total nukage of #ifdef QUAKE2 (R_DarkFieldParticles is present, just unused)

This commit is contained in:
Bill Currie 2001-08-27 23:21:09 +00:00
parent 330044ec72
commit a9d6bc9a30
15 changed files with 4 additions and 1138 deletions

View file

@ -49,9 +49,7 @@ void R_RunParticleEffect (vec3_t org, int color, int count);
void R_RunPuffEffect (vec3_t org, particle_effect_t type, byte count); void R_RunPuffEffect (vec3_t org, particle_effect_t type, byte count);
void R_RunSpikeEffect (vec3_t org, particle_effect_t type); void R_RunSpikeEffect (vec3_t org, particle_effect_t type);
#ifdef QUAKE2
void R_DarkFieldParticles (struct entity_s *ent); void R_DarkFieldParticles (struct entity_s *ent);
#endif
void R_EntityParticles (struct entity_s *ent); void R_EntityParticles (struct entity_s *ent);
void R_BlobExplosion (vec3_t org); void R_BlobExplosion (vec3_t org);
void R_ParticleExplosion (vec3_t org); void R_ParticleExplosion (vec3_t org);

View file

@ -43,7 +43,6 @@ vec3_t r_pright, r_pup, r_ppn;
int r_numparticles; int r_numparticles;
#ifdef QUAKE2
void void
R_DarkFieldParticles (entity_t *ent) R_DarkFieldParticles (entity_t *ent)
{ {
@ -82,7 +81,6 @@ R_DarkFieldParticles (entity_t *ent)
VectorScale (dir, vel, p->vel); VectorScale (dir, vel, p->vel);
} }
} }
#endif
#define NUMVERTEXNORMALS 162 #define NUMVERTEXNORMALS 162
extern float r_avertexnormals[NUMVERTEXNORMALS][3]; extern float r_avertexnormals[NUMVERTEXNORMALS][3];

View file

@ -52,9 +52,6 @@ typedef struct usercmd_s
float forwardmove; float forwardmove;
float sidemove; float sidemove;
float upmove; float upmove;
#ifdef QUAKE2
byte lightlevel;
#endif
} usercmd_t; } usercmd_t;
typedef struct typedef struct
@ -222,12 +219,6 @@ typedef struct
// frag scoreboard // frag scoreboard
scoreboard_t *scores; // [cl.maxclients] scoreboard_t *scores; // [cl.maxclients]
#ifdef QUAKE2
// light level at player's position including dlights this is sent back to the
// server each frame architectually ugly but it works
int light_level;
#endif
} client_state_t; } client_state_t;

View file

@ -169,10 +169,6 @@
#define TE_TELEPORT 11 #define TE_TELEPORT 11
#define TE_BLOOD 12 #define TE_BLOOD 12
#define TE_LIGHTNINGBLOOD 13 #define TE_LIGHTNINGBLOOD 13
#ifdef QUAKE2
#define TE_IMPLOSION 14
#define TE_RAILTRAIL 15
#endif
#define TE_EXPLOSION2 16 #define TE_EXPLOSION2 16
// PGM 01/21/97 // PGM 01/21/97
#define TE_BEAM 17 #define TE_BEAM 17

View file

@ -70,9 +70,6 @@ typedef struct
double lastchecktime; double lastchecktime;
char name[64]; // map name char name[64]; // map name
#ifdef QUAKE2
char startspot[64];
#endif
char modelname[64]; // maps/<name>.bsp, for model_precache[0] char modelname[64]; // maps/<name>.bsp, for model_precache[0]
struct model_s *worldmodel; struct model_s *worldmodel;
const char *model_precache[MAX_MODELS]; // NULL terminated const char *model_precache[MAX_MODELS]; // NULL terminated
@ -148,10 +145,6 @@ typedef struct client_s
#define MOVETYPE_NOCLIP 8 #define MOVETYPE_NOCLIP 8
#define MOVETYPE_FLYMISSILE 9 // extra size to monsters #define MOVETYPE_FLYMISSILE 9 // extra size to monsters
#define MOVETYPE_BOUNCE 10 #define MOVETYPE_BOUNCE 10
#ifdef QUAKE2
#define MOVETYPE_BOUNCEMISSILE 11 // bounce w/o gravity
#define MOVETYPE_FOLLOW 12 // track movement of aiment
#endif
// edict->solid values // edict->solid values
#define SOLID_NOT 0 // no interaction with other objects #define SOLID_NOT 0 // no interaction with other objects
@ -184,10 +177,6 @@ typedef struct client_s
#define FL_PARTIALGROUND 1024 // not all corners are valid #define FL_PARTIALGROUND 1024 // not all corners are valid
#define FL_WATERJUMP 2048 // player jumping out of water #define FL_WATERJUMP 2048 // player jumping out of water
#define FL_JUMPRELEASED 4096 // for jump debouncing #define FL_JUMPRELEASED 4096 // for jump debouncing
#ifdef QUAKE2
#define FL_FLASHLIGHT 8192
#define FL_ARCHIVE_OVERRIDE 1048576
#endif
// entity effects // entity effects
@ -195,28 +184,12 @@ typedef struct client_s
#define EF_MUZZLEFLASH 2 #define EF_MUZZLEFLASH 2
#define EF_BRIGHTLIGHT 4 #define EF_BRIGHTLIGHT 4
#define EF_DIMLIGHT 8 #define EF_DIMLIGHT 8
#ifdef QUAKE2
#define EF_DARKLIGHT 16
#define EF_DARKFIELD 32
#define EF_LIGHT 64
#define EF_NODRAW 128
#endif
#define SPAWNFLAG_NOT_EASY 256 #define SPAWNFLAG_NOT_EASY 256
#define SPAWNFLAG_NOT_MEDIUM 512 #define SPAWNFLAG_NOT_MEDIUM 512
#define SPAWNFLAG_NOT_HARD 1024 #define SPAWNFLAG_NOT_HARD 1024
#define SPAWNFLAG_NOT_DEATHMATCH 2048 #define SPAWNFLAG_NOT_DEATHMATCH 2048
#ifdef QUAKE2
// server flags
#define SFL_EPISODE_1 1
#define SFL_EPISODE_2 2
#define SFL_EPISODE_3 4
#define SFL_EPISODE_4 8
#define SFL_NEW_UNIT 16
#define SFL_NEW_EPISODE 32
#define SFL_CROSS_TRIGGERS 65280
#endif
//============================================================================ //============================================================================
@ -290,11 +263,7 @@ void SV_MoveToGoal (progs_t *pr);
void SV_CheckForNewClients (void); void SV_CheckForNewClients (void);
void SV_RunClients (void); void SV_RunClients (void);
void SV_SaveSpawnparms (); void SV_SaveSpawnparms ();
#ifdef QUAKE2
void SV_SpawnServer (const char *server, const char *startspot);
#else
void SV_SpawnServer (const char *server); void SV_SpawnServer (const char *server);
#endif
void SV_LoadProgs (void); void SV_LoadProgs (void);
void SV_Progs_Init (void); void SV_Progs_Init (void);

View file

@ -604,12 +604,6 @@ CL_SendMove (usercmd_t *cmd)
MSG_WriteByte (&buf, in_impulse); MSG_WriteByte (&buf, in_impulse);
in_impulse = 0; in_impulse = 0;
#ifdef QUAKE2
// light level
//
MSG_WriteByte (&buf, cmd->lightlevel);
#endif
// deliver the message // deliver the message
// //
if (cls.demoplayback) if (cls.demoplayback)

View file

