[Add] You can buy ships. :) Free of charge until offer lasts.
This commit is contained in:
parent
88c7ad1156
commit
3fc4cb88df
@ -199,8 +199,8 @@ static void shipyard_buy(char* str) {
|
|||||||
|
|
||||||
shipname = toolkit_getList(secondary_wid, "lstShipyard");
|
shipname = toolkit_getList(secondary_wid, "lstShipyard");
|
||||||
ship = ship_get(shipname);
|
ship = ship_get(shipname);
|
||||||
|
|
||||||
//Vec2 v;
|
player_newShip(ship);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Spaceport bar.
|
// Spaceport bar.
|
||||||
|
25
src/player.c
25
src/player.c
@ -115,8 +115,7 @@ void player_new(void) {
|
|||||||
uint32_t bufsize;
|
uint32_t bufsize;
|
||||||
char* buf = pack_readfile(DATA, START_DATA, &bufsize);
|
char* buf = pack_readfile(DATA, START_DATA, &bufsize);
|
||||||
int l, h;
|
int l, h;
|
||||||
double x, y, d;
|
double x, y;
|
||||||
Vec2 v;
|
|
||||||
|
|
||||||
xmlNodePtr node, cur, tmp;
|
xmlNodePtr node, cur, tmp;
|
||||||
xmlDocPtr doc = xmlParseMemory(buf, bufsize);
|
xmlDocPtr doc = xmlParseMemory(buf, bufsize);
|
||||||
@ -169,19 +168,29 @@ void player_new(void) {
|
|||||||
// Money.
|
// Money.
|
||||||
credits = RNG(l, h);
|
credits = RNG(l, h);
|
||||||
|
|
||||||
// Position and direction.
|
player_newShip(ship);
|
||||||
vect_cset(&v, x, y);
|
|
||||||
d = RNG(0, 359)/180.*M_PI;
|
|
||||||
|
|
||||||
pilot_create(ship, "Player", faction_get("Player"), NULL, d, &v, NULL, PILOT_PLAYER);
|
|
||||||
gl_bindCamera(&player->solid->pos); // Set opengl camers.
|
|
||||||
space_init(system);
|
space_init(system);
|
||||||
|
|
||||||
|
// Position and direction.
|
||||||
|
player_warp(x, y);
|
||||||
|
player->solid->dir = RNG(0, 359) / 180.*M_PI;
|
||||||
|
|
||||||
// Welcome message.
|
// Welcome message.
|
||||||
player_message("Welcome to "APPNAME"!");
|
player_message("Welcome to "APPNAME"!");
|
||||||
player_message("v%d.%d.%d", VMAJOR, VMINOR, VREV);
|
player_message("v%d.%d.%d", VMAJOR, VMINOR, VREV);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Change the players ship.
|
||||||
|
void player_newShip(Ship* ship) {
|
||||||
|
if(player)
|
||||||
|
pilot_destroy(player);
|
||||||
|
|
||||||
|
pilot_create(ship, "Player", faction_get("Player"), NULL,
|
||||||
|
0., NULL, NULL, PILOT_PLAYER);
|
||||||
|
|
||||||
|
gl_bindCamera(&player->solid->pos); // Set opengl camera.
|
||||||
|
}
|
||||||
|
|
||||||
void player_message(const char* fmt, ...) {
|
void player_message(const char* fmt, ...) {
|
||||||
va_list ap;
|
va_list ap;
|
||||||
int i;
|
int i;
|
||||||
|
@ -21,10 +21,12 @@ extern unsigned int player_flags;
|
|||||||
extern unsigned int credits;
|
extern unsigned int credits;
|
||||||
extern unsigned int combat_rating;
|
extern unsigned int combat_rating;
|
||||||
|
|
||||||
|
// Enums.
|
||||||
typedef enum RadarShape_ { RADAR_RECT, RADAR_CIRCLE } RadarShape; // For render functions.
|
typedef enum RadarShape_ { RADAR_RECT, RADAR_CIRCLE } RadarShape; // For render functions.
|
||||||
|
|
||||||
// Creation.
|
// Creation.
|
||||||
void player_new(void);
|
void player_new(void);
|
||||||
|
void player_newShip(Ship* ship);
|
||||||
|
|
||||||
// Render.
|
// Render.
|
||||||
int gui_init(void);
|
int gui_init(void);
|
||||||
|
Loading…
Reference in New Issue
Block a user