mirror of
https://github.com/stevenhowes/CTheEscape.git
synced 2026-05-27 00:03:27 +01:00
A3000/RO3 compatibility. Sprites need re-draw.
Real hardware available - very little worked. Moving to mode 15
This commit is contained in:
@@ -1,5 +1,5 @@
|
|||||||
Set TheEscape$Dir <Obey$Dir>
|
Set TheEsc$Dir <Obey$Dir>
|
||||||
IconSprites <TheEscape$Dir>.!Sprites
|
IconSprites <TheEsc$Dir>.!Sprites
|
||||||
WimpSlot -min 512k -max 512k
|
WimpSlot -min 128k -max 128k
|
||||||
Dir <TheEscape$Dir>
|
Dir <TheEsc$Dir>
|
||||||
Run <TheEscape$Dir>.!RunImage
|
Run <TheEsc$Dir>.!RunImage
|
||||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
+1
-1
@@ -1,4 +1,4 @@
|
|||||||
# Project: CTheEscape
|
# Project: TheEsc
|
||||||
|
|
||||||
|
|
||||||
# Toolflags:
|
# Toolflags:
|
||||||
|
|||||||
+42
-34
@@ -10,13 +10,13 @@ _kernel_swi_regs outreg;
|
|||||||
|
|
||||||
// Sprite buffer
|
// Sprite buffer
|
||||||
unsigned char *buffer;
|
unsigned char *buffer;
|
||||||
|
extern int screen;
|
||||||
extern struct CompositionElement composition[128];
|
extern struct CompositionElement composition[128];
|
||||||
extern int current_element;
|
extern int current_element;
|
||||||
|
|
||||||
#define DISPLAY_MODE 28
|
#define DISPLAY_MODE 15
|
||||||
#define DISPLAY_X 1280
|
#define DISPLAY_X 1280
|
||||||
#define DISPLAY_Y 960
|
#define DISPLAY_Y 1024
|
||||||
|
|
||||||
#define PLAYER_Y_START 100
|
#define PLAYER_Y_START 100
|
||||||
#define PLAYER_X_SPEED 10
|
#define PLAYER_X_SPEED 10
|
||||||
@@ -25,8 +25,8 @@ extern int current_element;
|
|||||||
#define MAX_PROJECTILES 10
|
#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};
|
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 *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];
|
char hudbuffer[63];
|
||||||
|
|
||||||
enum font_e{sys_12_8,font_max};
|
enum font_e{sys_12_8,font_max};
|
||||||
@@ -340,36 +340,40 @@ void game_draw_npcs()
|
|||||||
int i;
|
int i;
|
||||||
for(i = 0; i < MAX_NPCS; i++)
|
for(i = 0; i < MAX_NPCS; i++)
|
||||||
{
|
{
|
||||||
draw_sprite(sprites[NPCS[i].sprite], NPCS[i].location.X, NPCS[i].location.Y);
|
// Don't bother if they are off the screen
|
||||||
|
if(NPCS[i].location.Y < DISPLAY_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)
|
|
||||||
{
|
{
|
||||||
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_start) && (NPCS[i].sprite <= explode_end))
|
||||||
if(NPCS[i].sprite > explode_end)
|
{
|
||||||
game_respawn_npc(i);
|
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])
|
||||||
|
{
|
||||||
if(debugs[dbhitbox])
|
graphics_colour(colours[debugpink]);
|
||||||
{
|
|
||||||
graphics_colour(colours[debugpink]);
|
|
||||||
|
|
||||||
// Bounding box debug
|
// Bounding box debug
|
||||||
draw_rectangle(
|
draw_rectangle(
|
||||||
NPCS[i].location.X + NPCS[i].hitbox_bl.X,
|
NPCS[i].location.X + NPCS[i].hitbox_bl.X,
|
||||||
NPCS[i].location.Y + NPCS[i].hitbox_bl.Y,
|
NPCS[i].location.Y + NPCS[i].hitbox_bl.Y,
|
||||||
NPCS[i].location.X + NPCS[i].hitbox_tr.X,
|
NPCS[i].location.X + NPCS[i].hitbox_tr.X,
|
||||||
NPCS[i].location.Y + NPCS[i].hitbox_tr.Y
|
NPCS[i].location.Y + NPCS[i].hitbox_tr.Y
|
||||||
);
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -596,7 +600,7 @@ void game_draw_debugmenu()
|
|||||||
if(debugs[dbperformance])
|
if(debugs[dbperformance])
|
||||||
{
|
{
|
||||||
font_colour(colours[debuggreen],colours[lcars_black],font[sys_12_8]);
|
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]);
|
draw_text(hudbuffer,DISPLAY_X-500,DISPLAY_Y-60,font[sys_12_8]);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -950,6 +954,7 @@ void game_tick()
|
|||||||
{
|
{
|
||||||
lasttick = tick;
|
lasttick = tick;
|
||||||
tick = clock();
|
tick = clock();
|
||||||
|
|
||||||
|
|
||||||
screen_flipbuffer();
|
screen_flipbuffer();
|
||||||
screen_clear();
|
screen_clear();
|
||||||
@@ -976,14 +981,17 @@ int main(int argc, char *argv[])
|
|||||||
sound_on();
|
sound_on();
|
||||||
|
|
||||||
display_mode(DISPLAY_MODE);
|
display_mode(DISPLAY_MODE);
|
||||||
|
|
||||||
|
screen_clear();
|
||||||
|
|
||||||
load_sprites("Spr");
|
load_sprites("Spr");
|
||||||
|
font[sys_12_8] = font_find("Trinity.Medium",12,8);
|
||||||
|
|
||||||
intro();
|
intro();
|
||||||
|
|
||||||
display_mode(DISPLAY_MODE);
|
display_mode(DISPLAY_MODE);
|
||||||
|
screen_clear();
|
||||||
font[sys_12_8] = font_find("System.Medium",12,8);
|
|
||||||
|
|
||||||
game_setup();
|
game_setup();
|
||||||
|
|
||||||
while(Player.integrity > 0)
|
while(Player.integrity > 0)
|
||||||
|
|||||||
+36
-17
@@ -7,7 +7,7 @@ extern _kernel_swi_regs inreg;
|
|||||||
extern _kernel_swi_regs outreg;
|
extern _kernel_swi_regs outreg;
|
||||||
|
|
||||||
extern unsigned char *buffer;
|
extern unsigned char *buffer;
|
||||||
unsigned char screen = 1;
|
int screen = 1;
|
||||||
|
|
||||||
// Loads sprite file into buffer
|
// Loads sprite file into buffer
|
||||||
void load_sprites(char* filename)
|
void load_sprites(char* filename)
|
||||||
@@ -61,9 +61,30 @@ void load_sprites(char* filename)
|
|||||||
|
|
||||||
void display_mode(int mode)
|
void display_mode(int mode)
|
||||||
{
|
{
|
||||||
inreg.r[0] = 0;
|
int pitch;
|
||||||
inreg.r[1] = mode;
|
int height=256; // TODO: This shouldn't be here!
|
||||||
_kernel_swi(OS_ScreenMode,&inreg,&outreg);
|
|
||||||
|
// 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)
|
void draw_dotted_line(int x1,int y1,int x2,int y2)
|
||||||
@@ -157,23 +178,21 @@ void graphics_colour(int setcolour)
|
|||||||
}
|
}
|
||||||
void screen_flipbuffer()
|
void screen_flipbuffer()
|
||||||
{
|
{
|
||||||
inreg.r[0] = 19;
|
// Hardware
|
||||||
_kernel_swi(OS_Byte,&inreg,&outreg);
|
inreg.r[0] = 113;
|
||||||
|
inreg.r[1] = screen+1;
|
||||||
/* inreg.r[0] = 114;
|
|
||||||
inreg.r[1] = 1;
|
|
||||||
_kernel_swi(OS_Byte,&inreg,&outreg);
|
_kernel_swi(OS_Byte,&inreg,&outreg);
|
||||||
|
|
||||||
inreg.r[0] = 113;
|
screen ^= 1;
|
||||||
inreg.r[1] = screen;
|
|
||||||
|
// 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);
|
_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()
|
void screen_clear()
|
||||||
|
|||||||
Reference in New Issue
Block a user