@ -591,10 +591,6 @@ CL_RelinkEntities (void)
if (ent->effects & EF_BRIGHTFIELD) if (ent->effects & EF_BRIGHTFIELD)
R_EntityParticles (ent); R_EntityParticles (ent);
#ifdef QUAKE2
if (ent->effects & EF_DARKFIELD)
R_DarkFieldParticles (ent);
#endif
if (ent->effects & EF_MUZZLEFLASH) { if (ent->effects & EF_MUZZLEFLASH) {
vec3_t fv, rv, uv; vec3_t fv, rv, uv;
@ -626,21 +622,6 @@ CL_RelinkEntities (void)
if (ent->effects & EF_DIMLIGHT) if (ent->effects & EF_DIMLIGHT)
CL_NewDlight (i, ent->origin[0], ent->origin[1], ent->origin[2], CL_NewDlight (i, ent->origin[0], ent->origin[1], ent->origin[2],
200 + (rand () & 31), 0.001, 0); 200 + (rand () & 31), 0.001, 0);
#ifdef QUAKE2
if (ent->effects & EF_DARKLIGHT) {
dl = R_AllocDlight (i);
VectorCopy (ent->origin, dl->origin);
dl->radius = 200.0 + (rand () & 31);
dl->die = cl.time + 0.001;
dl->dark = true;
}
if (ent->effects & EF_LIGHT) {
dl = R_AllocDlight (i);
VectorCopy (ent->origin, dl->origin);
dl->radius = 200;
dl->die = cl.time + 0.001;
}
#endif
if (VectorDistance_fast(ent->msg_origins[1], ent->origin) > (256*256)) if (VectorDistance_fast(ent->msg_origins[1], ent->origin) > (256*256))
VectorCopy (ent ->origin, ent->msg_origins[1]); VectorCopy (ent ->origin, ent->msg_origins[1]);
if (ent->model->flags & EF_ROCKET) { if (ent->model->flags & EF_ROCKET) {
@ -668,10 +649,6 @@ CL_RelinkEntities (void)
if (i == cl.viewentity && !chase_active->int_val) { if (i == cl.viewentity && !chase_active->int_val) {
continue; continue;
} }
#ifdef QUAKE2
if (ent->effects & EF_NODRAW)
continue;
#endif
if ((_ent = R_NewEntity ())) if ((_ent = R_NewEntity ()))
*_ent = ent; *_ent = ent;
} }

View file

@ -79,10 +79,6 @@ sfx_t *cl_sfx_ric1;
sfx_t *cl_sfx_ric2; sfx_t *cl_sfx_ric2;
sfx_t *cl_sfx_ric3; sfx_t *cl_sfx_ric3;
sfx_t *cl_sfx_r_exp3; sfx_t *cl_sfx_r_exp3;
#ifdef QUAKE2
sfx_t *cl_sfx_imp;
sfx_t *cl_sfx_rail;
#endif
model_t *cl_mod_bolt; model_t *cl_mod_bolt;
model_t *cl_mod_bolt2; model_t *cl_mod_bolt2;
@ -120,10 +116,6 @@ CL_TEnts_Init (void)
cl_sfx_ric2 = S_PrecacheSound ("weapons/ric2.wav"); cl_sfx_ric2 = S_PrecacheSound ("weapons/ric2.wav");
cl_sfx_ric3 = S_PrecacheSound ("weapons/ric3.wav"); cl_sfx_ric3 = S_PrecacheSound ("weapons/ric3.wav");
cl_sfx_r_exp3 = S_PrecacheSound ("weapons/r_exp3.wav"); cl_sfx_r_exp3 = S_PrecacheSound ("weapons/r_exp3.wav");
#ifdef QUAKE2
cl_sfx_imp = S_PrecacheSound ("shambler/sattck1.wav");
cl_sfx_rail = S_PrecacheSound ("weapons/lstart.wav");
#endif
cl_mod_bolt = Mod_ForName ("progs/bolt.mdl", true); cl_mod_bolt = Mod_ForName ("progs/bolt.mdl", true);
cl_mod_bolt2 = Mod_ForName ("progs/bolt2.mdl", true); cl_mod_bolt2 = Mod_ForName ("progs/bolt2.mdl", true);
@ -237,9 +229,6 @@ CL_ParseTEnt (void)
{ {
byte type; byte type;
vec3_t pos; vec3_t pos;
#ifdef QUAKE2
vec3_t endpos;
#endif
dlight_t *dl; dlight_t *dl;
int rnd; int rnd;
int colorStart, colorLength; int colorStart, colorLength;
@ -410,38 +399,6 @@ CL_ParseTEnt (void)
R_RunPuffEffect (pos, prot_to_rend[type], cnt); R_RunPuffEffect (pos, prot_to_rend[type], cnt);
break; break;
#ifdef QUAKE2
case TE_IMPLOSION:
pos[0] = MSG_ReadCoord (net_message);
pos[1] = MSG_ReadCoord (net_message);
pos[2] = MSG_ReadCoord (net_message);
S_StartSound (-1, 0, cl_sfx_imp, pos, 1, 1);
break;
case TE_RAILTRAIL:
pos[0] = MSG_ReadCoord (net_message);
pos[1] = MSG_ReadCoord (net_message);
pos[2] = MSG_ReadCoord (net_message);
endpos[0] = MSG_ReadCoord (net_message);
endpos[1] = MSG_ReadCoord (net_message);
endpos[2] = MSG_ReadCoord (net_message);
S_StartSound (-1, 0, cl_sfx_rail, pos, 1, 1);
S_StartSound (-1, 1, cl_sfx_r_exp3, endpos, 1, 1);
/* Need updating to new Particle API
R_RocketTrail (pos, endpos, 0 + 128);
R_ParticleExplosion (endpos);
*/
dl = R_AllocDlight (-1);
VectorCopy (endpos, dl->origin);
dl->radius = 350;
dl->die = cl.time + 0.5;
dl->decay = 300;
dl->color[0] = 0.86;
dl->color[1] = 0.31;
dl->color[2] = 0.24;
break;
#endif
default: default:
Sys_Error ("CL_ParseTEnt: bad type"); Sys_Error ("CL_ParseTEnt: bad type");
} }

View file

@ -297,11 +297,7 @@ Host_Map_f (void)
svs.serverflags = 0; // haven't completed an episode yet svs.serverflags = 0; // haven't completed an episode yet
strcpy (name, Cmd_Argv (1)); strcpy (name, Cmd_Argv (1));
#ifdef QUAKE2
SV_SpawnServer (name, NULL);
#else
SV_SpawnServer (name); SV_SpawnServer (name);
#endif
if (!sv.active) if (!sv.active)
return; return;
@ -327,31 +323,6 @@ Goes to a new map, taking all clients along
void void
Host_Changelevel_f (void) Host_Changelevel_f (void)
{ {
#ifdef QUAKE2
char level[MAX_QPATH];
char _startspot[MAX_QPATH];
char *startspot;
if (Cmd_Argc () < 2) {
Con_Printf ("changelevel <levelname> : continue game on a new level\n");
return;
}
if (!sv.active || cls.demoplayback) {
Con_Printf ("Only the server may changelevel\n");
return;
}
strcpy (level, Cmd_Argv (1));
if (Cmd_Argc () == 2)
startspot = NULL;
else {
strcpy (_startspot, Cmd_Argv (2));
startspot = _startspot;
}
SV_SaveSpawnparms ();
SV_SpawnServer (level, startspot);
#else
char level[MAX_QPATH]; char level[MAX_QPATH];
if (Cmd_Argc () != 2) { if (Cmd_Argc () != 2) {
@ -365,7 +336,6 @@ Host_Changelevel_f (void)
SV_SaveSpawnparms (); SV_SaveSpawnparms ();
strcpy (level, Cmd_Argv (1)); strcpy (level, Cmd_Argv (1));
SV_SpawnServer (level); SV_SpawnServer (level);
#endif
} }
/* /*
@ -380,10 +350,6 @@ Host_Restart_f (void)
{ {
char mapname[MAX_QPATH]; char mapname[MAX_QPATH];
#ifdef QUAKE2
char startspot[MAX_QPATH];
#endif
if (cls.demoplayback || !sv.active) if (cls.demoplayback || !sv.active)
return; return;
@ -392,12 +358,7 @@ Host_Restart_f (void)
strcpy (mapname, sv.name); // must copy out, because it gets strcpy (mapname, sv.name); // must copy out, because it gets
// cleared // cleared
// in sv_spawnserver // in sv_spawnserver
#ifdef QUAKE2
strcpy (startspot, sv.startspot);
SV_SpawnServer (mapname, startspot);
#else
SV_SpawnServer (mapname); SV_SpawnServer (mapname);
#endif
} }
/* /*
@ -627,12 +588,6 @@ Host_Loadgame_f (void)
current_skill = (int) (tfloat + 0.1); current_skill = (int) (tfloat + 0.1);
Cvar_SetValue (skill, (float) current_skill); Cvar_SetValue (skill, (float) current_skill);
#ifdef QUAKE2
Cvar_SetValue (deathmatch, 0);
Cvar_SetValue (coop, 0);
Cvar_SetValue (teamplay, 0);
#endif
Qgets (f, buf, sizeof (buf)); Qgets (f, buf, sizeof (buf));
sscanf (buf, "%s\n", mapname); sscanf (buf, "%s\n", mapname);
Qgets (f, buf, sizeof (buf)); Qgets (f, buf, sizeof (buf));
@ -640,11 +595,7 @@ Host_Loadgame_f (void)
CL_Disconnect_f (); CL_Disconnect_f ();
#ifdef QUAKE2
SV_SpawnServer (mapname, NULL);
#else
SV_SpawnServer (mapname); SV_SpawnServer (mapname);
#endif
if (!sv.active) { if (!sv.active) {
Con_Printf ("Couldn't load map\n"); Con_Printf ("Couldn't load map\n");
return; return;
@ -715,198 +666,6 @@ Host_Loadgame_f (void)
} }
} }
#ifdef QUAKE2
void
SaveGamestate ()
{
char name[256];
VFile *f;
int i;
char comment[SAVEGAME_COMMENT_LENGTH + 1];
edict_t *ent;
snprintf (name, sizeof (name), "%s/%s.gip", com_gamedir, sv.name);
Con_Printf ("Saving game to %s...\n", name);
f = Qopen (name, "w");
if (!f) {
Con_Printf ("ERROR: couldn't open.\n");
return;
}
Qprintf (f, "%i\n", SAVEGAME_VERSION);
Host_SavegameComment (comment);
Qprintf (f, "%s\n", comment);
// for (i=0 ; i<NUM_SPAWN_PARMS ; i++)
// Qprintf (f, "%f\n", svs.clients->spawn_parms[i]);
Qprintf (f, "%f\n", skill->value);
Qprintf (f, "%s\n", sv.name);
Qprintf (f, "%f\n", sv.time);
// write the light styles
for (i = 0; i < MAX_LIGHTSTYLES; i++) {
if (sv.lightstyles[i])
Qprintf (f, "%s\n", sv.lightstyles[i]);
else
Qprintf (f, "m\n");
}
for (i = svs.maxclients + 1; i < sv.num_edicts; i++) {
ent = EDICT_NUM (i);
if ((int) SVfloat (ent, flags) & FL_ARCHIVE_OVERRIDE)
continue;
Qprintf (f, "%i\n", i);
ED_Write (f, ent);
Qflush (f);
}
Qclose (f);
Con_Printf ("done.\n");
}
int
LoadGamestate (char *level, char *startspot)
{
char name[MAX_OSPATH];
VFile *f;
char mapname[MAX_QPATH];
float time, sk;
char str[32768], *start;
int i, r;
edict_t *ent;
int entnum;
int version;
// float spawn_parms[NUM_SPAWN_PARMS];
snprintf (name, sizeof (name), "%s/%s.gip", com_gamedir, level);
Con_Printf ("Loading game from %s...\n", name);
f = Qopen (name, "r");
if (!f) {
Con_Printf ("ERROR: couldn't open.\n");
return -1;
}
Qgets (f, buf, sizeof (buf));
sscanf (buf, "%i\n", &version);
if (version != SAVEGAME_VERSION) {
Qclose (f);
Con_Printf ("Savegame is version %i, not %i\n", version,
SAVEGAME_VERSION);
return -1;
}
Qgets (f, buf, sizeof (buf));
sscanf (buf, "%s\n", str);
// for (i=0 ; i<NUM_SPAWN_PARMS ; i++)
// fscanf (f, "%f\n", &spawn_parms[i]);
Qgets (f, buf, sizeof (buf));
sscanf (buf, "%f\n", &sk);
Cvar_SetValue (skill, sk);
Qgets (f, buf, sizeof (buf));
sscanf (buf, "%s\n", mapname);
Qgets (f, buf, sizeof (buf));
sscanf (buf, "%f\n", &time);
SV_SpawnServer (mapname, startspot);
if (!sv.active) {
Con_Printf ("Couldn't load map\n");
return -1;
}
// load the light styles
for (i = 0; i < MAX_LIGHTSTYLES; i++) {
Qgets (f, buf, sizeof (buf));
sscanf (buf, "%s\n", str);
sv.lightstyles[i] = Hunk_Alloc (strlen (str) + 1);
strcpy (sv.lightstyles[i], str);
}
// load the edicts out of the savegame file
while (!feof (f)) {
Qgets (f, buf, sizeof (buf));
sscanf (buf, "%i\n", &entnum);
for (i = 0; i < sizeof (str) - 1; i++) {
r = fgetc (f);
if (r == EOF || !r)
break;
str[i] = r;
if (r == '}') {
i++;
break;
}
}
if (i == sizeof (str) - 1)
Sys_Error ("Loadgame buffer overflow");
str[i] = 0;
start = str;
start = COM_Parse (str);
if (!com_token[0])
break; // end of file
if (strcmp (com_token, "{"))
Sys_Error ("First token isn't a brace");
// parse an edict
ent = EDICT_NUM (entnum);
memset (&ent->v, 0, progs->entityfields * 4);
ent->free = false;
ED_ParseEdict (start, ent);
// link it into the bsp tree
if (!ent->free)
SV_LinkEdict (ent, false);
}
// sv.num_edicts = entnum;
sv.time = time;
Qclose (f);
// for (i=0 ; i<NUM_SPAWN_PARMS ; i++)
// svs.clients->spawn_parms[i] = spawn_parms[i];
return 0;
}
// changing levels within a unit
void
Host_Changelevel2_f (void)
{
char level[MAX_QPATH];
char _startspot[MAX_QPATH];
char *startspot;
if (Cmd_Argc () < 2) {
Con_Printf
("changelevel2 <levelname> : continue game on a new level in the unit\n");
return;
}
if (!sv.active || cls.demoplayback) {
Con_Printf ("Only the server may changelevel\n");
return;
}
strcpy (level, Cmd_Argv (1));
if (Cmd_Argc () == 2)
startspot = NULL;
else {
strcpy (_startspot, Cmd_Argv (2));
startspot = _startspot;
}
SV_SaveSpawnparms ();
// save the current level's state
SaveGamestate ();
// try to restore the new level
if (LoadGamestate (level, startspot))
SV_SpawnServer (level, startspot);
}
#endif
//============================================================================ //============================================================================
@ -1766,9 +1525,6 @@ Host_InitCommands (void)
Cmd_AddCommand ("map", Host_Map_f, "No Description"); Cmd_AddCommand ("map", Host_Map_f, "No Description");
Cmd_AddCommand ("restart", Host_Restart_f, "No Description"); Cmd_AddCommand ("restart", Host_Restart_f, "No Description");
Cmd_AddCommand ("changelevel", Host_Changelevel_f, "No Description"); Cmd_AddCommand ("changelevel", Host_Changelevel_f, "No Description");
#ifdef QUAKE2
Cmd_AddCommand ("changelevel2", Host_Changelevel2_f, "No Description");
#endif
Cmd_AddCommand ("connect", Host_Connect_f, "No Description"); Cmd_AddCommand ("connect", Host_Connect_f, "No Description");
Cmd_AddCommand ("reconnect", Host_Reconnect_f, "No Description"); Cmd_AddCommand ("reconnect", Host_Reconnect_f, "No Description");
Cmd_AddCommand ("name", Host_Name_f, "No Description"); Cmd_AddCommand ("name", Host_Name_f, "No Description");

View file

@ -481,37 +481,6 @@ PF_traceline (progs_t *pr)
} }
#ifdef QUAKE2
extern trace_t SV_Trace_Toss (edict_t *ent, edict_t *ignore);
void
PF_TraceToss (progs_t *pr)
{
trace_t trace;
edict_t *ent;
edict_t *ignore;
ent = G_EDICT (pr, OFS_PARM0);
ignore = G_EDICT (pr, OFS_PARM1);
trace = SV_Trace_Toss (ent, ignore);
*sv_globals.trace_allsolid = trace.allsolid;
*sv_globals.trace_startsolid = trace.startsolid;
*sv_globals.trace_fraction = trace.fraction;
*sv_globals.trace_inwater = trace.inwater;
*sv_globals.trace_inopen = trace.inopen;
VectorCopy (trace.endpos, *sv_globals.trace_endpos);
VectorCopy (trace.plane.normal, *sv_globals.trace_plane_normal);
*sv_globals.trace_plane_dist = trace.plane.dist;
if (trace.ent)
*sv_globals.trace_ent = EDICT_TO_PROG (pr, trace.ent);
else
*sv_globals.trace_ent = EDICT_TO_PROG (pr, sv.edicts);
}
#endif
/* /*
PF_checkpos PF_checkpos
@ -714,16 +683,6 @@ PF_findradius (progs_t *pr)
} }
#ifdef QUAKE2
void
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_SetString (pr, pr_string_temp);
}
#endif
void void
PF_Spawn (progs_t *pr) PF_Spawn (progs_t *pr)
{ {
@ -1052,42 +1011,6 @@ PF_changeyaw (progs_t *pr)
SVvector (ent, angles)[1] = anglemod (current + move); SVvector (ent, angles)[1] = anglemod (current + move);
} }
#ifdef QUAKE2
/*
PF_changepitch
*/
void
PF_changepitch (progs_t *pr)
{
edict_t *ent;
float ideal, current, move, speed;
ent = G_EDICT (pr, OFS_PARM0);
current = anglemod (SVvector (ent, angles)[0]);
ideal = SVfloat (ent, idealpitch);
speed = SVfloat (ent, pitch_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;
}
SVvector (ent, angles)[0] = anglemod (current + move);
}
#endif
/* /*
=============================================================================== ===============================================================================
@ -1240,22 +1163,6 @@ PF_setspawnparms (progs_t *pr)
void void
PF_changelevel (progs_t *pr) PF_changelevel (progs_t *pr)
{ {
#ifdef QUAKE2
char *s1, *s2;
if (svs.changelevel_issued)
return;
svs.changelevel_issued = true;
s1 = G_STRING (pr, OFS_PARM0);
s2 = G_STRING (pr, OFS_PARM1);
if ((int) *sv_globals.
serverflags & (SFL_NEW_UNIT | SFL_NEW_EPISODE))
Cbuf_AddText (va ("changelevel %s %s\n", s1, s2));
else
Cbuf_AddText (va ("changelevel2 %s %s\n", s1, s2));
#else
char *s; char *s;
// make sure we don't issue two changelevels // make sure we don't issue two changelevels
@ -1265,166 +1172,9 @@ PF_changelevel (progs_t *pr)
s = G_STRING (pr, OFS_PARM0); s = G_STRING (pr, OFS_PARM0);
Cbuf_AddText (va ("changelevel %s\n", s)); Cbuf_AddText (va ("changelevel %s\n", s));
#endif
} }
#ifdef QUAKE2
#define CONTENT_WATER -3
#define CONTENT_SLIME -4
#define CONTENT_LAVA -5
#define FL_IMMUNE_WATER 131072
#define FL_IMMUNE_SLIME 262144
#define FL_IMMUNE_LAVA 524288
#define CHAN_VOICE 2
#define CHAN_BODY 4
#define ATTN_NORM 1
void
PF_WaterMove (progs_t *pr)
{
edict_t *self;
int flags;
int waterlevel;
int watertype;
float drownlevel;
float damage = 0.0;
self = PROG_TO_EDICT (pr, *sv_globals.self);
if (SVfloat (self, movetype) == MOVETYPE_NOCLIP) {
SVfloat (self, air_finished) = sv.time + 12;
G_FLOAT (pr, OFS_RETURN) = damage;
return;
}
if (SVfloat (self, health) < 0) {
G_FLOAT (pr, OFS_RETURN) = damage;
return;
}
if (SVfloat (self, deadflag) == DEAD_NO)
drownlevel = 3;
else
drownlevel = 1;
flags = (int) SVfloat (self, flags);
waterlevel = (int) SVfloat (self, waterlevel);
watertype = (int) SVfloat (self, watertype);
if (!(flags & (FL_IMMUNE_WATER + FL_GODMODE)))
if (((flags & FL_SWIM) && (waterlevel < drownlevel))
|| (waterlevel >= drownlevel)) {
if (SVfloat (self, air_finished) < sv.time)
if (SVfloat (self, pain_finished) < sv.time) {
SVfloat (self, dmg) = SVfloat (self, dmg) + 2;
if (SVfloat (self, dmg) > 15)
SVfloat (self, dmg) = 10;
// T_Damage (self, world, world, self.dmg, 0, FALSE);
damage = SVfloat (self, dmg);
SVfloat (self, pain_finished) = sv.time + 1.0;
}
} else {
if (SVfloat (self, air_finished) < sv.time)
// sound (self, CHAN_VOICE, "player/gasp2.wav", 1, ATTN_NORM);
SV_StartSound (self, CHAN_VOICE, "player/gasp2.wav", 255,
ATTN_NORM);
else if (SVfloat (self, air_finished) < sv.time + 9)
// sound (self, CHAN_VOICE, "player/gasp1.wav", 1, ATTN_NORM);
SV_StartSound (self, CHAN_VOICE, "player/gasp1.wav", 255,
ATTN_NORM);
SVfloat (self, air_finished) = sv.time + 12.0;
SVfloat (self, dmg) = 2;
}
if (!waterlevel) {
if (flags & FL_INWATER) {
// play leave water sound
// sound (self, CHAN_BODY, "misc/outwater.wav", 1, ATTN_NORM);
SV_StartSound (self, CHAN_BODY, "misc/outwater.wav", 255,
ATTN_NORM);
SVfloat (self, flags) = (float) (flags & ~FL_INWATER);
}
SVfloat (self, air_finished) = sv.time + 12.0;
G_FLOAT (pr, OFS_RETURN) = damage;
return;
}
if (watertype == CONTENT_LAVA) { // do damage
if (!(flags & (FL_IMMUNE_LAVA + FL_GODMODE)))
if (SVfloat (self, dmgtime) < sv.time) {
if (SVfloat (self, radsuit_finished) < sv.time)
SVfloat (self, dmgtime) = sv.time + 0.2;
else
SVfloat (self, dmgtime) = sv.time + 1.0;
// T_Damage (self, world, world, 10*self.waterlevel, 0, TRUE);
damage = (float) (10 * waterlevel);
}
} else if (watertype == CONTENT_SLIME) { // do damage
if (!(flags & (FL_IMMUNE_SLIME + FL_GODMODE)))
if (SVfloat (self, dmgtime) < sv.time
&& SVfloat (self, radsuit_finished) < sv.time) {
SVfloat (self, dmgtime) = sv.time + 1.0;
// T_Damage (self, world, world, 4*self.waterlevel, 0, TRUE);
damage = (float) (4 * waterlevel);
}
}
if (!(flags & FL_INWATER)) {
// player enter water sound
if (watertype == CONTENT_LAVA)
// sound (self, CHAN_BODY, "player/inlava.wav", 1, ATTN_NORM);
SV_StartSound (self, CHAN_BODY, "player/inlava.wav", 255,
ATTN_NORM);
if (watertype == CONTENT_WATER)
// sound (self, CHAN_BODY, "player/inh2o.wav", 1, ATTN_NORM);
SV_StartSound (self, CHAN_BODY, "player/inh2o.wav", 255, ATTN_NORM);
if (watertype == CONTENT_SLIME)
// sound (self, CHAN_BODY, "player/slimbrn2.wav", 1, ATTN_NORM);
SV_StartSound (self, CHAN_BODY, "player/slimbrn2.wav", 255,
ATTN_NORM);
SVfloat (self, flags) = (float) (flags | FL_INWATER);
SVfloat (self, dmgtime) = 0;
}
if (!(flags & FL_WATERJUMP)) {
// self.velocity = self.velocity - 0.8*self.waterlevel*frametime*self.velocity;
VectorMA (SVvector (self, velocity),
-0.8 * SVfloat (self, waterlevel) * host_frametime,
SVvector (self, velocity), SVvector (self, velocity));
}
G_FLOAT (pr, OFS_RETURN) = damage;
}
void
PF_sin (progs_t *pr)
{
G_FLOAT (pr, OFS_RETURN) = sin (G_FLOAT (pr, OFS_PARM0));
}
void
PF_cos (progs_t *pr)
{
G_FLOAT (pr, OFS_RETURN) = cos (G_FLOAT (pr, OFS_PARM0));
}
void
PF_sqrt (progs_t *pr)
{
G_FLOAT (pr, OFS_RETURN) = sqrt (G_FLOAT (pr, OFS_PARM0));
}
#endif
#define MAX_PF_HULLS 64 // FIXME make dynamic? #define MAX_PF_HULLS 64 // FIXME make dynamic?
clip_hull_t *pf_hull_list[MAX_PF_HULLS]; clip_hull_t *pf_hull_list[MAX_PF_HULLS];
@ -1654,16 +1404,6 @@ SV_PR_Cmds_Init ()
PR_AddBuiltin (&sv_pr_state, "writestring", PF_WriteString, 58); // void(float to, string s) WriteString = #58 PR_AddBuiltin (&sv_pr_state, "writestring", PF_WriteString, 58); // void(float to, string s) WriteString = #58
PR_AddBuiltin (&sv_pr_state, "writeentity", PF_WriteEntity, 59); // void(float to, entity s) WriteEntity = #59 PR_AddBuiltin (&sv_pr_state, "writeentity", PF_WriteEntity, 59); // void(float to, entity s) WriteEntity = #59
#ifdef QUAKE2
/* PF_sin,
PF_cos,
PF_sqrt,
PF_changepitch,
PF_TraceToss,
PF_etos,
PF_WaterMove, */
#endif
PR_AddBuiltin (&sv_pr_state, "movetogoal", SV_MoveToGoal, 67); // void(float step) movetogoal = #67 PR_AddBuiltin (&sv_pr_state, "movetogoal", SV_MoveToGoal, 67); // void(float step) movetogoal = #67
PR_AddBuiltin (&sv_pr_state, "precache_file", PF_precache_file, 68); // string(string s) precache_file = #68 PR_AddBuiltin (&sv_pr_state, "precache_file", PF_precache_file, 68); // string(string s) precache_file = #68
PR_AddBuiltin (&sv_pr_state, "makestatic", PF_makestatic, 69); // void(entity e) makestatic = #69 PR_AddBuiltin (&sv_pr_state, "makestatic", PF_makestatic, 69); // void(entity e) makestatic = #69

View file

@ -393,12 +393,6 @@ SV_WriteEntitiesToClient (edict_t *clent, sizebuf_t *msg)
// send over all entities (excpet the client) that touch the pvs // send over all entities (excpet the client) that touch the pvs
ent = NEXT_EDICT (&sv_pr_state, sv.edicts); ent = NEXT_EDICT (&sv_pr_state, sv.edicts);
for (e = 1; e < sv.num_edicts; e++, ent = NEXT_EDICT (&sv_pr_state, ent)) { for (e = 1; e < sv.num_edicts; e++, ent = NEXT_EDICT (&sv_pr_state, ent)) {
#ifdef QUAKE2
// don't send if flagged for NODRAW and there are no lighting effects
if (SVfloat (ent, effects) == EF_NODRAW)
continue;
#endif
// ignore if not touching a PV leaf // ignore if not touching a PV leaf
if (ent != clent) // clent is ALLWAYS sent if (ent != clent) // clent is ALLWAYS sent
{ {
@ -520,10 +514,7 @@ SV_WriteClientdataToMessage (edict_t *ent, sizebuf_t *msg)
{ {
int bits, items, i; int bits, items, i;
edict_t *other; edict_t *other;
#ifndef QUAKE2
pr_type_t *val; pr_type_t *val;
#endif
// send a damage message // send a damage message
if (SVfloat (ent, dmg_take) || SVfloat (ent, dmg_save)) { if (SVfloat (ent, dmg_take) || SVfloat (ent, dmg_save)) {
@ -561,9 +552,6 @@ SV_WriteClientdataToMessage (edict_t *ent, sizebuf_t *msg)
// stuff the sigil bits into the high bits of items for sbar, or else // stuff the sigil bits into the high bits of items for sbar, or else
// mix in items2 // mix in items2
#ifdef QUAKE2
items = (int) SVfloat (ent, items) | ((int) SVfloat (ent, items2) << 23);
#else
val = GetEdictFieldValue (&sv_pr_state, ent, "items2"); val = GetEdictFieldValue (&sv_pr_state, ent, "items2");
if (val) if (val)
@ -571,7 +559,6 @@ SV_WriteClientdataToMessage (edict_t *ent, sizebuf_t *msg)
else else
items = (int) SVfloat (ent, items) | ((int) *sv_globals.serverflags << items = (int) SVfloat (ent, items) | ((int) *sv_globals.serverflags <<
28); 28);
#endif
bits |= SU_ITEMS; bits |= SU_ITEMS;
@ -886,11 +873,7 @@ SV_SendReconnect (void)
NET_SendToAll (&msg, 5); NET_SendToAll (&msg, 5);
if (cls.state != ca_dedicated) if (cls.state != ca_dedicated)
#ifdef QUAKE2
Cbuf_InsertText ("reconnect\n");
#else
Cmd_ExecuteString ("reconnect\n", src_command); Cmd_ExecuteString ("reconnect\n", src_command);
#endif
} }
/* /*
@ -929,13 +912,8 @@ extern float scr_centertime_off;
This is called at the start of each level This is called at the start of each level
*/ */
#ifdef QUAKE2
void
SV_SpawnServer (const char *server, const char *startspot)
#else
void void
SV_SpawnServer (const char *server) SV_SpawnServer (const char *server)
#endif
{ {
int i; int i;
edict_t *ent; edict_t *ent;
@ -970,10 +948,6 @@ SV_SpawnServer (const char *server)
memset (&sv, 0, sizeof (sv)); memset (&sv, 0, sizeof (sv));
strcpy (sv.name, server); strcpy (sv.name, server);
#ifdef QUAKE2
if (startspot)
strcpy (sv.startspot, startspot);
#endif
// load progs to get entity field count // load progs to get entity field count
SV_LoadProgs (); SV_LoadProgs ();
@ -1049,10 +1023,6 @@ SV_SpawnServer (const char *server)
*sv_globals.deathmatch = deathmatch->int_val; *sv_globals.deathmatch = deathmatch->int_val;
*sv_globals.mapname = PR_SetString (&sv_pr_state, sv.name); *sv_globals.mapname = PR_SetString (&sv_pr_state, sv.name);
#ifdef QUAKE2
*sv_globals.startspot =
PR_SetString (&sv_pr_state, sv.startspot);
#endif
// serverflags are for cross level information (sigils) // serverflags are for cross level information (sigils)
*sv_globals.serverflags = svs.serverflags; *sv_globals.serverflags = svs.serverflags;

View file

@ -60,10 +60,6 @@ cvar_t *sv_gravity;
cvar_t *sv_maxvelocity; cvar_t *sv_maxvelocity;
cvar_t *sv_nostep; cvar_t *sv_nostep;
#ifdef QUAKE2
static vec3_t vec_origin = { 0.0, 0.0, 0.0 };
#endif
#define MOVE_EPSILON 0.01 #define MOVE_EPSILON 0.01
void SV_Physics_Toss (edict_t *ent); void SV_Physics_Toss (edict_t *ent);
@ -83,9 +79,6 @@ SV_CheckAllEnts (void)
continue; continue;
if (SVfloat (check, movetype) == MOVETYPE_PUSH if (SVfloat (check, movetype) == MOVETYPE_PUSH
|| SVfloat (check, movetype) == MOVETYPE_NONE || SVfloat (check, movetype) == MOVETYPE_NONE
#ifdef QUAKE2
|| SVfloat (check, movetype) == MOVETYPE_FOLLOW
#endif
|| SVfloat (check, movetype) == MOVETYPE_NOCLIP) || SVfloat (check, movetype) == MOVETYPE_NOCLIP)
continue; continue;
@ -343,12 +336,6 @@ SV_AddGravity (edict_t *ent)
{ {
float ent_gravity; float ent_gravity;
#ifdef QUAKE2
if (SVfloat (ent, gravity))
ent_gravity = SVfloat (ent, gravity);
else
ent_gravity = 1.0;
#else
pr_type_t *val; pr_type_t *val;
val = GetEdictFieldValue (&sv_pr_state, ent, "gravity"); val = GetEdictFieldValue (&sv_pr_state, ent, "gravity");
@ -356,7 +343,6 @@ SV_AddGravity (edict_t *ent)
ent_gravity = val->float_var; ent_gravity = val->float_var;
else else
ent_gravity = 1.0; ent_gravity = 1.0;
#endif
SVvector (ent, velocity)[2] -= ent_gravity * sv_gravity->value * host_frametime; SVvector (ent, velocity)[2] -= ent_gravity * sv_gravity->value * host_frametime;
} }
@ -433,9 +419,6 @@ SV_PushMove (edict_t *pusher, float movetime)
continue; continue;
if (SVfloat (check, movetype) == MOVETYPE_PUSH if (SVfloat (check, movetype) == MOVETYPE_PUSH
|| SVfloat (check, movetype) == MOVETYPE_NONE || SVfloat (check, movetype) == MOVETYPE_NONE
#ifdef QUAKE2
|| SVfloat (check, movetype) == MOVETYPE_FOLLOW
#endif
|| SVfloat (check, movetype) == MOVETYPE_NOCLIP) || SVfloat (check, movetype) == MOVETYPE_NOCLIP)
continue; continue;
@ -510,136 +493,6 @@ SV_PushMove (edict_t *pusher, float movetime)
} }
#ifdef QUAKE2
void
SV_PushRotate (edict_t *pusher, float movetime)
{
int i, e;
edict_t *check, *block;
vec3_t move, a, amove;
vec3_t entorig, pushorig;
int num_moved;
edict_t *moved_edict[MAX_EDICTS];
vec3_t moved_from[MAX_EDICTS];
vec3_t org, org2;
vec3_t forward, right, up;
if (!SVfloat (pusher, avelocity)[0] && !SVfloat (pusher, avelocity)[1]
&& !SVfloat (pusher, avelocity)[2]) {
SVfloat (pusher, ltime) += movetime;
return;
}
for (i = 0; i < 3; i++)
amove[i] = SVfloat (pusher, avelocity)[i] * movetime;
VectorSubtract (vec3_origin, amove, a);
AngleVectors (a, forward, right, up);
VectorCopy (SVfloat (pusher, angles), pushorig);
// move the pusher to it's final position
VectorAdd (SVfloat (pusher, angles), amove, SVfloat (pusher, angles));
SVfloat (pusher, ltime) += movetime;
SV_LinkEdict (pusher, false);
// see if any solid entities are inside the final position
num_moved = 0;
check = NEXT_EDICT (&sv_pr_state, sv.edicts);
for (e = 1; e < sv.num_edicts;
e++, check = NEXT_EDICT (&sv_pr_state, check)) {
if (check->free)
continue;
if (SVfloat (check, movetype) == MOVETYPE_PUSH
|| SVfloat (check, movetype) == MOVETYPE_NONE
|| SVfloat (check, movetype) == MOVETYPE_FOLLOW
|| SVfloat (check, movetype) == MOVETYPE_NOCLIP) continue;
// if the entity is standing on the pusher, it will definately be moved
if (!(((int) SVfloat (check, flags) & FL_ONGROUND)
&& PROG_TO_EDICT (&sv_pr_state,
SVfloat (check, groundentity)) == pusher)) {
if (SVfloat (check, absmin)[0] >= SVfloat (pusher, absmax)[0]
|| SVfloat (check, absmin)[1] >= SVfloat (pusher, absmax)[1]
|| SVfloat (check, absmin)[2] >= SVfloat (pusher, absmax)[2]
|| SVfloat (check, absmax)[0] <= SVfloat (pusher, absmin)[0]
|| SVfloat (check, absmax)[1] <= SVfloat (pusher, absmin)[1]
|| SVfloat (check, absmax)[2] <= SVfloat (pusher, absmin)[2])
continue;
// see if the ent's bbox is inside the pusher's final position
if (!SV_TestEntityPosition (check))
continue;
}
// remove the onground flag for non-players
if (SVfloat (check, movetype) != MOVETYPE_WALK)
SVfloat (check, flags) = (int) SVfloat (check, flags) &
~FL_ONGROUND;
VectorCopy (SVfloat (check, origin), entorig);
VectorCopy (SVfloat (check, origin), moved_from[num_moved]);
moved_edict[num_moved] = check;
num_moved++;
// calculate destination position
VectorSubtract (SVfloat (check, origin), SVfloat (pusher, origin),
org);
org2[0] = DotProduct (org, forward);
org2[1] = -DotProduct (org, right);
org2[2] = DotProduct (org, up);
VectorSubtract (org2, org, move);
// try moving the contacted entity
SVfloat (pusher, solid) = SOLID_NOT;
SV_PushEntity (check, move);
SVfloat (pusher, solid) = SOLID_BSP;
// if it is still inside the pusher, block
block = SV_TestEntityPosition (check);
if (block) { // fail the move
if (SVfloat (check, mins)[0] == SVfloat (check, maxs)[0])
continue;
if (SVfloat (check, solid) == SOLID_NOT || SVfloat (check, solid)
== SOLID_TRIGGER) { // corpse
SVfloat (check, mins)[0] = SVfloat (check, mins)[1] = 0;
VectorCopy (SVfloat (check, mins), SVfloat (check, maxs));
continue;
}
VectorCopy (entorig, SVfloat (check, origin));
SV_LinkEdict (check, true);
VectorCopy (pushorig, SVfloat (pusher, angles));
SV_LinkEdict (pusher, false);
SVfloat (pusher, ltime) -= movetime;
// if the pusher has a "blocked" function, call it
// otherwise, just stay in place until the obstacle is gone
if (SVfloat (pusher, blocked)) {
*sv_globals.self =
EDICT_TO_PROG (&sv_pr_state, pusher);
*sv_globals.other =
EDICT_TO_PROG (&sv_pr_state, check);
PR_ExecuteProgram (&sv_pr_state, SVfloat (pusher, blocked));
}
// move back any entities we already moved
for (i = 0; i < num_moved; i++) {
VectorCopy (moved_from[i], moved_edict[i]->v.v.origin);
VectorSubtract (moved_edict[i]->v.v.angles, amove,
moved_edict[i]->v.v.angles);
SV_LinkEdict (moved_edict[i], false);
}
return;
} else {
VectorAdd (SVfloat (check, angles), amove, SVfloat (check,
angles));
}
}
}
#endif
void void
SV_Physics_Pusher (edict_t *ent) SV_Physics_Pusher (edict_t *ent)
{ {
@ -656,14 +509,8 @@ SV_Physics_Pusher (edict_t *ent)
movetime = host_frametime; movetime = host_frametime;
if (movetime) { if (movetime) {
#ifdef QUAKE2 SV_PushMove (ent, movetime); // advances SVfloat (ent, ltime)
if (SVfloat (ent, avelocity)[0] || SVfloat (ent, avelocity)[1] // if not blocked
|| SVfloat (ent, avelocity)[2])
SV_PushRotate (ent, movetime);
else
#endif
SV_PushMove (ent, movetime); // advances SVfloat (ent, ltime)
// if not blocked
} }
if (thinktime > oldltime && thinktime <= SVfloat (ent, ltime)) { if (thinktime > oldltime && thinktime <= SVfloat (ent, ltime)) {
@ -729,10 +576,6 @@ SV_CheckWater (edict_t *ent)
int cont; int cont;
vec3_t point; vec3_t point;
#ifdef QUAKE2
int truecont;
#endif
point[0] = SVvector (ent, origin)[0]; point[0] = SVvector (ent, origin)[0];
point[1] = SVvector (ent, origin)[1]; point[1] = SVvector (ent, origin)[1];
point[2] = SVvector (ent, origin)[2] + SVvector (ent, mins)[2] + 1; point[2] = SVvector (ent, origin)[2] + SVvector (ent, mins)[2] + 1;
@ -741,9 +584,6 @@ SV_CheckWater (edict_t *ent)
SVfloat (ent, watertype) = CONTENTS_EMPTY; SVfloat (ent, watertype) = CONTENTS_EMPTY;
cont = SV_PointContents (point); cont = SV_PointContents (point);
if (cont <= CONTENTS_WATER) { if (cont <= CONTENTS_WATER) {
#ifdef QUAKE2
truecont = SV_TruePointContents (point);
#endif
SVfloat (ent, watertype) = cont; SVfloat (ent, watertype) = cont;
SVfloat (ent, waterlevel) = 1; SVfloat (ent, waterlevel) = 1;
point[2] = SVvector (ent, origin)[2] + (SVvector (ent, mins)[2] + point[2] = SVvector (ent, origin)[2] + (SVvector (ent, mins)[2] +
@ -756,24 +596,6 @@ SV_CheckWater (edict_t *ent)
if (cont <= CONTENTS_WATER) if (cont <= CONTENTS_WATER)
SVfloat (ent, waterlevel) = 3; SVfloat (ent, waterlevel) = 3;
} }
#ifdef QUAKE2
if (truecont <= CONTENTS_CURRENT_0 && truecont >=
CONTENTS_CURRENT_DOWN) {
static vec3_t current_table[] = {
{1, 0, 0},
{0, 1, 0},
{-1, 0, 0},
{0, -1, 0},
{0, 0, 1},
{0, 0, -1}
};
VectorMA (SVfloat (ent, basevelocity), 150.0 *
SVfloat (ent, waterlevel) / 3.0,
current_table[CONTENTS_CURRENT_0 - truecont],
SVfloat (ent, basevelocity));
}
#endif
} }
return SVfloat (ent, waterlevel) > 1; return SVfloat (ent, waterlevel) > 1;
@ -1001,16 +823,7 @@ SV_Physics_Client (edict_t *ent, int num)
FL_WATERJUMP)) FL_WATERJUMP))
SV_AddGravity (ent); SV_AddGravity (ent);
SV_CheckStuck (ent); SV_CheckStuck (ent);
#ifdef QUAKE2
VectorAdd (SVfloat (ent, velocity), SVfloat (ent, basevelocity),
SVfloat (ent, velocity));
#endif
SV_WalkMove (ent); SV_WalkMove (ent);
#ifdef QUAKE2
VectorSubtract (SVfloat (ent, velocity), SVfloat (ent, basevelocity),
SVfloat (ent, velocity));
#endif
break; break;
case MOVETYPE_TOSS: case MOVETYPE_TOSS:
@ -1057,23 +870,6 @@ SV_Physics_None (edict_t *ent)
SV_RunThink (ent); SV_RunThink (ent);
} }
#ifdef QUAKE2
/*
SV_Physics_Follow
Entities that are "stuck" to another entity
*/
void
SV_Physics_Follow (edict_t *ent)
{
// regular thinking
SV_RunThink (ent);
VectorAdd (PROG_TO_EDICT (&sv_pr_state, SVfloat (ent, aiment))->v.v.origin,
SVfloat (ent, v_angle), SVfloat (ent, origin));
SV_LinkEdict (ent, true);
}
#endif
/* /*
SV_Physics_Noclip SV_Physics_Noclip
@ -1101,16 +897,7 @@ SV_CheckWaterTransition (edict_t *ent)
{ {
int cont; int cont;
#ifdef QUAKE2
vec3_t point;
point[0] = SVvector (ent, origin)[0];
point[1] = SVvector (ent, origin)[1];
point[2] = SVvector (ent, origin)[2] + SVvector (ent, mins)[2] + 1;
cont = SV_PointContents (point);
#else
cont = SV_PointContents (SVvector (ent, origin)); cont = SV_PointContents (SVvector (ent, origin));
#endif
if (!SVfloat (ent, watertype)) { // just spawned here if (!SVfloat (ent, watertype)) { // just spawned here
SVfloat (ent, watertype) = cont; SVfloat (ent, watertype) = cont;
@ -1147,39 +934,10 @@ SV_Physics_Toss (edict_t *ent)
trace_t trace; trace_t trace;
vec3_t move; vec3_t move;
#ifdef QUAKE2
edict_t *groundentity;
groundentity = PROG_TO_EDICT (&sv_pr_state, SVentity (ent, groundentity));
if ((int) SVfloat (groundentity, flags) & FL_CONVEYOR)
VectorScale (SVfloat (groundentity, movedir),
SVfloat (groundentity, speed),
SVfloat (ent, basevelocity));
else
VectorCopy (vec_origin, SVfloat (ent, basevelocity));
SV_CheckWater (ent);
#endif
// regular thinking // regular thinking
if (!SV_RunThink (ent)) if (!SV_RunThink (ent))
return; return;
#ifdef QUAKE2
if (SVfloat (ent, velocity)[2] > 0)
SVfloat (ent, flags) = (int) SVfloat (ent, flags) & ~FL_ONGROUND;
if (((int) SVfloat (ent, flags) & FL_ONGROUND))
//@@
if (VectorCompare (SVfloat (ent, basevelocity), vec_origin))
return;
SV_CheckVelocity (ent);
// add gravity
if (!((int) SVfloat (ent, flags) & FL_ONGROUND)
&& SVfloat (ent, movetype) != MOVETYPE_FLY
&& SVfloat (ent, movetype) != MOVETYPE_BOUNCEMISSILE
&& SVfloat (ent, movetype) != MOVETYPE_FLYMISSILE) SV_AddGravity (ent);
#else
// if onground, return without moving // if onground, return without moving
if (((int) SVfloat (ent, flags) & FL_ONGROUND)) if (((int) SVfloat (ent, flags) & FL_ONGROUND))
return; return;
@ -1189,23 +947,14 @@ SV_Physics_Toss (edict_t *ent)
// add gravity // add gravity
if (SVfloat (ent, movetype) != MOVETYPE_FLY if (SVfloat (ent, movetype) != MOVETYPE_FLY
&& SVfloat (ent, movetype) != MOVETYPE_FLYMISSILE) SV_AddGravity (ent); && SVfloat (ent, movetype) != MOVETYPE_FLYMISSILE) SV_AddGravity (ent);
#endif
// move angles // move angles
VectorMA (SVvector (ent, angles), host_frametime, VectorMA (SVvector (ent, angles), host_frametime,
SVvector (ent, avelocity), SVvector (ent, angles)); SVvector (ent, avelocity), SVvector (ent, angles));
// move origin // move origin
#ifdef QUAKE2
VectorAdd (SVvector (ent, velocity), SVvector (ent, basevelocity),
SVvector (ent, velocity));
#endif
VectorScale (SVvector (ent, velocity), host_frametime, move); VectorScale (SVvector (ent, velocity), host_frametime, move);
trace = SV_PushEntity (ent, move); trace = SV_PushEntity (ent, move);
#ifdef QUAKE2
VectorSubtract (SVvector (ent, velocity), SVvector (ent, basevelocity),
SVvector (ent, velocity));
#endif
if (trace.fraction == 1) if (trace.fraction == 1)
return; return;
if (ent->free) if (ent->free)
@ -1213,10 +962,6 @@ SV_Physics_Toss (edict_t *ent)
if (SVfloat (ent, movetype) == MOVETYPE_BOUNCE) if (SVfloat (ent, movetype) == MOVETYPE_BOUNCE)
backoff = 1.5; backoff = 1.5;
#ifdef QUAKE2
else if (SVfloat (ent, movetype) == MOVETYPE_BOUNCEMISSILE)
backoff = 2.0;
#endif
else else
backoff = 1; backoff = 1;
@ -1225,14 +970,8 @@ SV_Physics_Toss (edict_t *ent)
// stop if on ground // stop if on ground
if (trace.plane.normal[2] > 0.7) { if (trace.plane.normal[2] > 0.7) {
#ifdef QUAKE2 if (SVvector (ent, velocity)[2] < 60 || SVfloat (ent, movetype) !=
if (SVvector (ent, velocity)[2] < 60 MOVETYPE_BOUNCE)
|| (SVfloat (ent, movetype) != MOVETYPE_BOUNCE
&& SVfloat (ent, movetype) != MOVETYPE_BOUNCEMISSILE))
#else
if (SVvector (ent, velocity)[2] < 60 || SVfloat (ent, movetype) !=
MOVETYPE_BOUNCE)
#endif
{ {
SVfloat (ent, flags) = (int) SVfloat (ent, flags) | FL_ONGROUND; SVfloat (ent, flags) = (int) SVfloat (ent, flags) | FL_ONGROUND;
SVentity (ent, groundentity) = EDICT_TO_PROG (&sv_pr_state, SVentity (ent, groundentity) = EDICT_TO_PROG (&sv_pr_state,
@ -1256,110 +995,6 @@ SV_Physics_Toss (edict_t *ent)
This is also used for objects that have become still on the ground, but This is also used for objects that have become still on the ground, but
will fall if the floor is pulled out from under them. will fall if the floor is pulled out from under them.
*/ */
#ifdef QUAKE2
void
SV_Physics_Step (edict_t *ent)
{
float control, friction, speed, newspeed;
float *vel;
edict_t *groundentity;
qboolean wasonground, inwater;
qboolean hitsound = false;
groundentity = PROG_TO_EDICT (&sv_pr_state, SVfloat (ent, groundentity));
if ((int) SVfloat (groundentity, flags) & FL_CONVEYOR)
VectorScale (SVfloat (groundentity, movedir),
SVfloat (groundentity, speed),
SVfloat (ent, basevelocity));
else
VectorCopy (vec_origin, SVfloat (ent, basevelocity));
//@@
*sv_globals.time = sv.time;
*sv_globals.self = EDICT_TO_PROG (&sv_pr_state, ent);
PF_WaterMove (&sv_pr_state);
SV_CheckVelocity (ent);
wasonground = (int) SVfloat (ent, flags) & FL_ONGROUND;
// SVfloat (ent, flags) = (int)SVfloat (ent, flags) & ~FL_ONGROUND;
// add gravity except:
// flying monsters and swimming monsters who are in the water
inwater = SV_CheckWater (ent);
if (!wasonground)
if (!((int) SVfloat (ent, flags) & FL_FLY))
if (!(((int) SVfloat (ent, flags) & FL_SWIM)
&& (SVfloat (ent, waterlevel) > 0))) {
if (SVfloat (ent, velocity)[2] < sv_gravity->value * -0.1)
hitsound = true;
if (!inwater)
SV_AddGravity (ent);
}
if (!VectorCompare (SVfloat (ent, velocity), vec_origin)
|| !VectorCompare (SVfloat (ent, basevelocity), vec_origin)) {
SVfloat (ent, flags) = (int) SVfloat (ent, flags) & ~FL_ONGROUND;
// apply friction
// let dead monsters who aren't completely onground slide
if (wasonground)
if (!(SVfloat (ent, health) <= 0.0 && !SV_CheckBottom (ent))) {
vel = SVfloat (ent, velocity);
speed = sqrt (vel[0] * vel[0] + vel[1] * vel[1]);
if (speed) {
friction = sv_friction->value;
control = speed <sv_stopspeed->value ?
sv_stopspeed->value : speed;
newspeed = speed - host_frametime * control * friction;
if (newspeed < 0)
newspeed = 0;
newspeed /= speed;
vel[0] = vel[0] * newspeed;
vel[1] = vel[1] * newspeed;
}
}
VectorAdd (SVfloat (ent, velocity), SVfloat (ent, basevelocity),
SVfloat (ent, velocity));
SV_FlyMove (ent, host_frametime, NULL);
VectorSubtract (SVfloat (ent, velocity), SVfloat (ent, basevelocity),
SVfloat (ent, velocity));
// determine if it's on solid ground at all
{
int x, y;
vec3_t mins, maxs, point;
VectorAdd (SVfloat (ent, origin), SVfloat (ent, mins), mins);
VectorAdd (SVfloat (ent, origin), SVfloat (ent, maxs), maxs);
point[2] = mins[2] - 1;
for (x = 0; x <= 1; x++)
for (y = 0; y <= 1; y++) {
point[0] = x ? maxs[0] : mins[0];
point[1] = y ? maxs[1] : mins[1];
if (SV_PointContents (point) == CONTENTS_SOLID) {
SVfloat (ent, flags) = (int) SVfloat (ent, flags) |
FL_ONGROUND;
break;
}
}
}
SV_LinkEdict (ent, true);
if ((int) SVfloat (ent, flags) & FL_ONGROUND)
if (!wasonground)
if (hitsound)
SV_StartSound (ent, 0, "demon/dland2.wav", 255, 1);
}
// regular thinking
SV_RunThink (ent);
SV_CheckWaterTransition (ent);
}
#else
void void
SV_Physics_Step (edict_t *ent) SV_Physics_Step (edict_t *ent)
{ {
@ -1388,7 +1023,6 @@ SV_Physics_Step (edict_t *ent)
SV_CheckWaterTransition (ent); SV_CheckWaterTransition (ent);
} }
#endif
void void
SV_Physics (void) SV_Physics (void)
@ -1422,19 +1056,12 @@ SV_Physics (void)
SV_Physics_Pusher (ent); SV_Physics_Pusher (ent);
else if (SVfloat (ent, movetype) == MOVETYPE_NONE) else if (SVfloat (ent, movetype) == MOVETYPE_NONE)
SV_Physics_None (ent); SV_Physics_None (ent);
#ifdef QUAKE2
else if (SVfloat (ent, movetype) == MOVETYPE_FOLLOW)
SV_Physics_Follow (ent);
#endif
else if (SVfloat (ent, movetype) == MOVETYPE_NOCLIP) else if (SVfloat (ent, movetype) == MOVETYPE_NOCLIP)
SV_Physics_Noclip (ent); SV_Physics_Noclip (ent);
else if (SVfloat (ent, movetype) == MOVETYPE_STEP) else if (SVfloat (ent, movetype) == MOVETYPE_STEP)
SV_Physics_Step (ent); SV_Physics_Step (ent);
else if (SVfloat (ent, movetype) == MOVETYPE_TOSS else if (SVfloat (ent, movetype) == MOVETYPE_TOSS
|| SVfloat (ent, movetype) == MOVETYPE_BOUNCE || SVfloat (ent, movetype) == MOVETYPE_BOUNCE
#ifdef QUAKE2
|| SVfloat (ent, movetype) == MOVETYPE_BOUNCEMISSILE
#endif
|| SVfloat (ent, movetype) == MOVETYPE_FLY || SVfloat (ent, movetype) == MOVETYPE_FLY
|| SVfloat (ent, movetype) == MOVETYPE_FLYMISSILE) || SVfloat (ent, movetype) == MOVETYPE_FLYMISSILE)
SV_Physics_Toss (ent); SV_Physics_Toss (ent);
@ -1448,58 +1075,3 @@ SV_Physics (void)
sv.time += host_frametime; sv.time += host_frametime;
} }
#ifdef QUAKE2
trace_t
SV_Trace_Toss (edict_t *ent, edict_t *ignore)
{
double save_frametime;
vec3_t end, move;
edict_t tempent, *tent;
trace_t trace;
// extern particle_t *active_particles, *free_particles;
// particle_t *p;
save_frametime = host_frametime;
host_frametime = 0.05;
memcpy (&tempent, ent, sizeof (edict_t));
tent = &tempent;
while (1) {
SV_CheckVelocity (tent);
SV_AddGravity (tent);
VectorMA (SVfloat (tent, angles), host_frametime,
SVfloat (tent, avelocity), SVfloat (tent, angles));
VectorScale (SVfloat (tent, velocity), host_frametime, move);
VectorAdd (SVfloat (tent, origin), move, end);
trace =
SV_Move (SVfloat (tent, origin), SVfloat (tent, mins), SVfloat (tent, maxs), end,
MOVE_NORMAL, tent);
VectorCopy (trace.endpos, SVfloat (tent, origin));
// p = free_particles;
// if (p)
// {
// free_particles = p->next;
// p->next = active_particles;
// active_particles = p;
//
// p->die = 256;
// p->color = 15;
// p->type = pt_static;
// VectorCopy (vec3_origin, p->vel);
// VectorCopy (SVfloat (tent, origin), p->org);
// }
if (trace.ent)
if (trace.ent != ignore)
break;
}
// p->color = 224;
host_frametime = save_frametime;
return trace;
}
#endif

View file

@ -437,11 +437,6 @@ SV_ReadClientMove (usercmd_t *move)
i = MSG_ReadByte (net_message); i = MSG_ReadByte (net_message);
if (i) if (i)
SVfloat (host_client->edict, impulse) = i; SVfloat (host_client->edict, impulse) = i;
#ifdef QUAKE2
// read light level
SVfloat (host_client->edict, light_level) = MSG_ReadByte (net_message);
#endif
} }
/* /*

View file

@ -244,10 +244,6 @@
#define TE_TELEPORT 11 #define TE_TELEPORT 11
#define TE_BLOOD 12 #define TE_BLOOD 12
#define TE_LIGHTNINGBLOOD 13 #define TE_LIGHTNINGBLOOD 13
#ifdef QUAKE2
#define TE_IMPLOSION 14
#define TE_RAILTRAIL 15
#endif
#define TE_EXPLOSION2 16 #define TE_EXPLOSION2 16
// PGM 01/21/97 // PGM 01/21/97
#define TE_BEAM 17 #define TE_BEAM 17

View file

@ -83,10 +83,6 @@ sfx_t *cl_sfx_ric1;
sfx_t *cl_sfx_ric2; sfx_t *cl_sfx_ric2;
sfx_t *cl_sfx_ric3; sfx_t *cl_sfx_ric3;
sfx_t *cl_sfx_r_exp3; sfx_t *cl_sfx_r_exp3;
#ifdef QUAKE2
sfx_t *cl_sfx_imp;
sfx_t *cl_sfx_rail;
#endif
model_t *cl_mod_bolt; model_t *cl_mod_bolt;
model_t *cl_mod_bolt2; model_t *cl_mod_bolt2;
@ -124,10 +120,6 @@ CL_TEnts_Init (void)
cl_sfx_ric2 = S_PrecacheSound ("weapons/ric2.wav"); cl_sfx_ric2 = S_PrecacheSound ("weapons/ric2.wav");
cl_sfx_ric3 = S_PrecacheSound ("weapons/ric3.wav"); cl_sfx_ric3 = S_PrecacheSound ("weapons/ric3.wav");
cl_sfx_r_exp3 = S_PrecacheSound ("weapons/r_exp3.wav"); cl_sfx_r_exp3 = S_PrecacheSound ("weapons/r_exp3.wav");
#ifdef QUAKE2
cl_sfx_imp = S_PrecacheSound ("shambler/sattck1.wav");
cl_sfx_rail = S_PrecacheSound ("weapons/lstart.wav");
#endif
cl_mod_bolt = Mod_ForName ("progs/bolt.mdl", true); cl_mod_bolt = Mod_ForName ("progs/bolt.mdl", true);
cl_mod_bolt2 = Mod_ForName ("progs/bolt2.mdl", true); cl_mod_bolt2 = Mod_ForName ("progs/bolt2.mdl", true);
@ -243,9 +235,6 @@ CL_ParseTEnt (void)
{ {
byte type; byte type;
vec3_t pos; vec3_t pos;
#ifdef QUAKE2
vec3_t endpos;
#endif
dlight_t *dl; dlight_t *dl;
int rnd; int rnd;
int colorStart, colorLength; int colorStart, colorLength;
@ -404,38 +393,6 @@ CL_ParseTEnt (void)
R_RunPuffEffect (pos, prot_to_rend[type], cnt); R_RunPuffEffect (pos, prot_to_rend[type], cnt);
break; break;
#ifdef QUAKE2
case TE_IMPLOSION:
pos[0] = MSG_ReadCoord (net_message);
pos[1] = MSG_ReadCoord (net_message);
pos[2] = MSG_ReadCoord (net_message);
S_StartSound (-1, 0, cl_sfx_imp, pos, 1, 1);
break;
case TE_RAILTRAIL:
pos[0] = MSG_ReadCoord (net_message);
pos[1] = MSG_ReadCoord (net_message);
pos[2] = MSG_ReadCoord (net_message);
endpos[0] = MSG_ReadCoord (net_message);
endpos[1] = MSG_ReadCoord (net_message);
endpos[2] = MSG_ReadCoord (net_message);
S_StartSound (-1, 0, cl_sfx_rail, pos, 1, 1);
S_StartSound (-1, 1, cl_sfx_r_exp3, endpos, 1, 1);
/* Need updating to new Particle API
R_RocketTrail (pos, endpos, 0 + 128);
R_ParticleExplosion (endpos);
*/
dl = R_AllocDlight (-1);
VectorCopy (endpos, dl->origin);
dl->radius = 350;
dl->die = cl.time + 0.5;
dl->decay = 300;
dl->color[0] = 0.86;
dl->color[1] = 0.31;
dl->color[2] = 0.24;
break;
#endif
default: default:
Sys_Error ("CL_ParseTEnt: bad type"); Sys_Error ("CL_ParseTEnt: bad type");
} }