[r1346] Weird Decorate inheritance again

Bugs that have been investigated and resolved somehow.

Moderator: GZDoom Developers

Forum rules
Please don't bump threads here if you have a problem - it will often be forgotten about if you do. Instead, make a new thread here.
Post Reply
User avatar
Kilkakon
Posts: 314
Joined: Fri Jul 09, 2004 11:53 pm
Location: Western Australia
Contact:

[r1346] Weird Decorate inheritance again

Post by Kilkakon »

Hey developers,

Thanks for the recent fix by the way Graf. I like how I managed to monopolise an entire SVN release! Let's hope that it doesn't happen again! :)

I have recently encountered another issue. I'm not sure what's causing it, but I did try to rearrange things first, and it didn't help. The ingame result of the code below is that the A2C2KayLotusAllyPlasma still fires the A2C2BulletAllyProj instead of the A2C2PlasmaAllyBall. This does not occur if I copy the entire States { } from the SMG one to the Plasma one and change the projectiles there. Is it something that I have missed or is there a problem? Do you want more code?

Code: Select all

ACTOR A2C2KayLotusAllySMG REPLACES Megasphere
{
	//snip
	States
	{
	//snip
	Melee:
	Missile:
		// firing (from Move)
		ILLP A 0
		ILLP E 0 A_SpawnItemEx("A2C2MapPingAlly", 0, 0, 0, momx, momy, momz, 0, 40)
		ILLP E 2 A_FaceTarget
		ILLP F 0 A_AlertMonsters
		ILLP F 0 A_PlaySound("weapons/smg")
		ILLP F 2 BRIGHT A_CustomMissile("A2C2BulletAllyProj",30,0,random(-3,3))
		ILLP E 0 A_SpawnItemEx("A2C2MapPingAlly", 0, 0, 0, momx, momy, momz, 0, 40)
		ILLP E 2 A_FaceTarget
		ILLP F 0 A_AlertMonsters
		ILLP F 0 A_PlaySound("weapons/smg")
		//ILLP F 0 A_TakeInventory("A2C2CharmanderAmmo",1)
		ILLP F 2 BRIGHT A_CustomMissile("A2C2BulletAllyProj",30,0,random(-4,4))
		ILLP E 0 A_SpawnItemEx("A2C2MapPingAlly", 0, 0, 0, momx, momy, momz, 0, 40)
		ILLP E 2 A_FaceTarget
		ILLP F 0 A_AlertMonsters
		ILLP F 0 A_PlaySound("weapons/smg")
		//ILLP F 0 A_TakeInventory("A2C2CharmanderAmmo",1)
		ILLP F 2 BRIGHT A_CustomMissile("A2C2BulletAllyProj",30,0,random(-4,4))
		// end firing
		ILLP E 0 A_CPosRefire
		Loop
	FollowMissile:
		// firing (from FollowAttack)
		ILLP A 0
		ILLP E 0 A_SpawnItemEx("A2C2MapPingAlly", 0, 0, 0, momx, momy, momz, 0, 40)
		ILLP E 2 A_FaceTarget
		ILLP F 0 A_AlertMonsters
		ILLP F 0 A_PlaySound("weapons/smg")
		ILLP F 2 BRIGHT A_CustomMissile("A2C2BulletAllyProj",30,0,random(-4,4))
		ILLP E 0 A_SpawnItemEx("A2C2MapPingAlly", 0, 0, 0, momx, momy, momz, 0, 40)
		ILLP E 2 A_FaceTarget
		ILLP F 0 A_AlertMonsters
		ILLP F 0 A_PlaySound("weapons/smg")
		ILLP F 2 BRIGHT A_CustomMissile("A2C2BulletAllyProj",30,0,random(-4,4))
		ILLP E 0 A_SpawnItemEx("A2C2MapPingAlly", 0, 0, 0, momx, momy, momz, 0, 40)
		ILLP E 2 A_FaceTarget
		ILLP F 0 A_AlertMonsters
		ILLP F 0 A_PlaySound("weapons/smg")
		ILLP F 2 BRIGHT A_CustomMissile("A2C2BulletAllyProj",30,0,random(-4,4))
		// end firing
		ILLP E 0 A_CPosRefire
		Loop
		//snip
	}
}

