mirror of
https://github.com/coop-deluxe/sm64coopdx.git
synced 2025-10-30 08:01:01 +00:00
Merge branch 'unstable' of github.com:sm64ex-coop-dev/sm64ex-coop into unstable
This commit is contained in:
commit
dec4d0c51c
127 changed files with 489 additions and 523 deletions
|
|
@ -429,7 +429,7 @@ static void level_cmd_init_mario(void) {
|
||||||
struct GraphNode* unk18 = gLoadedGraphNodes[CMD_GET(u8, 3)];
|
struct GraphNode* unk18 = gLoadedGraphNodes[CMD_GET(u8, 3)];
|
||||||
|
|
||||||
struct SpawnInfo* lastSpawnInfo = NULL;
|
struct SpawnInfo* lastSpawnInfo = NULL;
|
||||||
for (int i = 0; i < MAX_PLAYERS; i++) {
|
for (s32 i = 0; i < MAX_PLAYERS; i++) {
|
||||||
struct SpawnInfo* spawnInfo = &gPlayerSpawnInfos[i];
|
struct SpawnInfo* spawnInfo = &gPlayerSpawnInfos[i];
|
||||||
vec3s_set(spawnInfo->startPos, 0, 0, 0);
|
vec3s_set(spawnInfo->startPos, 0, 0, 0);
|
||||||
vec3s_set(spawnInfo->startAngle, 0, 0, 0);
|
vec3s_set(spawnInfo->startAngle, 0, 0, 0);
|
||||||
|
|
@ -676,7 +676,7 @@ static void level_cmd_set_mario_start_pos(void) {
|
||||||
vec3s_copy(pos, CMD_GET(Vec3s, 6));
|
vec3s_copy(pos, CMD_GET(Vec3s, 6));
|
||||||
#endif
|
#endif
|
||||||
s16 angle = CMD_GET(s16, 4);
|
s16 angle = CMD_GET(s16, 4);
|
||||||
for (int i = 0; i < MAX_PLAYERS; i++) {
|
for (s32 i = 0; i < MAX_PLAYERS; i++) {
|
||||||
gPlayerSpawnInfos[i].areaIndex = areaIndex;
|
gPlayerSpawnInfos[i].areaIndex = areaIndex;
|
||||||
|
|
||||||
#if IS_64_BIT
|
#if IS_64_BIT
|
||||||
|
|
|
||||||
|
|
@ -45,8 +45,7 @@ void *vec3f_sum(Vec3f dest, Vec3f a, Vec3f b) {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Multiply vector 'dest' by a
|
/// Multiply vector 'dest' by a
|
||||||
void *vec3f_mul(Vec3f dest, f32 a)
|
void *vec3f_mul(Vec3f dest, f32 a) {
|
||||||
{
|
|
||||||
dest[0] *= a;
|
dest[0] *= a;
|
||||||
dest[1] *= a;
|
dest[1] *= a;
|
||||||
dest[2] *= a;
|
dest[2] *= a;
|
||||||
|
|
|
||||||
|
|
@ -131,7 +131,7 @@ static s32 find_wall_collisions_from_list(struct SurfaceNode *surfaceNode,
|
||||||
|
|
||||||
// If Mario has a vanish cap, pass through the vanish cap wall.
|
// If Mario has a vanish cap, pass through the vanish cap wall.
|
||||||
u8 passThroughWall = FALSE;
|
u8 passThroughWall = FALSE;
|
||||||
for (int i = 0; i < MAX_PLAYERS; i++) {
|
for (s32 i = 0; i < MAX_PLAYERS; i++) {
|
||||||
if (gCurrentObject != NULL && gCurrentObject == gMarioStates[i].marioObj
|
if (gCurrentObject != NULL && gCurrentObject == gMarioStates[i].marioObj
|
||||||
&& (gMarioStates[i].flags & MARIO_VANISH_CAP)) {
|
&& (gMarioStates[i].flags & MARIO_VANISH_CAP)) {
|
||||||
passThroughWall = TRUE;
|
passThroughWall = TRUE;
|
||||||
|
|
|
||||||
|
|
@ -774,7 +774,7 @@ void load_object_collision_model(void) {
|
||||||
f32 tangibleDist = gCurrentObject->oCollisionDistance;
|
f32 tangibleDist = gCurrentObject->oCollisionDistance;
|
||||||
|
|
||||||
u8 anyPlayerInTangibleRange = FALSE;
|
u8 anyPlayerInTangibleRange = FALSE;
|
||||||
for (int i = 0; i < MAX_PLAYERS; i++) {
|
for (s32 i = 0; i < MAX_PLAYERS; i++) {
|
||||||
f32 dist = dist_between_objects(gCurrentObject, gMarioStates[i].marioObj);
|
f32 dist = dist_between_objects(gCurrentObject, gMarioStates[i].marioObj);
|
||||||
if (dist < tangibleDist) { anyPlayerInTangibleRange = TRUE; }
|
if (dist < tangibleDist) { anyPlayerInTangibleRange = TRUE; }
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -117,7 +117,7 @@ void set_warp_transition_rgb(u8 red, u8 green, u8 blue) {
|
||||||
gWarpTransBlue = blue;
|
gWarpTransBlue = blue;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int scale_x_to_correct_aspect_center(int x) {
|
static s32 scale_x_to_correct_aspect_center(s32 x) {
|
||||||
f32 aspect = GFX_DIMENSIONS_ASPECT_RATIO;
|
f32 aspect = GFX_DIMENSIONS_ASPECT_RATIO;
|
||||||
return x + (SCREEN_HEIGHT * aspect / 2) - (SCREEN_WIDTH / 2);
|
return x + (SCREEN_HEIGHT * aspect / 2) - (SCREEN_WIDTH / 2);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -80,7 +80,7 @@ void bhv_activated_back_and_forth_platform_update(void) {
|
||||||
UNUSED s32 unused[3];
|
UNUSED s32 unused[3];
|
||||||
|
|
||||||
struct Object* player = nearest_player_to_object(o);
|
struct Object* player = nearest_player_to_object(o);
|
||||||
int distanceToPlayer = dist_between_objects(o, player);
|
s32 distanceToPlayer = dist_between_objects(o, player);
|
||||||
|
|
||||||
// oVelY is used for vertical platforms' movement and also for
|
// oVelY is used for vertical platforms' movement and also for
|
||||||
// horizontal platforms' dipping up/down when Mario gets on/off them
|
// horizontal platforms' dipping up/down when Mario gets on/off them
|
||||||
|
|
|
||||||
|
|
@ -20,7 +20,7 @@ void bhv_bbh_tilting_trap_platform_loop(void) {
|
||||||
f32 y = 0;
|
f32 y = 0;
|
||||||
f32 z = 0;
|
f32 z = 0;
|
||||||
u8 playersTouched = 0;
|
u8 playersTouched = 0;
|
||||||
for (int i = 0; i < MAX_PLAYERS; i++) {
|
for (s32 i = 0; i < MAX_PLAYERS; i++) {
|
||||||
if (!is_player_active(&gMarioStates[i])) { continue; }
|
if (!is_player_active(&gMarioStates[i])) { continue; }
|
||||||
if (gMarioStates[i].marioObj->platform == o) {
|
if (gMarioStates[i].marioObj->platform == o) {
|
||||||
x += gMarioStates[i].marioObj->oPosX;
|
x += gMarioStates[i].marioObj->oPosX;
|
||||||
|
|
@ -30,8 +30,8 @@ void bhv_bbh_tilting_trap_platform_loop(void) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int distanceToPlayer = 0;
|
s32 distanceToPlayer = 0;
|
||||||
int angleToPlayer = 0;
|
s32 angleToPlayer = 0;
|
||||||
if (playersTouched > 0) {
|
if (playersTouched > 0) {
|
||||||
x /= (f32)playersTouched;
|
x /= (f32)playersTouched;
|
||||||
y /= (f32)playersTouched;
|
y /= (f32)playersTouched;
|
||||||
|
|
|
||||||
|
|
@ -415,7 +415,7 @@ void bobomb_buddy_act_turn_to_talk(void) {
|
||||||
cur_obj_play_sound_2(SOUND_OBJ_BOBOMB_WALK);
|
cur_obj_play_sound_2(SOUND_OBJ_BOBOMB_WALK);
|
||||||
|
|
||||||
struct Object* player = nearest_player_to_object(o);
|
struct Object* player = nearest_player_to_object(o);
|
||||||
int angleToPlayer = obj_angle_to_object(o, player);
|
s32 angleToPlayer = obj_angle_to_object(o, player);
|
||||||
o->oMoveAngleYaw = approach_s16_symmetric(o->oMoveAngleYaw, angleToPlayer, 0x1000);
|
o->oMoveAngleYaw = approach_s16_symmetric(o->oMoveAngleYaw, angleToPlayer, 0x1000);
|
||||||
if ((s16) o->oMoveAngleYaw == (s16) angleToPlayer)
|
if ((s16) o->oMoveAngleYaw == (s16) angleToPlayer)
|
||||||
o->oAction = BOBOMB_BUDDY_ACT_TALK;
|
o->oAction = BOBOMB_BUDDY_ACT_TALK;
|
||||||
|
|
|
||||||
|
|
@ -56,7 +56,7 @@ void bhv_boo_init(void) {
|
||||||
|
|
||||||
static s32 boo_should_be_stopped(void) {
|
static s32 boo_should_be_stopped(void) {
|
||||||
if (cur_obj_has_behavior(bhvMerryGoRoundBigBoo) || cur_obj_has_behavior(bhvMerryGoRoundBoo)) {
|
if (cur_obj_has_behavior(bhvMerryGoRoundBigBoo) || cur_obj_has_behavior(bhvMerryGoRoundBoo)) {
|
||||||
for (int i = 0; i < MAX_PLAYERS; i++) {
|
for (s32 i = 0; i < MAX_PLAYERS; i++) {
|
||||||
if (!is_player_active(&gMarioStates[i])) { continue; }
|
if (!is_player_active(&gMarioStates[i])) { continue; }
|
||||||
if (gMarioStates[i].currentRoom == BBH_DYNAMIC_SURFACE_ROOM || gMarioStates[i].currentRoom == BBH_NEAR_MERRY_GO_ROUND_ROOM) { return FALSE; }
|
if (gMarioStates[i].currentRoom == BBH_DYNAMIC_SURFACE_ROOM || gMarioStates[i].currentRoom == BBH_NEAR_MERRY_GO_ROUND_ROOM) { return FALSE; }
|
||||||
}
|
}
|
||||||
|
|
@ -83,10 +83,10 @@ static s32 boo_should_be_stopped(void) {
|
||||||
|
|
||||||
static s32 boo_should_be_active(void) {
|
static s32 boo_should_be_active(void) {
|
||||||
struct MarioState* marioState = nearest_mario_state_to_object(o);
|
struct MarioState* marioState = nearest_mario_state_to_object(o);
|
||||||
int distanceToPlayer = dist_between_objects(o, marioState->marioObj);
|
s32 distanceToPlayer = dist_between_objects(o, marioState->marioObj);
|
||||||
|
|
||||||
u8 inRoom = FALSE;
|
u8 inRoom = FALSE;
|
||||||
for (int i = 0; i < MAX_PLAYERS; i++) {
|
for (s32 i = 0; i < MAX_PLAYERS; i++) {
|
||||||
if (!is_player_active(&gMarioStates[i])) { continue; }
|
if (!is_player_active(&gMarioStates[i])) { continue; }
|
||||||
if (gMarioStates[i].currentRoom == o->oRoom || gMarioStates[i].currentRoom == 0) { inRoom = TRUE; }
|
if (gMarioStates[i].currentRoom == o->oRoom || gMarioStates[i].currentRoom == 0) { inRoom = TRUE; }
|
||||||
}
|
}
|
||||||
|
|
@ -178,7 +178,7 @@ static void boo_oscillate(s32 ignoreOpacity) {
|
||||||
|
|
||||||
static s32 boo_vanish_or_appear(void) {
|
static s32 boo_vanish_or_appear(void) {
|
||||||
struct Object* player = nearest_player_to_object(o);
|
struct Object* player = nearest_player_to_object(o);
|
||||||
int angleToPlayer = obj_angle_to_object(o, player);
|
s32 angleToPlayer = obj_angle_to_object(o, player);
|
||||||
|
|
||||||
s16 relativeAngleToMario = abs_angle_diff(angleToPlayer, o->oMoveAngleYaw);
|
s16 relativeAngleToMario = abs_angle_diff(angleToPlayer, o->oMoveAngleYaw);
|
||||||
s16 relativeMarioFaceAngle = abs_angle_diff(o->oMoveAngleYaw, player->oFaceAngleYaw);
|
s16 relativeMarioFaceAngle = abs_angle_diff(o->oMoveAngleYaw, player->oFaceAngleYaw);
|
||||||
|
|
@ -207,7 +207,7 @@ static s32 boo_vanish_or_appear(void) {
|
||||||
|
|
||||||
static void boo_set_move_yaw_for_during_hit(s32 hurt) {
|
static void boo_set_move_yaw_for_during_hit(s32 hurt) {
|
||||||
struct Object* player = nearest_player_to_object(o);
|
struct Object* player = nearest_player_to_object(o);
|
||||||
int angleToPlayer = obj_angle_to_object(o, player);
|
s32 angleToPlayer = obj_angle_to_object(o, player);
|
||||||
|
|
||||||
cur_obj_become_intangible();
|
cur_obj_become_intangible();
|
||||||
|
|
||||||
|
|
@ -377,7 +377,7 @@ static s32 boo_get_attack_status(void) {
|
||||||
static void boo_chase_mario(f32 a0, s16 a1, f32 a2) {
|
static void boo_chase_mario(f32 a0, s16 a1, f32 a2) {
|
||||||
struct MarioState* marioState = nearest_mario_state_to_object(o);
|
struct MarioState* marioState = nearest_mario_state_to_object(o);
|
||||||
struct Object* player = marioState->marioObj;
|
struct Object* player = marioState->marioObj;
|
||||||
int angleToPlayer = obj_angle_to_object(o, player);
|
s32 angleToPlayer = obj_angle_to_object(o, player);
|
||||||
|
|
||||||
f32 sp1C;
|
f32 sp1C;
|
||||||
s16 sp1A;
|
s16 sp1A;
|
||||||
|
|
@ -621,7 +621,7 @@ static void big_boo_act_1(void) {
|
||||||
// redundant; this check is in boo_should_be_stopped
|
// redundant; this check is in boo_should_be_stopped
|
||||||
if (cur_obj_has_behavior(bhvMerryGoRoundBigBoo)) {
|
if (cur_obj_has_behavior(bhvMerryGoRoundBigBoo)) {
|
||||||
u8 inRoom = FALSE;
|
u8 inRoom = FALSE;
|
||||||
for (int i = 0; i < MAX_PLAYERS; i++) {
|
for (s32 i = 0; i < MAX_PLAYERS; i++) {
|
||||||
if (!is_player_active(&gMarioStates[i])) { continue; }
|
if (!is_player_active(&gMarioStates[i])) { continue; }
|
||||||
if (gMarioStates[i].currentRoom == BBH_DYNAMIC_SURFACE_ROOM || gMarioStates[i].currentRoom == BBH_NEAR_MERRY_GO_ROUND_ROOM) { inRoom = TRUE; }
|
if (gMarioStates[i].currentRoom == BBH_DYNAMIC_SURFACE_ROOM || gMarioStates[i].currentRoom == BBH_NEAR_MERRY_GO_ROUND_ROOM) { inRoom = TRUE; }
|
||||||
}
|
}
|
||||||
|
|
@ -712,7 +712,7 @@ static void big_boo_act_4(void) {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
struct Object* player = nearest_player_to_object(o);
|
struct Object* player = nearest_player_to_object(o);
|
||||||
int distanceToPlayer = dist_between_objects(o, player);
|
s32 distanceToPlayer = dist_between_objects(o, player);
|
||||||
|
|
||||||
if (o->oBehParams2ndByte == 0) {
|
if (o->oBehParams2ndByte == 0) {
|
||||||
obj_set_pos(o, 973, 0, 626);
|
obj_set_pos(o, 973, 0, 626);
|
||||||
|
|
@ -877,7 +877,7 @@ void bhv_merry_go_round_boo_manager_loop(void) {
|
||||||
}
|
}
|
||||||
|
|
||||||
struct Object* player = nearest_player_to_object(o);
|
struct Object* player = nearest_player_to_object(o);
|
||||||
int distanceToPlayer = dist_between_objects(o, player);
|
s32 distanceToPlayer = dist_between_objects(o, player);
|
||||||
|
|
||||||
switch (o->oAction) {
|
switch (o->oAction) {
|
||||||
case 0:
|
case 0:
|
||||||
|
|
@ -949,11 +949,11 @@ void bhv_boo_in_castle_loop(void) {
|
||||||
|
|
||||||
struct MarioState* marioState = nearest_mario_state_to_object(o);
|
struct MarioState* marioState = nearest_mario_state_to_object(o);
|
||||||
struct Object* player = marioState->marioObj;
|
struct Object* player = marioState->marioObj;
|
||||||
int distanceToPlayer = dist_between_objects(o, player);
|
s32 distanceToPlayer = dist_between_objects(o, player);
|
||||||
int angleToPlayer = obj_angle_to_object(o, player);
|
s32 angleToPlayer = obj_angle_to_object(o, player);
|
||||||
|
|
||||||
u8 inRoom = FALSE;
|
u8 inRoom = FALSE;
|
||||||
for (int i = 0; i < MAX_PLAYERS; i++) {
|
for (s32 i = 0; i < MAX_PLAYERS; i++) {
|
||||||
if (!is_player_active(&gMarioStates[i])) { continue; }
|
if (!is_player_active(&gMarioStates[i])) { continue; }
|
||||||
if (marioState->floor == NULL) { continue; }
|
if (marioState->floor == NULL) { continue; }
|
||||||
inRoom = inRoom || (marioState->floor->room == 1);
|
inRoom = inRoom || (marioState->floor->room == 1);
|
||||||
|
|
|
||||||
|
|
@ -29,7 +29,7 @@ void bhv_bouncing_fireball_flame_loop(void) {
|
||||||
|
|
||||||
void bhv_bouncing_fireball_loop(void) {
|
void bhv_bouncing_fireball_loop(void) {
|
||||||
struct Object* player = nearest_player_to_object(o);
|
struct Object* player = nearest_player_to_object(o);
|
||||||
int distanceToPlayer = dist_between_objects(o, player);
|
s32 distanceToPlayer = dist_between_objects(o, player);
|
||||||
|
|
||||||
struct Object *sp2C;
|
struct Object *sp2C;
|
||||||
f32 sp28;
|
f32 sp28;
|
||||||
|
|
|
||||||
|
|
@ -236,7 +236,7 @@ static void bowser_debug_actions(void) // unused
|
||||||
void bowser_bitdw_act_controller(void) {
|
void bowser_bitdw_act_controller(void) {
|
||||||
struct MarioState* marioState = nearest_mario_state_to_object(o);
|
struct MarioState* marioState = nearest_mario_state_to_object(o);
|
||||||
struct Object* player = marioState->marioObj;
|
struct Object* player = marioState->marioObj;
|
||||||
int distanceToPlayer = dist_between_objects(o, player);
|
s32 distanceToPlayer = dist_between_objects(o, player);
|
||||||
if (marioState->playerIndex != 0) { return; }
|
if (marioState->playerIndex != 0) { return; }
|
||||||
|
|
||||||
f32 rand = random_float();
|
f32 rand = random_float();
|
||||||
|
|
@ -273,7 +273,7 @@ void bowser_bitdw_act_controller(void) {
|
||||||
void bowser_bitfs_act_controller(void) {
|
void bowser_bitfs_act_controller(void) {
|
||||||
struct MarioState* marioState = nearest_mario_state_to_object(o);
|
struct MarioState* marioState = nearest_mario_state_to_object(o);
|
||||||
struct Object* player = marioState->marioObj;
|
struct Object* player = marioState->marioObj;
|
||||||
int distanceToPlayer = dist_between_objects(o, player);
|
s32 distanceToPlayer = dist_between_objects(o, player);
|
||||||
if (marioState->playerIndex != 0) { return; }
|
if (marioState->playerIndex != 0) { return; }
|
||||||
|
|
||||||
f32 rand = random_float();
|
f32 rand = random_float();
|
||||||
|
|
@ -305,7 +305,7 @@ void bowser_bitfs_act_controller(void) {
|
||||||
void bowser_general_bits_act_controller(void) {
|
void bowser_general_bits_act_controller(void) {
|
||||||
struct MarioState* marioState = nearest_mario_state_to_object(o);
|
struct MarioState* marioState = nearest_mario_state_to_object(o);
|
||||||
struct Object* player = marioState->marioObj;
|
struct Object* player = marioState->marioObj;
|
||||||
int distanceToPlayer = dist_between_objects(o, player);
|
s32 distanceToPlayer = dist_between_objects(o, player);
|
||||||
if (marioState->playerIndex != 0) { return; }
|
if (marioState->playerIndex != 0) { return; }
|
||||||
|
|
||||||
f32 rand = random_float();
|
f32 rand = random_float();
|
||||||
|
|
@ -394,7 +394,7 @@ void bowser_act_breath_fire(void) {
|
||||||
void bowser_act_walk_to_mario(void) // turn towards Mario
|
void bowser_act_walk_to_mario(void) // turn towards Mario
|
||||||
{
|
{
|
||||||
struct Object* player = nearest_player_to_object(o);
|
struct Object* player = nearest_player_to_object(o);
|
||||||
int angleToPlayer = obj_angle_to_object(o, player);
|
s32 angleToPlayer = obj_angle_to_object(o, player);
|
||||||
|
|
||||||
UNUSED s32 facing; // is Bowser facing Mario?
|
UNUSED s32 facing; // is Bowser facing Mario?
|
||||||
s16 turnSpeed;
|
s16 turnSpeed;
|
||||||
|
|
@ -427,8 +427,8 @@ void bowser_act_walk_to_mario(void) // turn towards Mario
|
||||||
|
|
||||||
void bowser_act_teleport(void) {
|
void bowser_act_teleport(void) {
|
||||||
struct Object* player = nearest_player_to_object(o);
|
struct Object* player = nearest_player_to_object(o);
|
||||||
int distanceToPlayer = dist_between_objects(o, player);
|
s32 distanceToPlayer = dist_between_objects(o, player);
|
||||||
int angleToPlayer = obj_angle_to_object(o, player);
|
s32 angleToPlayer = obj_angle_to_object(o, player);
|
||||||
|
|
||||||
switch (o->oSubAction) {
|
switch (o->oSubAction) {
|
||||||
case 0:
|
case 0:
|
||||||
|
|
@ -536,7 +536,7 @@ s32 bowser_set_anim_in_air(void) {
|
||||||
|
|
||||||
s32 bowser_land(void) {
|
s32 bowser_land(void) {
|
||||||
struct Object* player = nearest_player_to_object(o);
|
struct Object* player = nearest_player_to_object(o);
|
||||||
int distanceToPlayer = dist_between_objects(o, player);
|
s32 distanceToPlayer = dist_between_objects(o, player);
|
||||||
|
|
||||||
if (o->oMoveFlags & OBJ_MOVE_LANDED) {
|
if (o->oMoveFlags & OBJ_MOVE_LANDED) {
|
||||||
o->oForwardVel = 0;
|
o->oForwardVel = 0;
|
||||||
|
|
@ -667,7 +667,7 @@ void bowser_act_turn_from_edge(void) {
|
||||||
|
|
||||||
void bowser_act_charge_mario(void) {
|
void bowser_act_charge_mario(void) {
|
||||||
struct Object* player = nearest_player_to_object(o);
|
struct Object* player = nearest_player_to_object(o);
|
||||||
int angleToPlayer = obj_angle_to_object(o, player);
|
s32 angleToPlayer = obj_angle_to_object(o, player);
|
||||||
|
|
||||||
s32 sp34;
|
s32 sp34;
|
||||||
if (o->oTimer == 0)
|
if (o->oTimer == 0)
|
||||||
|
|
@ -906,8 +906,8 @@ void bowser_dead_bounce(void) {
|
||||||
|
|
||||||
s32 bowser_dead_wait_for_mario(void) {
|
s32 bowser_dead_wait_for_mario(void) {
|
||||||
struct Object* player = nearest_player_to_object(o);
|
struct Object* player = nearest_player_to_object(o);
|
||||||
int distanceToPlayer = dist_between_objects(o, player);
|
s32 distanceToPlayer = dist_between_objects(o, player);
|
||||||
int angleToPlayer = obj_angle_to_object(o, player);
|
s32 angleToPlayer = obj_angle_to_object(o, player);
|
||||||
|
|
||||||
s32 ret = 0;
|
s32 ret = 0;
|
||||||
cur_obj_become_intangible();
|
cur_obj_become_intangible();
|
||||||
|
|
@ -1246,8 +1246,8 @@ void bowser_thrown_dropped_update(void) {
|
||||||
|
|
||||||
void bhv_bowser_loop(void) {
|
void bhv_bowser_loop(void) {
|
||||||
struct Object* player = nearest_player_to_object(o);
|
struct Object* player = nearest_player_to_object(o);
|
||||||
int distanceToPlayer = dist_between_objects(o, player);
|
s32 distanceToPlayer = dist_between_objects(o, player);
|
||||||
int angleToPlayer = obj_angle_to_object(o, player);
|
s32 angleToPlayer = obj_angle_to_object(o, player);
|
||||||
|
|
||||||
// look for animation difference and override
|
// look for animation difference and override
|
||||||
struct Animation* anim = NULL;
|
struct Animation* anim = NULL;
|
||||||
|
|
@ -1305,7 +1305,7 @@ void bhv_bowser_loop(void) {
|
||||||
// update animation index
|
// update animation index
|
||||||
anim = o->oAnimations[networkBowserAnimationIndex];
|
anim = o->oAnimations[networkBowserAnimationIndex];
|
||||||
if (o->header.gfx.animInfo.curAnim != anim) {
|
if (o->header.gfx.animInfo.curAnim != anim) {
|
||||||
for (int i = 0; i < 32; i++) {
|
for (s32 i = 0; i < 32; i++) {
|
||||||
if (o->header.gfx.animInfo.curAnim == o->oAnimations[i]) {
|
if (o->header.gfx.animInfo.curAnim == o->oAnimations[i]) {
|
||||||
networkBowserAnimationIndex = i;
|
networkBowserAnimationIndex = i;
|
||||||
}
|
}
|
||||||
|
|
@ -1385,7 +1385,7 @@ Gfx *geo_update_body_rot_from_parent(s32 run, UNUSED struct GraphNode *node, Mat
|
||||||
|
|
||||||
void bowser_open_eye_switch(struct Object *a0, struct GraphNodeSwitchCase *switchCase) {
|
void bowser_open_eye_switch(struct Object *a0, struct GraphNodeSwitchCase *switchCase) {
|
||||||
struct Object* player = nearest_player_to_object(o);
|
struct Object* player = nearest_player_to_object(o);
|
||||||
int angleToPlayer = obj_angle_to_object(o, player);
|
s32 angleToPlayer = obj_angle_to_object(o, player);
|
||||||
|
|
||||||
s32 sp1C;
|
s32 sp1C;
|
||||||
s16 sp1A;
|
s16 sp1A;
|
||||||
|
|
|
||||||
|
|
@ -127,7 +127,7 @@ void bhv_lll_bowser_puzzle_loop(void) {
|
||||||
s32 i;
|
s32 i;
|
||||||
UNUSED struct Object *sp28;
|
UNUSED struct Object *sp28;
|
||||||
struct Object* player = nearest_player_to_object(o);
|
struct Object* player = nearest_player_to_object(o);
|
||||||
int distanceToPlayer = dist_between_objects(o, player);
|
s32 distanceToPlayer = dist_between_objects(o, player);
|
||||||
|
|
||||||
if (!network_sync_object_initialized(o)) {
|
if (!network_sync_object_initialized(o)) {
|
||||||
struct SyncObject *so = network_init_object(o, SYNC_DISTANCE_ONLY_EVENTS);
|
struct SyncObject *so = network_init_object(o, SYNC_DISTANCE_ONLY_EVENTS);
|
||||||
|
|
|
||||||
|
|
@ -14,8 +14,8 @@ static struct ObjectHitbox sBubbaHitbox = {
|
||||||
|
|
||||||
void bubba_act_0(void) {
|
void bubba_act_0(void) {
|
||||||
struct Object* player = nearest_player_to_object(o);
|
struct Object* player = nearest_player_to_object(o);
|
||||||
int distanceToPlayer = dist_between_objects(o, player);
|
s32 distanceToPlayer = dist_between_objects(o, player);
|
||||||
int angleToPlayer = obj_angle_to_object(o, player);
|
s32 angleToPlayer = obj_angle_to_object(o, player);
|
||||||
|
|
||||||
f32 sp24;
|
f32 sp24;
|
||||||
|
|
||||||
|
|
@ -126,8 +126,8 @@ void bhv_bubba_loop(void) {
|
||||||
|
|
||||||
struct MarioState* marioState = nearest_mario_state_to_object(o);
|
struct MarioState* marioState = nearest_mario_state_to_object(o);
|
||||||
struct Object* player = marioState->marioObj;
|
struct Object* player = marioState->marioObj;
|
||||||
int distanceToPlayer = dist_between_objects(o, player);
|
s32 distanceToPlayer = dist_between_objects(o, player);
|
||||||
int angleToPlayer = obj_angle_to_object(o, player);
|
s32 angleToPlayer = obj_angle_to_object(o, player);
|
||||||
|
|
||||||
UNUSED s32 unused;
|
UNUSED s32 unused;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -28,8 +28,8 @@ void bullet_bill_act_0(void) {
|
||||||
|
|
||||||
void bullet_bill_act_1(void) {
|
void bullet_bill_act_1(void) {
|
||||||
struct Object* player = nearest_player_to_object(o);
|
struct Object* player = nearest_player_to_object(o);
|
||||||
int distanceToPlayer = dist_between_objects(o, player);
|
s32 distanceToPlayer = dist_between_objects(o, player);
|
||||||
int angleToPlayer = obj_angle_to_object(o, player);
|
s32 angleToPlayer = obj_angle_to_object(o, player);
|
||||||
|
|
||||||
s16 sp1E = abs_angle_diff(angleToPlayer, o->oMoveAngleYaw);
|
s16 sp1E = abs_angle_diff(angleToPlayer, o->oMoveAngleYaw);
|
||||||
if (sp1E < 0x2000 && 400.0f < distanceToPlayer && distanceToPlayer < 1500.0f)
|
if (sp1E < 0x2000 && 400.0f < distanceToPlayer && distanceToPlayer < 1500.0f)
|
||||||
|
|
@ -38,8 +38,8 @@ void bullet_bill_act_1(void) {
|
||||||
|
|
||||||
void bullet_bill_act_2(void) {
|
void bullet_bill_act_2(void) {
|
||||||
struct Object* player = nearest_player_to_object(o);
|
struct Object* player = nearest_player_to_object(o);
|
||||||
int distanceToPlayer = dist_between_objects(o, player);
|
s32 distanceToPlayer = dist_between_objects(o, player);
|
||||||
int angleToPlayer = obj_angle_to_object(o, player);
|
s32 angleToPlayer = obj_angle_to_object(o, player);
|
||||||
|
|
||||||
if (o->oTimer < 40)
|
if (o->oTimer < 40)
|
||||||
o->oForwardVel = 3.0f;
|
o->oForwardVel = 3.0f;
|
||||||
|
|
|
||||||
|
|
@ -176,7 +176,7 @@ static void bhv_cannon_base_sanity_check(void) {
|
||||||
if (o->oCannonPlayerIndex == 0) {
|
if (o->oCannonPlayerIndex == 0) {
|
||||||
inUse = (gMarioStates[0].action == ACT_IN_CANNON && gMarioStates[0].interactObj == o);
|
inUse = (gMarioStates[0].action == ACT_IN_CANNON && gMarioStates[0].interactObj == o);
|
||||||
} else {
|
} else {
|
||||||
for (int i = 0; i < MAX_PLAYERS; i++) {
|
for (s32 i = 0; i < MAX_PLAYERS; i++) {
|
||||||
if (!is_player_active(&gMarioStates[i])) { continue; }
|
if (!is_player_active(&gMarioStates[i])) { continue; }
|
||||||
if (gMarioStates[i].action == ACT_IN_CANNON && gMarioStates[i].interactObj == o) {
|
if (gMarioStates[i].action == ACT_IN_CANNON && gMarioStates[i].interactObj == o) {
|
||||||
inUse = TRUE;
|
inUse = TRUE;
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
void bhv_floor_trap_in_castle_loop(void) {
|
void bhv_floor_trap_in_castle_loop(void) {
|
||||||
u8 onPlatform = FALSE;
|
u8 onPlatform = FALSE;
|
||||||
for (int i = 0; i < MAX_PLAYERS; i++) {
|
for (s32 i = 0; i < MAX_PLAYERS; i++) {
|
||||||
if (!is_player_active(&gMarioStates[i])) { continue; }
|
if (!is_player_active(&gMarioStates[i])) { continue; }
|
||||||
onPlatform = onPlatform || (gMarioStates[i].marioObj->platform == o);
|
onPlatform = onPlatform || (gMarioStates[i].marioObj->platform == o);
|
||||||
}
|
}
|
||||||
|
|
@ -43,7 +43,7 @@ void bhv_castle_floor_trap_open(void) {
|
||||||
|
|
||||||
void bhv_castle_floor_trap_close_detect(void) {
|
void bhv_castle_floor_trap_close_detect(void) {
|
||||||
struct Object* player = nearest_player_to_object(o);
|
struct Object* player = nearest_player_to_object(o);
|
||||||
int distanceToPlayer = dist_between_objects(o, player);
|
s32 distanceToPlayer = dist_between_objects(o, player);
|
||||||
if (distanceToPlayer > 1000.0f)
|
if (distanceToPlayer > 1000.0f)
|
||||||
o->oAction = 3; // close trapdoor
|
o->oAction = 3; // close trapdoor
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
// chuckya.c.inc
|
// chuckya.c.inc
|
||||||
|
|
||||||
void common_anchor_mario_behavior(f32 sp28, f32 sp2C, s32 sp30) {
|
void common_anchor_mario_behavior(f32 sp28, f32 sp2C, s32 sp30) {
|
||||||
for (int i = 0; i < MAX_PLAYERS; i++) {
|
for (s32 i = 0; i < MAX_PLAYERS; i++) {
|
||||||
if (!is_player_active(&gMarioStates[i])) { continue; }
|
if (!is_player_active(&gMarioStates[i])) { continue; }
|
||||||
struct MarioState* marioState = &gMarioStates[i];
|
struct MarioState* marioState = &gMarioStates[i];
|
||||||
struct Object* player = marioState->marioObj;
|
struct Object* player = marioState->marioObj;
|
||||||
|
|
@ -39,8 +39,8 @@ void bhv_chuckya_anchor_mario_loop(void) {
|
||||||
|
|
||||||
s32 unknown_chuckya_function(s32 sp20, f32 sp24, f32 sp28, s32 sp2C) {
|
s32 unknown_chuckya_function(s32 sp20, f32 sp24, f32 sp28, s32 sp2C) {
|
||||||
struct Object* player = nearest_player_to_object(o);
|
struct Object* player = nearest_player_to_object(o);
|
||||||
int distanceToPlayer = dist_between_objects(o, player);
|
s32 distanceToPlayer = dist_between_objects(o, player);
|
||||||
int angleToPlayer = obj_angle_to_object(o, player);
|
s32 angleToPlayer = obj_angle_to_object(o, player);
|
||||||
s32 sp1C = 0;
|
s32 sp1C = 0;
|
||||||
if (o->oChuckyaUnkF8 != 4) {
|
if (o->oChuckyaUnkF8 != 4) {
|
||||||
if (sp24 < cur_obj_lateral_dist_from_mario_to_home()) {
|
if (sp24 < cur_obj_lateral_dist_from_mario_to_home()) {
|
||||||
|
|
@ -82,7 +82,7 @@ s32 approach_forward_vel(f32 *arr, f32 spC, f32 sp10) {
|
||||||
|
|
||||||
void chuckya_act_0(void) {
|
void chuckya_act_0(void) {
|
||||||
struct Object* player = nearest_player_to_object(o);
|
struct Object* player = nearest_player_to_object(o);
|
||||||
int angleToPlayer = obj_angle_to_object(o, player);
|
s32 angleToPlayer = obj_angle_to_object(o, player);
|
||||||
s32 sp3C = 0;
|
s32 sp3C = 0;
|
||||||
UNUSED u8 pad[16];
|
UNUSED u8 pad[16];
|
||||||
s32 sp28;
|
s32 sp28;
|
||||||
|
|
|
||||||
|
|
@ -67,7 +67,7 @@ static void cloud_fwoosh_update(void) {
|
||||||
}
|
}
|
||||||
|
|
||||||
struct Object* player = nearest_player_to_object(o);
|
struct Object* player = nearest_player_to_object(o);
|
||||||
int distanceToPlayer = dist_between_objects(o, player);
|
s32 distanceToPlayer = dist_between_objects(o, player);
|
||||||
|
|
||||||
if (o->oCloudBlowing) {
|
if (o->oCloudBlowing) {
|
||||||
o->header.gfx.scale[0] += o->oCloudGrowSpeed;
|
o->header.gfx.scale[0] += o->oCloudGrowSpeed;
|
||||||
|
|
|
||||||
|
|
@ -95,7 +95,7 @@ void coffin_act_idle(void) {
|
||||||
|
|
||||||
struct MarioState* marioState = nearest_mario_state_to_object(o);
|
struct MarioState* marioState = nearest_mario_state_to_object(o);
|
||||||
struct Object* player = marioState->marioObj;
|
struct Object* player = marioState->marioObj;
|
||||||
int distanceToPlayer = dist_between_objects(o, player);
|
s32 distanceToPlayer = dist_between_objects(o, player);
|
||||||
|
|
||||||
dx = player->oPosX - o->oPosX;
|
dx = player->oPosX - o->oPosX;
|
||||||
dz = player->oPosZ - o->oPosZ;
|
dz = player->oPosZ - o->oPosZ;
|
||||||
|
|
|
||||||
|
|
@ -101,7 +101,7 @@ void bhv_controllable_platform_init(void) {
|
||||||
network_init_object_field(o, &o->oControllablePlatformUnk100);
|
network_init_object_field(o, &o->oControllablePlatformUnk100);
|
||||||
network_init_object_field(o, &o->oFaceAnglePitch);
|
network_init_object_field(o, &o->oFaceAnglePitch);
|
||||||
network_init_object_field(o, &o->oFaceAngleRoll);
|
network_init_object_field(o, &o->oFaceAngleRoll);
|
||||||
for (int i = 0; i < 4; i++) {
|
for (s32 i = 0; i < 4; i++) {
|
||||||
if (controllablePlatformSubs[i] == NULL) { continue; }
|
if (controllablePlatformSubs[i] == NULL) { continue; }
|
||||||
network_init_object_field(o, &controllablePlatformSubs[i]->oAction);
|
network_init_object_field(o, &controllablePlatformSubs[i]->oAction);
|
||||||
network_init_object_field(o, &controllablePlatformSubs[i]->oPrevAction);
|
network_init_object_field(o, &controllablePlatformSubs[i]->oPrevAction);
|
||||||
|
|
@ -178,7 +178,7 @@ void controllable_platform_tilt_from_mario(void) {
|
||||||
f32 x = 0;
|
f32 x = 0;
|
||||||
f32 z = 0;
|
f32 z = 0;
|
||||||
|
|
||||||
for (int i = 0; i < MAX_PLAYERS; i++) {
|
for (s32 i = 0; i < MAX_PLAYERS; i++) {
|
||||||
if (gMarioStates[i].marioObj->platform == o || gMarioStates[i].marioObj->platform == cur_obj_nearest_object_with_behavior(bhvControllablePlatformSub)) {
|
if (gMarioStates[i].marioObj->platform == o || gMarioStates[i].marioObj->platform == cur_obj_nearest_object_with_behavior(bhvControllablePlatformSub)) {
|
||||||
x += gMarioStates[i].pos[0];
|
x += gMarioStates[i].pos[0];
|
||||||
z += gMarioStates[i].pos[2];
|
z += gMarioStates[i].pos[2];
|
||||||
|
|
@ -277,7 +277,7 @@ void bhv_controllable_platform_loop(void) {
|
||||||
o->header.gfx.node.flags &= ~GRAPH_RENDER_INVISIBLE;
|
o->header.gfx.node.flags &= ~GRAPH_RENDER_INVISIBLE;
|
||||||
D_80331694 = 0;
|
D_80331694 = 0;
|
||||||
o->oTimer = 0;
|
o->oTimer = 0;
|
||||||
for (int i = 0; i < 4; i++) {
|
for (s32 i = 0; i < 4; i++) {
|
||||||
controllablePlatformSubs[i]->oParentRelativePosY = 51.0f;
|
controllablePlatformSubs[i]->oParentRelativePosY = 51.0f;
|
||||||
controllablePlatformSubs[i]->oAction = 0;
|
controllablePlatformSubs[i]->oAction = 0;
|
||||||
controllablePlatformSubs[i]->oTimer = 0;
|
controllablePlatformSubs[i]->oTimer = 0;
|
||||||
|
|
|
||||||
|
|
@ -36,7 +36,7 @@ void bhv_donut_platform_update(void) {
|
||||||
}
|
}
|
||||||
|
|
||||||
struct Object* player = nearest_player_to_object(o);
|
struct Object* player = nearest_player_to_object(o);
|
||||||
int distanceToPlayer = dist_between_objects(o, player);
|
s32 distanceToPlayer = dist_between_objects(o, player);
|
||||||
|
|
||||||
if (o->oAction == 2) {
|
if (o->oAction == 2) {
|
||||||
cur_obj_set_pos_to_home();
|
cur_obj_set_pos_to_home();
|
||||||
|
|
|
||||||
|
|
@ -16,7 +16,7 @@ void dorrie_raise_head(void) {
|
||||||
xzDisp = 440.0f * (coss(o->oDorrieNeckAngle) - coss(startAngle));
|
xzDisp = 440.0f * (coss(o->oDorrieNeckAngle) - coss(startAngle));
|
||||||
yDisp = 440.0f * (sins(o->oDorrieNeckAngle) - sins(startAngle));
|
yDisp = 440.0f * (sins(o->oDorrieNeckAngle) - sins(startAngle));
|
||||||
|
|
||||||
for (int i = 0; i < MAX_PLAYERS; i++) {
|
for (s32 i = 0; i < MAX_PLAYERS; i++) {
|
||||||
if (!is_player_active(&gMarioStates[i])) { continue; }
|
if (!is_player_active(&gMarioStates[i])) { continue; }
|
||||||
if (!dorrieLiftingPlayer[i]) { continue; }
|
if (!dorrieLiftingPlayer[i]) { continue; }
|
||||||
struct Object* player = gMarioStates[i].marioObj;
|
struct Object* player = gMarioStates[i].marioObj;
|
||||||
|
|
@ -46,7 +46,7 @@ void dorrie_act_move(void) {
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
u8 anyPlayerOnPlatform = FALSE;
|
u8 anyPlayerOnPlatform = FALSE;
|
||||||
for (int i = 0; i < MAX_PLAYERS; i++) {
|
for (s32 i = 0; i < MAX_PLAYERS; i++) {
|
||||||
if (!is_player_active(&gMarioStates[i])) { continue; }
|
if (!is_player_active(&gMarioStates[i])) { continue; }
|
||||||
struct Object* player = gMarioStates[i].marioObj;
|
struct Object* player = gMarioStates[i].marioObj;
|
||||||
if (player->platform != o) { continue; }
|
if (player->platform != o) { continue; }
|
||||||
|
|
@ -88,7 +88,7 @@ static u8 dorrie_act_lower_head_continue_dialog(void) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void dorrie_act_lower_head(void) {
|
void dorrie_act_lower_head(void) {
|
||||||
int distanceToLocalPlayer = dist_between_objects(o, gMarioStates[0].marioObj);
|
s32 distanceToLocalPlayer = dist_between_objects(o, gMarioStates[0].marioObj);
|
||||||
|
|
||||||
if (cur_obj_init_anim_check_frame(2, 35)) {
|
if (cur_obj_init_anim_check_frame(2, 35)) {
|
||||||
cur_obj_reverse_animation();
|
cur_obj_reverse_animation();
|
||||||
|
|
@ -131,13 +131,13 @@ void dorrie_act_raise_head(void) {
|
||||||
o->collisionData = segmented_to_virtual(dorrie_seg6_collision_0600F644);
|
o->collisionData = segmented_to_virtual(dorrie_seg6_collision_0600F644);
|
||||||
if (cur_obj_check_if_near_animation_end()) {
|
if (cur_obj_check_if_near_animation_end()) {
|
||||||
o->oAction = DORRIE_ACT_MOVE;
|
o->oAction = DORRIE_ACT_MOVE;
|
||||||
for (int i = 0; i < MAX_PLAYERS; i++) { dorrieLiftingPlayer[i] = FALSE; }
|
for (s32 i = 0; i < MAX_PLAYERS; i++) { dorrieLiftingPlayer[i] = FALSE; }
|
||||||
} else if (o->oDorrieLiftingMario && o->header.gfx.animInfo.animFrame < 74) {
|
} else if (o->oDorrieLiftingMario && o->header.gfx.animInfo.animFrame < 74) {
|
||||||
|
|
||||||
for (int i = 0; i < MAX_PLAYERS; i++) {
|
for (s32 i = 0; i < MAX_PLAYERS; i++) {
|
||||||
if (!is_player_active(&gMarioStates[i])) { continue; }
|
if (!is_player_active(&gMarioStates[i])) { continue; }
|
||||||
if (gMarioStates[i].marioObj->platform != o) { continue; }
|
if (gMarioStates[i].marioObj->platform != o) { continue; }
|
||||||
int dist = dist_between_objects(o, gMarioStates[0].marioObj);
|
s32 dist = dist_between_objects(o, gMarioStates[0].marioObj);
|
||||||
if (dist <= 780.0f) { continue; }
|
if (dist <= 780.0f) { continue; }
|
||||||
dorrieLiftingPlayer[i] = TRUE;
|
dorrieLiftingPlayer[i] = TRUE;
|
||||||
}
|
}
|
||||||
|
|
@ -159,11 +159,11 @@ void dorrie_act_raise_head(void) {
|
||||||
|
|
||||||
void bhv_dorrie_update(void) {
|
void bhv_dorrie_update(void) {
|
||||||
struct Object* player = nearest_player_to_object(o);
|
struct Object* player = nearest_player_to_object(o);
|
||||||
int distanceToPlayer = dist_between_objects(o, player);
|
s32 distanceToPlayer = dist_between_objects(o, player);
|
||||||
int angleToPlayer = obj_angle_to_object(o, player);
|
s32 angleToPlayer = obj_angle_to_object(o, player);
|
||||||
|
|
||||||
if (!network_sync_object_initialized(o)) {
|
if (!network_sync_object_initialized(o)) {
|
||||||
for (int i = 0; i < MAX_PLAYERS; i++) { dorrieLiftingPlayer[i] = FALSE; }
|
for (s32 i = 0; i < MAX_PLAYERS; i++) { dorrieLiftingPlayer[i] = FALSE; }
|
||||||
struct SyncObject* so = network_init_object(o, 4000.0f);
|
struct SyncObject* so = network_init_object(o, 4000.0f);
|
||||||
if (so) {
|
if (so) {
|
||||||
so->ignore_if_true = bhv_dorrie_ignore_if_true;
|
so->ignore_if_true = bhv_dorrie_ignore_if_true;
|
||||||
|
|
|
||||||
|
|
@ -19,7 +19,7 @@ void bhv_lll_drawbridge_spawner_init(void) {
|
||||||
|
|
||||||
if (!network_sync_object_initialized(o)) {
|
if (!network_sync_object_initialized(o)) {
|
||||||
network_init_object(o, 3000.0f);
|
network_init_object(o, 3000.0f);
|
||||||
for (int i = 0; i < 2; i++) {
|
for (s32 i = 0; i < 2; i++) {
|
||||||
if (drawbridge[i] == NULL) { continue; }
|
if (drawbridge[i] == NULL) { continue; }
|
||||||
network_init_object_field(o, &drawbridge[i]->oFaceAngleRoll);
|
network_init_object_field(o, &drawbridge[i]->oFaceAngleRoll);
|
||||||
network_init_object_field(o, &drawbridge[i]->oAction);
|
network_init_object_field(o, &drawbridge[i]->oAction);
|
||||||
|
|
|
||||||
|
|
@ -10,7 +10,7 @@ void elevator_act_0(void) {
|
||||||
struct Object* player = marioState->marioObj;
|
struct Object* player = marioState->marioObj;
|
||||||
|
|
||||||
u8 onPlatform = FALSE;
|
u8 onPlatform = FALSE;
|
||||||
for (int i = 0; i < MAX_PLAYERS; i++) {
|
for (s32 i = 0; i < MAX_PLAYERS; i++) {
|
||||||
if (!is_player_active(&gMarioStates[i])) { continue; }
|
if (!is_player_active(&gMarioStates[i])) { continue; }
|
||||||
onPlatform = onPlatform || gMarioStates[i].marioObj->platform == o;
|
onPlatform = onPlatform || gMarioStates[i].marioObj->platform == o;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -61,8 +61,8 @@ static void enemy_lakitu_update_vel_y(f32 offsetY) {
|
||||||
static void enemy_lakitu_update_speed_and_angle(void) {
|
static void enemy_lakitu_update_speed_and_angle(void) {
|
||||||
struct MarioState* marioState = nearest_mario_state_to_object(o);
|
struct MarioState* marioState = nearest_mario_state_to_object(o);
|
||||||
struct Object* player = marioState->marioObj;
|
struct Object* player = marioState->marioObj;
|
||||||
int distanceToPlayer = dist_between_objects(o, player);
|
s32 distanceToPlayer = dist_between_objects(o, player);
|
||||||
int angleToPlayer = obj_angle_to_object(o, player);
|
s32 angleToPlayer = obj_angle_to_object(o, player);
|
||||||
|
|
||||||
f32 minSpeed;
|
f32 minSpeed;
|
||||||
s16 turnSpeed;
|
s16 turnSpeed;
|
||||||
|
|
@ -102,8 +102,8 @@ static void enemy_lakitu_update_speed_and_angle(void) {
|
||||||
static void enemy_lakitu_sub_act_no_spiny(void) {
|
static void enemy_lakitu_sub_act_no_spiny(void) {
|
||||||
struct MarioState* marioState = nearest_mario_state_to_object(o);
|
struct MarioState* marioState = nearest_mario_state_to_object(o);
|
||||||
struct Object* player = marioState->marioObj;
|
struct Object* player = marioState->marioObj;
|
||||||
int distanceToPlayer = dist_between_objects(o, player);
|
s32 distanceToPlayer = dist_between_objects(o, player);
|
||||||
int angleToPlayer = obj_angle_to_object(o, player);
|
s32 angleToPlayer = obj_angle_to_object(o, player);
|
||||||
|
|
||||||
treat_far_home_as_mario(2000.0f, &distanceToPlayer, &angleToPlayer);
|
treat_far_home_as_mario(2000.0f, &distanceToPlayer, &angleToPlayer);
|
||||||
|
|
||||||
|
|
@ -148,8 +148,8 @@ static void enemy_lakitu_sub_act_hold_spiny(void) {
|
||||||
}
|
}
|
||||||
|
|
||||||
struct Object* player = nearest_player_to_object(o);
|
struct Object* player = nearest_player_to_object(o);
|
||||||
int distanceToPlayer = dist_between_objects(o, player);
|
s32 distanceToPlayer = dist_between_objects(o, player);
|
||||||
int angleToPlayer = obj_angle_to_object(o, player);
|
s32 angleToPlayer = obj_angle_to_object(o, player);
|
||||||
|
|
||||||
treat_far_home_as_mario(2000.0f, &distanceToPlayer, &angleToPlayer);
|
treat_far_home_as_mario(2000.0f, &distanceToPlayer, &angleToPlayer);
|
||||||
|
|
||||||
|
|
@ -217,7 +217,7 @@ static void enemy_lakitu_act_main(void) {
|
||||||
}
|
}
|
||||||
|
|
||||||
struct Object* player = nearest_player_to_object(o);
|
struct Object* player = nearest_player_to_object(o);
|
||||||
int distanceToPlayer = dist_between_objects(o, player);
|
s32 distanceToPlayer = dist_between_objects(o, player);
|
||||||
if (distanceToPlayer <= o->oDrawingDistance) {
|
if (distanceToPlayer <= o->oDrawingDistance) {
|
||||||
cur_obj_move_standard(78);
|
cur_obj_move_standard(78);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -62,7 +62,7 @@ void bhv_eyerok_boss_init(void) {
|
||||||
network_init_object_field(o, &o->oEyerokBossUnk10C);
|
network_init_object_field(o, &o->oEyerokBossUnk10C);
|
||||||
network_init_object_field(o, &o->oEyerokBossUnk110);
|
network_init_object_field(o, &o->oEyerokBossUnk110);
|
||||||
network_init_object_field(o, &o->oEyerokBossUnk1AC);
|
network_init_object_field(o, &o->oEyerokBossUnk1AC);
|
||||||
for (int i = 0; i < 2; i++) {
|
for (s32 i = 0; i < 2; i++) {
|
||||||
network_init_object_field(o, &hands[i]->oPosX);
|
network_init_object_field(o, &hands[i]->oPosX);
|
||||||
network_init_object_field(o, &hands[i]->oPosY);
|
network_init_object_field(o, &hands[i]->oPosY);
|
||||||
network_init_object_field(o, &hands[i]->oPosZ);
|
network_init_object_field(o, &hands[i]->oPosZ);
|
||||||
|
|
@ -87,7 +87,7 @@ void bhv_eyerok_boss_init(void) {
|
||||||
|
|
||||||
static void eyerok_boss_act_sleep(void) {
|
static void eyerok_boss_act_sleep(void) {
|
||||||
struct Object* player = nearest_player_to_object(o);
|
struct Object* player = nearest_player_to_object(o);
|
||||||
int distanceToPlayer = dist_between_objects(o, player);
|
s32 distanceToPlayer = dist_between_objects(o, player);
|
||||||
if (o->oTimer == 0) {
|
if (o->oTimer == 0) {
|
||||||
} else if (distanceToPlayer < 500.0f) {
|
} else if (distanceToPlayer < 500.0f) {
|
||||||
cur_obj_play_sound_2(SOUND_OBJ_EYEROK_EXPLODE);
|
cur_obj_play_sound_2(SOUND_OBJ_EYEROK_EXPLODE);
|
||||||
|
|
@ -243,7 +243,7 @@ void bhv_eyerok_boss_loop(void) {
|
||||||
|
|
||||||
static s32 eyerok_hand_check_attacked(void) {
|
static s32 eyerok_hand_check_attacked(void) {
|
||||||
struct Object* player = nearest_player_to_object(o);
|
struct Object* player = nearest_player_to_object(o);
|
||||||
int angleToPlayer = obj_angle_to_object(o, player);
|
s32 angleToPlayer = obj_angle_to_object(o, player);
|
||||||
if (o->oEyerokReceivedAttack != 0 && abs_angle_diff(angleToPlayer, o->oFaceAngleYaw) < 0x3000) {
|
if (o->oEyerokReceivedAttack != 0 && abs_angle_diff(angleToPlayer, o->oFaceAngleYaw) < 0x3000) {
|
||||||
cur_obj_play_sound_2(SOUND_OBJ2_EYEROK_SOUND_SHORT);
|
cur_obj_play_sound_2(SOUND_OBJ2_EYEROK_SOUND_SHORT);
|
||||||
|
|
||||||
|
|
@ -302,7 +302,7 @@ static void eyerok_hand_act_sleep(void) {
|
||||||
|
|
||||||
static void eyerok_hand_act_idle(void) {
|
static void eyerok_hand_act_idle(void) {
|
||||||
struct Object* player = nearest_player_to_object(o);
|
struct Object* player = nearest_player_to_object(o);
|
||||||
int angleToPlayer = obj_angle_to_object(o, player);
|
s32 angleToPlayer = obj_angle_to_object(o, player);
|
||||||
cur_obj_init_animation_with_sound(2);
|
cur_obj_init_animation_with_sound(2);
|
||||||
|
|
||||||
if (o->parentObj->oAction == EYEROK_BOSS_ACT_FIGHT) {
|
if (o->parentObj->oAction == EYEROK_BOSS_ACT_FIGHT) {
|
||||||
|
|
@ -362,7 +362,7 @@ static void eyerok_hand_act_open(void) {
|
||||||
|
|
||||||
static void eyerok_hand_act_show_eye(void) {
|
static void eyerok_hand_act_show_eye(void) {
|
||||||
struct Object* player = nearest_player_to_object(o);
|
struct Object* player = nearest_player_to_object(o);
|
||||||
int angleToPlayer = obj_angle_to_object(o, player);
|
s32 angleToPlayer = obj_angle_to_object(o, player);
|
||||||
UNUSED s16 val06;
|
UNUSED s16 val06;
|
||||||
|
|
||||||
cur_obj_init_animation_with_sound(5);
|
cur_obj_init_animation_with_sound(5);
|
||||||
|
|
@ -487,7 +487,7 @@ static void eyerok_hand_act_retreat(void) {
|
||||||
|
|
||||||
static void eyerok_hand_act_target_mario(void) {
|
static void eyerok_hand_act_target_mario(void) {
|
||||||
struct Object* player = nearest_player_to_object(o);
|
struct Object* player = nearest_player_to_object(o);
|
||||||
int angleToPlayer = obj_angle_to_object(o, player);
|
s32 angleToPlayer = obj_angle_to_object(o, player);
|
||||||
if (eyerok_check_mario_relative_z(400) != 0 || o->oPosZ - player->oPosZ > 0.0f
|
if (eyerok_check_mario_relative_z(400) != 0 || o->oPosZ - player->oPosZ > 0.0f
|
||||||
|| o->oPosZ - o->parentObj->oPosZ > 1700.0f || absf(o->oPosX - o->parentObj->oPosX) > 900.0f
|
|| o->oPosZ - o->parentObj->oPosZ > 1700.0f || absf(o->oPosX - o->parentObj->oPosX) > 900.0f
|
||||||
|| (o->oMoveFlags & OBJ_MOVE_HIT_WALL)) {
|
|| (o->oMoveFlags & OBJ_MOVE_HIT_WALL)) {
|
||||||
|
|
@ -504,8 +504,8 @@ static void eyerok_hand_act_target_mario(void) {
|
||||||
|
|
||||||
static void eyerok_hand_act_smash(void) {
|
static void eyerok_hand_act_smash(void) {
|
||||||
struct Object* player = nearest_player_to_object(o);
|
struct Object* player = nearest_player_to_object(o);
|
||||||
int distanceToPlayer = dist_between_objects(o, player);
|
s32 distanceToPlayer = dist_between_objects(o, player);
|
||||||
int angleToPlayer = obj_angle_to_object(o, player);
|
s32 angleToPlayer = obj_angle_to_object(o, player);
|
||||||
s16 sp1E;
|
s16 sp1E;
|
||||||
|
|
||||||
if (o->oTimer > 20) {
|
if (o->oTimer > 20) {
|
||||||
|
|
|
||||||
|
|
@ -61,7 +61,7 @@ s16 bhv_falling_pillar_calculate_angle_in_front_of_mario(void) {
|
||||||
*/
|
*/
|
||||||
void bhv_falling_pillar_loop(void) {
|
void bhv_falling_pillar_loop(void) {
|
||||||
struct Object* player = nearest_player_to_object(o);
|
struct Object* player = nearest_player_to_object(o);
|
||||||
int angleToPlayer = obj_angle_to_object(o, player);
|
s32 angleToPlayer = obj_angle_to_object(o, player);
|
||||||
|
|
||||||
s16 angleInFrontOfMario;
|
s16 angleInFrontOfMario;
|
||||||
switch (o->oAction) {
|
switch (o->oAction) {
|
||||||
|
|
|
||||||
|
|
@ -53,8 +53,8 @@ void bhv_fire_piranha_plant_init(void) {
|
||||||
|
|
||||||
static void fire_piranha_plant_act_hide(void) {
|
static void fire_piranha_plant_act_hide(void) {
|
||||||
struct Object* player = nearest_player_to_object(o);
|
struct Object* player = nearest_player_to_object(o);
|
||||||
int distanceToPlayer = dist_between_objects(o, player);
|
s32 distanceToPlayer = dist_between_objects(o, player);
|
||||||
int angleToPlayer = obj_angle_to_object(o, player);
|
s32 angleToPlayer = obj_angle_to_object(o, player);
|
||||||
|
|
||||||
if (o->oFirePiranhaPlantDeathSpinTimer != 0) {
|
if (o->oFirePiranhaPlantDeathSpinTimer != 0) {
|
||||||
o->oMoveAngleYaw += (s32) o->oFirePiranhaPlantDeathSpinVel;
|
o->oMoveAngleYaw += (s32) o->oFirePiranhaPlantDeathSpinVel;
|
||||||
|
|
@ -101,7 +101,7 @@ static void fire_piranha_plant_act_hide(void) {
|
||||||
|
|
||||||
static void fire_piranha_plant_act_grow(void) {
|
static void fire_piranha_plant_act_grow(void) {
|
||||||
struct Object* player = nearest_player_to_object(o);
|
struct Object* player = nearest_player_to_object(o);
|
||||||
int angleToPlayer = obj_angle_to_object(o, player);
|
s32 angleToPlayer = obj_angle_to_object(o, player);
|
||||||
|
|
||||||
cur_obj_init_anim_extend(4);
|
cur_obj_init_anim_extend(4);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
|
|
||||||
static void fire_spitter_act_idle(void) {
|
static void fire_spitter_act_idle(void) {
|
||||||
struct Object* player = nearest_player_to_object(o);
|
struct Object* player = nearest_player_to_object(o);
|
||||||
int distanceToPlayer = dist_between_objects(o, player);
|
s32 distanceToPlayer = dist_between_objects(o, player);
|
||||||
approach_f32_ptr(&o->header.gfx.scale[0], 0.2f, 0.002f);
|
approach_f32_ptr(&o->header.gfx.scale[0], 0.2f, 0.002f);
|
||||||
if (o->oTimer > 150 && distanceToPlayer < 800.0f && !(o->oMoveFlags & OBJ_MOVE_MASK_IN_WATER)) {
|
if (o->oTimer > 150 && distanceToPlayer < 800.0f && !(o->oMoveFlags & OBJ_MOVE_MASK_IN_WATER)) {
|
||||||
o->oAction = FIRE_SPITTER_ACT_SPIT_FIRE;
|
o->oAction = FIRE_SPITTER_ACT_SPIT_FIRE;
|
||||||
|
|
@ -13,7 +13,7 @@ static void fire_spitter_act_spit_fire(void) {
|
||||||
s32 scaleStatus;
|
s32 scaleStatus;
|
||||||
|
|
||||||
struct Object* player = nearest_player_to_object(o);
|
struct Object* player = nearest_player_to_object(o);
|
||||||
int angleToPlayer = obj_angle_to_object(o, player);
|
s32 angleToPlayer = obj_angle_to_object(o, player);
|
||||||
|
|
||||||
o->oMoveAngleYaw = angleToPlayer;
|
o->oMoveAngleYaw = angleToPlayer;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -103,8 +103,8 @@ static void fish_vertical_roam(s32 speed) {
|
||||||
*/
|
*/
|
||||||
static void fish_act_roam(void) {
|
static void fish_act_roam(void) {
|
||||||
struct Object* player = nearest_player_to_object(o);
|
struct Object* player = nearest_player_to_object(o);
|
||||||
int distanceToPlayer = dist_between_objects(o, player);
|
s32 distanceToPlayer = dist_between_objects(o, player);
|
||||||
int angleToPlayer = obj_angle_to_object(o, player);
|
s32 angleToPlayer = obj_angle_to_object(o, player);
|
||||||
|
|
||||||
f32 fishY = o->oPosY - player->oPosY;
|
f32 fishY = o->oPosY - player->oPosY;
|
||||||
|
|
||||||
|
|
@ -161,8 +161,8 @@ static void fish_act_roam(void) {
|
||||||
*/
|
*/
|
||||||
static void fish_act_flee(void) {
|
static void fish_act_flee(void) {
|
||||||
struct Object* player = nearest_player_to_object(o);
|
struct Object* player = nearest_player_to_object(o);
|
||||||
int distanceToPlayer = dist_between_objects(o, player);
|
s32 distanceToPlayer = dist_between_objects(o, player);
|
||||||
int angleToPlayer = obj_angle_to_object(o, player);
|
s32 angleToPlayer = obj_angle_to_object(o, player);
|
||||||
|
|
||||||
f32 fishY = o->oPosY - gMarioObject->oPosY;
|
f32 fishY = o->oPosY - gMarioObject->oPosY;
|
||||||
UNUSED s32 distance;
|
UNUSED s32 distance;
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
void bhv_small_piranha_flame_loop(void) {
|
void bhv_small_piranha_flame_loop(void) {
|
||||||
struct Object* player = nearest_player_to_object(o);
|
struct Object* player = nearest_player_to_object(o);
|
||||||
int angleToPlayer = obj_angle_to_object(o, player);
|
s32 angleToPlayer = obj_angle_to_object(o, player);
|
||||||
|
|
||||||
if ((u16)(o->oBehParams >> 16) == 0) {
|
if ((u16)(o->oBehParams >> 16) == 0) {
|
||||||
if (o->oTimer > 0) {
|
if (o->oTimer > 0) {
|
||||||
|
|
|
||||||
|
|
@ -42,7 +42,7 @@ void bhv_flamethrower_loop(void) {
|
||||||
}
|
}
|
||||||
struct MarioState* marioState = nearest_mario_state_to_object(o);
|
struct MarioState* marioState = nearest_mario_state_to_object(o);
|
||||||
struct Object* player = marioState->marioObj;
|
struct Object* player = marioState->marioObj;
|
||||||
int distanceToPlayer = dist_between_objects(o, player);
|
s32 distanceToPlayer = dist_between_objects(o, player);
|
||||||
|
|
||||||
struct Object *flame;
|
struct Object *flame;
|
||||||
f32 flameVel;
|
f32 flameVel;
|
||||||
|
|
|
||||||
|
|
@ -21,7 +21,7 @@ void floating_platform_act_0(void) {
|
||||||
f32 x = 0;
|
f32 x = 0;
|
||||||
f32 z = 0;
|
f32 z = 0;
|
||||||
u8 playersTouched = 0;
|
u8 playersTouched = 0;
|
||||||
for (int i = 0; i < MAX_PLAYERS; i++) {
|
for (s32 i = 0; i < MAX_PLAYERS; i++) {
|
||||||
if (!is_player_active(&gMarioStates[i])) { continue; }
|
if (!is_player_active(&gMarioStates[i])) { continue; }
|
||||||
if (gMarioStates[i].marioObj->platform == o) {
|
if (gMarioStates[i].marioObj->platform == o) {
|
||||||
x += gMarioStates[i].marioObj->oPosX;
|
x += gMarioStates[i].marioObj->oPosX;
|
||||||
|
|
|
||||||
|
|
@ -29,8 +29,8 @@ static s16 sFlyGuyJitterAmounts[] = { 0x1000, -0x2000, 0x2000 };
|
||||||
*/
|
*/
|
||||||
static void fly_guy_act_idle(void) {
|
static void fly_guy_act_idle(void) {
|
||||||
struct Object* player = nearest_player_to_object(o);
|
struct Object* player = nearest_player_to_object(o);
|
||||||
int distanceToPlayer = dist_between_objects(o, player);
|
s32 distanceToPlayer = dist_between_objects(o, player);
|
||||||
int angleToPlayer = obj_angle_to_object(o, player);
|
s32 angleToPlayer = obj_angle_to_object(o, player);
|
||||||
|
|
||||||
treat_far_home_as_mario(2000.0f, &distanceToPlayer, &angleToPlayer);
|
treat_far_home_as_mario(2000.0f, &distanceToPlayer, &angleToPlayer);
|
||||||
|
|
||||||
|
|
@ -64,8 +64,8 @@ static void fly_guy_act_idle(void) {
|
||||||
static void fly_guy_act_approach_mario(void) {
|
static void fly_guy_act_approach_mario(void) {
|
||||||
struct MarioState* marioState = nearest_mario_state_to_object(o);
|
struct MarioState* marioState = nearest_mario_state_to_object(o);
|
||||||
struct Object* player = marioState->marioObj;
|
struct Object* player = marioState->marioObj;
|
||||||
int distanceToPlayer = dist_between_objects(o, player);
|
s32 distanceToPlayer = dist_between_objects(o, player);
|
||||||
int angleToPlayer = obj_angle_to_object(o, player);
|
s32 angleToPlayer = obj_angle_to_object(o, player);
|
||||||
|
|
||||||
treat_far_home_as_mario(2000.0f, &distanceToPlayer, &angleToPlayer);
|
treat_far_home_as_mario(2000.0f, &distanceToPlayer, &angleToPlayer);
|
||||||
|
|
||||||
|
|
@ -148,7 +148,7 @@ static void fly_guy_act_lunge(void) {
|
||||||
static void fly_guy_act_shoot_fire(void) {
|
static void fly_guy_act_shoot_fire(void) {
|
||||||
struct MarioState* marioState = nearest_mario_state_to_object(o);
|
struct MarioState* marioState = nearest_mario_state_to_object(o);
|
||||||
struct Object* player = marioState->marioObj;
|
struct Object* player = marioState->marioObj;
|
||||||
int angleToPlayer = obj_angle_to_object(o, player);
|
s32 angleToPlayer = obj_angle_to_object(o, player);
|
||||||
|
|
||||||
treat_far_home_as_mario(2000.0f, NULL, &angleToPlayer);
|
treat_far_home_as_mario(2000.0f, NULL, &angleToPlayer);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -71,7 +71,7 @@ void flying_bookend_act_1(void) {
|
||||||
void flying_bookend_act_2(void) {
|
void flying_bookend_act_2(void) {
|
||||||
struct MarioState* marioState = nearest_mario_state_to_object(o);
|
struct MarioState* marioState = nearest_mario_state_to_object(o);
|
||||||
struct Object* player = marioState->marioObj;
|
struct Object* player = marioState->marioObj;
|
||||||
int angleToPlayer = obj_angle_to_object(o, player);
|
s32 angleToPlayer = obj_angle_to_object(o, player);
|
||||||
|
|
||||||
cur_obj_init_animation_with_sound(1);
|
cur_obj_init_animation_with_sound(1);
|
||||||
cur_obj_update_floor_and_walls();
|
cur_obj_update_floor_and_walls();
|
||||||
|
|
@ -321,7 +321,7 @@ void bhv_book_switch_loop(void) {
|
||||||
|
|
||||||
struct MarioState* marioState = nearest_mario_state_to_object(o);
|
struct MarioState* marioState = nearest_mario_state_to_object(o);
|
||||||
struct Object* player = marioState->marioObj;
|
struct Object* player = marioState->marioObj;
|
||||||
int distanceToPlayer = dist_between_objects(o, player);
|
s32 distanceToPlayer = dist_between_objects(o, player);
|
||||||
|
|
||||||
o->header.gfx.scale[0] = 2.0f;
|
o->header.gfx.scale[0] = 2.0f;
|
||||||
o->header.gfx.scale[1] = 0.9f;
|
o->header.gfx.scale[1] = 0.9f;
|
||||||
|
|
|
||||||
|
|
@ -172,8 +172,8 @@ static void goomba_act_walk(void) {
|
||||||
o->oGoombaTurningAwayFromWall = obj_resolve_collisions_and_turn(o->oGoombaTargetYaw, 0x200);
|
o->oGoombaTurningAwayFromWall = obj_resolve_collisions_and_turn(o->oGoombaTargetYaw, 0x200);
|
||||||
} else {
|
} else {
|
||||||
struct Object* player = nearest_player_to_object(o);
|
struct Object* player = nearest_player_to_object(o);
|
||||||
int distanceToPlayer = dist_between_objects(o, player);
|
s32 distanceToPlayer = dist_between_objects(o, player);
|
||||||
int angleToPlayer = obj_angle_to_object(o, player);
|
s32 angleToPlayer = obj_angle_to_object(o, player);
|
||||||
treat_far_home_as_mario(1000.0f, &distanceToPlayer, &angleToPlayer);
|
treat_far_home_as_mario(1000.0f, &distanceToPlayer, &angleToPlayer);
|
||||||
|
|
||||||
// If far from home, walk toward home.
|
// If far from home, walk toward home.
|
||||||
|
|
@ -234,7 +234,7 @@ static void goomba_act_attacked_mario(void) {
|
||||||
//! This can happen even when the goomba is already in the air. It's
|
//! This can happen even when the goomba is already in the air. It's
|
||||||
// hard to chain these in practice
|
// hard to chain these in practice
|
||||||
struct Object* player = nearest_player_to_object(o);
|
struct Object* player = nearest_player_to_object(o);
|
||||||
int angleToPlayer = obj_angle_to_object(o, player);
|
s32 angleToPlayer = obj_angle_to_object(o, player);
|
||||||
goomba_begin_jump();
|
goomba_begin_jump();
|
||||||
o->oGoombaTargetYaw = angleToPlayer;
|
o->oGoombaTargetYaw = angleToPlayer;
|
||||||
o->oGoombaTurningAwayFromWall = FALSE;
|
o->oGoombaTurningAwayFromWall = FALSE;
|
||||||
|
|
|
||||||
|
|
@ -39,7 +39,7 @@ void haunted_chair_act_0(void) {
|
||||||
s16 val0E;
|
s16 val0E;
|
||||||
|
|
||||||
struct Object* player = nearest_player_to_object(o);
|
struct Object* player = nearest_player_to_object(o);
|
||||||
int distanceToPlayer = dist_between_objects(o, player);
|
s32 distanceToPlayer = dist_between_objects(o, player);
|
||||||
|
|
||||||
if (o->parentObj != o) {
|
if (o->parentObj != o) {
|
||||||
if (o->oHauntedChairUnk104 == 0) {
|
if (o->oHauntedChairUnk104 == 0) {
|
||||||
|
|
@ -111,7 +111,7 @@ void haunted_chair_act_1(void) {
|
||||||
|
|
||||||
struct MarioState* marioState = nearest_mario_state_to_object(o);
|
struct MarioState* marioState = nearest_mario_state_to_object(o);
|
||||||
struct Object* player = marioState->marioObj;
|
struct Object* player = marioState->marioObj;
|
||||||
int angleToPlayer = obj_angle_to_object(o, player);
|
s32 angleToPlayer = obj_angle_to_object(o, player);
|
||||||
|
|
||||||
if (o->oTimer < 70) {
|
if (o->oTimer < 70) {
|
||||||
if (o->oTimer < 50) {
|
if (o->oTimer < 50) {
|
||||||
|
|
|
||||||
|
|
@ -47,7 +47,7 @@ void heave_ho_act_1(void) {
|
||||||
|
|
||||||
void heave_ho_act_2(void) {
|
void heave_ho_act_2(void) {
|
||||||
struct Object* player = nearest_player_to_object(o);
|
struct Object* player = nearest_player_to_object(o);
|
||||||
int angleToPlayer = obj_angle_to_object(o, player);
|
s32 angleToPlayer = obj_angle_to_object(o, player);
|
||||||
|
|
||||||
UNUSED s32 unused;
|
UNUSED s32 unused;
|
||||||
s16 angleVel;
|
s16 angleVel;
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,7 @@ struct MarioState* king_bobomb_nearest_mario_state() {
|
||||||
f32 nearestDist = 0;
|
f32 nearestDist = 0;
|
||||||
u8 checkActive = TRUE;
|
u8 checkActive = TRUE;
|
||||||
do {
|
do {
|
||||||
for (int i = 0; i < MAX_PLAYERS; i++) {
|
for (s32 i = 0; i < MAX_PLAYERS; i++) {
|
||||||
if (checkActive && !is_player_active(&gMarioStates[i])) { continue; }
|
if (checkActive && !is_player_active(&gMarioStates[i])) { continue; }
|
||||||
float ydiff = (o->oPosY - gMarioStates[i].marioObj->oPosY);
|
float ydiff = (o->oPosY - gMarioStates[i].marioObj->oPosY);
|
||||||
if (ydiff >= 1200) { continue; }
|
if (ydiff >= 1200) { continue; }
|
||||||
|
|
@ -96,7 +96,7 @@ void king_bobomb_act_2(void) {
|
||||||
o->oForwardVel = 3.0f;
|
o->oForwardVel = 3.0f;
|
||||||
struct MarioState* marioState = king_bobomb_nearest_mario_state();
|
struct MarioState* marioState = king_bobomb_nearest_mario_state();
|
||||||
if (marioState != NULL) {
|
if (marioState != NULL) {
|
||||||
int angleToPlayer = obj_angle_to_object(o, marioState->marioObj);
|
s32 angleToPlayer = obj_angle_to_object(o, marioState->marioObj);
|
||||||
cur_obj_rotate_yaw_toward(angleToPlayer, 0x100);
|
cur_obj_rotate_yaw_toward(angleToPlayer, 0x100);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|
@ -204,7 +204,7 @@ void king_bobomb_act_6(void) {
|
||||||
cur_obj_init_animation_with_sound(11);
|
cur_obj_init_animation_with_sound(11);
|
||||||
struct MarioState* marioState = king_bobomb_nearest_mario_state();
|
struct MarioState* marioState = king_bobomb_nearest_mario_state();
|
||||||
if (marioState != NULL) {
|
if (marioState != NULL) {
|
||||||
int angleToPlayer = obj_angle_to_object(o, marioState->marioObj);
|
s32 angleToPlayer = obj_angle_to_object(o, marioState->marioObj);
|
||||||
if (cur_obj_rotate_yaw_toward(angleToPlayer, 0x800) == 1) {
|
if (cur_obj_rotate_yaw_toward(angleToPlayer, 0x800) == 1) {
|
||||||
o->oAction = 2;
|
o->oAction = 2;
|
||||||
}
|
}
|
||||||
|
|
@ -362,7 +362,7 @@ void king_bobomb_move(void) {
|
||||||
cur_obj_move_using_fvel_and_gravity();
|
cur_obj_move_using_fvel_and_gravity();
|
||||||
cur_obj_call_action_function(sKingBobombActions);
|
cur_obj_call_action_function(sKingBobombActions);
|
||||||
exec_anim_sound_state(sKingBobombSoundStates);
|
exec_anim_sound_state(sKingBobombSoundStates);
|
||||||
int distanceToPlayer = dist_between_objects(o, gMarioStates[0].marioObj);
|
s32 distanceToPlayer = dist_between_objects(o, gMarioStates[0].marioObj);
|
||||||
if (distanceToPlayer < 5000.0f * draw_distance_scalar())
|
if (distanceToPlayer < 5000.0f * draw_distance_scalar())
|
||||||
cur_obj_enable_rendering();
|
cur_obj_enable_rendering();
|
||||||
else
|
else
|
||||||
|
|
|
||||||
|
|
@ -176,8 +176,8 @@ static void koopa_play_footstep_sound(s8 animFrame1, s8 animFrame2) {
|
||||||
* running away.
|
* running away.
|
||||||
*/
|
*/
|
||||||
static s32 koopa_check_run_from_mario(void) {
|
static s32 koopa_check_run_from_mario(void) {
|
||||||
int distanceToPlayer = o->oDistanceToMario;
|
s32 distanceToPlayer = o->oDistanceToMario;
|
||||||
int angleToPlayer = o->oAngleToMario;
|
s32 angleToPlayer = o->oAngleToMario;
|
||||||
if (distanceToPlayer < 300.0f && abs_angle_diff(angleToPlayer, o->oMoveAngleYaw) < 0x3000) {
|
if (distanceToPlayer < 300.0f && abs_angle_diff(angleToPlayer, o->oMoveAngleYaw) < 0x3000) {
|
||||||
o->oAction = KOOPA_SHELLED_ACT_RUN_FROM_MARIO;
|
o->oAction = KOOPA_SHELLED_ACT_RUN_FROM_MARIO;
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
|
@ -242,8 +242,8 @@ static void koopa_shelled_act_walk(void) {
|
||||||
if (o->oKoopaTurningAwayFromWall) {
|
if (o->oKoopaTurningAwayFromWall) {
|
||||||
o->oKoopaTurningAwayFromWall = obj_resolve_collisions_and_turn(o->oKoopaTargetYaw, 0x200);
|
o->oKoopaTurningAwayFromWall = obj_resolve_collisions_and_turn(o->oKoopaTargetYaw, 0x200);
|
||||||
} else {
|
} else {
|
||||||
int distanceToPlayer = o->oDistanceToMario;
|
s32 distanceToPlayer = o->oDistanceToMario;
|
||||||
int angleToPlayer = o->oAngleToMario;
|
s32 angleToPlayer = o->oAngleToMario;
|
||||||
// If far from home, then begin turning toward home
|
// If far from home, then begin turning toward home
|
||||||
if (distanceToPlayer >= 25000.0f) {
|
if (distanceToPlayer >= 25000.0f) {
|
||||||
o->oKoopaTargetYaw = angleToPlayer;
|
o->oKoopaTargetYaw = angleToPlayer;
|
||||||
|
|
@ -276,8 +276,8 @@ static void koopa_shelled_act_run_from_mario(void) {
|
||||||
cur_obj_init_animation_with_sound(1);
|
cur_obj_init_animation_with_sound(1);
|
||||||
koopa_play_footstep_sound(0, 11);
|
koopa_play_footstep_sound(0, 11);
|
||||||
|
|
||||||
int distanceToPlayer = o->oDistanceToMario;
|
s32 distanceToPlayer = o->oDistanceToMario;
|
||||||
int angleToPlayer = o->oAngleToMario;
|
s32 angleToPlayer = o->oAngleToMario;
|
||||||
|
|
||||||
// If far from home, run toward it
|
// If far from home, run toward it
|
||||||
if (distanceToPlayer >= 25000.0f) {
|
if (distanceToPlayer >= 25000.0f) {
|
||||||
|
|
@ -343,7 +343,7 @@ void shelled_koopa_attack_handler(s32 attackType) {
|
||||||
// If attacked from the side, get knocked away from mario
|
// If attacked from the side, get knocked away from mario
|
||||||
if (attackType != ATTACK_FROM_ABOVE && attackType != ATTACK_GROUND_POUND_OR_TWIRL) {
|
if (attackType != ATTACK_FROM_ABOVE && attackType != ATTACK_GROUND_POUND_OR_TWIRL) {
|
||||||
struct Object* player = nearest_player_to_object(o);
|
struct Object* player = nearest_player_to_object(o);
|
||||||
int angleToPlayer = obj_angle_to_object(o, player);
|
s32 angleToPlayer = obj_angle_to_object(o, player);
|
||||||
o->oMoveAngleYaw = angleToPlayer;
|
o->oMoveAngleYaw = angleToPlayer;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -422,8 +422,8 @@ static void koopa_shelled_update(void) {
|
||||||
* action.
|
* action.
|
||||||
*/
|
*/
|
||||||
static void koopa_unshelled_act_run(void) {
|
static void koopa_unshelled_act_run(void) {
|
||||||
int distanceToPlayer = o->oDistanceToMario;
|
s32 distanceToPlayer = o->oDistanceToMario;
|
||||||
int angleToPlayer = o->oAngleToMario;
|
s32 angleToPlayer = o->oAngleToMario;
|
||||||
|
|
||||||
f32 distToShell = 99999.0f;
|
f32 distToShell = 99999.0f;
|
||||||
struct Object *shell;
|
struct Object *shell;
|
||||||
|
|
@ -494,7 +494,7 @@ static void koopa_unshelled_act_dive(void) {
|
||||||
if (o->oTimer > 10) {
|
if (o->oTimer > 10) {
|
||||||
shell = cur_obj_find_nearest_object_with_behavior(bhvKoopaShell, &distToShell);
|
shell = cur_obj_find_nearest_object_with_behavior(bhvKoopaShell, &distToShell);
|
||||||
|
|
||||||
int distanceToPlayer = o->oDistanceToMario;
|
s32 distanceToPlayer = o->oDistanceToMario;
|
||||||
|
|
||||||
// If we got the shell and mario didn't, put on the shell
|
// If we got the shell and mario didn't, put on the shell
|
||||||
//! The shell comes after koopa in processing order, and the shell is
|
//! The shell comes after koopa in processing order, and the shell is
|
||||||
|
|
@ -731,7 +731,7 @@ static void koopa_the_quick_act_race(void) {
|
||||||
koopa_the_quick_animate_footsteps();
|
koopa_the_quick_animate_footsteps();
|
||||||
|
|
||||||
struct Object* player = nearest_player_to_object(o);
|
struct Object* player = nearest_player_to_object(o);
|
||||||
int distanceToPlayer = dist_between_objects(o, player);
|
s32 distanceToPlayer = dist_between_objects(o, player);
|
||||||
|
|
||||||
if (o->parentObj->oKoopaRaceEndpointRaceStatus != 0 && distanceToPlayer > 1500.0f
|
if (o->parentObj->oKoopaRaceEndpointRaceStatus != 0 && distanceToPlayer > 1500.0f
|
||||||
&& (o->oPathedPrevWaypointFlags & WAYPOINT_MASK_00FF) < 28) {
|
&& (o->oPathedPrevWaypointFlags & WAYPOINT_MASK_00FF) < 28) {
|
||||||
|
|
@ -924,8 +924,8 @@ void bhv_koopa_update(void) {
|
||||||
koopa_the_quick_update();
|
koopa_the_quick_update();
|
||||||
} else if (obj_update_standard_actions(o->oKoopaAgility * 1.5f)) {
|
} else if (obj_update_standard_actions(o->oKoopaAgility * 1.5f)) {
|
||||||
struct Object* player = nearest_player_to_object(o);
|
struct Object* player = nearest_player_to_object(o);
|
||||||
int distanceToPlayer = dist_between_objects(o, player);
|
s32 distanceToPlayer = dist_between_objects(o, player);
|
||||||
int angleToPlayer = obj_angle_to_object(o, player);
|
s32 angleToPlayer = obj_angle_to_object(o, player);
|
||||||
|
|
||||||
o->oKoopaDistanceToMario = distanceToPlayer;
|
o->oKoopaDistanceToMario = distanceToPlayer;
|
||||||
o->oKoopaAngleToMario = angleToPlayer;
|
o->oKoopaAngleToMario = angleToPlayer;
|
||||||
|
|
@ -959,7 +959,7 @@ void bhv_koopa_update(void) {
|
||||||
void bhv_koopa_race_endpoint_update(void) {
|
void bhv_koopa_race_endpoint_update(void) {
|
||||||
if (o->oKoopaRaceEndpointRaceBegun && !o->oKoopaRaceEndpointRaceEnded) {
|
if (o->oKoopaRaceEndpointRaceBegun && !o->oKoopaRaceEndpointRaceEnded) {
|
||||||
struct Object* player = nearest_player_to_object(o);
|
struct Object* player = nearest_player_to_object(o);
|
||||||
int distanceToPlayer = dist_between_objects(o, player);
|
s32 distanceToPlayer = dist_between_objects(o, player);
|
||||||
if (o->oKoopaRaceEndpointKoopaFinished || distanceToPlayer < 400.0f) {
|
if (o->oKoopaRaceEndpointKoopaFinished || distanceToPlayer < 400.0f) {
|
||||||
o->oKoopaRaceEndpointRaceEnded = TRUE;
|
o->oKoopaRaceEndpointRaceEnded = TRUE;
|
||||||
level_control_timer(TIMER_CONTROL_STOP);
|
level_control_timer(TIMER_CONTROL_STOP);
|
||||||
|
|
|
||||||
|
|
@ -16,7 +16,7 @@ static void mad_piano_act_wait(void) {
|
||||||
|
|
||||||
struct MarioState* marioState = nearest_mario_state_to_object(o);
|
struct MarioState* marioState = nearest_mario_state_to_object(o);
|
||||||
struct Object* player = marioState->marioObj;
|
struct Object* player = marioState->marioObj;
|
||||||
int distanceToPlayer = dist_between_objects(o, player);
|
s32 distanceToPlayer = dist_between_objects(o, player);
|
||||||
|
|
||||||
if (distanceToPlayer < 500.0f) {
|
if (distanceToPlayer < 500.0f) {
|
||||||
if (o->oTimer > 20) {
|
if (o->oTimer > 20) {
|
||||||
|
|
@ -39,8 +39,8 @@ static void mad_piano_act_attack(void) {
|
||||||
|
|
||||||
struct MarioState* marioState = nearest_mario_state_to_object(o);
|
struct MarioState* marioState = nearest_mario_state_to_object(o);
|
||||||
struct Object* player = marioState->marioObj;
|
struct Object* player = marioState->marioObj;
|
||||||
int distanceToPlayer = dist_between_objects(o, player);
|
s32 distanceToPlayer = dist_between_objects(o, player);
|
||||||
int angleToPlayer = obj_angle_to_object(o, player);
|
s32 angleToPlayer = obj_angle_to_object(o, player);
|
||||||
|
|
||||||
if (distanceToPlayer < 500.0f) {
|
if (distanceToPlayer < 500.0f) {
|
||||||
o->oTimer = 0;
|
o->oTimer = 0;
|
||||||
|
|
|
||||||
|
|
@ -41,7 +41,7 @@ void bhv_moneybag_init(void) {
|
||||||
|
|
||||||
void moneybag_check_mario_collision(void) {
|
void moneybag_check_mario_collision(void) {
|
||||||
struct Object* player = nearest_player_to_object(o);
|
struct Object* player = nearest_player_to_object(o);
|
||||||
int angleToPlayer = obj_angle_to_object(o, player);
|
s32 angleToPlayer = obj_angle_to_object(o, player);
|
||||||
|
|
||||||
obj_set_hitbox(o, &sMoneybagHitbox);
|
obj_set_hitbox(o, &sMoneybagHitbox);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -59,7 +59,7 @@ static struct Object *link_objects_with_behavior(const BehaviorScript *behavior)
|
||||||
*/
|
*/
|
||||||
static struct Object *monty_mole_select_available_hole(f32 minDistToMario) {
|
static struct Object *monty_mole_select_available_hole(f32 minDistToMario) {
|
||||||
struct Object* player;
|
struct Object* player;
|
||||||
int distanceToPlayer;
|
s32 distanceToPlayer;
|
||||||
|
|
||||||
struct Object *hole = sMontyMoleHoleList;
|
struct Object *hole = sMontyMoleHoleList;
|
||||||
s32 numAvailableHoles = 0;
|
s32 numAvailableHoles = 0;
|
||||||
|
|
@ -218,13 +218,13 @@ static void monty_mole_act_select_hole(void) {
|
||||||
o->oPosZ = o->oMontyMoleCurrentHole->oPosZ;
|
o->oPosZ = o->oMontyMoleCurrentHole->oPosZ;
|
||||||
|
|
||||||
struct Object* holePlayer = nearest_player_to_object(o->oMontyMoleCurrentHole);
|
struct Object* holePlayer = nearest_player_to_object(o->oMontyMoleCurrentHole);
|
||||||
int angleToHolePlayer = obj_angle_to_object(o->oMontyMoleCurrentHole, holePlayer);
|
s32 angleToHolePlayer = obj_angle_to_object(o->oMontyMoleCurrentHole, holePlayer);
|
||||||
|
|
||||||
o->oFaceAnglePitch = 0;
|
o->oFaceAnglePitch = 0;
|
||||||
o->oMoveAngleYaw = angleToHolePlayer;
|
o->oMoveAngleYaw = angleToHolePlayer;
|
||||||
|
|
||||||
struct Object* player = nearest_player_to_object(o);
|
struct Object* player = nearest_player_to_object(o);
|
||||||
int distanceToPlayer = dist_between_objects(o, player);
|
s32 distanceToPlayer = dist_between_objects(o, player);
|
||||||
|
|
||||||
if (distanceToPlayer > 500.0f || minDistToMario > 100.0f || random_sign() < 0) {
|
if (distanceToPlayer > 500.0f || minDistToMario > 100.0f || random_sign() < 0) {
|
||||||
o->oAction = MONTY_MOLE_ACT_RISE_FROM_HOLE;
|
o->oAction = MONTY_MOLE_ACT_RISE_FROM_HOLE;
|
||||||
|
|
@ -267,7 +267,7 @@ static void monty_mole_act_rise_from_hole(void) {
|
||||||
*/
|
*/
|
||||||
static void monty_mole_act_spawn_rock(void) {
|
static void monty_mole_act_spawn_rock(void) {
|
||||||
struct Object* player = nearest_player_to_object(o);
|
struct Object* player = nearest_player_to_object(o);
|
||||||
int angleToPlayer = obj_angle_to_object(o, player);
|
s32 angleToPlayer = obj_angle_to_object(o, player);
|
||||||
|
|
||||||
struct Object *rock;
|
struct Object *rock;
|
||||||
|
|
||||||
|
|
@ -489,7 +489,7 @@ static void monty_mole_rock_act_held(void) {
|
||||||
|
|
||||||
if (o->parentObj == NULL || o->parentObj->prevObj == NULL) {
|
if (o->parentObj == NULL || o->parentObj->prevObj == NULL) {
|
||||||
struct Object* player = nearest_player_to_object(o);
|
struct Object* player = nearest_player_to_object(o);
|
||||||
int distanceToPlayer = dist_between_objects(o, player);
|
s32 distanceToPlayer = dist_between_objects(o, player);
|
||||||
if (distanceToPlayer > 600.0f) {
|
if (distanceToPlayer > 600.0f) {
|
||||||
distanceToPlayer = 600.0f;
|
distanceToPlayer = 600.0f;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -146,7 +146,7 @@ void bhv_blue_coin_sliding_jumping_init(void) {
|
||||||
|
|
||||||
void blue_coin_sliding_away_from_mario(void) {
|
void blue_coin_sliding_away_from_mario(void) {
|
||||||
struct Object* player = nearest_player_to_object(o);
|
struct Object* player = nearest_player_to_object(o);
|
||||||
int angleToPlayer = obj_angle_to_object(o, player);
|
s32 angleToPlayer = obj_angle_to_object(o, player);
|
||||||
|
|
||||||
s16 collisionFlags;
|
s16 collisionFlags;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -108,8 +108,8 @@ static void mr_blizzard_act_spawn_snowball(void) {
|
||||||
|
|
||||||
static void mr_blizzard_act_hide_unhide(void) {
|
static void mr_blizzard_act_hide_unhide(void) {
|
||||||
struct Object* player = nearest_player_to_object(o);
|
struct Object* player = nearest_player_to_object(o);
|
||||||
int distanceToPlayer = dist_between_objects(o, player);
|
s32 distanceToPlayer = dist_between_objects(o, player);
|
||||||
int angleToPlayer = obj_angle_to_object(o, player);
|
s32 angleToPlayer = obj_angle_to_object(o, player);
|
||||||
|
|
||||||
if (distanceToPlayer < 1000.0f) {
|
if (distanceToPlayer < 1000.0f) {
|
||||||
// If Mario is in range, move to rising action, make Mr. Blizzard visible,
|
// If Mario is in range, move to rising action, make Mr. Blizzard visible,
|
||||||
|
|
@ -164,8 +164,8 @@ static void mr_blizzard_act_rise_from_ground(void) {
|
||||||
|
|
||||||
static void mr_blizzard_act_rotate(void) {
|
static void mr_blizzard_act_rotate(void) {
|
||||||
struct Object* player = nearest_player_to_object(o);
|
struct Object* player = nearest_player_to_object(o);
|
||||||
int distanceToPlayer = dist_between_objects(o, player);
|
s32 distanceToPlayer = dist_between_objects(o, player);
|
||||||
int angleToPlayer = obj_angle_to_object(o, player);
|
s32 angleToPlayer = obj_angle_to_object(o, player);
|
||||||
|
|
||||||
s16 angleDiff;
|
s16 angleDiff;
|
||||||
f32 prevDizziness;
|
f32 prevDizziness;
|
||||||
|
|
@ -233,7 +233,7 @@ static void mr_blizzard_act_rotate(void) {
|
||||||
|
|
||||||
static void mr_blizzard_act_death(void) {
|
static void mr_blizzard_act_death(void) {
|
||||||
struct Object* player = nearest_player_to_object(o);
|
struct Object* player = nearest_player_to_object(o);
|
||||||
int distanceToPlayer = dist_between_objects(o, player);
|
s32 distanceToPlayer = dist_between_objects(o, player);
|
||||||
|
|
||||||
cur_obj_become_intangible();
|
cur_obj_become_intangible();
|
||||||
struct Object *cap;
|
struct Object *cap;
|
||||||
|
|
@ -341,7 +341,7 @@ static void mr_blizzard_act_burrow(void) {
|
||||||
|
|
||||||
static void mr_blizzard_act_jump(void) {
|
static void mr_blizzard_act_jump(void) {
|
||||||
struct Object* player = nearest_player_to_object(o);
|
struct Object* player = nearest_player_to_object(o);
|
||||||
int distanceToPlayer = dist_between_objects(o, player);
|
s32 distanceToPlayer = dist_between_objects(o, player);
|
||||||
|
|
||||||
if (o->oMrBlizzardTimer != 0) {
|
if (o->oMrBlizzardTimer != 0) {
|
||||||
cur_obj_rotate_yaw_toward(o->oMrBlizzardTargetMoveYaw, 3400);
|
cur_obj_rotate_yaw_toward(o->oMrBlizzardTargetMoveYaw, 3400);
|
||||||
|
|
@ -449,7 +449,7 @@ static void mr_blizzard_snowball_act_0(void) {
|
||||||
|
|
||||||
static void mr_blizzard_snowball_act_1(void) {
|
static void mr_blizzard_snowball_act_1(void) {
|
||||||
struct Object* player = nearest_player_to_object(o);
|
struct Object* player = nearest_player_to_object(o);
|
||||||
int distanceToPlayer = dist_between_objects(o, player);
|
s32 distanceToPlayer = dist_between_objects(o, player);
|
||||||
|
|
||||||
f32 marioDist;
|
f32 marioDist;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -132,7 +132,7 @@ void mr_i_act_3(void) {
|
||||||
void mr_i_act_2(void) {
|
void mr_i_act_2(void) {
|
||||||
struct MarioState* marioState = nearest_mario_state_to_object(o);
|
struct MarioState* marioState = nearest_mario_state_to_object(o);
|
||||||
struct Object* player = marioState->marioObj;
|
struct Object* player = marioState->marioObj;
|
||||||
int distanceToPlayer = dist_between_objects(o, player);
|
s32 distanceToPlayer = dist_between_objects(o, player);
|
||||||
s16 sp1E;
|
s16 sp1E;
|
||||||
s16 sp1C;
|
s16 sp1C;
|
||||||
sp1E = o->oMoveAngleYaw;
|
sp1E = o->oMoveAngleYaw;
|
||||||
|
|
@ -195,7 +195,7 @@ void mr_i_act_2(void) {
|
||||||
void mr_i_act_1(void) {
|
void mr_i_act_1(void) {
|
||||||
struct MarioState* marioState = nearest_mario_state_to_object(o);
|
struct MarioState* marioState = nearest_mario_state_to_object(o);
|
||||||
struct Object* player = marioState->marioObj;
|
struct Object* player = marioState->marioObj;
|
||||||
int distanceToPlayer = dist_between_objects(o, player);
|
s32 distanceToPlayer = dist_between_objects(o, player);
|
||||||
s16 sp1E;
|
s16 sp1E;
|
||||||
s16 sp1C;
|
s16 sp1C;
|
||||||
s16 sp1A;
|
s16 sp1A;
|
||||||
|
|
@ -238,7 +238,7 @@ void mr_i_act_1(void) {
|
||||||
|
|
||||||
void mr_i_act_0(void) {
|
void mr_i_act_0(void) {
|
||||||
struct Object* player = nearest_player_to_object(o);
|
struct Object* player = nearest_player_to_object(o);
|
||||||
int distanceToPlayer = dist_between_objects(o, player);
|
s32 distanceToPlayer = dist_between_objects(o, player);
|
||||||
|
|
||||||
#ifndef VERSION_JP
|
#ifndef VERSION_JP
|
||||||
obj_set_angle(o, 0, 0, 0);
|
obj_set_angle(o, 0, 0, 0);
|
||||||
|
|
@ -277,7 +277,7 @@ void bhv_mr_i_loop(void) {
|
||||||
}
|
}
|
||||||
|
|
||||||
struct Object* player = nearest_player_to_object(o);
|
struct Object* player = nearest_player_to_object(o);
|
||||||
int distanceToPlayer = dist_between_objects(o, player);
|
s32 distanceToPlayer = dist_between_objects(o, player);
|
||||||
|
|
||||||
obj_set_hitbox(o, &sMrIHitbox);
|
obj_set_hitbox(o, &sMrIHitbox);
|
||||||
cur_obj_call_action_function(sMrIActions);
|
cur_obj_call_action_function(sMrIActions);
|
||||||
|
|
|
||||||
|
|
@ -60,7 +60,7 @@ void pole_1up_move_towards_mario(void) {
|
||||||
|
|
||||||
void one_up_move_away_from_mario(s16 sp1A) {
|
void one_up_move_away_from_mario(s16 sp1A) {
|
||||||
struct Object* player = nearest_player_to_object(o);
|
struct Object* player = nearest_player_to_object(o);
|
||||||
int angleToPlayer = obj_angle_to_object(o, player);
|
s32 angleToPlayer = obj_angle_to_object(o, player);
|
||||||
|
|
||||||
o->oForwardVel = 8.0f;
|
o->oForwardVel = 8.0f;
|
||||||
o->oMoveAngleYaw = angleToPlayer + 0x8000;
|
o->oMoveAngleYaw = angleToPlayer + 0x8000;
|
||||||
|
|
@ -378,7 +378,7 @@ void bhv_1up_hidden_in_pole_spawner_loop(void) {
|
||||||
}
|
}
|
||||||
|
|
||||||
struct Object* player = nearest_player_to_object(o);
|
struct Object* player = nearest_player_to_object(o);
|
||||||
int distanceToPlayer = dist_between_objects(o, player);
|
s32 distanceToPlayer = dist_between_objects(o, player);
|
||||||
if (player == gMarioStates[0].marioObj && distanceToPlayer < 700) {
|
if (player == gMarioStates[0].marioObj && distanceToPlayer < 700) {
|
||||||
struct Object* spawn_objects[3];
|
struct Object* spawn_objects[3];
|
||||||
u32 models[3];
|
u32 models[3];
|
||||||
|
|
@ -391,7 +391,7 @@ void bhv_1up_hidden_in_pole_spawner_loop(void) {
|
||||||
models[1 + sp2F] = MODEL_NONE;
|
models[1 + sp2F] = MODEL_NONE;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int i = 0; i < 3; i++) {
|
for (s32 i = 0; i < 3; i++) {
|
||||||
if (spawn_objects[i] == NULL) { continue; }
|
if (spawn_objects[i] == NULL) { continue; }
|
||||||
spawn_objects[i]->parentObj = spawn_objects[i];
|
spawn_objects[i]->parentObj = spawn_objects[i];
|
||||||
network_set_sync_id(spawn_objects[i]);
|
network_set_sync_id(spawn_objects[i]);
|
||||||
|
|
|
||||||
|
|
@ -40,7 +40,7 @@ void bhv_piranha_plant_bubble_loop(void) {
|
||||||
cur_obj_set_pos_relative(parent, 0, 72.0f, 180.0f);
|
cur_obj_set_pos_relative(parent, 0, 72.0f, 180.0f);
|
||||||
|
|
||||||
struct Object* parentPlayer = nearest_player_to_object(parent);
|
struct Object* parentPlayer = nearest_player_to_object(parent);
|
||||||
int distanceToParentPlayer = dist_between_objects(parent, parentPlayer);
|
s32 distanceToParentPlayer = dist_between_objects(parent, parentPlayer);
|
||||||
|
|
||||||
switch (o->oAction) {
|
switch (o->oAction) {
|
||||||
case PIRANHA_PLANT_BUBBLE_ACT_IDLE:
|
case PIRANHA_PLANT_BUBBLE_ACT_IDLE:
|
||||||
|
|
|
||||||
|
|
@ -23,7 +23,7 @@ void piranha_plant_act_idle(void) {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
struct Object* player = nearest_player_to_object(o);
|
struct Object* player = nearest_player_to_object(o);
|
||||||
int distanceToPlayer = dist_between_objects(o, player);
|
s32 distanceToPlayer = dist_between_objects(o, player);
|
||||||
if (distanceToPlayer < 1200.0f) {
|
if (distanceToPlayer < 1200.0f) {
|
||||||
o->oAction = PIRANHA_PLANT_ACT_SLEEPING;
|
o->oAction = PIRANHA_PLANT_ACT_SLEEPING;
|
||||||
if (network_owns_object(o)) { network_send_object(o); }
|
if (network_owns_object(o)) { network_send_object(o); }
|
||||||
|
|
@ -91,7 +91,7 @@ void piranha_plant_act_sleeping(void) {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
struct Object* player = nearest_player_to_object(o);
|
struct Object* player = nearest_player_to_object(o);
|
||||||
int distanceToPlayer = dist_between_objects(o, player);
|
s32 distanceToPlayer = dist_between_objects(o, player);
|
||||||
if (distanceToPlayer < 400.0f) {
|
if (distanceToPlayer < 400.0f) {
|
||||||
if (mario_moving_fast_enough_to_make_piranha_plant_bite()) {
|
if (mario_moving_fast_enough_to_make_piranha_plant_bite()) {
|
||||||
o->oAction = PIRANHA_PLANT_ACT_WOKEN_UP;
|
o->oAction = PIRANHA_PLANT_ACT_WOKEN_UP;
|
||||||
|
|
@ -209,7 +209,7 @@ void piranha_plant_act_shrink_and_die(void) {
|
||||||
*/
|
*/
|
||||||
void piranha_plant_act_wait_to_respawn(void) {
|
void piranha_plant_act_wait_to_respawn(void) {
|
||||||
struct Object* player = nearest_player_to_object(o);
|
struct Object* player = nearest_player_to_object(o);
|
||||||
int distanceToPlayer = dist_between_objects(o, player);
|
s32 distanceToPlayer = dist_between_objects(o, player);
|
||||||
if (distanceToPlayer > 1200.0f) {
|
if (distanceToPlayer > 1200.0f) {
|
||||||
o->oAction = PIRANHA_PLANT_ACT_RESPAWN;
|
o->oAction = PIRANHA_PLANT_ACT_RESPAWN;
|
||||||
if (network_owns_object(o)) { network_send_object(o); }
|
if (network_owns_object(o)) { network_send_object(o); }
|
||||||
|
|
@ -257,8 +257,8 @@ static s8 sPiranhaPlantBiteSoundFrames[] = { 12, 28, 50, 64, -1 };
|
||||||
void piranha_plant_act_biting(void) {
|
void piranha_plant_act_biting(void) {
|
||||||
struct MarioState* marioState = nearest_mario_state_to_object(o);
|
struct MarioState* marioState = nearest_mario_state_to_object(o);
|
||||||
struct Object* player = marioState->marioObj;
|
struct Object* player = marioState->marioObj;
|
||||||
int distanceToPlayer = dist_between_objects(o, player);
|
s32 distanceToPlayer = dist_between_objects(o, player);
|
||||||
int angleToPlayer = obj_angle_to_object(o, player);
|
s32 angleToPlayer = obj_angle_to_object(o, player);
|
||||||
|
|
||||||
s32 frame = o->header.gfx.animInfo.animFrame;
|
s32 frame = o->header.gfx.animInfo.animFrame;
|
||||||
|
|
||||||
|
|
@ -313,7 +313,7 @@ s32 mario_moving_fast_enough_to_make_piranha_plant_bite(void) {
|
||||||
*/
|
*/
|
||||||
void piranha_plant_act_stopped_biting(void) {
|
void piranha_plant_act_stopped_biting(void) {
|
||||||
struct Object* player = nearest_player_to_object(o);
|
struct Object* player = nearest_player_to_object(o);
|
||||||
int distanceToPlayer = dist_between_objects(o, player);
|
s32 distanceToPlayer = dist_between_objects(o, player);
|
||||||
cur_obj_become_intangible();
|
cur_obj_become_intangible();
|
||||||
cur_obj_init_animation_with_sound(6);
|
cur_obj_init_animation_with_sound(6);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -280,7 +280,7 @@ static void platform_on_track_rock_ski_lift(void) {
|
||||||
o->oFaceAngleRoll += (s32) o->oPlatformOnTrackSkiLiftRollVel;
|
o->oFaceAngleRoll += (s32) o->oPlatformOnTrackSkiLiftRollVel;
|
||||||
|
|
||||||
struct Object* player = NULL;
|
struct Object* player = NULL;
|
||||||
for (int i = 0; i < MAX_PLAYERS; i++) {
|
for (s32 i = 0; i < MAX_PLAYERS; i++) {
|
||||||
if (!is_player_active(&gMarioStates[i])) { continue; }
|
if (!is_player_active(&gMarioStates[i])) { continue; }
|
||||||
if (gMarioStates[i].marioObj->platform != o) { continue; }
|
if (gMarioStates[i].marioObj->platform != o) { continue; }
|
||||||
player = gMarioStates[i].marioObj;
|
player = gMarioStates[i].marioObj;
|
||||||
|
|
@ -289,8 +289,8 @@ static void platform_on_track_rock_ski_lift(void) {
|
||||||
|
|
||||||
// Tilt away from the moving direction and toward mario
|
// Tilt away from the moving direction and toward mario
|
||||||
if (player != NULL) {
|
if (player != NULL) {
|
||||||
int distanceToPlayer = dist_between_objects(o, player);
|
s32 distanceToPlayer = dist_between_objects(o, player);
|
||||||
int angleToPlayer = obj_angle_to_object(o, player);
|
s32 angleToPlayer = obj_angle_to_object(o, player);
|
||||||
targetRoll = o->oForwardVel * sins(o->oMoveAngleYaw) * -50.0f
|
targetRoll = o->oForwardVel * sins(o->oMoveAngleYaw) * -50.0f
|
||||||
+ (s32)(distanceToPlayer * sins(angleToPlayer - o->oFaceAngleYaw) * -4.0f);
|
+ (s32)(distanceToPlayer * sins(angleToPlayer - o->oFaceAngleYaw) * -4.0f);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -213,8 +213,8 @@ static void pokey_act_uninitialized(void) {
|
||||||
*/
|
*/
|
||||||
static void pokey_act_wander(void) {
|
static void pokey_act_wander(void) {
|
||||||
struct Object* player = nearest_player_to_object(o);
|
struct Object* player = nearest_player_to_object(o);
|
||||||
int distanceToPlayer = dist_between_objects(o, player);
|
s32 distanceToPlayer = dist_between_objects(o, player);
|
||||||
int angleToPlayer = obj_angle_to_object(o, player);
|
s32 angleToPlayer = obj_angle_to_object(o, player);
|
||||||
|
|
||||||
s32 targetAngleOffset;
|
s32 targetAngleOffset;
|
||||||
struct Object *bodyPart;
|
struct Object *bodyPart;
|
||||||
|
|
|
||||||
|
|
@ -14,7 +14,7 @@ void bhv_purple_switch_loop(void) {
|
||||||
}
|
}
|
||||||
|
|
||||||
u8 anyPlayerOnPlatform = FALSE;
|
u8 anyPlayerOnPlatform = FALSE;
|
||||||
for (int i = 0; i < MAX_PLAYERS; i++) {
|
for (s32 i = 0; i < MAX_PLAYERS; i++) {
|
||||||
if (!is_player_active(&gMarioStates[i])) { continue; }
|
if (!is_player_active(&gMarioStates[i])) { continue; }
|
||||||
if (gMarioStates[i].marioObj->platform == o) {
|
if (gMarioStates[i].marioObj->platform == o) {
|
||||||
anyPlayerOnPlatform = TRUE;
|
anyPlayerOnPlatform = TRUE;
|
||||||
|
|
|
||||||
|
|
@ -183,7 +183,7 @@ static void racing_penguin_act_race(void) {
|
||||||
// fact that one player can fall off while the other player completes the
|
// fact that one player can fall off while the other player completes the
|
||||||
// race.
|
// race.
|
||||||
/*u8 isInAir = FALSE;
|
/*u8 isInAir = FALSE;
|
||||||
for (int i = 0; i < MAX_PLAYERS; i++) {
|
for (s32 i = 0; i < MAX_PLAYERS; i++) {
|
||||||
if (!is_player_active(&gMarioStates[i])) { continue; }
|
if (!is_player_active(&gMarioStates[i])) { continue; }
|
||||||
isInAir = isInAir || mario_is_in_air_action(&gMarioStates[i]);
|
isInAir = isInAir || mario_is_in_air_action(&gMarioStates[i]);
|
||||||
}
|
}
|
||||||
|
|
@ -290,7 +290,7 @@ void bhv_racing_penguin_update(void) {
|
||||||
|
|
||||||
void bhv_penguin_race_finish_line_update(void) {
|
void bhv_penguin_race_finish_line_update(void) {
|
||||||
struct Object* player = nearest_player_to_object(o);
|
struct Object* player = nearest_player_to_object(o);
|
||||||
int distanceToPlayer = dist_between_objects(o, player);
|
s32 distanceToPlayer = dist_between_objects(o, player);
|
||||||
|
|
||||||
if (o->parentObj->oRacingPenguinReachedBottom
|
if (o->parentObj->oRacingPenguinReachedBottom
|
||||||
|| (distanceToPlayer < 1000.0f && player->oPosZ - o->oPosZ < 0.0f)) {
|
|| (distanceToPlayer < 1000.0f && player->oPosZ - o->oPosZ < 0.0f)) {
|
||||||
|
|
@ -303,7 +303,7 @@ void bhv_penguin_race_finish_line_update(void) {
|
||||||
|
|
||||||
void bhv_penguin_race_shortcut_check_update(void) {
|
void bhv_penguin_race_shortcut_check_update(void) {
|
||||||
struct Object* player = nearest_player_to_object(o);
|
struct Object* player = nearest_player_to_object(o);
|
||||||
int distanceToPlayer = dist_between_objects(o, player);
|
s32 distanceToPlayer = dist_between_objects(o, player);
|
||||||
if (distanceToPlayer < 500.0f && !o->parentObj->oRacingPenguinMarioCheated) {
|
if (distanceToPlayer < 500.0f && !o->parentObj->oRacingPenguinMarioCheated) {
|
||||||
o->parentObj->oRacingPenguinMarioCheated = TRUE;
|
o->parentObj->oRacingPenguinMarioCheated = TRUE;
|
||||||
network_send_object(o->parentObj);
|
network_send_object(o->parentObj);
|
||||||
|
|
|
||||||
|
|
@ -15,7 +15,7 @@ void bhv_recovery_heart_loop(void) {
|
||||||
u8 collided = FALSE;
|
u8 collided = FALSE;
|
||||||
obj_set_hitbox(o, &sRecoveryHeartHitbox);
|
obj_set_hitbox(o, &sRecoveryHeartHitbox);
|
||||||
|
|
||||||
for (int i = 0; i < MAX_PLAYERS; i++) {
|
for (s32 i = 0; i < MAX_PLAYERS; i++) {
|
||||||
if (!is_player_active(&gMarioStates[i])) { continue; }
|
if (!is_player_active(&gMarioStates[i])) { continue; }
|
||||||
if (obj_check_if_collided_with_object(o, gMarioStates[i].marioObj)) { collided = TRUE; }
|
if (obj_check_if_collided_with_object(o, gMarioStates[i].marioObj)) { collided = TRUE; }
|
||||||
}
|
}
|
||||||
|
|
@ -40,7 +40,7 @@ void bhv_recovery_heart_loop(void) {
|
||||||
if ((o->oSpinningHeartTotalSpin += o->oAngleVelYaw) >= 0x10000) {
|
if ((o->oSpinningHeartTotalSpin += o->oAngleVelYaw) >= 0x10000) {
|
||||||
|
|
||||||
struct MarioState* nearestState = nearest_mario_state_to_object(o);
|
struct MarioState* nearestState = nearest_mario_state_to_object(o);
|
||||||
for (int i = 0; i < MAX_PLAYERS; i++) {
|
for (s32 i = 0; i < MAX_PLAYERS; i++) {
|
||||||
if (!is_player_active(&gMarioStates[i])) { continue; }
|
if (!is_player_active(&gMarioStates[i])) { continue; }
|
||||||
if (&gMarioStates[i] == nearestState || dist_between_objects(o, gMarioStates[i].marioObj) < 1000) {
|
if (&gMarioStates[i] == nearestState || dist_between_objects(o, gMarioStates[i].marioObj) < 1000) {
|
||||||
gMarioStates[i].healCounter += 4;
|
gMarioStates[i].healCounter += 4;
|
||||||
|
|
|
||||||
|
|
@ -42,7 +42,7 @@ void rolling_log_roll_log(void) {
|
||||||
f32 z = 0;
|
f32 z = 0;
|
||||||
|
|
||||||
u8 playersTouched = 0;
|
u8 playersTouched = 0;
|
||||||
for (int i = 0; i < MAX_PLAYERS; i++) {
|
for (s32 i = 0; i < MAX_PLAYERS; i++) {
|
||||||
if (!is_player_active(&gMarioStates[i])) { continue; }
|
if (!is_player_active(&gMarioStates[i])) { continue; }
|
||||||
struct Object* player = gMarioStates[i].marioObj;
|
struct Object* player = gMarioStates[i].marioObj;
|
||||||
if (player->platform != o) { continue; }
|
if (player->platform != o) { continue; }
|
||||||
|
|
|
||||||
|
|
@ -61,8 +61,8 @@ static void skeeter_act_idle(void) {
|
||||||
}
|
}
|
||||||
|
|
||||||
static void skeeter_act_lunge(void) {
|
static void skeeter_act_lunge(void) {
|
||||||
int distanceToPlayer = o->oDistanceToMario;
|
s32 distanceToPlayer = o->oDistanceToMario;
|
||||||
int angleToPlayer = o->oAngleToMario;
|
s32 angleToPlayer = o->oAngleToMario;
|
||||||
|
|
||||||
if (!(o->oMoveFlags & OBJ_MOVE_AT_WATER_SURFACE)) {
|
if (!(o->oMoveFlags & OBJ_MOVE_AT_WATER_SURFACE)) {
|
||||||
o->oAction = SKEETER_ACT_IDLE;
|
o->oAction = SKEETER_ACT_IDLE;
|
||||||
|
|
@ -93,8 +93,8 @@ static void skeeter_act_lunge(void) {
|
||||||
}
|
}
|
||||||
|
|
||||||
static void skeeter_act_walk(void) {
|
static void skeeter_act_walk(void) {
|
||||||
int distanceToPlayer = o->oDistanceToMario;
|
s32 distanceToPlayer = o->oDistanceToMario;
|
||||||
int angleToPlayer = o->oAngleToMario;
|
s32 angleToPlayer = o->oAngleToMario;
|
||||||
|
|
||||||
f32 sp24;
|
f32 sp24;
|
||||||
|
|
||||||
|
|
@ -156,8 +156,8 @@ void bhv_skeeter_update(void) {
|
||||||
o->oDeathSound = SOUND_OBJ_SNUFIT_SKEETER_DEATH;
|
o->oDeathSound = SOUND_OBJ_SNUFIT_SKEETER_DEATH;
|
||||||
|
|
||||||
struct Object* player = nearest_player_to_object(o);
|
struct Object* player = nearest_player_to_object(o);
|
||||||
int distanceToPlayer = dist_between_objects(o, player);
|
s32 distanceToPlayer = dist_between_objects(o, player);
|
||||||
int angleToPlayer = obj_angle_to_object(o, player);
|
s32 angleToPlayer = obj_angle_to_object(o, player);
|
||||||
treat_far_home_as_mario(1000.0f, &distanceToPlayer, &angleToPlayer);
|
treat_far_home_as_mario(1000.0f, &distanceToPlayer, &angleToPlayer);
|
||||||
o->oDistanceToMario = distanceToPlayer;
|
o->oDistanceToMario = distanceToPlayer;
|
||||||
o->oAngleToMario = angleToPlayer;
|
o->oAngleToMario = angleToPlayer;
|
||||||
|
|
|
||||||
|
|
@ -56,7 +56,7 @@ void adjust_rolling_face_pitch(f32 f12) {
|
||||||
|
|
||||||
void snowmans_bottom_act_1(void) {
|
void snowmans_bottom_act_1(void) {
|
||||||
struct Object* player = nearest_player_to_object(o);
|
struct Object* player = nearest_player_to_object(o);
|
||||||
int angleToPlayer = obj_angle_to_object(o, player);
|
s32 angleToPlayer = obj_angle_to_object(o, player);
|
||||||
|
|
||||||
UNUSED s16 sp26;
|
UNUSED s16 sp26;
|
||||||
s32 sp20 = 0;
|
s32 sp20 = 0;
|
||||||
|
|
|
||||||
|
|
@ -72,7 +72,7 @@ Gfx *geo_snufit_scale_body(s32 callContext, struct GraphNode *node, UNUSED Mat4
|
||||||
*/
|
*/
|
||||||
void snufit_act_idle(void) {
|
void snufit_act_idle(void) {
|
||||||
struct Object* player = nearest_player_to_object(o);
|
struct Object* player = nearest_player_to_object(o);
|
||||||
int distanceToPlayer = dist_between_objects(o, player);
|
s32 distanceToPlayer = dist_between_objects(o, player);
|
||||||
s32 marioDist;
|
s32 marioDist;
|
||||||
|
|
||||||
// This line would could cause a crash in certain PU situations,
|
// This line would could cause a crash in certain PU situations,
|
||||||
|
|
@ -148,8 +148,8 @@ void bhv_snufit_loop(void) {
|
||||||
|
|
||||||
struct MarioState* marioState = nearest_mario_state_to_object(o);
|
struct MarioState* marioState = nearest_mario_state_to_object(o);
|
||||||
struct Object* player = marioState->marioObj;
|
struct Object* player = marioState->marioObj;
|
||||||
int distanceToPlayer = dist_between_objects(o, player);
|
s32 distanceToPlayer = dist_between_objects(o, player);
|
||||||
int angleToPlayer = obj_angle_to_object(o, player);
|
s32 angleToPlayer = obj_angle_to_object(o, player);
|
||||||
|
|
||||||
// Only update if Mario is in the current room.
|
// Only update if Mario is in the current room.
|
||||||
if (!(o->activeFlags & ACTIVE_FLAG_IN_DIFFERENT_ROOM)) {
|
if (!(o->activeFlags & ACTIVE_FLAG_IN_DIFFERENT_ROOM)) {
|
||||||
|
|
|
||||||
|
|
@ -144,7 +144,7 @@ void bhv_spawned_star_loop(void) {
|
||||||
|
|
||||||
void bhv_spawn_star_no_level_exit(struct Object* object, u32 params, u8 networkSendEvent) {
|
void bhv_spawn_star_no_level_exit(struct Object* object, u32 params, u8 networkSendEvent) {
|
||||||
// de-duplication checking
|
// de-duplication checking
|
||||||
for (int i = 0; i < gSpawnedStarNLECount; i++) {
|
for (s32 i = 0; i < gSpawnedStarNLECount; i++) {
|
||||||
if (gSpawnedStarNLE[i] == params) { return; }
|
if (gSpawnedStarNLE[i] == params) { return; }
|
||||||
}
|
}
|
||||||
if (gSpawnedStarNLECount < 8) {
|
if (gSpawnedStarNLECount < 8) {
|
||||||
|
|
|
||||||
|
|
@ -129,7 +129,7 @@ struct Object *spawn_star(struct Object *obj, f32 x, f32 y, f32 z) {
|
||||||
}
|
}
|
||||||
|
|
||||||
static u8 spawn_star_deduplication(u32* array, u8* count, u32 behParams) {
|
static u8 spawn_star_deduplication(u32* array, u8* count, u32 behParams) {
|
||||||
for (int i = 0; i < *count; i++) {
|
for (s32 i = 0; i < *count; i++) {
|
||||||
if (array[i] == behParams) { return TRUE; }
|
if (array[i] == behParams) { return TRUE; }
|
||||||
}
|
}
|
||||||
if (*count < 8) {
|
if (*count < 8) {
|
||||||
|
|
|
||||||
|
|
@ -19,8 +19,8 @@ void bhv_spindrift_loop(void) {
|
||||||
}
|
}
|
||||||
|
|
||||||
struct Object* player = nearest_player_to_object(o);
|
struct Object* player = nearest_player_to_object(o);
|
||||||
int distanceToPlayer = dist_between_objects(o, player);
|
s32 distanceToPlayer = dist_between_objects(o, player);
|
||||||
int angleToPlayer = obj_angle_to_object(o, player);
|
s32 angleToPlayer = obj_angle_to_object(o, player);
|
||||||
|
|
||||||
o->activeFlags |= ACTIVE_FLAG_UNK10;
|
o->activeFlags |= ACTIVE_FLAG_UNK10;
|
||||||
if (cur_obj_set_hitbox_and_die_if_attacked(&sSpindriftHitbox, SOUND_OBJ_DYING_ENEMY1, 0))
|
if (cur_obj_set_hitbox_and_die_if_attacked(&sSpindriftHitbox, SOUND_OBJ_DYING_ENEMY1, 0))
|
||||||
|
|
|
||||||
|
|
@ -74,7 +74,7 @@ static void bhv_spiny_on_sent_pre(void) {
|
||||||
*/
|
*/
|
||||||
static s32 spiny_check_active(void) {
|
static s32 spiny_check_active(void) {
|
||||||
struct Object* player = nearest_player_to_object(o);
|
struct Object* player = nearest_player_to_object(o);
|
||||||
int distanceToPlayer = dist_between_objects(o, player);
|
s32 distanceToPlayer = dist_between_objects(o, player);
|
||||||
|
|
||||||
if (o->parentObj == NULL || o->parentObj->behavior != bhvEnemyLakitu) {
|
if (o->parentObj == NULL || o->parentObj->behavior != bhvEnemyLakitu) {
|
||||||
obj_mark_for_deletion(o);
|
obj_mark_for_deletion(o);
|
||||||
|
|
|
||||||
|
|
@ -14,7 +14,7 @@ void bhv_squarish_path_parent_init(void) {
|
||||||
so->maxUpdateRate = 5.0f;
|
so->maxUpdateRate = 5.0f;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int i = 0; i < 2; i++) {
|
for (s32 i = 0; i < 2; i++) {
|
||||||
s16 action = (i == 0) ? 1 : 3;
|
s16 action = (i == 0) ? 1 : 3;
|
||||||
s16 offset = (i == 0) ? (-radius) : (radius);
|
s16 offset = (i == 0) ? (-radius) : (radius);
|
||||||
struct Object* square = spawn_object(o, MODEL_BITDW_SQUARE_PLATFORM, bhvSquarishPathMoving);
|
struct Object* square = spawn_object(o, MODEL_BITDW_SQUARE_PLATFORM, bhvSquarishPathMoving);
|
||||||
|
|
|
||||||
|
|
@ -25,8 +25,8 @@ static struct ObjectHitbox sSwoopHitbox = {
|
||||||
*/
|
*/
|
||||||
static void swoop_act_idle(void) {
|
static void swoop_act_idle(void) {
|
||||||
struct Object* player = nearest_player_to_object(o);
|
struct Object* player = nearest_player_to_object(o);
|
||||||
int distanceToPlayer = dist_between_objects(o, player);
|
s32 distanceToPlayer = dist_between_objects(o, player);
|
||||||
int angleToPlayer = obj_angle_to_object(o, player);
|
s32 angleToPlayer = obj_angle_to_object(o, player);
|
||||||
|
|
||||||
cur_obj_init_animation_with_sound(1);
|
cur_obj_init_animation_with_sound(1);
|
||||||
|
|
||||||
|
|
@ -47,7 +47,7 @@ static void swoop_act_idle(void) {
|
||||||
*/
|
*/
|
||||||
static void swoop_act_move(void) {
|
static void swoop_act_move(void) {
|
||||||
struct Object* player = nearest_player_to_object(o);
|
struct Object* player = nearest_player_to_object(o);
|
||||||
int angleToPlayer = obj_angle_to_object(o, player);
|
s32 angleToPlayer = obj_angle_to_object(o, player);
|
||||||
|
|
||||||
cur_obj_init_animation_with_accel_and_sound(0, 2.0f);
|
cur_obj_init_animation_with_accel_and_sound(0, 2.0f);
|
||||||
if (cur_obj_check_if_near_animation_end()) {
|
if (cur_obj_check_if_near_animation_end()) {
|
||||||
|
|
|
||||||
|
|
@ -26,7 +26,7 @@ void bhv_thi_tiny_island_top_loop(void) {
|
||||||
|
|
||||||
struct MarioState* marioState = nearest_mario_state_to_object(o);
|
struct MarioState* marioState = nearest_mario_state_to_object(o);
|
||||||
struct Object* player = marioState->marioObj;
|
struct Object* player = marioState->marioObj;
|
||||||
int distanceToPlayer = dist_between_objects(o, player);
|
s32 distanceToPlayer = dist_between_objects(o, player);
|
||||||
|
|
||||||
if (!(gTHIWaterDrained & 1)) {
|
if (!(gTHIWaterDrained & 1)) {
|
||||||
if (o->oAction == 0) {
|
if (o->oAction == 0) {
|
||||||
|
|
|
||||||
|
|
@ -21,7 +21,7 @@ void grindel_thwomp_act_2(void) {
|
||||||
|
|
||||||
void grindel_thwomp_act_3(void) {
|
void grindel_thwomp_act_3(void) {
|
||||||
if (o->oTimer == 0) {
|
if (o->oTimer == 0) {
|
||||||
int distanceToPlayer = dist_between_objects(o, gMarioStates[0].marioObj);
|
s32 distanceToPlayer = dist_between_objects(o, gMarioStates[0].marioObj);
|
||||||
if (distanceToPlayer < 1500.0f) {
|
if (distanceToPlayer < 1500.0f) {
|
||||||
cur_obj_shake_screen(SHAKE_POS_SMALL);
|
cur_obj_shake_screen(SHAKE_POS_SMALL);
|
||||||
cur_obj_play_sound_2(SOUND_OBJ_THWOMP);
|
cur_obj_play_sound_2(SOUND_OBJ_THWOMP);
|
||||||
|
|
|
||||||
|
|
@ -85,7 +85,7 @@ void bhv_tilting_inverted_pyramid_loop(void) {
|
||||||
f32 y = 0;
|
f32 y = 0;
|
||||||
f32 z = 0;
|
f32 z = 0;
|
||||||
u8 playersTouched = 0;
|
u8 playersTouched = 0;
|
||||||
for (int i = 0; i < MAX_PLAYERS; i++) {
|
for (s32 i = 0; i < MAX_PLAYERS; i++) {
|
||||||
if (!is_player_active(&gMarioStates[i])) { continue; }
|
if (!is_player_active(&gMarioStates[i])) { continue; }
|
||||||
if (gMarioStates[i].marioObj->platform != o) { continue; }
|
if (gMarioStates[i].marioObj->platform != o) { continue; }
|
||||||
x += gMarioStates[i].marioObj->oPosX;
|
x += gMarioStates[i].marioObj->oPosX;
|
||||||
|
|
|
||||||
|
|
@ -134,7 +134,7 @@ void bhv_tower_platform_group_init(void) {
|
||||||
void bhv_tower_platform_group_loop(void) {
|
void bhv_tower_platform_group_loop(void) {
|
||||||
|
|
||||||
u8 anyPlayerInRange = FALSE;
|
u8 anyPlayerInRange = FALSE;
|
||||||
for (int i = 0; i < MAX_PLAYERS; i++) {
|
for (s32 i = 0; i < MAX_PLAYERS; i++) {
|
||||||
if (!is_player_active(&gMarioStates[i])) { continue; }
|
if (!is_player_active(&gMarioStates[i])) { continue; }
|
||||||
if (gMarioStates[i].marioObj->oPosY > o->oHomeY - 1000.0f) { anyPlayerInRange = TRUE; }
|
if (gMarioStates[i].marioObj->oPosY > o->oHomeY - 1000.0f) { anyPlayerInRange = TRUE; }
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -123,7 +123,7 @@ void tumbling_bridge_act_1(void) {
|
||||||
|
|
||||||
void tumbling_bridge_act_2(void) {
|
void tumbling_bridge_act_2(void) {
|
||||||
struct Object* player = nearest_player_to_object(o);
|
struct Object* player = nearest_player_to_object(o);
|
||||||
int distanceToPlayer = dist_between_objects(o, player);
|
s32 distanceToPlayer = dist_between_objects(o, player);
|
||||||
|
|
||||||
cur_obj_hide();
|
cur_obj_hide();
|
||||||
if (cur_obj_has_behavior(bhvLllTumblingBridge))
|
if (cur_obj_has_behavior(bhvLllTumblingBridge))
|
||||||
|
|
@ -141,7 +141,7 @@ void tumbling_bridge_act_3(void) {
|
||||||
|
|
||||||
void tumbling_bridge_act_0(void) {
|
void tumbling_bridge_act_0(void) {
|
||||||
struct Object* player = nearest_player_to_object(o);
|
struct Object* player = nearest_player_to_object(o);
|
||||||
int distanceToPlayer = dist_between_objects(o, player);
|
s32 distanceToPlayer = dist_between_objects(o, player);
|
||||||
|
|
||||||
if (cur_obj_has_behavior(bhvLllTumblingBridge) || distanceToPlayer < 1000.0f)
|
if (cur_obj_has_behavior(bhvLllTumblingBridge) || distanceToPlayer < 1000.0f)
|
||||||
o->oAction = 1;
|
o->oAction = 1;
|
||||||
|
|
|
||||||
|
|
@ -13,7 +13,7 @@ void play_penguin_walking_sound(s32 walk) {
|
||||||
|
|
||||||
void tuxies_mother_act_2(void) {
|
void tuxies_mother_act_2(void) {
|
||||||
struct Object* player = gMarioStates[0].marioObj;
|
struct Object* player = gMarioStates[0].marioObj;
|
||||||
int angleToPlayer = obj_angle_to_object(o, player);
|
s32 angleToPlayer = obj_angle_to_object(o, player);
|
||||||
|
|
||||||
f32 sp24;
|
f32 sp24;
|
||||||
UNUSED s32 unused;
|
UNUSED s32 unused;
|
||||||
|
|
@ -109,7 +109,7 @@ u8 tuxies_mother_act_0_continue_dialog(void) { return (o->oAction == 0 && o->oSu
|
||||||
void tuxies_mother_act_0(void) {
|
void tuxies_mother_act_0(void) {
|
||||||
// only local can interact with mother
|
// only local can interact with mother
|
||||||
struct MarioState* marioState = &gMarioStates[0];
|
struct MarioState* marioState = &gMarioStates[0];
|
||||||
int distanceToPlayer = dist_between_objects(o, marioState->marioObj);
|
s32 distanceToPlayer = dist_between_objects(o, marioState->marioObj);
|
||||||
|
|
||||||
s32 sp2C;
|
s32 sp2C;
|
||||||
f32 sp28;
|
f32 sp28;
|
||||||
|
|
@ -171,8 +171,8 @@ void small_penguin_dive_with_mario(void) {
|
||||||
|
|
||||||
void small_penguin_act_2(void) {
|
void small_penguin_act_2(void) {
|
||||||
struct Object* player = nearest_player_to_object(o);
|
struct Object* player = nearest_player_to_object(o);
|
||||||
int distanceToPlayer = dist_between_objects(o, player);
|
s32 distanceToPlayer = dist_between_objects(o, player);
|
||||||
int angleToPlayer = obj_angle_to_object(o, player);
|
s32 angleToPlayer = obj_angle_to_object(o, player);
|
||||||
|
|
||||||
s32 sp1C = 0;
|
s32 sp1C = 0;
|
||||||
if (o->oTimer == 0)
|
if (o->oTimer == 0)
|
||||||
|
|
@ -190,8 +190,8 @@ void small_penguin_act_2(void) {
|
||||||
|
|
||||||
void small_penguin_act_1(void) {
|
void small_penguin_act_1(void) {
|
||||||
struct Object* player = nearest_player_to_object(o);
|
struct Object* player = nearest_player_to_object(o);
|
||||||
int distanceToPlayer = dist_between_objects(o, player);
|
s32 distanceToPlayer = dist_between_objects(o, player);
|
||||||
int angleToPlayer = obj_angle_to_object(o, player);
|
s32 angleToPlayer = obj_angle_to_object(o, player);
|
||||||
|
|
||||||
cur_obj_init_animation_with_sound(0);
|
cur_obj_init_animation_with_sound(0);
|
||||||
o->oForwardVel = o->oSmallPenguinUnk104 + 3.0f;
|
o->oForwardVel = o->oSmallPenguinUnk104 + 3.0f;
|
||||||
|
|
@ -225,7 +225,7 @@ void small_penguin_act_4(void) {
|
||||||
|
|
||||||
void small_penguin_act_0(void) {
|
void small_penguin_act_0(void) {
|
||||||
struct Object* player = nearest_player_to_object(o);
|
struct Object* player = nearest_player_to_object(o);
|
||||||
int distanceToPlayer = dist_between_objects(o, player);
|
s32 distanceToPlayer = dist_between_objects(o, player);
|
||||||
|
|
||||||
s32 sp1C;
|
s32 sp1C;
|
||||||
|
|
||||||
|
|
@ -251,7 +251,7 @@ void small_penguin_act_0(void) {
|
||||||
|
|
||||||
void small_penguin_act_5(void) {
|
void small_penguin_act_5(void) {
|
||||||
struct Object* player = nearest_player_to_object(o);
|
struct Object* player = nearest_player_to_object(o);
|
||||||
int distanceToPlayer = dist_between_objects(o, player);
|
s32 distanceToPlayer = dist_between_objects(o, player);
|
||||||
|
|
||||||
f32 sp24;
|
f32 sp24;
|
||||||
s16 sp22;
|
s16 sp22;
|
||||||
|
|
|
||||||
|
|
@ -44,7 +44,7 @@ void tweester_scale_and_move(f32 preScale) {
|
||||||
*/
|
*/
|
||||||
void tweester_act_idle(void) {
|
void tweester_act_idle(void) {
|
||||||
struct Object* player = nearest_player_to_object(o);
|
struct Object* player = nearest_player_to_object(o);
|
||||||
int distanceToPlayer = dist_between_objects(o, player);
|
s32 distanceToPlayer = dist_between_objects(o, player);
|
||||||
|
|
||||||
if (o->oSubAction == TWEESTER_SUB_ACT_WAIT) {
|
if (o->oSubAction == TWEESTER_SUB_ACT_WAIT) {
|
||||||
cur_obj_become_tangible();
|
cur_obj_become_tangible();
|
||||||
|
|
@ -74,8 +74,8 @@ void tweester_act_idle(void) {
|
||||||
void tweester_act_chase(void) {
|
void tweester_act_chase(void) {
|
||||||
struct MarioState* marioState = nearest_mario_state_to_object(o);
|
struct MarioState* marioState = nearest_mario_state_to_object(o);
|
||||||
struct Object* player = marioState->marioObj;
|
struct Object* player = marioState->marioObj;
|
||||||
int distanceToPlayer = dist_between_objects(o, player);
|
s32 distanceToPlayer = dist_between_objects(o, player);
|
||||||
int angleToPlayer = obj_angle_to_object(o, player);
|
s32 angleToPlayer = obj_angle_to_object(o, player);
|
||||||
|
|
||||||
f32 activationRadius = o->oBehParams2ndByte * 100;
|
f32 activationRadius = o->oBehParams2ndByte * 100;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -28,7 +28,7 @@ void handle_cap_ukiki_reset(void) {
|
||||||
*/
|
*/
|
||||||
s32 is_cap_ukiki_and_mario_has_normal_cap_on_head(void) {
|
s32 is_cap_ukiki_and_mario_has_normal_cap_on_head(void) {
|
||||||
if (o->oBehParams2ndByte == UKIKI_CAP) {
|
if (o->oBehParams2ndByte == UKIKI_CAP) {
|
||||||
for (int i = 0; i < MAX_PLAYERS; i++) {
|
for (s32 i = 0; i < MAX_PLAYERS; i++) {
|
||||||
if (!is_player_active(&gMarioStates[i])) { continue; }
|
if (!is_player_active(&gMarioStates[i])) { continue; }
|
||||||
if (!does_mario_have_normal_cap_on_head(&gMarioStates[i])) { return FALSE; }
|
if (!does_mario_have_normal_cap_on_head(&gMarioStates[i])) { return FALSE; }
|
||||||
}
|
}
|
||||||
|
|
@ -125,8 +125,8 @@ void idle_ukiki_taunt(void) {
|
||||||
*/
|
*/
|
||||||
void ukiki_act_idle(void) {
|
void ukiki_act_idle(void) {
|
||||||
struct Object* player = nearest_player_to_object(o);
|
struct Object* player = nearest_player_to_object(o);
|
||||||
int distanceToPlayer = dist_between_objects(o, player);
|
s32 distanceToPlayer = dist_between_objects(o, player);
|
||||||
int angleToPlayer = obj_angle_to_object(o, player);
|
s32 angleToPlayer = obj_angle_to_object(o, player);
|
||||||
|
|
||||||
idle_ukiki_taunt();
|
idle_ukiki_taunt();
|
||||||
|
|
||||||
|
|
@ -213,7 +213,7 @@ void ukiki_act_wait_to_respawn(void) {
|
||||||
*/
|
*/
|
||||||
void ukiki_act_unused_turn(void) {
|
void ukiki_act_unused_turn(void) {
|
||||||
struct Object* player = nearest_player_to_object(o);
|
struct Object* player = nearest_player_to_object(o);
|
||||||
int angleToPlayer = obj_angle_to_object(o, player);
|
s32 angleToPlayer = obj_angle_to_object(o, player);
|
||||||
idle_ukiki_taunt();
|
idle_ukiki_taunt();
|
||||||
|
|
||||||
if (o->oSubAction == UKIKI_SUB_ACT_TAUNT_JUMP_CLAP) {
|
if (o->oSubAction == UKIKI_SUB_ACT_TAUNT_JUMP_CLAP) {
|
||||||
|
|
@ -226,8 +226,8 @@ void ukiki_act_unused_turn(void) {
|
||||||
*/
|
*/
|
||||||
void ukiki_act_turn_to_mario(void) {
|
void ukiki_act_turn_to_mario(void) {
|
||||||
struct Object* player = nearest_player_to_object(o);
|
struct Object* player = nearest_player_to_object(o);
|
||||||
int distanceToPlayer = dist_between_objects(o, player);
|
s32 distanceToPlayer = dist_between_objects(o, player);
|
||||||
int angleToPlayer = obj_angle_to_object(o, player);
|
s32 angleToPlayer = obj_angle_to_object(o, player);
|
||||||
s32 facingMario;
|
s32 facingMario;
|
||||||
|
|
||||||
// Initialize the action with a random fVel from 2-5.
|
// Initialize the action with a random fVel from 2-5.
|
||||||
|
|
@ -258,8 +258,8 @@ void ukiki_act_turn_to_mario(void) {
|
||||||
void ukiki_act_run(void) {
|
void ukiki_act_run(void) {
|
||||||
struct MarioState* marioState = nearest_mario_state_to_object(o);
|
struct MarioState* marioState = nearest_mario_state_to_object(o);
|
||||||
struct Object* player = marioState->marioObj;
|
struct Object* player = marioState->marioObj;
|
||||||
int distanceToPlayer = dist_between_objects(o, player);
|
s32 distanceToPlayer = dist_between_objects(o, player);
|
||||||
int angleToPlayer = obj_angle_to_object(o, player);
|
s32 angleToPlayer = obj_angle_to_object(o, player);
|
||||||
|
|
||||||
s32 fleeMario = TRUE;
|
s32 fleeMario = TRUE;
|
||||||
s16 goalYaw = angleToPlayer + 0x8000;
|
s16 goalYaw = angleToPlayer + 0x8000;
|
||||||
|
|
@ -690,7 +690,7 @@ void bhv_ukiki_loop(void) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (o->oUkikiHasCap & UKIKI_CAP_ON) {
|
if (o->oUkikiHasCap & UKIKI_CAP_ON) {
|
||||||
for (int i = 0; i < MAX_PLAYERS; i++) {
|
for (s32 i = 0; i < MAX_PLAYERS; i++) {
|
||||||
if (!is_player_active(&gMarioStates[i])) { continue; }
|
if (!is_player_active(&gMarioStates[i])) { continue; }
|
||||||
if (!does_mario_have_normal_cap_on_head(&gMarioStates[i])) {
|
if (!does_mario_have_normal_cap_on_head(&gMarioStates[i])) {
|
||||||
o->oAnimState = UKIKI_ANIM_STATE_CAP_ON;
|
o->oAnimState = UKIKI_ANIM_STATE_CAP_ON;
|
||||||
|
|
|
||||||
|
|
@ -50,7 +50,7 @@ void bhv_unagi_init(void) {
|
||||||
|
|
||||||
void unagi_act_0(void) {
|
void unagi_act_0(void) {
|
||||||
struct Object* player = nearest_player_to_object(o);
|
struct Object* player = nearest_player_to_object(o);
|
||||||
int distanceToPlayer = dist_between_objects(o, player);
|
s32 distanceToPlayer = dist_between_objects(o, player);
|
||||||
if (distanceToPlayer > 4500.0f && o->oSubAction != 0) {
|
if (distanceToPlayer > 4500.0f && o->oSubAction != 0) {
|
||||||
o->oAction = 1;
|
o->oAction = 1;
|
||||||
o->oPosX = o->oPathedStartWaypoint->pos[0];
|
o->oPosX = o->oPathedStartWaypoint->pos[0];
|
||||||
|
|
@ -162,7 +162,7 @@ void bhv_unagi_loop(void) {
|
||||||
s32 val04;
|
s32 val04;
|
||||||
|
|
||||||
struct Object* player = nearest_player_to_object(o);
|
struct Object* player = nearest_player_to_object(o);
|
||||||
int distanceToPlayer = dist_between_objects(o, player);
|
s32 distanceToPlayer = dist_between_objects(o, player);
|
||||||
|
|
||||||
if (o->oUnagiUnk1B2 == 0) {
|
if (o->oUnagiUnk1B2 == 0) {
|
||||||
o->oUnagiUnk1AC = 99999.0f;
|
o->oUnagiUnk1AC = 99999.0f;
|
||||||
|
|
@ -198,7 +198,7 @@ void bhv_unagi_subobject_loop(void) {
|
||||||
f32 val04;
|
f32 val04;
|
||||||
|
|
||||||
struct Object* player = nearest_player_to_object(o);
|
struct Object* player = nearest_player_to_object(o);
|
||||||
int distanceToPlayer = dist_between_objects(o, player);
|
s32 distanceToPlayer = dist_between_objects(o, player);
|
||||||
|
|
||||||
if (o->parentObj->oUnagiUnk1B2 == 0) {
|
if (o->parentObj->oUnagiUnk1B2 == 0) {
|
||||||
obj_mark_for_deletion(o);
|
obj_mark_for_deletion(o);
|
||||||
|
|
|
||||||
|
|
@ -44,7 +44,7 @@ void bhv_water_bomb_spawner_update(void) {
|
||||||
struct MarioState* marioState = NULL;
|
struct MarioState* marioState = NULL;
|
||||||
struct Object* player = NULL;
|
struct Object* player = NULL;
|
||||||
|
|
||||||
for (int i = 0; i < MAX_PLAYERS; i++) {
|
for (s32 i = 0; i < MAX_PLAYERS; i++) {
|
||||||
if (!is_player_active(&gMarioStates[i])) { continue; }
|
if (!is_player_active(&gMarioStates[i])) { continue; }
|
||||||
f32 latDist = lateral_dist_between_objects(o, gMarioStates[i].marioObj);
|
f32 latDist = lateral_dist_between_objects(o, gMarioStates[i].marioObj);
|
||||||
if (latDist < latDistToMario) {
|
if (latDist < latDistToMario) {
|
||||||
|
|
@ -165,7 +165,7 @@ static void water_bomb_act_drop(void) {
|
||||||
|
|
||||||
// Move toward mario
|
// Move toward mario
|
||||||
struct Object* player = nearest_player_to_object(o);
|
struct Object* player = nearest_player_to_object(o);
|
||||||
int angleToPlayer = obj_angle_to_object(o, player);
|
s32 angleToPlayer = obj_angle_to_object(o, player);
|
||||||
o->oMoveAngleYaw = angleToPlayer;
|
o->oMoveAngleYaw = angleToPlayer;
|
||||||
o->oForwardVel = 10.0f;
|
o->oForwardVel = 10.0f;
|
||||||
o->oWaterBombStretchSpeed = -40.0f;
|
o->oWaterBombStretchSpeed = -40.0f;
|
||||||
|
|
|
||||||
|
|
@ -19,7 +19,7 @@ u8 whomp_act_0_continue_dialog(void) { return o->oAction == 0; }
|
||||||
void whomp_act_0(void) {
|
void whomp_act_0(void) {
|
||||||
struct MarioState* marioState = nearest_mario_state_to_object(o);
|
struct MarioState* marioState = nearest_mario_state_to_object(o);
|
||||||
struct Object* player = marioState->marioObj;
|
struct Object* player = marioState->marioObj;
|
||||||
int distanceToPlayer = dist_between_objects(o, player);
|
s32 distanceToPlayer = dist_between_objects(o, player);
|
||||||
|
|
||||||
cur_obj_init_animation_with_accel_and_sound(0, 1.0f);
|
cur_obj_init_animation_with_accel_and_sound(0, 1.0f);
|
||||||
cur_obj_set_pos_to_home();
|
cur_obj_set_pos_to_home();
|
||||||
|
|
@ -61,8 +61,8 @@ void whomp_act_7(void) {
|
||||||
|
|
||||||
void whomp_act_1(void) {
|
void whomp_act_1(void) {
|
||||||
struct Object* player = nearest_player_to_object(o);
|
struct Object* player = nearest_player_to_object(o);
|
||||||
int distanceToPlayer = dist_between_objects(o, player);
|
s32 distanceToPlayer = dist_between_objects(o, player);
|
||||||
int angleToPlayer = obj_angle_to_object(o, player);
|
s32 angleToPlayer = obj_angle_to_object(o, player);
|
||||||
|
|
||||||
s16 sp26;
|
s16 sp26;
|
||||||
f32 sp20;
|
f32 sp20;
|
||||||
|
|
@ -90,8 +90,8 @@ void whomp_act_1(void) {
|
||||||
|
|
||||||
void whomp_act_2(void) {
|
void whomp_act_2(void) {
|
||||||
struct Object* player = nearest_player_to_object(o);
|
struct Object* player = nearest_player_to_object(o);
|
||||||
int distanceToPlayer = dist_between_objects(o, player);
|
s32 distanceToPlayer = dist_between_objects(o, player);
|
||||||
int angleToPlayer = obj_angle_to_object(o, player);
|
s32 angleToPlayer = obj_angle_to_object(o, player);
|
||||||
|
|
||||||
s16 sp1E;
|
s16 sp1E;
|
||||||
cur_obj_init_animation_with_accel_and_sound(0, 1.0f);
|
cur_obj_init_animation_with_accel_and_sound(0, 1.0f);
|
||||||
|
|
|
||||||
|
|
@ -92,7 +92,7 @@ void yoshi_idle_loop(void) {
|
||||||
void yoshi_talk_loop(void) {
|
void yoshi_talk_loop(void) {
|
||||||
struct MarioState* marioState = nearest_mario_state_to_object(o);
|
struct MarioState* marioState = nearest_mario_state_to_object(o);
|
||||||
struct Object* player = marioState->marioObj;
|
struct Object* player = marioState->marioObj;
|
||||||
int angleToPlayer = obj_angle_to_object(o, player);
|
s32 angleToPlayer = obj_angle_to_object(o, player);
|
||||||
|
|
||||||
if (marioState != &gMarioStates[0]) {
|
if (marioState != &gMarioStates[0]) {
|
||||||
return;
|
return;
|
||||||
|
|
|
||||||
|
|
@ -498,7 +498,7 @@ static void newcam_bounding_box(void) {
|
||||||
camdirs[2][1] = -NEW_CAM_BOUNDING_BOX_VRADIUS;
|
camdirs[2][1] = -NEW_CAM_BOUNDING_BOX_VRADIUS;
|
||||||
camdirs[3][1] = NEW_CAM_BOUNDING_BOX_VRADIUS;
|
camdirs[3][1] = NEW_CAM_BOUNDING_BOX_VRADIUS;
|
||||||
|
|
||||||
for (int i = 0; i < NEW_CAM_BOUNDING_BOX_RAYS; i++) {
|
for (s32 i = 0; i < NEW_CAM_BOUNDING_BOX_RAYS; i++) {
|
||||||
struct Surface* surf;
|
struct Surface* surf;
|
||||||
Vec3f offset = { 0 };
|
Vec3f offset = { 0 };
|
||||||
|
|
||||||
|
|
@ -514,7 +514,7 @@ static void newcam_bounding_box(void) {
|
||||||
}
|
}
|
||||||
|
|
||||||
Vec3f avg = { 0 };
|
Vec3f avg = { 0 };
|
||||||
for (int i = 0; i < NEW_CAM_BOUNDING_BOX_RAYS; i++) {
|
for (s32 i = 0; i < NEW_CAM_BOUNDING_BOX_RAYS; i++) {
|
||||||
vec3f_add(avg, raypos[i]);
|
vec3f_add(avg, raypos[i]);
|
||||||
}
|
}
|
||||||
vec3f_mul(avg, 1.0f / ((f32)NEW_CAM_BOUNDING_BOX_RAYS));
|
vec3f_mul(avg, 1.0f / ((f32)NEW_CAM_BOUNDING_BOX_RAYS));
|
||||||
|
|
|
||||||
|
|
@ -434,7 +434,7 @@ u8 str_ascii_char_to_dialog(char c) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void str_ascii_to_dialog(const char* string, u8* dialog, u16 length) {
|
void str_ascii_to_dialog(const char* string, u8* dialog, u16 length) {
|
||||||
for (int i = 0; i < length; i++) {
|
for (s32 i = 0; i < length; i++) {
|
||||||
dialog[i] = str_ascii_char_to_dialog(string[i]);
|
dialog[i] = str_ascii_char_to_dialog(string[i]);
|
||||||
}
|
}
|
||||||
dialog[length] = DIALOG_CHAR_TERMINATOR;
|
dialog[length] = DIALOG_CHAR_TERMINATOR;
|
||||||
|
|
@ -464,7 +464,7 @@ f32 get_generic_ascii_string_width(const char* ascii) {
|
||||||
}
|
}
|
||||||
|
|
||||||
f32 get_generic_dialog_height(u8* dialog) {
|
f32 get_generic_dialog_height(u8* dialog) {
|
||||||
int lines = 0;
|
s32 lines = 0;
|
||||||
u8* d = dialog;
|
u8* d = dialog;
|
||||||
while (*d != DIALOG_CHAR_TERMINATOR) {
|
while (*d != DIALOG_CHAR_TERMINATOR) {
|
||||||
if (*d == DIALOG_CHAR_NEWLINE) { lines++; }
|
if (*d == DIALOG_CHAR_NEWLINE) { lines++; }
|
||||||
|
|
|
||||||
|
|
@ -676,7 +676,7 @@ u32 determine_knockback_action(struct MarioState *m, UNUSED s32 arg) {
|
||||||
// set knockback very high when dealing with player attacks
|
// set knockback very high when dealing with player attacks
|
||||||
if (m->interactObj != NULL && (m->interactObj->oInteractType & INTERACT_PLAYER) && terrainIndex != 2) {
|
if (m->interactObj != NULL && (m->interactObj->oInteractType & INTERACT_PLAYER) && terrainIndex != 2) {
|
||||||
f32 scaler = 1;
|
f32 scaler = 1;
|
||||||
for (int i = 0; i < MAX_PLAYERS; i++) {
|
for (s32 i = 0; i < MAX_PLAYERS; i++) {
|
||||||
struct MarioState* m2 = &gMarioStates[i];
|
struct MarioState* m2 = &gMarioStates[i];
|
||||||
if (!is_player_active(m2)) { continue; }
|
if (!is_player_active(m2)) { continue; }
|
||||||
if (m2->marioObj == NULL) { continue; }
|
if (m2->marioObj == NULL) { continue; }
|
||||||
|
|
@ -907,7 +907,7 @@ u32 interact_star_or_key(struct MarioState *m, UNUSED u32 interactType, struct O
|
||||||
starGrabAction = ACT_FALL_AFTER_STAR_GRAB;
|
starGrabAction = ACT_FALL_AFTER_STAR_GRAB;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int i = 0; i < MAX_PLAYERS; i++) {
|
for (s32 i = 0; i < MAX_PLAYERS; i++) {
|
||||||
struct MarioState* marioState = &gMarioStates[i];
|
struct MarioState* marioState = &gMarioStates[i];
|
||||||
if (!is_player_active(marioState)) { continue; }
|
if (!is_player_active(marioState)) { continue; }
|
||||||
if (marioState->marioObj == NULL) { continue; }
|
if (marioState->marioObj == NULL) { continue; }
|
||||||
|
|
@ -927,7 +927,7 @@ u32 interact_star_or_key(struct MarioState *m, UNUSED u32 interactType, struct O
|
||||||
save_file_collect_star_or_key(m->numCoins, starIndex, 0);
|
save_file_collect_star_or_key(m->numCoins, starIndex, 0);
|
||||||
|
|
||||||
s32 numStars = save_file_get_total_star_count(gCurrSaveFileNum - 1, COURSE_MIN - 1, COURSE_MAX - 1);
|
s32 numStars = save_file_get_total_star_count(gCurrSaveFileNum - 1, COURSE_MIN - 1, COURSE_MAX - 1);
|
||||||
for (int i = 0; i < MAX_PLAYERS; i++) {
|
for (s32 i = 0; i < MAX_PLAYERS; i++) {
|
||||||
gMarioStates[i].numStars = numStars;
|
gMarioStates[i].numStars = numStars;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1035,7 +1035,7 @@ u32 display_door_dialog(struct MarioState *m, u32 actionArg) {
|
||||||
|
|
||||||
u8 prevent_interact_door(struct MarioState* m, struct Object* o) {
|
u8 prevent_interact_door(struct MarioState* m, struct Object* o) {
|
||||||
// prevent multiple star/key unlocks on the same door
|
// prevent multiple star/key unlocks on the same door
|
||||||
for (int i = 0; i < MAX_PLAYERS; i++) {
|
for (s32 i = 0; i < MAX_PLAYERS; i++) {
|
||||||
struct MarioState* m2 = &gMarioStates[i];
|
struct MarioState* m2 = &gMarioStates[i];
|
||||||
if (m2 == m) { continue; }
|
if (m2 == m) { continue; }
|
||||||
if (!is_player_active(m2)) { continue; }
|
if (!is_player_active(m2)) { continue; }
|
||||||
|
|
@ -1323,7 +1323,7 @@ u32 interact_player(struct MarioState* m, UNUSED u32 interactType, struct Object
|
||||||
if (m->action == ACT_JUMBO_STAR_CUTSCENE) { return FALSE; }
|
if (m->action == ACT_JUMBO_STAR_CUTSCENE) { return FALSE; }
|
||||||
|
|
||||||
struct MarioState* m2 = NULL;
|
struct MarioState* m2 = NULL;
|
||||||
for (int i = 0; i < MAX_PLAYERS; i++) {
|
for (s32 i = 0; i < MAX_PLAYERS; i++) {
|
||||||
if (o == gMarioStates[i].marioObj) {
|
if (o == gMarioStates[i].marioObj) {
|
||||||
if (!is_player_active(&gMarioStates[i])) { return FALSE; }
|
if (!is_player_active(&gMarioStates[i])) { return FALSE; }
|
||||||
m2 = &gMarioStates[i];
|
m2 = &gMarioStates[i];
|
||||||
|
|
@ -1805,7 +1805,7 @@ u32 interact_koopa_shell(struct MarioState *m, UNUSED u32 interactType, struct O
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int i = 0; i < MAX_PLAYERS; i++) {
|
for (s32 i = 0; i < MAX_PLAYERS; i++) {
|
||||||
if (!is_player_active(&gMarioStates[i])) { continue; }
|
if (!is_player_active(&gMarioStates[i])) { continue; }
|
||||||
if (gMarioStates[i].riddenObj == o) { return FALSE; }
|
if (gMarioStates[i].riddenObj == o) { return FALSE; }
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -405,7 +405,7 @@ void init_mario_after_warp(void) {
|
||||||
u32 marioSpawnType = get_mario_spawn_type(spawnNode->object);
|
u32 marioSpawnType = get_mario_spawn_type(spawnNode->object);
|
||||||
|
|
||||||
if (gMarioState->action != ACT_UNINITIALIZED) {
|
if (gMarioState->action != ACT_UNINITIALIZED) {
|
||||||
for (int i = 0; i < MAX_PLAYERS; i++) {
|
for (s32 i = 0; i < MAX_PLAYERS; i++) {
|
||||||
gPlayerSpawnInfos[i].startPos[0] = (s16) spawnNode->object->oPosX;
|
gPlayerSpawnInfos[i].startPos[0] = (s16) spawnNode->object->oPosX;
|
||||||
gPlayerSpawnInfos[i].startPos[1] = (s16) spawnNode->object->oPosY;
|
gPlayerSpawnInfos[i].startPos[1] = (s16) spawnNode->object->oPosY;
|
||||||
gPlayerSpawnInfos[i].startPos[2] = (s16) spawnNode->object->oPosZ;
|
gPlayerSpawnInfos[i].startPos[2] = (s16) spawnNode->object->oPosZ;
|
||||||
|
|
@ -580,7 +580,7 @@ void warp_credits(void) {
|
||||||
gCurrCreditsEntry = &sCreditsSequence[0];
|
gCurrCreditsEntry = &sCreditsSequence[0];
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int i = 0; i < MAX_PLAYERS; i++) {
|
for (s32 i = 0; i < MAX_PLAYERS; i++) {
|
||||||
vec3s_set(gPlayerSpawnInfos[i].startPos, gCurrCreditsEntry->marioPos[0],
|
vec3s_set(gPlayerSpawnInfos[i].startPos, gCurrCreditsEntry->marioPos[0],
|
||||||
gCurrCreditsEntry->marioPos[1], gCurrCreditsEntry->marioPos[2]);
|
gCurrCreditsEntry->marioPos[1], gCurrCreditsEntry->marioPos[2]);
|
||||||
|
|
||||||
|
|
@ -637,7 +637,7 @@ void check_instant_warp(void) {
|
||||||
vec3f_copy(gMarioStates[0].nonInstantWarpPos, gMarioStates[0].pos);
|
vec3f_copy(gMarioStates[0].nonInstantWarpPos, gMarioStates[0].pos);
|
||||||
|
|
||||||
if (changeOfArea) {
|
if (changeOfArea) {
|
||||||
for (int i = 0; i < MAX_PLAYERS; i++) {
|
for (s32 i = 0; i < MAX_PLAYERS; i++) {
|
||||||
gMarioStates[i].marioObj->oIntangibleTimer = 30;
|
gMarioStates[i].marioObj->oIntangibleTimer = 30;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -649,7 +649,7 @@ void check_instant_warp(void) {
|
||||||
cameraAngle = gMarioStates[0].area->camera->yaw;
|
cameraAngle = gMarioStates[0].area->camera->yaw;
|
||||||
change_area(warp->area);
|
change_area(warp->area);
|
||||||
|
|
||||||
for (int i = 0; i < MAX_PLAYERS; i++) {
|
for (s32 i = 0; i < MAX_PLAYERS; i++) {
|
||||||
gMarioStates[i].area = gCurrentArea;
|
gMarioStates[i].area = gCurrentArea;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1219,7 +1219,7 @@ void level_set_transition(s16 length, void (*updateFunction)(s16 *)) {
|
||||||
*/
|
*/
|
||||||
s32 play_mode_change_area(void) {
|
s32 play_mode_change_area(void) {
|
||||||
// fade out all players
|
// fade out all players
|
||||||
for (int i = 0; i < MAX_PLAYERS; i++) {
|
for (s32 i = 0; i < MAX_PLAYERS; i++) {
|
||||||
gNetworkPlayers[i].fadeOpacity = 0;
|
gNetworkPlayers[i].fadeOpacity = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1248,7 +1248,7 @@ s32 play_mode_change_area(void) {
|
||||||
*/
|
*/
|
||||||
s32 play_mode_change_level(void) {
|
s32 play_mode_change_level(void) {
|
||||||
// fade out all players
|
// fade out all players
|
||||||
for (int i = 0; i < MAX_PLAYERS; i++) {
|
for (s32 i = 0; i < MAX_PLAYERS; i++) {
|
||||||
gNetworkPlayers[i].fadeOpacity = 0;
|
gNetworkPlayers[i].fadeOpacity = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -402,7 +402,7 @@ bool mario_can_bubble(struct MarioState* m) {
|
||||||
if (m->action == ACT_BUBBLED) { return false; }
|
if (m->action == ACT_BUBBLED) { return false; }
|
||||||
|
|
||||||
u8 allInBubble = TRUE;
|
u8 allInBubble = TRUE;
|
||||||
for (int i = 1; i < MAX_PLAYERS; i++) {
|
for (s32 i = 1; i < MAX_PLAYERS; i++) {
|
||||||
if (!is_player_active(&gMarioStates[i])) { continue; }
|
if (!is_player_active(&gMarioStates[i])) { continue; }
|
||||||
if (gMarioStates[i].action != ACT_BUBBLED && gMarioStates[i].health >= 0x100) {
|
if (gMarioStates[i].action != ACT_BUBBLED && gMarioStates[i].health >= 0x100) {
|
||||||
allInBubble = FALSE;
|
allInBubble = FALSE;
|
||||||
|
|
@ -1471,7 +1471,7 @@ copyPlayerGoto:;
|
||||||
if (!copiedPlayer) {
|
if (!copiedPlayer) {
|
||||||
// try to prevent OOB by copying position of other player
|
// try to prevent OOB by copying position of other player
|
||||||
struct Surface* floor2 = NULL;
|
struct Surface* floor2 = NULL;
|
||||||
for (int i = 0; i < MAX_PLAYERS; i++) {
|
for (s32 i = 0; i < MAX_PLAYERS; i++) {
|
||||||
struct MarioState* m2 = &gMarioStates[i];
|
struct MarioState* m2 = &gMarioStates[i];
|
||||||
if (m == m2) { continue; }
|
if (m == m2) { continue; }
|
||||||
find_floor(m2->pos[0], m2->pos[1], m2->pos[2], &floor2);
|
find_floor(m2->pos[0], m2->pos[1], m2->pos[2], &floor2);
|
||||||
|
|
@ -1873,7 +1873,7 @@ static u8 prevent_hang(u32 hangPreventionActions[], u8* hangPreventionIndex) {
|
||||||
|
|
||||||
// save to log
|
// save to log
|
||||||
fprintf(f, "(gMarioState->action: hang prevention begin)\n");
|
fprintf(f, "(gMarioState->action: hang prevention begin)\n");
|
||||||
for (int i = 0; i < MAX_HANG_PREVENTION; i++) {
|
for (s32 i = 0; i < MAX_HANG_PREVENTION; i++) {
|
||||||
fprintf(f, "%08X\n", hangPreventionActions[i]);
|
fprintf(f, "%08X\n", hangPreventionActions[i]);
|
||||||
}
|
}
|
||||||
fprintf(f, "(gMarioState->action: hang prevention end)\n");
|
fprintf(f, "(gMarioState->action: hang prevention end)\n");
|
||||||
|
|
|
||||||
|
|
@ -697,7 +697,7 @@ s32 act_grabbed(struct MarioState *m) {
|
||||||
// check if the object holding me is being held
|
// check if the object holding me is being held
|
||||||
u8 heldObjIsHeld = FALSE;
|
u8 heldObjIsHeld = FALSE;
|
||||||
if (m->heldByObj != NULL) {
|
if (m->heldByObj != NULL) {
|
||||||
for (int i = 0; i < MAX_PLAYERS; i++) {
|
for (s32 i = 0; i < MAX_PLAYERS; i++) {
|
||||||
if (!is_player_active(&gMarioStates[i])) { continue; }
|
if (!is_player_active(&gMarioStates[i])) { continue; }
|
||||||
if (gMarioStates[i].heldObj == m->heldByObj) { heldObjIsHeld = TRUE; }
|
if (gMarioStates[i].heldObj == m->heldByObj) { heldObjIsHeld = TRUE; }
|
||||||
}
|
}
|
||||||
|
|
@ -929,16 +929,17 @@ static void bubbled_offset_visual(struct MarioState* m) {
|
||||||
}
|
}
|
||||||
|
|
||||||
s32 act_bubbled(struct MarioState* m) {
|
s32 act_bubbled(struct MarioState* m) {
|
||||||
|
set_camera_mode(m->area->camera, CAMERA_MODE_FREE_ROAM, 1);
|
||||||
struct MarioState* targetMarioState = nearest_mario_state_to_object(m->marioObj);
|
struct MarioState* targetMarioState = nearest_mario_state_to_object(m->marioObj);
|
||||||
struct Object* target = targetMarioState->marioObj;
|
struct Object* target = targetMarioState->marioObj;
|
||||||
int angleToPlayer = obj_angle_to_object(m->marioObj, target);
|
s32 angleToPlayer = obj_angle_to_object(m->marioObj, target);
|
||||||
int pitchToPlayer = obj_pitch_to_object(m->marioObj, target);
|
s32 pitchToPlayer = obj_pitch_to_object(m->marioObj, target);
|
||||||
int distanceToPlayer = dist_between_objects(m->marioObj, target);
|
s32 distanceToPlayer = dist_between_objects(m->marioObj, target);
|
||||||
|
|
||||||
// trigger warp if all are bubbled
|
// trigger warp if all are bubbled
|
||||||
if (m->playerIndex == 0) {
|
if (m->playerIndex == 0) {
|
||||||
u8 allInBubble = TRUE;
|
u8 allInBubble = TRUE;
|
||||||
for (int i = 0; i < MAX_PLAYERS; i++) {
|
for (s32 i = 0; i < MAX_PLAYERS; i++) {
|
||||||
if (!is_player_active(&gMarioStates[i])) { continue; }
|
if (!is_player_active(&gMarioStates[i])) { continue; }
|
||||||
if (gMarioStates[i].action != ACT_BUBBLED && gMarioStates[i].health >= 0x100) {
|
if (gMarioStates[i].action != ACT_BUBBLED && gMarioStates[i].health >= 0x100) {
|
||||||
allInBubble = FALSE;
|
allInBubble = FALSE;
|
||||||
|
|
@ -978,7 +979,7 @@ s32 act_bubbled(struct MarioState* m) {
|
||||||
// set and smooth velocity
|
// set and smooth velocity
|
||||||
Vec3f oldVel = { m->vel[0], m->vel[1], m->vel[2] };
|
Vec3f oldVel = { m->vel[0], m->vel[1], m->vel[2] };
|
||||||
set_vel_from_pitch_and_yaw(m);
|
set_vel_from_pitch_and_yaw(m);
|
||||||
for (int i = 0; i < 3; i++) {
|
for (s32 i = 0; i < 3; i++) {
|
||||||
m->vel[i] = (oldVel[i] * 0.9f + m->vel[i] * 0.1f);
|
m->vel[i] = (oldVel[i] * 0.9f + m->vel[i] * 0.1f);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -206,11 +206,10 @@ void bhv_end_toad_loop(void) {
|
||||||
// Geo switch case function for controlling Peach's eye state.
|
// Geo switch case function for controlling Peach's eye state.
|
||||||
s32 geo_switch_peach_eyes(s32 run, struct GraphNode *node, UNUSED s32 a2) {
|
s32 geo_switch_peach_eyes(s32 run, struct GraphNode *node, UNUSED s32 a2) {
|
||||||
struct GraphNodeSwitchCase *switchCase = (struct GraphNodeSwitchCase *) node;
|
struct GraphNodeSwitchCase *switchCase = (struct GraphNodeSwitchCase *) node;
|
||||||
s16 timer;
|
|
||||||
|
|
||||||
if (run == TRUE) {
|
if (run == TRUE) {
|
||||||
if (D_8032CBE4 == 0) {
|
if (D_8032CBE4 == 0) {
|
||||||
timer = (gAreaUpdateCounter + 0x20) >> 1 & 0x1F;
|
s16 timer = (gAreaUpdateCounter + 0x20) >> 1 & 0x1F;
|
||||||
if (timer < 7) {
|
if (timer < 7) {
|
||||||
switchCase->selectedCase = D_8032CBE8 * 4 + D_8032CBEC[timer];
|
switchCase->selectedCase = D_8032CBE8 * 4 + D_8032CBEC[timer];
|
||||||
} else {
|
} else {
|
||||||
|
|
@ -239,12 +238,10 @@ static void stub_is_textbox_active(u16 *a0) {
|
||||||
* numStars has reached a milestone and prevNumStarsForDialog has not reached it.
|
* numStars has reached a milestone and prevNumStarsForDialog has not reached it.
|
||||||
*/
|
*/
|
||||||
s32 get_star_collection_dialog(struct MarioState *m) {
|
s32 get_star_collection_dialog(struct MarioState *m) {
|
||||||
s32 i;
|
|
||||||
s32 dialogID = 0;
|
s32 dialogID = 0;
|
||||||
s32 numStarsRequired;
|
|
||||||
|
|
||||||
for (i = 0; i < ARRAY_COUNT(sStarsNeededForDialog); i++) {
|
for (s32 i = 0; i < ARRAY_COUNT(sStarsNeededForDialog); i++) {
|
||||||
numStarsRequired = sStarsNeededForDialog[i];
|
s32 numStarsRequired = sStarsNeededForDialog[i];
|
||||||
if (m->prevNumStarsForDialog < numStarsRequired && m->numStars >= numStarsRequired) {
|
if (m->prevNumStarsForDialog < numStarsRequired && m->numStars >= numStarsRequired) {
|
||||||
dialogID = i + DIALOG_141;
|
dialogID = i + DIALOG_141;
|
||||||
break;
|
break;
|
||||||
|
|
@ -257,7 +254,6 @@ s32 get_star_collection_dialog(struct MarioState *m) {
|
||||||
|
|
||||||
// save menu handler
|
// save menu handler
|
||||||
void handle_save_menu(struct MarioState *m) {
|
void handle_save_menu(struct MarioState *m) {
|
||||||
s32 dialogID;
|
|
||||||
// wait for the menu to show up
|
// wait for the menu to show up
|
||||||
if (is_anim_past_end(m) && gSaveOptSelectIndex != 0) {
|
if (is_anim_past_end(m) && gSaveOptSelectIndex != 0) {
|
||||||
// save and continue / save and quit
|
// save and continue / save and quit
|
||||||
|
|
@ -278,7 +274,7 @@ void handle_save_menu(struct MarioState *m) {
|
||||||
disable_time_stop();
|
disable_time_stop();
|
||||||
m->faceAngle[1] += 0x8000;
|
m->faceAngle[1] += 0x8000;
|
||||||
// figure out what dialog to show, if we should
|
// figure out what dialog to show, if we should
|
||||||
dialogID = get_star_collection_dialog(m);
|
s32 dialogID = get_star_collection_dialog(m);
|
||||||
if (dialogID != 0) {
|
if (dialogID != 0) {
|
||||||
play_peachs_jingle();
|
play_peachs_jingle();
|
||||||
// look up for dialog
|
// look up for dialog
|
||||||
|
|
@ -495,15 +491,16 @@ s32 act_disappeared(struct MarioState *m) {
|
||||||
}
|
}
|
||||||
|
|
||||||
s32 act_reading_automatic_dialog(struct MarioState *m) {
|
s32 act_reading_automatic_dialog(struct MarioState *m) {
|
||||||
u32 actionArg;
|
if (m == NULL) { return TRUE; }
|
||||||
|
|
||||||
|
// Increment our action state to continue our 'cutscene'.
|
||||||
m->actionState++;
|
m->actionState++;
|
||||||
|
|
||||||
if (m->actionState == 2) {
|
if (m->actionState == 2) {
|
||||||
//enable_time_stop();
|
enable_time_stop_if_alone();
|
||||||
}
|
}
|
||||||
if (m->actionState < 9) {
|
if (m->actionState < 9) {
|
||||||
set_mario_animation(m, m->prevAction == ACT_STAR_DANCE_WATER ? MARIO_ANIM_WATER_IDLE
|
set_mario_animation(m, m->prevAction == ACT_STAR_DANCE_WATER ? MARIO_ANIM_WATER_IDLE : MARIO_ANIM_FIRST_PERSON);
|
||||||
: MARIO_ANIM_FIRST_PERSON);
|
|
||||||
// always look up for automatic dialogs
|
// always look up for automatic dialogs
|
||||||
m->actionTimer -= 1024;
|
m->actionTimer -= 1024;
|
||||||
} else {
|
} else {
|
||||||
|
|
@ -514,24 +511,17 @@ s32 act_reading_automatic_dialog(struct MarioState *m) {
|
||||||
actionArg = m->actionArg;
|
actionArg = m->actionArg;
|
||||||
if (GET_HIGH_U16_OF_32(actionArg) == 0) {
|
if (GET_HIGH_U16_OF_32(actionArg) == 0) {
|
||||||
create_dialog_box(GET_LOW_U16_OF_32(actionArg));
|
create_dialog_box(GET_LOW_U16_OF_32(actionArg));
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
create_dialog_box_with_var(GET_HIGH_U16_OF_32(actionArg), GET_LOW_U16_OF_32(actionArg));
|
create_dialog_box_with_var(GET_HIGH_U16_OF_32(actionArg), GET_LOW_U16_OF_32(actionArg));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
} else if (m->actionState == 10) { // wait until dialog is done
|
||||||
// wait until dialog is done
|
|
||||||
else if (m->actionState == 10) {
|
|
||||||
if (get_dialog_id() >= 0) {
|
if (get_dialog_id() >= 0) {
|
||||||
m->actionState--;
|
m->actionState--;
|
||||||
}
|
}
|
||||||
}
|
} else if (m->actionState < 19) { // wait until dialog is done
|
||||||
// look back down
|
|
||||||
else if (m->actionState < 19) {
|
|
||||||
m->actionTimer += 1024;
|
m->actionTimer += 1024;
|
||||||
}
|
} else if (m->actionState == 25) { // finished action
|
||||||
// finished action
|
|
||||||
else if (m->actionState == 25) {
|
|
||||||
disable_time_stop();
|
disable_time_stop();
|
||||||
if (gNeverEnteredCastle) {
|
if (gNeverEnteredCastle) {
|
||||||
gNeverEnteredCastle = FALSE;
|
gNeverEnteredCastle = FALSE;
|
||||||
|
|
@ -541,20 +531,23 @@ s32 act_reading_automatic_dialog(struct MarioState *m) {
|
||||||
set_mario_action(m, ACT_WATER_IDLE, 0); // 100c star?
|
set_mario_action(m, ACT_WATER_IDLE, 0); // 100c star?
|
||||||
} else {
|
} else {
|
||||||
// make Mario walk into door after star dialog
|
// make Mario walk into door after star dialog
|
||||||
set_mario_action(m, m->prevAction == ACT_UNLOCKING_STAR_DOOR ? ACT_WALKING : ACT_IDLE,
|
set_mario_action(m, m->prevAction == ACT_UNLOCKING_STAR_DOOR ? ACT_WALKING : ACT_IDLE, 0);
|
||||||
0);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// apply head turn
|
// apply head turn
|
||||||
vec3s_set(m->marioBodyState->headAngle, m->actionTimer, 0, 0);
|
vec3s_set(m->marioBodyState->headAngle, m->actionTimer, 0, 0);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
s32 act_reading_sign(struct MarioState *m) {
|
s32 act_reading_sign(struct MarioState *m) {
|
||||||
|
if (m == NULL) { return TRUE; }
|
||||||
|
|
||||||
struct Object *marioObj = m->marioObj;
|
struct Object *marioObj = m->marioObj;
|
||||||
|
|
||||||
|
// If anybody but us is reading a sign,
|
||||||
|
// Don't handle their action state.
|
||||||
if (m->playerIndex != 0) {
|
if (m->playerIndex != 0) {
|
||||||
set_mario_animation(m, MARIO_ANIM_FIRST_PERSON);
|
set_mario_animation(m, MARIO_ANIM_FIRST_PERSON);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
@ -568,7 +561,7 @@ s32 act_reading_sign(struct MarioState *m) {
|
||||||
if (m == &gMarioStates[0]) {
|
if (m == &gMarioStates[0]) {
|
||||||
trigger_cutscene_dialog(1);
|
trigger_cutscene_dialog(1);
|
||||||
}
|
}
|
||||||
//enable_time_stop();
|
enable_time_stop_if_alone();
|
||||||
// reading sign
|
// reading sign
|
||||||
set_mario_animation(m, MARIO_ANIM_FIRST_PERSON);
|
set_mario_animation(m, MARIO_ANIM_FIRST_PERSON);
|
||||||
m->actionState = 1;
|
m->actionState = 1;
|
||||||
|
|
@ -602,11 +595,9 @@ s32 act_reading_sign(struct MarioState *m) {
|
||||||
}
|
}
|
||||||
|
|
||||||
s32 act_debug_free_move(struct MarioState *m) {
|
s32 act_debug_free_move(struct MarioState *m) {
|
||||||
struct Surface *surf;
|
if (m == NULL) { return TRUE; }
|
||||||
f32 floorHeight;
|
|
||||||
Vec3f pos;
|
u32 action = ACT_IDLE;
|
||||||
f32 speed;
|
|
||||||
u32 action;
|
|
||||||
|
|
||||||
#ifndef DEVELOPMENT
|
#ifndef DEVELOPMENT
|
||||||
if (gNetworkType == NT_SERVER && configEnableCheats == 0 && m->action == ACT_DEBUG_FREE_MOVE) {
|
if (gNetworkType == NT_SERVER && configEnableCheats == 0 && m->action == ACT_DEBUG_FREE_MOVE) {
|
||||||
|
|
@ -621,9 +612,10 @@ s32 act_debug_free_move(struct MarioState *m) {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// integer immediates, generates convert instructions for some reason
|
// integer immediates, generates convert instructions for some reason
|
||||||
speed = gPlayer1Controller->buttonDown & B_BUTTON ? 1 : 4;
|
f32 speed = gPlayer1Controller->buttonDown & B_BUTTON ? 1 : 4;
|
||||||
|
|
||||||
set_mario_animation(m, MARIO_ANIM_A_POSE);
|
set_mario_animation(m, MARIO_ANIM_A_POSE);
|
||||||
|
Vec3f pos;
|
||||||
vec3f_copy(pos, m->pos);
|
vec3f_copy(pos, m->pos);
|
||||||
|
|
||||||
if (gPlayer1Controller->buttonDown & A_BUTTON) {
|
if (gPlayer1Controller->buttonDown & A_BUTTON) {
|
||||||
|
|
@ -640,7 +632,8 @@ s32 act_debug_free_move(struct MarioState *m) {
|
||||||
|
|
||||||
resolve_and_return_wall_collisions(pos, 60.0f, 50.0f);
|
resolve_and_return_wall_collisions(pos, 60.0f, 50.0f);
|
||||||
|
|
||||||
floorHeight = find_floor(pos[0], pos[1], pos[2], &surf);
|
struct Surface *surf = NULL;
|
||||||
|
f32 floorHeight = find_floor(pos[0], pos[1], pos[2], &surf);
|
||||||
if (surf != NULL) {
|
if (surf != NULL) {
|
||||||
if (pos[1] < floorHeight) {
|
if (pos[1] < floorHeight) {
|
||||||
pos[1] = floorHeight;
|
pos[1] = floorHeight;
|
||||||
|
|
@ -655,8 +648,6 @@ s32 act_debug_free_move(struct MarioState *m) {
|
||||||
if (gPlayer1Controller->buttonPressed == L_TRIG && m->marioObj->oTimer > 10) {
|
if (gPlayer1Controller->buttonPressed == L_TRIG && m->marioObj->oTimer > 10) {
|
||||||
if (m->pos[1] <= m->waterLevel - 100) {
|
if (m->pos[1] <= m->waterLevel - 100) {
|
||||||
action = ACT_WATER_IDLE;
|
action = ACT_WATER_IDLE;
|
||||||
} else {
|
|
||||||
action = ACT_IDLE;
|
|
||||||
}
|
}
|
||||||
set_mario_action(m, action, 0);
|
set_mario_action(m, action, 0);
|
||||||
}
|
}
|
||||||
|
|
@ -665,11 +656,12 @@ s32 act_debug_free_move(struct MarioState *m) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void general_star_dance_handler(struct MarioState *m, s32 isInWater) {
|
void general_star_dance_handler(struct MarioState *m, s32 isInWater) {
|
||||||
s32 dialogID;
|
if (m == NULL) { return; }
|
||||||
|
|
||||||
if (m->actionState == 0) {
|
if (m->actionState == 0) {
|
||||||
switch (++m->actionTimer) {
|
switch (++m->actionTimer) {
|
||||||
case 1:
|
case 1:
|
||||||
for (int i = 0; i < MAX_PLAYERS; i++) {
|
for (s32 i = 0; i < MAX_PLAYERS; i++) {
|
||||||
struct MarioState* marioState = &gMarioStates[i];
|
struct MarioState* marioState = &gMarioStates[i];
|
||||||
if (!is_player_active(marioState)) { continue; }
|
if (!is_player_active(marioState)) { continue; }
|
||||||
if (marioState->marioObj == NULL) { continue; }
|
if (marioState->marioObj == NULL) { continue; }
|
||||||
|
|
@ -700,7 +692,7 @@ void general_star_dance_handler(struct MarioState *m, s32 isInWater) {
|
||||||
if ((m->actionArg & 1) == 0) {
|
if ((m->actionArg & 1) == 0) {
|
||||||
level_trigger_warp(m, WARP_OP_STAR_EXIT);
|
level_trigger_warp(m, WARP_OP_STAR_EXIT);
|
||||||
} else if (m->playerIndex == 0) {
|
} else if (m->playerIndex == 0) {
|
||||||
//enable_time_stop();
|
enable_time_stop_if_alone();
|
||||||
create_dialog_box_with_response(gLastCompletedStarNum == 7 ? DIALOG_013 : DIALOG_014);
|
create_dialog_box_with_response(gLastCompletedStarNum == 7 ? DIALOG_013 : DIALOG_014);
|
||||||
m->actionState = 1;
|
m->actionState = 1;
|
||||||
} else {
|
} else {
|
||||||
|
|
@ -718,7 +710,7 @@ void general_star_dance_handler(struct MarioState *m, s32 isInWater) {
|
||||||
} else if (m->actionState == 2 && is_anim_at_end(m)) {
|
} else if (m->actionState == 2 && is_anim_at_end(m)) {
|
||||||
disable_time_stop();
|
disable_time_stop();
|
||||||
enable_background_sound();
|
enable_background_sound();
|
||||||
dialogID = get_star_collection_dialog(m);
|
s32 dialogID = get_star_collection_dialog(m);
|
||||||
if (dialogID != 0) {
|
if (dialogID != 0) {
|
||||||
// look up for dialog
|
// look up for dialog
|
||||||
set_mario_action(m, ACT_READING_AUTOMATIC_DIALOG, dialogID);
|
set_mario_action(m, ACT_READING_AUTOMATIC_DIALOG, dialogID);
|
||||||
|
|
@ -735,8 +727,7 @@ s32 act_star_dance(struct MarioState *m) {
|
||||||
if (m == &gMarioStates[0]) {
|
if (m == &gMarioStates[0]) {
|
||||||
m->faceAngle[1] = m->area->camera->yaw;
|
m->faceAngle[1] = m->area->camera->yaw;
|
||||||
}
|
}
|
||||||
set_mario_animation(m, m->actionState == 2 ? MARIO_ANIM_RETURN_FROM_STAR_DANCE
|
set_mario_animation(m, m->actionState == 2 ? MARIO_ANIM_RETURN_FROM_STAR_DANCE : MARIO_ANIM_STAR_DANCE);
|
||||||
: MARIO_ANIM_STAR_DANCE);
|
|
||||||
general_star_dance_handler(m, 0);
|
general_star_dance_handler(m, 0);
|
||||||
if (m->actionState != 2 && m->actionTimer >= 40) {
|
if (m->actionState != 2 && m->actionTimer >= 40) {
|
||||||
m->marioBodyState->handState = MARIO_HAND_PEACE_SIGN;
|
m->marioBodyState->handState = MARIO_HAND_PEACE_SIGN;
|
||||||
|
|
@ -749,8 +740,7 @@ s32 act_star_dance_water(struct MarioState *m) {
|
||||||
if (m == &gMarioStates[0]) {
|
if (m == &gMarioStates[0]) {
|
||||||
m->faceAngle[1] = m->area->camera->yaw;
|
m->faceAngle[1] = m->area->camera->yaw;
|
||||||
}
|
}
|
||||||
set_mario_animation(m, m->actionState == 2 ? MARIO_ANIM_RETURN_FROM_WATER_STAR_DANCE
|
set_mario_animation(m, m->actionState == 2 ? MARIO_ANIM_RETURN_FROM_WATER_STAR_DANCE : MARIO_ANIM_WATER_STAR_DANCE);
|
||||||
: MARIO_ANIM_WATER_STAR_DANCE);
|
|
||||||
vec3f_copy(m->marioObj->header.gfx.pos, m->pos);
|
vec3f_copy(m->marioObj->header.gfx.pos, m->pos);
|
||||||
vec3s_set(m->marioObj->header.gfx.angle, 0, m->faceAngle[1], 0);
|
vec3s_set(m->marioObj->header.gfx.angle, 0, m->faceAngle[1], 0);
|
||||||
general_star_dance_handler(m, 1);
|
general_star_dance_handler(m, 1);
|
||||||
|
|
@ -768,8 +758,7 @@ s32 act_fall_after_star_grab(struct MarioState *m) {
|
||||||
}
|
}
|
||||||
if (perform_air_step(m, 1) == AIR_STEP_LANDED) {
|
if (perform_air_step(m, 1) == AIR_STEP_LANDED) {
|
||||||
play_mario_landing_sound(m, SOUND_ACTION_TERRAIN_LANDING);
|
play_mario_landing_sound(m, SOUND_ACTION_TERRAIN_LANDING);
|
||||||
set_mario_action(m, m->actionArg & 1 ? ACT_STAR_DANCE_NO_EXIT : ACT_STAR_DANCE_EXIT,
|
set_mario_action(m, m->actionArg & 1 ? ACT_STAR_DANCE_NO_EXIT : ACT_STAR_DANCE_EXIT, m->actionArg);
|
||||||
m->actionArg);
|
|
||||||
}
|
}
|
||||||
set_mario_animation(m, MARIO_ANIM_GENERAL_FALL);
|
set_mario_animation(m, MARIO_ANIM_GENERAL_FALL);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
@ -1015,17 +1004,12 @@ s32 act_entering_star_door(struct MarioState *m) {
|
||||||
// set Mario's animation
|
// set Mario's animation
|
||||||
if (m->actionTimer < 15) {
|
if (m->actionTimer < 15) {
|
||||||
set_mario_animation(m, MARIO_ANIM_FIRST_PERSON);
|
set_mario_animation(m, MARIO_ANIM_FIRST_PERSON);
|
||||||
}
|
} else if (m->actionTimer < 35) { // go through door? for 20 frames
|
||||||
|
|
||||||
// go through door? for 20 frames
|
|
||||||
else if (m->actionTimer < 35) {
|
|
||||||
m->pos[0] += m->marioObj->oMarioReadingSignDPosX;
|
m->pos[0] += m->marioObj->oMarioReadingSignDPosX;
|
||||||
m->pos[2] += m->marioObj->oMarioReadingSignDPosZ;
|
m->pos[2] += m->marioObj->oMarioReadingSignDPosZ;
|
||||||
|
|
||||||
set_mario_anim_with_accel(m, MARIO_ANIM_WALKING, 0x00028000);
|
set_mario_anim_with_accel(m, MARIO_ANIM_WALKING, 0x00028000);
|
||||||
}
|
} else {
|
||||||
|
|
||||||
else {
|
|
||||||
if (m->usedObj != NULL) {
|
if (m->usedObj != NULL) {
|
||||||
m->faceAngle[1] = m->usedObj->oMoveAngleYaw;
|
m->faceAngle[1] = m->usedObj->oMoveAngleYaw;
|
||||||
}
|
}
|
||||||
|
|
@ -1093,8 +1077,7 @@ s32 act_warp_door_spawn(struct MarioState *m) {
|
||||||
if (m->usedObj != NULL) {
|
if (m->usedObj != NULL) {
|
||||||
if (m->actionArg & 1) {
|
if (m->actionArg & 1) {
|
||||||
m->usedObj->oInteractStatus = 0x00040000;
|
m->usedObj->oInteractStatus = 0x00040000;
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
m->usedObj->oInteractStatus = 0x00080000;
|
m->usedObj->oInteractStatus = 0x00080000;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -1162,10 +1145,7 @@ s32 act_spawn_spin_airborne(struct MarioState *m) {
|
||||||
if (set_mario_animation(m, MARIO_ANIM_FORWARD_SPINNING) == 0) { // first anim frame
|
if (set_mario_animation(m, MARIO_ANIM_FORWARD_SPINNING) == 0) { // first anim frame
|
||||||
play_sound(SOUND_ACTION_SPIN, m->marioObj->header.gfx.cameraToObject);
|
play_sound(SOUND_ACTION_SPIN, m->marioObj->header.gfx.cameraToObject);
|
||||||
}
|
}
|
||||||
}
|
} else { // under 300 units above floor, enter freefall animation
|
||||||
|
|
||||||
// under 300 units above floor, enter freefall animation
|
|
||||||
else {
|
|
||||||
m->actionState = 1;
|
m->actionState = 1;
|
||||||
set_mario_animation(m, MARIO_ANIM_GENERAL_FALL);
|
set_mario_animation(m, MARIO_ANIM_GENERAL_FALL);
|
||||||
}
|
}
|
||||||
|
|
@ -1225,13 +1205,11 @@ s32 act_exit_land_save_dialog(struct MarioState *m) {
|
||||||
switch (m->actionState) {
|
switch (m->actionState) {
|
||||||
// determine type of exit
|
// determine type of exit
|
||||||
case 0:
|
case 0:
|
||||||
set_mario_animation(m, m->actionArg == 0 ? MARIO_ANIM_GENERAL_LAND
|
set_mario_animation(m, m->actionArg == 0 ? MARIO_ANIM_GENERAL_LAND : MARIO_ANIM_LAND_FROM_SINGLE_JUMP);
|
||||||
: MARIO_ANIM_LAND_FROM_SINGLE_JUMP);
|
|
||||||
// only allow for local player
|
// only allow for local player
|
||||||
if (m == &gMarioStates[0] && is_anim_past_end(m)) {
|
if (m == &gMarioStates[0] && is_anim_past_end(m)) {
|
||||||
if (gLastCompletedCourseNum != COURSE_BITDW
|
if (gLastCompletedCourseNum != COURSE_BITDW && gLastCompletedCourseNum != COURSE_BITFS) {
|
||||||
&& gLastCompletedCourseNum != COURSE_BITFS) {
|
enable_time_stop_if_alone();
|
||||||
//enable_time_stop();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
set_menu_mode(RENDER_COURSE_DONE_SCREEN);
|
set_menu_mode(RENDER_COURSE_DONE_SCREEN);
|
||||||
|
|
@ -1425,12 +1403,9 @@ s32 act_spawn_no_spin_landing(struct MarioState *m) {
|
||||||
}
|
}
|
||||||
|
|
||||||
s32 act_bbh_enter_spin(struct MarioState *m) {
|
s32 act_bbh_enter_spin(struct MarioState *m) {
|
||||||
f32 floorDist;
|
f32 cageDX = 0.0f;
|
||||||
f32 scale;
|
f32 cageDZ = 0.0f;
|
||||||
f32 cageDX = 0;
|
f32 forwardVel = 0.0f;
|
||||||
f32 cageDZ = 0;
|
|
||||||
f32 cageDist;
|
|
||||||
f32 forwardVel;
|
|
||||||
|
|
||||||
if (m->usedObj == NULL) {
|
if (m->usedObj == NULL) {
|
||||||
m->usedObj = cur_obj_nearest_object_with_behavior(bhvBooCage);
|
m->usedObj = cur_obj_nearest_object_with_behavior(bhvBooCage);
|
||||||
|
|
@ -1440,7 +1415,7 @@ s32 act_bbh_enter_spin(struct MarioState *m) {
|
||||||
cageDX = m->usedObj->oPosX - m->pos[0];
|
cageDX = m->usedObj->oPosX - m->pos[0];
|
||||||
cageDZ = m->usedObj->oPosZ - m->pos[2];
|
cageDZ = m->usedObj->oPosZ - m->pos[2];
|
||||||
}
|
}
|
||||||
cageDist = sqrtf(cageDX * cageDX + cageDZ * cageDZ);
|
f32 cageDist = sqrtf(cageDX * cageDX + cageDZ * cageDZ);
|
||||||
|
|
||||||
if (cageDist > 20.0f) {
|
if (cageDist > 20.0f) {
|
||||||
forwardVel = 10.0f;
|
forwardVel = 10.0f;
|
||||||
|
|
@ -1453,7 +1428,7 @@ s32 act_bbh_enter_spin(struct MarioState *m) {
|
||||||
|
|
||||||
switch (m->actionState) {
|
switch (m->actionState) {
|
||||||
case 0:
|
case 0:
|
||||||
floorDist = 512.0f - (m->pos[1] - m->floorHeight);
|
f32 floorDist = 512.0f - (m->pos[1] - m->floorHeight);
|
||||||
m->vel[1] = floorDist > 0 ? sqrtf(4.0f * floorDist + 1.0f) - 1.0f : 2.0f;
|
m->vel[1] = floorDist > 0 ? sqrtf(4.0f * floorDist + 1.0f) - 1.0f : 2.0f;
|
||||||
|
|
||||||
m->actionState = 1;
|
m->actionState = 1;
|
||||||
|
|
@ -1498,7 +1473,7 @@ s32 act_bbh_enter_spin(struct MarioState *m) {
|
||||||
m->squishTimer = 0xFF;
|
m->squishTimer = 0xFF;
|
||||||
if (m->actionTimer >= 11) {
|
if (m->actionTimer >= 11) {
|
||||||
m->actionTimer -= 6;
|
m->actionTimer -= 6;
|
||||||
scale = m->actionTimer / 100.0f;
|
f32 scale = m->actionTimer / 100.0f;
|
||||||
vec3f_set(m->marioObj->header.gfx.scale, scale, scale, scale);
|
vec3f_set(m->marioObj->header.gfx.scale, scale, scale, scale);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
@ -1513,12 +1488,7 @@ s32 act_bbh_enter_spin(struct MarioState *m) {
|
||||||
}
|
}
|
||||||
|
|
||||||
s32 act_bbh_enter_jump(struct MarioState *m) {
|
s32 act_bbh_enter_jump(struct MarioState *m) {
|
||||||
f32 cageDX;
|
play_mario_action_sound(m, m->flags & MARIO_METAL_CAP ? SOUND_ACTION_METAL_JUMP : SOUND_ACTION_TERRAIN_JUMP, 1);
|
||||||
f32 cageDZ;
|
|
||||||
f32 cageDist;
|
|
||||||
|
|
||||||
play_mario_action_sound(
|
|
||||||
m, m->flags & MARIO_METAL_CAP ? SOUND_ACTION_METAL_JUMP : SOUND_ACTION_TERRAIN_JUMP, 1);
|
|
||||||
play_mario_jump_sound(m);
|
play_mario_jump_sound(m);
|
||||||
|
|
||||||
if (m->usedObj == NULL) {
|
if (m->usedObj == NULL) {
|
||||||
|
|
@ -1526,9 +1496,9 @@ s32 act_bbh_enter_jump(struct MarioState *m) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (m->actionState == 0 && m->usedObj != NULL) {
|
if (m->actionState == 0 && m->usedObj != NULL) {
|
||||||
cageDX = m->usedObj->oPosX - m->pos[0];
|
f32 cageDX = m->usedObj->oPosX - m->pos[0];
|
||||||
cageDZ = m->usedObj->oPosZ - m->pos[2];
|
f32 cageDZ = m->usedObj->oPosZ - m->pos[2];
|
||||||
cageDist = sqrtf(cageDX * cageDX + cageDZ * cageDZ);
|
f32 cageDist = sqrtf(cageDX * cageDX + cageDZ * cageDZ);
|
||||||
|
|
||||||
m->vel[1] = 60.0f;
|
m->vel[1] = 60.0f;
|
||||||
m->faceAngle[1] = atan2s(cageDZ, cageDX);
|
m->faceAngle[1] = atan2s(cageDZ, cageDX);
|
||||||
|
|
@ -1550,8 +1520,7 @@ s32 act_bbh_enter_jump(struct MarioState *m) {
|
||||||
|
|
||||||
s32 act_teleport_fade_out(struct MarioState *m) {
|
s32 act_teleport_fade_out(struct MarioState *m) {
|
||||||
play_sound_if_no_flag(m, SOUND_ACTION_TELEPORT, MARIO_ACTION_SOUND_PLAYED);
|
play_sound_if_no_flag(m, SOUND_ACTION_TELEPORT, MARIO_ACTION_SOUND_PLAYED);
|
||||||
set_mario_animation(m, m->prevAction == ACT_CROUCHING ? MARIO_ANIM_CROUCHING
|
set_mario_animation(m, m->prevAction == ACT_CROUCHING ? MARIO_ANIM_CROUCHING : MARIO_ANIM_FIRST_PERSON);
|
||||||
: MARIO_ANIM_FIRST_PERSON);
|
|
||||||
|
|
||||||
if (m->actionTimer == 0) {
|
if (m->actionTimer == 0) {
|
||||||
queue_rumble_data_mario(m, 30, 70);
|
queue_rumble_data_mario(m, 30, 70);
|
||||||
|
|
@ -1637,9 +1606,8 @@ s32 act_shocked(struct MarioState *m) {
|
||||||
}
|
}
|
||||||
|
|
||||||
s32 act_squished(struct MarioState *m) {
|
s32 act_squished(struct MarioState *m) {
|
||||||
|
if (m == NULL) { return TRUE; }
|
||||||
UNUSED s32 pad;
|
|
||||||
f32 squishAmount;
|
|
||||||
f32 spaceUnderCeil;
|
f32 spaceUnderCeil;
|
||||||
s16 surfAngle;
|
s16 surfAngle;
|
||||||
s32 underSteepSurf = FALSE; // seems to be responsible for setting velocity?
|
s32 underSteepSurf = FALSE; // seems to be responsible for setting velocity?
|
||||||
|
|
@ -1665,9 +1633,8 @@ s32 act_squished(struct MarioState *m) {
|
||||||
|
|
||||||
if (spaceUnderCeil >= 10.1f) {
|
if (spaceUnderCeil >= 10.1f) {
|
||||||
// Mario becomes a pancake
|
// Mario becomes a pancake
|
||||||
squishAmount = spaceUnderCeil / 160.0f;
|
f32 squishAmount = spaceUnderCeil / 160.0f;
|
||||||
vec3f_set(m->marioObj->header.gfx.scale, 2.0f - squishAmount, squishAmount,
|
vec3f_set(m->marioObj->header.gfx.scale, 2.0f - squishAmount, squishAmount, 2.0f - squishAmount);
|
||||||
2.0f - squishAmount);
|
|
||||||
} else {
|
} else {
|
||||||
if (!(m->flags & MARIO_METAL_CAP) && m->invincTimer == 0) {
|
if (!(m->flags & MARIO_METAL_CAP) && m->invincTimer == 0) {
|
||||||
// cap on: 3 units; cap off: 4.5 units
|
// cap on: 3 units; cap off: 4.5 units
|
||||||
|
|
@ -1756,7 +1723,7 @@ s32 act_putting_on_cap(struct MarioState *m) {
|
||||||
s32 animFrame = set_mario_animation(m, MARIO_ANIM_PUT_CAP_ON);
|
s32 animFrame = set_mario_animation(m, MARIO_ANIM_PUT_CAP_ON);
|
||||||
|
|
||||||
if (animFrame == 0) {
|
if (animFrame == 0) {
|
||||||
//enable_time_stop();
|
enable_time_stop_if_alone();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (animFrame == 28) {
|
if (animFrame == 28) {
|
||||||
|
|
@ -2058,7 +2025,6 @@ static void jumbo_star_cutscene_falling(struct MarioState *m) {
|
||||||
// jumbo star cutscene: Mario takes off
|
// jumbo star cutscene: Mario takes off
|
||||||
static s32 jumbo_star_cutscene_taking_off(struct MarioState *m) {
|
static s32 jumbo_star_cutscene_taking_off(struct MarioState *m) {
|
||||||
struct Object *marioObj = m->marioObj;
|
struct Object *marioObj = m->marioObj;
|
||||||
s32 animFrame;
|
|
||||||
|
|
||||||
if (m->actionState == 0) {
|
if (m->actionState == 0) {
|
||||||
set_mario_animation(m, MARIO_ANIM_FINAL_BOWSER_RAISE_HAND_SPIN);
|
set_mario_animation(m, MARIO_ANIM_FINAL_BOWSER_RAISE_HAND_SPIN);
|
||||||
|
|
@ -2069,7 +2035,7 @@ static s32 jumbo_star_cutscene_taking_off(struct MarioState *m) {
|
||||||
m->actionState++;
|
m->actionState++;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
animFrame = set_mario_animation(m, MARIO_ANIM_FINAL_BOWSER_WING_CAP_TAKE_OFF);
|
s32 animFrame = set_mario_animation(m, MARIO_ANIM_FINAL_BOWSER_WING_CAP_TAKE_OFF);
|
||||||
if (animFrame == 3 || animFrame == 28 || animFrame == 60) {
|
if (animFrame == 3 || animFrame == 28 || animFrame == 60) {
|
||||||
play_sound_and_spawn_particles(m, SOUND_ACTION_TERRAIN_JUMP, 1);
|
play_sound_and_spawn_particles(m, SOUND_ACTION_TERRAIN_JUMP, 1);
|
||||||
}
|
}
|
||||||
|
|
@ -2112,12 +2078,6 @@ static s32 jumbo_star_cutscene_taking_off(struct MarioState *m) {
|
||||||
// jumbo star cutscene: Mario flying
|
// jumbo star cutscene: Mario flying
|
||||||
static s32 jumbo_star_cutscene_flying(struct MarioState *m) {
|
static s32 jumbo_star_cutscene_flying(struct MarioState *m) {
|
||||||
Vec3f targetPos;
|
Vec3f targetPos;
|
||||||
UNUSED struct Object *marioObj = m->marioObj;
|
|
||||||
f32 targetDX;
|
|
||||||
f32 targetDY;
|
|
||||||
f32 targetDZ;
|
|
||||||
f32 targetHyp;
|
|
||||||
s16 targetAngle;
|
|
||||||
|
|
||||||
switch (m->actionState) {
|
switch (m->actionState) {
|
||||||
case 0:
|
case 0:
|
||||||
|
|
@ -2135,11 +2095,11 @@ static s32 jumbo_star_cutscene_flying(struct MarioState *m) {
|
||||||
float heightScalar = min(m->actionTimer / 30.0f, 1.0f);
|
float heightScalar = min(m->actionTimer / 30.0f, 1.0f);
|
||||||
targetPos[1] -= 100.0f * m->playerIndex * heightScalar;
|
targetPos[1] -= 100.0f * m->playerIndex * heightScalar;
|
||||||
|
|
||||||
targetDX = targetPos[0] - m->pos[0];
|
f32 targetDX = targetPos[0] - m->pos[0];
|
||||||
targetDY = targetPos[1] - m->pos[1];
|
f32 targetDY = targetPos[1] - m->pos[1];
|
||||||
targetDZ = targetPos[2] - m->pos[2];
|
f32 targetDZ = targetPos[2] - m->pos[2];
|
||||||
targetHyp = sqrtf(targetDX * targetDX + targetDZ * targetDZ);
|
f32 targetHyp = sqrtf(targetDX * targetDX + targetDZ * targetDZ);
|
||||||
targetAngle = atan2s(targetDZ, targetDX);
|
s16 targetAngle = atan2s(targetDZ, targetDX);
|
||||||
|
|
||||||
vec3f_copy(m->pos, targetPos);
|
vec3f_copy(m->pos, targetPos);
|
||||||
m->marioObj->header.gfx.angle[0] = -atan2s(targetHyp, targetDY);
|
m->marioObj->header.gfx.angle[0] = -atan2s(targetHyp, targetDY);
|
||||||
|
|
@ -2209,17 +2169,14 @@ void generate_yellow_sparkles(s16 x, s16 y, s16 z, f32 radius) {
|
||||||
static f32 end_obj_set_visual_pos(struct Object *o) {
|
static f32 end_obj_set_visual_pos(struct Object *o) {
|
||||||
struct Surface *surf;
|
struct Surface *surf;
|
||||||
Vec3s sp24;
|
Vec3s sp24;
|
||||||
f32 sp20;
|
|
||||||
f32 sp1C;
|
|
||||||
f32 sp18;
|
|
||||||
|
|
||||||
find_mario_anim_flags_and_translation(o, o->header.gfx.angle[1], sp24);
|
find_mario_anim_flags_and_translation(o, o->header.gfx.angle[1], sp24);
|
||||||
|
|
||||||
sp20 = o->header.gfx.pos[0] + sp24[0];
|
f32 x = o->header.gfx.pos[0] + sp24[0];
|
||||||
sp1C = o->header.gfx.pos[1] + 10.0f;
|
f32 y = o->header.gfx.pos[1] + 10.0f;
|
||||||
sp18 = o->header.gfx.pos[2] + sp24[2];
|
f32 z = o->header.gfx.pos[2] + sp24[2];
|
||||||
|
|
||||||
return find_floor(sp20, sp1C, sp18, &surf);
|
return find_floor(x, y, z, &surf);
|
||||||
}
|
}
|
||||||
|
|
||||||
// make Mario fall and soften wing cap gravity
|
// make Mario fall and soften wing cap gravity
|
||||||
|
|
@ -2826,9 +2783,6 @@ static s32 act_end_peach_cutscene(struct MarioState *m) {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static s32 act_credits_cutscene(struct MarioState *m) {
|
static s32 act_credits_cutscene(struct MarioState *m) {
|
||||||
s32 width;
|
|
||||||
s32 height;
|
|
||||||
|
|
||||||
m->statusForCamera->cameraEvent = CAM_EVENT_START_CREDITS;
|
m->statusForCamera->cameraEvent = CAM_EVENT_START_CREDITS;
|
||||||
// checks if Mario is underwater (JRB, DDD, SA, etc.)
|
// checks if Mario is underwater (JRB, DDD, SA, etc.)
|
||||||
if (m->pos[1] < m->waterLevel - 100) {
|
if (m->pos[1] < m->waterLevel - 100) {
|
||||||
|
|
@ -2853,15 +2807,13 @@ static s32 act_credits_cutscene(struct MarioState *m) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (m->playerIndex == 0) {
|
if (m->playerIndex == 0) {
|
||||||
width = m->actionState * 640 / 100;
|
s32 width = m->actionState * 640 / 100;
|
||||||
height = m->actionState * 480 / 100;
|
s32 height = m->actionState * 480 / 100;
|
||||||
|
|
||||||
sEndCutsceneVp.vp.vscale[0] = 640 - width;
|
sEndCutsceneVp.vp.vscale[0] = 640 - width;
|
||||||
sEndCutsceneVp.vp.vscale[1] = 480 - height;
|
sEndCutsceneVp.vp.vscale[1] = 480 - height;
|
||||||
sEndCutsceneVp.vp.vtrans[0] =
|
sEndCutsceneVp.vp.vtrans[0] = (gCurrCreditsEntry->unk02 & 0x10 ? width : -width) * 56 / 100 + 640;
|
||||||
(gCurrCreditsEntry->unk02 & 0x10 ? width : -width) * 56 / 100 + 640;
|
sEndCutsceneVp.vp.vtrans[1] = (gCurrCreditsEntry->unk02 & 0x20 ? height : -height) * 66 / 100 + 480;
|
||||||
sEndCutsceneVp.vp.vtrans[1] =
|
|
||||||
(gCurrCreditsEntry->unk02 & 0x20 ? height : -height) * 66 / 100 + 480;
|
|
||||||
|
|
||||||
override_viewport_and_clip(&sEndCutsceneVp, 0, 0, 0, 0);
|
override_viewport_and_clip(&sEndCutsceneVp, 0, 0, 0, 0);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -155,7 +155,7 @@ void set_player_colors(u8 paletteIndex, const u8 shirt[4], const u8 pants[4]) {
|
||||||
* 0 = shirt, 1 = pants
|
* 0 = shirt, 1 = pants
|
||||||
* Returns RGB, not RGBA!
|
* Returns RGB, not RGBA!
|
||||||
*/
|
*/
|
||||||
u8 *get_player_color(u8 paletteIndex, const int which) {
|
u8 *get_player_color(u8 paletteIndex, const s32 which) {
|
||||||
// choose the last color in the table for extra players
|
// choose the last color in the table for extra players
|
||||||
if (paletteIndex >= gNumPlayerColors) paletteIndex = gNumPlayerColors - 1;
|
if (paletteIndex >= gNumPlayerColors) paletteIndex = gNumPlayerColors - 1;
|
||||||
if (which == 0)
|
if (which == 0)
|
||||||
|
|
@ -405,7 +405,7 @@ static Gfx *make_gfx_mario_alpha(struct GraphNodeGenerated *node, s16 alpha) {
|
||||||
|
|
||||||
static u8 geo_get_processing_object_index(void) {
|
static u8 geo_get_processing_object_index(void) {
|
||||||
// sloppy way to fix mirror marios
|
// sloppy way to fix mirror marios
|
||||||
for (int i = 0; i < MAX_PLAYERS; i++) {
|
for (s32 i = 0; i < MAX_PLAYERS; i++) {
|
||||||
if ((struct GraphNodeObject*)gCurGraphNodeObject == &gMirrorMario[i]) {
|
if ((struct GraphNodeObject*)gCurGraphNodeObject == &gMirrorMario[i]) {
|
||||||
return i;
|
return i;
|
||||||
}
|
}
|
||||||
|
|
@ -735,7 +735,7 @@ Gfx* geo_switch_mario_hand_grab_pos(s32 callContext, struct GraphNode* b, Mat4*
|
||||||
* a mirror image of the player.
|
* a mirror image of the player.
|
||||||
*/
|
*/
|
||||||
Gfx* geo_render_mirror_mario(s32 callContext, struct GraphNode* node, UNUSED Mat4* c) {
|
Gfx* geo_render_mirror_mario(s32 callContext, struct GraphNode* node, UNUSED Mat4* c) {
|
||||||
for (int i = 0; i < MAX_PLAYERS; i++) {
|
for (s32 i = 0; i < MAX_PLAYERS; i++) {
|
||||||
f32 mirroredX;
|
f32 mirroredX;
|
||||||
struct MarioState* marioState = &gMarioStates[i];
|
struct MarioState* marioState = &gMarioStates[i];
|
||||||
struct Object* mario = marioState->marioObj;
|
struct Object* mario = marioState->marioObj;
|
||||||
|
|
@ -784,7 +784,7 @@ Gfx* geo_mirror_mario_backface_culling(s32 callContext, struct GraphNode* node,
|
||||||
Gfx* gfx = NULL;
|
Gfx* gfx = NULL;
|
||||||
|
|
||||||
u8 isMirrorMario = FALSE;
|
u8 isMirrorMario = FALSE;
|
||||||
for (int i = 0; i < MAX_PLAYERS; i++) {
|
for (s32 i = 0; i < MAX_PLAYERS; i++) {
|
||||||
if (gCurGraphNodeObject == &gMirrorMario[i]) {
|
if (gCurGraphNodeObject == &gMirrorMario[i]) {
|
||||||
isMirrorMario = TRUE;
|
isMirrorMario = TRUE;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -11,7 +11,7 @@ extern struct MarioBodyState gBodyStates[MAX_PLAYERS];
|
||||||
extern const size_t gNumPlayerColors;
|
extern const size_t gNumPlayerColors;
|
||||||
|
|
||||||
void set_player_colors(u8 paletteIndex, const u8 shirt[4], const u8 pants[4]);
|
void set_player_colors(u8 paletteIndex, const u8 shirt[4], const u8 pants[4]);
|
||||||
u8 *get_player_color(u8 paletteIndex, const int which);
|
u8 *get_player_color(u8 paletteIndex, const s32 which);
|
||||||
|
|
||||||
Gfx *geo_draw_mario_head_goddard(s32 callContext, struct GraphNode *node, Mat4 *c);
|
Gfx *geo_draw_mario_head_goddard(s32 callContext, struct GraphNode *node, Mat4 *c);
|
||||||
void bhv_toad_message_loop(void);
|
void bhv_toad_message_loop(void);
|
||||||
|
|
|
||||||
|
|
@ -502,7 +502,7 @@ void obj_move_xyz_using_fvel_and_yaw(struct Object *obj) {
|
||||||
* Checks if a point is within distance from Mario's graphical position. Test is exclusive.
|
* Checks if a point is within distance from Mario's graphical position. Test is exclusive.
|
||||||
*/
|
*/
|
||||||
s8 is_point_within_radius_of_mario(f32 x, f32 y, f32 z, s32 dist) {
|
s8 is_point_within_radius_of_mario(f32 x, f32 y, f32 z, s32 dist) {
|
||||||
for (int i = 0; i < MAX_PLAYERS; i++) {
|
for (s32 i = 0; i < MAX_PLAYERS; i++) {
|
||||||
if (!is_player_active(&gMarioStates[i])) { continue; }
|
if (!is_player_active(&gMarioStates[i])) { continue; }
|
||||||
struct Object* player = gMarioStates[i].marioObj;
|
struct Object* player = gMarioStates[i].marioObj;
|
||||||
f32 mGfxX = player->header.gfx.pos[0];
|
f32 mGfxX = player->header.gfx.pos[0];
|
||||||
|
|
@ -561,7 +561,7 @@ struct MarioState* nearest_mario_state_to_object(struct Object *obj) {
|
||||||
f32 nearestDist = 0;
|
f32 nearestDist = 0;
|
||||||
u8 checkActive = TRUE;
|
u8 checkActive = TRUE;
|
||||||
do {
|
do {
|
||||||
for (int i = 0; i < MAX_PLAYERS; i++) {
|
for (s32 i = 0; i < MAX_PLAYERS; i++) {
|
||||||
if (gMarioStates[i].marioObj == obj) { continue; }
|
if (gMarioStates[i].marioObj == obj) { continue; }
|
||||||
if (checkActive && !is_player_active(&gMarioStates[i])) { continue; }
|
if (checkActive && !is_player_active(&gMarioStates[i])) { continue; }
|
||||||
float dist = dist_between_objects(obj, gMarioStates[i].marioObj);
|
float dist = dist_between_objects(obj, gMarioStates[i].marioObj);
|
||||||
|
|
@ -629,7 +629,7 @@ s8 is_point_close_to_object(struct Object *obj, f32 x, f32 y, f32 z, s32 dist) {
|
||||||
* Sets an object as visible if within a certain distance of Mario's graphical position.
|
* Sets an object as visible if within a certain distance of Mario's graphical position.
|
||||||
*/
|
*/
|
||||||
void set_object_visibility(struct Object *obj, s32 dist) {
|
void set_object_visibility(struct Object *obj, s32 dist) {
|
||||||
int distanceToPlayer = dist_between_objects(obj, gMarioStates[0].marioObj);
|
s32 distanceToPlayer = dist_between_objects(obj, gMarioStates[0].marioObj);
|
||||||
if (distanceToPlayer < dist * draw_distance_scalar()) {
|
if (distanceToPlayer < dist * draw_distance_scalar()) {
|
||||||
obj->header.gfx.node.flags &= ~GRAPH_RENDER_INVISIBLE;
|
obj->header.gfx.node.flags &= ~GRAPH_RENDER_INVISIBLE;
|
||||||
} else {
|
} else {
|
||||||
|
|
@ -785,7 +785,7 @@ s8 current_mario_room_check(s16 room) {
|
||||||
s16 trigger_obj_dialog_when_facing(struct MarioState* m, s32 *inDialog, s16 dialogID, f32 dist, s32 actionArg, u8 (*inContinueDialogFunction)(void)) {
|
s16 trigger_obj_dialog_when_facing(struct MarioState* m, s32 *inDialog, s16 dialogID, f32 dist, s32 actionArg, u8 (*inContinueDialogFunction)(void)) {
|
||||||
s16 dialogueResponse;
|
s16 dialogueResponse;
|
||||||
|
|
||||||
int angleToPlayer = obj_angle_to_object(o, m->marioObj);
|
s32 angleToPlayer = obj_angle_to_object(o, m->marioObj);
|
||||||
|
|
||||||
if ((is_point_within_radius_of_mario(o->oPosX, o->oPosY, o->oPosZ, (s32) dist) == TRUE
|
if ((is_point_within_radius_of_mario(o->oPosX, o->oPosY, o->oPosZ, (s32) dist) == TRUE
|
||||||
&& obj_check_if_facing_toward_angle(o->oFaceAngleYaw, m->marioObj->header.gfx.angle[1] + 0x8000, 0x1000) == TRUE
|
&& obj_check_if_facing_toward_angle(o->oFaceAngleYaw, m->marioObj->header.gfx.angle[1] + 0x8000, 0x1000) == TRUE
|
||||||
|
|
|
||||||
|
|
@ -118,8 +118,8 @@ void obj_set_dist_from_home(f32 distFromHome) {
|
||||||
|
|
||||||
s32 obj_is_near_to_and_facing_mario(struct MarioState* m, f32 maxDist, s16 maxAngleDiff) {
|
s32 obj_is_near_to_and_facing_mario(struct MarioState* m, f32 maxDist, s16 maxAngleDiff) {
|
||||||
struct Object* player = m->marioObj;
|
struct Object* player = m->marioObj;
|
||||||
int distanceToPlayer = dist_between_objects(o, player);
|
s32 distanceToPlayer = dist_between_objects(o, player);
|
||||||
int angleToPlayer = obj_angle_to_object(o, player);
|
s32 angleToPlayer = obj_angle_to_object(o, player);
|
||||||
if (distanceToPlayer < maxDist
|
if (distanceToPlayer < maxDist
|
||||||
&& abs_angle_diff(o->oMoveAngleYaw, angleToPlayer) < maxAngleDiff) {
|
&& abs_angle_diff(o->oMoveAngleYaw, angleToPlayer) < maxAngleDiff) {
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
|
@ -881,7 +881,7 @@ s32 obj_move_for_one_second(s32 endAction) {
|
||||||
* attack Mario (e.g. fly guy shooting fire or lunging), especially when combined
|
* attack Mario (e.g. fly guy shooting fire or lunging), especially when combined
|
||||||
* with partial updates.
|
* with partial updates.
|
||||||
*/
|
*/
|
||||||
void treat_far_home_as_mario(f32 threshold, int* distanceToPlayer, int* angleToPlayer) {
|
void treat_far_home_as_mario(f32 threshold, s32* distanceToPlayer, s32* angleToPlayer) {
|
||||||
f32 dx = o->oHomeX - o->oPosX;
|
f32 dx = o->oHomeX - o->oPosX;
|
||||||
f32 dy = o->oHomeY - o->oPosY;
|
f32 dy = o->oHomeY - o->oPosY;
|
||||||
f32 dz = o->oHomeZ - o->oPosZ;
|
f32 dz = o->oHomeZ - o->oPosZ;
|
||||||
|
|
|
||||||
|
|
@ -9,10 +9,8 @@
|
||||||
|
|
||||||
struct Object *debug_print_obj_collision(struct Object *a) {
|
struct Object *debug_print_obj_collision(struct Object *a) {
|
||||||
struct Object *sp24;
|
struct Object *sp24;
|
||||||
UNUSED s32 unused;
|
|
||||||
s32 i;
|
|
||||||
|
|
||||||
for (i = 0; i < a->numCollidedObjs; i++) {
|
for (s32 i = 0; i < a->numCollidedObjs; i++) {
|
||||||
print_debug_top_down_objectinfo("ON", 0);
|
print_debug_top_down_objectinfo("ON", 0);
|
||||||
sp24 = a->collidedObjs[i];
|
sp24 = a->collidedObjs[i];
|
||||||
if (sp24 != gMarioObject) {
|
if (sp24 != gMarioObject) {
|
||||||
|
|
@ -191,7 +189,7 @@ void check_player_object_collision(void) {
|
||||||
}
|
}
|
||||||
|
|
||||||
extern struct MarioState gMarioStates[];
|
extern struct MarioState gMarioStates[];
|
||||||
for (int i = 1; i < MAX_PLAYERS; i++) {
|
for (s32 i = 1; i < MAX_PLAYERS; i++) {
|
||||||
detect_player_hitbox_overlap(&gMarioStates[0], &gMarioStates[i]);
|
detect_player_hitbox_overlap(&gMarioStates[0], &gMarioStates[i]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -208,7 +208,7 @@ Gfx *geo_switch_area(s32 callContext, struct GraphNode *node) {
|
||||||
|
|
||||||
// display both sides of door
|
// display both sides of door
|
||||||
gDoorCurrentRoom = 0;
|
gDoorCurrentRoom = 0;
|
||||||
for (int i = 0; i < MAX_PLAYERS; i++) {
|
for (s32 i = 0; i < MAX_PLAYERS; i++) {
|
||||||
struct MarioState* m = &gMarioStates[i];
|
struct MarioState* m = &gMarioStates[i];
|
||||||
if (!is_player_active(m)) { continue; }
|
if (!is_player_active(m)) { continue; }
|
||||||
|
|
||||||
|
|
@ -2333,7 +2333,7 @@ s32 cur_obj_wait_then_blink(s32 timeUntilBlinking, s32 numBlinks) {
|
||||||
}
|
}
|
||||||
|
|
||||||
s32 cur_obj_is_mario_ground_pounding_platform(void) {
|
s32 cur_obj_is_mario_ground_pounding_platform(void) {
|
||||||
for (int i = 0; i < MAX_PLAYERS; i++) {
|
for (s32 i = 0; i < MAX_PLAYERS; i++) {
|
||||||
if (!is_player_active(&gMarioStates[i])) { continue; }
|
if (!is_player_active(&gMarioStates[i])) { continue; }
|
||||||
if (gMarioStates[i].marioObj->platform == o) {
|
if (gMarioStates[i].marioObj->platform == o) {
|
||||||
if (gMarioStates[i].action == ACT_GROUND_POUND_LAND) {
|
if (gMarioStates[i].action == ACT_GROUND_POUND_LAND) {
|
||||||
|
|
@ -2355,7 +2355,7 @@ void spawn_mist_particles_with_sound(u32 sp18) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void cur_obj_push_mario_away(f32 radius) {
|
void cur_obj_push_mario_away(f32 radius) {
|
||||||
for (int i = 0; i < MAX_PLAYERS; i++) {
|
for (s32 i = 0; i < MAX_PLAYERS; i++) {
|
||||||
struct Object* player = gMarioStates[i].marioObj;
|
struct Object* player = gMarioStates[i].marioObj;
|
||||||
f32 marioRelX = player->oPosX - o->oPosX;
|
f32 marioRelX = player->oPosX - o->oPosX;
|
||||||
f32 marioRelZ = player->oPosZ - o->oPosZ;
|
f32 marioRelZ = player->oPosZ - o->oPosZ;
|
||||||
|
|
@ -2371,7 +2371,7 @@ void cur_obj_push_mario_away(f32 radius) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void cur_obj_push_mario_away_from_cylinder(f32 radius, f32 extentY) {
|
void cur_obj_push_mario_away_from_cylinder(f32 radius, f32 extentY) {
|
||||||
for (int i = 0; i < MAX_PLAYERS; i++) {
|
for (s32 i = 0; i < MAX_PLAYERS; i++) {
|
||||||
struct Object* player = gMarioStates[i].marioObj;
|
struct Object* player = gMarioStates[i].marioObj;
|
||||||
f32 marioRelY = player->oPosY - o->oPosY;
|
f32 marioRelY = player->oPosY - o->oPosY;
|
||||||
|
|
||||||
|
|
@ -2470,7 +2470,7 @@ s32 cur_obj_is_mario_on_platform(void) {
|
||||||
}
|
}
|
||||||
|
|
||||||
s32 cur_obj_is_any_player_on_platform(void) {
|
s32 cur_obj_is_any_player_on_platform(void) {
|
||||||
for (int i = 0; i < MAX_PLAYERS; i++) {
|
for (s32 i = 0; i < MAX_PLAYERS; i++) {
|
||||||
if (!is_player_active(&gMarioStates[i])) { continue; }
|
if (!is_player_active(&gMarioStates[i])) { continue; }
|
||||||
if (gMarioStates[i].marioObj == NULL) { continue; }
|
if (gMarioStates[i].marioObj == NULL) { continue; }
|
||||||
if (gMarioStates[i].marioObj->platform == o) {
|
if (gMarioStates[i].marioObj->platform == o) {
|
||||||
|
|
@ -2529,7 +2529,7 @@ s32 bit_shift_left(s32 a0) {
|
||||||
}
|
}
|
||||||
|
|
||||||
s32 cur_obj_mario_far_away(void) {
|
s32 cur_obj_mario_far_away(void) {
|
||||||
for (int i = 0; i < MAX_PLAYERS; i++) {
|
for (s32 i = 0; i < MAX_PLAYERS; i++) {
|
||||||
if (!is_player_active(&gMarioStates[i])) { continue; }
|
if (!is_player_active(&gMarioStates[i])) { continue; }
|
||||||
struct Object* player = gMarioStates[i].marioObj;
|
struct Object* player = gMarioStates[i].marioObj;
|
||||||
f32 dx = o->oHomeX - player->oPosX;
|
f32 dx = o->oHomeX - player->oPosX;
|
||||||
|
|
@ -2600,7 +2600,7 @@ void cur_obj_enable_rendering_if_mario_in_room(void) {
|
||||||
|
|
||||||
u8 marioInRoom = FALSE;
|
u8 marioInRoom = FALSE;
|
||||||
|
|
||||||
for (int i = 0; i < MAX_PLAYERS; i++) {
|
for (s32 i = 0; i < MAX_PLAYERS; i++) {
|
||||||
if (gMarioStates[i].currentRoom != 0) {
|
if (gMarioStates[i].currentRoom != 0) {
|
||||||
s16 currentRoom = gMarioStates[i].currentRoom;
|
s16 currentRoom = gMarioStates[i].currentRoom;
|
||||||
if (currentRoom == o->oRoom) {
|
if (currentRoom == o->oRoom) {
|
||||||
|
|
@ -2718,6 +2718,13 @@ void enable_time_stop(void) {
|
||||||
gTimeStopState |= TIME_STOP_ENABLED;
|
gTimeStopState |= TIME_STOP_ENABLED;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void enable_time_stop_if_alone(void) {
|
||||||
|
if (network_player_connected_count() > 1) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
gTimeStopState |= TIME_STOP_ENABLED;
|
||||||
|
}
|
||||||
|
|
||||||
void disable_time_stop(void) {
|
void disable_time_stop(void) {
|
||||||
gTimeStopState &= ~TIME_STOP_ENABLED;
|
gTimeStopState &= ~TIME_STOP_ENABLED;
|
||||||
}
|
}
|
||||||
|
|
@ -2726,6 +2733,13 @@ void set_time_stop_flags(s32 flags) {
|
||||||
gTimeStopState |= flags;
|
gTimeStopState |= flags;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void set_time_stop_flags_if_alone(s32 flags) {
|
||||||
|
if (network_player_connected_count() > 1) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
gTimeStopState |= flags;
|
||||||
|
}
|
||||||
|
|
||||||
void clear_time_stop_flags(s32 flags) {
|
void clear_time_stop_flags(s32 flags) {
|
||||||
gTimeStopState = gTimeStopState & (flags ^ 0xFFFFFFFF);
|
gTimeStopState = gTimeStopState & (flags ^ 0xFFFFFFFF);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -277,8 +277,10 @@ Gfx *geo_offset_klepto_held_object(s32 callContext, struct GraphNode *node, UNUS
|
||||||
s32 geo_offset_klepto_debug(s32 a0, struct GraphNode *a1, UNUSED s32 sp8);
|
s32 geo_offset_klepto_debug(s32 a0, struct GraphNode *a1, UNUSED s32 sp8);
|
||||||
s32 obj_is_hidden(struct Object *obj);
|
s32 obj_is_hidden(struct Object *obj);
|
||||||
void enable_time_stop(void);
|
void enable_time_stop(void);
|
||||||
|
void enable_time_stop_if_alone(void);
|
||||||
void disable_time_stop(void);
|
void disable_time_stop(void);
|
||||||
void set_time_stop_flags(s32 flags);
|
void set_time_stop_flags(s32 flags);
|
||||||
|
void set_time_stop_flags_if_alone(s32 flags);
|
||||||
void clear_time_stop_flags(s32 flags);
|
void clear_time_stop_flags(s32 flags);
|
||||||
s32 cur_obj_can_mario_activate_textbox(struct MarioState* m, f32 radius, f32 height, UNUSED s32 unused);
|
s32 cur_obj_can_mario_activate_textbox(struct MarioState* m, f32 radius, f32 height, UNUSED s32 unused);
|
||||||
s32 cur_obj_can_mario_activate_textbox_2(struct MarioState* m, f32 radius, f32 height);
|
s32 cur_obj_can_mario_activate_textbox_2(struct MarioState* m, f32 radius, f32 height);
|
||||||
|
|
|
||||||
|
|
@ -265,14 +265,14 @@ void spawn_particle(u32 activeParticleFlag, s16 model, const BehaviorScript *beh
|
||||||
void bhv_mario_update(void) {
|
void bhv_mario_update(void) {
|
||||||
// force indices to be well behaved
|
// force indices to be well behaved
|
||||||
// this may cause unintended side effects
|
// this may cause unintended side effects
|
||||||
for (int i = 0; i < MAX_PLAYERS; i++) {
|
for (s32 i = 0; i < MAX_PLAYERS; i++) {
|
||||||
if (gMarioStates[i].marioObj == NULL) { continue; }
|
if (gMarioStates[i].marioObj == NULL) { continue; }
|
||||||
gMarioStates[i].marioObj->oBehParams = i + 1;
|
gMarioStates[i].marioObj->oBehParams = i + 1;
|
||||||
gMarioStates[i].marioObj->globalPlayerIndex = gNetworkPlayers[i].globalIndex;
|
gMarioStates[i].marioObj->globalPlayerIndex = gNetworkPlayers[i].globalIndex;
|
||||||
}
|
}
|
||||||
|
|
||||||
// set mario state to the current player
|
// set mario state to the current player
|
||||||
int stateIndex = (gCurrentObject->oBehParams - 1);
|
s32 stateIndex = (gCurrentObject->oBehParams - 1);
|
||||||
gMarioState = &gMarioStates[stateIndex];
|
gMarioState = &gMarioStates[stateIndex];
|
||||||
|
|
||||||
// sanity check torsoPos, it isn't updated off-screen otherwise
|
// sanity check torsoPos, it isn't updated off-screen otherwise
|
||||||
|
|
@ -578,12 +578,12 @@ void clear_objects(void) {
|
||||||
gTHIWaterDrained = 0;
|
gTHIWaterDrained = 0;
|
||||||
gTimeStopState = 0;
|
gTimeStopState = 0;
|
||||||
gMarioObject = NULL;
|
gMarioObject = NULL;
|
||||||
for (int i = 0; i < MAX_PLAYERS; i++) {
|
for (s32 i = 0; i < MAX_PLAYERS; i++) {
|
||||||
gMarioObjects[i] = NULL;
|
gMarioObjects[i] = NULL;
|
||||||
}
|
}
|
||||||
gMarioCurrentRoom = 0;
|
gMarioCurrentRoom = 0;
|
||||||
|
|
||||||
for (int i = 0; i < MAX_PLAYERS; i++) {
|
for (s32 i = 0; i < MAX_PLAYERS; i++) {
|
||||||
gMarioStates[i].currentRoom = 0;
|
gMarioStates[i].currentRoom = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -20,7 +20,7 @@ struct Object *gMarioPlatform = NULL;
|
||||||
* within 4 units of the floor. Set his referenced platform object accordingly.
|
* within 4 units of the floor. Set his referenced platform object accordingly.
|
||||||
*/
|
*/
|
||||||
void update_mario_platform(void) {
|
void update_mario_platform(void) {
|
||||||
for (int i = 0; i < MAX_PLAYERS; i++) {
|
for (s32 i = 0; i < MAX_PLAYERS; i++) {
|
||||||
struct Surface *floor;
|
struct Surface *floor;
|
||||||
UNUSED u32 unused;
|
UNUSED u32 unused;
|
||||||
f32 marioX;
|
f32 marioX;
|
||||||
|
|
@ -177,7 +177,7 @@ void apply_platform_displacement(u32 playerIndex, struct Object *platform) {
|
||||||
* If Mario's platform is not null, apply platform displacement.
|
* If Mario's platform is not null, apply platform displacement.
|
||||||
*/
|
*/
|
||||||
void apply_mario_platform_displacement(void) {
|
void apply_mario_platform_displacement(void) {
|
||||||
for (int i = 0; i < MAX_PLAYERS; i++) {
|
for (s32 i = 0; i < MAX_PLAYERS; i++) {
|
||||||
struct Object* player = gMarioStates[i].marioObj;
|
struct Object* player = gMarioStates[i].marioObj;
|
||||||
if (player == NULL) { continue; }
|
if (player == NULL) { continue; }
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1083,7 +1083,7 @@ static void geo_process_object(struct Object *node) {
|
||||||
Vec3f scaleInterpolated;
|
Vec3f scaleInterpolated;
|
||||||
if (node->header.gfx.node.flags & GRAPH_RENDER_PLAYER) {
|
if (node->header.gfx.node.flags & GRAPH_RENDER_PLAYER) {
|
||||||
gCurGraphNodeMarioState = NULL;
|
gCurGraphNodeMarioState = NULL;
|
||||||
for (int i = 0; i < MAX_PLAYERS; i++) {
|
for (s32 i = 0; i < MAX_PLAYERS; i++) {
|
||||||
if (gMarioStates[i].marioObj == node) {
|
if (gMarioStates[i].marioObj == node) {
|
||||||
gCurGraphNodeMarioState = &gMarioStates[i];
|
gCurGraphNodeMarioState = &gMarioStates[i];
|
||||||
break;
|
break;
|
||||||
|
|
|
||||||
|
|
@ -73,7 +73,7 @@ static inline void bswap_signature(struct SaveBlockSignature *data) {
|
||||||
* Byteswap all multibyte fields in a MainMenuSaveData.
|
* Byteswap all multibyte fields in a MainMenuSaveData.
|
||||||
*/
|
*/
|
||||||
static inline void bswap_menudata(struct MainMenuSaveData *data) {
|
static inline void bswap_menudata(struct MainMenuSaveData *data) {
|
||||||
for (int i = 0; i < NUM_SAVE_FILES; ++i)
|
for (s32 i = 0; i < NUM_SAVE_FILES; ++i)
|
||||||
data->coinScoreAges[i] = BSWAP32(data->coinScoreAges[i]);
|
data->coinScoreAges[i] = BSWAP32(data->coinScoreAges[i]);
|
||||||
data->soundMode = BSWAP16(data->soundMode);
|
data->soundMode = BSWAP16(data->soundMode);
|
||||||
#ifdef VERSION_EU
|
#ifdef VERSION_EU
|
||||||
|
|
@ -322,10 +322,10 @@ static void restore_save_file_data(s32 fileIndex, s32 srcSlot) {
|
||||||
*/
|
*/
|
||||||
static u8 save_file_need_bswap(const struct SaveBuffer *buf) {
|
static u8 save_file_need_bswap(const struct SaveBuffer *buf) {
|
||||||
// check all signatures just in case
|
// check all signatures just in case
|
||||||
for (int i = 0; i < 2; ++i) {
|
for (s32 i = 0; i < 2; ++i) {
|
||||||
if (buf->menuData[i].signature.magic == BSWAP16(MENU_DATA_MAGIC))
|
if (buf->menuData[i].signature.magic == BSWAP16(MENU_DATA_MAGIC))
|
||||||
return TRUE;
|
return TRUE;
|
||||||
for (int j = 0; j < NUM_SAVE_FILES; ++j) {
|
for (s32 j = 0; j < NUM_SAVE_FILES; ++j) {
|
||||||
if (buf->files[j][i].signature.magic == BSWAP16(SAVE_FILE_MAGIC))
|
if (buf->files[j][i].signature.magic == BSWAP16(SAVE_FILE_MAGIC))
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
@ -339,7 +339,7 @@ static u8 save_file_need_bswap(const struct SaveBuffer *buf) {
|
||||||
static void save_file_bswap(struct SaveBuffer *buf) {
|
static void save_file_bswap(struct SaveBuffer *buf) {
|
||||||
bswap_menudata(buf->menuData + 0);
|
bswap_menudata(buf->menuData + 0);
|
||||||
bswap_menudata(buf->menuData + 1);
|
bswap_menudata(buf->menuData + 1);
|
||||||
for (int i = 0; i < NUM_SAVE_FILES; ++i) {
|
for (s32 i = 0; i < NUM_SAVE_FILES; ++i) {
|
||||||
bswap_savefile(buf->files[i] + 0);
|
bswap_savefile(buf->files[i] + 0);
|
||||||
bswap_savefile(buf->files[i] + 1);
|
bswap_savefile(buf->files[i] + 1);
|
||||||
}
|
}
|
||||||
|
|
@ -407,7 +407,7 @@ BAD_RETURN(s32) save_file_copy(s32 srcFileIndex, s32 destFileIndex) {
|
||||||
|
|
||||||
#ifdef TEXTSAVES
|
#ifdef TEXTSAVES
|
||||||
static void save_file_load_textsaves(void) {
|
static void save_file_load_textsaves(void) {
|
||||||
for (int file = 0; file < NUM_SAVE_FILES; file++) {
|
for (s32 file = 0; file < NUM_SAVE_FILES; file++) {
|
||||||
read_text_save(file);
|
read_text_save(file);
|
||||||
}
|
}
|
||||||
gSaveFileModified = TRUE;
|
gSaveFileModified = TRUE;
|
||||||
|
|
|
||||||
|
|
@ -20,8 +20,8 @@ static Gfx *sScreenTransitionVerticesPos[2];
|
||||||
static Vtx *sScreenTransitionVertices;
|
static Vtx *sScreenTransitionVertices;
|
||||||
|
|
||||||
void reset_screen_transition_timers(void) {
|
void reset_screen_transition_timers(void) {
|
||||||
for (int i = 0; i < 4; i++) { sTransitionColorFadeCount[i] = 0; }
|
for (s32 i = 0; i < 4; i++) { sTransitionColorFadeCount[i] = 0; }
|
||||||
for (int i = 0; i < 2; i++) { sTransitionTextureFadeCount[i] = 0; }
|
for (s32 i = 0; i < 2; i++) { sTransitionTextureFadeCount[i] = 0; }
|
||||||
}
|
}
|
||||||
|
|
||||||
void patch_screen_transition_interpolated(void) {
|
void patch_screen_transition_interpolated(void) {
|
||||||
|
|
|
||||||
|
|
@ -18,7 +18,7 @@ static u8 sConfirmPlayerIndex = 0;
|
||||||
|
|
||||||
static struct NetworkPlayer* chat_get_network_player(char* name) {
|
static struct NetworkPlayer* chat_get_network_player(char* name) {
|
||||||
// check for id
|
// check for id
|
||||||
for (int i = 0; i < MAX_PLAYERS; i++) {
|
for (s32 i = 0; i < MAX_PLAYERS; i++) {
|
||||||
if (!gNetworkPlayers[i].connected) { continue; }
|
if (!gNetworkPlayers[i].connected) { continue; }
|
||||||
char id[16] = { 0 };
|
char id[16] = { 0 };
|
||||||
if (snprintf(id, 16, "%d", i) < 0) {
|
if (snprintf(id, 16, "%d", i) < 0) {
|
||||||
|
|
@ -30,7 +30,7 @@ static struct NetworkPlayer* chat_get_network_player(char* name) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// check for name
|
// check for name
|
||||||
for (int i = 0; i < MAX_PLAYERS; i++) {
|
for (s32 i = 0; i < MAX_PLAYERS; i++) {
|
||||||
if (!gNetworkPlayers[i].connected) { continue; }
|
if (!gNetworkPlayers[i].connected) { continue; }
|
||||||
if (strcmp(gNetworkPlayers[i].name, name) == 0) {
|
if (strcmp(gNetworkPlayers[i].name, name) == 0) {
|
||||||
return &gNetworkPlayers[i];
|
return &gNetworkPlayers[i];
|
||||||
|
|
@ -86,7 +86,7 @@ bool exec_chat_command(char* command) {
|
||||||
char message[600] = { 0 };
|
char message[600] = { 0 };
|
||||||
char line[128] = { 0 };
|
char line[128] = { 0 };
|
||||||
strncat(message, "\\#fff982\\Players:\n", 599);
|
strncat(message, "\\#fff982\\Players:\n", 599);
|
||||||
for (int i = 0; i < MAX_PLAYERS; i++) {
|
for (s32 i = 0; i < MAX_PLAYERS; i++) {
|
||||||
struct NetworkPlayer* np = &gNetworkPlayers[i];
|
struct NetworkPlayer* np = &gNetworkPlayers[i];
|
||||||
if (!np->connected) { continue; }
|
if (!np->connected) { continue; }
|
||||||
if (gNetworkSystem == &gNetworkSystemSocket) {
|
if (gNetworkSystem == &gNetworkSystemSocket) {
|
||||||
|
|
|
||||||
|
|
@ -439,8 +439,8 @@ static CRASH_HANDLER_TYPE crash_handler(EXCEPTION_POINTERS *ExceptionInfo) {
|
||||||
crash_handler_add_info_str(&pText, 315, -4 + (8 * 2), "System", (gNetworkSystem == NULL) ? "null" : gNetworkSystem->name);
|
crash_handler_add_info_str(&pText, 315, -4 + (8 * 2), "System", (gNetworkSystem == NULL) ? "null" : gNetworkSystem->name);
|
||||||
crash_handler_add_info_int(&pText, 315, -4 + (8 * 3), "Players", network_player_connected_count());
|
crash_handler_add_info_int(&pText, 315, -4 + (8 * 3), "Players", network_player_connected_count());
|
||||||
|
|
||||||
int syncObjects = 0;
|
s32 syncObjects = 0;
|
||||||
for (int i = 0; i < MAX_SYNC_OBJECTS; i++) {
|
for (s32 i = 0; i < MAX_SYNC_OBJECTS; i++) {
|
||||||
if (gSyncObjects[i].o != NULL) { syncObjects++; }
|
if (gSyncObjects[i].o != NULL) { syncObjects++; }
|
||||||
}
|
}
|
||||||
crash_handler_add_info_int(&pText, 315, -4 + (8 * 4), "SyncObj", syncObjects);
|
crash_handler_add_info_int(&pText, 315, -4 + (8 * 4), "SyncObj", syncObjects);
|
||||||
|
|
@ -455,9 +455,9 @@ static CRASH_HANDLER_TYPE crash_handler(EXCEPTION_POINTERS *ExceptionInfo) {
|
||||||
// Mods
|
// Mods
|
||||||
crash_handler_set_text(245, 64, 0xFF, 0xFF, 0xFF, "%s", "Mods:");
|
crash_handler_set_text(245, 64, 0xFF, 0xFF, 0xFF, "%s", "Mods:");
|
||||||
{
|
{
|
||||||
int x = 245;
|
s32 x = 245;
|
||||||
int y = 72;
|
s32 y = 72;
|
||||||
for (int i = 0; i < gActiveMods.entryCount; i++) {
|
for (s32 i = 0; i < gActiveMods.entryCount; i++) {
|
||||||
struct Mod* mod = gActiveMods.entries[i];
|
struct Mod* mod = gActiveMods.entries[i];
|
||||||
u8 g = (gPcDebug.lastModRun == mod) ? 0 : 0xFF;
|
u8 g = (gPcDebug.lastModRun == mod) ? 0 : 0xFF;
|
||||||
crash_handler_set_text(x, y, 0xFF, g, 200, "%.21s", mod->name);
|
crash_handler_set_text(x, y, 0xFF, g, 200, "%.21s", mod->name);
|
||||||
|
|
@ -468,10 +468,10 @@ static CRASH_HANDLER_TYPE crash_handler(EXCEPTION_POINTERS *ExceptionInfo) {
|
||||||
// Packets
|
// Packets
|
||||||
crash_handler_set_text(335, 64, 0xFF, 0xFF, 0xFF, "%s", "Packets:");
|
crash_handler_set_text(335, 64, 0xFF, 0xFF, 0xFF, "%s", "Packets:");
|
||||||
{
|
{
|
||||||
int x = 335;
|
s32 x = 335;
|
||||||
int y = 72;
|
s32 y = 72;
|
||||||
u8 index = gDebugPacketOnBuffer;
|
u8 index = gDebugPacketOnBuffer;
|
||||||
for (int i = 0; i < 128; i++) {
|
for (s32 i = 0; i < 128; i++) {
|
||||||
u8 brightness = (gDebugPacketIdBuffer[index] * 5) % 200;
|
u8 brightness = (gDebugPacketIdBuffer[index] * 5) % 200;
|
||||||
if (gDebugPacketSentBuffer[index]) {
|
if (gDebugPacketSentBuffer[index]) {
|
||||||
crash_handler_set_text(x, y, 0xFF, 0xFF, brightness, "%02X", gDebugPacketIdBuffer[index]);
|
crash_handler_set_text(x, y, 0xFF, 0xFF, brightness, "%02X", gDebugPacketIdBuffer[index]);
|
||||||
|
|
|
||||||
|
|
@ -30,7 +30,7 @@ bool fs_dirtree_init(fs_dirtree_t *tree, const size_t entry_len) {
|
||||||
void fs_dirtree_free(fs_dirtree_t *tree) {
|
void fs_dirtree_free(fs_dirtree_t *tree) {
|
||||||
if (!tree) return;
|
if (!tree) return;
|
||||||
if (tree->root) free(tree->root);
|
if (tree->root) free(tree->root);
|
||||||
for (int i = 0; i < FS_NUMBUCKETS; ++i) {
|
for (int32_t i = 0; i < FS_NUMBUCKETS; ++i) {
|
||||||
fs_dirtree_entry_t *ent, *next;
|
fs_dirtree_entry_t *ent, *next;
|
||||||
for (ent = tree->buckets[i]; ent; ent = next) {
|
for (ent = tree->buckets[i]; ent; ent = next) {
|
||||||
next = ent->next_hash;
|
next = ent->next_hash;
|
||||||
|
|
|
||||||
|
|
@ -73,7 +73,7 @@ static void scan_path_dir(const char *ropath, const char *dir) {
|
||||||
fs_pathlist_t plist = fs_sys_enumerate(dirpath, false);
|
fs_pathlist_t plist = fs_sys_enumerate(dirpath, false);
|
||||||
if (plist.paths) {
|
if (plist.paths) {
|
||||||
qsort(plist.paths, plist.numpaths, sizeof(char *), mount_cmp);
|
qsort(plist.paths, plist.numpaths, sizeof(char *), mount_cmp);
|
||||||
for (int i = 0; i < plist.numpaths; ++i)
|
for (int32_t i = 0; i < plist.numpaths; ++i)
|
||||||
fs_mount(plist.paths[i]);
|
fs_mount(plist.paths[i]);
|
||||||
fs_pathlist_free(&plist);
|
fs_pathlist_free(&plist);
|
||||||
}
|
}
|
||||||
|
|
@ -121,7 +121,7 @@ bool fs_mount(const char *realpath) {
|
||||||
void *pack = NULL;
|
void *pack = NULL;
|
||||||
fs_packtype_t *packer = NULL;
|
fs_packtype_t *packer = NULL;
|
||||||
bool tried = false;
|
bool tried = false;
|
||||||
for (unsigned int i = 0; i < sizeof(fs_packers) / sizeof(fs_packers[0]); ++i) {
|
for (uint32_t i = 0; i < sizeof(fs_packers) / sizeof(fs_packers[0]); ++i) {
|
||||||
if (ext && sys_strcasecmp(ext, fs_packers[i]->extension))
|
if (ext && sys_strcasecmp(ext, fs_packers[i]->extension))
|
||||||
continue;
|
continue;
|
||||||
tried = true;
|
tried = true;
|
||||||
|
|
@ -301,7 +301,7 @@ fs_pathlist_t fs_enumerate(const char *base, const bool recur) {
|
||||||
|
|
||||||
void fs_pathlist_free(fs_pathlist_t *pathlist) {
|
void fs_pathlist_free(fs_pathlist_t *pathlist) {
|
||||||
if (!pathlist || !pathlist->paths) return;
|
if (!pathlist || !pathlist->paths) return;
|
||||||
for (int i = 0; i < pathlist->numpaths; ++i)
|
for (int32_t i = 0; i < pathlist->numpaths; ++i)
|
||||||
free(pathlist->paths[i]);
|
free(pathlist->paths[i]);
|
||||||
free(pathlist->paths);
|
free(pathlist->paths);
|
||||||
pathlist->paths = NULL;
|
pathlist->paths = NULL;
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
#include "gfx_cc.h"
|
#include "gfx_cc.h"
|
||||||
|
|
||||||
void gfx_cc_get_features(uint32_t shader_id, struct CCFeatures *cc_features) {
|
void gfx_cc_get_features(uint32_t shader_id, struct CCFeatures *cc_features) {
|
||||||
for (int i = 0; i < 4; i++) {
|
for (int32_t i = 0; i < 4; i++) {
|
||||||
cc_features->c[0][i] = (shader_id >> (i * 3)) & 7;
|
cc_features->c[0][i] = (shader_id >> (i * 3)) & 7;
|
||||||
cc_features->c[1][i] = (shader_id >> (12 + i * 3)) & 7;
|
cc_features->c[1][i] = (shader_id >> (12 + i * 3)) & 7;
|
||||||
}
|
}
|
||||||
|
|
@ -15,8 +15,8 @@ void gfx_cc_get_features(uint32_t shader_id, struct CCFeatures *cc_features) {
|
||||||
cc_features->used_textures[1] = false;
|
cc_features->used_textures[1] = false;
|
||||||
cc_features->num_inputs = 0;
|
cc_features->num_inputs = 0;
|
||||||
|
|
||||||
for (int i = 0; i < 2; i++) {
|
for (int32_t i = 0; i < 2; i++) {
|
||||||
for (int j = 0; j < 4; j++) {
|
for (int32_t j = 0; j < 4; j++) {
|
||||||
if (cc_features->c[i][j] >= SHADER_INPUT_1 && cc_features->c[i][j] <= SHADER_INPUT_4) {
|
if (cc_features->c[i][j] >= SHADER_INPUT_1 && cc_features->c[i][j] <= SHADER_INPUT_4) {
|
||||||
if (cc_features->c[i][j] > cc_features->num_inputs) {
|
if (cc_features->c[i][j] > cc_features->num_inputs) {
|
||||||
cc_features->num_inputs = cc_features->c[i][j];
|
cc_features->num_inputs = cc_features->c[i][j];
|
||||||
|
|
|
||||||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Reference in a new issue