[Add] You can buy ships. :) Free of charge until offer lasts.

This commit is contained in:
Allanis 2013-03-07 15:28:35 +00:00
parent 88c7ad1156
commit 3fc4cb88df
3 changed files with 21 additions and 10 deletions

View File

@ -200,7 +200,7 @@ static void shipyard_buy(char* str) {
shipname = toolkit_getList(secondary_wid, "lstShipyard");
ship = ship_get(shipname);
//Vec2 v;
player_newShip(ship);
}
// Spaceport bar.

View File

@ -115,8 +115,7 @@ void player_new(void) {
uint32_t bufsize;
char* buf = pack_readfile(DATA, START_DATA, &bufsize);
int l, h;
double x, y, d;
Vec2 v;
double x, y;
xmlNodePtr node, cur, tmp;
xmlDocPtr doc = xmlParseMemory(buf, bufsize);
@ -169,19 +168,29 @@ void player_new(void) {
// Money.
credits = RNG(l, h);
// Position and direction.
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.
player_newShip(ship);
space_init(system);
// Position and direction.
player_warp(x, y);
player->solid->dir = RNG(0, 359) / 180.*M_PI;
// Welcome message.
player_message("Welcome to "APPNAME"!");
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, ...) {
va_list ap;
int i;

View File

@ -21,10 +21,12 @@ extern unsigned int player_flags;
extern unsigned int credits;
extern unsigned int combat_rating;
// Enums.
typedef enum RadarShape_ { RADAR_RECT, RADAR_CIRCLE } RadarShape; // For render functions.
// Creation.
void player_new(void);
void player_newShip(Ship* ship);
// Render.
int gui_init(void);