ACTOR A2C2BulletAllyProj : A2C2BulletProj
{
	+THRUGHOST
}

ACTOR A2C2PlasmaAllyBall : A2C2PlasmaBall
{
	+THRUGHOST
}

ACTOR A2C2KayLotusAllyPlasma : A2C2KayLotusAllySMG REPLACES SoulSphere
{
	States
	{
	Melee:
	Missile:
		// firing (from Move)
		ILLP A 0
		ILLP E 0 A_SpawnItemEx("A2C2MapPingAlly", 0, 0, 0, momx, momy, momz, 0, 40)
		ILLP E 2 A_FaceTarget
		ILLP F 0 A_AlertMonsters
		ILLP F 2 BRIGHT A_CustomMissile("A2C2PlasmaAllyBall",30,0,0)
		ILLP E 0 A_SpawnItemEx("A2C2MapPingAlly", 0, 0, 0, momx, momy, momz, 0, 40)
		ILLP E 2 A_FaceTarget
		ILLP F 0 A_AlertMonsters
		ILLP F 2 BRIGHT A_CustomMissile("A2C2PlasmaAllyBall",30,0,0)
		ILLP E 0 A_SpawnItemEx("A2C2MapPingAlly", 0, 0, 0, momx, momy, momz, 0, 40)
		ILLP E 2 A_FaceTarget
		ILLP F 0 A_AlertMonsters
		ILLP F 2 BRIGHT A_CustomMissile("A2C2PlasmaAllyBall",30,0,0)
		// end firing
		ILLP E 0 A_CPosRefire
		Loop
	FollowMissile:
		// firing (from FollowAttack)
		ILLP A 0
		ILLP E 0 A_SpawnItemEx("A2C2MapPingAlly", 0, 0, 0, momx, momy, momz, 0, 40)
		ILLP E 2 A_FaceTarget
		ILLP F 0 A_AlertMonsters
		ILLP F 2 BRIGHT A_CustomMissile("A2C2PlasmaAllyBall",30,0,0)
		ILLP E 0 A_SpawnItemEx("A2C2MapPingAlly", 0, 0, 0, momx, momy, momz, 0, 40)
		ILLP E 2 A_FaceTarget
		ILLP F 0 A_AlertMonsters
		ILLP F 2 BRIGHT A_CustomMissile("A2C2PlasmaAllyBall",30,0,0)
		ILLP E 0 A_SpawnItemEx("A2C2MapPingAlly", 0, 0, 0, momx, momy, momz, 0, 40)
		ILLP E 2 A_FaceTarget
		ILLP F 0 A_AlertMonsters
		ILLP F 2 BRIGHT A_CustomMissile("A2C2PlasmaAllyBall",30,0,0)
		// end firing
		ILLP E 0 A_CPosRefire
		Loop
	}
}
Thanks again guys! Sorry if it's just a mistake. ():)
User avatar
Graf Zahl
Lead GZDoom+Raze Developer
Lead GZDoom+Raze Developer
Posts: 49230
Joined: Sat Jul 19, 2003 10:19 am
Location: Germany

Re: [r1346] Weird Decorate inheritance again

Post by Graf Zahl »

Hard to tell because were so smart to (snip) relevant parts of code.;)
User avatar
Kilkakon
Posts: 314
Joined: Fri Jul 09, 2004 11:53 pm
Location: Western Australia
Contact:

Re: [r1346] Weird Decorate inheritance again

Post by Kilkakon »

Sorry! Here you go! :)

Code: Select all

