InitJoysticks();
}
-static int getBeltNrFromElement(int element)
+static int getBeltNrFromBeltElement(int element)
{
return (element < EL_CONVEYOR_BELT2_LEFT ? 0 :
element < EL_CONVEYOR_BELT3_LEFT ? 1 :
element < EL_CONVEYOR_BELT4_LEFT ? 2 : 3);
}
-static int getBeltNrFromSwitchElement(int element)
+static int getBeltNrFromBeltActiveElement(int element)
+{
+ return (element < EL_CONVEYOR_BELT2_LEFT_ACTIVE ? 0 :
+ element < EL_CONVEYOR_BELT3_LEFT_ACTIVE ? 1 :
+ element < EL_CONVEYOR_BELT4_LEFT_ACTIVE ? 2 : 3);
+}
+
+static int getBeltNrFromBeltSwitchElement(int element)
{
return (element < EL_CONVEYOR_BELT2_SWITCH_LEFT ? 0 :
element < EL_CONVEYOR_BELT3_SWITCH_LEFT ? 1 :
element < EL_CONVEYOR_BELT4_SWITCH_LEFT ? 2 : 3);
}
-static int getBeltDirNrFromSwitchElement(int element)
+static int getBeltDirNrFromBeltSwitchElement(int element)
{
static int belt_base_element[4] =
{
EL_CONVEYOR_BELT4_SWITCH_LEFT
};
- int belt_nr = getBeltNrFromSwitchElement(element);
+ int belt_nr = getBeltNrFromBeltSwitchElement(element);
int belt_dir_nr = element - belt_base_element[belt_nr];
return (belt_dir_nr % 3);
}
-static int getBeltDirFromSwitchElement(int element)
+static int getBeltDirFromBeltSwitchElement(int element)
{
static int belt_move_dir[3] =
{
MV_RIGHT
};
- int belt_dir_nr = getBeltDirNrFromSwitchElement(element);
+ int belt_dir_nr = getBeltDirNrFromBeltSwitchElement(element);
return belt_move_dir[belt_dir_nr];
}
}
}
/* no break! */
- case EL_PLAYER:
- if (init_game)
- Feld[x][y] = EL_PLAYER1;
- /* no break! */
case EL_PLAYER1:
case EL_PLAYER2:
case EL_PLAYER3:
case EL_CONVEYOR_BELT4_SWITCH_RIGHT:
if (init_game)
{
- int belt_nr = getBeltNrFromSwitchElement(Feld[x][y]);
- int belt_dir = getBeltDirFromSwitchElement(Feld[x][y]);
- int belt_dir_nr = getBeltDirNrFromSwitchElement(Feld[x][y]);
+ int belt_nr = getBeltNrFromBeltSwitchElement(Feld[x][y]);
+ int belt_dir = getBeltDirFromBeltSwitchElement(Feld[x][y]);
+ int belt_dir_nr = getBeltDirNrFromBeltSwitchElement(Feld[x][y]);
if (game.belt_dir_nr[belt_nr] == 3) /* initial value */
{
RemoveMovingField(x, y);
}
- if (IS_MASSIVE(element) || element == EL_DRAGON_FIRE)
+ if (IS_MASSIVE(element) || element == EL_FLAMES)
continue;
if (IS_PLAYER(x, y) && SHIELD_ON(PLAYERINFO(x, y)))
if (IS_ACTIVE_BOMB(Feld[ex][ey]))
{
- player = &stored_player[Feld[ex][ey] - EL_DYNABOMB_ACTIVE_1];
+ player = &stored_player[Feld[ex][ey] - EL_DYNABOMB_PLAYER1_ACTIVE];
dynabomb_size = player->dynabomb_size;
dynabomb_xl = player->dynabomb_xl;
player->dynabombs_left++;
RaiseScoreElement(element);
Explode(x, y, EX_PHASE_START, EX_NORMAL);
break;
- case EL_DYNABOMB_ACTIVE_1:
- case EL_DYNABOMB_ACTIVE_2:
- case EL_DYNABOMB_ACTIVE_3:
- case EL_DYNABOMB_ACTIVE_4:
+ case EL_DYNABOMB_PLAYER1_ACTIVE:
+ case EL_DYNABOMB_PLAYER2_ACTIVE:
+ case EL_DYNABOMB_PLAYER3_ACTIVE:
+ case EL_DYNABOMB_PLAYER4_ACTIVE:
case EL_DYNABOMB_NR:
case EL_DYNABOMB_SZ:
case EL_DYNABOMB_XL:
static void ToggleBeltSwitch(int x, int y)
{
static int belt_base_element[4] =
+ {
+ EL_CONVEYOR_BELT1_LEFT,
+ EL_CONVEYOR_BELT2_LEFT,
+ EL_CONVEYOR_BELT3_LEFT,
+ EL_CONVEYOR_BELT4_LEFT
+ };
+ static int belt_base_active_element[4] =
+ {
+ EL_CONVEYOR_BELT1_LEFT_ACTIVE,
+ EL_CONVEYOR_BELT2_LEFT_ACTIVE,
+ EL_CONVEYOR_BELT3_LEFT_ACTIVE,
+ EL_CONVEYOR_BELT4_LEFT_ACTIVE
+ };
+ static int belt_base_switch_element[4] =
{
EL_CONVEYOR_BELT1_SWITCH_LEFT,
EL_CONVEYOR_BELT2_SWITCH_LEFT,
};
int element = Feld[x][y];
- int belt_nr = getBeltNrFromSwitchElement(element);
+ int belt_nr = getBeltNrFromBeltSwitchElement(element);
int belt_dir_nr = (game.belt_dir_nr[belt_nr] + 1) % 4;
int belt_dir = belt_move_dir[belt_dir_nr];
int xx, yy;
if (IS_BELT_SWITCH(element))
{
- int e_belt_nr = getBeltNrFromSwitchElement(element);
+ int e_belt_nr = getBeltNrFromBeltSwitchElement(element);
if (e_belt_nr == belt_nr)
{
- Feld[xx][yy] = belt_base_element[belt_nr] + belt_dir_nr;
+ Feld[xx][yy] = belt_base_switch_element[belt_nr] + belt_dir_nr;
DrawLevelField(xx, yy);
}
}
- else if (belt_dir == MV_NO_MOVING && IS_BELT(element))
+ else if (IS_BELT(element) && belt_dir != MV_NO_MOVING)
{
- int e_belt_nr = getBeltNrFromElement(element);
+ int e_belt_nr = getBeltNrFromBeltElement(element);
if (e_belt_nr == belt_nr)
- DrawLevelField(xx, yy); /* set belt to parking position */
+ {
+ int belt_part = Feld[xx][yy] - belt_base_element[belt_nr];
+
+ Feld[xx][yy] = belt_base_active_element[belt_nr] + belt_part;
+ DrawLevelField(xx, yy);
+ }
+ }
+ else if (IS_BELT_ACTIVE(element) && belt_dir == MV_NO_MOVING)
+ {
+ int e_belt_nr = getBeltNrFromBeltActiveElement(element);
+
+ if (e_belt_nr == belt_nr)
+ {
+ int belt_part = Feld[xx][yy] - belt_base_active_element[belt_nr];
+
+ Feld[xx][yy] = belt_base_element[belt_nr] + belt_part;
+ DrawLevelField(xx, yy);
+ }
}
}
}
}
}
+static int getInvisibleActiveFromInvisibleElement(int element)
+{
+ return (element == EL_INVISIBLE_STEELWALL ? EL_INVISIBLE_STEELWALL_ACTIVE :
+ element == EL_INVISIBLE_WALL ? EL_INVISIBLE_WALL_ACTIVE :
+ EL_INVISIBLE_SAND_ACTIVE);
+}
+
+static int getInvisibleFromInvisibleActiveElement(int element)
+{
+ return (element == EL_INVISIBLE_STEELWALL_ACTIVE ? EL_INVISIBLE_STEELWALL :
+ element == EL_INVISIBLE_WALL_ACTIVE ? EL_INVISIBLE_WALL :
+ EL_INVISIBLE_SAND);
+}
+
static void RedrawAllLightSwitchesAndInvisibleElements()
{
int x, y;
Feld[x][y] = EL_LIGHT_SWITCH;
DrawLevelField(x, y);
}
+ else if (element == EL_INVISIBLE_STEELWALL ||
+ element == EL_INVISIBLE_WALL ||
+ element == EL_INVISIBLE_SAND)
+ {
+ if (game.light_time_left > 0)
+ Feld[x][y] = getInvisibleActiveFromInvisibleElement(element);
+
+ DrawLevelField(x, y);
+ }
+ else if (element == EL_INVISIBLE_STEELWALL_ACTIVE ||
+ element == EL_INVISIBLE_WALL_ACTIVE ||
+ element == EL_INVISIBLE_SAND_ACTIVE)
+ {
+ if (game.light_time_left == 0)
+ Feld[x][y] = getInvisibleFromInvisibleActiveElement(element);
- if (element == EL_INVISIBLE_STEELWALL ||
- element == EL_INVISIBLE_WALL ||
- element == EL_INVISIBLE_SAND)
DrawLevelField(x, y);
+ }
}
}
}
{
int xx, yy;
int activated_magic_wall =
- (smashed == EL_MAGIC_WALL ? EL_MAGIC_WALL_EMPTY :
- EL_BD_MAGIC_WALL_EMPTY);
+ (smashed == EL_MAGIC_WALL ? EL_MAGIC_WALL_ACTIVE :
+ EL_BD_MAGIC_WALL_ACTIVE);
/* activate magic wall / mill */
for (yy=0; yy<lev_fieldy; yy++)
/* play sound of magic wall / mill */
if (!lastline &&
- (Feld[x][y+1] == EL_MAGIC_WALL_EMPTY ||
- Feld[x][y+1] == EL_BD_MAGIC_WALL_EMPTY))
+ (Feld[x][y+1] == EL_MAGIC_WALL_ACTIVE ||
+ Feld[x][y+1] == EL_BD_MAGIC_WALL_ACTIVE))
{
- if (Feld[x][y+1] == EL_MAGIC_WALL_EMPTY)
+ if (Feld[x][y+1] == EL_MAGIC_WALL_ACTIVE)
PlaySoundLevel(x, y, SND_MAGIC_WALL_CHANGING);
- else if (Feld[x][y+1] == EL_BD_MAGIC_WALL_EMPTY)
+ else if (Feld[x][y+1] == EL_BD_MAGIC_WALL_ACTIVE)
PlaySoundLevel(x, y, SND_BD_MAGIC_WALL_CHANGING);
return;
Feld[x][y] = EL_MAGIC_WALL_EMPTYING;
Store[x][y] = EL_CHANGED(Store[x][y]);
}
- else if (Feld[x][y+1] == EL_MAGIC_WALL_EMPTY)
+ else if (Feld[x][y+1] == EL_MAGIC_WALL_ACTIVE)
{
if (!MovDelay[x][y])
MovDelay[x][y] = TILEY/4 + 1;
return;
}
- Feld[x][y] = EL_MAGIC_WALL_EMPTY;
+ Feld[x][y] = EL_MAGIC_WALL_ACTIVE;
Feld[x][y+1] = EL_MAGIC_WALL_FULL;
Store[x][y+1] = EL_CHANGED(Store[x][y]);
Store[x][y] = 0;
Feld[x][y] = EL_BD_MAGIC_WALL_EMPTYING;
Store[x][y] = EL_CHANGED2(Store[x][y]);
}
- else if (Feld[x][y+1] == EL_BD_MAGIC_WALL_EMPTY)
+ else if (Feld[x][y+1] == EL_BD_MAGIC_WALL_ACTIVE)
{
if (!MovDelay[x][y])
MovDelay[x][y] = TILEY/4 + 1;
return;
}
- Feld[x][y] = EL_BD_MAGIC_WALL_EMPTY;
+ Feld[x][y] = EL_BD_MAGIC_WALL_ACTIVE;
Feld[x][y+1] = EL_BD_MAGIC_WALL_FULL;
Store[x][y+1] = EL_CHANGED2(Store[x][y]);
Store[x][y] = 0;
}
}
else if (CAN_CHANGE(element) &&
- (Feld[x][y+1] == EL_MAGIC_WALL_EMPTY ||
- Feld[x][y+1] == EL_BD_MAGIC_WALL_EMPTY))
+ (Feld[x][y+1] == EL_MAGIC_WALL_ACTIVE ||
+ Feld[x][y+1] == EL_BD_MAGIC_WALL_ACTIVE))
{
InitMovingField(x, y, MV_DOWN);
Feld[x][y] =
- (Feld[x][y+1] == EL_MAGIC_WALL_EMPTY ? EL_MAGIC_WALL_FILLING :
+ (Feld[x][y+1] == EL_MAGIC_WALL_ACTIVE ? EL_MAGIC_WALL_FILLING :
EL_BD_MAGIC_WALL_FILLING);
Store[x][y] = element;
}
InitMovingField(x, y, left ? MV_LEFT : MV_RIGHT);
}
}
- else if (IS_BELT(Feld[x][y+1]))
+ else if (IS_BELT_ACTIVE(Feld[x][y+1]))
{
boolean left_is_free = (x>0 && IS_FREE(x-1, y));
boolean right_is_free = (x<lev_fieldx-1 && IS_FREE(x+1, y));
- int belt_nr = getBeltNrFromElement(Feld[x][y+1]);
+ int belt_nr = getBeltNrFromBeltActiveElement(Feld[x][y+1]);
int belt_dir = game.belt_dir[belt_nr];
if ((belt_dir == MV_LEFT && left_is_free) ||
else
RemoveMovingField(xx, yy);
- Feld[xx][yy] = EL_DRAGON_FIRE;
+ Feld[xx][yy] = EL_FLAMES;
if (IN_SCR_FIELD(sx, sy))
DrawGraphic(sx, sy, graphic + phase*3 + i-1);
}
else
{
- if (Feld[xx][yy] == EL_DRAGON_FIRE)
+ if (Feld[xx][yy] == EL_FLAMES)
Feld[xx][yy] = EL_EMPTY;
DrawLevelField(xx, yy);
}
if ((wanna_flame || IS_ENEMY(element1) || IS_ENEMY(element2)) &&
element1 != EL_DRAGON && element2 != EL_DRAGON &&
- element1 != EL_DRAGON_FIRE && element2 != EL_DRAGON_FIRE)
+ element1 != EL_FLAMES && element2 != EL_FLAMES)
{
if (IS_PLAYER(x, y))
DrawPlayerField(x, y);
PlaySoundLevel(x, y, SND_DRAGON_ATTACKING);
MovDelay[x][y] = 50;
- Feld[newx][newy] = EL_DRAGON_FIRE;
+ Feld[newx][newy] = EL_FLAMES;
if (IN_LEV_FIELD(newx1, newy1) && Feld[newx1][newy1] == EL_EMPTY)
- Feld[newx1][newy1] = EL_DRAGON_FIRE;
+ Feld[newx1][newy1] = EL_FLAMES;
if (IN_LEV_FIELD(newx2, newy2) && Feld[newx2][newy2] == EL_EMPTY)
- Feld[newx2][newy2] = EL_DRAGON_FIRE;
+ Feld[newx2][newy2] = EL_FLAMES;
return;
}
}
element == EL_BD_MAGIC_WALL_EMPTYING)
step /= 2;
else if (CAN_FALL(element) && horiz_move &&
- y < lev_fieldy-1 && IS_BELT(Feld[x][y+1]))
+ y < lev_fieldy-1 && IS_BELT_ACTIVE(Feld[x][y+1]))
step /= 2;
else if (element == EL_SPRING_MOVING)
step*=2;
int xx = x + j*xy[i][0], yy = y + j*xy[i][1];
if (IN_LEV_FIELD(xx, yy) &&
- (Feld[xx][yy] == EL_DRAGON_FIRE || Feld[xx][yy] == EL_DRAGON))
+ (Feld[xx][yy] == EL_FLAMES || Feld[xx][yy] == EL_DRAGON))
{
if (Feld[xx][yy] == EL_DRAGON)
dragon_found = TRUE;
{
int xx = x + j*xy[i][0], yy = y + j*xy[i][1];
- if (IN_LEV_FIELD(xx, yy) && Feld[xx][yy] == EL_DRAGON_FIRE)
+ if (IN_LEV_FIELD(xx, yy) && Feld[xx][yy] == EL_FLAMES)
{
Feld[xx][yy] = EL_EMPTY;
DrawLevelField(xx, yy);
if (IS_PLAYER(xx, yy))
{
- PlaySoundLevel(x, y, SND_SP_BUGGY_BASE_ACTIVATING);
+ PlaySoundLevel(x, y, SND_SP_BUGGY_BASE_ACTIVE);
break;
}
}
static void DrawBeltAnimation(int x, int y, int element)
{
- int belt_nr = getBeltNrFromElement(element);
+ int belt_nr = getBeltNrFromBeltActiveElement(element);
int belt_dir = game.belt_dir[belt_nr];
if (belt_dir != MV_NO_MOVING)
element == EL_WALL_GROWING_Y ||
element == EL_WALL_GROWING_XY)
MauerAbleger(x, y);
- else if (element == EL_DRAGON_FIRE)
+ else if (element == EL_FLAMES)
CheckForDragon(x, y);
else if (element == EL_SP_BUGGY_BASE || element == EL_SP_BUGGY_BASE_ACTIVE)
CheckBuggyBase(x, y);
PlaySoundLevel(x, y, SND_SP_TERMINAL_ACTIVE);
#endif
}
- else if (IS_BELT(element))
+ else if (IS_BELT_ACTIVE(element))
DrawBeltAnimation(x, y, element);
else if (element == EL_SWITCHGATE_OPENING)
OpenSwitchgate(x, y);
int jx = local_player->jx, jy = local_player->jy;
if (element == EL_MAGIC_WALL_FULL ||
- element == EL_MAGIC_WALL_EMPTY ||
+ element == EL_MAGIC_WALL_ACTIVE ||
element == EL_MAGIC_WALL_EMPTYING)
{
SiebAktivieren(x, y, 1);
sieb = TRUE;
}
else if (element == EL_BD_MAGIC_WALL_FULL ||
- element == EL_BD_MAGIC_WALL_EMPTY ||
+ element == EL_BD_MAGIC_WALL_ACTIVE ||
element == EL_BD_MAGIC_WALL_EMPTYING)
{
SiebAktivieren(x, y, 2);
int element = Feld[sieb_x][sieb_y];
if (element == EL_BD_MAGIC_WALL_FULL ||
- element == EL_BD_MAGIC_WALL_EMPTY ||
+ element == EL_BD_MAGIC_WALL_ACTIVE ||
element == EL_BD_MAGIC_WALL_EMPTYING)
PlaySoundLevel(sieb_x, sieb_y, SND_BD_MAGIC_WALL_ACTIVE);
else
{
element = Feld[x][y];
- if (element == EL_MAGIC_WALL_EMPTY ||
+ if (element == EL_MAGIC_WALL_ACTIVE ||
element == EL_MAGIC_WALL_FULL)
{
Feld[x][y] = EL_MAGIC_WALL_DEAD;
DrawLevelField(x, y);
}
- else if (element == EL_BD_MAGIC_WALL_EMPTY ||
+ else if (element == EL_BD_MAGIC_WALL_ACTIVE ||
element == EL_BD_MAGIC_WALL_FULL)
{
Feld[x][y] = EL_BD_MAGIC_WALL_DEAD;
game.light_time_left--;
if (game.light_time_left == 0)
- {
- for (y=0; y<lev_fieldy; y++) for (x=0; x<lev_fieldx; x++)
- {
- element = Feld[x][y];
-
- if (element == EL_LIGHT_SWITCH_ACTIVE)
- {
- Feld[x][y] = EL_LIGHT_SWITCH;
- DrawLevelField(x, y);
- }
- else if (element == EL_INVISIBLE_STEELWALL ||
- element == EL_INVISIBLE_WALL ||
- element == EL_INVISIBLE_SAND)
- DrawLevelField(x, y);
- }
- }
+ RedrawAllLightSwitchesAndInvisibleElements();
}
if (game.timegate_time_left > 0)
if (element == EL_ACID && dx == 0 && dy == 1)
{
Blurb(jx, jy);
- Feld[jx][jy] = EL_PLAYER;
+ Feld[jx][jy] = EL_PLAYER1;
InitMovingField(jx, jy, MV_DOWN);
Store[jx][jy] = EL_ACID;
ContinueMoving(jx, jy);
case EL_EMPTY:
case EL_SAND:
case EL_INVISIBLE_SAND:
+ case EL_INVISIBLE_SAND_ACTIVE:
case EL_TRAP:
case EL_SP_BASE:
case EL_SP_BUGGY_BASE:
}
else
{
- Feld[jx][jy] = EL_DYNABOMB_ACTIVE_1 + (player->element_nr - EL_PLAYER1);
+ Feld[jx][jy] =
+ EL_DYNABOMB_PLAYER1_ACTIVE + (player->element_nr - EL_PLAYER1);
MovDelay[jx][jy] = 96;
player->dynabombs_left--;
if (IN_SCR_FIELD(SCREENX(jx), SCREENY(jy)))