diff --git a/nq/include/mathlib.h b/nq/include/mathlib.h index 994838ff9..3333cb96c 100644 --- a/nq/include/mathlib.h +++ b/nq/include/mathlib.h @@ -43,10 +43,10 @@ extern int nanmask; #define IS_NAN(x) (((*(int *)&x)&nanmask)==nanmask) -#define DotProduct(x,y) (x[0]*y[0]+x[1]*y[1]+x[2]*y[2]) -#define VectorSubtract(a,b,c) {c[0]=a[0]-b[0];c[1]=a[1]-b[1];c[2]=a[2]-b[2];} -#define VectorAdd(a,b,c) {c[0]=a[0]+b[0];c[1]=a[1]+b[1];c[2]=a[2]+b[2];} -#define VectorCopy(a,b) {b[0]=a[0];b[1]=a[1];b[2]=a[2];} +#define DotProduct(a,b) ((a)[0]*(b)[0]+(a)[1]*(b)[1]+(a)[2]*(b)[2]) +#define VectorSubtract(a,b,c) {(c)[0]=(a)[0]-(b)[0];(c)[1]=(a)[1]-(b)[1];(c)[2]=(a)[2]-(b)[2];} +#define VectorAdd(a,b,c) {(c)[0]=(a)[0]+(b)[0];(c)[1]=(a)[1]+(b)[1];(c)[2]=(a)[2]+(b)[2];} +#define VectorCopy(a,b) {(b)[0]=(a)[0];(b)[1]=(a)[1];(b)[2]=(a)[2];} // up / down #define PITCH 0 diff --git a/nq/include/sv_pr_cmds.h b/nq/include/sv_pr_cmds.h new file mode 100644 index 000000000..bb03f3db0 --- /dev/null +++ b/nq/include/sv_pr_cmds.h @@ -0,0 +1,108 @@ +/* + sv_pr_cmds.h + + server progs builtin prototypes + + Copyright (C) 2000 #AUTHOR# + + Author: #AUTHOR# + Date: #DATE# + + 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: + + Free Software Foundation, Inc. + 59 Temple Place - Suite 330 + Boston, MA 02111-1307, USA + + $Id$ +*/ + +#ifndef __sv_pr_cmds_h +#define __sv_pr_cmds_h + +char * PF_VarString (progs_t * pr, int first); +void PF_error (progs_t * pr); +void PF_objerror (progs_t * pr); +void PF_makevectors (progs_t * pr); +void PF_setorigin (progs_t * pr); +void PF_setsize (progs_t * pr); +void PF_setmodel (progs_t * pr); +void PF_bprint (progs_t * pr); +void PF_sprint (progs_t * pr); +void PF_centerprint (progs_t * pr); +void PF_normalize (progs_t * pr); +void PF_vlen (progs_t * pr); +void PF_vectoyaw (progs_t * pr); +void PF_vectoangles (progs_t * pr); +void PF_random (progs_t * pr); +void PF_particle (progs_t * pr); +void PF_ambientsound (progs_t * pr); +void PF_sound (progs_t * pr); +void PF_break (progs_t * pr); +void PF_traceline (progs_t * pr); +void PF_TraceToss (progs_t * pr); +void PF_checkpos (progs_t * pr); +int PF_newcheckclient (progs_t * pr, int check); +void PF_checkclient (progs_t * pr); +void PF_stuffcmd (progs_t * pr); +void PF_localcmd (progs_t * pr); +void PF_cvar (progs_t * pr); +void PF_cvar_set (progs_t * pr); +void PF_findradius (progs_t * pr); +void PF_dprint (progs_t * pr); +void PF_ftos (progs_t * pr); +void PF_fabs (progs_t * pr); +void PF_vtos (progs_t * pr); +void PF_etos (progs_t * pr); +void PF_Spawn (progs_t * pr); +void PF_Remove (progs_t * pr); +void PF_Find (progs_t * pr); +void PF_precache_file (progs_t * pr); +void PF_precache_sound (progs_t * pr); +void PF_precache_model (progs_t * pr); +void PF_coredump (progs_t * pr); +void PF_traceon (progs_t * pr); +void PF_traceoff (progs_t * pr); +void PF_eprint (progs_t * pr); +void PF_walkmove (progs_t * pr); +void PF_droptofloor (progs_t * pr); +void PF_lightstyle (progs_t * pr); +void PF_rint (progs_t * pr); +void PF_floor (progs_t * pr); +void PF_ceil (progs_t * pr); +void PF_checkbottom (progs_t * pr); +void PF_pointcontents (progs_t * pr); +void PF_nextent (progs_t * pr); +void PF_aim (progs_t * pr); +void PF_changeyaw (progs_t * pr); +void PF_changepitch (progs_t * pr); +void PF_WriteByte (progs_t * pr); +void PF_WriteChar (progs_t * pr); +void PF_WriteShort (progs_t * pr); +void PF_WriteLong (progs_t * pr); +void PF_WriteAngle (progs_t * pr); +void PF_WriteCoord (progs_t * pr); +void PF_WriteString (progs_t * pr); +void PF_WriteEntity (progs_t * pr); +void PF_makestatic (progs_t * pr); +void PF_setspawnparms (progs_t * pr); +void PF_changelevel (progs_t * pr); +void PF_WaterMove (progs_t * pr); +void PF_sin (progs_t * pr); +void PF_cos (progs_t * pr); +void PF_sqrt (progs_t * pr); +void PF_Fixme (progs_t * pr); + +#endif // __sv_pr_cmds_h diff --git a/nq/include/sv_progs.h b/nq/include/sv_progs.h index 14508da57..e2eda5b4b 100644 --- a/nq/include/sv_progs.h +++ b/nq/include/sv_progs.h @@ -33,6 +33,7 @@ #define __sv_progs_h #include "progs.h" +#include "sv_pr_cmds.h" typedef struct { int *self; @@ -182,7 +183,13 @@ typedef struct extern sv_fields_t sv_fields; #if 1 -#define SVFIELD(e,f,t) ((ED_FindField (&sv_pr_state, #f)->type == ev_##t) ? E_var (e, sv_fields.f, t) : PR_Error (&sv_pr_state, "bad type access %s:%d", __FILE__, __LINE__), E_var (e, sv_fields.f, t)) +#define SVFIELD(e,f,t) \ + ((ED_FindField (&sv_pr_state, #f)->type == ev_##t) \ + ? E_var (e, sv_fields.f, t) \ + : PR_Error (&sv_pr_state, \ + "bad type access to %s as %s at %s:%d", \ + #f, #t, __FILE__, __LINE__), \ + E_var (e, sv_fields.f, t)) #else #define SVFIELD(e,f,t) E_var (e, sv_fields.f, t) #endif diff --git a/nq/source/host_cmd.c b/nq/source/host_cmd.c index f1ba8f5ba..9aabb5a89 100644 --- a/nq/source/host_cmd.c +++ b/nq/source/host_cmd.c @@ -936,8 +936,8 @@ Host_Name_f (void) if (strcmp (host_client->name, newName) != 0) Con_Printf ("%s renamed to %s\n", host_client->name, newName); strcpy (host_client->name, newName); - SVFIELD (host_client->edict, netname, float) = - host_client->name - sv_pr_state.pr_strings; + SVFIELD (host_client->edict, netname, string) = + PR_SetString (&sv_pr_state, host_client->name); // send notification to all clients @@ -1170,12 +1170,10 @@ Host_Pause_f (void) if (sv.paused) { SV_BroadcastPrintf ("%s paused the game\n", - sv_pr_state.pr_strings + - SVFIELD (sv_player, netname, string)); + PR_GetString (&sv_pr_state, SVFIELD (sv_player, netname, string))); } else { SV_BroadcastPrintf ("%s unpaused the game\n", - sv_pr_state.pr_strings + - SVFIELD (sv_player, netname, string)); + PR_GetString (&sv_pr_state, SVFIELD (sv_player, netname, string))); } // send notification to all clients @@ -1244,7 +1242,7 @@ Host_Spawn_f (void) memset (&ent->v, 0, sv_pr_state.progs->entityfields * 4); SVFIELD (ent, colormap, float) = NUM_FOR_EDICT (&sv_pr_state, ent); SVFIELD (ent, team, float) = (host_client->colors & 15) + 1; - SVFIELD (ent, netname, float) = host_client->name - sv_pr_state.pr_strings; + SVFIELD (ent, netname, string) = PR_SetString (&sv_pr_state, host_client->name); // copy spawn parms out of the client_t @@ -1592,7 +1590,7 @@ FindViewthing (void) for (i = 0; i < sv.num_edicts; i++) { e = EDICT_NUM (&sv_pr_state, i); - if (!strcmp (sv_pr_state.pr_strings + SVFIELD (e, classname, string), "viewthing")) + if (!strcmp (PR_GetString (&sv_pr_state, SVFIELD (e, classname, string)), "viewthing")) return e; } Con_Printf ("No viewthing on map\n"); diff --git a/nq/source/pr_cmds.c b/nq/source/pr_cmds.c index 1bc049f53..167b7336f 100644 --- a/nq/source/pr_cmds.c +++ b/nq/source/pr_cmds.c @@ -84,7 +84,7 @@ PF_error (progs_t * pr) s = PF_VarString (pr, 0); Con_Printf ("======SERVER ERROR in %s:\n%s\n", - pr->pr_strings + pr->pr_xfunction->s_name, s); + PR_GetString (&sv_pr_state, pr->pr_xfunction->s_name), s); ed = PROG_TO_EDICT (pr, *sv_globals.self); ED_Print (pr, ed); @@ -109,7 +109,7 @@ PF_objerror (progs_t * pr) s = PF_VarString (pr, 0); Con_Printf ("======OBJECT ERROR in %s:\n%s\n", - pr->pr_strings + pr->pr_xfunction->s_name, s); + PR_GetString (&sv_pr_state, pr->pr_xfunction->s_name), s); ed = PROG_TO_EDICT (pr, *sv_globals.self); ED_Print (pr, ed); ED_Free (pr, ed); @@ -279,7 +279,7 @@ PF_setmodel (progs_t * pr) PR_RunError (pr, "no precache: %s\n", m); - SVFIELD (e, model, float) = m - pr->pr_strings; + SVFIELD (e, model, string) = PR_SetString (pr, m); SVFIELD (e, modelindex, float) = i; // SV_ModelIndex (m); mod = sv.models[(int) SVFIELD (e, modelindex, float)]; // Mod_ForName (m, true); @@ -947,7 +947,7 @@ PF_findradius (progs_t * pr) if (Length (eorg) > rad) continue; - SVFIELD (ent, chain, float) = EDICT_TO_PROG (pr, chain); + SVFIELD (ent, chain, entity) = EDICT_TO_PROG (pr, chain); chain = ent; } @@ -979,7 +979,7 @@ PF_ftos (progs_t * pr) snprintf (pr_string_temp, sizeof (pr_string_temp), "%d", (int) v); else snprintf (pr_string_temp, sizeof (pr_string_temp), "%5.1f", v); - G_INT (pr, OFS_RETURN) = pr_string_temp - pr->pr_strings; + G_INT (pr, OFS_RETURN) = PR_SetString (pr, pr_string_temp); } void @@ -998,7 +998,7 @@ PF_vtos (progs_t * pr) "'%5.1f %5.1f %5.1f'", G_VECTOR (pr, OFS_PARM0)[0], G_VECTOR (pr, OFS_PARM0) [1], G_VECTOR (pr, OFS_PARM0)[2]); - G_INT (pr, OFS_RETURN) = pr_string_temp - pr->pr_strings; + G_INT (pr, OFS_RETURN) = PR_SetString (pr, pr_string_temp); } #ifdef QUAKE2 @@ -1007,7 +1007,7 @@ PF_etos (progs_t * pr) { snprintf (pr_string_temp, sizeof (pr_string_temp), "entity %i", G_EDICTNUM (pr, OFS_PARM0)); - G_INT (pr, OFS_RETURN) = pr_string_temp - pr->pr_strings; + G_INT (pr, OFS_RETURN) = PR_SetString (pr, pr_string_temp); } #endif @@ -1062,19 +1062,19 @@ PF_Find (progs_t * pr) first = ed; else if (second == (edict_t *) sv.edicts) second = ed; - SVFIELD (ed, chain, float) = EDICT_TO_PROG (pr, last); + SVFIELD (ed, chain, entity) = EDICT_TO_PROG (pr, last); last = ed; } } if (first != last) { if (last != second) - SVFIELD (first, chain, float) = SVFIELD (last, chain, float); + SVFIELD (first, chain, entity) = SVFIELD (last, chain, entity); else - SVFIELD (first, chain, float) = EDICT_TO_PROG (pr, last); - SVFIELD (last, chain, float) = EDICT_TO_PROG (pr, (edict_t *) sv.edicts); + SVFIELD (first, chain, entity) = EDICT_TO_PROG (pr, last); + SVFIELD (last, chain, entity) = EDICT_TO_PROG (pr, (edict_t *) sv.edicts); if (second && second != last) - SVFIELD (second, chain, float) = EDICT_TO_PROG (pr, last); + SVFIELD (second, chain, entity) = EDICT_TO_PROG (pr, last); } RETURN_EDICT (pr, first); } @@ -1272,7 +1272,7 @@ PF_droptofloor (progs_t * pr) VectorCopy (trace.endpos, SVFIELD (ent, origin, vector)); SV_LinkEdict (ent, false); SVFIELD (ent, flags, float) = (int) SVFIELD (ent, flags, float) | FL_ONGROUND; - SVFIELD (ent, groundentity, float) = EDICT_TO_PROG (pr, trace.ent); + SVFIELD (ent, groundentity, entity) = EDICT_TO_PROG (pr, trace.ent); G_FLOAT (pr, OFS_RETURN) = 1; } } @@ -1521,7 +1521,7 @@ PF_changepitch (progs_t * pr) float ideal, current, move, speed; ent = G_EDICT (pr, OFS_PARM0); - current = anglemod (SVFIELD (ent, angles, float)[0]); + current = anglemod (SVFIELD (ent, angles, vector)[0]); ideal = SVFIELD (ent, idealpitch, float); speed = SVFIELD (ent, pitch_speed, float); @@ -1543,7 +1543,7 @@ PF_changepitch (progs_t * pr) move = -speed; } - SVFIELD (ent, angles, float)[0] = anglemod (current + move); + SVFIELD (ent, angles, vector)[0] = anglemod (current + move); } #endif @@ -1656,7 +1656,7 @@ PF_makestatic (progs_t * pr) MSG_WriteByte (&sv.signon, svc_spawnstatic); - MSG_WriteByte (&sv.signon, SV_ModelIndex (pr->pr_strings + SVFIELD (ent, model, string))); + MSG_WriteByte (&sv.signon, SV_ModelIndex (PR_GetString (pr, SVFIELD (ent, model, string)))); MSG_WriteByte (&sv.signon, SVFIELD (ent, frame, float)); MSG_WriteByte (&sv.signon, SVFIELD (ent, colormap, float)); @@ -1859,9 +1859,9 @@ PF_WaterMove (progs_t * pr) if (!(flags & FL_WATERJUMP)) { // self.velocity = self.velocity - 0.8*self.waterlevel*frametime*self.velocity; - VectorMA (SVFIELD (self, velocity, float), + VectorMA (SVFIELD (self, velocity, vector), -0.8 * SVFIELD (self, waterlevel, float) * host_frametime, - SVFIELD (self, velocity, float), SVFIELD (self, velocity, float)); + SVFIELD (self, velocity, vector), SVFIELD (self, velocity, vector)); } G_FLOAT (pr, OFS_RETURN) = damage; diff --git a/nq/source/sv_main.c b/nq/source/sv_main.c index 2d8b7a78c..81d972a18 100644 --- a/nq/source/sv_main.c +++ b/nq/source/sv_main.c @@ -45,6 +45,8 @@ server_static_t svs; char localmodels[MAX_MODELS][5]; // inline model names for precache +entity_state_t baselines[MAX_EDICTS]; + //============================================================================ /* @@ -220,7 +222,7 @@ SV_SendServerinfo (client_t *client) MSG_WriteByte (&client->message, GAME_COOP); snprintf (message, sizeof (message), - sv_pr_state.pr_strings + SVFIELD (sv.edicts, message, string)); + PR_GetString (&sv_pr_state, SVFIELD (sv.edicts, message, string))); MSG_WriteString (&client->message, message); @@ -464,7 +466,7 @@ SV_WriteEntitiesToClient (edict_t *clent, sizebuf_t *msg) if (ent != clent) // clent is ALLWAYS sent { // ignore ents without visible models - if (!SVFIELD (ent, modelindex, float) || !sv_pr_state.pr_strings[SVFIELD (ent, model, string)]) + if (!SVFIELD (ent, modelindex, float) || !*PR_GetString (&sv_pr_state, SVFIELD (ent, model, string))) continue; for (i = 0; i < ent->num_leafs; i++) @@ -697,8 +699,8 @@ SV_WriteClientdataToMessage (edict_t *ent, sizebuf_t *msg) MSG_WriteByte (msg, SVFIELD (ent, armorvalue, float)); if (bits & SU_WEAPON) MSG_WriteByte (msg, - SV_ModelIndex (sv_pr_state.pr_strings + - SVFIELD (ent, weaponmodel, string))); + SV_ModelIndex (PR_GetString (&sv_pr_state, + SVFIELD (ent, weaponmodel, string)))); MSG_WriteShort (msg, SVFIELD (ent, health, float)); MSG_WriteByte (msg, SVFIELD (ent, currentammo, float)); @@ -958,7 +960,7 @@ SV_CreateBaseline (void) } else { ((entity_state_t*)svent->data)->colormap = 0; ((entity_state_t*)svent->data)->modelindex = - SV_ModelIndex (sv_pr_state.pr_strings + SVFIELD (svent, model, string)); + SV_ModelIndex (PR_GetString (&sv_pr_state,SVFIELD (svent, model, string))); } // @@ -1106,9 +1108,14 @@ SV_SpawnServer (char *server) // allocate server memory sv.max_edicts = MAX_EDICTS; + sv_pr_state.pr_edictareasize = sv_pr_state.pr_edict_size * MAX_EDICTS; + sv.edicts = Hunk_AllocName (sv_pr_state.pr_edictareasize, "edicts"); - sv.edicts = - Hunk_AllocName (sv.max_edicts * sv_pr_state.pr_edict_size, "edicts"); + // init the data field of the edicts + for (i = 0; i < MAX_EDICTS; i++) { + ent = EDICT_NUM (&sv_pr_state, i); + ent->data = &baselines[i]; + } sv.datagram.maxsize = sizeof (sv.datagram_buf); sv.datagram.cursize = 0; @@ -1164,7 +1171,7 @@ SV_SpawnServer (char *server) ent = EDICT_NUM (&sv_pr_state, 0); memset (&ent->v, 0, sv_pr_state.progs->entityfields * 4); ent->free = false; - SVFIELD (ent, model, string) = sv.worldmodel->name - sv_pr_state.pr_strings; + SVFIELD (ent, model, string) = PR_SetString (&sv_pr_state, sv.worldmodel->name); SVFIELD (ent, modelindex, float) = 1; // world model SVFIELD (ent, solid, float) = SOLID_BSP; SVFIELD (ent, movetype, float) = MOVETYPE_PUSH; @@ -1174,10 +1181,10 @@ SV_SpawnServer (char *server) else *sv_globals.deathmatch = deathmatch->int_val; - *sv_globals.mapname = sv.name - sv_pr_state.pr_strings; + *sv_globals.mapname = PR_SetString (&sv_pr_state, sv.name); #ifdef QUAKE2 *sv_globals.startspot = - sv.startspot - sv_pr_state.pr_strings; + PR_SetString (&sv_pr_state, sv.startspot); #endif // serverflags are for cross level information (sigils) diff --git a/nq/source/sv_move.c b/nq/source/sv_move.c index e96b67bb9..4ce715aa1 100644 --- a/nq/source/sv_move.c +++ b/nq/source/sv_move.c @@ -216,7 +216,7 @@ SV_movestep (edict_t *ent, vec3_t move, qboolean relink) // Con_Printf ("back on ground\n"); SVFIELD (ent, flags, float) = (int) SVFIELD (ent, flags, float) & ~FL_PARTIALGROUND; } - SVFIELD (ent, groundentity, float) = EDICT_TO_PROG (&sv_pr_state, trace.ent); + SVFIELD (ent, groundentity, entity) = EDICT_TO_PROG (&sv_pr_state, trace.ent); // the move is ok if (relink) @@ -236,7 +236,6 @@ facing it. ====================== */ -void PF_changeyaw (void); qboolean SV_StepDirection (edict_t *ent, float yaw, float dist) { @@ -244,7 +243,7 @@ SV_StepDirection (edict_t *ent, float yaw, float dist) float delta; SVFIELD (ent, ideal_yaw, float) = yaw; - PF_changeyaw (); + PF_changeyaw (&sv_pr_state); yaw = yaw * M_PI * 2 / 360; move[0] = cos (yaw) * dist; diff --git a/nq/source/sv_phys.c b/nq/source/sv_phys.c index 6a41ef065..30c859b55 100644 --- a/nq/source/sv_phys.c +++ b/nq/source/sv_phys.c @@ -115,12 +115,12 @@ SV_CheckVelocity (edict_t *ent) for (i = 0; i < 3; i++) { if (IS_NAN (SVFIELD (ent, velocity, vector)[i])) { Con_Printf ("Got a NaN velocity on %s\n", - sv_pr_state.pr_strings + SVFIELD (ent, classname, string)); + PR_GetString (&sv_pr_state, SVFIELD (ent, classname, string))); SVFIELD (ent, velocity, vector)[i] = 0; } if (IS_NAN (SVFIELD (ent, origin, vector)[i])) { Con_Printf ("Got a NaN origin on %s\n", - sv_pr_state.pr_strings + SVFIELD (ent, classname, string)); + PR_GetString (&sv_pr_state, SVFIELD (ent, classname, string))); SVFIELD (ent, origin, vector)[i] = 0; } if (SVFIELD (ent, velocity, vector)[i] > sv_maxvelocity->value) @@ -158,7 +158,7 @@ SV_RunThink (edict_t *ent) *sv_globals.self = EDICT_TO_PROG (&sv_pr_state, ent); *sv_globals.other = EDICT_TO_PROG (&sv_pr_state, sv.edicts); - PR_ExecuteProgram (&sv_pr_state, SVFIELD (ent, think, float)); + PR_ExecuteProgram (&sv_pr_state, SVFIELD (ent, think, func)); return !ent->free; } @@ -178,16 +178,16 @@ SV_Impact (edict_t *e1, edict_t *e2) old_other = *sv_globals.other; *sv_globals.time = sv.time; - if (SVFIELD (e1, touch, float) && SVFIELD (e1, solid, float) != SOLID_NOT) { + if (SVFIELD (e1, touch, func) && SVFIELD (e1, solid, float) != SOLID_NOT) { *sv_globals.self = EDICT_TO_PROG (&sv_pr_state, e1); *sv_globals.other = EDICT_TO_PROG (&sv_pr_state, e2); - PR_ExecuteProgram (&sv_pr_state, SVFIELD (e1, touch, float)); + PR_ExecuteProgram (&sv_pr_state, SVFIELD (e1, touch, func)); } - if (SVFIELD (e2, touch, float) && SVFIELD (e2, solid, float) != SOLID_NOT) { + if (SVFIELD (e2, touch, func) && SVFIELD (e2, solid, float) != SOLID_NOT) { *sv_globals.self = EDICT_TO_PROG (&sv_pr_state, e2); *sv_globals.other = EDICT_TO_PROG (&sv_pr_state, e1); - PR_ExecuteProgram (&sv_pr_state, SVFIELD (e2, touch, float)); + PR_ExecuteProgram (&sv_pr_state, SVFIELD (e2, touch, func)); } *sv_globals.self = old_self; @@ -744,7 +744,7 @@ SV_Physics_Pusher (edict_t *ent) *sv_globals.self = EDICT_TO_PROG (&sv_pr_state, ent); *sv_globals.other = EDICT_TO_PROG (&sv_pr_state, sv.edicts); - PR_ExecuteProgram (&sv_pr_state, SVFIELD (ent, think, float)); + PR_ExecuteProgram (&sv_pr_state, SVFIELD (ent, think, func)); if (ent->free) return; } @@ -1423,7 +1423,7 @@ SV_Physics_Step (edict_t *ent) //@@ *sv_globals.time = sv.time; *sv_globals.self = EDICT_TO_PROG (&sv_pr_state, ent); - PF_WaterMove (); + PF_WaterMove (&sv_pr_state); SV_CheckVelocity (ent); diff --git a/nq/source/world.c b/nq/source/world.c index 6759da40c..21c0c579c 100644 --- a/nq/source/world.c +++ b/nq/source/world.c @@ -306,7 +306,7 @@ SV_TouchLinks (edict_t *ent, areanode_t *node) touch = EDICT_FROM_AREA (l); if (touch == ent) continue; - if (!SVFIELD (touch, touch, float) || SVFIELD (touch, solid, float) != SOLID_TRIGGER) + if (!SVFIELD (touch, touch, func) || SVFIELD (touch, solid, float) != SOLID_TRIGGER) continue; if (SVFIELD (ent, absmin, vector)[0] > SVFIELD (touch, absmax, vector)[0] || SVFIELD (ent, absmin, vector)[1] > SVFIELD (touch, absmax, vector)[1] @@ -322,7 +322,7 @@ SV_TouchLinks (edict_t *ent, areanode_t *node) EDICT_TO_PROG (&sv_pr_state, touch); *sv_globals.other = EDICT_TO_PROG (&sv_pr_state, ent); *sv_globals.time = sv.time; - PR_ExecuteProgram (&sv_pr_state, SVFIELD (touch, touch, float)); + PR_ExecuteProgram (&sv_pr_state, SVFIELD (touch, touch, func)); *sv_globals.self = old_self; *sv_globals.other = old_other; diff --git a/qw/include/mathlib.h b/qw/include/mathlib.h index da63f9541..bf91ab798 100644 --- a/qw/include/mathlib.h +++ b/qw/include/mathlib.h @@ -43,7 +43,7 @@ extern int nanmask; #define IS_NAN(x) (((*(int *)&x)&nanmask)==nanmask) -#define DotProduct(x,y) (x[0]*y[0]+x[1]*y[1]+x[2]*y[2]) +#define DotProduct(a,b) ((a)[0]*(a)[0]+(a)[1]*(a)[1]+(a)[2]*(a)[2]) #define VectorSubtract(a,b,c) {(c)[0]=(a)[0]-(b)[0];(c)[1]=(a)[1]-(b)[1];(c)[2]=(a)[2]-(b)[2];} #define VectorAdd(a,b,c) {(c)[0]=(a)[0]+(b)[0];(c)[1]=(a)[1]+(b)[1];(c)[2]=(a)[2]+(b)[2];} #define VectorCopy(a,b) {(b)[0]=(a)[0];(b)[1]=(a)[1];(b)[2]=(a)[2];}