From 0faa46986af423571abed004dea62b5f877bbf3f Mon Sep 17 00:00:00 2001 From: abalfoort Date: Sun, 11 Jun 2023 12:29:18 +0200 Subject: [PATCH] Issue 18: cleanup --- src/bot/fire.c | 20 -------------------- src/bot/func.c | 4 ---- src/bot/za.c | 21 +++++---------------- src/g_chase.c | 2 -- src/g_ctf.c | 4 ---- src/g_items.c | 4 +--- src/g_misc.c | 4 ---- src/g_phys.c | 3 --- src/g_spawn.c | 2 -- src/g_target.c | 9 --------- src/header/local.h | 8 ++++---- src/player/hud.c | 2 -- src/player/view.c | 3 +-- src/player/weapon.c | 6 +++--- src/shared/shared.c | 4 ---- 15 files changed, 14 insertions(+), 82 deletions(-) diff --git a/src/bot/fire.c b/src/bot/fire.c index aa4d71c..95fb314 100644 --- a/src/bot/fire.c +++ b/src/bot/fire.c @@ -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) { int mywep; - zgcl_t *zc; gclient_t *client; client = ent->client; - zc = &client->zc; 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) { int mywep; - zgcl_t *zc; gclient_t *client; client = ent->client; - zc = &client->zc; 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) { int mywep; - zgcl_t *zc; gclient_t *client; client = ent->client; - zc = &client->zc; 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) { int mywep; - zgcl_t *zc; gclient_t *client; client = ent->client; - zc = &client->zc; 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) { int k,mywep; - zgcl_t *zc; gclient_t *client; client = ent->client; - zc = &client->zc; 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) { int mywep; - zgcl_t *zc; gclient_t *client; client = ent->client; - zc = &client->zc; 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) { int mywep; - zgcl_t *zc; gclient_t *client; client = ent->client; - zc = &client->zc; 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) { int mywep; - zgcl_t *zc; gclient_t *client; client = ent->client; - zc = &client->zc; 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) { int mywep; - zgcl_t *zc; gclient_t *client; client = ent->client; - zc = &client->zc; 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) { int mywep; - zgcl_t *zc; gclient_t *client; client = ent->client; - zc = &client->zc; if(CanUsewep(ent,WEAP_BLASTER)) { diff --git a/src/bot/func.c b/src/bot/func.c index 3551a21..07c4b79 100644 --- a/src/bot/func.c +++ b/src/bot/func.c @@ -278,8 +278,6 @@ edict_t *Get_NewClient (void) //---------------------------------------------------------------- void Bot_Think (edict_t *self) { - gclient_t *client; - if (self->linkcount != self->monsterinfo.linkcount) { // self->monsterinfo.linkcount = self->linkcount; @@ -313,8 +311,6 @@ void Bot_Think (edict_t *self) Bots_Move_NORM (self); if(!self->inuse) return; //removed botself - client = self->client; - ClientBeginServerFrame (self); } if (self->linkcount != self->monsterinfo.linkcount) diff --git a/src/bot/za.c b/src/bot/za.c index 2dfa973..87bffaf 100644 --- a/src/bot/za.c +++ b/src/bot/za.c @@ -1205,7 +1205,7 @@ int Bot_Watermove ( edict_t *ent,vec3_t pos,float dist,float upd) vec3_t trmin,trmax,touchmin; float i,j; - float max,vec; + float vec; 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; vec = -1; - max = 0; for(i = 0;i < 360; i += 10) { if(i && upd > -13 && upd < 0/*13*/) break; @@ -1862,13 +1861,11 @@ JMPCHK: qboolean TargetJump(edict_t *ent,vec3_t tpos) { - zgcl_t *zc; float x,l,grav,vel,ypos,yori; vec3_t v,vv; 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; 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) { - zgcl_t *zc; float x,l,grav,vel,ypos,yori; vec3_t v,vv; int mf = false; 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; @@ -2005,13 +2000,11 @@ qboolean TargetJump_Turbo(edict_t *ent,vec3_t tpos) } qboolean TargetJump_Chk(edict_t *ent,vec3_t tpos,float defvel) { - zgcl_t *zc; float x,l,grav,vel,ypos,yori; vec3_t v,vv; 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; yori = ent->s.origin[2]; @@ -2299,7 +2292,7 @@ void Bots_Move_NORM (edict_t *ent) edict_t *it_ent; gitem_t *it; - edict_t *front,*left,*right,*e; + edict_t *e; char *string; @@ -5639,7 +5632,6 @@ GOMOVE: VCHCANSEL: //-------------------------------------------------------------------------------------- //ladder check - front = NULL, left = NULL, right = NULL; k = false; if(zc->route_trace && (zc->routeindex + 1) < CurrentIndex) { @@ -5667,7 +5659,6 @@ VCHCANSEL: VectorAdd(ent->s.origin,touchmin,touchmax); 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; @@ -5698,7 +5689,6 @@ VCHCANSEL: VectorAdd(ent->s.origin,touchmin,touchmax); 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; } @@ -5714,7 +5704,6 @@ VCHCANSEL: VectorAdd(ent->s.origin,touchmin,touchmax); 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; } diff --git a/src/g_chase.c b/src/g_chase.c index 5e7e9fa..8148fbf 100644 --- a/src/g_chase.c +++ b/src/g_chase.c @@ -7,7 +7,6 @@ void UpdateChaseCam(edict_t *ent) vec3_t forward, right; trace_t trace; int i; - vec3_t oldgoal; vec3_t angles; // is our chase target gone? @@ -25,7 +24,6 @@ void UpdateChaseCam(edict_t *ent) targ = ent->client->chase_target; VectorCopy(targ->s.origin, ownerv); - VectorCopy(ent->s.origin, oldgoal); ownerv[2] += targ->viewheight; diff --git a/src/g_ctf.c b/src/g_ctf.c index 18c1f81..c89b990 100644 --- a/src/g_ctf.c +++ b/src/g_ctf.c @@ -1030,8 +1030,6 @@ void SetCTFStats(edict_t *ent) e = G_Find(NULL, FOFS(classname), "item_flag_team1"); if (e != NULL) { if (e->solid == SOLID_NOT) { - int i; - // not at base // check if on player 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"); if (e != NULL) { if (e->solid == SOLID_NOT) { - int i; - // not at base // check if on player p2 = gi.imageindex ("i_ctf2d"); // default to dropped diff --git a/src/g_items.c b/src/g_items.c index 9dda6eb..f34bf28 100644 --- a/src/g_items.c +++ b/src/g_items.c @@ -1197,7 +1197,7 @@ droptofloor void droptofloor (edict_t *ent) { vec3_t trmin,trmax,min,mins,maxs; - float i,j,k,yaw; + float i,j,yaw; gitem_t *it; //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') { - k = 0; VectorCopy(ent->s.origin,min); VectorSet (mins, -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 ); VectorCopy(trx.endpos,it_ent->s.origin); SpawnItem3 (it_ent, it); - k = -1; } if(tr.endpos[2] < ent->s.origin[2] - 16 && tr.endpos[2] > min[2] && !tr.allsolid && !tr.startsolid) diff --git a/src/g_misc.c b/src/g_misc.c index e00ab07..3775c91 100644 --- a/src/g_misc.c +++ b/src/g_misc.c @@ -928,17 +928,13 @@ health (80), and dmg (150). */ void barrel_touch (edict_t *self, edict_t *other, cplane_t *plane, csurface_t *surf) - { - float ratio; vec3_t v; if ((!other->groundentity) || (other->groundentity == self)) return; - ratio = (float)other->mass / (float)self->mass; VectorSubtract (self->s.origin, other->s.origin, v); -// M_walkmove (self, vectoyaw(v), 20 * ratio * FRAMETIME); } void barrel_explode (edict_t *self) diff --git a/src/g_phys.c b/src/g_phys.c index d0bb83e..6098385 100644 --- a/src/g_phys.c +++ b/src/g_phys.c @@ -855,7 +855,6 @@ void P_FallingDamage (edict_t *ent); void SV_Physics_Step (edict_t *ent) { qboolean wasonground; - qboolean hitsound = false; float *vel; float speed, newspeed, control; float friction; @@ -887,8 +886,6 @@ void SV_Physics_Step (edict_t *ent) if (!(ent->flags & FL_FLY)) if (!((ent->flags & FL_SWIM) && (ent->waterlevel > 2))) { - if (ent->velocity[2] < sv_gravity->value*-0.1) - hitsound = true; if (ent->waterlevel == 0) SV_AddGravity (ent); } diff --git a/src/g_spawn.c b/src/g_spawn.c index 89b56d0..ecffb29 100644 --- a/src/g_spawn.c +++ b/src/g_spawn.c @@ -782,7 +782,6 @@ void G_FindRouteLink(edict_t *ent) { trace_t rs_trace; - gitem_t *item; qboolean tpbool; int i,j,k,l,total = 0; @@ -793,7 +792,6 @@ void G_FindRouteLink(edict_t *ent) //旗を発生させる if(!ctf->value && zigmode->value == 1) { - item = FindItem("Zig Flag"); SelectSpawnPoint (ent, v, vv); // VectorCopy (v, ent->s.origin); if(ZIGDrop_Flag(ent,zflag_item)) diff --git a/src/g_target.c b/src/g_target.c index 8fd8f74..aef8c0e 100644 --- a/src/g_target.c +++ b/src/g_target.c @@ -396,15 +396,6 @@ speed default is 1000 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); gi.sound (self, CHAN_VOICE, self->noise_index, 1, ATTN_NORM, 0); } diff --git a/src/header/local.h b/src/header/local.h index 3d5d543..6a70e1e 100644 --- a/src/header/local.h +++ b/src/header/local.h @@ -534,10 +534,10 @@ extern int meansOfDeath; extern edict_t *g_edicts; -#define FOFS(x) (int)&(((edict_t *)0)->x) -#define STOFS(x) (int)&(((spawn_temp_t *)0)->x) -#define LLOFS(x) (int)&(((level_locals_t *)0)->x) -#define CLOFS(x) (int)&(((gclient_t *)0)->x) +#define FOFS(x) (size_t)&(((edict_t *)NULL)->x) +#define STOFS(x) (size_t)&(((spawn_temp_t *)NULL)->x) +#define LLOFS(x) (size_t)&(((level_locals_t *)NULL)->x) +#define CLOFS(x) (size_t)&(((gclient_t *)NULL)->x) #define random() ((rand () & 0x7fff) / ((float)0x7fff)) #define crandom() (2.0 * (random() - 0.5)) diff --git a/src/player/hud.c b/src/player/hud.c index a5449b2..c80e6b2 100644 --- a/src/player/hud.c +++ b/src/player/hud.c @@ -147,7 +147,6 @@ void DeathmatchScoreboardMessage (edict_t *ent, edict_t *killer) int sorted[MAX_CLIENTS]; int sortedscores[MAX_CLIENTS]; int score, total; - int picnum; int x, y; gclient_t *cl; edict_t *cl_ent; @@ -197,7 +196,6 @@ void DeathmatchScoreboardMessage (edict_t *ent, edict_t *killer) cl = &game.clients[sorted[i]]; cl_ent = g_edicts + 1 + sorted[i]; - picnum = gi.imageindex ("i_fixme"); x = (i>=6) ? 160 : 0; y = 32 + 32 * (i%6); diff --git a/src/player/view.c b/src/player/view.c index 386b020..110f35a 100644 --- a/src/player/view.c +++ b/src/player/view.c @@ -1321,7 +1321,7 @@ Handles color blends and view kicks void B_DamageFeedback (edict_t *player) { gclient_t *client; - float realcount, count; + float count; int r, l; client = player->client; @@ -1364,7 +1364,6 @@ void B_DamageFeedback (edict_t *player) } } - realcount = count; if (count < 10) count = 10; // always make a visible effect diff --git a/src/player/weapon.c b/src/player/weapon.c index 8a7a4f7..6f73990 100644 --- a/src/player/weapon.c +++ b/src/player/weapon.c @@ -1069,9 +1069,9 @@ void Weapon_LockonRocketLauncher_Fire (edict_t *ent) if(ent->client->resp.ctf_team != rs_trace.ent->client->resp.ctf_team) { ent->client->zc.lockon = true; - if(ent->client->zc.first_target != rs_trace.ent) - gi.sound (ent, CHAN_AUTO, gi.soundindex("3zb/locrloc.wav"), 1, ATTN_NORM, 0); - 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); + ent->client->zc.first_target = rs_trace.ent; } else ent->client->zc.first_target = NULL; } diff --git a/src/shared/shared.c b/src/shared/shared.c index 8faf20a..896d0f4 100644 --- a/src/shared/shared.c +++ b/src/shared/shared.c @@ -257,10 +257,6 @@ float anglemod(float a) return a; } - int i; - vec3_t corners[2]; - - // this is the slow, general version int BoxOnPlaneSide2 (vec3_t emins, vec3_t emaxs, struct cplane_s *p) {