Handmade Hero»Forums»Code
Mox
32 posts
Bug Day 301: GetBoundFor Y set wrong
Hi,

I believe there is a bug in GetBoundFor that might exaggerate the problems with sorting: the Ymin and Ymax overwrite the previous error instead of adding to it.

1
2
SpriteBound.YMin = -0.5f*Height;
SpriteBound.YMax = 0.5f*Height;


should be

1
2
SpriteBound.YMin += -0.5f*Height;
SpriteBound.YMax += 0.5f*Height;


Happy coding,
Mox
Casey Muratori
801 posts / 1 project
Casey Muratori is a programmer at Molly Rocket on the game 1935 and is the host of the educational programming series Handmade Hero.
Bug Day 301: GetBoundFor Y set wrong
Ack! Yes, that is not good at all :)

- Casey
Andre
15 posts
Bug Day 301: GetBoundFor Y set wrong
I was wondering about a line that slipped into handmade_entity.cpp:
1
2
r32 TempZ = EntityTransform.OffsetP.z;
s32 RelativeLayer = ConvertToLayerRelative(WorldMode, &TempZ);

If I'm not mistaken, ConvertToLayerRelative is supposed to modify the transform's Z offset in place. Here, that modification is being lost in a temporary.
Casey Muratori
801 posts / 1 project
Casey Muratori is a programmer at Molly Rocket on the game 1935 and is the host of the educational programming series Handmade Hero.
Bug Day 301: GetBoundFor Y set wrong
Yes, that is intentional. Since we are temporarily looking at the Z/Y sorting stuff, we don't want to flatten everything down to layers, which is what it would do if we passed the actual Z there.

Once we're ready to deal with the layers again, we'll remove the temporary.

- Casey