// Variants of certain actors for Macintosh Wolfenstein 3D.

actor MacBJPlayer : BJPlayer
{
	player.displayname "BJ Blazkowicz"
	player.startitem "Clip", 16 // TODO: Double on easy
	player.startitem "MacPistol"
	player.startitem "MacKnife"
	player.weaponslot 1, "MacKnife"
	player.weaponslot 2, "MacPistol"
	player.weaponslot 3, "MacMachineGun"
	player.weaponslot 4, "MacGatlingGun"
	player.weaponslot 5, "MacFlameThrower"
	player.weaponslot 6, "MacRocketLauncher"
}

// Mac Wolfenstein runs weapon attacks at the start of a frame.

actor MacKnife : Knife
{
	states
	{
		Ready:
			KNIF A 1 A_WeaponReady
			loop
		Fire:
			KNIF B 3
			KNIF C 3 A_CustomPunch(random(0,15), true)
			KNIF D 3
			KNIF B 3
			goto Ready
	}
}

actor MacClip : Clip 206
{
	inventory.amount 5
}

actor MacPistol : Pistol
{
	states
	{
		Ready:
			PISG A 1 A_WeaponReady
			loop
		Fire:
			PISG B 3
			PISG C 3 bright A_GunAttack(GAF_MACDAMAGE|GAF_NORANDOM, "*", 1.0, random(0,0xF))
			PISG DB 3
			goto Ready
	}
}

actor MacMachineGun : MachineGun 209
{
	states
	{
		Spawn:
			MGUN A -1
			stop
		Ready:
			MCHG A 1 A_WeaponReady
			loop
		Fire:
			MCHG B 3
		Hold:
			MCHG C 3 bright A_GunAttack(GAF_MACDAMAGE|GAF_NORANDOM, "*", 1.0, random(0,0xF))
			MCHG D 3
			MCHG B 3 A_ReFire
			goto Ready
	}
}

actor MacGatlingGun : GatlingGun 210
{
	weapon.ammogive1 20
	states
	{
		Spawn:
			CGUN A -1
			stop
		Ready:
			CHGG A 1 A_WeaponReady
			loop
		Fire:
			CHGG B 3
		Hold:
			CHGG C 3 bright A_GunAttack(GAF_MACDAMAGE|GAF_NORANDOM, "*", 1.0, random(0,0xF))
			CHGG D 3 bright A_GunAttack(GAF_MACDAMAGE|GAF_NORANDOM, "*", 1.0, random(0,0xF))
			CHGG B 3 A_ReFire
			goto Ready
	}
}

actor MacGasTank : Ammo 207
{
	inventory.amount 14
	inventory.maxamount 99
	ammo.backpackamount 2
	ammo.backpackmaxamount 99
	states
	{
		Spawn:
			TANK A -1
			stop
	}
}

actor MacFlame
{
	radius 4
	speed 12.8
	damage (random(1,16))
	seesound "flame/fire"
	deathsound "flame/hit"
	PROJECTILE
	states
	{
		Spawn:
			FLAM A -1 bright
			stop
		Death:
			FLAM B 4 bright
			stop
	}
}

actor MacFlameThrower : WolfWeapon 211
{
	inventory.pickupsound "weapon/flame/pickup"
	weapon.ammotype1 "MacGasTank"
	weapon.ammogive1 20
	states
	{
		Spawn:
			FTHR A -1
			stop
		Ready:
			FLMG A 1 A_WeaponReady
			loop
		Fire:
			FLMG B 3
		Hold:
			FLMG C 3 bright A_FireCustomMissile("MacFlame")
			FLMG D 3 bright A_FireCustomMissile("MacFlame")
			FLMG B 3 A_ReFire
			goto Ready
	}
}

actor MacMissiles : Ammo 208
{
	inventory.amount 5
	inventory.maxamount 99
	ammo.backpackamount 5
	ammo.backpackmaxamount 99
	states
	{
		Spawn:
			BROK A -1
			stop
	}
}

