aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStrangerke2019-11-01 12:42:29 +0100
committerEugene Sandulenko2019-11-13 22:07:08 +0100
commit78d2dc32b21094922eee5cd2bab787767d19bd42 (patch)
treee9d3277b9ebf929ffe895dcb5404516f0afb8292
parent8438b9c9bbd52841ee8ef35e42dd660f0ab88e1a (diff)
downloadscummvm-rg350-78d2dc32b21094922eee5cd2bab787767d19bd42.tar.gz
scummvm-rg350-78d2dc32b21094922eee5cd2bab787767d19bd42.tar.bz2
scummvm-rg350-78d2dc32b21094922eee5cd2bab787767d19bd42.zip
GRIFFON: Introduce some new structures and refactoring, more renaming
-rw-r--r--engines/griffon/combat.cpp2
-rw-r--r--engines/griffon/cutscenes.cpp4
-rw-r--r--engines/griffon/draw.cpp26
-rw-r--r--engines/griffon/engine.cpp30
-rw-r--r--engines/griffon/gfx.cpp22
-rw-r--r--engines/griffon/griffon.h55
-rw-r--r--engines/griffon/input.cpp4
-rw-r--r--engines/griffon/logic.cpp122
-rw-r--r--engines/griffon/resources.cpp90
9 files changed, 187 insertions, 168 deletions
diff --git a/engines/griffon/combat.cpp b/engines/griffon/combat.cpp
index c469b02b75..9ec4c59184 100644
--- a/engines/griffon/combat.cpp
+++ b/engines/griffon/combat.cpp
@@ -402,7 +402,7 @@ void GriffonEngine::attack() {
for (int i = 0; i <= 15; i++) {
for (int a = 0; a <= 3; a++) {
- _playerattackofs[a][i][2] = 0;
+ _playerAttackOfs[a][i].completed = false;
}
}
}
diff --git a/engines/griffon/cutscenes.cpp b/engines/griffon/cutscenes.cpp
index f97b28420b..0a0556e71a 100644
--- a/engines/griffon/cutscenes.cpp
+++ b/engines/griffon/cutscenes.cpp
@@ -495,8 +495,8 @@ void GriffonEngine::endOfGame() {
void GriffonEngine::theEnd() {
for (int i = 0; i < kMaxFloat; i++) {
- _floatText[i][0] = 0;
- _floatIcon[i][0] = 0;
+ _floatText[i].framesLeft = 0;
+ _floatIcon[i].framesLeft = 0;
}
for (float y = 0; y < 100; y += _fpsr) {
diff --git a/engines/griffon/draw.cpp b/engines/griffon/draw.cpp
index 6575e0e754..54eab5cc77 100644
--- a/engines/griffon/draw.cpp
+++ b/engines/griffon/draw.cpp
@@ -189,8 +189,8 @@ void GriffonEngine::drawHud() {
game_fillrect(_videoBuffer2, 0, 0, 320, 240, 0);
for (int i = 0; i < kMaxFloat; i++) {
- if (_floatText[i][0] > 0) {
- int fc = (int)_floatText[i][3];
+ if (_floatText[i].framesLeft > 0) {
+ int fc = _floatText[i].col;
int c = fc, c2 = 3;
if (fc == 4)
@@ -201,19 +201,19 @@ void GriffonEngine::drawHud() {
c2 = 2;
if (fc != 0) {
- drawString(_videoBuffer, _floatStr[i], (int)(_floatText[i][1]) + 0, (int)(_floatText[i][2]) - 1, c2);
- drawString(_videoBuffer, _floatStr[i], (int)(_floatText[i][1]) + 0, (int)(_floatText[i][2]) + 1, c2);
- drawString(_videoBuffer, _floatStr[i], (int)(_floatText[i][1]) - 1, (int)(_floatText[i][2]) + 0, c2);
- drawString(_videoBuffer, _floatStr[i], (int)(_floatText[i][1]) + 1, (int)(_floatText[i][2]) + 0, c2);
+ drawString(_videoBuffer, _floatText[i].text, (int)(_floatText[i].x) + 0, (int)(_floatText[i].y) - 1, c2);
+ drawString(_videoBuffer, _floatText[i].text, (int)(_floatText[i].x) + 0, (int)(_floatText[i].y) + 1, c2);
+ drawString(_videoBuffer, _floatText[i].text, (int)(_floatText[i].x) - 1, (int)(_floatText[i].y) + 0, c2);
+ drawString(_videoBuffer, _floatText[i].text, (int)(_floatText[i].x) + 1, (int)(_floatText[i].y) + 0, c2);
}
- drawString(_videoBuffer, _floatStr[i], (int)(_floatText[i][1]), (int)(_floatText[i][2]), c);
+ drawString(_videoBuffer, _floatText[i].text, (int)(_floatText[i].x), (int)(_floatText[i].y), c);
}
- if (_floatIcon[i][0] > 0) {
- int ico = _floatIcon[i][3];
- int ix = _floatIcon[i][1];
- int iy = _floatIcon[i][2];
+ if (_floatIcon[i].framesLeft > 0) {
+ int ico = _floatIcon[i].ico;
+ int ix = _floatIcon[i].x;
+ int iy = _floatIcon[i].y;
rcDest.left = ix;
rcDest.top = iy;
@@ -833,7 +833,7 @@ void GriffonEngine::drawNPCs(int mode) {
int ydif = (yloc + 8) - (_player.py + 12);
if ((abs(xdif) < 8 && abs(ydif) < 8) && _player.pause < _ticks) {
- float damage = (float)_npcInfo[i].spelldamage * (1.0 + RND() * 0.5);
+ float damage = (float)_npcInfo[i].spellDamage * (1.0 + RND() * 0.5);
if (_player.hp > 0) {
damagePlayer(damage);
@@ -859,7 +859,7 @@ void GriffonEngine::drawNPCs(int mode) {
ydif = (yloc + 8) - (_player.py + 12);
if ((abs(xdif) < 8 && abs(ydif) < 8) && _player.pause < _ticks) {
- float damage = (float)_npcInfo[i].spelldamage * (1.0 + RND() * 0.5);
+ float damage = (float)_npcInfo[i].spellDamage * (1.0 + RND() * 0.5);
if (_player.hp > 0) {
damagePlayer(damage);
diff --git a/engines/griffon/engine.cpp b/engines/griffon/engine.cpp
index 2a8c865656..3dea927cf5 100644
--- a/engines/griffon/engine.cpp
+++ b/engines/griffon/engine.cpp
@@ -108,14 +108,14 @@ void GriffonEngine::updateEngine() {
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 (!_playerAttackOfs[_player.walkDir][i].completed) {
+ _playerAttackOfs[_player.walkDir][i].completed = true;
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 += _playerAttackOfs[_player.walkDir][i].x;
+ _player.py += _playerAttackOfs[_player.walkDir][i].y;
int sx = (int)(_player.px / 2 + 6);
int sy = (int)(_player.py / 2 + 10);
@@ -135,20 +135,20 @@ void GriffonEngine::updateEngine() {
}
for (int i = 0; i < kMaxFloat; i++) {
- if (_floatText[i][0] > 0) {
+ if (_floatText[i].framesLeft > 0) {
float spd = 0.5 * _fpsr;
- _floatText[i][0] = _floatText[i][0] - spd;
- _floatText[i][2] = _floatText[i][2] - spd;
- if (_floatText[i][0] < 0)
- _floatText[i][0] = 0;
+ _floatText[i].framesLeft -= spd;
+ _floatText[i].y -= spd;
+ if (_floatText[i].framesLeft < 0)
+ _floatText[i].framesLeft = 0;
}
- if (_floatIcon[i][0] > 0) {
+ if (_floatIcon[i].framesLeft > 0) {
float spd = 0.5 * _fpsr;
- _floatIcon[i][0] = _floatIcon[i][0] - spd;
- _floatIcon[i][2] = _floatIcon[i][2] - spd;
- if (_floatIcon[i][0] < 0)
- _floatIcon[i][0] = 0;
+ _floatIcon[i].framesLeft -= spd;
+ _floatIcon[i].y -= spd;
+ if (_floatIcon[i].framesLeft < 0)
+ _floatIcon[i].framesLeft = 0;
}
}
@@ -236,7 +236,7 @@ void GriffonEngine::updateEngine() {
}
}
- // cloudson = false
+ // _cloudsOn = false
if (_itemSelOn)
_player.itemselshade = _player.itemselshade + 2 * _fpsr;
diff --git a/engines/griffon/gfx.cpp b/engines/griffon/gfx.cpp
index de28eba922..c4cbaeadfd 100644
--- a/engines/griffon/gfx.cpp
+++ b/engines/griffon/gfx.cpp
@@ -42,11 +42,11 @@ namespace Griffon {
void GriffonEngine::addFloatIcon(int ico, float xloc, float yloc) {
for (int i = 0; i < kMaxFloat; i++) {
- if (ABS(_floatIcon[i][0]) < kEpsilon) {
- _floatIcon[i][0] = 32;
- _floatIcon[i][1] = xloc;
- _floatIcon[i][2] = yloc;
- _floatIcon[i][3] = ico;
+ if (ABS(_floatIcon[i].framesLeft) < kEpsilon) {
+ _floatIcon[i].framesLeft = 32;
+ _floatIcon[i].x = xloc;
+ _floatIcon[i].y = yloc;
+ _floatIcon[i].ico = ico;
return;
}
}
@@ -54,12 +54,12 @@ void GriffonEngine::addFloatIcon(int ico, float xloc, float yloc) {
void GriffonEngine::addFloatText(const char *stri, float xloc, float yloc, int col) {
for (int i = 0; i < kMaxFloat; i++) {
- if (ABS(_floatText[i][0]) < kEpsilon) {
- _floatText[i][0] = 32;
- _floatText[i][1] = xloc;
- _floatText[i][2] = yloc;
- _floatText[i][3] = col;
- strcpy(_floatStr[i], stri);
+ if (ABS(_floatText[i].framesLeft) < kEpsilon) {
+ _floatText[i].framesLeft = 32;
+ _floatText[i].x = xloc;
+ _floatText[i].y = yloc;
+ _floatText[i].col = col;
+ strcpy(_floatText[i].text, stri);
return;
}
}
diff --git a/engines/griffon/griffon.h b/engines/griffon/griffon.h
index 366dda2e14..dc6867b189 100644
--- a/engines/griffon/griffon.h
+++ b/engines/griffon/griffon.h
@@ -179,8 +179,8 @@ struct BodySection {
};
struct NPC {
- float x;
- float y;
+ float x;
+ float y;
int spriteset;
int x1; // patrol area
int y1;
@@ -194,10 +194,10 @@ struct NPC {
int item2;
int item3;
int script;
- float frame;
- float frame2; // end boss specific
+ float frame;
+ float frame2; // end boss specific
int cframe;
- bool 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;
@@ -205,7 +205,7 @@ struct NPC {
int movementmode;
int walkdir;
- float walkspd;
+ float walkspd;
int movingdir;
bool moving;
@@ -217,17 +217,17 @@ struct NPC {
int attacknext;
int attackattempt;
- int spelldamage;
- int attackdamage;
+ int spellDamage;
+ int attackDamage;
// one wing and firehydra specific
BodySection bodysection[31];
- float swayangle;
- float swayspd;
- float headtargetx[4];
- float headtargety[4];
- int castpause;
+ float swayAngle;
+ float swaySpeed;
+ float headTargetX[4];
+ float headTargetY[4];
+ int castPause;
// firehydra specific
int attacknext2[4];
@@ -281,6 +281,27 @@ struct DataChunk {
int size;
};
+struct FloatTextStruct {
+ float framesLeft;
+ float x;
+ float y;
+ int col;
+ char *text;
+};
+
+struct FloatIconStruct {
+ float framesLeft;
+ float x;
+ float y;
+ int ico;
+};
+
+struct AttackOffsetStruct {
+ float x;
+ float y;
+ bool completed;
+};
+
class GriffonEngine : public Engine {
public:
GriffonEngine(OSystem *syst);
@@ -451,12 +472,10 @@ private:
// id number 0&1 = players
Graphics::TransparentSurface *_animsAttack[100];
// attack anims
- float _playerattackofs[4][16][3];
- // [dir] [frame] [x,y ofs, completed(0/1)]
+ AttackOffsetStruct _playerAttackOfs[4][16];
- float _floatText[kMaxFloat][4]; // [id] [framesleft, x, y, col]
- char *_floatStr[kMaxFloat];
- float _floatIcon[kMaxFloat][4]; // [id] [framesleft, x, y, ico]
+ FloatTextStruct _floatText[kMaxFloat];
+ FloatIconStruct _floatIcon[kMaxFloat];
// special for animset2
AnimSet _animSet2[7], _animSet9[7];
diff --git a/engines/griffon/input.cpp b/engines/griffon/input.cpp
index 5d66b65b4c..96832429da 100644
--- a/engines/griffon/input.cpp
+++ b/engines/griffon/input.cpp
@@ -682,8 +682,8 @@ void GriffonEngine::processTrigger(int trignum) {
}
for (int i = 0; i < kMaxFloat; i++) {
- _floatText[i][0] = 0;
- _floatIcon[i][0] = 0;
+ _floatText[i].framesLeft = 0;
+ _floatIcon[i].framesLeft = 0;
}
}
diff --git a/engines/griffon/logic.cpp b/engines/griffon/logic.cpp
index 81133e2fa2..79ed593536 100644
--- a/engines/griffon/logic.cpp
+++ b/engines/griffon/logic.cpp
@@ -166,7 +166,7 @@ void GriffonEngine::updateNPCs() {
if (_npcInfo[i].pause > _ticks)
mode = -1;
- if (_npcInfo[i].spriteset == kMonsterOneWing && _npcInfo[i].castpause > _ticks)
+ if (_npcInfo[i].spriteset == kMonsterOneWing && _npcInfo[i].castPause > _ticks)
mode = -1;
if (mode == 3) {
@@ -572,8 +572,8 @@ void GriffonEngine::updateNPCs() {
_npcInfo[i].attacking = true;
_npcInfo[i].attackframe = 0;
- _npcInfo[i].headtargetx[0] = _player.px + 12;
- _npcInfo[i].headtargety[0] = _player.py - 4;
+ _npcInfo[i].headTargetX[0] = _player.px + 12;
+ _npcInfo[i].headTargetY[0] = _player.py - 4;
}
}
@@ -581,36 +581,36 @@ void GriffonEngine::updateNPCs() {
dospell = false;
- if (!_npcInfo[i].attacking && _npcInfo[i].castpause < _ticks) {
- _npcInfo[i].swayspd = _npcInfo[i].swayspd + _npcInfo[i].swayspd / 200 * _fpsr;
- if (_npcInfo[i].swayspd > 15) {
+ if (!_npcInfo[i].attacking && _npcInfo[i].castPause < _ticks) {
+ _npcInfo[i].swaySpeed = _npcInfo[i].swaySpeed + _npcInfo[i].swaySpeed / 200 * _fpsr;
+ if (_npcInfo[i].swaySpeed > 15) {
dospell = true;
- _npcInfo[i].swayspd = 1;
+ _npcInfo[i].swaySpeed = 1;
}
// sway code
- _npcInfo[i].swayangle = _npcInfo[i].swayangle + _npcInfo[i].swayspd * _fpsr;
- if (_npcInfo[i].swayangle >= 360)
- _npcInfo[i].swayangle = _npcInfo[i].swayangle - 360;
+ _npcInfo[i].swayAngle = _npcInfo[i].swayAngle + _npcInfo[i].swaySpeed * _fpsr;
+ if (_npcInfo[i].swayAngle >= 360)
+ _npcInfo[i].swayAngle = _npcInfo[i].swayAngle - 360;
- _npcInfo[i].headtargetx[0] = _npcInfo[i].x + (24 - _npcInfo[i].swayspd / 2) * sin(3.14159 / 180 * _npcInfo[i].swayangle) + 12;
- _npcInfo[i].headtargety[0] = _npcInfo[i].y - 36 + 16 + 8 * sin(3.14159 * 2 / 180 * _npcInfo[i].swayangle);
+ _npcInfo[i].headTargetX[0] = _npcInfo[i].x + (24 - _npcInfo[i].swaySpeed / 2) * sin(3.14159 / 180 * _npcInfo[i].swayAngle) + 12;
+ _npcInfo[i].headTargetY[0] = _npcInfo[i].y - 36 + 16 + 8 * sin(3.14159 * 2 / 180 * _npcInfo[i].swayAngle);
}
if (dospell) {
_npcInfo[i].pause = _ticks + 3000;
_npcInfo[i].attacknext = _ticks + 4500;
- _npcInfo[i].castpause = _ticks + 4500;
+ _npcInfo[i].castPause = _ticks + 4500;
castSpell(3, _npcInfo[i].x, _npcInfo[i].y, _npcInfo[i].x, _npcInfo[i].y, i);
- _npcInfo[i].headtargetx[0] = _npcInfo[i].x;
- _npcInfo[i].headtargety[0] = _npcInfo[i].y - 36 + 16;
+ _npcInfo[i].headTargetX[0] = _npcInfo[i].x;
+ _npcInfo[i].headTargetY[0] = _npcInfo[i].y - 36 + 16;
}
// targethead code
- xdif = _npcInfo[i].bodysection[7].x - _npcInfo[i].headtargetx[0];
- ydif = _npcInfo[i].bodysection[7].y - _npcInfo[i].headtargety[0];
+ xdif = _npcInfo[i].bodysection[7].x - _npcInfo[i].headTargetX[0];
+ ydif = _npcInfo[i].bodysection[7].y - _npcInfo[i].headTargetY[0];
_npcInfo[i].bodysection[7].x = _npcInfo[i].bodysection[7].x - xdif * 0.4 * _fpsr;
@@ -641,21 +641,21 @@ void GriffonEngine::updateNPCs() {
castSpell(1, _npcInfo[i].x, _npcInfo[i].y, _player.px, _player.py, i);
}
- if (_npcInfo[i].castpause < _ticks) {
+ if (_npcInfo[i].castPause < _ticks) {
castSpell(6, _npcInfo[i].x, _npcInfo[i].y, _player.px, _player.py, i);
- _npcInfo[i].castpause = _ticks + 12000;
+ _npcInfo[i].castPause = _ticks + 12000;
}
}
// firehydra specific
if (_npcInfo[i].spriteset == kMonsterFireHydra) {
- _npcInfo[i].swayspd = 4;
+ _npcInfo[i].swaySpeed = 4;
// sway code
- _npcInfo[i].swayangle = _npcInfo[i].swayangle + _npcInfo[i].swayspd * _fpsr;
- if (_npcInfo[i].swayangle >= 360)
- _npcInfo[i].swayangle = _npcInfo[i].swayangle - 360;
+ _npcInfo[i].swayAngle = _npcInfo[i].swayAngle + _npcInfo[i].swaySpeed * _fpsr;
+ if (_npcInfo[i].swayAngle >= 360)
+ _npcInfo[i].swayAngle = _npcInfo[i].swayAngle - 360;
for (int ff = 0; ff <= 2; ff++) {
if (_npcInfo[i].hp > 10 * ff * 20) {
@@ -679,23 +679,23 @@ void GriffonEngine::updateNPCs() {
_npcInfo[i].attacking2[ff] = 1;
_npcInfo[i].attackframe2[ff] = 0;
- _npcInfo[i].headtargetx[ff] = _player.px + 12;
- _npcInfo[i].headtargety[ff] = _player.py - 4;
+ _npcInfo[i].headTargetX[ff] = _player.px + 12;
+ _npcInfo[i].headTargetY[ff] = _player.py - 4;
- _npcInfo[i].swayangle = 0;
+ _npcInfo[i].swayAngle = 0;
}
}
}
if (_npcInfo[i].attacking2[ff] == 0) {
- _npcInfo[i].headtargetx[ff] = _npcInfo[i].x + 38 * sin(3.14159 / 180 * (_npcInfo[i].swayangle + 120 * ff)) + 12;
- _npcInfo[i].headtargety[ff] = _npcInfo[i].y - 46 + 16 + 16 * sin(3.14159 * 2 / 180 * (_npcInfo[i].swayangle + 120 * ff));
+ _npcInfo[i].headTargetX[ff] = _npcInfo[i].x + 38 * sin(3.14159 / 180 * (_npcInfo[i].swayAngle + 120 * ff)) + 12;
+ _npcInfo[i].headTargetY[ff] = _npcInfo[i].y - 46 + 16 + 16 * sin(3.14159 * 2 / 180 * (_npcInfo[i].swayAngle + 120 * ff));
}
// targethead code
- xdif = _npcInfo[i].bodysection[10 * ff + 9].x - _npcInfo[i].headtargetx[ff];
- ydif = _npcInfo[i].bodysection[10 * ff + 9].y - _npcInfo[i].headtargety[ff];
+ xdif = _npcInfo[i].bodysection[10 * ff + 9].x - _npcInfo[i].headTargetX[ff];
+ ydif = _npcInfo[i].bodysection[10 * ff + 9].y - _npcInfo[i].headTargetY[ff];
_npcInfo[i].bodysection[10 * ff + 9].x = _npcInfo[i].bodysection[10 * ff + 9].x - xdif * 0.4 * _fpsr;
_npcInfo[i].bodysection[10 * ff + 9].y = _npcInfo[i].bodysection[10 * ff + 9].y - ydif * 0.4 * _fpsr;
@@ -776,7 +776,7 @@ void GriffonEngine::updateNPCs() {
castSpell(9, _npcInfo[i].x, _npcInfo[i].y, _player.px, _player.py, i);
}
- if (_npcInfo[i].castpause < _ticks) {
+ if (_npcInfo[i].castPause < _ticks) {
// castSpell 6, _npcinfo[i].x, _npcinfo[i].y, _player.px, _player.py, i
// _npcinfo[i].castpause = _ticks + 12000
}
@@ -858,39 +858,39 @@ void GriffonEngine::updateNPCs() {
_npcInfo[i].attacking = true;
_npcInfo[i].attackframe = 0;
- _npcInfo[i].headtargetx[0] = _player.px + 12;
- _npcInfo[i].headtargety[0] = _player.py - 4;
+ _npcInfo[i].headTargetX[0] = _player.px + 12;
+ _npcInfo[i].headTargetY[0] = _player.py - 4;
}
}
}
- if (!_npcInfo[i].attacking && _npcInfo[i].castpause < _ticks) {
- _npcInfo[i].swayspd = 4;
+ if (!_npcInfo[i].attacking && _npcInfo[i].castPause < _ticks) {
+ _npcInfo[i].swaySpeed = 4;
// sway code
- _npcInfo[i].swayangle = _npcInfo[i].swayangle + _npcInfo[i].swayspd * _fpsr;
- if (_npcInfo[i].swayangle >= 360)
- _npcInfo[i].swayangle = _npcInfo[i].swayangle - 360;
+ _npcInfo[i].swayAngle = _npcInfo[i].swayAngle + _npcInfo[i].swaySpeed * _fpsr;
+ if (_npcInfo[i].swayAngle >= 360)
+ _npcInfo[i].swayAngle = _npcInfo[i].swayAngle - 360;
- _npcInfo[i].headtargetx[0] = _npcInfo[i].x + (24 - _npcInfo[i].swayspd / 2) * sin(3.14159 / 180 * _npcInfo[i].swayangle) + 12;
- _npcInfo[i].headtargety[0] = _npcInfo[i].y - 36 + 16 + 8 * sin(3.14159 * 2 / 180 * _npcInfo[i].swayangle);
+ _npcInfo[i].headTargetX[0] = _npcInfo[i].x + (24 - _npcInfo[i].swaySpeed / 2) * sin(3.14159 / 180 * _npcInfo[i].swayAngle) + 12;
+ _npcInfo[i].headTargetY[0] = _npcInfo[i].y - 36 + 16 + 8 * sin(3.14159 * 2 / 180 * _npcInfo[i].swayAngle);
}
if (dospell) {
_npcInfo[i].pause = _ticks + 3000;
_npcInfo[i].attacknext = _ticks + 5000;
- _npcInfo[i].castpause = _ticks + 3000;
+ _npcInfo[i].castPause = _ticks + 3000;
castSpell(3, _npcInfo[i].x, _npcInfo[i].y, _npcInfo[i].x, _npcInfo[i].y, i);
- _npcInfo[i].headtargetx[0] = _npcInfo[i].x;
- _npcInfo[i].headtargety[0] = _npcInfo[i].y - 36 + 16;
+ _npcInfo[i].headTargetX[0] = _npcInfo[i].x;
+ _npcInfo[i].headTargetY[0] = _npcInfo[i].y - 36 + 16;
}
// targethead code
- xdif = _npcInfo[i].bodysection[7].x - _npcInfo[i].headtargetx[0];
- ydif = _npcInfo[i].bodysection[7].y - _npcInfo[i].headtargety[0];
+ xdif = _npcInfo[i].bodysection[7].x - _npcInfo[i].headTargetX[0];
+ ydif = _npcInfo[i].bodysection[7].y - _npcInfo[i].headTargetY[0];
_npcInfo[i].bodysection[7].x = _npcInfo[i].bodysection[7].x - xdif * 0.4 * _fpsr;
@@ -1012,7 +1012,7 @@ void GriffonEngine::updateNPCs() {
// _npcinfo[i].attackframe = 0;
// _npcinfo[i].attacking = false;
- damage = (float)_npcInfo[i].attackdamage * (0.5 + RND() * 1.0);
+ damage = (float)_npcInfo[i].attackDamage * (0.5 + RND() * 1.0);
if (_player.hp > 0)
damagePlayer(damage);
@@ -1021,8 +1021,8 @@ void GriffonEngine::updateNPCs() {
if (_npcInfo[i].spriteset == kMonsterOneWing) {
// targethead code
- float xdif = _npcInfo[i].bodysection[7].x - _npcInfo[i].headtargetx[0];
- float ydif = _npcInfo[i].bodysection[7].y - _npcInfo[i].headtargety[0];
+ float xdif = _npcInfo[i].bodysection[7].x - _npcInfo[i].headTargetX[0];
+ float ydif = _npcInfo[i].bodysection[7].y - _npcInfo[i].headTargetY[0];
_npcInfo[i].bodysection[7].x = _npcInfo[i].bodysection[7].x - xdif * 0.4 * _fpsr;
_npcInfo[i].bodysection[7].y = _npcInfo[i].bodysection[7].y - ydif * 0.4 * _fpsr;
@@ -1062,7 +1062,7 @@ void GriffonEngine::updateNPCs() {
_npcInfo[i].attacknext = _ticks + _npcInfo[i].attackdelay;
// _npcinfo[i].attackframe = 0
// _npcinfo[i].attacking = false
- damage = (float)_npcInfo[i].attackdamage * (1.0 + (RND() * 0.5));
+ damage = (float)_npcInfo[i].attackDamage * (1.0 + (RND() * 0.5));
if (_player.hp > 0)
damagePlayer(damage);
}
@@ -1073,8 +1073,8 @@ void GriffonEngine::updateNPCs() {
if (_npcInfo[i].spriteset == kMonsterFireHydra) {
for (int ff = 0; ff <= 2; ff++) {
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];
+ 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];
_npcInfo[i].bodysection[10 * ff + 9].x = _npcInfo[i].bodysection[10 * ff + 9].x - xdif * .2 * _fpsr;
_npcInfo[i].bodysection[10 * ff + 9].y = _npcInfo[i].bodysection[10 * ff + 9].y - ydif * .2 * _fpsr;
@@ -1114,7 +1114,7 @@ void GriffonEngine::updateNPCs() {
_npcInfo[i].attacknext2[ff] = _ticks + _npcInfo[i].attackdelay;
// _npcinfo[i].attackframe2(ff) = 0
// _npcinfo[i].attacking2(ff) = false
- damage = (float)_npcInfo[i].attackdamage * (1.0 + RND() * 0.5);
+ damage = (float)_npcInfo[i].attackDamage * (1.0 + RND() * 0.5);
if (_player.hp > 0)
damagePlayer(damage);
}
@@ -1126,8 +1126,8 @@ void GriffonEngine::updateNPCs() {
// twowing specific
if (_npcInfo[i].spriteset == kMonsterTwoWing) {
// targethead code
- float xdif = _npcInfo[i].bodysection[7].x - _npcInfo[i].headtargetx[0];
- float ydif = _npcInfo[i].bodysection[7].y - _npcInfo[i].headtargety[0];
+ float xdif = _npcInfo[i].bodysection[7].x - _npcInfo[i].headTargetX[0];
+ float ydif = _npcInfo[i].bodysection[7].y - _npcInfo[i].headTargetY[0];
_npcInfo[i].bodysection[7].x = _npcInfo[i].bodysection[7].x - xdif * 0.4 * _fpsr;
_npcInfo[i].bodysection[7].y = _npcInfo[i].bodysection[7].y - ydif * 0.4 * _fpsr;
@@ -1167,7 +1167,7 @@ void GriffonEngine::updateNPCs() {
_npcInfo[i].attacknext = _ticks + _npcInfo[i].attackdelay;
// _npcinfo[i].attackframe = 0
// _npcinfo[i].attacking = false
- damage = (float)_npcInfo[i].attackdamage * (1.0 + RND() * 0.5);
+ damage = (float)_npcInfo[i].attackDamage * (1.0 + RND() * 0.5);
if (_player.hp > 0)
damagePlayer(damage);
}
@@ -1197,7 +1197,7 @@ void GriffonEngine::updateNPCs() {
_npcInfo[i].attacknext = _ticks + _npcInfo[i].attackdelay;
// _npcinfo[i].attackframe = 0
// _npcinfo[i].attacking = false
- damage = (float)_npcInfo[i].attackdamage * (0.5 + RND() * 1.0);
+ damage = (float)_npcInfo[i].attackDamage * (0.5 + RND() * 1.0);
if (_player.hp > 0)
damagePlayer(damage);
}
@@ -1226,7 +1226,7 @@ void GriffonEngine::updateNPCs() {
_npcInfo[i].attacknext = _ticks + _npcInfo[i].attackdelay;
// _npcinfo[i].attackframe = 0
// _npcinfo[i].attacking = false
- damage = (float)_npcInfo[i].attackdamage * (0.5 + RND() * 1.0);
+ damage = (float)_npcInfo[i].attackDamage * (0.5 + RND() * 1.0);
if (_player.hp > 0)
damagePlayer(damage);
}
@@ -1436,7 +1436,7 @@ void GriffonEngine::updateSpells() {
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);
+ float damage = (float)_npcInfo[_spellInfo[i].npc].spellDamage * (1.0 + RND() * 0.5);
if (_player.hp > 0) {
damagePlayer(damage);
@@ -1743,7 +1743,7 @@ void GriffonEngine::updateSpells() {
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;
+ float damage = _npcInfo[_spellInfo[i].npc].spellDamage * (1 + RND() * 0.5) / 3;
if (_player.hp > 0)
damagePlayer(damage);
@@ -2241,7 +2241,7 @@ void GriffonEngine::updateSpellsUnder() {
float ydif = (yloc + 8) - (_player.py + 12);
if ((abs(xdif) < 8 && abs(ydif) < 8) && _player.pause < _ticks) {
- float damage = (float)_npcInfo[_spellInfo[i].npc].spelldamage * (1.0 + RND() * 0.5);
+ float damage = (float)_npcInfo[_spellInfo[i].npc].spellDamage * (1.0 + RND() * 0.5);
if (_player.hp > 0) {
damagePlayer(damage);
@@ -2334,7 +2334,7 @@ void GriffonEngine::updateSpellsUnder() {
float ydif = (yloc + 8) - (_player.py + 12);
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);
+ float damage = (float)_npcInfo[_spellInfo[i].npc].spellDamage * (1.0 + RND() * 0.5);
if (_player.hp > 0) {
damagePlayer(damage);
diff --git a/engines/griffon/resources.cpp b/engines/griffon/resources.cpp
index 6f5b7e087f..a67b29235a 100644
--- a/engines/griffon/resources.cpp
+++ b/engines/griffon/resources.cpp
@@ -55,7 +55,7 @@ namespace Griffon {
void GriffonEngine::initialize() {
// init char *_floatstri[kMaxFloat]
for (int i = 0; i < kMaxFloat; i++)
- _floatStr[i] = (char *)malloc(64); // 64 bytes each string (should be enough)
+ _floatText[i].text = (char *)malloc(64); // 64 bytes each string (should be enough)
_video = new Graphics::TransparentSurface;
_video->create(320, 240, g_system->getScreenFormat());
@@ -107,17 +107,17 @@ void GriffonEngine::initialize() {
_nextTicks = _ticks + 1000;
for (int i = 0; i <= 15; i++) {
- _playerattackofs[0][i][0] = 0; // -1// -(i + 1)
- _playerattackofs[0][i][1] = -sin(3.14159 * 2 * (i + 1) / 16) * 2 - 1;
+ _playerAttackOfs[0][i].x = 0; // -1// -(i + 1)
+ _playerAttackOfs[0][i].y = -sin(3.14159 * 2 * (i + 1) / 16) * 2 - 1;
- _playerattackofs[1][i][0] = 0; // i + 1
- _playerattackofs[1][i][1] = -sin(3.14159 * 2 * (i + 1) / 16) * 2 + 1;
+ _playerAttackOfs[1][i].x = 0; // i + 1
+ _playerAttackOfs[1][i].y = -sin(3.14159 * 2 * (i + 1) / 16) * 2 + 1;
- _playerattackofs[2][i][0] = -1; // -(i + 1)
- _playerattackofs[2][i][1] = -sin(3.14159 * 2 * (i + 1) / 16) * 2;
+ _playerAttackOfs[2][i].x = -1; // -(i + 1)
+ _playerAttackOfs[2][i].y = -sin(3.14159 * 2 * (i + 1) / 16) * 2;
- _playerattackofs[3][i][0] = 1; // i + 1
- _playerattackofs[3][i][1] = -sin(3.14159 * 2 * (i + 1) / 16) * 2;
+ _playerAttackOfs[3][i].x = 1; // i + 1
+ _playerAttackOfs[3][i].y = -sin(3.14159 * 2 * (i + 1) / 16) * 2;
}
setupAudio();
@@ -390,7 +390,7 @@ void GriffonEngine::loadMap(int mapnum) {
_lastNpc = 0;
for (int i = 0; i < kMaxNPC; i++)
- _npcInfo[i].onmap = false;
+ _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 = true;
+ _npcInfo[o].onMap = true;
}
}
}
@@ -492,8 +492,8 @@ void GriffonEngine::loadMap(int mapnum) {
_npcInfo[i].hp = 12;
_npcInfo[i].attackdelay = 2000;
- _npcInfo[i].attackdamage = 2;
- _npcInfo[i].spelldamage = 0;
+ _npcInfo[i].attackDamage = 2;
+ _npcInfo[i].spellDamage = 0;
_npcInfo[i].walkspd = 1;
@@ -505,13 +505,13 @@ void GriffonEngine::loadMap(int mapnum) {
if (_npcInfo[i].spriteset == kMonsterOneWing) {
_npcInfo[i].hp = 200;
_npcInfo[i].attackdelay = 2000;
- _npcInfo[i].swayspd = 1;
+ _npcInfo[i].swaySpeed = 1;
- _npcInfo[i].attackdamage = 24;
- _npcInfo[i].spelldamage = 30;
+ _npcInfo[i].attackDamage = 24;
+ _npcInfo[i].spellDamage = 30;
_npcInfo[i].walkspd = 1.4f;
- _npcInfo[i].castpause = _ticks;
+ _npcInfo[i].castPause = _ticks;
}
// boss1
@@ -519,8 +519,8 @@ void GriffonEngine::loadMap(int mapnum) {
_npcInfo[i].hp = 300;
_npcInfo[i].attackdelay = 2200;
- _npcInfo[i].attackdamage = 0;
- _npcInfo[i].spelldamage = 30;
+ _npcInfo[i].attackDamage = 0;
+ _npcInfo[i].spellDamage = 30;
_npcInfo[i].walkspd = 1.2f;
}
@@ -530,8 +530,8 @@ void GriffonEngine::loadMap(int mapnum) {
_npcInfo[i].hp = 200;
_npcInfo[i].attackdelay = 2800;
- _npcInfo[i].attackdamage = 0;
- _npcInfo[i].spelldamage = 30;
+ _npcInfo[i].attackDamage = 0;
+ _npcInfo[i].spellDamage = 30;
_npcInfo[i].walkspd = 1;
}
@@ -541,12 +541,12 @@ void GriffonEngine::loadMap(int mapnum) {
_npcInfo[i].hp = 600;
_npcInfo[i].attackdelay = 2200;
- _npcInfo[i].attackdamage = 50;
- _npcInfo[i].spelldamage = 30;
+ _npcInfo[i].attackDamage = 50;
+ _npcInfo[i].spellDamage = 30;
_npcInfo[i].walkspd = 1.3f;
- _npcInfo[i].swayangle = 0;
+ _npcInfo[i].swayAngle = 0;
}
// baby fire dragon
@@ -554,8 +554,8 @@ void GriffonEngine::loadMap(int mapnum) {
_npcInfo[i].hp = 20;
_npcInfo[i].attackdelay = 1500;
- _npcInfo[i].attackdamage = 0;
- _npcInfo[i].spelldamage = 12;
+ _npcInfo[i].attackDamage = 0;
+ _npcInfo[i].spellDamage = 12;
_npcInfo[i].walkspd = 1;
@@ -568,8 +568,8 @@ void GriffonEngine::loadMap(int mapnum) {
_npcInfo[i].hp = 40;
_npcInfo[i].attackdelay = 5000;
- _npcInfo[i].attackdamage = 0;
- _npcInfo[i].spelldamage = 8;
+ _npcInfo[i].attackDamage = 0;
+ _npcInfo[i].spellDamage = 8;
_npcInfo[i].walkspd = 1;
@@ -582,8 +582,8 @@ void GriffonEngine::loadMap(int mapnum) {
_npcInfo[i].hp = 100;
_npcInfo[i].attackdelay = 1500;
- _npcInfo[i].attackdamage = 0;
- _npcInfo[i].spelldamage = 24;
+ _npcInfo[i].attackDamage = 0;
+ _npcInfo[i].spellDamage = 24;
_npcInfo[i].walkspd = 1;
@@ -595,14 +595,14 @@ void GriffonEngine::loadMap(int mapnum) {
if (_npcInfo[i].spriteset == kMonsterTwoWing) {
_npcInfo[i].hp = 140;
_npcInfo[i].attackdelay = 2000;
- _npcInfo[i].swayspd = 1;
+ _npcInfo[i].swaySpeed = 1;
- _npcInfo[i].attackdamage = 30;
- _npcInfo[i].spelldamage = 0;
+ _npcInfo[i].attackDamage = 30;
+ _npcInfo[i].spellDamage = 0;
_npcInfo[i].walkspd = 1;
- _npcInfo[i].castpause = 0;
+ _npcInfo[i].castPause = 0;
}
// dragon2
@@ -610,8 +610,8 @@ void GriffonEngine::loadMap(int mapnum) {
_npcInfo[i].hp = 80;
_npcInfo[i].attackdelay = 1500;
- _npcInfo[i].attackdamage = 24;
- _npcInfo[i].spelldamage = 0;
+ _npcInfo[i].attackDamage = 24;
+ _npcInfo[i].spellDamage = 0;
_npcInfo[i].walkspd = 1;
@@ -623,8 +623,8 @@ void GriffonEngine::loadMap(int mapnum) {
_npcInfo[i].hp = 1200;
_npcInfo[i].attackdelay = 2000;
- _npcInfo[i].attackdamage = 100;
- _npcInfo[i].spelldamage = 60;
+ _npcInfo[i].attackDamage = 100;
+ _npcInfo[i].spellDamage = 60;
_npcInfo[i].walkspd = 1;
@@ -636,15 +636,15 @@ void GriffonEngine::loadMap(int mapnum) {
_npcInfo[i].hp = 800;
_npcInfo[i].attackdelay = 2000;
- _npcInfo[i].attackdamage = 100;
- _npcInfo[i].spelldamage = 50;
+ _npcInfo[i].attackDamage = 100;
+ _npcInfo[i].spellDamage = 50;
_npcInfo[i].walkspd = 1;
_npcInfo[i].floating = RND() * 16;
}
- if (!_npcInfo[i].onmap)
+ if (!_npcInfo[i].onMap)
_npcInfo[i].hp = 0;
_npcInfo[i].maxhp = _npcInfo[i].hp;
@@ -678,8 +678,8 @@ void GriffonEngine::loadMap(int mapnum) {
_npcInfo[i].bodysection[f].y = _npcInfo[i].y + 14;
}
- _npcInfo[i].headtargetx[0] = _npcInfo[i].x + 12;
- _npcInfo[i].headtargety[0] = _npcInfo[i].y + 14;
+ _npcInfo[i].headTargetX[0] = _npcInfo[i].x + 12;
+ _npcInfo[i].headTargetY[0] = _npcInfo[i].y + 14;
}
@@ -690,8 +690,8 @@ void GriffonEngine::loadMap(int mapnum) {
}
for (int f = 0; f <= 2; f++) {
- _npcInfo[i].headtargetx[f] = _npcInfo[i].x + 12;
- _npcInfo[i].headtargety[f] = _npcInfo[i].y + 14;
+ _npcInfo[i].headTargetX[f] = _npcInfo[i].x + 12;
+ _npcInfo[i].headTargetY[f] = _npcInfo[i].y + 14;
_npcInfo[i].attacking2[f] = false;
_npcInfo[i].attackframe2[f] = 0;