Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
DM: Add GroupMan, Group, ActiveGroup, F0196_GROUP_InitializeActiveGroups
- Loading branch information
Bendegúz Nagy
committed
Aug 26, 2016
1 parent
f3d4b85
commit 5bb19fd
Showing
9 changed files
with
165 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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; | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -36,6 +36,7 @@ MODULE_OBJS := \ | |
dungeonman.o \ | ||
eventman.o \ | ||
gfx.o \ | ||
group.o \ | ||
inventory.o \ | ||
loadsave.o \ | ||
menus.o \ | ||
|