qzdoom/wadsrc/static/zscript/doom/weaponfist.txt
Christoph Oelckers 3ce699bf9b - implemented pass-by-reference arguments - so far only for memory based variables.
- changed Dehacked weapon function lookup to check the symbol table instead of directly referencing the VM functions. Once scriptified these pointers will no longer be available.
- removed all special ATAGs from the VM. While well intentioned any pointer tagged with them is basically unusable because it'd trigger asserts all over the place.
- scriptified A_Punch for testing pass-by-reference parameters and stack variables.
2016-11-19 01:23:56 +01:00

80 lines
No EOL
1.5 KiB
Text

// --------------------------------------------------------------------------
//
// Fist
//
// --------------------------------------------------------------------------
class Fist : Weapon
{
Default
{
Weapon.SelectionOrder 3700;
Weapon.Kickback 100;
Obituary "$OB_MPFIST";
Tag "$TAG_FIST";
+WEAPON.WIMPY_WEAPON
+WEAPON.MELEEWEAPON
}
States
{
Ready:
PUNG A 1 A_WeaponReady;
Loop;
Deselect:
PUNG A 1 A_Lower;
Loop;
Select:
PUNG A 1 A_Raise;
Loop;
Fire:
PUNG B 4;
PUNG C 4 A_Punch;
PUNG D 5;
PUNG C 4;
PUNG B 5 A_ReFire;
Goto Ready;
}
}
//===========================================================================
//
// Code (must be attached to Actor)
//
//===========================================================================
extend class Actor
{
action void A_Punch()
{
FTranslatedLineTarget t;
if (player != null)
{
Weapon weap = player.ReadyWeapon;
if (weap != null && !weap.bDehAmmo && invoker == weap && stateinfo != null && stateinfo.mStateType == STATE_Psprite)
{
if (!weap.DepleteAmmo (weap.bAltFire))
return;
}
}
int damage = random[Punch](1, 10) << 1;
if (FindInventory("PowerStrength"))
damage *= 10;
double ang = angle + Random2[Punch]() * (5.625 / 256);
double pitch = AimLineAttack (ang, MELEERANGE);
LineAttack (ang, MELEERANGE, pitch, damage, 'Melee', "BulletPuff", LAF_ISMELEEATTACK, t);
// turn to face target
if (t.linetarget)
{
A_PlaySound ("*fist", CHAN_WEAPON);
angle = t.angleFromSource;
}
}
}