aboutsummaryrefslogtreecommitdiff
path: root/kyra
diff options
context:
space:
mode:
authorOystein Eftevaag2006-01-13 03:27:01 +0000
committerOystein Eftevaag2006-01-13 03:27:01 +0000
commitd47ae2ca9f8326dc05f95c23f6e7ee8ffa132445 (patch)
treee334b0dec0c9333e7c8e54a1b623f37c6555908e /kyra
parent37e82c8c46fa40a85f64549158a5708942bfbeb1 (diff)
downloadscummvm-rg350-d47ae2ca9f8326dc05f95c23f6e7ee8ffa132445.tar.gz
scummvm-rg350-d47ae2ca9f8326dc05f95c23f6e7ee8ffa132445.tar.bz2
scummvm-rg350-d47ae2ca9f8326dc05f95c23f6e7ee8ffa132445.zip
Implemented a few drawing functions used by the menu, corrected a few incorrect
opcode debug messages, and blocked unnecessary sprite anim script looping. svn-id: r19992
Diffstat (limited to 'kyra')
-rw-r--r--kyra/gui.cpp6
-rw-r--r--kyra/kyra.cpp1
-rw-r--r--kyra/kyra.h2
-rw-r--r--kyra/screen.cpp73
-rw-r--r--kyra/screen.h3
-rw-r--r--kyra/script_v1.cpp6
-rw-r--r--kyra/sprites.cpp2
-rw-r--r--kyra/staticres.cpp2
8 files changed, 91 insertions, 4 deletions
diff --git a/kyra/gui.cpp b/kyra/gui.cpp
index 84b8df406e..1d28182425 100644
--- a/kyra/gui.cpp
+++ b/kyra/gui.cpp
@@ -289,5 +289,11 @@ void KyraEngine::processButton(Button *button) {
(this->*callback)(button);
}
}
+
+int KyraEngine::buttonMenuCallback(Button *caller) {
+ warning("Menu not implemented yet!");
+ return 0;
+}
+
} // end of namespace Kyra
diff --git a/kyra/kyra.cpp b/kyra/kyra.cpp
index d680d58508..6d4f2dc100 100644
--- a/kyra/kyra.cpp
+++ b/kyra/kyra.cpp
@@ -5546,6 +5546,7 @@ int KyraEngine::processSceneChange(int *table, int unk1, int frameReset) {
uint32 nextFrame = 0;
_abortWalkFlag = false;
_mousePressFlag = false;
+
while (running) {
if (_abortWalkFlag) {
*table = 8;
diff --git a/kyra/kyra.h b/kyra/kyra.h
index bf1821d741..eb2ef3c7f3 100644
--- a/kyra/kyra.h
+++ b/kyra/kyra.h
@@ -597,6 +597,8 @@ protected:
int buttonInventoryCallback(Button *caller);
int buttonAmuletCallback(Button *caller);
+ int buttonMenuCallback(Button *caller);
+
Button *initButton(Button *list, Button *newButton);
void processButtonList(Button *list);
void processButton(Button *button);
diff --git a/kyra/screen.cpp b/kyra/screen.cpp
index c9d6a08687..aeeb374f19 100644
--- a/kyra/screen.cpp
+++ b/kyra/screen.cpp
@@ -435,6 +435,79 @@ void Screen::fillRect(int x1, int y1, int x2, int y2, uint8 color, int pageNum)
}
}
+void Screen::drawBox(int x1, int y1, int x2, int y2, int color1, int color2) {
+ debug(9, "Screen::drawBox(%i, %i, %i, %i, %i, %i)", x1, y1, x2, y2, color1, color2);
+
+ //if (_menuUnk1 == 0)
+ //return;
+
+ hideMouse();
+
+ fillRect(x1, y1, x2, y1 + 1, color1);
+ fillRect(x2 - 1, y1, x2, y2, color1);
+
+ drawClippedLine(x1, y1, x1, y2, color2);
+ drawClippedLine(x1 + 1, y1 + 1, x1 + 1, y2 - 1, color2);
+ drawClippedLine(x1, y2, x2, y2, color2);
+ drawClippedLine(x1, y2 - 1, x2 - 1, y2 - 1, color2);
+
+ showMouse();
+}
+
+void Screen::drawClippedLine(int x1, int y1, int x2, int y2, int color) {
+ debug(9, "Screen::drawClippedLine(%i, %i, %i, %i, %i)", x1, y1, x2, y2, color);
+
+ if (x1 < 0)
+ x1 = 0;
+ else if (x1 > 319)
+ x1 = 319;
+
+ if (x2 < 0)
+ x2 = 0;
+ else if (x2 > 319)
+ x2 = 319;
+
+ if (y1 < 0)
+ y1 = 0;
+ else if (y1 > 199)
+ y1 = 199;
+
+ if (y2 < 0)
+ y2 = 0;
+ else if (y2 > 199)
+ y2 = 199;
+
+ if (x1 == x2)
+ if (y1 > y2)
+ drawLine(true, x1, y2, y1 - y2 + 1, color);
+ else
+ drawLine(true, x1, y1, y2 - y1 + 1, color);
+ else
+ if (x1 > x2)
+ drawLine(false, x2, y1, x1 - x2 + 1, color);
+ else
+ drawLine(false, x1, y1, x2 - x1 + 1, color);
+}
+
+void Screen::drawLine(bool horizontal, int x, int y, int length, int color) {
+ debug(9, "Screen::drawLine(%i, %i, %i, %i, %i)", horizontal, x, y, length, color);
+
+ uint8 *ptr = getPagePtr(_curPage) + y * SCREEN_W + x;
+
+ if (horizontal) {
+ assert((y + length) <= SCREEN_H);
+ int currLine = 0;
+ while (currLine < length) {
+ *ptr = color;
+ ptr += SCREEN_W;
+ currLine++;
+ }
+ } else {
+ assert((x + length) <= SCREEN_W);
+ memset(ptr, color, length);
+ }
+}
+
void Screen::setAnimBlockPtr(int size) {
debug(9, "Screen::setAnimBlockPtr(%d)", size);
free(_animBlockPtr);
diff --git a/kyra/screen.h b/kyra/screen.h
index fbf00c23f0..1bc769ec18 100644
--- a/kyra/screen.h
+++ b/kyra/screen.h
@@ -107,6 +107,9 @@ public:
void copyCurPageBlock(int x, int y, int w, int h, uint8 *dst);
void shuffleScreen(int sx, int sy, int w, int h, int srcPage, int dstPage, int ticks, bool transparent);
void fillRect(int x1, int y1, int x2, int y2, uint8 color, int pageNum = -1);
+ void drawLine(bool horizontal, int x, int y, int length, int color);
+ void drawClippedLine(int x1, int y1, int x2, int y2, int color);
+ void drawBox(int x1, int y1, int x2, int y2, int color1, int color2);
void setAnimBlockPtr(int size);
void setTextColorMap(const uint8 *cmap);
void setTextColor(const uint8 *cmap, int a, int b);
diff --git a/kyra/script_v1.cpp b/kyra/script_v1.cpp
index c4544ccb4c..3d7956f894 100644
--- a/kyra/script_v1.cpp
+++ b/kyra/script_v1.cpp
@@ -1215,7 +1215,7 @@ int KyraEngine::cmd_setFireberryGlowPalette(ScriptState *script) {
}
int KyraEngine::cmd_setDeathHandlerFlag(ScriptState *script) {
- debug(3, "cmd_drinkPotionAnimation(0x%X) (%d)", script, stackPos(0));
+ debug(3, "cmd_setDeathHandlerFlag(0x%X) (%d)", script, stackPos(0));
_deathHandler = stackPos(0);
return 0;
}
@@ -1375,7 +1375,7 @@ int KyraEngine::cmd_setSceneAnimCurrXY(ScriptState *script) {
}
int KyraEngine::cmd_poisonBrandonAndRemaps(ScriptState *script) {
- debug(3, "cmd_setSceneAnimCurrXY(0x%X) ()", script);
+ debug(3, "cmd_poisonBrandonAndRemaps(0x%X) ()", script);
setBrandonPoisonFlags(1);
return 0;
}
@@ -1440,7 +1440,7 @@ int KyraEngine::cmd_totalItemsInScene(ScriptState *script) {
}
int KyraEngine::cmd_restoreBrandonsMovementDelay(ScriptState *script) {
- debug(3, "cmd_restoreBrandonsMovemenyDelay(0x%X) ()", script);
+ debug(3, "cmd_restoreBrandonsMovementDelay(0x%X) ()", script);
//TODO: Use movement set by menu, instead of 5.
setTimerDelay(5, 5);
return 0;
diff --git a/kyra/sprites.cpp b/kyra/sprites.cpp
index 3e9f3e6064..243d84e191 100644
--- a/kyra/sprites.cpp
+++ b/kyra/sprites.cpp
@@ -136,6 +136,8 @@ void Sprites::updateSceneAnims() {
if (_anims[i].reentry == 0) {
data = _anims[i].script;
+ if (READ_LE_UINT16(data) == 0xFF8B)
+ continue;
} else {
data = _anims[i].reentry;
_anims[i].reentry = 0;
diff --git a/kyra/staticres.cpp b/kyra/staticres.cpp
index dc6fc4662e..ea848f9964 100644
--- a/kyra/staticres.cpp
+++ b/kyra/staticres.cpp
@@ -714,7 +714,7 @@ const uint8 KyraEngine::_itemPosY[] = {
Button KyraEngine::_buttonData[] = {
{ 0, 0x02, /*XXX,*/0, 0, 0, /*XXX,*/ 0x0400, 0, 0, 0, 0, 0, 0, 0, 0x05D, 0x9E, 0x13, 0x14, /*XXX,*/ 0, &KyraEngine::buttonInventoryCallback/*, XXX*/ },
- { 0, 0x01, /*XXX,*/1, 1, 1, /*XXX,*/ 0x0487, 0, 0, 0, 0, 0, 0, 0, 0x009, 0xA4, 0x36, 0x1E, /*XXX,*/ 0, 0/*opt_handleMenu, XXX*/ },
+ { 0, 0x01, /*XXX,*/1, 1, 1, /*XXX,*/ 0x0487, 0, 0, 0, 0, 0, 0, 0, 0x009, 0xA4, 0x36, 0x1E, /*XXX,*/ 0, &KyraEngine::buttonMenuCallback/*, XXX*/ },
{ 0, 0x03, /*XXX,*/0, 0, 0, /*XXX,*/ 0x0400, 0, 0, 0, 0, 0, 0, 0, 0x071, 0x9E, 0x13, 0x14, /*XXX,*/ 0, &KyraEngine::buttonInventoryCallback/*, XXX*/ },
{ 0, 0x04, /*XXX,*/0, 0, 0, /*XXX,*/ 0x0400, 0, 0, 0, 0, 0, 0, 0, 0x085, 0x9E, 0x13, 0x14, /*XXX,*/ 0, &KyraEngine::buttonInventoryCallback/*, XXX*/ },
{ 0, 0x05, /*XXX,*/0, 0, 0, /*XXX,*/ 0x0400, 0, 0, 0, 0, 0, 0, 0, 0x099, 0x9E, 0x13, 0x14, /*XXX,*/ 0, &KyraEngine::buttonInventoryCallback/*, XXX*/ },