diff options
author | Travis Howell | 2006-04-05 02:45:28 +0000 |
---|---|---|
committer | Travis Howell | 2006-04-05 02:45:28 +0000 |
commit | 935ea28e7ab107fe172fae16f50db7bda7fd591d (patch) | |
tree | 40353f82f7d39499f4722cf8aaf07f6d775bf90b /engines | |
parent | 9394430ea8aad1ada90cca0179bf78d111b2509e (diff) | |
download | scummvm-rg350-935ea28e7ab107fe172fae16f50db7bda7fd591d.tar.gz scummvm-rg350-935ea28e7ab107fe172fae16f50db7bda7fd591d.tar.bz2 scummvm-rg350-935ea28e7ab107fe172fae16f50db7bda7fd591d.zip |
Renames structures and other cleanup
svn-id: r21626
Diffstat (limited to 'engines')
-rw-r--r-- | engines/simon/charset.cpp | 106 | ||||
-rw-r--r-- | engines/simon/icons.cpp | 36 | ||||
-rw-r--r-- | engines/simon/intern.h | 23 | ||||
-rw-r--r-- | engines/simon/items.cpp | 28 | ||||
-rw-r--r-- | engines/simon/module.mk | 2 | ||||
-rw-r--r-- | engines/simon/saveload.cpp | 4 | ||||
-rw-r--r-- | engines/simon/simon.cpp | 222 | ||||
-rw-r--r-- | engines/simon/simon.h | 54 | ||||
-rw-r--r-- | engines/simon/verb.cpp | 62 |
9 files changed, 268 insertions, 269 deletions
diff --git a/engines/simon/charset.cpp b/engines/simon/charset.cpp index bf0092d405..c8ee4ca3f4 100644 --- a/engines/simon/charset.cpp +++ b/engines/simon/charset.cpp @@ -59,7 +59,7 @@ void SimonEngine::print_char_helper_1(const byte *src, uint len) { } } } else { - if (*src != 12 && _textWindow->fcs_data != NULL && + if (*src != 12 && _textWindow->iconPtr != NULL && _fcsData1[ind = get_fcs_ptr_3_index(_textWindow)] != 2) { _fcsData1[ind] = 2; @@ -71,19 +71,19 @@ void SimonEngine::print_char_helper_1(const byte *src, uint len) { } } -void SimonEngine::print_char_helper_5(FillOrCopyStruct *fcs) { - uint index = get_fcs_ptr_3_index(fcs); +void SimonEngine::print_char_helper_5(WindowBlock *window) { + uint index = get_fcs_ptr_3_index(window); print_char_helper_6(index); _fcsData1[index] = 0; } void SimonEngine::print_char_helper_6(uint i) { - FillOrCopyStruct *fcs; + WindowBlock *window; if (_fcsData2[i]) { mouseOff(); - fcs = _windowArray[i]; - drawIconArray(i, fcs->fcs_data->item_ptr, fcs->fcs_data->unk1, fcs->fcs_data->unk2); + window = _windowArray[i]; + drawIconArray(i, window->iconPtr->itemRef, window->iconPtr->line, window->iconPtr->classMask); _fcsData2[i] = 0; mouseOn(); } @@ -346,82 +346,82 @@ void SimonEngine::showmessage_helper_3(uint a, uint b) { _newLines = 0; } -void SimonEngine::video_putchar(FillOrCopyStruct *fcs, byte c, byte b) { +void SimonEngine::video_putchar(WindowBlock *window, byte c, byte b) { byte width = 6; if (c == 12) { - clearWindow(fcs); + clearWindow(window); } else if (c == 13 || c == 10) { - video_putchar_newline(fcs); + video_putchar_newline(window); } else if ((c == 1 && _language != Common::HB_ISR) || (c == 8)) { if (_language == Common::HB_ISR) { //Hebrew if (b >= 64 && b < 91) width = _hebrew_char_widths [b - 64]; - if (fcs->textLength != 0) { - fcs->textLength--; - fcs->textColumnOffset += width; - if (fcs->textColumnOffset >= 8) { - fcs->textColumnOffset -= 8; - fcs->textColumn--; + if (window->textLength != 0) { + window->textLength--; + window->textColumnOffset += width; + if (window->textColumnOffset >= 8) { + window->textColumnOffset -= 8; + window->textColumn--; } } } else { int8 val = (c == 8) ? 6 : 4; - if (fcs->textLength != 0) { - fcs->textLength--; - fcs->textColumnOffset -= val; - if ((int8)fcs->textColumnOffset < val) { - fcs->textColumnOffset += 8; - fcs->textColumn--; + if (window->textLength != 0) { + window->textLength--; + window->textColumnOffset -= val; + if ((int8)window->textColumnOffset < val) { + window->textColumnOffset += 8; + window->textColumn--; } } } } else if (c >= 32) { if (getGameType() == GType_FF) { - video_putchar_drawchar(fcs, fcs->textColumn + fcs->x, fcs->textRow + fcs->y, c); - fcs->textColumn += feebleFontSize[c - 32]; + video_putchar_drawchar(window, window->textColumn + window->x, window->textRow + window->y, c); + window->textColumn += feebleFontSize[c - 32]; return; } - if (fcs->textLength == fcs->textMaxLength) { - video_putchar_newline(fcs); - } else if (fcs->textRow == fcs->height) { - video_putchar_newline(fcs); - fcs->textRow--; + if (window->textLength == window->textMaxLength) { + video_putchar_newline(window); + } else if (window->textRow == window->height) { + video_putchar_newline(window); + window->textRow--; } if (_language == Common::HB_ISR) { //Hebrew if (c >= 64 && c < 91) width = _hebrew_char_widths [c - 64]; - fcs->textColumnOffset -= width; - if (fcs->textColumnOffset >= width) { - fcs->textColumn++; - fcs->textColumnOffset += 8; + window->textColumnOffset -= width; + if (window->textColumnOffset >= width) { + window->textColumn++; + window->textColumnOffset += 8; } - video_putchar_drawchar(fcs, (fcs->width + fcs->x - fcs->textColumn) * 8, fcs->textRow * 8 + fcs->y, c); - fcs->textLength++; + video_putchar_drawchar(window, (window->width + window->x - window->textColumn) * 8, window->textRow * 8 + window->y, c); + window->textLength++; } else { - video_putchar_drawchar(fcs, (fcs->textColumn + fcs->x) * 8, fcs->textRow * 8 + fcs->y, c); + video_putchar_drawchar(window, (window->textColumn + window->x) * 8, window->textRow * 8 + window->y, c); - fcs->textLength++; - fcs->textColumnOffset += 6; + window->textLength++; + window->textColumnOffset += 6; if (c == 'i' || c == 'l') - fcs->textColumnOffset -= 2; + window->textColumnOffset -= 2; - if (fcs->textColumnOffset >= 8) { - fcs->textColumnOffset -= 8; - fcs->textColumn++; + if (window->textColumnOffset >= 8) { + window->textColumnOffset -= 8; + window->textColumn++; } } } } -void SimonEngine::video_putchar_newline(FillOrCopyStruct *fcs) { +void SimonEngine::video_putchar_newline(WindowBlock *window) { if (getGameType() == GType_FF) { if (_noOracleScroll == 0) { - if (fcs->textRow + 30 > fcs->height) { + if (window->textRow + 30 > window->height) { if (getBitFlag(94) == false) { _noOracleScroll = 1; if (getBitFlag(92) == true) { @@ -429,7 +429,7 @@ void SimonEngine::video_putchar_newline(FillOrCopyStruct *fcs) { checkLinkBox(); scrollOracle(); linksUp(); - fcs->scrollY++; + window->scrollY++; _oracleMaxScrollY++; } else { _oracleMaxScrollY++; @@ -437,7 +437,7 @@ void SimonEngine::video_putchar_newline(FillOrCopyStruct *fcs) { } } } else { - fcs->textRow += 15; + window->textRow += 15; checkLinkBox(); } } else { @@ -445,13 +445,13 @@ void SimonEngine::video_putchar_newline(FillOrCopyStruct *fcs) { checkLinkBox(); } } else { - if (fcs->textRow != fcs->height) - fcs->textRow++; + if (window->textRow != window->height) + window->textRow++; } - fcs->textColumnOffset = 0; - fcs->textLength = 0; - fcs->textColumn = 0; + window->textColumnOffset = 0; + window->textLength = 0; + window->textColumn = 0; } #ifdef PALMOS_68K @@ -1273,7 +1273,7 @@ static const byte video_font[] = { }; #endif -void SimonEngine::video_putchar_drawchar(FillOrCopyStruct *fcs, uint x, uint y, byte chr) { +void SimonEngine::video_putchar_drawchar(WindowBlock *window, uint x, uint y, byte chr) { const byte *src; byte color, *dst; uint h, i; @@ -1281,7 +1281,7 @@ void SimonEngine::video_putchar_drawchar(FillOrCopyStruct *fcs, uint x, uint y, _lockWord |= 0x8000; dst = getFrontBuf(); - dst += y * _dxSurfacePitch + x + fcs->textColumnOffset; + dst += y * _dxSurfacePitch + x + window->textColumnOffset; switch(_language) { case Common::RU_RUS: @@ -1312,7 +1312,7 @@ void SimonEngine::video_putchar_drawchar(FillOrCopyStruct *fcs, uint x, uint y, error("video_putchar_drawchar: Unknown language %d\n", _language); } - color = fcs->text_color; + color = window->text_color; h = 8; do { diff --git a/engines/simon/icons.cpp b/engines/simon/icons.cpp index 7ef94ca4fa..9e11eaa70f 100644 --- a/engines/simon/icons.cpp +++ b/engines/simon/icons.cpp @@ -73,7 +73,7 @@ void SimonEngine::loadIconData() { // Thanks to Stuart Caie for providing the original // C conversion upon which this function is based. -void decompress_icon_amiga (byte *dst, byte *src, byte base, uint pitch) { +void decompressIconAmiga (byte *dst, byte *src, byte base, uint pitch) { byte icon_pln[288]; byte *i, *o, x, y; @@ -114,7 +114,7 @@ void decompress_icon_amiga (byte *dst, byte *src, byte base, uint pitch) { } } -static void decompress_icon(byte *dst, byte *src, uint w, uint h_org, byte base, uint pitch) { +static void decompressIcon(byte *dst, byte *src, uint w, uint h_org, byte base, uint pitch) { int8 reps; byte color_1, color_2; byte *dst_org = dst; @@ -174,71 +174,71 @@ static void decompress_icon(byte *dst, byte *src, uint w, uint h_org, byte base, } -void SimonEngine::draw_icon_c(FillOrCopyStruct *fcs, uint icon, uint x, uint y) { +void SimonEngine::draw_icon_c(WindowBlock *window, uint icon, uint x, uint y) { byte *dst; byte *src; _lockWord |= 0x8000; dst = getFrontBuf(); - if (!(getGameType() == GType_SIMON2)) { + if (getGameType() == GType_SIMON1) { // Simon 1 - dst += (x + fcs->x) * 8; - dst += (y * 25 + fcs->y) * _dxSurfacePitch; + dst += (x + window->x) * 8; + dst += (y * 25 + window->y) * _dxSurfacePitch; if (getPlatform() == Common::kPlatformAmiga) { src = _iconFilePtr; src += READ_BE_UINT32(&((uint32 *)src)[icon]); - decompress_icon_amiga (dst, src, 0xE0, _dxSurfacePitch); + decompressIconAmiga (dst, src, 224, _dxSurfacePitch); } else { src = _iconFilePtr; src += READ_LE_UINT16(&((uint16 *)src)[icon]); - decompress_icon(dst, src, 24, 12, 0xE0, _dxSurfacePitch); + decompressIcon(dst, src, 24, 12, 224, _dxSurfacePitch); } } else { // Simon 2 dst += 110; dst += x; - dst += (y + fcs->y) * _dxSurfacePitch; + dst += (y + window->y) * _dxSurfacePitch; src = _iconFilePtr; src += READ_LE_UINT16(&((uint16 *)src)[icon * 2 + 0]); - decompress_icon(dst, src, 20, 10, 0xE0, _dxSurfacePitch); + decompressIcon(dst, src, 20, 10, 224, _dxSurfacePitch); src = _iconFilePtr; src += READ_LE_UINT16(&((uint16 *)src)[icon * 2 + 1]); - decompress_icon(dst, src, 20, 10, 0xD0, _dxSurfacePitch); + decompressIcon(dst, src, 20, 10, 208, _dxSurfacePitch); } _lockWord &= ~0x8000; } -uint SimonEngine::setup_icon_hit_area(FillOrCopyStruct *fcs, uint x, uint y, uint icon_number, +uint SimonEngine::setup_icon_hit_area(WindowBlock *window, uint x, uint y, uint icon_number, Item *item_ptr) { HitArea *ha; ha = findEmptyHitArea(); - if (!(getGameType() == GType_SIMON2)) { - ha->x = (x + fcs->x) << 3; - ha->y = y * 25 + fcs->y; + if (getGameType() == GType_SIMON1) { + ha->x = (x + window->x) * 8; + ha->y = y * 25 + window->y; ha->item_ptr = item_ptr; ha->width = 24; ha->height = 24; ha->flags = 0xB0; ha->id = 0x7FFD; ha->priority = 100; - ha->verb = 0xD0; + ha->verb = 208; } else { ha->x = x + 110; - ha->y = fcs->y + y; + ha->y = window->y + y; ha->item_ptr = item_ptr; ha->width = 20; ha->height = 20; ha->flags = 0xB0; ha->id = 0x7FFD; ha->priority = 100; - ha->verb = 0xD0; + ha->verb = 208; } return ha - _hitAreas; diff --git a/engines/simon/intern.h b/engines/simon/intern.h index da8215cf73..3f319a32ca 100644 --- a/engines/simon/intern.h +++ b/engines/simon/intern.h @@ -70,21 +70,20 @@ struct Subroutine { Subroutine *next; /* next subroutine in linked list */ }; -struct FillOrCopyDataEntry { +struct IconEntry { Item *item; - uint16 hit_area; - uint16 xxx_1; + uint16 boxCode; }; -struct FillOrCopyData { - int16 unk1; - Item *item_ptr; - FillOrCopyDataEntry e[64]; +struct IconBlock { + int16 line; + Item *itemRef; + IconEntry iconArray[64]; int16 upArrow, downArrow; - uint16 unk2; + uint16 classMask; }; -struct FillOrCopyStruct { +struct WindowBlock { byte mode; byte flags; uint16 x, y; @@ -92,9 +91,9 @@ struct FillOrCopyStruct { uint16 textColumn, textRow; uint16 textColumnOffset, textLength, textMaxLength; uint16 scrollY; - uint8 fill_color, text_color, unk5; - FillOrCopyData *fcs_data; - FillOrCopyStruct() { memset(this, 0, sizeof(*this)); } + uint8 fill_color, text_color; + IconBlock *iconPtr; + WindowBlock() { memset(this, 0, sizeof(*this)); } }; // note on text offset: // the actual x-coordinate is: textColumn * 8 + textColumnOffset diff --git a/engines/simon/items.cpp b/engines/simon/items.cpp index 09895acf4d..e6213a337c 100644 --- a/engines/simon/items.cpp +++ b/engines/simon/items.cpp @@ -1505,12 +1505,12 @@ void SimonEngine::o_confirmQuit() { } void SimonEngine::o_restoreIconArray(uint fcs_index) { - FillOrCopyStruct *fcs; + WindowBlock *window; - fcs = _windowArray[fcs_index & 7]; - if (fcs->fcs_data == NULL) + window = _windowArray[fcs_index & 7]; + if (window->iconPtr == NULL) return; - drawIconArray(fcs_index, fcs->fcs_data->item_ptr, fcs->fcs_data->unk1, fcs->fcs_data->unk2); + drawIconArray(fcs_index, window->iconPtr->itemRef, window->iconPtr->line, window->iconPtr->classMask); } void SimonEngine::o_freezeBottom() { @@ -1598,12 +1598,12 @@ void SimonEngine::o_unk_132_helper_3() { set_hitarea_bit_0x40(i); } -void SimonEngine::o_clearCharacter(FillOrCopyStruct *fcs, int x, byte b) { +void SimonEngine::o_clearCharacter(WindowBlock *window, int x, byte b) { byte old_text; - video_putchar(fcs, x, b); - old_text = fcs->text_color; - fcs->text_color = fcs->fill_color; + video_putchar(window, x, b); + old_text = window->text_color; + window->text_color = window->fill_color; if (_language == Common::HB_ISR) { //Hebrew x = 128; @@ -1614,10 +1614,10 @@ void SimonEngine::o_clearCharacter(FillOrCopyStruct *fcs, int x, byte b) { } - video_putchar(fcs, x); + video_putchar(window, x); - fcs->text_color = old_text; - video_putchar(fcs, 8); + window->text_color = old_text; + video_putchar(window, 8); } void SimonEngine::o_playMusic() { @@ -1665,10 +1665,10 @@ void SimonEngine::o_playSFX(uint sound_id) { } void SimonEngine::o_setTextColor(uint color) { - FillOrCopyStruct *fcs; + WindowBlock *window; - fcs = _windowArray[_curWindow]; - fcs->text_color = color; + window = _windowArray[_curWindow]; + window->text_color = color; } void SimonEngine::o_unk_103() { diff --git a/engines/simon/module.mk b/engines/simon/module.mk index be8787e70a..ef347080e8 100644 --- a/engines/simon/module.mk +++ b/engines/simon/module.mk @@ -13,8 +13,8 @@ MODULE_OBJS := \ oracle.o \ res.o \ saveload.o \ - sound.o \ simon.o \ + sound.o \ verb.o \ vga.o \ diff --git a/engines/simon/saveload.cpp b/engines/simon/saveload.cpp index ba5edbe134..c56ac38aab 100644 --- a/engines/simon/saveload.cpp +++ b/engines/simon/saveload.cpp @@ -180,7 +180,7 @@ void SimonEngine::saveOrLoadDialog(bool load) { int number_of_savegames; int i; int unk132_result; - FillOrCopyStruct *fcs; + WindowBlock *fcs; char *name; int name_len; bool b; @@ -350,7 +350,7 @@ get_out:; g_system->setFeatureState(OSystem::kFeatureVirtualKeyboard, false); } -void SimonEngine::o_fileError(FillOrCopyStruct *fcs, bool save_error) { +void SimonEngine::o_fileError(WindowBlock *fcs, bool save_error) { HitArea *ha; const char *string, *string2; diff --git a/engines/simon/simon.cpp b/engines/simon/simon.cpp index 794f12b5fb..c015585229 100644 --- a/engines/simon/simon.cpp +++ b/engines/simon/simon.cpp @@ -417,7 +417,7 @@ SimonEngine::SimonEngine(OSystem *syst) memset(_videoBuf1, 0, sizeof(_videoBuf1)); - _fcs_list = new FillOrCopyStruct[16]; + _fcs_list = new WindowBlock[16]; memset(_lettersToPrintBuf, 0, sizeof(_lettersToPrintBuf)); @@ -1083,7 +1083,7 @@ void SimonEngine::setItemParent(Item *item, Item *parent) { void SimonEngine::itemChildrenChanged(Item *item) { int i; - FillOrCopyStruct *fcs; + WindowBlock *window; if (_noParentNotify) return; @@ -1091,13 +1091,13 @@ void SimonEngine::itemChildrenChanged(Item *item) { mouseOff(); for (i = 0; i != 8; i++) { - fcs = _windowArray[i]; - if (fcs && fcs->fcs_data && fcs->fcs_data->item_ptr == item) { + window = _windowArray[i]; + if (window && window->iconPtr && window->iconPtr->itemRef == item) { if (_fcsData1[i]) { _fcsData2[i] = true; } else { _fcsData2[i] = false; - drawIconArray(i, item, fcs->fcs_data->unk1, fcs->fcs_data->unk2); + drawIconArray(i, item, window->iconPtr->line, window->iconPtr->classMask); } } } @@ -1624,9 +1624,9 @@ void SimonEngine::setup_cond_c_helper() { if (_lastHitArea == NULL) { } else if (_lastHitArea->id == 0x7FFB) { - inventoryUp(_lastHitArea->fcs); + inventoryUp(_lastHitArea->window); } else if (_lastHitArea->id == 0x7FFC) { - inventoryDown(_lastHitArea->fcs); + inventoryDown(_lastHitArea->window); } else if (_lastHitArea->item_ptr != NULL) { _hitAreaObjectItem = _lastHitArea->item_ptr; _variableArray[60] = (_lastHitArea->flags & 1) ? (_lastHitArea->flags / 256) : 0xFFFF; @@ -1654,11 +1654,11 @@ void SimonEngine::endCutscene() { _runScriptReturn1 = true; } -uint SimonEngine::get_fcs_ptr_3_index(FillOrCopyStruct *fcs) { +uint SimonEngine::get_fcs_ptr_3_index(WindowBlock *window) { uint i; for (i = 0; i != ARRAYSIZE(_windowArray); i++) - if (_windowArray[i] == fcs) + if (_windowArray[i] == window) return i; error("get_fcs_ptr_3_index: not found"); @@ -1776,9 +1776,9 @@ get_out: _needHitAreaRecalc = 0; } -void SimonEngine::drawIconArray(uint fcs_index, Item *item_ptr, int unk1, int unk2) { - Item *item_ptr_org = item_ptr; - FillOrCopyStruct *fcs_ptr; +void SimonEngine::drawIconArray(uint fcs_index, Item *itemRef, int line, int classMask) { + Item *item_ptr_org = itemRef; + WindowBlock *fcs_ptr; uint width_div_3, height_div_3; uint j, k, i, num_sibs_with_flag; bool item_again; @@ -1799,34 +1799,34 @@ void SimonEngine::drawIconArray(uint fcs_index, Item *item_ptr, int unk1, int un if (fcs_ptr == NULL) return; - if (fcs_ptr->fcs_data) + if (fcs_ptr->iconPtr) removeIconArray(fcs_index); - fcs_ptr->fcs_data = (FillOrCopyData *) malloc(sizeof(FillOrCopyData)); - fcs_ptr->fcs_data->item_ptr = item_ptr; - fcs_ptr->fcs_data->upArrow = -1; - fcs_ptr->fcs_data->downArrow = -1; - fcs_ptr->fcs_data->unk1 = unk1; - fcs_ptr->fcs_data->unk2 = unk2; + fcs_ptr->iconPtr = (IconBlock *) malloc(sizeof(IconBlock)); + fcs_ptr->iconPtr->itemRef = itemRef; + fcs_ptr->iconPtr->upArrow = -1; + fcs_ptr->iconPtr->downArrow = -1; + fcs_ptr->iconPtr->line = line; + fcs_ptr->iconPtr->classMask = classMask; - item_ptr = derefItem(item_ptr->child); + itemRef = derefItem(itemRef->child); - while (item_ptr && unk1-- != 0) { + while (itemRef && line-- != 0) { num_sibs_with_flag = 0; - while (item_ptr && width_div_3 > num_sibs_with_flag) { - if ((unk2 == 0 || item_ptr->classFlags & unk2) && has_item_childflag_0x10(item_ptr)) + while (itemRef && width_div_3 > num_sibs_with_flag) { + 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; } - item_ptr = derefItem(item_ptr->sibling); + itemRef = derefItem(itemRef->sibling); } } - if (item_ptr == NULL) { - fcs_ptr->fcs_data->unk1 = 0; - item_ptr = derefItem(item_ptr_org->child); + if (itemRef == NULL) { + fcs_ptr->iconPtr->line = 0; + itemRef = derefItem(item_ptr_org->child); } x_pos = 0; @@ -1835,23 +1835,23 @@ void SimonEngine::drawIconArray(uint fcs_index, Item *item_ptr, int unk1, int un k = 0; j = 0; - while (item_ptr) { - if ((unk2 == 0 || item_ptr->classFlags & unk2) && has_item_childflag_0x10(item_ptr)) { + while (itemRef) { + if ((classMask == 0 || itemRef->classFlags & classMask) && has_item_childflag_0x10(itemRef)) { if (item_again == false) { - fcs_ptr->fcs_data->e[k].item = item_ptr; + fcs_ptr->iconPtr->iconArray[k].item = itemRef; if (getGameType() == GType_SIMON1) { - draw_icon_c(fcs_ptr, item_get_icon_number(item_ptr), x_pos * 3, y_pos); - fcs_ptr->fcs_data->e[k].hit_area = + draw_icon_c(fcs_ptr, item_get_icon_number(itemRef), x_pos * 3, y_pos); + fcs_ptr->iconPtr->iconArray[k].boxCode = setup_icon_hit_area(fcs_ptr, x_pos * 3, y_pos, - item_get_icon_number(item_ptr), item_ptr); + item_get_icon_number(itemRef), itemRef); } else { - draw_icon_c(fcs_ptr, item_get_icon_number(item_ptr), x_pos, y_pos); - fcs_ptr->fcs_data->e[k].hit_area = - setup_icon_hit_area(fcs_ptr, x_pos, y_pos, item_get_icon_number(item_ptr), item_ptr); + draw_icon_c(fcs_ptr, item_get_icon_number(itemRef), x_pos, y_pos); + fcs_ptr->iconPtr->iconArray[k].boxCode = + setup_icon_hit_area(fcs_ptr, x_pos, y_pos, item_get_icon_number(itemRef), itemRef); } k++; } else { - fcs_ptr->fcs_data->e[k].item = NULL; + fcs_ptr->iconPtr->iconArray[k].item = NULL; j = 1; } x_pos += (getGameType() == GType_SIMON1) ? 1 : 20; @@ -1864,24 +1864,24 @@ void SimonEngine::drawIconArray(uint fcs_index, Item *item_ptr, int unk1, int un item_again = true; } } - item_ptr = derefItem(item_ptr->sibling); + itemRef = derefItem(itemRef->sibling); } - fcs_ptr->fcs_data->e[k].item = NULL; + fcs_ptr->iconPtr->iconArray[k].item = NULL; - if (j != 0 || fcs_ptr->fcs_data->unk1 != 0) { + if (j != 0 || fcs_ptr->iconPtr->line != 0) { addArrows(fcs_ptr, fcs_index); } } -void SimonEngine::addArrows(FillOrCopyStruct *fcs, uint fcs_index) { - setArrowHitAreas(fcs, fcs_index); +void SimonEngine::addArrows(WindowBlock *window, uint fcs_index) { + setArrowHitAreas(window, fcs_index); - fcs->fcs_data->upArrow = _scrollUpHitArea; - fcs->fcs_data->downArrow = _scrollDownHitArea; + window->iconPtr->upArrow = _scrollUpHitArea; + window->iconPtr->downArrow = _scrollDownHitArea; } -void SimonEngine::setArrowHitAreas(FillOrCopyStruct *fcs, uint fcs_index) { +void SimonEngine::setArrowHitAreas(WindowBlock *window, uint fcs_index) { HitArea *ha; ha = findEmptyHitArea(); @@ -1894,7 +1894,7 @@ void SimonEngine::setArrowHitAreas(FillOrCopyStruct *fcs, uint fcs_index) { ha->flags = 0x24; ha->id = 0x7FFB; ha->priority = 100; - ha->fcs = fcs; + ha->window = window; ha->verb = 1; } else { ha->x = 81; @@ -1904,7 +1904,7 @@ void SimonEngine::setArrowHitAreas(FillOrCopyStruct *fcs, uint fcs_index) { ha->flags = 36; ha->id = 0x7FFB; ha->priority = 100; - ha->fcs = fcs; + ha->window = window; ha->verb = 1; } @@ -1919,7 +1919,7 @@ void SimonEngine::setArrowHitAreas(FillOrCopyStruct *fcs, uint fcs_index) { ha->flags = 0x24; ha->id = 0x7FFC; ha->priority = 100; - ha->fcs = fcs; + ha->window = window; ha->verb = 1; // Simon1 specific @@ -1933,7 +1933,7 @@ void SimonEngine::setArrowHitAreas(FillOrCopyStruct *fcs, uint fcs_index) { ha->flags = 36; ha->id = 0x7FFC; ha->priority = 100; - ha->fcs = fcs; + ha->window = window; ha->verb = 1; } } @@ -2086,9 +2086,9 @@ startOver: if (ha == NULL) { } else if (ha->id == 0x7FFB) { - inventoryUp(ha->fcs); + inventoryUp(ha->window); } else if (ha->id == 0x7FFC) { - inventoryDown(ha->fcs); + inventoryDown(ha->window); } else if (ha->id >= 101 && ha->id < 113) { _verbHitArea = ha->verb; setVerb(ha); @@ -3023,27 +3023,27 @@ void SimonEngine::changeWindow(uint a) { } // OK -FillOrCopyStruct *SimonEngine::openWindow(uint x, uint y, uint w, uint h, uint flags, uint fill_color, uint text_color) { - FillOrCopyStruct *fcs; - - fcs = _fcs_list; - while (fcs->mode != 0) - fcs++; - - fcs->mode = 2; - fcs->x = x; - fcs->y = y; - fcs->width = w; - fcs->height = h; - fcs->flags = flags; - fcs->fill_color = fill_color; - fcs->text_color = text_color; - fcs->textColumn = 0; - fcs->textRow = 0; - fcs->textColumnOffset = 0; - fcs->textMaxLength = fcs->width * 8 / 6; // characters are 6 pixels - fcs->scrollY = 0; - return fcs; +WindowBlock *SimonEngine::openWindow(uint x, uint y, uint w, uint h, uint flags, uint fill_color, uint text_color) { + WindowBlock *window; + + window = _fcs_list; + while (window->mode != 0) + window++; + + window->mode = 2; + window->x = x; + window->y = y; + window->width = w; + window->height = h; + window->flags = flags; + window->fill_color = fill_color; + window->text_color = text_color; + window->textColumn = 0; + window->textRow = 0; + window->textColumnOffset = 0; + window->textMaxLength = window->width * 8 / 6; // characters are 6 pixels + window->scrollY = 0; + return window; } Item *SimonEngine::derefItem(uint item) { @@ -3102,43 +3102,43 @@ void SimonEngine::o_pathfind(int x, int y, uint var_1, uint var_2) { // ok void SimonEngine::removeIconArray(uint fcs_index) { - FillOrCopyStruct *fcs; + WindowBlock *window; uint16 fcsunk1; uint16 i; - fcs = _windowArray[fcs_index & 7]; + window = _windowArray[fcs_index & 7]; fcsunk1 = _curWindow; - if (fcs == NULL || fcs->fcs_data == NULL) + if (window == NULL || window->iconPtr == NULL) return; changeWindow(fcs_index); fcs_putchar(12); changeWindow(fcsunk1); - for (i = 0; fcs->fcs_data->e[i].item != NULL; i++) { - delete_hitarea_by_index(fcs->fcs_data->e[i].hit_area); + for (i = 0; window->iconPtr->iconArray[i].item != NULL; i++) { + delete_hitarea_by_index(window->iconPtr->iconArray[i].boxCode); } - if (fcs->fcs_data->upArrow != -1) { - delete_hitarea_by_index(fcs->fcs_data->upArrow); + if (window->iconPtr->upArrow != -1) { + delete_hitarea_by_index(window->iconPtr->upArrow); } - if (fcs->fcs_data->downArrow != -1) { - delete_hitarea_by_index(fcs->fcs_data->downArrow); + if (window->iconPtr->downArrow != -1) { + delete_hitarea_by_index(window->iconPtr->downArrow); if (getGameType() == GType_SIMON1) - removeArrows(fcs, fcs_index); + removeArrows(window, fcs_index); } - free(fcs->fcs_data); - fcs->fcs_data = NULL; + free(window->iconPtr); + window->iconPtr = NULL; _fcsData1[fcs_index] = 0; _fcsData2[fcs_index] = 0; } // ok -void SimonEngine::removeArrows(FillOrCopyStruct *fcs, uint fcs_index) { +void SimonEngine::removeArrows(WindowBlock *window, uint fcs_index) { o_kill_sprite_simon1(128); } @@ -3154,40 +3154,40 @@ void SimonEngine::fcs_putchar(uint a) { } // ok -void SimonEngine::clearWindow(FillOrCopyStruct *fcs) { - if (fcs->flags & 0x10) - restoreWindow(fcs); +void SimonEngine::clearWindow(WindowBlock *window) { + if (window->flags & 0x10) + restoreWindow(window); else - colorWindow(fcs); + colorWindow(window); - fcs->textColumn = 0; - fcs->textRow = 0; - fcs->textColumnOffset = 0; - fcs->textLength = 0; + window->textColumn = 0; + window->textRow = 0; + window->textColumnOffset = 0; + window->textLength = 0; } // ok -void SimonEngine::restoreWindow(FillOrCopyStruct *fcs) { +void SimonEngine::restoreWindow(WindowBlock *window) { _lockWord |= 0x8000; if (getGameType() == GType_SIMON1) { - restoreBlock(fcs->y + fcs->height * 8 + ((fcs == _windowArray[2]) ? 1 : 0), (fcs->x + fcs->width) * 8, fcs->y, fcs->x * 8); + restoreBlock(window->y + window->height * 8 + ((window == _windowArray[2]) ? 1 : 0), (window->x + window->width) * 8, window->y, window->x * 8); } else { - if (_restoreWindow6 && _windowArray[2] == fcs) { - fcs = _windowArray[6]; + if (_restoreWindow6 && _windowArray[2] == window) { + window = _windowArray[6]; _restoreWindow6 = 0; } if (getGameType() == GType_FF) - restoreBlock(fcs->y + fcs->height, fcs->x + fcs->width, fcs->y, fcs->x); + restoreBlock(window->y + window->height, window->x + window->width, window->y, window->x); else - restoreBlock(fcs->y + fcs->height * 8, (fcs->x + fcs->width) * 8, fcs->y, fcs->x * 8); + restoreBlock(window->y + window->height * 8, (window->x + window->width) * 8, window->y, window->x * 8); } _lockWord &= ~0x8000; } -void SimonEngine::colorWindow(FillOrCopyStruct *fcs) { +void SimonEngine::colorWindow(WindowBlock *window) { byte *dst; uint h, w; @@ -3196,17 +3196,17 @@ void SimonEngine::colorWindow(FillOrCopyStruct *fcs) { dst = getFrontBuf(); if (getGameType() == GType_FF) { - dst += _dxSurfacePitch * fcs->y + fcs->x; - h = fcs->height; - w = fcs->width; + dst += _dxSurfacePitch * window->y + window->x; + h = window->height; + w = window->width; } else { - dst += _dxSurfacePitch * fcs->y + fcs->x * 8; - h = fcs->height * 8; - w = fcs->width * 8; + dst += _dxSurfacePitch * window->y + window->x * 8; + h = window->height * 8; + w = window->width * 8; } do { - memset(dst, fcs->fill_color, w); + memset(dst, window->fill_color, w); dst += _dxSurfacePitch; } while (--h); @@ -3389,10 +3389,10 @@ void SimonEngine::video_toggle_colors(HitArea * ha, byte a, byte b, byte c, byte _lockWord &= ~0x8000; } -void SimonEngine::video_copy_if_flag_0x8_c(FillOrCopyStruct *fcs) { - if (fcs->flags & 8) - restoreWindow(fcs); - fcs->mode = 0; +void SimonEngine::video_copy_if_flag_0x8_c(WindowBlock *window) { + if (window->flags & 8) + restoreWindow(window); + window->mode = 0; } void SimonEngine::loadSprite(uint windowNum, uint fileId, uint vgaSpriteId, uint x, uint y, uint palette) { diff --git a/engines/simon/simon.h b/engines/simon/simon.h index 0d0356f4ac..eab05cb435 100644 --- a/engines/simon/simon.h +++ b/engines/simon/simon.h @@ -52,7 +52,7 @@ struct Child; struct Child2; struct Item; -struct FillOrCopyStruct; +struct WindowBlock; struct Subroutine; struct SubroutineLine; struct TimeEvent; @@ -67,7 +67,7 @@ struct HitArea { uint16 width, height; uint16 flags; uint16 id; - FillOrCopyStruct *fcs; + WindowBlock *window; Item *item_ptr; uint16 verb; uint16 priority; @@ -273,7 +273,7 @@ protected: int16 _scriptAdj1, _scriptAdj2; uint16 _curWindow; - FillOrCopyStruct *_textWindow; + WindowBlock *_textWindow; Item *_subjectItem, *_objectItem; Item *_item1; @@ -372,7 +372,7 @@ protected: uint16 _bitArray[48]; int16 _variableArray[256]; - FillOrCopyStruct *_windowArray[8]; + WindowBlock *_windowArray[8]; byte _fcsData1[8]; bool _fcsData2[8]; @@ -406,7 +406,7 @@ protected: VgaTimerEntry _vgaTimerList[95]; - FillOrCopyStruct *_fcs_list; + WindowBlock *_fcs_list; byte _lettersToPrintBuf[80]; @@ -611,7 +611,7 @@ protected: void mouseOff(); void mouseOn(); - void drawIconArray(uint i, Item *item_ptr, int unk1, int unk2); + void drawIconArray(uint i, Item *item_ptr, int line, int classMask); void loadTextIntoMem(uint string_id); void loadTablesIntoMem(uint subr_id); @@ -632,22 +632,22 @@ protected: void defocusHitarea(); void endCutscene(); void runSubroutine101(); - void checkUp(FillOrCopyStruct *fcs); - void checkDown(FillOrCopyStruct *fcs); - void inventoryUp(FillOrCopyStruct *fcs); - void inventoryDown(FillOrCopyStruct *fcs); + void checkUp(WindowBlock *window); + void checkDown(WindowBlock *window); + void inventoryUp(WindowBlock *window); + void inventoryDown(WindowBlock *window); void hitareaChangedHelper(); void focusVerb(uint hitarea_id); HitArea *findHitAreaByID(uint hitarea_id); void showActionString(uint x, const byte *string); - void video_putchar(FillOrCopyStruct *fcs, byte c, byte b = 0); - void clearWindow(FillOrCopyStruct *fcs); + void video_putchar(WindowBlock *window, byte c, byte b = 0); + void clearWindow(WindowBlock *window); void video_toggle_colors(HitArea * ha, byte a, byte b, byte c, byte d); void read_vga_from_datfile_1(uint vga_id); - uint get_fcs_ptr_3_index(FillOrCopyStruct *fcs); + uint get_fcs_ptr_3_index(WindowBlock *window); void setup_hitarea_from_pos(uint x, uint y, uint mode); void new_current_hitarea(HitArea * ha); @@ -661,11 +661,11 @@ protected: void drawMousePointer(); void removeIconArray(uint fcs_index); - void draw_icon_c(FillOrCopyStruct *fcs, uint icon, uint x, uint y); + void draw_icon_c(WindowBlock *window, uint icon, uint x, uint y); bool has_item_childflag_0x10(Item *item); uint item_get_icon_number(Item *item); - uint setup_icon_hit_area(FillOrCopyStruct *fcs, uint x, uint y, uint icon_number, Item *item_ptr); - void addArrows(FillOrCopyStruct *fcs, uint fcs_index); + uint setup_icon_hit_area(WindowBlock *window, uint x, uint y, uint icon_number, Item *item_ptr); + void addArrows(WindowBlock *window, uint fcs_index); void loadIconData(); void loadIconFile(); @@ -688,12 +688,12 @@ protected: void o_defineWindow(uint a, uint b, uint c, uint d, uint e, uint f, uint g, uint h); void playSpeech(uint speech_id, uint vga_sprite_id); void printText(uint vga_sprite_id, uint color, const char *string_ptr, int16 x, int16 y, int16 width); - FillOrCopyStruct *openWindow(uint x, uint y, uint w, uint h, uint flags, uint fill_color, uint text_color); + WindowBlock *openWindow(uint x, uint y, uint w, uint h, uint flags, uint fill_color, uint text_color); void render_string_amiga(uint vga_sprite_id, uint color, uint width, uint height, const char *txt); void render_string(uint vga_sprite_id, uint color, uint width, uint height, const char *txt); - void setArrowHitAreas(FillOrCopyStruct *fcs, uint fcs_index); + void setArrowHitAreas(WindowBlock *window, uint fcs_index); byte *setup_vga_destination(uint32 size); void vga_buf_unk_proc3(byte *end); @@ -827,14 +827,14 @@ protected: bool isSpriteLoaded(uint16 id, uint16 fileId); - void video_copy_if_flag_0x8_c(FillOrCopyStruct *fcs); + void video_copy_if_flag_0x8_c(WindowBlock *window); void delete_hitarea_by_index(uint index); - void removeArrows(FillOrCopyStruct *fcs, uint fcs_index); + void removeArrows(WindowBlock *window, uint fcs_index); void fcs_putchar(uint a); - void restoreWindow(FillOrCopyStruct *fcs); - void colorWindow(FillOrCopyStruct *fcs); + void restoreWindow(WindowBlock *window); + void colorWindow(WindowBlock *window); void restoreBlock(uint b, uint r, uint y, uint x); @@ -873,7 +873,7 @@ protected: void dx_copy_from_2_to_attached(uint x, uint y, uint w, uint h); void print_char_helper_1(const byte *src, uint len); - void print_char_helper_5(FillOrCopyStruct *fcs); + void print_char_helper_5(WindowBlock *window); void quickLoadOrSave(); void shutdown(); @@ -889,8 +889,8 @@ protected: void showmessage_helper_2(); void print_char_helper_6(uint i); - void video_putchar_newline(FillOrCopyStruct *fcs); - void video_putchar_drawchar(FillOrCopyStruct *fcs, uint x, uint y, byte chr); + void video_putchar_newline(WindowBlock *window); + void video_putchar_drawchar(WindowBlock *window, uint x, uint y, byte chr); void loadMusic(uint music); void checkTimerCallback(); @@ -916,9 +916,9 @@ protected: void saveOrLoadDialog(bool load); void o_unk_132_helper_3(); int o_unk_132_helper(bool *b, char *buf); - void o_clearCharacter(FillOrCopyStruct *fcs, int x, byte b = 0); + void o_clearCharacter(WindowBlock *window, int x, byte b = 0); void saveGameDialog(char *buf); - void o_fileError(FillOrCopyStruct *fcs, bool save_error); + void o_fileError(WindowBlock *window, bool save_error); int countSaveGames(); int displaySaveGameList(int curpos, bool load, char *dst); diff --git a/engines/simon/verb.cpp b/engines/simon/verb.cpp index 16213694d7..a8eb7d7f77 100644 --- a/engines/simon/verb.cpp +++ b/engines/simon/verb.cpp @@ -278,30 +278,30 @@ void SimonEngine::focusVerb(uint hitarea_id) { } void SimonEngine::showActionString(uint x, const byte *string) { - FillOrCopyStruct *fcs; + WindowBlock *window; - fcs = _windowArray[1]; - if (fcs == NULL || fcs->text_color == 0) + window = _windowArray[1]; + if (window == NULL || window->text_color == 0) return; - fcs->textColumn = x >> 3; - fcs->textColumnOffset = x & 7; + window->textColumn = x >> 3; + window->textColumnOffset = x & 7; for (; *string; string++) - video_putchar(fcs, *string); + video_putchar(window, *string); } void SimonEngine::hitareaChangedHelper() { - FillOrCopyStruct *fcs; + WindowBlock *window; if (getGameType() == GType_SIMON2) { if (getBitFlag(79)) return; } - fcs = _windowArray[1]; - if (fcs != NULL && fcs->text_color != 0) - clearWindow(fcs); + window = _windowArray[1]; + if (window != NULL && window->text_color != 0) + clearWindow(window); _lastHitArea2Ptr = NULL; _hitAreaPtr7 = NULL; @@ -508,15 +508,15 @@ void SimonEngine::leaveHitAreaById(uint hitarea_id) { hitarea_leave(ha); } -void SimonEngine::checkUp(FillOrCopyStruct *fcs) { +void SimonEngine::checkUp(WindowBlock *window) { uint16 j, k; if (((_variableArray[31] - _variableArray[30]) == 40) && (_variableArray[31] > 52)) { k = (((_variableArray[31] / 52) - 2) % 3); j = k * 6; if (!is_hitarea_0x40_clear(j + 201)) { - uint index = get_fcs_ptr_3_index(fcs); - drawIconArray(index, fcs->fcs_data->item_ptr, 0, fcs->fcs_data->unk2); + uint index = get_fcs_ptr_3_index(window); + drawIconArray(index, window->iconPtr->itemRef, 0, window->iconPtr->classMask); loadSprite(4, 9, k + 34, 0, 0, 0); } } @@ -537,12 +537,12 @@ void SimonEngine::checkUp(FillOrCopyStruct *fcs) { } } -void SimonEngine::checkDown(FillOrCopyStruct *fcs) { +void SimonEngine::checkDown(WindowBlock *window) { uint16 j, k; if (((_variableArray[31] - _variableArray[30]) == 24) && (_iOverflow == 1)) { - uint index = get_fcs_ptr_3_index(fcs); - drawIconArray(index, fcs->fcs_data->item_ptr, 0, fcs->fcs_data->unk2); + uint index = get_fcs_ptr_3_index(window); + drawIconArray(index, window->iconPtr->itemRef, 0, window->iconPtr->classMask); k = ((_variableArray[31] / 52) % 3); loadSprite(4, 9, k + 25, 0, 0, 0); _variableArray[31] += 52; @@ -562,51 +562,51 @@ void SimonEngine::checkDown(FillOrCopyStruct *fcs) { } } -void SimonEngine::inventoryUp(FillOrCopyStruct *fcs) { +void SimonEngine::inventoryUp(WindowBlock *window) { if (getGameType() == GType_FF) { _marks = 0; - checkUp(fcs); + checkUp(window); loadSprite(4, 9 ,21 ,0 ,0, 0); while(1) { if (_currentBoxNumber != 32763 || _leftButtonDown) break; - checkUp(fcs); + checkUp(window); } o_waitForMark(2); - checkUp(fcs); + checkUp(window); o_sync(922); o_waitForMark(1); - checkUp(fcs); + checkUp(window); } else { - if (fcs->fcs_data->unk1 == 0) + if (window->iconPtr->line == 0) return; mouseOff(); - uint index = get_fcs_ptr_3_index(fcs); - drawIconArray(index, fcs->fcs_data->item_ptr, fcs->fcs_data->unk1 - 1, fcs->fcs_data->unk2); + uint index = get_fcs_ptr_3_index(window); + drawIconArray(index, window->iconPtr->itemRef, window->iconPtr->line - 1, window->iconPtr->classMask); mouseOn(); } } -void SimonEngine::inventoryDown(FillOrCopyStruct *fcs) { +void SimonEngine::inventoryDown(WindowBlock *window) { if (getGameType() == GType_FF) { _marks = 0; - checkDown(fcs); + checkDown(window); loadSprite(4, 9, 23, 0, 0, 0); while(1) { if (_currentBoxNumber != 32764 || _leftButtonDown) break; - checkDown(fcs); + checkDown(window); } o_waitForMark(2); - checkDown(fcs); + checkDown(window); o_sync(924); o_waitForMark(1); - checkDown(fcs); + checkDown(window); } else { mouseOff(); - uint index = get_fcs_ptr_3_index(fcs); - drawIconArray(index, fcs->fcs_data->item_ptr, fcs->fcs_data->unk1 + 1, fcs->fcs_data->unk2); + uint index = get_fcs_ptr_3_index(window); + drawIconArray(index, window->iconPtr->itemRef, window->iconPtr->line + 1, window->iconPtr->classMask); mouseOn(); } } |