static void UpdateGameControlValues(void)
{
int i, k;
- int time = (local_player->LevelSolved ?
- local_player->LevelSolved_CountingTime :
+ int time = (game.LevelSolved ?
+ game.LevelSolved_CountingTime :
level.game_engine_type == GAME_ENGINE_TYPE_EM ?
level.native_em_level->lev->time :
level.game_engine_type == GAME_ENGINE_TYPE_SP ?
level.game_engine_type == GAME_ENGINE_TYPE_MM ?
game_mm.energy_left :
game.no_time_limit ? TimePlayed : TimeLeft);
- int score = (local_player->LevelSolved ?
- local_player->LevelSolved_CountingScore :
+ int score = (game.LevelSolved ?
+ game.LevelSolved_CountingScore :
level.game_engine_type == GAME_ENGINE_TYPE_EM ?
level.native_em_level->lev->score :
level.game_engine_type == GAME_ENGINE_TYPE_SP ?
local_player->sokoban_fields_still_needed > 0 ||
local_player->sokoban_objects_still_needed > 0 ||
local_player->lights_still_needed > 0);
- int health = (local_player->LevelSolved ?
- local_player->LevelSolved_CountingHealth :
+ int health = (game.LevelSolved ?
+ game.LevelSolved_CountingHealth :
level.game_engine_type == GAME_ENGINE_TYPE_MM ?
MM_HEALTH(game_mm.laser_overload_value) :
local_player->health);
DigField(player, 0, 0, 0, 0, 0, 0, DF_NO_PUSH);
SnapField(player, 0, 0);
- player->LevelSolved = FALSE;
player->GameOver = FALSE;
- player->LevelSolved_GameWon = FALSE;
- player->LevelSolved_GameEnd = FALSE;
- player->LevelSolved_SaveTape = FALSE;
- player->LevelSolved_SaveScore = FALSE;
-
- player->LevelSolved_CountingTime = 0;
- player->LevelSolved_CountingScore = 0;
- player->LevelSolved_CountingHealth = 0;
-
map_player_action[i] = i;
}
AllPlayersGone = FALSE;
+ game.LevelSolved = FALSE;
+
+ game.LevelSolved_GameWon = FALSE;
+ game.LevelSolved_GameEnd = FALSE;
+ game.LevelSolved_SaveTape = FALSE;
+ game.LevelSolved_SaveScore = FALSE;
+
+ game.LevelSolved_CountingTime = 0;
+ game.LevelSolved_CountingScore = 0;
+ game.LevelSolved_CountingHealth = 0;
+
game.panel.active = TRUE;
game.no_time_limit = (level.time == 0);
AmoebaCnt2[group_nr]++;
}
-static void PlayerWins(struct PlayerInfo *player)
+static void PlayerWins(void)
{
if (level.game_engine_type == GAME_ENGINE_TYPE_RND &&
local_player->players_still_needed > 0)
return;
- player->LevelSolved = TRUE;
- player->GameOver = TRUE;
+ game.LevelSolved = TRUE;
+
+ local_player->GameOver = TRUE;
- player->score_final = (level.game_engine_type == GAME_ENGINE_TYPE_EM ?
- level.native_em_level->lev->score :
- level.game_engine_type == GAME_ENGINE_TYPE_MM ?
- game_mm.score :
- player->score);
- player->health_final = (level.game_engine_type == GAME_ENGINE_TYPE_MM ?
- MM_HEALTH(game_mm.laser_overload_value) :
- player->health);
+ local_player->score_final = (level.game_engine_type == GAME_ENGINE_TYPE_EM ?
+ level.native_em_level->lev->score :
+ level.game_engine_type == GAME_ENGINE_TYPE_MM ?
+ game_mm.score :
+ local_player->score);
+ local_player->health_final = (level.game_engine_type == GAME_ENGINE_TYPE_MM ?
+ MM_HEALTH(game_mm.laser_overload_value) :
+ local_player->health);
- player->LevelSolved_CountingTime = (game.no_time_limit ? TimePlayed :
- TimeLeft);
- player->LevelSolved_CountingScore = player->score_final;
- player->LevelSolved_CountingHealth = player->health_final;
+ game.LevelSolved_CountingTime = (game.no_time_limit ? TimePlayed : TimeLeft);
+ game.LevelSolved_CountingScore = local_player->score_final;
+ game.LevelSolved_CountingHealth = local_player->health_final;
}
void GameWon(void)
int game_over_delay_value_2 = 25;
int game_over_delay_value_3 = 50;
- if (!local_player->LevelSolved_GameWon)
+ if (!game.LevelSolved_GameWon)
{
int i;
if (local_player->MovPos)
return;
- local_player->LevelSolved_GameWon = TRUE;
- local_player->LevelSolved_SaveTape = tape.recording;
- local_player->LevelSolved_SaveScore = !tape.playing;
+ game.LevelSolved_GameWon = TRUE;
+ game.LevelSolved_SaveTape = tape.recording;
+ game.LevelSolved_SaveScore = !tape.playing;
if (!tape.playing)
{
time = time_final;
score = score_final;
- local_player->LevelSolved_CountingTime = time;
- local_player->LevelSolved_CountingScore = score;
+ game.LevelSolved_CountingTime = time;
+ game.LevelSolved_CountingScore = score;
game_panel_controls[GAME_PANEL_TIME].value = time;
game_panel_controls[GAME_PANEL_SCORE].value = score;
time += time_count_steps * time_count_dir;
score += time_count_steps * level.score[SC_TIME_BONUS];
- local_player->LevelSolved_CountingTime = time;
- local_player->LevelSolved_CountingScore = score;
+ game.LevelSolved_CountingTime = time;
+ game.LevelSolved_CountingScore = score;
game_panel_controls[GAME_PANEL_TIME].value = time;
game_panel_controls[GAME_PANEL_SCORE].value = score;
health += health_count_dir;
score += level.score[SC_TIME_BONUS];
- local_player->LevelSolved_CountingHealth = health;
- local_player->LevelSolved_CountingScore = score;
+ game.LevelSolved_CountingHealth = health;
+ game.LevelSolved_CountingScore = score;
game_panel_controls[GAME_PANEL_HEALTH].value = health;
game_panel_controls[GAME_PANEL_SCORE].value = score;
int last_level_nr = levelset.level_nr;
int hi_pos;
- local_player->LevelSolved_GameEnd = TRUE;
+ game.LevelSolved_GameEnd = TRUE;
- if (local_player->LevelSolved_SaveTape)
+ if (game.LevelSolved_SaveTape)
{
// make sure that request dialog to save tape does not open door again
if (!global.use_envelope_request)
return;
}
- if (!local_player->LevelSolved_SaveScore)
+ if (!game.LevelSolved_SaveScore)
{
SetGameStatus(GAME_MODE_MAIN);
local_player->friends_still_needed--;
if (!local_player->friends_still_needed &&
!local_player->GameOver && AllPlayersGone)
- PlayerWins(local_player);
+ PlayerWins();
return;
}
ExitPlayer(&stored_player[i]);
if (AllPlayersGone)
- PlayerWins(local_player);
+ PlayerWins();
break;
}
if (game_em.level_solved &&
!game_em.game_over) // game won
{
- PlayerWins(local_player);
+ PlayerWins();
game_em.game_over = TRUE;
if (game_sp.level_solved &&
!game_sp.game_over) // game won
{
- PlayerWins(local_player);
+ PlayerWins();
game_sp.game_over = TRUE;
if (game_mm.level_solved &&
!game_mm.game_over) // game won
{
- PlayerWins(local_player);
+ PlayerWins();
game_mm.game_over = TRUE;
}
}
- if (!local_player->LevelSolved && !level.use_step_counter)
+ if (!game.LevelSolved && !level.use_step_counter)
{
TimePlayed++;
CheckLevelSolved();
- if (local_player->LevelSolved && !local_player->LevelSolved_GameEnd)
+ if (game.LevelSolved && !game.LevelSolved_GameEnd)
GameWon();
if (AllPlayersGone && !TAPE_IS_STOPPED(tape))
if ((local_player->friends_still_needed == 0 ||
IS_SP_ELEMENT(Feld[jx][jy])) &&
AllPlayersGone)
- PlayerWins(local_player);
+ PlayerWins();
}
// this breaks one level: "machine", level 000
RemovePlayer(player);
}
- if (!local_player->LevelSolved && level.use_step_counter)
+ if (!game.LevelSolved && level.use_step_counter)
{
int i;
{
local_player->players_still_needed = 0;
- PlayerWins(local_player);
+ PlayerWins();
PlayLevelSound(x, y, SND_GAME_SOKOBAN_SOLVING);
}
boolean checkGameSolved(void)
{
// set for all game engines if level was solved
- return local_player->LevelSolved_GameEnd;
+ return game.LevelSolved_GameEnd;
}
boolean checkGameFailed(void)
else if (level.game_engine_type == GAME_ENGINE_TYPE_MM)
return (game_mm.game_over && !game_mm.level_solved);
else // GAME_ENGINE_TYPE_RND
- return (local_player->GameOver && !local_player->LevelSolved);
+ return (local_player->GameOver && !game.LevelSolved);
}
boolean checkGameEnded(void)