diff options
| author | Bendegúz Nagy | 2016-08-26 22:07:38 +0200 | 
|---|---|---|
| committer | Bendegúz Nagy | 2016-08-26 23:02:22 +0200 | 
| commit | 61500b3dc8253df3c62fada6ee6e5f297d67b33e (patch) | |
| tree | ad0ddb87c55fa2f7519595085a967782b456372c | |
| parent | c87e3ba0488b10c4dafa7c8d36e99938b22e216a (diff) | |
| download | scummvm-rg350-61500b3dc8253df3c62fada6ee6e5f297d67b33e.tar.gz scummvm-rg350-61500b3dc8253df3c62fada6ee6e5f297d67b33e.tar.bz2 scummvm-rg350-61500b3dc8253df3c62fada6ee6e5f297d67b33e.zip | |
DM: Add F0280_CHAMPION_AddCandidateChampionToParty
| -rw-r--r-- | engines/dm/champion.cpp | 221 | ||||
| -rw-r--r-- | engines/dm/champion.h | 12 | ||||
| -rw-r--r-- | engines/dm/dm.cpp | 1 | ||||
| -rw-r--r-- | engines/dm/dm.h | 1 | ||||
| -rw-r--r-- | engines/dm/dungeonman.h | 3 | ||||
| -rw-r--r-- | engines/dm/menus.cpp | 162 | 
6 files changed, 322 insertions, 78 deletions
| diff --git a/engines/dm/champion.cpp b/engines/dm/champion.cpp index 01f863732f..f93a9aa405 100644 --- a/engines/dm/champion.cpp +++ b/engines/dm/champion.cpp @@ -1,10 +1,54 @@  #include "champion.h"  #include "dungeonman.h" +#include "eventman.h" +#include "menus.h" +#include "inventory.h"  namespace DM { -Box gBoxChampionPortrait = Box(0, 31, 0, 28); // @ G0047_s_Graphic562_Box_ChampionPortrait  +uint16 gSlotMasks[38] = {  // @ G0038_ai_Graphic562_SlotMasks +	/* 30 for champion inventory, 8 for chest */ +	0xFFFF,   /* Ready Hand       Mouth/Head/Neck/Torso/Legs/Feet/Quiver 1/Quiver 2/Pouch/Hands/Chest */ +	0xFFFF,   /* Action Hand      Mouth/Head/Neck/Torso/Legs/Feet/Quiver 1/Quiver 2/Pouch/Hands/Chest */ +	0x0002,   /* Head             Head */ +	0x0008,   /* Torso            Torso */ +	0x0010,   /* Legs             Legs */ +	0x0020,   /* Feet             Feet */ +	0x0100,   /* Pouch 2          Pouch */ +	0x0080,   /* Quiver Line2 1   Quiver 2 */ +	0x0080,   /* Quiver Line1 2   Quiver 2 */ +	0x0080,   /* Quiver Line2 2   Quiver 2 */ +	0x0004,   /* Neck             Neck */ +	0x0100,   /* Pouch 1          Pouch */ +	0x0040,   /* Quiver Line1 1   Quiver 1 */ +	0xFFFF,   /* Backpack Line1 1 Mouth/Head/Neck/Torso/Legs/Feet/Quiver 1/Quiver 2/Pouch/Hands/Chest */ +	0xFFFF,   /* Backpack Line2 2 Mouth/Head/Neck/Torso/Legs/Feet/Quiver 1/Quiver 2/Pouch/Hands/Chest */ +	0xFFFF,   /* Backpack Line2 3 Mouth/Head/Neck/Torso/Legs/Feet/Quiver 1/Quiver 2/Pouch/Hands/Chest */ +	0xFFFF,   /* Backpack Line2 4 Mouth/Head/Neck/Torso/Legs/Feet/Quiver 1/Quiver 2/Pouch/Hands/Chest */ +	0xFFFF,   /* Backpack Line2 5 Mouth/Head/Neck/Torso/Legs/Feet/Quiver 1/Quiver 2/Pouch/Hands/Chest */ +	0xFFFF,   /* Backpack Line2 6 Mouth/Head/Neck/Torso/Legs/Feet/Quiver 1/Quiver 2/Pouch/Hands/Chest */ +	0xFFFF,   /* Backpack Line2 7 Mouth/Head/Neck/Torso/Legs/Feet/Quiver 1/Quiver 2/Pouch/Hands/Chest */ +	0xFFFF,   /* Backpack Line2 8 Mouth/Head/Neck/Torso/Legs/Feet/Quiver 1/Quiver 2/Pouch/Hands/Chest */ +	0xFFFF,   /* Backpack Line2 9 Mouth/Head/Neck/Torso/Legs/Feet/Quiver 1/Quiver 2/Pouch/Hands/Chest */ +	0xFFFF,   /* Backpack Line1 2 Mouth/Head/Neck/Torso/Legs/Feet/Quiver 1/Quiver 2/Pouch/Hands/Chest */ +	0xFFFF,   /* Backpack Line1 3 Mouth/Head/Neck/Torso/Legs/Feet/Quiver 1/Quiver 2/Pouch/Hands/Chest */ +	0xFFFF,   /* Backpack Line1 4 Mouth/Head/Neck/Torso/Legs/Feet/Quiver 1/Quiver 2/Pouch/Hands/Chest */ +	0xFFFF,   /* Backpack Line1 5 Mouth/Head/Neck/Torso/Legs/Feet/Quiver 1/Quiver 2/Pouch/Hands/Chest */ +	0xFFFF,   /* Backpack Line1 6 Mouth/Head/Neck/Torso/Legs/Feet/Quiver 1/Quiver 2/Pouch/Hands/Chest */ +	0xFFFF,   /* Backpack Line1 7 Mouth/Head/Neck/Torso/Legs/Feet/Quiver 1/Quiver 2/Pouch/Hands/Chest */ +	0xFFFF,   /* Backpack Line1 8 Mouth/Head/Neck/Torso/Legs/Feet/Quiver 1/Quiver 2/Pouch/Hands/Chest */ +	0xFFFF,   /* Backpack Line1 9 Mouth/Head/Neck/Torso/Legs/Feet/Quiver 1/Quiver 2/Pouch/Hands/Chest */ +	0x0400,   /* Chest 1          Chest */ +	0x0400,   /* Chest 2          Chest */ +	0x0400,   /* Chest 3          Chest */ +	0x0400,   /* Chest 4          Chest */ +	0x0400,   /* Chest 5          Chest */ +	0x0400,   /* Chest 6          Chest */ +	0x0400,   /* Chest 7          Chest */ +	0x0400}; /* Chest 8          Chest */ + +Box gBoxChampionPortrait = {0, 31, 0, 28}; // @ G0047_s_Graphic562_Box_ChampionPortrait   ChampionMan::ChampionMan(DMEngine *vm) : _vm(vm) {  	_leaderIndex = kChampionNone; @@ -37,7 +81,7 @@ ChampionIndex ChampionMan::getIndexInCell(ViewCell cell) {  void ChampionMan::resetDataToStartGame() {  	if (!_vm->_dungeonMan->_messages._newGame) { -		warning("MISSING CODE: stuff for resetting for loaded games"); +		warning("MISSING CODE: stuff for reeseting for loaded games");  		assert(false);  	} @@ -46,4 +90,177 @@ void ChampionMan::resetDataToStartGame() {  	_leaderEmptyHanded = true;  } + +void ChampionMan::addCandidateChampionToParty(uint16 championPortraitIndex) { +	DisplayMan &dispMan = *_vm->_displayMan; +	DungeonMan &dunMan = *_vm->_dungeonMan; + +	if (!_leaderEmptyHanded || _partyChampionCount == 4) +		return; + +	uint16 prevChampCount = _partyChampionCount; +	Champion *champ = &_champions[prevChampCount]; +	warning("MISSING CODE: Fill champ memory with zero bytes"); +	dispMan._useByteBoxCoordinates = true; +	{ // block on purpose +		Box &destBox = gBoxChampionPortrait; +		dispMan.blitToBitmap(dispMan.getBitmap(kChampionPortraitsIndice), 256, getChampionPortraitX(championPortraitIndex), getChampionPortraitY(championPortraitIndex), +							 champ->_portrait, 32, destBox._x1, destBox._x2, destBox._y1, destBox._y2, kColorNoTransparency); +	} + +	champ->_actionIndex = kChampionActionNone; +	champ->_enableActionEventIndex = -1; +	champ->_hideDamageReceivedIndex = -1; +	champ->_dir = dunMan._currMap._partyDir; +	ViewCell AL_0_viewCell = kViewCellFronLeft; +	while (getIndexInCell((ViewCell)((AL_0_viewCell + dunMan._currMap._partyDir) & 3)) != kChampionNone) +		AL_0_viewCell = (ViewCell)(AL_0_viewCell + 1); +	champ->_cell = (ViewCell)((AL_0_viewCell + dunMan._currMap._partyDir) & 3); +	champ->clearAttributes(kChampionAttributeIcon); +	champ->_directionMaximumDamageReceived = dunMan._currMap._partyDir; +	champ->_food = 1500 + _vm->_rnd->getRandomNumber(256); +	champ->_water = 1500 + _vm->_rnd->getRandomNumber(256); +	int16 AL_0_slotIndex_Red; +	for (AL_0_slotIndex_Red = kChampionSlotReadyHand; AL_0_slotIndex_Red < kChampionSlotChest_1; ++AL_0_slotIndex_Red) { +		champ->setSlot((ChampionSlot)AL_0_slotIndex_Red, Thing::_thingNone); +	} +	Thing thing = dunMan.getSquareFirstThing(dunMan._currMap._partyPosX, dunMan._currMap._partyPosY); +	while (thing.getType() != kTextstringType) { +		thing = dunMan.getNextThing(thing); +	} +	char decodedChampionText[77]; +	char* character_Green = decodedChampionText; +	dunMan.decodeText(character_Green, thing, (TextType)(kTextTypeScroll | kDecodeEvenIfInvisible)); +	int16 AL_0_characterIndex = 0; +	uint16 AL_2_character; +	while ((AL_2_character = *character_Green++) != '\n') { +		champ->_name[AL_0_characterIndex++] = AL_2_character; +	} +	champ->_name[AL_0_characterIndex] = '\0'; +	AL_0_characterIndex = 0; +	bool AL_4_champTitleCopied = false; +	for (;;) { // infinite +		AL_2_character = *character_Green++; +		if (AL_2_character == '\n') { +			if (AL_4_champTitleCopied) +				break; +			AL_4_champTitleCopied = true; +		} else { +			champ->_title[AL_0_characterIndex++] = AL_2_character; +		} +	} +	champ->_title[AL_0_characterIndex] = '\0'; +	if (*character_Green++ == 'M') { +		champ->setAttributeFlag(kChampionAttributeMale, true); +	} +	character_Green++; +	champ->_currHealth = champ->_maxHealth = getDecodedValue(character_Green, 4); +	character_Green += 4; +	champ->_currStamina = champ->_maxStamina = getDecodedValue(character_Green, 4); +	character_Green += 4; +	character_Green++; + +	int16 AL_0_statisticIndex; +	for (AL_0_statisticIndex = kChampionStatLuck; AL_0_statisticIndex <= kChampionStatAntifire; ++AL_0_statisticIndex) { +		champ->setStatistic((ChampionStatisticType)AL_0_statisticIndex, kChampionStatMinimum, 30); +		uint16 currMaxVal = getDecodedValue(character_Green, 2); +		champ->setStatistic((ChampionStatisticType)AL_0_statisticIndex, kChampionStatCurrent, currMaxVal); +		champ->setStatistic((ChampionStatisticType)AL_0_statisticIndex, kChampionStatMaximum, currMaxVal); +		character_Green += 2; +	} + +	champ->setStatistic(kChampionStatLuck, kChampionStatMinimum, 10); +	character_Green++; + +	int16 AL_0_skillIndex; +	int16 AL_2_skillValue; +	for (AL_0_skillIndex = kChampionSkillSwing; AL_0_skillIndex <= kChampionSkillWater; AL_0_skillIndex++) { +		if ((AL_2_skillValue = *character_Green++ - 'A') > 0) { +			champ->setSkillExp((ChampionSkill)AL_0_skillIndex, 125L << AL_2_skillValue); +		} +	} + +	for (AL_0_skillIndex = kChampionSkillFighter; AL_0_skillIndex <= kChampionSkillWizard; ++AL_0_skillIndex) { +		int32 baseSkillExp = 0; +		int16 hiddenSkillIndex = (AL_0_skillIndex + 1) << 2; +		for (uint16 AL_4_hiddenSkillCounter = 0; AL_4_hiddenSkillCounter < 4; ++AL_4_hiddenSkillCounter) { +			baseSkillExp += champ->getSkill((ChampionSkill)(hiddenSkillIndex + AL_4_hiddenSkillCounter))._experience; +		} +		champ->setSkillExp((ChampionSkill)AL_0_skillIndex, baseSkillExp); +	} + +	_candidateChampionOrdinal = prevChampCount + 1; +	if (++_partyChampionCount == 1) { +		_vm->_eventMan->commandSetLeader(kChampionFirst); +		_vm->_menuMan->_shouldRefreshActionArea = true; +	} else { +		_vm->_menuMan->clearActingChampion(); +		_vm->_menuMan->drawActionIcon((ChampionIndex)(_partyChampionCount - 1)); +	} + +	int16 mapX = _vm->_dungeonMan->_currMap._partyPosX; +	int16 mapY = _vm->_dungeonMan->_currMap._partyPosY; + +	uint16 championObjectsCell = returnOppositeDir((direction)(dunMan._currMap._partyDir)); +	mapX += dirIntoStepCountEast[dunMan._currMap._partyDir]; +	mapY += dirIntoStepCountNorth[dunMan._currMap._partyDir]; +	thing = dunMan.getSquareFirstThing(mapX, mapY); +	AL_0_slotIndex_Red = kChampionSlotBackpackLine_1_1; +	uint16 slotIndex_Green; +	while (thing != Thing::_thingNone) { +		ThingType AL_2_thingType = thing.getType(); +		if ((AL_2_thingType > kSensorThingType) && (thing.getCell() == championObjectsCell)) { +			int16 objectAllowedSlots = gObjectInfo[dunMan.getObjectInfoIndex(thing)].getAllowedSlots(); +			switch (AL_2_thingType) { +			case kArmourThingType: +				for (slotIndex_Green = kChampionSlotHead; slotIndex_Green <= kChampionSlotFeet; slotIndex_Green++) { +					if (objectAllowedSlots & gSlotMasks[slotIndex_Green]) +						goto T0280048; +				} +				if ((objectAllowedSlots & gSlotMasks[kChampionSlotNeck]) && (champ->getSlot(kChampionSlotNeck) == Thing::_thingNone)) { +					slotIndex_Green = kChampionSlotNeck; +				} else { +					goto T0280046; +				} +				break; +			case kWeaponThingType: +				if (champ->getSlot(kChampionSlotActionHand) == Thing::_thingNone) { +					slotIndex_Green = kChampionSlotActionHand; +				} else { +					goto T0280046; +				} +				break; +			case kScrollThingType: +			case kPotionThingType: +				if (champ->getSlot(kChampionSlotPouch_1) == Thing::_thingNone) { +					slotIndex_Green = kChampionSlotPouch_1; +				} else if (champ->getSlot(kChampionSlotPouch_2) == Thing::_thingNone) { +					slotIndex_Green = kChampionSlotPouch_2; +				} else { +					goto T0280046; +				} +				break; +			case kContainerThingType: +			case kJunkThingType: +T0280046: +				if ((objectAllowedSlots & gSlotMasks[kChampionSlotNeck]) && (champ->getSlot(kChampionSlotNeck) == Thing::_thingNone)) { +					slotIndex_Green = kChampionSlotNeck; +				} else { +					slotIndex_Green = AL_0_slotIndex_Red++; +				} +				break; +			} +T0280048: +			if (champ->getSlot((ChampionSlot)slotIndex_Green) != Thing::_thingNone) { +				goto T0280046; +			} +			warning("MISSING CODE: F0301_CHAMPION_AddObjectInSlot"); +		} +		thing = dunMan.getNextThing(thing); +	} + +	_vm->_inventoryMan->toggleInventory((ChampionIndex)prevChampCount); +	_vm->_menuMan->drawDisabledMenu(); +} +  }
\ No newline at end of file diff --git a/engines/dm/champion.h b/engines/dm/champion.h index 0c8a46fae0..96a5ef563a 100644 --- a/engines/dm/champion.h +++ b/engines/dm/champion.h @@ -251,8 +251,9 @@ enum ChampionAction {  class Skill { -	int _temporaryExperience; -	long _experience; +public: +	int16 _temporaryExperience; +	int32 _experience;  }; // @ SKILL  class Champion { @@ -291,7 +292,8 @@ public:  	void setSlot(ChampionSlot slot, Thing val) { _slots[slot] = val; }  	Skill getSkill(ChampionSkill skill) { return _skills[skill]; } -	void setSkill(ChampionSkill skill, Skill val) { _skills[skill] = val; } +	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]; }  	void setStatistic(ChampionStatisticType type, ChampionStatisticValue valType, byte newVal) { _statistics[type][valType] = newVal; } @@ -305,7 +307,7 @@ public:  			_attributes &= ~flag;  		}  	} -	void clearAttributes() { _attributes = kChampionAttributNone; } +	void clearAttributes(ChampionAttribute attribute = kChampionAttributNone) { _attributes = attribute; }  	uint16 getWounds() { return _wounds; }  	void setWoundsFlag(ChampionWound flag, bool value) { @@ -340,8 +342,10 @@ public:  	ChampionMan(DMEngine *vm);  	void resetDataToStartGame(); // @ F0278_CHAMPION_ResetDataToStartGame +	void addCandidateChampionToParty(uint16 championPortraitIndex); // @ F0280_CHAMPION_AddCandidateChampionToParty  }; +  }  #endif diff --git a/engines/dm/dm.cpp b/engines/dm/dm.cpp index 63ddf12be2..860fba2af6 100644 --- a/engines/dm/dm.cpp +++ b/engines/dm/dm.cpp @@ -28,6 +28,7 @@ int8 dirIntoStepCountNorth[4] = {-1 /* North */, 0 /* East */, 1 /* West */, 0 /  void turnDirRight(direction &dir) { dir = (direction)((dir + 1) & 3); }  void turnDirLeft(direction &dir) { dir = (direction)((dir - 1) & 3); } +direction returnOppositeDir(direction dir) { return (direction)((dir + 2) & 3); }  bool isOrientedWestEast(direction dir) { return dir & 1; } diff --git a/engines/dm/dm.h b/engines/dm/dm.h index 66be764bbc..61cb92c2c0 100644 --- a/engines/dm/dm.h +++ b/engines/dm/dm.h @@ -32,6 +32,7 @@ extern int8 dirIntoStepCountNorth[4];  void turnDirRight(direction &dir);  void turnDirLeft(direction &dir); +direction returnOppositeDir(direction dir);  bool isOrientedWestEast(direction dir); diff --git a/engines/dm/dungeonman.h b/engines/dm/dungeonman.h index 41a39739f8..ad64b85084 100644 --- a/engines/dm/dungeonman.h +++ b/engines/dm/dungeonman.h @@ -33,6 +33,7 @@ public:  	ObjectInfo(int16 type, uint16 objectAspectIndex, uint16 actionSetIndex, uint16 allowedSlots)  		: _type(type), _objectAspectIndex(objectAspectIndex), _actionSetIndex(actionSetIndex), _allowedSlots(allowedSlots) {}  	bool getAllowedSlot(ObjectAllowedSlot slot) { return _allowedSlots & slot; } +	uint16 getAllowedSlots() { return _allowedSlots; }  	void setAllowedSlot(ObjectAllowedSlot slot, bool val) {  		if (val) {  			_allowedSlots |= slot; @@ -566,7 +567,6 @@ class DungeonMan {  	void decompressDungeonFile(); // @ F0455_FLOPPY_DecompressDungeon  	int16 getSquareFirstThingIndex(int16 mapX, int16 mapY); // @ F0160_DUNGEON_GetSquareFirstThingIndex -	Thing getSquareFirstThing(int16 mapX, int16 mapY); // @ F0161_DUNGEON_GetSquareFirstThing  	int16 getRandomOrnOrdinal(bool allowed, int16 count, int16 mapX, int16 mapY, int16 modulo); // @ F0170_DUNGEON_GetRandomOrnamentOrdinal  	void setSquareAspectOrnOrdinals(uint16 *aspectArray, bool leftAllowed, bool frontAllowed, bool rightAllowed, direction dir, @@ -579,6 +579,7 @@ public:  	DungeonMan(DMEngine *dmEngine);  	~DungeonMan(); +	Thing getSquareFirstThing(int16 mapX, int16 mapY); // @ F0161_DUNGEON_GetSquareFirstThing  	Thing getNextThing(Thing thing); // @ F0159_DUNGEON_GetNextThing(THING P0280_T_Thing)  	uint16 *getThingData(Thing thing); // @ unsigned char* F0156_DUNGEON_GetThingData(register THING P0276_T_Thing) diff --git a/engines/dm/menus.cpp b/engines/dm/menus.cpp index 1d8b00cbc7..d39aa22a1a 100644 --- a/engines/dm/menus.cpp +++ b/engines/dm/menus.cpp @@ -1,71 +1,91 @@ -#include "menus.h"
 -#include "gfx.h"
 -#include "champion.h"
 -#include "dungeonman.h"
 -#include "objectman.h"
 -#include "inventory.h"
 -
 -
 -namespace DM {
 -
 -byte gPalChangesActionAreaObjectIcon[16] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 40, 0, 0, 0}; // @ G0498_auc_Graphic560_PaletteChanges_ActionAreaObjectIcon
 -
 -MenuMan::MenuMan(DMEngine *vm) : _vm(vm) {}
 -
 -void MenuMan::drawMovementArrows() {
 -	DisplayMan &disp = *_vm->_displayMan;
 -	byte *arrowsBitmap = disp.getBitmap(kMovementArrowsIndice);
 -	Box &dest = gBoxMovementArrows;
 -	uint16 w = disp.getWidth(kMovementArrowsIndice);
 -
 -	disp.blitToScreen(arrowsBitmap, w, 0, 0, dest._x1, dest._x2, dest._y1, dest._y2, kColorNoTransparency);
 -}
 -void MenuMan::clearActingChampion() {
 -	ChampionMan &cm = *_vm->_championMan;
 -	if (cm._actingChampionOrdinal) {
 -		cm._actingChampionOrdinal--;
 -		cm._champions[cm._actingChampionOrdinal].setAttributeFlag(kChampionAttributeActionHand, true);
 -		warning("MISSING CODE: F0292_CHAMPION_DrawState");
 -		cm._actingChampionOrdinal = indexToOrdinal(kChampionNone);
 -		_shouldRefreshActionArea = true;
 -	}
 -}
 -
 -void MenuMan::drawActionIcon(ChampionIndex championIndex) {
 -	if (!_actionAreaContainsIcons)
 -		return;
 -	DisplayMan &dm = *_vm->_displayMan;
 -	Champion &champion = _vm->_championMan->_champions[championIndex];
 -
 -	Box box;
 -	box._x1 = championIndex * 22 + 233;
 -	box._x2 = box._x1 + 19 + 1;
 -	box._y1 = 86;
 -	box._y2 = 120 + 1;
 -	dm._useByteBoxCoordinates = false;
 -	if (!champion._currHealth) {
 -		dm.clearScreenBox(kColorBlack, box);
 -		return;
 -	}
 -	byte *bitmapIcon = dm._tmpBitmap;
 -	Thing thing = champion.getSlot(kChampionSlotActionHand);
 -	IconIndice iconIndex;
 -	if (thing == Thing::_thingNone) {
 -		iconIndex = kIconIndiceActionEmptyHand;
 -	} else if (gObjectInfo[_vm->_dungeonMan->getObjectInfoIndex(thing)]._actionSetIndex) {
 -		iconIndex = _vm->_objectMan->getIconIndex(thing);
 -	} else {
 -		dm.clearBitmap(bitmapIcon, 16, 16, kColorCyan);
 -		goto T0386006;
 -	}
 -	_vm->_objectMan->extractIconFromBitmap(iconIndex, bitmapIcon);
 -	dm.blitToBitmapShrinkWithPalChange(bitmapIcon, 16, 16, bitmapIcon, 16, 16, gPalChangesActionAreaObjectIcon);
 -T0386006:
 -	dm.clearScreenBox(kColorCyan, box);
 -	Box box2;
 -	box2._x1 = box._x1 + 2;
 -	box2._x2 = box._x2 - 2; // no need to add +1 for exclusive boundaries, box already has that
 -	box2._y1 = 95;
 -	box2._y2 = 110 + 1;
 -	dm.blitToScreen(bitmapIcon, 16, 0, 0, box2._x1, box2._x2, box2._y1, box2._y2);
 -	if (champion.getAttributes(kChampionAttributeDisableAction) || _vm->_championMan->_candidateChampionOrdinal || _vm->_championMan->_partyIsSleeping) {
		warning("MISSING CODE: F0136_VIDEO_ShadeScreenBox");
	}
}
void MenuMan::drawDisabledMenu() {
	if (!_vm->_championMan->_partyIsSleeping) {
		warning("MISSING CODE: F0363_COMMAND_HighlightBoxDisable");
		_vm->_displayMan->_useByteBoxCoordinates = false;
		if (_vm->_inventoryMan->_inventoryChampionOrdinal) {
			warning("MISSING CODE: F0334_INVENTORY_CloseChest");
		} else {
			warning("MISSING CODE: F0136_VIDEO_ShadeScreenBox");
		}
		warning("MISSING CODE: F0136_VIDEO_ShadeScreenBox");
		warning("MISSING CODE: F0136_VIDEO_ShadeScreenBox");
		warning("MISSING CODE: F0067_MOUSE_SetPointerToNormal");
	}
}
}
\ No newline at end of file +#include "menus.h" +#include "gfx.h" +#include "champion.h" +#include "dungeonman.h" +#include "objectman.h" +#include "inventory.h" + + +namespace DM { + +byte gPalChangesActionAreaObjectIcon[16] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 40, 0, 0, 0}; // @ G0498_auc_Graphic560_PaletteChanges_ActionAreaObjectIcon + +MenuMan::MenuMan(DMEngine *vm) : _vm(vm) {} + +void MenuMan::drawMovementArrows() { +	DisplayMan &disp = *_vm->_displayMan; +	byte *arrowsBitmap = disp.getBitmap(kMovementArrowsIndice); +	Box &dest = gBoxMovementArrows; +	uint16 w = disp.getWidth(kMovementArrowsIndice); + +	disp.blitToScreen(arrowsBitmap, w, 0, 0, dest._x1, dest._x2, dest._y1, dest._y2, kColorNoTransparency); +} +void MenuMan::clearActingChampion() { +	ChampionMan &cm = *_vm->_championMan; +	if (cm._actingChampionOrdinal) { +		cm._actingChampionOrdinal--; +		cm._champions[cm._actingChampionOrdinal].setAttributeFlag(kChampionAttributeActionHand, true); +		warning("MISSING CODE: F0292_CHAMPION_DrawState"); +		cm._actingChampionOrdinal = indexToOrdinal(kChampionNone); +		_shouldRefreshActionArea = true; +	} +} + +void MenuMan::drawActionIcon(ChampionIndex championIndex) { +	if (!_actionAreaContainsIcons) +		return; +	DisplayMan &dm = *_vm->_displayMan; +	Champion &champion = _vm->_championMan->_champions[championIndex]; + +	Box box; +	box._x1 = championIndex * 22 + 233; +	box._x2 = box._x1 + 19 + 1; +	box._y1 = 86; +	box._y2 = 120 + 1; +	dm._useByteBoxCoordinates = false; +	if (!champion._currHealth) { +		dm.clearScreenBox(kColorBlack, box); +		return; +	} +	byte *bitmapIcon = dm._tmpBitmap; +	Thing thing = champion.getSlot(kChampionSlotActionHand); +	IconIndice iconIndex; +	if (thing == Thing::_thingNone) { +		iconIndex = kIconIndiceActionEmptyHand; +	} else if (gObjectInfo[_vm->_dungeonMan->getObjectInfoIndex(thing)]._actionSetIndex) { +		iconIndex = _vm->_objectMan->getIconIndex(thing); +	} else { +		dm.clearBitmap(bitmapIcon, 16, 16, kColorCyan); +		goto T0386006; +	} +	_vm->_objectMan->extractIconFromBitmap(iconIndex, bitmapIcon); +	dm.blitToBitmapShrinkWithPalChange(bitmapIcon, 16, 16, bitmapIcon, 16, 16, gPalChangesActionAreaObjectIcon); +T0386006: +	dm.clearScreenBox(kColorCyan, box); +	Box box2; +	box2._x1 = box._x1 + 2; +	box2._x2 = box._x2 - 2; // no need to add +1 for exclusive boundaries, box already has that +	box2._y1 = 95; +	box2._y2 = 110 + 1; +	dm.blitToScreen(bitmapIcon, 16, 0, 0, box2._x1, box2._x2, box2._y1, box2._y2); +	if (champion.getAttributes(kChampionAttributeDisableAction) || _vm->_championMan->_candidateChampionOrdinal || _vm->_championMan->_partyIsSleeping) { +		warning("MISSING CODE: F0136_VIDEO_ShadeScreenBox"); +	} +} + +void MenuMan::drawDisabledMenu() { +	if (!_vm->_championMan->_partyIsSleeping) { +		warning("MISSING CODE: F0363_COMMAND_HighlightBoxDisable"); +		_vm->_displayMan->_useByteBoxCoordinates = false; +		if (_vm->_inventoryMan->_inventoryChampionOrdinal) { +			warning("MISSING CODE: F0334_INVENTORY_CloseChest"); +		} else { +			warning("MISSING CODE: F0136_VIDEO_ShadeScreenBox"); +		} +		warning("MISSING CODE: F0136_VIDEO_ShadeScreenBox"); +		warning("MISSING CODE: F0136_VIDEO_ShadeScreenBox"); +		warning("MISSING CODE: F0067_MOUSE_SetPointerToNormal"); +	} +} + +}
\ No newline at end of file | 
