Graf Zahl wrote:Drawback: Syntax of weapon action functions will be completely messed up, not intuitive for modders
I still strongly disagree with that.
Here's an example based on a recent bug report:
Spoiler:
From this
Code: Select all
Class NewPistol : Pistol
{
int testing;
States
{
Select:
TNT1 A 0
{
invoker.testing = 9;
}
Goto Super::Select;
Fire:
TNT1 A 0
{
A_ChangeVelocity(0, 0, invoker.testing);
}
Goto Super::Fire;
}
}
To this
Code: Select all
Class NewPistol : Pistol
{
int testing;
States
{
Select:
TNT1 A 0
{
testing = 9;
}
Goto Super::Select;
Fire:
TNT1 A 0
{
caller.A_ChangeVelocity(0, 0, testing);
}
Goto Super::Fire;
}
}
I would say that the second syntax would be much more intuitive and on top of that consistent with everything else within zscript.
Currently the best part is that it's even inconsistent across the class definition itself:
Code: Select all
Class NewPistol : Pistol
{
int testing;
States
{
Select:
TNT1 A 0
{
invoker.testing = 9;
}
Goto Super::Select;
Fire:
TNT1 A 0
{
A_ChangeVelocity(0, 0, invoker.GetMyTest());
A_LogInt(invoker.GetMyTest());
A_LogInt(GetMyTest()); // This is broken by the way
}
Goto Super::Fire;
}
int GetMyTest() // non-action
{
return testing; // not invoker.testing???
}
}
Graf Zahl wrote:Which may be necessary anyway if HUD overlays from arbitrary actors become a thing.
No no no you got it wrong, it's not overlays
from arbitrary actors, it's overlays
on arbitrary actors.
The current implementation limits their use to player actors only and my pull request aimed at removing said limitation.
Meaning that:
Graf Zahl wrote:Is it possible that if actor A defines some states, it can inject them into actor B's overlays
Is wrong unless of course it's a StateProvider like currently for players.
Graf Zahl wrote:Of course that will again open up the old problem of having to add a runtime check for DECORATE based states in StateProvider-derived classes because then the incorrect use cannot be detected at compile time.
Before I made assignment operators for decorate people were forced to use the A_SetUserVar function which is slower than doing a pointer check so I guess it can't be that bad.
Here's a pull request.
I think it's the best solution as it doesn't remove/change anything and fixes the issue.
[quote="Graf Zahl"]Drawback: Syntax of weapon action functions will be completely messed up, not intuitive for modders[/quote]
I still strongly disagree with that.
Here's an example based on a recent bug report:
[spoiler]From this
[code]Class NewPistol : Pistol
{
int testing;
States
{
Select:
TNT1 A 0
{
invoker.testing = 9;
}
Goto Super::Select;
Fire:
TNT1 A 0
{
A_ChangeVelocity(0, 0, invoker.testing);
}
Goto Super::Fire;
}
}[/code]
To this
[code]Class NewPistol : Pistol
{
int testing;
States
{
Select:
TNT1 A 0
{
testing = 9;
}
Goto Super::Select;
Fire:
TNT1 A 0
{
caller.A_ChangeVelocity(0, 0, testing);
}
Goto Super::Fire;
}
}[/code][/spoiler]
I would say that the second syntax would be much more intuitive and on top of that consistent with everything else within zscript.
Currently the best part is that it's even inconsistent across the class definition itself:
[code]Class NewPistol : Pistol
{
int testing;
States
{
Select:
TNT1 A 0
{
invoker.testing = 9;
}
Goto Super::Select;
Fire:
TNT1 A 0
{
A_ChangeVelocity(0, 0, invoker.GetMyTest());
A_LogInt(invoker.GetMyTest());
A_LogInt(GetMyTest()); // This is broken by the way
}
Goto Super::Fire;
}
int GetMyTest() // non-action
{
return testing; // not invoker.testing???
}
}[/code]
[quote="Graf Zahl"]Which may be necessary anyway if HUD overlays from arbitrary actors become a thing.[/quote]
No no no you got it wrong, it's not overlays [u]from[/u] arbitrary actors, it's overlays [u]on[/u] arbitrary actors.
The current implementation limits their use to player actors only and my pull request aimed at removing said limitation.
Meaning that:
[quote="Graf Zahl"]Is it possible that if actor A defines some states, it can inject them into actor B's overlays[/quote]
Is wrong unless of course it's a StateProvider like currently for players.
[quote="Graf Zahl"]Of course that will again open up the old problem of having to add a runtime check for DECORATE based states in StateProvider-derived classes because then the incorrect use cannot be detected at compile time.[/quote]
Before I made assignment operators for decorate people were forced to use the A_SetUserVar function which is slower than doing a pointer check so I guess it can't be that bad.
[url=https://github.com/rheit/zdoom/pull/901]Here[/url]'s a pull request.
I think it's the best solution as it doesn't remove/change anything and fixes the issue.