Bank 90 rewrite and documentation, many other improvements

-Completely documented, rewrote, (mostly) extracted Bank 90
-Bank 85 clean up
-CalculateNthTransitionColor(), CalcItemPercentageCount() functions rewrite and documentation
-Extract Pause Menu Map Data
-Rename button_config variables
-Separate various variables
-Fix scrolling bugs
-OAM_DATA macro
-Enumerations, including but not limited to:
  -Knockback Direction
  -Arm Cannon Frame, Toggle, Drawing Mode
  -Atmospheric Graphics Type
  -Morph Ball Bounch State
  -Samus X Acceleration Mode
  -Samus Collision Results
This commit is contained in:
testyourmine 2024-09-19 15:26:19 -05:00
parent 3e1daf0eeb
commit 45fcc94c37
37 changed files with 9986 additions and 4649 deletions

33
docs/math.md Normal file
View File

@ -0,0 +1,33 @@
# Math
This is a WIP document describing some of the mathematical concepts used in the game's code.
## Trigonometric math
In Super Metroid, trigonometry is used often to calculate angles and distances. Since the original game is in binary,
a different system is used from what is normally used in trig. In trig, the two common angular units are degrees and radians,
where a full turn is 360° or 2π rads, and the conversion between the two is degrees = radians \* (180° / π)
and radians = degrees \* (π / 180°).
However, since we have a different counting system, we instead use binary degrees (bdegrees).
In this system, a full turn is now 0x100 binary degrees, so now we have that radians = bdegrees \* (π / 0x80).
So as an example, if we had a variable `bangle` in bdegrees and a variable `distance`, the formula
`y_distance = distance * sin(bangle * pi / 80h)` would be equivalent to `y_distance = distance * sin(angle)`, where angle is
now in standard radians.
## Color interpolation
WARNING: BAD EXPLANATION, REDO THIS LATER
Given two points $(x_0, y_0)$ and $(x_1, y_1)$, we want to an equation that can find any point $(x, y)$ along a straight line between the two points.
Such an equation can be found using the linear interpolation formula, which is as follows:
$y = y_0 + \frac{(x-x_0) * (y_1-y_0)} {(x_1 - x_0)}$, where $(x - x_0)$ is the x distance from the origin, $(y_1 - y_0)$ is the vertical component, and $(x_1 - x_0)$ is the horizontal component.
In the case we are using, the origin $(x_0, y_0)$ is always at $x_0 = 0$, which simplifies the equation to:
$y = y_0 + \frac{x * (y_1-y_0)} {x_1} = y_0 + (y_1-y_0)*\frac{x} {x_1}$.
The purpose of all this is that we want to get the color(s) between two colors in a color space (this is used for gradients), which can be achieved using linear interpolation.
Let's set $x$ = pal_change_numer, $y$ = color_trans_component, $y_0$ = src_pal_color, $x_1$ = palette_change_denom, and $y_1$ = dst_pal_color.
Now using the linear interpolation on the color space, we get:
$color\_trans\_component = src\_pal\_color + (dst\_pal\_color - src\_pal\_color)*\frac{pal\_change\_numer} {palette\_change\_denom}$.
In other words, given:
- source color
- target color
- palette change denominator, which represents the amount of color steps between the source and target
- palette change numerator, which represents the color step between the source and target
then plugging into the equation will give us the numerator[th] color between the source and target colors.

View File

