needed more DEG_TO_RAD (#773)

* sneaky

* first batch

* DEG_TO_RAD

* some mac_04 funcs

* parasol done

* unk playerstatus fields

* sprite learnin

* new sprite stuff

* yay

* fix a warning

Co-authored-by: HailSanta <Hail2Santa@gmail.com>
This commit is contained in:
HailSanta 2022-09-15 15:39:16 -04:00 committed by GitHub
parent 5592b4dae2
commit 9ef69b66cf
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
104 changed files with 1105 additions and 1279 deletions

View File

@ -190,7 +190,7 @@ typedef struct Npc {
} blur;
/* 0x024 */ s32 spriteInstanceID;
/* 0x028 */ AnimID currentAnim;
/* 0x02C */ s32 unk_2C;
/* 0x02C */ s32 animNotifyValue;
/* 0x030 */ f32 animationSpeed;
/* 0x034 */ f32 renderYaw;
/* 0x038 */ Vec3f pos;
@ -1534,7 +1534,7 @@ typedef struct ActorPart {
/* 0x80 */ s32 partFlags3;
/* 0x84 */ s32 unk_84;
/* 0x88 */ u32 currentAnimation;
/* 0x8C */ s32 unk_8C;
/* 0x8C */ s32 animNotifyValue;
/* 0x90 */ f32 animationRate;
/* 0x94 */ u32* idleAnimations;
/* 0x98 */ s16 opacity;
@ -1897,10 +1897,10 @@ typedef struct PlayerStatus {
/* 0x000 */ s32 flags; // PlayerStatusFlags
/* 0x004 */ u32 animFlags;
/* 0x008 */ s16 currentStateTime;
/* 0x00A */ s8 unk_0A;
/* 0x00A */ s8 shiverTime;
/* 0x00B */ char unk_0B;
/* 0x00C */ s8 peachDisguise;
/* 0x00D */ s8 unk_0D;
/* 0x00D */ s8 availableDisguiseType; ///< set in main map scripts
/* 0x00E */ u8 alpha1;
/* 0x00F */ u8 alpha2;
/* 0x010 */ s16 blinkTimer;
@ -1939,13 +1939,13 @@ typedef struct PlayerStatus {
/* 0x0B6 */ s8 actionSubstate;
/* 0x0B7 */ char unk_B7;
/* 0x0B8 */ AnimID anim;
/* 0x0BC */ u16 unk_BC;
/* 0x0BC */ u16 animNotifyValue;
/* 0x0BE */ s8 renderMode;
/* 0x0BF */ s8 hazardType;
/* 0x0C0 */ s16 timeInAir;
/* 0x0C2 */ s16 unk_C2;
/* 0x0C4 */ s8 peachItemHeld;
/* 0x0C5 */ s8 unk_C5;
/* 0x0C5 */ s8 camResetDelay;
/* 0x0C6 */ s16 interactingWithID;
/* 0x0C8 */ Npc* encounteredNPC;
/* 0x0CC */ s32 shadowID;

View File

@ -2700,6 +2700,7 @@ enum PeachStatusFlags {
PEACH_STATUS_FLAG_IS_PEACH = 0x01,
PEACH_STATUS_FLAG_DISGUISED = 0x02,
PEACH_STATUS_FLAG_HAS_PARASOL = 0x04,
PEACH_STATUS_FLAG_8 = 0x08,
PEACH_STATUS_FLAG_HAS_INGREDIENT = 0x10
};

View File

@ -201,7 +201,7 @@ s32 collision_main_above(void);
void collision_lava_reset_check_additional_overlaps(void);
s32 player_test_lateral_overlap(s32, PlayerStatus*, f32*, f32*, f32*, f32, f32);
Npc* peach_make_disguise_npc(s32 peachDisguise);
void peach_set_disguise_anim(s32);
void peach_set_disguise_anim(AnimID);
s32 draw_box(s32 flags, WindowStyle windowStyle, s32 posX, s32 posY, s32 posZ, s32 width, s32 height, u8 opacity,
u8 darkening, f32 scaleX, f32 scaleY, f32 rotX, f32 rotY, f32 rotZ, void (*fpDrawContents)(void*),
@ -732,7 +732,6 @@ void func_802B2000(void);
void func_802B203C(void);
void func_802B2078(void);
void func_802B20B4(void);
void func_802B6CF0_E2B3A0(void);
void func_802B7000_E225B0(void);
void func_802B70B4_E201C4(void);
void func_802B7140(void);

View File

@ -20,6 +20,8 @@
#define ARRAY_COUNT(arr) (s32)(sizeof(arr) / sizeof(arr[0]))
#define PTR_LIST_END ((void*) -1)
#define PHYSICAL_TO_VIRTUAL(addr) (void*)((u32)(addr) + 0x80000000)
#define VIRTUAL_TO_PHYSICAL(addr) (u32)((u8*)(addr) - 0x80000000)
@ -79,6 +81,7 @@
// Angle conversion macros
#define DEG_TO_BINANG(x) ((x) * (0x8000 / 180.0f))
#define RAD_TO_BINANG(x) ((x) * (f32)(0x8000 / M_PI))
#define DEG_TO_RAD(deg) (((deg) * TAU) / 360.0f)
// Should be 1.0f / 0x7FFF, but precision is wrong for a double
#define SHT_MINV 3.051851e-05

View File

@ -193,7 +193,7 @@ extern Entity* TweesterTouchingPartner;
extern Entity* TweesterTouchingPlayer;
extern UNK_FUN_PTR(D_8010C958);
extern s32 PrevPlayerDirection;
extern s32 D_8010C96C;
extern s32 PeachDisguiseNpcIndex;
extern s32 D_8010C980;
extern s32 D_8010C9A0;
extern s32 PrevPlayerCamRelativeYaw;

View File

@ -64,7 +64,7 @@ SpriteAnimData* spr_load_sprite(s32 idx, s32 arg1, s32 arg2) {
var_s2 = animData->rastersOffset + temp_v0_2;
animData->rastersOffset = var_s2;
while (*var_s2 != (s32* )-1) {
while (*var_s2 != PTR_LIST_END) {
temp_a1_3 = *var_s2 + temp_v0_2;
*var_s2 = temp_a1_3;
var_s2++;
@ -197,7 +197,7 @@ void** spr_allocate_components(s32 arg0) {
new_var++;
var_a0_2 += 0x50;
}
*new_var = (void* )-1;
*new_var = PTR_LIST_END;
return heap;
}
#else

View File

@ -1397,9 +1397,9 @@ block_52:
player->currentPos.x += (partner->state.currentPos.x - player->currentPos.x) / partner->state.moveTime;
player->currentPos.z += (partner->state.currentPos.z - player->currentPos.z) / partner->state.moveTime;
}
partner->currentPos.z -= sin_rad((partner->state.angle * TAU) / 360.0f) * 16.0f;
partner->currentPos.z -= sin_rad(DEG_TO_RAD(partner->state.angle)) * 16.0f;
partner->yaw = clamp_angle(partner->state.angle);
player->currentPos.z += sin_rad((partner->state.angle * TAU) / 360.0f) * 16.0f;
player->currentPos.z += sin_rad(DEG_TO_RAD(partner->state.angle)) * 16.0f;
player->yaw = clamp_angle(partner->state.angle);
partner->state.angle += 90.0f;
@ -1592,9 +1592,9 @@ void btl_state_update_end_turn(void) {
player->currentPos.x += (partner->state.currentPos.x - player->currentPos.x) / partner->state.moveTime;
player->currentPos.z += (partner->state.currentPos.z - player->currentPos.z) / partner->state.moveTime;
}
partner->currentPos.z -= sin_rad((partner->state.angle * TAU) / 360.0f) * 16.0f;
partner->currentPos.z -= sin_rad(DEG_TO_RAD(partner->state.angle)) * 16.0f;
partner->yaw = clamp_angle(partner->state.angle);
player->currentPos.z += sin_rad((partner->state.angle * TAU) / 360.0f) * 16.0f;
player->currentPos.z += sin_rad(DEG_TO_RAD(partner->state.angle)) * 16.0f;
player->yaw = clamp_angle(partner->state.angle);
partner->state.angle += 90.0f;
if (partner->state.moveTime != 0) {
@ -1813,9 +1813,9 @@ void btl_state_update_victory(void) {
player->currentPos.z += (partner->state.currentPos.z - player->currentPos.z)
/ partner->state.moveTime;
}
partner->currentPos.z += sin_rad((partner->state.angle * TAU) / 360.0f) * 16.0f;
partner->currentPos.z += sin_rad(DEG_TO_RAD(partner->state.angle)) * 16.0f;
partner->yaw = clamp_angle(-partner->state.angle);
player->currentPos.z -= sin_rad((partner->state.angle * TAU) / 360.0f) * 16.0f;
player->currentPos.z -= sin_rad(DEG_TO_RAD(partner->state.angle)) * 16.0f;
player->yaw = clamp_angle(-partner->state.angle);
partner->state.angle += 90.0f;
@ -2983,9 +2983,9 @@ void btl_state_update_end_player_turn(void) {
partner->currentPos.x += (player->state.currentPos.x - partner->currentPos.x) / player->state.moveTime;
partner->currentPos.z += (player->state.currentPos.z - partner->currentPos.z) / player->state.moveTime;
}
player->currentPos.z += sin_rad((player->state.angle * TAU) / 360.0f) * 16.0f;
player->currentPos.z += sin_rad(DEG_TO_RAD(player->state.angle)) * 16.0f;
player->yaw = clamp_angle(-player->state.angle);
partner->currentPos.z -= sin_rad((player->state.angle * TAU) / 360.0f) * 16.0f;
partner->currentPos.z -= sin_rad(DEG_TO_RAD(player->state.angle)) * 16.0f;
partner->yaw = clamp_angle(-player->state.angle);
player->state.angle += 90.0f;

View File

@ -608,7 +608,7 @@ void update_actor_shadow(s32 arg0, Actor* actor) {
spriteID = actorPart->unk_84;
if (spriteID >= 0) {
spr_update_sprite(spriteID, actorPart->currentAnimation, actorPart->animationRate);
actorPart->unk_8C = func_802DE5C8(actorPart->unk_84);
actorPart->animNotifyValue = spr_get_notify_value(actorPart->unk_84);
}
if (!(actorPart->flags & ACTOR_PART_FLAG_USE_ABSOLUTE_POSITION)) {
@ -1057,7 +1057,7 @@ void appendGfx_npc_actor(s32 isPartner, s32 actorIndex) {
if (part->unk_84 >= 0) {
if (lastAnim != part->currentAnimation) {
spr_update_sprite(part->unk_84, part->currentAnimation, part->animationRate);
part->unk_8C = func_802DE5C8(part->unk_84);
part->animNotifyValue = spr_get_notify_value(part->unk_84);
}
}
if (!(actor->flags & ACTOR_FLAG_HP_OFFSET_BELOW)) {
@ -1293,7 +1293,7 @@ void update_player_actor_shadow(void) {
Shadow* shadow;
f32 x, y, z, distance;
parts->unk_8C = spr_update_player_sprite(0, parts->currentAnimation, parts->animationRate);
parts->animNotifyValue = spr_update_player_sprite(0, parts->currentAnimation, parts->animationRate);
if (player->flags & ACTOR_FLAG_BLUR_ENABLED) {
func_802549F4(player);
@ -3675,7 +3675,7 @@ void func_8025D90C(ActorPart* part, s32 decorationIndex) {
decor->stateResetTimer[decorationIndex]++;
if (decor->stateResetTimer[decorationIndex] >= 4) {
decor->stateResetTimer[decorationIndex] = 0;
angle = (clamp_angle(-part->yaw) * TAU) / 360.0f;
angle = DEG_TO_RAD(clamp_angle(-part->yaw));
sinA = sin_rad(angle);
cosA = cos_rad(angle);
fx_walking_dust(0,

View File

@ -338,7 +338,7 @@ ApiStatus BattleMerleeUpdateFX(Evt* script, s32 isInitialCall) {
D_8029FB90 = 12;
sfx_play_sound(SOUND_2074);
}
merlee->pos.y = D_8029FB94 + (sin_rad((script->functionTemp[1] * TAU) / 360.0f) * 3.0f);
merlee->pos.y = D_8029FB94 + (sin_rad(DEG_TO_RAD(script->functionTemp[1])) * 3.0f);
script->functionTemp[1] += 10;
script->functionTemp[1] = clamp_angle(script->functionTemp[1]);

View File

@ -605,7 +605,7 @@ void set_animation(s32 actorID, s32 partIdx, s32 animationIndex) {
if (part->currentAnimation != animationIndex) {
part->currentAnimation = animationIndex;
spr_update_sprite(part->unk_84, animationIndex, part->animationRate);
part->unk_8C = func_802DE5C8(part->unk_84);
part->animNotifyValue = spr_get_notify_value(part->unk_84);
}
break;
case ACTOR_CLASS_ENEMY:
@ -613,7 +613,7 @@ void set_animation(s32 actorID, s32 partIdx, s32 animationIndex) {
if (part->currentAnimation != animationIndex) {
part->currentAnimation = animationIndex;
spr_update_sprite(part->unk_84, animationIndex, part->animationRate);
part->unk_8C = func_802DE5C8(part->unk_84);
part->animNotifyValue = spr_get_notify_value(part->unk_84);
}
break;
}
@ -634,7 +634,7 @@ void func_80263E08(Actor* actor, ActorPart* part, s32 anim) {
if (part->currentAnimation != anim) {
part->currentAnimation = anim;
spr_update_sprite(part->unk_84, anim, part->animationRate);
part->unk_8C = func_802DE5C8(part->unk_84);
part->animNotifyValue = spr_get_notify_value(part->unk_84);
}
break;
}
@ -713,7 +713,7 @@ void clear_part_flag_bits(s32 actorID, s32 partIndex, s32 flags) {
}
void add_xz_vec3f(Vec3f* vector, f32 speed, f32 angleDeg) {
f32 angleRad = angleDeg * TAU / 360.0f;
f32 angleRad = DEG_TO_RAD(angleDeg);
f32 sinAngleRad = sin_rad(angleRad);
f32 cosAngleRad = cos_rad(angleRad);
@ -722,7 +722,7 @@ void add_xz_vec3f(Vec3f* vector, f32 speed, f32 angleDeg) {
}
void add_xz_vec3f_copy1(Vec3f* vector, f32 speed, f32 angleDeg) {
f32 angleRad = angleDeg * TAU / 360.0f;
f32 angleRad = DEG_TO_RAD(angleDeg);
f32 sinAngleRad = sin_rad(angleRad);
f32 cosAngleRad = cos_rad(angleRad);
@ -731,7 +731,7 @@ void add_xz_vec3f_copy1(Vec3f* vector, f32 speed, f32 angleDeg) {
}
void add_xz_vec3f_copy2(Vec3f* vector, f32 speed, f32 angleDeg) {
f32 angleRad = angleDeg * TAU / 360.0f;
f32 angleRad = DEG_TO_RAD(angleDeg);
f32 sinAngleRad = sin_rad(angleRad);
f32 cosAngleRad = cos_rad(angleRad);
@ -752,7 +752,7 @@ void play_movement_dust_effects(s32 var0, f32 xPos, f32 yPos, f32 zPos, f32 angl
D_802938A8 = 4;
} else if (D_802938A8++ >= 4) {
D_802938A8 = 0;
temp_f20 = (clamp_angle(-angleDeg) * TAU) / 360.0f;
temp_f20 = DEG_TO_RAD(clamp_angle(-angleDeg));
temp_f20_2 = sin_rad(temp_f20);
temp_f0 = cos_rad(temp_f20);
fx_walking_dust(0, xPos + (temp_f20_2 * 24.0f * 0.2f), yPos + 1.5f, zPos + (temp_f0 * 24.0f * 0.2f), temp_f20_2, temp_f0);

View File

@ -1142,7 +1142,7 @@ ApiStatus func_80273444(Evt* script, s32 isInitialCall) {
playerState->currentPos.y += playerVel;
playerState->velocity -= playerState->acceleration;
temp_f20_2 = playerState->speed;
add_xz_vec3f(&playerState->currentPos, temp_f20_2 + sin_rad((playerState->unk_24 * TAU) / 360.0f), playerState->angle);
add_xz_vec3f(&playerState->currentPos, temp_f20_2 + sin_rad(DEG_TO_RAD(playerState->unk_24), playerState->angle);
playerState->unk_24 += playerState->unk_28;
playerState->unk_24 = clamp_angle(playerState->unk_24);
player->currentPos.x = playerState->currentPos.x;

View File

@ -146,7 +146,7 @@ ApiStatus MerleeUpdateFX(Evt* script, s32 isInitialCall) {
sfx_play_sound(SOUND_2074);
}
merlee->pos.y = D_800A0BA4 + (sin_rad((script->functionTemp[1] * TAU) / 360.0f) * 3.0f);
merlee->pos.y = D_800A0BA4 + sin_rad(DEG_TO_RAD(script->functionTemp[1])) * 3.0f;
script->functionTemp[1] += 10;
script->functionTemp[1] = clamp_angle(script->functionTemp[1]);

View File

@ -2274,9 +2274,9 @@ void btl_state_update_peach_menu(void) {
partner->currentPos.z += (player->state.currentPos.z - partner->currentPos.z) / player->state.moveTime;
}
player->currentPos.z -= sin_rad(player->state.angle * TAU / 360.0f) * 16.0f;
player->currentPos.z -= sin_rad(DEG_TO_RAD(player->state.angle)) * 16.0f;
player->yaw = clamp_angle(-player->state.angle);
partner->currentPos.z += sin_rad(player->state.angle * TAU / 360.0f) * 16.0f;
partner->currentPos.z += sin_rad(DEG_TO_RAD(player->state.angle)) * 16.0f;
partner->yaw = clamp_angle(-player->state.angle);
player->state.angle += 90.0f;
@ -2483,9 +2483,9 @@ void btl_state_update_twink_menu(void) {
partner->currentPos.x += (player->state.currentPos.x - partner->currentPos.x) / player->state.moveTime;
partner->currentPos.z += (player->state.currentPos.z - partner->currentPos.z) / player->state.moveTime;
}
player->currentPos.z += sin_rad((player->state.angle * TAU) / 360.0f) * 16.0f;
player->currentPos.z += sin_rad(DEG_TO_RAD(player->state.angle)) * 16.0f;
player->yaw = clamp_angle(-player->state.angle);
partner->currentPos.z -= sin_rad((player->state.angle * TAU) / 360.0f) * 16.0f;
partner->currentPos.z -= sin_rad(DEG_TO_RAD(player->state.angle)) * 16.0f;
partner->yaw = clamp_angle(-player->state.angle);
player->state.angle += 90.0f;
if (player->state.moveTime != 0) {

View File

@ -672,7 +672,7 @@ void add_vec2D_polar(f32* x, f32* y, f32 r, f32 theta) {
f32 sinTheta;
f32 cosTheta;
sin_cos_rad((theta * TAU) / 360.0f, &sinTheta, &cosTheta);
sin_cos_rad(DEG_TO_RAD(theta), &sinTheta, &cosTheta);
*x += r * sinTheta;
*y -= r * cosTheta;
}

View File

@ -60,7 +60,7 @@ s32 player_raycast_below(f32 yaw, f32 diameter, f32* outX, f32* outY, f32* outZ,
*hitDirZ = 0.0f;
inputLength = *outLength;
temp_f20 = diameter * 0.28f;
sin_cos_rad(yaw * TAU / 360.0f, &sinTheta, &cosTheta);
sin_cos_rad(DEG_TO_RAD(yaw), &sinTheta, &cosTheta);
sinTemp = temp_f20 * sinTheta;
cosTemp = -temp_f20 * cosTheta;
inputX = *outX;
@ -238,7 +238,7 @@ s32 player_raycast_up_corners(PlayerStatus* player, f32* posX, f32* posY, f32* p
f32 radius;
radius = player->colliderDiameter * 0.3f;
theta = yaw * TAU / 360.0f;
theta = DEG_TO_RAD(yaw);
deltaX = radius * sin_rad(theta);
deltaZ = -radius * cos_rad(theta);
@ -373,7 +373,7 @@ s32 player_test_lateral_overlap(s32 mode, PlayerStatus* playerStatus, f32* x, f3
height = 1.0f;
}
sin_cos_rad(yaw * TAU / 360.0f, &sinTheta, &cosTheta);
sin_cos_rad(DEG_TO_RAD(yaw), &sinTheta, &cosTheta);
cosTheta = -cosTheta;
hitDepth = length + radius;
hitID = player_raycast_general(mode, *x, *y + height, *z, sinTheta, 0, cosTheta, &hitX, &hitY, &hitZ, &hitDepth, &hitNx, &hitNy, &hitNz);
@ -481,7 +481,7 @@ s32 player_test_move_without_slipping(PlayerStatus* playerStatus, f32* x, f32* y
radius = playerStatus->colliderDiameter * 0.5f;
height = playerStatus->colliderHeight * 0.286f;
sin_cos_rad(yaw * TAU / 360.0f, &sinTheta, &cosTheta);
sin_cos_rad(DEG_TO_RAD(yaw), &sinTheta, &cosTheta);
depth = length + radius;
cosTheta = -cosTheta;
@ -550,7 +550,7 @@ s32 player_test_move_with_slipping(PlayerStatus* playerStatus, f32* x, f32* y, f
}
radius = playerStatus->colliderDiameter * 0.5f;
sin_cos_rad(yaw * TAU / 360.0f, &sinTheta, &cosTheta);
sin_cos_rad(DEG_TO_RAD(yaw), &sinTheta, &cosTheta);
cosTheta = -cosTheta;
hitDepth = length + radius;
@ -840,7 +840,7 @@ void suggest_player_anim_clearUnkFlag(AnimID anim) {
if (newAnim != -1) {
playerStatus->anim = newAnim;
playerStatus->unk_BC = 0;
playerStatus->animNotifyValue = 0;
playerStatus->flags &= ~PS_FLAGS_10000000;
}
}
@ -849,7 +849,7 @@ void force_player_anim(AnimID anim) {
PlayerStatus* playerStatus = &gPlayerStatus;
playerStatus->anim = anim;
playerStatus->unk_BC = 0;
playerStatus->animNotifyValue = 0;
playerStatus->flags &= ~PS_FLAGS_10000000;
}
@ -859,7 +859,7 @@ void suggest_player_anim_setUnkFlag(AnimID anim) {
if (newAnim != -1) {
playerStatus->anim = newAnim;
playerStatus->unk_BC = 0;
playerStatus->animNotifyValue = 0;
playerStatus->flags |= PS_FLAGS_10000000;
}
}
@ -1383,7 +1383,7 @@ void func_800E0B90(void) {
if (playerStatus->flags & PS_FLAGS_20000000) {
timescale = 0.0f;
}
playerStatus->unk_BC = spr_update_player_sprite(0, playerStatus->trueAnimation, timescale);
playerStatus->animNotifyValue = spr_update_player_sprite(0, playerStatus->trueAnimation, timescale);
playerStatus->flags |= PS_FLAGS_40000000;
}
@ -1432,7 +1432,6 @@ s32 get_player_back_anim(s32 anim) {
} else {
return anim | SPRITE_ID_BACK_FACING;
}
}
void render_player(void) {
@ -1532,14 +1531,14 @@ void appendGfx_player(void* data) {
if (playerStatus->animFlags & PA_FLAGS_SHIVERING) {
playerStatus->animFlags = playerStatus->animFlags & ~PA_FLAGS_SHIVERING;
playerStatus->unk_0A = 22;
playerStatus->shiverTime = 22;
func_802DDEE4(0, -1, 0, 0, 0, 0, 0, 0);
func_802DDFF8(playerStatus->anim, 5, 1, 1, 1, 0, 0);
}
if (playerStatus->unk_0A != 0) {
playerStatus->unk_0A--;
if (playerStatus->unk_0A == 0) {
if (playerStatus->shiverTime != 0) {
playerStatus->shiverTime--;
if (playerStatus->shiverTime == 0) {
func_802DDEE4(0, -1, 0, 0, 0, 0, 0, 0);
}
}

View File

@ -42,7 +42,7 @@ void reset_player_status(void) {
f32 one;
f32* floatsTemp;
D_8010C96C = -1;
PeachDisguiseNpcIndex = -1;
TweesterTouchingPartner = NULL;
D_8010C920 = 0;
D_8010C940 = 0;
@ -54,7 +54,7 @@ void reset_player_status(void) {
D_800F7B44 = 0;
D_8010C938 = 0;
D_8010C990 = 0.0f;
playerStatus->unk_0D = 1;
playerStatus->availableDisguiseType = 1;
playerStatus->renderMode = 0xD;
playerStatus->alpha1 = 255;

View File

@ -221,10 +221,10 @@ void phys_update_action_state(void) {
return;
}
if (playerStatus->unk_C5 != 0) {
playerStatus->unk_C5--;
if (playerStatus->unk_C5 == 0) {
gCameras[CAM_DEFAULT].moveFlags |= 4;
if (playerStatus->camResetDelay != 0) {
playerStatus->camResetDelay--;
if (playerStatus->camResetDelay == 0) {
gCameras[CAM_DEFAULT].moveFlags |= CAMERA_MOVE_FLAGS_4;
}
}
@ -540,24 +540,24 @@ void check_input_spin(void) {
}
}
void peach_set_disguise_anim(s32 arg0) {
s32 listIndex = D_8010C96C;
void peach_set_disguise_anim(AnimID anim) {
s32 listIndex = PeachDisguiseNpcIndex;
if (listIndex >= 0) {
get_npc_by_index(listIndex)->currentAnim = arg0;
get_npc_by_index(listIndex)->currentAnim = anim;
}
}
void func_800E63A4(s32 arg0) {
void peach_force_disguise_action(s32 useParasol) {
PlayerStatus* playerStatus = &gPlayerStatus;
if (arg0 != 0) {
if (useParasol) {
set_action_state(ACTION_STATE_USE_SNEAKY_PARASOL);
} else {
playerStatus->animFlags &= ~PA_FLAGS_IN_DISGUISE;
gGameStatusPtr->peachFlags &= ~0x2;
gGameStatusPtr->peachFlags &= ~PEACH_STATUS_FLAG_DISGUISED;
playerStatus->peachDisguise = 0;
free_npc_by_index(D_8010C96C);
free_npc_by_index(PeachDisguiseNpcIndex);
set_action_state(ACTION_STATE_IDLE);
playerStatus->colliderHeight = 55;
playerStatus->colliderDiameter = 38;
@ -573,9 +573,9 @@ void peach_check_for_parasol_input(void) {
if (D_8010C92C != 0) {
D_8010C92C--;
if (D_8010C92C == 0) {
if (gGameStatusPtr->peachFlags & 2) {
if (gGameStatusPtr->peachFlags & PEACH_STATUS_FLAG_DISGUISED) {
playerStatus->animFlags |= PA_FLAGS_IN_DISGUISE;
gGameStatusPtr->peachFlags |= 2;
gGameStatusPtr->peachFlags |= PEACH_STATUS_FLAG_DISGUISED;
disguiseNpc = peach_make_disguise_npc(gGameStatusPtr->peachDisguise);
if (disguiseNpc != NULL) {
@ -583,7 +583,7 @@ void peach_check_for_parasol_input(void) {
}
}
}
} else if (gGameStatusPtr->peachFlags & 4 && playerStatus->pressedButtons & B_BUTTON) {
} else if (gGameStatusPtr->peachFlags & PEACH_STATUS_FLAG_HAS_PARASOL && playerStatus->pressedButtons & B_BUTTON) {
set_action_state(ACTION_STATE_USE_SNEAKY_PARASOL);
}
}
@ -592,8 +592,8 @@ void peach_check_for_parasol_input(void) {
void peach_sync_disguise_npc(void) {
PlayerStatus* playerStatus = &gPlayerStatus;
if (D_8010C96C >= 0) {
Npc* npc = get_npc_by_index(D_8010C96C);
if (PeachDisguiseNpcIndex >= 0) {
Npc* npc = get_npc_by_index(PeachDisguiseNpcIndex);
if (npc->flags & NPC_FLAG_40000) {
npc->renderYaw = playerStatus->spriteFacingAngle;
@ -628,8 +628,8 @@ Npc* peach_make_disguise_npc(s32 peachDisguise) {
bpPtr->onUpdate = NULL;
bpPtr->onRender = NULL;
D_8010C96C = _create_npc_standard(bpPtr, PeachDisguiseExtraAnims[playerStatus->peachDisguise]);
npc = get_npc_by_index(D_8010C96C);
PeachDisguiseNpcIndex = _create_npc_standard(bpPtr, PeachDisguiseExtraAnims[playerStatus->peachDisguise]);
npc = get_npc_by_index(PeachDisguiseNpcIndex);
disable_npc_shadow(npc);
@ -648,13 +648,12 @@ Npc* peach_make_disguise_npc(s32 peachDisguise) {
return npc;
}
void peach_disguise_check_overlaps(void) {
s32 peach_disguise_check_overlaps(void) {
PlayerStatus* playerStatus = &gPlayerStatus;
Camera* camera = &gCameras[gCurrentCameraID];
f32 yaw;
f32 sinTheta;
f32 cosTheta;
s32 phi_s1;
f32 yaw, dx, dy;
s32 radius;
s32 hitID;
s32 i;
if (playerStatus->spriteFacingAngle >= 90.0f && playerStatus->spriteFacingAngle < 270.0f) {
@ -662,14 +661,17 @@ void peach_disguise_check_overlaps(void) {
} else {
yaw = camera->currentYaw - 90.0f;
}
sin_cos_rad(clamp_angle(yaw) * TAU / 360.0f, &sinTheta, &cosTheta);
sin_cos_rad(DEG_TO_RAD(clamp_angle(yaw)), &dx, &dy);
for (phi_s1 = 2, i = 2; i > 0; i--, phi_s1 += 18) {
f32 x = playerStatus->position.x + (sinTheta * phi_s1);
for (radius = 2, i = 2; i > 0; radius += 18, i--) {
f32 x = playerStatus->position.x + (dx * radius);
f32 y = playerStatus->position.y + 4.0f;
f32 z = playerStatus->position.z - (cosTheta * phi_s1);
if (player_test_lateral_overlap(3, playerStatus, &x, &y, &z, 4.0f, yaw) >= 0) {
f32 z = playerStatus->position.z - (dy * radius);
hitID = player_test_lateral_overlap(3, playerStatus, &x, &y, &z, 4.0f, yaw);
if (hitID >= 0) {
break;
}
}
return hitID;
}

View File

@ -616,7 +616,7 @@ void collision_main_lateral(void) {
speed *= 0.5f;
}
}
sin_cos_rad(yaw * TAU / 360.0f, &sinTheta, &cosTheta);
sin_cos_rad(DEG_TO_RAD(yaw), &sinTheta, &cosTheta);
if (playerStatus->actionState == ACTION_STATE_PUSHING_BLOCK) {
if (fabsf(sinTheta) > fabsf(cosTheta)) {
@ -634,7 +634,7 @@ void collision_main_lateral(void) {
zBump = 0.0f;
}
sin_cos_rad(playerStatus->targetYaw * TAU / 360.0f, &sinTheta, &cosTheta);
sin_cos_rad(DEG_TO_RAD(playerStatus->targetYaw), &sinTheta, &cosTheta);
speed = playerStatus->currentSpeed;
if (playerStatus->flags & PS_FLAGS_40000) {
speed *= 0.5f;
@ -673,7 +673,7 @@ void collision_main_lateral(void) {
playerStatus->colliderDiameter * 0.5f, playerStatus->targetYaw);
if (speed == 0.0f && result < 0) {
yaw2 = playerStatus->spriteFacingAngle - 90.0f + gCameras[gCurrentCameraID].currentYaw;
sin_cos_rad((yaw2 + 180.0f) * TAU / 360.0f, &sinTheta, &cosTheta);
sin_cos_rad(DEG_TO_RAD(yaw2 + 180.0f), &sinTheta, &cosTheta);
playerX = playerStatus->position.x + (sinTheta * playerStatus->colliderDiameter * 0.5f);
playerY = playerStatus->position.y;
playerZ = playerStatus->position.z - (cosTheta * playerStatus->colliderDiameter * 0.5f);
@ -1080,7 +1080,7 @@ void func_800E4F10(void) {
void check_input_midair_jump(void) {
if (!(gPlayerStatus.flags & (PS_FLAGS_800000 | PS_FLAGS_10 | PS_FLAGS_FLYING)) &&
!(gPlayerStatus.animFlags & 0x4001) &&
!(gPlayerStatus.animFlags & (PA_FLAGS_8BIT_MARIO | PA_FLAGS_HOLDING_WATT)) &&
gPlayerStatus.unk_C2 >= 6 &&
gPlayerStatus.timeInAir < 18 &&
gPlayerStatus.pressedButtons & A_BUTTON) {
@ -1090,11 +1090,11 @@ void check_input_midair_jump(void) {
break;
case 1:
set_action_state(ACTION_STATE_SPIN_JUMP);
gPlayerStatus.flags |= 8;
gPlayerStatus.flags |= PS_FLAGS_FLYING;
break;
case 2:
set_action_state(ACTION_STATE_TORNADO_JUMP);
gPlayerStatus.flags |= 8;
gPlayerStatus.flags |= PS_FLAGS_FLYING;
break;
}
}

View File

@ -97,7 +97,7 @@ void func_800F0248(void) {
if (D_80109490++ > 0) {
D_80109490 = 0;
sin_cos_rad((clamp_angle(-playerStatus->currentYaw) * TAU) / 360.0f, &sin, &cos);
sin_cos_rad(DEG_TO_RAD(clamp_angle(-playerStatus->currentYaw)), &sin, &cos);
x = (playerStatus->colliderDiameter * sin * -0.4f) + playerStatus->position.x;
z = (playerStatus->colliderDiameter * cos * -0.4f) + playerStatus->position.z;
@ -138,7 +138,7 @@ void func_800F0864(void) {
if (D_801094A4++ >= 4) {
D_801094A4 = 0;
sin_cos_rad((clamp_angle(-playerStatus->currentYaw) * TAU) / 360.0f, &sin, &cos);
sin_cos_rad(DEG_TO_RAD(clamp_angle(-playerStatus->currentYaw)), &sin, &cos);
fx_footprint(
playerStatus->position.x + (playerStatus->colliderDiameter * sin * 0.2f),
playerStatus->position.y + 1.5f,

View File

@ -61,13 +61,13 @@ void update_camera_mode_unused(Camera* camera) {
}
camera->vfov = fovTemp >> 2;
theta = (camera->currentBoomYaw * TAU) / 360.0f;
theta = DEG_TO_RAD(camera->currentBoomYaw);
sinTheta1 = sin_rad(theta);
cosTheta1 = cos_rad(theta);
temp_f30 = (cosTheta1 * 0.0f) + (camera->currentBoomLength * sinTheta1);
temp_f24_2 = (sinTheta1 * -0.0f) + (camera->currentBoomLength * cosTheta1);
theta = (camera->trueRotation.x * TAU) / 360.0f;
theta = DEG_TO_RAD(camera->trueRotation.x);
sinTheta2 = sin_rad(theta);
cosTheta2 = cos_rad(theta);
camera->lookAt_eye.x = camera->lookAt_obj.x + ((cosTheta2 * 0.0f) - (temp_f24_2 * sinTheta2));
@ -143,7 +143,7 @@ void func_80030210(Camera* camera, f32 arg1, f32 arg2, s32 arg3) {
}
camera->lookAt_obj.x = camera->lookAt_eye.x = camera->lookAt_obj.x + xDelta;
theta = (camera->currentBoomYaw * TAU) / 360.0f;
theta = DEG_TO_RAD(camera->currentBoomYaw);
cosTheta = cos_rad(theta);
camera->lookAt_obj.z += (camera->auxPos.z - camera->lookAt_obj.z) * arg1;

View File

@ -1436,7 +1436,7 @@ void update_item_entity_collectable(ItemEntity* item) {
if (!(item->flags & ITEM_ENTITY_FLAGS_1000000)) {
temp = rand_int(2000);
temp = (temp / 1000.0f) + 1.5;
theta = (physData->moveAngle * TAU) / 360.0f;
theta = DEG_TO_RAD(physData->moveAngle);
sinAngle = sin_rad(theta);
cosAngle = cos_rad(theta);
physData->velx = temp * sinAngle;
@ -1444,7 +1444,7 @@ void update_item_entity_collectable(ItemEntity* item) {
} else {
temp = rand_int(2000);
temp = (temp / 1000.0f) + 2.0;
theta = (physData->moveAngle * TAU) / 360.0f;
theta = DEG_TO_RAD(physData->moveAngle);
sinAngle = sin_rad(theta);
cosAngle = cos_rad(theta);
physData->velx = temp * sinAngle;
@ -1457,7 +1457,7 @@ void update_item_entity_collectable(ItemEntity* item) {
} else {
temp = 2.1f;
}
theta = physData->moveAngle * TAU / 360.0f;
theta = DEG_TO_RAD(physData->moveAngle);
sinAngle = sin_rad(theta);
cosAngle = cos_rad(theta);
physData->velx = temp * sinAngle;
@ -1589,7 +1589,7 @@ void update_item_entity_collectable(ItemEntity* item) {
item->position.y = outY;
item->position.z = outZ;
physData->moveAngle = clamp_angle(physData->moveAngle + 180.0f);
theta = physData->moveAngle * TAU / 360.0f;
theta = DEG_TO_RAD(physData->moveAngle);
sinAngle = sin_rad(theta);
cosAngle = cos_rad(theta);
physData->velx = sinAngle * 2.0;

View File

@ -2154,7 +2154,7 @@ ApiStatus func_8026DF88(Evt* script, s32 isInitialCall) {
actorID = script->owner1.actorID;
}
evt_set_variable(script, a2, get_actor_part(get_actor(actorID), partIndex)->unk_8C);
evt_set_variable(script, a2, get_actor_part(get_actor(actorID), partIndex)->animNotifyValue);
return ApiStatus_DONE2;
}

View File

@ -47,13 +47,13 @@ void update_camera_mode_6(Camera* camera) {
}
camera->vfov = (f32) (temp_lo >> 2);
boomYaw = (camera->currentBoomYaw * TAU) / 360.0f;
boomYaw = DEG_TO_RAD(camera->currentBoomYaw);
sinBoom = sin_rad(boomYaw);
cosBoom = cos_rad(boomYaw);
temp_f30 = (cosBoom * 0.0f) + (camera->currentBoomLength * sinBoom);
temp_f24_2 = (sinBoom * -0.0f) + (camera->currentBoomLength * cosBoom);
rotation = (camera->trueRotation.x * TAU) / 360.0f;
rotation = DEG_TO_RAD(camera->trueRotation.x);
sinRotation = sin_rad(rotation);
cosRotation = cos_rad(rotation);

View File

@ -623,7 +623,7 @@ void sfx_compute_spatialized_sound_params_0(f32 x, f32 y, f32 z, s16* volume, s1
*pan = (screenX * 0.2f) + 32.0f;
} else {
f32 temp_f20 = ((screenX * 127.0) / 320.0) - 64.0;
*pan = (s32) (temp_f20 * sin_rad((fabs(temp_f20) * 90.0 * (1/64.0) * TAU) / 360.0)) + 64;
*pan = (s32) (temp_f20 * sin_rad(DEG_TO_RAD(fabs(temp_f20) * 90.0 / 64.0))) + 64;
}
}

View File

@ -9,7 +9,7 @@ ApiStatus func_80218000_6DBDA0(Evt* script, s32 isInitialCall) {
D_802187E4_6DC584 += 9;
D_802187E4_6DC584 = clamp_angle(D_802187E4_6DC584);
actor->unk_19A = sin_rad((D_802187E4_6DC584 * TAU) / 360.0f) * 3.0f;
actor->unk_19A = sin_rad(DEG_TO_RAD(D_802187E4_6DC584)) * 3.0f;
return ApiStatus_DONE2;
}

View File

@ -31,7 +31,7 @@ ApiStatus func_802186D8_609188(Evt* script, s32 isInitialCall) {
do {} while(0);
var0 = evt_get_float_variable(script, arg0);
evt_set_float_variable(script, arg0, var1 * sin_rad(var0 * TAU / 360.0f));
evt_set_float_variable(script, arg0, var1 * sin_rad(DEG_TO_RAD(var0)));
return ApiStatus_DONE2;
}

View File

@ -107,7 +107,7 @@ ApiStatus func_80218000_4CF1B0(Evt* script, s32 isInitialCall) {
sym = &D_80219040;
*sym += 15;
*sym = clamp_angle(*sym);
actor->unk_19A = sin_rad(*sym * TAU / 360.0f) * 3.0f;
actor->unk_19A = sin_rad(DEG_TO_RAD(*sym)) * 3.0f;
return ApiStatus_BLOCK;
}

View File

@ -29,7 +29,7 @@ ApiStatus N(UnkWattEffectFunc1)(Evt* script, s32 isInitialCall) {
wattEffectData->angle += 15;
wattEffectData->angle = clamp_angle(wattEffectData->angle);
}
actor->unk_19A = sin_rad(wattEffectData->angle * TAU / 360.0f) * 3.0f;
actor->unk_19A = sin_rad(DEG_TO_RAD(wattEffectData->angle)) * 3.0f;
x = actor->currentPos.x + actor->headOffset.x;
y = actor->currentPos.y + actor->headOffset.y + actor->unk_19A + (actor->debuff != STATUS_SHRINK ? 12.0 : 4.800000000000001); // 4.8 doesn't match

View File

@ -29,7 +29,7 @@ ApiStatus N(func_802A1270_727B80)(Evt* script, s32 isInitialCall) {
camera->flags |= CAM_FLAG_SHAKING;
a = script->functionTemp[1];
guRotateF(camera->viewMtxShaking, a, 0.0f, 0.0f, 1.0f);
script->functionTemp[1] = 2.0 * ((1.0 - sin_rad(((script->functionTemp[2] + 90) * 6.28318f) / 360.0f)) * 360.0);
script->functionTemp[1] = 2.0 * ((1.0 - sin_rad(DEG_TO_RAD(script->functionTemp[2] + 90))) * 360.0);
script->functionTemp[2]++;
if (script->functionTemp[2] <= 90) {
return ApiStatus_BLOCK;

View File

@ -408,7 +408,7 @@ ApiStatus func_80238E24_700BA4(Evt* evt, s32 isInitialCall) {
parakarry->state.currentPos.x += parakarry->state.speed;
*animationRatePtr = 1.0f;
y = parakarry->state.currentPos.y;
parakarry->state.currentPos.y = y + (sin_rad(2.0f * sin_rad(parakarry->state.moveTime * TAU / 360.0f) * PI_S) * D_8023BD60_703AE0 + 0.5);
parakarry->state.currentPos.y = y + (sin_rad(2.0f * sin_rad(DEG_TO_RAD(parakarry->state.moveTime)) * PI_S) * D_8023BD60_703AE0 + 0.5);
parakarry->state.moveTime += 6;
parakarry->state.moveTime = clamp_angle(parakarry->state.moveTime);

View File

@ -19,6 +19,6 @@ ApiStatus func_80238028_714D18(Evt* script, s32 isInitialCall) {
D_802382F8_714FE8 += 18;
D_802382F8_714FE8 = clamp_angle(D_802382F8_714FE8);
actor->unk_19A = 2.0f * sin_rad(D_802382F8_714FE8 * TAU / 360.0f);
actor->unk_19A = 2.0f * sin_rad(DEG_TO_RAD(D_802382F8_714FE8));
return ApiStatus_DONE2;
}

View File

@ -21,7 +21,7 @@ ApiStatus func_802A1518_78D668(Evt* script, s32 isInitialCall) {
script->functionTemp[0] = 1;
case 1:
temp = script->functionTemp[2];
temp2 = (sin_rad((script->functionTemp[1] * TAU) / 360.0f) * 30.0f) + 30.0f;
temp2 = (sin_rad(DEG_TO_RAD(script->functionTemp[1])) * 30.0f) + 30.0f;
fx_music_note(0, temp, temp2, 50.0f);
script->functionTemp[2] += 14;

View File

@ -27,7 +27,7 @@ BSS s32 PrevPlayerDirection;
BSS s32 JumpedOnSwitchX;
BSS s32 D_8010C964;
BSS s32 D_8010C968;
BSS s32 D_8010C96C;
BSS s32 PeachDisguiseNpcIndex;
BSS s32 D_8010C970;
BSS s32 D_8010C974;
BSS s16 D_8010C978;

View File

@ -908,7 +908,7 @@ f32 test_ray_collider_horizontal(s32 ignoreFlags, s32 colliderID, f32 x, f32 y,
s32 i;
f32 ret;
sin_cos_rad(yaw * TAU / 360.0f, &sinTheta, &cosTheta);
sin_cos_rad(DEG_TO_RAD(yaw), &sinTheta, &cosTheta);
collider = &collisionData->colliderList[colliderID];
gCollisionRayDirY = 0;

View File

@ -1,7 +1,7 @@
#include "common.h"
ApiStatus N(ChompChainUpdateHelperFunc)(ChompChainAnimationState* script, f32 magnitude, f32 angleDeg) {
f32 angle = (angleDeg * TAU) / 360.0f;
f32 angle = DEG_TO_RAD(angleDeg);
f32 dirX = sin_rad(angle);
f32 dirY = cos_rad(angle);

View File

@ -1,7 +1,7 @@
#include "common.h"
ApiStatus N(ChompChainUpdateHelperFunc2)(f32* x, f32 magnitude, f32 angleDeg) {
f32 angle = (angleDeg * TAU) / 360.0f;
f32 angle = DEG_TO_RAD(angleDeg);
f32 dirX = sin_rad(angle);
f32 dirY = cos_rad(angle);

View File

@ -9,7 +9,7 @@ ApiStatus N(UnkAngleFunc2)(Evt* script, s32 isInitialCall) {
s32 a4 = *args++;
s32 a5 = *args++;
s32 a6 = *args++;
f32 temp1 = var0 * TAU / 360.0f;
f32 temp1 = DEG_TO_RAD(var0);
f32 fout1 = sin_rad(temp1) * 150.0f + 0.0f;
f32 fout2 = sin_rad(temp1 * 8.0f) * 10.0f + 0.0f;
f32 fout3 = cos_rad(temp1) * 150.0f / 20.0f + -50.0f;

View File

@ -65,11 +65,11 @@ ApiStatus N(UnkFloatFunc005)(Evt* script, s32 isInitialCall) {
vt2 = script->varTable[5];
vt3 = script->varTable[6];
vt4 = script->varTable[7];
temp_f20 = vt0 * (1.0 - sin_rad((script->varTable[9] * TAU) / 360.0f));
vt0 = (temp_f20 + (vt3 * sin_rad((script->varTable[9] * TAU) / 360.0f)));
vt1 = vt1 + (sin_rad(((script->varTable[9] * 2) * TAU) / 360.0f) * 90.0f);
temp_f20_2 = vt2 * (1.0 - sin_rad((script->varTable[9] * TAU) / 360.0f));
vt2 = temp_f20_2 + (vt4 * sin_rad((script->varTable[9] * TAU) / 360.0f));
temp_f20 = vt0 * (1.0 - sin_rad(DEG_TO_RAD(script->varTable[9])));
vt0 = (temp_f20 + (vt3 * sin_rad(DEG_TO_RAD(script->varTable[9]))));
vt1 = vt1 + sin_rad(DEG_TO_RAD(script->varTable[9] * 2)) * 90.0f;
temp_f20_2 = vt2 * (1.0 - sin_rad(DEG_TO_RAD(script->varTable[9])));
vt2 = temp_f20_2 + (vt4 * sin_rad(DEG_TO_RAD(script->varTable[9])));
if (script->varTable[9] == 45) {
script->varTable[11] = 1;
}
@ -84,11 +84,11 @@ ApiStatus N(UnkFloatFunc005)(Evt* script, s32 isInitialCall) {
vt2 = script->varTable[5];
vt3 = script->varTable[6];
vt4 = script->varTable[7];
temp_f20_3 = vt0 * (1.0 - sin_rad((script->varTable[9] * TAU) / 360.0f));
vt0 = (temp_f20_3 + (vt3 * sin_rad((script->varTable[9] * TAU) / 360.0f)));
vt1 = vt1 + (sin_rad(((script->varTable[9] * 2) * TAU) / 360.0f) * 90.0f);
temp_f20_4 = vt2 * (1.0 - sin_rad((script->varTable[9] * TAU) / 360.0f));
vt2 = temp_f20_4 + (vt4 * sin_rad((script->varTable[9] * TAU) / 360.0f));
temp_f20_3 = vt0 * (1.0 - sin_rad(DEG_TO_RAD(script->varTable[9])));
vt0 = (temp_f20_3 + (vt3 * sin_rad(DEG_TO_RAD(script->varTable[9]))));
vt1 = vt1 + sin_rad(DEG_TO_RAD(script->varTable[9] * 2)) * 90.0f;
temp_f20_4 = vt2 * (1.0 - sin_rad(DEG_TO_RAD(script->varTable[9])));
vt2 = temp_f20_4 + (vt4 * sin_rad(DEG_TO_RAD(script->varTable[9])));
if (script->varTable[9] == 90) {
script->varTable[11] = 2;
}

View File

@ -7,7 +7,7 @@ ApiStatus N(UnkFloatFunc2)(Evt* script, s32 isInitialCall) {
s32 a1 = *args++;
s32 a2 = *args++;
s32 a3 = *args++;
f32 temp = sin_rad(var0 / 10 * 6.28318f / 360.0f * 8.0f) * 10.0f;
f32 temp = sin_rad(DEG_TO_RAD(var0 / 10) * 8.0f) * 10.0f;
evt_set_variable(script, a1, 0);
evt_set_variable(script, a2, temp);

View File

@ -212,7 +212,7 @@ void entity_inactive_block_hit_anim(Entity* entity) {
entity_MulticoinBlock_update_timer(entity);
currentY = entity->position.y;
entity->position.y = currentY + ((f64)sin_rad((data->recoilInterpPhase * 6.28318f) / 360.0f) * 2);
entity->position.y = currentY + ((f64)sin_rad(DEG_TO_RAD(data->recoilInterpPhase)) * 2);
data->recoilInterpPhase += 60.0f;
if (data->recoilInterpPhase > 450.0f) {
data->recoilInterpPhase = clamp_angle(data->recoilInterpPhase);
@ -226,7 +226,7 @@ void entity_inactive_block_recoil_anim(Entity* entity) {
entity_MulticoinBlock_update_timer(entity);
currentY = entity->position.y;
entity->position.y = currentY + ((f64)sin_rad((data->recoilInterpPhase * 6.28318f) / 360.0f));
entity->position.y = currentY + ((f64)sin_rad(DEG_TO_RAD(data->recoilInterpPhase)));
data->recoilInterpPhase += 60.0f;
if (data->recoilInterpPhase >= 360.0f) {
data->recoilInterpPhase = 0.0f;

View File

@ -182,7 +182,7 @@ void entity_Chest_open(Entity* entity) {
if (data->lidAnimInterpPhase >= 180.0f) {
data->openState++;
}
temp = sin_rad(data->lidAnimInterpPhase * TAU / 360.0f) * 3.0f;
temp = sin_rad(DEG_TO_RAD(data->lidAnimInterpPhase)) * 3.0f;
data->lidAngle -= temp;
break;
case 3:
@ -191,7 +191,7 @@ void entity_Chest_open(Entity* entity) {
data->postLidAnimDelay = 10;
data->openState++;
}
temp = sin_rad(data->lidAnimInterpPhase * TAU / 360.0f) * 2.0f;
temp = sin_rad(DEG_TO_RAD(data->lidAnimInterpPhase)) * 2.0f;
data->lidAngle -= temp;
break;
case 4:
@ -225,7 +225,7 @@ void entity_Chest_close(Entity* entity) {
data->lidAnimInterpPhase = 180.0f;
data->state++;
}
delta = 2.6f * sin_rad(data->lidAnimInterpPhase * TAU / 360.0f);
delta = 2.6f * sin_rad(DEG_TO_RAD(data->lidAnimInterpPhase));
data->lidAngle += delta;
break;
case 2:
@ -235,7 +235,7 @@ void entity_Chest_close(Entity* entity) {
data->postLidAnimDelay = 10;
data->state++;
}
delta = 2.0f * sin_rad(data->lidAnimInterpPhase * TAU / 360.0f);
delta = 2.0f * sin_rad(DEG_TO_RAD(data->lidAnimInterpPhase));
data->lidAngle += delta;
break;
case 3:
@ -299,7 +299,7 @@ void entity_GiantChest_open(Entity* entity) {
break;
case 2:
if (chest->giveItemHeightInterpPhase < 140.0f) {
chest->itemEntityPos.y += cos_rad(chest->giveItemHeightInterpPhase * TAU / 360.0f) * 3.0f;
chest->itemEntityPos.y += cos_rad(DEG_TO_RAD(chest->giveItemHeightInterpPhase)) * 3.0f;
} else {
dy = (chest->itemEntityPos.y - playerStatus->position.y - 30.0f) * 0.25f;
if (dy <= 0.4) {
@ -307,7 +307,7 @@ void entity_GiantChest_open(Entity* entity) {
}
chest->itemEntityPos.y -= dy;
}
giveItemLerpAlpha = sin_rad(chest->giveItemRadiusInterpPhase * TAU / 360.0f);
giveItemLerpAlpha = sin_rad(DEG_TO_RAD(chest->giveItemRadiusInterpPhase));
theta = intermediateTheta = clamp_angle(atan2(entity->position.x, entity->position.z, playerStatus->position.x, playerStatus->position.z));
if (gGameStatusPtr->areaID == AREA_KZN) {
@ -331,8 +331,8 @@ void entity_GiantChest_open(Entity* entity) {
chest->state++;
if (chest->itemID != 0) {
suggest_player_anim_setUnkFlag(ANIM_Mario_6000C);
sin_cos_rad((90.0f - gCameras[CAM_DEFAULT].currentYaw) * TAU / 360.0f, &sinRight, &cosRight);
sin_cos_rad((180.0f - gCameras[CAM_DEFAULT].currentYaw) * TAU / 360.0f, &sinFwd, &cosFwd);
sin_cos_rad(DEG_TO_RAD(90.0f - gCameras[CAM_DEFAULT].currentYaw), &sinRight, &cosRight);
sin_cos_rad(DEG_TO_RAD(180.0f - gCameras[CAM_DEFAULT].currentYaw), &sinFwd, &cosFwd);
horizontalOffset = 0.0f;
depthOffset = 4.0f;
//RadialFlowOut
@ -381,7 +381,7 @@ void entity_GiantChest_give_equipment(Entity* entity) {
}
if (data->itemID != 0) {
angle = (entity->rotation.y * TAU) / 360.0f;
angle = DEG_TO_RAD(entity->rotation.y);
data->itemEntityPos.x = entity->position.x + (sin_rad(angle) * 10.0f);
data->itemEntityPos.y = entity->position.y;
data->itemEntityPos.z = entity->position.z + (cos_rad(angle) * 10.0f);

View File

@ -197,7 +197,7 @@ void entity_HeartBlockContent__anim_heal(Entity* entity, s32 arg1) {
}
break;
case 2:
entity->position.y += sin_rad((data->bouncePhase * TAU) / 360.0f) * 0.5f;
entity->position.y += sin_rad(DEG_TO_RAD(data->bouncePhase)) * 0.5f;
data->bouncePhase -= 30.0f;
if (data->bouncePhase < 0.0f) {
data->bouncePhase += 360.0f;
@ -229,8 +229,8 @@ void entity_HeartBlockContent__anim_heal(Entity* entity, s32 arg1) {
if (data->sparkleTrailAngle >= 360.0f) {
data->sparkleTrailAngle -= 360.0f;
}
offsetX = data->sparkleTrailRadius * sin_rad((data->sparkleTrailAngle * TAU) / 360.0f);
offsetZ = data->sparkleTrailRadius * cos_rad((data->sparkleTrailAngle * TAU) / 360.0f);
offsetX = data->sparkleTrailRadius * sin_rad(DEG_TO_RAD(data->sparkleTrailAngle));
offsetZ = data->sparkleTrailRadius * cos_rad(DEG_TO_RAD(data->sparkleTrailAngle));
offsetY = data->sparkleTrailPosY;
data->sparkleTrailPosY -= 0.7;
@ -248,7 +248,7 @@ void entity_HeartBlockContent__anim_heal(Entity* entity, s32 arg1) {
}
// fallthrough
case 4:
entity->position.y += sin_rad((data->bouncePhase * TAU) / 360.0f) * 0.5f;
entity->position.y += sin_rad(DEG_TO_RAD(data->bouncePhase)) * 0.5f;
data->bouncePhase -= 30.0f;
if (data->bouncePhase < 0.0f) {
data->bouncePhase += 360.0f;

View File

@ -133,7 +133,7 @@ void entity_HiddenPanel_flip_over(Entity* entity) {
entity->flags &= ~ENTITY_FLAGS_HIDDEN;
break;
case 1:
entity->position.y += data->riseVelocity * sin_rad(data->riseInterpPhase * TAU / 360.0f);
entity->position.y += data->riseVelocity * sin_rad(DEG_TO_RAD(data->riseInterpPhase));
if (entity->position.y <= data->initialY) {
entity->position.y = data->initialY;
entity->rotation.x = 0.0f;
@ -182,7 +182,7 @@ void entity_HiddenPanel_flip_over(Entity* entity) {
rotAngle = 360.0f;
}
entity->position.y += data->riseVelocity * sin_rad(data->riseInterpPhase * TAU / 360.0f);
entity->position.y += data->riseVelocity * sin_rad(DEG_TO_RAD(data->riseInterpPhase));
data->riseInterpPhase += 10.0f;
if (data->riseInterpPhase > 270.0f) {
data->riseInterpPhase = 270.0f;

View File

@ -107,7 +107,7 @@ void entity_shattering_idle(Entity* entity) {
data->fragmentPosY[i] += data->fragmentFallSpeed[i];
angle = data->fragmentMoveAngle[i] * 360.0 / 256;
sin_cos_rad(angle * TAU / 360.0f, &sinTheta, &cosTheta);
sin_cos_rad(DEG_TO_RAD(angle), &sinTheta, &cosTheta);
data->fragmentPosX[i] += lateralSpeed * sinTheta;
data->fragmentPosZ[i] += lateralSpeed * cosTheta;
@ -120,7 +120,7 @@ void entity_shattering_idle(Entity* entity) {
data->fragmentPosZ[i] = hitZ;
data->fragmentMoveAngle[i] += 0x80; // inverse yaw
sin_cos_rad(data->fragmentMoveAngle[i] * 360.0 / 256 * TAU / 360.0f, &sinTheta, &cosTheta);
sin_cos_rad(DEG_TO_RAD(data->fragmentMoveAngle[i] * 360.0 / 256), &sinTheta, &cosTheta);
lateralSpeed = 8.0f;
data->fragmentPosX[i] += lateralSpeed * sinTheta;
data->fragmentPosZ[i] += lateralSpeed * cosTheta;
@ -180,8 +180,8 @@ void entity_shattering_setupGfx(s32 entityIndex) {
}
guTranslateF(mtxTransInv, x_inv, y_inv, z_inv);
guRotateF(mtxRotX, data->fragmentRotX[i] * 360.0f * 0.00390625f, 1.0f, 0.0f, 0.0f);
guRotateF(mtxRotY, data->fragmentRotY[i] * 360.0f * 0.00390625f, 0.0f, 1.0f, 0.0f);
guRotateF(mtxRotX, data->fragmentRotX[i] * 360.0f / 256, 1.0f, 0.0f, 0.0f);
guRotateF(mtxRotY, data->fragmentRotY[i] * 360.0f / 256, 0.0f, 1.0f, 0.0f);
guMtxCatF(mtxRotX, mtxRotY, mtxRotY);
guMtxCatF(mtxRotY, mtxTransInv, mtxTransInv);
guTranslateF(mtx, data->fragmentPosX[i], data->fragmentPosY[i], data->fragmentPosZ[i]);

View File

@ -14,7 +14,7 @@ void entity_ScriptSpring_idle(Entity* entity) {
PlayerStatus* playerStatus = &gPlayerStatus;
if (playerStatus->actionState != ACTION_STATE_RIDE && (entity->collisionFlags & ENTITY_COLLISION_PLAYER_TOUCH_FLOOR)) {
playerStatus->unk_C5 = 5;
playerStatus->camResetDelay = 5;
playerStatus->flags &= ~PS_FLAGS_FALLING;
playerStatus->flags |= PS_FLAGS_800000;
play_model_animation(entity->virtualModelIndex, Entity_ScriptSpring_AnimLaunch);
@ -32,7 +32,7 @@ void entity_SimpleSpring_idle(Entity* entity) {
if (playerStatus->actionState != ACTION_STATE_RIDE && (entity->collisionFlags & ENTITY_COLLISION_PLAYER_TOUCH_FLOOR)) {
if (data->launchVelocity >= 70) {
playerStatus->unk_C5 = 5;
playerStatus->camResetDelay = 5;
}
play_model_animation(entity->virtualModelIndex, Entity_SimpleSpring_AnimLaunch);
entity_start_script(entity);

View File

@ -124,8 +124,8 @@ void entity_WoodenCrate_update_fragments(Entity* entity) {
}
data->fragmentPosY[i] += data->fragmentFallSpeed[i];
yawRad = data->fragmentMoveAngle[i] * 360.0f * 0.00390625f;
moveAngle = yawRad * TAU / 360.0f;
yawRad = data->fragmentMoveAngle[i] * 360.0f / 256;
moveAngle = DEG_TO_RAD(yawRad);
data->fragmentPosX[i] += lateralSpeed * sin_rad(moveAngle);
data->fragmentPosZ[i] += lateralSpeed * cos_rad(moveAngle);
@ -138,7 +138,7 @@ void entity_WoodenCrate_update_fragments(Entity* entity) {
data->fragmentPosZ[i] = hitZ;
data->fragmentMoveAngle[i] += 0x80; // inverse yaw
moveAngle = data->fragmentMoveAngle[i] * 360.0f * 0.00390625f * TAU / 360.0f;
moveAngle = DEG_TO_RAD(data->fragmentMoveAngle[i] * 360.0f / 256);
lateralSpeed = 8.0f;
data->fragmentPosX[i] += lateralSpeed * sin_rad(moveAngle);
data->fragmentPosZ[i] += lateralSpeed * cos_rad(moveAngle);
@ -198,8 +198,8 @@ void entity_WoodenCrate_setupGfx(s32 entityIndex) {
}
guTranslateF(mtxTransInv, x_inv, y_inv, z_inv);
guRotateF(mtxRotX, data->fragmentRotX[i] * 360.0f * 0.00390625f, 1.0f, 0.0f, 0.0f);
guRotateF(mtxRotY, data->fragmentRotY[i] * 360.0f * 0.00390625f, 0.0f, 1.0f, 0.0f);
guRotateF(mtxRotX, data->fragmentRotX[i] * 360.0f / 256, 1.0f, 0.0f, 0.0f);
guRotateF(mtxRotY, data->fragmentRotY[i] * 360.0f / 256, 0.0f, 1.0f, 0.0f);
guMtxCatF(mtxRotX, mtxRotY, mtxRotY);
guMtxCatF(mtxRotY, mtxTransInv, mtxTransInv);
guTranslateF(mtx, data->fragmentPosX[i], data->fragmentPosY[i], data->fragmentPosZ[i]);

View File

@ -112,8 +112,8 @@ void Entity_BoardedFloor_update_fragments(Entity* entity) {
}
data->fragmentPosY[i] += data->fragmentFallSpeed[i];
yawRad = data->fragmentMoveAngle[i] * 360.0f * 0.00390625f;
moveAngle = yawRad * TAU / 360.0f;
yawRad = data->fragmentMoveAngle[i] * 360.0f / 256;
moveAngle = DEG_TO_RAD(yawRad);
data->fragmentPosX[i] += lateralSpeed * sin_rad(moveAngle);
data->fragmentPosZ[i] += lateralSpeed * cos_rad(moveAngle);
@ -126,7 +126,7 @@ void Entity_BoardedFloor_update_fragments(Entity* entity) {
data->fragmentPosZ[i] = hitZ;
data->fragmentMoveAngle[i] += 0x80; // inverse yaw
moveAngle = data->fragmentMoveAngle[i] * 360.0f * 0.00390625f * TAU / 360.0f;
moveAngle = DEG_TO_RAD(data->fragmentMoveAngle[i] * 360.0f / 256);
lateralSpeed = 8.0f;
data->fragmentPosX[i] += lateralSpeed * sin_rad(moveAngle);
data->fragmentPosZ[i] += lateralSpeed * cos_rad(moveAngle);
@ -186,8 +186,8 @@ void Entity_BoardedFloor_setupGfx(s32 entityIndex) {
}
guTranslateF(mtxTransInv, x_inv, y_inv, z_inv);
guRotateF(mtxRotX, data->fragmentRotX[i] * 360.0f * 0.00390625f, 1.0f, 0.0f, 0.0f);
guRotateF(mtxRotY, data->fragmentRotY[i] * 360.0f * 0.00390625f, 0.0f, 1.0f, 0.0f);
guRotateF(mtxRotX, data->fragmentRotX[i] * 360.0f / 256, 1.0f, 0.0f, 0.0f);
guRotateF(mtxRotY, data->fragmentRotY[i] * 360.0f / 256, 0.0f, 1.0f, 0.0f);
guMtxCatF(mtxRotX, mtxRotY, mtxRotY);
guMtxCatF(mtxRotY, mtxTransInv, mtxTransInv);
guTranslateF(mtx, data->fragmentPosX[i], data->fragmentPosY[i], data->fragmentPosZ[i]);

View File

@ -137,8 +137,8 @@ void entity_BombableRock_update_fragments(Entity* entity) {
}
data->fragmentPosY[i] += data->fragmentFallSpeed[i];
yawRad = data->fragmentMoveAngle[i] * 360.0f * 0.00390625f;
moveAngle = yawRad * TAU / 360.0f;
yawRad = data->fragmentMoveAngle[i] * 360.0f / 256;
moveAngle = DEG_TO_RAD(yawRad);
data->fragmentPosX[i] += lateralSpeed * sin_rad(moveAngle);
data->fragmentPosZ[i] += lateralSpeed * cos_rad(moveAngle);
@ -151,7 +151,7 @@ void entity_BombableRock_update_fragments(Entity* entity) {
data->fragmentPosZ[i] = hitZ;
data->fragmentMoveAngle[i] += 0x80; // inverse yaw
moveAngle = data->fragmentMoveAngle[i] * 360.0f * 0.00390625f * TAU / 360.0f;
moveAngle = DEG_TO_RAD(data->fragmentMoveAngle[i] * 360.0f / 256);
lateralSpeed = 8.0f;
data->fragmentPosX[i] += lateralSpeed * sin_rad(moveAngle);
data->fragmentPosZ[i] += lateralSpeed * cos_rad(moveAngle);
@ -211,8 +211,8 @@ void entity_BombableRock_setupGfx(s32 entityIndex) {
}
guTranslateF(mtxTransInv, x_inv, y_inv, z_inv);
guRotateF(mtxRotX, data->fragmentRotX[i] * 360.0f * 0.00390625f, 1.0f, 0.0f, 0.0f);
guRotateF(mtxRotY, data->fragmentRotY[i] * 360.0f * 0.00390625f, 0.0f, 1.0f, 0.0f);
guRotateF(mtxRotX, data->fragmentRotX[i] * 360.0f / 256, 1.0f, 0.0f, 0.0f);
guRotateF(mtxRotY, data->fragmentRotY[i] * 360.0f / 256, 0.0f, 1.0f, 0.0f);
guMtxCatF(mtxRotX, mtxRotY, mtxRotY);
guMtxCatF(mtxRotY, mtxTransInv, mtxTransInv);
guTranslateF(mtx, data->fragmentPosX[i], data->fragmentPosY[i], data->fragmentPosZ[i]);

View File

@ -69,8 +69,8 @@ void entity_Padlock_push_player(Entity* entity) {
data->pushSpeed = 2.5f;
}
deltaX = data->pushSpeed * sin_rad((180.0f - entity->rotation.y) * TAU / 360.0f);
deltaZ = data->pushSpeed * cos_rad((180.0f - entity->rotation.y) * TAU / 360.0f);
deltaX = data->pushSpeed * sin_rad(DEG_TO_RAD(180.0f - entity->rotation.y));
deltaZ = data->pushSpeed * cos_rad(DEG_TO_RAD(180.0f - entity->rotation.y));
playerStatus->position.x += deltaX;
playerStatus->position.z -= deltaZ;

View File

@ -157,7 +157,7 @@ void entity_PinkFlowerLight_setupGfx(s32 entityIndex) {
guScaleF(sp18, entity->scale.x, entity->scale.x, entity->scale.x);
guMtxCatF(sp18, sp58, sp58);
guMtxL2F(sp18, ENTITY_ADDR(entity, Mtx*, &D_0A001098_E9C598));
sin_cos_rad((gCameras[CAM_DEFAULT].currentYaw + 180.0f) * TAU / 360.0f, &sinAngle, &cosAngle);
sin_cos_rad(DEG_TO_RAD(gCameras[CAM_DEFAULT].currentYaw + 180.0f), &sinAngle, &cosAngle);
sp18[3][1] += 10.0f;
sp18[3][2] -= 10.0f;
guMtxCatF(sp58, sp18, sp18);

View File

@ -56,7 +56,7 @@ void entity_TrumpetPlant_idle(Entity* entity) {
void entity_TrumpetPlant_create_effect(Entity* entity) {
f32 xOffset, zOffset, angle;
angle = clamp_angle(entity->rotation.y) * TAU / 360.0f;
angle = DEG_TO_RAD(clamp_angle(entity->rotation.y));
xOffset = -26.0 * cos_rad(angle);
zOffset = 6.0 * sin_rad(angle);
fx_stars_burst(0, entity->position.x + xOffset, entity->position.y + 62.0f, entity->position.z + zOffset, clamp_angle(entity->rotation.y - 90.0), 54.0f, 2);
@ -69,7 +69,7 @@ void entity_TrumpetPlant_spawn_coin(Entity* entity) {
if (data->numCoins < 3) {
f32 xOffset, zOffset, angle;
angle = clamp_angle(entity->rotation.y) * TAU / 360.0f;
angle = DEG_TO_RAD(clamp_angle(entity->rotation.y));
xOffset = -26.0 * cos_rad(angle);
zOffset = 6.0 * sin_rad(angle);
@ -182,7 +182,7 @@ void entity_MunchlesiaChewing_init(Entity* entity) {
void func_802BC3E4_E2ED14(Entity* entity) {
MunchlesiaData* data = entity->dataBuf.munchlesia;
gPlayerStatus.position.y = data->unk_0C + (sin_rad((data->unk_10 * TAU) / 360.0f) * 3.0f);
gPlayerStatus.position.y = data->unk_0C + (sin_rad(DEG_TO_RAD(data->unk_10)) * 3.0f);
data->unk_10 += 24.0f;
if (data->unk_10 > 360.0f) {

View File

@ -95,7 +95,7 @@ void entity_StarBoxLauncher_check_launch(Entity* entity) {
exec_entity_commandlist(entity);
data->timer = 4;
disable_player_static_collisions();
playerStatus->unk_C5 = 5;
playerStatus->camResetDelay = 5;
}
}
@ -142,7 +142,7 @@ void entity_StarBoxLauncher_launch(Entity* entity) {
/* fallthrough */
case 1:
temp = entity->position.y;
entity->position.y = temp + 8.0 * sin_rad(data->riseSpeedPhase * TAU / 360.0f);
entity->position.y = temp + 8.0 * sin_rad(DEG_TO_RAD(data->riseSpeedPhase));
data->riseSpeedPhase += 2.0f;
if (data->riseSpeedPhase >= 180.0f) {
data->riseSpeedPhase = 180.0f;
@ -157,14 +157,14 @@ void entity_StarBoxLauncher_launch(Entity* entity) {
}
break;
case 2:
entity->rotation.z = data->maxRotationZ * sin_rad(data->rotationZPhase * TAU / 360.0f);
entity->rotation.z = data->maxRotationZ * sin_rad(DEG_TO_RAD(data->rotationZPhase));
clamp_angle(entity->rotation.z);
data->rotationZPhase += 30.0f;
if (data->rotationZPhase >= 360.0f) {
data->rotationZPhase -= 360.0f;
}
entity->position.y += data->riseVelocity * cos_rad(data->riseSpeedPhase * TAU / 360.0f);
entity->position.y += data->riseVelocity * cos_rad(DEG_TO_RAD(data->riseSpeedPhase));
data->riseSpeedPhase += 30.0f;
if (data->riseSpeedPhase >= 360.0f) {
data->riseSpeedPhase -= 360.0f;
@ -181,7 +181,7 @@ void entity_StarBoxLauncher_launch(Entity* entity) {
data->maxRotationZ = 0.0f;
}
entity->rotation.z = data->maxRotationZ * sin_rad(data->rotationZPhase * TAU / 360.0f);
entity->rotation.z = data->maxRotationZ * sin_rad(DEG_TO_RAD(data->rotationZPhase));
clamp_angle(entity->rotation.z);
data->rotationZPhase += 30.0f;
if (data->rotationZPhase >= 360.0f) {
@ -190,7 +190,7 @@ void entity_StarBoxLauncher_launch(Entity* entity) {
entity_StarBoxLauncher_update_face_anim(entity);
entity->position.y += data->riseVelocity * cos_rad(data->riseSpeedPhase * TAU / 360.0f);
entity->position.y += data->riseVelocity * cos_rad(DEG_TO_RAD(data->riseSpeedPhase));
data->riseSpeedPhase += 30.0f;
if (data->riseSpeedPhase >= 360.0f) {
data->riseSpeedPhase -= 360.0f;

View File

@ -153,7 +153,7 @@ void entity_Tweester_select_target_point(Entity* entity) {
paths = data->paths;
if (pathOffset == 0) {
for (i = 0; (s32)*paths != -1; paths++, i++) {
for (i = 0; *paths != PTR_LIST_END; paths++, i++) {
}
j = rand_int(i * 10 - 1) / 10;
paths = data->paths;
@ -190,7 +190,7 @@ void entity_Tweester_move(Entity* entity) {
}
data->yaw = clamp_angle(data->yaw + temp_f4);
yawRad = data->yaw * TAU / 360.0f;
yawRad = DEG_TO_RAD(data->yaw);
entity->position.x += sin_rad(yawRad);
entity->position.z -= cos_rad(yawRad);

View File

@ -49,8 +49,8 @@ ApiStatus func_802D7690(Evt* script, s32 isInitialCall) {
offsetX = rand_int(10) - 5;
offsetZ = rand_int(10) - 5;
offsetY = -2.0f - ((SQ(offsetX) + SQ(offsetZ)) / 5.0f);
sinA = sin_rad(angle * TAU / 360.0f);
cosA = cos_rad(angle * TAU / 360.0f);
sinA = sin_rad(DEG_TO_RAD(angle));
cosA = cos_rad(DEG_TO_RAD(angle));
fx_cloud_trail(
posX + ((sinA * magnitude * script->functionTemp[0]) / duration) + offsetX,
posY + 15.5f + offsetY,

View File

@ -854,7 +854,7 @@ void virtual_entity_render_quad(s32 arg0, s32 arg1, s32 arg2, s32 arg3, s32 arg4
}
void virtual_entity_move_polar(VirtualEntity* virtualEntity, f32 magnitude, f32 angle) {
f32 theta = (angle * TAU) / 360.0f;
f32 theta = DEG_TO_RAD(angle);
f32 sinTheta = sin_rad(theta);
f32 cosTheta = cos_rad(theta);

View File

@ -400,7 +400,7 @@ void npc_do_other_npc_collision(Npc* npc) {
}
if (collision) {
temp_f20_2 = atan2(otherX, otherZ, thisX, thisZ) * TAU / 360.0f;
temp_f20_2 = DEG_TO_RAD(atan2(otherX, otherZ, thisX, thisZ));
temp_f24_2 = thisBuf + otherBuf - dist;
temp_f22_3 = temp_f24_2 * sin_rad(temp_f20_2);
temp_f22_4 = -temp_f24_2 * cos_rad(temp_f20_2);
@ -744,11 +744,11 @@ void appendGfx_npc(Npc* npc) {
if (!(npc->flags & NPC_FLAG_NO_ANIMS_LOADED)) {
if (!(npc->flags & NPC_FLAG_1000000) && (npc->currentAnim != 0) && (npc->spriteInstanceID >= 0)) {
npc_draw_with_palswap(npc, renderYaw, mtx1);
npc->unk_2C = func_802DE5C8(npc->spriteInstanceID);
npc->animNotifyValue = spr_get_notify_value(npc->spriteInstanceID);
}
} else {
npc_draw_with_palswap(npc, renderYaw, mtx1);
npc->unk_2C = func_802DDEC4(1);
npc->animNotifyValue = func_802DDEC4(1);
}
if (npc->flags & NPC_FLAG_REFLECT_WALL) {
@ -874,7 +874,7 @@ void render_npcs(void) {
}
void npc_move_heading(Npc* npc, f32 speed, f32 yaw) {
f32 angle = (yaw * TAU) / 360.0f;
f32 angle = DEG_TO_RAD(yaw);
f32 sin = sin_rad(angle);
f32 cos = cos_rad(angle);
@ -1664,11 +1664,11 @@ void func_8003D788(Npc* npc, s32 arg1) {
if (D_80077C14++ >= 4) {
D_80077C14 = 0;
if (phi_a2 == 0) {
sin_cos_rad((clamp_angle(-npc->yaw) * TAU) / 360.0f, &sinTheta, &cosTheta);
sin_cos_rad(DEG_TO_RAD(clamp_angle(-npc->yaw)), &sinTheta, &cosTheta);
fx_walking_dust(0, npc->pos.x + (npc->collisionRadius * sinTheta * 0.2f), npc->pos.y + 1.5f,
npc->pos.z + (npc->collisionRadius * cosTheta * 0.2f), sinTheta, cosTheta);
} else {
sin_cos_rad((clamp_angle(npc->yaw) * TAU) / 360.0f, &sinTheta, &cosTheta);
sin_cos_rad(DEG_TO_RAD(clamp_angle(npc->yaw)), &sinTheta, &cosTheta);
fx_misc_particles(3, npc->pos.x + (npc->collisionRadius * sinTheta), npc->pos.y + 1.5f,
npc->pos.z + (npc->collisionRadius * cosTheta), 5.0f, 10.0f, 1.0f, 5, 30);
}
@ -1698,7 +1698,7 @@ void func_8003DA38(Npc* npc, s32 arg1) {
if (D_80077C1C++ > 0) {
D_80077C1C = 0;
theta = clamp_angle(-npc->yaw) * TAU / 360.0f;
theta = DEG_TO_RAD(clamp_angle(-npc->yaw));
sinTheta = sin_rad(theta);
cosTheta = cos_rad(theta);
@ -1723,7 +1723,7 @@ void func_8003DFA0(Npc* npc, s32 arg1) {
f32 z;
D_80077C30 = 0;
temp_f20 = (clamp_angle(-npc->yaw) * TAU) / 360.0f;
temp_f20 = DEG_TO_RAD(clamp_angle(-npc->yaw));
x = sin_rad(temp_f20);
z = cos_rad(temp_f20);
fx_footprint(npc->pos.x + (npc->collisionRadius * x * 0.2f), npc->pos.y + 1.5f,
@ -1739,7 +1739,7 @@ void func_8003E0D4(Npc* npc, s32 arg1) {
f32 cosTheta;
D_80077C38 = 0;
theta = (clamp_angle(-npc->yaw) * TAU) / 360.0f;
theta = DEG_TO_RAD(clamp_angle(-npc->yaw));
sinTheta = sin_rad(theta);
cosTheta = cos_rad(theta);
fx_falling_leaves(1, npc->pos.x + (npc->collisionRadius * sinTheta * 0.2f),
@ -1754,7 +1754,7 @@ void func_8003E1D0(Npc* npc, s32 arg1) {
f32 z;
D_80077C3A = 0;
temp_f20 = (clamp_angle(-npc->yaw) * TAU) / 360.0f;
temp_f20 = DEG_TO_RAD(clamp_angle(-npc->yaw));
x = sin_rad(temp_f20);
z = cos_rad(temp_f20);
fx_rising_bubble(0, npc->pos.x + (npc->collisionRadius * x * 0.2f), npc->pos.y + 0.0f,

View File

@ -97,7 +97,7 @@ s32 npc_raycast_down_around(s32 ignoreFlags, f32* posX, f32* posY, f32* posZ, f3
hitYBehindLeft = hitYBehindRight = hitYAhead = -32767.0f;
minDepth = fabsf(*hitDepth);
theta = clamp_angle(yaw + 0.0f) * TAU / 360.0f;
theta = DEG_TO_RAD(clamp_angle(yaw + 0.0f));
sinTheta = sin_rad(theta);
cosTheta = cos_rad(theta);
deltaX = radius * sinTheta;
@ -120,7 +120,7 @@ s32 npc_raycast_down_around(s32 ignoreFlags, f32* posX, f32* posY, f32* posZ, f3
}
}
theta = clamp_angle(yaw + 120.0f) * TAU / 360.0f;
theta = DEG_TO_RAD(clamp_angle(yaw + 120.0f));
sinTheta = sin_rad(theta);
cosTheta = cos_rad(theta);
deltaX = radius * sinTheta;
@ -143,7 +143,7 @@ s32 npc_raycast_down_around(s32 ignoreFlags, f32* posX, f32* posY, f32* posZ, f3
}
}
theta = clamp_angle(yaw - 120.0f) * TAU / 360.0f;
theta = DEG_TO_RAD(clamp_angle(yaw - 120.0f));
sinTheta = sin_rad(theta);
cosTheta = cos_rad(theta);
deltaX = radius * sinTheta;
@ -210,7 +210,7 @@ s32 npc_raycast_down_sides(s32 ignoreFlags, f32* posX, f32* posY, f32* posZ, f32
yaw = 0.0f;
minDepth = fabsf(*hitDepth);
theta = clamp_angle(yaw) * TAU / 360.0f;
theta = DEG_TO_RAD(clamp_angle(yaw));
sinTheta = sin_rad(theta);
cosTheta = cos_rad(theta);
@ -236,7 +236,7 @@ s32 npc_raycast_down_sides(s32 ignoreFlags, f32* posX, f32* posY, f32* posZ, f32
}
}
theta = clamp_angle(yaw + 180.0f) * TAU / 360.0f;
theta = DEG_TO_RAD(clamp_angle(yaw + 180.0f));
sinTheta = sin_rad(theta);
cosTheta = cos_rad(theta);
deltaX = radius * sinTheta;
@ -384,7 +384,7 @@ s32 npc_raycast_up_corners(s32 ignoreFlags, f32* posX, f32* posY, f32* posZ, f32
s32 hitID;
f32 temp;
theta = (yaw * TAU) / 360.0f;
theta = DEG_TO_RAD(yaw);
deltaX = radius * sin_rad(theta);
temp = -radius; // needed to match
deltaZ = temp * cos_rad(theta);
@ -493,7 +493,7 @@ s32 npc_test_move_with_slipping(s32 ignoreFlags, f32* x, f32* y, f32* z, f32 len
s32 phi_s2 = -1;
f32 a, b;
sin_cos_rad((yaw * TAU) / 360.0f, &outSinTheta, &outCosTheta);
sin_cos_rad(DEG_TO_RAD(yaw), &outSinTheta, &outCosTheta);
aX = length * outSinTheta;
temp_f22 = length + radius + (radius * 0.5f);
inverseOutCosTheta = -outCosTheta;
@ -541,7 +541,7 @@ s32 npc_test_move_without_slipping(s32 ignoreFlags, f32* x, f32* y, f32* z, f32
f32 temp1;
f32 temp2;
sin_cos_rad(yaw * TAU / 360.0f, &dirY, &cosTheta);
sin_cos_rad(DEG_TO_RAD(yaw), &dirY, &cosTheta);
cosTheta = -cosTheta;
originalDepth = length + radius + (radius * 0.5f);
depth = originalDepth;

View File

@ -6,16 +6,18 @@ extern SpriteAnimData* spr_playerSprites[13];
extern s32 D_802DF57C;
extern s32 spr_playerMaxComponents;
extern PlayerCurrentAnimInfo spr_playerCurrentAnimInfo[3];
extern SpriteAnimData* spr_npcSprites[0xEA];
extern u8 spr_npcSpriteInstanceCount[];
extern SpriteInstance D_802DFA48[51];
extern SpriteAnimData* NpcSpriteData[0xEA];
extern u8 NpcSpriteInstanceCount[0xEA];
extern SpriteInstance SpriteInstances[51];
extern Quad* D_802DFE44;
extern s32 D_802DFE48[22];
extern s32 D_802DFEA0[3];
extern s32 D_802DFEAC;
extern s32 SpriteUpdateNotifyValue;
extern s32 MaxLoadedSpriteInstanceID;
SpriteComponent** spr_allocate_components(s32);
void spr_load_npc_extra_anims(SpriteAnimData*, u32*);
void spr_init_player_raster_cache(s32 cacheSize, s32 maxRasterSize);
Quad spr_defaultQuad = {
@ -140,18 +142,18 @@ void spr_make_quad_for_size(Quad* quad, s32 width, s32 height) {
Quad* spr_get_quad_for_size(s32* quadIndex, s32 width, s32 height) {
Quad* quad;
s32 qi;
s32 widthHeight;
s32 dimensions;
s32 i;
if ((width * height) / 2 <= 0x800) {
widthHeight = (width << 0x18) + (height << 0x10);
dimensions = (width << 0x18) + (height << 0x10);
qi = *quadIndex;
if (qi != -1 && (widthHeight == (D_802DFE48[qi] & 0xFFFF0000))) {
if (qi != -1 && (dimensions == (D_802DFE48[qi] & 0xFFFF0000))) {
return spr_get_cached_quad(qi);
}
for (i = 0; i < ARRAY_COUNT(D_802DFE48); i++) {
if (widthHeight == (D_802DFE48[i] & 0xFFFF0000)) {
if (dimensions == (D_802DFE48[i] & 0xFFFF0000)) {
*quadIndex = i;
return spr_get_cached_quad(i);
}
@ -165,7 +167,7 @@ Quad* spr_get_quad_for_size(s32* quadIndex, s32 width, s32 height) {
if (i != ARRAY_COUNT(D_802DFE48)) {
*quadIndex = i;
D_802DFE48[i] = widthHeight;
D_802DFE48[i] = dimensions;
quad = spr_get_cached_quad(i);
spr_make_quad_for_size(quad, width, height);
return quad;
@ -204,39 +206,38 @@ void spr_appendGfx_component(
f32 dx, f32 dy, f32 dz,
f32 rotX, f32 rotY, f32 rotZ,
f32 scaleX, f32 scaleY, f32 scaleZ,
s32 opacity, void* palette, Matrix4f mtx)
s32 opacity, PAL_PTR palette, Matrix4f mtx)
{
Matrix4f sp20;
Matrix4f sp60;
FoldImageRecPart spA0;
Matrix4f mtxTransform;
Matrix4f mtxTemp;
FoldImageRecPart foldImg;
s32 quadIndex;
Quad* quad;
u32 temp_v1;
s32 width;
s32 height;
guTranslateF(sp60, dx, dy, dz);
guMtxCatF(sp60, mtx, sp20);
guTranslateF(mtxTemp, dx, dy, dz);
guMtxCatF(mtxTemp, mtx, mtxTransform);
if (rotY != 0.0f) {
guRotateF(sp60, rotY, 0.0f, 1.0f, 0.0f);
guMtxCatF(sp60, sp20, sp20);
guRotateF(mtxTemp, rotY, 0.0f, 1.0f, 0.0f);
guMtxCatF(mtxTemp, mtxTransform, mtxTransform);
}
if (rotZ != 0.0f) {
guRotateF(sp60, rotZ, 0.0f, 0.0f, 1.0f);
guMtxCatF(sp60, sp20, sp20);
guRotateF(mtxTemp, rotZ, 0.0f, 0.0f, 1.0f);
guMtxCatF(mtxTemp, mtxTransform, mtxTransform);
}
if (rotX != 0.0f) {
guRotateF(sp60, rotX, 1.0f, 0.0f, 0.0f);
guMtxCatF(sp60, sp20, sp20);
guRotateF(mtxTemp, rotX, 1.0f, 0.0f, 0.0f);
guMtxCatF(mtxTemp, mtxTransform, mtxTransform);
}
if (scaleX != 1.0f || scaleY != 1.0f || scaleZ != 1.0f) {
guScaleF(sp60, scaleX, scaleY, scaleZ);
guMtxCatF(sp60, sp20, sp20);
guScaleF(mtxTemp, scaleX, scaleY, scaleZ);
guMtxCatF(mtxTemp, mtxTransform, mtxTransform);
}
guMtxF2L(sp20, &gDisplayContext->matrixStack[gMatrixListPos]);
guMtxF2L(mtxTransform, &gDisplayContext->matrixStack[gMatrixListPos]);
gSPMatrix(gMasterGfxPos++, VIRTUAL_TO_PHYSICAL(&gDisplayContext->matrixStack[gMatrixListPos++]),
G_MTX_PUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
@ -265,16 +266,16 @@ void spr_appendGfx_component(
}
if (quad != NULL) {
spr_appendGfx_component_flat(quad, cache->image, palette, width, height, rotY, sp20, (u8) opacity);
spr_appendGfx_component_flat(quad, cache->image, palette, width, height, rotY, mtxTransform, (u8) opacity);
} else {
spA0.raster = cache->image;
spA0.palette = palette;
spA0.width = width;
spA0.height = height;
spA0.xOffset = -(width / 2);
spA0.yOffset = height;
spA0.opacity = opacity;
if (fold_appendGfx_component((u8) (u16) D_802DF540, &spA0, 0x80000, sp20) == 1) { // todo bitfield?
foldImg.raster = cache->image;
foldImg.palette = palette;
foldImg.width = width;
foldImg.height = height;
foldImg.xOffset = -(width / 2);
foldImg.yOffset = height;
foldImg.opacity = opacity;
if (fold_appendGfx_component((u8) (u16) D_802DF540, &foldImg, 0x80000, mtxTransform) == 1) { // todo bitfield?
D_802DF540 &= ~(0x80000000 | 0x40000000 | 0x20000000 | 0x10000000);
}
}
@ -287,61 +288,56 @@ void spr_transform_point(s32 rotX, s32 rotY, s32 rotZ, f32 inX, f32 inY, f32 inZ
*outY = inY;
*outZ = inZ;
} else {
Matrix4f mtx, mtx2;
f32 f1, f2, f3, f4, f5, f6, f7, f8, f9;
Matrix4f mtxTransform, mtxTemp;
f32 xx, yx, zx, xy, yy, zy, xz, yz, zz;
guRotateF(mtx, rotY, 0.0f, 1.0f, 0.0f);
guRotateF(mtx2, rotZ, 0.0f, 0.0f, 1.0f);
guMtxCatF(mtx2, mtx, mtx);
guRotateF(mtx2, rotX, 1.0f, 0.0f, 0.0f);
guMtxCatF(mtx2, mtx, mtx);
guRotateF(mtxTransform, rotY, 0.0f, 1.0f, 0.0f);
guRotateF(mtxTemp, rotZ, 0.0f, 0.0f, 1.0f);
guMtxCatF(mtxTemp, mtxTransform, mtxTransform);
guRotateF(mtxTemp, rotX, 1.0f, 0.0f, 0.0f);
guMtxCatF(mtxTemp, mtxTransform, mtxTransform);
f1 = (mtx[0][0] * inX);
f2 = (mtx[1][0] * inY);
f3 = (mtx[2][0] * inZ);
f4 = (mtx[0][1] * inX);
f5 = (mtx[1][1] * inY);
f6 = (mtx[2][1] * inZ);
f7 = (mtx[0][2] * inX);
f8 = (mtx[1][2] * inY);
f9 = (mtx[2][2] * inZ);
xx = (mtxTransform[0][0] * inX);
yx = (mtxTransform[1][0] * inY);
zx = (mtxTransform[2][0] * inZ);
xy = (mtxTransform[0][1] * inX);
yy = (mtxTransform[1][1] * inY);
zy = (mtxTransform[2][1] * inZ);
xz = (mtxTransform[0][2] * inX);
yz = (mtxTransform[1][2] * inY);
zz = (mtxTransform[2][2] * inZ);
*outX = f1 + f2 + f3;
*outY = f4 + f5 + f6;
*outZ = f7 + f8 + f9;
*outX = xx + yx + zx;
*outY = xy + yy + zy;
*outZ = xz + yz + zz;
}
}
void spr_draw_component(s32 opacity, SpriteComponent* component, UnkSpriteThing* arg2, SpriteRasterCacheEntry** cache, s16** arg4, f32 arg5, Matrix4f mtx) {
f32 dx;
f32 dy;
f32 dz;
void spr_draw_component(s32 drawOpts, SpriteComponent* component, SpriteAnimComponent* anim,
SpriteRasterCacheEntry** cache, PAL_PTR* palettes, f32 zscale, Matrix4f mtx) {
SpriteRasterCacheEntry* cacheEntry;
s32 paletteIdx;
void* pal;
f32 rotX;
f32 rotY;
f32 rotZ;
f32 inX;
f32 inY;
f32 inZ;
PAL_PTR pal;
f32 dx, dy, dz;
f32 rotX, rotY, rotZ;
f32 inX, inY, inZ;
if (component->initialized && component->currentRaster != -1) {
rotX = D_802DFEA0[0];
rotY = D_802DFEA0[1];
rotZ = D_802DFEA0[2];
inX = component->compPos.x + arg2->unk_06.x;
inY = component->compPos.y + arg2->unk_06.y;
inZ = component->compPos.z + arg2->unk_06.z;
inX = component->compPos.x + anim->compOffset.x;
inY = component->compPos.y + anim->compOffset.y;
inZ = component->compPos.z + anim->compOffset.z;
spr_transform_point(rotX, rotY, rotZ, inX, inY, inZ * arg5, &dx, &dy, &dz);
spr_transform_point(rotX, rotY, rotZ, inX, inY, inZ * zscale, &dx, &dy, &dz);
cacheEntry = cache[component->currentRaster];
paletteIdx = component->currentPalette;
if (opacity & 0x08000000) {
if (drawOpts & 0x08000000) {
cacheEntry->image = spr_get_player_raster(component->currentRaster & 0xFFF, D_802DF57C);
}
D_802DF540 = component->unk_4C;
pal = arg4[paletteIdx];
pal = palettes[paletteIdx];
spr_appendGfx_component(
cacheEntry,
@ -352,13 +348,13 @@ void spr_draw_component(s32 opacity, SpriteComponent* component, UnkSpriteThing*
component->scale.x,
component->scale.y,
component->scale.z,
opacity, pal, mtx
drawOpts, pal, mtx
);
component->unk_4C = D_802DF540;
}
}
s32 spr_sign_extend_12bit(u16 val) {
s32 spr_unpack_signed_12bit(u16 val) {
s32 temp = val & 0xFFF;
if (temp & 0x800) {
@ -368,7 +364,7 @@ s32 spr_sign_extend_12bit(u16 val) {
}
}
s32 spr_sign_extend_16bit(u16 val) {
s32 spr_unpack_signed_16bit(u16 val) {
s32 temp = val & 0xFFFF;
if (temp & 0x8000) {
@ -378,8 +374,181 @@ s32 spr_sign_extend_16bit(u16 val) {
}
}
void spr_component_update_commands(SpriteComponent* comp, SpriteAnimComponent* animComponent);
INCLUDE_ASM(s32, "sprite", spr_component_update_commands);
void spr_component_update_commands(SpriteComponent* comp, SpriteAnimComponent* anim) {
f32 posX, posY, posZ;
f32 rotX, rotY, rotZ;
f32 scaleX, scaleY, scaleZ;
s32 changedFlags;
u16* bufPos;
u16* gotoPos;
s32 cmdValue;
if (comp->initialized) {
scaleZ = 1.0f;
scaleY = 1.0f;
scaleX = 1.0f;
changedFlags = 0;
bufPos = comp->readPos;
gotoPos = (u16*) -1;
comp->waitTime -= spr_animUpdateTimeScale;
while (comp->waitTime <= 0.0f) {
// overflow check
if (bufPos >= &anim->cmdList[anim->cmdListSize / 2]) {
bufPos = anim->cmdList;
break;
}
switch (*bufPos & 0xF000) {
// 0VVV
// Wait
case 0x0000:
comp->waitTime = *bufPos++ & 0xFFF;
if (comp->waitTime == 0.0f) {
comp->waitTime = 4095.0f;
}
comp->posOffset.z = 0.0f;
comp->posOffset.y = 0.0f;
comp->posOffset.x = 0.0f;
comp->rotation.z = 0;
comp->rotation.y = 0;
comp->rotation.x = 0;
comp->scale.z = 1.0f;
comp->scale.y = 1.0f;
comp->scale.x = 1.0f;
break;
// 2VVV
// Goto -- jump to another position in the list
case 0x2000:
bufPos = &anim->cmdList[spr_unpack_signed_12bit(*bufPos)];
if (bufPos == gotoPos) {
bufPos = anim->cmdList;
comp->waitTime = 1.0f;
}
gotoPos = bufPos;
break;
// 1VVV
// SetImage -- FFF is valid value for "no image"
case 0x1000:
cmdValue = *bufPos++ & 0xFFF;
if (cmdValue != 0xFFF) {
comp->currentRaster = cmdValue;
} else {
comp->currentRaster = -1;
}
comp->currentPalette = -1;
break;
// 6VVV
// SetPalette -- FFF to clear
case 0x6000:
cmdValue = *bufPos++ & 0xFFF;
if (cmdValue != 0xFFF) {
comp->currentPalette = cmdValue;
} else {
comp->currentPalette = -1;
}
break;
// 8VUU
// SetProperty
// 81-XX parent to component XX
// 82-YY set notify value to YY
case 0x8000:
cmdValue = *bufPos++;
switch (cmdValue & 0xF00) {
case 0x100: // set parent
comp->properties = (comp->properties & 0xFFFF0000) | cmdValue;
break;
case 0x200: // set notify value
SpriteUpdateNotifyValue = cmdValue & 0xFF;
comp->properties = (comp->properties & 0xFF00FFFF) | (SpriteUpdateNotifyValue << 0x10);
break;
}
break;
// 3VVV XXXX YYYY ZZZZ
// SetPosition -- what does the flag do?
case 0x3000:
switch (*bufPos++ & 0xF) {
case 0:
case 1:
posX = spr_unpack_signed_16bit(*bufPos++);
posY = spr_unpack_signed_16bit(*bufPos++);
posZ = spr_unpack_signed_16bit(*bufPos++);
changedFlags |= 1;
break;
}
break;
// 4XXX YYYY ZZZZ
// SetRotation (euler angles)
case 0x4000:
rotX = spr_unpack_signed_12bit(*bufPos++);
rotY = spr_unpack_signed_16bit(*bufPos++);
rotZ = spr_unpack_signed_16bit(*bufPos++);
changedFlags |= 2;
break;
// 5VVV UUUU
// SetScale (%)
case 0x5000:
switch (*bufPos++ & 0xF) {
case 0:
scaleZ = *bufPos++ / 100.0f;
scaleY = scaleZ;
scaleX = scaleZ;
break;
case 1:
scaleX = *bufPos++ / 100.0f;
break;
case 2:
scaleY = *bufPos++ / 100.0f;
break;
case 3:
scaleZ = *bufPos++ / 100.0f;
break;
}
changedFlags |= 4;
break;
// 7VVV UUUU
// Loop -- VV iterations jumping back to UUUU
case 0x7000:
if (comp->loopCounter != 0) {
comp->loopCounter--;
if (comp->loopCounter == 0) {
bufPos += 2;
break;
}
} else {
comp->loopCounter = bufPos[1];
}
bufPos = &anim->cmdList[spr_unpack_signed_12bit(*bufPos)];
break;
// invalid command
default:
bufPos = anim->cmdList;
comp->waitTime = 1.0f;
break;
}
} // end loop
comp->readPos = bufPos;
if (changedFlags & 1) {
comp->posOffset.x = posX;
comp->posOffset.y = posY;
comp->posOffset.z = posZ;
}
if (changedFlags & 2) {
comp->rotation.x = rotX;
comp->rotation.y = rotY;
comp->rotation.z = rotZ;
}
if (changedFlags & 4) {
comp->scale.x = scaleX;
comp->scale.y = scaleY;
comp->scale.z = scaleZ;
}
}
}
void spr_component_update_finish(SpriteComponent* comp, SpriteComponent** compList,
SpriteRasterCacheEntry** rasterCacheEntry, s32 overridePalette)
@ -392,8 +561,8 @@ void spr_component_update_finish(SpriteComponent* comp, SpriteComponent** compLi
comp->compPos.y = comp->posOffset.y;
comp->compPos.z = comp->posOffset.z;
if ((comp->unk_04 & 0xF00) == 0x100) {
listComp = compList[comp->unk_04 & 0xFF];
if ((comp->properties & 0xF00) == 0x100) {
listComp = compList[comp->properties & 0xFF];
comp->compPos.x += listComp->compPos.x;
comp->compPos.y += listComp->compPos.y;
comp->compPos.z += listComp->compPos.z;
@ -411,36 +580,37 @@ void spr_component_update_finish(SpriteComponent* comp, SpriteComponent** compLi
}
}
s32 spr_component_update(s32 arg0, SpriteComponent** compList, SpriteAnimComponent** arg2, SpriteRasterCacheEntry** rasterCache, s32 overridePalette) {
s32 spr_component_update(s32 curNotifyValue, SpriteComponent** compList, SpriteAnimComponent** animList,
SpriteRasterCacheEntry** rasterCache, s32 overridePalette) {
SpriteComponent** compListIt;
D_802DFEAC = arg0;
SpriteUpdateNotifyValue = curNotifyValue;
compListIt = compList;
while ((s32) *compListIt != -1) {
spr_component_update_commands(*compListIt++, *arg2);
if ((s32) *arg2 != -1) {
arg2++;
while (*compListIt != PTR_LIST_END) {
spr_component_update_commands(*compListIt++, *animList);
if (*animList != PTR_LIST_END) {
animList++;
}
}
compListIt = compList;
while ((s32) *compListIt != -1) {
while (*compListIt != PTR_LIST_END) {
spr_component_update_finish(*compListIt++, compList, rasterCache, overridePalette);
}
return D_802DFEAC;
return SpriteUpdateNotifyValue;
}
void spr_init_component_anim_state(SpriteComponent* comp, s16*** anim) {
if (anim == (s16***)-1) {
void spr_init_component_anim_state(SpriteComponent* comp, SpriteAnimComponent* anim) {
if (anim == PTR_LIST_END) {
comp->initialized = FALSE;
return;
}
comp->initialized = TRUE;
comp->unk_04 = 0;
comp->readPos = *anim;
comp->properties = 0;
comp->readPos = anim->cmdList;
comp->waitTime = 0;
comp->loopCounter = 0;
comp->currentRaster = -1;
@ -459,17 +629,12 @@ void spr_init_component_anim_state(SpriteComponent* comp, s16*** anim) {
comp->scale.z = 1.0f;
}
// very questionable cast, spr_init_component_anim_state args are probably wrong
void spr_init_anim_state(SpriteComponent** compList, s16** cmdList) {
SpriteComponent* component;
SpriteComponent** compListIt = compList;
s16** cmdListIt = cmdList;
while (*compListIt != (SpriteComponent*)-1) {
component = *compListIt++;
spr_init_component_anim_state(component, (s16***)*cmdListIt);
if (*cmdListIt != (s16*)-1) {
cmdListIt++;
void spr_init_anim_state(SpriteComponent** compList, SpriteAnimComponent** animList) {
while (*compList != PTR_LIST_END) {
SpriteComponent* component = *compList++;
spr_init_component_anim_state(component, *animList);
if (*animList != PTR_LIST_END) {
animList++;
}
}
}
@ -479,18 +644,17 @@ void spr_set_anim_timescale(f32 timescale) {
}
void spr_load_player_sprite(s32 spriteIndex) {
s32 ind = spriteIndex - 1;
SpriteAnimData* playerSprite = spr_load_sprite(ind, TRUE, FALSE);
SpriteAnimData* playerSprite = spr_load_sprite(spriteIndex - 1, TRUE, FALSE);
spr_playerSprites[ind] = playerSprite;
spr_playerSprites[spriteIndex - 1] = playerSprite;
if (spr_playerMaxComponents < playerSprite->maxComponents) {
spr_playerMaxComponents = playerSprite->maxComponents;
}
}
void spr_init_sprites(s32 playerSpriteSet) {
s32 loadedFlags;
s32 i;
s32 flags;
spr_allocateBtlComponentsOnWorldHeap = FALSE;
_heap_create(&gSpriteHeapPtr, 0x40000);
@ -507,39 +671,32 @@ void spr_init_sprites(s32 playerSpriteSet) {
playerSpriteSet = 4;
}
flags = (&spr_playerSpriteSets[playerSpriteSet])->initiallyLoaded;
loadedFlags = (&spr_playerSpriteSets[playerSpriteSet])->initiallyLoaded;
spr_init_player_raster_cache((&spr_playerSpriteSets[playerSpriteSet])->cacheSize,
(&spr_playerSpriteSets[playerSpriteSet])->rasterSize);
for (i = 1; i < 0xE; i++) {
if ((flags >> i) & 1) {
for (i = 1; i <= SPR_Peach_D; i++) {
if ((loadedFlags >> i) & 1) {
spr_load_player_sprite(i);
}
}
for (i = 0; i < ARRAY_COUNT(spr_playerCurrentAnimInfo); i++) {
PlayerCurrentAnimInfo* animInfo = &spr_playerCurrentAnimInfo[i];
animInfo->componentList = NULL;
animInfo->animID = -1;
spr_playerCurrentAnimInfo[i].componentList = NULL;
spr_playerCurrentAnimInfo[i].animID = -1;
}
for (i = 0; i < ARRAY_COUNT(spr_npcSprites); i++) {
s32* npcSprites = (s32*)spr_npcSprites;
u8* npcSpriteInstanceCount = spr_npcSpriteInstanceCount;
npcSprites[i] = NULL;
npcSpriteInstanceCount[i] = 0;
for (i = 0; i < ARRAY_COUNT(NpcSpriteData); i++) {
NpcSpriteData[i] = NULL;
NpcSpriteInstanceCount[i] = 0;
}
for (i = 0; i < ARRAY_COUNT(D_802DFA48); i++) {
SpriteInstance* sprite = &D_802DFA48[i];
sprite->spriteIndex = 0;
sprite->componentList = NULL;
sprite->spriteData = 0;
sprite->currentAnimID = -1;
sprite->unk_10 = 0;
for (i = 0; i < ARRAY_COUNT(SpriteInstances); i++) {
SpriteInstances[i].spriteIndex = 0;
SpriteInstances[i].componentList = NULL;
SpriteInstances[i].spriteData = NULL;
SpriteInstances[i].currentAnimID = -1;
SpriteInstances[i].notifyValue = 0;
}
spr_init_quad_cache();
@ -556,10 +713,102 @@ s32 func_802DDA84(void) {
INCLUDE_ASM(void, "sprite", spr_update_player_sprite, s32 arg0, s32 arg1, f32 arg2);
#ifdef NON_EQUIVALENT
s32 spr_draw_player_sprite(s32 spriteInstanceID, s32 yaw, s32 arg2, u16** paletteList, Matrix4f mtx) {
PlayerCurrentAnimInfo* animInfo;
SpriteComponent** compList;
SpriteAnimComponent** animList;
SpriteRasterCacheEntry** rasterList;
s32 spriteIndex;
s32 animIndex;
s32 spriteAnimIndex;
s32 animID;
s32 camRelativeYaw;
s32 alpha;
f32 zscale;
PAL_PTR* drawPalettes;
camRelativeYaw = yaw;
spriteAnimIndex = spriteInstanceID & 0xFF;
animID = spr_playerCurrentAnimInfo[spriteAnimIndex].animID;
if (animID == -1) {
return 0;
}
spriteIndex = ((animID >> 0x10) & 0xFF) - 1;
D_802DF57C = spriteIndex;
if (spr_playerSprites[spriteIndex] == NULL) {
return 0;
}
rasterList = spr_playerSprites[spriteIndex]->rastersOffset;
animList = &spr_playerSprites[spriteIndex]->animListStart[animID & 0xFF];
drawPalettes = spr_playerSprites[spriteIndex]->palettesOffset;
if (animID & 0x01000000) {
switch (spriteIndex) {
case 0:
case 5:
case 9:
spriteIndex++;
D_802DF57C = spriteIndex;
rasterList = spr_playerSprites[spriteIndex]->rastersOffset;
break;
}
}
if (!(spriteInstanceID & 0x40000000)) {
camRelativeYaw += (s32) -gCameras[gCurrentCamID].currentYaw;
if (camRelativeYaw > 360) {
camRelativeYaw -= 360;
}
if (camRelativeYaw < -360) {
camRelativeYaw += 360;
}
}
if ((camRelativeYaw - 91) < 180U || (camRelativeYaw + 270) < 180U) {
zscale = -1.5f;
} else {
zscale = 1.5f;
}
if (spriteInstanceID & 0x10000000) {
zscale = 0.0f - zscale;
}
D_802DFEA0[0] = 0;
D_802DFEA0[1] = camRelativeYaw;
D_802DFEA0[2] = 0;
if (spriteInstanceID & 0x80000000) {
if (arg2 == 0) {
return 0;
}
alpha = arg2 & 0xFF;
} else {
alpha = 255;
}
compList = spr_playerCurrentAnimInfo[spriteAnimIndex].componentList;
if (spriteInstanceID & 0x20000000) {
drawPalettes = paletteList;
}
while (*compList != PTR_LIST_END) {
SpriteComponent* comp = *compList;
spr_draw_component(alpha | 0x08000000, comp, *animList, rasterList, drawPalettes, zscale, mtx);
compList++;
if (*animList != PTR_LIST_END) {
animList++;
}
}
return 1;
}
#else
INCLUDE_ASM(void, "sprite", spr_draw_player_sprite, s32 arg0, s32 arg1, s32 arg2, s32 arg3, s32 arg4);
#endif
s32 func_802DDEC4(s32 arg0) {
return spr_playerCurrentAnimInfo[arg0].unk_08;
return spr_playerCurrentAnimInfo[arg0].notifyValue;
}
void func_802DDEE4(s32 arg0, s32 arg1, s32 arg2, s32 arg3, s32 arg4, s32 arg5, s32 arg6, s32 arg7) {
@ -571,7 +820,7 @@ void func_802DDEE4(s32 arg0, s32 arg1, s32 arg2, s32 arg3, s32 arg4, s32 arg5, s
componentListIt = spr_playerCurrentAnimInfo[arg0].componentList;
i = 0;
while (*componentListIt != (SpriteComponent*)-1) {
while (*componentListIt != PTR_LIST_END) {
component = *componentListIt;
if (arg1 == -1 || i == arg1) {
fold_update(component->unk_4C & 0xFF, arg2, arg3, arg4, arg5, arg6, arg7);
@ -610,74 +859,152 @@ void spr_get_player_raster_info(SpriteRasterInfo* out, s32 playerSpriteID, s32 r
PAL_PTR* spr_get_player_palettes(s32 spriteIndex) {
SpriteAnimData* sprites = spr_playerSprites[spriteIndex - 1];
if (sprites == NULL) {
return NULL;
} else {
return sprites->palettesOffset;
}
return sprites->palettesOffset;
}
INCLUDE_ASM(s32, "sprite", spr_load_npc_sprite);
s32 spr_load_npc_sprite(s32 animID, u32* extraAnimList) {
SpriteAnimData* animData;
SpriteComponent** compList;
s32 listIndex;
s32 i;
s32 spriteIndex = (animID >> 0x10) & 0x7FFF;
s32 useTailAlloc = (u32)animID >> 0x1F;
for (i = 0; i < ARRAY_COUNT(SpriteInstances); i++) {
if (SpriteInstances[i].spriteIndex == 0) {
break;
}
}
if (MaxLoadedSpriteInstanceID < i) {
MaxLoadedSpriteInstanceID = i;
}
if (i == ARRAY_COUNT(SpriteInstances)) {
return -1;
}
listIndex = i;
if (NpcSpriteData[spriteIndex] != NULL) {
NpcSpriteInstanceCount[spriteIndex]++;
animData = NpcSpriteData[spriteIndex];
SpriteInstances[listIndex].spriteData = animData;
} else {
NpcSpriteInstanceCount[spriteIndex] = 1;
animData = spr_load_sprite(spriteIndex - 1, FALSE, useTailAlloc);
SpriteInstances[listIndex].spriteData = animData;
NpcSpriteData[spriteIndex] = animData;
if (extraAnimList != NULL) {
spr_load_npc_extra_anims(animData, extraAnimList);
}
}
compList = spr_allocate_components(animData->maxComponents);
SpriteInstances[listIndex].componentList = compList;
while (*compList != PTR_LIST_END) {
SpriteComponent* comp = *compList;
comp->unk_4C = func_8013A704(1);
compList++;
}
SpriteInstances[listIndex].spriteIndex = spriteIndex;
SpriteInstances[listIndex].currentAnimID = -1;
return listIndex;
}
// animList being odd
#ifdef NON_MATCHING
s32 spr_update_sprite(s32 spriteInstanceID, s32 animID, f32 timeScale) {
SpriteAnimData* animData;
SpriteComponent** compList;
SpriteAnimComponent** animList;
SpriteRasterCacheEntry** rasterList;
s32 palID;
s32 i = spriteInstanceID & 0xFF;
s32 animIndex = animID & 0xFF;
animData = SpriteInstances[i].spriteData;
compList = SpriteInstances[i].componentList;
animList = &animData->animListStart[animIndex];
rasterList = animData->rastersOffset;
palID = (animID >> 8) & 0xFF;
spr_set_anim_timescale(timeScale);
if ((spriteInstanceID < 0) || ((SpriteInstances[i].currentAnimID & 0xFF) != animIndex)) {
spr_init_anim_state(compList, animList);
SpriteInstances[i].currentAnimID = (palID << 8) | animIndex;
SpriteInstances[i].notifyValue = 0;
}
if (!(spriteInstanceID & 0x40000000)) {
SpriteInstances[i].notifyValue = spr_component_update(SpriteInstances[i].notifyValue,
compList, animList, rasterList, palID);
}
return SpriteInstances[i].notifyValue;
}
#else
INCLUDE_ASM(s32, "sprite", spr_update_sprite, s32 arg0, s32 arg1, f32 arg2);
#endif
INCLUDE_ASM(void, "sprite", spr_draw_npc_sprite, s32 arg0, s32 arg1, s32 arg2, s32 arg3, Matrix4f* arg4);
s32 func_802DE5C8(s32 arg0) {
return D_802DFA48[arg0].unk_10;
s32 spr_get_notify_value(s32 spriteIndex) {
return SpriteInstances[spriteIndex].notifyValue;
}
s32 spr_free_sprite(s32 spriteInstanceID) {
SpriteInstance* sprite = &D_802DFA48[spriteInstanceID];
SpriteInstance* sprite = &SpriteInstances[spriteInstanceID];
SpriteAnimData* spriteData;
SpriteComponent** compList;
s32 spriteIndex = sprite->spriteIndex;
SpriteHeader* spriteData;
SpriteComponent** comps;
if (spriteIndex == 0 || spriteIndex >= ARRAY_COUNT(spr_npcSprites)) {
if (spriteIndex == 0 || spriteIndex >= ARRAY_COUNT(NpcSpriteData)) {
return spriteInstanceID;
}
spr_npcSpriteInstanceCount[spriteIndex]--;
NpcSpriteInstanceCount[spriteIndex]--;
spriteData = sprite->spriteData;
comps = sprite->componentList;
while ((s32) *comps != -1) {
func_8013A854((u8) (*comps)->unk_4C);
comps++;
compList = sprite->componentList;
while (*compList != PTR_LIST_END) {
SpriteComponent* comp = *compList;
func_8013A854(comp->unk_4C & 0xFF);
compList++;
}
comps = D_802DFA48[spriteInstanceID].componentList;
compList = SpriteInstances[spriteInstanceID].componentList;
if (spr_npcSpriteInstanceCount[spriteIndex] == 0) {
spr_npcSprites[spriteIndex] = NULL;
if (NpcSpriteInstanceCount[spriteIndex] == 0) {
NpcSpriteData[spriteIndex] = NULL;
_heap_free(&gSpriteHeapPtr, spriteData);
}
if (spr_allocateBtlComponentsOnWorldHeap) {
_heap_free(&heap_generalHead, comps);
_heap_free(&heap_generalHead, compList);
} else {
_heap_free(&gSpriteHeapPtr, comps);
_heap_free(&gSpriteHeapPtr, compList);
}
D_802DFA48[spriteInstanceID].spriteIndex = 0;
D_802DFA48[spriteInstanceID].componentList = NULL;
D_802DFA48[spriteInstanceID].spriteData = NULL;
D_802DFA48[spriteInstanceID].currentAnimID = -1;
SpriteInstances[spriteInstanceID].spriteIndex = 0;
SpriteInstances[spriteInstanceID].componentList = NULL;
SpriteInstances[spriteInstanceID].spriteData = NULL;
SpriteInstances[spriteInstanceID].currentAnimID = -1;
return 0;
}
s32 func_802DE748(s32 spriteIdx, s32 compIdx) {
SpriteComponent** componentList = D_802DFA48[spriteIdx].componentList;
SpriteComponent** componentList = SpriteInstances[spriteIdx].componentList;
if (componentList == NULL) {
return -1;
} else {
return componentList[compIdx]->unk_4C & 0xFF;
}
return componentList[compIdx]->unk_4C & 0xFF;
}
void func_802DE780(s32 spriteIdx, s32 compIdx, s32 foldType, s32 foldArg0, s32 foldArg1, s32 foldArg2, s32 foldArg3, s32 foldArg4) {
SpriteInstance* sprite = &D_802DFA48[spriteIdx];
SpriteInstance* sprite = &SpriteInstances[spriteIdx];
SpriteComponent** componentList;
s32 i;
@ -685,7 +1012,7 @@ void func_802DE780(s32 spriteIdx, s32 compIdx, s32 foldType, s32 foldArg0, s32 f
componentList = sprite->componentList;
i = 0;
while ((s32) *componentList != -1) {
while (*componentList != PTR_LIST_END) {
SpriteComponent* comp = *componentList;
if (compIdx == -1 || i == compIdx) {
@ -709,7 +1036,7 @@ void func_802DE894(s32 spriteIdx, s32 foldType, s32 foldArg0, s32 foldArg1, s32
// animList issue
#ifdef NON_MATCHING
s32 func_802DE8DC(s32 spriteIdx, s32 compListIdx, s32* outX, s32* outY, s32* outZ) {
SpriteInstance* sprite = &D_802DFA48[spriteIdx];
SpriteInstance* sprite = &SpriteInstances[spriteIdx];
SpriteAnimComponent** animList;
SpriteComponent** compList;
SpriteAnimComponent* anim;
@ -729,7 +1056,7 @@ s32 func_802DE8DC(s32 spriteIdx, s32 compListIdx, s32* outX, s32* outY, s32* out
animList = sprite->spriteData[animID].animListStart;
compList = sprite->componentList;
i = 0;
while (*compList != (SpriteComponent*) -1) {
while (*compList != PTR_LIST_END) {
if (i == compListIdx) {
do {
anim = *animList;
@ -742,7 +1069,7 @@ s32 func_802DE8DC(s32 spriteIdx, s32 compListIdx, s32* outX, s32* outY, s32* out
}
i++;
compList++;
if (*animList != (SpriteAnimComponent*) -1) {
if (*animList != PTR_LIST_END) {
animList++;
}
}
@ -753,17 +1080,15 @@ INCLUDE_ASM(s32, "sprite", func_802DE8DC);
#endif
s32 spr_get_npc_raster_info(SpriteRasterInfo* out, s32 npcSpriteID, s32 rasterIndex) {
SpriteAnimData* sprite = spr_npcSprites[npcSpriteID];
SpriteAnimData* sprite = NpcSpriteData[npcSpriteID];
SpriteRasterCacheEntry* cache;
u16** paletteOffsetCopy;
s32 newVar;
PAL_PTR* paletteOffsetCopy;
if (sprite != NULL) {
paletteOffsetCopy = sprite->palettesOffset;
cache = sprite->rastersOffset[rasterIndex];
out->raster = cache->image;
out->width = cache->width;
newVar = npcSpriteID;
out->height = cache->height;
out->defaultPal = paletteOffsetCopy[cache->palette];
return TRUE;
@ -772,19 +1097,21 @@ s32 spr_get_npc_raster_info(SpriteRasterInfo* out, s32 npcSpriteID, s32 rasterIn
}
PAL_PTR* spr_get_npc_palettes(s32 npcSpriteID) {
SpriteAnimData* sprite = spr_npcSprites[npcSpriteID];
SpriteAnimData* sprite = NpcSpriteData[npcSpriteID];
if (sprite != NULL) {
return sprite->palettesOffset;
} else {
return NULL;
}
return NULL;
}
s32 spr_get_npc_color_variations(s32 npcSpriteID) {
SpriteAnimData* sprite = spr_npcSprites[npcSpriteID];
SpriteAnimData* sprite = NpcSpriteData[npcSpriteID];
if (sprite != NULL) {
return sprite->colorVariations;
} else {
return -1;
}
return -1;
}

View File

@ -15,8 +15,8 @@ enum SpriteIDFields {
typedef struct SpriteComponent {
/* 0x00 */ s32 initialized;
/* 0x04 */ s32 unk_04;
/* 0x08 */ s16** readPos;
/* 0x04 */ s32 properties; ///< AABBCCCC : AA = unused?, BB = parent, CCCC = notify value
/* 0x08 */ s16* readPos;
/* 0x0C */ f32 waitTime;
/* 0x10 */ s32 loopCounter;
/* 0x14 */ s32 currentRaster;
@ -31,11 +31,11 @@ typedef struct SpriteComponent {
typedef struct PlayerCurrentAnimInfo {
/* 0x00 */ SpriteComponent** componentList;
/* 0x04 */ s32 animID;
/* 0x08 */ s32 unk_08;
/* 0x08 */ s32 notifyValue;
} PlayerCurrentAnimInfo; // size = 0xC
typedef struct SpriteAnimComponent {
/* 0x00 */ s16** cmdList;
/* 0x00 */ u16* cmdList;
/* 0x04 */ s16 cmdListSize;
/* 0x06 */ Vec3s compOffset;
} SpriteAnimComponent; // size = 0xC
@ -49,20 +49,21 @@ typedef struct SpriteRasterCacheEntry {
/* 0x07 */ s8 quadCacheIndex;
} SpriteRasterCacheEntry; // size = 0x8
typedef struct SpriteHeader {
/* 0x00 */ SpriteRasterCacheEntry* rasterList;
/* 0x04 */ s16** paletteList;
/// Sprite data header.
typedef struct SpriteAnimData {
/* 0x00 */ SpriteRasterCacheEntry** rastersOffset;
/* 0x04 */ PAL_PTR* palettesOffset;
/* 0x08 */ s32 maxComponents;
/* 0x0C */ s32 colorVariants;
/* 0x0C */ s32 colorVariations;
/* 0x10 */ SpriteAnimComponent** animListStart;
} SpriteHeader; // size = 0x14
} SpriteAnimData; // size = 0x14
typedef struct SpriteInstance {
/* 0x00 */ s32 spriteIndex;
/* 0x04 */ SpriteComponent** componentList;
/* 0x08 */ SpriteHeader* spriteData;
/* 0x08 */ SpriteAnimData* spriteData;
/* 0x0C */ s32 currentAnimID;
/* 0x10 */ s32 unk_10;
/* 0x10 */ s32 notifyValue;
} SpriteInstance; // size = 0x14
typedef struct PlayerSpriteSet {
@ -84,19 +85,6 @@ typedef struct PlayerSpriteCacheEntry {
/* 0x0C */ IMG_PTR raster;
} PlayerSpriteCacheEntry; // size = 0x10
/// Sprite data header.
typedef struct SpriteAnimData {
/* 0x00 */ SpriteRasterCacheEntry** rastersOffset;
/* 0x04 */ PAL_PTR* palettesOffset;
/* 0x08 */ s32 maxComponents;
/* 0x0C */ s32 colorVariations;
} SpriteAnimData; // size = 0x10
typedef struct UnkSpriteThing {
/* 0x00 */ char unk_00[0x6];
/* 0x06 */ Vec3s unk_06;
} UnkSpriteThing; // size = ??
typedef struct Quad {
Vtx v[4];
} Quad; // size = 0x40
@ -142,7 +130,7 @@ s32 spr_update_sprite(s32 spriteInstanceID, s32 animID, f32 timeScale);
s32 spr_draw_npc_sprite(s32 spriteInstanceID, s32 yaw, s32 arg2, PAL_PTR* paletteList, Matrix4f mtx);
s32 func_802DE5C8(s32 arg0);
s32 spr_get_notify_value(s32 arg0);
s32 spr_free_sprite(s32 spriteInstanceID);

View File

@ -66,7 +66,7 @@ void action_hammer_play_hit_fx(s32 hitID) {
soundID = SOUND_2118;
}
theta = (func_800E5348() * TAU) / 360.0f;
theta = DEG_TO_RAD(func_800E5348());
sinTheta = sin_rad(theta) * 25.0f;
cosTheta = cos_rad(theta) * -25.0f;
@ -133,7 +133,7 @@ s32 func_802B62A4_E25174(void) {
}
}
sin_cos_rad(yaw * TAU / 360.0f, &outSinTheta, &outCosTheta);
sin_cos_rad(DEG_TO_RAD(yaw), &outSinTheta, &outCosTheta);
playerX = playerStatus->position.x;
playerY = playerStatus->position.y;
playerZ = playerStatus->position.z;
@ -163,7 +163,7 @@ s32 func_802B62A4_E25174(void) {
}
}
sin_cos_rad(yaw * TAU / 360.0f, &outSinTheta, &outCosTheta);
sin_cos_rad(DEG_TO_RAD(yaw), &outSinTheta, &outCosTheta);
for (i = 1; i < 16; i++) {
x = playerX + (outSinTheta * i);
y = playerY;
@ -236,7 +236,7 @@ void action_update_hammer(void) {
HammerHit->timer = 0;
playerStatus->actionSubstate = SUBSTATE_HAMMER_0;
playerStatus->currentSpeed = 0.0f;
playerStatus->unk_BC = 0;
playerStatus->animNotifyValue = 0;
HammerHit->hitID = func_802B62A4_E25174();
if (gPlayerData.hammerLevel == 2) {
@ -309,7 +309,7 @@ void func_802B6820_E256F0(void) {
}
}
sin_cos_rad(yaw * TAU / 360.0f, &outSinTheta, &outCosTheta);
sin_cos_rad(DEG_TO_RAD(yaw), &outSinTheta, &outCosTheta);
playerX = playerStatus->position.x;
playerY = playerStatus->position.y;
playerZ = playerStatus->position.z;
@ -344,7 +344,7 @@ void func_802B6820_E256F0(void) {
yaw += -15.0f;
}
}
sin_cos_rad(yaw * TAU / 360.0f, &outSinTheta, &outCosTheta);
sin_cos_rad(DEG_TO_RAD(yaw), &outSinTheta, &outCosTheta);
for (i = 1; i < 16; i++) {
x = playerX + (outSinTheta * i);
@ -406,10 +406,9 @@ void func_802B6820_E256F0(void) {
playerStatus->flags &= ~PS_FLAGS_200000;
}
unk_BC = playerStatus->unk_BC;
if (unk_BC == 1) {
if (playerStatus->animNotifyValue == 1) {
if (HammerHit->timer >= 7 && (playerStatus->pressedButtons & BUTTON_B)) {
HammerHit->unk_1C = unk_BC;
HammerHit->unk_1C = 1;
}
HammerHit->unk_14 = 0;

View File

@ -33,7 +33,7 @@ void action_update_hit_fire(void) {
gOverrideFlags |= GLOBAL_OVERRIDES_40;
}
sin_cos_rad(ReturnAngle * TAU / 360.0f, &dx, &dy);
sin_cos_rad(DEG_TO_RAD(ReturnAngle), &dx, &dy);
speed = playerStatus->currentSpeed;
if (playerStatus->flags & PS_FLAGS_40000) {

View File

@ -92,8 +92,8 @@ void action_update_hit_lava(void) {
fx_smoke_burst(0, playerStatus->position.x, playerStatus->position.y, playerStatus->position.z, 0.7f, 18);
}
if (playerStatus->position.y < playerStatus->gravityIntegrator[3] + playerStatus->gravityIntegrator[2]) {
sin_cos_rad((LaunchInterpPhase * TAU) / 360.0f, &dx, &dy);
LaunchVelocity = sin_rad((LaunchInterpPhase * TAU) / 360.0f) * 16.0f;
sin_cos_rad(DEG_TO_RAD(LaunchInterpPhase), &dx, &dy);
LaunchVelocity = sin_rad(DEG_TO_RAD(LaunchInterpPhase)) * 16.0f;
if (LaunchVelocity < -1.0f) {
LaunchVelocity = -1.0f;
}
@ -129,7 +129,7 @@ void action_update_hit_lava(void) {
break;
case SUBSTATE_RETURN_MOTION:
ReturnAngle = atan2(playerStatus->position.x, playerStatus->position.z, playerStatus->lastGoodPosition.x, playerStatus->lastGoodPosition.z);
returnRadians = ReturnAngle * TAU / 360.0f;
returnRadians = DEG_TO_RAD(ReturnAngle);
// update motion along x axis
componentSpeed = playerStatus->currentSpeed * sin_rad(returnRadians);
playerStatus->position.x += componentSpeed;

View File

@ -137,7 +137,7 @@ void action_update_idle_peach(void) {
break;
case SUBSTATE_IDLE_STRETCH:
// waiting for yawn to finish
if (playerStatus->unk_BC != 0) {
if (playerStatus->animNotifyValue != 0) {
playerStatus->actionSubstate++;
playerStatus->currentStateTime = 0;
suggest_player_anim_clearUnkFlag(ANIM_Peach_A0001);
@ -156,7 +156,7 @@ void action_update_idle_peach(void) {
if (playerStatus->flags & (PS_FLAGS_1000 | PS_FLAGS_INPUT_DISABLED)) {
suggest_player_anim_clearUnkFlag(ANIM_Peach_A0001);
playerStatus->actionSubstate = SUBSTATE_IDLE_DEFAULT;
} else if (playerStatus->unk_BC != 0) {
} else if (playerStatus->animNotifyValue != 0) {
suggest_player_anim_clearUnkFlag(ANIM_Peach_C0004);
}
break;

View File

@ -32,7 +32,7 @@ void action_update_knockback(void) {
playerStatus->currentSpeed = get_xz_dist_to_player(playerStatus->lastGoodPosition.x, playerStatus->lastGoodPosition.z) / 18.0f;
}
sin_cos_rad((ReturnAngle * TAU) / 360.0f, &dx, &dy);
sin_cos_rad(DEG_TO_RAD(ReturnAngle), &dx, &dy);
speed = playerStatus->currentSpeed;

View File

@ -74,12 +74,12 @@ void action_update_state_23(void) {
return;
}
sin_cos_rad((D_8010C990 * TAU) / 360.0f, &sinTheta, &cosTheta);
sin_cos_rad(DEG_TO_RAD(D_8010C990), &sinTheta, &cosTheta);
miscTempVariable = 3.0f;
miscTempVariable = sinTheta * miscTempVariable;
sin_cos_rad((D_802B6770_E27C80 * TAU) / 360.0f, &sinTheta, &cosTheta);
sin_cos_rad(DEG_TO_RAD(D_802B6770_E27C80), &sinTheta, &cosTheta);
playerXOffset = sinTheta * miscTempVariable;
playerZOffset = cosTheta * miscTempVariable;

View File

@ -102,7 +102,7 @@ void action_update_sliding(void) {
} else {
playerStatus->actionSubstate = SUBSTATE_LAUNCH;
}
sin_cos_rad((D_802B6790 * TAU) / 360.0f, &sinA, &cosA);
sin_cos_rad(DEG_TO_RAD(D_802B6790), &sinA, &cosA);
playerStatus->position.y += fabsf((sinA / cosA) * playerStatus->currentSpeed);
snd_stop_sound(SOUND_167);
break;
@ -158,7 +158,7 @@ void action_update_sliding(void) {
if (playerStatus->currentSpeed <= 0.0f) {
playerStatus->currentSpeed = 0.0f;
}
if (playerStatus->unk_BC != 0) {
if (playerStatus->animNotifyValue != 0) {
suggest_player_anim_setUnkFlag(ANIM_Mario_GetUp);
playerStatus->actionSubstate++; // SUBSTATE_GET_UP
}
@ -168,7 +168,7 @@ void action_update_sliding(void) {
if (playerStatus->currentSpeed <= 0.0f) {
playerStatus->currentSpeed = 0.0f;
}
if (playerStatus->unk_BC != 0) {
if (playerStatus->animNotifyValue != 0) {
suggest_player_anim_setUnkFlag(ANIM_Mario_DustOff);
sfx_play_sound_at_player(SOUND_DUST_OFF, 0);
playerStatus->currentStateTime = 15;

View File

@ -2,26 +2,51 @@
#include "npc.h"
#include "effects.h"
typedef struct SneakyParasolUnk {
s32 peach_disguise_check_overlaps(void);
void peach_force_disguise_action(s32);
typedef struct TransformationData {
/* 0x00 */ Npc* npc;
/* 0x04 */ s32 unk_04;
/* 0x08 */ s32 unk_08;
/* 0x0C */ s32 unk_0C;
/* 0x04 */ s32 reverted;
/* 0x08 */ s32 disguiseTime;
/* 0x0C */ s32 revertTime;
/* 0x10 */ Vec3f position;
/* 0x1C */ f32 unk_1C;
/* 0x20 */ f32 unk_20;
} SneakyParasolUnk;
/* 0x1C */ f32 playerRotationRate;
/* 0x20 */ f32 playerYawOffset;
} TransformationData;
extern SneakyParasolUnk D_802B6E80;
enum {
SUBSTATE_DISGUISE_INIT = 0,
SUBSTATE_USE_PARASOL = 1, // get parasol out and try copying an npc
SUBSTATE_PUT_AWAY = 2, // put the parasol away
SUBSTATE_DISGUISE_BEGIN = 3,
SUBSTATE_DISGUISE_WAIT_FOR_ANGLE = 4, // sparkales?
SUBSTATE_DISGUISE_MAKE_NPC = 5, // npc?
SUBSTATE_DISGUISE_SPIN_DOWN = 6,
SUBSTATE_DISGUISE_FINISH_SPIN = 7,
SUBSTATE_DISGUISE_DONE = 8,
SUBSTATE_REVERT_INIT = 20, // begin undisguise process
SUBSTATE_REVERT_WAIT_FOR_ANGLE = 21,
SUBSTATE_SPIN_DOWN = 22,
SUBSTATE_FINISH_SPIN = 23,
SUBSTATE_REVERT_DONE = 24,
SUBSTATE_ABORT = 26,
SUBSTATE_FAILED = 40,
SUBSTATE_BLOCKED = 50, // cant raise parasol due to collisions with world
};
Npc* func_802B6000_E2A6B0(void) {
extern TransformationData ParasolTransformation;
void parasol_update_spin(void);
Npc* parasol_get_npc(void) {
PlayerStatus* playerStatus = &gPlayerStatus;
f32 angle;
Npc* ret = NULL;
do { // TODO fix this do...while
if (playerStatus->unk_0D != 0) {
if (gGameStatusPtr->peachFlags & 8) {
gGameStatusPtr->peachFlags &= ~0x8;
if (playerStatus->availableDisguiseType != 0) {
if (gGameStatusPtr->peachFlags & PEACH_STATUS_FLAG_8) {
gGameStatusPtr->peachFlags &= ~PEACH_STATUS_FLAG_8;
} else {
ret = npc_find_closest(playerStatus->position.x, playerStatus->position.y, playerStatus->position.z, 100.0f);
if (ret != 0) {
@ -42,119 +67,115 @@ Npc* func_802B6000_E2A6B0(void) {
void action_update_parasol(void) {
PlayerStatus* playerStatus = &gPlayerStatus;
SneakyParasolUnk* parasolStruct = &D_802B6E80;
TransformationData* transformation = &ParasolTransformation;
Camera* cam = &gCameras[gCurrentCameraID];
GameStatus* gameStatus;
GameStatus* gameStatus2;
Npc* temp_v0;
Npc* disguiseNpc;
f32* tempUnk_1C;
f32 temp_f0_3;
f32 temp_f20;
f32 temp_f20_2;
f32 tempX;
f64 tempZ;
f64 temp_f22;
s32 temp_v0_4;
f32 prevFacingAngle;
f32 phi_f4;
s32 phi_v0;
s32 phi_v0_2;
f32 phi_f12;
f32 phi_f12_2;
f32 phi_f20;
f32 phi_f22;
s32 reachedTangentAngle;
f32 angle;
f32 radius;
if (playerStatus->flags & PS_FLAGS_ACTION_STATE_CHANGED) {
playerStatus->flags &= ~PS_FLAGS_ACTION_STATE_CHANGED;
mem_clear(&D_802B6E80, sizeof(D_802B6E80));
mem_clear(&ParasolTransformation, sizeof(ParasolTransformation));
disable_player_static_collisions();
tempUnk_1C = &parasolStruct->unk_1C;
tempUnk_1C = &transformation->playerRotationRate;
playerStatus->timeInAir = 0;
playerStatus->unk_C2 = 0;
playerStatus->currentSpeed = 0;
playerStatus->pitch = 0;
phi_f4 = -2;
if (playerStatus->spriteFacingAngle >= 90 && playerStatus->spriteFacingAngle < 270) {
phi_f4 = 2;
} else {
phi_f4 = -2;
}
*tempUnk_1C = phi_f4;
if (!(playerStatus->animFlags & PA_FLAGS_IN_DISGUISE)) {
playerStatus->currentStateTime = 20;
playerStatus->actionSubstate = 0;
parasolStruct->unk_08 = 0xF;
parasolStruct->npc = func_802B6000_E2A6B0();
playerStatus->actionSubstate = SUBSTATE_DISGUISE_INIT;
transformation->disguiseTime = 15;
transformation->npc = parasol_get_npc();
} else {
playerStatus->actionSubstate = 0x14;
playerStatus->actionSubstate = SUBSTATE_REVERT_INIT;
playerStatus->currentStateTime = 40;
parasolStruct->unk_04 = 1;
parasolStruct->unk_0C = 0xC;
temp_v0 = get_npc_by_index(D_8010C96C);
temp_v0->flags |= 0x40000;
playerStatus->flags |= 0x100000;
transformation->reverted = 1;
transformation->revertTime = 12;
disguiseNpc = get_npc_by_index(PeachDisguiseNpcIndex);
disguiseNpc->flags |= NPC_FLAG_40000;
playerStatus->flags |= PS_FLAGS_100000;
sfx_play_sound_at_player(SOUND_FD, 0);
}
}
switch (playerStatus->actionSubstate) {
case 0:
case SUBSTATE_DISGUISE_INIT:
if (playerStatus->flipYaw[CAM_DEFAULT] == 0) {
if (peach_disguise_check_overlaps() < 0) {
suggest_player_anim_clearUnkFlag(ANIM_Peach_C0024);
sfx_play_sound_at_player(SOUND_92, 0);
playerStatus->actionSubstate++;
playerStatus->actionSubstate++; // SUBSTATE_USE_PARASOL
} else {
suggest_player_anim_clearUnkFlag(ANIM_Peach_C0027);
playerStatus->actionSubstate = 0x32;
playerStatus->actionSubstate = SUBSTATE_BLOCKED;
playerStatus->currentStateTime = 10;
parasolStruct->unk_08 = 0;
transformation->disguiseTime = 0;
}
}
case 1:
case SUBSTATE_USE_PARASOL:
if (--playerStatus->currentStateTime == 0) {
suggest_player_anim_clearUnkFlag(ANIM_Peach_C0025);
playerStatus->actionSubstate = 2;
if (parasolStruct->npc == NULL) {
playerStatus->actionSubstate = 0x28;
playerStatus->actionSubstate = SUBSTATE_PUT_AWAY;
if (transformation->npc == NULL) {
playerStatus->actionSubstate = SUBSTATE_FAILED;
} else {
set_time_freeze_mode(TIME_FREEZE_FULL);
}
}
break;
case 2:
if (playerStatus->unk_BC != 0) {
case SUBSTATE_PUT_AWAY:
if (playerStatus->animNotifyValue != 0) {
playerStatus->currentStateTime = 12;
playerStatus->flags |= 0x100000;
playerStatus->actionSubstate++;
playerStatus->flags |= PS_FLAGS_100000;
playerStatus->actionSubstate++; // SUBSTATE_DISGUISE_BEGIN
sfx_play_sound_at_player(SOUND_FD, 0);
}
break;
case 3:
case SUBSTATE_DISGUISE_BEGIN:
if (--playerStatus->currentStateTime == 0) {
playerStatus->currentStateTime = 10;
parasolStruct->unk_0C = 0xA;
playerStatus->actionSubstate++;
transformation->revertTime = 10;
playerStatus->actionSubstate++; // SUBSTATE_DISGUISE_WAIT_FOR_ANGLE
}
func_802B6CF0_E2B3A0();
parasol_update_spin();
break;
case 4:
temp_f20 = playerStatus->spriteFacingAngle;
func_802B6CF0_E2B3A0();
case SUBSTATE_DISGUISE_WAIT_FOR_ANGLE:
prevFacingAngle = playerStatus->spriteFacingAngle;
parasol_update_spin();
playerStatus->targetYaw = clamp_angle((cam->currentYaw - playerStatus->spriteFacingAngle) - 90);
if (playerStatus->currentStateTime == 0) {
phi_v0 = 0;
if (parasolStruct->unk_1C > 0) {
if (temp_f20 < 270 && playerStatus->spriteFacingAngle >= 270) {
phi_v0 = 1;
// wait for the sprite to rotate into a position where it's tangent to the camera
reachedTangentAngle = FALSE;
if (transformation->playerRotationRate > 0) {
if (prevFacingAngle < 270 && playerStatus->spriteFacingAngle >= 270) {
reachedTangentAngle = TRUE;
}
}
if (parasolStruct->unk_1C < 0 && temp_f20 > 270 && playerStatus->spriteFacingAngle <= 270) {
phi_v0 = 1;
if (transformation->playerRotationRate < 0) {
if (prevFacingAngle > 270 && playerStatus->spriteFacingAngle <= 270) {
reachedTangentAngle = TRUE;
}
}
if (phi_v0 != 0) {
playerStatus->actionSubstate = 6;
if (reachedTangentAngle) {
playerStatus->actionSubstate = SUBSTATE_DISGUISE_SPIN_DOWN;
playerStatus->currentStateTime = 2;
if (peach_make_disguise_npc(playerStatus->unk_0D) != 0) {
playerStatus->actionSubstate = 5;
if (peach_make_disguise_npc(playerStatus->availableDisguiseType) != NULL) {
playerStatus->actionSubstate = SUBSTATE_DISGUISE_MAKE_NPC;
peach_sync_disguise_npc();
}
}
@ -162,156 +183,147 @@ void action_update_parasol(void) {
playerStatus->currentStateTime--;
}
break;
case 5:
case SUBSTATE_DISGUISE_MAKE_NPC:
gameStatus = gGameStatusPtr;
playerStatus->animFlags |= 0x2000;
gameStatus->peachFlags |= 2;
playerStatus->actionSubstate++;
case 6:
playerStatus->animFlags |= PA_FLAGS_IN_DISGUISE;
gameStatus->peachFlags |= PEACH_STATUS_FLAG_DISGUISED;
playerStatus->actionSubstate++; // SUBSTATE_DISGUISE_SPIN_DOWN
case SUBSTATE_DISGUISE_SPIN_DOWN:
if (--playerStatus->currentStateTime == 0) {
playerStatus->actionSubstate++;
playerStatus->actionSubstate++; // SUBSTATE_DISGUISE_FINISH_SPIN
}
func_802B6CF0_E2B3A0();
parasol_update_spin();
break;
case 7:
if (parasolStruct->unk_1C > 0.0f) {
parasolStruct->unk_20 -= 2.35;
if (parasolStruct->unk_20 <= 0) {
parasolStruct->unk_20 = 0;
case SUBSTATE_DISGUISE_FINISH_SPIN:
if (transformation->playerRotationRate > 0.0f) {
transformation->playerYawOffset -= 2.35;
if (transformation->playerYawOffset <= 0) {
transformation->playerYawOffset = 0;
playerStatus->currentStateTime = 10;
playerStatus->actionSubstate++;
playerStatus->actionSubstate++; // SUBSTATE_DISGUISE_DONE
playerStatus->spriteFacingAngle = 180;
temp_v0 = get_npc_by_index(D_8010C96C);
temp_v0->isFacingAway = 1;
temp_f0_3 = clamp_angle((cam->currentYaw - playerStatus->spriteFacingAngle) - 90);
temp_v0_4 = temp_f0_3;
temp_v0->yaw = temp_f0_3;
temp_v0->yawCamOffset = temp_v0_4;
disguiseNpc = get_npc_by_index(PeachDisguiseNpcIndex);
disguiseNpc->isFacingAway = 1;
disguiseNpc->yaw = clamp_angle((cam->currentYaw - playerStatus->spriteFacingAngle) - 90);
disguiseNpc->yawCamOffset = disguiseNpc->yaw;
}
} else {
parasolStruct->unk_20 += 2.35;
if (parasolStruct->unk_20 >= 0) {
parasolStruct->unk_20 = 0;
transformation->playerYawOffset += 2.35;
if (transformation->playerYawOffset >= 0) {
transformation->playerYawOffset = 0;
playerStatus->currentStateTime = 10;
playerStatus->spriteFacingAngle = 0;
playerStatus->actionSubstate++;
temp_v0 = get_npc_by_index(D_8010C96C);
temp_v0->isFacingAway = 0;
temp_f0_3 = clamp_angle((cam->currentYaw - playerStatus->spriteFacingAngle) - 90);
temp_v0_4 = temp_f0_3;
temp_v0->yaw = temp_f0_3;
temp_v0->yawCamOffset = temp_v0_4;
playerStatus->actionSubstate++; // SUBSTATE_DISGUISE_DONE
disguiseNpc = get_npc_by_index(PeachDisguiseNpcIndex);
disguiseNpc->isFacingAway = 0;
disguiseNpc->yaw = clamp_angle((cam->currentYaw - playerStatus->spriteFacingAngle) - 90);
disguiseNpc->yawCamOffset = disguiseNpc->yaw;
}
}
temp_f0_3 = clamp_angle(playerStatus->spriteFacingAngle + parasolStruct->unk_20);
playerStatus->spriteFacingAngle = temp_f0_3;
phi_f12_2 = cam->currentYaw - temp_f0_3;
playerStatus->targetYaw = clamp_angle(phi_f12_2 - 90);
playerStatus->spriteFacingAngle = clamp_angle(playerStatus->spriteFacingAngle + transformation->playerYawOffset);
playerStatus->targetYaw = clamp_angle((cam->currentYaw - playerStatus->spriteFacingAngle) - 90);
break;
case 8:
case SUBSTATE_DISGUISE_DONE:
if (--playerStatus->currentStateTime == 0) {
set_time_freeze_mode(TIME_FREEZE_NORMAL);
temp_v0 = get_npc_by_index(D_8010C96C);
temp_v0->flags &= ~0x40000;
playerStatus->flags &= ~0x100000;
disguiseNpc = get_npc_by_index(PeachDisguiseNpcIndex);
disguiseNpc->flags &= ~NPC_FLAG_40000;
playerStatus->flags &= ~PS_FLAGS_100000;
set_action_state(ACTION_STATE_IDLE);
enable_player_static_collisions();
}
break;
case 20:
case SUBSTATE_REVERT_INIT:
if (--playerStatus->currentStateTime == 0) {
playerStatus->actionSubstate++;
playerStatus->actionSubstate++; // SUBSTATE_REVERT_WAIT_FOR_ANGLE
}
func_802B6CF0_E2B3A0();
parasol_update_spin();
playerStatus->targetYaw = clamp_angle(cam->currentYaw - playerStatus->spriteFacingAngle - 90);
break;
case 21:
temp_f20_2 = playerStatus->spriteFacingAngle;
func_802B6CF0_E2B3A0();
case SUBSTATE_REVERT_WAIT_FOR_ANGLE:
prevFacingAngle = playerStatus->spriteFacingAngle;
parasol_update_spin();
playerStatus->targetYaw = clamp_angle((cam->currentYaw - playerStatus->spriteFacingAngle) - 90);
if (playerStatus->currentStateTime == 0) {
phi_v0_2 = 0;
if (parasolStruct->unk_1C > 0) {
if (temp_f20_2 < 270 && playerStatus->spriteFacingAngle >= 270) {
phi_v0_2 = 1;
// wait for the sprite to rotate into a position where it's tangent to the camera
reachedTangentAngle = FALSE;
if (transformation->playerRotationRate > 0) {
if (prevFacingAngle < 270 && playerStatus->spriteFacingAngle >= 270) {
reachedTangentAngle = TRUE;
}
}
if (parasolStruct->unk_1C < 0 && temp_f20_2 > 270 && playerStatus->spriteFacingAngle <= 270) {
phi_v0_2 = 1;
if (transformation->playerRotationRate < 0) {
if (prevFacingAngle > 270 && playerStatus->spriteFacingAngle <= 270) {
reachedTangentAngle = TRUE;
}
}
if (phi_v0_2 != 0) {
if (reachedTangentAngle) {
playerStatus->currentStateTime = 2;
playerStatus->actionSubstate++;
playerStatus->actionSubstate++; // SUBSTATE_SPIN_DOWN
gameStatus2 = gGameStatusPtr;
playerStatus->animFlags &= -0x2001;
gameStatus2->peachFlags &= 0xFD;
playerStatus->animFlags &= ~PA_FLAGS_IN_DISGUISE;
gameStatus2->peachFlags &= ~PEACH_STATUS_FLAG_DISGUISED;
playerStatus->peachDisguise = 0;
free_npc_by_index(D_8010C96C);
playerStatus->colliderHeight = 0x37;
playerStatus->colliderDiameter = 0x26;
free_npc_by_index(PeachDisguiseNpcIndex);
playerStatus->colliderHeight = 55;
playerStatus->colliderDiameter = 38;
}
} else {
playerStatus->currentStateTime--;
}
break;
case 22:
case SUBSTATE_SPIN_DOWN:
if (--playerStatus->currentStateTime == 0) {
playerStatus->actionSubstate++;
playerStatus->actionSubstate++; // SUBSTATE_FINISH_SPIN
}
func_802B6CF0_E2B3A0();
parasol_update_spin();
break;
case 23:
if (parasolStruct->unk_1C > 0) {
parasolStruct->unk_20 -= 2.35;
if (parasolStruct->unk_20 <= 0) {
parasolStruct->unk_20 = 0;
case SUBSTATE_FINISH_SPIN:
if (transformation->playerRotationRate > 0) {
transformation->playerYawOffset -= 2.35;
if (transformation->playerYawOffset <= 0) {
transformation->playerYawOffset = 0;
playerStatus->currentStateTime = 10;
playerStatus->actionSubstate++;
playerStatus->actionSubstate++; // SUBSTATE_REVERT_DONE
playerStatus->spriteFacingAngle = 180;
PrevPlayerDirection = 1;
phi_f12 = (cam->currentYaw - 180) - 90;
temp_f0_3 = clamp_angle((cam->currentYaw - 180) - 90);
PrevPlayerCamRelativeYaw = temp_f0_3;
playerStatus->currentYaw = temp_f0_3;
playerStatus->currentYaw = clamp_angle((cam->currentYaw - 180) - 90);
PrevPlayerCamRelativeYaw = playerStatus->currentYaw;
}
} else {
parasolStruct->unk_20 += 2.35;
if (parasolStruct->unk_20 >= 0) {
parasolStruct->unk_20 = 0;
transformation->playerYawOffset += 2.35;
if (transformation->playerYawOffset >= 0) {
transformation->playerYawOffset = 0;
playerStatus->currentStateTime = 10;
playerStatus->spriteFacingAngle = 0;
playerStatus->actionSubstate++;
playerStatus->actionSubstate++; // SUBSTATE_REVERT_DONE
PrevPlayerDirection = 0;
phi_f12 = (cam->currentYaw - 0) - 90;
temp_f0_3 = clamp_angle(phi_f12);
PrevPlayerCamRelativeYaw = temp_f0_3;
playerStatus->currentYaw = temp_f0_3;
playerStatus->currentYaw = clamp_angle((cam->currentYaw - 0) - 90);
PrevPlayerCamRelativeYaw = playerStatus->currentYaw;
}
}
temp_f0_3 = clamp_angle(playerStatus->spriteFacingAngle + parasolStruct->unk_20);
playerStatus->spriteFacingAngle = temp_f0_3;
playerStatus->targetYaw = clamp_angle(cam->currentYaw - temp_f0_3 - 90);
playerStatus->spriteFacingAngle = clamp_angle(playerStatus->spriteFacingAngle + transformation->playerYawOffset);
playerStatus->targetYaw = clamp_angle(cam->currentYaw - playerStatus->spriteFacingAngle - 90);
break;
case 24:
case SUBSTATE_REVERT_DONE:
if (--playerStatus->currentStateTime == 0) {
set_time_freeze_mode(TIME_FREEZE_NORMAL);
playerStatus->flags &= ~0x100000;
playerStatus->flags &= ~PS_FLAGS_100000;
set_action_state(ACTION_STATE_IDLE);
enable_player_static_collisions();
}
break;
case 26:
func_800E63A4(0);
case SUBSTATE_ABORT:
peach_force_disguise_action(FALSE);
enable_player_static_collisions();
break;
case 40:
if (playerStatus->unk_BC != 0) {
case SUBSTATE_FAILED:
if (playerStatus->animNotifyValue != 0) {
set_action_state(ACTION_STATE_IDLE);
enable_player_static_collisions();
}
break;
case 50:
case SUBSTATE_BLOCKED:
if (--playerStatus->currentStateTime == 0) {
set_action_state(ACTION_STATE_IDLE);
enable_player_static_collisions();
@ -319,60 +331,81 @@ void action_update_parasol(void) {
break;
}
if (parasolStruct->unk_08 > 0) {
if (--parasolStruct->unk_08 == 0xA) {
if (transformation->disguiseTime > 0) {
if (--transformation->disguiseTime == 10) {
if (playerStatus->spriteFacingAngle >= 90 && playerStatus->spriteFacingAngle < 270) {
phi_f20 = ((cam->currentYaw - 270) * TAU) / 360;
phi_f22 = 46;
angle = DEG_TO_RAD(cam->currentYaw - 270);
radius = 46;
} else {
phi_f20 = ((cam->currentYaw - 90) * TAU) / 360;
phi_f22 = 30;
angle = DEG_TO_RAD(cam->currentYaw - 90);
radius = 30;
}
parasolStruct->position.x = playerStatus->position.x + (phi_f22 * sin_rad(phi_f20));
parasolStruct->position.z = playerStatus->position.z - (phi_f22 * cos_rad(phi_f20));
parasolStruct->position.y = playerStatus->position.y - 20;
transformation->position.x = playerStatus->position.x + (radius * sin_rad(angle));
transformation->position.z = playerStatus->position.z - (radius * cos_rad(angle));
transformation->position.y = playerStatus->position.y - 20;
}
if (parasolStruct->unk_08 < 0xB && parasolStruct->unk_08 & 1) {
fx_sparkles(FX_SPARKLES_3, parasolStruct->position.x - 8, parasolStruct->position.y + 50, parasolStruct->position.z, 2);
temp_f22 = parasolStruct->position.x;
tempX = (((cam->currentYaw + playerStatus->spriteFacingAngle) - 90) * TAU) / 360;
if (transformation->disguiseTime <= 10 && transformation->disguiseTime & 1) {
f64 tempX, tempZ;
phi_f20 = tempX;
tempX = temp_f22 + (sin_rad(phi_f20) * 10.0);
tempZ = parasolStruct->position.z;
fx_sparkles(FX_SPARKLES_3,
transformation->position.x - 8,
transformation->position.y + 50,
transformation->position.z,
2);
parasolStruct->position.x = tempX;
parasolStruct->position.z = (tempZ - (cos_rad(phi_f20) * 10.0));
/*
TODO something like:
angle = DEG_TO_RAD((cam->currentYaw + playerStatus->spriteFacingAngle) - 90);
transformation->position.x += (10.0 * sin_rad(angle));
transformation->position.z -= (10.0 * cos_rad(angle));
*/
angle = DEG_TO_RAD((cam->currentYaw + playerStatus->spriteFacingAngle) - 90);
tempX = transformation->position.x;
tempX += 10.0 * sin_rad(angle);
transformation->position.x = tempX;
tempZ = transformation->position.z;
transformation->position.z = tempZ - (10.0 * cos_rad(angle));
}
} else if (parasolStruct->unk_08 == 0) {
parasolStruct->unk_08 = -1;
if (parasolStruct->npc != NULL) {
fx_pink_sparkles(playerStatus->unk_0D - 1, parasolStruct->npc->pos.x, parasolStruct->npc->pos.y, parasolStruct->npc->pos.z, 1, parasolStruct->npc->yawCamOffset);
} else if (transformation->disguiseTime == 0) {
transformation->disguiseTime = -1;
if (transformation->npc != NULL) {
fx_pink_sparkles(playerStatus->availableDisguiseType - 1,
transformation->npc->pos.x,
transformation->npc->pos.y,
transformation->npc->pos.z,
1, transformation->npc->yawCamOffset);
}
}
if (parasolStruct->unk_0C != 0) {
if (parasolStruct->unk_0C < 11) {
if (parasolStruct->unk_0C == 10) {
if (transformation->revertTime != 0) {
if (transformation->revertTime <= 10) {
if (transformation->revertTime == 10) {
sfx_play_sound_at_player(SOUND_FE, 0);
}
if ((parasolStruct->unk_0C & 3) == 0) {
fx_stars_shimmer(4, playerStatus->position.x, playerStatus->position.y, playerStatus->position.z, 50, 50, 0x28, 0x1E);
if ((transformation->revertTime & 3) == 0) {
fx_stars_shimmer(4,
playerStatus->position.x,
playerStatus->position.y,
playerStatus->position.z,
50, 50, 40, 30);
}
}
parasolStruct->unk_0C--;
transformation->revertTime--;
}
}
void func_802B6CF0_E2B3A0(void) {
void parasol_update_spin(void) {
PlayerStatus* playerStatus = &gPlayerStatus;
SneakyParasolUnk* temp = &D_802B6E80;
TransformationData* transformation = &ParasolTransformation;
temp->unk_20 += temp->unk_1C;
if (temp->unk_20 > 50.0f) {
temp->unk_20 = 50.0f;
} else if (temp->unk_20 < -50.0f) {
temp->unk_20 = -50.0f;
transformation->playerYawOffset += transformation->playerRotationRate;
if (transformation->playerYawOffset > 50.0f) {
transformation->playerYawOffset = 50.0f;
} else if (transformation->playerYawOffset < -50.0f) {
transformation->playerYawOffset = -50.0f;
}
playerStatus->spriteFacingAngle = clamp_angle(playerStatus->spriteFacingAngle + temp->unk_20);
playerStatus->spriteFacingAngle = clamp_angle(playerStatus->spriteFacingAngle + transformation->playerYawOffset);
}

View File

@ -166,8 +166,8 @@ void action_update_spin(void) {
}
angle = clamp_angle(playerStatus->targetYaw - gCameras[gCurrentCameraID].currentYaw);
playerSpinState->spinDirection.x = sin_rad(angle * TAU / 360.0f) * playerSpinState->spinDirectionMagnitude;
playerSpinState->spinDirection.y = -cos_rad((angle * TAU) / 360.0f) * playerSpinState->spinDirectionMagnitude;
playerSpinState->spinDirection.x = sin_rad(DEG_TO_RAD(angle)) * playerSpinState->spinDirectionMagnitude;
playerSpinState->spinDirection.y = -cos_rad(DEG_TO_RAD(angle)) * playerSpinState->spinDirectionMagnitude;
playerStatus->currentStateTime--;
if ((playerStatus->currentStateTime) == 0) {
playerSpinState->stopSoundTimer = 4;
@ -200,8 +200,8 @@ void action_update_spin(void) {
}
angle = clamp_angle(playerStatus->targetYaw - gCameras[gCurrentCameraID].currentYaw);
playerSpinState->spinDirection.x = sin_rad(angle * TAU / 360.0f) * playerSpinState->spinDirectionMagnitude;
playerSpinState->spinDirection.y = -cos_rad(angle * TAU / 360.0f) * playerSpinState->spinDirectionMagnitude;
playerSpinState->spinDirection.x = sin_rad(DEG_TO_RAD(angle)) * playerSpinState->spinDirectionMagnitude;
playerSpinState->spinDirection.y = -cos_rad(DEG_TO_RAD(angle)) * playerSpinState->spinDirectionMagnitude;
} else {
speedModifier = playerSpinState->speedScale - (playerStatus->currentStateTime - playerSpinState->fullSpeedSpinTime - 1) * playerSpinState->frictionScale;
if (speedModifier < 0.1) {

View File

@ -54,7 +54,7 @@ void action_update_step_up(void) {
}
integrate_gravity();
sin_cos_rad((playerStatus->targetYaw * TAU) / 360.0f, &sinTheta, &cosTheta);
sin_cos_rad(DEG_TO_RAD(playerStatus->targetYaw), &sinTheta, &cosTheta);
colliderID = -1;
playerStatus->position.x += sinTheta * 3.0f;
playerStatus->position.z -= cosTheta * 3.0f;

View File

@ -66,7 +66,7 @@ void action_update_use_munchlesia(void) {
}
break;
case SUBSTATE_CRASH:
if (playerStatus->unk_BC != 0) {
if (playerStatus->animNotifyValue != 0) {
suggest_player_anim_setUnkFlag(ANIM_Mario_GetUp);
playerStatus->actionSubstate = SUBSTATE_GET_UP;
playerStatus->currentStateTime = 15;

View File

@ -91,7 +91,7 @@ void action_update_use_spinning_flower(void) {
D_802B6EF4++;
}
D_802B6EE8 += 8.0f;
playerStatus->position.y = D_802B6EF4 + sin_rad(clamp_angle(D_802B6EE8) * TAU / 360.0f) * 4.0f;
playerStatus->position.y = D_802B6EF4 + sin_rad(DEG_TO_RAD(clamp_angle(D_802B6EE8))) * 4.0f;
if (SpinningFlower_EntityIndex >= 0) {
entityByIndex = get_entity_by_index(SpinningFlower_EntityIndex);
distToCenter = dist2D(entityByIndex->position.x, entityByIndex->position.z, playerStatus->position.x, playerStatus->position.z);
@ -99,16 +99,16 @@ void action_update_use_spinning_flower(void) {
if (distToCenter > 4.0f) {
distToCenter--;
}
sin_cos_rad(SpinningFlower_AngleToCenter * TAU / 360.0f, &dx, &dz);
sin_cos_rad(DEG_TO_RAD(SpinningFlower_AngleToCenter), &dx, &dz);
playerStatus->position.x = entityByIndex->position.x + (dx * distToCenter);
playerStatus->position.z = entityByIndex->position.z - (dz * distToCenter);
sin_cos_rad((SpinningFlower_AngleToCenter - 91.0f) * TAU / 360.0f, &dx, &dz);
sin_cos_rad(DEG_TO_RAD(SpinningFlower_AngleToCenter - 91.0f), &dx, &dz);
D_802B6ED4 = dx * D_802B6EDC;
D_802B6ED8 = -dz * D_802B6EDC;
}
game_input_to_move_vector(&inputAngle, &inputMagnitude);
if (inputMagnitude != 0.0f) {
sin_cos_rad((inputAngle * TAU) / 360.0f, &dx, &dz);
sin_cos_rad(DEG_TO_RAD(inputAngle), &dx, &dz);
inputMagnitude *= 0.03125f;
if (inputMagnitude < 0.1) {
inputMagnitude = 0.1f;
@ -145,7 +145,7 @@ void action_update_use_spinning_flower(void) {
playerStatus->flags &= ~PS_FLAGS_100000;
}
playerStatus->spriteFacingAngle = clamp_angle(playerStatus->spriteFacingAngle + D_802B6EE4);
sin_cos_rad((SpinningFlower_AngleToCenter - 60.0f) * TAU / 360.0f, &dx, &dz);
sin_cos_rad(DEG_TO_RAD(SpinningFlower_AngleToCenter - 60.0f), &dx, &dz);
D_802B6EDC += 0.2;
D_802B6EF0 -= 0.72;
D_802B6ED4 = dx * D_802B6EDC;
@ -177,16 +177,16 @@ void action_update_use_spinning_flower(void) {
if (distToCenter > 4.0f) {
distToCenter -= 1.0f;
}
sin_cos_rad(SpinningFlower_AngleToCenter * TAU / 360.0f, &dx, &dz);
sin_cos_rad(DEG_TO_RAD(SpinningFlower_AngleToCenter), &dx, &dz);
playerStatus->position.x = entityByIndex->position.x + (dx * distToCenter);
playerStatus->position.z = entityByIndex->position.z - (dz * distToCenter);
sin_cos_rad((SpinningFlower_AngleToCenter - 91.0f) * TAU / 360.0f, &dx, &dz);
sin_cos_rad(DEG_TO_RAD(SpinningFlower_AngleToCenter - 91.0f), &dx, &dz);
D_802B6ED4 = dx * D_802B6EDC;
D_802B6ED8 = -dz * D_802B6EDC;
}
D_802B6EE8 += 8.0f;
playerStatus->position.y = D_802B6EF4 + sin_rad(clamp_angle(D_802B6EE8) * TAU / 360.0f) * 4.0f;
playerStatus->position.y = D_802B6EF4 + sin_rad(DEG_TO_RAD(clamp_angle(D_802B6EE8))) * 4.0f;
gCameras[CAM_DEFAULT].targetPos.z = playerStatus->position.z;
gCameras[CAM_DEFAULT].targetPos.x = playerStatus->position.x;
gCameras[CAM_DEFAULT].targetPos.y = playerStatus->position.y;
@ -214,7 +214,7 @@ void action_update_use_spinning_flower(void) {
D_802B6EE0 = 45.0f;
}
ascentVelocity = sin_rad(D_802B6EE0 * TAU / 360.0f) * 4.0f;
ascentVelocity = sin_rad(DEG_TO_RAD(D_802B6EE0)) * 4.0f;
playerStatus->position.y += ascentVelocity;
gCameras[CAM_DEFAULT].targetPos.x = playerStatus->position.x;
gCameras[CAM_DEFAULT].targetPos.y = playerStatus->position.y;
@ -224,7 +224,7 @@ void action_update_use_spinning_flower(void) {
if (D_802BCE30 + 30 < playerStatus->position.y) {
playerStatus->actionSubstate++; // SUBSTATE_ASCEND_B
inputAngle = atan2(playerStatus->position.x, playerStatus->position.z, D_802BCE34, D_802BCE32);
sin_cos_rad(inputAngle * TAU / 360.0f, &dx, &dz);
sin_cos_rad(DEG_TO_RAD(inputAngle), &dx, &dz);
playerStatus->currentStateTime = 64;
SpinningFlower_AngleToCenter = inputAngle;
D_802B6ED4 = (dx * distToCenter) * 0.015625;
@ -246,7 +246,7 @@ void action_update_use_spinning_flower(void) {
if (D_802B6EE0-- < 0.0f) {
D_802B6EE0 = 0.0f;
}
ascentVelocity = 2.0f * sin_rad(D_802B6EE0 * TAU / 360.0f);
ascentVelocity = 2.0f * sin_rad(DEG_TO_RAD(D_802B6EE0));
playerStatus->position.x += D_802B6ED4;
playerStatus->position.y += ascentVelocity;
playerStatus->position.z += D_802B6ED8;
@ -267,7 +267,7 @@ void action_update_use_spinning_flower(void) {
if (D_802B6EE0 > 45.0f) {
D_802B6EE0 = 45.0f;
}
ascentVelocity = sin_rad(D_802B6EE0 * TAU / 360.0f) * 3.0f;
ascentVelocity = sin_rad(DEG_TO_RAD(D_802B6EE0)) * 3.0f;
playerStatus->position.y += ascentVelocity;
if (playerStatus->currentStateTime != 0) {
playerStatus->currentStateTime--;

View File

@ -33,7 +33,7 @@ void action_update_use_tweester(void) {
switch (playerStatus->actionSubstate) {
case SUBSTATE_LAUNCH:
sin_cos_rad((PlayerTweesterPhysics->angle * TAU) / 360.0f, &sinAngle, &cosAngle);
sin_cos_rad(DEG_TO_RAD(PlayerTweesterPhysics->angle), &sinAngle, &cosAngle);
playerStatus->position.x = entity->position.x + (sinAngle * PlayerTweesterPhysics->radius);
playerStatus->position.z = entity->position.z - (cosAngle * PlayerTweesterPhysics->radius);
@ -46,7 +46,7 @@ void action_update_use_tweester(void) {
PlayerTweesterPhysics->radius++;
}
liftoffVelocity = sin_rad((PlayerTweesterPhysics->liftoffVelocityPhase * TAU) / 360.0f) * 3.0f;
liftoffVelocity = sin_rad(DEG_TO_RAD(PlayerTweesterPhysics->liftoffVelocityPhase)) * 3.0f;
PlayerTweesterPhysics->liftoffVelocityPhase += 3.0f;
if (PlayerTweesterPhysics->liftoffVelocityPhase > 150.0f) {
PlayerTweesterPhysics->liftoffVelocityPhase = 150.0f;

View File

@ -20,6 +20,6 @@ ApiStatus func_80240000_ACAB20(Evt* script, s32 isInitialCall) {
ApiStatus func_80240034_ACAB54(Evt* script, s32 isInitialCall) {
Bytecode* args = script->ptrReadPos;
gPlayerStatus.unk_0D = evt_get_float_variable(script, *args++);
gPlayerStatus.availableDisguiseType = evt_get_float_variable(script, *args++);
return ApiStatus_DONE2;
}

View File

@ -22,6 +22,6 @@ ApiStatus func_80240000_ACE140(Evt* script, s32 isInitialCall) {
ApiStatus func_80240034_ACE174(Evt* script, s32 isInitialCall) {
Bytecode* args = script->ptrReadPos;
gPlayerStatus.unk_0D = evt_get_float_variable(script, *args++);
gPlayerStatus.availableDisguiseType = evt_get_float_variable(script, *args++);
return ApiStatus_DONE2;
}

View File

@ -16,6 +16,6 @@ ApiStatus func_80240000_AD4090(Evt* script, s32 isInitialCall) {
ApiStatus func_80240034_AD40C4(Evt* script, s32 isInitialCall) {
Bytecode* args = script->ptrReadPos;
gPlayerStatus.unk_0D = evt_get_float_variable(script, *args++);
gPlayerStatus.availableDisguiseType = evt_get_float_variable(script, *args++);
return ApiStatus_DONE2;
}

View File

@ -12,7 +12,7 @@ ApiStatus func_80240000_AED410(Evt* script, s32 isInitialCall) {
ApiStatus func_80240028_AED438(Evt* script, s32 isInitialCall) {
Bytecode* args = script->ptrReadPos;
gPlayerStatus.unk_0D = evt_get_float_variable(script, *args++);
gPlayerStatus.availableDisguiseType = evt_get_float_variable(script, *args++);
return ApiStatus_DONE2;
}

View File

@ -10,7 +10,7 @@ ApiStatus func_80240020_B028A0(Evt* script, s32 isInitialCall) {
ApiStatus func_80240048_B028C8(Evt* script, s32 isInitialCall) {
Bytecode* args = script->ptrReadPos;
gPlayerStatus.unk_0D = evt_get_float_variable(script, *args++);
gPlayerStatus.availableDisguiseType = evt_get_float_variable(script, *args++);
return ApiStatus_DONE2;
}

View File

@ -1,7 +1,7 @@
#include "kkj_23.h"
#include "effects.h"
void func_800E63A4(s32);
void peach_force_disguise_action(s32);
ApiStatus func_80240910_B03190(Evt* script, s32 isInitialCall) {
Bytecode* args = script->ptrReadPos;
@ -18,6 +18,6 @@ ApiStatus func_80240910_B03190(Evt* script, s32 isInitialCall) {
}
ApiStatus func_802409AC_B0322C(Evt* script, s32 isInitialCall) {
func_800E63A4(0);
peach_force_disguise_action(FALSE);
return ApiStatus_DONE2;
}

View File

@ -1,11 +1,56 @@
#include "mac_04.h"
INCLUDE_ASM(s32, "world/area_mac/mac_04/844860", func_80241C90_844860);
void func_80241D30_844900(void);
void func_80241DAC_84497C(void*);
INCLUDE_ASM(s32, "world/area_mac/mac_04/844860", func_80241CEC_8448BC);
ApiStatus func_80241C90_844860(Evt* script, s32 isInitialCall) {
gPlayerStatus.animFlags |= PA_FLAGS_IN_DISGUISE;
evt_set_variable(script, MapVar(11), create_generic_entity_world(NULL, func_80241D30_844900));
INCLUDE_ASM(s32, "world/area_mac/mac_04/844860", func_80241D30_844900);
return ApiStatus_DONE2;
}
ApiStatus func_80241CEC_8448BC(Evt* script, s32 isInitialCall) {
s32 index = evt_get_variable(script, MapVar(11));
gPlayerStatus.animFlags &= ~PA_FLAGS_IN_DISGUISE;
free_generic_entity(index);
return ApiStatus_DONE2;
}
void func_80241D30_844900(void) {
RenderTask renderTask;
s32 screenX, screenY, screenZ;
get_screen_coords(gCurrentCamID, gPlayerStatus.position.x, gPlayerStatus.position.y, gPlayerStatus.position.z, &screenX, &screenY, &screenZ);
renderTask.appendGfxArg = &gPlayerStatus;
renderTask.appendGfx = func_80241DAC_84497C;
renderTask.renderMode = gPlayerStatus.renderMode;
renderTask.distance = screenZ;
queue_render_task(&renderTask);
}
// problem with asm file improperly including strings "omo_03" and "kmr_22"
#ifdef NON_MATCHING
void func_80241DAC_84497C(PlayerStatus* playerStatus) {
f32 scale = evt_get_float_variable(NULL, MapVar(10));
f32 scale_2;
Matrix4f transformMtx;
Matrix4f tempMtx;
guRotateF(transformMtx, playerStatus->spriteFacingAngle, 0.0f, 1.0f, 0.0f);
scale_2 = (f32) ((f64) scale * SPRITE_WORLD_SCALE_D);
guScaleF(tempMtx, scale_2, scale_2, scale_2);
guMtxCatF(transformMtx, tempMtx, transformMtx);
guTranslateF(tempMtx, playerStatus->position.x, playerStatus->position.y, playerStatus->position.z);
guMtxCatF(transformMtx, tempMtx, transformMtx);
playerStatus->unk_BC = spr_update_player_sprite(0, playerStatus->trueAnimation, 1.0f);
spr_draw_player_sprite(0, 0, 0, NULL, transformMtx);
}
#else
INCLUDE_ASM(s32, "world/area_mac/mac_04/844860", func_80241DAC_84497C);
#endif
#include "world/common/SetEntityFlags100000.inc.c"

View File

@ -3,6 +3,6 @@
ApiStatus func_80240020_AB2190(Evt* script, s32 isInitialCall) {
Bytecode* args = script->ptrReadPos;
gPlayerStatus.unk_0D = evt_get_float_variable(script, *args++);
gPlayerStatus.availableDisguiseType = evt_get_float_variable(script, *args++);
return ApiStatus_DONE2;
}

View File

@ -48,14 +48,14 @@ ApiStatus func_802400FC_B1B66C(Evt *script, s32 isInitialCall)
dist = dist2D(npc->pos.x, npc->pos.z, -250.0f, -100.0f);
angle = evt_get_variable(script, LVar0) - 1;
sinAngle = sin_rad((angle * TAU) / 360.0f);
cosAngle = cos_rad((angle * TAU) / 360.0f);
sinAngle = sin_rad(DEG_TO_RAD(angle));
cosAngle = cos_rad(DEG_TO_RAD(angle));
x0 = dist * cosAngle;
z0 = dist * -sinAngle;
angle = evt_get_variable(script, LVar0);
sinAngle = sin_rad((angle * TAU) / 360.0f);
cosAngle = cos_rad((angle * TAU) / 360.0f);
sinAngle = sin_rad(DEG_TO_RAD(angle));
cosAngle = cos_rad(DEG_TO_RAD(angle));
x1 = dist * cosAngle;
z1 = dist * -sinAngle;

View File

@ -81,7 +81,7 @@ ApiStatus N(UnkFunc62)(Evt* script, s32 isInitialCall) {
state->unk_18.y = 0.0f;
phi_f20 = state->velocity;
temp_f22_2 = state->acceleration;
phi_f0 = sin_rad(state->unk_24 * TAU / 360.0f);
phi_f0 = sin_rad(DEG_TO_RAD(state->unk_24));
phi_f2 = 0.53;
state->velocity = phi_f20 + ((phi_f0 * phi_f2 * temp_f22_2) + temp_f22_2);
} else {
@ -99,7 +99,7 @@ ApiStatus N(UnkFunc62)(Evt* script, s32 isInitialCall) {
state->unk_18.y = 0.0f;
velocity = state->velocity;
temp_f22_3 = state->acceleration;
phi_f0 = sin_rad(state->unk_24 * TAU / 360.0f);
phi_f0 = sin_rad(DEG_TO_RAD(state->unk_24));
phi_f2 = 0.8;
state->velocity = velocity + ((phi_f0 * phi_f2 * temp_f22_3) + temp_f22_3);
}
@ -131,13 +131,13 @@ ApiStatus N(UnkFunc62)(Evt* script, s32 isInitialCall) {
if (state->moveArcAmplitude < 3) {
phi_f20_2 = state->velocity;
temp_f22_5 = state->acceleration;
phi_f0_2 = sin_rad((state->unk_24 * TAU) / 360.0f);
phi_f0_2 = sin_rad(DEG_TO_RAD(state->unk_24));
phi_f2_2 = 0.53;
state->velocity = phi_f20_2 + ((phi_f0_2 * phi_f2_2 * temp_f22_5) + temp_f22_5);
} else {
temp_f20_6 = state->velocity;
temp_f22_6 = state->acceleration;
phi_f0_2 = sin_rad((state->unk_24 * TAU) / 360.0f);
phi_f0_2 = sin_rad(DEG_TO_RAD(state->unk_24));
phi_f2_2 = 0.8;
state->velocity = temp_f20_6 + ((phi_f0_2 * phi_f2_2 * temp_f22_6) + temp_f22_6);
}
@ -167,8 +167,8 @@ ApiStatus N(UnkFunc62)(Evt* script, s32 isInitialCall) {
// fallthrough
case 3:
currentPosX64 = state->currentPos.x; // required to match
state->currentPos.x = currentPosX64 + state->bounceDivisor * sin_rad((state->unk_24 * TAU) / 360.0f) / 33.0;
state->currentPos.y -= state->bounceDivisor * sin_rad((state->unk_24 * TAU) / 360.0f);
state->currentPos.x = currentPosX64 + state->bounceDivisor * sin_rad(DEG_TO_RAD(state->unk_24)) / 33.0;
state->currentPos.y -= state->bounceDivisor * sin_rad(DEG_TO_RAD(state->unk_24));
state->unk_24 += state->unk_28;
state->unk_24 = clamp_angle(state->unk_24);
actor->currentPos.x = state->currentPos.x;

View File

@ -11,7 +11,7 @@ ApiStatus N(UnkFunc27)(Evt* script, s32 isInitialCall) {
s32 temp_s1 = testS1;
s32 temp_s2 = testS2;
if ((s32) temp_s0_3 == -1) {
if (temp_s0_3 == PTR_LIST_END) {
mdl_set_all_fog_mode(temp_s1);
return ApiStatus_DONE2;
}

View File

@ -118,7 +118,7 @@ ApiStatus func_802BD338_318088(Evt* script, s32 isInitialCall) {
bombette->flags |= NPC_FLAG_40000 | NPC_FLAG_100 | NPC_FLAG_40 | NPC_FLAG_ENABLE_HIT_SCRIPT;
bombette->flags &= ~NPC_FLAG_GRAVITY;
case 1:
sin_cos_rad((BombetteTweesterPhysicsPtr->angle * TAU) / 360.0f, &sinAngle, &cosAngle);
sin_cos_rad(DEG_TO_RAD(BombetteTweesterPhysicsPtr->angle), &sinAngle, &cosAngle);
bombette->pos.x = entity->position.x + (sinAngle * BombetteTweesterPhysicsPtr->radius);
bombette->pos.z = entity->position.z - (cosAngle * BombetteTweesterPhysicsPtr->radius);
BombetteTweesterPhysicsPtr->angle = clamp_angle(BombetteTweesterPhysicsPtr->angle - BombetteTweesterPhysicsPtr->angularVelocity);
@ -129,7 +129,7 @@ ApiStatus func_802BD338_318088(Evt* script, s32 isInitialCall) {
BombetteTweesterPhysicsPtr->radius++;
}
liftoffVelocity = sin_rad((BombetteTweesterPhysicsPtr->liftoffVelocityPhase * TAU) / 360.0f) * 3.0f;
liftoffVelocity = sin_rad(DEG_TO_RAD(BombetteTweesterPhysicsPtr->liftoffVelocityPhase)) * 3.0f;
BombetteTweesterPhysicsPtr->liftoffVelocityPhase += 3.0f;
if (BombetteTweesterPhysicsPtr->liftoffVelocityPhase > 150.0f) {

View File

@ -71,7 +71,7 @@ ApiStatus BowUpdate(Evt* script, s32 isInitialCall) {
bow->flags |= NPC_FLAG_40000 | NPC_FLAG_100 | NPC_FLAG_40 | NPC_FLAG_ENABLE_HIT_SCRIPT;
bow->flags &= ~NPC_FLAG_GRAVITY;
case 1:
sin_cos_rad((BowTweesterPhysicsPtr->angle * TAU) / 360.0f, &sinAngle, &cosAngle);
sin_cos_rad(DEG_TO_RAD(BowTweesterPhysicsPtr->angle), &sinAngle, &cosAngle);
bow->pos.x = entity->position.x + (sinAngle * BowTweesterPhysicsPtr->radius);
bow->pos.z = entity->position.z - (cosAngle * BowTweesterPhysicsPtr->radius);
BowTweesterPhysicsPtr->angle = clamp_angle(BowTweesterPhysicsPtr->angle - BowTweesterPhysicsPtr->angularVelocity);
@ -81,7 +81,7 @@ ApiStatus BowUpdate(Evt* script, s32 isInitialCall) {
BowTweesterPhysicsPtr->radius++;
}
liftoffVelocity = sin_rad((BowTweesterPhysicsPtr->liftoffVelocityPhase * TAU) / 360.0f) * 3.0f;
liftoffVelocity = sin_rad(DEG_TO_RAD(BowTweesterPhysicsPtr->liftoffVelocityPhase)) * 3.0f;
BowTweesterPhysicsPtr->liftoffVelocityPhase += 3.0f;
if (BowTweesterPhysicsPtr->liftoffVelocityPhase > 150.0f) {

View File

@ -97,7 +97,7 @@ s32 func_802BD1D0_3170F0(Evt* script, s32 isInitialCall) {
npc->flags |= NPC_FLAG_ENABLE_HIT_SCRIPT | NPC_FLAG_40 | NPC_FLAG_100 | NPC_FLAG_40000;
npc->flags &= ~NPC_FLAG_GRAVITY;
case 1:
sin_cos_rad((GoombarioTweesterPhysicsPtr->angle * TAU) / 360.0f, &sinAngle, &cosAngle);
sin_cos_rad(DEG_TO_RAD(GoombarioTweesterPhysicsPtr->angle), &sinAngle, &cosAngle);
npc->pos.x = entity->position.x + (sinAngle * GoombarioTweesterPhysicsPtr->radius);
npc->pos.z = entity->position.z - (cosAngle * GoombarioTweesterPhysicsPtr->radius);
@ -109,7 +109,7 @@ s32 func_802BD1D0_3170F0(Evt* script, s32 isInitialCall) {
GoombarioTweesterPhysicsPtr->radius++;
}
liftoffVelocity = sin_rad((GoombarioTweesterPhysicsPtr->liftoffVelocityPhase * TAU) / 360.0f) * 3.0f;
liftoffVelocity = sin_rad(DEG_TO_RAD(GoombarioTweesterPhysicsPtr->liftoffVelocityPhase)) * 3.0f;
GoombarioTweesterPhysicsPtr->liftoffVelocityPhase += 3.0f;
if (GoombarioTweesterPhysicsPtr->liftoffVelocityPhase > 150.0f) {

View File

@ -63,7 +63,7 @@ ApiStatus func_802BD14C_324A5C(Evt* script, s32 isInitialCall) {
goompa->flags |= NPC_FLAG_ENABLE_HIT_SCRIPT | NPC_FLAG_40 | NPC_FLAG_100 | NPC_FLAG_40000;
goompa->flags &= ~NPC_FLAG_GRAVITY;
case 1:
sin_cos_rad((GoompaTweesterPhysicsPtr->angle * TAU) / 360.0f, &sinAngle, &cosAngle);
sin_cos_rad(DEG_TO_RAD(GoompaTweesterPhysicsPtr->angle), &sinAngle, &cosAngle);
goompa->pos.x = entity->position.x + (sinAngle * GoompaTweesterPhysicsPtr->radius);
goompa->pos.z = entity->position.z - (cosAngle * GoompaTweesterPhysicsPtr->radius);
GoompaTweesterPhysicsPtr->angle = clamp_angle(GoompaTweesterPhysicsPtr->angle - GoompaTweesterPhysicsPtr->angularVelocity);
@ -74,7 +74,7 @@ ApiStatus func_802BD14C_324A5C(Evt* script, s32 isInitialCall) {
GoompaTweesterPhysicsPtr->radius++;
}
liftoffVelocity = sin_rad((GoompaTweesterPhysicsPtr->liftoffVelocityPhase * TAU) / 360.0f) * 3.0f;
liftoffVelocity = sin_rad(DEG_TO_RAD(GoompaTweesterPhysicsPtr->liftoffVelocityPhase)) * 3.0f;
GoompaTweesterPhysicsPtr->liftoffVelocityPhase += 3.0f;
if (GoompaTweesterPhysicsPtr->liftoffVelocityPhase > 150.0f) {

View File

@ -117,7 +117,7 @@ ApiStatus KooperUpdate(Evt* script, s32 isInitialCall) {
kooper->flags |= NPC_FLAG_40000 | NPC_FLAG_100 | NPC_FLAG_40 | NPC_FLAG_ENABLE_HIT_SCRIPT;
kooper->flags &= ~NPC_FLAG_GRAVITY;
case 1:
sin_cos_rad((KooperTweesterPhysicsPtr->angle * TAU) / 360.0f, &sinAngle, &cosAngle);
sin_cos_rad(DEG_TO_RAD(KooperTweesterPhysicsPtr->angle), &sinAngle, &cosAngle);
kooper->pos.x = entity->position.x + (sinAngle * KooperTweesterPhysicsPtr->radius);
kooper->pos.z = entity->position.z - (cosAngle * KooperTweesterPhysicsPtr->radius);
@ -129,7 +129,7 @@ ApiStatus KooperUpdate(Evt* script, s32 isInitialCall) {
KooperTweesterPhysicsPtr->radius++;
}
liftoffVelocity = sin_rad((KooperTweesterPhysicsPtr->liftoffVelocityPhase * TAU) / 360.0f) * 3.0f;
liftoffVelocity = sin_rad(DEG_TO_RAD(KooperTweesterPhysicsPtr->liftoffVelocityPhase)) * 3.0f;
KooperTweesterPhysicsPtr->liftoffVelocityPhase += 3.0f;

View File

@ -114,7 +114,7 @@ ApiStatus func_802BD2D4_320E24(Evt* script, s32 isInitialCall) {
lakilester->flags |= NPC_FLAG_40000 | NPC_FLAG_100 | NPC_FLAG_40 | NPC_FLAG_ENABLE_HIT_SCRIPT;
lakilester->flags &= ~NPC_FLAG_GRAVITY;
case 1:
sin_cos_rad((LakilesterTweesterPhysicsPtr->angle * TAU) / 360.0f, &sinAngle, &cosAngle);
sin_cos_rad(DEG_TO_RAD(LakilesterTweesterPhysicsPtr->angle), &sinAngle, &cosAngle);
lakilester->pos.x = entity->position.x + (sinAngle * LakilesterTweesterPhysicsPtr->radius);
lakilester->pos.z = entity->position.z - (cosAngle * LakilesterTweesterPhysicsPtr->radius);
LakilesterTweesterPhysicsPtr->angle = clamp_angle(LakilesterTweesterPhysicsPtr->angle - LakilesterTweesterPhysicsPtr->angularVelocity);
@ -125,7 +125,7 @@ ApiStatus func_802BD2D4_320E24(Evt* script, s32 isInitialCall) {
LakilesterTweesterPhysicsPtr->radius++;
}
liftoffVelocity = sin_rad((LakilesterTweesterPhysicsPtr->liftoffVelocityPhase * TAU) / 360.0f) * 3.0f;
liftoffVelocity = sin_rad(DEG_TO_RAD(LakilesterTweesterPhysicsPtr->liftoffVelocityPhase)) * 3.0f;
LakilesterTweesterPhysicsPtr->liftoffVelocityPhase += 3.0f;
if (LakilesterTweesterPhysicsPtr->liftoffVelocityPhase > 150.0f) {
@ -483,7 +483,7 @@ void func_802BDDD8_321928(Npc* npc) {
}
if (D_802BFF28 > 0.0f && raycastBelowResult >= 0) {
sin_cos_rad((D_802BFF28 * TAU) / 360.0f, &sp50, &sp54);
sin_cos_rad(DEG_TO_RAD(D_802BFF28), &sp50, &sp54);
npc->pos.y = (npc->pos.y + fabs((sp50 / sp54) * playerStatus->runSpeed));
}
@ -1152,7 +1152,7 @@ s32 func_802BFBA0_3236F0(Evt* script, s32 isInitialCall) {
sfx_play_sound_at_npc(SOUND_295, 0, -4);
playerStatus->anim = ANIM_Mario_8000E;
playerStatus->unk_BC = 0;
playerStatus->animNotifyValue = 0;
playerStatus->flags |= PS_FLAGS_10000000;
func_802BFB44_323694(2.0f);
gGameStatusPtr->keepUsingPartnerOnMapChange = 1;

View File

@ -73,7 +73,7 @@ ApiStatus ParakarryUpdate(Evt* script, s32 isInitialCall) {
parakarry->flags |= NPC_FLAG_40000 | NPC_FLAG_100 | NPC_FLAG_40 | NPC_FLAG_ENABLE_HIT_SCRIPT;
parakarry->flags &= ~NPC_FLAG_GRAVITY;
case 1:
sin_cos_rad((ParakarryTweesterPhysicsPtr->angle * TAU) / 360.0f, &sinAngle, &cosAngle);
sin_cos_rad(DEG_TO_RAD(ParakarryTweesterPhysicsPtr->angle), &sinAngle, &cosAngle);
parakarry->pos.x = entity->position.x + (sinAngle * ParakarryTweesterPhysicsPtr->radius);
parakarry->pos.z = entity->position.z - (cosAngle * ParakarryTweesterPhysicsPtr->radius);
ParakarryTweesterPhysicsPtr->angle = clamp_angle(ParakarryTweesterPhysicsPtr->angle - ParakarryTweesterPhysicsPtr->angularVelocity);
@ -84,7 +84,7 @@ ApiStatus ParakarryUpdate(Evt* script, s32 isInitialCall) {
ParakarryTweesterPhysicsPtr->radius++;
}
liftoffVelocity = sin_rad((ParakarryTweesterPhysicsPtr->liftoffVelocityPhase * TAU) / 360.0f) * 3.0f;
liftoffVelocity = sin_rad(DEG_TO_RAD(ParakarryTweesterPhysicsPtr->liftoffVelocityPhase)) * 3.0f;
ParakarryTweesterPhysicsPtr->liftoffVelocityPhase += 3.0f;
if (ParakarryTweesterPhysicsPtr->liftoffVelocityPhase > 150.0f) {
@ -302,7 +302,7 @@ ApiStatus func_802BD660_319BD0(Evt* evt, s32 isInitialCall) {
if (!((tempFrameCounter - tempFrameCounterU32 * 6) & 0xFFFF)) {
sfx_play_sound_at_npc(SOUND_2009, 0, -4);
}
sp2C = fabsf(sin_rad((20 - D_802BEBC4) * 18 * TAU / 360.0f)) * 1.3;
sp2C = fabsf(sin_rad(DEG_TO_RAD((20 - D_802BEBC4) * 18))) * 1.3;
playerStatus->position.y += sp2C;
parakarry->pos.y += sp2C;
x = parakarry->pos.x;

View File

@ -45,8 +45,8 @@ void func_802BD100_31DE70(void) {
phi_v1 = 8;
}
playerStatus->position.z -= cos_rad((cam->currentYaw + playerStatus->spriteFacingAngle - 90.0f + phi_v1) *
TAU / 360.0f) * -4.0f;
playerStatus->position.z -= cos_rad(DEG_TO_RAD(
cam->currentYaw + playerStatus->spriteFacingAngle - 90.0f + phi_v1)) * -4.0f;
}
void func_802BD20C_31DF7C(f32* arg0, f32* arg1) {
@ -97,7 +97,7 @@ s32 func_802BE280_31EFF0(s32 arg0, f32* x, f32* y, f32* z, f32 length, f32 radiu
f32 sinAngle, cosAngle, hitX, hitY, hitZ, totalLength, hitNx, hitNy, hitNz;
s32 hitResult;
sin_cos_rad((*yaw * TAU) / 360.0f, &sinAngle, &cosAngle);
sin_cos_rad(DEG_TO_RAD(*yaw), &sinAngle, &cosAngle);
cosAngle = -cosAngle;
totalLength = radius + length;
hitResult = test_ray_colliders(0x10000, *x, *y, *z, sinAngle, 0.0f, cosAngle, &hitX, &hitY, &hitZ, &totalLength, &hitNx, &hitNy, &hitNz);
@ -179,7 +179,7 @@ ApiStatus SushieUpdate(Evt* script, s32 isInitialCall) {
sushie->flags |= NPC_FLAG_40000 | NPC_FLAG_100 | NPC_FLAG_40 | NPC_FLAG_ENABLE_HIT_SCRIPT;
sushie->flags &= ~NPC_FLAG_GRAVITY;
case 1:
sin_cos_rad((SushieTweesterPhysicsPtr->angle * TAU) / 360.0f, &sinAngle, &cosAngle);
sin_cos_rad(DEG_TO_RAD(SushieTweesterPhysicsPtr->angle), &sinAngle, &cosAngle);
sushie->pos.x = entity->position.x + (sinAngle * SushieTweesterPhysicsPtr->radius);
sushie->pos.z = entity->position.z - (cosAngle * SushieTweesterPhysicsPtr->radius);
SushieTweesterPhysicsPtr->angle = clamp_angle(SushieTweesterPhysicsPtr->angle - SushieTweesterPhysicsPtr->angularVelocity);
@ -190,7 +190,7 @@ ApiStatus SushieUpdate(Evt* script, s32 isInitialCall) {
SushieTweesterPhysicsPtr->radius++;
}
liftoffVelocity = sin_rad((SushieTweesterPhysicsPtr->liftoffVelocityPhase * TAU) / 360.0f) * 3.0f;
liftoffVelocity = sin_rad(DEG_TO_RAD(SushieTweesterPhysicsPtr->liftoffVelocityPhase)) * 3.0f;
SushieTweesterPhysicsPtr->liftoffVelocityPhase += 3.0f;
if (SushieTweesterPhysicsPtr->liftoffVelocityPhase > 150.0f) {

View File

@ -137,7 +137,7 @@ ApiStatus WattUpdate(Evt* script, s32 isInitialCall) {
watt->flags |= NPC_FLAG_40000 | NPC_FLAG_100 | NPC_FLAG_40 | NPC_FLAG_ENABLE_HIT_SCRIPT;
watt->flags &= ~NPC_FLAG_GRAVITY;
case 1:
sin_cos_rad((WattTweesterPhysicsPtr->angle * TAU) / 360.0f, &sinAngle, &cosAngle);
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);
@ -148,7 +148,7 @@ ApiStatus WattUpdate(Evt* script, s32 isInitialCall) {
WattTweesterPhysicsPtr->radius++;
}
liftoffVelocity = sin_rad(WattTweesterPhysicsPtr->liftoffVelocityPhase * TAU / 360.0f) * 3.0f;
liftoffVelocity = sin_rad(DEG_TO_RAD(WattTweesterPhysicsPtr->liftoffVelocityPhase)) * 3.0f;
WattTweesterPhysicsPtr->liftoffVelocityPhase += 3.0f;
if (WattTweesterPhysicsPtr->liftoffVelocityPhase > 150.0f) {
@ -525,7 +525,7 @@ void world_watt_sync_held_position(void) {
}
}
angle = (camera->currentYaw + 270.0f - gPlayerStatusPtr->spriteFacingAngle + angleOffset) * TAU / 360.0f;
angle = DEG_TO_RAD(camera->currentYaw + 270.0f - gPlayerStatusPtr->spriteFacingAngle + angleOffset);
playerStatus = gPlayerStatusPtr;
partnerNPC = wPartnerNpc;

View File

@ -3,4 +3,4 @@
.section .data
dlabel D_802B6D80_E2B430
.word D_802B6E80, 0x00000000, 0x00000000, 0x00000000
.word ParasolTransformation, 0x00000000, 0x00000000, 0x00000000

View File

@ -2,8 +2,8 @@
.set noreorder # don't insert nops after branches
glabel func_802DE8DC
/* 1019CC 802DE8DC 3C03802E */ lui $v1, %hi(D_802DFA48)
/* 1019D0 802DE8E0 2463FA48 */ addiu $v1, $v1, %lo(D_802DFA48)
/* 1019CC 802DE8DC 3C03802E */ lui $v1, %hi(SpriteInstances)
/* 1019D0 802DE8E0 2463FA48 */ addiu $v1, $v1, %lo(SpriteInstances)
/* 1019D4 802DE8E4 00041080 */ sll $v0, $a0, 2
/* 1019D8 802DE8E8 00441021 */ addu $v0, $v0, $a0
/* 1019DC 802DE8EC 00021080 */ sll $v0, $v0, 2

View File

@ -1,363 +0,0 @@
.set noat # allow manual use of $at
.set noreorder # don't insert nops after branches
glabel spr_component_update_commands
/* 10020C 802DD11C 27BDFF88 */ addiu $sp, $sp, -0x78
/* 100210 802DD120 AFB1002C */ sw $s1, 0x2c($sp)
/* 100214 802DD124 0080882D */ daddu $s1, $a0, $zero
/* 100218 802DD128 AFBF0040 */ sw $ra, 0x40($sp)
/* 10021C 802DD12C AFB5003C */ sw $s5, 0x3c($sp)
/* 100220 802DD130 AFB40038 */ sw $s4, 0x38($sp)
/* 100224 802DD134 AFB30034 */ sw $s3, 0x34($sp)
/* 100228 802DD138 AFB20030 */ sw $s2, 0x30($sp)
/* 10022C 802DD13C AFB00028 */ sw $s0, 0x28($sp)
/* 100230 802DD140 F7BE0070 */ sdc1 $f30, 0x70($sp)
/* 100234 802DD144 F7BC0068 */ sdc1 $f28, 0x68($sp)
/* 100238 802DD148 F7BA0060 */ sdc1 $f26, 0x60($sp)
/* 10023C 802DD14C F7B80058 */ sdc1 $f24, 0x58($sp)
/* 100240 802DD150 F7B60050 */ sdc1 $f22, 0x50($sp)
/* 100244 802DD154 F7B40048 */ sdc1 $f20, 0x48($sp)
/* 100248 802DD158 8E220000 */ lw $v0, ($s1)
/* 10024C 802DD15C 10400126 */ beqz $v0, .L802DD5F8
/* 100250 802DD160 00A0982D */ daddu $s3, $a1, $zero
/* 100254 802DD164 0000902D */ daddu $s2, $zero, $zero
/* 100258 802DD168 2414FFFF */ addiu $s4, $zero, -1
/* 10025C 802DD16C 3C013F80 */ lui $at, 0x3f80
/* 100260 802DD170 4481A000 */ mtc1 $at, $f20
/* 100264 802DD174 8E300008 */ lw $s0, 8($s1)
/* 100268 802DD178 C620000C */ lwc1 $f0, 0xc($s1)
/* 10026C 802DD17C 3C01802E */ lui $at, %hi(spr_animUpdateTimeScale)
/* 100270 802DD180 C422F4C0 */ lwc1 $f2, %lo(spr_animUpdateTimeScale)($at)
/* 100274 802DD184 4600A786 */ mov.s $f30, $f20
/* 100278 802DD188 46020001 */ sub.s $f0, $f0, $f2
/* 10027C 802DD18C 44801000 */ mtc1 $zero, $f2
/* 100280 802DD190 4600A706 */ mov.s $f28, $f20
/* 100284 802DD194 4602003E */ c.le.s $f0, $f2
/* 100288 802DD198 00000000 */ nop
/* 10028C 802DD19C 450000FC */ bc1f .L802DD590
/* 100290 802DD1A0 E620000C */ swc1 $f0, 0xc($s1)
/* 100294 802DD1A4 46001606 */ mov.s $f24, $f2
/* 100298 802DD1A8 4600A586 */ mov.s $f22, $f20
/* 10029C 802DD1AC 0280A82D */ daddu $s5, $s4, $zero
/* 1002A0 802DD1B0 3C0142C8 */ lui $at, 0x42c8
/* 1002A4 802DD1B4 4481D000 */ mtc1 $at, $f26
.L802DD1B8:
/* 1002A8 802DD1B8 96630004 */ lhu $v1, 4($s3)
/* 1002AC 802DD1BC 00031C00 */ sll $v1, $v1, 0x10
/* 1002B0 802DD1C0 00031403 */ sra $v0, $v1, 0x10
/* 1002B4 802DD1C4 00031FC2 */ srl $v1, $v1, 0x1f
/* 1002B8 802DD1C8 00431021 */ addu $v0, $v0, $v1
/* 1002BC 802DD1CC 00021043 */ sra $v0, $v0, 1
/* 1002C0 802DD1D0 8E630000 */ lw $v1, ($s3)
/* 1002C4 802DD1D4 00021040 */ sll $v0, $v0, 1
/* 1002C8 802DD1D8 00621021 */ addu $v0, $v1, $v0
/* 1002CC 802DD1DC 0202102B */ sltu $v0, $s0, $v0
/* 1002D0 802DD1E0 14400003 */ bnez $v0, .L802DD1F0
/* 1002D4 802DD1E4 24024000 */ addiu $v0, $zero, 0x4000
/* 1002D8 802DD1E8 080B7564 */ j .L802DD590
/* 1002DC 802DD1EC 0060802D */ daddu $s0, $v1, $zero
.L802DD1F0:
/* 1002E0 802DD1F0 96040000 */ lhu $a0, ($s0)
/* 1002E4 802DD1F4 3083F000 */ andi $v1, $a0, 0xf000
/* 1002E8 802DD1F8 10620089 */ beq $v1, $v0, .L802DD420
/* 1002EC 802DD1FC 28624001 */ slti $v0, $v1, 0x4001
/* 1002F0 802DD200 1040000F */ beqz $v0, .L802DD240
/* 1002F4 802DD204 24021000 */ addiu $v0, $zero, 0x1000
/* 1002F8 802DD208 10620040 */ beq $v1, $v0, .L802DD30C
/* 1002FC 802DD20C 28621001 */ slti $v0, $v1, 0x1001
/* 100300 802DD210 50400005 */ beql $v0, $zero, .L802DD228
/* 100304 802DD214 24022000 */ addiu $v0, $zero, 0x2000
/* 100308 802DD218 10600019 */ beqz $v1, .L802DD280
/* 10030C 802DD21C 30820FFF */ andi $v0, $a0, 0xfff
/* 100310 802DD220 080B755D */ j .L802DD574
/* 100314 802DD224 00000000 */ nop
.L802DD228:
/* 100318 802DD228 1062002C */ beq $v1, $v0, .L802DD2DC
/* 10031C 802DD22C 24023000 */ addiu $v0, $zero, 0x3000
/* 100320 802DD230 1062005F */ beq $v1, $v0, .L802DD3B0
/* 100324 802DD234 3083000F */ andi $v1, $a0, 0xf
/* 100328 802DD238 080B755D */ j .L802DD574
/* 10032C 802DD23C 00000000 */ nop
.L802DD240:
/* 100330 802DD240 24026000 */ addiu $v0, $zero, 0x6000
/* 100334 802DD244 10620039 */ beq $v1, $v0, .L802DD32C
/* 100338 802DD248 28626001 */ slti $v0, $v1, 0x6001
/* 10033C 802DD24C 10400005 */ beqz $v0, .L802DD264
/* 100340 802DD250 24025000 */ addiu $v0, $zero, 0x5000
/* 100344 802DD254 10620089 */ beq $v1, $v0, .L802DD47C
/* 100348 802DD258 3083000F */ andi $v1, $a0, 0xf
/* 10034C 802DD25C 080B755D */ j .L802DD574
/* 100350 802DD260 00000000 */ nop
.L802DD264:
/* 100354 802DD264 24027000 */ addiu $v0, $zero, 0x7000
/* 100358 802DD268 106200B3 */ beq $v1, $v0, .L802DD538
/* 10035C 802DD26C 34028000 */ ori $v0, $zero, 0x8000
/* 100360 802DD270 10620036 */ beq $v1, $v0, .L802DD34C
/* 100364 802DD274 24020100 */ addiu $v0, $zero, 0x100
/* 100368 802DD278 080B755D */ j .L802DD574
/* 10036C 802DD27C 00000000 */ nop
.L802DD280:
/* 100370 802DD280 44820000 */ mtc1 $v0, $f0
/* 100374 802DD284 00000000 */ nop
/* 100378 802DD288 46800020 */ cvt.s.w $f0, $f0
/* 10037C 802DD28C E620000C */ swc1 $f0, 0xc($s1)
/* 100380 802DD290 46180032 */ c.eq.s $f0, $f24
/* 100384 802DD294 00000000 */ nop
/* 100388 802DD298 45000006 */ bc1f .L802DD2B4
/* 10038C 802DD29C 26100002 */ addiu $s0, $s0, 2
/* 100390 802DD2A0 3C01457F */ lui $at, 0x457f
/* 100394 802DD2A4 3421F000 */ ori $at, $at, 0xf000
/* 100398 802DD2A8 44810000 */ mtc1 $at, $f0
/* 10039C 802DD2AC 00000000 */ nop
/* 1003A0 802DD2B0 E620000C */ swc1 $f0, 0xc($s1)
.L802DD2B4:
/* 1003A4 802DD2B4 E6380024 */ swc1 $f24, 0x24($s1)
/* 1003A8 802DD2B8 E6380020 */ swc1 $f24, 0x20($s1)
/* 1003AC 802DD2BC E638001C */ swc1 $f24, 0x1c($s1)
/* 1003B0 802DD2C0 AE20003C */ sw $zero, 0x3c($s1)
/* 1003B4 802DD2C4 AE200038 */ sw $zero, 0x38($s1)
/* 1003B8 802DD2C8 AE200034 */ sw $zero, 0x34($s1)
/* 1003BC 802DD2CC E6360048 */ swc1 $f22, 0x48($s1)
/* 1003C0 802DD2D0 E6360044 */ swc1 $f22, 0x44($s1)
/* 1003C4 802DD2D4 080B755F */ j .L802DD57C
/* 1003C8 802DD2D8 E6360040 */ swc1 $f22, 0x40($s1)
.L802DD2DC:
/* 1003CC 802DD2DC 96040000 */ lhu $a0, ($s0)
/* 1003D0 802DD2E0 0C0B7437 */ jal spr_sign_extend_12bit
/* 1003D4 802DD2E4 00000000 */ nop
/* 1003D8 802DD2E8 8E630000 */ lw $v1, ($s3)
/* 1003DC 802DD2EC 00021040 */ sll $v0, $v0, 1
/* 1003E0 802DD2F0 00628021 */ addu $s0, $v1, $v0
/* 1003E4 802DD2F4 161400A1 */ bne $s0, $s4, .L802DD57C
/* 1003E8 802DD2F8 0200A02D */ daddu $s4, $s0, $zero
/* 1003EC 802DD2FC 0060802D */ daddu $s0, $v1, $zero
/* 1003F0 802DD300 E636000C */ swc1 $f22, 0xc($s1)
/* 1003F4 802DD304 080B755F */ j .L802DD57C
/* 1003F8 802DD308 0200A02D */ daddu $s4, $s0, $zero
.L802DD30C:
/* 1003FC 802DD30C 30850FFF */ andi $a1, $a0, 0xfff
/* 100400 802DD310 24020FFF */ addiu $v0, $zero, 0xfff
/* 100404 802DD314 10A20003 */ beq $a1, $v0, .L802DD324
/* 100408 802DD318 26100002 */ addiu $s0, $s0, 2
/* 10040C 802DD31C 080B74D1 */ j .L802DD344
/* 100410 802DD320 AE250014 */ sw $a1, 0x14($s1)
.L802DD324:
/* 100414 802DD324 080B74D1 */ j .L802DD344
/* 100418 802DD328 AE350014 */ sw $s5, 0x14($s1)
.L802DD32C:
/* 10041C 802DD32C 30850FFF */ andi $a1, $a0, 0xfff
/* 100420 802DD330 24020FFF */ addiu $v0, $zero, 0xfff
/* 100424 802DD334 10A20003 */ beq $a1, $v0, .L802DD344
/* 100428 802DD338 26100002 */ addiu $s0, $s0, 2
/* 10042C 802DD33C 080B755F */ j .L802DD57C
/* 100430 802DD340 AE250018 */ sw $a1, 0x18($s1)
.L802DD344:
/* 100434 802DD344 080B755F */ j .L802DD57C
/* 100438 802DD348 AE350018 */ sw $s5, 0x18($s1)
.L802DD34C:
/* 10043C 802DD34C 96050000 */ lhu $a1, ($s0)
/* 100440 802DD350 30A30F00 */ andi $v1, $a1, 0xf00
/* 100444 802DD354 10620006 */ beq $v1, $v0, .L802DD370
/* 100448 802DD358 26100002 */ addiu $s0, $s0, 2
/* 10044C 802DD35C 24020200 */ addiu $v0, $zero, 0x200
/* 100450 802DD360 10620009 */ beq $v1, $v0, .L802DD388
/* 100454 802DD364 3C04FF00 */ lui $a0, 0xff00
/* 100458 802DD368 080B755F */ j .L802DD57C
/* 10045C 802DD36C 00000000 */ nop
.L802DD370:
/* 100460 802DD370 8E220004 */ lw $v0, 4($s1)
/* 100464 802DD374 3C03FFFF */ lui $v1, 0xffff
/* 100468 802DD378 00431024 */ and $v0, $v0, $v1
/* 10046C 802DD37C 00451025 */ or $v0, $v0, $a1
/* 100470 802DD380 080B755F */ j .L802DD57C
/* 100474 802DD384 AE220004 */ sw $v0, 4($s1)
.L802DD388:
/* 100478 802DD388 3484FFFF */ ori $a0, $a0, 0xffff
/* 10047C 802DD38C 8E230004 */ lw $v1, 4($s1)
/* 100480 802DD390 30A200FF */ andi $v0, $a1, 0xff
/* 100484 802DD394 3C01802E */ lui $at, %hi(D_802DFEAC)
/* 100488 802DD398 AC22FEAC */ sw $v0, %lo(D_802DFEAC)($at)
/* 10048C 802DD39C 00021400 */ sll $v0, $v0, 0x10
/* 100490 802DD3A0 00641824 */ and $v1, $v1, $a0
/* 100494 802DD3A4 00621825 */ or $v1, $v1, $v0
/* 100498 802DD3A8 080B755F */ j .L802DD57C
/* 10049C 802DD3AC AE230004 */ sw $v1, 4($s1)
.L802DD3B0:
/* 1004A0 802DD3B0 28620002 */ slti $v0, $v1, 2
/* 1004A4 802DD3B4 10400071 */ beqz $v0, .L802DD57C
/* 1004A8 802DD3B8 26100002 */ addiu $s0, $s0, 2
/* 1004AC 802DD3BC 0460006F */ bltz $v1, .L802DD57C
/* 1004B0 802DD3C0 00000000 */ nop
/* 1004B4 802DD3C4 96040000 */ lhu $a0, ($s0)
/* 1004B8 802DD3C8 26100002 */ addiu $s0, $s0, 2
/* 1004BC 802DD3CC 0C0B743F */ jal spr_sign_extend_16bit
/* 1004C0 802DD3D0 36520001 */ ori $s2, $s2, 1
/* 1004C4 802DD3D4 96040000 */ lhu $a0, ($s0)
/* 1004C8 802DD3D8 26100002 */ addiu $s0, $s0, 2
/* 1004CC 802DD3DC 44822000 */ mtc1 $v0, $f4
/* 1004D0 802DD3E0 00000000 */ nop
/* 1004D4 802DD3E4 46802120 */ cvt.s.w $f4, $f4
/* 1004D8 802DD3E8 0C0B743F */ jal spr_sign_extend_16bit
/* 1004DC 802DD3EC E7A40010 */ swc1 $f4, 0x10($sp)
/* 1004E0 802DD3F0 96040000 */ lhu $a0, ($s0)
/* 1004E4 802DD3F4 26100002 */ addiu $s0, $s0, 2
/* 1004E8 802DD3F8 44822000 */ mtc1 $v0, $f4
/* 1004EC 802DD3FC 00000000 */ nop
/* 1004F0 802DD400 46802120 */ cvt.s.w $f4, $f4
/* 1004F4 802DD404 0C0B743F */ jal spr_sign_extend_16bit
/* 1004F8 802DD408 E7A40014 */ swc1 $f4, 0x14($sp)
/* 1004FC 802DD40C 44822000 */ mtc1 $v0, $f4
/* 100500 802DD410 00000000 */ nop
/* 100504 802DD414 46802120 */ cvt.s.w $f4, $f4
/* 100508 802DD418 080B755F */ j .L802DD57C
/* 10050C 802DD41C E7A40018 */ swc1 $f4, 0x18($sp)
.L802DD420:
/* 100510 802DD420 96040000 */ lhu $a0, ($s0)
/* 100514 802DD424 26100002 */ addiu $s0, $s0, 2
/* 100518 802DD428 0C0B7437 */ jal spr_sign_extend_12bit
/* 10051C 802DD42C 36520002 */ ori $s2, $s2, 2
/* 100520 802DD430 96040000 */ lhu $a0, ($s0)
/* 100524 802DD434 26100002 */ addiu $s0, $s0, 2
/* 100528 802DD438 44822000 */ mtc1 $v0, $f4
/* 10052C 802DD43C 00000000 */ nop
/* 100530 802DD440 46802120 */ cvt.s.w $f4, $f4
/* 100534 802DD444 0C0B743F */ jal spr_sign_extend_16bit
/* 100538 802DD448 E7A4001C */ swc1 $f4, 0x1c($sp)
/* 10053C 802DD44C 96040000 */ lhu $a0, ($s0)
/* 100540 802DD450 26100002 */ addiu $s0, $s0, 2
/* 100544 802DD454 44822000 */ mtc1 $v0, $f4
/* 100548 802DD458 00000000 */ nop
/* 10054C 802DD45C 46802120 */ cvt.s.w $f4, $f4
/* 100550 802DD460 0C0B743F */ jal spr_sign_extend_16bit
/* 100554 802DD464 E7A40020 */ swc1 $f4, 0x20($sp)
/* 100558 802DD468 44822000 */ mtc1 $v0, $f4
/* 10055C 802DD46C 00000000 */ nop
/* 100560 802DD470 46802120 */ cvt.s.w $f4, $f4
/* 100564 802DD474 080B755F */ j .L802DD57C
/* 100568 802DD478 E7A40024 */ swc1 $f4, 0x24($sp)
.L802DD47C:
/* 10056C 802DD47C 24020001 */ addiu $v0, $zero, 1
/* 100570 802DD480 10620017 */ beq $v1, $v0, .L802DD4E0
/* 100574 802DD484 26100002 */ addiu $s0, $s0, 2
/* 100578 802DD488 28620002 */ slti $v0, $v1, 2
/* 10057C 802DD48C 50400005 */ beql $v0, $zero, .L802DD4A4
/* 100580 802DD490 24020002 */ addiu $v0, $zero, 2
/* 100584 802DD494 10600009 */ beqz $v1, .L802DD4BC
/* 100588 802DD498 00000000 */ nop
/* 10058C 802DD49C 080B755F */ j .L802DD57C
/* 100590 802DD4A0 36520004 */ ori $s2, $s2, 4
.L802DD4A4:
/* 100594 802DD4A4 10620015 */ beq $v1, $v0, .L802DD4FC
/* 100598 802DD4A8 24020003 */ addiu $v0, $zero, 3
/* 10059C 802DD4AC 1062001A */ beq $v1, $v0, .L802DD518
/* 1005A0 802DD4B0 00000000 */ nop
/* 1005A4 802DD4B4 080B755F */ j .L802DD57C
/* 1005A8 802DD4B8 36520004 */ ori $s2, $s2, 4
.L802DD4BC:
/* 1005AC 802DD4BC 96020000 */ lhu $v0, ($s0)
/* 1005B0 802DD4C0 26100002 */ addiu $s0, $s0, 2
/* 1005B4 802DD4C4 44820000 */ mtc1 $v0, $f0
/* 1005B8 802DD4C8 00000000 */ nop
/* 1005BC 802DD4CC 46800020 */ cvt.s.w $f0, $f0
/* 1005C0 802DD4D0 461A0503 */ div.s $f20, $f0, $f26
/* 1005C4 802DD4D4 4600A786 */ mov.s $f30, $f20
/* 1005C8 802DD4D8 080B754C */ j .L802DD530
/* 1005CC 802DD4DC 4600A706 */ mov.s $f28, $f20
.L802DD4E0:
/* 1005D0 802DD4E0 96020000 */ lhu $v0, ($s0)
/* 1005D4 802DD4E4 26100002 */ addiu $s0, $s0, 2
/* 1005D8 802DD4E8 44820000 */ mtc1 $v0, $f0
/* 1005DC 802DD4EC 00000000 */ nop
/* 1005E0 802DD4F0 46800020 */ cvt.s.w $f0, $f0
/* 1005E4 802DD4F4 080B754C */ j .L802DD530
/* 1005E8 802DD4F8 461A0703 */ div.s $f28, $f0, $f26
.L802DD4FC:
/* 1005EC 802DD4FC 96020000 */ lhu $v0, ($s0)
/* 1005F0 802DD500 26100002 */ addiu $s0, $s0, 2
/* 1005F4 802DD504 44820000 */ mtc1 $v0, $f0
/* 1005F8 802DD508 00000000 */ nop
/* 1005FC 802DD50C 46800020 */ cvt.s.w $f0, $f0
/* 100600 802DD510 080B754C */ j .L802DD530
/* 100604 802DD514 461A0783 */ div.s $f30, $f0, $f26
.L802DD518:
/* 100608 802DD518 96020000 */ lhu $v0, ($s0)
/* 10060C 802DD51C 26100002 */ addiu $s0, $s0, 2
/* 100610 802DD520 44820000 */ mtc1 $v0, $f0
/* 100614 802DD524 00000000 */ nop
/* 100618 802DD528 46800020 */ cvt.s.w $f0, $f0
/* 10061C 802DD52C 461A0503 */ div.s $f20, $f0, $f26
.L802DD530:
/* 100620 802DD530 080B755F */ j .L802DD57C
/* 100624 802DD534 36520004 */ ori $s2, $s2, 4
.L802DD538:
/* 100628 802DD538 8E220010 */ lw $v0, 0x10($s1)
/* 10062C 802DD53C 10400005 */ beqz $v0, .L802DD554
/* 100630 802DD540 2442FFFF */ addiu $v0, $v0, -1
/* 100634 802DD544 14400005 */ bnez $v0, .L802DD55C
/* 100638 802DD548 AE220010 */ sw $v0, 0x10($s1)
/* 10063C 802DD54C 080B755F */ j .L802DD57C
/* 100640 802DD550 26100004 */ addiu $s0, $s0, 4
.L802DD554:
/* 100644 802DD554 96020002 */ lhu $v0, 2($s0)
/* 100648 802DD558 AE220010 */ sw $v0, 0x10($s1)
.L802DD55C:
/* 10064C 802DD55C 0C0B7437 */ jal spr_sign_extend_12bit
/* 100650 802DD560 96040000 */ lhu $a0, ($s0)
/* 100654 802DD564 8E630000 */ lw $v1, ($s3)
/* 100658 802DD568 00021040 */ sll $v0, $v0, 1
/* 10065C 802DD56C 080B755F */ j .L802DD57C
/* 100660 802DD570 00628021 */ addu $s0, $v1, $v0
.L802DD574:
/* 100664 802DD574 8E700000 */ lw $s0, ($s3)
/* 100668 802DD578 E636000C */ swc1 $f22, 0xc($s1)
.L802DD57C:
/* 10066C 802DD57C C620000C */ lwc1 $f0, 0xc($s1)
/* 100670 802DD580 4618003E */ c.le.s $f0, $f24
/* 100674 802DD584 00000000 */ nop
/* 100678 802DD588 4501FF0B */ bc1t .L802DD1B8
/* 10067C 802DD58C 00000000 */ nop
.L802DD590:
/* 100680 802DD590 32420001 */ andi $v0, $s2, 1
/* 100684 802DD594 10400007 */ beqz $v0, .L802DD5B4
/* 100688 802DD598 AE300008 */ sw $s0, 8($s1)
/* 10068C 802DD59C C7A40010 */ lwc1 $f4, 0x10($sp)
/* 100690 802DD5A0 E624001C */ swc1 $f4, 0x1c($s1)
/* 100694 802DD5A4 C7A40014 */ lwc1 $f4, 0x14($sp)
/* 100698 802DD5A8 E6240020 */ swc1 $f4, 0x20($s1)
/* 10069C 802DD5AC C7A40018 */ lwc1 $f4, 0x18($sp)
/* 1006A0 802DD5B0 E6240024 */ swc1 $f4, 0x24($s1)
.L802DD5B4:
/* 1006A4 802DD5B4 32420002 */ andi $v0, $s2, 2
/* 1006A8 802DD5B8 1040000A */ beqz $v0, .L802DD5E4
/* 1006AC 802DD5BC 32420004 */ andi $v0, $s2, 4
/* 1006B0 802DD5C0 C7A4001C */ lwc1 $f4, 0x1c($sp)
/* 1006B4 802DD5C4 4600210D */ trunc.w.s $f4, $f4
/* 1006B8 802DD5C8 E6240034 */ swc1 $f4, 0x34($s1)
/* 1006BC 802DD5CC C7A40020 */ lwc1 $f4, 0x20($sp)
/* 1006C0 802DD5D0 4600210D */ trunc.w.s $f4, $f4
/* 1006C4 802DD5D4 E6240038 */ swc1 $f4, 0x38($s1)
/* 1006C8 802DD5D8 C7A40024 */ lwc1 $f4, 0x24($sp)
/* 1006CC 802DD5DC 4600210D */ trunc.w.s $f4, $f4
/* 1006D0 802DD5E0 E624003C */ swc1 $f4, 0x3c($s1)
.L802DD5E4:
/* 1006D4 802DD5E4 10400004 */ beqz $v0, .L802DD5F8
/* 1006D8 802DD5E8 00000000 */ nop
/* 1006DC 802DD5EC E63C0040 */ swc1 $f28, 0x40($s1)
/* 1006E0 802DD5F0 E63E0044 */ swc1 $f30, 0x44($s1)
/* 1006E4 802DD5F4 E6340048 */ swc1 $f20, 0x48($s1)
.L802DD5F8:
/* 1006E8 802DD5F8 8FBF0040 */ lw $ra, 0x40($sp)
/* 1006EC 802DD5FC 8FB5003C */ lw $s5, 0x3c($sp)
/* 1006F0 802DD600 8FB40038 */ lw $s4, 0x38($sp)
/* 1006F4 802DD604 8FB30034 */ lw $s3, 0x34($sp)
/* 1006F8 802DD608 8FB20030 */ lw $s2, 0x30($sp)
/* 1006FC 802DD60C 8FB1002C */ lw $s1, 0x2c($sp)
/* 100700 802DD610 8FB00028 */ lw $s0, 0x28($sp)
/* 100704 802DD614 D7BE0070 */ ldc1 $f30, 0x70($sp)
/* 100708 802DD618 D7BC0068 */ ldc1 $f28, 0x68($sp)
/* 10070C 802DD61C D7BA0060 */ ldc1 $f26, 0x60($sp)
/* 100710 802DD620 D7B80058 */ ldc1 $f24, 0x58($sp)
/* 100714 802DD624 D7B60050 */ ldc1 $f22, 0x50($sp)
/* 100718 802DD628 D7B40048 */ ldc1 $f20, 0x48($sp)
/* 10071C 802DD62C 03E00008 */ jr $ra
/* 100720 802DD630 27BD0078 */ addiu $sp, $sp, 0x78

View File

@ -4,8 +4,8 @@
glabel spr_draw_npc_sprite
/* 1014C8 802DE3D8 27BDFFB8 */ addiu $sp, $sp, -0x48
/* 1014CC 802DE3DC 308900FF */ andi $t1, $a0, 0xff
/* 1014D0 802DE3E0 3C02802E */ lui $v0, %hi(D_802DFA48)
/* 1014D4 802DE3E4 2442FA48 */ addiu $v0, $v0, %lo(D_802DFA48)
/* 1014D0 802DE3E0 3C02802E */ lui $v0, %hi(SpriteInstances)
/* 1014D4 802DE3E4 2442FA48 */ addiu $v0, $v0, %lo(SpriteInstances)
/* 1014D8 802DE3E8 00091880 */ sll $v1, $t1, 2
/* 1014DC 802DE3EC 00691821 */ addu $v1, $v1, $t1
/* 1014E0 802DE3F0 00031880 */ sll $v1, $v1, 2
@ -95,9 +95,9 @@ glabel spr_draw_npc_sprite
/* 101614 802DE524 00091080 */ sll $v0, $t1, 2
/* 101618 802DE528 00491021 */ addu $v0, $v0, $t1
/* 10161C 802DE52C 00021080 */ sll $v0, $v0, 2
/* 101620 802DE530 3C10802E */ lui $s0, %hi(D_802DFA48 + 0x4)
/* 101620 802DE530 3C10802E */ lui $s0, %hi(SpriteInstances + 0x4)
/* 101624 802DE534 02028021 */ addu $s0, $s0, $v0
/* 101628 802DE538 8E10FA4C */ lw $s0, %lo(D_802DFA48 + 0x4)($s0)
/* 101628 802DE538 8E10FA4C */ lw $s0, %lo(SpriteInstances + 0x4)($s0)
/* 10162C 802DE53C 3C022000 */ lui $v0, 0x2000
/* 101630 802DE540 00821024 */ and $v0, $a0, $v0
/* 101634 802DE544 54400001 */ bnel $v0, $zero, .L802DE54C

View File

@ -1,125 +0,0 @@
.set noat # allow manual use of $at
.set noreorder # don't insert nops after branches
glabel spr_load_npc_sprite
/* 1011DC 802DE0EC 27BDFFD0 */ addiu $sp, $sp, -0x30
/* 1011E0 802DE0F0 AFB50024 */ sw $s5, 0x24($sp)
/* 1011E4 802DE0F4 00A0A82D */ daddu $s5, $a1, $zero
/* 1011E8 802DE0F8 00041403 */ sra $v0, $a0, 0x10
/* 1011EC 802DE0FC AFB40020 */ sw $s4, 0x20($sp)
/* 1011F0 802DE100 30547FFF */ andi $s4, $v0, 0x7fff
/* 1011F4 802DE104 000437C2 */ srl $a2, $a0, 0x1f
/* 1011F8 802DE108 0000202D */ daddu $a0, $zero, $zero
/* 1011FC 802DE10C AFB3001C */ sw $s3, 0x1c($sp)
/* 101200 802DE110 3C13802E */ lui $s3, %hi(D_802DFA48)
/* 101204 802DE114 2673FA48 */ addiu $s3, $s3, %lo(D_802DFA48)
/* 101208 802DE118 0260182D */ daddu $v1, $s3, $zero
/* 10120C 802DE11C AFBF0028 */ sw $ra, 0x28($sp)
/* 101210 802DE120 AFB20018 */ sw $s2, 0x18($sp)
/* 101214 802DE124 AFB10014 */ sw $s1, 0x14($sp)
/* 101218 802DE128 AFB00010 */ sw $s0, 0x10($sp)
.L802DE12C:
/* 10121C 802DE12C 8C620000 */ lw $v0, ($v1)
/* 101220 802DE130 10400005 */ beqz $v0, .L802DE148
/* 101224 802DE134 00000000 */ nop
/* 101228 802DE138 24840001 */ addiu $a0, $a0, 1
/* 10122C 802DE13C 28820033 */ slti $v0, $a0, 0x33
/* 101230 802DE140 1440FFFA */ bnez $v0, .L802DE12C
/* 101234 802DE144 24630014 */ addiu $v1, $v1, 0x14
.L802DE148:
/* 101238 802DE148 3C03802E */ lui $v1, %hi(D_802DF530)
/* 10123C 802DE14C 2463F530 */ addiu $v1, $v1, %lo(D_802DF530)
/* 101240 802DE150 8C620000 */ lw $v0, ($v1)
/* 101244 802DE154 0044102A */ slt $v0, $v0, $a0
/* 101248 802DE158 54400001 */ bnel $v0, $zero, .L802DE160
/* 10124C 802DE15C AC640000 */ sw $a0, ($v1)
.L802DE160:
/* 101250 802DE160 24020033 */ addiu $v0, $zero, 0x33
/* 101254 802DE164 14820003 */ bne $a0, $v0, .L802DE174
/* 101258 802DE168 00141880 */ sll $v1, $s4, 2
/* 10125C 802DE16C 080B78A2 */ j .L802DE288
/* 101260 802DE170 2402FFFF */ addiu $v0, $zero, -1
.L802DE174:
/* 101264 802DE174 3C02802E */ lui $v0, %hi(spr_npcSprites)
/* 101268 802DE178 2442F5B0 */ addiu $v0, $v0, %lo(spr_npcSprites)
/* 10126C 802DE17C 00628821 */ addu $s1, $v1, $v0
/* 101270 802DE180 8E220000 */ lw $v0, ($s1)
/* 101274 802DE184 1040000E */ beqz $v0, .L802DE1C0
/* 101278 802DE188 0080902D */ daddu $s2, $a0, $zero
/* 10127C 802DE18C 3C03802E */ lui $v1, %hi(spr_npcSpriteInstanceCount)
/* 101280 802DE190 2463F958 */ addiu $v1, $v1, %lo(spr_npcSpriteInstanceCount)
/* 101284 802DE194 02831821 */ addu $v1, $s4, $v1
/* 101288 802DE198 90620000 */ lbu $v0, ($v1)
/* 10128C 802DE19C 24420001 */ addiu $v0, $v0, 1
/* 101290 802DE1A0 A0620000 */ sb $v0, ($v1)
/* 101294 802DE1A4 00121080 */ sll $v0, $s2, 2
/* 101298 802DE1A8 00521021 */ addu $v0, $v0, $s2
/* 10129C 802DE1AC 00021080 */ sll $v0, $v0, 2
/* 1012A0 802DE1B0 8E300000 */ lw $s0, ($s1)
/* 1012A4 802DE1B4 00531021 */ addu $v0, $v0, $s3
/* 1012A8 802DE1B8 080B7882 */ j .L802DE208
/* 1012AC 802DE1BC AC500008 */ sw $s0, 8($v0)
.L802DE1C0:
/* 1012B0 802DE1C0 2684FFFF */ addiu $a0, $s4, -1
/* 1012B4 802DE1C4 24020001 */ addiu $v0, $zero, 1
/* 1012B8 802DE1C8 3C01802E */ lui $at, %hi(spr_npcSpriteInstanceCount)
/* 1012BC 802DE1CC 00340821 */ addu $at, $at, $s4
/* 1012C0 802DE1D0 A022F958 */ sb $v0, %lo(spr_npcSpriteInstanceCount)($at)
/* 1012C4 802DE1D4 0C0B7AC3 */ jal spr_load_sprite
/* 1012C8 802DE1D8 0000282D */ daddu $a1, $zero, $zero
/* 1012CC 802DE1DC 0040802D */ daddu $s0, $v0, $zero
/* 1012D0 802DE1E0 00121080 */ sll $v0, $s2, 2
/* 1012D4 802DE1E4 00521021 */ addu $v0, $v0, $s2
/* 1012D8 802DE1E8 00021080 */ sll $v0, $v0, 2
/* 1012DC 802DE1EC 00531021 */ addu $v0, $v0, $s3
/* 1012E0 802DE1F0 AC500008 */ sw $s0, 8($v0)
/* 1012E4 802DE1F4 12A00004 */ beqz $s5, .L802DE208
/* 1012E8 802DE1F8 AE300000 */ sw $s0, ($s1)
/* 1012EC 802DE1FC 0200202D */ daddu $a0, $s0, $zero
/* 1012F0 802DE200 0C0B7C03 */ jal spr_load_npc_extra_anims
/* 1012F4 802DE204 02A0282D */ daddu $a1, $s5, $zero
.L802DE208:
/* 1012F8 802DE208 8E040008 */ lw $a0, 8($s0)
/* 1012FC 802DE20C 0C0B7CB6 */ jal spr_allocate_components
/* 101300 802DE210 00000000 */ nop
/* 101304 802DE214 0040882D */ daddu $s1, $v0, $zero
/* 101308 802DE218 00121080 */ sll $v0, $s2, 2
/* 10130C 802DE21C 00521021 */ addu $v0, $v0, $s2
/* 101310 802DE220 00021080 */ sll $v0, $v0, 2
/* 101314 802DE224 3C01802E */ lui $at, %hi(D_802DFA48 + 0x4)
/* 101318 802DE228 00220821 */ addu $at, $at, $v0
/* 10131C 802DE22C AC31FA4C */ sw $s1, %lo(D_802DFA48 + 0x4)($at)
/* 101320 802DE230 8E230000 */ lw $v1, ($s1)
/* 101324 802DE234 2402FFFF */ addiu $v0, $zero, -1
/* 101328 802DE238 10620009 */ beq $v1, $v0, .L802DE260
/* 10132C 802DE23C 0040982D */ daddu $s3, $v0, $zero
.L802DE240:
/* 101330 802DE240 8E300000 */ lw $s0, ($s1)
/* 101334 802DE244 0C04E9C1 */ jal func_8013A704
/* 101338 802DE248 24040001 */ addiu $a0, $zero, 1
/* 10133C 802DE24C 26310004 */ addiu $s1, $s1, 4
/* 101340 802DE250 AE02004C */ sw $v0, 0x4c($s0)
/* 101344 802DE254 8E220000 */ lw $v0, ($s1)
/* 101348 802DE258 1453FFF9 */ bne $v0, $s3, .L802DE240
/* 10134C 802DE25C 00000000 */ nop
.L802DE260:
/* 101350 802DE260 0240102D */ daddu $v0, $s2, $zero
/* 101354 802DE264 3C03802E */ lui $v1, %hi(D_802DFA48)
/* 101358 802DE268 2463FA48 */ addiu $v1, $v1, %lo(D_802DFA48)
/* 10135C 802DE26C 00022080 */ sll $a0, $v0, 2
/* 101360 802DE270 00822021 */ addu $a0, $a0, $v0
/* 101364 802DE274 00042080 */ sll $a0, $a0, 2
/* 101368 802DE278 00832021 */ addu $a0, $a0, $v1
/* 10136C 802DE27C 2403FFFF */ addiu $v1, $zero, -1
/* 101370 802DE280 AC940000 */ sw $s4, ($a0)
/* 101374 802DE284 AC83000C */ sw $v1, 0xc($a0)
.L802DE288:
/* 101378 802DE288 8FBF0028 */ lw $ra, 0x28($sp)
/* 10137C 802DE28C 8FB50024 */ lw $s5, 0x24($sp)
/* 101380 802DE290 8FB40020 */ lw $s4, 0x20($sp)
/* 101384 802DE294 8FB3001C */ lw $s3, 0x1c($sp)
/* 101388 802DE298 8FB20018 */ lw $s2, 0x18($sp)
/* 10138C 802DE29C 8FB10014 */ lw $s1, 0x14($sp)
/* 101390 802DE2A0 8FB00010 */ lw $s0, 0x10($sp)
/* 101394 802DE2A4 03E00008 */ jr $ra
/* 101398 802DE2A8 27BD0030 */ addiu $sp, $sp, 0x30

View File

@ -7,8 +7,8 @@ glabel spr_update_sprite
/* 1013A4 802DE2B4 0080A82D */ daddu $s5, $a0, $zero
/* 1013A8 802DE2B8 AFB20020 */ sw $s2, 0x20($sp)
/* 1013AC 802DE2BC 32B200FF */ andi $s2, $s5, 0xff
/* 1013B0 802DE2C0 3C03802E */ lui $v1, %hi(D_802DFA48)
/* 1013B4 802DE2C4 2463FA48 */ addiu $v1, $v1, %lo(D_802DFA48)
/* 1013B0 802DE2C0 3C03802E */ lui $v1, %hi(SpriteInstances)
/* 1013B4 802DE2C4 2463FA48 */ addiu $v1, $v1, %lo(SpriteInstances)
/* 1013B8 802DE2C8 00121080 */ sll $v0, $s2, 2
/* 1013BC 802DE2CC 00521021 */ addu $v0, $v0, $s2
/* 1013C0 802DE2D0 00021080 */ sll $v0, $v0, 2
@ -50,8 +50,8 @@ glabel spr_update_sprite
/* 101448 802DE358 1440000F */ bnez $v0, .L802DE398
/* 10144C 802DE35C 00121080 */ sll $v0, $s2, 2
/* 101450 802DE360 0260282D */ daddu $a1, $s3, $zero
/* 101454 802DE364 3C02802E */ lui $v0, %hi(D_802DFA48)
/* 101458 802DE368 2442FA48 */ addiu $v0, $v0, %lo(D_802DFA48)
/* 101454 802DE364 3C02802E */ lui $v0, %hi(SpriteInstances)
/* 101458 802DE368 2442FA48 */ addiu $v0, $v0, %lo(SpriteInstances)
/* 10145C 802DE36C 00128080 */ sll $s0, $s2, 2
/* 101460 802DE370 02128021 */ addu $s0, $s0, $s2
/* 101464 802DE374 00108080 */ sll $s0, $s0, 2
@ -66,9 +66,9 @@ glabel spr_update_sprite
.L802DE398:
/* 101488 802DE398 00521021 */ addu $v0, $v0, $s2
/* 10148C 802DE39C 00021080 */ sll $v0, $v0, 2
/* 101490 802DE3A0 3C01802E */ lui $at, %hi(D_802DFA48 + 0x10)
/* 101490 802DE3A0 3C01802E */ lui $at, %hi(SpriteInstances + 0x10)
/* 101494 802DE3A4 00220821 */ addu $at, $at, $v0
/* 101498 802DE3A8 8C22FA58 */ lw $v0, %lo(D_802DFA48 + 0x10)($at)
/* 101498 802DE3A8 8C22FA58 */ lw $v0, %lo(SpriteInstances + 0x10)($at)
/* 10149C 802DE3AC 8FBF0038 */ lw $ra, 0x38($sp)
/* 1014A0 802DE3B0 8FB70034 */ lw $s7, 0x34($sp)
/* 1014A4 802DE3B4 8FB60030 */ lw $s6, 0x30($sp)

View File

@ -9,8 +9,8 @@ glabel func_802452C4_A2F504
/* A2F514 802452D4 AFB00018 */ sw $s0, 0x18($sp)
/* A2F518 802452D8 10A0003B */ beqz $a1, .L802453C8
/* A2F51C 802452DC 8E30000C */ lw $s0, 0xc($s1)
/* A2F520 802452E0 3C048025 */ lui $a0, %hi(D_8024F580_852150)
/* A2F524 802452E4 2484F580 */ addiu $a0, $a0, %lo(D_8024F580_852150)
/* A2F520 802452E0 3C048025 */ lui $a0, %hi(D_8024F580_hos_05)
/* A2F524 802452E4 2484F580 */ addiu $a0, $a0, %lo(D_8024F580_hos_05)
/* A2F528 802452E8 3C058025 */ lui $a1, %hi(D_8024F581)
/* A2F52C 802452EC 24A5F581 */ addiu $a1, $a1, %lo(D_8024F581)
/* A2F530 802452F0 3C068025 */ lui $a2, %hi(D_8024F582)
@ -76,8 +76,8 @@ glabel func_802452C4_A2F504
/* A2F61C 802453DC 3C108025 */ lui $s0, %hi(D_8024F5A4)
/* A2F620 802453E0 2610F5A4 */ addiu $s0, $s0, %lo(D_8024F5A4)
/* A2F624 802453E4 8E030000 */ lw $v1, ($s0)
/* A2F628 802453E8 3C048025 */ lui $a0, %hi(D_8024F580_852150)
/* A2F62C 802453EC 9084F580 */ lbu $a0, %lo(D_8024F580_852150)($a0)
/* A2F628 802453E8 3C048025 */ lui $a0, %hi(D_8024F580_hos_05)
/* A2F62C 802453EC 9084F580 */ lbu $a0, %lo(D_8024F580_hos_05)($a0)
/* A2F630 802453F0 3C028025 */ lui $v0, %hi(D_8024F588)
/* A2F634 802453F4 8C42F588 */ lw $v0, %lo(D_8024F588)($v0)
/* A2F638 802453F8 24630001 */ addiu $v1, $v1, 1

View File

@ -1,27 +0,0 @@
.set noat # allow manual use of $at
.set noreorder # don't insert nops after branches
glabel func_80241C90_844860
/* 844860 80241C90 27BDFFE8 */ addiu $sp, $sp, -0x18
/* 844864 80241C94 AFB00010 */ sw $s0, 0x10($sp)
/* 844868 80241C98 0080802D */ daddu $s0, $a0, $zero
/* 84486C 80241C9C 0000202D */ daddu $a0, $zero, $zero
/* 844870 80241CA0 3C038011 */ lui $v1, %hi(gPlayerStatus)
/* 844874 80241CA4 2463EFC8 */ addiu $v1, $v1, %lo(gPlayerStatus)
/* 844878 80241CA8 AFBF0014 */ sw $ra, 0x14($sp)
/* 84487C 80241CAC 8C620004 */ lw $v0, 4($v1)
/* 844880 80241CB0 3C058024 */ lui $a1, %hi(func_80241D30_844900)
/* 844884 80241CB4 24A51D30 */ addiu $a1, $a1, %lo(func_80241D30_844900)
/* 844888 80241CB8 34422000 */ ori $v0, $v0, 0x2000
/* 84488C 80241CBC 0C048C56 */ jal create_generic_entity_world
/* 844890 80241CC0 AC620004 */ sw $v0, 4($v1)
/* 844894 80241CC4 0200202D */ daddu $a0, $s0, $zero
/* 844898 80241CC8 3C05FD05 */ lui $a1, 0xfd05
/* 84489C 80241CCC 34A50F8B */ ori $a1, $a1, 0xf8b
/* 8448A0 80241CD0 0C0B2026 */ jal evt_set_variable
/* 8448A4 80241CD4 0040302D */ daddu $a2, $v0, $zero
/* 8448A8 80241CD8 8FBF0014 */ lw $ra, 0x14($sp)
/* 8448AC 80241CDC 8FB00010 */ lw $s0, 0x10($sp)
/* 8448B0 80241CE0 24020002 */ addiu $v0, $zero, 2
/* 8448B4 80241CE4 03E00008 */ jr $ra
/* 8448B8 80241CE8 27BD0018 */ addiu $sp, $sp, 0x18

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