actor MacMissile
{
	radius 4
	speed 12.8
	damage (random(16,64))
	seesound "missile/fire"
	deathsound "missile/fire"
	PROJECTILE
	states
	{
		Spawn:
			MISL A -1 bright
			stop
		Death:
			BOOM A 8 bright
			stop
	}
}

actor MacRocketLauncher : WolfWeapon 212
{
	inventory.pickupsound "weapon/launcher/pickup"
	weapon.ammotype1 "MacMissiles"
	weapon.ammogive1 5
	states
	{
		Spawn:
			LAUN A -1
			stop
		Ready:
			MISG A 1 A_WeaponReady
			loop
		Fire:
			MISG B 3
		Hold:
			MISG C 3 bright A_FireCustomMissile("MacMissile")
			MISG DB 3
			goto Ready
	}
}

actor MacBandolier : BackpackItem 213
{
	inventory.pickupsound "misc/ammo_pkup"
	states
	{
		Spawn:
			BPAK A -1
			stop
	}
}

// Base item for Mac treasure items and Noah's fruit.
actor MacTreasureItem : ExtraLifeItem
{
	inventory.amount 1
	inventory.maxamount 50
	+COUNTITEM
	+INVENTORY.ALWAYSPICKUP
}

actor MacCross : MacTreasureItem 214
{
	states
	{
		Spawn:
			CROS A -1
			stop
	}
}

actor MacChalice : MacTreasureItem 215
{
	states
	{
		Spawn:
			CHAL A -1
			stop
	}
}

actor MacChestofJewels : MacTreasureItem 216
{
	states
	{
		Spawn:
			JEWL A -1
			stop
	}
}

actor MacCrown : MacTreasureItem 217
{
	states
	{
		Spawn:
			CRWN A -1
			stop
	}
}

actor MacGuard : Guard 218
{
	radius 26
	speed 2.5
	health 6
	points 100
	sighttime 1, 4
	dropitem "MacClip", 256, 5
	seesound "macguard/sight"
	attacksound "macguard/attack"
	deathsound "macguard/death"
	secretdeathsound "macguard/death"
	painsound "macguard/pain"
	states
	{
		Spawn:
			GARD D -1 NOP A_Look(0,0,0,0,360)
			stop
		Path:
		See:
			// TODO: Only determine attack once per state
			GARD ABCD 6 NOP A_Chase
			loop
		Missile:
			GARD EF 8 A_FaceTarget
			GARD G 8 bright A_WolfAttack(0, "*", 1.0, 40)
			goto See
		Pain:
			GARD H 6 A_Pain
			goto See
		Death:
			GARD H 4 A_Fall
			GARD I 4 A_Scream
			GARD J 4 A_PlaySound("misc/thud")
			GARD K -1
			stop
	}
}

actor MacOfficer : Officer 219
{
	radius 26
	speed 5
	health 12
	points 400
	sighttime 1, 63
	dropitem "MacClip", 256, 5
	seesound "macofficer/sight"
	attacksound "macofficer/attack"
	deathsound "macofficer/death"
	secretdeathsound "macofficer/death"
	painsound "macofficer/pain"
	states
	{
		Spawn:
			OFFI D -1 NOP A_Look(0,0,0,0,360)
			stop
		Path:
		See:
			OFFI A 6 NOP A_Chase
			OFFI B 4 NOP A_Chase
			OFFI C 6 NOP A_Chase
			OFFI D 4 NOP A_Chase
			loop
		Missile:
			OFFI EF 4 A_FaceTarget
			// TODO: Revisit damage
			OFFI G 8 bright A_WolfAttack(0, "*", 1.0, 40, 128, 3, 5)
			goto See
		Pain:
			OFFI H 4 A_Pain
			goto See
		Death:
			OFFI H 4 A_Fall
			OFFI I 4 A_Scream
			OFFI J 4 A_PlaySound("misc/thud")
			OFFI K -1
			stop
	}
}

