diff options
author | Strangerke | 2016-08-22 07:52:57 +0200 |
---|---|---|
committer | Bendegúz Nagy | 2016-08-26 23:02:22 +0200 |
commit | f9323fe9fae6a45c0a4359775ba0383924a75c47 (patch) | |
tree | 6087d6abe2f9ee22dcc6e6084b8aa7f60269e986 | |
parent | 236a27e4cc902ab50fa850535f36993056ba0fbc (diff) | |
download | scummvm-rg350-f9323fe9fae6a45c0a4359775ba0383924a75c47.tar.gz scummvm-rg350-f9323fe9fae6a45c0a4359775ba0383924a75c47.tar.bz2 scummvm-rg350-f9323fe9fae6a45c0a4359775ba0383924a75c47.zip |
DM: Get rid of some globals in inventory
-rw-r--r-- | engines/dm/champion.cpp | 2 | ||||
-rw-r--r-- | engines/dm/dm.cpp | 2 | ||||
-rw-r--r-- | engines/dm/inventory.cpp | 55 | ||||
-rw-r--r-- | engines/dm/inventory.h | 7 |
4 files changed, 35 insertions, 31 deletions
diff --git a/engines/dm/champion.cpp b/engines/dm/champion.cpp index 51f89f4d32..0a33c74af2 100644 --- a/engines/dm/champion.cpp +++ b/engines/dm/champion.cpp @@ -2354,7 +2354,7 @@ void ChampionMan::f281_renameChampion(Champion* champ) { displayBox._x2 = displayBox._x1 + 167; _vm->_displayMan->f135_fillBoxBitmap(_vm->_displayMan->_g296_bitmapViewport, displayBox, k12_ColorDarkestGray, k112_byteWidthViewport, k136_heightViewport); - _vm->_displayMan->f20_blitToViewport(_vm->_displayMan->f489_getNativeBitmapOrGraphic(k27_PanelRenameChampionIndice), g32_BoxPanel, k72_byteWidth, k4_ColorCyan, 73); + _vm->_displayMan->f20_blitToViewport(_vm->_displayMan->f489_getNativeBitmapOrGraphic(k27_PanelRenameChampionIndice), _vm->_inventoryMan->g32_BoxPanel, k72_byteWidth, k4_ColorCyan, 73); _vm->_textMan->f52_printToViewport(177, 58, k13_ColorLightestGray, "_______"); _vm->_textMan->f52_printToViewport(105, 76, k13_ColorLightestGray, "___________________"); _vm->_eventMan->f78_showMouse(); diff --git a/engines/dm/dm.cpp b/engines/dm/dm.cpp index ac85b9d0c4..075112b149 100644 --- a/engines/dm/dm.cpp +++ b/engines/dm/dm.cpp @@ -681,7 +681,7 @@ void DMEngine::f444_endGame(bool doNotDrawCreditsOnly) { continue; char displStr[20]; - strcpy(displStr, G0428_apc_SkillLevelNames[skillLevel - 2]); + strcpy(displStr, _inventoryMan->G0428_apc_SkillLevelNames[skillLevel - 2]); strcat(displStr, " "); strcat(displStr, _championMan->_baseSkillName[idx]); _textMan->f443_endgamePrintString(105, textPosY = textPosY + 8, k13_ColorLightestGray, displStr); diff --git a/engines/dm/inventory.cpp b/engines/dm/inventory.cpp index 3800b95f7e..ed1a014c82 100644 --- a/engines/dm/inventory.cpp +++ b/engines/dm/inventory.cpp @@ -42,32 +42,30 @@ namespace DM { -Box g41_BoxFloppyZzzCross = Box(174, 218, 2, 12); // @ G0041_s_Graphic562_Box_ViewportFloppyZzzCross -Box g32_BoxPanel = Box(80, 223, 52, 124); // @ G0032_s_Graphic562_Box_Panel -Box g35_BoxFood = Box(112, 159, 60, 68); // @ G0035_s_Graphic562_Box_Food -Box g36_BoxWater = Box(112, 159, 83, 91); // @ G0036_s_Graphic562_Box_Water -Box g37_BoxPoisoned = Box(112, 207, 105, 119); // @ G0037_s_Graphic562_Box_Poisoned - -const char* G0428_apc_SkillLevelNames[15]; - void InventoryMan::initConstants() { - { - static const char* G0428_apc_SkillLevelNames_EN_ANY[15] = {"NEOPHYTE", "NOVICE", "APPRENTICE", "JOURNEYMAN", "CRAFTSMAN", - "ARTISAN", "ADEPT", "EXPERT", "` MASTER", "a MASTER","b MASTER", "c MASTER", "d MASTER", "e MASTER", "ARCHMASTER"}; - static const char* G0428_apc_SkillLevelNames_DE_DEU[15] = {"ANFAENGER", "NEULING", "LEHRLING", "ARBEITER", "GESELLE", "HANDWERKR", "FACHMANN", - "EXPERTE", "` MEISTER", "a MEISTER", "b MEISTER", "c MEISTER", "d MEISTER", "e MEISTER", "ERZMEISTR"}; - static const char* G0428_apc_SkillLevelNames_FR_FRA[15] = {"NEOPHYTE", "NOVICE", "APPRENTI", "COMPAGNON", "ARTISAN", "PATRON", - "ADEPTE", "EXPERT", "MAITRE '", "MAITRE a", "MAITRE b", "MAITRE c", "MAITRE d", "MAITRE e", "SUR-MAITRE"}; - const char **g428_byLanguage; - switch (_vm->getGameLanguage()) { // localized - default: - case Common::EN_ANY: g428_byLanguage = G0428_apc_SkillLevelNames_EN_ANY; break; - case Common::DE_DEU: g428_byLanguage = G0428_apc_SkillLevelNames_DE_DEU; break; - case Common::FR_FRA: g428_byLanguage = G0428_apc_SkillLevelNames_FR_FRA; break; - } - for (int i = 0; i < 15; ++i) - G0428_apc_SkillLevelNames[i] = g428_byLanguage[i]; + static const char* G0428_apc_SkillLevelNames_EN_ANY[15] = {"NEOPHYTE", "NOVICE", "APPRENTICE", "JOURNEYMAN", "CRAFTSMAN", + "ARTISAN", "ADEPT", "EXPERT", "` MASTER", "a MASTER","b MASTER", "c MASTER", "d MASTER", "e MASTER", "ARCHMASTER"}; + static const char* G0428_apc_SkillLevelNames_DE_DEU[15] = {"ANFAENGER", "NEULING", "LEHRLING", "ARBEITER", "GESELLE", "HANDWERKR", "FACHMANN", + "EXPERTE", "` MEISTER", "a MEISTER", "b MEISTER", "c MEISTER", "d MEISTER", "e MEISTER", "ERZMEISTR"}; + static const char* G0428_apc_SkillLevelNames_FR_FRA[15] = {"NEOPHYTE", "NOVICE", "APPRENTI", "COMPAGNON", "ARTISAN", "PATRON", + "ADEPTE", "EXPERT", "MAITRE '", "MAITRE a", "MAITRE b", "MAITRE c", "MAITRE d", "MAITRE e", "SUR-MAITRE"}; + const char **g428_byLanguage; + switch (_vm->getGameLanguage()) { // localized + default: + case Common::EN_ANY: + g428_byLanguage = G0428_apc_SkillLevelNames_EN_ANY; + break; + case Common::DE_DEU: + g428_byLanguage = G0428_apc_SkillLevelNames_DE_DEU; + break; + case Common::FR_FRA: + g428_byLanguage = G0428_apc_SkillLevelNames_FR_FRA; + break; } + for (int i = 0; i < 15; ++i) + G0428_apc_SkillLevelNames[i] = g428_byLanguage[i]; + + g32_BoxPanel = Box(80, 223, 52, 124); // @ G0032_s_Graphic562_Box_Panel } InventoryMan::InventoryMan(DMEngine *vm) : _vm(vm) { @@ -79,10 +77,15 @@ InventoryMan::InventoryMan(DMEngine *vm) : _vm(vm) { _g421_objDescTextXpos = 0; _g422_objDescTextYpos = 0; + for (int i = 0; i < 15; i++) + G0428_apc_SkillLevelNames[i] = nullptr; + initConstants(); } void InventoryMan::f355_toggleInventory(ChampionIndex championIndex) { + static Box g41_BoxFloppyZzzCross(174, 218, 2, 12); // @ G0041_s_Graphic562_Box_ViewportFloppyZzzCross + if (championIndex == kM1_ChampionNone) { delete _vm->_saveThumbnail; _vm->_saveThumbnail = nullptr; @@ -210,6 +213,10 @@ void InventoryMan::f344_drawPanelFoodOrWaterBar(int16 amount, int16 y, Color col } void InventoryMan::f345_drawPanelFoodWaterPoisoned() { + static Box g35_BoxFood(112, 159, 60, 68); // @ G0035_s_Graphic562_Box_Food + static Box g36_BoxWater(112, 159, 83, 91); // @ G0036_s_Graphic562_Box_Water + static Box g37_BoxPoisoned(112, 207, 105, 119); // @ G0037_s_Graphic562_Box_Poisoned + Champion &champ = _vm->_championMan->_gK71_champions[_g432_inventoryChampionOrdinal]; f334_closeChest(); DisplayMan &dispMan = *_vm->_displayMan; diff --git a/engines/dm/inventory.h b/engines/dm/inventory.h index d16f22d6fa..856f7d02f8 100644 --- a/engines/dm/inventory.h +++ b/engines/dm/inventory.h @@ -37,9 +37,6 @@ namespace DM { #define k69_ChampionStatusBoxSpacing 69 // @ C69_CHAMPION_STATUS_BOX_SPACING #define k38_SlotBoxChestFirstSlot 38 // @ C38_SLOT_BOX_CHEST_FIRST_SLOT - -extern Box g32_BoxPanel; // @ G0032_s_Graphic562_Box_Panel - enum PanelContent { k0_PanelContentFoodWaterPoisoned = 0, // @ C00_PANEL_FOOD_WATER_POISONED k2_PanelContentScroll = 2, // @ C02_PANEL_SCROLL @@ -47,8 +44,6 @@ enum PanelContent { k5_PanelContentResurrectReincarnate = 5 // @ C05_PANEL_RESURRECT_REINCARNATE }; -extern const char* G0428_apc_SkillLevelNames[15]; // @ G0428_apc_SkillLevelNames - class InventoryMan { DMEngine *_vm; @@ -63,6 +58,8 @@ public: Thing _g426_openChest; // @ G0426_T_OpenChest int16 _g421_objDescTextXpos; // @ G0421_i_ObjectDescriptionTextX int16 _g422_objDescTextYpos; // @ G0422_i_ObjectDescriptionTextY + Box g32_BoxPanel; + const char* G0428_apc_SkillLevelNames[15]; void f355_toggleInventory(ChampionIndex championIndex); // @ F0355_INVENTORY_Toggle_CPSE void f354_drawStatusBoxPortrait(ChampionIndex championIndex); // @ F0354_INVENTORY_DrawStatusBoxPortrait |