When I tried mapping out all the "object" indices -- that is, the value which defines the general behavior of every enemy and item in CV3 -- I was left with a series of "Unknown" objects. Many of these don't have any significant behaviors, making them nearly impossible to figure out what they could have been. I didn't think much of it, as I had mapped everything out that was in-game, as far as I knew.
While analyzing the bosses -- again, for the umpteenth time -- I realized they have their own "behavior class". That's a variable that pretty much dictates for every enemy and item how it should behave inside its finite state machine. Cool. Behavior classes are pretty pointless in bosses -- they're just one extra thing the game has to account for that could have been handled in the main code (like CV1's beautiful boss code). So I started mapping out all the classes for bosses. When I was done, I was left with a few gaps.
"No biggy," I thought. "I'll just fight all the bosses again and set breakpoints for these specific behaviors. The ones I don't find, I'll dig deeper into the code to see if they were deleted or cut content."
Starting from the bottom, my first missing boss class was #48. I searched the PROM for all references to LDA #48. Nothing useful. Then I searched for LDA #C8, which I still don't know what the point of that is, but that high bit means something for bosses. I got a hit, so I read the code that was supposed to set the class to #C8. It belonged to one of the Unknown boss objects. Needless to say, I got really excited in anticipation that I was about to discover lost content.
...It was the Giant Bat.
Hear me out! It wasn't like I hadn't mapped out the Giant Bat already. It's object #04, uses classes #18, #19, #1A, #1B, and #46. I was looking at the code in question and it dealt with the boss thingy (it could have been a projectile, for all I knew) flipping its sprite when damaged by the player. I thought, "What the heck would flip its sprite when damaged?" The only thing I could think of at the time was the Giant Bat. So, I went to the swamp and faced the boss, set a breakpoint for the start of the code in question, and started the fight. Nothing at first, so the next thing to try was attacking the bat.
BINGO! Except not really.
I ran the game. The debugger stopped again. I looked at the object index for the Giant Bat.
#04.
Why the hell was it running the Unknown object's code for the Giant Bat, instead of the Giant Bat's code? It was time for the trace logger. I ran the game and looked at what code it processed before the breakpoint. It deliberately skipped the Giant Bat object's code if the boss was active. That's when it hit me.
Four of the Unknown objects are the Skeleton, Cyclops, Giant Bat, and Grant bosses.There are a few other Unknown boss objects for me to look into, but I suspect now they are similar to these four. Apparently, whoever programmed the bosses used one object for when a boss waits for the player to get close enough and a different object for movement. However, at some point he decided to just point the waiting object to the movement code instead of changing the object.
Yet another reason for me to despise whoever coded the bosses...
Oh yeah, and if I hadn't brought it up already: Death and the Doppelganger were apparently coded by a different programmer, because they are the only enemies (including items) to not use behavior classes. Oh, and I can't forget the occasional boss that sets the class to #80, which is just #00 with the high bit set, and then never changes the class ever again. Like, why even bother at all?
*cries in a corner*
No comments:
Post a Comment