aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBendegúz Nagy2016-06-18 17:18:01 +0200
committerBendegúz Nagy2016-08-26 23:02:22 +0200
commit7a255919994af82f4a09915f5586f9756ca0348a (patch)
tree07e14d06486a96c114a8c0698c6c944c486ca3c8
parenta2328b9eb2867c4b6ce78c4e4bab0c7f3a6cb620 (diff)
downloadscummvm-rg350-7a255919994af82f4a09915f5586f9756ca0348a.tar.gz
scummvm-rg350-7a255919994af82f4a09915f5586f9756ca0348a.tar.bz2
scummvm-rg350-7a255919994af82f4a09915f5586f9756ca0348a.zip
DM: Rearrange main parts to better align with the original
-rw-r--r--engines/dm/dm.cpp80
-rw-r--r--engines/dm/dm.h4
-rw-r--r--engines/dm/gfx.h5
-rw-r--r--engines/dm/loadsave.cpp1
4 files changed, 53 insertions, 37 deletions
diff --git a/engines/dm/dm.cpp b/engines/dm/dm.cpp
index 77d7ed012a..94f9f30420 100644
--- a/engines/dm/dm.cpp
+++ b/engines/dm/dm.cpp
@@ -72,8 +72,43 @@ DMEngine::~DMEngine() {
DebugMan.clearAllDebugChannels();
}
+void DMEngine::initializeGame() {
+ _displayMan->loadGraphics();
+ // DUMMY CODE: next line
+ _displayMan->loadPalette(gPalCredits);
+
+ _eventMan->initMouse();
+
+ while (_loadsaveMan->loadgame() != kLoadgameSuccess) {
+ // MISSING CODE: F0441_STARTEND_ProcessEntrance
+ }
+
+ _displayMan->loadFloorSet(kFloorSetStone);
+ _displayMan->loadWallSet(kWallSetStone);
+
+ startGame();
+ warning("MISSING CODE: F0267_MOVE_GetMoveResult_CPSCE (if newGame)");
+ _eventMan->showMouse(true);
+ warning("MISSING CODE: F0357_COMMAND_DiscardAllInput");
+}
+
+
+void DMEngine::startGame() {
+ _eventMan->_primaryMouseInput = gPrimaryMouseInput_Interface;
+ _eventMan->_secondaryMouseInput = gSecondaryMouseInput_Movement;
+ // TODO:(next 2 lines) move to F0003_MAIN_ProcessNewPartyMap_CPSE
+ _dungeonMan->setCurrentMapAndPartyMap(0);
+ _displayMan->loadCurrentMapGraphics();
+
+
+ _menuMan->drawMovementArrows();
+ _gameTimeTicking = true;
+
+ // MISSING CODE: Lot of stuff
+}
Common::Error DMEngine::run() {
+ // scummvm/engine specific
initGraphics(320, 200, false);
_console = new Console(this);
_displayMan = new DisplayMan(this);
@@ -82,55 +117,32 @@ Common::Error DMEngine::run() {
_menuMan = new MenuMan(this);
_championMan = new ChampionMan(this);
_loadsaveMan = new LoadsaveMan(this);
-
_displayMan->setUpScreens(320, 200);
- _displayMan->loadGraphics();
-
- _dungeonMan->loadDungeonFile();
- _dungeonMan->setCurrentMapAndPartyMap(0);
-
-
- _displayMan->loadCurrentMapGraphics();
- _displayMan->loadPalette(gPalCredits);
-
- _eventMan->initMouse();
- _eventMan->showMouse(true);
-
- _loadsaveMan->loadgame();
-
- startGame();
+ initializeGame(); // @ F0463_START_InitializeGame_CPSADEF
+ while (true) {
+ gameloop();
+ // MISSING CODE: F0444_STARTEND_Endgame(G0303_B_PartyDead);
+ }
+ return Common::kNoError;
+}
+void DMEngine::gameloop() {
while (true) {
_stopWaitingForPlayerInput = false;
//do {
- _eventMan->processInput();
- _eventMan->processCommandQueue();
+ _eventMan->processInput();
+ _eventMan->processCommandQueue();
//} while (!_stopWaitingForPlayerInput || !_gameTimeTicking);
_displayMan->clearScreen(kColorBlack);
_displayMan->drawDungeon(_dungeonMan->_currMap.partyDir, _dungeonMan->_currMap.partyPosX, _dungeonMan->_currMap.partyPosY);
- // DUMMY CODE:
+ // DUMMY CODE: next line
_menuMan->drawMovementArrows();
_displayMan->updateScreen();
_system->delayMillis(10);
}
-
-
- return Common::kNoError;
-}
-
-
-void DMEngine::startGame() {
- _eventMan->_primaryMouseInput = gPrimaryMouseInput_Interface;
- _eventMan->_secondaryMouseInput = gSecondaryMouseInput_Movement;
-
-
- _menuMan->drawMovementArrows();
- _gameTimeTicking = true;
-
- // MISSING CODE: Lot of stuff
}
} // End of namespace DM
diff --git a/engines/dm/dm.h b/engines/dm/dm.h
index 67d968a7f9..852b210ff0 100644
--- a/engines/dm/dm.h
+++ b/engines/dm/dm.h
@@ -84,7 +84,9 @@ public:
DMEngine(OSystem *syst);
~DMEngine();
- virtual Common::Error run();
+ virtual Common::Error run(); // @ main
+ void initializeGame(); // @ F0463_START_InitializeGame_CPSADEF
+ void gameloop(); // @ F0002_MAIN_GameLoop_CPSDF
private:
Console *_console;
diff --git a/engines/dm/gfx.h b/engines/dm/gfx.h
index cf06f1c7eb..241d45bfda 100644
--- a/engines/dm/gfx.h
+++ b/engines/dm/gfx.h
@@ -245,8 +245,6 @@ class DisplayMan {
void drawSquareD0R(direction dir, int16 posX, int16 posY); // @ F0126_DUNGEONVIEW_DrawSquareD0R
void drawSquareD0C(direction dir, int16 posX, int16 posY); // @ F0127_DUNGEONVIEW_DrawSquareD0C
- void loadWallSet(WallSet set); // @ F0095_DUNGEONVIEW_LoadWallSet
- void loadFloorSet(FloorSet set); // @ F0094_DUNGEONVIEW_LoadFloorSet
void applyCreatureReplColors(int replacedColor, int replacementColor); // @ F0093_DUNGEONVIEW_ApplyCreatureReplacementColors
@@ -258,6 +256,9 @@ public:
DisplayMan(DMEngine *dmEngine);
~DisplayMan();
+ void loadWallSet(WallSet set); // @ F0095_DUNGEONVIEW_LoadWallSet
+ void loadFloorSet(FloorSet set); // @ F0094_DUNGEONVIEW_LoadFloorSet
+
void setUpScreens(uint16 width, uint16 height);
void loadGraphics(); // @ F0479_MEMORY_ReadGraphicsDatHeader, F0460_START_InitializeGraphicData
void loadCurrentMapGraphics();
diff --git a/engines/dm/loadsave.cpp b/engines/dm/loadsave.cpp
index e58b746060..5518e7927d 100644
--- a/engines/dm/loadsave.cpp
+++ b/engines/dm/loadsave.cpp
@@ -22,6 +22,7 @@ LoadgameResponse LoadsaveMan::loadgame() {
assert(false);
// MISSING CODE: load game
}
+ _vm->_dungeonMan->loadDungeonFile();
if (newGame) {