[Scummvm-git-logs] scummvm master -> 7f64ddfbb1a04f197a2355872d8c326c0c33543b
Strangerke
noreply at scummvm.org
Sun Jan 19 09:22:10 UTC 2025
This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .
Summary:
7f64ddfbb1 GOT: renaming and constness in game and views folders, add some missing default cases in switches
Commit: 7f64ddfbb1a04f197a2355872d8c326c0c33543b
https://github.com/scummvm/scummvm/commit/7f64ddfbb1a04f197a2355872d8c326c0c33543b
Author: Strangerke (arnaud.boutonne at gmail.com)
Date: 2025-01-19T10:21:58+01:00
Commit Message:
GOT: renaming and constness in game and views folders, add some missing default cases in switches
Changed paths:
engines/got/data/actor.h
engines/got/game/back.cpp
engines/got/game/back.h
engines/got/game/boss1.cpp
engines/got/game/boss2.cpp
engines/got/game/boss3.cpp
engines/got/game/init.cpp
engines/got/game/move.cpp
engines/got/game/move.h
engines/got/game/move_patterns.cpp
engines/got/game/move_patterns.h
engines/got/game/object.cpp
engines/got/game/shot_movement.cpp
engines/got/game/shot_pattern.cpp
engines/got/got.cpp
engines/got/views/game.cpp
engines/got/views/game_content.cpp
diff --git a/engines/got/data/actor.h b/engines/got/data/actor.h
index 977a1551c55..88f04d6d686 100644
--- a/engines/got/data/actor.h
+++ b/engines/got/data/actor.h
@@ -19,12 +19,12 @@
*
*/
-#include "common/stream.h"
-#include "graphics/managed_surface.h"
-
#ifndef GOT_DATA_ACTOR_H
#define GOT_DATA_ACTOR_H
+#include "common/stream.h"
+#include "graphics/managed_surface.h"
+
namespace Got {
#define DIRECTION_COUNT 4
@@ -35,7 +35,7 @@ struct Actor {
byte _moveType = 0; // Movement pattern (0=none)
byte _width = 0; // Physical width
byte _height = 0; // Physical height
- byte _directions = 0; // 1,2 or 4 (1=uni-directional)
+ byte _directions = 0; // 1, 2 or 4 (1=uni-directional)
byte _framesPerDirection = 0; // # frames per direction
byte _frameSpeed = 0; // # cycles between frame changes
byte _frameSequence[4] = {}; // Sequence
@@ -51,7 +51,7 @@ struct Actor {
byte _solid = 0; // 1=solid (not ghost,etc)
bool _flying = false; //
byte _dropRating = 0; // rnd(100) < _dropRating = jewel
- byte _type = 0; // Actor (0=thor,1=hammer,2=enemy,3=shot)
+ byte _type = 0; // Actor (0 = thor, 1 = hammer, 2 = enemy, 3 = shot)
char _name[9] = {}; // Actors name
byte _funcNum = 0; // Special function when thor touches
byte _funcPass = 0; // Value to pass to func
diff --git a/engines/got/game/back.cpp b/engines/got/game/back.cpp
index 8c72e557e64..96c8016354b 100644
--- a/engines/got/game/back.cpp
+++ b/engines/got/game/back.cpp
@@ -45,7 +45,7 @@ const char *ITEM_NAMES[] = {
static const char *odinEndMessage;
-void showLevel(int new_level) {
+void showLevel(const int newLevel) {
_G(boss_active) = false;
if (!_G(shield_on))
_G(actor[2])._active = false;
@@ -75,23 +75,23 @@ void showLevel(int new_level) {
warning("showLevel - Potential short move missing");
if (_G(warp_flag))
- _G(current_level) = new_level - 5; // Force phase
+ _G(current_level) = newLevel - 5; // Force phase
_G(warp_flag) = false;
if (_G(warp_scroll)) {
_G(warp_scroll) = false;
if (_G(thor)->_dir == 0)
- _G(current_level) = new_level + 10;
+ _G(current_level) = newLevel + 10;
else if (_G(thor)->_dir == 1)
- _G(current_level) = new_level - 10;
+ _G(current_level) = newLevel - 10;
else if (_G(thor)->_dir == 2)
- _G(current_level) = new_level + 1;
+ _G(current_level) = newLevel + 1;
else if (_G(thor)->_dir == 3)
- _G(current_level) = new_level - 1;
+ _G(current_level) = newLevel - 1;
}
if (!_G(setup)._scrollFlag)
- _G(current_level) = new_level; // Force no scroll
+ _G(current_level) = newLevel; // Force no scroll
if (_G(music_current) != _G(levelMusic))
_G(sound).music_pause();
@@ -192,7 +192,7 @@ static void odin_speaks_end() {
g_events->send(GameMessage(odinEndMessage));
}
-void odinSpeaks(int index, int item, const char *endMessage) {
+void odinSpeaks(const int index, int item, const char *endMessage) {
odinEndMessage = endMessage;
execute_script((long)index, _G(odin), odin_speaks_end);
@@ -203,14 +203,15 @@ int switchIcons() {
for (int y = 0; y < 12; y++) {
for (int x = 0; x < 20; x++) {
- int ix = x * 16;
- int iy = y * 16;
+ const int ix = x * 16;
+ const int iy = y * 16;
if (_G(scrn)._iconGrid[y][x] == 93) {
placeTile(x, y, 144);
} else if (_G(scrn)._iconGrid[y][x] == 144) {
placeTile(x, y, 93);
killEnemies(iy, ix);
}
+
if (_G(scrn)._iconGrid[y][x] == 94) {
placeTile(x, y, 146);
} else if (_G(scrn)._iconGrid[y][x] == 146) {
@@ -242,7 +243,7 @@ int rotateArrows() {
return 0;
}
-void killEnemies(int iy, int ix) {
+void killEnemies(const int iy, const int ix) {
int x1, y1, x2, y2;
for (int i = 3; i < MAX_ACTORS; i++) {
@@ -252,14 +253,14 @@ void killEnemies(int iy, int ix) {
x2 = (_G(actor[i])._x + _G(actor[i])._sizeX);
y2 = _G(actor[i])._y + _G(actor[i])._sizeY - 1;
- if (point_within(x1, y1, ix, iy, ix + 15, iy + 15))
- actor_destroyed(&_G(actor[i]));
- else if (point_within(x2, y1, ix, iy, ix + 15, iy + 15))
- actor_destroyed(&_G(actor[i]));
- else if (point_within(x1, y2, ix, iy, ix + 15, iy + 15))
- actor_destroyed(&_G(actor[i]));
- else if (point_within(x2, y2, ix, iy, ix + 15, iy + 15))
- actor_destroyed(&_G(actor[i]));
+ if (pointWithin(x1, y1, ix, iy, ix + 15, iy + 15))
+ actorDestroyed(&_G(actor[i]));
+ else if (pointWithin(x2, y1, ix, iy, ix + 15, iy + 15))
+ actorDestroyed(&_G(actor[i]));
+ else if (pointWithin(x1, y2, ix, iy, ix + 15, iy + 15))
+ actorDestroyed(&_G(actor[i]));
+ else if (pointWithin(x2, y2, ix, iy, ix + 15, iy + 15))
+ actorDestroyed(&_G(actor[i]));
}
}
@@ -268,7 +269,7 @@ void killEnemies(int iy, int ix) {
x2 = x1 + 13;
y2 = y1 + 5;
- if (point_within(x1, y1, ix, iy, ix + 15, iy + 15) || point_within(x2, y1, ix, iy, ix + 15, iy + 15) || point_within(x1, y2, ix, iy, ix + 15, iy + 15) || point_within(x2, y2, ix, iy, ix + 15, iy + 15)) {
+ if (pointWithin(x1, y1, ix, iy, ix + 15, iy + 15) || pointWithin(x2, y1, ix, iy, ix + 15, iy + 15) || pointWithin(x1, y2, ix, iy, ix + 15, iy + 15) || pointWithin(x2, y2, ix, iy, ix + 15, iy + 15)) {
if (!_G(cheats).freezeHealth) {
_G(thor)->_health = 0;
g_events->send(GameMessage("THOR_DIES"));
@@ -276,8 +277,8 @@ void killEnemies(int iy, int ix) {
}
}
-void removeObjects(int y, int x) {
- int p = (y * 20) + x;
+void removeObjects(const int y, const int x) {
+ const int p = (y * 20) + x;
if (_G(object_map[p]) > 0) {
_G(object_map[p]) = 0;
@@ -285,7 +286,7 @@ void removeObjects(int y, int x) {
}
}
-void placeTile(int x, int y, int tile) {
+void placeTile(const int x, const int y, const int tile) {
_G(scrn)._iconGrid[y][x] = tile;
removeObjects(y, x);
}
diff --git a/engines/got/game/back.h b/engines/got/game/back.h
index 773698bf536..81ebf836f0c 100644
--- a/engines/got/game/back.h
+++ b/engines/got/game/back.h
@@ -35,7 +35,7 @@ extern const char *ITEM_NAMES[];
* Now in ScummVM, it only does the setup portions, since the
* GameContent view takes care of the scene rendering.
*/
-extern void showLevel(int new_level);
+extern void showLevel(int newLevel);
extern void showLevelDone();
extern void odinSpeaks(int index, int item, const char *endMessage = nullptr);
extern int switchIcons();
diff --git a/engines/got/game/boss1.cpp b/engines/got/game/boss1.cpp
index c8b2290ff10..41f1582ef4a 100644
--- a/engines/got/game/boss1.cpp
+++ b/engines/got/game/boss1.cpp
@@ -51,7 +51,7 @@ int boss1Movement(Actor *actor) {
if (overlap(actor->_x + 2, actor->_y + 8, actor->_x + 30, actor->_y + 30,
_G(thor)->_x, _G(thor)->_y + 8, _G(thor)->_x + 15, _G(thor)->_y + 15)) {
- thor_damaged(actor);
+ thorDamaged(actor);
}
if (actor->_temp3) { //start striking
@@ -117,7 +117,7 @@ int boss1Movement(Actor *actor) {
y1 = _G(actor[5])._y;
y1 += 2;
- if (!check_move2(x1, y1, &_G(actor[5])))
+ if (!checkMove2(x1, y1, &_G(actor[5])))
f = true;
else {
actor->_x = _G(actor[5])._x;
@@ -127,7 +127,7 @@ int boss1Movement(Actor *actor) {
case 0:
case 2:
y1 -= 2;
- if (!check_move2(x1, y1, actor))
+ if (!checkMove2(x1, y1, actor))
f = true;
break;
@@ -182,7 +182,7 @@ void boss1CheckHit(const Actor *actor, int x1, int y1, int x2, int y2, int act_n
if (actor->_moveType == 15 && act_num == 4) {
if ((!_G(actor[3])._vulnerableCountdown) && (_G(actor[3])._nextFrame != 3) &&
overlap(x1, y1, x2, y2, actor->_x + 6, actor->_y + 4, actor->_x + 14, actor->_y + 20)) {
- actor_damaged(&_G(actor[3]), _G(hammer)->_hitStrength);
+ actorDamaged(&_G(actor[3]), _G(hammer)->_hitStrength);
if (_G(cheat) && _G(key_flag[_Z]))
_G(actor[3])._health = 0;
else
@@ -217,12 +217,12 @@ static int boss1_dead() {
_G(hourglass_flag) = 0;
if (_G(boss_dead)) {
for (int rep = 0; rep < 4; rep++) {
- int x1 = _G(actor[3 + rep])._lastX[_G(pge)];
- int y1 = _G(actor[3 + rep])._lastY[_G(pge)];
- int x = _G(actor[3 + rep])._x;
- int y = _G(actor[3 + rep])._y;
- int n = _G(actor[3 + rep])._actorNum;
- int r = _G(actor[3 + rep])._dropRating;
+ const int x1 = _G(actor[3 + rep])._lastX[_G(pge)];
+ const int y1 = _G(actor[3 + rep])._lastY[_G(pge)];
+ const int x = _G(actor[3 + rep])._x;
+ const int y = _G(actor[3 + rep])._y;
+ const int n = _G(actor[3 + rep])._actorNum;
+ const int r = _G(actor[3 + rep])._dropRating;
_G(actor[3 + rep]) = _G(explosion);
_G(actor[3 + rep])._actorNum = n;
@@ -246,7 +246,7 @@ static int boss1_dead() {
for (int rep = 7; rep < MAX_ACTORS; rep++) {
if (_G(actor[rep])._active)
- actor_destroyed(&_G(actor[rep]));
+ actorDestroyed(&_G(actor[rep]));
}
}
diff --git a/engines/got/game/boss2.cpp b/engines/got/game/boss2.cpp
index db608707e69..14e0e1c6d68 100644
--- a/engines/got/game/boss2.cpp
+++ b/engines/got/game/boss2.cpp
@@ -134,7 +134,7 @@ int boss2Movement(Actor *actor) {
dropFlag = true;
_G(actor[3])._temp6 = 40;
- actor_always_shoots(actor, 1);
+ actorAlwaysShoots(actor, 1);
play_sound(FALL, false);
_G(actor[actor->_shotActor])._x = actor->_x + 12;
_G(actor[actor->_shotActor])._y = actor->_y + 32;
@@ -170,10 +170,10 @@ static void bossSet(byte d, int x, int y) {
void boss2CheckHit(Actor *actor, int x1, int y1, int x2, int y2, int act_num) {
if ((!_G(actor[3])._vulnerableCountdown)) {
- actor_damaged(&_G(actor[3]), _G(hammer)->_hitStrength);
+ actorDamaged(&_G(actor[3]), _G(hammer)->_hitStrength);
_G(actor[3])._health -= 10;
if (_G(actor[3])._health == 50) {
- play_sound(BOSS12, 1);
+ play_sound(BOSS12, true);
g_events->send("Game", GameMessage("PAUSE", 40));
@@ -183,7 +183,7 @@ void boss2CheckHit(Actor *actor, int x1, int y1, int x2, int y2, int act_num) {
for (int rep = 7; rep < MAX_ACTORS; rep++) {
if (_G(actor[rep])._active)
- actor_destroyed(&_G(actor[rep]));
+ actorDestroyed(&_G(actor[rep]));
}
_G(actor[3])._currNumShots = 0;
} else
@@ -202,7 +202,7 @@ void boss2CheckHit(Actor *actor, int x1, int y1, int x2, int y2, int act_num) {
_G(boss_dead) = true;
for (int rep = 7; rep < MAX_ACTORS; rep++) {
if (_G(actor[rep])._active)
- actor_destroyed(&_G(actor[rep]));
+ actorDestroyed(&_G(actor[rep]));
}
}
}
@@ -227,12 +227,12 @@ static int boss2Die() {
_G(thunder_flag) = 0;
if (_G(boss_dead)) {
for (int rep = 0; rep < 4; rep++) {
- int x1 = _G(actor[3 + rep])._lastX[_G(pge)];
- int y1 = _G(actor[3 + rep])._lastY[_G(pge)];
- int x = _G(actor[3 + rep])._x;
- int y = _G(actor[3 + rep])._y;
- int n = _G(actor[3 + rep])._actorNum;
- int r = _G(actor[3 + rep])._dropRating;
+ const int x1 = _G(actor[3 + rep])._lastX[_G(pge)];
+ const int y1 = _G(actor[3 + rep])._lastY[_G(pge)];
+ const int x = _G(actor[3 + rep])._x;
+ const int y = _G(actor[3 + rep])._y;
+ const int n = _G(actor[3 + rep])._actorNum;
+ const int r = _G(actor[3 + rep])._dropRating;
_G(actor[3 + rep]) = _G(explosion);
@@ -272,8 +272,8 @@ static int boss2MovementExplode(Actor *actor) {
return 0;
play_sound(EXPLODE, true);
- actor_always_shoots(&_G(actor[5]), 0);
- int an = _G(actor[5])._shotActor;
+ actorAlwaysShoots(&_G(actor[5]), 0);
+ const int an = _G(actor[5])._shotActor;
_G(actor[an])._moveType = 9;
int r = _G(rand1) % 60;
@@ -283,8 +283,8 @@ static int boss2MovementExplode(Actor *actor) {
r = 0;
}
expf[r] = true;
- int x = (EXPLOSION[r] % 20) * 16;
- int y = (EXPLOSION[r] / 20) * 16;
+ const int x = (EXPLOSION[r] % 20) * 16;
+ const int y = (EXPLOSION[r] / 20) * 16;
_G(actor[an])._x = x;
_G(actor[an])._y = y;
@@ -306,7 +306,7 @@ static int boss2MovementShake(Actor *actor) {
if (_G(hammer)->_active && _G(hammer)->_moveType != 5) {
hx = _G(hammer)->_x;
- int hy = _G(hammer)->_y;
+ const int hy = _G(hammer)->_y;
for (rep = 7; rep < 15; rep++) {
if (!_G(actor[rep])._active)
continue;
@@ -314,8 +314,7 @@ static int boss2MovementShake(Actor *actor) {
if (overlap(hx + 1, hy + 1, hx + 10, hy + 10, _G(actor[rep])._x, _G(actor[rep])._y,
_G(actor[rep])._x + _G(actor[rep])._sizeX - 1, _G(actor[rep])._y + _G(actor[rep])._sizeY - 1)) {
_G(hammer)->_moveType = 5;
- int d = reverse_direction(_G(hammer));
- _G(hammer)->_dir = d;
+ _G(hammer)->_dir = reverseDirection(_G(hammer));
break;
}
}
@@ -355,7 +354,7 @@ static int boss2MovementShake(Actor *actor) {
actor->_i2 = 0;
Common::fill(su, su + 18, 0);
- actor_always_shoots(&_G(actor[4]), 1);
+ actorAlwaysShoots(&_G(actor[4]), 1);
an = _G(actor[4])._shotActor;
hx = (_G(thor)->_x / 16);
_G(actor[an])._x = _G(thor)->_x; //hx*16;
@@ -370,7 +369,7 @@ static int boss2MovementShake(Actor *actor) {
break;
}
su[hx] = 1;
- actor_always_shoots(&_G(actor[4]), 1);
+ actorAlwaysShoots(&_G(actor[4]), 1);
an = _G(actor[4])._shotActor;
_G(actor[an])._nextFrame = g_events->getRandomNumber(3);
_G(actor[an])._x = 16 + hx * 16;
diff --git a/engines/got/game/boss3.cpp b/engines/got/game/boss3.cpp
index 5065bc7d0e2..0cca557e830 100644
--- a/engines/got/game/boss3.cpp
+++ b/engines/got/game/boss3.cpp
@@ -134,7 +134,7 @@ static int boss3Movement1(Actor *actor) {
if (_G(actor[19 + i])._active)
goto done1;
- while (1) {
+ while (true) {
rx = g_events->getRandomNumber(255) + 16;
ry = g_events->getRandomNumber(143);
if (!overlap(rx, ry, rx + 32, ry + 32, _G(thor_x1), _G(thor_y1),
@@ -184,7 +184,7 @@ static int boss3Movement1(Actor *actor) {
if (!actor->_temp5) {
if (_G(actor[4])._currNumShots < _G(actor[4])._numShotsAllowed) {
- actor_always_shoots(&_G(actor[4]), 0);
+ actorAlwaysShoots(&_G(actor[4]), 0);
const byte shot_actor = _G(actor[4])._shotActor;
_G(actor[shot_actor])._numMoves = podSpeed;
_G(actor[shot_actor])._x = actor->_x + 8;
@@ -245,6 +245,8 @@ int boss3Movement(Actor *actor) {
actor->_numMoves = 5;
actor->_speed = 2;
break;
+ default:
+ break;
}
int d = actor->_lastDir;
@@ -272,7 +274,7 @@ int boss3Movement(Actor *actor) {
goto new_dir;
if (overlap(actor->_x + 2, actor->_y + 8, actor->_x + 30, actor->_y + 30, _G(thor)->_x, _G(thor)->_y + 4, _G(thor)->_x + 15, _G(thor)->_y + 15))
- thor_damaged(actor);
+ thorDamaged(actor);
ox = actor->_x;
oy = actor->_y;
@@ -280,51 +282,51 @@ int boss3Movement(Actor *actor) {
case 0:
x1 = _G(actor[3])._x;
y1 = _G(actor[3])._y - 2;
- if (!check_move2(x1, y1, &_G(actor[3]))) {
+ if (!checkMove2(x1, y1, &_G(actor[3]))) {
f = 1;
break;
}
- if (!check_move2(x1 + 16, y1, &_G(actor[4])))
+ if (!checkMove2(x1 + 16, y1, &_G(actor[4])))
f = 1;
actor->_y = oy - 2;
break;
case 1:
x1 = _G(actor[5])._x;
y1 = _G(actor[5])._y + 2;
- if (!check_move2(x1, y1, &_G(actor[5]))) {
+ if (!checkMove2(x1, y1, &_G(actor[5]))) {
f = 1;
break;
}
- if (!check_move2(x1 + 16, y1, &_G(actor[6])))
+ if (!checkMove2(x1 + 16, y1, &_G(actor[6])))
f = 1;
actor->_y = oy + 2;
break;
case 2:
x1 = _G(actor[3])._x - 2;
y1 = _G(actor[3])._y;
- if (!check_move2(x1, y1, &_G(actor[3]))) {
+ if (!checkMove2(x1, y1, &_G(actor[3]))) {
f = 1;
break;
}
- if (!check_move2(x1, y1 + 16, &_G(actor[5])))
+ if (!checkMove2(x1, y1 + 16, &_G(actor[5])))
f = 1;
actor->_x = ox - 2;
break;
case 3:
x1 = _G(actor[4])._x + 2;
y1 = _G(actor[4])._y;
- if (!check_move2(x1, y1, &_G(actor[4]))) {
+ if (!checkMove2(x1, y1, &_G(actor[4]))) {
f = 1;
break;
}
- if (!check_move2(x1, y1 + 16, &_G(actor[6])))
+ if (!checkMove2(x1, y1 + 16, &_G(actor[6])))
f = 1;
actor->_x = ox + 2;
break;
case 4: //ul
x1 = _G(actor[3])._x - 2;
y1 = _G(actor[3])._y - 2;
- if (!check_move2(x1, y1, &_G(actor[3]))) {
+ if (!checkMove2(x1, y1, &_G(actor[3]))) {
f = 1;
break;
}
@@ -334,7 +336,7 @@ int boss3Movement(Actor *actor) {
case 5:
x1 = _G(actor[4])._x + 2;
y1 = _G(actor[4])._y - 2;
- if (!check_move2(x1, y1, &_G(actor[4]))) {
+ if (!checkMove2(x1, y1, &_G(actor[4]))) {
f = 1;
break;
}
@@ -344,7 +346,7 @@ int boss3Movement(Actor *actor) {
case 6:
x1 = _G(actor[6])._x + 2;
y1 = _G(actor[6])._y + 2;
- if (!check_move2(x1, y1, &_G(actor[6]))) {
+ if (!checkMove2(x1, y1, &_G(actor[6]))) {
f = 1;
break;
}
@@ -354,7 +356,7 @@ int boss3Movement(Actor *actor) {
case 7:
x1 = _G(actor[5])._x - 2;
y1 = _G(actor[5])._y + 2;
- if (!check_move2(x1, y1, &_G(actor[5]))) {
+ if (!checkMove2(x1, y1, &_G(actor[5]))) {
f = 1;
break;
}
@@ -389,7 +391,7 @@ new_dir:
_G(actor[3])._nextFrame = 3;
_G(actor[4])._nextFrame = 3;
actor->_temp4 = 120;
- actor_always_shoots(actor, 0);
+ actorAlwaysShoots(actor, 0);
_G(actor[actor->_shotActor])._x = actor->_x + 8;
_G(actor[actor->_shotActor])._y = actor->_y - 8;
_G(actor[actor->_shotActor])._temp1 = g_events->getRandomNumber(90, 189);
@@ -416,7 +418,7 @@ static void boss3CheckHit() {
}
if (_G(actor[3])._magicHit || _G(actor[4])._magicHit || _G(actor[5])._magicHit || _G(actor[6])._magicHit) {
if (!_G(actor[3])._temp2) {
- actor_damaged(&_G(actor[3]), 10);
+ actorDamaged(&_G(actor[3]), 10);
if (_G(cheat) && _G(key_flag[_Z]))
_G(actor[3])._health -= 50;
@@ -438,7 +440,7 @@ static void boss3CheckHit() {
_G(boss_dead) = true;
for (int rep = 7; rep < MAX_ACTORS; rep++) {
if (_G(actor[rep])._active)
- actor_destroyed(&_G(actor[rep]));
+ actorDestroyed(&_G(actor[rep]));
}
}
@@ -493,12 +495,12 @@ void boss3SetupLevel() {
static int bossDie() {
if (_G(boss_dead)) {
for (int rep = 0; rep < 4; rep++) {
- int x1 = _G(actor[3 + rep])._lastX[_G(pge)];
- int y1 = _G(actor[3 + rep])._lastY[_G(pge)];
- int x = _G(actor[3 + rep])._x;
- int y = _G(actor[3 + rep])._y;
- int n = _G(actor[3 + rep])._actorNum;
- int r = _G(actor[3 + rep])._dropRating;
+ const int x1 = _G(actor[3 + rep])._lastX[_G(pge)];
+ const int y1 = _G(actor[3 + rep])._lastY[_G(pge)];
+ const int x = _G(actor[3 + rep])._x;
+ const int y = _G(actor[3 + rep])._y;
+ const int n = _G(actor[3 + rep])._actorNum;
+ const int r = _G(actor[3 + rep])._dropRating;
_G(actor[3 + rep]) = _G(explosion);
@@ -637,8 +639,8 @@ int endGameMovement() {
r = 0;
}
expf[_G(exprow)][r] = true;
- int x = (EXPLOSION[_G(exprow)][r] % 20) * 16;
- int y = (EXPLOSION[_G(exprow)][r] / 20) * 16;
+ const int x = (EXPLOSION[_G(exprow)][r] % 20) * 16;
+ const int y = (EXPLOSION[_G(exprow)][r] / 20) * 16;
_G(actor[34])._x = x;
_G(actor[34])._y = y;
_G(actor[34])._active = true;
diff --git a/engines/got/game/init.cpp b/engines/got/game/init.cpp
index 2d16698fd71..c2869e6150e 100644
--- a/engines/got/game/init.cpp
+++ b/engines/got/game/init.cpp
@@ -108,14 +108,14 @@ void initGame() {
showLevel(_G(current_level));
if (!_G(auto_load)) {
- _G(sound).music_play(_G(levelMusic), 1);
+ _G(sound).music_play(_G(levelMusic), true);
}
g_vars->resetEndgameFlags();
_G(startup) = false;
}
-int setupBoss(int num) {
+int setupBoss(const int num) {
if (_G(boss_loaded) == num)
return 1;
diff --git a/engines/got/game/move.cpp b/engines/got/game/move.cpp
index 0c3558a3da5..09f8d6bd4e7 100644
--- a/engines/got/game/move.cpp
+++ b/engines/got/game/move.cpp
@@ -30,21 +30,21 @@
namespace Got {
-void nextFrame(Actor *actr) {
- const int fcount = actr->_frameCount - 1;
+void nextFrame(Actor *actor) {
+ const int fcount = actor->_frameCount - 1;
if (fcount <= 0) {
- actr->_nextFrame++;
+ actor->_nextFrame++;
- if (actr->_nextFrame > 3)
- actr->_nextFrame = 0;
+ if (actor->_nextFrame > 3)
+ actor->_nextFrame = 0;
- actr->_frameCount = actr->_frameSpeed;
+ actor->_frameCount = actor->_frameSpeed;
} else
- actr->_frameCount = fcount;
+ actor->_frameCount = fcount;
}
-bool point_within(int x, int y, int x1, int y1, int x2, int y2) {
+bool pointWithin(int x, int y, int x1, int y1, int x2, int y2) {
return ((x >= x1) && (x <= x2) && (y >= y1) && (y <= y2));
}
@@ -68,17 +68,17 @@ bool overlap(int x1, int y1, int x2, int y2, int x3, int y3, int x4, int y4) {
return false;
}
-int reverse_direction(Actor *actr) {
- if (actr->_dir == 1)
+int reverseDirection(Actor *actor) {
+ if (actor->_dir == 1)
return 0;
- if (actr->_dir == 2)
+ if (actor->_dir == 2)
return 3;
- if (actr->_dir == 3)
+ if (actor->_dir == 3)
return 2;
return 1;
}
-void thor_shoots() {
+void thorShoots() {
if (!_G(hammer)->_active && (!_G(hammer)->_dead) && (!_G(thor)->_shotCountdown)) {
play_sound(SWISH, false);
_G(thor)->_shotCountdown = 20;
@@ -96,7 +96,7 @@ void thor_shoots() {
}
}
-int kill_good_guy(void) {
+int killGoodGuy() {
if (!_G(killgg_inform) && !_G(thunder_flag)) {
odinSpeaks(2010, 0);
_G(killgg_inform) = true;
@@ -106,62 +106,62 @@ int kill_good_guy(void) {
return 0;
}
-void actor_damaged(Actor *actr, int damage) {
+void actorDamaged(Actor *actor, int damage) {
if (!_G(setup)._difficultyLevel)
damage *= 2;
else if (_G(setup)._difficultyLevel == 2)
damage /= 2;
- if (!actr->_vulnerableCountdown && actr->_type != 3 && (actr->_solid & 0x7f) != 2) {
- actr->_vulnerableCountdown = STAMINA;
- if (damage >= actr->_health) {
- if (actr->_type != 4) {
- add_score(actr->_initHealth * 10);
+ if (!actor->_vulnerableCountdown && actor->_type != 3 && (actor->_solid & 0x7f) != 2) {
+ actor->_vulnerableCountdown = STAMINA;
+ if (damage >= actor->_health) {
+ if (actor->_type != 4) {
+ add_score(actor->_initHealth * 10);
} else {
- kill_good_guy();
+ killGoodGuy();
}
- actor_destroyed(actr);
+ actorDestroyed(actor);
} else {
- actr->_show = 10;
- actr->_health -= damage;
- actr->_moveCountdown += 8;
+ actor->_show = 10;
+ actor->_health -= damage;
+ actor->_moveCountdown += 8;
}
- } else if (!actr->_vulnerableCountdown) {
- actr->_vulnerableCountdown = STAMINA;
+ } else if (!actor->_vulnerableCountdown) {
+ actor->_vulnerableCountdown = STAMINA;
- if (actr->_funcNum == 4) {
+ if (actor->_funcNum == 4) {
switchIcons();
}
- if (actr->_funcNum == 7) {
+ if (actor->_funcNum == 7) {
rotateArrows();
}
}
}
-void thor_damaged(Actor *actr) {
- actr->_hitThor = true;
+void thorDamaged(Actor *actor) {
+ actor->_hitThor = true;
// If we're invincible, ignore any damage
if (_G(cheats).freezeHealth)
return;
- if (GAME3 && actr->_funcNum == 11) {
- if (actr->_talkCounter) {
- actr->_talkCounter--;
+ if (GAME3 && actor->_funcNum == 11) {
+ if (actor->_talkCounter) {
+ actor->_talkCounter--;
return;
}
- int t = actr->_type;
- actr->_type = 4;
- actorSpeaks(actr, 0, 0);
- actr->_type = t;
- actr->_talkCounter = 30;
+ const int currType = actor->_type;
+ actor->_type = 4;
+ actorSpeaks(actor, 0, 0);
+ actor->_type = currType;
+ actor->_talkCounter = 30;
return;
}
- int damage = actr->_hitStrength;
+ int damage = actor->_hitStrength;
if (damage != 255) {
if (!_G(setup)._difficultyLevel)
damage /= 2;
@@ -177,66 +177,66 @@ void thor_damaged(Actor *actr) {
g_events->send(GameMessage("THOR_DIES"));
} else if (damage) {
_G(thor)->_vulnerableCountdown = 40;
- _G(sound).play_sound(OW, 0);
+ _G(sound).play_sound(OW, false);
_G(thor)->_show = 10;
_G(thor)->_health -= damage;
}
}
}
-void actor_destroyed(Actor *actr) {
- if (actr->_actorNum > 2) {
- int pge = _G(pge);
+void actorDestroyed(Actor *actor) {
+ if (actor->_actorNum > 2) {
+ const int curPage = _G(pge);
- int x = actr->_lastX[pge ^ 1];
- int y = actr->_lastY[pge ^ 1];
- int x1 = actr->_lastX[pge];
- int y1 = actr->_lastY[pge];
- int r = actr->_dropRating;
- int n = actr->_actorNum;
- int t = actr->_type;
+ const int x = actor->_lastX[curPage ^ 1];
+ const int y = actor->_lastY[curPage ^ 1];
+ const int x1 = actor->_lastX[curPage];
+ const int y1 = actor->_lastY[curPage];
+ const int r = actor->_dropRating;
+ const int n = actor->_actorNum;
+ const int t = actor->_type;
- if (actr->_funcNum == 255)
- actr->copyFixedAndPics(_G(explosion));
+ if (actor->_funcNum == 255)
+ actor->copyFixedAndPics(_G(explosion));
else
- actr->copyFixedAndPics(_G(sparkle));
-
- actr->_type = t;
- actr->_actorNum = n;
- actr->_dropRating = r;
- actr->_x = x;
- actr->_y = y;
- actr->_lastX[pge] = x1;
- actr->_lastX[pge ^ 1] = x;
- actr->_lastY[pge] = y1;
- actr->_lastY[pge ^ 1] = y;
- actr->_moveCountdown = actr->_speed;
- actr->_active = true;
- actr->_currNumShots = 3; // used to reverse explosion
- actr->_vulnerableCountdown = 255;
+ actor->copyFixedAndPics(_G(sparkle));
+
+ actor->_type = t;
+ actor->_actorNum = n;
+ actor->_dropRating = r;
+ actor->_x = x;
+ actor->_y = y;
+ actor->_lastX[curPage] = x1;
+ actor->_lastX[curPage ^ 1] = x;
+ actor->_lastY[curPage] = y1;
+ actor->_lastY[curPage ^ 1] = y;
+ actor->_moveCountdown = actor->_speed;
+ actor->_active = true;
+ actor->_currNumShots = 3; // used to reverse explosion
+ actor->_vulnerableCountdown = 255;
} else {
- actr->_dead = 2;
- actr->_active = false;
+ actor->_dead = 2;
+ actor->_active = false;
}
}
-int _actor_shoots(Actor *actr, int dir) {
- int t = actr->_shotType - 1;
+int _actor_shoots(Actor *actor, int dir) {
+ const int t = actor->_shotType - 1;
for (int i = MAX_ENEMIES + 3; i < MAX_ACTORS; i++) {
if ((!_G(actor[i])._active) && (!_G(actor[i])._dead)) {
Actor *act = &_G(actor[i]);
*act = _G(shot[t]);
int cx, cy;
- if (actr->_sizeY < act->_sizeY)
- cy = actr->_y - ((act->_sizeY - actr->_sizeY) / 2);
+ if (actor->_sizeY < act->_sizeY)
+ cy = actor->_y - ((act->_sizeY - actor->_sizeY) / 2);
else
- cy = actr->_y + ((actr->_sizeY - act->_sizeY) / 2);
+ cy = actor->_y + ((actor->_sizeY - act->_sizeY) / 2);
- if (actr->_sizeX < act->_sizeX)
- cx = actr->_x - ((act->_sizeX - actr->_sizeX) / 2);
+ if (actor->_sizeX < act->_sizeX)
+ cx = actor->_x - ((act->_sizeX - actor->_sizeX) / 2);
else
- cx = actr->_x + ((actr->_sizeX - act->_sizeX) / 2);
+ cx = actor->_x + ((actor->_sizeX - act->_sizeX) / 2);
if (cy > 174)
cy = 174;
@@ -259,17 +259,17 @@ int _actor_shoots(Actor *actr, int dir) {
act->_moveCountdown = act->_speed;
act->_lastX[0] = cx;
act->_lastX[1] = cx;
- act->_lastX[0] = actr->_x;
- act->_lastX[1] = actr->_x;
+ act->_lastX[0] = actor->_x;
+ act->_lastX[1] = actor->_x;
act->_lastY[0] = cy;
act->_lastY[1] = cy;
act->_active = true;
- act->_creator = actr->_actorNum;
+ act->_creator = actor->_actorNum;
act->_moveCount = act->_numMoves;
act->_dead = 0;
- actr->_shotActor = i;
- actr->_currNumShots++;
- actr->_shotCountdown = 20;
+ actor->_shotActor = i;
+ actor->_currNumShots++;
+ actor->_shotCountdown = 20;
_G(shot_ok) = false;
return 1;
}
@@ -277,103 +277,108 @@ int _actor_shoots(Actor *actr, int dir) {
return 0;
}
-void actor_always_shoots(Actor *actr, int dir) {
- _actor_shoots(actr, dir);
+void actorAlwaysShoots(Actor *actor, int dir) {
+ _actor_shoots(actor, dir);
}
-int actor_shoots(Actor *actr, int dir) {
- int i;
+int actorShoots(Actor *actor, int dir) {
+ const int cx = (actor->_x + (actor->_sizeX / 2)) >> 4;
+ const int cy = ((actor->_y + actor->_sizeY) - 2) >> 4;
- int cx = (actr->_x + (actr->_sizeX / 2)) >> 4;
- int cy = ((actr->_y + actr->_sizeY) - 2) >> 4;
-
- int tx = _G(thor)->_centerX;
- int ty = _G(thor)->_centerY;
+ const int tx = _G(thor)->_centerX;
+ const int ty = _G(thor)->_centerY;
int icn = 140;
- if (_G(shot[actr->_shotType - 1])._flying)
+ if (_G(shot[actor->_shotType - 1])._flying)
icn = 80;
switch (dir) {
case 0:
- for (i = ty + 1; i <= cy; i++) {
+ for (int i = ty + 1; i <= cy; i++) {
if (_G(scrn)._iconGrid[i][cx] < icn)
return 0;
}
break;
+
case 1:
- for (i = cy; i <= ty; i++) {
+ for (int i = cy; i <= ty; i++) {
if (_G(scrn)._iconGrid[i][cx] < icn)
return 0;
}
break;
+
case 2:
- for (i = tx; i < cx; i++) {
+ for (int i = tx; i < cx; i++) {
if (_G(scrn)._iconGrid[cy][i] < icn)
return 0;
}
break;
+
case 3:
- for (i = cx; i < tx; i++) {
+ for (int i = cx; i < tx; i++) {
if (_G(scrn)._iconGrid[cy][i] < icn)
return 0;
}
break;
+
+ default:
+ break;
}
- return _actor_shoots(actr, dir);
+
+ return _actor_shoots(actor, dir);
}
-void move_actor(Actor *actr) {
- if (actr->_vulnerableCountdown != 0)
- actr->_vulnerableCountdown--;
- if (actr->_shotCountdown != 0)
- actr->_shotCountdown--;
- if (actr->_show != 0)
- actr->_show--;
-
- if (!actr->_shotCountdown && _G(shot_ok)) {
- if (actr->_numShotsAllowed) {
- if (actr->_currNumShots < actr->_numShotsAllowed) {
- shot_pattern_func[actr->_shotPattern](actr);
+void moveActor(Actor *actor) {
+ if (actor->_vulnerableCountdown != 0)
+ actor->_vulnerableCountdown--;
+ if (actor->_shotCountdown != 0)
+ actor->_shotCountdown--;
+ if (actor->_show != 0)
+ actor->_show--;
+
+ if (!actor->_shotCountdown && _G(shot_ok)) {
+ if (actor->_numShotsAllowed) {
+ if (actor->_currNumShots < actor->_numShotsAllowed) {
+ shot_pattern_func[actor->_shotPattern](actor);
}
}
}
- const int scount = actr->_moveCountdown - 1;
+ const int scount = actor->_moveCountdown - 1;
if (scount <= 0) {
- if (!actr->_moveCounter)
- actr->_moveCountdown = actr->_speed;
+ if (!actor->_moveCounter)
+ actor->_moveCountdown = actor->_speed;
else
- actr->_moveCountdown = (actr->_speed << 1);
+ actor->_moveCountdown = (actor->_speed << 1);
int i;
- if (actr->_type == 3)
- i = shot_movement_func[actr->_moveType](actr);
+ if (actor->_type == 3)
+ i = shot_movement_func[actor->_moveType](actor);
else
- i = movement_func[actr->_moveType](actr);
+ i = _movementFunc[actor->_moveType](actor);
- if (actr->_directions == 2)
+ if (actor->_directions == 2)
i &= 1;
- if (i != actr->_dir)
- actr->_dir = i;
+ if (i != actor->_dir)
+ actor->_dir = i;
- if (actr->_moveType == 0 && _G(current_level) != _G(new_level) && _G(shield_on)) {
- _G(actor[2])._x = actr->_x - 2;
+ if (actor->_moveType == 0 && _G(current_level) != _G(new_level) && _G(shield_on)) {
+ _G(actor[2])._x = actor->_x - 2;
if (_G(actor[2])._x < 0)
_G(actor[2])._x = 0;
- _G(actor[2])._y = actr->_y;
+ _G(actor[2])._y = actor->_y;
_G(actor[2])._lastX[0] = _G(actor[2])._x;
_G(actor[2])._lastX[1] = _G(actor[2])._x;
_G(actor[2])._lastY[0] = _G(actor[2])._y;
_G(actor[2])._lastY[1] = _G(actor[2])._y;
}
} else
- actr->_moveCountdown = scount;
+ actor->_moveCountdown = scount;
- actr->_x &= 0xfffe;
+ actor->_x &= 0xfffe;
}
} // namespace Got
diff --git a/engines/got/game/move.h b/engines/got/game/move.h
index ed5d1474a9c..e86fe4910e1 100644
--- a/engines/got/game/move.h
+++ b/engines/got/game/move.h
@@ -26,17 +26,17 @@
namespace Got {
-extern void nextFrame(Actor *actr);
-extern bool point_within(int x, int y, int x1, int y1, int x2, int y2);
+extern void nextFrame(Actor *actor);
+extern bool pointWithin(int x, int y, int x1, int y1, int x2, int y2);
extern bool overlap(int x1, int y1, int x2, int y2, int x3, int y3, int x4, int y4);
-extern int reverse_direction(Actor *actr);
-extern void thor_shoots();
-extern void thor_damaged(Actor *actr);
-extern void actor_destroyed(Actor *actr);
-extern int actor_shoots(Actor *actr, int dir);
-extern void actor_always_shoots(Actor *actr, int dir);
-extern void actor_damaged(Actor *actr, int damage);
-extern void move_actor(Actor *actr);
+extern int reverseDirection(Actor *actor);
+extern void thorShoots();
+extern void thorDamaged(Actor *actor);
+extern void actorDestroyed(Actor *actor);
+extern int actorShoots(Actor *actor, int dir);
+extern void actorAlwaysShoots(Actor *actor, int dir);
+extern void actorDamaged(Actor *actor, int damage);
+extern void moveActor(Actor *actor);
} // namespace Got
diff --git a/engines/got/game/move_patterns.cpp b/engines/got/game/move_patterns.cpp
index a4c81061ebc..6d578c4b090 100644
--- a/engines/got/game/move_patterns.cpp
+++ b/engines/got/game/move_patterns.cpp
@@ -37,127 +37,124 @@ namespace Got {
#define TILE_FLY 140
#define TILE_SPECIAL 200
-int check_special_move1(int x, int y, Actor *actr);
-
-int check_move0(int x, int y, Actor *actr);
-int check_move1(int x, int y, Actor *actr);
-//int check_move2(int x, int y, Actor *actr);
-//int check_move3(int x, int y, Actor *actr);
-//int check_move4(int x, int y, Actor *actr);
-
-int movement_zero(Actor *actr);
-int movement_one(Actor *actr);
-int movement_two(Actor *actr);
-int movement_three(Actor *actr);
-int movement_four(Actor *actr);
-int movement_five(Actor *actr);
-int movement_six(Actor *actr);
-int movement_seven(Actor *actr);
-int movement_eight(Actor *actr);
-int movement_nine(Actor *actr);
-int movement_ten(Actor *actr);
-int movement_eleven(Actor *actr);
-int movement_twelve(Actor *actr); // Horz straight until bump
-int movement_thirteen(Actor *actr); // Pause-seek (mushroom)
-int movement_fourteen(Actor *actr); // Move-bump-stop (boulder)
-int movement_fifteen(Actor *actr); // No move, no frame cycle
-int movement_sixteen(Actor *actr); // Tornado 1
-int movement_seventeen(Actor *actr); // Tornado 2
-int movement_eighteen(Actor *actr); // Random-seek-bite-run
-int movement_nineteen(Actor *actr); // Tornado 2
-int movement_twenty(Actor *actr); // Tornado 2
-int movement_twentyone(Actor *actr); // Eyeball
-int movement_twentytwo(Actor *actr); // Spear
-int movement_twentythree(Actor *actr); // Spinball cw
-int movement_twentyfour(Actor *actr); // Spinball ccw
-int movement_twentyfive(Actor *actr); //
-int movement_twentysix(Actor *actr); //
-int movement_twentyseven(Actor *actr); //
-int movement_twentyeight(Actor *actr); // Tree boss
-int movement_twentynine(Actor *actr); // Horz or vert (pass_val)
-int movement_thirty(Actor *actr); // Vert straight
-int movement_thirtyone(Actor *actr); // Drop (stalagtite)
-int movement_thirtytwo(Actor *actr); // Bomb 1
-int movement_thirtythree(Actor *actr); // Bomb 2
-int movement_thirtyfour(Actor *actr); // Gun (4-dir)
-int movement_thirtyfive(Actor *actr); // Gun (4-dir)
-int movement_thirtysix(Actor *actr); // Acid drop
-int movement_thirtyseven(Actor *actr); // 4-way rnd,rnd len
-int movement_thirtyeight(Actor *actr); // Timed darting
-int movement_thirtynine(Actor *actr); // Troll 1
-int movement_forty(Actor *actr); // Troll 2
-
-int (*const movement_func[])(Actor *actr) = {
- movement_zero,
- movement_one,
- movement_two,
- movement_three,
- movement_four,
- movement_five,
- movement_six,
- movement_seven,
- movement_eight,
- movement_nine,
- movement_ten,
- movement_eleven,
- movement_twelve,
- movement_thirteen,
- movement_fourteen,
- movement_fifteen,
- movement_sixteen,
- movement_seventeen,
- movement_eighteen,
- movement_nineteen,
- movement_twenty,
- movement_twentyone,
- movement_twentytwo,
- movement_twentythree,
- movement_twentyfour,
- movement_twentyfive,
- movement_twentysix,
- movement_twentyseven,
- movement_twentyeight,
- movement_twentynine,
- movement_thirty,
- movement_thirtyone,
- movement_thirtytwo,
- movement_thirtythree,
- movement_thirtyfour,
- movement_thirtyfive,
- movement_thirtysix,
- movement_thirtyseven,
- movement_thirtyeight,
- movement_thirtynine,
- movement_forty};
-
-int special_movement_one(Actor *actr);
-int special_movement_two(Actor *actr);
-int special_movement_three(Actor *actr);
-int special_movement_four(Actor *actr);
-int special_movement_five(Actor *actr);
-int special_movement_six(Actor *actr);
-int special_movement_seven(Actor *actr);
-int special_movement_eight(Actor *actr);
-int special_movement_nine(Actor *actr);
-int special_movement_ten(Actor *actr);
-int special_movement_eleven(Actor *actr);
-
-int (*special_movement_func[])(Actor *actr) = {
+int checkSpecialMove1(int x, int y, Actor *actor);
+
+int checkMove0(int x, int y, Actor *actor);
+int checkMove1(int x, int y, Actor *actor);
+
+int movementZero(Actor *actor);
+int movementOne(Actor *actor);
+int movementTwo(Actor *actor);
+int movementThree(Actor *actor);
+int movementFour(Actor *actor);
+int movementFive(Actor *actor);
+int movementSix(Actor *actor);
+int movementSeven(Actor *actor);
+int movementEight(Actor *actor);
+int movementNine(Actor *actor);
+int movementTen(Actor *actor);
+int movementEleven(Actor *actor);
+int movementTwelve(Actor *actor); // Horizontal straight until bump
+int movementThirteen(Actor *actor); // Pause-seek (mushroom)
+int movementFourteen(Actor *actor); // Move-bump-stop (boulder)
+int movementFifteen(Actor *actor); // No move, no frame cycle
+int movementSixteen(Actor *actor); // Tornado 1
+int movementSeventeen(Actor *actor); // Tornado 2
+int movementEighteen(Actor *actor); // Random-seek-bite-run
+int movementNineteen(Actor *actor); // Tornado 2
+int movementTwenty(Actor *actor); // Tornado 2
+int movementTwentyOne(Actor *actor); // Eyeball
+int movementTwentyTwo(Actor *actor); // Spear
+int movementTwentyThree(Actor *actor); // Spinball cw
+int movementTwentyFour(Actor *actor); // Spinball ccw
+int movementTwentyFive(Actor *actor); //
+int movementTwentySix(Actor *actor); //
+int movementTwentySeven(Actor *actor); //
+int movementTwentyEight(Actor *actor); // Tree boss
+int movementTwentyNine(Actor *actor); // Horizontal or vertical (pass_val)
+int movementThirty(Actor *actor); // Vertical straight
+int movementThirtyOne(Actor *actor); // Drop (stalagtite)
+int movementThirtyTwo(Actor *actor); // Bomb 1
+int movementThirtyThree(Actor *actor); // Bomb 2
+int movementThirtyFour(Actor *actor); // Gun (4-dir)
+int movementThirtyFive(Actor *actor); // Gun (4-dir)
+int movementThirtySix(Actor *actor); // Acid drop
+int movementThirtySeven(Actor *actor); // 4-way rnd,rnd len
+int movementThirtyEight(Actor *actor); // Timed darting
+int movementThirtyNine(Actor *actor); // Troll 1
+int movementForty(Actor *actor); // Troll 2
+
+int (*const _movementFunc[])(Actor *actor) = {
+ movementZero,
+ movementOne,
+ movementTwo,
+ movementThree,
+ movementFour,
+ movementFive,
+ movementSix,
+ movementSeven,
+ movementEight,
+ movementNine,
+ movementTen,
+ movementEleven,
+ movementTwelve,
+ movementThirteen,
+ movementFourteen,
+ movementFifteen,
+ movementSixteen,
+ movementSeventeen,
+ movementEighteen,
+ movementNineteen,
+ movementTwenty,
+ movementTwentyOne,
+ movementTwentyTwo,
+ movementTwentyThree,
+ movementTwentyFour,
+ movementTwentyFive,
+ movementTwentySix,
+ movementTwentySeven,
+ movementTwentyEight,
+ movementTwentyNine,
+ movementThirty,
+ movementThirtyOne,
+ movementThirtyTwo,
+ movementThirtyThree,
+ movementThirtyFour,
+ movementThirtyFive,
+ movementThirtySix,
+ movementThirtySeven,
+ movementThirtyEight,
+ movementThirtyNine,
+ movementForty};
+
+int specialMovementOne(Actor *actor);
+int specialMovementTwo(Actor *actor);
+int specialMovementThree(Actor *actor);
+int specialMovementFour(Actor *actor);
+int specialMovementFive(Actor *actor);
+int specialMovementSix(Actor *actor);
+int specialMovementSeven(Actor *actor);
+int specialMovementEight(Actor *actor);
+int specialMovementNine(Actor *actor);
+int specialMovementTen(Actor *actor);
+int specialMovementEleven(Actor *actor);
+
+int (*specialMovementFunc[])(Actor *actor) = {
nullptr,
- special_movement_one,
- special_movement_two,
- special_movement_three,
- special_movement_four,
- special_movement_five,
- special_movement_six,
- special_movement_seven,
- special_movement_eight,
- special_movement_nine,
- special_movement_ten,
- special_movement_eleven};
+ specialMovementOne,
+ specialMovementTwo,
+ specialMovementThree,
+ specialMovementFour,
+ specialMovementFive,
+ specialMovementSix,
+ specialMovementSeven,
+ specialMovementEight,
+ specialMovementNine,
+ specialMovementTen,
+ specialMovementEleven};
// Check Thor move
-int check_move0(int x, int y, Actor *actr) {
+int checkMove0(const int x, const int y, Actor *actor) {
_G(thor_icon1) = 0;
_G(thor_icon2) = 0;
_G(thor_icon3) = 0;
@@ -166,12 +163,12 @@ int check_move0(int x, int y, Actor *actr) {
if (x < 0) {
if (_G(current_level) > 0) {
_G(new_level) = _G(current_level) - 1;
- actr->_x = 304;
- actr->_lastX[0] = 304;
- actr->_lastX[1] = 304;
- actr->_show = 0;
- actr->_moveCount = 0;
- set_thor_vars();
+ actor->_x = 304;
+ actor->_lastX[0] = 304;
+ actor->_lastX[1] = 304;
+ actor->_show = 0;
+ actor->_moveCount = 0;
+ setThorVars();
return 1;
}
@@ -181,12 +178,12 @@ int check_move0(int x, int y, Actor *actr) {
if (x > 306) {
if (_G(current_level) < 119) {
_G(new_level) = _G(current_level) + 1;
- actr->_x = 0;
- actr->_lastX[0] = 0;
- actr->_lastX[1] = 0;
- actr->_show = 0;
- actr->_moveCount = 0;
- set_thor_vars();
+ actor->_x = 0;
+ actor->_lastX[0] = 0;
+ actor->_lastX[1] = 0;
+ actor->_show = 0;
+ actor->_moveCount = 0;
+ setThorVars();
return 1;
}
@@ -196,12 +193,12 @@ int check_move0(int x, int y, Actor *actr) {
if (y < 0) {
if (_G(current_level) > 9) {
_G(new_level) = _G(current_level) - 10;
- actr->_y = 175;
- actr->_lastY[0] = 175;
- actr->_show = 0;
- actr->_lastY[1] = 175;
- actr->_moveCount = 0;
- set_thor_vars();
+ actor->_y = 175;
+ actor->_lastY[0] = 175;
+ actor->_show = 0;
+ actor->_lastY[1] = 175;
+ actor->_moveCount = 0;
+ setThorVars();
return 1;
}
@@ -211,12 +208,12 @@ int check_move0(int x, int y, Actor *actr) {
if (y > 175) {
if (_G(current_level) < 110) {
_G(new_level) = _G(current_level) + 10;
- actr->_y = 0;
- actr->_lastY[0] = 0;
- actr->_lastY[1] = 0;
- actr->_show = 0;
- actr->_moveCount = 0;
- set_thor_vars();
+ actor->_y = 0;
+ actor->_lastY[0] = 0;
+ actor->_lastY[1] = 0;
+ actor->_show = 0;
+ actor->_moveCount = 0;
+ setThorVars();
return 1;
}
@@ -231,7 +228,7 @@ int check_move0(int x, int y, Actor *actr) {
_G(slip_flag) = false;
// Check for cheat flying mode
- if (!actr->_flying) {
+ if (!actor->_flying) {
byte icn1 = _G(scrn)._iconGrid[y1][x1];
byte icn2 = _G(scrn)._iconGrid[y2][x1];
byte icn3 = _G(scrn)._iconGrid[y1][x2];
@@ -311,14 +308,14 @@ int check_move0(int x, int y, Actor *actr) {
if ((act->_solid & 128) || !act->_active)
continue;
- int x3 = act->_x + 1;
- int y3 = act->_y + 1;
+ const int x3 = act->_x + 1;
+ const int y3 = act->_y + 1;
if (ABS(x3 - x1) > 16 || ABS(y3 - y1) > 16)
continue;
-
- int x4 = act->_x + act->_sizeX - 1;
- int y4 = act->_y + act->_sizeY - 1;
+
+ const int x4 = act->_x + act->_sizeX - 1;
+ const int y4 = act->_y + act->_sizeY - 1;
if (overlap(x1, y1, x2, y2, x3, y3, x4, y4)) {
if (act->_funcNum > 0) { // 255=explosion
if (act->_funcNum == 255)
@@ -327,30 +324,30 @@ int check_move0(int x, int y, Actor *actr) {
act->_temp2 = y;
_G(thor_special_flag) = true;
- return special_movement_func[act->_funcNum](act);
+ return specialMovementFunc[act->_funcNum](act);
}
_G(thor_special_flag) = false;
- thor_damaged(act);
+ thorDamaged(act);
if (act->_solid < 2) {
if (!act->_vulnerableCountdown && (!(act->_type & 1)))
play_sound(PUNCH1, false);
if (!_G(hammer)->_active && _G(key_flag[key_fire]))
- actor_damaged(act, _G(hammer)->_hitStrength);
+ actorDamaged(act, _G(hammer)->_hitStrength);
else
- actor_damaged(act, _G(thor)->_hitStrength);
+ actorDamaged(act, _G(thor)->_hitStrength);
}
return 1;
}
}
- actr->_x = x;
- actr->_y = y;
+ actor->_x = x;
+ actor->_y = y;
return 1;
}
// Check hammer move
-int check_move1(int x, int y, Actor *actr) {
+int checkMove1(const int x, const int y, Actor *actor) {
if (x < 0 || x > 306 || y < 0 || y > 177)
return 0;
@@ -361,30 +358,30 @@ int check_move1(int x, int y, Actor *actr) {
// Check for solid or fly over
int icn = TILE_FLY;
- if (actr->_flying)
+ if (actor->_flying)
icn = TILE_SOLID;
- byte icn1 = _G(scrn)._iconGrid[y1][x1];
- byte icn2 = _G(scrn)._iconGrid[y2][x1];
- byte icn3 = _G(scrn)._iconGrid[y1][x2];
- byte icn4 = _G(scrn)._iconGrid[y2][x2];
+ const byte icn1 = _G(scrn)._iconGrid[y1][x1];
+ const byte icn2 = _G(scrn)._iconGrid[y2][x1];
+ const byte icn3 = _G(scrn)._iconGrid[y1][x2];
+ const byte icn4 = _G(scrn)._iconGrid[y2][x2];
if (icn1 < icn || icn2 < icn || icn3 < icn || icn4 < icn) {
- if (actr->_actorNum == 1 && actr->_moveType == 2)
+ if (actor->_actorNum == 1 && actor->_moveType == 2)
play_sound(CLANG, false);
return 0;
}
- if (icn1 > TILE_SPECIAL && !special_tile(actr, y1, x1, icn1))
+ if (icn1 > TILE_SPECIAL && !special_tile(actor, y1, x1, icn1))
return 0;
- if (icn2 > TILE_SPECIAL && !special_tile(actr, y2, x1, icn2))
+ if (icn2 > TILE_SPECIAL && !special_tile(actor, y2, x1, icn2))
return 0;
- if (icn3 > TILE_SPECIAL && !special_tile(actr, y1, x2, icn3))
+ if (icn3 > TILE_SPECIAL && !special_tile(actor, y1, x2, icn3))
return 0;
- if (icn4 > TILE_SPECIAL && !special_tile(actr, y2, x2, icn4))
+ if (icn4 > TILE_SPECIAL && !special_tile(actor, y2, x2, icn4))
return 0;
x1 = x + 1;
@@ -397,15 +394,15 @@ int check_move1(int x, int y, Actor *actr) {
Actor *act = &_G(actor[i]);
if (!act->_active || act->_type == 3)
continue;
-
- int x3 = act->_x;
- int y3 = act->_y;
+
+ const int x3 = act->_x;
+ const int y3 = act->_y;
if (ABS(x3 - x1) > 16 || ABS(y3 - y1) > 16)
continue;
-
- int x4 = act->_x + act->_sizeX - 1;
- int y4 = act->_y + act->_sizeY - 1;
+
+ const int x4 = act->_x + act->_sizeX - 1;
+ const int y4 = act->_y + act->_sizeY - 1;
if (overlap(x1, y1, x2, y2, x3, y3, x4, y4)) {
if (_G(boss_active) && !GAME3) {
@@ -421,93 +418,93 @@ int check_move1(int x, int y, Actor *actr) {
break;
}
} else {
- if (act->_solid == 2 && (actr->_moveType == 16 || actr->_moveType == 17))
+ if (act->_solid == 2 && (actor->_moveType == 16 || actor->_moveType == 17))
return 0;
- actor_damaged(act, actr->_hitStrength);
+ actorDamaged(act, actor->_hitStrength);
}
f++;
}
}
- if (f && actr->_moveType == 2)
+ if (f && actor->_moveType == 2)
return 0;
- actr->_x = x;
- actr->_y = y;
+ actor->_x = x;
+ actor->_y = y;
return 1;
}
// Check enemy move
-int check_move2(int x, int y, Actor *actr) {
- if (actr->_actorNum < 3)
- return check_move1(x, y, actr);
+int checkMove2(const int x, const int y, Actor *actor) {
+ if (actor->_actorNum < 3)
+ return checkMove1(x, y, actor);
- if (x < 0 || x > (319 - actr->_sizeX) || y < 0 || y > 175)
+ if (x < 0 || x > (319 - actor->_sizeX) || y < 0 || y > 175)
return 0;
int x1 = (x + 1) >> 4;
int y1;
- if (!actr->_funcNum)
- y1 = (y + (actr->_sizeY / 2)) >> 4;
+ if (!actor->_funcNum)
+ y1 = (y + (actor->_sizeY / 2)) >> 4;
else
y1 = (y + 1) >> 4;
- int x2 = ((x + actr->_sizeX) - 1) >> 4;
- int y2 = ((y + actr->_sizeY) - 1) >> 4;
+ int x2 = ((x + actor->_sizeX) - 1) >> 4;
+ int y2 = ((y + actor->_sizeY) - 1) >> 4;
// Check for solid or fly over
int icn = TILE_FLY;
- if (actr->_flying)
+ if (actor->_flying)
icn = TILE_SOLID;
- byte icn1 = _G(scrn)._iconGrid[y1][x1];
- byte icn2 = _G(scrn)._iconGrid[y2][x1];
- byte icn3 = _G(scrn)._iconGrid[y1][x2];
- byte icn4 = _G(scrn)._iconGrid[y2][x2];
+ const byte icn1 = _G(scrn)._iconGrid[y1][x1];
+ const byte icn2 = _G(scrn)._iconGrid[y2][x1];
+ const byte icn3 = _G(scrn)._iconGrid[y1][x2];
+ const byte icn4 = _G(scrn)._iconGrid[y2][x2];
if (icn1 < icn || icn2 < icn || icn3 < icn || icn4 < icn)
return 0;
if (icn1 > TILE_SPECIAL)
- if (!special_tile(actr, y1, x1, icn1))
+ if (!special_tile(actor, y1, x1, icn1))
return 0;
if (icn2 > TILE_SPECIAL)
- if (!special_tile(actr, y2, x1, icn2))
+ if (!special_tile(actor, y2, x1, icn2))
return 0;
if (icn3 > TILE_SPECIAL)
- if (!special_tile(actr, y1, x2, icn3))
+ if (!special_tile(actor, y1, x2, icn3))
return 0;
if (icn4 > TILE_SPECIAL)
- if (!special_tile(actr, y2, x2, icn4))
+ if (!special_tile(actor, y2, x2, icn4))
return 0;
x1 = x + 1;
y1 = y + 1;
- x2 = (x + actr->_sizeX) - 1;
- y2 = (y + actr->_sizeY) - 1;
+ x2 = (x + actor->_sizeX) - 1;
+ y2 = (y + actor->_sizeY) - 1;
for (int i = 0; i < MAX_ACTORS; i++) {
Actor *act = &_G(actor[i]);
- if (act->_actorNum == actr->_actorNum || act->_actorNum == 1 || !act->_active)
+ if (act->_actorNum == actor->_actorNum || act->_actorNum == 1 || !act->_active)
continue;
if (act->_type == 3)
continue; // Shot
if (i == 0) {
if (overlap(x1, y1, x2, y2, _G(thor_x1), _G(thor_y1), _G(thor_x2), _G(thor_y2))) {
- thor_damaged(actr);
+ thorDamaged(actor);
return 0;
}
} else {
- int x3 = act->_x;
- int y3 = act->_y;
+ const int x3 = act->_x;
+ const int y3 = act->_y;
if (ABS(x3 - x1) > 16 || ABS(y3 - y1) > 16)
continue;
- int x4 = act->_x + act->_sizeX;
- int y4 = act->_y + act->_sizeY;
+ const int x4 = act->_x + act->_sizeX;
+ const int y4 = act->_y + act->_sizeY;
if (overlap(x1, y1, x2, y2, x3, y3, x4, y4)) {
- if (actr->_moveType == 38) {
+ if (actor->_moveType == 38) {
if (act->_funcNum == 4)
_G(switch_flag) = 1;
else if (act->_funcNum == 7)
@@ -517,55 +514,55 @@ int check_move2(int x, int y, Actor *actr) {
}
}
}
- actr->_x = x;
- actr->_y = y;
+ actor->_x = x;
+ actor->_y = y;
return 1;
}
// Check enemy shot move
-int check_move3(int x, int y, Actor *actr) {
- if (x < 0 || x > (319 - actr->_sizeX) || y < 0 || y > 175)
+int checkMove3(const int x, const int y, Actor *actor) {
+ if (x < 0 || x > (319 - actor->_sizeX) || y < 0 || y > 175)
return 0;
int x1 = (x + 1) >> 4;
- int y1 = (y + (actr->_sizeY / 2)) >> 4;
- int x2 = ((x + actr->_sizeX) - 1) >> 4;
- int y2 = ((y + actr->_sizeY) - 1) >> 4;
+ int y1 = (y + (actor->_sizeY / 2)) >> 4;
+ int x2 = ((x + actor->_sizeX) - 1) >> 4;
+ int y2 = ((y + actor->_sizeY) - 1) >> 4;
// Check for solid or fly over
int icn = TILE_FLY;
- if (actr->_flying)
+ if (actor->_flying)
icn = TILE_SOLID;
- byte icn1 = _G(scrn)._iconGrid[y1][x1];
- byte icn2 = _G(scrn)._iconGrid[y2][x1];
- byte icn3 = _G(scrn)._iconGrid[y1][x2];
- byte icn4 = _G(scrn)._iconGrid[y2][x2];
+ const byte icn1 = _G(scrn)._iconGrid[y1][x1];
+ const byte icn2 = _G(scrn)._iconGrid[y2][x1];
+ const byte icn3 = _G(scrn)._iconGrid[y1][x2];
+ const byte icn4 = _G(scrn)._iconGrid[y2][x2];
if (icn1 < icn || icn2 < icn || icn3 < icn || icn4 < icn)
return 0;
- if (icn1 > TILE_SPECIAL && !special_tile(actr, y1, x1, icn1))
+ if (icn1 > TILE_SPECIAL && !special_tile(actor, y1, x1, icn1))
return 0;
- if (icn2 > TILE_SPECIAL && !special_tile(actr, y2, x1, icn2))
+ if (icn2 > TILE_SPECIAL && !special_tile(actor, y2, x1, icn2))
return 0;
- if (icn3 > TILE_SPECIAL && !special_tile(actr, y1, x2, icn3))
+ if (icn3 > TILE_SPECIAL && !special_tile(actor, y1, x2, icn3))
return 0;
- if (icn4 > TILE_SPECIAL && !special_tile(actr, y2, x2, icn4))
+ if (icn4 > TILE_SPECIAL && !special_tile(actor, y2, x2, icn4))
return 0;
// Check for solid or fly over
x1 = x + 1;
y1 = y + 1;
- x2 = (x + actr->_sizeX) - 1;
- y2 = (y + actr->_sizeY) - 1;
+ x2 = (x + actor->_sizeX) - 1;
+ y2 = (y + actor->_sizeY) - 1;
if (overlap(x1, y1, x2, y2, _G(thor_x1), _G(thor_real_y1), _G(thor_x2), _G(thor_y2))) {
- thor_damaged(actr);
+ thorDamaged(actor);
return 0;
}
for (int i = 3; i < MAX_ACTORS; i++) {
- if (i == actr->_actorNum)
+ if (i == actor->_actorNum)
continue;
Actor *act = &_G(actor[i]);
@@ -576,126 +573,133 @@ int check_move3(int x, int y, Actor *actr) {
continue;
if (act->_type == 3)
continue; // Shot
- if (act->_actorNum == actr->_creator)
+ if (act->_actorNum == actor->_creator)
continue;
- int x3 = act->_x;
- int y3 = act->_y;
+ const int x3 = act->_x;
+ const int y3 = act->_y;
if (ABS(x3 - x1) > 16 || ABS(y3 - y1) > 16)
continue;
- int x4 = x3 + 15;
- int y4 = y3 + 15;
+ const int x4 = x3 + 15;
+ const int y4 = y3 + 15;
if (overlap(x1, y1, x2, y2, x3, y3, x4, y4))
return 0;
}
- actr->_x = x;
- actr->_y = y;
+ actor->_x = x;
+ actor->_y = y;
return 1;
}
// Flying enemies
-int check_move4(int x, int y, Actor *actr) {
- if (x < 0 || x > (319 - actr->_sizeX) || y < 0 || y > 175)
+int checkMove4(const int x, const int y, Actor *actor) {
+ if (x < 0 || x > (319 - actor->_sizeX) || y < 0 || y > 175)
return 0;
- if (overlap(x, y, x + actr->_sizeX - 1, y + actr->_sizeY - 1,
+ if (overlap(x, y, x + actor->_sizeX - 1, y + actor->_sizeY - 1,
_G(thor_x1), _G(thor_y1), _G(thor_x2), _G(thor_y2))) {
- if (actr->_type == 3)
- thor_damaged(actr);
+ if (actor->_type == 3)
+ thorDamaged(actor);
return 0;
}
- actr->_x = x;
- actr->_y = y;
+ actor->_x = x;
+ actor->_y = y;
return 1;
}
#define THOR_PAD1 2
#define THOR_PAD2 4
-int check_thor_move(int x, int y, Actor *actr) {
- if (check_move0(x, y, actr))
+int check_thor_move(const int x, const int y, Actor *actor) {
+ if (checkMove0(x, y, actor))
return 1;
+
if (_G(diag_flag) || _G(thor_special_flag))
return 0;
if (_G(thor_icon1) + _G(thor_icon2) + _G(thor_icon3) + _G(thor_icon4) > 1)
return 0;
- switch (actr->_dir) {
+ switch (actor->_dir) {
case 0:
if (_G(thor_icon1)) {
- actr->_dir = 3;
- if (check_move0(x + THOR_PAD1, y + 2, actr)) {
- actr->_dir = 0;
+ actor->_dir = 3;
+ if (checkMove0(x + THOR_PAD1, y + 2, actor)) {
+ actor->_dir = 0;
return 1;
}
} else if (_G(thor_icon3)) {
- actr->_dir = 2;
- if (check_move0(x - THOR_PAD1, y + 2, actr)) {
- actr->_dir = 0;
+ actor->_dir = 2;
+ if (checkMove0(x - THOR_PAD1, y + 2, actor)) {
+ actor->_dir = 0;
return 1;
}
}
- actr->_dir = 0;
+ actor->_dir = 0;
break;
+
case 1:
if (_G(thor_icon2)) {
- actr->_dir = 3;
- if (check_move0(x + THOR_PAD1, y - 2, actr)) {
- actr->_dir = 1;
+ actor->_dir = 3;
+ if (checkMove0(x + THOR_PAD1, y - 2, actor)) {
+ actor->_dir = 1;
return 1;
}
} else if (_G(thor_icon4)) {
- actr->_dir = 2;
- if (check_move0(x - THOR_PAD1, y - 2, actr)) {
- actr->_dir = 1;
+ actor->_dir = 2;
+ if (checkMove0(x - THOR_PAD1, y - 2, actor)) {
+ actor->_dir = 1;
return 1;
}
}
- actr->_dir = 1;
+ actor->_dir = 1;
break;
+
case 2:
if (_G(thor_icon1)) {
- if (check_move0(x + 2, y + THOR_PAD1, actr))
+ if (checkMove0(x + 2, y + THOR_PAD1, actor))
return 1;
} else if (_G(thor_icon2)) {
- if (check_move0(x + 2, y - THOR_PAD1, actr))
+ if (checkMove0(x + 2, y - THOR_PAD1, actor))
return 1;
}
break;
+
case 3:
if (_G(thor_icon3)) {
- if (check_move0(x - 2, y + THOR_PAD1, actr))
+ if (checkMove0(x - 2, y + THOR_PAD1, actor))
return 1;
} else if (_G(thor_icon4)) {
- if (check_move0(x - 2, y - THOR_PAD1, actr))
+ if (checkMove0(x - 2, y - THOR_PAD1, actor))
return 1;
}
break;
+
+ default:
+ break;
}
return 0;
}
// Player control
-int movement_zero(Actor *actr) {
- int d = actr->_dir;
- int od = d;
+int movementZero(Actor *actor) {
+ int d = actor->_dir;
+ const int oldDir = d;
- set_thor_vars();
+ setThorVars();
if (_G(hammer)->_active && _G(hammer)->_moveType == 5) {
if (overlap(_G(thor_x1), _G(thor_y1), _G(thor_x2), _G(thor_y2),
_G(hammer)->_x, _G(hammer)->_y, _G(hammer)->_x + 13, _G(hammer)->_y + 13)) {
- actor_destroyed(_G(hammer));
+ actorDestroyed(_G(hammer));
}
}
- int x = actr->_x;
- int y = actr->_y;
+ int x = actor->_x;
+ int y = actor->_y;
_G(diag_flag) = false;
- if (actr->_moveCounter)
- actr->_moveCounter--;
+ if (actor->_moveCounter)
+ actor->_moveCounter--;
if (_G(slipping)) {
if (_G(slip_cnt) == 8)
@@ -706,45 +710,45 @@ int movement_zero(Actor *actr) {
if (!_G(slip_cnt))
_G(slipping) = false;
- check_thor_move(x, y, actr);
+ check_thor_move(x, y, actor);
_G(thor)->_moveCountdown = 4;
return d;
}
if (_G(key_flag[key_up]) && _G(key_flag[key_left])) {
d = 2;
- actr->_dir = d;
+ actor->_dir = d;
_G(diag) = 1;
_G(diag_flag) = true;
- if (check_thor_move(x - 2, y - 2, actr)) {
- nextFrame(actr);
+ if (check_thor_move(x - 2, y - 2, actor)) {
+ nextFrame(actor);
return d;
}
} else if (_G(key_flag[key_up]) && _G(key_flag[key_right])) {
d = 3;
- actr->_dir = d;
+ actor->_dir = d;
_G(diag) = 2;
_G(diag_flag) = true;
- if (check_thor_move(x + 2, y - 2, actr)) {
- nextFrame(actr);
+ if (check_thor_move(x + 2, y - 2, actor)) {
+ nextFrame(actor);
return d;
}
} else if (_G(key_flag[key_down]) && _G(key_flag[key_left])) {
d = 2;
- actr->_dir = d;
+ actor->_dir = d;
_G(diag) = 4;
_G(diag_flag) = true;
- if (check_thor_move(x - 2, y + 2, actr)) {
- nextFrame(actr);
+ if (check_thor_move(x - 2, y + 2, actor)) {
+ nextFrame(actor);
return d;
}
} else if (_G(key_flag[key_down]) && _G(key_flag[key_right])) {
d = 3;
- actr->_dir = d;
+ actor->_dir = d;
_G(diag) = 3;
_G(diag_flag) = true;
- if (check_thor_move(x + 2, y + 2, actr)) {
- nextFrame(actr);
+ if (check_thor_move(x + 2, y + 2, actor)) {
+ nextFrame(actor);
return d;
}
}
@@ -752,9 +756,9 @@ int movement_zero(Actor *actr) {
if (_G(key_flag[key_right])) {
if (!_G(key_flag[key_left])) {
d = 3;
- actr->_dir = d;
- if (check_thor_move(x + 2, y, actr)) {
- nextFrame(actr);
+ actor->_dir = d;
+ if (check_thor_move(x + 2, y, actor)) {
+ nextFrame(actor);
return d;
}
}
@@ -762,9 +766,9 @@ int movement_zero(Actor *actr) {
if (_G(key_flag[key_left])) {
if (!_G(key_flag[key_right])) {
d = 2;
- actr->_dir = d;
- if (check_thor_move(x - 2, y, actr)) {
- nextFrame(actr);
+ actor->_dir = d;
+ if (check_thor_move(x - 2, y, actor)) {
+ nextFrame(actor);
return d;
}
}
@@ -772,9 +776,9 @@ int movement_zero(Actor *actr) {
if (_G(key_flag[key_down])) {
if (!_G(key_flag[key_up])) {
d = 1;
- actr->_dir = d;
- if (check_thor_move(x, y + 2, actr)) {
- nextFrame(actr);
+ actor->_dir = d;
+ if (check_thor_move(x, y + 2, actor)) {
+ nextFrame(actor);
return d;
}
}
@@ -782,27 +786,26 @@ int movement_zero(Actor *actr) {
if (_G(key_flag[key_up])) {
if (!_G(key_flag[key_down])) {
d = 0;
- actr->_dir = d;
- if (check_thor_move(x, y - 2, actr)) {
- nextFrame(actr);
+ actor->_dir = d;
+ if (check_thor_move(x, y - 2, actor)) {
+ nextFrame(actor);
return d;
}
}
}
- actr->_moveCounter = 5;
- actr->_nextFrame = 0;
- actr->_dir = od;
+ actor->_moveCounter = 5;
+ actor->_nextFrame = 0;
+ actor->_dir = oldDir;
return d;
}
-int check_special_move1(int x, int y, Actor *actr) {
- int i;
+int checkSpecialMove1(const int x, const int y, Actor *actor) {
int x3, y3, x4, y4;
Actor *act;
- if (actr->_actorNum < 3)
- return check_move1(x, y, actr);
+ if (actor->_actorNum < 3)
+ return checkMove1(x, y, actor);
if (x < 0 || x > 304 || y < 0 || y > 176)
return 0;
@@ -815,23 +818,23 @@ int check_special_move1(int x, int y, Actor *actr) {
// Check for solid or fly over
int icn = TILE_FLY;
- if (actr->_flying)
+ if (actor->_flying)
icn = TILE_SOLID;
- byte icn1 = _G(scrn)._iconGrid[y1][x1];
- byte icn2 = _G(scrn)._iconGrid[y2][x1];
- byte icn3 = _G(scrn)._iconGrid[y1][x2];
- byte icn4 = _G(scrn)._iconGrid[y2][x2];
+ const byte icn1 = _G(scrn)._iconGrid[y1][x1];
+ const byte icn2 = _G(scrn)._iconGrid[y2][x1];
+ const byte icn3 = _G(scrn)._iconGrid[y1][x2];
+ const byte icn4 = _G(scrn)._iconGrid[y2][x2];
if (icn1 < icn || icn2 < icn || icn3 < icn || icn4 < icn)
return 0;
- if (icn1 > TILE_SPECIAL && !special_tile(actr, y1, x1, icn1))
+ if (icn1 > TILE_SPECIAL && !special_tile(actor, y1, x1, icn1))
return 0;
- if (icn2 > TILE_SPECIAL && !special_tile(actr, y2, x1, icn2))
+ if (icn2 > TILE_SPECIAL && !special_tile(actor, y2, x1, icn2))
return 0;
- if (icn3 > TILE_SPECIAL && !special_tile(actr, y1, x2, icn3))
+ if (icn3 > TILE_SPECIAL && !special_tile(actor, y1, x2, icn3))
return 0;
- if (icn4 > TILE_SPECIAL && !special_tile(actr, y2, x2, icn4))
+ if (icn4 > TILE_SPECIAL && !special_tile(actor, y2, x2, icn4))
return 0;
x1 = x;
@@ -839,9 +842,9 @@ int check_special_move1(int x, int y, Actor *actr) {
x2 = (x + 15);
y2 = (y + 15);
- for (i = 3; i < MAX_ACTORS; i++) {
+ for (int i = 3; i < MAX_ACTORS; i++) {
act = &_G(actor[i]);
- if (act->_actorNum == actr->_actorNum)
+ if (act->_actorNum == actor->_actorNum)
continue;
if (!act->_active)
continue;
@@ -858,9 +861,9 @@ int check_special_move1(int x, int y, Actor *actr) {
if (overlap(x1, y1, x2, y2, x3, y3, x4, y4))
return 0;
}
- for (i = 3; i < MAX_ACTORS; i++) {
+ for (int i = 3; i < MAX_ACTORS; i++) {
act = &_G(actor[i]);
- if (act->_actorNum == actr->_actorNum)
+ if (act->_actorNum == actor->_actorNum)
continue;
if (!act->_active)
continue;
@@ -877,84 +880,90 @@ int check_special_move1(int x, int y, Actor *actr) {
if (overlap(_G(thor_x1), _G(thor_y1), _G(thor_x2), _G(thor_y2), x3, y3, x4, y4))
return 0;
}
- actr->_x = x;
- actr->_y = y;
+ actor->_x = x;
+ actor->_y = y;
return 1;
}
//*==========================================================================
// Block
-int special_movement_one(Actor *actr) {
+int specialMovementOne(Actor *actor) {
if (_G(diag_flag))
return 0;
- int d = _G(thor)->_dir;
- int x1 = actr->_x;
- int y1 = actr->_y;
- int sd = actr->_lastDir;
- actr->_lastDir = d;
+ const int d = _G(thor)->_dir;
+ int x1 = actor->_x;
+ int y1 = actor->_y;
+ const int sd = actor->_lastDir;
+ actor->_lastDir = d;
switch (d) {
case 0:
y1 -= 2;
- if (!check_special_move1(x1, y1, actr)) {
- actr->_lastDir = sd;
+ if (!checkSpecialMove1(x1, y1, actor)) {
+ actor->_lastDir = sd;
return 0;
}
break;
+
case 1:
y1 += 2;
- if (!check_special_move1(x1, y1, actr)) {
- actr->_lastDir = sd;
+ if (!checkSpecialMove1(x1, y1, actor)) {
+ actor->_lastDir = sd;
return 0;
}
break;
+
case 2:
x1 -= 2;
- if (!check_special_move1(x1, y1, actr)) {
- actr->_lastDir = sd;
+ if (!checkSpecialMove1(x1, y1, actor)) {
+ actor->_lastDir = sd;
return 0;
}
break;
+
case 3:
x1 += 2;
- if (!check_special_move1(x1, y1, actr)) {
- actr->_lastDir = sd;
+ if (!checkSpecialMove1(x1, y1, actor)) {
+ actor->_lastDir = sd;
return 0;
}
break;
+
+ default:
+ break;
}
- nextFrame(actr);
- actr->_lastDir = d;
+ nextFrame(actor);
+ actor->_lastDir = d;
return 1;
}
// Angle
-int special_movement_two(Actor *actr) {
- int x1 = actr->_temp1; // Calc thor pos
- int y1 = actr->_temp2;
- int x2 = x1 + 13;
- int y2 = y1 + 14;
+int specialMovementTwo(Actor *actor) {
+ const int x1 = actor->_temp1; // Calc thor pos
+ const int y1 = actor->_temp2;
+ const int x2 = x1 + 13;
+ const int y2 = y1 + 14;
for (int i = 3; i < MAX_ACTORS; i++) {
Actor *act = &_G(actor[i]);
- if (actr->_actorNum == act->_actorNum)
+ if (actor->_actorNum == act->_actorNum)
continue;
if (!act->_active)
continue;
- int x3 = act->_x;
+ const int x3 = act->_x;
if ((ABS(x3 - x1)) > 16)
continue;
- int y3 = act->_y;
+ const int y3 = act->_y;
if ((ABS(y3 - y1)) > 16)
continue;
- int x4 = act->_x + act->_sizeX;
- int y4 = act->_y + act->_sizeY;
+ const int x4 = act->_x + act->_sizeX;
+ const int y4 = act->_y + act->_sizeY;
if (overlap(x1, y1, x2, y2, x3, y3, x4, y4))
return 0;
}
- if (!actr->_funcPass) {
+ if (!actor->_funcPass) {
if (_G(thor)->_health < 150) {
if (!sound_playing())
play_sound(ANGEL, false);
@@ -970,101 +979,107 @@ int special_movement_two(Actor *actr) {
}
// Yellow globe
-int special_movement_three(Actor *actr) {
+int specialMovementThree(Actor *actor) {
if (_G(thunder_flag))
return 0;
long lind = (long)_G(current_level);
lind *= 1000;
- lind += (long)actr->_actorNum;
+ lind += (long)actor->_actorNum;
execute_script(lind, _G(odin));
return 0;
}
// Peg switch
-int special_movement_four(Actor *actr) {
- if (actr->_shotCountdown != 0)
+int specialMovementFour(Actor *actor) {
+ if (actor->_shotCountdown != 0)
return 0;
- actr->_shotCountdown = 30;
+ actor->_shotCountdown = 30;
_G(switch_flag) = 1;
return 0;
}
// Boulder roll
-int special_movement_five(Actor *actr) {
+int specialMovementFive(Actor *actor) {
int d = _G(thor)->_dir;
if (_G(diag_flag)) {
switch (_G(diag)) {
case 1:
- if (_G(thor_x1) < (actr->_x + 15))
+ if (_G(thor_x1) < (actor->_x + 15))
d = 0;
else
d = 2;
break;
+
case 2:
- if (_G(thor_x2) < actr->_x)
+ if (_G(thor_x2) < actor->_x)
d = 3;
else
d = 0;
break;
+
case 3:
- if (_G(thor_x2) > (actr->_x))
+ if (_G(thor_x2) > (actor->_x))
d = 1;
else
d = 3;
break;
+
case 4:
- if (_G(thor_x1) > (actr->_x + 15))
+ if (_G(thor_x1) > (actor->_x + 15))
d = 2;
else
d = 1;
break;
+
+ default:
+ break;
}
}
- actr->_lastDir = d;
- actr->_moveType = 14;
+ actor->_lastDir = d;
+ actor->_moveType = 14;
return 0;
}
-int special_movement_six(Actor *actr) {
- thor_damaged(actr);
+int specialMovementSix(Actor *actor) {
+ thorDamaged(actor);
return 0;
}
-int special_movement_seven(Actor *actr) {
- if (actr->_shotCountdown != 0)
+int specialMovementSeven(Actor *actor) {
+ if (actor->_shotCountdown != 0)
return 0;
- actr->_shotCountdown = 30;
+ actor->_shotCountdown = 30;
_G(switch_flag) = 2;
return 0;
}
-int special_movement_eight(Actor *actr) {
+int specialMovementEight(Actor *actor) {
if (_G(thor)->_dir < 2 || _G(diag_flag))
return 0;
- actr->_lastDir = _G(thor)->_dir;
- actr->_moveType = 14;
+ actor->_lastDir = _G(thor)->_dir;
+ actor->_moveType = 14;
return 0;
}
-int special_movement_nine(Actor *actr) {
+int specialMovementNine(Actor *actor) {
if (_G(thor)->_dir > 1 || _G(diag_flag))
return 0;
- actr->_lastDir = _G(thor)->_dir;
- actr->_moveType = 14;
+ actor->_lastDir = _G(thor)->_dir;
+ actor->_moveType = 14;
return 0;
}
-int special_movement_ten(Actor *actr) {
- byte &actor_ctr = GAME1 ? actr->_temp6 : actr->_talkCounter;
+int specialMovementTen(Actor *actor) {
+ byte &actor_ctr = GAME1 ? actor->_temp6 : actor->_talkCounter;
if (actor_ctr) {
actor_ctr--;
@@ -1075,117 +1090,129 @@ int special_movement_ten(Actor *actr) {
return 0;
actor_ctr = 10;
- actorSpeaks(actr, 0 - actr->_passValue, 0);
+ actorSpeaks(actor, 0 - actor->_passValue, 0);
return 0;
}
// Red guard
-int special_movement_eleven(Actor *actr) {
- if (actr->_talkCounter) {
- actr->_talkCounter--;
+int specialMovementEleven(Actor *actor) {
+ if (actor->_talkCounter) {
+ actor->_talkCounter--;
return 0;
}
- const int oldType = actr->_type;
- actr->_type = 4;
- actorSpeaks(actr, 0, 0);
- actr->_type = oldType;
- actr->_talkCounter = 10;
+ const int oldType = actor->_type;
+ actor->_type = 4;
+ actorSpeaks(actor, 0, 0);
+ actor->_type = oldType;
+ actor->_talkCounter = 10;
return 0;
}
// No movement - frame cycle
-int movement_one(Actor *actr) {
- nextFrame(actr);
- return actr->_dir;
+int movementOne(Actor *actor) {
+ nextFrame(actor);
+ return actor->_dir;
}
// Hammer only
-int movement_two(Actor *actr) {
- int d = actr->_lastDir;
- int x1 = actr->_x;
- int y1 = actr->_y;
+int movementTwo(Actor *actor) {
+ int d = actor->_lastDir;
+ int x1 = actor->_x;
+ int y1 = actor->_y;
switch (d) {
case 0:
y1 -= 2;
break;
+
case 1:
y1 += 2;
break;
+
case 2:
x1 -= 2;
break;
+
case 3:
x1 += 2;
break;
+
+ default:
+ break;
}
- if (!check_move2(x1, y1, actr)) {
- if (actr->_actorNum == 1) {
+ if (!checkMove2(x1, y1, actor)) {
+ if (actor->_actorNum == 1) {
_G(hammer)->_moveType = 5;
- d = reverse_direction(_G(hammer));
+ d = reverseDirection(_G(hammer));
_G(hammer)->_dir = d;
}
- if (actr->_actorNum == 2) {
- actr->_active = false;
- actr->_dead = 2;
+ if (actor->_actorNum == 2) {
+ actor->_active = false;
+ actor->_dead = 2;
_G(lightning_used) = false;
_G(tornado_used) = false;
}
}
- nextFrame(actr);
- actr->_lastDir = d;
- if (actr->_directions == 1)
+ nextFrame(actor);
+ actor->_lastDir = d;
+ if (actor->_directions == 1)
return 0;
return d;
}
// Walk-bump-random turn
-int movement_three(Actor *actr) {
- int d = actr->_lastDir;
- int x1 = actr->_x;
- int y1 = actr->_y;
+int movementThree(Actor *actor) {
+ int d = actor->_lastDir;
+ int x1 = actor->_x;
+ int y1 = actor->_y;
switch (d) {
case 0:
y1 -= 2;
- if (!check_move2(x1, y1, actr)) {
+ if (!checkMove2(x1, y1, actor)) {
d = g_events->getRandomNumber(3);
}
break;
+
case 1:
y1 += 2;
- if (!check_move2(x1, y1, actr)) {
+ if (!checkMove2(x1, y1, actor)) {
d = g_events->getRandomNumber(3);
}
break;
+
case 2:
x1 -= 2;
- if (!check_move2(x1, y1, actr)) {
+ if (!checkMove2(x1, y1, actor)) {
d = g_events->getRandomNumber(3);
}
break;
+
case 3:
x1 += 2;
- if (!check_move2(x1, y1, actr)) {
+ if (!checkMove2(x1, y1, actor)) {
d = g_events->getRandomNumber(3);
}
break;
+
+ default:
+ break;
}
- nextFrame(actr);
- actr->_lastDir = d;
- if (actr->_directions == 1)
+ nextFrame(actor);
+ actor->_lastDir = d;
+ if (actor->_directions == 1)
return 0;
return d;
}
// Simple tracking
-int movement_four(Actor *actr) {
- int d = actr->_lastDir;
+int movementFour(Actor *actor) {
+ int d = actor->_lastDir;
- int x1 = actr->_x;
- int y1 = actr->_y;
+ int x1 = actor->_x;
+ int y1 = actor->_y;
int f = 0;
if (x1 > _G(thor_x1) - 1) {
@@ -1199,7 +1226,7 @@ int movement_four(Actor *actr) {
}
if (f)
- f = check_move2(x1, y1, actr);
+ f = checkMove2(x1, y1, actor);
if (!f) {
if (y1 < (_G(thor_real_y1))) {
@@ -1218,30 +1245,30 @@ int movement_four(Actor *actr) {
f = 1;
}
if (f)
- f = check_move2(actr->_x, y1, actr);
+ f = checkMove2(actor->_x, y1, actor);
if (!f)
- check_move2(actr->_x, actr->_y, actr);
+ checkMove2(actor->_x, actor->_y, actor);
}
- nextFrame(actr);
- actr->_lastDir = d;
- if (actr->_directions == 1)
+ nextFrame(actor);
+ actor->_lastDir = d;
+ if (actor->_directions == 1)
return 0;
return d;
}
-int movement_five(Actor *actr) {
- int x1 = actr->_x;
- int y1 = actr->_y;
+int movementFive(Actor *actor) {
+ int x1 = actor->_x;
+ int y1 = actor->_y;
int xd = 0;
int yd = 0;
- int d = actr->_lastDir;
+ int d = actor->_lastDir;
if (x1 > (_G(thor)->_x + 1))
xd = -2; //+1
else if (x1 < (_G(thor)->_x - 1))
xd = 2;
- if (actr->_actorNum == 1) {
+ if (actor->_actorNum == 1) {
if (y1 < (_G(thor_y1) - 6))
yd = 2;
else if (y1 > (_G(thor_y1) - 6))
@@ -1254,20 +1281,17 @@ int movement_five(Actor *actr) {
}
if (xd && yd) {
- if (xd == -2 && yd == -2)
- d = 2;
- else if (xd == -2 && yd == 2)
+ if (xd == -2 && ABS(yd) == 2)
d = 2;
- else if (xd == 2 && yd == -2)
- d = 3;
- else if (xd == 2 && yd == 2)
+ else if (xd == 2 && ABS(yd) == 2)
d = 3;
+
x1 += xd;
y1 += yd;
- if (check_move2(x1, y1, actr)) {
- nextFrame(actr);
- actr->_lastDir = d;
- if (actr->_directions == 1)
+ if (checkMove2(x1, y1, actor)) {
+ nextFrame(actor);
+ actor->_lastDir = d;
+ if (actor->_directions == 1)
return 0;
return d;
}
@@ -1281,36 +1305,36 @@ int movement_five(Actor *actr) {
else if (xd == -2 && yd == 0)
d = 2;
}
- x1 = actr->_x;
- y1 = actr->_y;
- actr->_toggle ^= 1;
+ x1 = actor->_x;
+ y1 = actor->_y;
+ actor->_toggle ^= 1;
- if (actr->_toggle) {
+ if (actor->_toggle) {
if (xd) {
x1 += xd;
- if (check_move2(x1, y1, actr)) {
+ if (checkMove2(x1, y1, actor)) {
if (xd > 0)
d = 3;
else
d = 2;
- nextFrame(actr);
- actr->_lastDir = d;
- if (actr->_directions == 1)
+ nextFrame(actor);
+ actor->_lastDir = d;
+ if (actor->_directions == 1)
return 0;
return d;
}
- x1 = actr->_x;
+ x1 = actor->_x;
}
if (yd) {
y1 += yd;
- if (check_move2(x1, y1, actr)) {
+ if (checkMove2(x1, y1, actor)) {
if (yd > 0)
d = 1;
else
d = 0;
- nextFrame(actr);
- actr->_lastDir = d;
- if (actr->_directions == 1)
+ nextFrame(actor);
+ actor->_lastDir = d;
+ if (actor->_directions == 1)
return 0;
return d;
}
@@ -1318,151 +1342,157 @@ int movement_five(Actor *actr) {
} else {
if (yd) {
y1 += yd;
- if (check_move2(x1, y1, actr)) {
+ if (checkMove2(x1, y1, actor)) {
if (yd > 0)
d = 1;
else
d = 0;
- nextFrame(actr);
- actr->_lastDir = d;
- if (actr->_directions == 1)
+ nextFrame(actor);
+ actor->_lastDir = d;
+ if (actor->_directions == 1)
return 0;
return d;
}
- y1 = actr->_y;
+ y1 = actor->_y;
}
if (xd) {
x1 += xd;
- if (check_move2(x1, y1, actr)) {
+ if (checkMove2(x1, y1, actor)) {
if (xd > 0)
d = 3;
else
d = 2;
- nextFrame(actr);
- actr->_lastDir = d;
- if (actr->_directions == 1)
+ nextFrame(actor);
+ actor->_lastDir = d;
+ if (actor->_directions == 1)
return 0;
return d;
}
}
}
- check_move2(actr->_x, actr->_y, actr);
- nextFrame(actr);
- actr->_lastDir = d;
- if (actr->_directions == 1)
+ checkMove2(actor->_x, actor->_y, actor);
+ nextFrame(actor);
+ actor->_lastDir = d;
+ if (actor->_directions == 1)
return 0;
return d;
}
// Explosion only
-int movement_six(Actor *actr) {
- if (actr->_currNumShots > 0) {
- actr->_nextFrame++;
- if (actr->_nextFrame > 2) {
- actr->_nextFrame = 0;
+int movementSix(Actor *actor) {
+ if (actor->_currNumShots > 0) {
+ actor->_nextFrame++;
+ if (actor->_nextFrame > 2) {
+ actor->_nextFrame = 0;
if (_G(boss_dead))
play_sound(EXPLODE, false);
}
- actr->_currNumShots--;
+ actor->_currNumShots--;
} else {
- actr->_dead = 2;
- actr->_active = false;
+ actor->_dead = 2;
+ actor->_active = false;
if (!_G(boss_dead) && !_G(endgame)) {
- if (actr->_type == 2)
- drop_object(actr);
+ if (actor->_type == 2)
+ drop_object(actor);
}
}
- nextFrame(actr);
+ nextFrame(actor);
return 0;
}
// Walk-bump-random turn (pause also)
-int movement_seven(Actor *actr) {
- if (actr->_nextFrame == 0 && actr->_frameCount == actr->_frameSpeed) {
- actr->_moveCountdown = 12;
- actr->_lastDir = g_events->getRandomNumber(3);
+int movementSeven(Actor *actor) {
+ if (actor->_nextFrame == 0 && actor->_frameCount == actor->_frameSpeed) {
+ actor->_moveCountdown = 12;
+ actor->_lastDir = g_events->getRandomNumber(3);
}
- return movement_three(actr);
+ return movementThree(actor);
}
// Follow thor
-int movement_eight(Actor *actr) {
+int movementEight(Actor *actor) {
if (_G(thor)->_x > 0)
- actr->_x = _G(thor)->_x - 1;
+ actor->_x = _G(thor)->_x - 1;
else
- actr->_x = _G(thor)->_x;
- actr->_y = _G(thor)->_y;
- nextFrame(actr);
+ actor->_x = _G(thor)->_x;
+ actor->_y = _G(thor)->_y;
+ nextFrame(actor);
return 0;
}
// 4-way straight (random length) change
-int movement_nine(Actor *actr) {
- int d = actr->_lastDir;
- int x1 = actr->_x;
- int y1 = actr->_y;
+int movementNine(Actor *actor) {
+ int d = actor->_lastDir;
+ int x1 = actor->_x;
+ int y1 = actor->_y;
int f = 0;
- if (actr->_counter) {
- actr->_counter--;
+ if (actor->_counter) {
+ actor->_counter--;
switch (d) {
case 0:
y1 -= 2;
- if (!check_move4(x1, y1, actr))
+ if (!checkMove4(x1, y1, actor))
f = 1;
break;
+
case 1:
y1 += 2;
- if (!check_move4(x1, y1, actr))
+ if (!checkMove4(x1, y1, actor))
f = 1;
break;
+
case 2:
x1 -= 2;
- if (!check_move4(x1, y1, actr))
+ if (!checkMove4(x1, y1, actor))
f = 1;
break;
+
case 3:
x1 += 2;
- if (!check_move4(x1, y1, actr))
+ if (!checkMove4(x1, y1, actor))
f = 1;
break;
+
+ default:
+ break;
}
} else
f = 1;
if (f == 1) {
- actr->_counter = g_events->getRandomNumber(10, 99);
+ actor->_counter = g_events->getRandomNumber(10, 99);
d = g_events->getRandomNumber(3);
}
- nextFrame(actr);
- actr->_lastDir = d;
- if (actr->_directions == 1)
+ nextFrame(actor);
+ actor->_lastDir = d;
+ if (actor->_directions == 1)
return 0;
return d;
}
-// Vert straight (random length) change
-int movement_ten(Actor *actr) {
- int lastDir = actr->_lastDir;
- int x1 = actr->_x;
- int y1 = actr->_y;
+// Vertical straight (random length) change
+int movementTen(Actor *actor) {
+ int lastDir = actor->_lastDir;
+ const int x1 = actor->_x;
+ int y1 = actor->_y;
bool setRandomDirFl = false;
- if (actr->_counter) {
- if (actr->_passValue != 1)
- actr->_counter--;
+ if (actor->_counter) {
+ if (actor->_passValue != 1)
+ actor->_counter--;
switch (lastDir) {
case 0:
case 2:
y1 -= 2;
- if (!check_move2(x1, y1, actr))
+ if (!checkMove2(x1, y1, actor))
setRandomDirFl = true;
break;
case 1:
case 3:
y1 += 2;
- if (!check_move2(x1, y1, actr))
+ if (!checkMove2(x1, y1, actor))
setRandomDirFl = true;
break;
@@ -1473,626 +1503,686 @@ int movement_ten(Actor *actr) {
setRandomDirFl = true;
if (setRandomDirFl) {
- actr->_counter = g_events->getRandomNumber(10, 99);
+ actor->_counter = g_events->getRandomNumber(10, 99);
lastDir = g_events->getRandomNumber(1);
}
if (lastDir > 1)
lastDir -= 2;
- nextFrame(actr);
- actr->_lastDir = lastDir;
- if (actr->_directions == 1)
+ nextFrame(actor);
+ actor->_lastDir = lastDir;
+ if (actor->_directions == 1)
return 0;
return lastDir;
}
-// Horz only (bats)
-int movement_eleven(Actor *actr) {
- int d = actr->_lastDir;
+// Horizontal only (bats)
+int movementEleven(Actor *actor) {
+ int d = actor->_lastDir;
switch (d) {
case 0:
- if (check_move2(actr->_x - 2, actr->_y - 2, actr))
+ if (checkMove2(actor->_x - 2, actor->_y - 2, actor))
break;
d = 1;
- if (check_move2(actr->_x - 2, actr->_y + 2, actr))
+ if (checkMove2(actor->_x - 2, actor->_y + 2, actor))
break;
d = 2;
break;
+
case 1:
- if (check_move2(actr->_x - 2, actr->_y + 2, actr))
+ if (checkMove2(actor->_x - 2, actor->_y + 2, actor))
break;
d = 0;
- if (check_move2(actr->_x - 2, actr->_y - 2, actr))
+ if (checkMove2(actor->_x - 2, actor->_y - 2, actor))
break;
d = 3;
break;
+
case 2:
- if (check_move2(actr->_x + 2, actr->_y - 2, actr))
+ if (checkMove2(actor->_x + 2, actor->_y - 2, actor))
break;
d = 3;
- if (check_move2(actr->_x + 2, actr->_y + 2, actr))
+ if (checkMove2(actor->_x + 2, actor->_y + 2, actor))
break;
d = 0;
break;
+
case 3:
- if (check_move2(actr->_x + 2, actr->_y + 2, actr))
+ if (checkMove2(actor->_x + 2, actor->_y + 2, actor))
break;
d = 2;
- if (check_move2(actr->_x + 2, actr->_y - 2, actr))
+ if (checkMove2(actor->_x + 2, actor->_y - 2, actor))
break;
d = 1;
break;
+
+ default:
+ break;
+
}
- nextFrame(actr);
- actr->_lastDir = d;
- if (actr->_directions == 1)
+ nextFrame(actor);
+ actor->_lastDir = d;
+ if (actor->_directions == 1)
return 0;
return d;
}
-// Horz straight until bump
-int movement_twelve(Actor *actr) {
- int d = actr->_lastDir;
+// Horizontal straight until bump
+int movementTwelve(Actor *actor) {
+ int d = actor->_lastDir;
switch (d) {
case 0:
case 2:
- if (check_move2(actr->_x - 2, actr->_y, actr))
+ if (checkMove2(actor->_x - 2, actor->_y, actor))
break;
d = 3;
break;
+
case 1:
case 3:
- if (check_move2(actr->_x + 2, actr->_y, actr))
+ if (checkMove2(actor->_x + 2, actor->_y, actor))
break;
d = 2;
break;
+
+ default:
+ break;
}
- nextFrame(actr);
- actr->_lastDir = d;
- if (actr->_directions == 1)
+ nextFrame(actor);
+ actor->_lastDir = d;
+ if (actor->_directions == 1)
return 0;
return d;
}
// Pause-seek (mushroom)
-int movement_thirteen(Actor *actr) {
- int d = actr->_lastDir;
+int movementThirteen(Actor *actor) {
+ const int d = actor->_lastDir;
- if (actr->_counter == 0 && actr->_unpauseCountdown == 0) {
- actr->_unpauseCountdown = 60;
+ if (actor->_counter == 0 && actor->_unpauseCountdown == 0) {
+ actor->_unpauseCountdown = 60;
return d;
}
- if (actr->_unpauseCountdown > 0) {
- actr->_unpauseCountdown--;
- if (!actr->_unpauseCountdown)
- actr->_counter = 60;
- actr->_vulnerableCountdown = 5;
- actr->_hitStrength = 0;
+ if (actor->_unpauseCountdown > 0) {
+ actor->_unpauseCountdown--;
+ if (!actor->_unpauseCountdown)
+ actor->_counter = 60;
+ actor->_vulnerableCountdown = 5;
+ actor->_hitStrength = 0;
return d;
}
- if (actr->_counter > 0) {
- actr->_counter--;
- if (!actr->_counter)
- actr->_unpauseCountdown = 60;
- actr->_hitStrength = 10;
- return movement_five(actr);
+ if (actor->_counter > 0) {
+ actor->_counter--;
+ if (!actor->_counter)
+ actor->_unpauseCountdown = 60;
+ actor->_hitStrength = 10;
+ return movementFive(actor);
}
return d;
}
// Move-bump-stop (boulder)
-int movement_fourteen(Actor *actr) {
- int d = actr->_lastDir;
- actr->_dir = d;
- int x1 = actr->_x;
- int y1 = actr->_y;
+int movementFourteen(Actor *actor) {
+ const int d = actor->_lastDir;
+ actor->_dir = d;
+ int x1 = actor->_x;
+ int y1 = actor->_y;
switch (d) {
case 0:
y1 -= 2;
- if (!check_move2(x1, y1, actr)) {
- actr->_moveType = 15;
+ if (!checkMove2(x1, y1, actor)) {
+ actor->_moveType = 15;
return 0;
}
break;
+
case 1:
y1 += 2;
- if (!check_move2(x1, y1, actr)) {
- actr->_moveType = 15;
+ if (!checkMove2(x1, y1, actor)) {
+ actor->_moveType = 15;
return 0;
}
break;
+
case 2:
x1 -= 2;
- if (!check_move2(x1, y1, actr)) {
- actr->_moveType = 15;
+ if (!checkMove2(x1, y1, actor)) {
+ actor->_moveType = 15;
return 0;
}
break;
+
case 3:
x1 += 2;
- if (!check_move2(x1, y1, actr)) {
- actr->_moveType = 15;
+ if (!checkMove2(x1, y1, actor)) {
+ actor->_moveType = 15;
return 0;
}
break;
+
+ default:
+ break;
}
- nextFrame(actr);
- actr->_lastDir = d;
- if (actr->_directions == 1)
+ nextFrame(actor);
+ actor->_lastDir = d;
+ if (actor->_directions == 1)
return 0;
return d;
}
// No movement - no frame cycle
-int movement_fifteen(Actor *actr) {
- return actr->_dir;
+int movementFifteen(Actor *actor) {
+ return actor->_dir;
}
// Tornado 1
-int movement_sixteen(Actor *actr) {
- int d = actr->_lastDir;
- int x1 = actr->_x;
- int y1 = actr->_y;
+int movementSixteen(Actor *actor) {
+ int d = actor->_lastDir;
+ int x1 = actor->_x;
+ int y1 = actor->_y;
switch (d) {
case 0:
y1 -= 2;
break;
+
case 1:
y1 += 2;
break;
+
case 2:
x1 -= 2;
break;
+
case 3:
x1 += 2;
break;
+
+ default:
+ break;
}
- if (!check_move1(x1, y1, actr)) {
- actr->_moveType = 17;
+
+ if (!checkMove1(x1, y1, actor)) {
+ actor->_moveType = 17;
d = g_events->getRandomNumber(3);
}
- nextFrame(actr);
- actr->_lastDir = d;
- if (actr->_directions == 1)
+ nextFrame(actor);
+ actor->_lastDir = d;
+ if (actor->_directions == 1)
return 0;
return d;
}
// Tornado 2
-int movement_seventeen(Actor *actr) {
- int d = actr->_lastDir;
+int movementSeventeen(Actor *actor) {
+ int d = actor->_lastDir;
switch (d) {
case 0:
- if (check_move1(actr->_x - 2, actr->_y - 2, actr))
+ if (checkMove1(actor->_x - 2, actor->_y - 2, actor))
break;
d = 1;
- if (check_move1(actr->_x - 2, actr->_y + 2, actr))
+ if (checkMove1(actor->_x - 2, actor->_y + 2, actor))
break;
d = 2;
break;
+
case 1:
- if (check_move1(actr->_x - 2, actr->_y + 2, actr))
+ if (checkMove1(actor->_x - 2, actor->_y + 2, actor))
break;
d = 0;
- if (check_move1(actr->_x - 2, actr->_y - 2, actr))
+ if (checkMove1(actor->_x - 2, actor->_y - 2, actor))
break;
d = 3;
break;
+
case 2:
- if (check_move1(actr->_x + 2, actr->_y - 2, actr))
+ if (checkMove1(actor->_x + 2, actor->_y - 2, actor))
break;
d = 3;
- if (check_move1(actr->_x + 2, actr->_y + 2, actr))
+ if (checkMove1(actor->_x + 2, actor->_y + 2, actor))
break;
d = 0;
break;
+
case 3:
- if (check_move1(actr->_x + 2, actr->_y + 2, actr))
+ if (checkMove1(actor->_x + 2, actor->_y + 2, actor))
break;
d = 2;
- if (check_move1(actr->_x + 2, actr->_y - 2, actr))
+ if (checkMove1(actor->_x + 2, actor->_y - 2, actor))
break;
d = 1;
break;
+
+ default:
+ break;
}
- nextFrame(actr);
- actr->_lastDir = d;
- if (actr->_directions == 1)
+
+ nextFrame(actor);
+ actor->_lastDir = d;
+ if (actor->_directions == 1)
return 0;
return d;
}
// No movement - frame cycle
-int movement_eighteen(Actor *actr) {
+int movementEighteen(Actor *actor) {
int d;
- if (actr->_temp5) {
- actr->_temp5--;
- if (!actr->_temp5)
- actr->_numMoves = 1;
- }
- if (actr->_temp1) {
- d = movement_five(actr);
- actr->_rand--;
- if (actr->_hitThor || !actr->_rand) {
- if (actr->_hitThor) {
- actr->_temp5 = 50;
- actr->_numMoves = 2;
- actr->_hitThor = false;
- actr->_dir = d;
- d = reverse_direction(actr);
+ if (actor->_temp5) {
+ actor->_temp5--;
+ if (!actor->_temp5)
+ actor->_numMoves = 1;
+ }
+ if (actor->_temp1) {
+ d = movementFive(actor);
+ actor->_rand--;
+ if (actor->_hitThor || !actor->_rand) {
+ if (actor->_hitThor) {
+ actor->_temp5 = 50;
+ actor->_numMoves = 2;
+ actor->_hitThor = false;
+ actor->_dir = d;
+ d = reverseDirection(actor);
}
- actr->_temp1 = 0;
- actr->_rand = g_events->getRandomNumber(50, 149);
+ actor->_temp1 = 0;
+ actor->_rand = g_events->getRandomNumber(50, 149);
}
} else {
- d = movement_three(actr);
- actr->_rand--;
- if (!actr->_rand) {
- actr->_temp5 = 0;
- actr->_temp1 = 1;
- actr->_rand = g_events->getRandomNumber(50, 149);
- }
- if (actr->_hitThor) {
- actr->_temp5 = 50;
- actr->_numMoves = 2;
- actr->_hitThor = false;
- actr->_dir = d;
- d = reverse_direction(actr);
- }
- }
- nextFrame(actr);
+ d = movementThree(actor);
+ actor->_rand--;
+ if (!actor->_rand) {
+ actor->_temp5 = 0;
+ actor->_temp1 = 1;
+ actor->_rand = g_events->getRandomNumber(50, 149);
+ }
+ if (actor->_hitThor) {
+ actor->_temp5 = 50;
+ actor->_numMoves = 2;
+ actor->_hitThor = false;
+ actor->_dir = d;
+ d = reverseDirection(actor);
+ }
+ }
+ nextFrame(actor);
return d;
}
// No movement - frame cycle
-int movement_nineteen(Actor *actr) {
- return movement_seven(actr);
+int movementNineteen(Actor *actor) {
+ return movementSeven(actor);
}
-int movement_twenty(Actor *actr) {
+int movementTwenty(Actor *actor) {
if (GAME1)
// Boss - snake
- return boss1Movement(actr);
+ return boss1Movement(actor);
- return movement_one(actr);
+ return movementOne(actor);
}
// No movement - frame cycle
-int movement_twentyone(Actor *actr) {
- return movement_three(actr);
+int movementTwentyOne(Actor *actor) {
+ return movementThree(actor);
}
// Spear
-int movement_twentytwo(Actor *actr) {
- int d = actr->_lastDir;
- if (actr->_directions == 1)
+int movementTwentyTwo(Actor *actor) {
+ int d = actor->_lastDir;
+ if (actor->_directions == 1)
d = 0;
redo:
- switch (actr->_temp2) {
+ switch (actor->_temp2) {
case 0:
- if (backgroundTile(actr->_x, actr->_y) >= TILE_SOLID)
- actr->_nextFrame = 1;
+ if (backgroundTile(actor->_x, actor->_y) >= TILE_SOLID)
+ actor->_nextFrame = 1;
else {
- actr->_temp2 = 6;
- actr->_temp1 = 1;
+ actor->_temp2 = 6;
+ actor->_temp1 = 1;
goto redo;
}
- actr->_temp2++;
+ actor->_temp2++;
break;
+
case 1:
- actr->_nextFrame = 2;
- actr->_temp2++;
+ actor->_nextFrame = 2;
+ actor->_temp2++;
break;
+
case 2:
- actr->_nextFrame = 3;
- actr->_hitStrength = 255;
- actr->_temp2++;
- actr->_temp1 = 10;
+ actor->_nextFrame = 3;
+ actor->_hitStrength = 255;
+ actor->_temp2++;
+ actor->_temp1 = 10;
break;
+
case 3:
- check_move2(actr->_x, actr->_y, actr);
- actr->_temp1--;
- if (actr->_temp1)
+ checkMove2(actor->_x, actor->_y, actor);
+ actor->_temp1--;
+ if (actor->_temp1)
break;
- actr->_temp2++;
- actr->_nextFrame = 2;
+ actor->_temp2++;
+ actor->_nextFrame = 2;
break;
+
case 4:
- actr->_hitStrength = 0;
- actr->_temp2++;
- actr->_nextFrame = 1;
+ actor->_hitStrength = 0;
+ actor->_temp2++;
+ actor->_nextFrame = 1;
break;
+
case 5:
- actr->_temp2++;
- actr->_nextFrame = 0;
- actr->_temp1 = 10;
+ actor->_temp2++;
+ actor->_nextFrame = 0;
+ actor->_temp1 = 10;
break;
+
case 6:
- actr->_temp1--;
- if (actr->_temp1)
+ actor->_temp1--;
+ if (actor->_temp1)
break;
- actr->_temp2 = 0;
- actr->_nextFrame = 0;
+ actor->_temp2 = 0;
+ actor->_nextFrame = 0;
switch (d) {
case 0:
- actr->_x += 16;
- actr->_y += 16;
+ actor->_x += 16;
+ actor->_y += 16;
d = 3;
- if (backgroundTile(actr->_x, actr->_y) < TILE_SOLID)
+ if (backgroundTile(actor->_x, actor->_y) < TILE_SOLID)
goto redo;
break;
+
case 1:
- actr->_x -= 16;
- actr->_y -= 16;
+ actor->_x -= 16;
+ actor->_y -= 16;
d = 2;
- if (backgroundTile(actr->_x, actr->_y) < TILE_SOLID)
+ if (backgroundTile(actor->_x, actor->_y) < TILE_SOLID)
goto redo;
break;
+
case 2:
- actr->_x += 16;
- actr->_y -= 16;
+ actor->_x += 16;
+ actor->_y -= 16;
d = 0;
- if (backgroundTile(actr->_x, actr->_y) < TILE_SOLID)
+ if (backgroundTile(actor->_x, actor->_y) < TILE_SOLID)
goto redo;
break;
+
case 3:
- actr->_x -= 16;
- actr->_y += 16;
+ actor->_x -= 16;
+ actor->_y += 16;
d = 1;
- if (backgroundTile(actr->_x, actr->_y) < TILE_SOLID)
+ if (backgroundTile(actor->_x, actor->_y) < TILE_SOLID)
goto redo;
break;
+ default:
+ break;
}
- actr->_dir = d;
- actr->_lastDir = d;
+ actor->_dir = d;
+ actor->_lastDir = d;
+ break;
+
+ default:
break;
}
return d;
}
// Spinball counter-clockwise
-int movement_twentythree(Actor *actr) {
- int d = actr->_lastDir;
- nextFrame(actr);
- if (actr->_passValue & 2)
- actr->_numMoves = 2;
+int movementTwentyThree(Actor *actor) {
+ int d = actor->_lastDir;
+ nextFrame(actor);
+ if (actor->_passValue & 2)
+ actor->_numMoves = 2;
switch (d) {
case 0:
- if (backgroundTile(actr->_x - 2, actr->_y) >= TILE_FLY &&
- backgroundTile(actr->_x - 2, actr->_y + actr->_sizeY - 1) >= TILE_FLY) {
+ if (backgroundTile(actor->_x - 2, actor->_y) >= TILE_FLY &&
+ backgroundTile(actor->_x - 2, actor->_y + actor->_sizeY - 1) >= TILE_FLY) {
d = 2;
- actr->_x -= 2;
+ actor->_x -= 2;
} else {
- if (backgroundTile(actr->_x, actr->_y - 2) < TILE_FLY ||
- backgroundTile(actr->_x + actr->_sizeX - 1, actr->_y - 2) < TILE_FLY) {
- if (backgroundTile(actr->_x + actr->_sizeX + 1, actr->_y) >= TILE_FLY &&
- backgroundTile(actr->_x + actr->_sizeX + 1, actr->_y + actr->_sizeY - 1) >= TILE_FLY) {
+ if (backgroundTile(actor->_x, actor->_y - 2) < TILE_FLY ||
+ backgroundTile(actor->_x + actor->_sizeX - 1, actor->_y - 2) < TILE_FLY) {
+ if (backgroundTile(actor->_x + actor->_sizeX + 1, actor->_y) >= TILE_FLY &&
+ backgroundTile(actor->_x + actor->_sizeX + 1, actor->_y + actor->_sizeY - 1) >= TILE_FLY) {
d = 3;
- actr->_x += 2;
+ actor->_x += 2;
} else {
d = 1;
break;
}
} else
- actr->_y -= 2;
+ actor->_y -= 2;
}
break;
+
case 1:
- if (backgroundTile(actr->_x + actr->_sizeX + 1, actr->_y) >= TILE_FLY &&
- backgroundTile(actr->_x + actr->_sizeX + 1, actr->_y + actr->_sizeY - 1) >= TILE_FLY) {
+ if (backgroundTile(actor->_x + actor->_sizeX + 1, actor->_y) >= TILE_FLY &&
+ backgroundTile(actor->_x + actor->_sizeX + 1, actor->_y + actor->_sizeY - 1) >= TILE_FLY) {
d = 3;
- actr->_x += 2;
+ actor->_x += 2;
} else {
- if (backgroundTile(actr->_x, actr->_y + actr->_sizeY + 1) < TILE_FLY ||
- backgroundTile(actr->_x + actr->_sizeX - 1, actr->_y + actr->_sizeY + 1) < TILE_FLY) {
- if (backgroundTile(actr->_x - 2, actr->_y) >= TILE_FLY &&
- backgroundTile(actr->_x - 2, actr->_y + actr->_sizeY - 1) >= TILE_FLY) {
+ if (backgroundTile(actor->_x, actor->_y + actor->_sizeY + 1) < TILE_FLY ||
+ backgroundTile(actor->_x + actor->_sizeX - 1, actor->_y + actor->_sizeY + 1) < TILE_FLY) {
+ if (backgroundTile(actor->_x - 2, actor->_y) >= TILE_FLY &&
+ backgroundTile(actor->_x - 2, actor->_y + actor->_sizeY - 1) >= TILE_FLY) {
d = 2;
- actr->_x -= 2;
+ actor->_x -= 2;
} else {
d = 0;
break;
}
} else
- actr->_y += 2;
+ actor->_y += 2;
}
break;
+
case 2:
- if (backgroundTile(actr->_x, actr->_y + actr->_sizeY + 1) >= TILE_FLY &&
- backgroundTile(actr->_x + actr->_sizeX - 1, actr->_y + actr->_sizeY + 1) >= TILE_FLY) {
+ if (backgroundTile(actor->_x, actor->_y + actor->_sizeY + 1) >= TILE_FLY &&
+ backgroundTile(actor->_x + actor->_sizeX - 1, actor->_y + actor->_sizeY + 1) >= TILE_FLY) {
d = 1;
- actr->_y += 2;
+ actor->_y += 2;
} else {
- if (backgroundTile(actr->_x - 2, actr->_y) < TILE_FLY ||
- backgroundTile(actr->_x - 2, actr->_y + actr->_sizeY - 1) < TILE_FLY) {
- if (backgroundTile(actr->_x, actr->_y - 2) >= TILE_FLY &&
- backgroundTile(actr->_x + actr->_sizeX - 1, actr->_y - 2) >= TILE_FLY) {
+ if (backgroundTile(actor->_x - 2, actor->_y) < TILE_FLY ||
+ backgroundTile(actor->_x - 2, actor->_y + actor->_sizeY - 1) < TILE_FLY) {
+ if (backgroundTile(actor->_x, actor->_y - 2) >= TILE_FLY &&
+ backgroundTile(actor->_x + actor->_sizeX - 1, actor->_y - 2) >= TILE_FLY) {
d = 0;
- actr->_y -= 2;
+ actor->_y -= 2;
} else {
d = 3;
break;
}
} else
- actr->_x -= 2;
+ actor->_x -= 2;
}
break;
+
case 3:
- if (backgroundTile(actr->_x, actr->_y - 2) >= TILE_FLY &&
- backgroundTile(actr->_x + actr->_sizeX - 1, actr->_y - 2) >= TILE_FLY) {
+ if (backgroundTile(actor->_x, actor->_y - 2) >= TILE_FLY &&
+ backgroundTile(actor->_x + actor->_sizeX - 1, actor->_y - 2) >= TILE_FLY) {
d = 0;
- actr->_y -= 2;
+ actor->_y -= 2;
} else {
- if (backgroundTile(actr->_x + actr->_sizeX + 1, actr->_y) < TILE_FLY ||
- backgroundTile(actr->_x + actr->_sizeX + 1, actr->_y + actr->_sizeY - 1) < TILE_FLY) {
- if (backgroundTile(actr->_x, actr->_y + actr->_sizeY + 1) >= TILE_FLY &&
- backgroundTile(actr->_x + actr->_sizeX - 1, actr->_y + actr->_sizeY + 1) >= TILE_FLY) {
+ if (backgroundTile(actor->_x + actor->_sizeX + 1, actor->_y) < TILE_FLY ||
+ backgroundTile(actor->_x + actor->_sizeX + 1, actor->_y + actor->_sizeY - 1) < TILE_FLY) {
+ if (backgroundTile(actor->_x, actor->_y + actor->_sizeY + 1) >= TILE_FLY &&
+ backgroundTile(actor->_x + actor->_sizeX - 1, actor->_y + actor->_sizeY + 1) >= TILE_FLY) {
d = 1;
- actr->_y += 2;
+ actor->_y += 2;
} else {
d = 2;
break;
}
} else
- actr->_x += 2;
+ actor->_x += 2;
}
break;
+
+ default:
+ break;
}
- check_move2(actr->_x, actr->_y, actr);
- actr->_lastDir = d;
- if (actr->_directions == 1)
+
+ checkMove2(actor->_x, actor->_y, actor);
+ actor->_lastDir = d;
+ if (actor->_directions == 1)
return 0;
return d;
}
// Spinball clockwise
-int movement_twentyfour(Actor *actr) {
- int d = actr->_lastDir;
- nextFrame(actr);
- if (actr->_passValue & 2)
- actr->_numMoves = 2;
+int movementTwentyFour(Actor *actor) {
+ int d = actor->_lastDir;
+ nextFrame(actor);
+ if (actor->_passValue & 2)
+ actor->_numMoves = 2;
switch (d) {
case 0:
- if (backgroundTile(actr->_x + actr->_sizeX + 1, actr->_y) >= TILE_FLY &&
- backgroundTile(actr->_x + actr->_sizeX + 1, actr->_y + actr->_sizeY - 1) >= TILE_FLY) {
+ if (backgroundTile(actor->_x + actor->_sizeX + 1, actor->_y) >= TILE_FLY &&
+ backgroundTile(actor->_x + actor->_sizeX + 1, actor->_y + actor->_sizeY - 1) >= TILE_FLY) {
d = 3;
- actr->_x += 2;
+ actor->_x += 2;
} else {
- if (backgroundTile(actr->_x, actr->_y - 2) < TILE_FLY ||
- backgroundTile(actr->_x + actr->_sizeX - 1, actr->_y - 2) < TILE_FLY) {
- if (backgroundTile(actr->_x - 2, actr->_y) >= TILE_FLY &&
- backgroundTile(actr->_x - 2, actr->_y + actr->_sizeY - 1) >= TILE_FLY) {
+ if (backgroundTile(actor->_x, actor->_y - 2) < TILE_FLY ||
+ backgroundTile(actor->_x + actor->_sizeX - 1, actor->_y - 2) < TILE_FLY) {
+ if (backgroundTile(actor->_x - 2, actor->_y) >= TILE_FLY &&
+ backgroundTile(actor->_x - 2, actor->_y + actor->_sizeY - 1) >= TILE_FLY) {
d = 2;
- actr->_x -= 2;
+ actor->_x -= 2;
} else {
d = 1;
break;
}
} else
- actr->_y -= 2;
+ actor->_y -= 2;
}
break;
+
case 1:
- if (backgroundTile(actr->_x - 2, actr->_y) >= TILE_FLY &&
- backgroundTile(actr->_x - 2, actr->_y + actr->_sizeY - 1) >= TILE_FLY) {
+ if (backgroundTile(actor->_x - 2, actor->_y) >= TILE_FLY &&
+ backgroundTile(actor->_x - 2, actor->_y + actor->_sizeY - 1) >= TILE_FLY) {
d = 2;
- actr->_x -= 2;
+ actor->_x -= 2;
} else {
- if (backgroundTile(actr->_x, actr->_y + actr->_sizeY + 1) < TILE_FLY ||
- backgroundTile(actr->_x + actr->_sizeX - 1, actr->_y + actr->_sizeY + 1) < TILE_FLY) {
- if (backgroundTile(actr->_x + actr->_sizeX + 1, actr->_y) >= TILE_FLY &&
- backgroundTile(actr->_x + actr->_sizeX + 1, actr->_y + actr->_sizeY - 1) >= TILE_FLY) {
+ if (backgroundTile(actor->_x, actor->_y + actor->_sizeY + 1) < TILE_FLY ||
+ backgroundTile(actor->_x + actor->_sizeX - 1, actor->_y + actor->_sizeY + 1) < TILE_FLY) {
+ if (backgroundTile(actor->_x + actor->_sizeX + 1, actor->_y) >= TILE_FLY &&
+ backgroundTile(actor->_x + actor->_sizeX + 1, actor->_y + actor->_sizeY - 1) >= TILE_FLY) {
d = 3;
- actr->_x += 2;
+ actor->_x += 2;
} else {
d = 0;
break;
}
} else
- actr->_y += 2;
+ actor->_y += 2;
}
break;
+
case 2:
- if (backgroundTile(actr->_x, actr->_y - 2) >= TILE_FLY &&
- backgroundTile(actr->_x + actr->_sizeX - 1, actr->_y - 2) >= TILE_FLY) {
+ if (backgroundTile(actor->_x, actor->_y - 2) >= TILE_FLY &&
+ backgroundTile(actor->_x + actor->_sizeX - 1, actor->_y - 2) >= TILE_FLY) {
d = 0;
- actr->_y -= 2;
+ actor->_y -= 2;
} else {
- if (backgroundTile(actr->_x - 2, actr->_y) < TILE_FLY ||
- backgroundTile(actr->_x - 2, actr->_y + actr->_sizeY - 1) < TILE_FLY) {
- if (backgroundTile(actr->_x, actr->_y + actr->_sizeY + 1) >= TILE_FLY &&
- backgroundTile(actr->_x + actr->_sizeX - 1, actr->_y + actr->_sizeY + 1) >= TILE_FLY) {
+ if (backgroundTile(actor->_x - 2, actor->_y) < TILE_FLY ||
+ backgroundTile(actor->_x - 2, actor->_y + actor->_sizeY - 1) < TILE_FLY) {
+ if (backgroundTile(actor->_x, actor->_y + actor->_sizeY + 1) >= TILE_FLY &&
+ backgroundTile(actor->_x + actor->_sizeX - 1, actor->_y + actor->_sizeY + 1) >= TILE_FLY) {
d = 1;
- actr->_y += 2;
+ actor->_y += 2;
} else {
d = 3;
break;
}
} else
- actr->_x -= 2;
+ actor->_x -= 2;
}
break;
+
case 3:
- if (backgroundTile(actr->_x, actr->_y + actr->_sizeY + 1) >= TILE_FLY &&
- backgroundTile(actr->_x + actr->_sizeX - 1, actr->_y + actr->_sizeY + 1) >= TILE_FLY) {
+ if (backgroundTile(actor->_x, actor->_y + actor->_sizeY + 1) >= TILE_FLY &&
+ backgroundTile(actor->_x + actor->_sizeX - 1, actor->_y + actor->_sizeY + 1) >= TILE_FLY) {
d = 1;
- actr->_y += 2;
+ actor->_y += 2;
} else {
- if (backgroundTile(actr->_x + actr->_sizeX + 1, actr->_y) < TILE_FLY ||
- backgroundTile(actr->_x + actr->_sizeX + 1, actr->_y + actr->_sizeY - 1) < TILE_FLY) {
- if (backgroundTile(actr->_x, actr->_y - 2) >= TILE_FLY &&
- backgroundTile(actr->_x + actr->_sizeX - 1, actr->_y - 2) >= TILE_FLY) {
+ if (backgroundTile(actor->_x + actor->_sizeX + 1, actor->_y) < TILE_FLY ||
+ backgroundTile(actor->_x + actor->_sizeX + 1, actor->_y + actor->_sizeY - 1) < TILE_FLY) {
+ if (backgroundTile(actor->_x, actor->_y - 2) >= TILE_FLY &&
+ backgroundTile(actor->_x + actor->_sizeX - 1, actor->_y - 2) >= TILE_FLY) {
d = 0;
- actr->_y -= 2;
+ actor->_y -= 2;
} else {
d = 2;
break;
}
} else
- actr->_x += 2;
+ actor->_x += 2;
}
break;
+
+ default:
+ break;
}
- check_move2(actr->_x, actr->_y, actr);
- actr->_lastDir = d;
- if (actr->_directions == 1)
+
+ checkMove2(actor->_x, actor->_y, actor);
+ actor->_lastDir = d;
+
+ if (actor->_directions == 1)
return 0;
return d;
}
// Acid puddle
-int movement_twentyfive(Actor *actr) {
- if (actr->_temp2) {
- actr->_temp2--;
- return movement_one(actr);
+int movementTwentyFive(Actor *actor) {
+ if (actor->_temp2) {
+ actor->_temp2--;
+ return movementOne(actor);
}
- if (!actr->_temp1) {
- actr->_lastDir = g_events->getRandomNumber(3);
+ if (!actor->_temp1) {
+ actor->_lastDir = g_events->getRandomNumber(3);
int i = 4;
while (i--) {
- int ret = movement_three(actr);
+ int ret = movementThree(actor);
if (ret)
return ret;
- actr->_lastDir++;
- if (actr->_lastDir > 3)
- actr->_lastDir = 0;
+ actor->_lastDir++;
+ if (actor->_lastDir > 3)
+ actor->_lastDir = 0;
}
- actr->_temp1 = 16;
+ actor->_temp1 = 16;
}
- actr->_temp1--;
- return movement_three(actr);
+ actor->_temp1--;
+ return movementThree(actor);
}
-int movement_twentysix(Actor *actr) {
+int movementTwentySix(Actor *actor) {
if (GAME2)
- return boss2Movement(actr);
+ return boss2Movement(actor);
if (GAME3)
- return boss3Movement(actr);
+ return boss3Movement(actor);
- return movement_one(actr);
+ return movementOne(actor);
}
-int movement_twentyseven(Actor *actr) {
+int movementTwentySeven(Actor *actor) {
if (GAME2)
- return boss2Movement(actr);
+ return boss2Movement(actor);
- return movement_one(actr);
+ return movementOne(actor);
}
-void set_thor_vars() {
+void setThorVars() {
_G(thor_x1) = _G(thor)->_x + 1;
_G(thor_y1) = _G(thor)->_y + 8;
@@ -2102,43 +2192,43 @@ void set_thor_vars() {
}
// Fish
-int movement_twentyeight(Actor *actr) {
- int d = actr->_lastDir;
- int x1 = actr->_x;
- int y1 = actr->_y;
+int movementTwentyEight(Actor *actor) {
+ const int d = actor->_lastDir;
+ int x1 = actor->_x;
+ int y1 = actor->_y;
int ret;
- if (actr->_i1)
- actr->_i1--;
+ if (actor->_i1)
+ actor->_i1--;
else {
- if (!actr->_temp3) {
- if (!actr->_nextFrame) {
- actr->_frameCount = 1;
- actr->_frameSpeed = 4;
+ if (!actor->_temp3) {
+ if (!actor->_nextFrame) {
+ actor->_frameCount = 1;
+ actor->_frameSpeed = 4;
}
- nextFrame(actr);
- if (actr->_nextFrame == 3) {
- if (actr->_currNumShots < actr->_numShotsAllowed)
- actor_shoots(actr, 0);
- actr->_temp3 = 1;
+ nextFrame(actor);
+ if (actor->_nextFrame == 3) {
+ if (actor->_currNumShots < actor->_numShotsAllowed)
+ actorShoots(actor, 0);
+ actor->_temp3 = 1;
}
} else {
- const int fcount = actr->_frameCount - 1;
+ const int fcount = actor->_frameCount - 1;
if (fcount <= 0) {
- actr->_nextFrame--;
- actr->_frameCount = actr->_frameSpeed;
- if (!actr->_nextFrame) {
- actr->_temp3 = 0;
- actr->_frameSpeed = 4;
- actr->_i1 = g_events->getRandomNumber(60, 159);
+ actor->_nextFrame--;
+ actor->_frameCount = actor->_frameSpeed;
+ if (!actor->_nextFrame) {
+ actor->_temp3 = 0;
+ actor->_frameSpeed = 4;
+ actor->_i1 = g_events->getRandomNumber(60, 159);
}
} else
- actr->_frameCount = fcount;
+ actor->_frameCount = fcount;
}
goto done;
}
- switch (actr->_temp2) {
+ switch (actor->_temp2) {
case 0:
y1 -= 2;
break;
@@ -2151,57 +2241,59 @@ int movement_twentyeight(Actor *actr) {
case 3:
x1 += 2;
break;
+ default:
+ break;
}
ret = backgroundTile(x1, y1);
if (ret != 100 && ret != 106 && ret != 110 && ret != 111 && ret != 113)
goto chg_dir;
- ret = backgroundTile((x1 + actr->_sizeX) - 1, y1);
+ ret = backgroundTile((x1 + actor->_sizeX) - 1, y1);
if (ret != 100 && ret != 106 && ret != 110 && ret != 111 && ret != 113)
goto chg_dir;
- ret = backgroundTile(x1, (y1 + actr->_sizeY) - 1);
+ ret = backgroundTile(x1, (y1 + actor->_sizeY) - 1);
if (ret != 100 && ret != 106 && ret != 110 && ret != 111 && ret != 113)
goto chg_dir;
- ret = backgroundTile((x1 + actr->_sizeX) - 1, (y1 + actr->_sizeY) - 1);
+ ret = backgroundTile((x1 + actor->_sizeX) - 1, (y1 + actor->_sizeY) - 1);
if (ret != 100 && ret != 106 && ret != 110 && ret != 111 && ret != 113)
goto chg_dir;
- actr->_x = x1;
- actr->_y = y1;
+ actor->_x = x1;
+ actor->_y = y1;
goto done;
chg_dir:
- actr->_temp2 = _G(rand1) % 4;
+ actor->_temp2 = _G(rand1) % 4;
done:
- if (actr->_nextFrame) {
- x1 = actr->_x;
- y1 = actr->_y;
- actr->_solid = 1;
- check_move2(x1, y1, actr);
- actr->_x = x1;
- actr->_y = y1;
+ if (actor->_nextFrame) {
+ x1 = actor->_x;
+ y1 = actor->_y;
+ actor->_solid = 1;
+ checkMove2(x1, y1, actor);
+ actor->_x = x1;
+ actor->_y = y1;
} else
- actr->_solid = 2;
- if (actr->_directions == 1)
+ actor->_solid = 2;
+ if (actor->_directions == 1)
return 0;
return d;
}
-// Horz or vert (pass_val)
-int movement_twentynine(Actor *actr) {
- if (!actr->_passValue)
- return movement_thirty(actr);
+// Horizontal or vertical (pass_val)
+int movementTwentyNine(Actor *actor) {
+ if (!actor->_passValue)
+ return movementThirty(actor);
- return movement_twelve(actr);
+ return movementTwelve(actor);
}
-// Vert straight
-int movement_thirty(Actor *actr) {
- int d = actr->_lastDir;
- int x1 = actr->_x;
- int y1 = actr->_y;
+// Vertical straight
+int movementThirty(Actor *actor) {
+ int d = actor->_lastDir;
+ const int x1 = actor->_x;
+ int y1 = actor->_y;
switch (d) {
case 0:
@@ -2210,143 +2302,152 @@ int movement_thirty(Actor *actr) {
case 1:
y1 += 2;
break;
+ default:
+ break;
}
- if (!check_move2(x1, y1, actr))
+ if (!checkMove2(x1, y1, actor))
d ^= 1;
- nextFrame(actr);
- actr->_lastDir = d;
- if (actr->_directions == 1)
+ nextFrame(actor);
+ actor->_lastDir = d;
+ if (actor->_directions == 1)
return 0;
return d;
}
// Drop (stalagtite)
-int movement_thirtyone(Actor *actr) {
- int d = actr->_lastDir;
- int x1 = actr->_x;
- int y1 = actr->_y;
+int movementThirtyOne(Actor *actor) {
+ const int d = actor->_lastDir;
+ int x1 = actor->_x;
+ int y1 = actor->_y;
- if (actr->_temp1) {
+ if (actor->_temp1) {
y1 += 2;
- if (!check_move2(x1, y1, actr))
- actor_destroyed(actr);
+ if (!checkMove2(x1, y1, actor))
+ actorDestroyed(actor);
} else if (_G(thor_y1) > y1 && ABS(x1 - _G(thor_x1)) < 16) {
- int cx = (actr->_x + (actr->_sizeX / 2)) >> 4;
- int cy = ((actr->_y + actr->_sizeY) - 2) >> 4;
- int ty = _G(thor)->_centerY;
+ const int cx = (actor->_x + (actor->_sizeX / 2)) >> 4;
+ const int cy = ((actor->_y + actor->_sizeY) - 2) >> 4;
+ const int ty = _G(thor)->_centerY;
for (int i = cy; i <= ty; i++)
if (_G(scrn)._iconGrid[i][cx] < TILE_SOLID)
goto done;
- actr->_numMoves = actr->_passValue + 1;
- actr->_temp1 = 1;
+ actor->_numMoves = actor->_passValue + 1;
+ actor->_temp1 = 1;
}
done:
- nextFrame(actr);
- actr->_lastDir = d;
- if (actr->_directions == 1)
+ nextFrame(actor);
+ actor->_lastDir = d;
+ if (actor->_directions == 1)
return 0;
return d;
}
// Unused
-int movement_thirtytwo(Actor *actr) {
+int movementThirtyTwo(Actor *actor) {
return 0;
}
// Unused
-int movement_thirtythree(Actor *actr) {
+int movementThirtyThree(Actor *actor) {
return 0;
}
// Unused
-int movement_thirtyfour(Actor *actr) {
+int movementThirtyFour(Actor *actor) {
return 0;
}
// Gun (single)
-int movement_thirtyfive(Actor *actr) {
- actr->_nextFrame = actr->_lastDir;
- return actr->_dir;
+int movementThirtyFive(Actor *actor) {
+ actor->_nextFrame = actor->_lastDir;
+ return actor->_dir;
}
// Acid drop
-int movement_thirtysix(Actor *actr) {
- actr->_speed = actr->_passValue;
- nextFrame(actr);
- if (actr->_nextFrame == 0 && actr->_frameCount == actr->_frameSpeed) {
- actor_always_shoots(actr, 1);
- _G(actor[actr->_shotActor])._x -= 2;
+int movementThirtySix(Actor *actor) {
+ actor->_speed = actor->_passValue;
+ nextFrame(actor);
+ if (actor->_nextFrame == 0 && actor->_frameCount == actor->_frameSpeed) {
+ actorAlwaysShoots(actor, 1);
+ _G(actor[actor->_shotActor])._x -= 2;
}
return 0;
}
// 4-way straight (random length) change
-int movement_thirtyseven(Actor *actr) {
- int d = actr->_lastDir;
- int x1 = actr->_x;
- int y1 = actr->_y;
-
- int f = 0;
- if (actr->_counter) {
- actr->_counter--;
+int movementThirtySeven(Actor *actor) {
+ int d = actor->_lastDir;
+ int x1 = actor->_x;
+ int y1 = actor->_y;
+
+ bool check = false;
+ if (actor->_counter) {
+ actor->_counter--;
switch (d) {
case 0:
y1 -= 2;
- if (!check_move2(x1, y1, actr))
- f = 1;
+ if (!checkMove2(x1, y1, actor))
+ check = true;
break;
+
case 1:
y1 += 2;
- if (!check_move2(x1, y1, actr))
- f = 1;
+ if (!checkMove2(x1, y1, actor))
+ check = true;
break;
+
case 2:
x1 -= 2;
- if (!check_move2(x1, y1, actr))
- f = 1;
+ if (!checkMove2(x1, y1, actor))
+ check = true;
break;
+
case 3:
x1 += 2;
- if (!check_move2(x1, y1, actr))
- f = 1;
+ if (!checkMove2(x1, y1, actor))
+ check = true;
+ break;
+
+ default:
break;
}
} else
- f = 1;
+ check = true;
- if (f == 1) {
- actr->_counter = g_events->getRandomNumber(10, 99);
+ if (check) {
+ actor->_counter = g_events->getRandomNumber(10, 99);
d = g_events->getRandomNumber(3);
}
- nextFrame(actr);
- actr->_lastDir = d;
- if (actr->_directions == 1)
+
+ nextFrame(actor);
+ actor->_lastDir = d;
+ if (actor->_directions == 1)
return 0;
return d;
}
// Timed darting
-#define TIMER actr->_i1
-#define INIT_DIR actr->_temp1
-#define OTHER_DIR actr->_temp2
-#define FLAG actr->_temp3
-#define OX actr->_i2
-#define OY actr->_i3
-#define CNT actr->_i4
-int movement_thirtyeight(Actor *actr) {
- int d = actr->_lastDir;
- int x1 = actr->_x;
- int y1 = actr->_y;
+#define TIMER actor->_i1
+#define INIT_DIR actor->_temp1
+#define OTHER_DIR actor->_temp2
+#define FLAG actor->_temp3
+#define OX actor->_i2
+#define OY actor->_i3
+#define CNT actor->_i4
+int movementThirtyEight(Actor *actor) {
+ int d = actor->_lastDir;
+ int x1 = actor->_x;
+ int y1 = actor->_y;
if (!FLAG) {
FLAG = 1;
- if (actr->_passValue)
- TIMER = actr->_passValue * 15;
+ if (actor->_passValue)
+ TIMER = actor->_passValue * 15;
else
TIMER = g_events->getRandomNumber(5, 364);
- INIT_DIR = actr->_lastDir;
+ INIT_DIR = actor->_lastDir;
OX = x1;
OY = y1;
CNT = 0;
@@ -2363,6 +2464,8 @@ int movement_thirtyeight(Actor *actr) {
case 3:
OTHER_DIR = 2;
break;
+ default:
+ break;
}
}
if (TIMER) {
@@ -2383,98 +2486,106 @@ int movement_thirtyeight(Actor *actr) {
case 3:
x1 += 2;
break;
+ default:
+ break;
}
switch (FLAG) {
case 1:
- if (!check_move2(x1, y1, actr)) {
+ if (!checkMove2(x1, y1, actor)) {
if (CNT) {
d = OTHER_DIR;
- actr->_lastDir = d;
+ actor->_lastDir = d;
FLAG = 2;
} else {
- actr->_nextFrame = 0;
+ actor->_nextFrame = 0;
FLAG = 0;
goto done;
}
} else
CNT++;
break;
+
case 2:
- check_move2(x1, y1, actr);
+ checkMove2(x1, y1, actor);
if (x1 == OX && y1 == OY) {
FLAG = 0;
d = INIT_DIR;
- actr->_lastDir = d;
- actr->_nextFrame = 0;
+ actor->_lastDir = d;
+ actor->_nextFrame = 0;
goto done;
}
+ break;
+
+ default:
+ break;
}
- nextFrame(actr);
+ nextFrame(actor);
done:
- actr->_lastDir = d;
- if (actr->_directions == 1)
+ actor->_lastDir = d;
+ if (actor->_directions == 1)
return 0;
return d;
}
// Troll 1
-int movement_thirtynine(Actor *actr) {
+int movementThirtyNine(Actor *actor) {
if (_G(setup)._difficultyLevel == 0) {
- actr->_speed = 3;
- actr->_numMoves = 1;
+ actor->_speed = 3;
+ actor->_numMoves = 1;
} else if (_G(setup)._difficultyLevel == 1) {
- actr->_speed = 2;
- actr->_numMoves = 1;
+ actor->_speed = 2;
+ actor->_numMoves = 1;
} else if (_G(setup)._difficultyLevel == 2) {
- actr->_speed = 1;
- actr->_numMoves = 1;
+ actor->_speed = 1;
+ actor->_numMoves = 1;
}
- if (actr->_passValue < 5)
- return movement_forty(actr);
- if (actr->_passValue == 10) {
- if (overlap(actr->_x + 1, actr->_y + 1, actr->_x + actr->_sizeX - 1,
- actr->_y + actr->_sizeY - 1, _G(thor_x1), _G(thor_y1), _G(thor_x2), _G(thor_y2))) {
- actr->_hitStrength = 255;
- thor_damaged(actr);
+ if (actor->_passValue < 5)
+ return movementForty(actor);
+
+ if (actor->_passValue == 10) {
+ if (overlap(actor->_x + 1, actor->_y + 1, actor->_x + actor->_sizeX - 1,
+ actor->_y + actor->_sizeY - 1, _G(thor_x1), _G(thor_y1), _G(thor_x2), _G(thor_y2))) {
+ actor->_hitStrength = 255;
+ thorDamaged(actor);
}
- return actr->_dir;
+ return actor->_dir;
}
- if (actr->_actorNum != 3)
- return actr->_dir;
+ if (actor->_actorNum != 3)
+ return actor->_dir;
- if (actr->_i1) {
- actr->_i1--;
- actr->_x -= 2;
- check_move2(actr->_x, actr->_y, actr);
+ if (actor->_i1) {
+ actor->_i1--;
+ actor->_x -= 2;
+ checkMove2(actor->_x, actor->_y, actor);
_G(actor[4])._x -= 2;
_G(actor[5])._x -= 2;
_G(actor[6])._x -= 2;
}
- nextFrame(actr);
- if (actr->_nextFrame == 3)
- actr->_nextFrame = 0;
+ nextFrame(actor);
+ if (actor->_nextFrame == 3)
+ actor->_nextFrame = 0;
_G(actor[4])._nextFrame = _G(actor[3])._nextFrame;
_G(actor[5])._nextFrame = 0;
_G(actor[6])._nextFrame = 0;
- return actr->_dir;
+ return actor->_dir;
}
// Troll 2
-int movement_forty(Actor *actr) {
- if (overlap(actr->_x + 1, actr->_y + 1, actr->_x + actr->_sizeX + 3,
- actr->_y + actr->_sizeY - 1, _G(thor_x1), _G(thor_y1), _G(thor_x2), _G(thor_y2))) {
- actr->_hitStrength = 150;
- thor_damaged(actr);
- }
- int a = 5 + (actr->_passValue * 4);
- const int x1 = actr->_x;
- int d = actr->_lastDir;
-
- if (actr->_lastDir == 2) {
- if (backgroundTile(x1 - 2, actr->_y) >= TILE_SOLID) {
+int movementForty(Actor *actor) {
+ if (overlap(actor->_x + 1, actor->_y + 1, actor->_x + actor->_sizeX + 3,
+ actor->_y + actor->_sizeY - 1, _G(thor_x1), _G(thor_y1), _G(thor_x2), _G(thor_y2))) {
+ actor->_hitStrength = 150;
+ thorDamaged(actor);
+ }
+ int a = 5 + (actor->_passValue * 4);
+ const int x1 = actor->_x;
+ int d = actor->_lastDir;
+
+ if (actor->_lastDir == 2) {
+ if (backgroundTile(x1 - 2, actor->_y) >= TILE_SOLID) {
_G(actor[a]._x) -= 2;
_G(actor[a - 1])._x -= 2;
_G(actor[a - 2])._x -= 2;
@@ -2489,20 +2600,20 @@ int movement_forty(Actor *actr) {
} else
d = 2;
- if (actr->_nextFrame == 3 && !actr->_currNumShots && actr->_frameCount == actr->_frameSpeed) {
- actor_always_shoots(actr, 1);
- _G(actor[actr->_shotActor])._x += 6;
+ if (actor->_nextFrame == 3 && !actor->_currNumShots && actor->_frameCount == actor->_frameSpeed) {
+ actorAlwaysShoots(actor, 1);
+ _G(actor[actor->_shotActor])._x += 6;
}
- nextFrame(actr);
- _G(actor[a - 2])._nextFrame = actr->_nextFrame;
- _G(actor[a - 1])._nextFrame = actr->_nextFrame;
- _G(actor[a + 1])._nextFrame = actr->_nextFrame;
+ nextFrame(actor);
+ _G(actor[a - 2])._nextFrame = actor->_nextFrame;
+ _G(actor[a - 1])._nextFrame = actor->_nextFrame;
+ _G(actor[a + 1])._nextFrame = actor->_nextFrame;
_G(actor[a - 2])._lastDir = d;
_G(actor[a - 1])._lastDir = d;
_G(actor[a + 1])._lastDir = d;
- actr->_lastDir = d;
- if (actr->_directions == 1)
+ actor->_lastDir = d;
+ if (actor->_directions == 1)
return 0;
return d;
}
diff --git a/engines/got/game/move_patterns.h b/engines/got/game/move_patterns.h
index 9bb501ef4ee..4a793d79270 100644
--- a/engines/got/game/move_patterns.h
+++ b/engines/got/game/move_patterns.h
@@ -26,11 +26,11 @@
namespace Got {
-extern int (*const movement_func[]) (Actor *actr);
-int check_move2(int x, int y, Actor *actr);
-int check_move3(int x, int y, Actor *actr);
-int check_move4(int x, int y, Actor *actr);
-void set_thor_vars();
+extern int (*const _movementFunc[]) (Actor *actor);
+int checkMove2(int x, int y, Actor *actor);
+int checkMove3(int x, int y, Actor *actor);
+int checkMove4(int x, int y, Actor *actor);
+void setThorVars();
} // namespace Got
diff --git a/engines/got/game/object.cpp b/engines/got/game/object.cpp
index 931e495d726..f87c397b77e 100644
--- a/engines/got/game/object.cpp
+++ b/engines/got/game/object.cpp
@@ -356,7 +356,7 @@ int use_tornado(int flag) {
}
}
if (_G(thor_info)._magic < 1) {
- actor_destroyed(&_G(actor[2]));
+ actorDestroyed(&_G(actor[2]));
_G(tornado_used) = false;
not_enough_magic();
return 0;
@@ -382,7 +382,7 @@ void use_item() {
int kf = _G(key_flag[key_magic]);
if (!kf && _G(tornado_used)) {
- actor_destroyed(&_G(actor[2]));
+ actorDestroyed(&_G(actor[2]));
_G(tornado_used) = false;
}
diff --git a/engines/got/game/shot_movement.cpp b/engines/got/game/shot_movement.cpp
index 482bca57895..61033a139d4 100644
--- a/engines/got/game/shot_movement.cpp
+++ b/engines/got/game/shot_movement.cpp
@@ -81,7 +81,7 @@ void next_shot_frame(Actor *actr) {
int shot_movement_none(Actor *actr) {
actr->_temp3--;
if (!actr->_temp3) {
- actor_destroyed(actr);
+ actorDestroyed(actr);
if (_G(actor[actr->_creator])._currNumShots)
_G(actor[actr->_creator])._currNumShots--;
}
@@ -117,8 +117,8 @@ int shot_movement_one(Actor *actr) {
break;
}
- if (!check_move3(x1, y1, actr)) {
- actor_destroyed(actr);
+ if (!checkMove3(x1, y1, actr)) {
+ actorDestroyed(actr);
if (_G(actor[actr->_creator])._currNumShots)
_G(actor[actr->_creator])._currNumShots--;
} else {
@@ -157,8 +157,8 @@ int shot_movement_two(Actor *actr) {
y1 = actr->_y;
break;
}
- if (!check_move4(x1, y1, actr)) {
- actor_destroyed(actr);
+ if (!checkMove4(x1, y1, actr)) {
+ actorDestroyed(actr);
if (_G(actor[actr->_creator])._currNumShots)
_G(actor[actr->_creator])._currNumShots--;
} else {
@@ -184,7 +184,7 @@ int shot_movement_three(Actor *actr) {
actr->_x, actr->_y, actr->_x + 15, actr->_y + 15)) {
actr->_moveType = 0;
actr->_speed = 6;
- thor_damaged(actr);
+ thorDamaged(actr);
actr->_x += 2;
}
if (!actr->_temp4) {
@@ -194,7 +194,7 @@ int shot_movement_three(Actor *actr) {
actr->_moveType = 0;
}
if (!actr->_temp3) {
- actor_destroyed(actr);
+ actorDestroyed(actr);
if (_G(actor[actr->_creator])._currNumShots)
_G(actor[actr->_creator])._currNumShots--;
} else {
@@ -211,7 +211,7 @@ int shot_movement_four(Actor *actr) {
if (actr->_temp1) {
actr->_temp1--;
if (!actr->_temp1) {
- actor_destroyed(actr);
+ actorDestroyed(actr);
_G(apple_drop++);
if (_G(apple_drop) == 4) {
if (_drop_obj(actr, 5))
@@ -225,8 +225,8 @@ int shot_movement_four(Actor *actr) {
}
if (overlap(_G(thor)->_x - 1, _G(thor)->_y - 1, _G(thor_x2) + 1, _G(thor_y2) + 1,
actr->_x, actr->_y, actr->_x + 15, actr->_y + 15)) {
- thor_damaged(actr);
- actor_destroyed(actr);
+ thorDamaged(actr);
+ actorDestroyed(actr);
return 0;
}
@@ -264,7 +264,7 @@ int shot_movement_four(Actor *actr) {
d = 3;
x1 += xd;
y1 += yd;
- if (check_move3(x1, y1, actr)) {
+ if (checkMove3(x1, y1, actr)) {
nextFrame(actr);
actr->_lastDir = d;
if (actr->_directions == 1)
@@ -287,7 +287,7 @@ int shot_movement_four(Actor *actr) {
if (actr->_toggle) {
if (xd) {
x1 += xd;
- if (check_move3(x1, y1, actr)) {
+ if (checkMove3(x1, y1, actr)) {
if (xd > 0)
d = 3;
else
@@ -302,7 +302,7 @@ int shot_movement_four(Actor *actr) {
}
if (yd) {
y1 += yd;
- if (check_move3(x1, y1, actr)) {
+ if (checkMove3(x1, y1, actr)) {
if (yd > 0)
d = 1;
else
@@ -317,7 +317,7 @@ int shot_movement_four(Actor *actr) {
} else {
if (yd) {
y1 += yd;
- if (check_move3(x1, y1, actr)) {
+ if (checkMove3(x1, y1, actr)) {
if (yd > 0)
d = 1;
else
@@ -332,7 +332,7 @@ int shot_movement_four(Actor *actr) {
}
if (xd) {
x1 += xd;
- if (check_move3(x1, y1, actr)) {
+ if (checkMove3(x1, y1, actr)) {
if (xd > 0)
d = 3;
else
@@ -345,7 +345,7 @@ int shot_movement_four(Actor *actr) {
}
}
}
- check_move3(actr->_x, actr->_y, actr);
+ checkMove3(actr->_x, actr->_y, actr);
nextFrame(actr);
actr->_lastDir = d;
if (actr->_directions == 1)
@@ -365,7 +365,7 @@ int shot_movement_five(Actor *actr) {
int shot_movement_six(Actor *actr) {
actr->_temp1--;
if (!actr->_temp1) {
- actor_destroyed(actr);
+ actorDestroyed(actr);
if (_G(actor[actr->_creator])._currNumShots)
_G(actor[actr->_creator])._currNumShots--;
} else
@@ -392,7 +392,7 @@ int shot_movement_seven(Actor *actr) {
}
if (overlap(actr->_x, actr->_y, actr->_x + actr->_sizeX, actr->_y + actr->_sizeY,
_G(thor)->_x, _G(thor)->_y + 4, _G(thor)->_x + 15, _G(thor)->_y + 15))
- thor_damaged(actr);
+ thorDamaged(actr);
actr->_temp2++;
if (actr->_temp2 > 2) {
@@ -473,11 +473,11 @@ int shot_movement_eight(Actor *actr) {
if (!actr->_dead)
if (_G(actor[actr->_creator])._currNumShots)
_G(actor[actr->_creator])._currNumShots--;
- actor_destroyed(actr);
+ actorDestroyed(actr);
}
if (overlap(actr->_x, actr->_y, actr->_x + actr->_sizeX, actr->_y + actr->_sizeY,
_G(thor)->_x, _G(thor)->_y + 4, _G(thor)->_x + 15, _G(thor)->_y + 15))
- thor_damaged(actr);
+ thorDamaged(actr);
actr->_x = x;
actr->_y = y;
@@ -493,7 +493,7 @@ int shot_movement_nine(Actor *actr) {
actr->_nextFrame++;
if (actr->_nextFrame == 3) {
_G(actor[actr->_creator])._currNumShots--;
- actor_destroyed(actr);
+ actorDestroyed(actr);
return 0;
}
if (actr->_directions == 1)
@@ -508,13 +508,13 @@ int shot_movement_ten(Actor *actr) {
if (overlap(actr->_x, actr->_y, actr->_x + actr->_sizeX, actr->_y + actr->_sizeY,
_G(thor)->_x, _G(thor)->_y + 4, _G(thor)->_x + 15, _G(thor)->_y + 15)) {
- thor_damaged(actr);
+ thorDamaged(actr);
f = 1;
}
if ((actr->_y > 160) || f) {
if (_G(actor[actr->_creator])._currNumShots)
_G(actor[actr->_creator])._currNumShots--;
- actor_destroyed(actr);
+ actorDestroyed(actr);
}
return 0;
@@ -585,10 +585,10 @@ int shot_movement_eleven(Actor *actr) {
}
}
- if (!check_move3(x1, y1, actr)) {
+ if (!checkMove3(x1, y1, actr)) {
if (_G(actor[actr->_creator])._currNumShots)
_G(actor[actr->_creator])._currNumShots--;
- actor_destroyed(actr);
+ actorDestroyed(actr);
} else
nextFrame(actr);
@@ -631,7 +631,7 @@ int shot_movement_twelve(Actor *actr) {
actr->_nextFrame = 2;
} else {
if (overlap(x1 + 2, y1 + 2, x1 + 14, y1 + 14, _G(thor_x1), _G(thor_y1), _G(thor_x2), _G(thor_y2))) {
- thor_damaged(actr);
+ thorDamaged(actr);
}
actr->_x = x1;
actr->_y = y1;
@@ -683,7 +683,7 @@ int shot_movement_thirteen(Actor *actr) {
if (!actr->_temp4) {
if (_G(actor[actr->_creator])._currNumShots)
_G(actor[actr->_creator])._currNumShots--;
- actor_destroyed(actr);
+ actorDestroyed(actr);
_G(apple_drop++);
if (_G(apple_drop) > 4) {
if (_drop_obj(actr, 5))
@@ -702,7 +702,7 @@ int shot_movement_thirteen(Actor *actr) {
YA = 0 - YA;
} else {
if (overlap(x1 + 4, y1 + 4, x1 + 12, y1 + 12, _G(thor_x1), _G(thor_y1), _G(thor_x2), _G(thor_y2))) {
- thor_damaged(actr);
+ thorDamaged(actr);
}
actr->_x = x1;
actr->_y = y1;
diff --git a/engines/got/game/shot_pattern.cpp b/engines/got/game/shot_pattern.cpp
index dd24a0ee9d2..55ea6e4e234 100644
--- a/engines/got/game/shot_pattern.cpp
+++ b/engines/got/game/shot_pattern.cpp
@@ -58,7 +58,7 @@ int shot_pattern_one(Actor *actr) {
case 0:
if (ABS(_G(thor_x1) - actr->_x) < 8) {
if (actr->_y > _G(thor_real_y1)) { //r
- if (actor_shoots(actr, 0))
+ if (actorShoots(actr, 0))
return 1;
}
}
@@ -66,7 +66,7 @@ int shot_pattern_one(Actor *actr) {
case 1:
if (ABS(_G(thor_x1) - actr->_x) < 8) {
if (actr->_y < _G(thor_real_y1)) { //r
- if (actor_shoots(actr, 1))
+ if (actorShoots(actr, 1))
return 1;
}
}
@@ -74,7 +74,7 @@ int shot_pattern_one(Actor *actr) {
case 2:
if (ABS(_G(thor_real_y1) - actr->_y) < 8) { //r
if (actr->_x > _G(thor_x1)) {
- if (actor_shoots(actr, 2))
+ if (actorShoots(actr, 2))
return 1;
}
}
@@ -82,7 +82,7 @@ int shot_pattern_one(Actor *actr) {
case 3:
if (ABS(_G(thor_real_y1) - actr->_y) < 8) { //r
if (actr->_x < _G(thor_x1)) {
- if (actor_shoots(actr, 3))
+ if (actorShoots(actr, 3))
return 1;
}
}
@@ -96,16 +96,16 @@ int shot_pattern_one(Actor *actr) {
int shot_pattern_two(Actor *actr) {
if (ABS(_G(thor)->_x - actr->_x) < 8) {
if (_G(thor)->_y > actr->_y)
- actor_shoots(actr, 1);
+ actorShoots(actr, 1);
else if (_G(thor)->_y < actr->_y)
- actor_shoots(actr, 0);
+ actorShoots(actr, 0);
else
return 0;
} else if (ABS(_G(thor)->_y - actr->_y) < 8) {
if (_G(thor)->_x > actr->_x)
- actor_shoots(actr, 3);
+ actorShoots(actr, 3);
else if (_G(thor)->_x < actr->_x)
- actor_shoots(actr, 2);
+ actorShoots(actr, 2);
} else {
return 0;
}
@@ -117,11 +117,11 @@ int shot_pattern_two(Actor *actr) {
int shot_pattern_three(Actor *actr) {
int ld = actr->_lastDir;
if (shot_pattern_one(actr)) {
- actr->_lastDir = reverse_direction(actr);
+ actr->_lastDir = reverseDirection(actr);
return 1;
}
- actr->_lastDir = reverse_direction(actr);
+ actr->_lastDir = reverseDirection(actr);
shot_pattern_one(actr);
actr->_lastDir = ld;
@@ -132,16 +132,16 @@ int shot_pattern_three(Actor *actr) {
int shot_pattern_four(Actor *actr) {
if (ABS(_G(thor)->_x - actr->_x) < 8) {
if (_G(thor)->_y > actr->_y)
- actor_always_shoots(actr, 1);
+ actorAlwaysShoots(actr, 1);
else if (_G(thor)->_y < actr->_y)
- actor_always_shoots(actr, 0);
+ actorAlwaysShoots(actr, 0);
else
return 0;
} else if (ABS(_G(thor)->_y - actr->_y) < 8) {
if (_G(thor)->_x > actr->_x)
- actor_always_shoots(actr, 3);
+ actorAlwaysShoots(actr, 3);
else if (_G(thor)->_x < actr->_x)
- actor_always_shoots(actr, 2);
+ actorAlwaysShoots(actr, 2);
} else {
return 0;
}
@@ -154,7 +154,7 @@ int shot_pattern_five(Actor *actr) {
if (_G(rand1) < 15 && (actr->_temp1 == 0) && (actr->_temp2 == 0)) {
actr->_y += 16;
actr->_numShotsAllowed = 3 + _G(setup)._difficultyLevel;
- actor_shoots(actr, 2);
+ actorShoots(actr, 2);
play_sound(BOSS12, false);
int num = actr->_shotActor;
@@ -174,13 +174,13 @@ int shot_pattern_six(Actor *actr) {
int pos = ((actr->_x) / 16) + (((actr->_y) / 16) * 20);
if (_G(thor_pos) == pos - 20)
- actor_shoots(actr, 0);
+ actorShoots(actr, 0);
else if (_G(thor_pos) == pos + 20)
- actor_shoots(actr, 1);
+ actorShoots(actr, 1);
else if (_G(thor_pos) == pos - 1)
- actor_shoots(actr, 2);
+ actorShoots(actr, 2);
else if (_G(thor_pos) == pos + 1)
- actor_shoots(actr, 3);
+ actorShoots(actr, 3);
else
return 0;
@@ -206,7 +206,7 @@ int shot_pattern_eight(Actor *actr) {
} else if (_G(rand1) < 10) {
actr->_i1 = actr->_funcPass;
actr->_i2 = _G(thor_real_y1);
- actor_shoots(actr, 0);
+ actorShoots(actr, 0);
return 1;
}
diff --git a/engines/got/got.cpp b/engines/got/got.cpp
index 4d70712455f..23b0b1da8a9 100644
--- a/engines/got/got.cpp
+++ b/engines/got/got.cpp
@@ -219,7 +219,7 @@ void GotEngine::pauseEngineIntern(bool pause) {
if (_G(tornado_used)) {
_G(tornado_used) = false;
- actor_destroyed(&_G(actor[2]));
+ actorDestroyed(&_G(actor[2]));
}
if (_G(shield_on)) {
diff --git a/engines/got/views/game.cpp b/engines/got/views/game.cpp
index e4fa14f282f..fb81a861b2d 100644
--- a/engines/got/views/game.cpp
+++ b/engines/got/views/game.cpp
@@ -91,7 +91,7 @@ bool Game::msgAction(const ActionMessage &msg) {
switch (msg._action) {
case KEYBIND_FIRE:
- thor_shoots();
+ thorShoots();
break;
case KEYBIND_SELECT:
diff --git a/engines/got/views/game_content.cpp b/engines/got/views/game_content.cpp
index 50e117b7b43..94aba352393 100644
--- a/engines/got/views/game_content.cpp
+++ b/engines/got/views/game_content.cpp
@@ -315,7 +315,7 @@ void GameContent::checkThunderShake() {
int thunderFl = _G(thunder_flag);
if (_G(actor[thunderFl])._active) {
_G(actor[thunderFl])._vulnerableCountdown = 0;
- actor_damaged(&_G(actor[thunderFl]), 20);
+ actorDamaged(&_G(actor[thunderFl]), 20);
}
}
@@ -360,10 +360,10 @@ void GameContent::moveActors() {
_G(actor[i])._moveCount = _G(actor[i])._numMoves;
while (_G(actor[i])._moveCount--)
- move_actor(&_G(actor[i]));
+ moveActor(&_G(actor[i]));
if (i == 0)
- set_thor_vars();
+ setThorVars();
if (_G(new_level) != _G(current_level))
return;
@@ -564,7 +564,7 @@ void GameContent::thorDead() {
_deathCtr = 0;
showLevel(_G(new_level));
- set_thor_vars();
+ setThorVars();
}
void GameContent::checkForCheats() {
@@ -635,7 +635,7 @@ void GameContent::placePixel(GfxSurface &s, int dir, int num) {
return;
}
- if (point_within(_pixelX[dir][num], _pixelY[dir][num], 0, 0, 319, 191)) {
+ if (pointWithin(_pixelX[dir][num], _pixelY[dir][num], 0, 0, 319, 191)) {
byte *pixel = (byte *)s.getBasePtr(_pixelX[dir][num],
_pixelY[dir][num]);
*pixel = _pixelC[dir];
@@ -682,7 +682,7 @@ void GameContent::lightningCountdownDone() {
if ((ABS(ax - x) < 30) && (ABS(ay - y) < 30)) {
_G(actor[i])._magicHit = 1;
_G(actor[i])._vulnerableCountdown = 0;
- actor_damaged(&_G(actor[i]), 254);
+ actorDamaged(&_G(actor[i]), 254);
}
}
}
More information about the Scummvm-git-logs
mailing list