487 lines
9.6 KiB
Text
487 lines
9.6 KiB
Text
// Key item replacements, including some for popular map packs
|
|
|
|
Class SWWMKey : Key abstract
|
|
{
|
|
Mixin SWWMOverlapPickupSound;
|
|
Mixin SWWMUseToPickup;
|
|
|
|
bool propagated;
|
|
Class<SWWMItemGesture> gesture;
|
|
|
|
Property GestureWeapon : gesture;
|
|
|
|
override void DoEffect()
|
|
{
|
|
Super.DoEffect();
|
|
if ( Icon.IsNull() )
|
|
{
|
|
// fetch icon from parent (if it exists)
|
|
Class<Key> pc = Species;
|
|
if ( !pc ) return;
|
|
let p = GetDefaultByType(pc);
|
|
Icon = p.Icon;
|
|
}
|
|
}
|
|
|
|
override void AttachToOwner( Actor other )
|
|
{
|
|
Super.AttachToOwner(other);
|
|
// also attach the vanilla key that we replace, mainly for script compatibility
|
|
Class<Key> pc = Species;
|
|
if ( pc )
|
|
{
|
|
let p = Inventory(Spawn(pc));
|
|
if ( Owner is 'Demolitionist' )
|
|
Demolitionist(Owner).key_reentrant = true; // avoid infinite loop
|
|
p.AttachToOwner(Owner);
|
|
if ( Owner is 'Demolitionist' )
|
|
Demolitionist(Owner).key_reentrant = false;
|
|
}
|
|
}
|
|
|
|
override bool Use( bool pickup )
|
|
{
|
|
if ( Owner.player && !propagated )
|
|
{
|
|
if ( pickup && CVar.GetCVar('swwm_collectanimkey',Owner.player).GetBool() )
|
|
SWWMGesture.SetSpecialGesture(Owner.player.mo,gesture);
|
|
else if ( !pickup )
|
|
SWWMGesture.SetSpecialGesture(Owner.player.mo,gesture,true);
|
|
}
|
|
// clean up the flag
|
|
propagated = false;
|
|
return false;
|
|
}
|
|
|
|
Default
|
|
{
|
|
+NOTDMATCH;
|
|
+FLOATBOB;
|
|
+INVENTORY.AUTOACTIVATE;
|
|
FloatBobStrength 0.25;
|
|
}
|
|
}
|
|
|
|
Class SWWMRedCard : SWWMKey
|
|
{
|
|
Default
|
|
{
|
|
Tag "$T_REDCARD";
|
|
Species "RedCard";
|
|
Inventory.PickupMessage "$T_REDCARD";
|
|
Inventory.PickupFlash "SWWMRedPickupFlash";
|
|
SWWMKey.GestureWeapon "SWWMRedCardGesture";
|
|
Radius 10;
|
|
Height 25;
|
|
}
|
|
States
|
|
{
|
|
Spawn:
|
|
XZW1 AB 10;
|
|
Loop;
|
|
}
|
|
}
|
|
Class SWWMYellowCard : SWWMKey
|
|
{
|
|
Default
|
|
{
|
|
Tag "$T_YELLOWCARD";
|
|
Species "YellowCard";
|
|
Inventory.PickupMessage "$T_YELLOWCARD";
|
|
Inventory.PickupFlash "SWWMPickupFlash";
|
|
SWWMKey.GestureWeapon "SWWMYellowCardGesture";
|
|
Radius 10;
|
|
Height 25;
|
|
}
|
|
States
|
|
{
|
|
Spawn:
|
|
XZW1 AB 10;
|
|
Loop;
|
|
}
|
|
}
|
|
Class SWWMBlueCard : SWWMKey
|
|
{
|
|
Default
|
|
{
|
|
Tag "$T_BLUECARD";
|
|
Species "BlueCard";
|
|
Inventory.PickupMessage "$T_BLUECARD";
|
|
Inventory.PickupFlash "SWWMBluePickupFlash";
|
|
SWWMKey.GestureWeapon "SWWMBlueCardGesture";
|
|
Radius 10;
|
|
Height 25;
|
|
}
|
|
States
|
|
{
|
|
Spawn:
|
|
XZW1 AB 10;
|
|
Loop;
|
|
}
|
|
}
|
|
Class SWWMSilverCardKDiZD : SWWMKey
|
|
{
|
|
Default
|
|
{
|
|
Tag "$T_SILVERCARD";
|
|
Species "BlueSkull";
|
|
Inventory.PickupMessage "$T_SILVERCARD";
|
|
Inventory.PickupFlash "SWWMWhitePickupFlash";
|
|
SWWMKey.GestureWeapon "SWWMSilverCardGesture";
|
|
Radius 10;
|
|
Height 25;
|
|
}
|
|
States
|
|
{
|
|
Spawn:
|
|
XZW1 AB 10;
|
|
Loop;
|
|
}
|
|
}
|
|
Class SWWMGreenCardKDiZD : SWWMKey
|
|
{
|
|
Default
|
|
{
|
|
Tag "$T_GREENCARD";
|
|
Species "YellowSkull";
|
|
Inventory.PickupMessage "$T_GREENCARD";
|
|
Inventory.PickupFlash "SWWMGreenPickupFlash";
|
|
SWWMKey.GestureWeapon "SWWMGreenCardGesture";
|
|
Radius 10;
|
|
Height 25;
|
|
}
|
|
States
|
|
{
|
|
Spawn:
|
|
XZW1 AB 10;
|
|
Loop;
|
|
}
|
|
}
|
|
Class SWWMOrangeCardKDiZD : SWWMKey
|
|
{
|
|
Default
|
|
{
|
|
Tag "$T_ORANGECARD";
|
|
Species "RedSkull";
|
|
Inventory.PickupMessage "$T_ORANGECARD";
|
|
Inventory.PickupFlash "SWWMPickupFlash";
|
|
SWWMKey.GestureWeapon "SWWMOrangeCardGesture";
|
|
Radius 10;
|
|
Height 25;
|
|
}
|
|
States
|
|
{
|
|
Spawn:
|
|
XZW1 AB 10;
|
|
Loop;
|
|
}
|
|
}
|
|
Class SWWMGreenCard : SWWMKey
|
|
{
|
|
Default
|
|
{
|
|
Tag "$T_GREENCARD";
|
|
Species "GreenCard";
|
|
Inventory.PickupMessage "$T_GREENCARD";
|
|
Inventory.PickupFlash "SWWMGreenPickupFlash";
|
|
SWWMKey.GestureWeapon "SWWMGreenCardGesture";
|
|
Radius 10;
|
|
Height 25;
|
|
}
|
|
States
|
|
{
|
|
Spawn:
|
|
XZW1 AB 10;
|
|
Loop;
|
|
}
|
|
}
|
|
// more Doom key color variants will be implemented as needed
|
|
|
|
Class SWWMRedSkull : SWWMKey
|
|
{
|
|
Default
|
|
{
|
|
Tag "$T_REDSKULL";
|
|
Species "RedSkull";
|
|
Inventory.PickupMessage "$T_REDSKULL";
|
|
Inventory.PickupFlash "SWWMRedPickupFlash";
|
|
SWWMKey.GestureWeapon "SWWMRedSkullGesture";
|
|
Radius 10;
|
|
Height 25;
|
|
}
|
|
States
|
|
{
|
|
Spawn:
|
|
XZW1 A -1;
|
|
Stop;
|
|
}
|
|
}
|
|
Class SWWMBlueSkull : SWWMKey
|
|
{
|
|
Default
|
|
{
|
|
Tag "$T_BLUESKULL";
|
|
Species "BlueSkull";
|
|
Inventory.PickupMessage "$T_BLUESKULL";
|
|
Inventory.PickupFlash "SWWMBluePickupFlash";
|
|
SWWMKey.GestureWeapon "SWWMBlueSkullGesture";
|
|
Radius 10;
|
|
Height 25;
|
|
}
|
|
States
|
|
{
|
|
Spawn:
|
|
XZW1 A -1;
|
|
Stop;
|
|
}
|
|
}
|
|
Class SWWMYellowSkull : SWWMKey
|
|
{
|
|
Default
|
|
{
|
|
Tag "$T_YELLOWSKULL";
|
|
Species "YellowSkull";
|
|
Inventory.PickupMessage "$T_YELLOWSKULL";
|
|
Inventory.PickupFlash "SWWMPickupFlash";
|
|
SWWMKey.GestureWeapon "SWWMYellowSkullGesture";
|
|
Radius 10;
|
|
Height 25;
|
|
}
|
|
States
|
|
{
|
|
Spawn:
|
|
XZW1 A -1;
|
|
Stop;
|
|
}
|
|
}
|
|
|
|
Class SWWMKeyGreen : SWWMKey
|
|
{
|
|
Default
|
|
{
|
|
Tag "$T_KEYGREEN";
|
|
Species "KeyGreen";
|
|
Inventory.PickupMessage "$T_KEYGREEN";
|
|
Inventory.PickupFlash "SWWMGreenPickupFlash";
|
|
SWWMKey.GestureWeapon "SWWMGreenKeyGesture";
|
|
Radius 10;
|
|
Height 25;
|
|
}
|
|
States
|
|
{
|
|
Spawn:
|
|
XZW1 A -1;
|
|
Stop;
|
|
}
|
|
}
|
|
Class SWWMKeyBlue : SWWMKey
|
|
{
|
|
Default
|
|
{
|
|
Tag "$T_KEYBLUE";
|
|
Species "KeyBlue";
|
|
Inventory.PickupMessage "$T_KEYBLUE";
|
|
Inventory.PickupFlash "SWWMBluePickupFlash";
|
|
SWWMKey.GestureWeapon "SWWMBlueKeyGesture";
|
|
Radius 10;
|
|
Height 25;
|
|
}
|
|
States
|
|
{
|
|
Spawn:
|
|
XZW1 A -1;
|
|
Stop;
|
|
}
|
|
}
|
|
Class SWWMKeyYellow : SWWMKey
|
|
{
|
|
Default
|
|
{
|
|
Tag "$T_KEYYELLOW";
|
|
Species "KeyYellow";
|
|
Inventory.PickupMessage "$T_KEYYELLOW";
|
|
Inventory.PickupFlash "SWWMPickupFlash";
|
|
SWWMKey.GestureWeapon "SWWMYellowKeyGesture";
|
|
Radius 10;
|
|
Height 25;
|
|
}
|
|
States
|
|
{
|
|
Spawn:
|
|
XZW1 A -1;
|
|
Stop;
|
|
}
|
|
}
|
|
Class SWWMKeyRed : SWWMKey
|
|
{
|
|
Default
|
|
{
|
|
Tag "$T_KEYRED";
|
|
Species "KeyRed";
|
|
Inventory.PickupMessage "$T_KEYRED";
|
|
Inventory.PickupFlash "SWWMRedPickupFlash";
|
|
SWWMKey.GestureWeapon "SWWMRedKeyGesture";
|
|
Radius 10;
|
|
Height 25;
|
|
}
|
|
States
|
|
{
|
|
Spawn:
|
|
XZW1 A -1;
|
|
Stop;
|
|
}
|
|
}
|
|
|
|
// Key gestures
|
|
// (they all use the same exact animations, just with the object changed)
|
|
// (yeah, I'm lazy, and there's a lot of keys)
|
|
Class SWWMKeyGesture : SWWMItemGesture abstract
|
|
{
|
|
// due to specifics™ we have to handle the punching here
|
|
override void DoEffect()
|
|
{
|
|
Super.DoEffect();
|
|
if ( !Owner || !Owner.player || (Owner.player.Health <= 0) || (Owner.player.ReadyWeapon != self) )
|
|
return;
|
|
PSprite psp = Owner.player.FindPSPrite(PSP_WEAPON+1);
|
|
if ( !(Owner.player.cmd.buttons&(BT_ATTACK|BT_ALTATTACK|BT_USER1)) && !psp )
|
|
{
|
|
// not punching, move weapon back
|
|
psp = Owner.player.FindPSPrite(PSP_WEAPON);
|
|
if ( psp )
|
|
{
|
|
psp.oldx = psp.x;
|
|
psp.x = max(0,psp.x-8);
|
|
psp.oldy = psp.y;
|
|
psp.y = min(32,psp.y+4);
|
|
}
|
|
return;
|
|
}
|
|
if ( psp )
|
|
{
|
|
// already punching, let's shift the weapon away
|
|
psp = Owner.player.FindPSPrite(PSP_WEAPON);
|
|
if ( psp )
|
|
{
|
|
// shift away from center to center
|
|
psp.oldx = psp.x;
|
|
psp.x = min(70,psp.x+8);
|
|
psp.oldy = psp.y;
|
|
psp.y = max(16,psp.y-4);
|
|
}
|
|
return;
|
|
}
|
|
// start punch
|
|
if ( Owner.player.cmd.buttons&(BT_ATTACK|BT_ALTATTACK|BT_USER1) )
|
|
{
|
|
psp = Owner.player.FindPSPrite(PSP_WEAPON);
|
|
if ( psp && (psp.CurState == FindState("WaitingForEnd")) )
|
|
return;
|
|
Owner.player.SetPSprite(PSP_WEAPON+1,FindState("Punch"));
|
|
psp = Owner.player.FindPSPrite(PSP_WEAPON+1);
|
|
if ( psp )
|
|
{
|
|
psp.bAddWeapon = false;
|
|
psp.bAddBob = false;
|
|
psp.x = -50;
|
|
psp.y = 32;
|
|
}
|
|
}
|
|
}
|
|
|
|
States
|
|
{
|
|
Fire:
|
|
XZW1 A 3 A_Jump(128,"AltFire","AltFire2");
|
|
XZW1 B 3 A_StartSound("demolitionist/handsup",CHAN_WEAPON,CHANF_OVERLAP);
|
|
XZW1 CDEF 3;
|
|
XZW1 GHIJKLMNO 4;
|
|
XZW1 P 3 A_StartSound("demolitionist/handsdown",CHAN_WEAPON,CHANF_OVERLAP);
|
|
XZW1 QRST 3;
|
|
Goto WaitingForEnd;
|
|
AltFire:
|
|
XZW1 A 3 A_Jump(128,"Fire","AltFire2");
|
|
XZW1 U 3 A_StartSound("demolitionist/handsup",CHAN_WEAPON,CHANF_OVERLAP);
|
|
XZW1 VWX 3;
|
|
XZW1 YZ 4;
|
|
XZW2 ABC 4;
|
|
XZW2 D 4 A_StartSound("demolitionist/handsdown",CHAN_WEAPON,CHANF_OVERLAP,pitch:.7);
|
|
XZW2 EFGHIJ 4;
|
|
XZW2 KL 3;
|
|
XZW2 M 3 A_StartSound("demolitionist/handsdown",CHAN_WEAPON,CHANF_OVERLAP);
|
|
XZW2 NOPQR 3;
|
|
Goto WaitingForEnd;
|
|
AltFire2:
|
|
XZW1 A 3;
|
|
XZW2 S 3 A_StartSound("demolitionist/handsup",CHAN_WEAPON,CHANF_OVERLAP);
|
|
XZW2 TUVWX 3;
|
|
XZW2 YZ 4;
|
|
XZW3 ABCDE 4;
|
|
XZW3 F 2 A_StartSound("demolitionist/handsdown",CHAN_WEAPON,CHANF_OVERLAP);
|
|
XZW3 GHI 2;
|
|
XZW3 JKL 3;
|
|
XZW3 MN 2;
|
|
XZW3 O 2 A_StartSound("demolitionist/petting",CHAN_WEAPON,CHANF_OVERLAP,.4);
|
|
XZW3 PQ 2;
|
|
XZW3 RS 4;
|
|
XZW3 T 4 A_StartSound("demolitionist/handsdown",CHAN_WEAPON,CHANF_OVERLAP);
|
|
XZW3 UV 4;
|
|
XZW3 WXY 3;
|
|
Goto WaitingForEnd;
|
|
WaitingForEnd:
|
|
XZW1 A 1 A_JumpIf(!player.FindPSprite(PSP_WEAPON+1),1);
|
|
Wait;
|
|
XZW1 A -1 A_FinishGesture();
|
|
Stop;
|
|
// overlay for melee
|
|
Punch:
|
|
XZW0 ABC 1;
|
|
PunchHold:
|
|
XZW0 D 1
|
|
{
|
|
A_PlayerMelee(true);
|
|
A_StartSound("demolitionist/swing",CHAN_WEAPON,CHANF_OVERLAP);
|
|
A_Parry(9);
|
|
}
|
|
XZW0 EF 1;
|
|
XZW0 G 1 A_Melee();
|
|
XZW0 HIJKLMN 2;
|
|
XZW0 A 0
|
|
{
|
|
if ( player.cmd.buttons&(BT_ATTACK|BT_ALTATTACK|BT_USER1) )
|
|
{
|
|
let psp = player.FindPSprite(PSP_WEAPON);
|
|
if ( psp && (psp.CurState != ResolveState("WaitingForEnd")) )
|
|
return ResolveState("PunchHold");
|
|
}
|
|
return ResolveState(null);
|
|
}
|
|
Stop;
|
|
}
|
|
}
|
|
Class SWWMRedCardGesture : SWWMKeyGesture {}
|
|
Class SWWMYellowCardGesture : SWWMKeyGesture {}
|
|
Class SWWMBlueCardGesture : SWWMKeyGesture {}
|
|
Class SWWMSilverCardGesture : SWWMKeyGesture {}
|
|
Class SWWMGreenCardGesture : SWWMKeyGesture {}
|
|
Class SWWMOrangeCardGesture : SWWMKeyGesture {}
|
|
Class SWWMRedSkullGesture : SWWMKeyGesture {}
|
|
Class SWWMYellowSkullGesture : SWWMKeyGesture {}
|
|
Class SWWMBlueSkullGesture : SWWMKeyGesture {}
|
|
Class SWWMGreenKeyGesture : SWWMKeyGesture {}
|
|
Class SWWMBlueKeyGesture : SWWMKeyGesture {}
|
|
Class SWWMYellowKeyGesture : SWWMKeyGesture {}
|
|
Class SWWMRedKeyGesture : SWWMKeyGesture {}
|
|
|
|
// HEXDD thingy
|
|
Class SWWMChaosSphere : Key
|
|
{
|
|
Default
|
|
{
|
|
Tag "$T_CHAOSSPHERE";
|
|
Inventory.InterHubAmount 1; // don't strip, this thing is always kept
|
|
+INVENTORY.UNDROPPABLE;
|
|
+INVENTORY.UNTOSSABLE;
|
|
+INVENTORY.UNCLEARABLE;
|
|
}
|
|
}
|