aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
authorBendegúz Nagy2016-08-26 22:41:19 +0200
committerBendegúz Nagy2016-08-26 23:02:22 +0200
commit5bb19fd2611dd28e6187b4d873de3f754a352b74 (patch)
treef00e91b6c763b686a3b66efb1af99d41dc4a3f2e /engines
parentf3d4b854b7544c1379414983fcc750d60dfe2151 (diff)
downloadscummvm-rg350-5bb19fd2611dd28e6187b4d873de3f754a352b74.tar.gz
scummvm-rg350-5bb19fd2611dd28e6187b4d873de3f754a352b74.tar.bz2
scummvm-rg350-5bb19fd2611dd28e6187b4d873de3f754a352b74.zip
DM: Add GroupMan, Group, ActiveGroup, F0196_GROUP_InitializeActiveGroups
Diffstat (limited to 'engines')
-rw-r--r--engines/dm/TODOs/methodtree.txt6
-rw-r--r--engines/dm/dm.cpp7
-rw-r--r--engines/dm/dm.h2
-rw-r--r--engines/dm/dungeonman.cpp2
-rw-r--r--engines/dm/dungeonman.h17
-rw-r--r--engines/dm/group.cpp54
-rw-r--r--engines/dm/group.h94
-rw-r--r--engines/dm/loadsave.cpp4
-rw-r--r--engines/dm/module.mk1
9 files changed, 165 insertions, 22 deletions
diff --git a/engines/dm/TODOs/methodtree.txt b/engines/dm/TODOs/methodtree.txt
index 9f09e9dd8c..ec7229b057 100644
--- a/engines/dm/TODOs/methodtree.txt
+++ b/engines/dm/TODOs/methodtree.txt
@@ -9,6 +9,10 @@ F0115_DUNGEONVIEW_DrawObjectsCreaturesProjectilesExplosions_CPSEF
F0158_DUNGEON_GetWeaponInfo // done
M66_PROJECTILE_ASPECT_ORDINAL // done
F0176_GROUP_GetCreatureOrdinalInCell
+ F0145_DUNGEON_GetGroupCells
+ F0147_DUNGEON_GetGroupDirections
+ GROUP // done
+ CreatureType
G0017_auc_Graphic562_PaletteChanges_NoChanges
G0075_apuc_PaletteChanges_Projectile
G0077_B_DoNotDrawFluxcagesDuringEndgame
@@ -40,7 +44,7 @@ F0115_DUNGEONVIEW_DrawObjectsCreaturesProjectilesExplosions_CPSEF
G0370_ps_Events
G0375_ps_ActiveGroups
OBJECT_ASPECT
- GROUP
+ GROUP // done
ACTIVE_GROUP
CREATURE_INFO
CREATURE_ASPECT
diff --git a/engines/dm/dm.cpp b/engines/dm/dm.cpp
index 2d55c5e8e3..1b2edceb81 100644
--- a/engines/dm/dm.cpp
+++ b/engines/dm/dm.cpp
@@ -49,6 +49,7 @@
#include "inventory.h"
#include "text.h"
#include "movesens.h"
+#include "group.h"
namespace DM {
@@ -93,7 +94,7 @@ DMEngine::DMEngine(OSystem *syst) : Engine(syst), _console(nullptr) {
_inventoryMan = nullptr;
_textMan = nullptr;
_movsens = nullptr;
-
+ _groupMan = nullptr;
_stopWaitingForPlayerInput = false;
_gameTimeTicking = false;
_restartGameAllowed = false;
@@ -122,6 +123,7 @@ DMEngine::~DMEngine() {
delete _inventoryMan;
delete _textMan;
delete _movsens;
+ delete _groupMan;
// clear debug channels
DebugMan.clearAllDebugChannels();
@@ -203,7 +205,8 @@ Common::Error DMEngine::run() {
_objectMan = new ObjectMan(this);
_inventoryMan = new InventoryMan(this);
_textMan = new TextMan(this);
- _movsens = new MovesensMan(this);
+ _movsens = new MovesensMan(this);
+ _groupMan = new GroupMan(this);
_displayMan->setUpScreens(320, 200);
initializeGame(); // @ F0463_START_InitializeGame_CPSADEF
diff --git a/engines/dm/dm.h b/engines/dm/dm.h
index 251a0af680..5bbeb4f1ae 100644
--- a/engines/dm/dm.h
+++ b/engines/dm/dm.h
@@ -46,6 +46,7 @@ class ObjectMan;
class InventoryMan;
class TextMan;
class MovesensMan;
+class GroupMan;
enum direction {
@@ -161,6 +162,7 @@ public:
InventoryMan *_inventoryMan;
TextMan *_textMan;
MovesensMan *_movsens;
+ GroupMan *_groupMan;
bool _stopWaitingForPlayerInput; // G0321_B_StopWaitingForPlayerInput
bool _gameTimeTicking; // @ G0301_B_GameTimeTicking
diff --git a/engines/dm/dungeonman.cpp b/engines/dm/dungeonman.cpp
index 12531b66ea..e513e58f44 100644
--- a/engines/dm/dungeonman.cpp
+++ b/engines/dm/dungeonman.cpp
@@ -1305,7 +1305,7 @@ int16 DungeonMan::getProjectileAspect(Thing thing) {
int16 projAspOrd;
WeaponInfo *weaponInfo;
- if ((thingType == thing.getType()) == kExplosionThingType) {
+ if ((thingType = thing.getType()) == kExplosionThingType) {
if (thing == Thing::_explFireBall)
return -_vm->indexToOrdinal(kProjectileAspectExplosionFireBall);
if (thing == Thing::_explSlime)
diff --git a/engines/dm/dungeonman.h b/engines/dm/dungeonman.h
index 0e17f629d1..a4f06ee963 100644
--- a/engines/dm/dungeonman.h
+++ b/engines/dm/dungeonman.h
@@ -326,23 +326,6 @@ public:
// some macros missing, i got bored
}; // @ SENSOR
-class Group {
- Thing _nextThing;
- Thing _possessionID;
- byte _type;
- byte _position;
- uint16 _health[4];
- uint16 _attributes;
-public:
- explicit Group(uint16 *rawDat) : _nextThing(rawDat[0]), _possessionID(rawDat[1]), _type(rawDat[2]),
- _position(rawDat[3]), _attributes(rawDat[8]) {
- _health[0] = rawDat[4];
- _health[1] = rawDat[5];
- _health[2] = rawDat[6];
- _health[3] = rawDat[7];
- }
- Thing getNextThing() { return _nextThing; }
-}; // @ GROUP
enum WeaponType {
kWeaponTypeTorch = 2, // @ C02_WEAPON_TORCH
diff --git a/engines/dm/group.cpp b/engines/dm/group.cpp
new file mode 100644
index 0000000000..645d81fa62
--- /dev/null
+++ b/engines/dm/group.cpp
@@ -0,0 +1,54 @@
+/* ScummVM - Graphic Adventure Engine
+*
+* ScummVM is the legal property of its developers, whose names
+* are too numerous to list here. Please refer to the COPYRIGHT
+* file distributed with this source distribution.
+*
+* This program is free software; you can redistribute it and/or
+* modify it under the terms of the GNU General Public License
+* as published by the Free Software Foundation; either version 2
+* of the License, or (at your option) any later version.
+*
+* This program is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+* GNU General Public License for more details.
+*
+* You should have received a copy of the GNU General Public License
+* along with this program; if not, write to the Free Software
+* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+*
+*/
+
+/*
+* Based on the Reverse Engineering work of Christophe Fontanel,
+* maintainer of the Dungeon Master Encyclopaedia (http://dmweb.free.fr/)
+*/
+
+#include "group.h"
+#include "dungeonman.h"
+
+
+
+namespace DM {
+
+
+GroupMan::GroupMan(DMEngine* vm) : _vm(vm) {
+ _activeGroups = nullptr;
+}
+
+GroupMan::~GroupMan() {
+ delete[] _activeGroups;
+}
+
+void GroupMan::initActiveGroups() {
+ if (_vm->_dungeonMan->_messages._newGame)
+ _maxActiveGroupCount = 60;
+ if (_activeGroups)
+ delete[] _activeGroups;
+ _activeGroups = new ActiveGroup[_maxActiveGroupCount];
+ for (uint16 i = 0; i < _maxActiveGroupCount; ++i)
+ _activeGroups[i]._groupThingIndex = -1;
+}
+
+}
diff --git a/engines/dm/group.h b/engines/dm/group.h
new file mode 100644
index 0000000000..9e1300ccde
--- /dev/null
+++ b/engines/dm/group.h
@@ -0,0 +1,94 @@
+/* ScummVM - Graphic Adventure Engine
+*
+* ScummVM is the legal property of its developers, whose names
+* are too numerous to list here. Please refer to the COPYRIGHT
+* file distributed with this source distribution.
+*
+* This program is free software; you can redistribute it and/or
+* modify it under the terms of the GNU General Public License
+* as published by the Free Software Foundation; either version 2
+* of the License, or (at your option) any later version.
+*
+* This program is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+* GNU General Public License for more details.
+*
+* You should have received a copy of the GNU General Public License
+* along with this program; if not, write to the Free Software
+* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+*
+*/
+
+/*
+* Based on the Reverse Engineering work of Christophe Fontanel,
+* maintainer of the Dungeon Master Encyclopaedia (http://dmweb.free.fr/)
+*/
+
+
+#ifndef DM_GROUP_H
+#define DM_GROUP_H
+
+#include "dm.h"
+
+namespace DM {
+
+class ActiveGroup {
+public:
+ int _groupThingIndex;
+ byte _directions;
+ byte _cells;
+ byte _lastMoveTime;
+ byte _delayFleeingFromTarget;
+ byte _targetMapX;
+ byte _targetMapY;
+ byte _priorMapX;
+ byte _priorMapY;
+ byte _homeMapX;
+ byte _homeMapY;
+ byte _aspect[4];
+}; // @ ACTIVE_GROUP
+
+
+class Group {
+public:
+ Thing _nextThing;
+ Thing _slot;
+ byte _type;
+ byte _cells;
+ uint16 _health[4];
+private:
+ uint16 _flags;
+public:
+ explicit Group(uint16 *rawDat) : _nextThing(rawDat[0]), _slot(rawDat[1]), _type(rawDat[2]),
+ _cells(rawDat[3]), _flags(rawDat[8]) {
+ _health[0] = rawDat[4];
+ _health[1] = rawDat[5];
+ _health[2] = rawDat[6];
+ _health[3] = rawDat[7];
+ }
+
+ byte &getActiveGroupIndex() { return _cells; }
+
+ uint16 getBehaviour() { return _flags & 0xF; }
+ uint16 getCount() { return (_flags >> 5) & 0x3; }
+ direction getDir() { return (direction)((_flags >> 8) & 0x3); }
+ uint16 getDoNotDiscard() { return (_flags >> 10) & 0x1; }
+}; // @ GROUP
+
+
+class GroupMan {
+ DMEngine *_vm;
+public:
+ uint16 _maxActiveGroupCount = 60; // @ G0376_ui_MaximumActiveGroupCount
+ ActiveGroup *_activeGroups; // @ G0375_ps_ActiveGroups
+ GroupMan(DMEngine *vm);
+ ~GroupMan();
+ void initActiveGroups(); // @ F0196_GROUP_InitializeActiveGroups
+};
+
+
+
+}
+
+#endif
diff --git a/engines/dm/loadsave.cpp b/engines/dm/loadsave.cpp
index 7da701b6c3..583762c9db 100644
--- a/engines/dm/loadsave.cpp
+++ b/engines/dm/loadsave.cpp
@@ -28,6 +28,7 @@
#include "loadsave.h"
#include "dungeonman.h"
#include "champion.h"
+#include "group.h"
@@ -53,7 +54,8 @@ LoadgameResponse LoadsaveMan::loadgame() {
if (newGame) {
- warning("MISSING CODE: Timline init, Group init");
+ warning("MISSING CODE: Timline init");
+ _vm->_groupMan->initActiveGroups();
} else {
assert(false);
// MISSING CODE: load game
diff --git a/engines/dm/module.mk b/engines/dm/module.mk
index 28bcaa2a54..721eb43db9 100644
--- a/engines/dm/module.mk
+++ b/engines/dm/module.mk
@@ -36,6 +36,7 @@ MODULE_OBJS := \
dungeonman.o \
eventman.o \
gfx.o \
+ group.o \
inventory.o \
loadsave.o \
menus.o \