r4297 Startup FloatbobPhase Error

Bugs that have been investigated and resolved somehow.

Moderator: GZDoom Developers

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 Reply
User avatar
Enjay
 
 
Posts: 26991
Joined: Tue Jul 15, 2003 4:58 pm
Location: Scotland
Contact:

r4297 Startup FloatbobPhase Error

Post by Enjay »

On starting r4297 this error is reported in the startup window.

Image
User avatar
Graf Zahl
Lead GZDoom+Raze Developer
Lead GZDoom+Raze Developer
Posts: 49230
Joined: Sat Jul 19, 2003 10:19 am
Location: Germany

Re: r4297 Startup FloatbobPhase Error

Post by Graf Zahl »

Hm... I must have hit undo sometime after testing...

fixed in r4299
User avatar
Enjay
 
 
Posts: 26991
Joined: Tue Jul 15, 2003 4:58 pm
Location: Scotland
Contact:

Re: r4297 Startup FloatbobPhase Error

Post by Enjay »

I'm still getting the same error. I did a clean and rebuild of the project just in case.

Image
Edward-san
Posts: 1774
Joined: Sat Oct 17, 2009 9:40 am

Re: r4297 Startup FloatbobPhase Error

Post by Edward-san »

... this patch fixes the problem for me:

Code: Select all

Index: src/thingdef/thingdef_properties.cpp
===================================================================
--- src/thingdef/thingdef_properties.cpp        (revision 4299)
+++ src/thingdef/thingdef_properties.cpp        (working copy)
@@ -627,7 +627,7 @@
 //==========================================================================
 //
 //==========================================================================
-DEFINE_PROPERTY(floatbobphase, F, Actor)
+DEFINE_PROPERTY(floatbobphase, I, Actor)
 {
        PROP_INT_PARM(id, 0);
        if (id < -1 || id >= 64) I_Error ("FloatBobPhase must be in range [-1,63]");
Also, I can't find any documentation in the code on how these properties work...
User avatar
Graf Zahl
Lead GZDoom+Raze Developer
Lead GZDoom+Raze Developer
Posts: 49230
Joined: Sat Jul 19, 2003 10:19 am
Location: Germany

Re: r4297 Startup FloatbobPhase Error

Post by Graf Zahl »

F*ck!

That happens when you don't have time to test such minor changes properly... :(
User avatar
edward850
Posts: 5886
Joined: Tue Jul 19, 2005 9:06 pm
Location: New Zealand
Contact:

Re: r4297 Startup FloatbobPhase Error

Post by edward850 »

I should note that FloatBobPhase can never be less then 0, as it's defined as a byte in actor.h.
Edward-san
Posts: 1774
Joined: Sat Oct 17, 2009 9:40 am

Re: r4297 Startup FloatbobPhase Error

Post by Edward-san »

... it gives me -1 if I load it normally:

Code: Select all

Breakpoint 1, Handler_floatbobphase_I_Actor (defaults=0xd2a400, info=0xd2a720, 
    bag=..., params=0xd2a8c0)
    at /home/edward-san/zdoom/trunk/src/thingdef/thingdef_properties.cpp:632
632		PROP_INT_PARM(id, 0);
(gdb) print id
$1 = 0
(gdb) next
633		if (id < -1 || id >= 64) I_Error ("FloatBobPhase must be in range [-1,63]");
(gdb) print id
$2 = -1
User avatar
edward850
Posts: 5886
Joined: Tue Jul 19, 2005 9:06 pm
Location: New Zealand
Contact:

Re: r4297 Startup FloatbobPhase Error

Post by edward850 »

Because you are looking at id, not defaults->FloatBobPhase. That's kind of important, otherwise FloatBobPhase can never be -1 at p_mobj: line 3882.
Edward-san
Posts: 1774
Joined: Sat Oct 17, 2009 9:40 am

Re: r4297 Startup FloatbobPhase Error

Post by Edward-san »

True, you're right. I fixed this with this patch, maybe inelegant:

Code: Select all

Index: src/p_mobj.cpp
===================================================================
--- src/p_mobj.cpp      (revision 4309)
+++ src/p_mobj.cpp      (working copy)
@@ -3878,7 +3878,7 @@
                actor->SpawnPoint[2] = (actor->z - actor->floorz);
        }
 
-       if (actor->FloatBobPhase < 0) actor->FloatBobPhase = rng();     // Don't make everything bob in sync (unless deliberately told to do)
+       if (actor->FloatBobPhase == (BYTE)-1) actor->FloatBobPhase = rng();     // Don't make everything bob in sync (unless deliberately told to do)
        if (actor->flags2 & MF2_FLOORCLIP)
        {
                actor->AdjustFloorClip ();

User avatar
Graf Zahl
Lead GZDoom+Raze Developer
Lead GZDoom+Raze Developer
Posts: 49230
Joined: Sat Jul 19, 2003 10:19 am
Location: Germany

Re: r4297 Startup FloatbobPhase Error

Post by Graf Zahl »

Cr*p
Edward-san
Posts: 1774
Joined: Sat Oct 17, 2009 9:40 am

Re: r4297 Startup FloatbobPhase Error

Post by Edward-san »

uh, is it okay to leave 'rng()' like that? you limit the floatbobphase range to [-1,63], but rng() has range [0,255].
User avatar
Graf Zahl
Lead GZDoom+Raze Developer
Lead GZDoom+Raze Developer
Posts: 49230
Joined: Sat Jul 19, 2003 10:19 am
Location: Germany

Re: r4297 Startup FloatbobPhase Error

Post by Graf Zahl »

It doesn't really matter. The upper 2 bits get masked out when using the variable.
Post Reply

Return to “Closed Bugs [GZDoom]”