![]() |
naev 0.12.5
|
Handles the special effects. More...
#include "spfx.h"#include "array.h"#include "camera.h"#include "conf.h"#include "debris.h"#include "log.h"#include "naev.h"#include "ndata.h"#include "nlua_shader.h"#include "nlua_spfx.h"#include "ntracing.h"#include "nxml.h"#include "opengl.h"#include "pause.h"#include "perlin.h"#include "render.h"#include "rng.h"#include "vec2.h"
Go to the source code of this file.
Data Structures | |
| struct | SPFX_Base |
| Generic special effect. More... | |
| struct | SPFX |
| An actual in-game active special effect. More... | |
Macros | |
| #define | SPFX_XML_ID "spfx" |
| #define | SHAKE_MASS ( 1. / 400. ) /** Shake mass. */ |
| #define | SHAKE_K ( 1. / 50. ) |
| #define | SHAKE_B ( 3. * sqrt( SHAKE_K * SHAKE_MASS ) ) |
| #define | HAPTIC_UPDATE_INTERVAL 0.1 |
| #define | TRAIL_UPDATE_DT 0.05 |
| #define | MELEMENT(o, s) |
| #define | MELEMENT(o, s) |
Functions | |
| static int | trailSpec_load (void) |
| Loads the trail colour sets. | |
| static int | trailSpec_parse (TrailSpec *tc, const char *file, int firstpass) |
| Parses raw values out of a "trail" element. | |
| static TrailSpec * | trailSpec_getRaw (const char *name) |
| static void | spfx_updateShake (double dt) |
| Updates the shake position. | |
| static void | spfx_updateDamage (double dt) |
| static int | spfx_base_cmp (const void *p1, const void *p2) |
| For sorting and stuff. | |
| static int | spfx_base_parse (SPFX_Base *temp, const char *filename) |
| Parses an xml node containing a SPFX. | |
| static void | spfx_base_free (SPFX_Base *effect) |
| Frees a SPFX_Base. | |
| static void | spfx_update_layer (SPFX *layer, const double dt) |
| Updates an individual spfx. | |
| static int | spfx_hapticInit (void) |
| Initializes the rumble effect. | |
| static void | spfx_hapticRumble (double mod) |
| Runs a rumble effect. | |
| static void | spfx_update_trails (double dt) |
| Updates all trails (handling dispersal/fadeout). | |
| static void | spfx_trail_update (Trail_spfx *trail, double dt) |
| Updates a trail. | |
| static void | spfx_trail_free (Trail_spfx *trail) |
| Deallocates an unreferenced, expired trail. | |
| int | spfx_get (const char *name) |
| Gets the id of an spfx based on name. | |
| int | spfx_load (void) |
| Loads the spfx stack. | |
| void | spfx_free (void) |
| Frees the spfx stack. | |
| void | spfx_add (int effect, const double px, const double py, const double vx, const double vy, int layer) |
| Creates a new special effect. | |
| void | spfx_clear (void) |
| Clears all the currently running effects. | |
| void | spfx_update (const double dt, const double real_dt) |
| Updates all the spfx. | |
| Trail_spfx * | spfx_trail_create (const TrailSpec *spec) |
| Initalizes a trail. | |
| void | spfx_trail_sample (Trail_spfx *trail, double x, double y, double z, double dx, double dy, TrailMode mode, int force) |
| Makes a trail grow. | |
| void | spfx_trail_remove (Trail_spfx *trail) |
| Removes a trail. | |
| void | spfx_trail_draw (const Trail_spfx *trail) |
| Draws a trail on screen. | |
| void | spfx_shake (double mod) |
| Increases the current rumble level. | |
| void | spfx_damage (double mod) |
| Increases the current damage level. | |
| void | spfx_setNebulaColour (double r, double g, double b) |
| Sets the nebula colour where applicable. | |
| void | spfx_cinematic (void) |
| Sets the cinematic mode. | |
| static void | spfx_renderStack (SPFX *spfx_stack) |
| void | spfx_render (int layer, double dt) |
| Renders the entire spfx layer. | |
| const TrailSpec * | trailSpec_get (const char *name) |
| Gets a trail spec by name. | |
Variables | |
| static TrailSpec * | trail_spec_stack |
| static Trail_spfx ** | trail_spfx_stack |
| static unsigned int | shake_shader_pp_id |
| static LuaShader_t | shake_shader |
| static vec2 | shake_pos = { .x = 0., .y = 0. } |
| static vec2 | shake_vel = { .x = 0., .y = 0. } |
| static double | shake_force_mod = 0. |
| static double | shake_force_mean = 0. |
| static float | shake_force_ang = 0. |
| static perlin_data_t * | shake_noise = NULL |
| SDL_Haptic * | haptic |
| unsigned int | haptic_query |
| static int | haptic_rumble = -1 |
| static SDL_HapticEffect | haptic_rumbleEffect |
| static double | haptic_lastUpdate |
| static unsigned int | damage_shader_pp_id |
| static LuaShader_t | damage_shader |
| static double | damage_strength = 0. |
| static SPFX_Base * | spfx_effects = NULL |
| static SPFX * | spfx_stack_front = NULL |
| static SPFX * | spfx_stack_middle = NULL |
| static SPFX * | spfx_stack_back = NULL |
Handles the special effects.
Definition in file spfx.c.
| #define HAPTIC_UPDATE_INTERVAL 0.1 |
| #define MELEMENT | ( | o, | |
| s ) |
| #define MELEMENT | ( | o, | |
| s ) |
| #define SHAKE_B ( 3. * sqrt( SHAKE_K * SHAKE_MASS ) ) |
| #define TRAIL_UPDATE_DT 0.05 |
| void spfx_add | ( | int | effect, |
| const double | px, | ||
| const double | py, | ||
| const double | vx, | ||
| const double | vy, | ||
| int | layer ) |
|
static |
|
static |
|
static |
| void spfx_cinematic | ( | void | ) |
| void spfx_clear | ( | void | ) |
| void spfx_damage | ( | double | mod | ) |
| int spfx_get | ( | const char * | name | ) |
|
static |
|
static |
| int spfx_load | ( | void | ) |
| void spfx_render | ( | int | layer, |
| double | dt ) |
| void spfx_setNebulaColour | ( | double | r, |
| double | g, | ||
| double | b ) |
| void spfx_shake | ( | double | mod | ) |
| Trail_spfx * spfx_trail_create | ( | const TrailSpec * | spec | ) |
| void spfx_trail_draw | ( | const Trail_spfx * | trail | ) |
|
static |
| void spfx_trail_remove | ( | Trail_spfx * | trail | ) |
| void spfx_trail_sample | ( | Trail_spfx * | trail, |
| double | x, | ||
| double | y, | ||
| double | z, | ||
| double | dx, | ||
| double | dy, | ||
| TrailMode | mode, | ||
| int | force ) |
Makes a trail grow.
| trail | Trail to update. |
| x | X position of the new control point. |
| y | Y position of the new control point. |
| z | Z position of the new control point. |
| dx | X derivative if applicable. |
| dy | Y derivative if applicable. |
| mode | Type of trail emission at this point. |
| force | Whether or not to force the addition of the sample. |
|
static |
| void spfx_update | ( | const double | dt, |
| const double | real_dt ) |
|
static |
|
static |
|
static |
| const TrailSpec * trailSpec_get | ( | const char * | name | ) |
|
static |
|
static |
|
static |
|
static |
|
static |
|
extern |
From joystick.c
Current haptic in use, externed in spfx.c.
Definition at line 21 of file joystick.c.
|
static |
|
extern |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |