projects
/
rocksndiamonds.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
fixed bug when using different normal and deadly shield time
[rocksndiamonds.git]
/
src
/
game.c
diff --git
a/src/game.c
b/src/game.c
index aff7972a58dc70b9f1e6ed620c77e2b6cacd2c48..4b7533ad779cabe27e85c770da5dae961eaf2378 100644
(file)
--- a/
src/game.c
+++ b/
src/game.c
@@
-1554,6
+1554,14
@@
access_direction_list[] =
{ EL_UNDEFINED, MV_NONE }
};
{ EL_UNDEFINED, MV_NONE }
};
+static struct XY xy_topdown[] =
+{
+ { 0, -1 },
+ { -1, 0 },
+ { +1, 0 },
+ { 0, +1 }
+};
+
static boolean trigger_events[MAX_NUM_ELEMENTS][NUM_CHANGE_EVENTS];
#define IS_AUTO_CHANGING(e) (element_info[e].has_change_event[CE_DELAY])
static boolean trigger_events[MAX_NUM_ELEMENTS][NUM_CHANGE_EVENTS];
#define IS_AUTO_CHANGING(e) (element_info[e].has_change_event[CE_DELAY])
@@
-2239,7
+2247,7
@@
static void UpdateGameControlValues(void)
game_sp.time_played :
level.game_engine_type == GAME_ENGINE_TYPE_MM ?
game_mm.energy_left :
game_sp.time_played :
level.game_engine_type == GAME_ENGINE_TYPE_MM ?
game_mm.energy_left :
- game.no_time_limit ? TimePlayed : TimeLeft);
+ game.no_
level_
time_limit ? TimePlayed : TimeLeft);
int score = (game.LevelSolved ?
game.LevelSolved_CountingScore :
level.game_engine_type == GAME_ENGINE_TYPE_EM ?
int score = (game.LevelSolved ?
game.LevelSolved_CountingScore :
level.game_engine_type == GAME_ENGINE_TYPE_EM ?
@@
-3680,7
+3688,8
@@
void InitGame(void)
player->can_fall_into_acid = CAN_MOVE_INTO_ACID(player->element_nr);
player->can_fall_into_acid = CAN_MOVE_INTO_ACID(player->element_nr);
- player->actual_frame_counter = 0;
+ player->actual_frame_counter.count = 0;
+ player->actual_frame_counter.value = 1;
player->step_counter = 0;
player->step_counter = 0;
@@
-3818,7
+3827,8
@@
void InitGame(void)
game.panel.active = TRUE;
game.panel.active = TRUE;
- game.no_time_limit = (level.time == 0);
+ game.no_level_time_limit = (level.time == 0);
+ game.time_limit = (leveldir_current->time_limit && setup.time_limit);
game.yamyam_content_nr = 0;
game.robot_wheel_active = FALSE;
game.yamyam_content_nr = 0;
game.robot_wheel_active = FALSE;
@@
-4726,7
+4736,7
@@
void InitAmoebaNr(int x, int y)
static void LevelSolved_SetFinalGameValues(void)
{
static void LevelSolved_SetFinalGameValues(void)
{
- game.time_final = (game.no_time_limit ? TimePlayed : TimeLeft);
+ game.time_final = (game.no_
level_
time_limit ? TimePlayed : TimeLeft);
game.score_time_final = (level.use_step_counter ? TimePlayed :
TimePlayed * FRAMES_PER_SECOND + TimeFrames);
game.score_time_final = (level.use_step_counter ? TimePlayed :
TimePlayed * FRAMES_PER_SECOND + TimeFrames);
@@
-4835,7
+4845,7
@@
void GameWon(void)
time_final = 0;
time_frames = time_frames_left;
}
time_final = 0;
time_frames = time_frames_left;
}
- else if (game.no_time_limit && TimePlayed < time_final_max)
+ else if (game.no_
level_
time_limit && TimePlayed < time_final_max)
{
time_final = time_final_max;
time_frames = time_frames_final_max - time_frames_played;
{
time_final = time_final_max;
time_frames = time_frames_final_max - time_frames_played;
@@
-5051,6
+5061,7
@@
void GameEnd(void)
if (setup.auto_play_next_level)
{
scores.continue_playing = TRUE;
if (setup.auto_play_next_level)
{
scores.continue_playing = TRUE;
+ scores.next_level_nr = level_nr;
LoadLevel(level_nr);
LoadLevel(level_nr);
@@
-6109,13
+6120,7
@@
static void DynaExplode(int ex, int ey)
int dynabomb_size = 1;
boolean dynabomb_xl = FALSE;
struct PlayerInfo *player;
int dynabomb_size = 1;
boolean dynabomb_xl = FALSE;
struct PlayerInfo *player;
- static int xy[4][2] =
- {
- { 0, -1 },
- { -1, 0 },
- { +1, 0 },
- { 0, +1 }
- };
+ struct XY *xy = xy_topdown;
if (IS_ACTIVE_BOMB(dynabomb_element))
{
if (IS_ACTIVE_BOMB(dynabomb_element))
{
@@
-6131,8
+6136,8
@@
static void DynaExplode(int ex, int ey)
{
for (j = 1; j <= dynabomb_size; j++)
{
{
for (j = 1; j <= dynabomb_size; j++)
{
- int x = ex + j * xy[i]
[0]
;
- int y = ey + j * xy[i]
[1]
;
+ int x = ex + j * xy[i]
.x
;
+ int y = ey + j * xy[i]
.y
;
int element;
if (!IN_LEV_FIELD(x, y) || IS_INDESTRUCTIBLE(Tile[x][y]))
int element;
if (!IN_LEV_FIELD(x, y) || IS_INDESTRUCTIBLE(Tile[x][y]))
@@
-7267,18
+7272,12
@@
static void TurnRoundExt(int x, int y)
if (element == EL_PENGUIN)
{
int i;
if (element == EL_PENGUIN)
{
int i;
- static int xy[4][2] =
- {
- { 0, -1 },
- { -1, 0 },
- { +1, 0 },
- { 0, +1 }
- };
+ struct XY *xy = xy_topdown;
for (i = 0; i < NUM_DIRECTIONS; i++)
{
for (i = 0; i < NUM_DIRECTIONS; i++)
{
- int ex = x + xy[i]
[0]
;
- int ey = y + xy[i]
[1]
;
+ int ex = x + xy[i]
.x
;
+ int ey = y + xy[i]
.y
;
if (IN_LEV_FIELD(ex, ey) && (Tile[ex][ey] == EL_EXIT_OPEN ||
Tile[ex][ey] == EL_EM_EXIT_OPEN ||
if (IN_LEV_FIELD(ex, ey) && (Tile[ex][ey] == EL_EXIT_OPEN ||
Tile[ex][ey] == EL_EM_EXIT_OPEN ||
@@
-7677,25
+7676,13
@@
static void TurnRoundExt(int x, int y)
}
else if (move_pattern & MV_MAZE_RUNNER_STYLE)
{
}
else if (move_pattern & MV_MAZE_RUNNER_STYLE)
{
- static int test_xy[7][2] =
- {
- { 0, -1 },
- { -1, 0 },
- { +1, 0 },
- { 0, +1 },
- { 0, -1 },
- { -1, 0 },
- { +1, 0 },
- };
- static int test_dir[7] =
+ struct XY *test_xy = xy_topdown;
+ static int test_dir[4] =
{
MV_UP,
MV_LEFT,
MV_RIGHT,
{
MV_UP,
MV_LEFT,
MV_RIGHT,
- MV_DOWN,
- MV_UP,
- MV_LEFT,
- MV_RIGHT,
+ MV_DOWN
};
boolean hunter_mode = (move_pattern == MV_MAZE_HUNTER);
int move_preference = -1000000; // start with very low preference
};
boolean hunter_mode = (move_pattern == MV_MAZE_HUNTER);
int move_preference = -1000000; // start with very low preference
@@
-7705,11
+7692,12
@@
static void TurnRoundExt(int x, int y)
for (i = 0; i < NUM_DIRECTIONS; i++)
{
for (i = 0; i < NUM_DIRECTIONS; i++)
{
- int move_dir = test_dir[start_test + i];
+ int j = (start_test + i) % 4;
+ int move_dir = test_dir[j];
int move_dir_preference;
int move_dir_preference;
- xx = x + test_xy[
start_test + i][0]
;
- yy = y + test_xy[
start_test + i][1]
;
+ xx = x + test_xy[
j].x
;
+ yy = y + test_xy[
j].y
;
if (hunter_mode && IN_LEV_FIELD(xx, yy) &&
(IS_PLAYER(xx, yy) || Tile[xx][yy] == EL_PLAYER_IS_LEAVING))
if (hunter_mode && IN_LEV_FIELD(xx, yy) &&
(IS_PLAYER(xx, yy) || Tile[xx][yy] == EL_PLAYER_IS_LEAVING))
@@
-8967,18
+8955,12
@@
int AmoebaNeighbourNr(int ax, int ay)
int i;
int element = Tile[ax][ay];
int group_nr = 0;
int i;
int element = Tile[ax][ay];
int group_nr = 0;
- static int xy[4][2] =
- {
- { 0, -1 },
- { -1, 0 },
- { +1, 0 },
- { 0, +1 }
- };
+ struct XY *xy = xy_topdown;
for (i = 0; i < NUM_DIRECTIONS; i++)
{
for (i = 0; i < NUM_DIRECTIONS; i++)
{
- int x = ax + xy[i]
[0]
;
- int y = ay + xy[i]
[1]
;
+ int x = ax + xy[i]
.x
;
+ int y = ay + xy[i]
.y
;
if (!IN_LEV_FIELD(x, y))
continue;
if (!IN_LEV_FIELD(x, y))
continue;
@@
-8994,21
+8976,15
@@
static void AmoebaMerge(int ax, int ay)
{
int i, x, y, xx, yy;
int new_group_nr = AmoebaNr[ax][ay];
{
int i, x, y, xx, yy;
int new_group_nr = AmoebaNr[ax][ay];
- static int xy[4][2] =
- {
- { 0, -1 },
- { -1, 0 },
- { +1, 0 },
- { 0, +1 }
- };
+ struct XY *xy = xy_topdown;
if (new_group_nr == 0)
return;
for (i = 0; i < NUM_DIRECTIONS; i++)
{
if (new_group_nr == 0)
return;
for (i = 0; i < NUM_DIRECTIONS; i++)
{
- x = ax + xy[i]
[0]
;
- y = ay + xy[i]
[1]
;
+ x = ax + xy[i]
.x
;
+ y = ay + xy[i]
.y
;
if (!IN_LEV_FIELD(x, y))
continue;
if (!IN_LEV_FIELD(x, y))
continue;
@@
-9071,18
+9047,12
@@
void AmoebaToDiamond(int ax, int ay)
}
else
{
}
else
{
- static int xy[4][2] =
- {
- { 0, -1 },
- { -1, 0 },
- { +1, 0 },
- { 0, +1 }
- };
+ struct XY *xy = xy_topdown;
for (i = 0; i < NUM_DIRECTIONS; i++)
{
for (i = 0; i < NUM_DIRECTIONS; i++)
{
- x = ax + xy[i]
[0]
;
- y = ay + xy[i]
[1]
;
+ x = ax + xy[i]
.x
;
+ y = ay + xy[i]
.y
;
if (!IN_LEV_FIELD(x, y))
continue;
if (!IN_LEV_FIELD(x, y))
continue;
@@
-9137,17
+9107,16
@@
static void AmoebaToDiamondBD(int ax, int ay, int new_element)
static void AmoebaGrowing(int x, int y)
{
static void AmoebaGrowing(int x, int y)
{
- static unsigned int sound_delay = 0;
- static unsigned int sound_delay_value = 0;
+ static DelayCounter sound_delay = { 0 };
if (!MovDelay[x][y]) // start new growing cycle
{
MovDelay[x][y] = 7;
if (!MovDelay[x][y]) // start new growing cycle
{
MovDelay[x][y] = 7;
- if (DelayReached(&sound_delay
, sound_delay_value
))
+ if (DelayReached(&sound_delay))
{
PlayLevelSoundElementAction(x, y, Store[x][y], ACTION_GROWING);
{
PlayLevelSoundElementAction(x, y, Store[x][y], ACTION_GROWING);
- sound_delay
_
value = 30;
+ sound_delay
.
value = 30;
}
}
}
}
@@
-9173,15
+9142,14
@@
static void AmoebaGrowing(int x, int y)
static void AmoebaShrinking(int x, int y)
{
static void AmoebaShrinking(int x, int y)
{
- static unsigned int sound_delay = 0;
- static unsigned int sound_delay_value = 0;
+ static DelayCounter sound_delay = { 0 };
if (!MovDelay[x][y]) // start new shrinking cycle
{
MovDelay[x][y] = 7;
if (!MovDelay[x][y]) // start new shrinking cycle
{
MovDelay[x][y] = 7;
- if (DelayReached(&sound_delay
, sound_delay_value
))
- sound_delay
_
value = 30;
+ if (DelayReached(&sound_delay))
+ sound_delay
.
value = 30;
}
if (MovDelay[x][y]) // wait some time before shrinking
}
if (MovDelay[x][y]) // wait some time before shrinking
@@
-9214,13
+9182,7
@@
static void AmoebaReproduce(int ax, int ay)
int graphic = el2img(element);
int newax = ax, neway = ay;
boolean can_drop = (element == EL_AMOEBA_WET || element == EL_EMC_DRIPPER);
int graphic = el2img(element);
int newax = ax, neway = ay;
boolean can_drop = (element == EL_AMOEBA_WET || element == EL_EMC_DRIPPER);
- static int xy[4][2] =
- {
- { 0, -1 },
- { -1, 0 },
- { +1, 0 },
- { 0, +1 }
- };
+ struct XY *xy = xy_topdown;
if (!level.amoeba_speed && element != EL_EMC_DRIPPER)
{
if (!level.amoeba_speed && element != EL_EMC_DRIPPER)
{
@@
-9245,8
+9207,8
@@
static void AmoebaReproduce(int ax, int ay)
if (can_drop) // EL_AMOEBA_WET or EL_EMC_DRIPPER
{
int start = RND(4);
if (can_drop) // EL_AMOEBA_WET or EL_EMC_DRIPPER
{
int start = RND(4);
- int x = ax + xy[start]
[0]
;
- int y = ay + xy[start]
[1]
;
+ int x = ax + xy[start]
.x
;
+ int y = ay + xy[start]
.y
;
if (!IN_LEV_FIELD(x, y))
return;
if (!IN_LEV_FIELD(x, y))
return;
@@
-9271,8
+9233,8
@@
static void AmoebaReproduce(int ax, int ay)
for (i = 0; i < NUM_DIRECTIONS; i++)
{
int j = (start + i) % 4;
for (i = 0; i < NUM_DIRECTIONS; i++)
{
int j = (start + i) % 4;
- int x = ax + xy[j]
[0]
;
- int y = ay + xy[j]
[1]
;
+ int x = ax + xy[j]
.x
;
+ int y = ay + xy[j]
.y
;
if (!IN_LEV_FIELD(x, y))
continue;
if (!IN_LEV_FIELD(x, y))
continue;
@@
-9950,19
+9912,14
@@
static void CheckForDragon(int x, int y)
{
int i, j;
boolean dragon_found = FALSE;
{
int i, j;
boolean dragon_found = FALSE;
- static int xy[4][2] =
- {
- { 0, -1 },
- { -1, 0 },
- { +1, 0 },
- { 0, +1 }
- };
+ struct XY *xy = xy_topdown;
for (i = 0; i < NUM_DIRECTIONS; i++)
{
for (j = 0; j < 4; j++)
{
for (i = 0; i < NUM_DIRECTIONS; i++)
{
for (j = 0; j < 4; j++)
{
- int xx = x + j * xy[i][0], yy = y + j * xy[i][1];
+ int xx = x + j * xy[i].x;
+ int yy = y + j * xy[i].y;
if (IN_LEV_FIELD(xx, yy) &&
(Tile[xx][yy] == EL_FLAMES || Tile[xx][yy] == EL_DRAGON))
if (IN_LEV_FIELD(xx, yy) &&
(Tile[xx][yy] == EL_FLAMES || Tile[xx][yy] == EL_DRAGON))
@@
-9981,8
+9938,9
@@
static void CheckForDragon(int x, int y)
{
for (j = 0; j < 3; j++)
{
{
for (j = 0; j < 3; j++)
{
- int xx = x + j * xy[i][0], yy = y + j * xy[i][1];
-
+ int xx = x + j * xy[i].x;
+ int yy = y + j * xy[i].y;
+
if (IN_LEV_FIELD(xx, yy) && Tile[xx][yy] == EL_FLAMES)
{
Tile[xx][yy] = EL_EMPTY;
if (IN_LEV_FIELD(xx, yy) && Tile[xx][yy] == EL_FLAMES)
{
Tile[xx][yy] = EL_EMPTY;
@@
-10012,18
+9970,12
@@
static void InitBuggyBase(int x, int y)
static void WarnBuggyBase(int x, int y)
{
int i;
static void WarnBuggyBase(int x, int y)
{
int i;
- static int xy[4][2] =
- {
- { 0, -1 },
- { -1, 0 },
- { +1, 0 },
- { 0, +1 }
- };
+ struct XY *xy = xy_topdown;
for (i = 0; i < NUM_DIRECTIONS; i++)
{
for (i = 0; i < NUM_DIRECTIONS; i++)
{
- int xx = x + xy[i]
[0]
;
- int yy = y + xy[i]
[1]
;
+ int xx = x + xy[i]
.x
;
+ int yy = y + xy[i]
.y
;
if (IN_LEV_FIELD(xx, yy) && IS_PLAYER(xx, yy))
{
if (IN_LEV_FIELD(xx, yy) && IS_PLAYER(xx, yy))
{
@@
-10226,7
+10178,7
@@
static void ExecuteCustomElementAction(int x, int y, int element, int page)
DisplayGameControlValues();
DisplayGameControlValues();
- if (!TimeLeft &&
setup
.time_limit)
+ if (!TimeLeft &&
game
.time_limit)
for (i = 0; i < MAX_PLAYERS; i++)
KillPlayer(&stored_player[i]);
}
for (i = 0; i < MAX_PLAYERS; i++)
KillPlayer(&stored_player[i]);
}
@@
-11636,18
+11588,18
@@
static void CheckLevelTime_StepCounter(void)
{
TimeLeft--;
{
TimeLeft--;
- if (TimeLeft <= 10 &&
setup
.time_limit && !game.LevelSolved)
+ if (TimeLeft <= 10 &&
game
.time_limit && !game.LevelSolved)
PlaySound(SND_GAME_RUNNING_OUT_OF_TIME);
game_panel_controls[GAME_PANEL_TIME].value = TimeLeft;
DisplayGameControlValues();
PlaySound(SND_GAME_RUNNING_OUT_OF_TIME);
game_panel_controls[GAME_PANEL_TIME].value = TimeLeft;
DisplayGameControlValues();
- if (!TimeLeft &&
setup
.time_limit && !game.LevelSolved)
+ if (!TimeLeft &&
game
.time_limit && !game.LevelSolved)
for (i = 0; i < MAX_PLAYERS; i++)
KillPlayer(&stored_player[i]);
}
for (i = 0; i < MAX_PLAYERS; i++)
KillPlayer(&stored_player[i]);
}
- else if (game.no_time_limit && !game.all_players_gone)
+ else if (game.no_
level_
time_limit && !game.all_players_gone)
{
game_panel_controls[GAME_PANEL_TIME].value = TimePlayed;
{
game_panel_controls[GAME_PANEL_TIME].value = TimePlayed;
@@
-11685,7
+11637,7
@@
static void CheckLevelTime(void)
{
TimeLeft--;
{
TimeLeft--;
- if (TimeLeft <= 10 &&
setup
.time_limit)
+ if (TimeLeft <= 10 &&
game
.time_limit)
PlaySound(SND_GAME_RUNNING_OUT_OF_TIME);
/* this does not make sense: game_panel_controls[GAME_PANEL_TIME].value
PlaySound(SND_GAME_RUNNING_OUT_OF_TIME);
/* this does not make sense: game_panel_controls[GAME_PANEL_TIME].value
@@
-11693,7
+11645,7
@@
static void CheckLevelTime(void)
game_panel_controls[GAME_PANEL_TIME].value = TimeLeft;
game_panel_controls[GAME_PANEL_TIME].value = TimeLeft;
- if (!TimeLeft &&
setup
.time_limit)
+ if (!TimeLeft &&
game
.time_limit)
{
if (level.game_engine_type == GAME_ENGINE_TYPE_EM)
game_em.lev->killed_out_of_time = TRUE;
{
if (level.game_engine_type == GAME_ENGINE_TYPE_EM)
game_em.lev->killed_out_of_time = TRUE;
@@
-11702,12
+11654,12
@@
static void CheckLevelTime(void)
KillPlayer(&stored_player[i]);
}
}
KillPlayer(&stored_player[i]);
}
}
- else if (game.no_time_limit && !game.all_players_gone)
+ else if (game.no_
level_
time_limit && !game.all_players_gone)
{
game_panel_controls[GAME_PANEL_TIME].value = TimePlayed;
}
{
game_panel_controls[GAME_PANEL_TIME].value = TimePlayed;
}
- game_em.lev->time = (game.no_time_limit ? TimePlayed : TimeLeft);
+ game_em.lev->time = (game.no_
level_
time_limit ? TimePlayed : TimeLeft);
}
if (tape.recording || tape.playing)
}
if (tape.recording || tape.playing)
@@
-13194,7
+13146,7
@@
void ScrollPlayer(struct PlayerInfo *player, int mode)
if (mode == SCROLL_INIT)
{
if (mode == SCROLL_INIT)
{
- player->actual_frame_counter = FrameCounter;
+ player->actual_frame_counter
.count
= FrameCounter;
player->GfxPos = move_stepsize * (player->MovPos / move_stepsize);
if ((player->block_last_field || player->block_delay_adjustment > 0) &&
player->GfxPos = move_stepsize * (player->MovPos / move_stepsize);
if ((player->block_last_field || player->block_delay_adjustment > 0) &&
@@
-13223,7
+13175,7
@@
void ScrollPlayer(struct PlayerInfo *player, int mode)
if (player->MovPos != 0) // player has not yet reached destination
return;
}
if (player->MovPos != 0) // player has not yet reached destination
return;
}
- else if (!FrameReached(&player->actual_frame_counter
, 1
))
+ else if (!FrameReached(&player->actual_frame_counter))
return;
if (player->MovPos != 0)
return;
if (player->MovPos != 0)
@@
-13346,20
+13298,22
@@
void ScrollPlayer(struct PlayerInfo *player, int mode)
void ScrollScreen(struct PlayerInfo *player, int mode)
{
void ScrollScreen(struct PlayerInfo *player, int mode)
{
- static
unsigned int screen_frame_counter = 0
;
+ static
DelayCounter screen_frame_counter = { 0 }
;
if (mode == SCROLL_INIT)
{
// set scrolling step size according to actual player's moving speed
ScrollStepSize = TILEX / player->move_delay_value;
if (mode == SCROLL_INIT)
{
// set scrolling step size according to actual player's moving speed
ScrollStepSize = TILEX / player->move_delay_value;
- screen_frame_counter = FrameCounter;
+ screen_frame_counter.count = FrameCounter;
+ screen_frame_counter.value = 1;
+
ScreenMovDir = player->MovDir;
ScreenMovPos = player->MovPos;
ScreenGfxPos = ScrollStepSize * (ScreenMovPos / ScrollStepSize);
return;
}
ScreenMovDir = player->MovDir;
ScreenMovPos = player->MovPos;
ScreenGfxPos = ScrollStepSize * (ScreenMovPos / ScrollStepSize);
return;
}
- else if (!FrameReached(&screen_frame_counter
, 1
))
+ else if (!FrameReached(&screen_frame_counter))
return;
if (ScreenMovPos)
return;
if (ScreenMovPos)
@@
-13386,13
+13340,7
@@
void CheckNextToConditions(int x, int y)
void TestIfPlayerNextToCustomElement(int x, int y)
{
void TestIfPlayerNextToCustomElement(int x, int y)
{
- static int xy[4][2] =
- {
- { 0, -1 },
- { -1, 0 },
- { +1, 0 },
- { 0, +1 }
- };
+ struct XY *xy = xy_topdown;
static int trigger_sides[4][2] =
{
// center side border side
static int trigger_sides[4][2] =
{
// center side border side
@@
-13413,8
+13361,8
@@
void TestIfPlayerNextToCustomElement(int x, int y)
for (i = 0; i < NUM_DIRECTIONS; i++)
{
for (i = 0; i < NUM_DIRECTIONS; i++)
{
- int xx = x + xy[i]
[0]
;
- int yy = y + xy[i]
[1]
;
+ int xx = x + xy[i]
.x
;
+ int yy = y + xy[i]
.y
;
int border_side = trigger_sides[i][1];
int border_element;
int border_side = trigger_sides[i][1];
int border_element;
@@
-13444,13
+13392,7
@@
void TestIfPlayerNextToCustomElement(int x, int y)
void TestIfPlayerTouchesCustomElement(int x, int y)
{
void TestIfPlayerTouchesCustomElement(int x, int y)
{
- static int xy[4][2] =
- {
- { 0, -1 },
- { -1, 0 },
- { +1, 0 },
- { 0, +1 }
- };
+ struct XY *xy = xy_topdown;
static int trigger_sides[4][2] =
{
// center side border side
static int trigger_sides[4][2] =
{
// center side border side
@@
-13471,8
+13413,8
@@
void TestIfPlayerTouchesCustomElement(int x, int y)
for (i = 0; i < NUM_DIRECTIONS; i++)
{
for (i = 0; i < NUM_DIRECTIONS; i++)
{
- int xx = x + xy[i]
[0]
;
- int yy = y + xy[i]
[1]
;
+ int xx = x + xy[i]
.x
;
+ int yy = y + xy[i]
.y
;
int center_side = trigger_sides[i][0];
int border_side = trigger_sides[i][1];
int border_element;
int center_side = trigger_sides[i][0];
int border_side = trigger_sides[i][1];
int border_element;
@@
-13544,13
+13486,7
@@
void TestIfPlayerTouchesCustomElement(int x, int y)
void TestIfElementNextToCustomElement(int x, int y)
{
void TestIfElementNextToCustomElement(int x, int y)
{
- static int xy[4][2] =
- {
- { 0, -1 },
- { -1, 0 },
- { +1, 0 },
- { 0, +1 }
- };
+ struct XY *xy = xy_topdown;
static int trigger_sides[4][2] =
{
// center side border side
static int trigger_sides[4][2] =
{
// center side border side
@@
-13567,8
+13503,8
@@
void TestIfElementNextToCustomElement(int x, int y)
for (i = 0; i < NUM_DIRECTIONS; i++)
{
for (i = 0; i < NUM_DIRECTIONS; i++)
{
- int xx = x + xy[i]
[0]
;
- int yy = y + xy[i]
[1]
;
+ int xx = x + xy[i]
.x
;
+ int yy = y + xy[i]
.y
;
int border_side = trigger_sides[i][1];
int border_element;
int border_side = trigger_sides[i][1];
int border_element;
@@
-13589,13
+13525,7
@@
void TestIfElementNextToCustomElement(int x, int y)
void TestIfElementTouchesCustomElement(int x, int y)
{
void TestIfElementTouchesCustomElement(int x, int y)
{
- static int xy[4][2] =
- {
- { 0, -1 },
- { -1, 0 },
- { +1, 0 },
- { 0, +1 }
- };
+ struct XY *xy = xy_topdown;
static int trigger_sides[4][2] =
{
// center side border side
static int trigger_sides[4][2] =
{
// center side border side
@@
-13618,8
+13548,8
@@
void TestIfElementTouchesCustomElement(int x, int y)
for (i = 0; i < NUM_DIRECTIONS; i++)
{
for (i = 0; i < NUM_DIRECTIONS; i++)
{
- int xx = x + xy[i]
[0]
;
- int yy = y + xy[i]
[1]
;
+ int xx = x + xy[i]
.x
;
+ int yy = y + xy[i]
.y
;
int border_element;
border_element_old[i] = -1;
int border_element;
border_element_old[i] = -1;
@@
-13641,8
+13571,8
@@
void TestIfElementTouchesCustomElement(int x, int y)
for (i = 0; i < NUM_DIRECTIONS; i++)
{
for (i = 0; i < NUM_DIRECTIONS; i++)
{
- int xx = x + xy[i]
[0]
;
- int yy = y + xy[i]
[1]
;
+ int xx = x + xy[i]
.x
;
+ int yy = y + xy[i]
.y
;
int center_side = trigger_sides[i][0];
int border_element = border_element_old[i];
int center_side = trigger_sides[i][0];
int border_element = border_element_old[i];
@@
-13658,8
+13588,8
@@
void TestIfElementTouchesCustomElement(int x, int y)
for (i = 0; i < NUM_DIRECTIONS; i++)
{
for (i = 0; i < NUM_DIRECTIONS; i++)
{
- int xx = x + xy[i]
[0]
;
- int yy = y + xy[i]
[1]
;
+ int xx = x + xy[i]
.x
;
+ int yy = y + xy[i]
.y
;
int border_side = trigger_sides[i][1];
int border_element = border_element_old[i];
int border_side = trigger_sides[i][1];
int border_element = border_element_old[i];
@@
-13746,13
+13676,7
@@
void TestIfGoodThingHitsBadThing(int good_x, int good_y, int good_move_dir)
int i, kill_x = -1, kill_y = -1;
int bad_element = -1;
int i, kill_x = -1, kill_y = -1;
int bad_element = -1;
- static int test_xy[4][2] =
- {
- { 0, -1 },
- { -1, 0 },
- { +1, 0 },
- { 0, +1 }
- };
+ struct XY *test_xy = xy_topdown;
static int test_dir[4] =
{
MV_UP,
static int test_dir[4] =
{
MV_UP,
@@
-13765,8
+13689,8
@@
void TestIfGoodThingHitsBadThing(int good_x, int good_y, int good_move_dir)
{
int test_x, test_y, test_move_dir, test_element;
{
int test_x, test_y, test_move_dir, test_element;
- test_x = good_x + test_xy[i]
[0]
;
- test_y = good_y + test_xy[i]
[1]
;
+ test_x = good_x + test_xy[i]
.x
;
+ test_y = good_y + test_xy[i]
.y
;
if (!IN_LEV_FIELD(test_x, test_y))
continue;
if (!IN_LEV_FIELD(test_x, test_y))
continue;
@@
-13811,13
+13735,7
@@
void TestIfBadThingHitsGoodThing(int bad_x, int bad_y, int bad_move_dir)
{
int i, kill_x = -1, kill_y = -1;
int bad_element = Tile[bad_x][bad_y];
{
int i, kill_x = -1, kill_y = -1;
int bad_element = Tile[bad_x][bad_y];
- static int test_xy[4][2] =
- {
- { 0, -1 },
- { -1, 0 },
- { +1, 0 },
- { 0, +1 }
- };
+ struct XY *test_xy = xy_topdown;
static int touch_dir[4] =
{
MV_LEFT | MV_RIGHT,
static int touch_dir[4] =
{
MV_LEFT | MV_RIGHT,
@@
-13840,8
+13758,8
@@
void TestIfBadThingHitsGoodThing(int bad_x, int bad_y, int bad_move_dir)
{
int test_x, test_y, test_move_dir, test_element;
{
int test_x, test_y, test_move_dir, test_element;
- test_x = bad_x + test_xy[i]
[0]
;
- test_y = bad_y + test_xy[i]
[1]
;
+ test_x = bad_x + test_xy[i]
.x
;
+ test_y = bad_y + test_xy[i]
.y
;
if (!IN_LEV_FIELD(test_x, test_y))
continue;
if (!IN_LEV_FIELD(test_x, test_y))
continue;
@@
-13993,20
+13911,14
@@
void TestIfBadThingTouchesFriend(int x, int y)
void TestIfBadThingTouchesOtherBadThing(int bad_x, int bad_y)
{
int i, kill_x = bad_x, kill_y = bad_y;
void TestIfBadThingTouchesOtherBadThing(int bad_x, int bad_y)
{
int i, kill_x = bad_x, kill_y = bad_y;
- static int xy[4][2] =
- {
- { 0, -1 },
- { -1, 0 },
- { +1, 0 },
- { 0, +1 }
- };
+ struct XY *xy = xy_topdown;
for (i = 0; i < NUM_DIRECTIONS; i++)
{
int x, y, element;
for (i = 0; i < NUM_DIRECTIONS; i++)
{
int x, y, element;
- x = bad_x + xy[i]
[0]
;
- y = bad_y + xy[i]
[1]
;
+ x = bad_x + xy[i]
.x
;
+ y = bad_y + xy[i]
.y
;
if (!IN_LEV_FIELD(x, y))
continue;
if (!IN_LEV_FIELD(x, y))
continue;
@@
-14518,9
+14430,13
@@
static int DigField(struct PlayerInfo *player,
}
else if (element == EL_SHIELD_NORMAL || element == EL_SHIELD_DEADLY)
{
}
else if (element == EL_SHIELD_NORMAL || element == EL_SHIELD_DEADLY)
{
- player->shield_normal_time_left += level.shield_normal_time;
+ int shield_time = (element == EL_SHIELD_DEADLY ?
+ level.shield_deadly_time :
+ level.shield_normal_time);
+
+ player->shield_normal_time_left += shield_time;
if (element == EL_SHIELD_DEADLY)
if (element == EL_SHIELD_DEADLY)
- player->shield_deadly_time_left +=
level.shield_deadly
_time;
+ player->shield_deadly_time_left +=
shield
_time;
}
else if (element == EL_DYNAMITE ||
element == EL_EM_DYNAMITE ||
}
else if (element == EL_DYNAMITE ||
element == EL_EM_DYNAMITE ||
@@
-14881,7
+14797,7
@@
static int DigField(struct PlayerInfo *player,
if (level.time > 0 || level.use_time_orb_bug)
{
TimeLeft += level.time_orb_time;
if (level.time > 0 || level.use_time_orb_bug)
{
TimeLeft += level.time_orb_time;
- game.no_time_limit = FALSE;
+ game.no_
level_
time_limit = FALSE;
game_panel_controls[GAME_PANEL_TIME].value = TimeLeft;
game_panel_controls[GAME_PANEL_TIME].value = TimeLeft;
@@
-15691,6
+15607,7
@@
void RequestQuitGameExt(boolean skip_request, boolean quick_quit, char *message)
{
// prevent short reactivation of overlay buttons while closing door
SetOverlayActive(FALSE);
{
// prevent short reactivation of overlay buttons while closing door
SetOverlayActive(FALSE);
+ UnmapGameButtons();
// door may still be open due to skipped or envelope style request
CloseDoor(score_info_tape_play ? DOOR_CLOSE_ALL : DOOR_CLOSE_1);
// door may still be open due to skipped or envelope style request
CloseDoor(score_info_tape_play ? DOOR_CLOSE_ALL : DOOR_CLOSE_1);
@@
-16298,6
+16215,10
@@
void CreateGameButtons(void)
int y = (is_touch_button ? pos->y : GDI_ACTIVE_POS(pos->y));
int id = i;
int y = (is_touch_button ? pos->y : GDI_ACTIVE_POS(pos->y));
int id = i;
+ // do not use touch buttons if overlay touch buttons are disabled
+ if (is_touch_button && !setup.touch.overlay_buttons)
+ continue;
+
if (gfx->bitmap == NULL)
{
game_gadget[id] = NULL;
if (gfx->bitmap == NULL)
{
game_gadget[id] = NULL;