Some prep for mission 2 and mission re-attempts/success

This commit is contained in:
stevenhowes
2021-03-28 22:48:32 +01:00
parent 9bbfe852a5
commit 8eba8f14e9
6 changed files with 164 additions and 12 deletions
Binary file not shown.
+7 -2
View File
@@ -7,8 +7,8 @@ Linkflags = -aif -o $@
# Final targets:
@.!RunImage: @.o.CTheEscape @.o.Graphics @.o.Sound @.o.Input @.o.Intro @.o.Mission1 C:o.stubs
Link $(Linkflags) @.o.CTheEscape @.o.Graphics @.o.Sound @.o.Input @.o.Intro @.o.Mission1 C:o.stubs
@.!RunImage: @.o.CTheEscape @.o.Graphics @.o.Sound @.o.Input @.o.Intro @.o.Mission1 @.o.Mission2 C:o.stubs
Link $(Linkflags) @.o.CTheEscape @.o.Graphics @.o.Sound @.o.Input @.o.Intro @.o.Mission1 @.o.Mission2 C:o.stubs
# User-editable dependencies:
@@ -27,6 +27,9 @@ Linkflags = -aif -o $@
cc $(ccflags) -o @.o.Intro @.c.Intro
@.o.Mission1: @.c.Mission1
cc $(ccflags) -o @.o.Mission1 @.c.Mission1
@.o.Mission2: @.c.Mission2
cc $(ccflags) -o @.o.Mission2 @.c.Mission2
# Dynamic dependencies:
@@ -59,3 +62,5 @@ o.Intro: c.Intro
o.Intro: h.Graphics
o.Mission1: c.Mission1
o.Mission1: h.Graphics
o.Mission2: c.Mission2
o.Mission2: h.Graphics
+27 -4
View File
@@ -36,7 +36,8 @@ 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;
int lastoutcome = 1;
int outcome = 0;
sound_on();
// Set initial display mode
@@ -49,17 +50,39 @@ int main(int argc, char *argv[])
// Intro titles + music
intro();
screen_flipbuffer();
screen_clear();
// Mission 1
while(lastoutcome == 1)
{
outcome = 0;
game1_briefing();
screen_clear();
game1_setup();
while(!lastoutcome)
while(!outcome)
{
lastoutcome = game1_tick();
outcome = game1_tick();
}
lastoutcome = outcome;
}
lastoutcome = 1;
// Mission 2
while(lastoutcome == 1)
{
outcome = 0;
game2_briefing();
screen_clear();
//game2_setup();
while(!outcome)
{
outcome = game2_tick();
}
lastoutcome = outcome;
}
free(buffer);
+9 -2
View File
@@ -724,7 +724,8 @@ void game_tick_input()
// Q
if(input_readkey(16))
debugs[dbbase] = 1;
Player.integrity = 1000;
// debugs[dbbase] = 1;
if(tick > Player.nextidlesprite)
Player.sprite = Player.idlesprite;
@@ -893,6 +894,8 @@ void game1_briefing()
draw_sprite("spacebar",(DISPLAY_X/2)-106,50);
screen_flipbuffer();
tick = clock();
while(1)
{
@@ -912,7 +915,11 @@ int game1_tick()
screen_flipbuffer();
screen_clear();
if(Player.integrity > 0)
if(Player.integrity > 200)
{
return 2;
}
else if(Player.integrity > 0)
{
PROFILE(game_tick_stars());
PROFILE(game_tick_input());
+117
View File
@@ -0,0 +1,117 @@
#include "Graphics.h"
//#defene PROFILE(X) lastprofile = clock(); X; printf("\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t%s %i\n", #X, (clock() - lastprofile))
#define PROFILE(X) X
extern int tick;
extern int lasttick;
void game2_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 + 100))
{
if(input_readkey(98))
sound_composition_stop();
}
}
}
void game2_briefing()
{
screen_clear();
draw_spritetext(
"~~~~~~~~{chief engineers log - uss archimedes - stardate 1234567890 ~~==========~~===============}\n\n\nYour mission is to be dead until I make mission 2. \n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n~~~~~~~~{==========================================~~~~~~~~=======}"
, 50, 950);
draw_sprite("spacebar",(DISPLAY_X/2)-106,50);
screen_flipbuffer();
tick = clock();
while(1)
{
if(clock() > (tick + 100))
{
if(input_readkey(98))
return;
}
}
}
int game2_tick()
{
lasttick = tick;
tick = clock();
screen_flipbuffer();
screen_clear();
if(0)
{
return 0;
}else{
screen_flipbuffer();
screen_clear();
game2_death();
return 1;
}
}
+1 -1
View File
@@ -20,7 +20,7 @@ Left Arrow: Left
Right Arrow: Right
Q: Display debug info (then numbers to select debug action) - Currently non-functioning
Q: Skip level (will be removed)
Space Bar: Fire phasers