diff options
-rw-r--r-- | engines/griffon/combat.cpp | 2 | ||||
-rw-r--r-- | engines/griffon/dialogs.cpp | 4 | ||||
-rw-r--r-- | engines/griffon/draw.cpp | 91 | ||||
-rw-r--r-- | engines/griffon/engine.cpp | 8 | ||||
-rw-r--r-- | engines/griffon/griffon.h | 22 | ||||
-rw-r--r-- | engines/griffon/input.cpp | 62 | ||||
-rw-r--r-- | engines/griffon/logic.cpp | 224 | ||||
-rw-r--r-- | engines/griffon/resources.cpp | 34 |
8 files changed, 213 insertions, 234 deletions
diff --git a/engines/griffon/combat.cpp b/engines/griffon/combat.cpp index 925a83c529..f8541040f5 100644 --- a/engines/griffon/combat.cpp +++ b/engines/griffon/combat.cpp @@ -113,7 +113,7 @@ void GriffonEngine::attack() { eventText("Found the Temple Key!"); return; case kScriptFindCrystal: - _player.foundSpell[0] = 1; + _player.foundSpell[0] = true; _player.spellCharge[0] = 0; addFloatIcon(7, lx * 16, (ly - 1) * 16); diff --git a/engines/griffon/dialogs.cpp b/engines/griffon/dialogs.cpp index 7e606f1fd0..a26f65c2e1 100644 --- a/engines/griffon/dialogs.cpp +++ b/engines/griffon/dialogs.cpp @@ -691,10 +691,10 @@ void GriffonEngine::saveLoadNew() { int nx = rcSrc.left + 13 + 3 * 8; rcSrc.left = nx - 17; - if (_playera.foundSpell[0] == 1) { + if (_playera.foundSpell[0]) { for (int i = 0; i < 5; i++) { rcSrc.left += 17; - if (_playera.foundSpell[i] == 1) + if (_playera.foundSpell[i]) _itemimg[7 + i]->blit(*_videobuffer, rcSrc.left, rcSrc.top); } } diff --git a/engines/griffon/draw.cpp b/engines/griffon/draw.cpp index 9cc5ae8bd6..54d249a4cc 100644 --- a/engines/griffon/draw.cpp +++ b/engines/griffon/draw.cpp @@ -152,17 +152,17 @@ void GriffonEngine::drawAnims(int Layer) { rcDest.setWidth(16); rcDest.setHeight(16); - int pass = 1; + bool pass = true; if (curtilel == 1) { for (int ff = 0; ff <= 5; ff++) { int ffa = 20 * 5 - 1 + ff * 20; int ffb = 20 * 5 + 4 + ff * 20; if (curtile > ffa && curtile < ffb) - pass = 0; + pass = false; } } - if (pass == 1) + if (pass) _tiles[curtilel]->blit(*_videobuffer, rcDest.left, rcDest.top, Graphics::FLIP_NONE, &rcSrc); } } @@ -197,8 +197,7 @@ void GriffonEngine::drawHud() { c = 1; else if (fc == 5) c = 0; - - if (fc == 1 || fc == 3) + else if (fc == 1 || fc == 3) c2 = 2; if (fc != 0) { @@ -239,20 +238,19 @@ void GriffonEngine::drawHud() { } } - if (_itemselon == 0) { + if (!_itemSelOn) { int sy = 211; - - int nx = 19 * 8 + 13; + rcSrc.left = nx - 17 + 48; rcSrc.top = sy; // spells in game - if (_player.foundSpell[0] == 1) { + if (_player.foundSpell[0]) { for (int i = 0; i < 5; i++) { rcSrc.left = rcSrc.left + 17; - if (_player.foundSpell[i] == 1) { + if (_player.foundSpell[i]) { _itemimg[7 + i]->blit(*_videobuffer, rcSrc.left, rcSrc.top); game_fillrect(_videobuffer, rcSrc.left, sy + 16, 16, 4, RGB(0, 32, 32)); @@ -265,7 +263,7 @@ void GriffonEngine::drawHud() { return; } - if (_selenemyon == 0) { + if (_selEnemyOn == false) { rcDest.left = 0; rcDest.top = 0; rcDest.right = 320; @@ -392,13 +390,13 @@ void GriffonEngine::drawHud() { } // spells in menu - if (_player.foundSpell[0] == 1) { + if (_player.foundSpell[0]) { for (int i = 0; i < 5; i++) { rcSrc.left = 243; rcSrc.top = 67 + i * 24; sy = rcSrc.top; - if (_player.foundSpell[i] == 1) { + if (_player.foundSpell[i]) { _itemimg[7 + i]->blit(*_videobuffer, rcSrc.left, rcSrc.top); game_fillrect(_videobuffer, rcSrc.left, sy + 16, 16, 4, RGB(0, 32, 32)); @@ -409,7 +407,7 @@ void GriffonEngine::drawHud() { } } - if (_itemselon == 1) { + if (_itemSelOn) { for (int i = 0; i <= 4; i++) { if (_curitem == 5 + i) { rcDest.left = (float)(243 - 12 + 3 * sin(3.141592 * 2 * _itemyloc / 16)); @@ -426,7 +424,7 @@ void GriffonEngine::drawHud() { } } - if (_selenemyon == 1) { + if (_selEnemyOn) { if (_curenemy > _lastnpc) { int pst = _curenemy - _lastnpc - 1; rcDest.left = postinfo[pst][0]; @@ -466,7 +464,7 @@ void GriffonEngine::drawNPCs(int mode) { // spriteset1 specific if (_npcinfo[i].spriteset == kMonsterBabyDragon) { - if (_npcinfo[i].attacking == 0) { + if (!_npcinfo[i].attacking) { int cframe = _npcinfo[i].cframe; @@ -546,57 +544,40 @@ void GriffonEngine::drawNPCs(int mode) { // boss 1 if (_npcinfo[i].spriteset == kMonsterBoss1) { - if (_npcinfo[i].attacking == 0) { + if (!_npcinfo[i].attacking) { int cframe = _npcinfo[i].cframe; - rcSrc.left = (int)(cframe / 4) * 24; - rcSrc.top = 0; - rcSrc.setWidth(24); - rcSrc.setHeight(48); - - rcDest.left = npx - 2; - rcDest.top = npy - 24; - - _anims[3]->blit(*_videobuffer, rcDest.left, rcDest.top, Graphics::FLIP_NONE, &rcSrc); } else { rcSrc.left = 4 * 24; - rcSrc.top = 0; - rcSrc.setWidth(24); - rcSrc.setHeight(48); + } + + rcSrc.top = 0; + rcSrc.setWidth(24); + rcSrc.setHeight(48); - rcDest.left = npx - 2; - rcDest.top = npy - 24; + rcDest.left = npx - 2; + rcDest.top = npy - 24; - _anims[3]->blit(*_videobuffer, rcDest.left, rcDest.top, Graphics::FLIP_NONE, &rcSrc); - } + _anims[3]->blit(*_videobuffer, rcDest.left, rcDest.top, Graphics::FLIP_NONE, &rcSrc); } // black knight if (_npcinfo[i].spriteset == kMonsterBlackKnight) { - if (_npcinfo[i].attacking == 0) { + if (!_npcinfo[i].attacking) { int cframe = _npcinfo[i].cframe; - rcSrc.left = (int)(cframe / 4) * 24; - rcSrc.top = 0; - rcSrc.setWidth(24); - rcSrc.setHeight(48); - - rcDest.left = npx - 2; - rcDest.top = npy - 24; - - _anims[4]->blit(*_videobuffer, rcDest.left, rcDest.top, Graphics::FLIP_NONE, &rcSrc); } else { rcSrc.left = 4 * 24; - rcSrc.top = 0; - rcSrc.setWidth(24); - rcSrc.setHeight(48); + } + rcSrc.top = 0; + rcSrc.setWidth(24); + rcSrc.setHeight(48); - rcDest.left = npx - 2; - rcDest.top = npy - 24; + rcDest.left = npx - 2; + rcDest.top = npy - 24; - _anims[4]->blit(*_videobuffer, rcDest.left, rcDest.top, Graphics::FLIP_NONE, &rcSrc); - } + _anims[4]->blit(*_videobuffer, rcDest.left, rcDest.top, Graphics::FLIP_NONE, &rcSrc); } @@ -739,7 +720,7 @@ void GriffonEngine::drawNPCs(int mode) { // dragon2 if (_npcinfo[i].spriteset == kMonsterDragon2) { - if (_npcinfo[i].attacking == 0) { + if (!_npcinfo[i].attacking) { _npcinfo[i].floating = _npcinfo[i].floating + 0.25 * _fpsr; while (_npcinfo[i].floating >= 16) _npcinfo[i].floating = _npcinfo[i].floating - 16; @@ -893,7 +874,7 @@ void GriffonEngine::drawNPCs(int mode) { _spellimg->setAlpha(255, true); - if (_npcinfo[i].attacking == 0) { + if (!_npcinfo[i].attacking) { int cframe = (int)(frame); rcSrc.left = 0; rcSrc.top = 72 * (int)(cframe / 4); @@ -1171,7 +1152,7 @@ void GriffonEngine::drawView() { updateSpells(); - if (cloudson == 1) { + if (_cloudsOn) { Common::Rect rc; rc.left = (float)(256 + 256 * cos(3.141592 / 180 * clouddeg)); rc.top = (float)(192 + 192 * sin(3.141592 / 180 * clouddeg)); @@ -1189,7 +1170,7 @@ void GriffonEngine::drawView() { void GriffonEngine::swash() { float y = 0.0; do { - y = y + 1 * _fpsr; + y += 1 * _fpsr; _videobuffer->setAlpha((int)y); _videobuffer->fillRect(Common::Rect(0, 0, _videobuffer->w, _videobuffer->h), 0); @@ -1228,7 +1209,7 @@ void GriffonEngine::swash() { _videobuffer->setAlpha((int)(y * 25)); _mapbg->blit(*_videobuffer); - if (cloudson == 1) { + if (_cloudsOn) { rcDest.left = (float)(256 + 256 * cos(3.141592 / 180 * clouddeg)); rcDest.top = (float)(192 + 192 * sin(3.141592 / 180 * clouddeg)); rcDest.setWidth(320); diff --git a/engines/griffon/engine.cpp b/engines/griffon/engine.cpp index 20cff6260b..a323febf41 100644 --- a/engines/griffon/engine.cpp +++ b/engines/griffon/engine.cpp @@ -187,7 +187,7 @@ void GriffonEngine::updateEngine() { if (!_forcepause) { for (int i = 0; i < 5; i++) { - if (_player.foundSpell[i] == 1) + if (_player.foundSpell[i]) _player.spellCharge[i] += 1 * _player.level * 0.01 * _fpsr; if (_player.spellCharge[i] > 100) _player.spellCharge[i] = 100; @@ -236,9 +236,9 @@ void GriffonEngine::updateEngine() { } } - // cloudson = 0 + // cloudson = false - if (_itemselon == 1) + if (_itemSelOn) _player.itemselshade = _player.itemselshade + 2 * _fpsr; if (_player.itemselshade > 24) _player.itemselshade = 24; @@ -272,7 +272,7 @@ void GriffonEngine::newGame() { _player.shield = 0; _player.armour = 0; for (int i = 0; i < 5; i++) { - _player.foundSpell[i] = 0; + _player.foundSpell[i] = false; _player.spellCharge[i] = 0; _player.inventory[i] = 0; } diff --git a/engines/griffon/griffon.h b/engines/griffon/griffon.h index 30df532f33..a3128306cd 100644 --- a/engines/griffon/griffon.h +++ b/engines/griffon/griffon.h @@ -152,7 +152,7 @@ struct Player { int sword; int shield; int armour; - int foundSpell[5]; + bool foundSpell[5]; float spellCharge[5]; int inventory[5]; float attackStrength; @@ -197,7 +197,7 @@ struct NPC { float frame; float frame2; // end boss specific int cframe; - int onmap; // is this npc set to be genned in the mapfile + bool onmap; // is this npc set to be genned in the mapfile int ticks; int pause; @@ -207,12 +207,12 @@ struct NPC { int walkdir; float walkspd; int movingdir; - int moving; + bool moving; - int attacking; - float attackframe; + bool attacking; + float attackframe; int cattackframe; - float attackspd; + float attackspd; int attackdelay; int attacknext; int attackattempt; @@ -231,7 +231,7 @@ struct NPC { // firehydra specific int attacknext2[4]; - int attacking2[4]; + bool attacking2[4]; int attackframe2[4]; // dragon2 specific @@ -399,9 +399,11 @@ private: Graphics::TransparentSurface *_itemimg[21], *_windowimg; Graphics::TransparentSurface *_spellimg; - int _itemselon, _curitem, _itemticks; + bool _itemSelOn; + int _curitem, _itemticks; float _itemyloc; - int _selenemyon, _curenemy; + bool _selEnemyOn; + int _curenemy; bool _forcepause; bool _roomlock; // set to disable any room jumps while in the room int _scriptflag[100][10], _saveslot; // script, flag @@ -429,7 +431,7 @@ private: // cloud info Graphics::TransparentSurface *cloudimg; float clouddeg; - int cloudson; + int _cloudsOn; // spell info Spell spellinfo[kMaxSpell]; diff --git a/engines/griffon/input.cpp b/engines/griffon/input.cpp index a7540e6f34..72398387fe 100644 --- a/engines/griffon/input.cpp +++ b/engines/griffon/input.cpp @@ -65,7 +65,7 @@ void GriffonEngine::checkInputs() { } } - if (attacking || (_forcepause && _itemselon == 0)) + if (attacking || (_forcepause && !_itemSelOn)) return; if (_event.type == Common::EVENT_QUIT) { @@ -81,10 +81,10 @@ void GriffonEngine::checkInputs() { _console->attach(); _event.type = Common::EVENT_INVALID; } else if (_event.kbd.hasFlags(Common::KBD_CTRL)) { - if (_itemselon == 0 && _itemticks < _ticks) + if (!_itemSelOn && (_itemticks < _ticks)) attack(); - if (_itemselon == 1 && _itemticks < _ticks) { + if (_itemSelOn && _itemticks < _ticks) { if (_curitem == 0 && _player.inventory[kInvFlask] > 0) { _itemticks = _ticks + ntickdelay; @@ -107,7 +107,7 @@ void GriffonEngine::checkInputs() { setChannelVolume(snd, config.effectsvol); } - _itemselon = 0; + _itemSelOn = false; _forcepause = false; } @@ -115,12 +115,12 @@ void GriffonEngine::checkInputs() { _itemticks = _ticks + ntickdelay; int heal = 200; - int maxh = _player.maxHp - _player.hp; + int maxHeal = _player.maxHp - _player.hp; - if (heal > maxh) - heal = maxh; + if (heal > maxHeal) + heal = maxHeal; - _player.hp = _player.hp + heal; + _player.hp += heal; char text[256]; sprintf(text, "+%i", heal); @@ -133,7 +133,7 @@ void GriffonEngine::checkInputs() { setChannelVolume(snd, config.effectsvol); } - _itemselon = 0; + _itemSelOn = false; _forcepause = false; } @@ -145,8 +145,8 @@ void GriffonEngine::checkInputs() { _player.inventory[kInvShock]--; _itemticks = _ticks + ntickdelay; - _selenemyon = 0; - _itemselon = 0; + _selEnemyOn = false; + _itemSelOn = false; } @@ -157,8 +157,8 @@ void GriffonEngine::checkInputs() { _player.inventory[kInvNormalKey]--; _itemticks = _ticks + ntickdelay; - _selenemyon = 0; - _itemselon = 0; + _selEnemyOn = false; + _itemSelOn = false; return; } @@ -169,8 +169,8 @@ void GriffonEngine::checkInputs() { _player.inventory[kInvMasterKey]--; _itemticks = _ticks + ntickdelay; - _selenemyon = 0; - _itemselon = 0; + _selEnemyOn = false; + _itemSelOn = false; return; } @@ -182,11 +182,11 @@ void GriffonEngine::checkInputs() { _forcepause = true; _itemticks = _ticks + ntickdelay; - _selenemyon = 0; - _itemselon = 0; + _selEnemyOn = false; + _itemSelOn = false; } - if (_curitem > 5 && _selenemyon == 1) { + if (_curitem > 5 && _selEnemyOn) { if (_curenemy <= _lastnpc) { castSpell(_curitem - 6, _player.px, _player.py, _npcinfo[_curenemy].x, _npcinfo[_curenemy].y, 0); } else { @@ -199,16 +199,16 @@ void GriffonEngine::checkInputs() { _player.spellStrength = 0; _itemticks = _ticks + ntickdelay; - _selenemyon = 0; - _itemselon = 0; + _selEnemyOn = false; + _itemSelOn = false; _forcepause = false; } - if (_curitem > 5 && _selenemyon == 0 && _itemselon == 1) { + if (_curitem > 5 && !_selEnemyOn && _itemSelOn) { if (ABS(_player.spellCharge[_curitem - 5] - 100) < kEpsilon) { _itemticks = _ticks + ntickdelay; - _selenemyon = 1; + _selEnemyOn = true; int i = 0; do { @@ -218,14 +218,14 @@ void GriffonEngine::checkInputs() { } i = i + 1; if (i == _lastnpc + 1) { - _selenemyon = 0; + _selEnemyOn = false; goto __exit_do; } } while (1); __exit_do: - if (nposts > 0 && _selenemyon == 0) { - _selenemyon = 1; + if (nposts > 0 && !_selEnemyOn) { + _selEnemyOn = true; _curenemy = _lastnpc + 1; } } @@ -234,13 +234,13 @@ __exit_do: } } else if (_event.kbd.hasFlags(Common::KBD_ALT)) { if (_itemticks < _ticks) { - _selenemyon = 0; - if (_itemselon == 1) { - _itemselon = 0; + _selEnemyOn = false; + if (_itemSelOn) { + _itemSelOn = false; _itemticks = _ticks + 220; _forcepause = false; } else { - _itemselon = 1; + _itemSelOn = true; _itemticks = _ticks + 220; _forcepause = true; _player.itemselshade = 0; @@ -249,7 +249,7 @@ __exit_do: } } - if (_itemselon == 0) { + if (!_itemSelOn) { movingup = false; movingdown = false; movingleft = false; @@ -268,7 +268,7 @@ __exit_do: movingleft = false; movingright = false; - if (_selenemyon == 1) { + if (_selEnemyOn) { if (_itemticks < _ticks) { if (_event.kbd.keycode == Common::KEYCODE_LEFT) { int origin = _curenemy; diff --git a/engines/griffon/logic.cpp b/engines/griffon/logic.cpp index 7a691b85c6..3225930555 100644 --- a/engines/griffon/logic.cpp +++ b/engines/griffon/logic.cpp @@ -132,15 +132,15 @@ void GriffonEngine::updateNPCs() { if (_npcinfo[i].hp > 0) { // is npc walking int pass = 0; - if (_npcinfo[i].attacking == 0) + if (!_npcinfo[i].attacking) pass = 1; if (_npcinfo[i].spriteset == kMonsterFireHydra) pass = 1; if (pass == 1) { - int moveup = 0; - int movedown = 0; - int moveleft = 0; - int moveright = 0; + bool moveup = false; + bool movedown = false; + bool moveleft = false; + bool moveright = false; float npx = _npcinfo[i].x; float npy = _npcinfo[i].y; @@ -200,13 +200,13 @@ void GriffonEngine::updateNPCs() { } if (xdif < 4) - moveleft = 1; + moveleft = true; if (xdif > -4) - moveright = 1; + moveright = true; if (ydif < 4) - moveup = 1; + moveup = true; if (ydif > -4) - movedown = 1; + movedown = true; } // ******************* @@ -226,32 +226,32 @@ void GriffonEngine::updateNPCs() { if (movingdir == 0) { wdir = 2; // left - moveup = 1; - moveleft = 1; + moveup = true; + moveleft = true; } else if (movingdir == 1) { wdir = 0; // up - moveup = 1; + moveup = true; } else if (movingdir == 2) { wdir = 3; // right - moveup = 1; - moveright = 1; + moveup = true; + moveright = true; } else if (movingdir == 3) { wdir = 3; // right - moveright = 1; + moveright = true; } else if (movingdir == 4) { wdir = 3; // right - moveright = 1; - movedown = 1; + moveright = true; + movedown = true; } else if (movingdir == 5) { wdir = 1; // down - movedown = 1; + movedown = true; } else if (movingdir == 6) { wdir = 2; // left - movedown = 1; - moveleft = 1; + movedown = true; + moveleft = true; } else if (movingdir == 7) { wdir = 2; // left - moveleft = 1; + moveleft = true; } checkpass = true; @@ -278,21 +278,21 @@ void GriffonEngine::updateNPCs() { } if (xdif < 4) - moveright = 1; + moveright = true; if (xdif > -4) - moveleft = 1; + moveleft = true; if (ydif < 4) - movedown = 1; + movedown = true; if (ydif > -4) - moveup = 1; + moveup = true; } // ******************* // -------------- ?? move*** vs movin*** - int movinup = 0; - int movindown = 0; - int movinleft = 0; - int movinright = 0; + bool movinup = false; + bool movindown = false; + bool movinleft = false; + bool movinright = false; float xp = (npx / 2 + 6); float yp = (npy / 2 + 10); @@ -313,7 +313,7 @@ void GriffonEngine::updateNPCs() { dq = 0; if (dq == 0) - movinup = 1; + movinup = true; if (dq > 0) { sx = xp - ii; sy = yp - ii; @@ -322,8 +322,8 @@ void GriffonEngine::updateNPCs() { if (_npcinfo[i].spriteset == kMonsterFinalBoss) dq = 0; if (dq == 0) { - movinup = 1; - movinleft = 1; + movinup = true; + movinleft = true; } } if (dq > 0) { @@ -334,8 +334,8 @@ void GriffonEngine::updateNPCs() { if (_npcinfo[i].spriteset == kMonsterFinalBoss) dq = 0; if (dq == 0) { - movinup = 1; - movinright = 1; + movinup = true; + movinright = true; } } } @@ -348,7 +348,7 @@ void GriffonEngine::updateNPCs() { if (_npcinfo[i].spriteset == kMonsterFinalBoss) dq = 0; if (dq == 0) - movindown = 1; + movindown = true; if (dq > 0) { sx = xp - ii; sy = yp + ii; @@ -357,8 +357,8 @@ void GriffonEngine::updateNPCs() { if (_npcinfo[i].spriteset == kMonsterFinalBoss) dq = 0; if (dq == 0) { - movindown = 1; - movinleft = 1; + movindown = true; + movinleft = true; } } if (dq > 0) { @@ -369,8 +369,8 @@ void GriffonEngine::updateNPCs() { if (_npcinfo[i].spriteset == kMonsterFinalBoss) dq = 0; if (dq == 0) { - movindown = 1; - movinright = 1; + movindown = true; + movinright = true; } } } @@ -383,7 +383,7 @@ void GriffonEngine::updateNPCs() { if (_npcinfo[i].spriteset == kMonsterFinalBoss) dq = 0; if (dq == 0) - movinleft = 1; + movinleft = true; if (dq > 0) { sx = xp - ii; sy = yp - ii; @@ -392,8 +392,8 @@ void GriffonEngine::updateNPCs() { if (_npcinfo[i].spriteset == kMonsterFinalBoss) dq = 0; if (dq == 0) { - movinleft = 1; - movinup = 1; + movinleft = true; + movinup = true; } } if (dq > 0) { @@ -404,8 +404,8 @@ void GriffonEngine::updateNPCs() { if (_npcinfo[i].spriteset == kMonsterFinalBoss) dq = 0; if (dq == 0) { - movinleft = 1; - movindown = 1; + movinleft = true; + movindown = true; } } } @@ -418,7 +418,7 @@ void GriffonEngine::updateNPCs() { if (_npcinfo[i].spriteset == kMonsterFinalBoss) dq = 0; if (dq == 0) - movinright = 1; + movinright = true; if (dq > 0) { sx = xp + ii; sy = yp - ii; @@ -427,8 +427,8 @@ void GriffonEngine::updateNPCs() { if (_npcinfo[i].spriteset == kMonsterFinalBoss) dq = 0; if (dq == 0) { - movinright = 1; - movinup = 1; + movinright = true; + movinup = true; } } if (dq > 0) { @@ -439,20 +439,20 @@ void GriffonEngine::updateNPCs() { if (_npcinfo[i].spriteset == kMonsterFinalBoss) dq = 0; if (dq == 0) { - movinright = 1; - movindown = 1; + movinright = true; + movindown = true; } } } if (movinup) - npy = npy - wspd * _fpsr; + npy -= wspd * _fpsr; if (movindown) - npy = npy + wspd * _fpsr; + npy += wspd * _fpsr; if (movinleft) - npx = npx - wspd * _fpsr; + npx -= wspd * _fpsr; if (movinright) - npx = npx + wspd * _fpsr; + npx += wspd * _fpsr; if (checkpass) { pass = 0; @@ -489,14 +489,14 @@ void GriffonEngine::updateNPCs() { if (_npcinfo[i].spriteset == kMonsterFinalBoss) bgc = 0; - int rst = 0; + bool rst = false; if (_npcinfo[i].spriteset == kMonsterFinalBoss) { if (npx < 40 || npx > 280 || npy < 36 || npy > 204) - rst = 1; + rst = true; } - if (bgc > 0 || rst == 1) { + if (bgc > 0 || rst) { npx = onpx; npy = onpy; } @@ -505,12 +505,12 @@ void GriffonEngine::updateNPCs() { _npcinfo[i].y = npy; _npcinfo[i].walkdir = wdir; - _npcinfo[i].moving = 0; + _npcinfo[i].moving = false; if (npx != onpx || npy != onpy) - _npcinfo[i].moving = 1; + _npcinfo[i].moving = true; - if (_npcinfo[i].moving == 1) { + if (_npcinfo[i].moving) { float frame = _npcinfo[i].frame; frame += aspd * _fpsr; @@ -527,7 +527,7 @@ void GriffonEngine::updateNPCs() { // spriteset1 specific if (_npcinfo[i].spriteset == kMonsterBabyDragon && _npcinfo[i].attackattempt < _ticks) { - if (_npcinfo[i].attacknext < _ticks && _npcinfo[i].pause < _ticks && _npcinfo[i].attacking == 0) { + if (_npcinfo[i].attacknext < _ticks && _npcinfo[i].pause < _ticks && !_npcinfo[i].attacking) { npx = _npcinfo[i].x; npy = _npcinfo[i].y; @@ -542,7 +542,7 @@ void GriffonEngine::updateNPCs() { setChannelVolume(snd, config.effectsvol); } - _npcinfo[i].attacking = 1; + _npcinfo[i].attacking = true; _npcinfo[i].attackframe = 0; } } @@ -553,7 +553,7 @@ void GriffonEngine::updateNPCs() { // onewing specific if (_npcinfo[i].spriteset == kMonsterOneWing) { - if (_npcinfo[i].attacknext < _ticks && _npcinfo[i].pause < _ticks && _npcinfo[i].attacking == 0) { + if (_npcinfo[i].attacknext < _ticks && _npcinfo[i].pause < _ticks && !_npcinfo[i].attacking) { npx = _npcinfo[i].x; npy = _npcinfo[i].y; @@ -569,7 +569,7 @@ void GriffonEngine::updateNPCs() { setChannelVolume(snd, config.effectsvol); } - _npcinfo[i].attacking = 1; + _npcinfo[i].attacking = true; _npcinfo[i].attackframe = 0; _npcinfo[i].headtargetx[0] = _player.px + 12; @@ -581,7 +581,7 @@ void GriffonEngine::updateNPCs() { dospell = false; - if (_npcinfo[i].attacking == 0 && _npcinfo[i].castpause < _ticks) { + if (!_npcinfo[i].attacking && _npcinfo[i].castpause < _ticks) { _npcinfo[i].swayspd = _npcinfo[i].swayspd + _npcinfo[i].swayspd / 200 * _fpsr; if (_npcinfo[i].swayspd > 15) { dospell = true; @@ -634,8 +634,8 @@ void GriffonEngine::updateNPCs() { // boss1 specific and blackknight if (_npcinfo[i].spriteset == kMonsterBoss1 || _npcinfo[i].spriteset == kMonsterBlackKnight) { - if (_npcinfo[i].attacknext < _ticks && _npcinfo[i].pause < _ticks && _npcinfo[i].attacking == 0) { - _npcinfo[i].attacking = 1; + if (_npcinfo[i].attacknext < _ticks && _npcinfo[i].pause < _ticks && !_npcinfo[i].attacking) { + _npcinfo[i].attacking = true; _npcinfo[i].attackframe = 0; castSpell(1, _npcinfo[i].x, _npcinfo[i].y, _player.px, _player.py, i); @@ -675,7 +675,7 @@ void GriffonEngine::updateNPCs() { setChannelVolume(snd, config.effectsvol); } - _npcinfo[i].attacking = 1; + _npcinfo[i].attacking = true; _npcinfo[i].attacking2[ff] = 1; _npcinfo[i].attackframe2[ff] = 0; @@ -719,7 +719,7 @@ void GriffonEngine::updateNPCs() { // spriteset6 specific if (_npcinfo[i].spriteset == kMonsterRedDragon && _npcinfo[i].attackattempt < _ticks) { - if (_npcinfo[i].attacknext < _ticks && _npcinfo[i].pause < _ticks && _npcinfo[i].attacking == 0) { + if (_npcinfo[i].attacknext < _ticks && _npcinfo[i].pause < _ticks && !_npcinfo[i].attacking) { npx = _npcinfo[i].x; npy = _npcinfo[i].y; @@ -735,7 +735,7 @@ void GriffonEngine::updateNPCs() { if (pass > 0) { _npcinfo[i].attackattempt = _ticks + 100; if ((int)(RND() * 2) == 0) { - _npcinfo[i].attacking = 1; + _npcinfo[i].attacking = true; _npcinfo[i].attackframe = 0; float nnxa = 0, nnya = 0, nnxb = 0, nnyb = 0; @@ -769,8 +769,8 @@ void GriffonEngine::updateNPCs() { // wizard1 specific if (_npcinfo[i].spriteset == kMonsterPriest) { - if (_npcinfo[i].attacknext < _ticks && _npcinfo[i].pause < _ticks && _npcinfo[i].attacking == 0) { - _npcinfo[i].attacking = 1; + if (_npcinfo[i].attacknext < _ticks && _npcinfo[i].pause < _ticks && !_npcinfo[i].attacking) { + _npcinfo[i].attacking = true; _npcinfo[i].attackframe = 0; castSpell(9, _npcinfo[i].x, _npcinfo[i].y, _player.px, _player.py, i); @@ -785,7 +785,7 @@ void GriffonEngine::updateNPCs() { // spriteset6 specific if (_npcinfo[i].spriteset == kMonsterYellowDragon && _npcinfo[i].attackattempt < _ticks) { - if (_npcinfo[i].attacknext < _ticks && _npcinfo[i].pause < _ticks && _npcinfo[i].attacking == 0) { + if (_npcinfo[i].attacknext < _ticks && _npcinfo[i].pause < _ticks && !_npcinfo[i].attacking) { npx = _npcinfo[i].x; npy = _npcinfo[i].y; @@ -801,7 +801,7 @@ void GriffonEngine::updateNPCs() { if (pass > 0) { _npcinfo[i].attackattempt = _ticks + 100; if ((int)(RND() * 2) == 0) { - _npcinfo[i].attacking = 1; + _npcinfo[i].attacking = true; _npcinfo[i].attackframe = 0; float nnxa = 0, nnya = 0, nnxb = 0, nnyb = 0; @@ -839,7 +839,7 @@ void GriffonEngine::updateNPCs() { // twowing specific if (_npcinfo[i].spriteset == kMonsterTwoWing) { - if (_npcinfo[i].attacknext < _ticks && _npcinfo[i].pause < _ticks && _npcinfo[i].attacking == 0) { + if (_npcinfo[i].attacknext < _ticks && _npcinfo[i].pause < _ticks && !_npcinfo[i].attacking) { npx = _npcinfo[i].bodysection[7].x; npy = _npcinfo[i].bodysection[7].y; @@ -855,7 +855,7 @@ void GriffonEngine::updateNPCs() { setChannelVolume(snd, config.effectsvol); } - _npcinfo[i].attacking = 1; + _npcinfo[i].attacking = true; _npcinfo[i].attackframe = 0; _npcinfo[i].headtargetx[0] = _player.px + 12; @@ -865,7 +865,7 @@ void GriffonEngine::updateNPCs() { } - if (_npcinfo[i].attacking == 0 && _npcinfo[i].castpause < _ticks) { + if (!_npcinfo[i].attacking && _npcinfo[i].castpause < _ticks) { _npcinfo[i].swayspd = 4; // sway code @@ -914,7 +914,7 @@ void GriffonEngine::updateNPCs() { // dragon2 specific if (_npcinfo[i].spriteset == kMonsterDragon2 && _npcinfo[i].attackattempt < _ticks) { - if (_npcinfo[i].attacknext < _ticks && _npcinfo[i].pause < _ticks && _npcinfo[i].attacking == 0) { + if (_npcinfo[i].attacknext < _ticks && _npcinfo[i].pause < _ticks && !_npcinfo[i].attacking) { npx = _npcinfo[i].x; npy = _npcinfo[i].y; @@ -929,7 +929,7 @@ void GriffonEngine::updateNPCs() { setChannelVolume(snd, config.effectsvol); } - _npcinfo[i].attacking = 1; + _npcinfo[i].attacking = true; _npcinfo[i].attackframe = 0; } } @@ -939,7 +939,7 @@ void GriffonEngine::updateNPCs() { // endboss specific if (_npcinfo[i].spriteset == kMonsterFinalBoss && _npcinfo[i].attackattempt < _ticks) { - if (_npcinfo[i].attacknext < _ticks && _npcinfo[i].pause < _ticks && _npcinfo[i].attacking == 0) { + if (_npcinfo[i].attacknext < _ticks && _npcinfo[i].pause < _ticks && !_npcinfo[i].attacking) { npx = _npcinfo[i].x; npy = _npcinfo[i].y; @@ -953,7 +953,7 @@ void GriffonEngine::updateNPCs() { int snd = playSound(_sfx[kSndIce]); setChannelVolume(snd, config.effectsvol); } - _npcinfo[i].attacking = 1; + _npcinfo[i].attacking = true; _npcinfo[i].attackframe = 0; } } @@ -978,14 +978,10 @@ void GriffonEngine::updateNPCs() { pass = 0; - if (_npcinfo[i].attacking == 1) + if (_npcinfo[i].attacking) pass = 1; if (_npcinfo[i].spriteset == kMonsterFireHydra) { - if (_npcinfo[i].attacking2[0] == 1) - pass = 1; - if (_npcinfo[i].attacking2[1] == 1) - pass = 1; - if (_npcinfo[i].attacking2[2] == 1) + if (_npcinfo[i].attacking2[0] || _npcinfo[i].attacking2[1] || _npcinfo[i].attacking2[2]) pass = 1; } @@ -997,7 +993,7 @@ void GriffonEngine::updateNPCs() { _npcinfo[i].attackframe = _npcinfo[i].attackframe + _npcinfo[i].attackspd * _fpsr; if (_npcinfo[i].attackframe >= 16) { _npcinfo[i].attackframe = 0; - _npcinfo[i].attacking = 0; + _npcinfo[i].attacking = false; _npcinfo[i].attacknext = _ticks + _npcinfo[i].attackdelay; } @@ -1014,7 +1010,7 @@ void GriffonEngine::updateNPCs() { if (abs(xdif) < dist && abs(ydif) < dist && _player.pause < _ticks) { _npcinfo[i].attacknext = _ticks + _npcinfo[i].attackdelay; // _npcinfo[i].attackframe = 0; - // _npcinfo[i].attacking = 0; + // _npcinfo[i].attacking = false; damage = (float)_npcinfo[i].attackdamage * (0.5 + RND() * 1.0); @@ -1048,7 +1044,7 @@ void GriffonEngine::updateNPCs() { _npcinfo[i].attackframe = _npcinfo[i].attackframe + _npcinfo[i].attackspd * _fpsr; if (_npcinfo[i].attackframe >= 16) { _npcinfo[i].attackframe = 0; - _npcinfo[i].attacking = 0; + _npcinfo[i].attacking = false; _npcinfo[i].attacknext = _ticks + _npcinfo[i].attackdelay; } @@ -1065,7 +1061,7 @@ void GriffonEngine::updateNPCs() { if (abs(xdif) < dist && abs(ydif) < dist && _player.pause < _ticks) { _npcinfo[i].attacknext = _ticks + _npcinfo[i].attackdelay; // _npcinfo[i].attackframe = 0 - // _npcinfo[i].attacking = 0 + // _npcinfo[i].attacking = false damage = (float)_npcinfo[i].attackdamage * (1.0 + (RND() * 0.5)); if (_player.hp > 0) damagePlayer(damage); @@ -1076,7 +1072,7 @@ void GriffonEngine::updateNPCs() { // firehydra if (_npcinfo[i].spriteset == kMonsterFireHydra) { for (int ff = 0; ff <= 2; ff++) { - if (_npcinfo[i].attacking2[ff] == 1) { + if (_npcinfo[i].attacking2[ff]) { float xdif = _npcinfo[i].bodysection[10 * ff + 9].x - _npcinfo[i].headtargetx[ff]; float ydif = _npcinfo[i].bodysection[10 * ff + 9].y - _npcinfo[i].headtargety[ff]; @@ -1100,7 +1096,7 @@ void GriffonEngine::updateNPCs() { _npcinfo[i].attackframe2[ff] = _npcinfo[i].attackframe2[ff] + _npcinfo[i].attackspd * _fpsr; if (_npcinfo[i].attackframe2[ff] >= 16) { _npcinfo[i].attackframe2[ff] = 0; - _npcinfo[i].attacking2[ff] = 0; + _npcinfo[i].attacking2[ff] = false; _npcinfo[i].attacknext2[ff] = _ticks + _npcinfo[i].attackdelay; } @@ -1117,7 +1113,7 @@ void GriffonEngine::updateNPCs() { if (abs(xdif) < dist && abs(ydif) < dist && _player.pause < _ticks) { _npcinfo[i].attacknext2[ff] = _ticks + _npcinfo[i].attackdelay; // _npcinfo[i].attackframe2(ff) = 0 - // _npcinfo[i].attacking2(ff) = 0 + // _npcinfo[i].attacking2(ff) = false damage = (float)_npcinfo[i].attackdamage * (1.0 + RND() * 0.5); if (_player.hp > 0) damagePlayer(damage); @@ -1153,7 +1149,7 @@ void GriffonEngine::updateNPCs() { _npcinfo[i].attackframe = _npcinfo[i].attackframe + _npcinfo[i].attackspd * _fpsr; if (_npcinfo[i].attackframe >= 16) { _npcinfo[i].attackframe = 0; - _npcinfo[i].attacking = 0; + _npcinfo[i].attacking = false; _npcinfo[i].attacknext = _ticks + _npcinfo[i].attackdelay; } @@ -1170,7 +1166,7 @@ void GriffonEngine::updateNPCs() { if (abs(xdif) < dist && abs(ydif) < dist && _player.pause < _ticks) { _npcinfo[i].attacknext = _ticks + _npcinfo[i].attackdelay; // _npcinfo[i].attackframe = 0 - // _npcinfo[i].attacking = 0 + // _npcinfo[i].attacking = false damage = (float)_npcinfo[i].attackdamage * (1.0 + RND() * 0.5); if (_player.hp > 0) damagePlayer(damage); @@ -1183,7 +1179,7 @@ void GriffonEngine::updateNPCs() { _npcinfo[i].attackframe = _npcinfo[i].attackframe + _npcinfo[i].attackspd * _fpsr; if (_npcinfo[i].attackframe >= 16) { _npcinfo[i].attackframe = 0; - _npcinfo[i].attacking = 0; + _npcinfo[i].attacking = false; _npcinfo[i].attacknext = _ticks + _npcinfo[i].attackdelay; } @@ -1200,7 +1196,7 @@ void GriffonEngine::updateNPCs() { if (abs(xdif) < dist && abs(ydif) < dist && _player.pause < _ticks) { _npcinfo[i].attacknext = _ticks + _npcinfo[i].attackdelay; // _npcinfo[i].attackframe = 0 - // _npcinfo[i].attacking = 0 + // _npcinfo[i].attacking = false damage = (float)_npcinfo[i].attackdamage * (0.5 + RND() * 1.0); if (_player.hp > 0) damagePlayer(damage); @@ -1212,7 +1208,7 @@ void GriffonEngine::updateNPCs() { _npcinfo[i].attackframe = _npcinfo[i].attackframe + _npcinfo[i].attackspd * _fpsr; if (_npcinfo[i].attackframe >= 16) { _npcinfo[i].attackframe = 0; - _npcinfo[i].attacking = 0; + _npcinfo[i].attacking = false; _npcinfo[i].attacknext = _ticks + _npcinfo[i].attackdelay; } @@ -1229,7 +1225,7 @@ void GriffonEngine::updateNPCs() { if (abs(xdif) < dist && abs(ydif) < dist && _player.pause < _ticks) { _npcinfo[i].attacknext = _ticks + _npcinfo[i].attackdelay; // _npcinfo[i].attackframe = 0 - // _npcinfo[i].attacking = 0 + // _npcinfo[i].attacking = false damage = (float)_npcinfo[i].attackdamage * (0.5 + RND() * 1.0); if (_player.hp > 0) damagePlayer(damage); @@ -1418,7 +1414,7 @@ void GriffonEngine::updateSpells() { if (ABS(spellinfo[i].frame) < 0 && _npcinfo[spellinfo[i].npc].spriteset == kMonsterBoss1) { int npc = spellinfo[i].npc; _npcinfo[npc].attackframe = 0; - _npcinfo[npc].attacking = 0; + _npcinfo[npc].attacking = false; _npcinfo[npc].pause = _ticks + 1000; _npcinfo[npc].attacknext = _ticks + 4000; @@ -1429,7 +1425,7 @@ void GriffonEngine::updateSpells() { if (ABS(spellinfo[i].frame) < 0 && _npcinfo[spellinfo[i].npc].spriteset == kMonsterBlackKnight) { int npc = spellinfo[i].npc; _npcinfo[npc].attackframe = 0; - _npcinfo[npc].attacking = 0; + _npcinfo[npc].attacking = false; _npcinfo[npc].pause = _ticks + 1000; _npcinfo[npc].attacknext = _ticks + 3500; @@ -1495,13 +1491,13 @@ void GriffonEngine::updateSpells() { rcSrc.setWidth(32); rcSrc.setHeight(32); - int scatter = 0; + bool scatter = false; if (fr < 8 + f) { xloc = spellinfo[i].enemyx - 4; yloc = spellinfo[i].enemyy * (1 - cos(3.14159 / 2 * (fr - f) / 8)); // ^ 2; yloc *= yloc; } else { - scatter = 1; + scatter = true; xloc = spellinfo[i].enemyx - 4 - spellinfo[i].rockdeflect[f] * sin(3.14159 / 2 * ((fr - f) - 8) / 8); yloc = spellinfo[i].enemyy + hght * (1 - cos(3.14159 / 2 * ((fr - f) - 8) / 8)); } @@ -1512,7 +1508,7 @@ void GriffonEngine::updateSpells() { if (xloc > -16 && xloc < 304 && yloc > -16 && yloc < 224) { _spellimg->blit(*_videobuffer, rcDest.left, rcDest.top, Graphics::FLIP_NONE, &rcSrc); - if (scatter == 1) { + if (scatter) { if (spellinfo[i].damagewho == 0) { for (int e = 1; e <= _lastnpc; e++) { float xdif = (xloc + 16) - (_npcinfo[e].x + 12); @@ -1604,9 +1600,9 @@ void GriffonEngine::updateSpells() { int lx = (int)npx / 16; int ly = (int)npy / 16; - int foundel[5]; + bool foundel[5]; for (int f1 = 0; f1 < 5; f1++) { // !! f < 5 - foundel[f1] = 0; + foundel[f1] = false; } for (int xo = -2; xo <= 2; xo++) { @@ -1627,17 +1623,17 @@ void GriffonEngine::updateSpells() { int element = elementmap[curtiley][curtilex]; if (element > -1 && curtilel == 0) - foundel[element + 1] = 1; + foundel[element + 1] = true; } } int o = _objectMap[sx][sy]; if (o > -1) { if (_objectInfo[o][4] == 1) - foundel[2] = 1; + foundel[2] = true; if (o == 1 || o == 2) { - foundel[2] = 1; - foundel[4] = 1; + foundel[2] = true; + foundel[4] = true; } } } @@ -1648,8 +1644,8 @@ void GriffonEngine::updateSpells() { strcpy(line, "Found... nothing..."); for (int f1 = 0; f1 < 5; f1++) { - if (foundel[f1] == 1 && _player.foundSpell[f1] == 0) { - _player.foundSpell[f1] = 1; + if (foundel[f1] && !_player.foundSpell[f1]) { + _player.foundSpell[f1] = true; _player.spellCharge[f1] = 0; if (f1 == 1) strcpy(line, "Found... Water Essence"); @@ -2067,7 +2063,7 @@ void GriffonEngine::updateSpells() { if (spellinfo[i].frame < 0) { spellinfo[i].frame = 0; - _npcinfo[spellinfo[i].npc].attacking = 0; + _npcinfo[spellinfo[i].npc].attacking = false; _npcinfo[spellinfo[i].npc].attacknext = _ticks + _npcinfo[spellinfo[i].npc].attackdelay; } } @@ -2361,7 +2357,7 @@ void GriffonEngine::updateSpellsUnder() { spellinfo[i].frame = 0; if (ABS(spellinfo[i].frame) < kEpsilon) { - _npcinfo[spellinfo[i].npc].attacking = 0; + _npcinfo[spellinfo[i].npc].attacking = false; _npcinfo[spellinfo[i].npc].attacknext = _ticks + _npcinfo[spellinfo[i].npc].attackdelay; } } diff --git a/engines/griffon/resources.cpp b/engines/griffon/resources.cpp index d24a947a7c..0c8b7045e5 100644 --- a/engines/griffon/resources.cpp +++ b/engines/griffon/resources.cpp @@ -158,27 +158,27 @@ void GriffonEngine::loadMap(int mapnum) { _clipbg2->fillRect(trect, ccc); _forcepause = false; - cloudson = 0; + _cloudsOn = false; if (mapnum < 6) - cloudson = 1; + _cloudsOn = true; if (mapnum > 41) - cloudson = 1; + _cloudsOn = true; if (mapnum > 47) - cloudson = 0; + _cloudsOn = false; if (mapnum == 52) - cloudson = 1; + _cloudsOn = true; if (mapnum == 60) - cloudson = 1; + _cloudsOn = true; if (mapnum == 50) - cloudson = 1; + _cloudsOn = true; if (mapnum == 54) - cloudson = 1; + _cloudsOn = true; if (mapnum == 58) - cloudson = 1; + _cloudsOn = true; if (mapnum == 62) - cloudson = 1; + _cloudsOn = true; if (mapnum == 83) - cloudson = 1; + _cloudsOn = true; // -----------special case dontdrawover = 0; @@ -390,7 +390,7 @@ void GriffonEngine::loadMap(int mapnum) { _lastnpc = 0; for (int i = 0; i < kMaxNPC; i++) - _npcinfo[i].onmap = 0; + _npcinfo[i].onmap = false; for (int x = 0; x <= 19; x++) { for (int y = 0; y <= 19; y++) { @@ -444,7 +444,7 @@ void GriffonEngine::loadMap(int mapnum) { _npcinfo[o].y = y * 16 - 5; _npcinfo[o].walkdir = 1; - _npcinfo[o].onmap = 1; + _npcinfo[o].onmap = true; } } } @@ -644,12 +644,12 @@ void GriffonEngine::loadMap(int mapnum) { _npcinfo[i].floating = RND() * 16; } - if (_npcinfo[i].onmap == 0) + if (!_npcinfo[i].onmap) _npcinfo[i].hp = 0; _npcinfo[i].maxhp = _npcinfo[i].hp; - _npcinfo[i].attacking = 0; + _npcinfo[i].attacking = false; _npcinfo[i].attackframe = 0; _npcinfo[i].cattackframe = 0; _npcinfo[i].attackspd = 1.5; @@ -693,7 +693,7 @@ void GriffonEngine::loadMap(int mapnum) { _npcinfo[i].headtargetx[f] = _npcinfo[i].x + 12; _npcinfo[i].headtargety[f] = _npcinfo[i].y + 14; - _npcinfo[i].attacking2[f] = 0; + _npcinfo[i].attacking2[f] = false; _npcinfo[i].attackframe2[f] = 0; } } @@ -763,7 +763,7 @@ void GriffonEngine::loadMap(int mapnum) { } // academy crystal - if (_curmap == 24 && _player.foundSpell[0] == 0 && _scriptflag[kScriptFindCrystal][0] == 1) { + if (_curmap == 24 && !_player.foundSpell[0] && _scriptflag[kScriptFindCrystal][0] == 1) { cx = 9; cy = 7; |