aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTravis Howell2006-04-08 12:06:52 +0000
committerTravis Howell2006-04-08 12:06:52 +0000
commit655b85bc84dfbc239c762b2e268824305787b83d (patch)
tree0d72f25adb7f3d3ac39cdca8a151e060c9c639a9
parente7a8bb6abff3a6bee3b28aa5a599912df43ed120 (diff)
downloadscummvm-rg350-655b85bc84dfbc239c762b2e268824305787b83d.tar.gz
scummvm-rg350-655b85bc84dfbc239c762b2e268824305787b83d.tar.bz2
scummvm-rg350-655b85bc84dfbc239c762b2e268824305787b83d.zip
Add FF difference in addTextBox() and minor cleanup
svn-id: r21690
-rw-r--r--engines/simon/debug.h6
-rw-r--r--engines/simon/icons.cpp56
-rw-r--r--engines/simon/items.cpp26
-rw-r--r--engines/simon/oracle.cpp4
-rw-r--r--engines/simon/simon.h22
-rw-r--r--engines/simon/verb.cpp7
6 files changed, 72 insertions, 49 deletions
diff --git a/engines/simon/debug.h b/engines/simon/debug.h
index e510ffefd4..fdcb2c3fcb 100644
--- a/engines/simon/debug.h
+++ b/engines/simon/debug.h
@@ -1197,10 +1197,10 @@ static const char *const feeblefiles_opcode_name_table[256] = {
"BJ|IS_BIT2_CLEAR",
"BJ|IS_BIT2_SET",
NULL,
- NULL,
+ "W|HYPERLINK_ON",
/* 172 */
- NULL,
- NULL,
+ "|HYPERLINK_OFF",
+ "|CHECK_PATHS",
NULL,
"|VGA_POINTER_OP_1",
/* 176 */
diff --git a/engines/simon/icons.cpp b/engines/simon/icons.cpp
index 32224f8904..b04213742a 100644
--- a/engines/simon/icons.cpp
+++ b/engines/simon/icons.cpp
@@ -223,19 +223,20 @@ void SimonEngine::drawIconArray(uint num, Item *itemRef, int line, int classMask
void SimonEngine::drawIconArray_Simon(uint num, Item *itemRef, int line, int classMask) {
Item *item_ptr_org = itemRef;
WindowBlock *window;
- uint width_div_3, height_div_3;
- uint j, k, i, num_sibs_with_flag;
- bool item_again;
+ uint width, height;
+ uint k, i, curWidth;
+ bool item_again, showArrows;
uint x_pos, y_pos;
+ const int iconSize = (getGameType() == GType_SIMON1) ? 1 : 20;
window = _windowArray[num & 7];
if (getGameType() == GType_SIMON1) {
- width_div_3 = window->width / 3;
- height_div_3 = window->height / 3;
+ width = window->width / 3;
+ height = window->height / 3;
} else {
- width_div_3 = 100;
- height_div_3 = 40;
+ width = 100;
+ height = 40;
}
i = 0;
@@ -256,14 +257,10 @@ void SimonEngine::drawIconArray_Simon(uint num, Item *itemRef, int line, int cla
itemRef = derefItem(itemRef->child);
while (itemRef && line-- != 0) {
- num_sibs_with_flag = 0;
- while (itemRef && width_div_3 > num_sibs_with_flag) {
+ curWidth = 0;
+ while (itemRef && width > curWidth) {
if ((classMask == 0 || itemRef->classFlags & classMask) && has_item_childflag_0x10(itemRef))
- if (getGameType() == GType_SIMON1) {
- num_sibs_with_flag++;
- } else {
- num_sibs_with_flag += 20;
- }
+ curWidth += iconSize;
itemRef = derefItem(itemRef->sibling);
}
}
@@ -275,9 +272,9 @@ void SimonEngine::drawIconArray_Simon(uint num, Item *itemRef, int line, int cla
x_pos = 0;
y_pos = 0;
- item_again = false;
k = 0;
- j = 0;
+ item_again = false;
+ showArrows = false;
while (itemRef) {
if ((classMask == 0 || itemRef->classFlags & classMask) && has_item_childflag_0x10(itemRef)) {
@@ -295,15 +292,14 @@ void SimonEngine::drawIconArray_Simon(uint num, Item *itemRef, int line, int cla
k++;
} else {
window->iconPtr->iconArray[k].item = NULL;
- j = 1;
+ showArrows = 1;
}
- x_pos += (getGameType() == GType_SIMON1) ? 1 : 20;
- if (x_pos >= width_div_3) {
+ x_pos += iconSize;
+ if (x_pos >= width) {
x_pos = 0;
-
- y_pos += (getGameType() == GType_SIMON1) ? 1 : 20;
- if (y_pos >= height_div_3)
+ y_pos += iconSize;
+ if (y_pos >= height)
item_again = true;
}
}
@@ -312,8 +308,11 @@ void SimonEngine::drawIconArray_Simon(uint num, Item *itemRef, int line, int cla
window->iconPtr->iconArray[k].item = NULL;
- if (j != 0 || window->iconPtr->line != 0) {
- addArrows(window, num);
+ if (showArrows != 0 || window->iconPtr->line != 0) {
+ /* Plot arrows and add their boxes */
+ window->iconPtr->upArrow = _scrollUpHitArea;
+ window->iconPtr->downArrow = _scrollDownHitArea;
+ defineArrowBoxes(window);
}
}
@@ -414,17 +413,14 @@ l1:; itemRef = derefItem(itemRef->sibling);
if ((xp == 188) && (yp == 358))
_variableArray[31] = 0;
}
- addArrows(window, num); /* Plot arrows and add their boxes */
-}
-
-void SimonEngine::addArrows(WindowBlock *window, uint num) {
- setArrowHitAreas(window, num);
+ /* Plot arrows and add their boxes */
window->iconPtr->upArrow = _scrollUpHitArea;
window->iconPtr->downArrow = _scrollDownHitArea;
+ defineArrowBoxes(window);
}
-void SimonEngine::setArrowHitAreas(WindowBlock *window, uint num) {
+void SimonEngine::defineArrowBoxes(WindowBlock *window) {
HitArea *ha;
ha = findEmptyHitArea();
diff --git a/engines/simon/items.cpp b/engines/simon/items.cpp
index bfa672c7a9..806f2ded2c 100644
--- a/engines/simon/items.cpp
+++ b/engines/simon/items.cpp
@@ -302,6 +302,7 @@ void SimonEngine::setupOpcodes() {
break;
case GType_FF:
opcode_table[37] = &SimonEngine::o3_jumpOut;
+ opcode_table[65] = &SimonEngine::o3_addTextBox;
opcode_table[70] = &SimonEngine::o3_printLongText;
opcode_table[83] = &SimonEngine::o2_rescan;
opcode_table[98] = &SimonEngine::o2_animate;
@@ -661,7 +662,7 @@ void SimonEngine::o1_addTextBox() {
int h = getVarOrWord();
int number = getVarOrByte();
if (number < 20)
- addNewHitArea(id, x, y, w, h, (number << 8) + 129, 0xD0, _dummyItem2);
+ defineBox(id, x, y, w, h, (number << 8) + 129, 208, _dummyItem2);
}
void SimonEngine::o1_setShortText() {
@@ -901,7 +902,7 @@ void SimonEngine::o1_addBox() {
verb += 0x4000;
x -= 1000;
}
- addNewHitArea(id, x, y, w, h, flags, verb, item);
+ defineBox(id, x, y, w, h, flags, verb, item);
}
void SimonEngine::o1_delBox() {
@@ -1404,6 +1405,27 @@ void SimonEngine::o3_jumpOut() {
setScriptReturn(1);
}
+void SimonEngine::o3_addTextBox() {
+ // 65: add hit area
+ uint flags = kBFTextBox | kBFBoxItem;
+ uint id = getVarOrWord();
+ uint params = id / 1000;
+ uint x, y, w, h, num;
+
+ id %= 1000;
+
+ if (params & 1)
+ flags |= kBFInvertTouch;
+
+ x = getVarOrWord();
+ y = getVarOrWord();
+ w = getVarOrWord();
+ h = getVarOrWord();
+ num = getVarOrByte();
+ if (num < 20)
+ defineBox(id, x, y, w, h, flags + (num << 8), 208, _dummyItem1);
+}
+
void SimonEngine::o3_printLongText() {
// 70: show string from array
int num = getVarOrByte();
diff --git a/engines/simon/oracle.cpp b/engines/simon/oracle.cpp
index 0a54eceddc..4980646cd9 100644
--- a/engines/simon/oracle.cpp
+++ b/engines/simon/oracle.cpp
@@ -34,7 +34,7 @@ void SimonEngine::checkLinkBox() { // Check for boxes spilling over to next row
if (_hyperLink != 0) {
_variableArray[52] = _textWindow->x + _textWindow->textColumn - _variableArray[50];
if (_variableArray[52] != 0) {
- addNewHitArea(_variableArray[53], _variableArray[50], _variableArray[51], _variableArray[52], 15, 145, 208, _dummyItem1);
+ defineBox(_variableArray[53], _variableArray[50], _variableArray[51], _variableArray[52], 15, 145, 208, _dummyItem1);
_variableArray[53]++;
}
_variableArray[50] = _textWindow->x;
@@ -57,7 +57,7 @@ void SimonEngine::hyperLinkOff() {
return;
_variableArray[52] = _textWindow->x + _textWindow->textColumn - _variableArray[50];
- addNewHitArea(_variableArray[53], _variableArray[50], _variableArray[51], _variableArray[52], 15, 145, 208, _dummyItem1);
+ defineBox(_variableArray[53], _variableArray[50], _variableArray[51], _variableArray[52], 15, 145, 208, _dummyItem1);
_variableArray[53]++;
_hyperLink = 0;
}
diff --git a/engines/simon/simon.h b/engines/simon/simon.h
index f8ee3320ed..25911adaed 100644
--- a/engines/simon/simon.h
+++ b/engines/simon/simon.h
@@ -565,7 +565,7 @@ protected:
void moveBox(uint hitarea, int x, int y);
bool is_hitarea_0x40_clear(uint hitarea);
void delete_hitarea(uint hitarea);
- void addNewHitArea(int id, int x, int y, int width, int height, int flags, int unk3, Item *item_ptr);
+ void defineBox(int id, int x, int y, int width, int height, int flags, int verb, Item *item_ptr);
HitArea *findEmptyHitArea();
void resetVerbs();
void setVerb(HitArea * ha);
@@ -623,10 +623,6 @@ protected:
void mouseOff();
void mouseOn();
- void drawIconArray(uint i, Item *item_ptr, int line, int classMask);
- void drawIconArray_FF(uint i, Item *item_ptr, int line, int classMask);
- void drawIconArray_Simon(uint i, Item *item_ptr, int line, int classMask);
-
void loadTextIntoMem(uint stringId);
void loadTablesIntoMem(uint subr_id);
@@ -646,10 +642,12 @@ protected:
void clearName();
void endCutscene();
void runSubroutine101();
+
void checkUp(WindowBlock *window);
void checkDown(WindowBlock *window);
void inventoryUp(WindowBlock *window);
void inventoryDown(WindowBlock *window);
+
void resetNameWindow();
void printVerbOf(uint hitarea_id);
HitArea *findHitAreaByID(uint hitarea_id);
@@ -672,12 +670,17 @@ protected:
void pollMouseXY();
void drawMousePointer();
- void removeIconArray(uint num);
+ void defineArrowBoxes(WindowBlock *window);
+ void removeArrows(WindowBlock *window, uint num);
+
void draw_icon_c(WindowBlock *window, uint icon, uint x, uint y);
bool has_item_childflag_0x10(Item *item);
uint itemGetIconNumber(Item *item);
uint setupIconHitArea(WindowBlock *window, uint num, uint x, uint y, Item *item_ptr);
- void addArrows(WindowBlock *window, uint num);
+ void drawIconArray(uint i, Item *item_ptr, int line, int classMask);
+ void drawIconArray_FF(uint i, Item *item_ptr, int line, int classMask);
+ void drawIconArray_Simon(uint i, Item *item_ptr, int line, int classMask);
+ void removeIconArray(uint num);
void loadIconData();
void loadIconFile();
@@ -709,8 +712,6 @@ protected:
void renderStringAmiga(uint vga_sprite_id, uint color, uint width, uint height, const char *txt);
void renderString(uint vga_sprite_id, uint color, uint width, uint height, const char *txt);
- void setArrowHitAreas(WindowBlock *window, uint num);
-
byte *setup_vga_destination(uint32 size);
void vga_buf_unk_proc3(byte *end);
void vga_buf_unk_proc1(byte *end);
@@ -967,6 +968,7 @@ public:
// Opcodes, Feeble Files
void o3_jumpOut();
+ void o3_addTextBox();
void o3_printLongText();
void o3_oracleTextDown();
void o3_oracleTextUp();
@@ -1001,7 +1003,6 @@ protected:
void horizontalScroll(VC10_state *state);
void verticalScroll(VC10_state *state);
-
void delete_vga_timer(VgaTimerEntry * vte);
void vcResumeSprite(const byte *code_ptr, uint16 cur_file, uint16 cur_sprite);
int vcReadVarOrWord();
@@ -1032,7 +1033,6 @@ protected:
void video_copy_if_flag_0x8_c(WindowBlock *window);
void delete_hitarea_by_index(uint index);
- void removeArrows(WindowBlock *window, uint num);
void windowPutChar(uint a);
void restoreWindow(WindowBlock *window);
diff --git a/engines/simon/verb.cpp b/engines/simon/verb.cpp
index aa5f1a41de..e12f41e3c7 100644
--- a/engines/simon/verb.cpp
+++ b/engines/simon/verb.cpp
@@ -381,7 +381,7 @@ bool SimonEngine::is_hitarea_0x40_clear(uint hitarea) {
return (ha->flags & kBFBoxDead) == 0;
}
-void SimonEngine::addNewHitArea(int id, int x, int y, int width, int height, int flags, int verb, Item *item_ptr) {
+void SimonEngine::defineBox(int id, int x, int y, int width, int height, int flags, int verb, Item *item_ptr) {
HitArea *ha;
delete_hitarea(id);
@@ -395,6 +395,11 @@ void SimonEngine::addNewHitArea(int id, int x, int y, int width, int height, int
ha->verb = verb;
ha->item_ptr = item_ptr;
+ if (getGameType() == GType_FF && (ha->flags & kBFHyperBox)) {
+ // TODO
+ ha->priority = 50;
+ }
+
_needHitAreaRecalc++;
}