ACTOR A2C2KayLotusAllySMG REPLACES Megasphere
{
	Speed 28
	Health 100
	Radius 16
	Height 56
	Mass 100
	PainChance 100
	PainSound "ally/kay/pain"
	Monster
	-COUNTKILL
	//+FRIENDLY
	+USESPECIAL
	+LOOKALLAROUND
	+QUICKTORETALIATE
	+NOTIMEFREEZE
	+DONTHURTSPECIES
	+NODAMAGE
	+NOBLOCKMONST
	DamageFactor "Foam",0
	DamageFactor "Grenade",0.5
	DamageFactor "Morph",0
	States
	{
	Spawn:
		ILLP A 0
		ILLP A 0 Thing_SetSpecial(0,80,300,0,0)
		ILLP A 0 A_SpawnItemEx("A2C2MapPingAlly", 0, 0, 0, momx, momy, momz, 0, 40)
		ILLP A 5 A_LookEx( 0, 0, 0, 0, 0, "Move" )
		ILLP A 0
		Loop
	See:
		ILLP A 0
		ILLP A 0 A_ClearTarget
		ILLP A 0 A_ChangeFlag( "FRIENDLY",0 )
		// fall through
	Move:
		ILLP A 0
		ILLP A 0 A_JumpIf( ACS_ExecuteWithResult(301,0,0,0) == 1,"FollowLook")
		ILLP A 0 A_ChangeFlag( "FRIENDLY",1)
		ILLP A 0 A_ClearTarget
		ILLP AAA 1 A_LookEx(0,0,0,0,0,"MoveSee")
		ILLP A 0 A_ChangeFlag( "FRIENDLY",0)
		Goto Move
	MoveSee:
		ILLP AAAA 1 A_Chase("Melee","Missile",18)
		Goto Move
	FollowLook:
		ILLP A 0
		ILLP AAAAAA 0 A_LookEx(0,0,0,0,0,"Follow")
		ILLP A 1 A_GiveInventory("A2C2StandGroundCount",1)
		ILLP AAAAAA 0 A_LookEx(0,0,0,0,0,"Follow")
		ILLP A 1 A_GiveInventory("A2C2StandGroundCount",1)
		ILLP AAAAAA 0 A_LookEx(0,0,0,0,0,"Follow")
		ILLP A 1 A_GiveInventory("A2C2StandGroundCount",1)
		ILLP AAAAAA 0 A_LookEx(0,0,0,0,0,"Follow")
		ILLP A 1 A_GiveInventory("A2C2StandGroundCount",1)
		ILLP AAAAAA 0 A_LookEx(0,0,0,0,0,"Follow")
		ILLP A 1 A_GiveInventory("A2C2StandGroundCount",1)
		ILLP A 0 A_SpawnItemEx("A2C2MapPingAlly", 0, 0, 0, momx, momy, momz, 0, 40)
		ILLP A 0 A_JumpIfInventory("A2C2StandGroundCount",300,"StandGround")
		ILLP A 0 A_JumpIf( ACS_ExecuteWithResult(301,0,0,0) == 1,"FollowLook")
		Goto Move
	Follow:
		ILLP A 0
		ILLP A 0 A_SpawnItemEx("A2C2MapPingAlly", 0, 0, 0, momx, momy, momz, 0, 40)
		ILLP A 3 A_Chase("","",2)
		ILLP A 0 A_JumpIf( ACS_ExecuteWithResult(301,0,0,0) == 0,"See")
		ILLP B 0 A_SpawnItemEx("A2C2MapPingAlly", 0, 0, 0, momx, momy, momz, 0, 40)
		ILLP B 0 A_SpawnItemEx("A2C2FootStep", 0, 0, 5, 0, 0, -1, 0, SXF_NOCHECKPOSITION)
		ILLP BB 3 A_Chase("","",2)
		ILLP A 0 A_JumpIf( ACS_ExecuteWithResult(301,0,0,0) == 0,"See")
		ILLP C 0 A_SpawnItemEx("A2C2MapPingAlly", 0, 0, 0, momx, momy, momz, 0, 40)
		ILLP CC 3 A_Chase("","",2)
		ILLP A 0 A_JumpIf( ACS_ExecuteWithResult(301,0,0,0) == 0,"See")
		ILLP D 0 A_SpawnItemEx("A2C2MapPingAlly", 0, 0, 0, momx, momy, momz, 0, 40)
		ILLP D 0 A_SpawnItemEx("A2C2FootStep", 0, 0, 5, 0, 0, -1, 0, SXF_NOCHECKPOSITION)
		ILLP DD 3 A_Chase("","",2)
		ILLP A 0 A_JumpIf( ACS_ExecuteWithResult(301,0,0,0) == 0,"See")
		ILLP A 0 A_CheckSight( "Follow" )
		ILLP A 0 A_ChangeFlag( "FRIENDLY",1)
		ILLP A 3 A_SpawnItem( "A2C2AllyThreatScan" )
		ILLP A 0 A_JumpIf( ACS_ExecuteWithResult(304,0,0,0) == 1,"FollowAttack")
		Loop
	FollowAttack:
		ILLP A 0 A_ChangeFlag( "FRIENDLY",1)
		ILLP A 0 A_SpawnItem( "A2C2AllyThreatScan" )
		ILLP A 0 A_ClearTarget
		ILLP AAA 1 A_LookEx(0,0,0,0,0,"FollowAttackSee")
		ILLP A 0 A_ChangeFlag( "FRIENDLY",0)
		ILLP A 0 A_ClearTarget
		ILLP A 0 A_JumpIf( ACS_ExecuteWithResult(304,0,0,0) == 1,"FollowAttack")
		Goto Move
	FollowAttackSee:
		ILLP AAAA 1 A_Chase("Melee","FollowMissile",18)
		Goto FollowAttack
	StandGround:
		ILLP A 0
		ILLP A 0 A_TakeInventory("A2C2StandGroundCount",300)
		ILLP A 1 ACS_Execute(302,0,0,0,0)
		Goto Move
	Melee:
	Missile:
		// firing (from Move)
		ILLP A 0
		ILLP E 0 A_SpawnItemEx("A2C2MapPingAlly", 0, 0, 0, momx, momy, momz, 0, 40)
		ILLP E 2 A_FaceTarget
		ILLP F 0 A_AlertMonsters
		ILLP F 0 A_PlaySound("weapons/smg")
		ILLP F 2 BRIGHT A_CustomMissile("A2C2BulletAllyProj",30,0,random(-3,3))
		ILLP E 0 A_SpawnItemEx("A2C2MapPingAlly", 0, 0, 0, momx, momy, momz, 0, 40)
		ILLP E 2 A_FaceTarget
		ILLP F 0 A_AlertMonsters
		ILLP F 0 A_PlaySound("weapons/smg")
		//ILLP F 0 A_TakeInventory("A2C2CharmanderAmmo",1)
		ILLP F 2 BRIGHT A_CustomMissile("A2C2BulletAllyProj",30,0,random(-4,4))
		ILLP E 0 A_SpawnItemEx("A2C2MapPingAlly", 0, 0, 0, momx, momy, momz, 0, 40)
		ILLP E 2 A_FaceTarget
		ILLP F 0 A_AlertMonsters
		ILLP F 0 A_PlaySound("weapons/smg")
		//ILLP F 0 A_TakeInventory("A2C2CharmanderAmmo",1)
		ILLP F 2 BRIGHT A_CustomMissile("A2C2BulletAllyProj",30,0,random(-4,4))
		// end firing
		ILLP E 0 A_CPosRefire
		Loop
	FollowMissile:
		// firing (from FollowAttack)
		ILLP A 0
		ILLP E 0 A_SpawnItemEx("A2C2MapPingAlly", 0, 0, 0, momx, momy, momz, 0, 40)
		ILLP E 2 A_FaceTarget
		ILLP F 0 A_AlertMonsters
		ILLP F 0 A_PlaySound("weapons/smg")
		ILLP F 2 BRIGHT A_CustomMissile("A2C2BulletAllyProj",30,0,random(-4,4))
		ILLP E 0 A_SpawnItemEx("A2C2MapPingAlly", 0, 0, 0, momx, momy, momz, 0, 40)
		ILLP E 2 A_FaceTarget
		ILLP F 0 A_AlertMonsters
		ILLP F 0 A_PlaySound("weapons/smg")
		ILLP F 2 BRIGHT A_CustomMissile("A2C2BulletAllyProj",30,0,random(-4,4))
		ILLP E 0 A_SpawnItemEx("A2C2MapPingAlly", 0, 0, 0, momx, momy, momz, 0, 40)
		ILLP E 2 A_FaceTarget
		ILLP F 0 A_AlertMonsters
		ILLP F 0 A_PlaySound("weapons/smg")
		ILLP F 2 BRIGHT A_CustomMissile("A2C2BulletAllyProj",30,0,random(-4,4))
		// end firing
		ILLP E 0 A_CPosRefire
		Loop
		
	Pain:
		ILLP G 0
		ILLP G 4 A_SpawnItemEx("A2C2MapPingAlly", 0, 0, 0, momx, momy, momz, 0, 40)
		ILLP G 4 A_Pain
		Goto See
	}
}

