aboutsummaryrefslogtreecommitdiff
path: root/engines/dm
diff options
context:
space:
mode:
authorBendegúz Nagy2016-07-29 22:27:43 +0200
committerBendegúz Nagy2016-08-26 23:02:22 +0200
commit2b2a0283322ba1d3852feb59b4cf2a4bcf5ed891 (patch)
treed8b3300b945df64d0cbc3d409c587cd7856f054c /engines/dm
parentec28573a3b8dac8728f89cf7d9f221f901812388 (diff)
downloadscummvm-rg350-2b2a0283322ba1d3852feb59b4cf2a4bcf5ed891.tar.gz
scummvm-rg350-2b2a0283322ba1d3852feb59b4cf2a4bcf5ed891.tar.bz2
scummvm-rg350-2b2a0283322ba1d3852feb59b4cf2a4bcf5ed891.zip
DM: Add f444_endGame and checks for Common::EVENT_QUIT
Diffstat (limited to 'engines/dm')
-rw-r--r--engines/dm/TODOs/todo.txt5
-rw-r--r--engines/dm/champion.cpp2
-rw-r--r--engines/dm/dm.cpp175
-rw-r--r--engines/dm/dm.h3
-rw-r--r--engines/dm/eventman.cpp31
-rw-r--r--engines/dm/eventman.h3
-rw-r--r--engines/dm/gfx.cpp17
-rw-r--r--engines/dm/gfx.h46
-rw-r--r--engines/dm/inventory.cpp39
-rw-r--r--engines/dm/inventory.h2
-rw-r--r--engines/dm/loadsave.cpp2
-rw-r--r--engines/dm/text.cpp14
-rw-r--r--engines/dm/text.h1
-rw-r--r--engines/dm/timeline.cpp2
14 files changed, 297 insertions, 45 deletions
diff --git a/engines/dm/TODOs/todo.txt b/engines/dm/TODOs/todo.txt
index 46928ac0f0..8c05efa73a 100644
--- a/engines/dm/TODOs/todo.txt
+++ b/engines/dm/TODOs/todo.txt
@@ -31,6 +31,9 @@ Todo:
I forgot to add a bunch of warning for show/hide mouse pointer and other mouse functions
Finish stuff:
+ F0444_STARTEND_Endgame
+ Make missing code warnings to STUB methods
+ Add quit resuest from scummvm
f380_processCommandQueue
Missing main loop methods
Save file f433_processCommand140_saveGame fails silently
@@ -40,7 +43,7 @@ Finish stuff:
G0335_ui_SelectedDialogChoice
Add dialogs
Add failcheck to saveing and loading
- F0444_STARTEND_Endgame
+
Refactoring
diff --git a/engines/dm/champion.cpp b/engines/dm/champion.cpp
index 9dcb199358..a2ff4393cf 100644
--- a/engines/dm/champion.cpp
+++ b/engines/dm/champion.cpp
@@ -2326,6 +2326,8 @@ void ChampionMan::f281_renameChampion(Champion* champ) {
Common::EventType eventType;
{
eventType = _vm->_eventMan->processInput(&event, &event);
+ if (_vm->_engineShouldQuit)
+ return;
_vm->_displayMan->updateScreen();
//_vm->f22_delay(1);
}
diff --git a/engines/dm/dm.cpp b/engines/dm/dm.cpp
index 33cfe2fbf3..852145056a 100644
--- a/engines/dm/dm.cpp
+++ b/engines/dm/dm.cpp
@@ -150,6 +150,7 @@ DMEngine::DMEngine(OSystem *syst) : Engine(syst), _console(nullptr) {
_projexpl = nullptr;
_displayMan = nullptr;
+ _engineShouldQuit = false;
_g528_saveFormat = 0;
_g527_platform = 0;
_g526_dungeonId = 0;
@@ -230,10 +231,11 @@ void DMEngine::f463_initializeGame() {
_textMan->f54_textInitialize();
_objectMan->loadObjectNames();
_eventMan->initMouse();
- f441_processEntrance();
- while (f435_loadgame(1) != k1_LoadgameSuccess) {
+ do {
f441_processEntrance();
- }
+ if (_engineShouldQuit)
+ return;
+ } while (f435_loadgame(1) != k1_LoadgameSuccess);
//F0396_MENUS_LoadSpellAreaLinesBitmap() is not needed, every bitmap has been loaded
// There was some memory wizardy for the Amiga platform, I skipped that part
@@ -327,7 +329,9 @@ Common::Error DMEngine::run() {
f463_initializeGame();
while (true) {
f2_gameloop();
- warning(false, "TODO: F0444_STARTEND_Endgame(G0303_B_PartyDead);");
+ if (_engineShouldQuit)
+ return Common::kNoError;
+ f444_endGame(_championMan->_g303_partyDead);
}
return Common::kNoError;
@@ -343,6 +347,8 @@ void DMEngine::f2_gameloop() {
_g318_waitForInputMaxVerticalBlankCount = 10;
while (true) {
+ if (_engineShouldQuit)
+ return;
if (_g327_newPartyMapIndex != kM1_mapIndexNone) {
T0002002:
f3_processNewPartyMap(_g327_newPartyMapIndex);
@@ -416,8 +422,10 @@ T0002002:
}
_eventMan->f380_processCommandQueue();
+ if (_engineShouldQuit)
+ return;
_displayMan->updateScreen();
- // if (!_vm->_g321_stopWaitingForPlayerInput) {
+ // if (!_g321_stopWaitingForPlayerInput) {
// F0363_COMMAND_HighlightBoxDisable();
// }
@@ -477,6 +485,8 @@ void DMEngine::f441_processEntrance() {
_g298_newGame = k99_modeWaitingOnEntrance;
do {
_eventMan->processInput();
+ if (_engineShouldQuit)
+ return;
_eventMan->f380_processCommandQueue();
_displayMan->updateScreen();
} while (_g298_newGame == k99_modeWaitingOnEntrance);
@@ -493,6 +503,161 @@ void DMEngine::f441_processEntrance() {
_g562_entranceDoorAnimSteps[i] = nullptr;
}
+void DMEngine::f444_endGame(bool doNotDrawCreditsOnly) {
+ // TODO: localization
+ static Box G0013_s_Graphic562_Box_Endgame_Restart_Outer = {103, 217, 145, 159};
+ static Box G0014_s_Graphic562_Box_Endgame_Restart_Inner = {105, 215, 147, 157};
+ static Box G0012_s_Graphic562_Box_Endgame_TheEnd = {120, 199, 95, 108};
+ static Box G0015_s_Graphic562_Box_Endgame_ChampionMirror = {11, 74, 7, 49};
+ static Box G0016_s_Graphic562_Box_Endgame_ChampionPortrait = {27, 58, 13, 41};
+ int16 L1409_i_Multiple;
+#define AL1409_i_Color L1409_i_Multiple
+#define AL1409_i_ChampionIndex L1409_i_Multiple
+#define AL1409_i_VerticalBlankCount L1409_i_Multiple
+ int16 L1410_i_Multiple;
+#define AL1410_i_Counter L1410_i_Multiple
+#define AL1410_i_Y L1410_i_Multiple
+ int16 L1411_i_Multiple;
+#define AL1411_i_X L1411_i_Multiple
+#define AL1411_i_SkillIndex L1411_i_Multiple
+ int16 L1412_i_SkillLevel;
+ char L1415_c_ChampionTitleFirstCharacter;
+ Champion* L1416_ps_Champion;
+ uint16 L1419_aui_Palette[16];
+ uint16 L1420_aui_Palette_TopAndBottomScreen[16];
+ uint16 L1421_aui_Palette_DarkBlue[16];
+ char L1422_ac_String[20];
+ // Strangerke: Not so sure it's useless.
+ bool L1423_B_WaitBeforeDrawingRestart; /* BUG0_00 Useless code */
+ L1423_B_WaitBeforeDrawingRestart = true; /* BUG0_00 Useless code */
+
+ _eventMan->f67_setMousePointerToNormal(k0_pointerArrow);
+ _eventMan->f78_showMouse();
+ _eventMan->_g441_primaryMouseInput = nullptr;
+ _eventMan->_g442_secondaryMouseInput = nullptr;
+ _eventMan->_g443_primaryKeyboardInput = nullptr;
+ _eventMan->_g444_secondaryKeyboardInput = nullptr;
+ if (doNotDrawCreditsOnly && !_g302_gameWon) {
+ f064_SOUND_RequestPlay_CPSD(k06_soundSCREAM, _dungeonMan->_g306_partyMapX, _dungeonMan->_g307_partyMapY, k0_soundModePlayImmediately);
+ f22_delay(240);
+ }
+
+ if (_displayMan->_g322_paletteSwitchingEnabled) {
+ for (uint16 i = 0; i < 16; ++i)
+ L1420_aui_Palette_TopAndBottomScreen[i] = _displayMan->_g347_paletteTopAndBottomScreen[i];
+ for (AL1410_i_Counter = 0; AL1410_i_Counter <= 7; AL1410_i_Counter++) {
+ f22_delay(1);
+ for (AL1409_i_Color = 0; AL1409_i_Color < 16; AL1409_i_Color++) {
+ _displayMan->_g346_paletteMiddleScreen[AL1409_i_Color] = _displayMan->f431_getDarkenedColor(_displayMan->_g346_paletteMiddleScreen[AL1409_i_Color]);
+ _displayMan->_g347_paletteTopAndBottomScreen[AL1409_i_Color] = _displayMan->f431_getDarkenedColor(_displayMan->_g347_paletteTopAndBottomScreen[AL1409_i_Color]);
+ }
+ }
+ _displayMan->_g322_paletteSwitchingEnabled = false;
+ f22_delay(1);
+ for (uint16 i = 0; i < 16; ++i)
+ _displayMan->_g347_paletteTopAndBottomScreen[i] = L1420_aui_Palette_TopAndBottomScreen[i];
+ } else {
+ warning(false, "MISSING CODE: F0436_STARTEND_FadeToPalette(G0345_aui_BlankBuffer)");
+ }
+ if (doNotDrawCreditsOnly) {
+ if (_g302_gameWon) {
+ // Strangerke: Related to portraits. Game data could be missing for earlier versions of the game.
+ _displayMan->fillScreen(k12_ColorDarkestGray);
+ for (AL1409_i_ChampionIndex = k0_ChampionFirst; AL1409_i_ChampionIndex < _championMan->_g305_partyChampionCount; AL1409_i_ChampionIndex++) {
+ AL1410_i_Y = AL1409_i_ChampionIndex * 48;
+ L1416_ps_Champion = &_championMan->_gK71_champions[AL1409_i_ChampionIndex];
+ _displayMan->f21_blitToScreen(_displayMan->f489_getNativeBitmapOrGraphic(k208_wallOrn_43_champMirror), &G0015_s_Graphic562_Box_Endgame_ChampionMirror, k32_byteWidth, k10_ColorFlesh, 43);
+ _displayMan->f21_blitToScreen(L1416_ps_Champion->_portrait, &G0016_s_Graphic562_Box_Endgame_ChampionPortrait, k16_byteWidth, k1_ColorDarkGary, 29);
+ _textMan->f443_endgamePrintString(87, AL1410_i_Y += 14, k9_ColorGold, L1416_ps_Champion->_name);
+ AL1411_i_X = (6 * strlen(L1416_ps_Champion->_name)) + 87;
+ L1415_c_ChampionTitleFirstCharacter = L1416_ps_Champion->_title[0];
+ if ((L1415_c_ChampionTitleFirstCharacter != ',') && (L1415_c_ChampionTitleFirstCharacter != ';') && (L1415_c_ChampionTitleFirstCharacter != '-')) {
+ AL1411_i_X += 6;
+ }
+ _textMan->f443_endgamePrintString(AL1411_i_X, AL1410_i_Y++, k9_ColorGold, L1416_ps_Champion->_title);
+ for (AL1411_i_SkillIndex = k0_ChampionSkillFighter; AL1411_i_SkillIndex <= k3_ChampionSkillWizard; AL1411_i_SkillIndex++) {
+ L1412_i_SkillLevel = MIN((uint16)16, _championMan->f303_getSkillLevel(AL1409_i_ChampionIndex, AL1411_i_SkillIndex | (k0x4000_IgnoreObjectModifiers | k0x8000_IgnoreTemporaryExperience)));
+ if (L1412_i_SkillLevel == 1)
+ continue;
+ strcpy(L1422_ac_String, G0428_apc_SkillLevelNames[L1412_i_SkillLevel - 2]);
+ strcat(L1422_ac_String, " ");
+ strcat(L1422_ac_String, g417_baseSkillName[AL1411_i_SkillIndex]);
+ _textMan->f443_endgamePrintString(105, AL1410_i_Y = AL1410_i_Y + 8, k13_ColorLightestGray, L1422_ac_String);
+ }
+ G0015_s_Graphic562_Box_Endgame_ChampionMirror._y1 += 48;
+ G0015_s_Graphic562_Box_Endgame_ChampionMirror._y2 += 48;
+ G0016_s_Graphic562_Box_Endgame_ChampionPortrait._y1 += 48;
+ G0016_s_Graphic562_Box_Endgame_ChampionPortrait._y1 += 48;
+ }
+ warning(false, "MISSING CODE: F0436_STARTEND_FadeToPalette(_displayMan->_g347_paletteTopAndBottomScreen);");
+ _engineShouldQuit = true;
+ return;
+ }
+T0444017:
+ _displayMan->fillScreen(k0_ColorBlack);
+ _displayMan->f21_blitToScreen(_displayMan->f489_getNativeBitmapOrGraphic(k6_theEndIndice), &G0012_s_Graphic562_Box_Endgame_TheEnd, k40_byteWidth, kM1_ColorNoTransparency, 14);
+ for (uint16 i = 0; i < 16; ++i)
+ L1421_aui_Palette_DarkBlue[i] = D01_RGB_DARK_BLUE;
+ for (uint16 i = 0; i < 16; ++i)
+ L1419_aui_Palette[i] = L1421_aui_Palette_DarkBlue[i];
+ L1419_aui_Palette[15] = D09_RGB_WHITE;
+ warning(false, "MISSING CODE: F0436_STARTEND_FadeToPalette(L1419_aui_Palette);");
+ if (L1423_B_WaitBeforeDrawingRestart) { /* BUG0_00 Useless code */
+ f22_delay(300);
+ } /* BUG0_00 Useless code */
+
+ if (_g524_restartGameAllowed) {
+ _displayMan->_g578_useByteBoxCoordinates = false;
+ _displayMan->D24_fillScreenBox(G0013_s_Graphic562_Box_Endgame_Restart_Outer, k12_ColorDarkestGray);
+ _displayMan->D24_fillScreenBox(G0014_s_Graphic562_Box_Endgame_Restart_Inner, k0_ColorBlack);
+ _textMan->f53_printToLogicalScreen(110, 154, k4_ColorCyan, k0_ColorBlack, "RESTART THIS GAME");
+ L1419_aui_Palette[1] = D03_RGB_PINK;
+ L1419_aui_Palette[4] = D09_RGB_WHITE;
+ _eventMan->_g441_primaryMouseInput = g446_PrimaryMouseInput_RestartGame;
+ _eventMan->f357_discardAllInput();
+ _eventMan->f77_hideMouse();
+ warning(false, "MISSING CODE: F0436_STARTEND_FadeToPalette");
+ for (AL1409_i_VerticalBlankCount = 900; --AL1409_i_VerticalBlankCount && !_g523_restartGameRequest; f22_delay(1)) {
+ _eventMan->f380_processCommandQueue();
+ }
+ _eventMan->f78_showMouse();
+ if (_g523_restartGameRequest) {
+ warning(false, "MISSING CODE: F0436_STARTEND_FadeToPalette");
+ _displayMan->fillScreen(k0_ColorBlack);
+ warning(false, "MISSING CODE: F0436_STARTEND_FadeToPalette");
+ _g298_newGame = k0_modeLoadSavedGame;
+ if (f435_loadgame(1) != kM1_LoadgameFailure) {
+ f462_startGame();
+ _g523_restartGameRequest = false;
+ _eventMan->f77_hideMouse();
+ _eventMan->f357_discardAllInput();
+ return;
+ }
+ }
+ }
+
+ warning(false, "MISSING CODE: F0436_STARTEND_FadeToPalette");
+ }
+ {
+ Box box(0, 319, 0, 199);
+ _displayMan->f132_blitToBitmap(_displayMan->f489_getNativeBitmapOrGraphic(k5_creditsGraphicIndice), _displayMan->_g348_bitmapScreen, box, 0, 0, 160, 160, kM1_ColorNoTransparency);
+ }
+ warning(false, "MISSING CODE: F0436_STARTEND_FadeToPalette");
+ _eventMan->f541_waitForMouseOrKeyActivity();
+ if (_engineShouldQuit)
+ return;
+
+ if (_g524_restartGameAllowed && doNotDrawCreditsOnly) {
+ L1423_B_WaitBeforeDrawingRestart = false;
+ warning(false, "MISSING CODE: F0436_STARTEND_FadeToPalette");
+ goto T0444017;
+ }
+
+ _engineShouldQuit = true;
+ return;
+}
+
+
void DMEngine::f439_drawEntrance() {
static Box K0079_s_Box_Entrance_DoorsUpperHalf = Box(0, 231, 0, 80);
static Box K0152_s_Box_Entrance_DoorsLowerHalf = Box(0, 231, 81, 160);
diff --git a/engines/dm/dm.h b/engines/dm/dm.h
index e2c8923645..cb7d07f781 100644
--- a/engines/dm/dm.h
+++ b/engines/dm/dm.h
@@ -221,6 +221,7 @@ public:
void f433_processCommand140_saveGame(uint16 slot, const Common::String desc); // @ F0433_STARTEND_ProcessCommand140_SaveGame_CPSCDF
LoadgameResponse f435_loadgame(int16 slot); // @ F0435_STARTEND_LoadGame_CPSF
void f441_processEntrance(); // @ F0441_STARTEND_ProcessEntrance
+ void f444_endGame(bool doNotDrawCreditsOnly); // @ F0444_STARTEND_Endgame
void f064_SOUND_RequestPlay_CPSD(uint16 P0088_ui_SoundIndex, int16 P0089_i_MapX, int16 P0090_i_MapY, uint16 P0091_ui_Mode) { warning(true, "STUB: f064_SOUND_RequestPlay_CPSD"); }
@@ -248,6 +249,8 @@ public:
DialogMan *_dialog;
+ bool _engineShouldQuit;
+
int16 _g298_newGame; // @ G0298_B_NewGame
bool _g523_restartGameRequest; // @ G0523_B_RestartGameRequested
diff --git a/engines/dm/eventman.cpp b/engines/dm/eventman.cpp
index 90f22054b5..2c95049044 100644
--- a/engines/dm/eventman.cpp
+++ b/engines/dm/eventman.cpp
@@ -599,6 +599,9 @@ Common::EventType EventManager::processInput(Common::Event *grabKey, Common::Eve
f544_resetPressingEyeOrMouth();
break;
}
+ case Common::EVENT_QUIT:
+ _vm->_engineShouldQuit = true;
+ break;
default:
break;
}
@@ -1171,6 +1174,8 @@ void EventManager::f282_commandProcessCommands160To162ClickInResurrectReincarnat
if (commandType == k161_CommandClickInPanelReincarnate) {
champMan.f281_renameChampion(champ);
+ if (_vm->_engineShouldQuit)
+ return;
champ->resetSkillsToZero();
for (uint16 i = 0; i < 12; i++) {
@@ -1209,7 +1214,7 @@ void EventManager::f378_commandProcess81ClickInPanel(int16 x, int16 y) {
return;
commandType = f358_getCommandTypeFromMouseInput(g456_MouseInput_PanelChest, Common::Point(x, y), k1_LeftMouseButton);
if (commandType != k0_CommandNone)
- _vm->_championMan->f302_processCommands28to65_clickOnSlotBox(commandType - k20_CommandClickOnSlotBoxChampion_0_StatusBoxReadyHand);
+ _vm->_championMan->f302_processCommands28to65_clickOnSlotBox(commandType - k20_CommandClickOnSlotBoxChampion_0_StatusBoxReadyHand);
break;
case k5_PanelContentResurrectReincarnate:
if (!champMan._g415_leaderEmptyHanded)
@@ -1302,8 +1307,10 @@ void EventManager::f379_drawSleepScreen() {
void EventManager::f357_discardAllInput() {
Common::Event event;
- while (_vm->_system->getEventManager()->pollEvent(event))
- ;
+ while (_vm->_system->getEventManager()->pollEvent(event) && !_vm->_engineShouldQuit) {
+ if (event.type == Common::EVENT_QUIT)
+ _vm->_engineShouldQuit = true;
+ }
_commandQueue.clear();
}
@@ -1537,4 +1544,22 @@ void EventManager::f544_resetPressingEyeOrMouth() {
_vm->_g334_stopPressingMouth = true;
}
}
+
+void EventManager::f541_waitForMouseOrKeyActivity() {
+ Common::Event event;
+ while (true) {
+ if (_vm->_system->getEventManager()->pollEvent(event)) {
+ switch (event.type) {
+ case Common::EVENT_QUIT:
+ _vm->_engineShouldQuit = true;
+ case Common::EVENT_KEYDOWN: // Intentional fall through
+ case Common::EVENT_LBUTTONDOWN:
+ case Common::EVENT_RBUTTONDOWN:
+ return;
+ }
+ }
+ _vm->f22_delay(1);
+ _vm->_displayMan->updateScreen();
+ }
+}
} // end of namespace DM
diff --git a/engines/dm/eventman.h b/engines/dm/eventman.h
index 3cf54785f6..d04b1c72c6 100644
--- a/engines/dm/eventman.h
+++ b/engines/dm/eventman.h
@@ -316,7 +316,8 @@ public:
void f370_commandProcessType100_clickInSpellArea(uint16 posX, uint16 posY); // @ F0370_COMMAND_ProcessType100_ClickInSpellArea
void f369_commandProcessTypes101To108_clickInSpellSymbolsArea(CommandType cmdType); // @ F0369_COMMAND_ProcessTypes101To108_ClickInSpellSymbolsArea_CPSE
void f371_commandProcessType111To115_ClickInActionArea(int16 posX, int16 posY); // @ F0371_COMMAND_ProcessType111To115_ClickInActionArea_CPSE
- void f544_resetPressingEyeOrMouth();// @ F0544_INPUT_ResetPressingEyeOrMouth
+ void f544_resetPressingEyeOrMouth(); // @ F0544_INPUT_ResetPressingEyeOrMouth
+ void f541_waitForMouseOrKeyActivity(); // @ F0541_INPUT_WaitForMouseOrKeyboardActivity
};
}
diff --git a/engines/dm/gfx.cpp b/engines/dm/gfx.cpp
index b76792b651..6384302389 100644
--- a/engines/dm/gfx.cpp
+++ b/engines/dm/gfx.cpp
@@ -719,6 +719,10 @@ DisplayMan::DisplayMan(DMEngine *dmEngine) : _vm(dmEngine) {
Frame(136, 159, 17, 102, 48, 88, 48, 0), /* Right Horizontal Closed half */
Frame(124, 159, 17, 102, 48, 88, 48, 0) /* Right Horizontal Closed three fourth */
);
+ for (uint16 i = 0; i < 16; ++i) {
+ _g347_paletteTopAndBottomScreen[i] = 0;
+ _g346_paletteMiddleScreen[i] = 0;
+ }
}
DisplayMan::~DisplayMan() {
@@ -3691,4 +3695,17 @@ void DisplayMan::f493_addDerivedBitmap(int16 derivedBitmapIndex) {
warning(false, "f493_addDerivedBitmap DOES NOTHING");
}
+uint16 DisplayMan::f431_getDarkenedColor(uint16 RGBcolor) {
+ if (getFlag(RGBcolor, D12_MASK_BLUE_COMPONENT)) {
+ RGBcolor--;
+ }
+ if (getFlag(RGBcolor, D11_MASK_GREEN_COMPONENT)) {
+ RGBcolor -= 16;
+ }
+ if (getFlag(RGBcolor, D10_MASK_RED_COMPONENT)) {
+ RGBcolor -= 256;
+ }
+ return RGBcolor;
+}
+
}
diff --git a/engines/dm/gfx.h b/engines/dm/gfx.h
index 57216981c5..0d9017df69 100644
--- a/engines/dm/gfx.h
+++ b/engines/dm/gfx.h
@@ -207,6 +207,7 @@ enum GraphicIndice {
k3_entranceRightDoorGraphicIndice = 3, // @ C003_GRAPHIC_ENTRANCE_RIGHT_DOOR
k4_entranceGraphicIndice = 4, // @ C004_GRAPHIC_ENTRANCE
k5_creditsGraphicIndice = 5, // @ C005_GRAPHIC_CREDITS
+ k6_theEndIndice = 6, // @ C006_GRAPHIC_THE_END
k8_StatusBoxDeadChampion = 8, // @ C008_GRAPHIC_STATUS_BOX_DEAD_CHAMPION
k9_MenuSpellAreaBackground = 9, // @ C009_GRAPHIC_MENU_SPELL_AREA_BACKGROUND
k10_MenuActionAreaIndice = 10, // @ C010_GRAPHIC_MENU_ACTION_AREA
@@ -266,6 +267,7 @@ enum GraphicIndice {
k69_FieldMask_D3R_GraphicIndice = 69, // @ C069_GRAPHIC_FIELD_MASK_D3R
k73_FieldTeleporterGraphicIndice = 73, // @ C073_GRAPHIC_FIELD_TELEPORTER
k120_InscriptionFontIndice = 120, // @ C120_GRAPHIC_INSCRIPTION_FONT
+ k208_wallOrn_43_champMirror = 208, // @ C208_GRAPHIC_WALL_ORNAMENT_43_CHAMPION_MIRROR
k241_FloorOrn_15_D3L_footprints = 241, // @ C241_GRAPHIC_FLOOR_ORNAMENT_15_D3L_FOOTPRINTS
k301_DoorMaskDestroyedIndice = 301, // @ C301_GRAPHIC_DOOR_MASK_DESTROYED
k315_firstDoorButton_GraphicIndice = 315, // @ C315_GRAPHIC_FIRST_DOOR_BUTTON
@@ -304,7 +306,7 @@ public:
bool isPointInside(Common::Point point) {
return (_x1 <= point.x) && (point.x <= _x2) && (_y1 <= point.y) && (point.y <= _y2); // <= because incluseive boundaries
}
- bool isPointInside(int16 x, int16 y) { return isPointInside(Common::Point(x, y)); }
+ bool isPointInside(int16 x, int16 y) { return isPointInside(Common::Point(x, y)); }
void setToZero() { _x1 = _x2 = _y1 = _y2 = 0; }
}; // @ BOX_BYTE, BOX_WORD
@@ -503,6 +505,21 @@ public:
}
}; // @ DOOR_FRAMES
+#define D00_RGB_BLACK 0x0000
+#define D01_RGB_DARK_BLUE 0x0004
+#define D02_RGB_LIGHT_BROWN 0x0842
+#define D03_RGB_PINK 0x086F
+#define D04_RGB_LIGHTER_BROWN 0x0A62
+#define D05_RGB_DARK_GOLD 0x0A82
+#define D06_RGB_GOLD 0x0CA2
+#define D07_RGB_RED 0x0F00
+#define D08_RGB_YELLOW 0x0FF4
+#define D09_RGB_WHITE 0x0FFF
+#define D10_MASK_RED_COMPONENT 0x0F00
+#define D10_MASK_RED_COMPONENT 0x0F00
+#define D11_MASK_GREEN_COMPONENT 0x00F0
+#define D12_MASK_BLUE_COMPONENT 0x000F
+
class DisplayMan {
friend class DM::TextMan;
@@ -579,7 +596,9 @@ class DisplayMan {
byte *_g696_bitmapWallSet_Wall_D3R2; // @ G0696_puc_Bitmap_WallSet_Wall_D3R2
byte *_g698_bitmapWallSet_Wall_D3LCR; // @ G0698_puc_Bitmap_WallSet_Wall_D3LCR
byte *_g699_bitmapWallSet_Wall_D2LCR; // @ G0699_puc_Bitmap_WallSet_Wall_D2LCR
+public:
byte *_g700_bitmapWallSet_Wall_D1LCR; // @ G0700_puc_Bitmap_WallSet_Wall_D1LCR
+private:
byte *_g701_bitmapWallSet_Wall_D0L; // @ G0701_puc_Bitmap_WallSet_Wall_D0L
byte *_g702_bitmapWallSet_Wall_D0R; // @ G0702_puc_Bitmap_WallSet_Wall_D0R
byte *_g703_bitmapWallSet_DoorFrameTop_D2LCR; // @ G0703_puc_Bitmap_WallSet_DoorFrameTop_D2LCR
@@ -611,6 +630,7 @@ class DisplayMan {
int16 _g694_doorNativeBitmapIndex_Front_D2LCR[2]; // @ G0694_ai_DoorNativeBitmapIndex_Front_D2LCR
int16 _g695_doorNativeBitmapIndex_Front_D1LCR[2]; // @ G0695_ai_DoorNativeBitmapIndex_Front_D1LCR
public:
+
uint16 _screenWidth;
uint16 _screenHeight;
byte *_g348_bitmapScreen; // @ G0348_pl_Bitmap_Screen
@@ -622,6 +642,7 @@ public:
bool _g342_refreshDungeonViewPaleteRequested; // @ G0342_B_RefreshDungeonViewPaletteRequested
int16 _g304_dungeonViewPaletteIndex; // @ G0304_i_DungeonViewPaletteIndex
uint16 _g347_paletteTopAndBottomScreen[16]; // @ G0347_aui_Palette_TopAndBottomScreen
+ uint16 _g346_paletteMiddleScreen[16]; // @ G0346_aui_Palette_MiddleScreen
explicit DisplayMan(DMEngine *dmEngine);
~DisplayMan();
@@ -657,19 +678,19 @@ public:
void f20_blitToViewport(byte *bitmap, int16 *box, int16 byteWidth, Color transparent, int16 height); // @ F0020_MAIN_BlitToViewport
void f21_blitToScreen(byte* bitmap, int16 *box, int16 viewDoorOrnIndex, Color transparent, int16 doorOrnOrdinal); // @ F0021_MAIN_BlitToScreen
void f21_blitToScreen(byte* bitmap, Box *box, int16 viewDoorOrnIndex, Color transparent, int16 doorOrnOrdinal); // @ F0021_MAIN_BlitToScreen
-
- /* srcHeight and destHeight are not necessary for blitting, only error checking, thus they are defaulted for existing code which
+
+ /* srcHeight and destHeight are not necessary for blitting, only error checking, thus they are defaulted for existing code which
does not pass anything, newly imported calls do pass srcHeght and srcWidth, so this is a ceonvenience change so the the parameters
match the original exatcly, if need arises for heights then we'll have to retrospectively add them in old function calls*/
/* Expects inclusive boundaries in box */
void f132_blitToBitmap(byte *srcBitmap, byte *destBitmap, Box &box, uint16 srcX, uint16 srcY, uint16 srcByteWidth,
- uint16 destByteWidth, Color transparent = kM1_ColorNoTransparency, int16 srcHeight = -1, int16 destHight = -1); // @ F0132_VIDEO_Blit
-/* Expects inclusive boundaries in box */
+ uint16 destByteWidth, Color transparent = kM1_ColorNoTransparency, int16 srcHeight = -1, int16 destHight = -1); // @ F0132_VIDEO_Blit
+ /* Expects inclusive boundaries in box */
void f133_blitBoxFilledWithMaskedBitmap(byte *src, byte *dest, byte *mask, byte *tmp, Box &box, int16 lastUnitIndex,
- int16 firstUnitIndex, int16 destByteWidth, Color transparent,
- int16 xPos, int16 yPos, int16 destHeight, int16 height2); // @ F0133_VIDEO_BlitBoxFilledWithMaskedBitmap
- // this function takes pixel widths
+ int16 firstUnitIndex, int16 destByteWidth, Color transparent,
+ int16 xPos, int16 yPos, int16 destHeight, int16 height2); // @ F0133_VIDEO_BlitBoxFilledWithMaskedBitmap
+ // this function takes pixel widths
void f129_blitToBitmapShrinkWithPalChange(byte *srcBitmap, byte *destBitmap,
int16 srcPixelWidth, int16 srcHight, int16 destPixelWidth, int16 destHeight, byte *palChange); // @ F0129_VIDEO_BlitShrinkWithPaletteChanges
void f130_flipBitmapHorizontal(byte *bitmap, uint16 byteWidth, uint16 height); // @ F0130_VIDEO_FlipHorizontal
@@ -695,8 +716,8 @@ public:
int16 f459_getScaledBitmapByteCount(int16 byteWidth, int16 height, int16 scale); // @ F0459_START_GetScaledBitmapByteCount
int16 M78_getScaledDimension(int16 dimension, int16 scale); // @ M78_SCALED_DIMENSION
void f115_cthulhu(Thing thingParam, Direction directionParam,
- int16 mapXpos, int16 mapYpos, int16 viewSquareIndex,
- uint16 orderedViewCellOrdinals); // @ F0115_DUNGEONVIEW_DrawObjectsCreaturesProjectilesExplosions_CPSEF
+ int16 mapXpos, int16 mapYpos, int16 viewSquareIndex,
+ uint16 orderedViewCellOrdinals); // @ F0115_DUNGEONVIEW_DrawObjectsCreaturesProjectilesExplosions_CPSEF
uint16 M77_getNormalizedByteWidth(uint16 byteWidth); // @ M77_NORMALIZED_BYTE_WIDTH
uint16 M23_getVerticalOffsetM23(uint16 val); // @ M23_VERTICAL_OFFSET
uint16 M22_getHorizontalOffsetM22(uint16 val); // @ M22_HORIZONTAL_OFFSET
@@ -726,10 +747,7 @@ public:
bool f491_isDerivedBitmapInCache(int16 derivedBitmapIndex); // @ F0491_CACHE_IsDerivedBitmapInCache
byte *f492_getDerivedBitmap(int16 derivedBitmapIndex); // @ F0492_CACHE_GetDerivedBitmap
void f493_addDerivedBitmap(int16 derivedBitmapIndex); // @ F0493_CACHE_AddDerivedBitmap
-
-
-
-
+ uint16 f431_getDarkenedColor(uint16 RGBcolor);
};
}
diff --git a/engines/dm/inventory.cpp b/engines/dm/inventory.cpp
index 9ecfed1f69..da59e7003f 100644
--- a/engines/dm/inventory.cpp
+++ b/engines/dm/inventory.cpp
@@ -44,6 +44,24 @@ 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
+// TODO: localization
+char* G0428_apc_SkillLevelNames[15] = { // @ G0428_apc_SkillLevelNames
+ "NEOPHYTE",
+ "NOVICE",
+ "APPRENTICE",
+ "JOURNEYMAN",
+ "CRAFTSMAN",
+ "ARTISAN",
+ "ADEPT",
+ "EXPERT",
+ "` MASTER",
+ "a MASTER",
+ "b MASTER",
+ "c MASTER",
+ "d MASTER",
+ "e MASTER",
+ "ARCHMASTER"};
+
InventoryMan::InventoryMan(DMEngine *vm) : _vm(vm) {
_g432_inventoryChampionOrdinal = 0;
_g424_panelContent = k0_PanelContentFoodWaterPoisoned;
@@ -659,23 +677,6 @@ void InventoryMan::f338_decreaseTorchesLightPower() {
}
void InventoryMan::f351_drawChampionSkillsAndStatistics() {
- // TODO: localization
- static char* G0428_apc_SkillLevelNames[15] = {
- "NEOPHYTE",
- "NOVICE",
- "APPRENTICE",
- "JOURNEYMAN",
- "CRAFTSMAN",
- "ARTISAN",
- "ADEPT",
- "EXPERT",
- "` MASTER",
- "a MASTER",
- "b MASTER",
- "c MASTER",
- "d MASTER",
- "e MASTER",
- "ARCHMASTER"};
uint16 L1090_ui_Multiple;
#define AL1090_ui_SkillIndex L1090_ui_Multiple
@@ -902,7 +903,9 @@ void InventoryMan::f349_processCommand70_clickOnMouth() {
if (L1081_B_RemoveObjectFromLeaderHand) {
for (L1086_ui_Counter = 5; --L1086_ui_Counter; _vm->f22_delay(8)) { /* Animate mouth icon */
_vm->_objectMan->f37_drawIconToScreen(k205_IconIndiceMouthOpen + !(L1086_ui_Counter & 0x0001), 56, 46);
- _vm->_eventMan->processInput();
+ _vm->_eventMan->f357_discardAllInput();
+ if (_vm->_engineShouldQuit)
+ return;
_vm->_displayMan->updateScreen();
}
} else {
diff --git a/engines/dm/inventory.h b/engines/dm/inventory.h
index 7617a9d77c..7a3543902a 100644
--- a/engines/dm/inventory.h
+++ b/engines/dm/inventory.h
@@ -47,7 +47,7 @@ enum PanelContent {
k5_PanelContentResurrectReincarnate = 5 // @ C05_PANEL_RESURRECT_REINCARNATE
};
-
+extern char* G0428_apc_SkillLevelNames[15];
class InventoryMan {
DMEngine *_vm;
diff --git a/engines/dm/loadsave.cpp b/engines/dm/loadsave.cpp
index 7440653b0c..85b36911d9 100644
--- a/engines/dm/loadsave.cpp
+++ b/engines/dm/loadsave.cpp
@@ -298,7 +298,7 @@ void DMEngine::f433_processCommand140_saveGame(uint16 slot, const Common::String
if (!saveAndPlayChoice) {
_eventMan->f77_hideMouse();
- warning(false, "MISSING CODE: F0444_STARTEND_Endgame");
+ f444_endGame(false);
}
if (!_championMan->_g415_leaderEmptyHanded) {
_championMan->_gK71_champions[_championMan->_g411_leaderIndex]._load += champHandObjWeight;
diff --git a/engines/dm/text.cpp b/engines/dm/text.cpp
index 993cc8e27f..d55ebca232 100644
--- a/engines/dm/text.cpp
+++ b/engines/dm/text.cpp
@@ -211,4 +211,18 @@ void TextMan::f44_messageAreaClearExpiredRows() {
_g360_messageAreaRowExpirationTime[L0026_ui_RowIndex] = -1;
}
}
+
+void TextMan::f443_endgamePrintString(int16 x, int16 y, Color textColor, char* text) {
+ char* L1407_pc_Character;
+ char L1408_ac_ModifiedString[50];
+
+ L1407_pc_Character = L1408_ac_ModifiedString;
+ while (*L1407_pc_Character = *text++) {
+ if ((*L1407_pc_Character >= 'A') && (*L1407_pc_Character <= 'Z')) {
+ *L1407_pc_Character -= 64; /* Use the same font as the one used for scrolls */
+ }
+ L1407_pc_Character++;
+ }
+ _vm->_textMan->f53_printToLogicalScreen(x, y, textColor, k12_ColorDarkestGray, L1408_ac_ModifiedString);
+}
}
diff --git a/engines/dm/text.h b/engines/dm/text.h
index e0f5e7a73c..3a41274c42 100644
--- a/engines/dm/text.h
+++ b/engines/dm/text.h
@@ -55,6 +55,7 @@ public:
void f54_textInitialize(); // @ F0054_TEXT_Initialize
void f42_messageAreaMoveCursor(int16 column, int16 row); // @ F0042_TEXT_MESSAGEAREA_MoveCursor
void f44_messageAreaClearExpiredRows(); // @ F0044_TEXT_MESSAGEAREA_ClearExpiredRows
+ void f443_endgamePrintString(int16 x, int16 y, Color textColor, char *text); // @ F0443_STARTEND_EndgamePrintString
};
diff --git a/engines/dm/timeline.cpp b/engines/dm/timeline.cpp
index 33a99c9b2f..e2b3f5fbc5 100644
--- a/engines/dm/timeline.cpp
+++ b/engines/dm/timeline.cpp
@@ -703,7 +703,7 @@ void Timeline::f248_timelineProcessEvent6_squareWall(TimelineEvent* event) {
_vm->f22_delay(60 * L0638_ps_Sensor->getValue());
_vm->_g524_restartGameAllowed = false;
_vm->_g302_gameWon = true;
- warning(false, "MISSING CODE: F0444_STARTEND_Endgame");
+ _vm->f444_endGame(true);
}
}
}