Skip to content

Commit

Permalink
De-constified a bunch of stuff, what a hassle
Browse files Browse the repository at this point in the history
  • Loading branch information
darkshade9 committed Feb 5, 2024
1 parent 8f95ae7 commit e302fdc
Show file tree
Hide file tree
Showing 15 changed files with 60 additions and 22 deletions.
4 changes: 3 additions & 1 deletion src/action/a_cmds.c
Original file line number Diff line number Diff line change
Expand Up @@ -850,7 +850,9 @@ void Cmd_Bandage_f(edict_t *ent)
if(ent->client->quad_framenum > level.framenum)
damage *= 1.5f;

fire_grenade2(ent, ent->s.origin, vec3_origin, damage, 0, 2 * HZ, damage * 2, false);
vec3_t non_const_origin; // Convert to non-const
VectorCopy(vec3_origin, non_const_origin);
fire_grenade2(ent, ent->s.origin, non_const_origin, damage, 0, 2 * HZ, damage * 2, false);

INV_AMMO(ent, GRENADE_NUM)--;
if (INV_AMMO(ent, GRENADE_NUM) <= 0) {
Expand Down
5 changes: 4 additions & 1 deletion src/action/a_team.c
Original file line number Diff line number Diff line change
Expand Up @@ -1208,7 +1208,10 @@ void killPlayer( edict_t *ent, qboolean suicidePunish )
ent->flags &= ~FL_GODMODE;
ent->health = 0;
meansOfDeath = MOD_SUICIDE;
player_die(ent, ent, ent, damage, vec3_origin);

vec3_t non_const_origin; // Convert to non-const
VectorCopy(vec3_origin, non_const_origin);
player_die(ent, ent, ent, damage, non_const_origin);
ent->deadflag = DEAD_DEAD;
}

