Und weitere Dateien portiert

This commit is contained in:
Yamagi Burmeister 2009-04-10 15:39:58 +00:00
parent 096c3faa1c
commit 3272fedbdb
10 changed files with 190 additions and 319 deletions

View file

@ -45,11 +45,6 @@ cvar_t *gamedir;
cvar_t *sv_cheats;
#ifdef CACHE_SOUND
cvar_t *printSoundRejects;
int internalSoundIndex(char *name);
int (*actual_soundindex) (char *name);
#endif
void SpawnEntities (char *mapname, char *entities, char *spawnpoint);
void ClientThink (edict_t *ent, usercmd_t *cmd);
@ -91,10 +86,6 @@ and global variables
game_export_t *GetGameAPI (game_import_t *import)
{
gi = *import;
#ifdef CACHE_SOUND
actual_soundindex = gi.soundindex;
gi.soundindex = internalSoundIndex;
#endif
globals.apiversion = GAME_API_VERSION;
globals.Init = InitGame;
globals.Shutdown = ShutdownGame;

View file

@ -354,11 +354,11 @@ void path_corner_touch (edict_t *self, edict_t *other, cplane_t *plane, csurface
if (self->wait)
{
if(other->goalentity)
{
VectorSubtract (other->goalentity->s.origin, other->s.origin, v);
other->ideal_yaw = vectoyaw (v);
}
if(other->goalentity)
{
VectorSubtract (other->goalentity->s.origin, other->s.origin, v);
other->ideal_yaw = vectoyaw (v);
}
other->monsterinfo.pausetime = level.time + self->wait;
other->monsterinfo.stand (other);
@ -465,7 +465,7 @@ void SP_point_combat (edict_t *self)
VectorSet (self->maxs, 8, 8, 16);
self->svflags = SVF_NOCLIENT;
gi.linkentity (self);
};
}
/*QUAKED viewthing (0 .5 .8) (-8 -8 -8) (8 8 8)
@ -500,7 +500,7 @@ Used as a positional target for spotlights, etc.
void SP_info_null (edict_t *self)
{
G_FreeEdict (self);
};
}
/*QUAKED info_notnull (0 0.5 0) (-4 -4 -4) (4 4 4)
@ -510,7 +510,7 @@ void SP_info_notnull (edict_t *self)
{
VectorCopy (self->s.origin, self->absmin);
VectorCopy (self->s.origin, self->absmax);
};
}
/*QUAKED light (0 1 0) (-8 -8 -8) (8 8 8) START_OFF
@ -611,7 +611,6 @@ void SP_func_wall (edict_t *self)
// it must be TRIGGER_SPAWN
if (!(self->spawnflags & 1))
{
// gi.dprintf("func_wall missing TRIGGER_SPAWN\n");
self->spawnflags |= 1;
}
@ -1294,44 +1293,44 @@ void SP_misc_viper (edict_t *ent)
ent->movetype = MOVETYPE_PUSH;
if (ent->spawnflags & 2)
if (ent->spawnflags & 2)
{
ent->solid = SOLID_BBOX;
}
else
{
ent->solid = SOLID_NOT;
}
if(ent->model)
{
ent->s.modelindex = gi.modelindex (ent->model);
}
else
{
ent->s.modelindex = gi.modelindex ("models/ships/viper/tris.md2");
}
if(ent->model2)
{
ent->s.modelindex2 = gi.modelindex (ent->model2);
}
if(ent->model3)
{
ent->s.modelindex3 = gi.modelindex (ent->model3);
}
if(ent->model4)
{
ent->s.modelindex4 = gi.modelindex (ent->model4);
}
if (!(ent->spawnflags & 4))
ent->solid = SOLID_BBOX;
}
else
{
VectorSet (ent->mins, -16, -16, 0);
VectorSet (ent->maxs, 16, 16, 32);
}
ent->solid = SOLID_NOT;
}
if(ent->model)
{
ent->s.modelindex = gi.modelindex (ent->model);
}
else
{
ent->s.modelindex = gi.modelindex ("models/ships/viper/tris.md2");
}
if(ent->model2)
{
ent->s.modelindex2 = gi.modelindex (ent->model2);
}
if(ent->model3)
{
ent->s.modelindex3 = gi.modelindex (ent->model3);
}
if(ent->model4)
{
ent->s.modelindex4 = gi.modelindex (ent->model4);
}
if (!(ent->spawnflags & 4))
{
VectorSet (ent->mins, -16, -16, 0);
VectorSet (ent->maxs, 16, 16, 32);
}
ent->think = func_train_find;
ent->nextthink = level.time + FRAMETIME;
@ -1845,7 +1844,9 @@ void teleporter_touch (edict_t *self, edict_t *other, cplane_t *plane, csurface_
// set angles
for (i=0 ; i<3 ; i++)
{
other->client->ps.pmove.delta_angles[i] = ANGLE2SHORT(dest->s.angles[i] - other->client->resp.cmd_angles[i]);
}
VectorClear (other->s.angles);
VectorClear (other->client->ps.viewangles);
@ -1901,7 +1902,6 @@ void SP_misc_teleporter_dest (edict_t *ent)
gi.setmodel (ent, "models/objects/dmspot/tris.md2");
ent->s.skinnum = 0;
ent->solid = SOLID_BBOX;
// ent->s.effects |= EF_FLIES;
VectorSet (ent->mins, -32, -32, -24);
VectorSet (ent->maxs, 32, 32, -16);
gi.linkentity (ent);

View file

@ -10,7 +10,7 @@
// the damages too, but I'm not sure that's such a good idea.
void monster_fire_bullet (edict_t *self, vec3_t start, vec3_t dir, int damage, int kick, int hspread, int vspread, int flashtype)
{
ANIM_AIM(self, dir);
ANIM_AIM(self, dir);
fire_bullet (self, start, dir, damage, kick, hspread, vspread, MOD_UNKNOWN);
gi.WriteByte (svc_muzzleflash2);
@ -21,7 +21,7 @@ void monster_fire_bullet (edict_t *self, vec3_t start, vec3_t dir, int damage, i
void monster_fire_shotgun (edict_t *self, vec3_t start, vec3_t aimdir, int damage, int kick, int hspread, int vspread, int count, int flashtype)
{
ANIM_AIM(self, aimdir);
ANIM_AIM(self, aimdir);
fire_shotgun (self, start, aimdir, damage, kick, hspread, vspread, count, MOD_UNKNOWN);
gi.WriteByte (svc_muzzleflash2);
@ -32,13 +32,13 @@ void monster_fire_shotgun (edict_t *self, vec3_t start, vec3_t aimdir, int damag
void monster_fire_blaster (edict_t *self, vec3_t start, vec3_t dir, int damage, int speed, int flashtype, int effect)
{
if(EMPNukeCheck(self, start))
{
if(EMPNukeCheck(self, start))
{
gi.sound (self, CHAN_AUTO, gi.soundindex("items/empnuke/emp_missfire.wav"), 1, ATTN_NORM, 0);
return;
}
return;
}
ANIM_AIM(self, dir);
ANIM_AIM(self, dir);
fire_blaster (self, start, dir, damage, speed, effect, false);
gi.WriteByte (svc_muzzleflash2);
@ -49,7 +49,7 @@ void monster_fire_blaster (edict_t *self, vec3_t start, vec3_t dir, int damage,
void monster_fire_grenade (edict_t *self, vec3_t start, vec3_t aimdir, int damage, int speed, int flashtype)
{
ANIM_AIM(self, aimdir);
ANIM_AIM(self, aimdir);
fire_grenade (self, start, aimdir, damage, speed, 2.5, damage+40);
gi.WriteByte (svc_muzzleflash2);
@ -60,13 +60,13 @@ void monster_fire_grenade (edict_t *self, vec3_t start, vec3_t aimdir, int damag
void monster_fire_rocket (edict_t *self, vec3_t start, vec3_t dir, int damage, int speed, int flashtype)
{
if(EMPNukeCheck(self, start))
{
if(EMPNukeCheck(self, start))
{
gi.sound (self, CHAN_AUTO, gi.soundindex("items/empnuke/emp_missfire.wav"), 1, ATTN_NORM, 0);
return;
}
return;
}
ANIM_AIM(self, dir);
ANIM_AIM(self, dir);
fire_rocket (self, start, dir, damage, speed, damage+20, damage);
gi.WriteByte (svc_muzzleflash2);
@ -77,13 +77,13 @@ void monster_fire_rocket (edict_t *self, vec3_t start, vec3_t dir, int damage, i
void monster_fire_railgun (edict_t *self, vec3_t start, vec3_t aimdir, int damage, int kick, int flashtype)
{
if(EMPNukeCheck(self, start))
{
if(EMPNukeCheck(self, start))
{
gi.sound (self, CHAN_AUTO, gi.soundindex("items/empnuke/emp_missfire.wav"), 1, ATTN_NORM, 0);
return;
}
return;
}
ANIM_AIM(self, aimdir);
ANIM_AIM(self, aimdir);
fire_rail (self, start, aimdir, damage, kick);
gi.WriteByte (svc_muzzleflash2);
@ -94,13 +94,13 @@ void monster_fire_railgun (edict_t *self, vec3_t start, vec3_t aimdir, int damag
void monster_fire_bfg (edict_t *self, vec3_t start, vec3_t aimdir, int damage, int speed, int kick, float damage_radius, int flashtype)
{
if(EMPNukeCheck(self, start))
{
if(EMPNukeCheck(self, start))
{
gi.sound (self, CHAN_AUTO, gi.soundindex("items/empnuke/emp_missfire.wav"), 1, ATTN_NORM, 0);
return;
}
return;
}
ANIM_AIM(self, aimdir);
ANIM_AIM(self, aimdir);
fire_bfg (self, start, aimdir, damage, speed, damage_radius);
gi.WriteByte (svc_muzzleflash2);
@ -163,7 +163,7 @@ void M_CheckGround (edict_t *ent)
return;
}
// if the hull point one-quarter unit down is solid the entity is on ground
// if the hull point one-quarter unit down is solid the entity is on ground
point[0] = ent->s.origin[0];
point[1] = ent->s.origin[1];
point[2] = ent->s.origin[2] - 0.25;
@ -177,10 +177,6 @@ void M_CheckGround (edict_t *ent)
return;
}
// ent->groundentity = trace.ent;
// ent->groundentity_linkcount = trace.ent->linkcount;
// if (!trace.startsolid && !trace.allsolid)
// VectorCopy (trace.endpos, ent->s.origin);
if (!trace.startsolid && !trace.allsolid)
{
VectorCopy (trace.endpos, ent->s.origin);
@ -196,9 +192,9 @@ void M_CatagorizePosition (edict_t *ent)
vec3_t point;
int cont;
//
// get waterlevel
//
//
// get waterlevel
//
point[0] = ent->s.origin[0];
point[1] = ent->s.origin[1];
point[2] = ent->s.origin[2] + ent->mins[2] + 1;
@ -418,12 +414,12 @@ void M_MoveFrame (edict_t *self)
}
index = self->s.frame - move->firstframe;
if (move->frame[index].aifunc)
if (move->frame[index].aifunc) {
if (!(self->monsterinfo.aiflags & AI_HOLD_FRAME))
move->frame[index].aifunc (self, move->frame[index].dist * self->monsterinfo.scale);
else
move->frame[index].aifunc (self, 0);
}
if (move->frame[index].thinkfunc)
move->frame[index].thinkfunc (self);
}
@ -465,7 +461,7 @@ void monster_use (edict_t *self, edict_t *other, edict_t *activator)
if (!(activator->client) && !(activator->monsterinfo.aiflags & AI_GOOD_GUY))
return;
// delay reaction so if the monster is teleported, its sound is still heard
// delay reaction so if the monster is teleported, its sound is still heard
self->enemy = activator;
FoundTarget (self);
}
@ -499,7 +495,7 @@ void monster_triggered_spawn (edict_t *self)
// some sort of spawn effect
// TODO good enough?
self->s.event = EV_PLAYER_TELEPORT;
MonsterPlayerKillBox(self);
MonsterPlayerKillBox(self);
}
void monster_triggered_spawn_use (edict_t *self, edict_t *other, edict_t *activator)
@ -565,7 +561,6 @@ qboolean monster_start (edict_t *self)
{
self->spawnflags &= ~4;
self->spawnflags |= 1;
// gi.dprintf("fixed spawnflags on %s at %s\n", self->classname, vtos(self->s.origin));
}
if (!(self->monsterinfo.aiflags & AI_GOOD_GUY))
@ -765,3 +760,4 @@ void swimmonster_start (edict_t *self)
self->think = swimmonster_start_go;
monster_start (self);
}

View file

@ -54,9 +54,9 @@ void SV_CheckVelocity (edict_t *ent)
{
int i;
//
// bound velocity
//
//
// bound velocity
//
for (i=0 ; i<3 ; i++)
{
if (ent->velocity[i] > sv_maxvelocity->value)
@ -144,7 +144,7 @@ int ClipVelocity (vec3_t in, vec3_t normal, vec3_t out, float overbounce)
if (out[i] > -STOP_EPSILON && out[i] < STOP_EPSILON)
out[i] = 0;
}
return blocked;
}
@ -225,9 +225,9 @@ int SV_FlyMove (edict_t *ent, float time, int mask)
blocked |= 2; // step
}
//
// run the impact function
//
//
// run the impact function
//
SV_Impact (ent, &trace);
if (!ent->inuse)
break; // removed by the impact function
@ -235,7 +235,7 @@ int SV_FlyMove (edict_t *ent, float time, int mask)
time_left -= time_left * trace.fraction;
// cliped to another plane
// cliped to another plane
if (numplanes >= MAX_CLIP_PLANES)
{ // this shouldn't really happen
VectorCopy (vec3_origin, ent->velocity);
@ -245,14 +245,14 @@ int SV_FlyMove (edict_t *ent, float time, int mask)
VectorCopy (trace.plane.normal, planes[numplanes]);
numplanes++;
//
// modify original_velocity so it parallels all of the clip planes
//
//
// modify original_velocity so it parallels all of the clip planes
//
for (i=0 ; i<numplanes ; i++)
{
ClipVelocity (original_velocity, planes[i], new_velocity, 1);
for (j=0 ; j<numplanes ; j++)
if (j != i)
if ((j != i) && !VectorCompare (planes[i], planes[j]))
{
if (DotProduct (new_velocity, planes[j]) < 0)
break; // not ok
@ -269,7 +269,6 @@ int SV_FlyMove (edict_t *ent, float time, int mask)
{ // go along the crease
if (numplanes != 2)
{
// gi.dprintf ("clip velocity, numplanes == %i\n",numplanes);
VectorCopy (vec3_origin, ent->velocity);
return 7;
}
@ -278,10 +277,10 @@ int SV_FlyMove (edict_t *ent, float time, int mask)
VectorScale (dir, d, ent->velocity);
}
//
// if original velocity is against the original velocity, stop dead
// to avoid tiny occilations in sloping corners
//
//
// if original velocity is against the original velocity, stop dead
// to avoid tiny occilations in sloping corners
//
if (DotProduct (ent->velocity, primal_velocity) <= 0)
{
VectorCopy (vec3_origin, ent->velocity);
@ -410,11 +409,11 @@ qboolean SV_Push (edict_t *pusher, vec3_t move, vec3_t amove)
maxs[i] = pusher->absmax[i] + move[i];
}
// we need this for pushing things later
// we need this for pushing things later
VectorSubtract (vec3_origin, amove, org);
AngleVectors (org, forward, right, up);
// save the pusher's original position
// save the pusher's original position
pushed_p->ent = pusher;
VectorCopy (pusher->s.origin, pushed_p->origin);
VectorCopy (pusher->s.angles, pushed_p->angles);
@ -422,12 +421,12 @@ qboolean SV_Push (edict_t *pusher, vec3_t move, vec3_t amove)
pushed_p->deltayaw = pusher->client->ps.pmove.delta_angles[YAW];
pushed_p++;
// move the pusher to it's final position
// move the pusher to it's final position
VectorAdd (pusher->s.origin, move, pusher->s.origin);
VectorAdd (pusher->s.angles, amove, pusher->s.angles);
gi.linkentity (pusher);
// see if any solid entities are inside the final position
// see if any solid entities are inside the final position
check = g_edicts+1;
for (e = 1; e < globals.num_edicts; e++, check++)
{
@ -442,7 +441,7 @@ qboolean SV_Push (edict_t *pusher, vec3_t move, vec3_t amove)
if (!check->area.prev)
continue; // not linked in anywhere
// if the entity is standing on the pusher, it will definitely be moved
// if the entity is standing on the pusher, it will definitely be moved
if (check->groundentity != pusher)
{
// see if the ent needs to be tested
@ -526,7 +525,6 @@ qboolean SV_Push (edict_t *pusher, vec3_t move, vec3_t amove)
return false;
}
//FIXME: is there a better way to handle this?
// see if anything we moved has touched a trigger
for (p=pushed_p-1 ; p>=pushed ; p--)
G_TouchTriggers (p->ent);
@ -554,7 +552,6 @@ void SV_Physics_Pusher (edict_t *ent)
// make sure all team slaves can move before commiting
// any moves or calling any think functions
// if the move is blocked, all moved objects will be backed out
//retry:
pushed_p = pushed;
for (part = ent ; part ; part=part->teamchain)
{
@ -585,11 +582,6 @@ void SV_Physics_Pusher (edict_t *ent)
// otherwise, just stay in place until the obstacle is gone
if (part->blocked)
part->blocked (part, obstacle);
#if 0
// if the pushed entity went away and the pusher is still there
if (!obstacle->inuse && part->inuse)
goto retry;
#endif
}
else
{
@ -612,7 +604,7 @@ Non moving objects can only think
*/
void SV_Physics_None (edict_t *ent)
{
// regular thinking
// regular thinking
SV_RunThink (ent);
}
@ -625,7 +617,7 @@ A moving object that doesn't obey physics
*/
void SV_Physics_Noclip (edict_t *ent)
{
// regular thinking
// regular thinking
if (!SV_RunThink (ent))
return;
@ -659,9 +651,9 @@ void SV_Physics_Toss (edict_t *ent)
qboolean wasinwater;
qboolean isinwater;
vec3_t old_origin;
float speed;
float speed = 0;
// regular thinking
// regular thinking
SV_RunThink (ent);
// if not a team captain, so movement will be handled elsewhere
@ -671,12 +663,12 @@ void SV_Physics_Toss (edict_t *ent)
if (ent->velocity[2] > 0)
ent->groundentity = NULL;
// check for the groundentity going away
// check for the groundentity going away
if (ent->groundentity)
if (!ent->groundentity->inuse)
ent->groundentity = NULL;
// if onground, return without moving
// if onground, return without moving
if ( ent->groundentity )
return;
@ -684,16 +676,16 @@ void SV_Physics_Toss (edict_t *ent)
SV_CheckVelocity (ent);
// add gravity
// add gravity
if (ent->movetype != MOVETYPE_FLY
&& ent->movetype != MOVETYPE_FLYMISSILE
&& ent->movetype != MOVETYPE_BOUNCEFLY)
&& ent->movetype != MOVETYPE_BOUNCEFLY)
SV_AddGravity (ent);
// move angles
// move angles
VectorMA (ent->s.angles, FRAMETIME, ent->avelocity, ent->s.angles);
// move origin
// move origin
VectorScale (ent->velocity, FRAMETIME, move);
trace = SV_PushEntity (ent, move);
if (!ent->inuse)
@ -703,28 +695,28 @@ void SV_Physics_Toss (edict_t *ent)
{
if (ent->movetype == MOVETYPE_BOUNCE)
backoff = 1.5;
else if(ent->movetype == MOVETYPE_BOUNCEFLY)
{
else if(ent->movetype == MOVETYPE_BOUNCEFLY)
{
backoff = 2;
}
}
else
backoff = 1;
if(ent->movetype == MOVETYPE_BOUNCEFLY)
{
speed = VectorLength(ent->velocity);
}
if(ent->movetype == MOVETYPE_BOUNCEFLY)
{
speed = VectorLength(ent->velocity);
}
ClipVelocity (ent->velocity, trace.plane.normal, ent->velocity, backoff);
if(ent->movetype == MOVETYPE_BOUNCEFLY)
{
VectorNormalize (ent->velocity);
VectorScale (ent->velocity, speed, ent->velocity);
}
else
if(ent->movetype == MOVETYPE_BOUNCEFLY)
{
VectorNormalize (ent->velocity);
VectorScale (ent->velocity, speed, ent->velocity);
}
else
// stop if on ground
// stop if on ground
if (trace.plane.normal[2] > 0.7)
{
if (ent->velocity[2] < 60 || ent->movetype != MOVETYPE_BOUNCE)
@ -735,12 +727,9 @@ void SV_Physics_Toss (edict_t *ent)
VectorCopy (vec3_origin, ent->avelocity);
}
}
// if (ent->touch)
// ent->touch (ent, trace.ent, &trace.plane, trace.surface);
}
// check for water transition
// check for water transition
wasinwater = (ent->watertype & MASK_WATER);
ent->watertype = gi.pointcontents (ent->s.origin);
isinwater = ent->watertype & MASK_WATER;
@ -755,7 +744,7 @@ void SV_Physics_Toss (edict_t *ent)
else if (wasinwater && !isinwater)
gi.positioned_sound (ent->s.origin, g_edicts, CHAN_AUTO, gi.soundindex("misc/h2ohit1.wav"), 1, 1, 0);
// move teamslaves
// move teamslaves
for (slave = ent->teamchain; slave; slave = slave->teamchain)
{
VectorCopy (ent->s.origin, slave->s.origin);
@ -910,6 +899,8 @@ void SV_Physics_Step (edict_t *ent)
gi.linkentity (ent);
G_TouchTriggers (ent);
if (!ent->inuse)
return;
if (ent->groundentity)
if (!wasonground)
@ -921,8 +912,6 @@ void SV_Physics_Step (edict_t *ent)
SV_RunThink (ent);
}
void SV_Physics_FallFloat (edict_t *ent)
{
float gravVal = ent->gravity * sv_gravity->value * FRAMETIME;
@ -971,7 +960,6 @@ void SV_Physics_FallFloat (edict_t *ent)
}
}
else
//if (ent->waterlevel)
{
// where's the midpoint? above or below the water?
const double WATER_MASS = 500.0;
@ -1080,8 +1068,6 @@ void SV_Physics_Ride (edict_t *ent)
adjustRiders(ent);
}
//============================================================================
/*
================
@ -1126,3 +1112,4 @@ void G_RunEntity (edict_t *ent)
gi.error ("SV_Physics: bad movetype %i", (int)ent->movetype);
}
}

View file

@ -267,7 +267,7 @@ spawn_t spawns[] = {
{"turret_base", SP_turret_base},
{"turret_driver", SP_turret_driver},
// evolve map entities
// evolve map entities
{"sound_echo", SP_sound_echo},
{"misc_ired", SP_misc_lasertripbomb},
{"trigger_laser", SP_trigger_laser},
@ -279,7 +279,7 @@ spawn_t spawns[] = {
{"monster_handler", SP_monster_handler},
{"misc_commdish", SP_misc_commdish},
// mirror level's
// mirror level's
{"load_mirrorlevel", SP_load_mirrorlevel},
{"misc_crate", SP_misc_crate},
@ -341,7 +341,7 @@ void ED_CallSpawn (edict_t *ent)
ED_NewString
=============
*/
char *ED_NewString (char *string)
char *ED_NewString (const char *string)
{
char *newb, *new_p;
int i,l;
@ -369,9 +369,6 @@ char *ED_NewString (char *string)
return newb;
}
/*
===============
ED_ParseField
@ -380,7 +377,7 @@ Takes a key/value pair and sets the binary values
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;
byte *b;
@ -421,6 +418,8 @@ void ED_ParseField (char *key, char *value, edict_t *ent)
break;
case F_IGNORE:
break;
default:
break;
}
return;
}
@ -440,15 +439,15 @@ char *ED_ParseEdict (char *data, edict_t *ent)
{
qboolean init;
char keyname[256];
char *com_token;
const char *com_token;
init = false;
memset (&st, 0, sizeof(st));
// go through all the dictionary pairs
// go through all the dictionary pairs
while (1)
{
// parse key
// parse key
com_token = COM_Parse (&data);
if (com_token[0] == '}')
break;
@ -457,7 +456,7 @@ char *ED_ParseEdict (char *data, edict_t *ent)
strncpy (keyname, com_token, sizeof(keyname)-1);
// parse value
// parse value
com_token = COM_Parse (&data);
if (!data)
gi.error ("ED_ParseEntity: EOF without closing brace");
@ -467,8 +466,8 @@ char *ED_ParseEdict (char *data, edict_t *ent)
init = true;
// keynames with a leading underscore are used for utility comments,
// and are immediately discarded by quake
// keynames with a leading underscore are used for utility comments,
// and are immediately discarded by quake
if (keyname[0] == '_')
continue;
@ -544,11 +543,11 @@ Creates a server's entity / program execution context by
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;
int inhibit;
char *com_token;
const char *com_token;
int i;
float skill_level;
int oldmaxent;
@ -564,9 +563,6 @@ void SpawnEntities (char *mapname, char *entities, char *spawnpoint)
SaveClientData ();
gi.FreeTags (TAG_LEVEL);
#ifdef CACHE_SOUND
initSoundList();
#endif
memset (&level, 0, sizeof(level));
memset (g_edicts, 0, game.maxentities * sizeof (g_edicts[0]));
@ -580,8 +576,8 @@ void SpawnEntities (char *mapname, char *entities, char *spawnpoint)
ent = NULL;
inhibit = 0;
// parse ents
// parse ents
while (1)
{
// parse the opening brace
@ -602,7 +598,6 @@ void SpawnEntities (char *mapname, char *entities, char *spawnpoint)
if (!Q_stricmp(level.mapname, "command") && !Q_stricmp(ent->classname, "trigger_once") && !Q_stricmp(ent->model, "*27"))
ent->spawnflags &= ~SPAWNFLAG_NOT_HARD;
// remove things (except the world) from different skill levels or deathmatch
if (ent != g_edicts)
{
@ -618,7 +613,7 @@ void SpawnEntities (char *mapname, char *entities, char *spawnpoint)
else
{
if (((!coop->value) && (ent->spawnflags2 & SPAWNFLAG2_NOT_SINGLE)) ||
((coop->value) && (ent->spawnflags2 & SPAWNFLAG2_NOT_COOP)) ||
((coop->value) && (ent->spawnflags2 & SPAWNFLAG2_NOT_COOP)) ||
((skill->value == 0) && (ent->spawnflags & SPAWNFLAG_NOT_EASY)) ||
((skill->value == 1) && (ent->spawnflags & SPAWNFLAG_NOT_MEDIUM)) ||
(((skill->value == 2) || (skill->value == 3)) && (ent->spawnflags & SPAWNFLAG_NOT_HARD))
@ -640,9 +635,6 @@ void SpawnEntities (char *mapname, char *entities, char *spawnpoint)
gi.dprintf("%i entities created\n", globals.num_edicts);
gi.dprintf ("%i entities inhibited\n", inhibit);
#ifdef CACHE_SOUND
printSoundNum();
#endif
G_FindTeams ();
@ -654,30 +646,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>
picn <name>
num <fieldwidth> <stat>
string <stat>
// control
if <stat>
ifeq <stat> <value>
ifbit <stat> <value>
endif
#endif
char *single_statusbar =
"yb -24 "
@ -897,12 +865,8 @@ void SP_worldspawn (edict_t *ent)
snd_fry = gi.soundindex ("player/fry.wav"); // standing in lava / slime
#ifndef CACHE_SOUND
PrecacheItem (FindItem ("Blaster"));
#else
precacheAllItems();
#endif
gi.soundindex ("player/lava1.wav");
gi.soundindex ("player/lava2.wav");
@ -965,9 +929,9 @@ void SP_worldspawn (edict_t *ent)
gi.modelindex ("models/objects/gibs/skull/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
gi.configstring(CS_LIGHTS+0, "m");

View file

@ -73,7 +73,7 @@ void SP_target_speaker (edict_t *ent)
else
strncpy (buffer, st.noise, sizeof(buffer));
ent->noise_index = gi.soundindex (buffer);
if (!ent->volume)
ent->volume = 1.0;
@ -436,11 +436,11 @@ void use_target_blaster (edict_t *self, edict_t *other, edict_t *activator)
{
int effect;
if(EMPNukeCheck(self, self->s.origin))
{
if(EMPNukeCheck(self, self->s.origin))
{
gi.sound (self, CHAN_AUTO, gi.soundindex("items/empnuke/emp_missfire.wav"), 1, ATTN_NORM, 0);
return;
}
return;
}
if (self->spawnflags & 2)
effect = 0;
@ -832,3 +832,4 @@ void SP_target_earthquake (edict_t *self)
self->noise_index = gi.soundindex ("world/quake.wav");
}

View file

@ -577,7 +577,7 @@ void trigger_monsterjump_touch (edict_t *self, edict_t *other, cplane_t *plane,
if ( !(other->svflags & SVF_MONSTER))
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[1] = self->movedir[1] * self->speed;

View file

@ -68,11 +68,11 @@ void turret_breach_fire (edict_t *self)
VectorMA (start, self->move_origin[1], r, start);
VectorMA (start, self->move_origin[2], u, start);
if(EMPNukeCheck(self, start))
{
if(EMPNukeCheck(self, start))
{
gi.sound (self, CHAN_AUTO, gi.soundindex("items/empnuke/emp_missfire.wav"), 1, ATTN_NORM, 0);
return;
}
return;
}
damage = 100 + random() * 50;
speed = 550 + 50 * skill->value;
@ -420,3 +420,4 @@ void SP_turret_driver (edict_t *self)
gi.linkentity (self);
}

View file

@ -155,9 +155,9 @@ void G_UseTargets (edict_t *ent, edict_t *activator)
{
edict_t *t;
//
// check for a delay
//
//
// check for a delay
//
if (ent->delay)
{
// create a temp object to fire at a later time
@ -175,10 +175,10 @@ void G_UseTargets (edict_t *ent, edict_t *activator)
}
//
// print the message
//
if ((ent->message) && (activator) && !(activator->svflags & SVF_MONSTER))
//
// print the message
//
if ((ent->message) && !(activator->svflags & SVF_MONSTER))
{
gi.centerprintf (activator, "%s", ent->message);
if (ent->noise_index)
@ -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);
}
//
// kill killtargets
//
//
// kill killtargets
//
if (ent->killtarget)
{
t = NULL;
@ -204,9 +204,9 @@ void G_UseTargets (edict_t *ent, edict_t *activator)
}
}
//
// fire targets
//
//
// fire targets
//
if (ent->target)
{
t = NULL;
@ -315,8 +315,14 @@ float vectoyaw (vec3_t vec)
{
float yaw;
if (vec[YAW] == 0 && vec[PITCH] == 0)
if (/*vec[YAW] == 0 &&*/ vec[PITCH] == 0)
{
yaw = 0;
if (vec[YAW] > 0)
yaw = 90;
else if (vec[YAW] < 0)
yaw = -90;
}
else
{
yaw = (int) (atan2(vec[YAW], vec[PITCH]) * 180 / M_PI);
@ -343,7 +349,12 @@ void vectoangles (vec3_t value1, vec3_t angles)
}
else
{
yaw = (int) (atan2(value1[1], value1[0]) * 180 / M_PI);
if (value1[0])
yaw = (int) (atan2(value1[1], value1[0]) * 180 / M_PI);
else if (value1[1] > 0)
yaw = 90;
else
yaw = -90;
if (yaw < 0)
yaw += 360;
@ -425,7 +436,6 @@ void G_FreeEdict (edict_t *ed)
if ((ed - g_edicts) <= (maxclients->value + BODY_QUEUE_SIZE))
{
// gi.dprintf("tried to free special edict\n");
return;
}
@ -433,7 +443,7 @@ void G_FreeEdict (edict_t *ed)
ed->classname = "freed";
ed->freetime = level.time;
ed->inuse = false;
ed->nextthink = 0; // just in case freed before a nextthink...
ed->nextthink = 0; // just in case freed before a nextthink...
}
@ -498,9 +508,6 @@ void G_TouchSolids (edict_t *ent)
}
}
/*
==============================================================================
@ -538,8 +545,6 @@ qboolean KillBox (edict_t *ent)
return true; // all clear
}
/*
=================
MonsterKillBox
@ -572,8 +577,6 @@ qboolean MonsterKillBox (edict_t *ent)
return true; // all clear
}
/*
=================
MonsterPlayerKillBox
@ -611,3 +614,4 @@ qboolean MonsterPlayerKillBox (edict_t *ent)
return true; // all clear
}

View file

@ -322,11 +322,6 @@ void blaster_touch (edict_t *self, edict_t *other, cplane_t *plane, csurface_t *
if (other == self->owner)
return;
// if(other->owner == self->owner && strcmp(other->classname, "PlasmaShield") == 0)
// {
// return;
// }
if (surf && (surf->flags & SURF_SKY))
{
G_FreeEdict (self);
@ -389,8 +384,6 @@ void fire_blaster (edict_t *self, vec3_t start, vec3_t dir, int damage, int spee
bolt->spawnflags = 1;
gi.linkentity (bolt);
// if (self->client)
// check_dodge (self, bolt->s.origin, dir, speed);
tr = gi.trace (self->s.origin, NULL, NULL, bolt->s.origin, bolt, MASK_SHOT);
if (tr.fraction < 1.0)
@ -468,11 +461,6 @@ static void Grenade_Touch (edict_t *ent, edict_t *other, cplane_t *plane, csurfa
if (other == ent->owner)
return;
// if(other->owner == ent->owner && strcmp(other->classname, "PlasmaShield") == 0)
// {
// return;
// }
if (surf && (surf->flags & SURF_SKY))
{
G_FreeEdict (ent);
@ -582,37 +570,6 @@ void fire_grenade2 (edict_t *self, vec3_t start, vec3_t aimdir, int damage, int
fire_rocket
=================
*/
#ifdef _SHANETEST
void animrocket(edict_t *ent)
{
ent->s.frame++;
if((ent->s.frame % 2) == 0)
ent->s.skinnum++;
if(ent->s.frame > 12)
{
gi.WriteByte (svc_temp_entity);
if (ent->waterlevel)
gi.WriteByte (TE_ROCKET_EXPLOSION_WATER);
else
gi.WriteByte (TE_ROCKET_EXPLOSION);
gi.WritePosition (ent->s.origin);
gi.multicast (ent->s.origin, MULTICAST_PHS);
G_FreeEdict (ent);
}
else
{
ent->nextthink = level.time + FRAMETIME;
}
}
#endif
void rocket_touch (edict_t *ent, edict_t *other, cplane_t *plane, csurface_t *surf)
{
vec3_t origin;
@ -621,11 +578,6 @@ void rocket_touch (edict_t *ent, edict_t *other, cplane_t *plane, csurface_t *su
if (other == ent->owner)
return;
// if(other->owner == ent->owner && strcmp(other->classname, "PlasmaShield") == 0)
// {
// return;
// }
if (surf && (surf->flags & SURF_SKY))
{
G_FreeEdict (ent);
@ -658,24 +610,6 @@ void rocket_touch (edict_t *ent, edict_t *other, cplane_t *plane, csurface_t *su
T_RadiusDamage(ent, ent->owner, ent->radius_dmg, other, ent->dmg_radius, MOD_R_SPLASH);
#ifdef _SHANETEST
VectorClear (ent->velocity);
ent->movetype = 0;
ent->clipmask = 0;
ent->solid = 0;
ent->s.effects = 0;
// ent->s.renderfx = RF_TRANSLUCENT | RF_FULLBRIGHT;
ent->s.renderfx = RF_TRANSLUCENT | RF_FULLBRIGHT;
ent->s.modelindex = gi.modelindex ("models/objects/r_explode/tris.md2");
ent->touch = NULL;
ent->nextthink = level.time + FRAMETIME;
ent->think = animrocket;
ent->s.sound = 0;
VectorCopy (origin, ent->s.origin);
#else
gi.WriteByte (svc_temp_entity);
if (ent->waterlevel)
gi.WriteByte (TE_ROCKET_EXPLOSION_WATER);
@ -685,8 +619,6 @@ void rocket_touch (edict_t *ent, edict_t *other, cplane_t *plane, csurface_t *su
gi.multicast (ent->s.origin, MULTICAST_PHS);
G_FreeEdict (ent);
#endif
}
void fire_rocket (edict_t *self, vec3_t start, vec3_t dir, int damage, int speed, float damage_radius, int radius_damage)
@ -770,7 +702,6 @@ void fire_rail (edict_t *self, vec3_t start, vec3_t aimdir, int damage, int kick
gi.WritePosition (start);
gi.WritePosition (tr.endpos);
gi.multicast (self->s.origin, MULTICAST_PHS);
// gi.multicast (start, MULTICAST_PHS);
if (water)
{
gi.WriteByte (svc_temp_entity);
@ -841,11 +772,6 @@ void bfg_touch (edict_t *self, edict_t *other, cplane_t *plane, csurface_t *surf
if (other == self->owner)
return;
// if(other->owner == self->owner && strcmp(other->classname, "PlasmaShield") == 0)
// {
// return;
// }
if (surf && (surf->flags & SURF_SKY))
{
G_FreeEdict (self);
@ -993,3 +919,4 @@ void fire_bfg (edict_t *self, vec3_t start, vec3_t dir, int damage, int speed, f
gi.linkentity (bfg);
}