Actor M1GARAND:Weapon
{
Weapon.AmmoUse1 0
Weapon.AmmoGive1 8
Weapon.AmmoUse2 0
Weapon.AmmoGive2 0
Weapon.AmmoType1 "M1CLIP"
Weapon.AmmoType2 "M1LOAD"
Weapon.BobRangeX 0.75
Weapon.BobRangeY 0.5
Weapon.BobSpeed 1.5
Weapon.BobStyle "InverseAlpha" //Denis Belmondo's Bobstyle
AttackSound "None"
Inventory.PickupSound "MP40_TAKE"
Inventory.Pickupmessage "You got the M1 Garand"
+WEAPON.WIMPY_WEAPON
+WEAPON.NOAUTOAIM
+WEAPON.NOALERT
+WEAPON.NOAUTOFIRE
tag "M1 Garand"
Inventory.Icon "M1BACK"
States
{
Ready:
TNT1 A 0 A_PlaySound("Deploy/garand")
M1GS ABCDEFGH 1 
Goto RealReady

RealReady:
M1GG A 1 A_WeaponReady
TNT1 A 0 A_SetCrosshair(0)
TNT1 A 0 A_JumpIfInventory("Kicking",1,"DoKick")
TNT1 A 0 A_JumpIfInventory("Taunting",1,"Taunt")
TNT1 A 0 A_JumpIfInventory("BWgrenade",1,"LaunchGrenade")
tnt1 a 0 a_jumpifinventory("Reloading",1,"Cantreload")
TNT1 A 0 A_JumpIfInventory("Meleeattack",1,"KnifeAttack")
Loop

RealReady2:
M1GA F 1 A_WeaponReady
TNT1 A 0 A_SetCrosshair(0)
TNT1 A 0 A_JumpIfInventory("Kicking",1,"DoKick")
TNT1 A 0 A_JumpIfInventory("Taunting",1,"Taunt")
tnt1 a 0 a_jumpifinventory("Reloading",1,"Reload")
TNT1 A 0 A_JumpIfInventory("BWgrenade",1,"LaunchGrenade")
TNT1 A 0 A_JumpIfInventory("Meleeattack",1,"KnifeAttack")
Loop

Ready2_1:
M2GA A 1 A_WeaponReady
TNT1 A 0 A_SetCrosshair(5)
TNT1 A 0 A_JumpIfInventory("Kicking",1,"DoKick")
TNT1 A 0 A_JumpIfInventory("Taunting",1,"Taunt")
tnt1 a 0 a_jumpifinventory("Reloading",1,"Reload")
TNT1 A 0 A_JumpIfInventory("BWgrenade",1,"LaunchGrenade")
TNT1 A 0 A_JumpIfInventory("Meleeattack",1,"KnifeAttack")
Loop

Ready2:
M2GA A 1 A_WeaponReady
TNT1 A 0 A_SetCrosshair(5)
TNT1 A 0 A_JumpIfInventory("Kicking",1,"DoKick")
TNT1 A 0 A_JumpIfInventory("Taunting",1,"Taunt")
tnt1 a 0 a_jumpifinventory("Reloading",1,"Cantreload")
TNT1 A 0 A_JumpIfInventory("BWgrenade",1,"LaunchGrenade")
TNT1 A 0 A_JumpIfInventory("Meleeattack",1,"KnifeAttack")
Loop

CantReload:
TNT1 A 0
TNT1 A 0 A_Takeinventory("Zoomed",1)
TNT1 A 0 A_Takeinventory("ADSmode",1)
TNT1 A 0 A_ZoomFactor(1.0)
TNT1 A 0 A_Print("Can't reload manualy this weapon.")
TNT1 A 0 A_Takeinventory("Reloading",1)
Goto RealReady

Deselect:
TNT1 A 0 A_Takeinventory("Zoomed",1)
TNT1 A 0 A_Takeinventory("ADSmode",1)
TNT1 A 0 A_Takeinventory("Meleeattack",1)
TNT1 A 0 A_Takeinventory("BWgrenade",1)
TNT1 A 0 A_Takeinventory("Reloading",1)
TNT1 A 0 A_ZoomFactor(1.0)
M1GS HGFEDCBA 1 
TNT1 A 0 A_Lower
Wait

Select:
TNT1 A 0 A_Raise
Wait

AltFire:
TNT1 A 0 A_JumpIfInventory("Zoomed",1,"UnZoom")
TNT1 A 0 A_Giveinventory("Zoomed",1)
TNT1 A 0 A_ZoomFactor(1.8)
TNT1 A 0 A_Giveinventory("ADSmode",1)
M1GX ABCDEF 1 
TNT1 A 0 A_JumpIfInventory("M1LOAD",1,1)
Goto Ready2_1
TNT1 A 0 
Goto Ready2 

UnZoom:
TNT1 A 0 A_Takeinventory("Zoomed",1)
TNT1 A 0 A_ZoomFactor(1.0)
TNT1 A 0 A_Takeinventory("ADSmode",1)
M1GX FEDCBA 1 
TNT1 A 0 A_JumpIfInventory("M1LOAD",1,1)
Goto RealReady2
TNT1 A 0 
Goto RealReady

NoAmmo:
TNT1 A 0 A_Takeinventory("Zoomed",1)
TNT1 A 0 A_ZoomFactor(1.0)
TNT1 A 0 A_Takeinventory("ADSmode",1)
Goto RealReady

FIRE:
TNT1 A 0 A_Takeinventory("Reloading",1)
TNT1 A 0 A_JumpIfInventory("Zoomed",1,"Fire2")
TNT1 A 0 A_JumpIfInventory("M1LOAD",2,1)
Goto LastFire
TNT1 AAAA 0
TNT1 A 0 A_AlertMonsters
TNT1 A 0 A_PlaySound("Weapons/Garand")
TNT1 A 0 A_FireCustomMissile("SmokeSpawner",0,0,0,5)
TNT1 A 0 A_FireCustomMissile("YellowFlareSpawn",0,0,0,0)
TNT1 A 0 A_Takeinventory("M1LOAD",1)
M1GG B 1 Bright 
TNT1 A 0 A_FireBullets(4,5,0,30,"RiflePuff")
TNT1 A 0 A_SetPitch(pitch - 5.0)
TNT1 A 0 A_FireCustomMissile("RifleCaseSpawn",5,0,8,-9)
M1GG C 1 
M1GA DEE 1
M1GA EE 1
M1GA EED 1 
M1GG C 1 
Goto RealReady 

LastFIRE:
TNT1 A 0 A_Takeinventory("Reloading",1)
TNT1 A 0 A_JumpIfInventory("Zoomed",1,"Fire2")
TNT1 A 0 A_JumpIfInventory("M1LOAD",1,1)
Goto Reload
TNT1 AAAA 0
TNT1 A 0 A_AlertMonsters
TNT1 A 0 A_PlaySound("Weapons/Garand/Ping")
TNT1 A 0 A_FireCustomMissile("SmokeSpawner",0,0,0,5)
TNT1 A 0 A_FireCustomMissile("YellowFlareSpawn",0,0,0,0)
TNT1 A 0 A_Takeinventory("M1LOAD",1)
M1GG B 1 Bright 
TNT1 A 0 A_FireBullets(4,5,0,30,"RiflePuff")
TNT1 A 0 A_SetPitch(pitch - 5.0)
TNT1 A 0 A_FireCustomMissile("RifleCaseSpawn",5,0,8,-9)
TNT1 A 0 A_FireCustomMissile("k98stripEmpty",0,0,4,5)
M1GG C 1 
M1GA DEF 1
M1GA FF 1
Goto RealReady2

Fire2:
TNT1 A 0 A_Takeinventory("Reloading",1)
TNT1 A 0 A_JumpIfInventory("M1LOAD",2,1)
Goto LastFire2
TNT1 AAAA 0
TNT1 A 0 A_AlertMonsters
TNT1 A 0 A_PlaySound("Weapons/Garand")
TNT1 A 0 A_FireCustomMissile("SmokeSpawner",0,0,0,5)
TNT1 A 0 A_FireCustomMissile("YellowFlareSpawn",0,0,0,0)
TNT1 A 0 A_Takeinventory("M1LOAD",1)
M2GA B 1 Bright 
TNT1 A 0 A_FireBullets(0,0,0,30,"RiflePuff")
TNT1 A 0 A_SetPitch(pitch - 2.5)
TNT1 A 0 A_FireCustomMissile("RifleCaseSpawn",5,0,8,-9)
M2GA C 1 
M2GA DEF 1
M2GA FF 1
M2GA FDE 1 
M2GA C 1 
Goto Ready2

LastFire2:
TNT1 A 0 A_Takeinventory("Reloading",1)
TNT1 A 0 A_JumpIfInventory("M1LOAD",1,1)
Goto Reload
TNT1 AAAA 0
TNT1 A 0 A_AlertMonsters
TNT1 A 0 A_PlaySound("Weapons/Garand/Ping")
TNT1 A 0 A_FireCustomMissile("SmokeSpawner",0,0,0,5)
TNT1 A 0 A_FireCustomMissile("YellowFlareSpawn",0,0,0,0)
TNT1 A 0 A_Takeinventory("M1LOAD",1)
M2GA B 1 Bright 
TNT1 A 0 A_FireBullets(0,0,0,30,"RiflePuff")
TNT1 A 0 A_SetPitch(pitch - 2.5)
TNT1 A 0 A_FireCustomMissile("RifleCaseSpawn",5,0,8,-9)
TNT1 A 0 A_FireCustomMissile("k98stripEmpty",0,0,4,5)
M2GA C 1 
M2GA DEF 1
M2GA FF 1
M2GA FDE 1 
M2GA C 1 
Goto Ready2_1


Spawn:
gapk A -1
Stop

Reload:
TNT1 A 0 A_ZoomFactor(1.0)
TNT1 A 0 A_Takeinventory("Reloading",1)
TNT1 A 0 A_Takeinventory("ADSmode",1)
TNT1 A 0 A_Takeinventory("Zoomed",1)
TNT1 A 0 A_JumpIfInventory("M1LOAD",8,"InsertBullets")//Even if is impossible automactly reload this weapon.
TNT1 A 0 A_JumpIfInventory("M1CLIP",1,3)
Goto NoAmmo
TNT1 AAA 0
M1GR ABCDEF 1 
M1GR GHIJKL 2 
TNT1 A 0 A_PLAYSOUND("M1LOAD")
M1GR M 2 
M1GR NOP 2
M1GR PON 2 
M1GR RSTU 2 
M2GR ABCDE 1 

InsertBullets:
TNT1 AAAA 0
TNT1 A 0 A_JumpIfInventory("M1LOAD",8,"RealReady")
TNT1 A 0 A_JumpIfInventory("M1CLIP",1,"AmmoIn")
Goto RealReady

AmmoIn:
TNT1 A 0 A_Giveinventory("M1LOAD",1)
TNT1 A 0 A_Takeinventory("M1CLIP",1)
Goto InsertBullets


DoKick:
TNT1 A 0
TNT1 A 0 A_Takeinventory("Zoomed",1)
TNT1 A 0 A_ZoomFactor(1.0)
TNT1 A 0 A_Takeinventory("ADSmode",1)
TNT1 A 0 A_PlaySound("KICK")
TNT1 A 0 SetPlayerProperty(0,1,0)
KICK BCD 1
RIFF A 0 A_FireCustomMissile("KickAttack", 0, 0, 0, -7)
KICK H 4
KICK A 0 A_Takeinventory("Kicking",1)
KICK IGFEDCBA 1
TNT1 A 0 SetPlayerProperty(0,0,0)
Goto RealReady

Taunt:
TNT1 A 0 A_Takeinventory("Zoomed",1)
TNT1 A 0 A_ZoomFactor(1.0)
TNT1 A 5
FUCK A 2
TNT1 A 0 BRIGHT A_FireCustomMissile("Taunter", 0, 0, -1, 0)
TNT1 A 0 BRIGHT A_FireCustomMissile("Taunter", -9, 0, -1, 0)
TNT1 A 0 BRIGHT A_FireCustomMissile("Taunter", 9, 0, -1, 0)
FUCK B 2 A_PlaySound("FUCK", 1)
FUCK C 2 A_AlertMonsters
FUCK D 15 A_Takeinventory("Taunting",1)
FUCK CBA 5
TNT1 A 5
Goto RealReady

LaunchGrenade:	
TNT1 A 0
TNT1 A 0 A_Takeinventory("Zoomed",1)
TNT1 A 0 A_ZoomFactor(1.0)
TNT1 A 0 A_TakeInventory("LaunchGrenade", 1)
TNT1 A 0 A_JumpIfInventory("GrenadeAmmo", 1, 1)
Goto NoGrenade
NGRA ABCD 2
TNT1 A 0 A_playSound("Pick/granate")
NGRA DD 2
TNT1 A 0 A_Jump(90,2)
TNT1 A 0 A_PlaySound("*grenadecall", CHAN_VOICE)
 NGRA DEFG 2
TNT1 A 0 A_PLaySound ("Launch/granate")
TNT1 A 0 A_FireCustomMissile("HandGrenade2", random(-3,3), 1, 0, 0, 0, 0)
GRWF STUVW 2 
TNT1 A 0 A_TakeInventory("GrenadeAmmo", 1)
TNT1 A 1 
TNT1 A 0 A_TakeInventory("LaunchGrenade", 1)
TNT1 A 0 A_Takeinventory("BWgrenade",1)
Goto RealReady

NoGrenade:
TNT1 A 0
TNT1 A 0 A_Takeinventory("Zoomed",1)
TNT1 A 0 A_Takeinventory("ADSmode",1)
TNT1 A 0 A_ZoomFactor(1.0)
TNT1 A 0 A_Print("No Grenades Left!")
TNT1 A 0 A_Takeinventory("BWgrenade",1)
Goto RealReady

KnifeAttack:
TNT1 A 0 A_Takeinventory("Zoomed",1)
TNT1 A 0 A_ZoomFactor(1.0)
TNT1 A 0 A_Jump(90,2)
TNT1 A 0 A_PlaySound("*taunt", CHAN_VOICE)
KNIF ABCDE 1
KNIF F 1 A_PlaySound("weapons/wknife")
KNIF F 0 A_Custompunch(16,0,1,"KnifePuff")
KNIF GHI 1 
TNT1 A 0 A_Takeinventory("Meleeattack",1)
GOTO RealREADY
}
}

ACTOR m1load : Ammo
{
   Inventory.Amount 0
   Inventory.MaxAmount 8
   Ammo.BackpackAmount 0
   Ammo.BackpackMaxAmount 8
}

ACTOR m1clip : Ammo 
{
	Inventory.PickupSound "pickups/ammo"
	Inventory.PickupMessage "M1 Garand's clip"
	Inventory.Amount 8
	Inventory.MaxAmount 200
	Ammo.BackpackAmount 16
	Ammo.BackpackMaxAmount 200
	Mass 10000
        Inventory.Icon "MAUSB0"
	States
	{
	Spawn:
		KARM A -1
		Loop
	}
}





