aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStrangerke2013-01-02 15:04:12 +0100
committerStrangerke2013-01-02 15:04:12 +0100
commit74d1e3e0137bfdc49936054999c2b3bd9d011e8a (patch)
treee69b3f969546afd63c0e4cbd4556d571e39f033c
parent682e70623ac864037e9b81b4215202cdece09bed (diff)
downloadscummvm-rg350-74d1e3e0137bfdc49936054999c2b3bd9d011e8a.tar.gz
scummvm-rg350-74d1e3e0137bfdc49936054999c2b3bd9d011e8a.tar.bz2
scummvm-rg350-74d1e3e0137bfdc49936054999c2b3bd9d011e8a.zip
HOPKINS: fix errors in ajoute_ligne, add comments on the impossible check
-rw-r--r--engines/hopkins/lines.cpp38
1 files changed, 22 insertions, 16 deletions
diff --git a/engines/hopkins/lines.cpp b/engines/hopkins/lines.cpp
index 710ff6c3ab..78096fcf38 100644
--- a/engines/hopkins/lines.cpp
+++ b/engines/hopkins/lines.cpp
@@ -225,6 +225,7 @@ void LinesManager::AJOUTE_LIGNE(int idx, int a2, int a3, int a4, int a5, int a6,
if (idx > 400)
error("Attempting to add a line obstacle > MAX_LIGNE.");
+
if (_linesNumb < idx)
_linesNumb = idx;
@@ -297,19 +298,20 @@ void LinesManager::AJOUTE_LIGNE(int idx, int a2, int a3, int a4, int a5, int a6,
Ligne[idx].field8 = 4;
}
}
- if (v11 == 1 && (unsigned int)(v37 - 251) <= 748) {
+ if (v11 == 1 && v37 > 250 && v37 <= 999) {
Ligne[idx].field6 = 4;
Ligne[idx].field8 = 8;
}
- if (v11 == -1 && (unsigned int)(v37 - 251) <= 748) {
+ if (v11 == -1 && v37 > 250 && v37 <= 999) {
Ligne[idx].field6 = 6;
Ligne[idx].field8 = 2;
}
- if (v11 == 1 && (unsigned int)(v37 + 999) <= 748) {
+ if (v11 == 1 && v37 < -250 && v37 > -1000) {
Ligne[idx].field6 = 2;
Ligne[idx].field8 = 6;
}
- // CHECKME: v37 conditions are impossible to meet!
+ // This copndition is impossible to meet!
+ // Code present in the Linux and BeOS executables
if (v11 == -1 && v37 <= 249 && v37 > 1000) {
Ligne[idx].field6 = 8;
Ligne[idx].field8 = 4;
@@ -348,7 +350,6 @@ void LinesManager::AJOUTE_LIGNE(int idx, int a2, int a3, int a4, int a5, int a6,
}
// Line Collision 2
-// TODO: Should return a bool
bool LinesManager::colision2_ligne(int a1, int a2, int *a3, int *a4, int a5, int a6) {
int16 *v7;
int16 *v13;
@@ -374,24 +375,29 @@ bool LinesManager::colision2_ligne(int a1, int a2, int *a3, int *a4, int a5, int
int v16 = v7[1];
int v10 = v7[v8 - 2];
int v18 = v7[v8 - 1];
- if (v7[0] >= v10)
- goto LABEL_32;
- if (v22 < v9 || v21 > v10)
- v23 = 0;
- if (v9 >= v10) {
-LABEL_32:
+ if (v7[0] >= v10) {
if (v21 > v9 || v22 < v10)
v23 = 0;
+ } else {
+ if (v22 < v9 || v21 > v10)
+ v23 = 0;
+ if (v9 >= v10) {
+ if (v21 > v9 || v22 < v10)
+ v23 = 0;
+ }
}
- if (v16 >= v18)
- goto LABEL_33;
- if (v20 < v16 || v19 > v18)
- v23 = 0;
if (v16 >= v18) {
-LABEL_33:
if (v19 > v16 || v20 < v18)
v23 = 0;
+ } else {
+ if (v20 < v16 || v19 > v18)
+ v23 = 0;
+ if (v16 >= v18) {
+ if (v19 > v16 || v20 < v18)
+ v23 = 0;
+ }
}
+
if (v23 == 1) {
v11 = 0;
v17 = Ligne[v24].field0;