other world partners (#981)

* watt

* half sushie

* sushie

* laki first pass

* checkpoint

* ok

* PartnerStatus

* enough

* minor

---------

Co-authored-by: HailSanta <Hail2Santa@gmail.com>
This commit is contained in:
HailSanta 2023-03-16 02:41:26 -04:00 committed by GitHub
parent cea7794e34
commit f0145e8541
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
107 changed files with 2044 additions and 1960 deletions

View File

@ -26,6 +26,7 @@ typedef void NoArgCallback(void*);
typedef s32 b32;
typedef s8 b8;
typedef s32 HitID;
typedef u32 AnimID;
typedef struct {
@ -235,7 +236,7 @@ typedef struct Npc {
/* 0x034 */ f32 renderYaw;
/* 0x038 */ Vec3f pos;
/* 0x044 */ Vec3f rotation;
/* 0x050 */ f32 rotationVerticalPivotOffset;
/* 0x050 */ f32 rotationPivotOffsetY;
/* 0x054 */ Vec3f scale;
/* 0x060 */ Vec3f moveToPos;
/* 0x06C */ Vec3f colliderPos; /* used during collision with player */
@ -2248,22 +2249,22 @@ typedef struct TweesterPhysics {
/* 0x18 */ f32 liftoffVelocityPhase;
} TweesterPhysics; // size = 0x1C
typedef struct PartnerActionStatus {
typedef struct PartnerStatus {
/* 0x000 */ s8 partnerActionState;
/* 0x001 */ b8 partnerAction_unk_1;
/* 0x002 */ s8 partnerAction_unk_2;
/* 0x001 */ b8 shouldResumeAbility;
/* 0x002 */ b8 partnerAction_unk_2;
/* 0x003 */ s8 actingPartner;
/* 0x004 */ s16 stickX;
/* 0x006 */ s16 stickY;
/* 0x008 */ s32 currentButtons;
/* 0x00C */ s32 pressedButtons;
/* 0x010 */ s32 heldButtons;
/* 0x014 */ s8 inputDisabled;
/* 0x014 */ s8 inputDisabledCount;
/* 0x015 */ char unk_15[3];
/* 0x018 */ Npc npc;
/* 0x358 */ s32 unk_358;
/* 0x35C */ char unk_35C[0x4];
} PartnerActionStatus; // size = 0x360
} PartnerStatus; // size = 0x360
typedef struct SpriteRasterInfo {
/* 0x00 */ IMG_PTR raster;

View File

@ -40,7 +40,7 @@
#define gCurrentCameraID dead_gCurrentCameraID
#define add_vec2D_polar dead_add_vec2D_polar
#define gCurrentCamID dead_gCurrentCamID
#define gPartnerActionStatus dead_gPartnerActionStatus
#define gPartnerStatus dead_gPartnerStatus
#define get_npc_safe dead_get_npc_safe
#define sfx_adjust_env_sound_pos dead_sfx_adjust_env_sound_pos
#define fx_star_spirits_energy dead_fx_star_spirits_energy

View File

@ -2228,20 +2228,18 @@ typedef struct MiscParticlesFXData {
} MiscParticlesFXData; // size = 0x64
typedef struct StaticStatusFXData {
/* 0x00 */ s32 unk_00;
/* 0x04 */ f32 unk_04;
/* 0x08 */ f32 unk_08;
/* 0x0C */ f32 unk_0C;
/* 0x00 */ s32 type;
/* 0x04 */ Vec3f pos;
/* 0x10 */ f32 unk_10;
/* 0x14 */ f32 unk_14;
/* 0x18 */ f32 unk_18;
/* 0x1C */ f32 unk_1C;
/* 0x20 */ s32 unk_20;
/* 0x24 */ f32 unk_24;
/* 0x28 */ s32 unk_28;
/* 0x2C */ s32 unk_2C;
/* 0x30 */ s32 unk_30;
/* 0x34 */ f32 unk_34;
/* 0x20 */ s32 frame; // not visible when negative
/* 0x24 */ f32 rotation;
/* 0x28 */ s32 timeLeft;
/* 0x2C */ s32 lifetime;
/* 0x30 */ s32 alpha;
/* 0x34 */ f32 scale;
} StaticStatusFXData; // size = 0x38
typedef struct MovingCloudFXData {

View File

@ -2341,14 +2341,14 @@ enum PlayerAnims {
ANIM_MarioB3_Hammer2_Charged = 0x00050007,
ANIM_MarioB3_Hammer3_Charging = 0x00050008,
ANIM_MarioB3_Hammer3_Charged = 0x00050009,
ANIM_MarioW1_Carry = 0x00060000,
ANIM_MarioW1_CarryWalk = 0x00060000,
ANIM_MarioW1_CarryAbove = 0x00060001,
ANIM_MarioW1_CarryRun = 0x00060002,
ANIM_MarioW1_CarryAboveRun = 0x00060003,
ANIM_MarioW1_PushToward = 0x00060004,
ANIM_MarioW1_TakeItem = 0x00060005,
ANIM_MarioW1_PlaceItem = 0x00060006,
ANIM_MarioW1_PlaceRecord = 0x00060007,
ANIM_MarioW1_CarryIdle = 0x00060007,
ANIM_MarioW1_TakeItemSquashed = 0x00060008,
ANIM_MarioW1_JumpWatt = 0x00060009,
ANIM_MarioW1_FallWatt = 0x0006000A,
@ -3709,7 +3709,7 @@ enum PlayerStatusAnimFlags {
/* This allows dismounting from Lakilester, even if in a precarious situation (like over spikes, lava, or water). */
PA_FLAG_DISMOUNTING_ALLOWED = 0x20000000,
/* This flag is set when partner usage was interrupted by a script, and it prevents menu sounds (like the error sound) from playing for script-initiated player actions */
PA_FLAG_PARTNER_USAGE_STOPPED = 0x40000000,
PA_FLAG_FORCED_PARTNER_ABILITY_END = 0x40000000,
/* This one's really weird. Seems to have something to do with the direction Mario is facing, but I'm not sure what it's actually supposed to be achieving. */
PA_FLAG_80000000 = 0x80000000,
};
@ -5368,6 +5368,7 @@ enum ColliderFlags {
SURFACE_TYPE_LAVA = 3,
SURFACE_TYPE_SPIKES = 2,
SURFACE_TYPE_WATER = 1,
SURFACE_TYPE_INVALID = -1,
COLLIDER_FLAG_SAFE_FLOOR = 0x00000100,
COLLIDER_FLAG_IGNORE_SHELL = 0x00008000,

View File

@ -230,7 +230,7 @@ void phys_main_collision_below(void);
void phys_peach_update(void);
void check_input_spin(void);
s32 npc_test_move_simple_without_slipping(s32, f32*, f32*, f32*, f32, f32, f32, f32);
b32 npc_test_move_simple_without_slipping(s32, f32*, f32*, f32*, f32, f32, f32, f32);
void update_collider_transform(s16 colliderID);
void get_collider_center(s32 colliderID, f32* x, f32* y, f32* z);
@ -403,19 +403,19 @@ s32 create_shadow_type(s32 type, f32 x, f32 y, f32 z);
s32 is_point_within_region(s32 shape, f32 pointX, f32 pointY, f32 centerX, f32 centerY, f32 sizeX, f32 sizeZ);
PlayerData* get_player_data(void);
s32 npc_raycast_down_around(s32, f32*, f32*, f32*, f32*, f32, f32);
b32 npc_raycast_down_around(s32, f32*, f32*, f32*, f32*, f32, f32);
s32 npc_raycast_down_sides(s32 ignoreFlags, f32* posX, f32* posY, f32* posZ, f32* hitDepth);
s32 npc_raycast_up(s32, f32*, f32*, f32*, f32*);
s32 npc_raycast_up_corners(s32 ignoreFlags, f32* posX, f32* posY, f32* posZ, f32* hitDepth, f32 yaw, f32 radius);
s32 player_raycast_up_corners(PlayerStatus*, f32*, f32*, f32*, f32*, f32);
s32 player_raycast_below_cam_relative(PlayerStatus* playerStatus, f32* outX, f32* outY, f32* outZ, f32* outLength,
f32* hitRx, f32* hitRz, f32* hitDirX, f32* hitDirZ);
s32 npc_test_move_taller_with_slipping(s32, f32*, f32*, f32*, f32, f32, f32, f32);
s32 npc_test_move_simple_with_slipping(s32, f32*, f32*, f32*, f32, f32, f32, f32);
b32 npc_test_move_taller_with_slipping(s32, f32*, f32*, f32*, f32, f32, f32, f32);
b32 npc_test_move_simple_with_slipping(s32, f32*, f32*, f32*, f32, f32, f32, f32);
s32 npc_test_move_complex_with_slipping(s32, f32*, f32*, f32*, f32, f32, f32, f32);
// Partner
EvtScript* partner_get_ride_script(void);
EvtScript* partner_get_enter_map_script(void);
void partner_handle_before_battle(void);
void partner_walking_update_player_tracking(Npc* partner);
void partner_walking_update_motion(Npc* partner);
@ -759,9 +759,6 @@ void pulse_stone_notification_setup(void);
void appendGfx_speech_bubble(void);
void appendGfx_pulse_stone_icon(void);
void ispy_notification_setup(void);
s32 lakilester_raycast_below(void);
void world_watt_sync_held_position(void);
void func_802BFB44_323694(f32 arg0);
void initialize_curtains(void);
void update_curtains(void);

View File

@ -257,7 +257,7 @@ extern s32 D_802EC390[];
extern s32 D_802EC3B0[];
extern s32 D_802EC3D0[];
extern PartnerActionStatus gPartnerActionStatus; // something with partners
extern PartnerStatus gPartnerStatus;
extern UiStatus gUIStatus;
extern PlayerStatus gPlayerStatus;
extern PlayerSpinState gPlayerSpinState;

View File

@ -3398,7 +3398,7 @@ void btl_update_message_popup(void* data) {
case BTL_MSG_40:
case BTL_MSG_41:
hud_element_set_script(D_8029F642, &HES_PressAButton);
/* fallthrough */
// fallthrough
case BTL_MSG_2E:
case BTL_MSG_30:
case BTL_MSG_3C:

View File

@ -3256,7 +3256,7 @@ void func_8025C918(s32 isNpcSprite, ActorPart* part, s32 yaw, s32 arg3) {
baseAngle = decor->unk75C;
if (decor->unk75C >= 360) {
decor->unk75C = baseAngle - ((baseAngle / 360) * 360);
decor->unk75C = baseAngle % 360;
}
for (i = 0; i < ARRAY_COUNT(rbuf); i++) {

View File

@ -417,7 +417,7 @@ s32 is_point_within_region(s32 shape, f32 pointX, f32 pointY, f32 centerX, f32 c
s32 basic_ai_check_player_dist(EnemyDetectVolume* territory, Enemy* enemy, f32 radius, f32 fwdPosOffset, s8 useWorldYaw) {
Npc* npc = get_npc_unsafe(enemy->npcID);
PlayerStatus* playerStatus = &gPlayerStatus;
PartnerActionStatus* partnerActionStatus;
PartnerStatus* partnerStatus;
f32 x, y, z;
f32 dist;
s32 skipCheckForPlayer;
@ -426,13 +426,13 @@ s32 basic_ai_check_player_dist(EnemyDetectVolume* territory, Enemy* enemy, f32 r
return FALSE;
}
partnerActionStatus = &gPartnerActionStatus;
if (partnerActionStatus->actingPartner == PARTNER_BOW && partnerActionStatus->partnerActionState
partnerStatus = &gPartnerStatus;
if (partnerStatus->actingPartner == PARTNER_BOW && partnerStatus->partnerActionState
&& !(territory->detectFlags & AI_TERRITORY_IGNORE_HIDING)) {
return FALSE;
}
if (partnerActionStatus->actingPartner == PARTNER_SUSHIE && partnerActionStatus->partnerActionState
if (partnerStatus->actingPartner == PARTNER_SUSHIE && partnerStatus->partnerActionState
&& !(territory->detectFlags & AI_TERRITORY_IGNORE_HIDING)) {
return FALSE;
}
@ -463,7 +463,7 @@ s32 basic_ai_check_player_dist(EnemyDetectVolume* territory, Enemy* enemy, f32 r
y = npc->pos.y + npc->collisionHeight * 0.5;
z = npc->pos.z;
dist = dist2D(npc->pos.x, npc->pos.z, playerStatus->position.x, playerStatus->position.z);
if (npc_test_move_simple_with_slipping(0x50000,
if (npc_test_move_simple_with_slipping(COLLISION_CHANNEL_10000 | COLLISION_IGNORE_ENTITIES,
&x, &y, &z,
dist, atan2(npc->pos.x, npc->pos.z, playerStatus->position.x, playerStatus->position.z),
0.1f, 0.1f)) {

View File

@ -89,11 +89,11 @@ ApiStatus func_8005DB00(Evt* script, s32 isInitialCall) {
Npc* npc;
f32 targetDir, npcYaw;
PlayerStatus* playerStatus;
PartnerActionStatus* partnerStatus;
PartnerStatus* partnerStatus;
npc = get_npc_unsafe(script->owner1.enemy->npcID);
playerStatus = &gPlayerStatus;
partnerStatus = &gPartnerActionStatus;
partnerStatus = &gPartnerStatus;
if (isInitialCall) {
script->functionTemp[0] = 0;

View File

@ -2,6 +2,7 @@
#include "ld_addrs.h"
#include "world/actions.h"
#include "sprite.h"
#include "world/partner/watt.h"
#ifdef SHIFT
#define inspect_icon_VRAM_DEF inspect_icon_VRAM
@ -781,12 +782,12 @@ void player_reset_data(void) {
}
s32 func_800DFCF4(void) {
if (gPartnerActionStatus.partnerActionState == PARTNER_ACTION_USE &&
(gPartnerActionStatus.actingPartner == PARTNER_WATT
|| gPartnerActionStatus.actingPartner == PARTNER_BOW
|| gPartnerActionStatus.actingPartner == PARTNER_SUSHIE
|| gPartnerActionStatus.actingPartner == PARTNER_PARAKARRY
|| gPartnerActionStatus.actingPartner == PARTNER_LAKILESTER)) {
if (gPartnerStatus.partnerActionState == PARTNER_ACTION_USE &&
(gPartnerStatus.actingPartner == PARTNER_WATT
|| gPartnerStatus.actingPartner == PARTNER_BOW
|| gPartnerStatus.actingPartner == PARTNER_SUSHIE
|| gPartnerStatus.actingPartner == PARTNER_PARAKARRY
|| gPartnerStatus.actingPartner == PARTNER_LAKILESTER)) {
return FALSE;
}
return TRUE;
@ -794,7 +795,7 @@ s32 func_800DFCF4(void) {
s32 get_overriding_player_anim(s32 anim) {
PlayerStatus* playerStatus = &gPlayerStatus;
PartnerActionStatus* partnerActionStatus = &gPartnerActionStatus;
PartnerStatus* partnerStatus = &gPartnerStatus;
if (playerStatus->actionState == ACTION_STATE_USE_SPINNING_FLOWER
&& anim != ANIM_Mario1_Flail
@ -803,13 +804,13 @@ s32 get_overriding_player_anim(s32 anim) {
return -1;
}
if (partnerActionStatus->partnerActionState != PARTNER_ACTION_NONE) {
if (partnerActionStatus->actingPartner == PARTNER_LAKILESTER && anim == ANIM_Mario1_Idle) {
if (partnerStatus->partnerActionState != PARTNER_ACTION_NONE) {
if (partnerStatus->actingPartner == PARTNER_LAKILESTER && anim == ANIM_Mario1_Idle) {
anim = ANIM_MarioW2_RideLaki;
}
if (partnerActionStatus->partnerActionState != PARTNER_ACTION_NONE
&& partnerActionStatus->actingPartner == PARTNER_BOW
if (partnerStatus->partnerActionState != PARTNER_ACTION_NONE
&& partnerStatus->actingPartner == PARTNER_BOW
&& anim != ANIM_Mario1_Crouch
&& anim != ANIM_Mario1_Idle
) {
@ -817,7 +818,7 @@ s32 get_overriding_player_anim(s32 anim) {
}
}
if (anim == ANIM_Mario1_ThumbsUp && partnerActionStatus->partnerActionState == PARTNER_ACTION_USE) {
if (anim == ANIM_Mario1_ThumbsUp && partnerStatus->partnerActionState == PARTNER_ACTION_USE) {
return -1;
}
@ -882,8 +883,8 @@ void update_player_blink(void) {
u8 phi_v1;
u8* alpha;
if (gPartnerActionStatus.actingPartner == PARTNER_BOW) {
outtaSight = gPartnerActionStatus.partnerActionState != PARTNER_ACTION_NONE;
if (gPartnerStatus.actingPartner == PARTNER_BOW) {
outtaSight = gPartnerStatus.partnerActionState != PARTNER_ACTION_NONE;
}
if (playerStatus->blinkTimer > 0) {
@ -977,7 +978,7 @@ s32 game_scripts_disabled(void) {
s32 ret = FALSE;
if (gGameStatusPtr->disableScripts && (gGameStatusPtr->currentButtons[0] & BUTTON_R)) {
if (gPartnerActionStatus.partnerActionState == PARTNER_ACTION_NONE) {
if (gPartnerStatus.partnerActionState == PARTNER_ACTION_NONE) {
set_action_state(ACTION_STATE_IDLE);
}
ret = TRUE;
@ -1042,7 +1043,7 @@ void check_for_pulse_stone(void) {
return;
}
if (gPlayerStatus.flags & PS_FLAG_PAUSED || gPlayerStatus.inputDisabledCount) {
if (gPlayerStatus.flags & PS_FLAG_PAUSED || gPlayerStatus.inputDisabledCount != 0) {
return;
}
@ -1127,7 +1128,7 @@ s32 func_800E06D8(void) {
s32 interactingID = playerStatus->interactingWithID;
s32 currentWall;
if (playerStatus->timeInAir != 0 || playerStatus->inputDisabledCount) {
if (playerStatus->timeInAir != 0 || playerStatus->inputDisabledCount != 0) {
return FALSE;
}
if (gCollisionStatus.currentWall == NO_COLLIDER) {

View File

@ -27,7 +27,7 @@ void func_800E5520(void) {
}
s32 phys_adjust_cam_on_landing(void) {
PartnerActionStatus* partnerActionStatus = &gPartnerActionStatus;
PartnerStatus* partnerStatus = &gPartnerStatus;
GameStatus* gameStatus = gGameStatusPtr;
PlayerStatus* playerStatus = &gPlayerStatus;
s32 ret = 1;
@ -160,7 +160,7 @@ s32 phys_adjust_cam_on_landing(void) {
} else {
gCameras[CAM_DEFAULT].moveFlags &= ~CAMERA_MOVE_IGNORE_PLAYER_Y;
}
} else if (partnerActionStatus->partnerActionState != PARTNER_ACTION_NONE && partnerActionStatus->actingPartner == PARTNER_PARAKARRY) {
} else if (partnerStatus->partnerActionState != PARTNER_ACTION_NONE && partnerStatus->actingPartner == PARTNER_PARAKARRY) {
gCameras[CAM_DEFAULT].moveFlags |= CAMERA_MOVE_FLAG_2;
} else {
gCameras[CAM_DEFAULT].moveFlags &= ~CAMERA_MOVE_FLAG_2;
@ -215,7 +215,7 @@ void phys_reset_spin_history(void) {
void phys_update_action_state(void) {
Camera* cameras = gCameras;
PartnerActionStatus* partnerActionStatus = &gPartnerActionStatus;
PartnerStatus* partnerStatus = &gPartnerStatus;
PlayerStatus* playerStatus = &gPlayerStatus;
PlayerSpinState* playerSpinState = &gPlayerSpinState;
@ -266,7 +266,7 @@ void phys_update_action_state(void) {
cond = FALSE;
}
if ((partnerActionStatus->partnerActionState == PARTNER_ACTION_NONE) && !(playerStatus->flags & PS_FLAG_PAUSED) && cond) {
if ((partnerStatus->partnerActionState == PARTNER_ACTION_NONE) && !(playerStatus->flags & PS_FLAG_PAUSED) && cond) {
set_action_state(ACTION_STATE_TALK);
}
check_input_spin();
@ -364,7 +364,7 @@ void set_action_state(s32 actionState) {
partner = playerData->currentPartner;
if (partner == PARTNER_SUSHIE || partner == PARTNER_LAKILESTER || partner == PARTNER_PARAKARRY) {
if (gPartnerActionStatus.partnerActionState != PARTNER_ACTION_NONE) {
if (gPartnerStatus.partnerActionState != PARTNER_ACTION_NONE) {
playerStatus->animFlags |= PA_FLAG_INTERRUPT_USE_PARTNER;
playerStatus->flags |= PS_FLAG_HIT_FIRE;
return;
@ -455,7 +455,7 @@ s32 check_input_hammer(void) {
return FALSE;
}
if (gPartnerActionStatus.partnerActionState == PARTNER_ACTION_USE && playerData->currentPartner == PARTNER_WATT) {
if (gPartnerStatus.partnerActionState == PARTNER_ACTION_USE && playerData->currentPartner == PARTNER_WATT) {
return FALSE;
}

View File

@ -18,7 +18,7 @@ void record_jump_apex(void) {
s32 can_trigger_loading_zone(void) {
PlayerData* playerData = &gPlayerData;
s32 actionState = gPlayerStatusPtr->actionState;
PartnerActionStatus* partnerActionStatus = &gPartnerActionStatus;
PartnerStatus* partnerStatus = &gPartnerStatus;
if (actionState == ACTION_STATE_IDLE ||
actionState == ACTION_STATE_WALK ||
@ -31,17 +31,17 @@ s32 can_trigger_loading_zone(void) {
if (actionState == ACTION_STATE_RIDE) {
if (playerData->currentPartner == PARTNER_LAKILESTER || playerData->currentPartner == PARTNER_BOW) {
if (partnerActionStatus->partnerActionState != PARTNER_ACTION_NONE) {
if (partnerStatus->partnerActionState != PARTNER_ACTION_NONE) {
return TRUE;
} else {
gPlayerStatusPtr->animFlags |= PA_FLAG_INTERRUPT_USE_PARTNER;
return FALSE;
}
} else {
if (partnerActionStatus->actingPartner == PARTNER_WATT || partnerActionStatus->actingPartner == PARTNER_SUSHIE) {
return partnerActionStatus->partnerActionState != PARTNER_ACTION_NONE;
if (partnerStatus->actingPartner == PARTNER_WATT || partnerStatus->actingPartner == PARTNER_SUSHIE) {
return partnerStatus->partnerActionState != PARTNER_ACTION_NONE;
}
if (partnerActionStatus->actingPartner == PARTNER_PARAKARRY) {
if (partnerStatus->actingPartner == PARTNER_PARAKARRY) {
gPlayerStatusPtr->animFlags |= PA_FLAG_INTERRUPT_USE_PARTNER;
return FALSE;
}
@ -334,7 +334,7 @@ void phys_update_falling(void) {
void player_handle_floor_collider_type(s32 colliderID) {
PlayerStatus* playerStatus = &gPlayerStatus;
PartnerActionStatus* partnerActionStatus = &gPartnerActionStatus;
PartnerStatus* partnerStatus = &gPartnerStatus;
if (colliderID >= 0) {
s32 surfaceType = get_collider_flags(colliderID) & COLLIDER_FLAGS_SURFACE_TYPE_MASK;
@ -345,7 +345,7 @@ void player_handle_floor_collider_type(s32 colliderID) {
set_action_state(ACTION_STATE_LAND);
break;
case SURFACE_TYPE_LAVA:
if ((*(s32*)(&partnerActionStatus->partnerActionState) & 0xFF0000FF) != 0x01000009) {
if ((*(s32*)(&partnerStatus->partnerActionState) & 0xFF0000FF) != 0x01000009) {
if (playerStatus->blinkTimer == 0) {
if (playerStatus->actionState != ACTION_STATE_HIT_LAVA) {
playerStatus->hazardType = HAZARD_TYPE_LAVA;
@ -357,7 +357,7 @@ void player_handle_floor_collider_type(s32 colliderID) {
}
break;
case SURFACE_TYPE_SPIKES:
if ((*(s32*)(&partnerActionStatus->partnerActionState) & 0xFF0000FF) != 0x01000009) {
if ((*(s32*)(&partnerStatus->partnerActionState) & 0xFF0000FF) != 0x01000009) {
if (playerStatus->blinkTimer == 0) {
if (playerStatus->actionState != ACTION_STATE_HIT_FIRE) {
playerStatus->hazardType = HAZARD_TYPE_SPIKES;
@ -877,7 +877,7 @@ s32 phys_is_on_sloped_ground(void) {
void phys_main_collision_below(void) {
PlayerStatus* playerStatus = &gPlayerStatus;
PartnerActionStatus* partnerActionStatus = &gPartnerActionStatus;
PartnerStatus* partnerStatus = &gPartnerStatus;
CollisionStatus* collisionStatus = &gCollisionStatus;
f32 collHeightHalf = playerStatus->colliderHeight * 0.5f;
f32 playerX = playerStatus->position.x;
@ -925,7 +925,7 @@ void phys_main_collision_below(void) {
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 (partnerStatus->partnerActionState == PARTNER_ACTION_NONE || partnerStatus->actingPartner != PARTNER_BOW) {
if (playerStatus->blinkTimer == 0) {
if (playerStatus->actionState != ACTION_STATE_HIT_LAVA) {
playerStatus->hazardType = HAZARD_TYPE_SPIKES;
@ -937,7 +937,7 @@ void phys_main_collision_below(void) {
}
break;
case SURFACE_TYPE_LAVA:
if (partnerActionStatus->partnerActionState == PARTNER_ACTION_NONE || partnerActionStatus->actingPartner != PARTNER_BOW) {
if (partnerStatus->partnerActionState == PARTNER_ACTION_NONE || partnerStatus->actingPartner != PARTNER_BOW) {
if (playerStatus->blinkTimer == 0) {
if (playerStatus->actionState != ACTION_STATE_HIT_LAVA) {
playerStatus->hazardType = HAZARD_TYPE_LAVA;
@ -1165,13 +1165,13 @@ s32 phys_check_interactable_collision(void) {
}
s32 phys_can_player_interact(void) {
PartnerActionStatus* partnerActionStatus = &gPartnerActionStatus;
PartnerStatus* partnerStatus = &gPartnerStatus;
PlayerStatus* playerStatus = &gPlayerStatus;
s32 ret = TRUE;
if (gPartnerActionStatus.partnerActionState != PARTNER_ACTION_NONE) {
if (gPartnerActionStatus.actingPartner == PARTNER_BOMBETTE) {
if (gPartnerActionStatus.partnerActionState <= PARTNER_ACTION_BOMBETTE_2) {
if (gPartnerStatus.partnerActionState != PARTNER_ACTION_NONE) {
if (gPartnerStatus.actingPartner == PARTNER_BOMBETTE) {
if (gPartnerStatus.partnerActionState <= PARTNER_ACTION_BOMBETTE_2) {
ret = FALSE;
}
} else {

View File

@ -6,6 +6,7 @@
#include "sprite.h"
#include "pause/pause_common.h"
#include "world/partners.h"
#include "world/partner/lakilester.h"
BSS s16 D_8010C9C0;
BSS char D_8010C9C4[0x4];
@ -27,7 +28,7 @@ extern s32 D_8008EEF0[];
void func_800E6860(void) {
PlayerStatus* playerStatus = &gPlayerStatus;
if (gPartnerActionStatus.partnerActionState != PARTNER_ACTION_NONE && gPartnerActionStatus.actingPartner == PARTNER_BOW) {
if (gPartnerStatus.partnerActionState != PARTNER_ACTION_NONE && gPartnerStatus.actingPartner == PARTNER_BOW) {
Npc* partner = get_npc_unsafe(NPC_PARTNER);
func_802DDEE4(PLAYER_SPRITE_MAIN, -1, FOLD_TYPE_7, 0, 0, 0, playerStatus->alpha1, 0);
@ -37,7 +38,7 @@ void func_800E6860(void) {
}
s32 func_800E6904(void) {
PartnerActionStatus* partnerActionStatus = &gPartnerActionStatus;
PartnerStatus* partnerStatus = &gPartnerStatus;
PlayerStatus* playerStatus = &gPlayerStatus;
s32 actionState = playerStatus->actionState;
@ -45,20 +46,20 @@ s32 func_800E6904(void) {
return FALSE;
}
if (partnerActionStatus->partnerActionState == PARTNER_ACTION_NONE) {
if (partnerStatus->partnerActionState == PARTNER_ACTION_NONE) {
if (!(playerStatus->flags & PS_FLAG_NO_STATIC_COLLISION) &&
(actionState == ACTION_STATE_IDLE || actionState == ACTION_STATE_WALK || actionState == ACTION_STATE_RUN))
{
return TRUE;
}
} else if (partner_player_can_pause()) {
if (partnerActionStatus->actingPartner == PARTNER_WATT) {
if (partnerStatus->actingPartner == PARTNER_WATT) {
return TRUE;
} else if (partnerActionStatus->actingPartner == PARTNER_BOW) {
} else if (partnerStatus->actingPartner == PARTNER_BOW) {
if (actionState == ACTION_STATE_RIDE) {
return TRUE;
}
} else if (partnerActionStatus->actingPartner == PARTNER_LAKILESTER) {
} else if (partnerStatus->actingPartner == PARTNER_LAKILESTER) {
if (actionState == ACTION_STATE_RIDE) {
return TRUE;
}
@ -69,7 +70,7 @@ s32 func_800E6904(void) {
}
s32 can_pause(s32 currentButtons, s32 pressedButtons) {
PartnerActionStatus* partnerActionStatus = &gPartnerActionStatus;
PartnerStatus* partnerStatus = &gPartnerStatus;
s32 actionState = gPlayerStatus.actionState;
if (!(gPlayerStatus.animFlags & PA_FLAG_CHANGING_MAP)
@ -81,7 +82,7 @@ s32 can_pause(s32 currentButtons, s32 pressedButtons) {
&& !is_picking_up_item()
) {
if (!(gPlayerStatus.animFlags & PA_FLAG_8BIT_MARIO)) {
if (partnerActionStatus->partnerActionState == PARTNER_ACTION_NONE) {
if (partnerStatus->partnerActionState == PARTNER_ACTION_NONE) {
if (!(gPlayerStatus.flags & PS_FLAG_NO_STATIC_COLLISION)) {
if (actionState == ACTION_STATE_IDLE ||
actionState == ACTION_STATE_WALK ||
@ -91,23 +92,23 @@ s32 can_pause(s32 currentButtons, s32 pressedButtons) {
}
}
} else if (partner_player_can_pause()) {
if (partnerActionStatus->actingPartner == PARTNER_WATT) {
if (partnerStatus->actingPartner == PARTNER_WATT) {
return actionState == ACTION_STATE_IDLE ||
actionState == ACTION_STATE_WALK ||
actionState == ACTION_STATE_RUN;
} else if (partnerActionStatus->actingPartner == PARTNER_BOW) {
} else if (partnerStatus->actingPartner == PARTNER_BOW) {
if (actionState == ACTION_STATE_RIDE) {
gPlayerStatus.alpha2 = 0;
return TRUE;
}
} else if (partnerActionStatus->actingPartner == PARTNER_LAKILESTER) {
} else if (partnerStatus->actingPartner == PARTNER_LAKILESTER) {
if (actionState == ACTION_STATE_RIDE) {
if (lakilester_raycast_below()) {
if (world_lakilester_can_dismount()) {
return TRUE;
}
sfx_play_sound(SOUND_MENU_ERROR);
}
} else if (partnerActionStatus->actingPartner == PARTNER_SUSHIE) {
} else if (partnerStatus->actingPartner == PARTNER_SUSHIE) {
sfx_play_sound(SOUND_MENU_ERROR);
}
}
@ -181,7 +182,7 @@ s32 setup_item_popup(PopupMenu* menu) {
void check_input_open_menus(void) {
static s16 D_8010C9C0;
PartnerActionStatus* partnerActionStatus;
PartnerStatus* partnerStatus;
PlayerStatus* playerStatus;
PlayerData* playerData;
PopupMenu* popup;
@ -191,7 +192,7 @@ void check_input_open_menus(void) {
s32 currentButtons;
s8* partnerActionState;
partnerActionStatus = &gPartnerActionStatus;
partnerStatus = &gPartnerStatus;
playerStatus = &gPlayerStatus;
playerData = &gPlayerData;
popup = &D_8010C9C8;
@ -203,18 +204,18 @@ void check_input_open_menus(void) {
return;
}
if (partnerActionStatus->partnerActionState != 0 &&
(partnerActionStatus->actingPartner == PARTNER_SUSHIE ||
partnerActionStatus->actingPartner == PARTNER_LAKILESTER ||
partnerActionStatus->actingPartner == PARTNER_BOW))
if (partnerStatus->partnerActionState != 0 &&
(partnerStatus->actingPartner == PARTNER_SUSHIE ||
partnerStatus->actingPartner == PARTNER_LAKILESTER ||
partnerStatus->actingPartner == PARTNER_BOW))
{
currentButtons = partnerActionStatus->currentButtons;
pressedButtons = partnerActionStatus->pressedButtons;
currentButtons = partnerStatus->currentButtons;
pressedButtons = partnerStatus->pressedButtons;
} else {
currentButtons = playerStatus->currentButtons;
pressedButtons = playerStatus->pressedButtons;
}
partnerActionState = &partnerActionStatus->partnerActionState;
partnerActionState = &partnerStatus->partnerActionState;
if (evt_get_variable(NULL, GB_StoryProgress) >= STORY_EPILOGUE) {
currentButtons &= ~(BUTTON_C_LEFT | BUTTON_C_RIGHT);
@ -274,7 +275,7 @@ block_17:
break;
case 1:
flags = ~PS_FLAG_PAUSED;
if ((func_800E6904() == 0) || is_picking_up_item() || D_8010CCFE < playerStatus->inputDisabledCount) {
if ((func_800E6904() == 0) || is_picking_up_item() || D_8010CCFE < playerStatus->inputDisabledCount != 0) {
playerStatus->flags &= flags;
enable_player_input();
partner_enable_input();

View File

@ -1775,7 +1775,7 @@ void func_80133A94(s32 idx, s32 itemID) {
#ifdef NON_EQUIVALENT
s32 test_item_player_collision(ItemEntity* item) {
PlayerStatus* playerStatus = &gPlayerStatus;
PartnerActionStatus* partnerActionStatus = &gPartnerActionStatus;
PartnerStatus* partnerStatus = &gPartnerStatus;
EncounterStatus* encounterStatus = &gCurrentEncounter;
Camera* camera = &gCameras[gCurrentCameraID];
s32 actionState;
@ -1832,7 +1832,7 @@ s32 test_item_player_collision(ItemEntity* item) {
return FALSE;
}
if (partnerActionStatus->partnerActionState != 0 && partnerActionStatus->actingPartner == 9) {
if (partnerStatus->partnerActionState != 0 && partnerStatus->actingPartner == 9) {
return FALSE;
}

View File

@ -250,7 +250,7 @@ void sfx_compute_spatialized_sound_params_full(f32 x, f32 y, f32 z, s16* volume,
offsetX = 0.0f;
}
volAmtOffsetX = update_lerp(0, 1.0f, 0.0f, offsetX, 200);
volAmtOffsetX = update_lerp(EASING_LINEAR, 1.0f, 0.0f, offsetX, 200);
if (volAmtOffsetX < 0.0) {
volAmtOffsetX = 0.0f;
}
@ -260,7 +260,7 @@ void sfx_compute_spatialized_sound_params_full(f32 x, f32 y, f32 z, s16* volume,
offsetY = 0.0f;
}
volAmtDeltaY = update_lerp(0, 1.0f, 0.0f, offsetY, 130);
volAmtDeltaY = update_lerp(EASING_LINEAR, 1.0f, 0.0f, offsetY, 130);
if (volAmtDeltaY < 0.0) {
volAmtDeltaY = 0.0f;
}
@ -270,7 +270,7 @@ void sfx_compute_spatialized_sound_params_full(f32 x, f32 y, f32 z, s16* volume,
depth = 0.0f;
}
volAmtDepth = update_lerp(0, 1.0f, 0.0f, depth, 250);
volAmtDepth = update_lerp(EASING_LINEAR, 1.0f, 0.0f, depth, 250);
if (volAmtDepth < 0.0) {
volAmtDepth = 0.0f;
}

View File

@ -2914,9 +2914,9 @@ API_CALLABLE(func_80219188_465618) {
wattEffectData->effect2->flags |= EFFECT_INSTANCE_FLAG_10;
wattEffectData->effect2 = NULL;
}
wattEffectData->effect1->data.staticStatus->unk_04 = x;
wattEffectData->effect1->data.staticStatus->unk_08 = y;
wattEffectData->effect1->data.staticStatus->unk_0C = z;
wattEffectData->effect1->data.staticStatus->pos.x = x;
wattEffectData->effect1->data.staticStatus->pos.y = y;
wattEffectData->effect1->data.staticStatus->pos.z = z;
break;
case 1:
if (wattEffectData->effect1 != NULL) {
@ -2927,9 +2927,9 @@ API_CALLABLE(func_80219188_465618) {
wattEffectData->effect2 = fx_static_status(1, x, y, z, (actor->debuff != STATUS_SHRINK) ? 1.0f : 0.4f, 5, 0);
}
wattEffectData->effect2->data.staticStatus->unk_04 = x;
wattEffectData->effect2->data.staticStatus->unk_08 = y;
wattEffectData->effect2->data.staticStatus->unk_0C = z;
wattEffectData->effect2->data.staticStatus->pos.x = x;
wattEffectData->effect2->data.staticStatus->pos.y = y;
wattEffectData->effect2->data.staticStatus->pos.z = z;
break;
}
} else {

View File

@ -45,9 +45,9 @@ API_CALLABLE(N(UnkWattEffectFunc1)) {
wattEffectData->effect2->flags |= EFFECT_INSTANCE_FLAG_10;
wattEffectData->effect2 = NULL;
}
wattEffectData->effect1->data.staticStatus->unk_04 = x;
wattEffectData->effect1->data.staticStatus->unk_08 = y;
wattEffectData->effect1->data.staticStatus->unk_0C = z;
wattEffectData->effect1->data.staticStatus->pos.x = x;
wattEffectData->effect1->data.staticStatus->pos.y = y;
wattEffectData->effect1->data.staticStatus->pos.z = z;
break;
case 1:
if (wattEffectData->effect1 != NULL) {
@ -58,9 +58,9 @@ API_CALLABLE(N(UnkWattEffectFunc1)) {
wattEffectData->effect2 = fx_static_status(1, x, y, z, (actor->debuff != STATUS_SHRINK) ? 1.0f : 0.4f, 5, 0);
}
wattEffectData->effect2->data.staticStatus->unk_04 = x;
wattEffectData->effect2->data.staticStatus->unk_08 = y;
wattEffectData->effect2->data.staticStatus->unk_0C = z;
wattEffectData->effect2->data.staticStatus->pos.x = x;
wattEffectData->effect2->data.staticStatus->pos.y = y;
wattEffectData->effect2->data.staticStatus->pos.z = z;
break;
}
} else {

View File

@ -80,9 +80,9 @@ API_CALLABLE(N(WattFXUpdate)) {
sWattEffectData_effect2->flags |= EFFECT_INSTANCE_FLAG_10;
sWattEffectData_effect2 = NULL;
}
sWattEffectData_effect1->data.staticStatus->unk_04 = x;
sWattEffectData_effect1->data.staticStatus->unk_08 = y;
sWattEffectData_effect1->data.staticStatus->unk_0C = z;
sWattEffectData_effect1->data.staticStatus->pos.x = x;
sWattEffectData_effect1->data.staticStatus->pos.y = y;
sWattEffectData_effect1->data.staticStatus->pos.z = z;
break;
case 1:
if (sWattEffectData_effect1 != NULL) {
@ -92,9 +92,9 @@ API_CALLABLE(N(WattFXUpdate)) {
if (sWattEffectData_effect2 == NULL) {
sWattEffectData_effect2 = fx_static_status(1, x, y, z, 1.0f, 5, 0);
}
sWattEffectData_effect2->data.staticStatus->unk_04 = x;
sWattEffectData_effect2->data.staticStatus->unk_08 = y;
sWattEffectData_effect2->data.staticStatus->unk_0C = z;
sWattEffectData_effect2->data.staticStatus->pos.x = x;
sWattEffectData_effect2->data.staticStatus->pos.y = y;
sWattEffectData_effect2->data.staticStatus->pos.z = z;
break;
}
} else {

View File

@ -270,7 +270,7 @@ void func_80032970(Camera* camera, f32 arg1) {
camera->unk_510 = 0.0f;
} else {
if (gPlayerStatusPtr->animFlags & PA_FLAG_RIDING_PARTNER) {
stickX = gPartnerActionStatus.stickX;
stickX = gPartnerStatus.stickX;
} else {
stickX = gPlayerStatusPtr->stickAxis[0];
}

View File

@ -90,7 +90,7 @@ void ice_pillar_update(EffectInstance* effect) {
EffectInstance* iceShard;
iceShard = ice_shard_main(
(i - ((i / 2) * 2)) + 2,
(i % 2) + 2,
(data->pos.x + shim_rand_int(20)) - 10.0f,
data->pos.y + (shim_rand_int(40) * data->scale),
data->pos.z + 3.0f,

View File

@ -7,24 +7,25 @@ extern Gfx D_090003A0_3E1670[];
Gfx* D_E00E6880[] = { D_090003A0_3E1670, D_090003A0_3E1670 };
Gfx* D_E00E6888[] = { D_09000280_3E1550, D_09000280_3E1550 };
s32 D_E00E6890[] = { 24, 12 };
// number of frames in animation for type 0 and type 1
s32 StaticEffectFrameCount[] = { 24, 12 };
f32 D_E00E6898[] = {
f32 StaticEffectScaleVals0[] = {
0.9f, 1.0f, 1.0f, 0.9f, 0.85f, 0.8f, 0.75f, 0.7f, 0.65f, 0.6f, 0.55f, 0.5f,
0.45f, 0.4f, 0.35f, 0.3f, 0.25f, 0.2f, 0.15f, 0.1f, 0.05f, 0.03f, 0.02f, 0.01f
};
u8 D_E00E68F8[] = {
u8 StaticEffectAlphaVals0[] = {
0xFA, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF
};
f32 D_E00E6910[] = {
f32 StaticEffectScaleVals1[] = {
0.9f, 1.0f, 1.0f, 0.9f, 0.8f, 0.7f, 0.6f, 0.5f, 0.4f, 0.3f, 0.2f, 0.1f,
0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f
};
u8 D_E00E6970[] = {
u8 StaticEffectAlphaVals1[] = {
0xFA, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
};
@ -35,21 +36,21 @@ void static_status_render(EffectInstance* effect);
void static_status_appendGfx(void* effect);
EffectInstance* static_status_main(
s32 arg0,
f32 arg1,
f32 arg2,
f32 arg3,
f32 arg4,
s32 arg5,
s32 arg6)
s32 type,
f32 x,
f32 y,
f32 z,
f32 scale,
s32 numBolts,
s32 duration)
{
EffectBlueprint bp;
EffectInstance* effect;
StaticStatusFXData* part;
f32 temp_f0;
f32 invisTime;
s32 i;
arg5++;
numBolts++;
bp.init = static_status_init;
bp.update = static_status_update;
@ -59,28 +60,28 @@ EffectInstance* static_status_main(
bp.effectID = EFFECT_STATIC_STATUS;
effect = shim_create_effect_instance(&bp);
effect->numParts = arg5;
part = effect->data.staticStatus = shim_general_heap_malloc(arg5 * sizeof(*part));
effect->numParts = numBolts;
part = effect->data.staticStatus = shim_general_heap_malloc(numBolts * sizeof(*part));
ASSERT(effect->data.staticStatus != NULL);
part->unk_00 = arg0;
part->unk_2C = 0;
if (arg6 <= 0) {
part->unk_28 = 1000;
part->type = type;
part->lifetime = 0;
if (duration <= 0) {
part->timeLeft = 1000;
} else {
part->unk_28 = arg6;
part->timeLeft = duration;
}
part->unk_30 = 255;
part->unk_04 = arg1;
part->unk_08 = arg2;
part->unk_0C = arg3;
part->unk_34 = arg4;
part->alpha = 255;
part->pos.x = x;
part->pos.y = y;
part->pos.z = z;
part->scale = scale;
temp_f0 = D_E00E6890[arg0] * 0.5f;
invisTime = StaticEffectFrameCount[type] * 0.5f;
part++;
for (i = 1; i < arg5; i++, part++) {
part->unk_20 = -1.0f - temp_f0 * (i & 1);
for (i = 1; i < numBolts; i++, part++) {
part->frame = -1.0f - invisTime * (i & 1);
}
return effect;
@ -91,83 +92,82 @@ void static_status_init(EffectInstance* effect) {
void static_status_update(EffectInstance* effect) {
StaticStatusFXData* part = effect->data.staticStatus;
s32 unk_00 = part->unk_00;
s32 type = part->type;
s32 unk_28;
s32 unk_2C;
f32 var_fs1;
f32 var_fs2;
s32 time;
f32 interpAmt;
f32 initialAmt;
f32 angle;
s32 i;
if (effect->flags & 0x10) {
effect->flags &= ~0x10;
part->unk_28 = 16;
if (effect->flags & EFFECT_INSTANCE_FLAG_10) {
effect->flags &= ~EFFECT_INSTANCE_FLAG_10;
part->timeLeft = 16;
}
if (part->unk_28 < 1000) {
part->unk_28--;
if (part->timeLeft < 1000) {
part->timeLeft--;
}
part->unk_2C++;
part->lifetime++;
if (part->unk_28 < 0) {
if (part->timeLeft < 0) {
shim_remove_effect(effect);
return;
}
unk_28 = part->unk_28;
unk_2C = part->unk_2C;
time = part->lifetime;
if (unk_28 < 16) {
part->unk_30 = unk_28 * 16;
if (part->timeLeft < 16) {
part->alpha = part->timeLeft * 16;
}
if (unk_00 == 0) {
var_fs2 = 0.1f;
var_fs1 = 0.2f;
if (type == 0) {
initialAmt = 0.1f;
interpAmt = 0.2f;
} else {
var_fs2 = 0.2f;
var_fs1 = 0.2f;
initialAmt = 0.2f;
interpAmt = 0.2f;
}
part++;
for (i = 1; i < effect->numParts; i++, part++) {
part->unk_20++;
if (part->unk_20 >= D_E00E6890[unk_00]) {
part->unk_20 = 0;
part->frame++;
if (part->frame >= StaticEffectFrameCount[type]) {
part->frame = 0;
}
if (part->unk_20 >= 0) {
if (part->unk_20 == 0) {
if (part->frame >= 0) {
if (part->frame == 0) {
angle = (i * 360.0f) / (effect->numParts - 1);
part->unk_04 = shim_sin_deg(angle) * 16.0f;
part->unk_08 = shim_cos_deg(angle) * 16.0f;
part->unk_10 = part->unk_04 * var_fs2;
part->unk_14 = part->unk_08 * var_fs2;
part->pos.x = shim_sin_deg(angle) * 16.0f;
part->pos.y = shim_cos_deg(angle) * 16.0f;
part->unk_10 = part->pos.x * initialAmt;
part->unk_14 = part->pos.y * initialAmt;
part->unk_18 = 0.0f;
part->unk_1C = 0.0f;
part->unk_34 = 1.0f;
part->unk_24 = -angle - 45.0f;
part->scale = 1.0f;
part->rotation = -angle - 45.0f;
}
if (unk_00 == 0) {
part->unk_30 = D_E00E68F8[part->unk_20];
part->unk_34 = D_E00E6898[part->unk_20];
if (type == 0) {
part->alpha = StaticEffectAlphaVals0[part->frame];
part->scale = StaticEffectScaleVals0[part->frame];
} else {
part->unk_30 = D_E00E6970[part->unk_20];
part->unk_34 = D_E00E6910[part->unk_20];
part->alpha = StaticEffectAlphaVals1[part->frame];
part->scale = StaticEffectScaleVals1[part->frame];
}
if ((unk_2C & 1) == (i & 1)) {
part->unk_04 += part->unk_10;
part->unk_08 += part->unk_14;
if ((time & 1) == (i & 1)) {
part->pos.x += part->unk_10;
part->pos.y += part->unk_14;
} else {
part->unk_04 += part->unk_10 * 0.2;
part->unk_08 += part->unk_14 * 0.2;
part->pos.x += part->unk_10 * 0.2;
part->pos.y += part->unk_14 * 0.2;
}
part->unk_10 += (part->unk_18 - part->unk_10) * var_fs1;
part->unk_14 += (part->unk_1C - part->unk_14) * var_fs1;
part->unk_10 += (part->unk_18 - part->unk_10) * interpAmt;
part->unk_14 += (part->unk_1C - part->unk_14) * interpAmt;
}
}
}
@ -191,19 +191,19 @@ void func_E00E651C(void) {
void static_status_appendGfx(void* effect) {
StaticStatusFXData* part = ((EffectInstance*)effect)->data.staticStatus;
Camera* camera = &gCameras[gCurrentCameraID];
s32 unk_30 = part->unk_30;
s32 unk_00 = part->unk_00;
Matrix4f sp20;
Matrix4f sp60;
s32 unk_30 = part->alpha;
s32 unk_00 = part->type;
Matrix4f mtxTransform;
Matrix4f mtxTemp;
s32 i;
gDPPipeSync(gMainGfxPos++);
gSPSegment(gMainGfxPos++, 0x09, VIRTUAL_TO_PHYSICAL(((EffectInstance*)effect)->graphics->data));
shim_guTranslateF(sp20, part->unk_04, part->unk_08, part->unk_0C);
shim_guScaleF(sp60, part->unk_34, part->unk_34, part->unk_34);
shim_guMtxCatF(sp60, sp20, sp20);
shim_guMtxF2L(sp20, &gDisplayContext->matrixStack[gMatrixListPos]);
shim_guTranslateF(mtxTransform, part->pos.x, part->pos.y, part->pos.z);
shim_guScaleF(mtxTemp, part->scale, part->scale, part->scale);
shim_guMtxCatF(mtxTemp, mtxTransform, mtxTransform);
shim_guMtxF2L(mtxTransform, &gDisplayContext->matrixStack[gMatrixListPos]);
gSPMatrix(gMainGfxPos++, &gDisplayContext->matrixStack[gMatrixListPos++], G_MTX_PUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
gSPMatrix(gMainGfxPos++, camera->unkMatrix, G_MTX_NOPUSH | G_MTX_MUL | G_MTX_MODELVIEW);
@ -211,12 +211,12 @@ void static_status_appendGfx(void* effect) {
part++;
for (i = 1; i < ((EffectInstance*)effect)->numParts; i++, part++) {
if (part->unk_20 >= 0) {
shim_guPositionF(sp20, 0.0f, 0.0f, part->unk_24, part->unk_34, part->unk_04, part->unk_08, 0.0f);
shim_guMtxF2L(sp20, &gDisplayContext->matrixStack[gMatrixListPos]);
if (part->frame >= 0) {
shim_guPositionF(mtxTransform, 0.0f, 0.0f, part->rotation, part->scale, part->pos.x, part->pos.y, 0.0f);
shim_guMtxF2L(mtxTransform, &gDisplayContext->matrixStack[gMatrixListPos]);
gSPMatrix(gMainGfxPos++, &gDisplayContext->matrixStack[gMatrixListPos++], G_MTX_PUSH | G_MTX_MUL | G_MTX_MODELVIEW);
gDPSetPrimColor(gMainGfxPos++, 0, 0, 0, 0, 0, (unk_30 * part->unk_30) >> 8);
gDPSetPrimColor(gMainGfxPos++, 0, 0, 0, 0, 0, (unk_30 * part->alpha) >> 8);
gSPDisplayList(gMainGfxPos++, D_E00E6880[unk_00]);
gSPPopMatrix(gMainGfxPos++, G_MTX_MODELVIEW);
}

View File

@ -661,7 +661,7 @@ void update_encounters_neutral(void) {
gGameStatusPtr->debugEnemyContact == DEBUG_CONTACT_CANT_TOUCH ||
(playerStatus->flags & PS_FLAG_ARMS_RAISED) ||
(gOverrideFlags & GLOBAL_OVERRIDES_40) ||
gPartnerActionStatus.actingPartner == PARTNER_BOW ||
gPartnerStatus.actingPartner == PARTNER_BOW ||
(enemy->flags & ENEMY_FLAG_PASSIVE) ||
(gOverrideFlags & (GLOBAL_OVERRIDES_DISABLE_BATTLES | GLOBAL_OVERRIDES_200 | GLOBAL_OVERRIDES_400 | GLOBAL_OVERRIDES_800)) ||
is_picking_up_item()) {
@ -734,11 +734,11 @@ void update_encounters_neutral(void) {
testY = npcY;
testZ = npcZ;
if (npc_test_move_taller_with_slipping(COLLISION_CHANNEL_10000, &testX, &testY, &testZ, distance, atan2(npcX, npcZ, playerX, playerZ), colHeight, colRadius * 2.0f) != 0) {
if (npc_test_move_taller_with_slipping(COLLISION_CHANNEL_10000, &testX, &testY, &testZ, distance, atan2(npcX, npcZ, playerX, playerZ), colHeight, colRadius * 2.0f)) {
testX = playerX;
testY = playerY;
testZ = playerZ;
if (npc_test_move_taller_with_slipping(COLLISION_CHANNEL_10000, &testX, &testY, &testZ, distance, atan2(playerX, playerZ, npcX, npcZ), colHeight, colRadius * 2.0f) != 0) {
if (npc_test_move_taller_with_slipping(COLLISION_CHANNEL_10000, &testX, &testY, &testZ, distance, atan2(playerX, playerZ, npcX, npcZ), colHeight, colRadius * 2.0f)) {
break;
}
}
@ -797,11 +797,11 @@ void update_encounters_neutral(void) {
testX = npcX;
testY = npcY;
testZ = npcZ;
if (npc_test_move_taller_with_slipping(COLLISION_CHANNEL_10000, &testX, &testY, &testZ, distance, atan2(npcX, npcZ, playerX, playerZ), colHeight, colRadius * 2.0f) != 0) {
if (npc_test_move_taller_with_slipping(COLLISION_CHANNEL_10000, &testX, &testY, &testZ, distance, atan2(npcX, npcZ, playerX, playerZ), colHeight, colRadius * 2.0f)) {
testX = playerX;
testY = playerY;
testZ = playerZ;
if (npc_test_move_taller_with_slipping(COLLISION_CHANNEL_10000, &testX, &testY, &testZ, distance, atan2(playerX, playerZ, npcX, npcZ), colHeight, colRadius * 2.0f) != 0) {
if (npc_test_move_taller_with_slipping(COLLISION_CHANNEL_10000, &testX, &testY, &testZ, distance, atan2(playerX, playerZ, npcX, npcZ), colHeight, colRadius * 2.0f)) {
break;
}
}
@ -882,11 +882,11 @@ void update_encounters_neutral(void) {
testX = npcX;
testY = npcY;
testZ = npcZ;
if (npc_test_move_taller_with_slipping(COLLISION_CHANNEL_10000, &testX, &testY, &testZ, distance, atan2(npcX, npcZ, playerX, playerZ), colHeight, colRadius * 2.0f) != 0) {
if (npc_test_move_taller_with_slipping(COLLISION_CHANNEL_10000, &testX, &testY, &testZ, distance, atan2(npcX, npcZ, playerX, playerZ), colHeight, colRadius * 2.0f)) {
testX = playerX;
testY = playerY;
testZ = playerZ;
if (npc_test_move_taller_with_slipping(COLLISION_CHANNEL_10000, &testX, &testY, &testZ, distance, atan2(playerX, playerZ, npcX, npcZ), colHeight, colRadius * 2.0f) != 0) {
if (npc_test_move_taller_with_slipping(COLLISION_CHANNEL_10000, &testX, &testY, &testZ, distance, atan2(playerX, playerZ, npcX, npcZ), colHeight, colRadius * 2.0f)) {
continue;
}
}
@ -1570,7 +1570,7 @@ void update_encounters_post_battle(void) {
EncounterStatus* currentEncounter = &gCurrentEncounter;
PlayerStatus* playerStatus = &gPlayerStatus;
PlayerData* playerData = &gPlayerData;
PartnerActionStatus* partnerActionStatus = &gPartnerActionStatus;
PartnerStatus* partnerStatus = &gPartnerStatus;
Encounter* encounter;
Evt* script;
Enemy* enemy;
@ -1611,7 +1611,7 @@ void update_encounters_post_battle(void) {
partner_handle_after_battle();
}
D_8009A63C = FALSE;
if (partnerActionStatus->partnerAction_unk_1) {
if (partnerStatus->shouldResumeAbility) {
D_8009A63C = TRUE;
} else if (D_8009A670 == 0 &&
!(gPlayerStatus.flags & (PS_FLAG_JUMPING | PS_FLAG_FALLING)) &&
@ -2281,7 +2281,7 @@ s32 check_conversation_trigger(void) {
playerY = playerStatus->position.y;
playerZ = playerStatus->position.z;
if (gPartnerActionStatus.partnerActionState != PARTNER_ACTION_NONE) {
if (gPartnerStatus.partnerActionState != PARTNER_ACTION_NONE) {
return FALSE;
}

View File

@ -796,7 +796,7 @@ ApiStatus GetSelfAnimationFromTable(Evt* script, s32 isInitialCall) {
ApiStatus func_80045798(Evt* script, s32 isInitialCall) {
Bytecode* args = script->ptrReadPos;
gPartnerActionStatus.unk_358 = evt_get_variable(script, *args++);
gPartnerStatus.unk_358 = evt_get_variable(script, *args++);
return ApiStatus_DONE2;
}

View File

@ -87,7 +87,7 @@ void entity_HugeBlueSwitch_idle(Entity* entity) {
void entity_small_switch_idle(Entity* entity) {
SwitchData* data = entity->dataBuf.swtch;
PlayerStatus* playerStatus = &gPlayerStatus;
PartnerActionStatus* partnerActionStatus = &gPartnerActionStatus;
PartnerStatus* partnerStatus = &gPartnerStatus;
entity_switch_fall_down(entity);
@ -111,7 +111,7 @@ void entity_small_switch_idle(Entity* entity) {
return;
}
if (partnerActionStatus->actingPartner == PARTNER_PARAKARRY && partnerActionStatus->partnerActionState != PARTNER_ACTION_NONE) {
if (partnerStatus->actingPartner == PARTNER_PARAKARRY && partnerStatus->partnerActionState != PARTNER_ACTION_NONE) {
return;
}

View File

@ -267,7 +267,7 @@ void func_802BB98C_E2E2BC(Entity* entity) {
void entity_CymbalPlant_idle(Entity* entity) {
CymbalPlantData* data = entity->dataBuf.cymbalPlant;
PartnerActionStatus* partnerActionStatus = &gPartnerActionStatus;
PartnerStatus* partnerStatus = &gPartnerStatus;
PlayerStatus* playerStatus = &gPlayerStatus;
f32 yaw;
f32 targetYaw;
@ -275,7 +275,7 @@ void entity_CymbalPlant_idle(Entity* entity) {
switch (data->state) {
case 0:
if (entity->collisionFlags & ENTITY_COLLISION_PLAYER_TOUCH_FLOOR) {
if (partnerActionStatus->actingPartner != 0) {
if (partnerStatus->actingPartner != 0) {
playerStatus->animFlags |= PA_FLAG_INTERRUPT_USE_PARTNER;
}
func_800EF300();
@ -334,7 +334,7 @@ void entity_CymbalPlant_idle(Entity* entity) {
}
break;
case 6:
if (!(entity->collisionFlags & ENTITY_COLLISION_PLAYER_TOUCH_FLOOR) && partnerActionStatus->partnerActionState == PARTNER_ACTION_NONE) {
if (!(entity->collisionFlags & ENTITY_COLLISION_PLAYER_TOUCH_FLOOR) && partnerStatus->partnerActionState == PARTNER_ACTION_NONE) {
data->state = 0;
enable_partner_ai();
phys_adjust_cam_on_landing();

View File

@ -139,7 +139,7 @@ void entity_StarBoxLauncher_launch(Entity* entity) {
data->faceTexOffset = D_802BCAA0_E313F0[0];
data->faceAnimTimer = D_802BCAA0_E313F0[1];
sfx_play_sound(SOUND_2085);
/* fallthrough */
// fallthrough
case 1:
temp = entity->position.y;
entity->position.y = temp + 8.0 * sin_rad(DEG_TO_RAD(data->riseSpeedPhase));

View File

@ -201,7 +201,7 @@ void entity_Tweester_move(Entity* entity) {
void entity_Tweester_idle(Entity* entity) {
PlayerStatus* playerStatus = &gPlayerStatus;
PartnerActionStatus* partnerActionStatus = &gPartnerActionStatus;
PartnerStatus* partnerStatus = &gPartnerStatus;
PlayerData* playerData = &gPlayerData;
TweesterData* data = entity->dataBuf.tweester;
f32 delta;
@ -265,7 +265,7 @@ void entity_Tweester_idle(Entity* entity) {
entity->rotation.y = -gCameras[CAM_DEFAULT].currentYaw;
if (partnerActionStatus->partnerActionState == PARTNER_ACTION_NONE || partnerActionStatus->actingPartner != PARTNER_BOW) {
if (partnerStatus->partnerActionState == PARTNER_ACTION_NONE || partnerStatus->actingPartner != PARTNER_BOW) {
if (playerStatus->actionState == ACTION_STATE_USE_TWEESTER) {
Npc* npc = npc_find_closest_simple(entity->position.x, entity->position.y, entity->position.z, 50.0f);
if (npc != NULL && (npc->flags & NPC_FLAG_PARTNER)) {

View File

@ -118,7 +118,7 @@ ApiStatus SetNpcRotationPivot(Evt* script, s32 isInitialCall) {
return ApiStatus_DONE2;
}
npc->rotationVerticalPivotOffset = value;
npc->rotationPivotOffsetY = value;
return ApiStatus_DONE2;
}
@ -952,16 +952,16 @@ ApiStatus GetCurrentPartnerID(Evt* script, s32 isInitialCall) {
}
ApiStatus PartnerCanUseAbility(Evt* script, s32 isInitialCall) {
Bytecode arg0 = *script->ptrReadPos;
Bytecode outVar = *script->ptrReadPos;
evt_set_variable(script, arg0, partner_can_use_ability());
evt_set_variable(script, outVar, partner_can_use_ability());
return ApiStatus_DONE2;
}
ApiStatus PartnerIsFlying(Evt* script, s32 isInitialCall) {
Bytecode arg0 = *script->ptrReadPos;
Bytecode outVar = *script->ptrReadPos;
evt_set_variable(script, arg0, partner_is_flying());
evt_set_variable(script, outVar, partner_is_flying());
return ApiStatus_DONE2;
}

View File

@ -772,7 +772,7 @@ ApiStatus GetPartnerInUse(Evt* script, s32 isInitialCall) {
PlayerData* playerData = &gPlayerData;
s32 currentPartner = PARTNER_NONE;
if (gPartnerActionStatus.partnerActionState != PARTNER_ACTION_NONE) {
if (gPartnerStatus.partnerActionState != PARTNER_ACTION_NONE) {
currentPartner = playerData->currentPartner;
}

View File

@ -52,7 +52,7 @@ void appendGfx_ispy_icon(void) {
}
flashPhase = ISpyPtr->flashCount;
flashPhase = flashPhase - (flashPhase / 12) * 12;
flashPhase = flashPhase % 12;
switch (flashPhase) {
case 0:
case 1:
@ -102,7 +102,7 @@ void ispy_notification_setup(void) {
void ispy_notification_update(void) {
PlayerStatus* playerStatus = &gPlayerStatus;
PartnerActionStatus* partnerActionStatus = &gPartnerActionStatus;
PartnerStatus* partnerStatus = &gPartnerStatus;
s32 cond;
ISpyPtr->pos.y +=
@ -112,8 +112,8 @@ void ispy_notification_update(void) {
switch (ISpyPtr->state) {
case I_SPY_DELAY:
if (partnerActionStatus->partnerActionState != PARTNER_ACTION_NONE
&& partnerActionStatus->actingPartner == PARTNER_LAKILESTER
if (partnerStatus->partnerActionState != PARTNER_ACTION_NONE
&& partnerStatus->actingPartner == PARTNER_LAKILESTER
) {
cond = gGameStatusPtr->keepUsingPartnerOnMapChange;
} else {

View File

@ -815,7 +815,7 @@ void msg_copy_to_print_buffer(MessagePrintState* printer, s32 arg1, s32 arg2) {
break;
case MSG_STYLE_LAMPPOST:
printer->windowSize.y = *srcBuf++;
/* fallthrough */
// fallthrough
case MSG_STYLE_SIGN:
do {
if (!s8) {
@ -1812,20 +1812,20 @@ void get_msg_properties(s32 msgID, s32* height, s32* width, s32* maxLineChars, s
break;
case MSG_READ_FUNC_CUSTOM_VOICE:
i++;
/* fallthrough */
// fallthrough
temp = 4;
case MSG_READ_FUNC_IMAGE:
i += temp;
/* fallthrough */
// fallthrough
case MSG_READ_FUNC_ANIM_SPRITE:
case MSG_READ_FUNC_ANIM_DELAY:
i++;
/* fallthrough */
// fallthrough
case MSG_READ_FUNC_SPEED:
case MSG_READ_FUNC_SET_X:
case MSG_READ_FUNC_ANIM_LOOP:
i++;
/* fallthrough */
// fallthrough
case MSG_READ_FUNC_COLOR:
case MSG_READ_FUNC_SPACING:
case MSG_READ_FUNC_SCROLL:
@ -1897,7 +1897,7 @@ void get_msg_properties(s32 msgID, s32* height, s32* width, s32* maxLineChars, s
case MSG_CHAR_READ_FULL_SPACE:
case MSG_CHAR_READ_HALF_SPACE:
spaceCount++;
/* fallthrough */
// fallthrough
default:
if (endl) {
lineCount++;
@ -2069,7 +2069,7 @@ void msg_update_rewind_arrow(s32 printerIndex) {
printer->rewindArrowCounter = 0;
printer->rewindArrowSwingPhase = 0;
printer->rewindArrowAnimState = REWIND_ARROW_STATE_GROW;
/* fallthrough */
// fallthrough
case REWIND_ARROW_STATE_GROW:
temp = printer->rewindArrowCounter;
scale = temp * 0.2 + 0.5;

View File

@ -121,7 +121,7 @@ s32 create_npc_impl(NpcBlueprint* blueprint, AnimID* animList, s32 isPeachNpc) {
npc->colliderPos.x = 0.0f;
npc->colliderPos.y = 0.0f;
npc->colliderPos.z = 0.0f;
npc->rotationVerticalPivotOffset = 0.0f;
npc->rotationPivotOffsetY = 0.0f;
npc->rotation.x = 0.0f;
npc->rotation.y = 0.0f;
npc->rotation.z = 0.0f;
@ -143,7 +143,7 @@ s32 create_npc_impl(NpcBlueprint* blueprint, AnimID* animList, s32 isPeachNpc) {
npc->foldType = 0;
npc->foldArg5 = 0;
npc->collisionChannel = COLLISION_CHANNEL_20000;
npc->isFacingAway = 0;
npc->isFacingAway = FALSE;
npc->yawCamOffset = 0;
npc->turnAroundYawAdjustment = 0;
npc->currentFloor = NO_COLLIDER;
@ -417,9 +417,9 @@ void npc_do_other_npc_collision(Npc* npc) {
if (!(thisBuf + otherBuf <= dist)) {
collision = FALSE;
if (npc->flags & NPC_FLAG_PARTNER) {
collision = gPartnerActionStatus.partnerActionState == PARTNER_ACTION_NONE;
collision = gPartnerStatus.partnerActionState == PARTNER_ACTION_NONE;
} else if (!(otherNpc->flags & NPC_FLAG_PARTNER) ||
gPartnerActionStatus.partnerActionState == PARTNER_ACTION_NONE)
gPartnerStatus.partnerActionState == PARTNER_ACTION_NONE)
{
collision = TRUE;
}
@ -821,8 +821,8 @@ void appendGfx_npc(void* data) {
guMtxCatF(mtx2, mtx1, mtx1);
}
if (npc->rotationVerticalPivotOffset != 0.0f) {
guTranslateF(mtx2, 0.0f, npc->rotationVerticalPivotOffset, 0.0f);
if (npc->rotationPivotOffsetY != 0.0f) {
guTranslateF(mtx2, 0.0f, npc->rotationPivotOffsetY, 0.0f);
guMtxCatF(mtx2, mtx1, mtx1);
}
@ -841,8 +841,8 @@ void appendGfx_npc(void* data) {
guMtxCatF(mtx2, mtx1, mtx1);
}
if (npc->rotationVerticalPivotOffset != 0.0f) {
guTranslateF(mtx2, 0.0f, -npc->rotationVerticalPivotOffset, 0.0f);
if (npc->rotationPivotOffsetY != 0.0f) {
guTranslateF(mtx2, 0.0f, -npc->rotationPivotOffsetY, 0.0f);
guMtxCatF(mtx2, mtx1, mtx1);
}
@ -1500,7 +1500,7 @@ s32 npc_draw_palswap_mode_2(Npc* npc, s32 arg1, s32 arg2, Matrix4f mtx) {
npc->palSwapLerpAlpha = 0;
npc->palSwapState = 1;
}
/* fallthrough */
// fallthrough
case 1:
npc->palSwapLerpAlpha += 25600 / npc->unk_30E;
if (npc->palSwapLerpAlpha > 25500) {
@ -1531,7 +1531,7 @@ s32 npc_draw_palswap_mode_2(Npc* npc, s32 arg1, s32 arg2, Matrix4f mtx) {
npc->palSwapLerpAlpha = 0;
npc->palSwapState = 3;
}
/* fallthrough */
// fallthrough
case 3:
npc->palSwapLerpAlpha += 25600 / npc->unk_312;
if (npc->palSwapLerpAlpha > 25500) {
@ -1622,7 +1622,7 @@ s32 npc_draw_palswap_mode_4(Npc* npc, s32 arg1, Matrix4f mtx) {
npc->palSwapLerpAlpha = 0;
npc->palSwapState = 1;
}
/* fallthrough */
// fallthrough
case 1:
npc->palSwapLerpAlpha += 25600 / npc->unk_30E;
if (npc->palSwapLerpAlpha > 25500) {
@ -1663,7 +1663,7 @@ s32 npc_draw_palswap_mode_4(Npc* npc, s32 arg1, Matrix4f mtx) {
npc->palSwapLerpAlpha = 0;
npc->palSwapState = 3;
}
/* fallthrough */
// fallthrough
case 3:
npc->palSwapLerpAlpha += 25600 / npc->unk_312;
if (npc->palSwapLerpAlpha > 25500) {
@ -2162,7 +2162,7 @@ void func_8003D624(Npc* npc, s32 foldType, s32 arg2, s32 arg3, s32 arg4, s32 arg
//TODO begin split for npc_surfaces
void spawn_surface_effects(Npc* npc, SurfaceInteractMode mode) {
PartnerActionStatus* temp = &gPartnerActionStatus;
PartnerStatus* temp = &gPartnerStatus;
if ((npc->flags & (NPC_FLAG_TOUCHES_GROUND | NPC_FLAG_INVISIBLE)) == NPC_FLAG_TOUCHES_GROUND) {
if (npc->moveSpeed != 0.0f) {

View File

@ -70,7 +70,7 @@ s32 npc_raycast_down(s32 ignoreFlags, f32* startX, f32* startY, f32* startZ, f32
return colliderID;
}
s32 npc_raycast_down_around(s32 ignoreFlags, f32* posX, f32* posY, f32* posZ, f32* hitDepth, f32 yaw, f32 radius) {
b32 npc_raycast_down_around(s32 ignoreFlags, f32* posX, f32* posY, f32* posZ, f32* hitDepth, f32 yaw, f32 radius) {
f32 startX;
f32 startY;
f32 startZ;
@ -490,7 +490,7 @@ s32 npc_test_move_with_slipping(s32 ignoreFlags, f32* x, f32* y, f32* z, f32 len
f32 inverseOutCosTheta;
s32 raycastHitID;
s32 phi_s5;
s32 phi_s2 = -1;
s32 hitResult = NO_COLLIDER;
f32 a, b;
sin_cos_rad(DEG_TO_RAD(yaw), &outSinTheta, &outCosTheta);
@ -518,7 +518,7 @@ s32 npc_test_move_with_slipping(s32 ignoreFlags, f32* x, f32* y, f32* z, f32 len
*x += a + outX;
*z += b + outY;
NpcHitQueryColliderID = raycastHitID;
phi_s2 = raycastHitID;
hitResult = raycastHitID;
}
if (phi_s5 == 0) {
@ -526,7 +526,7 @@ s32 npc_test_move_with_slipping(s32 ignoreFlags, f32* x, f32* y, f32* z, f32 len
*z += aZ;
}
return phi_s2;
return hitResult;
}
s32 npc_test_move_without_slipping(s32 ignoreFlags, f32* x, f32* y, f32* z, f32 length, f32 yaw, f32 radius) {
@ -566,7 +566,7 @@ s32 npc_test_move_without_slipping(s32 ignoreFlags, f32* x, f32* y, f32* z, f32
return ret;
}
s32 npc_test_move_taller_with_slipping(s32 ignoreFlags, f32* x, f32* y, f32* z, f32 length, f32 yaw, f32 height,
b32 npc_test_move_taller_with_slipping(s32 ignoreFlags, f32* x, f32* y, f32* z, f32 length, f32 yaw, f32 height,
f32 radius) {
f32 xTemp = *x;
f32 yTemp = *y + height - 1.0f;
@ -582,14 +582,14 @@ s32 npc_test_move_taller_with_slipping(s32 ignoreFlags, f32* x, f32* y, f32* z,
*x = xTemp;
*z = zTemp;
} else {
ret = 1;
ret = TRUE;
*x = xTemp;
*z = zTemp;
}
return ret;
}
s32 npc_test_move_simple_with_slipping(s32 ignoreFlags, f32* x, f32* y, f32* z, f32 length, f32 yaw, f32 height,
b32 npc_test_move_simple_with_slipping(s32 ignoreFlags, f32* x, f32* y, f32* z, f32 length, f32 yaw, f32 height,
f32 radius) {
f32 tempX = *x;
f32 tempY = *y + 10.01f;
@ -602,7 +602,7 @@ s32 npc_test_move_simple_with_slipping(s32 ignoreFlags, f32* x, f32* y, f32* z,
return hitID >= 0;
}
s32 npc_test_move_simple_without_slipping(s32 ignoreFlags, f32* x, f32* y, f32* z, f32 length, f32 yaw, f32 height,
b32 npc_test_move_simple_without_slipping(s32 ignoreFlags, f32* x, f32* y, f32* z, f32 length, f32 yaw, f32 height,
f32 radius) {
f32 tempX = *x;
f32 tempY = *y + 10.01f;

View File

@ -29,13 +29,13 @@ void pulse_stone_notification_update(void);
s32 should_cancel_pulse_stone(void) {
PlayerStatus* playerStatus = &gPlayerStatus;
PartnerActionStatus* partnerActionStatus = &gPartnerActionStatus;
PartnerStatus* partnerStatus = &gPartnerStatus;
s8 actionState = playerStatus->actionState;
// could be written more clearly if these two condtions were inverted
if (actionState != ACTION_STATE_USE_TWEESTER) {
if (!(partnerActionStatus->partnerActionState == PARTNER_ACTION_USE
&& (partnerActionStatus->actingPartner == PARTNER_BOW || partnerActionStatus->actingPartner == PARTNER_PARAKARRY))
if (!(partnerStatus->partnerActionState == PARTNER_ACTION_USE
&& (partnerStatus->actingPartner == PARTNER_BOW || partnerStatus->actingPartner == PARTNER_PARAKARRY))
) {
return FALSE;
}

View File

@ -25,7 +25,7 @@ void state_step_startup(void) {
gameStatus->entryID = 0;
gGameStatusPtr->unk_76 = 0;
gGameStatusPtr->disableScripts = 0;
gGameStatusPtr->keepUsingPartnerOnMapChange = 0;
gGameStatusPtr->keepUsingPartnerOnMapChange = FALSE;
gGameStatusPtr->creditsViewportMode = -1;
gGameStatusPtr->demoFlags = 0;
gGameStatusPtr->unk_A9 = -1;

View File

@ -48,9 +48,7 @@ void action_update_idle(void) {
playerStatus->currentStateTime++;
if (playerStatus->flags & PS_FLAG_ACTION_STATE_CHANGED) {
playerStatus->flags &= ~(PS_FLAG_ACTION_STATE_CHANGED
| PS_FLAG_ARMS_RAISED | PS_FLAG_AIRBORNE);
playerStatus->flags &= ~(PS_FLAG_ACTION_STATE_CHANGED | PS_FLAG_ARMS_RAISED | PS_FLAG_AIRBORNE);
wasMoving = TRUE;
playerStatus->actionSubstate = SUBSTATE_IDLE_DEFAULT;
playerStatus->currentStateTime = 0;
@ -66,7 +64,7 @@ void action_update_idle(void) {
} else if (playerStatus->prevActionState == ACTION_STATE_IDLE) {
anim = ANIM_MarioW1_TakeItem;
} else {
anim = ANIM_MarioW1_PlaceRecord;
anim = ANIM_MarioW1_CarryIdle;
}
suggest_player_anim_allow_backward(anim);
}

View File

@ -1,18 +1,16 @@
#include "common.h"
#include "world/actions.h"
#include "world/partner/goombario.h"
#include "world/partner/sushie.h"
#include "world/partner/lakilester.h"
BSS f32 D_802B6770_E27C80;
s32 action_update_ride(void) {
PartnerActionStatus* partnerActionStatus = &gPartnerActionStatus;
void action_update_ride(void) {
PartnerStatus* partnerStatus = &gPartnerStatus;
PlayerStatus* playerStatus = &gPlayerStatus;
s32 oldFlags = playerStatus->flags;
if (playerStatus->flags & PS_FLAG_ACTION_STATE_CHANGED) {
playerStatus->flags &= ~(
PS_FLAG_ACTION_STATE_CHANGED | PS_FLAG_ARMS_RAISED | PS_FLAG_AIRBORNE
);
playerStatus->flags &= ~(PS_FLAG_ACTION_STATE_CHANGED | PS_FLAG_ARMS_RAISED | PS_FLAG_AIRBORNE);
playerStatus->actionSubstate = 0;
playerStatus->currentStateTime = 0;
playerStatus->timeInAir = 0;
@ -22,17 +20,12 @@ s32 action_update_ride(void) {
}
if (playerStatus->animFlags & PA_FLAG_RIDING_PARTNER) {
if (partnerActionStatus->actingPartner == PARTNER_LAKILESTER) {
return world_goombario_get_trigger_tattle(oldFlags);
}
if (partnerActionStatus->actingPartner == PARTNER_SUSHIE) {
return world_goombario_get_trigger_tattle(oldFlags);
if (partnerStatus->actingPartner == PARTNER_LAKILESTER) {
world_lakilester_sync_player_position();
} else if (partnerStatus->actingPartner == PARTNER_SUSHIE) {
world_sushie_sync_player_position();
}
}
#ifdef AVOID_UB
return 0;
#endif
}
void action_update_state_23(void) {
@ -54,8 +47,7 @@ void action_update_state_23(void) {
f32 playerOffsetTempVar;
if (playerStatus->flags & PS_FLAG_ACTION_STATE_CHANGED) {
playerStatus->flags &= ~(PS_FLAG_ACTION_STATE_CHANGED
| PS_FLAG_ARMS_RAISED | PS_FLAG_AIRBORNE);
playerStatus->flags &= ~(PS_FLAG_ACTION_STATE_CHANGED | PS_FLAG_ARMS_RAISED | PS_FLAG_AIRBORNE);
playerStatus->actionSubstate = 0;
playerStatus->currentStateTime = 0;
playerStatus->timeInAir = 0;

View File

@ -205,7 +205,7 @@ void action_update_parasol(void) {
playerStatus->actionSubstate++; // SUBSTATE_DISGUISE_DONE
playerStatus->spriteFacingAngle = 180;
disguiseNpc = get_npc_by_index(PeachDisguiseNpcIndex);
disguiseNpc->isFacingAway = 1;
disguiseNpc->isFacingAway = TRUE;
disguiseNpc->yaw = clamp_angle((cam->currentYaw - playerStatus->spriteFacingAngle) - 90);
disguiseNpc->yawCamOffset = disguiseNpc->yaw;
}
@ -217,7 +217,7 @@ void action_update_parasol(void) {
playerStatus->spriteFacingAngle = 0;
playerStatus->actionSubstate++; // SUBSTATE_DISGUISE_DONE
disguiseNpc = get_npc_by_index(PeachDisguiseNpcIndex);
disguiseNpc->isFacingAway = 0;
disguiseNpc->isFacingAway = FALSE;
disguiseNpc->yaw = clamp_angle((cam->currentYaw - playerStatus->spriteFacingAngle) - 90);
disguiseNpc->yawCamOffset = disguiseNpc->yaw;
}

View File

@ -40,7 +40,7 @@ void action_update_step_up(void) {
if (!(playerStatus->animFlags & PA_FLAG_USING_WATT)) {
anim = ANIM_Mario1_Walk;
} else {
anim = ANIM_MarioW1_Carry;
anim = ANIM_MarioW1_CarryWalk;
}
suggest_player_anim_allow_backward(anim);
} else {

View File

@ -58,7 +58,7 @@ void action_update_walk(void) {
anim = ANIM_Mario1_Walk;
}
else {
anim = ANIM_MarioW1_Carry;
anim = ANIM_MarioW1_CarryWalk;
}
suggest_player_anim_allow_backward(anim);
}

View File

@ -150,7 +150,7 @@ void N(CharAnim_FadeIn_1)(CreditsLine* line, CreditsChar* chr) {
f32 posY = chr->posY;
f32 alpha;
alpha = update_lerp(0, 0.0f, 255.0f, chr->fadeInTime, line->appearTime);
alpha = update_lerp(EASING_LINEAR, 0.0f, 255.0f, chr->fadeInTime, line->appearTime);
if (alpha > 255.0f) {
alpha = 255.0;
}

View File

@ -31,7 +31,7 @@ API_CALLABLE(N(PlayLakiluluFlightSounds)) {
sfx_get_spatialized_sound_params(npc->pos.x, npc->pos.y, npc->pos.z,
&volume, &pan, SOUND_PARAM_MORE_QUIET | SOUND_SPACE_FULL);
sfx_play_sound_with_params(SOUND_295, volume, pan,
update_lerp(0, 500.0f, 0.0f, script->functionTemp[0], script->functionTemp[1]));
update_lerp(EASING_LINEAR, 500.0f, 0.0f, script->functionTemp[0], script->functionTemp[1]));
}
script->functionTemp[0]++;
@ -56,7 +56,7 @@ API_CALLABLE(N(PlayLakilesterFlightSounds)) {
sfx_get_spatialized_sound_params(npc->pos.x, npc->pos.y, npc->pos.z,
&volume, &pan, SOUND_PARAM_MORE_QUIET | SOUND_SPACE_FULL);
sfx_play_sound_with_params(SOUND_295, volume, pan,
update_lerp(0, 500.0f, 0.0f, script->functionTemp[0], 80));
update_lerp(EASING_LINEAR, 500.0f, 0.0f, script->functionTemp[0], 80));
}
script->functionTemp[0]++;

View File

@ -283,7 +283,7 @@ API_CALLABLE(N(ChangeStateToTitleScreen)) {
gGameStatusPtr->isBattle = FALSE;
gGameStatusPtr->unk_76 = 0;
gGameStatusPtr->disableScripts = 0;
gGameStatusPtr->keepUsingPartnerOnMapChange = 0;
gGameStatusPtr->keepUsingPartnerOnMapChange = FALSE;
gOverrideFlags &= ~GLOBAL_OVERRIDES_8;
general_heap_create();
clear_render_tasks();

View File

@ -1,7 +1,7 @@
#include "hos_00.h"
void N(setup_gfx_background_shade)(void) {
s32 alpha = update_lerp(0, 0.0f, 216.0f, gPlayerStatus.position.x - 200.0f, 500);
s32 alpha = update_lerp(EASING_LINEAR, 0.0f, 216.0f, gPlayerStatus.position.x - 200.0f, 500);
if (alpha < 0) {
alpha = 0;

View File

@ -698,7 +698,7 @@ API_CALLABLE(N(CamPushIn_BowserInhale)) {
N(interp_value_with_easing)(INTRO_MATH_EASING_LINEAR, 121.6f, 90.0f, N(CamMoveInhaleTime), 40.0f, &N(BoomLengthInhale));
camera->panActive = TRUE;
camera->controlSettings.boomLength = N(BoomLengthInhale);
if ((N(CamMoveInhaleTime) == ((N(CamMoveInhaleTime) / 5) * 5)) && (N(BoomLengthInhale) != 90.0f)) {
if (N(CamMoveInhaleTime) % 5 == 0 && N(BoomLengthInhale) != 90.0f) {
f32 temp_f4 = resolve_npc(script, NPC_Bowser_Body)->pos.y - 150.0f;
fx_fire_breath(

View File

@ -23,11 +23,11 @@ EvtScript N(EVS_OnTouch_DrainSwitch) = {
EVT_END_IF
EVT_CALL(DisablePlayerInput, TRUE)
EVT_LABEL(5)
EVT_WAIT(1)
EVT_CALL(PartnerCanUseAbility, LVar0)
EVT_IF_EQ(LVar0, TRUE)
EVT_GOTO(5)
EVT_END_IF
EVT_WAIT(1)
EVT_CALL(PartnerCanUseAbility, LVar0)
EVT_IF_EQ(LVar0, TRUE)
EVT_GOTO(5)
EVT_END_IF
EVT_CALL(GetNpcPos, NPC_PARTNER, LVar0, LVar1, LVar2)
EVT_IF_LT(LVar1, -80)
EVT_THREAD

View File

@ -8,11 +8,11 @@ EvtScript N(EVS_OnTouch_DrainSwitch) = {
EVT_END_IF
EVT_CALL(DisablePlayerInput, TRUE)
EVT_LABEL(5)
EVT_WAIT(1)
EVT_CALL(PartnerCanUseAbility, LVar0)
EVT_IF_EQ(LVar0, TRUE)
EVT_GOTO(5)
EVT_END_IF
EVT_WAIT(1)
EVT_CALL(PartnerCanUseAbility, LVar0)
EVT_IF_EQ(LVar0, TRUE)
EVT_GOTO(5)
EVT_END_IF
EVT_CALL(GetNpcPos, NPC_PARTNER, LVar0, LVar1, LVar2)
EVT_IF_LT(LVar1, -470)
EVT_THREAD

View File

@ -105,7 +105,7 @@ API_CALLABLE(N(SetupDemoScene)) {
switch (N(DemoInitState)) {
case 0:
rideScriptSrc = partner_get_ride_script();
rideScriptSrc = partner_get_enter_map_script();
if (rideScriptSrc != NULL) {
Evt* newScript;
@ -114,8 +114,8 @@ API_CALLABLE(N(SetupDemoScene)) {
newScript->varTable[1] = playerStatus->position.x - 10.0f;
newScript->varTable[2] = playerStatus->position.y;
newScript->varTable[3] = playerStatus->position.z;
D_8024A290 = newScript;
newScript->varTable[12] = 1;
D_8024A290 = newScript;
}
break;
case 1:

View File

@ -18,7 +18,7 @@ EvtScript N(EVS_YoshiKid_CryForHelp) = {
#include "world/common/todo/GetFloorCollider.inc.c"
API_CALLABLE(N(IsPartnerWatt)) {
if (gPartnerActionStatus.actingPartner == PARTNER_WATT) {
if (gPartnerStatus.actingPartner == PARTNER_WATT) {
script->varTable[9] = TRUE;
} else {
script->varTable[9] = FALSE;

View File

@ -1,7 +1,7 @@
#include "kgr_02.h"
API_CALLABLE(N(AwaitPartnerWatt)) {
if (gPartnerActionStatus.actingPartner == PARTNER_WATT) {
if (gPartnerStatus.actingPartner == PARTNER_WATT) {
return ApiStatus_DONE2;
} else {
return ApiStatus_BLOCK;
@ -9,7 +9,7 @@ API_CALLABLE(N(AwaitPartnerWatt)) {
}
API_CALLABLE(N(AwaitPartnerNotWatt)) {
if (gPartnerActionStatus.actingPartner != PARTNER_WATT) {
if (gPartnerStatus.actingPartner != PARTNER_WATT) {
return ApiStatus_DONE2;
} else {
return ApiStatus_BLOCK;

View File

@ -152,8 +152,7 @@ API_CALLABLE(N(func_802405F0_8AC580)) {
npc->pos.y = 100.0f;
add_vec2D_polar(&npc->pos.x, &npc->pos.z, 70.0f / DT, npc->moveToPos.x + (script->functionTemp[2] * 51) + 153.0f);
npc->pos.y += (-npc->pos.z + -50.0f + 70.0f / DT) * 0.15f;
if ((script->VAR_1 + script->functionTemp[2]) ==
(((script->VAR_1 + script->functionTemp[2]) / 13) * 13)) {
if ((script->VAR_1 + script->functionTemp[2]) % 13 == 0) {
fx_sparkles(FX_SPARKLES_3, npc->pos.x, npc->pos.y + 10.0f, npc->pos.z, 10.0f);
}
if (script->VAR_1 > 256) {
@ -167,8 +166,7 @@ API_CALLABLE(N(func_802405F0_8AC580)) {
npc->pos.y = 100.0f - (script->VAR_2 * 0.3f);
add_vec2D_polar(&npc->pos.x, &npc->pos.z, 70.0f / DT, npc->moveToPos.x + (script->functionTemp[2] * 51) + 153.0f);
npc->pos.y += (-npc->pos.z + -50.0f + 70.0f / DT) * 0.15f;
if ((script->VAR_1 + script->functionTemp[2]) ==
(((script->VAR_1 + script->functionTemp[2]) / 13) * 13)) {
if ((script->VAR_1 + script->functionTemp[2]) % 13 == 0) {
fx_sparkles(FX_SPARKLES_3, npc->pos.x, npc->pos.y + 10.0f, npc->pos.z, 10.0f);
}
if (script->VAR_2++ > 180) {
@ -188,8 +186,7 @@ API_CALLABLE(N(func_802405F0_8AC580)) {
npc->pos.y = 45.999996f;
add_vec2D_polar(&npc->pos.x, &npc->pos.z, 70.0f / DT, npc->moveToPos.x + (script->functionTemp[2] * 51) + 153.0f);
npc->pos.y += (-npc->pos.z + -50.0f + 70.0f / DT) * 0.15f;
if ((script->VAR_1 + script->functionTemp[2]) ==
(((script->VAR_1 + script->functionTemp[2]) / 13) * 13)) {
if ((script->VAR_1 + script->functionTemp[2]) % 13 == 0) {
fx_sparkles(FX_SPARKLES_3, npc->pos.x, npc->pos.y + 10.0f, npc->pos.z, 10.0f);
}
if (npc->moveToPos.y < 0.0f) {

View File

@ -146,7 +146,7 @@ void N(appendGfx_records)(void* data) {
// fallthrough
case RECORDS_STATE_FADING_IN:
records->lerpTime++;
records->alpha = update_lerp(0, 32.0f, 255.0f, records->lerpTime, 3);
records->alpha = update_lerp(EASING_LINEAR, 32.0f, 255.0f, records->lerpTime, 3);
records->lastAlpha = records->alpha;
if (records->lerpTime >= 3) {
records->state = RECORDS_STATE_IDLE;
@ -170,7 +170,7 @@ void N(appendGfx_records)(void* data) {
// fallthrough
case RECORDS_STATE_FADING_OUT:
records->lerpTime++;
records->alpha = update_lerp(0, records->lastAlpha, 0.0f, records->lerpTime, 3);
records->alpha = update_lerp(EASING_LINEAR, records->lastAlpha, 0.0f, records->lerpTime, 3);
if (records->lerpTime >= 3) {
records->state = RECORDS_STATE_DONE;
}

View File

@ -29,7 +29,7 @@ API_CALLABLE(N(AddPlatformPushVelocity)) {
}
API_CALLABLE(N(IsPartnerLakilester)) {
if (gPartnerActionStatus.actingPartner == PARTNER_LAKILESTER) {
if (gPartnerStatus.actingPartner == PARTNER_LAKILESTER) {
script->varTable[9] = TRUE;
} else {
script->varTable[9] = FALSE;

View File

@ -29,7 +29,7 @@ API_CALLABLE(N(AddPlatformPushVelocity)) {
}
API_CALLABLE(N(IsPartnerLakilester)) {
if (gPartnerActionStatus.actingPartner == PARTNER_LAKILESTER) {
if (gPartnerStatus.actingPartner == PARTNER_LAKILESTER) {
script->varTable[9] = TRUE;
} else {
script->varTable[9] = FALSE;

View File

@ -4,8 +4,8 @@
#include "world/common/atomic/TexturePan.inc.c"
API_CALLABLE(N(GetActingPartner)) {
if (gPartnerActionStatus.partnerActionState != 0) {
script->varTable[9] = gPartnerActionStatus.actingPartner;
if (gPartnerStatus.partnerActionState != 0) {
script->varTable[9] = gPartnerStatus.actingPartner;
} else {
script->varTable[9] = -1;
}

View File

@ -35,7 +35,7 @@ API_CALLABLE(N(AddPlatformPushVelocity)) {
}
API_CALLABLE(N(IsPartnerLakilester)) {
if (gPartnerActionStatus.actingPartner == PARTNER_LAKILESTER) {
if (gPartnerStatus.actingPartner == PARTNER_LAKILESTER) {
script->varTable[9] = TRUE;
} else {
script->varTable[9] = FALSE;

View File

@ -7,8 +7,8 @@ API_CALLABLE(N(SpinyTrompHit)) {
}
API_CALLABLE(N(SpinyTromp_GetActingPartner)) {
if (gPartnerActionStatus.partnerActionState != PARTNER_ACTION_NONE) {
script->varTable[0] = gPartnerActionStatus.actingPartner;
if (gPartnerStatus.partnerActionState != PARTNER_ACTION_NONE) {
script->varTable[0] = gPartnerStatus.actingPartner;
} else {
script->varTable[0] = -1;
}

View File

@ -28,7 +28,7 @@ API_CALLABLE(N(GetActingPartner)) {
Bytecode* args = script->ptrReadPos;
s32 outVar = *args++;
evt_set_variable(script, outVar, gPartnerActionStatus.actingPartner);
evt_set_variable(script, outVar, gPartnerStatus.actingPartner);
return ApiStatus_DONE2;
}

View File

@ -32,7 +32,7 @@ API_CALLABLE(N(func_80243EE0_C75360)) {
return ApiStatus_BLOCK;
}
if (gPartnerActionStatus.partnerActionState != PARTNER_ACTION_NONE) {
if (gPartnerStatus.partnerActionState != PARTNER_ACTION_NONE) {
if (playerData->currentPartner == PARTNER_WATT) {
if (!script->functionTemp[1]) {
script->functionTemp[1] = TRUE;

View File

@ -31,7 +31,7 @@ API_CALLABLE(N(GetCurrentFloor)) {
}
API_CALLABLE(N(IsPartnerLakilester)) {
if (gPartnerActionStatus.actingPartner == PARTNER_LAKILESTER) {
if (gPartnerStatus.actingPartner == PARTNER_LAKILESTER) {
script->varTable[9] = TRUE;
} else {
script->varTable[9] = FALSE;

View File

@ -1,7 +1,7 @@
#include "world/common/todo/GetFloorCollider.inc.c"
API_CALLABLE(N(IsPartnerBow)) {
if (gPartnerActionStatus.actingPartner == PARTNER_BOW) {
if (gPartnerStatus.actingPartner == PARTNER_BOW) {
script->varTable[0] = TRUE;
} else {
script->varTable[0] = FALSE;

View File

@ -95,9 +95,9 @@ API_CALLABLE(N(InterpSpriteShadingColor)) {
}
script->varTable[6]++;
shadingProfile->ambientColor.r = update_lerp(0, script->varTable[3], script->varTable[0], script->varTable[6], 20);
shadingProfile->ambientColor.g = update_lerp(0, script->varTable[4], script->varTable[1], script->varTable[6], 20);
shadingProfile->ambientColor.b = update_lerp(0, script->varTable[5], script->varTable[2], script->varTable[6], 20);
shadingProfile->ambientColor.r = update_lerp(EASING_LINEAR, script->varTable[3], script->varTable[0], script->varTable[6], 20);
shadingProfile->ambientColor.g = update_lerp(EASING_LINEAR, script->varTable[4], script->varTable[1], script->varTable[6], 20);
shadingProfile->ambientColor.b = update_lerp(EASING_LINEAR, script->varTable[5], script->varTable[2], script->varTable[6], 20);
if (script->varTable[6] == 20) {
if (script->varTable[0] == 255) {
@ -118,7 +118,7 @@ API_CALLABLE(N(MoveNpcAlongArc)) {
}
if (script->varTable[6] > 0) {
angle = update_lerp(0, script->varTable[3], script->varTable[4], (f32) script->varTable[6], (f32) script->varTable[5]);
angle = update_lerp(EASING_LINEAR, script->varTable[3], script->varTable[4], (f32) script->varTable[6], (f32) script->varTable[5]);
sin_cos_deg(angle, &sinAngle, &cosAngle);
npc->pos.x = script->varTable[1] + (script->varTable[7] * sinAngle);
npc->pos.z = script->varTable[2] + (script->varTable[7] * cosAngle);

View File

@ -886,7 +886,7 @@ EvtScript N(EVS_Inspect_Phonograph) = {
EVT_CALL(RemoveKeyItemAt, LVar1)
EVT_SET(GB_StoryProgress, STORY_CH3_PLAYED_THE_RECORD)
EVT_CALL(EnableModel, MODEL_reco, TRUE)
EVT_CALL(SetPlayerAnimation, ANIM_MarioW1_PlaceRecord)
EVT_CALL(SetPlayerAnimation, ANIM_MarioW1_CarryIdle)
EVT_WAIT(15)
EVT_CALL(SetPlayerAnimation, ANIM_Mario1_Idle)
EVT_WAIT(15)

View File

@ -23,7 +23,7 @@ s32 N(ShouldPauseConveyor)(void) {
return TRUE;
}
if (gPartnerActionStatus.partnerActionState != PARTNER_ACTION_NONE &&
if (gPartnerStatus.partnerActionState != PARTNER_ACTION_NONE &&
(playerData->currentPartner == PARTNER_GOOMBARIO || playerData->currentPartner == PARTNER_SUSHIE))
{
return TRUE;
@ -42,7 +42,7 @@ API_CALLABLE(N(WaitWhileConveyorPaused)) {
API_CALLABLE(N(AddConveyorPush)) {
PlayerStatus* playerStatus = &gPlayerStatus;
Npc* partner = get_npc_unsafe(NPC_PARTNER);
PartnerActionStatus* partnerActionStatus = &gPartnerActionStatus;
PartnerStatus* partnerStatus = &gPartnerStatus;
f32 x, y, z;
f32 outLength;
f32 hitRx, hitRz;
@ -57,8 +57,8 @@ API_CALLABLE(N(AddConveyorPush)) {
}
one = 1;
if (partnerActionStatus->actingPartner == PARTNER_BOW) {
if (partnerActionStatus->partnerActionState != PARTNER_ACTION_NONE && playerStatus->alpha1 == 128) {
if (partnerStatus->actingPartner == PARTNER_BOW) {
if (partnerStatus->partnerActionState != PARTNER_ACTION_NONE && playerStatus->alpha1 == 128) {
x = playerStatus->position.x;
y = playerStatus->position.y;
z = playerStatus->position.z;
@ -79,8 +79,8 @@ API_CALLABLE(N(AddConveyorPush)) {
}
}
one = 1;
if (partnerActionStatus->actingPartner != PARTNER_LAKILESTER ||
partnerActionStatus->partnerActionState == PARTNER_ACTION_NONE)
if (partnerStatus->actingPartner != PARTNER_LAKILESTER ||
partnerStatus->partnerActionState == PARTNER_ACTION_NONE)
{
for (i = 0; i < ARRAY_COUNT(N(ConveyorColliders)); i++) {
if (gCollisionStatus.currentFloor == N(ConveyorColliders)[i] ||
@ -91,8 +91,8 @@ API_CALLABLE(N(AddConveyorPush)) {
}
if (partner->currentFloor == N(ConveyorColliders)[i] &&
((partnerActionStatus->actingPartner != PARTNER_KOOPER) ||
(partnerActionStatus->partnerActionState == PARTNER_ACTION_NONE)))
((partnerStatus->actingPartner != PARTNER_KOOPER) ||
(partnerStatus->partnerActionState == PARTNER_ACTION_NONE)))
{
partner->pos.x += N(ConveyorPushVels)[i][0];
partner->pos.z += N(ConveyorPushVels)[i][one]; // TODO needed to match

View File

@ -60,8 +60,8 @@ API_CALLABLE(N(SimpleMoveNPC)) {
}
API_CALLABLE(N(GetActingPartner)) {
if (gPartnerActionStatus.partnerActionState != PARTNER_ACTION_NONE) {
script->varTable[9] = gPartnerActionStatus.actingPartner;
if (gPartnerStatus.partnerActionState != PARTNER_ACTION_NONE) {
script->varTable[9] = gPartnerStatus.actingPartner;
} else {
script->varTable[9] = -1;
}
@ -69,7 +69,7 @@ API_CALLABLE(N(GetActingPartner)) {
}
API_CALLABLE(N(IsPartnerWatt)) {
if (gPartnerActionStatus.actingPartner == PARTNER_WATT) {
if (gPartnerStatus.actingPartner == PARTNER_WATT) {
script->varTable[1] = TRUE;
} else {
script->varTable[1] = FALSE;

View File

@ -11,7 +11,7 @@ API_CALLABLE(N(DarkRoomUpdate)) {
set_screen_overlay_center_worldpos(1, 1, playerStatus->position.x, playerStatus->position.y + 8.0f, playerStatus->position.z);
if (gPartnerActionStatus.partnerActionState != PARTNER_ACTION_NONE) {
if (gPartnerStatus.partnerActionState != PARTNER_ACTION_NONE) {
if (playerData->currentPartner == PARTNER_WATT) {
if (!script->functionTemp[1]) {
script->functionTemp[1] = TRUE;

View File

@ -47,7 +47,7 @@ s32 N(CleftAI_CanSeePlayer)(Evt* script, MobileAISettings* aiSettings, EnemyDete
if (fabsf(npc->pos.y - gPlayerStatusPtr->position.y) >= 40.0f) {
seesPlayer = FALSE;
}
if (gPartnerActionStatus.actingPartner == PARTNER_BOW) {
if (gPartnerStatus.actingPartner == PARTNER_BOW) {
seesPlayer = FALSE;
}
return seesPlayer;

View File

@ -53,14 +53,14 @@ void N(ClubbaNappingAI_Sleep)(Evt* script, MobileAISettings* aiSettings, EnemyDe
}
if (playerData->currentPartner == PARTNER_KOOPER) {
if (gPartnerActionStatus.partnerActionState == playerData->currentPartner) {
if (gPartnerStatus.partnerActionState == playerData->currentPartner) {
shouldWakeUp = TRUE;
}
}
}
if (((playerData->currentPartner == PARTNER_GOOMBARIO) && (gPartnerActionStatus.partnerActionState != PARTNER_ACTION_NONE)) ||
((playerData->currentPartner == PARTNER_BOMBETTE) && (gPartnerActionStatus.partnerActionState == PARTNER_ACTION_BOMBETTE_2))) {
if (((playerData->currentPartner == PARTNER_GOOMBARIO) && (gPartnerStatus.partnerActionState != PARTNER_ACTION_NONE)) ||
((playerData->currentPartner == PARTNER_BOMBETTE) && (gPartnerStatus.partnerActionState == PARTNER_ACTION_BOMBETTE_2))) {
posX = npc->pos.x;
posZ = npc->pos.z;
add_vec2D_polar(&posX, &posZ, 0.0f, npc->yaw);

View File

@ -15,7 +15,7 @@ enum {
API_CALLABLE(N(FireBarAI_Main)) {
PlayerStatus* playerStatus = &gPlayerStatus;
PartnerActionStatus* partnerActionStatus = &gPartnerActionStatus;
PartnerStatus* partnerStatus = &gPartnerStatus;
Bytecode* args = script->ptrReadPos;
FireBarAISettings* settings;
FireBarData* data;
@ -69,10 +69,10 @@ API_CALLABLE(N(FireBarAI_Main)) {
}
if (!(data->flags & 2) && !(playerStatus->flags & PS_FLAG_HAZARD_INVINCIBILITY)) {
dY = playerStatus->position.y - npc->pos.y;
if (partnerActionStatus->partnerActionState == PARTNER_ACTION_USE) {
if (partnerActionStatus->actingPartner == PARTNER_LAKILESTER) {
if (partnerStatus->partnerActionState == PARTNER_ACTION_USE) {
if (partnerStatus->actingPartner == PARTNER_LAKILESTER) {
dY = partnerNpc->pos.y - npc->pos.y;
} else if (partnerActionStatus->actingPartner == PARTNER_PARAKARRY) {
} else if (partnerStatus->actingPartner == PARTNER_PARAKARRY) {
dY = (playerStatus->position.y - 10.0f) - npc->pos.y;
}
}

View File

@ -26,7 +26,7 @@ s32 N(MagikoopaAI_CanShootSpell)(Evt* script, f32 arg1, f32 arg2, EnemyDetectVol
return -1;
}
if (gPartnerActionStatus.actingPartner == PARTNER_BOW || gPartnerActionStatus.actingPartner == PARTNER_SUSHIE) {
if (gPartnerStatus.actingPartner == PARTNER_BOW || gPartnerStatus.actingPartner == PARTNER_SUSHIE) {
return -1;
}
@ -71,7 +71,7 @@ API_CALLABLE(N(MagikoopaAI_SpellMain)) {
npc1->pos.z = NPC_DISPOSE_POS_Z;
enemy->varTable[0] = 0;
script->functionTemp[0] = 1;
/* fallthrough */
// fallthrough
case 1:
if (enemy->varTable[0] == 1) {
s32 duration;
@ -118,7 +118,7 @@ API_CALLABLE(N(MagikoopaAI_SpellMain)) {
npc1->pos.y += npc1->jumpVelocity;
break;
}
/* fallthrough */
// fallthrough
case 3:
npc1->jumpVelocity = 0.0f;
npc1->moveSpeed = 0.0f;

View File

@ -86,11 +86,11 @@ s32 N(MeleeHitbox_CanSeePlayer)(Evt* script) {
ret = FALSE;
}
if (gPartnerActionStatus.actingPartner == PARTNER_BOW) {
if (gPartnerStatus.actingPartner == PARTNER_BOW) {
ret = FALSE;
}
if (gPartnerActionStatus.actingPartner == PARTNER_SUSHIE) {
if (gPartnerStatus.actingPartner == PARTNER_SUSHIE) {
ret = FALSE;
}

View File

@ -57,7 +57,7 @@ static s32 N(MontyMoleAI_CanAttack)(Evt* script, EnemyDetectVolume* territory, f
retVal = FALSE;
}
// check for bow hiding
if (gPartnerActionStatus.actingPartner == PARTNER_BOW) {
if (gPartnerStatus.actingPartner == PARTNER_BOW) {
retVal = FALSE;
}
return retVal;

View File

@ -125,7 +125,7 @@ void N(PiranhaPlantAI_10)(Evt* script, MobileAISettings* aiSettings, EnemyDetect
sp20 = gPlayerStatusPtr->position.x;
sp24 = gPlayerStatusPtr->position.y + 18.0;
sp28 = gPlayerStatusPtr->position.z;
if (npc_test_move_simple_with_slipping(npc->collisionChannel, &sp20, &sp24, &sp28, moveSpeed, yaw2, npc->collisionHeight, npc->collisionRadius) != 0) {
if (npc_test_move_simple_with_slipping(npc->collisionChannel, &sp20, &sp24, &sp28, moveSpeed, yaw2, npc->collisionHeight, npc->collisionRadius)) {
sp20 = gPlayerStatusPtr->position.x;
sp24 = gPlayerStatusPtr->position.y + 45.0;
sp28 = gPlayerStatusPtr->position.z;
@ -154,7 +154,7 @@ void N(PiranhaPlantAI_10)(Evt* script, MobileAISettings* aiSettings, EnemyDetect
sp20 = gPlayerStatusPtr->position.x;
sp24 = gPlayerStatusPtr->position.y + 18.0;
sp28 = gPlayerStatusPtr->position.z;
if (npc_test_move_simple_with_slipping(npc->collisionChannel, &sp20, &sp24, &sp28, moveSpeed, yaw2, npc->collisionHeight, npc->collisionRadius) != 0) {
if (npc_test_move_simple_with_slipping(npc->collisionChannel, &sp20, &sp24, &sp28, moveSpeed, yaw2, npc->collisionHeight, npc->collisionRadius)) {
posRadius = dist2D(gPlayerStatusPtr->position.x, gPlayerStatusPtr->position.z, sp20, sp28);
npc->pos.x = gPlayerStatusPtr->position.x;
npc->pos.z = gPlayerStatusPtr->position.z;

View File

@ -28,10 +28,10 @@ s32 N(ProjectileHitbox_GetUsableProjectileID)(Evt* script) {
if (fabsf(deltaAngle) > 75.0 || (2.0 * npc->collisionHeight <= fabsf(npc->pos.y - gPlayerStatusPtr->position.y))) {
return -1;
}
if (gPartnerActionStatus.actingPartner == PARTNER_BOW) {
if (gPartnerStatus.actingPartner == PARTNER_BOW) {
return -1;
}
if (gPartnerActionStatus.actingPartner == PARTNER_SUSHIE) {
if (gPartnerStatus.actingPartner == PARTNER_SUSHIE) {
return -1;
}

View File

@ -143,7 +143,7 @@ void N(SentinelAI_Descend)(Evt* script, MobileAISettings* aiSettings, EnemyDetec
} else {
npc->rotation.y = 0.0f;
npc->flags &= ~NPC_FLAG_200000;
if (gPartnerActionStatus.actingPartner != PARTNER_BOW) {
if (gPartnerStatus.actingPartner != PARTNER_BOW) {
disable_player_input();
partner_disable_input();
npc->duration = 0;
@ -208,7 +208,7 @@ void N(SentinelAI_GrabPlayer)(Evt* script, MobileAISettings* aiSettings, EnemyDe
npc->duration++;
if (npc->duration >= 3) {
if (gPartnerActionStatus.actingPartner != PARTNER_BOW) {
if (gPartnerStatus.actingPartner != PARTNER_BOW) {
npc->duration = 0;
script->AI_TEMP_STATE = AI_STATE_SENTINEL_CAUGHT_PLAYER;
} else {

View File

@ -85,7 +85,7 @@ API_CALLABLE(N(SwooperAI_Main)) {
x = npc->pos.x;
y = npc->pos.y;
z = npc->pos.z;
if (npc_test_move_simple_with_slipping(npc->collisionChannel, &x, &y, &z, npc->moveSpeed, npc->yaw, npc->collisionHeight, npc->collisionRadius) != 0) {
if (npc_test_move_simple_with_slipping(npc->collisionChannel, &x, &y, &z, npc->moveSpeed, npc->yaw, npc->collisionHeight, npc->collisionRadius)) {
npc->moveSpeed = 0.0f;
}
npc->yaw = atan2(npc->pos.x, npc->pos.z, playerStatus->position.x, playerStatus->position.z);

View File

@ -429,7 +429,7 @@ API_CALLABLE(N(SuperBlock_PartnerSparkles4)) {
API_CALLABLE(N(SuperBlock_WaitForPlayerToLand)) {
script->varTable[0] = FALSE;
if ((gPartnerActionStatus.partnerActionState != PARTNER_ACTION_NONE) && (gPartnerActionStatus.actingPartner == PARTNER_BOMBETTE)) {
if ((gPartnerStatus.partnerActionState != PARTNER_ACTION_NONE) && (gPartnerStatus.actingPartner == PARTNER_BOMBETTE)) {
script->varTable[0] = TRUE;
}
return ApiStatus_DONE2;

View File

@ -63,9 +63,9 @@ API_CALLABLE(N(StarSpiritEffectFunc3)) {
switch (ptr->unk_44) {
case 0:
ptr->unk_04 = update_lerp(5, ptr->unk_10, ptr->unk_1C, ptr->unk_46, ptr->unk_3C);
ptr->unk_00 = update_lerp(0, ptr->unk_0C, ptr->unk_18, ptr->unk_46, ptr->unk_3C);
ptr->unk_08 = update_lerp(0, ptr->unk_14, ptr->unk_20, ptr->unk_46, ptr->unk_3C);
ptr->unk_04 = update_lerp(EASING_CUBIC_OUT, ptr->unk_10, ptr->unk_1C, ptr->unk_46, ptr->unk_3C);
ptr->unk_00 = update_lerp(EASING_LINEAR, ptr->unk_0C, ptr->unk_18, ptr->unk_46, ptr->unk_3C);
ptr->unk_08 = update_lerp(EASING_LINEAR, ptr->unk_14, ptr->unk_20, ptr->unk_46, ptr->unk_3C);
ptr->unk_50->data.starSpiritsEnergy->unk_08 = ptr->unk_00;
ptr->unk_50->data.starSpiritsEnergy->unk_0C = ptr->unk_04;
ptr->unk_50->data.starSpiritsEnergy->unk_10 = ptr->unk_08;
@ -99,7 +99,7 @@ API_CALLABLE(N(StarSpiritEffectFunc3)) {
}
break;
case 3:
ptr->unk_30 = update_lerp(0, 36.0f, 19.0f, ptr->unk_46, 120);
ptr->unk_30 = update_lerp(EASING_LINEAR, 36.0f, 19.0f, ptr->unk_46, 120);
ptr->unk_46++;
if (ptr->unk_46 >= 120) {
ptr->unk_4C = 0;
@ -117,8 +117,8 @@ API_CALLABLE(N(StarSpiritEffectFunc3)) {
switch (ptr->unk_4A) {
case 1:
ptr->unk_2C = update_lerp(4, ptr->unk_34, 1440.0f, ptr->unk_4C, 120);
ptr->unk_04 = update_lerp(0xA, ptr->unk_1C, ptr->unk_24, ptr->unk_4C, 120);
ptr->unk_2C = update_lerp(EASING_QUADRATIC_OUT, ptr->unk_34, 1440.0f, ptr->unk_4C, 120);
ptr->unk_04 = update_lerp(EASING_COS_IN_OUT, ptr->unk_1C, ptr->unk_24, ptr->unk_4C, 120);
ptr->unk_4C++;
if (ptr->unk_4C >= 120) {
ptr->unk_4C = 270;

View File

@ -3,7 +3,7 @@
API_CALLABLE(N(WaitForPlayerToLand)) {
script->varTable[0] = 0;
if ((gPartnerActionStatus.partnerActionState != PARTNER_ACTION_NONE) && (gPartnerActionStatus.actingPartner == PARTNER_BOMBETTE)) {
if ((gPartnerStatus.partnerActionState != PARTNER_ACTION_NONE) && (gPartnerStatus.actingPartner == PARTNER_BOMBETTE)) {
script->varTable[0] = 1;
}
return ApiStatus_DONE2;

View File

@ -32,7 +32,7 @@ API_CALLABLE(N(PlayLakiluluFlightSounds)) {
sfx_get_spatialized_sound_params(npc->pos.x, npc->pos.y, npc->pos.z,
&volume, &pan, SOUND_PARAM_MORE_QUIET | SOUND_SPACE_FULL);
sfx_play_sound_with_params(SOUND_295, volume, pan,
update_lerp(0, 500.0f, 0.0f, script->functionTemp[0], script->functionTemp[1]));
update_lerp(EASING_LINEAR, 500.0f, 0.0f, script->functionTemp[0], script->functionTemp[1]));
}
script->functionTemp[0]++;
@ -57,7 +57,7 @@ API_CALLABLE(N(PlayLakilesterFlightSounds)) {
sfx_get_spatialized_sound_params(npc->pos.x, npc->pos.y, npc->pos.z,
&volume, &pan, SOUND_PARAM_MORE_QUIET | SOUND_SPACE_FULL);
sfx_play_sound_with_params(SOUND_295, volume, pan,
update_lerp(0, 500.0f, 0.0f, script->functionTemp[0], 80));
update_lerp(EASING_LINEAR, 500.0f, 0.0f, script->functionTemp[0], 80));
}
script->functionTemp[0]++;

View File

@ -31,7 +31,7 @@ API_CALLABLE(N(GetCurrentFloor)) {
}
API_CALLABLE(N(IsPartnerLakilester)) {
if (gPartnerActionStatus.actingPartner == PARTNER_LAKILESTER) {
if (gPartnerStatus.actingPartner == PARTNER_LAKILESTER) {
script->varTable[9] = TRUE;
} else {
script->varTable[9] = FALSE;

View File

@ -192,7 +192,7 @@ void N(try_cancel_tweester)(Npc* npc) {
}
s32 N(can_use_ability)(Npc* npc) {
if (gPartnerActionStatus.partnerActionState != PARTNER_ACTION_NONE) {
if (gPartnerStatus.partnerActionState != PARTNER_ACTION_NONE) {
N(TriggeredEarlyDetonation) = TRUE;
return FALSE;
}
@ -200,13 +200,13 @@ s32 N(can_use_ability)(Npc* npc) {
}
s32 N(can_player_pause)(Npc* npc) {
return gPartnerActionStatus.partnerActionState == PARTNER_ACTION_NONE;
return gPartnerStatus.partnerActionState == PARTNER_ACTION_NONE;
}
API_CALLABLE(N(UseAbility)) {
PlayerStatus* playerStatus = &gPlayerStatus;
CollisionStatus* collisionStatus = &gCollisionStatus;
PartnerActionStatus* partnerActionStatus = &gPartnerActionStatus;
PartnerStatus* partnerStatus = &gPartnerStatus;
Camera* camera = &gCameras[CAM_DEFAULT];
Npc* npc = script->owner2.npc;
u16 temp_ret;
@ -250,8 +250,8 @@ API_CALLABLE(N(UseAbility)) {
N(MaintainPosAfterBlast) = FALSE;
N(TriggeredEarlyDetonation) = FALSE;
npc->flags &= ~(NPC_FLAG_JUMPING | NPC_FLAG_GRAVITY | NPC_FLAG_IGNORE_WORLD_COLLISION | NPC_FLAG_8);
partnerActionStatus->partnerActionState = PARTNER_ACTION_USE;
partnerActionStatus->actingPartner = PARTNER_BOMBETTE;
partnerStatus->partnerActionState = PARTNER_ACTION_USE;
partnerStatus->actingPartner = PARTNER_BOMBETTE;
N(PlayerWasFacingLeft) = partner_force_player_flip_done();
enable_npc_blur(npc);
npc->duration = 4;
@ -430,7 +430,7 @@ API_CALLABLE(N(UseAbility)) {
collisionStatus->bombetteExplosionPos.z = npc->pos.z;
N(blast_affect_entities)(npc);
N(IsBlasting) = TRUE;
partnerActionStatus->partnerActionState = PARTNER_ACTION_BOMBETTE_2;
partnerStatus->partnerActionState = PARTNER_ACTION_BOMBETTE_2;
script->functionTemp[1] = 3;
script->USE_STATE++;
break;
@ -439,7 +439,7 @@ API_CALLABLE(N(UseAbility)) {
script->functionTemp[1]--;
break;
}
partnerActionStatus->partnerActionState = PARTNER_ACTION_BOMBETTE_3;
partnerStatus->partnerActionState = PARTNER_ACTION_BOMBETTE_3;
N(IsBlasting) = FALSE;
npc->jumpVelocity = ((playerStatus->position.y - npc->pos.y) / 20.0f) + 30.0;
npc->moveSpeed = 0.8f;
@ -513,8 +513,8 @@ API_CALLABLE(N(UseAbility)) {
N(LockingPlayerInput) = FALSE;
enable_player_input();
}
partnerActionStatus->partnerActionState = ACTION_STATE_IDLE;
partnerActionStatus->actingPartner = PARTNER_NONE;
partnerStatus->partnerActionState = ACTION_STATE_IDLE;
partnerStatus->actingPartner = PARTNER_NONE;
npc->jumpVelocity = 0.0f;
N(IsBlasting) = FALSE;
N(TriggeredEarlyDetonation) = FALSE;
@ -534,8 +534,8 @@ API_CALLABLE(N(UseAbility)) {
N(LockingPlayerInput) = FALSE;
enable_player_input();
}
partnerActionStatus->partnerActionState = PARTNER_ACTION_NONE;
partnerActionStatus->actingPartner = PARTNER_NONE;
partnerStatus->partnerActionState = PARTNER_ACTION_NONE;
partnerStatus->actingPartner = PARTNER_NONE;
npc->jumpVelocity = 0.0f;
npc->pos.y = playerStatus->position.y;
npc->rotation.x = 0.0f;
@ -643,9 +643,9 @@ s32 N(test_first_strike)(Npc* bombette, Npc* enemy) {
void N(pre_battle)(Npc* bombette) {
PlayerStatus* playerStatus = &gPlayerStatus;
PartnerActionStatus* bombetteActionStatus = &gPartnerActionStatus;
PartnerStatus* partnerStatus = &gPartnerStatus;
if (bombetteActionStatus->partnerActionState != PARTNER_ACTION_NONE) {
if (partnerStatus->partnerActionState != PARTNER_ACTION_NONE) {
if (N(LockingPlayerInput)) {
enable_player_input();
}
@ -658,8 +658,8 @@ void N(pre_battle)(Npc* bombette) {
set_action_state(ACTION_STATE_IDLE);
partner_clear_player_tracking(bombette);
bombetteActionStatus->partnerActionState = PARTNER_ACTION_NONE;
bombetteActionStatus->actingPartner = 0;
partnerStatus->partnerActionState = PARTNER_ACTION_NONE;
partnerStatus->actingPartner = 0;
bombette->pos.x = playerStatus->position.x;
bombette->pos.y = playerStatus->position.y;

View File

@ -53,7 +53,7 @@ API_CALLABLE(N(Update)) {
if (isInitialCall) {
partner_flying_enable(bow, 1);
mem_clear(N(TweesterPhysicsPtr), sizeof(*N(TweesterPhysicsPtr)));
mem_clear(N(TweesterPhysicsPtr), sizeof(TweesterPhysics));
TweesterTouchingPartner = NULL;
}
@ -164,7 +164,7 @@ s32 N(check_for_treadmill_overlaps)(void) {
API_CALLABLE(N(UseAbility)) {
PlayerStatus* playerStatus = &gPlayerStatus;
PartnerActionStatus* partnerActionStatus = &gPartnerActionStatus;
PartnerStatus* partnerStatus = &gPartnerStatus;
CollisionStatus* collisionStatus = &gCollisionStatus;
Npc* bow = script->owner2.npc;
f32 stickInputMag;
@ -198,7 +198,7 @@ API_CALLABLE(N(UseAbility)) {
switch (script->USE_STATE) {
case OUTTA_SIGHT_INIT:
if (playerStatus->inputDisabledCount) {
if (playerStatus->inputDisabledCount != 0) {
return ApiStatus_DONE2;
}
@ -249,8 +249,8 @@ API_CALLABLE(N(UseAbility)) {
N(IsHiding) = TRUE;
bow->flags &= ~(NPC_FLAG_JUMPING | NPC_FLAG_GRAVITY);
partnerActionStatus->partnerActionState = 1;
partnerActionStatus->actingPartner = 9;
partnerStatus->partnerActionState = 1;
partnerStatus->actingPartner = 9;
playerStatus->flags |= PS_FLAG_HAZARD_INVINCIBILITY;
partner_force_player_flip_done();
bow->moveToPos.x = playerStatus->position.x;
@ -259,8 +259,7 @@ API_CALLABLE(N(UseAbility)) {
bow->currentAnim = ANIM_WorldBow_Walk;
bow->yaw = playerStatus->targetYaw;
add_vec2D_polar(&bow->moveToPos.x, &bow->moveToPos.z, -2.0f, gCameras[gCurrentCameraID].currentYaw);
add_vec2D_polar(&bow->moveToPos.x, &bow->moveToPos.z,
playerStatus->colliderDiameter * 0.5f, bow->yaw);
add_vec2D_polar(&bow->moveToPos.x, &bow->moveToPos.z, playerStatus->colliderDiameter * 0.5f, bow->yaw);
bow->duration = 5;
bow->yaw = atan2(bow->pos.x, bow->pos.z, playerStatus->position.x, playerStatus->position.z);
set_action_state(ACTION_STATE_RIDE);
@ -289,7 +288,6 @@ API_CALLABLE(N(UseAbility)) {
}
break;
}
N(end_outta_sight_cleanup)(bow);
return ApiStatus_DONE2;
@ -311,7 +309,6 @@ API_CALLABLE(N(UseAbility)) {
bow->pos.z = playerStatus->position.z - N(OuttaSightPosZ);
break;
}
N(end_outta_sight_cleanup)(bow);
return ApiStatus_DONE2;
@ -325,10 +322,10 @@ API_CALLABLE(N(UseAbility)) {
bow->pos.y = playerStatus->position.y - N(OuttaSightPosY);
bow->pos.z = playerStatus->position.z - N(OuttaSightPosZ);
stickInputMag = dist2D(0.0f, 0.0f, partnerActionStatus->stickX, partnerActionStatus->stickY);
stickInputMag = dist2D(0.0f, 0.0f, partnerStatus->stickX, partnerStatus->stickY);
if ((collisionStatus->currentFloor <= NO_COLLIDER)
|| stickInputMag > 10.0f
|| partnerActionStatus->pressedButtons & (BUTTON_B | BUTTON_C_DOWN)
|| partnerStatus->pressedButtons & (BUTTON_B | BUTTON_C_DOWN)
|| playerStatus->flags & PS_FLAG_HIT_FIRE
) {
// prevent exiting from the ground while underneath a wall
@ -366,13 +363,13 @@ EvtScript EVS_WorldBow_UseAbility = {
void N(end_outta_sight_cleanup)(Npc* bow) {
PlayerStatus* playerStatus = &gPlayerStatus;
PartnerActionStatus* partnerActionStatus = &gPartnerActionStatus;
PartnerStatus* partnerStatus = &gPartnerStatus;
s32 actionState;
playerStatus->alpha1 = 255;
func_8003D624(bow, FOLD_TYPE_NONE, 0, 0, 0, 0, 0);
bow->renderMode = RENDER_MODE_SURFACE_XLU_LAYER1;
get_shadow_by_index(bow->shadowIndex)->alpha = playerStatus->alpha1 >> 1;
get_shadow_by_index(bow->shadowIndex)->alpha = playerStatus->alpha1 / 2;
if (N(LockingPlayerInput)) {
enable_player_input();
@ -388,8 +385,8 @@ void N(end_outta_sight_cleanup)(Npc* bow) {
}
set_action_state(actionState);
partnerActionStatus->partnerActionState = 0;
partnerActionStatus->actingPartner = 0;
partnerStatus->partnerActionState = 0;
partnerStatus->actingPartner = 0;
playerStatus->flags &= ~PS_FLAG_PAUSE_DISABLED;
partner_clear_player_tracking(bow);
N(IsHiding) = FALSE;
@ -420,14 +417,14 @@ EvtScript EVS_WorldBow_PutAway = {
};
void N(pre_battle)(Npc* bow) {
PartnerActionStatus* partnerActionStatus = &gPartnerActionStatus;
PartnerStatus* partnerStatus = &gPartnerStatus;
if (N(IsHiding)) {
enable_player_input();
set_action_state(ACTION_STATE_IDLE);
partner_clear_player_tracking(bow);
partnerActionStatus->partnerActionState = PARTNER_ACTION_NONE;
partnerActionStatus->actingPartner = PARTNER_NONE;
partnerStatus->partnerActionState = PARTNER_ACTION_NONE;
partnerStatus->actingPartner = PARTNER_NONE;
N(IsHiding) = FALSE;
bow->flags &= ~NPC_FLAG_INVISIBLE;
}

View File

@ -202,10 +202,10 @@ EvtScript EVS_WorldGoombario_Update = {
};
s32 N(can_pause)(Npc* goombario) {
PartnerActionStatus* goombarioActionStatus = &gPartnerActionStatus;
PartnerStatus* partnerStatus = &gPartnerStatus;
s32 new_var;
if (goombarioActionStatus->partnerActionState != PARTNER_ACTION_NONE) {
if (partnerStatus->partnerActionState != PARTNER_ACTION_NONE) {
return FALSE;
}
@ -283,7 +283,7 @@ API_CALLABLE(N(SelectTattleMsg)) {
playerStatus->flags &= ~PS_FLAG_HAS_CONVERSATION_NPC;
goombario->currentAnim = ANIM_WorldGoombario_Idle;
goombario->yaw = clamp_angle(gCameras[CAM_DEFAULT].currentYaw + playerStatus->spriteFacingAngle - 90.0f);
gPartnerActionStatus.partnerActionState = PARTNER_ACTION_USE;
gPartnerStatus.partnerActionState = PARTNER_ACTION_USE;
close_status_menu();
if (N(HadSpeechPrompt)) {
script->VAR_MSG = 0;
@ -434,7 +434,7 @@ API_CALLABLE(N(SelectTattleMsg)) {
}
API_CALLABLE(N(TattleEnd)) {
PartnerActionStatus* goombarioActionStatus = &gPartnerActionStatus;
PartnerStatus* partnerStatus = &gPartnerStatus;
set_time_freeze_mode(TIME_FREEZE_NORMAL);
@ -443,8 +443,8 @@ API_CALLABLE(N(TattleEnd)) {
enable_player_input();
}
goombarioActionStatus->partnerActionState = PARTNER_ACTION_NONE;
goombarioActionStatus->actingPartner = PARTNER_NONE;
partnerStatus->partnerActionState = PARTNER_ACTION_NONE;
partnerStatus->actingPartner = PARTNER_NONE;
return ApiStatus_DONE2;
}
@ -491,17 +491,17 @@ EvtScript EVS_WorldGoombario_PutAway = {
};
void N(pre_battle)(Npc* goombario) {
PartnerActionStatus* goombarioActionStatus = &gPartnerActionStatus;
PartnerStatus* partnerStatus = &gPartnerStatus;
if (goombarioActionStatus->partnerActionState != PARTNER_ACTION_NONE) {
if (partnerStatus->partnerActionState != PARTNER_ACTION_NONE) {
set_time_freeze_mode(TIME_FREEZE_NORMAL);
enable_player_input();
cancel_current_message();
partner_clear_player_tracking(goombario);
goombarioActionStatus->partnerActionState = PARTNER_ACTION_NONE;
goombarioActionStatus->actingPartner = PARTNER_NONE;
partnerStatus->partnerActionState = PARTNER_ACTION_NONE;
partnerStatus->actingPartner = PARTNER_NONE;
disable_npc_blur(goombario);
}
goombarioActionStatus->actingPartner = PARTNER_GOOMBARIO;
partnerStatus->actingPartner = PARTNER_GOOMBARIO;
}

View File

@ -7,7 +7,6 @@
void world_goombario_init(Npc* partner);
s32 world_goombario_can_pause(Npc* partner);
void world_goombario_pre_battle(Npc* partner);
s32 world_goombario_get_trigger_tattle(s32 arg0);
extern EvtScript EVS_WorldGoombario_TakeOut;
extern EvtScript EVS_WorldGoombario_Update;

View File

@ -202,7 +202,7 @@ API_CALLABLE(N(UseAbility)) {
EncounterStatus* currentEncounter = &gCurrentEncounter;
PlayerStatus* playerStatus = &gPlayerStatus;
Npc* kooper = script->owner2.npc;
PartnerActionStatus* partnerActionStatus = &gPartnerActionStatus;
PartnerStatus* partnerStatus = &gPartnerStatus;
CollisionStatus* collisionStatus = &gCollisionStatus;
f32 posX, posY, posZ, hitLength;
f32 testLength;
@ -243,9 +243,9 @@ API_CALLABLE(N(UseAbility)) {
} else {
return ApiStatus_DONE2;
}
} else if (partnerActionStatus->partnerActionState == PARTNER_ACTION_NONE) {
partnerActionStatus->partnerActionState = PARTNER_ACTION_KOOPER_GATHER;
partnerActionStatus->actingPartner = PARTNER_KOOPER;
} else if (partnerStatus->partnerActionState == PARTNER_ACTION_NONE) {
partnerStatus->partnerActionState = PARTNER_ACTION_KOOPER_GATHER;
partnerStatus->actingPartner = PARTNER_KOOPER;
script->USE_STATE = SHELL_TOSS_STATE_HOLD;
kooper->currentAnim = ANIM_WorldKooper_SpinShell;
N(ShellTossHoldTime) = 30;
@ -268,8 +268,8 @@ API_CALLABLE(N(UseAbility)) {
N(HasItem) = FALSE;
kooper->flags &= ~(NPC_FLAG_GRAVITY | NPC_FLAG_JUMPING | NPC_FLAG_8);
kooper->flags |= (NPC_FLAG_IGNORE_PLAYER_COLLISION | NPC_FLAG_IGNORE_WORLD_COLLISION);
partnerActionStatus->actingPartner = PARTNER_KOOPER;
partnerActionStatus->partnerActionState = PARTNER_ACTION_KOOPER_GATHER;
partnerStatus->actingPartner = PARTNER_KOOPER;
partnerStatus->partnerActionState = PARTNER_ACTION_KOOPER_GATHER;
N(PlayerWasFacingLeft) = partner_force_player_flip_done();
enable_npc_blur(kooper);
kooper->duration = 4;
@ -368,8 +368,8 @@ API_CALLABLE(N(UseAbility)) {
if (!(kooper->jumpVelocity > 0.0f) && (playerStatus->position.y < kooper->moveToPos.z)) {
N(D_802BEC5C) = 0;
kooper->flags &= ~NPC_FLAG_IGNORE_PLAYER_COLLISION;
partnerActionStatus->actingPartner = PARTNER_KOOPER;
partnerActionStatus->partnerActionState = PARTNER_ACTION_KOOPER_TOSS;
partnerStatus->actingPartner = PARTNER_KOOPER;
partnerStatus->partnerActionState = PARTNER_ACTION_KOOPER_TOSS;
kooper->rotation.z = 0.0f;
kooper->planarFlyDist = 0.0f;
kooper->moveSpeed = 8.0f;
@ -615,8 +615,8 @@ API_CALLABLE(N(UseAbility)) {
ShellTossHitboxState = SHELL_TOSS_HITBOX_DISABLED;
kooper->flags |= NPC_FLAG_IGNORE_PLAYER_COLLISION;
kooper->flags &= ~(NPC_FLAG_JUMPING | NPC_FLAG_IGNORE_WORLD_COLLISION);
partnerActionStatus->actingPartner = PARTNER_NONE;
partnerActionStatus->partnerActionState = PARTNER_ACTION_NONE;
partnerStatus->actingPartner = PARTNER_NONE;
partnerStatus->partnerActionState = PARTNER_ACTION_NONE;
kooper->jumpVelocity = 0.0f;
kooper->collisionHeight = 24;
kooper->currentAnim = ANIM_WorldKooper_Walk;
@ -721,11 +721,11 @@ s32 N(test_first_strike)(Npc* kooper, Npc* enemy) {
void N(pre_battle)(Npc* kooper) {
PlayerStatus* playerStatus = &gPlayerStatus;
PartnerActionStatus* kooperActionStatus = &gPartnerActionStatus;
PartnerStatus* partnerStatus = &gPartnerStatus;
N(TriggeredBattle) = FALSE;
if (kooperActionStatus->partnerActionState != PARTNER_ACTION_NONE) {
if (kooperActionStatus->partnerActionState == PARTNER_ACTION_KOOPER_TOSS) {
if (partnerStatus->partnerActionState != PARTNER_ACTION_NONE) {
if (partnerStatus->partnerActionState == PARTNER_ACTION_KOOPER_TOSS) {
N(TriggeredBattle) = TRUE;
}
@ -746,8 +746,8 @@ void N(pre_battle)(Npc* kooper) {
partner_clear_player_tracking(kooper);
disable_npc_blur(kooper);
kooperActionStatus->actingPartner = PARTNER_NONE;
kooperActionStatus->partnerActionState = PARTNER_ACTION_NONE;
partnerStatus->actingPartner = PARTNER_NONE;
partnerStatus->partnerActionState = PARTNER_ACTION_NONE;
}
}

File diff suppressed because it is too large Load Diff

View File

@ -8,10 +8,13 @@ void world_lakilester_init(Npc*);
void world_lakilester_pre_battle(Npc*);
void world_lakilester_post_battle(Npc*);
void world_lakilester_sync_player_position(void);
s32 world_lakilester_can_dismount(void);
extern EvtScript EVS_WorldLakilester_TakeOut;
extern EvtScript EVS_WorldLakilester_Update;
extern EvtScript EVS_WorldLakilester_UseAbility;
extern EvtScript EVS_WorldLakilester_PutAway;
extern EvtScript evs_worldlakilester_riding;
extern EvtScript EVS_WorldLakilester_EnterMap;
#endif

View File

@ -8,22 +8,22 @@ BSS b32 N(UsingAbility);
BSS b32 N(LockingPlayerInput);
BSS b32 N(PlayerCollisionDisabled); // minor bug: never gets properly reset to FALSE
BSS b32 N(PlayerWasFacingLeft);
BSS s32 N(UseAbilityState);
BSS s32 N(AbilityState);
BSS s32 N(AbilityStateTime);
BSS TweesterPhysics N(TweesterPhysicsData);
enum {
AIR_LIFT_NONE = 0, // only used for initial value
AIR_LIFT_NONE = 0, // only used for initial value
// next two states lock input for a few frames, during which the ability can be canceled
AIR_LIFT_INIT = 40,
AIR_LIFT_DELAY = 41,
AIR_LIFT_BEGIN = 30,
AIR_LIFT_GATHER = 31,
AIR_LIFT_PICKUP = 1, // pick up the player and lift them into the air
AIR_LIFT_CARRY = 2, // carry the player through the air
AIR_LIFT_HOLD = 6, // remain in one position for a short period of time
AIR_LIFT_JUMP = 20, // player jumped off while being carried
AIR_LIFT_DROP = 21, // dropping the player
AIR_LIFT_PICKUP = 1, // pick up the player and lift them into the air
AIR_LIFT_CARRY = 2, // carry the player through the air
AIR_LIFT_HOLD = 6, // remain in one position for a short period of time
AIR_LIFT_JUMP = 20, // player jumped off while being carried
AIR_LIFT_DROP = 21, // dropping the player
AIR_LIFT_CANCEL = 22,
};
@ -31,7 +31,7 @@ void N(init)(Npc* parakarry) {
parakarry->collisionHeight = 37;
parakarry->collisionRadius = 40;
N(UsingAbility) = FALSE;
N(UseAbilityState) = AIR_LIFT_NONE;
N(AbilityState) = AIR_LIFT_NONE;
N(LockingPlayerInput) = FALSE;
N(PlayerCollisionDisabled) = FALSE;
N(PlayerWasFacingLeft) = FALSE;
@ -176,7 +176,7 @@ s32 N(update_current_floor)(void) {
if (surfaceType == SURFACE_TYPE_SPIKES || surfaceType == SURFACE_TYPE_LAVA) {
gPlayerStatus.hazardType = HAZARD_TYPE_SPIKES;
gPlayerStatus.flags |= PS_FLAG_HIT_FIRE;
N(UseAbilityState) = AIR_LIFT_DROP;
N(AbilityState) = AIR_LIFT_DROP;
}
return hitResult;
@ -184,7 +184,7 @@ s32 N(update_current_floor)(void) {
API_CALLABLE(N(UseAbility)) {
PlayerStatus* playerStatus = &gPlayerStatus;
PartnerActionStatus* partnerActionStatus = &gPartnerActionStatus;
PartnerStatus* partnerStatus = &gPartnerStatus;
Npc* parakarry = script->owner2.npc;
s32 buttonTemp = BUTTON_A;
f32 x, y, z, yaw, length;
@ -204,34 +204,34 @@ API_CALLABLE(N(UseAbility)) {
return ApiStatus_DONE2;
}
if (!partnerActionStatus->partnerAction_unk_1) {
if (!partnerStatus->shouldResumeAbility) {
if (!func_800EA52C(PARTNER_PARAKARRY)) {
return ApiStatus_DONE2;
}
N(UseAbilityState) = AIR_LIFT_INIT;
N(AbilityState) = AIR_LIFT_INIT;
parakarry->flags &= ~NPC_FLAG_COLLDING_FORWARD_WITH_WORLD;
parakarry->flags |= NPC_FLAG_COLLDING_WITH_WORLD;
} else {
partnerActionStatus->partnerAction_unk_1 = FALSE;
partnerStatus->shouldResumeAbility = FALSE;
set_action_state(ACTION_STATE_RIDE);
parakarry->flags &= ~(NPC_FLAG_JUMPING | NPC_FLAG_GRAVITY);
N(UsingAbility) = TRUE;
gCameras[CAM_DEFAULT].moveFlags |= CAMERA_MOVE_IGNORE_PLAYER_Y;
parakarry->currentAnim = ANIM_WorldParakarry_CarryLight;
partnerActionStatus->actingPartner = PARTNER_PARAKARRY;
partnerActionStatus->partnerActionState = PARTNER_ACTION_PARAKARRY_HOVER;
partnerStatus->actingPartner = PARTNER_PARAKARRY;
partnerStatus->partnerActionState = PARTNER_ACTION_PARAKARRY_HOVER;
parakarry->flags &= ~NPC_FLAG_COLLDING_FORWARD_WITH_WORLD;
parakarry->flags |= NPC_FLAG_COLLDING_WITH_WORLD;
}
}
switch (N(UseAbilityState)) {
switch (N(AbilityState)) {
case AIR_LIFT_INIT:
if (playerStatus->inputDisabledCount != 0) {
return ApiStatus_DONE2;
}
N(AbilityStateTime) = 3;
N(UseAbilityState) = AIR_LIFT_DELAY;
N(AbilityState) = AIR_LIFT_DELAY;
script->functionTemp[2] = playerStatus->inputDisabledCount;
// fallthrough
case AIR_LIFT_DELAY:
@ -239,14 +239,14 @@ API_CALLABLE(N(UseAbility)) {
if (script->functionTemp[2] < playerStatus->inputDisabledCount || !func_800EA52C(PARTNER_PARAKARRY)) {
return ApiStatus_DONE2;
}
N(UseAbilityState) = AIR_LIFT_BEGIN;
N(AbilityState) = AIR_LIFT_BEGIN;
} else {
N(AbilityStateTime)--;
}
break;
}
switch (N(UseAbilityState)) {
switch (N(AbilityState)) {
case AIR_LIFT_BEGIN:
set_action_state(ACTION_STATE_RIDE);
disable_player_input();
@ -258,13 +258,13 @@ API_CALLABLE(N(UseAbility)) {
gCameras[CAM_DEFAULT].moveFlags |= CAMERA_MOVE_IGNORE_PLAYER_Y;
parakarry->flags &= ~(NPC_FLAG_JUMPING | NPC_FLAG_GRAVITY);
parakarry->flags |= NPC_FLAG_IGNORE_WORLD_COLLISION | NPC_FLAG_8;
partnerActionStatus->actingPartner = PARTNER_PARAKARRY;
partnerActionStatus->partnerActionState = PARTNER_ACTION_PARAKARRY_HOVER;
partnerStatus->actingPartner = PARTNER_PARAKARRY;
partnerStatus->partnerActionState = PARTNER_ACTION_PARAKARRY_HOVER;
N(PlayerWasFacingLeft) = partner_force_player_flip_done();
enable_npc_blur(parakarry);
parakarry->yaw = atan2(parakarry->pos.x, parakarry->pos.z, playerStatus->position.x, playerStatus->position.z);
parakarry->duration = 4;
N(UseAbilityState)++; // AIR_LIFT_GATHER
N(AbilityState)++; // AIR_LIFT_GATHER
break;
case AIR_LIFT_GATHER:
if (playerStatus->actionState == ACTION_STATE_HIT_FIRE
@ -274,7 +274,7 @@ API_CALLABLE(N(UseAbility)) {
|| playerStatus->actionState == ACTION_STATE_HOP
) {
disable_npc_blur(parakarry);
N(UseAbilityState) = AIR_LIFT_DROP;
N(AbilityState) = AIR_LIFT_DROP;
} else {
suggest_player_anim_allow_backward(ANIM_Mario1_Idle);
parakarry->moveToPos.x = playerStatus->position.x;
@ -295,7 +295,7 @@ API_CALLABLE(N(UseAbility)) {
if (parakarry->duration != 0) {
if (script->functionTemp[2] < playerStatus->inputDisabledCount) {
disable_npc_blur(parakarry);
N(UseAbilityState) = AIR_LIFT_CANCEL;
N(AbilityState) = AIR_LIFT_CANCEL;
}
} else {
disable_npc_blur(parakarry);
@ -309,7 +309,7 @@ API_CALLABLE(N(UseAbility)) {
gCollisionStatus.currentFloor = NO_COLLIDER;
parakarry->currentFloor = NO_COLLIDER;
N(AbilityStateTime) = 20;
N(UseAbilityState) = AIR_LIFT_PICKUP;
N(AbilityState) = AIR_LIFT_PICKUP;
}
}
break;
@ -318,12 +318,12 @@ API_CALLABLE(N(UseAbility)) {
|| playerStatus->actionState == ACTION_STATE_HIT_LAVA
|| playerStatus->actionState == ACTION_STATE_KNOCKBACK
) {
N(UseAbilityState) = AIR_LIFT_DROP;
N(AbilityState) = AIR_LIFT_DROP;
break;
}
// handle jump/cancel inputs
if (partnerActionStatus->pressedButtons & (BUTTON_A | BUTTON_B | BUTTON_C_DOWN)) {
N(UseAbilityState) = (partnerActionStatus->pressedButtons & BUTTON_A) ? AIR_LIFT_JUMP : AIR_LIFT_DROP;
if (partnerStatus->pressedButtons & (BUTTON_A | BUTTON_B | BUTTON_C_DOWN)) {
N(AbilityState) = (partnerStatus->pressedButtons & BUTTON_A) ? AIR_LIFT_JUMP : AIR_LIFT_DROP;
suggest_player_anim_allow_backward(ANIM_Mario1_Idle);
break;
}
@ -354,7 +354,7 @@ API_CALLABLE(N(UseAbility)) {
halfCollisionHeight = playerStatus->spriteFacingAngle - 90.0f + gCameras[gCurrentCameraID].currentYaw;
if (player_raycast_up_corners(playerStatus, &x, &y, &z, &length, halfCollisionHeight) >= 0) {
suggest_player_anim_allow_backward(ANIM_Mario1_Idle);
N(UseAbilityState) = AIR_LIFT_DROP;
N(AbilityState) = AIR_LIFT_DROP;
break;
}
@ -409,7 +409,7 @@ API_CALLABLE(N(UseAbility)) {
if (surfaceType == SURFACE_TYPE_SPIKES || surfaceType == SURFACE_TYPE_LAVA) {
playerStatus->hazardType = HAZARD_TYPE_SPIKES;
playerStatus->flags |= PS_FLAG_HIT_FIRE;
N(UseAbilityState) = AIR_LIFT_DROP;
N(AbilityState) = AIR_LIFT_DROP;
}
playerStatus->position.y += (y - playerStatus->position.y) / 4.0f;
@ -418,7 +418,7 @@ API_CALLABLE(N(UseAbility)) {
if (parakarry->flags & NPC_FLAG_COLLDING_FORWARD_WITH_WORLD) {
suggest_player_anim_allow_backward(ANIM_Mario1_Idle);
N(UseAbilityState) = AIR_LIFT_DROP;
N(AbilityState) = AIR_LIFT_DROP;
break;
}
@ -435,7 +435,7 @@ API_CALLABLE(N(UseAbility)) {
parakarry->currentAnim = ANIM_WorldParakarry_CarryHeavy;
parakarry->animationSpeed = 1.8f;
gCollisionStatus.currentFloor = NO_COLLIDER;
N(UseAbilityState)++; // AIR_LIFT_CARRY
N(AbilityState)++; // AIR_LIFT_CARRY
}
break;
case AIR_LIFT_CARRY:
@ -444,24 +444,24 @@ API_CALLABLE(N(UseAbility)) {
|| playerStatus->actionState == ACTION_STATE_HIT_LAVA
|| playerStatus->actionState == ACTION_STATE_KNOCKBACK
) {
N(UseAbilityState) = AIR_LIFT_DROP;
N(AbilityState) = AIR_LIFT_DROP;
break;
}
suggest_player_anim_always_forward(ANIM_MarioW2_HoldOnto);
if (playerStatus->flags & PS_FLAG_HIT_FIRE) {
N(UseAbilityState) = AIR_LIFT_JUMP;
N(AbilityState) = AIR_LIFT_JUMP;
break;
}
// handle jump/cancel inputs
if (partnerActionStatus->pressedButtons & (BUTTON_A | BUTTON_B | BUTTON_C_DOWN)) {
if (partnerActionStatus->pressedButtons & buttonTemp) { // TODO find a way to remove this while still loading 0x15 instead of moving it from register
if (partnerStatus->pressedButtons & (BUTTON_A | BUTTON_B | BUTTON_C_DOWN)) {
if (partnerStatus->pressedButtons & buttonTemp) { // TODO find a way to remove this while still loading 0x15 instead of moving it from register
if (!parakarry->pos.x) {
}
}
N(UseAbilityState) = (partnerActionStatus->pressedButtons & BUTTON_A) ? AIR_LIFT_JUMP : AIR_LIFT_DROP;
N(AbilityState) = (partnerStatus->pressedButtons & BUTTON_A) ? AIR_LIFT_JUMP : AIR_LIFT_DROP;
break;
}
@ -501,7 +501,7 @@ API_CALLABLE(N(UseAbility)) {
playerStatus->colliderHeight, playerStatus->colliderDiameter)
) {
suggest_player_anim_allow_backward(ANIM_Mario1_Idle);
N(UseAbilityState) = AIR_LIFT_DROP;
N(AbilityState) = AIR_LIFT_DROP;
break;
}
@ -538,7 +538,7 @@ API_CALLABLE(N(UseAbility)) {
parakarry->pos.y = y;
if (hitAbove) {
N(UseAbilityState) = AIR_LIFT_DROP;
N(AbilityState) = AIR_LIFT_DROP;
break;
}
}
@ -553,7 +553,7 @@ API_CALLABLE(N(UseAbility)) {
parakarry->duration++;
if (!(parakarry->planarFlyDist < 100.0f)) {
N(AbilityStateTime) = 5;
N(UseAbilityState) = AIR_LIFT_HOLD;
N(AbilityState) = AIR_LIFT_HOLD;
}
break;
}
@ -561,20 +561,20 @@ API_CALLABLE(N(UseAbility)) {
}
}
suggest_player_anim_allow_backward(ANIM_Mario1_Idle);
N(UseAbilityState) = AIR_LIFT_DROP;
N(AbilityState) = AIR_LIFT_DROP;
break;
case AIR_LIFT_HOLD:
if (N(AbilityStateTime) != 0) {
N(AbilityStateTime)--;
} else {
N(UseAbilityState) = AIR_LIFT_DROP;
N(AbilityState) = AIR_LIFT_DROP;
}
break;
}
if (N(UseAbilityState) == AIR_LIFT_JUMP
|| N(UseAbilityState) == AIR_LIFT_DROP
|| N(UseAbilityState) == AIR_LIFT_CANCEL
if (N(AbilityState) == AIR_LIFT_JUMP
|| N(AbilityState) == AIR_LIFT_DROP
|| N(AbilityState) == AIR_LIFT_CANCEL
) {
parakarry->currentAnim = ANIM_WorldParakarry_Idle;
N(UsingAbility) = FALSE;
@ -582,8 +582,8 @@ API_CALLABLE(N(UseAbility)) {
parakarry->flags &= ~NPC_FLAG_JUMPING;
parakarry->animationSpeed = 1.0f;
partner_clear_player_tracking(parakarry);
partnerActionStatus->actingPartner = PARTNER_NONE;
partnerActionStatus->partnerActionState = PARTNER_ACTION_NONE;
partnerStatus->actingPartner = PARTNER_NONE;
partnerStatus->partnerActionState = PARTNER_ACTION_NONE;
enable_partner_ai();
sfx_stop_sound(SOUND_2009);
if (N(LockingPlayerInput)) {
@ -594,9 +594,9 @@ API_CALLABLE(N(UseAbility)) {
}
if ((playerStatus->flags & PS_FLAG_HIT_FIRE)) {
set_action_state(ACTION_STATE_HIT_LAVA);
} else if (N(UseAbilityState) == AIR_LIFT_JUMP) {
} else if (N(AbilityState) == AIR_LIFT_JUMP) {
start_bounce_b();
} else if (N(UseAbilityState) == AIR_LIFT_DROP) {
} else if (N(AbilityState) == AIR_LIFT_DROP) {
start_falling();
gravity_use_fall_parms();
playerStatus->flags |= PS_FLAG_SCRIPTED_FALL;
@ -636,7 +636,7 @@ EvtScript EVS_WorldParakarry_PutAway = {
};
void N(pre_battle)(Npc* parakarry) {
PartnerActionStatus* partnerStatus = &gPartnerActionStatus;
PartnerStatus* partnerStatus = &gPartnerStatus;
if (N(UsingAbility)) {
if (N(PlayerCollisionDisabled)) {
@ -649,7 +649,7 @@ void N(pre_battle)(Npc* parakarry) {
set_action_state(ACTION_STATE_IDLE);
partnerStatus->npc = *parakarry;
partnerStatus->partnerAction_unk_1 = TRUE;
partnerStatus->shouldResumeAbility = TRUE;
partner_clear_player_tracking(parakarry);
}
@ -657,9 +657,9 @@ void N(pre_battle)(Npc* parakarry) {
}
void N(post_battle)(Npc* parakarry) {
PartnerActionStatus* partnerStatus = &gPartnerActionStatus;
PartnerStatus* partnerStatus = &gPartnerStatus;
if (partnerStatus->partnerAction_unk_1) {
if (partnerStatus->shouldResumeAbility) {
if (N(PlayerCollisionDisabled)) {
disable_player_static_collisions();
}

File diff suppressed because it is too large Load Diff

View File

@ -8,10 +8,12 @@ void world_sushie_init(Npc*);
void world_sushie_pre_battle(Npc*);
void world_sushie_post_battle(Npc*);
void world_sushie_sync_player_position(void);
extern EvtScript EVS_WorldSushie_TakeOut;
extern EvtScript EVS_WorldSushie_Update;
extern EvtScript EVS_WorldSushie_UseAbility;
extern EvtScript EVS_WorldSushie_PutAway;
extern EvtScript EVS_WorldSushie_Riding;
extern EvtScript EVS_WorldSushie_EnterMap;
#endif

View File

@ -8,62 +8,71 @@
#define NAMESPACE world_watt
void force_player_anim(AnimID);
void func_802BE014_31DB84(void);
void N(sync_held_position)(void);
void N(update_player_carry_anim)(void);
s32 D_802BE250_31DDC0[] = {24, 6};
BSS b32 N(D_802BE300);
BSS s32 N(AbilityState);
BSS b32 N(D_802BE308);
BSS b32 N(IsPlayerHolding);
BSS EffectInstance* N(StaticEffect);
BSS s32 N(D_802BE314); // unused (padding?)
BSS s32 D_802BE300;
BSS s32 D_802BE304;
BSS s32 D_802BE308;
BSS s32 D_802BE30C;
BSS EffectInstance* WattStaticEffect;
BSS s32 D_802BE314;
BSS TweesterPhysics WattTweesterPhysics;
enum {
// next two states lock input for a few frames, during which the ability can be canceled
SHINING_STATE_INIT = 40,
SHINING_STATE_DELAY = 41,
SHINING_STATE_BEGIN = 20,
SHINING_STATE_GATHER = 21,
SHINING_STATE_HOLDING = 1,
SHINING_STATE_RELEASE = 2,
};
void func_802BD100_31CC70(Npc* npc) {
void N(create_static_effect)(Npc* npc) {
if (!(npc->flags & NPC_FLAG_INVISIBLE)) {
if (WattStaticEffect == NULL) {
WattStaticEffect = fx_static_status(0, npc->pos.x, npc->pos.y + 13.0f, npc->pos.z, 0.9f, 5, 0);
if (N(StaticEffect) == NULL) {
N(StaticEffect) = fx_static_status(0, npc->pos.x, npc->pos.y + 13.0f, npc->pos.z, 0.9f, 5, 0);
}
}
}
s32 world_watt_dispose_static_effect(void) {
if (WattStaticEffect != NULL) {
WattStaticEffect->data.staticStatus->unk_28 = 1;
WattStaticEffect = NULL;
return 1;
void N(dispose_static_effect)(void) {
if (N(StaticEffect) != NULL) {
N(StaticEffect)->data.staticStatus->timeLeft = 1;
N(StaticEffect) = NULL;
}
}
void func_802BD1AC_31CD1C(s32 arg0) {
EffectInstance* effect = WattStaticEffect;
StaticStatusFXData* data = effect->data.staticStatus;
f32 tmp;
s32 parts;
s32 N(EffectAnimLengths)[] = { 24, 6 }; // second type is different from length in static_status.c (6 vs 12)
void N(reset_static_effect)(s32 type) {
EffectInstance* effect = N(StaticEffect);
StaticStatusFXData* part = effect->data.staticStatus;
f32 invisTime;
s32 count;
s32 i;
data->unk_00 = arg0;
tmp = D_802BE250_31DDC0[arg0] * 0.5f;
parts = effect->numParts - 1;
part->type = type;
invisTime = N(EffectAnimLengths)[type] * 0.5f;
count = effect->numParts - 1;
data++;
for (i = 1; i < parts; i++, data++) {
data->unk_20 = -1.0f - (tmp * (i & 1));
part++;
for (i = 1; i < count; i++, part++) {
part->frame = -1.0f - (invisTime * (i & 1));
}
}
void world_watt_init(Npc* npc) {
void N(init)(Npc* npc) {
npc->collisionHeight = 24;
npc->collisionRadius = 24;
D_802BE308 = 0;
D_802BE300 = 0;
D_802BE30C = 0;
D_802BE304 = 20;
WattStaticEffect = NULL;
N(D_802BE308) = FALSE;
N(D_802BE300) = FALSE;
N(IsPlayerHolding) = FALSE;
N(AbilityState) = SHINING_STATE_BEGIN;
N(StaticEffect) = NULL;
}
API_CALLABLE(func_802BD27C_31CDEC) {
API_CALLABLE(N(TakeOut)) {
Npc* watt = script->owner2.npc;
if (isInitialCall) {
@ -78,25 +87,26 @@ API_CALLABLE(func_802BD27C_31CDEC) {
}
EvtScript EVS_WorldWatt_TakeOut = {
EVT_CALL(func_802BD27C_31CDEC)
EVT_CALL(N(TakeOut))
EVT_RETURN
EVT_END
};
TweesterPhysics* WattTweesterPhysicsPtr = &WattTweesterPhysics;
BSS TweesterPhysics N(TweesterPhysicsData);
TweesterPhysics* N(TweesterPhysicsPtr) = &N(TweesterPhysicsData);
s32 D_802BE278_31DDE8 = 0;
b32 N(WattIsMoving) = FALSE;
API_CALLABLE(WattUpdate) {
API_CALLABLE(N(Update)) {
PlayerData* playerData = &gPlayerData;
Npc* watt = script->owner2.npc;
f32 sinAngle, cosAngle, liftoffVelocity;
Entity* entity;
if (!gPartnerActionStatus.partnerAction_unk_1) {
if (!gPartnerStatus.shouldResumeAbility) {
if (isInitialCall) {
partner_flying_enable(watt, 1);
mem_clear(WattTweesterPhysicsPtr, sizeof(TweesterPhysics));
mem_clear(N(TweesterPhysicsPtr), sizeof(TweesterPhysics));
TweesterTouchingPartner = NULL;
}
@ -104,188 +114,185 @@ API_CALLABLE(WattUpdate) {
playerData->partnerUsedTime[PARTNER_WATT]++;
if (entity == NULL) {
func_802BD100_31CC70(watt);
N(create_static_effect)(watt);
partner_flying_update_player_tracking(watt);
partner_flying_update_motion(watt);
if (watt->moveSpeed != 0.0f) {
if (D_802BE278_31DDE8 == 0) {
D_802BE278_31DDE8 = 1;
func_802BD1AC_31CD1C(1);
if (!N(WattIsMoving)) {
N(WattIsMoving) = TRUE;
N(reset_static_effect)(1);
watt->currentAnim = ANIM_WorldWatt_Run;
}
} else if (D_802BE278_31DDE8 != 0) {
D_802BE278_31DDE8 = 0;
func_802BD1AC_31CD1C(0);
watt->currentAnim = ANIM_WorldWatt_Idle;
} else {
if (N(WattIsMoving)) {
N(WattIsMoving) = FALSE;
N(reset_static_effect)(0);
watt->currentAnim = ANIM_WorldWatt_Idle;
}
}
if (WattStaticEffect != NULL) {
WattStaticEffect->data.staticStatus->unk_04 = watt->pos.x;
WattStaticEffect->data.staticStatus->unk_08 = watt->pos.y + 13.0f;
WattStaticEffect->data.staticStatus->unk_0C = watt->pos.z;
if (N(StaticEffect) != NULL) {
N(StaticEffect)->data.staticStatus->pos.x = watt->pos.x;
N(StaticEffect)->data.staticStatus->pos.y = watt->pos.y + 13.0f;
N(StaticEffect)->data.staticStatus->pos.z = watt->pos.z;
}
return ApiStatus_BLOCK;
}
switch (WattTweesterPhysicsPtr->state) {
switch (N(TweesterPhysicsPtr)->state) {
case TWEESTER_PARTNER_INIT:
WattTweesterPhysicsPtr->state++;
WattTweesterPhysicsPtr->prevFlags = watt->flags;
WattTweesterPhysicsPtr->radius = fabsf(dist2D(watt->pos.x, watt->pos.z,
entity->position.x, entity->position.z));
WattTweesterPhysicsPtr->angle = atan2(entity->position.x, entity->position.z, watt->pos.x, watt->pos.z);
WattTweesterPhysicsPtr->angularVelocity = 6.0f;
WattTweesterPhysicsPtr->liftoffVelocityPhase = 50.0f;
WattTweesterPhysicsPtr->countdown = 120;
N(TweesterPhysicsPtr)->state++;
N(TweesterPhysicsPtr)->prevFlags = watt->flags;
N(TweesterPhysicsPtr)->radius = fabsf(dist2D(watt->pos.x, watt->pos.z, entity->position.x, entity->position.z));
N(TweesterPhysicsPtr)->angle = atan2(entity->position.x, entity->position.z, watt->pos.x, watt->pos.z);
N(TweesterPhysicsPtr)->angularVelocity = 6.0f;
N(TweesterPhysicsPtr)->liftoffVelocityPhase = 50.0f;
N(TweesterPhysicsPtr)->countdown = 120;
watt->flags |= NPC_FLAG_IGNORE_CAMERA_FOR_YAW | NPC_FLAG_IGNORE_PLAYER_COLLISION | NPC_FLAG_IGNORE_WORLD_COLLISION | NPC_FLAG_8;
watt->flags &= ~NPC_FLAG_GRAVITY;
case TWEESTER_PARTNER_ATTRACT:
sin_cos_rad(DEG_TO_RAD(WattTweesterPhysicsPtr->angle), &sinAngle, &cosAngle);
watt->pos.x = (entity->position.x + (sinAngle * WattTweesterPhysicsPtr->radius));
watt->pos.z = (entity->position.z - (cosAngle * WattTweesterPhysicsPtr->radius));
WattTweesterPhysicsPtr->angle = clamp_angle(WattTweesterPhysicsPtr->angle - WattTweesterPhysicsPtr->angularVelocity);
sin_cos_rad(DEG_TO_RAD(N(TweesterPhysicsPtr)->angle), &sinAngle, &cosAngle);
watt->pos.x = entity->position.x + (sinAngle * N(TweesterPhysicsPtr)->radius);
watt->pos.z = entity->position.z - (cosAngle * N(TweesterPhysicsPtr)->radius);
N(TweesterPhysicsPtr)->angle = clamp_angle(N(TweesterPhysicsPtr)->angle - N(TweesterPhysicsPtr)->angularVelocity);
if (WattTweesterPhysicsPtr->radius > 20.0f) {
WattTweesterPhysicsPtr->radius--;
} else if (WattTweesterPhysicsPtr->radius < 19.0f) {
WattTweesterPhysicsPtr->radius++;
if (N(TweesterPhysicsPtr)->radius > 20.0f) {
N(TweesterPhysicsPtr)->radius--;
} else if (N(TweesterPhysicsPtr)->radius < 19.0f) {
N(TweesterPhysicsPtr)->radius++;
}
liftoffVelocity = sin_rad(DEG_TO_RAD(WattTweesterPhysicsPtr->liftoffVelocityPhase)) * 3.0f;
WattTweesterPhysicsPtr->liftoffVelocityPhase += 3.0f;
liftoffVelocity = sin_rad(DEG_TO_RAD(N(TweesterPhysicsPtr)->liftoffVelocityPhase)) * 3.0f;
N(TweesterPhysicsPtr)->liftoffVelocityPhase += 3.0f;
if (WattTweesterPhysicsPtr->liftoffVelocityPhase > 150.0f) {
WattTweesterPhysicsPtr->liftoffVelocityPhase = 150.0f;
if (N(TweesterPhysicsPtr)->liftoffVelocityPhase > 150.0f) {
N(TweesterPhysicsPtr)->liftoffVelocityPhase = 150.0f;
}
watt->pos.y += liftoffVelocity;
watt->renderYaw = clamp_angle(360.0f - WattTweesterPhysicsPtr->angle);
WattTweesterPhysicsPtr->angularVelocity += 0.8;
watt->renderYaw = clamp_angle(360.0f - N(TweesterPhysicsPtr)->angle);
N(TweesterPhysicsPtr)->angularVelocity += 0.8;
if (WattTweesterPhysicsPtr->angularVelocity > 40.0f) {
WattTweesterPhysicsPtr->angularVelocity = 40.0f;
if (N(TweesterPhysicsPtr)->angularVelocity > 40.0f) {
N(TweesterPhysicsPtr)->angularVelocity = 40.0f;
}
if (--WattTweesterPhysicsPtr->countdown == 0) {
WattTweesterPhysicsPtr->state++;
if (--N(TweesterPhysicsPtr)->countdown == 0) {
N(TweesterPhysicsPtr)->state++;
}
break;
case TWEESTER_PARTNER_HOLD:
watt->flags = WattTweesterPhysicsPtr->prevFlags;
WattTweesterPhysicsPtr->countdown = 30;
WattTweesterPhysicsPtr->state++;
watt->flags = N(TweesterPhysicsPtr)->prevFlags;
N(TweesterPhysicsPtr)->countdown = 30;
N(TweesterPhysicsPtr)->state++;
break;
case TWEESTER_PARTNER_RELEASE:
partner_flying_update_player_tracking(watt);
partner_flying_update_motion(watt);
if (--WattTweesterPhysicsPtr->countdown == 0) {
WattTweesterPhysicsPtr->state = TWEESTER_PARTNER_INIT;
if (--N(TweesterPhysicsPtr)->countdown == 0) {
N(TweesterPhysicsPtr)->state = TWEESTER_PARTNER_INIT;
TweesterTouchingPartner = NULL;
}
break;
}
if (WattStaticEffect != 0) {
WattStaticEffect->data.staticStatus->unk_04 = watt->pos.x;
WattStaticEffect->data.staticStatus->unk_08 = watt->pos.y + 13.0f;
WattStaticEffect->data.staticStatus->unk_0C = watt->pos.z;
if (N(StaticEffect) != NULL) {
N(StaticEffect)->data.staticStatus->pos.x = watt->pos.x;
N(StaticEffect)->data.staticStatus->pos.y = watt->pos.y + 13.0f;
N(StaticEffect)->data.staticStatus->pos.z = watt->pos.z;
}
}
return ApiStatus_BLOCK;
}
EvtScript EVS_WorldWatt_Update = {
EVT_CALL(WattUpdate)
EVT_CALL(N(Update))
EVT_RETURN
EVT_END
};
void func_802BD710_31D280(Npc* watt) {
void N(try_cancel_tweester)(Npc* watt) {
if (TweesterTouchingPartner != NULL) {
TweesterTouchingPartner = NULL;
watt->flags = WattTweesterPhysicsPtr->prevFlags;
WattTweesterPhysicsPtr->state = TWEESTER_PARTNER_INIT;
watt->flags = N(TweesterPhysicsPtr)->prevFlags;
N(TweesterPhysicsPtr)->state = TWEESTER_PARTNER_INIT;
partner_clear_player_tracking(watt);
}
}
API_CALLABLE(func_802BD754_31D2C4) {
API_CALLABLE(N(UseAbility)) {
PlayerStatus* playerStatus = &gPlayerStatus;
PartnerActionStatus* partnerActionStatus = &gPartnerActionStatus;
PartnerStatus* partnerStatus = &gPartnerStatus;
Npc* npc = script->owner2.npc;
s32 actionState;
if (isInitialCall) {
func_802BD710_31D280(npc);
if (!(playerStatus->animFlags & PA_FLAG_CHANGING_MAP)) {
if (!partnerActionStatus->partnerAction_unk_1) {
if ((partnerActionStatus->partnerActionState != ACTION_STATE_IDLE) ||
(func_800EA52C(PARTNER_WATT) && !is_starting_conversation()))
{
if (gGameStatusPtr->keepUsingPartnerOnMapChange) {
if (playerStatus->animFlags & (PA_FLAG_USING_WATT | PA_FLAG_WATT_IN_HANDS)) {
D_802BE304 = 20;
} else {
D_802BE304 = 40;
}
} else if (playerStatus->animFlags & PA_FLAG_USING_WATT) {
D_802BE304 = 2;
} else {
D_802BE304 = 40;
}
N(try_cancel_tweester)(npc);
if ((playerStatus->animFlags & PA_FLAG_CHANGING_MAP)) {
return ApiStatus_DONE2;
}
if (!partnerStatus->shouldResumeAbility) {
if (partnerStatus->partnerActionState == ACTION_STATE_IDLE
&& (!func_800EA52C(PARTNER_WATT) || is_starting_conversation()))
{
return ApiStatus_DONE2;
}
if (gGameStatusPtr->keepUsingPartnerOnMapChange) {
if (playerStatus->animFlags & (PA_FLAG_USING_WATT | PA_FLAG_WATT_IN_HANDS)) {
N(AbilityState) = SHINING_STATE_BEGIN;
} else {
return ApiStatus_DONE2;
N(AbilityState) = SHINING_STATE_INIT;
}
} else if (playerStatus->animFlags & PA_FLAG_USING_WATT) {
N(AbilityState) = SHINING_STATE_RELEASE;
} else {
partnerActionStatus->partnerAction_unk_1 = FALSE;
playerStatus->animFlags |= (PA_FLAG_USING_WATT | PA_FLAG_WATT_IN_HANDS);
func_802BE014_31DB84();
npc->currentAnim = ANIM_WorldWatt_Idle;
D_802BE304 = 1;
script->functionTemp[1] = 2;
N(AbilityState) = SHINING_STATE_INIT;
}
} else {
return ApiStatus_DONE2;
partnerStatus->shouldResumeAbility = FALSE;
playerStatus->animFlags |= (PA_FLAG_USING_WATT | PA_FLAG_WATT_IN_HANDS);
N(update_player_carry_anim)();
npc->currentAnim = ANIM_WorldWatt_Idle;
N(AbilityState) = SHINING_STATE_HOLDING;
script->functionTemp[1] = 2;
}
}
switch (D_802BE304) {
case 40:
switch (N(AbilityState)) {
case SHINING_STATE_INIT:
if (playerStatus->inputDisabledCount != 0) {
return ApiStatus_DONE2;
}
script->functionTemp[1] = 3;
D_802BE304 = 41;
N(AbilityState) = SHINING_STATE_DELAY;
script->functionTemp[2] = playerStatus->inputDisabledCount;
break;
case 41:
case SHINING_STATE_DELAY:
if (script->functionTemp[1] == 0) {
if (script->functionTemp[2] >= playerStatus->inputDisabledCount) {
if (!(playerStatus->animFlags & PA_FLAG_CHANGING_MAP)) {
if (func_800EA52C(PARTNER_WATT)) {
if (!is_starting_conversation()) {
D_802BE304 = 20;
break;
}
}
}
if (script->functionTemp[2] < playerStatus->inputDisabledCount
|| playerStatus->animFlags & PA_FLAG_CHANGING_MAP
|| !func_800EA52C(PARTNER_WATT)
|| is_starting_conversation()
) {
return ApiStatus_DONE2;
}
return ApiStatus_DONE2;
N(AbilityState) = SHINING_STATE_BEGIN;
break;
}
script->functionTemp[1]--;
break;
}
switch (D_802BE304) {
case 20:
switch (N(AbilityState)) {
case SHINING_STATE_BEGIN:
if (gGameStatusPtr->keepUsingPartnerOnMapChange) {
playerStatus->animFlags |= PA_FLAG_USING_WATT;
D_802BE30C = 1;
N(IsPlayerHolding) = TRUE;
npc->flags |= NPC_FLAG_IGNORE_PLAYER_COLLISION | NPC_FLAG_8;
npc->flags &= ~(NPC_FLAG_JUMPING | NPC_FLAG_GRAVITY);
gGameStatusPtr->keepUsingPartnerOnMapChange = 0;
partnerActionStatus->partnerActionState = PARTNER_ACTION_USE;
partnerActionStatus->actingPartner = PARTNER_WATT;
gGameStatusPtr->keepUsingPartnerOnMapChange = FALSE;
partnerStatus->partnerActionState = PARTNER_ACTION_USE;
partnerStatus->actingPartner = PARTNER_WATT;
npc->moveToPos.x = playerStatus->position.x;
npc->moveToPos.y = playerStatus->position.y + 5.0f;
npc->moveToPos.z = playerStatus->position.z;
@ -294,17 +301,17 @@ API_CALLABLE(func_802BD754_31D2C4) {
npc->yaw = playerStatus->targetYaw;
npc->currentAnim = ANIM_WorldWatt_Idle;
playerStatus->animFlags |= PA_FLAG_WATT_IN_HANDS;
func_802BE014_31DB84();
N(update_player_carry_anim)();
npc_set_palswap_mode_A(npc, 1);
script->functionTemp[1] = 2;
D_802BE304 = 1;
N(AbilityState) = SHINING_STATE_HOLDING;
} else {
playerStatus->animFlags |= PA_FLAG_USING_WATT;
D_802BE30C = 1;
N(IsPlayerHolding) = TRUE;
npc->flags &= ~(NPC_FLAG_JUMPING | NPC_FLAG_GRAVITY);
gGameStatusPtr->keepUsingPartnerOnMapChange = 0;
partnerActionStatus->partnerActionState = PARTNER_ACTION_USE;
partnerActionStatus->actingPartner = PARTNER_WATT;
gGameStatusPtr->keepUsingPartnerOnMapChange = FALSE;
partnerStatus->partnerActionState = PARTNER_ACTION_USE;
partnerStatus->actingPartner = PARTNER_WATT;
partner_force_player_flip_done();
npc->moveToPos.x = playerStatus->position.x;
npc->moveToPos.y = playerStatus->position.y + 5.0f;
@ -313,10 +320,10 @@ API_CALLABLE(func_802BD754_31D2C4) {
add_vec2D_polar(&npc->moveToPos.x, &npc->moveToPos.z, 15.0f, playerStatus->targetYaw);
npc->duration = 8;
npc->yaw = atan2(npc->pos.x, npc->pos.z, playerStatus->position.x, playerStatus->position.z);
D_802BE304++;
N(AbilityState)++; // SHINING_STATE_GATHER
}
break;
case 21:
case SHINING_STATE_GATHER:
npc->pos.x += (npc->moveToPos.x - npc->pos.x) / npc->duration;
npc->pos.y += (npc->moveToPos.y - npc->pos.y) / npc->duration;
npc->pos.z += (npc->moveToPos.z - npc->pos.z) / npc->duration;
@ -324,47 +331,50 @@ API_CALLABLE(func_802BD754_31D2C4) {
if (npc->duration == 0) {
npc->yaw = playerStatus->targetYaw;
npc->currentAnim = ANIM_WorldWatt_Idle;
partnerActionStatus->actingPartner = PARTNER_WATT;
partnerStatus->actingPartner = PARTNER_WATT;
playerStatus->animFlags |= PA_FLAG_WATT_IN_HANDS;
func_802BE014_31DB84();
N(update_player_carry_anim)();
script->functionTemp[1] = 2;
D_802BE304 = 1;
N(AbilityState) = SHINING_STATE_HOLDING;
}
break;
case 1:
world_watt_sync_held_position();
case SHINING_STATE_HOLDING:
N(sync_held_position)();
// immediately cancel state on touching fire
if ((playerStatus->flags & PS_FLAG_HIT_FIRE)) {
D_802BE304 = 2;
} else {
s32 actionState = playerStatus->actionState;
if (actionState != ACTION_STATE_USE_SPINNING_FLOWER) {
if (script->functionTemp[1] != 0) {
script->functionTemp[1]--;
} else if (
actionState == ACTION_STATE_IDLE ||
actionState == ACTION_STATE_WALK ||
actionState == ACTION_STATE_RUN ||
actionState == ACTION_STATE_LAND)
{
if (partnerActionStatus->pressedButtons & BUTTON_B) {
D_802BE304 = 2;
}
}
}
N(AbilityState) = SHINING_STATE_RELEASE;
break;
}
if (playerStatus->actionState == ACTION_STATE_USE_SPINNING_FLOWER) {
break;
}
// wait for begin holding cooldown
if (script->functionTemp[1] != 0) {
script->functionTemp[1]--;
break;
}
// allow stop-holding input
actionState = playerStatus->actionState;
if ((actionState == ACTION_STATE_IDLE
|| actionState == ACTION_STATE_WALK
|| actionState == ACTION_STATE_RUN
|| actionState == ACTION_STATE_LAND)
&& partnerStatus->pressedButtons & BUTTON_B
) {
N(AbilityState) = SHINING_STATE_RELEASE;
}
break;
}
if (D_802BE304 == 2) {
if (N(AbilityState) == SHINING_STATE_RELEASE) {
playerStatus->animFlags &= ~(PA_FLAG_WATT_IN_HANDS | PA_FLAG_USING_WATT);
npc->currentAnim = ANIM_WorldWatt_Idle;
partner_clear_player_tracking(npc);
D_802BE30C = 0;
partnerActionStatus->actingPartner = PARTNER_NONE;
partnerActionStatus->partnerActionState = PARTNER_ACTION_NONE;
N(IsPlayerHolding) = FALSE;
partnerStatus->actingPartner = PARTNER_NONE;
partnerStatus->partnerActionState = PARTNER_ACTION_NONE;
gGameStatusPtr->keepUsingPartnerOnMapChange = FALSE;
D_802BE304 = 20;
N(AbilityState) = SHINING_STATE_BEGIN;
npc_set_palswap_mode_A(npc, 0);
if (!(playerStatus->flags & PS_FLAG_HIT_FIRE)) {
set_action_state(ACTION_STATE_IDLE);
@ -372,34 +382,33 @@ API_CALLABLE(func_802BD754_31D2C4) {
return ApiStatus_DONE1;
}
if (WattStaticEffect != NULL) {
WattStaticEffect->data.staticStatus->unk_04 = npc->pos.x;
WattStaticEffect->data.staticStatus->unk_08 = npc->pos.y + 13.0f;
WattStaticEffect->data.staticStatus->unk_0C = npc->pos.z;
if (N(StaticEffect) != NULL) {
N(StaticEffect)->data.staticStatus->pos.x = npc->pos.x;
N(StaticEffect)->data.staticStatus->pos.y = npc->pos.y + 13.0f;
N(StaticEffect)->data.staticStatus->pos.z = npc->pos.z;
}
return ApiStatus_BLOCK;
}
EvtScript EVS_WorldWatt_UseAbility = {
EVT_CALL(func_802BD754_31D2C4)
EVT_CALL(N(UseAbility))
EVT_RETURN
EVT_END
};
API_CALLABLE(WattPutAway) {
API_CALLABLE(N(PutAway)) {
PlayerStatus* playerStatus = &gPlayerStatus;
PartnerActionStatus* wattActionStatus = &gPartnerActionStatus;
PartnerStatus* partnerStatus = &gPartnerStatus;
Npc* watt = script->owner2.npc;
if (isInitialCall) {
world_watt_dispose_static_effect();
N(dispose_static_effect)();
partner_init_put_away(watt);
force_player_anim(ANIM_Mario1_Idle);
wattActionStatus->actingPartner = PARTNER_NONE;
wattActionStatus->partnerActionState = PARTNER_ACTION_NONE;
partnerStatus->actingPartner = PARTNER_NONE;
partnerStatus->partnerActionState = PARTNER_ACTION_NONE;
playerStatus->animFlags &= ~(PA_FLAG_WATT_IN_HANDS | PA_FLAG_USING_WATT);
gGameStatusPtr->keepUsingPartnerOnMapChange = 0;
gGameStatusPtr->keepUsingPartnerOnMapChange = FALSE;
}
if (partner_put_away(watt)) {
@ -410,35 +419,35 @@ API_CALLABLE(WattPutAway) {
}
EvtScript EVS_WorldWatt_PutAway = {
EVT_CALL(WattPutAway)
EVT_CALL(N(PutAway))
EVT_RETURN
EVT_END
};
void world_watt_pre_battle(Npc* watt) {
PartnerActionStatus* wattActionStatus = &gPartnerActionStatus;
void N(pre_battle)(Npc* watt) {
PartnerStatus* partnerStatus = &gPartnerStatus;
if (D_802BE30C != 0) {
wattActionStatus->npc = *watt;
wattActionStatus->partnerAction_unk_1 = TRUE;
if (N(IsPlayerHolding)) {
partnerStatus->npc = *watt;
partnerStatus->shouldResumeAbility = TRUE;
partner_clear_player_tracking(watt);
}
world_watt_dispose_static_effect();
N(dispose_static_effect)();
}
void world_watt_post_battle(Npc* watt) {
PartnerActionStatus* wattActionStatus = &gPartnerActionStatus;
void N(post_battle)(Npc* watt) {
PartnerStatus* partnerStatus = &gPartnerStatus;
if (wattActionStatus->partnerAction_unk_1) {
*watt = wattActionStatus->npc;
if (partnerStatus->shouldResumeAbility) {
*watt = partnerStatus->npc;
partner_use_ability();
func_802BD100_31CC70(watt);
N(create_static_effect)(watt);
}
}
API_CALLABLE(N(Riding)) {
PartnerActionStatus* wattActionStatus = &gPartnerActionStatus;
API_CALLABLE(N(EnterMap)) {
PartnerStatus* partnerStatus = &gPartnerStatus;
PlayerStatus* playerStatus = &gPlayerStatus;
Npc* watt = get_npc_unsafe(NPC_PARTNER);
@ -450,28 +459,28 @@ API_CALLABLE(N(Riding)) {
case 0:
if (script->varTable[12] == 0) {
partner_kill_ability_script();
world_watt_dispose_static_effect();
N(dispose_static_effect)();
} else {
func_802BD100_31CC70(watt);
N(create_static_effect)(watt);
}
script->functionTemp[1] = script->varTable[4];
playerStatus->targetYaw = atan2(playerStatus->position.x, playerStatus->position.z,
script->varTable[1], script->varTable[3]);
script->varTable[1], script->varTable[3]);
playerStatus->heading = playerStatus->targetYaw;
move_player(script->functionTemp[1], playerStatus->heading, script->varTableF[5]);
world_watt_sync_held_position();
N(sync_held_position)();
watt->flags &= ~NPC_FLAG_GRAVITY;
watt->flags |= NPC_FLAG_IGNORE_PLAYER_COLLISION;
playerStatus->animFlags |= (PA_FLAG_WATT_IN_HANDS | PA_FLAG_USING_WATT);
gGameStatusPtr->keepUsingPartnerOnMapChange = 1;
wattActionStatus->partnerActionState = PARTNER_ACTION_WATT_SHINE;
wattActionStatus->actingPartner = PARTNER_WATT;
D_802BE308 = 0;
gGameStatusPtr->keepUsingPartnerOnMapChange = TRUE;
partnerStatus->partnerActionState = PARTNER_ACTION_WATT_SHINE;
partnerStatus->actingPartner = PARTNER_WATT;
N(D_802BE308) = FALSE;
script->functionTemp[0]++;
break;
case 1:
world_watt_sync_held_position();
N(sync_held_position)();
script->functionTemp[1]--;
if (script->functionTemp[1] == 0) {
if (script->varTable[12]) {
@ -485,7 +494,7 @@ API_CALLABLE(N(Riding)) {
return ApiStatus_BLOCK;
}
void func_802BE014_31DB84(void) {
void N(update_player_carry_anim)(void) {
PlayerStatus* playerStatus = &gPlayerStatus;
f32 currentSpeed = playerStatus->currentSpeed;
AnimID anim;
@ -493,14 +502,14 @@ void func_802BE014_31DB84(void) {
if (playerStatus->runSpeed <= currentSpeed) {
anim = ANIM_MarioW1_CarryRun;
} else if (playerStatus->walkSpeed <= currentSpeed) {
anim = ANIM_MarioW1_Carry;
anim = ANIM_MarioW1_CarryWalk;
} else {
anim = ANIM_MarioW1_PlaceRecord;
anim = ANIM_MarioW1_CarryIdle;
}
suggest_player_anim_allow_backward(anim);
}
void world_watt_sync_held_position(void) {
void N(sync_held_position)(void) {
Npc* partnerNPC;
Npc* new_var2;
Camera* camera = gCameras;
@ -509,7 +518,7 @@ void world_watt_sync_held_position(void) {
f32 spriteFacingAngle;
s32 angleOffset;
if (gPartnerActionStatus.partnerActionState != PARTNER_ACTION_NONE) {
if (gPartnerStatus.partnerActionState != PARTNER_ACTION_NONE) {
spriteFacingAngle = gPlayerStatusPtr->spriteFacingAngle;
if ((spriteFacingAngle < 90.0f) || (spriteFacingAngle > 270.0f)) {
if (!(gPlayerStatusPtr->trueAnimation & SPRITE_ID_BACK_FACING)) {
@ -545,8 +554,8 @@ void world_watt_sync_held_position(void) {
}
}
EvtScript EVS_WorldWatt_Riding = {
EVT_CALL(N(Riding))
EvtScript EVS_WorldWatt_EnterMap = {
EVT_CALL(N(EnterMap))
EVT_RETURN
EVT_END
};

View File

@ -8,10 +8,12 @@ void world_watt_init(Npc*);
void world_watt_pre_battle(Npc*);
void world_watt_post_battle(Npc*);
void world_watt_sync_held_position(void);
extern EvtScript EVS_WorldWatt_TakeOut;
extern EvtScript EVS_WorldWatt_Update;
extern EvtScript EVS_WorldWatt_UseAbility;
extern EvtScript EVS_WorldWatt_PutAway;
extern EvtScript EVS_WorldWatt_Riding;
extern EvtScript EVS_WorldWatt_EnterMap;
#endif

View File

@ -269,7 +269,7 @@ WorldPartner wPartners[] = {
.canPlayerPause = world_partner_can_player_pause_default,
.preBattle = world_watt_pre_battle,
.postBattle = world_watt_post_battle,
.whileRiding = &EVS_WorldWatt_Riding,
.onEnterMap = &EVS_WorldWatt_EnterMap,
},
[PARTNER_SUSHIE] {
.dmaStart = &world_partner_sushie_ROM_START,
@ -285,7 +285,7 @@ WorldPartner wPartners[] = {
.canPlayerPause = world_partner_can_player_pause_default,
.preBattle = world_sushie_pre_battle,
.postBattle = world_sushie_post_battle,
.whileRiding = &EVS_WorldSushie_Riding,
.onEnterMap = &EVS_WorldSushie_EnterMap,
},
[PARTNER_LAKILESTER] {
.dmaStart = &world_partner_lakilester_ROM_START,
@ -301,7 +301,7 @@ WorldPartner wPartners[] = {
.canPlayerPause = world_partner_can_player_pause_default,
.preBattle = world_lakilester_pre_battle,
.postBattle = world_lakilester_post_battle,
.whileRiding = &evs_worldlakilester_riding,
.onEnterMap = &EVS_WorldLakilester_EnterMap,
},
[PARTNER_BOW] {
.dmaStart = &world_partner_bow_ROM_START,
@ -530,7 +530,7 @@ s32 func_800EA4B0(s32 collisionID) {
}
s32 partner_is_idle(Npc* partner) {
return gPartnerActionStatus.partnerActionState == PARTNER_ACTION_NONE;
return gPartnerStatus.partnerActionState == PARTNER_ACTION_NONE;
}
s32 world_partner_can_player_pause_default(Npc* partner) {
@ -546,20 +546,25 @@ s32 func_800EA52C(s32 partnerID) {
return FALSE;
}
if (playerActionState == ACTION_STATE_IDLE || playerActionState == ACTION_STATE_WALK || playerActionState == ACTION_STATE_RUN) {
// any partner
if (playerActionState == ACTION_STATE_IDLE
|| playerActionState == ACTION_STATE_WALK
|| playerActionState == ACTION_STATE_RUN
) {
ret = TRUE;
}
// check specific partners
if (partnerID == PARTNER_BOW) {
if (playerActionState == ACTION_STATE_RIDE) {
ret = TRUE;
}
} else if (partnerID == PARTNER_PARAKARRY) {
if ((playerActionState != ACTION_STATE_RIDE) && (playerActionState != ACTION_STATE_IDLE) && (playerActionState != ACTION_STATE_WALK)) {
if (playerActionState == ACTION_STATE_RUN) {
ret = TRUE;
}
} else {
if (playerActionState == ACTION_STATE_RIDE
|| playerActionState == ACTION_STATE_IDLE
|| playerActionState == ACTION_STATE_WALK
|| playerActionState == ACTION_STATE_RUN
) {
ret = TRUE;
}
}
@ -624,27 +629,27 @@ void _use_partner_ability(void) {
static u32 PartnerCommand; // goes into BSS, needs to be static for the function to match
PlayerData* playerData = &gPlayerData;
PartnerActionStatus* partnerActionStatus = &gPartnerActionStatus;
PartnerStatus* partnerStatus = &gPartnerStatus;
PlayerStatus* playerStatus = &gPlayerStatus;
if (!partnerActionStatus->inputDisabled) {
partnerActionStatus->stickX = gGameStatusPtr->stickX[gGameStatusPtr->multiplayerEnabled];
partnerActionStatus->stickY = gGameStatusPtr->stickY[gGameStatusPtr->multiplayerEnabled];
partnerActionStatus->currentButtons = gGameStatusPtr->currentButtons[gGameStatusPtr->multiplayerEnabled];
partnerActionStatus->pressedButtons = gGameStatusPtr->pressedButtons[gGameStatusPtr->multiplayerEnabled];
partnerActionStatus->heldButtons = gGameStatusPtr->heldButtons[gGameStatusPtr->multiplayerEnabled];
if (partnerStatus->inputDisabledCount == 0) {
partnerStatus->stickX = gGameStatusPtr->stickX[gGameStatusPtr->multiplayerEnabled];
partnerStatus->stickY = gGameStatusPtr->stickY[gGameStatusPtr->multiplayerEnabled];
partnerStatus->currentButtons = gGameStatusPtr->currentButtons[gGameStatusPtr->multiplayerEnabled];
partnerStatus->pressedButtons = gGameStatusPtr->pressedButtons[gGameStatusPtr->multiplayerEnabled];
partnerStatus->heldButtons = gGameStatusPtr->heldButtons[gGameStatusPtr->multiplayerEnabled];
} else {
partnerActionStatus->stickX = 0;
partnerActionStatus->stickY = 0;
partnerActionStatus->currentButtons = 0;
partnerActionStatus->pressedButtons = 0;
partnerActionStatus->heldButtons = 0;
partnerStatus->stickX = 0;
partnerStatus->stickY = 0;
partnerStatus->currentButtons = 0;
partnerStatus->pressedButtons = 0;
partnerStatus->heldButtons = 0;
}
if (playerStatus->animFlags & PA_FLAG_INTERRUPT_USE_PARTNER) {
playerStatus->animFlags &= ~PA_FLAG_INTERRUPT_USE_PARTNER;
partnerActionStatus->pressedButtons |= BUTTON_B | BUTTON_C_DOWN;
playerStatus->animFlags |= PA_FLAG_PARTNER_USAGE_STOPPED;
partnerStatus->pressedButtons |= BUTTON_B | BUTTON_C_DOWN;
playerStatus->animFlags |= PA_FLAG_FORCED_PARTNER_ABILITY_END;
}
if (NextPartnerCommand != PARTNER_CMD_NONE) {
@ -687,7 +692,7 @@ void _use_partner_ability(void) {
sfx_play_sound(SOUND_E);
wPartner->init(wPartnerNpc);
PartnerCommandState += 1;
// fall through
// fallthrough
case 2: // take out new partner
wPartnerCurrentScript = start_script(wPartner->takeOut, EVT_PRIORITY_14, EVT_FLAG_RUN_IMMEDIATELY);
wPartnerCurrentScript->owner2.npc = wPartnerNpc;
@ -729,7 +734,7 @@ void _use_partner_ability(void) {
wPartnerNpc->scale.z = 1.0f;
wPartner->init(wPartnerNpc);
PartnerCommandState += 1;
// fall through
// fallthrough
case 2:
PartnerCommandState += 1;
break;
@ -782,7 +787,7 @@ void _use_partner_ability(void) {
create_partner_npc();
wPartner->init(wPartnerNpc);
PartnerCommandState += 1;
// fall through
// fallthrough
case 1: // take out new partner
wPartnerCurrentScript = start_script(wPartner->takeOut, EVT_PRIORITY_14, EVT_FLAG_RUN_IMMEDIATELY);
wPartnerCurrentScript->owner2.npc = wPartnerNpc;
@ -860,12 +865,12 @@ void _use_partner_ability(void) {
disable_player_input();
wPartner->init(wPartnerNpc);
PartnerCommandState += 1;
// fall through
// fallthrough
case 1:
PartnerCommandState += 1;
break;
case 2:
if (partnerActionStatus->partnerActionState != 1) {
if (partnerStatus->partnerActionState != 1) {
wSavedPartnerPosX = playerStatus->position.x;
wSavedPartnerPosY = playerStatus->position.y;
wSavedPartnerPosZ = playerStatus->position.z;
@ -919,13 +924,13 @@ void switch_to_partner(s32 partnerID) {
void partner_init_after_battle(s32 partnerID) {
PlayerStatus* playerStatus = &gPlayerStatus;
PartnerActionStatus* actionStatus = &gPartnerActionStatus;
PartnerStatus* partnerStatus = &gPartnerStatus;
if (wCurrentPartnerId != partnerID) {
D_8010CFE0 = 1;
NextPartnerID = partnerID;
actionStatus->partnerActionState = 0;
actionStatus->partnerAction_unk_1 = FALSE;
partnerStatus->partnerActionState = 0;
partnerStatus->shouldResumeAbility = FALSE;
if (wCurrentPartnerId != PARTNER_NONE && partnerID != PARTNER_NONE) {
NextPartnerCommand = PARTNER_CMD_INSTA_SWITCH;
@ -956,13 +961,13 @@ void func_800EB2A4(s32 partnerID) {
}
s32 partner_use_ability(void) {
PartnerActionStatus* actionStatus = &gPartnerActionStatus;
PartnerStatus* partnerStatus = &gPartnerStatus;
if (!is_starting_conversation() &&
wPartner != NULL &&
(wPartner->canUseAbility == NULL || wPartner->canUseAbility(wPartnerNpc)))
if (!is_starting_conversation()
&& wPartner != NULL
&& (wPartner->canUseAbility == NULL || wPartner->canUseAbility(wPartnerNpc)))
{
if (gGameStatusPtr->multiplayerEnabled && (actionStatus->currentButtons & BUTTON_B)) {
if (gGameStatusPtr->multiplayerEnabled && (partnerStatus->currentButtons & BUTTON_B)) {
sfx_play_sound(SOUND_MENU_ERROR);
} else if (wCurrentPartnerId != PARTNER_NONE) {
D_8010CFE0 = 1;
@ -975,7 +980,10 @@ s32 partner_use_ability(void) {
}
s32 partner_player_can_pause(void) {
if (wPartner != NULL && wPartner->canPlayerPause != NULL && !wPartner->canPlayerPause(wPartnerNpc)) {
if (wPartner != NULL
&& wPartner->canPlayerPause != NULL
&& !wPartner->canPlayerPause(wPartnerNpc)
) {
return FALSE;
}
return TRUE;
@ -992,16 +1000,16 @@ void partner_reset_data(void) {
PlayerStatus* playerStatus = &gPlayerStatus;
s32 currentPartner = gPlayerData.currentPartner;
mem_clear(&gPartnerActionStatus, sizeof(gPartnerActionStatus));
mem_clear(&gPartnerStatus, sizeof(gPartnerStatus));
get_worker(create_worker_frontUI(_use_partner_ability, NULL));
D_8010CFE0 = 1;
NextPartnerCommand = PARTNER_CMD_RESET;
wCurrentPartnerId = currentPartner;
if (gGameStatusPtr->keepUsingPartnerOnMapChange != 0) {
gPartnerActionStatus.partnerActionState = 1;
gGameStatusPtr->keepUsingPartnerOnMapChange = 0;
if (gGameStatusPtr->keepUsingPartnerOnMapChange) {
gPartnerStatus.partnerActionState = 1;
gGameStatusPtr->keepUsingPartnerOnMapChange = FALSE;
}
wPartner = NULL;
@ -1021,18 +1029,18 @@ void partner_reset_data(void) {
}
void partner_initialize_data(void) {
PartnerActionStatus* actionStatus = &gPartnerActionStatus;
PartnerStatus* partnerStatus = &gPartnerStatus;
wCurrentPartnerId = 0;
D_8010CFE0 = 0;
NextPartnerCommand = PARTNER_CMD_NONE;
D_8010CFC4 = 0;
actionStatus->actingPartner = 0;
actionStatus->inputDisabled = 0;
actionStatus->partnerAction_unk_1 = FALSE;
actionStatus->partnerActionState = 0;
actionStatus->unk_358 = 0;
actionStatus->partnerAction_unk_2 = 0;
partnerStatus->actingPartner = 0;
partnerStatus->inputDisabledCount = 0;
partnerStatus->shouldResumeAbility = FALSE;
partnerStatus->partnerActionState = 0;
partnerStatus->unk_358 = 0;
partnerStatus->partnerAction_unk_2 = FALSE;
wPartner = NULL;
wSavedPartnerPosX = 0;
wSavedPartnerPosY = 0;
@ -1046,13 +1054,13 @@ s32 partner_test_enemy_collision(Npc* enemy) {
return FALSE;
}
EvtScript* partner_get_ride_script(void) {
EvtScript* partner_get_enter_map_script(void) {
WorldPartner* partner = wPartner;
if (partner == NULL) {
return NULL;
}
return partner->whileRiding;
return partner->onEnterMap;
}
void partner_handle_before_battle(void) {
@ -1070,7 +1078,7 @@ void partner_handle_before_battle(void) {
}
void partner_handle_after_battle(void) {
PartnerActionStatus* actionStatus = &gPartnerActionStatus;
PartnerStatus* partnerStatus = &gPartnerStatus;
PlayerData* playerData = &gPlayerData;
if (wCurrentPartnerId != PARTNER_NONE) {
@ -1085,10 +1093,10 @@ void partner_handle_after_battle(void) {
NextPartnerCommand = PARTNER_CMD_INIT;
if (playerData->currentPartner != PARTNER_WATT && actionStatus->actingPartner == PARTNER_WATT) {
if (playerData->currentPartner != PARTNER_WATT && partnerStatus->actingPartner == PARTNER_WATT) {
gPlayerStatusPtr->animFlags &= ~PA_FLAG_USING_WATT;
gPlayerStatusPtr->animFlags &= ~PA_FLAG_WATT_IN_HANDS;
actionStatus->actingPartner = PARTNER_NONE;
partnerStatus->actingPartner = PARTNER_NONE;
}
if (wPartner->postBattle != NULL) {
@ -1192,15 +1200,15 @@ void partner_walking_update_player_tracking(Npc* partner) {
void partner_walking_update_motion(Npc* partner) {
PlayerStatus* playerStatus = &gPlayerStatus;
PartnerActionStatus* actionStatus = &gPartnerActionStatus;
PartnerStatus* partnerStatus = &gPartnerStatus;
if (gGameStatusPtr->multiplayerEnabled == 0 || playerStatus->flags & (PS_FLAG_INPUT_DISABLED | PS_FLAG_NO_STATIC_COLLISION)
|| actionStatus->inputDisabled != 0 || actionStatus->partnerAction_unk_2 != 0) {
|| partnerStatus->inputDisabledCount != 0 || partnerStatus->partnerAction_unk_2) {
if (!(playerStatus->animFlags & PA_FLAG_OPENED_HIDDEN_PANEL)) {
partner_walking_follow_player(partner);
}
if (actionStatus->pressedButtons & (BUTTON_Z | BUTTON_B | BUTTON_C_LEFT | BUTTON_C_DOWN)) {
actionStatus->partnerAction_unk_2 = 0;
if (partnerStatus->pressedButtons & (BUTTON_Z | BUTTON_B | BUTTON_C_LEFT | BUTTON_C_DOWN)) {
partnerStatus->partnerAction_unk_2 = FALSE;
}
}
@ -1594,7 +1602,7 @@ void partner_walking_follow_player(Npc* partner) {
yaw = atan2(partner->pos.x, partner->pos.z, partner->moveToPos.x, partner->moveToPos.z);
partner->yaw = D_800F8034 = yaw;
D_8010CFCE++;
/* fallthrough */
// fallthrough
case 1:
if (wPartnerMoveTime != 0) {
wPartnerMoveTime--;
@ -1766,21 +1774,21 @@ void partner_flying_update_player_tracking(Npc* partner) {
void partner_flying_update_motion(Npc* partner) {
PlayerStatus* playerStatus = &gPlayerStatus;
PartnerActionStatus* partnerActionStatus = &gPartnerActionStatus;
PartnerStatus* partnerStatus = &gPartnerStatus;
f32 x, y, z, hitDepth;
f32 var_f0;
f32 var_f2;
if (gGameStatusPtr->multiplayerEnabled == 0 ||
(playerStatus->flags & (PS_FLAG_INPUT_DISABLED | PS_FLAG_NO_STATIC_COLLISION)) ||
partnerActionStatus->inputDisabled ||
partnerActionStatus->partnerAction_unk_2 != 0)
partnerStatus->inputDisabledCount ||
partnerStatus->partnerAction_unk_2)
{
if (!(playerStatus->animFlags & PA_FLAG_OPENED_HIDDEN_PANEL) || D_800F8020 == 0) {
partner_flying_follow_player(partner);
}
if (partnerActionStatus->pressedButtons & (BUTTON_B | BUTTON_Z | BUTTON_C_DOWN | BUTTON_C_LEFT)) {
partnerActionStatus->partnerAction_unk_2 = 0;
if (partnerStatus->pressedButtons & (BUTTON_B | BUTTON_Z | BUTTON_C_DOWN | BUTTON_C_LEFT)) {
partnerStatus->partnerAction_unk_2 = FALSE;
}
}
if (wPartnerFollowState != 50 && fabsf(partner->pos.y - playerStatus->position.y) > 1000.0f) {
@ -2115,7 +2123,7 @@ void partner_flying_follow_player(Npc* partner) {
yaw = atan2(partner->pos.x, partner->pos.z, partner->moveToPos.x, partner->moveToPos.z);
partner->yaw = D_800F8034 = yaw;
D_8010CFCE++;
/* fallthrough */
// fallthrough
case 1:
if (wPartnerMoveTime != 0) {
x = partner->pos.x;
@ -2135,7 +2143,7 @@ void partner_flying_follow_player(Npc* partner) {
x = partner->pos.x;
y = partner->pos.y;
z = partner->pos.z;
if (npc_test_move_taller_with_slipping(0, &x, &y, &z, partner->moveSpeed, partner->yaw, partner->collisionHeight, partner->collisionRadius) != 0) {
if (npc_test_move_taller_with_slipping(0, &x, &y, &z, partner->moveSpeed, partner->yaw, partner->collisionHeight, partner->collisionRadius)) {
partner->pos.x += (x - partner->pos.x) / 5.0f;
partner->pos.z += (z - partner->pos.z) / 5.0f;
} else {
@ -2470,18 +2478,18 @@ s32 partner_force_player_flip_done(void) {
}
void partner_enable_input(void) {
PartnerActionStatus* actionStatus = &gPartnerActionStatus;
PartnerStatus* partnerStatus = &gPartnerStatus;
actionStatus->inputDisabled--;
if (actionStatus->inputDisabled < 0) {
actionStatus->inputDisabled = 0;
partnerStatus->inputDisabledCount--;
if (partnerStatus->inputDisabledCount < 0) {
partnerStatus->inputDisabledCount = 0;
}
}
void partner_disable_input(void) {
PartnerActionStatus* actionStatus = &gPartnerActionStatus;
PartnerStatus* partnerStatus = &gPartnerStatus;
actionStatus->inputDisabled++;
partnerStatus->inputDisabledCount++;
}
void partner_do_player_collision(Npc* partner) {

View File

@ -21,7 +21,7 @@ typedef struct WorldPartner {
/* 0x30 */ PartnerBoolFunc canPlayerPause;
/* 0x34 */ PartnerFunc preBattle;
/* 0x38 */ PartnerFunc postBattle;
/* 0x3C */ EvtScript* whileRiding;
/* 0x3C */ EvtScript* onEnterMap;
} WorldPartner; // size = 0x40
extern Npc* wPartnerNpc; // wPartnerNpc

View File

@ -4,16 +4,16 @@
extern s32 DoorModelsSwingCCW[3];
extern s32 DoorModelsSwingCW[3];
API_CALLABLE(CheckRideScriptForEnterExit) {
API_CALLABLE(CheckUsingRideablePartner) {
PlayerStatus* playerStatus = &gPlayerStatus;
script->varTable[10] = 0;
if (partner_get_ride_script() != NULL) {
if (gPartnerActionStatus.partnerActionState == ACTION_STATE_IDLE) {
if (partner_get_enter_map_script() != NULL) {
if (gPartnerStatus.partnerActionState == ACTION_STATE_IDLE) {
script->varTable[10] = 0;
} else {
script->varTable[10] = 1;
script->varTablePtr[11] = partner_get_ride_script();
script->varTablePtr[11] = partner_get_enter_map_script();
script->varTable[13] = playerStatus->targetYaw;
}
}
@ -199,7 +199,7 @@ API_CALLABLE(SetupSplitDoubleDoors) {
EvtScript EnterWalk = {
EVT_CALL(ShortenPartnerTetherDistance)
EVT_CALL(CheckRideScriptForEnterExit)
EVT_CALL(CheckUsingRideablePartner)
EVT_CALL(UseEntryHeading, 60, 15)
EVT_IF_EQ(LVarA, 0)
EVT_CALL(TeleportPartnerToPlayer)
@ -221,7 +221,7 @@ EvtScript EnterWalk = {
EvtScript EnterWalkShort = {
EVT_CALL(ShortenPartnerTetherDistance)
EVT_CALL(CheckRideScriptForEnterExit)
EVT_CALL(CheckUsingRideablePartner)
EVT_CALL(UseEntryHeading, 40, 15)
EVT_IF_EQ(LVarA, 0)
EVT_CALL(TeleportPartnerToPlayer)
@ -243,7 +243,7 @@ EvtScript EnterWalkShort = {
EvtScript EnterWalkCustom = {
EVT_CALL(ShortenPartnerTetherDistance)
EVT_CALL(CheckRideScriptForEnterExit)
EVT_CALL(CheckUsingRideablePartner)
EVT_CALL(UseEntryHeading, LVar1, LVar4)
EVT_IF_EQ(LVarA, 0)
EVT_CALL(TeleportPartnerToPlayer)
@ -265,7 +265,7 @@ EvtScript EnterWalkCustom = {
EvtScript EnterPostPipe = {
EVT_CALL(DisablePlayerPhysics, TRUE)
EVT_CALL(ShortenPartnerTetherDistance)
EVT_CALL(CheckRideScriptForEnterExit)
EVT_CALL(CheckUsingRideablePartner)
EVT_CALL(EnterPlayerPostPipe)
EVT_CALL(ResetPartnerTetherDistance)
EVT_CALL(DisablePlayerPhysics, FALSE)
@ -285,7 +285,7 @@ EvtScript EnterSavePoint = {
EvtScript ExitWalk = {
EVT_CALL(DisablePlayerInput, TRUE)
EVT_CALL(ShortenPartnerTetherDistance)
EVT_CALL(CheckRideScriptForEnterExit)
EVT_CALL(CheckUsingRideablePartner)
EVT_IF_EQ(LVarA, 0)
EVT_CALL(PlayerMoveTo, LVar1, LVar3, 15)
EVT_ELSE
@ -364,7 +364,7 @@ EvtScript BaseExitDoor = {
EVT_ADD(LVarB, 180)
EVT_CALL(InterpPlayerYaw, LVarB, 2)
EVT_CALL(ModifyColliderFlags, 0, LVar1, COLLIDER_FLAGS_UPPER_MASK)
EVT_CALL(PlaySoundAt, 0x90000000, 0, LVarC, LVarD, LVarE)
EVT_CALL(PlaySoundAt, SOUND_DOOR_OPEN, 0, LVarC, LVarD, LVarE)
EVT_CALL(MakeLerp, 0, 80, 10, EASING_LINEAR)
EVT_LABEL(0)
EVT_CALL(UpdateLerp)
@ -389,7 +389,7 @@ EvtScript BaseExitDoor = {
EVT_GOTO(0)
EVT_END_IF
EVT_CALL(UseExitHeading, 40, LVar9)
EVT_CALL(CheckRideScriptForEnterExit)
EVT_CALL(CheckUsingRideablePartner)
EVT_IF_EQ(LVarA, 0)
EVT_CALL(PlayerMoveTo, LVar1, LVar3, 15)
EVT_ELSE
@ -426,7 +426,7 @@ EvtScript BaseEnterDoor = {
EVT_END_LOOP
EVT_CALL(GetEntryCoords, LVar0, LVar7, LVar8, LVar9, LVarB)
EVT_CALL(InterpPlayerYaw, LVarB, 2)
EVT_CALL(CheckRideScriptForEnterExit)
EVT_CALL(CheckUsingRideablePartner)
EVT_IF_EQ(LVarA, 0)
EVT_CALL(TeleportPartnerToPlayer)
EVT_CALL(PlayerMoveToDoor, 10)
@ -438,7 +438,7 @@ EvtScript BaseEnterDoor = {
EVT_END_IF
EVT_THREAD
EVT_WAIT(8)
EVT_CALL(PlaySoundAt, 0x90000001, 0, LVar7, LVar8, LVar9)
EVT_CALL(PlaySoundAt, SOUND_DOOR_CLOSE, 0, LVar7, LVar8, LVar9)
EVT_END_THREAD
EVT_CALL(MakeLerp, -80, 0, 10, EASING_LINEAR)
EVT_LABEL(0)

View File

@ -11,8 +11,8 @@ glabel test_item_player_collision
/* C918C 801322AC 3C118011 */ lui $s1, %hi(gPlayerStatus)
/* C9190 801322B0 2631D3A8 */ addiu $s1, $s1, %lo(gPlayerStatus)
/* C9194 801322B4 AFB40038 */ sw $s4, 0x38($sp)
/* C9198 801322B8 3C148011 */ lui $s4, %hi(gPartnerActionStatus)
/* C919C 801322BC 2694CF90 */ addiu $s4, $s4, %lo(gPartnerActionStatus)
/* C9198 801322B8 3C148011 */ lui $s4, %hi(gPartnerStatus)
/* C919C 801322BC 2694CF90 */ addiu $s4, $s4, %lo(gPartnerStatus)
/* C91A0 801322C0 3C038007 */ lui $v1, %hi(gCurrentCameraID)
/* C91A4 801322C4 8C636070 */ lw $v1, %lo(gCurrentCameraID)($v1)
/* C91A8 801322C8 3C04800B */ lui $a0, %hi(gCameras)

View File

@ -63,7 +63,7 @@ D_800A08E8 = 0x8009d2f8;
D_800A08EC = 0x8009d2fc;
gNpcPlayerCollisionsEnabled = 0x8009d5a4;
wPartnerNpc = 0x8010ad10;
gPartnerActionStatus = 0x8010cf90;
gPartnerStatus = 0x8010cf90;
gPlayerStatus = 0x8010d3a8;
get_clamped_angle_diff = 0x800298f8;
get_npc_by_index = 0x8003818c;

View File

@ -794,7 +794,7 @@ HES_MoveDiamondDisabled = 0x801077b8;
HES_MoveDiamond = 0x80107718;
npc_test_move_simple_with_slipping = 0x800dc024;
SetNpcPos = 0x802cdcb0;
gPartnerActionStatus = 0x8010cf90;
gPartnerStatus = 0x8010cf90;
SetNpcAnimation = 0x802ce0f4;
GetNpcPos = 0x802cf0f4;
partner_reset_data = 0x800e9854;
@ -901,7 +901,7 @@ D_800A08E8 = 0x8009d2f8;
D_800A08EC = 0x8009d2fc;
gNpcPlayerCollisionsEnabled = 0x8009d5a4;
wPartnerNpc = 0x8010ad10;
gPartnerActionStatus = 0x8010cf90;
gPartnerStatus = 0x8010cf90;
gPlayerStatus = 0x8010d3a8;
D_801A6000 = 0x801a6000;

Some files were not shown because too many files have changed in this diff Show More