aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStrangerke2016-09-01 07:48:01 +0200
committerStrangerke2016-09-01 07:48:01 +0200
commit40da6882afba07f598fc8b023d14427808e3c1a7 (patch)
treebd4eead06819f3cbde9544473a9f4da5b5d62f5d
parentdeca60efc9bf1ce4a6321603741e478820e04e1b (diff)
downloadscummvm-rg350-40da6882afba07f598fc8b023d14427808e3c1a7.tar.gz
scummvm-rg350-40da6882afba07f598fc8b023d14427808e3c1a7.tar.bz2
scummvm-rg350-40da6882afba07f598fc8b023d14427808e3c1a7.zip
DM: Remove GOTOs in fluxCageAction
-rw-r--r--engines/dm/group.cpp43
1 files changed, 18 insertions, 25 deletions
diff --git a/engines/dm/group.cpp b/engines/dm/group.cpp
index 31313c4dff..5321d0edf4 100644
--- a/engines/dm/group.cpp
+++ b/engines/dm/group.cpp
@@ -1892,35 +1892,28 @@ void GroupMan::fluxCageAction(int16 mapX, int16 mapY) {
newEvent._B._location._mapY = mapY;
newEvent._B._location._mapY = mapY;
_vm->_timeline->addEventGetEventIndex(&newEvent);
- int16 AL0546_i_FluxcageCount;
+ int16 fluxcageCount;
if (isLordChaosOnSquare(mapX, mapY - 1)) {
mapY--;
- AL0546_i_FluxcageCount = isFluxcageOnSquare(mapX + 1, mapY);
- goto T0224005;
- }
- if (isLordChaosOnSquare(mapX - 1, mapY)) {
+ fluxcageCount = isFluxcageOnSquare(mapX + 1, mapY);
+ fluxcageCount += isFluxcageOnSquare(mapX, mapY - 1) + isFluxcageOnSquare(mapX - 1, mapY);
+ } else if (isLordChaosOnSquare(mapX - 1, mapY)) {
mapX--;
- AL0546_i_FluxcageCount = isFluxcageOnSquare(mapX, mapY + 1);
-T0224005:
- AL0546_i_FluxcageCount += isFluxcageOnSquare(mapX, mapY - 1) + isFluxcageOnSquare(mapX - 1, mapY);
- } else {
- if (isLordChaosOnSquare(mapX + 1, mapY)) {
- mapX++;
- AL0546_i_FluxcageCount = isFluxcageOnSquare(mapX, mapY - 1);
- goto T0224008;
- }
- if (isLordChaosOnSquare(mapX, mapY + 1)) {
- mapY++;
- AL0546_i_FluxcageCount = isFluxcageOnSquare(mapX - 1, mapY);
-T0224008:
- AL0546_i_FluxcageCount += isFluxcageOnSquare(mapX, mapY + 1) + isFluxcageOnSquare(mapX + 1, mapY);
- } else {
- AL0546_i_FluxcageCount = 0;
- }
- }
- if (AL0546_i_FluxcageCount == 2) {
+ fluxcageCount = isFluxcageOnSquare(mapX, mapY + 1);
+ fluxcageCount += isFluxcageOnSquare(mapX, mapY - 1) + isFluxcageOnSquare(mapX - 1, mapY);
+ } else if (isLordChaosOnSquare(mapX + 1, mapY)) {
+ mapX++;
+ fluxcageCount = isFluxcageOnSquare(mapX, mapY - 1);
+ fluxcageCount += isFluxcageOnSquare(mapX, mapY + 1) + isFluxcageOnSquare(mapX + 1, mapY);
+ } else if (isLordChaosOnSquare(mapX, mapY + 1)) {
+ mapY++;
+ fluxcageCount = isFluxcageOnSquare(mapX - 1, mapY);
+ fluxcageCount += isFluxcageOnSquare(mapX, mapY + 1) + isFluxcageOnSquare(mapX + 1, mapY);
+ } else
+ fluxcageCount = 0;
+
+ if (fluxcageCount == 2)
processEvents29to41(mapX, mapY, kM3_TMEventTypeCreateReactionEvent29DangerOnSquare, 0);
- }
}
uint16 GroupMan::isLordChaosOnSquare(int16 mapX, int16 mapY) {