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

@ -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;
}
@ -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

@ -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);
@ -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);
}
@ -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

@ -252,7 +252,7 @@ int SV_FlyMove (edict_t *ent, float time, int mask)
{
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;
}
@ -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
{
@ -659,7 +651,7 @@ void SV_Physics_Toss (edict_t *ent)
qboolean wasinwater;
qboolean isinwater;
vec3_t old_origin;
float speed;
float speed = 0;
// regular thinking
SV_RunThink (ent);
@ -735,9 +727,6 @@ 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
@ -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

@ -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,7 +439,7 @@ 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));
@ -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]));
@ -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)
{
@ -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,11 +865,7 @@ 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");

View File

@ -832,3 +832,4 @@ void SP_target_earthquake (edict_t *self)
self->noise_index = gi.soundindex ("world/quake.wav");
}

View File

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

View File

@ -178,7 +178,7 @@ void G_UseTargets (edict_t *ent, edict_t *activator)
//
// print the message
//
if ((ent->message) && (activator) && !(activator->svflags & SVF_MONSTER))
if ((ent->message) && !(activator->svflags & SVF_MONSTER))
{
gi.centerprintf (activator, "%s", ent->message);
if (ent->noise_index)
@ -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
{
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;
}
@ -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);
}