Skip to content

Commit

Permalink
DM: Fix some GCC warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
Strangerke authored and Bendegúz Nagy committed Aug 26, 2016
1 parent efac7b5 commit b4b7604
Show file tree
Hide file tree
Showing 7 changed files with 108 additions and 101 deletions.
78 changes: 44 additions & 34 deletions engines/dm/champion.cpp
Expand Up @@ -41,16 +41,6 @@

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 g54_BoxChampionIcons[4] = {
Box(281, 299, 0, 13),
Box(301, 319, 0, 13),
Box(301, 319, 15, 28),
Box(281, 299, 15, 28)};
Color g46_ChampionColor[4] = {(Color)7, (Color)11, (Color)8, (Color)14};

int16 g39_LightPowerToLightAmount[16] = {0, 5, 12, 24, 33, 40, 46, 51, 59, 68, 76, 82, 89, 94, 97, 100};

uint16 gSlotMasks[38] = { // @ G0038_ai_Graphic562_SlotMasks
Expand Down Expand Up @@ -99,20 +89,37 @@ Box gBoxChampionPortrait = Box(0, 31, 0, 28); // @ G0047_s_Graphic562_Box_Champi
const char *g417_baseSkillName[4];

void ChampionMan::initConstants() {
{
static const char *g417_baseSkillName_EN_ANY[4] = {"FIGHTER", "NINJA", "PRIEST", "WIZARD"};
static const char *g417_baseSkillName_DE_DEU[4] = {"KAEMPFER", "NINJA", "PRIESTER", "MAGIER"};
static const char *g417_baseSkillName_FR_FRA[4] = {"GUERRIER", "NINJA", "PRETRE", "SORCIER"};
static const char *g417_baseSkillName_EN_ANY[4] = {"FIGHTER", "NINJA", "PRIEST", "WIZARD"};
static const char *g417_baseSkillName_DE_DEU[4] = {"KAEMPFER", "NINJA", "PRIESTER", "MAGIER"};
static const char *g417_baseSkillName_FR_FRA[4] = {"GUERRIER", "NINJA", "PRETRE", "SORCIER"};
static Box boxChampionIcons[4] = {
Box(281, 299, 0, 13),
Box(301, 319, 0, 13),
Box(301, 319, 15, 28),
Box(281, 299, 15, 28)
};

const char **g417_byLanguage;
switch (_vm->getGameLanguage()) { // localized
default:
case Common::EN_ANY: g417_byLanguage = g417_baseSkillName_EN_ANY; break;
case Common::DE_DEU: g417_byLanguage = g417_baseSkillName_DE_DEU; break;
case Common::FR_FRA: g417_byLanguage = g417_baseSkillName_FR_FRA; break;
}
for (int i = 0; i < 4; ++i)
g417_baseSkillName[i] = g417_byLanguage[i];
static Color championColor[4] = {(Color)7, (Color)11, (Color)8, (Color)14};

const char **g417_byLanguage;
switch (_vm->getGameLanguage()) { // localized
case Common::EN_ANY:
g417_byLanguage = g417_baseSkillName_EN_ANY;
break;
case Common::DE_DEU:
g417_byLanguage = g417_baseSkillName_DE_DEU;
break;
case Common::FR_FRA:
g417_byLanguage = g417_baseSkillName_FR_FRA;
break;
default:
error("Unexpected language used");
}

for (int i = 0; i < 4; ++i) {
g417_baseSkillName[i] = g417_byLanguage[i];
_championColor[i] = championColor[i];
_boxChampionIcons[i] = boxChampionIcons[i];
}
}

Expand All @@ -139,9 +146,9 @@ ChampionMan::ChampionMan(DMEngine *vm) : _vm(vm) {
}

bool ChampionMan::f329_isLeaderHandObjectThrown(int16 side) {
if (_g411_leaderIndex == kM1_ChampionNone) {
if (_g411_leaderIndex == kM1_ChampionNone)
return false;
}

return f328_isObjectThrown(_g411_leaderIndex, kM1_ChampionSlotLeaderHand, side);
}

Expand Down Expand Up @@ -459,7 +466,7 @@ void ChampionMan::f296_drawChangedObjectIcons() {
}
}

if (invMan._g424_panelContent = k4_PanelContentChest) {
if (invMan._g424_panelContent == k4_PanelContentChest) {
thing = invMan._g425_chestSlots;
for (int16 slotIndex = 0; slotIndex < 8; ++slotIndex, thing++) {
drawViewport |= (f295_hasObjectIconInSlotBoxChanged(slotIndex + k38_SlotBoxChestFirstSlot, *thing) ? 1 : 0);
Expand Down Expand Up @@ -512,7 +519,7 @@ void ChampionMan::f301_addObjectInSlot(ChampionIndex champIndex, Thing thing, Ch
}
}

if (iconIndex = k4_IconIndiceWeaponTorchUnlit) {
if (iconIndex == k4_IconIndiceWeaponTorchUnlit) {
((Weapon *)rawObjPtr)->setLit(true);
_vm->_inventoryMan->f337_setDungeonViewPalette();
f296_drawChangedObjectIcons();
Expand Down Expand Up @@ -988,7 +995,7 @@ void ChampionMan::f304_addSkillExperience(uint16 champIndex, uint16 skillIndex,
setFlag(curChampion->_attributes, k0x0100_ChampionAttributeStatistics);
f292_drawChampionState((ChampionIndex)champIndex);
_vm->_textMan->f51_messageAreaPrintLineFeed();
Color curChampionColor = g46_ChampionColor[champIndex];
Color curChampionColor = _championColor[champIndex];
_vm->_textMan->f47_messageAreaPrintMessage(curChampionColor, curChampion->_name);

switch (_vm->getGameLanguage()) { // localized
Expand Down Expand Up @@ -1449,7 +1456,7 @@ void ChampionMan::f319_championKill(uint16 champIndex) {
f323_unpoison(champIndex);

_vm->_displayMan->_g578_useByteBoxCoordinates = false;
_vm->_displayMan->D24_fillScreenBox(g54_BoxChampionIcons[curChampionIconIndex], k0_ColorBlack);
_vm->_displayMan->D24_fillScreenBox(_boxChampionIcons[curChampionIconIndex], k0_ColorBlack);
f292_drawChampionState((ChampionIndex)champIndex);

int16 aliveChampionIndex;
Expand Down Expand Up @@ -2032,7 +2039,7 @@ void ChampionMan::f287_drawChampionBarGraphs(ChampionIndex champIndex) {
if (barGraphHeight) {
box._y1 = 27 - barGraphHeight;
box._y2 = 26;
_vm->_displayMan->D24_fillScreenBox(box, g46_ChampionColor[champIndex]);
_vm->_displayMan->D24_fillScreenBox(box, _championColor[champIndex]);
}
box._x1 += 7;
box._x2 += 7;
Expand Down Expand Up @@ -2068,6 +2075,9 @@ uint16 ChampionMan::f309_getMaximumLoad(Champion *champ) {
}

void ChampionMan::f292_drawChampionState(ChampionIndex champIndex) {
static Box boxMouth = Box(55, 72, 12, 29); // @ G0048_s_Graphic562_Box_Mouth
static Box boxEye = Box(11, 28, 12, 29); // @ G0049_s_Graphic562_Box_Eye

int16 championStatusBoxX = champIndex * k69_ChampionStatusBoxSpacing;
Champion *curChampion = &_gK71_champions[champIndex];
uint16 championAttributes = curChampion->_attributes;
Expand Down Expand Up @@ -2155,15 +2165,15 @@ void ChampionMan::f292_drawChampionState(ChampionIndex champIndex) {
else
nativeBitmapIndex = k33_SlotBoxNormalIndice;

_vm->_displayMan->f20_blitToViewport(_vm->_displayMan->f489_getNativeBitmapOrGraphic(nativeBitmapIndex), gBoxMouth, k16_byteWidth, k12_ColorDarkestGray, 18);
_vm->_displayMan->f20_blitToViewport(_vm->_displayMan->f489_getNativeBitmapOrGraphic(nativeBitmapIndex), boxMouth, k16_byteWidth, k12_ColorDarkestGray, 18);
nativeBitmapIndex = k33_SlotBoxNormalIndice;
for (int i = k1_ChampionStatStrength; i <= k6_ChampionStatAntifire; i++) {
if ((curChampion->_statistics[i][k1_ChampionStatCurrent] < curChampion->_statistics[i][k0_ChampionStatMaximum])) {
nativeBitmapIndex = k34_SlotBoxWoundedIndice;
break;
}
}
_vm->_displayMan->f20_blitToViewport(_vm->_displayMan->f489_getNativeBitmapOrGraphic(nativeBitmapIndex), gBoxEye, k16_byteWidth, k12_ColorDarkestGray, 18);
_vm->_displayMan->f20_blitToViewport(_vm->_displayMan->f489_getNativeBitmapOrGraphic(nativeBitmapIndex), boxEye, k16_byteWidth, k12_ColorDarkestGray, 18);
setFlag(championAttributes, k0x4000_ChampionAttributeViewport);
}
}
Expand Down Expand Up @@ -2213,8 +2223,8 @@ void ChampionMan::f292_drawChampionState(ChampionIndex champIndex) {
}
uint16 championIconIndex = M26_championIconIndex(curChampion->_cell, _vm->_dungeonMan->_g308_partyDir);
if (getFlag(championAttributes, k0x0400_ChampionAttributeIcon) && (_vm->_eventMan->_g599_useChampionIconOrdinalAsMousePointerBitmap != _vm->M0_indexToOrdinal(championIconIndex))) {
_vm->_displayMan->D24_fillScreenBox(g54_BoxChampionIcons[championIconIndex], g46_ChampionColor[champIndex]);
_vm->_displayMan->f132_blitToBitmap(_vm->_displayMan->f489_getNativeBitmapOrGraphic(k28_ChampionIcons), _vm->_displayMan->_g348_bitmapScreen, g54_BoxChampionIcons[championIconIndex], M26_championIconIndex(curChampion->_dir, _vm->_dungeonMan->_g308_partyDir) * 19, 0, k40_byteWidth, k160_byteWidthScreen, k12_ColorDarkestGray, 14, k200_heightScreen);
_vm->_displayMan->D24_fillScreenBox(_boxChampionIcons[championIconIndex], _championColor[champIndex]);
_vm->_displayMan->f132_blitToBitmap(_vm->_displayMan->f489_getNativeBitmapOrGraphic(k28_ChampionIcons), _vm->_displayMan->_g348_bitmapScreen, _boxChampionIcons[championIconIndex], M26_championIconIndex(curChampion->_dir, _vm->_dungeonMan->_g308_partyDir) * 19, 0, k40_byteWidth, k160_byteWidthScreen, k12_ColorDarkestGray, 14, k200_heightScreen);
}
if (getFlag(championAttributes, k0x0800_ChampionAttributePanel) && isInventoryChampion) {
if (_vm->_g333_pressingMouth)
Expand Down
8 changes: 4 additions & 4 deletions engines/dm/champion.h
Expand Up @@ -38,9 +38,6 @@ namespace DM {
#define k0x4000_IgnoreObjectModifiers 0x4000 // @ MASK0x4000_IGNORE_OBJECT_MODIFIERS
#define k0x8000_IgnoreTemporaryExperience 0x8000 // @ MASK0x8000_IGNORE_TEMPORARY_EXPERIENCE

extern Box g54_BoxChampionIcons[4]; // @ G0054_ai_Graphic562_Box_ChampionIcons
extern Color g46_ChampionColor[4]; // @ G0046_auc_Graphic562_ChampionColor

extern int16 g39_LightPowerToLightAmount[16]; // @ G0039_ai_Graphic562_LightPowerToLightAmount

class Scent {
Expand Down Expand Up @@ -590,9 +587,12 @@ class ChampionMan {
void f331_applyTimeEffects(); // @ F0331_CHAMPION_ApplyTimeEffects_CPSF
void save2_PartyPart(Common::OutSaveFile *file);
void load2_PartyPart(Common::InSaveFile* file);
};


Box _boxChampionIcons[4];
Color _championColor[4];
};

}

#endif
2 changes: 1 addition & 1 deletion engines/dm/dialog.h
Expand Up @@ -54,4 +54,4 @@ class DialogMan {
int16 f424_dialogGetChoice(uint16 choiceCount, uint16 dialogSetIndex, int16 driveType, int16 automaticChoiceIfFlopyInDrive); // @ F0424_DIALOG_GetChoice
};

}
}
4 changes: 0 additions & 4 deletions engines/dm/dm.h
Expand Up @@ -141,11 +141,7 @@ bool isOrientedWestEast(Direction dir); // @ M16_IS_ORIENTED_WEST_EAST


#define setFlag(val, mask) ((val) |= (mask))


#define getFlag(val, mask) ((val) & (mask))


#define clearFlag(val, mask) ((val) &= (~(mask))) // @ M09_CLEAR

uint16 toggleFlag(uint16 &val, uint16 mask); // @ M10_TOGGLE
Expand Down

0 comments on commit b4b7604

Please sign in to comment.