![]() |
naev 0.12.6
|
Bindings for Special effects functionality from Lua. More...
#include "nlua_spfx.h"#include "array.h"#include "camera.h"#include "debris.h"#include "nlua_audio.h"#include "nlua_colour.h"#include "nlua_vec2.h"#include "nluadef.h"#include "nopenal.h"#include "ntracing.h"#include "opengl.h"#include "player.h"#include "sound.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. | |
| static int | spfxL_eq (lua_State *L) |
| Compares two spfxs to see if they are the same. | |
| static int | spfxL_getAll (lua_State *L) |
| Gets all the active spfx. | |
| static int | spfxL_new (lua_State *L) |
| Creates a new special effect. | |
| static int | spfxL_rm (lua_State *L) |
| Removes a special effect. | |
| static int | spfxL_pos (lua_State *L) |
| Gets the position of a spfx. | |
| static int | spfxL_vel (lua_State *L) |
| Gets the velocity of a spfx. | |
| static int | spfxL_setPos (lua_State *L) |
| Sets the position of a spfx. | |
| static int | spfxL_setVel (lua_State *L) |
| Sets the velocity of a spfx. | |
| static int | spfxL_sfx (lua_State *L) |
| Gets the sound effect of a spfx. | |
| static int | spfxL_data (lua_State *L) |
| Gets the data table of a spfx. | |
| static int | spfxL_debris (lua_State *L) |
| Creates a cloud of debris. | |
| static int | spfxL_nebulaColour (lua_State *L) |
| Sets the nebula colour. | |
| static int | spfx_cmp (const void *p1, const void *p2) |
| int | nlua_loadSpfx (nlua_env env) |
| Loads the spfx library. | |
| LuaSpfx_t * | lua_tospfx (lua_State *L, int ind) |
| Gets spfx at index. | |
| LuaSpfx_t * | luaL_checkspfx (lua_State *L, int ind) |
| Gets spfx at index or raises error if there is no spfx at index. | |
| 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. | |
| int | lua_isspfx (lua_State *L, int ind) |
| Checks to see if ind is a spfx. | |
| static void | spfx_cleanup (LuaSpfxData_t *ls) |
| Cleans up a special effect. | |
| void | spfxL_setSpeed (double s) |
| Sets the speed of the playing spfx sounds. | |
| void | spfxL_setSpeedVolume (double v) |
| Sets the speed volume due to autonav and the likes. | |
| static void | spfx_lock (void) |
| static void | spfx_unlock (void) |
| void | spfxL_clear (void) |
| Clears the Lua spfx. | |
| void | spfxL_exit (void) |
| void | spfxL_update (double dt) |
| Updates the spfx. | |
| static void | spfxL_renderLayer (int func, const char *funcname, double dt) |
| void | spfxL_renderbg (double dt) |
| Renders the Lua SPFX on the background. | |
| void | spfxL_rendermg (double dt) |
| Renders the Lua SPFX in the midground. | |
| void | spfxL_renderfg (double dt) |
| Renders the Lua SPFX in the foreground. | |
Variables | |
| static LuaSpfxData_t * | lua_spfx = NULL |
| List of special effects being handled. | |
| 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 31 of file nlua_spfx.c.
| #define SPFX_CLEANUP ( 1 << 5 ) |
Spfx has to be cleaned up.
Definition at line 32 of file nlua_spfx.c.
| #define SPFX_GLOBAL ( 1 << 1 ) |
Spfx sound ignores pitch changes.
Definition at line 28 of file nlua_spfx.c.
| #define SPFX_MOVING ( 1 << 3 ) |
Spfx is moving.
Definition at line 30 of file nlua_spfx.c.
| #define SPFX_RELATIVE ( 1 << 2 ) |
Spfx is relative.
Definition at line 29 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 185 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 170 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 126 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 137 of file nlua_spfx.c.
|
static |
Definition at line 156 of file nlua_spfx.c.
|
static |
Definition at line 144 of file nlua_spfx.c.
| int nlua_loadSpfx | ( | nlua_env | env | ) |
Loads the spfx library.
| env | Lua environment. |
Definition at line 113 of file nlua_spfx.c.
|
static |
Cleans up a special effect.
| ls | Special effect to clean up. |
Definition at line 206 of file nlua_spfx.c.
|
static |
Definition at line 100 of file nlua_spfx.c.
|
static |
Definition at line 615 of file nlua_spfx.c.
|
static |
Definition at line 620 of file nlua_spfx.c.
| void spfxL_clear | ( | void | ) |
Clears the Lua spfx.
Definition at line 636 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 550 of file nlua_spfx.c.
|
static |
Creates a cloud of debris.
Lua function parameter: number mass Mass of the cloud. Lua function parameter: number radius Radius of the cloud. Lua function parameter: Vec2 pos Position of the cloud. Lua function parameter: Vec2 vel Velocity of the cloud.
| L | Lua State |
Lua function: debris
Definition at line 814 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 259 of file nlua_spfx.c.
| void spfxL_exit | ( | void | ) |
Definition at line 647 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 244 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 274 of file nlua_spfx.c.
|
static |
Sets the nebula colour.
Lua usage parameter: spfx.nebulaColour( 0.3, 0.5, 0.8 ) Lua usage parameter: spfx.nebulaColour( colour.new( 0.3, 0.5, 0.8 ) )
Lua function parameter: Colour|number col Colour to set.
| L | Lua State |
Lua function: nebulaColour
Definition at line 833 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:[opt] Function|nil update Update function to use if applicable. Lua function parameter:[opt] Function|nil render_bg Background render function to use if applicable (behind ships). Lua function parameter:[opt] Function|nil render_mg Middle render function to use if applicable (infront of NPC ships, behind player). Lua function parameter:[opt] Function|nil render_fg Foregroundrender function to use if applicable (infront of player). Lua function parameter:[opt] vec2|boolean pos Position of the effect, or a boolean to indicate whether or not the effect is local. Lua function parameter:[opt] vec2 vel Velocity of the effect. Lua function parameter:[opt] audio sfx Sound effect associated with the spfx. Lua function parameter:[opt] number radius Radius to use to determine if should render. Lua function parameter:[opt] Function|nil remove Function to run when removing the outfit. Lua return parameter: spfx New spfx corresponding to the data.
| L | Lua State |
Lua function: new
Definition at line 319 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 476 of file nlua_spfx.c.
| void spfxL_renderbg | ( | double | dt | ) |
Renders the Lua SPFX on the background.
Definition at line 778 of file nlua_spfx.c.
| void spfxL_renderfg | ( | double | dt | ) |
Renders the Lua SPFX in the foreground.
Definition at line 798 of file nlua_spfx.c.
|
static |
Definition at line 717 of file nlua_spfx.c.
| void spfxL_rendermg | ( | double | dt | ) |
Renders the Lua SPFX in the midground.
Definition at line 788 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 447 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 504 of file nlua_spfx.c.
| void spfxL_setSpeed | ( | double | s | ) |
Sets the speed of the playing spfx sounds.
Definition at line 560 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 590 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 519 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 534 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 661 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 490 of file nlua_spfx.c.
|
static |
List of special effects being handled.
Definition at line 64 of file nlua_spfx.c.
|
static |
Definition at line 66 of file nlua_spfx.c.
|
static |
Definition at line 67 of file nlua_spfx.c.
|
static |
Definition at line 65 of file nlua_spfx.c.
|
static |
SpfxLua methods.
Definition at line 84 of file nlua_spfx.c.