aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
Diffstat (limited to 'engines')
-rw-r--r--engines/hopkins/computer.cpp8
-rw-r--r--engines/hopkins/globals.h2
-rw-r--r--engines/hopkins/hopkins.cpp34
-rw-r--r--engines/hopkins/objects.cpp27
-rw-r--r--engines/hopkins/script.cpp4
5 files changed, 34 insertions, 41 deletions
diff --git a/engines/hopkins/computer.cpp b/engines/hopkins/computer.cpp
index b16b64c246..373c023c86 100644
--- a/engines/hopkins/computer.cpp
+++ b/engines/hopkins/computer.cpp
@@ -559,11 +559,9 @@ void ComputerManager::LIT_TEXTE(int a1) {
}
void ComputerManager::GAMES() {
- const byte *v1;
- int v2;
+ const byte *v1 = _vm->_objectsManager.Sprite[0].spriteData;
+ uint oldSpeed = _vm->_globals.vitesse;
- v1 = _vm->_objectsManager.Sprite[0].spriteData;
- v2 = _vm->_globals.vitesse;
_vm->_globals.vitesse = 1;
_vm->_eventsManager.CHANGE_MOUSE(0);
CASSESPR = g_PTRNUL;
@@ -599,7 +597,7 @@ void ComputerManager::GAMES() {
_vm->_soundManager.DEL_SAMPLE(1);
_vm->_soundManager.DEL_SAMPLE(2);
_vm->_soundManager.DEL_SAMPLE(3);
- _vm->_globals.vitesse = v2;
+ _vm->_globals.vitesse = oldSpeed;
_vm->_eventsManager.CASSE = false;
_vm->_eventsManager.CASSE_SOURIS_OFF();
setvideomode();
diff --git a/engines/hopkins/globals.h b/engines/hopkins/globals.h
index abde148e20..131c48cb4c 100644
--- a/engines/hopkins/globals.h
+++ b/engines/hopkins/globals.h
@@ -347,7 +347,7 @@ public:
bool XFORCE8;
bool CARD_SB;
int PERSO_TYPE;
- int vitesse;
+ uint vitesse;
int INSTALL_TYPE;
Common::String HOPIMAGE;
Common::String HOPANIM;
diff --git a/engines/hopkins/hopkins.cpp b/engines/hopkins/hopkins.cpp
index 4b2497fc22..d04b926f08 100644
--- a/engines/hopkins/hopkins.cpp
+++ b/engines/hopkins/hopkins.cpp
@@ -1888,7 +1888,7 @@ void HopkinsEngine::INTRORUN() {
_globals.BPP_NOAFF = false;
_globals.iRegul = 1;
_graphicsManager.FADE_INW();
- for (int i = 0; i < 200 / _globals.vitesse; ++i)
+ for (uint i = 0; i < 200 / _globals.vitesse; ++i)
_eventsManager.VBL();
_objectsManager.BOBANIM_ON(3);
@@ -1973,23 +1973,23 @@ void HopkinsEngine::INTRORUN() {
v9 += 2;
if (v9 > 15) {
_graphicsManager.setpal_vga256_linux(paletteData, _graphicsManager.VESA_BUFFER);
- for (int j = 1; j < 100 / _globals.vitesse; ++j)
+ for (uint j = 1; j < 100 / _globals.vitesse; ++j)
_eventsManager.VBL();
_objectsManager.BOBANIM_ON(3);
_soundManager.VOICE_MIX(7, 3);
_objectsManager.BOBANIM_OFF(3);
- for (int k = 1; k < 60 / _globals.vitesse; ++k)
+ for (uint k = 1; k < 60 / _globals.vitesse; ++k)
_eventsManager.VBL();
_objectsManager.BOBANIM_ON(5);
- for (int l = 0; l < 20 / _globals.vitesse; ++l)
+ for (uint l = 0; l < 20 / _globals.vitesse; ++l)
_eventsManager.VBL();
Common::copy(&paletteData2[0], &paletteData2[PALETTE_BLOCK_SIZE], &_graphicsManager.Palette[0]);
_graphicsManager.setpal_vga256_linux(_graphicsManager.Palette, _graphicsManager.VESA_BUFFER);
- for (int m = 0; m < 50 / _globals.vitesse; ++m) {
+ for (uint m = 0; m < 50 / _globals.vitesse; ++m) {
if (m == 30 / _globals.vitesse) {
_objectsManager.BOBANIM_ON(3);
_soundManager.VOICE_MIX(8, 3);
@@ -2807,9 +2807,9 @@ void HopkinsEngine::BTOCEAN() {
while (1) {
if (_globals.vitesse == 1)
oldX -= 2;
- if (_globals.vitesse == 2)
+ else if (_globals.vitesse == 2)
oldX -= 4;
- if (_globals.vitesse == 3)
+ else if (_globals.vitesse == 3)
oldX -= 6;
_objectsManager.SETXSPR(0, oldX);
OCEAN_HOME();
@@ -2839,9 +2839,9 @@ LABEL_22:
while (1) {
if (_globals.vitesse == 1)
oldX += 2;
- if (_globals.vitesse == 2)
+ else if (_globals.vitesse == 2)
oldX += 4;
- if (_globals.vitesse == 3)
+ else if (_globals.vitesse == 3)
oldX += 6;
_objectsManager.SETXSPR(0, oldX);
OCEAN_HOME();
@@ -2864,9 +2864,9 @@ LABEL_41:
do {
if (_globals.vitesse == 1)
oldX += 2;
- if (_globals.vitesse == 2)
+ else if (_globals.vitesse == 2)
oldX += 4;
- if (_globals.vitesse == 3)
+ else if (_globals.vitesse == 3)
oldX += 6;
_objectsManager.SETXSPR(0, oldX);
OCEAN_HOME();
@@ -2889,9 +2889,9 @@ LABEL_57:
do {
if (_globals.vitesse == 1)
oldX -= 2;
- if (_globals.vitesse == 2)
+ else if (_globals.vitesse == 2)
oldX -= 4;
- if (_globals.vitesse == 3)
+ else if (_globals.vitesse == 3)
oldX -= 6;
_objectsManager.SETXSPR(0, oldX);
OCEAN_HOME();
@@ -2920,9 +2920,9 @@ LABEL_72:
do {
if (_globals.vitesse == 1)
oldX += 2;
- if (_globals.vitesse == 2)
+ else if (_globals.vitesse == 2)
oldX += 4;
- if (_globals.vitesse == 3)
+ else if (_globals.vitesse == 3)
oldX += 6;
_objectsManager.SETXSPR(0, oldX);
OCEAN_HOME();
@@ -2945,9 +2945,9 @@ LABEL_91:
while (1) {
if (_globals.vitesse == 1)
oldX -= 2;
- if (_globals.vitesse == 2)
+ else if (_globals.vitesse == 2)
oldX -= 4;
- if (_globals.vitesse == 3)
+ else if (_globals.vitesse == 3)
oldX -= 6;
_objectsManager.SETXSPR(0, oldX);
OCEAN_HOME();
diff --git a/engines/hopkins/objects.cpp b/engines/hopkins/objects.cpp
index 767decdded..c42feb7791 100644
--- a/engines/hopkins/objects.cpp
+++ b/engines/hopkins/objects.cpp
@@ -1164,7 +1164,7 @@ void ObjectsManager::AFF_BOB_ANIM() {
int v1;
int v2;
int v5;
- int v6;
+ uint v6;
int v7;
int v8;
int v10;
@@ -1269,6 +1269,7 @@ LABEL_38:
if (v10 > 0) {
v11 = v10 / _vm->_globals.vitesse;
_vm->_globals.Bob[idx].field12 = v10 / _vm->_globals.vitesse;
+ // Original code. It can't be negative, so the check is on == 0
if (v11 <= 0)
_vm->_globals.Bob[idx].field12 = 1;
}
@@ -2263,14 +2264,13 @@ LABEL_153:
}
void ObjectsManager::GOHOME2() {
- signed int v0;
int16 v2;
- v0 = 2;
if (_vm->_globals.chemin != (int16 *)g_PTRNUL) {
+ int v0 = 2;
if (_vm->_globals.vitesse == 2)
v0 = 4;
- if (_vm->_globals.vitesse == 3)
+ else if (_vm->_globals.vitesse == 3)
v0 = 6;
_vm->_globals.j_104 = 0;
if (v0) {
@@ -3152,19 +3152,14 @@ void ObjectsManager::CHANGE_TETE(PlayerCharacter oldCharacter, PlayerCharacter n
// Check Size
void ObjectsManager::VERIFTAILLE() {
- int v0;
- int v1;
- int v2;
-
- v0 = _vm->_globals.STAILLE[YSPR(0)];
+ int v0 = _vm->_globals.STAILLE[YSPR(0)];
if (_vm->_globals.PERSO_TYPE == 1) {
- v1 = v0;
+ int v1 = v0;
if (v0 < 0)
v1 = -v0;
v0 = 20 * (5 * v1 - 100) / -80;
- }
- if (_vm->_globals.PERSO_TYPE == 2) {
- v2 = v0;
+ } else if (_vm->_globals.PERSO_TYPE == 2) {
+ int v2 = v0;
if (v0 < 0)
v2 = -v0;
v0 = 20 * (5 * v2 - 165) / -67;
@@ -5217,7 +5212,7 @@ void ObjectsManager::ACTION(const byte *spriteData, const Common::String &a2, in
v19 = " ";
if (_vm->_globals.vitesse == 2)
v15 = a5 / 2;
- if (_vm->_globals.vitesse == 3)
+ else if (_vm->_globals.vitesse == 3)
v15 = a5 / 3;
v14 = Sprite[0].spriteData;
spriteIndex = Sprite[0].spriteIndex;
@@ -5284,7 +5279,7 @@ void ObjectsManager::SPACTION(byte *a1, const Common::String &animationSeq, int
v14 = a5;
if (_vm->_globals.vitesse == 2)
v14 = a5 / 2;
- if (_vm->_globals.vitesse == 3)
+ else if (_vm->_globals.vitesse == 3)
v14 = a5 / 3;
S_old_spr = Sprite[0].spriteData;
S_old_ani = Sprite[0].spriteIndex;
@@ -5351,7 +5346,7 @@ void ObjectsManager::SPACTION1(byte *a1, const Common::String &a2, int a3, int a
v13 = a5;
if (_vm->_globals.vitesse == 2)
v13 = a5 / 2;
- if (_vm->_globals.vitesse == 3)
+ else if (_vm->_globals.vitesse == 3)
v13 = a5 / 3;
while (1) {
v6 = 0;
diff --git a/engines/hopkins/script.cpp b/engines/hopkins/script.cpp
index 8330c1ea43..d0b086c6e7 100644
--- a/engines/hopkins/script.cpp
+++ b/engines/hopkins/script.cpp
@@ -479,11 +479,11 @@ LABEL_1141:
if (*(a1 + 2) == 'M' && *(a1 + 3) == 'U' && *(a1 + 4) == 'S')
v1 = 1;
if (*(a1 + 2) == 'W' && *(a1 + 3) == 'A' && *(a1 + 4) == 'I') {
- int v74 = (int16)READ_LE_UINT16(a1 + 5) / _vm->_globals.vitesse;
+ uint v74 = READ_LE_UINT16(a1 + 5) / _vm->_globals.vitesse;
if (!v74)
v74 = 1;
if (v74 + 1 > 0) {
- for (int v10 = 0; v10 < v74 + 1; v10++) {
+ for (uint v10 = 0; v10 < v74 + 1; v10++) {
if (_vm->shouldQuit())
return -1; // Exiting game