Expand Down
4 changes: 3 additions & 1 deletion src/action/acesrc/acebot_spawn.c
Original file line number Diff line number Diff line change
Expand Up @@ -691,7 +691,9 @@ void ACESP_RemoveBot(char *name)
if( bot->is_bot && (remove_all || !strlen(name) || Q_stricmp(bot->client->pers.netname,name)==0 || (find_team && bot->client->resp.team==find_team)) )
{
bot->health = 0;
player_die (bot, bot, bot, 100000, vec3_origin);
vec3_t non_const_origin; // Convert to non-const
VectorCopy(vec3_origin, non_const_origin);
player_die (bot, bot, bot, 100000, non_const_origin);
// don't even bother waiting for death frames
// bot->deadflag = DEAD_DEAD;
// bot->inuse = false;
Expand Down
8 changes: 6 additions & 2 deletions src/action/cgf_sfx_glass.c
Original file line number Diff line number Diff line change
Expand Up @@ -279,8 +279,10 @@ CGF_SFX_ShootBreakableGlass (edict_t * aGlassPane, edict_t * anAttacker,
if (destruct)
{
// break glass (and hurt if doing kick)
vec3_t non_const_origin; // Convert to non-const
VectorCopy(vec3_origin, non_const_origin);
CGF_SFX_BreakGlass (aGlassPane, anAttacker, 0, aGlassPane->health,
vec3_origin, FRAMETIME);
non_const_origin, FRAMETIME);
if (mod == MOD_KICK)
{
vec3_t bloodorigin;
Expand Down Expand Up @@ -421,7 +423,9 @@ CGF_SFX_TouchGlass (edict_t * self, edict_t * other, cplane_t * plane,
goto knife_and_grenade_handling;

// break glass
CGF_SFX_BreakGlass (glass, other, other, glass->health, vec3_origin,
vec3_t non_const_origin; // Convert to non-const
VectorCopy(vec3_origin, non_const_origin);
CGF_SFX_BreakGlass (glass, other, other, glass->health, non_const_origin,
3.0f * FRAMETIME);
// glass can take care of itself, but the trigger isn't needed anymore
G_FreeEdict (self);
Expand Down
15 changes: 10 additions & 5 deletions src/action/g_combat.c
Original file line number Diff line number Diff line change
Expand Up @@ -202,8 +202,7 @@ qboolean CanDamage (edict_t * targ, edict_t * inflictor)
Killed
============
*/
void Killed (edict_t * targ, edict_t * inflictor, edict_t * attacker, int damage,
const vec3_t point)
void Killed (edict_t * targ, edict_t * inflictor, edict_t * attacker, int damage, vec3_t point)
{
if (targ->health < -999)
targ->health = -999;
Expand Down Expand Up @@ -507,8 +506,12 @@ void T_Damage (edict_t * targ, edict_t * inflictor, edict_t * attacker, const ve

if (from_top < 2 * HEAD_HEIGHT)
{
vec3_t new_point;
VerifyHeadShot(point, dir, HEAD_HEIGHT, new_point);
vec3_t new_point, deconst_point, deconst_dir;

//De-constify the point and dir
VectorCopy(point, deconst_point);
VectorCopy(dir, deconst_dir);
VerifyHeadShot(deconst_point, deconst_dir, HEAD_HEIGHT, new_point);
VectorSubtract(new_point, targ->s.origin, new_point);
//gi.cprintf(attacker, PRINT_HIGH, "z: %d y: %d x: %d\n", (int)(targ_maxs2 - new_point[2]),(int)(new_point[1]) , (int)(new_point[0]) );

Expand Down Expand Up @@ -843,7 +846,9 @@ void T_Damage (edict_t * targ, edict_t * inflictor, edict_t * attacker, const ve

if ((targ->svflags & SVF_MONSTER) || client)
targ->flags |= FL_NO_KNOCKBACK;
Killed(targ, inflictor, attacker, take, point);
vec3_t non_const_origin; // Convert to non-const
VectorCopy(vec3_origin, non_const_origin);
Killed(targ, inflictor, attacker, take, non_const_origin);
return;
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/action/g_ext.c
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ void(*engine_CvarSync_Set)(int index, const char *name, const char *val);
//
// optional new entrypoints the engine may want to call
edict_t *xerp_ent;
trace_t q_gameabi XERP_trace(vec3_t start, vec3_t mins, vec3_t maxs, vec3_t end)
trace_t q_gameabi XERP_trace(const vec3_t start, const vec3_t mins, const vec3_t maxs, const vec3_t end)
{
return gi.trace(start, mins, maxs, end, xerp_ent, MASK_PLAYERSOLID);
}
Expand Down
7 changes: 5 additions & 2 deletions src/action/g_grapple.c
Original file line number Diff line number Diff line change
Expand Up @@ -310,9 +310,12 @@ void CTFGrappleFire (edict_t *ent, vec3_t g_offset, int damage, int effect)
void CTFWeapon_Grapple_Fire (edict_t *ent)
{
int damage;

vec3_t non_const_origin;
damage = 10;
CTFGrappleFire (ent, vec3_origin, damage, 0);

// Copy const to non-const
VectorCopy(vec3_origin, non_const_origin);
CTFGrappleFire (ent, non_const_origin, damage, 0);
ent->client->ps.gunframe++;
}

Expand Down
2 changes: 1 addition & 1 deletion src/action/g_local.h
Original file line number Diff line number Diff line change
Expand Up @@ -2392,7 +2392,7 @@ void A_ScoreboardMessage( edict_t * ent, edict_t * killer );
//local to g_combat but needed in p_view
void SpawnDamage (int type, const vec3_t origin, const vec3_t normal, int damage);
void Killed (edict_t * targ, edict_t * inflictor, edict_t * attacker,
int damage, const vec3_t point);
int damage, vec3_t point);

void Add_Frag(edict_t * ent, int mod);
void Subtract_Frag (edict_t * ent);
Expand Down
2 changes: 1 addition & 1 deletion src/action/g_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -540,7 +540,7 @@ cvar_t *cl_discord_discriminator;
cvar_t *cl_discord_username;
cvar_t *cl_discord_avatar;

void SpawnEntities (char *mapname, char *entities, char *spawnpoint);
void SpawnEntities (const char *mapname, const char *entities, const char *spawnpoint);
void ClientThink (edict_t * ent, usercmd_t * cmd);
qboolean ClientConnect (edict_t * ent, char *userinfo);
void ClientUserinfoChanged (edict_t * ent, char *userinfo);
Expand Down
7 changes: 5 additions & 2 deletions src/action/g_misc.c
Original file line number Diff line number Diff line change
Expand Up @@ -730,7 +730,7 @@ one small chunk per 25 of mass (up to 16). So 800 gives the most.
*/
void
func_explosive_explode (edict_t * self, edict_t * inflictor,
edict_t * attacker, int damage, const vec3_t point)
edict_t * attacker, int damage, vec3_t point)
{
vec3_t origin;
vec3_t chunkorigin;
Expand Down Expand Up @@ -799,7 +799,10 @@ func_explosive_explode (edict_t * self, edict_t * inflictor,
void
func_explosive_use (edict_t * self, edict_t * other, edict_t * activator)
{
func_explosive_explode (self, self, other, self->health, vec3_origin);
vec3_t origin;
VectorCopy(vec3_origin, origin);
// This needs to be non-const
func_explosive_explode (self, self, other, self->health, origin);
}

void
Expand Down
2 changes: 1 addition & 1 deletion src/action/g_spawn.c
Original file line number Diff line number Diff line change
Expand Up @@ -913,7 +913,7 @@ Creates a server's entity / program execution context by
parsing textual entity definitions out of an ent file.
==============
*/
void SpawnEntities (char *mapname, const char *entities, const char *spawnpoint)
void SpawnEntities (const char *mapname, const char *entities, const char *spawnpoint)
{
edict_t *ent = NULL;
gclient_t *client;
Expand Down
4 changes: 3 additions & 1 deletion src/action/p_client.c
Original file line number Diff line number Diff line change
Expand Up @@ -1561,7 +1561,9 @@ void player_die(edict_t *self, edict_t *inflictor, edict_t *attacker, int damage
// Reset Grenade Damage to 1.52 when requested:
int damrad = use_classic->value ? GRENADE_DAMRAD_CLASSIC : GRENADE_DAMRAD;
self->client->ps.gunframe = 0;
fire_grenade2( self, self->s.origin, vec3_origin, damrad, 0, 2 * HZ, damrad * 2, false );
vec3_t non_const_origin; // Convert to non-const
VectorCopy(vec3_origin, non_const_origin);
fire_grenade2( self, self->s.origin, non_const_origin, damrad, 0, 2 * HZ, damrad * 2, false );
}

mod = meansOfDeath & ~MOD_FRIENDLY_FIRE;
Expand Down
8 changes: 6 additions & 2 deletions src/action/p_weapon.c
Original file line number Diff line number Diff line change
Expand Up @@ -929,7 +929,9 @@ void Drop_Weapon(edict_t* ent, gitem_t* item)
if (ent->client->quad_framenum > level.framenum)
damage *= 1.5f;

fire_grenade2(ent, ent->s.origin, vec3_origin, damage, 0, 2 * HZ, damage * 2, false);
vec3_t non_const_origin; // Convert to non-const
VectorCopy(vec3_origin, non_const_origin);
fire_grenade2(ent, ent->s.origin, non_const_origin, damage, 0, 2 * HZ, damage * 2, false);

INV_AMMO(ent, GRENADE_NUM)--;
ent->client->newweapon = GET_ITEM(MK23_NUM);
Expand Down Expand Up @@ -3748,7 +3750,9 @@ void Weapon_Gas(edict_t* ent)
if (is_quad)
damage *= 1.5f;

fire_grenade2(ent, ent->s.origin, vec3_origin, damage, 0, 2 * HZ, damage * 2, false);
vec3_t non_const_origin; // Convert to non-const
VectorCopy(vec3_origin, non_const_origin);
fire_grenade2(ent, ent->s.origin, non_const_origin, damage, 0, 2 * HZ, damage * 2, false);

INV_AMMO(ent, GRENADE_NUM)--;
if (INV_AMMO(ent, GRENADE_NUM) <= 0)
Expand Down
10 changes: 10 additions & 0 deletions src/client/demo.c
Original file line number Diff line number Diff line change
Expand Up @@ -416,8 +416,13 @@ static void CL_Record_f(void)

// send the serverdata
MSG_WriteByte(svc_serverdata);
#if USE_AQTION
if (cl.csr.extended)
MSG_WriteLong(PROTOCOL_VERSION_AQTION);
#else
if (cl.csr.extended)
MSG_WriteLong(PROTOCOL_VERSION_EXTENDED);
#endif
else
MSG_WriteLong(min(cls.serverProtocol, PROTOCOL_VERSION_DEFAULT));
MSG_WriteLong(cl.servercount);
Expand Down Expand Up @@ -1181,8 +1186,13 @@ demoInfo_t *CL_GetDemoInfo(const char *path, demoInfo_t *info)
goto fail;
}
c = MSG_ReadLong();
#if USE_AQTION
if (c == PROTOCOL_VERSION_AQTION) {
csr = &cs_remap_new;
#else
if (c == PROTOCOL_VERSION_EXTENDED) {
csr = &cs_remap_new;
#endif
} else if (c < PROTOCOL_VERSION_OLD || c > PROTOCOL_VERSION_DEFAULT) {
goto fail;
}
Expand Down
2 changes: 1 addition & 1 deletion src/client/parse.c
Original file line number Diff line number Diff line change
Expand Up @@ -566,7 +566,7 @@ static void CL_ParseServerData(void)
cls.serverProtocol, protocol);
}
// BIG HACK to let demos from release work with the 3.0x patch!!!
if (protocol == PROTOCOL_VERSION_EXTENDED) {
if (protocol == PROTOCOL_VERSION_EXTENDED || protocol == PROTOCOL_VERSION_AQTION) {
cl.csr = cs_remap_new;
protocol = PROTOCOL_VERSION_DEFAULT;
} else if (protocol < PROTOCOL_VERSION_OLD || protocol > PROTOCOL_VERSION_AQTION) {
Expand Down

0 comments on commit e302fdc

Please sign in to comment.