@ -45,10 +45,23 @@ Here are some tips and conventions for cleaning up code:
originally an unsigned integer, it should either be changed to a signed integer or sign casted. However, checks against 0x8000 sometimes
indicates that it's checking for a flag, in which case the `0x8000` should be replaced with a macro that describes the flag.
- Most of the time, when the code does something like `if ((x & 0xFF00) == 0)`, it usually means it is checking the high byte.
However, there are a few instances where it is a shorthand for `if (0 <= x && x < 0x100)`. This is because by masking out
the low byte, it can check if any bit above 0x00FF is set. This means that any value from 0x100 onward will make the
condition false, and any negative value will also cause the condition to be false since negative values sets 0x8000.
This check is most often used when checking location of an object on screen, however it may be used for other purposes.
If it's not entirely clear whether this is the case, consulting the bank logs is a good choice.
- Some while and do while loops can be replaced with for loops. For example, `int index = 0; while (index < 10) { ...; index++; }`
can be replaced with `for (int index = 0; index < 10; index++) { ... }`. However, this is not always the case, especially
when the order of iterating and checking is not the same.
- When comparing values, it is important to note what the sign of the values should be. Often, the port code does something like
`if ((int16)(x - y) >= 0)`, which could be reduced to `if (x >= y)`, casting to `int16` if they are not already of that type.
Currently, I do not know if all instances of these need to be signed or unsigned. So, when simplifying these,
check with the original code the type of comparison it does. If it uses `BCC/BCS`, then the comparison is unsigned.
If it uses `BPL/BMI`, then the comparison is signed.
- Whether a number is expressed in decimal or hex is up to interpretation. Generally, numbers that are used as bit flags
are expressed in hex. Sequences of numbers which seem random in decimal but line up nicely in hex should be expressed in hex,
and vice versa.
@ -66,7 +79,7 @@ Here are some tips and conventions for cleaning up code:
* @brief A brief description of the function
* @param1 A description of the first parameter
* @param2 A description of the second parameter
* @return type A description of the return value
* @return *type* description of the return value
*/
```
- Commenting in the middle of functions is fine, especially if its clarifying what a block of code or a condition is doing.

View File

@ -158,7 +158,7 @@ void VerifySRAM(void);
CoroutineRet WaitForNMI_Async(void);
CoroutineRet WaitForNMI_NoUpdate_Async(void);
void WriteLotsOf0x1c2f(void);
void memset7E(uint16 *k, uint16 a, uint16 j);
void memset7E(uint16 *dst, uint16 val, uint16 size);
void Write0x800BytesToRam3000(uint16 a);
void Write0x800BytesToRam4000(uint16 a);
void Write0x800BytesToRam6000(uint16 a);
@ -1017,11 +1017,11 @@ void RunRoomSetupCode(void);
CoroutineRet UnpauseHook_DraygonRoom(void);
// Bank 90
PairU16 Samus_CalcSpritemapPos(uint16 k);
PairU16 Samus_CalcSpritemapPos_Transitions(uint16 j);
PairU16 Samus_CalcSpritemapPos_Default(uint16 j);
PairU16 Samus_CalcSpritemapPos_Special(uint16 j);
PairU16 Samus_CalcSpritemapPos_Standing(uint16 j);
Point16U Samus_CalcSpritemapPos(uint16 k);
Point16U Samus_CalcSpritemapPos_Transitions(uint16 j);
Point16U Samus_CalcSpritemapPos_Default(uint16 j);
Point16U Samus_CalcSpritemapPos_Special(uint16 j);
Point16U Samus_CalcSpritemapPos_Standing(uint16 j);
uint16 RunSamusCode(uint16 a);
uint16 Samus_DetermineGrappleSwingSpeed_X(void);
uint16 Samus_DetermineSpeedTableEntryPtr_X(void);
@ -1081,8 +1081,8 @@ uint8 SamusCode_1D_ClearSoundInDoor(void);
uint8 SamusCode_1E_ResumeSfxAfterPowerBombExplosion(void);
uint8 SamusCode_1F_KillGrappleBeam(void);
uint8 Samus_CanFireBeam(void);
uint8 Samus_CanFireSuperMissile(void);
uint8 Samus_CheckAndMoveY(void);
uint8 Samus_CanFireAnyMissile(void);
uint8 Samus_MoveY_Simple(void);
uint8 Samus_EndShinespark(void);
uint8 UNUSED_Samus_Func26(void);
uint8 Samus_GrappleWallJumpCheck(int32 amt);
@ -1141,7 +1141,7 @@ void HandleChargingBeamGfxAudio(void);
void HandleControllerInputForGamePhysics(void);
void HandleSamusPlacementModeToggles(void);
void Samus_FrameHandlerBeta_Debug(void);
void HandleProjectile(void);
void HandleProjectiles(void);
void HandleProjectileTrails(void);
void HandleSamusMovementAndPause(void);
void HandleSwitchingHudSelection(void);
@ -1157,7 +1157,7 @@ void HudSelectionHandler_TurningAround(void);
void HudSelectionHandler_Xray(void);
void InitializeMiniMapBroken(void);
void InitializeProjectileSpeed(uint16 k, uint16 r22);
void InitializeProjectileSpeedOfType(uint16 r20);
void InitializeAnyMissileSpeed(uint16 r20);
void KillProjectile(uint16 k);
void KillProjectileFunc_0_Up(uint16 j);
void KillProjectileFunc_1_UpRight(uint16 j);
@ -1171,7 +1171,7 @@ void LoadProjectilePalette(uint16 a);
void MainScrollingRoutine(void);
void AccelerateMissileOrSuperMissile(uint16 k);
void SpawnSuperMissileLink(void);
void MoveSamusWithControlPad(void);
void DemoRecorder_MoveSamusWithControlPad(void);
void HandlePowerBomb(void);
void ProjTrailInstr_MoveLeftProjectileTrailDown(uint16 j);
void ProjTrailInstr_MoveLeftProjectileTrailUp(uint16 j);
@ -1225,16 +1225,16 @@ void ResetProjectileData(void);
void RunFrameHandlerGamma(void);
void RunSamusMovementHandler(void);
void UNUSED_SamusCrouching_Nothing(void);
void SamusDisplayHandler_SamusReceivedFatal(void);
void SamusDisplayHandler_UsingElevator(void);
void SamusDrawHandler_Default(void);
void SamusDrawSprites(void);
void SamusMoveHandler_CrystalFlashMain(void);
void Samus_DisplayHandler_InanimateSamus(void);
void Samus_DisplayHandler_UsingElevator(void);
void Samus_DrawHandler_Default(void);
void DrawSamusSprites(void);
void Samus_MovementHandler_CrystalFlashMain(void);
void SamusMoveHandler_CrystalFlash_0_DecMissiles(void);
void SamusMoveHandler_CrystalFlash_1_DecSuperMissiles(void);
void SamusMoveHandler_CrystalFlash_2_DecPowerBombs(void);
void SamusMoveHandler_CrystalFlashStart(void);
void SamusMovementType_Xray(void);
void Samus_MovementHandler_CrystalFlashStart(void);
void Samus_MovementHandler_Xray(void);
void Samus_AlignBottomWithPrevPose(void);
void Samus_Animate(void);
void Samus_Animate_AcidFx(void);
@ -1243,10 +1243,10 @@ void Samus_Animate_NoFx(void);
void Samus_Animate_SubmergedLavaAcid(void);
void Samus_Animate_WaterFx(void);
void Samus_ArmCannon_Draw(void);
void Samus_BombJumpFallingXMovement_(void);
void Samus_BombJumpFallingYMovement_(void);
void Samus_BombJumpRisingXMovement_(void);
void Samus_BombJumpRisingYMovement_(void);
void Samus_MoveX_CeresRidleyPush(void);
void Samus_MoveY_CeresRidleyPush(void);
void Samus_MoveX_KnockbackOrBombJump(void);
void Samus_BombJumpEnd(void);
int32 Samus_CalcBaseSpeed_X(uint16 k);
int32 Samus_CalcDisplacementMoveLeft(int32 amt);
int32 Samus_CalcDisplacementMoveRight(int32 amt);
@ -1263,11 +1263,11 @@ void Samus_DrawDuringDeathAnim(void);
void Samus_DrawEcho(uint16 j);
void Samus_DrawEchoes(void);
void Samus_DrawHandler_EndOfShinespark(void);
void Samus_DrawManyEchoes(void);
void Samus_DrawManyEchoes_Unused(void);
void Samus_DrawShinesparkCrashEchoProjectiles(void);
void Samus_DrawShinesparkCrashEchoes(uint16 k);
void Samus_DrawStartingDeathAnim(void);
void Samus_DrawWhenNotAnimatingOrDying(void);
void Samus_DrawInanimateSamus(void);
void Samus_FallingMovement(void);
void Samus_FootstepGraphics(void);
void Samus_FootstepGraphics_Common(void);
@ -1279,14 +1279,14 @@ void Samus_FrameHandlerAlfa_SamusLocked(void);
void Samus_FrameHandlerBeta_TitleDemo(void);
void Samus_FrameHandlerBeta_Normal(void);
void Samus_FrameHandlerGamma_UnlockSamusFromDrained(void);
void Samus_Func10(void);
void Samus_ClearMovement_ResetPoseChanges(void);
void Samus_FrameHandlerBeta_IntroDemo(void);
void Samus_FrameHandlerBeta_SamusAppears(void);
void Samus_FrameHandlerBeta_Ceres(void);
void Samus_FrameHandlerBeta_RidingElevator(void);
void Samus_FrameHandlerGamma_KeepSamusLockedFromDrained(void);
void Samus_InputHandler_Xray(void);
void Samus_MoveHandler_F04B_Unused(void);
void Samus_MovementHandler_F04B_Unused(void);
void Samus_FrameHandlerGamma_HandleTimer(void);
void Samus_FrameHandlerGamma_PushingOutOfRidleysWay(void);
void Samus_PushOutOfRidleysWay_Leftwards(void);
@ -1294,8 +1294,8 @@ void Samus_PushOutOfRidleysWay_Rightwards(void);
void Samus_FrameHandlerGamma_PushMorphedSamusOutOfRidleysWay_Unused(void);
void Samus_ClearSpecialFalling_Unused(void);
void Samus_FrameHandlerGamma_SpecialFalling_Unused(void);
uint16 Samus_GetTop_R20(void);
uint16 Samus_GetBottom_R18(void);
uint16 Samus_GetTopBound(void);
uint16 Samus_GetBottomBound(void);
void Samus_FrameHandlerGamma_GrabbedByDraygon(void);
static void Samus_HandleAnimDelay(void);
void Samus_HandleCooldown(void);
@ -1307,13 +1307,13 @@ void Samus_HandlePeriodicDamage(void);
void Samus_HandleScroll_X(void);
void Samus_HandleScroll_Y(void);
void Samus_HitInterruption(void);
void Samus_MoveHandler_HorizontalBombJump(void);
void Samus_MovementHandler_HorizontalBombJump(void);
void Samus_InitBombJump(void);
void Samus_InitJump(void);
void Samus_InitWallJump(void);
void Samus_InputHandler_Normal(void);
void Samus_InputHandler_Demo(void);
void Samus_JumpCheck(void);
void Samus_AutoJump_HurtFlash_PreviousInput_Handler(void);
void Samus_JumpingMovement(void);
void Samus_FrameHandlerBeta_EnterExitGunship(void);
void Samus_LowHealthCheck_(void);
@ -1326,15 +1326,15 @@ void Samus_MoveDown_SetPoseCalcInput(void);
void Samus_MoveExtraY(void);
void Samus_MovementHandler_ShinesparkWindup(void);
void Samus_MovementHandler_VerticalShinespark(void);
void Samus_MoveHandler_EndBombJump(void);
void Samus_MoveHandler_BombJumpMain(void);
void Samus_MoveHandler_BombJumpStart(void);
void Samus_MoveHandler_F072_Unused(void);
void Samus_MoveHandler_Knockback(void);
void Samus_MoveHandler_Invalid(void);
void Samus_MoveHandler_Knockback_StraightUp_Unused(void);
void Samus_MoveHandler_Knockback_Down(void);
void Samus_MoveHandler_Knockback_Up(void);
void Samus_MovementHandler_EndBombJump(void);
void Samus_MovementHandler_BombJumpMain(void);
void Samus_MovementHandler_BombJumpStart(void);
void Samus_MovementHandler_F072_Unused(void);
void Samus_MovementHandler_Knockback(void);
void Samus_MovementHandler_Invalid(void);
void Samus_MovementHandler_Knockback_StraightUp_Unused(void);
void Samus_MovementHandler_Knockback_Down(void);
void Samus_MovementHandler_Knockback_Up(void);
void Samus_MovementHandler_ReleaseFromGrapple(void);
void Samus_MovementHandler_ShinesparkCrash_EchoCircle(void);
void Samus_MovementHandler_ShinesparkCrash_EchoCircle_Finish(void);
@ -1403,18 +1403,18 @@ void Samus_SpinJumpMovement(void);
void Samus_UpdatePreviousPose(void);
void Samus_UpdateSpeedEchoPos(void);
void Samus_UpdateSuitPaletteIndex(void);
void Samus_MoveHandler_VerticalBombJump(void);
void Samus_MovementHandler_VerticalBombJump(void);
void Samus_FrameHandlerBeta_SamusLocked(void);
void SetInitialProjectileSpeed(uint16 r20);
void SetInitialBeamSpeed(uint16 r20);
void SetLiquidPhysicsType(void);
void SetupBombJump(void);
void SpawnProjectileTrail(uint16 k);
void SuperMissileBlockCollDetect_X(void);
void SuperMissileBlockCollDetect_Y(void);
void DisplaySamusPositionAsAmmoIfMorphed(void);
void SuperMissileBlockCollDetect_Horizontal(void);
void SuperMissileBlockCollDetect_Vertical(void);
void DemoRecorder_DisplaySamusPositionAsAmmoIfMorphed(void);
void UpdateBeamTilesAndPalette(void);
void UpdateMinimap(void);
void UpdateMinimapInside(uint16 r18, uint16 r22, uint16 r34, uint16 r30, uint16 r32, uint16 r38, uint16 r24, uint16 r40, uint16 r26, uint16 r42, uint16 r28);
void UpdateHudMinimapTilemap(uint16 r18, uint16 r22, uint16 r34, uint16 r30, uint16 r32, uint16 r38, uint16 r24, uint16 r40, uint16 r26, uint16 r42, uint16 r28);
void WaveBeam_CheckColl(uint16 k);
void WaveBeam_CheckColl_Vertical(void);
@ -1423,9 +1423,9 @@ void WaveBeam_CheckColl_Right(void);
void WaveBeam_CheckColl_Left(void);
void WriteBeamPalette_A(uint16 a);
void WriteBeamPalette_Y(uint16 j);
void SamusMoveHandler_CrystalFlashFinish(void);
void Samus_MovementHandler_CrystalFlashFinish(void);
void DrawSamus_NoChargeOrGrapple(void);
void SamusDrawHandler_NoChargeOrGrapple(void);
void Samus_DrawHandler_NoChargeOrGrapple(void);
// Bank 91
uint16 DemoInstr_ClearPreInstr(uint16 k, uint16 j);
@ -1532,7 +1532,7 @@ void HandleJumpTransition_SpringBallInAir(void);
void HandleJumpTransition_WallJump(void);
void HandleLandingGraphics(void);
void HandleLandingGraphics_Brinstar(void);
void HandleLandingGraphics_Ceres(void);
void HandleLandingGraphics_Delete(void);
void HandleLandingGraphics_Crateria(void);
void HandleLandingGraphics_Maridia_FootstepSplashes(void);
void HandleLandingGraphics_Norfair_WreckedShip_Dust(void);
@ -1764,7 +1764,10 @@ uint16 IsSamusWithinEnemy_Y(uint16 k, uint16 a);
uint16 Mult32(uint16 a);
typedef struct Pair_Bool_Amt {
bool flag;
union {
bool flag;
bool max_speed_flag;
};
int32 amt;
} Pair_Bool_Amt;
@ -5721,9 +5724,9 @@ void VerifySRAM(void);
#define fnSamus_MovementHandler_ShinesparkCrash_EchoCircle_Finish 0x90D3F3
#define fnSamus_MovementHandler_ShinesparkCrash_Finish 0x90D40D
#define fnProjPreInstr_SpeedEcho 0x90D4D2
#define fnSamusMoveHandler_CrystalFlashStart 0x90D678
#define fnSamusMoveHandler_CrystalFlashMain 0x90D6CE
#define fnSamusMoveHandler_CrystalFlashFinish 0x90D75B
#define fnSamus_MovementHandler_CrystalFlashStart 0x90D678
#define fnSamus_MovementHandler_CrystalFlashMain 0x90D6CE
#define fnSamus_MovementHandler_CrystalFlashFinish 0x90D75B
#define fnProjPreInstr_PlasmaSba 0x90D793
#define fnProjPreInstr_PlasmaSba_Phase0Expand 0x90D7E1
#define fnProjPreInstr_PlasmaSba_Phase1Contract 0x90D7FA
@ -5739,14 +5742,14 @@ void VerifySRAM(void);
#define fnProjPreInstr_SpazerSba_FuncB_1 0x90DBCF
#define fnProjPreInstr_SpazerSba_FuncB_2 0x90DC30
#define fnProjPreInstr_EndOfSpazerSba 0x90DC9C
#define fnSamus_MoveHandler_Knockback 0x90DF38
#define fnSamus_MoveHandler_Knockback_0 0x90DF50
#define fnSamus_MoveHandler_Knockback_Up 0x90DF53
#define fnSamus_MoveHandler_Knockback_3 0x90DF5D
#define fnSamus_MoveHandler_Knockback_Down 0x90DF64
#define fnSamus_MoveHandler_BombJumpStart 0x90E025
#define fnSamus_MoveHandler_BombJumpMain 0x90E032
#define fnSamus_MoveHandler_BombJumpFunc1 0x90E07D
#define fnSamus_MovementHandler_Knockback 0x90DF38
#define fnSamus_MovementHandler_Invalid 0x90DF50
#define fnSamus_MovementHandler_Knockback_Up 0x90DF53
#define fnSamus_MovementHandler_Knockback_StraightUp_Unused 0x90DF5D
#define fnSamus_MovementHandler_Knockback_Down 0x90DF64
#define fnSamus_MovementHandler_BombJumpStart 0x90E025
#define fnSamus_MovementHandler_BombJumpMain 0x90E032
#define fnSamus_MovementHandler_EndBombJump 0x90E07D
#define fnSamus_FrameHandlerGamma_UnlockSamusFromDrained 0x90E09B
#define fnSamus_FrameHandlerGamma_KeepSamusLockedFromDrained 0x90E0C5
#define fnSamus_FrameHandlerGamma_HandleTimer 0x90E0E6
@ -5777,16 +5780,16 @@ void VerifySRAM(void);
#define fnSamus_InputHandler_Xray 0x90E918
#define fnSamus_InputHandler_Demo 0x90E91D
#define fnSamus_InputHandler_AutoJump 0x90E926
#define fnSamusMovementType_Xray 0x90E94F
#define fnSamusDrawHandler_Default 0x90EB52
#define fnSamusDrawHandler_NoChargeOrGrapple 0x90EB86
#define fnSamus_MovementHandler_Xray 0x90E94F
#define fnSamus_DrawHandler_Default 0x90EB52
#define fnSamus_DrawHandler_NoChargeOrGrapple 0x90EB86
#define fnnullsub_156 0x90EBF2
#define fnSamus_DrawHandler_EndOfShinespark 0x90EBF3
#define fnSamusDisplayHandler_UsingElevator 0x90EC14
#define fnSamusDisplayHandler_SamusReceivedFatal 0x90EC1D
#define fnSamus_DisplayHandler_UsingElevator 0x90EC14
#define fnSamus_DisplayHandler_InanimateSamus 0x90EC1D
#define fnProjPreInstr_UnknownProj8027 0x90EFD3
#define fnSamus_MoveHandler_F04B_Unused 0x90F04B
#define fnSamus_MoveHandler_F072_Unused 0x90F072
#define fnSamus_MovementHandler_F04B_Unused 0x90F04B
#define fnSamus_MovementHandler_F072_Unused 0x90F072
#define fnnullsub_7 0x90F52F
#define fnSamus_InputHandler 0x918000
#define fnDemoPreInstr_nullsub_162 0x9183BF

View File

@ -11,6 +11,7 @@
#pragma pack(push, 1)
#define EARTHQUAKE(dir, disp, lyr) (dir + 3*disp + 9*lyr)
#define SPEED_BOOST_THRESHOLD 4
enum NmiEnable { // 0x7E0084
kNmi_EnableAutoJoypadRead = 0x1,
@ -295,6 +296,9 @@ enum ElevatorDirection { // 0x7E0799
kElevatorDirection_Up = 0x8000,
};
enum RoomIndex { // 0x7E079D
};
enum AreaIndex { // 0x7E079F
kArea_0_Crateria = 0x0,
kArea_1_Brinstar = 0x1,
@ -319,6 +323,13 @@ enum CeresStatus { // 0x7E093F
kCeresStatus_8000_ElevatorRoomRotate = 0x8000
};
enum CameraDistanceIndex {
kCameraDistanceIndex_0_Normal = 0x0,
kCameraDistanceIndex_2_Kraid_Crocomire = 0x2,
kCameraDistanceIndex_4_Unused = 0x4,
kCameraDistanceIndex_6_CrocomireWall = 0x6,
};
enum TimerStatus { // 0x7E0943
kTimerStatus_0_Inactive = 0x0,
kTimerStatus_1_CeresStart = 0x1,
@ -715,6 +726,33 @@ enum SamusMovementType { // 0x7E0A1F
kMovementType_1B_Shinespark_CrystalFlash_Drained_DamagedByMotherBrain = 0x1B,
};
enum KnockbackDir { // 0x7E0A52
kKnockbackDir_None = 0x0,
kKnockbackDir_UpLeft = 0x1,
kKnockbackDir_UpRight = 0x2,
kKnockbackDir_DownLeft = 0x4,
kKnockbackDir_DownRight = 0x5,
};
enum KnockbackXDir { // 0x7E0A54
kKnockbackXDir_Left = 0x0,
kKnockbackXDir_Right = 0x1,
};
enum BombJumpDir { // 0x7E0A56
kBombJumpDir_None = 0x0,
kBombJumpDir_Left = 0x1,
kBombJumpDir_Up = 0x2,
kBombJumpDir_Right = 0x3,
kBombJumpDir_Active = 0x800,
};
enum SamusPushDirection { // 0x7E0A62
kSamusPushDirection_None = 0x0,
kSamusPushDirection_Left = 0x1,
kSamusPushDirection_Right = 0x2,
};
enum SamusContactDamageIndex { // 0x7E0A6E
kSamusContactDamageIndex_0_Normal = 0x0,
kSamusContactDamageIndex_1_SpeedBoost = 0x1,
@ -729,6 +767,22 @@ enum SamusSuitPaletteIndex { // 0x7E0A74
kSuitPaletteIndex_4_Gravity = 0x4,
};
enum ArmCannonFrame { // 0x7E0AA8
kArmCannonFrame_0_Closed = 0x0,
kArmCannonFrame_3_Opened = 0x3,
};
enum ArmCannonToggle { // 0x7E0AAA
kArmCannonToggle_1_Yes = 0x1,
kArmCannonToggle_2_No = 0x2,
};
enum ArmCannonDrawingMode { // 0x7E0AAC
kArmCannonDrawingMode_0_NoDraw = 0x0,
kArmCannonDrawingMode_1_Draw = 0x1,
kArmCannonDrawingMode_2_FaceForward = 0x2
};
/* 29 */
enum LiquidPhysicsType { // 0x7E0AD2
kLiquidPhysicsType_Air = 0x0,
@ -736,7 +790,18 @@ enum LiquidPhysicsType { // 0x7E0AD2
kLiquidPhysicsType_LavaAcid = 0x2,
};
enum SamusCollisionDirection {
enum AtmosphericGraphicsType { // 0x7E0AEC
kAtmosphericGraphicType_0_None = 0x0,
kAtmosphericGraphicType_1_FootstepSplashes = 0x1,
kAtmosphericGraphicType_2_FootstepSplashes = 0x2,
kAtmosphericGraphicType_3_DivingSplashes = 0x3,
kAtmosphericGraphicType_4_LavaAcidSurfaceDamage = 0x4,
kAtmosphericGraphicType_5_Bubbles = 0x5,
kAtmosphericGraphicType_6_LandingDust = 0x6,
kAtmosphericGraphicType_7_SpeedBoostDust = 0x7,
};
enum SamusCollisionDirection { // 0x7E0B02
kSamusCollDir_0_Left = 0x0,
kSamusCollDir_1_Right = 0x1,
kSamusCollDir_2_Up = 0x2,
@ -746,12 +811,26 @@ enum SamusCollisionDirection {
kSamusCollDir_F_DisableSpecialColl = 0xF,
};
enum MorphBallBounceState { // 0x7E0B20
kMorphBallBounceState_NoBounce = 0x0,
kMorphBallBounceState_Morph_FirstBounce = 0x1,
kMorphBallBounceState_Morph_SecondBounce = 0x2,
kMorphBallBounceState_Spring_FirstBounce = 0x601,
kMorphBallBounceState_Spring_SecondBounce = 0x602
};
enum SamusYDirection { // 0x7E0B36
kSamusYDir_None = 0x0,
kSamusYDir_Up = 0x1,
kSamusYDir_Down = 0x2,
};
enum SamusXAccelerationMode { // 0x7E0B4A
kSamusXAccelMode_0_Accelerate = 0x0,
kSamusXAccelMode_1_TurnAround = 0x1,
kSamusXAccelMode_2_Decelerate = 0x2,
};
enum ProjectileDirection { // 0x7E0C04
kProjectileDir_UpFaceRight = 0x0,
kProjectileDir_UpRight = 0x1,
@ -767,6 +846,22 @@ enum ProjectileDirection { // 0x7E0C04
kProjectileDir_Delete = 0x10,
};
enum ProjectileOriginDirection { // 0x7E0C04
kProjectileOriginDir_UpFaceRight = 0x0,
kProjectileOriginDir_UpRight = 0x1,
kProjectileOriginDir_Right = 0x2,
kProjectileOriginDir_DownRight = 0x3,
kProjectileOriginDir_DownFaceRight = 0x4,
kProjectileOriginDir_DownFaceLeft = 0x5,
kProjectileOriginDir_DownLeft = 0x6,
kProjectileOriginDir_Left = 0x7,
kProjectileOriginDir_UpLeft = 0x8,
kProjectileOriginDir_UpFaceLeft = 0x9,
kProjectileOriginDir_TurnAimUpward = 0xA,
kProjectileOriginDir_TurnAimNeutral = 0xB,
kProjectileOriginDir_TurnAimDownward = 0xC,
};
/* 52 */
enum ProjectileType { // 0x7E0C18
kProjectileType_NormalBombExplosion = 0x1,
@ -780,7 +875,7 @@ enum ProjectileType { // 0x7E0C18
kProjectileType_SpazerSbaMask = 0x20,
kProjectileType_SpazerSbaTrail = 0x24,
kProjectileType_ShinesparkEcho = 0x29,
kProjectileType_CooldownMask = 0x3F,
kProjectileType_TableIndexMask = 0x3F,
kProjectileType_Missile = 0x100,
kProjectileType_SuperMissile = 0x200,
kProjectileType_PowerBomb = 0x300,
@ -792,6 +887,34 @@ enum ProjectileType { // 0x7E0C18
kProjectileType_DontInteractWithSamus = 0x8000,
};
enum SpazerSbaPhase { // 0x7E0CA4
kSpazerSbaPhase_0_Circle = 0x0,
kSpazerSbaPhase_2_FlyToPoint = 0x2,
kSpazerSbaPhase_4_FlyFromPoint = 0x4,
};
enum SamusSolidVerticalCollResult { // 0x7E0DC6
kSolidVertCollResult_0_NoChange = 0x0,
kSolidVertCollResult_1_Landed = 0x1,
kSolidVertCollResult_2_Falling = 0x2,
kSolidVertCollResult_3_Unused = 0x3,
kSolidVertCollResult_4_HitCeiling = 0x4,
kSolidVertCollResult_5_WallJumped = 0x5,
};
enum SamusDownwardCollResult { // 0x7E0DC7
kDownwardCollResult_Landed_0_Grounded = 0x0,
kDownwardCollResult_Landed_1_MorphGrounded = 0x1,
kDownwardCollResult_Landed_2_Unused = 0x2,
kDownwardCollResult_Landed_3_SpringGrounded = 0x3,
kDownwardCollResult_Landed_4_NoChange = 0x4,
kDownwardCollResult_Falling_0_Airborne = 0x0,
kDownwardCollResult_Falling_1_MorphAirborne = 0x1,
kDownwardCollResult_Falling_2_Unused = 0x2,
kDownwardCollResult_Falling_3_SpringAirborne = 0x3,
kDownwardCollResult_Falling_4_NoChange = 0x4,
};
enum GameOptionsMenuIndex { // 0x7E0DE2
kGameOptionsMenu_0_FinishFadeOut = 0x0,
kGameOptionsMenu_1_LoadOptionsMenu = 0x1,
@ -808,6 +931,12 @@ enum GameOptionsMenuIndex { // 0x7E0DE2
kGameOptionsMenu_12_FadeOutOptionsMenu = 0xC,
};
enum CrystalFlashAmmoDecrementIndex {
kCrystalFlashAmmoDecrement_0_Missiles = 0x0,
kCrystalFlashAmmoDecrement_1_SuperMissiles = 0x1,
kCrystalFlashAmmoDecrement_2_PowerBombs = 0x2,
};
enum ElevatorProperties { // 0x7E0E16
kElevatorProperty_StandingOnElevator = 0x1,
kElevatorProperty_DoorIsElevator = 0x80,
@ -994,14 +1123,20 @@ enum InsideBlockReactionSamusPoint { // 0x7E1E73
};
typedef struct Ram3000_MsgBox { // 0x7E30BC
uint8 pad[188];
uint16 msg_box_anim_y_radius_neg[30];
uint16 msg_box_anim_y_radius[30];
uint16 msg_box_anim_clear[86];
uint8 field_134[32];
uint16 tilemap[192];
union {
struct {
uint8 pad0[188];
uint16 msg_box_anim_y_radius_neg[30];
uint16 msg_box_anim_y_radius[30];
uint16 msg_box_anim_clear[86];
};
uint16 msg_box_anim_hdma_table[0x1E0 >> 1];
};
uint8 pad1[0x20];
uint16 tilemap[0x180 >> 1];
uint8 indirect_hdma[7];
uint8 field_387[99];
uint8 pad2[99];
uint8 backup_of_enabled_hdma_channels;
uint8 backup_of_bg3_tilemap_and_size;
} Ram3000_MsgBox;
@ -1784,6 +1919,11 @@ typedef struct CinematicSpriteObjectDef { // 0x8B0000
// VoidP instr_list;
//}CinematicBgObjectDef;
typedef struct ItemPercentageDigitsTilemap { // 0x8BE741
uint16 top_half_tilemap;
uint16 bottom_half_tilemap;
} ItemPercentageDigitsTilemap;
/* 21 */
typedef struct PalFxDef { // 0x8D0000
VoidP func;
@ -2198,52 +2338,6 @@ typedef struct SpawnHdmaObject_Args { // 0x
// uint16 field_0;
//}LoadBg_4;
/* 33 */
typedef struct DisableMinimapAndMarkBossRoomAsExploredEnt { // 0x90A83A
uint16 boss_id_;
VoidP ptrs;
} DisableMinimapAndMarkBossRoomAsExploredEnt;
typedef struct MarkMapTileExplored { // 0x90A852
uint16 x_offset;
uint16 y_offset;
} MarkMapTileExplored;
enum SamusCode { // 0x90F084
kSamusCode_0_LockSamus = 0x0,
kSamusCode_1_UnlockSamus = 0x1,
kSamusCode_2_ReachCeresElevator = 0x2,
kSamusCode_3_UnspinSamus = 0x3,
kSamusCode_4_EndChargeBeam = 0x4,
kSamusCode_5_SetupDrained = 0x5,
kSamusCode_6_LockToStation = 0x6,
kSamusCode_7_SetupForElevator = 0x7,
kSamusCode_8_SetupForCeresStart = 0x8,
kSamusCode_9_SetupForZebesStart = 0x9,
kSamusCode_10_ClearDrawHandler = 0xA,
kSamusCode_11_DrawHandlerDefault = 0xB,
kSamusCode_12_UnlockFromMapStation = 0xC,
kSamusCode_13_IsGrappleActive = 0xD,
kSamusCode_14_UnlockFromCeresElevator = 0xE,
kSamusCode_15_EnableTimerHandling = 0xF,
kSamusCode_16_UnlockSamusFromReserveTank = 0x10,
kSamusCode_17_SetupForDeath = 0x11,
kSamusCode_18_EnableBlueFlashing = 0x12,
kSamusCode_19_DisableBlueFlashing = 0x13,
kSamusCode_20_QueueSfx = 0x14,
kSamusCode_21_LockToSuitAcquisition = 0x15,
kSamusCode_22_EnableRainbowSamus = 0x16,
kSamusCode_23_DisableRainbowSamusAndStandUp = 0x17,
kSamusCode_24_SetupDrainedAndDisableStandUp = 0x18,
kSamusCode_25_FreezeDrainedSamus = 0x19,
kSamusCode_26_EnterGunship = 0x1A,
kSamusCode_27_LockForReserveTank = 0x1B,
kSamusCode_28_PlaySpinSfxIfSpinJumping = 0x1C,
kSamusCode_29_ClearSoundInDoor = 0x1D,
kSamusCode_30_ResumeSfxAfterPowerBombExplosion = 0x1E,
kSamusCode_31_KillGrappleBeam = 0x1F,
};
/* 31 */
typedef struct SamusSpeedTableEntry { // 0x909F55
uint16 accel;
@ -2254,6 +2348,104 @@ typedef struct SamusSpeedTableEntry { // 0x909F55
uint16 decel_sub;
} SamusSpeedTableEntry;
typedef struct MarkMapTileExplored { // 0x90A852
uint16 room_pixel_x_offset;
uint16 room_pixel_y_offset;
} MarkMapTileExplored;
/* 33 */
typedef struct DisableMinimapAndMarkBossRoomAsExploredEnt { // 0x90A83A
uint16 boss_id_;
const MarkMapTileExplored* ptrs;
} DisableMinimapAndMarkBossRoomAsExploredEnt;
typedef struct ProjectileTrailInstr {
union {
uint16 func_ptr;
uint16 timer;
};
uint16 tile_num_attributes;
} ProjectileTrailInstr;
typedef union ProjectileOriginOffsetDirection { // 0x90C1A8
uint16 dir[13];
struct {
uint16 up_face_right;
uint16 up_right;
uint16 right;
uint16 down_right;
uint16 down_face_right;
uint16 down_face_left;
uint16 down_left;
uint16 left;
uint16 up_left;
uint16 up_face_left;
uint16 turn_aim_upward;
uint16 turn_aim_neutral;
uint16 turn_aim_downward;
};
} ProjectileOriginOffsetDirection;
typedef struct BeamSpeed { // 0x90C2D1
uint16 horiz_vert_speed;
uint16 diag_speed;
} BeamSpeed;
typedef struct MissileAcceleration { // 0x90C303
uint16 x_accel;
uint16 y_accel;
} MissileAcceleration;
typedef union ArmCannonDrawingData { // 0x90C7DF
struct {
uint8 direction;
uint8 draw_mode;
};
struct {
uint8 frame_zero_direction;
uint8 frame_zero_draw_mode;
};
struct {
int8 x_offset;
int8 y_offset;
};
} ArmCannonDrawingData;
enum SamusCode { // 0x90F084
kSamusCode_0_LockSamus = 0x0,
kSamusCode_1_UnlockSamus = 0x1,
kSamusCode_2_ReachCeresElevator = 0x2,
kSamusCode_3_UnspinSamus = 0x3,
kSamusCode_4_EndChargeBeam = 0x4,
kSamusCode_5_SetupDrained_AbleToStand = 0x5,
kSamusCode_6_LockToStation = 0x6,
kSamusCode_7_SetupForElevator = 0x7,
kSamusCode_8_SetupForCeresStart = 0x8,
kSamusCode_9_SetupForZebesStart = 0x9,
kSamusCode_10_ClearDrawHandler = 0xA,
kSamusCode_11_UnlockFromFacingForward = 0xB,
kSamusCode_12_UpdateDueToUnpause = 0xC,
kSamusCode_13_IsGrappleActive = 0xD,
kSamusCode_14_UnlockFromCeresElevator = 0xE,
kSamusCode_15_EnableTimerHandling = 0xF,
kSamusCode_16_UnlockFromReserveTank = 0x10,
kSamusCode_17_SetupForDeath = 0x11,
kSamusCode_18_EnableBlueFlashing = 0x12,
kSamusCode_19_DisableBlueFlashing = 0x13,
kSamusCode_20_QueueSfx = 0x14,
kSamusCode_21_LockToSuitAcquisition = 0x15,
kSamusCode_22_EnableRainbowSamus = 0x16,
kSamusCode_23_DisableRainbowSamusAndStandUp = 0x17,
kSamusCode_24_SetupDrained_UnableToStand = 0x18,
kSamusCode_25_FreezeDrainedSamus = 0x19,
kSamusCode_26_EnterGunship = 0x1A,
kSamusCode_27_LockForReserveTank = 0x1B,
kSamusCode_28_PlaySpinSfxIfSpinJumping = 0x1C,
kSamusCode_29_ClearSoundInDoor = 0x1D,
kSamusCode_30_ResumeSfxAfterPowerBombExplosion = 0x1E,
kSamusCode_31_KillGrappleBeam = 0x1F,
};
/* 36 */
typedef struct DemoInputObject { // 0x910000
VoidP ptr;
@ -2293,17 +2485,17 @@ typedef struct PoseEntry { // 0x919EE2
uint16 new_pose;
} PoseEntry;
/* 30 */
typedef struct SamusPoseParams { // 0x91B629
uint8 pose_x_dir;
uint8 movement_type;
uint8 new_pose_unless_buttons;
uint8 direction_shots_fired;
uint8 y_offset_to_gfx;
uint8 UNUSED_field_5;
uint8 y_radius;
uint8 UNUSED_field_7;
} SamusPoseParams;
///* 30 */
//typedef struct SamusPoseParams { // 0x91B629
// uint8 pose_x_dir;
// uint8 movement_type;
// uint8 new_pose_unless_buttons;
// uint8 direction_shots_fired;
// uint8 y_offset_proj_origin_to_gfx;
// uint8 UNUSED_field_5;
// uint8 y_radius;
// uint8 UNUSED_field_7;
//} SamusPoseParams;
/* 40 */
typedef struct XrayBlockData { // 0x91D2D6
@ -2344,16 +2536,16 @@ typedef struct ProjectileDataTable { // 0x938431
union {
uint16 instr_ptrs[10];
struct {
uint16 up_to_right;
uint16 up_face_right;
uint16 up_right;
uint16 right;
uint16 down_right;
uint16 down_to_right;
uint16 down_to_left;
uint16 down_face_right;
uint16 down_face_left;
uint16 down_left;
uint16 left;
uint16 up_left;
uint16 up_to_left;
uint16 up_face_left;
};
};
} ProjectileDataTable;
@ -2903,16 +3095,22 @@ enum Consts_60 {
addr_kVram_2ndScreenOffset = 0x53E0,
addr_kVram_2ndScreen = 0x5400,
addr_kVram_Bg3Tilemap = 0x5800,
// BG3 Tilemaps {
//BG3 Tilemaps {
addr_kVram_HudTopRow = 0x5800,
addr_kVram_Hud = 0x5820,
addr_kVram_FxBackup = 0x5880,
addr_kVram_LargeMessageBox = 0x59A0,
addr_kVram_SmallMessageBox = 0x59C0,
addr_kVram_Fx = 0x5BE0,
// }
//}
//Sprite Tiles {
addr_kVram_SamusTopGfx_Part1 = 0x6000,
addr_kVram_SamusBottomGfx_Part1 = 0x6080,
addr_kVram_SamusTopGfx_Part2 = 0x6100,
addr_kVram_SamusBottomGfx_Part2 = 0x6180,
addr_kVram_UnclosedArmCannon = 0x61F0,
addr_kVram_Beam = 0x6300,
//}
};
enum Consts_80 {
//addr_kHudTilemaps_AutoReserve = 0x998B,
@ -2960,7 +3158,6 @@ enum Consts_81 {
addr_kAreaSelectBackgroundTilemaps = 0xBF1A,
};
enum Consts_82 {
addr_kPauseMenuMapData = 0x9717,
addr_kLeftMapScrollArrowData = 0xB9A0,
addr_kRightMapScrollArrowData = 0xB9AA,
addr_kUpMapScrollArrowData = 0xB9B4,
@ -3868,7 +4065,6 @@ enum Consts_8F {
addr_kDoorClosingPlmIds = 0xE68A,
};
enum Consts_90 {
//addr_loc_908029 = 0x8029,
addr_kSamusSpeedTable_DuringDiagonalBombJump = 0x9F25,
addr_kSamusSpeedTable_GrappleDisconnect_Air = 0x9F31,
addr_kSamusSpeedTable_GrappleDisconnect_Water = 0x9F3D,
@ -3876,8 +4072,11 @@ enum Consts_90 {
addr_kSamusSpeedTable_Normal_X = 0x9F55,
addr_kSamusSpeedTable_Water_X = 0xA08D,
addr_kSamusSpeedTable_LavaAcid_X = 0xA1DD,
addr_kMissileAccelerations = 0xC303,
addr_kSuperMissileAccelerations = 0xC32B,
addr_kProjectileTrail_IList_Empty = 0xB4C9,
addr_kProjectileTrail_IList_IceBeams_ChargedPowerBeam_Left = 0xB4CB,
addr_kProjectileTrail_IList_SomeIceBeams_Right = 0xB52D,
addr_kProjectileTrail_IList_WaveBeam = 0xB58F,
addr_kProjectileTrail_IList_AnyMissile = 0xB5A1,
};
enum Consts_91 {
addr_kDemoPreInstr_Empty = 0x8447,
@ -4614,6 +4813,9 @@ enum Consts_AA {
addr_kTorizo_Ilist_D203 = 0xD203,
addr_kTorizo_Ilist_D2AD = 0xD2AD,
addr_kTorizo_Ilist_D2BF = 0xD2BF,
addr_kTourianEntranceStatue_Ilist_Ridley = 0xD7A5,
addr_kTourianEntranceStatue_Ilist_Phantoon = 0xD7AF,
addr_kTourianEntranceStatue_Ilist_BaseDecoration = 0xD7B9,
addr_kShaktool_Ilist_E3A7 = 0xE3A7,
addr_kShaktool_Ilist_E461 = 0xE461,
};
@ -4729,11 +4931,12 @@ struct PlmHeader_Size4; static inline PlmHeader_Size4 *get_PlmHeader_Size4(uint1
struct PlmHeader_Size6; static inline PlmHeader_Size6 *get_PlmHeader_Size6(uint16 a) { return (PlmHeader_Size6 *)RomPtr(0x840000 | a); }
//struct RoomDefStateSelect; static inline RoomDefStateSelect *get_RoomDefStateSelect(uint16 a) { return (RoomDefStateSelect *)RomPtr(0x8F0000 | a); }
extern RoomDefStateSelect get_RoomDefStateSelect(uint16 a);
struct SamusSpeedTableEntry; static inline SamusSpeedTableEntry *get_SamusSpeedTableEntry(uint16 a) { return (SamusSpeedTableEntry *)RomPtr(0x900000 | a); }
//struct SamusSpeedTableEntry; static inline SamusSpeedTableEntry *get_SamusSpeedTableEntry(uint16 a) { return (SamusSpeedTableEntry *)RomPtr(0x900000 | a); }
struct SamusTileAnimationDefs; static inline SamusTileAnimationDefs *get_SamusTileAnimationDefs(uint16 a) { return (SamusTileAnimationDefs *)RomPtr(0x920000 | a); }
struct PalFxDef; static inline PalFxDef *get_PalFxDef(uint16 a) { return (PalFxDef *)RomPtr(0x8D0000 | a); }
//struct Mode7ObjectDef; static inline Mode7ObjectDef *get_Mode7ObjectDef(uint16 a) { return (Mode7ObjectDef *)RomPtr(0x8B0000 | a); }
static inline Ram7800_Default *gRam7800_Default(uint16 a) { return (Ram7800_Default *)&g_ram[0x7800 + a]; }
//static inline Mode7CgvmWriteQueue *get_Mode7CgvmWriteQueue_RAM(uint16 a) { return (Mode7CgvmWriteQueue *)RomPtr_RAM(a); }
extern const uint8* get_AnimationDelayData(uint16 pose);
#pragma pack(pop)

View File

@ -239,7 +239,7 @@ CoroutineRet Vector_RESET_Async(void) { // 0x80841C
reg_MEMSEL = 1;
// Removed code to wait 4 frames
uint16 bak = bug_fix_counter;
memset(g_ram, 0, 8192);
memset(g_ram, 0, 0x2000);
bug_fix_counter = bak;
COROUTINE_AWAIT(2, InitializeIoDisplayLogo_Async());
@ -277,7 +277,8 @@ CoroutineRet Vector_RESET_Async(void) { // 0x80841C
reg_OAMaddr_UNUSED = 0;
ClearOamExt();
ClearUnusedOam();
nmi_copy_samus_halves = 0;
nmi_copy_samus_top_half_ready_flag = 0;
nmi_copy_samus_bottom_half_ready_flag = 0;
nmi_copy_samus_top_half_src = 0;
nmi_copy_samus_bottom_half_src = 0;
EnableNMI();
@ -626,9 +627,8 @@ void NMI_ProcessVramWriteQueue(void) { // 0x808C83
gVramWriteEntry(vram_write_queue_tail)->size = 0;
WriteReg(DMAP1, DMA_CONTROL(0, 0, 0, 0, 1));
WriteReg(BBAD1, REG(VMDATAL));
//WriteRegWord(DMAP1, 0x1801);
for (int i = 0; ; i += sizeof(VramWriteEntry)) {
VramWriteEntry *vram_entry = gVramWriteEntry(i);
for (int vram_write_queue_idx = 0; ; vram_write_queue_idx += sizeof(VramWriteEntry)) {
VramWriteEntry *vram_entry = gVramWriteEntry(vram_write_queue_idx);
if (vram_entry->size == 0)
break;
WriteRegWord(DAS1L, vram_entry->size);
@ -1191,38 +1191,46 @@ void NmiUpdatePalettesAndOam(void) { // 0x80933A
}
/**
* @brief Transfer Samus tiles from RAM to VRAM
* @brief Transfer Samus tiles from ROM to VRAM
*/
void NmiTransferSamusToVram(void) { // 0x809376
WriteReg(VMAIN, 0x80);
if (nmi_copy_samus_top_half_ready_flag) {
SamusTileAnimationTileDefs *td = (SamusTileAnimationTileDefs *)RomPtr_92(nmi_copy_samus_top_half_src);
WriteRegWord(VMADDL, 0x6000);
// Set up transfer for Samus top graphics part 1 from ROM to VRAM
// CopyToVram(addr_kVram_SamusTopGfx_Part1, td->src, td->part1_size, 1)
WriteRegWord(VMADDL, addr_kVram_SamusTopGfx_Part1);
WriteReg(DMAP1, DMA_CONTROL(0, 0, 0, 0, 1));
WriteReg(BBAD1, REG(VMDATAL));
WriteRegWord(A1T1L, td->src.addr);
WriteReg(A1B1, td->src.bank);
WriteRegWord(DAS1L, td->part1_size);
WriteReg(MDMAEN, 2);
WriteRegWord(VMADDL, 0x6100);
// Set up transfer for Samus top graphics part 2 from ROM to VRAM
// CopyToVram(addr_kVram_SamusTopGfx_Part2, td->src, td->part2_size, 1)
WriteRegWord(VMADDL, addr_kVram_SamusTopGfx_Part2);
WriteRegWord(A1T1L, td->src.addr + td->part1_size);
if (td->part2_size) {
if (td->part2_size != 0) {
WriteRegWord(DAS1L, td->part2_size);
WriteReg(MDMAEN, 2);
}
}
if (nmi_copy_samus_bottom_half_ready_flag) {
SamusTileAnimationTileDefs *td = (SamusTileAnimationTileDefs *)RomPtr_92(nmi_copy_samus_bottom_half_src);
WriteRegWord(VMADDL, 0x6080);
// Set up transfer for Samus bottom graphics part 1 from ROM to VRAM
// CopyToVram(addr_kVram_SamusBottomGfx_Part1, td->src, td->part1_size, 1)
WriteRegWord(VMADDL, addr_kVram_SamusBottomGfx_Part1);
WriteReg(DMAP1, DMA_CONTROL(0, 0, 0, 0, 1));
WriteReg(BBAD1, REG(VMDATAL));
WriteRegWord(A1T1L, td->src.addr);
WriteReg(A1B1, td->src.bank);
WriteRegWord(DAS1L, td->part1_size);
WriteReg(MDMAEN, 2);
WriteRegWord(VMADDL, 0x6180);
// Set up transfer for Samus bottom graphics part 2 from ROM to VRAM
// CopyToVram(addr_kVram_SamusBottomGfx_Part1, td->src, td->part2_size, 1)
WriteRegWord(VMADDL, addr_kVram_SamusBottomGfx_Part2);
WriteRegWord(A1T1L, td->src.addr + td->part1_size);
if (td->part2_size) {
if (td->part2_size != 0) {
WriteRegWord(DAS1L, td->part2_size);
WriteReg(MDMAEN, 2);
}
@ -1621,7 +1629,7 @@ void Vector_IRQ(void) {
* @brief Writes the top and bottom row of the HUD missile icon to RAM if the tilemap is blank
*/
void AddMissilesToHudTilemap(void) { // 0x8099CF
if ((hud_tilemap.row1.missiles[0] & 0x3FF) == 15) {
if ((hud_tilemap.row1.missiles[0] & 0x3FF) == 0xF) {
uint16 row_size = sizeof(hud_tilemap.row1.missiles);
MemCpy(hud_tilemap.row1.missiles, kHudTilemaps_Missiles, row_size);
MemCpy(hud_tilemap.row2.missiles, kHudTilemaps_Missiles + (row_size >> 1), row_size);
@ -1667,7 +1675,7 @@ void AddXrayToHudTilemap(void) { // 0x809A3E
*/
void AddToTilemapInner(uint16 hud_tilemap_offset, const uint16 *tilemap_src) { // 0x809A4C
int offset = hud_tilemap_offset >> 1;
if ((hud_tilemap.arr[offset] & 0x3FF) == 15) {
if ((hud_tilemap.arr[offset] & 0x3FF) == 0xF) {
MemCpy(hud_tilemap.row1.arr + offset, &tilemap_src[0], 2*2);
MemCpy(hud_tilemap.row2.arr + offset, &tilemap_src[2], 2*2);
}
@ -2357,9 +2365,11 @@ void HandleAutoscrolling_X(void) { // 0x80A528
if (!time_is_frozen_flag) {
uint16 layer1_x_pos_backup = layer1_x_pos;
layer1_x_pos = IntMax(layer1_x_pos, 0);
if ((int16)layer1_x_pos < 0)
layer1_x_pos = 0;
uint16 room_pixel_width = swap16(room_width_in_scrolls - 1);
layer1_x_pos = IntMin(layer1_x_pos, room_pixel_width);
if (room_pixel_width < layer1_x_pos)
layer1_x_pos = room_pixel_width;
uint16 nearest_half_scroll_vertically = (uint16)(layer1_y_pos + 0x80) >> 8;
half_scroll_pos_on_screen = Mult8x8(nearest_half_scroll_vertically, room_width_in_scrolls);
@ -2477,10 +2487,12 @@ void HandleAutoscrolling_Y(void) { // 0x80A731
next_scroll_offset = 31;
uint16 layer1_y_pos_backup = layer1_y_pos;
layer1_y_pos = IntMax(layer1_y_pos, 0);
uint16 room_pixel_height = swap16(room_height_in_scrolls - 1);
if ((int16)layer1_y_pos < 0)
layer1_y_pos = 0;
int16 room_pixel_height = swap16(room_height_in_scrolls - 1);
uint16 scroll_pos = next_scroll_offset + room_pixel_height;
layer1_y_pos = IntMin(layer1_y_pos, scroll_pos);
if (scroll_pos < layer1_y_pos)
layer1_y_pos = scroll_pos;
nearest_top_scroll_bound = HIBYTE(layer1_y_pos);
nearest_half_scroll_horizontally = (uint16)(layer1_x_pos + 0x80) >> 8;
@ -2505,10 +2517,9 @@ void HandleAutoscrolling_Y(void) { // 0x80A731
new_layer1_y_pos = next_scroll_downwards & 0xFF00;
}
layer1_y_pos = new_layer1_y_pos;
return;
}
if (scrolls[(uint16)(room_width_in_scrolls + half_scroll_index)] == kScroll_Red) {
else if (scrolls[(uint16)(room_width_in_scrolls + half_scroll_index)] == kScroll_Red) {
uint16 top_scroll_bound_pos = next_scroll_offset + (layer1_y_pos & 0xFF00);
if (top_scroll_bound_pos < layer1_y_pos) {
uint16 next_scroll_upwards = layer1_y_pos_backup - camera_y_speed - 2;
@ -2517,18 +2528,16 @@ void HandleAutoscrolling_Y(void) { // 0x80A731
new_layer1_y_pos = top_scroll_bound_pos;
}
else {
layer1_y_pos_backup = next_scroll_upwards;
nearest_half_scroll_horizontally = (uint16)(layer1_x_pos + 0x80) >> 8;
nearest_top_scroll_bound = HIBYTE(next_scroll_upwards);
half_scroll_pos_on_screen = Mult8x8(nearest_top_scroll_bound, room_width_in_scrolls);
half_scroll_index = half_scroll_pos_on_screen + nearest_half_scroll_horizontally;
if (scrolls[half_scroll_index] != kScroll_Red)
new_layer1_y_pos = layer1_y_pos_backup;
new_layer1_y_pos = next_scroll_upwards;
else
new_layer1_y_pos = (layer1_y_pos_backup & 0xFF00) + 0x100;
new_layer1_y_pos = (next_scroll_upwards & 0xFF00) + 0x100;
}
layer1_y_pos = new_layer1_y_pos;
return;
}
}
}
@ -3289,7 +3298,7 @@ void LoadFromLoadStation(void) { // 0x80C437
reg_BG1HOFS = 0;
reg_BG1VOFS = 0;
area_index = get_RoomDefHeader(room_ptr).area_index_;
debug_disable_minimap = 0;
disable_minimap = 0;
}
/**

View File

@ -2446,13 +2446,13 @@ void NewSaveFile(void) { // 0x81B2CB
button_config_down = kButton_Down;
button_config_left = kButton_Left;
button_config_right = kButton_Right;
button_config_jump_a = kButton_A;
button_config_run_b = kButton_B;
button_config_shoot_x = kButton_X;
button_config_itemcancel_y = kButton_Y;
button_config_jump = kButton_A;
button_config_run = kButton_B;
button_config_shoot = kButton_X;
button_config_itemcancel = kButton_Y;
button_config_itemswitch = kButton_Select;
button_config_aim_up_R = kButton_R;
button_config_aim_down_L = kButton_L;
button_config_aim_up = kButton_R;
button_config_aim_down = kButton_L;
game_time_frames = 0;
game_time_seconds = 0;
game_time_minutes = 0;

View File

@ -540,7 +540,7 @@ void LoadDemoRoomData(void) { // 0x828679
samus_reserve_health = 0;
reserve_health_mode = kReserveHealthMode_0_None;
loading_game_state = kLoadingGameState_0_Intro;
debug_disable_minimap = 0;
disable_minimap = 0;
}
void DemoRoom_ChargeBeamRoomScroll21(void) { // 0x82891A
@ -632,7 +632,9 @@ CoroutineRet RunOneFrameOfGameInner(void) {
NextRandom();
ClearOamExt();
oam_next_ptr = 0;
nmi_copy_samus_halves = 0;
//nmi_copy_samus_halves = 0;
nmi_copy_samus_top_half_ready_flag = 0;
nmi_copy_samus_bottom_half_ready_flag = 0;
nmi_copy_samus_top_half_src = 0;
nmi_copy_samus_bottom_half_src = 0;
@ -1508,22 +1510,23 @@ void LoadPauseMenuMapTilemapAndAreaLabel(void) { // 0x8293C3
WriteReg(BBAD1, REG(VMDATAL));
WriteReg(DAS1L, 0x18);
WriteReg(DAS1H, 0);
uint16 v0 = area_index;
uint16 area_idx = area_index;
if (area_index >= kArea_7_Debug)
v0 = kArea_0_Crateria;
WriteRegWord(A1T1L, kPauseAreaLabelTilemap[v0]);
area_idx = kArea_0_Crateria;
WriteRegWord(A1T1L, kPauseAreaLabelTilemap[area_idx]);
WriteReg(A1B1, 0x82);
WriteReg(MDMAEN, 2);
}
void LoadPauseMenuMapTilemap(void) { // 0x82943D
uint16 v0 = area_index;
uint16 area_idx = area_index;
if (area_index >= kArea_7_Debug)
v0 = kArea_0_Crateria;
const uint16 *r0 = (const uint16 *)RomPtr(Load24(&kPauseMenuMapTilemaps[v0]));
area_idx = kArea_0_Crateria;
const uint16 *r0 = (const uint16 *)RomPtr(Load24(&kPauseMenuMapTilemaps[area_idx]));
uint16 *r3 = (uint16 *)&ram4000;
const uint16 *r6 = (const uint16 *)RomPtr_82(kPauseMenuMapData[v0]);
const uint16* r6 = (const uint16 *)kPauseMenuMapData[area_idx];
const uint16 *r9 = (const uint16 *)map_tiles_explored;
if (map_station_byte_array[area_index]) {
uint16 r38 = swap16(*r6++);
uint16 r40 = swap16(*r9++);
@ -1536,7 +1539,8 @@ void LoadPauseMenuMapTilemap(void) { // 0x82943D
if (v11) {
v10 &= ~0x400;
r38 *= 2;
} else {
}
else {
v11 = r38 >> 15;
r38 *= 2;
if (!v11)
@ -1550,7 +1554,8 @@ void LoadPauseMenuMapTilemap(void) { // 0x82943D
}
v8 += 2;
} while ((int16)(v8 - 4096) < 0);
} else {
}
else {
uint16 v1 = 0;
uint16 v2 = 0;
uint8 r18 = 0;
@ -1559,7 +1564,8 @@ void LoadPauseMenuMapTilemap(void) { // 0x82943D
map_tiles_explored[v2] <<= 1;
if (!(t & 0x80)) {
r3[v1 >> 1] = 0x1f;
} else {
}
else {
++map_tiles_explored[v2];
r3[v1 >> 1] = r0[v1 >> 1] & 0xFBFF;
}
@ -1577,13 +1583,13 @@ void DrawRoomSelectMap(void) { // 0x829517
reg_BG12NBA = 51;
reg_TM = 19;
reg_BG1VOFS = -40;
uint16 v0 = area_index;
uint16 area_idx = area_index;
if (area_index >= kArea_7_Debug)
v0 = kArea_0_Crateria;
area_idx = kArea_0_Crateria;
const uint16 *r0 = (const uint16 *)RomPtr(Load24(&kPauseMenuMapTilemaps[v0]));
const uint16 *r0 = (const uint16 *)RomPtr(Load24(&kPauseMenuMapTilemaps[area_idx]));
uint16 *r3 = (uint16 *)&ram3000;
const uint16 *r6 = (const uint16 *)RomPtr_82(kPauseMenuMapData[v0]);
const uint16* r6 = (const uint16 *)kPauseMenuMapData[area_idx];
const uint16 *r9 = (const uint16 *)map_tiles_explored;
if (map_station_byte_array[area_index]) {
@ -1612,7 +1618,8 @@ void DrawRoomSelectMap(void) { // 0x829517
}
v9 += 2;
} while ((int16)(v9 - 4096) < 0);
} else {
}
else {
uint16 v1 = 0;
uint16 v2 = 0;
uint8 r18 = 0;
@ -1621,7 +1628,8 @@ void DrawRoomSelectMap(void) { // 0x829517
map_tiles_explored[v2] <<= 1;
if (!(what & 0x80)) {
r3[v1 >> 1] = 0xf;
} else {
}
else {
++map_tiles_explored[v2];
r3[v1 >> 1] = r0[v1 >> 1] & ~0x400;
}
@ -1634,13 +1642,13 @@ void DrawRoomSelectMap(void) { // 0x829517
}
}
}
uint16 v16 = vram_write_queue_tail;
VramWriteEntry *v17 = gVramWriteEntry(vram_write_queue_tail);
v17->size = 4096;
v17->src.addr = ADDR16_OF_RAM(ram3000);
v17->src.bank = 126;
v17->vram_dst = (reg_BG1SC & 0xFC) << 8;
vram_write_queue_tail = v16 + 7;
VramWriteEntry *vram_entry = gVramWriteEntry(vram_write_queue_tail);
vram_entry->size = 0x1000;
vram_entry->src.addr = ADDR16_OF_RAM(ram3000);
vram_entry->src.bank = 0x7E;
vram_entry->vram_dst = (reg_BG1SC & 0xFC) << 8;
vram_write_queue_tail += sizeof(VramWriteEntry);
}
void DrawRoomSelectMapAreaLabel(uint16 *dst) { // 0x829628
@ -1757,18 +1765,19 @@ static uint16 DetermineBottommostMapColumn(const uint8 *r0) { // 0x82A053
}
void DetermineMapScrollLimits(void) { // 0x829EC4
const uint8 *r6;
const uint8 *map_data;
if (has_area_map) {
r6 = RomPtr_82(GET_WORD(RomPtr_82(addr_kPauseMenuMapData + 2 * area_index)));
} else {
r6 = map_tiles_explored;
map_data = kPauseMenuMapData[area_index];
}
map_min_x_scroll = DetermineLeftmostMapColumn(r6) * 8;
else {
map_data = map_tiles_explored;
}
map_min_x_scroll = DetermineLeftmostMapColumn(map_data) * 8;
if (area_index == kArea_4_Maridia)
map_min_x_scroll -= 24;
map_max_x_scroll = DetermineRightmostMapColumn(r6 + 131) * 8;
map_min_y_scroll = DetermineTopmostMapColumn(r6) * 8;
map_max_y_scroll = DetermineBottommostMapColumn(r6 + 124) * 8;
map_max_x_scroll = DetermineRightmostMapColumn(map_data + 131) * 8;
map_min_y_scroll = DetermineTopmostMapColumn(map_data) * 8;
map_max_y_scroll = DetermineBottommostMapColumn(map_data + 124) * 8;
}
void SetupPpuForPauseMenu(void) { // 0x82A09A
@ -1892,7 +1901,7 @@ void ContinueInitGameplayResume(void) { // 0x82A2E3
CalculateBgScrolls_Unpause();
UpdateBeamTilesAndPalette_Unpause();
ClearPauseMenuData();
RunSamusCode(kSamusCode_12_UnlockFromMapStation);
RunSamusCode(kSamusCode_12_UpdateDueToUnpause);
}
void SetupPpuForGameplayResume(void) { // 0x82A313
@ -2541,27 +2550,32 @@ void EquipmentScreenCategory_Tanks_0(void) {
}
}
/**
* @brief This function does not work correctly in the original game as it loads garbage to the HUD tilemap.
* It's overwritten by HandleHudTilemap(), thus this function is harmless
*/
void EquipmentScreenHudReserveAutoTilemap_On_BUGGY(void) { // 0x82AEFD
// loads garbage...
uint16 v0 = 0x998B;
if (!samus_reserve_health)
v0 = 0x9997;
const uint16 *v1 = (const uint16 *)RomPtr_82(v0);
hud_tilemap.row1.auto_reserve[0] = v1[0];
hud_tilemap.row1.auto_reserve[1] = v1[1];
hud_tilemap.row2.auto_reserve[0] = v1[2];
hud_tilemap.row2.auto_reserve[1] = v1[3];
hud_tilemap.row3.auto_reserve[0] = v1[4];
hud_tilemap.row3.auto_reserve[1] = v1[5];
//// loads garbage...
//uint16 v0 = 0x998B;
//if (!samus_reserve_health)
// v0 = 0x9997;
//const uint16 *v1 = (const uint16 *)RomPtr_82(v0);
//hud_tilemap.row1.auto_reserve[0] = v1[0];
//hud_tilemap.row1.auto_reserve[1] = v1[1];
//hud_tilemap.row2.auto_reserve[0] = v1[2];
//hud_tilemap.row2.auto_reserve[1] = v1[3];
//hud_tilemap.row3.auto_reserve[0] = v1[4];
//hud_tilemap.row3.auto_reserve[1] = v1[5];
}
void EquipmentScreenHudReserveAutoTilemap_Off(void) { // 0x82AF33
hud_tilemap.row1.auto_reserve[0] = 0x2C0F;
hud_tilemap.row1.auto_reserve[1] = 0x2C0F;
hud_tilemap.row2.auto_reserve[0] = 0x2C0F;
hud_tilemap.row2.auto_reserve[1] = 0x2C0F;
hud_tilemap.row3.auto_reserve[0] = 0x2C0F;
hud_tilemap.row3.auto_reserve[1] = 0x2C0F;
uint16 blank_tile = 0x2C0F;
hud_tilemap.row1.auto_reserve[0] = blank_tile;
hud_tilemap.row1.auto_reserve[1] = blank_tile;
hud_tilemap.row2.auto_reserve[0] = blank_tile;
hud_tilemap.row2.auto_reserve[1] = blank_tile;
hud_tilemap.row3.auto_reserve[0] = blank_tile;
hud_tilemap.row3.auto_reserve[1] = blank_tile;
}
static const uint16 kReserveTankEnergyTransferPerFrame = 1;
@ -3264,7 +3278,7 @@ void CancelSoundEffects(void) { // 0x82BE17
}
void QueueSamusMovementSfx(void) { // 0x82BE2F
if ((speed_boost_counter & 0xFF00) == 1024)
if (speed_boost_counter == SPEED_BOOST_THRESHOLD)
QueueSfx3_Max6(kSfx3_ResumeSpeedBooster_Shinespark);
if (!sign16(flare_counter - 16))
QueueSfx1_Max6(kSfx1_ResumeChargingBeam);
@ -3331,21 +3345,52 @@ uint8 AdvancePaletteFadeForAllPalettes(void) { // 0x82DA02
}
}
uint16 CalculateNthTransitionColorFromXtoY(uint16 a, uint16 k, uint16 j) { // 0x82DA4A
return CalculateNthTransitionColorComponentFromXtoY(a, k & 0x1F, j & 0x1F) |
CalculateNthTransitionColorComponentFromXtoY(a, (k >> 5) & 0x1F, (j >> 5) & 0x1F) << 5 |
CalculateNthTransitionColorComponentFromXtoY(a, (k >> 10) & 0x1F, (j >> 10) & 0x1F) << 10;
/**
* @brief Calculate the numerator-th transition color from the source to the destination palette
* @param pal_change_numer The palette change numerator
* @param src_pal The color from the source palette
* @param dst_pal The color from the destination palette
* @return uint16 The numerator-th transition color
*/
uint16 CalculateNthTransitionColorFromXtoY(uint16 pal_change_numer, uint16 src_pal, uint16 dst_pal) { // 0x82DA4A
uint16 src_color_red = src_pal & 0x1F;
uint16 dst_color_red = dst_pal & 0x1F;
uint16 src_color_green = (src_pal >> 5) & 0x1F;
uint16 dst_color_green = (dst_pal >> 5) & 0x1F;
uint16 src_color_blue = (src_pal >> 10) & 0x1F;
uint16 dst_color_blue = (dst_pal >> 10) & 0x1F;
uint16 trans_color_red = CalculateNthTransitionColorComponentFromXtoY(pal_change_numer, src_color_red, dst_color_red);
uint16 trans_color_green = CalculateNthTransitionColorComponentFromXtoY(pal_change_numer, src_color_green, dst_color_green) << 5;
uint16 trans_color_blue = CalculateNthTransitionColorComponentFromXtoY(pal_change_numer, src_color_blue, dst_color_blue) << 10;
uint16 transition_color = trans_color_red | trans_color_green | trans_color_blue;
return transition_color;
}
uint16 CalculateNthTransitionColorComponentFromXtoY(uint16 a, uint16 k, uint16 j) { // 0x82DAA6
if (!a)
return k;
uint16 v4 = a - 1;
if (v4 == palette_change_denom)
return j;
uint16 RegWord = SnesDivide(abs16(j - k) << 8, palette_change_denom - (v4 + 1) + 1);
uint16 r18 = sign16(j - k) ? -RegWord : RegWord;
return (uint16)(r18 + (k << 8)) >> 8;
/**
* @brief Calculate the color component of the numerator-th transitition color from the source to the destination palette
* @param pal_change_numer The palette change numerator
* @param src_pal_color The color component from the source palette
* @param dst_pal_color The color component from the destination palette
* @return uint16 The color component from the numerator-th transition color
*/
uint16 CalculateNthTransitionColorComponentFromXtoY(uint16 pal_change_numer, uint16 src_pal_color, uint16 dst_pal_color) { // 0x82DAA6
if (pal_change_numer == 0)
return src_pal_color;
if (pal_change_numer == (palette_change_denom + 1))
return dst_pal_color;
// For information about the math, see the "Color interpolation" section in math.md
// todo: The 0x100s should cancel, but it gives bad results
uint16 color_slope = (uint16)(0x100 * (dst_pal_color - src_pal_color) / (palette_change_denom + 1 - pal_change_numer)) / 0x100;
return (uint8)(src_pal_color + color_slope);
// Original code
//uint16 r18 = ((dst_pal_color - src_pal_color) << 8) / (palette_change_denom + 1 - pal_change_numer);
//return (uint16)(r18 + (src_pal_color << 8)) >> 8;
}
uint8 AdvancePaletteFadeForAllPalettesInA(uint16 a) { // 0x82DAF7
@ -3423,7 +3468,7 @@ CoroutineRet GameState_27_ReserveTanksAuto(void) { // 0x82DC10
if (coroutine_state_1 == 0 && RefillHealthFromReserveTanks()) {
time_is_frozen_flag = 0;
game_state = kGameState_8_MainGameplay;
RunSamusCode(kSamusCode_16_UnlockSamusFromReserveTank);
RunSamusCode(kSamusCode_16_UnlockFromReserveTank);
}
COROUTINE_AWAIT_ONLY(GameState_8_MainGameplay());
Samus_LowHealthCheck_0();
@ -3511,7 +3556,7 @@ CoroutineRet GameState_20_SamusNoHealth_BlackOut(void) { // 0x82DCE0
}
CoroutineRet GameState_21_SamusNoHealth(void) { // 0x82DD71
Samus_DrawWhenNotAnimatingOrDying();
Samus_DrawInanimateSamus();
if (!HasQueuedMusic()) {
StartSamusDeathAnimation();
++game_state;
@ -3587,9 +3632,7 @@ void LoadDoorHeader(void) { // 0x82DE12
}
void LoadRoomHeader(void) { // 0x82DE6F
RoomDefHeader RoomDefHeader;
RoomDefHeader = get_RoomDefHeader(room_ptr);
RoomDefHeader RoomDefHeader = get_RoomDefHeader(room_ptr);
room_index = RoomDefHeader.semiunique_room_number;
area_index = RoomDefHeader.area_index_;
room_x_coordinate_on_map = RoomDefHeader.x_coordinate_on_map;
@ -3602,8 +3645,7 @@ void LoadRoomHeader(void) { // 0x82DE6F
down_scroller = RoomDefHeader.down_scroller_;
door_list_pointer = RoomDefHeader.ptr_to_doorout;
HandleRoomDefStateSelect(room_ptr);
uint16 prod = Mult8x8(room_width_in_blocks, room_height_in_blocks);
room_size_in_blocks = 2 * prod;
room_size_in_blocks = 2 * Mult8x8(room_width_in_blocks, room_height_in_blocks);
}
void LoadStateHeader(void) { // 0x82DEF2
@ -3644,7 +3686,7 @@ void LoadMapExploredIfElevator(void) { // 0x82DFB6
void EnsureSamusDrawnEachFrame(void) { // 0x82DFC7
if (!elevator_properties)
Samus_DrawWhenNotAnimatingOrDying();
Samus_DrawInanimateSamus();
}
void LoadEnemyGfxToVram(void) { // 0x82DFD1
@ -3781,7 +3823,7 @@ CoroutineRet DoorTransitionFunction_Wait48frames(void) { // 0x82E19F
CoroutineRet GameState_10_LoadingNextRoom_Async(void) { // 0x82E1B7
door_transition_flag_enemies = 1;
door_transition_flag_elevator_zebetites = 1;
debug_disable_minimap = 0;
disable_minimap = 0;
save_station_lockout_flag = 0;
DetermineWhichEnemiesToProcess();
EnemyMain();
@ -4816,14 +4858,14 @@ void GameOptionsMenu_7_ControllerSettings(void) {
}
void OptionsMenuControllerFunc_ResetToDefault(void) { // 0x82F224
if ((joypad1_newkeys & (kButton_Start | kButton_A)) != 0) {
button_config_shoot_x = 64;
button_config_jump_a = 128;
button_config_run_b = 0x8000;
button_config_itemcancel_y = 0x4000;
button_config_itemswitch = 0x2000;
button_config_aim_up_R = 16;
button_config_aim_down_L = 32;
if (joypad1_newkeys & (kButton_Start | kButton_A)) {
button_config_shoot = kButton_X;
button_config_jump = kButton_A;
button_config_run = kButton_B;
button_config_itemcancel = kButton_Y;
button_config_itemswitch = kButton_Select;
button_config_aim_up = kButton_R;
button_config_aim_down = kButton_L;
LoadControllerOptionsFromControllerBindings();
OptionsMenuFunc6_DrawControllerBindings();
}

View File

@ -80,7 +80,486 @@ LongPtr kPauseMenuMapTilemaps[] = { 0x9000, 0xb5, 0x8000, 0xb5, 0xa000, 0xb5, 0x
//#define kPauseMenuMapData ((uint16*)RomFixedPtr(0x829717))
uint16 kPauseMenuMapData[] = { 0x9727, 0x9827, 0x9927, 0x9a27, 0x9b27, 0x9c27, 0x9d27, 0x9c27, };
//uint16 kPauseMenuMapData[] = { 0x9727, 0x9827, 0x9927, 0x9a27, 0x9b27, 0x9c27, 0x9d27, 0x9c27, };
const uint8 kPauseMenuMapData_Crateria[0x100] = { // 0x829727
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x7F,
0x00, 0x00, 0x00, 0x7F,
0x00, 0x00, 0x00, 0x7F,
0x00, 0x00, 0x00, 0x7F,
0x00, 0x01, 0xFF, 0xFF,
0x00, 0x07, 0x94, 0x00,
0x00, 0x1E, 0x37, 0xC0,
0x00, 0x10, 0xFF, 0x00,
0x03, 0xF0, 0x10, 0x00,
0x02, 0x00, 0x10, 0x00,
0x02, 0x00, 0x10, 0x00,
0x02, 0x00, 0x10, 0x00,
0x00, 0x00, 0x10, 0x00,
0x00, 0x00, 0x10, 0x00,
0x00, 0x00, 0x10, 0x00,
0x00, 0x00, 0x10, 0x00,
0x00, 0x00, 0x10, 0x00,
0x00, 0x00, 0x1F, 0x00,
0x00, 0x00, 0x01, 0x00,
0x00, 0x00, 0x01, 0x00,
0x00, 0x00, 0x01, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x03, 0xFC, 0x00, 0x00,
0x03, 0xFC, 0x00, 0x00,
0x03, 0xF0, 0x00, 0x00,
0x03, 0xF0, 0x00, 0x00,
0xFF, 0xFC, 0x7F, 0x80,
0x0D, 0xFC, 0x7F, 0x80,
0x00, 0x00, 0x00, 0x80,
0x20, 0x00, 0x00, 0x80,
0x20, 0x00, 0x07, 0x80,
0x20, 0x00, 0x0F, 0x80,
0x20, 0x00, 0x08, 0x00,
0x00, 0x00, 0x08, 0x00,
0x00, 0x00, 0x08, 0x00,
0x00, 0x00, 0x08, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
};
const uint8 kPauseMenuMapData_Brinstar[0x100] = { // 0x829827
0x00, 0x00, 0x00, 0x00,
0x00, 0x40, 0x00, 0x00,
0x00, 0x40, 0x02, 0x00,
0x00, 0x40, 0x02, 0x00,
0x00, 0x40, 0x02, 0x00,
0x07, 0xFD, 0xFE, 0x00,
0x00, 0xC0, 0x60, 0x00,
0x03, 0xFF, 0xE0, 0x00,
0x06, 0x00, 0x78, 0x20,
0x00, 0x00, 0x7C, 0x20,
0x00, 0x00, 0x60, 0x20,
0x00, 0x00, 0x7E, 0x7F,
0x00, 0x00, 0x1C, 0x0C,
0x00, 0x00, 0x07, 0x80,
0x00, 0xFE, 0x01, 0xFF,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x01, 0xFF,
0x00, 0x00, 0x00, 0x66,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x04, 0x00, 0x00, 0x00,
0x04, 0x00, 0x00, 0x00,
0x04, 0x00, 0x00, 0x00,
0x04, 0x00, 0x00, 0x00,
0x1C, 0x00, 0x00, 0x00,
0x06, 0x00, 0x00, 0x00,
0x7C, 0x00, 0x00, 0x00,
0xC0, 0x00, 0x00, 0x00,
0x50, 0x00, 0x00, 0x00,
0x40, 0x00, 0x00, 0x00,
0xC0, 0x00, 0x00, 0x00,
0x40, 0x00, 0x00, 0x00,
0xC0, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x02, 0x00, 0x00, 0x00,
0x3F, 0xFF, 0xC1, 0x80,
0x00, 0x79, 0xFF, 0xC0,
0x00, 0x40, 0x00, 0x00,
0x00, 0x40, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
};
const uint8 kPauseMenuMapData_Norfair[0x100] = { // 0x829927
0x00, 0x00, 0x00, 0x00,
0x00, 0x20, 0x00, 0x00,
0x1E, 0x20, 0x00, 0xFE,
0x1E, 0x20, 0x07, 0x8F,
0x1F, 0xFF, 0x87, 0x80,
0x3E, 0x7F, 0xFF, 0xFC,
0x20, 0xFF, 0xFF, 0xF8,
0x21, 0xBE, 0x1E, 0xFC,
0x3F, 0x1F, 0x13, 0x04,
0x03, 0xC1, 0x93, 0xFC,
0x00, 0xFF, 0xFF, 0xA0,
0x00, 0x7F, 0xF3, 0xE0,
0x00, 0x38, 0x01, 0xC0,
0x03, 0xE0, 0x01, 0x80,
0x03, 0xE0, 0x00, 0x00,
0x1E, 0x20, 0x00, 0x00,
0x1F, 0x3E, 0x00, 0x00,
0x1F, 0xA0, 0x01, 0x00,
0x0F, 0xF0, 0x01, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0xFC, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
};
const uint8 kPauseMenuMapData_WreckedShip[0x100] = { // 0x829A27
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x0F, 0xFC, 0x00,
0x00, 0x0F, 0x00, 0x00,
0x00, 0x3E, 0x00, 0x00,
0x00, 0x20, 0x80, 0x00,
0x00, 0x0F, 0xC4, 0x00,
0x00, 0x00, 0xFC, 0x00,
0x00, 0x00, 0x80, 0x00,
0x00, 0x01, 0x80, 0x00,
0x00, 0x00, 0x80, 0x00,
0x00, 0x07, 0xF0, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
};
const uint8 kPauseMenuMapData_Maridia[0x100] = { // 0x829B27
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x78,
0x00, 0x00, 0x00, 0x58,
0x00, 0x00, 0x01, 0xD8,
0x00, 0x00, 0x01, 0xC0,
0x00, 0x00, 0x3F, 0xC0,
0x00, 0x00, 0xFD, 0xFF,
0x00, 0x00, 0x31, 0xDF,
0x00, 0x02, 0x21, 0xFF,
0x00, 0x02, 0x2F, 0xBF,
0x00, 0x3F, 0xEF, 0xC0,
0x00, 0x3F, 0xCF, 0xFC,
0x00, 0x37, 0x9F, 0xC0,
0x00, 0x37, 0xB0, 0x00,
0x00, 0x37, 0xB0, 0x00,
0x00, 0x37, 0xB0, 0x00,
0x00, 0x3E, 0x70, 0x00,
0x00, 0x3F, 0xFF, 0xF0,
0x00, 0x1F, 0xC0, 0x00,
0x00, 0x7C, 0x00, 0x00,
0x00, 0x18, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x20, 0x00, 0x00, 0x00,
0x20, 0x00, 0x00, 0x00,
0x20, 0x00, 0x00, 0x00,
0x20, 0x00, 0x00, 0x00,
0x30, 0x00, 0x00, 0x00,
0xE0, 0x00, 0x00, 0x00,
0xFF, 0xE0, 0x00, 0x00,
0xFF, 0xE0, 0x00, 0x00,
0xFE, 0x00, 0x00, 0x00,
0x01, 0x80, 0x00, 0x00,
0x03, 0x80, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
};
const uint8 kPauseMenuMapData_Tourian_Debug[0x100] = { // 0x829C27
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x08, 0x00,
0x00, 0x00, 0x08, 0x00,
0x00, 0x00, 0x08, 0x00,
0x00, 0x00, 0x08, 0x00,
0x00, 0x07, 0xFC, 0x00,
0x00, 0x07, 0xF8, 0x00,
0x00, 0x00, 0x08, 0x00,
0x00, 0x0F, 0xF8, 0x00,
0x00, 0x1F, 0xC0, 0x00,
0x00, 0x00, 0xC0, 0x00,
0x00, 0x07, 0xC0, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
};
const uint8 kPauseMenuMapData_Ceres[0x100] = { // 0x829D27
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x08, 0x00, 0x00,
0x00, 0x08, 0x00, 0x00,
0x00, 0x08, 0x00, 0x00,
0x00, 0x08, 0x00, 0x00,
0x00, 0x08, 0x00, 0x00,
0x00, 0x0F, 0x00, 0x00,
0x00, 0x01, 0xF8, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
};
const uint8 *kPauseMenuMapData[8] = { // 0x829717
kPauseMenuMapData_Crateria,
kPauseMenuMapData_Brinstar,
kPauseMenuMapData_Norfair,
kPauseMenuMapData_WreckedShip,
kPauseMenuMapData_Maridia,
kPauseMenuMapData_Tourian_Debug,
kPauseMenuMapData_Ceres,
kPauseMenuMapData_Tourian_Debug,
};
//#define kEquipmentTilemaps_Tanks ((uint16*)RomFixedPtr(0x82c088))
//#define kEquipmentTilemaps_Weapons ((uint16*)RomFixedPtr(0x82c08c))

View File

@ -2269,6 +2269,7 @@ static const uint16 kInReact_QuicksandSurface_MaxVertVel[2] = { 0x280, 0x380 };
*/
uint8 PlmSetup_InsideReaction_QuicksandSurface(uint16 plm_idx) {
samus_has_momentum_flag = 0;
speed_boost_timer = 0;
speed_boost_counter = 0;
samus_echoes_sound_flag = 0;
samus_x_extra_run_subspeed = 0;
@ -3619,7 +3620,7 @@ uint8 PlmSetup_D028_D02C_Unused(uint16 plm_idx) { // 0x84CDC2
*/
uint8 PlmSetup_RespawningSpeedBoostBlock(uint16 plm_idx) { // 0x84CDEA
int idx = plm_idx >> 1;
if ((speed_boost_counter & 0xF00) == 0x400
if (speed_boost_counter == SPEED_BOOST_THRESHOLD
|| samus_pose == kPose_C9_FaceR_Shinespark_Horiz
|| samus_pose == kPose_CA_FaceL_Shinespark_Horiz
|| samus_pose == kPose_CB_FaceR_Shinespark_Vert
@ -3678,15 +3679,11 @@ uint8 PlmSetup_RespawningShotBlock(uint16 plm_idx) { // 0x84CE6B
* @return 1 if there was a collision, 0 if there was no collision
*/
uint8 PlmSetup_RespawningBombBlock(uint16 plm_idx) { // 0x84CE83
if ((speed_boost_counter & 0xF00) == 0x400
|| samus_pose == kPose_81_FaceR_Screwattack
|| samus_pose == kPose_82_FaceL_Screwattack
|| samus_pose == kPose_C9_FaceR_Shinespark_Horiz
|| samus_pose == kPose_CA_FaceL_Shinespark_Horiz
|| samus_pose == kPose_CB_FaceR_Shinespark_Vert
|| samus_pose == kPose_CC_FaceL_Shinespark_Vert
|| samus_pose == kPose_CD_FaceR_Shinespark_Diag
|| samus_pose == kPose_CE_FaceL_Shinespark_Diag) {
if (speed_boost_counter == SPEED_BOOST_THRESHOLD
|| samus_pose == kPose_81_FaceR_Screwattack || samus_pose == kPose_82_FaceL_Screwattack
|| samus_pose == kPose_C9_FaceR_Shinespark_Horiz || samus_pose == kPose_CA_FaceL_Shinespark_Horiz
|| samus_pose == kPose_CB_FaceR_Shinespark_Vert || samus_pose == kPose_CC_FaceL_Shinespark_Vert
|| samus_pose == kPose_CD_FaceR_Shinespark_Diag || samus_pose == kPose_CE_FaceL_Shinespark_Diag) {
int idx = plm_idx >> 1;
int plm_blk_idx = plm_block_indices[idx] >> 1;
uint16 plm_respawn_blk = level_data[plm_blk_idx] & 0xF000 | 0x58;
@ -4033,7 +4030,7 @@ const uint8 *PlmInstr_TransferWreckedShipSlopesToChozoSpikes(const uint8 *plmp,
}
/**
* @brief Activates the PLM if the face buttons or left/right d-pad buttons are pressed
* @brief Activates the PLM if the face buttons or left/right d-pad0 buttons are pressed
* @param plm_idx The index of the PLM
*/
void PlmPreInstr_WakeOnKeyPress(uint16 plm_idx) { // 0x84D4BF

View File

@ -26,21 +26,19 @@ static void InitializePpuForMessageBoxes(void) { // 0x858143
ram3000.msgbox.backup_of_enabled_hdma_channels = reg_HDMAEN;
ram3000.msgbox.backup_of_bg3_tilemap_and_size = gameplay_BG3SC;
gameplay_BG3SC = 0x58;
gameplay_TM = 23;
gameplay_TM = 0x10 | 0x4 | 0x2 | 0x1;
gameplay_CGWSEL = 0;
gameplay_CGADSUB = 0;
// Set color math subscreen backdrop to transparent
WriteReg(COLDATA, 0x20);
WriteReg(COLDATA, 0x40);
WriteReg(COLDATA, 0x80);
ReadReg(BG3HOFS); // Useless
// Initialize BG3 X scroll to 0
WriteReg(BG3HOFS, 0);
WriteReg(BG3HOFS, 0); // Doubly useless
ReadReg(BG3VOFS); // Triply useless
WriteReg(BG3HOFS, 0);
// Initialize BG3 Y scroll to 0
WriteReg(BG3VOFS, 0);
WriteReg(BG3VOFS, 0); // Combo breaker
WriteReg(BG3VOFS, 0);
memset(&ram3000.msgbox, 0, 0x80);
uint16 vram_backup_size = sizeof(ram4000.backups.backup_of_vram_0x5880_msgbox);
CopyFromVram(addr_kVram_FxBackup, ram4000.backups.backup_of_vram_0x5880_msgbox, vram_backup_size, 1);
@ -97,28 +95,27 @@ static void WriteSmallMessageBoxTilemap(void) { // 0x858289
/**
* @brief Creates a squishing effect using an HDMA table as the message box expands/contracts
@brief until it reaches the desired Y radius
* until it reaches the desired Y radius
*/
static void MsgBoxMakeHdmaTable(void) { // 0x85959B
message_box_animation_y2_top_half = (uint16)(0x7B00 - message_box_animation_y_radius) >> 8;
static void MsgBoxMakeHdmaTable(void) { // 0x85859B
message_box_animation_y2_top_half = 123 - HIBYTE(message_box_animation_y_radius);
message_box_animation_y3_top_half = 99;
message_box_animation_y0_bottom_half = (uint16)(0x7C00 + message_box_animation_y_radius) >> 8;
message_box_animation_y0_bottom_half = 124 + HIBYTE(message_box_animation_y_radius);
message_box_animation_y1_bottom_half = 148;
uint16 max_radius = sizeof(ram3000.msgbox.msg_box_anim_y_radius) / 2;
uint16 y_top_pos = max_radius - 1;
uint16 y_bottom_pos = 0;
// Subtracting and incrementing the bases does nothing
// Should just do a two equations beforehand and write the result to RAM
for (int r20 = max_radius; r20 > 0; r20--) {
ram3000.msgbox.msg_box_anim_y_radius_neg[y_top_pos] = message_box_animation_y3_top_half - message_box_animation_y2_top_half;
--message_box_animation_y3_top_half;
--message_box_animation_y2_top_half;
--y_top_pos;
ram3000.msgbox.msg_box_anim_y_radius[y_bottom_pos] = message_box_animation_y1_bottom_half - message_box_animation_y0_bottom_half;
++message_box_animation_y1_bottom_half;
++message_box_animation_y0_bottom_half;
++y_bottom_pos;
}
// message_box_animation_y3_top_half - message_box_animation_y2_top_half
uint16 top_half_radius = -(24 - HIBYTE(message_box_animation_y_radius));
//message_box_animation_y1_bottom_half - message_box_animation_y0_bottom_half
uint16 bottom_half_radius = 24 - HIBYTE(message_box_animation_y_radius);
memset7E(ram3000.msgbox.msg_box_anim_y_radius_neg, top_half_radius, sizeof(ram3000.msgbox.msg_box_anim_y_radius_neg));
memset7E(ram3000.msgbox.msg_box_anim_y_radius, bottom_half_radius, sizeof(ram3000.msgbox.msg_box_anim_y_radius));
message_box_animation_y3_top_half -= max_radius;
message_box_animation_y2_top_half -= max_radius;
message_box_animation_y1_bottom_half += max_radius;
message_box_animation_y0_bottom_half += max_radius;
memset(ram3000.msgbox.msg_box_anim_clear, 0, sizeof(ram3000.msgbox.msg_box_anim_clear));
}
@ -126,22 +123,21 @@ static void MsgBoxMakeHdmaTable(void) { // 0x85959B
* @brief Sets up an indirect HDMA to BG3 Y scroll for the expanding/contracting squish effect
*/
static void SetupMessageBoxBg3YscrollHdma(void) { // 0x858363
// Indirect HDMA table = ram3000.msgbox.msg_box_anim_hdma_table
ram3000.msgbox.indirect_hdma[0] = 0xFF;
WORD(ram3000.msgbox.indirect_hdma[1]) = 0x3000;
ram3000.msgbox.indirect_hdma[3] = 0xE1;
WORD(ram3000.msgbox.indirect_hdma[4]) = 0x30FE;
ram3000.msgbox.indirect_hdma[6] = 0;
// Set up indirect HDMA to BG3 Y scroll on HDMA channel 6
WriteReg(DMAP6, HDMA_CONTROL(0, 1, 2));
WriteReg(BBAD6, REG(BG3VOFS));
WriteReg(A1T6L, 0x80);
WriteReg(DAS6L, 0x80);
WriteReg(A1T6H, 0x33);
WriteReg(DAS6H, 0x33);
WriteRegWord(A1T6L, ADDR16_OF_RAM(ram3000.msgbox.indirect_hdma));
WriteReg(A1B6, 0x7E);
WriteRegWord(DAS6L, ADDR16_OF_RAM(ram3000.msgbox.indirect_hdma));
WriteReg(DAS60, 0x7E);
WriteReg(A2A6L, 0);
WriteReg(A2A6H, 0);
WriteRegWord(A2A6L, 0);
WriteReg(NTRL6, 0);
MsgBoxMakeHdmaTable();
// Enable HDMA channel 6
@ -164,19 +160,19 @@ static void SetupPpuForActiveMessageBox(uint16 bg3_tilemap_offset) { // 0x85831
*/
static void DrawSpecialButtonAndSetupPpuForLargeMessageBox(uint16 special_button) { // 0x8583D1
uint16 button_offset = 0;
if ((special_button & kButton_A) == 0) {
if (!(special_button & kButton_A)) {
button_offset = 2;
if ((special_button & kButton_B) == 0) {
if (!(special_button & kButton_B)) {
button_offset = 4;
if ((special_button & kButton_X) == 0) {
if (!(special_button & kButton_X)) {
button_offset = 6;
if ((special_button & kButton_Y) == 0) {
if (!(special_button & kButton_Y)) {
button_offset = 8;
if ((special_button & kButton_Select) == 0) {
if (!(special_button & kButton_Select)) {
button_offset = 10;
if ((special_button & kButton_L) == 0) {
if (!(special_button & kButton_L)) {
button_offset = 12;
if ((special_button & kButton_R) == 0)
if (!(special_button & kButton_R))
button_offset = 14;
}
}
@ -194,14 +190,14 @@ static void DrawSpecialButtonAndSetupPpuForLargeMessageBox(uint16 special_button
* @brief Draws the button assigned to shoot and sets up the PPU for a large message box
*/
static void DrawShootButtonAndSetupPpuForLargeMessageBox(void) { // 0x8583C5
DrawSpecialButtonAndSetupPpuForLargeMessageBox(button_config_shoot_x);
DrawSpecialButtonAndSetupPpuForLargeMessageBox(button_config_shoot);
}
/**
* @brief Draws the button assigned to run and sets up the PPU for a large message box
*/
static void DrawRunButtonAndSetupPpuForLargeMessageBox(void) { // 0x8583CC
DrawSpecialButtonAndSetupPpuForLargeMessageBox(button_config_run_b);
DrawSpecialButtonAndSetupPpuForLargeMessageBox(button_config_run);
}
/**
@ -287,7 +283,7 @@ static void RestorePpuForMessageBox(void) { // 0x85861A
}
/**
* @brief Expands the message box until it's reached the max radius
* @brief Expands the message box until it's reached the max radius and handles music/sfx
*/
static CoroutineRet OpenMessageBox_Async(void) { // 0x85844C
COROUTINE_BEGIN(coroutine_state_4, 0);
@ -333,11 +329,11 @@ static CoroutineRet HandleMessageBoxInteraction_Async(void) { // 0x85846D
if (message_box_index != kMessageBox_20_MapDataAccessCompleted && message_box_index != kMessageBox_21_EnergyRechargeCompleted
&& message_box_index != kMessageBox_22_MissileReloadCompleted && message_box_index != kMessageBox_24_SaveCompleted)
my_counter = 360;
do {
for (; my_counter > 0; --my_counter) {
COROUTINE_AWAIT(2, WaitForNMI_NoUpdate_Async());
HandleMusicQueue();
HandleSoundEffects();
} while (--my_counter);
}
do {
COROUTINE_AWAIT(3, WaitForNMI_NoUpdate_Async());
ReadJoypadInputs();
@ -347,17 +343,16 @@ static CoroutineRet HandleMessageBoxInteraction_Async(void) { // 0x85846D
}
/**
* @brief Shrinks the message box until it's gone
* @brief Shrinks the message box until it's gone and handles music/sfx
*/
static CoroutineRet CloseMessageBox_Async(void) { // 0x858589
COROUTINE_BEGIN(coroutine_state_4, 0);
do {
for (; (int16)message_box_animation_y_radius >= 0; message_box_animation_y_radius -= 0x200) {
COROUTINE_AWAIT(1, WaitForNMI_NoUpdate_Async());
HandleMusicQueue();
HandleSoundEffects();
MsgBoxMakeHdmaTable();
message_box_animation_y_radius -= 512;
} while ((int16)message_box_animation_y_radius >= 0);
}
COROUTINE_END(0);
}
@ -382,12 +377,11 @@ CoroutineRet DisplayMessageBox_Async(uint16 queued_message) { // 0x858080
ClearMessageBoxBg3Tilemap();
QueueSfx1_Max6(kSfx1_Saving);
my_counter = 160;
do {
for (my_counter = 160; my_counter > 0; --my_counter) {
HandleMusicQueue();
HandleSoundEffects();
COROUTINE_AWAIT(8, WaitForNMI_NoUpdate_Async());
} while (--my_counter != 0);
}
InitializeMessageBox();
COROUTINE_AWAIT(5, OpenMessageBox_Async());

View File

@ -348,7 +348,7 @@ void InitializeSpecialEffectsForNewRoom(void) { // 0x8882C1
|| room_ptr == addr_kRoom_EscapeRoom4) {
earthquake_sfx_timer = -1;
}
debug_disable_minimap = 0;
disable_minimap = 0;
for (int i = 0x20; i != 0x80; i += 0x10) {
WriteReg((SnesRegs)(i + DMAP0), DMA_CONTROL(0, 0, 0, 0, 0));
WriteReg((SnesRegs)(i + BBAD0), REG(BG4HOFS));
@ -369,7 +369,7 @@ void InitializeSpecialEffectsForNewRoom(void) { // 0x8882C1
bg3_xpos = 0;
bg3_ypos = 0;
irq_enable_mode7 = 0;
camera_distance_index = 0;
camera_distance_index = kCameraDistanceIndex_0_Normal;
tourian_entrance_statue_animstate = 0;
tourian_entrance_statue_finished = 0;
earthquake_timer = 0;
@ -648,7 +648,7 @@ uint8 RaiseOrLowerFx(void) { // 0x88868C
}
void HdmaobjPreInstr_XrayFunc0_NoBeam(uint16 k) { // 0x888732
if ((button_config_run_b & joypad1_lastkeys) != 0) {
if ((button_config_run & joypad1_lastkeys) != 0) {
CalculateXrayHdmaTable();
++demo_input_pre_instr;
} else {
@ -657,7 +657,7 @@ void HdmaobjPreInstr_XrayFunc0_NoBeam(uint16 k) { // 0x888732
}
void HdmaobjPreInstr_XrayFunc1_BeamWidening(uint16 k) { // 0x888754
if ((button_config_run_b & joypad1_lastkeys) != 0) {
if ((button_config_run & joypad1_lastkeys) != 0) {
AddToHiLo(&demo_input_instr_timer, &demo_input_instr_ptr, 2048);
AddToHiLo(&demo_input, &demo_input_new, __PAIR32__(demo_input_instr_timer, demo_input_instr_ptr));
if (!sign16(demo_input - 11)) {
@ -672,7 +672,7 @@ void HdmaobjPreInstr_XrayFunc1_BeamWidening(uint16 k) { // 0x888754
}
void HdmaobjPreInstr_XrayFunc2_FullBeam(uint16 k) { // 0x8887AB
if ((button_config_run_b & joypad1_lastkeys) != 0) {
if ((button_config_run & joypad1_lastkeys) != 0) {
HandleMovingXrayUpDown();
CalculateXrayHdmaTable();
} else {
@ -2888,7 +2888,7 @@ uint8 GravitySuitPickup_6(void) { // 0x88E25F
int idx = hdma_object_index >> 1;
hdma_object_instruction_list_pointers[idx] += 2;
hdma_object_instruction_timers[idx] = 1;
RunSamusCode(kSamusCode_11_DrawHandlerDefault);
RunSamusCode(kSamusCode_11_UnlockFromFacingForward);
return 0;
}
@ -3343,17 +3343,17 @@ void SpawnWavySamusHdmaObject(void) { // 0x88EC3B
hdma_wavy_samus_enable_flag = 1;
WORD(hdma_wavy_samus_amplitude_low) = 0x4000;
loop_counter_transfer_enemies_to_vram = 8;
button_config_shoot_x_saved = 192;
button_config_itemcancel_y_saved = 192;
button_config_shoot_saved = 192;
button_config_itemcancel_saved = 192;
v0 = 12621824;
*(uint16 *)((uint8 *)&button_config_jump_a_saved + 1) = HIWORD(v0);
*(uint16 *)((uint8 *)&button_config_shoot_x_saved + 1) = v0;
button_config_run_b_saved = -26496;
*(uint16 *)((uint8 *)&button_config_jump_saved + 1) = HIWORD(v0);
*(uint16 *)((uint8 *)&button_config_shoot_saved + 1) = v0;
button_config_run_saved = -26496;
v1 = 12621824;
*(uint16 *)((uint8 *)&button_config_itemswitch_saved + 1) = HIWORD(v1);
*(uint16 *)((uint8 *)&button_config_itemcancel_y_saved + 1) = v1;
button_config_aim_down_L_saved = -26496;
button_config_aim_up_R_saved = 0;
*(uint16 *)((uint8 *)&button_config_itemcancel_saved + 1) = v1;
button_config_aim_down_saved = -26496;
button_config_aim_up_saved = 0;
static const SpawnHdmaObject_Args kSpawnHdmaObject_88EC82 = {
.hdma_control = HDMA_CONTROL(0, 1, 2),
.hdma_target = REG(BG3HOFS),

View File

@ -445,7 +445,7 @@ void HandleMode7TransformationMatrix(void) { // 0x8B8532
void SetPpuBackdropSomeColor(void) { // 0x8B866B
reg_CGWSEL = 0;
reg_CGADSUB = -127;
reg_CGADSUB = 0x81;
reg_COLDATA[0] = 56;
reg_COLDATA[1] = 88;
reg_COLDATA[2] = 0x80;
@ -540,18 +540,18 @@ void ProcessCinematicBgObject_DrawToTextTilemap(uint16 k, uint16 j, uint16 r18)
uint16 offs = CinematicGetTilemapOffsetForTile(r18);
uint16 r22 = offs;
const uint8 *v3 = RomPtr_8C(j);
uint16 m = v3[2];
uint16 morg = m;
uint16 n = v3[3];
uint16 col_num = v3[2];
uint16 col_num_org = col_num;
uint16 row_num = v3[3];
while (1) {
do {
*(uint16 *)((uint8 *)ram3000.pause_menu_map_tilemap + offs) = *((uint16 *)RomPtr_8C(j) + 2);
j += 2;
offs += 2;
--m;
} while (m);
m = morg;
if (!--n)
--col_num;
} while (col_num);
col_num = col_num_org;
if (!--row_num)
break;
r22 += 64;
offs = r22;
@ -638,12 +638,11 @@ uint16 Mult0x80Add(uint16 r18) { // 0x8B8A2C
void Samus_CalcPos_Mode7(void) { // 0x8B8A52
uint16 x_pos = samus_x_pos - reg_M7X;
uint16 y_pos = reg_M7Y - samus_y_pos;
uint16 x_offset = Smult16x16(x_pos, reg_M7A) >> 8;
x_offset += Smult16x16(reg_M7B, y_pos) >> 8;
samus_x_pos = x_offset + reg_M7X;
uint16 x_offset = Smult16x16(x_pos, reg_M7A) / 0x100 + Smult16x16(y_pos, reg_M7B) / 0x100;
samus_x_pos = reg_M7X + x_offset;
uint16 y_offset = Smult16x16(reg_M7C, x_pos) >> 8;
y_offset += Smult16x16(reg_M7A, y_pos) >> 8;
uint16 y_offset = Smult16x16(x_pos, reg_M7C) / 0x100 + Smult16x16(y_pos, reg_M7A) / 0x100;
samus_y_pos = reg_M7Y - y_offset;
}
@ -878,7 +877,9 @@ CoroutineRet InitializeIoDisplayLogo_Async(void) { // 0x8B9146
oam_next_ptr = 0;
ClearOamExt();
ClearUnusedOam();
nmi_copy_samus_halves = 0;
//nmi_copy_samus_halves = 0;
nmi_copy_samus_top_half_ready_flag = 0;
nmi_copy_samus_bottom_half_ready_flag = 0;
nmi_copy_samus_top_half_src = 0;
nmi_copy_samus_bottom_half_src = 0;
WriteReg(NMITIMEN, 1);
@ -1923,19 +1924,17 @@ uint16 CinematicSprInstr_9F19(uint16 k, uint16 j) { // 0x8B9F19
}
void CinematicFunc_Func1(void) { // 0x8B9F29
bool v0 = (--demo_timer & 0x8000) != 0;
if (!demo_timer || v0) {
if ((int16)--demo_timer <= 0) {
cinematic_function = FUNC16(CinematicFunc_Func9);
LABEL_6:
screen_fade_delay = 2;
screen_fade_counter = 2;
goto LABEL_7;
}
if ((joypad1_newkeys & (uint16)(kButton_B | kButton_Start | kButton_A)) != 0) {
else if (joypad1_newkeys & (kButton_B | kButton_Start | kButton_A)) {
cinematic_function = FUNC16(CinematicFunc_Func10);
goto LABEL_6;
screen_fade_delay = 2;
screen_fade_counter = 2;
}
LABEL_7:;
// REMOVED: Debug_DisplayVersionInfo()
}
void CinematicFunc_Func10(void) { // 0x8B9F52
@ -2076,7 +2075,7 @@ void CinematicFunction_Intro_Initial(void) { // 0x8BA395
samus_max_missiles = 900;
samus_missiles = 900;
cinematic_samus_display_flag = 0;
samus_draw_handler = FUNC16(SamusDrawHandler_Default);
samus_draw_handler = FUNC16(Samus_DrawHandler_Default);
ResetButtonAssignmentsToDefault();
samus_invincibility_timer = 0;
samus_knockback_timer = 0;
@ -3284,10 +3283,11 @@ void CinematicFunction_Intro_Func44(uint16 k) { // 0x8BB8D8
if (sign16(cinematicbg_x_pos[v1] + 8 - (samus_x_pos - 5))) {
if (cinematicspr_preinstr_func[0] != FUNC16(CinematicFunction_Intro_Func39))
return;
} else {
}
else {
samus_invincibility_timer = 11;
samus_knockback_timer = 11;
knockback_x_dir = 1;
knockback_x_dir = kKnockbackXDir_Right;
}
cinematicspr_instr_timer[v1] = 1;
cinematicspr_instr_ptr[v1] = addr_kCinematicSpriteObjectInstrList_CE52_Nothing;
@ -3432,34 +3432,34 @@ void CinematicFunction_Intro_Func53(uint16 k) { // 0x8BBB24
}
void ResetButtonAssignmentsToDefault(void) { // 0x8BBC08
button_config_shoot_x_saved = button_config_shoot_x;
button_config_jump_a_saved = button_config_jump_a;
button_config_run_b_saved = button_config_run_b;
button_config_itemcancel_y_saved = button_config_itemcancel_y;
button_config_shoot_saved = button_config_shoot;
button_config_jump_saved = button_config_jump;
button_config_run_saved = button_config_run;
button_config_itemcancel_saved = button_config_itemcancel;
button_config_itemswitch_saved = button_config_itemswitch;
button_config_aim_down_L_saved = button_config_aim_down_L;
button_config_aim_up_R_saved = button_config_aim_up_R;
button_config_aim_down_saved = button_config_aim_down;
button_config_aim_up_saved = button_config_aim_up;
button_config_up = kButton_Up;
button_config_down = kButton_Down;
button_config_left = kButton_Left;
button_config_right = kButton_Right;
button_config_shoot_x = kButton_X;
button_config_jump_a = kButton_A;
button_config_run_b = kButton_B;
button_config_itemcancel_y = kButton_Y;
button_config_shoot = kButton_X;
button_config_jump = kButton_A;
button_config_run = kButton_B;
button_config_itemcancel = kButton_Y;
button_config_itemswitch = kButton_Select;
button_config_aim_down_L = kButton_L;
button_config_aim_up_R = kButton_R;
button_config_aim_down = kButton_L;
button_config_aim_up = kButton_R;
}
void RevertButtonConfig(void) { // 0x8BBC75
button_config_shoot_x = button_config_shoot_x_saved;
button_config_jump_a = button_config_jump_a_saved;
button_config_run_b = button_config_run_b_saved;
button_config_itemcancel_y = button_config_itemcancel_y_saved;
button_config_shoot = button_config_shoot_saved;
button_config_jump = button_config_jump_saved;
button_config_run = button_config_run_saved;
button_config_itemcancel = button_config_itemcancel_saved;
button_config_itemswitch = button_config_itemswitch_saved;
button_config_aim_down_L = button_config_aim_down_L_saved;
button_config_aim_up_R = button_config_aim_up_R_saved;
button_config_aim_down = button_config_aim_down_saved;
button_config_aim_up = button_config_aim_up_saved;
}
void CinematicFunction_Intro_Func54(void) { // 0x8BBCA0
@ -5184,47 +5184,46 @@ void CinematicFunction_Intro_Func144(void) { // 0x8BE58A
}
uint16 CalcItemPercentageCount(uint16 k, uint16 instrp) { // 0x8BE627
uint16 j;
uint16 item_percentage = 0;
uint16 v0 = 4;
uint16 r18 = 0;
do {
const uint16 *v1 = (const uint16 *)RomPtr_RAM(kCredits_ItemPercentageRamAddresses[v0]);
r18 += SnesDivide(*v1, kCredits_ItemPercentageDivisors[v0]);
--v0;
} while ((v0 & 0x8000) == 0);
for (int i = 20; i >= 0; i -= 2) {
if ((kCredits_ItemPercentageItemBits[i >> 1] & collected_items) != 0)
++r18;
// Get total percentage across all tanks collected (i.e. energy, reserves, missiles, etc.)
for (int item_tank_idx = 0; item_tank_idx < arraysize(kCredits_ItemPercentageDivisors); item_tank_idx++) {
uint16 item_tank_amt = GET_WORD(RomPtr_RAM(kCredits_ItemPercentageRamAddresses[item_tank_idx]));
item_percentage += item_tank_amt / kCredits_ItemPercentageDivisors[item_tank_idx];
--item_tank_idx;
}
for (j = 8; (j & 0x8000) == 0; j -= 2) {
if ((kCredits_ItemPercentageBeamBits[j >> 1] & collected_beams) != 0)
++r18;
// Get total percentage across all items collected (i.e. upgrades not including tanks and beams)
for (int item_idx = 0; item_idx < arraysize(kCredits_ItemPercentageItemBits); item_idx++) {
if (collected_items & kCredits_ItemPercentageItemBits[item_idx])
++item_percentage;
}
uint16 RegWord = r18 / 10;
uint16 r22 = r18 % 10;
r18 = RegWord / 10;
uint16 r20 = RegWord % 10;
if (r18) {
int v5 = (uint16)(4 * r18) >> 1;
ram3000.pause_menu_map_tilemap[462] = kCredits_ItemPercentageDigitsTilemap[v5];
ram3000.pause_menu_map_tilemap[494] = kCredits_ItemPercentageDigitsTilemap[v5 + 1];
// Get total percentage across all beams collected
for (int beam_idx = 0; beam_idx < arraysize(kCredits_ItemPercentageBeamBits); beam_idx++) {
if (collected_beams & kCredits_ItemPercentageBeamBits[beam_idx])
++item_percentage;
}
uint16 v6 = r20;
if (r20)
goto LABEL_16;
if (r18) {
v6 = r20;
LABEL_16:;
int v7 = (uint16)(4 * v6) >> 1;
ram3000.pause_menu_map_tilemap[463] = kCredits_ItemPercentageDigitsTilemap[v7];
ram3000.pause_menu_map_tilemap[495] = kCredits_ItemPercentageDigitsTilemap[v7 + 1];
// Calculate the digits of the item percentage
uint16 ones_digit = item_percentage % 10;
uint16 hundreds_digit = item_percentage / 100;
uint16 tens_digit = item_percentage / 10 % 10;
// Draw the item percentage
if (hundreds_digit != 0) {
ram3000.cinematic_bg_tilemap[462] = kCredits_ItemPercentageDigitsTilemap[hundreds_digit].top_half_tilemap;
ram3000.cinematic_bg_tilemap[494] = kCredits_ItemPercentageDigitsTilemap[hundreds_digit].bottom_half_tilemap;
}
int v8 = (uint16)(4 * r22) >> 1;
ram3000.pause_menu_map_tilemap[464] = kCredits_ItemPercentageDigitsTilemap[v8];
ram3000.pause_menu_map_tilemap[496] = kCredits_ItemPercentageDigitsTilemap[v8 + 1];
ram3000.pause_menu_map_tilemap[465] = 14442;
ram3000.pause_menu_map_tilemap[497] = 14458;
// Always draw tens digit if >= 100%
if (tens_digit != 0 || hundreds_digit != 0) {
ram3000.cinematic_bg_tilemap[463] = kCredits_ItemPercentageDigitsTilemap[tens_digit].top_half_tilemap;
ram3000.cinematic_bg_tilemap[495] = kCredits_ItemPercentageDigitsTilemap[tens_digit].bottom_half_tilemap;
}
ram3000.cinematic_bg_tilemap[464] = kCredits_ItemPercentageDigitsTilemap[ones_digit].top_half_tilemap;
ram3000.cinematic_bg_tilemap[496] = kCredits_ItemPercentageDigitsTilemap[ones_digit].bottom_half_tilemap;
// % symbol top half
ram3000.cinematic_bg_tilemap[465] = 0x386A;
// % symbol bottom half
ram3000.cinematic_bg_tilemap[497] = 0x387A;
return instrp;
}

View File

@ -228,32 +228,43 @@ uint16 kPalettes_EndingSuperMetroidIconGlare[] = {
};
uint16 kCredits_ItemPercentageRamAddresses[] = {
0x9c4, 0x9d4, 0x9c8, 0x9cc, 0x9d0,
0x9c4, // ADDR16_OF_RAM(samus_max_health),
0x9d4, // ADDR16_OF_RAM(samus_max_reserve_health),
0x9c8, // ADDR16_OF_RAM(samus_max_missiles),
0x9cc, // ADDR16_OF_RAM(samus_max_super_missiles),
0x9d0, // ADDR16_OF_RAM(samus_max_power_bombs),
};
uint16 kCredits_ItemPercentageDivisors[] = {
100, 100, 5, 5, 5,
100, // samus_max_health
100, // samus_max_reserve_health
5, // samus_max_missiles
5, // samus_max_super_missiles
5, // samus_max_power_bombs
};
uint16 kCredits_ItemPercentageItemBits[] = {
0x1, 0x20, 0x4, 0x1000, 0x2, 0x8, 0x100, 0x200, 0x2000, 0x4000, 0x8000,
/* SUIT */ kItem_VariaSuit, kItem_GravitySuit,
/* MISC. */ kItem_MorphBall, kItem_Bombs, kItem_SpringBall, kItem_ScrewAttack,
/* BOOTS */ kItem_HiJumpBoots, kItem_SpaceJump, kItem_SpeedBooster,
/* UPGRADES */ kItem_Grapple, kItem_Xray,
};
uint16 kCredits_ItemPercentageBeamBits[] = {
0x1, 0x2, 0x4, 0x8, 0x1000,
kBeam_Wave, kBeam_Ice, kBeam_Spazer, kBeam_Plasma, kBeam_Charge,
};
uint16 kCredits_ItemPercentageDigitsTilemap[] = {
0x3860, 0x3870,
0x3861, 0x3871,
0x3862, 0x3872,
0x3863, 0x3873,
0x3864, 0x3874,
0x3865, 0x3875,
0x3866, 0x3876,
0x3867, 0x3877,
0x3868, 0x3878,
0x3869, 0x3879,
ItemPercentageDigitsTilemap kCredits_ItemPercentageDigitsTilemap[] = {
[0] = { .top_half_tilemap = 0x3860, .bottom_half_tilemap = 0x3870, },
[1] = { .top_half_tilemap = 0x3861, .bottom_half_tilemap = 0x3871, },
[2] = { .top_half_tilemap = 0x3862, .bottom_half_tilemap = 0x3872, },
[3] = { .top_half_tilemap = 0x3863, .bottom_half_tilemap = 0x3873, },
[4] = { .top_half_tilemap = 0x3864, .bottom_half_tilemap = 0x3874, },
[5] = { .top_half_tilemap = 0x3865, .bottom_half_tilemap = 0x3875, },
[6] = { .top_half_tilemap = 0x3866, .bottom_half_tilemap = 0x3876, },
[7] = { .top_half_tilemap = 0x3867, .bottom_half_tilemap = 0x3877, },
[8] = { .top_half_tilemap = 0x3868, .bottom_half_tilemap = 0x3878, },
[9] = { .top_half_tilemap = 0x3869, .bottom_half_tilemap = 0x3879, },
};
uint16 kShootingStarTable[] = {

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -10,15 +10,15 @@
* @brief Sets the tile definition entry for the current Samus animation
*/
void SetSamusTilesDefsForCurAnim(void) { // 0x928000
uint16 anim_def_ptr = 4 * samus_anim_frame + kSamus_AnimationDefinitionPtrs[samus_pose];
uint16 anim_def_ptr = kSamus_AnimationDefinitionPtrs[samus_pose] + samus_anim_frame * sizeof(SamusTileAnimationDefs);
SamusTileAnimationDefs *AD = get_SamusTileAnimationDefs(anim_def_ptr);
uint16 tile_def_entry = sizeof(SamusTileAnimationTileDefs);
nmi_copy_samus_top_half_src = tile_def_entry * AD->top_half_pos + kSamus_TileDefs_TopHalf[AD->top_half_idx];
nmi_copy_samus_top_half_ready_flag = 1;
// The index will never be 255, so this condition is always true
if (AD->bottom_half_idx != 255) {
nmi_copy_samus_bottom_half_src = tile_def_entry * AD->bottom_half_pos + kSamus_TileDefs_BottomHalf[AD->bottom_half_idx];
nmi_copy_samus_bottom_half_ready_flag = 1;
nmi_copy_samus_top_half_src = kSamus_TileDefs_TopHalf[AD->top_half_idx] + AD->top_half_pos * tile_def_entry;
nmi_copy_samus_top_half_ready_flag = true;
// The index will never be 0xFF, so this condition is always true
if (AD->bottom_half_idx != 0xFF) {
nmi_copy_samus_bottom_half_src = kSamus_TileDefs_BottomHalf[AD->bottom_half_idx] + AD->bottom_half_pos * tile_def_entry;
nmi_copy_samus_bottom_half_ready_flag = true;
}
}
@ -31,20 +31,20 @@ uint8 PlaySamusFanfare(void) { // 0x92ED24
QueueMusic_DelayedY(kMusic_SamusFanfare, 14);
}
else if (samus_fanfare_timer == 5) {
PlayRoomMusicTrackAfterAFrames(360);
PlayRoomMusicTrackAfterAFrames(6*60);
}
if (samus_fanfare_timer + 1 < 360) {
if (samus_fanfare_timer + 1 < 6*60) {
++samus_fanfare_timer;
return 0;
}
else {
samus_last_different_pose = samus_prev_pose;
samus_last_different_pose_x_dir = samus_prev_pose_x_dir;
samus_last_different_pose_movement_type = samus_prev_movement_type2;
samus_last_different_pose_movement_type = samus_prev_movement_type;
samus_prev_pose = samus_pose;
samus_prev_pose_x_dir = samus_pose_x_dir;
samus_prev_movement_type2 = samus_movement_type;
samus_prev_movement_type = samus_movement_type;
samus_fanfare_timer = 0;
return 1;
}

View File

@ -2,11 +2,53 @@
#include "types.h"
//#define kSamus_AnimationDefinitionPtrs ((uint16*)RomFixedPtr(0x92d94e))
//#define kSamus_TileDefs_TopHalf ((uint16*)RomFixedPtr(0x92d91e))
//#define kSamus_TileDefs_BottomHalf ((uint16*)RomFixedPtr(0x92d938))
const uint16 kSamusPoseToBaseSpritemapIndexTop[] = { // 0x929263
0x2, 0x19a, 0x1a3, 0x1ad, 0x1af, 0x1b1, 0x1b3, 0x1b5, 0x1b7, 0x1f9, 0x203, 0x20d, 0x217, 0x221, 0x22b, 0x235,
0x23f, 0x249, 0x253, 0x275, 0x277, 0x279, 0x27b, 0x271, 0x273, 0x74c, 0x764, 0x77c, 0x794, 0x710, 0x724, 0x72e,
0x74c, 0x74c, 0x74c, 0x74c, 0x74c, 0x419, 0x41c, 0x3f1, 0x3fa, 0x3b7, 0x3be, 0x3d3, 0x3d6, 0x3d9, 0x3db, 0x419,
0x41c, 0x710, 0x710, 0x74c, 0x74c, 0x403, 0x404, 0x405, 0x407, 0x74c, 0x74c, 0x403, 0x404, 0x409, 0x40b, 0x710,
0x710, 0x71a, 0x74c, 0x419, 0x41c, 0x25d, 0x267, 0x19a, 0x1a3, 0x1d5, 0x1db, 0x289, 0x28a, 0x28b, 0x291, 0x297,
0x2a1, 0x285, 0x287, 0x31f, 0x321, 0x1cd, 0x1cf, 0x1b1, 0x1b3, 0x1b5, 0x1b7, 0x32f, 0x330, 0x331, 0x331, 0x331,
0x332, 0x333, 0x375, 0x2ab, 0x2ad, 0x2af, 0x2b8, 0x3c5, 0x3cc, 0x27d, 0x27f, 0x281, 0x283, 0x3dd, 0x3e0, 0x3e3,
0x3e6, 0x3e9, 0x3ea, 0x3eb, 0x3ec, 0x1e1, 0x1e7, 0x1ed, 0x1f3, 0x738, 0x742, 0x738, 0x742, 0x738, 0x742, 0x738,
0x742, 0x7ac, 0x7e4, 0x2c1, 0x2f0, 0x3ed, 0x3ef, 0x419, 0x41c, 0x19a, 0x1a3, 0x41f, 0x422, 0x425, 0x428, 0x41f,
0x422, 0x425, 0x428, 0x41f, 0x422, 0x425, 0x428, 0x41f, 0x422, 0x425, 0x428, 0xc2, 0x41f, 0x422, 0x41f, 0x422,
0x41f, 0x422, 0x41f, 0x422, 0x1b9, 0x1bb, 0x1bd, 0x1c0, 0x19a, 0x1a3, 0x1b5, 0x1b7, 0x275, 0x277, 0x271, 0x273,
0x281, 0x283, 0x333, 0x375, 0x3f1, 0x3fa, 0x3eb, 0x3ec, 0x32f, 0x330, 0x42f, 0x430, 0x431, 0x432, 0x439, 0x419,
0x41c, 0x41f, 0x422, 0x425, 0x428, 0x71a, 0x419, 0x28b, 0x291, 0x43f, 0x440, 0x82e, 0x82f, 0x441, 0x442, 0x1b1,
0x1b3, 0x1b5, 0x1b7, 0x443, 0x452, 0x1c3, 0x1c8, 0x461, 0x467, 0x1c3, 0x1c8, 0x40d, 0x410, 0x413, 0x416, 0x71a,
0x1cd, 0x1cf, 0x1b1, 0x1b3, 0x1b5, 0x1b7, 0x1d1, 0x1d3, 0x46d, 0x47c, 0x49c, 0x4a2, 0x42b, 0x42c, 0x42d, 0x42e,
0x433, 0x1cd, 0x1cf, 0x1b1, 0x1b3, 0x1b5, 0x1b7, 0x1cd, 0x1cf, 0x1b1, 0x1b3, 0x1b5, 0x1b7,
};
uint16 kSamus_AnimationDefinitionPtrs[] = {
const uint16 kSamusPoseToBaseSpritemapIndexBottom[] = { // 0x92945D
0x62, 0x4aa, 0x4b3, 0x4c0, 0x4c2, 0x4c0, 0x4c2, 0x4c0, 0x4c2, 0x4e3, 0x4ed, 0x4e3, 0x4ed, 0x4e3, 0x4ed, 0x4e3,
0x4ed, 0x4e3, 0x4ed, 0x507, 0x509, 0x50b, 0x50d, 0x503, 0x505, 0x758, 0x770, 0x788, 0x7a0, 0x710, 0x724, 0x72e,
0x74c, 0x74c, 0x74c, 0x74c, 0x74c, 0x687, 0x68a, 0x65f, 0x668, 0x63b, 0x642, 0x64d, 0x650, 0x649, 0x64b, 0x68d,
0x690, 0x710, 0x710, 0x74c, 0x74c, 0x679, 0x67a, 0x405, 0x407, 0x74c, 0x74c, 0x679, 0x67a, 0x409, 0x40b, 0x710,
0x710, 0x71a, 0x74c, 0x68d, 0x690, 0x4e3, 0x4ed, 0x4aa, 0x4b3, 0x4f7, 0x4fd, 0x51b, 0x51c, 0x51d, 0x523, 0x529,
0x533, 0x50f, 0x511, 0x5b1, 0x5b3, 0x51b, 0x51c, 0x51b, 0x51c, 0x51b, 0x51c, 0x5b5, 0x5b6, 0x5b7, 0x5b7, 0x5b7,
0x5b7, 0x5b7, 0x5f9, 0x53d, 0x53f, 0x541, 0x54a, 0x63b, 0x642, 0x513, 0x515, 0x517, 0x519, 0x653, 0x656, 0x659,
0x65c, 0x671, 0x672, 0x673, 0x674, 0x4f7, 0x4fd, 0x4f7, 0x4fd, 0x738, 0x742, 0x738, 0x742, 0x738, 0x742, 0x738,
0x742, 0x7c8, 0x800, 0x553, 0x582, 0x675, 0x677, 0x68d, 0x696, 0x4aa, 0x4b3, 0x687, 0x68a, 0x687, 0x68a, 0x68d,
0x690, 0x68d, 0x690, 0x68d, 0x696, 0x68d, 0x696, 0x68d, 0x690, 0x68d, 0x690, 0x122, 0x687, 0x68a, 0x68d, 0x690,
0x68d, 0x696, 0x68d, 0x690, 0x4c5, 0x4c7, 0x4c9, 0x4cc, 0x4aa, 0x4b3, 0x4c0, 0x4c2, 0x507, 0x509, 0x503, 0x505,
0x517, 0x519, 0x5b7, 0x5f9, 0x65f, 0x668, 0x673, 0x674, 0x5b5, 0x5b6, 0x69a, 0x69a, 0x69a, 0x69a, 0x6a1, 0x687,
0x68a, 0x687, 0x68a, 0x687, 0x68a, 0x71a, 0x687, 0x51d, 0x523, 0x6a7, 0x6a8, 0x82e, 0x82f, 0x6a9, 0x6aa, 0x4c0,
0x4c2, 0x4c0, 0x4c2, 0x6ab, 0x6ba, 0x4cf, 0x4d4, 0x6c9, 0x6cf, 0x4d9, 0x4de, 0x67d, 0x680, 0x681, 0x684, 0x71a,
0x4c5, 0x4c7, 0x4c5, 0x4c7, 0x4c5, 0x4c7, 0x4c5, 0x4c7, 0x6d5, 0x6e4, 0x704, 0x70a, 0x699, 0x699, 0x699, 0x699,
0x69b, 0x679, 0x67a, 0x679, 0x67a, 0x679, 0x67a, 0x679, 0x67a, 0x679, 0x67a, 0x679, 0x67a,
};
static const uint16 kSamus_TileDefs_TopHalf[] = { // 0x92D91E
0xcbee, 0xccce, 0xcda0, 0xce80, 0xcef7, 0xcf6e, 0xcfe5, 0xd05c, 0xd0e8, 0xd12e, 0xd613, 0xd6a6, 0xd74e,
};
static const uint16 kSamus_TileDefs_BottomHalf[] = { // 0x92D938
0xd19e, 0xd27e, 0xd35e, 0xd6d7, 0xd406, 0xd4a7, 0xd54f, 0xd786, 0xd5f0, 0xd79b, 0xd605,
};
static const uint16 kSamus_AnimationDefinitionPtrs[] = { // 0x92D94E
0xea24, 0xdb48, 0xdb6c, 0xe018, 0xe020, 0xe028, 0xe02c, 0xe030, 0xe034, 0xdc48, 0xdc70, 0xdc98, 0xdcc0, 0xdf28, 0xdf50, 0xdf78,
0xdfa0, 0xdfc8, 0xdff0, 0xdd28, 0xdd30, 0xdd38, 0xdd40, 0xdd18, 0xdd20, 0xe5f8, 0xe628, 0xe658, 0xe688, 0xe508, 0xe558, 0xe580,
0xe5f8, 0xe5f8, 0xe5f8, 0xe5f8, 0xe5f8, 0xe798, 0xe7a4, 0xde18, 0xde3c, 0xde60, 0xde7c, 0xde98, 0xdea4, 0xdeb0, 0xdeb8, 0xe7e0,
@ -25,12 +67,4 @@ uint16 kSamus_AnimationDefinitionPtrs[] = {
0xe848, 0xdd80, 0xdd84, 0xdd88, 0xdd8c, 0xdd90, 0xdd94, 0xdd80, 0xdd84, 0xdd88, 0xdd8c, 0xdd90, 0xdd94,
};
uint16 kSamus_TileDefs_TopHalf[] = {
0xcbee, 0xccce, 0xcda0, 0xce80, 0xcef7, 0xcf6e, 0xcfe5, 0xd05c, 0xd0e8, 0xd12e, 0xd613, 0xd6a6, 0xd74e,
};
uint16 kSamus_TileDefs_BottomHalf[] = {
0xd19e, 0xd27e, 0xd35e, 0xd6d7, 0xd406, 0xd4a7, 0xd54f, 0xd786, 0xd5f0, 0xd79b, 0xd605,
};

View File

@ -8,43 +8,43 @@
#define PROJ_INSTR_FUNC(INSTR, ENTRY, ANIM) (addr_kProjectile_IList_##INSTR + ENTRY*sizeof(ProjectileInstr_1) + ANIM*sizeof(ProjectileInstr_2))
static const ProjectileDataTable kProjectileData_UnchargedBeams[] = { // 0x9383C1
[kProjectileType_Power] = { .damage = 20, .up_to_right = PROJ_INSTR(Power_Up) , .up_right = PROJ_INSTR(Power_UpRight) , .right = PROJ_INSTR(Power_Right) , .down_right = PROJ_INSTR(Power_DownRight) , .down_to_right = PROJ_INSTR(Power_Down) , .down_to_left = PROJ_INSTR(Power_Down) , .down_left = PROJ_INSTR(Power_DownLeft) , .left = PROJ_INSTR(Power_Left) , .up_left = PROJ_INSTR(Power_UpLeft) , .up_to_left = PROJ_INSTR(Power_Up) },
[kProjectileType_Wave] = { .damage = 50, .up_to_right = PROJ_INSTR(Wave_IceWave_Up) , .up_right = PROJ_INSTR(Wave_IceWave_DownLeft_UpRight) , .right = PROJ_INSTR(Wave_IceWave_Left_Right) , .down_right = PROJ_INSTR(Wave_IceWave_DownRight_UpLeft) , .down_to_right = PROJ_INSTR(Wave_IceWave_Down) , .down_to_left = PROJ_INSTR(Wave_IceWave_Down) , .down_left = PROJ_INSTR(Wave_IceWave_DownLeft_UpRight) , .left = PROJ_INSTR(Wave_IceWave_Left_Right) , .up_left = PROJ_INSTR(Wave_IceWave_DownRight_UpLeft) , .up_to_left = PROJ_INSTR(Wave_IceWave_Up) },
[kProjectileType_Ice] = { .damage = 30, .up_to_right = PROJ_INSTR(Ice) , .up_right = PROJ_INSTR(Ice) , .right = PROJ_INSTR(Ice) , .down_right = PROJ_INSTR(Ice) , .down_to_right = PROJ_INSTR(Ice) , .down_to_left = PROJ_INSTR(Ice) , .down_left = PROJ_INSTR(Ice) , .left = PROJ_INSTR(Ice) , .up_left = PROJ_INSTR(Ice) , .up_to_left = PROJ_INSTR(Ice) },
[kProjectileType_Ice|kProjectileType_Wave] = { .damage = 60, .up_to_right = PROJ_INSTR(Wave_IceWave_Up) , .up_right = PROJ_INSTR(Wave_IceWave_DownLeft_UpRight) , .right = PROJ_INSTR(Wave_IceWave_Left_Right) , .down_right = PROJ_INSTR(Wave_IceWave_DownRight_UpLeft) , .down_to_right = PROJ_INSTR(Wave_IceWave_Down) , .down_to_left = PROJ_INSTR(Wave_IceWave_Down) , .down_left = PROJ_INSTR(Wave_IceWave_DownLeft_UpRight) , .left = PROJ_INSTR(Wave_IceWave_Left_Right) , .up_left = PROJ_INSTR(Wave_IceWave_DownRight_UpLeft) , .up_to_left = PROJ_INSTR(Wave_IceWave_Up) },
[kProjectileType_Spazer] = { .damage = 40, .up_to_right = PROJ_INSTR(Spazer_SpazerIce_Up) , .up_right = PROJ_INSTR(Spazer_SpazerIce_UpRight) , .right = PROJ_INSTR(Spazer_SpazerIce_Right) , .down_right = PROJ_INSTR(Spazer_SpazerIce_DownRight) , .down_to_right = PROJ_INSTR(Spazer_SpazerIce_Down) , .down_to_left = PROJ_INSTR(Spazer_SpazerIce_Down) , .down_left = PROJ_INSTR(Spazer_SpazerIce_DownLeft) , .left = PROJ_INSTR(Spazer_SpazerIce_Left) , .up_left = PROJ_INSTR(Spazer_SpazerIce_UpLeft) , .up_to_left = PROJ_INSTR(Spazer_SpazerIce_Up) },
[kProjectileType_Spazer|kProjectileType_Wave] = { .damage = 70, .up_to_right = PROJ_INSTR(SpazerWave_SpazerIceWave_Up) , .up_right = PROJ_INSTR(SpazerWave_SpazerIceWave_UpRight) , .right = PROJ_INSTR(SpazerWave_SpazerIceWave_Right) , .down_right = PROJ_INSTR(SpazerWave_SpazerIceWave_DownRight) , .down_to_right = PROJ_INSTR(SpazerWave_SpazerIceWave_Down) , .down_to_left = PROJ_INSTR(SpazerWave_SpazerIceWave_Down) , .down_left = PROJ_INSTR(SpazerWave_SpazerIceWave_DownLeft) , .left = PROJ_INSTR(SpazerWave_SpazerIceWave_Left) , .up_left = PROJ_INSTR(SpazerWave_SpazerIceWave_UpLeft) , .up_to_left = PROJ_INSTR(SpazerWave_SpazerIceWave_Up) },
[kProjectileType_Spazer|kProjectileType_Ice] = { .damage = 60, .up_to_right = PROJ_INSTR(Spazer_SpazerIce_Up) , .up_right = PROJ_INSTR(Spazer_SpazerIce_UpRight) , .right = PROJ_INSTR(Spazer_SpazerIce_Right) , .down_right = PROJ_INSTR(Spazer_SpazerIce_DownRight) , .down_to_right = PROJ_INSTR(Spazer_SpazerIce_Down) , .down_to_left = PROJ_INSTR(Spazer_SpazerIce_Down) , .down_left = PROJ_INSTR(Spazer_SpazerIce_DownLeft) , .left = PROJ_INSTR(Spazer_SpazerIce_Left) , .up_left = PROJ_INSTR(Spazer_SpazerIce_UpLeft) , .up_to_left = PROJ_INSTR(Spazer_SpazerIce_Up) },
[kProjectileType_Spazer|kProjectileType_Ice|kProjectileType_Wave] = { .damage = 100, .up_to_right = PROJ_INSTR(SpazerWave_SpazerIceWave_Up) , .up_right = PROJ_INSTR(SpazerWave_SpazerIceWave_UpRight) , .right = PROJ_INSTR(SpazerWave_SpazerIceWave_Right) , .down_right = PROJ_INSTR(SpazerWave_SpazerIceWave_DownRight) , .down_to_right = PROJ_INSTR(SpazerWave_SpazerIceWave_Down) , .down_to_left = PROJ_INSTR(SpazerWave_SpazerIceWave_Down) , .down_left = PROJ_INSTR(SpazerWave_SpazerIceWave_DownLeft) , .left = PROJ_INSTR(SpazerWave_SpazerIceWave_Left) , .up_left = PROJ_INSTR(SpazerWave_SpazerIceWave_UpLeft) , .up_to_left = PROJ_INSTR(SpazerWave_SpazerIceWave_Up) },
[kProjectileType_Plasma] = { .damage = 150, .up_to_right = PROJ_INSTR(Plasma_PlasmaIce_Down_Up) , .up_right = PROJ_INSTR(Plasma_PlasmaIce_DownLeft_UpRight) , .right = PROJ_INSTR(Plasma_PlasmaIce_Left_Right) , .down_right = PROJ_INSTR(Plasma_PlasmaIce_DownRight_UpLeft) , .down_to_right = PROJ_INSTR(Plasma_PlasmaIce_Down_Up) , .down_to_left = PROJ_INSTR(Plasma_PlasmaIce_Down_Up) , .down_left = PROJ_INSTR(Plasma_PlasmaIce_DownLeft_UpRight) , .left = PROJ_INSTR(Plasma_PlasmaIce_Left_Right) , .up_left = PROJ_INSTR(Plasma_PlasmaIce_DownRight_UpLeft) , .up_to_left = PROJ_INSTR(Plasma_PlasmaIce_Down_Up) },
[kProjectileType_Plasma|kProjectileType_Wave] = { .damage = 250, .up_to_right = PROJ_INSTR(PlasmaWave_Down_Up) , .up_right = PROJ_INSTR(PlasmaWave_DownLeft_UpRight) , .right = PROJ_INSTR(PlasmaWave_PlasmaIceWave_Left_Right) , .down_right = PROJ_INSTR(PlasmaWave_DownRight_UpLeft) , .down_to_right = PROJ_INSTR(PlasmaWave_Down_Up) , .down_to_left = PROJ_INSTR(PlasmaWave_Down_Up) , .down_left = PROJ_INSTR(PlasmaWave_DownLeft_UpRight) , .left = PROJ_INSTR(PlasmaWave_PlasmaIceWave_Left_Right) , .up_left = PROJ_INSTR(PlasmaWave_DownRight_UpLeft) , .up_to_left = PROJ_INSTR(PlasmaWave_Down_Up) },
[kProjectileType_Plasma|kProjectileType_Ice] = { .damage = 200, .up_to_right = PROJ_INSTR(Plasma_PlasmaIce_Down_Up) , .up_right = PROJ_INSTR(Plasma_PlasmaIce_DownLeft_UpRight) , .right = PROJ_INSTR(Plasma_PlasmaIce_Left_Right) , .down_right = PROJ_INSTR(Plasma_PlasmaIce_DownRight_UpLeft) , .down_to_right = PROJ_INSTR(Plasma_PlasmaIce_Down_Up) , .down_to_left = PROJ_INSTR(Plasma_PlasmaIce_Down_Up) , .down_left = PROJ_INSTR(Plasma_PlasmaIce_DownLeft_UpRight) , .left = PROJ_INSTR(Plasma_PlasmaIce_Left_Right) , .up_left = PROJ_INSTR(Plasma_PlasmaIce_DownRight_UpLeft) , .up_to_left = PROJ_INSTR(Plasma_PlasmaIce_Down_Up) },
[kProjectileType_Plasma|kProjectileType_Ice|kProjectileType_Wave] = { .damage = 300, .up_to_right = PROJ_INSTR(PlasmaIceWave_Down_Up) , .up_right = PROJ_INSTR(PlasmaIceWave_DownLeft_UpRight) , .right = PROJ_INSTR(PlasmaWave_PlasmaIceWave_Left_Right) , .down_right = PROJ_INSTR(PlasmaIceWave_DownRight_UpLeft) , .down_to_right = PROJ_INSTR(PlasmaIceWave_Down_Up) , .down_to_left = PROJ_INSTR(PlasmaIceWave_Down_Up) , .down_left = PROJ_INSTR(PlasmaIceWave_DownLeft_UpRight) , .left = PROJ_INSTR(PlasmaWave_PlasmaIceWave_Left_Right) , .up_left = PROJ_INSTR(PlasmaIceWave_DownRight_UpLeft) , .up_to_left = PROJ_INSTR(PlasmaIceWave_Down_Up) },
[kProjectileType_Power] = { .damage = 20, .up_face_right = PROJ_INSTR(Power_Up) , .up_right = PROJ_INSTR(Power_UpRight) , .right = PROJ_INSTR(Power_Right) , .down_right = PROJ_INSTR(Power_DownRight) , .down_face_right = PROJ_INSTR(Power_Down) , .down_face_left = PROJ_INSTR(Power_Down) , .down_left = PROJ_INSTR(Power_DownLeft) , .left = PROJ_INSTR(Power_Left) , .up_left = PROJ_INSTR(Power_UpLeft) , .up_face_left = PROJ_INSTR(Power_Up) },
[kProjectileType_Wave] = { .damage = 50, .up_face_right = PROJ_INSTR(Wave_IceWave_Up) , .up_right = PROJ_INSTR(Wave_IceWave_DownLeft_UpRight) , .right = PROJ_INSTR(Wave_IceWave_Left_Right) , .down_right = PROJ_INSTR(Wave_IceWave_DownRight_UpLeft) , .down_face_right = PROJ_INSTR(Wave_IceWave_Down) , .down_face_left = PROJ_INSTR(Wave_IceWave_Down) , .down_left = PROJ_INSTR(Wave_IceWave_DownLeft_UpRight) , .left = PROJ_INSTR(Wave_IceWave_Left_Right) , .up_left = PROJ_INSTR(Wave_IceWave_DownRight_UpLeft) , .up_face_left = PROJ_INSTR(Wave_IceWave_Up) },
[kProjectileType_Ice] = { .damage = 30, .up_face_right = PROJ_INSTR(Ice) , .up_right = PROJ_INSTR(Ice) , .right = PROJ_INSTR(Ice) , .down_right = PROJ_INSTR(Ice) , .down_face_right = PROJ_INSTR(Ice) , .down_face_left = PROJ_INSTR(Ice) , .down_left = PROJ_INSTR(Ice) , .left = PROJ_INSTR(Ice) , .up_left = PROJ_INSTR(Ice) , .up_face_left = PROJ_INSTR(Ice) },
[kProjectileType_Ice|kProjectileType_Wave] = { .damage = 60, .up_face_right = PROJ_INSTR(Wave_IceWave_Up) , .up_right = PROJ_INSTR(Wave_IceWave_DownLeft_UpRight) , .right = PROJ_INSTR(Wave_IceWave_Left_Right) , .down_right = PROJ_INSTR(Wave_IceWave_DownRight_UpLeft) , .down_face_right = PROJ_INSTR(Wave_IceWave_Down) , .down_face_left = PROJ_INSTR(Wave_IceWave_Down) , .down_left = PROJ_INSTR(Wave_IceWave_DownLeft_UpRight) , .left = PROJ_INSTR(Wave_IceWave_Left_Right) , .up_left = PROJ_INSTR(Wave_IceWave_DownRight_UpLeft) , .up_face_left = PROJ_INSTR(Wave_IceWave_Up) },
[kProjectileType_Spazer] = { .damage = 40, .up_face_right = PROJ_INSTR(Spazer_SpazerIce_Up) , .up_right = PROJ_INSTR(Spazer_SpazerIce_UpRight) , .right = PROJ_INSTR(Spazer_SpazerIce_Right) , .down_right = PROJ_INSTR(Spazer_SpazerIce_DownRight) , .down_face_right = PROJ_INSTR(Spazer_SpazerIce_Down) , .down_face_left = PROJ_INSTR(Spazer_SpazerIce_Down) , .down_left = PROJ_INSTR(Spazer_SpazerIce_DownLeft) , .left = PROJ_INSTR(Spazer_SpazerIce_Left) , .up_left = PROJ_INSTR(Spazer_SpazerIce_UpLeft) , .up_face_left = PROJ_INSTR(Spazer_SpazerIce_Up) },
[kProjectileType_Spazer|kProjectileType_Wave] = { .damage = 70, .up_face_right = PROJ_INSTR(SpazerWave_SpazerIceWave_Up) , .up_right = PROJ_INSTR(SpazerWave_SpazerIceWave_UpRight) , .right = PROJ_INSTR(SpazerWave_SpazerIceWave_Right) , .down_right = PROJ_INSTR(SpazerWave_SpazerIceWave_DownRight) , .down_face_right = PROJ_INSTR(SpazerWave_SpazerIceWave_Down) , .down_face_left = PROJ_INSTR(SpazerWave_SpazerIceWave_Down) , .down_left = PROJ_INSTR(SpazerWave_SpazerIceWave_DownLeft) , .left = PROJ_INSTR(SpazerWave_SpazerIceWave_Left) , .up_left = PROJ_INSTR(SpazerWave_SpazerIceWave_UpLeft) , .up_face_left = PROJ_INSTR(SpazerWave_SpazerIceWave_Up) },
[kProjectileType_Spazer|kProjectileType_Ice] = { .damage = 60, .up_face_right = PROJ_INSTR(Spazer_SpazerIce_Up) , .up_right = PROJ_INSTR(Spazer_SpazerIce_UpRight) , .right = PROJ_INSTR(Spazer_SpazerIce_Right) , .down_right = PROJ_INSTR(Spazer_SpazerIce_DownRight) , .down_face_right = PROJ_INSTR(Spazer_SpazerIce_Down) , .down_face_left = PROJ_INSTR(Spazer_SpazerIce_Down) , .down_left = PROJ_INSTR(Spazer_SpazerIce_DownLeft) , .left = PROJ_INSTR(Spazer_SpazerIce_Left) , .up_left = PROJ_INSTR(Spazer_SpazerIce_UpLeft) , .up_face_left = PROJ_INSTR(Spazer_SpazerIce_Up) },
[kProjectileType_Spazer|kProjectileType_Ice|kProjectileType_Wave] = { .damage = 100, .up_face_right = PROJ_INSTR(SpazerWave_SpazerIceWave_Up) , .up_right = PROJ_INSTR(SpazerWave_SpazerIceWave_UpRight) , .right = PROJ_INSTR(SpazerWave_SpazerIceWave_Right) , .down_right = PROJ_INSTR(SpazerWave_SpazerIceWave_DownRight) , .down_face_right = PROJ_INSTR(SpazerWave_SpazerIceWave_Down) , .down_face_left = PROJ_INSTR(SpazerWave_SpazerIceWave_Down) , .down_left = PROJ_INSTR(SpazerWave_SpazerIceWave_DownLeft) , .left = PROJ_INSTR(SpazerWave_SpazerIceWave_Left) , .up_left = PROJ_INSTR(SpazerWave_SpazerIceWave_UpLeft) , .up_face_left = PROJ_INSTR(SpazerWave_SpazerIceWave_Up) },
[kProjectileType_Plasma] = { .damage = 150, .up_face_right = PROJ_INSTR(Plasma_PlasmaIce_Down_Up) , .up_right = PROJ_INSTR(Plasma_PlasmaIce_DownLeft_UpRight) , .right = PROJ_INSTR(Plasma_PlasmaIce_Left_Right) , .down_right = PROJ_INSTR(Plasma_PlasmaIce_DownRight_UpLeft) , .down_face_right = PROJ_INSTR(Plasma_PlasmaIce_Down_Up) , .down_face_left = PROJ_INSTR(Plasma_PlasmaIce_Down_Up) , .down_left = PROJ_INSTR(Plasma_PlasmaIce_DownLeft_UpRight) , .left = PROJ_INSTR(Plasma_PlasmaIce_Left_Right) , .up_left = PROJ_INSTR(Plasma_PlasmaIce_DownRight_UpLeft) , .up_face_left = PROJ_INSTR(Plasma_PlasmaIce_Down_Up) },
[kProjectileType_Plasma|kProjectileType_Wave] = { .damage = 250, .up_face_right = PROJ_INSTR(PlasmaWave_Down_Up) , .up_right = PROJ_INSTR(PlasmaWave_DownLeft_UpRight) , .right = PROJ_INSTR(PlasmaWave_PlasmaIceWave_Left_Right) , .down_right = PROJ_INSTR(PlasmaWave_DownRight_UpLeft) , .down_face_right = PROJ_INSTR(PlasmaWave_Down_Up) , .down_face_left = PROJ_INSTR(PlasmaWave_Down_Up) , .down_left = PROJ_INSTR(PlasmaWave_DownLeft_UpRight) , .left = PROJ_INSTR(PlasmaWave_PlasmaIceWave_Left_Right) , .up_left = PROJ_INSTR(PlasmaWave_DownRight_UpLeft) , .up_face_left = PROJ_INSTR(PlasmaWave_Down_Up) },
[kProjectileType_Plasma|kProjectileType_Ice] = { .damage = 200, .up_face_right = PROJ_INSTR(Plasma_PlasmaIce_Down_Up) , .up_right = PROJ_INSTR(Plasma_PlasmaIce_DownLeft_UpRight) , .right = PROJ_INSTR(Plasma_PlasmaIce_Left_Right) , .down_right = PROJ_INSTR(Plasma_PlasmaIce_DownRight_UpLeft) , .down_face_right = PROJ_INSTR(Plasma_PlasmaIce_Down_Up) , .down_face_left = PROJ_INSTR(Plasma_PlasmaIce_Down_Up) , .down_left = PROJ_INSTR(Plasma_PlasmaIce_DownLeft_UpRight) , .left = PROJ_INSTR(Plasma_PlasmaIce_Left_Right) , .up_left = PROJ_INSTR(Plasma_PlasmaIce_DownRight_UpLeft) , .up_face_left = PROJ_INSTR(Plasma_PlasmaIce_Down_Up) },
[kProjectileType_Plasma|kProjectileType_Ice|kProjectileType_Wave] = { .damage = 300, .up_face_right = PROJ_INSTR(PlasmaIceWave_Down_Up) , .up_right = PROJ_INSTR(PlasmaIceWave_DownLeft_UpRight) , .right = PROJ_INSTR(PlasmaWave_PlasmaIceWave_Left_Right) , .down_right = PROJ_INSTR(PlasmaIceWave_DownRight_UpLeft) , .down_face_right = PROJ_INSTR(PlasmaIceWave_Down_Up) , .down_face_left = PROJ_INSTR(PlasmaIceWave_Down_Up) , .down_left = PROJ_INSTR(PlasmaIceWave_DownLeft_UpRight) , .left = PROJ_INSTR(PlasmaWave_PlasmaIceWave_Left_Right) , .up_left = PROJ_INSTR(PlasmaIceWave_DownRight_UpLeft) , .up_face_left = PROJ_INSTR(PlasmaIceWave_Down_Up) },
};
static const ProjectileDataTable kProjectileData_ChargedBeams[] = { // 0x9383D9
[kProjectileType_Power] = { .damage = 60, .up_to_right = PROJ_INSTR(Charged_Power_Up) , .up_right = PROJ_INSTR(Charged_Power_UpRight) , .right = PROJ_INSTR(Charged_Power_Right) , .down_right = PROJ_INSTR(Charged_Power_DownRight) , .down_to_right = PROJ_INSTR(Charged_Power_Down) , .down_to_left = PROJ_INSTR(Charged_Power_Down) , .down_left = PROJ_INSTR(Charged_Power_DownLeft) , .left = PROJ_INSTR(Charged_Power_Left) , .up_left = PROJ_INSTR(Charged_Power_UpLeft) , .up_to_left = PROJ_INSTR(Charged_Power_Up) },
[kProjectileType_Wave] = { .damage = 150, .up_to_right = PROJ_INSTR(Charged_Wave_Up) , .up_right = PROJ_INSTR(Charged_Wave_DownLeft_UpRight) , .right = PROJ_INSTR(Charged_Wave_Left_Right) , .down_right = PROJ_INSTR(Charged_Wave_DownRight_UpLeft) , .down_to_right = PROJ_INSTR(Charged_Wave_Down) , .down_to_left = PROJ_INSTR(Charged_Wave_Down) , .down_left = PROJ_INSTR(Charged_Wave_DownLeft_UpRight) , .left = PROJ_INSTR(Charged_Wave_Left_Right) , .up_left = PROJ_INSTR(Charged_Wave_DownRight_UpLeft) , .up_to_left = PROJ_INSTR(Charged_Wave_Up) },
[kProjectileType_Ice] = { .damage = 90, .up_to_right = PROJ_INSTR(Charged_Ice) , .up_right = PROJ_INSTR(Charged_Ice) , .right = PROJ_INSTR(Charged_Ice) , .down_right = PROJ_INSTR(Charged_Ice) , .down_to_right = PROJ_INSTR(Charged_Ice) , .down_to_left = PROJ_INSTR(Charged_Ice) , .down_left = PROJ_INSTR(Charged_Ice) , .left = PROJ_INSTR(Charged_Ice) , .up_left = PROJ_INSTR(Charged_Ice) , .up_to_left = PROJ_INSTR(Charged_Ice) },
[kProjectileType_Ice|kProjectileType_Wave] = { .damage = 180, .up_to_right = PROJ_INSTR(Charged_IceWave_Up) , .up_right = PROJ_INSTR(Charged_IceWave_DownLeft_UpRight) , .right = PROJ_INSTR(Charged_IceWave_Left_Right) , .down_right = PROJ_INSTR(Charged_IceWave_DownRight_UpLeft) , .down_to_right = PROJ_INSTR(Charged_IceWave_Down) , .down_to_left = PROJ_INSTR(Charged_IceWave_Down) , .down_left = PROJ_INSTR(Charged_IceWave_DownLeft_UpRight) , .left = PROJ_INSTR(Charged_IceWave_Left_Right) , .up_left = PROJ_INSTR(Charged_IceWave_DownRight_UpLeft) , .up_to_left = PROJ_INSTR(Charged_IceWave_Up) },
[kProjectileType_Spazer] = { .damage = 120, .up_to_right = PROJ_INSTR(Charged_Spazer_SpazerIce_Down_Up) , .up_right = PROJ_INSTR(Charged_Spazer_SpazerIce_DownLeft_UpRight) , .right = PROJ_INSTR(Charged_Spazer_SpazerIce_Left_Right) , .down_right = PROJ_INSTR(Charged_Spazer_SpazerIce_DownRight_UpLeft) , .down_to_right = PROJ_INSTR(Charged_Spazer_SpazerIce_Down_Up) , .down_to_left = PROJ_INSTR(Charged_Spazer_SpazerIce_Down_Up) , .down_left = PROJ_INSTR(Charged_Spazer_SpazerIce_DownLeft_UpRight) , .left = PROJ_INSTR(Charged_Spazer_SpazerIce_Left_Right) , .up_left = PROJ_INSTR(Charged_Spazer_SpazerIce_DownRight_UpLeft) , .up_to_left = PROJ_INSTR(Charged_Spazer_SpazerIce_Down_Up) },
[kProjectileType_Spazer|kProjectileType_Wave] = { .damage = 210, .up_to_right = PROJ_INSTR(Charged_SpazerWave_SpazerIceWave_Up) , .up_right = PROJ_INSTR(Charged_SpazerWave_SpazerIceWave_UpRight) , .right = PROJ_INSTR(Charged_SpazerWave_SpazerIceWave_Right) , .down_right = PROJ_INSTR(Charged_SpazerWave_SpazerIceWave_DownRight) , .down_to_right = PROJ_INSTR(Charged_SpazerWave_SpazerIceWave_Down) , .down_to_left = PROJ_INSTR(Charged_SpazerWave_SpazerIceWave_Down) , .down_left = PROJ_INSTR(Charged_SpazerWave_SpazerIceWave_DownLeft) , .left = PROJ_INSTR(Charged_SpazerWave_SpazerIceWave_Left) , .up_left = PROJ_INSTR(Charged_SpazerWave_SpazerIceWave_UpLeft) , .up_to_left = PROJ_INSTR(Charged_SpazerWave_SpazerIceWave_Up) },
[kProjectileType_Spazer|kProjectileType_Ice] = { .damage = 180, .up_to_right = PROJ_INSTR(Charged_Spazer_SpazerIce_Down_Up) , .up_right = PROJ_INSTR(Charged_Spazer_SpazerIce_DownLeft_UpRight) , .right = PROJ_INSTR(Charged_Spazer_SpazerIce_Left_Right) , .down_right = PROJ_INSTR(Charged_Spazer_SpazerIce_DownRight_UpLeft) , .down_to_right = PROJ_INSTR(Charged_Spazer_SpazerIce_Down_Up) , .down_to_left = PROJ_INSTR(Charged_Spazer_SpazerIce_Down_Up) , .down_left = PROJ_INSTR(Charged_Spazer_SpazerIce_DownLeft_UpRight) , .left = PROJ_INSTR(Charged_Spazer_SpazerIce_Left_Right) , .up_left = PROJ_INSTR(Charged_Spazer_SpazerIce_DownRight_UpLeft) , .up_to_left = PROJ_INSTR(Charged_Spazer_SpazerIce_Down_Up) },
[kProjectileType_Spazer|kProjectileType_Ice|kProjectileType_Wave] = { .damage = 300, .up_to_right = PROJ_INSTR(Charged_SpazerWave_SpazerIceWave_Up) , .up_right = PROJ_INSTR(Charged_SpazerWave_SpazerIceWave_UpRight) , .right = PROJ_INSTR(Charged_SpazerWave_SpazerIceWave_Right) , .down_right = PROJ_INSTR(Charged_SpazerWave_SpazerIceWave_DownRight) , .down_to_right = PROJ_INSTR(Charged_SpazerWave_SpazerIceWave_Down) , .down_to_left = PROJ_INSTR(Charged_SpazerWave_SpazerIceWave_Down) , .down_left = PROJ_INSTR(Charged_SpazerWave_SpazerIceWave_DownLeft) , .left = PROJ_INSTR(Charged_SpazerWave_SpazerIceWave_Left) , .up_left = PROJ_INSTR(Charged_SpazerWave_SpazerIceWave_UpLeft) , .up_to_left = PROJ_INSTR(Charged_SpazerWave_SpazerIceWave_Up) },
[kProjectileType_Plasma] = { .damage = 450, .up_to_right = PROJ_INSTR(Charged_Plasma_PlasmaIce_Down_Up) , .up_right = PROJ_INSTR(Charged_Plasma_PlasmaIce_DownLeft_UpRight) , .right = PROJ_INSTR(Charged_Plasma_PlasmaIce_Left_Right) , .down_right = PROJ_INSTR(Charged_Plasma_PlasmaIce_DownRight_UpLeft) , .down_to_right = PROJ_INSTR(Charged_Plasma_PlasmaIce_Down_Up) , .down_to_left = PROJ_INSTR(Charged_Plasma_PlasmaIce_Down_Up) , .down_left = PROJ_INSTR(Charged_Plasma_PlasmaIce_DownLeft_UpRight) , .left = PROJ_INSTR(Charged_Plasma_PlasmaIce_Left_Right) , .up_left = PROJ_INSTR(Charged_Plasma_PlasmaIce_DownRight_UpLeft) , .up_to_left = PROJ_INSTR(Charged_Plasma_PlasmaIce_Down_Up) },
[kProjectileType_Plasma|kProjectileType_Wave] = { .damage = 750, .up_to_right = PROJ_INSTR(Charged_PlasmaWave_PlasmaIceWave_Down_Up) , .up_right = PROJ_INSTR(Charged_PlasmaWave_PlasmaIceWave_DownLeft_UpRight) , .right = PROJ_INSTR(Charged_PlasmaWave_PlasmaIceWave_Left_Right) , .down_right = PROJ_INSTR(Charged_PlasmaWave_PlasmaIceWave_DownRight_UpLeft) , .down_to_right = PROJ_INSTR(Charged_PlasmaWave_PlasmaIceWave_Down_Up) , .down_to_left = PROJ_INSTR(Charged_PlasmaWave_PlasmaIceWave_Down_Up) , .down_left = PROJ_INSTR(Charged_PlasmaWave_PlasmaIceWave_DownLeft_UpRight) , .left = PROJ_INSTR(Charged_PlasmaWave_PlasmaIceWave_Left_Right) , .up_left = PROJ_INSTR(Charged_PlasmaWave_PlasmaIceWave_DownRight_UpLeft) , .up_to_left = PROJ_INSTR(Charged_PlasmaWave_PlasmaIceWave_Down_Up) },
[kProjectileType_Plasma|kProjectileType_Ice] = { .damage = 600, .up_to_right = PROJ_INSTR(Charged_Plasma_PlasmaIce_Down_Up) , .up_right = PROJ_INSTR(Charged_Plasma_PlasmaIce_DownLeft_UpRight) , .right = PROJ_INSTR(Charged_Plasma_PlasmaIce_Left_Right) , .down_right = PROJ_INSTR(Charged_Plasma_PlasmaIce_DownRight_UpLeft) , .down_to_right = PROJ_INSTR(Charged_Plasma_PlasmaIce_Down_Up) , .down_to_left = PROJ_INSTR(Charged_Plasma_PlasmaIce_Down_Up) , .down_left = PROJ_INSTR(Charged_Plasma_PlasmaIce_DownLeft_UpRight) , .left = PROJ_INSTR(Charged_Plasma_PlasmaIce_Left_Right) , .up_left = PROJ_INSTR(Charged_Plasma_PlasmaIce_DownRight_UpLeft) , .up_to_left = PROJ_INSTR(Charged_Plasma_PlasmaIce_Down_Up) },
[kProjectileType_Plasma|kProjectileType_Ice|kProjectileType_Wave] = { .damage = 900, .up_to_right = PROJ_INSTR(Charged_PlasmaWave_PlasmaIceWave_Down_Up) , .up_right = PROJ_INSTR(Charged_PlasmaWave_PlasmaIceWave_DownLeft_UpRight) , .right = PROJ_INSTR(Charged_PlasmaWave_PlasmaIceWave_Left_Right) , .down_right = PROJ_INSTR(Charged_PlasmaWave_PlasmaIceWave_DownRight_UpLeft) , .down_to_right = PROJ_INSTR(Charged_PlasmaWave_PlasmaIceWave_Down_Up) , .down_to_left = PROJ_INSTR(Charged_PlasmaWave_PlasmaIceWave_Down_Up) , .down_left = PROJ_INSTR(Charged_PlasmaWave_PlasmaIceWave_DownLeft_UpRight) , .left = PROJ_INSTR(Charged_PlasmaWave_PlasmaIceWave_Left_Right) , .up_left = PROJ_INSTR(Charged_PlasmaWave_PlasmaIceWave_DownRight_UpLeft) , .up_to_left = PROJ_INSTR(Charged_PlasmaWave_PlasmaIceWave_Down_Up) },
[kProjectileType_Power] = { .damage = 60, .up_face_right = PROJ_INSTR(Charged_Power_Up) , .up_right = PROJ_INSTR(Charged_Power_UpRight) , .right = PROJ_INSTR(Charged_Power_Right) , .down_right = PROJ_INSTR(Charged_Power_DownRight) , .down_face_right = PROJ_INSTR(Charged_Power_Down) , .down_face_left = PROJ_INSTR(Charged_Power_Down) , .down_left = PROJ_INSTR(Charged_Power_DownLeft) , .left = PROJ_INSTR(Charged_Power_Left) , .up_left = PROJ_INSTR(Charged_Power_UpLeft) , .up_face_left = PROJ_INSTR(Charged_Power_Up) },
[kProjectileType_Wave] = { .damage = 150, .up_face_right = PROJ_INSTR(Charged_Wave_Up) , .up_right = PROJ_INSTR(Charged_Wave_DownLeft_UpRight) , .right = PROJ_INSTR(Charged_Wave_Left_Right) , .down_right = PROJ_INSTR(Charged_Wave_DownRight_UpLeft) , .down_face_right = PROJ_INSTR(Charged_Wave_Down) , .down_face_left = PROJ_INSTR(Charged_Wave_Down) , .down_left = PROJ_INSTR(Charged_Wave_DownLeft_UpRight) , .left = PROJ_INSTR(Charged_Wave_Left_Right) , .up_left = PROJ_INSTR(Charged_Wave_DownRight_UpLeft) , .up_face_left = PROJ_INSTR(Charged_Wave_Up) },
[kProjectileType_Ice] = { .damage = 90, .up_face_right = PROJ_INSTR(Charged_Ice) , .up_right = PROJ_INSTR(Charged_Ice) , .right = PROJ_INSTR(Charged_Ice) , .down_right = PROJ_INSTR(Charged_Ice) , .down_face_right = PROJ_INSTR(Charged_Ice) , .down_face_left = PROJ_INSTR(Charged_Ice) , .down_left = PROJ_INSTR(Charged_Ice) , .left = PROJ_INSTR(Charged_Ice) , .up_left = PROJ_INSTR(Charged_Ice) , .up_face_left = PROJ_INSTR(Charged_Ice) },
[kProjectileType_Ice|kProjectileType_Wave] = { .damage = 180, .up_face_right = PROJ_INSTR(Charged_IceWave_Up) , .up_right = PROJ_INSTR(Charged_IceWave_DownLeft_UpRight) , .right = PROJ_INSTR(Charged_IceWave_Left_Right) , .down_right = PROJ_INSTR(Charged_IceWave_DownRight_UpLeft) , .down_face_right = PROJ_INSTR(Charged_IceWave_Down) , .down_face_left = PROJ_INSTR(Charged_IceWave_Down) , .down_left = PROJ_INSTR(Charged_IceWave_DownLeft_UpRight) , .left = PROJ_INSTR(Charged_IceWave_Left_Right) , .up_left = PROJ_INSTR(Charged_IceWave_DownRight_UpLeft) , .up_face_left = PROJ_INSTR(Charged_IceWave_Up) },
[kProjectileType_Spazer] = { .damage = 120, .up_face_right = PROJ_INSTR(Charged_Spazer_SpazerIce_Down_Up) , .up_right = PROJ_INSTR(Charged_Spazer_SpazerIce_DownLeft_UpRight) , .right = PROJ_INSTR(Charged_Spazer_SpazerIce_Left_Right) , .down_right = PROJ_INSTR(Charged_Spazer_SpazerIce_DownRight_UpLeft) , .down_face_right = PROJ_INSTR(Charged_Spazer_SpazerIce_Down_Up) , .down_face_left = PROJ_INSTR(Charged_Spazer_SpazerIce_Down_Up) , .down_left = PROJ_INSTR(Charged_Spazer_SpazerIce_DownLeft_UpRight) , .left = PROJ_INSTR(Charged_Spazer_SpazerIce_Left_Right) , .up_left = PROJ_INSTR(Charged_Spazer_SpazerIce_DownRight_UpLeft) , .up_face_left = PROJ_INSTR(Charged_Spazer_SpazerIce_Down_Up) },
[kProjectileType_Spazer|kProjectileType_Wave] = { .damage = 210, .up_face_right = PROJ_INSTR(Charged_SpazerWave_SpazerIceWave_Up) , .up_right = PROJ_INSTR(Charged_SpazerWave_SpazerIceWave_UpRight) , .right = PROJ_INSTR(Charged_SpazerWave_SpazerIceWave_Right) , .down_right = PROJ_INSTR(Charged_SpazerWave_SpazerIceWave_DownRight) , .down_face_right = PROJ_INSTR(Charged_SpazerWave_SpazerIceWave_Down) , .down_face_left = PROJ_INSTR(Charged_SpazerWave_SpazerIceWave_Down) , .down_left = PROJ_INSTR(Charged_SpazerWave_SpazerIceWave_DownLeft) , .left = PROJ_INSTR(Charged_SpazerWave_SpazerIceWave_Left) , .up_left = PROJ_INSTR(Charged_SpazerWave_SpazerIceWave_UpLeft) , .up_face_left = PROJ_INSTR(Charged_SpazerWave_SpazerIceWave_Up) },
[kProjectileType_Spazer|kProjectileType_Ice] = { .damage = 180, .up_face_right = PROJ_INSTR(Charged_Spazer_SpazerIce_Down_Up) , .up_right = PROJ_INSTR(Charged_Spazer_SpazerIce_DownLeft_UpRight) , .right = PROJ_INSTR(Charged_Spazer_SpazerIce_Left_Right) , .down_right = PROJ_INSTR(Charged_Spazer_SpazerIce_DownRight_UpLeft) , .down_face_right = PROJ_INSTR(Charged_Spazer_SpazerIce_Down_Up) , .down_face_left = PROJ_INSTR(Charged_Spazer_SpazerIce_Down_Up) , .down_left = PROJ_INSTR(Charged_Spazer_SpazerIce_DownLeft_UpRight) , .left = PROJ_INSTR(Charged_Spazer_SpazerIce_Left_Right) , .up_left = PROJ_INSTR(Charged_Spazer_SpazerIce_DownRight_UpLeft) , .up_face_left = PROJ_INSTR(Charged_Spazer_SpazerIce_Down_Up) },
[kProjectileType_Spazer|kProjectileType_Ice|kProjectileType_Wave] = { .damage = 300, .up_face_right = PROJ_INSTR(Charged_SpazerWave_SpazerIceWave_Up) , .up_right = PROJ_INSTR(Charged_SpazerWave_SpazerIceWave_UpRight) , .right = PROJ_INSTR(Charged_SpazerWave_SpazerIceWave_Right) , .down_right = PROJ_INSTR(Charged_SpazerWave_SpazerIceWave_DownRight) , .down_face_right = PROJ_INSTR(Charged_SpazerWave_SpazerIceWave_Down) , .down_face_left = PROJ_INSTR(Charged_SpazerWave_SpazerIceWave_Down) , .down_left = PROJ_INSTR(Charged_SpazerWave_SpazerIceWave_DownLeft) , .left = PROJ_INSTR(Charged_SpazerWave_SpazerIceWave_Left) , .up_left = PROJ_INSTR(Charged_SpazerWave_SpazerIceWave_UpLeft) , .up_face_left = PROJ_INSTR(Charged_SpazerWave_SpazerIceWave_Up) },
[kProjectileType_Plasma] = { .damage = 450, .up_face_right = PROJ_INSTR(Charged_Plasma_PlasmaIce_Down_Up) , .up_right = PROJ_INSTR(Charged_Plasma_PlasmaIce_DownLeft_UpRight) , .right = PROJ_INSTR(Charged_Plasma_PlasmaIce_Left_Right) , .down_right = PROJ_INSTR(Charged_Plasma_PlasmaIce_DownRight_UpLeft) , .down_face_right = PROJ_INSTR(Charged_Plasma_PlasmaIce_Down_Up) , .down_face_left = PROJ_INSTR(Charged_Plasma_PlasmaIce_Down_Up) , .down_left = PROJ_INSTR(Charged_Plasma_PlasmaIce_DownLeft_UpRight) , .left = PROJ_INSTR(Charged_Plasma_PlasmaIce_Left_Right) , .up_left = PROJ_INSTR(Charged_Plasma_PlasmaIce_DownRight_UpLeft) , .up_face_left = PROJ_INSTR(Charged_Plasma_PlasmaIce_Down_Up) },
[kProjectileType_Plasma|kProjectileType_Wave] = { .damage = 750, .up_face_right = PROJ_INSTR(Charged_PlasmaWave_PlasmaIceWave_Down_Up) , .up_right = PROJ_INSTR(Charged_PlasmaWave_PlasmaIceWave_DownLeft_UpRight) , .right = PROJ_INSTR(Charged_PlasmaWave_PlasmaIceWave_Left_Right) , .down_right = PROJ_INSTR(Charged_PlasmaWave_PlasmaIceWave_DownRight_UpLeft) , .down_face_right = PROJ_INSTR(Charged_PlasmaWave_PlasmaIceWave_Down_Up) , .down_face_left = PROJ_INSTR(Charged_PlasmaWave_PlasmaIceWave_Down_Up) , .down_left = PROJ_INSTR(Charged_PlasmaWave_PlasmaIceWave_DownLeft_UpRight) , .left = PROJ_INSTR(Charged_PlasmaWave_PlasmaIceWave_Left_Right) , .up_left = PROJ_INSTR(Charged_PlasmaWave_PlasmaIceWave_DownRight_UpLeft) , .up_face_left = PROJ_INSTR(Charged_PlasmaWave_PlasmaIceWave_Down_Up) },
[kProjectileType_Plasma|kProjectileType_Ice] = { .damage = 600, .up_face_right = PROJ_INSTR(Charged_Plasma_PlasmaIce_Down_Up) , .up_right = PROJ_INSTR(Charged_Plasma_PlasmaIce_DownLeft_UpRight) , .right = PROJ_INSTR(Charged_Plasma_PlasmaIce_Left_Right) , .down_right = PROJ_INSTR(Charged_Plasma_PlasmaIce_DownRight_UpLeft) , .down_face_right = PROJ_INSTR(Charged_Plasma_PlasmaIce_Down_Up) , .down_face_left = PROJ_INSTR(Charged_Plasma_PlasmaIce_Down_Up) , .down_left = PROJ_INSTR(Charged_Plasma_PlasmaIce_DownLeft_UpRight) , .left = PROJ_INSTR(Charged_Plasma_PlasmaIce_Left_Right) , .up_left = PROJ_INSTR(Charged_Plasma_PlasmaIce_DownRight_UpLeft) , .up_face_left = PROJ_INSTR(Charged_Plasma_PlasmaIce_Down_Up) },
[kProjectileType_Plasma|kProjectileType_Ice|kProjectileType_Wave] = { .damage = 900, .up_face_right = PROJ_INSTR(Charged_PlasmaWave_PlasmaIceWave_Down_Up) , .up_right = PROJ_INSTR(Charged_PlasmaWave_PlasmaIceWave_DownLeft_UpRight) , .right = PROJ_INSTR(Charged_PlasmaWave_PlasmaIceWave_Left_Right) , .down_right = PROJ_INSTR(Charged_PlasmaWave_PlasmaIceWave_DownRight_UpLeft) , .down_face_right = PROJ_INSTR(Charged_PlasmaWave_PlasmaIceWave_Down_Up) , .down_face_left = PROJ_INSTR(Charged_PlasmaWave_PlasmaIceWave_Down_Up) , .down_left = PROJ_INSTR(Charged_PlasmaWave_PlasmaIceWave_DownLeft_UpRight) , .left = PROJ_INSTR(Charged_PlasmaWave_PlasmaIceWave_Left_Right) , .up_left = PROJ_INSTR(Charged_PlasmaWave_PlasmaIceWave_DownRight_UpLeft) , .up_face_left = PROJ_INSTR(Charged_PlasmaWave_PlasmaIceWave_Down_Up) },
};
static const ProjectileDataTable kProjectileData_NonBeams[] = { // 0x9383F1
[0] = { .damage = 100, .up_to_right = PROJ_INSTR(Missiles_Up) , .up_right = PROJ_INSTR(Missiles_UpRight) , .right = PROJ_INSTR(Missiles_Right) , .down_right = PROJ_INSTR(Missiles_DownRight) , .down_to_right = PROJ_INSTR(Missiles_Down) , .down_to_left = PROJ_INSTR(Missiles_Down) , .down_left = PROJ_INSTR(Missiles_DownLeft) , .left = PROJ_INSTR(Missiles_Left) , .up_left = PROJ_INSTR(Missiles_UpLeft) , .up_to_left = PROJ_INSTR(Missiles_Up) },
[kProjectileType_Missile>>8] = { .damage = 100, .up_to_right = PROJ_INSTR(Missiles_Up) , .up_right = PROJ_INSTR(Missiles_UpRight) , .right = PROJ_INSTR(Missiles_Right) , .down_right = PROJ_INSTR(Missiles_DownRight) , .down_to_right = PROJ_INSTR(Missiles_Down) , .down_to_left = PROJ_INSTR(Missiles_Down) , .down_left = PROJ_INSTR(Missiles_DownLeft) , .left = PROJ_INSTR(Missiles_Left) , .up_left = PROJ_INSTR(Missiles_UpLeft) , .up_to_left = PROJ_INSTR(Missiles_Up) },
[kProjectileType_SuperMissile>>8] = { .damage = 300, .up_to_right = PROJ_INSTR(SuperMissile_Up) , .up_right = PROJ_INSTR(SuperMissile_UpRight) , .right = PROJ_INSTR(SuperMissile_Right) , .down_right = PROJ_INSTR(SuperMissile_DownRight) , .down_to_right = PROJ_INSTR(SuperMissile_Down) , .down_to_left = PROJ_INSTR(SuperMissile_Down) , .down_left = PROJ_INSTR(SuperMissile_DownLeft) , .left = PROJ_INSTR(SuperMissile_Left) , .up_left = PROJ_INSTR(SuperMissile_UpLeft) , .up_to_left = PROJ_INSTR(SuperMissile_Up) },
[0] = { .damage = 100, .up_face_right = PROJ_INSTR(Missiles_Up) , .up_right = PROJ_INSTR(Missiles_UpRight) , .right = PROJ_INSTR(Missiles_Right) , .down_right = PROJ_INSTR(Missiles_DownRight) , .down_face_right = PROJ_INSTR(Missiles_Down) , .down_face_left = PROJ_INSTR(Missiles_Down) , .down_left = PROJ_INSTR(Missiles_DownLeft) , .left = PROJ_INSTR(Missiles_Left) , .up_left = PROJ_INSTR(Missiles_UpLeft) , .up_face_left = PROJ_INSTR(Missiles_Up) },
[kProjectileType_Missile>>8] = { .damage = 100, .up_face_right = PROJ_INSTR(Missiles_Up) , .up_right = PROJ_INSTR(Missiles_UpRight) , .right = PROJ_INSTR(Missiles_Right) , .down_right = PROJ_INSTR(Missiles_DownRight) , .down_face_right = PROJ_INSTR(Missiles_Down) , .down_face_left = PROJ_INSTR(Missiles_Down) , .down_left = PROJ_INSTR(Missiles_DownLeft) , .left = PROJ_INSTR(Missiles_Left) , .up_left = PROJ_INSTR(Missiles_UpLeft) , .up_face_left = PROJ_INSTR(Missiles_Up) },
[kProjectileType_SuperMissile>>8] = { .damage = 300, .up_face_right = PROJ_INSTR(SuperMissile_Up) , .up_right = PROJ_INSTR(SuperMissile_UpRight) , .right = PROJ_INSTR(SuperMissile_Right) , .down_right = PROJ_INSTR(SuperMissile_DownRight) , .down_face_right = PROJ_INSTR(SuperMissile_Down) , .down_face_left = PROJ_INSTR(SuperMissile_Down) , .down_left = PROJ_INSTR(SuperMissile_DownLeft) , .left = PROJ_INSTR(SuperMissile_Left) , .up_left = PROJ_INSTR(SuperMissile_UpLeft) , .up_face_left = PROJ_INSTR(SuperMissile_Up) },
[kProjectileType_PowerBomb>>8] = { .damage = 200, .instr_ptrs[0] = PROJ_INSTR(PowerBomb) },
[4] = { .damage = 100, .up_to_right = PROJ_INSTR(Missiles_Up) , .up_right = PROJ_INSTR(Missiles_UpRight) , .right = PROJ_INSTR(Missiles_Right) , .down_right = PROJ_INSTR(Missiles_DownRight) , .down_to_right = PROJ_INSTR(Missiles_Down) , .down_to_left = PROJ_INSTR(Missiles_Down) , .down_left = PROJ_INSTR(Missiles_DownLeft) , .left = PROJ_INSTR(Missiles_Left) , .up_left = PROJ_INSTR(Missiles_UpLeft) , .up_to_left = PROJ_INSTR(Missiles_Up) },
[4] = { .damage = 100, .up_face_right = PROJ_INSTR(Missiles_Up) , .up_right = PROJ_INSTR(Missiles_UpRight) , .right = PROJ_INSTR(Missiles_Right) , .down_right = PROJ_INSTR(Missiles_DownRight) , .down_face_right = PROJ_INSTR(Missiles_Down) , .down_face_left = PROJ_INSTR(Missiles_Down) , .down_left = PROJ_INSTR(Missiles_DownLeft) , .left = PROJ_INSTR(Missiles_Left) , .up_left = PROJ_INSTR(Missiles_UpLeft) , .up_face_left = PROJ_INSTR(Missiles_Up) },
[kProjectileType_Bomb>>8] = { .damage = 30, .instr_ptrs[0] = PROJ_INSTR(Bomb) },
[6] = { .damage = 100, .up_to_right = PROJ_INSTR(Missiles_Up) , .up_right = PROJ_INSTR(Missiles_UpRight) , .right = PROJ_INSTR(Missiles_Right) , .down_right = PROJ_INSTR(Missiles_DownRight) , .down_to_right = PROJ_INSTR(Missiles_Down) , .down_to_left = PROJ_INSTR(Missiles_Down) , .down_left = PROJ_INSTR(Missiles_DownLeft) , .left = PROJ_INSTR(Missiles_Left) , .up_left = PROJ_INSTR(Missiles_UpLeft) , .up_to_left = PROJ_INSTR(Missiles_Up) },
[6] = { .damage = 100, .up_face_right = PROJ_INSTR(Missiles_Up) , .up_right = PROJ_INSTR(Missiles_UpRight) , .right = PROJ_INSTR(Missiles_Right) , .down_right = PROJ_INSTR(Missiles_DownRight) , .down_face_right = PROJ_INSTR(Missiles_Down) , .down_face_left = PROJ_INSTR(Missiles_Down) , .down_left = PROJ_INSTR(Missiles_DownLeft) , .left = PROJ_INSTR(Missiles_Left) , .up_left = PROJ_INSTR(Missiles_UpLeft) , .up_face_left = PROJ_INSTR(Missiles_Up) },
[kProjectileType_BeamExplosion>>8] = { .damage = 8, .instr_ptrs[0] = PROJ_INSTR(BeamExplosion) },
[kProjectileType_MissileExplosion>>8] = { .damage = 8, .instr_ptrs[0] = PROJ_INSTR(MissileExplosion) },
};
@ -52,12 +52,12 @@ static const ProjectileDataTable kProjectileData_NonBeams[] = { // 0x9383F1
static const ProjectileDataTable kProjectileData_ShinesparkEchoSpazerSba[] = { // 0x938403
[0] = { 0 },
[1] = { 0 },
[kProjectileType_SpazerSbaTrail-34] = { .damage = 300, .up_to_right = PROJ_INSTR(Spazer_SBA_Trail) , .up_right = PROJ_INSTR(Spazer_SBA_Trail) , .right = PROJ_INSTR(Spazer_SBA_Trail) , .down_right = PROJ_INSTR(Spazer_SBA_Trail) , .down_to_right = PROJ_INSTR(Spazer_SBA_Trail) , .down_to_left = PROJ_INSTR(Spazer_SBA_Trail) , .down_left = PROJ_INSTR(Spazer_SBA_Trail) , .left = PROJ_INSTR(Spazer_SBA_Trail) , .up_left = PROJ_INSTR(Spazer_SBA_Trail) , .up_to_left = PROJ_INSTR(Spazer_SBA_Trail) },
[3] = { .damage = 61440, .up_to_right = PROJ_INSTR(UnusedProjectile_25h) , .up_right = PROJ_INSTR(UnusedProjectile_25h) , .right = PROJ_INSTR(UnusedProjectile_25h) , .down_right = PROJ_INSTR(UnusedProjectile_25h) , .down_to_right = PROJ_INSTR(UnusedProjectile_25h) , .down_to_left = PROJ_INSTR(UnusedProjectile_25h) , .down_left = PROJ_INSTR(UnusedProjectile_25h) , .left = PROJ_INSTR(UnusedProjectile_25h) , .up_left = PROJ_INSTR(UnusedProjectile_25h) , .up_to_left = PROJ_INSTR(UnusedProjectile_25h) },
[4] = { .damage = 300, .up_to_right = PROJ_INSTR(Spazer_SBA_Trail) , .up_right = PROJ_INSTR(Spazer_SBA_Trail) , .right = PROJ_INSTR(Spazer_SBA_Trail) , .down_right = PROJ_INSTR(Spazer_SBA_Trail) , .down_to_right = PROJ_INSTR(Spazer_SBA_Trail) , .down_to_left = PROJ_INSTR(Spazer_SBA_Trail) , .down_left = PROJ_INSTR(Spazer_SBA_Trail) , .left = PROJ_INSTR(Spazer_SBA_Trail) , .up_left = PROJ_INSTR(Spazer_SBA_Trail) , .up_to_left = PROJ_INSTR(Spazer_SBA_Trail) },
[kProjectileType_SpazerSbaTrail-34] = { .damage = 300, .up_face_right = PROJ_INSTR(Spazer_SBA_Trail) , .up_right = PROJ_INSTR(Spazer_SBA_Trail) , .right = PROJ_INSTR(Spazer_SBA_Trail) , .down_right = PROJ_INSTR(Spazer_SBA_Trail) , .down_face_right = PROJ_INSTR(Spazer_SBA_Trail) , .down_face_left = PROJ_INSTR(Spazer_SBA_Trail) , .down_left = PROJ_INSTR(Spazer_SBA_Trail) , .left = PROJ_INSTR(Spazer_SBA_Trail) , .up_left = PROJ_INSTR(Spazer_SBA_Trail) , .up_face_left = PROJ_INSTR(Spazer_SBA_Trail) },
[3] = { .damage = 61440, .up_face_right = PROJ_INSTR(UnusedProjectile_25h) , .up_right = PROJ_INSTR(UnusedProjectile_25h) , .right = PROJ_INSTR(UnusedProjectile_25h) , .down_right = PROJ_INSTR(UnusedProjectile_25h) , .down_face_right = PROJ_INSTR(UnusedProjectile_25h) , .down_face_left = PROJ_INSTR(UnusedProjectile_25h) , .down_left = PROJ_INSTR(UnusedProjectile_25h) , .left = PROJ_INSTR(UnusedProjectile_25h) , .up_left = PROJ_INSTR(UnusedProjectile_25h) , .up_face_left = PROJ_INSTR(UnusedProjectile_25h) },
[4] = { .damage = 300, .up_face_right = PROJ_INSTR(Spazer_SBA_Trail) , .up_right = PROJ_INSTR(Spazer_SBA_Trail) , .right = PROJ_INSTR(Spazer_SBA_Trail) , .down_right = PROJ_INSTR(Spazer_SBA_Trail) , .down_face_right = PROJ_INSTR(Spazer_SBA_Trail) , .down_face_left = PROJ_INSTR(Spazer_SBA_Trail) , .down_left = PROJ_INSTR(Spazer_SBA_Trail) , .left = PROJ_INSTR(Spazer_SBA_Trail) , .up_left = PROJ_INSTR(Spazer_SBA_Trail) , .up_face_left = PROJ_INSTR(Spazer_SBA_Trail) },
[5] = { .damage = 0, .instr_ptrs[0] = PROJ_INSTR(UnusedShinesparkBeam_Projectile_27h) },
[6] = { 0 },
[kProjectileType_ShinesparkEcho-34] = { .damage = 4096, .up_to_right = PROJ_INSTR(ShinesparkEchoes) , .up_right = PROJ_INSTR(ShinesparkEchoes) , .right = PROJ_INSTR(ShinesparkEchoes) , .down_right = PROJ_INSTR(ShinesparkEchoes) , .down_to_right = PROJ_INSTR(ShinesparkEchoes) , .down_to_left = PROJ_INSTR(ShinesparkEchoes) , .down_left = PROJ_INSTR(ShinesparkEchoes) , .left = PROJ_INSTR(ShinesparkEchoes) , .up_left = PROJ_INSTR(ShinesparkEchoes) , .up_to_left = PROJ_INSTR(ShinesparkEchoes) },
[kProjectileType_ShinesparkEcho-34] = { .damage = 4096, .up_face_right = PROJ_INSTR(ShinesparkEchoes) , .up_right = PROJ_INSTR(ShinesparkEchoes) , .right = PROJ_INSTR(ShinesparkEchoes) , .down_right = PROJ_INSTR(ShinesparkEchoes) , .down_face_right = PROJ_INSTR(ShinesparkEchoes) , .down_face_left = PROJ_INSTR(ShinesparkEchoes) , .down_left = PROJ_INSTR(ShinesparkEchoes) , .left = PROJ_INSTR(ShinesparkEchoes) , .up_left = PROJ_INSTR(ShinesparkEchoes) , .up_face_left = PROJ_INSTR(ShinesparkEchoes) },
};
static const ProjectileDataTable kProjectileData_SBA[] = { // 0x938413

View File

@ -2101,30 +2101,7 @@ uint8 BlockReactGrapple(void) { // 0x94A91F
return rv;
}
const int16 kSinCosTable8bit_Sext[320] = { // 0x94A957
-256, -255, -255, -255, -254, -254, -253, -252, -251, -249, -248, -246, -244, -243, -241, -238,
-236, -234, -231, -228, -225, -222, -219, -216, -212, -209, -205, -201, -197, -193, -189, -185,
-181, -176, -171, -167, -162, -157, -152, -147, -142, -136, -131, -126, -120, -115, -109, -103,
-97, -92, -86, -80, -74, -68, -62, -56, -49, -43, -37, -31, -25, -18, -12, -6,
0, 6, 12, 18, 25, 31, 37, 43, 49, 56, 62, 68, 74, 80, 86, 92,
97, 103, 109, 115, 120, 126, 131, 136, 142, 147, 152, 157, 162, 167, 171, 176,
181, 185, 189, 193, 197, 201, 205, 209, 212, 216, 219, 222, 225, 228, 231, 234,
236, 238, 241, 243, 244, 246, 248, 249, 251, 252, 253, 254, 254, 255, 255, 255,
256, 255, 255, 255, 254, 254, 253, 252, 251, 249, 248, 246, 244, 243, 241, 238,
236, 234, 231, 228, 225, 222, 219, 216, 212, 209, 205, 201, 197, 193, 189, 185,
181, 176, 171, 167, 162, 157, 152, 147, 142, 136, 131, 126, 120, 115, 109, 103,
97, 92, 86, 80, 74, 68, 62, 56, 49, 43, 37, 31, 25, 18, 12, 6,
0, -6, -12, -18, -25, -31, -37, -43, -49, -56, -62, -68, -74, -80, -86, -92,
-97, -103, -109, -115, -120, -126, -131, -136, -142, -147, -152, -157, -162, -167, -171, -176,
-181, -185, -189, -193, -197, -201, -205, -209, -212, -216, -219, -222, -225, -228, -231, -234,
-236, -238, -241, -243, -244, -246, -248, -249, -251, -252, -253, -254, -254, -255, -255, -255,
-256, -255, -255, -255, -254, -254, -253, -252, -251, -249, -248, -246, -244, -243, -241, -238,
-236, -234, -231, -228, -225, -222, -219, -216, -212, -209, -205, -201, -197, -193, -189, -185,
-181, -176, -171, -167, -162, -157, -152, -147, -142, -136, -131, -126, -120, -115, -109, -103,
-97, -92, -86, -80, -74, -68, -62, -56, -49, -43, -37, -31, -25, -18, -12, -6,
};
static void BlockFunc_A957(uint16 tmpD82, uint16 tmpD84) {
static void BlockFunc_A957(uint16 tmpD82, uint16 tmpD84) { // 0x94A957
int16 v5;
int16 v7;

View File

@ -341,7 +341,7 @@ void GrappleNext_CrouchAimLeft(void) { // 0x9BBA29
}
void HandleConnectingGrapple_Swinging(void) { // 0x9BBA61
samus_special_transgfx_index = 9;
samus_new_pose_interrupted_command = 9;
uint16 v0 = swap16(CalculateAngleFromXY(samus_x_pos - grapple_beam_end_x_pos, samus_y_pos - grapple_beam_end_y_pos));
grapple_beam_end_angle16 = v0;
grapple_beam_end_angle_mirror = v0;
@ -352,7 +352,7 @@ void HandleConnectingGrapple_Swinging(void) { // 0x9BBA61
}
void HandleConnectingGrapple_StuckInPlace(void) { // 0x9BBA9B
samus_special_transgfx_index = 10;
samus_new_pose_interrupted_command = 10;
uint16 v0 = swap16(CalculateAngleFromXY(samus_x_pos - grapple_beam_end_x_pos, samus_y_pos - grapple_beam_end_y_pos));
grapple_beam_end_angle16 = v0;
grapple_beam_end_angle_mirror = v0;
@ -372,7 +372,7 @@ uint8 HandleSpecialGrappleBeamAngles(void) { // 0x9BBAD5
samus_x_pos = grapple_beam_end_x_pos + kGrappleBeam_SpecialAngles[v0].x_offset;
samus_y_pos = grapple_beam_end_y_pos + kGrappleBeam_SpecialAngles[v0].y_offset;
grapple_beam_function = kGrappleBeam_SpecialAngles[v0].grapple_function;
samus_special_transgfx_index = 0;
samus_new_pose_interrupted_command = 0;
slow_grapple_scrolling_flag = 0;
int16 v2 = samus_x_pos - samus_prev_x_pos;
if ((int16)(samus_x_pos - samus_prev_x_pos) < 0) {
@ -476,7 +476,7 @@ void GrappleBeamFunc_BCFF(void) { // 0x9BBCFF
}
void GrappleBeamFunc_BD44(void) { // 0x9BBD44
if (grapple_beam_kick_cooldown_timer && (button_config_jump_a & joypad1_newkeys) != 0) {
if (grapple_beam_kick_cooldown_timer && (button_config_jump & joypad1_newkeys) != 0) {
if (grapple_beam_angular_velocity) {
if ((grapple_beam_angular_velocity & 0x8000) != 0) {
if (grapple_beam_flags && (grapple_beam_flags & 1) != 0)
@ -563,7 +563,7 @@ void GrappleBeamFunc_BEEB(void) { // 0x9BBEEB
}
void GrappleBeamFunc_BF1B(void) { // 0x9BBF1B
uint16 r22 = kPoseParams[samus_pose].y_offset_to_gfx;
uint16 r22 = kPoseParams[samus_pose].y_offset_proj_origin_to_gfx;
uint16 v0 = 2 * grapple_beam_direction;
if (samus_pose == kPose_49_FaceL_Moonwalk || samus_pose == kPose_4A_FaceR_Moonwalk || samus_movement_type != kMovementType_01_Running) {
int v1 = v0 >> 1;
@ -641,7 +641,7 @@ void HandleGrappleBeamFlare(void) { // 0x9BC036
}
void GrappleBeamHandler(void) { // 0x9BC490
int16 samus_bottom_bound = Samus_GetBottom_R18();
int16 samus_bottom_bound = Samus_GetBottomBound();
if (grapple_beam_auto_cancel_timer != 0)
--grapple_beam_auto_cancel_timer;
samus_grapple_flags &= ~1;
@ -660,7 +660,7 @@ void GrappleBeamHandler(void) { // 0x9BC490
}
void GrappleBeamFunc_Inactive(void) { // 0x9BC4F0
if ((button_config_shoot_x & joypad1_newkeys) != 0 || (button_config_shoot_x & joypad1_newinput_samusfilter) != 0) {
if ((button_config_shoot & joypad1_newkeys) != 0 || (button_config_shoot & joypad1_newinput_samusfilter) != 0) {
GrappleBeamFunc_FireGoToCancel();
} else if (flare_counter) {
flare_counter = 0;
@ -682,7 +682,7 @@ void GrappleBeamFunc_FireGoToCancel(void) { // 0x9BC51E
v0 = CheckBannedDraygonGrappleDirs(samus_pose);
r22 = 6;
} else {
r22 = kPoseParams[samus_pose].y_offset_to_gfx;
r22 = kPoseParams[samus_pose].y_offset_proj_origin_to_gfx;
v0 = kPoseParams[samus_pose].direction_shots_fired;
if ((v0 & 0xF0) != 0) {
grapple_beam_function = FUNC16(GrappleBeamFunc_Cancel);
@ -741,7 +741,7 @@ void GrappleBeamFunc_FireGoToCancel(void) { // 0x9BC51E
grapple_beam_angle_handling_flag = 0;
slow_grapple_scrolling_flag = 0;
GrappleFunc_AF87();
samus_draw_handler = FUNC16(SamusDrawHandler_NoChargeOrGrapple);
samus_draw_handler = FUNC16(Samus_DrawHandler_NoChargeOrGrapple);
grapple_walljump_timer = 0;
LoadProjectilePalette(2);
palette_buffer.sprite_pal_5[15] = 32657;
@ -777,7 +777,7 @@ uint8 ClearCarry_12(void) { // 0x9BC701
}
void GrappleBeamFunc_Firing(void) { // 0x9BC703
if ((button_config_shoot_x & joypad1_lastkeys) == 0) {
if ((button_config_shoot & joypad1_lastkeys) == 0) {
grapple_beam_function = FUNC16(GrappleBeamFunc_Cancel);
return;
}
@ -809,14 +809,14 @@ void GrappleBeamFunc_Firing(void) { // 0x9BC703
}
void GrappleBeamFunc_ConnectedLockedInPlace(void) { // 0x9BC77E
if ((button_config_shoot_x & joypad1_lastkeys) != 0 && (GrappleBeam_CollDetect_Enemy().k || CheckIfGrappleIsConnectedToBlock())) {
if ((button_config_shoot & joypad1_lastkeys) != 0 && (GrappleBeam_CollDetect_Enemy().k || CheckIfGrappleIsConnectedToBlock())) {
} else {
grapple_beam_function = FUNC16(GrappleBeamFunc_Cancel);
}
}
void GrappleBeamFunc_Connected_Swinging(void) { // 0x9BC79D
if ((button_config_shoot_x & joypad1_lastkeys) != 0) {
if ((button_config_shoot & joypad1_lastkeys) != 0) {
GrappleBeamFunc_BB64();
if (grapple_beam_length_delta)
BlockFunc_AC31();
@ -847,7 +847,7 @@ LABEL_2:
}
void GrappleBeamFunc_Wallgrab(void) { // 0x9BC814
if ((button_config_shoot_x & joypad1_lastkeys) != 0 && CheckIfGrappleIsConnectedToBlock() & 1) {
if ((button_config_shoot & joypad1_lastkeys) != 0 && CheckIfGrappleIsConnectedToBlock() & 1) {
} else {
grapple_walljump_timer = 30;
@ -887,7 +887,7 @@ void GrappleBeamFunc_Cancel(void) { // 0x9BC856
flare_fast_sparks_anim_timer = 0;
LoadProjectilePalette(equipped_beams);
grapple_beam_function = FUNC16(GrappleBeamFunc_Inactive);
samus_draw_handler = FUNC16(SamusDrawHandler_Default);
samus_draw_handler = FUNC16(Samus_DrawHandler_Default);
Samus_PostGrappleCollisionDetect();
if (samus_auto_cancel_hud_item_index) {
hud_item_index = kHudItem_0_Nothing;
@ -911,8 +911,7 @@ LABEL_6:
else
samus_new_pose_transitional = kPose_27_FaceR_Crouch;
} else {
samus_new_pose_transitional = kGrappleToCrouchingSamusPoses[*(&kPoseParams[0].direction_shots_fired
+ (8 * samus_pose))];
samus_new_pose_transitional = kGrappleToCrouchingSamusPoses[kPoseParams[samus_pose].direction_shots_fired];
}
goto LABEL_15;
}
@ -924,11 +923,10 @@ LABEL_5:
}
goto LABEL_6;
}
samus_new_pose_transitional = kGrappleToStandingSamusPoses[*(&kPoseParams[0].direction_shots_fired
+ (8 * samus_pose))];
samus_new_pose_transitional = kGrappleToStandingSamusPoses[kPoseParams[samus_pose].direction_shots_fired];
LABEL_15:
samus_hurt_switch_index = 0;
input_to_pose_calc = 1;
samus_new_pose_transitional_command = 0;
samus_solid_vertical_coll_result = kSolidVertCollResult_1_Landed;
samus_x_base_speed = 0;
samus_x_base_subspeed = 0;
samus_y_subspeed = 0;
@ -950,7 +948,7 @@ LABEL_15:
flare_fast_sparks_anim_timer = 0;
LoadProjectilePalette(equipped_beams);
grapple_beam_function = FUNC16(GrappleBeamFunc_Inactive);
samus_draw_handler = FUNC16(SamusDrawHandler_Default);
samus_draw_handler = FUNC16(Samus_DrawHandler_Default);
Samus_PostGrappleCollisionDetect();
if (samus_auto_cancel_hud_item_index) {
hud_item_index = kHudItem_0_Nothing;
@ -964,9 +962,9 @@ void GrappleBeamFunc_C9CE(void) { // 0x9BC9CE
samus_new_pose_transitional = kPose_84_FaceL_Walljump;
else
samus_new_pose_transitional = kPose_83_FaceR_Walljump;
samus_hurt_switch_index = 6;
samus_new_pose_transitional_command = 6;
samus_x_accel_mode = 0;
samus_collides_with_solid_enemy = 0;
samus_stopped_by_collision = 0;
samus_is_falling_flag = 0;
UNUSED_word_7E0B1A = 0;
UNUSED_word_7E0B2A = 0;
@ -993,7 +991,7 @@ void GrappleBeamFunc_C9CE(void) { // 0x9BC9CE
flare_fast_sparks_anim_timer = 0;
LoadProjectilePalette(equipped_beams);
grapple_beam_function = FUNC16(GrappleBeamFunc_Inactive);
samus_draw_handler = FUNC16(SamusDrawHandler_Default);
samus_draw_handler = FUNC16(Samus_DrawHandler_Default);
Samus_PostGrappleCollisionDetect();
if (samus_auto_cancel_hud_item_index) {
hud_item_index = kHudItem_0_Nothing;
@ -1040,7 +1038,7 @@ void GrappleBeamFunc_ReleaseFromSwing(void) { // 0x9BCB8B
samus_new_pose_transitional = kPose_52_FaceL_Jump_NoAim_MoveF;
else
samus_new_pose_transitional = kPose_51_FaceR_Jump_NoAim_MoveF;
samus_hurt_switch_index = 7;
samus_new_pose_transitional_command = 7;
grapple_beam_unkD1E = 0;
grapple_beam_unkD20 = 0;
grapple_beam_direction = 0;
@ -1058,7 +1056,7 @@ void GrappleBeamFunc_ReleaseFromSwing(void) { // 0x9BCB8B
flare_fast_sparks_anim_timer = 0;
LoadProjectilePalette(equipped_beams);
grapple_beam_function = FUNC16(GrappleBeamFunc_Inactive);
samus_draw_handler = FUNC16(SamusDrawHandler_Default);
samus_draw_handler = FUNC16(Samus_DrawHandler_Default);
Samus_PostGrappleCollisionDetect();
if (samus_auto_cancel_hud_item_index) {
hud_item_index = kHudItem_0_Nothing;

View File

@ -31,7 +31,7 @@
//#define kGrappleBeamFlareTileEndPtr (*(uint16*)RomFixedPtr(0x9bc344))
//#define kGrappleBeamFlareTileBeginPtr (*(uint16*)RomFixedPtr(0x9bc342))
//#define kGrappleBeamTilePtrs ((uint16*)RomFixedPtr(0x9bc346))
////#define kFlareAnimDelays ((uint16*)RomFixedPtr(0x90c481))
////#define kFlareAnimDelayPtrs ((uint16*)RomFixedPtr(0x90c481))
//#define kFlareAnimDelays_Main ((uint8*)RomFixedPtr(0x90c487))
////#define kFlareAnimDelays_SlowSparks ((uint8*)RomFixedPtr(0x90c4a7))
////#define kFlareAnimDelays_FastSparks ((uint8*)RomFixedPtr(0x90c4ae))

View File

@ -2028,8 +2028,8 @@ void SamusProjectileInteractionHandler(void) { // 0xA09785
return;
}
if (projectile_variables[pidx] == 8) {
bomb_jump_dir = (samus_x_pos == projectile_x_pos[pidx]) ? 2 :
(int16)(samus_x_pos - projectile_x_pos[pidx]) < 0 ? 1 : 3;
bomb_jump_dir = (samus_x_pos == projectile_x_pos[pidx]) ? kBombJumpDir_Up :
(int16)(samus_x_pos - projectile_x_pos[pidx]) < kBombJumpDir_None ? kBombJumpDir_Left : kBombJumpDir_Right;
}
}
}

View File

@ -406,4 +406,30 @@ uint8 kAlignYPos_Tab0_a0[] = {
16, 13, 10, 7, 4, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
};
const int16 kSinCosTable8bit_Sext[320] = { // 0xA0B143
// 8 bit sext negative cosine
-256, -255, -255, -255, -254, -254, -253, -252, -251, -249, -248, -246, -244, -243, -241, -238,
-236, -234, -231, -228, -225, -222, -219, -216, -212, -209, -205, -201, -197, -193, -189, -185,
-181, -176, -171, -167, -162, -157, -152, -147, -142, -136, -131, -126, -120, -115, -109, -103,
-97, -92, -86, -80, -74, -68, -62, -56, -49, -43, -37, -31, -25, -18, -12, -6,
// 8 bit sext sine
0, 6, 12, 18, 25, 31, 37, 43, 49, 56, 62, 68, 74, 80, 86, 92,
97, 103, 109, 115, 120, 126, 131, 136, 142, 147, 152, 157, 162, 167, 171, 176,
181, 185, 189, 193, 197, 201, 205, 209, 212, 216, 219, 222, 225, 228, 231, 234,
236, 238, 241, 243, 244, 246, 248, 249, 251, 252, 253, 254, 254, 255, 255, 255,
// 8 bit sext cosine
256, 255, 255, 255, 254, 254, 253, 252, 251, 249, 248, 246, 244, 243, 241, 238,
236, 234, 231, 228, 225, 222, 219, 216, 212, 209, 205, 201, 197, 193, 189, 185,
181, 176, 171, 167, 162, 157, 152, 147, 142, 136, 131, 126, 120, 115, 109, 103,
97, 92, 86, 80, 74, 68, 62, 56, 49, 43, 37, 31, 25, 18, 12, 6,
// 8 bit sext negative sine
0, -6, -12, -18, -25, -31, -37, -43, -49, -56, -62, -68, -74, -80, -86, -92,
-97, -103, -109, -115, -120, -126, -131, -136, -142, -147, -152, -157, -162, -167, -171, -176,
-181, -185, -189, -193, -197, -201, -205, -209, -212, -216, -219, -222, -225, -228, -231, -234,
-236, -238, -241, -243, -244, -246, -248, -249, -251, -252, -253, -254, -254, -255, -255, -255,
// 8 bit sext negative cosine
-256, -255, -255, -255, -254, -254, -253, -252, -251, -249, -248, -246, -244, -243, -241, -238,
-236, -234, -231, -228, -225, -222, -219, -216, -212, -209, -205, -201, -197, -193, -189, -185,
-181, -176, -171, -167, -162, -157, -152, -147, -142, -136, -131, -126, -120, -115, -109, -103,
-97, -92, -86, -80, -74, -68, -62, -56, -49, -43, -37, -31, -25, -18, -12, -6,
};

View File

@ -521,7 +521,7 @@ void Elevator_Func_EnteringRoom(void) { // 0xA395BC
elevator_properties = 0;
QueueSfx3_Max6(kSfx3_ClearSpeedBooster_ElevatorSound_Silence);
E->base.y_pos = E->elevat_var_A;
RunSamusCode(kSamusCode_11_DrawHandlerDefault);
RunSamusCode(kSamusCode_11_UnlockFromFacingForward);
PlaceSamusOnElevator();
}

View File

@ -402,7 +402,7 @@ void Crocomire_Init(void) { // 0xA48A5A
}
E->crocom_var_C = 4;
UNUSED_word_7E179E = 16;
camera_distance_index = 2;
camera_distance_index = kCameraDistanceIndex_2_Kraid_Crocomire;
enemy_bg2_tilemap_size = 1024;
E->base.current_instruction = addr_kCrocomire_Ilist_BADE;
E->base.extra_properties |= 4;
@ -730,10 +730,10 @@ void Crocomire_Func_49(void) { // 0xA49099
E->crocom_var_A = 88;
E->base.current_instruction = addr_kCrocomire_Ilist_E1D2;
scrolls[5] = scrolls[4] = kScroll_Blue;
debug_disable_minimap = 0;
disable_minimap = 0;
Get_Crocomire(0x40)->base.properties |= kEnemyProps_Deleted;
SpawnHardcodedPlm((SpawnHardcodedPlmArgs) { .x_pos = 78, .y_pos = 3, .plm_id_ = addr_kPlmHeader_B753_Crocomire_ClearInvisibleWall });
camera_distance_index = 0;
camera_distance_index = kCameraDistanceIndex_0_Normal;
croco_target_0688 = 0;
}
}
@ -1237,7 +1237,7 @@ void Crocomire_Func_68(void) { // 0xA497D3
scrolls[3] = kScroll_Red;
scrolls[4] = kScroll_Blue;
SpawnHardcodedPlm((SpawnHardcodedPlmArgs) { .x_pos = 48, .y_pos = 3, .plm_id_ = addr_kPlmHeader_B757_Crocomire_CreateInvisibleWall });
camera_distance_index = 6;
camera_distance_index = kCameraDistanceIndex_6_CrocomireWall;
Enemy_Crocomire *E0 = Get_Crocomire(0);
E0->base.properties = E0->base.properties & ~(kEnemyProps_EnableSamusColl) | kEnemyProps_Intangible;
Enemy_Crocomire *E1 = Get_Crocomire(0x40);
@ -1484,7 +1484,7 @@ void Crocomire_Func_90(void) { // 0xA49B7D
void Crocomire_9B86(void) { // 0xA49B86
QueueMusic_Delayed8(kMusic_Song1);
camera_distance_index = 0;
camera_distance_index = kCameraDistanceIndex_0_Normal;
*(uint16 *)&boss_bits_for_area[area_index] |= kBossBit_AreaMiniBoss;
QueueMusic_Delayed8(kMusic_Song1);
Crocomire_Func_87(0, 0xFFF0);

View File

@ -205,7 +205,7 @@ void Kraid_Init(void) { // 0xA7A959
E->kraid_var_A = FUNC16(Kraid_FadeInBg_ClearBg2TilemapTopHalf);
} else {
reg_BG2SC = 67;
camera_distance_index = 2;
camera_distance_index = kCameraDistanceIndex_2_Kraid_Crocomire;
scrolls[1] = scrolls[0] = kScroll_Red;
scrolls[2] = kScroll_Blue;
scrolls[3] = kScroll_Red;
@ -1734,7 +1734,7 @@ void Kraid_Death_SinkThroughFloor(void) { // 0xA7C537
Get_Kraid(0x100)->base.properties = v4;
Get_Kraid(0x140)->base.properties = v4;
Get_Kraid(0)->kraid_var_A = FUNC16(Kraid_FadeInBg_ClearBg2TilemapTopHalf);
camera_distance_index = 0;
camera_distance_index = kCameraDistanceIndex_0_Normal;
Enemy_ItemDrop_Kraid(enemy_ptr);
Kraid_DrawRoomBg();
}

View File

@ -2413,10 +2413,10 @@ void MotherBomb_FiringRainbowBeam_5_StartFiring(void) { // 0xA9B975
E1->mbn_var_33 = 4;
E->mbn_parameter_1 = 0;
E->mbn_parameter_2 = 0;
uint16 v4 = kSamusCode_5_SetupDrained;
if ((int16)(samus_health - 700) < 0)
v4 = kSamusCode_24_SetupDrainedAndDisableStandUp;
RunSamusCode(v4);
uint16 samus_code = kSamusCode_5_SetupDrained_AbleToStand;
if ((int16)samus_health < 700)
samus_code = kSamusCode_24_SetupDrained_UnableToStand;
RunSamusCode(samus_code);
E->mbn_var_15 = 6;
E->mbn_var_A = FUNC16(MotherBomb_FiringRainbowBeam_6_MoveSamusToWall);
}

View File

@ -657,17 +657,13 @@ void Torizo_Init(void) { // 0xAAC87F
}
if (area_index != kArea_0_Crateria) {
Torizo_C280();
// GT Code
if (joypad1_lastkeys == (kButton_B | kButton_Y | kButton_A | kButton_X)) {
samus_health = 700;
samus_max_health = 700;
samus_max_reserve_health = 300;
samus_reserve_health = 300;
samus_missiles = 100;
samus_max_missiles = 100;
samus_super_missiles = 20;
samus_max_super_missiles = 20;
samus_power_bombs = 20;
samus_max_power_bombs = 20;
samus_max_health = samus_health = 700;
samus_reserve_health = samus_max_reserve_health = 300;
samus_max_missiles = samus_missiles = 100;
samus_max_super_missiles = samus_super_missiles = 20;
samus_max_power_bombs = samus_power_bombs = 20;
equipped_items = (kItem_Xray | kItem_Grapple | kItem_SpeedBooster | kItem_Bombs | kItem_SpaceJump | kItem_HiJumpBoots | kItem_GravitySuit | 0x10 | kItem_MorphBall | kItem_SpringBall | kItem_VariaSuit);
collected_items = (kItem_Xray | kItem_Grapple | kItem_SpeedBooster | kItem_Bombs | kItem_SpaceJump | kItem_HiJumpBoots | kItem_GravitySuit | 0x10 | kItem_MorphBall | kItem_SpringBall | kItem_VariaSuit);
equipped_beams = (kBeam_Charge | kBeam_Plasma | kBeam_Spazer | kBeam_Ice | kBeam_Wave);
@ -957,11 +953,9 @@ void Torizo_D5ED(uint16 k) { // 0xAAD5ED
}
void Torizo_D5F1(uint16 k) { // 0xAAD5F1
uint16 v3;
Enemy_Torizo *E = Get_Torizo(k);
uint16 torizo_var_03 = E->toriz_var_03;
if (!torizo_var_03 || (v3 = torizo_var_03 - 1, (E->toriz_var_03 = v3) != 0)) {
if (E->toriz_var_03 == 0 || --E->toriz_var_03 != 0) {
uint16 v5 = abs16(E->toriz_var_A) + 1;
if (v5 >= 0x10)
v5 = 15;
@ -976,7 +970,8 @@ void Torizo_D5F1(uint16 k) { // 0xAAD5F1
E->toriz_var_B = 256;
E->toriz_var_A = 0;
}
} else {
}
else {
E->toriz_var_03 = 0;
uint16 v4;
if ((E->toriz_parameter_1 & 0x8000) != 0)
@ -1070,23 +1065,22 @@ void Torizo_D6F7(uint16 k, uint16 j) { // 0xAAD6F7
}
}
/**
* @brief Initialize the Tourian entrance statue
*/
void TourianEntranceStatue_Init(void) { // 0xAAD7C8
EnemyData *v0 = gEnemyData(cur_enemy_index);
v0->palette_index = 0;
v0->instruction_timer = 1;
v0->timer = 0;
uint16 v1 = kEnemyInit_TourianEntranceStatue_InstrListPtrs[v0->parameter_1 >> 1];
v0->current_instruction = v1;
if (!v0->parameter_1) {
EnemyData *E = gEnemyData(cur_enemy_index);
E->palette_index = 0;
E->instruction_timer = 1;
E->timer = 0;
E->current_instruction = kTourianEntranceStatue_InstrListPtrs[E->parameter_1 >> 1];
if (E->parameter_1 == 0) {
SpawnEprojWithRoomGfx(addr_kEproj_TourianStatueBaseDecoration, 0);
SpawnEprojWithRoomGfx(addr_kEproj_TourianStatueRidley, 0);
SpawnEprojWithRoomGfx(addr_kEproj_TourianStatuePhantoon, 0);
}
for (int i = 0x1E; i >= 0; i -= 2) {
int v5 = i >> 1;
target_palettes.sprite_pal_7[v5] = kEnemyInit_TourianEntranceStatue_PaletteTab1[v5];
target_palettes.sprite_pal_2[v5] = kEnemyInit_TourianEntranceStatue_PaletteTab0[v5];
}
MemCpy(target_palettes.sprite_pal_7, kTourianEntranceStatue_SpritePalette7, sizeof(kTourianEntranceStatue_SpritePalette7));
MemCpy(target_palettes.sprite_pal_2, kTourianEntranceStatue_SpritePalette2, sizeof(kTourianEntranceStatue_SpritePalette2));
}
const uint16 *Shaktool_Instr_2(uint16 k, const uint16 *jp) { // 0xAAD931
@ -1363,6 +1357,7 @@ void Shaktool_DD25(uint16 k) { // 0xAADD25
}
}
/** @todo fix shaktool */
void Shaktool_Init(void) { // 0xAADE43
Enemy_Shaktool *E = Get_Shaktool(cur_enemy_index);
E->base.instruction_timer = 1;

View File

@ -3,9 +3,9 @@
#include "types.h"
//#define kEnemyInit_Torizo_InstrListPtrs ((uint16*)RomFixedPtr(0xaac967))
//#define kEnemyInit_TourianEntranceStatue_InstrListPtrs ((uint16*)RomFixedPtr(0xaad810))
//#define kEnemyInit_TourianEntranceStatue_PaletteTab0 ((uint16*)RomFixedPtr(0xaad765))
//#define kEnemyInit_TourianEntranceStatue_PaletteTab1 ((uint16*)RomFixedPtr(0xaad785))
//#define kTourianEntranceStatue_InstrListPtrs ((uint16*)RomFixedPtr(0xaad810))
//#define kTourianEntranceStatue_SpritePalette2 ((uint16*)RomFixedPtr(0xaad765))
//#define kTourianEntranceStatue_SpritePalette7 ((uint16*)RomFixedPtr(0xaad785))
//#define kShaktool_InstrListPtrs0 ((uint16*)RomFixedPtr(0xaadf13))
//#define kShaktool_InstrListPtrs1 ((uint16*)RomFixedPtr(0xaadf21))
//#define kSine ((uint16*)RomFixedPtr(0xaae0bd))
@ -30,15 +30,17 @@ uint16 kEnemyInit_Torizo_InstrListPtrs[] = {
0xb879, 0xc9cb,
};
uint16 kEnemyInit_TourianEntranceStatue_InstrListPtrs[] = {
0xd7b9, 0xd7a5, 0xd7af,
static const uint16 kTourianEntranceStatue_InstrListPtrs[3] = {
addr_kTourianEntranceStatue_Ilist_BaseDecoration,
addr_kTourianEntranceStatue_Ilist_Ridley,
addr_kTourianEntranceStatue_Ilist_Phantoon,
};
uint16 kEnemyInit_TourianEntranceStatue_PaletteTab0[] = {
static const uint16 kTourianEntranceStatue_SpritePalette2[] = {
0x3800, 0x57ff, 0x2bff, 0x1f3c, 0x278, 0x1b0, 0x10b, 0x87, 0x44, 0x7fff, 0x7fff, 0x7fff, 0x3ff, 0x252, 0x129, 0x0,
};
uint16 kEnemyInit_TourianEntranceStatue_PaletteTab1[] = {
static const uint16 kTourianEntranceStatue_SpritePalette7[] = {
0x3800, 0x27f9, 0x2375, 0x1ad2, 0x164e, 0x11ab, 0xd27, 0x484, 0x0, 0x7f5f, 0x7c1f, 0x5816, 0x300c, 0x5294, 0x39ce, 0x2108,
};

View File

@ -71,8 +71,8 @@ void MotherBrain_CalcHdma_Right_Right(uint16 right_edge_origin_x_pos, uint16 lef
hdma_table_2[0] = 0x00FF;
hdma_table_2[1] = 0x00FF;
Enemy_MotherBrain *E = Get_MotherBrain(0);
uint16 right_edge_gradient = kTanTable[LOBYTE(E->rainbow_beam_right_edge_angle)];
uint16 left_edge_gradient = kTanTable[LOBYTE(E->rainbow_beam_left_edge_angle)];
uint16 right_edge_gradient = kAbsTanTable[LOBYTE(E->rainbow_beam_right_edge_angle)];
uint16 left_edge_gradient = kAbsTanTable[LOBYTE(E->rainbow_beam_left_edge_angle)];
uint16 beam_y_pos = E->rainbow_beam_aimed_right_origin_y_pos;
uint16 num_pad_lines = beam_y_pos - 32;
uint16 *left_dst = hdma_table_2 + num_pad_lines + 1;
@ -88,7 +88,7 @@ void MotherBrain_CalcHdma_Right_Right(uint16 right_edge_origin_x_pos, uint16 lef
*left_dst-- = HIBYTE(left_edge_origin_x_pos) | 0xFF00;
}
// pad
// pad0
do {
*left_dst-- = 0x00FF;
} while (--beam_y_pos > 32);
@ -104,7 +104,7 @@ void MotherBrain_CalcHdma_Right_Right(uint16 right_edge_origin_x_pos, uint16 lef
return;
}
// pad
// pad0
do {
*right_dst++ = 0x00FF;
} while (++beam_y_pos < 232);
@ -170,8 +170,8 @@ void MotherBrain_CalcHdma_Up_UpRight(uint16 left_edge_origin_x_pos, uint16 right
hdma_table_2[0] = 0x00FF;
hdma_table_2[1] = 0x00FF;
Enemy_MotherBrain *E = Get_MotherBrain(0);
uint16 left_edge_gradient = kTanTable[LOBYTE(E->rainbow_beam_left_edge_angle)];
uint16 right_edge_gradient = kTanTable[LOBYTE(E->rainbow_beam_right_edge_angle)];
uint16 left_edge_gradient = kAbsTanTable[LOBYTE(E->rainbow_beam_left_edge_angle)];
uint16 right_edge_gradient = kAbsTanTable[LOBYTE(E->rainbow_beam_right_edge_angle)];
uint16 beam_y_pos = E->rainbow_beam_origin_y_pos;
uint16 num_pad_lines = beam_y_pos - 32;
uint16 *dst = hdma_table_2 + num_pad_lines + 1;
@ -196,8 +196,8 @@ void MotherBrain_CalcHdma_Up_Up(uint16 left_edge_origin_x_pos, uint16 right_edge
hdma_table_2[0] = 0x00FF;
hdma_table_2[1] = 0x00FF;
Enemy_MotherBrain *E = Get_MotherBrain(0);
uint16 left_edge_gradient = kTanTable[(uint8)-LOBYTE(E->rainbow_beam_left_edge_angle)];
uint16 right_edge_gradient = kTanTable[LOBYTE(E->rainbow_beam_right_edge_angle)];
uint16 left_edge_gradient = kAbsTanTable[(uint8)-LOBYTE(E->rainbow_beam_left_edge_angle)];
uint16 right_edge_gradient = kAbsTanTable[LOBYTE(E->rainbow_beam_right_edge_angle)];
uint16 beam_y_pos = E->rainbow_beam_origin_y_pos;
uint16 num_pad_lines = beam_y_pos - 32;
uint16 *dst = hdma_table_2 + num_pad_lines + 1;
@ -222,8 +222,8 @@ void MotherBrain_CalcHdma_Up_UpLeft(uint16 left_edge_origin_x_pos, uint16 right_
hdma_table_2[0] = 0xFF;
hdma_table_2[1] = 0xFF;
Enemy_MotherBrain *E = Get_MotherBrain(0);
uint16 left_edge_gradient = kTanTable[(uint8)-LOBYTE(E->rainbow_beam_left_edge_angle)];
uint16 right_edge_gradient = kTanTable[(uint8)-LOBYTE(E->rainbow_beam_right_edge_angle)];
uint16 left_edge_gradient = kAbsTanTable[(uint8)-LOBYTE(E->rainbow_beam_left_edge_angle)];
uint16 right_edge_gradient = kAbsTanTable[(uint8)-LOBYTE(E->rainbow_beam_right_edge_angle)];
uint16 beam_y_pos = E->rainbow_beam_origin_y_pos;
uint16 num_pad_lines = beam_y_pos - 32;
uint16 *dst = hdma_table_2 + num_pad_lines + 1;
@ -280,8 +280,8 @@ void MotherBrain_CalcHdma_Down_DownRight(uint16 right_edge_origin_x_pos, uint16
hdma_table_2[0] = 0xFF;
hdma_table_2[1] = 0xFF;
Enemy_MotherBrain *E = Get_MotherBrain(0);
uint16 right_edge_gradient = kTanTable[LOBYTE(E->rainbow_beam_right_edge_angle)];
uint16 left_edge_gradient = kTanTable[LOBYTE(E->rainbow_beam_left_edge_angle)];
uint16 right_edge_gradient = kAbsTanTable[LOBYTE(E->rainbow_beam_right_edge_angle)];
uint16 left_edge_gradient = kAbsTanTable[LOBYTE(E->rainbow_beam_left_edge_angle)];
uint16 beam_y_pos = E->rainbow_beam_origin_y_pos;
uint16 num_pad_lines = beam_y_pos - 32;
uint16 *dst = hdma_table_2 + 2;
@ -306,8 +306,8 @@ void MotherBrain_CalcHdma_Down_Down(uint16 right_edge_origin_x_pos, uint16 left_
hdma_table_2[0] = 0xFF;
hdma_table_2[1] = 0xFF;
Enemy_MotherBrain *E = Get_MotherBrain(0);
uint16 right_edge_gradient = kTanTable[(uint8)-LOBYTE(E->rainbow_beam_right_edge_angle)];
uint16 left_edge_gradient = kTanTable[LOBYTE(E->rainbow_beam_left_edge_angle)];
uint16 right_edge_gradient = kAbsTanTable[(uint8)-LOBYTE(E->rainbow_beam_right_edge_angle)];
uint16 left_edge_gradient = kAbsTanTable[LOBYTE(E->rainbow_beam_left_edge_angle)];
uint16 beam_y_pos = E->rainbow_beam_origin_y_pos;
uint16 num_pad_lines = beam_y_pos - 32;
uint16 *dst = hdma_table_2 + 2;
@ -332,8 +332,8 @@ void MotherBrain_CalcHdma_Down_DownLeft(uint16 right_edge_origin_x_pos, uint16 l
hdma_table_2[0] = 0xFF;
hdma_table_2[1] = 0xFF;
Enemy_MotherBrain *E = Get_MotherBrain(0);
uint16 right_edge_gradient = kTanTable[(uint8)-LOBYTE(E->rainbow_beam_right_edge_angle)];
uint16 left_edge_gradient = kTanTable[(uint8)-LOBYTE(E->rainbow_beam_left_edge_angle)];
uint16 right_edge_gradient = kAbsTanTable[(uint8)-LOBYTE(E->rainbow_beam_right_edge_angle)];
uint16 left_edge_gradient = kAbsTanTable[(uint8)-LOBYTE(E->rainbow_beam_left_edge_angle)];
uint16 beam_y_pos = E->rainbow_beam_origin_y_pos;
uint16 num_pad_lines = beam_y_pos - 32;
uint16 *dst = hdma_table_2 + 2;

View File

@ -312,7 +312,7 @@ uint32 PatchBugs(uint32 mode, uint32 addr) {
} else if (FixBugHook(0xA496C8)) { // Crocomire_Func_67 assumes A is zero
g_cpu->a = 0;
} else if (FixBugHook(0x9085AA)) { // Samus_HandleSpeedBoosterAnimDelay doesn't preserve A
g_cpu->a = speed_boost_counter;
g_cpu->a = PAIR16(speed_boost_counter, speed_boost_timer);
} else if (FixBugHook(0xA29044) || FixBugHook(0xA2905D)) { // MaridiaBeybladeTurtle_Func8 thinks INC sets carry
g_cpu->c = (g_cpu->a == 0);
} else if (FixBugHook(0xa29051)) { /// MaridiaBeybladeTurtle_Func8 does an INC too much

View File

@ -505,6 +505,11 @@ PairU16 MakePairU16(uint16 k, uint16 j) {
return r;
}
Point16U MakePoint16U(uint16 k, uint16 j) {
Point16U r = { k, j };
return r;
}
void mov24(struct LongPtr *a, uint32 d) {
a->addr = d & 0xffff;
a->bank = d >> 16;

View File

@ -21,7 +21,7 @@ typedef uint8 Func_U8(void);
typedef void Func_Y_V(uint16 j);
typedef uint16 Func_Y_Y(uint16 j);
typedef void FuncXY_V(uint16 k, uint16 j);
typedef PairU16 Func_Y_To_PairU16(uint16 j);
typedef Point16U Func_Y_To_Point16U(uint16 j);
struct LongPtr;
void mov24(LongPtr *dst, uint32 src);
@ -152,27 +152,20 @@ struct VramWriteEntry;
PairU16 MakePairU16(uint16 k, uint16 j);
Point16U MakePoint16U(uint16 k, uint16 j);
#define kPoseParams ((SamusPoseParams*)RomFixedPtr(0x91b629))
#define kAtmosphericGraphicAnimationTimers ((uint16*)RomFixedPtr(0x908b93))
#define kAtmosphericTypeNumFrames ((uint16*)RomFixedPtr(0x908bef))
#define kAtmosphericTypeTileNumAndAttributes ((uint16*)RomFixedPtr(0x908bff))
#define kBossRoomMapTile ((DisableMinimapAndMarkBossRoomAsExploredEnt*)RomFixedPtr(0x90a83a))
#define kPlayerPoseToPtr ((uint16*)RomFixedPtr(0x90c7df))
#define kDrawArmCannon_Tab2 ((uint16*)RomFixedPtr(0x90c7a5))
extern const SamusPoseParams kPoseParams[0xFC];
extern const int16 kSinCosTable8bit_Sext[320];
//#define kPoseTransitionTable ((uint16*)RomFixedPtr(0x919ee2))
//#define kDemoSetDefPtrs ((uint16*)RomFixedPtr(0x918885))
#define kSpeedBoostToCtr ((uint16*)RomFixedPtr(0x91b61f))
#define kSpeedBoostToAnimFramePtr ((uint16 *)RomFixedPtr(0x91B5DE))
#define kSamusPoseToBaseSpritemapIndexTop ((uint16*)RomFixedPtr(0x929263))
#define kSamusPoseToBaseSpritemapIndexBottom ((uint16*)RomFixedPtr(0x92945d))
#define kSamusAnimationDelayData ((uint16*)RomFixedPtr(0x91b010))
extern const uint8 kDefaultAnimFrames[11];
extern const uint8 kSpeedBoostToAnimFrames[5][11];
extern const uint16 kSpeedBoostToCtr[5];
extern const uint16 kSamusPoseToBaseSpritemapIndexTop[];
extern const uint16 kSamusPoseToBaseSpritemapIndexBottom[];
#define kCommonEnemySpeeds_Linear ((uint16*)RomFixedPtr(0xa28187))
#define kCommonEnemySpeeds_Quadratic ((uint16*)RomFixedPtr(0xa2838f))
#define kCommonEnemySpeeds_Quadratic32 ((uint32*)RomFixedPtr(0xa0cbc7))
#define kSine16bit ((uint16*)RomFixedPtr(0xa0b1c3))
#define kTanTable ((uint16*)RomFixedPtr(0x91c9d4))
extern const uint16 kAbsTanTable[129];
void CallEnemyAi(uint32 ea);
void CallEnemyPreInstr(uint32 ea);
@ -181,6 +174,7 @@ const uint16 *CallEnemyInstr(uint32 ea, uint16 k, const uint16 *jp);
void CalculateBlockContainingPixelPos(uint16 xpos, uint16 ypos);
#define REG(x) ((x) & 0xFF)
/**
* direction: 0 = CPU -> PPU, 1 = PPU -> CPU
* address mode: 0 = holds data, 1 = holds pointer to data (HDMA only)
@ -194,7 +188,9 @@ void CalculateBlockContainingPixelPos(uint16 xpos, uint16 ypos);
* 4 = 4 regs, write once
* 5 = 2 regs, write twice alternate
*/
#define DMA_CONTROL(dir, addr_mode, inc, fixed, trans_mode) (((dir) << 7) | ((addr_mode) << 6) | ((inc) << 4) | ((fixed) << 3) | trans_mode)
#define DMA_CONTROL(dir, addr_mode, inc, fixed, trans_mode) \
(((dir) << 7) | ((addr_mode) << 6) | ((inc) << 4) | ((fixed) << 3) | trans_mode)
/**
* direction: 0 = CPU -> PPU, 1 = PPU -> CPU
* address mode: 0 = holds data, 1 = holds pointer to data
@ -208,6 +204,17 @@ void CalculateBlockContainingPixelPos(uint16 xpos, uint16 ypos);
*/
#define HDMA_CONTROL(dir, addr_mode, trans_mode) DMA_CONTROL(dir, addr_mode, 0, 0, trans_mode)
/**
* y_flip: flag to flip the sprite vertically
* x_flip: flag to flip the sprite horizontally
* priority: the placement of the sprite, from 0 to 3, lowest to highest
* pal: the palette to select
* tile_nbr: the tile to select
*/
#define OAM_DATA(y_flip, x_flip, priority, pal, tile_nbr) \
(((y_flip) << 15) | ((x_flip) << 14) | ((priority) << 12) | ((pal) << 9) | (tile_nbr))
/* 148 */
typedef enum SnesRegs {
INIDISP = 0x2100,

View File

@ -145,6 +145,18 @@ typedef struct Mode7ObjectDef {
VoidP instr_list;
}Mode7ObjectDef;
/* 30 */
typedef struct SamusPoseParams { // 0x91B629
uint8 pose_x_dir;
uint8 movement_type;
uint8 new_pose_unless_buttons;
uint8 direction_shots_fired;
uint8 y_offset_proj_origin_to_gfx;
uint8 UNUSED_field_5;
uint8 y_radius;
uint8 UNUSED_field_7;
} SamusPoseParams;
/* 38 */
typedef union DemoInputEntry {
struct {

View File

@ -173,7 +173,7 @@ extern int32 *cur_coll_amt32;
#define REMOVED_mult_product_lo (*(uint16*)(g_ram+0x5F1))
#define REMOVED_mult_product_hi (*(uint16*)(g_ram+0x5F3))
#define disable_sounds (*(uint16*)(g_ram+0x5F5))
#define debug_disable_minimap (*(uint16*)(g_ram+0x5F7))
#define disable_minimap (*(uint16*)(g_ram+0x5F7))
#define save_confirmation_selection (*(uint16*)(g_ram+0x5F9))
#define map_scrolling_gear_switch_timer (*(uint16*)(g_ram+0x5FB))
#define map_scrolling_direction (*(uint16*)(g_ram+0x5FD))
@ -433,13 +433,13 @@ extern int32 *cur_coll_amt32;
#define button_config_down (*(uint16*)(g_ram+0x9AC))
#define button_config_left (*(uint16*)(g_ram+0x9AE))
#define button_config_right (*(uint16*)(g_ram+0x9B0))
#define button_config_shoot_x (*(uint16*)(g_ram+0x9B2))
#define button_config_jump_a (*(uint16*)(g_ram+0x9B4))
#define button_config_run_b (*(uint16*)(g_ram+0x9B6))
#define button_config_itemcancel_y (*(uint16*)(g_ram+0x9B8))
#define button_config_shoot (*(uint16*)(g_ram+0x9B2))
#define button_config_jump (*(uint16*)(g_ram+0x9B4))
#define button_config_run (*(uint16*)(g_ram+0x9B6))
#define button_config_itemcancel (*(uint16*)(g_ram+0x9B8))
#define button_config_itemswitch (*(uint16*)(g_ram+0x9BA))
#define button_config_aim_down_L (*(uint16*)(g_ram+0x9BC))
#define button_config_aim_up_R (*(uint16*)(g_ram+0x9BE))
#define button_config_aim_down (*(uint16*)(g_ram+0x9BC))
#define button_config_aim_up (*(uint16*)(g_ram+0x9BE))
#define reserve_health_mode (*(uint16*)(g_ram+0x9C0))
#define samus_health (*(uint16*)(g_ram+0x9C2))
#define samus_max_health (*(uint16*)(g_ram+0x9C4))
@ -470,7 +470,8 @@ extern int32 *cur_coll_amt32;
#define samus_prev_super_missiles (*(uint16*)(g_ram+0xA0A))
#define samus_prev_power_bombs (*(uint16*)(g_ram+0xA0C))
#define samus_prev_hud_item_index (*(uint16*)(g_ram+0xA0E))
#define samus_prev_movement_type (*(uint8*)(g_ram+0xA11))
#define UNUSED_samus_prev_pose_x_dir (*(uint8*)(g_ram+0xA10))
#define samus_prev_movement_type_ (*(uint8*)(g_ram+0xA11))
#define samus_prev_health_for_flash (*(uint16*)(g_ram+0xA12))
#define controller1_input_for_demo (*(uint16*)(g_ram+0xA14))
#define controller1_new_input_for_demo (*(uint16*)(g_ram+0xA16))
@ -480,7 +481,7 @@ extern int32 *cur_coll_amt32;
#define samus_movement_type (*(uint8*)(g_ram+0xA1F))
#define samus_prev_pose (*(uint16*)(g_ram+0xA20))
#define samus_prev_pose_x_dir (*(uint8*)(g_ram+0xA22))
#define samus_prev_movement_type2 (*(uint8*)(g_ram+0xA23))
#define samus_prev_movement_type (*(uint8*)(g_ram+0xA23))
#define samus_last_different_pose (*(uint16*)(g_ram+0xA24))
#define samus_last_different_pose_x_dir (*(uint8*)(g_ram+0xA26))
#define samus_last_different_pose_movement_type (*(uint8*)(g_ram+0xA27))
@ -488,8 +489,8 @@ extern int32 *cur_coll_amt32;
#define samus_new_pose_interrupted (*(uint16*)(g_ram+0xA2A))
#define samus_new_pose_transitional (*(uint16*)(g_ram+0xA2C))
#define samus_new_pose_command (*(uint16*)(g_ram+0xA2E))
#define samus_special_transgfx_index (*(uint16*)(g_ram+0xA30))
#define samus_hurt_switch_index (*(uint16*)(g_ram+0xA32))
#define samus_new_pose_interrupted_command (*(uint16*)(g_ram+0xA30))
#define samus_new_pose_transitional_command (*(uint16*)(g_ram+0xA32))
#define solid_enemy_collision_flags (*(uint16*)(g_ram+0xA34))
#define block_collision_flags (*(uint16*)(g_ram+0xA36))
#define samus_space_to_move_up_blocks (*(uint16*)(g_ram+0xA38))
@ -550,26 +551,40 @@ extern int32 *cur_coll_amt32;
#define samus_anim_frame_buffer (*(uint16*)(g_ram+0xA9C))
#define grapple_walljump_timer (*(uint16*)(g_ram+0xA9E))
#define reached_ceres_elevator_fade_timer (*(uint16*)(g_ram+0xAA0))
#define timer_for_shinesparks_startstop (*(uint16*)(g_ram+0xAA2))
// {
#define shinespark_startstop_timer (*(uint16*)(g_ram+0xAA2))
#define crystal_flash_raise_timer (*(uint16*)(g_ram+0xAA2))
// }
#define UNUSED_word_7E0AA4 (*(uint16*)(g_ram+0xAA4))
#define flag_arm_cannon_open_or_opening (*(uint8*)(g_ram+0xAA6))
#define flag_arm_cannon_opening_or_closing (*(uint8*)(g_ram+0xAA7))
#define arm_cannon_frame (*(uint16*)(g_ram+0xAA8))
#define arm_cannon_toggle_flag (*(uint16*)(g_ram+0xAAA))
#define arm_cannon_drawing_mode (*(uint16*)(g_ram+0xAAC))
// {
#define speed_echoes_index (*(uint16*)(g_ram+0xAAE))
#define speed_echo_xpos ((uint16*)(g_ram+0xAB0))
#define speed_echo_ypos ((uint16*)(g_ram+0xAB8))
#define speed_echo_xspeed ((uint16*)(g_ram+0xAC0))
#define speed_echo_draw_flag ((uint16*)(g_ram+0xAC0))
#define samus_top_half_spritemap_index (*(uint16*)(g_ram+0xAC8))
#define samus_bottom_half_spritemap_index (*(uint16*)(g_ram+0xACA))
#define timer_for_shine_timer (*(uint16*)(g_ram+0xACC))
// }
// {
#define crash_echo_distance (*(uint8*)(g_ram+0xAAE))
#define crash_echo_circle_phase (*(uint8*)(g_ram+0xAAF))
#define crash_echo_angle_delta (*(uint16*)(g_ram+0xAB4))
#define crash_echo_circle_timer (*(uint16*)(g_ram+0xABC))
#define crash_echo_angle ((uint16*)(g_ram+0xAC0))
// }
#define special_samus_palette_type (*(uint16*)(g_ram+0xACC))
#define special_samus_palette_frame (*(uint16*)(g_ram+0xACE))
#define special_samus_palette_timer (*(uint16*)(g_ram+0xAD0))
#define liquid_physics_type (*(uint16*)(g_ram+0xAD2))
#define atmospheric_gfx_anim_timer ((uint16*)(g_ram+0xAD4))
#define atmospheric_gfx_x_pos ((uint16*)(g_ram+0xADC))
#define atmospheric_gfx_y_pos ((uint16*)(g_ram+0xAE4))
// low byte is frame, high byte is type
#define atmospheric_gfx_frame_and_type ((uint16*)(g_ram+0xAEC))
#define autojump_timer (*(uint16*)(g_ram+0xAF4))
#define samus_x_pos (*(uint16*)(g_ram+0xAF6))
@ -589,19 +604,28 @@ extern int32 *cur_coll_amt32;
#define samus_prev_y_subpos (*(uint16*)(g_ram+0xB16))
#define charged_shot_glow_timer (*(uint16*)(g_ram+0xB18))
#define UNUSED_word_7E0B1A (*(uint16*)(g_ram+0xB1A))
#define used_for_ball_bounce_on_landing (*(uint16*)(g_ram+0xB20))
#define morph_ball_bounce_state (*(uint16*)(g_ram+0xB20))
#define samus_is_falling_flag (*(uint16*)(g_ram+0xB22))
//#define tempB24 (*(uint16*)(g_ram+0xB24))
//#define tempB26 (*(uint16*)(g_ram+0xB26))
#define UNUSED_word_7E0B2A (*(uint16*)(g_ram+0xB2A))
#define samus_y_subspeed (*(uint16*)(g_ram+0xB2C))
#define samus_y_speed (*(uint16*)(g_ram+0xB2E))
// {
#define samus_y_subaccel (*(uint16*)(g_ram+0xB32))
#define shinespark_y_subaccel_delta (*(uint16*)(g_ram+0xB32))
#define shinespark_x_subaccel (*(uint16*)(g_ram+0xB32))
// }
// {
#define samus_y_accel (*(uint16*)(g_ram+0xB34))
#define shinespark_y_accel_delta (*(uint16*)(g_ram+0xB34))
#define shinespark_x_accel (*(uint16*)(g_ram+0xB34))
// }
#define samus_y_dir (*(uint16*)(g_ram+0xB36))
#define UNUSED_word_7E0B38 (*(uint16*)(g_ram+0xB38))
#define samus_has_momentum_flag (*(uint16*)(g_ram+0xB3C))
#define speed_boost_counter (*(uint16*)(g_ram+0xB3E))
#define speed_boost_timer (*(uint8*)(g_ram+0xB3E))
#define speed_boost_counter (*(uint8*)(g_ram+0xB3F))
#define samus_echoes_sound_flag (*(uint16*)(g_ram+0xB40))
#define samus_x_extra_run_speed (*(uint16*)(g_ram+0xB42))
#define samus_x_extra_run_subspeed (*(uint16*)(g_ram+0xB44))
@ -622,20 +646,42 @@ extern int32 *cur_coll_amt32;
#define projectile_y_subpos ((uint16*)(g_ram+0xBA0))
#define projectile_x_radius ((uint16*)(g_ram+0xBB4))
#define projectile_y_radius ((uint16*)(g_ram+0xBC8))
// {
#define projectile_x_speed ((uint16*)(g_ram+0xBDC))
#define projectile_distance ((uint16*)(g_ram+0xBDC))
// }
#define bomb_x_speed ((uint16*)(g_ram+0xBE6))
// {
#define projectile_y_speed ((uint16*)(g_ram+0xBF0))
#define projectile_sba_timer ((uint16*)(g_ram+0xBF0))
#define projectile_angle_delta ((uint16*)(g_ram+0xBF0))
#define projectile_plasma_sba_phase ((uint16*)(g_ram+0xBF0))
// }
#define bomb_y_speed ((uint16*)(g_ram+0xBFA))
#define projectile_dir ((uint16*)(g_ram+0xC04))
#define projectile_type ((uint16*)(g_ram+0xC18))
#define main_bomb_spread_bomb (*(uint16*)(g_ram+0xC22))
#define projectile_damage ((uint16*)(g_ram+0xC2C))
#define projectile_instruction_ptr ((uint16*)(g_ram+0xC40))
#define projectile_instruction_timers ((uint16*)(g_ram+0xC54))
#define projectile_pre_instructions ((uint16*)(g_ram+0xC68))
#define bomb_functions ((uint16*)(g_ram+0xC72))
#define main_bomb_spread_bomb_pre_instruction (*(uint16*)(g_ram+0xC72))
#define projectile_variables ((uint16*)(g_ram+0xC7C))
// {
#define projectile_initialized_flag ((uint16*)(g_ram+0xC7C))
#define projectile_initial_speed ((uint16*)(g_ram+0xC7C))
#define projectile_link_index ((uint16*)(g_ram+0xC7C))
#define projectile_angle ((uint16*)(g_ram+0xC7C))
#define projectile_wave_sba_y_speed ((uint16*)(g_ram+0xC7C))
// }
#define bomb_timers ((uint16*)(g_ram+0xC86))
#define projectile_timers ((uint16*)(g_ram+0xC90))
#define bomb_subspeeds ((uint16*)(g_ram+0xC9A))
#define projectile_unk_A ((uint16*)(g_ram+0xCA4))
#define projectile_trail_timers ((uint16*)(g_ram+0xC90))
#define bomb_y_subspeeds ((uint16*)(g_ram+0xC9A))
#define projectile_variables_1 ((uint16*)(g_ram+0xCA4))
// {
#define spazer_sba_phase ((uint16*)(g_ram+0xCA4))
#define bomb_bounce_y_speed ((uint16*)(g_ram+0xCAE))
// }
#define projectile_spritemap_pointers ((uint16*)(g_ram+0xCB8))
#define cooldown_timer (*(uint16*)(g_ram+0xCCC))
#define projectile_counter (*(uint16*)(g_ram+0xCCE))
@ -699,13 +745,13 @@ extern int32 *cur_coll_amt32;
#define grapple_point_anim_ptr (*(uint16*)(g_ram+0xD40))
#define grapple_segment_anim_instr_timers ((uint16*)(g_ram+0xD42))
#define grapple_segment_anim_instr_ptrs ((uint16*)(g_ram+0xD62))
#define button_config_shoot_x_saved (*(uint16*)(g_ram+0xD82))
#define button_config_jump_a_saved (*(uint16*)(g_ram+0xD84))
#define button_config_run_b_saved (*(uint16*)(g_ram+0xD86))
#define button_config_itemcancel_y_saved (*(uint16*)(g_ram+0xD88))
#define button_config_shoot_saved (*(uint16*)(g_ram+0xD82))
#define button_config_jump_saved (*(uint16*)(g_ram+0xD84))
#define button_config_run_saved (*(uint16*)(g_ram+0xD86))
#define button_config_itemcancel_saved (*(uint16*)(g_ram+0xD88))
#define button_config_itemswitch_saved (*(uint16*)(g_ram+0xD8A))
#define button_config_aim_down_L_saved (*(uint16*)(g_ram+0xD8C))
#define button_config_aim_up_R_saved (*(uint16*)(g_ram+0xD8E))
#define button_config_aim_down_saved (*(uint16*)(g_ram+0xD8C))
#define button_config_aim_up_saved (*(uint16*)(g_ram+0xD8E))
#define grapple_beam_grapple_start_x (*(uint16*)(g_ram+0xD90))
#define grapple_beam_grapple_start_y (*(uint16*)(g_ram+0xD92))
#define grapple_beam_grapple_start_block_x (*(uint16*)(g_ram+0xD94))
@ -719,23 +765,23 @@ extern int32 *cur_coll_amt32;
#define camera_x_subspeed (*(uint16*)(g_ram+0xDA4))
#define camera_y_speed (*(uint16*)(g_ram+0xDA6))
#define camera_y_subspeed (*(uint16*)(g_ram+0xDA8))
#define projectile_init_speed_samus_moved_left (*(uint16*)(g_ram+0xDAA))
#define projectile_init_speed_samus_moved_left_fract (*(uint16*)(g_ram+0xDAC))
#define projectile_init_speed_samus_moved_right (*(uint16*)(g_ram+0xDAE))
#define projectile_init_speed_samus_moved_right_fract (*(uint16*)(g_ram+0xDB0))
#define projectile_init_speed_samus_moved_up (*(uint16*)(g_ram+0xDB2))
#define projectile_init_speed_samus_moved_up_fract (*(uint16*)(g_ram+0xDB4))
#define projectile_init_speed_samus_moved_down (*(uint16*)(g_ram+0xDB6))
#define projectile_init_speed_samus_moved_down_fract (*(uint16*)(g_ram+0xDB8))
#define distance_samus_moved_left (*(uint16*)(g_ram+0xDAA))
#define distance_samus_moved_left_fract (*(uint16*)(g_ram+0xDAC))
#define distance_samus_moved_right (*(uint16*)(g_ram+0xDAE))
#define distance_samus_moved_right_fract (*(uint16*)(g_ram+0xDB0))
#define distance_samus_moved_up (*(uint16*)(g_ram+0xDB2))
#define distance_samus_moved_up_fract (*(uint16*)(g_ram+0xDB4))
#define distance_samus_moved_down (*(uint16*)(g_ram+0xDB6))
#define distance_samus_moved_down_fract (*(uint16*)(g_ram+0xDB8))
#define samus_pos_adjusted_by_slope_flag (*(uint16*)(g_ram+0xDBA))
#define samus_total_x_speed (*(uint16*)(g_ram+0xDBC))
#define samus_total_x_subspeed (*(uint16*)(g_ram+0xDBE))
#define play_resume_charging_beam_sfx (*(uint16*)(g_ram+0xDC0))
#define prev_beam_charge_counter (*(uint16*)(g_ram+0xDC2))
#define cur_block_index (*(uint16*)(g_ram+0xDC4))
#define input_to_pose_calc (*(uint16*)(g_ram+0xDC6))
#define samus_solid_vertical_coll_result (*(uint16*)(g_ram+0xDC6))
#define queued_message_box_index (*(uint16*)(g_ram+0xDC8))
#define samus_collides_with_solid_enemy (*(uint16*)(g_ram+0xDCE))
#define samus_stopped_by_collision (*(uint16*)(g_ram+0xDCE))
#define samus_collision_flag (*(uint16*)(g_ram+0xDD0))
#define REMOVED_temp_collision_DD2 (*(uint16*)(g_ram+0xDD2))
#define REMOVED_temp_collision_DD4 (*(uint16*)(g_ram+0xDD4))
@ -751,9 +797,19 @@ extern int32 *cur_coll_amt32;
// {
#define substate (*(uint16*)(g_ram+0xDEC))
#define samus_fanfare_timer (*(uint16*)(g_ram+0xDEC))
#define shinespark_y_accel (*(uint16*)(g_ram+0xDEC))
#define crystal_flash_ammo_decrement_timer (*(uint16*)(g_ram+0xDEC))
#define draygon_escape_button_counter (*(uint16*)(g_ram+0xDEC))
// }
// {
#define suit_pickup_light_beam_pos (*(uint16*)(g_ram+0xDEE))
#define shinespark_y_subaccel (*(uint16*)(g_ram+0xDEE))
#define draygon_escape_prev_dpad_input (*(uint16*)(g_ram+0xDEE))
// }
// {
#define suit_pickup_color_math_R (*(uint8*)(g_ram+0xDF0))
#define crystal_flash_y_pos (*(uint16*)(g_ram+0xDF0))
// }
#define suit_pickup_color_math_G (*(uint8*)(g_ram+0xDF1))
#define suit_pickup_color_math_B (*(uint8*)(g_ram+0xDF2))
#define suit_pickup_palette_transition_color (*(uint8*)(g_ram+0xDF3))