From dac8e5fd32c7fa11a9cd926935e15c5cde34453b Mon Sep 17 00:00:00 2001 From: stevenhowes <38082088+stevenhowes@users.noreply.github.com> Date: Fri, 19 Mar 2021 20:49:38 +0000 Subject: [PATCH] Tidy up of tabbing, addition of key scanning (and ability to skip intro) --- !RunImage,ff8 | Bin 4520 -> 4664 bytes Makefile,fe1 | 20 +++++++++++-------- c/CTheEscape | 6 +++++- c/Input | 20 +++++++++++++++++++ c/Sound | 53 ++++++++++++++++++++++++++++---------------------- 5 files changed, 67 insertions(+), 32 deletions(-) create mode 100644 c/Input diff --git a/!RunImage,ff8 b/!RunImage,ff8 index 8e3a50b457d2d4ad7ba27e6a5e9f7433fbfb6971..95a74c37c371412de0be8c4e50c79cc5f46379b7 100644 GIT binary patch delta 1479 zcmZ8heQZ-z6hHU%wR^9l+R`mB$JWlt6ccD6TbLT92Fxz{*N~q< z{xxzJ@&V-6kSqU5$3VqRRQ#HRv!W? zSTC(hU@EfuSun#uE3&#;Pu~;LItQjKtG@x}EKo@4CIhWP{V5(2L5>RD>;l8k{n`2? z&`s1I0b{6o->YD1P|*#BlxJ@{m?n5cO)|3&?4Q6CmTBxSeK`u=FRdNm+OQ8#Z8Eb5 zo?qvAYSu{01uX-elgO*Vl1##u-lrY~-r(r$P( zOjHf7xK3J4&_AE2&n@&(aOG&EVKYy`^D&pWf)$luw>s?OU`OUv7CYS|;F6B#F?in3 zR+fPscG%Tm)%DCB&MK#}2;79@iNGUy$Q5kK1G^OH*u083D%5fKz?DHOSRpNUk+j~y zn;gTNYyy8y`6+7oQ;p^*xEFx8khIjpQT!%Bg{PhT4_>Zs=6Cfa6$y<-j$xK1aJFOg zV0QJ=fBSoO+E4va;IIJu=Rw zyK}0{3;*d)=0pmxg{fFHWV@(yVqF-cU*hN4Z%aOr(<+keGa_1LFF#_e7q__Eh?t#% zMnc%tQ64j@+(BS zetw&mh!zJzwm~QDJ7xyc3EaqiB4p!cxYb-)^Z+`=o1y#rY*8QkUXS(J3EF7Qq#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=Ji71nt&c2s9lX=Xs*}%e7{!f z{8bO+T{Op2TB{$Ix)|&S*Jtt~7FkgvGkMv(p6R{#IxlM>@jQFn_bGo8?{sex&3wQe zz@Ize4rwo8D}zcPALI+}2HsP)M>{t|w4Nq9%b%CMs(6 +#include "swis.h" +#include + +// 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; +} diff --git a/c/Sound b/c/Sound index 50f09af..34f77fb 100644 --- a/c/Sound +++ b/c/Sound @@ -85,6 +85,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; @@ -103,35 +110,35 @@ void sound_composition_tick(int cents) { if(composition[i].Start <= offset_cents) { - if(composition[i].Start >= 0) - { + if(composition[i].Start >= 0) + { sound_composition_element_play(composition[i]); - current_playback_element = i + 1; - } + current_playback_element = i + 1; + } } } } int sound_note(char* note) { - int octave = note[1] - 48; - char *basenote = "ZZ"; - int index = 1; - int indexi = 0; - int len = sizeof(notes)/sizeof(notes[0]); - basenote[0] = note[0]; - if(strlen(note) == 3) - { - basenote[1] = '#'; - }else{ - basenote[1] = 'X'; - } - for(indexi = 0; indexi < len; indexi++) - { - if(strcmp(notes[indexi],basenote) == 0) - index = indexi; - } - return 41 + (4 * index) + ((octave - 2) * 48); + int octave = note[1] - 48; + char *basenote = "ZZ"; + int index = 1; + int indexi = 0; + int len = sizeof(notes)/sizeof(notes[0]); + basenote[0] = note[0]; + if(strlen(note) == 3) + { + basenote[1] = '#'; + }else{ + basenote[1] = 'X'; + } + for(indexi = 0; indexi < len; indexi++) + { + if(strcmp(notes[indexi],basenote) == 0) + index = indexi; + } + return 41 + (4 * index) + ((octave - 2) * 48); } int sound_composition_incomplete() @@ -140,4 +147,4 @@ int sound_composition_incomplete() return 0; else return 1; -} +}