Skip to content

Commit

Permalink
HOPKINS: Use an unsigned int for speed variable
Browse files Browse the repository at this point in the history
  • Loading branch information
Strangerke committed Dec 2, 2012
1 parent a23813f commit 4631b46
Show file tree
Hide file tree
Showing 5 changed files with 34 additions and 41 deletions.
8 changes: 3 additions & 5 deletions engines/hopkins/computer.cpp
Expand Up @@ -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;
Expand Down Expand Up @@ -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();
Expand Down
2 changes: 1 addition & 1 deletion engines/hopkins/globals.h
Expand Up @@ -347,7 +347,7 @@ class Globals {
bool XFORCE8;
bool CARD_SB;
int PERSO_TYPE;
int vitesse;
uint vitesse;
int INSTALL_TYPE;
Common::String HOPIMAGE;
Common::String HOPANIM;
Expand Down
34 changes: 17 additions & 17 deletions engines/hopkins/hopkins.cpp
Expand Up @@ -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);
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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();
Expand Down Expand Up @@ -2839,9 +2839,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();
Expand All @@ -2864,9 +2864,9 @@ void HopkinsEngine::BTOCEAN() {
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();
Expand All @@ -2889,9 +2889,9 @@ void HopkinsEngine::BTOCEAN() {
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();
Expand Down Expand Up @@ -2920,9 +2920,9 @@ void HopkinsEngine::BTOCEAN() {
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();
Expand All @@ -2945,9 +2945,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();
Expand Down
27 changes: 11 additions & 16 deletions engines/hopkins/objects.cpp
Expand Up @@ -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;
Expand Down Expand Up @@ -1269,6 +1269,7 @@ void ObjectsManager::AFF_BOB_ANIM() {
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;
}
Expand Down Expand Up @@ -2263,14 +2264,13 @@ void ObjectsManager::GOHOME() {
}

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) {
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down
4 changes: 2 additions & 2 deletions engines/hopkins/script.cpp
Expand Up @@ -479,11 +479,11 @@ int ScriptManager::Traduction(byte *a1) {
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

Expand Down

0 comments on commit 4631b46

Please sign in to comment.