X-Git-Url: https://git.artsoft.org/?a=blobdiff_plain;f=src%2Fgame.c;h=0bd65fdb476fe8b3c45d4b186275e070c661c44a;hb=2a4878a4c2873df0426a22c357533656928748c8;hp=dc992f2573674d3a11831b92827c8434729b6167;hpb=67758fda340e825f188fc6a4caad03381bf031dc;p=rocksndiamonds.git diff --git a/src/game.c b/src/game.c index dc992f25..0bd65fdb 100644 --- a/src/game.c +++ b/src/game.c @@ -91,15 +91,6 @@ #define SC_SCHLUESSEL 9 #define SC_ZEITBONUS 10 -/* values for game_emulation */ -#define EMU_NONE 0 -#define EMU_BOULDERDASH 1 -#define EMU_SOKOBAN 2 -#define EMU_SUPAPLEX 3 - -/* to control special behaviour of certain game elements */ -int game_emulation = EMU_NONE; - @@ -392,6 +383,7 @@ void InitGame() MampferNr = 0; FrameCounter = 0; TimeFrames = 0; + TimePlayed = 0; TimeLeft = level.time; ScreenMovDir = MV_NO_MOVING; @@ -744,7 +736,7 @@ void GameWon() { if (!setup.sound_loops) PlaySoundStereo(SND_SIRR, PSND_MAX_RIGHT); - if (TimeLeft && !(TimeLeft % 10)) + if (TimeLeft > 0 && !(TimeLeft % 10)) RaiseScore(level.score[SC_ZEITBONUS]); if (TimeLeft > 100 && !(TimeLeft % 10)) TimeLeft -= 10; @@ -758,6 +750,29 @@ void GameWon() if (setup.sound_loops) StopSound(SND_SIRR); } + else if (level.time == 0) /* level without time limit */ + { + if (setup.sound_loops) + PlaySoundExt(SND_SIRR, PSND_MAX_VOLUME, PSND_MAX_RIGHT, PSND_LOOP); + + while(TimePlayed < 999) + { + if (!setup.sound_loops) + PlaySoundStereo(SND_SIRR, PSND_MAX_RIGHT); + if (TimePlayed < 999 && !(TimePlayed % 10)) + RaiseScore(level.score[SC_ZEITBONUS]); + if (TimePlayed < 900 && !(TimePlayed % 10)) + TimePlayed += 10; + else + TimePlayed++; + DrawText(DX_TIME, DY_TIME, int2str(TimePlayed, 3), FS_SMALL, FC_YELLOW); + BackToFront(); + Delay(10); + } + + if (setup.sound_loops) + StopSound(SND_SIRR); + } FadeSounds(); @@ -794,7 +809,7 @@ void GameWon() BackToFront(); } -boolean NewHiScore() +int NewHiScore() { int k, l; int position = -1; @@ -978,7 +993,9 @@ void DrawDynamite(int x, int y) phase = 7 - phase; } - if (Store[x][y]) + if (game_emulation == EMU_SUPAPLEX) + DrawGraphic(sx, sy, GFX_SP_DISK_RED); + else if (Store[x][y]) DrawGraphicThruMask(sx, sy, graphic + phase); else DrawGraphic(sx, sy, graphic + phase); @@ -1218,7 +1235,10 @@ void Bang(int x, int y) { int element = Feld[x][y]; - PlaySoundLevel(x, y, SND_ROAAAR); + if (game_emulation == EMU_SUPAPLEX) + PlaySoundLevel(x, y, SND_SP_BOOOM); + else + PlaySoundLevel(x, y, SND_ROAAAR); if (IS_PLAYER(x, y)) /* remove objects that might cause smaller explosion */ element = EL_LEERRAUM; @@ -1434,6 +1454,7 @@ void Impact(int x, int y) case EL_EDELSTEIN_ROT: case EL_EDELSTEIN_LILA: case EL_DIAMANT: + case EL_SP_INFOTRON: sound = SND_PLING; break; case EL_KOKOSNUSS: @@ -1442,6 +1463,9 @@ void Impact(int x, int y) case EL_FELSBROCKEN: sound = SND_KLOPF; break; + case EL_SP_ZONK: + sound = SND_SP_ZONKDOWN; + break; case EL_SCHLUESSEL: case EL_SCHLUESSEL1: case EL_SCHLUESSEL2: @@ -3157,6 +3181,68 @@ void CheckForDragon(int x, int y) } } +static void CheckBuggyBase(int x, int y) +{ + int element = Feld[x][y]; + + if (element == EL_SP_BUG) + { + if (!MovDelay[x][y]) /* start activating buggy base */ + MovDelay[x][y] = 2 * FRAMES_PER_SECOND + RND(5 * FRAMES_PER_SECOND); + + if (MovDelay[x][y]) /* wait some time before activating base */ + { + MovDelay[x][y]--; + if (MovDelay[x][y] < 5 && IN_SCR_FIELD(SCREENX(x), SCREENY(y))) + DrawGraphic(SCREENX(x), SCREENY(y), GFX_SP_BUG_WARNING); + if (MovDelay[x][y]) + return; + + Feld[x][y] = EL_SP_BUG_ACTIVE; + } + } + else if (element == EL_SP_BUG_ACTIVE) + { + if (!MovDelay[x][y]) /* start activating buggy base */ + MovDelay[x][y] = 1 * FRAMES_PER_SECOND + RND(1 * FRAMES_PER_SECOND); + + if (MovDelay[x][y]) /* wait some time before activating base */ + { + MovDelay[x][y]--; + if (MovDelay[x][y]) + { + int i; + static int xy[4][2] = + { + { 0, -1 }, + { -1, 0 }, + { +1, 0 }, + { 0, +1 } + }; + + if (IN_SCR_FIELD(SCREENX(x), SCREENY(y))) + DrawGraphic(SCREENX(x),SCREENY(y), GFX_SP_BUG_ACTIVE + SimpleRND(4)); + + for (i=0; i<4; i++) + { + int xx = x + xy[i][0], yy = y + xy[i][1]; + + if (IS_PLAYER(xx, yy)) + { + PlaySoundLevel(x, y, SND_SP_BUG); + break; + } + } + + return; + } + + Feld[x][y] = EL_SP_BUG; + DrawLevelField(x, y); + } + } +} + static void PlayerActions(struct PlayerInfo *player, byte player_action) { static byte stored_player_action[MAX_PLAYERS]; @@ -3400,9 +3486,9 @@ void GameActions() extern unsigned int last_RND(); printf("DEBUG: %03d last RND was %d \t [state checksum is %d]\n", - level.time - TimeLeft, + TimePlayed, last_RND(), - getStateCheckSum(level.time - TimeLeft)); + getStateCheckSum(TimePlayed)); } */ #endif @@ -3495,10 +3581,12 @@ void GameActions() MauerAbleger(x, y); else if (element == EL_BURNING) CheckForDragon(x, y); + else if (element == EL_SP_BUG || element == EL_SP_BUG_ACTIVE) + CheckBuggyBase(x, y); else if (element == EL_SP_TERMINAL) - DrawGraphicAnimation(x, y, GFX2_SP_TERMINAL, 7, 10, ANIM_NORMAL); + DrawGraphicAnimation(x, y, GFX2_SP_TERMINAL, 7, 12, ANIM_NORMAL); else if (element == EL_SP_TERMINAL_ACTIVE) - DrawGraphicAnimation(x, y, GFX2_SP_TERMINAL_ACTIVE, 7, 2, ANIM_NORMAL); + DrawGraphicAnimation(x, y, GFX2_SP_TERMINAL_ACTIVE, 7, 4, ANIM_NORMAL); if (SiebAktiv) { @@ -3557,22 +3645,29 @@ void GameActions() } } - if (TimeLeft > 0 && TimeFrames >= (1000 / GameFrameDelay) && !tape.pausing) + if (TimeFrames >= (1000 / GameFrameDelay) && !tape.pausing) { TimeFrames = 0; - TimeLeft--; + TimePlayed++; if (tape.recording || tape.playing) - DrawVideoDisplay(VIDEO_STATE_TIME_ON, level.time-TimeLeft); + DrawVideoDisplay(VIDEO_STATE_TIME_ON, TimePlayed); - if (TimeLeft<=10) - PlaySoundStereo(SND_GONG, PSND_MAX_RIGHT); + if (TimeLeft > 0) + { + TimeLeft--; - DrawText(DX_TIME, DY_TIME, int2str(TimeLeft, 3), FS_SMALL, FC_YELLOW); + if (TimeLeft <= 10) + PlaySoundStereo(SND_GONG, PSND_MAX_RIGHT); - if (!TimeLeft) - for (i=0; igems_still_needed, 3), FS_SMALL, FC_YELLOW); - PlaySoundLevel(x, y, SND_PONG); + if (element == EL_SP_INFOTRON) + PlaySoundLevel(x, y, SND_SP_INFOTRON); + else + PlaySoundLevel(x, y, SND_PONG); break; case EL_SPEED_PILL: @@ -4192,7 +4298,10 @@ int DigField(struct PlayerInfo *player, DrawText(DX_DYNAMITE, DY_DYNAMITE, int2str(local_player->dynamite, 3), FS_SMALL, FC_YELLOW); - PlaySoundLevel(x, y, SND_PONG); + if (element == EL_SP_DISK_RED) + PlaySoundLevel(x, y, SND_SP_INFOTRON); + else + PlaySoundLevel(x, y, SND_PONG); break; case EL_DYNABOMB_NR: @@ -4269,7 +4378,7 @@ int DigField(struct PlayerInfo *player, return MF_NO_ACTION; player->LevelSolved = player->GameOver = TRUE; - PlaySoundLevel(x, y, SND_BUING); + PlaySoundStereo(SND_SP_EXIT, PSND_MAX_RIGHT); break; case EL_FELSBROCKEN: @@ -4308,6 +4417,8 @@ int DigField(struct PlayerInfo *player, PlaySoundLevel(x+dx, y+dy, SND_PUSCH); else if (element == EL_KOKOSNUSS) PlaySoundLevel(x+dx, y+dy, SND_KNURK); + else if (IS_SP_ELEMENT(element)) + PlaySoundLevel(x+dx, y+dy, SND_SP_ZONKPUSH); else PlaySoundLevel(x+dx, y+dy, SND_KLOPF); break; @@ -4487,12 +4598,7 @@ int DigField(struct PlayerInfo *player, break; default: - if (IS_EATABLE(element)) /* other kinds of 'dirt' */ - Feld[x][y] = EL_LEERRAUM; - else - return MF_NO_ACTION; - - break; + return MF_NO_ACTION; } player->push_delay = 0; @@ -4561,7 +4667,12 @@ boolean PlaceBomb(struct PlayerInfo *player) DrawText(DX_DYNAMITE, DY_DYNAMITE, int2str(local_player->dynamite, 3), FS_SMALL, FC_YELLOW); if (IN_SCR_FIELD(SCREENX(jx), SCREENY(jy))) - DrawGraphicThruMask(SCREENX(jx), SCREENY(jy), GFX_DYNAMIT); + { + if (game_emulation == EMU_SUPAPLEX) + DrawGraphic(SCREENX(jx), SCREENY(jy), GFX_SP_DISK_RED); + else + DrawGraphicThruMask(SCREENX(jx), SCREENY(jy), GFX_DYNAMIT); + } } else {