Nov 23, 2023

Bit by bit, I'm going insane

I think I finally figured out what that high bit was in the "behavior class" variable for bosses and enemies. I searched the PROM for when the byte was loaded. Most of the references just ANDed by #7f, which tells me nothing. I narrowed the search down to BMI (branch if minus) or BPL (branch if plus) checks. Nothing. Then I tried narrowing the search down to AND #80 checks. I got one hit and it seemed to be the only one I would find referencing that high bit. 

Any object less than #10 wouldn't run that line of code. That is, the bosses skipped that code. ...So why do the bosses have that bit set? Guess I need to search a little more for that answer, hopefully. All other objects set that bit when they run their "Create Event". I use quotes because all instances essentially run a creation event in the spawn routine. All the variables are cleared to 0, then the object and behaviors are set. Well, it turns out there is a separate routine which runs every step or so checking if that high bit is cleared. If so, it sets the sprite for the instance and then sets the bit to let the game know that instance has already had its sprite set. 

First issue: Why run that code every step? Why not set the sprite when the object is created? This is just a waste of CPU space.

Second issue: The game already sets the sprites for instances inside their behavior classes or inside the instance which spawned them. Or did I take that for granted and overlooked something somewhere? 

Perhaps more updates will follow. In the meantime, #wtfkonami.

No comments:

Post a Comment

©TheouAegis Productions™. Powered by Blogger.