X-Git-Url: https://git.artsoft.org/?a=blobdiff_plain;f=src%2Fgame.c;h=533119c92b368df93d484018f33fd3d2b35a7b42;hb=7b47ce7ba0f673f0de5130daf5726104d0b38902;hp=901a7fcf427d8f7d75c4d9adba0b226a486cc553;hpb=38c26472a6e9f0f037ddfe535d3919c00772b26f;p=rocksndiamonds.git diff --git a/src/game.c b/src/game.c index 901a7fcf..533119c9 100644 --- a/src/game.c +++ b/src/game.c @@ -115,54 +115,8 @@ static void HandleGameButtons(struct GadgetInfo *); static struct GadgetInfo *game_gadget[NUM_GAME_BUTTONS]; -#define IS_ANIMATED(g) (new_graphic_info[g].anim_frames > 1) - - -/* ------------------------------------------------------------------------- */ -/* sound definitions */ -/* ------------------------------------------------------------------------- */ - -#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]) +#define IS_ANIMATED(g) (graphic_info[g].anim_frames > 1) +#define IS_LOOP_SOUND(s) (sound_info[s].loop) /* ------------------------------------------------------------------------- @@ -578,97 +532,6 @@ void DrawGameDoorValues() } -/* - ============================================================================= - 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 - - /* initialize sound effect for all elements to "no sound" */ - for (i=0; igems_still_needed, 3), FS_SMALL, FC_YELLOW); - PlaySoundLevelElementAction(x, y, element, SND_ACTION_COLLECTING); + PlaySoundLevelElementAction(x, y, element, ACTION_COLLECTING); break; case EL_SPEED_PILL: @@ -6434,7 +6306,7 @@ int DigField(struct PlayerInfo *player, DrawText(DX_DYNAMITE, DY_DYNAMITE, int2str(local_player->dynamite, 3), FS_SMALL, FC_YELLOW); - PlaySoundLevelElementAction(x, y, element, SND_ACTION_COLLECTING); + PlaySoundLevelElementAction(x, y, element, ACTION_COLLECTING); break; case EL_DYNABOMB_NR: @@ -6656,7 +6528,7 @@ int DigField(struct PlayerInfo *player, player->push_delay_value = (element == EL_SPRING ? 0 : 2 + RND(8)); DrawLevelField(x + dx, y + dy); - PlaySoundLevelElementAction(x, y, element, SND_ACTION_PUSHING); + PlaySoundLevelElementAction(x, y, element, ACTION_PUSHING); break; case EL_GATE1: @@ -6716,7 +6588,7 @@ int DigField(struct PlayerInfo *player, player->programmed_action = move_direction; DOUBLE_PLAYER_SPEED(player); - PlaySoundLevelElementAction(x, y, element, SND_ACTION_PASSING); + PlaySoundLevelElementAction(x, y, element, ACTION_PASSING); break; case EL_SP_PORT1_LEFT: @@ -6914,7 +6786,7 @@ int DigField(struct PlayerInfo *player, { RemoveField(x, y); Feld[x+dx][y+dy] = element; - PlaySoundLevelElementAction(x, y, element, SND_ACTION_PUSHING); + PlaySoundLevelElementAction(x, y, element, ACTION_PUSHING); } player->push_delay_value = (element == EL_BALLOON ? 0 : 2); @@ -7100,9 +6972,9 @@ static void PlaySoundLevelAction(int x, int y, int sound_action) static void PlaySoundLevelElementAction(int x, int y, int element, int sound_action) { - int sound_effect = element_action_sound[element][sound_action]; + int sound_effect = element_info[element].sound[sound_action]; - if (sound_effect != -1) + if (sound_effect != SND_UNDEFINED) PlaySoundLevel(x, y, sound_effect); } @@ -7249,7 +7121,7 @@ void CreateGameButtons() for (i=0; i