actor MacWolfensteinSS : WolfensteinSS 220
{
	radius 26
	speed 3
	health 25
	points 500
	sighttime 1, 9
	dropitem "MacMachineGun"
	seesound "macss/sight"
	attacksound "macss/attack"
	deathsound "macss/death"
	secretdeathsound "macss/death"
	painsound "macss/pain"
	-DROPBASEDONTARGET
	states
	{
		Spawn:
			SSWV D -1 NOP A_Look(0,0,0,0,360)
			stop
		Path:
		See:
			SSWV ABCD 5 NOP A_Chase
			loop
		Missile:
			SSWV EF 10 A_FaceTarget
			SSWV G 4 bright A_WolfAttack(0, "*", 1.0, 40)
			SSWV F 4 A_FaceTarget
			SSWV G 4 bright A_WolfAttack(0, "*", 1.0, 40)
			SSWV F 4 A_FaceTarget
			SSWV G 4 bright A_WolfAttack(0, "*", 1.0, 40)
			SSWV F 4 A_FaceTarget
			SSWV G 4 bright A_WolfAttack(0, "*", 1.0, 40)
			goto See
		Pain:
			SSWV H 4 A_Pain
			goto See
		Death:
			SSWV H 4 A_Fall
			SSWV I 4 A_Scream
			SSWV J 4 A_PlaySound("misc/thud")
			SSWV K -1
			stop
	}
}

actor MacDog : Dog 221
{
	radius 26
	speed 4.5
	health 1
	points 200
	sighttime 1, 9
	seesound "macdog/sight"
	attacksound "macdog/attack"
	deathsound "macdog/death"
	secretdeathsound "macdog/death"
	states
	{
		Spawn:
			DOGY D -1 NOP A_Look(0,0,0,0,360)
			stop
		Pain:
		Path:
		See:
			DOGY A 4 NOP A_Chase
			DOGY B 4 NOP A_Chase
			DOGY C 4 NOP A_Chase
			DOGY D 4 NOP A_Chase
			loop
		Melee:
			DOGY EF 4 A_FaceTarget
			DOGY G 10 A_MeleeAttack(random(1,15))
			DOGY A 4
			goto See
		Death:
			DOGY H 4 A_Fall
			DOGY I 4 A_Scream
			DOGY J -1 A_PlaySound("misc/thud")
			stop
	}
}

actor MacMutant : Mutant 222
{
	radius 26
	speed 3.5
	health 18
	points 400
	sighttime 1, 63
	dropitem "MacClip", 256, 5
	attacksound "macmutant/attack"
	deathsound "macmutant/death"
	secretdeathsound "macmutant/death"
	painsound "macmutant/pain"
	states
	{
		Spawn:
			MTNT D -1 NOP A_Look(0,0,0,0,360)
			stop
		Path:
		See:
			MTNT ABCD 8 NOP A_Chase
			loop
		Missile:
			MTNT E 4 A_FaceTarget
			MTNT F 10 bright A_WolfAttack(0, "*", 1.0, 40)
			MTNT E 4 A_FaceTarget
			MTNT G 10 bright A_WolfAttack(0, "*", 1.0, 40)
			goto See
		Pain:
			MTNT H 4 A_Pain
			goto See
		Death:
			MTNT H 4 A_Fall
			MTNT I 4 A_Scream
			MTNT J 4 A_PlaySound("misc/thud")
			MTNT K -1
			stop
	}
}

