Re: [g2.2pre-2105-g8f53599]Crash to desktop: User variables?

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 a reply

Smilies
:D :) :( :o :shock: :? 8-) :lol: :x :P :oops: :cry: :evil: :twisted: :roll: :wink: :geek: :ugeek: :!: :?: :idea: :arrow: :| :mrgreen: :3: :wub: >:( :blergh:
View more smilies

BBCode is OFF
Smilies are ON

Topic review
   

Expand view Topic review: Re: [g2.2pre-2105-g8f53599]Crash to desktop: User variables?

Re: Re: [g2.2pre-2105-g8f53599]Crash to desktop: User variab

by randi » Sat Oct 01, 2016 9:35 pm

The self == stateowner check is now restricted to action functions, so it won't crash Damage functions. The other problem has been fixed too.
Major Cooke wrote:Using A_SetUserVar, that works from weapons to player.
I don't see why that shouldn't work as described, since it works on self, just like every other function called from a weapon state. Don't consider A_SetUserVar and operator= as equivalent, since they're not. The former is resolved at compile time, and the latter is resolved at runtime.
Vaecrius wrote:

Code: Select all

actor zimpball:doomimpball replaces doomimpball{
	var int user_blah;
	damage(1+user_blah)
	states{
	spawn:
		TNT1 A 0 nodelay{
			user_blah=100;
		}goto super::spawn
	}
}
Looking at the code generated for the spawn state here, I think it should be safe to omit the self==stateowner check for any actors that aren't inventory items, since those are the only ones that could possibly be called with them different.

Re: Re: [g2.2pre-2105-g8f53599]Crash to desktop: User variab

by Leonard2 » Wed Sep 28, 2016 6:06 am

This isn't the only place where damage expressions are problematic with this anyways:

Code: Select all

actor D : rocket
{
	Damage (bool(A_JumpIf(true, "crashes")))
}
The actor D will crash the game when it explodes.

Re: Re: [g2.2pre-2105-g8f53599]Crash to desktop: User variab

by randi » Tue Sep 27, 2016 6:18 pm

Vaecrius wrote:Was this supposed to break projectiles that use uservars in their damage definition? If so, why, given they don't involve weapons or custominventory?
This FxClassMember change is generating bad code for damage expressions, because those don't have a callingstate parameter, but it generates code to try to compare against it anyway.

Re: Re: [g2.2pre-2105-g8f53599]Crash to desktop: User variab

by Leonard2 » Tue Sep 27, 2016 3:14 pm

Vaecrius wrote:[examples here]
I think I already know what's happening.
This doesn't actually trigger because of your decorate code, I think it triggers when the damage is calculated (which is done within the VM) and since there is no stateowner pointer passed to the damage vmfunction call the error is triggered.
To test this you could just put the damage on a missile and make it explode, see if the error shows.

Re: Re: [g2.2pre-2105-g8f53599]Crash to desktop: User variab

by Graf Zahl » Tue Sep 27, 2016 1:19 am

That should work, so please report a new bug.

Re: Re: [g2.2pre-2105-g8f53599]Crash to desktop: User variab

by Matt » Tue Sep 27, 2016 12:56 am

What would be proper?

Both this

Code: Select all

actor zimpball:doomimpball replaces doomimpball{
	var int user_blah;
	damage(user_blah+1)
	states{
	spawn:
		TNT1 A 0 nodelay A_SetUserVar(user_blah,100)
		goto super::spawn
	}
}
and this

Code: Select all

actor zimpball:doomimpball replaces doomimpball{
	var int user_blah;
	damage(1+user_blah)
	states{
	spawn:
		TNT1 A 0 nodelay{
			user_blah=100;
		}goto super::spawn
	}
}
trigger the error and abort.

Re: Re: [g2.2pre-2105-g8f53599]Crash to desktop: User variab

by Graf Zahl » Tue Sep 27, 2016 12:44 am

In that case, probably because their calling info is not set up properly.

Re: Re: [g2.2pre-2105-g8f53599]Crash to desktop: User variab

by Matt » Mon Sep 26, 2016 6:50 pm

From all the complaints so far, it seems that only that particular function aborts.

Was this supposed to break projectiles that use uservars in their damage definition? If so, why, given they don't involve weapons or custominventory?

Re: Re: [g2.2pre-2105-g8f53599]Crash to desktop: User variab

by Major Cooke » Fri Sep 16, 2016 11:50 am

So, curious, by abort, does that mean it shuts down the game (go to console) or does it just reject doing that specific thing from happening?

Re: Re: [g2.2pre-2105-g8f53599]Crash to desktop: User variab

by Graf Zahl » Thu Sep 15, 2016 3:43 pm

It still was a bad, shortsighted decision then.

Re: Re: [g2.2pre-2105-g8f53599]Crash to desktop: User variab

by Major Cooke » Thu Sep 15, 2016 3:34 pm

Graf Zahl wrote:Yeah, well, thank you for abusing something that was never meant to work that way...
The entire thing is broken, everybody knows it and yet people depend on the broken behavior, making a fix impossible. :( Ever since this got reported the first time the one issue that prevented us from addressing it is modders' insistence on abusing every single glitch they find.
I didn't see it as abuse since randi made it possible. >.>;

Re: Re: [g2.2pre-2105-g8f53599]Crash to desktop: User variab

by Leonard2 » Thu Sep 15, 2016 1:17 pm

Updated the PR: I simplified the check and fixed the problem I mentioned previously.

Re: Re: [g2.2pre-2105-g8f53599]Crash to desktop: User variab

by Graf Zahl » Thu Sep 15, 2016 12:02 am

FYI, I committed the rest of this PR but left out the self check for now.

And what a check really should do is something along:

Code: Select all

if (self != stateowner)
{
    if (variable_address outside of range for AActor)
    {
        throw an error;
    }
}
But can it be done in a less costly manner? Your attempt of a fix adds a lot of code for each variable access which may actually cause performance issues because this can happen so often.


I hope that for the real scripting language a better solution can be found.

Re: Re: [g2.2pre-2105-g8f53599]Crash to desktop: User variab

by Graf Zahl » Wed Sep 14, 2016 11:44 pm

Major Cooke wrote:I utilize A_SetUserVar for weapons setting user variables on the player directly in D4D.

Yeah, well, thank you for abusing something that was never meant to work that way...
The entire thing is broken, everybody knows it and yet people depend on the broken behavior, making a fix impossible. :( Ever since this got reported the first time the one issue that prevented us from addressing it is modders' insistence on abusing every single glitch they find.

Re: Re: [g2.2pre-2105-g8f53599]Crash to desktop: User variab

by Major Cooke » Wed Sep 14, 2016 10:27 pm

Using A_SetUserVar, that works from weapons to player.

Top