Skip to content

Commit

Permalink
the crate is now its own weapon with ammo and auto switch logic, curr…
Browse files Browse the repository at this point in the history
…ently locks you into holding it until thrown.
  • Loading branch information
nick-hopoo committed Jul 18, 2023
1 parent c9d7bce commit 4ae01ee
Show file tree
Hide file tree
Showing 5 changed files with 51 additions and 10 deletions.
15 changes: 12 additions & 3 deletions testmod/bizzBounceBomb.qc
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,14 @@
// remove(self);
// };

void() AutoSwitchToCratesOnAxeHit =
{
self.weapon = IT_CRATES;
self.weaponmodel = "progs/v_holdbox.mdl";
self.items = self.items | IT_CRATES;
self.ammo_type = AT_CRATES;
};

void() WaitForPlayerExit =
{
local float StopThinking = 0;
Expand Down Expand Up @@ -79,7 +87,7 @@ void(entity parent, string modl, vector org, float oldXAng, float oldYAng, float
newmis = spawn ();
newmis.movetype = MOVETYPE_STEP;
newmis.solid = SOLID_BBOX;
// newmis.classname = class;
newmis.classname = "bizzCrate";

setmodel (newmis, modl);
//set angle to nearest 90 so it can always match hitbox but also be near its last visual rotation on landing
Expand Down Expand Up @@ -246,7 +254,7 @@ void(entity parent, string modl, vector org, vector vel, INTEGER effect, INTEGER
newmis.owner = parent;
newmis.movetype = MOVETYPE_FLYMISSILE;
newmis.solid = SOLID_SLIDEBOX;
// newmis.classname = class;
newmis.classname = "bizzCrate";
newmis.velocity = vel;

newmis.damage_direct = damg;
Expand Down Expand Up @@ -281,8 +289,9 @@ void() W_FireBounceBomb =
// all the deathmatch code is probably worthless but I won't remove it.
if (deathmatch != 4)
{
self.ammo_rockets_real -= 1;
self.ammo_crates_real -= 1;
W_UpdateAmmoCounts(self);
dprint(ftos(self.ammo_crates_real));
}

sound (self, CHAN_WEAPON, "weapons/grenade.wav", 1, ATTN_NORM);
Expand Down
9 changes: 9 additions & 0 deletions testmod/defs.qc
Original file line number Diff line number Diff line change
Expand Up @@ -306,6 +306,8 @@ float IT_GRENADE_LAUNCHER = 16;
float IT_ROCKET_LAUNCHER = 32;
float IT_LIGHTNING = 64;
float IT_EXTRA_WEAPON = 128;
// custom bIZZ
float IT_CRATES = 8388608;

float IT_SHELLS = 256;
float IT_NAILS = 512;
Expand Down Expand Up @@ -370,6 +372,9 @@ float TE_LIGHTNINGBLOOD = 13;

//Bizz custom tracked variables
.float BIZZ_AXECLIMB;
//bizz below this is custom, crates are custom. Normally you can only have the one - Bizz
.float AMMO_CRATES;
// end of custom ammo


// sound channels
Expand Down Expand Up @@ -483,6 +488,7 @@ entity shub; // boss entity
.INTEGER ammo_nails_real; // real nails count
.INTEGER ammo_rockets_real; // real rockets count
.INTEGER ammo_cells_real; // real cells count
.INTEGER ammo_crates_real; // real crates count BIZZ custom

// Zoid Additions
noref .float maxspeed; // Used to set Maxspeed on a player
Expand Down Expand Up @@ -557,6 +563,9 @@ enum {
AT_SHELLS,
AT_NAILS,
AT_ROCKETS,
// custom BIZZ
AT_CRATES,
// custom
AT_CELLS
};

Expand Down
Binary file modified testmod/qwprogs.dat
Binary file not shown.
Binary file modified testmod/qwprogs.lno
Binary file not shown.
37 changes: 30 additions & 7 deletions testmod/weapons.qc
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,9 @@ void(entity ent) W_UpdateAmmoCounts =
case AT_ROCKETS:
ent.currentammo = ent.ammo_rockets_real;
break;
case AT_CRATES:
ent.currentammo = ent.ammo_crates_real;
break;
case AT_CELLS:
ent.currentammo = ent.ammo_cells_real;
break;
Expand Down Expand Up @@ -461,8 +464,8 @@ W_FireGrenade
void() W_FireGrenade =
{
//intercept with BounceBomb - Bizz
W_FireBounceBomb ();
return;
// W_FireBounceBomb ();
// return;
// end of intercept
local vector vel;

Expand Down Expand Up @@ -568,6 +571,8 @@ BOOL(float wep) W_HasAmmo =
return self.ammo_nails_real >= 1;
case IT_SUPER_NAILGUN:
return self.ammo_nails_real >= 2;
case IT_CRATES:
return self.ammo_crates_real >= 1;
case IT_GRENADE_LAUNCHER:
case IT_ROCKET_LAUNCHER:
return self.ammo_rockets_real >= 1;
Expand Down Expand Up @@ -610,11 +615,16 @@ void() W_UpdateWeapon =
self.items = self.items | IT_NAILS;
self.ammo_type = AT_NAILS;
break;
case IT_GRENADE_LAUNCHER:
case IT_CRATES:
self.weaponmodel = "progs/v_holdbox.mdl";
self.items = self.items | IT_ROCKETS;
self.ammo_type = AT_ROCKETS;
self.items = self.items | IT_CRATES;
self.ammo_type = AT_CRATES;
break;
case IT_GRENADE_LAUNCHER:
self.weaponmodel = "progs/v_rock.mdl";
self.items = self.items | IT_ROCKETS;
self.ammo_type = AT_ROCKETS;
break;
case IT_ROCKET_LAUNCHER:
self.weaponmodel = "progs/v_rock2.mdl";
self.items = self.items | IT_ROCKETS;
Expand Down Expand Up @@ -647,6 +657,7 @@ void(float weap) W_WeaponSwitch =

float() W_BestWeapon =
{
// BIZZ - there may be a bug here related to wanting to auto-switch to crates while underwater instead of Lightning gun or whatever...?
float fl;

if (self.waterlevel <= 1)
Expand All @@ -662,6 +673,9 @@ float() W_BestWeapon =
// best weapon order
switch (fl)
{
case IT_CRATES:
fl = IT_LIGHTNING;
break;
case IT_LIGHTNING:
fl = IT_SUPER_NAILGUN;
break;
Expand Down Expand Up @@ -829,8 +843,12 @@ void() W_Attack =
r = 0.1;
break;
case IT_GRENADE_LAUNCHER:
W_FireGrenade();
r = 0.6;
break;
case IT_CRATES:
W_FireBounceBomb();
r = 0.8;
r = 0.5;
break;
case IT_ROCKET_LAUNCHER:
W_FireRocket();
Expand Down Expand Up @@ -886,6 +904,9 @@ void() W_ChangeWeapon =
case 8:
fl = IT_LIGHTNING;
break;
case 9:
fl = IT_CRATES;
break;
}


Expand Down Expand Up @@ -918,6 +939,7 @@ void() CheatCommand =
return;

self.ammo_rockets_real = 100;
self.ammo_crates_real = 1;
self.ammo_nails_real = 200;
self.ammo_shells_real = 100;
self.ammo_cells_real = 100;
Expand All @@ -927,11 +949,12 @@ void() CheatCommand =
IT_NAILGUN |
IT_SUPER_NAILGUN |
IT_GRENADE_LAUNCHER |
IT_CRATES |
IT_ROCKET_LAUNCHER |
IT_LIGHTNING |
IT_KEY1 | IT_KEY2;

W_WeaponSwitch (IT_ROCKET_LAUNCHER);
W_WeaponSwitch (IT_CRATES);
};

/*
Expand Down

0 comments on commit 4ae01ee

Please sign in to comment.