Skip to content

Commit

Permalink
add fix explosive hitbox as a wt
Browse files Browse the repository at this point in the history
  • Loading branch information
videoP committed Jan 3, 2024
1 parent 0fee2e4 commit a66aa79
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 16 deletions.
2 changes: 1 addition & 1 deletion codemp/game/g_local.h
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ extern int dueltypes[MAX_CLIENTS];//JAPRO - Serverside - Fullforce Duels y is th
#define WT_PROJECTILE_GRAVITY (1<<12)
#define WT_CENTER_MUZZLEPOINT (1<<13)
#define WT_PSEUDORANDOM_FIRE (1<<14)
//#define WT_ROCKET_MORTAR (1<<15)
#define WT_EXPLOSIVE_HITBOX (1<<15)
#define WT_ROCKET_REDEEMER (1<<16)
#define WT_INFINITE_AMMO (1<<17)
#define WT_STUN_HEAL (1<<18)
Expand Down
2 changes: 1 addition & 1 deletion codemp/game/g_svcmds.c
Original file line number Diff line number Diff line change
Expand Up @@ -825,7 +825,7 @@ static bitInfo_T weaponTweaks[] = { // MAX_WEAPON_TWEAKS tweaks (24)
{"Projectile gravity"},//13
{"Allow center muzzle"},//14
{"Pseudo random weapon spread"},//15
{"UNUSED"},//16
{"Fix explosive hitbox"},//16
{"Rocket alt fire redeemer"},//17
{"Infinite ammo"},//18
{"Stun baton heal gun"},//19
Expand Down
41 changes: 27 additions & 14 deletions codemp/game/g_weapon.c
Original file line number Diff line number Diff line change
Expand Up @@ -3472,6 +3472,15 @@ void laserTrapStick( gentity_t *ent, vec3_t endpos, vec3_t normal )
VectorCopy( ent->s.apos.trBase, ent->s.angles );
VectorCopy( ent->s.angles, ent->r.currentAngles );

//shove the box through the wall
if (g_tweakWeapons.integer & WT_EXPLOSIVE_HITBOX) {
VectorSet(ent->r.mins, -LT_SIZE * 3.5f, -LT_SIZE * 3.5f, -LT_SIZE * 3.5f);
VectorSet(ent->r.maxs, LT_SIZE * 3.5f, LT_SIZE * 3.5f, LT_SIZE * 3.5f);
}
else {
VectorSet(ent->r.mins, -LT_SIZE * 2, -LT_SIZE * 2, -LT_SIZE * 2);
VectorSet(ent->r.maxs, LT_SIZE * 2, LT_SIZE * 2, LT_SIZE * 2);
}

G_Sound( ent, CHAN_WEAPON, G_SoundIndex( "sound/weapons/laser_trap/stick.wav" ) );
if ( ent->count )
Expand All @@ -3485,11 +3494,6 @@ void laserTrapStick( gentity_t *ent, vec3_t endpos, vec3_t normal )
ent->takedamage = qtrue;
ent->health = 5;
ent->die = laserTrapDelayedExplode;

//shove the box through the wall
VectorSet( ent->r.mins, -LT_SIZE*2, -LT_SIZE*2, -LT_SIZE*2 );
VectorSet( ent->r.maxs, LT_SIZE*2, LT_SIZE*2, LT_SIZE*2 );

//so that the owner can blow it up with projectiles
ent->r.svFlags |= SVF_OWNERNOTSHARED;
}
Expand All @@ -3498,7 +3502,6 @@ void laserTrapStick( gentity_t *ent, vec3_t endpos, vec3_t normal )
ent->touch = touchLaserTrap;
ent->think = proxMineThink;//laserTrapExplode;


if (!(g_tweakWeapons.integer & WT_JK2_STYLE_ALT_TRIPMINE))
ent->genericValue15 = level.time + 30000; //auto-explode after 30 seconds.
ent->nextthink = level.time + LT_ALT_TIME; // How long 'til she blows
Expand All @@ -3508,10 +3511,6 @@ void laserTrapStick( gentity_t *ent, vec3_t endpos, vec3_t normal )
ent->health = 5;
ent->die = laserTrapDelayedExplode;

//shove the box through the wall
VectorSet( ent->r.mins, -LT_SIZE*2, -LT_SIZE*2, -LT_SIZE*2 );
VectorSet( ent->r.maxs, LT_SIZE*2, LT_SIZE*2, LT_SIZE*2 );

//so that the owner can blow it up with projectiles
ent->r.svFlags |= SVF_OWNERNOTSHARED;

Expand Down Expand Up @@ -3551,8 +3550,16 @@ void CreateLaserTrap( gentity_t *laserTrap, vec3_t start, gentity_t *owner )
laserTrap->parent = owner;
laserTrap->activator = owner;
laserTrap->r.ownerNum = owner->s.number;
VectorSet( laserTrap->r.mins, -LT_SIZE, -LT_SIZE, -LT_SIZE );
VectorSet( laserTrap->r.maxs, LT_SIZE, LT_SIZE, LT_SIZE );

if (g_tweakWeapons.integer & WT_EXPLOSIVE_HITBOX) {
VectorSet(laserTrap->r.mins, -LT_SIZE, -LT_SIZE, 0);
VectorSet(laserTrap->r.maxs, LT_SIZE, LT_SIZE, LT_SIZE * 2);
}
else {
VectorSet(laserTrap->r.mins, -LT_SIZE, -LT_SIZE, -LT_SIZE);
VectorSet(laserTrap->r.maxs, LT_SIZE, LT_SIZE, LT_SIZE);
}

laserTrap->clipmask = MASK_SHOT;
laserTrap->s.solid = 2;
laserTrap->s.modelindex = G_ModelIndex( "models/weapons2/laser_trap/laser_trap_w.glm" );
Expand Down Expand Up @@ -3890,8 +3897,14 @@ void drop_charge (gentity_t *self, vec3_t start, vec3_t dir)
bolt->s.genericenemyindex = self->s.number+MAX_GENTITIES;
//rww - so client prediction knows we own this and won't hit it

VectorSet( bolt->r.mins, -2, -2, -2 );
VectorSet( bolt->r.maxs, 2, 2, 2 );
if (g_tweakWeapons.integer & WT_EXPLOSIVE_HITBOX) {
VectorSet(bolt->r.mins, -2, -2, 0);
VectorSet(bolt->r.maxs, 2, 2, 4);
}
else {
VectorSet(bolt->r.mins, -2, -2, -2);
VectorSet(bolt->r.maxs, 2, 2, 2);
}

bolt->pain = DetPackPain;
bolt->die = DetPackDie;
Expand Down

0 comments on commit a66aa79

Please sign in to comment.