2010-02-15 23:26:55 +00:00
/*
Copyright ( C ) 1996 - 2001 Id Software , Inc .
Copyright ( C ) 2002 - 2009 John Fitzgibbons and others
2014-09-22 08:55:46 +00:00
Copyright ( C ) 2010 - 2014 QuakeSpasm developers
2010-02-15 23:26:55 +00:00
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 .
*/
2022-04-27 14:00:02 +00:00
# ifndef QUAKE_PROGS_H
# define QUAKE_PROGS_H
bspfile.h, cdaudio.h, client.h, cmd.h, common.h, console.h, crc.h, cvar.h,
d_ifacea.h, draw.h, gl_texmgr.h, glquake.h, image.h, input.h, keys.h, mathlib.h,
menu.h, modelgen.h, net.h, net_dgrm.h, net_loop.h, net_sdlnet.h, net_udp.h,
net_wins.h, platform.h, pr_comp.h, progdefs.h, progs.h, protocol.h, quakedef.h,
render.h, resource.h, sbar.h, screen.h, server.h, sound.h, spritegn.h, sys.h,
vid.h, view.h, wad.h, world.h, zone.h: added include guards to the headers.
git-svn-id: svn://svn.code.sf.net/p/quakespasm/code/trunk/quakespasm@84 af15c1b1-3010-417e-b628-4374ebc0bcbd
2010-02-21 00:01:08 +00:00
2011-12-12 08:56:25 +00:00
# include "pr_comp.h" /* defs shared with qcc */
# include "progdefs.h" /* generated by program cdefs */
2010-02-15 23:26:55 +00:00
typedef union eval_s
{
2011-12-12 08:56:25 +00:00
string_t string ;
float _float ;
float vector [ 3 ] ;
func_t function ;
int _int ;
int edict ;
2010-02-15 23:26:55 +00:00
} eval_t ;
2014-08-13 06:40:07 +00:00
# define MAX_ENT_LEAFS 32
2010-02-15 23:26:55 +00:00
typedef struct edict_s
{
2011-12-12 08:56:25 +00:00
qboolean free ;
link_t area ; /* linked to a division node or leaf */
2017-09-17 02:12:53 +00:00
unsigned int num_leafs ;
2014-04-13 09:03:48 +00:00
int leafnums [ MAX_ENT_LEAFS ] ;
2011-12-12 08:56:25 +00:00
2010-02-15 23:26:55 +00:00
entity_state_t baseline ;
2011-12-12 08:56:25 +00:00
unsigned char alpha ; /* johnfitz -- hack to support alpha since it's not part of entvars_t */
qboolean sendinterval ; /* johnfitz -- send time until nextthink to client for better lerp timing */
2019-09-13 17:51:16 +00:00
qboolean onladder ; /* spike -- content_ladder stuff */
2011-12-12 08:56:25 +00:00
float freetime ; /* sv.time when the object was freed */
entvars_t v ; /* C exported fields from progs */
/* other fields from progs come immediately after */
2010-02-15 23:26:55 +00:00
} edict_t ;
2011-12-12 08:56:25 +00:00
# define EDICT_FROM_AREA(l) STRUCT_FROM_LINK(l,edict_t,area)
2010-02-15 23:26:55 +00:00
//============================================================================
2018-05-01 00:35:14 +00:00
typedef void ( * builtin_t ) ( void ) ;
typedef struct qcvm_s qcvm_t ;
2010-02-15 23:26:55 +00:00
void PR_Init ( void ) ;
void PR_ExecuteProgram ( func_t fnum ) ;
2018-05-01 00:35:14 +00:00
void PR_ClearProgs ( qcvm_t * vm ) ;
2022-07-15 12:24:04 +00:00
qboolean PR_LoadProgs ( const char * filename , qboolean fatal , unsigned int needcrc , const builtin_t * builtins , size_t numbuiltins ) ;
2010-02-15 23:26:55 +00:00
2017-09-17 02:12:53 +00:00
//from pr_ext.c
2018-05-01 00:35:14 +00:00
void PR_InitExtensions ( void ) ;
2017-09-17 02:12:53 +00:00
void PR_EnableExtensions ( ddef_t * pr_globaldefs ) ; //adds in the extra builtins etc
void PR_AutoCvarChanged ( cvar_t * var ) ; //updates the autocvar_ globals when their cvar is changed
void PR_ShutdownExtensions ( void ) ; //nooooes!
2018-05-05 15:18:07 +00:00
void PR_ReloadPics ( qboolean purge ) ; //for gamedir or video changes
2018-05-01 00:35:14 +00:00
func_t PR_FindExtFunction ( const char * entryname ) ;
2017-09-17 02:12:53 +00:00
void PR_DumpPlatform_f ( void ) ; //console command: writes out a qsextensions.qc file
//special hacks...
int PF_SV_ForceParticlePrecache ( const char * s ) ;
int SV_Precache_Model ( const char * s ) ;
int SV_Precache_Sound ( const char * s ) ;
void PR_spawnfunc_misc_model ( edict_t * self ) ;
//from pr_edict, for pr_ext. reflection is messy.
2020-07-19 00:47:06 +00:00
qboolean ED_ParseEpair ( void * base , ddef_t * key , const char * s , qboolean zoned ) ;
2017-09-17 02:12:53 +00:00
const char * PR_UglyValueString ( int type , eval_t * val ) ;
ddef_t * ED_FindField ( const char * name ) ;
ddef_t * ED_FindGlobal ( const char * name ) ;
dfunction_t * ED_FindFunction ( const char * fn_name ) ;
2010-08-29 02:22:55 +00:00
const char * PR_GetString ( int num ) ;
int PR_SetEngineString ( const char * s ) ;
64 bit compatibility effort, 4/nn: x86_64 works just fine now, yey!
the QuakeC interpreter used to use string pointer offsets from pr_strings
even when the pointers lead to engine data which is often well out of
32bit range on a 64bit architecture and they lead to crashes. they now
go through the new PR_SetEngineString and PR_GetString functions which
turn any address outside the pr_strings area into an index into a table
of engine string addresses, adding new string addresses to the table as
needed. the engine strings table is allocated with 256 entries at first
(see the PR_STRING_ALLOCSLOTS definition in pr_edict.c) and its size is
incremented by 256 as needed and re-allocated on the zone. managing that
allocation and reallocation is accomplished by the recently added Z_Realloc
function. implementation based on the uhexen2 (hexen2: hammer of thyrion)
engine which, in turn, is loosely based on twilight and quakeforge engines.
pr_strings range check is from tyrquake.
pr_edict.c: added the new PR_SetEngineString, PR_GetString, PR_AllocString
public functions and the new private PR_AllocStringSlots function. made
ED_NewString private to pr_edict.c and reworked it to return an index to a
newly allocated string.
progs.h: added prototypes for the new public PR_SetEngineString, PR_GetString
and PR_AllocString functions.
host_cmd.c, pr_cmds.c, pr_edict.c, pr_exec.c, progs.h, sv_main.c, sv_phys.c:
modifed to use the new PR_SetEngineString and PR_GetString functions.
git-svn-id: svn://svn.code.sf.net/p/quakespasm/code/trunk/quakespasm@38 af15c1b1-3010-417e-b628-4374ebc0bcbd
2010-02-17 15:04:50 +00:00
int PR_AllocString ( int bufferlength , char * * ptr ) ;
2017-09-17 02:12:53 +00:00
void PR_ClearEngineString ( int num ) ;
64 bit compatibility effort, 4/nn: x86_64 works just fine now, yey!
the QuakeC interpreter used to use string pointer offsets from pr_strings
even when the pointers lead to engine data which is often well out of
32bit range on a 64bit architecture and they lead to crashes. they now
go through the new PR_SetEngineString and PR_GetString functions which
turn any address outside the pr_strings area into an index into a table
of engine string addresses, adding new string addresses to the table as
needed. the engine strings table is allocated with 256 entries at first
(see the PR_STRING_ALLOCSLOTS definition in pr_edict.c) and its size is
incremented by 256 as needed and re-allocated on the zone. managing that
allocation and reallocation is accomplished by the recently added Z_Realloc
function. implementation based on the uhexen2 (hexen2: hammer of thyrion)
engine which, in turn, is loosely based on twilight and quakeforge engines.
pr_strings range check is from tyrquake.
pr_edict.c: added the new PR_SetEngineString, PR_GetString, PR_AllocString
public functions and the new private PR_AllocStringSlots function. made
ED_NewString private to pr_edict.c and reworked it to return an index to a
newly allocated string.
progs.h: added prototypes for the new public PR_SetEngineString, PR_GetString
and PR_AllocString functions.
host_cmd.c, pr_cmds.c, pr_edict.c, pr_exec.c, progs.h, sv_main.c, sv_phys.c:
modifed to use the new PR_SetEngineString and PR_GetString functions.
git-svn-id: svn://svn.code.sf.net/p/quakespasm/code/trunk/quakespasm@38 af15c1b1-3010-417e-b628-4374ebc0bcbd
2010-02-17 15:04:50 +00:00
2011-12-12 08:56:25 +00:00
void PR_Profile_f ( void ) ;
2010-02-15 23:26:55 +00:00
edict_t * ED_Alloc ( void ) ;
void ED_Free ( edict_t * ed ) ;
void ED_Print ( edict_t * ed ) ;
void ED_Write ( FILE * f , edict_t * ed ) ;
2010-08-29 02:22:55 +00:00
const char * ED_ParseEdict ( const char * data , edict_t * ent ) ;
2010-02-15 23:26:55 +00:00
void ED_WriteGlobals ( FILE * f ) ;
2017-04-16 02:53:06 +00:00
const char * ED_ParseGlobals ( const char * data ) ;
2010-02-15 23:26:55 +00:00
2010-08-29 02:22:55 +00:00
void ED_LoadFromFile ( const char * data ) ;
2010-02-15 23:26:55 +00:00
2011-12-12 08:56:25 +00:00
/*
# define EDICT_NUM(n) ((edict_t *)(sv.edicts+ (n)*pr_edict_size))
# define NUM_FOR_EDICT(e) (((byte *)(e) - sv.edicts) / pr_edict_size)
*/
2022-04-27 14:00:02 +00:00
edict_t * EDICT_NUM ( int ) ;
int NUM_FOR_EDICT ( edict_t * ) ;
2010-02-15 23:26:55 +00:00
2018-05-01 00:35:14 +00:00
# define NEXT_EDICT(e) ((edict_t *)( (byte *)e + qcvm->edict_size))
2010-02-15 23:26:55 +00:00
2018-05-01 00:35:14 +00:00
# define EDICT_TO_PROG(e) ((byte *)e - (byte *)qcvm->edicts)
# define PROG_TO_EDICT(e) ((edict_t *)((byte *)qcvm->edicts + e))
2010-02-15 23:26:55 +00:00
2018-05-01 00:35:14 +00:00
# define G_FLOAT(o) (qcvm->globals[o])
# define G_INT(o) (*(int *)&qcvm->globals[o])
# define G_EDICT(o) ((edict_t *)((byte *)qcvm->edicts+ *(int *)&qcvm->globals[o]))
2011-12-12 08:56:25 +00:00
# define G_EDICTNUM(o) NUM_FOR_EDICT(G_EDICT(o))
2018-05-01 00:35:14 +00:00
# define G_VECTOR(o) (&qcvm->globals[o])
# define G_STRING(o) (PR_GetString(*(string_t *)&qcvm->globals[o]))
# define G_FUNCTION(o) (*(func_t *)&qcvm->globals[o])
# define G_VECTORSET(r,x,y,z) do{G_FLOAT((r)+0) = x; G_FLOAT((r)+1) = y;G_FLOAT((r)+2) = z;}while(0)
2010-02-15 23:26:55 +00:00
2011-12-12 08:56:25 +00:00
# define E_FLOAT(e,o) (((float*)&e->v)[o])
# define E_INT(e,o) (*(int *)&((float*)&e->v)[o])
# define E_VECTOR(e,o) (&((float*)&e->v)[o])
# define E_STRING(e,o) (PR_GetString(*(string_t *)&((float*)&e->v)[o]))
2010-02-15 23:26:55 +00:00
extern int type_size [ 8 ] ;
2017-09-16 19:50:12 +00:00
FUNC_NORETURN void PR_RunError ( const char * error , . . . ) FUNC_PRINTF ( 1 , 2 ) ;
2021-03-28 11:16:10 +00:00
void PR_RunWarning ( const char * error , . . . ) FUNC_PRINTF ( 1 , 2 ) ;
2017-07-28 20:11:03 +00:00
# ifdef __WATCOMC__
# pragma aux PR_RunError aborts;
# endif
2010-02-15 23:26:55 +00:00
void ED_PrintEdicts ( void ) ;
void ED_PrintNum ( int ent ) ;
2017-09-17 02:12:53 +00:00
eval_t * GetEdictFieldValue ( edict_t * ed , int fldofs ) ; //handles invalid offsets with a null
int ED_FindFieldOffset ( const char * name ) ;
2020-09-03 10:08:13 +00:00
# define GetEdictFieldValid(fld) (qcvm->extfields.fld>=0)
# define GetEdictFieldEval(ed,fld) ((eval_t *)((char *)&ed->v + qcvm->extfields.fld*4)) //caller must validate the field first
2017-09-17 02:12:53 +00:00
//from pr_cmds, no longer static so that pr_ext can use them.
sizebuf_t * WriteDest ( void ) ;
char * PR_GetTempString ( void ) ;
2018-05-01 00:35:14 +00:00
int PR_MakeTempString ( const char * val ) ;
2017-09-17 02:12:53 +00:00
char * PF_VarString ( int first ) ;
2018-07-07 14:05:34 +00:00
# define STRINGTEMP_BUFFERS 1024
2017-09-17 02:12:53 +00:00
# define STRINGTEMP_LENGTH 1024
void PF_Fixme ( void ) ; //the 'unimplemented' builtin. woot.
2018-05-01 00:35:14 +00:00
struct pr_extfuncs_s
2020-09-03 10:08:13 +00:00
{
/*all vms*/
# define QCEXTFUNCS_COMMON \
QCEXTFUNC ( GameCommand , " void(string cmdtext) " ) /*obsoleted by m_consolecommand, included for dp compat.*/ \
/*csqc+ssqc*/
# define QCEXTFUNCS_GAME \
QCEXTFUNC ( EndFrame , " void() " ) \
/*ssqc*/
# define QCEXTFUNCS_SV \
QCEXTFUNC ( SV_ParseClientCommand , " void(string cmd) " ) \
QCEXTFUNC ( SV_RunClientCommand , " void() " ) \
/*csqc*/
# define QCEXTFUNCS_CS \
2021-08-31 02:36:55 +00:00
QCEXTFUNC ( CSQC_Init , " void(float apilevel, string enginename, float engineversion) " ) \
QCEXTFUNC ( CSQC_Shutdown , " void() " ) \
2020-09-03 10:08:13 +00:00
QCEXTFUNC ( CSQC_DrawHud , " void(vector virtsize, float showscores) " ) /*simple: for the simple(+limited) hud-only csqc interface.*/ \
QCEXTFUNC ( CSQC_DrawScores , " void(vector virtsize, float showscores) " ) /*simple: (optional) for the simple hud-only csqc interface.*/ \
QCEXTFUNC ( CSQC_InputEvent , " float(float evtype, float scanx, float chary, float devid) " ) \
QCEXTFUNC ( CSQC_ConsoleCommand , " float(string cmdstr) " ) \
QCEXTFUNC ( CSQC_Parse_Event , " void() " ) \
2021-08-31 02:36:55 +00:00
QCEXTFUNC ( CSQC_Parse_Damage , " float(float save, float take, vector dir) " ) \
2020-09-03 10:08:13 +00:00
QCEXTFUNC ( CSQC_UpdateView , " void(float vwidth, float vheight, float notmenu) " ) /*full only: for the full csqc-draws-entire-screen interface*/ \
2022-08-23 10:58:15 +00:00
QCEXTFUNC ( CSQC_UpdateViewLoading , " void(float vwidth, float vheight, float notmenu) " ) /*full only: for the full csqc-draws-entire-screen interface*/ \
2020-09-03 10:08:13 +00:00
QCEXTFUNC ( CSQC_Input_Frame , " void() " ) /*full only: input angles stuff.*/ \
QCEXTFUNC ( CSQC_Parse_CenterPrint , " float(string msg) " ) \
QCEXTFUNC ( CSQC_Parse_Print , " void(string printmsg, float printlvl) " ) \
QCEXTFUNC ( CSQC_Ent_Update , " void(float isnew) " ) /*full: lots of reads needed to interpret the bytestream*/ \
QCEXTFUNC ( CSQC_Ent_Remove , " void() " ) /*full: basically just remove(self)*/ \
2021-08-31 02:36:55 +00:00
QCEXTFUNC ( CSQC_Event_Sound , " void(float entnum, float channel, string soundname, float vol, float attenuation, vector pos, float pitchmod, float flags) " ) /*full: basically just remove(self)*/ \
QCEXTFUNC ( CSQC_Parse_TempEntity , " float() " ) /*full: evil... This is the bane of all protocol compatibility. Die.*/ \
2020-09-03 10:08:13 +00:00
QCEXTFUNC ( CSQC_Parse_StuffCmd , " void(string msg) " ) /*full only: not in simple. Too easy to make cheats by ignoring server messages.*/ \
/*menucsqc*/
# define QCEXTFUNCS_MENU \
QCEXTFUNC ( m_init , " void() " ) \
QCEXTFUNC ( m_toggle , " void(float wantmode) " ) /*-1: toggle, 0: clear, 1: force*/ \
QCEXTFUNC ( m_draw , " void(vector screensize) " ) \
2021-08-31 02:36:55 +00:00
QCEXTFUNC ( m_keydown , " void(float scan, float chr) " ) /*obsoleted by Menu_InputEvent, included for dp compat.*/ \
2020-09-03 10:08:13 +00:00
QCEXTFUNC ( m_keyup , " void(float scan, float chr) " ) /*obsoleted by Menu_InputEvent, included for dp compat.*/ \
QCEXTFUNC ( m_consolecommand , " float(string cmd) " ) \
QCEXTFUNC ( Menu_InputEvent , " float(float evtype, float scanx, float chary, float devid) " ) \
# define QCEXTFUNC(n,t) func_t n;
QCEXTFUNCS_COMMON
QCEXTFUNCS_GAME
QCEXTFUNCS_SV
QCEXTFUNCS_CS
QCEXTFUNCS_MENU
# undef QCEXTFUNC
2018-05-01 00:35:14 +00:00
} ;
2017-09-17 02:12:53 +00:00
extern cvar_t pr_checkextension ; //if 0, extensions are disabled (unless they'd be fatal, but they're still spammy)
2018-05-01 00:35:14 +00:00
struct pr_extglobals_s
{
2020-09-03 10:08:13 +00:00
# define QCEXTGLOBALS_COMMON \
QCEXTGLOBAL_FLOAT ( time ) \
QCEXTGLOBAL_FLOAT ( frametime ) \
//end
# define QCEXTGLOBALS_GAME \
QCEXTGLOBAL_FLOAT ( input_timelength ) \
2021-03-18 09:04:08 +00:00
QCEXTGLOBAL_VECTOR ( input_movevalues ) \
QCEXTGLOBAL_VECTOR ( input_angles ) \
2020-09-03 10:08:13 +00:00
QCEXTGLOBAL_FLOAT ( input_buttons ) \
QCEXTGLOBAL_FLOAT ( input_impulse ) \
2021-05-10 23:52:02 +00:00
QCEXTGLOBAL_INT ( input_weapon ) \
QCEXTGLOBAL_VECTOR ( input_cursor_screen ) \
QCEXTGLOBAL_VECTOR ( input_cursor_trace_start ) \
QCEXTGLOBAL_VECTOR ( input_cursor_trace_endpos ) \
QCEXTGLOBAL_FLOAT ( input_cursor_entitynumber ) \
2020-09-03 10:08:13 +00:00
QCEXTGLOBAL_FLOAT ( physics_mode ) \
//end
# define QCEXTGLOBALS_CSQC \
QCEXTGLOBAL_FLOAT ( cltime ) \
2021-03-18 09:04:08 +00:00
QCEXTGLOBAL_FLOAT ( clframetime ) \
2020-09-03 10:08:13 +00:00
QCEXTGLOBAL_FLOAT ( maxclients ) \
QCEXTGLOBAL_FLOAT ( intermission ) \
QCEXTGLOBAL_FLOAT ( intermission_time ) \
QCEXTGLOBAL_FLOAT ( player_localnum ) \
QCEXTGLOBAL_FLOAT ( player_localentnum ) \
2021-03-18 09:04:08 +00:00
QCEXTGLOBAL_VECTOR ( view_angles ) \
2020-09-03 10:08:13 +00:00
QCEXTGLOBAL_FLOAT ( clientcommandframe ) \
QCEXTGLOBAL_FLOAT ( servercommandframe ) \
//end
# define QCEXTGLOBAL_FLOAT(n) float *n;
2021-05-10 23:52:02 +00:00
# define QCEXTGLOBAL_INT(n) int *n;
2021-03-18 09:04:08 +00:00
# define QCEXTGLOBAL_VECTOR(n) float *n;
2020-09-03 10:08:13 +00:00
QCEXTGLOBALS_COMMON
QCEXTGLOBALS_GAME
QCEXTGLOBALS_CSQC
# undef QCEXTGLOBAL_FLOAT
2021-05-10 23:52:02 +00:00
# undef QCEXTGLOBAL_INT
2021-03-18 09:04:08 +00:00
# undef QCEXTGLOBAL_VECTOR
2018-05-01 00:35:14 +00:00
} ;
struct pr_extfields_s
2017-09-17 02:12:53 +00:00
{ //various fields that might be wanted by the engine. -1 == invalid
2020-09-03 10:08:13 +00:00
# define QCEXTFIELDS_ALL \
/*renderscene means we need a number of fields here*/ \
QCEXTFIELD ( alpha , " .float " ) /*float*/ \
QCEXTFIELD ( scale , " .float " ) /*float*/ \
QCEXTFIELD ( colormod , " .vector " ) /*vector*/ \
QCEXTFIELD ( tag_entity , " .entity " ) /*entity*/ \
QCEXTFIELD ( tag_index , " .float " ) /*float*/ \
QCEXTFIELD ( modelflags , " .float " ) /*float, the upper 8 bits of .effects*/ \
QCEXTFIELD ( origin , " .vector " ) /*for menuqc's addentity builtin.*/ \
QCEXTFIELD ( angles , " .vector " ) /*for menuqc's addentity builtin.*/ \
QCEXTFIELD ( frame , " .float " ) /*for menuqc's addentity builtin.*/ \
QCEXTFIELD ( skin , " .float " ) /*for menuqc's addentity builtin.*/ \
/*end of list*/
# define QCEXTFIELDS_GAME \
/*stuff used by csqc+ssqc, but not menu*/ \
QCEXTFIELD ( customphysics , " .void() " ) /*function*/ \
QCEXTFIELD ( gravity , " .float " ) /*float*/ \
//end of list
# define QCEXTFIELDS_CL \
QCEXTFIELD ( frame2 , " .float " ) /*for csqc's addentity builtin.*/ \
QCEXTFIELD ( lerpfrac , " .float " ) /*for csqc's addentity builtin.*/ \
QCEXTFIELD ( frame1time , " .float " ) /*for csqc's addentity builtin.*/ \
QCEXTFIELD ( frame2time , " .float " ) /*for csqc's addentity builtin.*/ \
QCEXTFIELD ( renderflags , " .float " ) /*for csqc's addentity builtin.*/ \
//end of list
# define QCEXTFIELDS_CS \
/*csqc-only*/ \
QCEXTFIELD ( entnum , " .float " ) /*for csqc.*/ \
QCEXTFIELD ( drawmask , " .float " ) /*for csqc's addentities builtin.*/ \
QCEXTFIELD ( predraw , " .float() " ) /*for csqc's addentities builtin.*/ \
//end of list
# define QCEXTFIELDS_SS \
/*ssqc-only*/ \
QCEXTFIELD ( items2 , " //.float " ) /*float*/ \
QCEXTFIELD ( movement , " .vector " ) /*vector*/ \
QCEXTFIELD ( viewmodelforclient , " .entity " ) /*entity*/ \
QCEXTFIELD ( exteriormodeltoclient , " .entity " ) /*entity*/ \
QCEXTFIELD ( traileffectnum , " .float " ) /*float*/ \
QCEXTFIELD ( emiteffectnum , " .float " ) /*float*/ \
QCEXTFIELD ( button3 , " .float " ) /*float*/ \
QCEXTFIELD ( button4 , " .float " ) /*float*/ \
QCEXTFIELD ( button5 , " .float " ) /*float*/ \
QCEXTFIELD ( button6 , " .float " ) /*float*/ \
QCEXTFIELD ( button7 , " .float " ) /*float*/ \
QCEXTFIELD ( button8 , " .float " ) /*float*/ \
QCEXTFIELD ( viewzoom , " .float " ) /*float*/ \
QCEXTFIELD ( SendEntity , " .float(entity to, float changedflags) " ) /*function*/ \
QCEXTFIELD ( SendFlags , " .float " ) /*float. :( */ \
//end of list
# define QCEXTFIELD(n,t) int n;
QCEXTFIELDS_ALL
QCEXTFIELDS_GAME
QCEXTFIELDS_CL
QCEXTFIELDS_CS
QCEXTFIELDS_SS
# undef QCEXTFIELD
2018-05-01 00:35:14 +00:00
} ;
typedef struct
{
int s ;
dfunction_t * f ;
} prstack_t ;
typedef struct areanode_s
{
int axis ; // -1 = leaf node
float dist ;
struct areanode_s * children [ 2 ] ;
link_t trigger_edicts ;
link_t solid_edicts ;
} areanode_t ;
# define AREA_DEPTH 4
# define AREA_NODES 32
# define CSIE_KEYDOWN 0
# define CSIE_KEYUP 1
# define CSIE_MOUSEDELTA 2
# define CSIE_MOUSEABS 3
//#define CSIE_ACCELEROMETER 4
//#define CSIE_FOCUS 5
# define CSIE_JOYAXIS 6
//#define CSIE_GYROSCOPE 7
struct qcvm_s
{
dprograms_t * progs ;
dfunction_t * functions ;
dstatement_t * statements ;
float * globals ; /* same as pr_global_struct */
ddef_t * fielddefs ; //yay reflection.
int edict_size ; /* in bytes */
builtin_t builtins [ 1024 ] ;
int numbuiltins ;
int argc ;
qboolean trace ;
dfunction_t * xfunction ;
int xstatement ;
2020-09-03 10:39:38 +00:00
unsigned short progscrc ; //crc16 of the entire file
unsigned int progshash ; //folded file md4
unsigned int progssize ; //file size (bytes)
2018-05-01 00:35:14 +00:00
struct pr_extglobals_s extglobals ;
struct pr_extfuncs_s extfuncs ;
struct pr_extfields_s extfields ;
2020-07-08 14:38:08 +00:00
2020-07-02 19:05:51 +00:00
qboolean cursorforced ;
2020-07-08 14:38:08 +00:00
void * cursorhandle ; //video code.
2020-09-03 10:39:38 +00:00
qboolean nogameaccess ; //simplecsqc isn't allowed to poke properties of the actual game (to prevent cheats when there's no restrictions on what it can access)
2021-09-08 01:47:50 +00:00
qboolean brokenbouncemissile ; //2021 rerelease redefined it, breaking any mod that depends on it.
2022-08-23 09:10:17 +00:00
qboolean rotatingbmodel ; //2021 rerelease fucks over avelocity on movetype_push. broken by lots of other defective maps too.
2021-09-08 01:47:50 +00:00
qboolean brokeneffects ; //2021 rerelease redefined EF_RED and EF_BLUE.
2021-09-06 10:59:09 +00:00
qboolean precacheanytime ; //mod queried for support. this is used to spam warnings to anyone that doesn't bother checking for it first. this annoyance is to reduce compat issues.
2018-05-01 00:35:14 +00:00
2022-08-23 09:10:17 +00:00
qboolean warned_rotatingbmodel ; //to enable warnings if the map looks like it this extension should have been enabled.
2018-05-01 00:35:14 +00:00
//was static inside pr_edict
char * strings ;
int stringssize ;
const char * * knownstrings ;
int maxknownstrings ;
int numknownstrings ;
int freeknownstrings ;
ddef_t * globaldefs ;
unsigned char * knownzone ;
size_t knownzonesize ;
//originally defined in pr_exec, but moved into the switchable qcvm struct
2020-01-12 07:45:41 +00:00
# define MAX_STACK_DEPTH 1024 /*was 64*/ /* was 32 */
2018-05-01 00:35:14 +00:00
prstack_t stack [ MAX_STACK_DEPTH ] ;
int depth ;
2020-01-12 07:45:41 +00:00
# define LOCALSTACK_SIZE 16384 /* was 2048*/
2018-05-01 00:35:14 +00:00
int localstack [ LOCALSTACK_SIZE ] ;
int localstack_used ;
//originally part of the sv_state_t struct
//FIXME: put worldmodel in here too.
double time ;
2022-07-19 21:36:57 +00:00
double frametime ;
2018-05-01 00:35:14 +00:00
int num_edicts ;
int reserved_edicts ;
int max_edicts ;
edict_t * edicts ; // can NOT be array indexed, because edict_t is variable sized, but can be used to reference the world ent
2022-08-23 10:58:15 +00:00
qboolean worldlocked ;
2018-05-01 00:35:14 +00:00
struct qmodel_s * worldmodel ;
struct qmodel_s * ( * GetModel ) ( int modelindex ) ; //returns the model for the given index, or null.
//originally from world.c
areanode_t areanodes [ AREA_NODES ] ;
int numareanodes ;
} ;
extern globalvars_t * pr_global_struct ;
#if 0
extern qcvm_t ssqcvm ;
# define qcvm (&ssqcvm)
# define PR_SwitchQCVM(n)
# else
extern qcvm_t * qcvm ;
void PR_SwitchQCVM ( qcvm_t * nvm ) ;
# endif
2022-07-15 12:24:04 +00:00
extern const builtin_t pr_ssqcbuiltins [ ] ;
extern const int pr_ssqcnumbuiltins ;
extern const builtin_t pr_csqcbuiltins [ ] ;
extern const int pr_csqcnumbuiltins ;
extern const builtin_t pr_menubuiltins [ ] ;
extern int const pr_menunumbuiltins ;
bspfile.h, cdaudio.h, client.h, cmd.h, common.h, console.h, crc.h, cvar.h,
d_ifacea.h, draw.h, gl_texmgr.h, glquake.h, image.h, input.h, keys.h, mathlib.h,
menu.h, modelgen.h, net.h, net_dgrm.h, net_loop.h, net_sdlnet.h, net_udp.h,
net_wins.h, platform.h, pr_comp.h, progdefs.h, progs.h, protocol.h, quakedef.h,
render.h, resource.h, sbar.h, screen.h, server.h, sound.h, spritegn.h, sys.h,
vid.h, view.h, wad.h, world.h, zone.h: added include guards to the headers.
git-svn-id: svn://svn.code.sf.net/p/quakespasm/code/trunk/quakespasm@84 af15c1b1-3010-417e-b628-4374ebc0bcbd
2010-02-21 00:01:08 +00:00
2022-04-27 14:00:02 +00:00
# endif /* QUAKE_PROGS_H */