Problems With GZDoom Not Respecting Tic Delays
Posted: Wed Aug 14, 2019 1:20 am
by 22alpha22
I've recently started simplifying my weapons in my mods by using Anonymous functions rather than a billion or so jumpifs, in the process I've run into a peculiar, game breaking problem. After I simplified my unarmed weapon (code below), switching from the unarmed weapon to any other weapon now causes the other weapons to switch near instantly despite there being delays in how many A_Raise is called per tic. Not only that, after switching to a new weapon from the fist, the new weapon behaves strangely, with random weapon actions performing much quicker than there supposed to and sometimes the weapon locks up completely. If the weapon locks up, it wont respond to any command and becomes impossible to switch away from. Even more strangely, the rest of the game continues to run fine, I can still move and interact with the map. I have to manually remove the weapon via console commands to regain control of my arsenal. This only happens when switching from the fist to another weapon. Switching from any other weapon to another doesn't break anything.
The new unarmed fist:
Another weapon's code for reference:
The new unarmed fist:
Spoiler:The old fist:Code: Select all
///////////////////Fist/////////////////////// Actor AlphaFist : Weapon { //$Category Weapons Game Doom Tag "Fist" Radius 1 Height 2 Gravity 1 Friction 1 Mass 1 BounceType None AttackSound "*Fist" RenderStyle Normal Scale 1 Obituary "$OB_MPFIST" Inventory.Icon "HUD_UNAR" Inventory.PickupMessage "You should not see this message." Inventory.PickupSound "NULL" Weapon.SisterWeapon "AlphaPoweredFist" Weapon.BobRangeX 1.0 Weapon.BobRangeY 1.0 Weapon.BobSpeed 1.0 Weapon.BobStyle Smooth Weapon.KickBack 100 Weapon.SelectionOrder 34 Weapon.SlotNumber 1 Weapon.SlotPriority 0.0 Weapon.UpSound "Weapon/UnarmedSelect" +BLOODLESSIMPACT +DROPPED +ALWAYSPICKUP +UNTOSSABLE +WIMPY_WEAPON +NOEXTREMEDEATH +MELEEWEAPON +NOALERT +NOAUTOAIM States { Select: FIST A 0 { ACS_NamedExecuteAlways("Normal_Speed",0,0,0,0); A_GiveInventory("AlphaPunchToken",10,AAPTR_DEFAULT); A_Overlay(2,"Crosshair",False); } FIST A 1 { A_Raise; A_Raise; A_Raise; } Goto Select+1 Deselect: FIST A 0 { A_TakeInventory("AlphaPunchToken",0,0,AAPTR_DEFAULT) A_PlaySound("Weapon/UnarmedDeslect",CHAN_WEAPON,1.0,False,ATTN_NORM,False) } FIST A 1 { A_Lower A_Lower A_Lower } Goto Deselect+1 Ready: FIST A 0 A_GiveInventory("AlphaPunchToken",1,AAPTR_DEFAULT) FIST A 5 A_WeaponReady Loop Fire: FIST A 1 A_GiveInventory("AlphaPunchToken",3,AAPTR_DEFAULT) FIST B 1 FIST C 2 FIST D 1 FIST E 2 A_CustomPunch(Random(6,9),TRUE,0) FIST D 1 FIST C 2 FIST B 1 FIST A 0 A_ReFire Goto Ready AltFire: FIST A 1 A_JumpIfInventory("AlphaPunchToken",10,1,AAPTR_DEFAULT) Goto Ready FIST A 0 A_TakeInventory("AlphaPunchToken",0,TIF_NOTAKEINFINITE,AAPTR_DEFAULT) FIST F 1 FIST G 2 FIST H 1 FIST I 2 FIST J 1 A_CustomPunch(Random(12,18),TRUE,0) FIST I 2 FIST H 1 FIST G 2 FIST F 1 FIST A 0 A_ReFire Goto Ready Crosshair: TNT1 A 1 A_SetCrosshair(9) Stop } } Actor AlphaPoweredFist : AlphaFist { Weapon.SisterWeapon "AlphaFist" +CHEATNOTWEAPON +POWERED_UP -NOEXTREMEDEATH -WIMPY_WEAPON States { Ready: FIST A 0 A_GiveInventory("AlphaPunchToken",1,AAPTR_DEFAULT) FIST A 5 A_WeaponReady Loop Fire: FIST A 1 A_GiveInventory("AlphaPunchToken",3,AAPTR_DEFAULT) FIST B 1 FIST C 2 FIST D 1 FIST E 2 A_CustomPunch(Random(60,90),TRUE,0) FIST D 1 FIST C 2 FIST B 1 FIST A 0 A_ReFire Goto Ready AltFire: FIST A 1 A_JumpIfInventory("AlphaPunchToken",10,1,AAPTR_DEFAULT) Goto Ready FIST A 0 A_TakeInventory("AlphaPunchToken",0,TIF_NOTAKEINFINITE,AAPTR_DEFAULT) FIST F 1 FIST G 2 FIST H 1 FIST I 2 FIST J 1 A_CustomPunch(Random(120,180),TRUE,0) FIST I 2 FIST H 1 FIST G 2 FIST F 1 FIST A 0 A_ReFire Goto Ready } }
Spoiler:Note when I reverted back to the old fist code, the problems went away.Code: Select all
///////////////////Fist/////////////////////// Actor AlphaFist : Weapon { //$Category Weapons Game Doom Tag "Fist" Radius 1 Height 2 Gravity 1 Friction 1 Mass 1 BounceType None AttackSound "*Fist" RenderStyle Normal Scale 1 Obituary "$OB_MPFIST" Inventory.Icon "HUD_UNAR" Inventory.PickupMessage "You should not see this message." Inventory.PickupSound "NULL" Weapon.SisterWeapon "AlphaPoweredFist" Weapon.BobRangeX 1.0 Weapon.BobRangeY 1.0 Weapon.BobSpeed 1.0 Weapon.BobStyle Smooth Weapon.KickBack 100 Weapon.SelectionOrder 34 Weapon.SlotNumber 1 Weapon.SlotPriority 0.0 Weapon.UpSound "Weapon/UnarmedSelect" +BLOODLESSIMPACT +DROPPED +ALWAYSPICKUP +UNTOSSABLE +WIMPY_WEAPON +NOEXTREMEDEATH +MELEEWEAPON +NOALERT +NOAUTOAIM States { Select: FIST A 0 ACS_NamedExecuteAlways("Normal_Speed",0,0,0,0) FIST # 0 A_GiveInventory("AlphaPunchToken",10,AAPTR_DEFAULT) FIST # 0 A_Overlay(2,"Crosshair",False) FIST # 0 A_Raise FIST # 0 A_Raise FIST A 1 A_Raise Goto Select+3 Deselect: FIST A 0 A_TakeInventory("AlphaPunchToken",0,0,AAPTR_DEFAULT) FIST # 0 A_PlaySound("Weapon/UnarmedDeslect",CHAN_WEAPON,1.0,False,ATTN_NORM,False) FIST # 0 A_Lower FIST # 0 A_Lower FIST A 1 A_Lower Goto Deselect+2 Ready: FIST A 0 A_GiveInventory("AlphaPunchToken",1,AAPTR_DEFAULT) FIST A 5 A_WeaponReady Loop Fire: FIST A 1 A_GiveInventory("AlphaPunchToken",3,AAPTR_DEFAULT) FIST B 1 FIST C 2 FIST D 1 FIST E 2 A_CustomPunch(Random(6,9),TRUE,0) FIST D 1 FIST C 2 FIST B 1 FIST A 0 A_ReFire Goto Ready AltFire: FIST A 1 A_JumpIfInventory("AlphaPunchToken",10,1,AAPTR_DEFAULT) Goto Ready FIST A 0 A_TakeInventory("AlphaPunchToken",0,TIF_NOTAKEINFINITE,AAPTR_DEFAULT) FIST F 1 FIST G 2 FIST H 1 FIST I 2 FIST J 1 A_CustomPunch(Random(12,18),TRUE,0) FIST I 2 FIST H 1 FIST G 2 FIST F 1 FIST A 0 A_ReFire Goto Ready Crosshair: TNT1 A 1 A_SetCrosshair(9) Stop } } Actor AlphaPoweredFist : AlphaFist { Weapon.SisterWeapon "AlphaFist" +CHEATNOTWEAPON +POWERED_UP -NOEXTREMEDEATH -WIMPY_WEAPON States { Ready: FIST A 0 A_GiveInventory("AlphaPunchToken",1,AAPTR_DEFAULT) FIST A 5 A_WeaponReady Loop Fire: FIST A 1 A_GiveInventory("AlphaPunchToken",3,AAPTR_DEFAULT) FIST B 1 FIST C 2 FIST D 1 FIST E 2 A_CustomPunch(Random(60,90),TRUE,0) FIST D 1 FIST C 2 FIST B 1 FIST A 0 A_ReFire Goto Ready AltFire: FIST A 1 A_JumpIfInventory("AlphaPunchToken",10,1,AAPTR_DEFAULT) Goto Ready FIST A 0 A_TakeInventory("AlphaPunchToken",0,TIF_NOTAKEINFINITE,AAPTR_DEFAULT) FIST F 1 FIST G 2 FIST H 1 FIST I 2 FIST J 1 A_CustomPunch(Random(120,180),TRUE,0) FIST I 2 FIST H 1 FIST G 2 FIST F 1 FIST A 0 A_ReFire Goto Ready } }
Another weapon's code for reference:
Spoiler:When switching from the fist to this weapon or any other, the weapon raises instantly and behaves unpredictably. When switching from any other weapon, it raises at the normal speed and behaves as expected.Code: Select all
///////////////////Precision Rifle//////////// Actor AlphaPrecisionRifle : Weapon 20107 { //$Category Weapons Game Doom Tag "Precision Rifle" Radius 20 Height 17 Gravity 1 Friction 1 Mass 15 BounceType None RenderStyle Normal Scale 1 Decal "BulletChip" Obituary "%o took a burst to the head from %k's precision rifle." Inventory.Icon "HUD_PRFL" Inventory.PickupMessage "You got the precision rifle!" Inventory.PickupSound "Weapon/Pickup" Weapon.AmmoGive1 0 Weapon.AmmoGive2 30 Weapon.AmmoType1 "AlphaPrecisionRifleMagazine" Weapon.AmmoType2 "Alpha556MMMagazine" Weapon.AmmoUse1 0 Weapon.AmmoUse2 0 Weapon.MinSelectionAmmo1 6 Weapon.MinSelectionAmmo2 6 Weapon.BobRangeX 1.0 Weapon.BobRangeY 1.0 Weapon.BobSpeed 1.0 Weapon.BobStyle Smooth Weapon.KickBack 30 Weapon.SelectionOrder 25 Weapon.SlotNumber 4 Weapon.SlotPriority 0.2 Weapon.UpSound "PrecisionRifle/Select" +FLOORCLIP +IGNORESKILL +NOALERT +AMMO_OPTIONAL +NOAUTOAIM States { Spawn: PRFL P 1 PRFL P 1 A_CheckFloor(1) Loop PRFL P 1 A_PlaySound("Weapon/Drop",CHAN_WEAPON) PRFL P -1 Stop Select: PRFL A 0 ACS_NamedExecuteAlways("Normal_Speed",0,0,0,0) PRFL # 0 A_Overlay(2,"Crosshair",False) PRFL # 0 A_Overlay(3,"MagazineTracker.Ready",False) PRFL A 1 A_Raise Goto Select+3 Deselect: PRFL A 0 A_JumpIfHealthLower(1,2,AAPTR_DEFAULT) PRFL # 0 A_PlaySound("PrecisionRifle/Deselect",CHAN_WEAPON) PRFL A 1 A_Lower Goto Deselect+2 Ready: PRFL A 1 A_WeaponReady(WRF_ALLOWRELOAD) Loop Fire: PRFL A 0 A_JumpIf(WaterLevel == 3,"Dry") PRFL # 0 A_JumpIfInventory("AlphaPrecisionRifleMagazine",1,1,AAPTR_DEFAULT) Goto Dry PRFL B 0 Bright A_Overlay(3,"MagazineTracker.Missile",False) PRFL # 0 Bright A_PlaySound("PrecisionRifle/Fire",CHAN_WEAPON) PRFL # 0 Bright A_TakeInventory("AlphaPrecisionRifleMagazine",1,TIF_NOTAKEINFINITE,AAPTR_DEFAULT) PRFL B 2 Bright A_FireBullets((SqRt((Abs(VelX) * Abs(VelX)) + (Abs(VelY) * Abs(VelY))) * 0.333) + 0.5,(SqRt((Abs(VelX) * Abs(VelX)) + (Abs(VelY) * Abs(VelY))) * 0.333) + 0.5,-1,Random(14,21),"AlphaBulletPuff",FBF_NORANDOM,5120) PRFL # 0 Bright A_AlertMonsters(3072) PRFL # 0 Bright A_SetPitch(Pitch - FRandom(0.75,1.5),SPF_INTERPOLATE,AAPTR_DEFAULT) PRFL # 0 Bright A_SetAngle(Angle - FRandom(-1.5,1.5),SPF_INTERPOLATE,AAPTR_DEFAULT) PRFL C 2 A_Overlay(3,"MagazineTracker.Ready",False) PRFL D 2 A_FireProjectile("AlphaRifleCasingSpawner",0,False,24,0) PRFL C 2 PRFL A 0 A_Refire("Hold") Goto Ready AltFire: PRFL A 0 A_JumpIf(WaterLevel == 3,"Dry") PRFL # 0 A_JumpIfInventory("AlphaPrecisionRifleMagazine",1,1,AAPTR_DEFAULT) Goto Dry PRFL B 0 Bright A_Overlay(3,"MagazineTracker.Missile",False) PRFL # 0 Bright A_PlaySound("PrecisionRifle/Fire",CHAN_WEAPON) PRFL # 0 Bright A_TakeInventory("AlphaPrecisionRifleMagazine",1,TIF_NOTAKEINFINITE,AAPTR_DEFAULT) PRFL B 2 Bright A_FireBullets((SqRt((Abs(VelX) * Abs(VelX)) + (Abs(VelY) * Abs(VelY))) * 0.333) + 0.75,(SqRt((Abs(VelX) * Abs(VelX)) + (Abs(VelY) * Abs(VelY))) * 0.333) + 0.75,-1,Random(14,21),"AlphaBulletPuff",FBF_NORANDOM,5120) PRFL # 0 Bright A_AlertMonsters(3072) PRFL # 0 Bright A_SetPitch(Pitch - FRandom(1.0,2.0),SPF_INTERPOLATE,AAPTR_DEFAULT) PRFL # 0 Bright A_SetAngle(Angle - FRandom(-2.0,2.0),SPF_INTERPOLATE,AAPTR_DEFAULT) PRFL C 1 A_Overlay(3,"MagazineTracker.Ready",False) PRFL D 1 A_FireProjectile("AlphaRifleCasingSpawner",0,False,24,0) PRFL C 1 PRFL A 0 A_JumpIf(WaterLevel == 3,"Dry") PRFL # 0 A_JumpIfInventory("AlphaPrecisionRifleMagazine",1,1,AAPTR_DEFAULT) Goto Dry PRFL B 0 Bright A_Overlay(3,"MagazineTracker.Missile",False) PRFL # 0 Bright A_PlaySound("PrecisionRifle/Fire",CHAN_WEAPON) PRFL # 0 Bright A_TakeInventory("AlphaPrecisionRifleMagazine",1,TIF_NOTAKEINFINITE,AAPTR_DEFAULT) PRFL B 2 Bright A_FireBullets((SqRt((Abs(VelX) * Abs(VelX)) + (Abs(VelY) * Abs(VelY))) * 0.333) + 1.0,(SqRt((Abs(VelX) * Abs(VelX)) + (Abs(VelY) * Abs(VelY))) * 0.333) + 1.0,-1,Random(14,21),"AlphaBulletPuff",FBF_NORANDOM,5120) PRFL # 0 Bright A_AlertMonsters(3072) PRFL # 0 Bright A_SetPitch(Pitch - FRandom(1.0,2.0),SPF_INTERPOLATE,AAPTR_DEFAULT) PRFL # 0 Bright A_SetAngle(Angle - FRandom(-2.0,2.0),SPF_INTERPOLATE,AAPTR_DEFAULT) PRFL C 1 A_Overlay(3,"MagazineTracker.Ready",False) PRFL D 1 A_FireProjectile("AlphaRifleCasingSpawner",0,False,24,0) PRFL C 1 PRFL A 0 A_JumpIf(WaterLevel == 3,"Dry") PRFL # 0 A_JumpIfInventory("AlphaPrecisionRifleMagazine",1,1,AAPTR_DEFAULT) Goto Dry PRFL B 0 Bright A_Overlay(3,"MagazineTracker.Missile",False) PRFL # 0 Bright A_PlaySound("PrecisionRifle/Fire",CHAN_WEAPON) PRFL # 0 Bright A_TakeInventory("AlphaPrecisionRifleMagazine",1,TIF_NOTAKEINFINITE,AAPTR_DEFAULT) PRFL B 2 Bright A_FireBullets((SqRt((Abs(VelX) * Abs(VelX)) + (Abs(VelY) * Abs(VelY))) * 0.333) + 1.25,(SqRt((Abs(VelX) * Abs(VelX)) + (Abs(VelY) * Abs(VelY))) * 0.333) + 1.25,-1,Random(14,21),"AlphaBulletPuff",FBF_NORANDOM,5120) PRFL # 0 Bright A_AlertMonsters(3072) PRFL # 0 Bright A_SetPitch(Pitch - FRandom(1.0,2.0),SPF_INTERPOLATE,AAPTR_DEFAULT) PRFL # 0 Bright A_SetAngle(Angle - FRandom(-2.0,2.0),SPF_INTERPOLATE,AAPTR_DEFAULT) PRFL C 1 A_Overlay(3,"MagazineTracker.Ready",False) PRFL D 1 A_FireProjectile("AlphaRifleCasingSpawner",0,False,24,0) PRFL C 1 PRFL A 0 A_Refire("Hold") Goto Ready Hold: PRFL A 1 PRFL A 1 A_Refire("Hold") PRFL A 1 A_ClearRefire Goto Ready MagazineTracker.Ready: TNT1 A 0 A_JumpIfInventory("AlphaPrecisionRifleMagazine",16,4,AAPTR_DEFAULT) PRFL A 0 A_JumpIfInventory("AlphaPrecisionRifleMagazine",1,2,AAPTR_DEFAULT) PRFL F 1 Loop PRFL E 1 Loop TNT1 A 1 Loop MagazineTracker.Missile: TNT1 A 0 A_JumpIfInventory("AlphaPrecisionRifleMagazine",16,4,AAPTR_DEFAULT) PRFL A 0 A_JumpIfInventory("AlphaPrecisionRifleMagazine",1,2,AAPTR_DEFAULT) PRFL H 1 Loop PRFL G 1 Loop TNT1 A 1 Loop Reload: PRFL A 1 A_JumpIfInventory("Alpha556MMMagazine",1,1,AAPTR_DEFAULT) Goto Ready PRFL # 0 A_JumpIfInventory("AlphaPrecisionRifleMagazine",30,"Ready",AAPTR_DEFAULT) PRFL # 0 A_JumpIf(WaterLevel == 3,"Ready") PRFL # 0 A_JumpIfInventory("AlphaPrecisionRifleMagazine",1,2,AAPTR_DEFAULT) PRFL # 0 A_GiveInventory("AlphaChargeToken",1,AAPTR_DEFAULT) PRFL AAAAAAAA 1 A_Lower PRFL A 5 PRFL A 1 A_PlaySound("PrecisionRifle/Reload",CHAN_WEAPON) PRFL # 0 A_JumpIfInventory("Alpha556MMMagazine",1,1,AAPTR_DEFAULT) Goto Reload+19 PRFL # 0 A_JumpIfInventory("AlphaPrecisionRifleMagazine",30,3,AAPTR_DEFAULT) PRFL # 0 A_TakeInventory("Alpha556MMMagazine",1,TIF_NOTAKEINFINITE,AAPTR_DEFAULT) PRFL # 0 A_GiveInventory("AlphaPrecisionRifleMagazine",1,AAPTR_DEFAULT) Goto Reload+15 PRFL A 70 PRFL # 0 A_JumpIfInventory("AlphaChargeToken",1,1,AAPTR_DEFAULT) Goto Reload+23 PRFL # 0 A_TakeInventory("AlphaChargeToken",0,0,AAPTR_DEFAULT) PRFL A 35 A_PlaySound("PrecisionRifle/Charge",CHAN_WEAPON) PRFL AAAAAAAA 1 A_Raise Goto Ready Crosshair: TNT1 A 0 A_JumpIf(WaterLevel == 3,2) TNT1 A 1 A_SetCrosshair(((SqRt((Abs(VelX) * Abs(VelX)) + (Abs(VelY) * Abs(VelY))) * 0.333) / 0.2) + 12) Loop TNT1 A 1 A_SetCrosshair(8) Loop Dry: PRFL A 10 A_PlaySound("PrecisionRifle/Dry",CHAN_WEAPON) Goto Reload } }