aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--engines/dm/champion.cpp8
-rw-r--r--engines/dm/champion.h11
-rw-r--r--engines/dm/dm.cpp4
-rw-r--r--engines/dm/dm.h4
-rw-r--r--engines/dm/dungeonman.cpp8
-rw-r--r--engines/dm/eventman.cpp90
-rw-r--r--engines/dm/eventman.h2
-rw-r--r--engines/dm/inventory.cpp6
8 files changed, 111 insertions, 22 deletions
diff --git a/engines/dm/champion.cpp b/engines/dm/champion.cpp
index b246eccbac..03515a0a2a 100644
--- a/engines/dm/champion.cpp
+++ b/engines/dm/champion.cpp
@@ -38,12 +38,12 @@ namespace DM {
Box gBoxMouth = Box(55, 72, 12, 29); // @ G0048_s_Graphic562_Box_Mouth
Box gBoxEye = Box(11, 28, 12, 29); // @ G0049_s_Graphic562_Box_Eye
-Box gBoxChampionIcons[4] = { // @ G0054_ai_Graphic562_Box_ChampionIcons
+Box gBoxChampionIcons[4] = {
Box(281, 299, 0, 13),
Box(301, 319, 0, 13),
Box(301, 319, 15, 28),
Box(281, 299, 15, 28)};
-Color gChampionColor[4] = {(Color)7, (Color)11, (Color)8, (Color)14}; // @ G0046_auc_Graphic562_ChampionColor
+Color gChampionColor[4] = {(Color)7, (Color)11, (Color)8, (Color)14};
uint16 gSlotMasks[38] = { // @ G0038_ai_Graphic562_SlotMasks
/* 30 for champion inventory, 8 for chest */
@@ -265,8 +265,8 @@ void ChampionMan::addCandidateChampionToParty(uint16 championPortraitIndex) {
int16 mapY = _vm->_dungeonMan->_currMap._partyPosY;
uint16 championObjectsCell = returnOppositeDir((direction)(dunMan._currMap._partyDir));
- mapX += _dirIntoStepCountEast[dunMan._currMap._partyDir];
- mapY += _dirIntoStepCountNorth[dunMan._currMap._partyDir];
+ mapX += gDirIntoStepCountEast[dunMan._currMap._partyDir];
+ mapY += gDirIntoStepCountNorth[dunMan._currMap._partyDir];
thing = dunMan.getSquareFirstThing(mapX, mapY);
AL_0_slotIndex_Red = kChampionSlotBackpackLine_1_1;
uint16 slotIndex_Green;
diff --git a/engines/dm/champion.h b/engines/dm/champion.h
index 0610f2913d..1a89bc2add 100644
--- a/engines/dm/champion.h
+++ b/engines/dm/champion.h
@@ -35,6 +35,9 @@
namespace DM {
+extern Box gBoxChampionIcons[4]; // @ G0054_ai_Graphic562_Box_ChampionIcons
+extern Color gChampionColor[4]; // @ G0046_auc_Graphic562_ChampionColor
+
class Scent {
uint16 _scent;
public:
@@ -157,7 +160,7 @@ enum ChampionIndex {
kChampionSecond = 1,
kChampionThird = 2,
kChampionFourth = 3,
- kChmpionCloseInventory = 4, // @ C04_CHAMPION_CLOSE_INVENTORY
+ kChampionCloseInventory = 4, // @ C04_CHAMPION_CLOSE_INVENTORY
kChampionSpecialInventory = 5 // @ C05_CHAMPION_SPECIAL_INVENTORY
};
@@ -366,7 +369,7 @@ public:
void setSkillExp(ChampionSkill skill, int32 val) { _skills[skill]._experience = val; }
void setSkillTempExp(ChampionSkill skill, int16 val) { _skills[skill]._temporaryExperience= val; }
- byte getStatistic(ChampionStatisticType type, ChampionStatisticValue valType) { return _statistics[type][valType]; }
+ byte& getStatistic(ChampionStatisticType type, ChampionStatisticValue valType) { return _statistics[type][valType]; }
void setStatistic(ChampionStatisticType type, ChampionStatisticValue valType, byte newVal) { _statistics[type][valType] = newVal; }
uint16 getAttributes() { return _attributes; }
@@ -409,6 +412,10 @@ public:
_actionDefense = _food = _water = _load = _shieldDefense = 0;
memset(_portrait, 0, 464);
}
+ void resetSkillsToZero() {
+ for (int16 i = 0; i < 20; ++i)
+ _skills[i].resetToZero();
+ }
}; // @ CHAMPION_INCLUDING_PORTRAIT
class ChampionMan {
diff --git a/engines/dm/dm.cpp b/engines/dm/dm.cpp
index aa4290f0a8..a28c14c000 100644
--- a/engines/dm/dm.cpp
+++ b/engines/dm/dm.cpp
@@ -52,8 +52,8 @@
namespace DM {
-int8 _dirIntoStepCountEast[4] = {0 /* North */, 1 /* East */, 0 /* West */, -1 /* South */}; // @ G0233_ai_Graphic559_DirectionToStepEastCount
-int8 _dirIntoStepCountNorth[4] = {-1 /* North */, 0 /* East */, 1 /* West */, 0 /* South */}; // @ G0234_ai_Graphic559_DirectionToStepNorthCount
+int8 gDirIntoStepCountEast[4] = {0 /* North */, 1 /* East */, 0 /* West */, -1 /* South */}; // @ G0233_ai_Graphic559_DirectionToStepEastCount
+int8 gDirIntoStepCountNorth[4] = {-1 /* North */, 0 /* East */, 1 /* West */, 0 /* South */}; // @ G0234_ai_Graphic559_DirectionToStepNorthCount
void turnDirRight(direction &dir) { dir = (direction)((dir + 1) & 3); }
void turnDirLeft(direction &dir) { dir = (direction)((dir - 1) & 3); }
diff --git a/engines/dm/dm.h b/engines/dm/dm.h
index e9ab80fff9..5a7e548448 100644
--- a/engines/dm/dm.h
+++ b/engines/dm/dm.h
@@ -56,8 +56,8 @@ enum direction {
};
// TODO: refactor direction into a class
-extern int8 _dirIntoStepCountEast[4];
-extern int8 _dirIntoStepCountNorth[4];
+extern int8 gDirIntoStepCountEast[4];
+extern int8 gDirIntoStepCountNorth[4];
void turnDirRight(direction &dir);
void turnDirLeft(direction &dir);
diff --git a/engines/dm/dungeonman.cpp b/engines/dm/dungeonman.cpp
index ac38a07438..755a7d8cd7 100644
--- a/engines/dm/dungeonman.cpp
+++ b/engines/dm/dungeonman.cpp
@@ -360,11 +360,11 @@ CreatureInfo gCreatureInfo[kCreatureTypeCount] = { // @ G0243_as_Graphic559_Crea
{26, 0, 0x38AA, 0x0000, 12, 22, 255, 180, 210, 0, 130, 0x6369, 0xFF37, 0x0FBF, 0x0564, 0xFB52, 5}};
void DungeonMan::mapCoordsAfterRelMovement(direction dir, int16 stepsForward, int16 stepsRight, int16 &posX, int16 &posY) {
- posX += _dirIntoStepCountEast[dir] * stepsForward;
- posY += _dirIntoStepCountNorth[dir] * stepsForward;
+ posX += gDirIntoStepCountEast[dir] * stepsForward;
+ posY += gDirIntoStepCountNorth[dir] * stepsForward;
turnDirRight(dir);
- posX += _dirIntoStepCountEast[dir] * stepsRight;
- posY += _dirIntoStepCountNorth[dir] * stepsRight;
+ posX += gDirIntoStepCountEast[dir] * stepsRight;
+ posY += gDirIntoStepCountNorth[dir] * stepsRight;
}
DungeonMan::DungeonMan(DMEngine *dmEngine) : _vm(dmEngine), _rawDunFileData(NULL), _maps(NULL), _rawMapData(NULL) {
diff --git a/engines/dm/eventman.cpp b/engines/dm/eventman.cpp
index 680c621434..ca094210ec 100644
--- a/engines/dm/eventman.cpp
+++ b/engines/dm/eventman.cpp
@@ -32,6 +32,7 @@
#include "dungeonman.h"
#include "movesens.h"
#include "objectman.h"
+#include "inventory.h"
@@ -517,8 +518,8 @@ void EventManager::commandProcessType80ClickInDungeonViewTouchFrontWall() {
CurrMapData &currMap = dunMan._currMap;
uint16 mapX = currMap._partyPosX;
uint16 mapY = currMap._partyPosY;
- mapX += _dirIntoStepCountEast[currMap._partyDir];
- mapY += _dirIntoStepCountNorth[currMap._partyDir];
+ mapX += gDirIntoStepCountEast[currMap._partyDir];
+ mapY += gDirIntoStepCountNorth[currMap._partyDir];
if ((mapX >= 0)
&& (mapX < currMap._width)
&& (mapY >= 0)
@@ -542,8 +543,8 @@ void EventManager::commandProcessType80ClickInDungeonView(int16 posX, int16 posY
}
mapX = currMap._partyPosX;
mapY = currMap._partyPosY;
- mapX += _dirIntoStepCountEast[currMap._partyDir];
- mapY += _dirIntoStepCountNorth[currMap._partyDir];
+ mapX += gDirIntoStepCountEast[currMap._partyDir];
+ mapY += gDirIntoStepCountNorth[currMap._partyDir];
if (champMan._leaderEmptyHanded) {
if (Door(dunMan.getSquareFirstThingData(mapX, mapY)).hasButton() &&
@@ -564,7 +565,7 @@ void EventManager::commandProcessType80ClickInDungeonView(int16 posX, int16 posY
if (viewCell == kViewCellDoorButtonOrWallOrn) {
if (!dunMan._isFacingAlcove) {
commandProcessType80ClickInDungeonViewTouchFrontWall();
- }
+ }
} else {
warning("MISSING CODE: F0373_COMMAND_ProcessType80_ClickInDungeonView_GrabLeaderHandObject");
}
@@ -616,4 +617,83 @@ T0377019:
}
}
+void EventManager::commandProcessCommands160To162ClickInResurrectReincarnatePanel(CommandType commandType) {
+ ChampionMan &champMan = *_vm->_championMan;
+ InventoryMan &invMan = *_vm->_inventoryMan;
+ DisplayMan &dispMan = *_vm->_displayMan;
+ CurrMapData &currMap = _vm->_dungeonMan->_currMap;
+ DungeonMan &dunMan = *_vm->_dungeonMan;
+
+ uint16 championIndex = champMan._partyChampionCount - 1;
+ Champion *champ = &champMan._champions[championIndex];
+ if (commandType == kCommandClickInPanelCancel) {
+ invMan.toggleInventory(kChampionCloseInventory);
+ champMan._candidateChampionOrdinal = _vm->indexToOrdinal(kChampionNone);
+ if (champMan._partyChampionCount == 1) {
+ commandSetLeader(kChampionNone);
+ }
+ champMan._partyChampionCount--;
+ Box box;
+ box._y1 = 0;
+ box._y2 = 28 + 1;
+ box._x1 = championIndex * kChampionStatusBoxSpacing;
+ box._x2 = box._x1 + 66 + 1;
+ dispMan._useByteBoxCoordinates = false;
+ dispMan.clearScreenBox(kColorBlack, box);
+ dispMan.clearScreenBox(kColorBlack, gBoxChampionIcons[champMan.championIconIndex(champ->_cell, currMap._partyDir) * 2]);
+ warning("F0457_START_DrawEnabledMenus_CPSF");
+ warning("F0078_MOUSE_ShowPointer");
+ return;
+ }
+
+ champMan._candidateChampionOrdinal = _vm->indexToOrdinal(kChampionNone);
+ int16 mapX = currMap._partyPosX;
+ int16 mapY = currMap._partyPosY;
+
+ mapX += gDirIntoStepCountEast[currMap._partyDir];
+ mapY += gDirIntoStepCountNorth[currMap._partyDir];
+ for (uint16 slotIndex = kChampionSlotReadyHand; slotIndex < kChampionSlotChest_1; slotIndex++) {
+ Thing thing = champ->getSlot((ChampionSlot)slotIndex);
+ if (thing != Thing::_thingNone) {
+ warning("MISSING CODE: F0164_DUNGEON_UnlinkThingFromList");
+ }
+ }
+ Thing thing = dunMan.getSquareFirstThing(mapX, mapY);
+ for (;;) { // infinite
+ if (thing.getType() == kSensorThingType) {
+ ((Sensor*)dunMan.getThingData(thing))->setTypeDisabled();
+ break;
+ }
+ thing = dunMan.getNextThing(thing);
+ }
+
+ if (commandType == kCommandClickInPanelReincarnate) {
+ warning("MISSING CODE: F0281_CHAMPION_Rename");
+ champ->resetSkillsToZero();
+
+ for (uint16 i = 0; i < 12; i++) {
+ uint16 statIndex = _vm->_rnd->getRandomNumber(7);
+ champ->getStatistic((ChampionStatisticType)statIndex, kChampionStatCurrent)++; // returns reference
+ champ->getStatistic((ChampionStatisticType)statIndex, kChampionStatMaximum)++; // returns reference
+ }
+ }
+
+ if (champMan._partyChampionCount == 1) {
+ warning("MISSING CODE: setting time, G0362_l_LastPartyMovementTime , G0313_ul_GameTime");
+ commandSetLeader(kChampionFirst);
+ warning("MISSING CODE: F0394_MENUS_SetMagicCasterAndDrawSpellArea");
+ } else {
+ warning("MISSING CODE: F0393_MENUS_DrawSpellAreaControls");
+ }
+
+ warning("MISSING CODE: F0051_TEXT_MESSAGEAREA_PrintLineFeed");
+ Color champColor = gChampionColor[championIndex]; // unreferenced because of missing code
+ warning("MISSING CODE: F0047_TEXT_MESSAGEAREA_PrintMessage");
+ warning("MISSING CODE: F0047_TEXT_MESSAGEAREA_PrintMessage");
+
+ invMan.toggleInventory(kChampionCloseInventory);
+ warning("MISSING CODE: F0457_START_DrawEnabledMenus_CPSF");
+ warning("MISSING CODE: F0067_MOUSE_SetPointerToNormal");
+}
+
}; // end of namespace DM
diff --git a/engines/dm/eventman.h b/engines/dm/eventman.h
index 1a4d663714..fa4728741d 100644
--- a/engines/dm/eventman.h
+++ b/engines/dm/eventman.h
@@ -31,6 +31,7 @@
#include "common/events.h"
#include "common/queue.h"
+#include "dm.h"
#include "gfx.h"
#include "champion.h"
@@ -248,6 +249,7 @@ public:
void commandSetLeader(ChampionIndex index); // @ F0368_COMMAND_SetLeader
void commandProcessType80ClickInDungeonViewTouchFrontWall(); // @ F0372_COMMAND_ProcessType80_ClickInDungeonView_TouchFrontWall
void commandProcessType80ClickInDungeonView(int16 posX, int16 posY); // @ F0377_COMMAND_ProcessType80_ClickInDungeonView
+ void commandProcessCommands160To162ClickInResurrectReincarnatePanel(CommandType commandType); // @ F0282_CHAMPION_ProcessCommands160To162_ClickInResurrectReincarnatePanel
};
}
diff --git a/engines/dm/inventory.cpp b/engines/dm/inventory.cpp
index ab57883fbf..2fd4f4157c 100644
--- a/engines/dm/inventory.cpp
+++ b/engines/dm/inventory.cpp
@@ -53,14 +53,14 @@ void InventoryMan::toggleInventory(ChampionIndex championIndex) {
EventManager &em = *_vm->_eventMan;
DisplayMan &dm = *_vm->_displayMan;
- if ((championIndex == kChmpionCloseInventory) && !cm._champions[championIndex]._currHealth)
+ if ((championIndex == kChampionCloseInventory) && !cm._champions[championIndex]._currHealth)
return;
if (_vm->_pressingEye || _vm->_pressingMouth)
return;
_vm->_stopWaitingForPlayerInput = true;
int16 invChampOrdinal = _inventoryChampionOrdinal; // copy, as the original will be edited
if (_vm->indexToOrdinal(championIndex) == invChampOrdinal) {
- championIndex = kChmpionCloseInventory;
+ championIndex = kChampionCloseInventory;
}
Champion *champion;
@@ -75,7 +75,7 @@ void InventoryMan::toggleInventory(ChampionIndex championIndex) {
if (cm._partyIsSleeping) {
return;
}
- if (championIndex == kChmpionCloseInventory) {
+ if (championIndex == kChampionCloseInventory) {
em._refreshMousePointerInMainLoop = true;
_vm->_menuMan->drawMovementArrows();
em._secondaryMouseInput = gSecondaryMouseInput_Movement;