Random hacks, ODE works in csqc.
git-svn-id: https://svn.code.sf.net/p/fteqw/code/branches/wip@3464 fc73d0e0-1445-4013-8a0c-d673dee63da5
This commit is contained in:
parent
8f43c1297f
commit
1f34680832
30 changed files with 1153 additions and 1101 deletions
|
@ -275,7 +275,8 @@ static void PClassic_DrawParticles(void)
|
|||
union c usecolours;
|
||||
RSpeedMark();
|
||||
|
||||
RQ_RenderDistAndClear();
|
||||
//make sure all ents are pushed through first
|
||||
RQ_RenderBatchClear();
|
||||
|
||||
if (!active_particles)
|
||||
{
|
||||
|
|
|
@ -1719,37 +1719,7 @@ static void P_AddRainParticles(void)
|
|||
skipped = false;
|
||||
|
||||
lastrendered = particletime;
|
||||
/*
|
||||
{
|
||||
int i;
|
||||
|
||||
glDisable(GL_TEXTURE_2D);
|
||||
glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);
|
||||
glDisable(GL_DEPTH_TEST);
|
||||
glBegin(GL_TRIANGLES);
|
||||
|
||||
st = skytris;
|
||||
for (i = 0; i < r_part_rain_quantity.ival; i++)
|
||||
st = st->next;
|
||||
glVertex3f(st->org[0], st->org[1], st->org[2]);
|
||||
glVertex3f(st->org[0]+st->x[0], st->org[1]+st->x[1], st->org[2]+st->x[2]);
|
||||
glVertex3f(st->org[0]+st->y[0], st->org[1]+st->y[1], st->org[2]+st->y[2]);
|
||||
glEnd();
|
||||
glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
|
||||
glBegin(GL_POINTS);
|
||||
for (i = 0; i < 1000; i++)
|
||||
{
|
||||
x = frandom()*frandom();
|
||||
y = frandom() * (1-x);
|
||||
VectorMA(st->org, x, st->x, org);
|
||||
VectorMA(org, y, st->y, org);
|
||||
|
||||
glVertex3f(org[0], org[1], org[2]);
|
||||
}
|
||||
glEnd();
|
||||
glEnable(GL_DEPTH_TEST);
|
||||
}
|
||||
*/
|
||||
for (ptype = 0; ptype<numparticletypes; ptype++)
|
||||
{
|
||||
if (!part_type[ptype].loaded) //woo, batch skipping.
|
||||
|
@ -1757,9 +1727,6 @@ glEnable(GL_DEPTH_TEST);
|
|||
|
||||
for (st = part_type[ptype].skytris; st; st = st->next)
|
||||
{
|
||||
// if (st->face->visframe != r_framecount)
|
||||
// continue;
|
||||
|
||||
if (st->face->visframe != r_framecount)
|
||||
{
|
||||
st->nexttime = particletime;
|
||||
|
@ -4122,10 +4089,6 @@ static void PScript_DrawParticleTypes (void (*texturedparticles)(int count, part
|
|||
particletime += pframetime;
|
||||
}
|
||||
|
||||
static void PScript_FlushRenderer(void)
|
||||
{
|
||||
}
|
||||
|
||||
/*
|
||||
===============
|
||||
R_DrawParticles
|
||||
|
@ -4133,18 +4096,9 @@ R_DrawParticles
|
|||
*/
|
||||
static void PScript_DrawParticles (void)
|
||||
{
|
||||
RSpeedMark();
|
||||
|
||||
P_AddRainParticles();
|
||||
|
||||
|
||||
PScript_FlushRenderer();
|
||||
|
||||
PScript_DrawParticleTypes(GL_DrawTexturedParticle, GL_DrawLineSparkParticle, GL_DrawTrifanParticle, GL_DrawTexturedSparkParticle, GL_DrawParticleBeam, GL_DrawClippedDecal);
|
||||
|
||||
RSpeedRemark();
|
||||
RQ_RenderBatchClear();
|
||||
RSpeedEnd(RSPEED_PARTICLESDRAW);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -440,6 +440,8 @@ skelobject_t *skel_get(progfuncs_t *prinst, int skelidx, int bonecount);
|
|||
void skel_dodelete(void);
|
||||
|
||||
|
||||
qboolean csqc_deprecated_warned;
|
||||
#define csqc_deprecated(s) do {if (!csqc_deprecated_warned){Con_Printf("deprecated feature used: %s\n", s); csqc_deprecated_warned = true;}}while(0)
|
||||
|
||||
|
||||
static model_t *CSQC_GetModelForIndex(int index);
|
||||
|
@ -543,6 +545,18 @@ static void PF_cvar (progfuncs_t *prinst, struct globalvars_s *pr_globals)
|
|||
char *str;
|
||||
|
||||
str = PR_GetStringOfs(prinst, OFS_PARM0);
|
||||
|
||||
if (!strcmp(str, "vid_conwidth"))
|
||||
{
|
||||
csqc_deprecated("vid_conwidth cvar");
|
||||
G_FLOAT(OFS_RETURN) = vid.width;
|
||||
}
|
||||
else if (!strcmp(str, "vid_conheight"))
|
||||
{
|
||||
csqc_deprecated("vid_conheight cvar");
|
||||
G_FLOAT(OFS_RETURN) = vid.height;
|
||||
}
|
||||
else
|
||||
{
|
||||
var = Cvar_Get(str, "", 0, "csqc cvars");
|
||||
if (var)
|
||||
|
@ -1356,8 +1370,6 @@ static void PF_R_RenderScene(progfuncs_t *prinst, struct globalvars_s *pr_global
|
|||
if (qrenderer == QR_OPENGL)
|
||||
{
|
||||
gl_ztrickdisabled|=16;
|
||||
qglDisable(GL_ALPHA_TEST);
|
||||
qglDisable(GL_BLEND);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -1373,16 +1385,6 @@ static void PF_R_RenderScene(progfuncs_t *prinst, struct globalvars_s *pr_global
|
|||
{
|
||||
gl_ztrickdisabled&=~16;
|
||||
GL_Set2D ();
|
||||
qglBlendFunc (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
||||
GL_TexEnv(GL_MODULATE);
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef GLQUAKE
|
||||
if (qrenderer == QR_OPENGL)
|
||||
{
|
||||
qglDisable(GL_ALPHA_TEST);
|
||||
qglEnable(GL_BLEND);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -2164,6 +2166,8 @@ typedef struct {
|
|||
}
|
||||
else
|
||||
{
|
||||
csqc_deprecated("runplayerphysics with no ent");
|
||||
|
||||
if (csqcg.pmove_jump_held)
|
||||
pmove.jump_held = *csqcg.pmove_jump_held;
|
||||
if (csqcg.pmove_waterjumptime)
|
||||
|
@ -3934,82 +3938,13 @@ static void PF_skel_delete (progfuncs_t *prinst, struct globalvars_s *pr_globals
|
|||
|
||||
|
||||
|
||||
|
||||
static qboolean CS_CheckBottom (csqcedict_t *ent)
|
||||
{
|
||||
int savedhull;
|
||||
vec3_t mins, maxs, start, stop;
|
||||
trace_t trace;
|
||||
int x, y;
|
||||
float mid, bottom;
|
||||
|
||||
if (!cl.worldmodel)
|
||||
return false;
|
||||
|
||||
VectorAdd (ent->v->origin, ent->v->mins, mins);
|
||||
VectorAdd (ent->v->origin, ent->v->maxs, maxs);
|
||||
|
||||
// if all of the points under the corners are solid world, don't bother
|
||||
// with the tougher checks
|
||||
// the corners must be within 16 of the midpoint
|
||||
start[2] = mins[2] - 1;
|
||||
for (x=0 ; x<=1 ; x++)
|
||||
for (y=0 ; y<=1 ; y++)
|
||||
{
|
||||
start[0] = x ? maxs[0] : mins[0];
|
||||
start[1] = y ? maxs[1] : mins[1];
|
||||
if (!(CS_PointContents (start) & FTECONTENTS_SOLID))
|
||||
goto realcheck;
|
||||
}
|
||||
|
||||
// c_yes++;
|
||||
return true; // we got out easy
|
||||
|
||||
realcheck:
|
||||
// c_no++;
|
||||
//
|
||||
// check it for real...
|
||||
//
|
||||
start[2] = mins[2];
|
||||
|
||||
// the midpoint must be within 16 of the bottom
|
||||
start[0] = stop[0] = (mins[0] + maxs[0])*0.5;
|
||||
start[1] = stop[1] = (mins[1] + maxs[1])*0.5;
|
||||
stop[2] = start[2] - 2*movevars.stepheight;
|
||||
trace = World_Move (&csqc_world, start, vec3_origin, vec3_origin, stop, true, (wedict_t*)ent);
|
||||
|
||||
if (trace.fraction == 1.0)
|
||||
return false;
|
||||
mid = bottom = trace.endpos[2];
|
||||
|
||||
// the corners must be within 16 of the midpoint
|
||||
for (x=0 ; x<=1 ; x++)
|
||||
for (y=0 ; y<=1 ; y++)
|
||||
{
|
||||
start[0] = stop[0] = x ? maxs[0] : mins[0];
|
||||
start[1] = stop[1] = y ? maxs[1] : mins[1];
|
||||
|
||||
savedhull = ent->xv->hull;
|
||||
ent->xv->hull = 0;
|
||||
trace = World_Move (&csqc_world, start, vec3_origin, vec3_origin, stop, true, (wedict_t*)ent);
|
||||
ent->xv->hull = savedhull;
|
||||
|
||||
if (trace.fraction != 1.0 && trace.endpos[2] > bottom)
|
||||
bottom = trace.endpos[2];
|
||||
if (trace.fraction == 1.0 || mid - trace.endpos[2] > movevars.stepheight)
|
||||
return false;
|
||||
}
|
||||
|
||||
// c_yes++;
|
||||
return true;
|
||||
}
|
||||
static void PF_cs_checkbottom (progfuncs_t *prinst, struct globalvars_s *pr_globals)
|
||||
{
|
||||
csqcedict_t *ent;
|
||||
|
||||
ent = (csqcedict_t*)G_EDICT(prinst, OFS_PARM0);
|
||||
|
||||
G_FLOAT(OFS_RETURN) = CS_CheckBottom (ent);
|
||||
G_FLOAT(OFS_RETURN) = World_CheckBottom (&csqc_world, (wedict_t*)ent);
|
||||
}
|
||||
|
||||
static void PF_cs_break (progfuncs_t *prinst, struct globalvars_s *pr_globals)
|
||||
|
@ -4113,7 +4048,7 @@ static qboolean CS_movestep (csqcedict_t *ent, vec3_t move, qboolean relink, qbo
|
|||
// check point traces down for dangling corners
|
||||
VectorCopy (trace.endpos, ent->v->origin);
|
||||
|
||||
if (!CS_CheckBottom (ent))
|
||||
if (!World_CheckBottom (&csqc_world, (wedict_t*)ent))
|
||||
{
|
||||
if ( (int)ent->v->flags & FL_PARTIALGROUND )
|
||||
{ // entity had floor mostly pulled out from underneath it
|
||||
|
@ -4177,6 +4112,15 @@ static void PF_cs_walkmove (progfuncs_t *prinst, struct globalvars_s *pr_globals
|
|||
*csqcg.self = oldself;
|
||||
}
|
||||
|
||||
static void PF_cs_movetogoal (progfuncs_t *prinst, struct globalvars_s *pr_globals)
|
||||
{
|
||||
wedict_t *ent;
|
||||
float dist;
|
||||
ent = (wedict_t*)PROG_TO_EDICT(prinst, *csqcg.self);
|
||||
dist = G_FLOAT(OFS_PARM0);
|
||||
World_MoveToGoal (&csqc_world, ent, dist);
|
||||
}
|
||||
|
||||
static void CS_ConsoleCommand_f(void)
|
||||
{ //FIXME: unregister them.
|
||||
char cmd[2048];
|
||||
|
@ -4801,7 +4745,7 @@ static struct {
|
|||
|
||||
{"etos", PF_etos, 65}, // #65 string(entity ent) etos (DP_QC_ETOS)
|
||||
{"?", PF_Fixme, 66}, // #66
|
||||
// {"movetogoal", PF_Fixme, 67}, // #67 void(float step) movetogoal (QUAKE)
|
||||
{"movetogoal", PF_cs_movetogoal, 67}, // #67 void(float step) movetogoal (QUAKE)
|
||||
{"precache_file", PF_NoCSQC, 68}, // #68 void(string s) precache_file (QUAKE) (don't support)
|
||||
{"makestatic", PF_cs_makestatic, 69}, // #69 void(entity e) makestatic (QUAKE)
|
||||
//70
|
||||
|
@ -5311,6 +5255,10 @@ void CSQC_Shutdown(void)
|
|||
}
|
||||
csqcprogs = NULL;
|
||||
|
||||
#ifdef USEODE
|
||||
World_Physics_End(&csqc_world);
|
||||
#endif
|
||||
|
||||
Z_Free(csqcdelta_pack_new.e);
|
||||
memset(&csqcdelta_pack_new, 0, sizeof(csqcdelta_pack_new));
|
||||
Z_Free(csqcdelta_pack_old.e);
|
||||
|
@ -5513,6 +5461,7 @@ qboolean CSQC_Init (unsigned int checksum)
|
|||
in_sensitivityscale = 1;
|
||||
csqcmapentitydataloaded = true;
|
||||
csqcprogs = InitProgs(&csqcprogparms);
|
||||
csqc_world.progs = csqcprogs;
|
||||
PR_Configure(csqcprogs, -1, 16);
|
||||
csqc_world.worldmodel = cl.worldmodel;
|
||||
csqc_world.Event_Touch = CSQC_Event_Touch;
|
||||
|
@ -5548,18 +5497,22 @@ qboolean CSQC_Init (unsigned int checksum)
|
|||
|
||||
CSQC_FindGlobals();
|
||||
|
||||
csqc_world.physicstime = 0;
|
||||
|
||||
csqc_fakereadbyte = -1;
|
||||
memset(csqcent, 0, sizeof(*csqcent)*maxcsqcentities); //clear the server->csqc entity translations.
|
||||
|
||||
csqcentsize = PR_InitEnts(csqcprogs, pr_csmaxedicts.value);
|
||||
|
||||
ED_Alloc(csqcprogs); //we need a word entity.
|
||||
ED_Alloc(csqcprogs); //we need a world entity.
|
||||
//world edict becomes readonly
|
||||
worldent = (csqcedict_t *)EDICT_NUM(csqcprogs, 0);
|
||||
|
||||
worldent->readonly = true;
|
||||
worldent->isfree = false;
|
||||
worldent->v->model = PR_SetString(csqcprogs, cl.model_name[1]);
|
||||
worldent->v->modelindex = 1;
|
||||
worldent->v->model = PR_SetString(csqcprogs, cl.model_name[(int)worldent->v->modelindex]);
|
||||
worldent->v->solid = SOLID_BSP;
|
||||
|
||||
str = (string_t*)csqcprogs->GetEdictFieldValue(csqcprogs, (edict_t*)worldent, "message", NULL);
|
||||
if (str)
|
||||
|
@ -5598,6 +5551,12 @@ void CSQC_WorldLoaded(void)
|
|||
return;
|
||||
csqcmapentitydataloaded = true;
|
||||
csqcmapentitydata = cl.worldmodel->entities;
|
||||
|
||||
csqc_world.worldmodel = cl.worldmodel;
|
||||
#ifdef USEODE
|
||||
World_Physics_Start(&csqc_world);
|
||||
#endif
|
||||
|
||||
if (csqcg.worldloaded)
|
||||
PR_ExecuteProgram(csqcprogs, csqcg.worldloaded);
|
||||
csqcmapentitydata = NULL;
|
||||
|
@ -5748,13 +5707,39 @@ void CSQC_RegisterCvarsAndThings(void)
|
|||
|
||||
qboolean CSQC_DrawView(void)
|
||||
{
|
||||
#ifdef USEODE
|
||||
int ticlimit = 10;
|
||||
float ft;
|
||||
float mintic = 0.01;
|
||||
#endif
|
||||
|
||||
if (!csqcg.draw_function || !csqcprogs || !cl.worldmodel)
|
||||
return false;
|
||||
|
||||
r_secondaryview = 0;
|
||||
|
||||
CL_CalcClientTime();
|
||||
|
||||
#ifdef USEODE
|
||||
while(1)
|
||||
{
|
||||
ft = cl.servertime - csqc_world.physicstime;
|
||||
if (ft < mintic)
|
||||
break;
|
||||
if (!--ticlimit)
|
||||
{
|
||||
csqc_world.physicstime = cl.servertime;
|
||||
break;
|
||||
}
|
||||
if (ft > mintic)
|
||||
ft = mintic;
|
||||
csqc_world.physicstime += ft;
|
||||
|
||||
World_Physics_Frame(&csqc_world, ft, 800);
|
||||
}
|
||||
#else
|
||||
csqc_world.physicstime = cl.servertime;
|
||||
#endif
|
||||
|
||||
DropPunchAngle (0);
|
||||
if (cl.worldmodel)
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -238,7 +238,7 @@ void P_EmitEffect (vec3_t pos, int type, trailstate_t **tsk)
|
|||
if (cl.paused)
|
||||
return;
|
||||
|
||||
pe->RunParticleEffectState(pos, NULL, host_frametime, type, tsk);
|
||||
pe->RunParticleEffectState(pos, NULL, ((host_frametime>0.1)?0.1:host_frametime), type, tsk);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -190,6 +190,7 @@ void Surf_LessenStains(void);
|
|||
void Surf_WipeStains(void);
|
||||
void Surf_DeInit(void);
|
||||
void Surf_BuildLightmaps(void);
|
||||
void Surf_BuildSurfaceDisplayList (struct model_s *mod, struct msurface_s *fa);
|
||||
void Surf_RenderDynamicLightmaps (struct msurface_s *fa, int shift);
|
||||
int Surf_LightmapShift (struct model_s *model);
|
||||
#ifndef LMBLOCK_WIDTH
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
|
||||
void RQ_AddDistReorder(void (*render) (int count, void **objects, void *objtype), void *object, void *objtype, float *pos);
|
||||
|
||||
void RQ_RenderDistAndClear(void);
|
||||
FTE_DEPRECATED void RQ_RenderDistAndClear(void);
|
||||
void RQ_RenderBatchClear(void);
|
||||
|
||||
typedef struct renderque_s
|
||||
|
|
|
@ -123,6 +123,8 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|||
|
||||
#define PSET_CLASSIC
|
||||
|
||||
#define CSQC_DAT //support for csqc
|
||||
|
||||
#ifndef SERVERONLY //don't be stupid, stupid.
|
||||
#ifndef CLIENTONLY
|
||||
#define CLIENTONLY
|
||||
|
|
|
@ -1540,7 +1540,7 @@ static void World_Physics_Frame_JointFromEntity(world_t *world, wedict_t *ed)
|
|||
//Con_Printf("made new joint %i\n", (int) (ed - prog->edicts));
|
||||
dJointSetData(j, (void *) ed);
|
||||
if(enemy)
|
||||
b1 = (dBodyID)(EDICT_NUM(world->progs, enemy)->ode.ode_body);
|
||||
b1 = (dBodyID)(((wedict_t*)EDICT_NUM(world->progs, enemy))->ode.ode_body);
|
||||
if(aiment)
|
||||
b2 = (dBodyID)world->edicts[aiment].ode.ode_body;
|
||||
dJointAttach(j, b1, b2);
|
||||
|
|
|
@ -352,7 +352,6 @@ void PF_logfrag (progfuncs_t *prinst, struct globalvars_s *pr_globals);
|
|||
void PF_centerprint (progfuncs_t *prinst, struct globalvars_s *pr_globals);
|
||||
void PF_ExecuteCommand (progfuncs_t *prinst, struct globalvars_s *pr_globals);
|
||||
void PF_setspawnparms (progfuncs_t *prinst, struct globalvars_s *pr_globals);
|
||||
void PF_walkmove (progfuncs_t *prinst, struct globalvars_s *pr_globals);
|
||||
void PF_ForceInfoKey(progfuncs_t *prinst, struct globalvars_s *pr_globals);
|
||||
void PF_precache_vwep_model(progfuncs_t *prinst, struct globalvars_s *pr_globals);
|
||||
int PF_checkclient_Internal (progfuncs_t *prinst);
|
||||
|
@ -365,6 +364,8 @@ void PF_WriteString_Internal (int target, char *str);
|
|||
pbool ED_CanFree (edict_t *ed);
|
||||
#endif
|
||||
|
||||
#define MOVETYPE_NONE 0 // never moves
|
||||
#define MOVETYPE_PHYSICS 32
|
||||
|
||||
// edict->solid values
|
||||
#define SOLID_NOT 0 // no interaction with other objects
|
||||
|
@ -375,6 +376,17 @@ pbool ED_CanFree (edict_t *ed);
|
|||
#define SOLID_PHASEH2 5
|
||||
#define SOLID_CORPSE 5
|
||||
#define SOLID_LADDER 20 //dmw. touch on edge, not blocking. Touching players have different physics. Otherwise a SOLID_TRIGGER
|
||||
#define SOLID_PHYSICS_BOX 32 ///< physics object (mins, maxs, mass, origin, axis_forward, axis_left, axis_up, velocity, spinvelocity)
|
||||
#define SOLID_PHYSICS_SPHERE 33 ///< physics object (mins, maxs, mass, origin, axis_forward, axis_left, axis_up, velocity, spinvelocity)
|
||||
#define SOLID_PHYSICS_CAPSULE 34 ///< physics object (mins, maxs, mass, origin, axis_forward, axis_left, axis_up, velocity, spinvelocity)
|
||||
|
||||
|
||||
#define JOINTTYPE_POINT 1
|
||||
#define JOINTTYPE_HINGE 2
|
||||
#define JOINTTYPE_SLIDER 3
|
||||
#define JOINTTYPE_UNIVERSAL 4
|
||||
#define JOINTTYPE_HINGE2 5
|
||||
#define JOINTTYPE_FIXED -1
|
||||
|
||||
#define DAMAGE_NO 0
|
||||
#define DAMAGE_YES 1
|
||||
|
|
|
@ -105,6 +105,8 @@ typedef struct areanode_s
|
|||
|
||||
#define AREA_DEPTH 4
|
||||
#define AREA_NODES 32 //pow(2, AREA_DEPTH+1)
|
||||
#define EDICT_FROM_AREA(l) STRUCT_FROM_LINK(l,wedict_t,area)
|
||||
|
||||
typedef struct wedict_s wedict_t;
|
||||
|
||||
typedef struct
|
||||
|
@ -142,8 +144,6 @@ FTE_DEPRECATED unsigned int edict_size;
|
|||
};
|
||||
typedef struct world_s world_t;
|
||||
|
||||
#ifndef CLIENTONLY
|
||||
|
||||
#ifdef USEODE
|
||||
void World_Physics_RemoveFromEntity(world_t *world, wedict_t *ed);
|
||||
void World_Physics_RemoveJointFromEntity(world_t *world, wedict_t *ed);
|
||||
|
@ -207,4 +207,10 @@ qboolean Q2BSP_EdictInFatPVS(model_t *mod, wedict_t *ent, qbyte *pvs);
|
|||
void Q2BSP_FindTouchedLeafs(world_t *w, model_t *mod, wedict_t *ent, float *mins, float *maxs);
|
||||
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
||||
/*sv_move.c*/
|
||||
qboolean World_CheckBottom (world_t *world, wedict_t *ent);
|
||||
qboolean World_movestep (world_t *world, wedict_t *ent, vec3_t move, qboolean relink, qboolean noenemy, struct globalvars_s *set_trace);
|
||||
qboolean World_MoveToGoal (world_t *world, wedict_t *ent, float dist);
|
||||
|
||||
|
|
|
@ -1686,7 +1686,7 @@ void *Cache_Alloc (cache_user_t *c, int size, char *name)
|
|||
|
||||
if (c->data)
|
||||
Sys_Error ("Cache_Alloc: already allocated");
|
||||
|
||||
|
||||
if (size <= 0)
|
||||
Sys_Error ("Cache_Alloc: size %i", size);
|
||||
|
||||
|
|
|
@ -1190,6 +1190,7 @@ static void (D3D9_R_RenderView) (void)
|
|||
d3d9error(IDirect3DDevice9_Clear(pD3DDev9, 0, NULL, D3DCLEAR_ZBUFFER, D3DCOLOR_XRGB(0,0,0), 1, 0));
|
||||
Surf_DrawWorld();
|
||||
P_DrawParticles ();
|
||||
RQ_RenderBatchClear();
|
||||
}
|
||||
|
||||
void (D3D9_R_NewMap) (void);
|
||||
|
|
|
@ -3727,190 +3727,6 @@
|
|||
/>
|
||||
</FileConfiguration>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\server\sv_move.c"
|
||||
>
|
||||
<FileConfiguration
|
||||
Name="MinGLDebug|Win32"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
AdditionalIncludeDirectories=""
|
||||
PreprocessorDefinitions=""
|
||||
PrecompiledHeaderThrough="qwsvdef.h"
|
||||
/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="MinGLDebug|x64"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
AdditionalIncludeDirectories=""
|
||||
PreprocessorDefinitions=""
|
||||
PrecompiledHeaderThrough="qwsvdef.h"
|
||||
/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="D3DDebug|Win32"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
AdditionalIncludeDirectories=""
|
||||
PreprocessorDefinitions=""
|
||||
PrecompiledHeaderThrough="qwsvdef.h"
|
||||
/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="D3DDebug|x64"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
AdditionalIncludeDirectories=""
|
||||
PreprocessorDefinitions=""
|
||||
PrecompiledHeaderThrough="qwsvdef.h"
|
||||
/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="MinGLRelease|Win32"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
AdditionalIncludeDirectories=""
|
||||
PreprocessorDefinitions=""
|
||||
PrecompiledHeaderThrough="qwsvdef.h"
|
||||
/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="MinGLRelease|x64"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
AdditionalIncludeDirectories=""
|
||||
PreprocessorDefinitions=""
|
||||
PrecompiledHeaderThrough="qwsvdef.h"
|
||||
/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="GLDebug|Win32"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
AdditionalIncludeDirectories=""
|
||||
PreprocessorDefinitions=""
|
||||
PrecompiledHeaderThrough="qwsvdef.h"
|
||||
/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="GLDebug|x64"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
AdditionalIncludeDirectories=""
|
||||
PreprocessorDefinitions=""
|
||||
PrecompiledHeaderThrough="qwsvdef.h"
|
||||
/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="Release Dedicated Server|Win32"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
AdditionalIncludeDirectories=""
|
||||
PreprocessorDefinitions=""
|
||||
PrecompiledHeaderThrough="qwsvdef.h"
|
||||
/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="Release Dedicated Server|x64"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
AdditionalIncludeDirectories=""
|
||||
PreprocessorDefinitions=""
|
||||
PrecompiledHeaderThrough="qwsvdef.h"
|
||||
/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="MRelease|Win32"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
AdditionalIncludeDirectories=""
|
||||
PreprocessorDefinitions=""
|
||||
PrecompiledHeaderThrough="qwsvdef.h"
|
||||
/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="MRelease|x64"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
AdditionalIncludeDirectories=""
|
||||
PreprocessorDefinitions=""
|
||||
PrecompiledHeaderThrough="qwsvdef.h"
|
||||
/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="Debug Dedicated Server|Win32"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
AdditionalIncludeDirectories=""
|
||||
PreprocessorDefinitions=""
|
||||
PrecompiledHeaderThrough="qwsvdef.h"
|
||||
/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="Debug Dedicated Server|x64"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
AdditionalIncludeDirectories=""
|
||||
PreprocessorDefinitions=""
|
||||
PrecompiledHeaderThrough="qwsvdef.h"
|
||||
/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="MDebug|Win32"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
AdditionalIncludeDirectories=""
|
||||
PreprocessorDefinitions=""
|
||||
PrecompiledHeaderThrough="qwsvdef.h"
|
||||
/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="MDebug|x64"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
AdditionalIncludeDirectories=""
|
||||
PreprocessorDefinitions=""
|
||||
PrecompiledHeaderThrough="qwsvdef.h"
|
||||
/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="GLRelease|Win32"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
AdditionalIncludeDirectories=""
|
||||
PreprocessorDefinitions=""
|
||||
PrecompiledHeaderThrough="qwsvdef.h"
|
||||
/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="GLRelease|x64"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
AdditionalIncludeDirectories=""
|
||||
PreprocessorDefinitions=""
|
||||
PrecompiledHeaderThrough="qwsvdef.h"
|
||||
/>
|
||||
</FileConfiguration>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\server\sv_mvd.c"
|
||||
>
|
||||
|
@ -21418,6 +21234,190 @@
|
|||
/>
|
||||
</FileConfiguration>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\server\sv_move.c"
|
||||
>
|
||||
<FileConfiguration
|
||||
Name="MinGLDebug|Win32"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
AdditionalIncludeDirectories=""
|
||||
PreprocessorDefinitions=""
|
||||
PrecompiledHeaderThrough="quakedef.h"
|
||||
/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="MinGLDebug|x64"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
AdditionalIncludeDirectories=""
|
||||
PreprocessorDefinitions=""
|
||||
PrecompiledHeaderThrough="qwsvdef.h"
|
||||
/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="D3DDebug|Win32"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
AdditionalIncludeDirectories=""
|
||||
PreprocessorDefinitions=""
|
||||
PrecompiledHeaderThrough="quakedef.h"
|
||||
/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="D3DDebug|x64"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
AdditionalIncludeDirectories=""
|
||||
PreprocessorDefinitions=""
|
||||
PrecompiledHeaderThrough="qwsvdef.h"
|
||||
/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="MinGLRelease|Win32"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
AdditionalIncludeDirectories=""
|
||||
PreprocessorDefinitions=""
|
||||
PrecompiledHeaderThrough="quakedef.h"
|
||||
/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="MinGLRelease|x64"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
AdditionalIncludeDirectories=""
|
||||
PreprocessorDefinitions=""
|
||||
PrecompiledHeaderThrough="qwsvdef.h"
|
||||
/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="GLDebug|Win32"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
AdditionalIncludeDirectories=""
|
||||
PreprocessorDefinitions=""
|
||||
PrecompiledHeaderThrough="quakedef.h"
|
||||
/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="GLDebug|x64"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
AdditionalIncludeDirectories=""
|
||||
PreprocessorDefinitions=""
|
||||
PrecompiledHeaderThrough="qwsvdef.h"
|
||||
/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="Release Dedicated Server|Win32"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
AdditionalIncludeDirectories=""
|
||||
PreprocessorDefinitions=""
|
||||
PrecompiledHeaderThrough="quakedef.h"
|
||||
/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="Release Dedicated Server|x64"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
AdditionalIncludeDirectories=""
|
||||
PreprocessorDefinitions=""
|
||||
PrecompiledHeaderThrough="qwsvdef.h"
|
||||
/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="MRelease|Win32"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
AdditionalIncludeDirectories=""
|
||||
PreprocessorDefinitions=""
|
||||
PrecompiledHeaderThrough="quakedef.h"
|
||||
/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="MRelease|x64"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
AdditionalIncludeDirectories=""
|
||||
PreprocessorDefinitions=""
|
||||
PrecompiledHeaderThrough="qwsvdef.h"
|
||||
/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="Debug Dedicated Server|Win32"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
AdditionalIncludeDirectories=""
|
||||
PreprocessorDefinitions=""
|
||||
PrecompiledHeaderThrough="quakedef.h"
|
||||
/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="Debug Dedicated Server|x64"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
AdditionalIncludeDirectories=""
|
||||
PreprocessorDefinitions=""
|
||||
PrecompiledHeaderThrough="qwsvdef.h"
|
||||
/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="MDebug|Win32"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
AdditionalIncludeDirectories=""
|
||||
PreprocessorDefinitions=""
|
||||
PrecompiledHeaderThrough="quakedef.h"
|
||||
/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="MDebug|x64"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
AdditionalIncludeDirectories=""
|
||||
PreprocessorDefinitions=""
|
||||
PrecompiledHeaderThrough="qwsvdef.h"
|
||||
/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="GLRelease|Win32"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
AdditionalIncludeDirectories=""
|
||||
PreprocessorDefinitions=""
|
||||
PrecompiledHeaderThrough="quakedef.h"
|
||||
/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="GLRelease|x64"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
AdditionalIncludeDirectories=""
|
||||
PreprocessorDefinitions=""
|
||||
PrecompiledHeaderThrough="qwsvdef.h"
|
||||
/>
|
||||
</FileConfiguration>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\common\translate.c"
|
||||
>
|
||||
|
|
|
@ -1156,7 +1156,6 @@ void R_DrawGAliasModel (entity_t *e, unsigned int rmode)
|
|||
BE_SelectMode(rmode, 0);
|
||||
}
|
||||
|
||||
#if defined(RTLIGHTS) && defined(GLQUAKE)
|
||||
//returns result in the form of the result vector
|
||||
void RotateLightVector(const vec3_t *axis, const vec3_t origin, const vec3_t lightpoint, vec3_t result)
|
||||
{
|
||||
|
@ -1171,6 +1170,7 @@ void RotateLightVector(const vec3_t *axis, const vec3_t origin, const vec3_t lig
|
|||
result[2] = DotProduct (offs, axis[2]);
|
||||
}
|
||||
|
||||
#if defined(RTLIGHTS) && defined(GLQUAKE)
|
||||
void GL_LightMesh (mesh_t *mesh, vec3_t lightpos, vec3_t colours, float radius)
|
||||
{
|
||||
vec3_t dir;
|
||||
|
|
|
@ -1901,14 +1901,6 @@ static void DrawPass(const shaderpass_t *pass, const mesh_t *meshlist)
|
|||
|
||||
checkerror();
|
||||
}
|
||||
#if 0
|
||||
void Matrix4_TransformN3(float *matrix, float *_vector, float *product)
|
||||
{
|
||||
product[0] = -matrix[12] - matrix[0]*_vector[0] - matrix[4]*_vector[1] - matrix[8]*_vector[2];
|
||||
product[1] = -matrix[13] - matrix[1]*_vector[0] - matrix[5]*_vector[1] - matrix[9]*_vector[2];
|
||||
product[2] = -matrix[14] - matrix[2]*_vector[0] - matrix[6]*_vector[1] - matrix[10]*_vector[2];
|
||||
}
|
||||
#endif
|
||||
|
||||
static void BE_RenderMeshProgram(const shader_t *shader, const shaderpass_t *pass, const mesh_t *meshlist)
|
||||
{
|
||||
|
@ -2497,8 +2489,10 @@ static void BaseBrushTextures(entity_t *ent)
|
|||
msurface_t *s, *chain;
|
||||
model_t *model;
|
||||
|
||||
#ifdef RTLIGHTS
|
||||
if (BE_LightCullModel(ent->origin, ent->model))
|
||||
return;
|
||||
#endif
|
||||
|
||||
qglPushMatrix();
|
||||
R_RotateForEntity(ent);
|
||||
|
|
|
@ -1224,6 +1224,7 @@ void R_RenderScene (void)
|
|||
TRACE(("dbg: calling R_DrawParticles\n"));
|
||||
P_DrawParticles ();
|
||||
}
|
||||
RQ_RenderBatchClear();
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -1762,6 +1762,9 @@ static void Sh_DrawBrushModelShadow(dlight_t *dl, entity_t *e)
|
|||
continue;
|
||||
}
|
||||
|
||||
if (!surf->mesh)
|
||||
continue;
|
||||
|
||||
//front face
|
||||
qglVertexPointer(3, GL_FLOAT, sizeof(vecV_t), surf->mesh->xyz_array);
|
||||
qglDrawArrays(GL_POLYGON, 0, surf->mesh->numvertexes);
|
||||
|
|
|
@ -473,6 +473,7 @@ GLhandleARB GLSlang_CreateShader (char *precompilerconstants, char *shadersource
|
|||
GLhandleARB shader;
|
||||
GLint compiled;
|
||||
char str[1024];
|
||||
int loglen;
|
||||
|
||||
char *prstrings[3];
|
||||
if (!precompilerconstants)
|
||||
|
@ -500,6 +501,7 @@ GLhandleARB GLSlang_CreateShader (char *precompilerconstants, char *shadersource
|
|||
qglGetObjectParameterivARB(shader, GL_OBJECT_COMPILE_STATUS_ARB, &compiled);
|
||||
if(!compiled)
|
||||
{
|
||||
Con_DPrintf("Shader source:\n%s%s%s\n", prstrings[0], prstrings[1], prstrings[2]);
|
||||
qglGetInfoLogARB(shader, sizeof(str), NULL, str);
|
||||
qglDeleteObjectARB(shader);
|
||||
switch (shadertype)
|
||||
|
@ -517,6 +519,20 @@ GLhandleARB GLSlang_CreateShader (char *precompilerconstants, char *shadersource
|
|||
return 0;
|
||||
}
|
||||
|
||||
if (developer.ival)
|
||||
{
|
||||
qglGetObjectParameterivARB(shader, GL_OBJECT_INFO_LOG_LENGTH_ARB, &loglen);
|
||||
if (loglen)
|
||||
{
|
||||
qglGetInfoLogARB(shader, sizeof(str), NULL, str);
|
||||
if (strstr(str, "WARNING"))
|
||||
{
|
||||
Con_Printf("Shader source:\n%s%s%s\n", prstrings[0], prstrings[1], prstrings[2]);
|
||||
Con_Printf("%s\n", str);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return shader;
|
||||
}
|
||||
|
||||
|
|
|
@ -98,6 +98,9 @@ int PR_InitEnts(progfuncs_t *progfuncs, int max_ents)
|
|||
QC_ClearEdict(progfuncs, sv_edicts);
|
||||
sv_num_edicts = 1;
|
||||
|
||||
if (externs->entspawn)
|
||||
externs->entspawn((struct edict_s *)sv_edicts, false);
|
||||
|
||||
return max_fields_size;
|
||||
}
|
||||
edictrun_t tempedict; //used as a safty buffer
|
||||
|
|
|
@ -3468,6 +3468,15 @@ void PF_svcoredump (progfuncs_t *prinst, struct globalvars_s *pr_globals)
|
|||
BZ_Free(buffer);
|
||||
}
|
||||
|
||||
static void PF_sv_movetogoal (progfuncs_t *prinst, struct globalvars_s *pr_globals)
|
||||
{
|
||||
wedict_t *ent;
|
||||
float dist;
|
||||
ent = (wedict_t*)PROG_TO_EDICT(prinst, pr_global_struct->self);
|
||||
dist = G_FLOAT(OFS_PARM0);
|
||||
World_MoveToGoal (&sv.world, ent, dist);
|
||||
}
|
||||
|
||||
/*
|
||||
===============
|
||||
PF_walkmove
|
||||
|
@ -3475,7 +3484,7 @@ PF_walkmove
|
|||
float(float yaw, float dist) walkmove
|
||||
===============
|
||||
*/
|
||||
void PF_walkmove (progfuncs_t *prinst, struct globalvars_s *pr_globals)
|
||||
static void PF_walkmove (progfuncs_t *prinst, struct globalvars_s *pr_globals)
|
||||
{
|
||||
edict_t *ent;
|
||||
float yaw, dist;
|
||||
|
@ -3514,7 +3523,7 @@ void PF_walkmove (progfuncs_t *prinst, struct globalvars_s *pr_globals)
|
|||
// }
|
||||
// else if (!SV_TestEntityPosition(ent))
|
||||
// {
|
||||
G_FLOAT(OFS_RETURN) = SV_movestep(ent, move, true, false, settrace);
|
||||
G_FLOAT(OFS_RETURN) = World_movestep(&sv.world, (wedict_t*)ent, move, true, false, settrace);
|
||||
// if (SV_TestEntityPosition(ent))
|
||||
// Con_Printf("Entity became stuck\n");
|
||||
// }
|
||||
|
@ -3703,13 +3712,13 @@ void PF_lightstylestatic (progfuncs_t *prinst, struct globalvars_s *pr_globals)
|
|||
PF_checkbottom
|
||||
=============
|
||||
*/
|
||||
void PF_checkbottom (progfuncs_t *prinst, struct globalvars_s *pr_globals)
|
||||
static void PF_checkbottom (progfuncs_t *prinst, struct globalvars_s *pr_globals)
|
||||
{
|
||||
edict_t *ent;
|
||||
|
||||
ent = G_EDICT(prinst, OFS_PARM0);
|
||||
|
||||
G_FLOAT(OFS_RETURN) = SV_CheckBottom (ent);
|
||||
G_FLOAT(OFS_RETURN) = World_CheckBottom (&sv.world, (wedict_t*)ent);
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -6998,7 +7007,7 @@ void PF_plaque_draw(progfuncs_t *prinst, struct globalvars_s *pr_globals)
|
|||
}
|
||||
}
|
||||
|
||||
void PF_movestep (progfuncs_t *prinst, struct globalvars_s *pr_globals)
|
||||
static void PF_movestep (progfuncs_t *prinst, struct globalvars_s *pr_globals)
|
||||
{
|
||||
vec3_t v;
|
||||
edict_t *ent;
|
||||
|
@ -7015,7 +7024,7 @@ void PF_movestep (progfuncs_t *prinst, struct globalvars_s *pr_globals)
|
|||
// save program state, because SV_movestep may call other progs
|
||||
oldself = pr_global_struct->self;
|
||||
|
||||
G_INT(OFS_RETURN) = SV_movestep (ent, v, false, true, set_trace?pr_globals:NULL);
|
||||
G_INT(OFS_RETURN) = World_movestep (&sv.world, (wedict_t*)ent, v, false, true, set_trace?pr_globals:NULL);
|
||||
|
||||
// restore program state
|
||||
pr_global_struct->self = oldself;
|
||||
|
@ -9069,7 +9078,7 @@ BuiltinList_t BuiltinList[] = { //nq qw h2 ebfs
|
|||
{"tracetoss", PF_TraceToss, 0, 0, 0, 64},
|
||||
{"etos", PF_etos, 0, 0, 0, 65},
|
||||
|
||||
{"movetogoal", SV_MoveToGoal, 67, 67, 67}, //67
|
||||
{"movetogoal", PF_sv_movetogoal, 67, 67, 67}, //67
|
||||
{"precache_file", PF_precache_file, 68, 68, 68}, //68
|
||||
{"makestatic", PF_makestatic, 69, 69, 69}, //69
|
||||
|
||||
|
|
|
@ -731,7 +731,7 @@ static qintptr_t syscallhandle (void *offset, quintptr_t mask, qintptr_t fn, con
|
|||
move[1] = sin(yaw)*dist;
|
||||
move[2] = 0;
|
||||
|
||||
return SV_movestep(ed, move, true, false, NULL);
|
||||
return World_movestep(&sv.world, (wedict_t*)ed, move, true, false, NULL);
|
||||
}
|
||||
|
||||
case G_DROPTOFLOOR:
|
||||
|
@ -767,7 +767,7 @@ static qintptr_t syscallhandle (void *offset, quintptr_t mask, qintptr_t fn, con
|
|||
break;
|
||||
|
||||
case G_CHECKBOTTOM:
|
||||
return SV_CheckBottom(EDICT_NUM(svprogfuncs, VM_LONG(arg[0])));
|
||||
return World_CheckBottom(&sv.world, (wedict_t*)EDICT_NUM(svprogfuncs, VM_LONG(arg[0])));
|
||||
|
||||
case G_POINTCONTENTS:
|
||||
{
|
||||
|
@ -1141,7 +1141,7 @@ Con_DPrintf("PF_readcmd: %s\n%s", s, output);
|
|||
//fallthrough
|
||||
|
||||
case G_MOVETOGOAL:
|
||||
return !!WrapQCBuiltin(SV_MoveToGoal, offset, mask, arg, "f");
|
||||
return World_MoveToGoal(&sv.world, (wedict_t*)Q1QVMPF_ProgsToEdict(svprogfuncs, pr_global_struct->self), VM_FLOAT(arg[0]));
|
||||
|
||||
case G_SetBotUserInfo:
|
||||
WrapQCBuiltin(PF_ForceInfoKey, offset, mask, arg, "ess");
|
||||
|
@ -1317,7 +1317,11 @@ qboolean PR_LoadQ1QVM(void)
|
|||
|
||||
q1qvm = VM_Create(NULL, "qwprogs", syscallnative, syscallqvm);
|
||||
if (!q1qvm)
|
||||
{
|
||||
if (svprogfuncs == &q1qvmprogfuncs)
|
||||
sv.world.progs = svprogfuncs = NULL;
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
progstype = PROG_QW;
|
||||
|
@ -1578,8 +1582,12 @@ void Q1QVM_GameCodePausedTic(float pausedduration)
|
|||
|
||||
void Q1QVM_DropClient(client_t *cl)
|
||||
{
|
||||
if (cl->name)
|
||||
Q_strncpyz(cl->namebuf, cl->name, sizeof(cl->namebuf));
|
||||
|
||||
pr_global_struct->self = EDICT_TO_PROG(svprogfuncs, cl->edict);
|
||||
VM_Call(q1qvm, GAME_CLIENT_DISCONNECT);
|
||||
cl->name = cl->namebuf;
|
||||
}
|
||||
|
||||
void Q1QVM_ChainMoved(void)
|
||||
|
|
|
@ -172,7 +172,7 @@ and the extension fields are added on the end and can have extra vm-specific stu
|
|||
comfieldfloat(ideal_yaw,ideal_yaw,ideal_yaw);\
|
||||
comfieldfloat(yaw_speed,yaw_speed,yaw_speed);\
|
||||
comfieldentity(aiment,aiment,aiment);\
|
||||
comfieldentity(goalentity,_goalentity,_goalentity);\
|
||||
comfieldentity(goalentity,goalentity,goalentity);\
|
||||
comfieldfloat(_spawnflags,_spawnflags,_spawnflags);\
|
||||
comfieldstring(_target,_target,_target);\
|
||||
comfieldstring(targetname,_targetname,_targetname);\
|
||||
|
@ -300,9 +300,12 @@ comqcfields
|
|||
#undef comfieldentity
|
||||
#undef comfieldstring
|
||||
#undef comfieldfunction
|
||||
} comentvars_t;
|
||||
|
||||
#ifdef VM_Q1
|
||||
} comentvars_t;
|
||||
typedef struct {
|
||||
#endif
|
||||
|
||||
#define comfieldfloat(name) float name
|
||||
#define comfieldvector(name) vec3_t name
|
||||
#define comfieldentity(name) int name
|
||||
|
@ -314,7 +317,67 @@ comextqcfields
|
|||
#undef comfieldentity
|
||||
#undef comfieldstring
|
||||
#undef comfieldfunction
|
||||
} comextentvars_t;
|
||||
|
||||
#ifdef VM_Q1
|
||||
} comextentvars_t;
|
||||
#else
|
||||
} comentvars_t;
|
||||
#endif
|
||||
|
||||
#define MAX_ENT_LEAFS 16
|
||||
|
||||
|
||||
|
||||
#if defined(ODE_STATIC) || defined(ODE_DYNAMIC)
|
||||
#define USEODE 1
|
||||
#endif
|
||||
|
||||
#ifdef USEODE
|
||||
typedef struct {
|
||||
// physics parameters
|
||||
qboolean ode_physics;
|
||||
void *ode_body;
|
||||
void *ode_geom;
|
||||
void *ode_joint;
|
||||
float *ode_vertex3f;
|
||||
int *ode_element3i;
|
||||
int ode_numvertices;
|
||||
int ode_numtriangles;
|
||||
vec3_t ode_mins;
|
||||
vec3_t ode_maxs;
|
||||
vec_t ode_mass;
|
||||
vec3_t ode_origin;
|
||||
vec3_t ode_velocity;
|
||||
vec3_t ode_angles;
|
||||
vec3_t ode_avelocity;
|
||||
qboolean ode_gravity;
|
||||
int ode_modelindex;
|
||||
vec_t ode_movelimit; // smallest component of (maxs[]-mins[])
|
||||
float ode_offsetmatrix[16];
|
||||
float ode_offsetimatrix[16];
|
||||
int ode_joint_type;
|
||||
int ode_joint_enemy;
|
||||
int ode_joint_aiment;
|
||||
vec3_t ode_joint_origin; // joint anchor
|
||||
vec3_t ode_joint_angles; // joint axis
|
||||
vec3_t ode_joint_velocity; // second joint axis
|
||||
vec3_t ode_joint_movedir; // parameters
|
||||
void *ode_massbuf;
|
||||
} entityode_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
// for ODE physics engine
|
||||
qboolean ode; // if true then ode is activated
|
||||
void *ode_world;
|
||||
void *ode_space;
|
||||
void *ode_contactgroup;
|
||||
// number of constraint solver iterations to use (for dWorldStepFast)
|
||||
int ode_iterations;
|
||||
// actual step (server frametime / ode_iterations)
|
||||
vec_t ode_step;
|
||||
// max velocity for a 1-unit radius object at current step to prevent
|
||||
// missed collisions
|
||||
vec_t ode_movelimit;
|
||||
} worldode_t;
|
||||
#endif
|
||||
|
|
|
@ -60,60 +60,6 @@ extern progstype_t progstype;
|
|||
|
||||
//extern progsnum_t mainprogs;
|
||||
|
||||
#if defined(ODE_STATIC) || defined(ODE_DYNAMIC)
|
||||
#define USEODE 1
|
||||
#endif
|
||||
|
||||
#ifdef USEODE
|
||||
typedef struct {
|
||||
// physics parameters
|
||||
qboolean ode_physics;
|
||||
void *ode_body;
|
||||
void *ode_geom;
|
||||
void *ode_joint;
|
||||
float *ode_vertex3f;
|
||||
int *ode_element3i;
|
||||
int ode_numvertices;
|
||||
int ode_numtriangles;
|
||||
vec3_t ode_mins;
|
||||
vec3_t ode_maxs;
|
||||
vec_t ode_mass;
|
||||
vec3_t ode_origin;
|
||||
vec3_t ode_velocity;
|
||||
vec3_t ode_angles;
|
||||
vec3_t ode_avelocity;
|
||||
qboolean ode_gravity;
|
||||
int ode_modelindex;
|
||||
vec_t ode_movelimit; // smallest component of (maxs[]-mins[])
|
||||
float ode_offsetmatrix[16];
|
||||
float ode_offsetimatrix[16];
|
||||
int ode_joint_type;
|
||||
int ode_joint_enemy;
|
||||
int ode_joint_aiment;
|
||||
vec3_t ode_joint_origin; // joint anchor
|
||||
vec3_t ode_joint_angles; // joint axis
|
||||
vec3_t ode_joint_velocity; // second joint axis
|
||||
vec3_t ode_joint_movedir; // parameters
|
||||
void *ode_massbuf;
|
||||
} entityode_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
// for ODE physics engine
|
||||
qboolean ode; // if true then ode is activated
|
||||
void *ode_world;
|
||||
void *ode_space;
|
||||
void *ode_contactgroup;
|
||||
// number of constraint solver iterations to use (for dWorldStepFast)
|
||||
int ode_iterations;
|
||||
// actual step (server frametime / ode_iterations)
|
||||
vec_t ode_step;
|
||||
// max velocity for a 1-unit radius object at current step to prevent
|
||||
// missed collisions
|
||||
vec_t ode_movelimit;
|
||||
} worldode_t;
|
||||
#endif
|
||||
|
||||
typedef struct edict_s
|
||||
{
|
||||
//these 5 shared with qclib
|
||||
|
@ -167,7 +113,6 @@ extern progfuncs_t *svprogfuncs; //instance
|
|||
extern progparms_t svprogparms;
|
||||
extern progsnum_t svmainprogs;
|
||||
extern progsnum_t clmainprogs;
|
||||
#define EDICT_FROM_AREA(l) STRUCT_FROM_LINK(l,wedict_t,area)
|
||||
#define HLEDICT_FROM_AREA(l) STRUCT_FROM_LINK(l,hledict_t,area)
|
||||
#define Q2EDICT_FROM_AREA(l) STRUCT_FROM_LINK(l,q2edict_t,area)
|
||||
#define Q3EDICT_FROM_AREA(l) STRUCT_FROM_LINK(l,q3serverEntity_t,area)
|
||||
|
|
|
@ -796,17 +796,6 @@ typedef struct
|
|||
#define SOLID_PHASEH2 5
|
||||
#define SOLID_CORPSE 5
|
||||
#define SOLID_LADDER 20 //dmw. touch on edge, not blocking. Touching players have different physics. Otherwise a SOLID_TRIGGER
|
||||
#define SOLID_PHYSICS_BOX 32 ///< physics object (mins, maxs, mass, origin, axis_forward, axis_left, axis_up, velocity, spinvelocity)
|
||||
#define SOLID_PHYSICS_SPHERE 33 ///< physics object (mins, maxs, mass, origin, axis_forward, axis_left, axis_up, velocity, spinvelocity)
|
||||
#define SOLID_PHYSICS_CAPSULE 34 ///< physics object (mins, maxs, mass, origin, axis_forward, axis_left, axis_up, velocity, spinvelocity)
|
||||
|
||||
|
||||
#define JOINTTYPE_POINT 1
|
||||
#define JOINTTYPE_HINGE 2
|
||||
#define JOINTTYPE_SLIDER 3
|
||||
#define JOINTTYPE_UNIVERSAL 4
|
||||
#define JOINTTYPE_HINGE2 5
|
||||
#define JOINTTYPE_FIXED -1
|
||||
|
||||
#define DAMAGE_NO 0
|
||||
#define DAMAGE_YES 1
|
||||
|
@ -940,14 +929,9 @@ void SVNQ_FullClientUpdate (client_t *client, sizebuf_t *buf);
|
|||
|
||||
int SV_ModelIndex (char *name);
|
||||
|
||||
qboolean SV_CheckBottom (edict_t *ent);
|
||||
qboolean SV_movestep (edict_t *ent, vec3_t move, qboolean relink, qboolean noenemy, struct globalvars_s *set_trace);
|
||||
|
||||
void SV_WriteClientdataToMessage (client_t *client, sizebuf_t *msg);
|
||||
void SV_WriteDelta (entity_state_t *from, entity_state_t *to, sizebuf_t *msg, qboolean force, unsigned int protext);
|
||||
|
||||
void SV_MoveToGoal (progfuncs_t *prinst, struct globalvars_s *pr_globals);
|
||||
|
||||
void SV_SaveSpawnparms (qboolean);
|
||||
void SV_SaveLevelCache(qboolean dontharmgame);
|
||||
qboolean SV_LoadLevelCache(char *level, char *startspot, qboolean ignoreplayers);
|
||||
|
|
|
@ -2514,7 +2514,6 @@ void SV_Snapshot_BuildQ1(client_t *client, packet_entities_t *pack, qbyte *pvs,
|
|||
leafnum = sv.world.worldmodel->funcs.LeafnumForPoint (sv.world.worldmodel, ent->v->origin)-1;
|
||||
if ( !(mask[leafnum>>3] & (1<<(leafnum&7)) ) )
|
||||
{
|
||||
Con_Printf ("PHS supressed entity\n");
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1123,8 +1123,6 @@ void SV_SpawnServer (char *server, char *startspot, qboolean noents, qboolean us
|
|||
ent->v->solid = SOLID_BSP;
|
||||
ent->v->movetype = MOVETYPE_PUSH;
|
||||
|
||||
ED_Spawned(ent, false);
|
||||
|
||||
if (progstype == PROG_QW && pr_imitatemvdsv.value>0)
|
||||
{
|
||||
#ifdef VM_Q1
|
||||
|
|
|
@ -447,10 +447,6 @@ void SV_DropClient (client_t *drop)
|
|||
case GT_MAX:
|
||||
break;
|
||||
case GT_Q1QVM:
|
||||
#ifdef VM_Q1
|
||||
// FIXME: missing code here?
|
||||
#endif
|
||||
break;
|
||||
case GT_PROGS:
|
||||
if (svprogfuncs)
|
||||
{
|
||||
|
|
|
@ -19,9 +19,10 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|||
*/
|
||||
// sv_move.c -- monster movement
|
||||
|
||||
#include "qwsvdef.h"
|
||||
#include "quakedef.h"
|
||||
#include "pr_common.h"
|
||||
|
||||
#ifndef CLIENTONLY
|
||||
#if defined(CSQC_DAT) || !defined(CLIENTONLY)
|
||||
|
||||
/*
|
||||
=============
|
||||
|
@ -34,7 +35,7 @@ is not a staircase.
|
|||
*/
|
||||
int c_yes, c_no;
|
||||
|
||||
qboolean SV_CheckBottom (edict_t *ent)
|
||||
qboolean World_CheckBottom (world_t *world, wedict_t *ent)
|
||||
{
|
||||
int savedhull;
|
||||
vec3_t mins, maxs, start, stop;
|
||||
|
@ -54,7 +55,7 @@ qboolean SV_CheckBottom (edict_t *ent)
|
|||
{
|
||||
start[0] = x ? maxs[0] : mins[0];
|
||||
start[1] = y ? maxs[1] : mins[1];
|
||||
if (!(World_PointContents (&sv.world, start) & FTECONTENTS_SOLID))
|
||||
if (!(World_PointContents (world, start) & FTECONTENTS_SOLID))
|
||||
goto realcheck;
|
||||
}
|
||||
|
||||
|
@ -74,7 +75,7 @@ realcheck:
|
|||
stop[2] = start[2] - 2*movevars.stepheight;
|
||||
savedhull = ent->xv->hull;
|
||||
ent->xv->hull = 0;
|
||||
trace = World_Move (&sv.world, start, vec3_origin, vec3_origin, stop, true, (wedict_t*)ent);
|
||||
trace = World_Move (world, start, vec3_origin, vec3_origin, stop, true, ent);
|
||||
ent->xv->hull = savedhull;
|
||||
|
||||
if (trace.fraction == 1.0)
|
||||
|
@ -90,7 +91,7 @@ realcheck:
|
|||
|
||||
savedhull = ent->xv->hull;
|
||||
ent->xv->hull = 0;
|
||||
trace = World_Move (&sv.world, start, vec3_origin, vec3_origin, stop, true, (wedict_t*)ent);
|
||||
trace = World_Move (world, start, vec3_origin, vec3_origin, stop, true, ent);
|
||||
ent->xv->hull = savedhull;
|
||||
|
||||
if (trace.fraction != 1.0 && trace.endpos[2] > bottom)
|
||||
|
@ -106,6 +107,10 @@ realcheck:
|
|||
|
||||
void set_move_trace(trace_t *trace, struct globalvars_s *pr_globals)
|
||||
{
|
||||
#pragma message("set_move_trace: fixme")
|
||||
#ifdef CLIENTONLY
|
||||
Sys_Error("set_move_trace: not fixed\n");
|
||||
#else
|
||||
pr_global_struct->trace_allsolid = trace->allsolid;
|
||||
pr_global_struct->trace_startsolid = trace->startsolid;
|
||||
pr_global_struct->trace_fraction = trace->fraction;
|
||||
|
@ -118,6 +123,7 @@ void set_move_trace(trace_t *trace, struct globalvars_s *pr_globals)
|
|||
pr_global_struct->trace_ent = EDICT_TO_PROG(svprogfuncs, trace->ent);
|
||||
else
|
||||
pr_global_struct->trace_ent = EDICT_TO_PROG(svprogfuncs, sv.world.edicts);
|
||||
#endif
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -130,13 +136,13 @@ possible, no move is done, false is returned, and
|
|||
pr_global_struct->trace_normal is set to the normal of the blocking wall
|
||||
=============
|
||||
*/
|
||||
qboolean SV_movestep (edict_t *ent, vec3_t move, qboolean relink, qboolean noenemy, struct globalvars_s *set_trace)
|
||||
qboolean World_movestep (world_t *world, wedict_t *ent, vec3_t move, qboolean relink, qboolean noenemy, struct globalvars_s *set_trace)
|
||||
{
|
||||
float dz;
|
||||
vec3_t oldorg, neworg, end;
|
||||
trace_t trace;
|
||||
int i;
|
||||
edict_t *enemy = (edict_t*)sv.world.edicts;
|
||||
wedict_t *enemy = world->edicts;
|
||||
|
||||
// try the move
|
||||
VectorCopy (ent->v->origin, oldorg);
|
||||
|
@ -151,32 +157,32 @@ qboolean SV_movestep (edict_t *ent, vec3_t move, qboolean relink, qboolean noene
|
|||
VectorAdd (ent->v->origin, move, neworg);
|
||||
if (!noenemy)
|
||||
{
|
||||
enemy = PROG_TO_EDICT(svprogfuncs, ent->v->enemy);
|
||||
if (i == 0 && enemy != (edict_t*)sv.world.edicts)
|
||||
enemy = (wedict_t*)PROG_TO_EDICT(world->progs, ent->v->enemy);
|
||||
if (i == 0 && enemy->entnum)
|
||||
{
|
||||
dz = ent->v->origin[2] - PROG_TO_EDICT(svprogfuncs, ent->v->enemy)->v->origin[2];
|
||||
dz = ent->v->origin[2] - ((wedict_t*)PROG_TO_EDICT(world->progs, ent->v->enemy))->v->origin[2];
|
||||
if (dz > 40)
|
||||
neworg[2] -= 8;
|
||||
if (dz < 30)
|
||||
neworg[2] += 8;
|
||||
}
|
||||
}
|
||||
trace = World_Move (&sv.world, ent->v->origin, ent->v->mins, ent->v->maxs, neworg, false, (wedict_t*)ent);
|
||||
trace = World_Move (world, ent->v->origin, ent->v->mins, ent->v->maxs, neworg, false, ent);
|
||||
if (set_trace)
|
||||
set_move_trace(&trace, set_trace);
|
||||
|
||||
if (trace.fraction == 1)
|
||||
{
|
||||
if ( ((int)ent->v->flags & FL_SWIM) && !(World_PointContents(&sv.world, trace.endpos) & FTECONTENTS_FLUID))
|
||||
if ( ((int)ent->v->flags & FL_SWIM) && !(World_PointContents(world, trace.endpos) & FTECONTENTS_FLUID))
|
||||
return false; // swim monster left water
|
||||
|
||||
VectorCopy (trace.endpos, ent->v->origin);
|
||||
if (relink)
|
||||
World_LinkEdict (&sv.world, (wedict_t*)ent, true);
|
||||
World_LinkEdict (world, ent, true);
|
||||
return true;
|
||||
}
|
||||
|
||||
if (noenemy || enemy == (edict_t*)sv.world.edicts)
|
||||
if (noenemy || !enemy->entnum)
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -188,7 +194,7 @@ qboolean SV_movestep (edict_t *ent, vec3_t move, qboolean relink, qboolean noene
|
|||
VectorCopy (neworg, end);
|
||||
end[2] -= movevars.stepheight*2;
|
||||
|
||||
trace = World_Move (&sv.world, neworg, ent->v->mins, ent->v->maxs, end, false, (wedict_t*)ent);
|
||||
trace = World_Move (world, neworg, ent->v->mins, ent->v->maxs, end, false, ent);
|
||||
if (set_trace)
|
||||
set_move_trace(&trace, set_trace);
|
||||
|
||||
|
@ -198,7 +204,7 @@ qboolean SV_movestep (edict_t *ent, vec3_t move, qboolean relink, qboolean noene
|
|||
if (trace.startsolid)
|
||||
{
|
||||
neworg[2] -= movevars.stepheight;
|
||||
trace = World_Move (&sv.world, neworg, ent->v->mins, ent->v->maxs, end, false, (wedict_t*)ent);
|
||||
trace = World_Move (world, neworg, ent->v->mins, ent->v->maxs, end, false, ent);
|
||||
if (set_trace)
|
||||
set_move_trace(&trace, set_trace);
|
||||
if (trace.allsolid || trace.startsolid)
|
||||
|
@ -211,7 +217,7 @@ qboolean SV_movestep (edict_t *ent, vec3_t move, qboolean relink, qboolean noene
|
|||
{
|
||||
VectorAdd (ent->v->origin, move, ent->v->origin);
|
||||
if (relink)
|
||||
World_LinkEdict (&sv.world, (wedict_t*)ent, true);
|
||||
World_LinkEdict (world, ent, true);
|
||||
ent->v->flags = (int)ent->v->flags & ~FL_ONGROUND;
|
||||
// Con_Printf ("fall down\n");
|
||||
return true;
|
||||
|
@ -223,13 +229,13 @@ qboolean SV_movestep (edict_t *ent, vec3_t move, qboolean relink, qboolean noene
|
|||
// check point traces down for dangling corners
|
||||
VectorCopy (trace.endpos, ent->v->origin);
|
||||
|
||||
if (!SV_CheckBottom (ent))
|
||||
if (!World_CheckBottom (world, ent))
|
||||
{
|
||||
if ( (int)ent->v->flags & FL_PARTIALGROUND )
|
||||
{ // entity had floor mostly pulled out from underneath it
|
||||
// and is trying to correct
|
||||
if (relink)
|
||||
World_LinkEdict (&sv.world, (wedict_t*)ent, true);
|
||||
World_LinkEdict (world, ent, true);
|
||||
return true;
|
||||
}
|
||||
VectorCopy (oldorg, ent->v->origin);
|
||||
|
@ -241,17 +247,59 @@ qboolean SV_movestep (edict_t *ent, vec3_t move, qboolean relink, qboolean noene
|
|||
// Con_Printf ("back on ground\n");
|
||||
ent->v->flags = (int)ent->v->flags & ~FL_PARTIALGROUND;
|
||||
}
|
||||
ent->v->groundentity = EDICT_TO_PROG(svprogfuncs, trace.ent);
|
||||
ent->v->groundentity = EDICT_TO_PROG(world->progs, trace.ent);
|
||||
|
||||
// the move is ok
|
||||
if (relink)
|
||||
World_LinkEdict (&sv.world, (wedict_t*)ent, true);
|
||||
World_LinkEdict (world, ent, true);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
//============================================================================
|
||||
|
||||
/*
|
||||
==============
|
||||
PF_changeyaw
|
||||
|
||||
This was a major timewaster in progs, so it was converted to C
|
||||
==============
|
||||
*/
|
||||
void World_changeyaw (wedict_t *ent)
|
||||
{
|
||||
float ideal, current, move, speed;
|
||||
|
||||
current = anglemod( ent->v->angles[1] );
|
||||
ideal = ent->v->ideal_yaw;
|
||||
speed = ent->v->yaw_speed;
|
||||
|
||||
if (current == ideal)
|
||||
return;
|
||||
move = ideal - current;
|
||||
if (ideal > current)
|
||||
{
|
||||
if (move >= 180)
|
||||
move = move - 360;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (move <= -180)
|
||||
move = move + 360;
|
||||
}
|
||||
if (move > 0)
|
||||
{
|
||||
if (move > speed)
|
||||
move = speed;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (move < -speed)
|
||||
move = -speed;
|
||||
}
|
||||
|
||||
ent->v->angles[1] = anglemod (current + move);
|
||||
}
|
||||
|
||||
/*
|
||||
======================
|
||||
SV_StepDirection
|
||||
|
@ -261,15 +309,14 @@ facing it.
|
|||
|
||||
======================
|
||||
*/
|
||||
void PF_changeyaw (progfuncs_t *prinst, struct globalvars_s *pr_globals);
|
||||
qboolean SV_StepDirection (edict_t *ent, float yaw, float dist, struct globalvars_s *pr_globals)
|
||||
qboolean World_StepDirection (world_t *world, wedict_t *ent, float yaw, float dist)
|
||||
{
|
||||
vec3_t move, oldorigin;
|
||||
float delta;
|
||||
|
||||
ent->v->ideal_yaw = yaw;
|
||||
|
||||
PF_changeyaw(svprogfuncs, pr_globals);
|
||||
World_changeyaw(ent);
|
||||
|
||||
yaw = yaw*M_PI*2 / 360;
|
||||
move[0] = cos(yaw)*dist;
|
||||
|
@ -277,17 +324,17 @@ qboolean SV_StepDirection (edict_t *ent, float yaw, float dist, struct globalvar
|
|||
move[2] = 0;
|
||||
|
||||
VectorCopy (ent->v->origin, oldorigin);
|
||||
if (SV_movestep (ent, move, false, false, NULL))
|
||||
if (World_movestep (world, ent, move, false, false, NULL))
|
||||
{
|
||||
delta = ent->v->angles[YAW] - ent->v->ideal_yaw;
|
||||
if (delta > 45 && delta < 315)
|
||||
{ // not turned far enough, so don't take the step
|
||||
VectorCopy (oldorigin, ent->v->origin);
|
||||
}
|
||||
World_LinkEdict (&sv.world, (wedict_t*)ent, true);
|
||||
World_LinkEdict (world, ent, true);
|
||||
return true;
|
||||
}
|
||||
World_LinkEdict (&sv.world, (wedict_t*)ent, true);
|
||||
World_LinkEdict (world, ent, true);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
@ -298,7 +345,7 @@ SV_FixCheckBottom
|
|||
|
||||
======================
|
||||
*/
|
||||
void SV_FixCheckBottom (edict_t *ent)
|
||||
void World_FixCheckBottom (wedict_t *ent)
|
||||
{
|
||||
// Con_Printf ("SV_FixCheckBottom\n");
|
||||
|
||||
|
@ -315,7 +362,7 @@ SV_NewChaseDir
|
|||
*/
|
||||
#define DI_NODIR -1
|
||||
|
||||
void SV_NewChaseDir (edict_t *actor, edict_t *enemy, float dist, struct globalvars_s *pr_globals)
|
||||
void World_NewChaseDir (world_t *world, wedict_t *actor, wedict_t *enemy, float dist)
|
||||
{
|
||||
float deltax,deltay;
|
||||
float d[3];
|
||||
|
@ -347,7 +394,7 @@ void SV_NewChaseDir (edict_t *actor, edict_t *enemy, float dist, struct globalva
|
|||
else
|
||||
tdir = d[2] == 90 ? 135 : 215;
|
||||
|
||||
if (tdir != turnaround && SV_StepDirection(actor, tdir, dist, pr_globals))
|
||||
if (tdir != turnaround && World_StepDirection(world, actor, tdir, dist))
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -360,32 +407,32 @@ void SV_NewChaseDir (edict_t *actor, edict_t *enemy, float dist, struct globalva
|
|||
}
|
||||
|
||||
if (d[1]!=DI_NODIR && d[1]!=turnaround
|
||||
&& SV_StepDirection(actor, d[1], dist, pr_globals))
|
||||
&& World_StepDirection(world, actor, d[1], dist))
|
||||
return;
|
||||
|
||||
if (d[2]!=DI_NODIR && d[2]!=turnaround
|
||||
&& SV_StepDirection(actor, d[2], dist, pr_globals))
|
||||
&& World_StepDirection(world, actor, d[2], dist))
|
||||
return;
|
||||
|
||||
/* there is no direct path to the player, so pick another direction */
|
||||
|
||||
if (olddir!=DI_NODIR && SV_StepDirection(actor, olddir, dist, pr_globals))
|
||||
if (olddir!=DI_NODIR && World_StepDirection(world, actor, olddir, dist))
|
||||
return;
|
||||
|
||||
if (rand()&1) /*randomly determine direction of search*/
|
||||
{
|
||||
for (tdir=0 ; tdir<=315 ; tdir += 45)
|
||||
if (tdir!=turnaround && SV_StepDirection(actor, tdir, dist, pr_globals) )
|
||||
if (tdir!=turnaround && World_StepDirection(world, actor, tdir, dist) )
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
for (tdir=315 ; tdir >=0 ; tdir -= 45)
|
||||
if (tdir!=turnaround && SV_StepDirection(actor, tdir, dist, pr_globals) )
|
||||
if (tdir!=turnaround && World_StepDirection(world, actor, tdir, dist) )
|
||||
return;
|
||||
}
|
||||
|
||||
if (turnaround != DI_NODIR && SV_StepDirection(actor, turnaround, dist, pr_globals) )
|
||||
if (turnaround != DI_NODIR && World_StepDirection(world, actor, turnaround, dist) )
|
||||
return;
|
||||
|
||||
actor->v->ideal_yaw = olddir; // can't move
|
||||
|
@ -393,8 +440,8 @@ void SV_NewChaseDir (edict_t *actor, edict_t *enemy, float dist, struct globalva
|
|||
// if a bridge was pulled out from underneath a monster, it may not have
|
||||
// a valid standing position at all
|
||||
|
||||
if (!SV_CheckBottom (actor))
|
||||
SV_FixCheckBottom (actor);
|
||||
if (!World_CheckBottom (world, actor))
|
||||
World_FixCheckBottom (actor);
|
||||
|
||||
}
|
||||
|
||||
|
@ -404,7 +451,7 @@ SV_CloseEnough
|
|||
|
||||
======================
|
||||
*/
|
||||
qboolean SV_CloseEnough (edict_t *ent, edict_t *goal, float dist)
|
||||
qboolean World_CloseEnough (wedict_t *ent, wedict_t *goal, float dist)
|
||||
{
|
||||
int i;
|
||||
|
||||
|
@ -424,31 +471,29 @@ SV_MoveToGoal
|
|||
|
||||
======================
|
||||
*/
|
||||
void SV_MoveToGoal (progfuncs_t *prinst, struct globalvars_s *pr_globals)
|
||||
qboolean World_MoveToGoal (world_t *world, wedict_t *ent, float dist)
|
||||
{
|
||||
edict_t *ent, *goal;
|
||||
float dist;
|
||||
wedict_t *goal;
|
||||
|
||||
ent = PROG_TO_EDICT(svprogfuncs, pr_global_struct->self);
|
||||
goal = PROG_TO_EDICT(svprogfuncs, ent->v->goalentity);
|
||||
dist = G_FLOAT(OFS_PARM0);
|
||||
ent = (wedict_t*)PROG_TO_EDICT(world->progs, pr_global_struct->self);
|
||||
goal = (wedict_t*)PROG_TO_EDICT(world->progs, ent->v->goalentity);
|
||||
|
||||
if ( !( (int)ent->v->flags & (FL_ONGROUND|FL_FLY|FL_SWIM) ) )
|
||||
{
|
||||
G_FLOAT(OFS_RETURN) = 0;
|
||||
return;
|
||||
return false;
|
||||
}
|
||||
|
||||
// if the next step hits the enemy, return immediately
|
||||
if ( PROG_TO_EDICT(svprogfuncs, ent->v->enemy) != (edict_t*)sv.world.edicts && SV_CloseEnough (ent, goal, dist) )
|
||||
return;
|
||||
if ( PROG_TO_EDICT(world->progs, ent->v->enemy) != (edict_t*)world->edicts && World_CloseEnough (ent, goal, dist) )
|
||||
return true;
|
||||
|
||||
// bump around...
|
||||
if ( (rand()&3)==1 ||
|
||||
!SV_StepDirection (ent, ent->v->ideal_yaw, dist, pr_globals))
|
||||
!World_StepDirection (world, ent, ent->v->ideal_yaw, dist))
|
||||
{
|
||||
SV_NewChaseDir (ent, goal, dist, pr_globals);
|
||||
World_NewChaseDir (world, ent, goal, dist);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
|
@ -22,7 +22,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|||
#include "quakedef.h"
|
||||
#include "pr_common.h"
|
||||
|
||||
#ifndef CLIENTONLY
|
||||
#if defined(CSQC_DAT) || !defined(CLIENTONLY)
|
||||
/*
|
||||
|
||||
entities never clip against themselves, or their owner
|
||||
|
@ -1102,7 +1102,7 @@ static trace_t World_ClipMoveToEntity (world_t *w, wedict_t *ent, vec3_t eorg, v
|
|||
{
|
||||
model = w->GetCModel(w, ent->v->modelindex);
|
||||
if (!model || (model->type != mod_brush && model->type != mod_heightmap))
|
||||
SV_Error("SOLID_BSP with non bsp model (classname: %s)", PR_GetString(svprogfuncs, ent->v->classname));
|
||||
Host_Error("SOLID_BSP with non bsp model (classname: %s)", PR_GetString(w->progs, ent->v->classname));
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -1134,7 +1134,7 @@ static trace_t World_ClipMoveToEntity (world_t *w, wedict_t *ent, vec3_t eorg, v
|
|||
|
||||
model_t *model;
|
||||
if (ent->v->modelindex < 1 || ent->v->modelindex >= MAX_MODELS)
|
||||
SV_Error("SV_ClipMoveToEntity: modelindex out of range\n");
|
||||
Host_Error("SV_ClipMoveToEntity: modelindex out of range\n");
|
||||
model = w->GetCModel(w, ent->v->modelindex);
|
||||
|
||||
if (model && model->funcs.Trace)
|
||||
|
@ -1463,7 +1463,7 @@ static void World_ClipToEverything (world_t *w, moveclip_t *clip)
|
|||
wedict_t *touch;
|
||||
for (e=1 ; e<w->num_edicts ; e++)
|
||||
{
|
||||
touch = (wedict_t*)EDICT_NUM(svprogfuncs, e);
|
||||
touch = (wedict_t*)EDICT_NUM(w->progs, e);
|
||||
|
||||
if (touch->isfree)
|
||||
continue;
|
||||
|
@ -1507,9 +1507,9 @@ static void World_ClipToEverything (world_t *w, moveclip_t *clip)
|
|||
return;
|
||||
if (clip->passedict)
|
||||
{
|
||||
if ((wedict_t*)PROG_TO_EDICT(svprogfuncs, touch->v->owner) == clip->passedict)
|
||||
if ((wedict_t*)PROG_TO_EDICT(w->progs, touch->v->owner) == clip->passedict)
|
||||
continue; // don't clip against own missiles
|
||||
if ((wedict_t*)PROG_TO_EDICT(svprogfuncs, clip->passedict->v->owner) == touch)
|
||||
if ((wedict_t*)PROG_TO_EDICT(w->progs, clip->passedict->v->owner) == touch)
|
||||
continue; // don't clip against owner
|
||||
}
|
||||
|
||||
|
@ -1585,9 +1585,9 @@ static void World_ClipToLinks (world_t *w, areanode_t *node, moveclip_t *clip)
|
|||
return;
|
||||
if (clip->passedict)
|
||||
{
|
||||
if ((wedict_t*)PROG_TO_EDICT(svprogfuncs, touch->v->owner) == clip->passedict)
|
||||
if ((wedict_t*)PROG_TO_EDICT(w->progs, touch->v->owner) == clip->passedict)
|
||||
continue; // don't clip against own missiles
|
||||
if ((wedict_t*)PROG_TO_EDICT(svprogfuncs, clip->passedict->v->owner) == touch)
|
||||
if ((wedict_t*)PROG_TO_EDICT(w->progs, clip->passedict->v->owner) == touch)
|
||||
continue; // don't clip against owner
|
||||
}
|
||||
|
||||
|
@ -1614,7 +1614,7 @@ static void World_ClipToLinks (world_t *w, areanode_t *node, moveclip_t *clip)
|
|||
if (touch == clip->passedict)
|
||||
continue;
|
||||
if (touch->v->solid == SOLID_TRIGGER || touch->v->solid == SOLID_LADDER)
|
||||
SV_Error ("Trigger (%s) in clipping list", PR_GetString(svprogfuncs, touch->v->classname));
|
||||
Host_Error ("Trigger (%s) in clipping list", PR_GetString(w->progs, touch->v->classname));
|
||||
|
||||
if (clip->type & MOVE_LAGGED)
|
||||
{
|
||||
|
@ -1656,9 +1656,9 @@ static void World_ClipToLinks (world_t *w, areanode_t *node, moveclip_t *clip)
|
|||
return;
|
||||
if (clip->passedict)
|
||||
{
|
||||
if ((wedict_t*)PROG_TO_EDICT(svprogfuncs, touch->v->owner) == clip->passedict)
|
||||
if ((wedict_t*)PROG_TO_EDICT(w->progs, touch->v->owner) == clip->passedict)
|
||||
continue; // don't clip against own missiles
|
||||
if ((wedict_t*)PROG_TO_EDICT(svprogfuncs, clip->passedict->v->owner) == touch)
|
||||
if ((wedict_t*)PROG_TO_EDICT(w->progs, clip->passedict->v->owner) == touch)
|
||||
continue; // don't clip against owner
|
||||
}
|
||||
|
||||
|
@ -1792,6 +1792,10 @@ trace_t World_Move (world_t *w, vec3_t start, vec3_t mins, vec3_t maxs, vec3_t e
|
|||
|
||||
if (passedict && passedict->xv->hull)
|
||||
hullnum = passedict->xv->hull;
|
||||
#ifdef CLIENTONLY
|
||||
else
|
||||
hullnum = 0;
|
||||
#else
|
||||
else if (sv_compatiblehulls.value)
|
||||
hullnum = 0;
|
||||
else
|
||||
|
@ -1819,6 +1823,7 @@ trace_t World_Move (world_t *w, vec3_t start, vec3_t mins, vec3_t maxs, vec3_t e
|
|||
}
|
||||
hullnum++;
|
||||
}
|
||||
#endif
|
||||
|
||||
// clip to world
|
||||
clip.trace = World_ClipMoveToEntity (w, w->edicts, w->edicts->v->origin, start, mins, maxs, end, hullnum, false);
|
||||
|
@ -1859,24 +1864,28 @@ trace_t World_Move (world_t *w, vec3_t start, vec3_t mins, vec3_t maxs, vec3_t e
|
|||
if (clip.type & MOVE_LAGGED)
|
||||
{
|
||||
clip.type &= ~MOVE_LAGGED;
|
||||
|
||||
if (passedict->entnum && passedict->entnum <= MAX_CLIENTS)
|
||||
#ifndef CLIENTONLY
|
||||
if (w == &sv.world)
|
||||
{
|
||||
clip.type |= MOVE_LAGGED;
|
||||
w->lagents = svs.clients[passedict->entnum-1].laggedents;
|
||||
w->maxlagents = svs.clients[passedict->entnum-1].laggedents_count;
|
||||
w->lagentsfrac = svs.clients[passedict->entnum-1].laggedents_frac;
|
||||
}
|
||||
else if (passedict->v->owner)
|
||||
{
|
||||
if (passedict->v->owner && passedict->v->owner <= MAX_CLIENTS)
|
||||
if (passedict->entnum && passedict->entnum <= MAX_CLIENTS)
|
||||
{
|
||||
clip.type |= MOVE_LAGGED;
|
||||
w->lagents = svs.clients[passedict->v->owner-1].laggedents;
|
||||
w->maxlagents = svs.clients[passedict->v->owner-1].laggedents_count;
|
||||
w->lagentsfrac = svs.clients[passedict->v->owner-1].laggedents_frac;
|
||||
w->lagents = svs.clients[passedict->entnum-1].laggedents;
|
||||
w->maxlagents = svs.clients[passedict->entnum-1].laggedents_count;
|
||||
w->lagentsfrac = svs.clients[passedict->entnum-1].laggedents_frac;
|
||||
}
|
||||
else if (passedict->v->owner)
|
||||
{
|
||||
if (passedict->v->owner && passedict->v->owner <= MAX_CLIENTS)
|
||||
{
|
||||
clip.type |= MOVE_LAGGED;
|
||||
w->lagents = svs.clients[passedict->v->owner-1].laggedents;
|
||||
w->maxlagents = svs.clients[passedict->v->owner-1].laggedents_count;
|
||||
w->lagentsfrac = svs.clients[passedict->v->owner-1].laggedents_frac;
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
if (clip.type & MOVE_LAGGED)
|
||||
{
|
||||
|
@ -1899,7 +1908,7 @@ trace_t World_Move (world_t *w, vec3_t start, vec3_t mins, vec3_t maxs, vec3_t e
|
|||
if (touch == clip.passedict)
|
||||
continue;
|
||||
if (touch->v->solid == SOLID_TRIGGER || touch->v->solid == SOLID_LADDER)
|
||||
SV_Error ("Trigger (%s) in clipping list", PR_GetString(svprogfuncs, touch->v->classname));
|
||||
Host_Error ("Trigger (%s) in clipping list", PR_GetString(w->progs, touch->v->classname));
|
||||
|
||||
if (clip.type & MOVE_NOMONSTERS && touch->v->solid != SOLID_BSP)
|
||||
continue;
|
||||
|
@ -1932,9 +1941,9 @@ trace_t World_Move (world_t *w, vec3_t start, vec3_t mins, vec3_t maxs, vec3_t e
|
|||
|
||||
if (clip.passedict)
|
||||
{
|
||||
if ((wedict_t*)PROG_TO_EDICT(svprogfuncs, touch->v->owner) == clip.passedict)
|
||||
if ((wedict_t*)PROG_TO_EDICT(w->progs, touch->v->owner) == clip.passedict)
|
||||
continue; // don't clip against own missiles
|
||||
if ((wedict_t*)PROG_TO_EDICT(svprogfuncs, clip.passedict->v->owner) == touch)
|
||||
if ((wedict_t*)PROG_TO_EDICT(w->progs, clip.passedict->v->owner) == touch)
|
||||
continue; // don't clip against owner
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue