17 Sep 2007

This commit is contained in:
g-cont 2007-09-17 00:00:00 +04:00 committed by Alibek Omarov
parent 68ac8aca44
commit 704e653af6
81 changed files with 11435 additions and 3073 deletions

View File

@ -1,5 +1,5 @@
Разработать концепцию языка VirtualC\VirtualC++ (базируется на QuakeC)
Придумать новые имена (6 символов) для launcher.dll
представить func_t как структуру(возвращаемые значения и аргументы)
Quake1 Quake2
SV_MoveBounds SV_TraceBounds
@ -21,14 +21,22 @@ SV_ClipToLinks SV_ClipMoveToEntities
12. Подключить advapi динамически OK
13. Переименовать platform.dll в common.dll OK
14. Переименовать renderer.dll в render.dll OK
15. Упорядочить файлы и код в common.dll Ok
15. Упорядочить файлы и код в common.dll OK
16. Пофиксить вылет при загрузке модели игрока в меню
17. Переписать bsplib для работы в цикле
18. Полная имплементация PRVM
{
перенести параметры из sv_edict_t в sv_fields_t
упорядочить FL_ флаги OK
упорядочить entvars_t
}
//==================================================
// то, что уже готово
//==================================================
+исправлен баг с загрузкой анимированных текстур
-удален формат моделей md2
+исправлен баг с флагом RF_FULLBRIGHT для studio models в режиме RDF_NOWORLDMODEL
+существенно уменьшен размер всех лаунчеров
+новая система загрузки дллок (поддержка нативных библиотек)

View File

@ -740,7 +740,6 @@ void ParseBrush (bsp_entity_t *mapent)
side = b->original_sides + b->numsides;
side->planenum = planenum;
side->texinfo = TexinfoForBrushTexture (&mapplanes[planenum], &td, vec3_origin);
// save the td off in case there is an origin brush and we
// have to recalculate the texinfo
side_brushtextures[nummapbrushsides] = td;

View File

