[Fixed] 3.7.1 and morph actors

Bugs that have been investigated and resolved somehow.

Moderator: GZDoom Developers

Re: 3.7.1 and morph actors

Postby _mental_ » Sat Jan 05, 2019 3:05 am

Is it about this commit? Anyway, this isn't fixed in the current master, 95995e4.
_mental_
 
 
 
Joined: 07 Aug 2011

Re: 3.7.1 and morph actors

Postby _mental_ » Sat Jan 05, 2019 6:03 am

Cooke is right, the problem is in rewritten loops.

To fix this particular issue it's enough to replace Actor invp = self; with Actor invp = item.Owner; here.
Item's owner in needed because we are trying to remove it from normal player pawn, not morphed one, and this breaks inventory linked list.
Without this, for loop does nothing, and the inventory list is cut after the removed item.
_mental_
 
 
 
Joined: 07 Aug 2011

Re: 3.7.1 and morph actors

Postby Graf Zahl » Sat Jan 05, 2019 7:21 am

So in other words, the function gets called from the wrong actor. This means the call needs to get fixed, not the function. All the function needs is to do nothing if the item doesn't belong to the calling actor.

Seriously though, the unmorphing process needs some serious rethinking. It cannot be that it fucks up the self pointer of the calling functions.
Actual unmorphing needs to be handled OUTSIDE PlayerThink or these problems will always come back haunting us - even if it breaks a small number of hacky mods that try to abuse the system.
User avatar
Graf Zahl
Lead GZDoom Developer
 
Joined: 19 Jul 2003
Location: Germany

Re: 3.7.1 and morph actors

Postby _mental_ » Sat Jan 05, 2019 7:52 am

OK but we should fix this bug for upcoming release I think without significant and risky changes.

Here is the problem. toucher is equal to players[consoleplayer].mo for AddInventory() call.
This is not the case for RemoveInventory() because Use() does morphing changing player pawn actor.
For this reason item's owner was important for that RemoveInventory() call.
The value of toucher remains the same while player pawn is a different actor.
_mental_
 
 
 
Joined: 07 Aug 2011

Re: 3.7.1 and morph actors

Postby Enjay » Sat Jan 05, 2019 7:59 am

Graf Zahl wrote:Seriously though, the unmorphing process needs some serious rethinking.

Indeed. Although I'm not au fait with the code itself, the mere fact that it breaks so often (I can't count the number of times an unmorph bug has appeared after an update) indicates that there is something fundamentally unstable about the setup.

_mental_ wrote:OK but we should fix this bug for upcoming release I think without significant and risky changes.

But that also makes a lot of sense.
User avatar
Enjay
Everyone is a moon, and has a dark side which he never shows to anybody. Twain
 
 
 
Joined: 15 Jul 2003
Location: Scotland

Re: 3.7.1 and morph actors

Postby Graf Zahl » Sat Jan 05, 2019 8:53 am

For a point release, the fix should obviously be kept as simple as possible.

But the fix should still not be in RemoveInventory but in the calling code. This actually needs to set toucher to the new owner before calling RemoveInventory so that the code calling CallTryPickup doesn't continue to operate on the invalid player. The weird setup of this function was only done to accomodate morphing, but missed this path because it wasn't an issue when the code was written.
User avatar
Graf Zahl
Lead GZDoom Developer
 
Joined: 19 Jul 2003
Location: Germany

Re: 3.7.1 and morph actors

Postby _mental_ » Sun Jan 13, 2019 4:39 am

To fix the provided sample it's enough to add toucher = self.owner; after Inventory.Use() call.
I guess this should be done conditionally, i.e. it must depend on value of usegood at least. Probably the owner can be null too.
_mental_
 
 
 
Joined: 07 Aug 2011

Re: 3.7.1 and morph actors

Postby Graf Zahl » Mon Jan 14, 2019 2:15 am

Yes, that's what I would have done, too. And surely be cautious about the owner being null.
User avatar
Graf Zahl
Lead GZDoom Developer
 
Joined: 19 Jul 2003
Location: Germany

Re: 3.7.1 and morph actors

Postby _mental_ » Thu Jan 17, 2019 8:08 am

Fixed in fc5420b.
_mental_
 
 
 
Joined: 07 Aug 2011

Re: 3.7.1 and morph actors

Postby Vostyok » Thu Jan 17, 2019 10:18 am

Thank you for your time and attention. Much appreciated.
User avatar
Vostyok
Zone Trippin'
 
Joined: 17 Jan 2015
Location: The Place of Broken Dreams
Discord: Vostyok#3164

Previous

Return to Closed Bugs

Who is online

Users browsing this forum: No registered users and 1 guest