ACTOR A2C2AllyThreatScan
{
	Radius 16
	Height 56
	+ISMONSTER
	+FRIENDLY
	+LOOKALLAROUND
	+NOTIMEFREEZE
	+NOBLOCKMONST
	+STANDSTILL
	States
	{
	Spawn:
		TNT1 A 0
		TNT1 A 1 A_LookEx(2,0,0,0,0,"See")
		TNT1 A 0 ACS_Execute(303,0,0,0,0)
		Stop
	See:
		TNT1 A 0
		TNT1 A 1 ACS_Execute(303,0,1,0,0)
		Stop
	}
}

ACTOR A2C2BulletAllyProj : A2C2BulletProj
{
	+THRUGHOST
}

ACTOR A2C2PlasmaAllyBall : A2C2PlasmaBall
{
	+THRUGHOST
}

ACTOR A2C2KayLotusAllyPlasma : A2C2KayLotusAllySMG REPLACES SoulSphere
{
	States
	{
	Melee:
	Missile:
		// firing (from Move)
		ILLP A 0
		ILLP E 0 A_SpawnItemEx("A2C2MapPingAlly", 0, 0, 0, momx, momy, momz, 0, 40)
		ILLP E 2 A_FaceTarget
		ILLP F 0 A_AlertMonsters
		ILLP F 2 BRIGHT A_CustomMissile("A2C2PlasmaAllyBall",30,0,0)
		ILLP E 0 A_SpawnItemEx("A2C2MapPingAlly", 0, 0, 0, momx, momy, momz, 0, 40)
		ILLP E 2 A_FaceTarget
		ILLP F 0 A_AlertMonsters
		ILLP F 2 BRIGHT A_CustomMissile("A2C2PlasmaAllyBall",30,0,0)
		ILLP E 0 A_SpawnItemEx("A2C2MapPingAlly", 0, 0, 0, momx, momy, momz, 0, 40)
		ILLP E 2 A_FaceTarget
		ILLP F 0 A_AlertMonsters
		ILLP F 2 BRIGHT A_CustomMissile("A2C2PlasmaAllyBall",30,0,0)
		// end firing
		ILLP E 0 A_CPosRefire
		Loop
	FollowMissile:
		// firing (from FollowAttack)
		ILLP A 0
		ILLP E 0 A_SpawnItemEx("A2C2MapPingAlly", 0, 0, 0, momx, momy, momz, 0, 40)
		ILLP E 2 A_FaceTarget
		ILLP F 0 A_AlertMonsters
		ILLP F 2 BRIGHT A_CustomMissile("A2C2PlasmaAllyBall",30,0,0)
		ILLP E 0 A_SpawnItemEx("A2C2MapPingAlly", 0, 0, 0, momx, momy, momz, 0, 40)
		ILLP E 2 A_FaceTarget
		ILLP F 0 A_AlertMonsters
		ILLP F 2 BRIGHT A_CustomMissile("A2C2PlasmaAllyBall",30,0,0)
		ILLP E 0 A_SpawnItemEx("A2C2MapPingAlly", 0, 0, 0, momx, momy, momz, 0, 40)
		ILLP E 2 A_FaceTarget
		ILLP F 0 A_AlertMonsters
		ILLP F 2 BRIGHT A_CustomMissile("A2C2PlasmaAllyBall",30,0,0)
		// end firing
		ILLP E 0 A_CPosRefire
		Loop
	}
}

