X-Git-Url: https://git.artsoft.org/?a=blobdiff_plain;f=src%2Fgame.c;h=b82ede439a61eea86f45182870abb95d7f777524;hb=cd9add1d9479d1938d05ca9df4f31c3f99bd5f3e;hp=5dbf9df02a21b95923757ebeff666a09bc1c15a7;hpb=16018297276e05edcfbe7aeda9e04a61d19e1e4c;p=rocksndiamonds.git diff --git a/src/game.c b/src/game.c index 5dbf9df0..b82ede43 100644 --- a/src/game.c +++ b/src/game.c @@ -1,7 +1,7 @@ /*********************************************************** * Rocks'n'Diamonds -- McDuffin Strikes Back! * *----------------------------------------------------------* -* (c) 1995-2001 Artsoft Entertainment * +* (c) 1995-2002 Artsoft Entertainment * * Holger Schemel * * Detmolder Strasse 189 * * 33604 Bielefeld * @@ -19,7 +19,6 @@ #include "init.h" #include "files.h" #include "tape.h" -#include "joystick.h" #include "network.h" /* this switch controls how rocks move horizontally */ @@ -77,12 +76,9 @@ #define DX_TIME (DX + XX_TIME) #define DY_TIME (DY + YY_TIME) -#define IS_LOOP_SOUND(s) ((s)==SND_KLAPPER || (s)==SND_ROEHR || \ - (s)==SND_NJAM || (s)==SND_MIEP) -#define IS_MUSIC_SOUND(s) ((s)==SND_ALCHEMY || (s)==SND_CHASE || \ - (s)==SND_NETWORK || (s)==SND_CZARDASZ || \ - (s)==SND_TYGER || (s)==SND_VOYAGER || \ - (s)==SND_TWILIGHT) +/* values for initial player move delay (initial delay counter value) */ +#define INITIAL_MOVE_DELAY_OFF -1 +#define INITIAL_MOVE_DELAY_ON 0 /* values for player movement speed (which is in fact a delay value) */ #define MOVE_DELAY_NORMAL_SPEED 8 @@ -108,11 +104,56 @@ static void CloseAllOpenTimegates(void); static void CheckGravityMovement(struct PlayerInfo *); static void KillHeroUnlessProtected(int, int); +void PlaySoundLevel(int, int, int); +void PlaySoundLevelAction(int, int, int); +void PlaySoundLevelElementAction(int, int, int, int); + static void MapGameButtons(); static void HandleGameButtons(struct GadgetInfo *); static struct GadgetInfo *game_gadget[NUM_GAME_BUTTONS]; +#define SND_ACTION_UNKNOWN 0 +#define SND_ACTION_WAITING 1 +#define SND_ACTION_MOVING 2 +#define SND_ACTION_DIGGING 3 +#define SND_ACTION_COLLECTING 4 +#define SND_ACTION_PASSING 5 +#define SND_ACTION_IMPACT 6 +#define SND_ACTION_PUSHING 7 +#define SND_ACTION_ACTIVATING 8 +#define SND_ACTION_ACTIVE 9 + +#define NUM_SND_ACTIONS 10 + +static struct +{ + char *text; + int value; + boolean is_loop; +} sound_action_properties[] = +{ + /* insert _all_ loop sound actions here */ + { ".waiting", SND_ACTION_WAITING, TRUE }, + { ".moving", SND_ACTION_MOVING, TRUE }, /* continuos moving */ + { ".active", SND_ACTION_ACTIVE, TRUE }, + { ".growing", SND_ACTION_UNKNOWN, TRUE }, + { ".attacking", SND_ACTION_UNKNOWN, TRUE }, + + /* other (non-loop) sound actions are optional */ + { ".stepping", SND_ACTION_MOVING, FALSE }, /* discrete moving */ + { ".digging", SND_ACTION_DIGGING, FALSE }, + { ".collecting", SND_ACTION_COLLECTING, FALSE }, + { ".passing", SND_ACTION_PASSING, FALSE }, + { ".impact", SND_ACTION_IMPACT, FALSE }, + { ".pushing", SND_ACTION_PUSHING, FALSE }, + { ".activating", SND_ACTION_ACTIVATING, FALSE }, + { NULL, 0, 0 }, +}; +static int element_action_sound[MAX_NUM_ELEMENTS][NUM_SND_ACTIONS]; +static boolean is_loop_sound[NUM_SOUND_FILES]; + +#define IS_LOOP_SOUND(x) (is_loop_sound[x]) #ifdef DEBUG @@ -174,10 +215,10 @@ void GetPlayerConfig() setup.sound = FALSE; if (!audio.loops_available) - { setup.sound_loops = FALSE; + + if (!audio.music_available) setup.sound_music = FALSE; - } if (!video.fullscreen_available) setup.fullscreen = FALSE; @@ -188,37 +229,44 @@ void GetPlayerConfig() InitJoysticks(); } -static int getBeltNrFromElement(int element) +static int getBeltNrFromBeltElement(int element) { - return (element < EL_BELT2_LEFT ? 0 : - element < EL_BELT3_LEFT ? 1 : - element < EL_BELT4_LEFT ? 2 : 3); + return (element < EL_CONVEYOR_BELT2_LEFT ? 0 : + element < EL_CONVEYOR_BELT3_LEFT ? 1 : + element < EL_CONVEYOR_BELT4_LEFT ? 2 : 3); } -static int getBeltNrFromSwitchElement(int element) +static int getBeltNrFromBeltActiveElement(int element) { - return (element < EL_BELT2_SWITCH_LEFT ? 0 : - element < EL_BELT3_SWITCH_LEFT ? 1 : - element < EL_BELT4_SWITCH_LEFT ? 2 : 3); + return (element < EL_CONVEYOR_BELT2_LEFT_ACTIVE ? 0 : + element < EL_CONVEYOR_BELT3_LEFT_ACTIVE ? 1 : + element < EL_CONVEYOR_BELT4_LEFT_ACTIVE ? 2 : 3); } -static int getBeltDirNrFromSwitchElement(int element) +static int getBeltNrFromBeltSwitchElement(int element) +{ + return (element < EL_CONVEYOR_BELT2_SWITCH_LEFT ? 0 : + element < EL_CONVEYOR_BELT3_SWITCH_LEFT ? 1 : + element < EL_CONVEYOR_BELT4_SWITCH_LEFT ? 2 : 3); +} + +static int getBeltDirNrFromBeltSwitchElement(int element) { static int belt_base_element[4] = { - EL_BELT1_SWITCH_LEFT, - EL_BELT2_SWITCH_LEFT, - EL_BELT3_SWITCH_LEFT, - EL_BELT4_SWITCH_LEFT + EL_CONVEYOR_BELT1_SWITCH_LEFT, + EL_CONVEYOR_BELT2_SWITCH_LEFT, + EL_CONVEYOR_BELT3_SWITCH_LEFT, + EL_CONVEYOR_BELT4_SWITCH_LEFT }; - int belt_nr = getBeltNrFromSwitchElement(element); + int belt_nr = getBeltNrFromBeltSwitchElement(element); int belt_dir_nr = element - belt_base_element[belt_nr]; return (belt_dir_nr % 3); } -static int getBeltDirFromSwitchElement(int element) +static int getBeltDirFromBeltSwitchElement(int element) { static int belt_move_dir[3] = { @@ -227,7 +275,7 @@ static int getBeltDirFromSwitchElement(int element) MV_RIGHT }; - int belt_dir_nr = getBeltDirNrFromSwitchElement(element); + int belt_dir_nr = getBeltDirNrFromBeltSwitchElement(element); return belt_move_dir[belt_dir_nr]; } @@ -246,17 +294,13 @@ static void InitField(int x, int y, boolean init_game) } } /* no break! */ - case EL_SPIELFIGUR: - if (init_game) - Feld[x][y] = EL_SPIELER1; - /* no break! */ - case EL_SPIELER1: - case EL_SPIELER2: - case EL_SPIELER3: - case EL_SPIELER4: + case EL_PLAYER1: + case EL_PLAYER2: + case EL_PLAYER3: + case EL_PLAYER4: if (init_game) { - struct PlayerInfo *player = &stored_player[Feld[x][y] - EL_SPIELER1]; + struct PlayerInfo *player = &stored_player[Feld[x][y] - EL_PLAYER1]; int jx = player->jx, jy = player->jy; player->present = TRUE; @@ -280,51 +324,51 @@ static void InitField(int x, int y, boolean init_game) } } - Feld[x][y] = EL_LEERRAUM; + Feld[x][y] = EL_EMPTY; player->jx = player->last_jx = x; player->jy = player->last_jy = y; } break; - case EL_BADEWANNE: - if (x < lev_fieldx-1 && Feld[x+1][y] == EL_SALZSAEURE) - Feld[x][y] = EL_BADEWANNE1; - else if (x > 0 && Feld[x-1][y] == EL_SALZSAEURE) - Feld[x][y] = EL_BADEWANNE2; - else if (y > 0 && Feld[x][y-1] == EL_BADEWANNE1) - Feld[x][y] = EL_BADEWANNE3; - else if (y > 0 && Feld[x][y-1] == EL_SALZSAEURE) - Feld[x][y] = EL_BADEWANNE4; - else if (y > 0 && Feld[x][y-1] == EL_BADEWANNE2) - Feld[x][y] = EL_BADEWANNE5; + case EL_STONEBLOCK: + if (x < lev_fieldx-1 && Feld[x+1][y] == EL_ACID) + Feld[x][y] = EL_ACIDPOOL_TOPLEFT; + else if (x > 0 && Feld[x-1][y] == EL_ACID) + Feld[x][y] = EL_ACIDPOOL_TOPRIGHT; + else if (y > 0 && Feld[x][y-1] == EL_ACIDPOOL_TOPLEFT) + Feld[x][y] = EL_ACIDPOOL_BOTTOMLEFT; + else if (y > 0 && Feld[x][y-1] == EL_ACID) + Feld[x][y] = EL_ACIDPOOL_BOTTOM; + else if (y > 0 && Feld[x][y-1] == EL_ACIDPOOL_TOPRIGHT) + Feld[x][y] = EL_ACIDPOOL_BOTTOMRIGHT; break; - case EL_KAEFER_RIGHT: - case EL_KAEFER_UP: - case EL_KAEFER_LEFT: - case EL_KAEFER_DOWN: - case EL_KAEFER: - case EL_FLIEGER_RIGHT: - case EL_FLIEGER_UP: - case EL_FLIEGER_LEFT: - case EL_FLIEGER_DOWN: - case EL_FLIEGER: - case EL_BUTTERFLY_RIGHT: - case EL_BUTTERFLY_UP: - case EL_BUTTERFLY_LEFT: - case EL_BUTTERFLY_DOWN: - case EL_BUTTERFLY: - case EL_FIREFLY_RIGHT: - case EL_FIREFLY_UP: - case EL_FIREFLY_LEFT: - case EL_FIREFLY_DOWN: - case EL_FIREFLY: + case EL_BUG_RIGHT: + case EL_BUG_UP: + case EL_BUG_LEFT: + case EL_BUG_DOWN: + case EL_BUG: + case EL_SPACESHIP_RIGHT: + case EL_SPACESHIP_UP: + case EL_SPACESHIP_LEFT: + case EL_SPACESHIP_DOWN: + case EL_SPACESHIP: + case EL_BD_BUTTERFLY_RIGHT: + case EL_BD_BUTTERFLY_UP: + case EL_BD_BUTTERFLY_LEFT: + case EL_BD_BUTTERFLY_DOWN: + case EL_BD_BUTTERFLY: + case EL_BD_FIREFLY_RIGHT: + case EL_BD_FIREFLY_UP: + case EL_BD_FIREFLY_LEFT: + case EL_BD_FIREFLY_DOWN: + case EL_BD_FIREFLY: case EL_PACMAN_RIGHT: case EL_PACMAN_UP: case EL_PACMAN_LEFT: case EL_PACMAN_DOWN: - case EL_MAMPFER: - case EL_MAMPFER2: + case EL_YAMYAM: + case EL_DARK_YAMYAM: case EL_ROBOT: case EL_PACMAN: case EL_SP_SNIKSNAK: @@ -337,16 +381,16 @@ static void InitField(int x, int y, boolean init_game) InitMovDir(x, y); break; - case EL_AMOEBE_VOLL: - case EL_AMOEBE_BD: + case EL_AMOEBA_FULL: + case EL_BD_AMOEBA: InitAmoebaNr(x, y); break; - case EL_TROPFEN: + case EL_AMOEBA_DROP: if (y == lev_fieldy - 1) { - Feld[x][y] = EL_AMOEBING; - Store[x][y] = EL_AMOEBE_NASS; + Feld[x][y] = EL_AMOEBA_CREATING; + Store[x][y] = EL_AMOEBA_WET; } break; @@ -354,57 +398,57 @@ static void InitField(int x, int y, boolean init_game) MovDelay[x][y] = 96; break; - case EL_BIRNE_AUS: + case EL_LAMP: local_player->lights_still_needed++; break; - case EL_SOKOBAN_FELD_LEER: + case EL_SOKOBAN_FIELD_EMPTY: local_player->sokobanfields_still_needed++; break; - case EL_PINGUIN: + case EL_PENGUIN: local_player->friends_still_needed++; break; - case EL_SCHWEIN: - case EL_DRACHE: + case EL_PIG: + case EL_DRAGON: MovDir[x][y] = 1 << RND(4); break; case EL_SP_EMPTY: - Feld[x][y] = EL_LEERRAUM; + Feld[x][y] = EL_EMPTY; break; - case EL_EM_KEY_1_FILE: - Feld[x][y] = EL_EM_KEY_1; + case EL_EM_KEY1_FILE: + Feld[x][y] = EL_EM_KEY1; break; - case EL_EM_KEY_2_FILE: - Feld[x][y] = EL_EM_KEY_2; + case EL_EM_KEY2_FILE: + Feld[x][y] = EL_EM_KEY2; break; - case EL_EM_KEY_3_FILE: - Feld[x][y] = EL_EM_KEY_3; + case EL_EM_KEY3_FILE: + Feld[x][y] = EL_EM_KEY3; break; - case EL_EM_KEY_4_FILE: - Feld[x][y] = EL_EM_KEY_4; + case EL_EM_KEY4_FILE: + Feld[x][y] = EL_EM_KEY4; break; - case EL_BELT1_SWITCH_LEFT: - case EL_BELT1_SWITCH_MIDDLE: - case EL_BELT1_SWITCH_RIGHT: - case EL_BELT2_SWITCH_LEFT: - case EL_BELT2_SWITCH_MIDDLE: - case EL_BELT2_SWITCH_RIGHT: - case EL_BELT3_SWITCH_LEFT: - case EL_BELT3_SWITCH_MIDDLE: - case EL_BELT3_SWITCH_RIGHT: - case EL_BELT4_SWITCH_LEFT: - case EL_BELT4_SWITCH_MIDDLE: - case EL_BELT4_SWITCH_RIGHT: + case EL_CONVEYOR_BELT1_SWITCH_LEFT: + case EL_CONVEYOR_BELT1_SWITCH_MIDDLE: + case EL_CONVEYOR_BELT1_SWITCH_RIGHT: + case EL_CONVEYOR_BELT2_SWITCH_LEFT: + case EL_CONVEYOR_BELT2_SWITCH_MIDDLE: + case EL_CONVEYOR_BELT2_SWITCH_RIGHT: + case EL_CONVEYOR_BELT3_SWITCH_LEFT: + case EL_CONVEYOR_BELT3_SWITCH_MIDDLE: + case EL_CONVEYOR_BELT3_SWITCH_RIGHT: + case EL_CONVEYOR_BELT4_SWITCH_LEFT: + case EL_CONVEYOR_BELT4_SWITCH_MIDDLE: + case EL_CONVEYOR_BELT4_SWITCH_RIGHT: if (init_game) { - int belt_nr = getBeltNrFromSwitchElement(Feld[x][y]); - int belt_dir = getBeltDirFromSwitchElement(Feld[x][y]); - int belt_dir_nr = getBeltDirNrFromSwitchElement(Feld[x][y]); + int belt_nr = getBeltNrFromBeltSwitchElement(Feld[x][y]); + int belt_dir = getBeltDirFromBeltSwitchElement(Feld[x][y]); + int belt_dir_nr = getBeltDirNrFromBeltSwitchElement(Feld[x][y]); if (game.belt_dir_nr[belt_nr] == 3) /* initial value */ { @@ -418,12 +462,12 @@ static void InitField(int x, int y, boolean init_game) } break; - case EL_SWITCHGATE_SWITCH_2: /* always start with same switch pos */ + case EL_SWITCHGATE_SWITCH_DOWN: /* always start with same switch pos */ if (init_game) - Feld[x][y] = EL_SWITCHGATE_SWITCH_1; + Feld[x][y] = EL_SWITCHGATE_SWITCH_UP; break; - case EL_LIGHT_SWITCH_ON: + case EL_LIGHT_SWITCH_ACTIVE: if (init_game) game.light_time_left = level.time_light * FRAMES_PER_SECOND; break; @@ -433,19 +477,206 @@ static void InitField(int x, int y, boolean init_game) } } +void DrawGameDoorValues() +{ + int i, j; + + for (i=0; igems_still_needed, 3), FS_SMALL, FC_YELLOW); + DrawText(DX + XX_DYNAMITE, DY + YY_DYNAMITE, + int2str(local_player->dynamite, 3), FS_SMALL, FC_YELLOW); + DrawText(DX + XX_SCORE, DY + YY_SCORE, + int2str(local_player->score, 5), FS_SMALL, FC_YELLOW); + DrawText(DX + XX_TIME, DY + YY_TIME, + int2str(TimeLeft, 3), FS_SMALL, FC_YELLOW); +} + + +/* + ============================================================================= + InitGameSound() + ----------------------------------------------------------------------------- + initialize sound effect lookup table for element actions + ============================================================================= +*/ + +void InitGameSound() +{ + int sound_effect_properties[NUM_SOUND_FILES]; + int i, j; + +#if 0 + debug_print_timestamp(0, NULL); +#endif + + for (i=0; i game.engine_version == %06d\n", game.engine_version); +#endif + + /* dynamically adjust player properties according to game engine version */ + game.initial_move_delay = + (game.engine_version <= VERSION_IDENT(2,0,1) ? INITIAL_MOVE_DELAY_ON : + INITIAL_MOVE_DELAY_OFF); + + /* dynamically adjust player properties according to level information */ + game.initial_move_delay_value = + (level.double_speed ? MOVE_DELAY_HIGH_SPEED : MOVE_DELAY_NORMAL_SPEED); + + /* dynamically adjust element properties according to game engine version */ + { + static int ep_em_slippery_wall[] = + { + EL_STEELWALL, + EL_WALL, + EL_WALL_GROWING, + EL_WALL_GROWING_X, + EL_WALL_GROWING_Y, + EL_WALL_GROWING_XY + }; + static int ep_em_slippery_wall_num = SIZEOF_ARRAY_INT(ep_em_slippery_wall); + + for (i=0; i VERSION_IDENT(2,0,1)) + Elementeigenschaften2[EL_WALL_GROWING_ACTIVE] |= EP_BIT_EM_SLIPPERY_WALL; + else + Elementeigenschaften2[EL_WALL_GROWING_ACTIVE] &=~EP_BIT_EM_SLIPPERY_WALL; + } +} + + +/* + ============================================================================= + InitGame() + ----------------------------------------------------------------------------- + initialize and start new game + ============================================================================= +*/ + void InitGame() { - int i, j, x, y; boolean emulate_bd = TRUE; /* unless non-BOULDERDASH elements found */ boolean emulate_sb = TRUE; /* unless non-SOKOBAN elements found */ boolean emulate_sp = TRUE; /* unless non-SUPAPLEX elements found */ + int i, j, x, y; + InitGameEngine(); + +#if 0 #if DEBUG #if USE_NEW_AMOEBA_CODE printf("Using new amoeba code.\n"); #else printf("Using old amoeba code.\n"); #endif +#endif #endif /* don't play tapes over network */ @@ -456,7 +687,7 @@ void InitGame() struct PlayerInfo *player = &stored_player[i]; player->index_nr = i; - player->element_nr = EL_SPIELER1 + i; + player->element_nr = EL_PLAYER1 + i; player->present = FALSE; player->active = FALSE; @@ -491,15 +722,14 @@ void InitGame() player->frame_reset_delay = 0; - player->push_delay = 0; - player->push_delay_value = 5; - - player->move_delay = 0; player->last_move_dir = MV_NO_MOVING; player->is_moving = FALSE; - player->move_delay_value = - (level.double_speed ? MOVE_DELAY_HIGH_SPEED : MOVE_DELAY_NORMAL_SPEED); + player->move_delay = game.initial_move_delay; + player->move_delay_value = game.initial_move_delay_value; + + player->push_delay = 0; + player->push_delay_value = 5; player->snapped = FALSE; @@ -565,6 +795,7 @@ void InitGame() MovPos[x][y] = MovDir[x][y] = MovDelay[x][y] = 0; Store[x][y] = Store2[x][y] = StorePlayer[x][y] = 0; Frame[x][y] = 0; + GfxAction[x][y] = GFX_ACTION_DEFAULT; AmoebaNr[x][y] = 0; JustStopped[x][y] = 0; Stop[x][y] = FALSE; @@ -587,6 +818,10 @@ void InitGame() } } + game.emulation = (emulate_bd ? EMU_BOULDERDASH : + emulate_sb ? EMU_SOKOBAN : + emulate_sp ? EMU_SUPAPLEX : EMU_NONE); + /* correct non-moving belts to start moving left */ for (i=0; i<4; i++) if (game.belt_dir[i] == MV_NO_MOVING) @@ -634,7 +869,7 @@ void InitGame() player->active = FALSE; StorePlayer[jx][jy] = 0; - Feld[jx][jy] = EL_LEERRAUM; + Feld[jx][jy] = EL_EMPTY; } } } @@ -655,7 +890,7 @@ void InitGame() player->active = FALSE; StorePlayer[jx][jy] = 0; - Feld[jx][jy] = EL_LEERRAUM; + Feld[jx][jy] = EL_EMPTY; } } } @@ -686,34 +921,7 @@ void InitGame() } } - game.version = (tape.playing ? tape.game_version : level.game_version); - game.emulation = (emulate_bd ? EMU_BOULDERDASH : - emulate_sb ? EMU_SOKOBAN : - emulate_sp ? EMU_SUPAPLEX : EMU_NONE); - - /* dynamically adjust element properties according to game engine version */ - { - static int ep_slippery[] = - { - EL_BETON, - EL_MAUERWERK, - EL_MAUER_LEBT, - EL_MAUER_X, - EL_MAUER_Y, - EL_MAUER_XY - }; - static int ep_slippery_num = sizeof(ep_slippery)/sizeof(int); - - for (i=0; i= GAME_VERSION_2_0) - Elementeigenschaften2[ep_slippery[i]] |= EP_BIT_SLIPPERY_GEMS; - else - Elementeigenschaften2[ep_slippery[i]] &= ~EP_BIT_SLIPPERY_GEMS; - } - } - - if (BorderElement == EL_LEERRAUM) + if (BorderElement == EL_EMPTY) { SBX_Left = 0; SBX_Right = lev_fieldx - SCR_FIELDX; @@ -777,16 +985,10 @@ void InitGame() DX + XX_LEVEL - 1, DY + YY_LEVEL + 1); } - DrawText(DX + XX_EMERALDS, DY + YY_EMERALDS, - int2str(local_player->gems_still_needed, 3), FS_SMALL, FC_YELLOW); - DrawText(DX + XX_DYNAMITE, DY + YY_DYNAMITE, - int2str(local_player->dynamite, 3), FS_SMALL, FC_YELLOW); - DrawText(DX + XX_SCORE, DY + YY_SCORE, - int2str(local_player->score, 5), FS_SMALL, FC_YELLOW); - DrawText(DX + XX_TIME, DY + YY_TIME, - int2str(TimeLeft, 3), FS_SMALL, FC_YELLOW); + DrawGameDoorValues(); UnmapGameButtons(); + UnmapTapeButtons(); game_gadget[SOUND_CTRL_ID_MUSIC]->checked = setup.sound_music; game_gadget[SOUND_CTRL_ID_LOOPS]->checked = setup.sound_loops; game_gadget[SOUND_CTRL_ID_SIMPLE]->checked = setup.sound_simple; @@ -799,8 +1001,9 @@ void InitGame() OpenDoor(DOOR_OPEN_ALL); - if (setup.sound_music && num_bg_loops) - PlayMusic(level_nr % num_bg_loops); + PlaySoundStereo(SND_GAME_STARTING, SOUND_MAX_RIGHT); + if (setup.sound_music) + PlayMusic(level_nr); KeyboardAutoRepeatOff(); @@ -831,36 +1034,36 @@ void InitMovDir(int x, int y) switch(element) { - case EL_KAEFER_RIGHT: - case EL_KAEFER_UP: - case EL_KAEFER_LEFT: - case EL_KAEFER_DOWN: - Feld[x][y] = EL_KAEFER; - MovDir[x][y] = direction[0][element - EL_KAEFER_RIGHT]; + case EL_BUG_RIGHT: + case EL_BUG_UP: + case EL_BUG_LEFT: + case EL_BUG_DOWN: + Feld[x][y] = EL_BUG; + MovDir[x][y] = direction[0][element - EL_BUG_RIGHT]; break; - case EL_FLIEGER_RIGHT: - case EL_FLIEGER_UP: - case EL_FLIEGER_LEFT: - case EL_FLIEGER_DOWN: - Feld[x][y] = EL_FLIEGER; - MovDir[x][y] = direction[0][element - EL_FLIEGER_RIGHT]; + case EL_SPACESHIP_RIGHT: + case EL_SPACESHIP_UP: + case EL_SPACESHIP_LEFT: + case EL_SPACESHIP_DOWN: + Feld[x][y] = EL_SPACESHIP; + MovDir[x][y] = direction[0][element - EL_SPACESHIP_RIGHT]; break; - case EL_BUTTERFLY_RIGHT: - case EL_BUTTERFLY_UP: - case EL_BUTTERFLY_LEFT: - case EL_BUTTERFLY_DOWN: - Feld[x][y] = EL_BUTTERFLY; - MovDir[x][y] = direction[0][element - EL_BUTTERFLY_RIGHT]; + case EL_BD_BUTTERFLY_RIGHT: + case EL_BD_BUTTERFLY_UP: + case EL_BD_BUTTERFLY_LEFT: + case EL_BD_BUTTERFLY_DOWN: + Feld[x][y] = EL_BD_BUTTERFLY; + MovDir[x][y] = direction[0][element - EL_BD_BUTTERFLY_RIGHT]; break; - case EL_FIREFLY_RIGHT: - case EL_FIREFLY_UP: - case EL_FIREFLY_LEFT: - case EL_FIREFLY_DOWN: - Feld[x][y] = EL_FIREFLY; - MovDir[x][y] = direction[0][element - EL_FIREFLY_RIGHT]; + case EL_BD_FIREFLY_RIGHT: + case EL_BD_FIREFLY_UP: + case EL_BD_FIREFLY_LEFT: + case EL_BD_FIREFLY_DOWN: + Feld[x][y] = EL_BD_FIREFLY; + MovDir[x][y] = direction[0][element - EL_BD_FIREFLY_RIGHT]; break; case EL_PACMAN_RIGHT: @@ -889,10 +1092,10 @@ void InitMovDir(int x, int y) default: MovDir[x][y] = 1 << RND(4); - if (element != EL_KAEFER && - element != EL_FLIEGER && - element != EL_BUTTERFLY && - element != EL_FIREFLY) + if (element != EL_BUG && + element != EL_SPACESHIP && + element != EL_BD_BUTTERFLY && + element != EL_BD_FIREFLY) break; for (i=0; i<4; i++) @@ -902,12 +1105,12 @@ void InitMovDir(int x, int y) if (!IN_LEV_FIELD(x1, y1) || !IS_FREE(x1, y1)) { - if (element == EL_KAEFER || element == EL_BUTTERFLY) + if (element == EL_BUG || element == EL_BD_BUTTERFLY) { MovDir[x][y] = direction[0][i]; break; } - else if (element == EL_FLIEGER || element == EL_FIREFLY || + else if (element == EL_SPACESHIP || element == EL_BD_FIREFLY || element == EL_SP_SNIKSNAK || element == EL_SP_ELECTRON) { MovDir[x][y] = direction[1][i]; @@ -951,15 +1154,18 @@ void GameWon() local_player->LevelSolved = FALSE; + PlaySoundStereo(SND_GAME_WINNING, SOUND_MAX_RIGHT); + if (TimeLeft) { if (!tape.playing && setup.sound_loops) - PlaySoundExt(SND_SIRR, PSND_MAX_VOLUME, PSND_MAX_RIGHT, PSND_LOOP); + PlaySoundExt(SND_GAME_LEVELTIME_BONUS, SOUND_MAX_VOLUME, SOUND_MAX_RIGHT, + SND_CTRL_PLAY_LOOP); - while(TimeLeft > 0) + while (TimeLeft > 0) { if (!tape.playing && !setup.sound_loops) - PlaySoundStereo(SND_SIRR, PSND_MAX_RIGHT); + PlaySoundStereo(SND_GAME_LEVELTIME_BONUS, SOUND_MAX_RIGHT); if (TimeLeft > 0 && !(TimeLeft % 10)) RaiseScore(level.score[SC_ZEITBONUS]); if (TimeLeft > 100 && !(TimeLeft % 10)) @@ -974,17 +1180,18 @@ void GameWon() } if (!tape.playing && setup.sound_loops) - StopSound(SND_SIRR); + StopSound(SND_GAME_LEVELTIME_BONUS); } else if (level.time == 0) /* level without time limit */ { if (!tape.playing && setup.sound_loops) - PlaySoundExt(SND_SIRR, PSND_MAX_VOLUME, PSND_MAX_RIGHT, PSND_LOOP); + PlaySoundExt(SND_GAME_LEVELTIME_BONUS, SOUND_MAX_VOLUME, SOUND_MAX_RIGHT, + SND_CTRL_PLAY_LOOP); - while(TimePlayed < 999) + while (TimePlayed < 999) { if (!tape.playing && !setup.sound_loops) - PlaySoundStereo(SND_SIRR, PSND_MAX_RIGHT); + PlaySoundStereo(SND_GAME_LEVELTIME_BONUS, SOUND_MAX_RIGHT); if (TimePlayed < 999 && !(TimePlayed % 10)) RaiseScore(level.score[SC_ZEITBONUS]); if (TimePlayed < 900 && !(TimePlayed % 10)) @@ -999,7 +1206,7 @@ void GameWon() } if (!tape.playing && setup.sound_loops) - StopSound(SND_SIRR); + StopSound(SND_GAME_LEVELTIME_BONUS); } #if 0 @@ -1007,7 +1214,7 @@ void GameWon() #endif /* Hero disappears */ - DrawLevelField(ExitX, ExitY); + DrawNewLevelField(ExitX, ExitY); BackToFront(); if (tape.playing) @@ -1123,8 +1330,11 @@ void InitMovingField(int x, int y, int direction) MovDir[x][y] = direction; MovDir[newx][newy] = direction; - if (Feld[newx][newy] == EL_LEERRAUM) + + if (Feld[newx][newy] == EL_EMPTY) Feld[newx][newy] = EL_BLOCKED; + + GfxAction[x][y] = GFX_ACTION_MOVING; } void Moving2Blocked(int x, int y, int *goes_to_x, int *goes_to_y) @@ -1195,7 +1405,7 @@ static int MovingOrBlocked2ElementIfNotLeaving(int x, int y) static void RemoveField(int x, int y) { - Feld[x][y] = EL_LEERRAUM; + Feld[x][y] = EL_EMPTY; MovPos[x][y] = 0; MovDir[x][y] = 0; MovDelay[x][y] = 0; @@ -1224,51 +1434,77 @@ void RemoveMovingField(int x, int y) if (Feld[x][y] == EL_BLOCKED && (Feld[oldx][oldy] == EL_QUICKSAND_EMPTYING || Feld[oldx][oldy] == EL_MAGIC_WALL_EMPTYING || - Feld[oldx][oldy] == EL_MAGIC_WALL_BD_EMPTYING || + Feld[oldx][oldy] == EL_BD_MAGIC_WALL_EMPTYING || Feld[oldx][oldy] == EL_AMOEBA_DRIPPING)) Feld[oldx][oldy] = get_next_element(Feld[oldx][oldy]); else - Feld[oldx][oldy] = EL_LEERRAUM; + Feld[oldx][oldy] = EL_EMPTY; Store[oldx][oldy] = Store2[oldx][oldy] = 0; - Feld[newx][newy] = EL_LEERRAUM; + Feld[newx][newy] = EL_EMPTY; MovPos[oldx][oldy] = MovDir[oldx][oldy] = MovDelay[oldx][oldy] = 0; MovPos[newx][newy] = MovDir[newx][newy] = MovDelay[newx][newy] = 0; + GfxAction[oldx][oldy] = GfxAction[newx][newy] = GFX_ACTION_DEFAULT; - DrawLevelField(oldx, oldy); - DrawLevelField(newx, newy); + DrawNewLevelField(oldx, oldy); + DrawNewLevelField(newx, newy); } void DrawDynamite(int x, int y) { int sx = SCREENX(x), sy = SCREENY(y); +#if 0 int graphic = el2gfx(Feld[x][y]); - int phase; +#else + int graphic = el2img(Feld[x][y]); +#endif + int frame; if (!IN_SCR_FIELD(sx, sy) || IS_PLAYER(x, y)) return; if (Store[x][y]) +#if 0 DrawGraphic(sx, sy, el2gfx(Store[x][y])); +#else + DrawNewGraphic(sx, sy, el2img(Store[x][y]), 0); +#endif if (Feld[x][y] == EL_DYNAMITE_ACTIVE) { - if ((phase = (96 - MovDelay[x][y]) / 12) > 6) - phase = 6; + if ((frame = (96 - MovDelay[x][y]) / 12) > 6) + frame = 6; } else { - if ((phase = ((96 - MovDelay[x][y]) / 6) % 8) > 3) - phase = 7 - phase; + if ((frame = ((96 - MovDelay[x][y]) / 6) % 8) > 3) + frame = 7 - frame; } +#if 1 + frame = getNewGraphicAnimationFrame(graphic, 96 - MovDelay[x][y]); +#endif + + /* + printf("-> %d: %d [%d]\n", graphic, frame, MovDelay[x][y]); + */ + +#if 0 if (game.emulation == EMU_SUPAPLEX) DrawGraphic(sx, sy, GFX_SP_DISK_RED); else if (Store[x][y]) - DrawGraphicThruMask(sx, sy, graphic + phase); + DrawGraphicThruMask(sx, sy, graphic + frame); else - DrawGraphic(sx, sy, graphic + phase); + DrawGraphic(sx, sy, graphic + frame); +#else + if (game.emulation == EMU_SUPAPLEX) + DrawNewGraphic(sx, sy, IMG_SP_DISK_RED, 0); + else if (Store[x][y]) + DrawNewGraphicThruMask(sx, sy, graphic, frame); + else + DrawNewGraphic(sx, sy, graphic, frame); +#endif } void CheckDynamite(int x, int y) @@ -1278,8 +1514,8 @@ void CheckDynamite(int x, int y) MovDelay[x][y]--; if (MovDelay[x][y]) { - if (!(MovDelay[x][y] % 12)) - PlaySoundLevel(x, y, SND_ZISCH); + if (!(MovDelay[x][y] % 6)) + PlaySoundLevelAction(x, y, SND_ACTION_ACTIVE); if (IS_ACTIVE_BOMB(Feld[x][y])) { @@ -1293,14 +1529,19 @@ void CheckDynamite(int x, int y) } } - StopSound(SND_ZISCH); + if (Feld[x][y] == EL_DYNAMITE_ACTIVE) + StopSound(SND_DYNAMITE_ACTIVE); + else + StopSound(SND_DYNABOMB_ACTIVE); + Bang(x, y); } void Explode(int ex, int ey, int phase, int mode) { int x, y; - int num_phase = 9, delay = (game.emulation == EMU_SUPAPLEX ? 3 : 2); + int num_phase = 9; + int delay = (game.emulation == EMU_SUPAPLEX ? 3 : 2); int last_phase = num_phase * delay; int half_phase = (num_phase / 2) * delay; int first_phase_after_start = EX_PHASE_START + 1; @@ -1328,7 +1569,7 @@ void Explode(int ex, int ey, int phase, int mode) int element; if (!IN_LEV_FIELD(x, y) || - ((mode != EX_NORMAL || center_element == EL_AMOEBA2DIAM) && + ((mode != EX_NORMAL || center_element == EL_AMOEBA_TO_DIAMOND) && (x != ex || y != ey))) continue; @@ -1340,7 +1581,7 @@ void Explode(int ex, int ey, int phase, int mode) RemoveMovingField(x, y); } - if (IS_MASSIVE(element) || element == EL_BURNING) + if (IS_MASSIVE(element) || element == EL_FLAMES) continue; if (IS_PLAYER(x, y) && SHIELD_ON(PLAYERINFO(x, y))) @@ -1348,92 +1589,92 @@ void Explode(int ex, int ey, int phase, int mode) if (IS_ACTIVE_BOMB(element)) { /* re-activate things under the bomb like gate or penguin */ - Feld[x][y] = (Store[x][y] ? Store[x][y] : EL_LEERRAUM); + Feld[x][y] = (Store[x][y] ? Store[x][y] : EL_EMPTY); Store[x][y] = 0; } continue; } - if (element == EL_EXPLODING) + if (element == EL_EXPLOSION) element = Store2[x][y]; if (IS_PLAYER(ex, ey) && !PLAYER_PROTECTED(ex, ey)) { switch(StorePlayer[ex][ey]) { - case EL_SPIELER2: - Store[x][y] = EL_EDELSTEIN_ROT; + case EL_PLAYER2: + Store[x][y] = EL_EMERALD_RED; break; - case EL_SPIELER3: - Store[x][y] = EL_EDELSTEIN; + case EL_PLAYER3: + Store[x][y] = EL_EMERALD; break; - case EL_SPIELER4: - Store[x][y] = EL_EDELSTEIN_LILA; + case EL_PLAYER4: + Store[x][y] = EL_EMERALD_PURPLE; break; - case EL_SPIELER1: + case EL_PLAYER1: default: - Store[x][y] = EL_EDELSTEIN_GELB; + Store[x][y] = EL_EMERALD_YELLOW; break; } if (game.emulation == EMU_SUPAPLEX) - Store[x][y] = EL_LEERRAUM; + Store[x][y] = EL_EMPTY; } else if (center_element == EL_MOLE) - Store[x][y] = EL_EDELSTEIN_ROT; - else if (center_element == EL_PINGUIN) - Store[x][y] = EL_EDELSTEIN_LILA; - else if (center_element == EL_KAEFER) - Store[x][y] = ((x == ex && y == ey) ? EL_DIAMANT : EL_EDELSTEIN); - else if (center_element == EL_BUTTERFLY) - Store[x][y] = EL_EDELSTEIN_BD; + Store[x][y] = EL_EMERALD_RED; + else if (center_element == EL_PENGUIN) + Store[x][y] = EL_EMERALD_PURPLE; + else if (center_element == EL_BUG) + Store[x][y] = ((x == ex && y == ey) ? EL_DIAMOND : EL_EMERALD); + else if (center_element == EL_BD_BUTTERFLY) + Store[x][y] = EL_BD_DIAMOND; else if (center_element == EL_SP_ELECTRON) Store[x][y] = EL_SP_INFOTRON; - else if (center_element == EL_MAMPFER) + else if (center_element == EL_YAMYAM) Store[x][y] = level.yam_content[game.yam_content_nr][x-ex+1][y-ey+1]; - else if (center_element == EL_AMOEBA2DIAM) + else if (center_element == EL_AMOEBA_TO_DIAMOND) Store[x][y] = level.amoeba_content; - else if (element == EL_ERZ_EDEL) - Store[x][y] = EL_EDELSTEIN; - else if (element == EL_ERZ_DIAM) - Store[x][y] = EL_DIAMANT; - else if (element == EL_ERZ_EDEL_BD) - Store[x][y] = EL_EDELSTEIN_BD; - else if (element == EL_ERZ_EDEL_GELB) - Store[x][y] = EL_EDELSTEIN_GELB; - else if (element == EL_ERZ_EDEL_ROT) - Store[x][y] = EL_EDELSTEIN_ROT; - else if (element == EL_ERZ_EDEL_LILA) - Store[x][y] = EL_EDELSTEIN_LILA; + else if (element == EL_WALL_EMERALD) + Store[x][y] = EL_EMERALD; + else if (element == EL_WALL_DIAMOND) + Store[x][y] = EL_DIAMOND; + else if (element == EL_WALL_BD_DIAMOND) + Store[x][y] = EL_BD_DIAMOND; + else if (element == EL_WALL_EMERALD_YELLOW) + Store[x][y] = EL_EMERALD_YELLOW; + else if (element == EL_WALL_EMERALD_RED) + Store[x][y] = EL_EMERALD_RED; + else if (element == EL_WALL_EMERALD_PURPLE) + Store[x][y] = EL_EMERALD_PURPLE; else if (element == EL_WALL_PEARL) Store[x][y] = EL_PEARL; else if (element == EL_WALL_CRYSTAL) Store[x][y] = EL_CRYSTAL; else if (!IS_PFORTE(Store[x][y])) - Store[x][y] = EL_LEERRAUM; + Store[x][y] = EL_EMPTY; if (x != ex || y != ey || - center_element == EL_AMOEBA2DIAM || mode == EX_BORDER) + center_element == EL_AMOEBA_TO_DIAMOND || mode == EX_BORDER) Store2[x][y] = element; if (AmoebaNr[x][y] && - (element == EL_AMOEBE_VOLL || - element == EL_AMOEBE_BD || - element == EL_AMOEBING)) + (element == EL_AMOEBA_FULL || + element == EL_BD_AMOEBA || + element == EL_AMOEBA_CREATING)) { AmoebaCnt[AmoebaNr[x][y]]--; AmoebaCnt2[AmoebaNr[x][y]]--; } - Feld[x][y] = EL_EXPLODING; + Feld[x][y] = EL_EXPLOSION; MovDir[x][y] = MovPos[x][y] = 0; AmoebaNr[x][y] = 0; Frame[x][y] = 1; Stop[x][y] = TRUE; } - if (center_element == EL_MAMPFER) + if (center_element == EL_YAMYAM) game.yam_content_nr = (game.yam_content_nr + 1) % level.num_yam_contents; return; @@ -1470,7 +1711,7 @@ void Explode(int ex, int ey, int phase, int mode) Store2[x][y] = 0; Bang(x, y); } - else if (element == EL_AMOEBA2DIAM) + else if (element == EL_AMOEBA_TO_DIAMOND) AmoebeUmwandeln(x, y); } @@ -1484,13 +1725,14 @@ void Explode(int ex, int ey, int phase, int mode) InitField(x, y, FALSE); if (CAN_MOVE(element) || COULD_MOVE(element)) InitMovDir(x, y); - DrawLevelField(x, y); + DrawNewLevelField(x, y); if (IS_PLAYER(x, y) && !PLAYERINFO(x,y)->present) StorePlayer[x][y] = 0; } else if (!(phase % delay) && IN_SCR_FIELD(SCREENX(x), SCREENY(y))) { +#if 0 int graphic = GFX_EXPLOSION; if (game.emulation == EMU_SUPAPLEX) @@ -1498,18 +1740,35 @@ void Explode(int ex, int ey, int phase, int mode) GFX_SP_EXPLODE_INFOTRON : GFX_SP_EXPLODE_EMPTY); + graphic += (phase / delay - 1); +#else + int graphic = IMG_EXPLOSION; + int frame = (phase / delay - 1); + + if (game.emulation == EMU_SUPAPLEX) + graphic = (Store[x][y] == EL_SP_INFOTRON ? + IMG_SP_EXPLOSION_INFOTRON : + IMG_SP_EXPLOSION); +#endif + if (phase == delay) ErdreichAnbroeckeln(SCREENX(x), SCREENY(y)); - graphic += (phase / delay - 1); - if (IS_PFORTE(Store[x][y])) { - DrawLevelElement(x, y, Store[x][y]); + DrawNewLevelElement(x, y, Store[x][y]); +#if 0 DrawGraphicThruMask(SCREENX(x), SCREENY(y), graphic); +#else + DrawNewGraphicThruMask(SCREENX(x), SCREENY(y), graphic, frame); +#endif } else +#if 0 DrawGraphic(SCREENX(x), SCREENY(y), graphic); +#else + DrawNewGraphic(SCREENX(x), SCREENY(y), graphic, frame); +#endif } } @@ -1529,7 +1788,7 @@ void DynaExplode(int ex, int ey) if (IS_ACTIVE_BOMB(Feld[ex][ey])) { - player = &stored_player[Feld[ex][ey] - EL_DYNABOMB_ACTIVE_1]; + player = &stored_player[Feld[ex][ey] - EL_DYNABOMB_PLAYER1_ACTIVE]; dynabomb_size = player->dynabomb_size; dynabomb_xl = player->dynabomb_xl; player->dynabombs_left++; @@ -1551,14 +1810,14 @@ void DynaExplode(int ex, int ey) element = Feld[x][y]; /* do not restart explosions of fields with active bombs */ - if (element == EL_EXPLODING && IS_ACTIVE_BOMB(Store2[x][y])) + if (element == EL_EXPLOSION && IS_ACTIVE_BOMB(Store2[x][y])) continue; Explode(x, y, EX_PHASE_START, EX_BORDER); - if (element != EL_LEERRAUM && - element != EL_ERDREICH && - element != EL_EXPLODING && + if (element != EL_EMPTY && + element != EL_SAND && + element != EL_EXPLOSION && !dynabomb_xl) break; } @@ -1570,41 +1829,41 @@ void Bang(int x, int y) int element = Feld[x][y]; if (game.emulation == EMU_SUPAPLEX) - PlaySoundLevel(x, y, SND_SP_BOOOM); + PlaySoundLevel(x, y, SND_SP_ELEMENT_EXPLODING); else - PlaySoundLevel(x, y, SND_ROAAAR); + PlaySoundLevel(x, y, SND_ELEMENT_EXPLODING); #if 0 if (IS_PLAYER(x, y)) /* remove objects that might cause smaller explosion */ - element = EL_LEERRAUM; + element = EL_EMPTY; #endif switch(element) { - case EL_KAEFER: - case EL_FLIEGER: - case EL_BUTTERFLY: - case EL_FIREFLY: - case EL_MAMPFER: - case EL_MAMPFER2: + case EL_BUG: + case EL_SPACESHIP: + case EL_BD_BUTTERFLY: + case EL_BD_FIREFLY: + case EL_YAMYAM: + case EL_DARK_YAMYAM: case EL_ROBOT: case EL_PACMAN: case EL_MOLE: RaiseScoreElement(element); Explode(x, y, EX_PHASE_START, EX_NORMAL); break; - case EL_DYNABOMB_ACTIVE_1: - case EL_DYNABOMB_ACTIVE_2: - case EL_DYNABOMB_ACTIVE_3: - case EL_DYNABOMB_ACTIVE_4: + case EL_DYNABOMB_PLAYER1_ACTIVE: + case EL_DYNABOMB_PLAYER2_ACTIVE: + case EL_DYNABOMB_PLAYER3_ACTIVE: + case EL_DYNABOMB_PLAYER4_ACTIVE: case EL_DYNABOMB_NR: case EL_DYNABOMB_SZ: case EL_DYNABOMB_XL: DynaExplode(x, y); break; - case EL_PINGUIN: - case EL_BIRNE_AUS: - case EL_BIRNE_EIN: + case EL_PENGUIN: + case EL_LAMP: + case EL_LAMP_ACTIVE: if (IS_PLAYER(x, y)) Explode(x, y, EX_PHASE_START, EX_NORMAL); else @@ -1620,25 +1879,33 @@ void Blurb(int x, int y) { int element = Feld[x][y]; - if (element != EL_BLURB_LEFT && element != EL_BLURB_RIGHT) /* start */ + if (element != EL_ACID_SPLASHING_LEFT && + element != EL_ACID_SPLASHING_RIGHT) /* start */ { - PlaySoundLevel(x, y, SND_BLURB); + PlaySoundLevel(x, y, SND_ACID_SPLASHING); if (IN_LEV_FIELD(x-1, y) && IS_FREE(x-1, y) && (!IN_LEV_FIELD(x-1, y-1) || !CAN_FALL(MovingOrBlocked2Element(x-1, y-1)))) { - Feld[x-1][y] = EL_BLURB_LEFT; + Feld[x-1][y] = EL_ACID_SPLASHING_LEFT; } if (IN_LEV_FIELD(x+1, y) && IS_FREE(x+1, y) && (!IN_LEV_FIELD(x+1, y-1) || !CAN_FALL(MovingOrBlocked2Element(x+1, y-1)))) { - Feld[x+1][y] = EL_BLURB_RIGHT; + Feld[x+1][y] = EL_ACID_SPLASHING_RIGHT; } } else /* go on */ { - int graphic = (element==EL_BLURB_LEFT ? GFX_BLURB_LEFT : GFX_BLURB_RIGHT); +#if 0 + int graphic = + (element == EL_ACID_SPLASHING_LEFT ? GFX_BLURB_LEFT : GFX_BLURB_RIGHT); +#else + int graphic = (element == EL_ACID_SPLASHING_LEFT ? + IMG_ACID_SPLASHING_LEFT : + IMG_ACID_SPLASHING_RIGHT); +#endif if (!MovDelay[x][y]) /* initialize animation counter */ MovDelay[x][y] = 9; @@ -1647,12 +1914,20 @@ void Blurb(int x, int y) { MovDelay[x][y]--; if (MovDelay[x][y]/2 && IN_SCR_FIELD(SCREENX(x), SCREENY(y))) +#if 0 DrawGraphic(SCREENX(x), SCREENY(y), graphic+4-MovDelay[x][y]/2); +#else + { + int frame = getNewGraphicAnimationFrame(graphic, 8 - MovDelay[x][y]); + + DrawNewGraphic(SCREENX(x), SCREENY(y), graphic, frame); + } +#endif if (!MovDelay[x][y]) { - Feld[x][y] = EL_LEERRAUM; - DrawLevelField(x, y); + Feld[x][y] = EL_EMPTY; + DrawNewLevelField(x, y); } } } @@ -1662,10 +1937,24 @@ static void ToggleBeltSwitch(int x, int y) { static int belt_base_element[4] = { - EL_BELT1_SWITCH_LEFT, - EL_BELT2_SWITCH_LEFT, - EL_BELT3_SWITCH_LEFT, - EL_BELT4_SWITCH_LEFT + EL_CONVEYOR_BELT1_LEFT, + EL_CONVEYOR_BELT2_LEFT, + EL_CONVEYOR_BELT3_LEFT, + EL_CONVEYOR_BELT4_LEFT + }; + static int belt_base_active_element[4] = + { + EL_CONVEYOR_BELT1_LEFT_ACTIVE, + EL_CONVEYOR_BELT2_LEFT_ACTIVE, + EL_CONVEYOR_BELT3_LEFT_ACTIVE, + EL_CONVEYOR_BELT4_LEFT_ACTIVE + }; + static int belt_base_switch_element[4] = + { + EL_CONVEYOR_BELT1_SWITCH_LEFT, + EL_CONVEYOR_BELT2_SWITCH_LEFT, + EL_CONVEYOR_BELT3_SWITCH_LEFT, + EL_CONVEYOR_BELT4_SWITCH_LEFT }; static int belt_move_dir[4] = { @@ -1676,10 +1965,10 @@ static void ToggleBeltSwitch(int x, int y) }; int element = Feld[x][y]; - int belt_nr = getBeltNrFromSwitchElement(element); + int belt_nr = getBeltNrFromBeltSwitchElement(element); int belt_dir_nr = (game.belt_dir_nr[belt_nr] + 1) % 4; int belt_dir = belt_move_dir[belt_dir_nr]; - int xx, yy; + int xx, yy, i; if (!IS_BELT_SWITCH(element)) return; @@ -1690,6 +1979,18 @@ static void ToggleBeltSwitch(int x, int y) if (belt_dir_nr == 3) belt_dir_nr = 1; + /* set frame order for belt animation graphic according to belt direction */ + for (i=0; i<3; i++) + { + int element = belt_base_active_element[belt_nr] + i; + int graphic = el2img(element); + + if (belt_dir == MV_LEFT) + new_graphic_info[graphic].anim_mode &= ~ANIM_REVERSE; + else + new_graphic_info[graphic].anim_mode |= ANIM_REVERSE; + } + for (yy=0; yy 0) { - Feld[x][y] = EL_LIGHT_SWITCH_ON; - DrawLevelField(x, y); + Feld[x][y] = EL_LIGHT_SWITCH_ACTIVE; + DrawNewLevelField(x, y); } - else if (element == EL_LIGHT_SWITCH_ON && + else if (element == EL_LIGHT_SWITCH_ACTIVE && game.light_time_left == 0) { - Feld[x][y] = EL_LIGHT_SWITCH_OFF; - DrawLevelField(x, y); + Feld[x][y] = EL_LIGHT_SWITCH; + DrawNewLevelField(x, y); } + else if (element == EL_INVISIBLE_STEELWALL || + element == EL_INVISIBLE_WALL || + element == EL_INVISIBLE_SAND) + { + if (game.light_time_left > 0) + Feld[x][y] = getInvisibleActiveFromInvisibleElement(element); - if (element == EL_INVISIBLE_STEEL || - element == EL_UNSICHTBAR || - element == EL_SAND_INVISIBLE) - DrawLevelField(x, y); + DrawNewLevelField(x, y); + } + else if (element == EL_INVISIBLE_STEELWALL_ACTIVE || + element == EL_INVISIBLE_WALL_ACTIVE || + element == EL_INVISIBLE_SAND_ACTIVE) + { + if (game.light_time_left == 0) + Feld[x][y] = getInvisibleFromInvisibleActiveElement(element); + + DrawNewLevelField(x, y); + } } } } @@ -1787,7 +2132,7 @@ static void ToggleLightSwitch(int x, int y) int element = Feld[x][y]; game.light_time_left = - (element == EL_LIGHT_SWITCH_OFF ? + (element == EL_LIGHT_SWITCH ? level.time_light * FRAMES_PER_SECOND : 0); RedrawAllLightSwitchesAndInvisibleElements(); @@ -1809,13 +2154,13 @@ static void ActivateTimegateSwitch(int x, int y) element == EL_TIMEGATE_CLOSING) { Feld[xx][yy] = EL_TIMEGATE_OPENING; - PlaySoundLevel(xx, yy, SND_OEFFNEN); + PlaySoundLevel(xx, yy, SND_TIMEGATE_OPENING); } /* - else if (element == EL_TIMEGATE_SWITCH_ON) + else if (element == EL_TIMEGATE_SWITCH_ACTIVE) { - Feld[xx][yy] = EL_TIMEGATE_SWITCH_OFF; + Feld[xx][yy] = EL_TIMEGATE_SWITCH; DrawLevelField(xx, yy); } */ @@ -1823,7 +2168,7 @@ static void ActivateTimegateSwitch(int x, int y) } } - Feld[x][y] = EL_TIMEGATE_SWITCH_ON; + Feld[x][y] = EL_TIMEGATE_SWITCH_ACTIVE; } void Impact(int x, int y) @@ -1845,13 +2190,13 @@ void Impact(int x, int y) smashed = MovingOrBlocked2Element(x, y+1); } - if (!lastline && smashed == EL_SALZSAEURE) /* element falls into acid */ + if (!lastline && smashed == EL_ACID) /* element falls into acid */ { Blurb(x, y); return; } - if ((element == EL_BOMBE || + if ((element == EL_BOMB || element == EL_SP_DISK_ORANGE || element == EL_DX_SUPABOMB) && (lastline || object_hit)) /* element is bomb */ @@ -1862,20 +2207,20 @@ void Impact(int x, int y) else if (element == EL_PEARL) { Feld[x][y] = EL_PEARL_BREAKING; - PlaySoundLevel(x, y, SND_KNACK); + PlaySoundLevel(x, y, SND_PEARL_BREAKING); return; } - if (element == EL_TROPFEN && (lastline || object_hit)) /* acid drop */ + if (element == EL_AMOEBA_DROP && (lastline || object_hit)) { if (object_hit && IS_PLAYER(x, y+1)) KillHeroUnlessProtected(x, y+1); - else if (object_hit && smashed == EL_PINGUIN) + else if (object_hit && smashed == EL_PENGUIN) Bang(x, y+1); else { - Feld[x][y] = EL_AMOEBING; - Store[x][y] = EL_AMOEBE_NASS; + Feld[x][y] = EL_AMOEBA_CREATING; + Store[x][y] = EL_AMOEBA_WET; } return; } @@ -1883,22 +2228,25 @@ void Impact(int x, int y) if (!lastline && object_hit) /* check which object was hit */ { if (CAN_CHANGE(element) && - (smashed == EL_MAGIC_WALL_OFF || smashed == EL_MAGIC_WALL_BD_OFF)) + (smashed == EL_MAGIC_WALL || smashed == EL_BD_MAGIC_WALL)) { - int x, y; + int xx, yy; int activated_magic_wall = - (smashed == EL_MAGIC_WALL_OFF ? EL_MAGIC_WALL_EMPTY : - EL_MAGIC_WALL_BD_EMPTY); + (smashed == EL_MAGIC_WALL ? EL_MAGIC_WALL_ACTIVE : + EL_BD_MAGIC_WALL_ACTIVE); /* activate magic wall / mill */ - - for (y=0; y= 0) - PlaySoundLevel(x, y, sound); - } + PlaySoundLevelElementAction(x, y, element, SND_ACTION_IMPACT); } void TurnRound(int x, int y) @@ -2087,7 +2393,7 @@ void TurnRound(int x, int y) int right_x = x+right_dx, right_y = y+right_dy; int move_x = x+move_dx, move_y = y+move_dy; - if (element == EL_KAEFER || element == EL_BUTTERFLY) + if (element == EL_BUG || element == EL_BD_BUTTERFLY) { TestIfBadThingTouchesOtherBadThing(x, y); @@ -2098,12 +2404,12 @@ void TurnRound(int x, int y) !IS_FREE(move_x, move_y)) MovDir[x][y] = left_dir; - if (element == EL_KAEFER && MovDir[x][y] != old_move_dir) + if (element == EL_BUG && MovDir[x][y] != old_move_dir) MovDelay[x][y] = 9; - else if (element == EL_BUTTERFLY) /* && MovDir[x][y] == left_dir) */ + else if (element == EL_BD_BUTTERFLY) /* && MovDir[x][y] == left_dir) */ MovDelay[x][y] = 1; } - else if (element == EL_FLIEGER || element == EL_FIREFLY || + else if (element == EL_SPACESHIP || element == EL_BD_FIREFLY || element == EL_SP_SNIKSNAK || element == EL_SP_ELECTRON) { TestIfBadThingTouchesOtherBadThing(x, y); @@ -2115,24 +2421,24 @@ void TurnRound(int x, int y) !IS_FREE(move_x, move_y)) MovDir[x][y] = right_dir; - if ((element == EL_FLIEGER || + if ((element == EL_SPACESHIP || element == EL_SP_SNIKSNAK || element == EL_SP_ELECTRON) && MovDir[x][y] != old_move_dir) MovDelay[x][y] = 9; - else if (element == EL_FIREFLY) /* && MovDir[x][y] == right_dir) */ + else if (element == EL_BD_FIREFLY) /* && MovDir[x][y] == right_dir) */ MovDelay[x][y] = 1; } - else if (element == EL_MAMPFER) + else if (element == EL_YAMYAM) { boolean can_turn_left = FALSE, can_turn_right = FALSE; if (IN_LEV_FIELD(left_x, left_y) && (IS_FREE_OR_PLAYER(left_x, left_y) || - Feld[left_x][left_y] == EL_DIAMANT)) + Feld[left_x][left_y] == EL_DIAMOND)) can_turn_left = TRUE; if (IN_LEV_FIELD(right_x, right_y) && (IS_FREE_OR_PLAYER(right_x, right_y) || - Feld[right_x][right_y] == EL_DIAMANT)) + Feld[right_x][right_y] == EL_DIAMOND)) can_turn_right = TRUE; if (can_turn_left && can_turn_right) @@ -2146,7 +2452,7 @@ void TurnRound(int x, int y) MovDelay[x][y] = 16+16*RND(3); } - else if (element == EL_MAMPFER2) + else if (element == EL_DARK_YAMYAM) { boolean can_turn_left = FALSE, can_turn_right = FALSE; @@ -2194,7 +2500,7 @@ void TurnRound(int x, int y) MovDelay[x][y] = 6+RND(40); } - else if (element == EL_SCHWEIN) + else if (element == EL_PIG) { boolean can_turn_left = FALSE, can_turn_right = FALSE, can_move_on = FALSE; boolean should_turn_left = FALSE, should_turn_right = FALSE; @@ -2266,7 +2572,7 @@ void TurnRound(int x, int y) MovDelay[x][y] = 0; } - else if (element == EL_DRACHE) + else if (element == EL_DRAGON) { boolean can_turn_left = FALSE, can_turn_right = FALSE, can_move_on = FALSE; int rnd_value = 24; @@ -2301,7 +2607,7 @@ void TurnRound(int x, int y) if (IN_LEV_FIELD(move_x, move_y) && (IS_FREE(move_x, move_y) || IS_AMOEBOID(Feld[move_x][move_y]) || - Feld[move_x][move_y] == EL_DEAMOEBING)) + Feld[move_x][move_y] == EL_AMOEBA_SHRINKING)) can_move_on = TRUE; if (!can_move_on) @@ -2339,7 +2645,7 @@ void TurnRound(int x, int y) } MovDelay[x][y] = 0; } - else if (element == EL_ROBOT || element == EL_SONDE || element == EL_PINGUIN) + else if (element == EL_ROBOT || element == EL_SATELLITE || element == EL_PENGUIN) { int attr_x = -1, attr_y = -1; @@ -2374,7 +2680,7 @@ void TurnRound(int x, int y) attr_y = ZY; } - if (element == EL_PINGUIN) + if (element == EL_PENGUIN) { int i; static int xy[4][2] = @@ -2390,7 +2696,7 @@ void TurnRound(int x, int y) int ex = x + xy[i%4][0]; int ey = y + xy[i%4][1]; - if (IN_LEV_FIELD(ex, ey) && Feld[ex][ey] == EL_AUSGANG_AUF) + if (IN_LEV_FIELD(ex, ey) && Feld[ex][ey] == EL_EXIT_OPEN) { attr_x = ex; attr_y = ey; @@ -2439,9 +2745,9 @@ void TurnRound(int x, int y) if (IN_LEV_FIELD(newx, newy) && (IS_FREE(newx, newy) || - Feld[newx][newy] == EL_SALZSAEURE || - (element == EL_PINGUIN && - (Feld[newx][newy] == EL_AUSGANG_AUF || + Feld[newx][newy] == EL_ACID || + (element == EL_PENGUIN && + (Feld[newx][newy] == EL_EXIT_OPEN || IS_MAMPF3(Feld[newx][newy]))))) return; @@ -2451,9 +2757,9 @@ void TurnRound(int x, int y) if (IN_LEV_FIELD(newx, newy) && (IS_FREE(newx, newy) || - Feld[newx][newy] == EL_SALZSAEURE || - (element == EL_PINGUIN && - (Feld[newx][newy] == EL_AUSGANG_AUF || + Feld[newx][newy] == EL_ACID || + (element == EL_PENGUIN && + (Feld[newx][newy] == EL_EXIT_OPEN || IS_MAMPF3(Feld[newx][newy]))))) return; @@ -2492,21 +2798,24 @@ void StartMoving(int x, int y) if (Stop[x][y]) return; + GfxAction[x][y] = GFX_ACTION_DEFAULT; + if (CAN_FALL(element) && y0 && IS_PLAYER(x-1, y)) || (x EL_FELSBROCKEN): Store[x][y+1] == EL_MORAST_LEER + (EL_QUICKSAND_FULL -> EL_ROCK): Store[x][y+1] == EL_QUICKSAND_EMPTY */ #if 0 #if OLD_GAME_BEHAVIOUR @@ -2626,31 +2937,31 @@ void StartMoving(int x, int y) #endif #else else if ((IS_SLIPPERY(Feld[x][y+1]) || - (IS_SLIPPERY_GEMS(Feld[x][y+1]) && IS_GEM(element))) && + (IS_EM_SLIPPERY_WALL(Feld[x][y+1]) && IS_GEM(element))) && !IS_FALLING(x, y+1) && !JustStopped[x][y+1] && element != EL_DX_SUPABOMB && element != EL_SP_DISK_ORANGE) #endif { boolean left = (x>0 && IS_FREE(x-1, y) && - (IS_FREE(x-1, y+1) || Feld[x-1][y+1] == EL_SALZSAEURE)); + (IS_FREE(x-1, y+1) || Feld[x-1][y+1] == EL_ACID)); boolean right = (x0 && IS_FREE(x-1, y)); boolean right_is_free = (x3) - phase = 7-phase; + if (phase > 3) + phase = 7 - phase; if (IN_SCR_FIELD(SCREENX(x), SCREENY(y))) - DrawGraphic(SCREENX(x), SCREENY(y), el2gfx(element)+phase); +#if 0 + DrawGraphic(SCREENX(x), SCREENY(y), el2gfx(element) + phase); +#else + { + int graphic = el2img(element); + int frame = getNewGraphicAnimationFrame(graphic, MovDelay[x][y] % 8); - if ((element == EL_MAMPFER || element == EL_MAMPFER2) - && MovDelay[x][y]%4 == 3) - PlaySoundLevel(x, y, SND_NJAM); + DrawNewGraphic(SCREENX(x), SCREENY(y), graphic, frame); + } +#endif + + if (MovDelay[x][y] % 4 == 3) + { + if (element == EL_YAMYAM) + PlaySoundLevel(x, y, SND_YAMYAM_WAITING); + else if (element == EL_DARK_YAMYAM) + PlaySoundLevel(x, y, SND_DARK_YAMYAM_WAITING); + } } else if (element == EL_SP_ELECTRON) - DrawGraphicAnimation(x, y, GFX2_SP_ELECTRON, 8, 2, ANIM_NORMAL); - else if (element == EL_DRACHE) +#if 0 + DrawGraphicAnimation(x, y, GFX2_SP_ELECTRON, 8, 2, ANIM_LOOP); +#else + DrawNewGraphicAnimation(x, y, IMG_SP_ELECTRON); +#endif + else if (element == EL_DRAGON) { int i; int dir = MovDir[x][y]; int dx = (dir == MV_LEFT ? -1 : dir == MV_RIGHT ? +1 : 0); int dy = (dir == MV_UP ? -1 : dir == MV_DOWN ? +1 : 0); +#if 0 int graphic = (dir == MV_LEFT ? GFX_FLAMMEN_LEFT : dir == MV_RIGHT ? GFX_FLAMMEN_RIGHT : dir == MV_UP ? GFX_FLAMMEN_UP : dir == MV_DOWN ? GFX_FLAMMEN_DOWN : GFX_LEERRAUM); int phase = FrameCounter % 2; +#else + int graphic = (dir == MV_LEFT ? IMG_FLAMES_LEFT1 : + dir == MV_RIGHT ? IMG_FLAMES_RIGHT1 : + dir == MV_UP ? IMG_FLAMES_UP1 : + dir == MV_DOWN ? IMG_FLAMES_DOWN1 : IMG_EMPTY); + int frame = getNewGraphicAnimationFrame(graphic, -1); +#endif for (i=1; i<=3; i++) { int xx = x + i*dx, yy = y + i*dy; int sx = SCREENX(xx), sy = SCREENY(yy); + int flame_graphic = graphic + (i - 1); if (!IN_LEV_FIELD(xx, yy) || - IS_SOLID(Feld[xx][yy]) || Feld[xx][yy] == EL_EXPLODING) + IS_SOLID(Feld[xx][yy]) || Feld[xx][yy] == EL_EXPLOSION) break; if (MovDelay[x][y]) @@ -2735,30 +3073,29 @@ void StartMoving(int x, int y) else RemoveMovingField(xx, yy); - Feld[xx][yy] = EL_BURNING; + Feld[xx][yy] = EL_FLAMES; if (IN_SCR_FIELD(sx, sy)) +#if 0 DrawGraphic(sx, sy, graphic + phase*3 + i-1); +#else + DrawNewGraphic(sx, sy, flame_graphic, frame); +#endif } else { - if (Feld[xx][yy] == EL_BURNING) - Feld[xx][yy] = EL_LEERRAUM; - DrawLevelField(xx, yy); + if (Feld[xx][yy] == EL_FLAMES) + Feld[xx][yy] = EL_EMPTY; + DrawNewLevelField(xx, yy); } } } - if (MovDelay[x][y]) - return; - } + if (MovDelay[x][y]) /* element still has to wait some time */ + { + PlaySoundLevelAction(x, y, SND_ACTION_WAITING); - if (element == EL_KAEFER || element == EL_BUTTERFLY) - { - PlaySoundLevel(x, y, SND_KLAPPER); - } - else if (element == EL_FLIEGER || element == EL_FIREFLY) - { - PlaySoundLevel(x, y, SND_ROEHR); + return; + } } /* now make next step */ @@ -2780,24 +3117,29 @@ void StartMoving(int x, int y) #endif } - else if ((element == EL_PINGUIN || element == EL_ROBOT || - element == EL_SONDE || element == EL_BALLOON) && + else if ((element == EL_PENGUIN || element == EL_ROBOT || + element == EL_SATELLITE || element == EL_BALLOON) && IN_LEV_FIELD(newx, newy) && - MovDir[x][y] == MV_DOWN && Feld[newx][newy] == EL_SALZSAEURE) + MovDir[x][y] == MV_DOWN && Feld[newx][newy] == EL_ACID) { Blurb(x, y); - Store[x][y] = EL_SALZSAEURE; + Store[x][y] = EL_ACID; } - else if (element == EL_PINGUIN && IN_LEV_FIELD(newx, newy)) + else if (element == EL_PENGUIN && IN_LEV_FIELD(newx, newy)) { - if (Feld[newx][newy] == EL_AUSGANG_AUF) + if (Feld[newx][newy] == EL_EXIT_OPEN) { - Feld[x][y] = EL_LEERRAUM; - DrawLevelField(x, y); + Feld[x][y] = EL_EMPTY; + DrawNewLevelField(x, y); - PlaySoundLevel(newx, newy, SND_BUING); + PlaySoundLevel(newx, newy, SND_PENGUIN_PASSING_EXIT); if (IN_SCR_FIELD(SCREENX(newx), SCREENY(newy))) +#if 0 DrawGraphicThruMask(SCREENX(newx), SCREENY(newy), el2gfx(element)); +#else + DrawNewGraphicThruMask(SCREENX(newx), SCREENY(newy), el2img(element), + 0); +#endif local_player->friends_still_needed--; if (!local_player->friends_still_needed && @@ -2809,7 +3151,7 @@ void StartMoving(int x, int y) else if (IS_MAMPF3(Feld[newx][newy])) { if (DigField(local_player, newx, newy, 0, 0, DF_DIG) == MF_MOVING) - DrawLevelField(newx, newy); + DrawNewLevelField(newx, newy); else MovDir[x][y] = MV_NO_MOVING; } @@ -2818,11 +3160,11 @@ void StartMoving(int x, int y) if (IS_PLAYER(x, y)) DrawPlayerField(x, y); else - DrawLevelField(x, y); + DrawNewLevelField(x, y); return; } } - else if (element == EL_SCHWEIN && IN_LEV_FIELD(newx, newy)) + else if (element == EL_PIG && IN_LEV_FIELD(newx, newy)) { if (IS_GEM(Feld[newx][newy])) { @@ -2830,27 +3172,29 @@ void StartMoving(int x, int y) RemoveMovingField(newx, newy); else { - Feld[newx][newy] = EL_LEERRAUM; - DrawLevelField(newx, newy); + Feld[newx][newy] = EL_EMPTY; + DrawNewLevelField(newx, newy); } + + PlaySoundLevel(x, y, SND_PIG_EATING); } else if (!IS_FREE(newx, newy)) { if (IS_PLAYER(x, y)) DrawPlayerField(x, y); else - DrawLevelField(x, y); + DrawNewLevelField(x, y); return; } } - else if (element == EL_DRACHE && IN_LEV_FIELD(newx, newy)) + else if (element == EL_DRAGON && IN_LEV_FIELD(newx, newy)) { if (!IS_FREE(newx, newy)) { if (IS_PLAYER(x, y)) DrawPlayerField(x, y); else - DrawLevelField(x, y); + DrawNewLevelField(x, y); return; } else @@ -2860,48 +3204,52 @@ void StartMoving(int x, int y) int newx1 = newx+1*dx, newy1 = newy+1*dy; int newx2 = newx+2*dx, newy2 = newy+2*dy; int element1 = (IN_LEV_FIELD(newx1, newy1) ? - MovingOrBlocked2Element(newx1, newy1) : EL_BETON); + MovingOrBlocked2Element(newx1, newy1) : EL_STEELWALL); int element2 = (IN_LEV_FIELD(newx2, newy2) ? - MovingOrBlocked2Element(newx2, newy2) : EL_BETON); + MovingOrBlocked2Element(newx2, newy2) : EL_STEELWALL); if ((wanna_flame || IS_ENEMY(element1) || IS_ENEMY(element2)) && - element1 != EL_DRACHE && element2 != EL_DRACHE && - element1 != EL_BURNING && element2 != EL_BURNING) + element1 != EL_DRAGON && element2 != EL_DRAGON && + element1 != EL_FLAMES && element2 != EL_FLAMES) { if (IS_PLAYER(x, y)) DrawPlayerField(x, y); else - DrawLevelField(x, y); + DrawNewLevelField(x, y); + + PlaySoundLevel(x, y, SND_DRAGON_ATTACKING); MovDelay[x][y] = 50; - Feld[newx][newy] = EL_BURNING; - if (IN_LEV_FIELD(newx1, newy1) && Feld[newx1][newy1] == EL_LEERRAUM) - Feld[newx1][newy1] = EL_BURNING; - if (IN_LEV_FIELD(newx2, newy2) && Feld[newx2][newy2] == EL_LEERRAUM) - Feld[newx2][newy2] = EL_BURNING; + Feld[newx][newy] = EL_FLAMES; + if (IN_LEV_FIELD(newx1, newy1) && Feld[newx1][newy1] == EL_EMPTY) + Feld[newx1][newy1] = EL_FLAMES; + if (IN_LEV_FIELD(newx2, newy2) && Feld[newx2][newy2] == EL_EMPTY) + Feld[newx2][newy2] = EL_FLAMES; return; } } } - else if (element == EL_MAMPFER && IN_LEV_FIELD(newx, newy) && - Feld[newx][newy] == EL_DIAMANT) + else if (element == EL_YAMYAM && IN_LEV_FIELD(newx, newy) && + Feld[newx][newy] == EL_DIAMOND) { if (IS_MOVING(newx, newy)) RemoveMovingField(newx, newy); else { - Feld[newx][newy] = EL_LEERRAUM; - DrawLevelField(newx, newy); + Feld[newx][newy] = EL_EMPTY; + DrawNewLevelField(newx, newy); } + + PlaySoundLevel(x, y, SND_YAMYAM_EATING); } - else if (element == EL_MAMPFER2 && IN_LEV_FIELD(newx, newy) && + else if (element == EL_DARK_YAMYAM && IN_LEV_FIELD(newx, newy) && IS_MAMPF2(Feld[newx][newy])) { if (AmoebaNr[newx][newy]) { AmoebaCnt2[AmoebaNr[newx][newy]]--; - if (Feld[newx][newy] == EL_AMOEBE_VOLL || - Feld[newx][newy] == EL_AMOEBE_BD) + if (Feld[newx][newy] == EL_AMOEBA_FULL || + Feld[newx][newy] == EL_BD_AMOEBA) AmoebaCnt[AmoebaNr[newx][newy]]--; } @@ -2909,9 +3257,11 @@ void StartMoving(int x, int y) RemoveMovingField(newx, newy); else { - Feld[newx][newy] = EL_LEERRAUM; - DrawLevelField(newx, newy); + Feld[newx][newy] = EL_EMPTY; + DrawNewLevelField(newx, newy); } + + PlaySoundLevel(x, y, SND_DARK_YAMYAM_EATING); } else if ((element == EL_PACMAN || element == EL_MOLE) && IN_LEV_FIELD(newx, newy) && IS_AMOEBOID(Feld[newx][newy])) @@ -2919,26 +3269,28 @@ void StartMoving(int x, int y) if (AmoebaNr[newx][newy]) { AmoebaCnt2[AmoebaNr[newx][newy]]--; - if (Feld[newx][newy] == EL_AMOEBE_VOLL || - Feld[newx][newy] == EL_AMOEBE_BD) + if (Feld[newx][newy] == EL_AMOEBA_FULL || + Feld[newx][newy] == EL_BD_AMOEBA) AmoebaCnt[AmoebaNr[newx][newy]]--; } if (element == EL_MOLE) { - Feld[newx][newy] = EL_DEAMOEBING; + Feld[newx][newy] = EL_AMOEBA_SHRINKING; + PlaySoundLevel(x, y, SND_MOLE_EATING); MovDelay[newx][newy] = 0; /* start amoeba shrinking delay */ return; /* wait for shrinking amoeba */ } else /* element == EL_PACMAN */ { - Feld[newx][newy] = EL_LEERRAUM; - DrawLevelField(newx, newy); + Feld[newx][newy] = EL_EMPTY; + DrawNewLevelField(newx, newy); + PlaySoundLevel(x, y, SND_PACMAN_EATING); } } else if (element == EL_MOLE && IN_LEV_FIELD(newx, newy) && - (Feld[newx][newy] == EL_DEAMOEBING || - (Feld[newx][newy] == EL_LEERRAUM && Stop[newx][newy]))) + (Feld[newx][newy] == EL_AMOEBA_SHRINKING || + (Feld[newx][newy] == EL_EMPTY && Stop[newx][newy]))) { /* wait for shrinking amoeba to completely disappear */ return; @@ -2949,26 +3301,50 @@ void StartMoving(int x, int y) TurnRound(x, y); - if (element == EL_KAEFER || element == EL_FLIEGER || - element == EL_SP_SNIKSNAK || element == EL_MOLE) + if (element == EL_BUG || element == EL_SPACESHIP || + element == EL_SP_SNIKSNAK) +#if 0 + DrawLevelField(x, y); +#else + DrawNewLevelField(x, y); +#endif + else if (element == EL_BUG || element == EL_SPACESHIP || + element == EL_SP_SNIKSNAK || element == EL_MOLE) +#if 0 DrawLevelField(x, y); - else if (element == EL_BUTTERFLY || element == EL_FIREFLY) - DrawGraphicAnimation(x, y, el2gfx(element), 2, 4, ANIM_NORMAL); - else if (element == EL_SONDE) - DrawGraphicAnimation(x, y, GFX_SONDE_START, 8, 2, ANIM_NORMAL); +#else + DrawNewLevelField(x, y); +#endif + else if (element == EL_BD_BUTTERFLY || element == EL_BD_FIREFLY) +#if 0 + DrawGraphicAnimation(x, y, el2gfx(element), 2, 4, ANIM_LOOP); +#else + DrawNewGraphicAnimation(x, y, el2img(element)); +#endif + else if (element == EL_SATELLITE) +#if 0 + DrawGraphicAnimation(x, y, GFX_SONDE_START, 8, 2, ANIM_LOOP); +#else + DrawNewGraphicAnimation(x, y, IMG_SATELLITE); +#endif else if (element == EL_SP_ELECTRON) - DrawGraphicAnimation(x, y, GFX2_SP_ELECTRON, 8, 2, ANIM_NORMAL); +#if 0 + DrawGraphicAnimation(x, y, GFX2_SP_ELECTRON, 8, 2, ANIM_LOOP); +#else + DrawNewGraphicAnimation(x, y, IMG_SP_ELECTRON); +#endif if (DONT_TOUCH(element)) TestIfBadThingTouchesHero(x, y); + PlaySoundLevelAction(x, y, SND_ACTION_WAITING); + return; } - if (element == EL_ROBOT && IN_SCR_FIELD(x, y)) - PlaySoundLevel(x, y, SND_SCHLURF); - InitMovingField(x, y, MovDir[x][y]); + + PlaySoundLevelAction(x, y, SND_ACTION_MOVING); } if (MovDir[x][y]) @@ -2985,18 +3361,18 @@ void ContinueMoving(int x, int y) int newx = x + dx, newy = y + dy; int step = (horiz_move ? dx : dy) * TILEX / 8; - if (element == EL_TROPFEN || element == EL_AMOEBA_DRIPPING) + if (element == EL_AMOEBA_DROP || element == EL_AMOEBA_DRIPPING) step /= 2; else if (element == EL_QUICKSAND_FILLING || element == EL_QUICKSAND_EMPTYING) step /= 4; else if (element == EL_MAGIC_WALL_FILLING || - element == EL_MAGIC_WALL_BD_FILLING || + element == EL_BD_MAGIC_WALL_FILLING || element == EL_MAGIC_WALL_EMPTYING || - element == EL_MAGIC_WALL_BD_EMPTYING) + element == EL_BD_MAGIC_WALL_EMPTYING) step /= 2; else if (CAN_FALL(element) && horiz_move && - y < lev_fieldy-1 && IS_BELT(Feld[x][y+1])) + y < lev_fieldy-1 && IS_BELT_ACTIVE(Feld[x][y+1])) step /= 2; else if (element == EL_SPRING_MOVING) step*=2; @@ -3008,9 +3384,9 @@ void ContinueMoving(int x, int y) MovPos[x][y] += step; - if (ABS(MovPos[x][y])>=TILEX) /* object reached its destination */ + if (ABS(MovPos[x][y]) >= TILEX) /* object reached its destination */ { - Feld[x][y] = EL_LEERRAUM; + Feld[x][y] = EL_EMPTY; Feld[newx][newy] = element; if (element == EL_MOLE) @@ -3024,8 +3400,8 @@ void ContinueMoving(int x, int y) { 0, +1 } }; - Feld[x][y] = EL_ERDREICH; - DrawLevelField(x, y); + Feld[x][y] = EL_SAND; + DrawNewLevelField(x, y); for(i=0; i<4; i++) { @@ -3034,8 +3410,8 @@ void ContinueMoving(int x, int y) xx = x + xy[i][0]; yy = y + xy[i][1]; - if (IN_LEV_FIELD(xx, yy) && Feld[xx][yy] == EL_ERDREICH) - DrawLevelField(xx, yy); /* for "ErdreichAnbroeckeln()" */ + if (IN_LEV_FIELD(xx, yy) && Feld[xx][yy] == EL_SAND) + DrawNewLevelField(xx, yy); /* for "ErdreichAnbroeckeln()" */ } } @@ -3063,18 +3439,18 @@ void ContinueMoving(int x, int y) Feld[x][y] = EL_MAGIC_WALL_DEAD; element = Feld[newx][newy] = Store[x][y]; } - else if (element == EL_MAGIC_WALL_BD_FILLING) + else if (element == EL_BD_MAGIC_WALL_FILLING) { element = Feld[newx][newy] = get_next_element(element); if (!game.magic_wall_active) - element = Feld[newx][newy] = EL_MAGIC_WALL_BD_DEAD; + element = Feld[newx][newy] = EL_BD_MAGIC_WALL_DEAD; Store[newx][newy] = Store[x][y]; } - else if (element == EL_MAGIC_WALL_BD_EMPTYING) + else if (element == EL_BD_MAGIC_WALL_EMPTYING) { Feld[x][y] = get_next_element(element); if (!game.magic_wall_active) - Feld[x][y] = EL_MAGIC_WALL_BD_DEAD; + Feld[x][y] = EL_BD_MAGIC_WALL_DEAD; element = Feld[newx][newy] = Store[x][y]; } else if (element == EL_AMOEBA_DRIPPING) @@ -3082,20 +3458,23 @@ void ContinueMoving(int x, int y) Feld[x][y] = get_next_element(element); element = Feld[newx][newy] = Store[x][y]; } - else if (Store[x][y] == EL_SALZSAEURE) + else if (Store[x][y] == EL_ACID) { - element = Feld[newx][newy] = EL_SALZSAEURE; + element = Feld[newx][newy] = EL_ACID; } Store[x][y] = 0; MovPos[x][y] = MovDir[x][y] = MovDelay[x][y] = 0; MovDelay[newx][newy] = 0; + GfxAction[newx][newy] = GfxAction[x][y]; /* keep action one frame */ + GfxAction[x][y] = GFX_ACTION_DEFAULT; + if (!CAN_MOVE(element)) MovDir[newx][newy] = 0; - DrawLevelField(x, y); - DrawLevelField(newx, newy); + DrawNewLevelField(x, y); + DrawNewLevelField(newx, newy); Stop[newx][newy] = TRUE; JustStopped[newx][newy] = 3; @@ -3106,7 +3485,7 @@ void ContinueMoving(int x, int y) TestIfBadThingTouchesFriend(newx, newy); TestIfBadThingTouchesOtherBadThing(newx, newy); } - else if (element == EL_PINGUIN) + else if (element == EL_PENGUIN) TestIfFriendTouchesBadThing(newx, newy); if (CAN_SMASH(element) && direction == MV_DOWN && @@ -3114,7 +3493,12 @@ void ContinueMoving(int x, int y) Impact(x, newy); } else /* still moving on */ - DrawLevelField(x, y); + { + if (GfxAction[x][y] == GFX_ACTION_DEFAULT) + GfxAction[x][y] = GFX_ACTION_MOVING; + + DrawNewLevelField(x, y); + } } int AmoebeNachbarNr(int ax, int ay) @@ -3168,9 +3552,9 @@ void AmoebenVereinigen(int ax, int ay) if (!IN_LEV_FIELD(x, y)) continue; - if ((Feld[x][y] == EL_AMOEBE_VOLL || - Feld[x][y] == EL_AMOEBE_BD || - Feld[x][y] == EL_AMOEBE_TOT) && + if ((Feld[x][y] == EL_AMOEBA_FULL || + Feld[x][y] == EL_BD_AMOEBA || + Feld[x][y] == EL_AMOEBA_DEAD) && AmoebaNr[x][y] != new_group_nr) { int old_group_nr = AmoebaNr[x][y]; @@ -3199,7 +3583,7 @@ void AmoebeUmwandeln(int ax, int ay) { int i, x, y; - if (Feld[ax][ay] == EL_AMOEBE_TOT) + if (Feld[ax][ay] == EL_AMOEBA_DEAD) { int group_nr = AmoebaNr[ax][ay]; @@ -3216,13 +3600,16 @@ void AmoebeUmwandeln(int ax, int ay) { for (x=0; x= 200) + if (element == EL_BD_AMOEBA && AmoebaCnt2[new_group_nr] >= 200) { AmoebeUmwandelnBD(newax, neway, EL_BD_ROCK); return; @@ -3474,24 +3885,27 @@ void AmoebeAbleger(int ax, int ay) } } - if (element != EL_AMOEBE_NASS || neway < ay || !IS_FREE(newax, neway) || + if (element != EL_AMOEBA_WET || neway < ay || !IS_FREE(newax, neway) || (neway == lev_fieldy - 1 && newax != ax)) { - Feld[newax][neway] = EL_AMOEBING; /* simple growth of new amoeba tile */ + Feld[newax][neway] = EL_AMOEBA_CREATING; /* creation of new amoeba */ Store[newax][neway] = element; } else if (neway == ay) - Feld[newax][neway] = EL_TROPFEN; /* drop left or right from amoeba */ + { + Feld[newax][neway] = EL_AMOEBA_DROP; /* drop left/right of amoeba */ + PlaySoundLevel(newax, neway, SND_AMOEBA_DROP_CREATING); + } else { - InitMovingField(ax, ay, MV_DOWN); /* drop dripping out of amoeba */ + InitMovingField(ax, ay, MV_DOWN); /* drop dripping from amoeba */ Feld[ax][ay] = EL_AMOEBA_DRIPPING; - Store[ax][ay] = EL_TROPFEN; + Store[ax][ay] = EL_AMOEBA_DROP; ContinueMoving(ax, ay); return; } - DrawLevelField(newax, neway); + DrawNewLevelField(newax, neway); } void Life(int ax, int ay) @@ -3500,6 +3914,7 @@ void Life(int ax, int ay) static int life[4] = { 2, 3, 3, 3 }; /* parameters for "game of life" */ int life_time = 40; int element = Feld[ax][ay]; + boolean changed = FALSE; if (Stop[ax][ay]) return; @@ -3530,7 +3945,7 @@ void Life(int ax, int ay) continue; if (((Feld[x][y] == element || - (element == EL_LIFE && IS_PLAYER(x, y))) && + (element == EL_GAMEOFLIFE && IS_PLAYER(x, y))) && !Stop[x][y]) || (IS_FREE(x, y) && Stop[x][y])) nachbarn++; @@ -3538,29 +3953,35 @@ void Life(int ax, int ay) if (xx == ax && yy == ay) /* field in the middle */ { - if (nachbarnlife[1]) + if (nachbarn < life[0] || nachbarn > life[1]) { - Feld[xx][yy] = EL_LEERRAUM; + Feld[xx][yy] = EL_EMPTY; if (!Stop[xx][yy]) - DrawLevelField(xx, yy); + DrawNewLevelField(xx, yy); Stop[xx][yy] = TRUE; + changed = TRUE; } } - else if (IS_FREE(xx, yy) || Feld[xx][yy] == EL_ERDREICH) + else if (IS_FREE(xx, yy) || Feld[xx][yy] == EL_SAND) { /* free border field */ - if (nachbarn>=life[2] && nachbarn<=life[3]) + if (nachbarn >= life[2] && nachbarn <= life[3]) { Feld[xx][yy] = element; - MovDelay[xx][yy] = (element == EL_LIFE ? 0 : life_time-1); + MovDelay[xx][yy] = (element == EL_GAMEOFLIFE ? 0 : life_time-1); if (!Stop[xx][yy]) - DrawLevelField(xx, yy); + DrawNewLevelField(xx, yy); Stop[xx][yy] = TRUE; + changed = TRUE; } } } + + if (changed) + PlaySoundLevel(ax, ay, element == EL_GAMEOFLIFE ? SND_GAMEOFLIFE_CREATING : + SND_BIOMAZE_CREATING); } -void Ablenk(int x, int y) +void RobotWheel(int x, int y) { if (!MovDelay[x][y]) /* next animation frame */ MovDelay[x][y] = level.time_wheel * FRAMES_PER_SECOND; @@ -3571,15 +3992,23 @@ void Ablenk(int x, int y) if (MovDelay[x][y]) { if (IN_SCR_FIELD(SCREENX(x), SCREENY(y))) +#if 0 DrawGraphic(SCREENX(x), SCREENY(y), GFX_ABLENK+MovDelay[x][y]%4); +#else + { + int frame = getNewGraphicAnimationFrame(IMG_ROBOT_WHEEL_ACTIVE, -1); + + DrawNewGraphic(SCREENX(x), SCREENY(y), IMG_ROBOT_WHEEL_ACTIVE, frame); + } +#endif if (!(MovDelay[x][y]%4)) - PlaySoundLevel(x, y, SND_MIEP); + PlaySoundLevel(x, y, SND_ROBOT_WHEEL_ACTIVE); return; } } - Feld[x][y] = EL_ABLENK_AUS; - DrawLevelField(x, y); + Feld[x][y] = EL_ROBOT_WHEEL; + DrawNewLevelField(x, y); if (ZX == x && ZY == y) ZX = ZY = -1; } @@ -3595,55 +4024,38 @@ void TimegateWheel(int x, int y) if (MovDelay[x][y]) { if (IN_SCR_FIELD(SCREENX(x), SCREENY(y))) +#if 0 DrawGraphic(SCREENX(x), SCREENY(y), GFX_TIMEGATE_SWITCH + MovDelay[x][y]%4); +#else + { + int frame = getNewGraphicAnimationFrame(IMG_TIMEGATE_SWITCH_ACTIVE, -1); + + DrawNewGraphic(SCREENX(x), SCREENY(y), IMG_TIMEGATE_SWITCH_ACTIVE, frame); + } +#endif if (!(MovDelay[x][y]%4)) - PlaySoundLevel(x, y, SND_MIEP); + PlaySoundLevel(x, y, SND_TIMEGATE_SWITCH_ACTIVE); return; } } - Feld[x][y] = EL_TIMEGATE_SWITCH_OFF; - DrawLevelField(x, y); + Feld[x][y] = EL_TIMEGATE_SWITCH; + DrawNewLevelField(x, y); if (ZX == x && ZY == y) ZX = ZY = -1; } -void Birne(int x, int y) -{ - if (!MovDelay[x][y]) /* next animation frame */ - MovDelay[x][y] = 800; - - if (MovDelay[x][y]) /* wait some time before next frame */ - { - MovDelay[x][y]--; - if (MovDelay[x][y]) - { - if (!(MovDelay[x][y]%5)) - { - if (!(MovDelay[x][y]%10)) - Feld[x][y]=EL_ABLENK_EIN; - else - Feld[x][y]=EL_ABLENK_AUS; - DrawLevelField(x, y); - Feld[x][y]=EL_ABLENK_EIN; - } - return; - } - } - - Feld[x][y]=EL_ABLENK_AUS; - DrawLevelField(x, y); - if (ZX == x && ZY == y) - ZX=ZY=-1; -} - void Blubber(int x, int y) { - if (y > 0 && IS_MOVING(x, y-1) && MovDir[x][y-1] == MV_DOWN) - DrawLevelField(x, y-1); +#if 0 + if (y > 0 && IS_MOVING(x, y - 1) && MovDir[x][y - 1] == MV_DOWN) + DrawNewLevelField(x, y - 1); else - DrawGraphicAnimation(x, y, GFX_GEBLUBBER, 4, 10, ANIM_NORMAL); + DrawGraphicAnimation(x, y, GFX_GEBLUBBER, 4, 10, ANIM_LOOP); +#else + DrawNewGraphicAnimation(x, y, IMG_ACID); +#endif } void NussKnacken(int x, int y) @@ -3655,13 +4067,22 @@ void NussKnacken(int x, int y) { MovDelay[x][y]--; if (MovDelay[x][y]/2 && IN_SCR_FIELD(SCREENX(x), SCREENY(y))) +#if 0 DrawGraphic(SCREENX(x), SCREENY(y), GFX_CRACKINGNUT + 3 - MovDelay[x][y]/2); +#else + { + int frame = getNewGraphicAnimationFrame(IMG_NUT_CRACKING, + 6 - MovDelay[x][y]); + + DrawNewGraphic(SCREENX(x), SCREENY(y), IMG_NUT_CRACKING, frame); + } +#endif if (!MovDelay[x][y]) { - Feld[x][y] = EL_EDELSTEIN; - DrawLevelField(x, y); + Feld[x][y] = EL_EMERALD; + DrawNewLevelField(x, y); } } } @@ -3675,38 +4096,67 @@ void BreakingPearl(int x, int y) { MovDelay[x][y]--; if (MovDelay[x][y]/2 && IN_SCR_FIELD(SCREENX(x), SCREENY(y))) +#if 0 DrawGraphic(SCREENX(x), SCREENY(y), GFX_PEARL_BREAKING + 4 - MovDelay[x][y]/2); +#else + { + int frame = getNewGraphicAnimationFrame(IMG_PEARL_BREAKING, + 8 - MovDelay[x][y]); + + DrawNewGraphic(SCREENX(x), SCREENY(y), IMG_PEARL_BREAKING, frame); + } +#endif if (!MovDelay[x][y]) { - Feld[x][y] = EL_LEERRAUM; - DrawLevelField(x, y); + Feld[x][y] = EL_EMPTY; + DrawNewLevelField(x, y); } } } -void SiebAktivieren(int x, int y, int typ) +void SiebAktivieren(int x, int y, int type) { - int graphic = (typ == 1 ? GFX_MAGIC_WALL_FULL : GFX_MAGIC_WALL_BD_FULL) + 3; +#if 0 + int graphic = (type == 1 ? GFX_MAGIC_WALL_FULL : GFX_MAGIC_WALL_BD_FULL) + 3; DrawGraphicAnimation(x, y, graphic, 4, 4, ANIM_REVERSE); +#else + int graphic = (type == 1 ? IMG_MAGIC_WALL_FULL : IMG_BD_MAGIC_WALL_FULL); + + DrawNewGraphicAnimation(x, y, graphic); +#endif } void AusgangstuerPruefen(int x, int y) { - if (!local_player->gems_still_needed && - !local_player->sokobanfields_still_needed && - !local_player->lights_still_needed) - { - Feld[x][y] = EL_AUSGANG_ACT; + if (local_player->gems_still_needed > 0 || + local_player->sokobanfields_still_needed > 0 || + local_player->lights_still_needed > 0) + return; - PlaySoundLevel(x < LEVELX(BX1) ? LEVELX(BX1) : - (x > LEVELX(BX2) ? LEVELX(BX2) : x), - y < LEVELY(BY1) ? LEVELY(BY1) : - (y > LEVELY(BY2) ? LEVELY(BY2) : y), - SND_OEFFNEN); - } + Feld[x][y] = EL_EXIT_OPENING; + + PlaySoundLevel(x < LEVELX(BX1) ? LEVELX(BX1) : + (x > LEVELX(BX2) ? LEVELX(BX2) : x), + y < LEVELY(BY1) ? LEVELY(BY1) : + (y > LEVELY(BY2) ? LEVELY(BY2) : y), + SND_EXIT_OPENING); +} + +void AusgangstuerPruefen_SP(int x, int y) +{ + if (local_player->gems_still_needed > 0) + return; + + Feld[x][y] = EL_SP_EXIT_OPEN; + + PlaySoundLevel(x < LEVELX(BX1) ? LEVELX(BX1) : + (x > LEVELX(BX2) ? LEVELX(BX2) : x), + y < LEVELY(BY1) ? LEVELY(BY1) : + (y > LEVELY(BY2) ? LEVELY(BY2) : y), + SND_SP_EXIT_OPENING); } void AusgangstuerOeffnen(int x, int y) @@ -3714,7 +4164,7 @@ void AusgangstuerOeffnen(int x, int y) int delay = 6; if (!MovDelay[x][y]) /* next animation frame */ - MovDelay[x][y] = 5*delay; + MovDelay[x][y] = 5 * delay; if (MovDelay[x][y]) /* wait some time before next frame */ { @@ -3723,19 +4173,32 @@ void AusgangstuerOeffnen(int x, int y) MovDelay[x][y]--; tuer = MovDelay[x][y]/delay; if (!(MovDelay[x][y]%delay) && IN_SCR_FIELD(SCREENX(x), SCREENY(y))) +#if 0 DrawGraphic(SCREENX(x), SCREENY(y), GFX_AUSGANG_AUF-tuer); +#else + { + int frame = getNewGraphicAnimationFrame(IMG_EXIT_OPENING, + 29 - MovDelay[x][y]); + + DrawNewGraphic(SCREENX(x), SCREENY(y), IMG_EXIT_OPENING, frame); + } +#endif if (!MovDelay[x][y]) { - Feld[x][y] = EL_AUSGANG_AUF; - DrawLevelField(x, y); + Feld[x][y] = EL_EXIT_OPEN; + DrawNewLevelField(x, y); } } } void AusgangstuerBlinken(int x, int y) { - DrawGraphicAnimation(x, y, GFX_AUSGANG_AUF, 4, 4, ANIM_OSCILLATE); +#if 0 + DrawGraphicAnimation(x, y, GFX_AUSGANG_AUF, 4, 4, ANIM_PINGPONG); +#else + DrawNewGraphicAnimation(x, y, IMG_EXIT_OPEN); +#endif } void OpenSwitchgate(int x, int y) @@ -3752,12 +4215,21 @@ void OpenSwitchgate(int x, int y) MovDelay[x][y]--; phase = MovDelay[x][y] / delay; if (!(MovDelay[x][y] % delay) && IN_SCR_FIELD(SCREENX(x), SCREENY(y))) +#if 0 DrawGraphic(SCREENX(x), SCREENY(y), GFX_SWITCHGATE_OPEN - phase); +#else + { + int frame = getNewGraphicAnimationFrame(IMG_SWITCHGATE_OPENING, + 29 - MovDelay[x][y]); + + DrawNewGraphic(SCREENX(x), SCREENY(y), IMG_SWITCHGATE_OPENING, frame); + } +#endif if (!MovDelay[x][y]) { Feld[x][y] = EL_SWITCHGATE_OPEN; - DrawLevelField(x, y); + DrawNewLevelField(x, y); } } } @@ -3776,12 +4248,21 @@ void CloseSwitchgate(int x, int y) MovDelay[x][y]--; phase = MovDelay[x][y] / delay; if (!(MovDelay[x][y] % delay) && IN_SCR_FIELD(SCREENX(x), SCREENY(y))) +#if 0 DrawGraphic(SCREENX(x), SCREENY(y), GFX_SWITCHGATE_CLOSED + phase); +#else + { + int frame = getNewGraphicAnimationFrame(IMG_SWITCHGATE_CLOSING, + 29 - MovDelay[x][y]); + + DrawNewGraphic(SCREENX(x), SCREENY(y), IMG_SWITCHGATE_CLOSING, frame); + } +#endif if (!MovDelay[x][y]) { Feld[x][y] = EL_SWITCHGATE_CLOSED; - DrawLevelField(x, y); + DrawNewLevelField(x, y); } } } @@ -3800,12 +4281,21 @@ void OpenTimegate(int x, int y) MovDelay[x][y]--; phase = MovDelay[x][y] / delay; if (!(MovDelay[x][y] % delay) && IN_SCR_FIELD(SCREENX(x), SCREENY(y))) +#if 0 DrawGraphic(SCREENX(x), SCREENY(y), GFX_TIMEGATE_OPEN - phase); +#else + { + int frame = getNewGraphicAnimationFrame(IMG_TIMEGATE_OPENING, + 29 - MovDelay[x][y]); + + DrawNewGraphic(SCREENX(x), SCREENY(y), IMG_TIMEGATE_OPENING, frame); + } +#endif if (!MovDelay[x][y]) { Feld[x][y] = EL_TIMEGATE_OPEN; - DrawLevelField(x, y); + DrawNewLevelField(x, y); } } } @@ -3824,12 +4314,21 @@ void CloseTimegate(int x, int y) MovDelay[x][y]--; phase = MovDelay[x][y] / delay; if (!(MovDelay[x][y] % delay) && IN_SCR_FIELD(SCREENX(x), SCREENY(y))) +#if 0 DrawGraphic(SCREENX(x), SCREENY(y), GFX_TIMEGATE_CLOSED + phase); +#else + { + int frame = getNewGraphicAnimationFrame(IMG_TIMEGATE_CLOSING, + 29 - MovDelay[x][y]); + + DrawNewGraphic(SCREENX(x), SCREENY(y), IMG_TIMEGATE_CLOSING, frame); + } +#endif if (!MovDelay[x][y]) { Feld[x][y] = EL_TIMEGATE_CLOSED; - DrawLevelField(x, y); + DrawNewLevelField(x, y); } } } @@ -3847,7 +4346,7 @@ static void CloseAllOpenTimegates() if (element == EL_TIMEGATE_OPEN || element == EL_TIMEGATE_OPENING) { Feld[x][y] = EL_TIMEGATE_CLOSING; - PlaySoundLevel(x, y, SND_OEFFNEN); + PlaySoundLevel(x, y, SND_TIMEGATE_CLOSING); } } } @@ -3858,8 +4357,12 @@ void EdelsteinFunkeln(int x, int y) if (!IN_SCR_FIELD(SCREENX(x), SCREENY(y)) || IS_MOVING(x, y)) return; - if (Feld[x][y] == EL_EDELSTEIN_BD) + if (Feld[x][y] == EL_BD_DIAMOND) +#if 0 DrawGraphicAnimation(x, y, GFX_EDELSTEIN_BD, 4, 4, ANIM_REVERSE); +#else + DrawNewGraphicAnimation(x, y, IMG_BD_DIAMOND); +#endif else { if (!MovDelay[x][y]) /* next animation frame */ @@ -3872,7 +4375,11 @@ void EdelsteinFunkeln(int x, int y) if (setup.direct_draw && MovDelay[x][y]) SetDrawtoField(DRAW_BUFFERED); +#if 0 DrawGraphic(SCREENX(x), SCREENY(y), el2gfx(Feld[x][y])); +#else + DrawNewGraphic(SCREENX(x), SCREENY(y), el2img(Feld[x][y]), 0); +#endif if (MovDelay[x][y]) { @@ -3881,14 +4388,24 @@ void EdelsteinFunkeln(int x, int y) if (phase > 2) phase = 4-phase; +#if 0 DrawGraphicThruMask(SCREENX(x), SCREENY(y), GFX_FUNKELN_WEISS + phase); +#else + { + int frame = getNewGraphicAnimationFrame(IMG_TWINKLE_WHITE, + 10 - MovDelay[x][y]); + + DrawNewGraphicThruMask(SCREENX(x), SCREENY(y), IMG_TWINKLE_WHITE, + frame); + } +#endif if (setup.direct_draw) { int dest_x, dest_y; - dest_x = FX + SCREENX(x)*TILEX; - dest_y = FY + SCREENY(y)*TILEY; + dest_x = FX + SCREENX(x) * TILEX; + dest_y = FY + SCREENY(y) * TILEY; BlitBitmap(drawto_field, window, dest_x, dest_y, TILEX, TILEY, dest_x, dest_y); @@ -3904,48 +4421,58 @@ void MauerWaechst(int x, int y) int delay = 6; if (!MovDelay[x][y]) /* next animation frame */ - MovDelay[x][y] = 3*delay; + MovDelay[x][y] = 3 * delay; if (MovDelay[x][y]) /* wait some time before next frame */ { int phase; MovDelay[x][y]--; - phase = 2-MovDelay[x][y]/delay; + phase = 2 - MovDelay[x][y] / delay; +#if 0 if (!(MovDelay[x][y]%delay) && IN_SCR_FIELD(SCREENX(x), SCREENY(y))) DrawGraphic(SCREENX(x), SCREENY(y), (MovDir[x][y] == MV_LEFT ? GFX_MAUER_LEFT : MovDir[x][y] == MV_RIGHT ? GFX_MAUER_RIGHT : MovDir[x][y] == MV_UP ? GFX_MAUER_UP : GFX_MAUER_DOWN ) + phase); +#else + if (IN_SCR_FIELD(SCREENX(x), SCREENY(y))) + { + int graphic = el_dir2img(Feld[x][y], MovDir[x][y]); + int frame = getNewGraphicAnimationFrame(graphic, 17 - MovDelay[x][y]); + + DrawNewGraphic(SCREENX(x), SCREENY(y), graphic, frame); + } +#endif if (!MovDelay[x][y]) { if (MovDir[x][y] == MV_LEFT) { - if (IN_LEV_FIELD(x-1, y) && IS_MAUER(Feld[x-1][y])) - DrawLevelField(x-1, y); + if (IN_LEV_FIELD(x - 1, y) && IS_MAUER(Feld[x - 1][y])) + DrawNewLevelField(x - 1, y); } else if (MovDir[x][y] == MV_RIGHT) { - if (IN_LEV_FIELD(x+1, y) && IS_MAUER(Feld[x+1][y])) - DrawLevelField(x+1, y); + if (IN_LEV_FIELD(x + 1, y) && IS_MAUER(Feld[x + 1][y])) + DrawNewLevelField(x + 1, y); } else if (MovDir[x][y] == MV_UP) { - if (IN_LEV_FIELD(x, y-1) && IS_MAUER(Feld[x][y-1])) - DrawLevelField(x, y-1); + if (IN_LEV_FIELD(x, y - 1) && IS_MAUER(Feld[x][y - 1])) + DrawNewLevelField(x, y - 1); } else { - if (IN_LEV_FIELD(x, y+1) && IS_MAUER(Feld[x][y+1])) - DrawLevelField(x, y+1); + if (IN_LEV_FIELD(x, y + 1) && IS_MAUER(Feld[x][y + 1])) + DrawNewLevelField(x, y + 1); } Feld[x][y] = Store[x][y]; Store[x][y] = 0; MovDir[x][y] = MV_NO_MOVING; - DrawLevelField(x, y); + DrawNewLevelField(x, y); } } } @@ -3957,6 +4484,7 @@ void MauerAbleger(int ax, int ay) boolean links_frei = FALSE, rechts_frei = FALSE; boolean oben_massiv = FALSE, unten_massiv = FALSE; boolean links_massiv = FALSE, rechts_massiv = FALSE; + boolean new_wall = FALSE; if (!MovDelay[ax][ay]) /* start building new wall */ MovDelay[ax][ay] = 6; @@ -3977,49 +4505,74 @@ void MauerAbleger(int ax, int ay) if (IN_LEV_FIELD(ax+1, ay) && IS_FREE(ax+1, ay)) rechts_frei = TRUE; - if (element == EL_MAUER_Y || element == EL_MAUER_XY) + if (element == EL_WALL_GROWING_Y || element == EL_WALL_GROWING_XY) { if (oben_frei) { - Feld[ax][ay-1] = EL_MAUERND; + Feld[ax][ay-1] = EL_WALL_GROWING_ACTIVE; Store[ax][ay-1] = element; MovDir[ax][ay-1] = MV_UP; if (IN_SCR_FIELD(SCREENX(ax), SCREENY(ay-1))) +#if 0 DrawGraphic(SCREENX(ax), SCREENY(ay-1), GFX_MAUER_UP); +#else + DrawNewGraphic(SCREENX(ax), SCREENY(ay - 1), + IMG_WALL_GROWING_ACTIVE_UP, 0); +#endif + new_wall = TRUE; } if (unten_frei) { - Feld[ax][ay+1] = EL_MAUERND; + Feld[ax][ay+1] = EL_WALL_GROWING_ACTIVE; Store[ax][ay+1] = element; MovDir[ax][ay+1] = MV_DOWN; if (IN_SCR_FIELD(SCREENX(ax), SCREENY(ay+1))) +#if 0 DrawGraphic(SCREENX(ax), SCREENY(ay+1), GFX_MAUER_DOWN); +#else + DrawNewGraphic(SCREENX(ax), SCREENY(ay + 1), + IMG_WALL_GROWING_ACTIVE_DOWN, 0); +#endif + new_wall = TRUE; } } - if (element == EL_MAUER_X || element == EL_MAUER_XY || - element == EL_MAUER_LEBT) + if (element == EL_WALL_GROWING_X || element == EL_WALL_GROWING_XY || + element == EL_WALL_GROWING) { if (links_frei) { - Feld[ax-1][ay] = EL_MAUERND; + Feld[ax-1][ay] = EL_WALL_GROWING_ACTIVE; Store[ax-1][ay] = element; MovDir[ax-1][ay] = MV_LEFT; if (IN_SCR_FIELD(SCREENX(ax-1), SCREENY(ay))) +#if 0 DrawGraphic(SCREENX(ax-1), SCREENY(ay), GFX_MAUER_LEFT); +#else + DrawNewGraphic(SCREENX(ax - 1), SCREENY(ay), + IMG_WALL_GROWING_ACTIVE_LEFT, 0); +#endif + new_wall = TRUE; } + if (rechts_frei) { - Feld[ax+1][ay] = EL_MAUERND; + Feld[ax+1][ay] = EL_WALL_GROWING_ACTIVE; Store[ax+1][ay] = element; MovDir[ax+1][ay] = MV_RIGHT; if (IN_SCR_FIELD(SCREENX(ax+1), SCREENY(ay))) +#if 0 DrawGraphic(SCREENX(ax+1), SCREENY(ay), GFX_MAUER_RIGHT); +#else + DrawNewGraphic(SCREENX(ax + 1), SCREENY(ay), + IMG_WALL_GROWING_ACTIVE_RIGHT, 0); +#endif + new_wall = TRUE; } } - if (element == EL_MAUER_LEBT && (links_frei || rechts_frei)) - DrawLevelField(ax, ay); + if (element == EL_WALL_GROWING && (links_frei || rechts_frei)) + DrawNewLevelField(ax, ay); if (!IN_LEV_FIELD(ax, ay-1) || IS_MAUER(Feld[ax][ay-1])) oben_massiv = TRUE; @@ -4031,10 +4584,13 @@ void MauerAbleger(int ax, int ay) rechts_massiv = TRUE; if (((oben_massiv && unten_massiv) || - element == EL_MAUER_X || element == EL_MAUER_LEBT) && + element == EL_WALL_GROWING_X || element == EL_WALL_GROWING) && ((links_massiv && rechts_massiv) || - element == EL_MAUER_Y)) - Feld[ax][ay] = EL_MAUERWERK; + element == EL_WALL_GROWING_Y)) + Feld[ax][ay] = EL_WALL; + + if (new_wall) + PlaySoundLevel(ax, ay, SND_WALL_GROWING); } void CheckForDragon(int x, int y) @@ -4056,9 +4612,9 @@ void CheckForDragon(int x, int y) int xx = x + j*xy[i][0], yy = y + j*xy[i][1]; if (IN_LEV_FIELD(xx, yy) && - (Feld[xx][yy] == EL_BURNING || Feld[xx][yy] == EL_DRACHE)) + (Feld[xx][yy] == EL_FLAMES || Feld[xx][yy] == EL_DRAGON)) { - if (Feld[xx][yy] == EL_DRACHE) + if (Feld[xx][yy] == EL_DRAGON) dragon_found = TRUE; } else @@ -4074,10 +4630,10 @@ void CheckForDragon(int x, int y) { int xx = x + j*xy[i][0], yy = y + j*xy[i][1]; - if (IN_LEV_FIELD(xx, yy) && Feld[xx][yy] == EL_BURNING) + if (IN_LEV_FIELD(xx, yy) && Feld[xx][yy] == EL_FLAMES) { - Feld[xx][yy] = EL_LEERRAUM; - DrawLevelField(xx, yy); + Feld[xx][yy] = EL_EMPTY; + DrawNewLevelField(xx, yy); } else break; @@ -4090,7 +4646,7 @@ static void CheckBuggyBase(int x, int y) { int element = Feld[x][y]; - if (element == EL_SP_BUG) + if (element == EL_SP_BUGGY_BASE) { if (!MovDelay[x][y]) /* wait some time before activating base */ MovDelay[x][y] = 2 * FRAMES_PER_SECOND + RND(5 * FRAMES_PER_SECOND); @@ -4099,14 +4655,18 @@ static void CheckBuggyBase(int x, int y) { MovDelay[x][y]--; if (MovDelay[x][y] < 5 && IN_SCR_FIELD(SCREENX(x), SCREENY(y))) +#if 0 DrawGraphic(SCREENX(x), SCREENY(y), GFX_SP_BUG_WARNING); +#else + DrawNewGraphic(SCREENX(x), SCREENY(y), IMG_SP_BUGGY_BASE, 0); +#endif if (MovDelay[x][y]) return; - Feld[x][y] = EL_SP_BUG_ACTIVE; + Feld[x][y] = EL_SP_BUGGY_BASE_ACTIVE; } } - else if (element == EL_SP_BUG_ACTIVE) + else if (element == EL_SP_BUGGY_BASE_ACTIVE) { if (!MovDelay[x][y]) /* start activating buggy base */ MovDelay[x][y] = 1 * FRAMES_PER_SECOND + RND(1 * FRAMES_PER_SECOND); @@ -4126,7 +4686,16 @@ static void CheckBuggyBase(int x, int y) }; if (IN_SCR_FIELD(SCREENX(x), SCREENY(y))) +#if 0 DrawGraphic(SCREENX(x),SCREENY(y), GFX_SP_BUG_ACTIVE + SimpleRND(4)); +#else + { + int graphic = IMG_SP_BUGGY_BASE_ACTIVE; + int frame = getNewGraphicAnimationFrame(graphic, SimpleRND(100)); + + DrawNewGraphic(SCREENX(x), SCREENY(y), graphic, frame); + } +#endif for (i=0; i<4; i++) { @@ -4134,7 +4703,7 @@ static void CheckBuggyBase(int x, int y) if (IS_PLAYER(xx, yy)) { - PlaySoundLevel(x, y, SND_SP_BUG); + PlaySoundLevel(x, y, SND_SP_BUGGY_BASE_ACTIVE); break; } } @@ -4142,8 +4711,8 @@ static void CheckBuggyBase(int x, int y) return; } - Feld[x][y] = EL_SP_BUG; - DrawLevelField(x, y); + Feld[x][y] = EL_SP_BUGGY_BASE; + DrawNewLevelField(x, y); } } } @@ -4152,7 +4721,7 @@ static void CheckTrap(int x, int y) { int element = Feld[x][y]; - if (element == EL_TRAP_INACTIVE) + if (element == EL_TRAP) { if (!MovDelay[x][y]) /* wait some time before activating trap */ MovDelay[x][y] = 2 * FRAMES_PER_SECOND + RND(5 * FRAMES_PER_SECOND); @@ -4164,6 +4733,7 @@ static void CheckTrap(int x, int y) return; Feld[x][y] = EL_TRAP_ACTIVE; + PlaySoundLevel(x, y, SND_TRAP_ACTIVATING); } } else if (element == EL_TRAP_ACTIVE) @@ -4189,7 +4759,15 @@ static void CheckTrap(int x, int y) if (IN_SCR_FIELD(SCREENX(x), SCREENY(y))) { +#if 0 DrawGraphic(SCREENX(x),SCREENY(y), GFX_TRAP_INACTIVE + phase - 1); +#else + int graphic = IMG_TRAP_ACTIVE; + int frame = getNewGraphicAnimationFrame(graphic, + 31 - MovDelay[x][y]); + + DrawNewGraphic(SCREENX(x),SCREENY(y), graphic, frame); +#endif ErdreichAnbroeckeln(SCREENX(x), SCREENY(y)); } } @@ -4197,24 +4775,33 @@ static void CheckTrap(int x, int y) return; } - Feld[x][y] = EL_TRAP_INACTIVE; - DrawLevelField(x, y); + Feld[x][y] = EL_TRAP; + DrawNewLevelField(x, y); } } } static void DrawBeltAnimation(int x, int y, int element) { - int belt_nr = getBeltNrFromElement(element); + int belt_nr = getBeltNrFromBeltActiveElement(element); int belt_dir = game.belt_dir[belt_nr]; if (belt_dir != MV_NO_MOVING) { +#if 0 int delay = 2; - int mode = (belt_dir == MV_LEFT ? ANIM_NORMAL : ANIM_REVERSE); + int mode = ANIM_LOOP | (belt_dir == MV_LEFT ? 0 : ANIM_REVERSE); int graphic = el2gfx(element) + (belt_dir == MV_LEFT ? 0 : 7); DrawGraphicAnimation(x, y, graphic, 8, delay, mode); +#else + int graphic = el2img(element); + + DrawNewGraphicAnimation(x, y, graphic); +#endif + + if (!(FrameCounter % 2)) + PlaySoundLevel(x, y, SND_CONVEYOR_BELT_ACTIVE); } } @@ -4257,6 +4844,15 @@ static void PlayerActions(struct PlayerInfo *player, byte player_action) moved = MoveFigure(player, dx, dy); } + if (tape.single_step && tape.recording && !tape.pausing) + { + if (button1 || (bombed && !moved)) + { + TapeTogglePause(TAPE_TOGGLE_AUTOMATIC); + SnapField(player, 0, 0); /* stop snapping */ + } + } + #if 0 if (tape.recording && (moved || snapped || bombed)) { @@ -4334,7 +4930,7 @@ static void PlayerActions(struct PlayerInfo *player, byte player_action) if (IN_LEV_FIELD(jx+dx, jy) && IS_PUSHABLE(Feld[jx+dx][jy])) { int el = Feld[jx+dx][jy]; - int push_delay = (IS_SB_ELEMENT(el) || el == EL_SONDE ? 2 : + int push_delay = (IS_SB_ELEMENT(el) || el == EL_SATELLITE ? 2 : (el == EL_BALLOON || el == EL_SPRING) ? 0 : 10); if (tape.delay_played + push_delay >= tape.pos[tape.counter].delay) @@ -4364,6 +4960,9 @@ void GameActions() action_delay_value = (tape.playing && tape.fast_forward ? FfwdFrameDelay : GameFrameDelay); + if (tape.playing && tape.index_search && !tape.pausing) + action_delay_value = 0; + /* ---------- main game synchronization point ---------- */ WaitUntilDelayReached(&action_delay, action_delay_value); @@ -4398,11 +4997,6 @@ void GameActions() if (tape.pausing) return; - if (tape.playing) - TapePlayDelay(); - else if (tape.recording) - TapeRecordDelay(); - recorded_player_action = (tape.playing ? TapePlayAction() : NULL); for (i=0; ijx, jy = local_player->jy; if (element == EL_MAGIC_WALL_FULL || - element == EL_MAGIC_WALL_EMPTY || + element == EL_MAGIC_WALL_ACTIVE || element == EL_MAGIC_WALL_EMPTYING) { SiebAktivieren(x, y, 1); sieb = TRUE; } - else if (element == EL_MAGIC_WALL_BD_FULL || - element == EL_MAGIC_WALL_BD_EMPTY || - element == EL_MAGIC_WALL_BD_EMPTYING) + else if (element == EL_BD_MAGIC_WALL_FULL || + element == EL_BD_MAGIC_WALL_ACTIVE || + element == EL_BD_MAGIC_WALL_EMPTYING) { SiebAktivieren(x, y, 2); sieb = TRUE; @@ -4623,17 +5263,17 @@ void GameActions() element = Feld[x][y]; if (!IS_PLAYER(x,y) && - (element == EL_LEERRAUM || - element == EL_ERDREICH || - element == EL_MORAST_LEER || - element == EL_BLURB_LEFT || - element == EL_BLURB_RIGHT)) + (element == EL_EMPTY || + element == EL_SAND || + element == EL_QUICKSAND_EMPTY || + element == EL_ACID_SPLASHING_LEFT || + element == EL_ACID_SPLASHING_RIGHT)) { - if ((IN_LEV_FIELD(x, y-1) && Feld[x][y-1] == EL_AMOEBE_NASS) || - (IN_LEV_FIELD(x-1, y) && Feld[x-1][y] == EL_AMOEBE_NASS) || - (IN_LEV_FIELD(x+1, y) && Feld[x+1][y] == EL_AMOEBE_NASS) || - (IN_LEV_FIELD(x, y+1) && Feld[x][y+1] == EL_AMOEBE_NASS)) - Feld[x][y] = EL_TROPFEN; + if ((IN_LEV_FIELD(x, y-1) && Feld[x][y-1] == EL_AMOEBA_WET) || + (IN_LEV_FIELD(x-1, y) && Feld[x-1][y] == EL_AMOEBA_WET) || + (IN_LEV_FIELD(x+1, y) && Feld[x+1][y] == EL_AMOEBA_WET) || + (IN_LEV_FIELD(x, y+1) && Feld[x][y+1] == EL_AMOEBA_WET)) + Feld[x][y] = EL_AMOEBA_DROP; } random = random * 129 + 1; @@ -4653,7 +5293,7 @@ void GameActions() if (ExplodeField[x][y]) Explode(x, y, EX_PHASE_START, ExplodeField[x][y]); - else if (element == EL_EXPLODING) + else if (element == EL_EXPLOSION) Explode(x, y, Frame[x][y], EX_NORMAL); ExplodeField[x][y] = EX_NO_EXPLOSION; @@ -4665,7 +5305,16 @@ void GameActions() if (game.magic_wall_active) { if (!(game.magic_wall_time_left % 4)) - PlaySoundLevel(sieb_x, sieb_y, SND_MIEP); + { + int element = Feld[sieb_x][sieb_y]; + + if (element == EL_BD_MAGIC_WALL_FULL || + element == EL_BD_MAGIC_WALL_ACTIVE || + element == EL_BD_MAGIC_WALL_EMPTYING) + PlaySoundLevel(sieb_x, sieb_y, SND_BD_MAGIC_WALL_ACTIVE); + else + PlaySoundLevel(sieb_x, sieb_y, SND_MAGIC_WALL_ACTIVE); + } if (game.magic_wall_time_left > 0) { @@ -4676,17 +5325,17 @@ void GameActions() { element = Feld[x][y]; - if (element == EL_MAGIC_WALL_EMPTY || + if (element == EL_MAGIC_WALL_ACTIVE || element == EL_MAGIC_WALL_FULL) { Feld[x][y] = EL_MAGIC_WALL_DEAD; - DrawLevelField(x, y); + DrawNewLevelField(x, y); } - else if (element == EL_MAGIC_WALL_BD_EMPTY || - element == EL_MAGIC_WALL_BD_FULL) + else if (element == EL_BD_MAGIC_WALL_ACTIVE || + element == EL_BD_MAGIC_WALL_FULL) { - Feld[x][y] = EL_MAGIC_WALL_BD_DEAD; - DrawLevelField(x, y); + Feld[x][y] = EL_BD_MAGIC_WALL_DEAD; + DrawNewLevelField(x, y); } } @@ -4700,22 +5349,7 @@ void GameActions() game.light_time_left--; if (game.light_time_left == 0) - { - for (y=0; y 0) @@ -4726,6 +5360,19 @@ void GameActions() CloseAllOpenTimegates(); } + for (i=0; ishield_active_time_left) + PlaySoundLevel(player->jx, player->jy, SND_SHIELD_DEADLY_ACTIVE); + else if (player->shield_passive_time_left) + PlaySoundLevel(player->jx, player->jy, SND_SHIELD_NORMAL_ACTIVE); + } + } + if (TimeFrames >= (1000 / GameFrameDelay)) { TimeFrames = 0; @@ -4733,12 +5380,14 @@ void GameActions() for (i=0; ishield_passive_time_left--; - if (stored_player[i].shield_active_time_left > 0) - stored_player[i].shield_active_time_left--; + if (player->shield_active_time_left > 0) + player->shield_active_time_left--; } } @@ -4750,7 +5399,7 @@ void GameActions() TimeLeft--; if (TimeLeft <= 10 && setup.time_limit) - PlaySoundStereo(SND_GONG, PSND_MAX_RIGHT); + PlaySoundStereo(SND_GAME_RUNNING_OUT_OF_TIME, SOUND_MAX_RIGHT); DrawText(DX_TIME, DY_TIME, int2str(TimeLeft, 3), FS_SMALL, FC_YELLOW); @@ -4758,7 +5407,7 @@ void GameActions() for (i=0; iprogrammed_action = MV_DOWN; } } @@ -4908,12 +5560,12 @@ boolean MoveFigureOneStep(struct PlayerInfo *player, if (DONT_GO_TO(element)) { - if (element == EL_SALZSAEURE && dx == 0 && dy == 1) + if (element == EL_ACID && dx == 0 && dy == 1) { Blurb(jx, jy); - Feld[jx][jy] = EL_SPIELFIGUR; + Feld[jx][jy] = EL_PLAYER1; InitMovingField(jx, jy, MV_DOWN); - Store[jx][jy] = EL_SALZSAEURE; + Store[jx][jy] = EL_ACID; ContinueMoving(jx, jy); BuryHero(player); } @@ -5085,7 +5737,7 @@ boolean MoveFigure(struct PlayerInfo *player, int dx, int dy) else if (old_jx == jx && old_jy != jy) player->MovDir = (old_jy < jy ? MV_DOWN : MV_UP); - DrawLevelField(jx, jy); /* for "ErdreichAnbroeckeln()" */ + DrawNewLevelField(jx, jy); /* for "ErdreichAnbroeckeln()" */ player->last_move_dir = player->MovDir; player->is_moving = TRUE; @@ -5122,7 +5774,7 @@ void ScrollFigure(struct PlayerInfo *player, int mode) player->actual_frame_counter = FrameCounter; player->GfxPos = move_stepsize * (player->MovPos / move_stepsize); - if (Feld[last_jx][last_jy] == EL_LEERRAUM) + if (Feld[last_jx][last_jy] == EL_EMPTY) Feld[last_jx][last_jy] = EL_PLAYER_IS_LEAVING; DrawPlayer(player); @@ -5135,7 +5787,7 @@ void ScrollFigure(struct PlayerInfo *player, int mode) player->GfxPos = move_stepsize * (player->MovPos / move_stepsize); if (Feld[last_jx][last_jy] == EL_PLAYER_IS_LEAVING) - Feld[last_jx][last_jy] = EL_LEERRAUM; + Feld[last_jx][last_jy] = EL_EMPTY; /* before DrawPlayer() to draw correct player graphic for this case */ if (player->MovPos == 0) @@ -5157,13 +5809,19 @@ void ScrollFigure(struct PlayerInfo *player, int mode) player->last_jx = jx; player->last_jy = jy; - if (Feld[jx][jy] == EL_AUSGANG_AUF) + if (Feld[jx][jy] == EL_EXIT_OPEN || + Feld[jx][jy] == EL_SP_EXIT_OPEN) { RemoveHero(player); - if (!local_player->friends_still_needed) + if (local_player->friends_still_needed == 0 || + Feld[jx][jy] == EL_SP_EXIT_OPEN) player->LevelSolved = player->GameOver = TRUE; } + + if (tape.single_step && tape.recording && !tape.pausing && + !player->programmed_action) + TapeTogglePause(TAPE_TOGGLE_AUTOMATIC); } } @@ -5278,7 +5936,7 @@ void TestIfBadThingHitsGoodThing(int bad_x, int bad_y, int bad_move_dir) MV_DOWN }; - if (bad_element == EL_EXPLODING) /* skip just exploding bad things */ + if (bad_element == EL_EXPLOSION) /* skip just exploding bad things */ return; for (i=0; i<4; i++) @@ -5313,7 +5971,7 @@ void TestIfBadThingHitsGoodThing(int bad_x, int bad_y, int bad_move_dir) kill_y = test_y; break; } - else if (test_element == EL_PINGUIN) + else if (test_element == EL_PENGUIN) { kill_x = test_x; kill_y = test_y; @@ -5407,8 +6065,8 @@ void TestIfBadThingTouchesOtherBadThing(int bad_x, int bad_y) continue; element = Feld[x][y]; - if (IS_AMOEBOID(element) || element == EL_LIFE || - element == EL_AMOEBING || element == EL_TROPFEN) + if (IS_AMOEBOID(element) || element == EL_GAMEOFLIFE || + element == EL_AMOEBA_CREATING || element == EL_AMOEBA_DROP) { kill_x = x; kill_y = y; @@ -5428,7 +6086,7 @@ void KillHero(struct PlayerInfo *player) return; if (IS_PFORTE(Feld[jx][jy])) - Feld[jx][jy] = EL_LEERRAUM; + Feld[jx][jy] = EL_EMPTY; /* deactivate shield (else Bang()/Explode() would not work right) */ player->shield_passive_time_left = 0; @@ -5451,8 +6109,8 @@ void BuryHero(struct PlayerInfo *player) if (!player->active) return; - PlaySoundLevel(jx, jy, SND_AUTSCH); - PlaySoundLevel(jx, jy, SND_LACHEN); + PlaySoundLevel(jx, jy, SND_PLAYER_DYING); + PlaySoundLevel(jx, jy, SND_GAME_LOSING); player->GameOver = TRUE; RemoveHero(player); @@ -5491,7 +6149,7 @@ int DigField(struct PlayerInfo *player, dy == +1 ? MV_DOWN : MV_NO_MOVING); int element; - if (!player->MovPos) + if (player->MovPos == 0) player->Pushing = FALSE; if (mode == DF_NO_PUSH) @@ -5509,18 +6167,18 @@ int DigField(struct PlayerInfo *player, int i = 0; int tube_leave_directions[][2] = { - { EL_TUBE_CROSS, MV_LEFT | MV_RIGHT | MV_UP | MV_DOWN }, - { EL_TUBE_VERTICAL, MV_UP | MV_DOWN }, - { EL_TUBE_HORIZONTAL, MV_LEFT | MV_RIGHT }, - { EL_TUBE_VERT_LEFT, MV_LEFT | MV_UP | MV_DOWN }, - { EL_TUBE_VERT_RIGHT, MV_RIGHT | MV_UP | MV_DOWN }, - { EL_TUBE_HORIZ_UP, MV_LEFT | MV_RIGHT | MV_UP }, - { EL_TUBE_HORIZ_DOWN, MV_LEFT | MV_RIGHT | MV_DOWN }, - { EL_TUBE_LEFT_UP, MV_LEFT | MV_UP }, - { EL_TUBE_LEFT_DOWN, MV_LEFT | MV_DOWN }, - { EL_TUBE_RIGHT_UP, MV_RIGHT | MV_UP }, - { EL_TUBE_RIGHT_DOWN, MV_RIGHT | MV_DOWN }, - { -1, MV_LEFT | MV_RIGHT | MV_UP | MV_DOWN } + { EL_TUBE_ALL, MV_LEFT | MV_RIGHT | MV_UP | MV_DOWN }, + { EL_TUBE_VERTICAL, MV_UP | MV_DOWN }, + { EL_TUBE_HORIZONTAL, MV_LEFT | MV_RIGHT }, + { EL_TUBE_VERTICAL_LEFT, MV_LEFT | MV_UP | MV_DOWN }, + { EL_TUBE_VERTICAL_RIGHT, MV_RIGHT | MV_UP | MV_DOWN }, + { EL_TUBE_HORIZONTAL_UP, MV_LEFT | MV_RIGHT | MV_UP }, + { EL_TUBE_HORIZONTAL_DOWN, MV_LEFT | MV_RIGHT | MV_DOWN }, + { EL_TUBE_LEFT_UP, MV_LEFT | MV_UP }, + { EL_TUBE_LEFT_DOWN, MV_LEFT | MV_DOWN }, + { EL_TUBE_RIGHT_UP, MV_RIGHT | MV_UP }, + { EL_TUBE_RIGHT_DOWN, MV_RIGHT | MV_DOWN }, + { -1, MV_LEFT | MV_RIGHT | MV_UP | MV_DOWN } }; while (tube_leave_directions[i][0] != Feld[jx][jy]) @@ -5538,34 +6196,28 @@ int DigField(struct PlayerInfo *player, switch (element) { - case EL_LEERRAUM: - PlaySoundLevel(x, y, SND_EMPTY); - break; - - case EL_ERDREICH: - case EL_SAND_INVISIBLE: - case EL_TRAP_INACTIVE: - Feld[x][y] = EL_LEERRAUM; - PlaySoundLevel(x, y, SND_SCHLURF); - break; - + case EL_EMPTY: + case EL_SAND: + case EL_INVISIBLE_SAND: + case EL_INVISIBLE_SAND_ACTIVE: + case EL_TRAP: case EL_SP_BASE: - case EL_SP_BUG: - Feld[x][y] = EL_LEERRAUM; - PlaySoundLevel(x, y, SND_SP_BASE); + case EL_SP_BUGGY_BASE: + RemoveField(x, y); + PlaySoundLevelElementAction(x, y, element, SND_ACTION_DIGGING); break; - case EL_EDELSTEIN: - case EL_EDELSTEIN_BD: - case EL_EDELSTEIN_GELB: - case EL_EDELSTEIN_ROT: - case EL_EDELSTEIN_LILA: - case EL_DIAMANT: + case EL_EMERALD: + case EL_BD_DIAMOND: + case EL_EMERALD_YELLOW: + case EL_EMERALD_RED: + case EL_EMERALD_PURPLE: + case EL_DIAMOND: case EL_SP_INFOTRON: case EL_PEARL: case EL_CRYSTAL: RemoveField(x, y); - local_player->gems_still_needed -= (element == EL_DIAMANT ? 3 : + local_player->gems_still_needed -= (element == EL_DIAMOND ? 3 : element == EL_PEARL ? 5 : element == EL_CRYSTAL ? 8 : 1); if (local_player->gems_still_needed < 0) @@ -5574,21 +6226,18 @@ int DigField(struct PlayerInfo *player, DrawText(DX_EMERALDS, DY_EMERALDS, int2str(local_player->gems_still_needed, 3), FS_SMALL, FC_YELLOW); - if (element == EL_SP_INFOTRON) - PlaySoundLevel(x, y, SND_SP_INFOTRON); - else - PlaySoundLevel(x, y, SND_PONG); + PlaySoundLevelElementAction(x, y, element, SND_ACTION_COLLECTING); break; case EL_SPEED_PILL: RemoveField(x, y); player->move_delay_value = MOVE_DELAY_HIGH_SPEED; - PlaySoundLevel(x, y, SND_PONG); + PlaySoundLevel(x, y, SND_SPEED_PILL_COLLECTING); break; case EL_ENVELOPE: - Feld[x][y] = EL_LEERRAUM; - PlaySoundLevel(x, y, SND_PONG); + Feld[x][y] = EL_EMPTY; + PlaySoundLevel(x, y, SND_ENVELOPE_COLLECTING); break; case EL_EXTRA_TIME: @@ -5598,99 +6247,97 @@ int DigField(struct PlayerInfo *player, TimeLeft += 10; DrawText(DX_TIME, DY_TIME, int2str(TimeLeft, 3), FS_SMALL, FC_YELLOW); } - PlaySoundStereo(SND_GONG, PSND_MAX_RIGHT); + PlaySoundStereo(SND_EXTRA_TIME_COLLECTING, SOUND_MAX_RIGHT); break; - case EL_SHIELD_PASSIVE: + case EL_SHIELD_NORMAL: RemoveField(x, y); player->shield_passive_time_left += 10; - PlaySoundLevel(x, y, SND_PONG); + PlaySoundLevel(x, y, SND_SHIELD_NORMAL_COLLECTING); break; - case EL_SHIELD_ACTIVE: + case EL_SHIELD_DEADLY: RemoveField(x, y); player->shield_passive_time_left += 10; player->shield_active_time_left += 10; - PlaySoundLevel(x, y, SND_PONG); + PlaySoundLevel(x, y, SND_SHIELD_DEADLY_COLLECTING); break; - case EL_DYNAMITE_INACTIVE: + case EL_DYNAMITE: case EL_SP_DISK_RED: RemoveField(x, y); player->dynamite++; - RaiseScoreElement(EL_DYNAMITE_INACTIVE); + RaiseScoreElement(EL_DYNAMITE); DrawText(DX_DYNAMITE, DY_DYNAMITE, int2str(local_player->dynamite, 3), FS_SMALL, FC_YELLOW); - if (element == EL_SP_DISK_RED) - PlaySoundLevel(x, y, SND_SP_INFOTRON); - else - PlaySoundLevel(x, y, SND_PONG); + PlaySoundLevelElementAction(x, y, element, SND_ACTION_COLLECTING); break; case EL_DYNABOMB_NR: RemoveField(x, y); player->dynabomb_count++; player->dynabombs_left++; - RaiseScoreElement(EL_DYNAMITE_INACTIVE); - PlaySoundLevel(x, y, SND_PONG); + RaiseScoreElement(EL_DYNAMITE); + PlaySoundLevel(x, y, SND_DYNABOMB_NR_COLLECTING); break; case EL_DYNABOMB_SZ: RemoveField(x, y); player->dynabomb_size++; - RaiseScoreElement(EL_DYNAMITE_INACTIVE); - PlaySoundLevel(x, y, SND_PONG); + RaiseScoreElement(EL_DYNAMITE); + PlaySoundLevel(x, y, SND_DYNABOMB_SZ_COLLECTING); break; case EL_DYNABOMB_XL: RemoveField(x, y); player->dynabomb_xl = TRUE; - RaiseScoreElement(EL_DYNAMITE_INACTIVE); - PlaySoundLevel(x, y, SND_PONG); + RaiseScoreElement(EL_DYNAMITE); + PlaySoundLevel(x, y, SND_DYNABOMB_XL_COLLECTING); break; - case EL_SCHLUESSEL1: - case EL_SCHLUESSEL2: - case EL_SCHLUESSEL3: - case EL_SCHLUESSEL4: + case EL_KEY1: + case EL_KEY2: + case EL_KEY3: + case EL_KEY4: { - int key_nr = element - EL_SCHLUESSEL1; + int key_nr = element - EL_KEY1; RemoveField(x, y); player->key[key_nr] = TRUE; - RaiseScoreElement(EL_SCHLUESSEL); + RaiseScoreElement(element); DrawMiniGraphicExt(drawto, DX_KEYS + key_nr * MINI_TILEX, DY_KEYS, GFX_SCHLUESSEL1 + key_nr); DrawMiniGraphicExt(window, DX_KEYS + key_nr * MINI_TILEX, DY_KEYS, GFX_SCHLUESSEL1 + key_nr); - PlaySoundLevel(x, y, SND_PONG); + PlaySoundLevel(x, y, SND_KEY_COLLECTING); break; } - case EL_EM_KEY_1: - case EL_EM_KEY_2: - case EL_EM_KEY_3: - case EL_EM_KEY_4: + case EL_EM_KEY1: + case EL_EM_KEY2: + case EL_EM_KEY3: + case EL_EM_KEY4: { - int key_nr = element - EL_EM_KEY_1; + int key_nr = element - EL_EM_KEY1; RemoveField(x, y); player->key[key_nr] = TRUE; - RaiseScoreElement(EL_SCHLUESSEL); + RaiseScoreElement(element); DrawMiniGraphicExt(drawto, DX_KEYS + key_nr * MINI_TILEX, DY_KEYS, GFX_SCHLUESSEL1 + key_nr); DrawMiniGraphicExt(window, DX_KEYS + key_nr * MINI_TILEX, DY_KEYS, GFX_SCHLUESSEL1 + key_nr); - PlaySoundLevel(x, y, SND_PONG); + PlaySoundLevel(x, y, SND_KEY_COLLECTING); break; } - case EL_ABLENK_AUS: - Feld[x][y] = EL_ABLENK_EIN; + case EL_ROBOT_WHEEL: + Feld[x][y] = EL_ROBOT_WHEEL_ACTIVE; ZX = x; ZY = y; - DrawLevelField(x, y); + DrawNewLevelField(x, y); + PlaySoundLevel(x, y, SND_ROBOT_WHEEL_ACTIVATING); return MF_ACTION; break; @@ -5698,6 +6345,8 @@ int DigField(struct PlayerInfo *player, { int xx, yy; + PlaySoundLevel(x, y, SND_SP_TERMINAL_ACTIVATING); + for (yy=0; yySwitching) { player->Switching = TRUE; ToggleBeltSwitch(x, y); + PlaySoundLevel(x, y, SND_CONVEYOR_BELT_SWITCH_ACTIVATING); } return MF_ACTION; break; - case EL_SWITCHGATE_SWITCH_1: - case EL_SWITCHGATE_SWITCH_2: + case EL_SWITCHGATE_SWITCH_UP: + case EL_SWITCHGATE_SWITCH_DOWN: if (!player->Switching) { player->Switching = TRUE; ToggleSwitchgateSwitch(x, y); + PlaySoundLevel(x, y, SND_SWITCHGATE_SWITCH_ACTIVATING); } return MF_ACTION; break; - case EL_LIGHT_SWITCH_OFF: - case EL_LIGHT_SWITCH_ON: + case EL_LIGHT_SWITCH: + case EL_LIGHT_SWITCH_ACTIVE: if (!player->Switching) { player->Switching = TRUE; ToggleLightSwitch(x, y); + PlaySoundLevel(x, y, element == EL_LIGHT_SWITCH ? + SND_LIGHT_SWITCH_ACTIVATING : + SND_LIGHT_SWITCH_DEACTIVATING); } return MF_ACTION; break; - case EL_TIMEGATE_SWITCH_OFF: + case EL_TIMEGATE_SWITCH: ActivateTimegateSwitch(x, y); + PlaySoundLevel(x, y, SND_TIMEGATE_SWITCH_ACTIVATING); return MF_ACTION; break; @@ -5763,8 +6418,8 @@ int DigField(struct PlayerInfo *player, case EL_BALLOON_SEND_RIGHT: case EL_BALLOON_SEND_UP: case EL_BALLOON_SEND_DOWN: - case EL_BALLOON_SEND_ANY: - if (element == EL_BALLOON_SEND_ANY) + case EL_BALLOON_SEND_ANY_DIRECTION: + if (element == EL_BALLOON_SEND_ANY_DIRECTION) game.balloon_dir = move_direction; else game.balloon_dir = (element == EL_BALLOON_SEND_LEFT ? MV_LEFT : @@ -5772,28 +6427,26 @@ int DigField(struct PlayerInfo *player, element == EL_BALLOON_SEND_UP ? MV_UP : element == EL_BALLOON_SEND_DOWN ? MV_DOWN : MV_NO_MOVING); + PlaySoundLevel(x, y, SND_BALLOON_SWITCH_ACTIVATING); return MF_ACTION; break; - case EL_SP_EXIT: - if (local_player->gems_still_needed > 0) - return MF_NO_ACTION; - - player->LevelSolved = player->GameOver = TRUE; - PlaySoundStereo(SND_SP_EXIT, PSND_MAX_RIGHT); - break; - - case EL_FELSBROCKEN: - case EL_BD_ROCK: - case EL_BOMBE: + /* the following elements cannot be pushed by "snapping" */ + case EL_ROCK: + case EL_BOMB: case EL_DX_SUPABOMB: - case EL_KOKOSNUSS: - case EL_ZEIT_LEER: + case EL_NUT: + case EL_TIME_ORB_EMPTY: case EL_SP_ZONK: case EL_SP_DISK_ORANGE: case EL_SPRING: - if (dy || mode == DF_SNAP) + if (mode == DF_SNAP) + return MF_NO_ACTION; + /* no "break" -- fall through to next case */ + /* the following elements can be pushed by "snapping" */ + case EL_BD_ROCK: + if (dy) return MF_NO_ACTION; player->Pushing = TRUE; @@ -5820,8 +6473,16 @@ int DigField(struct PlayerInfo *player, return MF_NO_ACTION; #endif - RemoveField(x, y); - Feld[x+dx][y+dy] = element; + if (mode == DF_SNAP) + { + InitMovingField(x, y, move_direction); + ContinueMoving(x, y); + } + else + { + RemoveField(x, y); + Feld[x+dx][y+dy] = element; + } if (element == EL_SPRING) { @@ -5831,38 +6492,31 @@ int DigField(struct PlayerInfo *player, player->push_delay_value = (element == EL_SPRING ? 0 : 2 + RND(8)); - DrawLevelField(x+dx, y+dy); - if (element == EL_FELSBROCKEN || element == EL_BD_ROCK) - 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_PUSCH); /* better than "SND_KLOPF" */ + DrawNewLevelField(x + dx, y + dy); + PlaySoundLevelElementAction(x, y, element, SND_ACTION_PUSHING); break; - case EL_PFORTE1: - case EL_PFORTE2: - case EL_PFORTE3: - case EL_PFORTE4: - if (!player->key[element - EL_PFORTE1]) + case EL_GATE1: + case EL_GATE2: + case EL_GATE3: + case EL_GATE4: + if (!player->key[element - EL_GATE1]) return MF_NO_ACTION; break; - case EL_PFORTE1X: - case EL_PFORTE2X: - case EL_PFORTE3X: - case EL_PFORTE4X: - if (!player->key[element - EL_PFORTE1X]) + case EL_GATE1_GRAY: + case EL_GATE2_GRAY: + case EL_GATE3_GRAY: + case EL_GATE4_GRAY: + if (!player->key[element - EL_GATE1_GRAY]) return MF_NO_ACTION; break; - case EL_EM_GATE_1: - case EL_EM_GATE_2: - case EL_EM_GATE_3: - case EL_EM_GATE_4: - if (!player->key[element - EL_EM_GATE_1]) + case EL_EM_GATE1: + case EL_EM_GATE2: + case EL_EM_GATE3: + case EL_EM_GATE4: + if (!player->key[element - EL_EM_GATE1]) return MF_NO_ACTION; if (!IN_LEV_FIELD(x + dx, y + dy) || !IS_FREE(x + dx, y + dy)) return MF_NO_ACTION; @@ -5871,15 +6525,14 @@ int DigField(struct PlayerInfo *player, player->programmed_action = move_direction; DOUBLE_PLAYER_SPEED(player); - PlaySoundLevel(x, y, SND_GATE); - + PlaySoundLevel(x, y, SND_GATE_PASSING); break; - case EL_EM_GATE_1X: - case EL_EM_GATE_2X: - case EL_EM_GATE_3X: - case EL_EM_GATE_4X: - if (!player->key[element - EL_EM_GATE_1X]) + case EL_EM_GATE1_GRAY: + case EL_EM_GATE2_GRAY: + case EL_EM_GATE3_GRAY: + case EL_EM_GATE4_GRAY: + if (!player->key[element - EL_EM_GATE1_GRAY]) return MF_NO_ACTION; if (!IN_LEV_FIELD(x + dx, y + dy) || !IS_FREE(x + dx, y + dy)) return MF_NO_ACTION; @@ -5888,8 +6541,7 @@ int DigField(struct PlayerInfo *player, player->programmed_action = move_direction; DOUBLE_PLAYER_SPEED(player); - PlaySoundLevel(x, y, SND_GATE); - + PlaySoundLevel(x, y, SND_GATE_PASSING); break; case EL_SWITCHGATE_OPEN: @@ -5901,8 +6553,7 @@ int DigField(struct PlayerInfo *player, player->programmed_action = move_direction; DOUBLE_PLAYER_SPEED(player); - PlaySoundLevel(x, y, SND_GATE); - + PlaySoundLevelElementAction(x, y, element, SND_ACTION_PASSING); break; case EL_SP_PORT1_LEFT: @@ -5944,16 +6595,16 @@ int DigField(struct PlayerInfo *player, player->programmed_action = move_direction; DOUBLE_PLAYER_SPEED(player); - PlaySoundLevel(x, y, SND_GATE); + PlaySoundLevel(x, y, SND_SP_PORT_PASSING); break; - case EL_TUBE_CROSS: + case EL_TUBE_ALL: case EL_TUBE_VERTICAL: case EL_TUBE_HORIZONTAL: - case EL_TUBE_VERT_LEFT: - case EL_TUBE_VERT_RIGHT: - case EL_TUBE_HORIZ_UP: - case EL_TUBE_HORIZ_DOWN: + case EL_TUBE_VERTICAL_LEFT: + case EL_TUBE_VERTICAL_RIGHT: + case EL_TUBE_HORIZONTAL_UP: + case EL_TUBE_HORIZONTAL_DOWN: case EL_TUBE_LEFT_UP: case EL_TUBE_LEFT_DOWN: case EL_TUBE_RIGHT_UP: @@ -5962,18 +6613,18 @@ int DigField(struct PlayerInfo *player, int i = 0; int tube_enter_directions[][2] = { - { EL_TUBE_CROSS, MV_LEFT | MV_RIGHT | MV_UP | MV_DOWN }, - { EL_TUBE_VERTICAL, MV_UP | MV_DOWN }, - { EL_TUBE_HORIZONTAL, MV_LEFT | MV_RIGHT }, - { EL_TUBE_VERT_LEFT, MV_RIGHT | MV_UP | MV_DOWN }, - { EL_TUBE_VERT_RIGHT, MV_LEFT | MV_UP | MV_DOWN }, - { EL_TUBE_HORIZ_UP, MV_LEFT | MV_RIGHT | MV_DOWN }, - { EL_TUBE_HORIZ_DOWN, MV_LEFT | MV_RIGHT | MV_UP }, - { EL_TUBE_LEFT_UP, MV_RIGHT | MV_DOWN }, - { EL_TUBE_LEFT_DOWN, MV_RIGHT | MV_UP }, - { EL_TUBE_RIGHT_UP, MV_LEFT | MV_DOWN }, - { EL_TUBE_RIGHT_DOWN, MV_LEFT | MV_UP }, - { -1, MV_NO_MOVING } + { EL_TUBE_ALL, MV_LEFT | MV_RIGHT | MV_UP | MV_DOWN }, + { EL_TUBE_VERTICAL, MV_UP | MV_DOWN }, + { EL_TUBE_HORIZONTAL, MV_LEFT | MV_RIGHT }, + { EL_TUBE_VERTICAL_LEFT, MV_RIGHT | MV_UP | MV_DOWN }, + { EL_TUBE_VERTICAL_RIGHT, MV_LEFT | MV_UP | MV_DOWN }, + { EL_TUBE_HORIZONTAL_UP, MV_LEFT | MV_RIGHT | MV_DOWN }, + { EL_TUBE_HORIZONTAL_DOWN, MV_LEFT | MV_RIGHT | MV_UP }, + { EL_TUBE_LEFT_UP, MV_RIGHT | MV_DOWN }, + { EL_TUBE_LEFT_DOWN, MV_RIGHT | MV_UP }, + { EL_TUBE_RIGHT_UP, MV_LEFT | MV_DOWN }, + { EL_TUBE_RIGHT_DOWN, MV_LEFT | MV_UP }, + { -1, MV_NO_MOVING } }; while (tube_enter_directions[i][0] != element) @@ -5985,46 +6636,52 @@ int DigField(struct PlayerInfo *player, if (!(tube_enter_directions[i][1] & move_direction)) return MF_NO_ACTION; /* tube has no opening in this direction */ + + PlaySoundLevel(x, y, SND_TUBE_PASSING); } break; - case EL_AUSGANG_ZU: - case EL_AUSGANG_ACT: - /* door is not (yet) open */ + case EL_EXIT_CLOSED: + case EL_SP_EXIT_CLOSED: + case EL_EXIT_OPENING: return MF_NO_ACTION; break; - case EL_AUSGANG_AUF: + case EL_EXIT_OPEN: + case EL_SP_EXIT_OPEN: if (mode == DF_SNAP) return MF_NO_ACTION; - PlaySoundLevel(x, y, SND_BUING); + if (element == EL_EXIT_OPEN) + PlaySoundLevel(x, y, SND_EXIT_PASSING); + else + PlaySoundLevel(x, y, SND_SP_EXIT_PASSING); break; - case EL_BIRNE_AUS: - Feld[x][y] = EL_BIRNE_EIN; + case EL_LAMP: + Feld[x][y] = EL_LAMP_ACTIVE; local_player->lights_still_needed--; - DrawLevelField(x, y); - PlaySoundLevel(x, y, SND_DENG); + DrawNewLevelField(x, y); + PlaySoundLevel(x, y, SND_LAMP_ACTIVATING); return MF_ACTION; break; - case EL_ZEIT_VOLL: - Feld[x][y] = EL_ZEIT_LEER; + case EL_TIME_ORB_FULL: + Feld[x][y] = EL_TIME_ORB_EMPTY; TimeLeft += 10; DrawText(DX_TIME, DY_TIME, int2str(TimeLeft, 3), FS_SMALL, FC_YELLOW); - DrawLevelField(x, y); - PlaySoundStereo(SND_GONG, PSND_MAX_RIGHT); + DrawNewLevelField(x, y); + PlaySoundStereo(SND_TIME_ORB_FULL_COLLECTING, SOUND_MAX_RIGHT); return MF_ACTION; break; - case EL_SOKOBAN_FELD_LEER: + case EL_SOKOBAN_FIELD_EMPTY: break; - case EL_SOKOBAN_FELD_VOLL: - case EL_SOKOBAN_OBJEKT: - case EL_SONDE: + case EL_SOKOBAN_OBJECT: + case EL_SOKOBAN_FIELD_FULL: + case EL_SATELLITE: case EL_SP_DISK_YELLOW: case EL_BALLOON: if (mode == DF_SNAP) @@ -6034,7 +6691,7 @@ int DigField(struct PlayerInfo *player, if (!IN_LEV_FIELD(x+dx, y+dy) || (!IS_FREE(x+dx, y+dy) - && (Feld[x+dx][y+dy] != EL_SOKOBAN_FELD_LEER + && (Feld[x+dx][y+dy] != EL_SOKOBAN_FIELD_EMPTY || !IS_SB_ELEMENT(element)))) return MF_NO_ACTION; @@ -6064,52 +6721,57 @@ int DigField(struct PlayerInfo *player, if (IS_SB_ELEMENT(element)) { - if (element == EL_SOKOBAN_FELD_VOLL) + if (element == EL_SOKOBAN_FIELD_FULL) { - Feld[x][y] = EL_SOKOBAN_FELD_LEER; + Feld[x][y] = EL_SOKOBAN_FIELD_EMPTY; local_player->sokobanfields_still_needed++; } else RemoveField(x, y); - if (Feld[x+dx][y+dy] == EL_SOKOBAN_FELD_LEER) + if (Feld[x+dx][y+dy] == EL_SOKOBAN_FIELD_EMPTY) { - Feld[x+dx][y+dy] = EL_SOKOBAN_FELD_VOLL; + Feld[x+dx][y+dy] = EL_SOKOBAN_FIELD_FULL; local_player->sokobanfields_still_needed--; - if (element == EL_SOKOBAN_OBJEKT) - PlaySoundLevel(x, y, SND_DENG); + if (element == EL_SOKOBAN_OBJECT) + PlaySoundLevel(x, y, SND_SOKOBAN_FIELD_FILLING); + else + PlaySoundLevel(x, y, SND_SOKOBAN_OBJECT_PUSHING); } else - Feld[x+dx][y+dy] = EL_SOKOBAN_OBJEKT; + { + Feld[x+dx][y+dy] = EL_SOKOBAN_OBJECT; + if (element == EL_SOKOBAN_FIELD_FULL) + PlaySoundLevel(x, y, SND_SOKOBAN_FIELD_EMPTYING); + else + PlaySoundLevel(x, y, SND_SOKOBAN_OBJECT_PUSHING); + } } else { RemoveField(x, y); Feld[x+dx][y+dy] = element; + PlaySoundLevelElementAction(x, y, element, SND_ACTION_PUSHING); } player->push_delay_value = (element == EL_BALLOON ? 0 : 2); - DrawLevelField(x, y); - DrawLevelField(x+dx, y+dy); - if (element == EL_BALLOON) - PlaySoundLevel(x+dx, y+dy, SND_SCHLURF); - else - PlaySoundLevel(x+dx, y+dy, SND_PUSCH); + DrawNewLevelField(x, y); + DrawNewLevelField(x + dx, y + dy); if (IS_SB_ELEMENT(element) && local_player->sokobanfields_still_needed == 0 && game.emulation == EMU_SOKOBAN) { player->LevelSolved = player->GameOver = TRUE; - PlaySoundLevel(x, y, SND_BUING); + PlaySoundLevel(x, y, SND_SOKOBAN_GAME_SOLVING); } break; - case EL_PINGUIN: - case EL_SCHWEIN: - case EL_DRACHE: + case EL_PENGUIN: + case EL_PIG: + case EL_DRAGON: break; default: @@ -6134,6 +6796,9 @@ boolean SnapField(struct PlayerInfo *player, int dx, int dy) if (!dx && !dy) { + if (player->MovPos == 0) + player->Pushing = FALSE; + player->snapped = FALSE; return FALSE; } @@ -6150,7 +6815,7 @@ boolean SnapField(struct PlayerInfo *player, int dx, int dy) return FALSE; player->snapped = TRUE; - DrawLevelField(x, y); + DrawNewLevelField(x, y); BackToFront(); return TRUE; @@ -6167,10 +6832,10 @@ boolean PlaceBomb(struct PlayerInfo *player) element = Feld[jx][jy]; if ((player->dynamite == 0 && player->dynabombs_left == 0) || - IS_ACTIVE_BOMB(element) || element == EL_EXPLODING) + IS_ACTIVE_BOMB(element) || element == EL_EXPLOSION) return FALSE; - if (element != EL_LEERRAUM) + if (element != EL_EMPTY) Store[jx][jy] = element; if (player->dynamite) @@ -6182,60 +6847,100 @@ boolean PlaceBomb(struct PlayerInfo *player) FS_SMALL, FC_YELLOW); if (IN_SCR_FIELD(SCREENX(jx), SCREENY(jy))) { +#if 0 if (game.emulation == EMU_SUPAPLEX) DrawGraphic(SCREENX(jx), SCREENY(jy), GFX_SP_DISK_RED); else DrawGraphicThruMask(SCREENX(jx), SCREENY(jy), GFX_DYNAMIT); +#else + if (game.emulation == EMU_SUPAPLEX) + DrawNewGraphic(SCREENX(jx), SCREENY(jy), IMG_SP_DISK_RED, 0); + else + DrawNewGraphicThruMask(SCREENX(jx), SCREENY(jy), + IMG_DYNAMITE_ACTIVE, 0); +#endif } + + PlaySoundLevel(jx, jy, SND_DYNAMITE_DROPPING); } else { - Feld[jx][jy] = EL_DYNABOMB_ACTIVE_1 + (player->element_nr - EL_SPIELER1); + Feld[jx][jy] = + EL_DYNABOMB_PLAYER1_ACTIVE + (player->element_nr - EL_PLAYER1); MovDelay[jx][jy] = 96; player->dynabombs_left--; if (IN_SCR_FIELD(SCREENX(jx), SCREENY(jy))) +#if 0 DrawGraphicThruMask(SCREENX(jx), SCREENY(jy), GFX_DYNABOMB); +#else + DrawNewGraphicThruMask(SCREENX(jx), SCREENY(jy), + el2img(Feld[jx][jy]), 0); +#endif + + PlaySoundLevel(jx, jy, SND_DYNABOMB_DROPPING); } return TRUE; } -void PlaySoundLevel(int x, int y, int sound_nr) +void PlaySoundLevel(int x, int y, int nr) { + static int loop_sound_frame[NUM_SOUND_FILES]; + static int loop_sound_volume[NUM_SOUND_FILES]; int sx = SCREENX(x), sy = SCREENY(y); - int volume, stereo; - int silence_distance = 8; + int volume, stereo_position; + int max_distance = 8; + int type = (IS_LOOP_SOUND(nr) ? SND_CTRL_PLAY_LOOP : SND_CTRL_PLAY_SOUND); - if ((!setup.sound_simple && !IS_LOOP_SOUND(sound_nr)) || - (!setup.sound_loops && IS_LOOP_SOUND(sound_nr))) + if ((!setup.sound_simple && !IS_LOOP_SOUND(nr)) || + (!setup.sound_loops && IS_LOOP_SOUND(nr))) return; if (!IN_LEV_FIELD(x, y) || - sx < -silence_distance || sx >= SCR_FIELDX+silence_distance || - sy < -silence_distance || sy >= SCR_FIELDY+silence_distance) + sx < -max_distance || sx >= SCR_FIELDX + max_distance || + sy < -max_distance || sy >= SCR_FIELDY + max_distance) return; - volume = PSND_MAX_VOLUME; - -#if !defined(PLATFORM_MSDOS) - stereo = (sx - SCR_FIELDX/2) * 12; -#else - stereo = PSND_MIDDLE + (2 * sx - (SCR_FIELDX - 1)) * 5; - if (stereo > PSND_MAX_RIGHT) - stereo = PSND_MAX_RIGHT; - if (stereo < PSND_MAX_LEFT) - stereo = PSND_MAX_LEFT; -#endif + volume = SOUND_MAX_VOLUME; if (!IN_SCR_FIELD(sx, sy)) { - int dx = ABS(sx - SCR_FIELDX/2) - SCR_FIELDX/2; - int dy = ABS(sy - SCR_FIELDY/2) - SCR_FIELDY/2; + int dx = ABS(sx - SCR_FIELDX / 2) - SCR_FIELDX / 2; + int dy = ABS(sy - SCR_FIELDY / 2) - SCR_FIELDY / 2; + + volume -= volume * (dx > dy ? dx : dy) / max_distance; + } + + stereo_position = (SOUND_MAX_LEFT + + (sx + max_distance) * SOUND_MAX_LEFT2RIGHT / + (SCR_FIELDX + 2 * max_distance)); + + if (IS_LOOP_SOUND(nr)) + { + /* This assures that quieter loop sounds do not overwrite louder ones, + while restarting sound volume comparison with each new game frame. */ + + if (loop_sound_volume[nr] > volume && loop_sound_frame[nr] == FrameCounter) + return; - volume -= volume * (dx > dy ? dx : dy) / silence_distance; + loop_sound_volume[nr] = volume; + loop_sound_frame[nr] = FrameCounter; } - PlaySoundExt(sound_nr, volume, stereo, PSND_NO_LOOP); + PlaySoundExt(nr, volume, stereo_position, type); +} + +void PlaySoundLevelAction(int x, int y, int sound_action) +{ + PlaySoundLevelElementAction(x, y, Feld[x][y], sound_action); +} + +void PlaySoundLevelElementAction(int x, int y, int element, int sound_action) +{ + int sound_effect = element_action_sound[element][sound_action]; + + if (sound_effect != -1) + PlaySoundLevel(x, y, sound_effect); } void RaiseScore(int value) @@ -6249,26 +6954,26 @@ void RaiseScoreElement(int element) { switch(element) { - case EL_EDELSTEIN: - case EL_EDELSTEIN_BD: - case EL_EDELSTEIN_GELB: - case EL_EDELSTEIN_ROT: - case EL_EDELSTEIN_LILA: + case EL_EMERALD: + case EL_BD_DIAMOND: + case EL_EMERALD_YELLOW: + case EL_EMERALD_RED: + case EL_EMERALD_PURPLE: RaiseScore(level.score[SC_EDELSTEIN]); break; - case EL_DIAMANT: + case EL_DIAMOND: RaiseScore(level.score[SC_DIAMANT]); break; - case EL_KAEFER: - case EL_BUTTERFLY: + case EL_BUG: + case EL_BD_BUTTERFLY: RaiseScore(level.score[SC_KAEFER]); break; - case EL_FLIEGER: - case EL_FIREFLY: + case EL_SPACESHIP: + case EL_BD_FIREFLY: RaiseScore(level.score[SC_FLIEGER]); break; - case EL_MAMPFER: - case EL_MAMPFER2: + case EL_YAMYAM: + case EL_DARK_YAMYAM: RaiseScore(level.score[SC_MAMPFER]); break; case EL_ROBOT: @@ -6277,13 +6982,16 @@ void RaiseScoreElement(int element) case EL_PACMAN: RaiseScore(level.score[SC_PACMAN]); break; - case EL_KOKOSNUSS: + case EL_NUT: RaiseScore(level.score[SC_KOKOSNUSS]); break; - case EL_DYNAMITE_INACTIVE: + case EL_DYNAMITE: RaiseScore(level.score[SC_DYNAMIT]); break; - case EL_SCHLUESSEL: + case EL_KEY1: + case EL_KEY2: + case EL_KEY3: + case EL_KEY4: RaiseScore(level.score[SC_SCHLUESSEL]); break; default: @@ -6291,6 +6999,31 @@ void RaiseScoreElement(int element) } } +void RequestQuitGame(boolean ask_if_really_quit) +{ + if (AllPlayersGone || + !ask_if_really_quit || + level_editor_test_game || + Request("Do you really want to quit the game ?", + REQ_ASK | REQ_STAY_CLOSED)) + { +#if defined(PLATFORM_UNIX) + if (options.network) + SendToServer_StopPlaying(); + else +#endif + { + game_status = MAINMENU; + DrawMainMenu(); + } + } + else + { + OpenDoor(DOOR_OPEN_1 | DOOR_COPY_BACK); + } +} + + /* ---------- new game button stuff ---------------------------------------- */ /* graphic position values for game buttons */ @@ -6439,30 +7172,7 @@ static void HandleGameButtons(struct GadgetInfo *gi) switch (id) { case GAME_CTRL_ID_STOP: - if (AllPlayersGone) - { - CloseDoor(DOOR_CLOSE_1); - game_status = MAINMENU; - DrawMainMenu(); - break; - } - - if (level_editor_test_game || - Request("Do you really want to quit the game ?", - REQ_ASK | REQ_STAY_CLOSED)) - { -#if defined(PLATFORM_UNIX) - if (options.network) - SendToServer_StopPlaying(); - else -#endif - { - game_status = MAINMENU; - DrawMainMenu(); - } - } - else - OpenDoor(DOOR_OPEN_1 | DOOR_COPY_BACK); + RequestQuitGame(TRUE); break; case GAME_CTRL_ID_PAUSE: @@ -6476,7 +7186,7 @@ static void HandleGameButtons(struct GadgetInfo *gi) #endif } else - TapeTogglePause(); + TapeTogglePause(TAPE_TOGGLE_MANUAL); break; case GAME_CTRL_ID_PLAY: @@ -6500,11 +7210,10 @@ static void HandleGameButtons(struct GadgetInfo *gi) setup.sound_music = FALSE; FadeMusic(); } - else if (audio.loops_available) + else if (audio.music_available) { setup.sound = setup.sound_music = TRUE; - if (num_bg_loops) - PlayMusic(level_nr % num_bg_loops); + PlayMusic(level_nr); } break;