Page 1 of 1

Strange lockup

Posted: Sun Dec 04, 2005 2:08
by DoomRater
However, lately when kicking using my unarmed weapon GZDoom locks up and is really hard to close. This used to happen when a weapon would go into an infinite loop from jumping but I cannot figure out why it does this in my unarmed weapon, as it happens intermittedly.

Here's the DECORATE code...

Code: Select all

ACTOR Unarmed : Weapon
{
	Inventory.PickupSound "misc/w_pkup"
	Inventory.PickupMessage "If you see this you are dumb -Xaser"
	AttackSound "weapons/thud"
	+MELEEWEAPON
	+NOALERT
	Weapon.Kickback 100
	States
	{
	Select:
		PUN2 A 0 A_TakeInventory("Kick")
		PUN2 A 0 A_Raise
		PUN2 A 0 A_Raise
		PUN2 A 1 A_Raise
		Loop
	Deselect:
		PUN2 A 0 A_Lower
		PUN2 A 0 A_Lower
		PUN2 A 1 A_Lower
		Loop

	Ready:
		PUN2 A -1 A_WeaponReady
	Fire:
		PUN2 A 2
		PUN2 B 0 A_Refire
		PUN2 C 2
		PUN2 D 0 A_FireCustomMissile("KingOfFlames",0,0,0,0)
		PUN2 D 0 A_JumpIfInventory("PowerStrength",1,2)
		PUN2 D 2 A_CustomPunch(10,1,0,1)
		Goto Fire + 7
		PUN2 D 2 A_CustomPunch(200,1,0,1)
		PUN2 C 2 A_GiveInventory("HookCharge",99)
		PUN2 B 4 A_Refire
		PUN2 A 0 A_TakeInventory("HookCharge",99)
		Goto Ready
	Hold:
		PUN2 B 0 A_JumpIfInventory("HookCharge",0,4)
		PUN2 A 1 A_GiveInventory("HookCharge",1)
		PUN2 B 0 A_Refire
		PUN2 B 0 A_JumpIfInventory("HookCharge",0,3)
		Goto Fire + 2
		PUN2 B 1
		PUN2 B 0 A_Refire
		PUN2 EF 2
		PUN2 G 0 A_FireCustomMissile("KingOfFlames",0,0,0,0)
		PUN2 G 0 A_JumpIfInventory("PowerStrength",1,2)
		PUN2 G 1 A_CustomPunch(30,1,0,1)
		Goto Hold + 13
		PUN2 G 1 A_CustomPunch(400,1,0,1)
		PUN2 H 2
		PUN2 I 8
		PUN2 H 2
		PUN2 GF 3
		PUN2 E 3 A_Refire
		PUN2 E 0 A_TakeInventory("HookCharge",99)
		Goto Ready
	AltFire:
		TNT1 A 0 A_GiveInventory("Kick")
		TNT1 A 0 A_SelectWeapon("Kick")
		Goto Ready
	}
}

ACTOR Kick : Unarmed
{
	Weapon.kickback 99999999
	States
	{
	Select:
		TNT1 A 0 A_Raise
		Loop
	Deselect:
		TNT1 A 0 SetPlayerProperty(0,0,0)
		TNT1 A 0 A_Lower
		Loop
	Ready:
		TNT1 A 0
	Fire:
		PUN3 A 0 A_JumpIfInventory("PowerStrength",1,6)
		PUN3 A 5 A_GunFlash
		PUN3 B 0 A_FireCustomMissile("KingOfFlames",0,0,0,0)
		PUN3 B 9 A_CustomPunch(1,0,0,1,70)
		PUN3 A 5 A_SelectWeapon("Unarmed")
		Goto Deselect
	Hold:
		PUN3 A 3
		PUN3 B 0 A_FireCustomMissile("KingOfFlames",0,0,0,0)
		PUN3 B 5 A_CustomPunch(10,0,0,1,70)
		PUN3 A 4 A_SelectWeapon("Unarmed")
		Goto Deselect
	Flash:
		TNT1 A 12 SetPlayerProperty(0,1,0)
		TNT1 A 1 SetPlayerProperty(0,0,0)
		Stop
	}
}

ACTOR KingOfFlames  //yes I am naming my projectiles after ZDoom.org people
{
   Health 1000
   Radius 1
   Height 1
   Speed  0
   Damage 0
   Mass	  1
        
   PROJECTILE
   States
   {
      Spawn:
      Death:
      NULL AA 1 A_AlertMonsters
      Stop
   }
}
ACTOR HookCharge : Inventory
{
	Inventory.Amount 1
	Inventory.MaxAmount 6
}
I do recall trying to kick at a Cacodemon when it happened, however, and also Lord Mattus reported a caco lockup when he fired his BFG25K at it. Perhaps the lockup is somehow related to the caco?

EDIT: When the lockup occured the caco was firing at me as well. My kick had just reached full length.

Posted: Sun Dec 04, 2005 10:22
by Graf Zahl
The weapons have several bugs, including zero length loops and jumps to incorrect labels. You are trying to abuse the weapons system and getting strange results. I am moving this to the general discussion forum because you might get better help there.

Posted: Sun Dec 04, 2005 16:43
by DoomRater
I have corrected one of the incorrect jumps, but by zero length loops, especially in this one, what do you mean? I haven't come across any in this code except in the empty states of the kick. As I said the lockup doesn't occur in the punch code but in the kick code, so the problem really isn't in the punch code itself.

I mentioned that another person had a lockup when firing at a caco as well... I thought that might be of importance. It was that BFG25K

Posted: Sun Dec 04, 2005 18:15
by Graf Zahl
This is zero length loop and can lock up the game:

Code: Select all

  Select:
      TNT1 A 0 A_Raise
      Loop
But this not the big problem. Your weapon violates all rules concerning weapon handling and as such most likely confuses the engine up to a point where it wouldn't run anymore.

In the end I strongly suggest you implement the kick as a true Altfire sequence. That is most likely more stable.

Posted: Sun Dec 04, 2005 18:15
by TheDarkArchon
Should'n the ready line be of 1 length and loop?

Posted: Tue Dec 06, 2005 2:20
by DoomRater
I expect the punch frames to call the kick and once the weapon is selected and switched to, kick, not wait for another button press. I had to do this to use a seperate weapon.kickback.

Think of it like Duke Nukem's Mighty Boot. You press the button, it selects the kick, kicks once, then goes back to the weapon you were using before. (I'm thinking of using wimpyweapon on it to see if it goes back to the weapon that called it without explicitly telling it what weapon to select... that would rock as well)