ACTOR A2C2StandGroundCount : Ammo
{
	Inventory.MaxAmount 300
	Ammo.BackpackAmount 0
	Ammo.BackpackMaxAmount 300
}
User avatar
Graf Zahl
Lead GZDoom+Raze Developer
Lead GZDoom+Raze Developer
Posts: 49230
Joined: Sat Jul 19, 2003 10:19 am
Location: Germany

Re: [r1346] Weird Decorate inheritance again

Post by Graf Zahl »

Ok, now I see where's the problem. Seems I need to make some changes to state name evaluation at compile time.
User avatar
Kilkakon
Posts: 314
Joined: Fri Jul 09, 2004 11:53 pm
Location: Western Australia
Contact:

Re: [r1346] Weird Decorate inheritance again

Post by Kilkakon »

Yay it wasn't me. ():) Not the only bug I've hit today sadly, but I can't reproduce the other one so I just found a workaround instead. :)

Trust such a hacky actor for this to appear. May I ask if there's a heavy-duty syntax program somewhere or a standards sheet or something? I'm happy to rearrange my actors etc. if it makes the mod less likely to become obsolete. :)

Rejoice for bugs killed in advance! :cheers:

EDIT: I spelt syntax wrong. Not a good look.
User avatar
Graf Zahl
Lead GZDoom+Raze Developer
Lead GZDoom+Raze Developer
Posts: 49230
Joined: Sat Jul 19, 2003 10:19 am
Location: Germany

