[Add] Visualization and description of ships in the shipyard.
This commit is contained in:
parent
9d08ff3ae0
commit
1b4bea7b1f
@ -6,6 +6,8 @@
|
|||||||
<sound>engine</sound>
|
<sound>engine</sound>
|
||||||
<class>1</class>
|
<class>1</class>
|
||||||
<price>120000</price>
|
<price>120000</price>
|
||||||
|
<fabricator>KonoGroup</fabricator>
|
||||||
|
<description>One of the most widely used ships in the galaxy. Reknown for it's stability and stubborness. The design hasn't been modified much since it's creation many years ago. It was one of the first civilian used spacecrafts, first used by the aristocracy and now used by everyone who cannot afford better.</description>
|
||||||
<movement>
|
<movement>
|
||||||
<thrust>320</thrust>
|
<thrust>320</thrust>
|
||||||
<turn>150</turn>
|
<turn>150</turn>
|
||||||
@ -35,6 +37,8 @@
|
|||||||
<sound>engine</sound>
|
<sound>engine</sound>
|
||||||
<class>1</class>
|
<class>1</class>
|
||||||
<price>180000</price>
|
<price>180000</price>
|
||||||
|
<fabricator>SaraCraft</fabricator>
|
||||||
|
<description>The star product of SaraCraft, the leapard has quickly become a favourite of pirates far and wide. Not much of a fighter, nor does it pack too much of a punch, but they like to come in swarms to overcome their enemies. While the SaraCraft official stance doesn't sell them to shady characters, it's widely known that they do as it seems there's a countless amount in the hands of pirates. </description>
|
||||||
<movement>
|
<movement>
|
||||||
<thrust>400</thrust>
|
<thrust>400</thrust>
|
||||||
<turn>180</turn>
|
<turn>180</turn>
|
||||||
@ -64,6 +68,9 @@
|
|||||||
<sound>engine</sound>
|
<sound>engine</sound>
|
||||||
<class>2</class>
|
<class>2</class>
|
||||||
<price>600000</price>
|
<price>600000</price>
|
||||||
|
<fabricator>VLSoft</fabricator>
|
||||||
|
<description>On of VLSoft's prize heavey fighters. Was originally a secret design for the Empire military, but then disclosed. Now a modified version is available for civilians, although it doesn't meet up to the original specifications.
|
||||||
|
Used by security agencies all over the universe for it's reliability and availability. Proudly enforcing your security since STARDATE.</description>
|
||||||
<movement>
|
<movement>
|
||||||
<thrust>320</thrust>
|
<thrust>320</thrust>
|
||||||
<turn>150</turn>
|
<turn>150</turn>
|
||||||
@ -95,6 +102,8 @@
|
|||||||
<sound>engine</sound>
|
<sound>engine</sound>
|
||||||
<class>2</class>
|
<class>2</class>
|
||||||
<price>900000</price>
|
<price>900000</price>
|
||||||
|
<fabricator>VLSoft</fabricator>
|
||||||
|
<description>A heavy liner specialized in freighting cargo all over the universe. Also has good accomodations for passengers depending on the model, allowing for enjoyable curises. Was a favourite target of pirates until they added stick turrets to the new models which can now defend themselves effectively.</description>
|
||||||
<movement>
|
<movement>
|
||||||
<thrust>180</thrust>
|
<thrust>180</thrust>
|
||||||
<turn>100</turn>
|
<turn>100</turn>
|
||||||
|
40
src/land.c
40
src/land.c
@ -52,6 +52,7 @@ static void outfits_close(char* str);
|
|||||||
static void shipyard(void);
|
static void shipyard(void);
|
||||||
static void shipyard_close(char* str);
|
static void shipyard_close(char* str);
|
||||||
static void shipyard_update(char* str);
|
static void shipyard_update(char* str);
|
||||||
|
static void shipyard_info(char* str);
|
||||||
// Spaceport bar.
|
// Spaceport bar.
|
||||||
static void spaceport_bar(void);
|
static void spaceport_bar(void);
|
||||||
static void spaceport_bar_close(char* str);
|
static void spaceport_bar_close(char* str);
|
||||||
@ -115,15 +116,29 @@ static void shipyard(void) {
|
|||||||
BUTTON_WIDTH, BUTTON_HEIGHT, "btnBuyShip",
|
BUTTON_WIDTH, BUTTON_HEIGHT, "btnBuyShip",
|
||||||
"Buy", NULL);
|
"Buy", NULL);
|
||||||
|
|
||||||
window_addText(secondary_wid, 20+200+20, -160,
|
window_addButton(secondary_wid, -40-BUTTON_WIDTH, 40+BUTTON_HEIGHT,
|
||||||
SHIPYARD_WIDTH-260, 200, 0, "txtDescription",
|
BUTTON_WIDTH, BUTTON_HEIGHT, "btnInfoShip",
|
||||||
&gl_defFont, &cConsole, NULL);
|
"Info", shipyard_info);
|
||||||
|
|
||||||
|
window_addRect(secondary_wid, 20+200+60, -50,
|
||||||
|
128, 96, "rctTarget", &cBlack, 0);
|
||||||
|
|
||||||
|
window_addImage(secondary_wid, 20+200+60, -50-96,
|
||||||
|
"imgTarget", NULL);
|
||||||
|
|
||||||
|
|
||||||
|
window_addText(secondary_wid, 20+200+40, -160,
|
||||||
|
SHIPYARD_WIDTH-360, 200, 0, "txtDescription",
|
||||||
|
&gl_smallFont, NULL, NULL);
|
||||||
|
|
||||||
// Setup the ships to buy/sell.
|
// Setup the ships to buy/sell.
|
||||||
ships = ship_getAll(&nships);
|
ships = ship_getAll(&nships);
|
||||||
window_addList(secondary_wid, 20, 40,
|
window_addList(secondary_wid, 20, 40,
|
||||||
200, SHIPYARD_HEIGHT-120, "lstShipyard",
|
200, SHIPYARD_HEIGHT-120, "lstShipyard",
|
||||||
ships, nships, 0, shipyard_update);
|
ships, nships, 0, shipyard_update);
|
||||||
|
|
||||||
|
// Write the shipyard stuff.
|
||||||
|
shipyard_update(NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void shipyard_close(char* str) {
|
static void shipyard_close(char* str) {
|
||||||
@ -133,9 +148,22 @@ static void shipyard_close(char* str) {
|
|||||||
|
|
||||||
static void shipyard_update(char* str) {
|
static void shipyard_update(char* str) {
|
||||||
(void)str;
|
(void)str;
|
||||||
char* tship;
|
char* shipname;
|
||||||
|
Ship* ship;
|
||||||
|
|
||||||
tship = toolkit_getList(secondary_wid, "lstShipyard");
|
shipname = toolkit_getList(secondary_wid, "lstShipyard");
|
||||||
|
ship = ship_get(shipname);
|
||||||
|
|
||||||
|
window_modifyText(secondary_wid, "txtDescription", ship->description);
|
||||||
|
window_modifyImage(secondary_wid, "imgTarget", ship->gfx_target);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void shipyard_info(char* str) {
|
||||||
|
(void)str;
|
||||||
|
char* shipname;
|
||||||
|
|
||||||
|
shipname = toolkit_getList(secondary_wid, "lstShipyard");
|
||||||
|
ship_view(shipname);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Spaceport bar.
|
// Spaceport bar.
|
||||||
@ -185,7 +213,7 @@ void land(Planet* p) {
|
|||||||
land_wid = window_create(p->name, -1, -1, LAND_WIDTH, LAND_HEIGHT);
|
land_wid = window_create(p->name, -1, -1, LAND_WIDTH, LAND_HEIGHT);
|
||||||
|
|
||||||
// Pretty display.
|
// Pretty display.
|
||||||
window_addImage(land_wid, 20, -440, "imgPlanet", p->gfx_exterior);
|
window_addImage(land_wid, 20, -40, "imgPlanet", p->gfx_exterior);
|
||||||
window_addText(land_wid, 440, 80, 200, 460, 0,
|
window_addText(land_wid, 440, 80, 200, 460, 0,
|
||||||
"txtPlanetDesc", &gl_smallFont, &cBlack, p->description);
|
"txtPlanetDesc", &gl_smallFont, &cBlack, p->description);
|
||||||
// Buttons.
|
// Buttons.
|
||||||
|
@ -93,6 +93,10 @@ static Ship* ship_parse(xmlNodePtr parent) {
|
|||||||
tmp->class = xml_getInt(node);
|
tmp->class = xml_getInt(node);
|
||||||
else if(xml_isNode(node, "price"))
|
else if(xml_isNode(node, "price"))
|
||||||
tmp->price = xml_getInt(node);
|
tmp->price = xml_getInt(node);
|
||||||
|
else if(xml_isNode(node, "fabricator"))
|
||||||
|
tmp->fabricator = strdup(xml_get(node));
|
||||||
|
else if(xml_isNode(node, "description"))
|
||||||
|
tmp->description = strdup(xml_get(node));
|
||||||
else if(xml_isNode(node, "movement")) {
|
else if(xml_isNode(node, "movement")) {
|
||||||
cur = node->children;
|
cur = node->children;
|
||||||
do {
|
do {
|
||||||
@ -165,6 +169,8 @@ static Ship* ship_parse(xmlNodePtr parent) {
|
|||||||
MELEMENT(tmp->gui == NULL, "GUI");
|
MELEMENT(tmp->gui == NULL, "GUI");
|
||||||
MELEMENT(tmp->class==0, "class");
|
MELEMENT(tmp->class==0, "class");
|
||||||
MELEMENT(tmp->price==0, "price");
|
MELEMENT(tmp->price==0, "price");
|
||||||
|
MELEMENT(tmp->fabricator==0, "fabricator");
|
||||||
|
MELEMENT(tmp->description==0, "description");
|
||||||
MELEMENT(tmp->thrust==0, "thrust");
|
MELEMENT(tmp->thrust==0, "thrust");
|
||||||
MELEMENT(tmp->turn==0, "turn");
|
MELEMENT(tmp->turn==0, "turn");
|
||||||
MELEMENT(tmp->speed==0, "speed");
|
MELEMENT(tmp->speed==0, "speed");
|
||||||
|
@ -27,7 +27,10 @@ typedef struct Ship_ {
|
|||||||
char* name; // Ship name.
|
char* name; // Ship name.
|
||||||
ShipClass class; // Ship class.
|
ShipClass class; // Ship class.
|
||||||
|
|
||||||
|
// Store stuff.
|
||||||
unsigned int price; // Price!
|
unsigned int price; // Price!
|
||||||
|
char* fabricator; // Manufacturer.
|
||||||
|
char* description; // Sales pitch.
|
||||||
|
|
||||||
// Movement.
|
// Movement.
|
||||||
double thrust, turn, speed;
|
double thrust, turn, speed;
|
||||||
|
@ -181,8 +181,7 @@ void window_addImage(const unsigned int wid, const int x, const int y,
|
|||||||
wgt->h = (image == NULL) ? 0 : wgt->dat.img.image->sh;
|
wgt->h = (image == NULL) ? 0 : wgt->dat.img.image->sh;
|
||||||
if(x < 0) wgt->x = wdw->w - wgt->w + x;
|
if(x < 0) wgt->x = wdw->w - wgt->w + x;
|
||||||
else wgt->x = (double)x;
|
else wgt->x = (double)x;
|
||||||
if(y < 0) wgt->y = wdw->h + y;
|
if(y < 0) wgt->y = wdw->h - wgt->h + y;
|
||||||
//if(y < 0) wgt->y = wdw->h - wgt->h + y;
|
|
||||||
else wgt->y = (double)y;
|
else wgt->y = (double)y;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user