HOPKINS: Clean up some 'for' statements

This commit is contained in:
Strangerke 2012-11-21 08:04:50 +01:00
parent ec81dfb655
commit 8e376ccc81
4 changed files with 50 additions and 129 deletions

View File

@ -873,7 +873,6 @@ void AnimationManager::RECHERCHE_ANIM(const byte *data, int animIndex, int count
int v11;
int v12;
int v13;
int v14;
int v15;
int v16;
int v17;
@ -929,8 +928,7 @@ void AnimationManager::RECHERCHE_ANIM(const byte *data, int animIndex, int count
WRITE_LE_UINT16(dataP + 26, v12);
*(dataP + 28) = v13;
v14 = 1;
do {
for (int v14 = 1; v14 <= 4999; v14++) {
v9 += 10;
v23 += 10;
if (!v22)
@ -947,8 +945,7 @@ void AnimationManager::RECHERCHE_ANIM(const byte *data, int animIndex, int count
WRITE_LE_UINT16(v9 + 4, v22);
WRITE_LE_UINT16(v9 + 6, v16);
*(v9 + 8) = v17;
++v14;
} while (v14 <= 4999);
}
v3 = 1;
}
}

View File

@ -742,20 +742,17 @@ void ComputerManager::AFF_BRIQUES() {
}
void ComputerManager::AFF_VIE() {
int v0;
int v1;
int v2;
int v3;
int v4;
v0 = CASSEVIE - 1;
v1 = 10;
v2 = 0;
do {
int v0 = CASSEVIE - 1;
int v1 = 10;
for (int v2 = 0; v2 <= 11; v2++) {
_vm->_graphicsManager.AFFICHE_SPEEDVGA(CASSESPR, v1, 10, 15);
v1 += 7;
++v2;
} while (v2 <= 11);
}
if (v0) {
v3 = 10;
v4 = 0;
@ -851,11 +848,8 @@ void ComputerManager::PLAY_BRIQUE() {
int ComputerManager::HIGHT_SCORE() {
int v0;
int v1;
int v2;
int v3;
int v4;
int v6;
byte *ptr;
_vm->_graphicsManager.RESET_SEGMENT_VESA();
@ -867,22 +861,18 @@ int ComputerManager::HIGHT_SCORE() {
_vm->_graphicsManager.SETCOLOR3(253, 100, 100, 100);
_vm->_graphicsManager.SETCOLOR3(251, 100, 100, 100);
_vm->_graphicsManager.SETCOLOR3(254, 0, 0, 0);
v6 = 0;
do {
for (int v6 = 0; v6 <= 5; v6++) {
v0 = 19 * v6;
v0 = v0 + 46;
v1 = 0;
do {
v0 += 46;
for (int v1 = 0; v1 <= 5; v1++)
PRINT_HSCORE(ptr, 9 * v1 + 69, v0, Score[v6].name[v1]);
++v1;
} while (v1 <= 5);
v2 = 0;
do {
for (int v2 = 0; v2 <= 8; v2++)
PRINT_HSCORE(ptr, 9 * v2 + 199, v0, Score[v6].score[v2]);
++v2;
} while (v2 <= 8);
++v6;
} while (v6 <= 5);
}
_vm->_graphicsManager.FADE_IN_CASSE();
_vm->_graphicsManager.RESET_SEGMENT_VESA();
v3 = 0;
@ -915,8 +905,7 @@ void ComputerManager::NAME_SCORE() {
_vm->_fileManager.CONSTRUIT_SYSTEM("ALPHA.SPR");
ptr = _vm->_fileManager.CHARGE_FICHIER(_vm->_globals.NFICHIER);
_vm->_graphicsManager.FADE_IN_CASSE();
int strPos = 0;
do {
for (int strPos = 0; strPos <= 4; strPos++) {
PRINT_HSCORE(ptr, 9 * strPos + 140, 78, 1);
curChar = toupper(_vm->_eventsManager.keywin());
@ -940,8 +929,7 @@ void ComputerManager::NAME_SCORE() {
_vm->_eventsManager.VBL();
_vm->_eventsManager.VBL();
_vm->_eventsManager.VBL();
++strPos;
} while (strPos <= 4);
}
Score[5].score = " ";
char score[16];
@ -1020,77 +1008,65 @@ void ComputerManager::IMPSCORE(int a1, int a2) {
}
void ComputerManager::SAUVE_SCORE() {
int v0;
int v1;
int v2;
int v3;
int v4;
int v5;
int v6;
int v7;
char v8;
int v9;
int v10;
char v11;
int v13;
int v14;
byte *ptr;
int v16[6];
int v17[6];
v0 = 0;
do {
for (int v0 = 0; v0 <= 5; v0++) {
v1 = atol(Score[v0].score.c_str());
v17[v0] = v1;
if (!v1)
v17[v0] = 5;
++v0;
} while (v0 <= 5);
v13 = 0;
do {
}
for (int v13 = 0; v13 <= 5; v13++) {
v2 = 0;
v3 = 0;
bool v3 = false;
do {
v4 = v17[v2];
if (v4 && v17[0] <= v4 && v17[1] <= v4 && v17[2] <= v4 && v17[3] <= v4
&& v17[4] <= v4 && v17[5] <= v4)
v3 = 1;
if (v3 == 1) {
v3 = true;
if (v3) {
v16[v13] = v2;
v17[v2] = 0;
} else {
++v2;
}
} while (v3 != 1);
++v13;
} while (v13 <= 5);
} while (!v3);
}
ptr = _vm->_globals.dos_malloc2(0x64u);
memset(ptr, 0, 0x63u);
v5 = 0;
do {
for (int v5 = 0; v5 <= 5; v5++) {
v6 = 16 * v5;
v14 = v16[v5];
v7 = 0;
do {
for (int v7 = 0; v7 <= 4; v7++) {
v8 = Score[v14].name[v7];
if (!v8)
v8 = 32;
*(ptr + (16 * v5) + v7++) = v8;
} while (v7 <= 4);
*(ptr + (16 * v5) + v7) = v8;
};
*(ptr + v6 + 5) = 0;
v9 = v6 + 6;
v10 = 0;
do {
for (int v10 = 0; v10 <= 8; v10++) {
v11 = Score[v14].score[v10];
if (!v11)
v11 = 48;
*(ptr + v9 + v10++) = v11;
} while (v10 <= 8);
*(ptr + v9 + v10) = v11;
};
*(ptr + v9 + 9) = 0;
++v5;
} while (v5 <= 5);
}
_vm->_fileManager.CONSTRUIT_LINUX("HISCORE.DAT");
_vm->_saveLoadManager.SAUVE_FICHIER(_vm->_globals.NFICHIER, ptr, 0x64u);

View File

@ -301,10 +301,8 @@ void DialogsManager::showOptionsDialog() {
}
void DialogsManager::showInventory() {
int v1;
size_t filesize;
int v4;
int v5;
int v6;
byte *v7;
int v8;
@ -313,7 +311,6 @@ void DialogsManager::showInventory() {
int v11;
int v12;
int v13;
int v14;
int v15;
int v16;
int v17;
@ -327,14 +324,12 @@ void DialogsManager::showInventory() {
_vm->_graphicsManager.no_scroll = 1;
_vm->_objectsManager.FLAG_VISIBLE_EFFACE = 4;
_vm->_objectsManager.FLAG_VISIBLE = false;
v1 = 0;
do {
for (int v1 = 0; v1 <= 1; v1++) {
INVENT_ANIM();
_vm->_eventsManager.XMOUSE();
_vm->_eventsManager.YMOUSE();
_vm->_eventsManager.VBL();
++v1;
} while (v1 <= 1);
}
_vm->_dialogsManager.Winventaire = g_PTRNUL;
LABEL_7:
@ -376,11 +371,9 @@ LABEL_7:
v19 + 300, 414, 0, 0, 0, 0);
v15 = 0;
v4 = 0;
v14 = 1;
do {
for (int v14 = 1; v14 <= 5; v14++) {
v16 = 0;
v5 = 1;
do {
for (int v5 = 1; v5 <= 6; v5++) {
++v4;
v6 = _vm->_globals.INVENTAIRE[v4];
if (v6 && v4 <= 29) {
@ -390,11 +383,9 @@ LABEL_7:
_vm->_globals.dos_free2(v7);
}
v16 += 54;
++v5;
} while (v5 <= 6);
};
v15 += 38;
++v14;
} while (v14 <= 5);
}
_vm->_graphicsManager.Capture_Mem(_vm->_graphicsManager.VESA_BUFFER, _vm->_dialogsManager.Winventaire, inventairex, inventairey, inventairel, inventaireh);
_vm->_eventsManager.souris_bb = 0;
v20 = 0;

View File

@ -1837,8 +1837,6 @@ void HopkinsEngine::PUBQUIT() {
}
void HopkinsEngine::INCENDIE() {
warning("INCENDIE()");
_globals.DESACTIVE_INVENT = true;
_globals.iRegul = 1;
_graphicsManager.LOAD_IMAGE("IM71");
@ -1850,31 +1848,22 @@ void HopkinsEngine::INCENDIE() {
_graphicsManager.VISU_ALL();
_globals.BPP_NOAFF = true;
int cpt = 0;
do {
for (int cpt = 0; cpt <= 4; cpt++)
_eventsManager.VBL();
++cpt;
} while (cpt <= 4);
_globals.BPP_NOAFF = false;
_graphicsManager.FADE_INW();
_globals.iRegul = 1;
cpt = 0;
do {
for (int cpt = 0; cpt <= 249; cpt++)
_eventsManager.VBL();
++cpt;
} while (cpt <= 249);
_globals.NOPARLE = true;
_talkManager.PARLER_PERSO("SVGARD1.pe2");
_globals.NOPARLE = false;
cpt = 0;
do {
for (int cpt = 0; cpt <= 49; cpt++)
_eventsManager.VBL();
++cpt;
} while (cpt <= 49);
_graphicsManager.FADE_OUTW();
_graphicsManager.FIN_VISU();
@ -1883,8 +1872,6 @@ void HopkinsEngine::INCENDIE() {
}
void HopkinsEngine::BASE() {
warning("BASE()");
_globals.iRegul = 1;
_graphicsManager.nbrligne = 640;
_graphicsManager.DD_Lock();
@ -1919,8 +1906,7 @@ void HopkinsEngine::BASE() {
_graphicsManager.FADE_LINUX = 2;
_animationManager.PLAY_ANM("OC30.anm", 10, 18, 18);
}
}
if (_globals.SVGA == 2) {
} else if (_globals.SVGA == 2) {
_animationManager.PLAY_ANM("base00a.anm", 10, 18, 18);
if (!_eventsManager.ESC_KEY)
_animationManager.PLAY_ANM("base05a.anm", 10, 18, 18);
@ -1955,8 +1941,6 @@ void HopkinsEngine::BASE() {
}
void HopkinsEngine::BASED() {
warning("BASED()");
_graphicsManager.DD_Lock();
_graphicsManager.Cls_Video();
_graphicsManager.DD_Unlock();
@ -1975,11 +1959,8 @@ void HopkinsEngine::BASED() {
_objectsManager.INILINK("IM92");
_globals.BPP_NOAFF = true;
int cpt = 0;
do {
for (int cpt = 0; cpt <= 4; cpt++)
_eventsManager.VBL();
++cpt;
} while (cpt <= 4);
_globals.BPP_NOAFF = false;
_graphicsManager.FADE_INW();
@ -1998,8 +1979,6 @@ void HopkinsEngine::BASED() {
}
void HopkinsEngine::JOUE_FIN() {
warning("JOUE_FIN()");
_globals.PERSO = _globals.dos_free2(_globals.PERSO);
_dialogsManager.VIRE_INVENT = true;
_globals.DESACTIVE_INVENT = true;
@ -2027,11 +2006,8 @@ void HopkinsEngine::JOUE_FIN() {
_eventsManager.CHANGE_MOUSE(0);
_globals.BPP_NOAFF = true;
int cpt = 0;
do {
for (int cpt = 0; cpt <= 4; cpt++)
_eventsManager.VBL();
++cpt;
} while (cpt <= 4);
_globals.BPP_NOAFF = false;
_graphicsManager.FADE_INW();
@ -2158,8 +2134,6 @@ void HopkinsEngine::JOUE_FIN() {
}
void HopkinsEngine::AVION() {
warning("AVION()");
_soundManager.WSOUND(28);
_globals.iRegul = 1;
_globals.nbrligne = 640;
@ -2240,8 +2214,6 @@ void HopkinsEngine::AVION() {
}
int HopkinsEngine::PWBASE() {
warning("PWBASE()");
_globals.DESACTIVE_INVENT = true;
_graphicsManager.LOAD_IMAGE("PBASE");
_graphicsManager.SETCOLOR3(252, 100, 100, 100);
@ -2321,8 +2293,6 @@ int HopkinsEngine::PWBASE() {
}
void HopkinsEngine::Charge_Credits() {
warning("Charge_Credits()");
_globals.Credit_y = 440;
_globals.Credit_l = 10;
_globals.Credit_h = 40;
@ -2387,8 +2357,6 @@ void HopkinsEngine::Charge_Credits() {
}
void HopkinsEngine::CREDIT_AFFICHE(int startPosY, byte *buffer, char colour) {
warning("CREDIT_AFFICHE");
byte *bufPtr = buffer;
int strWidth = 0;
byte curChar;
@ -2430,8 +2398,6 @@ void HopkinsEngine::CREDIT_AFFICHE(int startPosY, byte *buffer, char colour) {
}
void HopkinsEngine::Credits() {
warning("Credits()");
Charge_Credits();
_globals.Credit_y = 436;
_graphicsManager.LOAD_IMAGE("GENERIC");
@ -2494,8 +2460,6 @@ void HopkinsEngine::Credits() {
}
void HopkinsEngine::BTOCEAN() {
warning("BTOCEAN()");
_fontManager.TEXTE_OFF(9);
if (_eventsManager.btsouris == 16) {
_eventsManager.XMOUSE();
@ -2684,8 +2648,6 @@ LABEL_91:
}
void HopkinsEngine::OCEAN_HOME() {
warning("OCEAN_HOME()");
if (_globals.OCEAN_SENS == 3)
_objectsManager.SETANISPR(0, 0);
if (_globals.OCEAN_SENS == 7)
@ -2697,8 +2659,6 @@ void HopkinsEngine::OCEAN_HOME() {
}
void HopkinsEngine::OCEAN(int16 a1, Common::String a2, Common::String a3, int16 a4, int16 a5, int16 a6, int16 a7, int16 a8, int16 a9) {
warning("OCEAN()");
_globals.PLAN_FLAG = false;
_graphicsManager.NOFADE = false;
_globals.NOMARCHE = false;
@ -2757,11 +2717,8 @@ void HopkinsEngine::OCEAN(int16 a1, Common::String a2, Common::String a3, int16
_eventsManager.MOUSE_ON();
_eventsManager.CHANGE_MOUSE(4);
int cpt = 0;
do {
for (int cpt = 0; cpt <= 4; cpt++)
_eventsManager.VBL();
++cpt;
} while (cpt <= 4);
if (!_graphicsManager.NOFADE)
_graphicsManager.FADE_INW();