From 87d70bb986a9c6010a00be0ac1f38a37cbffb555 Mon Sep 17 00:00:00 2001 From: stevenhowes <38082088+stevenhowes@users.noreply.github.com> Date: Fri, 26 Mar 2021 20:10:17 +0000 Subject: [PATCH] A3000/RO3 compatibility. Sprites need re-draw. Real hardware available - very little worked. Moving to mode 15 --- !Run,feb | 10 +++---- !RunImage,ff8 | Bin 14784 -> 15164 bytes !Sprites,ff9 | Bin 736 -> 736 bytes !Sprites22,ff9 | Bin 1892 -> 1892 bytes Makefile,fe1 | 2 +- Spr,ff9 | Bin 79376 -> 80892 bytes c/CTheEscape | 76 +++++++++++++++++++++++++++---------------------- c/Graphics | 53 +++++++++++++++++++++++----------- 8 files changed, 84 insertions(+), 57 deletions(-) diff --git a/!Run,feb b/!Run,feb index b5bada1..9ab2418 100644 --- a/!Run,feb +++ b/!Run,feb @@ -1,5 +1,5 @@ -Set TheEscape$Dir -IconSprites .!Sprites -WimpSlot -min 512k -max 512k -Dir -Run .!RunImage \ No newline at end of file +Set TheEsc$Dir +IconSprites .!Sprites +WimpSlot -min 128k -max 128k +Dir +Run .!RunImage \ No newline at end of file diff --git a/!RunImage,ff8 b/!RunImage,ff8 index e663ed79fa9e8a413cdc5e0ecc1fe51cc645b96f..04450d2b49de77273e1fe0a9c19899798bb8c2bc 100644 GIT binary patch delta 4689 zcmZ8k3v^RO8lHQTv}qnRC2eW?x@k+_57NgX3PMW(fl>$sM0seD7RoM^T3QxdwXLLp zE?{BWitD2n*9RUVm5M?{n!{uK<1$ zcn^3Hd^z|_;5Fb&!CwH+@%MtS;d11&-fPq&SR?8neFEtU-6LAfiy)mYm6bEluz>wR zu7PwZV6TE?n=UKIpg9+?Plcur(uV;%kJ~*%R^EZ;RKPwOnl~Z!2ka$~iZK2SX!Zx} zdC+W!v?pLshja_$pND1_x0{ooslbSB(Cpxts2FG-0!FBCd7puHJICdlplw9vVbfgR zC!u{7GO^1Z%-T~iPF6G)5OjZlZ6n>PvCg?;AijGrA{--DLE92CBH97}81Wx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GE!5ElYt@(8>OpQnSu1?8LVd*0mFw03IG5A delta 45 ycmaFD_k>THiGhJZ0Ejc#85n9<85k6kOEOYZi<1)zQa4Ihu`&bc%`;ffFaiMNj0@QS diff --git a/Makefile,fe1 b/Makefile,fe1 index 8da425f..5effb70 100644 --- a/Makefile,fe1 +++ b/Makefile,fe1 @@ -1,4 +1,4 @@ -# Project: CTheEscape +# Project: TheEsc # Toolflags: diff --git a/Spr,ff9 b/Spr,ff9 index 829679f83e7aab333099ddf9588c6bef60aa70b1..4f02497b0c5a88708d3b1852bf2cb70fd4410f4e 100644 GIT binary patch delta 527 zcmbR6hUL$97A^?}1_l8jX0X}FWyHdrlUSKr6knW?S-{Zj&a&N|h4G}J<{MT9h5{rR zcA#=TkRBl52Vxy21_mA$AbWD-!RGA?j2W95CznK6PwtQ4V-o>`$@8Pc>LE-R`5y`x z7$6LoID&?V6DN<*h0Fq(0MQQ=MYA8Q4n+a7PAD58|NlRxG)NX^0bzLobS0DDM~WfB zM+X>O3X?xrDok(CV^o-KAi&5sollyPZTcDkMxN<4I*eS?v!xh$C;#*3o_uko9Mk{* pAZqdfJ{h1U7IYda4W*_hN->IqbWUfIW)y;(C@@J<0Bjpj833XdwB7&! delta 34 ocmezKon^us7A|oH1_l8j7BSn%WyCVMW;%DXJIi)=7RHl?0ITH*U;qFB diff --git a/c/CTheEscape b/c/CTheEscape index 0646e35..371a787 100644 --- a/c/CTheEscape +++ b/c/CTheEscape @@ -10,13 +10,13 @@ _kernel_swi_regs outreg; // Sprite buffer unsigned char *buffer; - +extern int screen; extern struct CompositionElement composition[128]; extern int current_element; -#define DISPLAY_MODE 28 +#define DISPLAY_MODE 15 #define DISPLAY_X 1280 -#define DISPLAY_Y 960 +#define DISPLAY_Y 1024 #define PLAYER_Y_START 100 #define PLAYER_X_SPEED 10 @@ -25,8 +25,8 @@ extern int current_element; #define MAX_PROJECTILES 10 enum sprite_e{player_ship, durno_ship, ship_trgt, durno_ship2, ship2_trgt, player_shipl,player_shipr,explode_start,explode_shp2,explode_shp3,explode_shp4,explode_shp5,explode_shp6,explode_shp7,explode_end,photon1,photon2,plasma1,plasma2}; +//char *sprites[] = {"player_ship","durno_ship","ship_trgt","durno_ship2","ship2_trgt","player_shipl","player_shipr","explode_shp1","explode_shp2","explode_shp3","explode_shp4","explode_shp5","explode_shp6","explode_shp7","explode_shp8","photon1","photon2","plasma1","plasma2"}; char *sprites[] = {"player_ship","durno_ship","ship_trgt","durno_ship2","ship2_trgt","player_shipl","player_shipr","explode_shp1","explode_shp2","explode_shp3","explode_shp4","explode_shp5","explode_shp6","explode_shp7","explode_shp8","photon1","photon2","plasma1","plasma2"}; - char hudbuffer[63]; enum font_e{sys_12_8,font_max}; @@ -340,36 +340,40 @@ void game_draw_npcs() int i; for(i = 0; i < MAX_NPCS; i++) { - draw_sprite(sprites[NPCS[i].sprite], NPCS[i].location.X, NPCS[i].location.Y); - - // Next sprite up in index is the appropriate target icon - if(Player.targetleft == i) - draw_sprite(sprites[NPCS[i].sprite + 1], NPCS[i].location.X, NPCS[i].location.Y); - if(Player.targetright == i) - draw_sprite(sprites[NPCS[i].sprite + 1], NPCS[i].location.X, NPCS[i].location.Y); - - if(tick > NPCS[i].explodenextframe) + // Don't bother if they are off the screen + if(NPCS[i].location.Y < DISPLAY_Y) { - if((NPCS[i].sprite >= explode_start) && (NPCS[i].sprite <= explode_end)) + draw_sprite(sprites[NPCS[i].sprite], NPCS[i].location.X, NPCS[i].location.Y); + + // Next sprite up in index is the appropriate target icon + if(Player.targetleft == i) + draw_sprite(sprites[NPCS[i].sprite + 1], NPCS[i].location.X, NPCS[i].location.Y); + if(Player.targetright == i) + draw_sprite(sprites[NPCS[i].sprite + 1], NPCS[i].location.X, NPCS[i].location.Y); + + if(tick > NPCS[i].explodenextframe) { - NPCS[i].sprite++; - if(NPCS[i].sprite > explode_end) - game_respawn_npc(i); + if((NPCS[i].sprite >= explode_start) && (NPCS[i].sprite <= explode_end)) + { + NPCS[i].sprite++; + if(NPCS[i].sprite > explode_end) + game_respawn_npc(i); + } + NPCS[i].explodenextframe = tick + 4; } - NPCS[i].explodenextframe = tick + 4; - } - - if(debugs[dbhitbox]) - { - graphics_colour(colours[debugpink]); + + if(debugs[dbhitbox]) + { + graphics_colour(colours[debugpink]); - // Bounding box debug - draw_rectangle( - NPCS[i].location.X + NPCS[i].hitbox_bl.X, - NPCS[i].location.Y + NPCS[i].hitbox_bl.Y, - NPCS[i].location.X + NPCS[i].hitbox_tr.X, - NPCS[i].location.Y + NPCS[i].hitbox_tr.Y - ); + // Bounding box debug + draw_rectangle( + NPCS[i].location.X + NPCS[i].hitbox_bl.X, + NPCS[i].location.Y + NPCS[i].hitbox_bl.Y, + NPCS[i].location.X + NPCS[i].hitbox_tr.X, + NPCS[i].location.Y + NPCS[i].hitbox_tr.Y + ); + } } } } @@ -596,7 +600,7 @@ void game_draw_debugmenu() if(debugs[dbperformance]) { font_colour(colours[debuggreen],colours[lcars_black],font[sys_12_8]); - sprintf(hudbuffer,"Cents per frame: %i",(tick-lasttick)); + sprintf(hudbuffer,"CPF: %i",(tick-lasttick)); draw_text(hudbuffer,DISPLAY_X-500,DISPLAY_Y-60,font[sys_12_8]); } @@ -950,6 +954,7 @@ void game_tick() { lasttick = tick; tick = clock(); + screen_flipbuffer(); screen_clear(); @@ -976,14 +981,17 @@ int main(int argc, char *argv[]) sound_on(); display_mode(DISPLAY_MODE); + + screen_clear(); + load_sprites("Spr"); + font[sys_12_8] = font_find("Trinity.Medium",12,8); intro(); display_mode(DISPLAY_MODE); - - font[sys_12_8] = font_find("System.Medium",12,8); - + screen_clear(); + game_setup(); while(Player.integrity > 0) diff --git a/c/Graphics b/c/Graphics index ef4046a..33aea88 100644 --- a/c/Graphics +++ b/c/Graphics @@ -7,7 +7,7 @@ extern _kernel_swi_regs inreg; extern _kernel_swi_regs outreg; extern unsigned char *buffer; -unsigned char screen = 1; +int screen = 1; // Loads sprite file into buffer void load_sprites(char* filename) @@ -61,9 +61,30 @@ void load_sprites(char* filename) void display_mode(int mode) { - inreg.r[0] = 0; - inreg.r[1] = mode; - _kernel_swi(OS_ScreenMode,&inreg,&outreg); + int pitch; + int height=256; // TODO: This shouldn't be here! + + // OS_ScreenMode doesn't seem to work in 3.10 + inreg.r[0] = 22; + _kernel_swi(OS_WriteC,&inreg,&outreg); + inreg.r[0] = mode; + _kernel_swi(OS_WriteC,&inreg,&outreg); + + // The SDL library does this if double buffering is enabled - seems + // to be what makes it work - although other examples dont have this + inreg.r[0] = -1; + inreg.r[1] = 6; + _kernel_swi(OS_ReadModeVariable, &inreg, &outreg); + pitch = outreg.r[2]; + + inreg.r[0] = 2; /* Screen area */ + _kernel_swi(OS_ReadDynamicArea, &inreg, &outreg); + inreg.r[1] = (pitch * height * 2) - outreg.r[1]; + if (_kernel_swi(OS_ChangeDynamicArea, &inreg, &outreg) != NULL) + { + printf("Couldn't OS_ChangeDynamicArea"); + exit(0); + } } void draw_dotted_line(int x1,int y1,int x2,int y2) @@ -157,23 +178,21 @@ void graphics_colour(int setcolour) } void screen_flipbuffer() { - inreg.r[0] = 19; - _kernel_swi(OS_Byte,&inreg,&outreg); - -/* inreg.r[0] = 114; - inreg.r[1] = 1; + // Hardware + inreg.r[0] = 113; + inreg.r[1] = screen+1; _kernel_swi(OS_Byte,&inreg,&outreg); - inreg.r[0] = 113; - inreg.r[1] = screen; + screen ^= 1; + + // Drivers + inreg.r[0] = 112; + inreg.r[1] = screen+1; + _kernel_swi(OS_Byte,&inreg,&outreg); + + inreg.r[0] = 19; _kernel_swi(OS_Byte,&inreg,&outreg); - screen++; - if(screen > 3) - screen = 1; - inreg.r[0] = 112; - inreg.r[1] = screen; - _kernel_swi(OS_Byte,&inreg,&outreg);*/ } void screen_clear()