96 lines
2.6 KiB
C
96 lines
2.6 KiB
C
#pragma once
|
|
#include "faction.h"
|
|
#include "opengl.h"
|
|
#include "pilot.h"
|
|
|
|
#define MIN_HYPERSPACE_DIST 1500
|
|
#define MAX_HYPERSPACE_VEL 25
|
|
|
|
// Planet types. I didn't take them from Star Trek, I promise.
|
|
typedef enum PlanetClass_ {
|
|
PLANET_CLASS_NULL = 0,
|
|
PLANET_CLASS_A, // Geothermal.
|
|
PLANET_CLASS_B, // Geomorteus.
|
|
PLANET_CLASS_C, // Geoinactive.
|
|
PLANET_CLASS_D, // Asteroid/Moon.
|
|
PLANET_CLASS_E, // Geoplastic.
|
|
PLANET_CLASS_F, // Geometallic.
|
|
PLANET_CLASS_G, // GroCrystaline.
|
|
PLANET_CLASS_H, // Desert.
|
|
PLANET_CLASS_I, // Gas Supergiant.
|
|
PLANET_CLASS_J, // Gas Giant.
|
|
PLANET_CLASS_K, // Adaptable.
|
|
PLANET_CLASS_L, // Marginal.
|
|
PLANET_CLASS_M, // Terrestrial.
|
|
PLANET_CLASS_N, // Reducing.
|
|
PLANET_CLASS_O, // Pelagic.
|
|
PLANET_CLASS_P, // Glaciated.
|
|
PLANET_CLASS_Q, // Variable.
|
|
PLANET_CLASS_R, // Rogue.
|
|
PLANET_CLASS_S, // Ultragiant.
|
|
PLANET_CLASS_T, // Ultragiant.
|
|
PLANET_CLASS_X, // Demon.
|
|
PLANET_CLASS_Y, // Demon.
|
|
PLANET_CLASS_Z // Demon.
|
|
} PlanetClass;
|
|
|
|
// Planet services.
|
|
#define PLANET_SERVICE_BASIC (1<<0) // Refueling, spaceport bar, new.
|
|
#define PLANET_SERVICE_COMMODITY (1<<1)
|
|
#define PLANET_SERVICE_OUTFITS (1<<2)
|
|
#define PLANET_SERVICE_SHIPYARD (1<<3)
|
|
#define planet_hasService(p,s) ((p)->services & s)
|
|
|
|
typedef struct Planet_ {
|
|
char* name; // Planet name
|
|
Vec2 pos; // Position in star system.
|
|
|
|
PlanetClass class; // Planet type.
|
|
Faction* faction; // Planet faction.
|
|
|
|
char* description; // Planet description.
|
|
char* bar_description; // Spaceport bar description.
|
|
int services; // Offered services.
|
|
glTexture* gfx_space; // Graphics in space.
|
|
glTexture* gfx_exterior; // Graphics in the exterior.
|
|
} Planet;
|
|
|
|
// Star systems.
|
|
typedef struct SystemFleet_ {
|
|
Fleet* fleet; // Fleet to appear.
|
|
int chance; // Chance of fleet appearing in the system.
|
|
} SystemFleet;
|
|
|
|
typedef struct StarSystem_ {
|
|
char* name; // Star system identifier.
|
|
Vec2 pos; // Position.
|
|
int stars, asteroids; // Un numero!
|
|
double interference; // Un uh.. Percentage.
|
|
|
|
Planet* planets; // Planets.
|
|
int nplanets; // Total number of planets.
|
|
|
|
SystemFleet* fleets; // Fleets that can appear in the current system.
|
|
int nfleets; // Total number of fleets.
|
|
|
|
int* jumps; // Adjacent star system index number.
|
|
int njumps; // Number of adjacent jumps.
|
|
} StarSystem;
|
|
|
|
extern StarSystem* cur_system; // Current star system.
|
|
|
|
// Load/Exit.
|
|
void space_init(const char* sysname);
|
|
int space_load(void);
|
|
void space_exit(void);
|
|
|
|
// Render.
|
|
void space_render(double dt);
|
|
void planets_render(void);
|
|
|
|
// Misc.
|
|
int space_canHyperspace(Pilot* p);
|
|
int space_hyperspace(Pilot* p);
|
|
extern char* stardate;
|
|
|