Re: [r1346] Weird Decorate inheritance again

Post by Graf Zahl »

fixed.

This will be fun once Doomscript becomes reality... :?
User avatar
randi
Site Admin
Posts: 7749
Joined: Wed Jul 09, 2003 10:30 pm
Contact:

Re: [r1346] Weird Decorate inheritance again

Post by randi »

So, what exactly was the problem?
User avatar
Kilkakon
Posts: 314
Joined: Fri Jul 09, 2004 11:53 pm
Location: Western Australia
Contact:

Re: [r1346] Weird Decorate inheritance again

Post by Kilkakon »

The KayLotusPlasma actor ignored me overwriting the Missile and FollowMissile states, and still fired the machine gun. Graf's fix worked, whatever he did. :)

EDIT: [from changelog:] State labels must be evaluated for the state's owner, not the calling actor.

May I ask again if there's a "standards sheet" that you guys have done? I do know I need to " " all my strings, which I have done, but I don't want to find more problems that fixes in the league r1334 have done. I don't want to write a game that forces you guys to have bad coding. ():)
User avatar
Graf Zahl
Lead GZDoom+Raze Developer
Lead GZDoom+Raze Developer
Posts: 49230
Joined: Sat Jul 19, 2003 10:19 am
Location: Germany

Re: [r1346] Weird Decorate inheritance again

Post by Graf Zahl »

randy wrote:So, what exactly was the problem?

When I rewrote the expression evaluator 2 months ago it didn't properly evaluate state labels for A_Jumps in weapons because the code had no access to the state's owner. So to fix this back then I did state label evaluation at compile time without realizing that there are situations where this won't work. So I changed it so that all code pointers get passed the state's owner as well in addition to the calling actor.


@LeaderOne: This was a deviation from existing behavior so it had to be fixed.
Post Reply

Return to “Closed Bugs [GZDoom]”