diff options
author | Strangerke | 2019-09-16 22:41:37 +0200 |
---|---|---|
committer | Eugene Sandulenko | 2019-11-13 22:07:08 +0100 |
commit | 57af73cb18c243d6af86cbaf56da73eb0f2cc96e (patch) | |
tree | 21a58e1525e7effa315a65b6d964a007b17090d0 /engines/griffon | |
parent | 92e22e4153963b8bd57f149dc335ee852beaf7c0 (diff) | |
download | scummvm-rg350-57af73cb18c243d6af86cbaf56da73eb0f2cc96e.tar.gz scummvm-rg350-57af73cb18c243d6af86cbaf56da73eb0f2cc96e.tar.bz2 scummvm-rg350-57af73cb18c243d6af86cbaf56da73eb0f2cc96e.zip |
GRIFFON: Various code simplifications and renaming
Diffstat (limited to 'engines/griffon')
-rw-r--r-- | engines/griffon/combat.cpp | 68 | ||||
-rw-r--r-- | engines/griffon/dialogs.cpp | 54 | ||||
-rw-r--r-- | engines/griffon/draw.cpp | 54 | ||||
-rw-r--r-- | engines/griffon/engine.cpp | 104 | ||||
-rw-r--r-- | engines/griffon/griffon.h | 28 | ||||
-rw-r--r-- | engines/griffon/input.cpp | 46 | ||||
-rw-r--r-- | engines/griffon/logic.cpp | 132 | ||||
-rw-r--r-- | engines/griffon/resources.cpp | 2 | ||||
-rw-r--r-- | engines/griffon/saveload.cpp | 82 |
9 files changed, 280 insertions, 290 deletions
diff --git a/engines/griffon/combat.cpp b/engines/griffon/combat.cpp index ecdcf55ee5..2ef46c7b63 100644 --- a/engines/griffon/combat.cpp +++ b/engines/griffon/combat.cpp @@ -48,7 +48,7 @@ void GriffonEngine::attack() { int ly = (int)npy / 16; // if facing up - if (_player.walkdir == 0) { + if (_player.walkDir == 0) { if (ly > 0) { int o2 = 0; // ?? int o = _objectMap[lx][ly - 1]; @@ -119,8 +119,8 @@ void GriffonEngine::attack() { } if (oscript == kScriptFindCtystal) { - _player.foundspell[0] = 1; - _player.spellcharge[0] = 0; + _player.foundSpell[0] = 1; + _player.spellCharge[0] = 0; addFloatIcon(7, lx * 16, (ly - 1) * 16); @@ -409,7 +409,7 @@ void GriffonEngine::attack() { } attacking = true; - _player.attackframe = 0; + _player.attackFrame = 0; movingup = false; movingdown = false; movingleft = false; @@ -444,8 +444,8 @@ void GriffonEngine::castSpell(int spellnum, float homex, float homey, float enem spellinfo[i].frame = 32.0f; if (damagewho == 0) { - spellinfo[i].strength = _player.spellstrength / 100; - if (ABS(_player.spellstrength - 100) < kEpsilon) + spellinfo[i].strength = _player.spellStrength / 100; + if (ABS(_player.spellStrength - 100) < kEpsilon) spellinfo[i].strength = 1.5f; } @@ -518,26 +518,26 @@ void GriffonEngine::checkHit() { float ps = _player.sword; if (ps > 1) - ps = ps * 0.75; - float damage = (float)_player.sworddamage * (1.0 + RND() * 1.0) * _player.attackstrength / 100.0 * ps; + ps *= 0.75; + float damage = (float)_player.swordDamage * (1.0 + RND() * 1.0) * _player.attackStrength / 100.0 * ps; if (_console->_godMode) damage = 1000; - if (ABS(_player.attackstrength - 100) < kEpsilon) + if (ABS(_player.attackStrength - 100) < kEpsilon) damage *= 1.5; bool hit = false; - if (_player.walkdir == 0) { + if (_player.walkDir == 0) { if (abs(xdif) <= 8 && ydif >= 0 && ydif < 8) hit = true; - } else if (_player.walkdir == 1) { + } else if (_player.walkDir == 1) { if (abs(xdif) <= 8 && ydif <= 0 && ydif > -8) hit = true; - } else if (_player.walkdir == 2) { + } else if (_player.walkDir == 2) { if (abs(ydif) <= 8 && xdif >= -8 && xdif < 8) hit = true; - } else if (_player.walkdir == 3) { + } else if (_player.walkDir == 3) { if (abs(ydif) <= 8 && xdif <= 8 && xdif > -8) hit = true; } @@ -593,7 +593,7 @@ void GriffonEngine::damageNPC(int npcnum, int damage, int spell) { _npcinfo[npcnum].pause = _ticks + 900; if (spell == 0) - _player.attackstrength = ratio; + _player.attackStrength = ratio; } addFloatText(line, _npcinfo[npcnum].x + 12 - 4 * strlen(line), _npcinfo[npcnum].y + 16, fcol); @@ -603,7 +603,7 @@ void GriffonEngine::damageNPC(int npcnum, int damage, int spell) { // if enemy is killed if (_npcinfo[npcnum].hp == 0) { - _player.exp = _player.exp + _npcinfo[npcnum].maxhp; + _player.exp += _npcinfo[npcnum].maxhp; if (_npcinfo[npcnum].spriteset == kMonsterBabyDragon || _npcinfo[npcnum].spriteset == kMonsterPriest || _npcinfo[npcnum].spriteset == kMonsterRedDragon) { @@ -676,7 +676,7 @@ void GriffonEngine::damageNPC(int npcnum, int damage, int spell) { int ly = (int)npy / 16; if (lx == cx && ly == cy) - _player.py = _player.py + 16; + _player.py += 16; _clipbg2->fillRect(rcDest, _clipbg->format.RGBToColor(255, 255, 255)); _scriptflag[kScriptMasterKey][0] = 1; } @@ -708,7 +708,7 @@ void GriffonEngine::damageNPC(int npcnum, int damage, int spell) { int ly = (int)npy / 16; if (lx == cx && ly == cy) - _player.py = _player.py + 16; + _player.py += 16; _scriptflag[kScriptFindCtystal][0] = 1; _clipbg2->fillRect(rcDest, _clipbg->format.RGBToColor(255, 255, 255)); } @@ -718,17 +718,17 @@ void GriffonEngine::damageNPC(int npcnum, int damage, int spell) { if (_npcinfo[npcnum].script == kScriptFindShield && _scriptflag[kScriptFindShield][0] == 0) { _triggerloc[9][7] = 5004; - int curtile = 40; - int curtilel = 0; - int curtilex = curtile % 20; - int curtiley = (curtile - curtilex) / 20; + int curTile = 40; + int curTileL = 0; + int curTileX = curTile % 20; + int curTileY = (curTile - curTileX) / 20; int l = 0; // ?? not defined in original code - _tileinfo[l][9][7][0] = curtile + 1; + _tileinfo[l][9][7][0] = curTile + 1; _tileinfo[l][9][7][1] = 0; - rcSrc.left = curtilex * 16; - rcSrc.top = curtiley * 16; + rcSrc.left = curTileX * 16; + rcSrc.top = curTileY * 16; rcSrc.setWidth(16); rcSrc.setHeight(16); @@ -737,7 +737,7 @@ void GriffonEngine::damageNPC(int npcnum, int damage, int spell) { rcDest.setWidth(16); rcDest.setHeight(16); - _tiles[curtilel]->blit(*_mapbg, rcDest.left, rcDest.top, Graphics::FLIP_NONE, &rcSrc); + _tiles[curTileL]->blit(*_mapbg, rcDest.left, rcDest.top, Graphics::FLIP_NONE, &rcSrc); } // firehydra sword chest @@ -766,7 +766,7 @@ void GriffonEngine::damageNPC(int npcnum, int damage, int spell) { int ly = (int)npy / 16; if (lx == cx && ly == cy) - _player.py = _player.py + 16; + _player.py += 16; _scriptflag[kScriptFindSword][0] = 1; _clipbg2->fillRect(rcDest, _clipbg->format.RGBToColor(255, 255, 255)); } @@ -799,7 +799,7 @@ void GriffonEngine::damageNPC(int npcnum, int damage, int spell) { int ly = (int)npy / 16; if (lx == cx && ly == cy) - _player.py = _player.py + 16; + _player.py += 16; _clipbg2->fillRect(rcDest, _clipbg->format.RGBToColor(255, 255, 255)); _scriptflag[kScriptGardenMasterKey][0] = 1; } @@ -832,7 +832,7 @@ void GriffonEngine::damageNPC(int npcnum, int damage, int spell) { int ly = (int)npy / 16; if (lx == cx && ly == cy) - _player.py = _player.py + 16; + _player.py += 16; _scriptflag[s][0] = 1; _clipbg2->fillRect(rcDest, _clipbg->format.RGBToColor(255, 255, 255)); } @@ -865,7 +865,7 @@ void GriffonEngine::damageNPC(int npcnum, int damage, int spell) { int ly = (int)npy / 16; if (lx == cx && ly == cy) - _player.py = _player.py + 16; + _player.py += 16; } } @@ -895,7 +895,7 @@ void GriffonEngine::damageNPC(int npcnum, int damage, int spell) { int ly = (int)npy / 16; if (lx == cx && ly == cy) - _player.py = _player.py + 16; + _player.py += 16; _scriptflag[kScriptArmourChest][0] = 1; _clipbg2->fillRect(rcDest, _clipbg->format.RGBToColor(255, 255, 255)); } @@ -927,7 +927,7 @@ void GriffonEngine::damageNPC(int npcnum, int damage, int spell) { int ly = (int)npy / 16; if (lx == cx && ly == cy) - _player.py = _player.py + 16; + _player.py += 16; _clipbg2->fillRect(rcDest, _clipbg->format.RGBToColor(255, 255, 255)); _scriptflag[kScriptCitadelMasterKey][0] = 1; } @@ -959,7 +959,7 @@ void GriffonEngine::damageNPC(int npcnum, int damage, int spell) { int ly = (int)npy / 16; if (lx == cx && ly == cy) - _player.py = _player.py + 16; + _player.py += 16; _clipbg2->fillRect(rcDest, _clipbg->format.RGBToColor(255, 255, 255)); _scriptflag[kScriptGetSword3][0] = 1; @@ -980,7 +980,7 @@ void GriffonEngine::damageNPC(int npcnum, int damage, int spell) { ly = (int)npy / 16; if (lx == cx && ly == cy) - _player.py = _player.py + 16; + _player.py += 16; _clipbg2->fillRect(rcDest, _clipbg->format.RGBToColor(255, 255, 255)); _scriptflag[kScriptShield3][0] = 1; @@ -1002,7 +1002,7 @@ void GriffonEngine::damageNPC(int npcnum, int damage, int spell) { ly = (int)npy / 16; if (lx == cx && ly == cy) - _player.py = _player.py + 16; + _player.py += 16; _clipbg2->fillRect(rcDest, _clipbg->format.RGBToColor(255, 255, 255)); _scriptflag[kScriptArmour3][0] = 1; } diff --git a/engines/griffon/dialogs.cpp b/engines/griffon/dialogs.cpp index 8fe7e8cb64..d822945dd2 100644 --- a/engines/griffon/dialogs.cpp +++ b/engines/griffon/dialogs.cpp @@ -148,7 +148,7 @@ void GriffonEngine::title(int mode) { if (add > 1) add = 1; - xofs = xofs + add; + xofs += add; if (xofs >= 320.0) xofs -= 320.0; @@ -407,7 +407,7 @@ void GriffonEngine::configMenu() { cursel = 14; } if (_event.kbd.keycode == Common::KEYCODE_DOWN) { - cursel++; + ++cursel; if (cursel > 14) cursel = MINCURSEL; } @@ -469,7 +469,7 @@ void GriffonEngine::saveLoadNew() { int currow = 0; int curcol = 0; - int lowerlock = 0; + bool lowerLock = false; _ticks = g_system->getMillis(); int _ticks1 = _ticks; @@ -478,7 +478,7 @@ void GriffonEngine::saveLoadNew() { do { _videobuffer->fillRect(Common::Rect(0, 0, _videobuffer->w, _videobuffer->h), 0); - y = y + 1 * _fpsr; + y += 1 * _fpsr; rcDest.left = 256 + 256 * cos(3.141592 / 180 * clouddeg * 40); rcDest.top = 192 + 192 * sin(3.141592 / 180 * clouddeg * 40); @@ -529,34 +529,34 @@ void GriffonEngine::saveLoadNew() { // LOAD GAME if (currow == 0 && curcol == 1) { - lowerlock = 1; + lowerLock = true; currow = 1 + _saveslot; tickpause = _ticks + 125; } // SAVE GAME if (currow == 0 && curcol == 2) { - lowerlock = 1; + lowerLock = true; currow = 1; tickpause = _ticks + 125; } - if (lowerlock == 1 && curcol == 1 && tickpause < _ticks) { + if (lowerLock && curcol == 1 && tickpause < _ticks) { if (saveState(currow - 1)) { _secstart = _secstart + _secsingame; _secsingame = 0; - lowerlock = 0; + lowerLock = false; _saveslot = currow - 1; currow = 0; } } - if (lowerlock == 1 && curcol == 2 && tickpause < _ticks) { + if (lowerLock && curcol == 2 && tickpause < _ticks) { if (loadState(currow - 1)) { - _player.walkspd = 1.1f; + _player.walkSpeed = 1.1f; _animspd = 0.5f; attacking = false; - _player.attackspd = 1.5f; + _player.attackSpeed = 1.5f; _pgardens = false; _ptown = false; @@ -578,15 +578,15 @@ void GriffonEngine::saveLoadNew() { switch (_event.kbd.keycode) { case Common::KEYCODE_ESCAPE: - if (lowerlock == 0) + if (!lowerLock) return; - lowerlock = 0; + lowerLock = false; currow = 0; tickpause = _ticks + 125; break; case Common::KEYCODE_DOWN: - if (lowerlock == 1) { - currow = currow + 1; + if (lowerLock) { + ++currow; if (currow == 5) currow = 1; tickpause = _ticks + 125; @@ -594,8 +594,8 @@ void GriffonEngine::saveLoadNew() { break; case Common::KEYCODE_UP: - if (lowerlock == 1) { - currow = currow - 1; + if (lowerLock) { + --currow; if (currow == 0) currow = 4; tickpause = _ticks + 125; @@ -603,8 +603,8 @@ void GriffonEngine::saveLoadNew() { break; case Common::KEYCODE_LEFT: - if (lowerlock == 0) { - curcol = curcol - 1; + if (!lowerLock) { + --curcol; if (curcol == -1) curcol = 3; tickpause = _ticks + 125; @@ -612,8 +612,8 @@ void GriffonEngine::saveLoadNew() { break; case Common::KEYCODE_RIGHT: - if (lowerlock == 0) { - curcol = curcol + 1; + if (!lowerLock) { + ++curcol; if (curcol == 4) curcol = 0; tickpause = _ticks + 125; @@ -648,10 +648,10 @@ void GriffonEngine::saveLoadNew() { drawString(_videobuffer, line, 160 - strlen(line) * 4, sy, 0); sx = 12; - sy = sy + 11; + sy += 11; int cc = 0; - sprintf(line, "Health: %i/%i", _playera.hp, _playera.maxhp); + sprintf(line, "Health: %i/%i", _playera.hp, _playera.maxHp); drawString(_videobuffer, line, sx, sy, cc); if (_playera.level == 22) @@ -684,10 +684,10 @@ void GriffonEngine::saveLoadNew() { int nx = rcSrc.left + 13 + 3 * 8; rcSrc.left = nx - 17; - if (_playera.foundspell[0] == 1) { + if (_playera.foundSpell[0] == 1) { for (int i = 0; i < 5; i++) { - rcSrc.left = rcSrc.left + 17; - if (_playera.foundspell[i] == 1) + rcSrc.left += 17; + if (_playera.foundSpell[i] == 1) _itemimg[7 + i]->blit(*_videobuffer, rcSrc.left, rcSrc.top); } } @@ -720,7 +720,7 @@ void GriffonEngine::saveLoadNew() { _itemimg[15]->blit(*_videobuffer, rcDest.left, rcDest.top); - if (lowerlock == 1) { + if (lowerLock) { rcDest.top = 18; if (curcol == 1) rcDest.left = 108; diff --git a/engines/griffon/draw.cpp b/engines/griffon/draw.cpp index 37d9f46f28..4810667a83 100644 --- a/engines/griffon/draw.cpp +++ b/engines/griffon/draw.cpp @@ -248,17 +248,17 @@ void GriffonEngine::drawHud() { rcSrc.top = sy; // spells in game - if (_player.foundspell[0] == 1) { + if (_player.foundSpell[0] == 1) { for (int i = 0; i < 5; i++) { rcSrc.left = rcSrc.left + 17; - if (_player.foundspell[i] == 1) { + if (_player.foundSpell[i] == 1) { _itemimg[7 + i]->blit(*_videobuffer, rcSrc.left, rcSrc.top); game_fillrect(_videobuffer, rcSrc.left, sy + 16, 16, 4, RGB(0, 32, 32)); game_fillrect(_videobuffer, rcSrc.left + 1, sy + 17, - hud_recalc(_player.spellcharge[i], 14, 100), 2, - ABS(_player.spellcharge[i] - 100) < kEpsilon ? RGB(255, 128, 32) : RGB(0, 224, 64)); + hud_recalc(_player.spellCharge[i], 14, 100), 2, + ABS(_player.spellCharge[i] - 100) < kEpsilon ? RGB(255, 128, 32) : RGB(0, 224, 64)); } } } @@ -314,29 +314,29 @@ void GriffonEngine::drawHud() { } char line[128]; - sprintf(line, "Health: %i/%i", _player.hp, _player.maxhp); - drawString(_videobuffer, line, sx, sy, _player.hp <= _player.maxhp * 0.25 ? (int)_player.hpflash : 0); + sprintf(line, "Health: %i/%i", _player.hp, _player.maxHp); + drawString(_videobuffer, line, sx, sy, _player.hp <= _player.maxHp * 0.25 ? (int)_player.hpflash : 0); sprintf(line, "Level : %i", _player.level); - if (_player.level == _player.maxlevel) + if (_player.level == _player.maxLevel) strcpy(line, "Level : MAX"); drawString(_videobuffer, line, sx, sy + 8, 0); // experience game_fillrect(_videobuffer, sx + 64, sy + 16, 16, 4, RGB(0, 32, 32)); game_fillrect(_videobuffer, sx + 65, sy + 17, - hud_recalc(_player.exp, 14, _player.nextlevel), 2, RGB(0, 224, 64)); + hud_recalc(_player.exp, 14, _player.nextLevel), 2, RGB(0, 224, 64)); // attack strength game_fillrect(_videobuffer, sx + 1, sy + 16, 56, 6, RGB(0, 32, 32)); game_fillrect(_videobuffer, sx + 1, sy + 17, - hud_recalc(_player.attackstrength, 54, 100), 2, - ABS(_player.attackstrength - 100) < kEpsilon ? RGB(255, 128, 32) : RGB(0, 64, 224)); + hud_recalc(_player.attackStrength, 54, 100), 2, + ABS(_player.attackStrength - 100) < kEpsilon ? RGB(255, 128, 32) : RGB(0, 64, 224)); // spell strength game_fillrect(_videobuffer, sx + 1, sy + 19, - hud_recalc(_player.spellstrength, 54, 100), 2, - ABS(_player.spellstrength - 100) < kEpsilon ? RGB(224, 0, 0) : RGB(128, 0, 224)); + hud_recalc(_player.spellStrength, 54, 100), 2, + ABS(_player.spellStrength - 100) < kEpsilon ? RGB(224, 0, 0) : RGB(128, 0, 224)); // time int ase = _secstart + _secsingame; @@ -392,19 +392,19 @@ void GriffonEngine::drawHud() { } // spells in menu - if (_player.foundspell[0] == 1) { + if (_player.foundSpell[0] == 1) { 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] == 1) { _itemimg[7 + i]->blit(*_videobuffer, rcSrc.left, rcSrc.top); game_fillrect(_videobuffer, rcSrc.left, sy + 16, 16, 4, RGB(0, 32, 32)); game_fillrect(_videobuffer, rcSrc.left + 1, sy + 17, - hud_recalc(_player.spellcharge[i], 14, 100), 2, - ABS(_player.spellcharge[i] - 100) < kEpsilon ? RGB(255, 128, 32) : RGB(0, 224, 64)); + hud_recalc(_player.spellCharge[i], 14, 100), 2, + ABS(_player.spellCharge[i] - 100) < kEpsilon ? RGB(255, 128, 32) : RGB(0, 224, 64)); } } } @@ -1058,8 +1058,8 @@ void GriffonEngine::drawPlayer() { f = 13; if (!attacking) { - rcSrc.left = (int)(_player.walkframe / 4) * 24; - rcSrc.top = _player.walkdir * 24; + rcSrc.left = (int)(_player.walkFrame / 4) * 24; + rcSrc.top = _player.walkDir * 24; rcSrc.setWidth(24); rcSrc.setHeight(24); @@ -1070,8 +1070,8 @@ void GriffonEngine::drawPlayer() { _anims[f]->blit(*_videobuffer, rcDest.left, rcDest.top, Graphics::FLIP_NONE, &rcSrc); } else { - rcSrc.left = (int)(_player.attackframe / 4) * 24; - rcSrc.top = _player.walkdir * 24; + rcSrc.left = (int)(_player.attackFrame / 4) * 24; + rcSrc.top = _player.walkDir * 24; rcSrc.setWidth(24); rcSrc.setHeight(24); @@ -1087,7 +1087,7 @@ void GriffonEngine::drawPlayer() { long ccc = _videobuffer->format.RGBToColor(224, 224, 64); bool pass = false; - if (_player.hp <= _player.maxhp * 0.25) + if (_player.hp <= _player.maxHp * 0.25) pass = true; if (pass) { @@ -1097,7 +1097,7 @@ void GriffonEngine::drawPlayer() { } int sss = 6; - if (_player.foundspell[0]) + if (_player.foundSpell[0]) sss = 8; int npx = _player.px; int npy = _player.py; @@ -1112,7 +1112,7 @@ void GriffonEngine::drawPlayer() { rcDest.top = npy + 23; - int ww = 14 * _player.hp / _player.maxhp; + int ww = 14 * _player.hp / _player.maxHp; if (ww > 14) ww = 14; if (ww < 1) @@ -1124,14 +1124,14 @@ void GriffonEngine::drawPlayer() { _videobuffer->fillRect(rcDest, ccc); ccc = _videobuffer->format.RGBToColor(0, 224, 64); - if (ABS(_player.attackstrength - 100) < kEpsilon) + if (ABS(_player.attackStrength - 100) < kEpsilon) ccc = _videobuffer->format.RGBToColor(255, 128, 32); - ww = 14 * _player.attackstrength / 100; + ww = 14 * _player.attackStrength / 100; if (ww > 14) ww = 14; - int ww2 = 14 * _player.spellstrength / 100; + int ww2 = 14 * _player.spellStrength / 100; if (ww2 > 14) ww2 = 14; @@ -1142,7 +1142,7 @@ void GriffonEngine::drawPlayer() { _videobuffer->fillRect(rcDest, ccc); ccc = _videobuffer->format.RGBToColor(128, 0, 224); - if (ABS(_player.spellstrength - 100) < kEpsilon) + if (ABS(_player.spellStrength - 100) < kEpsilon) ccc = _videobuffer->format.RGBToColor(224, 0, 0); rcDest.top = rcDest.top + 2; diff --git a/engines/griffon/engine.cpp b/engines/griffon/engine.cpp index 25f580e38a..e2281b3bf1 100644 --- a/engines/griffon/engine.cpp +++ b/engines/griffon/engine.cpp @@ -98,24 +98,24 @@ void GriffonEngine::updateEngine() { } if (attacking) { - _player.attackframe += _player.attackspd * _fpsr; - if (_player.attackframe >= 16) { + _player.attackFrame += _player.attackSpeed * _fpsr; + if (_player.attackFrame >= 16) { attacking = false; - _player.attackframe = 0; - _player.walkframe = 0; + _player.attackFrame = 0; + _player.walkFrame = 0; } - int pa = (int)(_player.attackframe); + int pa = (int)(_player.attackFrame); for (int i = 0; i <= pa; i++) { - if (ABS(_playerattackofs[_player.walkdir][i][2]) < kEpsilon) { - _playerattackofs[_player.walkdir][i][2] = 1; + if (ABS(_playerattackofs[_player.walkDir][i][2]) < kEpsilon) { + _playerattackofs[_player.walkDir][i][2] = 1; float opx = _player.px; float opy = _player.py; - _player.px = _player.px + _playerattackofs[_player.walkdir][i][0]; - _player.py = _player.py + _playerattackofs[_player.walkdir][i][1]; + _player.px = _player.px + _playerattackofs[_player.walkDir][i][0]; + _player.py = _player.py + _playerattackofs[_player.walkDir][i][1]; int sx = (int)(_player.px / 2 + 6); int sy = (int)(_player.py / 2 + 10); @@ -152,21 +152,21 @@ void GriffonEngine::updateEngine() { } } - if (_player.level == _player.maxlevel) + if (_player.level == _player.maxLevel) _player.exp = 0; - if (_player.exp >= _player.nextlevel) { + if (_player.exp >= _player.nextLevel) { _player.level = _player.level + 1; addFloatText("LEVEL UP!", _player.px + 16 - 36, _player.py + 16, 3); - _player.exp = _player.exp - _player.nextlevel; - _player.nextlevel = _player.nextlevel * 3 / 2; // 1.5 - _player.maxhp = _player.maxhp + _player.level * 3; - if (_player.maxhp > 999) - _player.maxhp = 999; - _player.hp = _player.maxhp; + _player.exp = _player.exp - _player.nextLevel; + _player.nextLevel = _player.nextLevel * 3 / 2; // 1.5 + _player.maxHp = _player.maxHp + _player.level * 3; + if (_player.maxHp > 999) + _player.maxHp = 999; + _player.hp = _player.maxHp; - _player.sworddamage = _player.level * 14 / 10; - _player.spelldamage = _player.level * 13 / 10; + _player.swordDamage = _player.level * 14 / 10; + _player.spellDamage = _player.level * 13 / 10; if (config.effects) { int snd = playSound(_sfx[kSndPowerUp]); @@ -187,24 +187,24 @@ void GriffonEngine::updateEngine() { if (!_forcepause) { for (int i = 0; i < 5; i++) { - if (_player.foundspell[i] == 1) - _player.spellcharge[i] += 1 * _player.level * 0.01 * _fpsr; - if (_player.spellcharge[i] > 100) - _player.spellcharge[i] = 100; + if (_player.foundSpell[i] == 1) + _player.spellCharge[i] += 1 * _player.level * 0.01 * _fpsr; + if (_player.spellCharge[i] > 100) + _player.spellCharge[i] = 100; } - if (_player.foundspell[0]) { - _player.spellstrength += 3 * _player.level * .01 * _fpsr; + if (_player.foundSpell[0]) { + _player.spellStrength += 3 * _player.level * .01 * _fpsr; } - _player.attackstrength += (30 + 3 * (float)_player.level) / 50 * _fpsr; + _player.attackStrength += (30 + 3 * (float)_player.level) / 50 * _fpsr; } - if (_player.attackstrength > 100) - _player.attackstrength = 100; + if (_player.attackStrength > 100) + _player.attackStrength = 100; - if (_player.spellstrength > 100) - _player.spellstrength = 100; + if (_player.spellStrength > 100) + _player.spellStrength = 100; _itemyloc += 0.75 * _fpsr; while (_itemyloc >= 16) @@ -230,7 +230,7 @@ void GriffonEngine::updateEngine() { _player.hpflashb = _player.hpflashb + 1; if (_player.hpflashb == 2) _player.hpflashb = 0; - if (config.effects && _player.hpflashb == 0 && _player.hp < _player.maxhp / 4) { + if (config.effects && _player.hpflashb == 0 && _player.hp < _player.maxHp / 4) { int snd = playSound(_sfx[kSndBeep]); setChannelVolume(snd, config.effectsvol); } @@ -258,29 +258,29 @@ void GriffonEngine::newGame() { _player.py = 0; _player.opx = 0; _player.opy = 0; - _player.walkdir = 0; - _player.walkframe = 0; - _player.walkspd = 0; - _player.attackframe = 0; - _player.attackspd = 0; + _player.walkDir = 0; + _player.walkFrame = 0; + _player.walkSpeed = 0; + _player.attackFrame = 0; + _player.attackSpeed = 0; _player.hp = 0; - _player.maxhp = 0; + _player.maxHp = 0; _player.hpflash = 0; _player.level = 0; - _player.maxlevel = 0; + _player.maxLevel = 0; _player.sword = 0; _player.shield = 0; _player.armour = 0; for (int i = 0; i < 5; i++) { - _player.foundspell[i] = 0; - _player.spellcharge[i] = 0; + _player.foundSpell[i] = 0; + _player.spellCharge[i] = 0; _player.inventory[i] = 0; } - _player.attackstrength = 0; - _player.spelldamage = 0; - _player.sworddamage = 0; + _player.attackStrength = 0; + _player.spellDamage = 0; + _player.swordDamage = 0; _player.exp = 0; - _player.nextlevel = 0; + _player.nextLevel = 0; memset(_scriptflag, 0, sizeof(_scriptflag)); memset(_objmapf, 0, sizeof(_objmapf)); @@ -294,26 +294,26 @@ void GriffonEngine::newGame() { _roomLocks[73] = 1; _roomLocks[82] = 2; - _player.walkspd = 1.1f; + _player.walkSpeed = 1.1f; _animspd = 0.5f; attacking = false; - _player.attackspd = 1.5f; + _player.attackSpeed = 1.5f; _player.sword = 1; _player.level = 1; - _player.maxlevel = 22; - _player.nextlevel = 50; + _player.maxLevel = 22; + _player.nextLevel = 50; _player.shield = 1; _player.armour = 1; _player.hp = 14; - _player.maxhp = _player.hp; + _player.maxHp = _player.hp; - _player.sworddamage = _player.level * 2; - _player.spelldamage = _player.level * 3 / 2; + _player.swordDamage = _player.level * 2; + _player.spellDamage = _player.level * 3 / 2; _player.px = 15 * 16 - 4; _player.py = 6 * 16 - 4; - _player.walkdir = 1; + _player.walkDir = 1; _pgardens = false; _ptown = false; diff --git a/engines/griffon/griffon.h b/engines/griffon/griffon.h index f56ec878d0..55fedeb410 100644 --- a/engines/griffon/griffon.h +++ b/engines/griffon/griffon.h @@ -136,31 +136,31 @@ struct Player { float py; float opx; float opy; - int walkdir; - float walkframe; - float walkspd; - float attackframe; - float attackspd; + int walkDir; + float walkFrame; + float walkSpeed; + float attackFrame; + float attackSpeed; int hp; - int maxhp; + int maxHp; float hpflash; int hpflashb; int level; - int maxlevel; + int maxLevel; int sword; int shield; int armour; - int foundspell[5]; - float spellcharge[5]; + int foundSpell[5]; + float spellCharge[5]; int inventory[5]; - float attackstrength; - float spellstrength; - int spelldamage; - int sworddamage; + float attackStrength; + float spellStrength; + int spellDamage; + int swordDamage; int exp; - int nextlevel; + int nextLevel; int pause; diff --git a/engines/griffon/input.cpp b/engines/griffon/input.cpp index f7ebb15b19..a7540e6f34 100644 --- a/engines/griffon/input.cpp +++ b/engines/griffon/input.cpp @@ -89,7 +89,7 @@ void GriffonEngine::checkInputs() { _itemticks = _ticks + ntickdelay; int heal = 50; - int maxh = _player.maxhp - _player.hp; + int maxh = _player.maxHp - _player.hp; if (heal > maxh) heal = maxh; @@ -115,7 +115,7 @@ void GriffonEngine::checkInputs() { _itemticks = _ticks + ntickdelay; int heal = 200; - int maxh = _player.maxhp - _player.hp; + int maxh = _player.maxHp - _player.hp; if (heal > maxh) heal = maxh; @@ -174,10 +174,10 @@ void GriffonEngine::checkInputs() { return; } - if (_curitem == 5 && _player.spellcharge[0] == 100) { + if (_curitem == 5 && _player.spellCharge[0] == 100) { castSpell(5, _player.px, _player.py, _npcinfo[_curenemy].x, _npcinfo[_curenemy].y, 0); - _player.spellcharge[0] = 0; + _player.spellCharge[0] = 0; _forcepause = true; @@ -194,9 +194,9 @@ void GriffonEngine::checkInputs() { castSpell(_curitem - 6, _player.px, _player.py, postinfo[pst][0], postinfo[pst][1], 0); } - _player.spellcharge[_curitem - 5] = 0; + _player.spellCharge[_curitem - 5] = 0; - _player.spellstrength = 0; + _player.spellStrength = 0; _itemticks = _ticks + ntickdelay; _selenemyon = 0; @@ -205,7 +205,7 @@ void GriffonEngine::checkInputs() { } if (_curitem > 5 && _selenemyon == 0 && _itemselon == 1) { - if (ABS(_player.spellcharge[_curitem - 5] - 100) < kEpsilon) { + if (ABS(_player.spellCharge[_curitem - 5] - 100) < kEpsilon) { _itemticks = _ticks + ntickdelay; _selenemyon = 1; @@ -352,7 +352,7 @@ void GriffonEngine::handleWalking() { float opx = px; float opy = py; - float spd = _player.walkspd * _fpsr; + float spd = _player.walkSpeed * _fpsr; float nx = (px / 2 + 6); float ny = (py / 2 + 10); @@ -394,17 +394,17 @@ void GriffonEngine::handleWalking() { } if (movingup) - _player.walkdir = 0; + _player.walkDir = 0; if (movingdown) - _player.walkdir = 1; + _player.walkDir = 1; if (movingleft) - _player.walkdir = 2; + _player.walkDir = 2; if (movingright) - _player.walkdir = 3; + _player.walkDir = 3; if (movingup && _clipsurround[1][0] == 0) { py -= spd; - _player.walkdir = 0; + _player.walkDir = 0; } else if (movingup && _clipsurround[1][0] > 0) { // move upleft if (!movingright && _clipsurround[0][0] == 0) { @@ -420,7 +420,7 @@ void GriffonEngine::handleWalking() { } if (movingdown && _clipsurround[1][2] == 0) { py += spd; - _player.walkdir = 1; + _player.walkDir = 1; } else if (movingdown && _clipsurround[1][2] > 0) { // move downleft if (movingright == 0 && _clipsurround[0][2] == 0) { @@ -436,7 +436,7 @@ void GriffonEngine::handleWalking() { } if (movingleft && _clipsurround[0][1] == 0) { px -= spd; - _player.walkdir = 2; + _player.walkDir = 2; } else if (movingleft && _clipsurround[0][1] > 0) { // move leftup if (!movingdown && _clipsurround[0][0] == 0) { @@ -452,7 +452,7 @@ void GriffonEngine::handleWalking() { } if (movingright && _clipsurround[2][1] == 0) { px += spd; - _player.walkdir = 3; + _player.walkDir = 3; } else if (movingright && _clipsurround[2][1] > 0) { // move rightup if (!movingdown && _clipsurround[2][0] == 0) { @@ -501,16 +501,16 @@ void GriffonEngine::handleWalking() { int xdif = _player.px - npx; int ydif = _player.py - npy; - if (_player.walkdir == 0) { + if (_player.walkDir == 0) { if (abs(xdif) <= 8 && ydif > 0 && ydif < 8) _npcinfo[i].y -= spd; - } else if (_player.walkdir == 1) { + } else if (_player.walkDir == 1) { if (abs(xdif) <= 8 && ydif < 0 && ydif > -8) _npcinfo[i].y += spd; - } else if (_player.walkdir == 2) { + } else if (_player.walkDir == 2) { if (abs(ydif) <= 8 && xdif > 0 && xdif < 8) _npcinfo[i].x -= spd; - } else if (_player.walkdir == 3) { + } else if (_player.walkDir == 3) { if (abs(ydif) <= 8 && xdif < 0 && xdif > -8) _npcinfo[i].x += spd; } @@ -537,9 +537,9 @@ void GriffonEngine::handleWalking() { _player.py = py; if (_player.px != _player.opx || _player.py != _player.opy) - _player.walkframe += _animspd * _fpsr; - if (_player.walkframe >= 16) - _player.walkframe -= 16; + _player.walkFrame += _animspd * _fpsr; + if (_player.walkFrame >= 16) + _player.walkFrame -= 16; // walking over items to pickup ::: int o = _objectMap[lx][ly]; diff --git a/engines/griffon/logic.cpp b/engines/griffon/logic.cpp index 310bfcc590..7a691b85c6 100644 --- a/engines/griffon/logic.cpp +++ b/engines/griffon/logic.cpp @@ -116,7 +116,7 @@ void GriffonEngine::updateY() { do { if (_ysort[yy] == -1 || yy == 2400) break; - yy = yy + 1; + ++yy; } while (1); _ysort[yy] = i; @@ -1242,11 +1242,7 @@ void GriffonEngine::updateNPCs() { } void GriffonEngine::updateSpells() { - int foundel[5]; - long cl1, cl2, cl3; - int ll[4][2]; - - float xloc = 0, yloc = 0, xst, yst, xdif, ydif; + float xloc = 0, yloc = 0; for (int i = 0; i < kMaxSpell; i++) { if (spellinfo[i].frame > 0) { @@ -1255,6 +1251,7 @@ void GriffonEngine::updateSpells() { // water if (spellnum == 0 && !_forcepause) { float fr = (32 - spellinfo[i].frame); + int ll[4][2]; ll[0][0] = -2; ll[0][1] = -3; @@ -1297,8 +1294,8 @@ void GriffonEngine::updateSpells() { rcSrc.setWidth(16); rcSrc.setHeight(16); - xst = spellinfo[i].enemyx + 12 + ll[f][0] * 16; - yst = spellinfo[i].enemyy + 16 + ll[f][1] * 16; + float xst = spellinfo[i].enemyx + 12 + ll[f][0] * 16; + float yst = spellinfo[i].enemyy + 16 + ll[f][1] * 16; float xi = (spellinfo[i].enemyx - xst) * 2 / 8; float yi = (spellinfo[i].enemyy - yst) * 2 / 8; @@ -1320,12 +1317,11 @@ void GriffonEngine::updateSpells() { if (spellinfo[i].damagewho == 0) { for (int e = 1; e <= _lastnpc; e++) { - - xdif = (xloc + 16) - (_npcinfo[e].x + 12); - ydif = (yloc + 16) - (_npcinfo[e].y + 12); + float xdif = (xloc + 16) - (_npcinfo[e].x + 12); + float ydif = (yloc + 16) - (_npcinfo[e].y + 12); if ((abs(xdif) < 16 && abs(ydif) < 16)) { - float damage = (float)_player.spelldamage * (1.0 + RND() * 0.5) * (float)spellinfo[i].strength; + float damage = (float)_player.spellDamage * (1.0 + RND() * 0.5) * (float)spellinfo[i].strength; if (_npcinfo[e].hp > 0 && _npcinfo[e].pause < _ticks) { damageNPC(e, damage, 1); @@ -1341,8 +1337,8 @@ void GriffonEngine::updateSpells() { // check for post damage if (nposts > 0) { for (int e = 0; e <= nposts - 1; e++) { - xdif = (xloc + 16) - (postinfo[e][0] + 8); - ydif = (yloc + 16) - (postinfo[e][1] + 8); + float xdif = (xloc + 16) - (postinfo[e][0] + 8); + float ydif = (yloc + 16) - (postinfo[e][1] + 8); if ((abs(xdif) < 16 && abs(ydif) < 16)) { _objmapf[_curmap][(int)postinfo[e][0] / 16][(int)postinfo[e][1] / 16] = 1; @@ -1400,11 +1396,11 @@ void GriffonEngine::updateSpells() { if (spellinfo[i].damagewho == 0) { for (int e = 1; e <= _lastnpc; e++) { - xdif = (xloc + 24) - (_npcinfo[e].x + 12); - ydif = (yloc + 24) - (_npcinfo[e].y + 12); + float xdif = (xloc + 24) - (_npcinfo[e].x + 12); + float ydif = (yloc + 24) - (_npcinfo[e].y + 12); if ((abs(xdif) < 24 && abs(ydif) < 24)) { - float damage = (float)_player.spelldamage * (1.0 + RND() * 0.5) * (float)spellinfo[i].strength; + float damage = (float)_player.spellDamage * (1.0 + RND() * 0.5) * (float)spellinfo[i].strength; if (_npcinfo[e].hp > 0 && _npcinfo[e].pause < _ticks) { damageNPC(e, damage, 1); @@ -1440,8 +1436,8 @@ void GriffonEngine::updateSpells() { } // --------------- - xdif = (xloc + 24) - (_player.px + 12); - ydif = (yloc + 24) - (_player.py + 12); + float xdif = (xloc + 24) - (_player.px + 12); + float ydif = (yloc + 24) - (_player.py + 12); if ((abs(xdif) < 24 && abs(ydif) < 24) && _player.pause < _ticks) { float damage = (float)_npcinfo[spellinfo[i].npc].spelldamage * (1.0 + RND() * 0.5); @@ -1460,8 +1456,8 @@ void GriffonEngine::updateSpells() { // check for(int post damage if (nposts > 0) { for (int e = 0; e <= nposts - 1; e++) { - xdif = (xloc + 24) - (postinfo[e][0] + 8); - ydif = (yloc + 24) - (postinfo[e][1] + 8); + float xdif = (xloc + 24) - (postinfo[e][0] + 8); + float ydif = (yloc + 24) - (postinfo[e][1] + 8); if ((abs(xdif) < 24 && abs(ydif) < 24)) { _objmapf[_curmap][(int)postinfo[e][0] / 16][(int)postinfo[e][1] / 16] = 1; @@ -1519,11 +1515,11 @@ void GriffonEngine::updateSpells() { if (scatter == 1) { if (spellinfo[i].damagewho == 0) { for (int e = 1; e <= _lastnpc; e++) { - xdif = (xloc + 16) - (_npcinfo[e].x + 12); - ydif = (yloc + 16) - (_npcinfo[e].y + 12); + float xdif = (xloc + 16) - (_npcinfo[e].x + 12); + float ydif = (yloc + 16) - (_npcinfo[e].y + 12); if ((abs(xdif) < 16 && abs(ydif) < 16)) { - float damage = (float)_player.spelldamage * (1.0 + RND() * 0.5) * (float)spellinfo[i].strength; + float damage = (float)_player.spellDamage * (1.0 + RND() * 0.5) * (float)spellinfo[i].strength; if (_npcinfo[e].hp > 0 && _npcinfo[e].pause < _ticks) { damageNPC(e, damage, 1); @@ -1540,8 +1536,8 @@ void GriffonEngine::updateSpells() { // check for(int post damage if (nposts > 0) { for (int e = 0; e <= nposts - 1; e++) { - xdif = (xloc + 16) - (postinfo[e][0] + 8); - ydif = (yloc + 16) - (postinfo[e][1] + 8); + float xdif = (xloc + 16) - (postinfo[e][0] + 8); + float ydif = (yloc + 16) - (postinfo[e][1] + 8); if ((abs(xdif) < 16 && abs(ydif) < 16)) { _objmapf[_curmap][(int)postinfo[e][0] / 16][(int)postinfo[e][1] / 16] = 1; @@ -1608,6 +1604,7 @@ void GriffonEngine::updateSpells() { int lx = (int)npx / 16; int ly = (int)npy / 16; + int foundel[5]; for (int f1 = 0; f1 < 5; f1++) { // !! f < 5 foundel[f1] = 0; } @@ -1651,9 +1648,9 @@ 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; - _player.spellcharge[f1] = 0; + if (foundel[f1] == 1 && _player.foundSpell[f1] == 0) { + _player.foundSpell[f1] = 1; + _player.spellCharge[f1] = 0; if (f1 == 1) strcpy(line, "Found... Water Essence"); if (f1 == 2) @@ -1746,8 +1743,8 @@ void GriffonEngine::updateSpells() { xloc = spellinfo[i].fireballs[ff][0] + (int)(RND() * 3) - 1; yloc = spellinfo[i].fireballs[ff][1] + (int)(RND() * 3) - 1; - xdif = (xloc + 8) - (_player.px + 12); - ydif = (yloc + 8) - (_player.py + 12); + float xdif = (xloc + 8) - (_player.px + 12); + float ydif = (yloc + 8) - (_player.py + 12); if ((abs(xdif) < 8 && abs(ydif) < 8) && _player.pause < _ticks) { float damage = _npcinfo[spellinfo[i].npc].spelldamage * (1 + RND() * 0.5) / 3; @@ -1767,10 +1764,9 @@ void GriffonEngine::updateSpells() { // lightning bomb if (spellnum == 8) { - - cl1 = _videobuffer->format.RGBToColor(0, 32, 204); - cl2 = _videobuffer->format.RGBToColor(142, 173, 191); - cl3 = _videobuffer->format.RGBToColor(240, 240, 240); + long cl1 = _videobuffer->format.RGBToColor(0, 32, 204); + long cl2 = _videobuffer->format.RGBToColor(142, 173, 191); + long cl3 = _videobuffer->format.RGBToColor(240, 240, 240); float px = _player.px + 12; float py = _player.py + 12; @@ -1785,9 +1781,9 @@ void GriffonEngine::updateSpells() { int rn = (int)(RND() * 3); if (orn == 0) - y = y - 1; - if (orn == 2) - y = y + 1; + --y; + else if (orn == 2) + ++y; drawLine(_videobuffer, x, y - 1, x, y + 2, cl1); drawLine(_videobuffer, x, y, x, y + 1, cl3); @@ -1801,9 +1797,8 @@ void GriffonEngine::updateSpells() { if (spellinfo[i].damagewho == 0) { for (int e = 1; e <= _lastnpc; e++) { - - xdif = (x + 16) - (_npcinfo[e].x + 12); - ydif = (y + 16) - (_npcinfo[e].y + 12); + float xdif = (x + 16) - (_npcinfo[e].x + 12); + float ydif = (y + 16) - (_npcinfo[e].y + 12); if ((abs(xdif) < 8 && abs(ydif) < 8)) { float damage = 30 * (1 + RND() * 0.5); @@ -1817,8 +1812,8 @@ void GriffonEngine::updateSpells() { // check for post damage if (nposts > 0) { for (int e = 0; e <= nposts - 1; e++) { - xdif = (xloc + 16) - (postinfo[e][0] + 8); - ydif = (yloc + 16) - (postinfo[e][1] + 8); + float xdif = (xloc + 16) - (postinfo[e][0] + 8); + float ydif = (yloc + 16) - (postinfo[e][1] + 8); if ((abs(xdif) < 16 && abs(ydif) < 16)) { _objmapf[_curmap][(int)postinfo[e][0] / 16][(int)postinfo[e][1] / 16] = 1; @@ -1843,9 +1838,9 @@ void GriffonEngine::updateSpells() { int rn = (int)(RND() * 3); if (orn == 0) - y = y - 1; - if (orn == 2) - y = y + 1; + --y; + else if (orn == 2) + ++y; drawLine(_videobuffer, x, y - 1, x, y + 2, cl1); drawLine(_videobuffer, x, y, x, y + 1, cl3); @@ -1859,9 +1854,8 @@ void GriffonEngine::updateSpells() { if (spellinfo[i].damagewho == 0) { for (int e = 1; e <= _lastnpc; e++) { - - xdif = (x + 16) - (_npcinfo[e].x + 12); - ydif = (y + 16) - (_npcinfo[e].y + 12); + float xdif = (x + 16) - (_npcinfo[e].x + 12); + float ydif = (y + 16) - (_npcinfo[e].y + 12); if ((abs(xdif) < 8 && abs(ydif) < 8)) { float damage = 30 * (1 + RND() * 0.5); @@ -1875,8 +1869,8 @@ void GriffonEngine::updateSpells() { // check for post damage if (nposts > 0) { for (int e = 0; e <= nposts - 1; e++) { - xdif = (xloc + 16) - (postinfo[e][0] + 8); - ydif = (yloc + 16) - (postinfo[e][1] + 8); + float xdif = (xloc + 16) - (postinfo[e][0] + 8); + float ydif = (yloc + 16) - (postinfo[e][1] + 8); if ((abs(xdif) < 16 && abs(ydif) < 16)) { _objmapf[_curmap][(int)postinfo[e][0] / 16][(int)postinfo[e][1] / 16] = 1; @@ -1917,8 +1911,8 @@ void GriffonEngine::updateSpells() { if (spellinfo[i].damagewho == 0) { for (int e = 1; e <= _lastnpc; e++) { - xdif = (x + 16) - (_npcinfo[e].x + 12); - ydif = (y + 16) - (_npcinfo[e].y + 12); + float xdif = (x + 16) - (_npcinfo[e].x + 12); + float ydif = (y + 16) - (_npcinfo[e].y + 12); if ((abs(xdif) < 8 && abs(ydif) < 8)) { float damage = 30 * (1 + RND() * 0.5); @@ -1932,8 +1926,8 @@ void GriffonEngine::updateSpells() { // check for post damage if (nposts > 0) { for (int e = 0; e <= nposts - 1; e++) { - xdif = (xloc + 16) - (postinfo[e][0] + 8); - ydif = (yloc + 16) - (postinfo[e][1] + 8); + float xdif = (xloc + 16) - (postinfo[e][0] + 8); + float ydif = (yloc + 16) - (postinfo[e][1] + 8); if ((abs(xdif) < 16 && abs(ydif) < 16)) { _objmapf[_curmap][(int)postinfo[e][0] / 16][(int)postinfo[e][1] / 16] = 1; @@ -1974,8 +1968,8 @@ void GriffonEngine::updateSpells() { if (spellinfo[i].damagewho == 0) { for (int e = 1; e <= _lastnpc; e++) { - xdif = (x + 16) - (_npcinfo[e].x + 12); - ydif = (y + 16) - (_npcinfo[e].y + 12); + float xdif = (x + 16) - (_npcinfo[e].x + 12); + float ydif = (y + 16) - (_npcinfo[e].y + 12); if ((abs(xdif) < 8 && abs(ydif) < 8)) { float damage = 30 * (1 + RND() * 0.5); @@ -1989,8 +1983,8 @@ void GriffonEngine::updateSpells() { // check for post damage if (nposts > 0) { for (int e = 0; e <= nposts - 1; e++) { - xdif = (xloc + 16) - (postinfo[e][0] + 8); - ydif = (yloc + 16) - (postinfo[e][1] + 8); + float xdif = (xloc + 16) - (postinfo[e][0] + 8); + float ydif = (yloc + 16) - (postinfo[e][1] + 8); if ((abs(xdif) < 16 && abs(ydif) < 16)) { _objmapf[_curmap][(int)postinfo[e][0] / 16][(int)postinfo[e][1] / 16] = 1; @@ -2019,10 +2013,9 @@ void GriffonEngine::updateSpells() { // wizard 1 lightning if (spellnum == 9) { - - cl1 = _videobuffer->format.RGBToColor(0, 32, 204); - cl2 = _videobuffer->format.RGBToColor(142, 173, 191); - cl3 = _videobuffer->format.RGBToColor(240, 240, 240); + long cl1 = _videobuffer->format.RGBToColor(0, 32, 204); + long cl2 = _videobuffer->format.RGBToColor(142, 173, 191); + long cl3 = _videobuffer->format.RGBToColor(240, 240, 240); int px = spellinfo[i].enemyx + 12; int py = spellinfo[i].enemyy + 24; @@ -2052,19 +2045,16 @@ void GriffonEngine::updateSpells() { orn = rn; if (spellinfo[i].damagewho == 1) { - - xdif = (x + 8) - (_player.px + 12); - ydif = (y + 8) - (_player.py + 12); + float xdif = (x + 8) - (_player.px + 12); + float ydif = (y + 8) - (_player.py + 12); 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; - if (_npcinfo[spellinfo[i].npc].spriteset == kMonsterBatKitty) { - if (damage < 50) - damage = 40 + (int)(RND() * 40); - } + if ((_npcinfo[spellinfo[i].npc].spriteset == kMonsterBatKitty) && (damage < 50)) + damage = 40 + (int)(RND() * 40); if (_player.hp > 0) damagePlayer(damage); @@ -2233,7 +2223,7 @@ void GriffonEngine::updateSpellsUnder() { float ydif = (yloc + 8) - (_npcinfo[e].y + 12); if ((abs(xdif) < 8 && abs(ydif) < 8)) { - float damage = (float)_player.spelldamage * (1.0 + RND() * 0.5) * (float)spellinfo[i].strength; + float damage = (float)_player.spellDamage * (1.0 + RND() * 0.5) * (float)spellinfo[i].strength; if (_npcinfo[e].spriteset == kMonsterFireHydra) damage = -damage; diff --git a/engines/griffon/resources.cpp b/engines/griffon/resources.cpp index 19c80e4f8b..e81502ec75 100644 --- a/engines/griffon/resources.cpp +++ b/engines/griffon/resources.cpp @@ -763,7 +763,7 @@ void GriffonEngine::loadMap(int mapnum) { } // academy crystal - if (_curmap == 24 && _player.foundspell[0] == 0 && _scriptflag[kScriptFindCtystal][0] == 1) { + if (_curmap == 24 && _player.foundSpell[0] == 0 && _scriptflag[kScriptFindCtystal][0] == 1) { cx = 9; cy = 7; diff --git a/engines/griffon/saveload.cpp b/engines/griffon/saveload.cpp index ae2656768a..972d1b0eaf 100644 --- a/engines/griffon/saveload.cpp +++ b/engines/griffon/saveload.cpp @@ -76,31 +76,31 @@ int GriffonEngine::loadState(int slotnum) { INPUT("%f", &_player.py); INPUT("%f", &_player.opx); INPUT("%f", &_player.opy); - INPUT("%i", &_player.walkdir); - INPUT("%f", &_player.walkframe); - INPUT("%f", &_player.walkspd); - INPUT("%f", &_player.attackframe); - INPUT("%f", &_player.attackspd); + INPUT("%i", &_player.walkDir); + INPUT("%f", &_player.walkFrame); + INPUT("%f", &_player.walkSpeed); + INPUT("%f", &_player.attackFrame); + INPUT("%f", &_player.attackSpeed); INPUT("%i", &_player.hp); - INPUT("%i", &_player.maxhp); + INPUT("%i", &_player.maxHp); INPUT("%f", &_player.hpflash); INPUT("%i", &_player.level); - INPUT("%i", &_player.maxlevel); + INPUT("%i", &_player.maxLevel); INPUT("%i", &_player.sword); INPUT("%i", &_player.shield); INPUT("%i", &_player.armour); for (int i = 0; i < 5; i++) { - INPUT("%i", &_player.foundspell[i]); - INPUT("%f", &_player.spellcharge[i]); + INPUT("%i", &_player.foundSpell[i]); + INPUT("%f", &_player.spellCharge[i]); } for (int a = 0; a < 5; a++) { INPUT("%i", &_player.inventory[a]); } - INPUT("%f", &_player.attackstrength); - INPUT("%i", &_player.spelldamage); - INPUT("%i", &_player.sworddamage); + INPUT("%f", &_player.attackStrength); + INPUT("%i", &_player.spellDamage); + INPUT("%i", &_player.swordDamage); INPUT("%i", &_player.exp); - INPUT("%i", &_player.nextlevel); + INPUT("%i", &_player.nextLevel); for (int a = 0; a <= 99; a++) { for (int b = 0; b <= 9; b++) { INPUT("%i", &_scriptflag[a][b]); @@ -120,7 +120,7 @@ int GriffonEngine::loadState(int slotnum) { INPUT("%i", &_roomLocks[a]); } - INPUT("%f", &_player.spellstrength); + INPUT("%f", &_player.spellStrength); return 1; // success } @@ -150,31 +150,31 @@ int GriffonEngine::loadPlayer(int slotnum) { INPUT("%f", &_playera.py); INPUT("%f", &_playera.opx); INPUT("%f", &_playera.opy); - INPUT("%i", &_playera.walkdir); - INPUT("%f", &_playera.walkframe); - INPUT("%f", &_playera.walkspd); - INPUT("%f", &_playera.attackframe); - INPUT("%f", &_playera.attackspd); + INPUT("%i", &_playera.walkDir); + INPUT("%f", &_playera.walkFrame); + INPUT("%f", &_playera.walkSpeed); + INPUT("%f", &_playera.attackFrame); + INPUT("%f", &_playera.attackSpeed); INPUT("%i", &_playera.hp); - INPUT("%i", &_playera.maxhp); + INPUT("%i", &_playera.maxHp); INPUT("%f", &_playera.hpflash); INPUT("%i", &_playera.level); - INPUT("%i", &_playera.maxlevel); + INPUT("%i", &_playera.maxLevel); INPUT("%i", &_playera.sword); INPUT("%i", &_playera.shield); INPUT("%i", &_playera.armour); for (int i = 0; i < 5; i++) { - INPUT("%i", &_playera.foundspell[i]); - INPUT("%f", &_playera.spellcharge[i]); + INPUT("%i", &_playera.foundSpell[i]); + INPUT("%f", &_playera.spellCharge[i]); } for (int a = 0; a < 5; a++) { INPUT("%i", &_playera.inventory[a]); } - INPUT("%f", &_playera.attackstrength); - INPUT("%i", &_playera.spelldamage); - INPUT("%i", &_playera.sworddamage); + INPUT("%f", &_playera.attackStrength); + INPUT("%i", &_playera.spellDamage); + INPUT("%i", &_playera.swordDamage); INPUT("%i", &_playera.exp); - INPUT("%i", &_playera.nextlevel); + INPUT("%i", &_playera.nextLevel); return 1; // success } @@ -201,31 +201,31 @@ int GriffonEngine::saveState(int slotnum) { PRINT("%f", _player.py); PRINT("%f", _player.opx); PRINT("%f", _player.opy); - PRINT("%i", _player.walkdir); - PRINT("%f", _player.walkframe); - PRINT("%f", _player.walkspd); - PRINT("%f", _player.attackframe); - PRINT("%f", _player.attackspd); + PRINT("%i", _player.walkDir); + PRINT("%f", _player.walkFrame); + PRINT("%f", _player.walkSpeed); + PRINT("%f", _player.attackFrame); + PRINT("%f", _player.attackSpeed); PRINT("%i", _player.hp); - PRINT("%i", _player.maxhp); + PRINT("%i", _player.maxHp); PRINT("%f", _player.hpflash); PRINT("%i", _player.level); - PRINT("%i", _player.maxlevel); + PRINT("%i", _player.maxLevel); PRINT("%i", _player.sword); PRINT("%i", _player.shield); PRINT("%i", _player.armour); for (int i = 0; i < 5; i++) { - PRINT("%i", _player.foundspell[i]); - PRINT("%f", _player.spellcharge[i]); + PRINT("%i", _player.foundSpell[i]); + PRINT("%f", _player.spellCharge[i]); } for (int a = 0; a < 5; a++) { PRINT("%i", _player.inventory[a]); } - PRINT("%f", _player.attackstrength); - PRINT("%i", _player.spelldamage); - PRINT("%i", _player.sworddamage); + PRINT("%f", _player.attackStrength); + PRINT("%i", _player.spellDamage); + PRINT("%i", _player.swordDamage); PRINT("%i", _player.exp); - PRINT("%i", _player.nextlevel); + PRINT("%i", _player.nextLevel); for (int a = 0; a <= 99; a++) { for (int b = 0; b <= 9; b++) { PRINT("%i", _scriptflag[a][b]); @@ -245,7 +245,7 @@ int GriffonEngine::saveState(int slotnum) { PRINT("%i", _roomLocks[a]); } - PRINT("%f", _player.spellstrength); + PRINT("%f", _player.spellStrength); } file->finalize(); |