X-Git-Url: https://git.artsoft.org/?a=blobdiff_plain;f=src%2Fgame.c;h=f280dbacc2825b7d973b4b34e22a264394f26232;hb=bdb859038a8e2a419aa326bd38eff7e1045da834;hp=cb8a7974bcf2a5f5345cd7b50b22fa6b723c4040;hpb=2362e426463cb445e119a4e3e5ce0b6ccb3fb33c;p=rocksndiamonds.git diff --git a/src/game.c b/src/game.c index cb8a7974..f280dbac 100644 --- a/src/game.c +++ b/src/game.c @@ -2121,6 +2121,15 @@ void InitGame() #endif } +void UpdateEngineValues(int actual_scroll_x, int actual_scroll_y) +{ + /* this is used for non-R'n'D game engines to update certain engine values */ + + /* needed to determine if sounds are played within the visible screen area */ + scroll_x = actual_scroll_x; + scroll_y = actual_scroll_y; +} + void InitMovDir(int x, int y) { int i, element = Feld[x][y]; @@ -3125,8 +3134,15 @@ void Explode(int ex, int ey, int phase, int mode) return; #endif +#if 1 + if (mode == EX_TYPE_NORMAL || + mode == EX_TYPE_CENTER || + mode == EX_TYPE_CROSS) + PlayLevelSoundAction(ex, ey, ACTION_EXPLODING); +#else if (mode == EX_TYPE_NORMAL || mode == EX_TYPE_CENTER) PlayLevelSoundAction(ex, ey, ACTION_EXPLODING); +#endif /* remove things displayed in background while burning dynamite */ if (Back[ex][ey] != EL_EMPTY && !IS_INDESTRUCTIBLE(Back[ex][ey])) @@ -8529,8 +8545,8 @@ void AdvanceFrameAndPlayerCounters(int player_nr) void GameActions() { - static unsigned long action_delay = 0; - unsigned long action_delay_value; + static unsigned long game_frame_delay = 0; + unsigned long game_frame_delay_value; int magic_wall_x = 0, magic_wall_y = 0; int i, x, y, element, graphic; byte *recorded_player_action; @@ -8542,15 +8558,15 @@ void GameActions() if (game_status != GAME_MODE_PLAYING) return; - action_delay_value = + game_frame_delay_value = (tape.playing && tape.fast_forward ? FfwdFrameDelay : GameFrameDelay); if (tape.playing && tape.warp_forward && !tape.pausing) - action_delay_value = 0; + game_frame_delay_value = 0; /* ---------- main game synchronization point ---------- */ - WaitUntilDelayReached(&action_delay, action_delay_value); + WaitUntilDelayReached(&game_frame_delay, game_frame_delay_value); if (network_playing && !network_player_action_received) { @@ -12394,6 +12410,151 @@ static void PlayLevelMusic() PlayMusic(MAP_NOCONF_MUSIC(level_nr)); /* from music dir */ } +void PlayLevelSound_EM(int x, int y, int element_em, int sample) +{ + int element = (element_em > -1 ? map_element_EM_to_RND(element_em) : 0); + +#if 0 + if (sample == SAMPLE_bug) + printf("::: PlayLevelSound_EM: %d, %d: %d\n", x, y, sample); +#endif + + switch (sample) + { + case SAMPLE_blank: + PlayLevelSoundElementAction(x, y, element, ACTION_WALKING); + break; + + case SAMPLE_roll: + PlayLevelSoundElementAction(x, y, element, ACTION_PUSHING); + break; + + case SAMPLE_stone: + PlayLevelSoundElementAction(x, y, element, ACTION_IMPACT); + break; + + case SAMPLE_nut: + PlayLevelSoundElementAction(x, y, element, ACTION_IMPACT); + break; + + case SAMPLE_crack: + PlayLevelSoundElementAction(x, y, element, ACTION_BREAKING); + break; + + case SAMPLE_bug: + PlayLevelSoundElementAction(x, y, EL_BUG, ACTION_MOVING); + break; + + case SAMPLE_tank: + PlayLevelSoundElementAction(x, y, EL_SPACESHIP, ACTION_MOVING); + break; + + case SAMPLE_android: + PlayLevelSoundElementAction(x, y, element, ACTION_DROPPING); + break; + + case SAMPLE_spring: + PlayLevelSoundElementAction(x, y, element, ACTION_IMPACT); + break; + + case SAMPLE_slurp: + PlayLevelSoundElementAction(x, y, element, ACTION_DYING); + break; + + case SAMPLE_eater: + PlayLevelSoundElementAction(x, y, EL_YAMYAM, ACTION_WAITING); + break; + + case SAMPLE_alien: + PlayLevelSoundElementAction(x, y, element, ACTION_MOVING); + break; + + case SAMPLE_collect: + PlayLevelSoundElementAction(x, y, element, ACTION_COLLECTING); + break; + + case SAMPLE_diamond: + PlayLevelSoundElementAction(x, y, element, ACTION_IMPACT); + break; + + case SAMPLE_squash: + PlayLevelSoundElementAction(x, y, element, ACTION_BREAKING); + break; + + case SAMPLE_wonderfall: + PlayLevelSoundElementAction(x, y, EL_MAGIC_WALL, ACTION_FILLING); + break; + + case SAMPLE_drip: + PlayLevelSoundElementAction(x, y, element, ACTION_IMPACT); + break; + + case SAMPLE_push: + PlayLevelSoundElementAction(x, y, element, ACTION_PUSHING); + break; + + case SAMPLE_dirt: + PlayLevelSoundElementAction(x, y, element, ACTION_DIGGING); + break; + + case SAMPLE_acid: + PlayLevelSound(x, y, SND_ACID_SPLASHING); + break; + + case SAMPLE_ball: + PlayLevelSoundElementAction(x, y, element, ACTION_DROPPING); + break; + + case SAMPLE_grow: + PlayLevelSoundElementAction(x, y, element, ACTION_GROWING); + break; + + case SAMPLE_wonder: + PlayLevelSoundElementAction(x, y, element, ACTION_ACTIVE); + break; + + case SAMPLE_door: + PlayLevelSoundElementAction(x, y, element, ACTION_PASSING); + break; + + case SAMPLE_exit: + PlayLevelSoundElementAction(x, y, element, ACTION_PASSING); + break; + + case SAMPLE_dynamite: + PlayLevelSoundElementAction(x, y, element, ACTION_DROPPING); + break; + + case SAMPLE_tick: + PlayLevelSoundElementAction(x, y, element, ACTION_ACTIVE); + break; + + case SAMPLE_press: + PlayLevelSoundElementAction(x, y, element, ACTION_ACTIVATING); + break; + + case SAMPLE_wheel: + PlaySoundStereo(SND_MAGIC_WALL_ACTIVE, SOUND_MIDDLE); + break; + + case SAMPLE_boom: + PlayLevelSoundElementAction(x, y, element, ACTION_EXPLODING); + break; + + case SAMPLE_time: + PlaySoundStereo(SND_GAME_RUNNING_OUT_OF_TIME, SOUND_MIDDLE); + break; + + case SAMPLE_die: + PlayLevelSoundElementAction(x, y, element, ACTION_DYING); + break; + + default: + PlayLevelSoundElementAction(x, y, element, ACTION_DEFAULT); + break; + } +} + void RaiseScore(int value) { local_player->score += value;