mirror of
https://github.com/pmret/papermario.git
synced 2024-11-18 00:42:34 +01:00
player anim + collider surface types (#769)
* player anim + collider surface types * added default surface type * remove unused flags and define surface mask * revised action table * checkpoint * player sprite stuff * remove currentAnim union * more actions * enough * discharged Co-authored-by: HailSanta <Hail2Santa@gmail.com>
This commit is contained in:
parent
3e91a3fd53
commit
f7e39c0802
@ -189,10 +189,7 @@ typedef struct Npc {
|
||||
NpcQuizmoBlur* quizmo;
|
||||
} blur;
|
||||
/* 0x024 */ s32 spriteInstanceID;
|
||||
/* 0x028 */ union {
|
||||
/* */ u16 h;
|
||||
/* */ u32 w;
|
||||
/* */ } currentAnim;
|
||||
/* 0x028 */ AnimID currentAnim;
|
||||
/* 0x02C */ s32 unk_2C;
|
||||
/* 0x030 */ f32 animationSpeed;
|
||||
/* 0x034 */ f32 renderYaw;
|
||||
@ -989,7 +986,7 @@ typedef struct CollisionData {
|
||||
/* 0x04 */ Collider* colliderList;
|
||||
/* 0x08 */ union {
|
||||
struct ColliderBoundingBox* aabbs;
|
||||
CameraControlSettings* camSettings;
|
||||
struct CameraControlSettings* camSettings;
|
||||
};
|
||||
/* 0x0C */ s16 numColliders;
|
||||
/* 0x0E */ char unk_0E[2];
|
||||
@ -1888,6 +1885,14 @@ typedef struct FontData {
|
||||
/* 0x00 */ char unk_00[24];
|
||||
} FontData; // size = 0x18
|
||||
|
||||
typedef struct SlideParams {
|
||||
f32 heading;
|
||||
f32 maxDescendAccel;
|
||||
f32 launchVelocity;
|
||||
f32 maxDescendVelocity;
|
||||
f32 integrator[4];
|
||||
} SlideParams;
|
||||
|
||||
typedef struct PlayerStatus {
|
||||
/* 0x000 */ s32 flags; // PlayerStatusFlags
|
||||
/* 0x004 */ u32 animFlags;
|
||||
@ -1922,31 +1927,31 @@ typedef struct PlayerStatus {
|
||||
/* 0x084 */ f32 currentYaw;
|
||||
/* 0x088 */ f32 overlapPushYaw;
|
||||
/* 0x08C */ f32 pitch;
|
||||
/* 0x090 */ f32 unk_90[4];
|
||||
/* 0x090 */ f32 flipYaw[4];
|
||||
/* 0x0A0 */ f32 heading;
|
||||
/* 0x0A4 */ s32 trueAnimation; ///< Encoding back-facing sprite
|
||||
/* 0x0A4 */ AnimID trueAnimation; ///< Encoding back-facing sprite
|
||||
/* 0x0A8 */ f32 spriteFacingAngle; /* angle of sprite, relative to camera, from 0 to 180 */
|
||||
/* 0x0AC */ char unk_AC[4];
|
||||
/* 0x0B0 */ s16 colliderHeight;
|
||||
/* 0x0B2 */ s16 colliderDiameter;
|
||||
/* 0x0B4 */ s8 actionState;
|
||||
/* 0x0B5 */ s8 prevActionState;
|
||||
/* 0x0B6 */ s8 fallState; ///< Also used as sleep state in Peach idle action
|
||||
/* 0x0B6 */ s8 actionSubstate;
|
||||
/* 0x0B7 */ char unk_B7;
|
||||
/* 0x0B8 */ u32 anim;
|
||||
/* 0x0B8 */ AnimID anim;
|
||||
/* 0x0BC */ u16 unk_BC;
|
||||
/* 0x0BE */ s8 renderMode;
|
||||
/* 0x0BF */ s8 unk_BF;
|
||||
/* 0x0BF */ s8 hazardType;
|
||||
/* 0x0C0 */ s16 timeInAir;
|
||||
/* 0x0C2 */ s16 unk_C2;
|
||||
/* 0x0C4 */ char unk_C4;
|
||||
/* 0x0C4 */ s8 peachItemHeld;
|
||||
/* 0x0C5 */ s8 unk_C5;
|
||||
/* 0x0C6 */ s16 interactingWithID;
|
||||
/* 0x0C8 */ Npc* encounteredNPC;
|
||||
/* 0x0CC */ s32 shadowID;
|
||||
/* 0x0D0 */ f32* unk_D0;
|
||||
/* 0x0D0 */ SlideParams* slideParams;
|
||||
/* 0x0D4 */ f32 spinRate;
|
||||
/* 0x0D8 */ struct EffectInstance* unk_D8; // effect 46
|
||||
/* 0x0D8 */ struct EffectInstance* specialDecorationEffect;
|
||||
/* 0x0DC */ s32 currentButtons;
|
||||
/* 0x0E0 */ s32 pressedButtons;
|
||||
/* 0x0E4 */ s32 heldButtons;
|
||||
@ -1958,7 +1963,7 @@ typedef struct PlayerStatus {
|
||||
/* 0x190 */ s32 stickYBuffer[10];
|
||||
/* 0x1B8 */ s32 inputBufPos;
|
||||
/* 0x1BC */ char unk_1BC[196];
|
||||
/* 0x280 */ s8 unk_280;
|
||||
/* 0x280 */ s8 poundImpactDelay; // governs period of immobility after landing a ground pound
|
||||
/* 0x281 */ char unk_281[7];
|
||||
} PlayerStatus; // size = 0x288
|
||||
|
||||
|
@ -654,11 +654,11 @@ enum SoundIDs {
|
||||
SOUND_139 = 0x00000139,
|
||||
SOUND_13D = 0x0000013D,
|
||||
SOUND_13E = 0x0000013E,
|
||||
SOUND_STEP1 = 0x00000141,
|
||||
SOUND_STEP2 = 0x00000142,
|
||||
SOUND_143 = 0x00000143,
|
||||
SOUND_144 = 0x00000144,
|
||||
SOUND_146 = 0x00000146,
|
||||
SOUND_STEP_NORMAL1 = 0x00000141,
|
||||
SOUND_STEP_NORMAL2 = 0x00000142,
|
||||
SOUND_STEP_CRUNCHY1 = 0x00000143,
|
||||
SOUND_STEP_CRUNCHY2 = 0x00000144,
|
||||
SOUND_SPIN_JUMP = 0x00000146,
|
||||
SOUND_TORNADO_JUMP = 0x00000147,
|
||||
SOUND_SOFT_LAND = 0x00000148,
|
||||
SOUND_149 = 0x00000149,
|
||||
@ -679,7 +679,7 @@ enum SoundIDs {
|
||||
SOUND_166 = 0x00000166,
|
||||
SOUND_167 = 0x00000167,
|
||||
SOUND_168 = 0x00000168,
|
||||
SOUND_172 = 0x00000172,
|
||||
SOUND_DUST_OFF = 0x00000172,
|
||||
SOUND_173 = 0x00000173,
|
||||
SOUND_174 = 0x00000174,
|
||||
SOUND_175 = 0x00000175,
|
||||
@ -872,7 +872,7 @@ enum SoundIDs {
|
||||
SOUND_2F1 = 0x000002F1,
|
||||
SOUND_2F3 = 0x000002F3,
|
||||
SOUND_2F4 = 0x000002F4,
|
||||
SOUND_2F6 = 0x000002F6,
|
||||
SOUND_TWEESTER_LAUNCH = 0x000002F6,
|
||||
SOUND_2F7 = 0x000002F7,
|
||||
SOUND_2F9 = 0x000002F9,
|
||||
SOUND_CLOSE_SHELL = 0x000002FF,
|
||||
@ -1268,6 +1268,9 @@ enum SoundIDs {
|
||||
SOUND_8000006B = 0x8000006B,
|
||||
SOUND_8000006C = 0x8000006C,
|
||||
SOUND_B000000A = 0xB000000A,
|
||||
SOUND_B000000C = 0xB000000C,
|
||||
SOUND_B000000D = 0xB000000D,
|
||||
SOUND_B000000E = 0xB000000E,
|
||||
SOUND_B0000010 = 0xB0000010,
|
||||
SOUND_B0000011 = 0xB0000011,
|
||||
SOUND_B0000012 = 0xB0000012,
|
||||
@ -1374,9 +1377,9 @@ enum AuxCameraParams {
|
||||
|
||||
enum ItemIDs {
|
||||
ITEM_NONE = 0x00000000,
|
||||
ITEM_JUMP = 0x00000001,
|
||||
ITEM_SPIN_JUMP = 0x00000002,
|
||||
ITEM_TORNADO_JUMP = 0x00000003,
|
||||
ITEM_BOOTS = 0x00000001,
|
||||
ITEM_SUPER_BOOTS = 0x00000002,
|
||||
ITEM_ULTRA_BOOTS = 0x00000003,
|
||||
ITEM_HAMMER = 0x00000004,
|
||||
ITEM_SUPER_HAMMER = 0x00000005,
|
||||
ITEM_ULTRA_HAMMER = 0x00000006,
|
||||
@ -1619,7 +1622,7 @@ enum ItemIDs {
|
||||
ITEM_ATTACK_FX_A = 0x000000F3,
|
||||
ITEM_ALLOR_NOTHING = 0x000000F4,
|
||||
ITEM_HP_DRAIN = 0x000000F5,
|
||||
ITEM_JUMP_CHARGE0 = 0x000000F6,
|
||||
ITEM_BOOTS_CHARGE0 = 0x000000F6,
|
||||
ITEM_SLOW_GO = 0x000000F7,
|
||||
ITEM_FP_PLUS_A = 0x000000F8,
|
||||
ITEM_MEGA_RUSH = 0x000000F9,
|
||||
@ -1639,7 +1642,7 @@ enum ItemIDs {
|
||||
ITEM_HAMMER_THROW = 0x00000107,
|
||||
ITEM_MEGA_QUAKE = 0x00000108,
|
||||
ITEM_SMASH_CHARGE = 0x00000109,
|
||||
ITEM_JUMP_CHARGE = 0x0000010A,
|
||||
ITEM_BOOTS_CHARGE = 0x0000010A,
|
||||
ITEM_S_SMASH_CHG = 0x0000010B,
|
||||
ITEM_S_JUMP_CHG = 0x0000010C,
|
||||
ITEM_POWER_RUSH = 0x0000010D,
|
||||
@ -1783,6 +1786,22 @@ enum ItemTargetFlags {
|
||||
ITEM_TARGET_FLAG_8000 = 0x8000
|
||||
};
|
||||
|
||||
enum PlayerSprites {
|
||||
SPR_Mario_1 = 0x1,
|
||||
SPR_Mario_2 = 0x2,
|
||||
SPR_Mario_3 = 0x3,
|
||||
SPR_Mario_4 = 0x4,
|
||||
SPR_Mario_5 = 0x5,
|
||||
SPR_Mario_6 = 0x6,
|
||||
SPR_Mario_7 = 0x7,
|
||||
SPR_Mario_8 = 0x8,
|
||||
SPR_Mario_9 = 0x9,
|
||||
SPR_Peach_A = 0xA,
|
||||
SPR_Peach_B = 0xB,
|
||||
SPR_Peach_C = 0xC,
|
||||
SPR_Peach_D = 0xD,
|
||||
};
|
||||
|
||||
// TODO: extract player sprite + animations
|
||||
enum PlayerAnims {
|
||||
ANIM_Mario_StandStill = 0x00010000,
|
||||
@ -2638,13 +2657,13 @@ enum ActionStates {
|
||||
// Following action states prohibit movement (see set_action_state())
|
||||
ACTION_STATE_TALK = 0x0000000C, ///< Reading signs doesn't count
|
||||
ACTION_STATE_SPIN_JUMP = 0x0000000D,
|
||||
ACTION_STATE_GROUND_POUND = 0x0000000E,
|
||||
ACTION_STATE_ULTRA_JUMP = 0x0000000F,
|
||||
ACTION_STATE_ULTRA_POUND = 0x00000010,
|
||||
ACTION_STATE_SPIN_POUND = 0x0000000E,
|
||||
ACTION_STATE_TORNADO_JUMP = 0x0000000F,
|
||||
ACTION_STATE_TORNADO_POUND = 0x00000010,
|
||||
ACTION_STATE_SLIDING = 0x00000011,
|
||||
ACTION_STATE_HAMMER = 0x00000012,
|
||||
ACTION_STATE_13 = 0x00000013,
|
||||
ACTION_STATE_14 = 0x00000014,
|
||||
ACTION_STATE_PUSHING_BLOCK = 0x00000014,
|
||||
ACTION_STATE_HIT_FIRE = 0x00000015, ///< Causes Mario to fly up and take damage. Used for fire bars.
|
||||
ACTION_STATE_KNOCKBACK = 0x00000016, // some kind of knockback, does no damage
|
||||
ACTION_STATE_HIT_LAVA = 0x00000017,
|
||||
@ -2661,10 +2680,21 @@ enum ActionStates {
|
||||
ACTION_STATE_STEP_UP = 0x00000022,
|
||||
ACTION_STATE_23 = 0x00000023,
|
||||
ACTION_STATE_24 = 0x00000024,
|
||||
ACTION_STATE_25 = 0x00000025,
|
||||
ACTION_STATE_INVALID_25 = 0x00000025,
|
||||
ACTION_STATE_USE_SPRING = 0x00000026,
|
||||
};
|
||||
|
||||
enum JumpSubstate {
|
||||
JUMP_SUBSTATE_0 = 0,
|
||||
JUMP_SUBSTATE_1 = 1,
|
||||
};
|
||||
|
||||
enum LandOnSwitchSubstate {
|
||||
LANDING_ON_SWITCH_SUBSTATE_0 = 0,
|
||||
LANDING_ON_SWITCH_SUBSTATE_1 = 1,
|
||||
LANDING_ON_SWITCH_SUBSTATE_2 = 2,
|
||||
};
|
||||
|
||||
/* (1 = isPeach, 2 = isTransformed, 4 = hasUmbrella) */
|
||||
enum PeachStatusFlags {
|
||||
PEACH_STATUS_FLAG_IS_PEACH = 0x01,
|
||||
@ -3093,6 +3123,7 @@ enum NpcFlags {
|
||||
};
|
||||
|
||||
enum PlayerStatusFlags {
|
||||
PLAYER_STATUS_FLAGS_AIRBORNE = 0x0000000E,
|
||||
PLAYER_STATUS_FLAGS_JUMPING = 0x00000002,
|
||||
PLAYER_STATUS_FLAGS_FALLING = 0x00000004,
|
||||
PLAYER_STATUS_FLAGS_FLYING = 0x00000008,
|
||||
@ -3109,7 +3140,7 @@ enum PlayerStatusFlags {
|
||||
PLAYER_STATUS_FLAGS_4000 = 0x00004000,
|
||||
PLAYER_STATUS_FLAGS_8000 = 0x00008000,
|
||||
PLAYER_STATUS_FLAGS_20000 = 0x00020000,
|
||||
PLAYER_STATUS_FLAGS_40000 = 0x00040000,
|
||||
PLAYER_STATUS_FLAGS_40000 = 0x00040000, // physics and animations run at half speed
|
||||
PLAYER_STATUS_FLAGS_80000 = 0x00080000,
|
||||
PLAYER_STATUS_FLAGS_100000 = 0x00100000,
|
||||
PLAYER_STATUS_FLAGS_200000 = 0x00200000, // using hammer?
|
||||
@ -3407,6 +3438,13 @@ enum ActionCommand {
|
||||
ACTION_COMMAND_TIDAL_WAVE = 0x00000017,
|
||||
};
|
||||
|
||||
enum HazardType {
|
||||
HAZARD_TYPE_NONE = 0,
|
||||
HAZARD_TYPE_LAVA = 1,
|
||||
HAZARD_TYPE_SPIKES = 2,
|
||||
HAZARD_TYPE_FIRE_BAR = 3,
|
||||
};
|
||||
|
||||
enum EffectGfxDataFlags {
|
||||
FX_GRAPHICS_DISABLED = 0x00000000,
|
||||
FX_GRAPHICS_ENABLED = 0x00000001,
|
||||
@ -4078,16 +4116,23 @@ enum MusicSettingsFlags {
|
||||
MUSIC_SETTINGS_FLAGS_80000000 = 0x80000000,
|
||||
};
|
||||
|
||||
// the lower byte of Collider::flags
|
||||
enum SurfaceType {
|
||||
SURFACE_TYPE_DEFAULT = 0,
|
||||
SURFACE_TYPE_WATER = 1,
|
||||
SURFACE_TYPE_SPIKES = 2,
|
||||
SURFACE_TYPE_LAVA = 3,
|
||||
SURFACE_TYPE_DOCK_WALL = 4,
|
||||
SURFACE_TYPE_SLIDE = 5,
|
||||
SURFACE_TYPE_FLOWERS = 6,
|
||||
SURFACE_TYPE_CLOUD = 7, ///< used with clouds in flo_19 and flo_21
|
||||
SURFACE_TYPE_SNOW = 8,
|
||||
SURFACE_TYPE_HEDGES = 9, ///< used within hedge maze in flo_11
|
||||
};
|
||||
|
||||
enum ColliderFlags {
|
||||
COLLIDER_FLAGS_UPPER_MASK = 0x7FFFFE00, // map data dumper needs this to be first
|
||||
COLLIDER_FLAGS_WATER_FLOOR = 0x00000001,
|
||||
COLLIDER_FLAGS_LAVA_FLOOR = 0x00000002,
|
||||
COLLIDER_FLAGS_SUSHIE_DOCK_WALL = 0x00000004,
|
||||
COLLIDER_FLAGS_SNOW_FLOOR = 0x00000008,
|
||||
COLLIDER_FLAGS_10 = 0x00000010,
|
||||
COLLIDER_FLAGS_20 = 0x00000020,
|
||||
COLLIDER_FLAGS_40 = 0x00000040,
|
||||
COLLIDER_FLAGS_80 = 0x00000080,
|
||||
COLLIDER_FLAGS_SURFACE_TYPE_MASK = 0x000000FF,
|
||||
COLLIDER_FLAGS_100 = 0x00000100,
|
||||
COLLIDER_FLAGS_200 = 0x00000200,
|
||||
COLLIDER_FLAGS_400 = 0x00000400,
|
||||
|
@ -608,9 +608,9 @@ s32 add_star_pieces(s32 amt);
|
||||
s32 make_item_entity_at_player(s32 itemID, s32 arg1, s32 pickupMsgFlags);
|
||||
|
||||
void set_action_state(s32 actionState);
|
||||
s32 get_collider_type_by_id(s32 colliderID);
|
||||
void suggest_player_anim_setUnkFlag(s32 arg0);
|
||||
void suggest_player_anim_clearUnkFlag(s32 arg0);
|
||||
s32 get_collider_flags(s32 colliderID);
|
||||
void suggest_player_anim_setUnkFlag(AnimID anim);
|
||||
void suggest_player_anim_clearUnkFlag(AnimID anim);
|
||||
void subtract_hp(s32 amt);
|
||||
void draw_status_ui(void);
|
||||
void open_status_menu_long(void);
|
||||
@ -740,7 +740,7 @@ void func_802B71C8(void);
|
||||
void func_802B71D4(void);
|
||||
void func_802B72C0_E22870(void);
|
||||
s32 func_802BD7DC(void);
|
||||
void func_802BE070_31DBE0(void);
|
||||
void world_watt_sync_held_position(void);
|
||||
void func_802BFB44_323694(f32 arg0);
|
||||
|
||||
void initialize_curtains(void);
|
||||
|
@ -83,8 +83,7 @@
|
||||
// Should be 1.0f / 0x7FFF, but precision is wrong for a double
|
||||
#define SHT_MINV 3.051851e-05
|
||||
|
||||
|
||||
#define SPRITE_WORLD_SCALE (5.0f/7.0f)
|
||||
#define SPRITE_WORLD_SCALE_F (5.0f/7.0f)
|
||||
#define SPRITE_WORLD_SCALE_D (5.0/7.0)
|
||||
|
||||
#define BATTLE_ENTITY_ID_MASK 0x800
|
||||
@ -112,10 +111,16 @@
|
||||
|
||||
#define ASCII_TO_U32(a, b, c, d) ((u32)((a << 24) | (b << 16) | (c << 8) | (d << 0)))
|
||||
|
||||
#define SPRITE_PIXEL_SCALE (5.0 / 7.0)
|
||||
|
||||
#define ITEM_VIS_GROUP(itemID, visGroupID) ((visGroupID) << 16 | (itemID))
|
||||
|
||||
// loads integrator with standard parameter set used for falling
|
||||
|
||||
#define LOAD_INTEGRATOR_FALL(ptr) \
|
||||
(ptr)[0] = 0.11430f; \
|
||||
(ptr)[1] = -0.28710f; \
|
||||
(ptr)[2] = -0.18230f; \
|
||||
(ptr)[3] = 0.01152f; \
|
||||
|
||||
/* common AI function and script variables */
|
||||
// ai script
|
||||
#define AI_TEMP_STATE functionTemp[0]
|
||||
|
@ -404,11 +404,11 @@ void init_npc_list(void);
|
||||
/// Presumably did something once upon a time but got commented out.
|
||||
void npc_iter_no_op(void);
|
||||
|
||||
s32 _create_npc(NpcBlueprint* blueprint, u32** animList, s32 skipLoadingAnims);
|
||||
s32 _create_npc(NpcBlueprint* blueprint, AnimID** animList, s32 skipLoadingAnims);
|
||||
|
||||
s32 _create_npc_basic(NpcBlueprint* blueprint);
|
||||
|
||||
s32 _create_npc_standard(NpcBlueprint* blueprint, u32** animList);
|
||||
s32 _create_npc_standard(NpcBlueprint* blueprint, AnimID** animList);
|
||||
|
||||
s32 _create_npc_partner(NpcBlueprint* blueprint);
|
||||
|
||||
|
@ -72,7 +72,7 @@ extern CollisionData gCollisionData;
|
||||
|
||||
extern s8 D_800A0900;
|
||||
extern f32 GravityParamsStartFall[];
|
||||
extern s16 D_800F7B80;
|
||||
extern s16 FootstepSoundSelector;
|
||||
extern u8* D_801512F0;
|
||||
extern u16 D_80151308;
|
||||
extern s32 gEntityHideMode;
|
||||
@ -192,11 +192,11 @@ extern UNK_FUN_PTR(D_8010C940);
|
||||
extern Entity* TweesterTouchingPartner;
|
||||
extern Entity* TweesterTouchingPlayer;
|
||||
extern UNK_FUN_PTR(D_8010C958);
|
||||
extern s32 D_8010C95C;
|
||||
extern s32 PrevPlayerDirection;
|
||||
extern s32 D_8010C96C;
|
||||
extern s32 D_8010C980;
|
||||
extern s32 D_8010C9A0;
|
||||
extern s32 D_800F7B40;
|
||||
extern s32 PrevPlayerCamRelativeYaw;
|
||||
extern s32 D_800F7B44;
|
||||
extern f32 D_8010C938;
|
||||
extern f32 D_8010C990;
|
||||
@ -258,8 +258,8 @@ extern s32 D_80292110[];
|
||||
|
||||
extern s32 D_8029FBD0;
|
||||
|
||||
extern s32 KoopatrolDisguiseExtraAnims[];
|
||||
extern s32 HammerBroDisguiseExtraAnims[];
|
||||
extern AnimID KoopatrolDisguiseExtraAnims[];
|
||||
extern AnimID HammerBroDisguiseExtraAnims[];
|
||||
|
||||
//various
|
||||
extern s32 D_802C05CC;
|
||||
|
16
src/182B30.c
16
src/182B30.c
@ -348,9 +348,9 @@ void appendGfx_player_actor_blur(Actor* actor) {
|
||||
guRotateF(mtxRotZ, rotZ, 0.0f, 0.0f, 1.0f);
|
||||
guMtxCatF(mtxRotX, mtxRotY, mtxTransform);
|
||||
guMtxCatF(mtxTransform, mtxRotZ, mtxRotation);
|
||||
guScaleF(mtxScale, actor->scale.x * SPRITE_PIXEL_SCALE * actor->scalingFactor,
|
||||
actor->scale.y * SPRITE_PIXEL_SCALE * actor->scalingFactor * partTable->verticalStretch,
|
||||
actor->scale.z * SPRITE_PIXEL_SCALE);
|
||||
guScaleF(mtxScale, actor->scale.x * SPRITE_WORLD_SCALE_D * actor->scalingFactor,
|
||||
actor->scale.y * SPRITE_WORLD_SCALE_D * actor->scalingFactor * partTable->verticalStretch,
|
||||
actor->scale.z * SPRITE_WORLD_SCALE_D);
|
||||
guMtxCatF(mtxScale, mtxPivotOn, mtxTemp);
|
||||
guMtxCatF(mtxTemp, mtxRotation, mtxTransform);
|
||||
guMtxCatF(mtxTransform, mtxPivotOff, mtxTemp);
|
||||
@ -424,9 +424,9 @@ void func_802552EC(s32 arg0, Actor* actor) {
|
||||
guRotateF(mtxRotZ, actor->rotation.z, 0.0f, 0.0f, 1.0f);
|
||||
guMtxCatF(mtxRotX, mtxRotY, mtxTemp);
|
||||
guMtxCatF(mtxTemp, mtxRotZ, mtxRotation);
|
||||
guScaleF(mtxScale, actor->scale.x * SPRITE_PIXEL_SCALE * actor->scalingFactor,
|
||||
actor->scale.y * SPRITE_PIXEL_SCALE * actor->scalingFactor,
|
||||
actor->scale.z * SPRITE_PIXEL_SCALE);
|
||||
guScaleF(mtxScale, actor->scale.x * SPRITE_WORLD_SCALE_D * actor->scalingFactor,
|
||||
actor->scale.y * SPRITE_WORLD_SCALE_D * actor->scalingFactor,
|
||||
actor->scale.z * SPRITE_WORLD_SCALE_D);
|
||||
guMtxCatF(mtxScale, mtxRotation, mtxActor);
|
||||
|
||||
numParts = actor->numParts;
|
||||
@ -453,7 +453,7 @@ void func_802552EC(s32 arg0, Actor* actor) {
|
||||
}
|
||||
|
||||
if (partTable->flags & ACTOR_PART_FLAG_USE_ABSOLUTE_POSITION) {
|
||||
guScaleF(mtxPartScale, actor->scale.x * SPRITE_PIXEL_SCALE, actor->scale.y * SPRITE_PIXEL_SCALE, actor->scale.z * SPRITE_PIXEL_SCALE);
|
||||
guScaleF(mtxPartScale, actor->scale.x * SPRITE_WORLD_SCALE_D, actor->scale.y * SPRITE_WORLD_SCALE_D, actor->scale.z * SPRITE_WORLD_SCALE_D);
|
||||
}
|
||||
|
||||
j = decorationTable->unk_7D9;
|
||||
@ -3705,7 +3705,7 @@ void func_8025DA68(ActorPart* part, s32 decorationIndex) {
|
||||
x = part->currentPos.x;
|
||||
y = part->currentPos.y + (part->size.y / 2);
|
||||
z = part->currentPos.z - 5.0f;
|
||||
// bug? perhaps this should be % 4?
|
||||
// @bug? perhaps this should be % 4?
|
||||
if ((gGameStatusPtr->frameCounter / 4) == 0) {
|
||||
fx_sparkles(FX_SPARKLES_1, x, y, z, 10.0f);
|
||||
}
|
||||
|
12
src/190A10.c
12
src/190A10.c
@ -3,19 +3,19 @@
|
||||
extern s32 D_8010C968;
|
||||
extern s32 D_8010C98C;
|
||||
|
||||
s32 func_80262130(f32 inX, f32 inY, f32 inZ, f32 arg3, f32 radius) {
|
||||
s32 func_80262130(f32 inX, f32 inY, f32 inZ, f32 height, f32 radius) {
|
||||
f32 x = inX;
|
||||
f32 y = inY;
|
||||
f32 z = inZ;
|
||||
f32 hitDepth = arg3;
|
||||
f32 hitDepth = height;
|
||||
s32 ret = FALSE;
|
||||
s32 phi_s0 = 0;
|
||||
|
||||
if (npc_raycast_down_around(0, &x, &y, &z, &hitDepth, 90.0f, radius) && hitDepth <= arg3) {
|
||||
s32 type = get_collider_type_by_id(D_8010C98C & 0xFF);
|
||||
s32 type2 = get_collider_type_by_id(D_8010C968 & 0xFF);
|
||||
if (npc_raycast_down_around(0, &x, &y, &z, &hitDepth, 90.0f, radius) && hitDepth <= height) {
|
||||
s32 colliderFlagsA = get_collider_flags(D_8010C98C & 0xFF);
|
||||
s32 colliderFlagsB = get_collider_flags(D_8010C968 & 0xFF);
|
||||
|
||||
phi_s0 = type & type2;
|
||||
phi_s0 = colliderFlagsA & colliderFlagsB;
|
||||
if (phi_s0 != (D_8010C98C & 0xFF)) {
|
||||
phi_s0 = 0;
|
||||
}
|
||||
|
@ -36,7 +36,7 @@ extern ActorPartBlueprint bMarioParts[];
|
||||
|
||||
extern PartnerDMAData D_80283F10[];
|
||||
|
||||
s32 func_80265CE8(u32*, s32);
|
||||
s32 func_80265CE8(AnimID*, s32);
|
||||
|
||||
void create_target_list(Actor* actor, s32 arg1);
|
||||
INCLUDE_ASM(s32, "190B20", create_target_list);
|
||||
@ -1218,7 +1218,7 @@ void load_partner_actor(void) {
|
||||
|
||||
if (part->idleAnimations != NULL) {
|
||||
part->currentAnimation = func_80265CE8(part->idleAnimations, 1);
|
||||
part->unk_84 = spr_load_npc_sprite(part->currentAnimation | 0x80000000, NULL);
|
||||
part->unk_84 = spr_load_npc_sprite(part->currentAnimation | SPRITE_ID_TAIL_ALLOCATE, NULL);
|
||||
}
|
||||
|
||||
if (i + 1 >= partCount) {
|
||||
@ -1484,7 +1484,7 @@ Actor* create_actor(Formation formation) {
|
||||
part->unk_84 = -1;
|
||||
|
||||
if (part->idleAnimations != NULL) {
|
||||
part->currentAnimation = func_80265CE8(part->idleAnimations, 1) & ~0x80000000;
|
||||
part->currentAnimation = func_80265CE8(part->idleAnimations, 1) & ~SPRITE_ID_TAIL_ALLOCATE;
|
||||
part->unk_84 = spr_load_npc_sprite(part->currentAnimation, NULL);
|
||||
}
|
||||
|
||||
|
@ -1351,9 +1351,9 @@ ApiStatus PlayerRunToGoal(Evt* script, s32 isInitialCall) {
|
||||
player->footStepCounter++;
|
||||
playerState->distance = 0.0f;
|
||||
if ((player->footStepCounter % 2) != 0) {
|
||||
sfx_play_sound_at_position(SOUND_STEP1, 0, player->currentPos.x, player->currentPos.y, player->currentPos.z);
|
||||
sfx_play_sound_at_position(SOUND_STEP_NORMAL1, 0, player->currentPos.x, player->currentPos.y, player->currentPos.z);
|
||||
} else {
|
||||
sfx_play_sound_at_position(SOUND_STEP2, 0, player->currentPos.x, player->currentPos.y, player->currentPos.z);
|
||||
sfx_play_sound_at_position(SOUND_STEP_NORMAL2, 0, player->currentPos.x, player->currentPos.y, player->currentPos.z);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1426,9 +1426,9 @@ ApiStatus CancelablePlayerRunToGoal(Evt* script, s32 isInitialCall) {
|
||||
player->footStepCounter++;
|
||||
playerState->distance = 0.0f;
|
||||
if ((player->footStepCounter % 2) != 0) {
|
||||
sfx_play_sound_at_position(SOUND_STEP1, 0, player->currentPos.x, player->currentPos.y, player->currentPos.z);
|
||||
sfx_play_sound_at_position(SOUND_STEP_NORMAL1, 0, player->currentPos.x, player->currentPos.y, player->currentPos.z);
|
||||
} else {
|
||||
sfx_play_sound_at_position(SOUND_STEP2, 0, player->currentPos.x, player->currentPos.y, player->currentPos.z);
|
||||
sfx_play_sound_at_position(SOUND_STEP_NORMAL2, 0, player->currentPos.x, player->currentPos.y, player->currentPos.z);
|
||||
}
|
||||
}
|
||||
|
||||
|
14
src/23680.c
14
src/23680.c
@ -269,7 +269,7 @@ void basic_ai_wander_init(Evt* script, MobileAISettings* npcAISettings, EnemyDet
|
||||
// chose a random direction and move time
|
||||
npc->duration = (npcAISettings->moveTime / 2) + rand_int((npcAISettings->moveTime / 2) + 1);
|
||||
npc->yaw = clamp_angle(npc->yaw + rand_int(60) - 30.0f);
|
||||
npc->currentAnim.w = enemy->animList[ENEMY_ANIM_WALK];
|
||||
npc->currentAnim = enemy->animList[ENEMY_ANIM_WALK];
|
||||
script->functionTemp[1] = 0;
|
||||
|
||||
if (enemy->territory->wander.moveSpeedOverride < 0) {
|
||||
@ -379,7 +379,7 @@ void basic_ai_loiter_init(Evt* script, MobileAISettings* aiSettings, EnemyDetect
|
||||
|
||||
npc->duration = (aiSettings->waitTime / 2) + rand_int((aiSettings->waitTime / 2) + 1);
|
||||
npc->yaw = clamp_angle(npc->yaw + rand_int(180) - 90.0f);
|
||||
npc->currentAnim.w = enemy->animList[ENEMY_ANIM_IDLE];
|
||||
npc->currentAnim = enemy->animList[ENEMY_ANIM_IDLE];
|
||||
script->AI_TEMP_STATE = AI_STATE_LOITER;
|
||||
}
|
||||
|
||||
@ -430,7 +430,7 @@ void basic_ai_found_player_jump_init(Evt* script, MobileAISettings* npcAISetting
|
||||
Npc* npc = get_npc_unsafe(enemy->npcID);
|
||||
|
||||
ai_enemy_play_sound(npc, SOUND_3E1, 0);
|
||||
npc->currentAnim.w = enemy->animList[ENEMY_ANIM_JUMP];
|
||||
npc->currentAnim = enemy->animList[ENEMY_ANIM_JUMP];
|
||||
npc->jumpVelocity = 10.0f;
|
||||
npc->jumpScale = 2.5f;
|
||||
npc->moveToPos.y = npc->pos.y;
|
||||
@ -489,7 +489,7 @@ void basic_ai_chase_init(Evt* script, MobileAISettings* npcAISettings, EnemyDete
|
||||
npc->duration = 0;
|
||||
}
|
||||
|
||||
npc->currentAnim.w = enemy->animList[ENEMY_ANIM_CHASE];
|
||||
npc->currentAnim = enemy->animList[ENEMY_ANIM_CHASE];
|
||||
npc->moveSpeed = npcAISettings->chaseSpeed;
|
||||
script->AI_TEMP_STATE = AI_STATE_CHASE;
|
||||
}
|
||||
@ -502,7 +502,7 @@ void basic_ai_chase(Evt* script, MobileAISettings* aiSettings, EnemyDetectVolume
|
||||
|
||||
if (!basic_ai_check_player_dist(territory, enemy, aiSettings->chaseRadius, aiSettings->chaseOffsetDist, 1)) {
|
||||
fx_emote(EMOTE_QUESTION, npc, 0, npc->collisionHeight, 1.0f, 2.0f, -20.0f, 15, &sp28);
|
||||
npc->currentAnim.w = enemy->animList[ENEMY_ANIM_IDLE];
|
||||
npc->currentAnim = enemy->animList[ENEMY_ANIM_IDLE];
|
||||
npc->duration = 20;
|
||||
script->AI_TEMP_STATE = AI_STATE_LOSE_PLAYER;
|
||||
return;
|
||||
@ -515,7 +515,7 @@ void basic_ai_chase(Evt* script, MobileAISettings* aiSettings, EnemyDetectVolume
|
||||
z = npc->pos.z;
|
||||
if (npc_test_move_simple_with_slipping(npc->collisionChannel, &x, &y, &z, 1.0f, npc->yaw, npc->collisionHeight, npc->collisionRadius)) {
|
||||
fx_emote(EMOTE_QUESTION, npc, 0, npc->collisionHeight, 1.0f, 2.0f, -20.0f, 0xC, &sp28);
|
||||
npc->currentAnim.w = enemy->animList[ENEMY_ANIM_IDLE];
|
||||
npc->currentAnim = enemy->animList[ENEMY_ANIM_IDLE];
|
||||
npc->duration = 15;
|
||||
script->AI_TEMP_STATE = AI_STATE_LOSE_PLAYER;
|
||||
return;
|
||||
@ -570,7 +570,7 @@ ApiStatus BasicAI_Main(Evt* script, s32 isInitialCall) {
|
||||
script->AI_TEMP_STATE = AI_STATE_WANDER_INIT;
|
||||
npc->duration = 0;
|
||||
|
||||
npc->currentAnim.w = enemy->animList[ENEMY_ANIM_IDLE];
|
||||
npc->currentAnim = enemy->animList[ENEMY_ANIM_IDLE];
|
||||
|
||||
npc->flags &= ~NPC_FLAG_JUMPING;
|
||||
if (!enemy->territory->wander.isFlying) {
|
||||
|
@ -105,7 +105,7 @@ ApiStatus func_8005DB00(Evt* script, s32 isInitialCall) {
|
||||
npc->duration = evt_get_variable(script, LVar1);
|
||||
script->functionTemp[1] = evt_get_variable(script, LVar2);
|
||||
script->functionTemp[2] = evt_get_variable(script, LVar3) / 2;
|
||||
npc->currentAnim.w = script->varTable[10];
|
||||
npc->currentAnim = script->varTable[10];
|
||||
script->functionTemp[0] = 1;
|
||||
break;
|
||||
case 1:
|
||||
|
@ -2665,7 +2665,7 @@ void btl_state_update_select_target(void) {
|
||||
}
|
||||
}
|
||||
|
||||
if (battleStatus->currentTargetListFlags < 0) {
|
||||
if (battleStatus->currentTargetListFlags & 0x80000000) {
|
||||
if (!(gBattleStatus.flags1 & BS_FLAGS1_80000)) {
|
||||
gBattleState2 = battleStatus->unk_6E;
|
||||
if (gBattleStatus.flags2 & BS_FLAGS2_40) {
|
||||
|
249
src/77480.c
249
src/77480.c
@ -40,6 +40,7 @@ s32 get_player_back_anim(s32 arg0);
|
||||
void appendGfx_player(void* data);
|
||||
void appendGfx_player_spin(void* data);
|
||||
void update_player_shadow(void);
|
||||
s32 partner_use_ability(void);
|
||||
|
||||
s32 player_raycast_below(f32 yaw, f32 diameter, f32* outX, f32* outY, f32* outZ, f32* outLength, f32* hitRx, f32* hitRz,
|
||||
f32* hitDirX, f32* hitDirZ) {
|
||||
@ -366,7 +367,7 @@ s32 player_test_lateral_overlap(s32 mode, PlayerStatus* playerStatus, f32* x, f3
|
||||
radius = playerStatus->colliderDiameter * 0.5f;
|
||||
ret = -1;
|
||||
|
||||
if ((playerStatus->flags & (PLAYER_STATUS_FLAGS_FALLING | PLAYER_STATUS_FLAGS_JUMPING)) == 0) {
|
||||
if (!(playerStatus->flags & (PLAYER_STATUS_FLAGS_FALLING | PLAYER_STATUS_FLAGS_JUMPING))) {
|
||||
height = playerStatus->colliderHeight * 0.286f;
|
||||
} else {
|
||||
height = 1.0f;
|
||||
@ -544,7 +545,7 @@ s32 player_test_move_with_slipping(PlayerStatus* playerStatus, f32* x, f32* y, f
|
||||
s32 ret = -1;
|
||||
|
||||
height = 0.0f;
|
||||
if ((playerStatus->flags & (PLAYER_STATUS_FLAGS_JUMPING | PLAYER_STATUS_FLAGS_FALLING)) == 0) {
|
||||
if (!(playerStatus->flags & (PLAYER_STATUS_FLAGS_JUMPING | PLAYER_STATUS_FLAGS_FALLING))) {
|
||||
height = 10.01f;
|
||||
}
|
||||
radius = playerStatus->colliderDiameter * 0.5f;
|
||||
@ -698,14 +699,14 @@ void phys_update_standard(void) {
|
||||
check_input_use_partner();
|
||||
phys_update_action_state();
|
||||
|
||||
if (!(playerStatus->flags & 8)) {
|
||||
if (playerStatus->flags & 2) {
|
||||
if (!(playerStatus->flags & PLAYER_STATUS_FLAGS_FLYING)) {
|
||||
if (playerStatus->flags & PLAYER_STATUS_FLAGS_JUMPING) {
|
||||
phys_update_jump();
|
||||
}
|
||||
}
|
||||
|
||||
if (playerStatus->flags & 4) {
|
||||
if (!(playerStatus->flags & 8)) {
|
||||
if (playerStatus->flags & PLAYER_STATUS_FLAGS_FALLING) {
|
||||
if (!(playerStatus->flags & PLAYER_STATUS_FLAGS_FLYING)) {
|
||||
phys_update_falling();
|
||||
}
|
||||
}
|
||||
@ -716,11 +717,8 @@ void phys_update_standard(void) {
|
||||
collision_main_lateral();
|
||||
collision_check_player_overlaps();
|
||||
|
||||
if (
|
||||
collision_main_above() < 0 &&
|
||||
playerStatus->timeInAir == 0 &&
|
||||
playerStatus->animFlags & PLAYER_STATUS_ANIM_FLAGS_USING_PEACH_PHYSICS
|
||||
) {
|
||||
if (collision_main_above() < 0 && playerStatus->timeInAir == 0 &&
|
||||
playerStatus->animFlags & PLAYER_STATUS_ANIM_FLAGS_USING_PEACH_PHYSICS) {
|
||||
func_800E4F10();
|
||||
}
|
||||
|
||||
@ -730,8 +728,8 @@ void phys_update_standard(void) {
|
||||
}
|
||||
}
|
||||
|
||||
if (playerStatus->animFlags & 2) {
|
||||
func_802BE070_31DBE0();
|
||||
if (playerStatus->animFlags & PLAYER_STATUS_ANIM_FLAGS_2) {
|
||||
world_watt_sync_held_position();
|
||||
}
|
||||
|
||||
if (!(playerStatus->flags & PLAYER_STATUS_FLAGS_CAMERA_DOESNT_FOLLOW)) {
|
||||
@ -823,7 +821,8 @@ s32 get_overriding_player_anim(s32 anim) {
|
||||
return -1;
|
||||
}
|
||||
} else if (playerStatus->animFlags & PLAYER_STATUS_ANIM_FLAGS_USING_PEACH_PHYSICS) {
|
||||
if (playerStatus->unk_C4 && (anim == ANIM_Peach_C0000 || anim == ANIM_Peach_C0001 || anim == ANIM_Peach_C0002)) {
|
||||
if ((playerStatus->peachItemHeld != 0)
|
||||
&& (anim == ANIM_Peach_C0000 || anim == ANIM_Peach_C0001 || anim == ANIM_Peach_C0002)) {
|
||||
anim = ANIM_Peach_D0000;
|
||||
}
|
||||
}
|
||||
@ -835,9 +834,9 @@ s32 get_overriding_player_anim(s32 anim) {
|
||||
return anim;
|
||||
}
|
||||
|
||||
void suggest_player_anim_clearUnkFlag(s32 anim) {
|
||||
void suggest_player_anim_clearUnkFlag(AnimID anim) {
|
||||
PlayerStatus* playerStatus = &gPlayerStatus;
|
||||
s32 newAnim = get_overriding_player_anim(anim);
|
||||
AnimID newAnim = get_overriding_player_anim(anim);
|
||||
|
||||
if (newAnim != -1) {
|
||||
playerStatus->anim = newAnim;
|
||||
@ -846,7 +845,7 @@ void suggest_player_anim_clearUnkFlag(s32 anim) {
|
||||
}
|
||||
}
|
||||
|
||||
void force_player_anim(s32 anim) {
|
||||
void force_player_anim(AnimID anim) {
|
||||
PlayerStatus* playerStatus = &gPlayerStatus;
|
||||
|
||||
playerStatus->anim = anim;
|
||||
@ -854,9 +853,9 @@ void force_player_anim(s32 anim) {
|
||||
playerStatus->flags &= ~PLAYER_STATUS_FLAGS_10000000;
|
||||
}
|
||||
|
||||
void suggest_player_anim_setUnkFlag(s32 anim) {
|
||||
void suggest_player_anim_setUnkFlag(AnimID anim) {
|
||||
PlayerStatus* playerStatus = &gPlayerStatus;
|
||||
s32 newAnim = get_overriding_player_anim(anim);
|
||||
AnimID newAnim = get_overriding_player_anim(anim);
|
||||
|
||||
if (newAnim != -1) {
|
||||
playerStatus->anim = newAnim;
|
||||
@ -867,34 +866,34 @@ void suggest_player_anim_setUnkFlag(s32 anim) {
|
||||
|
||||
void update_player_blink(void) {
|
||||
PlayerStatus* playerStatus = &gPlayerStatus;
|
||||
s32 phi_a2 = 0;
|
||||
s32 outtaSight = FALSE;
|
||||
u8 phi_v1;
|
||||
u8* alpha;
|
||||
|
||||
if (gPartnerActionStatus.actingPartner == PARTNER_BOW) {
|
||||
phi_a2 = gPartnerActionStatus.partnerActionState != PARTNER_ACTION_NONE;
|
||||
outtaSight = gPartnerActionStatus.partnerActionState != PARTNER_ACTION_NONE;
|
||||
}
|
||||
|
||||
if (playerStatus->blinkTimer > 0) {
|
||||
playerStatus->blinkTimer--;
|
||||
alpha = &playerStatus->alpha1;
|
||||
if (!(gGameStatusPtr->frameCounter & 1)) {
|
||||
if (phi_a2) {
|
||||
phi_v1 = 0xC0;
|
||||
if (outtaSight) {
|
||||
phi_v1 = 192;
|
||||
} else {
|
||||
phi_v1 = 0xFF;
|
||||
phi_v1 = 255;
|
||||
}
|
||||
} else {
|
||||
phi_v1 = 0x60;
|
||||
phi_v1 = 96;
|
||||
}
|
||||
*alpha = phi_v1;
|
||||
|
||||
if (!playerStatus->blinkTimer) {
|
||||
if (phi_a2) {
|
||||
playerStatus->alpha1 = 0x80;
|
||||
if (outtaSight) {
|
||||
playerStatus->alpha1 = 128;
|
||||
playerStatus->flags |= PLAYER_STATUS_FLAGS_8000;
|
||||
} else {
|
||||
playerStatus->alpha1 = 0xFF;
|
||||
playerStatus->alpha1 = 255;
|
||||
playerStatus->flags &= ~PLAYER_STATUS_FLAGS_8000;
|
||||
}
|
||||
} else {
|
||||
@ -965,9 +964,7 @@ void func_800E01DC(void) {
|
||||
s32 func_800E0208(void) {
|
||||
s32 ret = FALSE;
|
||||
|
||||
if (gGameStatusPtr->disableScripts &&
|
||||
(gGameStatusPtr->currentButtons[0] & PLAYER_STATUS_FLAGS_10))
|
||||
{
|
||||
if (gGameStatusPtr->disableScripts && (gGameStatusPtr->currentButtons[0] & BUTTON_R)) {
|
||||
if (gPartnerActionStatus.partnerActionState == PARTNER_ACTION_NONE) {
|
||||
set_action_state(ACTION_STATE_IDLE);
|
||||
}
|
||||
@ -1284,7 +1281,7 @@ void update_partner_timers(void) {
|
||||
|
||||
for (i = 1; i < ARRAY_COUNT(playerData->partnerUnlockedTime); i++) {
|
||||
if (playerData->partners[i].enabled) {
|
||||
playerData->partnerUnlockedTime[i] += 1;
|
||||
playerData->partnerUnlockedTime[i]++;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1293,73 +1290,74 @@ void update_partner_timers(void) {
|
||||
void func_800E0B90(void) {
|
||||
PlayerStatus* playerStatus = &gPlayerStatus;
|
||||
f32 cameraYaw = gCameras[gCurrentCameraID].currentYaw;
|
||||
f32 temp_f20 = get_clamped_angle_diff(cameraYaw, playerStatus->currentYaw);
|
||||
f32 camRelativeYaw = get_clamped_angle_diff(cameraYaw, playerStatus->currentYaw);
|
||||
s32 trueAnim;
|
||||
s32 animByte;
|
||||
f32 unk_90;
|
||||
s32 phi_v1;
|
||||
f32 phi_f0;
|
||||
s32 sprIndex;
|
||||
f32 angle;
|
||||
s32 direction;
|
||||
f32 timescale;
|
||||
|
||||
D_800F7B48 = 0.0f;
|
||||
if (temp_f20 < -5.0f && temp_f20 > -175.0f) {
|
||||
temp_f20 = 0.0f;
|
||||
phi_v1 = 0;
|
||||
} else if (temp_f20 > 5.0f && temp_f20 < 175.0f) {
|
||||
temp_f20 = 180.0f;
|
||||
phi_v1 = 1;
|
||||
if (camRelativeYaw < -5.0f && camRelativeYaw > -175.0f) {
|
||||
camRelativeYaw = 0.0f;
|
||||
direction = 0;
|
||||
} else if (camRelativeYaw > 5.0f && camRelativeYaw < 175.0f) {
|
||||
camRelativeYaw = 180.0f;
|
||||
direction = 1;
|
||||
} else {
|
||||
temp_f20 = D_800F7B40;
|
||||
phi_v1 = 2;
|
||||
// direction is close to flipping, use saved value
|
||||
camRelativeYaw = PrevPlayerCamRelativeYaw;
|
||||
direction = 2;
|
||||
}
|
||||
if (D_8010C95C != phi_v1 && phi_v1 != 2) {
|
||||
D_8010C95C = phi_v1;
|
||||
playerStatus->unk_90[gCurrentCameraID] = (phi_v1 != 0) ? 180.0f : -180.0f;
|
||||
// detect direction change
|
||||
if (PrevPlayerDirection != direction && direction != 2) {
|
||||
PrevPlayerDirection = direction;
|
||||
playerStatus->flipYaw[gCurrentCameraID] = (direction != 0) ? 180.0f : -180.0f;
|
||||
|
||||
if (fabsf(get_clamped_angle_diff(cameraYaw, playerStatus->currentYaw)) >= 90.0f) {
|
||||
playerStatus->unk_90[gCurrentCameraID] = -playerStatus->unk_90[gCurrentCameraID];
|
||||
playerStatus->flipYaw[gCurrentCameraID] = -playerStatus->flipYaw[gCurrentCameraID];
|
||||
}
|
||||
}
|
||||
|
||||
unk_90 = playerStatus->unk_90[gCurrentCameraID];
|
||||
if (unk_90 != 0.0f) {
|
||||
if (unk_90 < 0.0f) {
|
||||
unk_90 += 28.0f;
|
||||
if (unk_90 > 0.0f) {
|
||||
unk_90 = 0.0f;
|
||||
// handle sprite 'flipping' when changing direction
|
||||
angle = playerStatus->flipYaw[gCurrentCameraID];
|
||||
if (angle != 0.0f) {
|
||||
if (angle < 0.0f) {
|
||||
angle += 28.0f;
|
||||
if (angle > 0.0f) {
|
||||
angle = 0.0f;
|
||||
}
|
||||
}
|
||||
|
||||
if (unk_90 > 0.0f) {
|
||||
unk_90 -= 28.0f;
|
||||
if (unk_90 < 0.0f) {
|
||||
unk_90 = 0.0f;
|
||||
if (angle > 0.0f) {
|
||||
angle -= 28.0f;
|
||||
if (angle < 0.0f) {
|
||||
angle = 0.0f;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (playerStatus->flags & 0x200000) {
|
||||
unk_90 = 0.0f;
|
||||
if (playerStatus->flags & PLAYER_STATUS_FLAGS_200000) {
|
||||
angle = 0.0f;
|
||||
}
|
||||
|
||||
playerStatus->unk_90[gCurrentCameraID] = unk_90;
|
||||
playerStatus->flipYaw[gCurrentCameraID] = angle;
|
||||
|
||||
D_800F7B40 = unk_90 = clamp_angle(temp_f20);
|
||||
unk_90 = clamp_angle(playerStatus->unk_90[gCurrentCameraID] + unk_90);
|
||||
PrevPlayerCamRelativeYaw = angle = clamp_angle(camRelativeYaw);
|
||||
angle = clamp_angle(playerStatus->flipYaw[gCurrentCameraID] + angle);
|
||||
if (playerStatus->currentSpeed == 0.0f) {
|
||||
D_800F7B48 = 0.0f;
|
||||
}
|
||||
|
||||
trueAnim = playerStatus->anim;
|
||||
if (playerStatus->flags & 0x20000) {
|
||||
if (playerStatus->flags & PLAYER_STATUS_FLAGS_20000) {
|
||||
playerStatus->trueAnimation = trueAnim;
|
||||
} else {
|
||||
animByte = (trueAnim >> 0x10) & 0xFF;
|
||||
sprIndex = (trueAnim >> 0x10) & 0xFF;
|
||||
|
||||
if (playerStatus->actionState != 0xF && !(playerStatus->flags & 0x100000)) {
|
||||
playerStatus->spriteFacingAngle = unk_90 + D_800F7B48;
|
||||
if (playerStatus->actionState != ACTION_STATE_TORNADO_JUMP && !(playerStatus->flags & PLAYER_STATUS_FLAGS_100000)) {
|
||||
playerStatus->spriteFacingAngle = angle + D_800F7B48;
|
||||
trueAnim = playerStatus->anim;
|
||||
if (!(playerStatus->flags & 0x10000000) &&
|
||||
(animByte == 1 || animByte == 6 || animByte == 10) &&
|
||||
if (!(playerStatus->flags & PLAYER_STATUS_FLAGS_10000000) &&
|
||||
(sprIndex == SPR_Mario_1 || sprIndex == SPR_Mario_6 || sprIndex == SPR_Peach_A) &&
|
||||
fabsf(get_clamped_angle_diff(cameraYaw, playerStatus->currentYaw)) < 60.0f)
|
||||
{
|
||||
trueAnim = get_player_back_anim(trueAnim);
|
||||
@ -1368,10 +1366,9 @@ void func_800E0B90(void) {
|
||||
playerStatus->currentYaw = playerStatus->targetYaw;
|
||||
} else {
|
||||
trueAnim = playerStatus->anim;
|
||||
if (!(playerStatus->flags & 0x10000000) &&
|
||||
(animByte == 1 || animByte == 6 || animByte == 10) &&
|
||||
playerStatus->spriteFacingAngle < 350.0f &&
|
||||
playerStatus->spriteFacingAngle > 190.0f)
|
||||
if (!(playerStatus->flags & PLAYER_STATUS_FLAGS_10000000) &&
|
||||
(sprIndex == SPR_Mario_1 || sprIndex == SPR_Mario_6 || sprIndex == SPR_Peach_A) &&
|
||||
playerStatus->spriteFacingAngle < 350.0f && playerStatus->spriteFacingAngle > 190.0f)
|
||||
{
|
||||
trueAnim = get_player_back_anim(trueAnim);
|
||||
}
|
||||
@ -1379,61 +1376,61 @@ void func_800E0B90(void) {
|
||||
}
|
||||
}
|
||||
|
||||
phi_f0 = 1.0f;
|
||||
if (playerStatus->flags & 0x40000) {
|
||||
phi_f0 = 0.5f;
|
||||
timescale = 1.0f;
|
||||
if (playerStatus->flags & PLAYER_STATUS_FLAGS_40000) {
|
||||
timescale = 0.5f;
|
||||
}
|
||||
if (playerStatus->flags & 0x20000000) {
|
||||
phi_f0 = 0.0f;
|
||||
if (playerStatus->flags & PLAYER_STATUS_FLAGS_20000000) {
|
||||
timescale = 0.0f;
|
||||
}
|
||||
playerStatus->unk_BC = spr_update_player_sprite(0, playerStatus->trueAnimation, phi_f0);
|
||||
playerStatus->flags |= 0x40000000;
|
||||
playerStatus->unk_BC = spr_update_player_sprite(0, playerStatus->trueAnimation, timescale);
|
||||
playerStatus->flags |= PLAYER_STATUS_FLAGS_40000000;
|
||||
}
|
||||
|
||||
s32 get_player_back_anim(s32 arg0) {
|
||||
s32 animByte = (arg0 >> 16) & 0xff;
|
||||
s32 ret = 0;
|
||||
s32 get_player_back_anim(s32 anim) {
|
||||
s32 sprIndex = (anim >> 16) & 0xff;
|
||||
s32 outAnim = 0;
|
||||
|
||||
if (animByte != 1) {
|
||||
if (animByte != 6 && animByte != 10) {
|
||||
return arg0;
|
||||
if (sprIndex != SPR_Mario_1) {
|
||||
if (sprIndex != SPR_Mario_6 && sprIndex != SPR_Peach_A) {
|
||||
return anim;
|
||||
}
|
||||
|
||||
if (animByte == 1) {
|
||||
if (arg0 > 0x1000C) {
|
||||
return arg0;
|
||||
if (sprIndex == SPR_Mario_1) {
|
||||
if (anim > ANIM_Mario_1000C) {
|
||||
return anim;
|
||||
}
|
||||
} else if (animByte == 6) {
|
||||
if (arg0 == 0x6000C) {
|
||||
ret = 0x6000D;
|
||||
} else if (arg0 == 0x6000E) {
|
||||
ret = 0x6000F;
|
||||
} else if (arg0 == 0x60010) {
|
||||
ret = 0x60011;
|
||||
} else if (arg0 == 0x60012) {
|
||||
ret = 0x60013;
|
||||
} else if (arg0 == 0x60014) {
|
||||
ret = 0x60015;
|
||||
} else if (arg0 == 0x60016) {
|
||||
ret = 0x60017;
|
||||
} else if (arg0 == 0x60018) {
|
||||
ret = 0x60019;
|
||||
} else if (arg0 == 0x6001A) {
|
||||
ret = 0x6001B;
|
||||
} else if (sprIndex == SPR_Mario_6) {
|
||||
if (anim == ANIM_Mario_6000C) {
|
||||
outAnim = ANIM_Mario_6000D;
|
||||
} else if (anim == ANIM_Mario_6000E) {
|
||||
outAnim = ANIM_Mario_6000F;
|
||||
} else if (anim == ANIM_Mario_60010) {
|
||||
outAnim = ANIM_Mario_60011;
|
||||
} else if (anim == ANIM_Mario_60012) {
|
||||
outAnim = ANIM_Mario_60013;
|
||||
} else if (anim == ANIM_Mario_60014) {
|
||||
outAnim = ANIM_Mario_60015;
|
||||
} else if (anim == ANIM_Mario_60016) {
|
||||
outAnim = ANIM_Mario_60017;
|
||||
} else if (anim == ANIM_Mario_60018) {
|
||||
outAnim = ANIM_Mario_60019;
|
||||
} else if (anim == ANIM_Mario_6001A) {
|
||||
outAnim = ANIM_Mario_6001B;
|
||||
}
|
||||
} else if (animByte == 10) {
|
||||
if (arg0 > 0xA0006) {
|
||||
ret = arg0 + 1;
|
||||
} else if (sprIndex == SPR_Peach_A) {
|
||||
if (anim > ANIM_Peach_A0006) {
|
||||
outAnim = anim + 1;
|
||||
}
|
||||
}
|
||||
} else if (arg0 > 0x1000C) {
|
||||
return arg0;
|
||||
} else if (anim > ANIM_Mario_1000C) {
|
||||
return anim;
|
||||
}
|
||||
|
||||
if (ret != 0) {
|
||||
return ret;
|
||||
if (outAnim != 0) {
|
||||
return outAnim;
|
||||
} else {
|
||||
return arg0 | 0x1000000;
|
||||
return anim | SPRITE_ID_BACK_FACING;
|
||||
}
|
||||
|
||||
}
|
||||
@ -1505,10 +1502,10 @@ void appendGfx_player(void* data) {
|
||||
PlayerStatus* playerStatus = &gPlayerStatus;
|
||||
Matrix4f sp20, sp60, spA0, spE0;
|
||||
f32 temp_f0 = -gCameras[gCurrentCamID].currentYaw;
|
||||
s32 phi_a0;
|
||||
s32 flags;
|
||||
|
||||
if (playerStatus->actionState == ACTION_STATE_SLIDING) {
|
||||
guScaleF(spE0, SPRITE_PIXEL_SCALE, SPRITE_PIXEL_SCALE, SPRITE_PIXEL_SCALE);
|
||||
guScaleF(spE0, SPRITE_WORLD_SCALE_D, SPRITE_WORLD_SCALE_D, SPRITE_WORLD_SCALE_D);
|
||||
guRotateF(sp20, temp_f0, 0.0f, 1.0f, 0.0f);
|
||||
guMtxCatF(spE0, sp20, sp20);
|
||||
guRotateF(spA0, playerStatus->spriteFacingAngle, 0.0f, 1.0f, 0.0f);
|
||||
@ -1528,7 +1525,7 @@ void appendGfx_player(void* data) {
|
||||
guMtxCatF(sp20, spA0, sp20);
|
||||
guTranslateF(sp60, 0.0f, playerStatus->colliderHeight * 0.5f, 0.0f);
|
||||
guMtxCatF(sp20, sp60, sp20);
|
||||
guScaleF(spE0, SPRITE_PIXEL_SCALE, SPRITE_PIXEL_SCALE, SPRITE_PIXEL_SCALE);
|
||||
guScaleF(spE0, SPRITE_WORLD_SCALE_F, SPRITE_WORLD_SCALE_D, SPRITE_WORLD_SCALE_D);
|
||||
guMtxCatF(sp20, spE0, sp20);
|
||||
guTranslateF(sp60, playerStatus->position.x, playerStatus->position.y, playerStatus->position.z);
|
||||
guMtxCatF(sp20, sp60, sp20);
|
||||
@ -1546,14 +1543,14 @@ void appendGfx_player(void* data) {
|
||||
func_802DDEE4(0, -1, 0, 0, 0, 0, 0, 0);
|
||||
}
|
||||
}
|
||||
|
||||
phi_a0 = 0;
|
||||
|
||||
|
||||
if (playerStatus->spriteFacingAngle >= 90.0f && playerStatus->spriteFacingAngle < 270.0f) {
|
||||
phi_a0 = PLAYER_STATUS_ANIM_FLAGS_10000000;
|
||||
flags = 0x10000000;
|
||||
} else {
|
||||
flags = 0;
|
||||
}
|
||||
|
||||
spr_draw_player_sprite(phi_a0, 0, 0, 0, sp20);
|
||||
spr_draw_player_sprite(flags, 0, 0, 0, sp20);
|
||||
}
|
||||
|
||||
D_800F7B4C++;
|
||||
@ -1634,7 +1631,7 @@ void appendGfx_player_spin(void* data) {
|
||||
guMtxCatF(mtx, rotation, mtx);
|
||||
guTranslateF(translation, 0.0f, playerStatus->colliderHeight * 0.5f, 0.0f);
|
||||
guMtxCatF(mtx, translation, mtx);
|
||||
guScaleF(scale, SPRITE_PIXEL_SCALE, SPRITE_PIXEL_SCALE, SPRITE_PIXEL_SCALE);
|
||||
guScaleF(scale, SPRITE_WORLD_SCALE_D, SPRITE_WORLD_SCALE_D, SPRITE_WORLD_SCALE_D);
|
||||
guMtxCatF(mtx, scale, mtx);
|
||||
guTranslateF(translation, px, py, pz);
|
||||
guMtxCatF(mtx, translation, mtx);
|
||||
|
12
src/7B440.c
12
src/7B440.c
@ -48,9 +48,9 @@ void reset_player_status(void) {
|
||||
D_8010C940 = 0;
|
||||
D_8010C958 = 0;
|
||||
D_8010C92C = 0;
|
||||
D_8010C95C = 0;
|
||||
PrevPlayerDirection = 0;
|
||||
D_8010C980 = 0;
|
||||
D_800F7B40 = 0;
|
||||
PrevPlayerCamRelativeYaw = 0;
|
||||
D_800F7B44 = 0;
|
||||
D_8010C938 = 0;
|
||||
D_8010C990 = 0.0f;
|
||||
@ -97,10 +97,10 @@ void reset_player_status(void) {
|
||||
playerStatus->position.y = 0.0f;
|
||||
playerStatus->position.z = 0.0f;
|
||||
playerStatus->currentYaw = 0.0f;
|
||||
playerStatus->unk_90[CAM_DEFAULT] = 0.0f;
|
||||
playerStatus->unk_90[CAM_BATTLE] = 0.0f;
|
||||
playerStatus->unk_90[CAM_TATTLE] = 0.0f;
|
||||
playerStatus->unk_90[CAM_3] = 0.0f;
|
||||
playerStatus->flipYaw[CAM_DEFAULT] = 0.0f;
|
||||
playerStatus->flipYaw[CAM_BATTLE] = 0.0f;
|
||||
playerStatus->flipYaw[CAM_TATTLE] = 0.0f;
|
||||
playerStatus->flipYaw[CAM_3] = 0.0f;
|
||||
|
||||
mapSettings = gAreas[gGameStatusPtr->areaID].maps[gGameStatusPtr->mapID].settings;
|
||||
|
||||
|
28
src/7E9D0.c
28
src/7E9D0.c
@ -145,9 +145,11 @@ s32 phys_adjust_cam_on_landing(void) {
|
||||
}
|
||||
|
||||
if (ret == 1) {
|
||||
if ((get_collider_type_by_id(gCollisionStatus.currentFloor) & 0xFF) == 3) {
|
||||
ret = 0;
|
||||
s32 surfaceType = get_collider_flags(gCollisionStatus.currentFloor) & COLLIDER_FLAGS_SURFACE_TYPE_MASK;
|
||||
|
||||
if (surfaceType == SURFACE_TYPE_LAVA) {
|
||||
gCameras[0].moveFlags |= CAMERA_MOVE_FLAGS_1;
|
||||
ret = 0;
|
||||
} else {
|
||||
gCameras[0].moveFlags &= ~CAMERA_MOVE_FLAGS_1;
|
||||
}
|
||||
@ -347,11 +349,11 @@ void set_action_state(s32 actionState) {
|
||||
if (actionState == ACTION_STATE_HIT_FIRE || actionState == ACTION_STATE_HIT_LAVA) {
|
||||
s8 partner;
|
||||
|
||||
if (playerStatus->unk_BF == 3) {
|
||||
if (playerStatus->hazardType == HAZARD_TYPE_FIRE_BAR) {
|
||||
actionState = ACTION_STATE_HIT_FIRE;
|
||||
}
|
||||
|
||||
// Whilst Sushie, Lakilester, Parakarry's ability is active, hazards have no effect.
|
||||
// Whilst Sushie, Lakilester, or Parakarry's ability is active, hazards have no effect.
|
||||
partner = playerData->currentPartner;
|
||||
|
||||
if (partner == PARTNER_SUSHIE || partner == PARTNER_LAKILESTER || partner == PARTNER_PARAKARRY) {
|
||||
@ -391,9 +393,9 @@ void set_action_state(s32 actionState) {
|
||||
sfx_stop_sound(spinState->spinSoundID);
|
||||
}
|
||||
|
||||
if (playerStatus->unk_D8 != NULL) {
|
||||
playerStatus->unk_D8->data.unk_46->unk_24 = 10;
|
||||
playerStatus->unk_D8 = NULL;
|
||||
if (playerStatus->specialDecorationEffect != NULL) {
|
||||
playerStatus->specialDecorationEffect->data.unk_46->unk_24 = 10;
|
||||
playerStatus->specialDecorationEffect = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
@ -413,10 +415,7 @@ void start_falling(void) {
|
||||
PlayerStatus* playerStatus = &gPlayerStatus;
|
||||
|
||||
set_action_state(ACTION_STATE_FALLING);
|
||||
playerStatus->gravityIntegrator[0] = 0.1143f;
|
||||
playerStatus->gravityIntegrator[1] = -0.2871f;
|
||||
playerStatus->gravityIntegrator[2] = -0.1823f;
|
||||
playerStatus->gravityIntegrator[3] = 0.01152f;
|
||||
LOAD_INTEGRATOR_FALL(playerStatus->gravityIntegrator);
|
||||
}
|
||||
|
||||
void start_bounce_a(void) {
|
||||
@ -466,12 +465,15 @@ s32 check_input_hammer(void) {
|
||||
s32 check_input_jump(void) {
|
||||
PlayerStatus* playerStatus = &gPlayerStatus;
|
||||
CollisionStatus* collisionStatus = &gCollisionStatus;
|
||||
s32 surfaceType;
|
||||
|
||||
if (!(playerStatus->pressedButtons & BUTTON_A)) {
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if ((get_collider_type_by_id((u16)collisionStatus->currentFloor) == 5) && phys_should_player_be_sliding()) {
|
||||
// @bug? collider flags not properly masked with COLLIDER_FLAGS_SURFACE_TYPE
|
||||
surfaceType = get_collider_flags((u16)gCollisionStatus.currentFloor);
|
||||
if ((surfaceType == SURFACE_TYPE_SLIDE) && phys_should_player_be_sliding()) {
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
@ -542,7 +544,7 @@ void peach_set_disguise_anim(s32 arg0) {
|
||||
s32 listIndex = D_8010C96C;
|
||||
|
||||
if (listIndex >= 0) {
|
||||
get_npc_by_index(listIndex)->currentAnim.w = arg0;
|
||||
get_npc_by_index(listIndex)->currentAnim = arg0;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -3,8 +3,8 @@
|
||||
|
||||
extern f32 GravityParamsStartJump[];
|
||||
extern f32 D_8010C928;
|
||||
extern f32 D_8010C960;
|
||||
extern f32 D_8010C97C;
|
||||
extern f32 JumpedOnSwitchX;
|
||||
extern f32 JumpedOnSwitchZ;
|
||||
extern f32 D_8010C984;
|
||||
|
||||
void func_800E315C(s32 colliderID);
|
||||
@ -103,7 +103,7 @@ s32 collision_main_above(void) {
|
||||
} while (0);
|
||||
|
||||
playerStatus->position.y = y - ((playerStatus->colliderHeight / 5.0f) * 3.0f);
|
||||
if (playerStatus->actionState != ACTION_STATE_ULTRA_JUMP &&
|
||||
if (playerStatus->actionState != ACTION_STATE_TORNADO_JUMP &&
|
||||
playerStatus->actionState != ACTION_STATE_SPIN_JUMP)
|
||||
{
|
||||
playerStatus->gravityIntegrator[0] = 0.0f;
|
||||
@ -121,16 +121,16 @@ s32 collision_main_above(void) {
|
||||
void func_800E29C8(void) {
|
||||
PlayerStatus* playerStatus = &gPlayerStatus;
|
||||
s32 colliderID;
|
||||
f32 temp_f20;
|
||||
s32 phi_a0;
|
||||
f32 groundPosY;
|
||||
AnimID anim;
|
||||
|
||||
if (playerStatus->flags & PLAYER_STATUS_FLAGS_ACTION_STATE_CHANGED) {
|
||||
playerStatus->flags &= ~PLAYER_STATUS_FLAGS_ACTION_STATE_CHANGED;
|
||||
playerStatus->fallState = 0;
|
||||
playerStatus->actionSubstate = LANDING_ON_SWITCH_SUBSTATE_0;
|
||||
}
|
||||
|
||||
if (playerStatus->fallState == 0) {
|
||||
if (dist2D(D_8010C960, D_8010C97C, playerStatus->position.x, playerStatus->position.z) <= 22.0f) {
|
||||
if (playerStatus->actionSubstate == LANDING_ON_SWITCH_SUBSTATE_0) {
|
||||
if (dist2D(JumpedOnSwitchX, JumpedOnSwitchZ, playerStatus->position.x, playerStatus->position.z) <= 22.0f) {
|
||||
add_vec2D_polar(&playerStatus->position.x, &playerStatus->position.z, 5.0f, playerStatus->targetYaw);
|
||||
}
|
||||
integrate_gravity();
|
||||
@ -138,26 +138,26 @@ void func_800E29C8(void) {
|
||||
record_jump_apex();
|
||||
gravity_use_fall_parms();
|
||||
integrate_gravity();
|
||||
playerStatus->fallState = 1;
|
||||
playerStatus->actionSubstate = LANDING_ON_SWITCH_SUBSTATE_1;
|
||||
}
|
||||
if (playerStatus->gravityIntegrator[0] > playerStatus->maxJumpSpeed) {
|
||||
playerStatus->gravityIntegrator[0] = playerStatus->maxJumpSpeed;
|
||||
}
|
||||
playerStatus->position.y += playerStatus->gravityIntegrator[0];
|
||||
} else if (playerStatus->fallState == 2) {
|
||||
if (dist2D(D_8010C960, D_8010C97C, playerStatus->position.x, playerStatus->position.z) <= 22.0f) {
|
||||
} else if (playerStatus->actionSubstate == LANDING_ON_SWITCH_SUBSTATE_2) {
|
||||
if (dist2D(JumpedOnSwitchX, JumpedOnSwitchZ, playerStatus->position.x, playerStatus->position.z) <= 22.0f) {
|
||||
add_vec2D_polar(&playerStatus->position.x, &playerStatus->position.z, 5.0f, playerStatus->targetYaw);
|
||||
}
|
||||
temp_f20 = player_check_collision_below(func_800E34D8(), &colliderID);
|
||||
groundPosY = player_check_collision_below(func_800E34D8(), &colliderID);
|
||||
func_800E315C(colliderID);
|
||||
playerStatus->position.y = temp_f20;
|
||||
playerStatus->position.y = groundPosY;
|
||||
if (colliderID >= 0) {
|
||||
if (!(playerStatus->animFlags & 1)) {
|
||||
phi_a0 = 0x10009;
|
||||
if (!(playerStatus->animFlags & PLAYER_STATUS_ANIM_FLAGS_HOLDING_WATT)) {
|
||||
anim = ANIM_Mario_10009;
|
||||
} else {
|
||||
phi_a0 = 0x6000B;
|
||||
anim = ANIM_Mario_6000B;
|
||||
}
|
||||
suggest_player_anim_clearUnkFlag(phi_a0);
|
||||
suggest_player_anim_clearUnkFlag(anim);
|
||||
enable_player_input();
|
||||
phys_player_land();
|
||||
}
|
||||
@ -192,10 +192,7 @@ void func_800E2BB0(void) {
|
||||
|
||||
if (cond) {
|
||||
record_jump_apex();
|
||||
playerStatus->gravityIntegrator[0] = 0.1143f;
|
||||
playerStatus->gravityIntegrator[1] = -0.2871f;
|
||||
playerStatus->gravityIntegrator[2] = -0.1823f;
|
||||
playerStatus->gravityIntegrator[3] = 0.01152f;
|
||||
LOAD_INTEGRATOR_FALL(playerStatus->gravityIntegrator);
|
||||
set_action_state(ACTION_STATE_FALLING);
|
||||
}
|
||||
}
|
||||
@ -272,7 +269,7 @@ void phys_update_jump(void) {
|
||||
|
||||
void phys_init_integrator_for_current_state(void) {
|
||||
PlayerStatus* playerStatus = &gPlayerStatus;
|
||||
f32* temp_a0;
|
||||
f32* params;
|
||||
|
||||
switch (playerStatus->actionState) {
|
||||
case ACTION_STATE_LANDING_ON_SWITCH:
|
||||
@ -283,22 +280,22 @@ void phys_init_integrator_for_current_state(void) {
|
||||
break;
|
||||
case ACTION_STATE_JUMP:
|
||||
case ACTION_STATE_SPIN_JUMP:
|
||||
case ACTION_STATE_GROUND_POUND:
|
||||
case ACTION_STATE_ULTRA_JUMP:
|
||||
case ACTION_STATE_ULTRA_POUND:
|
||||
case ACTION_STATE_SPIN_POUND:
|
||||
case ACTION_STATE_TORNADO_JUMP:
|
||||
case ACTION_STATE_TORNADO_POUND:
|
||||
case ACTION_STATE_HIT_FIRE:
|
||||
case ACTION_STATE_HIT_LAVA:
|
||||
temp_a0 = GravityParamsStartJump;
|
||||
params = GravityParamsStartJump;
|
||||
if (!(playerStatus->flags & PLAYER_STATUS_FLAGS_40000)) {
|
||||
playerStatus->gravityIntegrator[0] = *temp_a0++;
|
||||
playerStatus->gravityIntegrator[1] = *temp_a0++;
|
||||
playerStatus->gravityIntegrator[2] = *temp_a0++;
|
||||
playerStatus->gravityIntegrator[3] = *temp_a0++;
|
||||
playerStatus->gravityIntegrator[0] = *params++;
|
||||
playerStatus->gravityIntegrator[1] = *params++;
|
||||
playerStatus->gravityIntegrator[2] = *params++;
|
||||
playerStatus->gravityIntegrator[3] = *params++;
|
||||
} else {
|
||||
playerStatus->gravityIntegrator[0] = *temp_a0++ * 0.5f;
|
||||
playerStatus->gravityIntegrator[1] = *temp_a0++ * 0.5f;
|
||||
playerStatus->gravityIntegrator[2] = *temp_a0++ * 0.5f;
|
||||
playerStatus->gravityIntegrator[3] = *temp_a0++ * 0.5f;
|
||||
playerStatus->gravityIntegrator[0] = *params++ * 0.5f;
|
||||
playerStatus->gravityIntegrator[1] = *params++ * 0.5f;
|
||||
playerStatus->gravityIntegrator[2] = *params++ * 0.5f;
|
||||
playerStatus->gravityIntegrator[3] = *params++ * 0.5f;
|
||||
}
|
||||
break;
|
||||
}
|
||||
@ -308,21 +305,21 @@ static const f32 padding = 0.0f;
|
||||
|
||||
// This function is wack. This weird stuff is needed to match
|
||||
void gravity_use_fall_parms(void) {
|
||||
f32* floats = GravityParamsStartFall;
|
||||
f32* params = GravityParamsStartFall;
|
||||
PlayerStatus* playerStatus;
|
||||
do {} while (0);
|
||||
playerStatus = &gPlayerStatus;
|
||||
|
||||
if (playerStatus->flags & 0x40000) {
|
||||
playerStatus->gravityIntegrator[0] = *floats++ / 12.0f;
|
||||
playerStatus->gravityIntegrator[1] = *floats++ / 12.0f;
|
||||
playerStatus->gravityIntegrator[2] = *floats++ / 12.0f;
|
||||
playerStatus->gravityIntegrator[3] = *floats++ / 12.0f;
|
||||
if (playerStatus->flags & PLAYER_STATUS_FLAGS_40000) {
|
||||
playerStatus->gravityIntegrator[0] = *params++ / 12.0f;
|
||||
playerStatus->gravityIntegrator[1] = *params++ / 12.0f;
|
||||
playerStatus->gravityIntegrator[2] = *params++ / 12.0f;
|
||||
playerStatus->gravityIntegrator[3] = *params++ / 12.0f;
|
||||
} else {
|
||||
playerStatus->gravityIntegrator[0] = *floats++;
|
||||
playerStatus->gravityIntegrator[1] = *floats++;
|
||||
playerStatus->gravityIntegrator[2] = *floats++;
|
||||
playerStatus->gravityIntegrator[3] = *floats++;
|
||||
playerStatus->gravityIntegrator[0] = *params++;
|
||||
playerStatus->gravityIntegrator[1] = *params++;
|
||||
playerStatus->gravityIntegrator[2] = *params++;
|
||||
playerStatus->gravityIntegrator[3] = *params++;
|
||||
}
|
||||
}
|
||||
|
||||
@ -331,9 +328,7 @@ void phys_update_falling(void) {
|
||||
gPlayerStatus.actionState != ACTION_STATE_BOUNCE)
|
||||
{
|
||||
s32 colliderID;
|
||||
|
||||
gPlayerStatus.position.y = player_check_collision_below(func_800E34D8(), &colliderID);
|
||||
|
||||
func_800E315C(colliderID);
|
||||
}
|
||||
}
|
||||
@ -343,19 +338,18 @@ void func_800E315C(s32 colliderID) {
|
||||
PartnerActionStatus* partnerActionStatus = &gPartnerActionStatus;
|
||||
|
||||
if (colliderID >= 0) {
|
||||
u8 colliderType = get_collider_type_by_id(colliderID);
|
||||
|
||||
switch (colliderType) {
|
||||
case 1:
|
||||
case 4:
|
||||
case 5:
|
||||
s32 surfaceType = get_collider_flags(colliderID) & COLLIDER_FLAGS_SURFACE_TYPE_MASK;
|
||||
switch (surfaceType) {
|
||||
case SURFACE_TYPE_WATER:
|
||||
case SURFACE_TYPE_DOCK_WALL:
|
||||
case SURFACE_TYPE_SLIDE:
|
||||
set_action_state(ACTION_STATE_LAND);
|
||||
break;
|
||||
case 3:
|
||||
case SURFACE_TYPE_LAVA:
|
||||
if ((*(s32*)(&partnerActionStatus->partnerActionState) & 0xFF0000FF) != 0x01000009) {
|
||||
if (playerStatus->blinkTimer == 0) {
|
||||
if (playerStatus->actionState != ACTION_STATE_HIT_LAVA) {
|
||||
playerStatus->unk_BF = 1;
|
||||
playerStatus->hazardType = HAZARD_TYPE_LAVA;
|
||||
set_action_state(ACTION_STATE_HIT_LAVA);
|
||||
}
|
||||
} else {
|
||||
@ -363,11 +357,11 @@ void func_800E315C(s32 colliderID) {
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 2:
|
||||
case SURFACE_TYPE_SPIKES:
|
||||
if ((*(s32*)(&partnerActionStatus->partnerActionState) & 0xFF0000FF) != 0x01000009) {
|
||||
if (playerStatus->blinkTimer == 0) {
|
||||
if (playerStatus->actionState != ACTION_STATE_HIT_FIRE) {
|
||||
playerStatus->unk_BF = 2;
|
||||
playerStatus->hazardType = HAZARD_TYPE_SPIKES;
|
||||
set_action_state(ACTION_STATE_HIT_LAVA);
|
||||
}
|
||||
break;
|
||||
@ -393,7 +387,7 @@ void phys_player_land(void) {
|
||||
playerStatus->flags &= ~PLAYER_STATUS_FLAGS_800000;
|
||||
playerStatus->landPos.x = playerStatus->position.x;
|
||||
playerStatus->landPos.z = playerStatus->position.z;
|
||||
playerStatus->flags &= ~(PLAYER_STATUS_FLAGS_FLYING | PLAYER_STATUS_FLAGS_FALLING | PLAYER_STATUS_FLAGS_JUMPING);
|
||||
playerStatus->flags &= ~PLAYER_STATUS_FLAGS_AIRBORNE;
|
||||
sfx_play_sound_at_player(SOUND_SOFT_LAND, 0);
|
||||
if (!(collisionStatus->currentFloor & COLLISION_WITH_ENTITY_BIT)) {
|
||||
phys_adjust_cam_on_landing();
|
||||
@ -408,22 +402,22 @@ void phys_player_land(void) {
|
||||
Entity* entity = get_entity_by_index(collisionStatus->currentFloor);
|
||||
|
||||
entity->collisionFlags |= ENTITY_COLLISION_PLAYER_TOUCH_FLOOR;
|
||||
if (playerStatus->actionState != ACTION_STATE_ULTRA_JUMP &&
|
||||
playerStatus->actionState != ACTION_STATE_ULTRA_POUND &&
|
||||
if (playerStatus->actionState != ACTION_STATE_TORNADO_JUMP &&
|
||||
playerStatus->actionState != ACTION_STATE_TORNADO_POUND &&
|
||||
playerStatus->actionState != ACTION_STATE_SPIN_JUMP &&
|
||||
playerStatus->actionState != ACTION_STATE_GROUND_POUND)
|
||||
playerStatus->actionState != ACTION_STATE_SPIN_POUND)
|
||||
{
|
||||
set_action_state(ACTION_STATE_LANDING_ON_SWITCH);
|
||||
} else {
|
||||
disable_player_input();
|
||||
playerStatus->fallState = 0xB;
|
||||
playerStatus->actionSubstate = 11;
|
||||
}
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (playerStatus->flags & 0x4000) {
|
||||
if (playerStatus->flags & PLAYER_STATUS_FLAGS_4000) {
|
||||
set_action_state(ACTION_STATE_RUN);
|
||||
return;
|
||||
}
|
||||
@ -465,12 +459,12 @@ f32 integrate_gravity(void) {
|
||||
}
|
||||
|
||||
f32 func_800E34D8(void) {
|
||||
f32 ret = integrate_gravity();
|
||||
f32 velocity = integrate_gravity();
|
||||
|
||||
if (func_800E0208()) {
|
||||
ret = 0.0f;
|
||||
velocity = 0.0f;
|
||||
}
|
||||
return ret;
|
||||
return velocity;
|
||||
}
|
||||
|
||||
f32 player_check_collision_below(f32 offset, s32* colliderID) {
|
||||
@ -549,8 +543,8 @@ void collision_main_lateral(void) {
|
||||
}
|
||||
}
|
||||
break;
|
||||
case ACTION_STATE_GROUND_POUND:
|
||||
case ACTION_STATE_ULTRA_POUND:
|
||||
case ACTION_STATE_SPIN_POUND:
|
||||
case ACTION_STATE_TORNADO_POUND:
|
||||
playerStatus->position.x += playerStatus->extraVelocity.x;
|
||||
playerStatus->position.y += playerStatus->extraVelocity.y;
|
||||
playerStatus->position.z += playerStatus->extraVelocity.z;
|
||||
@ -624,7 +618,7 @@ void collision_main_lateral(void) {
|
||||
}
|
||||
sin_cos_rad(yaw * TAU / 360.0f, &sinTheta, &cosTheta);
|
||||
|
||||
if (playerStatus->actionState == ACTION_STATE_14) {
|
||||
if (playerStatus->actionState == ACTION_STATE_PUSHING_BLOCK) {
|
||||
if (fabsf(sinTheta) > fabsf(cosTheta)) {
|
||||
xBump = speed * sinTheta;
|
||||
zBump = 0.0f;
|
||||
@ -751,7 +745,7 @@ void collision_main_lateral(void) {
|
||||
case ACTION_STATE_LANDING_ON_SWITCH:
|
||||
case ACTION_STATE_LAND:
|
||||
case ACTION_STATE_STEP_DOWN_LAND:
|
||||
case ACTION_STATE_ULTRA_JUMP:
|
||||
case ACTION_STATE_TORNADO_JUMP:
|
||||
case ACTION_STATE_SLIDING:
|
||||
case ACTION_STATE_HIT_FIRE:
|
||||
case ACTION_STATE_HIT_LAVA:
|
||||
@ -888,20 +882,20 @@ void phys_main_collision_below(void) {
|
||||
f32 temp_f24 = (2.0f * playerStatus->colliderHeight) / 7.0f;
|
||||
f32 hitRx, hitRz;
|
||||
f32 hitDirX, hitDirZ;
|
||||
s32 result;
|
||||
s32 colliderID;
|
||||
s32 cond;
|
||||
|
||||
result = player_raycast_below_cam_relative(playerStatus, &playerX, &playerY, &playerZ, &outLength, &hitRx, &hitRz,
|
||||
colliderID = player_raycast_below_cam_relative(playerStatus, &playerX, &playerY, &playerZ, &outLength, &hitRx, &hitRz,
|
||||
&hitDirX, &hitDirZ);
|
||||
playerStatus->groundNormalPitch = get_player_normal_pitch();
|
||||
|
||||
if (collHeightHalf + (temp_f24 * 0.5f) < outLength) {
|
||||
result = -1;
|
||||
colliderID = -1;
|
||||
}
|
||||
if (playerStatus->timeInAir == 0) {
|
||||
collisionStatus->currentFloor = result;
|
||||
collisionStatus->currentFloor = colliderID;
|
||||
}
|
||||
if (result >= 0) {
|
||||
if (colliderID >= 0) {
|
||||
playerStatus->groundAnglesXZ.x = hitDirX;
|
||||
playerStatus->groundAnglesXZ.y = hitDirZ;
|
||||
}
|
||||
@ -910,7 +904,7 @@ void phys_main_collision_below(void) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (playerStatus->flags & (PLAYER_STATUS_FLAGS_FLYING | PLAYER_STATUS_FLAGS_FALLING | PLAYER_STATUS_FLAGS_JUMPING)) {
|
||||
if (playerStatus->flags & PLAYER_STATUS_FLAGS_AIRBORNE) {
|
||||
return;
|
||||
}
|
||||
|
||||
@ -922,13 +916,14 @@ void phys_main_collision_below(void) {
|
||||
(phys_adjust_cam_on_landing(), !phys_should_player_be_sliding()) ||
|
||||
(set_action_state(ACTION_STATE_SLIDING), (playerStatus->actionState != ACTION_STATE_SLIDING))))
|
||||
{
|
||||
if (result >= 0) {
|
||||
switch (get_collider_type_by_id(result) & 0xFF) {
|
||||
case 2:
|
||||
if (colliderID >= 0) {
|
||||
s32 surfaceType = get_collider_flags(colliderID) & COLLIDER_FLAGS_SURFACE_TYPE_MASK;
|
||||
switch (surfaceType) {
|
||||
case SURFACE_TYPE_SPIKES:
|
||||
if (partnerActionStatus->partnerActionState == PARTNER_ACTION_NONE || partnerActionStatus->actingPartner != PARTNER_BOW) {
|
||||
if (playerStatus->blinkTimer == 0) {
|
||||
if (playerStatus->actionState != ACTION_STATE_HIT_LAVA) {
|
||||
playerStatus->unk_BF = 2;
|
||||
playerStatus->hazardType = HAZARD_TYPE_SPIKES;
|
||||
set_action_state(ACTION_STATE_HIT_LAVA);
|
||||
}
|
||||
} else {
|
||||
@ -936,11 +931,11 @@ void phys_main_collision_below(void) {
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 3:
|
||||
case SURFACE_TYPE_LAVA:
|
||||
if (partnerActionStatus->partnerActionState == PARTNER_ACTION_NONE || partnerActionStatus->actingPartner != PARTNER_BOW) {
|
||||
if (playerStatus->blinkTimer == 0) {
|
||||
if (playerStatus->actionState != ACTION_STATE_HIT_LAVA) {
|
||||
playerStatus->unk_BF = 1;
|
||||
playerStatus->hazardType = HAZARD_TYPE_LAVA;
|
||||
set_action_state(ACTION_STATE_HIT_LAVA);
|
||||
}
|
||||
} else {
|
||||
@ -1000,7 +995,7 @@ void collision_lava_reset_check_additional_overlaps(void) {
|
||||
f32 x, y, z;
|
||||
f32 temp_f0;
|
||||
|
||||
if (playerStatus->animFlags & 0x1000) {
|
||||
if (playerStatus->animFlags & PLAYER_STATUS_ANIM_FLAGS_USING_PEACH_PHYSICS) {
|
||||
func_800E4F10();
|
||||
return;
|
||||
}
|
||||
@ -1098,7 +1093,7 @@ void check_input_midair_jump(void) {
|
||||
gPlayerStatus.flags |= 8;
|
||||
break;
|
||||
case 2:
|
||||
set_action_state(ACTION_STATE_ULTRA_JUMP);
|
||||
set_action_state(ACTION_STATE_TORNADO_JUMP);
|
||||
gPlayerStatus.flags |= 8;
|
||||
break;
|
||||
}
|
||||
@ -1109,26 +1104,25 @@ s8 get_current_partner_id(void) {
|
||||
return gPlayerData.currentPartner;
|
||||
}
|
||||
|
||||
void try_player_footstep_sounds(s32 arg0) {
|
||||
if (gGameStatusPtr->frameCounter % arg0 == 0) {
|
||||
u8 colliderType = get_collider_type_by_id(gCollisionStatus.currentFloor);
|
||||
s32 soundID;
|
||||
s32 soundID2;
|
||||
void try_player_footstep_sounds(s32 interval) {
|
||||
if (gGameStatusPtr->frameCounter % interval == 0) {
|
||||
s32 surfaceType = get_collider_flags(gCollisionStatus.currentFloor) & COLLIDER_FLAGS_SURFACE_TYPE_MASK;
|
||||
s32 soundID, altSoundID;
|
||||
|
||||
if (colliderType == 6 || colliderType == 9) {
|
||||
soundID = SOUND_143;
|
||||
soundID2 = SOUND_144;
|
||||
if (surfaceType == SURFACE_TYPE_FLOWERS || surfaceType == SURFACE_TYPE_HEDGES) {
|
||||
soundID = SOUND_STEP_CRUNCHY1;
|
||||
altSoundID = SOUND_STEP_CRUNCHY2;
|
||||
} else {
|
||||
soundID = SOUND_STEP1;
|
||||
soundID2 = SOUND_STEP2;
|
||||
soundID = SOUND_STEP_NORMAL1;
|
||||
altSoundID = SOUND_STEP_NORMAL2;
|
||||
}
|
||||
|
||||
if (D_800F7B80 == 0) {
|
||||
soundID = soundID2;
|
||||
if (FootstepSoundSelector == 0) {
|
||||
soundID = altSoundID;
|
||||
}
|
||||
|
||||
sfx_play_sound_at_player(soundID, 0);
|
||||
D_800F7B80 ^= 1;
|
||||
FootstepSoundSelector ^= 1;
|
||||
}
|
||||
}
|
||||
|
||||
@ -1186,16 +1180,16 @@ s32 phys_can_player_interact(void) {
|
||||
}
|
||||
|
||||
f32 func_800E5348(void) {
|
||||
f32 temp_f0 = get_clamped_angle_diff(gCameras[gCurrentCameraID].currentYaw, gPlayerStatus.currentYaw);
|
||||
f32 deltaYaw = get_clamped_angle_diff(gCameras[gCurrentCameraID].currentYaw, gPlayerStatus.currentYaw);
|
||||
|
||||
if (temp_f0 < -5.0f && temp_f0 > -175.0f) {
|
||||
temp_f0 = 0.0f;
|
||||
} else if (temp_f0 > 5.0f && temp_f0 < 175.0f) {
|
||||
temp_f0 = 180.0f;
|
||||
if (deltaYaw < -5.0f && deltaYaw > -175.0f) {
|
||||
deltaYaw = 0.0f;
|
||||
} else if (deltaYaw > 5.0f && deltaYaw < 175.0f) {
|
||||
deltaYaw = 180.0f;
|
||||
} else {
|
||||
temp_f0 = D_800F7B40;
|
||||
deltaYaw = PrevPlayerCamRelativeYaw;
|
||||
}
|
||||
return clamp_angle(temp_f0 - 90.0f + gCameras[gCurrentCameraID].currentYaw);
|
||||
return clamp_angle(deltaYaw - 90.0f + gCameras[gCurrentCameraID].currentYaw);
|
||||
}
|
||||
|
||||
f32 player_get_camera_facing_angle(void) {
|
||||
|
@ -29,7 +29,7 @@ void func_800EFD08(void) {
|
||||
colliderType = D_80109480;
|
||||
}
|
||||
|
||||
D_80109480 = get_collider_type_by_id((u16)gCollisionStatus.currentFloor) & 0xFF;
|
||||
D_80109480 = get_collider_flags((u16)gCollisionStatus.currentFloor) & COLLIDER_FLAGS_SURFACE_TYPE_MASK;
|
||||
|
||||
if (playerStatus->actionState != ACTION_STATE_JUMP) {
|
||||
colliderType = D_80109480;
|
||||
@ -42,19 +42,19 @@ void func_800EFD08(void) {
|
||||
D_8010CFF0 = playerStatus->timeInAir;
|
||||
|
||||
switch (colliderType) {
|
||||
case 6:
|
||||
case SURFACE_TYPE_FLOWERS:
|
||||
func_800F0248();
|
||||
break;
|
||||
case 7:
|
||||
case SURFACE_TYPE_CLOUD:
|
||||
func_800F0490();
|
||||
break;
|
||||
case 8:
|
||||
case SURFACE_TYPE_SNOW:
|
||||
func_800F0864();
|
||||
break;
|
||||
case 9:
|
||||
case SURFACE_TYPE_HEDGES:
|
||||
func_800F09EC();
|
||||
break;
|
||||
case 1:
|
||||
case SURFACE_TYPE_WATER:
|
||||
func_800F0B3C();
|
||||
break;
|
||||
default:
|
||||
@ -89,7 +89,7 @@ void func_800F0248(void) {
|
||||
|
||||
if (
|
||||
playerStatus->actionState != ACTION_STATE_WALK && playerStatus->actionState != ACTION_STATE_RUN &&
|
||||
(playerStatus->actionState != ACTION_STATE_SPIN || playerStatus->fallState != 0)
|
||||
!(playerStatus->actionState == ACTION_STATE_SPIN && playerStatus->actionSubstate == 0)
|
||||
) {
|
||||
D_80109490 = 0;
|
||||
return;
|
||||
@ -128,7 +128,7 @@ void func_800F0864(void) {
|
||||
if (
|
||||
(
|
||||
playerStatus->actionState != ACTION_STATE_WALK && playerStatus->actionState != ACTION_STATE_RUN &&
|
||||
(playerStatus->actionState != ACTION_STATE_SPIN || playerStatus->fallState != 0) &&
|
||||
!(playerStatus->actionState == ACTION_STATE_SPIN && playerStatus->actionSubstate == 0) &&
|
||||
playerStatus->actionState != ACTION_STATE_LAND && playerStatus->actionState != ACTION_STATE_IDLE
|
||||
) || playerStatus->flags >= 0
|
||||
) {
|
||||
|
18
src/C50A0.c
18
src/C50A0.c
@ -1854,7 +1854,7 @@ void update_item_entity_temp(ItemEntity* itemEntity) {
|
||||
actionState != ACTION_STATE_LAUNCH &&
|
||||
actionState != ACTION_STATE_RIDE &&
|
||||
actionState != ACTION_STATE_IDLE &&
|
||||
(actionState != ACTION_STATE_USE_SPINNING_FLOWER || playerStatus->fallState != 1)
|
||||
!(actionState == ACTION_STATE_USE_SPINNING_FLOWER && playerStatus->actionSubstate == 1)
|
||||
) {
|
||||
break;
|
||||
}
|
||||
@ -1874,7 +1874,7 @@ void update_item_entity_temp(ItemEntity* itemEntity) {
|
||||
}
|
||||
}
|
||||
D_801568E0 = hud_element_create(gItemHudScripts[gItemTable[itemEntity->itemID].hudElemID].enabled);
|
||||
hud_element_set_flags(D_801568E0, 0x80);
|
||||
hud_element_set_flags(D_801568E0, HUD_ELEMENT_FLAGS_80);
|
||||
hud_element_set_render_pos(D_801568E0, -100, -100);
|
||||
itemEntity->state = 2;
|
||||
|
||||
@ -1942,9 +1942,9 @@ void update_item_entity_temp(ItemEntity* itemEntity) {
|
||||
playerData->hammerLevel = itemEntity->itemID - 4;
|
||||
}
|
||||
|
||||
if (itemEntity->itemID == ITEM_JUMP ||
|
||||
itemEntity->itemID == ITEM_SPIN_JUMP ||
|
||||
itemEntity->itemID == ITEM_TORNADO_JUMP)
|
||||
if (itemEntity->itemID == ITEM_BOOTS ||
|
||||
itemEntity->itemID == ITEM_SUPER_BOOTS ||
|
||||
itemEntity->itemID == ITEM_ULTRA_BOOTS)
|
||||
{
|
||||
playerData->bootsLevel = itemEntity->itemID - 1;
|
||||
}
|
||||
@ -1975,7 +1975,7 @@ block_47: // TODO required to match
|
||||
itemEntity->position.x = playerStatus->position.x;
|
||||
itemEntity->position.y = playerStatus->position.y + playerStatus->colliderHeight;
|
||||
itemEntity->position.z = playerStatus->position.z;
|
||||
suggest_player_anim_setUnkFlag(0x6000C);
|
||||
suggest_player_anim_setUnkFlag(ANIM_Mario_6000C);
|
||||
}
|
||||
|
||||
if (gItemTable[itemEntity->itemID].typeFlags & ITEM_TYPE_FLAG_GEAR) {
|
||||
@ -1998,7 +1998,7 @@ block_47: // TODO required to match
|
||||
(itemEntity->flags & ITEM_ENTITY_FLAGS_4000000) ||
|
||||
(itemEntity->pickupMsgFlags & 2))
|
||||
{
|
||||
suggest_player_anim_setUnkFlag(0x6000C);
|
||||
suggest_player_anim_setUnkFlag(ANIM_Mario_6000C);
|
||||
}
|
||||
}
|
||||
|
||||
@ -2170,7 +2170,7 @@ block_47: // TODO required to match
|
||||
sort_items();
|
||||
add_item(itemEntity->itemID);
|
||||
}
|
||||
suggest_player_anim_setUnkFlag(0x6000C);
|
||||
suggest_player_anim_setUnkFlag(ANIM_Mario_6000C);
|
||||
func_801363A0(itemEntity);
|
||||
set_window_update(0xC, (s32) basic_window_update);
|
||||
D_801568E4 = 50;
|
||||
@ -2192,7 +2192,7 @@ block_47: // TODO required to match
|
||||
}
|
||||
break;
|
||||
case 15:
|
||||
suggest_player_anim_setUnkFlag(0x10002);
|
||||
suggest_player_anim_setUnkFlag(ANIM_Mario_10002);
|
||||
set_time_freeze_mode(TIME_FREEZE_NORMAL);
|
||||
enable_player_input();
|
||||
partner_enable_input();
|
||||
|
@ -55,18 +55,18 @@ ApiStatus func_80240158_EC2358(Evt* script, s32 isInitialCall) {
|
||||
osSyncPrintf("cccc\n");
|
||||
}
|
||||
}
|
||||
npc->currentAnim.w = enemy->animList[ENEMY_ANIM_RUN];
|
||||
npc->currentAnim = enemy->animList[ENEMY_ANIM_RUN];
|
||||
npc->yaw = atan2(npc->pos.x, npc->pos.z, sp10, sp14);
|
||||
npc_move_heading(npc, 2.0f, npc->yaw);
|
||||
} else if (temp_f4 > 0.2) {
|
||||
npc->yaw = atan2(npc->pos.x, npc->pos.z, sp10, sp14);
|
||||
npc->pos.x = sp10;
|
||||
npc->pos.z = sp14;
|
||||
npc->currentAnim.w = enemy->animList[ENEMY_ANIM_WALK];
|
||||
npc->currentAnim = enemy->animList[ENEMY_ANIM_WALK];
|
||||
} else {
|
||||
npc->pos.x = sp10;
|
||||
npc->pos.z = sp14;
|
||||
npc->currentAnim.w = enemy->animList[ENEMY_ANIM_IDLE];
|
||||
npc->currentAnim = enemy->animList[ENEMY_ANIM_IDLE];
|
||||
}
|
||||
return ApiStatus_BLOCK;
|
||||
}
|
||||
|
@ -9,9 +9,9 @@
|
||||
ApiStatus func_802429A0_EEFAA0(Evt* script, s32 isInitialCall) {
|
||||
script->varTable[0] = 0;
|
||||
do {} while (0);
|
||||
if (gPlayerStatus.actionState == ACTION_STATE_GROUND_POUND) {
|
||||
if (gPlayerStatus.actionState == ACTION_STATE_SPIN_POUND) {
|
||||
script->varTable[0] = 1;
|
||||
} else if (gPlayerStatus.actionState == ACTION_STATE_ULTRA_POUND) {
|
||||
} else if (gPlayerStatus.actionState == ACTION_STATE_TORNADO_POUND) {
|
||||
script->varTable[0] = 1;
|
||||
}
|
||||
return ApiStatus_DONE2;
|
||||
|
@ -23,8 +23,8 @@ BSS s32 D_8010C94C;
|
||||
BSS s32 D_8010C950;
|
||||
BSS s32 TweesterTouchingPartner;
|
||||
BSS s32 D_8010C958;
|
||||
BSS s32 D_8010C95C;
|
||||
BSS s32 D_8010C960;
|
||||
BSS s32 PrevPlayerDirection;
|
||||
BSS s32 JumpedOnSwitchX;
|
||||
BSS s32 D_8010C964;
|
||||
BSS s32 D_8010C968;
|
||||
BSS s32 D_8010C96C;
|
||||
@ -32,7 +32,7 @@ BSS s32 D_8010C970;
|
||||
BSS s32 D_8010C974;
|
||||
BSS s16 D_8010C978;
|
||||
BSS s16 D_8010C97A;
|
||||
BSS s32 D_8010C97C;
|
||||
BSS s32 JumpedOnSwitchZ;
|
||||
BSS s32 D_8010C980;
|
||||
BSS s32 D_8010C984;
|
||||
BSS char D_8010C988[0x4];
|
||||
|
@ -284,7 +284,7 @@ void load_hit_data(s32 idx, HitFile* hit) {
|
||||
e21_y = triangle->e21.y;
|
||||
e21_z = triangle->e21.z;
|
||||
|
||||
// vector product
|
||||
// cross product
|
||||
normalX = e13_y * e21_z - e13_z * e21_y;
|
||||
normalY = e13_z * e21_x - e13_x * e21_z;
|
||||
normalZ = e13_x * e21_y - e13_y * e21_x;
|
||||
@ -465,7 +465,7 @@ void update_collider_transform(s16 colliderID) {
|
||||
}
|
||||
}
|
||||
|
||||
s32 get_collider_type_by_id(s32 colliderID) {
|
||||
s32 get_collider_flags(s32 colliderID) {
|
||||
if (colliderID & COLLISION_WITH_ENTITY_BIT) {
|
||||
return 0;
|
||||
} else {
|
||||
|
@ -189,7 +189,7 @@ void peach_star_beam_appendGfx(void* effect) {
|
||||
}
|
||||
|
||||
if (!(data->pos.z < partZ)) {
|
||||
shim_guPositionF(sp20, 0.0f, 0.0f, 0.0f, SPRITE_WORLD_SCALE, partX, partY, partZ);
|
||||
shim_guPositionF(sp20, 0.0f, 0.0f, 0.0f, SPRITE_WORLD_SCALE_F, partX, partY, partZ);
|
||||
shim_guMtxF2L(sp20, &gDisplayContext->matrixStack[gMatrixListPos]);
|
||||
|
||||
gSPMatrix(gMasterGfxPos++, &gDisplayContext->matrixStack[gMatrixListPos++],
|
||||
|
@ -163,7 +163,7 @@ void throw_spiny_appendGfx(void* effect) {
|
||||
ThrowSpinyFXData* data = ((EffectInstance*)effect)->data.throwSpiny;
|
||||
s32 temp_s5 = data->rgba;
|
||||
s32 temp_s6 = data->unk_00;
|
||||
f32 scale = data->unk_40 * SPRITE_PIXEL_SCALE;
|
||||
f32 scale = data->unk_40 * SPRITE_WORLD_SCALE_D;
|
||||
|
||||
gDPPipeSync(gMasterGfxPos++);
|
||||
gSPSegment(gMasterGfxPos++, 0x09, VIRTUAL_TO_PHYSICAL(((EffectInstance*)effect)->graphics->data));
|
||||
|
@ -169,7 +169,7 @@ ApiStatus DoNpcDefeat(Evt* script, s32 isInitialCall) {
|
||||
Evt* newScript;
|
||||
|
||||
kill_script(script);
|
||||
npc->currentAnim.w = owner->animList[6];
|
||||
npc->currentAnim = owner->animList[6];
|
||||
newScript = start_script(&SCRIPT_NpcDefeat, EVT_PRIORITY_A, 0);
|
||||
owner->defeatScript = newScript;
|
||||
owner->defeatScriptID = newScript->id;
|
||||
@ -812,7 +812,7 @@ ApiStatus func_80045900(Evt* script, s32 isInitialCall) {
|
||||
s32 unk;
|
||||
|
||||
if (!(enemy->aiFlags & ENEMY_AI_FLAGS_10)) {
|
||||
npc->currentAnim.w = *enemy->animList;
|
||||
npc->currentAnim = *enemy->animList;
|
||||
}
|
||||
|
||||
if (!(enemy->aiFlags & ENEMY_AI_FLAGS_8)) {
|
||||
|
@ -343,11 +343,11 @@ s32 entity_block_handle_collision(Entity* entity) {
|
||||
|
||||
breakBlock = FALSE;
|
||||
if (entity->collisionFlags & ENTITY_COLLISION_PLAYER_TOUCH_FLOOR) {
|
||||
if (playerStatus->actionState == ACTION_STATE_SPIN_JUMP || playerStatus->actionState == ACTION_STATE_ULTRA_JUMP) {
|
||||
if (playerStatus->actionState == ACTION_STATE_SPIN_JUMP || playerStatus->actionState == ACTION_STATE_TORNADO_JUMP) {
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (playerStatus->actionState == ACTION_STATE_GROUND_POUND || playerStatus->actionState == ACTION_STATE_ULTRA_POUND) {
|
||||
if (playerStatus->actionState == ACTION_STATE_SPIN_POUND || playerStatus->actionState == ACTION_STATE_TORNADO_POUND) {
|
||||
breakBlock = TRUE;
|
||||
} else {
|
||||
return TRUE;
|
||||
|
@ -330,7 +330,7 @@ void entity_GiantChest_open(Entity* entity) {
|
||||
chest->giveItemHeightInterpPhase = 180.0f;
|
||||
chest->state++;
|
||||
if (chest->itemID != 0) {
|
||||
suggest_player_anim_setUnkFlag(0x6000C);
|
||||
suggest_player_anim_setUnkFlag(ANIM_Mario_6000C);
|
||||
sin_cos_rad((90.0f - gCameras[CAM_DEFAULT].currentYaw) * TAU / 360.0f, &sinRight, &cosRight);
|
||||
sin_cos_rad((180.0f - gCameras[CAM_DEFAULT].currentYaw) * TAU / 360.0f, &sinFwd, &cosFwd);
|
||||
horizontalOffset = 0.0f;
|
||||
@ -360,13 +360,13 @@ void entity_GiantChest_give_equipment(Entity* entity) {
|
||||
s32 flagIndex;
|
||||
|
||||
switch (data->itemID) {
|
||||
case ITEM_JUMP:
|
||||
case ITEM_BOOTS:
|
||||
gPlayerData.bootsLevel = 0;
|
||||
break;
|
||||
case ITEM_SPIN_JUMP:
|
||||
case ITEM_SUPER_BOOTS:
|
||||
gPlayerData.bootsLevel = 1;
|
||||
break;
|
||||
case ITEM_TORNADO_JUMP:
|
||||
case ITEM_ULTRA_BOOTS:
|
||||
gPlayerData.bootsLevel = 2;
|
||||
break;
|
||||
case ITEM_HAMMER:
|
||||
@ -412,7 +412,7 @@ void entity_GiantChest_await_got_item(Entity* entity) {
|
||||
if (data->unk_30 != 0) {
|
||||
exec_entity_commandlist(entity);
|
||||
remove_item_entity_by_index(data->itemEntityIndex);
|
||||
suggest_player_anim_clearUnkFlag(0x10002);
|
||||
suggest_player_anim_clearUnkFlag(ANIM_Mario_10002);
|
||||
enable_player_input();
|
||||
data->itemID = -1;
|
||||
}
|
||||
|
@ -15,8 +15,8 @@ void entity_GreenStompSwitch_idle(Entity* entity) {
|
||||
SwitchData* data = entity->dataBuf.swtch;
|
||||
|
||||
if (entity->collisionFlags & ENTITY_COLLISION_PLAYER_TOUCH_FLOOR) {
|
||||
if ((playerStatus->actionState == ACTION_STATE_GROUND_POUND)
|
||||
|| (playerStatus->actionState == ACTION_STATE_ULTRA_POUND)) {
|
||||
if ((playerStatus->actionState == ACTION_STATE_SPIN_POUND)
|
||||
|| (playerStatus->actionState == ACTION_STATE_TORNADO_POUND)) {
|
||||
exec_entity_commandlist(entity);
|
||||
data->greenMotionTimer = 8;
|
||||
}
|
||||
@ -75,8 +75,8 @@ void entity_HugeBlueSwitch_idle(Entity* entity) {
|
||||
PlayerStatus* playerStatus = &gPlayerStatus;
|
||||
|
||||
if (entity->collisionFlags & ENTITY_COLLISION_PLAYER_TOUCH_FLOOR) {
|
||||
if ((playerStatus->actionState == ACTION_STATE_GROUND_POUND)
|
||||
|| (playerStatus->actionState == ACTION_STATE_ULTRA_POUND)) {
|
||||
if ((playerStatus->actionState == ACTION_STATE_SPIN_POUND)
|
||||
|| (playerStatus->actionState == ACTION_STATE_TORNADO_POUND)) {
|
||||
exec_entity_commandlist(entity);
|
||||
}
|
||||
}
|
||||
|
@ -220,8 +220,8 @@ s32 entity_WoodenCrate_idle(Entity* entity) {
|
||||
s32 shouldBreak = FALSE;
|
||||
|
||||
if (entity->collisionFlags & ENTITY_COLLISION_PLAYER_TOUCH_FLOOR) {
|
||||
if ((playerStatus->actionState == ACTION_STATE_GROUND_POUND)
|
||||
|| (playerStatus->actionState == ACTION_STATE_ULTRA_POUND)) {
|
||||
if ((playerStatus->actionState == ACTION_STATE_SPIN_POUND)
|
||||
|| (playerStatus->actionState == ACTION_STATE_TORNADO_POUND)) {
|
||||
set_action_state(ACTION_STATE_FALLING);
|
||||
shouldBreak = TRUE;
|
||||
}
|
||||
|
@ -207,8 +207,8 @@ void Entity_BoardedFloor_idle(Entity* entity) {
|
||||
PlayerStatus* playerStatus = &gPlayerStatus;
|
||||
|
||||
if (entity->collisionFlags & ENTITY_COLLISION_PLAYER_TOUCH_FLOOR) {
|
||||
if (playerStatus->actionState == ACTION_STATE_GROUND_POUND
|
||||
|| playerStatus->actionState == ACTION_STATE_ULTRA_POUND) {
|
||||
if (playerStatus->actionState == ACTION_STATE_SPIN_POUND
|
||||
|| playerStatus->actionState == ACTION_STATE_TORNADO_POUND) {
|
||||
entity_start_script(entity);
|
||||
exec_entity_commandlist(entity);
|
||||
}
|
||||
|
@ -60,7 +60,7 @@ void entity_Padlock_push_player(Entity* entity) {
|
||||
|
||||
if (entity->collisionFlags & ENTITY_COLLISION_PLAYER_TOUCH_FLOOR) {
|
||||
if (data->pushSpeed == 0.0f) {
|
||||
suggest_player_anim_clearUnkFlag(0x10005);
|
||||
suggest_player_anim_clearUnkFlag(ANIM_Mario_Running);
|
||||
}
|
||||
|
||||
data->pushSpeed += 0.5;
|
||||
|
@ -148,7 +148,7 @@ void func_802BC2B4_E2EBE4(Entity* entity) {
|
||||
gPlayerStatus.prevActionState = 0;
|
||||
gPlayerStatus.actionState = 0;
|
||||
gPlayerStatus.flags &= ~PLAYER_STATUS_FLAGS_ACTION_STATE_CHANGED;
|
||||
suggest_player_anim_setUnkFlag(0x8001F);
|
||||
suggest_player_anim_setUnkFlag(ANIM_Mario_8001F);
|
||||
}
|
||||
|
||||
void func_802BC308_E2EC38(Entity* entity) {
|
||||
|
@ -79,7 +79,7 @@ void entity_StarBoxLauncher_check_launch(Entity* entity) {
|
||||
result = get_entity_type(D_8010C978) == ENTITY_TYPE_STAR_BOX_LAUCHER;
|
||||
}
|
||||
}
|
||||
} else if ((entity->collisionFlags & ENTITY_COLLISION_PLAYER_TOUCH_FLOOR) && (actionState == ACTION_STATE_GROUND_POUND || actionState == ACTION_STATE_ULTRA_POUND)) {
|
||||
} else if ((entity->collisionFlags & ENTITY_COLLISION_PLAYER_TOUCH_FLOOR) && (actionState == ACTION_STATE_SPIN_POUND || actionState == ACTION_STATE_TORNADO_POUND)) {
|
||||
result = 1;
|
||||
} else if (entity->collisionFlags & ENTITY_COLLISION_PLAYER_HAMMER) {
|
||||
result = -1;
|
||||
|
@ -37,7 +37,7 @@ static s32 PollMusicEvents(Evt* script, s32 isInitialCall) {
|
||||
}
|
||||
cur++;
|
||||
}
|
||||
// bug? can cur ever be NULL here?
|
||||
// @bug? can cur ever be NULL here?
|
||||
// condition should probably be if (cur->musicEventID != -1)
|
||||
if (cur != NULL) {
|
||||
EvtScript* newSource = cur->scripts[scriptSelector];
|
||||
|
@ -84,7 +84,7 @@ s32 _show_message(Evt* script, s32 isInitialCall, s32 arg2) {
|
||||
npc = resolve_npc(script, temp_fp);
|
||||
get_screen_coords(gCurrentCameraID, npc->pos.x, npc->pos.y + npc->collisionHeight, npc->pos.z,
|
||||
&screenX, &screenY, &screenZ);
|
||||
script->functionTemp[3] = npc->currentAnim.w;
|
||||
script->functionTemp[3] = npc->currentAnim;
|
||||
script->varTable[15] = npc->yaw;
|
||||
}
|
||||
|
||||
|
@ -18,11 +18,11 @@ void set_npc_animation(Npc* npc, u32 animID) {
|
||||
PlayerData* playerData = &gPlayerData;
|
||||
|
||||
if (animID - PARTNER_ANIM_WALK < 9) {
|
||||
npc->currentAnim.w = gPartnerAnimations[playerData->currentPartner].anims[animID - PARTNER_ANIM_WALK];
|
||||
npc->currentAnim = gPartnerAnimations[playerData->currentPartner].anims[animID - PARTNER_ANIM_WALK];
|
||||
} else if ((animID - 0x201) < 0x10) {
|
||||
npc->currentAnim.w = get_enemy(npc->npcID)->animList[animID - 0x201];
|
||||
npc->currentAnim = get_enemy(npc->npcID)->animList[animID - 0x201];
|
||||
} else {
|
||||
npc->currentAnim.w = animID;
|
||||
npc->currentAnim = animID;
|
||||
}
|
||||
}
|
||||
|
||||
@ -207,7 +207,7 @@ ApiStatus GetNpcAnimation(Evt* script, s32 isInitialCall) {
|
||||
return ApiStatus_DONE2;
|
||||
}
|
||||
|
||||
evt_set_variable(script, outVar, npc->currentAnim.w);
|
||||
evt_set_variable(script, outVar, npc->currentAnim);
|
||||
return ApiStatus_DONE2;
|
||||
}
|
||||
|
||||
@ -840,7 +840,7 @@ s32 BringPartnerOut(Evt *script, s32 isInitialCall) {
|
||||
}
|
||||
|
||||
npc->jumpVelocity = ((playerY - targetY) + (npc->jumpScale * npc->duration * npc->duration * 0.5f)) / npc->duration;
|
||||
npc->currentAnim.w = gPartnerAnimations[wExtraPartnerID].anims[PARTNER_ANIM_INDEX_WALK];
|
||||
npc->currentAnim = gPartnerAnimations[wExtraPartnerID].anims[PARTNER_ANIM_INDEX_WALK];
|
||||
return ApiStatus_BLOCK;
|
||||
}
|
||||
|
||||
@ -848,7 +848,7 @@ s32 BringPartnerOut(Evt *script, s32 isInitialCall) {
|
||||
npc->jumpVelocity -= npc->jumpScale;
|
||||
npc->pos.y += npc->jumpVelocity;
|
||||
if (npc->jumpVelocity <= 0.0f) {
|
||||
npc->currentAnim.w = gPartnerAnimations[wExtraPartnerID].anims[PARTNER_ANIM_INDEX_JUMP];
|
||||
npc->currentAnim = gPartnerAnimations[wExtraPartnerID].anims[PARTNER_ANIM_INDEX_JUMP];
|
||||
}
|
||||
npc_move_heading(npc, npc->moveSpeed, npc->yaw);
|
||||
duration = npc->duration;
|
||||
@ -861,7 +861,7 @@ s32 BringPartnerOut(Evt *script, s32 isInitialCall) {
|
||||
|
||||
npc->duration--;
|
||||
if (npc->duration < 0) {
|
||||
npc->currentAnim.w = gPartnerAnimations[wExtraPartnerID].anims[PARTNER_ANIM_INDEX_IDLE];
|
||||
npc->currentAnim = gPartnerAnimations[wExtraPartnerID].anims[PARTNER_ANIM_INDEX_IDLE];
|
||||
npc->jumpVelocity = 0.0f;
|
||||
npc->pos.y = npc->moveToPos.y;
|
||||
npc->scale.x = 1.0f;
|
||||
@ -910,7 +910,7 @@ ApiStatus PutPartnerAway(Evt* script, s32 isInitialCall) {
|
||||
|
||||
partnerY = targetY - partnerY;
|
||||
partner->jumpVelocity = (partnerY + (partner->jumpScale * partner->duration * partner->duration * 0.5f)) / partner->duration;
|
||||
partner->currentAnim.w = gPartnerAnimations[wExtraPartnerID].anims[PARTNER_ANIM_INDEX_WALK];
|
||||
partner->currentAnim = gPartnerAnimations[wExtraPartnerID].anims[PARTNER_ANIM_INDEX_WALK];
|
||||
return ApiStatus_BLOCK;
|
||||
} else {
|
||||
return ApiStatus_DONE2;
|
||||
@ -920,7 +920,7 @@ ApiStatus PutPartnerAway(Evt* script, s32 isInitialCall) {
|
||||
partner->jumpVelocity -= partner->jumpScale;
|
||||
partner->pos.y += partner->jumpVelocity;
|
||||
if (partner->jumpVelocity <= 0.0f) {
|
||||
partner->currentAnim.w = gPartnerAnimations[wExtraPartnerID].anims[PARTNER_ANIM_INDEX_JUMP];
|
||||
partner->currentAnim = gPartnerAnimations[wExtraPartnerID].anims[PARTNER_ANIM_INDEX_JUMP];
|
||||
}
|
||||
npc_move_heading(partner, partner->moveSpeed, partner->yaw);
|
||||
|
||||
@ -935,7 +935,7 @@ ApiStatus PutPartnerAway(Evt* script, s32 isInitialCall) {
|
||||
|
||||
partner->duration--;
|
||||
if (partner->duration < 0) {
|
||||
partner->currentAnim.w = gPartnerAnimations[wExtraPartnerID].anims[PARTNER_ANIM_INDEX_FALL];
|
||||
partner->currentAnim = gPartnerAnimations[wExtraPartnerID].anims[PARTNER_ANIM_INDEX_FALL];
|
||||
partner->jumpVelocity = 0.0f;
|
||||
partner->pos.y = partner->moveToPos.y;
|
||||
free_npc_by_index(wExtraPartnerNpcID);
|
||||
|
@ -82,7 +82,7 @@ ApiStatus SetPlayerCollisionSize(Evt* script, s32 isInitialCall) {
|
||||
PlayerStatus* playerStatus = &gPlayerStatus;
|
||||
Bytecode* args = script->ptrReadPos;
|
||||
s32 height = evt_get_variable(script, *args++);
|
||||
s32 radius = evt_get_variable(script, *args);
|
||||
s32 radius = evt_get_variable(script, *args++);
|
||||
|
||||
playerNpc->collisionHeight = height;
|
||||
playerNpc->collisionRadius = radius;
|
||||
@ -94,27 +94,26 @@ ApiStatus SetPlayerCollisionSize(Evt* script, s32 isInitialCall) {
|
||||
}
|
||||
|
||||
ApiStatus SetPlayerSpeed(Evt* script, s32 isInitialCall) {
|
||||
playerNpc->moveSpeed = evt_get_float_variable(script, *script->ptrReadPos);
|
||||
Bytecode* args = script->ptrReadPos;
|
||||
|
||||
playerNpc->moveSpeed = evt_get_float_variable(script, *args++);
|
||||
return ApiStatus_DONE2;
|
||||
}
|
||||
|
||||
ApiStatus SetPlayerJumpscale(Evt* script, s32 isInitialCall) {
|
||||
playerNpc->jumpScale = evt_get_float_variable(script, *script->ptrReadPos);
|
||||
Bytecode* args = script->ptrReadPos;
|
||||
|
||||
playerNpc->jumpScale = evt_get_float_variable(script, *args++);
|
||||
return ApiStatus_DONE2;
|
||||
}
|
||||
|
||||
ApiStatus SetPlayerAnimation(Evt* script, s32 isInitialCall) {
|
||||
Bytecode* args = script->ptrReadPos;
|
||||
s32 currentAnim = evt_get_variable(script, *args++);
|
||||
s32 shakeAnim = 0x80003;
|
||||
AnimID anim = evt_get_variable(script, *args++);
|
||||
|
||||
playerNpc->currentAnim.w = currentAnim;
|
||||
gPlayerStatus.anim = playerNpc->currentAnim = anim;
|
||||
|
||||
do { } while (0); // Needed to match for some reason
|
||||
|
||||
gPlayerStatus.anim = playerNpc->currentAnim.w;
|
||||
|
||||
if (gPlayerStatus.anim == shakeAnim) {
|
||||
if (gPlayerStatus.anim == ANIM_Mario_80003) {
|
||||
exec_ShakeCam1(0, 0, 2);
|
||||
}
|
||||
|
||||
@ -122,12 +121,16 @@ ApiStatus SetPlayerAnimation(Evt* script, s32 isInitialCall) {
|
||||
}
|
||||
|
||||
ApiStatus SetPlayerActionState(Evt* script, s32 isInitialCall) {
|
||||
set_action_state(evt_get_variable(script, *script->ptrReadPos));
|
||||
Bytecode* args = script->ptrReadPos;
|
||||
|
||||
set_action_state(evt_get_variable(script, *args++));
|
||||
return ApiStatus_DONE2;
|
||||
}
|
||||
|
||||
ApiStatus SetPlayerAnimationSpeed(Evt* script, s32 isInitialCall) {
|
||||
playerNpc->animationSpeed = evt_get_float_variable(script, *script->ptrReadPos);
|
||||
Bytecode* args = script->ptrReadPos;
|
||||
|
||||
playerNpc->animationSpeed = evt_get_float_variable(script, *args++);
|
||||
return ApiStatus_DONE2;
|
||||
}
|
||||
|
||||
@ -216,7 +219,7 @@ s32 player_jump(Evt* script, s32 isInitialCall, s32 mode) {
|
||||
f32 zTemp;
|
||||
f32 jumpVelocity;
|
||||
s32 duration;
|
||||
s32 animID;
|
||||
AnimID anim;
|
||||
f32 dist;
|
||||
|
||||
if (isInitialCall) {
|
||||
@ -252,20 +255,20 @@ s32 player_jump(Evt* script, s32 isInitialCall, s32 mode) {
|
||||
}
|
||||
|
||||
playerNpc->jumpVelocity = (playerNpc->jumpScale * (playerNpc->duration - 1) / 2) + (yTemp / playerNpc->duration);
|
||||
playerStatus->flags |= 8;
|
||||
playerStatus->animFlags |= 0x10000000;
|
||||
playerStatus->flags |= PLAYER_STATUS_FLAGS_FLYING;
|
||||
playerStatus->animFlags |= PLAYER_STATUS_ANIM_FLAGS_10000000;
|
||||
|
||||
if (mode == 0) {
|
||||
if (!(playerStatus->animFlags & 0x4000)) {
|
||||
if (!(playerStatus->animFlags & 1)) {
|
||||
animID = 0x10007;
|
||||
if (!(playerStatus->animFlags & PLAYER_STATUS_ANIM_FLAGS_8BIT_MARIO)) {
|
||||
if (!(playerStatus->animFlags & PLAYER_STATUS_ANIM_FLAGS_HOLDING_WATT)) {
|
||||
anim = ANIM_Mario_AnimMidairStill;
|
||||
} else {
|
||||
animID = 0x60009;
|
||||
anim = ANIM_Mario_60009;
|
||||
}
|
||||
} else {
|
||||
animID = 0x90005;
|
||||
anim = ANIM_Mario_90005;
|
||||
}
|
||||
suggest_player_anim_clearUnkFlag(animID);
|
||||
suggest_player_anim_clearUnkFlag(anim);
|
||||
sfx_play_sound_at_player(SOUND_JUMP_2081, 0);
|
||||
}
|
||||
script->functionTemp[0] = 1;
|
||||
@ -277,16 +280,16 @@ s32 player_jump(Evt* script, s32 isInitialCall, s32 mode) {
|
||||
playerNpc->jumpVelocity -= playerNpc->jumpScale;
|
||||
|
||||
if (mode == 0 && jumpVelocity > 0.0f && playerNpc->jumpVelocity <= 0.0f) {
|
||||
if (!(playerStatus->animFlags & 0x4000)) {
|
||||
if (!(playerStatus->animFlags & 1)) {
|
||||
animID = 0x10008;
|
||||
if (!(playerStatus->animFlags & PLAYER_STATUS_ANIM_FLAGS_8BIT_MARIO)) {
|
||||
if (!(playerStatus->animFlags & PLAYER_STATUS_ANIM_FLAGS_HOLDING_WATT)) {
|
||||
anim = ANIM_Mario_AnimMidair;
|
||||
} else {
|
||||
animID = 0x6000A;
|
||||
anim = ANIM_Mario_6000A;
|
||||
}
|
||||
} else {
|
||||
animID = 0x90005;
|
||||
anim = ANIM_Mario_90005;
|
||||
}
|
||||
suggest_player_anim_clearUnkFlag(animID);
|
||||
suggest_player_anim_clearUnkFlag(anim);
|
||||
}
|
||||
|
||||
playerStatus->position.x = playerNpc->pos.x;
|
||||
@ -299,20 +302,20 @@ s32 player_jump(Evt* script, s32 isInitialCall, s32 mode) {
|
||||
|
||||
playerNpc->duration--;
|
||||
if (playerNpc->duration == 0) {
|
||||
playerStatus->flags &= -9;
|
||||
playerStatus->animFlags &= ~0x10000000;
|
||||
playerStatus->flags &= ~PLAYER_STATUS_FLAGS_FLYING;
|
||||
playerStatus->animFlags &= ~PLAYER_STATUS_ANIM_FLAGS_10000000;
|
||||
|
||||
if (mode == 0) {
|
||||
if (!(playerStatus->animFlags & 0x4000)) {
|
||||
if (!(playerStatus->animFlags & 1)) {
|
||||
animID = 0x10009;
|
||||
if (!(playerStatus->animFlags & PLAYER_STATUS_ANIM_FLAGS_8BIT_MARIO)) {
|
||||
if (!(playerStatus->animFlags & PLAYER_STATUS_ANIM_FLAGS_HOLDING_WATT)) {
|
||||
anim = ANIM_Mario_10009;
|
||||
} else {
|
||||
animID = 0x6000B;
|
||||
anim = ANIM_Mario_6000B;
|
||||
}
|
||||
} else {
|
||||
animID = 0x10003;
|
||||
anim = ANIM_Mario_AnimPanting;
|
||||
}
|
||||
suggest_player_anim_clearUnkFlag(animID);
|
||||
suggest_player_anim_clearUnkFlag(anim);
|
||||
func_8003D660(playerNpc, 2);
|
||||
}
|
||||
|
||||
@ -581,8 +584,8 @@ ApiStatus UseExitHeading(Evt* script, s32 isInitialCall) {
|
||||
s32 func_802D23F8(void) {
|
||||
if (gPlayerStatus.actionState == ACTION_STATE_IDLE || gPlayerStatus.actionState == ACTION_STATE_WALK ||
|
||||
gPlayerStatus.actionState == ACTION_STATE_RUN || gPlayerStatus.actionState == ACTION_STATE_LAND ||
|
||||
gPlayerStatus.actionState == ACTION_STATE_STEP_DOWN_LAND || gPlayerStatus.actionState == ACTION_STATE_GROUND_POUND ||
|
||||
gPlayerStatus.actionState == ACTION_STATE_ULTRA_POUND || gPlayerStatus.actionState == ACTION_STATE_SPIN) {
|
||||
gPlayerStatus.actionState == ACTION_STATE_STEP_DOWN_LAND || gPlayerStatus.actionState == ACTION_STATE_SPIN_POUND ||
|
||||
gPlayerStatus.actionState == ACTION_STATE_TORNADO_POUND || gPlayerStatus.actionState == ACTION_STATE_SPIN) {
|
||||
return TRUE;
|
||||
}
|
||||
return FALSE;
|
||||
|
85
src/npc.c
85
src/npc.c
@ -66,7 +66,7 @@ void npc_iter_no_op(void) {
|
||||
}
|
||||
}
|
||||
|
||||
s32 _create_npc(NpcBlueprint* blueprint, u32** animList, s32 skipLoadingAnims) {
|
||||
s32 _create_npc(NpcBlueprint* blueprint, AnimID** animList, s32 skipLoadingAnims) {
|
||||
Npc* npc;
|
||||
s32 i;
|
||||
s32 j;
|
||||
@ -115,7 +115,7 @@ s32 _create_npc(NpcBlueprint* blueprint, u32** animList, s32 skipLoadingAnims) {
|
||||
npc->scale.x = 1.0f;
|
||||
npc->scale.y = 1.0f;
|
||||
npc->scale.z = 1.0f;
|
||||
npc->currentAnim.w = blueprint->initialAnim;
|
||||
npc->currentAnim = blueprint->initialAnim;
|
||||
npc->animationSpeed = 1.0f;
|
||||
npc->renderYaw = 0.0f;
|
||||
npc->unk_98 = 0;
|
||||
@ -150,9 +150,9 @@ s32 _create_npc(NpcBlueprint* blueprint, u32** animList, s32 skipLoadingAnims) {
|
||||
npc->extraAnimList = animList;
|
||||
if (!(npc->flags & NPC_FLAG_1000000)) {
|
||||
if (!(npc->flags & NPC_FLAG_PARTICLE)) {
|
||||
npc->spriteInstanceID = spr_load_npc_sprite(npc->currentAnim.w, animList);
|
||||
npc->spriteInstanceID = spr_load_npc_sprite(npc->currentAnim, animList);
|
||||
} else {
|
||||
npc->spriteInstanceID = spr_load_npc_sprite(npc->currentAnim.w | 0x80000000, animList);
|
||||
npc->spriteInstanceID = spr_load_npc_sprite(npc->currentAnim | SPRITE_ID_TAIL_ALLOCATE, animList);
|
||||
}
|
||||
} else {
|
||||
npc->flags |= NPC_FLAG_2;
|
||||
@ -172,7 +172,7 @@ s32 _create_npc_basic(NpcBlueprint* blueprint) {
|
||||
return _create_npc(blueprint, NULL, FALSE);
|
||||
}
|
||||
|
||||
s32 _create_npc_standard(NpcBlueprint* blueprint, u32** animList) {
|
||||
s32 _create_npc_standard(NpcBlueprint* blueprint, AnimID** animList) {
|
||||
return _create_npc(blueprint, animList, FALSE);
|
||||
}
|
||||
|
||||
@ -552,14 +552,14 @@ void update_npcs(void) {
|
||||
|
||||
if (!(npc->flags & NPC_FLAG_NO_ANIMS_LOADED)) {
|
||||
if (!(npc->flags & NPC_FLAG_1000000)) {
|
||||
if (npc->currentAnim.w != 0) {
|
||||
if (npc->currentAnim != 0) {
|
||||
if (npc->spriteInstanceID >= 0) {
|
||||
spr_update_sprite(npc->spriteInstanceID, npc->currentAnim.w, npc->animationSpeed);
|
||||
spr_update_sprite(npc->spriteInstanceID, npc->currentAnim, npc->animationSpeed);
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
spr_update_player_sprite(1, npc->currentAnim.w, npc->animationSpeed);
|
||||
spr_update_player_sprite(1, npc->currentAnim, npc->animationSpeed);
|
||||
}
|
||||
|
||||
if (npc->flags & NPC_FLAG_HAS_SHADOW) {
|
||||
@ -617,9 +617,9 @@ void update_npcs(void) {
|
||||
if (npc->spriteInstanceID < 0) {
|
||||
npc->spriteInstanceID++;
|
||||
if (npc->spriteInstanceID == -1) {
|
||||
npc->spriteInstanceID = spr_load_npc_sprite(npc->currentAnim.w, npc->extraAnimList);
|
||||
npc->spriteInstanceID = spr_load_npc_sprite(npc->currentAnim, npc->extraAnimList);
|
||||
ASSERT(npc->spriteInstanceID >= 0);
|
||||
spr_update_sprite(npc->spriteInstanceID, npc->currentAnim.w, npc->animationSpeed);
|
||||
spr_update_sprite(npc->spriteInstanceID, npc->currentAnim, npc->animationSpeed);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -734,15 +734,15 @@ void appendGfx_npc(Npc* npc) {
|
||||
guMtxCatF(mtx2, mtx1, mtx1);
|
||||
}
|
||||
|
||||
if ((npc->scale.x * SPRITE_PIXEL_SCALE != 1.0f) || ((npc->scale.y * npc->verticalStretch) * SPRITE_PIXEL_SCALE != 1.0f)
|
||||
|| (npc->scale.z * SPRITE_PIXEL_SCALE != 1.0f)) {
|
||||
guScaleF(mtx2, npc->scale.x * SPRITE_PIXEL_SCALE, (npc->scale.y * npc->verticalStretch) * SPRITE_PIXEL_SCALE,
|
||||
npc->scale.z * SPRITE_PIXEL_SCALE);
|
||||
if ((npc->scale.x * SPRITE_WORLD_SCALE_D != 1.0f) || ((npc->scale.y * npc->verticalStretch) * SPRITE_WORLD_SCALE_D != 1.0f)
|
||||
|| (npc->scale.z * SPRITE_WORLD_SCALE_D != 1.0f)) {
|
||||
guScaleF(mtx2, npc->scale.x * SPRITE_WORLD_SCALE_D, (npc->scale.y * npc->verticalStretch) * SPRITE_WORLD_SCALE_D,
|
||||
npc->scale.z * SPRITE_WORLD_SCALE_D);
|
||||
guMtxCatF(mtx2, mtx1, mtx1);
|
||||
}
|
||||
|
||||
if (!(npc->flags & NPC_FLAG_NO_ANIMS_LOADED)) {
|
||||
if (!(npc->flags & NPC_FLAG_1000000) && (npc->currentAnim.w != 0) && (npc->spriteInstanceID >= 0)) {
|
||||
if (!(npc->flags & NPC_FLAG_1000000) && (npc->currentAnim != 0) && (npc->spriteInstanceID >= 0)) {
|
||||
npc_draw_with_palswap(npc, renderYaw, mtx1);
|
||||
npc->unk_2C = func_802DE5C8(npc->spriteInstanceID);
|
||||
}
|
||||
@ -763,20 +763,20 @@ void appendGfx_npc(Npc* npc) {
|
||||
}
|
||||
|
||||
|
||||
if ((npc->scale.x * SPRITE_PIXEL_SCALE != 1.0f) || ((npc->scale.y * npc->verticalStretch) * SPRITE_PIXEL_SCALE != 1.0f)
|
||||
|| (npc->scale.z * SPRITE_PIXEL_SCALE != 1.0f))
|
||||
if ((npc->scale.x * SPRITE_WORLD_SCALE_D != 1.0f) || ((npc->scale.y * npc->verticalStretch) * SPRITE_WORLD_SCALE_D != 1.0f)
|
||||
|| (npc->scale.z * SPRITE_WORLD_SCALE_D != 1.0f))
|
||||
{
|
||||
do {
|
||||
guScaleF(mtx2, npc->scale.x * SPRITE_PIXEL_SCALE,
|
||||
(npc->scale.y * npc->verticalStretch) * SPRITE_PIXEL_SCALE,
|
||||
npc->scale.z * SPRITE_PIXEL_SCALE);
|
||||
guScaleF(mtx2, npc->scale.x * SPRITE_WORLD_SCALE_D,
|
||||
(npc->scale.y * npc->verticalStretch) * SPRITE_WORLD_SCALE_D,
|
||||
npc->scale.z * SPRITE_WORLD_SCALE_D);
|
||||
} while (0); // required to match (macro?)
|
||||
guMtxCatF(mtx2, mtx1, mtx1);
|
||||
|
||||
}
|
||||
|
||||
if (!(npc->flags & NPC_FLAG_NO_ANIMS_LOADED)) {
|
||||
if (!(npc->flags & NPC_FLAG_1000000) && (npc->currentAnim.w != 0)) {
|
||||
if (!(npc->flags & NPC_FLAG_1000000) && (npc->currentAnim != 0)) {
|
||||
spr_draw_npc_sprite(npc->spriteInstanceID, renderYaw, 0, 0, mtx1);
|
||||
}
|
||||
} else {
|
||||
@ -794,19 +794,19 @@ void appendGfx_npc(Npc* npc) {
|
||||
guMtxCatF(mtx2, mtx1, mtx1);
|
||||
}
|
||||
|
||||
if ((npc->scale.x * SPRITE_PIXEL_SCALE != 1.0f) || ((npc->scale.y * npc->verticalStretch) * SPRITE_PIXEL_SCALE != 1.0f)
|
||||
|| (npc->scale.z * SPRITE_PIXEL_SCALE != 1.0f))
|
||||
if ((npc->scale.x * SPRITE_WORLD_SCALE_D != 1.0f) || ((npc->scale.y * npc->verticalStretch) * SPRITE_WORLD_SCALE_D != 1.0f)
|
||||
|| (npc->scale.z * SPRITE_WORLD_SCALE_D != 1.0f))
|
||||
{
|
||||
do {
|
||||
guScaleF(mtx2, npc->scale.x * SPRITE_PIXEL_SCALE,
|
||||
(npc->scale.y * npc->verticalStretch) * SPRITE_PIXEL_SCALE,
|
||||
npc->scale.z * SPRITE_PIXEL_SCALE);
|
||||
guScaleF(mtx2, npc->scale.x * SPRITE_WORLD_SCALE_D,
|
||||
(npc->scale.y * npc->verticalStretch) * SPRITE_WORLD_SCALE_D,
|
||||
npc->scale.z * SPRITE_WORLD_SCALE_D);
|
||||
} while (0); // required to match (macro?)
|
||||
|
||||
guMtxCatF(mtx2, mtx1, mtx1);
|
||||
}
|
||||
if (!(npc->flags & NPC_FLAG_NO_ANIMS_LOADED)) {
|
||||
if (!(npc->flags & NPC_FLAG_1000000) && (npc->currentAnim.w != 0)) {
|
||||
if (!(npc->flags & NPC_FLAG_1000000) && (npc->currentAnim != 0)) {
|
||||
spr_draw_npc_sprite(npc->spriteInstanceID, renderYaw, 0, 0, mtx1);
|
||||
}
|
||||
} else {
|
||||
@ -945,7 +945,7 @@ void set_npc_sprite(Npc* npc, s32 anim, u32** extraAnimList) {
|
||||
ASSERT(npc->spriteInstanceID >= 0);
|
||||
}
|
||||
|
||||
npc->currentAnim.w = anim;
|
||||
npc->currentAnim = anim;
|
||||
|
||||
if (!(npc->flags & NPC_FLAG_NO_ANIMS_LOADED)) {
|
||||
if (!(npc->flags & NPC_FLAG_1000000)) {
|
||||
@ -1023,19 +1023,19 @@ void npc_reload_all(void) {
|
||||
if (npc->flags && !(npc->flags & NPC_FLAG_NO_ANIMS_LOADED)) {
|
||||
if (!(npc->flags & NPC_FLAG_1000000)) {
|
||||
if (!(npc->flags & NPC_FLAG_PARTICLE)) {
|
||||
npc->spriteInstanceID = spr_load_npc_sprite(npc->currentAnim.w, npc->extraAnimList);
|
||||
npc->spriteInstanceID = spr_load_npc_sprite(npc->currentAnim, npc->extraAnimList);
|
||||
} else {
|
||||
npc->spriteInstanceID = spr_load_npc_sprite(npc->currentAnim.w | 0x80000000, npc->extraAnimList);
|
||||
npc->spriteInstanceID = spr_load_npc_sprite(npc->currentAnim | SPRITE_ID_TAIL_ALLOCATE, npc->extraAnimList);
|
||||
}
|
||||
}
|
||||
if (!(npc->flags & NPC_FLAG_NO_ANIMS_LOADED)) {
|
||||
if (!(npc->flags & NPC_FLAG_1000000) && (npc->palSwapType != 0)) {
|
||||
npc->spritePaletteList = spr_get_npc_palettes(npc->currentAnim.h);
|
||||
npc->spritePaletteList = spr_get_npc_palettes(npc->currentAnim >> 16);
|
||||
npc->paletteCount = 0;
|
||||
while (npc->spritePaletteList[npc->paletteCount] != -1) {
|
||||
npc->paletteCount++;
|
||||
}
|
||||
npc->unk_C0 = spr_get_npc_color_variations(npc->currentAnim.h);
|
||||
npc->unk_C0 = spr_get_npc_color_variations(npc->currentAnim >> 16);
|
||||
}
|
||||
if (!(npc->flags & NPC_FLAG_NO_ANIMS_LOADED)) {
|
||||
if (!(npc->flags & NPC_FLAG_1000000)) {
|
||||
@ -1606,29 +1606,30 @@ void func_8003D660(Npc* npc, s32 arg1) {
|
||||
|
||||
if ((npc->flags & (NPC_FLAG_400000 | NPC_FLAG_2)) == NPC_FLAG_400000) {
|
||||
if (npc->moveSpeed != 0.0f) {
|
||||
switch (get_collider_type_by_id((u16)npc->currentFloor) & 0xFF) {
|
||||
case 6:
|
||||
s32 surfaceType = get_collider_flags((u16)npc->currentFloor) & COLLIDER_FLAGS_SURFACE_TYPE_MASK;
|
||||
switch (surfaceType) {
|
||||
case SURFACE_TYPE_FLOWERS:
|
||||
func_8003DA38(npc, arg1);
|
||||
return;
|
||||
case 7:
|
||||
case SURFACE_TYPE_CLOUD:
|
||||
func_8003DC38(npc, arg1);
|
||||
return;
|
||||
case 8:
|
||||
case SURFACE_TYPE_SNOW:
|
||||
if ((temp->partnerActionState == PARTNER_ACTION_NONE) || (temp->actingPartner != PARTNER_LAKILESTER)) {
|
||||
func_8003DFA0(npc, arg1);
|
||||
return;
|
||||
}
|
||||
break;
|
||||
case 9:
|
||||
case SURFACE_TYPE_HEDGES:
|
||||
func_8003E0D4(npc, arg1);
|
||||
return;
|
||||
case 1:
|
||||
case SURFACE_TYPE_WATER:
|
||||
func_8003E1D0(npc, arg1);
|
||||
return;
|
||||
case 2:
|
||||
case 3:
|
||||
case 4:
|
||||
case 5:
|
||||
case SURFACE_TYPE_SPIKES:
|
||||
case SURFACE_TYPE_LAVA:
|
||||
case SURFACE_TYPE_DOCK_WALL:
|
||||
case SURFACE_TYPE_SLIDE:
|
||||
default:
|
||||
func_8003D788(npc, arg1);
|
||||
return;
|
||||
|
10
src/sprite.h
10
src/sprite.h
@ -5,6 +5,14 @@
|
||||
|
||||
#define SPR_PLAYER_COLOR_VARIATIONS 6
|
||||
|
||||
enum SpriteIDFields {
|
||||
SPRITE_ID_ANIM_MASK = 0x000000FF,
|
||||
SPRITE_ID_PAL_MASK = 0x0000FF00,
|
||||
SPRITE_ID_SPR_MASK = 0x00FF0000,
|
||||
SPRITE_ID_BACK_FACING = 0x01000000,
|
||||
SPRITE_ID_TAIL_ALLOCATE = 0x80000000,
|
||||
};
|
||||
|
||||
typedef struct SpriteComponent {
|
||||
/* 0x00 */ s32 initialized;
|
||||
/* 0x04 */ s32 unk_04;
|
||||
@ -111,7 +119,7 @@ void spr_render_init(void);
|
||||
|
||||
void spr_update_player_raster_cache(void);
|
||||
|
||||
s32 spr_update_player_sprite(s32 arg0, s32 arg1, f32 arg2);
|
||||
s32 spr_update_player_sprite(s32 arg0, s32 arg1, f32 timescale);
|
||||
|
||||
s32 spr_draw_player_sprite(s32 spriteInstanceID, s32 yaw, s32 arg2, PAL_PTR* paletteList, Matrix4f mtx);
|
||||
|
||||
|
@ -1,5 +1,12 @@
|
||||
#include "common.h"
|
||||
#include "effects.h"
|
||||
#include "sprite.h"
|
||||
|
||||
enum {
|
||||
SUBSTATE_HAMMER_0 = 0,
|
||||
SUBSTATE_HAMMER_1 = 1,
|
||||
SUBSTATE_HAMMER_2 = 2
|
||||
};
|
||||
|
||||
typedef struct HammerHitData {
|
||||
/* 0x00 */ Vec3f hitPos;
|
||||
@ -15,18 +22,18 @@ extern HammerHitData* HammerHit;
|
||||
void func_802B6820_E256F0(void);
|
||||
|
||||
s32 action_hammer_is_swinging_away(s32 animID) {
|
||||
if (animID & 0x1000000) {
|
||||
if (animID & SPRITE_ID_BACK_FACING) {
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
// away-facing swing anims
|
||||
// back facing swing anims
|
||||
switch (animID) {
|
||||
case 0x60011:
|
||||
case 0x60013:
|
||||
case 0x60015:
|
||||
case 0x60017:
|
||||
case 0x60019:
|
||||
case 0x6001B:
|
||||
case ANIM_Mario_60011:
|
||||
case ANIM_Mario_60013:
|
||||
case ANIM_Mario_60015:
|
||||
case ANIM_Mario_60017:
|
||||
case ANIM_Mario_60019:
|
||||
case ANIM_Mario_6001B:
|
||||
return TRUE;
|
||||
}
|
||||
return FALSE;
|
||||
@ -101,7 +108,7 @@ void action_hammer_play_hit_fx(s32 hitID) {
|
||||
}
|
||||
|
||||
sfx_play_sound_at_player(soundID, 0);
|
||||
start_rumble(0x100, 50);
|
||||
start_rumble(256, 50);
|
||||
}
|
||||
|
||||
s32 func_802B62A4_E25174(void) {
|
||||
@ -115,6 +122,7 @@ s32 func_802B62A4_E25174(void) {
|
||||
s32 ret;
|
||||
s32 i;
|
||||
|
||||
// first attempt
|
||||
yaw = func_800E5348();
|
||||
if (action_hammer_is_swinging_away(playerStatus->trueAnimation)) {
|
||||
angle = clamp_angle(yaw + 90.0f - gCameras[gCurrentCameraID].currentYaw);
|
||||
@ -143,7 +151,8 @@ s32 func_802B62A4_E25174(void) {
|
||||
}
|
||||
}
|
||||
|
||||
if (i >= 0x10) {
|
||||
// second attempt
|
||||
if (i >= 16) {
|
||||
yaw = func_800E5348();
|
||||
if (!action_hammer_is_swinging_away(playerStatus->trueAnimation)) {
|
||||
angle = clamp_angle(yaw + 90.0f - gCameras[gCurrentCameraID].currentYaw);
|
||||
@ -213,47 +222,47 @@ s32 func_802B62A4_E25174(void) {
|
||||
return ret;
|
||||
}
|
||||
|
||||
void action_hammer_update(void) {
|
||||
void action_update_hammer(void) {
|
||||
PlayerStatus* playerStatus = &gPlayerStatus;
|
||||
|
||||
HammerHit->unk_1C = 0;
|
||||
|
||||
if (playerStatus->flags & PLAYER_STATUS_FLAGS_ACTION_STATE_CHANGED) {
|
||||
s32 animID;
|
||||
AnimID anim;
|
||||
s32 soundID;
|
||||
|
||||
playerStatus->flags &= ~PLAYER_STATUS_FLAGS_ACTION_STATE_CHANGED;
|
||||
playerStatus->flags |= PLAYER_STATUS_FLAGS_200000;
|
||||
HammerHit->timer = 0;
|
||||
playerStatus->fallState = 0;
|
||||
playerStatus->actionSubstate = SUBSTATE_HAMMER_0;
|
||||
playerStatus->currentSpeed = 0.0f;
|
||||
playerStatus->unk_BC = 0;
|
||||
HammerHit->hitID = func_802B62A4_E25174();
|
||||
|
||||
if (gPlayerData.hammerLevel == 2) {
|
||||
soundID = SOUND_2117;
|
||||
animID = 0x6001A;
|
||||
anim = ANIM_Mario_6001A;
|
||||
if (HammerHit->hitID < 0) {
|
||||
soundID = SOUND_2117;
|
||||
animID = 0x60018;
|
||||
anim = ANIM_Mario_60018;
|
||||
}
|
||||
} else if (gPlayerData.hammerLevel == 1) {
|
||||
soundID = SOUND_2116;
|
||||
animID = 0x60016;
|
||||
anim = ANIM_Mario_60016;
|
||||
if (HammerHit->hitID < 0) {
|
||||
soundID = SOUND_2116;
|
||||
animID = 0x60014;
|
||||
anim = ANIM_Mario_60014;
|
||||
}
|
||||
} else {
|
||||
soundID = SOUND_2115;
|
||||
animID = 0x60012;
|
||||
anim = ANIM_Mario_60012;
|
||||
if (HammerHit->hitID < 0) {
|
||||
soundID = SOUND_2115;
|
||||
animID = 0x60010;
|
||||
anim = ANIM_Mario_60010;
|
||||
}
|
||||
}
|
||||
|
||||
suggest_player_anim_clearUnkFlag(animID);
|
||||
suggest_player_anim_clearUnkFlag(anim);
|
||||
sfx_play_sound_at_player(soundID, 0);
|
||||
HammerHit->unk_0C = 0;
|
||||
HammerHit->unk_14 = 0;
|
||||
@ -305,6 +314,7 @@ void func_802B6820_E256F0(void) {
|
||||
playerY = playerStatus->position.y;
|
||||
playerZ = playerStatus->position.z;
|
||||
|
||||
// check collision allong 16 points in a line away from the player
|
||||
for (i = 1; i < 16; i++) {
|
||||
x = playerX + (outSinTheta * i);
|
||||
y = playerY;
|
||||
@ -382,13 +392,13 @@ void func_802B6820_E256F0(void) {
|
||||
}
|
||||
}
|
||||
|
||||
if (playerStatus->fallState == 0 && result >= 0 && HammerHit->unk_14 == 0) {
|
||||
playerStatus->fallState++;
|
||||
if (playerStatus->actionSubstate == SUBSTATE_HAMMER_0 && result >= 0 && HammerHit->unk_14 == 0) {
|
||||
playerStatus->actionSubstate++;
|
||||
}
|
||||
if (playerStatus->fallState == 1 && result < 0) {
|
||||
playerStatus->fallState = 2;
|
||||
if (playerStatus->actionSubstate == SUBSTATE_HAMMER_1 && result < 0) {
|
||||
playerStatus->actionSubstate = SUBSTATE_HAMMER_2;
|
||||
}
|
||||
HammerHit->timer += 1;
|
||||
HammerHit->timer++;
|
||||
if (result >= 0) {
|
||||
HammerHit->unk_14 = 1;
|
||||
}
|
||||
|
@ -1,58 +1,65 @@
|
||||
#include "common.h"
|
||||
|
||||
extern f32 D_802B62B0;
|
||||
enum {
|
||||
SUBSTATE_FLYING = 0,
|
||||
SUBSTATE_FALLING = 1
|
||||
};
|
||||
|
||||
void func_802B6000_E27C90(void) {
|
||||
void action_update_hit_fire(void) {
|
||||
PlayerStatus* playerStatus = &gPlayerStatus;
|
||||
f32 sinTheta;
|
||||
f32 cosTheta;
|
||||
f32 dx, dy;
|
||||
f32 speed;
|
||||
|
||||
static f32 ReturnAngle;
|
||||
|
||||
if (playerStatus->flags & PLAYER_STATUS_FLAGS_ACTION_STATE_CHANGED) {
|
||||
playerStatus->flags &= ~PLAYER_STATUS_FLAGS_ACTION_STATE_CHANGED;
|
||||
|
||||
playerStatus->animFlags |= PLAYER_STATUS_ANIM_FLAGS_4;
|
||||
playerStatus->flags |= (PLAYER_STATUS_FLAGS_800 | PLAYER_STATUS_FLAGS_FLYING);
|
||||
suggest_player_anim_setUnkFlag(0x10019);
|
||||
playerStatus->fallState = 0;
|
||||
|
||||
suggest_player_anim_setUnkFlag(ANIM_Mario_Scared);
|
||||
|
||||
playerStatus->actionSubstate = SUBSTATE_FLYING;
|
||||
playerStatus->gravityIntegrator[0] = 18.3473f;
|
||||
playerStatus->gravityIntegrator[1] = -3.738f;
|
||||
playerStatus->gravityIntegrator[2] = 0.8059f;
|
||||
playerStatus->gravityIntegrator[3] = -0.0987f;
|
||||
gCameras[CAM_DEFAULT].moveFlags |= CAMERA_MOVE_FLAGS_1;
|
||||
D_802B62B0 = atan2(playerStatus->position.x, playerStatus->position.z, playerStatus->lastGoodPosition.x, playerStatus->lastGoodPosition.z);
|
||||
ReturnAngle = atan2(playerStatus->position.x, playerStatus->position.z, playerStatus->lastGoodPosition.x, playerStatus->lastGoodPosition.z);
|
||||
playerStatus->currentSpeed = get_xz_dist_to_player(playerStatus->lastGoodPosition.x, playerStatus->lastGoodPosition.z) / 18.0f;
|
||||
subtract_hp(1);
|
||||
open_status_menu_long();
|
||||
gOverrideFlags |= GLOBAL_OVERRIDES_40;
|
||||
}
|
||||
|
||||
sin_cos_rad(D_802B62B0 * TAU / 360.0f, &sinTheta, &cosTheta);
|
||||
sin_cos_rad(ReturnAngle * TAU / 360.0f, &dx, &dy);
|
||||
speed = playerStatus->currentSpeed;
|
||||
|
||||
if (playerStatus->flags & 0x40000) {
|
||||
if (playerStatus->flags & PLAYER_STATUS_FLAGS_40000) {
|
||||
speed *= 0.5;
|
||||
}
|
||||
|
||||
playerStatus->position.x += speed * sinTheta;
|
||||
playerStatus->position.z -= speed * cosTheta;
|
||||
playerStatus->position.x += speed * dx;
|
||||
playerStatus->position.z -= speed * dy;
|
||||
|
||||
if (playerStatus->fallState == 0) {
|
||||
if (playerStatus->actionSubstate == SUBSTATE_FLYING) {
|
||||
integrate_gravity();
|
||||
playerStatus->position.y += playerStatus->gravityIntegrator[0];
|
||||
if (playerStatus->gravityIntegrator[0] < 0.0f) {
|
||||
playerStatus->fallState = 1;
|
||||
playerStatus->flags |= 4;
|
||||
playerStatus->actionSubstate = SUBSTATE_FALLING;
|
||||
playerStatus->flags |= PLAYER_STATUS_FLAGS_FALLING;
|
||||
}
|
||||
} else {
|
||||
s32 collider;
|
||||
s32 colliderID;
|
||||
|
||||
playerStatus->position.y = player_check_collision_below(func_800E34D8(), &collider);
|
||||
if (collider >= 0) {
|
||||
collider = get_collider_type_by_id(collider);
|
||||
playerStatus->position.y = player_check_collision_below(func_800E34D8(), &colliderID);
|
||||
if (colliderID >= 0) {
|
||||
colliderID = get_collider_flags(colliderID); //TODO surfaceType
|
||||
set_action_state(ACTION_STATE_LAND);
|
||||
playerStatus->blinkTimer = 60;
|
||||
playerStatus->unk_BF = 0;
|
||||
playerStatus->flags &= ~0x800;
|
||||
playerStatus->hazardType = HAZARD_TYPE_NONE;
|
||||
playerStatus->flags &= ~PLAYER_STATUS_FLAGS_800;
|
||||
gOverrideFlags &= ~GLOBAL_OVERRIDES_40;
|
||||
}
|
||||
}
|
||||
|
@ -1,196 +1,206 @@
|
||||
#include "common.h"
|
||||
#include "effects.h"
|
||||
|
||||
extern f32 D_802B68B0;
|
||||
extern f32 D_802B68B4;
|
||||
extern f32 D_802B68B8;
|
||||
extern f32 D_802B68BC;
|
||||
enum {
|
||||
SUBSTATE_INIT = 0,
|
||||
SUBSTATE_DELAY_LAUNCH = 1,
|
||||
SUBSTATE_LAUNCH = 2,
|
||||
SUBSTATE_END_LAUNCH = 3,
|
||||
SUBSTATE_RETURN_INIT = 4,
|
||||
SUBSTATE_RETURN_MOTION = 5,
|
||||
SUBSTATE_HOVER = 6,
|
||||
SUBSTATE_BOUNCE = 7,
|
||||
SUBSTATE_DELAY_DONE = 8,
|
||||
SUBSTATE_DELAY_INIT_SINK = 20,
|
||||
SUBSTATE_DELAY_INIT = 21
|
||||
};
|
||||
|
||||
void func_802B6000_E27F40(void) {
|
||||
void action_update_hit_lava(void) {
|
||||
PlayerStatus* playerStatus = &gPlayerStatus;
|
||||
f32 sp18;
|
||||
f32 sp1C;
|
||||
f32 sp20;
|
||||
f32 sp24;
|
||||
f32 sp28;
|
||||
s32 sp2C;
|
||||
f32 tempGravityIntegrator;
|
||||
f32 theta;
|
||||
f32 tempCurrentSpeed;
|
||||
f32 resetPosX, resetPosY, resetPosZ;
|
||||
f32 returnRadians;
|
||||
f32 dx, dy;
|
||||
f32 componentSpeed;
|
||||
s32 completeAxes; // number of axes along which the 'return motion' is complete
|
||||
|
||||
if (playerStatus->flags & (1 << 31)) {
|
||||
playerStatus->flags &= ~0x80000000;
|
||||
playerStatus->flags |= 0x800008;
|
||||
playerStatus->animFlags |= 4;
|
||||
playerStatus->flags |= 0x800;
|
||||
if (playerStatus->unk_BF == 1) {
|
||||
playerStatus->fallState = 0x14;
|
||||
static s32 pad[2]; // curious
|
||||
static f32 LaunchVelocity;
|
||||
static f32 LaunchInterpPhase; // used to interp launch velocity
|
||||
static f32 ReturnAngle;
|
||||
static f32 InitialPosY;
|
||||
|
||||
if (playerStatus->flags & PLAYER_STATUS_FLAGS_ACTION_STATE_CHANGED) {
|
||||
playerStatus->flags &= ~PLAYER_STATUS_FLAGS_ACTION_STATE_CHANGED;
|
||||
playerStatus->flags |= (PLAYER_STATUS_FLAGS_800000 | PLAYER_STATUS_FLAGS_FLYING);
|
||||
playerStatus->animFlags |= PLAYER_STATUS_ANIM_FLAGS_4;
|
||||
playerStatus->flags |= PLAYER_STATUS_FLAGS_800;
|
||||
if (playerStatus->hazardType == HAZARD_TYPE_LAVA) {
|
||||
playerStatus->actionSubstate = SUBSTATE_DELAY_INIT_SINK;
|
||||
playerStatus->currentStateTime = 2;
|
||||
} else {
|
||||
playerStatus->fallState = 0;
|
||||
playerStatus->actionSubstate = SUBSTATE_INIT;
|
||||
}
|
||||
D_802B68BC = playerStatus->position.y;
|
||||
InitialPosY = playerStatus->position.y;
|
||||
playerStatus->currentSpeed = 0.0f;
|
||||
D_802B68B0 = 0.0f;
|
||||
LaunchVelocity = 0.0f;
|
||||
|
||||
gCameras[CAM_DEFAULT].moveFlags |= (CAMERA_MOVE_FLAGS_1 | CAMERA_MOVE_FLAGS_2);
|
||||
D_802B68B4 = 90.0f;
|
||||
LaunchInterpPhase = 90.0f;
|
||||
subtract_hp(1);
|
||||
open_status_menu_long();
|
||||
gOverrideFlags |= GLOBAL_OVERRIDES_40;
|
||||
sfx_play_sound_at_player(SOUND_E8, 0);
|
||||
}
|
||||
|
||||
switch (playerStatus->fallState) {
|
||||
case 21:
|
||||
switch (playerStatus->actionSubstate) {
|
||||
case SUBSTATE_DELAY_INIT:
|
||||
if (--playerStatus->currentStateTime == -1) {
|
||||
playerStatus->fallState = 0;
|
||||
playerStatus->actionSubstate = SUBSTATE_INIT;
|
||||
}
|
||||
break;
|
||||
case 20:
|
||||
case SUBSTATE_DELAY_INIT_SINK:
|
||||
if (--playerStatus->currentStateTime == -1) {
|
||||
playerStatus->fallState = 0;
|
||||
playerStatus->actionSubstate = SUBSTATE_INIT;
|
||||
}
|
||||
playerStatus->position.y -= 4.0f;
|
||||
break;
|
||||
case 0:
|
||||
if (playerStatus->unk_BF == 1) {
|
||||
case SUBSTATE_INIT:
|
||||
if (playerStatus->hazardType == HAZARD_TYPE_LAVA) {
|
||||
fx_smoke_burst(0, playerStatus->position.x, playerStatus->position.y, playerStatus->position.z, 1.0f, 40);
|
||||
}
|
||||
suggest_player_anim_setUnkFlag(0x80000 | 2);
|
||||
suggest_player_anim_setUnkFlag(ANIM_Mario_80002);
|
||||
playerStatus->gravityIntegrator[1] = 0.0f;
|
||||
playerStatus->timeInAir = 0;
|
||||
playerStatus->unk_C2 = 0;
|
||||
playerStatus->fallState = 2;
|
||||
playerStatus->actionSubstate = SUBSTATE_LAUNCH;
|
||||
playerStatus->currentStateTime = 1;
|
||||
playerStatus->gravityIntegrator[0] = 20.0f;
|
||||
playerStatus->gravityIntegrator[2] = 250.0f;
|
||||
playerStatus->gravityIntegrator[3] = D_802B68BC;
|
||||
playerStatus->gravityIntegrator[3] = InitialPosY;
|
||||
playerStatus->jumpFromPos.x = playerStatus->position.x;
|
||||
playerStatus->jumpFromPos.z = playerStatus->position.z;
|
||||
playerStatus->jumpFromHeight = playerStatus->position.y;
|
||||
playerStatus->flags |= 0x2;
|
||||
playerStatus->flags |= PLAYER_STATUS_FLAGS_JUMPING;
|
||||
break;
|
||||
case 1:
|
||||
if (--playerStatus->currentStateTime << 16 <= 0) {
|
||||
playerStatus->fallState++;
|
||||
case SUBSTATE_DELAY_LAUNCH:
|
||||
if (--playerStatus->currentStateTime <= 0) {
|
||||
playerStatus->actionSubstate++;
|
||||
}
|
||||
break;
|
||||
case 2:
|
||||
if (playerStatus->unk_BF == 1 && (playerStatus->timeInAir % 2) == 0) {
|
||||
case SUBSTATE_LAUNCH:
|
||||
if (playerStatus->hazardType == HAZARD_TYPE_LAVA && (playerStatus->timeInAir % 2) == 0) {
|
||||
fx_smoke_burst(0, playerStatus->position.x, playerStatus->position.y, playerStatus->position.z, 0.7f, 18);
|
||||
}
|
||||
if (playerStatus->position.y < playerStatus->gravityIntegrator[3] + playerStatus->gravityIntegrator[2]) {
|
||||
sin_cos_rad((D_802B68B4 * TAU) / 360.0f, &sp18, &sp1C);
|
||||
D_802B68B0 = sin_rad((D_802B68B4 * TAU) / 360.0f) * 16.0f;
|
||||
if (D_802B68B0 < -1.0f) {
|
||||
D_802B68B0 = -1.0f;
|
||||
sin_cos_rad((LaunchInterpPhase * TAU) / 360.0f, &dx, &dy);
|
||||
LaunchVelocity = sin_rad((LaunchInterpPhase * TAU) / 360.0f) * 16.0f;
|
||||
if (LaunchVelocity < -1.0f) {
|
||||
LaunchVelocity = -1.0f;
|
||||
}
|
||||
playerStatus->position.y += D_802B68B0;
|
||||
D_802B68B4 += 3.0f;
|
||||
if (D_802B68B4 > 180.0f) {
|
||||
D_802B68B4 = 180.0f;
|
||||
playerStatus->fallState++;
|
||||
playerStatus->position.y += LaunchVelocity;
|
||||
LaunchInterpPhase += 3.0f;
|
||||
if (LaunchInterpPhase > 180.0f) {
|
||||
LaunchInterpPhase = 180.0f;
|
||||
playerStatus->actionSubstate++;
|
||||
}
|
||||
} else {
|
||||
playerStatus->position.y = playerStatus->gravityIntegrator[3] + playerStatus->gravityIntegrator[2];
|
||||
playerStatus->fallState++;
|
||||
playerStatus->actionSubstate++;
|
||||
}
|
||||
break;
|
||||
case 3:
|
||||
if (playerStatus->unk_BF == 1 && (playerStatus->timeInAir % 2) == 0) {
|
||||
case SUBSTATE_END_LAUNCH:
|
||||
if (playerStatus->hazardType == HAZARD_TYPE_LAVA && (playerStatus->timeInAir % 2) == 0) {
|
||||
fx_smoke_burst(0, playerStatus->position.x, playerStatus->position.y, playerStatus->position.z, 0.7f, 18);
|
||||
}
|
||||
if (get_lava_reset_pos(&sp20, &sp24, &sp28) == 0) {
|
||||
sp20 = playerStatus->position.x;
|
||||
sp28 = playerStatus->position.z;
|
||||
if (get_lava_reset_pos(&resetPosX, &resetPosY, &resetPosZ) == 0) {
|
||||
resetPosX = playerStatus->position.x;
|
||||
resetPosZ = playerStatus->position.z;
|
||||
}
|
||||
playerStatus->lastGoodPosition.x = sp20;
|
||||
playerStatus->lastGoodPosition.z = sp28;
|
||||
playerStatus->lastGoodPosition.x = resetPosX;
|
||||
playerStatus->lastGoodPosition.z = resetPosZ;
|
||||
playerStatus->jumpApexHeight = playerStatus->position.y;
|
||||
playerStatus->gravityIntegrator[0] = 0.1143f;
|
||||
playerStatus->gravityIntegrator[1] = -0.2871f;
|
||||
playerStatus->gravityIntegrator[2] = -0.1823f;
|
||||
playerStatus->gravityIntegrator[3] = 0.01152f;
|
||||
playerStatus->fallState++;
|
||||
LOAD_INTEGRATOR_FALL(playerStatus->gravityIntegrator);
|
||||
playerStatus->actionSubstate++;
|
||||
break;
|
||||
case 4:
|
||||
D_802B68B8 = atan2(playerStatus->position.x, playerStatus->position.z, playerStatus->lastGoodPosition.x, playerStatus->lastGoodPosition.z);
|
||||
case SUBSTATE_RETURN_INIT:
|
||||
ReturnAngle = atan2(playerStatus->position.x, playerStatus->position.z, playerStatus->lastGoodPosition.x, playerStatus->lastGoodPosition.z);
|
||||
playerStatus->currentSpeed = get_xz_dist_to_player(playerStatus->lastGoodPosition.x, playerStatus->lastGoodPosition.z) / 18.0f;
|
||||
playerStatus->fallState++;
|
||||
playerStatus->actionSubstate++;
|
||||
break;
|
||||
case 5:
|
||||
D_802B68B8 = atan2(playerStatus->position.x, playerStatus->position.z, playerStatus->lastGoodPosition.x, playerStatus->lastGoodPosition.z);
|
||||
theta = D_802B68B8 * TAU / 360.0f;
|
||||
tempCurrentSpeed = playerStatus->currentSpeed * sin_rad(theta);
|
||||
playerStatus->position.x += tempCurrentSpeed;
|
||||
sp2C = 0;
|
||||
if (tempCurrentSpeed >= 0.0f) {
|
||||
case SUBSTATE_RETURN_MOTION:
|
||||
ReturnAngle = atan2(playerStatus->position.x, playerStatus->position.z, playerStatus->lastGoodPosition.x, playerStatus->lastGoodPosition.z);
|
||||
returnRadians = ReturnAngle * TAU / 360.0f;
|
||||
// update motion along x axis
|
||||
componentSpeed = playerStatus->currentSpeed * sin_rad(returnRadians);
|
||||
playerStatus->position.x += componentSpeed;
|
||||
completeAxes = 0;
|
||||
if (componentSpeed >= 0.0f) {
|
||||
if (playerStatus->lastGoodPosition.x <= playerStatus->position.x) {
|
||||
playerStatus->position.x = playerStatus->lastGoodPosition.x;
|
||||
sp2C = 1;
|
||||
completeAxes++;
|
||||
}
|
||||
} else {
|
||||
if (playerStatus->position.x <= playerStatus->lastGoodPosition.x) {
|
||||
playerStatus->position.x = playerStatus->lastGoodPosition.x;
|
||||
sp2C = 1;
|
||||
completeAxes++;
|
||||
}
|
||||
}
|
||||
tempCurrentSpeed = playerStatus->currentSpeed * cos_rad(theta);
|
||||
playerStatus->position.z -= tempCurrentSpeed;
|
||||
if (tempCurrentSpeed >= 0.0f) {
|
||||
// update motion along z axis
|
||||
componentSpeed = playerStatus->currentSpeed * cos_rad(returnRadians);
|
||||
playerStatus->position.z -= componentSpeed;
|
||||
if (componentSpeed >= 0.0f) {
|
||||
if (playerStatus->position.z <= playerStatus->lastGoodPosition.z) {
|
||||
playerStatus->position.z = playerStatus->lastGoodPosition.z;
|
||||
sp2C++;
|
||||
completeAxes++;
|
||||
}
|
||||
} else {
|
||||
if (playerStatus->lastGoodPosition.z <= playerStatus->position.z) {
|
||||
playerStatus->position.z = playerStatus->lastGoodPosition.z;
|
||||
sp2C++;
|
||||
completeAxes++;
|
||||
}
|
||||
}
|
||||
if (sp2C == 2) {
|
||||
playerStatus->fallState++;
|
||||
// if both axes are done, continue to next substate
|
||||
if (completeAxes == 2) {
|
||||
playerStatus->actionSubstate++;
|
||||
}
|
||||
break;
|
||||
case 6:
|
||||
if (playerStatus->unk_BF == 1 && (playerStatus->timeInAir % 2) == 0) {
|
||||
case SUBSTATE_HOVER:
|
||||
if (playerStatus->hazardType == HAZARD_TYPE_LAVA && (playerStatus->timeInAir % 2) == 0) {
|
||||
fx_smoke_burst(0, playerStatus->position.x, playerStatus->position.y, playerStatus->position.z, 0.7f, 18);
|
||||
}
|
||||
playerStatus->position.y = player_check_collision_below(func_800E34D8(), &sp2C);
|
||||
if (sp2C >= 0) {
|
||||
playerStatus->position.y = player_check_collision_below(func_800E34D8(), &completeAxes);
|
||||
if (completeAxes >= 0) {
|
||||
exec_ShakeCamX(0, 2, 1, 0.8f);
|
||||
start_rumble(0x100, 0x32);
|
||||
start_rumble(256, 50);
|
||||
phys_adjust_cam_on_landing();
|
||||
gCameras[CAM_DEFAULT].moveFlags &= ~CAMERA_MOVE_FLAGS_2;
|
||||
sfx_play_sound_at_player(SOUND_3FB, 0);
|
||||
suggest_player_anim_setUnkFlag(0x8001A);
|
||||
playerStatus->flags &= ~0x800;
|
||||
playerStatus->flags &= ~8;
|
||||
playerStatus->unk_BF = 0;
|
||||
suggest_player_anim_setUnkFlag(ANIM_Mario_8001A);
|
||||
playerStatus->flags &= ~PLAYER_STATUS_FLAGS_800;
|
||||
playerStatus->flags &= ~PLAYER_STATUS_FLAGS_FLYING;
|
||||
playerStatus->hazardType = HAZARD_TYPE_NONE;
|
||||
playerStatus->gravityIntegrator[0] = 6.0f;
|
||||
playerStatus->position.y += 6.0f;
|
||||
playerStatus->fallState++;
|
||||
playerStatus->actionSubstate++;
|
||||
}
|
||||
break;
|
||||
case 7:
|
||||
tempGravityIntegrator = playerStatus->gravityIntegrator[0] - 1.0;
|
||||
playerStatus->gravityIntegrator[0] = tempGravityIntegrator;
|
||||
playerStatus->position.y = player_check_collision_below(tempGravityIntegrator, &sp2C);
|
||||
if (sp2C >= 0) {
|
||||
playerStatus->currentStateTime = 0xA;
|
||||
playerStatus->fallState++;
|
||||
case SUBSTATE_BOUNCE:
|
||||
playerStatus->gravityIntegrator[0] -= 1.0;
|
||||
playerStatus->position.y = player_check_collision_below(playerStatus->gravityIntegrator[0], &completeAxes);
|
||||
if (completeAxes >= 0) {
|
||||
playerStatus->currentStateTime = 10;
|
||||
playerStatus->actionSubstate++;
|
||||
}
|
||||
break;
|
||||
case 8:
|
||||
if (--playerStatus->currentStateTime << 16 <= 0) {
|
||||
case SUBSTATE_DELAY_DONE:
|
||||
if (--playerStatus->currentStateTime <= 0) {
|
||||
set_action_state(ACTION_STATE_LAND);
|
||||
playerStatus->flags &= ~0x800000;
|
||||
playerStatus->flags &= ~PLAYER_STATUS_FLAGS_800000;
|
||||
gOverrideFlags &= ~GLOBAL_OVERRIDES_40;
|
||||
}
|
||||
break;
|
||||
}
|
||||
if (playerStatus->fallState < 7) {
|
||||
if (playerStatus->actionSubstate < SUBSTATE_BOUNCE) {
|
||||
playerStatus->timeInAir++;
|
||||
}
|
||||
}
|
||||
|
@ -1,54 +1,58 @@
|
||||
#include "common.h"
|
||||
#include "../actions.h"
|
||||
|
||||
s32 IdlePeachAnims[] = {
|
||||
0x000A0001, // none
|
||||
0x000A0007, // cream
|
||||
0x000A0009, // strawberry
|
||||
0x000A000B, // butter
|
||||
0x000A000D, // cleanser
|
||||
0x000A000F, // water
|
||||
0x000A0011, // milk
|
||||
0x000A0013, // flour
|
||||
0x000A0015, // egg
|
||||
0x000A0017, // complete cake
|
||||
0x000A0019, // cake bowl
|
||||
0x000A001B, // cake mixed
|
||||
0x000A001D, // cake pan
|
||||
0x000A001F, // cake batter
|
||||
0x000A0021, // cake bare
|
||||
0x000A0023, // salt
|
||||
0x000A0025, // sugar
|
||||
0x000A0027, // cake with icing
|
||||
0x000A0029, // cake with berries
|
||||
AnimID IdlePeachAnims[] = {
|
||||
ANIM_Peach_A0001, // none
|
||||
ANIM_Peach_A0007, // cream
|
||||
ANIM_Peach_A0009, // strawberry
|
||||
ANIM_Peach_A000B, // butter
|
||||
ANIM_Peach_A000D, // cleanser
|
||||
ANIM_Peach_A000F, // water
|
||||
ANIM_Peach_A0011, // milk
|
||||
ANIM_Peach_A0013, // flour
|
||||
ANIM_Peach_A0015, // egg
|
||||
ANIM_Peach_A0017, // complete cake
|
||||
ANIM_Peach_A0019, // cake bowl
|
||||
ANIM_Peach_A001B, // cake mixed
|
||||
ANIM_Peach_A001D, // cake pan
|
||||
ANIM_Peach_A001F, // cake batter
|
||||
ANIM_Peach_A0021, // cake bare
|
||||
ANIM_Peach_A0023, // salt
|
||||
ANIM_Peach_A0025, // sugar
|
||||
ANIM_Peach_A0027, // cake with icing
|
||||
ANIM_Peach_A0029, // cake with berries
|
||||
0x00000000,
|
||||
};
|
||||
|
||||
void action_idle_update_peach(void);
|
||||
enum {
|
||||
SUBSTATE_IDLE_DEFAULT = 0,
|
||||
SUBSTATE_IDLE_STRETCH = 1,
|
||||
SUBSTATE_DELAY_SLEEP = 2,
|
||||
SUBSTATE_IDLE_SLEEP = 3,
|
||||
};
|
||||
|
||||
void action_idle_update(void) {
|
||||
void action_update_idle_peach(void);
|
||||
|
||||
void action_update_idle(void) {
|
||||
PlayerStatus* playerStatus = &gPlayerStatus;
|
||||
PlayerData* playerData = &gPlayerData;
|
||||
s32 wasMoving = FALSE;
|
||||
f32 angle, magnitude;
|
||||
AnimID anim;
|
||||
|
||||
if (playerStatus->animFlags & PLAYER_STATUS_ANIM_FLAGS_USING_PEACH_PHYSICS) {
|
||||
action_idle_update_peach();
|
||||
action_update_idle_peach();
|
||||
return;
|
||||
}
|
||||
|
||||
playerStatus->currentStateTime++;
|
||||
|
||||
if (playerStatus->flags & PLAYER_STATUS_FLAGS_ACTION_STATE_CHANGED) {
|
||||
s32 anim;
|
||||
|
||||
playerStatus->flags &=
|
||||
~(PLAYER_STATUS_FLAGS_ACTION_STATE_CHANGED
|
||||
| PLAYER_STATUS_FLAGS_80000
|
||||
| PLAYER_STATUS_FLAGS_JUMPING
|
||||
| PLAYER_STATUS_FLAGS_FALLING
|
||||
| PLAYER_STATUS_FLAGS_FLYING);
|
||||
playerStatus->flags &= ~(PLAYER_STATUS_FLAGS_ACTION_STATE_CHANGED
|
||||
| PLAYER_STATUS_FLAGS_80000 | PLAYER_STATUS_FLAGS_AIRBORNE);
|
||||
wasMoving = TRUE;
|
||||
playerStatus->fallState = 0;
|
||||
playerStatus->actionSubstate = SUBSTATE_IDLE_DEFAULT;
|
||||
playerStatus->currentStateTime = 0;
|
||||
playerStatus->timeInAir = 0;
|
||||
playerStatus->unk_C2 = 0;
|
||||
@ -56,13 +60,13 @@ void action_idle_update(void) {
|
||||
playerStatus->pitch = 0.0f;
|
||||
|
||||
if (playerStatus->animFlags & PLAYER_STATUS_ANIM_FLAGS_8BIT_MARIO) {
|
||||
anim = 0x90002;
|
||||
anim = ANIM_Mario_90002;
|
||||
} else if (!(playerStatus->animFlags & PLAYER_STATUS_ANIM_FLAGS_HOLDING_WATT)) {
|
||||
anim = 0x10002;
|
||||
} else if ((s8)playerStatus->prevActionState == ACTION_STATE_IDLE) {
|
||||
anim = 0x60005;
|
||||
anim = ANIM_Mario_10002;
|
||||
} else if (playerStatus->prevActionState == ACTION_STATE_IDLE) {
|
||||
anim = ANIM_Mario_60005;
|
||||
} else {
|
||||
anim = 0x60007;
|
||||
anim = ANIM_Mario_60007;
|
||||
}
|
||||
suggest_player_anim_clearUnkFlag(anim);
|
||||
}
|
||||
@ -70,9 +74,6 @@ void action_idle_update(void) {
|
||||
if (playerStatus->animFlags & PLAYER_STATUS_ANIM_FLAGS_RAISED_ARMS) {
|
||||
set_action_state(ACTION_STATE_RAISE_ARMS);
|
||||
} else {
|
||||
f32 angle;
|
||||
f32 magnitude;
|
||||
|
||||
player_input_to_move_vector(&angle, &magnitude);
|
||||
phys_update_interact_collider();
|
||||
|
||||
@ -95,29 +96,25 @@ void action_idle_update(void) {
|
||||
}
|
||||
}
|
||||
|
||||
void action_idle_update_peach(void) {
|
||||
void action_update_idle_peach(void) {
|
||||
PlayerStatus* playerStatus = &gPlayerStatus;
|
||||
PlayerData* playerData = &gPlayerData;
|
||||
f32 angle;
|
||||
f32 magnitude;
|
||||
f32 angle, magnitude;
|
||||
|
||||
if (playerStatus->flags & PLAYER_STATUS_FLAGS_ACTION_STATE_CHANGED) {
|
||||
playerStatus->flags &= ~PLAYER_STATUS_FLAGS_ACTION_STATE_CHANGED;
|
||||
playerStatus->fallState = 0;
|
||||
playerStatus->actionSubstate = SUBSTATE_IDLE_DEFAULT;
|
||||
playerStatus->currentStateTime = 0;
|
||||
playerStatus->timeInAir = 0;
|
||||
playerStatus->unk_C2 = 0;
|
||||
playerStatus->currentSpeed = 0.0f;
|
||||
playerStatus->flags &=
|
||||
~(PLAYER_STATUS_FLAGS_JUMPING
|
||||
| PLAYER_STATUS_FLAGS_FALLING
|
||||
| PLAYER_STATUS_FLAGS_FLYING);
|
||||
playerStatus->flags &= ~PLAYER_STATUS_FLAGS_AIRBORNE;
|
||||
|
||||
if (!(playerStatus->animFlags & PLAYER_STATUS_ANIM_FLAGS_IN_DISGUISE)) {
|
||||
if (!(gGameStatusPtr->peachFlags & PEACH_STATUS_FLAG_HAS_INGREDIENT)) {
|
||||
suggest_player_anim_clearUnkFlag(IdlePeachAnims[gGameStatusPtr->peachCookingIngredient]);
|
||||
} else {
|
||||
suggest_player_anim_clearUnkFlag(0xC000E);
|
||||
suggest_player_anim_clearUnkFlag(ANIM_Peach_C000E);
|
||||
}
|
||||
} else {
|
||||
peach_set_disguise_anim(BasicPeachDisguiseAnims[gPlayerStatus.peachDisguise].idle);
|
||||
@ -125,38 +122,42 @@ void action_idle_update_peach(void) {
|
||||
}
|
||||
|
||||
if (!(playerStatus->animFlags & PLAYER_STATUS_ANIM_FLAGS_IN_DISGUISE)) {
|
||||
switch (playerStatus->fallState) {
|
||||
case 0:
|
||||
if (!(playerStatus->flags & (PLAYER_STATUS_FLAGS_1000 | PLAYER_STATUS_FLAGS_INPUT_DISABLED)) && (playerStatus->unk_C4 == 0)) {
|
||||
switch (playerStatus->actionSubstate) {
|
||||
case SUBSTATE_IDLE_DEFAULT:
|
||||
if (!(playerStatus->flags & (PLAYER_STATUS_FLAGS_1000 | PLAYER_STATUS_FLAGS_INPUT_DISABLED))
|
||||
&& (playerStatus->peachItemHeld == 0)) {
|
||||
if (playerStatus->currentStateTime > 1800) {
|
||||
playerStatus->fallState++;
|
||||
suggest_player_anim_clearUnkFlag(0xC0003);
|
||||
// begin first yawm
|
||||
playerStatus->actionSubstate++;
|
||||
suggest_player_anim_clearUnkFlag(ANIM_Peach_C0003);
|
||||
return;
|
||||
}
|
||||
playerStatus->currentStateTime++;
|
||||
}
|
||||
break;
|
||||
case 1:
|
||||
case SUBSTATE_IDLE_STRETCH:
|
||||
// waiting for yawn to finish
|
||||
if (playerStatus->unk_BC != 0) {
|
||||
playerStatus->fallState++;
|
||||
playerStatus->actionSubstate++;
|
||||
playerStatus->currentStateTime = 0;
|
||||
suggest_player_anim_clearUnkFlag(0xA0001);
|
||||
suggest_player_anim_clearUnkFlag(ANIM_Peach_A0001);
|
||||
}
|
||||
break;
|
||||
case 2: {
|
||||
case SUBSTATE_DELAY_SLEEP:
|
||||
// delay before next yawn and sleep
|
||||
playerStatus->currentStateTime++;
|
||||
if (playerStatus->currentStateTime > 200) {
|
||||
playerStatus->fallState++;
|
||||
suggest_player_anim_clearUnkFlag(0xC0003);
|
||||
playerStatus->actionSubstate++;
|
||||
suggest_player_anim_clearUnkFlag(ANIM_Peach_C0003);
|
||||
}
|
||||
break;
|
||||
}
|
||||
case 3:
|
||||
case SUBSTATE_IDLE_SLEEP:
|
||||
// peach is asleep
|
||||
if (playerStatus->flags & (PLAYER_STATUS_FLAGS_1000 | PLAYER_STATUS_FLAGS_INPUT_DISABLED)) {
|
||||
suggest_player_anim_clearUnkFlag(0xA0001);
|
||||
playerStatus->fallState = 0;
|
||||
suggest_player_anim_clearUnkFlag(ANIM_Peach_A0001);
|
||||
playerStatus->actionSubstate = SUBSTATE_IDLE_DEFAULT;
|
||||
} else if (playerStatus->unk_BC != 0) {
|
||||
suggest_player_anim_clearUnkFlag(0xC0004);
|
||||
suggest_player_anim_clearUnkFlag(ANIM_Peach_C0004);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
@ -1,21 +1,23 @@
|
||||
#include "common.h"
|
||||
|
||||
extern f32 D_8010C960;
|
||||
extern f32 D_8010C97C;
|
||||
extern f32 JumpedOnSwitchX;
|
||||
extern f32 JumpedOnSwitchZ;
|
||||
|
||||
void func_802B6508_E24548(void);
|
||||
void func_802B647C_E244BC(void);
|
||||
// private functions
|
||||
void initialize_jump(void);
|
||||
void action_update_peach_step_down(void);
|
||||
void action_update_peach_falling(void);
|
||||
|
||||
void func_802B6000_E24040(void) {
|
||||
void initialize_jump(void) {
|
||||
PlayerStatus* playerStatus = &gPlayerStatus;
|
||||
CollisionStatus* collisionStatus = &gCollisionStatus;
|
||||
s32 temp_v1;
|
||||
AnimID anim;
|
||||
|
||||
playerStatus->fallState = 0;
|
||||
playerStatus->actionSubstate = JUMP_SUBSTATE_0;
|
||||
playerStatus->timeInAir = 0;
|
||||
playerStatus->unk_C2 = 0;
|
||||
playerStatus->flags &= ~0x80000008;
|
||||
playerStatus->flags |= 2;
|
||||
playerStatus->flags &= ~(PLAYER_STATUS_FLAGS_ACTION_STATE_CHANGED | PLAYER_STATUS_FLAGS_FLYING);
|
||||
playerStatus->flags |= PLAYER_STATUS_FLAGS_JUMPING;
|
||||
playerStatus->jumpFromPos.x = playerStatus->position.x;
|
||||
playerStatus->jumpFromPos.z = playerStatus->position.z;
|
||||
playerStatus->jumpFromHeight = playerStatus->position.y;
|
||||
@ -23,25 +25,25 @@ void func_802B6000_E24040(void) {
|
||||
phys_init_integrator_for_current_state();
|
||||
|
||||
if (playerStatus->animFlags & PLAYER_STATUS_ANIM_FLAGS_8BIT_MARIO) {
|
||||
temp_v1 = 0x90005;
|
||||
anim = ANIM_Mario_90005;
|
||||
} else if (!(playerStatus->animFlags & (PLAYER_STATUS_ANIM_FLAGS_HOLDING_WATT | PLAYER_STATUS_ANIM_FLAGS_2))) {
|
||||
temp_v1 = 0x10007;
|
||||
anim = ANIM_Mario_AnimMidairStill;
|
||||
} else {
|
||||
temp_v1 = 0x60009;
|
||||
anim = ANIM_Mario_60009;
|
||||
}
|
||||
suggest_player_anim_clearUnkFlag(temp_v1);
|
||||
suggest_player_anim_clearUnkFlag(anim);
|
||||
|
||||
collisionStatus->lastTouchedFloor = collisionStatus->currentFloor;
|
||||
collisionStatus->currentFloor = -1;
|
||||
}
|
||||
|
||||
void func_802B60B4_E240F4(void) {
|
||||
void action_update_jump(void) {
|
||||
PlayerStatus* playerStatus = &gPlayerStatus;
|
||||
s32 anim;
|
||||
AnimID anim;
|
||||
|
||||
if (playerStatus->flags < 0) {
|
||||
playerStatus->flags &= ~0x80000000;
|
||||
func_802B6000_E24040();
|
||||
if (playerStatus->flags & PLAYER_STATUS_FLAGS_ACTION_STATE_CHANGED) {
|
||||
playerStatus->flags &= ~PLAYER_STATUS_FLAGS_ACTION_STATE_CHANGED;
|
||||
initialize_jump();
|
||||
|
||||
if (playerStatus->actionState == ACTION_STATE_LAUNCH) {
|
||||
phys_adjust_cam_on_landing();
|
||||
@ -60,35 +62,35 @@ void func_802B60B4_E240F4(void) {
|
||||
}
|
||||
|
||||
if (playerStatus->animFlags & PLAYER_STATUS_ANIM_FLAGS_8BIT_MARIO) {
|
||||
anim = 0x90005;
|
||||
anim = ANIM_Mario_90005;
|
||||
} else if (!(playerStatus->animFlags & (PLAYER_STATUS_ANIM_FLAGS_HOLDING_WATT | PLAYER_STATUS_ANIM_FLAGS_2))) {
|
||||
anim = 0x10007;
|
||||
anim = ANIM_Mario_AnimMidairStill;
|
||||
} else {
|
||||
anim = 0x60009;
|
||||
anim = ANIM_Mario_60009;
|
||||
}
|
||||
suggest_player_anim_clearUnkFlag(anim);
|
||||
|
||||
playerStatus->timeInAir++;
|
||||
}
|
||||
|
||||
void func_802B6198_E241D8(void) {
|
||||
void action_update_landing_on_switch(void) {
|
||||
PlayerStatus* playerStatus = &gPlayerStatus;
|
||||
CollisionStatus* collisionStatus = &gCollisionStatus;
|
||||
s32 anim;
|
||||
AnimID anim;
|
||||
|
||||
if (playerStatus->flags & PLAYER_STATUS_FLAGS_ACTION_STATE_CHANGED) {
|
||||
Entity* entity = get_entity_by_index(collisionStatus->currentFloor);
|
||||
|
||||
D_8010C960 = entity->position.x;
|
||||
D_8010C97C = entity->position.z;
|
||||
func_802B6000_E24040();
|
||||
playerStatus->flags |= 0x880000;
|
||||
JumpedOnSwitchX = entity->position.x;
|
||||
JumpedOnSwitchZ = entity->position.z;
|
||||
initialize_jump();
|
||||
playerStatus->flags |= (PLAYER_STATUS_FLAGS_800000 | PLAYER_STATUS_FLAGS_80000);
|
||||
disable_player_input();
|
||||
}
|
||||
|
||||
playerStatus->timeInAir++;
|
||||
|
||||
if (playerStatus->fallState != 1) {
|
||||
if (playerStatus->actionSubstate != JUMP_SUBSTATE_1) {
|
||||
return;
|
||||
}
|
||||
|
||||
@ -96,60 +98,57 @@ void func_802B6198_E241D8(void) {
|
||||
playerStatus->flags &= ~(PLAYER_STATUS_FLAGS_ACTION_STATE_CHANGED | PLAYER_STATUS_FLAGS_JUMPING | PLAYER_STATUS_FLAGS_FLYING);
|
||||
playerStatus->flags |= PLAYER_STATUS_FLAGS_FALLING;
|
||||
|
||||
|
||||
if (!(playerStatus->animFlags & (PLAYER_STATUS_ANIM_FLAGS_HOLDING_WATT | PLAYER_STATUS_ANIM_FLAGS_2))) {
|
||||
anim = 0x10008;
|
||||
anim = ANIM_Mario_AnimMidair;
|
||||
} else {
|
||||
anim = 0x6000A;
|
||||
anim = ANIM_Mario_6000A;
|
||||
}
|
||||
|
||||
suggest_player_anim_clearUnkFlag(anim);
|
||||
gCameras[CAM_DEFAULT].moveFlags |= CAMERA_MOVE_FLAGS_1;
|
||||
}
|
||||
|
||||
playerStatus->fallState++;
|
||||
playerStatus->actionSubstate++;
|
||||
}
|
||||
|
||||
void func_802B6294_E242D4(void) {
|
||||
void action_update_falling(void) {
|
||||
PlayerStatus* playerStatus = &gPlayerStatus;
|
||||
|
||||
if (playerStatus->animFlags & PLAYER_STATUS_ANIM_FLAGS_USING_PEACH_PHYSICS) {
|
||||
func_802B647C_E244BC();
|
||||
action_update_peach_falling();
|
||||
return;
|
||||
}
|
||||
|
||||
if (playerStatus->flags & PLAYER_STATUS_FLAGS_ACTION_STATE_CHANGED) {
|
||||
s32 phi_a0;
|
||||
s32 anim;
|
||||
|
||||
playerStatus->flags &= ~(PLAYER_STATUS_FLAGS_ACTION_STATE_CHANGED | PLAYER_STATUS_FLAGS_JUMPING | PLAYER_STATUS_FLAGS_FLYING);
|
||||
playerStatus->flags |= PLAYER_STATUS_FLAGS_FALLING;
|
||||
|
||||
if (playerStatus->animFlags & PLAYER_STATUS_ANIM_FLAGS_8BIT_MARIO) {
|
||||
phi_a0 = 0x90005;
|
||||
anim = ANIM_Mario_90005;
|
||||
} else if (!(playerStatus->animFlags & (PLAYER_STATUS_ANIM_FLAGS_HOLDING_WATT | PLAYER_STATUS_ANIM_FLAGS_2))) {
|
||||
phi_a0 = 0x10008;
|
||||
anim = ANIM_Mario_AnimMidair;
|
||||
} else {
|
||||
phi_a0 = 0x6000A;
|
||||
anim = ANIM_Mario_6000A;
|
||||
}
|
||||
suggest_player_anim_clearUnkFlag(phi_a0);
|
||||
suggest_player_anim_clearUnkFlag(anim);
|
||||
gCameras[CAM_DEFAULT].moveFlags |= CAMERA_MOVE_FLAGS_1;
|
||||
}
|
||||
playerStatus->timeInAir++;
|
||||
}
|
||||
|
||||
void func_802B6348_E24388(void) {
|
||||
void action_update_step_down(void) {
|
||||
PlayerStatus* playerStatus = &gPlayerStatus;
|
||||
f32 sub_arg5;
|
||||
f32 sub_arg6;
|
||||
f32 sub_arg7;
|
||||
f32 sub_arg8;
|
||||
f32 sp28;
|
||||
f32 sp2C;
|
||||
f32 sp30;
|
||||
f32 sp34;
|
||||
s32 colliderID;
|
||||
s32 surfaceType;
|
||||
f32 posX, posY, posZ;
|
||||
f32 hitRx, hitRz;
|
||||
f32 hitDirX, hitDirZ;
|
||||
f32 height;
|
||||
|
||||
if (playerStatus->animFlags & PLAYER_STATUS_ANIM_FLAGS_USING_PEACH_PHYSICS) {
|
||||
func_802B6508_E24548();
|
||||
action_update_peach_step_down();
|
||||
return;
|
||||
}
|
||||
|
||||
@ -161,23 +160,23 @@ void func_802B6348_E24388(void) {
|
||||
|
||||
playerStatus->timeInAir++;
|
||||
phys_update_interact_collider();
|
||||
sp28 = playerStatus->position.x;
|
||||
sp2C = playerStatus->position.y;
|
||||
sp30 = playerStatus->position.z;
|
||||
sp34 = playerStatus->colliderHeight;
|
||||
|
||||
if (((get_collider_type_by_id(player_raycast_below_cam_relative(playerStatus, &sp28, &sp2C, &sp30, &sp34,
|
||||
&sub_arg5, &sub_arg6, &sub_arg7, &sub_arg8)) & 0xFF) - 2 >= 2U) && check_input_jump()) {
|
||||
posX = playerStatus->position.x;
|
||||
posY = playerStatus->position.y;
|
||||
posZ = playerStatus->position.z;
|
||||
height = playerStatus->colliderHeight;
|
||||
|
||||
colliderID = player_raycast_below_cam_relative(playerStatus, &posX, &posY, &posZ, &height, &hitRx, &hitRz, &hitDirX, &hitDirZ);
|
||||
surfaceType = get_collider_flags(colliderID) & COLLIDER_FLAGS_SURFACE_TYPE_MASK;
|
||||
if (!(surfaceType == SURFACE_TYPE_SPIKES || surfaceType == SURFACE_TYPE_LAVA) && check_input_jump()) {
|
||||
set_action_state(ACTION_STATE_JUMP);
|
||||
playerStatus->flags &= ~0xE;
|
||||
func_802B60B4_E240F4();
|
||||
playerStatus->flags &= ~PLAYER_STATUS_FLAGS_AIRBORNE;
|
||||
action_update_jump();
|
||||
}
|
||||
}
|
||||
|
||||
void func_802B647C_E244BC(void) {
|
||||
void action_update_peach_falling(void) {
|
||||
PlayerStatus* playerStatus = &gPlayerStatus;
|
||||
s32 temp_v1;
|
||||
AnimID anim;
|
||||
|
||||
if (playerStatus->flags & PLAYER_STATUS_FLAGS_ACTION_STATE_CHANGED) {
|
||||
playerStatus->flags &= ~PLAYER_STATUS_FLAGS_ACTION_STATE_CHANGED;
|
||||
@ -185,18 +184,18 @@ void func_802B647C_E244BC(void) {
|
||||
playerStatus->flags |= PLAYER_STATUS_FLAGS_FALLING;
|
||||
|
||||
if (!(playerStatus->animFlags & PLAYER_STATUS_ANIM_FLAGS_USING_PEACH_PHYSICS)) {
|
||||
temp_v1 = 0x10008;
|
||||
anim = ANIM_Mario_AnimMidair;
|
||||
} else {
|
||||
temp_v1 = 0xA0006;
|
||||
anim = ANIM_Peach_A0006;
|
||||
}
|
||||
|
||||
suggest_player_anim_clearUnkFlag(temp_v1);
|
||||
suggest_player_anim_clearUnkFlag(anim);
|
||||
gCameras[CAM_DEFAULT].moveFlags |= CAMERA_MOVE_FLAGS_1;
|
||||
}
|
||||
playerStatus->timeInAir++;
|
||||
}
|
||||
|
||||
void func_802B6508_E24548(void) {
|
||||
void action_update_peach_step_down(void) {
|
||||
PlayerStatus* playerStatus = &gPlayerStatus;
|
||||
|
||||
if (playerStatus->flags & PLAYER_STATUS_FLAGS_ACTION_STATE_CHANGED) {
|
||||
@ -206,7 +205,7 @@ void func_802B6508_E24548(void) {
|
||||
gCameras[CAM_DEFAULT].moveFlags |= CAMERA_MOVE_FLAGS_1;
|
||||
|
||||
if (playerStatus->animFlags & PLAYER_STATUS_ANIM_FLAGS_USING_PEACH_PHYSICS) {
|
||||
suggest_player_anim_clearUnkFlag(0xA0006);
|
||||
suggest_player_anim_clearUnkFlag(ANIM_Peach_A0006);
|
||||
}
|
||||
}
|
||||
playerStatus->timeInAir++;
|
||||
|
@ -1,20 +1,25 @@
|
||||
#include "common.h"
|
||||
|
||||
extern f32 D_802B6240; // bss? angle to lastGoodPosition
|
||||
enum {
|
||||
SUBSTATE_FLYING = 0,
|
||||
SUBSTATE_FALLING = 1
|
||||
};
|
||||
|
||||
void func_802B6000_E287F0(void) {
|
||||
void action_update_knockback(void) {
|
||||
PlayerStatus* playerStatus = &gPlayerStatus;
|
||||
f32 dx;
|
||||
f32 dy;
|
||||
f32 dx, dy;
|
||||
f32 speed;
|
||||
|
||||
if (playerStatus->flags & 0x80000000) {
|
||||
playerStatus->flags &= ~0x80000000;
|
||||
static f32 ReturnAngle;
|
||||
|
||||
suggest_player_anim_setUnkFlag(0x10017);
|
||||
if (playerStatus->flags & PLAYER_STATUS_FLAGS_ACTION_STATE_CHANGED) {
|
||||
playerStatus->flags &= ~PLAYER_STATUS_FLAGS_ACTION_STATE_CHANGED;
|
||||
|
||||
suggest_player_anim_setUnkFlag(ANIM_Mario_FallBack);
|
||||
|
||||
playerStatus->flags |= PLAYER_STATUS_FLAGS_FLYING;
|
||||
|
||||
playerStatus->flags |= 8;
|
||||
playerStatus->fallState = 0;
|
||||
playerStatus->actionSubstate = SUBSTATE_FLYING;
|
||||
playerStatus->gravityIntegrator[0] = 18.3473f;
|
||||
playerStatus->gravityIntegrator[1] = -3.738f;
|
||||
playerStatus->gravityIntegrator[2] = 0.8059f;
|
||||
@ -22,30 +27,30 @@ void func_802B6000_E287F0(void) {
|
||||
|
||||
gCameras[CAM_DEFAULT].moveFlags |= CAMERA_MOVE_FLAGS_1;
|
||||
|
||||
D_802B6240 = atan2(playerStatus->position.x, playerStatus->position.z, playerStatus->lastGoodPosition.x,
|
||||
ReturnAngle = atan2(playerStatus->position.x, playerStatus->position.z, playerStatus->lastGoodPosition.x,
|
||||
playerStatus->lastGoodPosition.z);
|
||||
playerStatus->currentSpeed = get_xz_dist_to_player(playerStatus->lastGoodPosition.x, playerStatus->lastGoodPosition.z) / 18.0f;
|
||||
}
|
||||
|
||||
sin_cos_rad((D_802B6240 * TAU) / 360.0f, &dx, &dy);
|
||||
sin_cos_rad((ReturnAngle * TAU) / 360.0f, &dx, &dy);
|
||||
|
||||
speed = playerStatus->currentSpeed;
|
||||
|
||||
if (playerStatus->flags & 0x40000) {
|
||||
if (playerStatus->flags & PLAYER_STATUS_FLAGS_40000) {
|
||||
speed *= 0.5f;
|
||||
}
|
||||
|
||||
playerStatus->position.x += speed * dx;
|
||||
playerStatus->position.z -= speed * dy;
|
||||
|
||||
if (playerStatus->fallState == 0) {
|
||||
if (playerStatus->actionSubstate == SUBSTATE_FLYING) {
|
||||
integrate_gravity();
|
||||
|
||||
playerStatus->position.y += playerStatus->gravityIntegrator[0];
|
||||
|
||||
if (playerStatus->gravityIntegrator[0] < 0.0f) {
|
||||
playerStatus->fallState = 1; // Now start checking for floor
|
||||
playerStatus->flags |= 4;
|
||||
playerStatus->actionSubstate = SUBSTATE_FALLING;
|
||||
playerStatus->flags |= PLAYER_STATUS_FLAGS_FALLING;
|
||||
}
|
||||
} else {
|
||||
s32 colliderID;
|
||||
@ -53,7 +58,7 @@ void func_802B6000_E287F0(void) {
|
||||
playerStatus->position.y = player_check_collision_below(func_800E34D8(), &colliderID);
|
||||
|
||||
if (colliderID >= 0) {
|
||||
colliderID = get_collider_type_by_id(colliderID); // what
|
||||
colliderID = get_collider_flags(colliderID); //TODO surfaceType
|
||||
set_action_state(ACTION_STATE_LAND);
|
||||
}
|
||||
}
|
@ -1,19 +1,24 @@
|
||||
#include "common.h"
|
||||
|
||||
void func_802B62CC_E24BEC(void);
|
||||
void func_802B644C_E24D6C(void);
|
||||
enum {
|
||||
SUBSTATE_INIT = 0,
|
||||
SUBSTATE_DONE = 1,
|
||||
};
|
||||
|
||||
void func_802B6000_E24920(void) {
|
||||
void action_update_peach_land(void);
|
||||
void action_update_peach_step_down_land(void);
|
||||
|
||||
void action_update_land(void) {
|
||||
CollisionStatus* collisionStatus = &gCollisionStatus;
|
||||
PlayerStatus* playerStatus = &gPlayerStatus;
|
||||
Camera* camera = &gCameras[CAM_DEFAULT];
|
||||
f32 inputMoveMagnitude;
|
||||
f32 inputMoveAngle;
|
||||
s32 jumpInputCheck;
|
||||
s32 phi_a0;
|
||||
AnimID anim;
|
||||
|
||||
if (playerStatus->animFlags & PLAYER_STATUS_ANIM_FLAGS_USING_PEACH_PHYSICS) {
|
||||
func_802B62CC_E24BEC();
|
||||
action_update_peach_land();
|
||||
return;
|
||||
}
|
||||
|
||||
@ -22,25 +27,23 @@ void func_802B6000_E24920(void) {
|
||||
PLAYER_STATUS_FLAGS_ACTION_STATE_CHANGED |
|
||||
PLAYER_STATUS_FLAGS_800000 |
|
||||
PLAYER_STATUS_FLAGS_80000 |
|
||||
PLAYER_STATUS_FLAGS_FLYING |
|
||||
PLAYER_STATUS_FLAGS_FALLING |
|
||||
PLAYER_STATUS_FLAGS_JUMPING
|
||||
PLAYER_STATUS_FLAGS_AIRBORNE
|
||||
);
|
||||
playerStatus->fallState = 0;
|
||||
playerStatus->actionSubstate = SUBSTATE_INIT;
|
||||
playerStatus->timeInAir = 0;
|
||||
playerStatus->unk_C2 = 0;
|
||||
playerStatus->landPos.x = playerStatus->position.x;
|
||||
playerStatus->landPos.z = playerStatus->position.z;
|
||||
|
||||
if (playerStatus->animFlags & PLAYER_STATUS_ANIM_FLAGS_8BIT_MARIO) {
|
||||
phi_a0 = 0x90002;
|
||||
anim = ANIM_Mario_90002;
|
||||
} else if (!(playerStatus->animFlags & PLAYER_STATUS_ANIM_FLAGS_HOLDING_WATT)) {
|
||||
phi_a0 = 0x10009;
|
||||
anim = ANIM_Mario_10009;
|
||||
} else {
|
||||
phi_a0 = 0x6000B;
|
||||
anim = ANIM_Mario_6000B;
|
||||
}
|
||||
|
||||
suggest_player_anim_clearUnkFlag(phi_a0);
|
||||
suggest_player_anim_clearUnkFlag(anim);
|
||||
sfx_play_sound_at_player(SOUND_8161, 0);
|
||||
sfx_play_sound_at_player(SOUND_SOFT_LAND, 0);
|
||||
|
||||
@ -52,13 +55,13 @@ void func_802B6000_E24920(void) {
|
||||
playerStatus->animFlags &= ~PLAYER_STATUS_ANIM_FLAGS_40000;
|
||||
camera->moveFlags &= ~CAMERA_MOVE_FLAGS_4;
|
||||
}
|
||||
playerStatus->fallState++;
|
||||
playerStatus->actionSubstate++; // SUBSTATE_DONE
|
||||
playerStatus->currentSpeed *= 0.6f;
|
||||
|
||||
player_input_to_move_vector(&inputMoveAngle, &inputMoveMagnitude);
|
||||
jumpInputCheck = check_input_jump();
|
||||
|
||||
if (jumpInputCheck != 0 || jumpInputCheck < playerStatus->fallState) {
|
||||
if (jumpInputCheck != 0 || jumpInputCheck < playerStatus->actionSubstate) {
|
||||
if (inputMoveMagnitude == 0.0f) {
|
||||
set_action_state(ACTION_STATE_IDLE);
|
||||
return;
|
||||
@ -70,14 +73,14 @@ void func_802B6000_E24920(void) {
|
||||
}
|
||||
}
|
||||
|
||||
void func_802B61C0_E24AE0(void) {
|
||||
void action_update_step_down_land(void) {
|
||||
CollisionStatus* collisionStatus = &gCollisionStatus;
|
||||
PlayerStatus* playerStatus = &gPlayerStatus;
|
||||
f32 inputMoveMagnitude;
|
||||
f32 inputMoveAngle;
|
||||
|
||||
if (playerStatus->animFlags & PLAYER_STATUS_ANIM_FLAGS_USING_PEACH_PHYSICS) {
|
||||
func_802B644C_E24D6C();
|
||||
action_update_peach_step_down_land();
|
||||
return;
|
||||
}
|
||||
|
||||
@ -86,11 +89,9 @@ void func_802B61C0_E24AE0(void) {
|
||||
PLAYER_STATUS_FLAGS_ACTION_STATE_CHANGED |
|
||||
PLAYER_STATUS_FLAGS_800000 |
|
||||
PLAYER_STATUS_FLAGS_80000 |
|
||||
PLAYER_STATUS_FLAGS_FLYING |
|
||||
PLAYER_STATUS_FLAGS_FALLING |
|
||||
PLAYER_STATUS_FLAGS_JUMPING
|
||||
PLAYER_STATUS_FLAGS_AIRBORNE
|
||||
);
|
||||
playerStatus->fallState = 0;
|
||||
playerStatus->actionSubstate = SUBSTATE_INIT;
|
||||
playerStatus->timeInAir = 0;
|
||||
playerStatus->unk_C2 = 0;
|
||||
playerStatus->landPos.x = playerStatus->position.x;
|
||||
@ -103,7 +104,7 @@ void func_802B61C0_E24AE0(void) {
|
||||
collisionStatus->lastTouchedFloor = -1;
|
||||
}
|
||||
|
||||
playerStatus->fallState++;
|
||||
playerStatus->actionSubstate++; // SUBSTATE_DONE
|
||||
playerStatus->currentSpeed *= 0.6f;
|
||||
|
||||
player_input_to_move_vector(&inputMoveAngle, &inputMoveMagnitude);
|
||||
@ -116,7 +117,7 @@ void func_802B61C0_E24AE0(void) {
|
||||
update_locomotion_state();
|
||||
}
|
||||
|
||||
void func_802B62CC_E24BEC(void) {
|
||||
void action_update_peach_land(void) {
|
||||
CollisionStatus* collisionStatus = &gCollisionStatus;
|
||||
PlayerStatus* playerStatus = &gPlayerStatus;
|
||||
f32 inputMoveMagnitude;
|
||||
@ -124,10 +125,10 @@ void func_802B62CC_E24BEC(void) {
|
||||
|
||||
if (playerStatus->flags & PLAYER_STATUS_FLAGS_ACTION_STATE_CHANGED) {
|
||||
playerStatus->flags &= ~PLAYER_STATUS_FLAGS_ACTION_STATE_CHANGED;
|
||||
playerStatus->fallState = 0;
|
||||
playerStatus->actionSubstate = SUBSTATE_INIT;
|
||||
playerStatus->timeInAir = 0;
|
||||
playerStatus->unk_C2 = 0;
|
||||
playerStatus->flags &= ~(PLAYER_STATUS_FLAGS_FLYING | PLAYER_STATUS_FLAGS_FALLING | PLAYER_STATUS_FLAGS_JUMPING);
|
||||
playerStatus->flags &= ~PLAYER_STATUS_FLAGS_AIRBORNE;
|
||||
playerStatus->landPos.x = playerStatus->position.x;
|
||||
playerStatus->landPos.z = playerStatus->position.z;
|
||||
|
||||
@ -140,7 +141,7 @@ void func_802B62CC_E24BEC(void) {
|
||||
collisionStatus->lastTouchedFloor = -1;
|
||||
}
|
||||
|
||||
playerStatus->fallState++;
|
||||
playerStatus->actionSubstate++; // SUBSTATE_DONE
|
||||
playerStatus->currentSpeed *= 0.6f;
|
||||
|
||||
player_input_to_move_vector(&inputMoveAngle, &inputMoveMagnitude);
|
||||
@ -160,7 +161,7 @@ void func_802B62CC_E24BEC(void) {
|
||||
}
|
||||
}
|
||||
|
||||
void func_802B644C_E24D6C(void) {
|
||||
void action_update_peach_step_down_land(void) {
|
||||
CollisionStatus* collisionStatus = &gCollisionStatus;
|
||||
PlayerStatus* playerStatus = &gPlayerStatus;
|
||||
f32 inputMoveMagnitude;
|
||||
@ -168,10 +169,10 @@ void func_802B644C_E24D6C(void) {
|
||||
|
||||
if (playerStatus->flags & PLAYER_STATUS_FLAGS_ACTION_STATE_CHANGED) {
|
||||
playerStatus->flags &= ~PLAYER_STATUS_FLAGS_ACTION_STATE_CHANGED;
|
||||
playerStatus->fallState = 0;
|
||||
playerStatus->actionSubstate = SUBSTATE_INIT;
|
||||
playerStatus->timeInAir = 0;
|
||||
playerStatus->unk_C2 = 0;
|
||||
playerStatus->flags &= ~(PLAYER_STATUS_FLAGS_FLYING | PLAYER_STATUS_FLAGS_FALLING | PLAYER_STATUS_FLAGS_JUMPING);
|
||||
playerStatus->flags &= ~PLAYER_STATUS_FLAGS_AIRBORNE;
|
||||
playerStatus->landPos.x = playerStatus->position.x;
|
||||
playerStatus->landPos.z = playerStatus->position.z;
|
||||
|
||||
@ -181,7 +182,7 @@ void func_802B644C_E24D6C(void) {
|
||||
collisionStatus->lastTouchedFloor = -1;
|
||||
}
|
||||
|
||||
playerStatus->fallState++;
|
||||
playerStatus->actionSubstate++; // SUBSTATE_DONE
|
||||
playerStatus->currentSpeed *= 0.6f;
|
||||
player_input_to_move_vector(&inputMoveAngle, &inputMoveMagnitude);
|
||||
|
||||
|
@ -2,17 +2,16 @@
|
||||
#include "world/actions.h"
|
||||
#include "world/partner/goombario.h"
|
||||
|
||||
s32 func_802B6000_E28A30(void) {
|
||||
s32 action_update_ride(void) {
|
||||
PartnerActionStatus* partnerActionStatus = &gPartnerActionStatus;
|
||||
PlayerStatus* playerStatus = &gPlayerStatus;
|
||||
s32 oldFlags = playerStatus->flags;
|
||||
|
||||
if (playerStatus->flags & PLAYER_STATUS_FLAGS_ACTION_STATE_CHANGED) {
|
||||
playerStatus->flags &= ~(
|
||||
PLAYER_STATUS_FLAGS_ACTION_STATE_CHANGED | PLAYER_STATUS_FLAGS_80000 | PLAYER_STATUS_FLAGS_FLYING |
|
||||
PLAYER_STATUS_FLAGS_FALLING | PLAYER_STATUS_FLAGS_JUMPING
|
||||
PLAYER_STATUS_FLAGS_ACTION_STATE_CHANGED | PLAYER_STATUS_FLAGS_80000 | PLAYER_STATUS_FLAGS_AIRBORNE
|
||||
);
|
||||
playerStatus->fallState = 0;
|
||||
playerStatus->actionSubstate = 0;
|
||||
playerStatus->currentStateTime = 0;
|
||||
playerStatus->timeInAir = 0;
|
||||
playerStatus->unk_C2 = 0;
|
||||
@ -36,7 +35,7 @@ s32 func_802B6000_E28A30(void) {
|
||||
|
||||
extern f32 D_802B6770_E27C80;
|
||||
|
||||
void func_802B609C_E28ACC(void) {
|
||||
void action_update_state_23(void) {
|
||||
PlayerStatus* playerStatus = &gPlayerStatus;
|
||||
f32 hitDirZ;
|
||||
f32 hitDirX;
|
||||
@ -55,11 +54,9 @@ void func_802B609C_E28ACC(void) {
|
||||
f32 playerOffsetTempVar;
|
||||
|
||||
if (playerStatus->flags & PLAYER_STATUS_FLAGS_ACTION_STATE_CHANGED) {
|
||||
playerStatus->flags &= ~(
|
||||
PLAYER_STATUS_FLAGS_ACTION_STATE_CHANGED | PLAYER_STATUS_FLAGS_80000 | PLAYER_STATUS_FLAGS_FLYING |
|
||||
PLAYER_STATUS_FLAGS_FALLING | PLAYER_STATUS_FLAGS_JUMPING
|
||||
);
|
||||
playerStatus->fallState = 0;
|
||||
playerStatus->flags &= ~(PLAYER_STATUS_FLAGS_ACTION_STATE_CHANGED
|
||||
| PLAYER_STATUS_FLAGS_80000 | PLAYER_STATUS_FLAGS_AIRBORNE);
|
||||
playerStatus->actionSubstate = 0;
|
||||
playerStatus->currentStateTime = 0;
|
||||
playerStatus->timeInAir = 0;
|
||||
playerStatus->unk_C2 = 0;
|
||||
@ -68,9 +65,9 @@ void func_802B609C_E28ACC(void) {
|
||||
D_802B6770_E27C80 = D_8010C938;
|
||||
}
|
||||
|
||||
switch (playerStatus->fallState) {
|
||||
switch (playerStatus->actionSubstate) {
|
||||
case 0:
|
||||
playerStatus->fallState++;
|
||||
playerStatus->actionSubstate++;
|
||||
case 1:
|
||||
break;
|
||||
default:
|
||||
@ -125,19 +122,19 @@ void func_802B609C_E28ACC(void) {
|
||||
}
|
||||
}
|
||||
|
||||
void func_802B6350_E28D80(void) {
|
||||
void action_update_launch(void) {
|
||||
PlayerStatus* playerStatus = &gPlayerStatus;
|
||||
|
||||
if (playerStatus->flags & PLAYER_STATUS_FLAGS_ACTION_STATE_CHANGED) {
|
||||
playerStatus->flags &= ~(0x80000000 | 0x80000 | 0x8 | 0x4 | 0x2);
|
||||
playerStatus->fallState = 0;
|
||||
playerStatus->flags &= ~(PLAYER_STATUS_FLAGS_ACTION_STATE_CHANGED | PLAYER_STATUS_FLAGS_80000 | PLAYER_STATUS_FLAGS_AIRBORNE);
|
||||
playerStatus->actionSubstate = 0;
|
||||
playerStatus->currentStateTime = 0;
|
||||
playerStatus->timeInAir = 0;
|
||||
playerStatus->unk_C2 = 0;
|
||||
playerStatus->currentSpeed = 0.0f;
|
||||
playerStatus->pitch = 0.0f;
|
||||
|
||||
if (playerStatus->animFlags & 0x1000) {
|
||||
if (playerStatus->animFlags & PLAYER_STATUS_ANIM_FLAGS_USING_PEACH_PHYSICS) {
|
||||
return;
|
||||
}
|
||||
playerStatus->currentStateTime = 5;
|
||||
@ -149,17 +146,17 @@ void func_802B6350_E28D80(void) {
|
||||
}
|
||||
}
|
||||
|
||||
void func_802B63D4_E28E04(void) {
|
||||
void action_update_first_strike(void) {
|
||||
PlayerStatus* playerStatus = &gPlayerStatus;
|
||||
|
||||
if (playerStatus->flags & PLAYER_STATUS_FLAGS_ACTION_STATE_CHANGED) {
|
||||
playerStatus->flags &= ~(0x80000000 | 0x8 | 0x4 | 0x2);
|
||||
playerStatus->fallState = 0;
|
||||
playerStatus->flags &= ~(PLAYER_STATUS_FLAGS_ACTION_STATE_CHANGED | PLAYER_STATUS_FLAGS_AIRBORNE);
|
||||
playerStatus->actionSubstate = 0;
|
||||
playerStatus->timeInAir = 0;
|
||||
playerStatus->unk_C2 = 0;
|
||||
playerStatus->currentSpeed = 0.0f;
|
||||
playerStatus->pitch = 0.0f;
|
||||
suggest_player_anim_setUnkFlag(0x10017);
|
||||
suggest_player_anim_setUnkFlag(ANIM_Mario_FallBack);
|
||||
playerStatus->currentStateTime = 30;
|
||||
}
|
||||
|
||||
@ -170,48 +167,48 @@ void func_802B63D4_E28E04(void) {
|
||||
}
|
||||
}
|
||||
|
||||
void func_802B6478_E28EA8(void) {
|
||||
void action_update_raise_arms(void) {
|
||||
PlayerStatus* playerStatus = &gPlayerStatus;
|
||||
|
||||
if (playerStatus->flags & PLAYER_STATUS_FLAGS_ACTION_STATE_CHANGED) {
|
||||
playerStatus->flags &= ~0x80000000;
|
||||
playerStatus->flags |= 0x80000;
|
||||
playerStatus->flags &= ~PLAYER_STATUS_FLAGS_ACTION_STATE_CHANGED;
|
||||
playerStatus->flags |= PLAYER_STATUS_FLAGS_80000;
|
||||
playerStatus->currentStateTime = 0;
|
||||
playerStatus->fallState = 0;
|
||||
playerStatus->actionSubstate = 0;
|
||||
playerStatus->currentSpeed = 0.0f;
|
||||
playerStatus->pitch = 0.0f;
|
||||
suggest_player_anim_setUnkFlag(0x1001F);
|
||||
suggest_player_anim_setUnkFlag(ANIM_Mario_GotItem);
|
||||
}
|
||||
|
||||
if (!(playerStatus->animFlags & 0x200)) {
|
||||
if (!(playerStatus->animFlags & PLAYER_STATUS_ANIM_FLAGS_RAISED_ARMS)) {
|
||||
set_action_state(ACTION_STATE_IDLE);
|
||||
playerStatus->flags &= ~0x80000;
|
||||
playerStatus->flags &= ~PLAYER_STATUS_FLAGS_80000;
|
||||
}
|
||||
}
|
||||
|
||||
void func_802B6508_E28F38(void) {
|
||||
void action_update_pushing_block(void) {
|
||||
PlayerStatus* playerStatus = &gPlayerStatus;
|
||||
|
||||
if (playerStatus->flags & PLAYER_STATUS_FLAGS_ACTION_STATE_CHANGED) {
|
||||
f32 angle;
|
||||
f32 magnitude;
|
||||
|
||||
playerStatus->flags &= ~0x80000000;
|
||||
playerStatus->flags &= ~PLAYER_STATUS_FLAGS_ACTION_STATE_CHANGED;
|
||||
playerStatus->currentSpeed = 0.0f;
|
||||
playerStatus->unk_60 = 0;
|
||||
playerStatus->currentStateTime = 5;
|
||||
player_input_to_move_vector(&angle, &magnitude);
|
||||
|
||||
if (((angle >= 45.0f) && (angle <= 135.0f)) || ((angle >= 225.0f) && (angle <= 315.0f))) {
|
||||
suggest_player_anim_setUnkFlag(0x80000 | 0x20);
|
||||
suggest_player_anim_setUnkFlag(ANIM_Mario_80020);
|
||||
} else {
|
||||
suggest_player_anim_clearUnkFlag(0x60000 | 0x4);
|
||||
suggest_player_anim_clearUnkFlag(ANIM_Mario_60004);
|
||||
}
|
||||
}
|
||||
|
||||
check_input_jump();
|
||||
|
||||
if (playerStatus->animFlags & 0x800000) {
|
||||
if (playerStatus->animFlags & PLAYER_STATUS_ANIM_FLAGS_800000) {
|
||||
if (playerStatus->currentStateTime != 0) {
|
||||
playerStatus->currentStateTime--;
|
||||
if (playerStatus->currentStateTime == 0) {
|
||||
@ -221,7 +218,7 @@ void func_802B6508_E28F38(void) {
|
||||
}
|
||||
}
|
||||
|
||||
void func_802B6638_E29068(void) {
|
||||
void action_update_talk(void) {
|
||||
PlayerStatus* playerStatus = &gPlayerStatus;
|
||||
|
||||
if (playerStatus->flags & PLAYER_STATUS_FLAGS_ACTION_STATE_CHANGED) {
|
||||
@ -229,11 +226,11 @@ void func_802B6638_E29068(void) {
|
||||
playerStatus->currentSpeed = 0.0f;
|
||||
playerStatus->unk_60 = 0;
|
||||
|
||||
if (!(playerStatus->animFlags & 0x1000)) {
|
||||
suggest_player_anim_setUnkFlag(0x80007);
|
||||
} else if (playerStatus->unk_C4 == 0) {
|
||||
if (!(playerStatus->animFlags & 0x2000)) {
|
||||
suggest_player_anim_setUnkFlag(0xC0000);
|
||||
if (!(playerStatus->animFlags & PLAYER_STATUS_ANIM_FLAGS_USING_PEACH_PHYSICS)) {
|
||||
suggest_player_anim_setUnkFlag(ANIM_Mario_80007);
|
||||
} else if (playerStatus->peachItemHeld == 0) {
|
||||
if (!(playerStatus->animFlags & PLAYER_STATUS_ANIM_FLAGS_IN_DISGUISE)) {
|
||||
suggest_player_anim_setUnkFlag(ANIM_Peach_C0000);
|
||||
} else {
|
||||
peach_set_disguise_anim(BasicPeachDisguiseAnims[playerStatus->peachDisguise].talk);
|
||||
}
|
||||
@ -241,12 +238,12 @@ void func_802B6638_E29068(void) {
|
||||
playerStatus->currentStateTime = 30;
|
||||
}
|
||||
|
||||
if (playerStatus->animFlags & 0x1000) {
|
||||
if (playerStatus->animFlags & PLAYER_STATUS_ANIM_FLAGS_USING_PEACH_PHYSICS) {
|
||||
if (playerStatus->currentStateTime != 0) {
|
||||
playerStatus->currentStateTime--;
|
||||
} else if (playerStatus->unk_C4 == 0) {
|
||||
if (!(playerStatus->animFlags & 0x2000)) {
|
||||
suggest_player_anim_setUnkFlag(0xA0001);
|
||||
} else if (playerStatus->peachItemHeld == 0) {
|
||||
if (!(playerStatus->animFlags & PLAYER_STATUS_ANIM_FLAGS_IN_DISGUISE)) {
|
||||
suggest_player_anim_setUnkFlag(ANIM_Peach_A0001);
|
||||
} else {
|
||||
peach_set_disguise_anim(BasicPeachDisguiseAnims[playerStatus->peachDisguise].idle);
|
||||
}
|
@ -1,77 +1,82 @@
|
||||
#include "common.h"
|
||||
|
||||
extern f32 D_802B6780;
|
||||
extern f32 D_802B6784;
|
||||
extern f32 D_802B6788;
|
||||
extern f32 D_802B678C;
|
||||
extern f32 D_802B6790;
|
||||
extern f32 D_802B6794;
|
||||
extern f32 D_802B6798;
|
||||
extern s32 D_802B679C;
|
||||
static f32 SlideAcceleration;
|
||||
static f32 MaxSlideAccel;
|
||||
static f32 MaxSlideVelocity;
|
||||
static f32 SlideLaunchSpeed;
|
||||
static f32 D_802B6790;
|
||||
static f32 D_802B6794;
|
||||
static f32 D_802B6798;
|
||||
static s32 D_802B679C;
|
||||
|
||||
enum {
|
||||
SUBSTATE_SLIDING = 0,
|
||||
SUBSTATE_STOP = 1,
|
||||
SUBSTATE_LAUNCH = 2,
|
||||
SUBSTATE_FALL = 3,
|
||||
SUBSTATE_CRASH = 4,
|
||||
SUBSTATE_GET_UP = 5,
|
||||
SUBSTATE_DUST_OFF = 6,
|
||||
SUBSTATE_DONE = 7,
|
||||
};
|
||||
|
||||
void func_802B6000_E27510(void) {
|
||||
PlayerStatus* playerStatus = &gPlayerStatus;
|
||||
f32* temp_v0 = playerStatus->unk_D0;
|
||||
SlideParams* slide = playerStatus->slideParams;
|
||||
|
||||
playerStatus->gravityIntegrator[0] = temp_v0[4];
|
||||
playerStatus->gravityIntegrator[1] = temp_v0[5];
|
||||
playerStatus->gravityIntegrator[2] = temp_v0[6];
|
||||
playerStatus->gravityIntegrator[3] = temp_v0[7];
|
||||
playerStatus->heading = *temp_v0;
|
||||
D_802B6784 = temp_v0[1];
|
||||
D_802B678C = temp_v0[2];
|
||||
D_802B6788 = temp_v0[3];
|
||||
playerStatus->gravityIntegrator[0] = slide->integrator[0];
|
||||
playerStatus->gravityIntegrator[1] = slide->integrator[1];
|
||||
playerStatus->gravityIntegrator[2] = slide->integrator[2];
|
||||
playerStatus->gravityIntegrator[3] = slide->integrator[3];
|
||||
playerStatus->heading = slide->heading;
|
||||
MaxSlideAccel = slide->maxDescendAccel;
|
||||
SlideLaunchSpeed = slide->launchVelocity;
|
||||
MaxSlideVelocity = slide->maxDescendVelocity;
|
||||
}
|
||||
|
||||
void func_802B6060_E27570(void) {
|
||||
void action_update_sliding(void) {
|
||||
PlayerStatus* playerStatus = &gPlayerStatus;
|
||||
CollisionStatus* collisionStatus;
|
||||
f32 cosA;
|
||||
f32 sinA;
|
||||
s32 surfaceType;
|
||||
f32 sinA, cosA;
|
||||
f32 speed;
|
||||
f32 posX, posY, posZ, depth;
|
||||
f32 hitRx, hitRy, hitDirX, hitDirZ;
|
||||
s32 hitID;
|
||||
f32 hitDirZ;
|
||||
f32 hitDirX;
|
||||
f32 hitRy;
|
||||
f32 hitRx;
|
||||
f32 depth;
|
||||
f32 posZ;
|
||||
f32 posY;
|
||||
f32 posX;
|
||||
f32 tempCurrentSpeed;
|
||||
|
||||
if (playerStatus->flags & PLAYER_STATUS_FLAGS_ACTION_STATE_CHANGED) {
|
||||
playerStatus->flags &= ~PLAYER_STATUS_FLAGS_ACTION_STATE_CHANGED;
|
||||
playerStatus->fallState = 0;
|
||||
playerStatus->actionSubstate = SUBSTATE_SLIDING;
|
||||
playerStatus->currentSpeed = 0.0f;
|
||||
playerStatus->animFlags |= 4;
|
||||
func_802B6000_E27510();
|
||||
D_802B6780 = 0.0f;
|
||||
SlideAcceleration = 0.0f;
|
||||
D_802B6790 = 0.0f;
|
||||
D_802B6794 = 0.0f;
|
||||
D_802B6798 = 0.0f;
|
||||
D_802B679C = 0;
|
||||
suggest_player_anim_clearUnkFlag(0x1000A);
|
||||
suggest_player_anim_clearUnkFlag(ANIM_Mario_1000A);
|
||||
sfx_play_sound_at_player(SOUND_167, 0);
|
||||
gCameras[CAM_DEFAULT].moveFlags |= CAMERA_MOVE_FLAGS_1;
|
||||
}
|
||||
tempCurrentSpeed = playerStatus->currentSpeed;
|
||||
speed = playerStatus->currentSpeed;
|
||||
posX = playerStatus->position.x;
|
||||
posY = playerStatus->position.y;
|
||||
posZ = playerStatus->position.z;
|
||||
hitID = player_test_move_with_slipping(playerStatus, &posX, &posY, &posZ, tempCurrentSpeed, playerStatus->heading);
|
||||
hitID = player_test_move_with_slipping(playerStatus, &posX, &posY, &posZ, speed, playerStatus->heading);
|
||||
playerStatus->position.x = posX;
|
||||
playerStatus->position.z = posZ;
|
||||
playerStatus->position.y = posY;
|
||||
|
||||
switch (playerStatus->fallState) {
|
||||
case 0:
|
||||
D_802B6780 += 0.1;
|
||||
if (D_802B6784 <= D_802B6780) {
|
||||
D_802B6780 = D_802B6784;
|
||||
switch (playerStatus->actionSubstate) {
|
||||
case SUBSTATE_SLIDING:
|
||||
SlideAcceleration += 0.1;
|
||||
if (MaxSlideAccel <= SlideAcceleration) {
|
||||
SlideAcceleration = MaxSlideAccel;
|
||||
}
|
||||
playerStatus->currentSpeed += D_802B6780;
|
||||
if (D_802B6788 <= playerStatus->currentSpeed) {
|
||||
playerStatus->currentSpeed = D_802B6788;
|
||||
playerStatus->currentSpeed += SlideAcceleration;
|
||||
if (MaxSlideVelocity <= playerStatus->currentSpeed) {
|
||||
playerStatus->currentSpeed = MaxSlideVelocity;
|
||||
}
|
||||
posX = playerStatus->position.x;
|
||||
depth = 100.0f;
|
||||
@ -82,111 +87,109 @@ void func_802B6060_E27570(void) {
|
||||
D_802B6798 = hitRy;
|
||||
if (hitID >= 0) {
|
||||
collisionStatus = &gCollisionStatus;
|
||||
if ((u8)get_collider_type_by_id(hitID) == 5) {
|
||||
surfaceType = get_collider_flags(hitID) & COLLIDER_FLAGS_SURFACE_TYPE_MASK;
|
||||
if (surfaceType == SURFACE_TYPE_SLIDE) {
|
||||
collisionStatus->currentFloor = hitID;
|
||||
playerStatus->position.y = posY;
|
||||
D_802B6790 = hitRy + 180.0f;
|
||||
break;
|
||||
}
|
||||
if (!(fabs(D_802B6794 - D_802B6798) >= 50.0)) {
|
||||
playerStatus->fallState = 1;
|
||||
playerStatus->actionSubstate = SUBSTATE_STOP;
|
||||
} else {
|
||||
playerStatus->fallState = 2;
|
||||
playerStatus->actionSubstate = SUBSTATE_LAUNCH;
|
||||
}
|
||||
} else {
|
||||
playerStatus->fallState = 2;
|
||||
playerStatus->actionSubstate = SUBSTATE_LAUNCH;
|
||||
}
|
||||
sin_cos_rad((D_802B6790 * TAU) / 360.0f, &sinA, &cosA);
|
||||
playerStatus->position.y += fabsf((sinA / cosA) * playerStatus->currentSpeed);
|
||||
snd_stop_sound(SOUND_167);
|
||||
break;
|
||||
case 1:
|
||||
case SUBSTATE_STOP:
|
||||
posX = playerStatus->position.x;
|
||||
depth = 50.0f;
|
||||
posZ = playerStatus->position.z;
|
||||
posY = playerStatus->position.y + (playerStatus->colliderHeight * 0.5f);
|
||||
hitID = player_raycast_below_cam_relative(playerStatus, &posX, &posY, &posZ, &depth, &hitRx, &hitRy, &hitDirX, &hitDirZ);
|
||||
if (hitID >= 0) {
|
||||
tempCurrentSpeed = playerStatus->currentSpeed / 3.0f;
|
||||
if (tempCurrentSpeed < 0.01) {
|
||||
speed = playerStatus->currentSpeed / 3.0f;
|
||||
if (speed < 0.01) {
|
||||
playerStatus->currentSpeed = 0.0f;
|
||||
}
|
||||
playerStatus->currentSpeed -= tempCurrentSpeed;
|
||||
playerStatus->currentSpeed -= speed;
|
||||
if (playerStatus->currentSpeed <= 0.0f) {
|
||||
sfx_play_sound_at_player(SOUND_172, 0);
|
||||
suggest_player_anim_setUnkFlag(0x10031);
|
||||
playerStatus->fallState = 6;
|
||||
sfx_play_sound_at_player(SOUND_DUST_OFF, 0);
|
||||
suggest_player_anim_setUnkFlag(ANIM_Mario_DustOff);
|
||||
playerStatus->actionSubstate = SUBSTATE_DUST_OFF;
|
||||
playerStatus->currentStateTime = 15;
|
||||
playerStatus->currentSpeed = 0.0f;
|
||||
playerStatus->position.y = posY;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case 2:
|
||||
playerStatus->currentSpeed += D_802B678C;
|
||||
case SUBSTATE_LAUNCH:
|
||||
playerStatus->currentSpeed += SlideLaunchSpeed;
|
||||
if (playerStatus->currentSpeed <= 0.0f) {
|
||||
playerStatus->currentSpeed = 0.0f;
|
||||
}
|
||||
playerStatus->gravityIntegrator[0] += playerStatus->gravityIntegrator[1];
|
||||
playerStatus->position.y += playerStatus->gravityIntegrator[0];
|
||||
if (playerStatus->gravityIntegrator[0] <= 0.0f) {
|
||||
playerStatus->fallState = 3;
|
||||
playerStatus->gravityIntegrator[0] = 0.1143f;
|
||||
playerStatus->gravityIntegrator[1] = -0.2871f;
|
||||
playerStatus->gravityIntegrator[2] = -0.1823f;
|
||||
playerStatus->gravityIntegrator[3] = 0.01152f;
|
||||
playerStatus->actionSubstate = SUBSTATE_FALL;
|
||||
LOAD_INTEGRATOR_FALL(playerStatus->gravityIntegrator);
|
||||
}
|
||||
break;
|
||||
case 3:
|
||||
playerStatus->currentSpeed += D_802B678C;
|
||||
case SUBSTATE_FALL:
|
||||
playerStatus->currentSpeed += SlideLaunchSpeed;
|
||||
if (playerStatus->currentSpeed <= 0.0f) {
|
||||
playerStatus->currentSpeed = 0.0f;
|
||||
}
|
||||
playerStatus->position.y = player_check_collision_below(func_800E34D8(), &hitID);
|
||||
if (hitID >= 0) {
|
||||
D_802B678C = -1;
|
||||
suggest_player_anim_setUnkFlag(0x80003);
|
||||
SlideLaunchSpeed = -1;
|
||||
suggest_player_anim_setUnkFlag(ANIM_Mario_80003);
|
||||
sfx_play_sound_at_player(SOUND_162, 0);
|
||||
playerStatus->fallState++;
|
||||
playerStatus->actionSubstate++; // SUBSTATE_CRASH
|
||||
}
|
||||
break;
|
||||
case 4:
|
||||
playerStatus->currentSpeed += D_802B678C;
|
||||
case SUBSTATE_CRASH:
|
||||
playerStatus->currentSpeed += SlideLaunchSpeed;
|
||||
if (playerStatus->currentSpeed <= 0.0f) {
|
||||
playerStatus->currentSpeed = 0.0f;
|
||||
}
|
||||
if (playerStatus->unk_BC != 0) {
|
||||
suggest_player_anim_setUnkFlag(0x10030);
|
||||
playerStatus->fallState++;
|
||||
suggest_player_anim_setUnkFlag(ANIM_Mario_GetUp);
|
||||
playerStatus->actionSubstate++; // SUBSTATE_GET_UP
|
||||
}
|
||||
break;
|
||||
case 5:
|
||||
playerStatus->currentSpeed += D_802B678C;
|
||||
case SUBSTATE_GET_UP:
|
||||
playerStatus->currentSpeed += SlideLaunchSpeed;
|
||||
if (playerStatus->currentSpeed <= 0.0f) {
|
||||
playerStatus->currentSpeed = 0.0f;
|
||||
}
|
||||
if (playerStatus->unk_BC != 0) {
|
||||
suggest_player_anim_setUnkFlag(0x10031);
|
||||
sfx_play_sound_at_player(SOUND_172, 0);
|
||||
suggest_player_anim_setUnkFlag(ANIM_Mario_DustOff);
|
||||
sfx_play_sound_at_player(SOUND_DUST_OFF, 0);
|
||||
playerStatus->currentStateTime = 15;
|
||||
playerStatus->fallState++;
|
||||
playerStatus->actionSubstate++; // SUBSTATE_DUST_OFF
|
||||
}
|
||||
break;
|
||||
case 6:
|
||||
playerStatus->currentSpeed += D_802B678C;
|
||||
case SUBSTATE_DUST_OFF:
|
||||
playerStatus->currentSpeed += SlideLaunchSpeed;
|
||||
if (playerStatus->currentSpeed <= 0.0f) {
|
||||
playerStatus->currentSpeed = 0.0f;
|
||||
}
|
||||
if (--playerStatus->currentStateTime == 0) {
|
||||
playerStatus->fallState++;
|
||||
playerStatus->actionSubstate++; // SUBSTATE_DONE
|
||||
}
|
||||
break;
|
||||
case 7:
|
||||
tempCurrentSpeed = playerStatus->currentSpeed / 3.0f;
|
||||
if (tempCurrentSpeed < 0.01) {
|
||||
case SUBSTATE_DONE:
|
||||
speed = playerStatus->currentSpeed / 3.0f;
|
||||
if (speed < 0.01) {
|
||||
playerStatus->currentSpeed = 0.0f;
|
||||
}
|
||||
playerStatus->currentSpeed -= tempCurrentSpeed;
|
||||
playerStatus->currentSpeed -= speed;
|
||||
if (playerStatus->currentSpeed <= 0.0f) {
|
||||
playerStatus->currentSpeed = 0.0f;
|
||||
set_action_state(ACTION_STATE_IDLE);
|
||||
|
@ -40,7 +40,7 @@ Npc* func_802B6000_E2A6B0(void) {
|
||||
} while (0);
|
||||
}
|
||||
|
||||
void func_802B6120_E2A7D0(void) {
|
||||
void action_update_parasol(void) {
|
||||
PlayerStatus* playerStatus = &gPlayerStatus;
|
||||
SneakyParasolUnk* parasolStruct = &D_802B6E80;
|
||||
Camera* cam = &gCameras[gCurrentCameraID];
|
||||
@ -78,13 +78,13 @@ void func_802B6120_E2A7D0(void) {
|
||||
phi_f4 = 2;
|
||||
}
|
||||
*tempUnk_1C = phi_f4;
|
||||
if (!(playerStatus->animFlags & 0x2000)) {
|
||||
if (!(playerStatus->animFlags & PLAYER_STATUS_ANIM_FLAGS_IN_DISGUISE)) {
|
||||
playerStatus->currentStateTime = 20;
|
||||
playerStatus->fallState = 0;
|
||||
playerStatus->actionSubstate = 0;
|
||||
parasolStruct->unk_08 = 0xF;
|
||||
parasolStruct->npc = func_802B6000_E2A6B0();
|
||||
} else {
|
||||
playerStatus->fallState = 0x14;
|
||||
playerStatus->actionSubstate = 0x14;
|
||||
playerStatus->currentStateTime = 40;
|
||||
parasolStruct->unk_04 = 1;
|
||||
parasolStruct->unk_0C = 0xC;
|
||||
@ -95,26 +95,26 @@ void func_802B6120_E2A7D0(void) {
|
||||
}
|
||||
}
|
||||
|
||||
switch (playerStatus->fallState) {
|
||||
switch (playerStatus->actionSubstate) {
|
||||
case 0:
|
||||
if (playerStatus->unk_90[CAM_DEFAULT] == 0) {
|
||||
if (playerStatus->flipYaw[CAM_DEFAULT] == 0) {
|
||||
if (peach_disguise_check_overlaps() < 0) {
|
||||
suggest_player_anim_clearUnkFlag(0xC0024);
|
||||
suggest_player_anim_clearUnkFlag(ANIM_Peach_C0024);
|
||||
sfx_play_sound_at_player(SOUND_92, 0);
|
||||
playerStatus->fallState++;
|
||||
playerStatus->actionSubstate++;
|
||||
} else {
|
||||
suggest_player_anim_clearUnkFlag(0xC0027);
|
||||
playerStatus->fallState = 0x32;
|
||||
suggest_player_anim_clearUnkFlag(ANIM_Peach_C0027);
|
||||
playerStatus->actionSubstate = 0x32;
|
||||
playerStatus->currentStateTime = 10;
|
||||
parasolStruct->unk_08 = 0;
|
||||
}
|
||||
}
|
||||
case 1:
|
||||
if (--playerStatus->currentStateTime == 0) {
|
||||
suggest_player_anim_clearUnkFlag(0xC0025);
|
||||
playerStatus->fallState = 2;
|
||||
suggest_player_anim_clearUnkFlag(ANIM_Peach_C0025);
|
||||
playerStatus->actionSubstate = 2;
|
||||
if (parasolStruct->npc == NULL) {
|
||||
playerStatus->fallState = 0x28;
|
||||
playerStatus->actionSubstate = 0x28;
|
||||
} else {
|
||||
set_time_freeze_mode(TIME_FREEZE_FULL);
|
||||
}
|
||||
@ -124,7 +124,7 @@ void func_802B6120_E2A7D0(void) {
|
||||
if (playerStatus->unk_BC != 0) {
|
||||
playerStatus->currentStateTime = 12;
|
||||
playerStatus->flags |= 0x100000;
|
||||
playerStatus->fallState++;
|
||||
playerStatus->actionSubstate++;
|
||||
sfx_play_sound_at_player(SOUND_FD, 0);
|
||||
}
|
||||
break;
|
||||
@ -132,7 +132,7 @@ void func_802B6120_E2A7D0(void) {
|
||||
if (--playerStatus->currentStateTime == 0) {
|
||||
playerStatus->currentStateTime = 10;
|
||||
parasolStruct->unk_0C = 0xA;
|
||||
playerStatus->fallState++;
|
||||
playerStatus->actionSubstate++;
|
||||
}
|
||||
func_802B6CF0_E2B3A0();
|
||||
break;
|
||||
@ -151,10 +151,10 @@ void func_802B6120_E2A7D0(void) {
|
||||
phi_v0 = 1;
|
||||
}
|
||||
if (phi_v0 != 0) {
|
||||
playerStatus->fallState = 6;
|
||||
playerStatus->actionSubstate = 6;
|
||||
playerStatus->currentStateTime = 2;
|
||||
if (peach_make_disguise_npc(playerStatus->unk_0D) != 0) {
|
||||
playerStatus->fallState = 5;
|
||||
playerStatus->actionSubstate = 5;
|
||||
peach_sync_disguise_npc();
|
||||
}
|
||||
}
|
||||
@ -166,10 +166,10 @@ void func_802B6120_E2A7D0(void) {
|
||||
gameStatus = gGameStatusPtr;
|
||||
playerStatus->animFlags |= 0x2000;
|
||||
gameStatus->peachFlags |= 2;
|
||||
playerStatus->fallState++;
|
||||
playerStatus->actionSubstate++;
|
||||
case 6:
|
||||
if (--playerStatus->currentStateTime == 0) {
|
||||
playerStatus->fallState++;
|
||||
playerStatus->actionSubstate++;
|
||||
}
|
||||
func_802B6CF0_E2B3A0();
|
||||
break;
|
||||
@ -179,7 +179,7 @@ void func_802B6120_E2A7D0(void) {
|
||||
if (parasolStruct->unk_20 <= 0) {
|
||||
parasolStruct->unk_20 = 0;
|
||||
playerStatus->currentStateTime = 10;
|
||||
playerStatus->fallState++;
|
||||
playerStatus->actionSubstate++;
|
||||
playerStatus->spriteFacingAngle = 180;
|
||||
temp_v0 = get_npc_by_index(D_8010C96C);
|
||||
temp_v0->isFacingAway = 1;
|
||||
@ -194,7 +194,7 @@ void func_802B6120_E2A7D0(void) {
|
||||
parasolStruct->unk_20 = 0;
|
||||
playerStatus->currentStateTime = 10;
|
||||
playerStatus->spriteFacingAngle = 0;
|
||||
playerStatus->fallState++;
|
||||
playerStatus->actionSubstate++;
|
||||
temp_v0 = get_npc_by_index(D_8010C96C);
|
||||
temp_v0->isFacingAway = 0;
|
||||
temp_f0_3 = clamp_angle((cam->currentYaw - playerStatus->spriteFacingAngle) - 90);
|
||||
@ -221,7 +221,7 @@ void func_802B6120_E2A7D0(void) {
|
||||
break;
|
||||
case 20:
|
||||
if (--playerStatus->currentStateTime == 0) {
|
||||
playerStatus->fallState++;
|
||||
playerStatus->actionSubstate++;
|
||||
}
|
||||
func_802B6CF0_E2B3A0();
|
||||
playerStatus->targetYaw = clamp_angle(cam->currentYaw - playerStatus->spriteFacingAngle - 90);
|
||||
@ -242,7 +242,7 @@ void func_802B6120_E2A7D0(void) {
|
||||
}
|
||||
if (phi_v0_2 != 0) {
|
||||
playerStatus->currentStateTime = 2;
|
||||
playerStatus->fallState++;
|
||||
playerStatus->actionSubstate++;
|
||||
gameStatus2 = gGameStatusPtr;
|
||||
playerStatus->animFlags &= -0x2001;
|
||||
gameStatus2->peachFlags &= 0xFD;
|
||||
@ -257,7 +257,7 @@ void func_802B6120_E2A7D0(void) {
|
||||
break;
|
||||
case 22:
|
||||
if (--playerStatus->currentStateTime == 0) {
|
||||
playerStatus->fallState++;
|
||||
playerStatus->actionSubstate++;
|
||||
}
|
||||
func_802B6CF0_E2B3A0();
|
||||
break;
|
||||
@ -267,12 +267,12 @@ void func_802B6120_E2A7D0(void) {
|
||||
if (parasolStruct->unk_20 <= 0) {
|
||||
parasolStruct->unk_20 = 0;
|
||||
playerStatus->currentStateTime = 10;
|
||||
playerStatus->fallState++;
|
||||
playerStatus->actionSubstate++;
|
||||
playerStatus->spriteFacingAngle = 180;
|
||||
D_8010C95C = 1;
|
||||
PrevPlayerDirection = 1;
|
||||
phi_f12 = (cam->currentYaw - 180) - 90;
|
||||
temp_f0_3 = clamp_angle((cam->currentYaw - 180) - 90);
|
||||
D_800F7B40 = temp_f0_3;
|
||||
PrevPlayerCamRelativeYaw = temp_f0_3;
|
||||
playerStatus->currentYaw = temp_f0_3;
|
||||
}
|
||||
} else {
|
||||
@ -281,11 +281,11 @@ void func_802B6120_E2A7D0(void) {
|
||||
parasolStruct->unk_20 = 0;
|
||||
playerStatus->currentStateTime = 10;
|
||||
playerStatus->spriteFacingAngle = 0;
|
||||
playerStatus->fallState++;
|
||||
D_8010C95C = 0;
|
||||
playerStatus->actionSubstate++;
|
||||
PrevPlayerDirection = 0;
|
||||
phi_f12 = (cam->currentYaw - 0) - 90;
|
||||
temp_f0_3 = clamp_angle(phi_f12);
|
||||
D_800F7B40 = temp_f0_3;
|
||||
PrevPlayerCamRelativeYaw = temp_f0_3;
|
||||
playerStatus->currentYaw = temp_f0_3;
|
||||
}
|
||||
}
|
||||
|
@ -6,25 +6,43 @@ extern s32 gSpinHistoryPosY[5];
|
||||
extern s32 gSpinHistoryPosX[5];
|
||||
extern s32 gSpinHistoryPosZ[5];
|
||||
extern s16 gSpinHistoryPosAngle[5];
|
||||
|
||||
void phys_clear_spin_history(void);
|
||||
|
||||
void func_802B6000_E25D60(void) {
|
||||
enum {
|
||||
SUBSTATE_SPIN_0 = 0,
|
||||
SUBSTATE_SPIN_1 = 1,
|
||||
SUBSTATE_SPIN_2 = 2,
|
||||
SUBSTATE_SPIN_3 = 3,
|
||||
};
|
||||
|
||||
enum SpinTypeFlag {
|
||||
SPIN_TYPE_DEFAULT = 0,
|
||||
SPIN_TYPE_SPEEDY = 1,
|
||||
SPIN_TYPE_DIZZY = 2,
|
||||
SPIN_TYPE_ATTACK = 4,
|
||||
};
|
||||
|
||||
void action_update_spin(void) {
|
||||
PlayerSpinState* playerSpinState = &gPlayerSpinState;
|
||||
PlayerStatus* playerStatus = &gPlayerStatus;
|
||||
f32 sp10, sp14, temp_f24;
|
||||
s32 phi_s2, phi_s3, phi_s4;
|
||||
s32 temp_v1_2;
|
||||
s32 phi_s5 = 0;
|
||||
f32 angle, magnitude, speedModifier;
|
||||
|
||||
s32 spinFlags, nonDizzyFlags;
|
||||
s32 effectType;
|
||||
AnimID anim;
|
||||
s32 firstCall = FALSE;
|
||||
|
||||
// initialization
|
||||
if (playerStatus->flags & PLAYER_STATUS_FLAGS_ACTION_STATE_CHANGED) {
|
||||
playerStatus->flags &= ~(PLAYER_STATUS_FLAGS_ACTION_STATE_CHANGED | PLAYER_STATUS_FLAGS_80000);
|
||||
playerStatus->animFlags &= ~PLAYER_STATUS_ANIM_FLAGS_40000;
|
||||
playerStatus->animFlags |= PLAYER_STATUS_ANIM_FLAGS_SPINNING;
|
||||
playerStatus->flags |= PLAYER_STATUS_FLAGS_20000;
|
||||
playerStatus->currentStateTime = 0;
|
||||
playerStatus->fallState = 0;
|
||||
playerStatus->actionSubstate = SUBSTATE_SPIN_0;
|
||||
playerSpinState->stopSoundTimer = 0;
|
||||
playerSpinState->hasBufferedSpin = 0;
|
||||
playerSpinState->hasBufferedSpin = FALSE;
|
||||
playerSpinState->spinDirectionMagnitude = 0.0f;
|
||||
playerSpinState->spinDirection.x = 0.0f;
|
||||
playerSpinState->spinDirection.y = 0.0f;
|
||||
@ -32,127 +50,128 @@ void func_802B6000_E25D60(void) {
|
||||
playerSpinState->bufferedStickAxis.x = 0;
|
||||
playerSpinState->bufferedStickAxis.y = 0;
|
||||
playerSpinState->spinSoundID = 0;
|
||||
playerStatus->unk_D8 = NULL;
|
||||
playerStatus->specialDecorationEffect = NULL;
|
||||
playerSpinState->initialSpinTime = 25;
|
||||
playerSpinState->fullSpeedSpinTime = 15;
|
||||
playerSpinState->spinRate = 40.0f;
|
||||
playerSpinState->speedScale = 2.0f;
|
||||
playerSpinState->frictionScale = 0.5f;
|
||||
playerSpinState->spinCountdown = playerSpinState->initialSpinTime; //was unk2D access?
|
||||
phi_s5 = 1;
|
||||
playerSpinState->spinCountdown = playerSpinState->initialSpinTime;
|
||||
spinFlags = SPIN_TYPE_DEFAULT;
|
||||
firstCall = TRUE;
|
||||
|
||||
if (is_ability_active(ABILITY_SPIN_ATTACK)) {
|
||||
phi_s2 = 1 << 2;
|
||||
} else {
|
||||
phi_s2 = 0;
|
||||
spinFlags |= SPIN_TYPE_ATTACK;
|
||||
}
|
||||
|
||||
if (is_ability_active(ABILITY_DIZZY_ATTACK)) {
|
||||
phi_s2 = phi_s2 | 2;
|
||||
spinFlags |= SPIN_TYPE_DIZZY;
|
||||
}
|
||||
|
||||
if (is_ability_active(ABILITY_SPEEDY_SPIN)) {
|
||||
playerSpinState->initialSpinTime = 30;
|
||||
playerSpinState->spinRate = 40.0f;
|
||||
playerSpinState->fullSpeedSpinTime = 20;
|
||||
playerSpinState->spinCountdown = playerSpinState->initialSpinTime; //was unk2D access?
|
||||
playerSpinState->spinCountdown = playerSpinState->initialSpinTime;
|
||||
playerSpinState->speedScale = 2.7f;
|
||||
playerSpinState->frictionScale = 0.9f;
|
||||
phi_s2 |= 1;
|
||||
spinFlags |= SPIN_TYPE_SPEEDY;
|
||||
}
|
||||
|
||||
phi_s4 = -1;
|
||||
phi_s3 = 0x10010;
|
||||
effectType = -1;
|
||||
anim = ANIM_Mario_10010;
|
||||
|
||||
if (phi_s2) {
|
||||
if (phi_s2 & 4) {
|
||||
phi_s4 = 2;
|
||||
phi_s3 = 0x10012;
|
||||
} else if (phi_s2 & 2) {
|
||||
phi_s4 = 4;
|
||||
} else if (phi_s2 & 1) {
|
||||
phi_s4 = 0;
|
||||
phi_s3 = 0x10011;
|
||||
if (spinFlags) {
|
||||
if (spinFlags & SPIN_TYPE_ATTACK) {
|
||||
effectType = 2;
|
||||
anim = ANIM_Mario_Flailing;
|
||||
} else if (spinFlags & SPIN_TYPE_DIZZY) {
|
||||
effectType = 4;
|
||||
anim = ANIM_Mario_10010;
|
||||
} else if (spinFlags & SPIN_TYPE_SPEEDY) {
|
||||
effectType = 0;
|
||||
anim = ANIM_Mario_Spinning;
|
||||
}
|
||||
}
|
||||
|
||||
playerSpinState->spinSoundID = SOUND_2111;
|
||||
temp_v1_2 = phi_s2 & ~2;
|
||||
nonDizzyFlags = spinFlags & ~SPIN_TYPE_DIZZY;
|
||||
|
||||
if (temp_v1_2 == 4) {
|
||||
if (nonDizzyFlags == SPIN_TYPE_ATTACK) {
|
||||
playerSpinState->spinSoundID = SOUND_2113;
|
||||
}
|
||||
if (temp_v1_2 == 1) {
|
||||
if (nonDizzyFlags == SPIN_TYPE_SPEEDY) {
|
||||
playerSpinState->spinSoundID = SOUND_2112;
|
||||
}
|
||||
if (temp_v1_2 == 5) {
|
||||
if (nonDizzyFlags == (SPIN_TYPE_ATTACK | SPIN_TYPE_SPEEDY)) {
|
||||
playerSpinState->spinSoundID = SOUND_2114;
|
||||
}
|
||||
|
||||
sfx_play_sound_at_player(playerSpinState->spinSoundID, 0);
|
||||
suggest_player_anim_setUnkFlag(phi_s3);
|
||||
suggest_player_anim_setUnkFlag(anim);
|
||||
|
||||
if ((clamp_angle(playerStatus->targetYaw - gCameras[gCurrentCameraID].currentYaw) <= 180.0f)) {
|
||||
playerStatus->spinRate = playerSpinState->spinRate;
|
||||
} else {
|
||||
phi_s4++;
|
||||
effectType++;
|
||||
playerStatus->spinRate = -playerSpinState->spinRate;
|
||||
}
|
||||
if (phi_s2 != 0) {
|
||||
playerStatus->unk_D8 = fx_46(phi_s4, playerStatus, 1.0f, 1000);
|
||||
if (spinFlags != 0) {
|
||||
playerStatus->specialDecorationEffect = fx_46(effectType, playerStatus, 1.0f, 1000);
|
||||
}
|
||||
|
||||
phys_clear_spin_history();
|
||||
player_input_to_move_vector(&sp10, &sp14);
|
||||
playerStatus->targetYaw = sp10;
|
||||
playerSpinState->inputMagnitude = sp14;
|
||||
player_input_to_move_vector(&angle, &magnitude);
|
||||
playerStatus->targetYaw = angle;
|
||||
playerSpinState->inputMagnitude = magnitude;
|
||||
}
|
||||
|
||||
// update saved position and rotation values for motion blur effect
|
||||
gSpinHistoryPosAngle[gSpinHistoryBufferPos++] = playerStatus->spriteFacingAngle;
|
||||
|
||||
if (gSpinHistoryBufferPos >= 6) {
|
||||
if (gSpinHistoryBufferPos > ARRAY_COUNT(gSpinHistoryPosX)) {
|
||||
gSpinHistoryBufferPos = 0;
|
||||
}
|
||||
|
||||
gSpinHistoryPosX[gSpinHistoryBufferPos] = playerStatus->position.x;
|
||||
gSpinHistoryPosY[gSpinHistoryBufferPos] = playerStatus->position.y;
|
||||
gSpinHistoryPosZ[gSpinHistoryBufferPos] = playerStatus->position.z;
|
||||
gSpinHistoryPosAngle[gSpinHistoryBufferPos] = playerStatus->spriteFacingAngle;
|
||||
gSpinHistoryBufferPos++;
|
||||
|
||||
if (gSpinHistoryBufferPos >= 6) {
|
||||
if (gSpinHistoryBufferPos > ARRAY_COUNT(gSpinHistoryPosX)) {
|
||||
gSpinHistoryBufferPos = 0;
|
||||
}
|
||||
|
||||
if (phi_s5 == 0 && (check_input_hammer() || check_input_jump())) {
|
||||
// check for spin cancel
|
||||
if (!firstCall && (check_input_hammer() || check_input_jump())) {
|
||||
playerStatus->animFlags &= ~PLAYER_STATUS_ANIM_FLAGS_SPINNING;
|
||||
playerStatus->flags &= ~PLAYER_STATUS_FLAGS_20000;
|
||||
sfx_stop_sound(playerSpinState->spinSoundID);
|
||||
player_input_to_move_vector(&sp10, &sp14);
|
||||
playerStatus->targetYaw = sp10;
|
||||
player_input_to_move_vector(&angle, &magnitude);
|
||||
playerStatus->targetYaw = angle;
|
||||
return;
|
||||
}
|
||||
|
||||
if (playerSpinState->spinCountdown < 11 && playerStatus->pressedButtons & Z_TRIG) {
|
||||
playerSpinState->hasBufferedSpin = 1;
|
||||
// check for buffered next spin
|
||||
if (playerSpinState->spinCountdown < 11 && playerStatus->pressedButtons & BUTTON_Z) {
|
||||
playerSpinState->hasBufferedSpin = TRUE;
|
||||
playerSpinState->prevActionState = playerStatus->prevActionState;
|
||||
playerSpinState->bufferedStickAxis.x = playerStatus->stickAxis[0];
|
||||
playerSpinState->bufferedStickAxis.y = playerStatus->stickAxis[1];
|
||||
}
|
||||
|
||||
if (playerStatus->fallState >= 2) {
|
||||
playerSpinState->spinDirectionMagnitude = playerSpinState->spinDirectionMagnitude - 1.0f;;
|
||||
// check for action finished
|
||||
if (playerStatus->actionSubstate >= SUBSTATE_SPIN_2) {
|
||||
playerSpinState->spinDirectionMagnitude -= 1.0f;
|
||||
if (playerSpinState->spinDirectionMagnitude < 0.0f) {
|
||||
playerSpinState->spinDirectionMagnitude = 0.0f;
|
||||
}
|
||||
|
||||
sp10 = clamp_angle(playerStatus->targetYaw - gCameras[gCurrentCameraID].currentYaw);
|
||||
playerSpinState->spinDirection.x = sin_rad(sp10 * TAU / 360.0f) * playerSpinState->spinDirectionMagnitude;
|
||||
playerSpinState->spinDirection.y = -cos_rad((sp10 * TAU) / 360.0f) * playerSpinState->spinDirectionMagnitude;
|
||||
angle = clamp_angle(playerStatus->targetYaw - gCameras[gCurrentCameraID].currentYaw);
|
||||
playerSpinState->spinDirection.x = sin_rad(angle * TAU / 360.0f) * playerSpinState->spinDirectionMagnitude;
|
||||
playerSpinState->spinDirection.y = -cos_rad((angle * TAU) / 360.0f) * playerSpinState->spinDirectionMagnitude;
|
||||
playerStatus->currentStateTime--;
|
||||
if ((playerStatus->currentStateTime) == 0) {
|
||||
playerSpinState->stopSoundTimer = 4;
|
||||
set_action_state(0);
|
||||
set_action_state(ACTION_STATE_IDLE);
|
||||
playerStatus->flags &= ~PLAYER_STATUS_ANIM_FLAGS_20000;
|
||||
playerStatus->animFlags &= ~PLAYER_STATUS_ANIM_FLAGS_SPINNING;
|
||||
sfx_stop_sound(playerSpinState->spinSoundID);
|
||||
@ -161,36 +180,36 @@ void func_802B6000_E25D60(void) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (playerStatus->fallState == 0) {
|
||||
if (playerStatus->actionSubstate == SUBSTATE_SPIN_0) {
|
||||
if (playerStatus->animFlags & PLAYER_STATUS_ANIM_FLAGS_40000) {
|
||||
playerStatus->fallState = 1;
|
||||
playerStatus->actionSubstate = SUBSTATE_SPIN_1;
|
||||
} else if (gCollisionStatus.pushingAgainstWall >= 0) {
|
||||
playerSpinState->hitWallTime++;
|
||||
if (playerSpinState->hitWallTime >= 10) {
|
||||
playerStatus->fallState = 1;
|
||||
playerStatus->actionSubstate = SUBSTATE_SPIN_1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!(playerStatus->currentStateTime > playerSpinState->fullSpeedSpinTime)) {
|
||||
temp_f24 = (playerSpinState->inputMagnitude) ? playerSpinState->speedScale : 0.0f;
|
||||
speedModifier = (playerSpinState->inputMagnitude) ? playerSpinState->speedScale : 0.0f;
|
||||
playerSpinState->spinDirectionMagnitude = playerSpinState->spinDirectionMagnitude + 0.9;
|
||||
|
||||
if (playerSpinState->spinDirectionMagnitude > 9.0f) {
|
||||
playerSpinState->spinDirectionMagnitude = 9.0f;
|
||||
}
|
||||
|
||||
sp10 = clamp_angle(playerStatus->targetYaw - gCameras[gCurrentCameraID].currentYaw);
|
||||
playerSpinState->spinDirection.x = sin_rad(sp10 * TAU / 360.0f) * playerSpinState->spinDirectionMagnitude;
|
||||
playerSpinState->spinDirection.y = -cos_rad(sp10 * TAU / 360.0f) * playerSpinState->spinDirectionMagnitude;
|
||||
angle = clamp_angle(playerStatus->targetYaw - gCameras[gCurrentCameraID].currentYaw);
|
||||
playerSpinState->spinDirection.x = sin_rad(angle * TAU / 360.0f) * playerSpinState->spinDirectionMagnitude;
|
||||
playerSpinState->spinDirection.y = -cos_rad(angle * TAU / 360.0f) * playerSpinState->spinDirectionMagnitude;
|
||||
} else {
|
||||
temp_f24 = playerSpinState->speedScale - (playerStatus->currentStateTime - playerSpinState->fullSpeedSpinTime - 1) * playerSpinState->frictionScale;
|
||||
if (temp_f24 < 0.1) {
|
||||
temp_f24 = 0.1f;
|
||||
speedModifier = playerSpinState->speedScale - (playerStatus->currentStateTime - playerSpinState->fullSpeedSpinTime - 1) * playerSpinState->frictionScale;
|
||||
if (speedModifier < 0.1) {
|
||||
speedModifier = 0.1f;
|
||||
}
|
||||
|
||||
if (playerSpinState->inputMagnitude == 0.0f) {
|
||||
temp_f24 = 0.0f;
|
||||
speedModifier = 0.0f;
|
||||
}
|
||||
|
||||
playerSpinState->spinDirectionMagnitude -= 1.0f;
|
||||
@ -202,22 +221,22 @@ void func_802B6000_E25D60(void) {
|
||||
playerStatus->currentStateTime++;
|
||||
|
||||
switch (playerStatus->prevActionState) {
|
||||
case 0:
|
||||
player_input_to_move_vector(&sp10, &sp14);
|
||||
case ACTION_STATE_IDLE:
|
||||
player_input_to_move_vector(&angle, &magnitude);
|
||||
phys_update_interact_collider();
|
||||
if (check_input_jump()) {
|
||||
if (sp14 != 0.0f || playerStatus->targetYaw != sp10) {
|
||||
playerStatus->targetYaw = sp10;
|
||||
if (magnitude != 0.0f || playerStatus->targetYaw != angle) {
|
||||
playerStatus->targetYaw = angle;
|
||||
}
|
||||
}
|
||||
playerStatus->currentSpeed = (sp14 != 0.0f) ? playerStatus->runSpeed * temp_f24 : 0.0f;
|
||||
playerStatus->currentSpeed = (magnitude != 0.0f) ? playerStatus->runSpeed * speedModifier : 0.0f;
|
||||
break;
|
||||
case 1:
|
||||
case 2:
|
||||
playerStatus->currentSpeed = playerStatus->runSpeed * temp_f24;
|
||||
case ACTION_STATE_WALK:
|
||||
case ACTION_STATE_RUN:
|
||||
playerStatus->currentSpeed = playerStatus->runSpeed * speedModifier;
|
||||
break;
|
||||
}
|
||||
if (playerStatus->fallState == 0) {
|
||||
if (playerStatus->actionSubstate == SUBSTATE_SPIN_0) {
|
||||
playerSpinState->spinCountdown--;
|
||||
if (playerSpinState->spinCountdown > 0) {
|
||||
if (playerStatus->currentStateTime >= 2) {
|
||||
@ -225,33 +244,33 @@ void func_802B6000_E25D60(void) {
|
||||
}
|
||||
return;
|
||||
} else {
|
||||
playerStatus->fallState = 1;
|
||||
playerStatus->actionSubstate = SUBSTATE_SPIN_1;
|
||||
}
|
||||
}
|
||||
|
||||
if (playerStatus->fallState == 1) {
|
||||
sp10 = playerStatus->spriteFacingAngle;
|
||||
playerStatus->spriteFacingAngle = sp10 + playerStatus->spinRate;
|
||||
if (playerStatus->actionSubstate == SUBSTATE_SPIN_1) {
|
||||
angle = playerStatus->spriteFacingAngle;
|
||||
playerStatus->spriteFacingAngle = angle + playerStatus->spinRate;
|
||||
|
||||
if (playerSpinState->hasBufferedSpin != 0) {
|
||||
if (playerSpinState->hasBufferedSpin) {
|
||||
playerStatus->currentStateTime = 2;
|
||||
playerStatus->fallState = 2;
|
||||
playerStatus->actionSubstate = SUBSTATE_SPIN_2;
|
||||
playerStatus->flags &= ~PLAYER_STATUS_FLAGS_20000;
|
||||
suggest_player_anim_clearUnkFlag(0x10002);
|
||||
} else if (sp10 < playerStatus->spriteFacingAngle) {
|
||||
if (playerStatus->spriteFacingAngle >= 180.0f && sp10 < 180.0f) {
|
||||
suggest_player_anim_clearUnkFlag(ANIM_Mario_10002);
|
||||
} else if (angle < playerStatus->spriteFacingAngle) {
|
||||
if (playerStatus->spriteFacingAngle >= 180.0f && angle < 180.0f) {
|
||||
playerStatus->spriteFacingAngle = 180.0f;
|
||||
playerStatus->currentStateTime = 2;
|
||||
playerStatus->fallState = 2;
|
||||
playerStatus->actionSubstate = SUBSTATE_SPIN_2;
|
||||
playerStatus->flags &= ~PLAYER_STATUS_FLAGS_20000;
|
||||
suggest_player_anim_clearUnkFlag(0x10002);
|
||||
suggest_player_anim_clearUnkFlag(ANIM_Mario_10002);
|
||||
}
|
||||
} else if (playerStatus->spriteFacingAngle <= 0.0f && sp10 < 90.0f) {
|
||||
} else if (playerStatus->spriteFacingAngle <= 0.0f && angle < 90.0f) {
|
||||
playerStatus->spriteFacingAngle = 0.0f;
|
||||
playerStatus->currentStateTime = 2;
|
||||
playerStatus->fallState = 2;
|
||||
playerStatus->actionSubstate = SUBSTATE_SPIN_2;
|
||||
playerStatus->flags &= ~PLAYER_STATUS_FLAGS_20000;
|
||||
suggest_player_anim_clearUnkFlag(0x10002);
|
||||
suggest_player_anim_clearUnkFlag(ANIM_Mario_10002);
|
||||
}
|
||||
playerStatus->spriteFacingAngle = clamp_angle(playerStatus->spriteFacingAngle);
|
||||
}
|
||||
|
@ -1,40 +1,52 @@
|
||||
#include "common.h"
|
||||
|
||||
extern f32 D_802B6730;
|
||||
enum {
|
||||
SUBSTATE_SPIN = 0,
|
||||
SUBSTATE_RISE = 2,
|
||||
SUBSTATE_HOVER = 3,
|
||||
SUBSTATE_DESCEND = 4,
|
||||
SUBSTATE_IMPACT = 5,
|
||||
SUBSTATE_HOLD = 6,
|
||||
SUBSTATE_ABORT = 7,
|
||||
SUBSTATE_HIT_SWITCH = 11,
|
||||
SUBSTATE_DONE_SWITCH = 12
|
||||
};
|
||||
|
||||
s32 func_802B6648_E27428(void);
|
||||
static s32 get_collider_below_spin_jump(void);
|
||||
|
||||
void func_802B6000_E26DE0(void) {
|
||||
void action_update_spin_jump(void) {
|
||||
PlayerStatus* playerStatus = &gPlayerStatus;
|
||||
CollisionStatus* collisionStatus = &gCollisionStatus;
|
||||
Entity* entity;
|
||||
HiddenPanelsData* panels;
|
||||
s32 sp10;
|
||||
s32 tempCondition;
|
||||
f32 temp_f20;
|
||||
Entity* entity;
|
||||
s32 belowColliderID;
|
||||
s32 landed;
|
||||
f32 velocity;
|
||||
u32 entityType;
|
||||
u8 colliderType;
|
||||
s32 surfaceType;
|
||||
|
||||
static f32 RotationRate;
|
||||
|
||||
if (playerStatus->flags & PLAYER_STATUS_FLAGS_ACTION_STATE_CHANGED) {
|
||||
playerStatus->flags &= ~(PLAYER_STATUS_FLAGS_ACTION_STATE_CHANGED | PLAYER_STATUS_FLAGS_JUMPING | PLAYER_STATUS_FLAGS_FALLING);
|
||||
playerStatus->flags |= (PLAYER_STATUS_FLAGS_JUMPING | PLAYER_STATUS_FLAGS_FLYING);
|
||||
|
||||
playerStatus->fallState = 0;
|
||||
playerStatus->actionSubstate = SUBSTATE_SPIN;
|
||||
playerStatus->currentSpeed = 0.0f;
|
||||
D_802B6730 = 0.0f;
|
||||
RotationRate = 0.0f;
|
||||
playerStatus->gravityIntegrator[0] = 5.2f;
|
||||
suggest_player_anim_clearUnkFlag(0x1000A);
|
||||
suggest_player_anim_clearUnkFlag(ANIM_Mario_1000A);
|
||||
disable_player_input();
|
||||
playerStatus->flags |= PLAYER_STATUS_FLAGS_200;
|
||||
gCameras[CAM_DEFAULT].moveFlags |= CAMERA_MOVE_FLAGS_1;
|
||||
sfx_play_sound_at_player(SOUND_146, 0);
|
||||
sfx_play_sound_at_player(SOUND_SPIN_JUMP, 0);
|
||||
}
|
||||
|
||||
tempCondition = 0;
|
||||
switch (playerStatus->fallState) {
|
||||
case 0:
|
||||
D_802B6730 = 40.0f;
|
||||
playerStatus->pitch += 40.0f;
|
||||
landed = FALSE;
|
||||
switch (playerStatus->actionSubstate) {
|
||||
case SUBSTATE_SPIN:
|
||||
RotationRate = 40.0f;
|
||||
playerStatus->pitch += RotationRate;
|
||||
if (playerStatus->pitch >= 360.0f) {
|
||||
playerStatus->pitch = 360.0f;
|
||||
}
|
||||
@ -52,13 +64,13 @@ void func_802B6000_E26DE0(void) {
|
||||
if (playerStatus->pitch == 360.0f) {
|
||||
if (playerStatus->gravityIntegrator[0] <= 0.0f) {
|
||||
playerStatus->currentStateTime = 5;
|
||||
playerStatus->fallState = 2;
|
||||
playerStatus->actionSubstate = SUBSTATE_RISE;
|
||||
playerStatus->gravityIntegrator[0] = 2.0f;
|
||||
}
|
||||
}
|
||||
collisionStatus->currentCeiling = -1;
|
||||
break;
|
||||
case 2:
|
||||
case SUBSTATE_RISE:
|
||||
if (playerStatus->gravityIntegrator[0] >= 0.0f) {
|
||||
playerStatus->gravityIntegrator[0] -= 1.4;
|
||||
if (collisionStatus->currentCeiling < 0) {
|
||||
@ -66,65 +78,65 @@ void func_802B6000_E26DE0(void) {
|
||||
}
|
||||
}
|
||||
if (--playerStatus->currentStateTime <= 0) {
|
||||
playerStatus->fallState++;
|
||||
playerStatus->actionSubstate++;
|
||||
}
|
||||
break;
|
||||
case 3:
|
||||
playerStatus->position.y = player_check_collision_below(0.0f, &sp10);
|
||||
D_802B6730 = 45.0f;
|
||||
playerStatus->pitch += 45.0f;
|
||||
case SUBSTATE_HOVER:
|
||||
playerStatus->position.y = player_check_collision_below(0.0f, &belowColliderID);
|
||||
RotationRate = 45.0f;
|
||||
playerStatus->pitch += RotationRate;
|
||||
if (playerStatus->pitch >= 360.0) {
|
||||
playerStatus->pitch = 0.0f;
|
||||
playerStatus->fallState++;
|
||||
playerStatus->actionSubstate++;
|
||||
playerStatus->gravityIntegrator[1] = -3.4744f;
|
||||
playerStatus->gravityIntegrator[2] = 0.4704f;
|
||||
playerStatus->gravityIntegrator[3] = -1.1904f;
|
||||
playerStatus->gravityIntegrator[0] = playerStatus->gravityIntegrator[1];
|
||||
suggest_player_anim_clearUnkFlag(0x1000B);
|
||||
suggest_player_anim_clearUnkFlag(ANIM_Mario_1000B);
|
||||
}
|
||||
break;
|
||||
case 4:
|
||||
temp_f20 = func_800E34D8();
|
||||
playerStatus->position.y = player_check_collision_below(temp_f20, &sp10);
|
||||
if (temp_f20 < -100.0f) {
|
||||
case SUBSTATE_DESCEND:
|
||||
velocity = func_800E34D8();
|
||||
playerStatus->position.y = player_check_collision_below(velocity, &belowColliderID);
|
||||
if (velocity < -100.0f) {
|
||||
playerStatus->gravityIntegrator[3] = 0.0f;
|
||||
playerStatus->gravityIntegrator[2] = 0.0f;
|
||||
playerStatus->gravityIntegrator[1] = 0.0f;
|
||||
playerStatus->gravityIntegrator[0] = -100.0f;
|
||||
}
|
||||
if (sp10 >= 0) {
|
||||
if (belowColliderID >= 0) {
|
||||
if (collisionStatus->currentFloor & COLLISION_WITH_ENTITY_BIT && (entityType = get_entity_type(collisionStatus->currentFloor),
|
||||
entityType == ENTITY_TYPE_RED_SWITCH || entityType == ENTITY_TYPE_BLUE_SWITCH)) {
|
||||
get_entity_by_index(collisionStatus->currentFloor)->collisionFlags |= ENTITY_COLLISION_PLAYER_TOUCH_FLOOR;
|
||||
playerStatus->fallState = 0xB;
|
||||
playerStatus->actionSubstate = SUBSTATE_HIT_SWITCH;
|
||||
playerStatus->flags &= ~PLAYER_STATUS_FLAGS_FLYING;
|
||||
break;
|
||||
} else {
|
||||
colliderType = get_collider_type_by_id(sp10);
|
||||
if (colliderType == 3) {
|
||||
playerStatus->unk_BF = 1;
|
||||
surfaceType = get_collider_flags(belowColliderID) & COLLIDER_FLAGS_SURFACE_TYPE_MASK;
|
||||
if (surfaceType == SURFACE_TYPE_LAVA) {
|
||||
playerStatus->hazardType = HAZARD_TYPE_LAVA;
|
||||
set_action_state(ACTION_STATE_HIT_LAVA);
|
||||
playerStatus->flags |= PLAYER_STATUS_FLAGS_800;
|
||||
playerStatus->flags &= ~PLAYER_STATUS_FLAGS_FLYING;
|
||||
return;
|
||||
} else if (colliderType == 2) {
|
||||
set_action_state(ACTION_STATE_HIT_LAVA);
|
||||
playerStatus->flags &= ~PLAYER_STATUS_FLAGS_FLYING;
|
||||
return;
|
||||
} else if (surfaceType == SURFACE_TYPE_SPIKES) {
|
||||
set_action_state(ACTION_STATE_HIT_LAVA);
|
||||
playerStatus->flags &= ~PLAYER_STATUS_FLAGS_FLYING;
|
||||
return;
|
||||
} else {
|
||||
playerStatus->gravityIntegrator[1] = -3.4744f;
|
||||
playerStatus->gravityIntegrator[2] = 0.4704f;
|
||||
playerStatus->gravityIntegrator[3] = -1.1904f;
|
||||
playerStatus->gravityIntegrator[0] = 10.0f;
|
||||
suggest_player_anim_clearUnkFlag(0x1000B);
|
||||
playerStatus->actionState = ACTION_STATE_GROUND_POUND;
|
||||
suggest_player_anim_clearUnkFlag(ANIM_Mario_1000B);
|
||||
playerStatus->actionState = ACTION_STATE_SPIN_POUND;
|
||||
playerStatus->timeInAir = 0;
|
||||
playerStatus->unk_280 = 0xC;
|
||||
playerStatus->poundImpactDelay = 12;
|
||||
playerStatus->pitch = 0.0f;
|
||||
playerStatus->fallState++;
|
||||
playerStatus->actionSubstate++;
|
||||
exec_ShakeCam1(0, 0, 4);
|
||||
sfx_play_sound_at_player(SOUND_149, 0);
|
||||
start_rumble(0x80, 0x19);
|
||||
start_rumble(128, 25);
|
||||
panels = &gCurrentHiddenPanels;
|
||||
panels->tryFlipTrigger = TRUE;
|
||||
panels->flipTriggerPosY = playerStatus->position.y;
|
||||
@ -133,70 +145,65 @@ void func_802B6000_E26DE0(void) {
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 5:
|
||||
temp_f20 = integrate_gravity();
|
||||
if (temp_f20 == 0.0f) {
|
||||
tempCondition = 1;
|
||||
case SUBSTATE_IMPACT:
|
||||
velocity = integrate_gravity();
|
||||
if (velocity == 0.0f) {
|
||||
landed = TRUE;
|
||||
} else {
|
||||
if (playerStatus->gravityIntegrator[0] > 0.0f) {
|
||||
playerStatus->position.y += temp_f20;
|
||||
playerStatus->position.y += velocity;
|
||||
} else {
|
||||
playerStatus->position.y = player_check_collision_below(temp_f20, &sp10);
|
||||
if (playerStatus->gravityIntegrator[0] < 0.0f && sp10 >= 0) {
|
||||
playerStatus->fallState++;
|
||||
playerStatus->position.y = player_check_collision_below(velocity, &belowColliderID);
|
||||
if (playerStatus->gravityIntegrator[0] < 0.0f && belowColliderID >= 0) {
|
||||
playerStatus->actionSubstate++;
|
||||
}
|
||||
}
|
||||
playerStatus->position.y = player_check_collision_below(0.0f, &sp10);
|
||||
playerStatus->position.y = player_check_collision_below(0.0f, &belowColliderID);
|
||||
}
|
||||
break;
|
||||
case 6:
|
||||
playerStatus->position.y = player_check_collision_below(0.0f, &sp10);
|
||||
if (sp10 >= 0) {
|
||||
case SUBSTATE_HOLD:
|
||||
playerStatus->position.y = player_check_collision_below(0.0f, &belowColliderID);
|
||||
if (belowColliderID >= 0) {
|
||||
playerStatus->gravityIntegrator[0] = 0.0f;
|
||||
playerStatus->gravityIntegrator[1] = 0.0f;
|
||||
playerStatus->gravityIntegrator[2] = 0.0f;
|
||||
playerStatus->gravityIntegrator[3] = 0.0f;
|
||||
}
|
||||
case 7:
|
||||
if (--playerStatus->unk_280 <= 0) {
|
||||
tempCondition = 1;
|
||||
// fallthrough
|
||||
case SUBSTATE_ABORT:
|
||||
if (--playerStatus->poundImpactDelay <= 0) {
|
||||
landed = TRUE;
|
||||
}
|
||||
break;
|
||||
case 11:
|
||||
case SUBSTATE_HIT_SWITCH:
|
||||
set_action_state(ACTION_STATE_LANDING_ON_SWITCH);
|
||||
playerStatus->fallState++;
|
||||
playerStatus->actionSubstate++;
|
||||
enable_player_input();
|
||||
break;
|
||||
case 12:
|
||||
case SUBSTATE_DONE_SWITCH:
|
||||
break;
|
||||
}
|
||||
|
||||
if (tempCondition != 0) {
|
||||
if (landed) {
|
||||
set_action_state(ACTION_STATE_LAND);
|
||||
playerStatus->flags &= ~0x8;
|
||||
playerStatus->flags &= ~PLAYER_STATUS_ANIM_FLAGS_8;
|
||||
}
|
||||
if (playerStatus->gravityIntegrator[0] < 0.0f) {
|
||||
sp10 = func_802B6648_E27428();
|
||||
if (sp10 >= 0) {
|
||||
belowColliderID = get_collider_below_spin_jump();
|
||||
if (belowColliderID >= 0) {
|
||||
collisionStatus->lastTouchedFloor = -1;
|
||||
collisionStatus->currentFloor = sp10;
|
||||
collisionStatus->currentFloor = belowColliderID;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
s32 func_802B6648_E27428(void) {
|
||||
f32 sp28;
|
||||
f32 sp2C;
|
||||
f32 sp30;
|
||||
f32 sp34;
|
||||
f32 sp38;
|
||||
f32 sp3C;
|
||||
f32 sp40;
|
||||
f32 sp44;
|
||||
static s32 get_collider_below_spin_jump(void) {
|
||||
f32 posX, posY, posZ, height;
|
||||
f32 hitRx, hitRz, hitDirX, hitDirZ;
|
||||
|
||||
sp28 = gPlayerStatus.position.x;
|
||||
sp34 = gPlayerStatus.colliderHeight;
|
||||
sp30 = gPlayerStatus.position.z;
|
||||
sp2C = gPlayerStatus.position.y + (sp34 * 0.5f);
|
||||
return player_raycast_below_cam_relative(&gPlayerStatus, &sp28, &sp2C, &sp30, &sp34, &sp38, &sp3C, &sp40, &sp44);
|
||||
posX = gPlayerStatus.position.x;
|
||||
posZ = gPlayerStatus.position.z;
|
||||
height = gPlayerStatus.colliderHeight;
|
||||
posY = gPlayerStatus.position.y + (height * 0.5f);
|
||||
return player_raycast_below_cam_relative(&gPlayerStatus, &posX, &posY, &posZ, &height, &hitRx, &hitRz, &hitDirX, &hitDirZ);
|
||||
}
|
@ -1,51 +1,50 @@
|
||||
#include "common.h"
|
||||
#include "world/actions.h"
|
||||
|
||||
s32 State18PeachAnims[] = {
|
||||
0x000A0002, // none
|
||||
0x000A002B, // cream
|
||||
0x000A002D, // strawberry
|
||||
0x000A002F, // butter
|
||||
0x000A0031, // cleanser
|
||||
0x000A0033, // water
|
||||
0x000A0035, // milk
|
||||
0x000A0037, // flour
|
||||
0x000A0039, // egg
|
||||
0x000A003B, // complete cake
|
||||
0x000A003D, // cake bowl
|
||||
0x000A003F, // cake mixed
|
||||
0x000A0041, // cake pan
|
||||
0x000A0043, // cake batter
|
||||
0x000A0045, // cake bare
|
||||
0x000A0047, // salt
|
||||
0x000A0049, // sugar
|
||||
0x000A004B, // cake with icing
|
||||
0x000A004D, // cake with berries
|
||||
AnimID StepUpPeachAnims[] = {
|
||||
ANIM_Peach_A0002, // none
|
||||
ANIM_Peach_A002B, // cream
|
||||
ANIM_Peach_A002D, // strawberry
|
||||
ANIM_Peach_A002F, // butter
|
||||
ANIM_Peach_A0031, // cleanser
|
||||
ANIM_Peach_A0033, // water
|
||||
ANIM_Peach_A0035, // milk
|
||||
ANIM_Peach_A0037, // flour
|
||||
ANIM_Peach_A0039, // egg
|
||||
ANIM_Peach_A003B, // complete cake
|
||||
ANIM_Peach_A003D, // cake bowl
|
||||
ANIM_Peach_A003F, // cake mixed
|
||||
ANIM_Peach_A0041, // cake pan
|
||||
ANIM_Peach_A0043, // cake batter
|
||||
ANIM_Peach_A0045, // cake bare
|
||||
ANIM_Peach_A0047, // salt
|
||||
ANIM_Peach_A0049, // sugar
|
||||
ANIM_Peach_A004B, // cake with icing
|
||||
ANIM_Peach_A004D, // cake with berries
|
||||
0x00000000
|
||||
};
|
||||
|
||||
void func_802B6000_E245D0(void) {
|
||||
void action_update_step_up(void) {
|
||||
PlayerStatus* playerStatus = &gPlayerStatus;
|
||||
f32 cosTheta;
|
||||
f32 sinTheta;
|
||||
s32 colliderID;
|
||||
AnimID anim;
|
||||
|
||||
if (playerStatus->flags & PLAYER_STATUS_FLAGS_ACTION_STATE_CHANGED) {
|
||||
playerStatus->flags &= ~PLAYER_STATUS_FLAGS_ACTION_STATE_CHANGED;
|
||||
phys_adjust_cam_on_landing();
|
||||
if (!(playerStatus->animFlags & 0x1000)) {
|
||||
s32 temp;
|
||||
|
||||
if (!(playerStatus->animFlags & 1)) {
|
||||
temp = 0x10004;
|
||||
if (!(playerStatus->animFlags & PLAYER_STATUS_ANIM_FLAGS_USING_PEACH_PHYSICS)) {
|
||||
if (!(playerStatus->animFlags & PLAYER_STATUS_ANIM_FLAGS_HOLDING_WATT)) {
|
||||
anim = ANIM_Mario_Walking;
|
||||
} else {
|
||||
temp = 0x60000;
|
||||
anim = ANIM_Mario_60000;
|
||||
}
|
||||
suggest_player_anim_clearUnkFlag(temp);
|
||||
suggest_player_anim_clearUnkFlag(anim);
|
||||
} else {
|
||||
func_802B6198_E24768();
|
||||
}
|
||||
playerStatus->fallState = 0;
|
||||
playerStatus->actionSubstate = 0;
|
||||
playerStatus->timeInAir = 0;
|
||||
playerStatus->unk_C2 = 0;
|
||||
playerStatus->gravityIntegrator[0] = 17.7566f;
|
||||
@ -76,23 +75,23 @@ void func_802B6000_E245D0(void) {
|
||||
}
|
||||
|
||||
void func_802B6198_E24768(void) {
|
||||
if (!(gPlayerStatus.animFlags & 0x2000)) {
|
||||
if (!(gGameStatusPtr->peachFlags & 0x10)) {
|
||||
suggest_player_anim_clearUnkFlag((State18PeachAnims)[gGameStatusPtr->peachCookingIngredient]);
|
||||
if (!(gPlayerStatus.animFlags & PLAYER_STATUS_ANIM_FLAGS_IN_DISGUISE)) {
|
||||
if (!(gGameStatusPtr->peachFlags & PEACH_STATUS_FLAG_HAS_INGREDIENT)) {
|
||||
suggest_player_anim_clearUnkFlag((StepUpPeachAnims)[gGameStatusPtr->peachCookingIngredient]);
|
||||
} else {
|
||||
suggest_player_anim_clearUnkFlag(0xD000D); // doood
|
||||
suggest_player_anim_clearUnkFlag(ANIM_Peach_D000D);
|
||||
}
|
||||
} else {
|
||||
peach_set_disguise_anim(BasicPeachDisguiseAnims[gPlayerStatus.peachDisguise].walk);
|
||||
}
|
||||
}
|
||||
|
||||
void func_802B6230_E24800(void) {
|
||||
void action_update_step_up_peach(void) {
|
||||
PlayerStatus* playerStatus = &gPlayerStatus;
|
||||
|
||||
if (playerStatus->flags & PLAYER_STATUS_FLAGS_ACTION_STATE_CHANGED) {
|
||||
playerStatus->flags &= ~PLAYER_STATUS_FLAGS_ACTION_STATE_CHANGED;
|
||||
suggest_player_anim_clearUnkFlag(0xA0005);
|
||||
suggest_player_anim_clearUnkFlag(ANIM_Peach_A0005);
|
||||
playerStatus->currentStateTime = 8;
|
||||
}
|
||||
|
||||
@ -102,12 +101,12 @@ void func_802B6230_E24800(void) {
|
||||
try_player_footstep_sounds(1);
|
||||
}
|
||||
} else {
|
||||
if (!(playerStatus->flags & 0x4000)) {
|
||||
set_action_state(0);
|
||||
if (!(playerStatus->flags & PLAYER_STATUS_FLAGS_4000)) {
|
||||
set_action_state(ACTION_STATE_IDLE);
|
||||
} else if (playerStatus->currentSpeed >= playerStatus->runSpeed) {
|
||||
set_action_state(2);
|
||||
set_action_state(ACTION_STATE_RUN);
|
||||
} else {
|
||||
set_action_state(1);
|
||||
set_action_state(ACTION_STATE_WALK);
|
||||
}
|
||||
}
|
||||
}
|
@ -4,15 +4,27 @@ extern s32 gSpinHistoryBufferPos;
|
||||
extern s32 gSpinHistoryPosY[5];
|
||||
extern s16 gSpinHistoryPosAngle[5];
|
||||
|
||||
s32 func_802B65F8_E26D08(void);
|
||||
void phys_clear_spin_history(void);
|
||||
void record_jump_apex(void);
|
||||
|
||||
void func_802B6000_E26710(void) {
|
||||
enum {
|
||||
SUBSTATE_ASCEND = 0,
|
||||
SUBSTATE_HOVER = 1,
|
||||
SUBSTATE_DESCEND = 2,
|
||||
SUBSTATE_IMPACT = 3,
|
||||
SUBSTATE_HIT_SWITCH = 11,
|
||||
SUBSTATE_DONE_SWITCH = 12,
|
||||
};
|
||||
|
||||
static s32 get_collider_below_tornado_jump(void);
|
||||
|
||||
void action_update_tornado_jump(void) {
|
||||
PlayerStatus* playerStatus = &gPlayerStatus;
|
||||
CollisionStatus* collisionStatus = &gCollisionStatus;
|
||||
f32 temp_f0;
|
||||
f32 cameraRelativeYaw;
|
||||
f32 fallVelocity;
|
||||
u8 colliderType;
|
||||
f32 phi_f4;
|
||||
s32 surfaceType;
|
||||
f32 spinRate;
|
||||
s32 colliderBelow;
|
||||
u32 entityType;
|
||||
|
||||
@ -20,24 +32,25 @@ void func_802B6000_E26710(void) {
|
||||
playerStatus->flags &= ~PLAYER_STATUS_FLAGS_ACTION_STATE_CHANGED;
|
||||
playerStatus->flags |= (PLAYER_STATUS_FLAGS_20000 | PLAYER_STATUS_FLAGS_FLYING | PLAYER_STATUS_FLAGS_JUMPING);
|
||||
phys_clear_spin_history();
|
||||
playerStatus->fallState = 0;
|
||||
playerStatus->actionSubstate = SUBSTATE_ASCEND;
|
||||
playerStatus->currentSpeed = 0.0f;
|
||||
playerStatus->gravityIntegrator[0] = 16.0f;
|
||||
playerStatus->gravityIntegrator[1] = -7.38624f;
|
||||
playerStatus->gravityIntegrator[2] = 3.44694f;
|
||||
playerStatus->gravityIntegrator[3] = -0.75f;
|
||||
suggest_player_anim_setUnkFlag(0x80000);
|
||||
suggest_player_anim_setUnkFlag(ANIM_Mario_80000);
|
||||
disable_player_input();
|
||||
playerStatus->flags |= 0x200;
|
||||
playerStatus->flags |= PLAYER_STATUS_FLAGS_200;
|
||||
gCameras[CAM_DEFAULT].moveFlags |= CAMERA_MOVE_FLAGS_1;
|
||||
temp_f0 = clamp_angle(playerStatus->targetYaw - gCameras[gCurrentCameraID].currentYaw);
|
||||
phi_f4 = -60.0f;
|
||||
if (temp_f0 <= 180.0f) {
|
||||
phi_f4 = 60.0f;
|
||||
cameraRelativeYaw = clamp_angle(playerStatus->targetYaw - gCameras[gCurrentCameraID].currentYaw);
|
||||
if (cameraRelativeYaw <= 180.0f) {
|
||||
spinRate = 60.0f;
|
||||
} else {
|
||||
spinRate = -60.0f;
|
||||
}
|
||||
playerStatus->spinRate = phi_f4;
|
||||
playerStatus->spinRate = spinRate;
|
||||
}
|
||||
if (playerStatus->fallState < 4) {
|
||||
if (playerStatus->actionSubstate <= SUBSTATE_IMPACT) {
|
||||
if (playerStatus->spinRate >= 0.0f) {
|
||||
playerStatus->spriteFacingAngle += playerStatus->spinRate;
|
||||
if (playerStatus->spriteFacingAngle >= 360.0f) {
|
||||
@ -60,8 +73,8 @@ void func_802B6000_E26710(void) {
|
||||
gSpinHistoryBufferPos = 0;
|
||||
}
|
||||
|
||||
switch (playerStatus->fallState) {
|
||||
case 0:
|
||||
switch (playerStatus->actionSubstate) {
|
||||
case SUBSTATE_ASCEND:
|
||||
fallVelocity = integrate_gravity();
|
||||
playerStatus->position.y = player_check_collision_below(fallVelocity, &colliderBelow);
|
||||
if (colliderBelow >= 0 && collisionStatus->currentFloor & COLLISION_WITH_ENTITY_BIT ) {
|
||||
@ -69,7 +82,7 @@ void func_802B6000_E26710(void) {
|
||||
if (entityType == ENTITY_TYPE_BLUE_SWITCH || entityType == ENTITY_TYPE_RED_SWITCH) {
|
||||
get_entity_by_index(collisionStatus->currentFloor)->collisionFlags |= ENTITY_COLLISION_PLAYER_TOUCH_FLOOR;
|
||||
disable_player_input();
|
||||
playerStatus->fallState = 0xB;
|
||||
playerStatus->actionSubstate = SUBSTATE_HIT_SWITCH;
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -77,7 +90,7 @@ void func_802B6000_E26710(void) {
|
||||
record_jump_apex();
|
||||
playerStatus->currentStateTime = 3;
|
||||
playerStatus->flags |= PLAYER_STATUS_FLAGS_FALLING;
|
||||
playerStatus->fallState++;
|
||||
playerStatus->actionSubstate++;
|
||||
sfx_play_sound_at_player(SOUND_TORNADO_JUMP, 0);
|
||||
}
|
||||
if (colliderBelow >= 0) {
|
||||
@ -85,12 +98,12 @@ void func_802B6000_E26710(void) {
|
||||
set_action_state(ACTION_STATE_LAND);
|
||||
}
|
||||
break;
|
||||
case 1:
|
||||
case SUBSTATE_HOVER:
|
||||
if (--playerStatus->currentStateTime <= 0) {
|
||||
playerStatus->fallState++;
|
||||
playerStatus->actionSubstate++;
|
||||
}
|
||||
break;
|
||||
case 2:
|
||||
case SUBSTATE_DESCEND:
|
||||
fallVelocity = integrate_gravity();
|
||||
playerStatus->position.y = player_check_collision_below(fallVelocity, &colliderBelow);
|
||||
if (fallVelocity < -100.0f) {
|
||||
@ -120,22 +133,22 @@ void func_802B6000_E26710(void) {
|
||||
}
|
||||
}
|
||||
|
||||
colliderType = get_collider_type_by_id(colliderBelow);
|
||||
if (colliderType == 3) {
|
||||
playerStatus->unk_BF = 1;
|
||||
surfaceType = get_collider_flags(colliderBelow) & COLLIDER_FLAGS_SURFACE_TYPE_MASK;
|
||||
if (surfaceType == SURFACE_TYPE_LAVA) {
|
||||
playerStatus->hazardType = HAZARD_TYPE_LAVA;
|
||||
playerStatus->flags &= ~(PLAYER_STATUS_FLAGS_20000 | PLAYER_STATUS_FLAGS_FLYING);
|
||||
set_action_state(ACTION_STATE_HIT_LAVA);
|
||||
playerStatus->flags |= PLAYER_STATUS_FLAGS_800;
|
||||
return;
|
||||
} else if (colliderType == 2) {
|
||||
} else if (surfaceType == SURFACE_TYPE_SPIKES) {
|
||||
set_action_state(ACTION_STATE_HIT_LAVA);
|
||||
playerStatus->flags &= ~(PLAYER_STATUS_FLAGS_20000 | PLAYER_STATUS_FLAGS_FLYING);
|
||||
return;
|
||||
}
|
||||
playerStatus->currentStateTime = 8;
|
||||
playerStatus->timeInAir = 0;
|
||||
playerStatus->actionState = ACTION_STATE_ULTRA_POUND;
|
||||
playerStatus->fallState++;
|
||||
playerStatus->actionState = ACTION_STATE_TORNADO_POUND;
|
||||
playerStatus->actionSubstate++;
|
||||
exec_ShakeCam1(0, 0, 4);
|
||||
sfx_play_sound_at_player(SOUND_14A, 0);
|
||||
start_rumble(256, 50);
|
||||
@ -145,24 +158,24 @@ void func_802B6000_E26710(void) {
|
||||
playerStatus->flags |= PLAYER_STATUS_FLAGS_400;
|
||||
}
|
||||
break;
|
||||
case 3:
|
||||
case SUBSTATE_IMPACT:
|
||||
if (--playerStatus->currentStateTime == 0) {
|
||||
playerStatus->fallState++;
|
||||
playerStatus->actionSubstate++;
|
||||
playerStatus->flags &= ~(PLAYER_STATUS_FLAGS_20000 | PLAYER_STATUS_FLAGS_FLYING);
|
||||
set_action_state(ACTION_STATE_LAND);
|
||||
}
|
||||
break;
|
||||
case 11:
|
||||
case SUBSTATE_HIT_SWITCH:
|
||||
set_action_state(ACTION_STATE_LANDING_ON_SWITCH);
|
||||
playerStatus->fallState++;
|
||||
playerStatus->actionSubstate++;
|
||||
enable_player_input();
|
||||
break;
|
||||
case 12:
|
||||
case SUBSTATE_DONE_SWITCH:
|
||||
break;
|
||||
}
|
||||
|
||||
if (playerStatus->gravityIntegrator[0] < 0.0f) {
|
||||
colliderBelow = func_802B65F8_E26D08();
|
||||
colliderBelow = get_collider_below_tornado_jump();
|
||||
if (colliderBelow >= 0) {
|
||||
collisionStatus->lastTouchedFloor = -1;
|
||||
collisionStatus->currentFloor = colliderBelow;
|
||||
@ -170,19 +183,13 @@ void func_802B6000_E26710(void) {
|
||||
}
|
||||
}
|
||||
|
||||
s32 func_802B65F8_E26D08(void) {
|
||||
f32 sp28;
|
||||
f32 sp2C;
|
||||
f32 sp30;
|
||||
f32 sp34;
|
||||
f32 sp38;
|
||||
f32 sp3C;
|
||||
f32 sp40;
|
||||
f32 sp44;
|
||||
static s32 get_collider_below_tornado_jump(void) {
|
||||
f32 posX, posY, posZ, height;
|
||||
f32 hitRx, hitRz, hitDirX, hitDirZ;
|
||||
|
||||
sp28 = gPlayerStatus.position.x;
|
||||
sp34 = gPlayerStatus.colliderHeight;
|
||||
sp30 = gPlayerStatus.position.z;
|
||||
sp2C = gPlayerStatus.position.y + (sp34 * 0.5f);
|
||||
return player_raycast_below_cam_relative(&gPlayerStatus, &sp28, &sp2C, &sp30, &sp34, &sp38, &sp3C, &sp40, &sp44);
|
||||
posX = gPlayerStatus.position.x;
|
||||
posZ = gPlayerStatus.position.z;
|
||||
height = gPlayerStatus.colliderHeight;
|
||||
posY = gPlayerStatus.position.y + (height * 0.5f);
|
||||
return player_raycast_below_cam_relative(&gPlayerStatus, &posX, &posY, &posZ, &height, &hitRx, &hitRz, &hitDirX, &hitDirZ);
|
||||
}
|
@ -1,71 +1,79 @@
|
||||
#include "common.h"
|
||||
|
||||
extern f32 D_802B62D0;
|
||||
extern f32 D_802B62D4;
|
||||
extern f32 D_802B62D8;
|
||||
extern f32 D_802B62DC;
|
||||
extern f32 Munchlesia_LaunchVelocity;
|
||||
extern f32 Munchlesia_LateralVelocity;
|
||||
extern f32 Munchlesia_LaunchAccel;
|
||||
extern f32 Munchlesia_LaunchYaw;
|
||||
extern s32 D_802B62E0;
|
||||
|
||||
void func_802B6000_E291A0(void) {
|
||||
PlayerStatus* playerStatus = &gPlayerStatus;
|
||||
s32 sp10;
|
||||
f32 tempCollision;
|
||||
enum {
|
||||
SUBSTATE_INIT = 0,
|
||||
SUBSTATE_EJECT = 1,
|
||||
SUBSTATE_FALL = 2,
|
||||
SUBSTATE_CRASH = 3,
|
||||
SUBSTATE_GET_UP = 5,
|
||||
};
|
||||
|
||||
if (playerStatus->flags & (1 << 31)) {
|
||||
playerStatus->flags &= ~0x80000000;
|
||||
playerStatus->fallState = 0;
|
||||
void action_update_use_munchlesia(void) {
|
||||
PlayerStatus* playerStatus = &gPlayerStatus;
|
||||
s32 colliderID;
|
||||
f32 hitPosY;
|
||||
|
||||
if (playerStatus->flags & PLAYER_STATUS_FLAGS_ACTION_STATE_CHANGED) {
|
||||
playerStatus->flags &= ~PLAYER_STATUS_FLAGS_ACTION_STATE_CHANGED;
|
||||
playerStatus->actionSubstate = SUBSTATE_INIT;
|
||||
gOverrideFlags |= GLOBAL_OVERRIDES_40;
|
||||
disable_player_static_collisions();
|
||||
disable_player_input();
|
||||
}
|
||||
|
||||
switch (playerStatus->fallState) {
|
||||
case 0:
|
||||
suggest_player_anim_clearUnkFlag(0x1002E);
|
||||
D_802B62E0 = 0x20;
|
||||
D_802B62D0 = 16.0f;
|
||||
D_802B62D4 = 4.0f;
|
||||
D_802B62D8 = 1.0f;
|
||||
D_802B62D4 = 1.875f;
|
||||
playerStatus->fallState++;
|
||||
D_802B62DC = playerStatus->targetYaw;
|
||||
switch (playerStatus->actionSubstate) {
|
||||
case SUBSTATE_INIT:
|
||||
suggest_player_anim_clearUnkFlag(ANIM_Mario_1002E);
|
||||
D_802B62E0 = 32;
|
||||
Munchlesia_LaunchVelocity = 16.0f;
|
||||
Munchlesia_LateralVelocity = 4.0f;
|
||||
Munchlesia_LaunchAccel = 1.0f;
|
||||
Munchlesia_LateralVelocity = 1.875f;
|
||||
playerStatus->actionSubstate++; // SUBSTATE_EJECT
|
||||
Munchlesia_LaunchYaw = playerStatus->targetYaw;
|
||||
break;
|
||||
case 1:
|
||||
playerStatus->position.y += D_802B62D0;
|
||||
D_802B62D0 -= D_802B62D8;
|
||||
add_vec2D_polar(&playerStatus->position, &playerStatus->position.z, D_802B62D4, D_802B62DC);
|
||||
case SUBSTATE_EJECT:
|
||||
playerStatus->position.y += Munchlesia_LaunchVelocity;
|
||||
Munchlesia_LaunchVelocity -= Munchlesia_LaunchAccel;
|
||||
add_vec2D_polar(&playerStatus->position.x, &playerStatus->position.z, Munchlesia_LateralVelocity, Munchlesia_LaunchYaw);
|
||||
gCameras[CAM_DEFAULT].targetPos.x = playerStatus->position.x;
|
||||
gCameras[CAM_DEFAULT].targetPos.y = playerStatus->position.y;
|
||||
gCameras[CAM_DEFAULT].targetPos.z = playerStatus->position.z;
|
||||
if (D_802B62D0 <= 0.0f) {
|
||||
playerStatus->fallState++;
|
||||
if (Munchlesia_LaunchVelocity <= 0.0f) {
|
||||
playerStatus->actionSubstate++; // SUBSTATE_FALL
|
||||
}
|
||||
break;
|
||||
case 2:
|
||||
playerStatus->position.y += D_802B62D0;
|
||||
D_802B62D0 -= D_802B62D8;
|
||||
add_vec2D_polar(&playerStatus->position, &playerStatus->position.z, D_802B62D4, D_802B62DC);
|
||||
case SUBSTATE_FALL:
|
||||
playerStatus->position.y += Munchlesia_LaunchVelocity;
|
||||
Munchlesia_LaunchVelocity -= Munchlesia_LaunchAccel;
|
||||
add_vec2D_polar(&playerStatus->position.x, &playerStatus->position.z, Munchlesia_LateralVelocity, Munchlesia_LaunchYaw);
|
||||
gCameras[CAM_DEFAULT].targetPos.x = playerStatus->position.x;
|
||||
gCameras[CAM_DEFAULT].targetPos.y = playerStatus->position.y;
|
||||
gCameras[CAM_DEFAULT].targetPos.z = playerStatus->position.z;
|
||||
tempCollision = player_check_collision_below(D_802B62D0, &sp10);
|
||||
if (sp10 >= 0) {
|
||||
hitPosY = player_check_collision_below(Munchlesia_LaunchVelocity, &colliderID);
|
||||
if (colliderID >= 0) {
|
||||
sfx_play_sound_at_player(SOUND_162, 0);
|
||||
suggest_player_anim_setUnkFlag(0x80003);
|
||||
playerStatus->position.y = tempCollision;
|
||||
D_802B62E0 = 0xA;
|
||||
playerStatus->fallState++;
|
||||
suggest_player_anim_setUnkFlag(ANIM_Mario_80003);
|
||||
playerStatus->position.y = hitPosY;
|
||||
D_802B62E0 = 10;
|
||||
playerStatus->actionSubstate++; // SUBSTATE_CRASH
|
||||
}
|
||||
break;
|
||||
case 3:
|
||||
case SUBSTATE_CRASH:
|
||||
if (playerStatus->unk_BC != 0) {
|
||||
suggest_player_anim_setUnkFlag(0x10030);
|
||||
playerStatus->fallState = 5;
|
||||
suggest_player_anim_setUnkFlag(ANIM_Mario_GetUp);
|
||||
playerStatus->actionSubstate = SUBSTATE_GET_UP;
|
||||
playerStatus->currentStateTime = 15;
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case 5:
|
||||
case SUBSTATE_GET_UP:
|
||||
if (playerStatus->currentStateTime != 0) {
|
||||
playerStatus->currentStateTime--;
|
||||
break;
|
||||
|
@ -1,54 +1,58 @@
|
||||
#include "common.h"
|
||||
|
||||
extern s32 D_802B6ED0; // some entity index
|
||||
extern s32 SpinningFlower_EntityIndex;
|
||||
extern f32 D_802B6ED4;
|
||||
extern f32 D_802B6ED8;
|
||||
extern f32 D_802B6EDC;
|
||||
extern f32 D_802B6EE0;
|
||||
extern f32 D_802B6EE4;
|
||||
extern f32 D_802B6EE8;
|
||||
extern f32 D_802B6EEC;
|
||||
extern f32 SpinningFlower_AngleToCenter;
|
||||
extern f32 D_802B6EF0;
|
||||
extern f32 D_802B6EF4;
|
||||
extern s16 D_802BCE30;
|
||||
extern s16 D_802BCE32;
|
||||
extern s16 D_802BCE34;
|
||||
|
||||
s32 func_802B6000_E29470(void) {
|
||||
f32 sp28;
|
||||
f32 sp2C;
|
||||
f32 sp30;
|
||||
f32 sp34;
|
||||
f32 sp38;
|
||||
f32 sp3C;
|
||||
f32 sp40;
|
||||
f32 sp44;
|
||||
enum {
|
||||
SUBSTATE_ATTRACT = 1,
|
||||
SUBSTATE_EJECT = 2,
|
||||
SUBSTATE_SPIN_UP = 3,
|
||||
SUBSTATE_ASCEND_A = 4,
|
||||
SUBSTATE_ASCEND_B = 5,
|
||||
SUBSTATE_BOOST = 10,
|
||||
SUBSTATE_FINISH = 11,
|
||||
};
|
||||
|
||||
sp28 = gPlayerStatus.position.x;
|
||||
sp34 = gPlayerStatus.colliderHeight;
|
||||
sp30 = gPlayerStatus.position.z;
|
||||
sp2C = gPlayerStatus.position.y + (sp34 * 0.5);
|
||||
return player_raycast_below_cam_relative(&gPlayerStatus, &sp28, &sp2C, &sp30, &sp34, &sp38, &sp3C, &sp40, &sp44);
|
||||
static s32 get_entity_below_spinning_flower(void) {
|
||||
f32 posX, posY, posZ, height;
|
||||
f32 hitRx, hitRz, hitDirX, hitDirZ;
|
||||
|
||||
posX = gPlayerStatus.position.x;
|
||||
posZ = gPlayerStatus.position.z;
|
||||
height = gPlayerStatus.colliderHeight;
|
||||
posY = gPlayerStatus.position.y + (height * 0.5);
|
||||
return player_raycast_below_cam_relative(&gPlayerStatus, &posX, &posY, &posZ, &height, &hitRx, &hitRz, &hitDirX, &hitDirZ);
|
||||
}
|
||||
|
||||
void func_802B60A4_E29514(void) {
|
||||
void action_update_use_spinning_flower(void) {
|
||||
PlayerStatus* playerStatus = &gPlayerStatus;
|
||||
Entity* entityByIndex;
|
||||
s32* TempPointer;
|
||||
s32 sp20;
|
||||
f32 sp1C;
|
||||
f32 sp18;
|
||||
f32 sp14;
|
||||
f32 sp10;
|
||||
f32 tempY;
|
||||
f32 tempDistance;
|
||||
s32 entityID;
|
||||
f32 inputMagnitude;
|
||||
f32 inputAngle;
|
||||
f32 dz;
|
||||
f32 dx;
|
||||
f32 ascentVelocity;
|
||||
f32 distToCenter;
|
||||
s8 switchCondition;
|
||||
|
||||
if (playerStatus->flags & (1 << 31)) {
|
||||
playerStatus->flags &= ~0x80000000;
|
||||
if (playerStatus->flags & PLAYER_STATUS_FLAGS_ACTION_STATE_CHANGED) {
|
||||
playerStatus->flags &= ~PLAYER_STATUS_FLAGS_ACTION_STATE_CHANGED;
|
||||
gOverrideFlags |= GLOBAL_OVERRIDES_40;
|
||||
func_800EF300();
|
||||
playerStatus->fallState = 1;
|
||||
playerStatus->actionSubstate = SUBSTATE_ATTRACT;
|
||||
playerStatus->currentStateTime = 0;
|
||||
D_802B6EE4 = 0.0f;
|
||||
D_802B6EE8 = 0.0f;
|
||||
@ -56,27 +60,29 @@ void func_802B60A4_E29514(void) {
|
||||
D_802B6EDC = 3.0f;
|
||||
disable_player_static_collisions();
|
||||
disable_player_input();
|
||||
playerStatus->flags |= 0x100000;
|
||||
sp20 = gCollisionStatus.currentFloor;
|
||||
playerStatus->flags |= PLAYER_STATUS_FLAGS_100000;
|
||||
entityID = gCollisionStatus.currentFloor;
|
||||
|
||||
TempPointer = &D_802B6ED0;
|
||||
if (sp20 >= 0){
|
||||
if (!(sp20 & COLLISION_WITH_ENTITY_BIT)) {
|
||||
D_802B6ED0 = -1;
|
||||
TempPointer = &SpinningFlower_EntityIndex;
|
||||
if (entityID >= 0){
|
||||
if (!(entityID & COLLISION_WITH_ENTITY_BIT)) {
|
||||
SpinningFlower_EntityIndex = -1;
|
||||
} else {
|
||||
D_802B6ED0 = sp20 & 0x3FF;
|
||||
SpinningFlower_EntityIndex = entityID & 0x3FF;
|
||||
}
|
||||
} else {
|
||||
D_802B6ED0 = -1;
|
||||
SpinningFlower_EntityIndex = -1;
|
||||
}
|
||||
if (!(playerStatus->animFlags & (PLAYER_STATUS_ANIM_FLAGS_HOLDING_WATT | PLAYER_STATUS_ANIM_FLAGS_2))) {
|
||||
suggest_player_anim_clearUnkFlag(0x1002B);
|
||||
suggest_player_anim_clearUnkFlag(ANIM_Mario_1002B);
|
||||
}
|
||||
}
|
||||
switch (playerStatus->fallState) {
|
||||
case 1:
|
||||
|
||||
switch (playerStatus->actionSubstate) {
|
||||
case SUBSTATE_ATTRACT:
|
||||
gOverrideFlags |= GLOBAL_OVERRIDES_40;
|
||||
if (++D_802B6EE4 >= 20.0f) {
|
||||
D_802B6EE4 += 1.0f;
|
||||
if (D_802B6EE4 >= 20.0f) {
|
||||
D_802B6EE4 = 20.0f;
|
||||
}
|
||||
playerStatus->spriteFacingAngle = clamp_angle(playerStatus->spriteFacingAngle + D_802B6EE4);
|
||||
@ -86,72 +92,73 @@ void func_802B60A4_E29514(void) {
|
||||
}
|
||||
D_802B6EE8 += 8.0f;
|
||||
playerStatus->position.y = D_802B6EF4 + sin_rad(clamp_angle(D_802B6EE8) * TAU / 360.0f) * 4.0f;
|
||||
if (D_802B6ED0 >= 0) {
|
||||
entityByIndex = get_entity_by_index(D_802B6ED0);
|
||||
tempDistance = dist2D(entityByIndex->position.x, entityByIndex->position.z, playerStatus->position.x, playerStatus->position.z);
|
||||
D_802B6EEC = atan2(entityByIndex->position.x, entityByIndex->position.z, playerStatus->position.x, playerStatus->position.z);
|
||||
if (tempDistance > 4.0f) {
|
||||
tempDistance--;
|
||||
if (SpinningFlower_EntityIndex >= 0) {
|
||||
entityByIndex = get_entity_by_index(SpinningFlower_EntityIndex);
|
||||
distToCenter = dist2D(entityByIndex->position.x, entityByIndex->position.z, playerStatus->position.x, playerStatus->position.z);
|
||||
SpinningFlower_AngleToCenter = atan2(entityByIndex->position.x, entityByIndex->position.z, playerStatus->position.x, playerStatus->position.z);
|
||||
if (distToCenter > 4.0f) {
|
||||
distToCenter--;
|
||||
}
|
||||
sin_cos_rad(D_802B6EEC * TAU / 360.0f, &sp10, &sp14);
|
||||
playerStatus->position.x = entityByIndex->position.x + (sp10 * tempDistance);
|
||||
playerStatus->position.z = entityByIndex->position.z - (sp14 * tempDistance);
|
||||
sin_cos_rad((D_802B6EEC - 91.0f) * TAU / 360.0f, &sp10, &sp14);
|
||||
D_802B6ED4 = sp10 * D_802B6EDC;
|
||||
D_802B6ED8 = -sp14 * D_802B6EDC;
|
||||
sin_cos_rad(SpinningFlower_AngleToCenter * TAU / 360.0f, &dx, &dz);
|
||||
playerStatus->position.x = entityByIndex->position.x + (dx * distToCenter);
|
||||
playerStatus->position.z = entityByIndex->position.z - (dz * distToCenter);
|
||||
sin_cos_rad((SpinningFlower_AngleToCenter - 91.0f) * TAU / 360.0f, &dx, &dz);
|
||||
D_802B6ED4 = dx * D_802B6EDC;
|
||||
D_802B6ED8 = -dz * D_802B6EDC;
|
||||
}
|
||||
game_input_to_move_vector(&sp18, &sp1C);
|
||||
if (sp1C != 0.0f) {
|
||||
sin_cos_rad((sp18 * TAU) / 360.0f, &sp10, &sp14);
|
||||
sp1C *= 0.03125f;
|
||||
if (sp1C < 0.1) {
|
||||
sp1C = 0.1f;
|
||||
game_input_to_move_vector(&inputAngle, &inputMagnitude);
|
||||
if (inputMagnitude != 0.0f) {
|
||||
sin_cos_rad((inputAngle * TAU) / 360.0f, &dx, &dz);
|
||||
inputMagnitude *= 0.03125f;
|
||||
if (inputMagnitude < 0.1) {
|
||||
inputMagnitude = 0.1f;
|
||||
}
|
||||
playerStatus->position.x += sp10 * sp1C;
|
||||
playerStatus->position.z -= sp14 * sp1C;
|
||||
playerStatus->position.x += dx * inputMagnitude;
|
||||
playerStatus->position.z -= dz * inputMagnitude;
|
||||
}
|
||||
gCameras[CAM_DEFAULT].targetPos.x = playerStatus->position.x;
|
||||
gCameras[CAM_DEFAULT].targetPos.y = playerStatus->position.y;
|
||||
gCameras[CAM_DEFAULT].targetPos.z = playerStatus->position.z;
|
||||
sp20 = func_802B6000_E29470();
|
||||
if (sp20 < 0 || !(sp20 & COLLISION_WITH_ENTITY_BIT)) {
|
||||
entityID = get_entity_below_spinning_flower();
|
||||
if (entityID < 0 || !(entityID & COLLISION_WITH_ENTITY_BIT)) {
|
||||
playerStatus->currentStateTime = 20;
|
||||
D_802B6EE8 = 0.0f;
|
||||
D_802B6EF4 = playerStatus->position.y;
|
||||
playerStatus->fallState++;
|
||||
playerStatus->actionSubstate++;
|
||||
D_802B6EF0 = 1.6f;
|
||||
playerStatus->flags |= 0x800000;
|
||||
playerStatus->flags |= PLAYER_STATUS_FLAGS_800000;
|
||||
}
|
||||
if (gGameStatusPtr->pressedButtons[0] & BUTTON_Z && !(playerStatus->animFlags & (PLAYER_STATUS_ANIM_FLAGS_HOLDING_WATT | PLAYER_STATUS_ANIM_FLAGS_2))) {
|
||||
suggest_player_anim_setUnkFlag(0x10007);
|
||||
playerStatus->fallState = 3;
|
||||
if (gGameStatusPtr->pressedButtons[0] & BUTTON_Z &&
|
||||
!(playerStatus->animFlags & (PLAYER_STATUS_ANIM_FLAGS_HOLDING_WATT | PLAYER_STATUS_ANIM_FLAGS_2))) {
|
||||
suggest_player_anim_setUnkFlag(ANIM_Mario_AnimMidairStill);
|
||||
playerStatus->actionSubstate = SUBSTATE_SPIN_UP;
|
||||
playerStatus->currentStateTime = 30;
|
||||
D_802B6EE0 = 0.0f;
|
||||
gCollisionStatus.currentFloor = -1;
|
||||
exec_entity_commandlist(get_entity_by_index(D_802B6ED0));
|
||||
exec_entity_commandlist(get_entity_by_index(SpinningFlower_EntityIndex));
|
||||
}
|
||||
break;
|
||||
case 2:
|
||||
case SUBSTATE_EJECT:
|
||||
gOverrideFlags |= GLOBAL_OVERRIDES_40;
|
||||
if (--D_802B6EE4 < 0.0f) {
|
||||
D_802B6EE4 = 0.0f;
|
||||
playerStatus->flags &= ~0x100000;
|
||||
playerStatus->flags &= ~PLAYER_STATUS_FLAGS_100000;
|
||||
}
|
||||
playerStatus->spriteFacingAngle = clamp_angle(playerStatus->spriteFacingAngle + D_802B6EE4);
|
||||
sin_cos_rad((D_802B6EEC - 60.0f) * TAU / 360.0f, &sp10, &sp14);
|
||||
sin_cos_rad((SpinningFlower_AngleToCenter - 60.0f) * TAU / 360.0f, &dx, &dz);
|
||||
D_802B6EDC += 0.2;
|
||||
D_802B6EF0 -= 0.72;
|
||||
D_802B6ED4 = sp10 * D_802B6EDC;
|
||||
D_802B6ED8 = -sp14 * D_802B6EDC;
|
||||
D_802B6ED4 = dx * D_802B6EDC;
|
||||
D_802B6ED8 = -dz * D_802B6EDC;
|
||||
playerStatus->position.x += D_802B6ED4;
|
||||
playerStatus->position.z += D_802B6ED8;
|
||||
collision_lava_reset_check_additional_overlaps();
|
||||
playerStatus->position.y = player_check_collision_below(D_802B6EF0, &sp20);
|
||||
playerStatus->position.y = player_check_collision_below(D_802B6EF0, &entityID);
|
||||
gCameras[CAM_DEFAULT].targetPos.x = playerStatus->position.x;
|
||||
gCameras[CAM_DEFAULT].targetPos.y = playerStatus->position.y;
|
||||
gCameras[CAM_DEFAULT].targetPos.z = playerStatus->position.z;
|
||||
if (sp20 >= 0) {
|
||||
playerStatus->flags &= ~0x100000;
|
||||
if (entityID >= 0) {
|
||||
playerStatus->flags &= ~PLAYER_STATUS_FLAGS_100000;
|
||||
enable_player_input();
|
||||
enable_player_static_collisions();
|
||||
set_action_state(ACTION_STATE_LAND);
|
||||
@ -161,22 +168,21 @@ void func_802B60A4_E29514(void) {
|
||||
}
|
||||
}
|
||||
|
||||
switchCondition = playerStatus->fallState - 3;
|
||||
switch (switchCondition) {
|
||||
case 0:
|
||||
if (D_802B6ED0 >= 0) {
|
||||
entityByIndex = get_entity_by_index(D_802B6ED0);
|
||||
tempDistance = dist2D(entityByIndex->position.x, entityByIndex->position.z, playerStatus->position.x, playerStatus->position.z);
|
||||
D_802B6EEC = atan2(entityByIndex->position.x, entityByIndex->position.z, playerStatus->position.x, playerStatus->position.z);
|
||||
if (tempDistance > 4.0f) {
|
||||
tempDistance -= 1.0f;
|
||||
switch (playerStatus->actionSubstate) {
|
||||
case SUBSTATE_SPIN_UP:
|
||||
if (SpinningFlower_EntityIndex >= 0) {
|
||||
entityByIndex = get_entity_by_index(SpinningFlower_EntityIndex);
|
||||
distToCenter = dist2D(entityByIndex->position.x, entityByIndex->position.z, playerStatus->position.x, playerStatus->position.z);
|
||||
SpinningFlower_AngleToCenter = atan2(entityByIndex->position.x, entityByIndex->position.z, playerStatus->position.x, playerStatus->position.z);
|
||||
if (distToCenter > 4.0f) {
|
||||
distToCenter -= 1.0f;
|
||||
}
|
||||
sin_cos_rad(D_802B6EEC * TAU / 360.0f, &sp10, &sp14);
|
||||
playerStatus->position.x = entityByIndex->position.x + (sp10 * tempDistance);
|
||||
playerStatus->position.z = entityByIndex->position.z - (sp14 * tempDistance);
|
||||
sin_cos_rad((D_802B6EEC - 91.0f) * TAU / 360.0f, &sp10, &sp14);
|
||||
D_802B6ED4 = sp10 * D_802B6EDC;
|
||||
D_802B6ED8 = -sp14 * D_802B6EDC;
|
||||
sin_cos_rad(SpinningFlower_AngleToCenter * TAU / 360.0f, &dx, &dz);
|
||||
playerStatus->position.x = entityByIndex->position.x + (dx * distToCenter);
|
||||
playerStatus->position.z = entityByIndex->position.z - (dz * distToCenter);
|
||||
sin_cos_rad((SpinningFlower_AngleToCenter - 91.0f) * TAU / 360.0f, &dx, &dz);
|
||||
D_802B6ED4 = dx * D_802B6EDC;
|
||||
D_802B6ED8 = -dz * D_802B6EDC;
|
||||
}
|
||||
D_802B6EE8 += 8.0f;
|
||||
|
||||
@ -193,11 +199,11 @@ void func_802B60A4_E29514(void) {
|
||||
playerStatus->spriteFacingAngle = clamp_angle(playerStatus->spriteFacingAngle + D_802B6EE4);
|
||||
break;
|
||||
}
|
||||
playerStatus->fallState++;
|
||||
playerStatus->actionSubstate++; // SUBSTATE_ASCEND_A
|
||||
playerStatus->currentStateTime = 30;
|
||||
phys_adjust_cam_on_landing();
|
||||
break;
|
||||
case 1:
|
||||
case SUBSTATE_ASCEND_A:
|
||||
D_802B6EE4 += 2.0f;
|
||||
if (D_802B6EE4 >= 45.0f) {
|
||||
D_802B6EE4 = 45.0f;
|
||||
@ -208,51 +214,52 @@ void func_802B60A4_E29514(void) {
|
||||
D_802B6EE0 = 45.0f;
|
||||
}
|
||||
|
||||
tempY = sin_rad(D_802B6EE0 * TAU / 360.0f) * 4.0f;
|
||||
playerStatus->position.y += tempY;
|
||||
ascentVelocity = sin_rad(D_802B6EE0 * TAU / 360.0f) * 4.0f;
|
||||
playerStatus->position.y += ascentVelocity;
|
||||
gCameras[CAM_DEFAULT].targetPos.x = playerStatus->position.x;
|
||||
gCameras[CAM_DEFAULT].targetPos.y = playerStatus->position.y;
|
||||
gCameras[CAM_DEFAULT].targetPos.z = playerStatus->position.z;
|
||||
tempDistance = fabsf(dist2D(D_802BCE34, D_802BCE32, playerStatus->position.x, playerStatus->position.z));
|
||||
if (tempDistance > 40.0f) {
|
||||
distToCenter = fabsf(dist2D(D_802BCE34, D_802BCE32, playerStatus->position.x, playerStatus->position.z));
|
||||
if (distToCenter > 40.0f) {
|
||||
if (D_802BCE30 + 30 < playerStatus->position.y) {
|
||||
playerStatus->fallState++;
|
||||
sp18 = atan2(playerStatus->position.x, playerStatus->position.z, D_802BCE34, D_802BCE32);
|
||||
sin_cos_rad(sp18 * TAU / 360.0f, &sp10, &sp14);
|
||||
playerStatus->actionSubstate++; // SUBSTATE_ASCEND_B
|
||||
inputAngle = atan2(playerStatus->position.x, playerStatus->position.z, D_802BCE34, D_802BCE32);
|
||||
sin_cos_rad(inputAngle * TAU / 360.0f, &dx, &dz);
|
||||
playerStatus->currentStateTime = 64;
|
||||
D_802B6EEC = sp18;
|
||||
D_802B6ED4 = (sp10 * tempDistance) * 0.015625;
|
||||
D_802B6ED8 = (-sp14 * tempDistance) * 0.015625;
|
||||
SpinningFlower_AngleToCenter = inputAngle;
|
||||
D_802B6ED4 = (dx * distToCenter) * 0.015625;
|
||||
D_802B6ED8 = (-dz * distToCenter) * 0.015625;
|
||||
}
|
||||
break;
|
||||
}
|
||||
if (playerStatus->currentStateTime == 0) {
|
||||
playerStatus->fallState = 0xA;
|
||||
playerStatus->actionSubstate = SUBSTATE_BOOST;
|
||||
playerStatus->currentStateTime = 20;
|
||||
} else {
|
||||
playerStatus->currentStateTime--;
|
||||
}
|
||||
break;
|
||||
case 2:
|
||||
case SUBSTATE_ASCEND_B:
|
||||
playerStatus->spriteFacingAngle = clamp_angle(playerStatus->spriteFacingAngle + D_802B6EE4);
|
||||
if (playerStatus->currentStateTime != 0) {
|
||||
playerStatus->currentStateTime--;
|
||||
if (D_802B6EE0-- < 0.0f) {
|
||||
D_802B6EE0 = 0.0f;
|
||||
}
|
||||
tempY = 2.0f * sin_rad(D_802B6EE0 * TAU / 360.0f);
|
||||
ascentVelocity = 2.0f * sin_rad(D_802B6EE0 * TAU / 360.0f);
|
||||
playerStatus->position.x += D_802B6ED4;
|
||||
playerStatus->position.y += tempY;
|
||||
playerStatus->position.y += ascentVelocity;
|
||||
playerStatus->position.z += D_802B6ED8;
|
||||
} else {
|
||||
playerStatus->fallState = 0xB;
|
||||
playerStatus->actionSubstate = SUBSTATE_FINISH;
|
||||
}
|
||||
gCameras[CAM_DEFAULT].targetPos.x = playerStatus->position.x;
|
||||
gCameras[CAM_DEFAULT].targetPos.y = playerStatus->position.y;
|
||||
gCameras[CAM_DEFAULT].targetPos.z = playerStatus->position.z;
|
||||
break;
|
||||
case 7:
|
||||
if (++D_802B6EE4 >= 45.0f) {
|
||||
case SUBSTATE_BOOST:
|
||||
D_802B6EE4 += 1.0f;
|
||||
if (D_802B6EE4 >= 45.0f) {
|
||||
D_802B6EE4 = 45.0f;
|
||||
}
|
||||
playerStatus->spriteFacingAngle = clamp_angle(playerStatus->spriteFacingAngle + D_802B6EE4);
|
||||
@ -260,13 +267,13 @@ void func_802B60A4_E29514(void) {
|
||||
if (D_802B6EE0 > 45.0f) {
|
||||
D_802B6EE0 = 45.0f;
|
||||
}
|
||||
tempY = sin_rad(D_802B6EE0 * TAU / 360.0f) * 3.0f;
|
||||
playerStatus->position.y += tempY;
|
||||
ascentVelocity = sin_rad(D_802B6EE0 * TAU / 360.0f) * 3.0f;
|
||||
playerStatus->position.y += ascentVelocity;
|
||||
if (playerStatus->currentStateTime != 0) {
|
||||
playerStatus->currentStateTime--;
|
||||
break;
|
||||
}
|
||||
case 8:
|
||||
case SUBSTATE_FINISH:
|
||||
enable_player_static_collisions();
|
||||
enable_player_input();
|
||||
playerStatus->flags &= ~0x100000;
|
||||
|
@ -4,7 +4,12 @@
|
||||
|
||||
extern struct TweesterPhysics* PlayerTweesterPhysics;
|
||||
|
||||
void func_802B6000_E2A340(void) {
|
||||
enum {
|
||||
SUBSTATE_LAUNCH = 0,
|
||||
SUBSTATE_DONE = 1
|
||||
};
|
||||
|
||||
void action_update_use_tweester(void) {
|
||||
PlayerStatus* playerStatus = &gPlayerStatus;
|
||||
f32 sinAngle, cosAngle, liftoffVelocity;
|
||||
Entity* entity;
|
||||
@ -15,19 +20,19 @@ void func_802B6000_E2A340(void) {
|
||||
disable_player_static_collisions();
|
||||
disable_player_input();
|
||||
playerStatus->flags |= (PLAYER_STATUS_FLAGS_100000 | PLAYER_STATUS_FLAGS_FLYING);
|
||||
suggest_player_anim_clearUnkFlag(0x8001F);
|
||||
playerStatus->fallState = 0;
|
||||
mem_clear(PlayerTweesterPhysics, sizeof(TweesterPhysics));
|
||||
suggest_player_anim_clearUnkFlag(ANIM_Mario_8001F);
|
||||
playerStatus->actionSubstate = SUBSTATE_LAUNCH;
|
||||
mem_clear(PlayerTweesterPhysics, sizeof(*PlayerTweesterPhysics));
|
||||
PlayerTweesterPhysics->radius = fabsf(dist2D(playerStatus->position.x, playerStatus->position.z, entity->position.x, entity->position.z));
|
||||
PlayerTweesterPhysics->angle = atan2(entity->position.x, entity->position.z, playerStatus->position.x, playerStatus->position.z);
|
||||
PlayerTweesterPhysics->angularVelocity = 6.0f;
|
||||
PlayerTweesterPhysics->liftoffVelocityPhase = 50.0f;
|
||||
PlayerTweesterPhysics->countdown = 0x78;
|
||||
sfx_play_sound_at_player(SOUND_2F6, 0);
|
||||
PlayerTweesterPhysics->countdown = 120;
|
||||
sfx_play_sound_at_player(SOUND_TWEESTER_LAUNCH, 0);
|
||||
}
|
||||
|
||||
switch (playerStatus->fallState) {
|
||||
case 0:
|
||||
switch (playerStatus->actionSubstate) {
|
||||
case SUBSTATE_LAUNCH:
|
||||
sin_cos_rad((PlayerTweesterPhysics->angle * TAU) / 360.0f, &sinAngle, &cosAngle);
|
||||
|
||||
playerStatus->position.x = entity->position.x + (sinAngle * PlayerTweesterPhysics->radius);
|
||||
@ -54,14 +59,14 @@ void func_802B6000_E2A340(void) {
|
||||
PlayerTweesterPhysics->angularVelocity = 40.0f;
|
||||
}
|
||||
if (--PlayerTweesterPhysics->countdown == 0) {
|
||||
playerStatus->fallState++;
|
||||
playerStatus->actionSubstate++; // SUBSTATE_DONE
|
||||
entity_start_script(entity);
|
||||
}
|
||||
break;
|
||||
case 1:
|
||||
case SUBSTATE_DONE:
|
||||
disable_player_shadow();
|
||||
disable_npc_shadow(wPartnerNpc);
|
||||
playerStatus->blinkTimer = 0x32;
|
||||
playerStatus->blinkTimer = 50;
|
||||
enable_player_static_collisions();
|
||||
enable_player_input();
|
||||
playerStatus->flags &= ~(PLAYER_STATUS_FLAGS_100000 | PLAYER_STATUS_FLAGS_FLYING);
|
||||
|
@ -1,44 +1,43 @@
|
||||
#include "common.h"
|
||||
#include "world/actions.h"
|
||||
|
||||
s32 WalkPeachAnims[] = {
|
||||
0x000A0002, // none
|
||||
0x000A002B, // cream
|
||||
0x000A002D, // strawberry
|
||||
0x000A002F, // butter
|
||||
0x000A0031, // cleanser
|
||||
0x000A0033, // water
|
||||
0x000A0035, // milk
|
||||
0x000A0037, // flour
|
||||
0x000A0039, // egg
|
||||
0x000A003B, // complete cake
|
||||
0x000A003D, // cake bowl
|
||||
0x000A003F, // cake mixed
|
||||
0x000A0041, // cake pan
|
||||
0x000A0043, // cake batter
|
||||
0x000A0045, // cake bare
|
||||
0x000A0047, // salt
|
||||
0x000A0049, // sugar
|
||||
0x000A004B, // cake with icing
|
||||
0x000A004D, // cake with berries
|
||||
AnimID WalkPeachAnims[] = {
|
||||
ANIM_Peach_A0002, // none
|
||||
ANIM_Peach_A002B, // cream
|
||||
ANIM_Peach_A002D, // strawberry
|
||||
ANIM_Peach_A002F, // butter
|
||||
ANIM_Peach_A0031, // cleanser
|
||||
ANIM_Peach_A0033, // water
|
||||
ANIM_Peach_A0035, // milk
|
||||
ANIM_Peach_A0037, // flour
|
||||
ANIM_Peach_A0039, // egg
|
||||
ANIM_Peach_A003B, // complete cake
|
||||
ANIM_Peach_A003D, // cake bowl
|
||||
ANIM_Peach_A003F, // cake mixed
|
||||
ANIM_Peach_A0041, // cake pan
|
||||
ANIM_Peach_A0043, // cake batter
|
||||
ANIM_Peach_A0045, // cake bare
|
||||
ANIM_Peach_A0047, // salt
|
||||
ANIM_Peach_A0049, // sugar
|
||||
ANIM_Peach_A004B, // cake with icing
|
||||
ANIM_Peach_A004D, // cake with berries
|
||||
0x00000000
|
||||
};
|
||||
|
||||
void action_run_update_peach(void);
|
||||
void func_802B65E8_E23CC8(void);
|
||||
static void action_update_run_peach(void);
|
||||
static void action_update_walk_peach(void);
|
||||
|
||||
// walk
|
||||
void func_802B6000_E236E0(void) {
|
||||
void action_update_walk(void) {
|
||||
PlayerStatus* playerStatus = &gPlayerStatus;
|
||||
PlayerData* playerData = &gPlayerData;
|
||||
f32 moveVectorMagnitude;
|
||||
f32 moveVectorAngle;
|
||||
s32 stickAxisX;
|
||||
s32 stickAxisY;
|
||||
s32 playerAnim;
|
||||
AnimID anim;
|
||||
s32 changedAnim = FALSE;
|
||||
if (playerStatus->animFlags & PLAYER_STATUS_ANIM_FLAGS_USING_PEACH_PHYSICS) {
|
||||
func_802B65E8_E23CC8();
|
||||
action_update_walk_peach();
|
||||
return;
|
||||
}
|
||||
|
||||
@ -53,15 +52,15 @@ void func_802B6000_E236E0(void) {
|
||||
}
|
||||
|
||||
if (playerStatus->animFlags & PLAYER_STATUS_ANIM_FLAGS_8BIT_MARIO) {
|
||||
playerAnim = 0x90003;
|
||||
anim = ANIM_Mario_90003;
|
||||
}
|
||||
else if (!(playerStatus->animFlags & PLAYER_STATUS_ANIM_FLAGS_HOLDING_WATT)) {
|
||||
playerAnim = 0x10004;
|
||||
anim = ANIM_Mario_Walking;
|
||||
}
|
||||
else {
|
||||
playerAnim = 0x60000;
|
||||
anim = ANIM_Mario_60000;
|
||||
}
|
||||
suggest_player_anim_clearUnkFlag(playerAnim);
|
||||
suggest_player_anim_clearUnkFlag(anim);
|
||||
}
|
||||
|
||||
if (playerStatus->flags & PLAYER_STATUS_ANIM_FLAGS_8BIT_MARIO) {
|
||||
@ -81,7 +80,7 @@ void func_802B6000_E236E0(void) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (fabsf(D_800F7B40 - moveVectorAngle) <= 90.0f && abs(moveVectorMagnitude - D_800F7B44) < 20) {
|
||||
if (fabsf(PrevPlayerCamRelativeYaw - moveVectorAngle) <= 90.0f && abs(moveVectorMagnitude - D_800F7B44) < 20) {
|
||||
if (!(playerStatus->animFlags & PLAYER_STATUS_ANIM_FLAGS_80000000)) {
|
||||
if (moveVectorMagnitude >= 20.0f) {
|
||||
playerStatus->targetYaw = moveVectorAngle;
|
||||
@ -111,25 +110,25 @@ void func_802B6000_E236E0(void) {
|
||||
}
|
||||
}
|
||||
|
||||
// run
|
||||
void action_run_update(void) {
|
||||
void action_update_run(void) {
|
||||
PlayerStatus* playerStatus = &gPlayerStatus;
|
||||
PlayerData* playerData = &gPlayerData;
|
||||
f32 moveX;
|
||||
f32 moveY;
|
||||
s32 temp_v1;
|
||||
s32 phi_a0;
|
||||
f32 phi_f2;
|
||||
AnimID anim;
|
||||
f32 runSpeedModifier;
|
||||
s32 phi_s3;
|
||||
|
||||
phi_s3 = 0;
|
||||
if (playerStatus->animFlags & PLAYER_STATUS_ANIM_FLAGS_USING_PEACH_PHYSICS) {
|
||||
action_run_update_peach();
|
||||
action_update_run_peach();
|
||||
return;
|
||||
}
|
||||
|
||||
if (playerStatus->flags & PLAYER_STATUS_FLAGS_ACTION_STATE_CHANGED) {
|
||||
playerStatus->flags &= ~0x80880000;
|
||||
playerStatus->flags &= ~(PLAYER_STATUS_FLAGS_ACTION_STATE_CHANGED |
|
||||
PLAYER_STATUS_FLAGS_800000 | PLAYER_STATUS_FLAGS_80000);
|
||||
D_8010C980 = 0;
|
||||
playerStatus->unk_60 = 0;
|
||||
phi_s3 = 1;
|
||||
@ -138,31 +137,31 @@ void action_run_update(void) {
|
||||
playerStatus->currentSpeed = playerStatus->runSpeed;
|
||||
}
|
||||
if (playerStatus->animFlags & PLAYER_STATUS_ANIM_FLAGS_8BIT_MARIO) {
|
||||
phi_a0 = 0x90003;
|
||||
anim = ANIM_Mario_90003;
|
||||
} else {
|
||||
if (!(playerStatus->animFlags & PLAYER_STATUS_ANIM_FLAGS_HOLDING_WATT)) {
|
||||
phi_a0 = 0x10005;
|
||||
anim = ANIM_Mario_Running;
|
||||
} else {
|
||||
phi_a0 = 0x60002;
|
||||
anim = ANIM_Mario_60002;
|
||||
}
|
||||
}
|
||||
suggest_player_anim_clearUnkFlag(phi_a0);
|
||||
suggest_player_anim_clearUnkFlag(anim);
|
||||
}
|
||||
|
||||
if (playerStatus->flags & 0x00004000) {
|
||||
if (playerStatus->flags & PLAYER_STATUS_FLAGS_4000) {
|
||||
playerStatus->targetYaw = playerStatus->heading;
|
||||
try_player_footstep_sounds(4);
|
||||
return;
|
||||
}
|
||||
|
||||
D_8010C980++;
|
||||
phi_f2 = 1.0f;
|
||||
runSpeedModifier = 1.0f;
|
||||
|
||||
if (playerStatus->animFlags & 0x10000) {
|
||||
phi_f2 = 1.5f;
|
||||
if (playerStatus->animFlags & PLAYER_STATUS_ANIM_FLAGS_SPINNING) {
|
||||
runSpeedModifier = 1.5f;
|
||||
}
|
||||
|
||||
playerStatus->currentSpeed = playerStatus->runSpeed * phi_f2;
|
||||
playerStatus->currentSpeed = playerStatus->runSpeed * runSpeedModifier;
|
||||
player_input_to_move_vector(&moveX, &moveY);
|
||||
phys_update_interact_collider();
|
||||
if (check_input_jump() == FALSE) {
|
||||
@ -178,19 +177,16 @@ void action_run_update(void) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (fabsf(D_800F7B40 - moveX) <= 90.0f) {
|
||||
temp_v1 = playerStatus->animFlags;
|
||||
if (temp_v1 >= 0) {
|
||||
if (fabsf(PrevPlayerCamRelativeYaw - moveX) <= 90.0f) {
|
||||
if (!(playerStatus->animFlags & PLAYER_STATUS_ANIM_FLAGS_80000000)) {
|
||||
playerStatus->targetYaw = moveX;
|
||||
}
|
||||
playerStatus->animFlags &= ~0x80000000;
|
||||
playerStatus->animFlags &= ~PLAYER_STATUS_ANIM_FLAGS_80000000;
|
||||
} else {
|
||||
temp_v1 = playerStatus->animFlags;
|
||||
temp_v1 = temp_v1 < 0;
|
||||
if (temp_v1) {
|
||||
if (playerStatus->animFlags & PLAYER_STATUS_ANIM_FLAGS_80000000) {
|
||||
playerStatus->targetYaw = moveX;
|
||||
} else {
|
||||
playerStatus->animFlags |= 0x80000000;
|
||||
playerStatus->animFlags |= PLAYER_STATUS_ANIM_FLAGS_80000000;
|
||||
}
|
||||
}
|
||||
|
||||
@ -214,13 +210,13 @@ void func_802B6550_E23C30(void) {
|
||||
suggest_player_anim_clearUnkFlag(WalkPeachAnims[gGameStatusPtr->peachCookingIngredient]);
|
||||
return;
|
||||
}
|
||||
suggest_player_anim_clearUnkFlag(0xD000D);
|
||||
suggest_player_anim_clearUnkFlag(ANIM_Peach_D000D);
|
||||
return;
|
||||
}
|
||||
peach_set_disguise_anim(BasicPeachDisguiseAnims[gPlayerStatus.peachDisguise].walk);
|
||||
}
|
||||
|
||||
void func_802B65E8_E23CC8(void) {
|
||||
static void action_update_walk_peach(void) {
|
||||
PlayerStatus* playerStatus = &gPlayerStatus;
|
||||
f32 magnitude;
|
||||
f32 angle;
|
||||
@ -256,7 +252,7 @@ void func_802B65E8_E23CC8(void) {
|
||||
try_player_footstep_sounds(8);
|
||||
}
|
||||
|
||||
void action_run_update_peach(void) {
|
||||
static void action_update_run_peach(void) {
|
||||
PlayerStatus* playerStatus = &gPlayerStatus;
|
||||
GameStatus* gameStatus;
|
||||
f32 moveX;
|
||||
@ -273,12 +269,12 @@ void action_run_update_peach(void) {
|
||||
gameStatus = gGameStatusPtr;
|
||||
if (!(gameStatus->peachFlags & PEACH_STATUS_FLAG_HAS_INGREDIENT)) {
|
||||
if (!gameStatus->peachCookingIngredient) {
|
||||
suggest_player_anim_clearUnkFlag(0xA0003);
|
||||
suggest_player_anim_clearUnkFlag(ANIM_Peach_A0003);
|
||||
} else {
|
||||
suggest_player_anim_clearUnkFlag(WalkPeachAnims[gameStatus->peachCookingIngredient]);
|
||||
}
|
||||
} else {
|
||||
suggest_player_anim_clearUnkFlag(0xD000D);
|
||||
suggest_player_anim_clearUnkFlag(ANIM_Peach_D000D);
|
||||
}
|
||||
} else {
|
||||
peach_set_disguise_anim(BasicPeachDisguiseAnims[playerStatus->peachDisguise].run);
|
||||
|
@ -2,27 +2,38 @@
|
||||
#include "ld_addrs.h"
|
||||
#include "actions.h"
|
||||
|
||||
void action_idle_update(void);
|
||||
void func_802B6000_E24920(void);
|
||||
void action_run_update(void);
|
||||
void func_802B60B4_E240F4(void);
|
||||
void func_802B6198_E241D8(void);
|
||||
void func_802B6294_E242D4(void);
|
||||
void func_802B6348_E24388(void);
|
||||
void func_802B61C0_E24AE0(void);
|
||||
void func_802B6638_E29068(void);
|
||||
void func_802B6060_E27570(void);
|
||||
void action_hammer_update(void);
|
||||
void func_802B6350_E28D80(void);
|
||||
void func_802B6508_E28F38(void);
|
||||
void func_802B6230_E24800(void);
|
||||
void func_802B6120_E2A7D0(void);
|
||||
void func_802B63D4_E28E04(void);
|
||||
void func_802B6478_E28EA8(void);
|
||||
void func_802B60A4_E29514(void);
|
||||
void func_802B609C_E28ACC(void);
|
||||
void action_update_idle(void);
|
||||
void action_update_walk(void);
|
||||
void action_update_run(void);
|
||||
void action_update_land(void);
|
||||
void action_update_jump(void);
|
||||
void action_update_landing_on_switch(void);
|
||||
void action_update_falling(void);
|
||||
void action_update_step_down(void);
|
||||
void action_update_step_down_land(void);
|
||||
void action_update_spin_jump(void);
|
||||
void action_update_tornado_jump(void);
|
||||
void action_update_talk(void);
|
||||
void action_update_sliding(void);
|
||||
void action_update_hammer(void);
|
||||
void action_update_launch(void);
|
||||
void action_update_pushing_block(void);
|
||||
void action_update_hit_fire(void);
|
||||
void action_update_knockback(void);
|
||||
void action_update_hit_lava(void);
|
||||
void action_update_parasol(void);
|
||||
void action_update_spin(void);
|
||||
void action_update_step_up_peach(void);
|
||||
void action_update_ride(void);
|
||||
void action_update_step_up(void);
|
||||
void action_update_first_strike(void);
|
||||
void action_update_raise_arms(void);
|
||||
void action_update_use_spinning_flower(void);
|
||||
void action_update_use_munchlesia(void);
|
||||
void action_update_use_tweester(void);
|
||||
void action_update_state_23(void);
|
||||
|
||||
s32 D_800F7B40 = 0;
|
||||
s32 PrevPlayerCamRelativeYaw = 0;
|
||||
s32 D_800F7B44 = 0;
|
||||
f32 D_800F7B48 = 0.0f;
|
||||
s32 D_800F7B4C = 0;
|
||||
@ -36,15 +47,15 @@ f32 D_800F7B74 = 4.0f; // run
|
||||
f32 D_800F7B78 = 32.0f; // max jump
|
||||
f32 D_800F7B7C = -32.0f; // ???
|
||||
|
||||
s16 D_800F7B80 = 0;
|
||||
s16 FootstepSoundSelector = 0;
|
||||
s32 D_800F7B84[] = { 0, 0, 0};
|
||||
f32 D_800F7B90 = 0.0;
|
||||
|
||||
s32 ClubbaDisguiseExtraAnims[] = { 0x00390000, 0x00390002, 0x00390003, 0x00390004, 0x00390005, 0x00390008, 0x00390007, 0x00390013, 0x00390014, ANIM_LIST_END };
|
||||
AnimID ClubbaDisguiseExtraAnims[] = { 0x00390000, 0x00390002, 0x00390003, 0x00390004, 0x00390005, 0x00390008, 0x00390007, 0x00390013, 0x00390014, ANIM_LIST_END };
|
||||
|
||||
s32 HammerBroDisguiseExtraAnims[] = { 0x005A0000, 0x005A0002, 0x005A0003, 0x005A0004, 0x005A0006, 0x005A0007, 0x005A0009, 0x005A000A, 0x005A000B, 0x005A001A, ANIM_LIST_END };
|
||||
AnimID HammerBroDisguiseExtraAnims[] = { 0x005A0000, 0x005A0002, 0x005A0003, 0x005A0004, 0x005A0006, 0x005A0007, 0x005A0009, 0x005A000A, 0x005A000B, 0x005A001A, ANIM_LIST_END };
|
||||
|
||||
s32 KoopatrolDisguiseExtraAnims[] = { 0x00580000, 0x00580001, 0x00580002, 0x00580004, 0x00580005, 0x00580006, 0x00580007, 0x00580008, 0x00580009, 0x00580012, 0x00580014, 0x0058001B, ANIM_LIST_END };
|
||||
AnimID KoopatrolDisguiseExtraAnims[] = { 0x00580000, 0x00580001, 0x00580002, 0x00580004, 0x00580005, 0x00580006, 0x00580007, 0x00580008, 0x00580009, 0x00580012, 0x00580014, 0x0058001B, ANIM_LIST_END };
|
||||
|
||||
DisguiseAnims BasicPeachDisguiseAnims[4] = {
|
||||
{0x00580001, 0x00580004, 0x00580006, 0x00580008, 0x00580000, 0x0058001B},
|
||||
@ -53,46 +64,49 @@ DisguiseAnims BasicPeachDisguiseAnims[4] = {
|
||||
{0x00390002, 0x00390003, 0x00390004, 0x00390005, 0x00390000, 0x00390014},
|
||||
};
|
||||
|
||||
s32* PeachDisguiseExtraAnims[4] = { KoopatrolDisguiseExtraAnims, KoopatrolDisguiseExtraAnims, HammerBroDisguiseExtraAnims, ClubbaDisguiseExtraAnims };
|
||||
AnimID* PeachDisguiseExtraAnims[4] = { KoopatrolDisguiseExtraAnims, KoopatrolDisguiseExtraAnims, HammerBroDisguiseExtraAnims, ClubbaDisguiseExtraAnims };
|
||||
|
||||
#define ACTION_FILE(name) world_action_##name##_ROM_START, world_action_##name##_ROM_END
|
||||
|
||||
Action PlayerActionsTable[] = {
|
||||
{ action_idle_update, world_action_idle_ROM_START, world_action_idle_ROM_END, TRUE },
|
||||
{ func_802B6000_E24920, world_action_walk_ROM_START, world_action_walk_ROM_END, TRUE },
|
||||
{ action_run_update, world_action_walk_ROM_START, world_action_walk_ROM_END, TRUE },
|
||||
{ func_802B60B4_E240F4, world_action_jump_ROM_START, world_action_jump_ROM_END, TRUE },
|
||||
{ func_802B60B4_E240F4, world_action_jump_ROM_START, world_action_jump_ROM_END, TRUE },
|
||||
{ func_802B60B4_E240F4, world_action_jump_ROM_START, world_action_jump_ROM_END, FALSE },
|
||||
{ func_802B60B4_E240F4, world_action_jump_ROM_START, world_action_jump_ROM_END, FALSE },
|
||||
{ func_802B6198_E241D8, world_action_jump_ROM_START, world_action_jump_ROM_END, FALSE },
|
||||
{ func_802B6294_E242D4, world_action_jump_ROM_START, world_action_jump_ROM_END, TRUE },
|
||||
{ func_802B6348_E24388, world_action_jump_ROM_START, world_action_jump_ROM_END, TRUE },
|
||||
{ func_802B6000_E24920, world_action_land_ROM_START, world_action_land_ROM_END, TRUE },
|
||||
{ func_802B61C0_E24AE0, world_action_land_ROM_START, world_action_land_ROM_END, TRUE },
|
||||
{ func_802B6638_E29068, world_action_encounter_ROM_START, world_action_encounter_ROM_END, TRUE },
|
||||
{ func_802B6000_E24920, world_action_super_boots_ROM_START, world_action_super_boots_ROM_END, FALSE },
|
||||
{ func_802B6000_E24920, world_action_super_boots_ROM_START, world_action_super_boots_ROM_END, FALSE },
|
||||
{ func_802B6000_E24920, world_action_ultra_boots_ROM_START, world_action_ultra_boots_ROM_END, FALSE },
|
||||
{ func_802B6000_E24920, world_action_ultra_boots_ROM_START, world_action_ultra_boots_ROM_END, FALSE },
|
||||
{ func_802B6060_E27570, world_action_slide_ROM_START, world_action_slide_ROM_END, FALSE },
|
||||
{ action_hammer_update, world_action_hammer_ROM_START, world_action_hammer_ROM_END, FALSE },
|
||||
{ func_802B6350_E28D80, world_action_encounter_ROM_START, world_action_encounter_ROM_END, TRUE },
|
||||
{ func_802B6508_E28F38, world_action_encounter_ROM_START, world_action_encounter_ROM_END, FALSE },
|
||||
{ func_802B6000_E24920, world_action_hit_fire_ROM_START, world_action_hit_fire_ROM_END, FALSE },
|
||||
{ func_802B6000_E24920, world_action_16_ROM_START, world_action_16_ROM_END, FALSE },
|
||||
{ func_802B6000_E24920, world_action_hit_lava_ROM_START, world_action_hit_lava_ROM_END, FALSE },
|
||||
{ func_802B6230_E24800, world_action_18_ROM_START, world_action_18_ROM_END, TRUE },
|
||||
{ func_802B6120_E2A7D0, world_action_sneaky_parasol_ROM_START, world_action_sneaky_parasol_ROM_END, TRUE },
|
||||
{ func_802B6000_E24920, world_action_spin_ROM_START, world_action_spin_ROM_END, FALSE },
|
||||
{ func_802B63D4_E28E04, world_action_encounter_ROM_START, world_action_encounter_ROM_END, FALSE },
|
||||
{ func_802B6478_E28EA8, world_action_encounter_ROM_START, world_action_encounter_ROM_END, FALSE },
|
||||
{ func_802B60A4_E29514, world_action_use_spinning_flower_ROM_START, world_action_use_spinning_flower_ROM_END, FALSE },
|
||||
{ func_802B6000_E24920, world_action_use_munchlesia_ROM_START, world_action_use_munchlesia_ROM_END, FALSE },
|
||||
{ func_802B6000_E24920, world_action_use_tweester_ROM_START, world_action_use_tweester_ROM_END, FALSE },
|
||||
{ func_802B6350_E28D80, world_action_encounter_ROM_START, world_action_encounter_ROM_END, TRUE },
|
||||
{ func_802B6000_E24920, world_action_encounter_ROM_START, world_action_encounter_ROM_END, FALSE },
|
||||
{ func_802B6000_E24920, world_action_18_ROM_START, world_action_18_ROM_END, TRUE },
|
||||
{ func_802B609C_E28ACC, world_action_encounter_ROM_START, world_action_encounter_ROM_END, FALSE },
|
||||
{ func_802B6350_E28D80, world_action_encounter_ROM_START, world_action_encounter_ROM_END, FALSE },
|
||||
{ func_802B6350_E28D80, world_action_walk_ROM_START, world_action_walk_ROM_END, FALSE },
|
||||
{ func_802B6350_E28D80, world_action_encounter_ROM_START, world_action_encounter_ROM_END, TRUE },
|
||||
[ACTION_STATE_IDLE] { action_update_idle, ACTION_FILE(idle), TRUE },
|
||||
[ACTION_STATE_WALK] { action_update_walk, ACTION_FILE(walk), TRUE },
|
||||
[ACTION_STATE_RUN] { action_update_run, ACTION_FILE(walk), TRUE },
|
||||
[ACTION_STATE_JUMP] { action_update_jump, ACTION_FILE(jump), TRUE },
|
||||
[ACTION_STATE_BOUNCE] { action_update_jump, ACTION_FILE(jump), TRUE },
|
||||
[ACTION_STATE_HOP] { action_update_jump, ACTION_FILE(jump), FALSE },
|
||||
[ACTION_STATE_LAUNCH] { action_update_jump, ACTION_FILE(jump), FALSE },
|
||||
[ACTION_STATE_LANDING_ON_SWITCH] { action_update_landing_on_switch, ACTION_FILE(jump), FALSE },
|
||||
[ACTION_STATE_FALLING] { action_update_falling, ACTION_FILE(jump), TRUE },
|
||||
[ACTION_STATE_STEP_DOWN] { action_update_step_down, ACTION_FILE(jump), TRUE },
|
||||
[ACTION_STATE_LAND] { action_update_land, ACTION_FILE(land), TRUE },
|
||||
[ACTION_STATE_STEP_DOWN_LAND] { action_update_step_down_land, ACTION_FILE(land), TRUE },
|
||||
[ACTION_STATE_TALK] { action_update_talk, ACTION_FILE(misc), TRUE },
|
||||
[ACTION_STATE_SPIN_JUMP] { action_update_spin_jump, ACTION_FILE(spin_jump), FALSE },
|
||||
[ACTION_STATE_SPIN_POUND] { action_update_spin_jump, ACTION_FILE(spin_jump), FALSE },
|
||||
[ACTION_STATE_TORNADO_JUMP] { action_update_tornado_jump, ACTION_FILE(tornado_jump), FALSE },
|
||||
[ACTION_STATE_TORNADO_POUND] { action_update_tornado_jump, ACTION_FILE(tornado_jump), FALSE },
|
||||
[ACTION_STATE_SLIDING] { action_update_sliding, ACTION_FILE(slide), FALSE },
|
||||
[ACTION_STATE_HAMMER] { action_update_hammer, ACTION_FILE(hammer), FALSE },
|
||||
[ACTION_STATE_13] { action_update_launch, ACTION_FILE(misc), TRUE },
|
||||
[ACTION_STATE_PUSHING_BLOCK] { action_update_pushing_block, ACTION_FILE(misc), FALSE },
|
||||
[ACTION_STATE_HIT_FIRE] { action_update_hit_fire, ACTION_FILE(hit_fire), FALSE },
|
||||
[ACTION_STATE_KNOCKBACK] { action_update_knockback, ACTION_FILE(knockback), FALSE },
|
||||
[ACTION_STATE_HIT_LAVA] { action_update_hit_lava, ACTION_FILE(hit_lava), FALSE },
|
||||
[ACTION_STATE_STEP_UP_PEACH] { action_update_step_up_peach, ACTION_FILE(step_up), TRUE },
|
||||
[ACTION_STATE_USE_SNEAKY_PARASOL] { action_update_parasol, ACTION_FILE(sneaky_parasol), TRUE },
|
||||
[ACTION_STATE_SPIN] { action_update_spin, ACTION_FILE(spin), FALSE },
|
||||
[ACTION_STATE_ENEMY_FIRST_STRIKE] { action_update_first_strike, ACTION_FILE(misc), FALSE },
|
||||
[ACTION_STATE_RAISE_ARMS] { action_update_raise_arms, ACTION_FILE(misc), FALSE },
|
||||
[ACTION_STATE_USE_SPINNING_FLOWER] { action_update_use_spinning_flower, ACTION_FILE(use_spinning_flower), FALSE },
|
||||
[ACTION_STATE_USE_MUNCHLESIA] { action_update_use_munchlesia, ACTION_FILE(use_munchlesia), FALSE },
|
||||
[ACTION_STATE_USE_TWEESTER] { action_update_use_tweester, ACTION_FILE(use_tweester), FALSE },
|
||||
[ACTION_STATE_BOUNCE_OFF_SWITCH] { action_update_launch, ACTION_FILE(misc), TRUE },
|
||||
[ACTION_STATE_RIDE] { action_update_ride, ACTION_FILE(misc), FALSE },
|
||||
[ACTION_STATE_STEP_UP] { action_update_step_up, ACTION_FILE(step_up), TRUE },
|
||||
[ACTION_STATE_23] { action_update_state_23, ACTION_FILE(misc), FALSE },
|
||||
[ACTION_STATE_24] { action_update_launch, ACTION_FILE(misc), FALSE },
|
||||
//@bug function does not exist in world_action_walk, causes jump to middle of action_update_run and crashes
|
||||
[ACTION_STATE_INVALID_25] { action_update_launch, ACTION_FILE(walk), FALSE },
|
||||
[ACTION_STATE_USE_SPRING] { action_update_launch, ACTION_FILE(misc), TRUE },
|
||||
};
|
||||
|
@ -23,6 +23,6 @@ extern f32 D_800F7B90;
|
||||
extern Action PlayerActionsTable[39];
|
||||
|
||||
extern DisguiseAnims BasicPeachDisguiseAnims[4];
|
||||
extern s32* PeachDisguiseExtraAnims[4];
|
||||
extern AnimID* PeachDisguiseExtraAnims[4];
|
||||
|
||||
#endif
|
||||
|
@ -151,7 +151,7 @@ void N(func_80241068_BDFDF8)(Evt* script, MobileAISettings* aiSettings, EnemyDet
|
||||
npc->duration = aiSettings->waitTime / 2 + rand_int(aiSettings->waitTime / 2 + 1);
|
||||
} else {
|
||||
script->functionTemp[0] = 4;
|
||||
npc->currentAnim.w = enemy->animList[ENEMY_ANIM_IDLE];
|
||||
npc->currentAnim = enemy->animList[ENEMY_ANIM_IDLE];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1086,7 +1086,7 @@ void N(func_80241068_BE8C48)(Evt* script, MobileAISettings* aiSettings, EnemyDet
|
||||
npc->duration = aiSettings->waitTime / 2 + rand_int(aiSettings->waitTime / 2 + 1);
|
||||
} else {
|
||||
script->functionTemp[0] = 4;
|
||||
npc->currentAnim.w = enemy->animList[ENEMY_ANIM_IDLE];
|
||||
npc->currentAnim = enemy->animList[ENEMY_ANIM_IDLE];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -7,7 +7,7 @@ ApiStatus N(func_80240000_BF47A0)(Evt* script, s32 isInitialCall) {
|
||||
|
||||
if (isInitialCall) {
|
||||
script->functionTemp[0] = 0;
|
||||
suggest_player_anim_clearUnkFlag(0x10007);
|
||||
suggest_player_anim_clearUnkFlag(ANIM_Mario_AnimMidairStill);
|
||||
}
|
||||
|
||||
temp_f20 = func_800E34D8();
|
||||
|
@ -2515,7 +2515,7 @@ void N(func_80242214_96B3D4)(s32 arg0, f32* arg1, f32* arg2, f32* arg3, f32* arg
|
||||
Matrix4f sp60;
|
||||
Matrix4f spA0;
|
||||
|
||||
guPositionF(spA0, 0.0f, -gCameras[gCurrentCameraID].currentYaw, 0.0f, SPRITE_WORLD_SCALE,
|
||||
guPositionF(spA0, 0.0f, -gCameras[gCurrentCameraID].currentYaw, 0.0f, SPRITE_WORLD_SCALE_F,
|
||||
evt_get_variable(N(D_8024EFCC), ArrayVar(4)), evt_get_variable(N(D_8024EFCC), ArrayVar(5)),
|
||||
evt_get_variable(N(D_8024EFCC), ArrayVar(6)));
|
||||
|
||||
@ -2539,7 +2539,7 @@ void N(func_80242EAC_96C06C)(Evt* script, s32 isInitialCall) {
|
||||
Matrix4f sp20;
|
||||
u32 temp_s1;
|
||||
|
||||
guPositionF(sp20, 0.0f, -gCameras[gCurrentCameraID].currentYaw, 0.0f, SPRITE_WORLD_SCALE,
|
||||
guPositionF(sp20, 0.0f, -gCameras[gCurrentCameraID].currentYaw, 0.0f, SPRITE_WORLD_SCALE_F,
|
||||
evt_get_variable(N(D_8024EFCC), ArrayVar(4)), evt_get_variable(N(D_8024EFCC), ArrayVar(5)),
|
||||
evt_get_variable(N(D_8024EFCC), ArrayVar(6)));
|
||||
|
||||
|
@ -1145,18 +1145,18 @@ ApiStatus N(func_80240158_CA73F8)(Evt* script, s32 isInitialCall) {
|
||||
add_vec2D_polar(&sp10, &sp14, 46.0f, clamp);
|
||||
}
|
||||
}
|
||||
npc->currentAnim.w = enemy->animList[ENEMY_ANIM_RUN];
|
||||
npc->currentAnim = enemy->animList[ENEMY_ANIM_RUN];
|
||||
npc->yaw = atan2(npc->pos.x, npc->pos.z, sp10, sp14);
|
||||
npc_move_heading(npc, 2.0f, npc->yaw);
|
||||
} else if (temp_f4 > 0.2) {
|
||||
npc->yaw = atan2(npc->pos.x, npc->pos.z, sp10, sp14);
|
||||
npc->pos.x = sp10;
|
||||
npc->pos.z = sp14;
|
||||
npc->currentAnim.w = enemy->animList[ENEMY_ANIM_WALK];
|
||||
npc->currentAnim = enemy->animList[ENEMY_ANIM_WALK];
|
||||
} else {
|
||||
npc->pos.x = sp10;
|
||||
npc->pos.z = sp14;
|
||||
npc->currentAnim.w = enemy->animList[ENEMY_ANIM_IDLE];
|
||||
npc->currentAnim = enemy->animList[ENEMY_ANIM_IDLE];
|
||||
}
|
||||
return ApiStatus_BLOCK;
|
||||
}
|
||||
|
@ -3,7 +3,7 @@
|
||||
ApiStatus N(func_80242940_CD4770)(Evt* script, s32 isInitialCall) {
|
||||
script->varTable[0] = 0;
|
||||
do {} while (0);
|
||||
if (gPlayerStatus.actionState == ACTION_STATE_GROUND_POUND || gPlayerStatus.actionState == ACTION_STATE_ULTRA_POUND) {
|
||||
if (gPlayerStatus.actionState == ACTION_STATE_SPIN_POUND || gPlayerStatus.actionState == ACTION_STATE_TORNADO_POUND) {
|
||||
script->varTable[0] = 1;
|
||||
}
|
||||
return ApiStatus_DONE2;
|
||||
|
@ -99,9 +99,9 @@ ApiStatus func_80241B28_97F5F8(Evt* script, s32 isInitialCall) {
|
||||
ambush->rot.x = 0;
|
||||
ambush->rot.y = 0;
|
||||
ambush->rot.z = 0;
|
||||
ambush->scale.x = SPRITE_WORLD_SCALE;
|
||||
ambush->scale.y = SPRITE_WORLD_SCALE;
|
||||
ambush->scale.z = SPRITE_WORLD_SCALE;
|
||||
ambush->scale.x = SPRITE_WORLD_SCALE_F;
|
||||
ambush->scale.y = SPRITE_WORLD_SCALE_F;
|
||||
ambush->scale.z = SPRITE_WORLD_SCALE_F;
|
||||
ambush->renderYaw = 85.0f;
|
||||
ambush->alpha = 0.0f;
|
||||
|
||||
|
@ -107,9 +107,9 @@ ApiStatus func_80241BA8_991388(Evt* script, s32 isInitialCall) {
|
||||
ambush->rot.x = 0.0f;
|
||||
ambush->rot.y = 0.0f;
|
||||
ambush->rot.z = 90.0f;
|
||||
ambush->scale.x = SPRITE_WORLD_SCALE;
|
||||
ambush->scale.y = SPRITE_WORLD_SCALE;
|
||||
ambush->scale.z = SPRITE_WORLD_SCALE;
|
||||
ambush->scale.x = SPRITE_WORLD_SCALE_F;
|
||||
ambush->scale.y = SPRITE_WORLD_SCALE_F;
|
||||
ambush->scale.z = SPRITE_WORLD_SCALE_F;
|
||||
ambush->renderYaw = 60.0f;
|
||||
ambush->color.r = 255.0f;
|
||||
ambush->color.g = 128.0f;
|
||||
|
@ -97,9 +97,9 @@ ApiStatus func_80241AF0_994220(Evt* script, s32 isInitialCall) {
|
||||
ambush->rot.x = 0;
|
||||
ambush->rot.y = 0;
|
||||
ambush->rot.z = 0;
|
||||
ambush->scale.x = SPRITE_WORLD_SCALE;
|
||||
ambush->scale.y = SPRITE_WORLD_SCALE;
|
||||
ambush->scale.z = SPRITE_WORLD_SCALE;
|
||||
ambush->scale.x = SPRITE_WORLD_SCALE_F;
|
||||
ambush->scale.y = SPRITE_WORLD_SCALE_F;
|
||||
ambush->scale.z = SPRITE_WORLD_SCALE_F;
|
||||
ambush->renderYaw = 270.0f;
|
||||
|
||||
ambush->foldID = 0;
|
||||
|
@ -1,7 +1,7 @@
|
||||
#include "iwa_00.h"
|
||||
|
||||
ApiStatus func_802402B0_90CEF0(Evt* script, s32 isInitialCall) {
|
||||
gPlayerStatus.unk_D0 = script->varTablePtr[0];
|
||||
gPlayerStatus.slideParams = script->varTablePtr[0];
|
||||
gPlayerStatus.flags |= PLAYER_STATUS_FLAGS_10;
|
||||
return ApiStatus_DONE2;
|
||||
}
|
||||
|
@ -1,7 +1,7 @@
|
||||
#include "iwa_01.h"
|
||||
|
||||
ApiStatus func_802432B0_912960(Evt* script, s32 isInitialCall) {
|
||||
gPlayerStatus.unk_D0 = script->varTablePtr[0];
|
||||
gPlayerStatus.slideParams = script->varTablePtr[0];
|
||||
gPlayerStatus.flags |= PLAYER_STATUS_ANIM_FLAGS_INTERACT_PROMPT_AVAILABLE;
|
||||
return ApiStatus_DONE2;
|
||||
}
|
||||
|
@ -3,7 +3,7 @@
|
||||
#include "world/common/enemy/CleftAI.inc.c"
|
||||
|
||||
ApiStatus func_80241320_919ED0(Evt* script, s32 isInitialCall) {
|
||||
gPlayerStatus.unk_D0 = script->varTablePtr[0];
|
||||
gPlayerStatus.slideParams = script->varTablePtr[0];
|
||||
gPlayerStatus.flags |= PLAYER_STATUS_FLAGS_10;
|
||||
return ApiStatus_DONE2;
|
||||
}
|
||||
|
@ -16,12 +16,12 @@ ApiStatus func_80240000_ABB290(Evt* script, s32 isInitialCall) {
|
||||
|
||||
ApiStatus func_80240040_ABB2D0(Evt* script, s32 isInitialCall) {
|
||||
Bytecode* args = script->ptrReadPos;
|
||||
PlayerStatus *status = &gPlayerStatus;
|
||||
PlayerStatus* status = &gPlayerStatus;
|
||||
|
||||
if (evt_get_variable(script, *args++) == 0) {
|
||||
status->unk_D0 = &D_8024160C_ABC89C;
|
||||
status->slideParams = &D_8024160C_ABC89C;
|
||||
} else {
|
||||
status->unk_D0 = &D_8024162C_ABC8BC;
|
||||
status->slideParams = &D_8024162C_ABC8BC;
|
||||
}
|
||||
|
||||
status->flags |= PLAYER_STATUS_FLAGS_10;
|
||||
|
@ -83,8 +83,8 @@ ApiStatus func_80240694_AF3334(Evt* script, s32 isInitialCall) {
|
||||
ApiStatus func_80240730_AF33D0(Evt* script, s32 isInitialCall) {
|
||||
Bytecode* args = script->ptrReadPos;
|
||||
|
||||
gPlayerStatus.unk_C4 = evt_get_float_variable(script, *args++);
|
||||
gGameStatusPtr->peachCookingIngredient = gPlayerStatus.unk_C4;
|
||||
gPlayerStatus.peachItemHeld = evt_get_float_variable(script, *args++);
|
||||
gGameStatusPtr->peachCookingIngredient = gPlayerStatus.peachItemHeld;
|
||||
|
||||
return ApiStatus_DONE2;
|
||||
}
|
||||
|
@ -251,8 +251,8 @@ ApiStatus func_80240B8C_AF84DC(Evt* script, s32 isInitialCall) {
|
||||
ApiStatus func_80240C10_AF8560(Evt* script, s32 isInitialCall) {
|
||||
Bytecode* args = script->ptrReadPos;
|
||||
|
||||
gPlayerStatus.unk_C4 = evt_get_variable(script, *args++);
|
||||
gGameStatusPtr->peachCookingIngredient = gPlayerStatus.unk_C4;
|
||||
gPlayerStatus.peachItemHeld = evt_get_variable(script, *args++);
|
||||
gGameStatusPtr->peachCookingIngredient = gPlayerStatus.peachItemHeld;
|
||||
|
||||
return ApiStatus_DONE2;
|
||||
}
|
||||
|
@ -19,9 +19,9 @@ ApiStatus func_802406EC_B070EC(Evt* script, s32 isInitialCall) {
|
||||
unkStruct->rot.x = 0.0f;
|
||||
unkStruct->rot.y = 0.0f;
|
||||
unkStruct->rot.z = 0.0f;
|
||||
unkStruct->scale.x = SPRITE_WORLD_SCALE;
|
||||
unkStruct->scale.y = SPRITE_WORLD_SCALE;
|
||||
unkStruct->scale.z = SPRITE_WORLD_SCALE;
|
||||
unkStruct->scale.x = SPRITE_WORLD_SCALE_F;
|
||||
unkStruct->scale.y = SPRITE_WORLD_SCALE_F;
|
||||
unkStruct->scale.z = SPRITE_WORLD_SCALE_F;
|
||||
unkStruct->foldID = func_8013A704(1);
|
||||
unkStruct->entityID = create_generic_entity_world(NULL, kkj_25_UnkFoldFunc);
|
||||
|
||||
|
@ -2,6 +2,25 @@
|
||||
|
||||
#include "world/common/CheckPartnerFlags1000.inc.c"
|
||||
|
||||
#ifdef NON_MATCHING
|
||||
ApiStatus func_8024366C_8B36DC(Evt* script, s32 isInitialCall) {
|
||||
static s32* D_8025578C_8C57FC[4]; // EnemyTerritoryWander
|
||||
|
||||
Bytecode* args = script->ptrReadPos;
|
||||
s32 enemyIndex = evt_get_variable(script, *args++);
|
||||
s32 territoryIndex = evt_get_variable(script, *args++);
|
||||
s32* src = D_8025578C_8C57FC[territoryIndex];
|
||||
Enemy* enemy = get_enemy(enemyIndex);
|
||||
s32 i;
|
||||
|
||||
for (i = 0; i < 0xE; i++) {
|
||||
enemy->territory.raw[i] = src[i];
|
||||
}
|
||||
|
||||
return ApiStatus_DONE2;
|
||||
}
|
||||
#else
|
||||
INCLUDE_ASM(s32, "world/area_kmr/kmr_02/8B36B0", func_8024366C_8B36DC);
|
||||
#endif
|
||||
|
||||
#include "world/common/UnkFunc42.inc.c"
|
||||
|
@ -28,7 +28,7 @@ ApiStatus func_8024073C_A57BEC(Evt* script, s32 isInitialCall) {
|
||||
PlayerStatus* playerStatus = &gPlayerStatus;
|
||||
|
||||
if (gCollisionStatus.currentFloor == floor || gCollisionStatus.lastTouchedFloor == floor) {
|
||||
if (playerStatus->actionState != ACTION_STATE_ULTRA_JUMP &&
|
||||
if (playerStatus->actionState != ACTION_STATE_TORNADO_JUMP &&
|
||||
playerStatus->actionState != ACTION_STATE_SPIN_JUMP &&
|
||||
temp_a0 == 0)
|
||||
{
|
||||
|
@ -30,7 +30,7 @@ ApiStatus func_80240050_A6ACF0(Evt* script, s32 isInitialCall) {
|
||||
} else {
|
||||
animID = 0xA0003;
|
||||
}
|
||||
npc->currentAnim.w = animID;
|
||||
npc->currentAnim = animID;
|
||||
evt_set_variable(script, outVar, playerStatus->targetYaw);
|
||||
return ApiStatus_DONE2;
|
||||
}
|
||||
|
@ -40,9 +40,9 @@ ApiStatus func_80243380_803C00(Evt* script, s32 isInitialCall) {
|
||||
temp_v0->rot.x = 0.0f;
|
||||
temp_v0->rot.y = 0.0f;
|
||||
temp_v0->rot.z = 0.0f;
|
||||
temp_v0->scale.x = SPRITE_WORLD_SCALE;
|
||||
temp_v0->scale.y = SPRITE_WORLD_SCALE;
|
||||
temp_v0->scale.z = SPRITE_WORLD_SCALE;
|
||||
temp_v0->scale.x = SPRITE_WORLD_SCALE_F;
|
||||
temp_v0->scale.y = SPRITE_WORLD_SCALE_F;
|
||||
temp_v0->scale.z = SPRITE_WORLD_SCALE_F;
|
||||
temp_v0->foldID = func_8013A704(1);
|
||||
temp_v0->entityID = create_generic_entity_world(NULL, mac_01_UnkFoldFunc);
|
||||
evt_set_variable(script, MapVar(10), (s32) temp_v0);
|
||||
|
@ -436,7 +436,7 @@ ApiStatus N(RunMinigame)(Evt* script, s32 isInitialCall) {
|
||||
case BOX_STATE_FUZZY_IDLE:
|
||||
data->box[i].stateTimer--;
|
||||
if (data->box[i].stateTimer <= 0) {
|
||||
npc->currentAnim.w = NPC_ANIM_fuzzy_Palette_00_Anim_2;
|
||||
npc->currentAnim = NPC_ANIM_fuzzy_Palette_00_Anim_2;
|
||||
data->box[i].state = BOX_STATE_FUZZY_POPUP;
|
||||
sfx_play_sound_at_position(enemy->varTable[8], 0x100000, npc->pos.x, npc->pos.y, npc->pos.z);
|
||||
get_model_center_and_size(data->box[i].modelID, ¢erX, ¢erY, ¢erZ, &sizeX, &sizeY, &sizeZ);
|
||||
@ -482,7 +482,7 @@ ApiStatus N(RunMinigame)(Evt* script, s32 isInitialCall) {
|
||||
sfx_play_sound(enemy->varTable[8]);
|
||||
data->box[i].state = BOX_STATE_FUZZY_ATTACH;
|
||||
gPlayerStatusPtr->anim = ANIM_Mario_CrouchStill;
|
||||
npc->currentAnim.w = NPC_ANIM_fuzzy_Palette_00_Anim_3;
|
||||
npc->currentAnim = NPC_ANIM_fuzzy_Palette_00_Anim_3;
|
||||
get_model_center_and_size(data->box[i].modelID, ¢erX, ¢erY, ¢erZ, &sizeX, &sizeY, &sizeZ);
|
||||
npc->pos.x = centerX;
|
||||
npc->pos.y = centerY;
|
||||
@ -509,7 +509,7 @@ ApiStatus N(RunMinigame)(Evt* script, s32 isInitialCall) {
|
||||
gPlayerStatusPtr->anim = ANIM_Mario_CrouchStill;
|
||||
npc->duration--;
|
||||
if (npc->duration <= 0) {
|
||||
npc->currentAnim.w = NPC_ANIM_fuzzy_Palette_00_Anim_F;
|
||||
npc->currentAnim = NPC_ANIM_fuzzy_Palette_00_Anim_F;
|
||||
gPlayerStatusPtr->anim = ANIM_Mario_RunPanic;
|
||||
data->mashProgress = 0;
|
||||
npc->pos.x = gPlayerStatusPtr->position.x;
|
||||
@ -535,7 +535,7 @@ ApiStatus N(RunMinigame)(Evt* script, s32 isInitialCall) {
|
||||
hud_element_set_script(data->hudElemID_AButton, &HES_AButton);
|
||||
hud_element_set_alpha(data->hudElemID_AButton, 160);
|
||||
hud_element_set_alpha(data->hudElemID_Meter, 160);
|
||||
npc->currentAnim.w = NPC_ANIM_fuzzy_Palette_00_Anim_8;
|
||||
npc->currentAnim = NPC_ANIM_fuzzy_Palette_00_Anim_8;
|
||||
npc->pos.y += 3.0;
|
||||
}
|
||||
break;
|
||||
@ -600,7 +600,7 @@ ApiStatus N(RunMinigame)(Evt* script, s32 isInitialCall) {
|
||||
case BOX_STATE_BOMB_HIT:
|
||||
enable_npc_shadow(npc);
|
||||
npc->duration = 15;
|
||||
npc->currentAnim.w = NPC_ANIM_bob_omb_Palette_00_Anim_5;
|
||||
npc->currentAnim = NPC_ANIM_bob_omb_Palette_00_Anim_5;
|
||||
data->stunFlags |= (STUN_FLAGS_STUNNED | STUN_FLAGS_CHANGED);
|
||||
data->box[i].state = BOX_STATE_BOMB_ATTACK;
|
||||
get_model_center_and_size(data->box[i].modelID, ¢erX, ¢erY, ¢erZ, &sizeX, &sizeY, &sizeZ);
|
||||
@ -934,7 +934,7 @@ ApiStatus N(CleanupGame)(Evt* script, s32 isInitialCall) {
|
||||
if (data->box[i].state != BOX_STATE_FUZZY_END) {
|
||||
data->box[i].state = BOX_STATE_FUZZY_END;
|
||||
fx_emote(EMOTE_QUESTION, npc, 0.0f, npc->collisionHeight, 1.0f, 2.0f, 0.0f, 30, &writeback);
|
||||
npc->currentAnim.w = NPC_ANIM_fuzzy_Palette_00_Anim_E;
|
||||
npc->currentAnim = NPC_ANIM_fuzzy_Palette_00_Anim_E;
|
||||
enable_npc_shadow(npc);
|
||||
}
|
||||
break;
|
||||
@ -943,7 +943,7 @@ ApiStatus N(CleanupGame)(Evt* script, s32 isInitialCall) {
|
||||
if (data->box[i].state != BOX_STATE_BOMB_END) {
|
||||
data->box[i].state = BOX_STATE_BOMB_END;
|
||||
fx_emote(EMOTE_QUESTION, npc, 0.0f, npc->collisionHeight, 1.0f, 2.0f, 0.0f, 30, &writeback);
|
||||
npc->currentAnim.w = NPC_ANIM_bob_omb_Palette_00_Anim_1C;
|
||||
npc->currentAnim = NPC_ANIM_bob_omb_Palette_00_Anim_1C;
|
||||
enable_npc_shadow(npc);
|
||||
}
|
||||
break;
|
||||
|
@ -28,7 +28,7 @@ ApiStatus func_802423CC_D8F61C(Evt *script, s32 isInitialCall) {
|
||||
if (isInitialCall || (enemy->aiFlags & ENEMY_AI_FLAGS_4)) {
|
||||
script->functionTemp[0] = 0;
|
||||
npc->duration = 0;
|
||||
npc->currentAnim.w = enemy->animList[ENEMY_ANIM_IDLE];
|
||||
npc->currentAnim = enemy->animList[ENEMY_ANIM_IDLE];
|
||||
npc->flags &= ~NPC_FLAG_JUMPING;
|
||||
if (!enemy->territory->patrol.isFlying) {
|
||||
npc->flags |= NPC_FLAG_GRAVITY;
|
||||
|
@ -14,7 +14,7 @@ ApiStatus func_80240960_86F460(Evt* script, s32 isInitialCall) {
|
||||
if (gCollisionStatus.currentFloor != D_80242930_871430[i]) {
|
||||
continue;
|
||||
}
|
||||
if ((player->actionState == ACTION_STATE_GROUND_POUND) || (player->actionState == ACTION_STATE_ULTRA_POUND)) {
|
||||
if ((player->actionState == ACTION_STATE_SPIN_POUND) || (player->actionState == ACTION_STATE_TORNADO_POUND)) {
|
||||
return ApiStatus_BLOCK;
|
||||
}
|
||||
}
|
||||
|
@ -63,7 +63,7 @@ ApiStatus func_80240C20_872650(Evt* script, s32 isInitialCall) {
|
||||
PlayerStatus* player = &gPlayerStatus;
|
||||
|
||||
if ((gCollisionStatus.currentFloor == 9) || (gCollisionStatus.currentFloor == 0xB)) {
|
||||
if ((player->actionState == ACTION_STATE_GROUND_POUND) || (player->actionState == ACTION_STATE_ULTRA_POUND)) {
|
||||
if ((player->actionState == ACTION_STATE_SPIN_POUND) || (player->actionState == ACTION_STATE_TORNADO_POUND)) {
|
||||
return ApiStatus_BLOCK;
|
||||
}
|
||||
}
|
||||
|
@ -12,7 +12,7 @@ ApiStatus func_80241390_87AF70(Evt* script, s32 isInitialCall) {
|
||||
if (gCollisionStatus.currentFloor != D_802449B0_87E590[i]) {
|
||||
continue;
|
||||
}
|
||||
if ((player->actionState == ACTION_STATE_GROUND_POUND) || (player->actionState == ACTION_STATE_ULTRA_POUND)) {
|
||||
if ((player->actionState == ACTION_STATE_SPIN_POUND) || (player->actionState == ACTION_STATE_TORNADO_POUND)) {
|
||||
return ApiStatus_BLOCK;
|
||||
}
|
||||
}
|
||||
|
@ -87,14 +87,14 @@ void func_80240020_9AE720(void) {
|
||||
|
||||
ApiStatus func_80240404_9AEB04(Evt* script, s32 isInitialCall) {
|
||||
N(D_80243090).pos.x = gPlayerStatus.position.x;
|
||||
N(D_80243090).pos.y = gPlayerStatus.position.y + (gPlayerStatus.colliderHeight * SPRITE_PIXEL_SCALE * 0.5);
|
||||
N(D_80243090).pos.y = gPlayerStatus.position.y + (gPlayerStatus.colliderHeight * SPRITE_WORLD_SCALE_D * 0.5);
|
||||
N(D_80243090).pos.z = gPlayerStatus.position.z;
|
||||
N(D_80243090).rot.x = 0.0f;
|
||||
N(D_80243090).rot.y = 0.0f;
|
||||
N(D_80243090).rot.z = 0.0f;
|
||||
N(D_80243090).scale.x = SPRITE_WORLD_SCALE;
|
||||
N(D_80243090).scale.y = SPRITE_WORLD_SCALE;
|
||||
N(D_80243090).scale.z = SPRITE_WORLD_SCALE;
|
||||
N(D_80243090).scale.x = SPRITE_WORLD_SCALE_F;
|
||||
N(D_80243090).scale.y = SPRITE_WORLD_SCALE_F;
|
||||
N(D_80243090).scale.z = SPRITE_WORLD_SCALE_F;
|
||||
N(D_80243090).foldStateID = func_8013A704(1);
|
||||
N(D_80243090).entityID = create_generic_entity_world(0, func_80240020_9AE720);
|
||||
return ApiStatus_DONE2;
|
||||
@ -113,7 +113,7 @@ ApiStatus func_80240508_9AEC08(Evt* script, s32 isInitialCall) {
|
||||
s32 z = evt_get_float_variable(script, *args++);
|
||||
|
||||
N(D_80243090).pos.x = x;
|
||||
N(D_80243090).pos.y = y + (gPlayerStatus.colliderHeight * SPRITE_PIXEL_SCALE * 0.5);
|
||||
N(D_80243090).pos.y = y + (gPlayerStatus.colliderHeight * SPRITE_WORLD_SCALE_D * 0.5);
|
||||
N(D_80243090).pos.z = z;
|
||||
return ApiStatus_DONE2;
|
||||
}
|
||||
|
@ -109,7 +109,7 @@ void func_80240360_B1B8D0(void* data) {
|
||||
guMtxCatF(main, rotation, main);
|
||||
guRotateF(rotation, playerStatus->spriteFacingAngle, 0.0f, 1.0f, 0.0f);
|
||||
guMtxCatF(main, rotation, main);
|
||||
guScaleF(scale, SPRITE_WORLD_SCALE, SPRITE_WORLD_SCALE, SPRITE_WORLD_SCALE);
|
||||
guScaleF(scale, SPRITE_WORLD_SCALE_F, SPRITE_WORLD_SCALE_F, SPRITE_WORLD_SCALE_F);
|
||||
guMtxCatF(main, scale, main);
|
||||
guTranslateF(translation, playerStatus->position.x, playerStatus->position.y, -playerStatus->position.z);
|
||||
guMtxCatF(main, translation, main);
|
||||
|
@ -51,11 +51,11 @@ void func_80240100_B1CB50(void* data) {
|
||||
guMtxCatF(main, rotation, main);
|
||||
guRotateF(rotation, playerStatus->spriteFacingAngle, 0.0f, 1.0f, 0.0f);
|
||||
guMtxCatF(main, rotation, main);
|
||||
guScaleF(scale, SPRITE_WORLD_SCALE, SPRITE_WORLD_SCALE, SPRITE_WORLD_SCALE);
|
||||
guScaleF(scale, SPRITE_WORLD_SCALE_F, SPRITE_WORLD_SCALE_F, SPRITE_WORLD_SCALE_F);
|
||||
guMtxCatF(main, scale, main);
|
||||
guTranslateF(translation, playerStatus->position.x, playerStatus->position.y, -playerStatus->position.z);
|
||||
guMtxCatF(main, translation, main);
|
||||
spr_update_player_sprite(1, playerStatus->trueAnimation ^ 0x1000000, 1.0f);
|
||||
spr_update_player_sprite(1, playerStatus->trueAnimation ^ SPRITE_ID_BACK_FACING, 1.0f);
|
||||
spr_draw_player_sprite(1, 0, 0, NULL, main);
|
||||
}
|
||||
|
||||
@ -104,7 +104,7 @@ void func_802403B8_B1CE08(void* data) {
|
||||
guMtxCatF(sp20, spA0, sp20);
|
||||
guRotateF(spA0, playerStatus->spriteFacingAngle, 0.0f, 1.0f, 0.0f);
|
||||
guMtxCatF(sp20, spA0, sp20);
|
||||
guScaleF(spE0, SPRITE_PIXEL_SCALE, -SPRITE_PIXEL_SCALE, SPRITE_PIXEL_SCALE);
|
||||
guScaleF(spE0, SPRITE_WORLD_SCALE_D, -SPRITE_WORLD_SCALE_D, SPRITE_WORLD_SCALE_D);
|
||||
guMtxCatF(sp20, spE0, sp20);
|
||||
guTranslateF(sp60, playerStatus->position.x, -playerStatus->position.y, playerStatus->position.z);
|
||||
guMtxCatF(sp20, sp60, sp20);
|
||||
@ -116,7 +116,7 @@ void func_802403B8_B1CE08(void* data) {
|
||||
guMtxCatF(sp20, spA0, sp20);
|
||||
guRotateF(spA0, playerStatus->spriteFacingAngle, 0.0f, 1.0f, 0.0f);
|
||||
guMtxCatF(sp20, spA0, sp20);
|
||||
guScaleF(spE0, SPRITE_PIXEL_SCALE, SPRITE_PIXEL_SCALE, SPRITE_PIXEL_SCALE);
|
||||
guScaleF(spE0, SPRITE_WORLD_SCALE_D, SPRITE_WORLD_SCALE_D, SPRITE_WORLD_SCALE_D);
|
||||
guMtxCatF(sp20, spE0, sp20);
|
||||
guTranslateF(sp60, playerStatus->position.x, playerStatus->position.y, 0.0f);
|
||||
guMtxCatF(sp20, sp60, sp20);
|
||||
|
@ -8,7 +8,7 @@ ApiStatus func_80240000_B1D760(Evt* script, s32 isInitialCall) {
|
||||
f32 dist = dist2D(playerStatus->position.x, playerStatus->position.z, script->array[2], script->array[3]);
|
||||
|
||||
script->varTable[0] = 1;
|
||||
if (playerStatus->actionState != ACTION_STATE_GROUND_POUND && playerStatus->actionState != ACTION_STATE_ULTRA_POUND) {
|
||||
if (playerStatus->actionState != ACTION_STATE_SPIN_POUND && playerStatus->actionState != ACTION_STATE_TORNADO_POUND) {
|
||||
script->varTable[0] = 0;
|
||||
}
|
||||
if (script->array[4] <= dist) {
|
||||
|
@ -45,14 +45,14 @@ ApiStatus N(LetterDelivery_CalcLetterPos)(Evt* script, s32 isInitialCall) {
|
||||
ApiStatus N(LetterDelivery_SaveNpcAnim)(Evt* script, s32 isInitialCall) {
|
||||
Npc* npc = get_npc_unsafe(script->varTable[2]);
|
||||
|
||||
N(LetterDelivery_SavedNpcAnim) = npc->currentAnim.w;
|
||||
npc->currentAnim.w = script->varTable[4];
|
||||
N(LetterDelivery_SavedNpcAnim) = npc->currentAnim;
|
||||
npc->currentAnim = script->varTable[4];
|
||||
return ApiStatus_DONE2;
|
||||
}
|
||||
|
||||
ApiStatus N(LetterDelivery_RestoreNpcAnim)(Evt* script, s32 isInitialCall) {
|
||||
Npc* npc = get_npc_unsafe(script->varTable[2]);
|
||||
|
||||
npc->currentAnim.w = N(LetterDelivery_SavedNpcAnim);
|
||||
npc->currentAnim = N(LetterDelivery_SavedNpcAnim);
|
||||
return ApiStatus_DONE2;
|
||||
}
|
||||
|
@ -20,10 +20,10 @@ ApiStatus N(UnkAngleFunc001)(Evt* script, s32 isInitialCall) {
|
||||
}
|
||||
|
||||
y = npc->pos.y;
|
||||
if (npc->currentAnim.w == 0xB60000 ||
|
||||
npc->currentAnim.w == 0xB60004 ||
|
||||
npc->currentAnim.w == 0xB60008 ||
|
||||
npc->currentAnim.w == 0xB6000C)
|
||||
if (npc->currentAnim == 0xB60000 ||
|
||||
npc->currentAnim == 0xB60004 ||
|
||||
npc->currentAnim == 0xB60008 ||
|
||||
npc->currentAnim == 0xB6000C)
|
||||
{
|
||||
y += 2.0f * sin_deg(N(unkAngle1));
|
||||
}
|
||||
|
@ -43,7 +43,7 @@ ApiStatus N(UnkFunc001)(Evt* script, s32 isInitialCall) {
|
||||
|
||||
switch (script->functionTemp[0]) {
|
||||
case 0:
|
||||
npc->currentAnim.w = enemy->animList[0];
|
||||
npc->currentAnim = enemy->animList[0];
|
||||
npc->verticalRenderOffset = npc->collisionHeight;
|
||||
npc->flags |= NPC_FLAG_UPSIDE_DOWN;
|
||||
script->functionTemp[1] = 0;
|
||||
@ -63,7 +63,7 @@ ApiStatus N(UnkFunc001)(Evt* script, s32 isInitialCall) {
|
||||
break;
|
||||
}
|
||||
case 10:
|
||||
npc->currentAnim.w = enemy->animList[3];
|
||||
npc->currentAnim = enemy->animList[3];
|
||||
npc->planarFlyDist = atan2(npc->pos.x, npc->pos.z, playerStatus->position.x, playerStatus->position.z);
|
||||
npc->jumpScale = 1.3f;
|
||||
npc->jumpVelocity = 0.0f;
|
||||
@ -173,7 +173,7 @@ ApiStatus N(UnkFunc001)(Evt* script, s32 isInitialCall) {
|
||||
break;
|
||||
}
|
||||
case 14:
|
||||
npc->currentAnim.w = enemy->animList[8];
|
||||
npc->currentAnim = enemy->animList[8];
|
||||
npc->verticalRenderOffset = npc->collisionHeight;
|
||||
npc->flags |= NPC_FLAG_UPSIDE_DOWN;
|
||||
npc->duration = 15;
|
||||
|
@ -6,7 +6,7 @@ ApiStatus N(UnkFunc11)(Evt* script, s32 isInitialCall) {
|
||||
PlayerStatus* playerStatus = &gPlayerStatus;
|
||||
CollisionStatus* collisionStatus = &gCollisionStatus;
|
||||
|
||||
if (((collisionStatus->pushingAgainstWall != pushableColliderID) && (playerStatus->actionState == ACTION_STATE_14)) ||
|
||||
if (((collisionStatus->pushingAgainstWall != pushableColliderID) && (playerStatus->actionState == ACTION_STATE_PUSHING_BLOCK)) ||
|
||||
playerStatus->enableCollisionOverlapsCheck || playerStatus->inputEnabledCounter) {
|
||||
set_action_state(ACTION_STATE_IDLE);
|
||||
script->varTable[0] = 0;
|
||||
@ -15,7 +15,7 @@ ApiStatus N(UnkFunc11)(Evt* script, s32 isInitialCall) {
|
||||
|
||||
if (collisionStatus->pushingAgainstWall != pushableColliderID) {
|
||||
script->varTable[0] = 0;
|
||||
} else if ((playerStatus->actionState != ACTION_STATE_14) && (playerStatus->actionState != ACTION_STATE_WALK) &&
|
||||
} else if ((playerStatus->actionState != ACTION_STATE_PUSHING_BLOCK) && (playerStatus->actionState != ACTION_STATE_WALK) &&
|
||||
(playerStatus->actionState != ACTION_STATE_RUN)) {
|
||||
script->varTable[0] = 0;
|
||||
} else if (playerStatus->animFlags & PLAYER_STATUS_ANIM_FLAGS_HOLDING_WATT) {
|
||||
|
@ -4,9 +4,9 @@
|
||||
ApiStatus N(UnkFunc44)(Evt* script, s32 isInitialCall) {
|
||||
script->varTable[0] = 0;
|
||||
do {} while (0);
|
||||
if (gPlayerStatus.actionState == ACTION_STATE_GROUND_POUND) {
|
||||
if (gPlayerStatus.actionState == ACTION_STATE_SPIN_POUND) {
|
||||
script->varTable[0] = 1;
|
||||
} else if (gPlayerStatus.actionState == ACTION_STATE_ULTRA_POUND) {
|
||||
} else if (gPlayerStatus.actionState == ACTION_STATE_TORNADO_POUND) {
|
||||
script->varTable[0] = 1;
|
||||
}
|
||||
return ApiStatus_DONE2;
|
||||
|
@ -7,18 +7,18 @@
|
||||
|
||||
// temporarily copied from StashVars to allow static varStash
|
||||
ApiStatus N(StashVars)(Evt* script, s32 isInitialCall) {
|
||||
static s32** varStash = NULL;
|
||||
static s32* varStash = NULL;
|
||||
s32 i;
|
||||
|
||||
if (varStash == NULL) {
|
||||
varStash = heap_malloc(sizeof(script->varTable));
|
||||
|
||||
for (i = 0; i < ARRAY_COUNT(script->varTable); i++) {
|
||||
varStash[i] = (s32*) script->varTable[i];
|
||||
varStash[i] = script->varTable[i];
|
||||
}
|
||||
} else {
|
||||
for (i = 0; i < ARRAY_COUNT(script->varTable); i++) {
|
||||
script->varTable[i] = (s32) varStash[i];
|
||||
script->varTable[i] = varStash[i];
|
||||
}
|
||||
|
||||
heap_free(varStash);
|
||||
|
@ -23,11 +23,11 @@ void N(SetPartnerFlags80000)(void);
|
||||
void N(SetPartnerFlags20000)(void);
|
||||
|
||||
s32 N(reflection_unk_resolve_anim)(s32 playerAnim) {
|
||||
u32 val;
|
||||
AnimID temp;
|
||||
|
||||
playerAnim &= ~0x1000000;
|
||||
val = playerAnim + ~0x6000B;
|
||||
if (val < 0x10 && val & 1) {
|
||||
playerAnim &= ~SPRITE_ID_BACK_FACING;
|
||||
temp = playerAnim + ~ANIM_Mario_6000B;
|
||||
if (temp < 16 && temp & 1) {
|
||||
playerAnim--;
|
||||
}
|
||||
|
||||
@ -35,32 +35,31 @@ s32 N(reflection_unk_resolve_anim)(s32 playerAnim) {
|
||||
}
|
||||
|
||||
s32 N(reflection_unk_change_anim_facing)(s32 playerAnim) {
|
||||
s32 temp_v1 = playerAnim >> 0x10;
|
||||
u32 temp_v1_2;
|
||||
s32 sprIndex = (playerAnim >> 0x10) & 0xFF;
|
||||
u32 temp;
|
||||
|
||||
switch ((u8)temp_v1) {
|
||||
case 1:
|
||||
if (playerAnim > 0x1000C) {
|
||||
switch (sprIndex) {
|
||||
case SPR_Mario_1:
|
||||
if (playerAnim > ANIM_Mario_1000C) {
|
||||
return playerAnim;
|
||||
}
|
||||
break;
|
||||
case 6:
|
||||
// above function, inlined
|
||||
temp_v1_2 = playerAnim + 0xFFF9FFF4; // + ~0x0006000B
|
||||
if (temp_v1_2 < 16) {
|
||||
if (temp_v1_2 & 1) {
|
||||
case SPR_Mario_6:
|
||||
temp = playerAnim + ~ANIM_Mario_6000B;
|
||||
if (temp < 16) {
|
||||
if (temp & 1) {
|
||||
return playerAnim;
|
||||
} else {
|
||||
return playerAnim + 1;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 8:
|
||||
case 9:
|
||||
case SPR_Mario_8:
|
||||
case SPR_Mario_9:
|
||||
return playerAnim;
|
||||
}
|
||||
|
||||
return playerAnim | 0x1000000;
|
||||
return playerAnim | SPRITE_ID_BACK_FACING;
|
||||
}
|
||||
|
||||
ApiStatus N(ReflectWall)(Evt* script, s32 isInitialCall) {
|
||||
@ -94,7 +93,7 @@ void N(reflection_setup_wall)(void) {
|
||||
|
||||
spr_update_player_sprite(2, anim, 1.0f);
|
||||
|
||||
if (!(playerStatus->flags & 0x20000)) {
|
||||
if (!(playerStatus->flags & PLAYER_STATUS_FLAGS_20000)) {
|
||||
if (playerStatus->alpha1 != D_802D9D70) {
|
||||
if (playerStatus->alpha1 < 254) {
|
||||
renderMode = RENDER_MODE_SURFACE_XLU_LAYER1;
|
||||
@ -132,7 +131,7 @@ void N(reflection_render_wall)(PlayerStatus* playerStatus) {
|
||||
guMtxCatF(main, rotation, main);
|
||||
guRotateF(rotation, playerStatus->spriteFacingAngle, 0.0f, 1.0f, 0.0f);
|
||||
guMtxCatF(main, rotation, main);
|
||||
guScaleF(scale, SPRITE_WORLD_SCALE, SPRITE_WORLD_SCALE, SPRITE_WORLD_SCALE);
|
||||
guScaleF(scale, SPRITE_WORLD_SCALE_F, SPRITE_WORLD_SCALE_F, SPRITE_WORLD_SCALE_F);
|
||||
guMtxCatF(main, scale, main);
|
||||
guTranslateF(translation, playerStatus->position.x, playerStatus->position.y, -playerStatus->position.z - 3.0f);
|
||||
guMtxCatF(main, translation, main);
|
||||
@ -159,9 +158,7 @@ void N(reflection_setup_floor)(void) {
|
||||
s32 renderMode = playerStatus->renderMode;
|
||||
RenderTask renderTask;
|
||||
RenderTask* renderTaskPtr = &renderTask;
|
||||
s32 screenX;
|
||||
s32 screenY;
|
||||
s32 screenZ;
|
||||
s32 screenX, screenY, screenZ;
|
||||
|
||||
if (playerStatus->flags & 1) {
|
||||
entityModel = get_entity_model(get_shadow_by_index(playerStatus->shadowID)->entityModelID);
|
||||
@ -171,7 +168,7 @@ void N(reflection_setup_floor)(void) {
|
||||
|
||||
spr_update_player_sprite(1, playerStatus->trueAnimation, 1.0f);
|
||||
|
||||
if (!(playerStatus->flags & 0x20000)) {
|
||||
if (!(playerStatus->flags & PLAYER_STATUS_FLAGS_20000)) {
|
||||
if (playerStatus->alpha1 != D_802D9D71) {
|
||||
if (playerStatus->alpha1 < 254) {
|
||||
renderMode = RENDER_MODE_SURFACE_XLU_LAYER1;
|
||||
@ -191,7 +188,7 @@ void N(reflection_setup_floor)(void) {
|
||||
renderTaskPtr->appendGfxArg = playerStatus;
|
||||
renderTaskPtr->distance = -screenZ;
|
||||
renderTaskPtr->appendGfx = (void (*)(void*)) (
|
||||
!(playerStatus->flags & 0x20000)
|
||||
!(playerStatus->flags & PLAYER_STATUS_FLAGS_20000)
|
||||
? N(reflection_render_floor)
|
||||
: N(reflection_render_floor_fancy)
|
||||
);
|
||||
@ -214,7 +211,7 @@ void N(reflection_render_floor)(PlayerStatus* playerStatus) {
|
||||
guMtxCatF(main, rotation, main);
|
||||
guRotateF(rotation, playerStatus->spriteFacingAngle, 0.0f, 1.0f, 0.0f);
|
||||
guMtxCatF(main, rotation, main);
|
||||
guScaleF(scale, SPRITE_WORLD_SCALE, -SPRITE_WORLD_SCALE, SPRITE_WORLD_SCALE);
|
||||
guScaleF(scale, SPRITE_WORLD_SCALE_F, -SPRITE_WORLD_SCALE_F, SPRITE_WORLD_SCALE_F);
|
||||
guMtxCatF(main, scale, main);
|
||||
guTranslateF(translation, playerStatus->position.x, -playerStatus->position.y, playerStatus->position.z);
|
||||
guMtxCatF(main, translation, main);
|
||||
@ -303,15 +300,14 @@ void N(reflection_render_floor_fancy)(PlayerStatus* playerStatus) {
|
||||
guMtxCatF(mtx, rotation, mtx);
|
||||
guTranslateF(translation, 0.0f, playerStatus->colliderHeight * 0.5f, 0.0f);
|
||||
guMtxCatF(mtx, translation, mtx);
|
||||
guScaleF(scale, SPRITE_WORLD_SCALE, -SPRITE_WORLD_SCALE, SPRITE_WORLD_SCALE);
|
||||
guScaleF(scale, SPRITE_WORLD_SCALE_F, -SPRITE_WORLD_SCALE_F, SPRITE_WORLD_SCALE_F);
|
||||
guMtxCatF(mtx, scale, mtx);
|
||||
guTranslateF(translation, px, -py, pz);
|
||||
guMtxCatF(mtx, translation, mtx);
|
||||
|
||||
flags = 1;
|
||||
if (playerStatus->spriteFacingAngle >= 90.0f && playerStatus->spriteFacingAngle < 270.0f) {
|
||||
flags = 0x10000001;
|
||||
} else {
|
||||
flags = 1;
|
||||
flags |= 0x10000000;
|
||||
}
|
||||
|
||||
spr_draw_player_sprite(flags, 0, 0, NULL, mtx);
|
||||
|
@ -88,14 +88,14 @@ ApiStatus N(BulletBillAI_Main)(Evt* script, s32 isInitialCall) {
|
||||
npc->pos.z = blasterNpc->pos.z + 1.0;
|
||||
npc->yaw = blasterNpc->yaw;
|
||||
npc->moveSpeed = aiSettings->chaseSpeed;
|
||||
npc->currentAnim.w = enemy->animList[ENEMY_ANIM_RUN];
|
||||
npc->currentAnim = enemy->animList[ENEMY_ANIM_RUN];
|
||||
add_vec2D_polar(&npc->pos.x, &npc->pos.z, 25.0f, npc->yaw);
|
||||
if (npc->yaw < 180.0f) {
|
||||
npc->renderYaw = 180.0f;
|
||||
} else {
|
||||
npc->renderYaw = 0.0f;
|
||||
}
|
||||
npc->currentAnim.w = enemy->animList[ENEMY_ANIM_CHASE];
|
||||
npc->currentAnim = enemy->animList[ENEMY_ANIM_CHASE];
|
||||
npc->duration = 300;
|
||||
npc->flags |= (NPC_FLAG_DIRTY_SHADOW | NPC_FLAG_LOCK_ANIMS);
|
||||
enable_npc_shadow(npc);
|
||||
@ -122,7 +122,7 @@ ApiStatus N(BulletBillAI_Main)(Evt* script, s32 isInitialCall) {
|
||||
}
|
||||
|
||||
if (hitDetected) {
|
||||
npc->currentAnim.w = enemy->animList[ENEMY_ANIM_HIT];
|
||||
npc->currentAnim = enemy->animList[ENEMY_ANIM_HIT];
|
||||
ai_enemy_play_sound(npc, SOUND_B0000018, 0);
|
||||
fx_ring_blast(0, npc->pos.x, npc->pos.y + 5.0f, npc->pos.z + 1.0f, 0.05f, 20);
|
||||
fx_smoke_burst(0, npc->pos.x, npc->pos.y + 5.0f, npc->pos.z + 0.0f, 1.2f, 25);
|
||||
@ -162,7 +162,7 @@ ApiStatus N(BillBlasterAI_Main)(Evt* script, s32 isInitialCall) {
|
||||
if (isInitialCall) {
|
||||
script->AI_TEMP_STATE = AI_STATE_BLASTER_INIT;
|
||||
npc->duration = 30;
|
||||
npc->currentAnim.w = enemy->animList[ENEMY_ANIM_IDLE];
|
||||
npc->currentAnim = enemy->animList[ENEMY_ANIM_IDLE];
|
||||
enemy->flags |= ENEMY_FLAGS_200000;
|
||||
disable_npc_shadow(npc);
|
||||
}
|
||||
@ -173,7 +173,7 @@ ApiStatus N(BillBlasterAI_Main)(Evt* script, s32 isInitialCall) {
|
||||
}
|
||||
|
||||
if (enemy->aiFlags & ENEMY_AI_FLAGS_4) {
|
||||
npc->currentAnim.w = enemy->animList[ENEMY_ANIM_IDLE];
|
||||
npc->currentAnim = enemy->animList[ENEMY_ANIM_IDLE];
|
||||
if (enemy->aiPaused != 0) {
|
||||
return ApiStatus_BLOCK;
|
||||
}
|
||||
@ -195,7 +195,7 @@ ApiStatus N(BillBlasterAI_Main)(Evt* script, s32 isInitialCall) {
|
||||
bulletEnemy->VAR_PROJECTILE_HITBOX_STATE = PROJECTILE_HITBOX_STATE_INIT;
|
||||
bulletEnemy->AI_VAR_BULLET_BLASTER = enemy->npcID;
|
||||
bulletEnemy->AI_VAR_BULLET_RANGE = enemy->AI_VAR_BLASTER_RANGE;
|
||||
npc->currentAnim.w = enemy->animList[ENEMY_ANIM_MELEE_PRE];
|
||||
npc->currentAnim = enemy->animList[ENEMY_ANIM_MELEE_PRE];
|
||||
npc->duration = 10;
|
||||
script->AI_TEMP_STATE = AI_STATE_BLASTER_FIRE;
|
||||
} else {
|
||||
@ -208,7 +208,7 @@ ApiStatus N(BillBlasterAI_Main)(Evt* script, s32 isInitialCall) {
|
||||
if (npc->duration > 0) {
|
||||
break;
|
||||
}
|
||||
npc->currentAnim.w = enemy->animList[ENEMY_ANIM_IDLE];
|
||||
npc->currentAnim = enemy->animList[ENEMY_ANIM_IDLE];
|
||||
bulletEnemy = get_enemy(enemy->AI_VAR_BLASTER_BULLET);
|
||||
bulletEnemy->VAR_PROJECTILE_HITBOX_STATE = PROJECTILE_HITBOX_STATE_PRE;
|
||||
ai_enemy_play_sound(npc, SOUND_328, 0x200000);
|
||||
|
@ -62,7 +62,7 @@ void N(CleftAI_HidingInit)(Evt* script, MobileAISettings* aiSettings, EnemyDetec
|
||||
npc->collisionRadius = 24;
|
||||
script->functionTemp[1] = 0;
|
||||
npc->duration = 0;
|
||||
npc->currentAnim.w = enemy->animList[8];
|
||||
npc->currentAnim = enemy->animList[8];
|
||||
script->AI_TEMP_STATE = AI_STATE_CLEFT_HIDING;
|
||||
}
|
||||
|
||||
@ -74,7 +74,7 @@ void N(CleftAI_Hiding)(Evt* script, MobileAISettings* aiSettings, EnemyDetectVol
|
||||
if (script->functionTemp[1] <= 0) {
|
||||
script->functionTemp[1] = aiSettings->playerSearchInterval;
|
||||
if (basic_ai_check_player_dist(volume, enemy, aiSettings->alertRadius * 0.85, aiSettings->alertOffsetDist, FALSE)) {
|
||||
npc->currentAnim.w = enemy->animList[9];
|
||||
npc->currentAnim = enemy->animList[9];
|
||||
fx_emote(EMOTE_EXCLAMATION, npc, 0.0f, npc->collisionHeight, 1.0f, 2.0f, -20.0f, 15, &emoteTemp);
|
||||
ai_enemy_play_sound(npc, SOUND_2F4, 0x200000);
|
||||
npc->duration = 12;
|
||||
@ -93,7 +93,7 @@ void N(CleftAI_PreAmbush)(Evt* script, MobileAISettings* aiSettings, EnemyDetect
|
||||
if (npc->duration <= 0) {
|
||||
npc->yaw = atan2(npc->pos.x, npc->pos.z, gPlayerStatusPtr->position.x, gPlayerStatusPtr->position.z);
|
||||
enable_npc_shadow(npc);
|
||||
npc->currentAnim.w = enemy->animList[10];
|
||||
npc->currentAnim = enemy->animList[10];
|
||||
npc->duration = 8;
|
||||
script->AI_TEMP_STATE = AI_STATE_CLEFT_AMBUSH;
|
||||
}
|
||||
@ -116,7 +116,7 @@ void N(CleftAI_FindPlayerInit)(Evt* script, MobileAISettings* aiSettings, EnemyD
|
||||
Npc* npc = get_npc_unsafe(enemy->npcID);
|
||||
|
||||
npc->yaw = clamp_angle(npc->yaw + rand_int(180) - 90.0f);
|
||||
npc->currentAnim.w = enemy->animList[ENEMY_ANIM_IDLE];
|
||||
npc->currentAnim = enemy->animList[ENEMY_ANIM_IDLE];
|
||||
script->functionTemp[1] = rand_int(1000) % 2 + 2;
|
||||
script->AI_TEMP_STATE = AI_STATE_CLEFT_FIND_PLAYER;
|
||||
}
|
||||
@ -150,7 +150,7 @@ void N(CleftAI_RevUpInit)(Evt* script, MobileAISettings* aiSettings, EnemyDetect
|
||||
Npc* npc = get_npc_unsafe(enemy->npcID);
|
||||
|
||||
npc->duration = enemy->varTable[10];
|
||||
npc->currentAnim.w = enemy->animList[13];
|
||||
npc->currentAnim = enemy->animList[13];
|
||||
script->AI_TEMP_STATE = AI_STATE_CLEFT_REV_UP;
|
||||
}
|
||||
|
||||
@ -220,7 +220,7 @@ void N(CleftAI_LosePlayer)(Evt* script, MobileAISettings* aiSettings, EnemyDetec
|
||||
|
||||
npc->duration--;
|
||||
if (npc->duration <= 0) {
|
||||
npc->currentAnim.w = enemy->animList[ENEMY_ANIM_WALK];
|
||||
npc->currentAnim = enemy->animList[ENEMY_ANIM_WALK];
|
||||
if (enemy->territory->wander.moveSpeedOverride < 0) {
|
||||
npc->moveSpeed = aiSettings->moveSpeed;
|
||||
} else {
|
||||
@ -256,7 +256,7 @@ void N(CleftAI_DisguiseInit)(Evt* script, MobileAISettings* aiSettings, EnemyDet
|
||||
|
||||
if (npc->turnAroundYawAdjustment == 0 && npc->duration <= 0) {
|
||||
npc->duration = 8;
|
||||
npc->currentAnim.w = enemy->animList[11];
|
||||
npc->currentAnim = enemy->animList[11];
|
||||
script->AI_TEMP_STATE = AI_STATE_CLEFT_DISGUISE;
|
||||
}
|
||||
}
|
||||
@ -268,7 +268,7 @@ void N(CleftAI_Disguise)(Evt* script, MobileAISettings* aiSettings, EnemyDetectV
|
||||
npc->duration--;
|
||||
if (npc->duration <= 0) {
|
||||
npc->duration = 8;
|
||||
npc->currentAnim.w = enemy->animList[14];
|
||||
npc->currentAnim = enemy->animList[14];
|
||||
script->AI_TEMP_STATE = AI_STATE_CLEFT_POST_DISGUISE;
|
||||
}
|
||||
}
|
||||
|
@ -22,9 +22,9 @@ void N(ClubbaNappingAI_Init)(Evt* script, MobileAISettings* aiSettings, EnemyDet
|
||||
}
|
||||
|
||||
if (npc->duration == 1) {
|
||||
npc->currentAnim.w = enemy->animList[12];
|
||||
npc->currentAnim = enemy->animList[12];
|
||||
} else if (npc->duration <= 0) {
|
||||
npc->currentAnim.w = enemy->animList[10];
|
||||
npc->currentAnim = enemy->animList[10];
|
||||
npc->duration = 0;
|
||||
script->AI_TEMP_STATE = AI_STATE_NAPPING_CLUBBA_SLEEP;
|
||||
}
|
||||
@ -42,13 +42,13 @@ void N(ClubbaNappingAI_Sleep)(Evt* script, MobileAISettings* aiSettings, EnemyDe
|
||||
if ( gPlayerStatusPtr->actionState == ACTION_STATE_RUN
|
||||
|| gPlayerStatusPtr->actionState == ACTION_STATE_SPIN
|
||||
|| gPlayerStatusPtr->actionState == ACTION_STATE_JUMP
|
||||
|| gPlayerStatusPtr->actionState == ACTION_STATE_GROUND_POUND
|
||||
|| gPlayerStatusPtr->actionState == ACTION_STATE_ULTRA_POUND
|
||||
|| gPlayerStatusPtr->actionState == ACTION_STATE_SPIN_POUND
|
||||
|| gPlayerStatusPtr->actionState == ACTION_STATE_TORNADO_POUND
|
||||
|| gPlayerStatusPtr->actionState == ACTION_STATE_STEP_DOWN_LAND
|
||||
|| gPlayerStatusPtr->actionState == ACTION_STATE_LAND
|
||||
|| gPlayerStatusPtr->actionState == ACTION_STATE_HAMMER
|
||||
|| gPlayerStatusPtr->actionState == ACTION_STATE_13
|
||||
|| gPlayerStatusPtr->actionState == ACTION_STATE_25) {
|
||||
|| gPlayerStatusPtr->actionState == ACTION_STATE_INVALID_25) {
|
||||
shouldWakeUp = TRUE;
|
||||
}
|
||||
|
||||
@ -70,8 +70,8 @@ void N(ClubbaNappingAI_Sleep)(Evt* script, MobileAISettings* aiSettings, EnemyDe
|
||||
}
|
||||
|
||||
if (shouldWakeUp) {
|
||||
ai_enemy_play_sound(npc, 0xB000000E, 0);
|
||||
npc->currentAnim.w = enemy->animList[11];
|
||||
ai_enemy_play_sound(npc, SOUND_B000000E, 0);
|
||||
npc->currentAnim = enemy->animList[11];
|
||||
npc->duration = 10;
|
||||
fx_emote(EMOTE_EXCLAMATION, npc, 0.0f, npc->collisionHeight, 1.0f, 2.0f, -20.0f, 15, &emoteTemp);
|
||||
ai_enemy_play_sound(npc, SOUND_2F4, 0x200000);
|
||||
@ -80,13 +80,13 @@ void N(ClubbaNappingAI_Sleep)(Evt* script, MobileAISettings* aiSettings, EnemyDe
|
||||
|
||||
npc->duration++;
|
||||
if (npc->duration == 27) {
|
||||
ai_enemy_play_sound(npc, 0xB000000C, 0);
|
||||
ai_enemy_play_sound(npc, SOUND_B000000C, 0);
|
||||
} else if (npc->duration == 57) {
|
||||
ai_enemy_play_sound(npc, 0xB000000D, 0);
|
||||
ai_enemy_play_sound(npc, SOUND_B000000D, 0);
|
||||
} else if (npc->duration == 59) {
|
||||
npc->currentAnim.w = enemy->animList[12];
|
||||
npc->currentAnim = enemy->animList[12];
|
||||
} else if (npc->duration == 60) {
|
||||
npc->currentAnim.w = enemy->animList[10];
|
||||
npc->currentAnim = enemy->animList[10];
|
||||
npc->duration = 0;
|
||||
}
|
||||
}
|
||||
@ -108,7 +108,7 @@ void N(ClubbaNappingAI_LoiterInit)(Evt* script, MobileAISettings* aiSettings, En
|
||||
Npc* npc = get_npc_unsafe(enemy->npcID);
|
||||
|
||||
npc->yaw = clamp_angle((npc->yaw + rand_int(180)) - 90.0f);
|
||||
npc->currentAnim.w = enemy->animList[ENEMY_ANIM_IDLE];
|
||||
npc->currentAnim = enemy->animList[ENEMY_ANIM_IDLE];
|
||||
script->functionTemp[1] = (rand_int(1000) % 2) + 2; // chose random number 2-3
|
||||
script->AI_TEMP_STATE = AI_STATE_NAPPING_CLUBBA_LOITER;
|
||||
}
|
||||
@ -153,7 +153,7 @@ void N(ClubbaNappingAI_ReturnHomeInit)(Evt* script, MobileAISettings* aiSettings
|
||||
|
||||
npc->duration--;
|
||||
if (npc->duration <= 0) {
|
||||
npc->currentAnim.w = enemy->animList[ENEMY_ANIM_WALK];
|
||||
npc->currentAnim = enemy->animList[ENEMY_ANIM_WALK];
|
||||
if (enemy->territory->wander.moveSpeedOverride < 0) {
|
||||
npc->moveSpeed = aiSettings->moveSpeed;
|
||||
} else {
|
||||
@ -173,7 +173,7 @@ void N(ClubbaNappingAI_ReturnHome)(Evt* script, MobileAISettings* aiSettings, En
|
||||
script->AI_TEMP_STATE = AI_STATE_CHASE_INIT;
|
||||
} else if (dist2D(npc->pos.x, npc->pos.z, enemy->territory->wander.centerPos.x,
|
||||
enemy->territory->wander.centerPos.z) <= npc->moveSpeed) {
|
||||
npc->currentAnim.w = enemy->animList[ENEMY_ANIM_IDLE];
|
||||
npc->currentAnim = enemy->animList[ENEMY_ANIM_IDLE];
|
||||
npc->duration = 15;
|
||||
enemy->AI_VAR_NEXT_STATE = AI_STATE_NAPPING_CLUBBA_50;
|
||||
script->AI_TEMP_STATE = AI_STATE_NAPPING_CLUBBA_LOITER_INIT;
|
||||
@ -219,7 +219,7 @@ ApiStatus N(ClubbaNappingAI_Main)(Evt* script, s32 isInitialCall) {
|
||||
if (isInitialCall || (enemy->aiFlags & ENEMY_AI_FLAGS_4)) {
|
||||
script->AI_TEMP_STATE = AI_STATE_NAPPING_CLUBBA_INIT;
|
||||
npc->duration = 30;
|
||||
npc->currentAnim.w = enemy->animList[10];
|
||||
npc->currentAnim = enemy->animList[10];
|
||||
npc->flags &= ~NPC_FLAG_JUMPING;
|
||||
enemy->AI_VAR_ATTACK_STATE = MELEE_HITBOX_STATE_NONE;
|
||||
if (!enemy->territory->wander.isFlying) {
|
||||
@ -230,7 +230,7 @@ ApiStatus N(ClubbaNappingAI_Main)(Evt* script, s32 isInitialCall) {
|
||||
if (enemy->aiFlags & ENEMY_AI_FLAGS_4) {
|
||||
script->AI_TEMP_STATE = AI_STATE_SUSPEND;
|
||||
script->AI_TEMP_STATE_AFTER_SUSPEND = AI_RETURN_HOME_INIT;
|
||||
npc->currentAnim.w = enemy->animList[ENEMY_ANIM_IDLE];
|
||||
npc->currentAnim = enemy->animList[ENEMY_ANIM_IDLE];
|
||||
}
|
||||
enemy->aiFlags &= ~ENEMY_AI_FLAGS_4;
|
||||
}
|
||||
|
@ -25,7 +25,7 @@ ApiStatus N(ClubbaPatrolAI_Main)(Evt* script, s32 isInitialCall) {
|
||||
if (isInitialCall || (enemy->aiFlags & ENEMY_AI_FLAGS_4)) {
|
||||
script->AI_TEMP_STATE = AI_STATE_PATROL_INIT;
|
||||
npc->duration = 0;
|
||||
npc->currentAnim.w = enemy->animList[ENEMY_ANIM_IDLE];
|
||||
npc->currentAnim = enemy->animList[ENEMY_ANIM_IDLE];
|
||||
npc->flags &= ~0x800;
|
||||
if (!enemy->territory->patrol.isFlying) {
|
||||
npc->flags |= 0x200;
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user