mirror of
https://github.com/UberGames/RPG-X2.git
synced 2024-11-25 13:51:03 +00:00
111 lines
No EOL
5.4 KiB
Text
111 lines
No EOL
5.4 KiB
Text
Basic Concept for Weapons:
|
|
There is one or multiple Lua vms running, each with a lua file containing functions that describe the effects for all
|
|
weapons. The fx function in the code will call their corresponding Lua functions which will then create the effect.
|
|
|
|
FX functions to be implemented in Lua:
|
|
void CG_BUbbleTrail(vec3_t start, vec3_t end, float spacing)
|
|
localEnt *CG_SMokePuff(const vec3_t p, const vec3_t vel,
|
|
float radius,
|
|
float r, float g, float b, float a,
|
|
float duration,
|
|
int startTime,
|
|
int leFlags,
|
|
qhandle shader)
|
|
void CG_spawnEffect(vec3_t origin, refEnt *legs, refEnt *torso,
|
|
refEnt *head)
|
|
void CG_QFlashEvent(vec3_t org)
|
|
localEnt *CG_MakeExplosion( vec3_t origin, vec3_t dir,
|
|
qhandle hModel, qhandle shader,
|
|
int msec, float scale, qboolean isSprite)
|
|
localEnt *CG_MakeExplosion2( vec3_t origin, vec3_t dir,
|
|
qhandle hModel, int numFrames, qHandle shader
|
|
int msec, qboolean isSprite, float scale, int flags)
|
|
void CG_ExplosionEffects( vec3_t origin, int intensity, int radius)
|
|
void CG_Smoke( vec3_t position, vec3_t dir, int killTime, int radius )
|
|
void CG_Fire( vec3_t position, vec3_t direction, int killTime, int radius, int fxEnt )
|
|
void FXE_Spray (vec3_t direction, float speed, float variation, float cone, vec3_t velocity)
|
|
localEntity_t *FX_AddLine(vec3_t start, vec3_t end, float stScale, float scale, float dscale, float startalpha, float endalpha, float killTime, qhandle_t shader)
|
|
localEntity_t *FX_AddLine2(vec3_t start, vec3_t end, float stScale, float width1, float dwidth1, float width2, float dwidth2,
|
|
float startalpha, float endalpha, vec3_t startRGB, vec3_t endRGB, float killTime, qhandle_t shader)
|
|
localEntity_t *FX_AddOrientedLine(vec3_t start, vec3_t end, vec3_t normal, float stScale, float scale,
|
|
float dscale, float startalpha, float endalpha, float killTime, qhandle_t shader)
|
|
localEntity_t *FX_AddTrail( vec3_t origin, vec3_t velocity, qboolean gravity, float length, float dlength,
|
|
float scale, float dscale, float startalpha, float endalpha,
|
|
float elasticity, float killTime, qhandle_t shader)
|
|
localEntity_t *FX_AddTrail2( vec3_t origin, vec3_t velocity, qboolean gravity, float length, float dlength,
|
|
float scale, float dscale, float startalpha, float endalpha, vec3_t startRGB, vec3_t endRGB,
|
|
float elasticity, float killTime, qhandle_t shader)
|
|
localEntity_t *FX_AddSprite(vec3_t origin, vec3_t velocity, qboolean gravity, float scale, float dscale,
|
|
float startalpha, float endalpha, float roll, float elasticity,
|
|
float killTime, qhandle_t shader)
|
|
localEntity_t *FX_AddSprite2(vec3_t origin, vec3_t velocity, qboolean gravity, float scale, float dscale,
|
|
float startalpha, float endalpha, vec3_t startRGB, vec3_t endRGB, float roll, float elasticity,
|
|
float killTime, qhandle_t shader)
|
|
localEntity_t *FX_AddBezier(vec3_t start, vec3_t end, vec3_t cpoint1, vec3_t cpoint2, vec3_t cpointvel1, vec3_t cpointvel2,
|
|
vec3_t cpointacc1, vec3_t cpointacc2, float width, float killTime, qhandle_t shader)
|
|
localEntity_t *FX_AddQuad( vec3_t origin, vec3_t normal, float scale, float dscale,
|
|
float startalpha, float endalpha, float roll, float killTime, qhandle_t shader )
|
|
localEntity_t *FX_AddQuad2( vec3_t origin, vec3_t normal, float scale, float dscale, float startalpha, float endalpha,
|
|
vec3_t startRGB, vec3_t endRGB, float roll, float killTime, qhandle_t shader )
|
|
localEntity_t *FX_AddCylinder( vec3_t start,
|
|
vec3_t normal,
|
|
float height,
|
|
float dheight,
|
|
float scale,
|
|
float dscale,
|
|
float scale2,
|
|
float dscale2,
|
|
float startalpha,
|
|
float endalpha,
|
|
float killTime,
|
|
qhandle_t shader,
|
|
float bias )
|
|
localEntity_t *FX_AddElectricity( vec3_t origin, vec3_t origin2, float stScale, float scale, float dscale,
|
|
float startalpha, float endalpha, float killTime, qhandle_t shader, float deviation )
|
|
localEntity_t *FX_AddParticle( vec3_t origin, vec3_t velocity, qboolean gravity, float scale, float dscale,
|
|
float startalpha, float endalpha, float roll, float elasticity,
|
|
float killTime, qhandle_t shader, qboolean (*thinkFn)(localEntity_t *le) )
|
|
localEntity_t *FX_AddSpawner( vec3_t origin, vec3_t dir, vec3_t velocity, vec3_t user, qboolean gravity, int delay,
|
|
float variance, float killTime, qboolean (*thinkFn)(localEntity_t *le), int radius )
|
|
|
|
Weapon FX in Lua:
|
|
function AltCompressionAftereffect(local le)
|
|
local cyl;
|
|
local shader = *insert shader here*
|
|
local percentLife = 1.0 - (le.endTime() - cg.getTime()) * le.lifeRate();
|
|
local alpha = 0.6 - (0.6*percentLife);
|
|
local length = 20;
|
|
local vec2, dir2;
|
|
|
|
cyl = FX_AddCylinder( le.rentorigin(),
|
|
le.dataSpawnerDir(),
|
|
length,
|
|
0,
|
|
10,
|
|
210,
|
|
10+(30*percentLife),
|
|
210,
|
|
alpha,
|
|
15);
|
|
cyl.addFlags( *LEF_ONE_FRAME* );
|
|
|
|
qmath.VectorMA(le.rentorigin(), length*2.0, le.dataSpawnerDir(), vec2)
|
|
qmath.VectorScale(le.dataspawnerdir(), -1.0, dir2);
|
|
cyl = FX_AddCylinder( vec2,
|
|
dir2,
|
|
length,
|
|
0,
|
|
10,
|
|
210,
|
|
10+(30*percentLife),
|
|
alpha,
|
|
0.0,
|
|
500,
|
|
shader,
|
|
15);
|
|
cyl.addFlags( *LEF_ONE_FRAME* );
|
|
end
|
|
|
|
Possible drawbacks/problems:
|
|
Lua might be to slow ...
|
|
How to handle shaders (preventing multiple qhandles for one sahders)? |