mirror of
https://github.com/stevenhowes/CTheEscape.git
synced 2026-05-26 15:53:29 +01:00
Some sound fixes (allow more than one composition) and death screen handling
This commit is contained in:
Binary file not shown.
Binary file not shown.
+11
-9
@@ -21,6 +21,7 @@ int lasttick = 0;
|
||||
extern int screen;
|
||||
|
||||
extern int game1_tick();
|
||||
extern void game1_setup();
|
||||
|
||||
int game_hitbox_collide(int x1, int y1, int w1, int h1, int x2, int y2, int w2, int h2)
|
||||
{
|
||||
@@ -35,26 +36,27 @@ int game_hitbox_collide(int x1, int y1, int w1, int h1, int x2, int y2, int w2,
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
int lastoutcome = 0;
|
||||
sound_on();
|
||||
|
||||
// Set initial display mode
|
||||
display_mode(DISPLAY_MODE);
|
||||
|
||||
screen_clear();
|
||||
|
||||
// Load sprite library
|
||||
load_sprites("Spr");
|
||||
|
||||
// Intro titles + music
|
||||
intro();
|
||||
|
||||
display_mode(DISPLAY_MODE);
|
||||
screen_clear();
|
||||
|
||||
game_setup();
|
||||
|
||||
while(game1_tick());
|
||||
|
||||
screen_clear();
|
||||
printf("you ded\n");
|
||||
screen_flipbuffer();
|
||||
// Mission 1
|
||||
game1_setup();
|
||||
while(!lastoutcome)
|
||||
{
|
||||
lastoutcome = game1_tick();
|
||||
}
|
||||
|
||||
free(buffer);
|
||||
|
||||
|
||||
+78
-5
@@ -782,7 +782,7 @@ void game_draw_hud()
|
||||
draw_sprite("pointer",141+(Player.remainingdistance/7500),DISPLAY_Y - 164 + 4);
|
||||
}
|
||||
|
||||
void game_setup()
|
||||
void game1_setup()
|
||||
{
|
||||
game_setup_input();
|
||||
game_setup_audio();
|
||||
@@ -816,6 +816,73 @@ void game_tick_player()
|
||||
}
|
||||
}
|
||||
|
||||
void game1_death()
|
||||
{
|
||||
int currentstart = 0;
|
||||
int introframe = 0;
|
||||
sound_voices(4);
|
||||
|
||||
sound_set_voice(1,"WaveSynth-Beep");
|
||||
sound_set_voice(2,"WaveSynth-Beep");
|
||||
sound_set_voice(3,"WaveSynth-Beep");
|
||||
sound_set_voice(4,"WaveSynth-Beep");
|
||||
sound_composition_init();
|
||||
|
||||
currentstart += 100;
|
||||
sound_composition_element_add(currentstart,1,sound_note("D2"),150);
|
||||
currentstart += 100;
|
||||
sound_composition_element_add(currentstart,2,sound_note("G2"),200);
|
||||
currentstart += 200;
|
||||
sound_composition_element_add(currentstart,3,sound_note("B3"),75);
|
||||
currentstart += 40;
|
||||
sound_composition_element_add(currentstart,4,sound_note("G2"),75);
|
||||
currentstart += 50;
|
||||
sound_composition_element_add(currentstart,2,sound_note("B3"),200);
|
||||
currentstart += 200;
|
||||
sound_composition_element_add(currentstart,1,sound_note("A3"),100);
|
||||
currentstart += 100;
|
||||
sound_composition_element_add(currentstart,3,sound_note("G2"),150);
|
||||
currentstart += 150;
|
||||
sound_composition_element_add(currentstart,2,sound_note("E2"),100);
|
||||
currentstart += 100;
|
||||
sound_composition_element_add(currentstart,1,sound_note("D2"),150);
|
||||
currentstart += 150;
|
||||
sound_composition_element_add(currentstart,3,sound_note("D2"),150);
|
||||
currentstart += 100;
|
||||
sound_composition_element_add(currentstart,4,sound_note("G2"),150);
|
||||
currentstart += 150;
|
||||
sound_composition_element_add(currentstart,1,sound_note("B3"),75);
|
||||
currentstart += 40;
|
||||
sound_composition_element_add(currentstart,2,sound_note("G2"),75);
|
||||
currentstart += 40;
|
||||
sound_composition_element_add(currentstart,3,sound_note("B3"),150);
|
||||
currentstart += 150;
|
||||
sound_composition_element_add(currentstart,4,sound_note("A3"),130);
|
||||
currentstart += 100;
|
||||
sound_composition_element_add(currentstart,1,sound_note("G2"),200);
|
||||
currentstart += 300;
|
||||
tick = clock();
|
||||
|
||||
sound_composition_start(clock());
|
||||
|
||||
draw_sprite("spacebar",(DISPLAY_X/2)-106,50);
|
||||
draw_sprite("kia",(DISPLAY_X/2)-300,500);
|
||||
|
||||
screen_flipbuffer();
|
||||
|
||||
while(sound_composition_incomplete())
|
||||
{
|
||||
sound_composition_tick(clock());
|
||||
|
||||
if(clock() > (tick + 200))
|
||||
{
|
||||
if(input_readkey(98))
|
||||
sound_composition_stop();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
int game1_tick()
|
||||
{
|
||||
lasttick = tick;
|
||||
@@ -824,6 +891,8 @@ int game1_tick()
|
||||
screen_flipbuffer();
|
||||
screen_clear();
|
||||
|
||||
if(Player.integrity > 0)
|
||||
{
|
||||
PROFILE(game_tick_stars());
|
||||
PROFILE(game_tick_input());
|
||||
PROFILE(game_tick_player());
|
||||
@@ -839,9 +908,13 @@ int game1_tick()
|
||||
|
||||
PROFILE(game_draw_hud());
|
||||
PROFILE(game_draw_debugmenu());
|
||||
|
||||
if(Player.integrity > 0)
|
||||
return 1;
|
||||
else
|
||||
return 0;
|
||||
}else{
|
||||
screen_flipbuffer();
|
||||
screen_clear();
|
||||
game1_death();
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -61,6 +61,7 @@ void sound_composition_init()
|
||||
{
|
||||
composition[i].Start = -1;
|
||||
}
|
||||
current_element = 0;
|
||||
}
|
||||
|
||||
void sound_composition_element_add(int start, int channel, int note, int length)
|
||||
@@ -101,6 +102,7 @@ void sound_composition_debug()
|
||||
void sound_composition_start(int cent)
|
||||
{
|
||||
composition_startcent = cent;
|
||||
current_playback_element = 0;
|
||||
}
|
||||
|
||||
void sound_composition_stop()
|
||||
|
||||
Reference in New Issue
Block a user