diff options
Diffstat (limited to 'engines/simon/simon.cpp')
-rw-r--r-- | engines/simon/simon.cpp | 206 |
1 files changed, 1 insertions, 205 deletions
diff --git a/engines/simon/simon.cpp b/engines/simon/simon.cpp index c015585229..9eb4db7094 100644 --- a/engines/simon/simon.cpp +++ b/engines/simon/simon.cpp @@ -1776,175 +1776,12 @@ get_out: _needHitAreaRecalc = 0; } -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; - uint x_pos, y_pos; - - fcs_ptr = _windowArray[fcs_index & 7]; - - if (getGameType() == GType_SIMON1) { - width_div_3 = fcs_ptr->width / 3; - height_div_3 = fcs_ptr->height / 3; - } else { - width_div_3 = 100; - height_div_3 = 40; - } - - i = 0; - - if (fcs_ptr == NULL) - return; - - if (fcs_ptr->iconPtr) - removeIconArray(fcs_index); - - 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; - - itemRef = derefItem(itemRef->child); - - while (itemRef && line-- != 0) { - num_sibs_with_flag = 0; - 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; - } - itemRef = derefItem(itemRef->sibling); - } - } - - if (itemRef == NULL) { - fcs_ptr->iconPtr->line = 0; - itemRef = derefItem(item_ptr_org->child); - } - - x_pos = 0; - y_pos = 0; - item_again = false; - k = 0; - j = 0; - - while (itemRef) { - if ((classMask == 0 || itemRef->classFlags & classMask) && has_item_childflag_0x10(itemRef)) { - if (item_again == false) { - fcs_ptr->iconPtr->iconArray[k].item = itemRef; - if (getGameType() == GType_SIMON1) { - 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(itemRef), itemRef); - } else { - 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->iconPtr->iconArray[k].item = NULL; - j = 1; - } - x_pos += (getGameType() == GType_SIMON1) ? 1 : 20; - - if (x_pos >= width_div_3) { - x_pos = 0; - - y_pos += (getGameType() == GType_SIMON1) ? 1 : 20; - if (y_pos >= height_div_3) - item_again = true; - } - } - itemRef = derefItem(itemRef->sibling); - } - - fcs_ptr->iconPtr->iconArray[k].item = NULL; - - if (j != 0 || fcs_ptr->iconPtr->line != 0) { - addArrows(fcs_ptr, fcs_index); - } -} - -void SimonEngine::addArrows(WindowBlock *window, uint fcs_index) { - setArrowHitAreas(window, fcs_index); - - window->iconPtr->upArrow = _scrollUpHitArea; - window->iconPtr->downArrow = _scrollDownHitArea; -} - -void SimonEngine::setArrowHitAreas(WindowBlock *window, uint fcs_index) { - HitArea *ha; - - ha = findEmptyHitArea(); - _scrollUpHitArea = ha - _hitAreas; - if (getGameType() == GType_SIMON1) { - ha->x = 308; - ha->y = 149; - ha->width = 12; - ha->height = 17; - ha->flags = 0x24; - ha->id = 0x7FFB; - ha->priority = 100; - ha->window = window; - ha->verb = 1; - } else { - ha->x = 81; - ha->y = 158; - ha->width = 12; - ha->height = 26; - ha->flags = 36; - ha->id = 0x7FFB; - ha->priority = 100; - ha->window = window; - ha->verb = 1; - } - - ha = findEmptyHitArea(); - _scrollDownHitArea = ha - _hitAreas; - - if (getGameType() == GType_SIMON1) { - ha->x = 308; - ha->y = 176; - ha->width = 12; - ha->height = 17; - ha->flags = 0x24; - ha->id = 0x7FFC; - ha->priority = 100; - ha->window = window; - ha->verb = 1; - - // Simon1 specific - o_kill_sprite_simon1(128); - loadSprite(0, 1, 128, 0, 0, 14); - } else { - ha->x = 227; - ha->y = 162; - ha->width = 12; - ha->height = 26; - ha->flags = 36; - ha->id = 0x7FFC; - ha->priority = 100; - ha->window = window; - ha->verb = 1; - } -} - - bool SimonEngine::has_item_childflag_0x10(Item *item) { Child2 *child = (Child2 *)findChildOfType(item, 2); return child && (child->avail_props & 0x10) != 0; } -uint SimonEngine::item_get_icon_number(Item *item) { +uint SimonEngine::itemGetIconNumber(Item *item) { Child2 *child = (Child2 *)findChildOfType(item, 2); uint offs; @@ -3101,47 +2938,6 @@ void SimonEngine::o_pathfind(int x, int y, uint var_1, uint var_2) { } // ok -void SimonEngine::removeIconArray(uint fcs_index) { - WindowBlock *window; - uint16 fcsunk1; - uint16 i; - - window = _windowArray[fcs_index & 7]; - fcsunk1 = _curWindow; - - if (window == NULL || window->iconPtr == NULL) - return; - - changeWindow(fcs_index); - fcs_putchar(12); - changeWindow(fcsunk1); - - for (i = 0; window->iconPtr->iconArray[i].item != NULL; i++) { - delete_hitarea_by_index(window->iconPtr->iconArray[i].boxCode); - } - - if (window->iconPtr->upArrow != -1) { - delete_hitarea_by_index(window->iconPtr->upArrow); - } - - if (window->iconPtr->downArrow != -1) { - delete_hitarea_by_index(window->iconPtr->downArrow); - if (getGameType() == GType_SIMON1) - removeArrows(window, fcs_index); - } - - free(window->iconPtr); - window->iconPtr = NULL; - - _fcsData1[fcs_index] = 0; - _fcsData2[fcs_index] = 0; -} - -// ok -void SimonEngine::removeArrows(WindowBlock *window, uint fcs_index) { - o_kill_sprite_simon1(128); -} - void SimonEngine::delete_hitarea_by_index(uint index) { CHECK_BOUNDS(index, _hitAreas); _hitAreas[index].flags = 0; |