-#define COMPILE_DATE_STRING "[2004-09-27 19:23]"
+#define COMPILE_DATE_STRING "[2004-09-27 20:49]"
ply2->x_initial = 0;
ply2->y_initial = 0;
- /* at last, set the two players at their positions in the playfield */
+ /* at last, set the two players to their positions in the playfield */
for (y = 0; y < lev->height; y++) for (x = 0; x < lev->width; x++)
{
if (level->field[x][y] == EL_PLAYER_1)
"12.collect.au",
"13.diamond.au",
"14.squash.au",
+ "14.squash.au",
"15.drip.au",
"16.push.au",
"17.dirt.au",
100,
100,
100,
+ 100,
20,
100,
100,
#endif
}
+void play_element_sound(int x, int y, int sample, int element)
+{
+ play_sound(x, y, sample);
+}
+
void sound_play(void)
{
#if 0
TILE_MAX
};
+enum
+{
+ SAMPLE_blank = 0, /* player walks on blank */
+ SAMPLE_roll, /* player pushes stone/bomb/nut/spring */
+ SAMPLE_stone, /* stone hits ground */
+ SAMPLE_nut, /* nut hits ground */
+ SAMPLE_crack, /* stone hits nut */
+ SAMPLE_bug, /* bug moves */
+ SAMPLE_tank, /* tank moves */
+ SAMPLE_android, /* android places something */
+ SAMPLE_spring, /* spring hits ground/wall/bumper, stone hits spring */
+ SAMPLE_slurp, /* spring kills alien */
+ SAMPLE_eater, /* eater sits/eats diamond */
+ SAMPLE_alien, /* alien moves */
+ SAMPLE_collect, /* player collects object */
+ SAMPLE_diamond, /* diamond/emerald hits ground */
+ SAMPLE_squash, /* stone squashes diamond */
+ SAMPLE_wonderfall, /* object falls thru wonderwall */
+ SAMPLE_drip, /* drip hits ground */
+ SAMPLE_push, /* player pushes balloon/android */
+ SAMPLE_dirt, /* player walks on dirt */
+ SAMPLE_acid, /* acid splashes */
+ SAMPLE_ball, /* ball places something */
+ SAMPLE_grow, /* growing wall grows */
+ SAMPLE_wonder, /* wonderwall moves (is active) */
+ SAMPLE_door, /* player goes thru door */
+ SAMPLE_exit, /* player goes in exit */
+ SAMPLE_dynamite, /* player places dynamite */
+ SAMPLE_tick, /* dynamite ticks */
+ SAMPLE_press, /* player presses wheel/wind/switch */
+ SAMPLE_wheel, /* wheel moves */
+ SAMPLE_boom, /* explosion */
+ SAMPLE_time, /* time runs out */
+ SAMPLE_die, /* player dies */
+
+ SAMPLE_MAX
+};
+
struct LEVEL
{
unsigned int home_initial; /* number of players (initial) */
#ifndef SAMPLE_H
#define SAMPLE_H
+#include "main_em.h"
+
+#if 0
+
enum
{
- SAMPLE_blank = 0, /* player walks on blank */
- SAMPLE_roll, /* player pushes stone/bomb/nut */
- SAMPLE_stone, /* stone hits ground */
- SAMPLE_nut, /* nut hits ground */
- SAMPLE_crack, /* stone hits nut */
- SAMPLE_bug, /* bug moves */
- SAMPLE_tank, /* tank moves */
- SAMPLE_android, /* android places something */
- SAMPLE_spring, /* spring hits ground/wall/bumper, stone hits spring */
- SAMPLE_slurp, /* spring kills alien */
- SAMPLE_eater, /* eater sits/eats diamond */
- SAMPLE_alien, /* alien moves */
- SAMPLE_collect, /* player collects object */
- SAMPLE_diamond, /* diamond/emerald hits ground */
- SAMPLE_squash, /* stone squashes diamond; object falls thru wonderwall */
- SAMPLE_drip, /* drip hits ground */
- SAMPLE_push, /* player pushes spring/balloon/android */
- SAMPLE_dirt, /* player walks on dirt */
- SAMPLE_acid, /* acid splashes */
- SAMPLE_ball, /* ball places something */
- SAMPLE_grow, /* growing wall grows */
- SAMPLE_wonder, /* wonderwall moves */
- SAMPLE_door, /* player goes thru door */
- SAMPLE_exit, /* player goes in exit */
- SAMPLE_dynamite, /* player places dynamite */
- SAMPLE_tick, /* dynamite ticks */
- SAMPLE_press, /* player presses wheel/wind/switch */
- SAMPLE_wheel, /* wheel moves */
- SAMPLE_boom, /* explosion */
- SAMPLE_time, /* time runs out */
- SAMPLE_die, /* player dies */
+ SAMPLE_blank = 0, /* player walks on blank */
+ SAMPLE_roll, /* player pushes stone/bomb/nut/spring */
+ SAMPLE_stone, /* stone hits ground */
+ SAMPLE_nut, /* nut hits ground */
+ SAMPLE_crack, /* stone hits nut */
+ SAMPLE_bug, /* bug moves */
+ SAMPLE_tank, /* tank moves */
+ SAMPLE_android, /* android places something */
+ SAMPLE_spring, /* spring hits ground/wall/bumper, stone hits spring */
+ SAMPLE_slurp, /* spring kills alien */
+ SAMPLE_eater, /* eater sits/eats diamond */
+ SAMPLE_alien, /* alien moves */
+ SAMPLE_collect, /* player collects object */
+ SAMPLE_diamond, /* diamond/emerald hits ground */
+ SAMPLE_squash, /* stone squashes diamond */
+ SAMPLE_wonderfall, /* object falls thru wonderwall */
+ SAMPLE_drip, /* drip hits ground */
+ SAMPLE_push, /* player pushes balloon/android */
+ SAMPLE_dirt, /* player walks on dirt */
+ SAMPLE_acid, /* acid splashes */
+ SAMPLE_ball, /* ball places something */
+ SAMPLE_grow, /* growing wall grows */
+ SAMPLE_wonder, /* wonderwall moves (is active) */
+ SAMPLE_door, /* player goes thru door */
+ SAMPLE_exit, /* player goes in exit */
+ SAMPLE_dynamite, /* player places dynamite */
+ SAMPLE_tick, /* dynamite ticks */
+ SAMPLE_press, /* player presses wheel/wind/switch */
+ SAMPLE_wheel, /* wheel moves */
+ SAMPLE_boom, /* explosion */
+ SAMPLE_time, /* time runs out */
+ SAMPLE_die, /* player dies */
SAMPLE_MAX
};
+#endif
+
extern void play_sound(int, int, int);
+extern void play_element_sound(int, int, int, int);
extern char play[SAMPLE_MAX];
extern int sound_pipe[2];
extern short *sound_data[SAMPLE_MAX];
extern long sound_length[SAMPLE_MAX];
-#define MIXER_MAX 4 /* maximum number of samples we can play at once */
+#define MIXER_MAX 4 /* maximum number of samples we can play at once */
#if defined(AUDIO_UNIX_NATIVE)
static const int sound_priority[SAMPLE_MAX] =
{
- SAMPLE_exit, SAMPLE_die, SAMPLE_time, SAMPLE_boom, SAMPLE_tick,
- SAMPLE_collect, SAMPLE_roll, SAMPLE_push, SAMPLE_dynamite, SAMPLE_press,
- SAMPLE_door, SAMPLE_dirt, SAMPLE_blank, SAMPLE_android, SAMPLE_ball,
- SAMPLE_grow, SAMPLE_squash, SAMPLE_crack, SAMPLE_slurp, SAMPLE_drip,
- SAMPLE_wonder, SAMPLE_wheel, SAMPLE_stone, SAMPLE_spring, SAMPLE_diamond,
- SAMPLE_nut, SAMPLE_bug, SAMPLE_tank, SAMPLE_eater, SAMPLE_alien,
+ SAMPLE_exit,
+ SAMPLE_die,
+ SAMPLE_time,
+ SAMPLE_boom,
+ SAMPLE_tick,
+ SAMPLE_collect,
+ SAMPLE_roll,
+ SAMPLE_push,
+ SAMPLE_dynamite,
+ SAMPLE_press,
+ SAMPLE_door,
+ SAMPLE_dirt,
+ SAMPLE_blank,
+ SAMPLE_android,
+ SAMPLE_ball,
+ SAMPLE_grow,
+ SAMPLE_squash,
+ SAMPLE_wonderfall,
+ SAMPLE_crack,
+ SAMPLE_slurp,
+ SAMPLE_drip,
+ SAMPLE_wonder,
+ SAMPLE_wheel,
+ SAMPLE_stone,
+ SAMPLE_spring,
+ SAMPLE_diamond,
+ SAMPLE_nut,
+ SAMPLE_bug,
+ SAMPLE_tank,
+ SAMPLE_eater,
+ SAMPLE_alien,
SAMPLE_acid
};
register unsigned int x = ply->x;
register unsigned int y = ply->y;
+ if (!ply->alive)
+ return 0;
+
if (lev.time == 0)
return(1);
if (ply->joy_fire == 0)
{
+ int element = Cave[y][x];
+
switch(Cave[y][x])
{
/* fire is released */
Cave[y][x] = (dy ? (dy < 0 ? Ygrass_nB : Ygrass_sB) :
(dx > 0 ? Ygrass_eB : Ygrass_wB));
Next[y][x] = Zplayer;
- play_sound(x, y, SAMPLE_dirt);
+ play_element_sound(x, y, SAMPLE_dirt, Xgrass);
ply->anim = SPR_walk + anim;
ply->x = x;
ply->y = y;
Cave[y][x] = (dy ? (dy < 0 ? Ydirt_nB : Ydirt_sB) :
(dx > 0 ? Ydirt_eB : Ydirt_wB));
Next[y][x] = Zplayer;
- play_sound(x, y, SAMPLE_dirt);
+ play_element_sound(x, y, SAMPLE_dirt, Xdirt);
ply->anim = SPR_walk + anim;
ply->x = x;
ply->y = y;
case Xdiamond_pause:
Cave[y][x] = Ydiamond_eat;
Next[y][x] = Zplayer;
- play_sound(x, y, SAMPLE_collect);
+ play_element_sound(x, y, SAMPLE_collect, element);
lev.score += lev.diamond_score;
lev.required = lev.required < 3 ? 0 : lev.required - 3;
ply->anim = SPR_walk + anim;
case Xemerald_pause:
Cave[y][x] = Yemerald_eat;
Next[y][x] = Zplayer;
- play_sound(x, y, SAMPLE_collect);
+ play_element_sound(x, y, SAMPLE_collect, element);
lev.score += lev.emerald_score;
lev.required = lev.required < 1 ? 0 : lev.required - 1;
ply->anim = SPR_walk + anim;
case Xdynamite:
Cave[y][x] = Ydynamite_eat;
Next[y][x] = Zplayer;
- play_sound(x, y, SAMPLE_collect);
+ play_element_sound(x, y, SAMPLE_collect, element);
lev.score += lev.dynamite_score;
ply->dynamite = ply->dynamite > 9998 ? 9999 : ply->dynamite + 1;
ply->anim = SPR_walk + anim;
Cave[y][x] = Yball_eat;
Next[y][x] = Zplayer;
- play_sound(x, y, SAMPLE_collect);
+ play_element_sound(x, y, SAMPLE_collect, element);
lev.score += lev.key_score;
ply->anim = SPR_walk + anim;
ply->x = x;
case Xlenses:
Cave[y][x] = Yball_eat;
Next[y][x] = Zplayer;
- play_sound(x, y, SAMPLE_collect);
+ play_element_sound(x, y, SAMPLE_collect, element);
lev.score += lev.lenses_score;
lev.lenses_cnt = lev.lenses_time;
ply->anim = SPR_walk + anim;
case Xmagnify:
Cave[y][x] = Yball_eat;
Next[y][x] = Zplayer;
- play_sound(x, y, SAMPLE_collect);
+ play_element_sound(x, y, SAMPLE_collect, element);
lev.score += lev.magnify_score;
lev.magnify_cnt = lev.magnify_time;
ply->anim = SPR_walk + anim;
Cave[y][x] = dx > 0 ? Ystone_eB : Ystone_wB;
Next[y][x] = Zplayer;
- play_sound(x, y, SAMPLE_roll);
+ play_element_sound(x, y, SAMPLE_roll, Xstone);
ply->x = x;
}
Cave[y][x] = dx > 0 ? Ybomb_eB : Ybomb_wB;
Next[y][x] = Zplayer;
- play_sound(x, y, SAMPLE_roll);
+ play_element_sound(x, y, SAMPLE_roll, Xbomb);
ply->x = x;
}
Cave[y][x] = dx > 0 ? Ynut_eB : Ynut_wB;
Next[y][x] = Zplayer;
- play_sound(x, y, SAMPLE_roll);
+ play_element_sound(x, y, SAMPLE_roll, Xnut);
ply->x = x;
}
spring_walk:
Cave[y][x] = dx > 0 ? Yspring_eB : Yspring_wB;
Next[y][x] = Zplayer;
- play_sound(x, y, SAMPLE_roll);
+ play_element_sound(x, y, SAMPLE_roll, Xspring);
ply->x = x;
}
Cave[y][x] = (dy ? (dy < 0 ? Yballoon_nB : Yballoon_sB) :
(dx > 0 ? Yballoon_eB : Yballoon_wB));
Next[y][x] = Zplayer;
- play_sound(x, y, SAMPLE_push);
+ play_element_sound(x, y, SAMPLE_push, Xballoon);
ply->x = x;
ply->y = y;
}
Cave[y][x] = (dy ? (dy < 0 ? Yandroid_nB : Yandroid_sB) :
(dx > 0 ? Yandroid_eB : Yandroid_wB));
Next[y][x] = Zplayer;
- play_sound(x, y, SAMPLE_push);
+ play_element_sound(x, y, SAMPLE_push, Xandroid);
ply->x = x;
ply->y = y;
}
Cave[y+dy][x+dx] = Zplayer;
Next[y+dy][x+dx] = Zplayer;
- play_sound(x, y, SAMPLE_door);
+ play_element_sound(x, y, SAMPLE_door, element);
ply->anim = SPR_walk + anim;
ply->x = x + dx;
ply->y = y + dy;
break;
case Xwheel:
- play_sound(x, y, SAMPLE_press);
+ play_element_sound(x, y, SAMPLE_press, element);
lev.wheel_cnt = lev.wheel_time;
lev.wheel_x = x;
lev.wheel_y = y;
goto wind_walk;
wind_walk:
- play_sound(x, y, SAMPLE_press);
+ play_element_sound(x, y, SAMPLE_press, element);
lev.wind_cnt = lev.wind_time;
break;
case Xwind_stop:
- play_sound(x, y, SAMPLE_press);
+ play_element_sound(x, y, SAMPLE_press, element);
lev.wind_cnt = 0;
break;
case Xswitch:
- play_sound(x, y, SAMPLE_press);
+ play_element_sound(x, y, SAMPLE_press, element);
lev.ball_cnt = lev.ball_time;
lev.ball_state = !lev.ball_state;
break;
case Xplant:
Cave[y][x] = Yplant;
Next[y][x] = Xplant;
- play_sound(x, y, SAMPLE_blank);
+ play_element_sound(x, y, SAMPLE_blank, Xplant);
ply->anim = SPR_walk + anim;
ply->x = x;
ply->y = y;
}
else
{
+ int element = Cave[y][x];
+
switch(Cave[y][x])
{
/* fire is pressed */
case Xdirt:
Cave[y][x] = Yball_eat;
Next[y][x] = Xblank;
- play_sound(x, y, SAMPLE_dirt);
+ play_element_sound(x, y, SAMPLE_dirt, element);
ply->anim = SPR_spray + anim;
break;
case Xdiamond_pause:
Cave[y][x] = Ydiamond_eat;
Next[y][x] = Xblank;
- play_sound(x, y, SAMPLE_collect);
+ play_element_sound(x, y, SAMPLE_collect, element);
lev.score += lev.diamond_score;
lev.required = lev.required < 3 ? 0 : lev.required - 3;
ply->anim = SPR_walk + anim;
case Xemerald_pause:
Cave[y][x] = Yemerald_eat;
Next[y][x] = Xblank;
- play_sound(x, y, SAMPLE_collect);
+ play_element_sound(x, y, SAMPLE_collect, element);
lev.score += lev.emerald_score;
lev.required = lev.required < 1 ? 0 : lev.required - 1;
ply->anim = SPR_walk + anim;
case Xdynamite:
Cave[y][x] = Ydynamite_eat;
Next[y][x] = Xblank;
- play_sound(x, y, SAMPLE_collect);
+ play_element_sound(x, y, SAMPLE_collect, element);
lev.score += lev.dynamite_score;
ply->dynamite = ply->dynamite > 9998 ? 9999 : ply->dynamite + 1;
ply->anim = SPR_walk + anim;
key_shoot:
Cave[y][x] = Yball_eat;
Next[y][x] = Xblank;
- play_sound(x, y, SAMPLE_collect);
+ play_element_sound(x, y, SAMPLE_collect, element);
lev.score += lev.key_score;
ply->anim = SPR_walk + anim;
break;
case Xlenses:
Cave[y][x] = Yball_eat;
Next[y][x] = Xblank;
- play_sound(x, y, SAMPLE_collect);
+ play_element_sound(x, y, SAMPLE_collect, element);
lev.score += lev.lenses_score;
lev.lenses_cnt = lev.lenses_time;
ply->anim = SPR_walk + anim;
case Xmagnify:
Cave[y][x] = Yball_eat;
Next[y][x] = Xblank;
- play_sound(x, y, SAMPLE_collect);
+ play_element_sound(x, y, SAMPLE_collect, element);
lev.score += lev.magnify_score;
lev.magnify_cnt = lev.magnify_time;
ply->anim = SPR_walk + anim;
unsigned int temp = 0; /* initialized to make compilers happy */
unsigned int dx; /* only needed to find closest player */
unsigned int dy;
+ int element;
loop:
- switch (cave_cache[++x])
+ element = cave_cache[++x];
+
+ switch (element)
{
default:
goto loop;
}
Next[y][x] = Xblank;
- play_sound(x, y, SAMPLE_squash);
+ play_element_sound(x, y, SAMPLE_wonderfall, Xstone);
goto loop;
}
{
Cave[y][x+1] = Ydiamond_eat;
Next[y][x+1] = Xblank;
- play_sound(x, y, SAMPLE_eater);
+ play_element_sound(x, y, SAMPLE_eater, Xdiamond);
goto loop;
}
{
Cave[y+1][x] = Ydiamond_eat;
Next[y+1][x] = Xblank;
- play_sound(x, y, SAMPLE_eater);
+ play_element_sound(x, y, SAMPLE_eater, Xdiamond);
goto loop;
}
{
Cave[y][x-1] = Ydiamond_eat;
Next[y][x-1] = Xblank;
- play_sound(x, y, SAMPLE_eater);
+ play_element_sound(x, y, SAMPLE_eater, Xdiamond);
goto loop;
}
{
Cave[y-1][x] = Ydiamond_eat;
Next[y-1][x] = Xblank;
- play_sound(x, y, SAMPLE_eater);
+ play_element_sound(x, y, SAMPLE_eater, Xdiamond);
goto loop;
}
{
Cave[y+1][x] = Ydiamond_eat;
Next[y+1][x] = Xblank;
- play_sound(x, y, SAMPLE_eater);
+ play_element_sound(x, y, SAMPLE_eater, Xdiamond);
goto loop;
}
{
Cave[y][x-1] = Ydiamond_eat;
Next[y][x-1] = Xblank;
- play_sound(x, y, SAMPLE_eater);
+ play_element_sound(x, y, SAMPLE_eater, Xdiamond);
goto loop;
}
{
Cave[y-1][x] = Ydiamond_eat;
Next[y-1][x] = Xblank;
- play_sound(x, y, SAMPLE_eater);
+ play_element_sound(x, y, SAMPLE_eater, Xdiamond);
goto loop;
}
{
Cave[y][x+1] = Ydiamond_eat;
Next[y][x+1] = Xblank;
- play_sound(x, y, SAMPLE_eater);
+ play_element_sound(x, y, SAMPLE_eater, Xdiamond);
goto loop;
}
{
Cave[y][x-1] = Ydiamond_eat;
Next[y][x-1] = Xblank;
- play_sound(x, y, SAMPLE_eater);
+ play_element_sound(x, y, SAMPLE_eater, Xdiamond);
goto loop;
}
{
Cave[y-1][x] = Ydiamond_eat;
Next[y-1][x] = Xblank;
- play_sound(x, y, SAMPLE_eater);
+ play_element_sound(x, y, SAMPLE_eater, Xdiamond);
goto loop;
}
{
Cave[y][x+1] = Ydiamond_eat;
Next[y][x+1] = Xblank;
- play_sound(x, y, SAMPLE_eater);
+ play_element_sound(x, y, SAMPLE_eater, Xdiamond);
goto loop;
}
{
Cave[y+1][x] = Ydiamond_eat;
Next[y+1][x] = Xblank;
- play_sound(x, y, SAMPLE_eater);
+ play_element_sound(x, y, SAMPLE_eater, Xdiamond);
goto loop;
}
{
Cave[y-1][x] = Ydiamond_eat;
Next[y-1][x] = Xblank;
- play_sound(x, y, SAMPLE_eater);
+ play_element_sound(x, y, SAMPLE_eater, Xdiamond);
goto loop;
}
{
Cave[y][x+1] = Ydiamond_eat;
Next[y][x+1] = Xblank;
- play_sound(x, y, SAMPLE_eater);
+ play_element_sound(x, y, SAMPLE_eater, Xdiamond);
goto loop;
}
{
Cave[y+1][x] = Ydiamond_eat;
Next[y+1][x] = Xblank;
- play_sound(x, y, SAMPLE_eater);
+ play_element_sound(x, y, SAMPLE_eater, Xdiamond);
goto loop;
}
{
Cave[y][x-1] = Ydiamond_eat;
Next[y][x-1] = Xblank;
- play_sound(x, y, SAMPLE_eater);
+ play_element_sound(x, y, SAMPLE_eater, Xdiamond);
goto loop;
}
}
Next[y][x] = Xblank;
- play_sound(x, y, SAMPLE_squash);
+ play_element_sound(x, y, SAMPLE_wonderfall, Xemerald);
goto loop;
}
default:
Cave[y][x] = Xemerald;
Next[y][x] = Xemerald;
- play_sound(x, y, SAMPLE_diamond);
+ play_element_sound(x, y, SAMPLE_diamond, Xemerald);
goto loop;
}
}
Next[y][x] = Xblank;
- play_sound(x, y, SAMPLE_squash);
+ play_element_sound(x, y, SAMPLE_wonderfall, Xdiamond);
goto loop;
}
default:
Cave[y][x] = Xdiamond;
Next[y][x] = Xdiamond;
- play_sound(x, y, SAMPLE_diamond);
+ play_element_sound(x, y, SAMPLE_diamond, Xdiamond);
goto loop;
}
ball_common:
- play_sound(x, y, SAMPLE_ball);
+ play_element_sound(x, y, SAMPLE_ball, element);
if (lev.ball_random)
{
switch (RANDOM & 7)