[Scummvm-cvs-logs] SF.net SVN: scummvm: [32379] scummvm/trunk/engines/drascula/drascula.cpp
thebluegr at users.sourceforge.net
thebluegr at users.sourceforge.net
Fri May 30 10:00:43 CEST 2008
Revision: 32379
http://scummvm.svn.sourceforge.net/scummvm/?rev=32379&view=rev
Author: thebluegr
Date: 2008-05-30 01:00:42 -0700 (Fri, 30 May 2008)
Log Message:
-----------
Untangling spaghetti code: removed several goto statements
Modified Paths:
--------------
scummvm/trunk/engines/drascula/drascula.cpp
Modified: scummvm/trunk/engines/drascula/drascula.cpp
===================================================================
--- scummvm/trunk/engines/drascula/drascula.cpp 2008-05-30 07:26:55 UTC (rev 32378)
+++ scummvm/trunk/engines/drascula/drascula.cpp 2008-05-30 08:00:42 UTC (rev 32379)
@@ -928,8 +928,9 @@
if (num_ejec == 2) {
getLine(ald, buffer, size);
sscanf(buffer, "%d", &martin);
- if (martin == 0)
- goto martini;
+ }
+
+ if (num_ejec == 2 && martin != 0) {
ancho_hare = martin;
getLine(ald, buffer, size);
sscanf(buffer, "%d",&alto_hare);
@@ -959,8 +960,6 @@
strcpy(menuBackground, pant4);
}
-martini:
-
getLine(ald, buffer, size);
sscanf(buffer, "%d", &numRoomObjs);
@@ -1183,7 +1182,9 @@
if (hare_se_ve == 0) {
hare_x = sitio_x;
hare_y = sitio_y;
- goto fin;
+ updateRoom();
+ updateScreen(0, 0, 0, 0, 320, 200, screenSurface);
+ return;
}
}
sitio_x = pointX;
@@ -1201,7 +1202,6 @@
walkToObject = 0;
sentido_hare = sentido_final;
}
-fin:
updateRoom();
updateScreen(0, 0, 0, 0, 320, 200, screenSurface);
}
@@ -2187,33 +2187,32 @@
if (num_ejec == 3)
y = -1;
-comienza:
- counter--;
+ do {
+ counter--;
- updateRoom();
- if (num_ejec == 3)
- updateScreen(0, 0, 0, y, 320, 200, screenSurface);
- else
- updateScreen(0, 1, 0, y, 320, 198, screenSurface);
+ updateRoom();
+ if (num_ejec == 3)
+ updateScreen(0, 0, 0, y, 320, 200, screenSurface);
+ else
+ updateScreen(0, 1, 0, y, 320, 198, screenSurface);
- if (sentido == 0)
- y++;
- else
- y--;
+ if (sentido == 0)
+ y++;
+ else
+ y--;
- if (num_ejec == 3) {
- if (y == 1)
- sentido = 1;
- if (y == -1)
- sentido = 0;
- } else {
- if (y == 2)
- sentido = 1;
- if (y == 0)
- sentido = 0;
- }
- if (counter > 0)
- goto comienza;
+ if (num_ejec == 3) {
+ if (y == 1)
+ sentido = 1;
+ if (y == -1)
+ sentido = 0;
+ } else {
+ if (y == 2)
+ sentido = 1;
+ if (y == 0)
+ sentido = 0;
+ }
+ } while (counter > 0);
updateRoom();
updateScreen(0, 0, 0, 0, 320, 200, screenSurface);
@@ -2482,8 +2481,10 @@
}
if (num_ejec == 1 || num_ejec == 4 || num_ejec == 5 || num_ejec == 6) {
- if (hare_se_ve == 0)
- goto no_vuelco;
+ if (hare_se_ve == 0) {
+ increaseFrameNum();
+ return;
+ }
}
if (hare_se_mueve == 0) {
@@ -2563,8 +2564,6 @@
reduce_hare_chico(pos_hare[0], pos_hare[1], pos_hare[2], pos_hare[3], pos_hare[4], pos_hare[5],
factor_red[hare_y + alto_hare], frontSurface, screenSurface);
}
-
-no_vuelco:
increaseFrameNum();
}
}
@@ -2783,19 +2782,17 @@
menu_sin_volcar();
updateScreen(0, 0, 0, 0, 320, 200, screenSurface);
- if (pickedObject < 7)
- goto usando_verbos;
-
- for (n = 1; n < 43; n++) {
- if (whichObject() == n && inventoryObjects[n] == 0) {
- inventoryObjects[n] = h;
- takeObject = 0;
- checkFlags = 0;
+ // Objects with an ID smaller than 7 are the inventory verbs
+ if (pickedObject >= 7) {
+ for (n = 1; n < 43; n++) {
+ if (whichObject() == n && inventoryObjects[n] == 0) {
+ inventoryObjects[n] = h;
+ takeObject = 0;
+ checkFlags = 0;
+ }
}
}
-usando_verbos:
-
if (checkFlags == 1) {
if (checkMenuFlags())
return true;
@@ -4338,33 +4335,32 @@
if (num_ejec == 3)
y = -1;
-comienza:
- counter--;
+ do {
+ counter--;
- copyBackground(0, 0, 0, 0, 320, 200, drawSurface1, screenSurface);
- if (num_ejec == 3)
- updateScreen(0, 0, 0, y, 320, 200, screenSurface);
- else
- updateScreen(0, 1, 0, y, 320, 198, screenSurface);
+ copyBackground(0, 0, 0, 0, 320, 200, drawSurface1, screenSurface);
+ if (num_ejec == 3)
+ updateScreen(0, 0, 0, y, 320, 200, screenSurface);
+ else
+ updateScreen(0, 1, 0, y, 320, 198, screenSurface);
- if (sentido == 0)
- y++;
- else
- y--;
+ if (sentido == 0)
+ y++;
+ else
+ y--;
- if (num_ejec == 3) {
- if (y == 1)
- sentido = 1;
- if (y == -1)
- sentido = 0;
- } else {
- if (y == 2)
- sentido = 1;
- if (y == 0)
- sentido = 0;
- }
- if (counter > 0)
- goto comienza;
+ if (num_ejec == 3) {
+ if (y == 1)
+ sentido = 1;
+ if (y == -1)
+ sentido = 0;
+ } else {
+ if (y == 2)
+ sentido = 1;
+ if (y == 0)
+ sentido = 0;
+ }
+ } while (counter > 0);
copyBackground(0, 0, 0, 0, 320, 200, drawSurface1, screenSurface);
updateScreen(0, 0, 0, 0, 320, 200, screenSurface);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
More information about the Scummvm-git-logs
mailing list