diff options
-rw-r--r-- | simon/cursor.cpp | 2 | ||||
-rw-r--r-- | simon/debug.cpp | 2 | ||||
-rw-r--r-- | simon/debugger.cpp | 4 | ||||
-rw-r--r-- | simon/items.cpp | 168 | ||||
-rw-r--r-- | simon/saveload.cpp | 48 | ||||
-rw-r--r-- | simon/simon.cpp | 82 | ||||
-rw-r--r-- | simon/simon.h | 80 | ||||
-rw-r--r-- | simon/verb.cpp | 2 | ||||
-rw-r--r-- | simon/vga.cpp | 384 |
9 files changed, 360 insertions, 412 deletions
diff --git a/simon/cursor.cpp b/simon/cursor.cpp index a6406ca3f0..0d0d5dadfe 100644 --- a/simon/cursor.cpp +++ b/simon/cursor.cpp @@ -222,7 +222,7 @@ static const byte _simon2_cursors[10][256] = { 0xff,0xff,0xff,0xff,0xff,0xff,0xe5,0xe5,0xe5,0xff,0xff,0xff,0xff,0xff,0xff,0xff }, }; -void SimonEngine::draw_mouse_pointer() { +void SimonEngine::drawMousePointer() { if (getGameType() == GType_SIMON2) _system->setMouseCursor(_simon2_cursors[_mouseCursor], 16, 16, 7, 7); else diff --git a/simon/debug.cpp b/simon/debug.cpp index 0060ba4db0..76e17b8ed5 100644 --- a/simon/debug.cpp +++ b/simon/debug.cpp @@ -211,7 +211,7 @@ void SimonEngine::dump_video_script(const byte *src, bool one_opcode_only) { break; case 'd': { int16 tmp = (int16)readUint16Wrapper(src); - if (tmp < 0) tmp = vc_read_var(-tmp); + if (tmp < 0) tmp = vcReadVar(-tmp); fprintf(_dumpFile, "%d ", tmp); src += 2; break; diff --git a/simon/debugger.cpp b/simon/debugger.cpp index a6ce24e3d5..f01467b522 100644 --- a/simon/debugger.cpp +++ b/simon/debugger.cpp @@ -153,13 +153,13 @@ bool Debugger::Cmd_SetBit(int argc, const char **argv) { bit = atoi(argv[1]); value = atoi(argv[2]); if (value <= 1) { - _vm->vc_set_bit_to(bit, value != 0); + _vm->vcSetBitTo(bit, value != 0); DebugPrintf("Set bit %d to %d\n", bit, value); } else DebugPrintf("Bit value out of range (0 - 1)\n"); } else if (argc > 1) { bit = atoi(argv[1]); - value = _vm->vc_get_bit(bit); + value = _vm->vcGetBit(bit); DebugPrintf("Bit %d is %d\n", bit, value); } else DebugPrintf("Syntax: bit <bitnum> <value>\n"); diff --git a/simon/items.cpp b/simon/items.cpp index faaebb2a0f..32e2406acb 100644 --- a/simon/items.cpp +++ b/simon/items.cpp @@ -375,10 +375,10 @@ int SimonEngine::runScript() { uint var = getVarOrByte(); uint string_id = getNextStringID(); if (getFeatures() & GF_TALKIE) { - uint speech_id = getNextWord(); + uint speechId = getNextWord(); if (var < 20) { _stringIdArray3[var] = string_id; - _speechIdArray4[var] = speech_id; + _speechIdArray4[var] = speechId; } } else { if (var < 20) { @@ -449,12 +449,12 @@ int SimonEngine::runScript() { break; case 83:{ /* restart subroutine */ - if (getGameType() == GType_SIMON2) + if (getGameType() == GType_SIMON2 || getGameType() == GType_FF) o_83_helper(); return -10; } - case 87:{ /* dummy opcode */ + case 87:{ /* comment */ getNextStringID(); } break; @@ -521,7 +521,7 @@ int SimonEngine::runScript() { break; case 97:{ /* load vga */ - ensureVgaResLoadedC(getVarOrWord()); + o_loadZone(getVarOrWord()); } break; @@ -674,13 +674,13 @@ int SimonEngine::runScript() { _scriptVar2 = (var == 200); if (var != 200 || !_skipVgaWait) - o_wait_for_vga(var); + o_waitForSync(var); _skipVgaWait = false; } break; case 120:{ - o_unk_120(getVarOrWord()); + o_sync(getVarOrWord()); } break; @@ -733,7 +733,7 @@ int SimonEngine::runScript() { break; case 127:{ /* deals with music */ - o_play_music_resource(); + o_playMusic(); } break; @@ -762,19 +762,19 @@ int SimonEngine::runScript() { case 132:{ /* save game */ _system->setFeatureState(OSystem::kFeatureVirtualKeyboard, true); - o_save_game(); + o_saveGame(); _system->setFeatureState(OSystem::kFeatureVirtualKeyboard, false); } break; case 133:{ /* load game */ - _system->setFeatureState(OSystem::kFeatureVirtualKeyboard, true); if (getGameType() == GType_FF) { - load_game(readVariable(55)); + loadGame(readVariable(55)); } else { - o_load_game(); + _system->setFeatureState(OSystem::kFeatureVirtualKeyboard, true); + o_loadGame(); + _system->setFeatureState(OSystem::kFeatureVirtualKeyboard, false); } - _system->setFeatureState(OSystem::kFeatureVirtualKeyboard, false); } break; @@ -812,7 +812,7 @@ int SimonEngine::runScript() { break; case 138:{ /* vga pointer op 4 */ - o_unk_138(); + o_freezeBottom(); } break; @@ -940,12 +940,12 @@ int SimonEngine::runScript() { break; case 162:{ /* print string */ - o_print_str(); + o_printStr(); } break; case 163:{ /* play sound */ - o_play_sound(getVarOrWord()); + o_playSFX(getVarOrWord()); } break; @@ -1014,17 +1014,17 @@ int SimonEngine::runScript() { uint vgaSpriteId = getVarOrByte(); /* and room descriptions */ uint color = getVarOrByte(); uint string_id = getVarOrByte(); - uint speech_id = 0; + uint speechId = 0; const char *string_ptr = (const char *)getStringPtrByID(_stringIdArray3[string_id]); TextLocation *tl = getTextLocation(vgaSpriteId); if (getFeatures() & GF_TALKIE) - speech_id = _speechIdArray4[string_id]; + speechId = _speechIdArray4[string_id]; - if (_speech && speech_id != 0) - talk_with_speech(speech_id, vgaSpriteId); + if (_speech && speechId != 0) + playSpeech(speechId, vgaSpriteId); if (string_ptr != NULL && _subtitles) - talk_with_text(vgaSpriteId, color, string_ptr, tl->x, tl->y, tl->width); + printText(vgaSpriteId, color, string_ptr, tl->x, tl->y, tl->width); } break; @@ -1067,7 +1067,7 @@ int SimonEngine::runScript() { break; case 184:{ /* clear vgapointer entry */ - o_clear_vgapointer_entry(getVarOrWord()); + o_unloadZone(getVarOrWord()); } break; @@ -1088,14 +1088,14 @@ int SimonEngine::runScript() { break; case 186:{ /* vga pointer op 3 */ - o_unk_186(); + o_unfreezeBottom(); } break; case 187:{ /* fade to black */ if (getGameType() == GType_SIMON2) goto invalid_opcode; - o_fade_to_black(); + o_fadeToBlack(); } break; @@ -1281,8 +1281,8 @@ bool SimonEngine::checkIfToRunSubroutineLine(SubroutineLine *sl, Subroutine *sub void SimonEngine::o_83_helper() { if (_exitCutscene) { - if (vc_get_bit(9)) { - startSubroutine170(); + if (vcGetBit(9)) { + endCutscene(); } } else { processSpecialKeys(); @@ -1293,8 +1293,8 @@ void SimonEngine::o_waitForMark(uint i) { _exitCutscene = false; while (!(_marks & (1 << i))) { if (_exitCutscene) { - if (vc_get_bit(9)) { - startSubroutine170(); + if (vcGetBit(9)) { + endCutscene(); break; } } else { @@ -1350,63 +1350,63 @@ void SimonEngine::o_inventory_descriptions() { if ((getGameType() == GType_SIMON2) && (getFeatures() & GF_TALKIE)) { if (child != NULL && child->avail_props & 0x200) { - uint speech_id = child->array[getOffsetOfChild2Param(child, 0x200)]; + uint speechId = child->array[getOffsetOfChild2Param(child, 0x200)]; if (child->avail_props & 0x100) { - uint speech_id_offs = child->array[getOffsetOfChild2Param(child, 0x100)]; - - if (speech_id == 116) - speech_id = speech_id_offs + 115; - if (speech_id == 92) - speech_id = speech_id_offs + 98; - if (speech_id == 99) - speech_id = 9; - if (speech_id == 97) { - switch (speech_id_offs) { + uint speechIdOffs = child->array[getOffsetOfChild2Param(child, 0x100)]; + + if (speechId == 116) + speechId = speechIdOffs + 115; + if (speechId == 92) + speechId = speechIdOffs + 98; + if (speechId == 99) + speechId = 9; + if (speechId == 97) { + switch (speechIdOffs) { case 12: - speech_id = 109; + speechId = 109; break; case 14: - speech_id = 108; + speechId = 108; break; case 18: - speech_id = 107; + speechId = 107; break; case 20: - speech_id = 106; + speechId = 106; break; case 22: - speech_id = 105; + speechId = 105; break; case 28: - speech_id = 104; + speechId = 104; break; case 90: - speech_id = 103; + speechId = 103; break; case 92: - speech_id = 102; + speechId = 102; break; case 100: - speech_id = 51; + speechId = 51; break; default: - error("o_177: invalid case %d", speech_id_offs); + error("o_177: invalid case %d", speechIdOffs); } } } if (_speech) - talk_with_speech(speech_id, vgaSpriteId); + playSpeech(speechId, vgaSpriteId); } } else if (getFeatures() & GF_TALKIE) { if (child != NULL && child->avail_props & 0x200) { uint offs = getOffsetOfChild2Param(child, 0x200); - talk_with_speech(child->array[offs], vgaSpriteId); + playSpeech(child->array[offs], vgaSpriteId); } else if (child != NULL && child->avail_props & 0x100) { uint offs = getOffsetOfChild2Param(child, 0x100); - talk_with_speech(child->array[offs] + 3550, vgaSpriteId); + playSpeech(child->array[offs] + 3550, vgaSpriteId); } } @@ -1416,7 +1416,7 @@ void SimonEngine::o_inventory_descriptions() { string_ptr = buf; } if (string_ptr != NULL) - talk_with_text(vgaSpriteId, color, string_ptr, tl->x, tl->y, tl->width); + printText(vgaSpriteId, color, string_ptr, tl->x, tl->y, tl->width); } } @@ -1478,12 +1478,12 @@ void SimonEngine::o_restoreIconArray(uint fcs_index) { drawIconArray(fcs_index, fcs->fcs_data->item_ptr, fcs->fcs_data->unk1, fcs->fcs_data->unk2); } -void SimonEngine::o_unk_138() { +void SimonEngine::o_freezeBottom() { _vgaBufStart = _vgaBufFreeStart; _vgaFileBufOrg = _vgaBufFreeStart; } -void SimonEngine::o_unk_186() { +void SimonEngine::o_unfreezeBottom() { _vgaBufFreeStart = _vgaFileBufOrg2; _vgaBufStart = _vgaFileBufOrg2; _vgaFileBufOrg = _vgaFileBufOrg2; @@ -1505,15 +1505,12 @@ int SimonEngine::o_unk_132_helper(bool *b, char *buf) { if (!_saveLoadFlag) { strange_jump:; _saveLoadFlag = false; - savegame_dialog(buf); + saveGameDialog(buf); } start_over:; _keyPressed = 0; - if (getPlatform() == Common::kPlatformAmiga && getFeatures() & GF_TALKIE) - goto start_over_3; - start_over_2:; _lastHitArea = _lastHitArea3 = 0; @@ -1559,51 +1556,6 @@ start_over_2:; if (ha->id >= 214) goto start_over_2; return ha->id - 208; - -//FIXME Hack to allow load and save file selection in simon1cd32 -// Uses the follow keys for moving around -// 1 - 6 to select slot to load/save -// Up Arrow to move up slots -// Down Arrow to move down slots -// X to exit -start_over_3:; - if (_saveLoadFlag) { - *b = false; - delay(1); - return _keyPressed; - } - - if (_keyPressed == 17) { - if (_saveLoadRowCurPos == 1) - goto start_over_3; - if (_saveLoadRowCurPos < 7) - _saveLoadRowCurPos = 1; - else - _saveLoadRowCurPos -= 6; - - goto strange_jump; - } - - if (_keyPressed == 18) { - if (!_saveDialogFlag) - goto start_over_3; - _saveLoadRowCurPos += 6; - if (_saveLoadRowCurPos >= _numSaveGameRows) - _saveLoadRowCurPos = _numSaveGameRows; - goto strange_jump; - } - - if (_keyPressed == 120) - return 205; - - if (_keyPressed > 48 && _keyPressed < 55) { - return _keyPressed - 49; - } - - - delay(1); - goto start_over_3; - } void SimonEngine::o_unk_132_helper_3() { @@ -1611,7 +1563,7 @@ void SimonEngine::o_unk_132_helper_3() { set_hitarea_bit_0x40(i); } -void SimonEngine::o_clear_character(FillOrCopyStruct *fcs, int x, byte b) { +void SimonEngine::o_clearCharacter(FillOrCopyStruct *fcs, int x, byte b) { byte old_text; video_putchar(fcs, x, b); @@ -1633,7 +1585,7 @@ void SimonEngine::o_clear_character(FillOrCopyStruct *fcs, int x, byte b) { video_putchar(fcs, 8); } -void SimonEngine::o_play_music_resource() { +void SimonEngine::o_playMusic() { int music = getVarOrWord(); int track = getVarOrWord(); @@ -1662,7 +1614,7 @@ void SimonEngine::o_play_music_resource() { } } -void SimonEngine::o_unk_120(uint a) { +void SimonEngine::o_sync(uint a) { uint16 id = to16Wrapper(a); _lockWord |= 0x8000; _vcPtr = (byte *)&id; @@ -1670,7 +1622,7 @@ void SimonEngine::o_unk_120(uint a) { _lockWord &= ~0x8000; } -void SimonEngine::o_play_sound(uint sound_id) { +void SimonEngine::o_playSFX(uint sound_id) { if (getGameId() == GID_SIMON1DOS) playSting(sound_id); else diff --git a/simon/saveload.cpp b/simon/saveload.cpp index cabf464b1b..c18b95c20f 100644 --- a/simon/saveload.cpp +++ b/simon/saveload.cpp @@ -32,15 +32,15 @@ namespace Simon { -void SimonEngine::o_save_game() { - save_or_load_dialog(false); +void SimonEngine::o_saveGame() { + saveOrLoadDialog(false); } -void SimonEngine::o_load_game() { - save_or_load_dialog(true); +void SimonEngine::o_loadGame() { + saveOrLoadDialog(true); } -int SimonEngine::count_savegames() { +int SimonEngine::countSaveGames() { Common::InSaveFile *f; uint i = 1; bool marks[256]; @@ -60,7 +60,7 @@ int SimonEngine::count_savegames() { return i; } -int SimonEngine::display_savegame_list(int curpos, bool load, char *dst) { +int SimonEngine::displaySaveGameList(int curpos, bool load, char *dst) { int slot, last_slot; Common::InSaveFile *in; @@ -105,7 +105,7 @@ int SimonEngine::display_savegame_list(int curpos, bool load, char *dst) { return slot - curpos; } -void SimonEngine::quick_load_or_save() { +void SimonEngine::quickLoadOrSave() { // simon1demo subroutines are missing too many segments // original demo didn't allow load or save either. if (getGameId() == GID_SIMON1DEMO) @@ -117,7 +117,7 @@ void SimonEngine::quick_load_or_save() { char *filename = gen_savename(_saveLoadSlot); if (_saveLoadType == 2) { Subroutine *sub; - success = load_game(_saveLoadSlot); + success = loadGame(_saveLoadSlot); if (!success) { sprintf(buf, "Failed to load game state to file:\n\n%s", filename); } else { @@ -126,12 +126,12 @@ void SimonEngine::quick_load_or_save() { drawIconArray(2, getItem1Ptr(), 0, 0); mouseOn(); // Reset engine? - vc_set_bit_to(97, true); + vcSetBitTo(97, true); sub = getSubroutineByID(100); startSubroutine(sub); } } else { - success = save_game(_saveLoadSlot, _saveLoadName); + success = saveGame(_saveLoadSlot, _saveLoadName); if (!success) sprintf(buf, "Failed to save game state to file:\n\n%s", filename); } @@ -150,12 +150,12 @@ void SimonEngine::quick_load_or_save() { _saveLoadType = 0; } -void SimonEngine::savegame_dialog(char *buf) { +void SimonEngine::saveGameDialog(char *buf) { int i; o_unk_132_helper_3(); - i = display_savegame_list(_saveLoadRowCurPos, _saveOrLoad, buf); + i = displaySaveGameList(_saveLoadRowCurPos, _saveOrLoad, buf); _saveDialogFlag = true; @@ -174,7 +174,7 @@ void SimonEngine::savegame_dialog(char *buf) { } while (--i); } -void SimonEngine::save_or_load_dialog(bool load) { +void SimonEngine::saveOrLoadDialog(bool load) { time_t save_time; int number_of_savegames; int i; @@ -191,7 +191,7 @@ void SimonEngine::save_or_load_dialog(bool load) { _copyPartialMode = 1; - number_of_savegames = count_savegames(); + number_of_savegames = countSaveGames(); if (!load) number_of_savegames++; number_of_savegames -= 6; @@ -283,7 +283,7 @@ restart:; goto get_out; clear_hitarea_bit_0x40(0xd0 + unk132_result); if (_saveLoadFlag) { - o_clear_character(_windowArray[5], 8); + o_clearCharacter(_windowArray[5], 8); // move code } goto if_1; @@ -297,7 +297,7 @@ restart:; } while (i >= 0x80 || i == 0); // after_do_2 - o_clear_character(_windowArray[5], 8); + o_clearCharacter(_windowArray[5], 8); if (i == 10 || i == 13) break; if (i == 8) { @@ -316,7 +316,7 @@ restart:; name[name_len] = 0; - o_clear_character(_windowArray[5], x, m); + o_clearCharacter(_windowArray[5], x, m); } } else if (i >= 32 && name_len != 17) { name[name_len++] = i; @@ -326,11 +326,11 @@ restart:; } // do_save - if (!save_game(_saveLoadRowCurPos + unk132_result, buf + unk132_result * 18)) - o_file_error(_windowArray[5], true); + if (!saveGame(_saveLoadRowCurPos + unk132_result, buf + unk132_result * 18)) + o_fileError(_windowArray[5], true); } else { - if (!load_game(_saveLoadRowCurPos + i)) - o_file_error(_windowArray[5], false); + if (!loadGame(_saveLoadRowCurPos + i)) + o_fileError(_windowArray[5], false); } get_out:; @@ -349,7 +349,7 @@ get_out:; g_system->setFeatureState(OSystem::kFeatureVirtualKeyboard, false); } -void SimonEngine::o_file_error(FillOrCopyStruct *fcs, bool save_error) { +void SimonEngine::o_fileError(FillOrCopyStruct *fcs, bool save_error) { HitArea *ha; const char *string, *string2; @@ -399,7 +399,7 @@ loop:; delete_hitarea(0x7FFF); } -bool SimonEngine::save_game(uint slot, char *caption) { +bool SimonEngine::saveGame(uint slot, char *caption) { Common::OutSaveFile *f; uint item_index, num_item, i, j; TimeEvent *te; @@ -512,7 +512,7 @@ char *SimonEngine::gen_savename(int slot) { return buf; } -bool SimonEngine::load_game(uint slot) { +bool SimonEngine::loadGame(uint slot) { char ident[100]; Common::InSaveFile *f; uint num, item_index, i, j; diff --git a/simon/simon.cpp b/simon/simon.cpp index 3b27a35f97..0ef8a9e81d 100644 --- a/simon/simon.cpp +++ b/simon/simon.cpp @@ -1615,7 +1615,7 @@ void SimonEngine::setup_cond_c_helper() { do { if (_exitCutscene && (_bitArray[0] & 0x200)) { - startSubroutine170(); + endCutscene(); goto out_of_here; } @@ -1640,7 +1640,7 @@ out_of_here: _lastHitArea2Ptr = NULL; } -void SimonEngine::startSubroutine170() { +void SimonEngine::endCutscene() { Subroutine *sub; _sound->stopVoice(); @@ -1765,7 +1765,7 @@ void SimonEngine::handle_mouse_moved() { _lastHitArea3 = (HitArea *) - 1; get_out: - draw_mouse_pointer(); + drawMousePointer(); _needHitAreaRecalc = 0; } @@ -2271,7 +2271,7 @@ TextLocation *SimonEngine::getTextLocation(uint a) { return NULL; } -void SimonEngine::o_print_str() { +void SimonEngine::o_printStr() { uint vgaSpriteId = getVarOrByte(); uint color = getVarOrByte(); uint string_id = getNextStringID(); @@ -2288,22 +2288,22 @@ void SimonEngine::o_print_str() { tl = getTextLocation(vgaSpriteId); if (_speech && speech_id != 0) - talk_with_speech(speech_id, vgaSpriteId); + playSpeech(speech_id, vgaSpriteId); if ((getGameType() == GType_SIMON2) && (getFeatures() & GF_TALKIE) && speech_id == 0) o_kill_sprite_simon2(2, vgaSpriteId + 2); if (string_ptr != NULL && (speech_id == 0 || _subtitles)) - talk_with_text(vgaSpriteId, color, (const char *)string_ptr, tl->x, tl->y, tl->width); + printText(vgaSpriteId, color, (const char *)string_ptr, tl->x, tl->y, tl->width); } -void SimonEngine::ensureVgaResLoadedC(uint vga_res) { +void SimonEngine::o_loadZone(uint vga_res) { _lockWord |= 0x80; - ensureVgaResLoaded(vga_res); + loadZone(vga_res); _lockWord &= ~0x80; } -void SimonEngine::ensureVgaResLoaded(uint vga_res) { +void SimonEngine::loadZone(uint vga_res) { VgaPointersEntry *vpe; CHECK_BOUNDS(vga_res, _vgaBufferPointers); @@ -2419,7 +2419,7 @@ void SimonEngine::vga_buf_unk_proc2(uint a, byte *end) { } } -void SimonEngine::o_clear_vgapointer_entry(uint a) { +void SimonEngine::o_unloadZone(uint a) { VgaPointersEntry *vpe; vpe = &_vgaBufferPointers[a]; @@ -2471,7 +2471,7 @@ void SimonEngine::set_video_mode_internal(uint mode, uint vga_res_id) { if (vpe->vgaFile1 != NULL) break; - ensureVgaResLoaded(num); + loadZone(num); } // ensure flipping complete @@ -2560,7 +2560,7 @@ void SimonEngine::set_video_mode_internal(uint mode, uint vga_res_id) { } } -void SimonEngine::o_fade_to_black() { +void SimonEngine::o_fadeToBlack() { uint i; memcpy(_videoBuf1, _paletteBackup, 1024); @@ -2614,7 +2614,7 @@ void SimonEngine::expire_vga_timers() { // special scroll timer scroll_timeout(); } else { - vc_resume_sprite(script_ptr, cur_file, cur_unk); + vcResumeSprite(script_ptr, cur_file, cur_unk); } vte = _nextVgaTimerToProcess; } else { @@ -2645,7 +2645,7 @@ void SimonEngine::scroll_timeout() { add_vga_timer(6, NULL, 0, 0); } -void SimonEngine::vc_resume_sprite(const byte *code_ptr, uint16 cur_file, uint16 cur_sprite) { +void SimonEngine::vcResumeSprite(const byte *code_ptr, uint16 cur_file, uint16 cur_sprite) { VgaPointersEntry *vpe; _vgaCurSpriteId = cur_sprite; @@ -2701,20 +2701,20 @@ void SimonEngine::o_mouseOff() { _lockWord &= ~0x8000; } -void SimonEngine::o_wait_for_vga(uint a) { +void SimonEngine::o_waitForSync(uint a) { _vgaWaitFor = a; _timer1 = 0; _exitCutscene = false; _skipSpeech = false; while (_vgaWaitFor != 0) { if (_skipSpeech && (getGameType() == GType_SIMON2 || getGameType() == GType_FF)) { - if (_vgaWaitFor == 200 && !vc_get_bit(14)) { - skip_speech(); + if (_vgaWaitFor == 200 && !vcGetBit(14)) { + skipSpeech(); break; } } else if (_exitCutscene) { - if (vc_get_bit(9)) { - startSubroutine170(); + if (vcGetBit(9)) { + endCutscene(); break; } } else { @@ -2736,13 +2736,13 @@ void SimonEngine::o_wait_for_vga(uint a) { } } -void SimonEngine::skip_speech() { +void SimonEngine::skipSpeech() { _sound->stopVoice(); if (!(_bitArray[1] & 0x1000)) { _bitArray[0] |= 0x4000; _variableArray[100] = 5; loadSprite(4, 1, 30, 0, 0, 0); - o_wait_for_vga(130); + o_waitForSync(130); o_kill_sprite_simon2(2, 1); } } @@ -2826,7 +2826,7 @@ void SimonEngine::timer_vga_sprites_helper() { _scrollX += _scrollFlag; - vc_write_var(251, _scrollX); + vcWriteVar(251, _scrollX); _scrollFlag = 0; } @@ -3180,7 +3180,7 @@ void SimonEngine::video_erase(FillOrCopyStruct *fcs) { _lockWord &= ~0x8000; } -VgaSprite *SimonEngine::find_cur_sprite() { +VgaSprite *SimonEngine::findCurSprite() { VgaSprite *vsp = _vgaSprites; while (vsp->id) { if (getGameType() == GType_SIMON1) { @@ -3217,27 +3217,27 @@ void SimonEngine::processSpecialKeys() { break; case 59: // F1 if (getGameType() == GType_SIMON1) { - vc_write_var(5, 40); + vcWriteVar(5, 40); } else { - vc_write_var(5, 50); + vcWriteVar(5, 50); } - vc_write_var(86, 0); + vcWriteVar(86, 0); break; case 60: // F2 if (getGameType() == GType_SIMON1) { - vc_write_var(5, 60); + vcWriteVar(5, 60); } else { - vc_write_var(5, 75); + vcWriteVar(5, 75); } - vc_write_var(86, 1); + vcWriteVar(86, 1); break; case 61: // F3 if (getGameType() == GType_SIMON1) { - vc_write_var(5, 100); + vcWriteVar(5, 100); } else { - vc_write_var(5, 125); + vcWriteVar(5, 125); } - vc_write_var(86, 2); + vcWriteVar(86, 2); break; case 63: // F5 if (getGameType() == GType_SIMON2 || getGameType() == GType_FF) @@ -3402,7 +3402,7 @@ void SimonEngine::loadSprite(uint windowNum, uint fileId, uint vgaSpriteId, uint _curVgaFile1 = vpe->vgaFile1; if (vpe->vgaFile1 != NULL) break; - ensureVgaResLoaded(fileId); + loadZone(fileId); } pp = _curVgaFile1; @@ -3446,7 +3446,7 @@ void SimonEngine::loadSprite(uint windowNum, uint fileId, uint vgaSpriteId, uint _lockWord &= ~0x40; } -void SimonEngine::talk_with_speech(uint speech_id, uint vgaSpriteId) { +void SimonEngine::playSpeech(uint speech_id, uint vgaSpriteId) { if (getGameType() == GType_SIMON1) { if (speech_id == 9999) { if (_subtitles) @@ -3455,13 +3455,13 @@ void SimonEngine::talk_with_speech(uint speech_id, uint vgaSpriteId) { _bitArray[0] |= 0x4000; _variableArray[100] = 15; loadSprite(4, 1, 130, 0, 0, 0); - o_wait_for_vga(130); + o_waitForSync(130); } _skipVgaWait = true; } else { if (_subtitles && _scriptVar2) { loadSprite(4, 2, 204, 0, 0, 0); - o_wait_for_vga(204); + o_waitForSync(204); o_kill_sprite_simon1(204); } o_kill_sprite_simon1(vgaSpriteId + 201); @@ -3476,7 +3476,7 @@ void SimonEngine::talk_with_speech(uint speech_id, uint vgaSpriteId) { _bitArray[0] |= 0x4000; _variableArray[100] = 5; loadSprite(4, 1, 30, 0, 0, 0); - o_wait_for_vga(130); + o_waitForSync(130); } _skipVgaWait = true; } else { @@ -3485,7 +3485,7 @@ void SimonEngine::talk_with_speech(uint speech_id, uint vgaSpriteId) { return; } else if (_subtitles && _scriptVar2) { loadSprite(4, 2, 5, 0, 0, 0); - o_wait_for_vga(205); + o_waitForSync(205); o_kill_sprite_simon2(2,5); } @@ -3496,7 +3496,7 @@ void SimonEngine::talk_with_speech(uint speech_id, uint vgaSpriteId) { } } -void SimonEngine::talk_with_text(uint vgaSpriteId, uint color, const char *string, int16 x, int16 y, int16 width) { +void SimonEngine::printText(uint vgaSpriteId, uint color, const char *string, int16 x, int16 y, int16 width) { char convertedString[320]; char *convertedString2 = convertedString; int16 height, talkDelay; @@ -4107,7 +4107,7 @@ void SimonEngine::delay(uint amount) { // We should only allow a load or save when it was possible in original // This stops load/save during copy protection, conversations and cut scenes if (!_mouseHideCount && !_showPreposition) - quick_load_or_save(); + quickLoadOrSave(); } else if (event.kbd.flags == OSystem::KBD_CTRL) { if (event.kbd.keycode == 'a') { GUI::Dialog *_aboutDialog; @@ -4163,7 +4163,7 @@ void SimonEngine::delay(uint amount) { } while (cur < start + amount); } -void SimonEngine::loadMusic (uint music) { +void SimonEngine::loadMusic(uint music) { char buf[4]; if (getPlatform() == Common::kPlatformAmiga) { diff --git a/simon/simon.h b/simon/simon.h index de21fb6d76..35c6039ea6 100644 --- a/simon/simon.h +++ b/simon/simon.h @@ -536,7 +536,6 @@ protected: void changeWindow(uint a); void o_unk_103(); void closeWindow(uint a); - void o_unk_108(uint a); void clear_hitarea_bit_0x40(uint hitarea); void set_hitarea_bit_0x40(uint hitarea); void set_hitarea_x_y(uint hitarea, int x, int y); @@ -549,22 +548,20 @@ protected: void hitarea_leave(HitArea * ha); void leaveHitAreaById(uint hitarea_id); - void o_unk_114(); - void o_wait_for_vga(uint a); - void skip_speech(); - void o_unk_120(uint a); - void o_unk_126(); - void o_play_music_resource(); - void o_save_game(); - void o_load_game(); + void o_waitForSync(uint a); + void skipSpeech(); + void o_sync(uint a); + void o_playMusic(); + void o_saveGame(); + void o_loadGame(); void o_confirmQuit(); void o_restoreIconArray(uint a); - void o_unk_138(); + void o_freezeBottom(); void killAllTimers(); uint getOffsetOfChild2Param(Child2 *child, uint prop); void o_unk_160(uint a); - void o_play_sound(uint a); + void o_playSFX(uint a); void o_lockZone(); void o_unlockZone(); void o_pathfind(int x, int y, uint var_1, uint var_2); @@ -572,12 +569,12 @@ protected: void o_mouseOff(); void o_loadBeard(); void o_unloadBeard(); - void o_clear_vgapointer_entry(uint a); - void o_unk_186(); - void o_fade_to_black(); + void o_unloadZone(uint a); + void o_unfreezeBottom(); + void o_fadeToBlack(); TextLocation *getTextLocation(uint a); - void o_print_str(); + void o_printStr(); void o_setup_cond_c(); void setup_cond_c_helper(); @@ -591,7 +588,6 @@ protected: void loadTextIntoMem(uint string_id); void loadTablesIntoMem(uint subr_id); - uint loadTextFile(const char *filename, byte *dst); Common::File *openTablesFile(const char *filename); void closeTablesFile(Common::File *in); @@ -606,7 +602,7 @@ protected: bool kickoffTimeEvents(); void defocusHitarea(); - void startSubroutine170(); + void endCutscene(); void runSubroutine101(); void handle_uparrow_hitarea(FillOrCopyStruct *fcs); void handle_downarrow_hitarea(FillOrCopyStruct *fcs); @@ -632,7 +628,7 @@ protected: void handle_mouse_moved(); void pollMouseXY(); - void draw_mouse_pointer(); + void drawMousePointer(); void removeIconArray(uint fcs_index); void draw_icon_c(FillOrCopyStruct *fcs, uint icon, uint x, uint y); @@ -654,13 +650,13 @@ protected: void o_set_video_mode(uint mode, uint vga_res); void set_video_mode_internal(uint mode, uint vga_res_id); - void ensureVgaResLoadedC(uint vga_res); - void ensureVgaResLoaded(uint vga_res); + void o_loadZone(uint vga_res); + void loadZone(uint vga_res); void loadSprite(uint windowNum, uint vga_res, uint vga_sprite_id, uint x, uint y, uint palette); void o_defineWindow(uint a, uint b, uint c, uint d, uint e, uint f, uint g, uint h); - void talk_with_speech(uint speech_id, uint vga_sprite_id); - void talk_with_text(uint vga_sprite_id, uint color, const char *string_ptr, int16 x, int16 y, int16 width); + 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); void render_string_amiga(uint vga_sprite_id, uint color, uint width, uint height, const char *txt); @@ -774,13 +770,13 @@ protected: void drawImages_Feeble(VC10_state *state); void delete_vga_timer(VgaTimerEntry * vte); - void vc_resume_sprite(const byte *code_ptr, uint16 cur_file, uint16 cur_sprite); - int vc_read_var_or_word(); - uint vc_read_next_word(); - uint vc_read_next_byte(); - uint vc_read_var(uint var); - void vc_write_var(uint var, int16 value); - void vc_skip_next_instruction(); + void vcResumeSprite(const byte *code_ptr, uint16 cur_file, uint16 cur_sprite); + int vcReadVarOrWord(); + uint vcReadNextWord(); + uint vcReadNextByte(); + uint vcReadVar(uint var); + void vcWriteVar(uint var, int16 value); + void vcSkipNextInstruction(); int getScale(int y, int x); @@ -789,15 +785,15 @@ protected: bool vc_maybe_skip_proc_1(uint16 a, int16 b); void add_vga_timer(uint num, const byte *code_ptr, uint cur_sprite, uint cur_file); - VgaSprite *find_cur_sprite(); - void vc_set_bit_to(uint bit, bool value); + VgaSprite *findCurSprite(); + + bool vcGetBit(uint bit); + void vcSetBitTo(uint bit, bool value); void expire_vga_timers(); bool isSpriteLoaded(uint16 id, uint16 fileId); - bool vc_get_bit(uint bit); - void fcs_setTextColor(FillOrCopyStruct *fcs, uint value); void video_copy_if_flag_0x8_c(FillOrCopyStruct *fcs); @@ -849,7 +845,7 @@ protected: void print_char_helper_1(const byte *src, uint len); void print_char_helper_5(FillOrCopyStruct *fcs); - void quick_load_or_save(); + void quickLoadOrSave(); void shutdown(); byte *vc10_uncompressFlip(const byte *src, uint w, uint h); @@ -857,8 +853,8 @@ protected: Item *getNextItemPtrStrange(); - bool save_game(uint slot, char *caption); - bool load_game(uint slot); + bool saveGame(uint slot, char *caption); + bool loadGame(uint slot); void showmessage_helper_2(); void print_char_helper_6(uint i); @@ -887,15 +883,15 @@ protected: void set_volume(int volume); - void save_or_load_dialog(bool load); + void saveOrLoadDialog(bool load); void o_unk_132_helper_3(); int o_unk_132_helper(bool *b, char *buf); - void o_clear_character(FillOrCopyStruct *fcs, int x, byte b = 0); - void savegame_dialog(char *buf); - void o_file_error(FillOrCopyStruct *fcs, bool save_error); + void o_clearCharacter(FillOrCopyStruct *fcs, int x, byte b = 0); + void saveGameDialog(char *buf); + void o_fileError(FillOrCopyStruct *fcs, bool save_error); - int count_savegames(); - int display_savegame_list(int curpos, bool load, char *dst); + int countSaveGames(); + int displaySaveGameList(int curpos, bool load, char *dst); void show_it(void *buf); diff --git a/simon/verb.cpp b/simon/verb.cpp index c8df543dd7..b50499435a 100644 --- a/simon/verb.cpp +++ b/simon/verb.cpp @@ -193,7 +193,7 @@ void SimonEngine::defocusHitarea() { if (getGameType() == GType_SIMON2) { if (_bitArray[4] & 0x8000) { - o_unk_120(202); + o_sync(202); _lastHitArea2Ptr = NULL; return; } diff --git a/simon/vga.cpp b/simon/vga.cpp index 341c381e5d..d93704d2b6 100644 --- a/simon/vga.cpp +++ b/simon/vga.cpp @@ -151,26 +151,26 @@ void SimonEngine::run_vga_script() { } } -int SimonEngine::vc_read_var_or_word() { - int16 var = vc_read_next_word(); +int SimonEngine::vcReadVarOrWord() { + int16 var = vcReadNextWord(); if (var < 0) - var = vc_read_var(-var); + var = vcReadVar(-var); return var; } -uint SimonEngine::vc_read_next_word() { +uint SimonEngine::vcReadNextWord() { uint a; a = readUint16Wrapper(_vcPtr); _vcPtr += 2; return a; } -uint SimonEngine::vc_read_next_byte() { +uint SimonEngine::vcReadNextByte() { return *_vcPtr++; } -void SimonEngine::vc_skip_next_instruction() { - static const byte opcode_param_len_simon1[] = { +void SimonEngine::vcSkipNextInstruction() { + static const byte opcodeParamLenSimon1[] = { 0, 6, 2, 10, 6, 4, 2, 2, 4, 4, 10, 0, 2, 2, 2, 2, 2, 0, 2, 0, 4, 2, 4, 2, @@ -181,7 +181,7 @@ void SimonEngine::vc_skip_next_instruction() { 0, 0, 0, 0, 2, 6, 0, 0, }; - static const byte opcode_param_len_simon2[] = { + static const byte opcodeParamLenSimon2[] = { 0, 6, 2, 12, 6, 4, 2, 2, 4, 4, 9, 0, 1, 2, 2, 2, 2, 0, 2, 0, 4, 2, 4, 2, @@ -194,7 +194,7 @@ void SimonEngine::vc_skip_next_instruction() { 4, 2, 2 }; - static const byte opcode_param_len_feeblefiles[] = { + static const byte opcodeParamLenFeebleFiles[] = { 0, 6, 2, 12, 6, 4, 2, 2, 4, 4, 9, 0, 1, 2, 2, 2, 2, 0, 2, 0, 4, 2, 4, 2, @@ -209,14 +209,14 @@ void SimonEngine::vc_skip_next_instruction() { }; if (getGameType() == GType_FF) { - uint opcode = vc_read_next_byte(); - _vcPtr += opcode_param_len_feeblefiles[opcode]; + uint opcode = vcReadNextByte(); + _vcPtr += opcodeParamLenFeebleFiles[opcode]; } else if (getGameType() == GType_SIMON2) { - uint opcode = vc_read_next_byte(); - _vcPtr += opcode_param_len_simon2[opcode]; + uint opcode = vcReadNextByte(); + _vcPtr += opcodeParamLenSimon2[opcode]; } else { - uint opcode = vc_read_next_word(); - _vcPtr += opcode_param_len_simon1[opcode]; + uint opcode = vcReadNextWord(); + _vcPtr += opcodeParamLenSimon1[opcode]; } if (_continousVgaScript) @@ -257,7 +257,7 @@ void SimonEngine::vc2_call() { byte *b, *bb; const byte *vc_ptr_org; - num = vc_read_var_or_word(); + num = vcReadVarOrWord(); old_file_1 = _curVgaFile1; old_file_2 = _curVgaFile2; @@ -273,7 +273,7 @@ void SimonEngine::vc2_call() { if (_vgaCurFile2 != res) _videoVar7 = _vgaCurFile2; - ensureVgaResLoaded(res); + loadZone(res); _videoVar7 = 0xFFFF; } @@ -318,19 +318,19 @@ void SimonEngine::vc3_loadSprite() { byte *p, *pp; byte *old_file_1; - windowNum = vc_read_next_word(); /* 0 */ + windowNum = vcReadNextWord(); /* 0 */ if (getGameType() == GType_SIMON1) { - vgaSpriteId = vc_read_next_word(); /* 2 */ + vgaSpriteId = vcReadNextWord(); /* 2 */ fileId = vgaSpriteId / 100; } else { - fileId = vc_read_next_word(); /* 0 */ - vgaSpriteId = vc_read_next_word(); /* 2 */ + fileId = vcReadNextWord(); /* 0 */ + vgaSpriteId = vcReadNextWord(); /* 2 */ } - x = vc_read_next_word(); /* 4 */ - y = vc_read_next_word(); /* 6 */ - palette = vc_read_next_word(); /* 8 */ + x = vcReadNextWord(); /* 4 */ + y = vcReadNextWord(); /* 6 */ + palette = vcReadNextWord(); /* 8 */ /* 2nd param ignored with simon1 */ if (isSpriteLoaded(vgaSpriteId, fileId)) @@ -360,7 +360,7 @@ void SimonEngine::vc3_loadSprite() { if (_vgaCurFile2 != res) _videoVar7 = _vgaCurFile2; - ensureVgaResLoaded(res); + loadZone(res); _videoVar7 = 0xFFFF; } @@ -423,34 +423,34 @@ void SimonEngine::vc4_fadeIn() { } void SimonEngine::vc5_skip_if_neq() { - uint var = vc_read_next_word(); - uint value = vc_read_next_word(); - if (vc_read_var(var) != value) - vc_skip_next_instruction(); + uint var = vcReadNextWord(); + uint value = vcReadNextWord(); + if (vcReadVar(var) != value) + vcSkipNextInstruction(); } void SimonEngine::vc6_skip_ifn_sib_with_a() { - if (!itemIsSiblingOf(vc_read_next_word())) - vc_skip_next_instruction(); + if (!itemIsSiblingOf(vcReadNextWord())) + vcSkipNextInstruction(); } void SimonEngine::vc7_skip_if_sib_with_a() { - if (itemIsSiblingOf(vc_read_next_word())) - vc_skip_next_instruction(); + if (itemIsSiblingOf(vcReadNextWord())) + vcSkipNextInstruction(); } void SimonEngine::vc8_skip_if_parent_is() { - uint a = vc_read_next_word(); - uint b = vc_read_next_word(); + uint a = vcReadNextWord(); + uint b = vcReadNextWord(); if (!itemIsParentOf(a, b)) - vc_skip_next_instruction(); + vcSkipNextInstruction(); } void SimonEngine::vc9_skip_if_unk3_is() { - uint a = vc_read_next_word(); - uint b = vc_read_next_word(); + uint a = vcReadNextWord(); + uint b = vcReadNextWord(); if (!vc_maybe_skip_proc_1(a, b)) - vc_skip_next_instruction(); + vcSkipNextInstruction(); } byte *vc10_depack_column(VC10_state * vs) { @@ -662,7 +662,7 @@ void SimonEngine::vc10_draw() { int cur; - state.image = (int16)vc_read_next_word(); + state.image = (int16)vcReadNextWord(); if (state.image == 0) return; @@ -672,21 +672,21 @@ void SimonEngine::vc10_draw() { state.palette = (_vcPtr[1] * 16); } _vcPtr += 2; - state.x = (int16)vc_read_next_word(); + state.x = (int16)vcReadNextWord(); if (getGameType() == GType_SIMON2) { state.x -= _scrollX; } - state.y = (int16)vc_read_next_word(); + state.y = (int16)vcReadNextWord(); if (getGameType() == GType_SIMON1) { - state.flags = vc_read_next_word(); + state.flags = vcReadNextWord(); } else { - state.flags = vc_read_next_byte(); + state.flags = vcReadNextByte(); } if (state.image < 0) - state.image = vc_read_var(-state.image); + state.image = vcReadVar(-state.image); debug(1, "vc10_draw: image %d palette %d x %d y %d flags 0x0%x\n", state.image, state.palette, state.x, state.y, state.flags); @@ -738,7 +738,7 @@ void SimonEngine::vc10_draw() { _scrollX = state.x; - vc_write_var(251, _scrollX); + vcWriteVar(251, _scrollX); dst = dx_lock_attached(); src = state.depack_src + _scrollX * 4; @@ -844,7 +844,7 @@ void SimonEngine::drawImages_Feeble(VC10_state *state) { state->surf_addr += state->x + state->y * state->surf_pitch; if (state->flags & 0x20) { - if (vc_get_bit(81) == false) { + if (vcGetBit(81) == false) { // TODO: Compare Feeble rect } @@ -992,7 +992,7 @@ void SimonEngine::drawImages(VC10_state *state) { dst = state->surf_addr + w * 2; /* edi */ h = state->draw_height; - if ((getGameType() == GType_SIMON1) && vc_get_bit(88)) { + if ((getGameType() == GType_SIMON1) && vcGetBit(88)) { /* transparency */ do { if (mask[0] & 0xF0) { @@ -1168,7 +1168,7 @@ void SimonEngine::drawImages(VC10_state *state) { } else { dst_org = state->surf_addr; if (state->flags & 0x40) { /* reached */ - dst_org += vc_read_var(252); + dst_org += vcReadVar(252); } w = 0; do { @@ -1237,13 +1237,13 @@ void SimonEngine::vc11_clearPathFinder() { } void SimonEngine::vc12_delay() { - VgaSprite *vsp = find_cur_sprite(); + VgaSprite *vsp = findCurSprite(); uint num; if (getGameType() == GType_SIMON1) { - num = vc_read_var_or_word(); + num = vcReadVarOrWord(); } else { - num = vc_read_next_byte() * _frameRate; + num = vcReadNextByte() * _frameRate; } // Work around to allow inventory arrows to be @@ -1258,20 +1258,20 @@ void SimonEngine::vc12_delay() { } void SimonEngine::vc13_addToSpriteX() { - VgaSprite *vsp = find_cur_sprite(); - vsp->x += (int16)vc_read_next_word(); + VgaSprite *vsp = findCurSprite(); + vsp->x += (int16)vcReadNextWord(); _vgaSpriteChanged++; } void SimonEngine::vc14_addToSpriteY() { - VgaSprite *vsp = find_cur_sprite(); - vsp->y += (int16)vc_read_next_word(); + VgaSprite *vsp = findCurSprite(); + vsp->y += (int16)vcReadNextWord(); _vgaSpriteChanged++; } void SimonEngine::vc15_wakeup_id() { VgaSleepStruct *vfs = _vgaSleepStructs, *vfs_tmp; - uint16 id = vc_read_next_word(); + uint16 id = vcReadNextWord(); while (vfs->ident != 0) { if (vfs->ident == id) { add_vga_timer(VGA_DELAY_BASE, vfs->code_ptr, vfs->sprite_id, vfs->cur_vga_file); @@ -1295,7 +1295,7 @@ void SimonEngine::vc16_sleep_on_id() { while (vfs->ident) vfs++; - vfs->ident = vc_read_next_word(); + vfs->ident = vcReadNextWord(); vfs->code_ptr = _vcPtr; vfs->sprite_id = _vgaCurSpriteId; vfs->cur_vga_file = _vgaCurFileId; @@ -1304,7 +1304,7 @@ void SimonEngine::vc16_sleep_on_id() { } void SimonEngine::vc17_setPathfinderItem() { - uint a = vc_read_next_word(); + uint a = vcReadNextWord(); _pathFindArray[a - 1] = (const uint16 *)_vcPtr; int end = (getGameType() == GType_FF) ? 9999 : 999; @@ -1314,7 +1314,7 @@ void SimonEngine::vc17_setPathfinderItem() { } void SimonEngine::vc18_jump() { - int16 offs = vc_read_next_word(); + int16 offs = vcReadNextWord(); _vcPtr += offs; } @@ -1331,13 +1331,13 @@ void SimonEngine::vc20_setRepeat() { * the script (advancing the script pointer in doing so); then it writes * back the same word, this time as LE, into the script. */ - uint16 a = vc_read_next_word(); + uint16 a = vcReadNextWord(); WRITE_LE_UINT16(const_cast<byte *>(_vcPtr), a); _vcPtr += 2; } void SimonEngine::vc21_endRepeat() { - int16 a = vc_read_next_word(); + int16 a = vcReadNextWord(); const byte *tmp = _vcPtr + a; if (getGameType() == GType_SIMON1) tmp += 4; @@ -1353,8 +1353,8 @@ void SimonEngine::vc21_endRepeat() { } void SimonEngine::vc22_setSpritePalette() { - uint a = vc_read_next_word(); - uint b = vc_read_next_word(); + uint a = vcReadNextWord(); + uint b = vcReadNextWord(); uint num = a == 0 ? 32 : 16; uint palSize = 96; byte *palptr, *src; @@ -1383,8 +1383,8 @@ void SimonEngine::vc22_setSpritePalette() { } void SimonEngine::vc23_setSpritePriority() { - VgaSprite *vsp = find_cur_sprite(), *vus2; - uint16 pri = vc_read_next_word(); + VgaSprite *vsp = findCurSprite(), *vus2; + uint16 pri = vcReadNextWord(); VgaSprite bak; if (vsp->id == 0) @@ -1419,22 +1419,22 @@ void SimonEngine::vc23_setSpritePriority() { } void SimonEngine::vc24_setSpriteXY() { - VgaSprite *vsp = find_cur_sprite(); - vsp->image = vc_read_var_or_word(); + VgaSprite *vsp = findCurSprite(); + vsp->image = vcReadVarOrWord(); - vsp->x += (int16)vc_read_next_word(); - vsp->y += (int16)vc_read_next_word(); + vsp->x += (int16)vcReadNextWord(); + vsp->y += (int16)vcReadNextWord(); if (getGameType() == GType_SIMON1) { - vsp->flags = vc_read_next_word(); + vsp->flags = vcReadNextWord(); } else { - vsp->flags = vc_read_next_byte(); + vsp->flags = vcReadNextByte(); } _vgaSpriteChanged++; } void SimonEngine::vc25_halt_sprite() { - VgaSprite *vsp = find_cur_sprite(); + VgaSprite *vsp = findCurSprite(); while (vsp->id != 0) { memcpy(vsp, vsp + 1, sizeof(VgaSprite)); vsp++; @@ -1444,11 +1444,11 @@ void SimonEngine::vc25_halt_sprite() { } void SimonEngine::vc26_setSubWindow() { - uint16 *as = &_video_windows[vc_read_next_word() * 4]; // number - as[0] = vc_read_next_word(); // x - as[1] = vc_read_next_word(); // y - as[2] = vc_read_next_word(); // width - as[3] = vc_read_next_word(); // height + uint16 *as = &_video_windows[vcReadNextWord() * 4]; // number + as[0] = vcReadNextWord(); // x + as[1] = vcReadNextWord(); // y + as[2] = vcReadNextWord(); // width + as[3] = vcReadNextWord(); // height } void SimonEngine::vc27_resetSprite() { @@ -1491,7 +1491,7 @@ void SimonEngine::vc27_resetSprite() { } } - vc_write_var(254, 0); + vcWriteVar(254, 0); _lockWord &= ~8; } @@ -1506,25 +1506,25 @@ void SimonEngine::vc29_stopAllSounds() { } void SimonEngine::vc30_setFrameRate() { - _frameRate = vc_read_next_word(); + _frameRate = vcReadNextWord(); } void SimonEngine::vc31_setWindow() { - _windowNum = vc_read_next_word(); + _windowNum = vcReadNextWord(); } -uint SimonEngine::vc_read_var(uint var) { +uint SimonEngine::vcReadVar(uint var) { assert(var < 255); return (uint16)_variableArray[var]; } -void SimonEngine::vc_write_var(uint var, int16 value) { +void SimonEngine::vcWriteVar(uint var, int16 value) { _variableArray[var] = value; } void SimonEngine::vc32_copyVar() { - uint16 a = vc_read_var(vc_read_next_word()); - vc_write_var(vc_read_next_word(), a); + uint16 a = vcReadVar(vcReadNextWord()); + vcWriteVar(vcReadNextWord(), a); } void SimonEngine::vc33_setMouseOn() { @@ -1548,8 +1548,8 @@ void SimonEngine::vc35_clearWindow() { void SimonEngine::vc36_setWindowImage() { _updateScreen = false; - uint vga_res = vc_read_next_word(); - uint windowNum = vc_read_next_word(); + uint vga_res = vcReadNextWord(); + uint windowNum = vcReadNextWord(); if (getGameType() == GType_SIMON1) { if (windowNum == 16) { @@ -1563,26 +1563,26 @@ void SimonEngine::vc36_setWindowImage() { } void SimonEngine::vc37_addToSpriteY() { - VgaSprite *vsp = find_cur_sprite(); - vsp->y += vc_read_var(vc_read_next_word()); + VgaSprite *vsp = findCurSprite(); + vsp->y += vcReadVar(vcReadNextWord()); _vgaSpriteChanged++; } void SimonEngine::vc38_skipIfVarZero() { - uint var = vc_read_next_word(); - if (vc_read_var(var) == 0) - vc_skip_next_instruction(); + uint var = vcReadNextWord(); + if (vcReadVar(var) == 0) + vcSkipNextInstruction(); } void SimonEngine::vc39_setVar() { - uint var = vc_read_next_word(); - int16 value = vc_read_next_word(); - vc_write_var(var, value); + uint var = vcReadNextWord(); + int16 value = vcReadNextWord(); + vcWriteVar(var, value); } void SimonEngine::vc40() { - uint var = vc_read_next_word(); - int16 value = vc_read_var(var) + vc_read_next_word(); + uint var = vcReadNextWord(); + int16 value = vcReadVar(var) + vcReadNextWord(); if ((getGameType() == GType_SIMON2) && var == 15 && !(_bitArray[5] & 1)) { int16 tmp; @@ -1606,12 +1606,12 @@ void SimonEngine::vc40() { } no_scroll:; - vc_write_var(var, value); + vcWriteVar(var, value); } void SimonEngine::vc41() { - uint var = vc_read_next_word(); - int16 value = vc_read_var(var) - vc_read_next_word(); + uint var = vcReadNextWord(); + int16 value = vcReadVar(var) - vcReadNextWord(); if ((getGameType() == GType_SIMON2) && var == 15 && !(_bitArray[5] & 1)) { int16 tmp; @@ -1635,12 +1635,12 @@ void SimonEngine::vc41() { } no_scroll:; - vc_write_var(var, value); + vcWriteVar(var, value); } void SimonEngine::vc42_delayIfNotEQ() { - uint val = vc_read_var(vc_read_next_word()); - if (val != vc_read_next_word()) { + uint val = vcReadVar(vcReadNextWord()); + if (val != vcReadNextWord()) { add_vga_timer(_frameRate + 1, _vcPtr - 4, _vgaCurSpriteId, _vgaCurFileId); _vcPtr = (byte *)&_vc_get_out_of_code; @@ -1648,32 +1648,32 @@ void SimonEngine::vc42_delayIfNotEQ() { } void SimonEngine::vc43_skipIfBitClear() { - if (!vc_get_bit(vc_read_next_word())) { - vc_skip_next_instruction(); + if (!vcGetBit(vcReadNextWord())) { + vcSkipNextInstruction(); } } void SimonEngine::vc44_skipIfBitSet() { - if (vc_get_bit(vc_read_next_word())) { - vc_skip_next_instruction(); + if (vcGetBit(vcReadNextWord())) { + vcSkipNextInstruction(); } } void SimonEngine::vc45_setSpriteX() { - VgaSprite *vsp = find_cur_sprite(); - vsp->x = vc_read_var(vc_read_next_word()); + VgaSprite *vsp = findCurSprite(); + vsp->x = vcReadVar(vcReadNextWord()); _vgaSpriteChanged++; } void SimonEngine::vc46_setSpriteY() { - VgaSprite *vsp = find_cur_sprite(); - vsp->y = vc_read_var(vc_read_next_word()); + VgaSprite *vsp = findCurSprite(); + vsp->y = vcReadVar(vcReadNextWord()); _vgaSpriteChanged++; } void SimonEngine::vc47_addToVar() { - uint var = vc_read_next_word(); - vc_write_var(var, vc_read_var(var) + vc_read_var(vc_read_next_word())); + uint var = vcReadNextWord(); + vcWriteVar(var, vcReadVar(var) + vcReadVar(vcReadNextWord())); } void SimonEngine::vc48_setPathFinder() { @@ -1681,7 +1681,7 @@ void SimonEngine::vc48_setPathFinder() { const uint16 *p = _pathFindArray[a - 1]; if (getGameType() == GType_FF) { - VgaSprite *vsp = find_cur_sprite(); + VgaSprite *vsp = findCurSprite(); int16 x, x2, y, y1, y2, ydiff; uint pos = 0; @@ -1746,40 +1746,40 @@ void SimonEngine::vc48_setPathFinder() { } } -void SimonEngine::vc_set_bit_to(uint bit, bool value) { +void SimonEngine::vcSetBitTo(uint bit, bool value) { uint16 *bits = &_bitArray[bit >> 4]; *bits = (*bits & ~(1 << (bit & 15))) | (value << (bit & 15)); } -bool SimonEngine::vc_get_bit(uint bit) { +bool SimonEngine::vcGetBit(uint bit) { uint16 *bits = &_bitArray[bit >> 4]; return (*bits & (1 << (bit & 15))) != 0; } void SimonEngine::vc49_setBit() { - vc_set_bit_to(vc_read_next_word(), true); + vcSetBitTo(vcReadNextWord(), true); } void SimonEngine::vc50_clearBit() { - vc_set_bit_to(vc_read_next_word(), false); + vcSetBitTo(vcReadNextWord(), false); } void SimonEngine::vc51_clear_hitarea_bit_0x40() { - clear_hitarea_bit_0x40(vc_read_next_word()); + clear_hitarea_bit_0x40(vcReadNextWord()); } void SimonEngine::vc52_playSound() { bool ambient = false; - uint16 sound = vc_read_next_word(); + uint16 sound = vcReadNextWord(); if (sound >= 0x8000) { ambient = true; sound = -sound; } if (getGameType() == GType_FF) { - uint16 pan = vc_read_next_word(); - uint16 vol = vc_read_next_word(); + uint16 pan = vcReadNextWord(); + uint16 vol = vcReadNextWord(); _sound->playSoundData(_curSfxFile, sound, pan, vol, ambient); } else if (getGameType() == GType_SIMON2) { if (ambient) { @@ -1796,9 +1796,9 @@ void SimonEngine::vc52_playSound() { void SimonEngine::vc53_no_op() { // Start sound effect, panning it with the animation - int snd = vc_read_next_word(); - int xoffs = vc_read_next_word(); - int vol = vc_read_next_word(); + int snd = vcReadNextWord(); + int xoffs = vcReadNextWord(); + int vol = vcReadNextWord(); debug(0, "STUB: vc53_no_op: snd %d xoffs %d vol %d", snd, xoffs, vol); } @@ -1810,9 +1810,9 @@ void SimonEngine::vc54_no_op() { void SimonEngine::vc55_offset_hit_area() { HitArea *ha = _hitAreas; uint count = ARRAYSIZE(_hitAreas); - uint16 id = vc_read_next_word(); - int16 x = vc_read_next_word(); - int16 y = vc_read_next_word(); + uint16 id = vcReadNextWord(); + int16 x = vcReadNextWord(); + int16 y = vcReadNextWord(); for (;;) { if (ha->id == id) { @@ -1829,7 +1829,7 @@ void SimonEngine::vc55_offset_hit_area() { } void SimonEngine::vc56_delay() { - uint num = vc_read_var_or_word() * _frameRate; + uint num = vcReadVarOrWord() * _frameRate; add_vga_timer(num + VGA_DELAY_BASE, _vcPtr, _vgaCurSpriteId, _vgaCurFileId); _vcPtr = (byte *)&_vc_get_out_of_code; @@ -1838,11 +1838,11 @@ void SimonEngine::vc56_delay() { void SimonEngine::vc59() { if (getGameType() == GType_SIMON1) { if (!_sound->isVoiceActive()) - vc_skip_next_instruction(); + vcSkipNextInstruction(); } else { - uint file = vc_read_next_word(); - uint start = vc_read_next_word(); - uint end = vc_read_next_word() + 1; + uint file = vcReadNextWord(); + uint start = vcReadNextWord(); + uint end = vcReadNextWord() + 1; do { vc_kill_sprite(file, start); @@ -1856,10 +1856,10 @@ void SimonEngine::vc58() { const byte *vc_ptr_org; uint16 tmp; - _vgaCurFileId = vc_read_next_word(); - _vgaCurSpriteId = vc_read_next_word(); + _vgaCurFileId = vcReadNextWord(); + _vgaCurSpriteId = vcReadNextWord(); - tmp = to16Wrapper(vc_read_next_word()); + tmp = to16Wrapper(vcReadNextWord()); vc_ptr_org = _vcPtr; _vcPtr = (byte *)&tmp; @@ -1900,7 +1900,7 @@ void SimonEngine::vc_kill_sprite(uint file, uint sprite) { vfs++; } - vsp = find_cur_sprite(); + vsp = findCurSprite(); if (vsp->id) { vc25_halt_sprite(); @@ -1925,19 +1925,19 @@ void SimonEngine::vc60_killSprite() { if (getGameType() == GType_SIMON1) { file = _vgaCurFileId; } else { - file = vc_read_next_word(); + file = vcReadNextWord(); } - uint sprite = vc_read_next_word(); + uint sprite = vcReadNextWord(); vc_kill_sprite(file, sprite); } void SimonEngine::vc61_setMaskImage() { - VgaSprite *vsp = find_cur_sprite(); + VgaSprite *vsp = findCurSprite(); - vsp->image = vc_read_var_or_word(); + vsp->image = vcReadVarOrWord(); - vsp->x += vc_read_next_word(); - vsp->y += vc_read_next_word(); + vsp->x += vcReadNextWord(); + vsp->y += vcReadNextWord(); vsp->flags = 0x24; _vgaSpriteChanged++; @@ -2033,7 +2033,7 @@ void SimonEngine::vc63_fastFadeIn() { void SimonEngine::vc64_skipIfSpeechEnded() { if (!_sound->isVoiceActive() || (_subtitles && _language != Common::HB_ISR)) - vc_skip_next_instruction(); + vcSkipNextInstruction(); } void SimonEngine::vc65_slowFadeIn() { @@ -2048,32 +2048,32 @@ void SimonEngine::vc65_slowFadeIn() { } void SimonEngine::vc66_skipIfNotEqual() { - uint a = vc_read_next_word(); - uint b = vc_read_next_word(); + uint a = vcReadNextWord(); + uint b = vcReadNextWord(); - if (vc_read_var(a) != vc_read_var(b)) - vc_skip_next_instruction(); + if (vcReadVar(a) != vcReadVar(b)) + vcSkipNextInstruction(); } void SimonEngine::vc67_skipIfGE() { - uint a = vc_read_next_word(); - uint b = vc_read_next_word(); + uint a = vcReadNextWord(); + uint b = vcReadNextWord(); - if (vc_read_var(a) >= vc_read_var(b)) - vc_skip_next_instruction(); + if (vcReadVar(a) >= vcReadVar(b)) + vcSkipNextInstruction(); } void SimonEngine::vc68_skipIfLE() { - uint a = vc_read_next_word(); - uint b = vc_read_next_word(); + uint a = vcReadNextWord(); + uint b = vcReadNextWord(); - if (vc_read_var(a) <= vc_read_var(b)) - vc_skip_next_instruction(); + if (vcReadVar(a) <= vcReadVar(b)) + vcSkipNextInstruction(); } void SimonEngine::vc69_playTrack() { - int16 track = vc_read_next_word(); - int16 loop = vc_read_next_word(); + int16 track = vcReadNextWord(); + int16 loop = vcReadNextWord(); // Jamieson630: // This is a "play track". The original @@ -2096,8 +2096,8 @@ void SimonEngine::vc69_playTrack() { void SimonEngine::vc70_queueMusic() { // Simon2 - uint16 track = vc_read_next_word(); - uint16 loop = vc_read_next_word(); + uint16 track = vcReadNextWord(); + uint16 loop = vcReadNextWord(); // Jamieson630: // This sets the "on end of track" action. @@ -2116,7 +2116,7 @@ void SimonEngine::vc71_checkMusicQueue() { // unless (1) there is a track playing, AND // (2) there is a track queued to play after it. if (!midi.isPlaying (true)) - vc_skip_next_instruction(); + vcSkipNextInstruction(); } void SimonEngine::vc72_play_track_2() { @@ -2133,8 +2133,8 @@ void SimonEngine::vc72_play_track_2() { // case where this is used to stop a track in the // first place. - int16 track = vc_read_next_word(); - int16 loop = vc_read_next_word(); + int16 track = vcReadNextWord(); + int16 loop = vcReadNextWord(); if (track == -1 || track == 999) { midi.stop(); @@ -2145,13 +2145,13 @@ void SimonEngine::vc72_play_track_2() { } void SimonEngine::vc73_setMark() { - vc_read_next_byte(); - _marks |= 1 << vc_read_next_byte(); + vcReadNextByte(); + _marks |= 1 << vcReadNextByte(); } void SimonEngine::vc74_clearMark() { - vc_read_next_byte(); - _marks &= ~(1 << vc_read_next_byte()); + vcReadNextByte(); + _marks &= ~(1 << vcReadNextByte()); } int SimonEngine::getScale(int y, int x) { @@ -2178,16 +2178,16 @@ int SimonEngine::getScale(int y, int x) { } void SimonEngine::vc75_setScale() { - _baseY = vc_read_next_word(); - _scale = (float)vc_read_next_word() / 1000000.; + _baseY = vcReadNextWord(); + _scale = (float)vcReadNextWord() / 1000000.; } void SimonEngine::vc76_setScaleXOffs() { - VgaSprite *vsp = find_cur_sprite(); + VgaSprite *vsp = findCurSprite(); - vsp->image = vc_read_next_word(); - int16 xoffs = vc_read_next_word(); - int var = vc_read_next_word(); + vsp->image = vcReadNextWord(); + int16 xoffs = vcReadNextWord(); + int var = vcReadNextWord(); vsp->x += getScale(vsp->x, xoffs); _variableArray[var] = vsp->x; @@ -2200,11 +2200,11 @@ void SimonEngine::vc76_setScaleXOffs() { } void SimonEngine::vc77_setScaleYOffs() { - VgaSprite *vsp = find_cur_sprite(); + VgaSprite *vsp = findCurSprite(); - vsp->image = vc_read_next_word(); - int16 yoffs = vc_read_next_word(); - int var = vc_read_next_word(); + vsp->image = vcReadNextWord(); + int16 yoffs = vcReadNextWord(); + int var = vcReadNextWord(); vsp->y += getScale(vsp->y, yoffs); _variableArray[var] = vsp->y; @@ -2212,7 +2212,7 @@ void SimonEngine::vc77_setScaleYOffs() { } void SimonEngine::vc78_computeXY() { - VgaSprite *vsp = find_cur_sprite(); + VgaSprite *vsp = findCurSprite(); uint a = (uint16)_variableArray[12]; uint b = (uint16)_variableArray[13]; @@ -2228,8 +2228,8 @@ void SimonEngine::vc78_computeXY() { _variableArray[16] = posy; vsp->y = posy; - vc_set_bit_to(85, false); - if (vc_get_bit(74) == true) { + vcSetBitTo(85, false); + if (vcGetBit(74) == true) { //centreScroll(); } } @@ -2239,7 +2239,7 @@ void SimonEngine::vc79_computePosNum() { uint pos = 0; const uint16 *p = _pathFindArray[a - 1]; - int16 y = vc_read_next_word(); + int16 y = vcReadNextWord(); while(y > readUint16Wrapper(p + 1)) { p += 2; pos++; @@ -2249,29 +2249,29 @@ void SimonEngine::vc79_computePosNum() { } void SimonEngine::vc80_setOverlayImage() { - VgaSprite *vsp = find_cur_sprite(); + VgaSprite *vsp = findCurSprite(); - vsp->image = vc_read_var_or_word(); + vsp->image = vcReadVarOrWord(); - vsp->x += vc_read_next_word(); - vsp->y += vc_read_next_word(); + vsp->x += vcReadNextWord(); + vsp->y += vcReadNextWord(); vsp->flags = 0x10; _vgaSpriteChanged++; } void SimonEngine::vc81_setRandom() { - uint var = vc_read_next_word(); - uint value = vc_read_next_word(); + uint var = vcReadNextWord(); + uint value = vcReadNextWord(); writeVariable(var, _rnd.getRandomNumber(value - 1)); } void SimonEngine::vc82_getPathValue() { uint8 val; - uint16 var = vc_read_next_word(); + uint16 var = vcReadNextWord(); - if (vc_get_bit(82) == true) { + if (vcGetBit(82) == true) { val = _pathValues1[_GPVCount1++]; } else { val = _pathValues[_GPVCount++]; @@ -2282,9 +2282,9 @@ void SimonEngine::vc82_getPathValue() { void SimonEngine::vc83_playSoundLoop() { // Start looping sound effect - int snd = vc_read_next_word(); - int vol = vc_read_next_word(); - int pan = vc_read_next_word(); + int snd = vcReadNextWord(); + int vol = vcReadNextWord(); + int pan = vcReadNextWord(); debug(0, "STUB: vc83_playSoundLoop: snd %d vol %d pan %d", snd, vol, pan); } |