[Add] Start of toolkit framework, we will manage windows etc here.
[Add] Pause/Resume
This commit is contained in:
parent
67480a47e3
commit
c0cc0a9346
40
bin/conf
Normal file
40
bin/conf
Normal file
@ -0,0 +1,40 @@
|
|||||||
|
--WINDOW.
|
||||||
|
width = 800
|
||||||
|
height = 640
|
||||||
|
fullscreen = 0
|
||||||
|
|
||||||
|
-- SCREEN.
|
||||||
|
fps = 0
|
||||||
|
|
||||||
|
-- JOYSTICK.
|
||||||
|
-- Can be number or substring of joystick name.
|
||||||
|
joystick = "Precision"
|
||||||
|
|
||||||
|
-- KEYBINDINGS.
|
||||||
|
-- Type can be keyboard, jaxis or jbutton.
|
||||||
|
--
|
||||||
|
-- If left is an axis, it will automatically set right to the same axis.
|
||||||
|
-- setting both to the same axis (key).
|
||||||
|
-- You can use reverse = 1 option to reverse them.
|
||||||
|
|
||||||
|
-- Movement.
|
||||||
|
accel = { type = "jbutton", key = 0 }
|
||||||
|
left = { type = "jaxis", key = 0 }
|
||||||
|
right = { type = "jaxis", key = 0 }
|
||||||
|
|
||||||
|
-- Combat.
|
||||||
|
primary = { type = "jbutton", key = 1 }
|
||||||
|
target = { type = "jbutton", key = 4 }
|
||||||
|
target_nearest = { type = "jbutton", key = 3 }
|
||||||
|
face = { type = "keyboard", key = 38 }
|
||||||
|
board = { type = "keyboard", key = 57 }
|
||||||
|
secondary = { type = "jbutton", key = 7 }
|
||||||
|
secondary_next = { type = "jbutotn", key = 5 }
|
||||||
|
|
||||||
|
-- Space.
|
||||||
|
|
||||||
|
-- Gui.
|
||||||
|
mapzoomin = { type = "jbutton", key = 4 }
|
||||||
|
mapzoomout = { type = "jbuton", key = 6 }
|
||||||
|
screenshot = { type = "keyboard", key = 82 }
|
||||||
|
|
@ -13,7 +13,7 @@
|
|||||||
<range>300</range>
|
<range>300</range>
|
||||||
<accuracy>30</accuracy>
|
<accuracy>30</accuracy>
|
||||||
<damage>
|
<damage>
|
||||||
<armour>20</armour>
|
<armour>13</armour>
|
||||||
<shield>10</shield>
|
<shield>10</shield>
|
||||||
</damage>
|
</damage>
|
||||||
</specific>
|
</specific>
|
||||||
|
@ -200,3 +200,9 @@ void conf_parseCLI(int argc, char** argv) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Saves the current configuration.
|
||||||
|
int conf_saveConfig(void) {
|
||||||
|
// TODO:
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
@ -1,6 +1,10 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
// Loading.
|
||||||
void conf_setDefaults(void);
|
void conf_setDefaults(void);
|
||||||
int conf_loadConfig(const char* file);
|
int conf_loadConfig(const char* file);
|
||||||
void conf_parseCLI(int argc, char** argv);
|
void conf_parseCLI(int argc, char** argv);
|
||||||
|
|
||||||
|
// Saving.
|
||||||
|
int conf_saveConfig(void);
|
||||||
|
|
||||||
|
32
src/input.c
32
src/input.c
@ -1,6 +1,7 @@
|
|||||||
#include "main.h"
|
#include "main.h"
|
||||||
#include "log.h"
|
#include "log.h"
|
||||||
#include "player.h"
|
#include "player.h"
|
||||||
|
#include "pause.h"
|
||||||
#include "input.h"
|
#include "input.h"
|
||||||
|
|
||||||
#define KEY_PRESS ( 1.)
|
#define KEY_PRESS ( 1.)
|
||||||
@ -22,7 +23,7 @@ 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.
|
"target_planet", "land", // Navigation.
|
||||||
"mapzoomin", "mapzoomout", "screenshot", "end" }; // Misc.
|
"mapzoomin", "mapzoomout", "screenshot", "pause", "end" }; // Misc.
|
||||||
// From player.c
|
// From player.c
|
||||||
extern double player_turn;
|
extern double player_turn;
|
||||||
extern double player_acc;
|
extern double player_acc;
|
||||||
@ -52,6 +53,7 @@ void input_setDefault(void) {
|
|||||||
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);
|
||||||
|
input_setKeybind("pause", KEYBIND_KEYBOARD, SDLK_p, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Initialization/exit functions (does not assign keys).
|
// Initialization/exit functions (does not assign keys).
|
||||||
@ -151,24 +153,34 @@ static void input_key(int keynum, double value, int abs) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Board those ships.
|
// Board those ships.
|
||||||
else if(KEY("board")) {
|
else if(KEY("board") && !paused) {
|
||||||
if(value == KEY_PRESS) player_board();
|
if(value == KEY_PRESS) player_board();
|
||||||
}
|
}
|
||||||
// Shooting secondary weapon.
|
// Selecting secondary weapon.
|
||||||
|
else if(KEY("secondary") && !paused) {
|
||||||
|
if(value == KEY_PRESS) player_setFlag(PLAYER_SECONDARY);
|
||||||
|
else if(value == KEY_RELEASE) player_rmFlag(PLAYER_SECONDARY);
|
||||||
|
}
|
||||||
|
// Selecting secondary weapon.
|
||||||
|
else if(KEY("secondary_next") && !paused) {
|
||||||
|
if(value == KEY_PRESS) player_secondaryNext();
|
||||||
|
}
|
||||||
|
// Selecting secondary weapon.
|
||||||
else if(KEY("secondary")) {
|
else if(KEY("secondary")) {
|
||||||
if(value == KEY_PRESS) player_setFlag(PLAYER_SECONDARY);
|
if(value == KEY_PRESS) player_setFlag(PLAYER_SECONDARY);
|
||||||
else if(value == KEY_RELEASE) player_rmFlag(PLAYER_SECONDARY);
|
else if(value == KEY_RELEASE) player_rmFlag(PLAYER_SECONDARY);
|
||||||
}
|
}
|
||||||
// Selecting secondary weapon.
|
// Selecting secondary weapon.
|
||||||
else if(KEY("secondary_next")) {
|
else if(KEY("secondary_next") && !paused) {
|
||||||
if(value == KEY_PRESS) player_secondaryNext();
|
if(value == KEY_PRESS) player_secondaryNext();
|
||||||
}
|
}
|
||||||
|
// Space.
|
||||||
// Target planet (cycles just like target).
|
// Target planet (cycles just like target).
|
||||||
else if(KEY("target_planet")) {
|
else if(KEY("target_planet") && !paused) {
|
||||||
if(value == KEY_PRESS) player_targetPlanet();
|
if(value == KEY_PRESS) player_targetPlanet();
|
||||||
}
|
}
|
||||||
// Target nearest planet or attempt to land.
|
// Target nearest planet or attempt to land.
|
||||||
else if(KEY("land")) {
|
else if(KEY("land") && !paused) {
|
||||||
if(value == KEY_PRESS) player_land();
|
if(value == KEY_PRESS) player_land();
|
||||||
}
|
}
|
||||||
// Zoom in.
|
// Zoom in.
|
||||||
@ -180,9 +192,15 @@ static void input_key(int keynum, double value, int abs) {
|
|||||||
if(value == KEY_PRESS) player_setRadarRel(-1);
|
if(value == KEY_PRESS) player_setRadarRel(-1);
|
||||||
}
|
}
|
||||||
// Take a screenshot.
|
// Take a screenshot.
|
||||||
else if(KEY("screenshot")) {
|
if(KEY("screenshot")) {
|
||||||
if(value == KEY_PRESS) player_screenshot();
|
if(value == KEY_PRESS) player_screenshot();
|
||||||
}
|
}
|
||||||
|
// Pause the game.
|
||||||
|
if(KEY("pause")) {
|
||||||
|
if(value == KEY_PRESS) {
|
||||||
|
if(paused) unpause();
|
||||||
|
} else pause();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// --Events--
|
// --Events--
|
||||||
|
19
src/main.c
19
src/main.c
@ -19,6 +19,8 @@
|
|||||||
#include "weapon.h"
|
#include "weapon.h"
|
||||||
#include "faction.h"
|
#include "faction.h"
|
||||||
#include "xml.h"
|
#include "xml.h"
|
||||||
|
#include "pause.h"
|
||||||
|
#include "toolkit.h"
|
||||||
#include "pilot.h"
|
#include "pilot.h"
|
||||||
|
|
||||||
#define XML_START_ID "Start"
|
#define XML_START_ID "Start"
|
||||||
@ -30,9 +32,8 @@
|
|||||||
#define MINIMUM_FPS 0.5
|
#define MINIMUM_FPS 0.5
|
||||||
#define FONT_SIZE 12
|
#define FONT_SIZE 12
|
||||||
|
|
||||||
int toolkit = 0; // Toolkit has a window open.
|
|
||||||
static int quit = 0; // Primary loop.
|
static int quit = 0; // Primary loop.
|
||||||
static unsigned int time = 0; // Calculate FPS and movement.
|
unsigned int time = 0; // Calculate FPS and movement.
|
||||||
static char version[VERSION_LEN];
|
static char version[VERSION_LEN];
|
||||||
|
|
||||||
// Just some default crap.
|
// Just some default crap.
|
||||||
@ -54,7 +55,6 @@ static void update_space(void);
|
|||||||
static void render_space(void);
|
static void render_space(void);
|
||||||
|
|
||||||
int main(int argc, char** argv) {
|
int main(int argc, char** argv) {
|
||||||
|
|
||||||
// Print the version.
|
// Print the version.
|
||||||
snprintf(version, VERSION_LEN, "%d.%d.%d", VMAJOR, VMINOR, VREV);
|
snprintf(version, VERSION_LEN, "%d.%d.%d", VMAJOR, VMINOR, VREV);
|
||||||
LOG(" "APPNAME" v%s", version);
|
LOG(" "APPNAME" v%s", version);
|
||||||
@ -123,6 +123,7 @@ int main(int argc, char** argv) {
|
|||||||
// Misc openGL init stuff.
|
// Misc openGL init stuff.
|
||||||
gl_fontInit(NULL, NULL, FONT_SIZE); // Init default font size.
|
gl_fontInit(NULL, NULL, FONT_SIZE); // Init default font size.
|
||||||
gui_init(); // Init the GUI crap.
|
gui_init(); // Init the GUI crap.
|
||||||
|
toolkit_init(); // Init the toolkit.
|
||||||
|
|
||||||
// Data loading.
|
// Data loading.
|
||||||
factions_load();
|
factions_load();
|
||||||
@ -149,16 +150,15 @@ 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.
|
||||||
}
|
}
|
||||||
|
|
||||||
if(toolkit) {
|
|
||||||
|
|
||||||
} else {
|
|
||||||
// Player is flying around.
|
|
||||||
update_space();
|
|
||||||
glClear(GL_COLOR_BUFFER_BIT);
|
glClear(GL_COLOR_BUFFER_BIT);
|
||||||
|
|
||||||
|
if(!paused) update_space(); // Update the game.
|
||||||
|
|
||||||
render_space();
|
render_space();
|
||||||
|
if(toolkit) toolkit_render();
|
||||||
|
|
||||||
SDL_GL_SwapBuffers();
|
SDL_GL_SwapBuffers();
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
// Unload data.
|
// Unload data.
|
||||||
weapon_exit(); // Destroy all active weapons.
|
weapon_exit(); // Destroy all active weapons.
|
||||||
@ -173,6 +173,7 @@ int main(int argc, char** argv) {
|
|||||||
gl_freeFont(NULL);
|
gl_freeFont(NULL);
|
||||||
|
|
||||||
// Exit subsystems.
|
// Exit subsystems.
|
||||||
|
toolkit_exit(); // Kill the toolkit.
|
||||||
ai_exit(); // Stop the Lua AI magicness.
|
ai_exit(); // Stop the Lua AI magicness.
|
||||||
joystick_exit(); // Release joystick.
|
joystick_exit(); // Release joystick.
|
||||||
input_exit(); // Clean up keybindings.
|
input_exit(); // Clean up keybindings.
|
||||||
|
61
src/pause.c
Normal file
61
src/pause.c
Normal file
@ -0,0 +1,61 @@
|
|||||||
|
#include "weapon.h"
|
||||||
|
#include "pilot.h"
|
||||||
|
#include "pause.h"
|
||||||
|
|
||||||
|
// Main thing with pausing is to allow things based on time to
|
||||||
|
// work properly when the toolkit opens a window.
|
||||||
|
|
||||||
|
int paused = 0; // Are we paused.
|
||||||
|
|
||||||
|
// From pilot.c
|
||||||
|
extern Pilot** pilot_stack;
|
||||||
|
extern int pilots;
|
||||||
|
// From main.c
|
||||||
|
extern unsigned int time;
|
||||||
|
|
||||||
|
static void pilots_pause(void);
|
||||||
|
static void pilots_unpause(void);
|
||||||
|
|
||||||
|
// Pause the game.
|
||||||
|
void pause(void) {
|
||||||
|
if(paused) return; // Well well.. We are paused already.
|
||||||
|
|
||||||
|
time -= SDL_GetTicks();
|
||||||
|
pilots_pause();
|
||||||
|
weapons_pause();
|
||||||
|
|
||||||
|
paused = 0; // We should unpause it.
|
||||||
|
}
|
||||||
|
|
||||||
|
void unpause(void) {
|
||||||
|
if(!paused) return; // We are unpaused already.
|
||||||
|
|
||||||
|
time += SDL_GetTicks();
|
||||||
|
pilots_unpause();
|
||||||
|
weapons_unpause();
|
||||||
|
|
||||||
|
paused = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void pilots_pause(void) {
|
||||||
|
int i, j;
|
||||||
|
unsigned int t = SDL_GetTicks();
|
||||||
|
for(i = 0; i < pilots; i++) {
|
||||||
|
pilot_stack[i]->tcontrol -= t;
|
||||||
|
|
||||||
|
for(j = 0; j < MAX_AI_TIMERS; j++)
|
||||||
|
pilot_stack[i]->timer[j] -= t;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static void pilots_unpause(void) {
|
||||||
|
int i, j;
|
||||||
|
unsigned int t = SDL_GetTicks();
|
||||||
|
for(i = 0; i < pilots; i++) {
|
||||||
|
pilot_stack[i]->tcontrol += t;
|
||||||
|
|
||||||
|
for(j = 0; j < MAX_AI_TIMERS; j++)
|
||||||
|
pilot_stack[i]->timer[j] += t;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
7
src/pause.h
Normal file
7
src/pause.h
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
#pragma once
|
||||||
|
|
||||||
|
extern int paused;
|
||||||
|
|
||||||
|
void pause(void);
|
||||||
|
void unpause(void);
|
||||||
|
|
@ -8,6 +8,7 @@
|
|||||||
#include "space.h"
|
#include "space.h"
|
||||||
#include "faction.h"
|
#include "faction.h"
|
||||||
#include "xml.h"
|
#include "xml.h"
|
||||||
|
#include "pause.h"
|
||||||
#include "player.h"
|
#include "player.h"
|
||||||
|
|
||||||
#define XML_PLANET_ID "Planets"
|
#define XML_PLANET_ID "Planets"
|
||||||
@ -440,6 +441,7 @@ void space_render(double dt) {
|
|||||||
glTranslated(-(double)gl_screen.w/2., -(double)gl_screen.h/2., 0.);
|
glTranslated(-(double)gl_screen.w/2., -(double)gl_screen.h/2., 0.);
|
||||||
glBegin(GL_POINTS);
|
glBegin(GL_POINTS);
|
||||||
for(i = 0; i < nstars; i++) {
|
for(i = 0; i < nstars; i++) {
|
||||||
|
if(!paused) {
|
||||||
// Update the position.
|
// Update the position.
|
||||||
stars[i].x -= VX(player->solid->vel)/(15.-10.*stars[i].brightness)*dt;
|
stars[i].x -= VX(player->solid->vel)/(15.-10.*stars[i].brightness)*dt;
|
||||||
stars[i].y -= VY(player->solid->vel)/(15.-10.*stars[i].brightness)*dt;
|
stars[i].y -= VY(player->solid->vel)/(15.-10.*stars[i].brightness)*dt;
|
||||||
@ -448,6 +450,7 @@ void space_render(double dt) {
|
|||||||
else if(stars[i].x < -STAR_BUF) stars[i].x = gl_screen.w + STAR_BUF;
|
else if(stars[i].x < -STAR_BUF) stars[i].x = gl_screen.w + STAR_BUF;
|
||||||
if(stars[i].y > gl_screen.h + STAR_BUF) stars[i].y = -STAR_BUF;
|
if(stars[i].y > gl_screen.h + STAR_BUF) stars[i].y = -STAR_BUF;
|
||||||
else if(stars[i].y < -STAR_BUF) stars[i].y = gl_screen.h + STAR_BUF;
|
else if(stars[i].y < -STAR_BUF) stars[i].y = gl_screen.h + STAR_BUF;
|
||||||
|
}
|
||||||
// Render.
|
// Render.
|
||||||
glColor4d(1., 1., 1., stars[i].brightness);
|
glColor4d(1., 1., 1., stars[i].brightness);
|
||||||
glVertex2d(stars[i].x, stars[i].y);
|
glVertex2d(stars[i].x, stars[i].y);
|
||||||
|
91
src/toolkit.c
Normal file
91
src/toolkit.c
Normal file
@ -0,0 +1,91 @@
|
|||||||
|
#include "log.h"
|
||||||
|
#include "pause.h"
|
||||||
|
#include "toolkit.h"
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
unsigned int id; // Unique identifier.
|
||||||
|
|
||||||
|
double x,y; // Position.
|
||||||
|
double w,h; // Dimensions.
|
||||||
|
|
||||||
|
gl_texture* t; // Possible texture.
|
||||||
|
} Window;
|
||||||
|
|
||||||
|
static unsigned int genwid = 0; // Generate unique id.
|
||||||
|
|
||||||
|
int toolkit = 0;
|
||||||
|
|
||||||
|
#define MIN_WINDOWS 3
|
||||||
|
static Window** windows = NULL;
|
||||||
|
static int nwindows = 0;
|
||||||
|
static int mwindows = 0;
|
||||||
|
|
||||||
|
// Create a window.
|
||||||
|
unsigned int window_create(int x, int y, int w, int h, gl_texture* t) {
|
||||||
|
Window* wtmp = NULL;
|
||||||
|
if(nwindows == mwindows) {
|
||||||
|
// We have reached the memory limit.
|
||||||
|
windows = realloc(windows, sizeof(Window*)*(++mwindows));
|
||||||
|
if(windows == NULL) WARN("Out of memory");
|
||||||
|
}
|
||||||
|
wtmp = malloc(sizeof(Window));
|
||||||
|
if(wtmp == NULL) WARN("Out of memory");
|
||||||
|
|
||||||
|
int wid = (++genwid); // Unique id
|
||||||
|
|
||||||
|
wtmp->id = wid;
|
||||||
|
|
||||||
|
wtmp->x = x;
|
||||||
|
wtmp->y = y;
|
||||||
|
wtmp->h = h;
|
||||||
|
wtmp->w = w;
|
||||||
|
wtmp->t = t;
|
||||||
|
|
||||||
|
windows[nwindows++] = wtmp;
|
||||||
|
|
||||||
|
if(toolkit == 0) toolkit = 1; // Enable the toolkit.
|
||||||
|
|
||||||
|
return wid;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Destroy a window.
|
||||||
|
void window_destroy(unsigned int wid) {
|
||||||
|
int i;
|
||||||
|
|
||||||
|
// Destroy the window.
|
||||||
|
for(i = 0; i < nwindows; i++)
|
||||||
|
if(windows[i]->id == wid) {
|
||||||
|
free(windows[i]);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
// Move the other windows down a layer.
|
||||||
|
for(; i<(nwindows-1); i++)
|
||||||
|
windows[i] = windows[i+1];
|
||||||
|
|
||||||
|
nwindows--;
|
||||||
|
if(nwindows == 0) toolkit = 0; // Disable the toolkit.
|
||||||
|
}
|
||||||
|
|
||||||
|
// Render the window.
|
||||||
|
void toolkit_render(void) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
// Init.
|
||||||
|
int toolkit_init(void) {
|
||||||
|
windows = malloc(sizeof(Window)*MIN_WINDOWS);
|
||||||
|
nwindows = 0;
|
||||||
|
mwindows = MIN_WINDOWS;
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Exit the toolkit.
|
||||||
|
void toolkit_exit(void) {
|
||||||
|
int i;
|
||||||
|
for(i = 0; i < nwindows; i++) {
|
||||||
|
window_destroy(windows[i]->id);
|
||||||
|
free(windows);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
18
src/toolkit.h
Normal file
18
src/toolkit.h
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
#pragma once
|
||||||
|
#include "opengl.h"
|
||||||
|
|
||||||
|
extern int toolkit;
|
||||||
|
|
||||||
|
// Creation.
|
||||||
|
unsigned int window_create(int x, int y, int w, int h, gl_texture* t);
|
||||||
|
|
||||||
|
// Destroy window.
|
||||||
|
void window_destroy(unsigned int wid);
|
||||||
|
|
||||||
|
// Render.
|
||||||
|
void toolkit_render(void);
|
||||||
|
|
||||||
|
// Init/Exit.
|
||||||
|
int toolkit_init(void);
|
||||||
|
void toolkit_exit(void);
|
||||||
|
|
20
src/weapon.c
20
src/weapon.c
@ -80,6 +80,26 @@ void weapon_minimap(const double res, const double w, const double h, const Rada
|
|||||||
}
|
}
|
||||||
#undef PIXEL
|
#undef PIXEL
|
||||||
|
|
||||||
|
// Pause/Unpause the weapon system.
|
||||||
|
void weapons_pause(void) {
|
||||||
|
int i;
|
||||||
|
unsigned int t = SDL_GetTicks();
|
||||||
|
for(i = 0; i < nwbackLayer; i++)
|
||||||
|
wbackLayer[i]->timer -= t;
|
||||||
|
for(i = 0; i < nwfrontLayer; i++)
|
||||||
|
wfrontLayer[i]->timer -= t;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void weapons_unpause(void) {
|
||||||
|
int i;
|
||||||
|
unsigned int t = SDL_GetTicks();
|
||||||
|
for(i = 0; i < nwbackLayer; i++)
|
||||||
|
wbackLayer[i]->timer += t;
|
||||||
|
for(i = 0; i < nwfrontLayer; i++)
|
||||||
|
wfrontLayer[i]->timer += t;
|
||||||
|
}
|
||||||
|
|
||||||
static void think_seeker(Weapon* w) {
|
static void think_seeker(Weapon* w) {
|
||||||
if(w->target == w->parent) return; // HEY! Self harm is not allowed.
|
if(w->target == w->parent) return; // HEY! Self harm is not allowed.
|
||||||
|
|
||||||
|
@ -8,6 +8,10 @@ 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, const WeaponLayer layer);
|
const unsigned int target, const WeaponLayer layer);
|
||||||
|
|
||||||
|
// Pausing.
|
||||||
|
void weapons_pause(void);
|
||||||
|
void weapons_unpause(void);
|
||||||
|
|
||||||
// Update.
|
// Update.
|
||||||
void weapons_update(const double dt);
|
void weapons_update(const double dt);
|
||||||
void weapons_render(const WeaponLayer layer);
|
void weapons_render(const WeaponLayer layer);
|
||||||
|
Loading…
Reference in New Issue
Block a user