A_WeaponReady: WRF_USER1 (etc.)

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: A_WeaponReady: WRF_USER1 (etc.)

Re: A_WeaponReady: WRF_USER1 (etc.)

by Major Cooke » Thu Dec 31, 2015 5:08 pm

Randi has added this. This can be closed.

Re: A_WeaponReady: WRF_USER1 (etc.)

by Major Cooke » Tue Dec 15, 2015 9:04 am

Alright, done. Anything else?

Re: A_WeaponReady: WRF_USER1 (etc.)

by Graf Zahl » Tue Dec 15, 2015 8:17 am

That may be, but it's bad style. Never use '+' with flag values, always use '|'. It's not the first time you did this and it was problematic in other cases. Better stop doing this altogether.

Re: A_WeaponReady: WRF_USER1 (etc.)

by Major Cooke » Tue Dec 15, 2015 7:56 am

No other flags are being passed into it. It's fine.

Re: A_WeaponReady: WRF_USER1 (etc.)

by Edward-san » Tue Dec 15, 2015 7:47 am

imho, you should keep the consistency with the | operator here.

Re: A_WeaponReady: WRF_USER1 (etc.)

by Major Cooke » Tue Dec 15, 2015 7:19 am

And done.

Re: A_WeaponReady: WRF_USER1 (etc.)

by Graf Zahl » Tue Dec 15, 2015 2:54 am

'That piece of code just looks wrong. If you deserialize an old savegame you should always set WeaponState. Like this:

Code: Select all

if (SaveVersion < 4526)
   {
      BYTE oldWeaponState;
      arc << oldWeaponState;
      WeaponState = oldWeaponState;
   }
   else
   {
      arc << WeaponState;
   }

Re: A_WeaponReady: WRF_USER1 (etc.)

by Major Cooke » Tue Dec 15, 2015 12:43 am

Actually that doesn't work. Found something else that I think might though... Accuracy and stamina do this.

Code: Select all

if (SaveVersion < 4526)
	{
		BYTE oldWeaponState;
		arc << oldWeaponState;
		if (WeaponState != NULL)
		{
			WeaponState = oldWeaponState; //Shouldnt this be opposite? Looks like it should be but this is how accuracy and stamina did it...
		}
	}
	else
	{
		arc << WeaponState;
	}

Re: A_WeaponReady: WRF_USER1 (etc.)

by edward850 » Tue Dec 15, 2015 12:38 am

You'll want to test that, but yes that should do it.

Re: A_WeaponReady: WRF_USER1 (etc.)

by Major Cooke » Tue Dec 15, 2015 12:37 am

(byte)WeaponState right?

Re: A_WeaponReady: WRF_USER1 (etc.)

by edward850 » Tue Dec 15, 2015 12:26 am

WeaponState is serialized. You'll need to explicitly load a byte for older versions.

Re: A_WeaponReady: WRF_USER1 (etc.)

by Major Cooke » Mon Dec 14, 2015 11:54 pm

Sorry! Found out what it was.

WeaponState is BYTE, and the flags for WF_USER#OKAY are 256 and above. Changing it to WORD fixed it. I hope this won't have any unforeseen consequences.

Pull Request and putting this on my first post on page 1.

Re: A_WeaponReady: WRF_USER1 (etc.)

by edward850 » Mon Dec 14, 2015 10:38 pm

Except it most certainly does.
Image

Edit: Gah what. Stop deleting posts! D:
For the record, Major Cooke said that BT_USER1-4 did nothing in the playsim. I'm assume he then found something he might have been missing.

Re: A_WeaponReady: WRF_USER1 (etc.)

by Xaser » Mon Dec 14, 2015 9:00 pm

What's the issue at present? Should be able to get away with copying+pasting+renaming how the Reload and Zoom states do things, since it's the same thing.

Re: A_WeaponReady: WRF_USER1 (etc.)

by Major Cooke » Mon Dec 14, 2015 7:32 pm

Yeah I figured not but still... Hell if I know where to find it, honestly.

Top