diff options
Diffstat (limited to 'engines/zvision')
57 files changed, 1081 insertions, 1064 deletions
diff --git a/engines/zvision/animation/meta_animation.cpp b/engines/zvision/animation/meta_animation.cpp index 1ea6df6481..2e549ec838 100644 --- a/engines/zvision/animation/meta_animation.cpp +++ b/engines/zvision/animation/meta_animation.cpp @@ -39,7 +39,7 @@ namespace ZVision { MetaAnimation::MetaAnimation(const Common::String &fileName, ZVision *engine) : _fileType(RLF), - _cur_frame(NULL) { + _curFrame(NULL) { Common::String tmpFileName = fileName; tmpFileName.toLowercase(); if (tmpFileName.hasSuffix(".rlf")) { @@ -102,11 +102,11 @@ void MetaAnimation::seekToFrame(int frameNumber) { const Graphics::Surface *MetaAnimation::decodeNextFrame() { if (_fileType == RLF) - _cur_frame = _animation.rlf->decodeNextFrame(); + _curFrame = _animation.rlf->decodeNextFrame(); else - _cur_frame = _animation.avi->decodeNextFrame(); + _curFrame = _animation.avi->decodeNextFrame(); - return _cur_frame; + return _curFrame; } const Graphics::Surface *MetaAnimation::getFrameData(uint frameNumber) { @@ -114,12 +114,12 @@ const Graphics::Surface *MetaAnimation::getFrameData(uint frameNumber) { frameNumber = frameCount() - 1; if (_fileType == RLF) { - _cur_frame = _animation.rlf->getFrameData(frameNumber); - return _cur_frame; + _curFrame = _animation.rlf->getFrameData(frameNumber); + return _curFrame; } else { _animation.avi->seekToFrame(frameNumber); - _cur_frame = _animation.avi->decodeNextFrame(); - return _cur_frame; + _curFrame = _animation.avi->decodeNextFrame(); + return _curFrame; } } diff --git a/engines/zvision/animation/meta_animation.h b/engines/zvision/animation/meta_animation.h index 2ea00310f9..4795a388e4 100644 --- a/engines/zvision/animation/meta_animation.h +++ b/engines/zvision/animation/meta_animation.h @@ -57,7 +57,7 @@ public: int32 start; int32 stop; int32 loop; - int32 _cur_frm; + int32 _curFrame; int32 _delay; Graphics::Surface *_scaled; }; @@ -77,7 +77,7 @@ private: FileType _fileType; int32 _frmDelay; - const Graphics::Surface *_cur_frame; + const Graphics::Surface *_curFrame; public: 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 diff --git a/engines/zvision/fonts/truetype_font.cpp b/engines/zvision/fonts/truetype_font.cpp index 22aa16f52f..638a8ed233 100644 --- a/engines/zvision/fonts/truetype_font.cpp +++ b/engines/zvision/fonts/truetype_font.cpp @@ -116,24 +116,24 @@ Graphics::Surface *TruetypeFont::drawTextToSurface(const Common::String &text, u return surface; } -sTTFont::sTTFont(ZVision *engine) { +StyledTTFont::StyledTTFont(ZVision *engine) { _engine = engine; _style = 0; _font = NULL; _lineHeight = 0; } -sTTFont::~sTTFont() { +StyledTTFont::~StyledTTFont() { if (_font) delete _font; } -bool sTTFont::loadFont(const Common::String &fontName, int32 point, uint style) { +bool StyledTTFont::loadFont(const Common::String &fontName, int32 point, uint style) { _style = style; return loadFont(fontName, point); } -bool sTTFont::loadFont(const Common::String &fontName, int32 point) { +bool StyledTTFont::loadFont(const Common::String &fontName, int32 point) { Common::String newFontName; if (fontName.matchString("*times new roman*", true) || fontName.matchString("*times*", true)) { if ((_style & (STTF_BOLD | STTF_ITALIC)) == (STTF_BOLD | STTF_ITALIC)) @@ -205,7 +205,7 @@ bool sTTFont::loadFont(const Common::String &fontName, int32 point) { } } } - if (!themeFile) { // Fallback 2.5: Search for ScummModern.zip in SearchMan. + if (!themeFile) { // Fallback : Search for ScummModern.zip in SearchMan. themeFile = SearchMan.createReadStreamForMember("scummmodern.zip"); } if (themeFile) { @@ -243,7 +243,7 @@ bool sTTFont::loadFont(const Common::String &fontName, int32 point) { return false; } -void sTTFont::setStyle(uint newStyle) { +void StyledTTFont::setStyle(uint newStyle) { if ((_style & (STTF_BOLD | STTF_ITALIC | STTF_SHARP)) != (newStyle & (STTF_BOLD | STTF_ITALIC | STTF_SHARP))) { _style = newStyle; loadFont(_fntName, _lineHeight); @@ -252,31 +252,31 @@ void sTTFont::setStyle(uint newStyle) { } } -int sTTFont::getFontHeight() { +int StyledTTFont::getFontHeight() { if (_font) return _font->getFontHeight(); return 0; } -int sTTFont::getMaxCharWidth() { +int StyledTTFont::getMaxCharWidth() { if (_font) return _font->getMaxCharWidth(); return 0; } -int sTTFont::getCharWidth(byte chr) { +int StyledTTFont::getCharWidth(byte chr) { if (_font) return _font->getCharWidth(chr); return 0; } -int sTTFont::getKerningOffset(byte left, byte right) { +int StyledTTFont::getKerningOffset(byte left, byte right) { if (_font) return _font->getKerningOffset(left, right); return 0; } -void sTTFont::drawChar(Graphics::Surface *dst, byte chr, int x, int y, uint32 color) { +void StyledTTFont::drawChar(Graphics::Surface *dst, byte chr, int x, int y, uint32 color) { if (_font) { _font->drawChar(dst, chr, x, y, color); if (_style & STTF_UNDERLINE) { @@ -292,7 +292,7 @@ void sTTFont::drawChar(Graphics::Surface *dst, byte chr, int x, int y, uint32 co } } -void sTTFont::drawString(Graphics::Surface *dst, const Common::String &str, int x, int y, int w, uint32 color, Graphics::TextAlign align) { +void StyledTTFont::drawString(Graphics::Surface *dst, const Common::String &str, int x, int y, int w, uint32 color, Graphics::TextAlign align) { if (_font) { _font->drawString(dst, str, x, y, w, color, align); if (_style & STTF_UNDERLINE) { @@ -324,13 +324,13 @@ void sTTFont::drawString(Graphics::Surface *dst, const Common::String &str, int } } -int sTTFont::getStringWidth(const Common::String &str) { +int StyledTTFont::getStringWidth(const Common::String &str) { if (_font) return _font->getStringWidth(str); return 0; } -Graphics::Surface *sTTFont::renderSolidText(const Common::String &str, uint32 color) { +Graphics::Surface *StyledTTFont::renderSolidText(const Common::String &str, uint32 color) { Graphics::Surface *tmp = new Graphics::Surface; if (_font) { int16 w = _font->getStringWidth(str); diff --git a/engines/zvision/fonts/truetype_font.h b/engines/zvision/fonts/truetype_font.h index 0fed3ccbc4..771c02a6dc 100644 --- a/engines/zvision/fonts/truetype_font.h +++ b/engines/zvision/fonts/truetype_font.h @@ -77,10 +77,10 @@ public: }; // Styled TTF -class sTTFont { +class StyledTTFont { public: - sTTFont(ZVision *engine); - ~sTTFont(); + StyledTTFont(ZVision *engine); + ~StyledTTFont(); enum { STTF_BOLD = 1, diff --git a/engines/zvision/graphics/effects/fog.h b/engines/zvision/graphics/effects/fog.h index 62dd1f9473..45d6f9596d 100644 --- a/engines/zvision/graphics/effects/fog.h +++ b/engines/zvision/graphics/effects/fog.h @@ -20,8 +20,8 @@ * */ -#ifndef FOGFX_H_INCLUDED -#define FOGFX_H_INCLUDED +#ifndef ZVISION_FOG_H +#define ZVISION_FOG_H #include "zvision/graphics/effect.h" @@ -49,4 +49,4 @@ private: }; } // End of namespace ZVision -#endif // FOGFX_H_INCLUDED +#endif // ZVISION_FOG_H diff --git a/engines/zvision/graphics/effects/wave.cpp b/engines/zvision/graphics/effects/wave.cpp index 88239f3cad..9f2fbb285c 100644 --- a/engines/zvision/graphics/effects/wave.cpp +++ b/engines/zvision/graphics/effects/wave.cpp @@ -30,32 +30,32 @@ namespace ZVision { -WaveFx::WaveFx(ZVision *engine, uint32 key, Common::Rect region, bool ported, int16 frames, int16 s_x, int16 s_y, float ampl, float waveln, float spd): +WaveFx::WaveFx(ZVision *engine, uint32 key, Common::Rect region, bool ported, int16 frames, int16 centerX, int16 centerY, float ampl, float waveln, float spd): Effect(engine, key, region, ported) { _frame = 0; - _frame_cnt = frames; + _frameCount = frames; - _ampls.resize(_frame_cnt); - _hw = _region.width() / 2; - _hh = _region.height() / 2; + _ampls.resize(_frameCount); + _halfWidth = _region.width() / 2; + _halfHeight = _region.height() / 2; - int32 frmsize = _hw * _hh; + int32 frmsize = _halfWidth * _halfHeight; float phase = 0; - int16 w_4 = _hw / 2; - int16 h_4 = _hh / 2; + int16 quarterWidth = _halfWidth / 2; + int16 quarterHeight = _halfHeight / 2; - for (int16 i = 0; i < _frame_cnt; i++) { + for (int16 i = 0; i < _frameCount; i++) { _ampls[i].resize(frmsize); - for (int16 y = 0; y < _hh; y++) - for (int16 x = 0; x < _hw; x++) { - int16 dx = (x - w_4); - int16 dy = (y - h_4); + for (int16 y = 0; y < _halfHeight; y++) + for (int16 x = 0; x < _halfWidth; x++) { + int16 dx = (x - quarterWidth); + int16 dy = (y - quarterHeight); - _ampls[i][x + y * _hw] = ampl * sin(sqrt(dx * dx / (float)s_x + dy * dy / (float)s_y) / (-waveln * 3.1415926) + phase); + _ampls[i][x + y * _halfWidth] = ampl * sin(sqrt(dx * dx / (float)centerX + dy * dy / (float)centerY) / (-waveln * 3.1415926) + phase); } phase += spd; } @@ -68,66 +68,66 @@ WaveFx::~WaveFx() { } const Graphics::Surface *WaveFx::draw(const Graphics::Surface &srcSubRect) { - for (int16 y = 0; y < _hh; y++) { + for (int16 y = 0; y < _halfHeight; y++) { uint16 *abc = (uint16 *)_surface.getBasePtr(0, y); - uint16 *abc2 = (uint16 *)_surface.getBasePtr(0, _hh + y); - uint16 *abc3 = (uint16 *)_surface.getBasePtr(_hw, y); - uint16 *abc4 = (uint16 *)_surface.getBasePtr(_hw, _hh + y); - - for (int16 x = 0; x < _hw; x++) { - int8 amnt = _ampls[_frame][x + _hw * y]; - - int16 n_x = x + amnt; - int16 n_y = y + amnt; - - if (n_x < 0) - n_x = 0; - if (n_x >= _region.width()) - n_x = _region.width() - 1; - if (n_y < 0) - n_y = 0; - if (n_y >= _region.height()) - n_y = _region.height() - 1; - *abc = *(const uint16 *)srcSubRect.getBasePtr(n_x, n_y); - - n_x = x + amnt + _hw; - n_y = y + amnt; - - if (n_x < 0) - n_x = 0; - if (n_x >= _region.width()) - n_x = _region.width() - 1; - if (n_y < 0) - n_y = 0; - if (n_y >= _region.height()) - n_y = _region.height() - 1; - *abc3 = *(const uint16 *)srcSubRect.getBasePtr(n_x, n_y); - - n_x = x + amnt; - n_y = y + amnt + _hh; - - if (n_x < 0) - n_x = 0; - if (n_x >= _region.width()) - n_x = _region.width() - 1; - if (n_y < 0) - n_y = 0; - if (n_y >= _region.height()) - n_y = _region.height() - 1; - *abc2 = *(const uint16 *)srcSubRect.getBasePtr(n_x, n_y); - - n_x = x + amnt + _hw; - n_y = y + amnt + _hh; - - if (n_x < 0) - n_x = 0; - if (n_x >= _region.width()) - n_x = _region.width() - 1; - if (n_y < 0) - n_y = 0; - if (n_y >= _region.height()) - n_y = _region.height() - 1; - *abc4 = *(const uint16 *)srcSubRect.getBasePtr(n_x, n_y); + uint16 *abc2 = (uint16 *)_surface.getBasePtr(0, _halfHeight + y); + uint16 *abc3 = (uint16 *)_surface.getBasePtr(_halfWidth, y); + uint16 *abc4 = (uint16 *)_surface.getBasePtr(_halfWidth, _halfHeight + y); + + for (int16 x = 0; x < _halfWidth; x++) { + int8 amnt = _ampls[_frame][x + _halfWidth * y]; + + int16 nX = x + amnt; + int16 nY = y + amnt; + + if (nX < 0) + nX = 0; + if (nX >= _region.width()) + nX = _region.width() - 1; + if (nY < 0) + nY = 0; + if (nY >= _region.height()) + nY = _region.height() - 1; + *abc = *(const uint16 *)srcSubRect.getBasePtr(nX, nY); + + nX = x + amnt + _halfWidth; + nY = y + amnt; + + if (nX < 0) + nX = 0; + if (nX >= _region.width()) + nX = _region.width() - 1; + if (nY < 0) + nY = 0; + if (nY >= _region.height()) + nY = _region.height() - 1; + *abc3 = *(const uint16 *)srcSubRect.getBasePtr(nX, nY); + + nX = x + amnt; + nY = y + amnt + _halfHeight; + + if (nX < 0) + nX = 0; + if (nX >= _region.width()) + nX = _region.width() - 1; + if (nY < 0) + nY = 0; + if (nY >= _region.height()) + nY = _region.height() - 1; + *abc2 = *(const uint16 *)srcSubRect.getBasePtr(nX, nY); + + nX = x + amnt + _halfWidth; + nY = y + amnt + _halfHeight; + + if (nX < 0) + nX = 0; + if (nX >= _region.width()) + nX = _region.width() - 1; + if (nY < 0) + nY = 0; + if (nY >= _region.height()) + nY = _region.height() - 1; + *abc4 = *(const uint16 *)srcSubRect.getBasePtr(nX, nY); abc++; abc2++; @@ -140,7 +140,7 @@ const Graphics::Surface *WaveFx::draw(const Graphics::Surface &srcSubRect) { } void WaveFx::update() { - _frame = (_frame + 1) % _frame_cnt; + _frame = (_frame + 1) % _frameCount; } } // End of namespace ZVision diff --git a/engines/zvision/graphics/effects/wave.h b/engines/zvision/graphics/effects/wave.h index 0046dfceec..2e813ed5b6 100644 --- a/engines/zvision/graphics/effects/wave.h +++ b/engines/zvision/graphics/effects/wave.h @@ -33,7 +33,7 @@ class ZVision; class WaveFx : public Effect { public: - WaveFx(ZVision *engine, uint32 key, Common::Rect region, bool ported, int16 frames, int16 s_x, int16 s_y, float ampl, float waveln, float spd); + WaveFx(ZVision *engine, uint32 key, Common::Rect region, bool ported, int16 frames, int16 centerX, int16 centerY, float ampl, float waveln, float spd); ~WaveFx(); const Graphics::Surface *draw(const Graphics::Surface &srcSubRect); @@ -42,8 +42,8 @@ public: private: int16 _frame; - int16 _frame_cnt; - int16 _hw, _hh; + int16 _frameCount; + int16 _halfWidth, _halfHeight; Common::Array< Common::Array< int8 > > _ampls; }; } // End of namespace ZVision diff --git a/engines/zvision/graphics/render_manager.cpp b/engines/zvision/graphics/render_manager.cpp index 3e146939e3..05f8dec937 100644 --- a/engines/zvision/graphics/render_manager.cpp +++ b/engines/zvision/graphics/render_manager.cpp @@ -78,6 +78,7 @@ RenderManager::~RenderManager() { void RenderManager::renderBackbufferToScreen() { Graphics::Surface *out = &_outWnd; Graphics::Surface *in = &_wrkWnd; + Common::Rect outWndDirtyRect; if (!_effects.empty()) { bool copied = false; @@ -114,22 +115,20 @@ void RenderManager::renderBackbufferToScreen() { if (!_wrkWndDirtyRect.isEmpty()) { _renderTable.mutateImage(&_outWnd, in); out = &_outWnd; - _outWndDirtyRect = Common::Rect(_wrkWidth, _wrkHeight); + outWndDirtyRect = Common::Rect(_wrkWidth, _wrkHeight); } } else { out = in; - _outWndDirtyRect = _wrkWndDirtyRect; + outWndDirtyRect = _wrkWndDirtyRect; } - if (!_outWndDirtyRect.isEmpty()) { - _system->copyRectToScreen(out->getBasePtr(_outWndDirtyRect.left, _outWndDirtyRect.top), out->pitch, - _outWndDirtyRect.left + _workingWindow.left, - _outWndDirtyRect.top + _workingWindow.top, - _outWndDirtyRect.width(), - _outWndDirtyRect.height()); - - _outWndDirtyRect = Common::Rect(); + if (!outWndDirtyRect.isEmpty()) { + _system->copyRectToScreen(out->getBasePtr(outWndDirtyRect.left, outWndDirtyRect.top), out->pitch, + outWndDirtyRect.left + _workingWindow.left, + outWndDirtyRect.top + _workingWindow.top, + outWndDirtyRect.width(), + outWndDirtyRect.height()); } } @@ -472,7 +471,7 @@ void RenderManager::blitSurfaceToSurface(const Graphics::Surface &src, const Com return; // Copy srcRect from src surface to dst surface - const byte *src_buf = (const byte *)src.getBasePtr(srcRect.left, srcRect.top); + const byte *srcBuffer = (const byte *)src.getBasePtr(srcRect.left, srcRect.top); int xx = _x; int yy = _y; @@ -485,15 +484,15 @@ void RenderManager::blitSurfaceToSurface(const Graphics::Surface &src, const Com if (_x >= dst.w || _y >= dst.h) return; - byte *dst_buf = (byte *)dst.getBasePtr(xx, yy); + byte *dstBuffer = (byte *)dst.getBasePtr(xx, yy); int32 w = srcRect.width(); int32 h = srcRect.height(); for (int32 y = 0; y < h; y++) { - memcpy(dst_buf, src_buf, w * src.format.bytesPerPixel); - src_buf += src.pitch; - dst_buf += dst.pitch; + memcpy(dstBuffer, srcBuffer, w * src.format.bytesPerPixel); + srcBuffer += src.pitch; + dstBuffer += dst.pitch; } } @@ -517,7 +516,7 @@ void RenderManager::blitSurfaceToSurface(const Graphics::Surface &src, const Com uint32 _keycolor = colorkey & ((1 << (src.format.bytesPerPixel << 3)) - 1); // Copy srcRect from src surface to dst surface - const byte *src_buf = (const byte *)src.getBasePtr(srcRect.left, srcRect.top); + const byte *srcBuffer = (const byte *)src.getBasePtr(srcRect.left, srcRect.top); int xx = _x; int yy = _y; @@ -530,7 +529,7 @@ void RenderManager::blitSurfaceToSurface(const Graphics::Surface &src, const Com if (_x >= dst.w || _y >= dst.h) return; - byte *dst_buf = (byte *)dst.getBasePtr(xx, yy); + byte *dstBuffer = (byte *)dst.getBasePtr(xx, yy); int32 w = srcRect.width(); int32 h = srcRect.height(); @@ -538,37 +537,37 @@ void RenderManager::blitSurfaceToSurface(const Graphics::Surface &src, const Com for (int32 y = 0; y < h; y++) { switch (src.format.bytesPerPixel) { case 1: { - const uint *src_tmp = (const uint *)src_buf; - uint *dst_tmp = (uint *)dst_buf; + const uint *srcTemp = (const uint *)srcBuffer; + uint *dstTemp = (uint *)dstBuffer; for (int32 x = 0; x < w; x++) { - if (*src_tmp != _keycolor) - *dst_tmp = *src_tmp; - src_tmp++; - dst_tmp++; + if (*srcTemp != _keycolor) + *dstTemp = *srcTemp; + srcTemp++; + dstTemp++; } } break; case 2: { - const uint16 *src_tmp = (const uint16 *)src_buf; - uint16 *dst_tmp = (uint16 *)dst_buf; + const uint16 *srcTemp = (const uint16 *)srcBuffer; + uint16 *dstTemp = (uint16 *)dstBuffer; for (int32 x = 0; x < w; x++) { - if (*src_tmp != _keycolor) - *dst_tmp = *src_tmp; - src_tmp++; - dst_tmp++; + if (*srcTemp != _keycolor) + *dstTemp = *srcTemp; + srcTemp++; + dstTemp++; } } break; case 4: { - const uint32 *src_tmp = (const uint32 *)src_buf; - uint32 *dst_tmp = (uint32 *)dst_buf; + const uint32 *srcTemp = (const uint32 *)srcBuffer; + uint32 *dstTemp = (uint32 *)dstBuffer; for (int32 x = 0; x < w; x++) { - if (*src_tmp != _keycolor) - *dst_tmp = *src_tmp; - src_tmp++; - dst_tmp++; + if (*srcTemp != _keycolor) + *dstTemp = *srcTemp; + srcTemp++; + dstTemp++; } } break; @@ -576,8 +575,8 @@ void RenderManager::blitSurfaceToSurface(const Graphics::Surface &src, const Com default: break; } - src_buf += src.pitch; - dst_buf += dst.pitch; + srcBuffer += src.pitch; + dstBuffer += dst.pitch; } } @@ -796,7 +795,7 @@ uint16 RenderManager::createSubArea(const Common::Rect &area) { sub.redraw = false; sub.timer = -1; sub.todelete = false; - sub._r = area; + sub.r = area; _subsList[_subid] = sub; @@ -810,8 +809,8 @@ uint16 RenderManager::createSubArea() { sub.redraw = false; sub.timer = -1; sub.todelete = false; - sub._r = Common::Rect(_subWndRect.left, _subWndRect.top, _subWndRect.right, _subWndRect.bottom); - sub._r.translate(-_workingWindow.left, -_workingWindow.top); + sub.r = Common::Rect(_subWndRect.left, _subWndRect.top, _subWndRect.right, _subWndRect.bottom); + sub.r.translate(-_workingWindow.left, -_workingWindow.top); _subsList[_subid] = sub; @@ -831,7 +830,7 @@ void RenderManager::deleteSubArea(uint16 id, int16 delay) { void RenderManager::updateSubArea(uint16 id, const Common::String &txt) { if (_subsList.contains(id)) { oneSub *sub = &_subsList[id]; - sub->_txt = txt; + sub->txt = txt; sub->redraw = true; } } @@ -857,11 +856,11 @@ void RenderManager::processSubs(uint16 deltatime) { for (subMap::iterator it = _subsList.begin(); it != _subsList.end(); it++) { oneSub *sub = &it->_value; - if (sub->_txt.size()) { + if (sub->txt.size()) { Graphics::Surface *rndr = new Graphics::Surface(); - rndr->create(sub->_r.width(), sub->_r.height(), _pixelFormat); - _engine->getTextRenderer()->drawTxtInOneLine(sub->_txt, *rndr); - blitSurfaceToSurface(*rndr, _subWnd, sub->_r.left - _subWndRect.left + _workingWindow.left, sub->_r.top - _subWndRect.top + _workingWindow.top); + rndr->create(sub->r.width(), sub->r.height(), _pixelFormat); + _engine->getTextRenderer()->drawTxtInOneLine(sub->txt, *rndr); + blitSurfaceToSurface(*rndr, _subWnd, sub->r.left - _subWndRect.left + _workingWindow.left, sub->r.top - _subWndRect.top + _workingWindow.top); rndr->free(); delete rndr; } diff --git a/engines/zvision/graphics/render_manager.h b/engines/zvision/graphics/render_manager.h index d34ecf8ce0..7723c3d0f3 100644 --- a/engines/zvision/graphics/render_manager.h +++ b/engines/zvision/graphics/render_manager.h @@ -54,21 +54,13 @@ public: private: struct oneSub { - Common::Rect _r; - Common::String _txt; + Common::Rect r; + Common::String txt; int16 timer; bool todelete; bool redraw; }; -// struct AlphaDataEntry { -// Graphics::Surface *data; -// uint16 alphaColor; -// uint16 destX; -// uint16 destY; -// uint16 width; -// uint16 height; -// }; -// + typedef Common::HashMap<uint16, oneSub> subMap; typedef Common::List<Effect *> effectsList; @@ -82,37 +74,25 @@ private: Common::Rect _wrkWndDirtyRect; + // A buffer for mutate image by tilt or panorama renderers Graphics::Surface _outWnd; - Common::Rect _outWndDirtyRect; - Common::Rect _bkgDirtyRect; + // A buffer for subtitles Graphics::Surface _subWnd; Common::Rect _subWndDirtyRect; + // A buffer for menu drawing Graphics::Surface _menuWnd; Common::Rect _menuWndDirtyRect; + // A buffer used for apply graphics effects Graphics::Surface _effectWnd; - // A buffer the exact same size as the workingWindow - // This buffer stores everything un-warped, then does a warp at the end of the frame - //Graphics::Surface _workingWindowBuffer; - // A buffer representing the entire screen. Any graphical updates are first done with this buffer - // before actually being blitted to the screen - //Graphics::Surface _backBuffer; - // A list of Alpha Entries that need to be blitted to the backbuffer - //AlphaEntryMap _alphaDataEntries; - - // A rectangle representing the portion of the working window where the pixels have been changed since last frame - //Common::Rect _workingWindowDirtyRect; - // A rectangle representing the portion of the backbuffer where the pixels have been changed since last frame - //Common::Rect _backBufferDirtyRect; - /** Width of the working window. Saved to prevent extraneous calls to _workingWindow.width() */ const int _wrkWidth; /** Height of the working window. Saved to prevent extraneous calls to _workingWindow.height() */ @@ -129,13 +109,16 @@ private: */ const Common::Rect _workingWindow; + // Recatangle for subtitles area Common::Rect _subWndRect; + // Recatangle for menu area Common::Rect _menuWndRect; /** Used to warp the background image */ RenderTable _renderTable; + // A buffer for background image Graphics::Surface _curBkg; /** The (x1,y1) coordinates of the subRectangle of the background that is currently displayed on the screen */ int16 _bkgOff; @@ -144,18 +127,13 @@ private: /** The height of the current background image */ uint16 _bkgHeight; + // Internal subtitles counter uint16 _subid; + // Subtitle list subMap _subsList; - /** - * The "velocity" at which the background image is panning. We actually store the inverse of velocity (ms/pixel instead of pixels/ms) - * because it allows you to accumulate whole pixels 'steps' instead of rounding pixels every frame - */ - //int _backgroundInverseVelocity; - /** Holds any 'leftover' milliseconds between frames */ - //uint _accumulatedVelocityMilliseconds; - + // Visual effects list effectsList _effects; public: @@ -178,13 +156,22 @@ public: /** * Blits the image or a portion of the image to the background. * - * @param fileName Name of the image file - * @param destinationX X position where the image should be put. Coords are in working window space, not screen space! - * @param destinationY Y position where the image should be put. Coords are in working window space, not screen space! + * @param fileName Name of the image file + * @param destX X position where the image should be put. Coords are in working window space, not screen space! + * @param destY Y position where the image should be put. Coords are in working window space, not screen space! * @param colorkey Transparent color */ void renderImageToBackground(const Common::String &fileName, int16 destX, int16 destY, uint32 colorkey); + /** + * Blits the image or a portion of the image to the background. + * + * @param fileName Name of the image file + * @param destX X position where the image should be put. Coords are in working window space, not screen space! + * @param destY Y position where the image should be put. Coords are in working window space, not screen space! + * @param keyX X position of transparent color + * @param keyY Y position of transparent color + */ void renderImageToBackground(const Common::String &fileName, int16 destX, int16 destY, int16 keyX, int16 keyY); /** @@ -215,7 +202,10 @@ public: */ const Common::Point screenSpaceToImageSpace(const Common::Point &point); + // Return pointer of RenderTable object RenderTable *getRenderTable(); + + // Return current background offset uint32 getCurrentBackgroundOffset(); /** @@ -229,39 +219,64 @@ public: */ static Graphics::Surface *tranposeSurface(const Graphics::Surface *surface); + // Scale buffer (nearest) void scaleBuffer(const void *src, void *dst, uint32 srcWidth, uint32 srcHeight, byte bytesPerPixel, uint32 dstWidth, uint32 dstHeight); - + // Blitting surface-to-surface methods void blitSurfaceToSurface(const Graphics::Surface &src, const Common::Rect &_srcRect , Graphics::Surface &dst, int x, int y); void blitSurfaceToSurface(const Graphics::Surface &src, const Common::Rect &_srcRect , Graphics::Surface &dst, int _x, int _y, uint32 colorkey); void blitSurfaceToSurface(const Graphics::Surface &src, Graphics::Surface &dst, int x, int y); void blitSurfaceToSurface(const Graphics::Surface &src, Graphics::Surface &dst, int x, int y, uint32 colorkey); + + // Blitting surface-to-background methods void blitSurfaceToBkg(const Graphics::Surface &src, int x, int y); void blitSurfaceToBkg(const Graphics::Surface &src, int x, int y, uint32 colorkey); + + // Blitting surface-to-background methods with scale void blitSurfaceToBkgScaled(const Graphics::Surface &src, const Common::Rect &_dstRect); void blitSurfaceToBkgScaled(const Graphics::Surface &src, const Common::Rect &_dstRect, uint32 colorkey); + + // Blitting surface-to-menu methods void blitSurfaceToMenu(const Graphics::Surface &src, int x, int y); void blitSurfaceToMenu(const Graphics::Surface &src, int x, int y, uint32 colorkey); + // Subtitles methods + + // Create subtitle area and return ID uint16 createSubArea(const Common::Rect &area); uint16 createSubArea(); + + // Delete subtitle by ID void deleteSubArea(uint16 id); void deleteSubArea(uint16 id, int16 delay); + + // Update subtitle area void updateSubArea(uint16 id, const Common::String &txt); + + // Processing subtitles void processSubs(uint16 deltatime); + + // Return background size Common::Point getBkgSize(); + // Return portion of background as new surface Graphics::Surface *getBkgRect(Common::Rect &rect); + + // Load image into new surface Graphics::Surface *loadImage(const char *file); Graphics::Surface *loadImage(Common::String &file); Graphics::Surface *loadImage(const char *file, bool transposed); Graphics::Surface *loadImage(Common::String &file, bool transposed); + // Clear whole/area of menu surface void clearMenuSurface(); void clearMenuSurface(const Common::Rect &r); + + // Copy menu buffer to screen void renderMenuToScreen(); + // Copy needed portion of background surface to workingWindow surface void prepareBkg(); /** @@ -275,17 +290,44 @@ public: * @param destination A reference to the Surface to store the pixel data in */ void readImageToSurface(const Common::String &fileName, Graphics::Surface &destination); + + /** + * Reads an image file pixel data into a Surface buffer. In the process + * it converts the pixel data from RGB 555 to RGB 565. Also, if the image + * is transposed, it will un-transpose the pixel data. The function will + * call destination::create() if the dimensions of destination do not match + * up with the dimensions of the image. + * + * @param fileName The name of a .tga file + * @param destination A reference to the Surface to store the pixel data in + * @param transposed Transpose flag + */ void readImageToSurface(const Common::String &fileName, Graphics::Surface &destination, bool transposed); + // Add visual effect to effects list void addEffect(Effect *_effect); + + // Delete effect(s) by ID (ID equal to slot of action:region that create this effect) void deleteEffect(uint32 ID); + + // Create "mask" for effects - (color +/- depth) will be selected as not transparent. Like color selection + // xy - base color + // depth - +/- of base color + // rect - rectangle where select pixels + // minD - if not NULL will recieve real bottom border of depth + // maxD - if not NULL will recieve real top border of depth EffectMap *makeEffectMap(const Common::Point &xy, int16 depth, const Common::Rect &rect, int8 *minD, int8 *maxD); + + // Create "mask" for effects by simple transparent color EffectMap *makeEffectMap(const Graphics::Surface &surf, uint16 transp); + // Return background rectangle in screen coordinates Common::Rect bkgRectToScreen(const Common::Rect &src); + // Mark whole background surface as dirty void markDirty(); + // Fille background surface by color void bkgFill(uint8 r, uint8 g, uint8 b); }; diff --git a/engines/zvision/module.mk b/engines/zvision/module.mk index 199f96bf47..f7927650d9 100644 --- a/engines/zvision/module.mk +++ b/engines/zvision/module.mk @@ -1,5 +1,5 @@ MODULE := engines/zvision - + MODULE_OBJS := \ animation/meta_animation.o \ animation/rlf_animation.o \ @@ -53,15 +53,15 @@ MODULE_OBJS := \ utility/win_keys.o \ video/video.o \ video/zork_avi_decoder.o \ - zvision.o - + zvision.o + MODULE_DIRS += \ engines/zvision - + # This module can be built as a plugin ifeq ($(ENABLE_ZVISION), DYNAMIC_PLUGIN) PLUGIN := 1 endif - -# Include common rules + +# Include common rules include $(srcdir)/rules.mk diff --git a/engines/zvision/scripting/actions.cpp b/engines/zvision/scripting/actions.cpp index 31f68d7953..8ff6bd0496 100644 --- a/engines/zvision/scripting/actions.cpp +++ b/engines/zvision/scripting/actions.cpp @@ -275,7 +275,7 @@ bool ActionDissolve::execute() { ActionDistort::ActionDistort(ZVision *engine, int32 slotkey, const Common::String &line) : ResultAction(engine, slotkey) { - sscanf(line.c_str(), "%hd %hd %f %f %f %f", &_distSlot, &_speed, &_st_angl, &_en_angl, &_st_lin, &_en_lin); + sscanf(line.c_str(), "%hd %hd %f %f %f %f", &_distSlot, &_speed, &_startAngle, &_endAngle, &_startLineScale, &_endLineScale); } ActionDistort::~ActionDistort() { @@ -286,7 +286,7 @@ bool ActionDistort::execute() { if (_engine->getScriptManager()->getSideFX(_distSlot)) return true; - _engine->getScriptManager()->addSideFX(new DistortNode(_engine, _distSlot, _speed, _st_angl, _en_angl, _st_lin, _en_lin)); + _engine->getScriptManager()->addSideFX(new DistortNode(_engine, _distSlot, _speed, _startAngle, _endAngle, _startLineScale, _endLineScale)); return true; } @@ -345,22 +345,22 @@ ActionInventory::ActionInventory(ZVision *engine, int32 slotkey, const Common::S bool ActionInventory::execute() { switch (_type) { case 0: // add - _engine->getScriptManager()->invertory_add(_key); + _engine->getScriptManager()->inventoryAdd(_key); break; case 1: // addi - _engine->getScriptManager()->invertory_add(_engine->getScriptManager()->getStateValue(_key)); + _engine->getScriptManager()->inventoryAdd(_engine->getScriptManager()->getStateValue(_key)); break; case 2: // drop if (_key >= 0) - _engine->getScriptManager()->invertory_drop(_key); + _engine->getScriptManager()->inventoryDrop(_key); else - _engine->getScriptManager()->invertory_drop(_engine->getScriptManager()->getStateValue(StateKey_InventoryItem)); + _engine->getScriptManager()->inventoryDrop(_engine->getScriptManager()->getStateValue(StateKey_InventoryItem)); break; case 3: // dropi - _engine->getScriptManager()->invertory_drop(_engine->getScriptManager()->getStateValue(_key)); + _engine->getScriptManager()->inventoryDrop(_engine->getScriptManager()->getStateValue(_key)); break; case 4: // cycle - _engine->getScriptManager()->invertory_cycle(); + _engine->getScriptManager()->inventoryCycle(); break; default: break; @@ -463,20 +463,20 @@ ActionMusic::ActionMusic(ZVision *engine, int32 slotkey, const Common::String &l ActionMusic::~ActionMusic() { if (!_universe) - _engine->getScriptManager()->killSideFx(_slotkey); + _engine->getScriptManager()->killSideFx(_slotKey); } bool ActionMusic::execute() { - if (_engine->getScriptManager()->getSideFX(_slotkey)) + if (_engine->getScriptManager()->getSideFX(_slotKey)) return true; if (_midi) { - _engine->getScriptManager()->addSideFX(new MusicMidiNode(_engine, _slotkey, _prog, _note, _volume)); + _engine->getScriptManager()->addSideFX(new MusicMidiNode(_engine, _slotKey, _prog, _note, _volume)); } else { if (!_engine->getSearchManager()->hasFile(_fileName)) return true; - _engine->getScriptManager()->addSideFX(new MusicNode(_engine, _slotkey, _fileName, _loop, _volume)); + _engine->getScriptManager()->addSideFX(new MusicNode(_engine, _slotKey, _fileName, _loop, _volume)); } return true; @@ -489,20 +489,20 @@ bool ActionMusic::execute() { ActionPanTrack::ActionPanTrack(ZVision *engine, int32 slotkey, const Common::String &line) : ResultAction(engine, slotkey), _pos(0), - _mus_slot(0) { + _musicSlot(0) { - sscanf(line.c_str(), "%u %d", &_mus_slot, &_pos); + sscanf(line.c_str(), "%u %d", &_musicSlot, &_pos); } ActionPanTrack::~ActionPanTrack() { - _engine->getScriptManager()->killSideFx(_slotkey); + _engine->getScriptManager()->killSideFx(_slotKey); } bool ActionPanTrack::execute() { - if (_engine->getScriptManager()->getSideFX(_slotkey)) + if (_engine->getScriptManager()->getSideFX(_slotKey)) return true; - _engine->getScriptManager()->addSideFX(new PanTrackNode(_engine, _slotkey, _mus_slot, _pos)); + _engine->getScriptManager()->addSideFX(new PanTrackNode(_engine, _slotKey, _musicSlot, _pos)); return true; } @@ -549,18 +549,18 @@ ActionPreloadAnimation::ActionPreloadAnimation(ZVision *engine, int32 slotkey, c } ActionPreloadAnimation::~ActionPreloadAnimation() { - _engine->getScriptManager()->deleteSideFx(_slotkey); + _engine->getScriptManager()->deleteSideFx(_slotKey); } bool ActionPreloadAnimation::execute() { - AnimationNode *nod = (AnimationNode *)_engine->getScriptManager()->getSideFX(_slotkey); + AnimationNode *nod = (AnimationNode *)_engine->getScriptManager()->getSideFX(_slotKey); if (!nod) { - nod = new AnimationNode(_engine, _slotkey, _fileName, _mask, _framerate, false); + nod = new AnimationNode(_engine, _slotKey, _fileName, _mask, _framerate, false); _engine->getScriptManager()->addSideFX(nod); } else nod->stop(); - _engine->getScriptManager()->setStateValue(_slotkey, 2); + _engine->getScriptManager()->setStateValue(_slotKey, 2); return true; } @@ -607,20 +607,20 @@ ActionPlayAnimation::ActionPlayAnimation(ZVision *engine, int32 slotkey, const C } ActionPlayAnimation::~ActionPlayAnimation() { - _engine->getScriptManager()->deleteSideFx(_slotkey); + _engine->getScriptManager()->deleteSideFx(_slotKey); } bool ActionPlayAnimation::execute() { - AnimationNode *nod = (AnimationNode *)_engine->getScriptManager()->getSideFX(_slotkey); + AnimationNode *nod = (AnimationNode *)_engine->getScriptManager()->getSideFX(_slotKey); if (!nod) { - nod = new AnimationNode(_engine, _slotkey, _fileName, _mask, _framerate); + nod = new AnimationNode(_engine, _slotKey, _fileName, _mask, _framerate); _engine->getScriptManager()->addSideFX(nod); } else nod->stop(); if (nod) - nod->addPlayNode(_slotkey, _x, _y, _x2, _y2, _start, _end, _loopCount); + nod->addPlayNode(_slotKey, _x, _y, _x2, _y2, _start, _end, _loopCount); return true; } @@ -641,7 +641,7 @@ bool ActionPlayPreloadAnimation::execute() { AnimationNode *nod = (AnimationNode *)_engine->getScriptManager()->getSideFX(_controlKey); if (nod) - nod->addPlayNode(_slotkey, _x1, _y1, _x2, _y2, _startFrame, _endFrame, _loopCount); + nod->addPlayNode(_slotKey, _x1, _y1, _x2, _y2, _startFrame, _endFrame, _loopCount); return true; } @@ -676,20 +676,20 @@ ActionRegion::ActionRegion(ZVision *engine, int32 slotkey, const Common::String } ActionRegion::~ActionRegion() { - _engine->getScriptManager()->killSideFx(_slotkey); + _engine->getScriptManager()->killSideFx(_slotKey); } bool ActionRegion::execute() { - if (_engine->getScriptManager()->getSideFX(_slotkey)) + if (_engine->getScriptManager()->getSideFX(_slotKey)) return true; Effect *effct = NULL; switch (_type) { case 0: { - uint16 s_x, s_y, frames; + uint16 centerX, centerY, frames; double amplitude, waveln, speed; - sscanf(_custom.c_str(), "%hu,%hu,%hu,%lf,%lf,%lf,", &s_x, &s_y, &frames, &litude, &waveln, &speed); - effct = new WaveFx(_engine, _slotkey, _rect, _unk1, frames, s_x, s_y, amplitude, waveln, speed); + sscanf(_custom.c_str(), "%hu,%hu,%hu,%lf,%lf,%lf,", ¢erX, ¢erY, &frames, &litude, &waveln, &speed); + effct = new WaveFx(_engine, _slotKey, _rect, _unk1, frames, centerX, centerY, amplitude, waveln, speed); } break; case 1: { @@ -701,7 +701,7 @@ bool ActionRegion::execute() { int8 minD; int8 maxD; EffectMap *_map = _engine->getRenderManager()->makeEffectMap(Common::Point(aX, aY), aD, _rect, &minD, &maxD); - effct = new LightFx(_engine, _slotkey, _rect, _unk1, _map, atoi(_custom.c_str()), minD, maxD); + effct = new LightFx(_engine, _slotKey, _rect, _unk1, _map, atoi(_custom.c_str()), minD, maxD); } break; case 9: { @@ -717,7 +717,7 @@ bool ActionRegion::execute() { _rect.setHeight(tempMask.h); EffectMap *_map = _engine->getRenderManager()->makeEffectMap(tempMask, 0); - effct = new FogFx(_engine, _slotkey, _rect, _unk1, _map, Common::String(buf)); + effct = new FogFx(_engine, _slotKey, _rect, _unk1, _map, Common::String(buf)); } break; default: @@ -725,7 +725,7 @@ bool ActionRegion::execute() { } if (effct) { - _engine->getScriptManager()->addSideFX(new RegionNode(_engine, _slotkey, effct, _delay)); + _engine->getScriptManager()->addSideFX(new RegionNode(_engine, _slotKey, effct, _delay)); _engine->getRenderManager()->addEffect(effct); } @@ -738,10 +738,10 @@ bool ActionRegion::execute() { ActionRandom::ActionRandom(ZVision *engine, int32 slotkey, const Common::String &line) : ResultAction(engine, slotkey) { - char max_buf[64]; - memset(max_buf, 0, 64); - sscanf(line.c_str(), "%s", max_buf); - _max = new ValueSlot(_engine->getScriptManager(), max_buf); + char maxBuffer[64]; + memset(maxBuffer, 0, 64); + sscanf(line.c_str(), "%s", maxBuffer); + _max = new ValueSlot(_engine->getScriptManager(), maxBuffer); } ActionRandom::~ActionRandom() { @@ -751,7 +751,7 @@ ActionRandom::~ActionRandom() { bool ActionRandom::execute() { uint randNumber = _engine->getRandomSource()->getRandomNumber(_max->getValue()); - _engine->getScriptManager()->setStateValue(_slotkey, randNumber); + _engine->getScriptManager()->setStateValue(_slotKey, randNumber); return true; } @@ -941,9 +941,9 @@ bool ActionStreamVideo::execute() { ActionSyncSound::ActionSyncSound(ZVision *engine, int32 slotkey, const Common::String &line) : ResultAction(engine, slotkey) { char fileName[25]; - int not_used; + int notUsed; - sscanf(line.c_str(), "%d %d %25s", &_syncto, ¬_used, fileName); + sscanf(line.c_str(), "%d %d %25s", &_syncto, ¬Used, fileName); _fileName = Common::String(fileName); } @@ -960,7 +960,7 @@ bool ActionSyncSound::execute() { if (animnode->getFrameDelay() > 200) // Hack for fix incorrect framedelay in some animpreload animnode->setNewFrameDelay(66); // ~15fps - _engine->getScriptManager()->addSideFX(new SyncSoundNode(_engine, _slotkey, _fileName, _syncto)); + _engine->getScriptManager()->addSideFX(new SyncSoundNode(_engine, _slotKey, _fileName, _syncto)); return true; } @@ -970,22 +970,22 @@ bool ActionSyncSound::execute() { ActionTimer::ActionTimer(ZVision *engine, int32 slotkey, const Common::String &line) : ResultAction(engine, slotkey) { - char time_buf[64]; - memset(time_buf, 0, 64); - sscanf(line.c_str(), "%s", time_buf); - _time = new ValueSlot(_engine->getScriptManager(), time_buf); + char timeBuffer[64]; + memset(timeBuffer, 0, 64); + sscanf(line.c_str(), "%s", timeBuffer); + _time = new ValueSlot(_engine->getScriptManager(), timeBuffer); } ActionTimer::~ActionTimer() { if (_time) delete _time; - _engine->getScriptManager()->killSideFx(_slotkey); + _engine->getScriptManager()->killSideFx(_slotKey); } bool ActionTimer::execute() { - if (_engine->getScriptManager()->getSideFX(_slotkey)) + if (_engine->getScriptManager()->getSideFX(_slotKey)) return true; - _engine->getScriptManager()->addSideFX(new TimerNode(_engine, _slotkey, _time->getValue())); + _engine->getScriptManager()->addSideFX(new TimerNode(_engine, _slotKey, _time->getValue())); return true; } @@ -1003,13 +1003,13 @@ ActionTtyText::ActionTtyText(ZVision *engine, int32 slotkey, const Common::Strin } ActionTtyText::~ActionTtyText() { - _engine->getScriptManager()->killSideFx(_slotkey); + _engine->getScriptManager()->killSideFx(_slotKey); } bool ActionTtyText::execute() { - if (_engine->getScriptManager()->getSideFX(_slotkey)) + if (_engine->getScriptManager()->getSideFX(_slotKey)) return true; - _engine->getScriptManager()->addSideFX(new ttyTextNode(_engine, _slotkey, _filename, _r, _delay)); + _engine->getScriptManager()->addSideFX(new ttyTextNode(_engine, _slotKey, _filename, _r, _delay)); return true; } diff --git a/engines/zvision/scripting/actions.h b/engines/zvision/scripting/actions.h index 5401af0876..03a249e580 100644 --- a/engines/zvision/scripting/actions.h +++ b/engines/zvision/scripting/actions.h @@ -41,7 +41,7 @@ class ValueSlot; */ class ResultAction { public: - ResultAction(ZVision *engine, int32 slotkey) : _engine(engine), _slotkey(slotkey) {} + ResultAction(ZVision *engine, int32 slotkey) : _engine(engine), _slotKey(slotkey) {} virtual ~ResultAction() {} /** * This is called by the script system whenever a Puzzle's criteria are found to be true. @@ -54,40 +54,8 @@ public: virtual bool execute() = 0; protected: ZVision *_engine; - int32 _slotkey; -}; - - -// The different types of actions -// DEBUG, -// DISABLE_CONTROL, -// DISABLE_VENUS, -// DISPLAY_MESSAGE, -// DISSOLVE, -// DISTORT, -// ENABLE_CONTROL, -// FLUSH_MOUSE_EVENTS, -// INVENTORY, -// KILL, -// MENU_BAR_ENABLE, -// MUSIC, -// PAN_TRACK, -// PLAY_PRELOAD, -// PREFERENCES, -// QUIT, -// RANDOM, -// REGION, -// RESTORE_GAME, -// ROTATE_TO, -// SAVE_GAME, -// SET_PARTIAL_SCREEN, -// SET_SCREEN, -// SET_VENUS, -// STOP, -// STREAM_VIDEO, -// SYNC_SOUND, -// TTY_TEXT, -// UNIVERSE_MUSIC, + int32 _slotKey; +}; class ActionAdd : public ResultAction { public: @@ -217,10 +185,10 @@ public: private: int16 _distSlot; int16 _speed; - float _st_angl; - float _en_angl; - float _st_lin; - float _en_lin; + float _startAngle; + float _endAngle; + float _startLineScale; + float _endLineScale; }; class ActionEnableControl : public ResultAction { @@ -290,7 +258,7 @@ public: private: int32 _pos; - uint32 _mus_slot; + uint32 _musicSlot; }; class ActionPlayAnimation : public ResultAction { diff --git a/engines/zvision/scripting/control.cpp b/engines/zvision/scripting/control.cpp index 9c8156961c..e69d57f75c 100644 --- a/engines/zvision/scripting/control.cpp +++ b/engines/zvision/scripting/control.cpp @@ -106,24 +106,24 @@ void Control::parseTiltControl(ZVision *engine, Common::SeekableReadStream &stre renderTable->generateRenderTable(); } -void Control::getParams(const Common::String &input_str, Common::String ¶meter, Common::String &values) { - const char *chrs = input_str.c_str(); +void Control::getParams(const Common::String &inputStr, Common::String ¶meter, Common::String &values) { + const char *chrs = inputStr.c_str(); uint lbr; - for (lbr = 0; lbr < input_str.size(); lbr++) + for (lbr = 0; lbr < inputStr.size(); lbr++) if (chrs[lbr] == '(') break; - if (lbr >= input_str.size()) + if (lbr >= inputStr.size()) return; uint rbr; - for (rbr = lbr + 1; rbr < input_str.size(); rbr++) + for (rbr = lbr + 1; rbr < inputStr.size(); rbr++) if (chrs[rbr] == ')') break; - if (rbr >= input_str.size()) + if (rbr >= inputStr.size()) return; parameter = Common::String(chrs, chrs + lbr); @@ -131,9 +131,9 @@ void Control::getParams(const Common::String &input_str, Common::String ¶met } void Control::setVenus() { - if (_venus_id >= 0) - if (_engine->getScriptManager()->getStateValue(_venus_id) > 0) - _engine->getScriptManager()->setStateValue(StateKey_Venus, _venus_id); + if (_venusId >= 0) + if (_engine->getScriptManager()->getStateValue(_venusId) > 0) + _engine->getScriptManager()->setStateValue(StateKey_Venus, _venusId); } } // End of namespace ZVision diff --git a/engines/zvision/scripting/control.h b/engines/zvision/scripting/control.h index b784a66913..5814c9e419 100644 --- a/engines/zvision/scripting/control.h +++ b/engines/zvision/scripting/control.h @@ -54,7 +54,7 @@ public: CONTROL_PAINT }; - Control(ZVision *engine, uint32 key, ControlType type) : _engine(engine), _key(key), _type(type), _venus_id(-1) {} + Control(ZVision *engine, uint32 key, ControlType type) : _engine(engine), _key(key), _type(type), _venusId(-1) {} virtual ~Control() {} uint32 getKey() { @@ -120,14 +120,15 @@ public: virtual bool process(uint32 deltaTimeInMillis) { return false; } + void setVenus(); protected: ZVision *_engine; uint32 _key; - int32 _venus_id; + int32 _venusId; - void getParams(const Common::String &input_str, Common::String ¶meter, Common::String &values); + void getParams(const Common::String &inputStr, Common::String ¶meter, Common::String &values); // Static member functions public: static void parseFlatControl(ZVision *engine); @@ -137,15 +138,6 @@ private: ControlType _type; }; -// TODO: Implement InputControl -// TODO: Implement SaveControl -// TODO: Implement SlotControl -// TODO: Implement SafeControl -// TODO: Implement FistControl -// TODO: Implement HotMovieControl -// TODO: Implement PaintControl -// TODO: Implement TilterControl - } // End of namespace ZVision #endif diff --git a/engines/zvision/scripting/controls/fist_control.cpp b/engines/zvision/scripting/controls/fist_control.cpp index 185bea09d2..9bb03cba51 100644 --- a/engines/zvision/scripting/controls/fist_control.cpp +++ b/engines/zvision/scripting/controls/fist_control.cpp @@ -80,7 +80,7 @@ FistControl::FistControl(ZVision *engine, uint32 key, Common::SeekableReadStream } else if (param.matchString("animation_id", true)) { _animationId = atoi(values.c_str()); } else if (param.matchString("venus_id", true)) { - _venus_id = atoi(values.c_str()); + _venusId = atoi(values.c_str()); } line = stream.readLine(); @@ -152,13 +152,13 @@ bool FistControl::onMouseUp(const Common::Point &screenSpacePos, const Common::P if (_engine->getScriptManager()->getStateFlag(_key) & Puzzle::DISABLED) return false; - int n_fist = mouseIn(screenSpacePos, backgroundImageSpacePos); + int fistNumber = mouseIn(screenSpacePos, backgroundImageSpacePos); - if (n_fist >= 0) { + if (fistNumber >= 0) { setVenus(); uint32 oldStatus = _fiststatus; - _fiststatus ^= (1 << n_fist); + _fiststatus ^= (1 << fistNumber); for (int i = 0; i < _numEntries; i++) if (_entries[i]._bitsStrt == oldStatus && _entries[i]._bitsEnd == _fiststatus) { @@ -233,12 +233,12 @@ void FistControl::readDescFile(const Common::String &fileName) { (_fistsDwn[fist])[box] = Common::Rect(x1, y1, x2, y2); } else { int entry, start, end, sound; - char bits_start[33]; - char bits_end[33]; + char bitsStart[33]; + char bitsEnd[33]; entry = atoi(param.c_str()); - if (sscanf(values.c_str(), "%s %s %d %d (%d)", bits_start, bits_end, &start, &end, &sound) == 5) { - _entries[entry]._bitsStrt = readBits(bits_start); - _entries[entry]._bitsEnd = readBits(bits_end); + if (sscanf(values.c_str(), "%s %s %d %d (%d)", bitsStart, bitsEnd, &start, &end, &sound) == 5) { + _entries[entry]._bitsStrt = readBits(bitsStart); + _entries[entry]._bitsEnd = readBits(bitsEnd); _entries[entry]._anmStrt = start; _entries[entry]._anmEnd = end; _entries[entry]._sound = sound; @@ -293,24 +293,24 @@ int FistControl::mouseIn(const Common::Point &screenSpacePos, const Common::Poin return -1; } -void FistControl::getFistParams(const Common::String &input_str, Common::String ¶meter, Common::String &values) { - const char *chrs = input_str.c_str(); +void FistControl::getFistParams(const Common::String &inputStr, Common::String ¶meter, Common::String &values) { + const char *chrs = inputStr.c_str(); uint lbr; - for (lbr = 0; lbr < input_str.size(); lbr++) + for (lbr = 0; lbr < inputStr.size(); lbr++) if (chrs[lbr] == ':') break; - if (lbr >= input_str.size()) + if (lbr >= inputStr.size()) return; uint rbr; - for (rbr = lbr + 1; rbr < input_str.size(); rbr++) + for (rbr = lbr + 1; rbr < inputStr.size(); rbr++) if (chrs[rbr] == '~') break; - if (rbr >= input_str.size()) + if (rbr >= inputStr.size()) return; parameter = Common::String(chrs, chrs + lbr); diff --git a/engines/zvision/scripting/controls/fist_control.h b/engines/zvision/scripting/controls/fist_control.h index 8b229f964a..33c3c7b579 100644 --- a/engines/zvision/scripting/controls/fist_control.h +++ b/engines/zvision/scripting/controls/fist_control.h @@ -79,7 +79,7 @@ private: void clearFistArray(Common::Array< Common::Array<Common::Rect> > &arr); uint32 readBits(const char *str); int mouseIn(const Common::Point &screenSpacePos, const Common::Point &backgroundImageSpacePos); - void getFistParams(const Common::String &input_str, Common::String ¶meter, Common::String &values); + void getFistParams(const Common::String &inputStr, Common::String ¶meter, Common::String &values); }; } // End of namespace ZVision diff --git a/engines/zvision/scripting/controls/hotmov_control.cpp b/engines/zvision/scripting/controls/hotmov_control.cpp index 6969ee1bfe..fd7afb92d1 100644 --- a/engines/zvision/scripting/controls/hotmov_control.cpp +++ b/engines/zvision/scripting/controls/hotmov_control.cpp @@ -44,12 +44,12 @@ HotMovControl::HotMovControl(ZVision *engine, uint32 key, Common::SeekableReadSt : Control(engine, key, CONTROL_HOTMOV) { _animation = NULL; _cycle = 0; - _cur_frame = -1; + _curFrame = -1; _lastRenderedFrame = -1; _frames.clear(); - _frame_time = 0; - _num_cycles = 0; - _num_frames = 0; + _frameTime = 0; + _cyclesCount = 0; + _framesCount = 0; _engine->getScriptManager()->setStateValue(_key, 0); @@ -73,16 +73,16 @@ HotMovControl::HotMovControl(ZVision *engine, uint32 key, Common::SeekableReadSt _rectangle = Common::Rect(x, y, width, height); } else if (param.matchString("num_frames", true)) { - _num_frames = atoi(values.c_str()); + _framesCount = atoi(values.c_str()); } else if (param.matchString("num_cycles", true)) { - _num_cycles = atoi(values.c_str()); + _cyclesCount = atoi(values.c_str()); } else if (param.matchString("animation", true)) { char filename[64]; sscanf(values.c_str(), "%s", filename); values = Common::String(filename); _animation = new MetaAnimation(values, _engine); } else if (param.matchString("venus_id", true)) { - _venus_id = atoi(values.c_str()); + _venusId = atoi(values.c_str()); } line = stream.readLine(); @@ -117,21 +117,21 @@ bool HotMovControl::process(uint32 deltaTimeInMillis) { if (_engine->getScriptManager()->getStateFlag(_key) & Puzzle::DISABLED) return false; - if (_cycle < _num_cycles) { - _frame_time -= deltaTimeInMillis; + if (_cycle < _cyclesCount) { + _frameTime -= deltaTimeInMillis; - if (_frame_time <= 0) { - _cur_frame++; - if (_cur_frame >= _num_frames) { - _cur_frame = 0; + if (_frameTime <= 0) { + _curFrame++; + if (_curFrame >= _framesCount) { + _curFrame = 0; _cycle++; } - if (_cycle != _num_cycles) - renderFrame(_cur_frame); + if (_cycle != _cyclesCount) + renderFrame(_curFrame); else _engine->getScriptManager()->setStateValue(_key, 2); - _frame_time = _animation->frameTime(); + _frameTime = _animation->frameTime(); } } @@ -142,8 +142,8 @@ bool HotMovControl::onMouseMove(const Common::Point &screenSpacePos, const Commo if (_engine->getScriptManager()->getStateFlag(_key) & Puzzle::DISABLED) return false; - if (_cycle < _num_cycles) { - if (_frames[_cur_frame].contains(backgroundImageSpacePos)) { + if (_cycle < _cyclesCount) { + if (_frames[_curFrame].contains(backgroundImageSpacePos)) { _engine->getCursorManager()->changeCursor(CursorIndex_Active); return true; } @@ -156,8 +156,8 @@ bool HotMovControl::onMouseUp(const Common::Point &screenSpacePos, const Common: if (_engine->getScriptManager()->getStateFlag(_key) & Puzzle::DISABLED) return false; - if (_cycle < _num_cycles) { - if (_frames[_cur_frame].contains(backgroundImageSpacePos)) { + if (_cycle < _cyclesCount) { + if (_frames[_curFrame].contains(backgroundImageSpacePos)) { setVenus(); _engine->getScriptManager()->setStateValue(_key, 1); return true; @@ -168,7 +168,7 @@ bool HotMovControl::onMouseUp(const Common::Point &screenSpacePos, const Common: } void HotMovControl::readHsFile(const Common::String &fileName) { - if (_num_frames == 0) + if (_framesCount == 0) return; Common::File file; @@ -179,7 +179,7 @@ void HotMovControl::readHsFile(const Common::String &fileName) { Common::String line; - _frames.resize(_num_frames); + _frames.resize(_framesCount); while (!file.eos()) { line = file.readLine(); @@ -192,7 +192,7 @@ void HotMovControl::readHsFile(const Common::String &fileName) { sscanf(line.c_str(), "%d:%d %d %d %d~", &frame, &x, &y, &width, &height); - if (frame >= 0 && frame < _num_frames) + if (frame >= 0 && frame < _framesCount) _frames[frame] = Common::Rect(x, y, width, height); } file.close(); diff --git a/engines/zvision/scripting/controls/hotmov_control.h b/engines/zvision/scripting/controls/hotmov_control.h index ea12bab82b..9e01b40bab 100644 --- a/engines/zvision/scripting/controls/hotmov_control.h +++ b/engines/zvision/scripting/controls/hotmov_control.h @@ -39,12 +39,12 @@ public: ~HotMovControl(); private: - int32 _num_frames; - int32 _frame_time; - int32 _cur_frame; + int32 _framesCount; + int32 _frameTime; + int32 _curFrame; int32 _lastRenderedFrame; int32 _cycle; - int32 _num_cycles; + int32 _cyclesCount; MetaAnimation *_animation; Common::Rect _rectangle; Common::Array<Common::Rect> _frames; diff --git a/engines/zvision/scripting/controls/input_control.cpp b/engines/zvision/scripting/controls/input_control.cpp index 442c6cbc6a..8af436bb40 100644 --- a/engines/zvision/scripting/controls/input_control.cpp +++ b/engines/zvision/scripting/controls/input_control.cpp @@ -79,13 +79,13 @@ InputControl::InputControl(ZVision *engine, uint32 key, Common::SeekableReadStre sscanf(values.c_str(), "%u", &fontFormatNumber); - _string_init.readAllStyle(_engine->getStringManager()->getTextLine(fontFormatNumber)); + _stringInit.readAllStyle(_engine->getStringManager()->getTextLine(fontFormatNumber)); } else if (param.matchString("chooser_init_string", true)) { uint fontFormatNumber; sscanf(values.c_str(), "%u", &fontFormatNumber); - _string_chooser_init.readAllStyle(_engine->getStringManager()->getTextLine(fontFormatNumber)); + _stringChooserInit.readAllStyle(_engine->getStringManager()->getTextLine(fontFormatNumber)); } else if (param.matchString("next_tabstop", true)) { sscanf(values.c_str(), "%u", &_nextTabstop); } else if (param.matchString("cursor_dimensions", true)) { @@ -104,7 +104,7 @@ InputControl::InputControl(ZVision *engine, uint32 key, Common::SeekableReadStre _focused = true; _engine->getScriptManager()->setFocusControlKey(_key); } else if (param.matchString("venus_id", true)) { - _venus_id = atoi(values.c_str()); + _venusId = atoi(values.c_str()); } line = stream.readLine(); @@ -201,9 +201,9 @@ bool InputControl::process(uint32 deltaTimeInMillis) { txt.create(_textRectangle.width(), _textRectangle.height(), _engine->_pixelFormat); if (!_readOnly || !_focused) - _txtWidth = _engine->getTextRenderer()->drawTxt(_currentInputText, _string_init, txt); + _txtWidth = _engine->getTextRenderer()->drawTxt(_currentInputText, _stringInit, txt); else - _txtWidth = _engine->getTextRenderer()->drawTxt(_currentInputText, _string_chooser_init, txt); + _txtWidth = _engine->getTextRenderer()->drawTxt(_currentInputText, _stringChooserInit, txt); _engine->getRenderManager()->blitSurfaceToBkg(txt, _textRectangle.left, _textRectangle.top); @@ -211,15 +211,15 @@ bool InputControl::process(uint32 deltaTimeInMillis) { } if (_animation && !_readOnly && _focused) { - bool need_draw = true;// = _textChanged; + bool needDraw = true;// = _textChanged; _frameDelay -= deltaTimeInMillis; if (_frameDelay <= 0) { _frame = (_frame + 1) % _animation->frameCount(); _frameDelay = _animation->frameTime(); - need_draw = true; + needDraw = true; } - if (need_draw) { + if (needDraw) { const Graphics::Surface *srf = _animation->getFrameData(_frame); uint32 xx = _textRectangle.left + _txtWidth; if (xx >= _textRectangle.left + (_textRectangle.width() - _animation->width())) diff --git a/engines/zvision/scripting/controls/input_control.h b/engines/zvision/scripting/controls/input_control.h index 5e2190f369..9a829d30f6 100644 --- a/engines/zvision/scripting/controls/input_control.h +++ b/engines/zvision/scripting/controls/input_control.h @@ -40,8 +40,8 @@ public: private: Common::Rect _textRectangle; Common::Rect _headerRectangle; - cTxtStyle _string_init; - cTxtStyle _string_chooser_init; + cTxtStyle _stringInit; + cTxtStyle _stringChooserInit; uint32 _nextTabstop; bool _focused; diff --git a/engines/zvision/scripting/controls/lever_control.cpp b/engines/zvision/scripting/controls/lever_control.cpp index a9836b388e..1f176ef9d0 100644 --- a/engines/zvision/scripting/controls/lever_control.cpp +++ b/engines/zvision/scripting/controls/lever_control.cpp @@ -142,7 +142,7 @@ void LeverControl::parseLevFile(const Common::String &fileName) { _hotspotDelta.x = x; _hotspotDelta.y = y; } else if (param.matchString("venus_id", true)) { - _venus_id = atoi(values.c_str()); + _venusId = atoi(values.c_str()); } else { uint frameNumber; uint x, y; @@ -381,24 +381,24 @@ void LeverControl::renderFrame(uint frameNumber) { _engine->getRenderManager()->blitSurfaceToBkgScaled(*frameData, _animationCoords); } -void LeverControl::getLevParams(const Common::String &input_str, Common::String ¶meter, Common::String &values) { - const char *chrs = input_str.c_str(); +void LeverControl::getLevParams(const Common::String &inputStr, Common::String ¶meter, Common::String &values) { + const char *chrs = inputStr.c_str(); uint lbr; - for (lbr = 0; lbr < input_str.size(); lbr++) + for (lbr = 0; lbr < inputStr.size(); lbr++) if (chrs[lbr] == ':') break; - if (lbr >= input_str.size()) + if (lbr >= inputStr.size()) return; uint rbr; - for (rbr = lbr + 1; rbr < input_str.size(); rbr++) + for (rbr = lbr + 1; rbr < inputStr.size(); rbr++) if (chrs[rbr] == '~') break; - if (rbr >= input_str.size()) + if (rbr >= inputStr.size()) return; parameter = Common::String(chrs, chrs + lbr); diff --git a/engines/zvision/scripting/controls/lever_control.h b/engines/zvision/scripting/controls/lever_control.h index 22789f777b..8de6d1e5c9 100644 --- a/engines/zvision/scripting/controls/lever_control.h +++ b/engines/zvision/scripting/controls/lever_control.h @@ -112,7 +112,7 @@ private: */ static int calculateVectorAngle(const Common::Point &pointOne, const Common::Point &pointTwo); void renderFrame(uint frameNumber); - void getLevParams(const Common::String &input_str, Common::String ¶meter, Common::String &values); + void getLevParams(const Common::String &inputStr, Common::String ¶meter, Common::String &values); }; } // End of namespace ZVision diff --git a/engines/zvision/scripting/controls/paint_control.cpp b/engines/zvision/scripting/controls/paint_control.cpp index 54c02a2568..cb3c17e0fd 100644 --- a/engines/zvision/scripting/controls/paint_control.cpp +++ b/engines/zvision/scripting/controls/paint_control.cpp @@ -64,7 +64,7 @@ PaintControl::PaintControl(ZVision *engine, uint32 key, Common::SeekableReadStre } else if (param.matchString("brush_file", true)) { _brush = _engine->getRenderManager()->loadImage(values, false); } else if (param.matchString("venus_id", true)) { - _venus_id = atoi(values.c_str()); + _venusId = atoi(values.c_str()); } else if (param.matchString("paint_file", true)) { _paint = _engine->getRenderManager()->loadImage(values, false); } else if (param.matchString("eligible_objects", true)) { @@ -88,7 +88,7 @@ PaintControl::PaintControl(ZVision *engine, uint32 key, Common::SeekableReadStre int obj = atoi(st); - _eligible_objects.push_back(obj); + _eligibleObjects.push_back(obj); } } @@ -139,9 +139,9 @@ bool PaintControl::onMouseDown(const Common::Point &screenSpacePos, const Common return false; if (_rectangle.contains(backgroundImageSpacePos)) { - int mouse_item = _engine->getScriptManager()->getStateValue(StateKey_InventoryItem); + int mouseItem = _engine->getScriptManager()->getStateValue(StateKey_InventoryItem); - if (eligeblity(mouse_item)) { + if (eligeblity(mouseItem)) { setVenus(); _mouseDown = true; } @@ -155,9 +155,9 @@ bool PaintControl::onMouseMove(const Common::Point &screenSpacePos, const Common return false; if (_rectangle.contains(backgroundImageSpacePos)) { - int mouse_item = _engine->getScriptManager()->getStateValue(StateKey_InventoryItem); + int mouseItem = _engine->getScriptManager()->getStateValue(StateKey_InventoryItem); - if (eligeblity(mouse_item)) { + if (eligeblity(mouseItem)) { _engine->getCursorManager()->changeCursor(_cursor); if (_mouseDown) { @@ -178,30 +178,30 @@ bool PaintControl::onMouseMove(const Common::Point &screenSpacePos, const Common return false; } -bool PaintControl::eligeblity(int item_id) { - for (Common::List<int>::iterator it = _eligible_objects.begin(); it != _eligible_objects.end(); it++) - if (*it == item_id) +bool PaintControl::eligeblity(int itemId) { + for (Common::List<int>::iterator it = _eligibleObjects.begin(); it != _eligibleObjects.end(); it++) + if (*it == itemId) return true; return false; } Common::Rect PaintControl::paint(const Common::Point &point) { - Common::Rect paint_rect = Common::Rect(_brush->w, _brush->h); - paint_rect.moveTo(point); - paint_rect.clip(_rectangle); - - if (!paint_rect.isEmpty()) { - Common::Rect brush_rect = paint_rect; - brush_rect.translate(-point.x, -point.y); - - Common::Rect bkg_rect = paint_rect; - bkg_rect.translate(-_rectangle.left, -_rectangle.top); - - for (int yy = 0; yy < brush_rect.height(); yy++) { - uint16 *mask = (uint16 *)_brush->getBasePtr(brush_rect.left, brush_rect.top + yy); - uint16 *from = (uint16 *)_paint->getBasePtr(bkg_rect.left, bkg_rect.top + yy); - uint16 *to = (uint16 *)_bkg->getBasePtr(bkg_rect.left, bkg_rect.top + yy); - for (int xx = 0; xx < brush_rect.width(); xx++) { + Common::Rect paintRect = Common::Rect(_brush->w, _brush->h); + paintRect.moveTo(point); + paintRect.clip(_rectangle); + + if (!paintRect.isEmpty()) { + Common::Rect brushRect = paintRect; + brushRect.translate(-point.x, -point.y); + + Common::Rect bkgRect = paintRect; + bkgRect.translate(-_rectangle.left, -_rectangle.top); + + for (int yy = 0; yy < brushRect.height(); yy++) { + uint16 *mask = (uint16 *)_brush->getBasePtr(brushRect.left, brushRect.top + yy); + uint16 *from = (uint16 *)_paint->getBasePtr(bkgRect.left, bkgRect.top + yy); + uint16 *to = (uint16 *)_bkg->getBasePtr(bkgRect.left, bkgRect.top + yy); + for (int xx = 0; xx < brushRect.width(); xx++) { if (*mask != 0) *(to + xx) = *(from + xx); @@ -210,7 +210,7 @@ Common::Rect PaintControl::paint(const Common::Point &point) { } } - return paint_rect; + return paintRect; } } // End of namespace ZVision diff --git a/engines/zvision/scripting/controls/paint_control.h b/engines/zvision/scripting/controls/paint_control.h index 54b96e8e4e..aac4755fcd 100644 --- a/engines/zvision/scripting/controls/paint_control.h +++ b/engines/zvision/scripting/controls/paint_control.h @@ -75,14 +75,14 @@ private: Graphics::Surface *_bkg; Graphics::Surface *_brush; - Common::List<int> _eligible_objects; + Common::List<int> _eligibleObjects; int _cursor; Common::Rect _rectangle; bool _mouseDown; - bool eligeblity(int item_id); + bool eligeblity(int itemId); Common::Rect paint(const Common::Point &point); }; diff --git a/engines/zvision/scripting/controls/push_toggle_control.cpp b/engines/zvision/scripting/controls/push_toggle_control.cpp index 561dd1dd20..ea4e947abe 100644 --- a/engines/zvision/scripting/controls/push_toggle_control.cpp +++ b/engines/zvision/scripting/controls/push_toggle_control.cpp @@ -75,7 +75,7 @@ PushToggleControl::PushToggleControl(ZVision *engine, uint32 key, Common::Seekab // Not used } } else if (param.matchString("venus_id", true)) { - _venus_id = atoi(values.c_str()); + _venusId = atoi(values.c_str()); } line = stream.readLine(); diff --git a/engines/zvision/scripting/controls/safe_control.cpp b/engines/zvision/scripting/controls/safe_control.cpp index 9df61ce341..de1ece5b19 100644 --- a/engines/zvision/scripting/controls/safe_control.cpp +++ b/engines/zvision/scripting/controls/safe_control.cpp @@ -43,18 +43,18 @@ namespace ZVision { SafeControl::SafeControl(ZVision *engine, uint32 key, Common::SeekableReadStream &stream) : Control(engine, key, CONTROL_SAFE) { - _num_states = 0; - _cur_state = 0; + _statesCount = 0; + _curState = 0; _animation = NULL; - _radius_inner = 0; - _radius_inner_sq = 0; - _radius_outer = 0; - _radius_outer_sq = 0; - _zero_pointer = 0; - _start_pointer = 0; - _cur_frame = -1; - _to_frame = 0; - _frame_time = 0; + _innerRaduis = 0; + _innerRadiusSqr = 0; + _outerRadius = 0; + _outerRadiusSqr = 0; + _zeroPointer = 0; + _startPointer = 0; + _curFrame = -1; + _targetFrame = 0; + _frameTime = 0; _lastRenderedFrame = -1; // Loop until we find the closing brace @@ -77,7 +77,7 @@ SafeControl::SafeControl(ZVision *engine, uint32 key, Common::SeekableReadStream _rectangle = Common::Rect(x, y, width, height); } else if (param.matchString("num_states", true)) { - _num_states = atoi(values.c_str()); + _statesCount = atoi(values.c_str()); } else if (param.matchString("center", true)) { int x; int y; @@ -85,29 +85,29 @@ SafeControl::SafeControl(ZVision *engine, uint32 key, Common::SeekableReadStream sscanf(values.c_str(), "%d %d", &x, &y); _center = Common::Point(x, y); } else if (param.matchString("dial_inner_radius", true)) { - _radius_inner = atoi(values.c_str()); - _radius_inner_sq = _radius_inner * _radius_inner; + _innerRaduis = atoi(values.c_str()); + _innerRadiusSqr = _innerRaduis * _innerRaduis; } else if (param.matchString("radius", true)) { - _radius_outer = atoi(values.c_str()); - _radius_outer_sq = _radius_outer * _radius_outer; + _outerRadius = atoi(values.c_str()); + _outerRadiusSqr = _outerRadius * _outerRadius; } else if (param.matchString("zero_radians_offset", true)) { - _zero_pointer = atoi(values.c_str()); + _zeroPointer = atoi(values.c_str()); } else if (param.matchString("pointer_offset", true)) { - _start_pointer = atoi(values.c_str()); - _cur_state = _start_pointer; + _startPointer = atoi(values.c_str()); + _curState = _startPointer; } else if (param.matchString("cursor", true)) { // Not used } else if (param.matchString("mirrored", true)) { // Not used } else if (param.matchString("venus_id", true)) { - _venus_id = atoi(values.c_str()); + _venusId = atoi(values.c_str()); } line = stream.readLine(); trimCommentsAndWhiteSpace(&line); getParams(line, param, values); } - renderFrame(_cur_state); + renderFrame(_curState); } SafeControl::~SafeControl() { @@ -121,7 +121,7 @@ void SafeControl::renderFrame(uint frameNumber) { _lastRenderedFrame = frameNumber; } else if ((int16)frameNumber < _lastRenderedFrame) { _lastRenderedFrame = frameNumber; - frameNumber = (_num_states * 2) - frameNumber; + frameNumber = (_statesCount * 2) - frameNumber; } else { _lastRenderedFrame = frameNumber; } @@ -139,21 +139,20 @@ bool SafeControl::process(uint32 deltaTimeInMillis) { if (_engine->getScriptManager()->getStateFlag(_key) & Puzzle::DISABLED) return false; - if (_cur_frame != _to_frame) { - _frame_time -= deltaTimeInMillis; + if (_curFrame != _targetFrame) { + _frameTime -= deltaTimeInMillis; - if (_frame_time <= 0) { - if (_cur_frame < _to_frame) { - _cur_frame++; - renderFrame(_cur_frame); - } else if (_cur_frame > _to_frame) { - _cur_frame--; - renderFrame(_cur_frame); + if (_frameTime <= 0) { + if (_curFrame < _targetFrame) { + _curFrame++; + renderFrame(_curFrame); + } else if (_curFrame > _targetFrame) { + _curFrame--; + renderFrame(_curFrame); } - _frame_time = _animation->frameTime(); + _frameTime = _animation->frameTime(); } } - return false; } @@ -163,12 +162,11 @@ bool SafeControl::onMouseMove(const Common::Point &screenSpacePos, const Common: if (_rectangle.contains(backgroundImageSpacePos)) { int32 mR = backgroundImageSpacePos.sqrDist(_center); - if (mR <= _radius_outer_sq && mR >= _radius_inner_sq) { + if (mR <= _outerRadiusSqr && mR >= _innerRadiusSqr) { _engine->getCursorManager()->changeCursor(CursorIndex_Active); return true; } } - return false; } @@ -178,30 +176,29 @@ bool SafeControl::onMouseUp(const Common::Point &screenSpacePos, const Common::P if (_rectangle.contains(backgroundImageSpacePos)) { int32 mR = backgroundImageSpacePos.sqrDist(_center); - if (mR <= _radius_outer_sq && mR >= _radius_inner_sq) { + if (mR <= _outerRadiusSqr && mR >= _innerRadiusSqr) { setVenus(); Common::Point tmp = backgroundImageSpacePos - _center; float dd = atan2(tmp.x, tmp.y) * 57.29578; - int16 dp_state = 360 / _num_states; + int16 dp_state = 360 / _statesCount; - int16 m_state = (_num_states - ((((int16)dd + 540) % 360) / dp_state)) % _num_states; + int16 m_state = (_statesCount - ((((int16)dd + 540) % 360) / dp_state)) % _statesCount; - int16 tmp2 = (m_state + _cur_state - _zero_pointer + _num_states - 1) % _num_states; + int16 tmp2 = (m_state + _curState - _zeroPointer + _statesCount - 1) % _statesCount; - _cur_frame = (_cur_state + _num_states - _start_pointer) % _num_states; + _curFrame = (_curState + _statesCount - _startPointer) % _statesCount; - _cur_state = (_num_states * 2 + tmp2) % _num_states; + _curState = (_statesCount * 2 + tmp2) % _statesCount; - _to_frame = (_cur_state + _num_states - _start_pointer) % _num_states; + _targetFrame = (_curState + _statesCount - _startPointer) % _statesCount; - _engine->getScriptManager()->setStateValue(_key, _cur_state); + _engine->getScriptManager()->setStateValue(_key, _curState); return true; } } - return false; } diff --git a/engines/zvision/scripting/controls/safe_control.h b/engines/zvision/scripting/controls/safe_control.h index 2477d8c26d..e682e35050 100644 --- a/engines/zvision/scripting/controls/safe_control.h +++ b/engines/zvision/scripting/controls/safe_control.h @@ -40,20 +40,20 @@ public: ~SafeControl(); private: - int16 _num_states; - int16 _cur_state; + int16 _statesCount; + int16 _curState; MetaAnimation *_animation; Common::Point _center; Common::Rect _rectangle; - int16 _radius_inner; - int32 _radius_inner_sq; - int16 _radius_outer; - int32 _radius_outer_sq; - int16 _zero_pointer; - int16 _start_pointer; - int16 _cur_frame; - int16 _to_frame; - int32 _frame_time; + int16 _innerRaduis; + int32 _innerRadiusSqr; + int16 _outerRadius; + int32 _outerRadiusSqr; + int16 _zeroPointer; + int16 _startPointer; + int16 _curFrame; + int16 _targetFrame; + int32 _frameTime; int16 _lastRenderedFrame; diff --git a/engines/zvision/scripting/controls/save_control.cpp b/engines/zvision/scripting/controls/save_control.cpp index a0b19db513..7e1a65a9cc 100644 --- a/engines/zvision/scripting/controls/save_control.cpp +++ b/engines/zvision/scripting/controls/save_control.cpp @@ -50,13 +50,13 @@ SaveControl::SaveControl(ZVision *engine, uint32 key, Common::SeekableReadStream while (!stream.eos() && !line.contains('}')) { if (param.matchString("savebox", true)) { - int save_id; - int input_id; + int saveId; + int inputId; - sscanf(values.c_str(), "%d %d", &save_id, &input_id); - save_elmnt elmnt; - elmnt.input_key = input_id; - elmnt.save_id = save_id; + sscanf(values.c_str(), "%d %d", &saveId, &inputId); + saveElement elmnt; + elmnt.inputKey = inputId; + elmnt.saveId = saveId; elmnt.exist = false; _inputs.push_back(elmnt); } else if (param.matchString("control_type", true)) { @@ -72,11 +72,11 @@ SaveControl::SaveControl(ZVision *engine, uint32 key, Common::SeekableReadStream } for (saveElmntList::iterator iter = _inputs.begin(); iter != _inputs.end(); ++iter) { - Control *ctrl = _engine->getScriptManager()->getControl(iter->input_key); + Control *ctrl = _engine->getScriptManager()->getControl(iter->inputKey); if (ctrl && ctrl->getType() == Control::CONTROL_INPUT) { InputControl *inp = (InputControl *)ctrl; inp->setReadOnly(!_saveControl); - Common::SeekableReadStream *save = _engine->getSaveManager()->getSlotFile(iter->save_id); + Common::SeekableReadStream *save = _engine->getSaveManager()->getSlotFile(iter->saveId); if (save) { SaveGameHeader header; _engine->getSaveManager()->readSaveGameHeader(save, header); @@ -90,7 +90,7 @@ SaveControl::SaveControl(ZVision *engine, uint32 key, Common::SeekableReadStream bool SaveControl::process(uint32 deltaTimeInMillis) { for (saveElmntList::iterator iter = _inputs.begin(); iter != _inputs.end(); ++iter) { - Control *ctrl = _engine->getScriptManager()->getControl(iter->input_key); + Control *ctrl = _engine->getScriptManager()->getControl(iter->inputKey); if (ctrl && ctrl->getType() == Control::CONTROL_INPUT) { InputControl *inp = (InputControl *)ctrl; if (inp->enterPress()) { @@ -102,7 +102,7 @@ bool SaveControl::process(uint32 deltaTimeInMillis) { toSave = false; if (toSave) { - _engine->getSaveManager()->saveGameBuffered(iter->save_id, inp->getText()); + _engine->getSaveManager()->saveGameBuffered(iter->saveId, inp->getText()); _engine->delayedMessage(_engine->getStringManager()->getTextLine(StringManager::ZVISION_STR_SAVED), 2000); _engine->getScriptManager()->changeLocation(_engine->getScriptManager()->getLastMenuLocation()); } @@ -110,7 +110,7 @@ bool SaveControl::process(uint32 deltaTimeInMillis) { _engine->timedMessage(_engine->getStringManager()->getTextLine(StringManager::ZVISION_STR_SAVEEMPTY), 2000); } } else { - _engine->getSaveManager()->loadGame(iter->save_id); + _engine->getSaveManager()->loadGame(iter->saveId); return true; } break; diff --git a/engines/zvision/scripting/controls/save_control.h b/engines/zvision/scripting/controls/save_control.h index 942b9c9269..fefb0e0ce2 100644 --- a/engines/zvision/scripting/controls/save_control.h +++ b/engines/zvision/scripting/controls/save_control.h @@ -35,12 +35,12 @@ public: SaveControl(ZVision *engine, uint32 key, Common::SeekableReadStream &stream); private: - struct save_elmnt { - int save_id; - int input_key; + struct saveElement { + int saveId; + int inputKey; bool exist; }; - typedef Common::List<save_elmnt> saveElmntList; + typedef Common::List<saveElement> saveElmntList; saveElmntList _inputs; bool _saveControl; diff --git a/engines/zvision/scripting/controls/slot_control.cpp b/engines/zvision/scripting/controls/slot_control.cpp index 46ee320eb5..074d1905b4 100644 --- a/engines/zvision/scripting/controls/slot_control.cpp +++ b/engines/zvision/scripting/controls/slot_control.cpp @@ -38,7 +38,7 @@ namespace ZVision { SlotControl::SlotControl(ZVision *engine, uint32 key, Common::SeekableReadStream &stream) : Control(engine, key, CONTROL_SLOT) { - _rendered_item = 0; + _renderedItem = 0; _bkg = NULL; // Loop until we find the closing brace @@ -70,9 +70,9 @@ SlotControl::SlotControl(ZVision *engine, uint32 key, Common::SeekableReadStream } else if (param.matchString("cursor", true)) { _cursor = _engine->getCursorManager()->getCursorId(values); } else if (param.matchString("distance_id", true)) { - sscanf(values.c_str(), "%c", &_distance_id); + sscanf(values.c_str(), "%c", &_distanceId); } else if (param.matchString("venus_id", true)) { - _venus_id = atoi(values.c_str()); + _venusId = atoi(values.c_str()); } else if (param.matchString("eligible_objects", true)) { char buf[256]; memset(buf, 0, 256); @@ -94,7 +94,7 @@ SlotControl::SlotControl(ZVision *engine, uint32 key, Common::SeekableReadStream int obj = atoi(st); - _eligible_objects.push_back(obj); + _eligibleObjects.push_back(obj); } } @@ -124,26 +124,26 @@ bool SlotControl::onMouseUp(const Common::Point &screenSpacePos, const Common::P setVenus(); int item = _engine->getScriptManager()->getStateValue(_key); - int mouse_item = _engine->getScriptManager()->getStateValue(StateKey_InventoryItem); + int mouseItem = _engine->getScriptManager()->getStateValue(StateKey_InventoryItem); if (item != 0) { - if (mouse_item != 0) { - if (eligeblity(mouse_item)) { - _engine->getScriptManager()->invertory_drop(mouse_item); - _engine->getScriptManager()->invertory_add(item); - _engine->getScriptManager()->setStateValue(_key, mouse_item); + if (mouseItem != 0) { + if (eligeblity(mouseItem)) { + _engine->getScriptManager()->inventoryDrop(mouseItem); + _engine->getScriptManager()->inventoryAdd(item); + _engine->getScriptManager()->setStateValue(_key, mouseItem); } } else { - _engine->getScriptManager()->invertory_add(item); + _engine->getScriptManager()->inventoryAdd(item); _engine->getScriptManager()->setStateValue(_key, 0); } - } else if (mouse_item == 0) { + } else if (mouseItem == 0) { if (eligeblity(0)) { - _engine->getScriptManager()->invertory_drop(0); + _engine->getScriptManager()->inventoryDrop(0); _engine->getScriptManager()->setStateValue(_key, 0); } - } else if (eligeblity(mouse_item)) { - _engine->getScriptManager()->setStateValue(_key, mouse_item); - _engine->getScriptManager()->invertory_drop(mouse_item); + } else if (eligeblity(mouseItem)) { + _engine->getScriptManager()->setStateValue(_key, mouseItem); + _engine->getScriptManager()->inventoryDrop(mouseItem); } } return false; @@ -166,13 +166,13 @@ bool SlotControl::process(uint32 deltaTimeInMillis) { return false; if (_engine->canRender()) { - int cur_item = _engine->getScriptManager()->getStateValue(_key); - if (cur_item != _rendered_item) { - if (_rendered_item != 0 && cur_item == 0) { + int curItem = _engine->getScriptManager()->getStateValue(_key); + if (curItem != _renderedItem) { + if (_renderedItem != 0 && curItem == 0) { _engine->getRenderManager()->blitSurfaceToBkg(*_bkg, _rectangle.left, _rectangle.top); - _rendered_item = cur_item; + _renderedItem = curItem; } else { - if (_rendered_item == 0) { + if (_renderedItem == 0) { if (_bkg) delete _bkg; @@ -183,9 +183,9 @@ bool SlotControl::process(uint32 deltaTimeInMillis) { char buf[16]; if (_engine->getGameId() == GID_NEMESIS) - sprintf(buf, "%d%cobj.tga", cur_item, _distance_id); + sprintf(buf, "%d%cobj.tga", curItem, _distanceId); else - sprintf(buf, "g0z%cu%2.2x1.tga", _distance_id, cur_item); + sprintf(buf, "g0z%cu%2.2x1.tga", _distanceId, curItem); Graphics::Surface *srf = _engine->getRenderManager()->loadImage(buf); @@ -202,16 +202,16 @@ bool SlotControl::process(uint32 deltaTimeInMillis) { delete srf; - _rendered_item = cur_item; + _renderedItem = curItem; } } } return false; } -bool SlotControl::eligeblity(int item_id) { - for (Common::List<int>::iterator it = _eligible_objects.begin(); it != _eligible_objects.end(); it++) - if (*it == item_id) +bool SlotControl::eligeblity(int itemId) { + for (Common::List<int>::iterator it = _eligibleObjects.begin(); it != _eligibleObjects.end(); it++) + if (*it == itemId) return true; return false; } diff --git a/engines/zvision/scripting/controls/slot_control.h b/engines/zvision/scripting/controls/slot_control.h index 7799785aa5..86fd261f25 100644 --- a/engines/zvision/scripting/controls/slot_control.h +++ b/engines/zvision/scripting/controls/slot_control.h @@ -66,13 +66,13 @@ private: Common::Rect _hotspot; int _cursor; - char _distance_id; + char _distanceId; - int _rendered_item; + int _renderedItem; - Common::List<int> _eligible_objects; + Common::List<int> _eligibleObjects; - bool eligeblity(int item_id); + bool eligeblity(int itemId); Graphics::Surface *_bkg; diff --git a/engines/zvision/scripting/inventory.cpp b/engines/zvision/scripting/inventory.cpp index f8b22970c4..98d063395b 100644 --- a/engines/zvision/scripting/inventory.cpp +++ b/engines/zvision/scripting/inventory.cpp @@ -27,95 +27,95 @@ namespace ZVision { -int8 ScriptManager::invertory_getCount() { +int8 ScriptManager::inventoryGetCount() { return getStateValue(StateKey_Inv_Cnt_Slot); } -void ScriptManager::invertory_setCount(int8 cnt) { +void ScriptManager::inventorySetCount(int8 cnt) { setStateValue(StateKey_Inv_Cnt_Slot, cnt); } -int16 ScriptManager::invertory_getItem(int8 id) { +int16 ScriptManager::inventoryGetItem(int8 id) { if (id < 49 && id >= 0) return getStateValue(StateKey_Inv_1_Slot + id); return -1; } -void ScriptManager::invertory_setItem(int8 id, int16 item) { +void ScriptManager::inventorySetItem(int8 id, int16 item) { if (id < 49 && id >= 0) setStateValue(StateKey_Inv_1_Slot + id, item); } -void ScriptManager::invertory_add(int16 item) { - int8 cnt = invertory_getCount(); +void ScriptManager::inventoryAdd(int16 item) { + int8 cnt = inventoryGetCount(); if (cnt < 49) { - bool not_exist = true; + bool notExist = true; if (cnt == 0) { - invertory_setItem(0, 0); - invertory_setCount(1); // we needed empty item for cycle code + inventorySetItem(0, 0); + inventorySetCount(1); // we needed empty item for cycle code cnt = 1; } for (int8 cur = 0; cur < cnt; cur++) - if (invertory_getItem(cur) == item) { - not_exist = false; + if (inventoryGetItem(cur) == item) { + notExist = false; break; } - if (not_exist) { + if (notExist) { for (int8 i = cnt; i > 0; i--) - invertory_setItem(i, invertory_getItem(i - 1)); + inventorySetItem(i, inventoryGetItem(i - 1)); - invertory_setItem(0, item); + inventorySetItem(0, item); setStateValue(StateKey_InventoryItem, item); - invertory_setCount(cnt + 1); + inventorySetCount(cnt + 1); } } } -void ScriptManager::invertory_drop(int16 item) { - int8 items_cnt = invertory_getCount(); +void ScriptManager::inventoryDrop(int16 item) { + int8 itemCount = inventoryGetCount(); // if items in inventory > 0 - if (items_cnt != 0) { + if (itemCount != 0) { int8 index = 0; // finding needed item - while (index < items_cnt) { - if (invertory_getItem(index) == item) + while (index < itemCount) { + if (inventoryGetItem(index) == item) break; index++; } // if item in the inventory - if (items_cnt != index) { + if (itemCount != index) { // shift all items left with rewrite founded item - for (int8 v = index; v < items_cnt - 1 ; v++) - invertory_setItem(v, invertory_getItem(v + 1)); + for (int8 v = index; v < itemCount - 1 ; v++) + inventorySetItem(v, inventoryGetItem(v + 1)); // del last item - invertory_setItem(items_cnt - 1, 0); - invertory_setCount(invertory_getCount() - 1); + inventorySetItem(itemCount - 1, 0); + inventorySetCount(inventoryGetCount() - 1); - setStateValue(StateKey_InventoryItem, invertory_getItem(0)); + setStateValue(StateKey_InventoryItem, inventoryGetItem(0)); } } } -void ScriptManager::invertory_cycle() { - int8 item_cnt = invertory_getCount(); - int8 cur_item = invertory_getItem(0); - if (item_cnt > 1) { - for (int8 i = 0; i < item_cnt - 1; i++) - invertory_setItem(i, invertory_getItem(i + 1)); +void ScriptManager::inventoryCycle() { + int8 itemCount = inventoryGetCount(); + int8 curItem = inventoryGetItem(0); + if (itemCount > 1) { + for (int8 i = 0; i < itemCount - 1; i++) + inventorySetItem(i, inventoryGetItem(i + 1)); - invertory_setItem(item_cnt - 1, cur_item); + inventorySetItem(itemCount - 1, curItem); - setStateValue(StateKey_InventoryItem, invertory_getItem(0)); + setStateValue(StateKey_InventoryItem, inventoryGetItem(0)); } } diff --git a/engines/zvision/scripting/scr_file_handling.cpp b/engines/zvision/scripting/scr_file_handling.cpp index 5e0387f0d9..697de58ed8 100644 --- a/engines/zvision/scripting/scr_file_handling.cpp +++ b/engines/zvision/scripting/scr_file_handling.cpp @@ -46,7 +46,7 @@ namespace ZVision { -void ScriptManager::parseScrFile(const Common::String &fileName, script_scope &scope) { +void ScriptManager::parseScrFile(const Common::String &fileName, ScriptScope &scope) { Common::File file; if (!_engine->getSearchManager()->openFile(file, fileName)) { warning("Script file not found: %s", fileName.c_str()); @@ -70,15 +70,15 @@ void ScriptManager::parseScrFile(const Common::String &fileName, script_scope &s if (getStateFlag(puzzle->key) & Puzzle::ONCE_PER_INST) setStateValue(puzzle->key, 0); parsePuzzle(puzzle, file); - scope._puzzles.push_back(puzzle); + scope.puzzles.push_back(puzzle); } else if (line.matchString("control:*", true)) { Control *ctrl = parseControl(line, file); if (ctrl) - scope._controls.push_back(ctrl); + scope.controls.push_back(ctrl); } } - scope.proc_count = 0; + scope.procCount = 0; } void ScriptManager::parsePuzzle(Puzzle *puzzle, Common::SeekableReadStream &stream) { @@ -196,8 +196,8 @@ void ScriptManager::parseResults(Common::SeekableReadStream &stream, Common::Lis for (pos = startpos; pos < line.size(); pos++) if (chrs[pos] == '(') break; - Common::String s_slot(chrs + startpos, chrs + pos); - slot = atoi(s_slot.c_str()); + Common::String strSlot(chrs + startpos, chrs + pos); + slot = atoi(strSlot.c_str()); startpos = pos + 1; } diff --git a/engines/zvision/scripting/script_manager.cpp b/engines/zvision/scripting/script_manager.cpp index 7df48183bd..2a54cc4314 100644 --- a/engines/zvision/scripting/script_manager.cpp +++ b/engines/zvision/scripting/script_manager.cpp @@ -76,7 +76,7 @@ void ScriptManager::update(uint deltaTimeMillis) { _currentLocation.room != _nextLocation.room || _currentLocation.view != _nextLocation.view || _currentLocation.world != _nextLocation.world) - do_changeLocation(); + ChangeLocationReal(); updateNodes(deltaTimeMillis); if (! execScope(nodeview)) @@ -90,35 +90,35 @@ void ScriptManager::update(uint deltaTimeMillis) { updateControls(deltaTimeMillis); } -bool ScriptManager::execScope(script_scope &scope) { +bool ScriptManager::execScope(ScriptScope &scope) { // Swap queues - PuzzleList *tmp = scope.exec_queue; - scope.exec_queue = scope.scope_queue; - scope.scope_queue = tmp; - scope.scope_queue->clear(); + PuzzleList *tmp = scope.execQueue; + scope.execQueue = scope.scopeQueue; + scope.scopeQueue = tmp; + scope.scopeQueue->clear(); - for (PuzzleList::iterator PuzzleIter = scope._puzzles.begin(); PuzzleIter != scope._puzzles.end(); ++PuzzleIter) + for (PuzzleList::iterator PuzzleIter = scope.puzzles.begin(); PuzzleIter != scope.puzzles.end(); ++PuzzleIter) (*PuzzleIter)->addedBySetState = 0; - if (scope.proc_count < 2 || getStateValue(StateKey_ExecScopeStyle)) { - for (PuzzleList::iterator PuzzleIter = scope._puzzles.begin(); PuzzleIter != scope._puzzles.end(); ++PuzzleIter) - if (!checkPuzzleCriteria(*PuzzleIter, scope.proc_count)) + if (scope.procCount < 2 || getStateValue(StateKey_ExecScopeStyle)) { + for (PuzzleList::iterator PuzzleIter = scope.puzzles.begin(); PuzzleIter != scope.puzzles.end(); ++PuzzleIter) + if (!checkPuzzleCriteria(*PuzzleIter, scope.procCount)) return false; } else { - for (PuzzleList::iterator PuzzleIter = scope.exec_queue->begin(); PuzzleIter != scope.exec_queue->end(); ++PuzzleIter) - if (!checkPuzzleCriteria(*PuzzleIter, scope.proc_count)) + for (PuzzleList::iterator PuzzleIter = scope.execQueue->begin(); PuzzleIter != scope.execQueue->end(); ++PuzzleIter) + if (!checkPuzzleCriteria(*PuzzleIter, scope.procCount)) return false; } - if (scope.proc_count < 2) { - scope.proc_count++; + if (scope.procCount < 2) { + scope.procCount++; } return true; } -void ScriptManager::referenceTableAddPuzzle(uint32 key, puzzle_ref ref) { +void ScriptManager::referenceTableAddPuzzle(uint32 key, PuzzleRef ref) { if (_referenceTable.contains(key)) { - Common::Array<puzzle_ref> *arr = &_referenceTable[key]; + Common::Array<PuzzleRef> *arr = &_referenceTable[key]; for (uint32 i = 0; i < arr->size(); i++) if ((*arr)[i].puz == ref.puz) return; @@ -127,12 +127,12 @@ void ScriptManager::referenceTableAddPuzzle(uint32 key, puzzle_ref ref) { _referenceTable[key].push_back(ref); } -void ScriptManager::addPuzzlesToReferenceTable(script_scope &scope) { +void ScriptManager::addPuzzlesToReferenceTable(ScriptScope &scope) { // Iterate through each local Puzzle - for (PuzzleList::iterator PuzzleIter = scope._puzzles.begin(); PuzzleIter != scope._puzzles.end(); ++PuzzleIter) { + for (PuzzleList::iterator PuzzleIter = scope.puzzles.begin(); PuzzleIter != scope.puzzles.end(); ++PuzzleIter) { Puzzle *puzzlePtr = (*PuzzleIter); - puzzle_ref ref; + PuzzleRef ref; ref.scope = &scope; ref.puz = puzzlePtr; @@ -270,22 +270,22 @@ void ScriptManager::cleanStateTable() { } } -void ScriptManager::cleanScriptScope(script_scope &scope) { - scope._priv_queue_one.clear(); - scope._priv_queue_two.clear(); - scope.scope_queue = &scope._priv_queue_one; - scope.exec_queue = &scope._priv_queue_two; - for (PuzzleList::iterator iter = scope._puzzles.begin(); iter != scope._puzzles.end(); ++iter) +void ScriptManager::cleanScriptScope(ScriptScope &scope) { + scope.privQueueOne.clear(); + scope.privQueueTwo.clear(); + scope.scopeQueue = &scope.privQueueOne; + scope.execQueue = &scope.privQueueTwo; + for (PuzzleList::iterator iter = scope.puzzles.begin(); iter != scope.puzzles.end(); ++iter) delete(*iter); - scope._puzzles.clear(); + scope.puzzles.clear(); - for (ControlList::iterator iter = scope._controls.begin(); iter != scope._controls.end(); ++iter) + for (ControlList::iterator iter = scope.controls.begin(); iter != scope.controls.end(); ++iter) delete(*iter); - scope._controls.clear(); + scope.controls.clear(); - scope.proc_count = 0; + scope.procCount = 0; } int ScriptManager::getStateValue(uint32 key) { @@ -297,10 +297,10 @@ int ScriptManager::getStateValue(uint32 key) { void ScriptManager::queuePuzzles(uint32 key) { if (_referenceTable.contains(key)) { - Common::Array<puzzle_ref> *arr = &_referenceTable[key]; + Common::Array<PuzzleRef> *arr = &_referenceTable[key]; for (int32 i = arr->size() - 1; i >= 0; i--) if (!(*arr)[i].puz->addedBySetState) { - (*arr)[i].scope->scope_queue->push_back((*arr)[i].puz); + (*arr)[i].scope->scopeQueue->push_back((*arr)[i].puz); (*arr)[i].puz->addedBySetState = true; } } @@ -518,7 +518,7 @@ void ScriptManager::changeLocation(char _world, char _room, char _node, char _vi } } -void ScriptManager::do_changeLocation() { +void ScriptManager::ChangeLocationReal() { assert(_nextLocation.world != 0); debug(1, "Changing location to: %c %c %c %c %u", _nextLocation.world, _nextLocation.room, _nextLocation.node, _nextLocation.view, _nextLocation.offset); @@ -605,7 +605,7 @@ void ScriptManager::do_changeLocation() { addPuzzlesToReferenceTable(nodeview); } - _activeControls = &nodeview._controls; + _activeControls = &nodeview.controls; // Revert to the idle cursor _engine->getCursorManager()->changeCursor(CursorIndex_Idle); @@ -701,19 +701,17 @@ void ScriptManager::deserialize(Common::SeekableReadStream *stream) { return; } - Location next_loc; + Location nextLocation; - next_loc.world = stream->readByte(); - next_loc.room = stream->readByte(); - next_loc.node = stream->readByte(); - next_loc.view = stream->readByte(); - next_loc.offset = stream->readUint32LE() & 0x0000FFFF; + nextLocation.world = stream->readByte(); + nextLocation.room = stream->readByte(); + nextLocation.node = stream->readByte(); + nextLocation.view = stream->readByte(); + nextLocation.offset = stream->readUint32LE() & 0x0000FFFF; - // What the fck, eos is not 'return pos >= size' - // while (!stream->eos()) {*/ while (stream->pos() < stream->size()) { uint32 tag = stream->readUint32BE(); - uint32 tag_size = stream->readUint32LE(); + uint32 tagSize = stream->readUint32LE(); switch (tag) { case MKTAG('T', 'I', 'M', 'R'): { uint32 key = stream->readUint32LE(); @@ -726,22 +724,22 @@ void ScriptManager::deserialize(Common::SeekableReadStream *stream) { } break; case MKTAG('F', 'L', 'A', 'G'): - for (uint32 i = 0; i < tag_size / 2; i++) + for (uint32 i = 0; i < tagSize / 2; i++) setStateFlagSilent(i, stream->readUint16LE()); break; case MKTAG('P', 'U', 'Z', 'Z'): - for (uint32 i = 0; i < tag_size / 2; i++) + for (uint32 i = 0; i < tagSize / 2; i++) setStateValueSilent(i, stream->readUint16LE()); break; default: - stream->seek(tag_size, SEEK_CUR); + stream->seek(tagSize, SEEK_CUR); } } - _nextLocation = next_loc; + _nextLocation = nextLocation; + + ChangeLocationReal(); - do_changeLocation(); - // Place for read prefs _engine->setRenderDelay(10); setStateValue(StateKey_RestoreFlag, 1); @@ -792,23 +790,23 @@ void ScriptManager::flushEvent(Common::EventType type) { } } -ValueSlot::ValueSlot(ScriptManager *sc_man, const char *slot_val): - _sc_man(sc_man) { +ValueSlot::ValueSlot(ScriptManager *scriptManager, const char *slotValue): + _scriptManager(scriptManager) { value = 0; slot = false; - const char *is_slot = strstr(slot_val, "["); - if (is_slot) { + const char *isSlot = strstr(slotValue, "["); + if (isSlot) { slot = true; - value = atoi(is_slot + 1); + value = atoi(isSlot + 1); } else { slot = false; - value = atoi(slot_val); + value = atoi(slotValue); } } int16 ValueSlot::getValue() { if (slot) { if (value >= 0) - return _sc_man->getStateValue(value); + return _scriptManager->getStateValue(value); else return 0; } else diff --git a/engines/zvision/scripting/script_manager.h b/engines/zvision/scripting/script_manager.h index ddb8c885aa..5701cde6d0 100644 --- a/engines/zvision/scripting/script_manager.h +++ b/engines/zvision/scripting/script_manager.h @@ -123,24 +123,24 @@ public: private: ZVision *_engine; - struct script_scope { - uint32 proc_count; + struct ScriptScope { + uint32 procCount; - PuzzleList *scope_queue; // For adding puzzles to queue - PuzzleList *exec_queue; // Switch to it when execute - PuzzleList _priv_queue_one; - PuzzleList _priv_queue_two; + PuzzleList *scopeQueue; // For adding puzzles to queue + PuzzleList *execQueue; // Switch to it when execute + PuzzleList privQueueOne; + PuzzleList privQueueTwo; - PuzzleList _puzzles; - ControlList _controls; + PuzzleList puzzles; + ControlList controls; }; - struct puzzle_ref { + struct PuzzleRef { Puzzle *puz; - script_scope *scope; + ScriptScope *scope; }; - typedef Common::HashMap<uint32, Common::Array<puzzle_ref> > PuzzleMap; + typedef Common::HashMap<uint32, Common::Array<PuzzleRef> > PuzzleMap; /** * Holds the global state variable. Do NOT directly modify this. Use the accessors and @@ -157,10 +157,10 @@ private: EventList _controlEvents; - script_scope universe; - script_scope world; - script_scope room; - script_scope nodeview; + ScriptScope universe; + ScriptScope world; + ScriptScope room; + ScriptScope nodeview; /** Holds the currently active timers, musics, other */ SideFXList _activeSideFx; @@ -249,30 +249,30 @@ public: Location getLastMenuLocation(); private: - void referenceTableAddPuzzle(uint32 key, puzzle_ref ref); - void addPuzzlesToReferenceTable(script_scope &scope); + void referenceTableAddPuzzle(uint32 key, PuzzleRef ref); + void addPuzzlesToReferenceTable(ScriptScope &scope); void updateNodes(uint deltaTimeMillis); void updateControls(uint deltaTimeMillis); bool checkPuzzleCriteria(Puzzle *puzzle, uint counter); void cleanStateTable(); - void cleanScriptScope(script_scope &scope); - bool execScope(script_scope &scope); + void cleanScriptScope(ScriptScope &scope); + bool execScope(ScriptScope &scope); /** Perform change location */ - void do_changeLocation(); + void ChangeLocationReal(); - int8 invertory_getCount(); - void invertory_setCount(int8 cnt); - int16 invertory_getItem(int8 id); - void invertory_setItem(int8 id, int16 item); + int8 inventoryGetCount(); + void inventorySetCount(int8 cnt); + int16 inventoryGetItem(int8 id); + void inventorySetItem(int8 id, int16 item); void setStateFlagSilent(uint32 key, uint value); void setStateValueSilent(uint32 key, int value); public: - void invertory_add(int16 item); - void invertory_drop(int16 item); - void invertory_cycle(); + void inventoryAdd(int16 item); + void inventoryDrop(int16 item); + void inventoryCycle(); // TODO: Make this private. It was only made public so Console::cmdParseAllScrFiles() could use it /** @@ -281,7 +281,7 @@ public: * @param fileName Name of the .scr file * @param isGlobal Are the puzzles included in the file global (true). AKA, the won't be purged during location changes */ - void parseScrFile(const Common::String &fileName, script_scope &scope); + void parseScrFile(const Common::String &fileName, ScriptScope &scope); private: /** @@ -332,12 +332,12 @@ private: class ValueSlot { public: - ValueSlot(ScriptManager *sc_man, const char *slot_val); + ValueSlot(ScriptManager *scriptManager, const char *slotValue); int16 getValue(); private: int16 value; bool slot; - ScriptManager *_sc_man; + ScriptManager *_scriptManager; }; diff --git a/engines/zvision/scripting/sidefx/animation_node.cpp b/engines/zvision/scripting/sidefx/animation_node.cpp index bd9c543d52..98ac4e3b37 100644 --- a/engines/zvision/scripting/sidefx/animation_node.cpp +++ b/engines/zvision/scripting/sidefx/animation_node.cpp @@ -75,19 +75,19 @@ bool AnimationNode::process(uint32 deltaTimeInMillis) { const Graphics::Surface *frame = NULL; - if (nod->_cur_frm == -1) { // Start of new playlist node - nod->_cur_frm = nod->start; + if (nod->_curFrame == -1) { // Start of new playlist node + nod->_curFrame = nod->start; - _animation->seekToFrame(nod->_cur_frm); + _animation->seekToFrame(nod->_curFrame); frame = _animation->decodeNextFrame(); nod->_delay = _frmDelay; if (nod->slot) _engine->getScriptManager()->setStateValue(nod->slot, 1); } else { - nod->_cur_frm++; + nod->_curFrame++; - if (nod->_cur_frm > nod->stop) { + if (nod->_curFrame > nod->stop) { nod->loop--; if (nod->loop == 0) { @@ -99,8 +99,8 @@ bool AnimationNode::process(uint32 deltaTimeInMillis) { return _DisposeAfterUse; } - nod->_cur_frm = nod->start; - _animation->seekToFrame(nod->_cur_frm); + nod->_curFrame = nod->start; + _animation->seekToFrame(nod->_curFrame); } frame = _animation->decodeNextFrame(); @@ -156,18 +156,18 @@ bool AnimationNode::process(uint32 deltaTimeInMillis) { -void AnimationNode::addPlayNode(int32 slot, int x, int y, int x2, int y2, int start_frame, int end_frame, int loops) { +void AnimationNode::addPlayNode(int32 slot, int x, int y, int x2, int y2, int startFrame, int endFrame, int loops) { playnode nod; nod.loop = loops; nod.pos = Common::Rect(x, y, x2 + 1, y2 + 1); - nod.start = start_frame; - nod.stop = end_frame; + nod.start = startFrame; + nod.stop = endFrame; if (nod.stop >= (int)_animation->frameCount()) nod.stop = _animation->frameCount() - 1; nod.slot = slot; - nod._cur_frm = -1; + nod._curFrame = -1; nod._delay = 0; nod._scaled = NULL; _playList.push_back(nod); diff --git a/engines/zvision/scripting/sidefx/animation_node.h b/engines/zvision/scripting/sidefx/animation_node.h index 4d1c74bccf..dab3d88d80 100644 --- a/engines/zvision/scripting/sidefx/animation_node.h +++ b/engines/zvision/scripting/sidefx/animation_node.h @@ -52,7 +52,7 @@ public: int32 start; int32 stop; int32 loop; - int32 _cur_frm; + int32 _curFrame; int32 _delay; Graphics::Surface *_scaled; }; @@ -71,7 +71,7 @@ private: public: bool process(uint32 deltaTimeInMillis); - void addPlayNode(int32 slot, int x, int y, int x2, int y2, int start_frame, int end_frame, int loops = 1); + void addPlayNode(int32 slot, int x, int y, int x2, int y2, int startFrame, int endFrame, int loops = 1); bool stop(); diff --git a/engines/zvision/scripting/sidefx/distort_node.cpp b/engines/zvision/scripting/sidefx/distort_node.cpp index 576a1f8592..9be6b29413 100644 --- a/engines/zvision/scripting/sidefx/distort_node.cpp +++ b/engines/zvision/scripting/sidefx/distort_node.cpp @@ -34,7 +34,7 @@ namespace ZVision { -DistortNode::DistortNode(ZVision *engine, uint32 key, int16 speed, float st_angl, float en_angl, float st_lin, float en_lin) +DistortNode::DistortNode(ZVision *engine, uint32 key, int16 speed, float startAngle, float endAngle, float startLineScale, float endLineScale) : SideFX(engine, key, SIDEFX_DISTORT) { _angle = _engine->getRenderManager()->getRenderTable()->getAngle(); @@ -42,15 +42,15 @@ DistortNode::DistortNode(ZVision *engine, uint32 key, int16 speed, float st_angl _speed = speed; _incr = true; - _st_angl = st_angl; - _en_angl = en_angl; - _st_lin = st_lin; - _en_lin = en_lin; + _startAngle = startAngle; + _endAngle = endAngle; + _startLineScale = startLineScale; + _endLineScale = endLineScale; _curFrame = 1.0; - _diff_angl = en_angl - st_angl; - _diff_lin = en_lin - st_lin; + _diffAngle = endAngle - startAngle; + _diffLinScale = endLineScale - startLineScale; _frmSpeed = (float)speed / 15.0; _frames = ceil((5.0 - _frmSpeed * 2.0) / _frmSpeed); @@ -85,7 +85,7 @@ bool DistortNode::process(uint32 deltaTimeInMillis) { float diff = (1.0 / (5.0 - (_curFrame * _frmSpeed))) / (5.0 - _frmSpeed); - setParams(_st_angl + diff * _diff_angl, _st_lin + diff * _diff_lin); + setParams(_startAngle + diff * _diffAngle, _startLineScale + diff * _diffLinScale); return false; } diff --git a/engines/zvision/scripting/sidefx/distort_node.h b/engines/zvision/scripting/sidefx/distort_node.h index cba9c5eff2..787a69bdde 100644 --- a/engines/zvision/scripting/sidefx/distort_node.h +++ b/engines/zvision/scripting/sidefx/distort_node.h @@ -31,21 +31,21 @@ class ZVision; class DistortNode : public SideFX { public: - DistortNode(ZVision *engine, uint32 key, int16 speed, float st_angl, float en_angl, float st_lin, float en_lin); + DistortNode(ZVision *engine, uint32 key, int16 speed, float startAngle, float endAngle, float startLineScale, float endLineScale); ~DistortNode(); bool process(uint32 deltaTimeInMillis); private: int16 _speed; - float _st_angl; - float _en_angl; - float _st_lin; - float _en_lin; + float _startAngle; + float _endAngle; + float _startLineScale; + float _endLineScale; float _frmSpeed; - float _diff_angl; - float _diff_lin; + float _diffAngle; + float _diffLinScale; bool _incr; int16 _frames; diff --git a/engines/zvision/scripting/sidefx/music_node.cpp b/engines/zvision/scripting/sidefx/music_node.cpp index 4420da3e96..e9baadb011 100644 --- a/engines/zvision/scripting/sidefx/music_node.cpp +++ b/engines/zvision/scripting/sidefx/music_node.cpp @@ -38,15 +38,15 @@ namespace ZVision { MusicNode::MusicNode(ZVision *engine, uint32 key, Common::String &filename, bool loop, int8 volume) - : MusicNode_BASE(engine, key, SIDEFX_AUDIO) { + : MusicNodeBASE(engine, key, SIDEFX_AUDIO) { _loop = loop; _volume = volume; _crossfade = false; - _crossfade_target = 0; - _crossfade_time = 0; + _crossfadeTarget = 0; + _crossfadeTime = 0; _attenuate = 0; _pantrack = false; - _pantrack_X = 0; + _pantrackPosition = 0; _sub = NULL; Audio::RewindableAudioStream *audioStream; @@ -93,7 +93,7 @@ MusicNode::~MusicNode() { void MusicNode::setPanTrack(int16 pos) { if (!_stereo) { _pantrack = true; - _pantrack_X = pos; + _pantrackPosition = pos; setVolume(_volume); } } @@ -104,8 +104,8 @@ void MusicNode::unsetPanTrack() { } void MusicNode::setFade(int32 time, uint8 target) { - _crossfade_target = target; - _crossfade_time = time; + _crossfadeTarget = target; + _crossfadeTime = time; _crossfade = true; } @@ -116,14 +116,14 @@ bool MusicNode::process(uint32 deltaTimeInMillis) { uint8 _newvol = _volume; if (_crossfade) { - if (_crossfade_time > 0) { - if ((int32)deltaTimeInMillis > _crossfade_time) - deltaTimeInMillis = _crossfade_time; - _newvol += floor(((float)(_crossfade_target - _newvol) / (float)_crossfade_time)) * (float)deltaTimeInMillis; - _crossfade_time -= deltaTimeInMillis; + if (_crossfadeTime > 0) { + if ((int32)deltaTimeInMillis > _crossfadeTime) + deltaTimeInMillis = _crossfadeTime; + _newvol += floor(((float)(_crossfadeTarget - _newvol) / (float)_crossfadeTime)) * (float)deltaTimeInMillis; + _crossfadeTime -= deltaTimeInMillis; } else { _crossfade = false; - _newvol = _crossfade_target; + _newvol = _crossfadeTarget; } } @@ -136,17 +136,17 @@ bool MusicNode::process(uint32 deltaTimeInMillis) { return false; } -void MusicNode::setVolume(uint8 new_volume) { +void MusicNode::setVolume(uint8 newVolume) { if (_pantrack) { - int cur_x = _engine->getScriptManager()->getStateValue(StateKey_ViewPos); - cur_x -= _pantrack_X; + int curX = _engine->getScriptManager()->getStateValue(StateKey_ViewPos); + curX -= _pantrackPosition; int32 _width = _engine->getRenderManager()->getBkgSize().x; - if (cur_x < (-_width) / 2) - cur_x += _width; - else if (cur_x >= _width / 2) - cur_x -= _width; + if (curX < (-_width) / 2) + curX += _width; + else if (curX >= _width / 2) + curX -= _width; - float norm = (float)cur_x / ((float)_width / 2.0); + float norm = (float)curX / ((float)_width / 2.0); float lvl = fabs(norm); if (lvl > 0.5) lvl = (lvl - 0.5) * 1.7; @@ -157,16 +157,16 @@ void MusicNode::setVolume(uint8 new_volume) { if (_engine->_mixer->isSoundHandleActive(_handle)) { _engine->_mixer->setChannelBalance(_handle, bal); - _engine->_mixer->setChannelVolume(_handle, new_volume * lvl); + _engine->_mixer->setChannelVolume(_handle, newVolume * lvl); } } else { if (_engine->_mixer->isSoundHandleActive(_handle)) { _engine->_mixer->setChannelBalance(_handle, 0); - _engine->_mixer->setChannelVolume(_handle, new_volume); + _engine->_mixer->setChannelVolume(_handle, newVolume); } } - _volume = new_volume; + _volume = newVolume; } PanTrackNode::PanTrackNode(ZVision *engine, uint32 key, uint32 slot, int16 pos) @@ -175,7 +175,7 @@ PanTrackNode::PanTrackNode(ZVision *engine, uint32 key, uint32 slot, int16 pos) SideFX *fx = _engine->getScriptManager()->getSideFX(slot); if (fx && fx->getType() == SIDEFX_AUDIO) { - MusicNode_BASE *mus = (MusicNode_BASE *)fx; + MusicNodeBASE *mus = (MusicNodeBASE *)fx; mus->setPanTrack(pos); } } @@ -183,14 +183,14 @@ PanTrackNode::PanTrackNode(ZVision *engine, uint32 key, uint32 slot, int16 pos) PanTrackNode::~PanTrackNode() { SideFX *fx = _engine->getScriptManager()->getSideFX(_slot); if (fx && fx->getType() == SIDEFX_AUDIO) { - MusicNode_BASE *mus = (MusicNode_BASE *)fx; + MusicNodeBASE *mus = (MusicNodeBASE *)fx; mus->unsetPanTrack(); } } MusicMidiNode::MusicMidiNode(ZVision *engine, uint32 key, int8 program, int8 note, int8 volume) - : MusicNode_BASE(engine, key, SIDEFX_AUDIO) { + : MusicNodeBASE(engine, key, SIDEFX_AUDIO) { _volume = volume; _prog = program; _noteNumber = note; @@ -230,11 +230,11 @@ bool MusicMidiNode::process(uint32 deltaTimeInMillis) { return false; } -void MusicMidiNode::setVolume(uint8 new_volume) { +void MusicMidiNode::setVolume(uint8 newVolume) { if (_chan >= 0) { - _engine->getMidiManager()->setVolume(_chan, new_volume); + _engine->getMidiManager()->setVolume(_chan, newVolume); } - _volume = new_volume; + _volume = newVolume; } } // End of namespace ZVision diff --git a/engines/zvision/scripting/sidefx/music_node.h b/engines/zvision/scripting/sidefx/music_node.h index 262b13085e..954e2f474e 100644 --- a/engines/zvision/scripting/sidefx/music_node.h +++ b/engines/zvision/scripting/sidefx/music_node.h @@ -33,10 +33,10 @@ class String; namespace ZVision { -class MusicNode_BASE : public SideFX { +class MusicNodeBASE : public SideFX { public: - MusicNode_BASE(ZVision *engine, uint32 key, SideFXType type) : SideFX(engine, key, type) {} - ~MusicNode_BASE() {} + MusicNodeBASE(ZVision *engine, uint32 key, SideFXType type) : SideFX(engine, key, type) {} + ~MusicNodeBASE() {} /** * Decrement the timer by the delta time. If the timer is finished, set the status @@ -55,7 +55,7 @@ public: virtual void setFade(int32 time, uint8 target) = 0; }; -class MusicNode : public MusicNode_BASE { +class MusicNode : public MusicNodeBASE { public: MusicNode(ZVision *engine, uint32 key, Common::String &file, bool loop, int8 volume); ~MusicNode(); @@ -79,19 +79,19 @@ public: private: int32 _timeLeft; bool _pantrack; - int32 _pantrack_X; + int32 _pantrackPosition; int32 _attenuate; uint8 _volume; bool _loop; bool _crossfade; - uint8 _crossfade_target; - int32 _crossfade_time; + uint8 _crossfadeTarget; + int32 _crossfadeTime; bool _stereo; Audio::SoundHandle _handle; Subtitle *_sub; }; -class MusicMidiNode : public MusicNode_BASE { +class MusicMidiNode : public MusicNodeBASE { public: MusicMidiNode(ZVision *engine, uint32 key, int8 program, int8 note, int8 volume); ~MusicMidiNode(); diff --git a/engines/zvision/scripting/sidefx/ttytext_node.h b/engines/zvision/scripting/sidefx/ttytext_node.h index a6326c733b..a229129b9d 100644 --- a/engines/zvision/scripting/sidefx/ttytext_node.h +++ b/engines/zvision/scripting/sidefx/ttytext_node.h @@ -50,15 +50,12 @@ public: bool process(uint32 deltaTimeInMillis); private: Common::Rect _r; - //int16 x; - //int16 y; - //uint16 w; - //uint16 h; + cTxtStyle _style; - sTTFont _fnt; + StyledTTFont _fnt; Common::String _txtbuf; uint32 _txtpos; - //int32 txtsize; + int32 _delay; int32 _nexttime; Graphics::Surface _img; diff --git a/engines/zvision/subtitles/subtitles.cpp b/engines/zvision/subtitles/subtitles.cpp index 4ca48f7b42..1f68b2435f 100644 --- a/engines/zvision/subtitles/subtitles.cpp +++ b/engines/zvision/subtitles/subtitles.cpp @@ -52,12 +52,12 @@ Subtitle::Subtitle(ZVision *engine, const Common::String &subname) : if (_engine->getSearchManager()->openFile(txt, filename)) { while (!txt.eos()) { Common::String txtline = readWideLine(txt); - sub cur_sub; - cur_sub.start = -1; - cur_sub.stop = -1; - cur_sub.sub = txtline; + sub curSubtitle; + curSubtitle.start = -1; + curSubtitle.stop = -1; + curSubtitle.sub = txtline; - _subs.push_back(cur_sub); + _subs.push_back(curSubtitle); } txt.close(); } diff --git a/engines/zvision/text/text.cpp b/engines/zvision/text/text.cpp index efb0fb42f9..872d6875b7 100644 --- a/engines/zvision/text/text.cpp +++ b/engines/zvision/text/text.cpp @@ -233,71 +233,71 @@ txtReturn cTxtStyle::parseStyle(const Common::String &strin, int16 ln) { } void cTxtStyle::readAllStyle(const Common::String &txt) { - int16 strt = -1; - int16 endt = -1; + int16 startTextPosition = -1; + int16 endTextPosition = -1; for (uint16 i = 0; i < txt.size(); i++) { if (txt[i] == '<') - strt = i; + startTextPosition = i; else if (txt[i] == '>') { - endt = i; - if (strt != -1) - if ((endt - strt - 1) > 0) - parseStyle(Common::String(txt.c_str() + strt + 1), endt - strt - 1); + endTextPosition = i; + if (startTextPosition != -1) + if ((endTextPosition - startTextPosition - 1) > 0) + parseStyle(Common::String(txt.c_str() + startTextPosition + 1), endTextPosition - startTextPosition - 1); } } } -void cTxtStyle::setFontStyle(sTTFont &font) { - uint temp_stl = 0; +void cTxtStyle::setFontStyle(StyledTTFont &font) { + uint tempStyle = 0; if (bold) - temp_stl |= sTTFont::STTF_BOLD; + tempStyle |= StyledTTFont::STTF_BOLD; if (italic) - temp_stl |= sTTFont::STTF_ITALIC; + tempStyle |= StyledTTFont::STTF_ITALIC; if (underline) - temp_stl |= sTTFont::STTF_UNDERLINE; + tempStyle |= StyledTTFont::STTF_UNDERLINE; if (strikeout) - temp_stl |= sTTFont::STTF_STRIKEOUT; + tempStyle |= StyledTTFont::STTF_STRIKEOUT; if (sharp) - temp_stl |= sTTFont::STTF_SHARP; + tempStyle |= StyledTTFont::STTF_SHARP; - font.setStyle(temp_stl); + font.setStyle(tempStyle); } -void cTxtStyle::setFont(sTTFont &font) { - uint temp_stl = 0; +void cTxtStyle::setFont(StyledTTFont &font) { + uint tempStyle = 0; if (bold) - temp_stl |= sTTFont::STTF_BOLD; + tempStyle |= StyledTTFont::STTF_BOLD; if (italic) - temp_stl |= sTTFont::STTF_ITALIC; + tempStyle |= StyledTTFont::STTF_ITALIC; if (underline) - temp_stl |= sTTFont::STTF_UNDERLINE; + tempStyle |= StyledTTFont::STTF_UNDERLINE; if (strikeout) - temp_stl |= sTTFont::STTF_STRIKEOUT; + tempStyle |= StyledTTFont::STTF_STRIKEOUT; if (sharp) - temp_stl |= sTTFont::STTF_SHARP; + tempStyle |= StyledTTFont::STTF_SHARP; - font.loadFont(fontname, size, temp_stl); + font.loadFont(fontname, size, tempStyle); } -Graphics::Surface *textRenderer::render(sTTFont &fnt, const Common::String &txt, cTxtStyle &style) { +Graphics::Surface *TextRenderer::render(StyledTTFont &fnt, const Common::String &txt, cTxtStyle &style) { style.setFontStyle(fnt); uint32 clr = _engine->_pixelFormat.RGBToColor(style.red, style.green, style.blue); return fnt.renderSolidText(txt, clr); } -void textRenderer::drawTxtWithJustify(const Common::String &txt, sTTFont &fnt, uint32 color, Graphics::Surface &dst, int lineY, txtJustify justify) { +void TextRenderer::drawTxtWithJustify(const Common::String &txt, StyledTTFont &fnt, uint32 color, Graphics::Surface &dst, int lineY, txtJustify justify) { if (justify == TXT_JUSTIFY_LEFT) fnt.drawString(&dst, txt, 0, lineY, dst.w, color, Graphics::kTextAlignLeft); else if (justify == TXT_JUSTIFY_CENTER) @@ -306,33 +306,33 @@ void textRenderer::drawTxtWithJustify(const Common::String &txt, sTTFont &fnt, u fnt.drawString(&dst, txt, 0, lineY, dst.w, color, Graphics::kTextAlignRight); } -int32 textRenderer::drawTxt(const Common::String &txt, cTxtStyle &fnt_stl, Graphics::Surface &dst) { - sTTFont font(_engine); - fnt_stl.setFont(font); +int32 TextRenderer::drawTxt(const Common::String &txt, cTxtStyle &fontStyle, Graphics::Surface &dst) { + StyledTTFont font(_engine); + fontStyle.setFont(font); dst.fillRect(Common::Rect(dst.w, dst.h), 0); - uint32 clr = _engine->_pixelFormat.RGBToColor(fnt_stl.red, fnt_stl.green, fnt_stl.blue); + uint32 clr = _engine->_pixelFormat.RGBToColor(fontStyle.red, fontStyle.green, fontStyle.blue); int16 w; w = font.getStringWidth(txt); - drawTxtWithJustify(txt, font, clr, dst, 0, fnt_stl.justify); + drawTxtWithJustify(txt, font, clr, dst, 0, fontStyle.justify); return w; } -void textRenderer::drawTxtInOneLine(const Common::String &text, Graphics::Surface &dst) { +void TextRenderer::drawTxtInOneLine(const Common::String &text, Graphics::Surface &dst) { const int16 TXT_CFG_TEXTURES_LINES = 256; // For now I don't want remake it const int TXT_CFG_TEXTURES_PER_LINE = 6; cTxtStyle style, style2; - int16 strt = -1; - int16 endt = -1; + int16 startTextPosition = -1; + int16 endTextPosition = -1; int16 i = 0; int16 dx = 0, dy = 0; - int16 txt_w; - int16 txtpos = 0; + int16 textPixelWidth; + int16 textPosition = 0; Common::String buf; Common::String buf2; @@ -350,7 +350,7 @@ void textRenderer::drawTxtInOneLine(const Common::String &text, Graphics::Surfac int16 stringlen = text.size(); - sTTFont font(_engine); + StyledTTFont font(_engine); style.setFont(font); @@ -361,19 +361,19 @@ void textRenderer::drawTxtInOneLine(const Common::String &text, Graphics::Surfac if (text[i] == '<') { int16 ret = 0; - strt = i; + startTextPosition = i; while (i < stringlen && text[i] != '>') i++; - endt = i; - if (strt != -1) - if ((endt - strt - 1) > 0) { + endTextPosition = i; + if (startTextPosition != -1) + if ((endTextPosition - startTextPosition - 1) > 0) { style2 = style; - ret = style.parseStyle(Common::String(text.c_str() + strt + 1), endt - strt - 1); + ret = style.parseStyle(Common::String(text.c_str() + startTextPosition + 1), endTextPosition - startTextPosition - 1); } if (ret & (TXT_RET_FNTCHG | TXT_RET_FNTSTL | TXT_RET_NEWLN)) { if (buf.size() > 0) { - txt_w = font.getStringWidth(buf); + textPixelWidth = font.getStringWidth(buf); TxtSurfaces[currentline][currentlineitm] = render(font, buf, style2); TxtPoint[currentline] = MAX(font.getFontHeight(), TxtPoint[currentline]); @@ -382,8 +382,8 @@ void textRenderer::drawTxtInOneLine(const Common::String &text, Graphics::Surfac buf.clear(); prevbufspace = 0; - txtpos = 0; - dx += txt_w; + textPosition = 0; + dx += textPixelWidth; } if (ret & TXT_RET_FNTCHG) { @@ -403,25 +403,25 @@ void textRenderer::drawTxtInOneLine(const Common::String &text, Graphics::Surfac Common::String buf3; buf3.format("%d", _engine->getScriptManager()->getStateValue(style.statebox)); buf += buf3; - txtpos += buf3.size(); + textPosition += buf3.size(); } } else { buf += text[i]; - txtpos++; + textPosition++; if (text[i] == ' ') { - prevbufspace = txtpos - 1; + prevbufspace = textPosition - 1; prevtxtspace = i; } if (font.isLoaded()) { - txt_w = font.getStringWidth(buf); - if (txt_w + dx > dst.w) { + textPixelWidth = font.getStringWidth(buf); + if (textPixelWidth + dx > dst.w) { if (prevbufspace == 0) { prevtxtspace = i; - prevbufspace = txtpos - 1; + prevbufspace = textPosition - 1; } buf2 = Common::String(buf.c_str(), prevbufspace + 1); @@ -433,7 +433,7 @@ void textRenderer::drawTxtInOneLine(const Common::String &text, Graphics::Surfac buf.clear(); i = prevtxtspace; prevbufspace = 0; - txtpos = 0; + textPosition = 0; currentline++; currentlineitm = 0; dx = 0; @@ -494,7 +494,7 @@ Common::String readWideLine(Common::SeekableReadStream &stream) { break; } - // Crush each octet pair to a single octet with a simple cast + // Crush each octet pair to a UTF-8 sequence if (value < 0x80) { asciiString += (char)(value & 0x7F); } else if (value >= 0x80 && value < 0x800) { diff --git a/engines/zvision/text/text.h b/engines/zvision/text/text.h index 4b318fdef0..c2468383d3 100644 --- a/engines/zvision/text/text.h +++ b/engines/zvision/text/text.h @@ -56,8 +56,8 @@ public: cTxtStyle(); txtReturn parseStyle(const Common::String &strin, int16 len); void readAllStyle(const Common::String &txt); - void setFontStyle(sTTFont &font); - void setFont(sTTFont &font); + void setFontStyle(StyledTTFont &font); + void setFont(StyledTTFont &font); public: Common::String fontname; @@ -78,13 +78,13 @@ public: // char image ?? }; -class textRenderer { +class TextRenderer { public: - textRenderer(ZVision *engine): _engine(engine) {}; + TextRenderer(ZVision *engine): _engine(engine) {}; - void drawTxtWithJustify(const Common::String &txt, sTTFont &fnt, uint32 color, Graphics::Surface &dst, int lineY, txtJustify justify); - int32 drawTxt(const Common::String &txt, cTxtStyle &fnt_stl, Graphics::Surface &dst); - Graphics::Surface *render(sTTFont &fnt, const Common::String &txt, cTxtStyle &style); + void drawTxtWithJustify(const Common::String &txt, StyledTTFont &fnt, uint32 color, Graphics::Surface &dst, int lineY, txtJustify justify); + int32 drawTxt(const Common::String &txt, cTxtStyle &fontStyle, Graphics::Surface &dst); + Graphics::Surface *render(StyledTTFont &fnt, const Common::String &txt, cTxtStyle &style); void drawTxtInOneLine(const Common::String &txt, Graphics::Surface &dst); private: diff --git a/engines/zvision/utility/win_keys.cpp b/engines/zvision/utility/win_keys.cpp index 3441fb8bf0..86ed7c596f 100644 --- a/engines/zvision/utility/win_keys.cpp +++ b/engines/zvision/utility/win_keys.cpp @@ -24,17 +24,17 @@ namespace ZVision { -uint8 VKkey(Common::KeyCode scumm_key) { - if (scumm_key >= Common::KEYCODE_a && scumm_key <= Common::KEYCODE_z) - return 0x41 + scumm_key - Common::KEYCODE_a; - if (scumm_key >= Common::KEYCODE_0 && scumm_key <= Common::KEYCODE_9) - return 0x30 + scumm_key - Common::KEYCODE_0; - if (scumm_key >= Common::KEYCODE_F1 && scumm_key <= Common::KEYCODE_F15) - return 0x70 + scumm_key - Common::KEYCODE_F1; - if (scumm_key >= Common::KEYCODE_KP0 && scumm_key <= Common::KEYCODE_KP9) - return 0x60 + scumm_key - Common::KEYCODE_KP0; +uint8 VKkey(Common::KeyCode scummKeyCode) { + if (scummKeyCode >= Common::KEYCODE_a && scummKeyCode <= Common::KEYCODE_z) + return 0x41 + scummKeyCode - Common::KEYCODE_a; + if (scummKeyCode >= Common::KEYCODE_0 && scummKeyCode <= Common::KEYCODE_9) + return 0x30 + scummKeyCode - Common::KEYCODE_0; + if (scummKeyCode >= Common::KEYCODE_F1 && scummKeyCode <= Common::KEYCODE_F15) + return 0x70 + scummKeyCode - Common::KEYCODE_F1; + if (scummKeyCode >= Common::KEYCODE_KP0 && scummKeyCode <= Common::KEYCODE_KP9) + return 0x60 + scummKeyCode - Common::KEYCODE_KP0; - switch (scumm_key) { + switch (scummKeyCode) { case Common::KEYCODE_BACKSPACE: return 0x8; case Common::KEYCODE_TAB: diff --git a/engines/zvision/utility/win_keys.h b/engines/zvision/utility/win_keys.h index a79a03a07b..53d76c4d5f 100644 --- a/engines/zvision/utility/win_keys.h +++ b/engines/zvision/utility/win_keys.h @@ -20,13 +20,13 @@ * */ -#ifndef ZVISION_WINKEY_H -#define ZVISION_WINKEY_H +#ifndef ZVISION_WIN_KEYS_H +#define ZVISION_WIN_KEYS_H #include "common/keyboard.h" namespace ZVision { -uint8 VKkey(Common::KeyCode scumm_key); +uint8 VKkey(Common::KeyCode scummKeyCode); } // End of namespace ZVision #endif diff --git a/engines/zvision/zvision.cpp b/engines/zvision/zvision.cpp index 84856429e9..62342f02b9 100644 --- a/engines/zvision/zvision.cpp +++ b/engines/zvision/zvision.cpp @@ -95,7 +95,7 @@ ZVision::ZVision(OSystem *syst, const ZVisionGameDescription *gameDesc) _stringManager(nullptr), _cursorManager(nullptr), _midiManager(nullptr), - _aud_id(0), + _audioId(0), _rendDelay(2), _kbdVelocity(0), _mouseVelocity(0) { @@ -147,7 +147,7 @@ void ZVision::saveSettings() { void ZVision::initialize() { const Common::FSNode gameDataDir(ConfMan.get("path")); - _searchManager = new sManager(ConfMan.get("path"), 6); + _searchManager = new SearchManager(ConfMan.get("path"), 6); _searchManager->addDir("FONTS"); _searchManager->addDir("addon"); @@ -182,13 +182,13 @@ void ZVision::initialize() { _saveManager = new SaveManager(this); _stringManager = new StringManager(this); _cursorManager = new CursorManager(this, &_pixelFormat); - _textRenderer = new textRenderer(this); - _midiManager = new midiManager(); + _textRenderer = new TextRenderer(this); + _midiManager = new MidiManager(); if (_gameDescription->gameId == GID_GRANDINQUISITOR) - _menu = new menuZgi(this); + _menu = new MenuZGI(this); else - _menu = new menuNem(this); + _menu = new MenuNemesis(this); // Initialize the managers _cursorManager->initialize(); @@ -290,8 +290,8 @@ void ZVision::delayedMessage(const Common::String &str, uint16 milsecs) { _renderManager->renderBackbufferToScreen(); _clock.stop(); - uint32 stop_time = _system->getMillis() + milsecs; - while (_system->getMillis() < stop_time) { + uint32 stopTime = _system->getMillis() + milsecs; + while (_system->getMillis() < stopTime) { Common::Event evnt; while (_eventMan->pollEvent(evnt)) { if (evnt.type == Common::EVENT_KEYDOWN && @@ -353,38 +353,38 @@ void ZVision::updateRotation() { if (_velocity) { RenderTable::RenderState renderState = _renderManager->getRenderTable()->getRenderState(); if (renderState == RenderTable::PANORAMA) { - int16 st_pos = _scriptManager->getStateValue(StateKey_ViewPos); + int16 startPosition = _scriptManager->getStateValue(StateKey_ViewPos); - int16 new_pos = st_pos + (_renderManager->getRenderTable()->getPanoramaReverse() ? -_velocity : _velocity); + int16 newPosition = startPosition + (_renderManager->getRenderTable()->getPanoramaReverse() ? -_velocity : _velocity); - int16 zero_point = _renderManager->getRenderTable()->getPanoramaZeroPoint(); - if (st_pos >= zero_point && new_pos < zero_point) + int16 zeroPoint = _renderManager->getRenderTable()->getPanoramaZeroPoint(); + if (startPosition >= zeroPoint && newPosition < zeroPoint) _scriptManager->setStateValue(StateKey_Rounds, _scriptManager->getStateValue(StateKey_Rounds) - 1); - if (st_pos <= zero_point && new_pos > zero_point) + if (startPosition <= zeroPoint && newPosition > zeroPoint) _scriptManager->setStateValue(StateKey_Rounds, _scriptManager->getStateValue(StateKey_Rounds) + 1); - int16 scr_width = _renderManager->getBkgSize().x; - if (scr_width) - new_pos %= scr_width; + int16 screenWidth = _renderManager->getBkgSize().x; + if (screenWidth) + newPosition %= screenWidth; - if (new_pos < 0) - new_pos += scr_width; + if (newPosition < 0) + newPosition += screenWidth; - _renderManager->setBackgroundPosition(new_pos); + _renderManager->setBackgroundPosition(newPosition); } else if (renderState == RenderTable::TILT) { - int16 st_pos = _scriptManager->getStateValue(StateKey_ViewPos); + int16 startPosition = _scriptManager->getStateValue(StateKey_ViewPos); - int16 new_pos = st_pos + _velocity; + int16 newPosition = startPosition + _velocity; - int16 scr_height = _renderManager->getBkgSize().y; - int16 tilt_gap = _renderManager->getRenderTable()->getTiltGap(); + int16 screenHeight = _renderManager->getBkgSize().y; + int16 tiltGap = _renderManager->getRenderTable()->getTiltGap(); - if (new_pos >= (scr_height - tilt_gap)) - new_pos = scr_height - tilt_gap; - if (new_pos <= tilt_gap) - new_pos = tilt_gap; + if (newPosition >= (screenHeight - tiltGap)) + newPosition = screenHeight - tiltGap; + if (newPosition <= tiltGap) + newPosition = tiltGap; - _renderManager->setBackgroundPosition(new_pos); + _renderManager->setBackgroundPosition(newPosition); } } } @@ -392,35 +392,35 @@ void ZVision::updateRotation() { void ZVision::checkBorders() { RenderTable::RenderState renderState = _renderManager->getRenderTable()->getRenderState(); if (renderState == RenderTable::PANORAMA) { - int16 st_pos = _scriptManager->getStateValue(StateKey_ViewPos); + int16 startPosition = _scriptManager->getStateValue(StateKey_ViewPos); - int16 new_pos = st_pos; + int16 newPosition = startPosition; - int16 scr_width = _renderManager->getBkgSize().x; + int16 screenWidth = _renderManager->getBkgSize().x; - if (scr_width) - new_pos %= scr_width; + if (screenWidth) + newPosition %= screenWidth; - if (new_pos < 0) - new_pos += scr_width; + if (newPosition < 0) + newPosition += screenWidth; - if (st_pos != new_pos) - _renderManager->setBackgroundPosition(new_pos); + if (startPosition != newPosition) + _renderManager->setBackgroundPosition(newPosition); } else if (renderState == RenderTable::TILT) { - int16 st_pos = _scriptManager->getStateValue(StateKey_ViewPos); + int16 startPosition = _scriptManager->getStateValue(StateKey_ViewPos); - int16 new_pos = st_pos; + int16 newPosition = startPosition; - int16 scr_height = _renderManager->getBkgSize().y; - int16 tilt_gap = _renderManager->getRenderTable()->getTiltGap(); + int16 screenHeight = _renderManager->getBkgSize().y; + int16 tiltGap = _renderManager->getRenderTable()->getTiltGap(); - if (new_pos >= (scr_height - tilt_gap)) - new_pos = scr_height - tilt_gap; - if (new_pos <= tilt_gap) - new_pos = tilt_gap; + if (newPosition >= (screenHeight - tiltGap)) + newPosition = screenHeight - tiltGap; + if (newPosition <= tiltGap) + newPosition = tiltGap; - if (st_pos != new_pos) - _renderManager->setBackgroundPosition(new_pos); + if (startPosition != newPosition) + _renderManager->setBackgroundPosition(newPosition); } } diff --git a/engines/zvision/zvision.h b/engines/zvision/zvision.h index 8cf9dbf107..8b14cfa178 100644 --- a/engines/zvision/zvision.h +++ b/engines/zvision/zvision.h @@ -52,10 +52,10 @@ class CursorManager; class StringManager; class SaveManager; class RlfAnimation; -class menuHandler; -class textRenderer; +class MenuHandler; +class TextRenderer; class Subtitle; -class midiManager; +class MidiManager; class ZVision : public Engine { public: @@ -104,16 +104,16 @@ private: CursorManager *_cursorManager; SaveManager *_saveManager; StringManager *_stringManager; - menuHandler *_menu; - sManager *_searchManager; - textRenderer *_textRenderer; - midiManager *_midiManager; + MenuHandler *_menu; + SearchManager *_searchManager; + TextRenderer *_textRenderer; + MidiManager *_midiManager; // Clock Clock _clock; // Audio ID - int _aud_id; + int _audioId; // To prevent allocation every time we process events Common::Event _event; @@ -148,13 +148,13 @@ public: StringManager *getStringManager() const { return _stringManager; } - sManager *getSearchManager() const { + SearchManager *getSearchManager() const { return _searchManager; } - textRenderer *getTextRenderer() const { + TextRenderer *getTextRenderer() const { return _textRenderer; } - midiManager *getMidiManager() const { + MidiManager *getMidiManager() const { return _midiManager; } Common::RandomSource *getRandomSource() const { |