actor MacHans : Hans 223
{
	radius 26
	speed 3.5
	health 250
	points 5000
	sighttime 1, 63
	dropitem "GoldKey"
	attacksound "machans/attack"
	deathsound "machans/death"
	seesound "machans/sight"
	states
	{
		Spawn:
			HANS D -1 NOP A_Look(0, 0, 0, 0, 360)
			stop
		See:
			HANS ABCD 10 NOP A_Chase
			loop
		Missile:
			HANS E 20 A_FaceTarget
			HANS FGFGFG 6 bright A_WolfAttack(0, "*", 1.0, 40, 128, 3, 5)
			goto See
		Death:
			HANS H 0 A_Fall
			HANS H 8 A_Scream
			HANS I 8 A_PlaySound("misc/thud")
			HANS J -1
			stop
	}
}

actor MacNeedle : Needle
{
	radius 8
	speed 12.8
	damage (random[MissileDamage](8, 64))
	seesound "missile/fire"
	deathsound "missile/hit"
	states
	{
		Spawn:
			HYPO A -1
			stop
		Death:
			FLAM B 4 bright
			stop
	}
}

actor MacSchabbs : Schabbs 224
{
	radius 26
	speed 2.5
	health 350
	points 5000
	sighttime 1, 63
	dropitem "GoldKey"
	deathsound "macschabbs/death"
	seesound "macschabbs/sight"
	states
	{
		Spawn:
			SHAB D -1 NOP A_Look(0, 0, 0, 0, 360)
			stop
		See:
			SHAB ABCD 10 NOP A_Chase("*", "*", CHF_BACKOFF)
			loop
		Missile:
			SHAB E 14 A_FaceTarget
			SHAB F 6 A_CustomMissile("MacNeedle")
			goto See
		Death:
			SHAB G 0 A_Fall
			SHAB G 8 A_Scream
			SHAB H 8 A_PlaySound("misc/thud")
			SHAB I -1
			stop
	}
}

actor MacTrans : Trans 225
{
	radius 26
	speed 3.5
	health 300
	points 5000
	sighttime 1, 63
	dropitem "GoldKey"
	attacksound "mactrans/attack"
	deathsound "mactrans/death"
	seesound "mactrans/sight"
	states
	{
		Spawn:
			TRNS D -1 NOP A_Look(0, 0, 0, 0, 360)
			stop
		See:
			TRNS ABCD 10 NOP A_Chase
			loop
		Missile:
			TRNS E 24 A_FaceTarget
			TRNS FGFGFG 6 bright A_WolfAttack(0, "*", 1.0, 40)
			goto See
		Death:
			TRNS H 0 A_Fall
			TRNS H 8 A_Scream
			TRNS I 8 A_PlaySound("misc/thud")
			TRNS J -1
			stop
	}
}

actor MacUberMutant : UberMutant 226
{
	radius 26
	speed 4
	health 400
	points 5000
	sighttime 1, 63
	dropitem "GoldKey"
	attacksound "macuber/attack"
	deathsound "macuber/death"
	seesound "macuber/sight"
	states
	{
		Spawn:
			UBER D -1 NOP A_Look(0, 0, 0, 0, 360)
			stop
		See:
			UBER ABCD 6 NOP A_Chase
			loop
		Missile:
			UBER E 20 A_FaceTarget
			UBER FGFGFG 6 bright A_WolfAttack(0, "*", 1.0, 40)
			goto See
		Death:
			UBER I 0 A_Fall
			UBER I 8 A_Scream
			UBER J 8 A_PlaySound("misc/thud")
			UBER K -1
			stop
	}
}

actor MacRocket : Rocket
{
	radius 8
	speed 12.8
	damage (random[MissileDamage](8, 64))
	seesound "missile/fire"
	deathsound "missile/hit"
	states
	{
		Spawn:
			ROCK A -1 bright
			loop
		Death:
			FLAM B 4 bright
			stop
	}
}

