aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
authorWinterGrascph2016-05-21 21:09:09 +0200
committerBendegúz Nagy2016-08-26 23:02:22 +0200
commitf591cbbcf350b0f61cb2441bd4a89a7b45e3c689 (patch)
treeb661320766c6304d5070ba4601e11df5ead43b85 /engines
parent807fda8a9a3d7b975a749c6d82232526bc43281d (diff)
downloadscummvm-rg350-f591cbbcf350b0f61cb2441bd4a89a7b45e3c689.tar.gz
scummvm-rg350-f591cbbcf350b0f61cb2441bd4a89a7b45e3c689.tar.bz2
scummvm-rg350-f591cbbcf350b0f61cb2441bd4a89a7b45e3c689.zip
DM: Add dummy movement code for testing
Diffstat (limited to 'engines')
-rw-r--r--engines/dm/dm.cpp55
-rw-r--r--engines/dm/dm.h11
-rw-r--r--engines/dm/dungeonman.cpp12
-rw-r--r--engines/dm/dungeonman.h7
-rw-r--r--engines/dm/gfx.h1
5 files changed, 59 insertions, 27 deletions
diff --git a/engines/dm/dm.cpp b/engines/dm/dm.cpp
index 9cdcd1a9f4..0aa4cb32b0 100644
--- a/engines/dm/dm.cpp
+++ b/engines/dm/dm.cpp
@@ -9,6 +9,7 @@
#include "engines/engine.h"
#include "graphics/palette.h"
#include "common/file.h"
+#include "common/events.h"
#include "dm/dm.h"
#include "dm/gfx.h"
@@ -16,6 +17,13 @@
namespace DM {
+int8 dirIntoStepCountEast[4] = {0 /* North */, 1 /* East */, 0 /* West */, -1 /* South */};
+int8 dirIntoStepCountNorth[4] = {-1 /* North */, 0 /* East */, 1 /* West */, 0 /* South */};
+
+void turnDirRight(direction &dir) { dir = (direction)((dir + 1) & 3); }
+void turnDirLeft(direction &dir) { dir = (direction)((dir - 1) & 3); }
+bool isOrientedWestEast(direction dir) { return dir & 1; }
+
DMEngine::DMEngine(OSystem *syst) : Engine(syst), _console(nullptr) {
// Do not load data files
@@ -59,7 +67,8 @@ Common::Error DMEngine::run() {
_displayMan->loadGraphics();
_dungeonMan->loadDungeonFile();
- _dungeonMan->setCurrentMapAndPartyMap(0);
+ int16 dummyMapIndex = 0;
+ _dungeonMan->setCurrentMapAndPartyMap(dummyMapIndex);
@@ -68,18 +77,44 @@ Common::Error DMEngine::run() {
_displayMan->loadPalette(gPalCredits);
- byte pos[] = {kDirSouth, 1, 3, kDirSouth, 1, 4, kDirSouth, 1, 5, kDirSouth, 1, 6, kDirSouth, 1, 7, kDirEast, 1, 7};
-
- uint16 i = 0; //TODO: testing, please delete me
+ CurrMapData &currMap = _dungeonMan->_currMap;
while (true) {
+ Common::Event event;
+ while (_system->getEventManager()->pollEvent(event)) {
+ if (event.type == Common::EVENT_KEYDOWN && !event.synthetic)
+ switch (event.kbd.keycode) {
+ case Common::KEYCODE_w:
+ _dungeonMan->mapCoordsAfterRelMovement(currMap.partyDir, 1, 0, currMap.partyPosX, currMap.partyPosY);
+ break;
+ case Common::KEYCODE_a:
+ _dungeonMan->mapCoordsAfterRelMovement(currMap.partyDir, 0, -1, currMap.partyPosX, currMap.partyPosY);
+ break;
+ case Common::KEYCODE_s:
+ _dungeonMan->mapCoordsAfterRelMovement(currMap.partyDir, -1, 0, currMap.partyPosX, currMap.partyPosY);
+ break;
+ case Common::KEYCODE_d:
+ _dungeonMan->mapCoordsAfterRelMovement(currMap.partyDir, 0, 1, currMap.partyPosX, currMap.partyPosY);
+ break;
+ case Common::KEYCODE_q:
+ turnDirLeft(currMap.partyDir);
+ break;
+ case Common::KEYCODE_e:
+ turnDirRight(currMap.partyDir);
+ break;
+ case Common::KEYCODE_UP:
+ if (dummyMapIndex < 13)
+ _dungeonMan->setCurrentMapAndPartyMap(++dummyMapIndex);
+ break;
+ case Common::KEYCODE_DOWN:
+ if (dummyMapIndex > 0)
+ _dungeonMan->setCurrentMapAndPartyMap(--dummyMapIndex);
+ break;
+ }
+ }
_displayMan->clearScreen(kColorBlack);
- _displayMan->drawDungeon((direction)pos[i*3 + 0], pos[i*3 + 1], pos[i*3 + 2]);
- //_displayMan->drawDungeon(_dungeonMan->_currMap.partyDir, _dungeonMan->_currMap.partyPosX, _dungeonMan->_currMap.partyPosY + i);
+ _displayMan->drawDungeon(_dungeonMan->_currMap.partyDir, _dungeonMan->_currMap.partyPosX, _dungeonMan->_currMap.partyPosY);
_displayMan->updateScreen();
- _system->delayMillis(1000); //TODO: testing, please set me to 10
- if(i == 0)
- _system->delayMillis(0000); //TODO: testing, please set me to 10
- if (++i == 6) i = 0;
+ _system->delayMillis(10);
}
diff --git a/engines/dm/dm.h b/engines/dm/dm.h
index a0bbadd156..817c3ece28 100644
--- a/engines/dm/dm.h
+++ b/engines/dm/dm.h
@@ -20,8 +20,15 @@ enum direction {
kDirWest = 3
};
-int16 ordinalToIndex(int16 val); // @ M01_ORDINAL_TO_INDEX
-int16 indexToOrdinal(int16 val); // @ M00_INDEX_TO_ORDINAL
+// TODO: refactor direction into a class
+extern int8 dirIntoStepCountEast[4];
+extern int8 dirIntoStepCountNorth[4];
+
+void turnDirRight(direction &dir);
+void turnDirLeft(direction &dir);
+bool isOrientedWestEast(direction dir);
+
+
enum ThingType {
kPartyThingType = -1, // @ CM1_THING_TYPE_PARTY, special value
kDoorThingType = 0,
diff --git a/engines/dm/dungeonman.cpp b/engines/dm/dungeonman.cpp
index cd713e4127..ccefaceb45 100644
--- a/engines/dm/dungeonman.cpp
+++ b/engines/dm/dungeonman.cpp
@@ -5,18 +5,6 @@
-
-namespace DM {
-// TODO: refactor direction into a class
-int8 dirIntoStepCountEast[4] = {0 /* North */, 1 /* East */, 0 /* West */, -1 /* South */};
-int8 dirIntoStepCountNorth[4] = {-1 /* North */, 0 /* East */, 1 /* West */, 0 /* South */};
-
-void turnDirRight(direction &dir) { dir = (direction)((dir + 1) & 3); }
-bool isOrientedWestEast(direction dir) { return dir & 1; }
-
-
-}
-
using namespace DM;
CreatureInfo gCreatureInfo[kCreatureTypeCount] = { // @ G0243_as_Graphic559_CreatureInfo
diff --git a/engines/dm/dungeonman.h b/engines/dm/dungeonman.h
index 3c0215849c..35a337d088 100644
--- a/engines/dm/dungeonman.h
+++ b/engines/dm/dungeonman.h
@@ -9,7 +9,8 @@ namespace DM {
class DungeonMan;
struct Map;
-
+int16 ordinalToIndex(int16 val); // @ M01_ORDINAL_TO_INDEX
+int16 indexToOrdinal(int16 val); // @ M00_INDEX_TO_ORDINAL
struct CreatureInfo {
byte creatureAspectIndex;
@@ -360,8 +361,8 @@ struct DungeonData {
struct CurrMapData {
direction partyDir; // @ G0308_i_PartyDirection
- uint16 partyPosX; // @ G0306_i_PartyMapX
- uint16 partyPosY; // @ G0307_i_PartyMapY
+ int16 partyPosX; // @ G0306_i_PartyMapX
+ int16 partyPosY; // @ G0307_i_PartyMapY
uint8 currPartyMapIndex; // @ G0309_i_PartyMapIndex
uint8 index; // @ G0272_i_CurrentMapIndex
diff --git a/engines/dm/gfx.h b/engines/dm/gfx.h
index 8b59d5194a..d558e812a7 100644
--- a/engines/dm/gfx.h
+++ b/engines/dm/gfx.h
@@ -116,6 +116,7 @@ class DisplayMan {
void loadIntoBitmap(uint16 index, byte *destBitmap); // @ F0466_EXPAND_GraphicToBitmap
void unpackGraphics();
+ // @ F0104_DUNGEONVIEW_DrawFloorPitOrStairsBitmap
void drawWallSetBitmap(byte *bitmap, Frame &f); // @ F0100_DUNGEONVIEW_DrawWallSetBitmap
void drawWallSetBitmapWithoutTransparency(byte *bitmap, Frame &f); // @ F0101_DUNGEONVIEW_DrawWallSetBitmapWithoutTransparency
void drawSquareD3L(direction dir, int16 posX, int16 posY); // @ F0116_DUNGEONVIEW_DrawSquareD3L