diff options
author | Bendegúz Nagy | 2016-06-19 18:05:19 +0200 |
---|---|---|
committer | Bendegúz Nagy | 2016-08-26 23:02:22 +0200 |
commit | e9a4e818f21af256eea54bf08993425c6933e998 (patch) | |
tree | e8d35042b9d2c9b5b0f6826234b3c12876abbe54 | |
parent | e64e352815cb80d4aa0b709b86ad30abb6b6ef8c (diff) | |
download | scummvm-rg350-e9a4e818f21af256eea54bf08993425c6933e998.tar.gz scummvm-rg350-e9a4e818f21af256eea54bf08993425c6933e998.tar.bz2 scummvm-rg350-e9a4e818f21af256eea54bf08993425c6933e998.zip |
DM: Add F0355_INVENTORY_Toggle_CPSE
-rw-r--r-- | engines/dm/gfx.cpp | 2 | ||||
-rw-r--r-- | engines/dm/gfx.h | 5 | ||||
-rw-r--r-- | engines/dm/inventory.cpp | 79 | ||||
-rw-r--r-- | engines/dm/inventory.h | 3 |
4 files changed, 85 insertions, 4 deletions
diff --git a/engines/dm/gfx.cpp b/engines/dm/gfx.cpp index ea05f44b76..223257c220 100644 --- a/engines/dm/gfx.cpp +++ b/engines/dm/gfx.cpp @@ -1501,7 +1501,7 @@ byte* DisplayMan::getBitmap(uint16 index) { return _bitmaps[index]; } -void DisplayMan::clearScreenBox(Color color, Box &box) { +void DisplayMan::clearScreenBox(Color color, Box &box, Viewport &viewport) { uint16 width = box._x2 - box._x1; for (int y = box._y1; y < box._y2; ++y) memset(_vgaBuffer + y * _screenWidth + box._x1, color, sizeof(byte) * width); diff --git a/engines/dm/gfx.h b/engines/dm/gfx.h index 99d3f8f417..65322918cd 100644 --- a/engines/dm/gfx.h +++ b/engines/dm/gfx.h @@ -27,7 +27,8 @@ enum GraphicIndice { kObjectIcons_096_TO_127 = 45, // @ C045_GRAPHIC_OBJECT_ICONS_096_TO_127 kObjectIcons_128_TO_159 = 46, // @ C046_GRAPHIC_OBJECT_ICONS_128_TO_159 kObjectIcons_160_TO_191 = 47, // @ C047_GRAPHIC_OBJECT_ICONS_160_TO_191 - kObjectIcons_192_TO_223 = 48 // @ C048_GRAPHIC_OBJECT_ICONS_192_TO_223 + kObjectIcons_192_TO_223 = 48, // @ C048_GRAPHIC_OBJECT_ICONS_192_TO_223 + kInventoryGraphicIndice = 17 // @ C017_GRAPHIC_INVENTORY }; extern uint16 gPalSwoosh[16]; @@ -295,7 +296,7 @@ public: void clearBitmap(byte *bitmap, uint16 width, uint16 height, Color color); void clearScreen(Color color); - void clearScreenBox(Color color, Box &box); // @ D24_FillScreenBox + void clearScreenBox(Color color, Box &box, Viewport &viewport = gDefultViewPort); // @ D24_FillScreenBox void drawDungeon(direction dir, int16 posX, int16 posY); // @ F0128_DUNGEONVIEW_Draw_CPSF void updateScreen(); byte* getBitmap(uint16 index); diff --git a/engines/dm/inventory.cpp b/engines/dm/inventory.cpp index 378d79839b..70359334b0 100644 --- a/engines/dm/inventory.cpp +++ b/engines/dm/inventory.cpp @@ -1,11 +1,88 @@ #include "inventory.h" +#include "dungeonman.h" +#include "eventman.h" +#include "menus.h" namespace DM { -Viewport gViewportFloppyZzzCross = {174, 2}; // @ G0041_s_Graphic562_Box_ViewportFloppyZzzCross +Box gBoxFloppyZzzCross = Box(174, 218, 2, 12); // @ G0041_s_Graphic562_Box_ViewportFloppyZzzCross InventoryMan::InventoryMan(DMEngine *vm): _vm(vm) {} +void InventoryMan::toggleInventory(ChampionIndex championIndex) { + ChampionMan &cm = *_vm->_championMan; + EventManager &em = *_vm->_eventMan; + DisplayMan &dm = *_vm->_displayMan; + + if ((championIndex == kChmpionCloseInventory) && !cm._champions[championIndex]._currHealth) + return; + if (_vm->_pressingEye || _vm->_pressingMouth) + return; + _vm->_stopWaitingForPlayerInput = true; + int16 invChampOrdinal = _inventoryChampionOrdinal; // copy, as the original will be edited + if (indexToOrdinal(championIndex) == invChampOrdinal) { + championIndex = kChmpionCloseInventory; + } + + Champion *champion; + if (invChampOrdinal) { + _inventoryChampionOrdinal = indexToOrdinal(kChampionNone); + warning("MISSING CODE: F0334_INVENTORY_CloseChest"); + champion = &cm._champions[ordinalToIndex(kChampionNone)]; + if (champion->_currHealth && !cm._candidateChampionOrdinal) { + champion->setAttributeFlag(kChampionAttributeStatusBox, true); + warning("MISSING CODE: F0292_CHAMPION_DrawState"); + } + if (cm._partyIsSleeping) { + return; + } + if (championIndex == kChmpionCloseInventory) { + em._refreshMousePointerInMainLoop = true; + _vm->_menuMan->drawMovementArrows(); + em._secondaryMouseInput = gSecondaryMouseInput_Movement; + warning("MISSING CODE: set G0444_ps_SecondaryKeyboardInput"); + warning("MISSING CODE: F0357_COMMAND_DiscardAllInput"); + return; + } + } + + dm._useByteBoxCoordinates = false; + _inventoryChampionOrdinal = indexToOrdinal(championIndex); + if (!invChampOrdinal) { + warning("MISSING CODE: F0136_VIDEO_ShadeScreenBox"); + } + + champion = &cm._champions[championIndex]; + int16 w = dm.getWidth(kInventoryGraphicIndice); + int16 h = dm.getHeight(kInventoryGraphicIndice); + dm.blitToScreen(dm.getBitmap(kInventoryGraphicIndice), w, 0, 0, 0, w, 0, h, kColorNoTransparency, gDungeonViewport); + if (cm._candidateChampionOrdinal) { + dm.clearScreenBox(kColorDarkestGray, gBoxFloppyZzzCross, gDungeonViewport); + } else { + static Box gBoxFloppy = Box(174, 182, 2, 12); // @ K0300_s_Box_ViewportFloppy + dm.clearScreenBox(kColorDarkestGray, gBoxFloppy, gDungeonViewport); + } + warning("MISSING CODE: F0052_TEXT_PrintToViewport -> HEALTH"); + warning("MISSING CODE: F0052_TEXT_PrintToViewport -> STAMINA"); + warning("MISSING CODE: F0052_TEXT_PrintToViewport -> MANA"); + + warning("MISSING CODE: F0291_CHAMPION_DrawSlot in LOOOOOOOOOOOOP"); + + champion->setAttributeFlag(kChampionAttributeViewport, true); + champion->setAttributeFlag(kChampionAttributeStatusBox, true); + champion->setAttributeFlag(kChampionAttributePanel, true); + champion->setAttributeFlag(kChampionAttributeLoad, true); + champion->setAttributeFlag(kChampionAttributeStatistics, true); + champion->setAttributeFlag(kChampionAttributeNameTitle, true); + + warning("MISSING CODE: F0292_CHAMPION_DrawState"); + em._mousePointerBitmapUpdated = true; + em._secondaryMouseInput = gSecondaryMouseInput_ChampionInventory; + warning("MISSING CODE: set G0444_ps_SecondaryKeyboardInput"); + warning("MISSING CODE: F0357_COMMAND_DiscardAllInput"); +} + + }
\ No newline at end of file diff --git a/engines/dm/inventory.h b/engines/dm/inventory.h index 06488fe4d4..6579708293 100644 --- a/engines/dm/inventory.h +++ b/engines/dm/inventory.h @@ -1,5 +1,6 @@ #include "dm.h" #include "gfx.h" +#include "champion.h" @@ -8,7 +9,9 @@ namespace DM { class InventoryMan { DMEngine *_vm; public: + int16 _inventoryChampionOrdinal; // @ G0423_i_InventoryChampionOrdinal InventoryMan(DMEngine *vm); + void toggleInventory(ChampionIndex championIndex); // @ F0355_INVENTORY_Toggle_CPSE }; }
\ No newline at end of file |