@ -323,7 +323,7 @@ bool PrepareBSPModel ( const char *dir, const char *name, byte params )
bool CompileBSPModel ( void )
{
//must be first!
// must be first!
if( onlyents ) WbspMain( true );
else if( onlyvis && !onlyrad ) WvisMain ( full_compile );
else if( onlyrad && !onlyvis ) WradMain( full_compile );

View File

@ -15,7 +15,7 @@ int FindMiptex (char *name)
for (i = 0; i < nummiptex; i++ )
{
if (!strcmp (name, textureref[i].name))
if (!stricmp(name, textureref[i].name))
return i;
}
if (nummiptex == MAX_MAP_TEXTURES) Sys_Error ("MAX_MAP_TEXTURES");
@ -33,11 +33,11 @@ int FindMiptex (char *name)
}
nummiptex++;
if (textureref[i].animname[0])
if (textureref[i].animname[0])
{
Msg("animname %s\n", textureref[i].animname );
FindMiptex(textureref[i].animname);
}
MsgDev(D_INFO, "FindMiptex: animation chain \"%s->%s\"\n", textureref[i].name, textureref[i].animname );
FindMiptex(textureref[i].name);
}
return i;
}
@ -189,17 +189,15 @@ int TexinfoForBrushTexture (plane_t *plane, brush_texture_t *bt, vec3_t origin)
// find the texinfo
tc = texinfo;
for (i=0 ; i<numtexinfo ; i++, tc++)
for (i = 0; i < numtexinfo; i++, tc++)
{
if (tc->flags != tx.flags)
continue;
if (tc->value != tx.value)
continue;
for (j=0 ; j<2 ; j++)
if (tc->flags != tx.flags) continue;
if (tc->value != tx.value) continue;
for (j = 0; j < 2; j++)
{
if (strcmp (tc->texture, tx.texture))
if (stricmp (tc->texture, tx.texture))
goto skip;
for (k=0 ; k<4 ; k++)
for (k = 0; k < 4; k++)
{
if (tc->vecs[j][k] != tx.vecs[j][k])
goto skip;
@ -214,15 +212,13 @@ skip:;
// load the next animation
mt = FindMiptex (bt->name);
if (textureref[mt].animname)
if (textureref[mt].animname[0])
{
anim = *bt;
strcpy (anim.name, textureref[mt].animname);
tc->nexttexinfo = TexinfoForBrushTexture (plane, &anim, origin);
}
else
tc->nexttexinfo = -1;
else tc->nexttexinfo = -1;
return i;
}

View File

@ -54,7 +54,7 @@ BSC32=bscmake.exe
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386 /opt:nowin98
# ADD LINK32 msvcrt.lib winmm.lib /nologo /dll /pdb:none /machine:I386 /nodefaultlib:"libc.lib" /opt:nowin98
# ADD LINK32 msvcrt.lib winmm.lib user32.lib /nologo /dll /pdb:none /machine:I386 /nodefaultlib:"libc.lib" /opt:nowin98
# Begin Custom Build
TargetDir=\XASH3D\src_main\!source\temp\common\!release
InputPath=\XASH3D\src_main\!source\temp\common\!release\common.dll
@ -90,7 +90,7 @@ BSC32=bscmake.exe
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept
# ADD LINK32 msvcrt.lib winmm.lib /nologo /dll /debug /machine:I386 /nodefaultlib:"msvcrtd.lib" /pdbtype:sept
# ADD LINK32 msvcrt.lib winmm.lib user32.lib /nologo /dll /debug /machine:I386 /nodefaultlib:"msvcrtd.lib" /pdbtype:sept
# SUBTRACT LINK32 /incremental:no /nodefaultlib
# Begin Custom Build
TargetDir=\XASH3D\src_main\!source\temp\common\!debug
@ -113,14 +113,6 @@ SOURCE="$(InputPath)"
# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
# Begin Source File
SOURCE=.\common\memory.c
# End Source File
# Begin Source File
SOURCE=.\common\utils.c
# End Source File
# Begin Source File
SOURCE=.\bsplib\brushbsp.c
# End Source File
# Begin Source File
@ -161,6 +153,10 @@ SOURCE=.\bsplib\map.c
# End Source File
# Begin Source File
SOURCE=.\common\memory.c
# End Source File
# Begin Source File
SOURCE=.\bsplib\patches.c
# End Source File
# Begin Source File
@ -233,6 +229,10 @@ SOURCE=.\bsplib\tree.c
# End Source File
# Begin Source File
SOURCE=.\common\utils.c
# End Source File
# Begin Source File
SOURCE=.\bsplib\winding.c
# End Source File
# Begin Source File
@ -249,14 +249,6 @@ SOURCE=.\common\ziplib.c
# PROP Default_Filter "h;hpp;hxx;hm;inl"
# Begin Source File
SOURCE=.\common\memory.h
# End Source File
# Begin Source File
SOURCE=.\common\utils.h
# End Source File
# Begin Source File
SOURCE=.\common\blankframe.h
# End Source File
# Begin Source File
@ -273,6 +265,10 @@ SOURCE=.\common\mdllib.h
# End Source File
# Begin Source File
SOURCE=.\common\memory.h
# End Source File
# Begin Source File
SOURCE=.\platform.h
# End Source File
# Begin Source File
@ -285,6 +281,10 @@ SOURCE=..\public\ref_system.h
# End Source File
# Begin Source File
SOURCE=.\common\utils.h
# End Source File
# Begin Source File
SOURCE=.\common\zip32.h
# End Source File
# End Group

View File

@ -1333,31 +1333,22 @@ static int enter;
void ThreadLock (void)
{
if (!threaded) return;
if (enter)
{
MsgWarn("ThreadLock: recursive call\n");
return;
}
EnterCriticalSection (&crit);
if (enter) Sys_Error ("Recursive ThreadLock\n");
enter = 1;
}
void ThreadUnlock (void)
{
if (!threaded) return;
if (!enter)
{
MsgWarn("ThreadUnlock: must call ThreadLock first\n");
return;
}
if (!enter) Sys_Error ("ThreadUnlock without lock\n");
enter = 0;
LeaveCriticalSection (&crit);
}
int GetThreadWork (void)
{
int r;
int f;
int r, f;
ThreadLock ();
@ -1367,7 +1358,7 @@ int GetThreadWork (void)
return -1;
}
f = 10*dispatch / workcount;
f = 10 * dispatch / workcount;
if (f != oldf)
{
oldf = f;
@ -1397,7 +1388,7 @@ void ThreadSetDefault (void)
{
if (numthreads == -1) // not set manually
{
//NOTE: we must init Plat_InitCPU() first
// NOTE: we must init Plat_InitCPU() first
numthreads = GI.cpunum;
if (numthreads < 1 || numthreads > MAX_THREADS)
numthreads = 1;
@ -1418,9 +1409,8 @@ RunThreadsOn
*/
void RunThreadsOn (int workcnt, bool showpacifier, void(*func)(int))
{
int threadid[MAX_THREADS];
int i, threadid[MAX_THREADS];
HANDLE threadhandle[MAX_THREADS];
int i;
double start, end;
start = Plat_DoubleTime();
@ -1433,16 +1423,17 @@ void RunThreadsOn (int workcnt, bool showpacifier, void(*func)(int))
// run threads in parallel
InitializeCriticalSection (&crit);
if (numthreads == 1) func (0); // use same thread
if (numthreads == 1) func(0); // use same thread
else
{
for (i = 0;i < numthreads; i++)
for (i = 0; i < numthreads; i++)
{
threadhandle[i] = CreateThread( NULL, 0, (LPTHREAD_START_ROUTINE)func, (LPVOID)i, 0, &threadid[i]);
}
for (i = 0; i < numthreads; i++)
{
WaitForSingleObject (threadhandle[i], INFINITE);
}
}
DeleteCriticalSection (&crit);

View File

@ -389,7 +389,7 @@ void CL_LoadClientinfo (clientinfo_t *ci, char *s)
{
sprintf (model_filename, "models/players/gordon/player.mdl");
sprintf (weapon_filename, "models/weapons/w_glock.mdl");
strcpy (ci->iconname, "textures/base_menu/i_fixme.pcx");
strcpy (ci->iconname, "i_fixme.pcx");
ci->model = re->RegisterModel (model_filename);
memset(ci->weaponmodel, 0, sizeof(ci->weaponmodel));
ci->weaponmodel[0] = re->RegisterModel (weapon_filename);
@ -436,7 +436,7 @@ void CL_LoadClientinfo (clientinfo_t *ci, char *s)
}
// icon file
strcpy (ci->iconname, "textures/base_menu/i_fixme.pcx");
strcpy (ci->iconname, "i_fixme.pcx");
ci->icon = re->RegisterPic (ci->iconname);
}

View File

@ -125,7 +125,7 @@ void CL_ClipMoveToEntities ( vec3_t start, vec3_t mins, vec3_t maxs, vec3_t end,
if (trace.allsolid || trace.startsolid ||
trace.fraction < tr->fraction)
{
trace.ent = (struct edict_s *)ent;
trace.ent = (edict_t *)ent;
if (tr->startsolid)
{
*tr = trace;
@ -145,14 +145,13 @@ void CL_ClipMoveToEntities ( vec3_t start, vec3_t mins, vec3_t maxs, vec3_t end,
CL_PMTrace
================
*/
trace_t CL_PMTrace (vec3_t start, vec3_t mins, vec3_t maxs, vec3_t end)
trace_t CL_PMTrace (vec3_t start, vec3_t mins, vec3_t maxs, vec3_t end)
{
trace_t t;
// check against world
t = CM_BoxTrace (start, end, mins, maxs, 0, MASK_PLAYERSOLID);
if (t.fraction < 1.0)
t.ent = (struct edict_s *)1;
if (t.fraction < 1.0) t.ent = (edict_t *)1;
// check all other solid models
CL_ClipMoveToEntities (start, mins, maxs, end, &t);
@ -160,7 +159,7 @@ trace_t CL_PMTrace (vec3_t start, vec3_t mins, vec3_t maxs, vec3_t end)
return t;
}
int CL_PMpointcontents (vec3_t point)
int CL_PMpointcontents (vec3_t point)
{
int i;
entity_state_t *ent;

View File

@ -131,7 +131,7 @@ int COM_CheckParm (char *parm);
void COM_Init (void);
void COM_InitArgv (int argc, char **argv);
char *CopyString (char *in);
char *CopyString (const char *in);
//============================================================================
@ -406,7 +406,7 @@ void Cmd_AddCommand (char *cmd_name, xcommand_t function);
// as a clc_stringcmd instead of executed locally
void Cmd_RemoveCommand (char *cmd_name);
bool Cmd_Exists (char *cmd_name);
bool Cmd_Exists (const char *cmd_name);
// used by the cvar code to check for cvar / command name overlap
char *Cmd_CompleteCommand (char *partial);
@ -420,11 +420,11 @@ char *Cmd_Args (void);
// functions. Cmd_Argv () will return an empty string, not a NULL
// if arg > argc, so string operations are always safe.
void Cmd_TokenizeString (char *text, bool macroExpand);
void Cmd_TokenizeString (const char *text, bool macroExpand);
// Takes a null terminated string. Does not need to be /n terminated.
// breaks the string up into arg tokens.
void Cmd_ExecuteString (char *text);
void Cmd_ExecuteString (const char *text);
// Parses a single line of text into arguments and tries to execute it
// as if it was typed at the console

View File

@ -538,7 +538,7 @@ char *Cmd_Args (void)
Cmd_MacroExpandString
======================
*/
char *Cmd_MacroExpandString (char *text)
char *Cmd_MacroExpandString (const char *text)
{
int i, j, count, len;
bool inquote;
@ -548,7 +548,7 @@ char *Cmd_MacroExpandString (char *text)
char *token, *start;
inquote = false;
scan = text;
scan = (char *)text;
len = strlen (scan);
if (len >= MAX_STRING_CHARS)
@ -613,7 +613,7 @@ Parses the given string into command line tokens.
$Cvars will be expanded unless they are in a quoted token
============
*/
void Cmd_TokenizeString (char *text, bool macroExpand)
void Cmd_TokenizeString (const char *text, bool macroExpand)
{
int i;
char *token;
@ -741,7 +741,7 @@ void Cmd_RemoveCommand (char *cmd_name)
Cmd_Exists
============
*/
bool Cmd_Exists (char *cmd_name)
bool Cmd_Exists (const char *cmd_name)
{
cmd_function_t *cmd;
@ -800,7 +800,7 @@ A complete command line has been parsed, so try to execute it
FIXME: lookupnoadd the token to speed search?
============
*/
void Cmd_ExecuteString (char *text)
void Cmd_ExecuteString (const char *text)
{
cmd_function_t *cmd;
cmdalias_t *a;

View File

@ -148,7 +148,7 @@ void COM_InitArgv (int argc, char **argv)
srand(time(NULL)); // init random generator
}
char *CopyString (char *in)
char *CopyString (const char *in)
{
char *out;

View File

@ -28,7 +28,7 @@ cvar_t *cvar_vars;
Cvar_InfoValidate
============
*/
static bool Cvar_InfoValidate (char *s)
static bool Cvar_InfoValidate (const char *s)
{
if (strstr (s, "\\"))
return false;
@ -44,11 +44,11 @@ static bool Cvar_InfoValidate (char *s)
Cvar_FindVar
============
*/
cvar_t *Cvar_FindVar (char *var_name)
cvar_t *Cvar_FindVar (const char *var_name)
{
cvar_t *var;
for (var=cvar_vars ; var ; var=var->next)
for (var = cvar_vars; var; var = var->next)
if (!strcmp (var_name, var->name))
return var;
@ -60,13 +60,12 @@ cvar_t *Cvar_FindVar (char *var_name)
Cvar_VariableValue
============
*/
float Cvar_VariableValue (char *var_name)
float Cvar_VariableValue (const char *var_name)
{
cvar_t *var;
var = Cvar_FindVar (var_name);
if (!var)
return 0;
if (!var) return 0;
return atof (var->string);
}
@ -76,13 +75,12 @@ float Cvar_VariableValue (char *var_name)
Cvar_VariableString
============
*/
char *Cvar_VariableString (char *var_name)
char *Cvar_VariableString (const char *var_name)
{
cvar_t *var;
var = Cvar_FindVar (var_name);
if (!var)
return "";
if (!var) return "";
return var->string;
}
@ -95,7 +93,7 @@ Cvar_CompleteVariable
char *Cvar_CompleteVariable (char *partial)
{
cvar_t *cvar;
int len;
int len;
len = strlen(partial);
@ -124,7 +122,7 @@ If the variable already exists, the value will not be set
The flags will be or'ed in if the variable exists.
============
*/
cvar_t *Cvar_Get (char *var_name, char *var_value, int flags)
cvar_t *Cvar_Get (const char *var_name, const char *var_value, int flags)
{
cvar_t *var;
@ -176,15 +174,12 @@ cvar_t *Cvar_Get (char *var_name, char *var_value, int flags)
Cvar_Set2
============
*/
cvar_t *Cvar_Set2 (char *var_name, char *value, bool force)
cvar_t *Cvar_Set2 (const char *var_name, const char *value, bool force)
{
cvar_t *var;
var = Cvar_FindVar (var_name);
if (!var)
{ // create it
return Cvar_Get (var_name, value, 0);
}
if (!var) return Cvar_Get (var_name, value, 0); // create it
if (var->flags & (CVAR_USERINFO | CVAR_SERVERINFO))
{
@ -244,13 +239,13 @@ cvar_t *Cvar_Set2 (char *var_name, char *value, bool force)
var->modified = true;
if (var->flags & CVAR_USERINFO)
userinfo_modified = true; // transmit at next oportunity
// transmit at next oportunity
if (var->flags & CVAR_USERINFO) userinfo_modified = true;
Z_Free (var->string); // free the old value string
Z_Free (var->string); // free the old value string
var->string = CopyString(value);
var->value = atof (var->string);
var->value = atof(var->string);
return var;
}
@ -260,7 +255,7 @@ cvar_t *Cvar_Set2 (char *var_name, char *value, bool force)
Cvar_ForceSet
============
*/
cvar_t *Cvar_ForceSet (char *var_name, char *value)
cvar_t *Cvar_ForceSet (const char *var_name, const char *value)
{
return Cvar_Set2 (var_name, value, true);
}
@ -270,7 +265,7 @@ cvar_t *Cvar_ForceSet (char *var_name, char *value)
Cvar_Set
============
*/
cvar_t *Cvar_Set (char *var_name, char *value)
cvar_t *Cvar_Set (const char *var_name, const char *value)
{
return Cvar_Set2 (var_name, value, false);
}
@ -352,14 +347,13 @@ Handles variable inspection and changing from the console
*/
bool Cvar_Command (void)
{
cvar_t *v;
cvar_t *v;
// check variables
// check variables
v = Cvar_FindVar (Cmd_Argv(0));
if (!v)
return false;
if (!v) return false;
// perform a variable print or set
// perform a variable print or set
if (Cmd_Argc() == 1)
{
Msg ("\"%s\" is \"%s\"\n", v->name, v->string);
@ -392,10 +386,8 @@ void Cvar_Set_f (void)
if (c == 4)
{
if (!strcmp(Cmd_Argv(3), "u"))
flags = CVAR_USERINFO;
else if (!strcmp(Cmd_Argv(3), "s"))
flags = CVAR_SERVERINFO;
if (!strcmp(Cmd_Argv(3), "u")) flags = CVAR_USERINFO;
else if (!strcmp(Cmd_Argv(3), "s")) flags = CVAR_SERVERINFO;
else
{
Msg ("flags can only be 'u' or 's'\n");
@ -403,8 +395,7 @@ void Cvar_Set_f (void)
}
Cvar_FullSet (Cmd_Argv(1), Cmd_Argv(2), flags);
}
else
Cvar_Set (Cmd_Argv(1), Cmd_Argv(2));
else Cvar_Set (Cmd_Argv(1), Cmd_Argv(2));
}
@ -475,7 +466,7 @@ void Cvar_List_f (void)
bool userinfo_modified;
char *Cvar_BitInfo (int bit)
char *Cvar_BitInfo (int bit)
{
static char info[MAX_INFO_STRING];
cvar_t *var;
@ -491,13 +482,13 @@ char *Cvar_BitInfo (int bit)
}
// returns an info string containing all the CVAR_USERINFO cvars
char *Cvar_Userinfo (void)
char *Cvar_Userinfo (void)
{
return Cvar_BitInfo (CVAR_USERINFO);
}
// returns an info string containing all the CVAR_SERVERINFO cvars
char *Cvar_Serverinfo (void)
char *Cvar_Serverinfo (void)
{
return Cvar_BitInfo (CVAR_SERVERINFO);
}

View File

@ -6,17 +6,17 @@
#define CVAR_H
extern cvar_t *cvar_vars;
cvar_t *Cvar_FindVar (char *var_name);
cvar_t *Cvar_FindVar (const char *var_name);
cvar_t *Cvar_Get (char *var_name, char *value, int flags);
cvar_t *Cvar_Get (const char *var_name, const char *value, int flags);
// creates the variable if it doesn't exist, or returns the existing one
// if it exists, the value will not be changed, but flags will be ORed in
// that allows variables to be unarchived without needing bitflags
cvar_t *Cvar_Set (char *var_name, char *value);
cvar_t *Cvar_Set (const char *var_name, const char *value);
// will create the variable if it doesn't exist
cvar_t *Cvar_ForceSet (char *var_name, char *value);
cvar_t *Cvar_ForceSet (const char *var_name, const char *value);
// will set the variable even if NOSET or LATCH
cvar_t *Cvar_FullSet (char *var_name, char *value, int flags);
@ -24,10 +24,10 @@ cvar_t *Cvar_FullSet (char *var_name, char *value, int flags);
void Cvar_SetValue (char *var_name, float value);
// expands value to a string and calls Cvar_Set
float Cvar_VariableValue (char *var_name);
float Cvar_VariableValue (const char *var_name);
// returns 0 if not defined or non numeric
char *Cvar_VariableString (char *var_name);
char *Cvar_VariableString (const char *var_name);
// returns an empty string if not defined
char *Cvar_CompleteVariable (char *partial);

View File

@ -142,5 +142,7 @@ void Key_Init (void);
void Key_WriteBindings (file_t *f);
void Key_SetBinding (int keynum, char *binding);
void Key_ClearStates (void);
char *Key_KeynumToString (int keynum);
int Key_StringToKeynum (char *str);
int Key_GetKey (void);

View File

@ -3275,7 +3275,7 @@ void PlayerConfig_MenuDraw( void )
re->RenderFrame( &refdef );
strcpy( scratch, "textures/base_menu/i_fixme.pcx" );
strcpy( scratch, "i_fixme.pcx" );
re->DrawPic( s_player_config_menu.x - 40, refdef.y, scratch );
}
}

387
engine/common/progsvm.h Normal file
View File

@ -0,0 +1,387 @@
/*
Copyright (C) 1996-1997 Id Software, Inc.
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
/*
This is a try to make the vm more generic, it is mainly based on the progs.h file.
For the license refer to progs.h.
Generic means, less as possible hard-coded links with the other parts of the engine.
This means no edict_engineprivate struct usage, etc.
The code uses void pointers instead.
*/
#ifndef PROGSVM_H
#define PROGSVM_H
#include "vprogs.h" // defs shared with qcc
#include "progdefs.h" // generated by program cdefs
#include "sv_edict.h"
typedef struct prvm_stack_s
{
int s;
mfunction_t *f;
} prvm_stack_t;
// virtual typedef
typedef union prvm_eval_s
{
int edict;
int _int;
float _float;
float vector[3];
int ivector[3];
func_t function;
string_t string;
} prvm_eval_t;
//with this the crc isn't needed for fields.
typedef struct prvm_fieldvars_s
{
int ofs;
int type;
const char *name;
} prvm_fieldvars_t;
typedef struct edict_state_s
{
bool free;
float freetime;
} vm_edict_t;
struct edict_s
{
// engine-private fields (stored in dynamically resized array)
union
{
vm_edict_t *ed; // vm edict state
void *vp; // generic edict
sv_edict_t *sv; // sv edict state
} priv;
// QuakeC prog fields (stored in dynamically resized array)
union
{
void *vp; // generic entvars
entvars_t *sv; // server entvars
} progs;
};
#define PRVM_GETEDICTFIELDVALUE(ed, fieldoffset) (fieldoffset ? (prvm_eval_t *)((unsigned char *)ed->progs.vp + fieldoffset) : NULL)
#define PRVM_GETGLOBALFIELDVALUE(fieldoffset) (fieldoffset ? (prvm_eval_t *)((unsigned char *)prog->globals.generic + fieldoffset) : NULL)
#define PRVM_FE_CLASSNAME 8
#define PRVM_FE_CHAIN 4
#define PRVM_OP_STATE 1
#define PRVM_MAX_STACK_DEPTH 1024
#define PRVM_LOCALSTACK_SIZE 16384
#define PRVM_MAX_OPENFILES 256
#define PRVM_MAX_OPENSEARCHES 128
typedef void (*prvm_builtin_t) (void);
// [INIT] variables flagged with this token can be initialized by 'you'
// NOTE: external code has to create and free the mempools but everything else is done by prvm !
typedef struct prvm_prog_s
{
dprograms_t *progs;
mfunction_t *functions;
char *strings;
int stringssize;
ddef_t *fielddefs;
ddef_t *globaldefs;
dstatement_t *statements;
int edict_size; // in bytes
int edictareasize; // in bytes (for bound checking)
int pev_save; // used by PRVM_PUSH_GLOBALS\PRVM_POP_GLOBALS
int other_save; // used by PRVM_PUSH_GLOBALS\PRVM_POP_GLOBALS
int *statement_linenums;// NULL if not available
double *statement_profile; // only incremented if prvm_statementprofiling is on
union
{
float *generic;
globalvars_t *server;
} globals;
int maxknownstrings;
int numknownstrings;
// this is updated whenever a string is removed or added
// (simple optimization of the free string search)
int firstfreeknownstring;
const char **knownstrings;
byte *knownstrings_freeable;
const char ***stringshash;
// all memory allocations related to this vm_prog (code, edicts, strings)
byte *progs_mempool; // [INIT]
prvm_builtin_t *builtins; // [INIT]
int numbuiltins; // [INIT]
int argc;
int trace;
mfunction_t *xfunction;
int xstatement;
// stacktrace writes into stack[MAX_STACK_DEPTH]
// thus increase the array, so depth wont be overwritten
prvm_stack_t stack[PRVM_MAX_STACK_DEPTH + 1];
int depth;
int localstack[PRVM_LOCALSTACK_SIZE];
int localstack_used;
word filecrc;
//============================================================================
// until this point everything also exists (with the pr_ prefix) in the old vm
file_t *openfiles[PRVM_MAX_OPENFILES];
search_t *opensearches[PRVM_MAX_OPENSEARCHES];
// copies of some vars that were former read from sv
int num_edicts;
// number of edicts for which space has been (should be) allocated
int max_edicts; // [INIT]
// used instead of the constant MAX_EDICTS
int limit_edicts; // [INIT]
// number of reserved edicts (allocated from 1)
int reserved_edicts; // [INIT]
edict_t *edicts;
void *edictsfields;
void *edictprivate;
// size of the engine private struct
int edictprivate_size; // [INIT]
// has to be updated every frame - so the vm time is up-to-date
// AK changed so time will point to the time field (if there is one) else it points to _time
// actually should be double, but qc doesnt support it
float *time;
float _time;
// allow writing to world entity fields, this is set by server init and
// cleared before first server frame
bool protect_world;
// name of the prog, e.g. "Server", "Client" or "Menu" (used for text output)
char *name; // [INIT]
// flag - used to store general flags like PRVM_GE_SELF, etc.
int flag;
char *extensionstring; // [INIT]
bool loadintoworld; // [INIT]
// used to indicate whether a prog is loaded
bool loaded;
//============================================================================
ddef_t *self; // if self != 0 then there is a global self
//============================================================================
// function pointers
void (*begin_increase_edicts)(void); // [INIT] used by PRVM_MEM_Increase_Edicts
void (*end_increase_edicts)(void); // [INIT]
void (*init_edict)(edict_t *edict); // [INIT] used by PRVM_ED_ClearEdict
void (*free_edict)(edict_t *ed); // [INIT] used by PRVM_ED_Free
void (*count_edicts)(void); // [INIT] used by PRVM_ED_Count_f
bool (*load_edict)(edict_t *ent); // [INIT] used by PRVM_ED_LoadFromFile
void (*init_cmd)(void); // [INIT] used by PRVM_InitProg
void (*reset_cmd)(void); // [INIT] used by PRVM_ResetProg
void (*error_cmd)(const char *format, ...); // [INIT]
} prvm_prog_t;
extern prvm_prog_t *prog;
enum
{
PRVM_SERVERPROG = 0,
PRVM_CLIENTPROG,
PRVM_MENUPROG,
PRVM_MAXPROGS, // must be last
};
extern prvm_prog_t prvm_prog_list[PRVM_MAXPROGS];
//============================================================================
// prvm_cmds part
extern prvm_builtin_t vm_sv_builtins[];
extern prvm_builtin_t vm_cl_builtins[];
extern prvm_builtin_t vm_m_builtins[];
extern const int vm_sv_numbuiltins;
extern const int vm_cl_numbuiltins;
extern const int vm_m_numbuiltins;
extern char * vm_sv_extensions;
extern char * vm_cl_extensions;
extern char * vm_m_extensions;
void VM_SV_Cmd_Init(void);
void VM_SV_Cmd_Reset(void);
void VM_CL_Cmd_Init(void);
void VM_CL_Cmd_Reset(void);
void VM_M_Cmd_Init(void);
void VM_M_Cmd_Reset(void);
void VM_Cmd_Init(void);
void VM_Cmd_Reset(void);
//============================================================================
void PRVM_Init (void);
void PRVM_ExecuteProgram (func_t fnum, const char *errormessage);
#define PRVM_Alloc(buffersize) _PRVM_Alloc(buffersize, __FILE__, __LINE__)
#define PRVM_Free(buffer) _PRVM_Free(buffer, __FILE__, __LINE__)
#define PRVM_FreeAll() _PRVM_FreeAll(__FILE__, __LINE__)
void *_PRVM_Alloc (size_t buffersize, const char *filename, int fileline);
void _PRVM_Free (void *buffer, const char *filename, int fileline);
void _PRVM_FreeAll (const char *filename, int fileline);
void PRVM_Profile (int maxfunctions, int mininstructions);
void PRVM_Profile_f (void);
void PRVM_PrintFunction_f (void);
void PRVM_PrintState(void);
void PRVM_CrashAll (void);
void PRVM_Crash (void);
int PRVM_ED_FindFieldOffset(const char *field);
int PRVM_ED_FindGlobalOffset(const char *global);
ddef_t *PRVM_ED_FindField (const char *name);
ddef_t *PRVM_ED_FindGlobal (const char *name);
mfunction_t *PRVM_ED_FindFunction (const char *name);
func_t PRVM_ED_FindFunctionOffset(const char *function);
void PRVM_MEM_IncreaseEdicts(void);
edict_t *PRVM_ED_Alloc (void);
void PRVM_ED_Free (edict_t *ed);
void PRVM_ED_ClearEdict (edict_t *e);
void PRVM_PrintFunctionStatements (const char *name);
void PRVM_ED_Print(edict_t *ed);
void PRVM_ED_Write (file_t *f, edict_t *ed);
const char *PRVM_ED_ParseEdict (const char *data, edict_t *ent);
void PRVM_ED_WriteGlobals (file_t *f);
void PRVM_ED_ParseGlobals (const char *data);
void PRVM_ED_LoadFromFile (const char *data);
edict_t *PRVM_EDICT_NUM_ERROR(int n, char *filename, int fileline);
#define PRVM_EDICT_NUM(n) (((n) >= 0 && (n) < prog->max_edicts) ? prog->edicts + (n) : PRVM_EDICT_NUM_ERROR(n, __FILE__, __LINE__))
#define PRVM_EDICT_NUM_UNSIGNED(n) (((n) < prog->max_edicts) ? prog->edicts + (n) : PRVM_EDICT_NUM_ERROR(n, __FILE__, __LINE__))
#define PRVM_NUM_FOR_EDICT(e) ((int)((edict_t *)(e) - prog->edicts))
#define PRVM_NEXT_EDICT(e) ((e) + 1)
#define PRVM_EDICT_TO_PROG(e) (PRVM_NUM_FOR_EDICT(e))
#define PRVM_PROG_TO_EDICT(n) (PRVM_EDICT_NUM(n))
#define PRVM_PUSH_GLOBALS prog->pev_save = prog->globals.server->pev, prog->other_save = prog->globals.server->other
#define PRVM_POP_GLOBALS prog->globals.server->pev = prog->pev_save, prog->globals.server->other = prog->other_save
//============================================================================
#define PRVM_G_FLOAT(o) (prog->globals.generic[o])
#define PRVM_G_INT(o) (*(int *)&prog->globals.generic[o])
#define PRVM_G_EDICT(o) (PRVM_PROG_TO_EDICT(*(int *)&prog->globals.generic[o]))
#define PRVM_G_EDICTNUM(o) PRVM_NUM_FOR_EDICT(PRVM_G_EDICT(o))
#define PRVM_G_VECTOR(o) (&prog->globals.generic[o])
#define PRVM_G_STRING(o) (PRVM_GetString(*(string_t *)&prog->globals.generic[o]))
//#define PRVM_G_FUNCTION(o) (*(func_t *)&prog->globals.generic[o])
// FIXME: make these go away?
#define PRVM_E_FLOAT(e,o) (((float*)e->progs.vp)[o])
#define PRVM_E_INT(e,o) (((int*)e->progs.vp)[o])
//#define PRVM_E_VECTOR(e,o) (&((float*)e->progs.vp)[o])
#define PRVM_E_STRING(e,o) (PRVM_GetString(*(string_t *)&((float*)e->progs.vp)[o]))
extern int prvm_type_size[8]; // for consistency : I think a goal of this sub-project is to
// make the new vm mostly independent from the old one, thus if it's necessary, I copy everything
void PRVM_Init_Exec(void);
void PRVM_ED_PrintEdicts_f (void);
void PRVM_ED_PrintNum (int ent);
const char *PRVM_GetString(int num);
int PRVM_SetEngineString(const char *s);
int PRVM_AllocString(size_t bufferlength, char **pointer);
void PRVM_FreeString(int num);
//============================================================================
#define PRVM_Begin
#define PRVM_End prog = 0
#define PRVM_NAME (prog->name ? prog->name : "unnamed.dat")
// helper macro to make function pointer calls easier
#define PRVM_GCALL(func) if(prog->func) prog->func
#define PRVM_ERROR prog->error_cmd
// other prog handling functions
bool PRVM_SetProgFromString(const char *str);
void PRVM_SetProg(int prognr);
/*
Initializing a vm:
Call InitProg with the num
Set up the fields marked with [INIT] in the prog struct
Load a program with LoadProgs
*/
void PRVM_InitProg(int prognr);
// LoadProgs expects to be called right after InitProg
void PRVM_LoadProgs (const char *filename, int numrequiredfunc, char **required_func, int numrequiredfields, prvm_fieldvars_t *required_field);
void PRVM_ResetProg(void);
bool PRVM_ProgLoaded(int prognr);
int PRVM_GetProgNr(void);
void VM_Warning(const char *fmt, ...);
void VM_Error(const char *fmt, ...);
// TODO: fill in the params
//void PRVM_Create();
#endif

3150
engine/common/vm_cmds.c Normal file

File diff suppressed because it is too large Load Diff

343
engine/common/vm_cmds.h Normal file
View File

@ -0,0 +1,343 @@
// AK
// Basically every vm builtin cmd should be in here.
// All 3 builtin and extension lists can be found here
// cause large (I think they will) parts are from pr_cmds the same copyright like in pr_cmds
// also applies here
/*
============================================================================
common cmd list:
=================
checkextension(string)
error(...[string])
objerror(...[string)
print(...[strings])
bprint(...[string])
sprint(float clientnum,...[string])
centerprint(...[string])
vector normalize(vector)
float vlen(vector)
float vectoyaw(vector)
vector vectoangles(vector)
float random()
cmd(string)
float cvar (string)
cvar_set (string,string)
dprint(...[string])
string ftos(float)
float fabs(float)
string vtos(vector)
string etos(entity)
float stof(...[string])
entity spawn()
remove(entity e)
entity find(entity start, .string field, string match)
entity findfloat(entity start, .float field, float match)
entity findentity(entity start, .entity field, entity match)
entity findchain(.string field, string match)
entity findchainfloat(.string field, float match)
entity findchainentity(.string field, entity match)
string precache_file(string)
string precache_sound (string sample)
coredump()
traceon()
traceoff()
eprint(entity e)
float rint(float)
float floor(float)
float ceil(float)
entity nextent(entity)
float sin(float)
float cos(float)
float sqrt(float)
vector randomvec()
float registercvar (string name, string value, float flags)
float min(float a, float b, ...[float])
float max(float a, float b, ...[float])
float bound(float min, float value, float max)
float pow(float a, float b)
copyentity(entity src, entity dst)
float fopen(string filename, float mode)
fclose(float fhandle)
string fgets(float fhandle)
fputs(float fhandle, string s)
float strlen(string s)
string strcat(string,string,...[string])
string substring(string s, float start, float length)
vector stov(string s)
string strzone(string s)
strunzone(string s)
float tokenize(string s)
string argv(float n)
float isserver()
float clientcount()
float clientstate()
clientcommand(float client, string s) (for client and menu)
changelevel(string map)
localsound(string sample)
vector getmousepos()
float gettime()
loadfromdata(string data)
loadfromfile(string file)
parseentitydata(entity ent, string data)
float mod(float val, float m)
const string cvar_string (string)
crash()
stackdump()
float search_begin(string pattern, float caseinsensitive, float quiet)
void search_end(float handle)
float search_getsize(float handle)
string search_getfilename(float handle, float num)
string chr(float ascii)
float itof(intt ent)
entity ftoe(float num)
-------will be removed soon----------
float altstr_count(string)
string altstr_prepare(string)
string altstr_get(string,float)
string altstr_set(string altstr, float num, string set)
string altstr_ins(string altstr, float num, string set)
--------------------------------------
entity findflags(entity start, .float field, float match)
entity findchainflags(.float field, float match)
perhaps only : Menu : WriteMsg
===============================
WriteByte(float data, float dest, float desto)
WriteChar(float data, float dest, float desto)
WriteShort(float data, float dest, float desto)
WriteLong(float data, float dest, float desto)
WriteAngle(float data, float dest, float desto)
WriteCoord(float data, float dest, float desto)
WriteString(string data, float dest, float desto)
WriteEntity(entity data, float dest, float desto)
Client & Menu : draw functions & video functions
===================================================
float iscachedpic(string pic)
string precache_pic(string pic)
freepic(string s)
float drawcharacter(vector position, float character, vector scale, vector rgb, float alpha, float flag)
float drawstring(vector position, string text, vector scale, vector rgb, float alpha, float flag)
float drawpic(vector position, string pic, vector size, vector rgb, float alpha, float flag)
float drawfill(vector position, vector size, vector rgb, float alpha, float flag)
==============================================================================
menu cmd list:
===============
setkeydest(float dest)
float getkeydest()
setmousetarget(float target)
float getmousetarget()
callfunction(...,string function_name)
writetofile(float fhandle, entity ent)
float isfunction(string function_name)
vector getresolution(float number)
string keynumtostring(float keynum)
string findkeysforcommand(string command)
float getserverliststat(float type)
string getserverliststring(float fld, float hostnr)
float stringtokeynum(string key)
resetserverlistmasks()
setserverlistmaskstring(float mask, float fld, string str)
setserverlistmasknumber(float mask, float fld, float num, float op)
resortserverlist()
setserverlistsort(float field, float descending)
refreshserverlist()
float getserverlistnumber(float fld, float hostnr)
float getserverlistindexforkey(string key)
addwantedserverlistkey(string key)
*/
#include "engine.h"
#include "server.h"
#include "progdefs.h"
#include "progsvm.h"
//============================================================================
// nice helper macros
#ifndef VM_NOPARMCHECK
#define VM_SAFEPARMCOUNT(p,f) if(prog->argc != p) PRVM_ERROR(#f " wrong parameter count (" #p " expected ) !")
#else
#define VM_SAFEPARMCOUNT(p,f)
#endif
#define VM_RETURN_EDICT(e) (((int *)prog->globals.generic)[OFS_RETURN] = PRVM_EDICT_TO_PROG(e))
#define e10 NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL
#define e100 e10,e10,e10,e10,e10,e10,e10,e10,e10,e10
#define e1000 e100,e100,e100,e100,e100,e100,e100,e100,e100,e100
#define VM_STRINGTEMP_BUFFERS 16
#define VM_STRINGTEMP_LENGTH MAX_INPUTLINE
// builtins and other general functions
char *VM_GetTempString(void);
void VM_CheckEmptyString (const char *s);
void VM_VarString(int first, char *out, int outlength);
void VM_checkextension (void);
void VM_error (void);
void VM_objerror (void);
void VM_print (void);
void VM_bprint (void);
void VM_sprint (void);
void VM_centerprint (void);
void VM_normalize (void);
void VM_vlen (void);
void VM_vectoyaw (void);
void VM_vectoangles (void);
void VM_random (void);
void VM_localsound(void);
void VM_break (void);
void VM_localcmd (void);
void VM_cvar (void);
void VM_cvar_string(void);
void VM_cvar_set (void);
void VM_dprint (void);
void VM_ftos (void);
void VM_fabs (void);
void VM_vtos (void);
void VM_etos (void);
void VM_stof(void);
void VM_itof(void);
void VM_ftoe(void);
void VM_spawn (void);
void VM_remove (void);
void VM_find (void);
void VM_findfloat (void);
void VM_findchain (void);
void VM_findchainfloat (void);
void VM_findflags (void);
void VM_findchainflags (void);
void VM_precache_file (void);
void VM_precache_error (void);
void VM_precache_sound (void);
void VM_coredump (void);
void VM_stackdump (void);
void VM_crash(void); // REMOVE IT
void VM_traceon (void);
void VM_traceoff (void);
void VM_eprint (void);
void VM_rint (void);
void VM_floor (void);
void VM_ceil (void);
void VM_nextent (void);
void VM_changelevel (void);
void VM_sin (void);
void VM_cos (void);
void VM_sqrt (void);
void VM_randomvec (void);
void VM_registercvar (void);
void VM_min (void);
void VM_max (void);
void VM_bound (void);
void VM_pow (void);
void VM_copyentity (void);
void VM_Files_Init(void);
void VM_Files_CloseAll(void);
void VM_fopen(void);
void VM_fclose(void);
void VM_fgets(void);
void VM_fputs(void);
// used by M_WriteToFile
// should be only called from a builtin
file_t *VM_GetFileHandle( int index );
void VM_strlen(void);
void VM_strcat(void);
void VM_substring(void);
void VM_stov(void);
void VM_strzone(void);
void VM_strunzone(void);
void VM_clcommand (void);
void VM_tokenize (void);
void VM_argv (void);
void VM_isserver(void);
void VM_clientcount(void);
void VM_getmousepos(void);
void VM_gettime(void);
void VM_loadfromdata(void);
void VM_parseentitydata(void);
void VM_loadfromfile(void);
void VM_modulo(void);
void VM_search_begin(void);
void VM_search_end(void);
void VM_search_getsize(void);
void VM_search_getfilename(void);
void VM_chr(void);
void VM_iscachedpic(void);
void VM_precache_pic(void);
void VM_freepic(void);
void VM_drawcharacter(void);
void VM_drawstring(void);
void VM_drawpic(void);
void VM_drawfill(void);
void VM_drawsetcliparea(void);
void VM_drawresetcliparea(void);
void VM_getimagesize(void);
void VM_vectorvectors (void);
void VM_keynumtostring (void);
void VM_stringtokeynum (void);
void VM_cin_open( void );
void VM_cin_close( void );
void VM_cin_setstate( void );
void VM_cin_getstate( void );
void VM_cin_restart( void );
void VM_drawline (void);
void VM_R_PolygonBegin (void);
void VM_R_PolygonVertex (void);
void VM_R_PolygonEnd (void);
void VM_bitshift (void);
void VM_altstr_count( void );
void VM_altstr_prepare( void );
void VM_altstr_get( void );
void VM_altstr_set( void );
void VM_altstr_ins(void);
void VM_buf_create(void);
void VM_buf_del (void);
void VM_buf_getsize (void);
void VM_buf_copy (void);
void VM_buf_sort (void);
void VM_buf_implode (void);
void VM_bufstr_get (void);
void VM_bufstr_set (void);
void VM_bufstr_add (void);
void VM_bufstr_free (void);
void VM_Cmd_Init(void);
void VM_Cmd_Reset(void);

1944
engine/common/vm_edict.c Normal file

File diff suppressed because it is too large Load Diff

1121
engine/common/vm_exec.c Normal file

File diff suppressed because it is too large Load Diff

View File

@ -300,6 +300,18 @@ SOURCE=.\vid_dll.c
SOURCE=.\vid_menu.c
# End Source File
# Begin Source File
SOURCE=.\common\vm_cmds.c
# End Source File
# Begin Source File
SOURCE=.\common\vm_edict.c
# End Source File
# Begin Source File
SOURCE=.\common\vm_exec.c
# End Source File
# End Group
# Begin Group "Header Files"
@ -350,6 +362,14 @@ SOURCE=..\public\platform.h
# End Source File
# Begin Source File
SOURCE=.\progdefs.h
# End Source File
# Begin Source File
SOURCE=.\common\progsvm.h
# End Source File
# Begin Source File
SOURCE=.\common\qmenu.h
# End Source File
# Begin Source File
@ -372,6 +392,10 @@ SOURCE=.\sound.h
SOURCE=.\common\vid.h
# End Source File
# Begin Source File
SOURCE=.\common\vm_cmds.h
# End Source File
# End Group
# End Target
# End Project

View File

@ -23,7 +23,7 @@
#include "sprite.h"
#include "bspmodel.h"
#include <ref_system.h>
#include "bspmodel.h"
#include "vprogs.h"
#include "const.h"
#include "common.h"
#include "cvar.h"
@ -127,6 +127,7 @@ filesystem manager
#define FS_FileBase( x, y ) Com->Fs.FileBase( x, y )
#define FS_Find( x ) Com->Fs.Search( x, false )
#define FS_Printf Com->Fs.Printf
#define FS_Print Com->Fs.Print
#define FS_Seek Com->Fs.Seek
#define FS_Tell Com->Fs.Tell
#define FS_Gets Com->Fs.Gets
@ -199,4 +200,12 @@ System utilites
*/
void Sys_Error( const char *msg, ... );
//
// in_win.c
//
extern int mouse_x, mouse_y, old_mouse_x, old_mouse_y, mx_accum, my_accum;
// vm_exec.c
void PRVM_Init (void);
#endif//ENGINE_H

View File

@ -106,6 +106,7 @@ void Host_Init (char *funcname, int argc, char **argv)
Cmd_Init ();
Cvar_Init ();
Key_Init ();
PRVM_Init();
// we need to add the early commands twice, because
// a basedir or cddir needs to be set before execing

183
engine/progdefs.h Normal file
View File

@ -0,0 +1,183 @@
#ifndef PROGDEFS_H
#define PROGDEFS_H
typedef struct globalvars_s
{
int pad[28]; // parms offsets
// pointers to ents
int pev; // Pointer EntVars (same as self)
int other;
int world;
// timer
float time;
float frametime;
// map global info
string_t mapname; // map name
string_t startspot; // landmark name (new map position - get by name)
vec3_t spotoffset; // landmark offset (old map position)
// gameplay modes
float deathmatch;
float coop;
float teamplay;
float serverflags; //server flags
// game info
float total_secrets;
float total_monsters;
float found_secrets;
float killed_monsters;
// AngleVectors result
vec3_t v_forward;
vec3_t v_right;
vec3_t v_up;
// SV_trace result
float trace_allsolid;
float trace_startsolid;
float trace_fraction;
vec3_t trace_endpos;
vec3_t trace_plane_normal;
float trace_plane_dist;
float trace_hitgroup; // studio model hitgroup number
float trace_contents;
int trace_ent;
float trace_flags; // misc info
// game_export_s
func_t main; // Init
func_t StartFrame; // RunFrame
func_t EndFrame; // EndFrame
func_t PlayerPreThink; // ClientThink
func_t PlayerPostThink; // ClientThink
func_t ClientKill; // ???
func_t ClientConnect; // ClientConnect
func_t PutClientInServer; // ClientBegin
func_t ClientDisconnect; // ClientDisconnect
func_t SetNewParms; // ???
func_t SetChangeParms; // ???
} globalvars_t;
typedef struct entvars_s
{
// base entity info
string_t classname;
string_t globalname;
float modelindex;
// physics description
vec3_t origin;
vec3_t angles;
vec3_t velocity;
vec3_t avelocity;
vec3_t post_origin;
vec3_t post_angles;
vec3_t post_velocity;
vec3_t post_avelocity;
vec3_t origin_offset;
vec3_t angles_offset;
float bouncetype;
float movetype;
float solid;
vec3_t absmin, absmax;
vec3_t mins, maxs;
vec3_t size;
// entity base description
int chain; // dynamic list of all ents
string_t model;
float frame;
float sequence;
float renderfx;
float effects;
float skin;
float body;
string_t weaponmodel;
float weaponframe;
// base generic funcs
func_t use;
func_t touch;
func_t think;
func_t blocked;
func_t activate;
// npc generic funcs
func_t walk;
func_t jump;
func_t duck;
// flags
float flags;
float aiflags;
float spawnflags;
// other variables
int groundentity;
float nextthink;
float takedamage;
float health;
float frags;
float weapon;
float items;
string_t target;
string_t parent;
string_t targetname;
int aiment; // attachment edict
int goalentity;
vec3_t punchangle;
float deadflag;
vec3_t view_ofs; //int viewheight;
float button0;
float button1;
float button2;
float impulse;
float fixangle;
vec3_t v_angle;
float idealpitch;
string_t netname;
int enemy;
float colormap;
float team;
float max_health;
float teleport_time;
float armortype;
float armorvalue;
float waterlevel;
float watertype;
float ideal_yaw;
float yaw_speed;
float dmg_take;
float dmg_save;
int dmg_inflictor;
int owner;
vec3_t movedir;
string_t message;
float sounds;
string_t noise;
string_t noise1;
string_t noise2;
string_t noise3;
float jumpup;
float jumpdn;
int movetarget;
float mass;
float density;
float gravity;
float dmg;
float dmgtime;
float speed;
} entvars_t;
#define PROG_CRC_SERVER 63599
#endif//PROGDEFS_H

View File

@ -1,191 +0,0 @@
// game.h -- game dll information visible to server
#include "savefile.h"
#define GAME_API_VERSION 3
#define FL_TRACKTRAIN 0x00008000
// edict->svflags
#define SVF_NOCLIENT 0x00000001 // don't send entity to clients, even if it has effects
#define SVF_DEADMONSTER 0x00000002 // treat as CONTENTS_DEADMONSTER for collision
#define SVF_MONSTER 0x00000004 // treat as CONTENTS_MONSTER for collision
#define AI_NOSTEP 0x00000400
#define AI_DUCKED 0x00000800
#define AI_ACTOR 0x00040000
// edict->solid values
typedef enum
{
SOLID_NOT, // no interaction with other objects
SOLID_TRIGGER, // only touch when inside, after moving
SOLID_BBOX, // touch on edge
SOLID_BSP // bsp clip, touch on edge
} solid_t;
typedef enum {
F_INT,
F_FLOAT,
F_LSTRING, // string on disk, pointer in memory, TAG_LEVEL
F_GSTRING, // string on disk, pointer in memory, TAG_GAME
F_VECTOR,
F_ANGLEHACK,
F_EDICT, // index on disk, pointer in memory
F_ITEM, // index on disk, pointer in memory
F_CLIENT, // index on disk, pointer in memory
F_FUNCTION,
F_MMOVE,
F_IGNORE
} fieldtype_t;
typedef struct
{
char *name;
int ofs;
fieldtype_t type;
int flags;
} field_t;
typedef struct
{
char *name;
void (*spawn)(edict_t *ent);
} spawn_t;
//===============================================================
// link_t is only used for entity area links now
typedef struct link_s
{
struct link_s *prev, *next;
} link_t;
#define MAX_ENT_CLUSTERS 16
struct gclient_s
{
player_state_t ps; // communicated by server to clients
int ping;
pmove_state_t old_pmove; // for detecting out-of-pmove changes
vec3_t v_angle; // aiming direction
vec3_t oldviewangles;
vec3_t oldvelocity;
float bobtime; // so off-ground doesn't change it
// the game dll can add anything it wants after
// this point in the structure
};
typedef struct monsterinfo_s
{
int aiflags;
float jumpup;
float jumpdn;
void (*jump)(edict_t *self);
} monsterinfo_t;
struct edict_s
{
entity_state_t s;
struct gclient_s *client;
bool inuse;
int linkcount;
// FIXME: move these fields to a server private sv_entity_t
link_t area; // linked to a division node or leaf
int num_clusters; // if -1, use headnode instead
int clusternums[MAX_ENT_CLUSTERS];
int headnode; // unused if num_clusters != -1
int areanum, areanum2;
//================================
int svflags; // SVF_NOCLIENT, SVF_DEADMONSTER, SVF_MONSTER, etc
vec3_t mins, maxs;
vec3_t absmin, absmax, size;
solid_t solid;
int clipmask;
edict_t *owner;
// added for engine
char *classname;
int spawnflags;
int movetype;
int flags;
char *model;
float freetime; // sv.time when the object was freed
vec3_t velocity;
vec3_t avelocity;
vec3_t origin_offset;
int health;
float nextthink;
void (*prethink) (edict_t *ent);
void (*think)(edict_t *self);
void (*blocked)(edict_t *self, edict_t *other); //move to moveinfo?
void (*touch)(edict_t *self, edict_t *other, cplane_t *plane, csurface_t *surf);
void (*use)(edict_t *self, edict_t *other, edict_t *activator);
edict_t *enemy;
edict_t *goalentity;
edict_t *movetarget;
float teleport_time;
int watertype;
int waterlevel;
int viewheight;
monsterinfo_t monsterinfo;
vec3_t movedir;
edict_t *groundentity;
int groundentity_linkcount;
int mass;
float gravity_debounce_time;
float gravity;
int takedamage;
int dmg;
vec3_t move_origin;
vec3_t move_angles;
vec3_t oldvelocity;
float speed;
float density;
float volume; // precalculated size scale
float bob; // bobbing in water amplitude
float duration;
int bobframe;
int bouncetype;
};
typedef struct game_export_s
{
edict_t *edicts;
int edict_size;
int client_size;
int num_edicts; // current number, <= max_edicts
int max_edicts;
} game_export_t;
//dll handle

View File

@ -18,102 +18,95 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
// server.h
#ifndef SERVER_H
#define SERVER_H
//define PARANOID // speed sapping error checking
#include "ref_server.h"
#include "progsvm.h"
#include "vm_cmds.h"
//=============================================================================
typedef struct
#define MAX_MASTERS 8 // max recipients for heartbeat packets
#define LATENCY_COUNTS 16
#define RATE_MESSAGES 10
typedef enum
{
gclient_t *clients; // [maxclients]
int maxclients;
int maxentities;
bool autosaved;
} game_locals_t;
#define MAX_MASTERS 8 // max recipients for heartbeat packets
typedef enum {
ss_dead, // no map loaded
ss_loading, // spawning level edicts
ss_game, // actively running
ss_dead, // no map loaded
ss_loading, // spawning level edicts
ss_game, // actively running
ss_cinematic,
ss_demo,
ss_pic
} server_state_t;
// some qc commands are only valid before the server has finished
// initializing (precache commands, static sounds / objects, etc)
typedef enum
{
cs_free, // can be reused for a new connection
cs_zombie, // client has been disconnected, but don't reuse connection for a couple seconds
cs_connected, // has been assigned to a client_t, but not in game yet
cs_spawned // client is fully in game
} client_state_t;
typedef struct
{
server_state_t state; // precache commands are only valid during load
server_state_t state; // precache commands are only valid during load
bool attractloop; // running cinematics and demos for the local system only
bool loadgame; // client begins should reuse existing entity
bool attractloop; // running cinematics and demos for the local system only
bool loadgame; // client begins should reuse existing entity
float time; // always sv.framenum * 100 msec
float time; // always sv.framenum * 100 msec
int framenum;
float frametime;
char name[MAX_QPATH]; // map name, or cinematic name
struct cmodel_s *models[MAX_MODELS];
char name[MAX_QPATH]; // map name, or cinematic name
struct cmodel_s *models[MAX_MODELS];
char configstrings[MAX_CONFIGSTRINGS][MAX_QPATH];
entity_state_t baselines[MAX_EDICTS];
// the multicast buffer is used to send a message to a set of clients
// it is only used to marshall data until SV_Message is called
sizebuf_t multicast;
sizebuf_t multicast;
byte multicast_buf[MAX_MSGLEN];
// demo server information
file_t *demofile;
bool timedemo; // don't time sync
byte *mempool;
float lastchecktime;
int lastcheck;
// global
edict_t **edicts; // [max_edicts]
gclient_t *clients; // [maxclients]
bool autosaved;
} server_t;
#define EDICT_NUM(n) ((edict_t *)((byte *)ge->edicts + ge->edict_size * (n) ))
#define NUM_FOR_EDICT(e) ( ((byte *)(e) - (byte *)ge->edicts ) / ge->edict_size)
typedef enum
{
cs_free, // can be reused for a new connection
cs_zombie, // client has been disconnected, but don't reuse
// connection for a couple seconds
cs_connected, // has been assigned to a client_t, but not in game yet
cs_spawned // client is fully in game
} client_state_t;
typedef struct
{
int areabytes;
byte areabits[MAX_MAP_AREAS/8]; // portalarea visibility bits
player_state_t ps;
int num_entities;
int first_entity; // into the circular sv_packet_entities[]
float senttime; // for ping calculations
} client_frame_t;
int areabytes;
byte areabits[MAX_MAP_AREAS/8]; // portalarea visibility bits
player_state_t ps;
int num_entities;
int first_entity; // into the circular sv_packet_entities[]
float senttime; // for ping calculations
#define LATENCY_COUNTS 16
#define RATE_MESSAGES 10
} client_frame_t;
typedef struct client_s
{
client_state_t state;
char userinfo[MAX_INFO_STRING]; // name, etc
char userinfo[MAX_INFO_STRING]; // name, etc
int lastframe; // for delta compression
int lastframe; // for delta compression
usercmd_t lastcmd; // for filling in big drops
int commandMsec; // every seconds this is reset, if user
// commands exhaust it, assume time cheating
// commands exhaust it, assume time cheating
int frame_latency[LATENCY_COUNTS];
int ping;
@ -122,7 +115,7 @@ typedef struct client_s
int rate;
int surpressCount; // number of messages rate supressed
edict_t *edict; // EDICT_NUM(clientnum+1)
edict_t *edict; // EDICT_NUM(clientnum+1)
char name[32]; // extracted from userinfo, high bits masked
int messagelevel; // for filtering printed messages
@ -133,25 +126,27 @@ typedef struct client_s
client_frame_t frames[UPDATE_BACKUP]; // updates can be delta'd from here
byte *download; // file being downloaded
byte *download; // file being downloaded
int downloadsize; // total bytes (can't use EOF because of paks)
int downloadcount; // bytes sent
float lastmessage; // sv.framenum when packet was last received
float lastconnect;
int challenge; // challenge of this user, randomly generated
int challenge; // challenge of this user, randomly generated
netchan_t netchan;
} client_t;
// a client can leave the server in one of four ways:
// dropping properly by quiting or disconnecting
// timing out if no valid messages are received for timeout.value seconds
// getting kicked off by the server operator
// a program error, like an overflowed reliable buffer
//=============================================================================
/*
=============================================================================
a client can leave the server in one of four ways:
dropping properly by quiting or disconnecting
timing out if no valid messages are received for timeout.value seconds
getting kicked off by the server operator
a program error, like an overflowed reliable buffer
=============================================================================
*/
// MAX_CHALLENGES is made large to prevent a denial
// of service attack that could cycle all of them
@ -163,21 +158,21 @@ typedef struct
netadr_t adr;
int challenge;
float time;
} challenge_t;
} challenge_t;
typedef struct
{
bool initialized; // sv_init has completed
float realtime; // always increasing, no clamping, etc
bool initialized; // sv_init has completed
float realtime; // always increasing, no clamping, etc
char mapcmd[MAX_TOKEN_CHARS]; // ie: *intro.cin+base
char comment[MAX_TOKEN_CHARS]; // map name, e.t.c.
int spawncount; // incremented each server start
// used to check late spawns
int spawncount; // incremented each server start
// used to check late spawns
client_t *clients; // [maxclients->value];
client_t *clients; // [maxclients->value];
int num_client_entities; // maxclients->value*UPDATE_BACKUP*MAX_PACKET_ENTITIES
int next_client_entities; // next client_entity to use
entity_state_t *client_entities; // [num_client_entities]
@ -197,45 +192,40 @@ typedef struct
extern netadr_t net_from;
extern sizebuf_t net_message;
extern netadr_t master_adr[MAX_MASTERS]; // address of the master server
extern netadr_t master_adr[MAX_MASTERS]; // address of the master server
extern server_static_t svs; // persistant server info
extern server_t sv; // local server
extern server_static_t svs; // persistant server info
extern server_t sv; // local server
extern cvar_t *sv_paused;
extern cvar_t *maxclients;
extern cvar_t *sv_noreload; // don't reload level state when reentering
extern cvar_t *sv_noreload; // don't reload level state when reentering
extern cvar_t *sv_airaccelerate; // don't reload level state when reentering
extern cvar_t *sv_maxvelocity;
extern cvar_t *sv_gravity;
// development tool
// development tool
extern cvar_t *sv_enforcetime;
extern client_t *sv_client;
extern edict_t *sv_player;
extern game_locals_t game;
//===========================================================
//
// sv_main.c
//
void SV_FinalMessage (char *message, bool reconnect);
void SV_DropClient (client_t *drop);
int SV_ModelIndex (char *name);
int SV_SoundIndex (char *name);
int SV_ImageIndex (char *name);
int SV_ModelIndex (const char *name);
int SV_SoundIndex (const char *name);
int SV_ImageIndex (const char *name);
void SV_WriteClientdataToMessage (client_t *client, sizebuf_t *msg);
void SV_ExecuteUserCommand (char *s);
void SV_InitOperatorCommands (void);
void SV_SendServerinfo (client_t *client);
void SV_UserinfoChanged (client_t *cl);
void Master_Heartbeat (void);
void Master_Packet (void);
@ -244,7 +234,9 @@ void Master_Packet (void);
//
void SV_InitGame (void);
void SV_Map (bool attractloop, char *levelstring, char *savename, bool loadgame);
void SV_VM_Setup(void);
void SV_VM_Begin(void);
void SV_VM_End(void);
//
// sv_phys.c
@ -260,15 +252,13 @@ void SV_CheckGround (edict_t *ent);
typedef enum {RD_NONE, RD_CLIENT, RD_PACKET} redirect_t;
#define SV_OUTPUTBUF_LENGTH (MAX_MSGLEN - 16)
extern char sv_outputbuf[SV_OUTPUTBUF_LENGTH];
extern char sv_outputbuf[SV_OUTPUTBUF_LENGTH];
void SV_FlushRedirect (int sv_redirected, char *outputbuf);
void SV_DemoCompleted (void);
void SV_SendClientMessages (void);
void SV_StartSound (vec3_t origin, edict_t *entity, int channel,
int soundindex, float volume,
float attenuation, float timeofs);
void SV_StartSound (vec3_t origin, edict_t *entity, int channel, int index, float vol, float attn, float timeofs);
void SV_ClientPrintf (client_t *cl, int level, char *fmt, ...);
void SV_BroadcastPrintf (int level, char *fmt, ...);
void SV_BroadcastCommand (char *fmt, ...);
@ -290,38 +280,29 @@ void SV_Status_f (void);
void SV_WriteFrameToClient (client_t *client, sizebuf_t *msg);
void SV_RecordDemoMessage (void);
void SV_BuildClientFrame (client_t *client);
void SV_FatPVS ( vec3_t org );
void SV_Error (char *error, ...);
//
// sv_game.c
//
extern game_export_t *ge;
void SV_InitGameProgs (void);
void SV_ShutdownGameProgs (void);
void SV_InitEdict (edict_t *e);
// misc game funcs
void PF_error (char *fmt, ...);
void PF_Configstring (int index, char *val);
void PF_setmodel (edict_t *ent, char *name);
void PF_cprintf (edict_t *ent, int level, char *fmt, ...);
bool PF_inPVS (vec3_t p1, vec3_t p2);
void PF_StartSound (edict_t *entity, int channel, int sound_num, float volume, float attenuation, float timeofs);
void SV_ConfigString (int index, const char *val);
void SV_SetModel (edict_t *ent, const char *name);
bool PF_inpvs (vec3_t p1, vec3_t p2);
//
// sv_studio.c
//
byte *SV_GetModelPtr(edict_t *ent);
int SV_StudioExtractBbox( studiohdr_t *phdr, int sequence, float *mins, float *maxs );
//
// sv_spawn.c
//
void SV_SpawnEntities (char *mapname, char *entities, char *spawnpoint);
void SV_FreeEdict (edict_t *ed);
void SV_InitEdict (edict_t *e);
@ -338,7 +319,6 @@ void SV_TouchTriggers (edict_t *ent);
//
// sv_save.c
//
void SV_WriteSaveFile( char *name );
void SV_ReadSaveFile( char *name );
void SV_ReadLevelFile( char *name );
@ -347,7 +327,6 @@ void SV_ReadLevelFile( char *name );
//
// high level object sorting to reduce interaction tests
//
void SV_ClearWorld (void);
// called after the world model has been loaded, before linking any entities
@ -389,4 +368,5 @@ trace_t SV_Trace (vec3_t start, vec3_t mins, vec3_t maxs, vec3_t end, edict_t *p
// if the starting point is in a solid, it will be allowed to move out
// to an open area
// passedict is explicitly excluded from clipping checks (normally NULL)
// passedict is explicitly excluded from clipping checks (normally NULL)
#endif//SERVER_H

View File

@ -174,7 +174,7 @@ void SV_GameMap_f (void)
char *map;
int i;
client_t *cl;
bool *savedInuse;
bool *savedFree;
if (Cmd_Argc() != 2)
{
@ -189,22 +189,22 @@ void SV_GameMap_f (void)
// save the map just exited
if (sv.state == ss_game)
{
// clear all the client inuse flags before saving so that
// clear all the client free flags before saving so that
// when the level is re-entered, the clients will spawn
// at spawn points instead of occupying body shells
savedInuse = Z_Malloc(maxclients->value * sizeof(bool));
savedFree = Z_Malloc(maxclients->value * sizeof(bool));
for (i = 0, cl = svs.clients; i < maxclients->value; i++, cl++)
{
savedInuse[i] = cl->edict->inuse;
cl->edict->inuse = false;
savedFree[i] = cl->edict->priv.sv->free;
cl->edict->priv.sv->free = true;
}
SV_WriteSaveFile( "save0" ); //autosave
// we must restore these for clients to transfer over correctly
for (i = 0, cl = svs.clients; i < maxclients->value; i++, cl++)
cl->edict->inuse = savedInuse[i];
Z_Free (savedInuse);
cl->edict->priv.sv->free = savedFree[i];
Z_Free (savedFree);
}
}
@ -309,7 +309,7 @@ void SV_Savegame_f (void)
return;
}
if (maxclients->value == 1 && svs.clients[0].edict->client->ps.stats[STAT_HEALTH] <= 0)
if (maxclients->value == 1 && svs.clients[0].edict->priv.sv->client->ps.stats[STAT_HEALTH] <= 0)
{
Msg ("\nCan't savegame while dead!\n");
return;
@ -381,7 +381,7 @@ void SV_Status_f (void)
{
if (!cl->state) continue;
Msg ("%3i ", i);
Msg ("%5i ", cl->edict->client->ps.stats[STAT_FRAGS]);
Msg ("%5i ", cl->edict->priv.sv->client->ps.stats[STAT_FRAGS]);
if (cl->state == cs_connected)
Msg ("CNCT ");
@ -626,11 +626,7 @@ Let the game dll handle a command
*/
void SV_ServerCommand_f (void)
{
if (!ge)
{
Msg ("No game loaded.\n");
return;
}
Msg ("No game loaded.\n");
}
//===========================================================

77
engine/server/sv_edict.h Normal file
View File

@ -0,0 +1,77 @@
//=======================================================================
// Copyright XashXT Group 2007 ©
// sv_edict.h - server prvm edict
//=======================================================================
#ifndef SV_EDICT_H
#define SV_EDICT_H
// game.h -- game dll information visible to server
#include "savefile.h"
#define MAX_ENT_CLUSTERS 16
#define AI_FLY (1<<0) // monster is flying
#define AI_SWIM (1<<1) // swimming monster
#define AI_ONGROUND (1<<2) // monster is onground
#define AI_PARTIALONGROUND (1<<3) // monster is partially onground
#define AI_GODMODE (1<<4) // monster don't give damage at all
#define AI_NOTARGET (1<<5) // monster will no searching enemy's
#define AI_NOSTEP (1<<6) // Lazarus stuff
#define AI_DUCKED (1<<7) // monster (or player) is ducked
#define AI_JUMPING (1<<8) // monster (or player) is jumping
#define AI_FROZEN (1<<9) // stop moving, but continue thinking
#define AI_ACTOR (1<<10) // disable ai for actor
#define AI_DRIVER (1<<11) // npc or player driving vehcicle or train
#define AI_SPECTATOR (1<<12) // spectator mode for clients
// edict->solid values
typedef enum
{
SOLID_NOT, // no interaction with other objects
SOLID_TRIGGER, // only touch when inside, after moving
SOLID_BBOX, // touch on edge
SOLID_BSP // bsp clip, touch on edge
} solid_t;
// link_t is only used for entity area links now
typedef struct link_s
{
struct link_s *prev;
struct link_s *next;
int entnum; // get edict by number
} link_t;
struct gclient_s
{
player_state_t ps; // communicated by server to clients
int ping;
pmove_state_t old_pmove; // for detecting out-of-pmove changes
vec3_t v_angle; // aiming direction
vec3_t oldviewangles;
vec3_t oldvelocity;
float bobtime; // so off-ground doesn't change it
};
struct sv_edict_s
{
// generic_edict_t (don't move these fields!)
bool free;
float freetime; // sv.time when the object was freed
// sv_private_edict_t
link_t area; // linked to a division node or leaf
int clipmask; // trace info
int headnode; // unused if num_clusters != -1
int linkcount;
int num_clusters; // if -1, use headnode instead
int clusternums[MAX_ENT_CLUSTERS];
int areanum, areanum2;
// baselines
entity_state_t s;
struct gclient_s *client; //get rid of this
};
#endif//SV_EDICT_H

View File

@ -550,7 +550,7 @@ void SV_BuildClientFrame (client_t *client)
byte *bitvector;
clent = client->edict;
if (!clent->client) return;// not in game yet
if (!clent->priv.sv->client) return;// not in game yet
// this is the frame we are creating
frame = &client->frames[sv.framenum & UPDATE_MASK];
@ -559,7 +559,7 @@ void SV_BuildClientFrame (client_t *client)
// find the client's PVS
for (i=0 ; i<3 ; i++)
org[i] = clent->client->ps.pmove.origin[i]*0.125 + clent->client->ps.viewoffset[i];
org[i] = clent->priv.sv->client->ps.pmove.origin[i]*0.125 + clent->priv.sv->client->ps.viewoffset[i];
leafnum = CM_PointLeafnum (org);
clientarea = CM_LeafArea (leafnum);
@ -569,7 +569,7 @@ void SV_BuildClientFrame (client_t *client)
frame->areabytes = CM_WriteAreaBits (frame->areabits, clientarea);
// grab the current player_state_t
frame->ps = clent->client->ps;
frame->ps = clent->priv.sv->client->ps;
SV_FatPVS (org);
@ -581,34 +581,29 @@ void SV_BuildClientFrame (client_t *client)
c_fullsend = 0;
for (e = 1; e < ge->num_edicts ; e++)
for (e = 1; e < prog->num_edicts; e++)
{
ent = EDICT_NUM(e);
// ignore ents without visible models
if (ent->svflags & SVF_NOCLIENT)
continue;
ent = PRVM_EDICT_NUM(e);
// ignore ents without visible models unless they have an effect
if (!ent->s.modelindex && !ent->s.effects && !ent->s.sound && !ent->s.event)
if (!ent->priv.sv->s.modelindex && !ent->priv.sv->s.effects && !ent->priv.sv->s.sound && !ent->priv.sv->s.event)
continue;
// ignore if not touching a PV leaf
if (ent != clent)
{
// check area
if (!CM_AreasConnected (clientarea, ent->areanum))
if (!CM_AreasConnected (clientarea, ent->priv.sv->areanum))
{ // doors can legally straddle two areas, so
// we may need to check another one
if (!ent->areanum2
|| !CM_AreasConnected (clientarea, ent->areanum2))
if (!ent->priv.sv->areanum2 || !CM_AreasConnected (clientarea, ent->priv.sv->areanum2))
continue; // blocked by a door
}
// beams just check one point for PHS
if (ent->s.renderfx & RF_BEAM)
if (ent->priv.sv->s.renderfx & RF_BEAM)
{
l = ent->clusternums[0];
l = ent->priv.sv->clusternums[0];
if ( !(clientphs[l >> 3] & (1 << (l&7) )) )
continue;
}
@ -616,37 +611,38 @@ void SV_BuildClientFrame (client_t *client)
{
// FIXME: if an ent has a model and a sound, but isn't
// in the PVS, only the PHS, clear the model
if (ent->s.sound)
if (ent->priv.sv->s.sound)
{
bitvector = fatpvs; //clientphs;
}
else
bitvector = fatpvs;
if (ent->num_clusters == -1)
{ // too many leafs for individual check, go by headnode
if (!CM_HeadnodeVisible (ent->headnode, bitvector))
if (ent->priv.sv->num_clusters == -1)
{
// too many leafs for individual check, go by headnode
if (!CM_HeadnodeVisible (ent->priv.sv->headnode, bitvector))
continue;
c_fullsend++;
}
else
{ // check individual leafs
for (i=0 ; i < ent->num_clusters ; i++)
for (i=0 ; i < ent->priv.sv->num_clusters ; i++)
{
l = ent->clusternums[i];
l = ent->priv.sv->clusternums[i];
if (bitvector[l >> 3] & (1 << (l&7) ))
break;
}
if (i == ent->num_clusters)
if (i == ent->priv.sv->num_clusters)
continue; // not visible
}
if (!ent->s.modelindex)
if (!ent->priv.sv->s.modelindex)
{ // don't send sounds if they will be attenuated away
vec3_t delta;
float len;
VectorSubtract (org, ent->s.origin, delta);
VectorSubtract (org, ent->priv.sv->s.origin, delta);
len = VectorLength (delta);
if (len > 400)
continue;
@ -656,15 +652,15 @@ void SV_BuildClientFrame (client_t *client)
// add it to the circular client_entities array
state = &svs.client_entities[svs.next_client_entities % svs.num_client_entities];
if (ent->s.number != e)
if (ent->priv.sv->s.number != e)
{
MsgWarn ("SV_BuildClientFrame: invalid ent->s.number %d\n", ent->s.number );
ent->s.number = e; // ptr to current entity such as entnumber
MsgWarn ("SV_BuildClientFrame: invalid ent->priv.sv->s.number %d\n", ent->priv.sv->s.number );
ent->priv.sv->s.number = e; // ptr to current entity such as entnumber
}
*state = ent->s;
*state = ent->priv.sv->s;
// don't mark players missiles as solid
if (ent->owner == client->edict) state->solid = 0;
if (PRVM_PROG_TO_EDICT(ent->progs.sv->owner) == client->edict) state->solid = 0;
svs.next_client_entities++;
frame->num_entities++;
@ -702,18 +698,16 @@ void SV_RecordDemoMessage (void)
MSG_WriteByte (&buf, svc_packetentities);
e = 1;
ent = EDICT_NUM(e);
while (e < ge->num_edicts)
ent = PRVM_EDICT_NUM(e);
while (e < prog->num_edicts)
{
// ignore ents without visible models unless they have an effect
if (ent->inuse &&
ent->s.number &&
(ent->s.modelindex || ent->s.effects || ent->s.sound || ent->s.event) &&
!(ent->svflags & SVF_NOCLIENT))
MSG_WriteDeltaEntity (&nostate, &ent->s, &buf, false, true);
if (!ent->priv.sv->free && ent->priv.sv->s.number &&
(ent->priv.sv->s.modelindex || ent->priv.sv->s.effects || ent->priv.sv->s.sound || ent->priv.sv->s.event))
MSG_WriteDeltaEntity (&nostate, &ent->priv.sv->s, &buf, false, true);
e++;
ent = EDICT_NUM(e);
ent = PRVM_EDICT_NUM(e);
}
MSG_WriteShort (&buf, 0); // end of packetentities

File diff suppressed because it is too large Load Diff

View File

@ -24,28 +24,132 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
server_static_t svs; // persistant server info
server_t sv; // local server
#define REQFIELDS (sizeof(reqfields) / sizeof(prvm_fieldvars_t))
prvm_fieldvars_t reqfields[] =
{
{0, 1, "classname"},
{1, 1, "globalname"},
{2, 2, "modelindex"},
{3, 3, "origin"},
{6, 3, "angles"},
{9, 3, "velocity"},
{12, 3, "avelocity"},
{15, 3, "post_origin"},
{18, 3, "post_angles"},
{21, 3, "post_velocity"},
{24, 3, "post_avelocity"},
{27, 3, "origin_offset"},
{30, 3, "angles_offset"},
{33, 2, "bouncetype"},
{34, 2, "movetype"},
{35, 2, "solid"},
{36, 3, "absmin"},
{39, 3, "absmax"},
{42, 3, "mins"},
{45, 3, "maxs"},
{48, 3, "size"},
{51, 4, "chain"},
{52, 1, "model"},
{53, 2, "frame"},
{54, 2, "sequence"},
{55, 2, "renderfx"},
{56, 2, "effects"},
{57, 2, "skin"},
{58, 2, "body"},
{59, 1, "weaponmodel"},
{60, 2, "weaponframe"},
{61, 6, "use"},
{62, 6, "touch"},
{63, 6, "think"},
{64, 6, "blocked"},
{65, 6, "activate"},
{66, 6, "walk"},
{67, 6, "jump"},
{68, 6, "duck"},
{69, 2, "flags"},
{70, 2, "aiflags"},
{71, 2, "spawnflags"},
{72, 4, "groundentity"},
{73, 2, "nextthink"},
{74, 2, "takedamage"},
{75, 2, "health"},
{76, 2, "frags"},
{77, 2, "weapon"},
{78, 2, "items"},
{79, 1, "target"},
{80, 1, "parent"},
{81, 1, "targetname"},
{82, 4, "aiment"},
{83, 4, "goalentity"},
{84, 3, "punchangle"},
{87, 2, "deadflag"},
{88, 3, "view_ofs"},
{91, 2, "button0"},
{92, 2, "button1"},
{93, 2, "button2"},
{94, 2, "impulse"},
{95, 2, "fixangle"},
{96, 3, "v_angle"},
{99, 2, "idealpitch"},
{100, 1, "netname"},
{101, 4, "enemy"},
{102, 2, "colormap"},
{103, 2, "team"},
{104, 2, "max_health"},
{105, 2, "teleport_time"},
{106, 2, "armortype"},
{107, 2, "armorvalue"},
{108, 2, "waterlevel"},
{109, 2, "watertype"},
{110, 2, "ideal_yaw"},
{111, 2, "yaw_speed"},
{112, 2, "dmg_take"},
{113, 2, "dmg_save"},
{114, 4, "dmg_inflictor"},
{115, 4, "owner"},
{116, 3, "movedir"},
{119, 1, "message"},
{120, 2, "sounds"},
{121, 1, "noise"},
{122, 1, "noise1"},
{123, 1, "noise2"},
{124, 1, "noise3"},
{125, 2, "jumpup"},
{126, 2, "jumpdn"},
{127, 4, "movetarget"},
{128, 2, "mass"},
{129, 2, "density"},
{130, 2, "gravity"},
{131, 2, "dmg"},
{132, 2, "dmgtime"},
{133, 2, "speed"}
};
/*
================
SV_FindIndex
================
*/
int SV_FindIndex (char *name, int start, int max, bool create)
int SV_FindIndex (const char *name, int start, int end, bool create)
{
int i;
if (!name || !name[0])
return 0;
if (!name || !name[0]) return 0;
for (i=1 ; i<max && sv.configstrings[start+i][0] ; i++)
if (!strcmp(sv.configstrings[start+i], name))
for (i = 1; i < end && sv.configstrings[start+i][0]; i++)
if(!strcmp(sv.configstrings[start+i], name))
return i;
if(!create) return 0;
if (!create)
if (i == end)
{
MsgWarn ("SV_FindIndex: %d out range [%d - %d]\n", start, end );
return 0;
}
if (i == max) Host_Error("SV_FindIndex: limit exceeded\n");
// register new resource
strncpy (sv.configstrings[start+i], name, sizeof(sv.configstrings[i]));
if (sv.state != ss_loading)
@ -54,7 +158,7 @@ int SV_FindIndex (char *name, int start, int max, bool create)
SZ_Clear (&sv.multicast);
MSG_Begin(svc_configstring);
MSG_WriteShort (&sv.multicast, start+i);
MSG_WriteString (&sv.multicast, name);
MSG_WriteString (&sv.multicast, (char *)name);
MSG_Send(MSG_ALL_R, vec3_origin, NULL );
}
@ -62,17 +166,17 @@ int SV_FindIndex (char *name, int start, int max, bool create)
}
int SV_ModelIndex (char *name)
int SV_ModelIndex (const char *name)
{
return SV_FindIndex (name, CS_MODELS, MAX_MODELS, true);
}
int SV_SoundIndex (char *name)
int SV_SoundIndex (const char *name)
{
return SV_FindIndex (name, CS_SOUNDS, MAX_SOUNDS, true);
}
int SV_ImageIndex (char *name)
int SV_ImageIndex (const char *name)
{
return SV_FindIndex (name, CS_IMAGES, MAX_IMAGES, true);
}
@ -90,22 +194,21 @@ baseline will be transmitted
void SV_CreateBaseline (void)
{
edict_t *svent;
int entnum;
int entnum;
for (entnum = 1; entnum < ge->num_edicts ; entnum++)
for (entnum = 1; entnum < prog->num_edicts ; entnum++)
{
svent = EDICT_NUM(entnum);
if (!svent->inuse)
svent = PRVM_EDICT_NUM(entnum);
if (svent->priv.sv->free) continue;
if (!svent->priv.sv->s.modelindex && !svent->priv.sv->s.sound && !svent->priv.sv->s.effects)
continue;
if (!svent->s.modelindex && !svent->s.sound && !svent->s.effects)
continue;
svent->s.number = entnum;
svent->priv.sv->s.number = entnum;
//
// take current state as baseline
//
VectorCopy (svent->s.origin, svent->s.old_origin);
sv.baselines[entnum] = svent->s;
VectorCopy (svent->priv.sv->s.origin, svent->priv.sv->s.old_origin);
sv.baselines[entnum] = svent->priv.sv->s;
}
}
@ -166,6 +269,7 @@ clients along with it.
void SV_SpawnServer (char *server, char *spawnpoint, char *savename, server_state_t serverstate, bool attractloop, bool loadgame)
{
uint i, checksum;
edict_t *ent;
if (attractloop) Cvar_Set ("paused", "0");
@ -199,8 +303,10 @@ void SV_SpawnServer (char *server, char *spawnpoint, char *savename, server_stat
SZ_Init (&sv.multicast, sv.multicast_buf, sizeof(sv.multicast_buf));
strcpy (sv.name, server);
SV_VM_Begin();
// leave slots at start for clients only
for (i=0 ; i<maxclients->value ; i++)
for (i = 0; i<maxclients->value ; i++)
{
// needs to reconnect
if (svs.clients[i].state > cs_connected)
@ -242,6 +348,39 @@ void SV_SpawnServer (char *server, char *spawnpoint, char *savename, server_stat
sv.state = ss_loading;
Com_SetServerState (sv.state);
ent = PRVM_EDICT_NUM(0);
prog->protect_world = false;
memset (ent->progs.sv, 0, prog->progs->entityfields * 4);
ent->priv.sv->free = false;
ent->progs.sv->model = PRVM_SetEngineString(sv.configstrings[CS_MODELS]);
ent->progs.sv->modelindex = 1; // world model
ent->progs.sv->solid = SOLID_BSP;
ent->progs.sv->movetype = MOVETYPE_PUSH;
prog->globals.server->mapname = PRVM_SetEngineString(sv.name);
// spawn the rest of the entities on the map
sv.edicts = (edict_t **)PRVM_Alloc(prog->max_edicts * sizeof(edict_t *));
sv.clients = (gclient_t *)PRVM_Alloc(maxclients->value * sizeof(gclient_t));
*prog->time = sv.time = 1.0;
// serverflags are for cross level information (sigils)
//prog->globals.server->serverflags = svs.serverflags;
// we need to reset the spawned flag on all connected clients here so that
// their thinks don't run during startup (before PutClientInServer)
// we also need to set up the client entities now
// and we need to set the ->edict pointers to point into the progs edicts
for (i = 0, sv_client = svs.clients; i < maxclients->value; i++, sv_client++)
{
sv_client->state = cs_connected;
sv_client->edict = PRVM_EDICT_NUM(i + 1);
sv_client->edict->priv.sv->client = sv.clients + i;
ent->priv.sv->s.number = i + 1;
memset (&sv_client->lastcmd, 0, sizeof(sv_client->lastcmd));
PRVM_ED_ClearEdict(sv_client->edict);
}
// load and spawn all other entities
SV_SpawnEntities ( sv.name, CM_EntityString(), spawnpoint );
@ -263,6 +402,7 @@ void SV_SpawnServer (char *server, char *spawnpoint, char *savename, server_stat
Cvar_FullSet ("mapname", sv.name, CVAR_SERVERINFO | CVAR_NOSET);
Msg ("-------------------------------------\n");
SV_VM_End();
}
/*
@ -274,9 +414,7 @@ A brand new game has been started
*/
void SV_InitGame (void)
{
int i;
edict_t *ent;
char idmaster[32];
char idmaster[32];
if (svs.initialized)
{
@ -342,14 +480,6 @@ void SV_InitGame (void)
// init game
SV_InitGameProgs ();
for (i = 0; i < maxclients->value; i++)
{
ent = EDICT_NUM(i + 1);
ent->s.number = i + 1;
svs.clients[i].edict = ent;
memset (&svs.clients[i].lastcmd, 0, sizeof(svs.clients[i].lastcmd));
}
}
@ -438,3 +568,132 @@ void SV_Map (bool attractloop, char *levelstring, char *savename, bool loadgame)
SV_BroadcastCommand ("reconnect\n");
}
void SV_VM_BeginIncreaseEdicts(void)
{
int i;
edict_t *ent;
if(sv.edicts) PRVM_Free( sv.edicts );
sv.edicts = (edict_t **)PRVM_Alloc(prog->max_edicts * sizeof(prvm_edict_t *));
// links don't survive the transition, so unlink everything
for (i = 0, ent = prog->edicts; i < prog->max_edicts; i++, ent++)
{
if (!ent->priv.sv->free) SV_UnlinkEdict(prog->edicts + i); //free old entity
memset(&ent->priv.sv->clusternums, 0, sizeof(ent->priv.sv->clusternums));
}
SV_ClearWorld();
}
void SV_VM_EndIncreaseEdicts(void)
{
int i;
edict_t *ent;
for (i = 0, ent = prog->edicts; i < prog->max_edicts; i++, ent++)
{
// link every entity except world
if (!ent->priv.sv->free) SV_LinkEdict(ent);
}
}
void SV_VM_InitEdict(edict_t *e)
{
SV_InitEdict( e );
}
void SV_VM_FreeEdict(edict_t *e)
{
SV_UnlinkEdict(e); // unlink from world bsp
SV_FreeEdict( e );
}
void SV_VM_CountEdicts( void )
{
int i;
edict_t *ent;
int active = 0, models = 0, solid = 0, step = 0;
for (i = 0; i < prog->num_edicts; i++)
{
ent = PRVM_EDICT_NUM(i);
if (ent->priv.sv->free)
continue;
active++;
if (ent->progs.sv->solid) solid++;
if (ent->progs.sv->model) models++;
if (ent->progs.sv->movetype == MOVETYPE_STEP) step++;
}
Msg("num_edicts:%3i\n", prog->num_edicts);
Msg("active :%3i\n", active);
Msg("view :%3i\n", models);
Msg("touch :%3i\n", solid);
Msg("step :%3i\n", step);
}
bool SV_VM_LoadEdict(edict_t *ent)
{
int current_skill = (int)Cvar_VariableValue ("skill");
// remove things from different skill levels or deathmatch
if(Cvar_VariableValue ("deathmatch"))
{
if (((int)ent->progs.sv->spawnflags & SPAWNFLAG_NOT_DEATHMATCH))
{
return false;
}
}
else if ((current_skill <= 0 && ((int)ent->progs.sv->spawnflags & SPAWNFLAG_NOT_EASY )) || (current_skill == 1 && ((int)ent->progs.sv->spawnflags & SPAWNFLAG_NOT_MEDIUM)) || (current_skill >= 2 && ((int)ent->progs.sv->spawnflags & SPAWNFLAG_NOT_HARD )))
{
return false;
}
return true;
}
void SV_VM_Setup( void )
{
PRVM_Begin;
PRVM_InitProg( PRVM_SERVERPROG );
// allocate the mempools
// TODO: move the magic numbers/constants into #defines [9/13/2006 Black]
prog->progs_mempool = Mem_AllocPool("Server Progs" );
prog->builtins = vm_sv_builtins;
prog->numbuiltins = vm_sv_numbuiltins;
prog->max_edicts = 512;
prog->limit_edicts = MAX_EDICTS;
prog->reserved_edicts = maxclients->value;
prog->edictprivate_size = sizeof(sv_edict_t);
prog->name = "server";
prog->extensionstring = "";
prog->loadintoworld = true;
prog->begin_increase_edicts = SV_VM_BeginIncreaseEdicts;
prog->end_increase_edicts = SV_VM_EndIncreaseEdicts;
prog->init_edict = SV_VM_InitEdict;
prog->free_edict = SV_VM_FreeEdict;
prog->count_edicts = SV_VM_CountEdicts;
prog->load_edict = SV_VM_LoadEdict;
prog->init_cmd = VM_Cmd_Init;
prog->reset_cmd = VM_Cmd_Reset;
prog->error_cmd = VM_Error;
// TODO: add a requiredfuncs list (ask LH if this is necessary at all)
PRVM_LoadProgs( "server.dat", 0, NULL, REQFIELDS, reqfields );
PRVM_End;
}
void SV_VM_Begin(void)
{
PRVM_Begin;
PRVM_SetProg( PRVM_SERVERPROG );
*prog->time = sv.time;
}
void SV_VM_End(void)
{
PRVM_End;
}

View File

@ -151,7 +151,7 @@ char *SV_StatusString (void)
cl = &svs.clients[i];
if (cl->state == cs_connected || cl->state == cs_spawned )
{
sprintf (player, "%i %i \"%s\"\n", cl->edict->client->ps.stats[STAT_FRAGS], cl->ping, cl->name);
sprintf (player, "%i %i \"%s\"\n", cl->edict->priv.sv->client->ps.stats[STAT_FRAGS], cl->ping, cl->name);
playerLength = strlen(player);
if (statusLength + playerLength >= sizeof(status) )
break; // can't hold any more
@ -396,7 +396,7 @@ gotnewcl:
sv_client = newcl;
edictnum = (newcl - svs.clients) + 1;
ent = EDICT_NUM(edictnum);
ent = PRVM_EDICT_NUM( edictnum );
newcl->edict = ent;
newcl->challenge = challenge; // save challenge for checksumming
@ -556,7 +556,7 @@ void SV_CalcPings (void)
#endif
// let the game dll know about the ping
cl->edict->client->ping = cl->ping;
cl->edict->priv.sv->client->ping = cl->ping;
}
}
@ -700,14 +700,14 @@ player processing happens outside RunWorldFrame
*/
void SV_PrepWorldFrame (void)
{
edict_t *ent;
edict_t *ent;
int i;
for (i=0 ; i<ge->num_edicts ; i++, ent++)
for (i = 0; i < prog->num_edicts ; i++, ent++)
{
ent = EDICT_NUM(i);
ent = PRVM_EDICT_NUM(i);
// events only last for a single message
ent->s.event = 0;
ent->priv.sv->s.event = 0;
}
}
@ -768,6 +768,9 @@ void SV_Frame (float time)
// keep the random time dependent
rand ();
// setup the VM frame
SV_VM_Begin();
// check timeouts
SV_CheckTimeouts ();
@ -809,6 +812,8 @@ void SV_Frame (float time)
// clear teleport flags, etc for next frame
SV_PrepWorldFrame ();
// end the server VM frame
SV_VM_End();
}
//============================================================================

File diff suppressed because it is too large Load Diff

View File

@ -208,7 +208,7 @@ void _MSG_Send (msgtype_t to, vec3_t origin, edict_t *ent, const char *filename,
reliable = true; // intentional fallthrough
case MSG_ONE:
if(ent == NULL) return;
j = NUM_FOR_EDICT(ent);
j = PRVM_NUM_FOR_EDICT(ent);
if (j < 1 || j > numclients) return;
current = svs.clients + (j - 1);
numclients = 1; // send to one
@ -228,7 +228,7 @@ void _MSG_Send (msgtype_t to, vec3_t origin, edict_t *ent, const char *filename,
{
area2 = CM_LeafArea (leafnum);
cluster = CM_LeafCluster (leafnum);
leafnum = CM_PointLeafnum (client->edict->s.origin);
leafnum = CM_PointLeafnum (client->edict->priv.sv->s.origin);
if (!CM_AreasConnected (area1, area2)) continue;
if ( mask && (!(mask[cluster>>3] & (1<<(cluster&7))))) continue;
}
@ -299,7 +299,7 @@ void SV_StartSound (vec3_t origin, edict_t *entity, int channel, int soundindex,
MsgWarn("SV_StartSound: timeofs = %f\n", timeofs);
timeofs = bound(0, timeofs, 0.255 );
}
ent = NUM_FOR_EDICT(entity);
ent = PRVM_NUM_FOR_EDICT(entity);
if (channel & 8) // no PHS flag
{
@ -315,7 +315,7 @@ void SV_StartSound (vec3_t origin, edict_t *entity, int channel, int soundindex,
// the client doesn't know that bmodels have weird origins
// the origin can also be explicitly set
if ( (entity->svflags & SVF_NOCLIENT) || (entity->solid == SOLID_BSP) || origin )
if (entity->progs.sv->solid == SOLID_BSP || !VectorIsNull(origin))
flags |= SND_POS;
// always send the entity number for channel overrides
@ -327,16 +327,16 @@ void SV_StartSound (vec3_t origin, edict_t *entity, int channel, int soundindex,
if (!origin)
{
origin = origin_v;
if (entity->solid == SOLID_BSP)
if (entity->progs.sv->solid == SOLID_BSP)
{
for (i = 0; i < 3; i++)
{
origin_v[i] = entity->s.origin[i]+0.5*(entity->mins[i]+entity->maxs[i]);
origin_v[i] = entity->priv.sv->s.origin[i]+0.5*(entity->progs.sv->mins[i]+entity->progs.sv->maxs[i]);
}
}
else
{
VectorCopy (entity->s.origin, origin_v);
VectorCopy (entity->priv.sv->s.origin, origin_v);
}
}

File diff suppressed because it is too large Load Diff

View File

@ -97,8 +97,8 @@ void SV_New_f (void)
if (sv.state == ss_game)
{
// set up the entity for the client
ent = EDICT_NUM(playernum+1);
ent->s.number = playernum+1;
ent = PRVM_EDICT_NUM(playernum+1);
ent->priv.sv->s.number = playernum+1;
sv_client->edict = ent;
memset (&sv_client->lastcmd, 0, sizeof(sv_client->lastcmd));

View File

@ -30,13 +30,7 @@ ENTITY AREA CHECKING
FIXME: this use of "area" is different from the bsp file use
===============================================================================
*/
// (type *)STRUCT_FROM_LINK(link_t *link, type, member)
// ent = STRUCT_FROM_LINK(link,entity_t,order)
// FIXME: remove this mess!
#define STRUCT_FROM_LINK(l,t,m) ((t *)((byte *)l - (int)&(((t *)0)->m)))
#define EDICT_FROM_AREA(l) STRUCT_FROM_LINK(l,edict_t,area)
#define EDICT_FROM_AREA(l) PRVM_EDICT_NUM(l->entnum)
typedef struct areanode_s
{
@ -73,12 +67,13 @@ void RemoveLink (link_t *l)
l->prev->next = l->next;
}
void InsertLinkBefore (link_t *l, link_t *before)
void InsertLinkBefore (link_t *l, link_t *before, edict_t *ent)
{
l->next = before;
l->prev = before->prev;
l->prev->next = l;
l->next->prev = l;
l->entnum = PRVM_NUM_FOR_EDICT(ent);
}
/*
@ -108,10 +103,8 @@ areanode_t *SV_CreateAreaNode (int depth, vec3_t mins, vec3_t maxs)
}
VectorSubtract (maxs, mins, size);
if (size[0] > size[1])
anode->axis = 0;
else
anode->axis = 1;
if (size[0] > size[1]) anode->axis = 0;
else anode->axis = 1;
anode->dist = 0.5 * (maxs[anode->axis] + mins[anode->axis]);
VectorCopy (mins, mins1);
@ -149,10 +142,9 @@ SV_UnlinkEdict
*/
void SV_UnlinkEdict (edict_t *ent)
{
if (!ent->area.prev)
return; // not linked in anywhere
RemoveLink (&ent->area);
ent->area.prev = ent->area.next = NULL;
if (!ent->priv.sv->area.prev) return; // not linked in anywhere
RemoveLink (&ent->priv.sv->area);
ent->priv.sv->area.prev = ent->priv.sv->area.next = NULL;
}
@ -166,47 +158,47 @@ SV_LinkEdict
void SV_LinkEdict (edict_t *ent)
{
areanode_t *node;
int leafs[MAX_TOTAL_ENT_LEAFS];
int clusters[MAX_TOTAL_ENT_LEAFS];
int num_leafs;
int i, j, k;
int area;
int topnode;
int leafs[MAX_TOTAL_ENT_LEAFS];
int clusters[MAX_TOTAL_ENT_LEAFS];
int num_leafs;
int i, j, k;
int area;
int topnode;
if (ent->area.prev) SV_UnlinkEdict (ent); // unlink from old position
if (ent == ge->edicts) return; // don't add the world
if (!ent->inuse) return;
if (ent->priv.sv->area.prev) SV_UnlinkEdict (ent); // unlink from old position
if (ent == prog->edicts) return; // don't add the world
if (ent->priv.sv->free) return;
// set the size
VectorSubtract (ent->maxs, ent->mins, ent->size);
VectorSubtract (ent->progs.sv->maxs, ent->progs.sv->mins, ent->progs.sv->size);
// encode the size into the entity_state for client prediction
if (ent->solid == SOLID_BBOX && !(ent->svflags & SVF_DEADMONSTER))
if (ent->progs.sv->solid == SOLID_BBOX && !((int)ent->progs.sv->flags & FL_DEADMONSTER))
{
// assume that x/y are equal and symetric
i = ent->maxs[0]/8;
i = ent->progs.sv->maxs[0]/8;
if (i<1) i = 1;
if (i>31) i = 31;
// z is not symetric
j = (-ent->mins[2])/8;
j = (-ent->progs.sv->mins[2])/8;
if (j < 1) j = 1;
if (j > 31) j = 31;
// and z maxs can be negative...
k = (ent->maxs[2]+32)/8;
k = (ent->progs.sv->maxs[2]+32)/8;
if (k<1) k = 1;
if (k>63) k = 63;
ent->s.solid = (k<<10) | (j<<5) | i;
ent->priv.sv->s.solid = (k<<10) | (j<<5) | i;
}
else if (ent->solid == SOLID_BSP)
else if (ent->progs.sv->solid == SOLID_BSP)
{
ent->s.solid = 31; // a solid_bbox will never create this value
ent->priv.sv->s.solid = 31; // a solid_bbox will never create this value
}
else ent->s.solid = 0;
else ent->priv.sv->s.solid = 0;
// set the abs box
if (ent->solid == SOLID_BSP && (ent->s.angles[0] || ent->s.angles[1] || ent->s.angles[2]) )
if (ent->progs.sv->solid == SOLID_BSP && (ent->priv.sv->s.angles[0] || ent->priv.sv->s.angles[1] || ent->priv.sv->s.angles[2]) )
{
// expand for rotation
float max = 0, v;
@ -214,39 +206,39 @@ void SV_LinkEdict (edict_t *ent)
for (i=0 ; i<3 ; i++)
{
v =fabs( ent->mins[i]);
v =fabs( ent->progs.sv->mins[i]);
if (v > max) max = v;
v =fabs( ent->maxs[i]);
v =fabs( ent->progs.sv->maxs[i]);
if (v > max) max = v;
}
for (i=0 ; i<3 ; i++)
{
ent->absmin[i] = ent->s.origin[i] - max;
ent->absmax[i] = ent->s.origin[i] + max;
ent->progs.sv->absmin[i] = ent->priv.sv->s.origin[i] - max;
ent->progs.sv->absmax[i] = ent->priv.sv->s.origin[i] + max;
}
}
else
{ // normal
VectorAdd (ent->s.origin, ent->mins, ent->absmin);
VectorAdd (ent->s.origin, ent->maxs, ent->absmax);
VectorAdd (ent->priv.sv->s.origin, ent->progs.sv->mins, ent->progs.sv->absmin);
VectorAdd (ent->priv.sv->s.origin, ent->progs.sv->maxs, ent->progs.sv->absmax);
}
// because movement is clipped an epsilon away from an actual edge,
// we must fully check even when bounding boxes don't quite touch
ent->absmin[0] -= 1;
ent->absmin[1] -= 1;
ent->absmin[2] -= 1;
ent->absmax[0] += 1;
ent->absmax[1] += 1;
ent->absmax[2] += 1;
ent->progs.sv->absmin[0] -= 1;
ent->progs.sv->absmin[1] -= 1;
ent->progs.sv->absmin[2] -= 1;
ent->progs.sv->absmax[0] += 1;
ent->progs.sv->absmax[1] += 1;
ent->progs.sv->absmax[2] += 1;
// link to PVS leafs
ent->num_clusters = 0;
ent->areanum = 0;
ent->areanum2 = 0;
ent->priv.sv->num_clusters = 0;
ent->priv.sv->areanum = 0;
ent->priv.sv->areanum2 = 0;
//get all leafs, including solids
num_leafs = CM_BoxLeafnums (ent->absmin, ent->absmax, leafs, MAX_TOTAL_ENT_LEAFS, &topnode);
num_leafs = CM_BoxLeafnums (ent->progs.sv->absmin, ent->progs.sv->absmax, leafs, MAX_TOTAL_ENT_LEAFS, &topnode);
// set areas
for (i = 0; i < num_leafs; i++)
@ -256,25 +248,25 @@ void SV_LinkEdict (edict_t *ent)
if (area)
{ // doors may legally straggle two areas,
// but nothing should evern need more than that
if (ent->areanum && ent->areanum != area)
if (ent->priv.sv->areanum && ent->priv.sv->areanum != area)
{
if (ent->areanum2 && ent->areanum2 != area && sv.state == ss_loading)
MsgWarn("SV_LinkEdict: object touching 3 areas at %f %f %f\n", ent->absmin[0], ent->absmin[1], ent->absmin[2]);
ent->areanum2 = area;
if (ent->priv.sv->areanum2 && ent->priv.sv->areanum2 != area && sv.state == ss_loading)
MsgWarn("SV_LinkEdict: object touching 3 areas at %f %f %f\n", ent->progs.sv->absmin[0], ent->progs.sv->absmin[1], ent->progs.sv->absmin[2]);
ent->priv.sv->areanum2 = area;
}
else ent->areanum = area;
else ent->priv.sv->areanum = area;
}
}
if (num_leafs >= MAX_TOTAL_ENT_LEAFS)
{
// assume we missed some leafs, and mark by headnode
ent->num_clusters = -1;
ent->headnode = topnode;
ent->priv.sv->num_clusters = -1;
ent->priv.sv->headnode = topnode;
}
else
{
ent->num_clusters = 0;
ent->priv.sv->num_clusters = 0;
for (i = 0; i < num_leafs; i++)
{
if (clusters[i] == -1) continue; // not a visible leaf
@ -284,42 +276,42 @@ void SV_LinkEdict (edict_t *ent)
}
if (j == i)
{
if (ent->num_clusters == MAX_ENT_CLUSTERS)
if (ent->priv.sv->num_clusters == MAX_ENT_CLUSTERS)
{
// assume we missed some leafs, and mark by headnode
ent->num_clusters = -1;
ent->headnode = topnode;
ent->priv.sv->num_clusters = -1;
ent->priv.sv->headnode = topnode;
break;
}
ent->clusternums[ent->num_clusters++] = clusters[i];
ent->priv.sv->clusternums[ent->priv.sv->num_clusters++] = clusters[i];
}
}
}
// if first time, make sure old_origin is valid
if (!ent->linkcount)
if (!ent->priv.sv->linkcount)
{
VectorCopy (ent->s.origin, ent->s.old_origin);
VectorCopy (ent->priv.sv->s.origin, ent->priv.sv->s.old_origin);
}
ent->linkcount++;
ent->priv.sv->linkcount++;
if (ent->solid == SOLID_NOT) return;
if (ent->progs.sv->solid == SOLID_NOT) return;
// find the first node that the ent's box crosses
node = sv_areanodes;
while (1)
{
if (node->axis == -1) break;
if (ent->absmin[node->axis] > node->dist)
if (ent->progs.sv->absmin[node->axis] > node->dist)
node = node->children[0];
else if (ent->absmax[node->axis] < node->dist)
else if (ent->progs.sv->absmax[node->axis] < node->dist)
node = node->children[1];
else break; // crosses the node
}
// link it in
if (ent->solid == SOLID_TRIGGER) InsertLinkBefore (&ent->area, &node->trigger_edicts);
else InsertLinkBefore (&ent->area, &node->solid_edicts);
if (ent->progs.sv->solid == SOLID_TRIGGER) InsertLinkBefore (&ent->priv.sv->area, &node->trigger_edicts, ent );
else InsertLinkBefore (&ent->priv.sv->area, &node->solid_edicts, ent );
}
@ -346,9 +338,9 @@ void SV_AreaEdicts_r (areanode_t *node)
next = l->next;
check = EDICT_FROM_AREA(l);
if (check->solid == SOLID_NOT) continue; // deactivated
if (check->absmin[0] > area_maxs[0] || check->absmin[1] > area_maxs[1] || check->absmin[2] > area_maxs[2]
|| check->absmax[0] < area_mins[0] || check->absmax[1] < area_mins[1] || check->absmax[2] < area_mins[2])
if (check->progs.sv->solid == SOLID_NOT) continue; // deactivated
if (check->progs.sv->absmin[0] > area_maxs[0] || check->progs.sv->absmin[1] > area_maxs[1] || check->progs.sv->absmin[2] > area_maxs[2]
|| check->progs.sv->absmax[0] < area_mins[0] || check->progs.sv->absmax[1] < area_mins[1] || check->progs.sv->absmax[2] < area_mins[2])
continue; // not touching
if (area_count == area_maxcount)
@ -417,9 +409,9 @@ int SV_PointContents (vec3_t p)
// might intersect, so do an exact clip
headnode = SV_HullForEntity (hit);
angles = hit->s.angles;
if (hit->solid != SOLID_BSP) angles = vec3_origin; // boxes don't rotate
c2 = CM_TransformedPointContents (p, headnode, hit->s.origin, hit->s.angles);
angles = hit->priv.sv->s.angles;
if (hit->progs.sv->solid != SOLID_BSP) angles = vec3_origin; // boxes don't rotate
c2 = CM_TransformedPointContents (p, headnode, hit->priv.sv->s.origin, hit->priv.sv->s.angles);
contents |= c2;
}
return contents;
@ -456,10 +448,10 @@ int SV_HullForEntity (edict_t *ent)
cmodel_t *model;
// decide which clipping hull to use, based on the size
if (ent->solid == SOLID_BSP)
if (ent->progs.sv->solid == SOLID_BSP)
{
// explicit hulls in the BSP model
model = sv.models[ ent->s.modelindex ];
model = sv.models[ ent->priv.sv->s.modelindex ];
if (!model)
{
@ -470,7 +462,7 @@ int SV_HullForEntity (edict_t *ent)
}
// create a temp hull from bounding box sizes
return CM_HeadnodeForBox (ent->mins, ent->maxs);
return CM_HeadnodeForBox (ent->progs.sv->mins, ent->progs.sv->maxs);
}
/*
@ -494,30 +486,32 @@ void SV_ClipMoveToEntities ( moveclip_t *clip )
for (i = 0; i < num; i++)
{
touch = touchlist[i];
if (touch->solid == SOLID_NOT) continue;
if (touch->progs.sv->solid == SOLID_NOT) continue;
if (touch == clip->passedict) continue;
if (clip->trace.allsolid) return;
if (clip->passedict)
{
if (touch->owner == clip->passedict) continue; // don't clip against own missiles
if (clip->passedict->owner == touch) continue; // don't clip against owner
if (PRVM_PROG_TO_EDICT(touch->progs.sv->owner) == clip->passedict)
continue; // don't clip against own missiles
if (PRVM_PROG_TO_EDICT(clip->passedict->progs.sv->owner) == touch)
continue; // don't clip against owner
}
if ( !(clip->contentmask & CONTENTS_DEADMONSTER) && (touch->svflags & SVF_DEADMONSTER) )
if ( !(clip->contentmask & CONTENTS_DEADMONSTER) && ((int)touch->progs.sv->flags & FL_DEADMONSTER))
continue;
// might intersect, so do an exact clip
headnode = SV_HullForEntity (touch);
angles = touch->s.angles;
if (touch->solid != SOLID_BSP) angles = vec3_origin; // boxes don't rotate
angles = touch->priv.sv->s.angles;
if (touch->progs.sv->solid != SOLID_BSP) angles = vec3_origin; // boxes don't rotate
if (touch->svflags & SVF_MONSTER)
if ((int)touch->progs.sv->flags & FL_MONSTER)
{
trace = CM_TransformedBoxTrace (clip->start, clip->end, clip->mins2, clip->maxs2, headnode, clip->contentmask, touch->s.origin, angles);
trace = CM_TransformedBoxTrace (clip->start, clip->end, clip->mins2, clip->maxs2, headnode, clip->contentmask, touch->priv.sv->s.origin, angles);
}
else
{
trace = CM_TransformedBoxTrace (clip->start, clip->end, clip->mins, clip->maxs, headnode, clip->contentmask, touch->s.origin, angles);
trace = CM_TransformedBoxTrace (clip->start, clip->end, clip->mins, clip->maxs, headnode, clip->contentmask, touch->priv.sv->s.origin, angles);
}
if (trace.allsolid || trace.startsolid || trace.fraction < clip->trace.fraction)
{
@ -579,7 +573,7 @@ trace_t SV_Trace (vec3_t start, vec3_t mins, vec3_t maxs, vec3_t end, edict_t *p
// clip to world
clip.trace = CM_BoxTrace (start, end, mins, maxs, 0, contentmask);
clip.trace.ent = ge->edicts;
clip.trace.ent = prog->edicts;
if (clip.trace.fraction == 0) return clip.trace; // blocked by the world
clip.contentmask = contentmask;

55
engine/server/tstent.c Normal file
View File

@ -0,0 +1,55 @@
void SP_info_player_start (edict_t *ent){}
void SP_info_player_deathmatch (edict_t *ent){}
void SP_worldspawn (edict_t *ent)
{
vec3_t skyaxis;
ent->priv.sv->movetype = MOVETYPE_PUSH;
ent->priv.sv->solid = SOLID_BSP;
ent->priv.sv->free = false; // since the world doesn't use G_Spawn()
ent->priv.sv->s.modelindex = 1; // world model is always index 1
//---------------
VectorSet( skyaxis, 32, 180, 20 );
PF_Configstring (CS_MAXCLIENTS, va("%i", (int)(maxclients->value)));
PF_Configstring (CS_STATUSBAR, single_statusbar);
PF_Configstring (CS_SKY, "sky" );
PF_Configstring (CS_SKYROTATE, va("%f", 0.0f ));
PF_Configstring (CS_SKYAXIS, va("%f %f %f", skyaxis[0], skyaxis[1], skyaxis[2]) );
PF_Configstring (CS_CDTRACK, va("%i", 0 ));
//---------------
// help icon for statusbar
SV_ImageIndex ("i_help");
SV_ImageIndex ("help");
SV_ImageIndex ("field_3");
}
void SP_misc_explobox (edict_t *self)
{
self->priv.sv->solid = SOLID_BBOX;
self->priv.sv->movetype = MOVETYPE_STEP;
self->priv.sv->model = "models/barrel.mdl";
self->priv.sv->s.modelindex = SV_ModelIndex (self->priv.sv->model);
VectorSet (self->priv.sv->mins, -16, -16, 0);
VectorSet (self->priv.sv->maxs, 16, 16, 40);
if (!self->priv.sv->health) self->priv.sv->health = 10;
self->priv.sv->monsterinfo.aiflags = AI_NOSTEP;
self->priv.sv->think = SV_DropToFloor;
self->priv.sv->nextthink = sv.time + 0.5;
PF_setmodel (self, self->priv.sv->model);
}
void SP_func_wall(edict_t *self)
{
self->priv.sv->solid = SOLID_BSP;
PF_setmodel (self, self->priv.sv->model);
SV_LinkEdict(self);
}

View File

@ -202,7 +202,7 @@ S_FindName
==================
*/
sfx_t *S_FindName (char *name, bool create)
sfx_t *S_FindName (const char *name, bool create)
{
int i;
sfx_t *sfx;
@ -302,7 +302,7 @@ S_RegisterSound
==================
*/
sfx_t *S_RegisterSound (char *name)
sfx_t *S_RegisterSound (const char *name)
{
sfx_t *sfx;
@ -731,7 +731,7 @@ void S_StartSound(vec3_t origin, int entnum, int entchannel, sfx_t *sfx, float f
S_StartLocalSound
==================
*/
int S_StartLocalSound (char *sound)
int S_StartLocalSound (const char *sound)
{
sfx_t *sfx;

View File

@ -25,7 +25,7 @@ void S_Shutdown (void);
// if origin is NULL, the sound will be dynamically sourced from the entity
void S_StartSound (vec3_t origin, int entnum, int entchannel, struct sfx_s *sfx, float fvol, float attenuation, float timeofs);
int S_StartLocalSound (char *s);
int S_StartLocalSound (const char *s);
void S_RawSamples (int samples, int rate, int width, int channels, byte *data);
@ -35,10 +35,10 @@ void S_Update (vec3_t origin, vec3_t v_forward, vec3_t v_right, vec3_t v_up);
void S_Activate (bool active);
void S_BeginRegistration (void);
struct sfx_s *S_RegisterSound (char *sample);
struct sfx_s *S_RegisterSound (const char *sample);
void S_EndRegistration (void);
struct sfx_s *S_FindName (char *name, bool create);
struct sfx_s *S_FindName (const char *name, bool create);
// the sound code makes callbacks to the client for entitiy position
// information, so entities can be dynamically re-spatialized

View File

@ -89,13 +89,20 @@ void Sys_ShowConsoleW( bool show )
static LONG WINAPI ConWndProc( HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
static bool s_timePolarity;
static bool s_timePolarity;
PAINTSTRUCT ps;
HDC hdc;
switch (uMsg)
{
case WM_ACTIVATE:
if ( LOWORD( wParam ) != WA_INACTIVE ) SetFocus( s_wcd.hwndInputLine );
break;
case WM_PAINT:
hdc = BeginPaint(hWnd, (LPPAINTSTRUCT)&ps);
EndPaint(hWnd,(LPPAINTSTRUCT)&ps);
return TRUE;
break;
case WM_CLOSE:
if(sys_error)
{
@ -129,7 +136,7 @@ static LONG WINAPI ConWndProc( HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lPara
case WM_COMMAND:
if ( wParam == SUBMIT_ID )
{
SendMessage(s_wcd.hwndInputLine,WM_CHAR, 13, 0L);
SendMessage(s_wcd.hwndInputLine, WM_CHAR, 13, 0L);
SetFocus( s_wcd.hwndInputLine );
}
break;
@ -197,11 +204,10 @@ print into window console
void Sys_PrintW(const char *pMsg)
{
char buffer[MAX_INPUTLINE*2];
static dword s_totalChars;
char *b = buffer;
const char *msg;
int bufLen;
int i = 0;
static unsigned long s_totalChars;
int bufLen, i = 0;
// if the message is REALLY long, use just the last portion of it
if ( strlen( pMsg ) > MAX_INPUTLINE - 1 )

View File

@ -12,6 +12,18 @@ bool debug_mode = false;
bool console_read_only = true;
int dev_mode = 0;
void Sys_SendKeyEvents( void )
{
MSG wmsg;
while (PeekMessage (&wmsg, NULL, 0, 0, PM_NOREMOVE))
{
if (!GetMessage (&wmsg, NULL, 0, 0)) break;
TranslateMessage (&wmsg);
DispatchMessage (&wmsg);
}
}
/*
====================
Log_Timestamp

View File

@ -45,8 +45,10 @@ typedef struct image_s image_t;
typedef struct model_s model_t;
typedef int func_t;
typedef struct edict_s edict_t;
typedef struct gclient_s gclient_t;
typedef int string_t;
typedef struct gclient_s gclient_t;
typedef struct sv_edict_s sv_edict_t;
typedef struct cl_edict_s cl_edict_t;
typedef int progsnum_t;
typedef struct progfuncs_s progfuncs_t;
typedef float vec_t;

View File

@ -121,17 +121,15 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
// edict->movetype values
// edict->flags
#define FL_FLY 0x00000001
#define FL_SWIM 0x00000002 // implied immunity to drowining
#define FL_IMMUNE_LASER 0x00000004
#define FL_INWATER 0x00000008
#define FL_GODMODE 0x00000010
#define FL_NOTARGET 0x00000020
#define FL_IMMUNE_SLIME 0x00000040
#define FL_IMMUNE_LAVA 0x00000080
#define FL_PARTIALGROUND 0x00000100 // not all corners are valid
#define FL_WATERJUMP 0x00000200 // player jumping out of water
#define FL_ONGROUND 0x00000400
#define FL_CLIENT (1<<0) // this is client
#define FL_MONSTER (1<<1) // this is npc
#define FL_DEADMONSTER (1<<2) // dead npc or dead player
#define FL_WORLDBRUSH (1<<3) // Not moveable/removeable brush entity
#define FL_DORMANT (1<<4) // Entity is dormant, no updates to client
#define FL_FRAMETHINK (1<<5) // entity will be thinking every frame
#define FL_GRAPHED (1<<6) // worldgraph has this ent listed as something that blocks a connection
#define FL_FLOAT (1<<7) // this entity can be floating. FIXME: remove this ?
#define FL_TRACKTRAIN (1<<8) // old stuff...
typedef enum
{
@ -260,7 +258,7 @@ typedef struct
cplane_t plane; // surface normal at impact
csurface_t *surface; // surface hit
int contents; // contents on other side of surface hit
struct edict_s *ent; // not set by CM_*() functions
edict_t *ent; // not set by CM_*() functions
} trace_t;
@ -343,14 +341,14 @@ typedef struct
// results (out)
int numtouch;
struct edict_s *touchents[MAXTOUCH];
edict_t *touchents[MAXTOUCH];
vec3_t viewangles; // clamped
float viewheight;
vec3_t mins, maxs; // bounding box size
struct edict_s *groundentity;
edict_t *groundentity;
int watertype;
int waterlevel;

View File

@ -56,5 +56,6 @@ if exist vprogs\server.dat move vprogs\server.dat D:\Xash3D\xash\server.dat
echo Build succeeded!
echo Please wait. Xash is now loading
cd D:\Xash3D\
xash.exe -game valve +map skytest -debug -log
xash.exe -game valve +map lighttest -debug -log
rem bin\bsplib -game xash +map dm_qstyle -vis -rad -full -log
:done

View File

@ -444,7 +444,7 @@ void Mod_LoadTexinfo (lump_t *l)
loadmodel->texinfo = out;
loadmodel->numtexinfo = count;
for ( i=0 ; i<count ; i++, in++, out++)
for ( i = 0; i < count; i++, in++, out++)
{
for (j=0 ; j<8 ; j++)
out->vecs[0][j] = LittleFloat(in->vecs[0][j]);
@ -461,13 +461,12 @@ void Mod_LoadTexinfo (lump_t *l)
out->image = r_notexture;
}
}
// count animation frames
for (i = 0; i < count; i++)
{
out = &loadmodel->texinfo[i];
out->numframes = 1;
for (step = out->next ; step && step != out ; step=step->next)
for (step = out->next; step && step != out; step = step->next)
out->numframes++;
}
}

View File

@ -83,10 +83,9 @@ image_t *R_TextureAnimation (mtexinfo_t *tex)
{
int c;
if (!tex->next)
return tex->image;
if (!tex->next) return tex->image;
c = fmod(currententity->frame, tex->numframes);
c = (int)currententity->frame % tex->numframes;
while (c)
{
tex = tex->next;
@ -96,81 +95,6 @@ image_t *R_TextureAnimation (mtexinfo_t *tex)
return tex->image;
}
#if 0
/*
=================
WaterWarpPolyVerts
Mangles the x and y coordinates in a copy of the poly
so that any drawing routine can be water warped
=================
*/
glpoly_t *WaterWarpPolyVerts (glpoly_t *p)
{
int i;
float *v, *nv;
static byte buffer[1024];
glpoly_t *out;
out = (glpoly_t *)buffer;
out->numverts = p->numverts;
v = p->verts[0];
nv = out->verts[0];
for (i = 0; i < p->numverts; i++, v+= VERTEXSIZE, nv+=VERTEXSIZE)
{
nv[0] = v[0] + 4*sin(v[1] * 0.05 + r_newrefdef.time) * sin(v[2] * 0.05 + r_newrefdef.time);
nv[1] = v[1] + 4*sin(v[0] * 0.05 + r_newrefdef.time) * sin(v[2] * 0.05 + r_newrefdef.time);
nv[2] = v[2];
nv[3] = v[3];
nv[4] = v[4];
nv[5] = v[5];
nv[6] = v[6];
}
return out;
}
/*
================
DrawGLWaterPoly
Warp the vertex coordinates
================
*/
void DrawGLWaterPoly (glpoly_t *p)
{
int i;
float *v;
p = WaterWarpPolyVerts (p);
qglBegin (GL_TRIANGLE_FAN);
v = p->verts[0];
for (i=0 ; i<p->numverts ; i++, v+= VERTEXSIZE)
{
qglTexCoord2f (v[3], v[4]);
qglVertex3fv (v);
}
qglEnd ();
}
void DrawGLWaterPolyLightmap (glpoly_t *p)
{
int i;
float *v;
p = WaterWarpPolyVerts (p);
qglBegin (GL_TRIANGLE_FAN);
v = p->verts[0];
for (i=0 ; i<p->numverts ; i++, v+= VERTEXSIZE)
{
qglTexCoord2f (v[5], v[6]);
qglVertex3fv (v);
}
qglEnd ();
}
#endif
/*
================
DrawGLPoly
@ -1191,7 +1115,7 @@ void R_DrawWorld (void)
// auto cycle the world frame for texture animation
memset (&ent, 0, sizeof(ent));
ent.frame = (int)(r_newrefdef.time * 0.5);
ent.frame = (int)(r_newrefdef.time * 0.01);
currententity = &ent;
gl_state.currenttextures[0] = gl_state.currenttextures[1] = -1;

View File

@ -166,8 +166,8 @@ This function is called when the player enters the 'kill' command in the console
void() ClientKill =
{
//pprint(self, " has", " killed themselves.");
T_Damage(self, self, self, self.health);
//pprint(pev, " has", " killed themselves.");
T_Damage(pev, pev, pev, pev->health);
ClientRespawn();
};
@ -182,7 +182,7 @@ This function is called when the player connects to the server.
void() ClientConnect =
{
pprint(self, " has", " joined the game.");
pprint(pev, " has", " joined the game.");
configstring (2, "sky"); //CS_SKY
};
@ -197,7 +197,7 @@ This function is called when the player disconnects from the server.
void() ClientDisconnect =
{
pprint(self, " has", " left the game.");
pprint(pev, " has", " left the game.");
};
/*
@ -261,37 +261,37 @@ void() PutClientInServer =
local entity spawn_spot; // This holds where we want to spawn
spawn_spot = find_spawnspot(); //find (world, classname, "info_player_start"); // Find it :)
self.classname = "player"; // I'm a player!
self.health = self.max_health = 100; // My health (and my max) is 100
self.takedamage = DAMAGE_AIM; // I can be fired at
self.solid = SOLID_BBOX; // Things sort of 'slide' past me
self.movetype = MOVETYPE_WALK; // Yep, I want to walk.
self.flags = FL_CLIENT; // Yes, I'm a client.
pev->classname = "player"; // I'm a player!
pev->health = pev->max_health = 100; // My health (and my max) is 100
pev->takedamage = DAMAGE_AIM; // I can be fired at
pev->solid = SOLID_BBOX; // Things sort of 'slide' past me
pev->movetype = MOVETYPE_WALK; // Yep, I want to walk.
pev->flags = FL_CLIENT; // Yes, I'm a client.
self.origin = spawn_spot.origin + '0 0 1'; // Move to the spawnspot location
self.angles = spawn_spot.angles; // Face the angle the spawnspot indicates
self.fixangle = TRUE; // Turn this way immediately
pev->origin = spawn_spot.origin + '0 0 1'; // Move to the spawnspot location
pev->angles = spawn_spot.angles; // Face the angle the spawnspot indicates
pev->fixangle = TRUE; // Turn this way immediately
dprint("PutClientInServer()\n");
setmodel (self, "models/player.mdl"); // Set my player to the player model
setsize (self, VEC_HULL_MIN, VEC_HULL_MAX); // Set my size
setmodel (pev, "models/player.mdl"); // Set my player to the player model
setsize (pev, VEC_HULL_MIN, VEC_HULL_MAX); // Set my size
self.view_ofs = '0 0 22'; // Center my view
pev->view_ofs = '0 0 22'; // Center my view
setsize(self, '-16 -16 -32', '16 16 32' );
setsize(pev, '-16 -16 -32', '16 16 32' );
if (self.aflag)
if (pev->aflag)
CCamChasePlayer ();
self.velocity = '0 0 0'; // Stop any old movement
pev->velocity = '0 0 0'; // Stop any old movement
self.th_pain = PlayerPain;
self.th_die = PlayerDie;
pev->th_pain = PlayerPain;
pev->th_die = PlayerDie;
setstats( self, STAT_HEALTH_ICON, "i_health");
setstats( self, STAT_HEALTH, ftos(self.health));
//setstats( self, STAT_HELPICON, "i_help");
setstats( pev, STAT_HEALTH_ICON, "i_health");
setstats( pev, STAT_HEALTH, ftos(pev->health));
//setstats( pev, STAT_HELPICON, "i_help");
GetLevelParms();
};

75
vprogs/compile.log Normal file
View File

@ -0,0 +1,75 @@
=======================================================================
Xash3D started at Sep16 2007 [20:19:23]
=======================================================================
------- Loading bin/launch.dll [0.6] -------
Sys_LoadLibrary: Loading common.dll [2] - ok
------- Loading bin/common.dll [1.3] -------
CPU: AuthenticAMD [1 core]. Frequency: 1.8 Ghz
CPU Features: MMX 3DNow SSE SSE2 RDTSC CMOV FCMOV
Current search path:
./
--------------------Configuration: server - Vm16 Debug--------------------
Compiling...
defs.c
main.c
damage.c
player.c
client.c
dummys.c
ents/internal.c
ents/lights.c
ents/ambient.c
ents/ccam.c
ents/triggers/triggers.c
ents/triggers/trigger_generic.c
ents/triggers/trigger_once.c
ents/triggers/trigger_sequence.c
ents/triggers/trigger_message.c
ents/triggers/trigger_counter.c
ents/triggers/trigger_setviewpoint.c
ents/triggers/trigger_teleport.c
ents/triggers/trigger_hurt.c
ents/triggers/trigger_push.c
ents/triggers/trigger_changelevel.c
ents/triggers/trigger_setskill.c
ents/triggers/trigger_secret.c
ents/funcs/funcs.c
ents/funcs/func_mover.c
ents/funcs/func_door.c
ents/funcs/func_button.c
ents/funcs/func_path_corner.c
ents/funcs/func_train.c
ents/items/items.c
impulses.c
writing progdefs.h
Progs should run on any Quake executor
client.c(75) : warning C2: 'who' : unreferenced local variable
client.c(76) : warning C2: 'fragnum' : unreferenced local variable
dummys.c(131) : warning C2: 'f' : unreferenced local variable
dummys.c(131) : warning C2: 'g' : unreferenced local variable
ents/triggers/trigger_setviewpoint.c(26) : warning C2: 'oldpev' : unreferenced local variable
ents/triggers/trigger_setviewpoint.c(26) : warning C2: 'oldtrig' : unreferenced local variable
18752 strofs (of 1000000)
2805 numstatements (of 524288)
263 numfunctions (of 16384)
893 numglobaldefs (of 32768)
234 numfielddefs (209 unique) (of 2048)
903 numpr_globals (of 65536)
Writing server.dat
63476 TOTAL SIZE
17 unique precache_sounds
5 unique precache_models
optres_shortenifnots 30
optres_overlaptemps 1282
optres_nonvec_parms 457
optres_assignments 58
optres_unreferenced 92
optres_dupconstdefs 84
‘ª®¯¨à®¢ ­® ä ©«®¢: 1.
server.dat - 0 error(s), 6 warning(s)
Sys_FreeLibrary: Unloading common.dll
=======================================================================
Xash3D stopped at Sep16 2007 [20:19:24]
=======================================================================

View File

@ -18,7 +18,7 @@ void(entity who_died, entity who_killed) ClientObiturary;
void(entity targ, entity attacker) Killed =
{
local entity oself;
local entity oldpev;
if (targ.health < -99)
targ.health = -99; // don't let sbar look bad if a player
@ -26,10 +26,10 @@ void(entity targ, entity attacker) Killed =
targ.takedamage = DAMAGE_NO;
targ.touch = SUB_Null;
oself = self;
self = targ; // self must be targ for th_die
self.th_die ();
self = oself;
oldpev = pev;
pev = targ; // pev must be targ for th_die
pev->th_die ();
pev = oldpev;
ClientObiturary(targ, attacker);
};
@ -69,7 +69,7 @@ This should be the only function that ever reduces health.
void(entity targ, entity inflictor, entity attacker, float damage) T_Damage=
{
local vector dir;
local entity oldself;
local entity oldpev;
if (!targ.takedamage)
return;
@ -86,7 +86,7 @@ void(entity targ, entity inflictor, entity attacker, float damage) T_Damage=
}
// check for godmode
if (targ.flags & FL_GODMODE)
if (targ.aiflags & AI_GODMODE)
return;
// add to the damage total for clients, which will be sent as a single
@ -112,13 +112,13 @@ void(entity targ, entity inflictor, entity attacker, float damage) T_Damage=
}
// react to the damage
oldself = self;
self = targ;
oldpev = pev;
pev = targ;
if (self.th_pain)
self.th_pain (attacker, damage);
if (pev->th_pain)
pev->th_pain (attacker, damage);
self = oldself;
pev = oldpev;
};
@ -131,33 +131,33 @@ Can be used for clients or monsters
*/
void() WaterMove =
{
if (self.movetype == MOVETYPE_NOCLIP)
if (pev->movetype == MOVETYPE_NOCLIP)
return;
if (self.health < 0)
if (pev->health < 0)
return;
if (self.waterlevel != 3)
if (pev->waterlevel != 3)
{
self.air_finished = time + 12;
self.dmg = 2;
pev->air_finished = time + 12;
pev->dmg = 2;
}
else if (self.air_finished < time && self.pain_finished < time)
else if (pev->air_finished < time && pev->pain_finished < time)
{ // drown!
self.dmg = self.dmg + 2;
if (self.dmg > 15)
self.dmg = 10;
T_Damage (self, world, world, self.dmg);
self.pain_finished = time + 1;
pev->dmg = pev->dmg + 2;
if (pev->dmg > 15)
pev->dmg = 10;
T_Damage (pev, world, world, pev->dmg);
pev->pain_finished = time + 1;
}
if (self.watertype == CONTENT_LAVA && self.dmgtime < time)
if (pev->watertype == CONTENT_LAVA && pev->dmgtime < time)
{ // do damage
self.dmgtime = time + 0.2;
T_Damage (self, world, world, 6*self.waterlevel);
pev->dmgtime = time + 0.2;
T_Damage (pev, world, world, 6*pev->waterlevel);
}
else if (self.watertype == CONTENT_SLIME && self.dmgtime < time)
else if (pev->watertype == CONTENT_SLIME && pev->dmgtime < time)
{ // do damage
self.dmgtime = time + 1;
T_Damage (self, world, world, 4*self.waterlevel);
pev->dmgtime = time + 1;
T_Damage (pev, world, world, 4*pev->waterlevel);
}
};

View File

@ -14,120 +14,173 @@
*/
// These lines CANNOT be altered/moved
entity self;
entity other;
entity world;
float time;
float frametime;
float force_retouch; // force all entities to touch triggers
string mapname;
float deathmatch;
float coop;
float teamplay;
float serverflags; // propagated from level to level, used to
float total_secrets;
float total_monsters;
float found_secrets; // number of secrets found
float killed_monsters; // number of monsters killed
float parm1, parm2, parm3, parm4, parm5, parm6, parm7, parm8, parm9, parm10, parm11, parm12, parm13, parm14, parm15, parm16;
vector v_forward, v_up, v_right; // set by makevectors()
float trace_allsolid;
float trace_startsolid;
float trace_fraction;
vector trace_endpos;
vector trace_plane_normal;
float trace_plane_dist;
entity trace_ent;
float trace_inopen;
float trace_inwater;
// pointers to ents
entity pev; // Pointer EntVars (same as self)
entity other;
entity world;
entity msg_entity; // destination of single entity writes
void() main; // only for testing
void() StartFrame;
void() EndFrame;
void() PlayerPreThink;
void() PlayerPostThink;
void() ClientKill;
void() ClientConnect;
void() PutClientInServer; // call after setting the parm1... parms
void() ClientDisconnect;
void() SetNewParms; // called when a client first connects to
void() SetChangeParms; // call to set parms for self so they can
void end_sys_globals; // flag for structure dumping
// timer
float time;
float frametime;
.float modelindex; // *** model index in the precached list
.vector absmin, absmax; // *** origin + mins / maxs
.float ltime; // local time for entity
.float movetype;
.float solid;
.vector origin; // ***
.vector oldorigin; // ***
.vector velocity;
.vector angles;
.vector avelocity;
.vector punchangle; // temp angle adjust from damage or recoil
.string classname; // spawn function
.string model;
.float frame;
.float skin;
.float body;
.float effects;
.float sequence;
.float renderfx;
.vector mins, maxs; // bounding box extents reletive to origin
.vector size; // maxs - mins
.void() touch;
.void() use;
.void() think;
.void() blocked; // for doors or plats, called when can't push other
.float nextthink;
.entity groundentity;
.float health;
.float frags;
.float weapon; // one of the IT_SHOTGUN, etc flags
.string weaponmodel;
.float weaponframe;
.float currentammo;
.float ammo_shells, ammo_nails, ammo_rockets, ammo_cells;
.float items; // bit flags
.float takedamage;
.entity chain;
.float deadflag;
.vector view_ofs; // add to origin to get eye point
.float button0; // fire
.float button1; // use
.float button2; // jump
.float impulse; // weapon changes
.float fixangle;
.vector v_angle; // view / targeting angle for players
.float idealpitch; // calculated pitch angle for lookup up slopes
.string netname;
.entity enemy;
.float flags;
.float colormap;
.float team;
.float max_health; // players maximum health is stored here
.float teleport_time; // don't back up
.float armortype; // save this fraction of incoming damage
.float armorvalue;
.float waterlevel; // 0 = not in, 1 = feet, 2 = wast, 3 = eyes
.float watertype; // a contents value
.float ideal_yaw;
.float yaw_speed;
.entity aiment;
.entity goalentity; // a movetarget or an enemy
.float spawnflags;
.string target;
.string targetname;
.float dmg_take;
.float dmg_save;
.entity dmg_inflictor;
.entity owner; // who launched a missile
.vector movedir; // mostly for doors, but also used for waterjump
.string message; // trigger messages
.float sounds; // either a cd track number or sound number
.string noise, noise1, noise2, noise3; // contains names of wavs to play
// map global info
string mapname;
string startspot;
vector spotoffset;
// gameplay modes
float deathmatch;
float coop;
float teamplay;
float serverflags; // propagated from level to level, used to
// game info
float total_secrets;
float total_monsters;
float found_secrets; // number of secrets found
float killed_monsters; // number of monsters killed
// MakeVectors result
vector v_forward;
vector v_right;
vector v_up;
// SV_trace result
float trace_allsolid;
float trace_startsolid;
float trace_fraction;
vector trace_endpos;
vector trace_plane_normal;
float trace_plane_dist;
float trace_hitgroup;
float trace_contents;
entity trace_ent;
float trace_flags;
void() main; // only for testing
void() StartFrame;
void() EndFrame;
void() PlayerPreThink;
void() PlayerPostThink;
void() ClientKill;
void() ClientConnect;
void() PutClientInServer; // call after setting the parm1... parms
void() ClientDisconnect;
void() SetNewParms; // called when a client first connects to
void() SetChangeParms; // call to set parms for self so they can
void end_sys_globals; // flag for structure dumping
// base entity info
.string classname;
.string globalname;
.float modelindex;
// physics description
.vector origin;
.vector angles;
.vector velocity;
.vector avelocity;
.vector post_origin;
.vector post_angles;
.vector post_velocity;
.vector post_avelocity;
.vector origin_offset;
.vector angles_offset;
.float bouncetype;
.float movetype;
.float solid;
.vector absmin, absmax;
.vector mins, maxs;
.vector size;
// entity base description
.entity chain; // dynamic list of all ents
.string model;
.float frame;
.float sequence;
.float renderfx;
.float effects;
.float skin;
.float body;
.string weaponmodel;
.float weaponframe;
// base generic funcs
.void() use;
.void() touch;
.void() think;
.void() blocked;
.void() activate;
// npc generic funcs
.void() walk;
.void() jump;
.void() duck;
// flags
.float flags;
.float aiflags;
.float spawnflags;
// other variables
.entity groundentity;
.float nextthink;
.float takedamage;
.float health;
.float frags;
.float weapon;
.float items;
.string target;
.string parent;
.string targetname;
.entity aiment; // attachment edict
.entity goalentity;
.vector punchangle;
.float deadflag;
.vector view_ofs; //.entity viewheight;
.float button0;
.float button1;
.float button2;
.float impulse;
.float fixangle;
.vector v_angle;
.float idealpitch;
.string netname;
.entity enemy;
.float colormap;
.float team;
.float max_health;
.float teleport_time;
.float armortype;
.float armorvalue;
.float waterlevel;
.float watertype;
.float ideal_yaw;
.float yaw_speed;
.float dmg_take;
.float dmg_save;
.entity dmg_inflictor;
.entity owner;
.vector movedir;
.string message;
.float sounds;
.string noise;
.string noise1;
.string noise2;
.string noise3;
.float jumpup;
.float jumpdn;
.entity movetarget;
.float mass;
.float density;
.float gravity;
.float dmg;
.float dmgtime;
.float speed;
void end_sys_fields; // flag for structure dumping
// End. Lines below this MAY be altered, to some extent
@ -240,19 +293,31 @@ float TRUE = 1;
#define STAT_ZOOM 23
#define MAX_STATS 32
// edict.aiflags
#define AI_FLY 1 // monster is flying
#define AI_SWIM 2 // swimming monster
#define AI_ONGROUND 4 // monster is onground
#define AI_PARTIALONGROUND 8 // monster is partially onground
#define AI_GODMODE 16 // monster don't give damage at all
#define AI_NOTARGET 32 // monster will no searching enemy's
#define AI_NOSTEP 64 // Lazarus stuff
#define AI_DUCKED 128 // monster (or player) is ducked
#define AI_JUMPING 256 // monster (or player) is jumping
#define AI_FROZEN 512 // stop moving, but continue thinking
#define AI_ACTOR 1024 // disable ai for actor
#define AI_DRIVER 2048 // npc or player driving vehcicle or train
#define AI_SPECTATOR 4096 // spectator mode for clients
// edict.flags
float FL_FLY = 1;
float FL_SWIM = 2;
float FL_CLIENT = 8; // set for all client edicts
float FL_INWATER = 16; // for enter / leave water splash
float FL_MONSTER = 32;
float FL_GODMODE = 64; // player cheat
float FL_NOTARGET = 128; // player cheat
float FL_ITEM = 256; // extra wide size for bonus items
float FL_ONGROUND = 512; // standing on something
float FL_PARTIALGROUND = 1024; // not all corners are valid
float FL_WATERJUMP = 2048; // player jumping out of water
float FL_JUMPRELEASED = 4096; // for jump debouncing
#define FL_CLIENT 1 // this is client
#define FL_MONSTER 2 // this is npc
#define FL_DEADMONSTER 4
#define FL_WORLDBRUSH 8 // Not moveable/removeable brush entity
#define FL_DORMANT 16 // Entity is dormant, no updates to client
#define FL_FRAMETHINK 32 // entity will be thinking every frame
#define FL_GRAPHED 64 // ainode list member
#define FL_FLOAT 128 // this entity can be floating. FIXME: remove this ?
#define FL_TRACKTRAIN 256 // this is tracktrain entity
// edict.movetype values
float MOVETYPE_NONE = 0; // never moves
@ -424,7 +489,7 @@ string string_null; // null string, nothing should be held here
void(vector o, vector d, float color, float count) particle = #48;// start a particle effect
void(string s) bprint = #23;
void(entity client, string s) sprint = #24;
void() SUB_Remove = {remove(self);};
void() SUB_Remove = {remove(pev);};
// End
// Damage.qc

View File

@ -4,44 +4,44 @@
+------+-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-+
| Scratch Http://www.admdev.com/scratch |
+=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-+
| This file contains remove(self); statements for entities not yet coded. |
| This file contains remove(pev); statements for entities not yet coded. |
| This avoids Quake spewing out pages and pages of error messages when |
| loading maps. |
+=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-+
*/
// General Junk
void() event_lightning = {remove(self);};
void() misc_fireball = {remove(self);};
void() misc_explobox2 = {remove(self);};
void() trap_spikeshooter = {remove(self);};
void() trap_shooter = {remove(self);};
void() func_bossgate = {remove(self);};
void() func_episodegate = {remove(self);};
//void() func_illusionary = {remove(self);};
//void() func_train = {remove(self);};
//void() func_button = {remove(self);};
//void() func_door = {remove(self);};
void() func_door_secret = {remove(self);};
void() func_plat = {remove(self);};
void() func_wall = {remove(self);};
void() info_intermission = {remove(self);};
void() info_null = {remove(self);};
//void() info_teleport_destination= {remove(self);};
//void() path_corner = {remove(self);};
void() event_lightning = {remove(pev);};
void() misc_fireball = {remove(pev);};
void() misc_explobox2 = {remove(pev);};
void() trap_spikeshooter = {remove(pev);};
void() trap_shooter = {remove(pev);};
void() func_bossgate = {remove(pev);};
void() func_episodegate = {remove(pev);};
//void() func_illusionary = {remove(pev);};
//void() func_train = {remove(pev);};
//void() func_button = {remove(pev);};
//void() func_door = {remove(pev);};
void() func_door_secret = {remove(pev);};
void() func_plat = {remove(pev);};
void() func_wall = {remove(pev);};
void() info_intermission = {remove(pev);};
void() info_null = {remove(pev);};
//void() info_teleport_destination= {remove(pev);};
//void() path_corner = {remove(pev);};
// Triggers
//void() trigger_relay = {remove(self);};
//void() trigger_multiple = {remove(self);};
//void() trigger_once = {remove(self);};
//void() trigger_changelevel = {remove(self);};
//void() trigger_counter = {remove(self);};
//void() trigger_teleport = {remove(self);};
//void() trigger_secret = {remove(self);};
//void() trigger_setskill = {remove(self);};
void() trigger_monsterjump = {remove(self);};
void() trigger_onlyregistered = {remove(self);};
//void() trigger_push = {remove(self);};
//void() trigger_hurt = {remove(self);};
//void() trigger_relay = {remove(pev);};
//void() trigger_multiple = {remove(pev);};
//void() trigger_once = {remove(pev);};
//void() trigger_changelevel = {remove(pev);};
//void() trigger_counter = {remove(pev);};
//void() trigger_teleport = {remove(pev);};
//void() trigger_secret = {remove(pev);};
//void() trigger_setskill = {remove(pev);};
void() trigger_monsterjump = {remove(pev);};
void() trigger_onlyregistered = {remove(pev);};
//void() trigger_push = {remove(pev);};
//void() trigger_hurt = {remove(pev);};
// Player Starts
void() info_player_start = {};
@ -50,45 +50,45 @@ void() info_player_deathmatch = {};
void() info_player_coop = {};
// Weapons
void() weapon_supershotgun = {remove(self);};
void() weapon_nailgun = {remove(self);};
void() weapon_supernailgun = {remove(self);};
void() weapon_grenadelauncher = {remove(self);};
void() weapon_rocketlauncher = {remove(self);};
void() weapon_lightning = {remove(self);};
void() weapon_supershotgun = {remove(pev);};
void() weapon_nailgun = {remove(pev);};
void() weapon_supernailgun = {remove(pev);};
void() weapon_grenadelauncher = {remove(pev);};
void() weapon_rocketlauncher = {remove(pev);};
void() weapon_lightning = {remove(pev);};
// Monsters
void() monster_enforcer = {remove(self);};
void() monster_ogre = {remove(self);};
void() monster_demon1 = {remove(self);};
void() monster_shambler = {remove(self);};
void() monster_knight = {remove(self);};
void() monster_army = {remove(self);};
void() monster_wizard = {remove(self);};
void() monster_dog = {remove(self);};
void() monster_zombie = {remove(self);};
void() monster_boss = {remove(self);};
void() monster_tarbaby = {remove(self);};
void() monster_hell_knight = {remove(self);};
void() monster_fish = {remove(self);};
void() monster_shalrath = {remove(self);};
void() monster_oldone = {remove(self);};
void() monster_enforcer = {remove(pev);};
void() monster_ogre = {remove(pev);};
void() monster_demon1 = {remove(pev);};
void() monster_shambler = {remove(pev);};
void() monster_knight = {remove(pev);};
void() monster_army = {remove(pev);};
void() monster_wizard = {remove(pev);};
void() monster_dog = {remove(pev);};
void() monster_zombie = {remove(pev);};
void() monster_boss = {remove(pev);};
void() monster_tarbaby = {remove(pev);};
void() monster_hell_knight = {remove(pev);};
void() monster_fish = {remove(pev);};
void() monster_shalrath = {remove(pev);};
void() monster_oldone = {remove(pev);};
void() item_health = {remove(self);};
void() item_megahealth_rot = {remove(self);};
void() item_armor1 = {remove(self);};
void() item_armor2 = {remove(self);};
void() item_armorInv = {remove(self);};
void() item_shells = {remove(self);};
void() item_spikes = {remove(self);};
void() item_rockets = {remove(self);};
void() item_cells = {remove(self);};
void() item_key1 = {remove(self);};
void() item_key2 = {remove(self);};
void() item_artifact_invulnerability = {remove(self);};
void() item_artifact_envirosuit = {remove(self);};
void() item_artifact_invisibility = {remove(self);};
void() item_artifact_super_damage = {remove(self);};
void() item_health = {remove(pev);};
void() item_megahealth_rot = {remove(pev);};
void() item_armor1 = {remove(pev);};
void() item_armor2 = {remove(pev);};
void() item_armorInv = {remove(pev);};
void() item_shells = {remove(pev);};
void() item_spikes = {remove(pev);};
void() item_rockets = {remove(pev);};
void() item_cells = {remove(pev);};
void() item_key1 = {remove(pev);};
void() item_key2 = {remove(pev);};
void() item_artifact_invulnerability = {remove(pev);};
void() item_artifact_envirosuit = {remove(pev);};
void() item_artifact_invisibility = {remove(pev);};
void() item_artifact_super_damage = {remove(pev);};
void barrel_spawn(string netname1, string model1, string deathmessage, float damage)
{
@ -98,31 +98,31 @@ void barrel_spawn(string netname1, string model1, string deathmessage, float dam
precache_model (model1);
precache_sound ("weapons/r_exp3.wav");
if (!self.dmg) self.dmg = damage;
self.netname = netname1;
if (!pev->dmg) pev->dmg = damage;
pev->netname = netname1;
self.owner = self;
self.solid = SOLID_BBOX;
self.movetype = MOVETYPE_NONE;
setmodel (self, model1);
self.health = 20;
self.th_die = SUB_Null;
self.takedamage = DAMAGE_AIM;
self.think = SUB_Null;
self.nextthink = -1;
self.flags = 0;
pev->owner = pev;
pev->solid = SOLID_BBOX;
pev->movetype = MOVETYPE_NONE;
setmodel (pev, model1);
pev->health = 20;
pev->th_die = SUB_Null;
pev->takedamage = DAMAGE_AIM;
pev->think = SUB_Null;
pev->nextthink = -1;
pev->flags = 0;
self.origin_z = self.origin_z + 2;
oldz = self.origin_z;
pev->origin_z = pev->origin_z + 2;
oldz = pev->origin_z;
droptofloor();
if (oldz - self.origin_z > 250)
if (oldz - pev->origin_z > 250)
{
dprint ("explosive box fell out of level at ");
dprint (vtos(self.origin));
dprint (vtos(pev->origin));
dprint ("\n");
remove(self);
remove(pev);
}
}

View File

@ -23,6 +23,6 @@ void() ambient_swamp2 = {doambient("ambience/swamp2.wav", 0.5);};
void(string soundfile, float volume) doambient =
{
precache_sound (soundfile);
ambientsound (self.origin, soundfile, volume, ATTN_STATIC);
ambientsound (pev->origin, soundfile, volume, ATTN_STATIC);
};

View File

@ -8,13 +8,13 @@ void () CCam;
void () CCamChasePlayer =
{
makevectors (self.v_angle);
traceline ((self.origin + self.view_ofs),((((self.origin + self.view_ofs) + (v_forward * self.camview_z)) + (v_up * self.camview_x)) + (v_right * self.camview_y)),FALSE,self);
setorigin (self.trigger_field,trace_endpos);
makevectors (pev->v_angle);
traceline ((pev->origin + pev->view_ofs),((((pev->origin + pev->view_ofs) + (v_forward * pev->camview_z)) + (v_up * pev->camview_x)) + (v_right * pev->camview_y)),FALSE,pev);
setorigin (pev->trigger_field,trace_endpos);
MsgBegin( 5 );
WriteEntity (self.trigger_field);
MsgEnd( MSG_ONE, '0 0 0', self );
self.weaponmodel = "";
WriteEntity (pev->trigger_field);
MsgEnd( MSG_ONE, '0 0 0', pev );
pev->weaponmodel = "";
};
void () CCam =
@ -22,25 +22,24 @@ void () CCam =
local entity camera;
local entity spot;
if (self.aflag == FALSE)
if (pev->aflag == FALSE)
{
self.aflag = TRUE;
pev->aflag = TRUE;
camera = spawn ();
spot = spawn ();
self.trigger_field = camera;
pev->trigger_field = camera;
camera.classname = "camera";
camera.movetype = MOVETYPE_FLY;
camera.solid = SOLID_NOT;
setmodel (camera,"progs/eyes.mdl");
setsize (camera,'0 0 0','0 0 0');
makevectors (self.v_angle);
traceline ((self.origin + self.view_ofs),(((self.origin + self.view_ofs)
+ (v_forward * -64.000))),FALSE,self);
self.camview = '0 0 -64'; // added
makevectors (pev->v_angle);
traceline ((pev->origin + pev->view_ofs),(((pev->origin + pev->view_ofs)
+ (v_forward * -64.000))),FALSE,pev);
pev->camview = '0 0 -64'; // added
setorigin (camera,trace_endpos);
camera.angles = self.angles;
self.weaponmodel = "";
msg_entity = self;
camera.angles = pev->angles;
pev->weaponmodel = "";
MsgBegin( 5 );
WriteEntity (camera);
@ -48,22 +47,21 @@ void () CCam =
WriteAngle (camera.angles_x);
WriteAngle (camera.angles_y);
WriteAngle (camera.angles_z);
MsgEnd( MSG_ONE, '0 0 0', self );
sprint (self,"Chase Cam On\n");
MsgEnd( MSG_ONE, '0 0 0', pev );
sprint (pev,"Chase Cam On\n");
}
else
{
self.aflag = FALSE;
msg_entity = self;
pev->aflag = FALSE;
MsgBegin( 5 );
WriteEntity (self);
WriteEntity (pev);
WriteByte (10);
WriteAngle (camera.angles_x);
WriteAngle (camera.angles_y);
WriteAngle (camera.angles_z);
MsgEnd( MSG_ONE, '0 0 0', self );
remove (self.trigger_field);
sprint (self,"Chase Cam Off\n");
MsgEnd( MSG_ONE, '0 0 0', pev );
remove (pev->trigger_field);
sprint (pev,"Chase Cam Off\n");
//W_SetCurrentAmmo ();
}
};

View File

@ -8,6 +8,6 @@ Points func_button to the unified func_mover(); code.
void() func_button =
{
func_mover();
self.classname = "button";
pev->classname = "button";
};

View File

@ -8,6 +8,6 @@ Points func_door to the unified func_mover(); code.
void() func_door =
{
func_mover();
self.classname = "door";
pev->classname = "door";
bprint("func_door_spawn\n");
};

View File

@ -64,20 +64,20 @@ float MOVER_TOGGLE = 32;
void() func_mover_stop_general =
{
self.velocity = '0 0 0'; //Stop me!
self.touched = FALSE; //Touch me!
sound (self, CHAN_VOICE, self.noise1, 1, ATTN_NORM); //make a sound!
setorigin(self, self.dest); //set my origin exactly to dest.
pev->velocity = '0 0 0'; //Stop me!
pev->touched = FALSE; //Touch me!
sound (pev, CHAN_VOICE, pev->noise1, 1, ATTN_NORM); //make a sound!
setorigin(pev, pev->dest); //set my origin exactly to dest.
};
void() func_mover_stop =
{
func_mover_stop_general();
if(self.wait >= 0) //Return upon wait over!
if(pev->wait >= 0) //Return upon wait over!
{
self.think = func_mover_think;
self.nextthink = self.ltime + self.wait;
pev->think = func_mover_think;
pev->nextthink = time + pev->wait;
}
};
@ -88,7 +88,7 @@ void() func_mover_stop_dead =
void() func_mover_blocked =
{
T_Damage (other, self, self, self.dmg); //Do my damage;
T_Damage (other, pev, pev, pev->dmg); //Do my damage;
func_mover_think(); //Return;
};
@ -99,7 +99,7 @@ void(vector destination, float movespeed, void() dest_func) func_mover_move =
local float pathlength, traveltime;
//Calculate movement vector
path = destination - self.origin;
path = destination - pev->origin;
//Calculate length of movement vector;
pathlength = vlen(path);
@ -108,20 +108,20 @@ void(vector destination, float movespeed, void() dest_func) func_mover_move =
traveltime = (pathlength) / (movespeed);
// scale the destdelta vector by the time spent traveling to get velocity
self.velocity = path * (1/traveltime);
pev->velocity = path * (1/traveltime);
if(traveltime < 0.1 || self.origin == destination)
if(traveltime < 0.1 || pev->origin == destination)
{
self.think = dest_func;
self.nextthink = self.ltime + 0.1;
self.dest = destination;
pev->think = dest_func;
pev->nextthink = time + 0.1;
pev->dest = destination;
return;
}
self.think = dest_func;
self.nextthink = self.ltime + traveltime;
pev->think = dest_func;
pev->nextthink = time + traveltime;
self.dest = destination;
pev->dest = destination;
};
void() func_mover_think =
@ -129,26 +129,26 @@ void() func_mover_think =
local vector a;
local void() b;
if(self.state == STATE_OPEN) //Am i open?
if(pev->state == STATE_OPEN) //Am i open?
{
self.state = STATE_CLOSED; //Now im closing!
a = self.pos1; //My first position!
pev->state = STATE_CLOSED; //Now im closing!
a = pev->pos1; //My first position!
b = func_mover_stop_dead; //Stopping func to use!
}
else if (self.state == STATE_CLOSED)
else if (pev->state == STATE_CLOSED)
{
self.state = STATE_OPEN;
a = self.pos2;
pev->state = STATE_OPEN;
a = pev->pos2;
if(self.spawnflags & MOVER_TOGGLE) //Am i toggable?
if(pev->spawnflags & MOVER_TOGGLE) //Am i toggable?
b = func_mover_stop_dead; //if yes.. stop me dead.
else
b = func_mover_stop; //if no.. return me;
}
func_mover_move(a, self.speed, b); //Loaded move function;
func_mover_move(a, pev->speed, b); //Loaded move function;
sound (self, CHAN_VOICE, self.noise2, 1, ATTN_NORM);
sound (pev, CHAN_VOICE, pev->noise2, 1, ATTN_NORM);
};
void() func_mover_fire =
@ -165,76 +165,76 @@ void() func_mover_touch =
if(other == world) //Are you the world?
return;
if(self.touched == FALSE)
if(pev->touched == FALSE)
{
self.triggerer = other;
pev->triggerer = other;
self.touched = TRUE; //stop touching me!
self.think = func_mover_fire; //set me next think
self.nextthink = self.ltime + self.delay; //set it so it happens in 0.1 secs from now.
pev->touched = TRUE; //stop touching me!
pev->think = func_mover_fire; //set me next think
pev->nextthink = time + pev->delay; //set it so it happens in 0.1 secs from now.
}
};
void() func_mover_use =
{
if(self.message)
centerprint(self.triggerer, self.message);
if(pev->message)
centerprint(pev->triggerer, pev->message);
self.touched = TRUE; //Fake touch!
pev->touched = TRUE; //Fake touch!
self.think = func_mover_fire; //set me next think!
self.nextthink = self.ltime + self.delay; //in delay
pev->think = func_mover_fire; //set me next think!
pev->nextthink = time + pev->delay; //in delay
};
void() func_mover_die =
{
self.health = self.max_health; //reset health on death;
pev->health = pev->max_health; //reset health on death;
self.takedamage = DAMAGE_YES; //These two are set to no and null in killed function;
self.touch = func_mover_touch; //[Damage.QC]
pev->takedamage = DAMAGE_YES; //These two are set to no and null in killed function;
pev->touch = func_mover_touch; //[Damage.QC]
};
void() func_mover =
{
func_setup(); //Sets up some basic func properties;[funcs.qc]
self.classname = "mover";
pev->classname = "mover";
if(self.health)
if(pev->health)
{
self.max_health = self.health;
self.takedamage = DAMAGE_YES;
pev->max_health = pev->health;
pev->takedamage = DAMAGE_YES;
}
self.blocked = func_mover_blocked;
self.use = func_mover_use;
self.touch = func_mover_touch;
self.th_die = func_mover_die;
pev->blocked = func_mover_blocked;
pev->use = func_mover_use;
pev->touch = func_mover_touch;
pev->th_die = func_mover_die;
//func_mover; DEFAULTS;
if (!self.speed)
self.speed = 100;
if (!self.wait)
self.wait = 3;
if (!self.lip)
self.lip = 8;
if (!self.dmg)
self.dmg = 2;
if (!pev->speed)
pev->speed = 100;
if (!pev->wait)
pev->wait = 3;
if (!pev->lip)
pev->lip = 8;
if (!pev->dmg)
pev->dmg = 2;
if(!self.delay)
self.delay = 0.1; //stuff with 0 delay dont move! (or work ;) )
if(!pev->delay)
pev->delay = 0.1; //stuff with 0 delay dont move! (or work ;) )
//func_mover; positions; .pos1 == closed; .pos2 == open;
self.pos1 = self.origin;
self.pos2 = self.pos1 + self.movedir*(fabs(self.movedir*self.size) - self.lip);
pev->pos1 = pev->origin;
pev->pos2 = pev->pos1 + pev->movedir*(fabs(pev->movedir*pev->size) - pev->lip);
if(self.spawnflags & MOVER_START_OPEN)
if(pev->spawnflags & MOVER_START_OPEN)
{
self.state = STATE_OPEN;
setorigin(self, self.pos2);
pev->state = STATE_OPEN;
setorigin(pev, pev->pos2);
}
else
self.state = STATE_CLOSED;
pev->state = STATE_CLOSED;
};

View File

@ -8,9 +8,9 @@ Currently only trains use this to tell their next stop position;
void() func_path_corner =
{
if (!self.targetname)
if (!pev->targetname)
objerror ("monster_movetarget: no targetname");
self.solid = SOLID_TRIGGER;
setsize (self, '-8 -8 -8', '8 8 8');
pev->solid = SOLID_TRIGGER;
setsize (pev, '-8 -8 -8', '8 8 8');
};

View File

@ -21,15 +21,15 @@ If the train has the 'wait' field set on its spawn it waits the alloted time the
void() func_train_wait =
{
if (self.wait)
if (pev->wait)
{
self.nextthink = self.ltime + self.wait;
//sound (self, CHAN_VOICE, self.noise, 1, ATTN_NORM);
pev->nextthink = time + pev->wait;
//sound (pev, CHAN_VOICE, pev->noise, 1, ATTN_NORM);
}
else
self.nextthink = self.ltime + 0.1;
pev->nextthink = time + 0.1;
self.think = func_train_next;
pev->think = func_train_next;
};
/*
@ -44,21 +44,21 @@ void() func_train_next =
{
local entity targ;
targ = find (world, targetname, self.target);
targ = find (world, targetname, pev->target);
self.target = targ.target;
pev->target = targ.target;
if (!self.target)
if (!pev->target)
objerror ("train_next: no next target");
if (targ.wait)
self.wait = targ.wait;
pev->wait = targ.wait;
else
self.wait = 0;
pev->wait = 0;
//sound (self, CHAN_VOICE, self.noise1, 1, ATTN_NORM);
//sound (pev, CHAN_VOICE, pev->noise1, 1, ATTN_NORM);
func_mover_move (targ.origin - self.mins, self.speed, func_train_wait);
func_mover_move (targ.origin - pev->mins, pev->speed, func_train_wait);
};
/*
@ -72,16 +72,16 @@ void() func_train_find =
{
local entity targ;
targ = find (world, targetname, self.target);
targ = find (world, targetname, pev->target);
self.target = targ.target;
pev->target = targ.target;
setorigin (self, targ.origin - self.mins);
setorigin (pev, targ.origin - pev->mins);
if (!self.targetname) // not triggered, so start immediately
if (!pev->targetname) // not triggered, so start immediately
{
self.nextthink = self.ltime + 0.1;
self.think = func_train_next;
pev->nextthink = time + 0.1;
pev->think = func_train_next;
}
};
@ -95,11 +95,11 @@ If targeted the train starts moving then cannot be used/targetted again;
void() func_train_use =
{
if(self.touched == FALSE)
if(pev->touched == FALSE)
{
self.touched = TRUE;
self.nextthink = self.ltime + 0.1;
self.think = func_train_next;
pev->touched = TRUE;
pev->nextthink = time + 0.1;
pev->think = func_train_next;
}
};
@ -114,19 +114,19 @@ void() func_train =
{
func_setup();
setsize (self, self.mins , self.maxs);
setsize (pev, pev->mins , pev->maxs);
self.classname = "train";
pev->classname = "train";
//func_train defaults;
if (!self.speed)
self.speed = 100;
if (!self.target)
if (!pev->speed)
pev->speed = 100;
if (!pev->target)
objerror ("func_train without a target");
if (!self.dmg)
self.dmg = 2;
if (!pev->dmg)
pev->dmg = 2;
self.nextthink = self.ltime + 0.1;
self.think = func_train_find;
pev->nextthink = time + 0.1;
pev->think = func_train_find;
};

View File

@ -20,7 +20,7 @@ FUNC_SETUP();
Description;
This function is used by ALL our map func_'s. It sets up the func_'s basic and most common properties;
With the only exception being 'self.movetype = MOVETYPE_PUSH;' which usually gets set to something else
With the only exception being 'pev->movetype = MOVETYPE_PUSH;' which usually gets set to something else
in the func_'s spawning function after this has been called. It's included because out of the func_'s we have so far
more require this field to be set to that than any other.
*/
@ -28,12 +28,12 @@ void() func_setup =
{
SetMovedir ();
self.solid = SOLID_BSP;
self.movetype = MOVETYPE_PUSH;
pev->solid = SOLID_BSP;
pev->movetype = MOVETYPE_PUSH;
setorigin (self, self.origin);
setmodel (self, self.model);
setsize (self, self.mins , self.maxs);
setorigin (pev, pev->origin);
setmodel (pev, pev->model);
setsize (pev, pev->mins , pev->maxs);
};
/*
@ -48,7 +48,7 @@ void() func_illusionary =
{
func_setup();
self.solid = SOLID_TRIGGER;
pev->solid = SOLID_TRIGGER;
};
/*
@ -64,10 +64,10 @@ Jon Eriksson - For the idea and base code!
void() func_place_model =
{
precache_model (self.model);
precache_model (pev->model);
func_setup();
self.movetype = MOVETYPE_NONE;
pev->movetype = MOVETYPE_NONE;
};

View File

@ -11,16 +11,14 @@
.string name; //
.entity triggerer;
void(string modelname) Precache_Set = // Precache model, and set myself to it
void(string modelname) Precache_Set = // Precache model, and set mypev to it
{
precache_model(modelname);
setmodel(self, modelname);
setmodel(pev, modelname);
};
void(entity ent) SetViewPoint = // Alter the Viewpoint Entity
{
msg_entity = self; // This message is to myself.
MsgBegin(SVC_SETVIEW); // Network Protocol: Set Viewpoint Entity
WriteEntity(ent); // Write entity to clients.
MsgEnd( MSG_ONE, '0 0 0', ent );
@ -32,44 +30,44 @@ just constant angles.
*/
void() SetMovedir =
{
if (self.angles == '0 -1 0')
self.movedir = '0 0 1';
else if (self.angles == '0 -2 0')
self.movedir = '0 0 -1';
if (pev->angles == '0 -1 0')
pev->movedir = '0 0 1';
else if (pev->angles == '0 -2 0')
pev->movedir = '0 0 -1';
else
{
makevectors (self.angles);
self.movedir = v_forward;
makevectors (pev->angles);
pev->movedir = v_forward;
}
self.angles = '0 0 0';
pev->angles = '0 0 0';
};
void() IEM_usetarget =
{
local entity t, oldself, oldother;
local entity t, oldpev, oldother;
if(self.target)
if(pev->target)
{
t = find(world, targetname, self.target);
t = find(world, targetname, pev->target);
while(t)
{
if(self.triggerer)
t.triggerer = self.triggerer;
if(pev->triggerer)
t.triggerer = pev->triggerer;
oldself = self;
oldpev = pev;
oldother = other;
self = t;
pev = t;
if(t.use)
t.use();
self = oldself;
pev = oldpev;
other = oldother;
t = find(t, targetname, self.target);
t = find(t, targetname, pev->target);
}
}
@ -80,5 +78,5 @@ void(float effect_type, vector effect_org) IEM_effects =
MsgBegin(SVC_TEMPENTITY);
WriteByte(effect_type);
WriteCoord(effect_org);
MsgEnd( MSG_BROADCAST, effect_org, self );
MsgEnd( MSG_BROADCAST, effect_org, pev );
};

View File

@ -23,20 +23,19 @@ It sets up all the required and most basic item parimeters.
void() item_setup =
{
if(!self.think) //Items should start after other solids....
if(!pev->think) //Items should start after other solids....
{
self.think = item_setup;
self.nextthink = time + 0.2;
pev->think = item_setup;
pev->nextthink = time + 0.2;
return;
}
self.oldmodel = self.model; // so it can be restored on respawn
pev->oldmodel = pev->model; // so it can be restored on respawn
self.flags = FL_ITEM; // make extra wide
self.solid = SOLID_TRIGGER; //Im a TRIGGER!
self.movetype = MOVETYPE_TOSS; //Toss me baby!... erm..
self.velocity = '0 0 0'; //Stop me moving!
self.origin_z = self.origin_z + 6; //Raise me a bit off the floor
pev->solid = SOLID_TRIGGER; //Im a TRIGGER!
pev->movetype = MOVETYPE_TOSS; //Toss me baby!... erm..
pev->velocity = '0 0 0'; //Stop me moving!
pev->origin_z = pev->origin_z + 6; //Raise me a bit off the floor
};
/*
@ -63,9 +62,9 @@ Makes the item pickupable again.
void() item_respawn =
{
setorigin(self, self.origin);
self.solid = SOLID_TRIGGER;
self.model = self.oldmodel;
setorigin(pev, pev->origin);
pev->solid = SOLID_TRIGGER;
pev->model = pev->oldmodel;
};
/*
@ -80,18 +79,18 @@ Stops the item getting picked up for a while, nextthink at bottom of code.
void() item_pickup =
{
self.solid = SOLID_NOT;
self.model = string_null;
pev->solid = SOLID_NOT;
pev->model = string_null;
IEM_usetarget();
if(self.spawnflags & ITEM_PICKUP_ONCE)
if(pev->spawnflags & ITEM_PICKUP_ONCE)
return;
self.think = item_respawn;
pev->think = item_respawn;
if(deathmatch)
self.nextthink = time + 20; //This ideally would be a CVAR
pev->nextthink = time + 20; //This ideally would be a CVAR
};

View File

@ -32,46 +32,46 @@ void() light_fluorospark = // Light with buzz ambient
void() light_globe = // Light with visible globe
{
Precache_Set("progs/s_light.spr"); // Set model
makestatic(self); // Static entity. Never changes.
makestatic(pev); // Static entity. Never changes.
};
void() light_torch_small_walltorch = // Light with visible wall torch
{
Precache_Set("progs/flame.mdl"); // Set model
makestatic(self); // Static entity. Never changes.
makestatic(pev); // Static entity. Never changes.
doambient("ambience/fire1.wav", 0.5); // Spawn fire ambient sound
};
void() light_flame_small_yellow = // Light with small flame & fire sound
{
Precache_Set("progs/flame2.mdl"); // Set model
makestatic(self); // Static entity. Never changes.
makestatic(pev); // Static entity. Never changes.
doambient("ambience/fire1.wav", 0.5); // Spawn fire ambient sound
};
void() light_flame_large_yellow = // Light with larger flame & fire sound
{
Precache_Set("progs/flame2.mdl"); // Set model
self.frame = 1; // Switch to second frame (large)
makestatic(self); // Static entity. Never changes.
pev->frame = 1; // Switch to second frame (large)
makestatic(pev); // Static entity. Never changes.
doambient("ambience/fire1.wav", 0.5); // Spawn fire ambient sound
};
void() light_flame_small_white = // Light with small flame & fire sound
{
Precache_Set("progs/flame2.mdl"); // Set model
makestatic(self); // Static entity. Never changes.
makestatic(pev); // Static entity. Never changes.
doambient("ambience/fire1.wav", 0.5); // Spawn fire ambient sound
};
void() Light_setup = // Set light on or off, as per spawnflags
{
if (self.style < 32) {return;} // Dont switch other styles.
if (pev->style < 32) {return;} // Dont switch other styles.
if (self.spawnflags & START_OFF)
lightstyle(self.style, "a"); // If light starts off, set it off.
if (pev->spawnflags & START_OFF)
lightstyle(pev->style, "a"); // If light starts off, set it off.
else
lightstyle(self.style, "m"); // If light starts ON, turn in ON. Simple :)
lightstyle(pev->style, "m"); // If light starts ON, turn in ON. Simple :)
};
void() LightStyles_setup =

View File

@ -7,17 +7,17 @@
*/
void() trigger_changelevel_touch =
{
changelevel(self.map);
changelevel(pev->map);
};
void() trigger_changelevel =
{
if (!self.map)
if (!pev->map)
objerror ("chagnelevel trigger doesn't have map");
trigger_setup();
self.touch = trigger_changelevel_touch;
pev->touch = trigger_changelevel_touch;
};

View File

@ -11,48 +11,48 @@ Counts the number of times it gets fired.. then fires its targets..
void() trigger_counter_use =
{
self.count = self.count - 1; //subtract my count by one; 'ive been triggered'
pev->count = pev->count - 1; //subtract my count by one; 'ive been triggered'
if(self.count < 0)
if(pev->count < 0)
return;
if(self.count != 0)
if(pev->count != 0)
{
if (self.count >= 4)
centerprint (self.triggerer, self.targ1);
else if (self.count == 3)
centerprint (self.triggerer, self.targ2);
else if (self.count == 2)
centerprint (self.triggerer, self.targ3);
if (pev->count >= 4)
centerprint (pev->triggerer, pev->targ1);
else if (pev->count == 3)
centerprint (pev->triggerer, pev->targ2);
else if (pev->count == 2)
centerprint (pev->triggerer, pev->targ3);
else
centerprint (self.triggerer, self.targ4);
centerprint (pev->triggerer, pev->targ4);
}
IEM_usetarget();
if(!(self.spawnflags & TRIGGER_ONCE)) //if im a trigger_once, remove me;
remove(self);
if(!(pev->spawnflags & TRIGGER_ONCE)) //if im a trigger_once, remove me;
remove(pev);
else
self.count = self.wait1; //restore old count
pev->count = pev->wait1; //restore old count
};
void() trigger_counter =
{
if(!self.count) //If my count not set in map default it to 1;
self.count = 1;
if(!pev->count) //If my count not set in map default it to 1;
pev->count = 1;
self.wait1 = self.count; //store count levels;
pev->wait1 = pev->count; //store count levels;
self.use = trigger_counter_use; //my use function;
pev->use = trigger_counter_use; //my use function;
if(!self.targ1) //if a custom message is not set use the standard ones instead;
self.targ1 = "There are more to go...";
if(!self.targ2)
self.targ2 = "Only 3 more to go...";
if(!self.targ3)
self.targ3 = "Only 2 more to go...";
if(!self.targ4)
self.targ4 = "Only 1 more to go...";
if(!pev->targ1) //if a custom message is not set use the standard ones instead;
pev->targ1 = "There are more to go...";
if(!pev->targ2)
pev->targ2 = "Only 3 more to go...";
if(!pev->targ3)
pev->targ3 = "Only 2 more to go...";
if(!pev->targ4)
pev->targ4 = "Only 1 more to go...";
self.classname = "t_counter";
pev->classname = "t_counter";
};

View File

@ -6,16 +6,16 @@
void() trigger_generic_think =
{
self.touched = FALSE;
pev->touched = FALSE;
if(self.message)
centerprint(self.triggerer , self.message);
if(pev->message)
centerprint(pev->triggerer , pev->message);
if(self.target)
if(pev->target)
IEM_usetarget();
if(self.spawnflags & TRIGGER_ONCE)
remove(self);
if(pev->spawnflags & TRIGGER_ONCE)
remove(pev);
};
void() trigger_generic_touch =
@ -23,39 +23,39 @@ void() trigger_generic_touch =
if(!(other.flags & FL_CLIENT))
return;
if(self.touched == FALSE)
if(pev->touched == FALSE)
{
self.triggerer = other;
pev->triggerer = other;
self.touched = TRUE;
self.think = trigger_generic_think;
self.nextthink = time + self.delay;
pev->touched = TRUE;
pev->think = trigger_generic_think;
pev->nextthink = time + pev->delay;
}
};
void() trigger_generic_use =
{
if(self.touched == TRUE)
if(pev->touched == TRUE)
return;
self.touched = TRUE;
pev->touched = TRUE;
if(self.message)
centerprint(self.triggerer, self.message);
if(pev->message)
centerprint(pev->triggerer, pev->message);
self.think = trigger_generic_think;
self.nextthink = time + self.delay;
pev->think = trigger_generic_think;
pev->nextthink = time + pev->delay;
};
void() trigger_generic =
{
trigger_setup();
self.touch = trigger_generic_touch;
self.use = trigger_generic_use;
pev->touch = trigger_generic_touch;
pev->use = trigger_generic_use;
self.classname = "generic";
pev->classname = "generic";
if(!self.delay)
self.delay = 0.1;
if(!pev->delay)
pev->delay = 0.1;
};

View File

@ -3,28 +3,28 @@
|TRIGGER_HURT|
+============+==============+
|Description; |
|Hurt player for self.dmg. |
|Hurt player for pev->dmg. |
+===========================+
*/
void() trigger_hurt_think =
{
self.solid = SOLID_TRIGGER;
self.touched = FALSE;
pev->solid = SOLID_TRIGGER;
pev->touched = FALSE;
};
void() trigger_hurt_touch =
{
if(other.takedamage)
{
if(self.touched == FALSE)
if(pev->touched == FALSE)
{
T_Damage (other, self, self, self.dmg);
T_Damage (other, pev, pev, pev->dmg);
self.touched = TRUE;
self.solid = SOLID_NOT;
self.think = trigger_hurt_think;
self.nextthink = time + 1;
pev->touched = TRUE;
pev->solid = SOLID_NOT;
pev->think = trigger_hurt_think;
pev->nextthink = time + 1;
}
}
};
@ -33,10 +33,10 @@ void() trigger_hurt =
{
trigger_setup();
self.touch = trigger_hurt_touch;
pev->touch = trigger_hurt_touch;
if(!self.dmg)
self.dmg = 5;
if(!pev->dmg)
pev->dmg = 5;
self.classname = "t_hurt";
pev->classname = "t_hurt";
};

View File

@ -10,26 +10,26 @@
void() trigger_message_think =
{
self.touched = FALSE;
pev->touched = FALSE;
if(self.message)
centerprint(self.triggerer, self.message);
if(self.message1)
if(pev->message)
centerprint(pev->triggerer, pev->message);
if(pev->message1)
{
sprint(self.triggerer, self.message1);
sprint(self.triggerer, "\n");
sprint(pev->triggerer, pev->message1);
sprint(pev->triggerer, "\n");
}
if(self.message2)
if(pev->message2)
{
dprint(self.message2);
dprint(pev->message2);
dprint("\n");
}
if(self.target)
if(pev->target)
IEM_usetarget();
if(self.spawnflags & TRIGGER_ONCE)
remove(self);
if(pev->spawnflags & TRIGGER_ONCE)
remove(pev);
};
void() trigger_message_touch =
@ -37,50 +37,50 @@ void() trigger_message_touch =
if(!(other.flags & FL_CLIENT))
return;
if(self.touched == FALSE)
if(pev->touched == FALSE)
{
self.touched = TRUE;
pev->touched = TRUE;
self.triggerer = other;
pev->triggerer = other;
self.think = trigger_message_think;
self.nextthink = time + self.delay;
pev->think = trigger_message_think;
pev->nextthink = time + pev->delay;
}
};
void() trigger_message_use =
{
if(self.touched == TRUE)
if(pev->touched == TRUE)
return;
self.touched = TRUE;
pev->touched = TRUE;
if(self.message)
centerprint(self.triggerer, self.message);
if(self.message1)
if(pev->message)
centerprint(pev->triggerer, pev->message);
if(pev->message1)
{
sprint(self.triggerer, self.message1);
sprint(self.triggerer, "\n");
sprint(pev->triggerer, pev->message1);
sprint(pev->triggerer, "\n");
}
if(self.message2)
if(pev->message2)
{
dprint(self.message2);
dprint(pev->message2);
dprint("\n");
}
self.think = trigger_message_think;
self.nextthink = time + self.delay;
pev->think = trigger_message_think;
pev->nextthink = time + pev->delay;
};
void() trigger_message =
{
trigger_setup();
if(!self.delay)
self.delay = 1;
if(!pev->delay)
pev->delay = 1;
self.touch = trigger_message_touch;
self.use = trigger_message_use;
pev->touch = trigger_message_touch;
pev->use = trigger_message_use;
self.classname = "t_message";
pev->classname = "t_message";
};

View File

@ -6,10 +6,10 @@
void() trigger_once_think =
{
if(self.target)
if(pev->target)
IEM_usetarget();
remove(self);
remove(pev);
};
void() trigger_once_touch =
@ -17,45 +17,45 @@ void() trigger_once_touch =
if(!(other.flags & FL_CLIENT))
return;
if(self.touched == FALSE)
if(pev->touched == FALSE)
{
if(self.message)
centerprint(other, self.message);
if(pev->message)
centerprint(other, pev->message);
self.think = trigger_once_think;
self.nextthink = time + self.delay;
pev->think = trigger_once_think;
pev->nextthink = time + pev->delay;
}
};
void() trigger_once_use =
{
if(self.touched == TRUE)
if(pev->touched == TRUE)
return;
self.touched = TRUE;
pev->touched = TRUE;
if(self.message)
if(pev->message)
{
bprint(self.message);
bprint(pev->message);
dprint("\n");
}
self.think = trigger_once_think;
self.nextthink = time + self.delay;
pev->think = trigger_once_think;
pev->nextthink = time + pev->delay;
}
void() trigger_once =
{
trigger_setup();
self.touch = trigger_once_touch;
self.use = trigger_once_use;
pev->touch = trigger_once_touch;
pev->use = trigger_once_use;
self.classname = "once";
pev->classname = "once";
if(!self.delay)
self.delay = 0.1;
if(!pev->delay)
pev->delay = 0.1;
if(!self.target)
remove(self);
if(!pev->target)
remove(pev);
};

View File

@ -3,31 +3,31 @@
|TRIGGER_PUSH|
+============+==============+
|Description; |
|Push player for self speed.|
|Push player for pev speed.|
+===========================+
*/
void() trigger_push_think =
{
self.touched = FALSE;
pev->touched = FALSE;
};
void() trigger_push_touch =
{
if(other.flags & FL_CLIENT)
other.velocity = self.speed * self.movedir * 10;
other.velocity = pev->speed * pev->movedir * 10;
if (self.spawnflags & TRIGGER_ONCE)
remove(self);
if (pev->spawnflags & TRIGGER_ONCE)
remove(pev);
if(self.dmg)
if(pev->dmg)
{
if(self.touched == FALSE)
if(pev->touched == FALSE)
{
T_Damage (other, self, self, self.dmg);
self.touched = TRUE;
T_Damage (other, pev, pev, pev->dmg);
pev->touched = TRUE;
self.think = trigger_push_think;
self.nextthink = time + 0.1;
pev->think = trigger_push_think;
pev->nextthink = time + 0.1;
}
}
};
@ -36,12 +36,12 @@ void() trigger_push =
{
trigger_setup();
self.touch = trigger_push_touch;
pev->touch = trigger_push_touch;
if (!self.speed)
self.speed = 1000;
if (!pev->speed)
pev->speed = 1000;
self.classname = "t_push";
pev->classname = "t_push";
};

View File

@ -8,7 +8,7 @@ void() trigger_secret_think =
{
total_secrets++;
if(self.target)
if(pev->target)
IEM_usetarget();
};
@ -18,20 +18,20 @@ void() trigger_secret_touch =
if(!(other.flags & FL_CLIENT))
return;
if(self.touched == FALSE)
if(pev->touched == FALSE)
{
if (!self.message)
self.message = "You found a secret area!";
if (!pev->message)
pev->message = "You found a secret area!";
else
centerprint(other, self.message);
centerprint(other, pev->message);
if(self.delay)
if(pev->delay)
{
self.think = trigger_secret_think;
self.nextthink = time + self.delay;
pev->think = trigger_secret_think;
pev->nextthink = time + pev->delay;
}
self.touched = TRUE;
pev->touched = TRUE;
}
};
@ -39,8 +39,8 @@ void() trigger_secret =
{
trigger_setup();
self.touch = trigger_secret_touch;
pev->touch = trigger_secret_touch;
if(!self.delay)
self.delay = 0.1;
if(!pev->delay)
pev->delay = 0.1;
};

View File

@ -36,16 +36,16 @@ void() trigger_sequence_think;
void(string seq_a, float seq_b) trigger_sequence_think1 =
{
self.target = seq_a;
self.delay = seq_b;
pev->target = seq_a;
pev->delay = seq_b;
if(self.target)
if(pev->target)
IEM_usetarget();
else
self.touched = FALSE;
pev->touched = FALSE;
self.think = trigger_sequence_think;
self.nextthink = time + self.delay;
pev->think = trigger_sequence_think;
pev->nextthink = time + pev->delay;
};
void() trigger_sequence_think =
@ -53,99 +53,99 @@ void() trigger_sequence_think =
local string a;
local float b;
if(self.touched == FALSE)
if(pev->touched == FALSE)
{
self.oldtarg1 = self.targ1;
self.oldtarg2 = self.targ2;
self.oldtarg3 = self.targ3;
self.oldtarg4 = self.targ4;
self.oldtarg5 = self.targ5;
self.oldtarg6 = self.targ6;
self.oldtarg7 = self.targ7;
self.oldtarg8 = self.targ8;
self.delay = self.olddelay;
pev->oldtarg1 = pev->targ1;
pev->oldtarg2 = pev->targ2;
pev->oldtarg3 = pev->targ3;
pev->oldtarg4 = pev->targ4;
pev->oldtarg5 = pev->targ5;
pev->oldtarg6 = pev->targ6;
pev->oldtarg7 = pev->targ7;
pev->oldtarg8 = pev->targ8;
pev->delay = pev->olddelay;
return;
}
if(self.targ1)
if(pev->targ1)
{
a = self.targ1;
b = self.wait1;
a = pev->targ1;
b = pev->wait1;
self.targ1 = self.oldtarg1;
pev->targ1 = pev->oldtarg1;
trigger_sequence_think1(a,b);
return;
}
else if(self.targ2)
else if(pev->targ2)
{
a = self.targ2;
b = self.wait2;
a = pev->targ2;
b = pev->wait2;
self.targ2 = self.oldtarg2;
pev->targ2 = pev->oldtarg2;
trigger_sequence_think1(a,b);
return;
}
else if(self.targ3)
else if(pev->targ3)
{
a = self.targ3;
b = self.wait3;
a = pev->targ3;
b = pev->wait3;
self.targ3 = self.oldtarg3;
pev->targ3 = pev->oldtarg3;
trigger_sequence_think1(a,b);
return;
}
else if(self.targ4)
else if(pev->targ4)
{
a = self.targ4;
b = self.wait4;
a = pev->targ4;
b = pev->wait4;
self.targ4 = self.oldtarg4;
pev->targ4 = pev->oldtarg4;
trigger_sequence_think1(a,b);
return;
}
else if(self.targ5)
else if(pev->targ5)
{
a = self.targ5;
b = self.wait5;
a = pev->targ5;
b = pev->wait5;
self.targ5 = self.oldtarg5;
pev->targ5 = pev->oldtarg5;
trigger_sequence_think1(a,b);
return;
}
else if(self.targ6)
else if(pev->targ6)
{
a = self.targ6;
b = self.wait6;
a = pev->targ6;
b = pev->wait6;
self.targ6 = self.oldtarg6;
pev->targ6 = pev->oldtarg6;
trigger_sequence_think1(a,b);
return;
}
else if(self.targ7)
else if(pev->targ7)
{
a = self.targ7;
b = self.wait7;
a = pev->targ7;
b = pev->wait7;
self.targ7 = self.oldtarg7;
pev->targ7 = pev->oldtarg7;
trigger_sequence_think1(a,b);
return;
}
else if(self.targ8)
else if(pev->targ8)
{
a = self.targ8;
b = self.wait8;
a = pev->targ8;
b = pev->wait8;
self.targ8 = self.oldtarg8;
pev->targ8 = pev->oldtarg8;
trigger_sequence_think1(a,b);
return;
}
self.touched = FALSE;
pev->touched = FALSE;
if(self.spawnflags & TRIGGER_ONCE)
remove(self);
if(pev->spawnflags & TRIGGER_ONCE)
remove(pev);
};
void() trigger_sequence_touch =
@ -153,74 +153,74 @@ void() trigger_sequence_touch =
if(!(other.flags & FL_CLIENT))
return;
if(self.spawnflags & TRIGGER_INTTERUPTABLE)
if(pev->spawnflags & TRIGGER_INTTERUPTABLE)
{
if(self.touched == TRUE)
if(pev->touched == TRUE)
{
self.touched = FALSE;
pev->touched = FALSE;
self.delay = self.olddelay;
pev->delay = pev->olddelay;
self.triggerer = other;
pev->triggerer = other;
self.think = trigger_sequence_think;
self.nextthink = time + self.delay;
pev->think = trigger_sequence_think;
pev->nextthink = time + pev->delay;
return;
}
}
if(self.touched == FALSE)
if(pev->touched == FALSE)
{
self.touched = TRUE;
pev->touched = TRUE;
if(self.message)
centerprint(other, self.message);
if(pev->message)
centerprint(other, pev->message);
self.triggerer = other;
pev->triggerer = other;
self.think = trigger_sequence_think;
self.nextthink = time + self.delay;
pev->think = trigger_sequence_think;
pev->nextthink = time + pev->delay;
}
};
void() trigger_sequence_use =
{
if(self.spawnflags & TRIGGER_INTTERUPTABLE)
if(pev->spawnflags & TRIGGER_INTTERUPTABLE)
{
if(self.touched == TRUE)
if(pev->touched == TRUE)
{
self.touched = FALSE;
pev->touched = FALSE;
self.delay = self.olddelay;
pev->delay = pev->olddelay;
self.think = trigger_sequence_think;
self.nextthink = time + self.delay;
pev->think = trigger_sequence_think;
pev->nextthink = time + pev->delay;
return;
}
}
if(self.touched == TRUE)
if(pev->touched == TRUE)
return;
self.touched = TRUE;
pev->touched = TRUE;
self.think = trigger_sequence_think;
self.nextthink = time + self.delay;
pev->think = trigger_sequence_think;
pev->nextthink = time + pev->delay;
};
void() trigger_sequence =
{
trigger_setup();
if(!self.delay)
self.delay = 0.1;
if(!pev->delay)
pev->delay = 0.1;
self.delay = self.olddelay;
pev->delay = pev->olddelay;
self.classname = "t_sequence";
pev->classname = "t_sequence";
self.touch = trigger_sequence_touch;
self.use = trigger_sequence_use;
pev->touch = trigger_sequence_touch;
pev->use = trigger_sequence_use;
};

View File

@ -3,7 +3,7 @@
|TRIGGER_SETSKILL|
+================+====================+
|Description; |
|Set skill to value of self.message. |
|Set skill to value of pev->message. |
+=====================================+
*/
@ -12,9 +12,9 @@ void() trigger_setskill_touch =
if (other.classname != "player")
return;
if(self.touched == FALSE)
if(pev->touched == FALSE)
{
cvar_set ("skill", self.message);
cvar_set ("skill", pev->message);
}
};
@ -22,8 +22,8 @@ void() trigger_setskill =
{
trigger_setup();
self.classname = "setskill";
pev->classname = "setskill";
self.touch = trigger_setskill_touch;
pev->touch = trigger_setskill_touch;
};

View File

@ -7,64 +7,62 @@ void() info_viewpoint_destination =
{
trigger_setup();
setorigin(self, self.origin);
setorigin(pev, pev->origin);
setmodel (self, "progs/eyes.mdl");
self.modelindex = 0;
setmodel (pev, "progs/eyes.mdl");
pev->modelindex = 0;
};
void() trigger_change_viewpoint_touch;
void() trigger_change_viewpoint_think1 =
{
self.touched = FALSE;
self.touch = trigger_change_viewpoint_touch;
pev->touched = FALSE;
pev->touch = trigger_change_viewpoint_touch;
};
void() trigger_change_viewpoint_think =
{
local entity e, oldself, oldtrig;
local entity e, oldpev, oldtrig;
if(self.touched == TRUE)
if(pev->touched == TRUE)
{
e = find(world, targetname, self.target);
//e = self.triggerer.triggerer.triggerer;
self.triggerer.triggerer = self.triggerer;
e = find(world, targetname, pev->target);
//e = pev->triggerer.triggerer.triggerer;
pev->triggerer.triggerer = pev->triggerer;
msg_entity = self.triggerer;
MsgBegin(SVC_SETVIEW); // Network Protocol: Set Viewpoint Entity
WriteEntity( e); // Write entity to clients.
MsgEnd(MSG_ONE, '0 0 0', self );
MsgEnd(MSG_ONE, '0 0 0', pev );
//self.angles = e.mangles;
//self.fixangle = 1;
//pev->angles = e.mangles;
//pev->fixangle = 1;
//self.triggerer.movetype = MOVETYPE_NONE;
//pev->triggerer.movetype = MOVETYPE_NONE;
self.think = trigger_change_viewpoint_think;
self.nextthink = time + self.wait1;
pev->think = trigger_change_viewpoint_think;
pev->nextthink = time + pev->wait1;
self.touched = FALSE;
pev->touched = FALSE;
bprint("working\n");
}
else if(self.touched == FALSE)
else if(pev->touched == FALSE)
{
//self.triggerer = self.triggerer.triggerer;
//pev->triggerer = pev->triggerer.triggerer;
msg_entity = self.triggerer;
MsgBegin(SVC_SETVIEW); // Network Protocol: Set Viewpoint Entity
WriteEntity(self.triggerer.triggerer);
MsgEnd(MSG_ONE, '0 0 0', self );
WriteEntity(pev->triggerer.triggerer);
MsgEnd(MSG_ONE, '0 0 0', pev );
self.triggerer.movetype = MOVETYPE_WALK;
pev->triggerer.movetype = MOVETYPE_WALK;
self.triggerer = world;
pev->triggerer = world;
self.touched = TRUE;
pev->touched = TRUE;
self.think = trigger_change_viewpoint_think1;
self.nextthink = time + 2;
pev->think = trigger_change_viewpoint_think1;
pev->nextthink = time + 2;
}
};
@ -73,14 +71,14 @@ void() trigger_change_viewpoint_touch =
if(!(other.flags & FL_CLIENT))
return;
if(self.touched == FALSE)
if(pev->touched == FALSE)
{
self.touched = TRUE;
self.touch = SUB_Null;
self.triggerer = other;
pev->touched = TRUE;
pev->touch = SUB_Null;
pev->triggerer = other;
self.think = trigger_change_viewpoint_think;
self.nextthink = time + self.delay;
pev->think = trigger_change_viewpoint_think;
pev->nextthink = time + pev->delay;
bprint("touched");
}
@ -88,28 +86,28 @@ void() trigger_change_viewpoint_touch =
void() trigger_change_viewpoint_use =
{
if(self.touched == TRUE)
if(pev->touched == TRUE)
return;
self.think = trigger_change_viewpoint_think;
self.nextthink = time + self.delay;
pev->think = trigger_change_viewpoint_think;
pev->nextthink = time + pev->delay;
};
void() trigger_change_viewpoint =
{
trigger_setup();
if(!self.delay)
self.delay = 1;
if(!self.wait)
self.wait = 1;
if(!pev->delay)
pev->delay = 1;
if(!pev->wait)
pev->wait = 1;
self.touch = trigger_change_viewpoint_touch;
self.use = trigger_change_viewpoint_use ;
pev->touch = trigger_change_viewpoint_touch;
pev->use = trigger_change_viewpoint_use ;
if(!self.target)
if(!pev->target)
{
objerror("trigger_change_viewpoint: NO TARGET");
self.solid = SOLID_NOT;
pev->solid = SOLID_NOT;
}
};

View File

@ -11,15 +11,15 @@ void(entity ono, entity duo)setangles =
void() spawn_tdeath_touch =
{
if (other == self.owner)
if (other == pev->owner)
return;
// frag anyone who teleports in on top of an invincible player
if (other.classname == "player")
{
if (self.owner.classname != "player")
if (pev->owner.classname != "player")
{
T_Damage (self.owner, self, self, 50000);
T_Damage (pev->owner, pev, pev, 50000);
return;
}
@ -27,7 +27,7 @@ void() spawn_tdeath_touch =
if (other.health)
{
T_Damage (other, self, self, 50000);
T_Damage (other, pev, pev, 50000);
}
};
@ -56,24 +56,24 @@ void() trigger_teleport_think =
{
local entity t;
t = find (world, targetname, self.target);
t = find (world, targetname, pev->target);
if (!t)
objerror ("couldn't find target");
IEM_effects(TE_TELEPORT, self.triggerer.origin);
IEM_effects(TE_TELEPORT, pev->triggerer.origin);
spawn_tdeath(t.origin, self.triggerer);
spawn_tdeath(t.origin, pev->triggerer);
setorigin(self.triggerer, t.origin);
setangles(self.triggerer, t);
setorigin(pev->triggerer, t.origin);
setangles(pev->triggerer, t);
IEM_effects(TE_TELEPORT, t.origin);
if(self.message)
centerprint(self.triggerer, self.message);
if(pev->message)
centerprint(pev->triggerer, pev->message);
self.touched = FALSE;
pev->touched = FALSE;
};
void() trigger_teleport_touch =
@ -81,25 +81,25 @@ void() trigger_teleport_touch =
if(!(other.flags & FL_CLIENT))
return;
if(self.touched == FALSE)
if(pev->touched == FALSE)
{
self.touched = TRUE;
pev->touched = TRUE;
self.triggerer = other;
pev->triggerer = other;
self.think = trigger_teleport_think;
self.nextthink = time + self.delay;
pev->think = trigger_teleport_think;
pev->nextthink = time + pev->delay;
}
};
void() trigger_teleport_use =
{
//if(self.touched == TRUE)
//if(pev->touched == TRUE)
// return;
if(self.touched == TRUE)
self.touched = FALSE;
//self.think = trigger_teleport_think;
//self.nextthink = time + self.delay;
if(pev->touched == TRUE)
pev->touched = FALSE;
//pev->think = trigger_teleport_think;
//pev->nextthink = time + pev->delay;
};
@ -107,25 +107,25 @@ void() trigger_teleport =
{
trigger_setup();
self.touch = trigger_teleport_touch;
self.use = trigger_teleport_use;
pev->touch = trigger_teleport_touch;
pev->use = trigger_teleport_use;
if (!self.target)
if (!pev->target)
objerror ("no target");
if(self.spawnflags & TRIGGER_START_OFF)
self.touched = TRUE;
if(pev->spawnflags & TRIGGER_START_OFF)
pev->touched = TRUE;
if(!self.delay)
self.delay = 0.1;
if(!pev->delay)
pev->delay = 0.1;
self.classname = "t_teleport";
pev->classname = "t_teleport";
/*
if (!(self.spawnflags & SILENT))
if (!(pev->spawnflags & SILENT))
{
//precache_sound ("ambience/hum1.wav");
//o = (self.mins + self.maxs)*0.5;
//o = (pev->mins + pev->maxs)*0.5;
//ambientsound (o, "ambience/hum1.wav",0.5 , ATTN_STATIC);
}
*/
@ -134,11 +134,11 @@ void() trigger_teleport =
void() info_teleport_destination =
{
// this does nothing, just serves as a target spot
self.mangle = self.angles;
self.angles = '0 0 0';
self.model = "";
self.origin = self.origin + '0 0 27';
if (!self.targetname)
pev->mangle = pev->angles;
pev->angles = '0 0 0';
pev->model = "";
pev->origin = pev->origin + '0 0 27';
if (!pev->targetname)
objerror ("no targetname");
};

View File

@ -17,20 +17,20 @@ void() trigger_setup =
{
// trigger angles are used for one-way touches. An angle of 0 is assumed
// to mean no restrictions, so use a yaw of 360 instead.
//if (self.angles != '0 0 0')
//if (pev->angles != '0 0 0')
// SetMovedir ();
//not at the moment they are not....
self.solid = SOLID_TRIGGER;
self.movetype = MOVETYPE_NONE;
pev->solid = SOLID_TRIGGER;
pev->movetype = MOVETYPE_NONE;
setmodel (self, self.model);
setorigin(self, self.origin);
setmodel (pev, pev->model);
setorigin(pev, pev->origin);
if(self.spawnflags & TRIGGER_NO_MODEL)
if(pev->spawnflags & TRIGGER_NO_MODEL)
{
self.modelindex = 0;
self.model = "";
pev->modelindex = 0;
pev->model = "";
}
};

View File

@ -10,26 +10,26 @@
void() CheckImpulses =
{
if (self.impulse == 15)
if (pev->impulse == 15)
CCam ();
if(self.impulse == 10)
if(pev->impulse == 10)
{
local string a;
a = ftos(self.items);
sprint(self, a);
sprint(self, "Items Printed\n");
a = ftos(pev->items);
sprint(pev, a);
sprint(pev, "Items Printed\n");
}
if(self.impulse == 11)
if(pev->impulse == 11)
{
self.items = self.items + 8;
sprint(self, "Items added to\{136}\n");
pev->items = pev->items + 8;
sprint(pev, "Items added to\{136}\n");
}
if(self.impulse == 150)
if(pev->impulse == 150)
{
IEM_effects(TE_TELEPORT, self.origin);
IEM_effects(TE_TELEPORT, pev->origin);
}
self.impulse = 0; // Clear impulse list.
pev->impulse = 0; // Clear impulse list.
};

View File

@ -29,8 +29,8 @@ This function is called to set up new player info.
void() SetNewParms = //Sets up start game parms
{
parm1 = 10;
parm2 = 100;
pev->items = 10;
pev->health = 100;
};
/*
@ -46,14 +46,11 @@ loading upon next level.
void() SetChangeParms = //called on changelevel; command
{
if (self.health <= 0)
if (pev->health <= 0)
{
SetNewParms();
return;
}
parm1 = self.items;
parm2 = self.health;
};
/*
@ -74,9 +71,6 @@ void() GetLevelParms =
{
if (world.model == "maps/start.bsp")
SetNewParms (); // take away all stuff on starting new episode
self.items = parm1;
self.health = parm2;
};

View File

@ -61,13 +61,13 @@ $frame axattd1 axattd2 axattd3 axattd4 axattd5 axattd6
void () SetClientFrame =
{
// note: call whenever weapon frames are called!
if (self.anim_time > time)
if (pev->anim_time > time)
return; //don't call every frame, if it is the animations will play too fast
self.anim_time = time + 0.1;
pev->anim_time = time + 0.1;
local float anim_change, run;
if (self.velocity_x || self.velocity_y)
if (pev->velocity_x || pev->velocity_y)
run = TRUE;
else
run = FALSE;
@ -75,40 +75,40 @@ void () SetClientFrame =
anim_change = FALSE;
// check for stop/go and animation transitions
if (run != self.anim_run && self.anim_priority == ANIM_BASIC)
if (run != pev->anim_run && pev->anim_priority == ANIM_BASIC)
anim_change = TRUE;
if (anim_change != TRUE)
{
if (self.frame < self.anim_end)
if (pev->frame < pev->anim_end)
{ // continue an animation
self.frame = self.frame + 1;
pev->frame = pev->frame + 1;
return;
}
if (self.anim_priority == ANIM_DEATH)
if (pev->anim_priority == ANIM_DEATH)
{
if (self.deadflag == DEAD_DYING)
if (pev->deadflag == DEAD_DYING)
{
self.nextthink = -1;
self.deadflag = DEAD_DEAD;
pev->nextthink = -1;
pev->deadflag = DEAD_DEAD;
}
return; // stay there
}
}
// return to either a running or standing frame
self.anim_priority = ANIM_BASIC;
self.anim_run = run;
pev->anim_priority = ANIM_BASIC;
pev->anim_run = run;
if (self.velocity_x || self.velocity_y)
if (pev->velocity_x || pev->velocity_y)
{ // running
self.frame = $rockrun1;
self.anim_end = $rockrun6;
pev->frame = $rockrun1;
pev->anim_end = $rockrun6;
}
else
{ // standing
self.frame = $stand1;
self.anim_end = $stand5;
pev->frame = $stand1;
pev->anim_end = $stand5;
}
};
@ -119,61 +119,61 @@ void () SetClientFrame =
*/
void() PainSound =
{
if (self.health < 0)
if (pev->health < 0)
return;
self.noise = "";
pev->noise = "";
if (self.watertype == CONTENT_WATER && self.waterlevel == 3)
if (pev->watertype == CONTENT_WATER && pev->waterlevel == 3)
{ // water pain sounds
if (random() <= 0.5)
self.noise = "player/drown1.wav";
pev->noise = "player/drown1.wav";
else
self.noise = "player/drown2.wav";
pev->noise = "player/drown2.wav";
}
else if (self.watertype == CONTENT_SLIME || self.watertype == CONTENT_LAVA)
else if (pev->watertype == CONTENT_SLIME || pev->watertype == CONTENT_LAVA)
{ // slime/lava pain sounds
if (random() <= 0.5)
self.noise = "player/lburn1.wav";
pev->noise = "player/lburn1.wav";
else
self.noise = "player/lburn2.wav";
pev->noise = "player/lburn2.wav";
}
if (self.noise)
if (pev->noise)
{
sound (self, CHAN_VOICE, self.noise, 1, ATTN_NORM);
sound (pev, CHAN_VOICE, pev->noise, 1, ATTN_NORM);
return;
}
//don't make multiple pain sounds right after each other
if (self.pain_finished > time)
if (pev->pain_finished > time)
return;
self.pain_finished = time + 0.5;
pev->pain_finished = time + 0.5;
local float rs;
rs = rint((random() * 5) + 1); // rs = 1-6
if (rs == 1)
self.noise = "player/pain1.wav";
pev->noise = "player/pain1.wav";
else if (rs == 2)
self.noise = "player/pain2.wav";
pev->noise = "player/pain2.wav";
else if (rs == 3)
self.noise = "player/pain3.wav";
pev->noise = "player/pain3.wav";
else if (rs == 4)
self.noise = "player/pain4.wav";
pev->noise = "player/pain4.wav";
else if (rs == 5)
self.noise = "player/pain5.wav";
pev->noise = "player/pain5.wav";
else
self.noise = "player/pain6.wav";
pev->noise = "player/pain6.wav";
sound (self, CHAN_VOICE, self.noise, 1, ATTN_NORM);
sound (pev, CHAN_VOICE, pev->noise, 1, ATTN_NORM);
};
void () PlayerPain =
{
if (self.anim_priority < ANIM_PAIN) // call only if not attacking and not already in pain
if (pev->anim_priority < ANIM_PAIN) // call only if not attacking and not already in pain
{
self.anim_priority = ANIM_PAIN;
self.frame = $pain1;
self.anim_end = $pain6;
pev->anim_priority = ANIM_PAIN;
pev->frame = $pain1;
pev->anim_end = $pain6;
}
PainSound ();
};
@ -188,61 +188,61 @@ void() DeathSound =
local float rs;
rs = rint ((random() * 4) + 1); // rs = 1-5
if (self.waterlevel == 3) // water death sound
self.noise = "player/h2odeath.wav";
if (pev->waterlevel == 3) // water death sound
pev->noise = "player/h2odeath.wav";
else if (rs == 1)
self.noise = "player/death1.wav";
pev->noise = "player/death1.wav";
else if (rs == 2)
self.noise = "player/death2.wav";
pev->noise = "player/death2.wav";
else if (rs == 3)
self.noise = "player/death3.wav";
pev->noise = "player/death3.wav";
else if (rs == 4)
self.noise = "player/death4.wav";
pev->noise = "player/death4.wav";
else if (rs == 5)
self.noise = "player/death5.wav";
pev->noise = "player/death5.wav";
sound (self, CHAN_VOICE, self.noise, 1, ATTN_NONE);
sound (pev, CHAN_VOICE, pev->noise, 1, ATTN_NONE);
};
void () PlayerDie =
{
self.view_ofs = '0 0 -8';
self.angles_x = self.angles_z = 0;
self.deadflag = DEAD_DYING;
self.solid = SOLID_NOT;
self.movetype = MOVETYPE_TOSS;
self.flags = self.flags - (self.flags & FL_ONGROUND);
if (self.velocity_z < 10)
self.velocity_z = self.velocity_z + random()*300;
pev->view_ofs = '0 0 -8';
pev->angles_x = pev->angles_z = 0;
pev->deadflag = DEAD_DYING;
pev->solid = SOLID_NOT;
pev->movetype = MOVETYPE_TOSS;
pev->aiflags = pev->aiflags - (pev->aiflags & AI_ONGROUND);
if (pev->velocity_z < 10)
pev->velocity_z = pev->velocity_z + random()*300;
local float rand;
rand = rint ((random() * 4) + 1); // rand = 1-5
self.anim_priority = ANIM_DEATH;
pev->anim_priority = ANIM_DEATH;
if (rand == 1)
{
self.frame = $deatha1;
self.anim_end = $deatha11;
pev->frame = $deatha1;
pev->anim_end = $deatha11;
}
else if (rand == 2)
{
self.frame = $deathb1;
self.anim_end = $deathb9;
pev->frame = $deathb1;
pev->anim_end = $deathb9;
}
else if (rand == 3)
{
self.frame = $deathc1;
self.anim_end = $deathc15;
pev->frame = $deathc1;
pev->anim_end = $deathc15;
}
else if (rand == 4)
{
self.frame = $deathd1;
self.anim_end = $deathd9;
pev->frame = $deathd1;
pev->anim_end = $deathd9;
}
else
{
self.frame = $deathe1;
self.anim_end = $deathe9;
pev->frame = $deathe1;
pev->anim_end = $deathe9;
}
DeathSound();
};

View File

@ -12,13 +12,14 @@ typedef struct globalvars_s
int ofs_parm5[3];
int ofs_parm6[3];
int ofs_parm7[3];
int self;
int pev;
int other;
int world;
float time;
float frametime;
float force_retouch;
string_t mapname;
string_t startspot;
vec3_t spotoffset;
float deathmatch;
float coop;
float teamplay;
@ -27,35 +28,19 @@ typedef struct globalvars_s
float total_monsters;
float found_secrets;
float killed_monsters;
float parm1;
float parm2;
float parm3;
float parm4;
float parm5;
float parm6;
float parm7;
float parm8;
float parm9;
float parm10;
float parm11;
float parm12;
float parm13;
float parm14;
float parm15;
float parm16;
vec3_t v_forward;
vec3_t v_up;
vec3_t v_right;
vec3_t v_up;
float trace_allsolid;
float trace_startsolid;
float trace_fraction;
vec3_t trace_endpos;
vec3_t trace_plane_normal;
float trace_plane_dist;
float trace_hitgroup;
float trace_contents;
int trace_ent;
float trace_inopen;
float trace_inwater;
int msg_entity;
float trace_flags;
func_t main;
func_t StartFrame;
func_t EndFrame;
@ -71,48 +56,61 @@ typedef struct globalvars_s
typedef struct entvars_s
{
string_t classname;
string_t globalname;
float modelindex;
vec3_t absmin;
vec3_t absmax;
float ltime;
vec3_t origin;
vec3_t angles;
vec3_t velocity;
vec3_t avelocity;
vec3_t post_origin;
vec3_t post_angles;
vec3_t post_velocity;
vec3_t post_avelocity;
vec3_t origin_offset;
vec3_t angles_offset;
float bouncetype;
float movetype;
float solid;
vec3_t origin;
vec3_t oldorigin;
vec3_t velocity;
vec3_t angles;
vec3_t avelocity;
vec3_t punchangle;
string_t classname;
string_t model;
float frame;
float skin;
float body;
float effects;
float sequence;
float renderfx;
vec3_t absmin;
vec3_t absmax;
vec3_t mins;
vec3_t maxs;
vec3_t size;
func_t touch;
int chain;
string_t model;
float frame;
float sequence;
float renderfx;
float effects;
float skin;
float body;
string_t weaponmodel;
float weaponframe;
func_t use;
func_t touch;
func_t think;
func_t blocked;
float nextthink;
func_t activate;
func_t walk;
func_t jump;
func_t duck;
float flags;
float aiflags;
float spawnflags;
int groundentity;
float nextthink;
float takedamage;
float health;
float frags;
float weapon;
string_t weaponmodel;
float weaponframe;
float currentammo;
float ammo_shells;
float ammo_nails;
float ammo_rockets;
float ammo_cells;
float items;
float takedamage;
int chain;
string_t target;
string_t parent;
string_t targetname;
int aiment;
int goalentity;
vec3_t punchangle;
float deadflag;
vec3_t view_ofs;
float button0;
@ -124,7 +122,6 @@ typedef struct entvars_s
float idealpitch;
string_t netname;
int enemy;
float flags;
float colormap;
float team;
float max_health;
@ -135,11 +132,6 @@ typedef struct entvars_s
float watertype;
float ideal_yaw;
float yaw_speed;
int aiment;
int goalentity;
float spawnflags;
string_t target;
string_t targetname;
float dmg_take;
float dmg_save;
int dmg_inflictor;
@ -151,6 +143,15 @@ typedef struct entvars_s
string_t noise1;
string_t noise2;
string_t noise3;
float jumpup;
float jumpdn;
int movetarget;
float mass;
float density;
float gravity;
float dmg;
float dmgtime;
float speed;
} entvars_t;
//with this the crc isn't needed for fields.
@ -160,128 +161,159 @@ struct fieldvars_s
int type;
char *name;
} fieldvars[] = {
{0, 2, "modelindex"},
{1, 3, "absmin"},
{1, 2, "absmin_x"},
{2, 2, "absmin_y"},
{3, 2, "absmin_z"},
{4, 3, "absmax"},
{4, 2, "absmax_x"},
{5, 2, "absmax_y"},
{6, 2, "absmax_z"},
{7, 2, "ltime"},
{8, 2, "movetype"},
{9, 2, "solid"},
{10, 3, "origin"},
{10, 2, "origin_x"},
{11, 2, "origin_y"},
{12, 2, "origin_z"},
{13, 3, "oldorigin"},
{13, 2, "oldorigin_x"},
{14, 2, "oldorigin_y"},
{15, 2, "oldorigin_z"},
{16, 3, "velocity"},
{16, 2, "velocity_x"},
{17, 2, "velocity_y"},
{18, 2, "velocity_z"},
{19, 3, "angles"},
{19, 2, "angles_x"},
{20, 2, "angles_y"},
{21, 2, "angles_z"},
{22, 3, "avelocity"},
{22, 2, "avelocity_x"},
{23, 2, "avelocity_y"},
{24, 2, "avelocity_z"},
{25, 3, "punchangle"},
{25, 2, "punchangle_x"},
{26, 2, "punchangle_y"},
{27, 2, "punchangle_z"},
{28, 1, "classname"},
{29, 1, "model"},
{30, 2, "frame"},
{31, 2, "skin"},
{32, 2, "body"},
{33, 2, "effects"},
{34, 2, "sequence"},
{35, 2, "renderfx"},
{36, 3, "mins"},
{36, 2, "mins_x"},
{37, 2, "mins_y"},
{38, 2, "mins_z"},
{39, 3, "maxs"},
{39, 2, "maxs_x"},
{40, 2, "maxs_y"},
{41, 2, "maxs_z"},
{42, 3, "size"},
{42, 2, "size_x"},
{43, 2, "size_y"},
{44, 2, "size_z"},
{45, 6, "touch"},
{46, 6, "use"},
{47, 6, "think"},
{48, 6, "blocked"},
{49, 2, "nextthink"},
{50, 4, "groundentity"},
{51, 2, "health"},
{52, 2, "frags"},
{53, 2, "weapon"},
{54, 1, "weaponmodel"},
{55, 2, "weaponframe"},
{56, 2, "currentammo"},
{57, 2, "ammo_shells"},
{58, 2, "ammo_nails"},
{59, 2, "ammo_rockets"},
{60, 2, "ammo_cells"},
{61, 2, "items"},
{62, 2, "takedamage"},
{63, 4, "chain"},
{64, 2, "deadflag"},
{65, 3, "view_ofs"},
{65, 2, "view_ofs_x"},
{66, 2, "view_ofs_y"},
{67, 2, "view_ofs_z"},
{68, 2, "button0"},
{69, 2, "button1"},
{70, 2, "button2"},
{71, 2, "impulse"},
{72, 2, "fixangle"},
{73, 3, "v_angle"},
{73, 2, "v_angle_x"},
{74, 2, "v_angle_y"},
{75, 2, "v_angle_z"},
{76, 2, "idealpitch"},
{77, 1, "netname"},
{78, 4, "enemy"},
{79, 2, "flags"},
{80, 2, "colormap"},
{81, 2, "team"},
{82, 2, "max_health"},
{83, 2, "teleport_time"},
{84, 2, "armortype"},
{85, 2, "armorvalue"},
{86, 2, "waterlevel"},
{87, 2, "watertype"},
{88, 2, "ideal_yaw"},
{89, 2, "yaw_speed"},
{90, 4, "aiment"},
{91, 4, "goalentity"},
{92, 2, "spawnflags"},
{93, 1, "target"},
{94, 1, "targetname"},
{95, 2, "dmg_take"},
{96, 2, "dmg_save"},
{97, 4, "dmg_inflictor"},
{98, 4, "owner"},
{99, 3, "movedir"},
{99, 2, "movedir_x"},
{100, 2, "movedir_y"},
{101, 2, "movedir_z"},
{102, 1, "message"},
{103, 2, "sounds"},
{104, 1, "noise"},
{105, 1, "noise1"},
{106, 1, "noise2"},
{107, 1, "noise3"}
{0, 1, "classname"},
{1, 1, "globalname"},
{2, 2, "modelindex"},
{3, 3, "origin"},
{3, 2, "origin_x"},
{4, 2, "origin_y"},
{5, 2, "origin_z"},
{6, 3, "angles"},
{6, 2, "angles_x"},
{7, 2, "angles_y"},
{8, 2, "angles_z"},
{9, 3, "velocity"},
{9, 2, "velocity_x"},
{10, 2, "velocity_y"},
{11, 2, "velocity_z"},
{12, 3, "avelocity"},
{12, 2, "avelocity_x"},
{13, 2, "avelocity_y"},
{14, 2, "avelocity_z"},
{15, 3, "post_origin"},
{15, 2, "post_origin_x"},
{16, 2, "post_origin_y"},
{17, 2, "post_origin_z"},
{18, 3, "post_angles"},
{18, 2, "post_angles_x"},
{19, 2, "post_angles_y"},
{20, 2, "post_angles_z"},
{21, 3, "post_velocity"},
{21, 2, "post_velocity_x"},
{22, 2, "post_velocity_y"},
{23, 2, "post_velocity_z"},
{24, 3, "post_avelocity"},
{24, 2, "post_avelocity_x"},
{25, 2, "post_avelocity_y"},
{26, 2, "post_avelocity_z"},
{27, 3, "origin_offset"},
{27, 2, "origin_offset_x"},
{28, 2, "origin_offset_y"},
{29, 2, "origin_offset_z"},
{30, 3, "angles_offset"},
{30, 2, "angles_offset_x"},
{31, 2, "angles_offset_y"},
{32, 2, "angles_offset_z"},
{33, 2, "bouncetype"},
{34, 2, "movetype"},
{35, 2, "solid"},
{36, 3, "absmin"},
{36, 2, "absmin_x"},
{37, 2, "absmin_y"},
{38, 2, "absmin_z"},
{39, 3, "absmax"},
{39, 2, "absmax_x"},
{40, 2, "absmax_y"},
{41, 2, "absmax_z"},
{42, 3, "mins"},
{42, 2, "mins_x"},
{43, 2, "mins_y"},
{44, 2, "mins_z"},
{45, 3, "maxs"},
{45, 2, "maxs_x"},
{46, 2, "maxs_y"},
{47, 2, "maxs_z"},
{48, 3, "size"},
{48, 2, "size_x"},
{49, 2, "size_y"},
{50, 2, "size_z"},
{51, 4, "chain"},
{52, 1, "model"},
{53, 2, "frame"},
{54, 2, "sequence"},
{55, 2, "renderfx"},
{56, 2, "effects"},
{57, 2, "skin"},
{58, 2, "body"},
{59, 1, "weaponmodel"},
{60, 2, "weaponframe"},
{61, 6, "use"},
{62, 6, "touch"},
{63, 6, "think"},
{64, 6, "blocked"},
{65, 6, "activate"},
{66, 6, "walk"},
{67, 6, "jump"},
{68, 6, "duck"},
{69, 2, "flags"},
{70, 2, "aiflags"},
{71, 2, "spawnflags"},
{72, 4, "groundentity"},
{73, 2, "nextthink"},
{74, 2, "takedamage"},
{75, 2, "health"},
{76, 2, "frags"},
{77, 2, "weapon"},
{78, 2, "items"},
{79, 1, "target"},
{80, 1, "parent"},
{81, 1, "targetname"},
{82, 4, "aiment"},
{83, 4, "goalentity"},
{84, 3, "punchangle"},
{84, 2, "punchangle_x"},
{85, 2, "punchangle_y"},
{86, 2, "punchangle_z"},
{87, 2, "deadflag"},
{88, 3, "view_ofs"},
{88, 2, "view_ofs_x"},
{89, 2, "view_ofs_y"},
{90, 2, "view_ofs_z"},
{91, 2, "button0"},
{92, 2, "button1"},
{93, 2, "button2"},
{94, 2, "impulse"},
{95, 2, "fixangle"},
{96, 3, "v_angle"},
{96, 2, "v_angle_x"},
{97, 2, "v_angle_y"},
{98, 2, "v_angle_z"},
{99, 2, "idealpitch"},
{100, 1, "netname"},
{101, 4, "enemy"},
{102, 2, "colormap"},
{103, 2, "team"},
{104, 2, "max_health"},
{105, 2, "teleport_time"},
{106, 2, "armortype"},
{107, 2, "armorvalue"},
{108, 2, "waterlevel"},
{109, 2, "watertype"},
{110, 2, "ideal_yaw"},
{111, 2, "yaw_speed"},
{112, 2, "dmg_take"},
{113, 2, "dmg_save"},
{114, 4, "dmg_inflictor"},
{115, 4, "owner"},
{116, 3, "movedir"},
{116, 2, "movedir_x"},
{117, 2, "movedir_y"},
{118, 2, "movedir_z"},
{119, 1, "message"},
{120, 2, "sounds"},
{121, 1, "noise"},
{122, 1, "noise1"},
{123, 1, "noise2"},
{124, 1, "noise3"},
{125, 2, "jumpup"},
{126, 2, "jumpdn"},
{127, 4, "movetarget"},
{128, 2, "mass"},
{129, 2, "density"},
{130, 2, "gravity"},
{131, 2, "dmg"},
{132, 2, "dmgtime"},
{133, 2, "speed"}
};
#define PROGHEADER_CRC 21645
#define PROGHEADER_CRC 63599

1
vprogs/run.bat Normal file
View File

@ -0,0 +1 @@
qcclib -log -dev 4 -progdefs -debug