diff --git a/dat/outfit.xml b/dat/outfit.xml index dc894e8..a64d6a7 100644 --- a/dat/outfit.xml +++ b/dat/outfit.xml @@ -531,5 +531,130 @@ 1000 35 + + + + 1 + 6 + 15 + 65000 + plasteel + Plasteel was one of man's greatest improvements on materials. It's a cheap, very strong armour that seems to take the best from both the plastic and steel. You can bend it relatively easily while keeping it's incredible strength. The Second Growth was only possible with this amazing new material. +By adding quite a dense layer of Plasteel to your ship you can increase it's sturdiness by a lot. Although with the advent of even newer materials Plasteel is starting to fade in popularity, although it's lower price tag always seems to keep a loyal customer base. + + + 35 + + + + + 1 + 9 + 35 + 365000 + nanobond + Nanobond is the succesor to Plasteel. It follows the same approach but has a much more refined manufacturing process with much more control on the small scale. The result is a much more robust and dense material although much more expensive. + + + 120 + + + + + 1 + 15 + 57 + 1120000 + biometal + Biometal is a metal armour that will actually regenerate itself thanks to some special bacteria it uses. The downside is that this makes it much bulkier and expensive then just using more refined Nanobond. The results are pretty formidable, but it's hard to equip such an armour on anything short of a Destroyer. + + + 150 + 60 + + + + + 3 + 11 + 3 + 430000 + droid + The low maintenance droid crew will scour your ship to repair any damages caused by space hazards. They are very small and able to work both on interior or exterior of the ship. Power is drawn from the ship to feed the robots, although the load is generally very low compared to the benefits of having a robotic repair crew. + + + 30 + -5 + -40 + + + + + 1 + 9 + 12 + 170000 + reactor_i + Adding a complementary reactor to your ship is a great way to get that extra energy boost you need. This do not replace the existing reactor but work alongside it and hook up directly to the energy flux. + + + 20 + 330 + + + + + 1 + 12 + 23 + 530000 + reactor_ii + The class II reactor takes a different approach to energy creation then the class I reactor. The new fusion design allows it to have a higher energy output, but is deemed unstable at bigger loads. The result is a medium sized reactor that can't really suit the needs of the bigger warships. + + + 60 + 720 + + + + + 1 + 12 + 46 + 970000 + reactor_iii + The class III reactor pretty much makes all your energy worries negligable. It follows the traditional fusion approach of the class I reactor, only making it much bigger. The size increase makes it only fit comfortably on large vessels, but the energy output is also suited for those. + + + 100 + 1620 + + + + + 1 + 14 + 80 + 830000 + lancelot_fighter + This fighter bay allows your ship to carry a pair of Lancelot class Fighters. It comes with all the devices required for the maintenance and flight of the fighters. + + + Lancelot Fighter + 4000 + + + + + 2 + 12 + 0 + 500000 + lancelot_fighter + This is a Lancelot class Fighter adapted for usage in the Lancelot Fighter Bay. It contains all the features of the standalone Lancelot with improved encrypted communication. + + + Lancelot + diff --git a/dat/ship.xml b/dat/ship.xml index 2df37e4..b4ba099 100644 --- a/dat/ship.xml +++ b/dat/ship.xml @@ -238,6 +238,8 @@ 10 + Lancelot Fighter Bay + Lancelot Fighter Ripper MK2 Ragnarok Beam Orion Beam diff --git a/dat/start.xml b/dat/start.xml index 31afd39..a44543e 100644 --- a/dat/start.xml +++ b/dat/start.xml @@ -2,7 +2,7 @@ Dark Tides - Llama + Lancelot 10000 20000 diff --git a/gfx/outfit/store/biometal.png b/gfx/outfit/store/biometal.png new file mode 100644 index 0000000..12a40aa Binary files /dev/null and b/gfx/outfit/store/biometal.png differ diff --git a/gfx/outfit/store/cannon.png b/gfx/outfit/store/cannon.png deleted file mode 100644 index 150a450..0000000 Binary files a/gfx/outfit/store/cannon.png and /dev/null differ diff --git a/gfx/outfit/store/droid.png b/gfx/outfit/store/droid.png new file mode 100644 index 0000000..7438e13 Binary files /dev/null and b/gfx/outfit/store/droid.png differ diff --git a/gfx/outfit/store/lancelot_fighter.png b/gfx/outfit/store/lancelot_fighter.png new file mode 100644 index 0000000..2a2e53b Binary files /dev/null and b/gfx/outfit/store/lancelot_fighter.png differ diff --git a/gfx/outfit/store/medium.png b/gfx/outfit/store/medium.png new file mode 100644 index 0000000..6381282 Binary files /dev/null and b/gfx/outfit/store/medium.png differ diff --git a/gfx/outfit/store/nanobond.png b/gfx/outfit/store/nanobond.png new file mode 100644 index 0000000..c5a4808 Binary files /dev/null and b/gfx/outfit/store/nanobond.png differ diff --git a/gfx/outfit/store/orion.png b/gfx/outfit/store/orion.png new file mode 100644 index 0000000..6d5037c Binary files /dev/null and b/gfx/outfit/store/orion.png differ diff --git a/gfx/outfit/store/plasteel.png b/gfx/outfit/store/plasteel.png new file mode 100644 index 0000000..85c22ce Binary files /dev/null and b/gfx/outfit/store/plasteel.png differ diff --git a/gfx/outfit/store/reactor_i.png b/gfx/outfit/store/reactor_i.png new file mode 100644 index 0000000..69d9343 Binary files /dev/null and b/gfx/outfit/store/reactor_i.png differ diff --git a/gfx/outfit/store/reactor_ii.png b/gfx/outfit/store/reactor_ii.png new file mode 100644 index 0000000..51241e6 Binary files /dev/null and b/gfx/outfit/store/reactor_ii.png differ diff --git a/gfx/outfit/store/reactor_iii.png b/gfx/outfit/store/reactor_iii.png new file mode 100644 index 0000000..0709fb6 Binary files /dev/null and b/gfx/outfit/store/reactor_iii.png differ diff --git a/src/outfit.c b/src/outfit.c index e75e367..b089dea 100644 --- a/src/outfit.c +++ b/src/outfit.c @@ -34,8 +34,10 @@ static void outfit_parseSLauncher(Outfit* tmp, const xmlNodePtr parent); static void outfit_parseSAmmo(Outfit* tmp, const xmlNodePtr parent); static void outfit_parseSMod(Outfit* tmp, const xmlNodePtr parent); static void outfit_parseSAfterburner(Outfit* tmp, const xmlNodePtr parent); -static void outfit_parseSMap(Outfit* tmp, const xmlNodePtr parent); static void outfit_parseSJammer(Outfit* tmp, const xmlNodePtr parent); +static void outfit_parseSFighterBay(Outfit* tmp, const xmlNodePtr parent); +static void outfit_parseSFighter(Outfit* tmp, const xmlNodePtr parent); +static void outfit_parseSMap(Outfit* tmp, const xmlNodePtr parent); /* Return an outfit. */ Outfit* outfit_get(const char* name) { @@ -365,6 +367,18 @@ int outfit_delay(const Outfit* o) { return -1; } +/** + * @fn char* outfit_ammo(const Outfit* o) + * + * @brief Get the outfits ammo. + * @param o Outfit to get information from. + */ +char* outfit_ammo(const Outfit* o) { + if(outfit_isLauncher(o)) return o->u.lau.ammo; + else if(outfit_isFighterBay(o)) return o->u.bay.ammo; + return NULL; +} + /** * @fn double outfit_energy(const Outfit* o) * @@ -492,6 +506,8 @@ static OutfitType outfit_strToOutfitType(char* buf) { O_CMP("modification", OUTFIT_TYPE_MODIFICATION); O_CMP("afterburner", OUTFIT_TYPE_AFTERBURNER); O_CMP("map", OUTFIT_TYPE_MAP); + O_CMP("fighter bay", OUTFIT_TYPE_FIGHTER_BAY); + O_CMP("fighter", OUTFIT_TYPE_FIGHTER); O_CMP("jammer", OUTFIT_TYPE_JAMMER); WARN("Invalid outfit type '%s'", buf); @@ -654,8 +670,8 @@ static void outfit_parseSLauncher(Outfit* tmp, const xmlNodePtr parent) { node = parent->xmlChildrenNode; do { /* Load the dataz. */ - if(xml_isNode(node, "delay")) tmp->u.lau.delay = xml_getInt(node); - else if(xml_isNode(node, "ammo")) tmp->u.lau.ammo = strdup(xml_get(node)); + xmlr_int(node, "delay", tmp->u.lau.delay); + xmlr_strd(node, "ammo", tmp->u.lau.ammo); } while((node = node->next)); #define MELEMENT(o,s) if(o) WARN("Outfit '%s' missing '"s"' element", tmp->name) @@ -763,6 +779,50 @@ static void outfit_parseSAfterburner(Outfit* tmp, const xmlNodePtr parent) { } while((node = node->next)); } +/** + * @fn static void outfit_parseSFighterBay(Outfit* tmp, const xmlNodePtr parent) + * + * @brief Parse the fighter bay tidbits of the outfit. + * @param tmp Outfit to finish laiding. + * @param parent Outfits parent node. + */ +static void outfit_parseSFighterBay(Outfit* tmp, const xmlNodePtr parent) { + xmlNodePtr node; + node = parent->children; + + do { + xmlr_int(node, "delay", tmp->u.bay.delay); + xmlr_strd(node, "ammo", tmp->u.bay.ammo); + } while(xml_nextNode(node)); + +#define MELEMENT(o,s) \ +if(o) WARN("Outfit '%s' missing/invalid '"s"' element", tmp->name) + MELEMENT(tmp->u.bay.delay==0, "delay"); + MELEMENT(tmp->u.bay.ammo==NULL, "ammo"); +#undef MELEMENT +} + +/** + * @fn static void outfit_parseSFighter(Outfit* tmp, const xmlNodePtr parent) + * + * @brief Parse the fighter tidbits of the outfit. + * @param tmp Outfit to finish loading. + * @param parent Outfits parent node. + */ +static void outfit_parseSFighter(Outfit* tmp, const xmlNodePtr parent) { + xmlNodePtr node; + node = parent->children; + + do { + xmlr_strd(node, "ship", tmp->u.fig.ship); + } while(xml_nextNode(node)); + +#define MELEMENT(o,s) \ +if(o) WARN("Outfit '%s' missing/invalid '"s"' element", tmp->name) + MELEMENT(tmp->u.fig.ship==NULL, "ship"); +#undef MELEMENT +} + static void outfit_parseSMap(Outfit* tmp, const xmlNodePtr parent) { xmlNodePtr node; node = parent->children; @@ -853,10 +913,14 @@ static Outfit* outfit_parse(const xmlNodePtr parent) { outfit_parseSMod(tmp, node); else if(outfit_isAfterburner(tmp)) outfit_parseSAfterburner(tmp, node); - else if(outfit_isMap(tmp)) - outfit_parseSMap(tmp, node); else if(outfit_isJammer(tmp)) outfit_parseSJammer(tmp, node); + else if(outfit_isFighterBay(tmp)) + outfit_parseSFighterBay(tmp, node); + else if(outfit_isFighter(tmp)) + outfit_parseSFighter(tmp, node); + else if(outfit_isMap(tmp)) + outfit_parseSMap(tmp, node); } } while(xml_nextNode(node)); #define MELEMENT(o,s) if(o) WARN("Outfit '%s' missing '"s"' element", tmp->name) @@ -928,6 +992,8 @@ void outfit_free(void) { free(o->u.lau.ammo); if(outfit_isFighterBay(o) && o->u.bay.ammo) free(o->u.bay.ammo); + if(outfit_isFighter(o) && o->u.fig.ship) + free(o->u.fig.ship); /* Strings. */ if(o->description) diff --git a/src/outfit.h b/src/outfit.h index 164718a..aefc3dc 100644 --- a/src/outfit.h +++ b/src/outfit.h @@ -282,6 +282,7 @@ int outfit_spfx(const Outfit* o); double outfit_damage(const Outfit* o); DamageType outfit_damageType(const Outfit* o); int outfit_delay(const Outfit* o); +char* outfit_ammo(const Outfit* o); double outfit_energy(const Outfit* o); double outfit_range(const Outfit* o); double outfit_speed(const Outfit* o); diff --git a/src/pilot.c b/src/pilot.c index 2c92b1b..cd2a3b9 100644 --- a/src/pilot.c +++ b/src/pilot.c @@ -18,6 +18,7 @@ #include "hook.h" #include "map.h" #include "explosion.h" +#include "escort.h" #include "pilot.h" #define XML_ID "Fleets" /**< XML document identifier. */ @@ -215,7 +216,8 @@ void pilot_shoot(Pilot* p, const int secondary) { for(i = 0; i < p->noutfits; i++) { o = p->outfits[i].outfit; if(!outfit_isProp(o, OUTFIT_PROP_WEAP_SECONDARY) && - (outfit_isBolt(o) || outfit_isBeam(o))) /** @todo Possibly make the neater. */ + (outfit_isBolt(o) || outfit_isBeam(o) || outfit_isFighterBay(o))) + /** @todo Possibly make this neater. */ pilot_shootWeapon(p, &p->outfits[i]); } } else { @@ -320,6 +322,24 @@ static void pilot_shootWeapon(Pilot* p, PilotOutfit* w) { p->ammo->quantity -= 1; /* There's no getting this one back. */ if(p->ammo->quantity <= 0) /* Out of ammo. */ pilot_rmOutfit(p, p->ammo->outfit, 0); /* It'll set p->ammo to NULL. */ + } + /* + * Fighter bays. + * + * Must be secondary weapon. + */ + else if(outfit_isFighterBay(w->outfit) && (w == p->secondary)) { + /* Must have ammo left. */ + if((p->ammo == NULL) || (p->ammo->quantity <= 0)) + return; + + /* Create escort. */ + escort_create(p->id, p->ammo->outfit->u.fig.ship, + &p->solid->pos, &p->solid->vel, 1); + + p->ammo->quantity -= 1; /* We just shot it. */ + if(p->ammo->quantity <= 0) /* Out of ammo. */ + pilot_rmOutfit(p, p->ammo->outfit, 0); /* It'll set p->ammo to NULL. */ } else { WARN("Shooting unknown weapon type: %s", w->outfit->name); } @@ -499,15 +519,14 @@ void pilot_setAmmo(Pilot* p) { int i; char* name; - /* Only launchers use ammo. */ - if((p->secondary == NULL) || !outfit_isLauncher(p->secondary->outfit)) { + /* Weapon must use ammo. */ + if((p->secondary == NULL) || (outfit_ammo(p->secondary->outfit)==NULL)) { p->ammo = NULL; return; } /* Find the ammo and set it. */ - name = p->secondary->outfit->u.lau.ammo; - + name = outfit_ammo(p->secondary->outfit); for(i = 0; i < p->noutfits; i++) if(strcmp(p->outfits[i].outfit->name, name)==0) { p->ammo = &p->outfits[i]; diff --git a/src/player.c b/src/player.c index 2d0e8e0..221f858 100644 --- a/src/player.c +++ b/src/player.c @@ -985,9 +985,9 @@ void player_renderGUI(void) { c = &cConsole; /* Launcher. */ - if(outfit_isLauncher(player->secondary->outfit)) { + if(player->ammo != NULL) { /* Use the ammunitions name. */ - i = gl_printWidth(f, "%s", player->secondary->outfit->u.lau.ammo); + i = gl_printWidth(f, "%s", outfit_ammo(player->secondary->outfit)); if(i > gui.weapon.w) /* Font is too big. */ f = &gl_smallFont; @@ -996,7 +996,7 @@ void player_renderGUI(void) { gl_printMid(f, (int)gui.weapon.w, gui.weapon.x, gui.weapon.y - 5, (player->ammo) ? c : &cGrey, "%s", - player->secondary->outfit->u.lau.ammo); + outfit_ammo(player->secondary->outfit)); /* Print ammo underneath to the left. */ gl_printMid(&gl_smallFont, (int)gui.weapon.w, gui.weapon.x,