actor MacDeathKnight : DeathKnight 227
{
	radius 26
	speed 3.5
	health 450
	points 5000
	sighttime 1, 63
	dropitem "GoldKey"
	attacksound "macknight/attack"
	deathsound "macknight/death"
	seesound "macknight/sight"
	states
	{
		Spawn:
			DKNT D -1 NOP A_Look(0, 0, 0, 0, 360)
			stop
		See:
			DKNT ABCD 10 NOP A_Chase("*", "*", CHF_BACKOFF)
			loop
		Missile:
			DKNT E 14 A_FaceTarget
			DKNT F 0 bright A_CustomMissile("MacRocket")
			DKNT FH 6 bright A_WolfAttack(0, "*", 1.0, 40)
			DKNT G 0 bright A_CustomMissile("MacRocket")
			DKNT GH 6 bright A_WolfAttack(0, "*", 1.0, 40)
			goto See
		Death:
			DKNT I 0 A_Fall
			DKNT I 8 A_Scream
			DKNT J 8 A_PlaySound("misc/thud")
			DKNT K -1
			stop
	}
}

actor MacMechaHitler : MechaHitler 228
{
	radius 26
	speed 3.5
	health 500
	points 5000
	sighttime 1, 63
	attacksound "machitler/attack"
	deathsound "machitler/mechadeath"
	seesound "machitler/sight"
	states
	{
		Spawn:
			MECH D -1 NOP A_Look(0, 0, 0, 0, 360)
			stop
		See:
			MECH A 10 A_PlaySound("machitler/active") A_Chase
			MECH B 10 NOP A_Chase
			MECH C 10 A_PlaySound("machitler/active") A_Chase
			MECH D 10 NOP A_Chase
			loop
		Missile:
			MECH E 14 A_FaceTarget
			MECH FGFGFG 8 bright A_WolfAttack(0, "*", 1.0, 40)
			goto See
		Death:
			MECH H 6 A_Fall
			MECH I 6
			MECH J 6
			MECH K 0 A_Scream
			MECH K -1 A_SpawnItemEx("MacHitler", 0, 0, 0, 0, 0, 0, 0, SXF_TRANSFERPOINTERS)
			stop
	}
}

actor MacHitler : Hitler
{
	radius 26
	speed 4
	health 500
	points 5000
	sighttime 1, 63
	attacksound "machitler/attack"
	deathsound "machitler/death"
	seesound "machitler/sight"
	states
	{
		Spawn:
			HTLR D 4
		See:
			HTLR A 6 NOP A_Chase
			HTLR B 4 NOP A_Chase
			HTLR C 6 NOP A_Chase
			HTLR D 4 NOP A_Chase
			loop
		Missile:
			HTLR E 14 A_FaceTarget
			HTLR FGFG 4 bright A_WolfAttack(0, "*", 1.0, 40)
			goto See
		Death:
			HTLR H 0 A_Fall
			HTLR H 8 A_Scream
			HTLR I 8
			HTLR J 60 A_PlaySound("misc/thud")
			HTLR J -1 A_BossDeath
			stop
	}
}

actor MacFunky 229
{
	damage (2)
	speed 2.93, 5.859
	states
	{
		Spawn:
			FNKY A -1 NOP A_Chase("*", "*", CHF_DONTDODGE)
			stop
	}
}

actor MacInky 230
{
	damage (2)
	speed 2.93, 5.859
	states
	{
		Spawn:
			INKY A -1 NOP A_Chase("*", "*", CHF_DONTDODGE)
			stop
	}
}

actor MacKinky 231
{
	damage (2)
	speed 2.93, 5.859
	states
	{
		Spawn:
			KNKY A -1 NOP A_Chase("*", "*", CHF_DONTDODGE)
			stop
	}
}

actor MacBlinky 232
{
	damage (2)
	speed 2.93, 5.859
	states
	{
		Spawn:
			BLKY A -1 NOP A_Chase("*", "*", CHF_DONTDODGE)
			stop
	}
}

actor MacDeadGuard : DeadGuard 233
{
	states
	{
		Spawn:
			GARD K -1
			stop
	}
}
