I don't know why this was so difficult for me to understand the first time I looked at the code for Bionic Commando on the NES, but it makes a bit more sense now.
There are 9 possible angles for the arm, ranging from values 0 thru 8. Even though values 0 and 8 will yield proper hook angles, the swinging mechanics only work for angles 1 thru 7, whereas values of 0 or 8 will cause graphical issues. Values larger than 8 will crash the program. If we treat angle 4 as 270°, the angles are thus roughly equivalent to:
- 202°
- 225°
- 248°
- 270°
- 292°
- 315°
- 338°
The grappling arm can have an extension length up to 31, with 2 typically being the smallest working range (less than 2 would be considered retracting). Each angle has its own separate code state, rather than just a simple series of LUT references, because Capcom.
The distance from the hook to Rad's arm thus is roughly
HOOKx + round( cos(angle) * armlength * 1.95 );
HOOKy + round( sin(angle) * armlength * 1.95 );
I can't tell you why the armlength needs to be multiplied by roughly 1.95, but that's what my calculator suggested was the average deviation from the working values.
Rad will kick off swinging starting from angle 1 or angle 7. The entire period of his swing is defined by 14 sets of 4 bytes each, which actually hold 6 values. Byte 0 is his sprite index (there are only 3) and his angle. Byte 1 is the horizontal offset from his hand to his body's sprite's origin. Byte 2 is the vertical offset from his hand to his body's sprite's origin. Byte 4 is for sprite mirroring and delay until the next angle. There are two sets of sprite information, one for actively swinging and one for retracting the arm. So as an example, 1CF40908 would set the angle to 1, set the sprite to 12 (a.k.a. Superman pose), set the body sprite 4 pixels to the left and 9 pixels below the hand, disable sprite mirroring, and set the delay until the next angle to 8 steps.
- 1 C F4 09 0 8
- 2 C F4 09 0 6
- 3 C F4 09 0 5
- 4 D 02 0D 0 5
- 5 D 06 0D 0 4
- 6 E 0C 09 0 6
- 7 E 0C 09 0 8
- 7 C 0C 09 1 8
- 6 C 0C 09 1 6
- 5 C 0C 09 1 4
- 4 D FE 0D 1 4
- 3 D FA 0D 1 6
- 2 E F4 09 1 8
- 1 E F4 09 1 8
- 1 F F4 09 1 5
- 2 F F4 09 1 5
- 3 F F4 09 1 4
- 4 D 02 0D 0 4
- 5 D 06 0D 0 3
- 6 0 0C 09 1 5
- 7 0 0C 09 1 5
- 7 F 0C 09 0 5
- 6 F 0C 09 0 5
- 5 F 0C 09 0 3
- 4 D FE 0D 1 3
- 3 D FA 0D 1 5
- 2 0 F4 09 0 5
- 1 0 F4 09 0 5
Dismount speed is simply a LUT referenced in tandem with the same 14 points of the swing period. The values used are pretty disappointing, in my opinion.
- 0001 80FE
- 0001 80FE
- 0001 80FE
- 0001 80FE
- 0001 80FE
- 0001 80FE
- 2001 D0FD
- 0001 80FE
- 0001 80FE
- 0001 80FE
- 0001 80FE
- 0001 80FE
- 0001 80FE
- 2001 D0FD
Simply pressing down while swinging results in the same awkward hop, and only when detaching at the extreme limits do you achieve a greater boost, which is practically a negligible difference. Perhaps there was a reason for this, like Rad is maybe supposed to be hoisting himself up a tad at the moment the hook detaches, but even when I played this as a kid, it still felt weird.
Have I mentioned yet how much I hate Capcom's programmers? Oh my god, this game's code is an eyesore.
No comments:
Post a Comment