diff options
author | Cameron Cawley | 2019-11-16 18:02:52 +0000 |
---|---|---|
committer | Eugene Sandulenko | 2019-11-17 22:32:39 +0100 |
commit | c5a5e0f68a8d740f37f234e773988e8f58273466 (patch) | |
tree | acafb82d05949ccb29720c6634eabfc8bda3b08e /engines/griffon | |
parent | 397a29a5a26c9b3889fa7e47ecd4240d5488c2f9 (diff) | |
download | scummvm-rg350-c5a5e0f68a8d740f37f234e773988e8f58273466.tar.gz scummvm-rg350-c5a5e0f68a8d740f37f234e773988e8f58273466.tar.bz2 scummvm-rg350-c5a5e0f68a8d740f37f234e773988e8f58273466.zip |
GRIFFON: Replace use of abs() with ABS()
Diffstat (limited to 'engines/griffon')
-rw-r--r-- | engines/griffon/combat.cpp | 10 | ||||
-rw-r--r-- | engines/griffon/draw.cpp | 4 | ||||
-rw-r--r-- | engines/griffon/input.cpp | 8 | ||||
-rw-r--r-- | engines/griffon/logic.cpp | 82 |
4 files changed, 52 insertions, 52 deletions
diff --git a/engines/griffon/combat.cpp b/engines/griffon/combat.cpp index a21ce7f4f0..3c9a6381a1 100644 --- a/engines/griffon/combat.cpp +++ b/engines/griffon/combat.cpp @@ -523,16 +523,16 @@ void GriffonEngine::checkHit() { bool hit = false; if (_player.walkDir == 0) { - if (abs(xdif) <= 8 && ydif >= 0 && ydif < 8) + if (ABS(xdif) <= 8 && ydif >= 0 && ydif < 8) hit = true; } else if (_player.walkDir == 1) { - if (abs(xdif) <= 8 && ydif <= 0 && ydif > -8) + if (ABS(xdif) <= 8 && ydif <= 0 && ydif > -8) hit = true; } else if (_player.walkDir == 2) { - if (abs(ydif) <= 8 && xdif >= -8 && xdif < 8) + if (ABS(ydif) <= 8 && xdif >= -8 && xdif < 8) hit = true; } else if (_player.walkDir == 3) { - if (abs(ydif) <= 8 && xdif <= 8 && xdif > -8) + if (ABS(ydif) <= 8 && xdif <= 8 && xdif > -8) hit = true; } @@ -561,7 +561,7 @@ void GriffonEngine::damageNPC(int npcnum, int damage, int spell) { int heal = 0; if (damage < 0) heal = 1; - damage = abs(damage); + damage = ABS(damage); if (heal == 0) { if (damage > _npcInfo[npcnum].hp) { diff --git a/engines/griffon/draw.cpp b/engines/griffon/draw.cpp index 0e6b3488dd..fe28384868 100644 --- a/engines/griffon/draw.cpp +++ b/engines/griffon/draw.cpp @@ -804,7 +804,7 @@ void GriffonEngine::drawNPCs(int mode) { int xdif = (xloc + 8) - (_player.px + 12); int ydif = (yloc + 8) - (_player.py + 12); - if ((abs(xdif) < 8 && abs(ydif) < 8) && _player.pause < _ticks) { + if ((ABS(xdif) < 8 && ABS(ydif) < 8) && _player.pause < _ticks) { float damage = (float)_npcInfo[i].spellDamage * (1.0 + RND() * 0.5); if (_player.hp > 0) { @@ -830,7 +830,7 @@ void GriffonEngine::drawNPCs(int mode) { xdif = (xloc + 8) - (_player.px + 12); ydif = (yloc + 8) - (_player.py + 12); - if ((abs(xdif) < 8 && abs(ydif) < 8) && _player.pause < _ticks) { + if ((ABS(xdif) < 8 && ABS(ydif) < 8) && _player.pause < _ticks) { float damage = (float)_npcInfo[i].spellDamage * (1.0 + RND() * 0.5); if (_player.hp > 0) { diff --git a/engines/griffon/input.cpp b/engines/griffon/input.cpp index 7bb33f7ddc..64c260b9c4 100644 --- a/engines/griffon/input.cpp +++ b/engines/griffon/input.cpp @@ -503,16 +503,16 @@ void GriffonEngine::handleWalking() { int ydif = _player.py - npy; if (_player.walkDir == 0) { - if (abs(xdif) <= 8 && ydif > 0 && ydif < 8) + if (ABS(xdif) <= 8 && ydif > 0 && ydif < 8) _npcInfo[i].y -= spd; } else if (_player.walkDir == 1) { - if (abs(xdif) <= 8 && ydif < 0 && ydif > -8) + if (ABS(xdif) <= 8 && ydif < 0 && ydif > -8) _npcInfo[i].y += spd; } else if (_player.walkDir == 2) { - if (abs(ydif) <= 8 && xdif > 0 && xdif < 8) + if (ABS(ydif) <= 8 && xdif > 0 && xdif < 8) _npcInfo[i].x -= spd; } else if (_player.walkDir == 3) { - if (abs(ydif) <= 8 && xdif < 0 && xdif > -8) + if (ABS(ydif) <= 8 && xdif < 0 && xdif > -8) _npcInfo[i].x += spd; } diff --git a/engines/griffon/logic.cpp b/engines/griffon/logic.cpp index 47d49113bf..d0ed91b2c3 100644 --- a/engines/griffon/logic.cpp +++ b/engines/griffon/logic.cpp @@ -157,7 +157,7 @@ void GriffonEngine::updateNPCs() { float xdif = _player.px - npx; float ydif = _player.py - npy; - if (abs(xdif) < 4 * 16 && abs(ydif) < 4 * 16 && mode < 3) + if (ABS(xdif) < 4 * 16 && ABS(ydif) < 4 * 16 && mode < 3) mode = 0; if (_npcInfo[i].hp < _npcInfo[i].maxhp * 0.25) mode = 3; @@ -169,7 +169,7 @@ void GriffonEngine::updateNPCs() { if (mode == 3) { mode = 1; - if (abs(xdif) < 4 * 16 && abs(ydif) < 4 * 16) + if (ABS(xdif) < 4 * 16 && ABS(ydif) < 4 * 16) mode = 3; } @@ -185,7 +185,7 @@ void GriffonEngine::updateNPCs() { xdif = _player.px - npx; ydif = _player.py - npy; - if (abs(xdif) > abs(ydif)) { + if (ABS(xdif) > ABS(ydif)) { if (xdif < 4) wdir = 2; if (xdif > -4) @@ -263,7 +263,7 @@ void GriffonEngine::updateNPCs() { xdif = _player.px - npx; ydif = _player.py - npy; - if (abs(xdif) > abs(ydif)) { + if (ABS(xdif) > ABS(ydif)) { if (xdif < 4) wdir = 3; if (xdif > -4) @@ -532,7 +532,7 @@ void GriffonEngine::updateNPCs() { xdif = _player.px - npx; ydif = _player.py - npy; - if (abs(xdif) < 20 && abs(ydif) < 20) { + if (ABS(xdif) < 20 && ABS(ydif) < 20) { _npcInfo[i].attackattempt = _ticks + 100; if ((int)(RND() * 2) == 0) { if (config.effects) { @@ -558,7 +558,7 @@ void GriffonEngine::updateNPCs() { xdif = _player.px - npx; ydif = _player.py - npy; - if (abs(xdif) < 24 && abs(ydif) < 24) { + if (ABS(xdif) < 24 && ABS(ydif) < 24) { float dist = sqrt(xdif * xdif + ydif * ydif); if ((dist) < 24) { @@ -664,7 +664,7 @@ void GriffonEngine::updateNPCs() { xdif = _player.px - npx; ydif = _player.py - npy; - if (abs(xdif) < 48 && abs(ydif) < 48) { + if (ABS(xdif) < 48 && ABS(ydif) < 48) { float dist = sqrt(xdif * xdif + ydif * ydif); if ((dist) < 36) { @@ -725,9 +725,9 @@ void GriffonEngine::updateNPCs() { ydif = _player.py - npy; pass = 0; - if (abs(xdif) < 48 && abs(ydif) < 6) + if (ABS(xdif) < 48 && ABS(ydif) < 6) pass = 1; - if (abs(ydif) < 48 && abs(xdif) < 6) + if (ABS(ydif) < 48 && ABS(xdif) < 6) pass = 2; if (pass > 0) { @@ -791,9 +791,9 @@ void GriffonEngine::updateNPCs() { ydif = _player.py - npy; pass = 0; - if (abs(xdif) < 56 && abs(ydif) < 6) + if (ABS(xdif) < 56 && ABS(ydif) < 6) pass = 1; - if (abs(ydif) < 56 && abs(xdif) < 6) + if (ABS(ydif) < 56 && ABS(xdif) < 6) pass = 2; if (pass > 0) { @@ -844,7 +844,7 @@ void GriffonEngine::updateNPCs() { xdif = _player.px - npx; ydif = _player.py - npy; - if (abs(xdif) < 24 && abs(ydif) < 24) { + if (ABS(xdif) < 24 && ABS(ydif) < 24) { float dist = sqrt(xdif * xdif + ydif * ydif); if ((dist) < 24) { @@ -919,7 +919,7 @@ void GriffonEngine::updateNPCs() { xdif = _player.px - npx; ydif = _player.py - npy; - if (abs(xdif) < 32 && abs(ydif) < 32) { + if (ABS(xdif) < 32 && ABS(ydif) < 32) { _npcInfo[i].attackattempt = _ticks + 100; if ((int)(RND() * 2) == 0) { if (config.effects) { @@ -944,7 +944,7 @@ void GriffonEngine::updateNPCs() { xdif = _player.px - npx; ydif = _player.py - npy; - if (abs(xdif) < 38 && abs(ydif) < 38) { + if (ABS(xdif) < 38 && ABS(ydif) < 38) { _npcInfo[i].attackattempt = _ticks + 100; if ((int)(RND() * 2) == 0) { if (config.effects) { @@ -1005,7 +1005,7 @@ void GriffonEngine::updateNPCs() { dist = 10; - if (abs(xdif) < dist && abs(ydif) < dist && _player.pause < _ticks) { + if (ABS(xdif) < dist && ABS(ydif) < dist && _player.pause < _ticks) { _npcInfo[i].attacknext = _ticks + _npcInfo[i].attackdelay; // _npcinfo[i].attackframe = 0; // _npcinfo[i].attacking = false; @@ -1056,7 +1056,7 @@ void GriffonEngine::updateNPCs() { dist = 8; - if (abs(xdif) < dist && abs(ydif) < dist && _player.pause < _ticks) { + if (ABS(xdif) < dist && ABS(ydif) < dist && _player.pause < _ticks) { _npcInfo[i].attacknext = _ticks + _npcInfo[i].attackdelay; // _npcinfo[i].attackframe = 0 // _npcinfo[i].attacking = false @@ -1108,7 +1108,7 @@ void GriffonEngine::updateNPCs() { dist = 8; - if (abs(xdif) < dist && abs(ydif) < dist && _player.pause < _ticks) { + 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) = false @@ -1161,7 +1161,7 @@ void GriffonEngine::updateNPCs() { dist = 8; - if (abs(xdif) < dist && abs(ydif) < dist && _player.pause < _ticks) { + if (ABS(xdif) < dist && ABS(ydif) < dist && _player.pause < _ticks) { _npcInfo[i].attacknext = _ticks + _npcInfo[i].attackdelay; // _npcinfo[i].attackframe = 0 // _npcinfo[i].attacking = false @@ -1191,7 +1191,7 @@ void GriffonEngine::updateNPCs() { dist = 16 + _npcInfo[i].attackframe; - if (abs(xdif) < dist && abs(ydif) < dist && _player.pause < _ticks) { + if (ABS(xdif) < dist && ABS(ydif) < dist && _player.pause < _ticks) { _npcInfo[i].attacknext = _ticks + _npcInfo[i].attackdelay; // _npcinfo[i].attackframe = 0 // _npcinfo[i].attacking = false @@ -1220,7 +1220,7 @@ void GriffonEngine::updateNPCs() { dist = 36; - if (abs(xdif) < dist && abs(ydif) < dist && _player.pause < _ticks) { + if (ABS(xdif) < dist && ABS(ydif) < dist && _player.pause < _ticks) { _npcInfo[i].attacknext = _ticks + _npcInfo[i].attackdelay; // _npcinfo[i].attackframe = 0 // _npcinfo[i].attacking = false @@ -1313,7 +1313,7 @@ void GriffonEngine::updateSpells() { float xdif = (xloc + 16) - (_npcInfo[e].x + 12); float ydif = (yloc + 16) - (_npcInfo[e].y + 12); - if ((abs(xdif) < 16 && abs(ydif) < 16)) { + if ((ABS(xdif) < 16 && ABS(ydif) < 16)) { float damage = (float)_player.spellDamage * (1.0 + RND() * 0.5) * (float)_spellInfo[i].strength; if (_npcInfo[e].hp > 0 && _npcInfo[e].pause < _ticks) { @@ -1333,7 +1333,7 @@ void GriffonEngine::updateSpells() { float xdif = (xloc + 16) - (_postInfo[e][0] + 8); float ydif = (yloc + 16) - (_postInfo[e][1] + 8); - if ((abs(xdif) < 16 && abs(ydif) < 16)) { + if ((ABS(xdif) < 16 && ABS(ydif) < 16)) { _objectMapFull[_curMap][(int)_postInfo[e][0] / 16][(int)_postInfo[e][1] / 16] = 1; _objectMap[(int)_postInfo[e][0] / 16][(int)_postInfo[e][1] / 16] = -1; @@ -1393,7 +1393,7 @@ void GriffonEngine::updateSpells() { float xdif = (xloc + 24) - (_npcInfo[e].x + 12); float ydif = (yloc + 24) - (_npcInfo[e].y + 12); - if ((abs(xdif) < 24 && abs(ydif) < 24)) { + if ((ABS(xdif) < 24 && ABS(ydif) < 24)) { float damage = (float)_player.spellDamage * (1.0 + RND() * 0.5) * (float)_spellInfo[i].strength; if (_npcInfo[e].hp > 0 && _npcInfo[e].pause < _ticks) { @@ -1433,7 +1433,7 @@ void GriffonEngine::updateSpells() { float xdif = (xloc + 24) - (_player.px + 12); float ydif = (yloc + 24) - (_player.py + 12); - if ((abs(xdif) < 24 && abs(ydif) < 24) && _player.pause < _ticks) { + if ((ABS(xdif) < 24 && ABS(ydif) < 24) && _player.pause < _ticks) { float damage = (float)_npcInfo[_spellInfo[i].npc].spellDamage * (1.0 + RND() * 0.5); if (_player.hp > 0) { @@ -1453,7 +1453,7 @@ void GriffonEngine::updateSpells() { float xdif = (xloc + 24) - (_postInfo[e][0] + 8); float ydif = (yloc + 24) - (_postInfo[e][1] + 8); - if ((abs(xdif) < 24 && abs(ydif) < 24)) { + if ((ABS(xdif) < 24 && ABS(ydif) < 24)) { _objectMapFull[_curMap][(int)_postInfo[e][0] / 16][(int)_postInfo[e][1] / 16] = 1; _objectMap[(int)_postInfo[e][0] / 16][(int)_postInfo[e][1] / 16] = -1; @@ -1513,7 +1513,7 @@ void GriffonEngine::updateSpells() { float xdif = (xloc + 16) - (_npcInfo[e].x + 12); float ydif = (yloc + 16) - (_npcInfo[e].y + 12); - if ((abs(xdif) < 16 && abs(ydif) < 16)) { + if ((ABS(xdif) < 16 && ABS(ydif) < 16)) { float damage = (float)_player.spellDamage * (1.0 + RND() * 0.5) * (float)_spellInfo[i].strength; if (_npcInfo[e].hp > 0 && _npcInfo[e].pause < _ticks) { @@ -1534,7 +1534,7 @@ void GriffonEngine::updateSpells() { float xdif = (xloc + 16) - (_postInfo[e][0] + 8); float ydif = (yloc + 16) - (_postInfo[e][1] + 8); - if ((abs(xdif) < 16 && abs(ydif) < 16)) { + if ((ABS(xdif) < 16 && ABS(ydif) < 16)) { _objectMapFull[_curMap][(int)_postInfo[e][0] / 16][(int)_postInfo[e][1] / 16] = 1; _objectMap[(int)_postInfo[e][0] / 16][(int)_postInfo[e][1] / 16] = -1; @@ -1736,7 +1736,7 @@ void GriffonEngine::updateSpells() { float xdif = (xloc + 8) - (_player.px + 12); float ydif = (yloc + 8) - (_player.py + 12); - if ((abs(xdif) < 8 && abs(ydif) < 8) && _player.pause < _ticks) { + if ((ABS(xdif) < 8 && ABS(ydif) < 8) && _player.pause < _ticks) { float damage = _npcInfo[_spellInfo[i].npc].spellDamage * (1 + RND() * 0.5) / 3; if (_player.hp > 0) @@ -1790,7 +1790,7 @@ void GriffonEngine::updateSpells() { float xdif = (x + 16) - (_npcInfo[e].x + 12); float ydif = (y + 16) - (_npcInfo[e].y + 12); - if ((abs(xdif) < 8 && abs(ydif) < 8)) { + if ((ABS(xdif) < 8 && ABS(ydif) < 8)) { float damage = 30 * (1 + RND() * 0.5); if (_npcInfo[e].hp > 0 && _npcInfo[e].pause < _ticks) @@ -1805,7 +1805,7 @@ void GriffonEngine::updateSpells() { float xdif = (xloc + 16) - (_postInfo[e][0] + 8); float ydif = (yloc + 16) - (_postInfo[e][1] + 8); - if ((abs(xdif) < 16 && abs(ydif) < 16)) { + if ((ABS(xdif) < 16 && ABS(ydif) < 16)) { _objectMapFull[_curMap][(int)_postInfo[e][0] / 16][(int)_postInfo[e][1] / 16] = 1; _objectMap[(int)_postInfo[e][0] / 16][(int)_postInfo[e][1] / 16] = -1; @@ -1847,7 +1847,7 @@ void GriffonEngine::updateSpells() { float xdif = (x + 16) - (_npcInfo[e].x + 12); float ydif = (y + 16) - (_npcInfo[e].y + 12); - if ((abs(xdif) < 8 && abs(ydif) < 8)) { + if ((ABS(xdif) < 8 && ABS(ydif) < 8)) { float damage = 30 * (1 + RND() * 0.5); if (_npcInfo[e].hp > 0 && _npcInfo[e].pause < _ticks) @@ -1862,7 +1862,7 @@ void GriffonEngine::updateSpells() { float xdif = (xloc + 16) - (_postInfo[e][0] + 8); float ydif = (yloc + 16) - (_postInfo[e][1] + 8); - if ((abs(xdif) < 16 && abs(ydif) < 16)) { + if ((ABS(xdif) < 16 && ABS(ydif) < 16)) { _objectMapFull[_curMap][(int)_postInfo[e][0] / 16][(int)_postInfo[e][1] / 16] = 1; _objectMap[(int)_postInfo[e][0] / 16][(int)_postInfo[e][1] / 16] = -1; @@ -1904,7 +1904,7 @@ void GriffonEngine::updateSpells() { float xdif = (x + 16) - (_npcInfo[e].x + 12); float ydif = (y + 16) - (_npcInfo[e].y + 12); - if ((abs(xdif) < 8 && abs(ydif) < 8)) { + if ((ABS(xdif) < 8 && ABS(ydif) < 8)) { float damage = 30 * (1 + RND() * 0.5); if (_npcInfo[e].hp > 0 && _npcInfo[e].pause < _ticks) @@ -1919,7 +1919,7 @@ void GriffonEngine::updateSpells() { float xdif = (xloc + 16) - (_postInfo[e][0] + 8); float ydif = (yloc + 16) - (_postInfo[e][1] + 8); - if ((abs(xdif) < 16 && abs(ydif) < 16)) { + if ((ABS(xdif) < 16 && ABS(ydif) < 16)) { _objectMapFull[_curMap][(int)_postInfo[e][0] / 16][(int)_postInfo[e][1] / 16] = 1; _objectMap[(int)_postInfo[e][0] / 16][(int)_postInfo[e][1] / 16] = -1; @@ -1961,7 +1961,7 @@ void GriffonEngine::updateSpells() { float xdif = (x + 16) - (_npcInfo[e].x + 12); float ydif = (y + 16) - (_npcInfo[e].y + 12); - if ((abs(xdif) < 8 && abs(ydif) < 8)) { + if ((ABS(xdif) < 8 && ABS(ydif) < 8)) { float damage = 30 * (1 + RND() * 0.5); if (_npcInfo[e].hp > 0 && _npcInfo[e].pause < _ticks) @@ -1976,7 +1976,7 @@ void GriffonEngine::updateSpells() { float xdif = (xloc + 16) - (_postInfo[e][0] + 8); float ydif = (yloc + 16) - (_postInfo[e][1] + 8); - if ((abs(xdif) < 16 && abs(ydif) < 16)) { + if ((ABS(xdif) < 16 && ABS(ydif) < 16)) { _objectMapFull[_curMap][(int)_postInfo[e][0] / 16][(int)_postInfo[e][1] / 16] = 1; _objectMap[(int)_postInfo[e][0] / 16][(int)_postInfo[e][1] / 16] = -1; @@ -2038,7 +2038,7 @@ void GriffonEngine::updateSpells() { float xdif = (x + 8) - (_player.px + 12); float ydif = (y + 8) - (_player.py + 12); - if ((abs(xdif) < 8 && abs(ydif) < 8) && _player.pause < _ticks) { + if ((ABS(xdif) < 8 && ABS(ydif) < 8) && _player.pause < _ticks) { float damage = ((float)_player.hp * 0.75) * (RND() * 0.5 + 0.5); if (damage < 5) damage = 5; @@ -2211,7 +2211,7 @@ void GriffonEngine::updateSpellsUnder() { float xdif = (xloc + 8) - (_npcInfo[e].x + 12); float ydif = (yloc + 8) - (_npcInfo[e].y + 12); - if ((abs(xdif) < 8 && abs(ydif) < 8)) { + if ((ABS(xdif) < 8 && ABS(ydif) < 8)) { float damage = (float)_player.spellDamage * (1.0 + RND() * 0.5) * (float)_spellInfo[i].strength; if (_npcInfo[e].spriteset == kMonsterFireHydra) @@ -2233,7 +2233,7 @@ void GriffonEngine::updateSpellsUnder() { float xdif = (xloc + 8) - (_player.px + 12); float ydif = (yloc + 8) - (_player.py + 12); - if ((abs(xdif) < 8 && abs(ydif) < 8) && _player.pause < _ticks) { + if ((ABS(xdif) < 8 && ABS(ydif) < 8) && _player.pause < _ticks) { float damage = (float)_npcInfo[_spellInfo[i].npc].spellDamage * (1.0 + RND() * 0.5); if (_player.hp > 0) { @@ -2253,7 +2253,7 @@ void GriffonEngine::updateSpellsUnder() { float xdif = (xloc + 8) - (_postInfo[e][0] + 8); float ydif = (yloc + 8) - (_postInfo[e][1] + 8); - if ((abs(xdif) < 8 && abs(ydif) < 8)) { + if ((ABS(xdif) < 8 && ABS(ydif) < 8)) { _objectMapFull[_curMap][(int)_postInfo[e][0] / 16][(int)_postInfo[e][1] / 16] = 1; _objectMap[(int)_postInfo[e][0] / 16][(int)_postInfo[e][1] / 16] = -1; @@ -2324,7 +2324,7 @@ void GriffonEngine::updateSpellsUnder() { float xdif = (xloc + 8) - (_player.px + 12); float ydif = (yloc + 8) - (_player.py + 12); - if ((abs(xdif) < 8 && abs(ydif) < 8) && _player.pause < _ticks && alpha > 64) { + if ((ABS(xdif) < 8 && ABS(ydif) < 8) && _player.pause < _ticks && alpha > 64) { float damage = (float)_npcInfo[_spellInfo[i].npc].spellDamage * (1.0 + RND() * 0.5); if (_player.hp > 0) { |