![]() |
naev 0.10.4
|
Bindings for Special effects functionality from Lua. More...
#include "nlua_spfx.h"#include "conf.h"#include "camera.h"#include "array.h"#include "nlua_audio.h"#include "nlua_vec2.h"#include "nluadef.h"#include "sound.h"#include "opengl.h"#include "nopenal.h"#include "player.h"Go to the source code of this file.
Data Structures | |
| struct | LuaSpfxData_t |
| Handles the special effects Lua-side. More... | |
Macros | |
| #define | SPFX_GLOBAL (1<<1) |
| #define | SPFX_RELATIVE (1<<2) |
| #define | SPFX_MOVING (1<<3) |
| #define | SPFX_AUDIO (1<<4) |
| #define | SPFX_CLEANUP (1<<5) |
Functions | |
| static int | spfxL_gc (lua_State *L) |
| Lua bindings to interact with spfx. More... | |
| static int | spfxL_eq (lua_State *L) |
| Compares two spfxs to see if they are the same. More... | |
| static int | spfxL_getAll (lua_State *L) |
| Gets all the active spfx. More... | |
| static int | spfxL_new (lua_State *L) |
| Creates a new special effect. More... | |
| static int | spfxL_rm (lua_State *L) |
| Removes a special effect. More... | |
| static int | spfxL_pos (lua_State *L) |
| Gets the position of a spfx. More... | |
| static int | spfxL_vel (lua_State *L) |
| Gets the velocity of a spfx. More... | |
| static int | spfxL_setPos (lua_State *L) |
| Sets the position of a spfx. More... | |
| static int | spfxL_setVel (lua_State *L) |
| Sets the velocity of a spfx. More... | |
| static int | spfxL_sfx (lua_State *L) |
| Gets the sound effect of a spfx. More... | |
| static int | spfxL_data (lua_State *L) |
| Gets the data table of a spfx. More... | |
| static int | spfx_cmp (const void *p1, const void *p2) |
| int | nlua_loadSpfx (nlua_env env) |
| Loads the spfx library. More... | |
| LuaSpfx_t * | lua_tospfx (lua_State *L, int ind) |
| Gets spfx at index. More... | |
| LuaSpfx_t * | luaL_checkspfx (lua_State *L, int ind) |
| Gets spfx at index or raises error if there is no spfx at index. More... | |
| static LuaSpfxData_t * | luaL_checkspfxdataNoWarn (lua_State *L, int ind) |
| static LuaSpfxData_t * | luaL_checkspfxdata (lua_State *L, int ind) |
| LuaSpfx_t * | lua_pushspfx (lua_State *L, LuaSpfx_t spfx) |
| Pushes a spfx on the stack. More... | |
| int | lua_isspfx (lua_State *L, int ind) |
| Checks to see if ind is a spfx. More... | |
| static void | spfx_cleanup (LuaSpfxData_t *ls) |
| Cleans up a special effect. More... | |
| void | spfxL_setSpeed (double s) |
| Sets the speed of the playing spfx sounds. More... | |
| void | spfxL_setSpeedVolume (double v) |
| Sets the speed volume due to autonav and the likes. More... | |
| static void | spfx_lock (void) |
| static void | spfx_unlock (void) |
| void | spfxL_clear (void) |
| Clears the Lua spfx. More... | |
| void | spfxL_exit (void) |
| void | spfxL_update (double dt) |
| Updates the spfx. More... | |
| void | spfxL_renderbg (void) |
| Renders the Lua SPFX on the background. More... | |
| void | spfxL_rendermg (void) |
| Renders the Lua SPFX in the midground. More... | |
| void | spfxL_renderfg (void) |
| Renders the Lua SPFX in the foreground. More... | |
Variables | |
| static LuaSpfxData_t * | lua_spfx = NULL |
| List of special effects being handled. More... | |
| static LuaSpfxData_t * | lua_spfx_queue = NULL |
| static int | lua_spfx_idgen = 0 |
| static int | lua_spfx_lock = 0 |
| static const luaL_Reg | spfxL_methods [] |
Bindings for Special effects functionality from Lua.
Definition in file nlua_spfx.c.
| #define SPFX_AUDIO (1<<4) |
Spfx has audio.
Definition at line 32 of file nlua_spfx.c.
| #define SPFX_CLEANUP (1<<5) |
Spfx has to be cleaned up.
Definition at line 33 of file nlua_spfx.c.
| #define SPFX_GLOBAL (1<<1) |
Spfx sound ignores pitch changes.
Definition at line 29 of file nlua_spfx.c.
| #define SPFX_MOVING (1<<3) |
Spfx is moving.
Definition at line 31 of file nlua_spfx.c.
| #define SPFX_RELATIVE (1<<2) |
Spfx is relative.
Definition at line 30 of file nlua_spfx.c.
| int lua_isspfx | ( | lua_State * | L, |
| int | ind | ||
| ) |
Checks to see if ind is a spfx.
| L | Lua state to check. |
| ind | Index position to check. |
Definition at line 174 of file nlua_spfx.c.
| LuaSpfx_t * lua_pushspfx | ( | lua_State * | L, |
| LuaSpfx_t | spfx | ||
| ) |
Pushes a spfx on the stack.
| L | Lua state to push spfx into. |
| spfx | Spfx to push. |
Definition at line 159 of file nlua_spfx.c.
| LuaSpfx_t * lua_tospfx | ( | lua_State * | L, |
| int | ind | ||
| ) |
Gets spfx at index.
| L | Lua state to get spfx from. |
| ind | Index position to find the spfx. |
Definition at line 117 of file nlua_spfx.c.
| LuaSpfx_t * luaL_checkspfx | ( | lua_State * | L, |
| int | ind | ||
| ) |
Gets spfx at index or raises error if there is no spfx at index.
| L | Lua state to get spfx from. |
| ind | Index position to find spfx. |
Definition at line 128 of file nlua_spfx.c.
|
static |
Definition at line 145 of file nlua_spfx.c.
|
static |
Definition at line 135 of file nlua_spfx.c.
| int nlua_loadSpfx | ( | nlua_env | env | ) |
Loads the spfx library.
| env | Lua environment. |
Definition at line 104 of file nlua_spfx.c.
|
static |
Cleans up a special effect.
| ls | Special effect to clean up. |
Definition at line 195 of file nlua_spfx.c.
|
static |
Definition at line 90 of file nlua_spfx.c.
|
static |
Definition at line 557 of file nlua_spfx.c.
|
static |
Definition at line 562 of file nlua_spfx.c.
| void spfxL_clear | ( | void | ) |
Clears the Lua spfx.
Definition at line 577 of file nlua_spfx.c.
|
static |
Gets the data table of a spfx.
This table is unique to each instance.
Lua function parameter: spfx s Spfx to get data table of. Lua return parameter: table Data table of the spfx.
| L | Lua State |
Lua function: data
Definition at line 500 of file nlua_spfx.c.
|
static |
Compares two spfxs to see if they are the same.
Lua function parameter: Spfx s1 Spfx 1 to compare. Lua function parameter: Spfx s2 Spfx 2 to compare. Lua return parameter: boolean true if both spfxs are the same.
| L | Lua State |
Lua function: __eq
Definition at line 246 of file nlua_spfx.c.
| void spfxL_exit | ( | void | ) |
Definition at line 587 of file nlua_spfx.c.
|
static |
Lua bindings to interact with spfx.
Lua module: spfx
Frees a spfx.
Lua function parameter: Spfx spfx Spfx to free.
| L | Lua State |
Lua function: __gc
Definition at line 231 of file nlua_spfx.c.
|
static |
Gets all the active spfx.
Lua return parameter: table A table containing all the spfx.
| L | Lua State |
Lua function: getAll
Definition at line 261 of file nlua_spfx.c.
|
static |
Creates a new special effect.
Lua usage parameter: spfx.new( 5, update, nil, nil, render, player.pos(), player.pilot():vel(), sfx ) – Play effect with update and render functions at player position/velocity Lua usage parameter: spfx.new( 10, nil, nil, nil, nil, true, nil, sfx ) – Play an effect locally (affected by time compression and autonav stuff) Lua usage parameter: spfx.new( 10, nil, nil, nil, nil, nil, nil, sfx ) – Play a global effect (not affected by time stuff )
Lua function parameter: Number ttl Time to live of the effect. Lua function parameter: Function|nil update Update function to use if applicable. Lua function parameter: Function|nil render_bg Background render function to use if applicable (behind ships). Lua function parameter: Function|nil render_mg Middle render function to use if applicable (infront of NPC ships, behind player). Lua function parameter: Function|nil render_fg Foregroundrender function to use if applicable (infront of player). Lua function parameter: vec2|boolean pos Position of the effect, or a boolean to indicate whether or not the effect is local. Lua function parameter: vec2 vel Velocity of the effect. Lua function parameter: audio sfx Sound effect associated with the spfx. Lua function parameter: number radius Radius to use to determine if should render. Lua return parameter: spfx New spfx corresponding to the data.
| L | Lua State |
Lua function: new
Definition at line 296 of file nlua_spfx.c.
|
static |
Gets the position of a spfx.
Lua function parameter: spfx s Spfx to get position of. Lua return parameter: vec2 Position of the spfx.
| L | Lua State |
Lua function: pos( s )
Definition at line 426 of file nlua_spfx.c.
| void spfxL_renderbg | ( | void | ) |
Renders the Lua SPFX on the background.
Definition at line 652 of file nlua_spfx.c.
| void spfxL_renderfg | ( | void | ) |
Renders the Lua SPFX in the foreground.
Definition at line 726 of file nlua_spfx.c.
| void spfxL_rendermg | ( | void | ) |
Renders the Lua SPFX in the midground.
Definition at line 685 of file nlua_spfx.c.
|
static |
Removes a special effect.
Lua function parameter: spfx s Spfx to remove.
| L | Lua State |
Lua function: rm
Definition at line 409 of file nlua_spfx.c.
|
static |
Sets the position of a spfx.
Lua function parameter: spfx s Spfx to set the position of. Lua function parameter: vec2 p Position to set to.
| L | Lua State |
Lua function: setPos
Definition at line 454 of file nlua_spfx.c.
| void spfxL_setSpeed | ( | double | s | ) |
Sets the speed of the playing spfx sounds.
Definition at line 510 of file nlua_spfx.c.
| void spfxL_setSpeedVolume | ( | double | v | ) |
Sets the speed volume due to autonav and the likes.
| v | Speed volume to use. |
Definition at line 536 of file nlua_spfx.c.
|
static |
Sets the velocity of a spfx.
Lua function parameter: spfx s Spfx to set the velocity of. Lua function parameter: vec2 v Velocity to set to.
| L | Lua State |
Lua function: setVel
Definition at line 469 of file nlua_spfx.c.
|
static |
Gets the sound effect of a spfx.
Lua function parameter: spfx s Spfx to get sound effect of. Lua return parameter: audio Sound effect of the spfx.
| L | Lua State |
Lua function: vel
Definition at line 484 of file nlua_spfx.c.
| void spfxL_update | ( | double | dt | ) |
Updates the spfx.
Lua function parameter: dt Delta tick to use for the update.
Definition at line 601 of file nlua_spfx.c.
|
static |
Gets the velocity of a spfx.
Lua function parameter: spfx s Spfx to get velocity of. Lua return parameter: vec2 Velocity of the spfx.
| L | Lua State |
Lua function: vel
Definition at line 440 of file nlua_spfx.c.
|
static |
List of special effects being handled.
Definition at line 58 of file nlua_spfx.c.
|
static |
Definition at line 60 of file nlua_spfx.c.
|
static |
Definition at line 61 of file nlua_spfx.c.
|
static |
Definition at line 59 of file nlua_spfx.c.
|
static |
SpfxLua methods.
Definition at line 75 of file nlua_spfx.c.