MantisBT - Zandronum
View Issue Details
0002776Zandronum[All Projects] Bugpublic2016-07-11 16:002018-09-30 22:32
Dusk 
Dusk 
normalminorN/A
closedfixed 
3.0-beta 
3.0 
0002776: FindStateLabelAndOffset flaws
I was going to refactor FindStateLabelAndOffset into a member of AActor and have it return a struct containing the information (mostly because it would be a useful method to use in debugging to find out in which state the actor really is) and realized that the approach is quite flawed.

It was based on the dumpstates console command, whose purpose is to find the state labels of an actor and the owners of these labels. But FindStateLabelAndOffset only returns the state label and offset, not the owner. So what if the actor is in a shadowed state of its ancestor? (e.g. goto Super::Spawn + 2) Then it would only return Spawn + 2, which would be wrong. So it also needs to return the owner.

Furthermore, this is used in server commands code, to give a network-friendly representation of the state. Okay, but why label and offset? The label is just that, a label, and also lacks the owner so shadowed states would be sent wrong.

Wouldn't it be better to send the actor class who owns the state, and the offset from SpawnState? That would not be subject to this problem. I'll try to piece together a test case.
No tags attached.
parent of 0002832closed Dusk Incorrect Jump Frame Errors 
parent of 0003107closed  Issues with weapon switching and state jumps 
Issue History
2016-07-11 16:00DuskNew Issue
2016-07-11 17:43DuskNote Added: 0015280
2016-07-11 19:35Torr SamahoNote Added: 0015282
2016-07-12 16:54DuskNote Added: 0015293
2016-07-12 16:54DuskAssigned To => Dusk
2016-07-12 16:54DuskStatusnew => needs review
2016-11-20 21:38Edward-sanProduct Version3.0 => 3.0-beta
2016-11-21 07:06Torr SamahoRelationship addedparent of 0002832
2016-11-21 07:07Torr SamahoNote Added: 0016236
2016-11-21 07:09Torr SamahoStatusneeds review => needs testing
2016-12-24 22:42DuskTarget Version => 3.0
2017-04-30 20:19WaTaKiDRelationship addedparent of 0003107
2017-08-06 19:07DuskStatusneeds testing => resolved
2017-08-06 19:07DuskResolutionopen => fixed
2018-09-30 22:32Blzut3Statusresolved => closed

Notes
(0015280)
Dusk   
2016-07-11 17:43   
Okay, SERVERCOMMANDS_SetThingFrame does have enough safeguards to prevent this from causing desyncs but IMO the code is still needlessly complicated.
(0015282)
Torr Samaho   
2016-07-11 19:35   
Quote from Dusk
Wouldn't it be better to send the actor class who owns the state, and the offset from SpawnState?
That could work. It would be surely nice to simplify the current approach. If you get this to work reliably, I'm all for it.
(0015293)
Dusk   
2016-07-12 16:54   
Here goes. AOW2 turned out to be a rather useful test case for this.

Turns out I cannot use the offset from SpawnState, because it isn't necessarily the first defined state of the actor. It isn't even owned by the actor, if the actor inherits it. So OwnedStates needs to be used instead, as &OwnedStates[0] is the first state the actor actually owns.
(0016236)
Torr Samaho   
2016-11-21 07:07   
I added this a while a ago. Unfortunately, it seems to have led to a new problem: 0002832.