Issue 18: cleanup

This commit is contained in:
abalfoort 2023-06-11 12:29:18 +02:00
parent 1a264e6934
commit 0faa46986a
15 changed files with 14 additions and 82 deletions

View file

@ -536,11 +536,9 @@ qboolean B_UseBfg(edict_t *ent,edict_t *target,int enewep,float aim,float distan
qboolean B_UseHyperBlaster(edict_t *ent,edict_t *target,int enewep,float aim,float distance,int skill) qboolean B_UseHyperBlaster(edict_t *ent,edict_t *target,int enewep,float aim,float distance,int skill)
{ {
int mywep; int mywep;
zgcl_t *zc;
gclient_t *client; gclient_t *client;
client = ent->client; client = ent->client;
zc = &client->zc;
if(CanUsewep(ent,WEAP_HYPERBLASTER)) if(CanUsewep(ent,WEAP_HYPERBLASTER))
{ {
@ -721,11 +719,9 @@ qboolean B_UseRocket(edict_t *ent,edict_t *target,int enewep,float aim,float dis
qboolean B_UseBoomer(edict_t *ent,edict_t *target,int enewep,float aim,float distance,int skill) qboolean B_UseBoomer(edict_t *ent,edict_t *target,int enewep,float aim,float distance,int skill)
{ {
int mywep; int mywep;
zgcl_t *zc;
gclient_t *client; gclient_t *client;
client = ent->client; client = ent->client;
zc = &client->zc;
if(CanUsewep(ent,WEAP_BOOMER)) if(CanUsewep(ent,WEAP_BOOMER))
{ {
@ -746,11 +742,9 @@ qboolean B_UseBoomer(edict_t *ent,edict_t *target,int enewep,float aim,float dis
qboolean B_UseRailgun(edict_t *ent,edict_t *target,int enewep,float aim,float distance,int skill) qboolean B_UseRailgun(edict_t *ent,edict_t *target,int enewep,float aim,float distance,int skill)
{ {
int mywep; int mywep;
zgcl_t *zc;
gclient_t *client; gclient_t *client;
client = ent->client; client = ent->client;
zc = &client->zc;
if(CanUsewep(ent,WEAP_RAILGUN)) if(CanUsewep(ent,WEAP_RAILGUN))
{ {
@ -824,11 +818,9 @@ qboolean B_UseGrenadeLauncher(edict_t *ent,edict_t *target,int enewep,float aim,
qboolean B_UseChainGun(edict_t *ent,edict_t *target,int enewep,float aim,float distance,int skill) qboolean B_UseChainGun(edict_t *ent,edict_t *target,int enewep,float aim,float distance,int skill)
{ {
int mywep; int mywep;
zgcl_t *zc;
gclient_t *client; gclient_t *client;
client = ent->client; client = ent->client;
zc = &client->zc;
if(CanUsewep(ent,WEAP_CHAINGUN)) if(CanUsewep(ent,WEAP_CHAINGUN))
{ {
@ -850,11 +842,9 @@ qboolean B_UseChainGun(edict_t *ent,edict_t *target,int enewep,float aim,float d
qboolean B_UseMachineGun(edict_t *ent,edict_t *target,int enewep,float aim,float distance,int skill) qboolean B_UseMachineGun(edict_t *ent,edict_t *target,int enewep,float aim,float distance,int skill)
{ {
int k,mywep; int k,mywep;
zgcl_t *zc;
gclient_t *client; gclient_t *client;
client = ent->client; client = ent->client;
zc = &client->zc;
if((k = CanUsewep(ent,WEAP_MACHINEGUN))) if((k = CanUsewep(ent,WEAP_MACHINEGUN)))
{ {
@ -875,11 +865,9 @@ qboolean B_UseMachineGun(edict_t *ent,edict_t *target,int enewep,float aim,float
qboolean B_UseSuperShotgun(edict_t *ent,edict_t *target,int enewep,float aim,float distance,int skill) qboolean B_UseSuperShotgun(edict_t *ent,edict_t *target,int enewep,float aim,float distance,int skill)
{ {
int mywep; int mywep;
zgcl_t *zc;
gclient_t *client; gclient_t *client;
client = ent->client; client = ent->client;
zc = &client->zc;
if(CanUsewep(ent,WEAP_SUPERSHOTGUN)) if(CanUsewep(ent,WEAP_SUPERSHOTGUN))
{ {
@ -900,11 +888,9 @@ qboolean B_UseSuperShotgun(edict_t *ent,edict_t *target,int enewep,float aim,flo
qboolean B_UseShotgun(edict_t *ent,edict_t *target,int enewep,float aim,float distance,int skill) qboolean B_UseShotgun(edict_t *ent,edict_t *target,int enewep,float aim,float distance,int skill)
{ {
int mywep; int mywep;
zgcl_t *zc;
gclient_t *client; gclient_t *client;
client = ent->client; client = ent->client;
zc = &client->zc;
if(CanUsewep(ent,WEAP_SHOTGUN)) if(CanUsewep(ent,WEAP_SHOTGUN))
{ {
@ -925,11 +911,9 @@ qboolean B_UseShotgun(edict_t *ent,edict_t *target,int enewep,float aim,float di
qboolean B_UseHandGrenade(edict_t *ent,edict_t *target,int enewep,float aim,float distance,int skill) qboolean B_UseHandGrenade(edict_t *ent,edict_t *target,int enewep,float aim,float distance,int skill)
{ {
int mywep; int mywep;
zgcl_t *zc;
gclient_t *client; gclient_t *client;
client = ent->client; client = ent->client;
zc = &client->zc;
if(CanUsewep(ent,WEAP_GRENADES)) if(CanUsewep(ent,WEAP_GRENADES))
{ {
@ -950,11 +934,9 @@ qboolean B_UseHandGrenade(edict_t *ent,edict_t *target,int enewep,float aim,floa
qboolean B_UseTrap(edict_t *ent,edict_t *target,int enewep,float aim,float distance,int skill) qboolean B_UseTrap(edict_t *ent,edict_t *target,int enewep,float aim,float distance,int skill)
{ {
int mywep; int mywep;
zgcl_t *zc;
gclient_t *client; gclient_t *client;
client = ent->client; client = ent->client;
zc = &client->zc;
if(CanUsewep(ent,WEAP_TRAP)) if(CanUsewep(ent,WEAP_TRAP))
{ {
@ -976,11 +958,9 @@ qboolean B_UseTrap(edict_t *ent,edict_t *target,int enewep,float aim,float dista
qboolean B_UseBlaster(edict_t *ent,edict_t *target,int enewep,float aim,float distance,int skill) qboolean B_UseBlaster(edict_t *ent,edict_t *target,int enewep,float aim,float distance,int skill)
{ {
int mywep; int mywep;
zgcl_t *zc;
gclient_t *client; gclient_t *client;
client = ent->client; client = ent->client;
zc = &client->zc;
if(CanUsewep(ent,WEAP_BLASTER)) if(CanUsewep(ent,WEAP_BLASTER))
{ {

View file

@ -278,8 +278,6 @@ edict_t *Get_NewClient (void)
//---------------------------------------------------------------- //----------------------------------------------------------------
void Bot_Think (edict_t *self) void Bot_Think (edict_t *self)
{ {
gclient_t *client;
if (self->linkcount != self->monsterinfo.linkcount) if (self->linkcount != self->monsterinfo.linkcount)
{ {
// self->monsterinfo.linkcount = self->linkcount; // self->monsterinfo.linkcount = self->linkcount;
@ -313,8 +311,6 @@ void Bot_Think (edict_t *self)
Bots_Move_NORM (self); Bots_Move_NORM (self);
if(!self->inuse) return; //removed botself if(!self->inuse) return; //removed botself
client = self->client;
ClientBeginServerFrame (self); ClientBeginServerFrame (self);
} }
if (self->linkcount != self->monsterinfo.linkcount) if (self->linkcount != self->monsterinfo.linkcount)

View file

@ -1205,7 +1205,7 @@ int Bot_Watermove ( edict_t *ent,vec3_t pos,float dist,float upd)
vec3_t trmin,trmax,touchmin; vec3_t trmin,trmax,touchmin;
float i,j; float i,j;
float max,vec; float vec;
VectorCopy(ent->s.origin,trmax); VectorCopy(ent->s.origin,trmax);
@ -1230,7 +1230,6 @@ int Bot_Watermove ( edict_t *ent,vec3_t pos,float dist,float upd)
trmin[2] += upd; trmin[2] += upd;
vec = -1; vec = -1;
max = 0;
for(i = 0;i < 360; i += 10) for(i = 0;i < 360; i += 10)
{ {
if(i && upd > -13 && upd < 0/*13*/) break; if(i && upd > -13 && upd < 0/*13*/) break;
@ -1862,13 +1861,11 @@ JMPCHK:
qboolean TargetJump(edict_t *ent,vec3_t tpos) qboolean TargetJump(edict_t *ent,vec3_t tpos)
{ {
zgcl_t *zc;
float x,l,grav,vel,ypos,yori; float x,l,grav,vel,ypos,yori;
vec3_t v,vv; vec3_t v,vv;
int mf = false; int mf = false;
zc = &ent->client->zc; grav = ent->gravity * sv_gravity->value * FRAMETIME;
grav = ent->gravity * sv_gravity->value * FRAMETIME;
vel = ent->velocity[2] + VEL_BOT_JUMP; vel = ent->velocity[2] + VEL_BOT_JUMP;
yori = ent->s.origin[2]; yori = ent->s.origin[2];
@ -1929,14 +1926,12 @@ qboolean TargetJump(edict_t *ent,vec3_t tpos)
qboolean TargetJump_Turbo(edict_t *ent,vec3_t tpos) qboolean TargetJump_Turbo(edict_t *ent,vec3_t tpos)
{ {
zgcl_t *zc;
float x,l,grav,vel,ypos,yori; float x,l,grav,vel,ypos,yori;
vec3_t v,vv; vec3_t v,vv;
int mf = false; int mf = false;
float jvel; float jvel;
zc = &ent->client->zc; grav = ent->gravity * sv_gravity->value * FRAMETIME;
grav = ent->gravity * sv_gravity->value * FRAMETIME;
vel = ent->velocity[2] + VEL_BOT_JUMP; vel = ent->velocity[2] + VEL_BOT_JUMP;
@ -2005,13 +2000,11 @@ qboolean TargetJump_Turbo(edict_t *ent,vec3_t tpos)
} }
qboolean TargetJump_Chk(edict_t *ent,vec3_t tpos,float defvel) qboolean TargetJump_Chk(edict_t *ent,vec3_t tpos,float defvel)
{ {
zgcl_t *zc;
float x,l,grav,vel,ypos,yori; float x,l,grav,vel,ypos,yori;
vec3_t v,vv; vec3_t v,vv;
int mf = false; int mf = false;
zc = &ent->client->zc; grav = ent->gravity * sv_gravity->value * FRAMETIME;
grav = ent->gravity * sv_gravity->value * FRAMETIME;
vel = defvel + VEL_BOT_JUMP; vel = defvel + VEL_BOT_JUMP;
yori = ent->s.origin[2]; yori = ent->s.origin[2];
@ -2299,7 +2292,7 @@ void Bots_Move_NORM (edict_t *ent)
edict_t *it_ent; edict_t *it_ent;
gitem_t *it; gitem_t *it;
edict_t *front,*left,*right,*e; edict_t *e;
char *string; char *string;
@ -5639,7 +5632,6 @@ GOMOVE:
VCHCANSEL: VCHCANSEL:
//-------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------
//ladder check //ladder check
front = NULL, left = NULL, right = NULL;
k = false; k = false;
if(zc->route_trace && (zc->routeindex + 1) < CurrentIndex) if(zc->route_trace && (zc->routeindex + 1) < CurrentIndex)
{ {
@ -5667,7 +5659,6 @@ VCHCANSEL:
VectorAdd(ent->s.origin,touchmin,touchmax); VectorAdd(ent->s.origin,touchmin,touchmax);
rs_trace = gi.trace (ent->s.origin, trmin,ent->maxs, touchmax,ent, MASK_BOTSOLID ); rs_trace = gi.trace (ent->s.origin, trmin,ent->maxs, touchmax,ent, MASK_BOTSOLID );
front = rs_trace.ent;
if(rs_trace.contents & CONTENTS_LADDER) tempflag = true; if(rs_trace.contents & CONTENTS_LADDER) tempflag = true;
@ -5698,7 +5689,6 @@ VCHCANSEL:
VectorAdd(ent->s.origin,touchmin,touchmax); VectorAdd(ent->s.origin,touchmin,touchmax);
rs_trace = gi.trace (ent->s.origin, trmin,ent->maxs, touchmax,ent, MASK_BOTSOLID ); rs_trace = gi.trace (ent->s.origin, trmin,ent->maxs, touchmax,ent, MASK_BOTSOLID );
right = rs_trace.ent;
if(rs_trace.contents & CONTENTS_LADDER) tempflag = true; if(rs_trace.contents & CONTENTS_LADDER) tempflag = true;
} }
@ -5714,7 +5704,6 @@ VCHCANSEL:
VectorAdd(ent->s.origin,touchmin,touchmax); VectorAdd(ent->s.origin,touchmin,touchmax);
rs_trace = gi.trace (ent->s.origin, trmin,ent->maxs, touchmax,ent, MASK_BOTSOLID ); rs_trace = gi.trace (ent->s.origin, trmin,ent->maxs, touchmax,ent, MASK_BOTSOLID );
left = rs_trace.ent;
if(rs_trace.contents & CONTENTS_LADDER) tempflag = true; if(rs_trace.contents & CONTENTS_LADDER) tempflag = true;
} }

View file

@ -7,7 +7,6 @@ void UpdateChaseCam(edict_t *ent)
vec3_t forward, right; vec3_t forward, right;
trace_t trace; trace_t trace;
int i; int i;
vec3_t oldgoal;
vec3_t angles; vec3_t angles;
// is our chase target gone? // is our chase target gone?
@ -25,7 +24,6 @@ void UpdateChaseCam(edict_t *ent)
targ = ent->client->chase_target; targ = ent->client->chase_target;
VectorCopy(targ->s.origin, ownerv); VectorCopy(targ->s.origin, ownerv);
VectorCopy(ent->s.origin, oldgoal);
ownerv[2] += targ->viewheight; ownerv[2] += targ->viewheight;

View file

@ -1030,8 +1030,6 @@ void SetCTFStats(edict_t *ent)
e = G_Find(NULL, FOFS(classname), "item_flag_team1"); e = G_Find(NULL, FOFS(classname), "item_flag_team1");
if (e != NULL) { if (e != NULL) {
if (e->solid == SOLID_NOT) { if (e->solid == SOLID_NOT) {
int i;
// not at base // not at base
// check if on player // check if on player
p1 = gi.imageindex ("i_ctf1d"); // default to dropped p1 = gi.imageindex ("i_ctf1d"); // default to dropped
@ -1049,8 +1047,6 @@ void SetCTFStats(edict_t *ent)
e = G_Find(NULL, FOFS(classname), "item_flag_team2"); e = G_Find(NULL, FOFS(classname), "item_flag_team2");
if (e != NULL) { if (e != NULL) {
if (e->solid == SOLID_NOT) { if (e->solid == SOLID_NOT) {
int i;
// not at base // not at base
// check if on player // check if on player
p2 = gi.imageindex ("i_ctf2d"); // default to dropped p2 = gi.imageindex ("i_ctf2d"); // default to dropped

View file

@ -1197,7 +1197,7 @@ droptofloor
void droptofloor (edict_t *ent) void droptofloor (edict_t *ent)
{ {
vec3_t trmin,trmax,min,mins,maxs; vec3_t trmin,trmax,min,mins,maxs;
float i,j,k,yaw; float i,j,yaw;
gitem_t *it; //j gitem_t *it; //j
edict_t *it_ent; //j edict_t *it_ent; //j
@ -1282,7 +1282,6 @@ void droptofloor (edict_t *ent)
if(ent->classname[0] == 'w' || ent->classname[0] == 'i' || ent->classname[0] == 'a') if(ent->classname[0] == 'w' || ent->classname[0] == 'i' || ent->classname[0] == 'a')
{ {
k = 0;
VectorCopy(ent->s.origin,min); VectorCopy(ent->s.origin,min);
VectorSet (mins, -16, -16, -16); VectorSet (mins, -16, -16, -16);
VectorSet (maxs, 16, 16, 16); VectorSet (maxs, 16, 16, 16);
@ -1318,7 +1317,6 @@ void droptofloor (edict_t *ent)
trx = gi.trace (trmax, mins, maxs, trmin,ent, CONTENTS_WATER ); trx = gi.trace (trmax, mins, maxs, trmin,ent, CONTENTS_WATER );
VectorCopy(trx.endpos,it_ent->s.origin); VectorCopy(trx.endpos,it_ent->s.origin);
SpawnItem3 (it_ent, it); SpawnItem3 (it_ent, it);
k = -1;
} }
if(tr.endpos[2] < ent->s.origin[2] - 16 if(tr.endpos[2] < ent->s.origin[2] - 16
&& tr.endpos[2] > min[2] && !tr.allsolid && !tr.startsolid) && tr.endpos[2] > min[2] && !tr.allsolid && !tr.startsolid)

View file

@ -928,17 +928,13 @@ health (80), and dmg (150).
*/ */
void barrel_touch (edict_t *self, edict_t *other, cplane_t *plane, csurface_t *surf) void barrel_touch (edict_t *self, edict_t *other, cplane_t *plane, csurface_t *surf)
{ {
float ratio;
vec3_t v; vec3_t v;
if ((!other->groundentity) || (other->groundentity == self)) if ((!other->groundentity) || (other->groundentity == self))
return; return;
ratio = (float)other->mass / (float)self->mass;
VectorSubtract (self->s.origin, other->s.origin, v); VectorSubtract (self->s.origin, other->s.origin, v);
// M_walkmove (self, vectoyaw(v), 20 * ratio * FRAMETIME);
} }
void barrel_explode (edict_t *self) void barrel_explode (edict_t *self)

View file

@ -855,7 +855,6 @@ void P_FallingDamage (edict_t *ent);
void SV_Physics_Step (edict_t *ent) void SV_Physics_Step (edict_t *ent)
{ {
qboolean wasonground; qboolean wasonground;
qboolean hitsound = false;
float *vel; float *vel;
float speed, newspeed, control; float speed, newspeed, control;
float friction; float friction;
@ -887,8 +886,6 @@ void SV_Physics_Step (edict_t *ent)
if (!(ent->flags & FL_FLY)) if (!(ent->flags & FL_FLY))
if (!((ent->flags & FL_SWIM) && (ent->waterlevel > 2))) if (!((ent->flags & FL_SWIM) && (ent->waterlevel > 2)))
{ {
if (ent->velocity[2] < sv_gravity->value*-0.1)
hitsound = true;
if (ent->waterlevel == 0) if (ent->waterlevel == 0)
SV_AddGravity (ent); SV_AddGravity (ent);
} }

View file

@ -782,7 +782,6 @@ void G_FindRouteLink(edict_t *ent)
{ {
trace_t rs_trace; trace_t rs_trace;
gitem_t *item;
qboolean tpbool; qboolean tpbool;
int i,j,k,l,total = 0; int i,j,k,l,total = 0;
@ -793,7 +792,6 @@ void G_FindRouteLink(edict_t *ent)
//旗を発生させる //旗を発生させる
if(!ctf->value && zigmode->value == 1) if(!ctf->value && zigmode->value == 1)
{ {
item = FindItem("Zig Flag");
SelectSpawnPoint (ent, v, vv); SelectSpawnPoint (ent, v, vv);
// VectorCopy (v, ent->s.origin); // VectorCopy (v, ent->s.origin);
if(ZIGDrop_Flag(ent,zflag_item)) if(ZIGDrop_Flag(ent,zflag_item))

View file

@ -396,15 +396,6 @@ speed default is 1000
void use_target_blaster (edict_t *self, edict_t *other, edict_t *activator) void use_target_blaster (edict_t *self, edict_t *other, edict_t *activator)
{ {
int effect;
if (self->spawnflags & 2)
effect = 0;
else if (self->spawnflags & 1)
effect = EF_HYPERBLASTER;
else
effect = EF_BLASTER;
fire_blaster (self, self->s.origin, self->movedir, self->dmg, self->speed, EF_BLASTER, MOD_TARGET_BLASTER); fire_blaster (self, self->s.origin, self->movedir, self->dmg, self->speed, EF_BLASTER, MOD_TARGET_BLASTER);
gi.sound (self, CHAN_VOICE, self->noise_index, 1, ATTN_NORM, 0); gi.sound (self, CHAN_VOICE, self->noise_index, 1, ATTN_NORM, 0);
} }

View file

@ -534,10 +534,10 @@ extern int meansOfDeath;
extern edict_t *g_edicts; extern edict_t *g_edicts;
#define FOFS(x) (int)&(((edict_t *)0)->x) #define FOFS(x) (size_t)&(((edict_t *)NULL)->x)
#define STOFS(x) (int)&(((spawn_temp_t *)0)->x) #define STOFS(x) (size_t)&(((spawn_temp_t *)NULL)->x)
#define LLOFS(x) (int)&(((level_locals_t *)0)->x) #define LLOFS(x) (size_t)&(((level_locals_t *)NULL)->x)
#define CLOFS(x) (int)&(((gclient_t *)0)->x) #define CLOFS(x) (size_t)&(((gclient_t *)NULL)->x)
#define random() ((rand () & 0x7fff) / ((float)0x7fff)) #define random() ((rand () & 0x7fff) / ((float)0x7fff))
#define crandom() (2.0 * (random() - 0.5)) #define crandom() (2.0 * (random() - 0.5))

View file

@ -147,7 +147,6 @@ void DeathmatchScoreboardMessage (edict_t *ent, edict_t *killer)
int sorted[MAX_CLIENTS]; int sorted[MAX_CLIENTS];
int sortedscores[MAX_CLIENTS]; int sortedscores[MAX_CLIENTS];
int score, total; int score, total;
int picnum;
int x, y; int x, y;
gclient_t *cl; gclient_t *cl;
edict_t *cl_ent; edict_t *cl_ent;
@ -197,7 +196,6 @@ void DeathmatchScoreboardMessage (edict_t *ent, edict_t *killer)
cl = &game.clients[sorted[i]]; cl = &game.clients[sorted[i]];
cl_ent = g_edicts + 1 + sorted[i]; cl_ent = g_edicts + 1 + sorted[i];
picnum = gi.imageindex ("i_fixme");
x = (i>=6) ? 160 : 0; x = (i>=6) ? 160 : 0;
y = 32 + 32 * (i%6); y = 32 + 32 * (i%6);

View file

@ -1321,7 +1321,7 @@ Handles color blends and view kicks
void B_DamageFeedback (edict_t *player) void B_DamageFeedback (edict_t *player)
{ {
gclient_t *client; gclient_t *client;
float realcount, count; float count;
int r, l; int r, l;
client = player->client; client = player->client;
@ -1364,7 +1364,6 @@ void B_DamageFeedback (edict_t *player)
} }
} }
realcount = count;
if (count < 10) if (count < 10)
count = 10; // always make a visible effect count = 10; // always make a visible effect

View file

@ -1069,9 +1069,9 @@ void Weapon_LockonRocketLauncher_Fire (edict_t *ent)
if(ent->client->resp.ctf_team != rs_trace.ent->client->resp.ctf_team) if(ent->client->resp.ctf_team != rs_trace.ent->client->resp.ctf_team)
{ {
ent->client->zc.lockon = true; ent->client->zc.lockon = true;
if(ent->client->zc.first_target != rs_trace.ent) if(ent->client->zc.first_target != rs_trace.ent)
gi.sound (ent, CHAN_AUTO, gi.soundindex("3zb/locrloc.wav"), 1, ATTN_NORM, 0); gi.sound (ent, CHAN_AUTO, gi.soundindex("3zb/locrloc.wav"), 1, ATTN_NORM, 0);
ent->client->zc.first_target = rs_trace.ent; ent->client->zc.first_target = rs_trace.ent;
} }
else ent->client->zc.first_target = NULL; else ent->client->zc.first_target = NULL;
} }

View file

@ -257,10 +257,6 @@ float anglemod(float a)
return a; return a;
} }
int i;
vec3_t corners[2];
// this is the slow, general version // this is the slow, general version
int BoxOnPlaneSide2 (vec3_t emins, vec3_t emaxs, struct cplane_s *p) int BoxOnPlaneSide2 (vec3_t emins, vec3_t emaxs, struct cplane_s *p)
{ {