aboutsummaryrefslogtreecommitdiff
path: root/engines/kyra/sprites_eob.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'engines/kyra/sprites_eob.cpp')
-rw-r--r--engines/kyra/sprites_eob.cpp25
1 files changed, 14 insertions, 11 deletions
diff --git a/engines/kyra/sprites_eob.cpp b/engines/kyra/sprites_eob.cpp
index 5c679f5cb4..1d4c143185 100644
--- a/engines/kyra/sprites_eob.cpp
+++ b/engines/kyra/sprites_eob.cpp
@@ -58,7 +58,7 @@ void EoBCoreEngine::releaseMonsterShapes(int first, int num) {
const uint8 *EoBCoreEngine::loadMonsterProperties(const uint8 *data) {
uint8 cmd = *data++;
- while (cmd != 0xff) {
+ while (cmd != 0xFF) {
EoBMonsterProperty *d = &_monsterProps[cmd];
d->armorClass = (int8)*data++;
d->hitChance = (int8)*data++;
@@ -90,7 +90,7 @@ const uint8 *EoBCoreEngine::loadMonsterProperties(const uint8 *data) {
d->sound2 = (int8)*data++;
d->numRemoteAttacks = *data++;
- if (*data++ != 0xff) {
+ if (*data++ != 0xFF) {
d->remoteWeaponChangeMode = *data++;
d->numRemoteWeapons = *data++;
@@ -113,7 +113,7 @@ const uint8 *EoBCoreEngine::loadMonsterProperties(const uint8 *data) {
}
const uint8 *EoBCoreEngine::loadActiveMonsterData(const uint8 *data, int level) {
- for (uint8 p = *data++; p != 0xff; p = *data++) {
+ for (uint8 p = *data++; p != 0xFF; p = *data++) {
uint8 v = *data++;
_timer->setCountdown(0x20 + (p << 1), v);
_timer->setCountdown(0x21 + (p << 1), v);
@@ -132,7 +132,7 @@ const uint8 *EoBCoreEngine::loadActiveMonsterData(const uint8 *data, int level)
memset(_monsters, 0, 30 * sizeof(EoBMonsterInPlay));
for (int i = 0; i < 30; i++, data += 14) {
- if (*data == 0xff)
+ if (*data == 0xFF)
continue;
initMonster(data[0], data[1], READ_LE_UINT16(&data[2]), data[4], (int8)data[5], data[6], data[7], data[8], data[9], READ_LE_UINT16(&data[10]), READ_LE_UINT16(&data[12]));
@@ -174,7 +174,7 @@ void EoBCoreEngine::initMonster(int index, int unit, uint16 block, int pos, int
}
void EoBCoreEngine::placeMonster(EoBMonsterInPlay *m, uint16 block, int dir) {
- if (block != 0xffff) {
+ if (block != 0xFFFF) {
checkSceneUpdateNeed(m->block);
if (_levelBlockProperties[m->block].flags & 7) {
_levelBlockProperties[m->block].flags--;
@@ -201,11 +201,11 @@ void EoBCoreEngine::killMonster(EoBMonsterInPlay *m, bool giveExperience) {
if (m->randItem) {
if (rollDice(1, 10, 0) == 1)
- setItemPosition((Item *)&_levelBlockProperties[m->block & 0x3ff].drawObjects, m->block, duplicateItem(m->randItem), pos);
+ setItemPosition((Item *)&_levelBlockProperties[m->block & 0x3FF].drawObjects, m->block, duplicateItem(m->randItem), pos);
}
if (m->fixedItem)
- setItemPosition((Item *)&_levelBlockProperties[m->block & 0x3ff].drawObjects, m->block, duplicateItem(m->fixedItem), pos);
+ setItemPosition((Item *)&_levelBlockProperties[m->block & 0x3FF].drawObjects, m->block, duplicateItem(m->fixedItem), pos);
if (giveExperience)
increasePartyExperience(_monsterProps[m->type].experience);
@@ -247,6 +247,9 @@ void EoBCoreEngine::updateAttackingMonsterFlags() {
m2 = m;
}
+ if (!m2)
+ return;
+
if (m2->type == 7)
setScriptFlags(4);
@@ -357,7 +360,7 @@ void EoBCoreEngine::flashMonsterShape(EoBMonsterInPlay *m) {
disableSysTimer(2);
_flashShapeTimer = 0;
drawScene(1);
- m->flags &= 0xfd;
+ m->flags &= 0xFD;
_flashShapeTimer = _system->getMillis() + _tickLength;
enableSysTimer(2);
@@ -536,7 +539,7 @@ void EoBCoreEngine::drawMonsters(int index) {
int h = shp[1];
x = x - (w >> 1) + (d->idleAnimState >> 4);
- y = y - h + (d->idleAnimState & 0x0f);
+ y = y - h + (d->idleAnimState & 0x0F);
drawMonsterShape(shp, x, y, f >= 0 ? 0 : 1, d->flags, palIndex);
@@ -551,8 +554,6 @@ void EoBCoreEngine::drawMonsters(int index) {
SpriteDecoration *dcr = &_monsterDecorations[(p->decorations[ii] - 1) * 6 + subFrame + shpIndex - 1];
- if (!dcr)
- continue;
if (!dcr->shp)
continue;
@@ -652,6 +653,8 @@ void EoBCoreEngine::drawFlyingObjects(int index) {
}
}
+ assert(shp);
+
shp = _screen->scaleShape(shp, sclValue);
if (rstFade) {