mirror of
https://github.com/UberGames/RPG-X2.git
synced 2024-11-15 01:11:46 +00:00
Added/Updated Lua-descriptions (some are guesstimates, tbc)
Minor fix in g_spawn.c Signed-off-by: Harry Young <hendrik.gerritzen@googlemail.com>
This commit is contained in:
parent
65f4ec4f0f
commit
77f9f9e147
6 changed files with 82 additions and 47 deletions
Binary file not shown.
|
@ -436,7 +436,7 @@ spawn_t spawns[] = {
|
|||
// Additional ports from SP by Harry Young
|
||||
{"fx_cooking_steam", SP_fx_cooking_steam},
|
||||
{"fx_elecfire", SP_fx_electricfire},
|
||||
{"forge_bolt", SP_fx_forge_bolt},
|
||||
{"fx_forge_bolt", SP_fx_forge_bolt},
|
||||
{"fx_plasma", SP_fx_plasma},
|
||||
{"fx_energy_stream", SP_fx_stream},
|
||||
{"fx_transporter_stream", SP_fx_transporter_stream},
|
||||
|
|
|
@ -3,8 +3,8 @@
|
|||
#include "g_lua.h"
|
||||
|
||||
#ifdef G_LUA
|
||||
// qmath.abs(float num)
|
||||
// Returns the integer part of a floating point number
|
||||
// qmath.abs(float f)
|
||||
// Returns the integer part of f.
|
||||
static int Qmath_Abs(lua_State * L)
|
||||
{
|
||||
lua_pushnumber(L, fabs(luaL_checknumber(L, 1)));
|
||||
|
@ -12,7 +12,7 @@ static int Qmath_Abs(lua_State * L)
|
|||
}
|
||||
|
||||
// qmath.sin(float degree)
|
||||
// Sinus implementation, takes degree as input not radian
|
||||
// Returns the sine of degree.
|
||||
static int Qmath_Sin(lua_State * L)
|
||||
{
|
||||
lua_pushnumber(L, sin(DEG2RAD(luaL_checknumber(L, 1))));
|
||||
|
@ -20,7 +20,7 @@ static int Qmath_Sin(lua_State * L)
|
|||
}
|
||||
|
||||
// qmath.cos(float degree)
|
||||
// Cosinus implementation, takes degree as input not radian
|
||||
// Returns the cosine of degree.
|
||||
static int Qmath_Cos(lua_State * L)
|
||||
{
|
||||
lua_pushnumber(L, cos(DEG2RAD(luaL_checknumber(L, 1))));
|
||||
|
@ -28,31 +28,31 @@ static int Qmath_Cos(lua_State * L)
|
|||
}
|
||||
|
||||
// qmath.tan(float degree)
|
||||
// Tan implementation, take degree as input not radian
|
||||
// Returns the tangent of degree.
|
||||
static int Qmath_Tan(lua_State * L)
|
||||
{
|
||||
lua_pushnumber(L, tan(DEG2RAD(luaL_checknumber(L, 1))));
|
||||
return 1;
|
||||
}
|
||||
|
||||
// qmath.asin(float num)
|
||||
// asin implementation
|
||||
// qmath.asin(float f)
|
||||
// Returns the arcsine of f.
|
||||
static int Qmath_Asin(lua_State * L)
|
||||
{
|
||||
lua_pushnumber(L, RAD2DEG(asin(luaL_checknumber(L, 1))));
|
||||
return 1;
|
||||
}
|
||||
|
||||
// qmath.acos(float num)
|
||||
// acos implementation
|
||||
// qmath.acos(float f)
|
||||
// Returns the arccosine of f.
|
||||
static int Qmath_Acos(lua_State * L)
|
||||
{
|
||||
lua_pushnumber(L, RAD2DEG(acos(luaL_checknumber(L, 1))));
|
||||
return 1;
|
||||
}
|
||||
|
||||
// qmath.atan(float num)
|
||||
// atan implementation
|
||||
// qmath.atan(float f)
|
||||
// Returns the arctangent of f.
|
||||
static int Qmath_Atan(lua_State * L)
|
||||
{
|
||||
lua_pushnumber(L, RAD2DEG(atan(luaL_checknumber(L, 1))));
|
||||
|
@ -66,28 +66,33 @@ static int Qmath_Atan2(lua_State * L)
|
|||
return 1;
|
||||
}
|
||||
|
||||
// qmath.ceil(float number)
|
||||
// qmath.ceil(float f)
|
||||
// Returns the ceiled value of f.
|
||||
static int Qmath_Ceil(lua_State * L)
|
||||
{
|
||||
lua_pushnumber(L, ceil(luaL_checknumber(L, 1)));
|
||||
return 1;
|
||||
}
|
||||
|
||||
// qmath.floor(float number)
|
||||
// qmath.floor(float f)
|
||||
// Returns the floored value of f.
|
||||
static int Qmath_Floor(lua_State * L)
|
||||
{
|
||||
lua_pushnumber(L, floor(luaL_checknumber(L, 1)));
|
||||
return 1;
|
||||
}
|
||||
|
||||
// qmath.fmod(float num, float num2)
|
||||
// qmath.fmod(float f, float n)
|
||||
// Returns the remainder of f=n.
|
||||
static int Qmath_Fmod(lua_State * L)
|
||||
{
|
||||
lua_pushnumber(L, fmod(luaL_checknumber(L, 1), luaL_checknumber(L, 2)));
|
||||
return 1;
|
||||
}
|
||||
|
||||
// qmath.modf(float num)
|
||||
// qmath.modf(float f)
|
||||
// Breaks f apart into its integer part and its fractional part.
|
||||
// The fractional part is returned while the integer part is assigned to f.
|
||||
static int Qmath_Modf(lua_State * L)
|
||||
{
|
||||
double ip;
|
||||
|
@ -98,30 +103,32 @@ static int Qmath_Modf(lua_State * L)
|
|||
return 2;
|
||||
}
|
||||
|
||||
// qmath.sqrt(float number)
|
||||
// qmath.sqrt(float f)
|
||||
// Returns the square root of f.
|
||||
static int Qmath_Sqrt(lua_State * L)
|
||||
{
|
||||
lua_pushnumber(L, sqrt(luaL_checknumber(L, 1)));
|
||||
return 1;
|
||||
}
|
||||
|
||||
// qmath.pow(float num, float num2)
|
||||
// qmath.pow(float f, float n)
|
||||
// What's this??
|
||||
static int Qmath_Pow(lua_State * L)
|
||||
{
|
||||
lua_pushnumber(L, pow(luaL_checknumber(L, 1), luaL_checknumber(L, 2)));
|
||||
return 1;
|
||||
}
|
||||
|
||||
// qmath.log(float num)
|
||||
// Returns logarithm of a number
|
||||
// qmath.log(float f)
|
||||
// Returns logarithm of f.
|
||||
static int Qmath_Log(lua_State * L)
|
||||
{
|
||||
lua_pushnumber(L, log(luaL_checknumber(L, 1)));
|
||||
return 1;
|
||||
}
|
||||
|
||||
// qmath.log10(float num)
|
||||
// Returns logarithm to base 10 of a number
|
||||
// qmath.log10(float f)
|
||||
// Returns logarithm to base 10 of f.
|
||||
static int Qmath_Log10(lua_State * L)
|
||||
{
|
||||
lua_pushnumber(L, log10(luaL_checknumber(L, 1)));
|
||||
|
@ -129,6 +136,7 @@ static int Qmath_Log10(lua_State * L)
|
|||
}
|
||||
|
||||
// qmath.exp(float number)
|
||||
// What's this??
|
||||
static int Qmath_Exp(lua_State * L)
|
||||
{
|
||||
lua_pushnumber(L, exp(luaL_checknumber(L, 1)));
|
||||
|
@ -136,7 +144,7 @@ static int Qmath_Exp(lua_State * L)
|
|||
}
|
||||
|
||||
// qmath.deg(float radian)
|
||||
// Converts radian to degree
|
||||
// Converts radian to degree.
|
||||
static int Qmath_Deg(lua_State * L)
|
||||
{
|
||||
lua_pushnumber(L, RAD2DEG(luaL_checknumber(L, 1)));
|
||||
|
@ -144,14 +152,16 @@ static int Qmath_Deg(lua_State * L)
|
|||
}
|
||||
|
||||
// qmath.rad(float dgree)
|
||||
// Converts degree to radian
|
||||
// Converts degree to radian.
|
||||
static int Qmath_Rad(lua_State * L)
|
||||
{
|
||||
lua_pushnumber(L, DEG2RAD(luaL_checknumber(L, 1)));
|
||||
return 1;
|
||||
}
|
||||
|
||||
// qmath.frexp(float number)
|
||||
// qmath.frexp(float f)
|
||||
// Breaks f into its binary significant and an integral exponent for 2.
|
||||
// x = significant 2exponent
|
||||
static int Qmath_Frexp(lua_State * L)
|
||||
{
|
||||
int e;
|
||||
|
@ -162,6 +172,7 @@ static int Qmath_Frexp(lua_State * L)
|
|||
}
|
||||
|
||||
// qmath.ldexp(float f, float n)
|
||||
// Returns the result from multiplying f by 2 raised to the power of n.
|
||||
static int Qmath_Ldexp(lua_State * L)
|
||||
{
|
||||
lua_pushnumber(L, ldexp(luaL_checknumber(L, 1), luaL_checkint(L, 2)));
|
||||
|
@ -170,7 +181,7 @@ static int Qmath_Ldexp(lua_State * L)
|
|||
|
||||
|
||||
// qmath.min(int array[])
|
||||
// Returns the minimum of a list of values
|
||||
// Return the lowest value in array[].
|
||||
static int Qmath_Min(lua_State * L)
|
||||
{
|
||||
int n = lua_gettop(L); /* number of arguments */
|
||||
|
@ -189,7 +200,7 @@ static int Qmath_Min(lua_State * L)
|
|||
}
|
||||
|
||||
// qmath.max(int array[])
|
||||
// Returns the maximum of a list of numbers
|
||||
// Return the highest value in array[].
|
||||
static int Qmath_Max(lua_State * L)
|
||||
{
|
||||
int n = lua_gettop(L); /* number of arguments */
|
||||
|
@ -207,23 +218,24 @@ static int Qmath_Max(lua_State * L)
|
|||
return 1;
|
||||
}
|
||||
|
||||
// qmath.rand(void)
|
||||
// Returns a random integer
|
||||
// qmath.rand()
|
||||
// Returns a random integer.
|
||||
static int Qmath_Rand(lua_State * L)
|
||||
{
|
||||
lua_pushinteger(L, rand());
|
||||
return 1;
|
||||
}
|
||||
|
||||
// qmath.random(void)
|
||||
// Returns a random number
|
||||
// qmath.random()
|
||||
// Returns a random float.
|
||||
static int Qmath_Random(lua_State * L)
|
||||
{
|
||||
lua_pushnumber(L, random());
|
||||
return 1;
|
||||
}
|
||||
|
||||
// qmath.crandom(void)
|
||||
// qmath.crandom()
|
||||
// Returns random floats (crazy random function).
|
||||
static int Qmath_Crandom(lua_State * L)
|
||||
{
|
||||
lua_pushnumber(L, crandom());
|
||||
|
|
|
@ -4,6 +4,10 @@
|
|||
|
||||
#ifdef G_LUA
|
||||
|
||||
// sound.PlaySound(entity ent, string sound, integer chan)
|
||||
// * ent the entity the sound will be played on
|
||||
// * sound the sound file which will be played
|
||||
// * chan the sound channel the sound will be played on
|
||||
static int Sound_PlaySound(lua_State *L) {
|
||||
char *sound;
|
||||
int snd;
|
||||
|
|
|
@ -31,6 +31,14 @@ static int Trace_ToString(lua_State * L)
|
|||
return 1;
|
||||
}
|
||||
|
||||
// trace.DoTrace(vector start, vector mins, vector maxs, vector end, float passEnt, float contents)
|
||||
// Does a trace.
|
||||
// * start start-point of trace
|
||||
// * mins minimal distance of trace (nil if unused)
|
||||
// * maxs maximal distance of trace (nil if unused)
|
||||
// * end end-point of trace
|
||||
// * passEnt Number of ents to pass
|
||||
// * contents ????????
|
||||
static int Trace_DoTrace(lua_State *L) {
|
||||
trace_t *tr;
|
||||
vec_t *start, *end, *mins = NULL, *maxs = NULL;
|
||||
|
@ -59,6 +67,8 @@ static int Trace_DoTrace(lua_State *L) {
|
|||
return 1;
|
||||
}
|
||||
|
||||
// trace.FreeTrace(trace tr)
|
||||
// Ends trace-process for tr.
|
||||
static int Trace_FreeTrace(lua_State *L) {
|
||||
ltrace_t *tr;
|
||||
|
||||
|
|
|
@ -8,8 +8,8 @@
|
|||
#include "lauxlib.h"
|
||||
#include "lualib.h"
|
||||
|
||||
// vector.New(void)
|
||||
// Returns a new empty vector
|
||||
// vector.New()
|
||||
// Allocates and returns a new vector (0|0|0).
|
||||
static int Vector_New(lua_State *L) {
|
||||
vec_t *v;
|
||||
|
||||
|
@ -24,7 +24,7 @@ static int Vector_New(lua_State *L) {
|
|||
}
|
||||
|
||||
// vector.Construct(float x, float y, float z)
|
||||
// Creats a new vector with the values x,y, and z
|
||||
// Allocates and returns a new vector (x|y|z).
|
||||
static int Vector_Construct(lua_State *L) {
|
||||
vec_t *v;
|
||||
|
||||
|
@ -41,7 +41,7 @@ static int Vector_Construct(lua_State *L) {
|
|||
}
|
||||
|
||||
// vector.Set(vector v, float x, float y, float z)
|
||||
// Sets a vector to the values x, y, and z
|
||||
// Set the vector v to the specified values.
|
||||
static int Vector_Set(lua_State *L) {
|
||||
vec_t *v;
|
||||
|
||||
|
@ -55,7 +55,7 @@ static int Vector_Set(lua_State *L) {
|
|||
}
|
||||
|
||||
// vector.Clear(vector vec)
|
||||
// Clear a vector (sets it to (0 0 0))
|
||||
// Clears vector v by setting it to (0|0|0).
|
||||
static int Vector_Clear(lua_State * L)
|
||||
{
|
||||
vec_t *a;
|
||||
|
@ -68,7 +68,7 @@ static int Vector_Clear(lua_State * L)
|
|||
}
|
||||
|
||||
// vector.Vector_Add(vector a, vector b, vector c)
|
||||
// Adds a and b together and stores the result in c
|
||||
// Adds a and b together and stores the result in c.
|
||||
static int Vector_Add(lua_State *L) {
|
||||
vec_t *a, *b, *c;
|
||||
|
||||
|
@ -82,7 +82,7 @@ static int Vector_Add(lua_State *L) {
|
|||
}
|
||||
|
||||
// vector.Vector_subtract(vector a, vector b, vector c)
|
||||
// Subtracts b from a and stores the result in c
|
||||
// Subtracts b from a and stores the result in c.
|
||||
static int Vector_Subtract(lua_State *L) {
|
||||
vec_t *a, *b, *c;
|
||||
|
||||
|
@ -96,7 +96,7 @@ static int Vector_Subtract(lua_State *L) {
|
|||
}
|
||||
|
||||
// vector.Scale(vector a, float b, vector c)
|
||||
// Scales a vector by the value of b and stores the result in c
|
||||
// Scales a vector by the value of b and stores the result in c.
|
||||
static int Vector_Scale(lua_State *L) {
|
||||
vec_t *a, b, *c;
|
||||
|
||||
|
@ -109,8 +109,8 @@ static int Vector_Scale(lua_State *L) {
|
|||
return 1;
|
||||
}
|
||||
|
||||
// vector.Length(vector vec)
|
||||
// Returns the length of the vector
|
||||
// vector.Length(vector a)
|
||||
// Returns the length of a.
|
||||
static int Vector_Length(lua_State *L) {
|
||||
vec_t *a;
|
||||
vec_t len;
|
||||
|
@ -123,8 +123,8 @@ static int Vector_Length(lua_State *L) {
|
|||
return 1;
|
||||
}
|
||||
|
||||
// vector.Normalize(vector vec)
|
||||
// Normalizes the vector
|
||||
// vector.Normalize(vector a)
|
||||
// Normalizes a
|
||||
static int Vector_Normalize(lua_State *L) {
|
||||
vec_t *a;
|
||||
vec_t len;
|
||||
|
@ -149,8 +149,12 @@ static int Vector_NormalizeFast(lua_State *L) {
|
|||
return 1;
|
||||
}
|
||||
|
||||
// vector.RotatePointAround(vector destination, vector direction, vector point, vector degrees)
|
||||
// Rotate a vector around a point
|
||||
// vector.RotateAroundPoint(vector dest, vector dir, vector point, float degrees)
|
||||
// Rotates point around a given vector.
|
||||
// * dir vector around which to rotate (must be normalized)
|
||||
// * point point to be rotated
|
||||
// * degrees how many degrees to rotate the point by
|
||||
// * dest point after rotation
|
||||
static int Vector_RotatePointAround(lua_State *L) {
|
||||
vec_t *dst, *dir, *point;
|
||||
vec_t degrees;
|
||||
|
@ -165,7 +169,10 @@ static int Vector_RotatePointAround(lua_State *L) {
|
|||
return 1;
|
||||
}
|
||||
|
||||
// vector.Perpendicular(vector destination, vector source)
|
||||
// vector.Perpendicular(vector dest, vector src)
|
||||
// Finds a vector perpendicular to the source vector.
|
||||
// * src source vector
|
||||
// * dest a vector that is perpendicular to src (the result is stored here)
|
||||
static int Vector_Perpendicular(lua_State *L) {
|
||||
vec_t *dst, *src;
|
||||
|
||||
|
@ -177,6 +184,7 @@ static int Vector_Perpendicular(lua_State *L) {
|
|||
return 1;
|
||||
}
|
||||
|
||||
//What does this do?
|
||||
static int Vector_VecToAngles(lua_State *L) {
|
||||
vec_t *v, *t;
|
||||
|
||||
|
@ -188,6 +196,7 @@ static int Vector_VecToAngles(lua_State *L) {
|
|||
return 1;
|
||||
}
|
||||
|
||||
//What does this do?
|
||||
static int Vector_AngleVectors(lua_State *L) {
|
||||
vec_t *v, *fwd, *right, *up;
|
||||
|
||||
|
|
Loading…
Reference in a new issue