Rogue-Cleanup stufe 3

This commit is contained in:
Yamagi Burmeister 2009-03-12 17:36:35 +00:00
parent b8e40ec947
commit aaa166297e
7 changed files with 78 additions and 182 deletions

View file

@ -83,7 +83,7 @@ field_t fields[] = {
{"pausetime", STOFS(pausetime), F_FLOAT, FFL_SPAWNTEMP}, {"pausetime", STOFS(pausetime), F_FLOAT, FFL_SPAWNTEMP},
{"item", STOFS(item), F_LSTRING, FFL_SPAWNTEMP}, {"item", STOFS(item), F_LSTRING, FFL_SPAWNTEMP},
//need for item field in edict struct, FFL_SPAWNTEMP item will be skipped on saves // need for item field in edict struct, FFL_SPAWNTEMP item will be skipped on saves
{"item", FOFS(item), F_ITEM}, {"item", FOFS(item), F_ITEM},
{"gravity", STOFS(gravity), F_LSTRING, FFL_SPAWNTEMP}, {"gravity", STOFS(gravity), F_LSTRING, FFL_SPAWNTEMP},
@ -164,7 +164,8 @@ void InitGame (void)
fraglimit = gi.cvar ("fraglimit", "0", CVAR_SERVERINFO); fraglimit = gi.cvar ("fraglimit", "0", CVAR_SERVERINFO);
timelimit = gi.cvar ("timelimit", "0", CVAR_SERVERINFO); timelimit = gi.cvar ("timelimit", "0", CVAR_SERVERINFO);
password = gi.cvar ("password", "", CVAR_USERINFO); password = gi.cvar ("password", "", CVAR_USERINFO);
spectator_password = gi.cvar ("spectator_password", "", 0); spectator_password = gi.cvar ("spectator_password", "", CVAR_USERINFO);
needpass = gi.cvar ("needpass", "0", CVAR_SERVERINFO);
filterban = gi.cvar ("filterban", "1", 0); filterban = gi.cvar ("filterban", "1", 0);
g_select_empty = gi.cvar ("g_select_empty", "0", CVAR_ARCHIVE); g_select_empty = gi.cvar ("g_select_empty", "0", CVAR_ARCHIVE);
@ -295,6 +296,8 @@ void WriteField2 (FILE *f, field_t *field, byte *base)
fwrite (*(char **)p, len, 1, f); fwrite (*(char **)p, len, 1, f);
} }
break; break;
default:
break;
} }
} }
@ -323,7 +326,11 @@ void ReadField (FILE *f, field_t *field, byte *base)
*(char **)p = NULL; *(char **)p = NULL;
else else
{ {
*(char **)p = gi.TagMalloc (len, TAG_LEVEL); /*
SBF: FIXME - 32 extra bytes alloc'd since the saved
string might not be long enough
*/
*(char **)p = gi.TagMalloc (32+len, TAG_LEVEL);
fread (*(char **)p, len, 1, f); fread (*(char **)p, len, 1, f);
} }
break; break;
@ -438,7 +445,7 @@ A single player death will automatically restore from the
last save position. last save position.
============ ============
*/ */
void WriteGame (char *filename, qboolean autosave) void WriteGame (const char *filename, qboolean autosave)
{ {
FILE *f; FILE *f;
int i; int i;
@ -465,7 +472,7 @@ void WriteGame (char *filename, qboolean autosave)
fclose (f); fclose (f);
} }
void ReadGame (char *filename) void ReadGame (const char *filename)
{ {
FILE *f; FILE *f;
int i; int i;
@ -606,7 +613,7 @@ WriteLevel
================= =================
*/ */
void WriteLevel (char *filename) void WriteLevel (const char *filename)
{ {
int i; int i;
edict_t *ent; edict_t *ent;
@ -660,7 +667,7 @@ calling ReadLevel.
No clients are connected yet. No clients are connected yet.
================= =================
*/ */
void ReadLevel (char *filename) void ReadLevel (const char *filename)
{ {
int entnum; int entnum;
FILE *f; FILE *f;
@ -690,15 +697,7 @@ void ReadLevel (char *filename)
// check function pointer base address // check function pointer base address
fread (&base, sizeof(base), 1, f); fread (&base, sizeof(base), 1, f);
#ifdef _WIN32
if (base != (void *)InitGame)
{
fclose (f);
gi.error ("ReadLevel: function pointers have moved");
}
#else
gi.dprintf("Function offsets %d\n", ((byte *)base) - ((byte *)InitGame)); gi.dprintf("Function offsets %d\n", ((byte *)base) - ((byte *)InitGame));
#endif
// load the level locals // load the level locals
ReadLevelLocals (f); ReadLevelLocals (f);
@ -748,3 +747,4 @@ void ReadLevel (char *filename)
ent->nextthink = level.time + ent->delay; ent->nextthink = level.time + ent->delay;
} }
} }

View file

@ -345,7 +345,7 @@ void ED_CallSpawn (edict_t *ent)
ED_NewString ED_NewString
============= =============
*/ */
char *ED_NewString (char *string) char *ED_NewString (const char *string)
{ {
char *newb, *new_p; char *newb, *new_p;
int i,l; int i,l;
@ -384,7 +384,7 @@ Takes a key/value pair and sets the binary values
in an edict in an edict
=============== ===============
*/ */
void ED_ParseField (char *key, char *value, edict_t *ent) void ED_ParseField (const char *key, const char *value, edict_t *ent)
{ {
field_t *f; field_t *f;
byte *b; byte *b;
@ -425,6 +425,8 @@ void ED_ParseField (char *key, char *value, edict_t *ent)
break; break;
case F_IGNORE: case F_IGNORE:
break; break;
default:
break;
} }
return; return;
} }
@ -444,15 +446,15 @@ char *ED_ParseEdict (char *data, edict_t *ent)
{ {
qboolean init; qboolean init;
char keyname[256]; char keyname[256];
char *com_token; const char *com_token;
init = false; init = false;
memset (&st, 0, sizeof(st)); memset (&st, 0, sizeof(st));
// go through all the dictionary pairs // go through all the dictionary pairs
while (1) while (1)
{ {
// parse key // parse key
com_token = COM_Parse (&data); com_token = COM_Parse (&data);
if (com_token[0] == '}') if (com_token[0] == '}')
break; break;
@ -461,7 +463,7 @@ char *ED_ParseEdict (char *data, edict_t *ent)
strncpy (keyname, com_token, sizeof(keyname)-1); strncpy (keyname, com_token, sizeof(keyname)-1);
// parse value // parse value
com_token = COM_Parse (&data); com_token = COM_Parse (&data);
if (!data) if (!data)
gi.error ("ED_ParseEntity: EOF without closing brace"); gi.error ("ED_ParseEntity: EOF without closing brace");
@ -471,8 +473,8 @@ char *ED_ParseEdict (char *data, edict_t *ent)
init = true; init = true;
// keynames with a leading underscore are used for utility comments, // keynames with a leading underscore are used for utility comments,
// and are immediately discarded by quake // and are immediately discarded by quake
if (keyname[0] == '_') if (keyname[0] == '_')
continue; continue;
@ -546,11 +548,11 @@ Creates a server's entity / program execution context by
parsing textual entity definitions out of an ent file. parsing textual entity definitions out of an ent file.
============== ==============
*/ */
void SpawnEntities (char *mapname, char *entities, char *spawnpoint) void SpawnEntities (const char *mapname, char *entities, const char *spawnpoint)
{ {
edict_t *ent; edict_t *ent;
int inhibit; int inhibit;
char *com_token; const char *com_token;
int i; int i;
float skill_level; float skill_level;
@ -596,7 +598,7 @@ void SpawnEntities (char *mapname, char *entities, char *spawnpoint)
entities = ED_ParseEdict (entities, ent); entities = ED_ParseEdict (entities, ent);
// yet another map hack // yet another map hack
if (!stricmp(level.mapname, "command") && !stricmp(ent->classname, "trigger_once") && !stricmp(ent->model, "*27")) if (!Q_stricmp(level.mapname, "command") && !Q_stricmp(ent->classname, "trigger_once") && !Q_stricmp(ent->model, "*27"))
ent->spawnflags &= ~SPAWNFLAG_NOT_HARD; ent->spawnflags &= ~SPAWNFLAG_NOT_HARD;
// remove things (except the world) from different skill levels or deathmatch // remove things (except the world) from different skill levels or deathmatch
@ -633,16 +635,6 @@ void SpawnEntities (char *mapname, char *entities, char *spawnpoint)
gi.dprintf ("%i entities inhibited\n", inhibit); gi.dprintf ("%i entities inhibited\n", inhibit);
#ifdef DEBUG
i = 1;
ent = EDICT_NUM(i);
while (i < globals.num_edicts) {
if (ent->inuse != 0 || ent->inuse != 1)
Com_DPrintf("Invalid entity %d\n", i);
i++, ent++;
}
#endif
G_FindTeams (); G_FindTeams ();
PlayerTrail_Init (); PlayerTrail_Init ();
@ -651,29 +643,6 @@ void SpawnEntities (char *mapname, char *entities, char *spawnpoint)
//=================================================================== //===================================================================
#if 0
// cursor positioning
xl <value>
xr <value>
yb <value>
yt <value>
xv <value>
yv <value>
// drawing
statpic <name>
pic <stat>
num <fieldwidth> <stat>
string <stat>
// control
if <stat>
ifeq <stat> <value>
ifbit <stat> <value>
endif
#endif
char *single_statusbar = char *single_statusbar =
"yb -24 " "yb -24 "
@ -972,9 +941,9 @@ void SP_worldspawn (edict_t *ent)
gi.modelindex ("models/objects/gibs/skull/tris.md2"); gi.modelindex ("models/objects/gibs/skull/tris.md2");
gi.modelindex ("models/objects/gibs/head2/tris.md2"); gi.modelindex ("models/objects/gibs/head2/tris.md2");
// //
// Setup light animation tables. 'a' is total darkness, 'z' is doublebright. // Setup light animation tables. 'a' is total darkness, 'z' is doublebright.
// //
// 0 normal // 0 normal
gi.configstring(CS_LIGHTS+0, "m"); gi.configstring(CS_LIGHTS+0, "m");

View file

@ -157,7 +157,7 @@ void SP_target_secret (edict_t *ent)
ent->svflags = SVF_NOCLIENT; ent->svflags = SVF_NOCLIENT;
level.total_secrets++; level.total_secrets++;
// map bug hack // map bug hack
if (!stricmp(level.mapname, "mine3") && ent->s.origin[0] == 280 && ent->s.origin[1] == -2048 && ent->s.origin[2] == -624) if (!Q_stricmp(level.mapname, "mine3") && ent->s.origin[0] == 280 && ent->s.origin[1] == -2048 && ent->s.origin[2] == -624)
ent->message = "You have found a secret area."; ent->message = "You have found a secret area.";
} }
@ -290,7 +290,7 @@ void SP_target_changelevel (edict_t *ent)
} }
// ugly hack because *SOMEBODY* screwed up their map // ugly hack because *SOMEBODY* screwed up their map
if((stricmp(level.mapname, "fact1") == 0) && (stricmp(ent->map, "fact3") == 0)) if((Q_stricmp(level.mapname, "fact1") == 0) && (Q_stricmp(ent->map, "fact3") == 0))
ent->map = "fact3$secret1"; ent->map = "fact3$secret1";
ent->use = use_target_changelevel; ent->use = use_target_changelevel;
@ -344,7 +344,7 @@ void SP_target_splash (edict_t *self)
//========================================================== //==========================================================
/*QUAKED target_spawner (1 0 0) (-8 -8 -8) (8 8 8) 1 2 3 4 5 6 /*QUAKED target_spawner (1 0 0) (-8 -8 -8) (8 8 8)
Set target to the type of entity you want spawned. Set target to the type of entity you want spawned.
Useful for spawning monsters and gibs in the factory levels. Useful for spawning monsters and gibs in the factory levels.
@ -364,7 +364,6 @@ void use_target_spawner (edict_t *self, edict_t *other, edict_t *activator)
ent = G_Spawn(); ent = G_Spawn();
ent->classname = self->target; ent->classname = self->target;
ent->flags = self->flags;
VectorCopy (self->s.origin, ent->s.origin); VectorCopy (self->s.origin, ent->s.origin);
VectorCopy (self->s.angles, ent->s.angles); VectorCopy (self->s.angles, ent->s.angles);
ED_CallSpawn (ent); ED_CallSpawn (ent);
@ -880,3 +879,4 @@ void SP_target_earthquake (edict_t *self)
self->noise_index = gi.soundindex ("world/quake.wav"); self->noise_index = gi.soundindex ("world/quake.wav");
} }

View file

@ -367,7 +367,7 @@ trigger_push
============================================================================== ==============================================================================
*/ */
#if 0
#define PUSH_ONCE 1 #define PUSH_ONCE 1
static int windsound; static int windsound;
@ -397,52 +397,10 @@ void trigger_push_touch (edict_t *self, edict_t *other, cplane_t *plane, csurfac
G_FreeEdict (self); G_FreeEdict (self);
} }
void SP_trigger_push (edict_t *self)
{
InitTrigger (self);
windsound = gi.soundindex ("misc/windfly.wav");
self->touch = trigger_push_touch;
if (!self->speed)
self->speed = 1000;
gi.linkentity (self);
}
#endif
// RAFAEL
#define PUSH_ONCE 1
static int windsound;
void trigger_push_touch (edict_t *self, edict_t *other, cplane_t *plane, csurface_t *surf)
{
if (strcmp(other->classname, "grenade") == 0)
{
VectorScale (self->movedir, self->speed * 10, other->velocity);
}
else if (other->health > 0)
{
VectorScale (self->movedir, self->speed * 10, other->velocity);
if (other->client)
{
// don't take falling damage immediately from this
VectorCopy (other->velocity, other->client->oldvelocity);
if (other->fly_sound_debounce_time < level.time)
{
other->fly_sound_debounce_time = level.time + 1.5;
gi.sound (other, CHAN_AUTO, windsound, 1, ATTN_NORM, 0);
}
}
}
if (self->spawnflags & PUSH_ONCE)
G_FreeEdict (self);
}
/*QUAKED trigger_push (.5 .5 .5) ? PUSH_ONCE PUSH_PLUS PUSH_RAMP /*QUAKED trigger_push (.5 .5 .5) ? PUSH_ONCE PUSH_PLUS PUSH_RAMP
Pushes the player Pushes the player
"speed" defaults to 1000 "speed" defaults to 1000
"wait" defaults to 10 must use PUSH_PLUS used for on
*/ */
void trigger_push_active (edict_t *self); void trigger_push_active (edict_t *self);
@ -664,7 +622,7 @@ void trigger_monsterjump_touch (edict_t *self, edict_t *other, cplane_t *plane,
if ( !(other->svflags & SVF_MONSTER)) if ( !(other->svflags & SVF_MONSTER))
return; return;
// set XY even if not on ground, so the jump will clear lips // set XY even if not on ground, so the jump will clear lips
other->velocity[0] = self->movedir[0] * self->speed; other->velocity[0] = self->movedir[0] * self->speed;
other->velocity[1] = self->movedir[1] * self->speed; other->velocity[1] = self->movedir[1] * self->speed;

View file

@ -411,3 +411,4 @@ void SP_turret_driver (edict_t *self)
gi.linkentity (self); gi.linkentity (self);
} }

View file

@ -155,9 +155,9 @@ void G_UseTargets (edict_t *ent, edict_t *activator)
{ {
edict_t *t; edict_t *t;
// //
// check for a delay // check for a delay
// //
if (ent->delay) if (ent->delay)
{ {
// create a temp object to fire at a later time // create a temp object to fire at a later time
@ -175,9 +175,9 @@ void G_UseTargets (edict_t *ent, edict_t *activator)
} }
// //
// print the message // print the message
// //
if ((ent->message) && !(activator->svflags & SVF_MONSTER)) if ((ent->message) && !(activator->svflags & SVF_MONSTER))
{ {
gi.centerprintf (activator, "%s", ent->message); gi.centerprintf (activator, "%s", ent->message);
@ -187,9 +187,9 @@ void G_UseTargets (edict_t *ent, edict_t *activator)
gi.sound (activator, CHAN_AUTO, gi.soundindex ("misc/talk1.wav"), 1, ATTN_NORM, 0); gi.sound (activator, CHAN_AUTO, gi.soundindex ("misc/talk1.wav"), 1, ATTN_NORM, 0);
} }
// //
// kill killtargets // kill killtargets
// //
if (ent->killtarget) if (ent->killtarget)
{ {
t = NULL; t = NULL;
@ -204,9 +204,9 @@ void G_UseTargets (edict_t *ent, edict_t *activator)
} }
} }
// //
// fire targets // fire targets
// //
if (ent->target) if (ent->target)
{ {
t = NULL; t = NULL;
@ -315,14 +315,14 @@ float vectoyaw (vec3_t vec)
{ {
float yaw; float yaw;
if (/*vec[YAW] == 0 &&*/ vec[PITCH] == 0) if (/*vec[YAW] == 0 &&*/ vec[PITCH] == 0)
{ {
yaw = 0; yaw = 0;
if (vec[YAW] > 0) if (vec[YAW] > 0)
yaw = 90; yaw = 90;
else if (vec[YAW] < 0) else if (vec[YAW] < 0)
yaw = -90; yaw = -90;
} }
else else
{ {
yaw = (int) (atan2(vec[YAW], vec[PITCH]) * 180 / M_PI); yaw = (int) (atan2(vec[YAW], vec[PITCH]) * 180 / M_PI);
@ -436,7 +436,6 @@ void G_FreeEdict (edict_t *ed)
if ((ed - g_edicts) <= (maxclients->value + BODY_QUEUE_SIZE)) if ((ed - g_edicts) <= (maxclients->value + BODY_QUEUE_SIZE))
{ {
// gi.dprintf("tried to free special edict\n");
return; return;
} }
@ -508,9 +507,6 @@ void G_TouchSolids (edict_t *ent)
} }
} }
/* /*
============================================================================== ==============================================================================
@ -547,3 +543,4 @@ qboolean KillBox (edict_t *ent)
return true; // all clear return true; // all clear
} }

View file

@ -311,11 +311,7 @@ void blaster_touch (edict_t *self, edict_t *other, cplane_t *plane, csurface_t *
else else
{ {
gi.WriteByte (svc_temp_entity); gi.WriteByte (svc_temp_entity);
// RAFAEL gi.WriteByte (TE_BLASTER);
//if (self->s.effects & TE_BLUEHYPERBLASTER)
// gi.WriteByte (TE_BLUEHYPERBLASTER);
//else
gi.WriteByte (TE_BLASTER);
gi.WritePosition (self->s.origin); gi.WritePosition (self->s.origin);
if (!plane) if (!plane)
gi.WriteDir (vec3_origin); gi.WriteDir (vec3_origin);
@ -688,7 +684,7 @@ void fire_rail (edict_t *self, vec3_t start, vec3_t aimdir, int damage, int kick
vec3_t end; vec3_t end;
trace_t tr; trace_t tr;
edict_t *ignore; edict_t *ignore;
int mask; int mask;
qboolean water; qboolean water;
VectorMA (start, 8192, aimdir, end); VectorMA (start, 8192, aimdir, end);
@ -696,29 +692,28 @@ void fire_rail (edict_t *self, vec3_t start, vec3_t aimdir, int damage, int kick
ignore = self; ignore = self;
water = false; water = false;
mask = MASK_SHOT|CONTENTS_SLIME|CONTENTS_LAVA; mask = MASK_SHOT|CONTENTS_SLIME|CONTENTS_LAVA;
while (ignore) while (ignore) {
{ tr = gi.trace (from, NULL, NULL, end, ignore, mask);
tr = gi.trace (from, NULL, NULL, end, ignore, mask);
if (tr.contents & (CONTENTS_SLIME|CONTENTS_LAVA)) {
if (tr.contents & (CONTENTS_SLIME|CONTENTS_LAVA)) mask &= ~(CONTENTS_SLIME|CONTENTS_LAVA);
{ water = true;
mask &= ~(CONTENTS_SLIME|CONTENTS_LAVA); }
water = true; else {
} //ZOID--added so rail goes through SOLID_BBOX entities (gibs, etc)
else if ((tr.ent->svflags & SVF_MONSTER) || (tr.ent->client) ||
{ (tr.ent->solid == SOLID_BBOX))
//ZOID--added so rail goes through SOLID_BBOX entities (gibs, etc) ignore = tr.ent;
if ((tr.ent->svflags & SVF_MONSTER) || (tr.ent->client) || else
(tr.ent->solid == SOLID_BBOX)) ignore = NULL;
ignore = tr.ent;
else if ((tr.ent != self) && (tr.ent->takedamage))
ignore = NULL; T_Damage (tr.ent, self, self, aimdir, tr.endpos, tr.plane.normal, damage, kick, 0, MOD_RAILGUN);
else
if ((tr.ent != self) && (tr.ent->takedamage)) ignore = NULL;
T_Damage (tr.ent, self, self, aimdir, tr.endpos, tr.plane.normal, damage, kick, 0, MOD_RAILGUN); }
}
VectorCopy (tr.endpos, from);
VectorCopy (tr.endpos, from);
} }
// send gun puff / flash // send gun puff / flash
@ -727,7 +722,6 @@ void fire_rail (edict_t *self, vec3_t start, vec3_t aimdir, int damage, int kick
gi.WritePosition (start); gi.WritePosition (start);
gi.WritePosition (tr.endpos); gi.WritePosition (tr.endpos);
gi.multicast (self->s.origin, MULTICAST_PHS); gi.multicast (self->s.origin, MULTICAST_PHS);
// gi.multicast (start, MULTICAST_PHS);
if (water) if (water)
{ {
gi.WriteByte (svc_temp_entity); gi.WriteByte (svc_temp_entity);
@ -950,7 +944,6 @@ void fire_bfg (edict_t *self, vec3_t start, vec3_t dir, int damage, int speed, f
/* /*
fire_ionripper fire_ionripper
*/ */
void ionripper_sparks (edict_t *self) void ionripper_sparks (edict_t *self)
{ {
gi.WriteByte (svc_temp_entity); gi.WriteByte (svc_temp_entity);
@ -1043,8 +1036,6 @@ void fire_ionripper (edict_t *self, vec3_t start, vec3_t dir, int damage, int sp
/* /*
fire_heat fire_heat
*/ */
void heat_think (edict_t *self) void heat_think (edict_t *self)
{ {
edict_t *target = NULL; edict_t *target = NULL;
@ -1071,23 +1062,6 @@ void heat_think (edict_t *self)
if (!visible (self, target)) if (!visible (self, target))
continue; continue;
// if we need to reduce the tracking cone
/*
{
vec3_t vec;
float dot;
vec3_t forward;
AngleVectors (self->s.angles, forward, NULL, NULL);
VectorSubtract (target->s.origin, self->s.origin, vec);
VectorNormalize (vec);
dot = DotProduct (vec, forward);
if (dot > 0.6)
continue;
}
*/
if (!infront (self, target)) if (!infront (self, target))
continue; continue;
@ -1158,7 +1132,6 @@ void fire_heat (edict_t *self, vec3_t start, vec3_t dir, int damage, int speed,
/* /*
fire_plasma fire_plasma
*/ */
void plasma_touch (edict_t *ent, edict_t *other, cplane_t *plane, csurface_t *surf) void plasma_touch (edict_t *ent, edict_t *other, cplane_t *plane, csurface_t *surf)
{ {
vec3_t origin; vec3_t origin;
@ -1457,8 +1430,6 @@ void fire_trap (edict_t *self, vec3_t start, vec3_t aimdir, int damage, int spee
trap->movetype = MOVETYPE_BOUNCE; trap->movetype = MOVETYPE_BOUNCE;
trap->clipmask = MASK_SHOT; trap->clipmask = MASK_SHOT;
trap->solid = SOLID_BBOX; trap->solid = SOLID_BBOX;
// VectorClear (trap->mins);
// VectorClear (trap->maxs);
VectorSet (trap->mins, -4, -4, 0); VectorSet (trap->mins, -4, -4, 0);
VectorSet (trap->maxs, 4, 4, 8); VectorSet (trap->maxs, 4, 4, 8);
trap->s.modelindex = gi.modelindex ("models/weapons/z_trap/tris.md2"); trap->s.modelindex = gi.modelindex ("models/weapons/z_trap/tris.md2");