[Add] Planet targeting/landing framework.
[Change] Seperated update/render as it should be.
This commit is contained in:
parent
ef108e9f2e
commit
e3c2ca72ac
Binary file not shown.
Before Width: | Height: | Size: 326 B After Width: | Height: | Size: 328 B |
50
src/main.c
50
src/main.c
@ -53,6 +53,7 @@ static void window_caption(void);
|
|||||||
static void data_name(void);
|
static void data_name(void);
|
||||||
// Update.
|
// Update.
|
||||||
static void update_all(void);
|
static void update_all(void);
|
||||||
|
static void render_all(void);
|
||||||
|
|
||||||
// Usage.
|
// Usage.
|
||||||
static void print_usage(char** argv) {
|
static void print_usage(char** argv) {
|
||||||
@ -276,7 +277,7 @@ int main(int argc, char** argv) {
|
|||||||
|
|
||||||
time = SDL_GetTicks(); // Init the time.
|
time = SDL_GetTicks(); // Init the time.
|
||||||
|
|
||||||
// Main looops.
|
// Main loop.
|
||||||
SDL_Event event;
|
SDL_Event event;
|
||||||
// flushes the event loop, since I notices that when the joystick is loaded, it
|
// flushes the event loop, since I notices that when the joystick is loaded, it
|
||||||
// creates button events that results in the player starting out accelerating.
|
// creates button events that results in the player starting out accelerating.
|
||||||
@ -288,6 +289,7 @@ int main(int argc, char** argv) {
|
|||||||
input_handle(&event); // handles all the events the player keybinds.
|
input_handle(&event); // handles all the events the player keybinds.
|
||||||
}
|
}
|
||||||
update_all();
|
update_all();
|
||||||
|
render_all();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Unload data.
|
// Unload data.
|
||||||
@ -310,25 +312,12 @@ int main(int argc, char** argv) {
|
|||||||
exit(EXIT_SUCCESS);
|
exit(EXIT_SUCCESS);
|
||||||
}
|
}
|
||||||
|
|
||||||
// == Update everything. ==================================
|
// Updates everything.
|
||||||
// Blitting order. (layers)
|
|
||||||
//
|
|
||||||
// BG | Stars and planets.
|
|
||||||
// | Background particles.
|
|
||||||
// | Back layer weapons.
|
|
||||||
// X
|
|
||||||
// N | NPC ships.
|
|
||||||
// | Normal layer particles (above ships).
|
|
||||||
// | Front layer weapons.
|
|
||||||
// X
|
|
||||||
// FG | Player.
|
|
||||||
// | Foreground particles.
|
|
||||||
// | Text and GUI.
|
|
||||||
// ========================================================
|
|
||||||
static double fps_dt = 1.;
|
static double fps_dt = 1.;
|
||||||
|
static double dt = 0.;
|
||||||
static void update_all(void) {
|
static void update_all(void) {
|
||||||
// dt in ms/1000.
|
// dt in ms/1000.
|
||||||
double dt = (double)(SDL_GetTicks() - time) / 1000.;
|
dt = (double)(SDL_GetTicks() - time) / 1000.;
|
||||||
time = SDL_GetTicks();
|
time = SDL_GetTicks();
|
||||||
|
|
||||||
// TODO: This could use some work.
|
// TODO: This could use some work.
|
||||||
@ -344,21 +333,38 @@ static void update_all(void) {
|
|||||||
SDL_Delay(delay);
|
SDL_Delay(delay);
|
||||||
fps_dt += delay; // Make sure it displays the propper FPS.
|
fps_dt += delay; // Make sure it displays the propper FPS.
|
||||||
}
|
}
|
||||||
|
weapons_update(dt);
|
||||||
|
pilots_update(dt);
|
||||||
|
}
|
||||||
|
|
||||||
|
// == Renders everything. ==================================
|
||||||
|
// Blitting order. (layers)
|
||||||
|
//
|
||||||
|
// BG | Stars and planets.
|
||||||
|
// | Background particles.
|
||||||
|
// | Back layer weapons.
|
||||||
|
// X
|
||||||
|
// N | NPC ships.
|
||||||
|
// | Normal layer particles (above ships).
|
||||||
|
// | Front layer weapons.
|
||||||
|
// X
|
||||||
|
// FG | Player.
|
||||||
|
// | Foreground particles.
|
||||||
|
// | Text and GUI.
|
||||||
|
// ========================================================
|
||||||
|
static void render_all(void) {
|
||||||
glClear(GL_COLOR_BUFFER_BIT);
|
glClear(GL_COLOR_BUFFER_BIT);
|
||||||
|
|
||||||
// --
|
|
||||||
// BG.
|
// BG.
|
||||||
space_render(dt);
|
space_render(dt);
|
||||||
planets_render();
|
planets_render();
|
||||||
weapons_update(dt, WEAPON_LAYER_BG);
|
weapons_render(WEAPON_LAYER_BG);
|
||||||
// N.
|
// N.
|
||||||
pilots_update(dt);
|
pilots_render();
|
||||||
weapons_update(dt, WEAPON_LAYER_FG);
|
weapons_render(WEAPON_LAYER_FG);
|
||||||
// FG.
|
// FG.
|
||||||
player_render();
|
player_render();
|
||||||
display_fps(dt);
|
display_fps(dt);
|
||||||
// --
|
|
||||||
|
|
||||||
SDL_GL_SwapBuffers();
|
SDL_GL_SwapBuffers();
|
||||||
}
|
}
|
||||||
|
@ -361,6 +361,15 @@ void pilots_update(double dt) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Render all the pilots.
|
||||||
|
void pilots_render(void) {
|
||||||
|
int i;
|
||||||
|
for(i = 1; i < pilots; i++)
|
||||||
|
// Skip the player.
|
||||||
|
if(pilot_stack[i]->render)
|
||||||
|
pilot_stack[i]->render(pilot_stack[i]);
|
||||||
|
}
|
||||||
|
|
||||||
// Return the fleet based on 'name'
|
// Return the fleet based on 'name'
|
||||||
Fleet* fleet_get(const char* name) {
|
Fleet* fleet_get(const char* name) {
|
||||||
int i;
|
int i;
|
||||||
|
@ -112,4 +112,5 @@ void fleet_free(void);
|
|||||||
|
|
||||||
// Update.
|
// Update.
|
||||||
void pilots_update(double dt);
|
void pilots_update(double dt);
|
||||||
|
void pilots_render(void);
|
||||||
|
|
||||||
|
104
src/player.c
104
src/player.c
@ -49,6 +49,7 @@ static Keybind** player_input; // Contains the players keybindings.
|
|||||||
const char* keybindNames[] = { "accel", "left", "right", // Movement.
|
const char* keybindNames[] = { "accel", "left", "right", // Movement.
|
||||||
"primary", "target", "target_nearest", "face", "board", // Combat.
|
"primary", "target", "target_nearest", "face", "board", // Combat.
|
||||||
"secondary", "secondary_next", // Secondary weapons.
|
"secondary", "secondary_next", // Secondary weapons.
|
||||||
|
"target_planet", "land", // Navigation.
|
||||||
"mapzoomin", "mapzoomout", "screenshot", "end" }; // Misc.
|
"mapzoomin", "mapzoomout", "screenshot", "end" }; // Misc.
|
||||||
|
|
||||||
// Player stuff.
|
// Player stuff.
|
||||||
@ -149,6 +150,8 @@ static void gui_renderBar(const glColour* c, const Vec2* p, const Rect* r, const
|
|||||||
// Keybinds.
|
// Keybinds.
|
||||||
static void player_board(void);
|
static void player_board(void);
|
||||||
static void player_secondaryNext(void);
|
static void player_secondaryNext(void);
|
||||||
|
static void player_targetPlanet(void);
|
||||||
|
static void player_land(void);
|
||||||
static void player_screenshot(void);
|
static void player_screenshot(void);
|
||||||
|
|
||||||
// Create a new player.
|
// Create a new player.
|
||||||
@ -248,6 +251,7 @@ void player_render(void) {
|
|||||||
int i, j;
|
int i, j;
|
||||||
char str[10];
|
char str[10];
|
||||||
Pilot* p;
|
Pilot* p;
|
||||||
|
Planet* planet;
|
||||||
Vec2 v;
|
Vec2 v;
|
||||||
glColour* c;
|
glColour* c;
|
||||||
gl_font* f;
|
gl_font* f;
|
||||||
@ -270,7 +274,23 @@ void player_render(void) {
|
|||||||
VX(v) -= p->ship->gfx_space->sw * PILOT_SIZE_APROX;
|
VX(v) -= p->ship->gfx_space->sw * PILOT_SIZE_APROX;
|
||||||
gl_blitSprite(gui.gfx_targetPilot, &v, 0, 1, c); // Bottom left.
|
gl_blitSprite(gui.gfx_targetPilot, &v, 0, 1, c); // Bottom left.
|
||||||
}
|
}
|
||||||
|
// Render the planet target graphics.
|
||||||
|
if(planet_target >= 0) {
|
||||||
|
planet = &cur_system->planets[planet_target];
|
||||||
|
|
||||||
|
if(areEnemies(player->faction, planet->faction)) c = &cHostile;
|
||||||
|
else c = &cNeutral;
|
||||||
|
|
||||||
|
vect_csetmin(&v, VX(planet->pos) - planet->gfx_space->sw/2.,
|
||||||
|
VY(planet->pos) + planet->gfx_space->sh/2.);
|
||||||
|
gl_blitSprite(gui.gfx_targetPlanet, &v, 0, 0, c); // Top left.
|
||||||
|
VX(v) += planet->gfx_space->sw;
|
||||||
|
gl_blitSprite(gui.gfx_targetPlanet, &v, 1, 0, c); // Top right.
|
||||||
|
VY(v) -= planet->gfx_space->sh;
|
||||||
|
gl_blitSprite(gui.gfx_targetPlanet, &v, 1, 1, c); // Bottom right.
|
||||||
|
VX(v) -= planet->gfx_space->sw;
|
||||||
|
gl_blitSprite(gui.gfx_targetPlanet, &v, 0, 1, c); // Bottom left.
|
||||||
|
}
|
||||||
// Render the player.
|
// Render the player.
|
||||||
pilot_render(player);
|
pilot_render(player);
|
||||||
|
|
||||||
@ -325,15 +345,23 @@ void player_render(void) {
|
|||||||
glPopMatrix(); // GL_PROJECTION.
|
glPopMatrix(); // GL_PROJECTION.
|
||||||
|
|
||||||
// Nav.
|
// Nav.
|
||||||
if(planet_target != -1) {
|
if(planet_target >= 0) {
|
||||||
|
// Planet landing target.
|
||||||
} else {
|
i = gl_printWidth(NULL, "Land");
|
||||||
i = gl_printWidth(NULL, "NAV");
|
|
||||||
vect_csetmin(&v, VX(gui.pos_nav) + (gui.nav.w - i)/2., VY(gui.pos_nav) - 5);
|
vect_csetmin(&v, VX(gui.pos_nav) + (gui.nav.w - i)/2., VY(gui.pos_nav) - 5);
|
||||||
gl_print(NULL, &v, &cConsole, "NAV");
|
gl_print(NULL, &v, &cConsole, "Land");
|
||||||
i = gl_printWidth(&gui.smallFont, "No Target");
|
i = gl_printWidth(&gui.smallFont, "%s", cur_system->planets[planet_target].name);
|
||||||
vect_csetmin(&v, VX(gui.pos_nav) + (gui.nav.w - i)/2., VY(gui.pos_nav) - 10 - gui.smallFont.h);
|
vect_csetmin(&v, VX(gui.pos_nav) + (gui.nav.w - i)/2., VY(gui.pos_nav) - 10 - gui.smallFont.h);
|
||||||
gl_print(&gui.smallFont, &v, &cGrey, "No Target");
|
gl_print(&gui.smallFont, &v, NULL, "%s", cur_system->planets[planet_target].name);
|
||||||
|
}
|
||||||
|
else if(planet_target == -1) {
|
||||||
|
// No planet target.
|
||||||
|
i = gl_printWidth(NULL, "Navigation");
|
||||||
|
vect_csetmin(&v, VX(gui.pos_nav) + (gui.nav.w - i)/2., VY(gui.pos_nav) - 5);
|
||||||
|
gl_print(NULL, &v, &cConsole, "Navigation");
|
||||||
|
i = gl_printWidth(&gui.smallFont, "Off");
|
||||||
|
vect_csetmin(&v, VX(gui.pos_nav) + (gui.nav.w - i)/2., VY(gui.pos_nav) - 10 - gui.smallFont.h);
|
||||||
|
gl_print(&gui.smallFont, &v, &cGrey, "Off");
|
||||||
}
|
}
|
||||||
|
|
||||||
// Health
|
// Health
|
||||||
@ -810,6 +838,7 @@ void player_board(void) {
|
|||||||
player_message("You are going too fact to board the ship");
|
player_message("You are going too fact to board the ship");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
// TODO:
|
||||||
player_message("It's a shame Allanis hasn't added boarding yet, right?!");
|
player_message("It's a shame Allanis hasn't added boarding yet, right?!");
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -838,6 +867,52 @@ static void player_secondaryNext(void) {
|
|||||||
pilot_setAmmo(player);
|
pilot_setAmmo(player);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Cycle through planet targets.
|
||||||
|
static void player_targetPlanet(void) {
|
||||||
|
if((planet_target == -1) && (cur_system->nplanets > 0)) {
|
||||||
|
// No target.
|
||||||
|
planet_target = 0;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
planet_target++;
|
||||||
|
|
||||||
|
if(planet_target >= cur_system->nplanets)
|
||||||
|
// Last system.
|
||||||
|
planet_target = -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Attempt to land or target closest planet if no land target.
|
||||||
|
static void player_land(void) {
|
||||||
|
Planet* planet = &cur_system->planets[planet_target];
|
||||||
|
if(planet_target >= 0) {
|
||||||
|
if(vect_dist(&player->solid->vel, &planet->pos) > planet->gfx_space->sw) {
|
||||||
|
player_message("You are too far away to land on %s", planet->name);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
else if((pow2(VX(player->solid->vel)) + pow2(VY(player->solid->vel))) > (double)pow2(MAX_HYPERSPACE_VEL)) {
|
||||||
|
player_message("You are going too fast to land on %s", planet->name);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
// TODO: Landing.
|
||||||
|
player_message("D'aww.. Allanis was too lazy to do it properly.");
|
||||||
|
} else {
|
||||||
|
// Get nearest planet target.
|
||||||
|
int i;
|
||||||
|
int tp;
|
||||||
|
double td, d;
|
||||||
|
|
||||||
|
for(i = 0, tp = -1; i < cur_system->nplanets; i++) {
|
||||||
|
d = vect_dist(&player->solid->vel, &planet->pos);
|
||||||
|
if((tp == -1) || (td > d)) {
|
||||||
|
tp = i;
|
||||||
|
td = d;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
planet_target = tp;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Take a screenshot.
|
// Take a screenshot.
|
||||||
static void player_screenshot(void) {
|
static void player_screenshot(void) {
|
||||||
char filename[20];
|
char filename[20];
|
||||||
@ -852,16 +927,23 @@ static void player_screenshot(void) {
|
|||||||
|
|
||||||
// Set the default input keys.
|
// Set the default input keys.
|
||||||
void input_setDefault(void) {
|
void input_setDefault(void) {
|
||||||
|
// Movement.
|
||||||
input_setKeybind("accel", KEYBIND_KEYBOARD, SDLK_w, 0);
|
input_setKeybind("accel", KEYBIND_KEYBOARD, SDLK_w, 0);
|
||||||
input_setKeybind("left", KEYBIND_KEYBOARD, SDLK_a, 0);
|
input_setKeybind("left", KEYBIND_KEYBOARD, SDLK_a, 0);
|
||||||
input_setKeybind("right", KEYBIND_KEYBOARD, SDLK_d, 0);
|
input_setKeybind("right", KEYBIND_KEYBOARD, SDLK_d, 0);
|
||||||
|
// Combat.
|
||||||
input_setKeybind("primary", KEYBIND_KEYBOARD, SDLK_SPACE, 0);
|
input_setKeybind("primary", KEYBIND_KEYBOARD, SDLK_SPACE, 0);
|
||||||
input_setKeybind("target", KEYBIND_KEYBOARD, SDLK_TAB, 0);
|
input_setKeybind("target", KEYBIND_KEYBOARD, SDLK_TAB, 0);
|
||||||
input_setKeybind("target_nearest", KEYBIND_KEYBOARD, SDLK_r, 0);
|
input_setKeybind("target_nearest", KEYBIND_KEYBOARD, SDLK_r, 0);
|
||||||
input_setKeybind("face", KEYBIND_KEYBOARD, SDLK_f, 0);
|
input_setKeybind("face", KEYBIND_KEYBOARD, SDLK_f, 0);
|
||||||
input_setKeybind("board", KEYBIND_KEYBOARD, SDLK_b, 0);
|
input_setKeybind("board", KEYBIND_KEYBOARD, SDLK_b, 0);
|
||||||
|
// Secondary weapon.
|
||||||
input_setKeybind("secondary", KEYBIND_KEYBOARD, SDLK_LSHIFT, 0);
|
input_setKeybind("secondary", KEYBIND_KEYBOARD, SDLK_LSHIFT, 0);
|
||||||
input_setKeybind("secondary_next", KEYBIND_KEYBOARD, SDLK_q, 0);
|
input_setKeybind("secondary_next", KEYBIND_KEYBOARD, SDLK_q, 0);
|
||||||
|
// Space
|
||||||
|
input_setKeybind("target_planet", KEYBIND_KEYBOARD, SDLK_p, 0);
|
||||||
|
input_setKeybind("land", KEYBIND_KEYBOARD, SDLK_l, 0);
|
||||||
|
// Misc.
|
||||||
input_setKeybind("mapzoomin", KEYBIND_KEYBOARD, SDLK_UP, 0);
|
input_setKeybind("mapzoomin", KEYBIND_KEYBOARD, SDLK_UP, 0);
|
||||||
input_setKeybind("mapzoomout", KEYBIND_KEYBOARD, SDLK_DOWN, 0);
|
input_setKeybind("mapzoomout", KEYBIND_KEYBOARD, SDLK_DOWN, 0);
|
||||||
input_setKeybind("screenshot", KEYBIND_KEYBOARD, SDLK_F12, 0);
|
input_setKeybind("screenshot", KEYBIND_KEYBOARD, SDLK_F12, 0);
|
||||||
@ -975,6 +1057,14 @@ static void input_key(int keynum, double value, int abs) {
|
|||||||
else if(strcmp(player_input[keynum]->name, "secondary_next")==0) {
|
else if(strcmp(player_input[keynum]->name, "secondary_next")==0) {
|
||||||
if(value == KEY_PRESS) player_secondaryNext();
|
if(value == KEY_PRESS) player_secondaryNext();
|
||||||
}
|
}
|
||||||
|
// Target planet (cycles just like target).
|
||||||
|
else if(strcmp(player_input[keynum]->name, "target_planet")==0) {
|
||||||
|
if(value == KEY_PRESS) player_targetPlanet();
|
||||||
|
}
|
||||||
|
// Target nearest planet or attempt to land.
|
||||||
|
else if(strcmp(player_input[keynum]->name, "land")==0) {
|
||||||
|
if(value == KEY_PRESS) player_land();
|
||||||
|
}
|
||||||
// Zoom in.
|
// Zoom in.
|
||||||
else if(strcmp(player_input[keynum]->name, "mapzoomin")==0) {
|
else if(strcmp(player_input[keynum]->name, "mapzoomin")==0) {
|
||||||
if((value == KEY_PRESS) && (gui.radar.res < RADAR_RES_MAX))
|
if((value == KEY_PRESS) && (gui.radar.res < RADAR_RES_MAX))
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
#include "pilot.h"
|
#include "pilot.h"
|
||||||
|
|
||||||
#define MIN_HYPERSPACE_DIST 1500
|
#define MIN_HYPERSPACE_DIST 1500
|
||||||
#define MAX_HYPERSPACE_VEL 10
|
#define MAX_HYPERSPACE_VEL 15
|
||||||
|
|
||||||
// Planet types. I didn't take them from Star Trek, I promise.
|
// Planet types. I didn't take them from Star Trek, I promise.
|
||||||
typedef enum {
|
typedef enum {
|
||||||
|
33
src/weapon.c
33
src/weapon.c
@ -49,6 +49,7 @@ static Weapon* weapon_create(const Outfit* outfit, const double dir,
|
|||||||
const unsigned int target);
|
const unsigned int target);
|
||||||
|
|
||||||
static void weapon_render(const Weapon* w);
|
static void weapon_render(const Weapon* w);
|
||||||
|
static void weapons_updateLayer(const double dt, const WeaponLayer layer);
|
||||||
static void weapon_update(Weapon* w, const double dt, WeaponLayer layer);
|
static void weapon_update(Weapon* w, const double dt, WeaponLayer layer);
|
||||||
static void weapon_hit(Weapon* w, Pilot* p, WeaponLayer layer);
|
static void weapon_hit(Weapon* w, Pilot* p, WeaponLayer layer);
|
||||||
static void weapon_destroy(Weapon* w, WeaponLayer layer);
|
static void weapon_destroy(Weapon* w, WeaponLayer layer);
|
||||||
@ -98,8 +99,14 @@ static void think_seeker(Weapon* w) {
|
|||||||
vect_pset(&w->solid->vel, w->outfit->speed, VANGLE(w->solid->vel));
|
vect_pset(&w->solid->vel, w->outfit->speed, VANGLE(w->solid->vel));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Update all the weapon layers.
|
||||||
|
void weapons_update(const double dt) {
|
||||||
|
weapons_updateLayer(dt, WEAPON_LAYER_BG);
|
||||||
|
weapons_updateLayer(dt, WEAPON_LAYER_FG);
|
||||||
|
}
|
||||||
|
|
||||||
// Update all weapons in the layer.
|
// Update all weapons in the layer.
|
||||||
void weapons_update(const double dt, WeaponLayer layer) {
|
static void weapons_updateLayer(const double dt, const WeaponLayer layer) {
|
||||||
Weapon** wlayer;
|
Weapon** wlayer;
|
||||||
int* nlayer;
|
int* nlayer;
|
||||||
|
|
||||||
@ -139,6 +146,26 @@ void weapons_update(const double dt, WeaponLayer layer) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Render all the weapons.
|
||||||
|
void weapons_render(const WeaponLayer layer) {
|
||||||
|
Weapon** wlayer;
|
||||||
|
int* nlayer;
|
||||||
|
int i;
|
||||||
|
|
||||||
|
switch(layer) {
|
||||||
|
case WEAPON_LAYER_BG:
|
||||||
|
wlayer = wbackLayer;
|
||||||
|
nlayer = &nwbackLayer;
|
||||||
|
break;
|
||||||
|
case WEAPON_LAYER_FG:
|
||||||
|
wlayer = wfrontLayer;
|
||||||
|
nlayer = &nwfrontLayer;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
for(i = 0; i < (*nlayer); i++)
|
||||||
|
weapon_render(wlayer[i]);
|
||||||
|
}
|
||||||
|
|
||||||
// Render the weapons.
|
// Render the weapons.
|
||||||
static void weapon_render(const Weapon* w) {
|
static void weapon_render(const Weapon* w) {
|
||||||
int sx, sy;
|
int sx, sy;
|
||||||
@ -175,8 +202,6 @@ static void weapon_update(Weapon* w, const double dt, WeaponLayer layer) {
|
|||||||
}
|
}
|
||||||
if(weapon_isSmart(w)) (*w->think)(w);
|
if(weapon_isSmart(w)) (*w->think)(w);
|
||||||
(*w->solid->update)(w->solid, dt);
|
(*w->solid->update)(w->solid, dt);
|
||||||
|
|
||||||
weapon_render(w);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Good shot.
|
// Good shot.
|
||||||
@ -231,7 +256,7 @@ static Weapon* weapon_create(const Outfit* outfit, const double dir, const Vec2*
|
|||||||
|
|
||||||
// Add a new weapon.
|
// Add a new weapon.
|
||||||
void weapon_add(const Outfit* outfit, const double dir, const Vec2* pos, const Vec2* vel,
|
void weapon_add(const Outfit* outfit, const double dir, const Vec2* pos, const Vec2* vel,
|
||||||
unsigned int parent, unsigned int target, WeaponLayer layer) {
|
unsigned int parent, unsigned int target, const WeaponLayer layer) {
|
||||||
|
|
||||||
if(!outfit_isWeapon(outfit) && !outfit_isAmmo(outfit)) {
|
if(!outfit_isWeapon(outfit) && !outfit_isAmmo(outfit)) {
|
||||||
ERR("Trying to create a weapon from a non-Weapon type Outfit");
|
ERR("Trying to create a weapon from a non-Weapon type Outfit");
|
||||||
|
@ -6,10 +6,13 @@ typedef enum { WEAPON_LAYER_BG, WEAPON_LAYER_FG } WeaponLayer;
|
|||||||
|
|
||||||
void weapon_add(const Outfit* outfit, const double dir,
|
void weapon_add(const Outfit* outfit, const double dir,
|
||||||
const Vec2* pos, const Vec2* vel, unsigned int parent,
|
const Vec2* pos, const Vec2* vel, unsigned int parent,
|
||||||
const unsigned int target, WeaponLayer layer);
|
const unsigned int target, const WeaponLayer layer);
|
||||||
|
|
||||||
void weapons_update(const double dt, WeaponLayer layer);
|
// Update.
|
||||||
|
void weapons_update(const double dt);
|
||||||
|
void weapons_render(const WeaponLayer layer);
|
||||||
|
|
||||||
|
// Clean.
|
||||||
void weapon_clear(void);
|
void weapon_clear(void);
|
||||||
void weapon_exit(void);
|
void weapon_exit(void);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user