X-Git-Url: https://git.artsoft.org/?a=blobdiff_plain;f=src%2Fgame.c;h=fcaedf73e391e6c0882991de5811ecfc1e1968c7;hb=78ec772d11cb8823d8dca05c227b472da8708a07;hp=f66cd400858a100f9add6ab75b57fc9814883155;hpb=7eec2d73cfa570db7704b990d871e23ebfeb215b;p=rocksndiamonds.git diff --git a/src/game.c b/src/game.c index f66cd400..fcaedf73 100644 --- a/src/game.c +++ b/src/game.c @@ -349,7 +349,7 @@ void InitGame() player->programmed_action = 0; player->score = 0; - player->gems_still_needed = level.edelsteine; + player->gems_still_needed = level.gems_needed; player->sokobanfields_still_needed = 0; player->lights_still_needed = 0; player->friends_still_needed = 0; @@ -384,8 +384,6 @@ void InitGame() player->snapped = FALSE; - player->gone = FALSE; - player->last_jx = player->last_jy = 0; player->jx = player->jy = 0; @@ -406,7 +404,7 @@ void InitGame() ZX = ZY = -1; - MampferNr = 0; + game.yam_content_nr = 0; FrameCounter = 0; TimeFrames = 0; TimePlayed = 0; @@ -419,8 +417,8 @@ void InitGame() ScrollStepSize = 0; /* will be correctly initialized by ScrollScreen() */ AllPlayersGone = FALSE; - SiebAktiv = FALSE; - SiebCount = 0; + game.magic_wall_active = FALSE; + game.magic_wall_time_left = 0; for (i=0; ijx, jy = player->jy; - if (!player->active || player->gone) + if (!player->active) continue; if (attr_x == -1 || ABS(jx-x)+ABS(jy-y) < ABS(attr_x-x)+ABS(attr_y-y)) @@ -1949,8 +1947,7 @@ static boolean JustBeingPushed(int x, int y) { struct PlayerInfo *player = &stored_player[i]; - if (player->active && !player->gone && - player->Pushing && player->MovPos) + if (player->active && player->Pushing && player->MovPos) { int next_jx = player->jx + (player->jx - player->last_jx); int next_jy = player->jy + (player->jy - player->last_jy); @@ -2093,7 +2090,7 @@ void StartMoving(int x, int y) if (left || right) { - if (left && right && game_emulation != EMU_BOULDERDASH) + if (left && right && game.emulation != EMU_BOULDERDASH) left = !(right = RND(2)); InitMovingField(x, y, left ? MV_LEFT : MV_RIGHT); @@ -2425,22 +2422,24 @@ void ContinueMoving(int x, int y) else if (Store[x][y] == EL_SIEB_VOLL) { Store[x][y] = 0; - element = Feld[newx][newy] = (SiebAktiv ? EL_SIEB_VOLL : EL_SIEB_TOT); + element = Feld[newx][newy] = + (game.magic_wall_active ? EL_SIEB_VOLL : EL_SIEB_TOT); } else if (Store[x][y] == EL_SIEB_LEER) { Store[x][y] = Store2[x][y] = 0; - Feld[x][y] = (SiebAktiv ? EL_SIEB_LEER : EL_SIEB_TOT); + Feld[x][y] = (game.magic_wall_active ? EL_SIEB_LEER : EL_SIEB_TOT); } else if (Store[x][y] == EL_SIEB2_VOLL) { Store[x][y] = 0; - element = Feld[newx][newy] = (SiebAktiv ? EL_SIEB2_VOLL : EL_SIEB2_TOT); + element = Feld[newx][newy] = + (game.magic_wall_active ? EL_SIEB2_VOLL : EL_SIEB2_TOT); } else if (Store[x][y] == EL_SIEB2_LEER) { Store[x][y] = Store2[x][y] = 0; - Feld[x][y] = (SiebAktiv ? EL_SIEB2_LEER : EL_SIEB2_TOT); + Feld[x][y] = (game.magic_wall_active ? EL_SIEB2_LEER : EL_SIEB2_TOT); } else if (Store[x][y] == EL_SALZSAEURE) { @@ -2697,7 +2696,7 @@ void AmoebeAbleger(int ax, int ay) { 0, +1 } }; - if (!level.tempo_amoebe) + if (!level.amoeba_speed) { Feld[ax][ay] = EL_AMOEBE_TOT; DrawLevelField(ax, ay); @@ -2705,7 +2704,7 @@ void AmoebeAbleger(int ax, int ay) } if (!MovDelay[ax][ay]) /* start making new amoeba field */ - MovDelay[ax][ay] = RND(FRAMES_PER_SECOND * 25 / (1 + level.tempo_amoebe)); + MovDelay[ax][ay] = RND(FRAMES_PER_SECOND * 25 / (1 + level.amoeba_speed)); if (MovDelay[ax][ay]) /* wait some time before making new amoeba */ { @@ -2760,7 +2759,7 @@ void AmoebeAbleger(int ax, int ay) if (newax == ax && neway == ay) /* amoeba cannot grow */ { - if (i == 4 && (!waiting_for_player || game_emulation == EMU_BOULDERDASH)) + if (i == 4 && (!waiting_for_player || game.emulation == EMU_BOULDERDASH)) { Feld[ax][ay] = EL_AMOEBE_TOT; DrawLevelField(ax, ay); @@ -2771,7 +2770,7 @@ void AmoebeAbleger(int ax, int ay) if (element == EL_AMOEBE_VOLL) AmoebeUmwandeln(ax, ay); else if (element == EL_AMOEBE_BD) - AmoebeUmwandelnBD(ax, ay, level.amoebe_inhalt); + AmoebeUmwandelnBD(ax, ay, level.amoeba_content); } } return; @@ -2895,7 +2894,7 @@ void Life(int ax, int ay) void Ablenk(int x, int y) { if (!MovDelay[x][y]) /* next animation frame */ - MovDelay[x][y] = level.dauer_ablenk * FRAMES_PER_SECOND; + MovDelay[x][y] = level.time_wheel * FRAMES_PER_SECOND; if (MovDelay[x][y]) /* wait some time before next frame */ { @@ -3338,7 +3337,7 @@ static void PlayerActions(struct PlayerInfo *player, byte player_action) stored_player_action[player->index_nr] = 0; num_stored_actions++; - if (!player->active || player->gone || tape.pausing) + if (!player->active || tape.pausing) return; if (player_action) @@ -3505,7 +3504,7 @@ void GameActions() #ifdef DEBUG #if 0 - if (TimeFrames == 0 && !local_player->gone) + if (TimeFrames == 0 && local_player->active) { extern unsigned int last_RND(); @@ -3606,7 +3605,7 @@ void GameActions() else if (element == EL_SP_TERMINAL_ACTIVE) DrawGraphicAnimation(x, y, GFX2_SP_TERMINAL_ACTIVE, 7, 4, ANIM_NORMAL); - if (SiebAktiv) + if (game.magic_wall_active) { boolean sieb = FALSE; int jx = local_player->jx, jy = local_player->jy; @@ -3633,15 +3632,15 @@ void GameActions() } } - if (SiebAktiv) + if (game.magic_wall_active) { - if (!(SiebCount % 4)) + if (!(game.magic_wall_time_left % 4)) PlaySoundLevel(sieb_x, sieb_y, SND_MIEP); - if (SiebCount > 0) + if (game.magic_wall_time_left > 0) { - SiebCount--; - if (!SiebCount) + game.magic_wall_time_left--; + if (!game.magic_wall_time_left) { for (y=0; ygone || (!dx && !dy)) + if (!player->active || (!dx && !dy)) return MF_NO_ACTION; player->MovDir = (dx < 0 ? MV_LEFT : @@ -3856,7 +3854,7 @@ boolean MoveFigure(struct PlayerInfo *player, int dx, int dy) int old_jx = jx, old_jy = jy; int moved = MF_NO_ACTION; - if (player->gone || (!dx && !dy)) + if (!player->active || (!dx && !dy)) return FALSE; if (!FrameReached(&player->move_delay, player->move_delay_value) && @@ -4000,7 +3998,7 @@ boolean MoveFigure(struct PlayerInfo *player, int dx, int dy) TestIfHeroHitsBadThing(jx, jy); - if (player->gone) + if (!player->active) RemoveHero(player); return moved; @@ -4012,7 +4010,7 @@ void ScrollFigure(struct PlayerInfo *player, int mode) int last_jx = player->last_jx, last_jy = player->last_jy; int move_stepsize = TILEX / player->move_delay_value; - if (!player->active || player->gone || !player->MovPos) + if (!player->active || !player->MovPos) return; if (mode == SCROLL_INIT) @@ -4259,7 +4257,7 @@ void KillHero(struct PlayerInfo *player) { int jx = player->jx, jy = player->jy; - if (player->gone) + if (!player->active) return; if (IS_PFORTE(Feld[jx][jy])) @@ -4273,7 +4271,7 @@ void BuryHero(struct PlayerInfo *player) { int jx = player->jx, jy = player->jy; - if (player->gone) + if (!player->active) return; PlaySoundLevel(jx, jy, SND_AUTSCH); @@ -4288,11 +4286,13 @@ void RemoveHero(struct PlayerInfo *player) int jx = player->jx, jy = player->jy; int i, found = FALSE; - player->gone = TRUE; + player->present = FALSE; + player->active = FALSE; + StorePlayer[jx][jy] = 0; for (i=0; isokobanfields_still_needed == 0 && - game_emulation == EMU_SOKOBAN) + game.emulation == EMU_SOKOBAN) { player->LevelSolved = player->GameOver = TRUE; PlaySoundLevel(x, y, SND_BUING); @@ -4739,7 +4739,7 @@ boolean SnapField(struct PlayerInfo *player, int dx, int dy) int jx = player->jx, jy = player->jy; int x = jx + dx, y = jy + dy; - if (player->gone || !IN_LEV_FIELD(x, y)) + if (!player->active || !IN_LEV_FIELD(x, y)) return FALSE; if (dx && dy) @@ -4774,7 +4774,7 @@ boolean PlaceBomb(struct PlayerInfo *player) int jx = player->jx, jy = player->jy; int element; - if (player->gone || player->MovPos) + if (!player->active || player->MovPos) return FALSE; element = Feld[jx][jy]; @@ -4796,7 +4796,7 @@ boolean PlaceBomb(struct PlayerInfo *player) FS_SMALL, FC_YELLOW); if (IN_SCR_FIELD(SCREENX(jx), SCREENY(jy))) { - if (game_emulation == EMU_SUPAPLEX) + if (game.emulation == EMU_SUPAPLEX) DrawGraphic(SCREENX(jx), SCREENY(jy), GFX_SP_DISK_RED); else DrawGraphicThruMask(SCREENX(jx), SCREENY(jy), GFX_DYNAMIT);