Skip to content

Commit

Permalink
Zscripted 2 weapons
Browse files Browse the repository at this point in the history
- ported pump shotgun and revolver to zscript
- revolver now has ADS (thanks MG0061), use it with secondary attack button
- revolver fan fire its still usable by pressing fire again after firing but before it goes back to ready
  • Loading branch information
jaih1r0 committed Sep 18, 2024
1 parent c223755 commit d3fb6b6
Show file tree
Hide file tree
Showing 38 changed files with 2,558 additions and 3 deletions.
19 changes: 18 additions & 1 deletion BMAP/Revolver.txt
Original file line number Diff line number Diff line change
Expand Up @@ -556,4 +556,21 @@ brightmap sprite 43V3D0 { map "Brightmaps/WEAPONS/Revolver/DUALMAG/Unload/43V3D0
brightmap sprite 43V3E0 { map "Brightmaps/WEAPONS/Revolver/DUALMAG/Unload/43V3E0.png" }
brightmap sprite 43V3F0 { map "Brightmaps/WEAPONS/Revolver/DUALMAG/Unload/43V3F0.png" }
brightmap sprite 43V3G0 { map "Brightmaps/WEAPONS/Revolver/DUALMAG/Unload/43V3G0.png" }
brightmap sprite 43V3H0 { map "Brightmaps/WEAPONS/Revolver/DUALMAG/Unload/43V3H0.png" }
brightmap sprite 43V3H0 { map "Brightmaps/WEAPONS/Revolver/DUALMAG/Unload/43V3H0.png" }

//ADS
brightmap sprite R4V2A0 { map "brightmaps/weapons/slot 2/revolver/R4V2A0.png" disablefullbright }
brightmap sprite R4V2B0 { map "brightmaps/weapons/slot 2/revolver/R4V2B0.png" disablefullbright }
brightmap sprite R4V2C0 { map "brightmaps/weapons/slot 2/revolver/R4V2C0.png" disablefullbright }
brightmap sprite R4V2D0 { map "brightmaps/weapons/slot 2/revolver/R4V2D0.png" disablefullbright }
brightmap sprite R4V2E0 { map "brightmaps/weapons/slot 2/revolver/R4V2E0.png" disablefullbright }
brightmap sprite R4V2F0 { map "brightmaps/weapons/slot 2/revolver/R4V2F0.png" disablefullbright }

brightmap sprite R4V3A0 { map "brightmaps/weapons/slot 2/revolver/R4V3A0.png" disablefullbright }
brightmap sprite R4V3B0 { map "brightmaps/weapons/slot 2/revolver/R4V3B0.png" disablefullbright }
brightmap sprite R4V3C0 { map "brightmaps/weapons/slot 2/revolver/R4V3C0.png" disablefullbright }
brightmap sprite R4V3D0 { map "brightmaps/weapons/slot 2/revolver/R4V3D0.png" disablefullbright }
brightmap sprite R4V3E0 { map "brightmaps/weapons/slot 2/revolver/R4V3E0.png" disablefullbright }
brightmap sprite R4V3F0 { map "brightmaps/weapons/slot 2/revolver/R4V3F0.png" disablefullbright }
brightmap sprite R4V3G0 { map "brightmaps/weapons/slot 2/revolver/R4V3G0.png" disablefullbright }
brightmap sprite R4V3H0 { map "brightmaps/weapons/slot 2/revolver/R4V3H0.png" disablefullbright }
4 changes: 2 additions & 2 deletions DECORATE
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ Actor IsTacticalClass : Inventory {} //Fake item to fix the lag.
#include "actors/Weapons/Slot1/Axe.dec"
#include "actors/Weapons/Slot1/SAW.dec"
#include "actors/Weapons/Slot4/PBRIFLE.dec"
#include "actors/Weapons/Slot3/SHOTGUN.dec"
//#include "actors/Weapons/Slot3/SHOTGUN.dec"
#include "actors/Weapons/Slot3/SSG.dec"
#include "actors/Weapons/Slot4/MINIGUN.dec"
#include "actors/Weapons/Slot5/ROCKETLAUNCHER.dec"
Expand Down Expand Up @@ -236,7 +236,7 @@ Actor IsTacticalClass : Inventory {} //Fake item to fix the lag.
#include "actors/Weapons/Throwables.dec"
#include "actors/Weapons/Slot2/PBPISTOL.dec"
#include "actors/Weapons/Slot2/Deagle.dec"
#include "actors/Weapons/Slot2/REVOLVER.dec"
//#include "actors/Weapons/Slot2/REVOLVER.dec"
#include "actors/Weapons/Slot2/UACSMG.dec"
#include "actors/Weapons/Slot2/MP40.dec"
#include "actors/Weapons/Slot3/AUTOSHOTGUN.dec"
Expand Down
Binary file added SPRITES/WEAPONS/Slot 2/REVOLVER/Ads/R4V2A0.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added SPRITES/WEAPONS/Slot 2/REVOLVER/Ads/R4V2B0.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added SPRITES/WEAPONS/Slot 2/REVOLVER/Ads/R4V2C0.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added SPRITES/WEAPONS/Slot 2/REVOLVER/Ads/R4V2D0.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added SPRITES/WEAPONS/Slot 2/REVOLVER/Ads/R4V2E0.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added SPRITES/WEAPONS/Slot 2/REVOLVER/Ads/R4V2F0.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added SPRITES/WEAPONS/Slot 2/REVOLVER/Ads/R4V3A0.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added SPRITES/WEAPONS/Slot 2/REVOLVER/Ads/R4V3B0.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added SPRITES/WEAPONS/Slot 2/REVOLVER/Ads/R4V3C0.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added SPRITES/WEAPONS/Slot 2/REVOLVER/Ads/R4V3D0.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added SPRITES/WEAPONS/Slot 2/REVOLVER/Ads/R4V3E0.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added SPRITES/WEAPONS/Slot 2/REVOLVER/Ads/R4V3F0.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added SPRITES/WEAPONS/Slot 2/REVOLVER/Ads/R4V3G0.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added SPRITES/WEAPONS/Slot 2/REVOLVER/Ads/R4V3H0.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added SPRITES/WEAPONS/Slot 2/REVOLVER/Ads/R4V4A0.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added SPRITES/WEAPONS/Slot 2/REVOLVER/Ads/R4V4B0.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added SPRITES/WEAPONS/Slot 2/REVOLVER/Ads/R4V4C0.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added SPRITES/WEAPONS/Slot 2/REVOLVER/Ads/R4V4D0.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions ZSCRIPT.zc
Original file line number Diff line number Diff line change
Expand Up @@ -212,6 +212,9 @@ const MAXITERATIONS = 32676;
#include "zscript/Weapons/ThrownGrenades.zs"
#include "zscript/Weapons/Keepweapmanager.zsc"

#include "zscript/Weapons/Slot2/Revolver.zs"
#include "zscript/Weapons/Slot3/Shotgun.zs"

//Spawners
#include "zscript/Spawner/PB_SpawnerBase.zc"
#include "zscript/Spawner/PB_SpawnerTypes.zc"
Expand Down
Binary file added brightmaps/WEAPONS/Slot 2/Revolver/R4V2A0.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added brightmaps/WEAPONS/Slot 2/Revolver/R4V2B0.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added brightmaps/WEAPONS/Slot 2/Revolver/R4V2C0.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added brightmaps/WEAPONS/Slot 2/Revolver/R4V2D0.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added brightmaps/WEAPONS/Slot 2/Revolver/R4V2E0.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added brightmaps/WEAPONS/Slot 2/Revolver/R4V2F0.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added brightmaps/WEAPONS/Slot 2/Revolver/R4V3A0.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added brightmaps/WEAPONS/Slot 2/Revolver/R4V3B0.png
Binary file added brightmaps/WEAPONS/Slot 2/Revolver/R4V3C0.png
Binary file added brightmaps/WEAPONS/Slot 2/Revolver/R4V3D0.png
Binary file added brightmaps/WEAPONS/Slot 2/Revolver/R4V3E0.png
Binary file added brightmaps/WEAPONS/Slot 2/Revolver/R4V3F0.png
Binary file added brightmaps/WEAPONS/Slot 2/Revolver/R4V3G0.png
Binary file added brightmaps/WEAPONS/Slot 2/Revolver/R4V3H0.png
121 changes: 121 additions & 0 deletions zscript/Weapons/BaseWeapon_Functions.zsc
Original file line number Diff line number Diff line change
@@ -1,5 +1,126 @@
extend class PB_WeaponBase
{
//these functions were added to simplify part of the states from pb weapons

//raises the weapon, and plays a raise sound if any
//also this avoids needing to go to SelectFirstPersonLegs state after the select state
//so it can go select -> selectcontinue -> selectanimation
action void PB_WeaponRaise(string upSnd = "")
{
A_weaponoffset(0,32);
if(upSnd)
A_startsound(upSnd,32); //play the select sound if defined

A_setroll(0);
A_zoomfactor(1.0);

//this was in the SelectFirstPersonLegs state
A_StopSound(1);
A_StopSound(CHAN_VOICE);
A_StopSound(5);
A_StopSound(6);
A_StopSound(7);
A_StopSOund(CHAN_AUTO);

A_SetInventory("Spin",0);
A_SetInventory("CantWeaponSpecial",0); //Fixes bug with Weapon Special Key no longer working when changing SGL grenade type or RL missile mode
A_SetInventory("MG42Selected",0); //Take this token on every weapon that's not the MG42.
A_SetInventory("Grabbing_A_Ledge", 0); //Fixed bug where movement is locked when vaulting after entering a level
A_SetInventory("RandomHeadExploder",0);
A_SetInventory("DualFireReload",0);
A_SetInventory("Kicking",0);
A_SetInventory("Zoomed",0);

A_ClearOverlays(-999, -999);
A_Overlay(-777, "Melee_Equipment_Handler_Overlay");
A_Overlay(-778, "KickHandler_Overlay");
A_Overlay(-779, "Equipment_Toggle_Handler_Overlay");
A_Overlay(-10, "FirstPersonLegsStand");

PB_SetUsingKick(false);
PB_SetUsingMelee(false);
PB_SetUsingEquipment(false);
PB_SetExecutingEnemy(false);
}

//put this in the beggining of the reload state
// -emptyReload is meant for guns that have different reloads when its empty, if its not the case just pass null (without "")
// -fullAlready is the state it jumps if its already full, usually just ready3
// -noAmmo is the state to jump if theres no reserve ammo
// -full is the amount considered for the gun to be full
// -equal is the equivalence between the ammo reserve and a single bullet/shell/whateverammouses loaded
action state PB_checkReload(statelabel emptyReload,statelabel fullAlready,statelabel noAmmo,int full = 30,int equal = 1)
{
int amount1 = countinv(invoker.ammotype1); //reserve
int amount2 = countinv(invoker.ammotype2); //to be loaded

if(amount2 >= full) //if the weapon is already full
return resolvestate(fullAlready);

if(amount1 < equal) //if theres no reserve ammo enough to reload a single bullet
return resolvestate(noAmmo);

if(amount2 <= 0) //if the chamber was empty
return resolvestate(EmptyReload);

return resolvestate(null);
}

//maybe constants would be better for this
action bool,int isHoldingBarrel()
{
if(findinventory("GrabbedBarrel"))
return true,1;
if(findinventory("GrabbedFlameBarrel"))
return true,2;
if(findinventory("GrabbedIceBarrel"))
return true,3;

return false,0;
}

//to avoid spaming A_jumpifinventory(barrel, barrelstate)
//just pass the respective state to jump in case of the barrel
action state PB_jumpIfHasBarrel(statelabel nukage,statelabel flame, statelabel ice)
{
bool b; int type;
[b,type] = isHoldingBarrel();

if(!b)
return resolvestate(null);

switch(type)
{
case 1: return resolvestate(nukage); break;
case 2: return resolvestate(flame); break;
case 3: return resolvestate(ice); break;
}
return resolvestate(null);
}

//put this in the beggining of the fire state to determine if it can fire or needs reloading
//this replaces the usual:
// TNT1 A 0 A_jumpifinventory(ammo,1,1)
// goto reload
//it also lets you specify the specific reload state to jump
action state PB_jumpIfNoAmmo(statelabel reloadstate = "Reload",int min = 1,bool secondary = true)
{
if(!secondary && invoker.ammotype1 != null)
{
if(countinv(invoker.ammotype1) < min)
return resolvestate(reloadstate);
return resolvestate(null);
}
if(secondary && invoker.ammotype2 != null)
{
if(countinv(invoker.ammotype2) < min)
return resolvestate(reloadstate);
return resolvestate(null);
}
return resolvestate(null);
}
//

action void PB_DynamicTail(string tailInside, string tailOutside)
{
double tailVolume = CVar.GetCVar("pb_tailvolume", player).GetFloat();
Expand Down
Loading

0 comments on commit d3fb6b6

Please sign in to comment.