diff options
Diffstat (limited to 'engines/zvision/core')
-rw-r--r-- | engines/zvision/core/events.cpp | 2 | ||||
-rw-r--r-- | engines/zvision/core/menu.cpp | 282 | ||||
-rw-r--r-- | engines/zvision/core/menu.h | 34 | ||||
-rw-r--r-- | engines/zvision/core/midi.cpp | 18 | ||||
-rw-r--r-- | engines/zvision/core/midi.h | 6 | ||||
-rw-r--r-- | engines/zvision/core/save_manager.cpp | 3 | ||||
-rw-r--r-- | engines/zvision/core/search_manager.cpp | 103 | ||||
-rw-r--r-- | engines/zvision/core/search_manager.h | 38 |
8 files changed, 255 insertions, 231 deletions
diff --git a/engines/zvision/core/events.cpp b/engines/zvision/core/events.cpp index 0d38e08b88..873cdb0df7 100644 --- a/engines/zvision/core/events.cpp +++ b/engines/zvision/core/events.cpp @@ -170,7 +170,7 @@ void ZVision::processEvents() { _scriptManager->setStateValue(StateKey_RMouse, 1); if (getGameId() == GID_NEMESIS) - _scriptManager->invertory_cycle(); + _scriptManager->inventoryCycle(); break; case Common::EVENT_RBUTTONUP: diff --git a/engines/zvision/core/menu.cpp b/engines/zvision/core/menu.cpp index 57a1983784..5816b3f364 100644 --- a/engines/zvision/core/menu.cpp +++ b/engines/zvision/core/menu.cpp @@ -43,14 +43,14 @@ enum { menu_MAIN_EXIT = 3 }; -menuHandler::menuHandler(ZVision *engine) { +MenuHandler::MenuHandler(ZVision *engine) { _engine = engine; - menu_bar_flag = 0xFFFF; + menuBarFlag = 0xFFFF; } -menuZgi::menuZgi(ZVision *engine) : - menuHandler(engine) { - menu_mousefocus = -1; +MenuZGI::MenuZGI(ZVision *engine) : + MenuHandler(engine) { + menuMouseFocus = -1; inmenu = false; scrolled[0] = false; scrolled[1] = false; @@ -58,7 +58,7 @@ menuZgi::menuZgi(ZVision *engine) : scrollPos[0] = 0.0; scrollPos[1] = 0.0; scrollPos[2] = 0.0; - mouse_on_item = -1; + mouseOnItem = -1; char buf[24]; for (int i = 1; i < 4; i++) { @@ -77,17 +77,17 @@ menuZgi::menuZgi(ZVision *engine) : for (int i = 0; i < 50; i++) { items[i][0] = NULL; items[i][1] = NULL; - item_id[i] = 0; + itemId[i] = 0; } for (int i = 0; i < 12; i++) { magic[i][0] = NULL; magic[i][1] = NULL; - magic_id[i] = 0; + magicId[i] = 0; } } -menuZgi::~menuZgi() { +MenuZGI::~MenuZGI() { for (int i = 0; i < 3; i++) { menuback[i][0].free(); menuback[i][1].free(); @@ -118,25 +118,25 @@ menuZgi::~menuZgi() { } } -void menuZgi::onMouseUp(const Common::Point &Pos) { +void MenuZGI::onMouseUp(const Common::Point &Pos) { if (Pos.y < 40) { - switch (menu_mousefocus) { + switch (menuMouseFocus) { case menu_ITEM: - if (menu_bar_flag & menuBar_Items) { - int item_count = _engine->getScriptManager()->getStateValue(StateKey_Inv_TotalSlots); - if (item_count == 0) - item_count = 20; + if (menuBarFlag & menuBar_Items) { + int itemCount = _engine->getScriptManager()->getStateValue(StateKey_Inv_TotalSlots); + if (itemCount == 0) + itemCount = 20; - for (int i = 0; i < item_count; i++) { - int itemspace = (600 - 28) / item_count; + for (int i = 0; i < itemCount; i++) { + int itemspace = (600 - 28) / itemCount; if (Common::Rect(scrollPos[menu_ITEM] + itemspace * i, 0, scrollPos[menu_ITEM] + itemspace * i + 28, 32).contains(Pos)) { - int32 mouse_item = _engine->getScriptManager()->getStateValue(StateKey_InventoryItem); - if (mouse_item >= 0 && mouse_item < 0xE0) { - _engine->getScriptManager()->invertory_drop(mouse_item); - _engine->getScriptManager()->invertory_add(_engine->getScriptManager()->getStateValue(SLOT_START_SLOT + i)); - _engine->getScriptManager()->setStateValue(SLOT_START_SLOT + i, mouse_item); + int32 mouseItem = _engine->getScriptManager()->getStateValue(StateKey_InventoryItem); + if (mouseItem >= 0 && mouseItem < 0xE0) { + _engine->getScriptManager()->inventoryDrop(mouseItem); + _engine->getScriptManager()->inventoryAdd(_engine->getScriptManager()->getStateValue(SLOT_START_SLOT + i)); + _engine->getScriptManager()->setStateValue(SLOT_START_SLOT + i, mouseItem); redraw = true; } @@ -146,7 +146,7 @@ void menuZgi::onMouseUp(const Common::Point &Pos) { break; case menu_MAGIC: - if (menu_bar_flag & menuBar_Magic) { + if (menuBarFlag & menuBar_Magic) { for (int i = 0; i < 12; i++) { uint itemnum = _engine->getScriptManager()->getStateValue(SLOT_SPELL_1 + i); @@ -169,7 +169,7 @@ void menuZgi::onMouseUp(const Common::Point &Pos) { case menu_MAIN: // Exit - if (menu_bar_flag & menuBar_Exit) + if (menuBarFlag & menuBar_Exit) if (Common::Rect(320 + 135, scrollPos[menu_MAIN], 320 + 135 + 135, @@ -178,7 +178,7 @@ void menuZgi::onMouseUp(const Common::Point &Pos) { } // Settings - if (menu_bar_flag & menuBar_Settings) + if (menuBarFlag & menuBar_Settings) if (Common::Rect(320 , scrollPos[menu_MAIN], 320 + 135, @@ -187,7 +187,7 @@ void menuZgi::onMouseUp(const Common::Point &Pos) { } // Load - if (menu_bar_flag & menuBar_Restore) + if (menuBarFlag & menuBar_Restore) if (Common::Rect(320 - 135, scrollPos[menu_MAIN], 320, @@ -196,7 +196,7 @@ void menuZgi::onMouseUp(const Common::Point &Pos) { } // Save - if (menu_bar_flag & menuBar_Save) + if (menuBarFlag & menuBar_Save) if (Common::Rect(320 - 135 * 2, scrollPos[menu_MAIN], 320 - 135, @@ -208,133 +208,133 @@ void menuZgi::onMouseUp(const Common::Point &Pos) { } } -void menuZgi::onMouseMove(const Common::Point &Pos) { +void MenuZGI::onMouseMove(const Common::Point &Pos) { if (Pos.y < 40) { if (!inmenu) redraw = true; inmenu = true; - switch (menu_mousefocus) { + switch (menuMouseFocus) { case menu_ITEM: - if (menu_bar_flag & menuBar_Items) { - int item_count = _engine->getScriptManager()->getStateValue(StateKey_Inv_TotalSlots); - if (item_count == 0) - item_count = 20; - else if (item_count > 50) - item_count = 50; + if (menuBarFlag & menuBar_Items) { + int itemCount = _engine->getScriptManager()->getStateValue(StateKey_Inv_TotalSlots); + if (itemCount == 0) + itemCount = 20; + else if (itemCount > 50) + itemCount = 50; - int last_item = mouse_on_item; + int lastItem = mouseOnItem; - mouse_on_item = -1; + mouseOnItem = -1; - for (int i = 0; i < item_count; i++) { - int itemspace = (600 - 28) / item_count; + for (int i = 0; i < itemCount; i++) { + int itemspace = (600 - 28) / itemCount; if (Common::Rect(scrollPos[menu_ITEM] + itemspace * i, 0, scrollPos[menu_ITEM] + itemspace * i + 28, 32).contains(Pos)) { - mouse_on_item = i; + mouseOnItem = i; break; } } - if (last_item != mouse_on_item) - if (_engine->getScriptManager()->getStateValue(SLOT_START_SLOT + mouse_on_item) || - _engine->getScriptManager()->getStateValue(SLOT_START_SLOT + last_item)) + if (lastItem != mouseOnItem) + if (_engine->getScriptManager()->getStateValue(SLOT_START_SLOT + mouseOnItem) || + _engine->getScriptManager()->getStateValue(SLOT_START_SLOT + lastItem)) redraw = true; } break; case menu_MAGIC: - if (menu_bar_flag & menuBar_Magic) { - int last_item = mouse_on_item; - mouse_on_item = -1; + if (menuBarFlag & menuBar_Magic) { + int lastItem = mouseOnItem; + mouseOnItem = -1; for (int i = 0; i < 12; i++) { if (Common::Rect(668 + 47 * i - scrollPos[menu_MAGIC], 0, 668 + 47 * i - scrollPos[menu_MAGIC] + 28, 32).contains(Pos)) { - mouse_on_item = i; + mouseOnItem = i; break; } } - if (last_item != mouse_on_item) - if (_engine->getScriptManager()->getStateValue(SLOT_SPELL_1 + mouse_on_item) || - _engine->getScriptManager()->getStateValue(SLOT_SPELL_1 + last_item)) + if (lastItem != mouseOnItem) + if (_engine->getScriptManager()->getStateValue(SLOT_SPELL_1 + mouseOnItem) || + _engine->getScriptManager()->getStateValue(SLOT_SPELL_1 + lastItem)) redraw = true; } break; case menu_MAIN: { - int last_item = mouse_on_item; - mouse_on_item = -1; + int lastItem = mouseOnItem; + mouseOnItem = -1; // Exit - if (menu_bar_flag & menuBar_Exit) + if (menuBarFlag & menuBar_Exit) if (Common::Rect(320 + 135, scrollPos[menu_MAIN], 320 + 135 + 135, scrollPos[menu_MAIN] + 32).contains(Pos)) { - mouse_on_item = menu_MAIN_EXIT; + mouseOnItem = menu_MAIN_EXIT; } // Settings - if (menu_bar_flag & menuBar_Settings) + if (menuBarFlag & menuBar_Settings) if (Common::Rect(320 , scrollPos[menu_MAIN], 320 + 135, scrollPos[menu_MAIN] + 32).contains(Pos)) { - mouse_on_item = menu_MAIN_PREF; + mouseOnItem = menu_MAIN_PREF; } // Load - if (menu_bar_flag & menuBar_Restore) + if (menuBarFlag & menuBar_Restore) if (Common::Rect(320 - 135, scrollPos[menu_MAIN], 320, scrollPos[menu_MAIN] + 32).contains(Pos)) { - mouse_on_item = menu_MAIN_REST; + mouseOnItem = menu_MAIN_REST; } // Save - if (menu_bar_flag & menuBar_Save) + if (menuBarFlag & menuBar_Save) if (Common::Rect(320 - 135 * 2, scrollPos[menu_MAIN], 320 - 135, scrollPos[menu_MAIN] + 32).contains(Pos)) { - mouse_on_item = menu_MAIN_SAVE; + mouseOnItem = menu_MAIN_SAVE; } - if (last_item != mouse_on_item) + if (lastItem != mouseOnItem) redraw = true; } break; default: - int cur_menu = menu_mousefocus; + int cur_menu = menuMouseFocus; if (Common::Rect(64, 0, 64 + 512, 8).contains(Pos)) { // Main - menu_mousefocus = menu_MAIN; + menuMouseFocus = menu_MAIN; scrolled[menu_MAIN] = false; scrollPos[menu_MAIN] = menuback[menu_MAIN][1].h - menuback[menu_MAIN][0].h; _engine->getScriptManager()->setStateValue(StateKey_MenuState, 2); } - if (menu_bar_flag & menuBar_Magic) + if (menuBarFlag & menuBar_Magic) if (Common::Rect(640 - 28, 0, 640, 32).contains(Pos)) { // Magic - menu_mousefocus = menu_MAGIC; + menuMouseFocus = menu_MAGIC; scrolled[menu_MAGIC] = false; scrollPos[menu_MAGIC] = 28; _engine->getScriptManager()->setStateValue(StateKey_MenuState, 3); } - if (menu_bar_flag & menuBar_Items) + if (menuBarFlag & menuBar_Items) if (Common::Rect(0, 0, 28, 32).contains(Pos)) { // Items - menu_mousefocus = menu_ITEM; + menuMouseFocus = menu_ITEM; scrolled[menu_ITEM] = false; scrollPos[menu_ITEM] = 28 - 600; _engine->getScriptManager()->setStateValue(StateKey_MenuState, 1); } - if (cur_menu != menu_mousefocus) + if (cur_menu != menuMouseFocus) clean = true; break; @@ -345,18 +345,18 @@ void menuZgi::onMouseMove(const Common::Point &Pos) { inmenu = false; if (_engine->getScriptManager()->getStateValue(StateKey_MenuState) != 0) _engine->getScriptManager()->setStateValue(StateKey_MenuState, 0); - menu_mousefocus = -1; + menuMouseFocus = -1; } } -void menuZgi::process(uint32 deltatime) { +void MenuZGI::process(uint32 deltatime) { if (clean) { _engine->getRenderManager()->clearMenuSurface(); clean = false; } - switch (menu_mousefocus) { + switch (menuMouseFocus) { case menu_ITEM: - if (menu_bar_flag & menuBar_Items) + if (menuBarFlag & menuBar_Items) if (!scrolled[menu_ITEM]) { redraw = true; float scrl = 600.0 * (deltatime / 1000.0); @@ -374,31 +374,31 @@ void menuZgi::process(uint32 deltatime) { if (redraw) { _engine->getRenderManager()->blitSurfaceToMenu(menuback[menu_ITEM][0], scrollPos[menu_ITEM], 0); - int item_count = _engine->getScriptManager()->getStateValue(StateKey_Inv_TotalSlots); - if (item_count == 0) - item_count = 20; - else if (item_count > 50) - item_count = 50; + int itemCount = _engine->getScriptManager()->getStateValue(StateKey_Inv_TotalSlots); + if (itemCount == 0) + itemCount = 20; + else if (itemCount > 50) + itemCount = 50; - for (int i = 0; i < item_count; i++) { - int itemspace = (600 - 28) / item_count; + for (int i = 0; i < itemCount; i++) { + int itemspace = (600 - 28) / itemCount; bool inrect = false; - if (mouse_on_item == i) + if (mouseOnItem == i) inrect = true; - uint cur_item_id = _engine->getScriptManager()->getStateValue(SLOT_START_SLOT + i); + uint curItemId = _engine->getScriptManager()->getStateValue(SLOT_START_SLOT + i); - if (cur_item_id != 0) { - if (item_id[i] != cur_item_id) { + if (curItemId != 0) { + if (itemId[i] != curItemId) { char buf[16]; - sprintf(buf, "gmzwu%2.2x1.tga", cur_item_id); + sprintf(buf, "gmzwu%2.2x1.tga", curItemId); items[i][0] = _engine->getRenderManager()->loadImage(buf, false); - sprintf(buf, "gmzxu%2.2x1.tga", cur_item_id); + sprintf(buf, "gmzxu%2.2x1.tga", curItemId); items[i][1] = _engine->getRenderManager()->loadImage(buf, false); - item_id[i] = cur_item_id; + itemId[i] = curItemId; } if (inrect) @@ -417,7 +417,7 @@ void menuZgi::process(uint32 deltatime) { delete items[i][1]; items[i][1] = NULL; } - item_id[i] = 0; + itemId[i] = 0; } } @@ -426,7 +426,7 @@ void menuZgi::process(uint32 deltatime) { break; case menu_MAGIC: - if (menu_bar_flag & menuBar_Magic) + if (menuBarFlag & menuBar_Magic) if (!scrolled[menu_MAGIC]) { redraw = true; float scrl = 600.0 * (deltatime / 1000.0); @@ -447,25 +447,25 @@ void menuZgi::process(uint32 deltatime) { for (int i = 0; i < 12; i++) { bool inrect = false; - if (mouse_on_item == i) + if (mouseOnItem == i) inrect = true; - uint cur_item_id = _engine->getScriptManager()->getStateValue(SLOT_SPELL_1 + i); - if (cur_item_id) { + uint curItemId = _engine->getScriptManager()->getStateValue(SLOT_SPELL_1 + i); + if (curItemId) { if (_engine->getScriptManager()->getStateValue(SLOT_REVERSED_SPELLBOOK) == 1) - cur_item_id = 0xEE + i; + curItemId = 0xEE + i; else - cur_item_id = 0xE0 + i; + curItemId = 0xE0 + i; } - if (cur_item_id != 0) { - if (item_id[i] != cur_item_id) { + if (curItemId != 0) { + if (itemId[i] != curItemId) { char buf[16]; - sprintf(buf, "gmzwu%2.2x1.tga", cur_item_id); + sprintf(buf, "gmzwu%2.2x1.tga", curItemId); magic[i][0] = _engine->getRenderManager()->loadImage(buf, false); - sprintf(buf, "gmzxu%2.2x1.tga", cur_item_id); + sprintf(buf, "gmzxu%2.2x1.tga", curItemId); magic[i][1] = _engine->getRenderManager()->loadImage(buf, false); - magic_id[i] = cur_item_id; + magicId[i] = curItemId; } if (inrect) @@ -484,7 +484,7 @@ void menuZgi::process(uint32 deltatime) { delete magic[i][1]; magic[i][1] = NULL; } - magic_id[i] = 0; + magicId[i] = 0; } } redraw = false; @@ -509,26 +509,26 @@ void menuZgi::process(uint32 deltatime) { if (redraw) { _engine->getRenderManager()->blitSurfaceToMenu(menuback[menu_MAIN][0], 30, scrollPos[menu_MAIN]); - if (menu_bar_flag & menuBar_Exit) { - if (mouse_on_item == menu_MAIN_EXIT) + if (menuBarFlag & menuBar_Exit) { + if (mouseOnItem == menu_MAIN_EXIT) _engine->getRenderManager()->blitSurfaceToMenu(menubar[menu_MAIN_EXIT][1], 320 + 135, scrollPos[menu_MAIN]); else _engine->getRenderManager()->blitSurfaceToMenu(menubar[menu_MAIN_EXIT][0], 320 + 135, scrollPos[menu_MAIN]); } - if (menu_bar_flag & menuBar_Settings) { - if (mouse_on_item == menu_MAIN_PREF) + if (menuBarFlag & menuBar_Settings) { + if (mouseOnItem == menu_MAIN_PREF) _engine->getRenderManager()->blitSurfaceToMenu(menubar[menu_MAIN_PREF][1], 320, scrollPos[menu_MAIN]); else _engine->getRenderManager()->blitSurfaceToMenu(menubar[menu_MAIN_PREF][0], 320, scrollPos[menu_MAIN]); } - if (menu_bar_flag & menuBar_Restore) { - if (mouse_on_item == menu_MAIN_REST) + if (menuBarFlag & menuBar_Restore) { + if (mouseOnItem == menu_MAIN_REST) _engine->getRenderManager()->blitSurfaceToMenu(menubar[menu_MAIN_REST][1], 320 - 135, scrollPos[menu_MAIN]); else _engine->getRenderManager()->blitSurfaceToMenu(menubar[menu_MAIN_REST][0], 320 - 135, scrollPos[menu_MAIN]); } - if (menu_bar_flag & menuBar_Save) { - if (mouse_on_item == menu_MAIN_SAVE) + if (menuBarFlag & menuBar_Save) { + if (mouseOnItem == menu_MAIN_SAVE) _engine->getRenderManager()->blitSurfaceToMenu(menubar[menu_MAIN_SAVE][1], 320 - 135 * 2, scrollPos[menu_MAIN]); else _engine->getRenderManager()->blitSurfaceToMenu(menubar[menu_MAIN_SAVE][0], 320 - 135 * 2, scrollPos[menu_MAIN]); @@ -541,10 +541,10 @@ void menuZgi::process(uint32 deltatime) { if (inmenu) { _engine->getRenderManager()->blitSurfaceToMenu(menuback[menu_MAIN][1], 30, 0); - if (menu_bar_flag & menuBar_Items) + if (menuBarFlag & menuBar_Items) _engine->getRenderManager()->blitSurfaceToMenu(menuback[menu_ITEM][1], 0, 0); - if (menu_bar_flag & menuBar_Magic) + if (menuBarFlag & menuBar_Magic) _engine->getRenderManager()->blitSurfaceToMenu(menuback[menu_MAGIC][1], 640 - 28, 0); } redraw = false; @@ -554,12 +554,12 @@ void menuZgi::process(uint32 deltatime) { } -menuNem::menuNem(ZVision *engine) : - menuHandler(engine) { +MenuNemesis::MenuNemesis(ZVision *engine) : + MenuHandler(engine) { inmenu = false; scrolled = false; scrollPos = 0.0; - mouse_on_item = -1; + mouseOnItem = -1; char buf[24]; for (int i = 0; i < 4; i++) @@ -573,7 +573,7 @@ menuNem::menuNem(ZVision *engine) : frm = 0; } -menuNem::~menuNem() { +MenuNemesis::~MenuNemesis() { for (int i = 0; i < 4; i++) for (int j = 0; j < 6; j++) but[i][j].free(); @@ -583,10 +583,10 @@ menuNem::~menuNem() { static const int16 buts[4][2] = { {120 , 64}, {144, 184}, {128, 328}, {120, 456} }; -void menuNem::onMouseUp(const Common::Point &Pos) { +void MenuNemesis::onMouseUp(const Common::Point &Pos) { if (Pos.y < 40) { // Exit - if (menu_bar_flag & menuBar_Exit) + if (menuBarFlag & menuBar_Exit) if (Common::Rect(buts[3][1], scrollPos, buts[3][0] + buts[3][1], @@ -597,7 +597,7 @@ void menuNem::onMouseUp(const Common::Point &Pos) { } // Settings - if (menu_bar_flag & menuBar_Settings) + if (menuBarFlag & menuBar_Settings) if (Common::Rect(buts[2][1], scrollPos, buts[2][0] + buts[2][1], @@ -608,7 +608,7 @@ void menuNem::onMouseUp(const Common::Point &Pos) { } // Load - if (menu_bar_flag & menuBar_Restore) + if (menuBarFlag & menuBar_Restore) if (Common::Rect(buts[1][1], scrollPos, buts[1][0] + buts[1][1], @@ -619,7 +619,7 @@ void menuNem::onMouseUp(const Common::Point &Pos) { } // Save - if (menu_bar_flag & menuBar_Save) + if (menuBarFlag & menuBar_Save) if (Common::Rect(buts[0][1], scrollPos, buts[0][0] + buts[0][1], @@ -631,7 +631,7 @@ void menuNem::onMouseUp(const Common::Point &Pos) { } } -void menuNem::onMouseMove(const Common::Point &Pos) { +void MenuNemesis::onMouseMove(const Common::Point &Pos) { if (Pos.y < 40) { inmenu = true; @@ -639,46 +639,46 @@ void menuNem::onMouseMove(const Common::Point &Pos) { if (_engine->getScriptManager()->getStateValue(StateKey_MenuState) != 2) _engine->getScriptManager()->setStateValue(StateKey_MenuState, 2); - int last_item = mouse_on_item; - mouse_on_item = -1; + int lastItem = mouseOnItem; + mouseOnItem = -1; // Exit - if (menu_bar_flag & menuBar_Exit) + if (menuBarFlag & menuBar_Exit) if (Common::Rect(buts[3][1], scrollPos, buts[3][0] + buts[3][1], scrollPos + 32).contains(Pos)) { - mouse_on_item = menu_MAIN_EXIT; + mouseOnItem = menu_MAIN_EXIT; } // Settings - if (menu_bar_flag & menuBar_Settings) + if (menuBarFlag & menuBar_Settings) if (Common::Rect(buts[2][1], scrollPos, buts[2][0] + buts[2][1], scrollPos + 32).contains(Pos)) { - mouse_on_item = menu_MAIN_PREF; + mouseOnItem = menu_MAIN_PREF; } // Load - if (menu_bar_flag & menuBar_Restore) + if (menuBarFlag & menuBar_Restore) if (Common::Rect(buts[1][1], scrollPos, buts[1][0] + buts[1][1], scrollPos + 32).contains(Pos)) { - mouse_on_item = menu_MAIN_REST; + mouseOnItem = menu_MAIN_REST; } // Save - if (menu_bar_flag & menuBar_Save) + if (menuBarFlag & menuBar_Save) if (Common::Rect(buts[0][1], scrollPos, buts[0][0] + buts[0][1], scrollPos + 32).contains(Pos)) { - mouse_on_item = menu_MAIN_SAVE; + mouseOnItem = menu_MAIN_SAVE; } - if (last_item != mouse_on_item) { + if (lastItem != mouseOnItem) { redraw = true; frm = 0; delay = 200; @@ -687,11 +687,11 @@ void menuNem::onMouseMove(const Common::Point &Pos) { inmenu = false; if (_engine->getScriptManager()->getStateValue(StateKey_MenuState) != 0) _engine->getScriptManager()->setStateValue(StateKey_MenuState, 0); - mouse_on_item = -1; + mouseOnItem = -1; } } -void menuNem::process(uint32 deltatime) { +void MenuNemesis::process(uint32 deltatime) { if (inmenu) { if (!scrolled) { float scrl = 32.0 * 2.0 * (deltatime / 1000.0); @@ -708,7 +708,7 @@ void menuNem::process(uint32 deltatime) { scrollPos = 0; } - if (mouse_on_item != -1) { + if (mouseOnItem != -1) { delay -= deltatime; if (delay <= 0 && frm < 4) { delay = 200; @@ -720,20 +720,20 @@ void menuNem::process(uint32 deltatime) { if (redraw) { _engine->getRenderManager()->blitSurfaceToMenu(menubar, 64, scrollPos); - if (menu_bar_flag & menuBar_Exit) - if (mouse_on_item == menu_MAIN_EXIT) + if (menuBarFlag & menuBar_Exit) + if (mouseOnItem == menu_MAIN_EXIT) _engine->getRenderManager()->blitSurfaceToMenu(but[3][frm], buts[3][1], scrollPos); - if (menu_bar_flag & menuBar_Settings) - if (mouse_on_item == menu_MAIN_PREF) + if (menuBarFlag & menuBar_Settings) + if (mouseOnItem == menu_MAIN_PREF) _engine->getRenderManager()->blitSurfaceToMenu(but[2][frm], buts[2][1], scrollPos); - if (menu_bar_flag & menuBar_Restore) - if (mouse_on_item == menu_MAIN_REST) + if (menuBarFlag & menuBar_Restore) + if (mouseOnItem == menu_MAIN_REST) _engine->getRenderManager()->blitSurfaceToMenu(but[1][frm], buts[1][1], scrollPos); - if (menu_bar_flag & menuBar_Save) - if (mouse_on_item == menu_MAIN_SAVE) + if (menuBarFlag & menuBar_Save) + if (mouseOnItem == menu_MAIN_SAVE) _engine->getRenderManager()->blitSurfaceToMenu(but[0][frm], buts[0][1], scrollPos); redraw = false; diff --git a/engines/zvision/core/menu.h b/engines/zvision/core/menu.h index c2ea822dd9..62683de912 100644 --- a/engines/zvision/core/menu.h +++ b/engines/zvision/core/menu.h @@ -40,30 +40,30 @@ enum menuBar { menuBar_Magic = 0x200 }; -class menuHandler { +class MenuHandler { public: - menuHandler(ZVision *engine); - virtual ~menuHandler() {}; + MenuHandler(ZVision *engine); + virtual ~MenuHandler() {}; virtual void onMouseMove(const Common::Point &Pos) {}; virtual void onMouseDown(const Common::Point &Pos) {}; virtual void onMouseUp(const Common::Point &Pos) {}; virtual void process(uint32 deltaTimeInMillis) {}; void setEnable(uint16 flags) { - menu_bar_flag = flags; + menuBarFlag = flags; } uint16 getEnable() { - return menu_bar_flag; + return menuBarFlag; } protected: - uint16 menu_bar_flag; + uint16 menuBarFlag; ZVision *_engine; }; -class menuZgi: public menuHandler { +class MenuZGI: public MenuHandler { public: - menuZgi(ZVision *engine); - ~menuZgi(); + MenuZGI(ZVision *engine); + ~MenuZGI(); void onMouseMove(const Common::Point &Pos); void onMouseUp(const Common::Point &Pos); void process(uint32 deltaTimeInMillis); @@ -73,15 +73,15 @@ private: Graphics::Surface *items[50][2]; - uint item_id[50]; + uint itemId[50]; Graphics::Surface *magic[12][2]; - uint magic_id[12]; + uint magicId[12]; - int menu_mousefocus; + int menuMouseFocus; bool inmenu; - int mouse_on_item; + int mouseOnItem; bool scrolled[3]; float scrollPos[3]; @@ -97,10 +97,10 @@ private: }; -class menuNem: public menuHandler { +class MenuNemesis: public MenuHandler { public: - menuNem(ZVision *engine); - ~menuNem(); + MenuNemesis(ZVision *engine); + ~MenuNemesis(); void onMouseMove(const Common::Point &Pos); void onMouseUp(const Common::Point &Pos); void process(uint32 deltaTimeInMillis); @@ -110,7 +110,7 @@ private: bool inmenu; - int mouse_on_item; + int mouseOnItem; bool scrolled; float scrollPos; diff --git a/engines/zvision/core/midi.cpp b/engines/zvision/core/midi.cpp index 5cc8cd0402..736be1311d 100644 --- a/engines/zvision/core/midi.cpp +++ b/engines/zvision/core/midi.cpp @@ -26,25 +26,25 @@ namespace ZVision { -midiManager::midiManager() { +MidiManager::MidiManager() { MidiDriver::DeviceHandle dev = MidiDriver::detectDevice(MDT_MIDI | MDT_ADLIB); _driver = MidiDriver::createMidi(dev); _driver->open(); } -midiManager::~midiManager() { +MidiManager::~MidiManager() { stop(); _driver->close(); delete _driver; } -void midiManager::stop() { +void MidiManager::stop() { for (int8 i = 0; i < 16; i++) if (_playChannels[i].playing) noteOff(i); } -void midiManager::noteOn(int8 channel, int8 note, int8 velocity) { +void MidiManager::noteOn(int8 channel, int8 note, int8 velocity) { assert(channel <= 15); _playChannels[channel].playing = true; @@ -52,7 +52,7 @@ void midiManager::noteOn(int8 channel, int8 note, int8 velocity) { _driver->send(channel | (velocity << 16) | (note << 8) | 0x90); } -void midiManager::noteOff(int8 channel) { +void MidiManager::noteOff(int8 channel) { assert(channel <= 15); if (_playChannels[channel].playing) { @@ -61,26 +61,26 @@ void midiManager::noteOff(int8 channel) { } } -int8 midiManager::getFreeChannel() { +int8 MidiManager::getFreeChannel() { for (int8 i = 0; i < 16; i++) if (!_playChannels[i].playing) return i; return -1; } -void midiManager::setPan(int8 channel, int8 pan) { +void MidiManager::setPan(int8 channel, int8 pan) { assert(channel <= 15); _driver->send(channel | (pan << 16) | 0xAB0); } -void midiManager::setVolume(int8 channel, int8 volume) { +void MidiManager::setVolume(int8 channel, int8 volume) { assert(channel <= 15); _driver->send(channel | (volume << 16) | 0x7B0); } -void midiManager::setProgram(int8 channel, int8 prog) { +void MidiManager::setProgram(int8 channel, int8 prog) { assert(channel <= 15); _driver->send(channel | (prog << 8) | 0xC0); diff --git a/engines/zvision/core/midi.h b/engines/zvision/core/midi.h index 79f8ea3d04..a3bac19636 100644 --- a/engines/zvision/core/midi.h +++ b/engines/zvision/core/midi.h @@ -27,10 +27,10 @@ namespace ZVision { -class midiManager { +class MidiManager { public: - midiManager(); - ~midiManager(); + MidiManager(); + ~MidiManager(); void stop(); void noteOn(int8 channel, int8 noteNumber, int8 velocity); diff --git a/engines/zvision/core/save_manager.cpp b/engines/zvision/core/save_manager.cpp index 2797b940a0..9b36824c3b 100644 --- a/engines/zvision/core/save_manager.cpp +++ b/engines/zvision/core/save_manager.cpp @@ -165,6 +165,7 @@ Common::Error SaveManager::loadGame(const Common::String &saveName) { bool SaveManager::readSaveGameHeader(Common::InSaveFile *in, SaveGameHeader &header) { uint32 tag = in->readUint32BE(); + // Check if it's original savegame than fill header structure if (tag == MKTAG('Z', 'N', 'S', 'G')) { header.saveYear = 0; header.saveMonth = 0; @@ -216,7 +217,7 @@ bool SaveManager::readSaveGameHeader(Common::InSaveFile *in, SaveGameHeader &hea Common::SeekableReadStream *SaveManager::getSlotFile(uint slot) { Common::SeekableReadStream *saveFile = g_system->getSavefileManager()->openForLoading(_engine->generateSaveFileName(slot)); if (saveFile == NULL) { - // Try to load standart save file + // Try to load standard save file Common::String filename; if (_engine->getGameId() == GID_GRANDINQUISITOR) filename = Common::String::format("inqsav%u.sav", slot); diff --git a/engines/zvision/core/search_manager.cpp b/engines/zvision/core/search_manager.cpp index fe99772b9b..8350189566 100644 --- a/engines/zvision/core/search_manager.cpp +++ b/engines/zvision/core/search_manager.cpp @@ -19,6 +19,7 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * */ + #include "common/debug.h" #include "zvision/core/search_manager.h" @@ -29,18 +30,18 @@ namespace ZVision { -sManager::sManager(const Common::String &root_path, int depth) { - _root = root_path; +SearchManager::SearchManager(const Common::String &rootPath, int depth) { + _root = rootPath; if (_root[_root.size() - 1] == '\\' || _root[_root.size() - 1] == '/') _root.deleteLastChar(); - Common::FSNode fs_node(_root); + Common::FSNode fsNode(_root); - list_dir_recursive(dir_list, fs_node, depth); + listDirRecursive(dirList, fsNode, depth); - for (Common::List<Common::String>::iterator it = dir_list.begin(); it != dir_list.end();) + for (Common::List<Common::String>::iterator it = dirList.begin(); it != dirList.end();) if (it->size() == _root.size()) - it = dir_list.erase(it); + it = dirList.erase(it); else if (it->size() > _root.size()) { *it = Common::String(it->c_str() + _root.size() + 1); it++; @@ -48,7 +49,7 @@ sManager::sManager(const Common::String &root_path, int depth) { it++; } -sManager::~sManager() { +SearchManager::~SearchManager() { Common::List<Common::Archive *>::iterator it = archList.begin(); while (it != archList.end()) { delete *it; @@ -58,20 +59,20 @@ sManager::~sManager() { archList.clear(); } -void sManager::addPatch(const Common::String &src, const Common::String &dst) { - Common::String lw_name = dst; - lw_name.toLowercase(); +void SearchManager::addPatch(const Common::String &src, const Common::String &dst) { + Common::String lowerCaseName = dst; + lowerCaseName.toLowercase(); - sManager::MatchList::iterator it = files.find(lw_name); + SearchManager::MatchList::iterator it = files.find(lowerCaseName); if (it != files.end()) { - lw_name = src; - lw_name.toLowercase(); - files[lw_name] = it->_value; + lowerCaseName = src; + lowerCaseName.toLowercase(); + files[lowerCaseName] = it->_value; } } -void sManager::addFile(const Common::String &name, Common::Archive *arch) { +void SearchManager::addFile(const Common::String &name, Common::Archive *arch) { bool addArch = true; Common::List<Common::Archive *>::iterator it = archList.begin(); while (it != archList.end()) { @@ -84,17 +85,17 @@ void sManager::addFile(const Common::String &name, Common::Archive *arch) { if (addArch) archList.push_back(arch); - Common::String lw_name = name; - lw_name.toLowercase(); + Common::String lowerCaseName = name; + lowerCaseName.toLowercase(); - sManager::Node nod; - nod.name = lw_name; + SearchManager::Node nod; + nod.name = lowerCaseName; nod.arch = arch; - sManager::MatchList::iterator fit = files.find(lw_name); + SearchManager::MatchList::iterator fit = files.find(lowerCaseName); if (fit == files.end()) { - files[lw_name] = nod; + files[lowerCaseName] = nod; } else { Common::SeekableReadStream *stream = fit->_value.arch->createReadStreamForMember(fit->_value.name); if (stream) { @@ -102,16 +103,16 @@ void sManager::addFile(const Common::String &name, Common::Archive *arch) { fit->_value.arch = arch; delete stream; } else { - files[lw_name] = nod; + files[lowerCaseName] = nod; } } } -Common::File *sManager::openFile(const Common::String &name) { - Common::String lw_name = name; - lw_name.toLowercase(); +Common::File *SearchManager::openFile(const Common::String &name) { + Common::String lowerCaseName = name; + lowerCaseName.toLowercase(); - sManager::MatchList::iterator fit = files.find(lw_name); + SearchManager::MatchList::iterator fit = files.find(lowerCaseName); if (fit != files.end()) { Common::File *tmp = new Common::File(); @@ -121,29 +122,29 @@ Common::File *sManager::openFile(const Common::String &name) { return NULL; } -bool sManager::openFile(Common::File &file, const Common::String &name) { - Common::String lw_name = name; - lw_name.toLowercase(); +bool SearchManager::openFile(Common::File &file, const Common::String &name) { + Common::String lowerCaseName = name; + lowerCaseName.toLowercase(); - sManager::MatchList::iterator fit = files.find(lw_name); + SearchManager::MatchList::iterator fit = files.find(lowerCaseName); if (fit != files.end()) return file.open(fit->_value.name, *fit->_value.arch); return false; } -bool sManager::hasFile(const Common::String &name) { - Common::String lw_name = name; - lw_name.toLowercase(); +bool SearchManager::hasFile(const Common::String &name) { + Common::String lowerCaseName = name; + lowerCaseName.toLowercase(); - sManager::MatchList::iterator fit = files.find(lw_name); + SearchManager::MatchList::iterator fit = files.find(lowerCaseName); if (fit != files.end()) return true; return false; } -void sManager::loadZix(const Common::String &name) { +void SearchManager::loadZix(const Common::String &name) { Common::File file; file.open(name); @@ -168,13 +169,13 @@ void sManager::loadZix(const Common::String &name) { else if (line.matchString("DIR:*", true)) { Common::String path(line.c_str() + 5); Common::Archive *arc; - char n_path[128]; - strcpy(n_path, path.c_str()); + char tempPath[128]; + strcpy(tempPath, path.c_str()); for (uint i = 0; i < path.size(); i++) - if (n_path[i] == '\\') - n_path[i] = '/'; + if (tempPath[i] == '\\') + tempPath[i] = '/'; - path = Common::String(n_path); + path = Common::String(tempPath); if (path.size() && path[0] == '.') path.deleteChar(0); if (path.size() && path[0] == '/') @@ -187,7 +188,7 @@ void sManager::loadZix(const Common::String &name) { if (path[path.size() - 1] == '\\' || path[path.size() - 1] == '/') path.deleteLastChar(); if (path.size()) - for (Common::List<Common::String>::iterator it = dir_list.begin(); it != dir_list.end(); ++it) + for (Common::List<Common::String>::iterator it = dirList.begin(); it != dirList.end(); ++it) if (path.equalsIgnoreCase(*it)) { path = *it; break; @@ -218,9 +219,9 @@ void sManager::loadZix(const Common::String &name) { } } -void sManager::addDir(const Common::String &name) { +void SearchManager::addDir(const Common::String &name) { Common::String path; - for (Common::List<Common::String>::iterator it = dir_list.begin(); it != dir_list.end(); ++it) + for (Common::List<Common::String>::iterator it = dirList.begin(); it != dirList.end(); ++it) if (name.equalsIgnoreCase(*it)) { path = *it; break; @@ -246,8 +247,8 @@ void sManager::addDir(const Common::String &name) { zfs->listMembers(zfslist); for (Common::ArchiveMemberList::iterator ziter = zfslist.begin(); ziter != zfslist.end(); ++ziter) { - Common::String z_name = (*ziter)->getName(); - addFile(z_name, zfs); + Common::String zfsFileName = (*ziter)->getName(); + addFile(zfsFileName, zfs); } } @@ -260,15 +261,15 @@ void sManager::addDir(const Common::String &name) { } } -void sManager::list_dir_recursive(Common::List<Common::String> &_list, const Common::FSNode &fs_node, int depth) { - Common::FSList fs_list; - fs_node.getChildren(fs_list); +void SearchManager::listDirRecursive(Common::List<Common::String> &_list, const Common::FSNode &fsNode, int depth) { + Common::FSList fsList; + fsNode.getChildren(fsList); - _list.push_back(fs_node.getPath()); + _list.push_back(fsNode.getPath()); if (depth > 1) - for (Common::FSList::const_iterator it = fs_list.begin(); it != fs_list.end(); ++it) - list_dir_recursive(_list, *it, depth - 1); + for (Common::FSList::const_iterator it = fsList.begin(); it != fsList.end(); ++it) + listDirRecursive(_list, *it, depth - 1); } } // End of namespace ZVision diff --git a/engines/zvision/core/search_manager.h b/engines/zvision/core/search_manager.h index c768cb8b00..180102eac6 100644 --- a/engines/zvision/core/search_manager.h +++ b/engines/zvision/core/search_manager.h @@ -1,5 +1,27 @@ -#ifndef SEARCH_MANAGER_H_INCLUDED -#define SEARCH_MANAGER_H_INCLUDED +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#ifndef ZVISION_SEARCH_MANAGER_H +#define ZVISION_SEARCH_MANAGER_H #include "common/str.h" #include "common/hash-str.h" @@ -10,10 +32,10 @@ namespace ZVision { -class sManager { +class SearchManager { public: - sManager(const Common::String &root_path, int depth); - ~sManager(); + SearchManager(const Common::String &rootPath, int depth); + ~SearchManager(); void addFile(const Common::String &name, Common::Archive *arch); void addDir(const Common::String &name); @@ -27,14 +49,14 @@ public: private: - void list_dir_recursive(Common::List<Common::String> &dir_list, const Common::FSNode &fs_node, int depth); + void listDirRecursive(Common::List<Common::String> &dirList, const Common::FSNode &fsNode, int depth); struct Node { Common::String name; Common::Archive *arch; }; - Common::List<Common::String> dir_list; + Common::List<Common::String> dirList; typedef Common::HashMap<Common::String, Node, Common::IgnoreCase_Hash, Common::IgnoreCase_EqualTo> MatchList; @@ -48,4 +70,4 @@ private: } -#endif // SEARCH_MANAGER_H_INCLUDED +#endif // ZVISION_SEARCH_MANAGER_H |