Tidy up of tabbing, addition of key scanning (and ability to skip intro)

This commit is contained in:
stevenhowes
2021-03-19 20:49:38 +00:00
parent 3946f245c7
commit dac8e5fd32
5 changed files with 67 additions and 32 deletions
BIN
View File
Binary file not shown.
+12 -8
View File
@@ -7,8 +7,8 @@ Linkflags = -aif -o $@
# Final targets:
@.!RunImage: @.o.CTheEscape @.o.Graphics @.o.Sound C:o.stubs
Link $(Linkflags) @.o.CTheEscape @.o.Graphics @.o.Sound C:o.stubs
@.!RunImage: @.o.CTheEscape @.o.Graphics @.o.Sound @.o.Input C:o.stubs
Link $(Linkflags) @.o.CTheEscape @.o.Graphics @.o.Sound @.o.Input C:o.stubs
# User-editable dependencies:
@@ -21,7 +21,8 @@ Linkflags = -aif -o $@
cc $(ccflags) -o @.o.Graphics @.c.Graphics
@.o.Sound: @.c.Sound
cc $(ccflags) -o @.o.Sound @.c.Sound
@.o.Input: @.c.Input
cc $(ccflags) -o @.o.Input @.c.Input
# Dynamic dependencies:
o.Graphics: c.Graphics
@@ -38,8 +39,11 @@ o.CTheEscape: C:h.swis
o.CTheEscape: C:h.kernel
o.CTheEscape: C:h.kernel
o.CTheEscape: h.Sound
o.CTheEscape: c.CTheEscape
o.CTheEscape: C:h.swis
o.CTheEscape: C:h.kernel
o.CTheEscape: C:h.kernel
o.CTheEscape: h.Sound
o.Input: c.Input
o.Input: C:h.swis
o.Input: C:h.kernel
o.Input: C:h.kernel
o.Input: c.Input
o.Input: C:h.swis
o.Input: C:h.kernel
o.Input: C:h.kernel
+5 -1
View File
@@ -78,11 +78,15 @@ void intro()
currentstart += 100;
draw_sprite("tng",320,400);
printf("%i elements at %i bytes\n",current_element,sizeof(composition[0]));
sound_composition_start(clock());
while(sound_composition_incomplete())
{
sound_composition_tick(clock());
if(input_readkey(98))
sound_composition_stop();
}
}
int main(int argc, char *argv[])
+20
View File
@@ -0,0 +1,20 @@
#include <stdio.h>
#include "swis.h"
#include <kernel.h>
// SWI Registers
extern _kernel_swi_regs inreg;
extern _kernel_swi_regs outreg;
int input_readkey(int key)
{
inreg.r[0] = 129;
inreg.r[1] = key ^ 255;
inreg.r[2] = 255;
_kernel_swi(OS_Byte,&inreg,&outreg);
if(outreg.r[1] == 255)
return 1;
return 0;
}
+7
View File
@@ -86,6 +86,8 @@ void sound_composition_debug()
}
}
printf("%i elements at %i bytes each\n",current_element,sizeof(composition[0]));
printf("------------------------------\n");
}
@@ -94,6 +96,11 @@ void sound_composition_start(int cent)
composition_startcent = cent;
}
void sound_composition_stop()
{
current_playback_element = COMPOSITION_MAX;
}
void sound_composition_tick(int cents)
{
int offset_cents = cents - composition_startcent;