From ce042dbefd9fb685b76dcd829554d1c71b1cb2d5 Mon Sep 17 00:00:00 2001 From: stevenhowes <38082088+stevenhowes@users.noreply.github.com> Date: Sat, 20 Mar 2021 17:47:49 +0000 Subject: [PATCH] Phaser locations, debug framework --- !RunImage,ff8 | Bin 7500 -> 8480 bytes Makefile,fe1 | 16 ++++---- c/CTheEscape | 110 +++++++++++++++++++++++++++++++++++++++++++++----- c/Input | 10 +++++ 4 files changed, 118 insertions(+), 18 deletions(-) diff --git a/!RunImage,ff8 b/!RunImage,ff8 index b93a85ca4d1007185849418a2c1796ae3e814d9a..a528296a6fe281665537fbb2af614a59001edb8b 100644 GIT binary patch delta 3437 zcmZu!3s6+o8UD{cU>6s-z@q2^dn1aH7+AGNW=nb4s2O<#tu@5>f;i(Z zon(L>L^7e_Sj{xrM>HxkmbA51JEn~@PMg@!q$9hxCk<>frENN`c9ebx?j~EBo%!dU z^MBv}IRE+2xp&|3i)Ay3L{N!~C|n;y;UuEJ3NKM}*UZ7d-(zTyiiKe#VcfA%__ntr z#4u)d3V(>P1>^hB4`FP@_&*rm!dUVDjqxn-ZY6ev&frP92tpsc?t{H1j7;cm0y{Yc zvjCd`-SuJ-Fy02?l_>;eoCw_&VBJ$NW$b`%W`!``0{-F@T-g$I1Hjs+V9Hi4vgdJO zyaD`>J@Efo{|$uG0QY}^@hGrG2>db0+Bsapbg-g0R3dL;6R8DfK@`Uhj!IU5lUXi|O~B_w z;gR0x1^y+q{}!xf9Y~%i(jwDI2T0E#8O2!zPI43{(@f?FIBh0pIXKQJPQ=e4a0X1y zQgBp%OfEbif{LU{w-=<3O;R36|H3>{omy~I>2^Rj7ueVoOjWKHx@=%GbA@5g5XMO> zg_q#CU4%YH1tg!Lz5bNb2i?!0t06SG%LLxAk>?(N(ssC_>HUXCY-h_takMe`iJb=f zlKN#|Nx!sFw}E%NGet;2S`Ib^5e&_68yn?QEN*%u@*CxS&KU?}^D9tmVm zP2e+Zfe6mg&DA)XKTDvg-ZS!B3ypr-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( diff --git a/Makefile,fe1 b/Makefile,fe1 index ced36f4..02ad35f 100644 --- a/Makefile,fe1 +++ b/Makefile,fe1 @@ -30,14 +30,6 @@ o.Sound: C:h.swis o.Sound: C:h.kernel o.Sound: C:h.kernel o.Sound: 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 o.Graphics: c.Graphics o.Graphics: C:h.swis o.Graphics: C:h.kernel @@ -46,6 +38,14 @@ o.Graphics: c.Graphics o.Graphics: C:h.swis o.Graphics: C:h.kernel o.Graphics: C:h.kernel +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 o.CTheEscape: c.CTheEscape o.CTheEscape: C:h.swis o.CTheEscape: C:h.kernel diff --git a/c/CTheEscape b/c/CTheEscape index 774b859..2feec59 100644 --- a/c/CTheEscape +++ b/c/CTheEscape @@ -30,10 +30,13 @@ char hudbuffer[63]; enum font_e{sys_12_8,font_max}; -enum colour_e{lcars_black,lcars_violet1,hotpink,stargrey1,stargrey2,stargrey3}; -int colours[] = {0x11111100,0xc4727200,0xcc00ff00,0x66666600,0x22222200,0x44444400}; +enum colour_e{lcars_black,lcars_violet1,debugpink,stargrey1,stargrey2,stargrey3,debuggreen}; +int colours[] = {0x11111100,0xc4727200,0xcc00ff00,0x66666600,0x22222200,0x44444400,0x00ff0000}; int font[font_max]; +enum debugs_e{dbbase,dbhitbox,dbweapons,dbinput,dbmax}; +int debugs[dbmax]; + struct EntityLocation_s { short int X,Y; }; @@ -60,6 +63,8 @@ struct Player_s { int remainingdistance; struct EntityLocation_s hitbox_bl; struct EntityLocation_s hitbox_tr; + struct EntityLocation_s phaser1; + struct EntityLocation_s phaser2; }; struct NPC_s NPCS[MAX_NPCS]; @@ -148,15 +153,49 @@ void game_draw_player() { draw_sprite(sprites[Player.sprite], Player.location.X, Player.location.Y); - graphics_colour(colours[hotpink]); + if(debugs[dbhitbox]) + { + graphics_colour(colours[debugpink]); - // Bounding box debug - draw_rectangle( - Player.location.X + Player.hitbox_bl.X, - Player.location.Y + Player.hitbox_bl.Y, - Player.location.X + Player.hitbox_tr.X, - Player.location.Y + Player.hitbox_tr.Y - ); + // Bounding box debug + draw_rectangle( + Player.location.X + Player.hitbox_bl.X, + Player.location.Y + Player.hitbox_bl.Y, + Player.location.X + Player.hitbox_tr.X, + Player.location.Y + Player.hitbox_tr.Y + ); + } + + if(debugs[dbweapons]) + { + graphics_colour(colours[debuggreen]); + + // Draw phaser banks + draw_line( + Player.location.X + Player.phaser1.X, + Player.location.Y + Player.phaser1.Y -5, + Player.location.X + Player.phaser1.X, + Player.location.Y + Player.phaser1.Y + 5 + ); + draw_line( + Player.location.X + Player.phaser1.X -5, + Player.location.Y + Player.phaser1.Y, + Player.location.X + Player.phaser1.X +5, + Player.location.Y + Player.phaser1.Y + ); + draw_line( + Player.location.X + Player.phaser2.X, + Player.location.Y + Player.phaser2.Y -5, + Player.location.X + Player.phaser2.X, + Player.location.Y + Player.phaser2.Y + 5 + ); + draw_line( + Player.location.X + Player.phaser2.X -5, + Player.location.Y + Player.phaser2.Y, + Player.location.X + Player.phaser2.X +5, + Player.location.Y + Player.phaser2.Y + ); + } } void game_draw_stars() { @@ -184,6 +223,11 @@ void game_setup_player() Player.hitbox_bl.Y = 0; Player.hitbox_tr.X = 60; Player.hitbox_tr.Y = 81; + Player.phaser1.X = 20; + Player.phaser1.Y = 75; + Player.phaser2.X = 41; + Player.phaser2.Y = 75; + } void game_tick_stars() @@ -223,8 +267,53 @@ void game_setup_input() */ } +void game_draw_debugmenu() +{ + if(debugs[dbbase]) + { + font_colour(colours[debuggreen],colours[lcars_black],font[sys_12_8]); + draw_text("Debug List",DISPLAY_X-200,DISPLAY_Y-40,font[sys_12_8]); + font_colour(colours[debugs[dbhitbox]?debugpink:stargrey1],colours[lcars_black],font[sys_12_8]); + draw_text("1: hitbox",DISPLAY_X-200,DISPLAY_Y-60,font[sys_12_8]); + font_colour(colours[debugs[dbweapons]?debugpink:stargrey1],colours[lcars_black],font[sys_12_8]); + draw_text("2: weapons",DISPLAY_X-200,DISPLAY_Y-80,font[sys_12_8]); + font_colour(colours[debugs[dbinput]?debugpink:stargrey1],colours[lcars_black],font[sys_12_8]); + draw_text("3: input",DISPLAY_X-200,DISPLAY_Y-100,font[sys_12_8]); + } +} + void game_input_tick() { + if(debugs[dbbase]) + { + if(input_readkey(17)) + { + debugs[dbinput] = 1; + } + + if(input_readkey(48)) + { + debugs[dbhitbox] = 1; + } + + if(input_readkey(49)) + { + debugs[dbweapons] = 1; + } + } + + if(debugs[dbinput]) + { + font_colour(colours[debuggreen],colours[lcars_black],font[sys_12_8]); + sprintf(hudbuffer,"Keycode: %i",input_readanykey()); + draw_text(hudbuffer,DISPLAY_X-500,DISPLAY_Y-40,font[sys_12_8]); + } + + if(input_readkey(16)) + { + debugs[dbbase] = 1; + } + // Right arrow if(input_readkey(121)) { @@ -317,6 +406,7 @@ void game_tick() game_draw_player(); game_draw_hud(); + game_draw_debugmenu(); } int main(int argc, char *argv[]) diff --git a/c/Input b/c/Input index 40285b2..6e806c0 100644 --- a/c/Input +++ b/c/Input @@ -18,3 +18,13 @@ int input_readkey(int key) return 0; } + +int input_readanykey() +{ + inreg.r[0] = 129; + inreg.r[1] = 123 + 255; + inreg.r[2] = 255; + _kernel_swi(OS_Byte,&inreg,&outreg); + + return outreg.r[1]; +}