2016-08-26 22:36:31 +02:00
|
|
|
/* 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/)
|
|
|
|
*/
|
|
|
|
|
2016-04-26 14:44:01 +02:00
|
|
|
#include "common/scummsys.h"
|
2016-05-02 20:58:55 +02:00
|
|
|
#include "common/system.h"
|
2016-04-26 14:44:01 +02:00
|
|
|
|
|
|
|
#include "common/debug.h"
|
|
|
|
#include "common/debug-channels.h"
|
|
|
|
#include "common/error.h"
|
|
|
|
|
|
|
|
#include "engines/util.h"
|
2016-05-02 20:58:55 +02:00
|
|
|
#include "engines/engine.h"
|
|
|
|
#include "graphics/palette.h"
|
|
|
|
#include "common/file.h"
|
2016-05-21 21:09:09 +02:00
|
|
|
#include "common/events.h"
|
2016-07-11 11:37:01 +02:00
|
|
|
#include "common/array.h"
|
|
|
|
#include "common/algorithm.h"
|
2016-04-26 14:44:01 +02:00
|
|
|
|
|
|
|
#include "dm/dm.h"
|
2016-06-15 22:42:08 +02:00
|
|
|
#include "gfx.h"
|
|
|
|
#include "dungeonman.h"
|
|
|
|
#include "eventman.h"
|
2016-06-17 14:29:05 +02:00
|
|
|
#include "menus.h"
|
2016-06-18 11:36:31 +02:00
|
|
|
#include "champion.h"
|
|
|
|
#include "loadsave.h"
|
2016-06-19 00:54:28 +02:00
|
|
|
#include "objectman.h"
|
2016-06-19 16:17:28 +02:00
|
|
|
#include "inventory.h"
|
2016-06-22 20:32:30 +02:00
|
|
|
#include "text.h"
|
2016-08-26 22:37:14 +02:00
|
|
|
#include "movesens.h"
|
2016-08-26 22:41:19 +02:00
|
|
|
#include "group.h"
|
2016-06-30 19:59:35 +02:00
|
|
|
#include "timeline.h"
|
2016-07-07 00:46:51 +02:00
|
|
|
#include "projexpl.h"
|
2016-04-26 14:44:01 +02:00
|
|
|
|
|
|
|
namespace DM {
|
2016-07-11 11:37:01 +02:00
|
|
|
void warning(bool repeat, const char* s, ...) {
|
|
|
|
va_list va;
|
|
|
|
|
|
|
|
va_start(va, s);
|
|
|
|
Common::String output = Common::String::vformat(s, va);
|
|
|
|
va_end(va);
|
|
|
|
|
|
|
|
if (repeat) {
|
|
|
|
::warning(output.c_str());
|
|
|
|
} else {
|
|
|
|
static Common::Array<Common::String> stringsPrinted;
|
|
|
|
|
|
|
|
if (Common::find(stringsPrinted.begin(), stringsPrinted.end(), s) == stringsPrinted.end()) {
|
|
|
|
stringsPrinted.push_back(output);
|
|
|
|
::warning(output.c_str());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2016-04-26 14:44:01 +02:00
|
|
|
|
2016-05-21 21:09:09 +02:00
|
|
|
void turnDirRight(direction &dir) { dir = (direction)((dir + 1) & 3); }
|
|
|
|
void turnDirLeft(direction &dir) { dir = (direction)((dir - 1) & 3); }
|
2016-08-26 22:07:38 +02:00
|
|
|
direction returnOppositeDir(direction dir) { return (direction)((dir + 2) & 3); }
|
2016-06-30 15:48:23 +02:00
|
|
|
|
|
|
|
uint16 returnPrevVal(uint16 val) {
|
|
|
|
return (direction)((val + 3) & 3);
|
|
|
|
}
|
|
|
|
|
|
|
|
uint16 returnNextVal(uint16 val) {
|
|
|
|
return (val + 1) & 0x3;
|
|
|
|
}
|
|
|
|
|
2016-05-21 21:09:09 +02:00
|
|
|
bool isOrientedWestEast(direction dir) { return dir & 1; }
|
|
|
|
|
2016-07-04 14:22:17 +02:00
|
|
|
uint16 toggleFlag(uint16& val, uint16 mask) {
|
|
|
|
return val ^= mask;
|
2016-07-04 17:14:32 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
uint16 M75_bitmapByteCount(uint16 pixelWidth, uint16 height) {
|
|
|
|
return pixelWidth / 2 * height;
|
2016-07-04 20:54:17 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
uint16 M21_normalizeModulo4(uint16 val) {
|
|
|
|
return val & 3;
|
2016-06-29 22:08:10 +02:00
|
|
|
}
|
2016-05-04 12:50:06 +02:00
|
|
|
|
2016-07-07 00:46:51 +02:00
|
|
|
int32 M30_time(int32 map_time) {
|
|
|
|
return map_time & 0x00FFFFFF;
|
|
|
|
}
|
|
|
|
|
|
|
|
int32 M33_setMapAndTime(int32 &map_time, uint32 map, uint32 time) {
|
|
|
|
return (map_time) = ((time) | (((long)(map)) << 24));
|
|
|
|
}
|
|
|
|
|
|
|
|
uint16 M29_map(int32 map_time) {
|
|
|
|
return ((uint16)((map_time) >> 24));
|
|
|
|
}
|
|
|
|
|
|
|
|
Thing M15_thingWithNewCell(Thing thing, int16 cell) {
|
|
|
|
return Thing(((thing.toUint16()) & 0x3FFF) | ((cell) << 14));
|
|
|
|
}
|
|
|
|
|
|
|
|
int16 M38_distance(int16 mapx1, int16 mapy1, int16 mapx2, int16 mapy2) {
|
|
|
|
return ABS(mapx1 - mapx2) + ABS(mapy1 - mapy2);
|
|
|
|
}
|
|
|
|
|
2016-04-26 14:44:01 +02:00
|
|
|
DMEngine::DMEngine(OSystem *syst) : Engine(syst), _console(nullptr) {
|
2016-06-29 22:08:10 +02:00
|
|
|
// Do not load data files
|
|
|
|
// Do not initialize graphics here
|
|
|
|
// Do not initialize audio devices here
|
|
|
|
// Do these from run
|
|
|
|
|
|
|
|
//Specify all default directories
|
|
|
|
//const Common::FSNode gameDataDir(ConfMan.get("example"));
|
|
|
|
//SearchMan.addSubDirectoryMatching(gameDataDir, "example2");
|
2016-04-26 14:44:01 +02:00
|
|
|
DebugMan.addDebugChannel(kDMDebugExample, "example", "example desc");
|
|
|
|
|
2016-05-04 11:23:52 +02:00
|
|
|
// register random source
|
2016-04-26 14:44:01 +02:00
|
|
|
_rnd = new Common::RandomSource("quux");
|
|
|
|
|
2016-06-17 23:08:04 +02:00
|
|
|
_dungeonMan = nullptr;
|
2016-06-18 11:36:31 +02:00
|
|
|
_displayMan = nullptr;
|
2016-06-17 23:08:04 +02:00
|
|
|
_eventMan = nullptr;
|
|
|
|
_menuMan = nullptr;
|
2016-06-18 11:36:31 +02:00
|
|
|
_championMan = nullptr;
|
|
|
|
_loadsaveMan = nullptr;
|
2016-06-19 00:54:28 +02:00
|
|
|
_objectMan = nullptr;
|
2016-06-19 16:17:28 +02:00
|
|
|
_inventoryMan = nullptr;
|
2016-06-22 20:32:30 +02:00
|
|
|
_textMan = nullptr;
|
2016-08-26 22:37:14 +02:00
|
|
|
_movsens = nullptr;
|
2016-08-26 22:41:19 +02:00
|
|
|
_groupMan = nullptr;
|
2016-06-30 19:59:35 +02:00
|
|
|
_timeline = nullptr;
|
2016-07-07 00:46:51 +02:00
|
|
|
_projexpl = nullptr;
|
2016-08-26 22:50:01 +02:00
|
|
|
|
|
|
|
_g298_newGame = false;
|
|
|
|
_g523_restartGameRequest = false;
|
|
|
|
_g321_stopWaitingForPlayerInput = true;
|
2016-08-26 22:43:17 +02:00
|
|
|
_g301_gameTimeTicking = false;
|
|
|
|
_g524_restartGameAllowed = false;
|
2016-08-26 22:50:01 +02:00
|
|
|
_g525_gameId = 0;
|
2016-08-26 22:43:17 +02:00
|
|
|
_g331_pressingEye = false;
|
|
|
|
_g332_stopPressingEye = false;
|
2016-08-26 22:50:01 +02:00
|
|
|
_g333_pressingMouth = false;
|
2016-08-26 22:43:17 +02:00
|
|
|
_g334_stopPressingMouth = false;
|
|
|
|
_g340_highlightBoxInversionRequested = false;
|
2016-08-26 22:50:01 +02:00
|
|
|
_g311_projectileDisableMovementTicks = 0;
|
|
|
|
_g312_lastProjectileDisabledMovementDirection = 0;
|
2016-07-07 00:46:51 +02:00
|
|
|
_g302_gameWon = false;
|
|
|
|
_g327_newPartyMapIndex = kM1_mapIndexNone;
|
2016-08-26 22:50:01 +02:00
|
|
|
_g325_setMousePointerToObjectInMainLoop = false;
|
|
|
|
_g310_disabledMovementTicks = 0;
|
|
|
|
_g313_gameTime = 0;
|
|
|
|
_g353_stringBuildBuffer[0] = '\0';
|
2016-04-26 14:44:01 +02:00
|
|
|
debug("DMEngine::DMEngine");
|
2016-08-26 22:50:01 +02:00
|
|
|
|
|
|
|
|
2016-07-11 11:37:01 +02:00
|
|
|
warning(false, "DUMMY CODE: setting _g298_newGame to true, should be in processEntrance");
|
2016-08-26 22:50:01 +02:00
|
|
|
_g298_newGame = true;
|
2016-04-26 14:44:01 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
DMEngine::~DMEngine() {
|
|
|
|
debug("DMEngine::~DMEngine");
|
|
|
|
|
|
|
|
// dispose of resources
|
|
|
|
delete _rnd;
|
2016-05-02 20:58:55 +02:00
|
|
|
delete _console;
|
|
|
|
delete _displayMan;
|
2016-05-03 17:55:04 +02:00
|
|
|
delete _dungeonMan;
|
2016-06-15 10:41:33 +02:00
|
|
|
delete _eventMan;
|
2016-06-17 14:29:05 +02:00
|
|
|
delete _menuMan;
|
2016-06-18 11:36:31 +02:00
|
|
|
delete _championMan;
|
|
|
|
delete _loadsaveMan;
|
2016-06-19 00:54:28 +02:00
|
|
|
delete _objectMan;
|
2016-06-19 16:17:28 +02:00
|
|
|
delete _inventoryMan;
|
2016-06-22 20:32:30 +02:00
|
|
|
delete _textMan;
|
2016-08-26 22:37:14 +02:00
|
|
|
delete _movsens;
|
2016-08-26 22:41:19 +02:00
|
|
|
delete _groupMan;
|
2016-06-30 19:59:35 +02:00
|
|
|
delete _timeline;
|
2016-07-07 00:46:51 +02:00
|
|
|
delete _projexpl;
|
2016-04-26 14:44:01 +02:00
|
|
|
|
|
|
|
// clear debug channels
|
|
|
|
DebugMan.clearAllDebugChannels();
|
|
|
|
}
|
|
|
|
|
2016-07-11 17:06:24 +02:00
|
|
|
void DMEngine::f22_delay(uint16 verticalBlank) {
|
|
|
|
_system->delayMillis(verticalBlank * 20); // Google says most Amiga games had a refreshrate of 50 hz
|
2016-07-07 00:46:51 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
uint16 DMEngine::f30_getScaledProduct(uint16 val, uint16 scale, uint16 vale2) {
|
|
|
|
return ((uint32)val * vale2) >> scale;
|
|
|
|
}
|
|
|
|
|
2016-08-26 22:47:44 +02:00
|
|
|
void DMEngine::f463_initializeGame() {
|
|
|
|
_displayMan->f479_loadGraphics();
|
|
|
|
_displayMan->f460_initializeGraphicData();
|
2016-06-18 17:18:01 +02:00
|
|
|
// DUMMY CODE: next line
|
2016-08-26 22:50:01 +02:00
|
|
|
_displayMan->loadPalette(g21_PalDungeonView[0]);
|
|
|
|
_displayMan->f94_loadFloorSet(k0_FloorSetStone);
|
|
|
|
_displayMan->f95_loadWallSet(k0_WallSetStone);
|
2016-07-04 14:22:17 +02:00
|
|
|
|
2016-08-26 22:50:01 +02:00
|
|
|
_textMan->f54_textInitialize();
|
|
|
|
_objectMan->loadObjectNames();
|
2016-06-18 17:18:01 +02:00
|
|
|
_eventMan->initMouse();
|
2016-08-26 22:50:01 +02:00
|
|
|
//F0441_STARTEND_ProcessEntrance();
|
2016-08-26 22:47:44 +02:00
|
|
|
while (_loadsaveMan->f435_loadgame() != k1_LoadgameSuccess) {
|
2016-07-11 11:37:01 +02:00
|
|
|
warning(false, "TODO: F0441_STARTEND_ProcessEntrance");
|
2016-06-18 17:18:01 +02:00
|
|
|
}
|
2016-08-26 22:50:01 +02:00
|
|
|
//F0396_MENUS_LoadSpellAreaLinesBitmap() is not needed, every bitmap has been loaded
|
2016-06-18 17:18:01 +02:00
|
|
|
|
|
|
|
|
2016-07-02 17:46:05 +02:00
|
|
|
// There was some memory wizardy for the Amiga platform, I skipped that part
|
|
|
|
_displayMan->f461_allocateFlippedWallBitmaps();
|
|
|
|
|
2016-08-26 22:47:44 +02:00
|
|
|
f462_startGame();
|
2016-08-26 22:50:01 +02:00
|
|
|
if (_g298_newGame)
|
|
|
|
_movsens->f267_getMoveResult(Thing::_party, kM1_MapXNotOnASquare, 0, _dungeonMan->_g306_partyMapX, _dungeonMan->_g307_partyMapY);
|
2016-07-07 00:46:51 +02:00
|
|
|
_eventMan->f78_showMouse();
|
|
|
|
_eventMan->f357_discardAllInput();
|
2016-06-18 17:18:01 +02:00
|
|
|
}
|
|
|
|
|
2016-07-04 14:22:17 +02:00
|
|
|
void DMEngine::f448_initMemoryManager() {
|
2016-07-11 11:37:01 +02:00
|
|
|
warning(false, "STUB FUNCTION");
|
2016-07-04 14:22:17 +02:00
|
|
|
for (uint16 i = 0; i < 16; ++i)
|
|
|
|
_displayMan->_g347_paletteTopAndBottomScreen[i] = g21_PalDungeonView[0][i];
|
|
|
|
}
|
2016-06-18 17:18:01 +02:00
|
|
|
|
2016-07-04 14:22:17 +02:00
|
|
|
void DMEngine::f462_startGame() {
|
2016-08-26 22:50:01 +02:00
|
|
|
static Box g61_boxScreenTop(0, 319, 0, 32); // @ G0061_s_Graphic562_Box_ScreenTop
|
|
|
|
static Box g62_boxScreenRight(224, 319, 33, 169); // @ G0062_s_Graphic562_Box_ScreenRight
|
|
|
|
static Box g63_boxScreenBottom(0, 319, 169, 199); // @ G0063_s_Graphic562_Box_ScreenBottom
|
|
|
|
|
|
|
|
|
2016-08-26 22:43:17 +02:00
|
|
|
_g331_pressingEye = false;
|
|
|
|
_g332_stopPressingEye = false;
|
|
|
|
_g333_pressingMouth = false;
|
|
|
|
_g334_stopPressingMouth = false;
|
|
|
|
_g340_highlightBoxInversionRequested = false;
|
2016-07-02 02:58:44 +02:00
|
|
|
_eventMan->_g341_highlightBoxEnabled = false;
|
2016-07-02 01:55:48 +02:00
|
|
|
_championMan->_g300_partyIsSleeping = false;
|
2016-08-26 22:47:44 +02:00
|
|
|
_championMan->_g506_actingChampionOrdinal = M0_indexToOrdinal(kM1_ChampionNone);
|
2016-07-02 12:57:31 +02:00
|
|
|
_menuMan->_g509_actionAreaContainsIcons = true;
|
2016-08-26 22:47:44 +02:00
|
|
|
_eventMan->_g599_useChampionIconOrdinalAsMousePointerBitmap = M0_indexToOrdinal(kM1_ChampionNone);
|
2016-06-18 19:42:05 +02:00
|
|
|
|
2016-07-02 02:58:44 +02:00
|
|
|
_eventMan->_g441_primaryMouseInput = g447_PrimaryMouseInput_Interface;
|
|
|
|
_eventMan->_g442_secondaryMouseInput = g448_SecondaryMouseInput_Movement;
|
2016-07-11 10:52:38 +02:00
|
|
|
_eventMan->_g443_primaryKeyboardInput = g458_primaryKeyboardInput_interface;
|
|
|
|
_eventMan->_g444_secondaryKeyboardInput = g459_secondaryKeyboardInput_movement;
|
2016-06-18 19:42:05 +02:00
|
|
|
|
2016-08-26 22:47:44 +02:00
|
|
|
f3_processNewPartyMap(_dungeonMan->_g309_partyMapIndex);
|
2016-06-18 17:18:01 +02:00
|
|
|
|
2016-07-02 13:47:19 +02:00
|
|
|
if (!_g298_newGame) {
|
2016-07-11 11:37:01 +02:00
|
|
|
warning(false, "TODO: loading game");
|
2016-08-26 22:50:01 +02:00
|
|
|
assert(false);
|
2016-06-19 00:49:23 +02:00
|
|
|
} else {
|
2016-07-02 00:27:05 +02:00
|
|
|
_displayMan->_g578_useByteBoxCoordinates = false;
|
2016-08-26 22:50:01 +02:00
|
|
|
_displayMan->D24_fillScreenBox(g61_boxScreenTop, k0_ColorBlack);
|
|
|
|
_displayMan->D24_fillScreenBox(g62_boxScreenRight, k0_ColorBlack);
|
|
|
|
_displayMan->D24_fillScreenBox(g63_boxScreenBottom, k0_ColorBlack);
|
2016-06-18 19:42:05 +02:00
|
|
|
}
|
2016-06-18 17:18:01 +02:00
|
|
|
|
2016-07-11 11:37:01 +02:00
|
|
|
warning(false, "TODO: build copper");
|
2016-08-26 22:47:44 +02:00
|
|
|
_menuMan->f395_drawMovementArrows();
|
|
|
|
_championMan->f278_resetDataToStartGame();
|
2016-08-26 22:43:17 +02:00
|
|
|
_g301_gameTimeTicking = true;
|
2016-06-18 17:18:01 +02:00
|
|
|
}
|
2016-05-03 17:55:04 +02:00
|
|
|
|
2016-08-26 22:47:44 +02:00
|
|
|
void DMEngine::f3_processNewPartyMap(uint16 mapIndex) {
|
2016-08-26 22:50:01 +02:00
|
|
|
_groupMan->f194_removeAllActiveGroups();
|
2016-08-26 22:47:44 +02:00
|
|
|
_dungeonMan->f174_setCurrentMapAndPartyMap(mapIndex);
|
|
|
|
_displayMan->f96_loadCurrentMapGraphics();
|
2016-08-26 22:50:01 +02:00
|
|
|
_groupMan->f195_addAllActiveGroups();
|
2016-07-07 00:46:51 +02:00
|
|
|
_inventoryMan->f337_setDungeonViewPalette();
|
2016-06-18 19:58:19 +02:00
|
|
|
}
|
|
|
|
|
2016-04-26 14:44:01 +02:00
|
|
|
Common::Error DMEngine::run() {
|
2016-06-29 23:17:04 +02:00
|
|
|
initArrays();
|
|
|
|
|
2016-06-18 17:18:01 +02:00
|
|
|
// scummvm/engine specific
|
2016-04-26 14:44:01 +02:00
|
|
|
initGraphics(320, 200, false);
|
|
|
|
_console = new Console(this);
|
2016-05-02 20:58:55 +02:00
|
|
|
_displayMan = new DisplayMan(this);
|
2016-05-03 17:55:04 +02:00
|
|
|
_dungeonMan = new DungeonMan(this);
|
2016-06-15 10:41:33 +02:00
|
|
|
_eventMan = new EventManager(this);
|
2016-06-17 14:29:05 +02:00
|
|
|
_menuMan = new MenuMan(this);
|
2016-06-18 11:36:31 +02:00
|
|
|
_championMan = new ChampionMan(this);
|
|
|
|
_loadsaveMan = new LoadsaveMan(this);
|
2016-06-19 00:54:28 +02:00
|
|
|
_objectMan = new ObjectMan(this);
|
2016-06-19 16:17:28 +02:00
|
|
|
_inventoryMan = new InventoryMan(this);
|
2016-06-22 20:32:30 +02:00
|
|
|
_textMan = new TextMan(this);
|
2016-06-30 15:48:23 +02:00
|
|
|
_movsens = new MovesensMan(this);
|
2016-08-26 22:41:19 +02:00
|
|
|
_groupMan = new GroupMan(this);
|
2016-06-30 19:59:35 +02:00
|
|
|
_timeline = new Timeline(this);
|
2016-07-07 00:46:51 +02:00
|
|
|
_projexpl = new ProjExpl(this);
|
2016-05-15 17:52:39 +02:00
|
|
|
_displayMan->setUpScreens(320, 200);
|
|
|
|
|
2016-08-26 22:47:44 +02:00
|
|
|
f463_initializeGame(); // @ F0463_START_InitializeGame_CPSADEF
|
2016-06-18 17:18:01 +02:00
|
|
|
while (true) {
|
2016-08-26 22:47:44 +02:00
|
|
|
f2_gameloop();
|
2016-07-11 11:37:01 +02:00
|
|
|
warning(false, "TODO: F0444_STARTEND_Endgame(G0303_B_PartyDead);");
|
2016-06-18 17:18:01 +02:00
|
|
|
}
|
2016-06-16 23:48:18 +02:00
|
|
|
|
2016-06-18 17:18:01 +02:00
|
|
|
return Common::kNoError;
|
|
|
|
}
|
2016-06-16 23:48:18 +02:00
|
|
|
|
2016-08-26 22:47:44 +02:00
|
|
|
void DMEngine::f2_gameloop() {
|
2016-07-11 11:37:01 +02:00
|
|
|
warning(false, "DUMMY CODE SETTING PARTY POS AND DIRECTION");
|
2016-07-02 13:47:19 +02:00
|
|
|
_dungeonMan->_g306_partyMapX = 10;
|
|
|
|
_dungeonMan->_g307_partyMapY = 4;
|
|
|
|
_dungeonMan->_g308_partyDir = kDirNorth;
|
2016-07-11 11:37:01 +02:00
|
|
|
warning(false, "DUMMY CODE: setting InventoryMan::_g432_inventoryChampionOrdinal to zero");
|
2016-07-02 12:57:31 +02:00
|
|
|
_inventoryMan->_g432_inventoryChampionOrdinal = 0;
|
2016-07-07 00:46:51 +02:00
|
|
|
|
2016-05-02 20:58:55 +02:00
|
|
|
while (true) {
|
2016-08-26 22:50:01 +02:00
|
|
|
if (_g327_newPartyMapIndex != kM1_mapIndexNone) {
|
2016-08-26 22:50:13 +02:00
|
|
|
T0002002:
|
2016-08-26 22:50:01 +02:00
|
|
|
f3_processNewPartyMap(_g327_newPartyMapIndex);
|
|
|
|
_movsens->f267_getMoveResult(Thing::_party, kM1_MapXNotOnASquare, 0, _dungeonMan->_g306_partyMapX, _dungeonMan->_g307_partyMapY);
|
|
|
|
_g327_newPartyMapIndex = kM1_mapIndexNone;
|
|
|
|
_eventMan->f357_discardAllInput();
|
|
|
|
}
|
2016-07-11 14:33:25 +02:00
|
|
|
_timeline->f261_processTimeline();
|
2016-08-26 22:50:01 +02:00
|
|
|
|
|
|
|
if (_g327_newPartyMapIndex != kM1_mapIndexNone)
|
|
|
|
goto T0002002;
|
|
|
|
|
2016-08-26 22:50:13 +02:00
|
|
|
if (!_inventoryMan->_g432_inventoryChampionOrdinal && !_championMan->_g300_partyIsSleeping) {
|
|
|
|
Box box(0, 223, 0, 135);
|
2016-08-26 22:50:30 +02:00
|
|
|
warning(false, "DUMMY CODE: clearing screen to black");
|
2016-08-26 22:50:13 +02:00
|
|
|
_displayMan->f135_fillBoxBitmap(_displayMan->_g296_bitmapViewport, box, k0_ColorBlack, k112_byteWidthViewport, k136_heightViewport); // dummy code
|
|
|
|
_displayMan->f128_drawDungeon(_dungeonMan->_g308_partyDir, _dungeonMan->_g306_partyMapX, _dungeonMan->_g307_partyMapY);
|
|
|
|
if (_g325_setMousePointerToObjectInMainLoop) {
|
|
|
|
_g325_setMousePointerToObjectInMainLoop = false;
|
|
|
|
_eventMan->f78_showMouse();
|
|
|
|
_eventMan->f68_setPointerToObject(_objectMan->_g412_objectIconForMousePointer);
|
|
|
|
_eventMan->f77_hideMouse();
|
2016-07-11 11:37:01 +02:00
|
|
|
|
2016-08-26 22:50:13 +02:00
|
|
|
}
|
|
|
|
if (_eventMan->_g326_refreshMousePointerInMainLoop) {
|
|
|
|
_eventMan->_g326_refreshMousePointerInMainLoop = false;
|
|
|
|
_eventMan->_g598_mousePointerBitmapUpdated = true;
|
|
|
|
_eventMan->f78_showMouse();
|
|
|
|
_eventMan->f77_hideMouse();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2016-08-26 22:50:01 +02:00
|
|
|
if (_championMan->_g303_partyDead)
|
|
|
|
break;
|
2016-07-07 00:46:51 +02:00
|
|
|
_g313_gameTime++;
|
2016-08-26 22:50:01 +02:00
|
|
|
|
|
|
|
if (!(_g313_gameTime & 511))
|
2016-07-11 15:20:00 +02:00
|
|
|
_inventoryMan->f338_decreaseTorchesLightPower();
|
2016-08-26 22:50:13 +02:00
|
|
|
if (_g310_disabledMovementTicks) {
|
|
|
|
_g310_disabledMovementTicks--;
|
|
|
|
}
|
2016-08-26 22:50:01 +02:00
|
|
|
if (_championMan->_g407_party._freezeLifeTicks) {
|
|
|
|
_championMan->_g407_party._freezeLifeTicks -= 1;
|
|
|
|
}
|
2016-08-26 22:47:44 +02:00
|
|
|
_menuMan->f390_refreshActionAreaAndSetChampDirMaxDamageReceived();
|
2016-08-26 22:38:51 +02:00
|
|
|
|
2016-07-07 00:46:51 +02:00
|
|
|
if (_g311_projectileDisableMovementTicks)
|
|
|
|
_g311_projectileDisableMovementTicks--;
|
|
|
|
|
|
|
|
_g321_stopWaitingForPlayerInput = false;
|
2016-06-17 14:29:05 +02:00
|
|
|
|
2016-07-11 14:55:56 +02:00
|
|
|
do {
|
|
|
|
_eventMan->processInput();
|
|
|
|
|
|
|
|
if (_g332_stopPressingEye) {
|
|
|
|
_g331_pressingEye = false;
|
|
|
|
_g332_stopPressingEye = false;
|
|
|
|
_inventoryMan->f353_drawStopPressingEye();
|
|
|
|
} else if (_g334_stopPressingMouth) {
|
|
|
|
_g333_pressingMouth = false;
|
|
|
|
_g334_stopPressingMouth = false;
|
|
|
|
_inventoryMan->f350_drawStopPressingMouth();
|
|
|
|
}
|
|
|
|
|
|
|
|
_eventMan->f380_processCommandQueue();
|
|
|
|
_displayMan->updateScreen();
|
|
|
|
// if (!_vm->_g321_stopWaitingForPlayerInput) {
|
|
|
|
warning(false, "MISSING CODE: F0363_COMMAND_HighlightBoxDisable");
|
|
|
|
// }
|
|
|
|
} while (!_g321_stopWaitingForPlayerInput || !_g301_gameTimeTicking);
|
2016-07-02 23:10:05 +02:00
|
|
|
|
2016-07-07 00:46:51 +02:00
|
|
|
_system->delayMillis(18);
|
2016-05-02 20:58:55 +02:00
|
|
|
}
|
2016-06-16 23:48:18 +02:00
|
|
|
}
|
|
|
|
|
2016-08-26 22:47:44 +02:00
|
|
|
int16 DMEngine::M1_ordinalToIndex(int16 val) {
|
2016-06-23 23:12:39 +02:00
|
|
|
return val - 1;
|
|
|
|
}
|
|
|
|
|
2016-08-26 22:47:44 +02:00
|
|
|
int16 DMEngine::M0_indexToOrdinal(int16 val) {
|
2016-06-23 23:12:39 +02:00
|
|
|
return val + 1;
|
|
|
|
}
|
|
|
|
|
2016-04-26 14:44:01 +02:00
|
|
|
} // End of namespace DM
|