mirror of
https://github.com/stevenhowes/CTheEscape.git
synced 2026-05-26 15:53:29 +01:00
Show real data on the hud, decrement goal distance
This commit is contained in:
Binary file not shown.
+26
-4
@@ -26,6 +26,8 @@ extern int current_element;
|
|||||||
enum sprite_e{player_ship, durno_ship,player_shipl,player_shipr};
|
enum sprite_e{player_ship, durno_ship,player_shipl,player_shipr};
|
||||||
char *sprites[] = {"player_ship","durno_ship","player_shipl","player_shipr"};
|
char *sprites[] = {"player_ship","durno_ship","player_shipl","player_shipr"};
|
||||||
|
|
||||||
|
char hudbuffer[63];
|
||||||
|
|
||||||
enum font_e{sys_12_8,font_max};
|
enum font_e{sys_12_8,font_max};
|
||||||
|
|
||||||
enum fontcolour_e{lcars_black,lcars_violet1};
|
enum fontcolour_e{lcars_black,lcars_violet1};
|
||||||
@@ -46,6 +48,9 @@ struct Player_s {
|
|||||||
struct EntityLocation_s location;
|
struct EntityLocation_s location;
|
||||||
enum sprite_e sprite;
|
enum sprite_e sprite;
|
||||||
unsigned char velocity;
|
unsigned char velocity;
|
||||||
|
int shields;
|
||||||
|
int integrity;
|
||||||
|
int remainingdistance;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct NPC_s NPCS[MAX_NPCS];
|
struct NPC_s NPCS[MAX_NPCS];
|
||||||
@@ -148,6 +153,10 @@ void game_setup_player()
|
|||||||
Player.location.X = DISPLAY_X/2;
|
Player.location.X = DISPLAY_X/2;
|
||||||
Player.location.Y = PLAYER_Y_START;
|
Player.location.Y = PLAYER_Y_START;
|
||||||
Player.sprite = player_ship;
|
Player.sprite = player_ship;
|
||||||
|
Player.velocity = 100;
|
||||||
|
Player.shields = 100;
|
||||||
|
Player.integrity = 50;
|
||||||
|
Player.remainingdistance = 1500000;
|
||||||
}
|
}
|
||||||
|
|
||||||
void game_tick_stars()
|
void game_tick_stars()
|
||||||
@@ -234,10 +243,17 @@ void game_draw_hud()
|
|||||||
|
|
||||||
font_colour(fontcolours[lcars_violet1],fontcolours[lcars_black],font[sys_12_8]);
|
font_colour(fontcolours[lcars_violet1],fontcolours[lcars_black],font[sys_12_8]);
|
||||||
|
|
||||||
draw_text("Shields",230,DISPLAY_Y-62,font[sys_12_8]);
|
sprintf(hudbuffer,"%i",Player.shields);
|
||||||
draw_text("Integrity",230,DISPLAY_Y-92,font[sys_12_8]);
|
draw_text(hudbuffer,230,DISPLAY_Y-62,font[sys_12_8]);
|
||||||
draw_text("Velocity",230,DISPLAY_Y-122,font[sys_12_8]);
|
|
||||||
draw_text("Distance",230,DISPLAY_Y-152,font[sys_12_8]);
|
sprintf(hudbuffer,"%i",Player.integrity);
|
||||||
|
draw_text(hudbuffer,230,DISPLAY_Y-92,font[sys_12_8]);
|
||||||
|
|
||||||
|
sprintf(hudbuffer,"%i",Player.velocity);
|
||||||
|
draw_text(hudbuffer,230,DISPLAY_Y-122,font[sys_12_8]);
|
||||||
|
|
||||||
|
sprintf(hudbuffer,"%i",Player.remainingdistance/1000);
|
||||||
|
draw_text(hudbuffer,230,DISPLAY_Y-152,font[sys_12_8]);
|
||||||
}
|
}
|
||||||
|
|
||||||
void game_setup()
|
void game_setup()
|
||||||
@@ -249,6 +265,11 @@ void game_setup()
|
|||||||
tick = clock();
|
tick = clock();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void game_tick_player()
|
||||||
|
{
|
||||||
|
Player.remainingdistance -= Player.velocity * (tick - lasttick);
|
||||||
|
}
|
||||||
|
|
||||||
void game_tick()
|
void game_tick()
|
||||||
{
|
{
|
||||||
lasttick = tick;
|
lasttick = tick;
|
||||||
@@ -259,6 +280,7 @@ void game_tick()
|
|||||||
|
|
||||||
game_tick_stars();
|
game_tick_stars();
|
||||||
game_input_tick();
|
game_input_tick();
|
||||||
|
game_tick_player();
|
||||||
|
|
||||||
game_draw_stars();
|
game_draw_stars();
|
||||||
game_draw_player();
|
game_draw_player();
|
||||||
|
|||||||
Reference in New Issue
Block a user