/
machinegun.txt
104 lines (95 loc) · 2.09 KB
/
machinegun.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
/*
* eriguns1: machinegun
* (c) xaser 2017
* sprites (c) Amuscaria
*/
class EriMachinegun : EriWeapon replaces Chaingun
{
const AMMO_OVERLAY_L = 11;
const AMMO_OVERLAY_C = 12;
const AMMO_OVERLAY_R = 13;
int counteryoffset;
Default
{
Weapon.SelectionOrder 700;
Weapon.AmmoUse 1;
Weapon.AmmoGive 20;
Weapon.AmmoType "Clip";
Inventory.PickupMessage "$GOTCHAINGUN";
Obituary "$OB_MPCHAINGUN";
Tag "$TAG_MACHINEGUN";
Decal "BulletChip";
}
States
{
Ready:
DMGG A 1 A_WeaponReady();
Wait;
Deselect:
DMGG A 1 A_Lower();
Wait;
Select:
DMGG A 0 X_InitAmmoCounter();
DMGG A 1 A_Raise();
Wait;
Fire:
DMGF A 2 Bright X_FireMachinegun();
DMGF B 2 Bright X_MachinegunRecoil();
DMGF C 2 Bright X_FireMachinegun();
DMGF D 2 Bright X_MachinegunRecoil();
DMGG B 0 X_MachinegunRefire();
Goto Ready;
Flash:
TNT1 A 2 Bright A_Light(1);
TNT1 A 2 Bright A_Light(2);
Goto LightDone;
AmmoCounterL:
DMGN A 1 Bright X_AmmoCounter(AMMO_OVERLAY_L, 2,-5);
Loop;
AmmoCounterC:
DMGN A 1 Bright X_AmmoCounter(AMMO_OVERLAY_C, 1, 0);
Loop;
AmmoCounterR:
DMGN A 1 Bright X_AmmoCounter(AMMO_OVERLAY_R, 0, 5);
Loop;
Spawn:
DEMG A -1;
Stop;
}
action state X_FireMachinegun()
{
invoker.counteryoffset = 0;
if(invoker.CheckAmmo(Weapon.PrimaryFire, false)) {
A_GunFlash();
A_FireBullets (5.6, 0, 1, 5, "BulletPuff");
A_PlaySound("weapons/machinegun", CHAN_WEAPON);
return null;
} else {
return ResolveState("Ready");
}
}
action void X_MachinegunRecoil()
{
invoker.counteryoffset = 2;
}
action void X_MachinegunRefire()
{
invoker.counteryoffset = 0;
A_Refire();
}
action void X_InitAmmoCounter()
{
A_Overlay(AMMO_OVERLAY_L, "AmmoCounterL");
A_Overlay(AMMO_OVERLAY_C, "AmmoCounterC");
A_Overlay(AMMO_OVERLAY_R, "AmmoCounterR");
}
action void X_AmmoCounter(int layer, int place, float xoffset)
{
A_OverlayOffset(layer, xoffset, invoker.counteryoffset);
// set the digit
int ammoCount = invoker.ammo1 ? invoker.ammo1.amount : 0;
int div = invoker.pow(10, place);
int frame = ammoCount / div % 10;
X_SetOverlayFrame(layer, frame);
}
}