world kooper cleanup (#963)

* kooper cleanup

* second pass

---------

Co-authored-by: HailSanta <Hail2Santa@gmail.com>
This commit is contained in:
HailSanta 2023-03-03 22:20:43 -05:00 committed by GitHub
parent 209457a32a
commit 288bb8511f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
36 changed files with 775 additions and 719 deletions

View File

@ -1514,7 +1514,7 @@ typedef struct ItemEntityPhysicsData {
/* 0x10 */ f32 velx; /* 0x10 */ f32 velx;
/* 0x14 */ f32 velz; /* 0x14 */ f32 velz;
/* 0x18 */ f32 moveAngle; /* 0x18 */ f32 moveAngle;
/* 0x1C */ s32 unk_1C; /* 0x1C */ s32 timeLeft;
/* 0x20 */ s32 unk_20; /* 0x20 */ s32 unk_20;
} ItemEntityPhysicsData; // size = 0x24 } ItemEntityPhysicsData; // size = 0x24

View File

@ -71,7 +71,7 @@
#define sfx_play_sound_with_params dead_sfx_play_sound_with_params #define sfx_play_sound_with_params dead_sfx_play_sound_with_params
#define sfx_get_spatialized_sound_params dead_sfx_get_spatialized_sound_params #define sfx_get_spatialized_sound_params dead_sfx_get_spatialized_sound_params
#define npc_test_move_simple_without_slipping dead_npc_test_move_simple_without_slipping #define npc_test_move_simple_without_slipping dead_npc_test_move_simple_without_slipping
#define func_8003D660 dead_func_8003D660 #define spawn_surface_effects dead_spawn_surface_effects
#define get_item_entity dead_get_item_entity #define get_item_entity dead_get_item_entity
#define gOverrideFlags dead_gOverrideFlags #define gOverrideFlags dead_gOverrideFlags
#define set_message_msg dead_set_message_msg #define set_message_msg dead_set_message_msg

View File

@ -3245,7 +3245,7 @@ enum ItemEntityFlags {
ITEM_ENTITY_FLAG_10 = 0x00000010, ITEM_ENTITY_FLAG_10 = 0x00000010,
ITEM_ENTITY_FLAG_HIDDEN = 0x00000040, // do not render; player cant pickup ITEM_ENTITY_FLAG_HIDDEN = 0x00000040, // do not render; player cant pickup
ITEM_ENTITY_FLAG_80 = 0x00000080, ITEM_ENTITY_FLAG_80 = 0x00000080,
ITEM_ENTITY_FLAG_100 = 0x00000100, ITEM_ENTITY_FLAG_AUTO_COLLECT = 0x00000100,
ITEM_ENTITY_FLAG_NEVER_VANISH = 0x00000200, ITEM_ENTITY_FLAG_NEVER_VANISH = 0x00000200,
ITEM_ENTITY_FLAG_400 = 0x00000400, ITEM_ENTITY_FLAG_400 = 0x00000400,
ITEM_ENTITY_FLAG_800 = 0x00000800, ITEM_ENTITY_FLAG_800 = 0x00000800,
@ -3258,7 +3258,7 @@ enum ItemEntityFlags {
ITEM_ENTITY_FLAG_40000 = 0x00040000, ITEM_ENTITY_FLAG_40000 = 0x00040000,
ITEM_ENTITY_FLAG_TRANSPARENT = 0x00080000, ITEM_ENTITY_FLAG_TRANSPARENT = 0x00080000,
ITEM_ENTITY_FLAG_100000 = 0x00100000, ITEM_ENTITY_FLAG_100000 = 0x00100000,
ITEM_ENTITY_FLAG_200000 = 0x00200000, ITEM_ENTITY_FLAG_CANT_COLLECT = 0x00200000,
ITEM_ENTITY_FLAG_400000 = 0x00400000, ITEM_ENTITY_FLAG_400000 = 0x00400000,
ITEM_ENTITY_FLAG_800000 = 0x00800000, ITEM_ENTITY_FLAG_800000 = 0x00800000,
ITEM_ENTITY_FLAG_1000000 = 0x01000000, ITEM_ENTITY_FLAG_1000000 = 0x01000000,
@ -3415,8 +3415,8 @@ enum EventSupressFlags {
enum PartnerActions { enum PartnerActions {
PARTNER_ACTION_NONE = 0, // generic state PARTNER_ACTION_NONE = 0, // generic state
PARTNER_ACTION_USE = 1, // generic state PARTNER_ACTION_USE = 1, // generic state
PARTNER_ACTION_KOOPER_1 = 1, PARTNER_ACTION_KOOPER_GATHER = 1,
PARTNER_ACTION_KOOPER_2 = 2, PARTNER_ACTION_KOOPER_TOSS = 2,
PARTNER_ACTION_BOMBETTE_1 = 1, PARTNER_ACTION_BOMBETTE_1 = 1,
PARTNER_ACTION_BOMBETTE_2 = 2, PARTNER_ACTION_BOMBETTE_2 = 2,
PARTNER_ACTION_BOMBETTE_3 = 3, PARTNER_ACTION_BOMBETTE_3 = 3,
@ -3491,7 +3491,7 @@ enum NpcFlags {
NPC_FLAG_GRAVITY = 0x00000200, // Enables gravity. Does nothing if NPC_FLAG_JUMPING is set. NPC_FLAG_GRAVITY = 0x00000200, // Enables gravity. Does nothing if NPC_FLAG_JUMPING is set.
NPC_FLAG_DONT_UPDATE_SHADOW_Y = 0x00000400, // When shadow raycasting is off, only X and Z update as NPC moves NPC_FLAG_DONT_UPDATE_SHADOW_Y = 0x00000400, // When shadow raycasting is off, only X and Z update as NPC moves
NPC_FLAG_JUMPING = 0x00000800, NPC_FLAG_JUMPING = 0x00000800,
NPC_FLAG_FALLING = 0x00001000, NPC_FLAG_GROUNDED = 0x00001000, // Touching the ground
NPC_FLAG_COLLDING_WITH_WORLD = 0x00002000, // Colliding with world in front or to the sides of the NPC NPC_FLAG_COLLDING_WITH_WORLD = 0x00002000, // Colliding with world in front or to the sides of the NPC
NPC_FLAG_COLLDING_FORWARD_WITH_WORLD = 0x00004000, // Colliding with world directly in front of NPC NPC_FLAG_COLLDING_FORWARD_WITH_WORLD = 0x00004000, // Colliding with world directly in front of NPC
NPC_FLAG_IGNORE_ENTITY_COLLISION = 0x00008000, NPC_FLAG_IGNORE_ENTITY_COLLISION = 0x00008000,
@ -5248,6 +5248,12 @@ enum SurfaceType {
*/ */
}; };
typedef enum SurfaceInteractMode {
SURFACE_INTERACT_WALK = 0,
SURFACE_INTERACT_RUN = 1,
SURFACE_INTERACT_LAND = 2,
} SurfaceInteractMode;
//TODO -- temporarily combined with SurfaceType for map data dumper //TODO -- temporarily combined with SurfaceType for map data dumper
enum ColliderFlags { enum ColliderFlags {
COLLIDER_FLAGS_UPPER_MASK = 0x7FFFFE00, // map data dumper needs this to be first COLLIDER_FLAGS_UPPER_MASK = 0x7FFFFE00, // map data dumper needs this to be first

View File

@ -461,9 +461,9 @@ void npc_do_other_npc_collision(Npc* npc);
/// @returns TRUE if a collision occurred /// @returns TRUE if a collision occurred
s32 npc_do_player_collision(Npc* npc); s32 npc_do_player_collision(Npc* npc);
void npc_do_gravity(Npc* npc); void npc_try_apply_gravity(Npc* npc);
s32 func_800397E8(Npc* npc, f32 velocity); s32 npc_try_snap_to_ground(Npc* npc, f32 velocity);
/// Updates all NPCs. /// Updates all NPCs.
void update_npcs(void); void update_npcs(void);
@ -528,7 +528,7 @@ void npc_remove_decoration(Npc* npc, s32 idx);
s32 npc_update_decorations(Npc* npc); s32 npc_update_decorations(Npc* npc);
void npc__remove_decoration(Npc* npc, s32 idx); void npc_remove_decoration_impl(Npc* npc, s32 idx);
void npc_reset_current_decoration(Npc* npc, s32 idx); void npc_reset_current_decoration(Npc* npc, s32 idx);
@ -596,19 +596,19 @@ void func_8003D3BC(Npc* npc);
void func_8003D624(Npc* npc, s32 arg1, s32 arg2, s32 arg3, s32 arg4, s32 arg5, s32 arg6); void func_8003D624(Npc* npc, s32 arg1, s32 arg2, s32 arg3, s32 arg4, s32 arg5, s32 arg6);
void func_8003D660(Npc* npc, s32); void spawn_surface_effects(Npc* npc, SurfaceInteractMode mode);
void func_8003D788(Npc* npc, s32); void spawn_default_surface_effects(Npc* npc, SurfaceInteractMode mode);
void func_8003DA38(Npc* npc, s32); void spawn_flower_surface_effects(Npc* npc, SurfaceInteractMode mode);
void func_8003DC38(Npc* npc, s32); void spawn_cloud_surface_effects(Npc* npc, SurfaceInteractMode mode);
void func_8003DFA0(Npc* npc, s32); void spawn_snow_surface_effects(Npc* npc, SurfaceInteractMode mode);
void func_8003E0D4(Npc* npc, s32); void spawn_hedge_surface_effects(Npc* npc, SurfaceInteractMode mode);
void func_8003E1D0(Npc* npc, s32); void spawn_water_surface_effects(Npc* npc, SurfaceInteractMode mode);
/// Duplicate of set_defeated(). /// Duplicate of set_defeated().
void COPY_set_defeated(s32 mapID, s32 encounterID); void COPY_set_defeated(s32 mapID, s32 encounterID);

View File

@ -815,7 +815,7 @@ void basic_ai_chase(Evt* script, MobileAISettings* aiSettings, EnemyDetectVolume
} }
} }
func_8003D660(npc, 1); spawn_surface_effects(npc, SURFACE_INTERACT_RUN);
npc_move_heading(npc, npc->moveSpeed, npc->yaw); npc_move_heading(npc, npc->moveSpeed, npc->yaw);
if (npc->moveSpeed > 8.0 && !(gGameStatusPtr->frameCounter % 5)) { if (npc->moveSpeed > 8.0 && !(gGameStatusPtr->frameCounter % 5)) {

View File

@ -158,7 +158,7 @@ ApiStatus func_8005DD54(Evt* script, s32 isInitialCall) {
} }
ApiStatus func_8005DDF0(Evt* script, s32 isInitialCall) { ApiStatus func_8005DDF0(Evt* script, s32 isInitialCall) {
if (~gCurrentEncounter.unk_08) { if (gCurrentEncounter.unk_08 != -1) {
return ApiStatus_DONE1; return ApiStatus_DONE1;
} else { } else {
return ApiStatus_BLOCK; return ApiStatus_BLOCK;

View File

@ -130,7 +130,7 @@ void npc_follow_npc(Npc* npc) {
} }
npc->currentAnim = followData->anims->run; npc->currentAnim = followData->anims->run;
if (!(npc->flags & NPC_FLAG_FALLING)) { if (!(npc->flags & NPC_FLAG_GROUNDED)) {
npc->currentAnim = followData->anims->fall; npc->currentAnim = followData->anims->fall;
} }
@ -177,7 +177,7 @@ void npc_follow_npc(Npc* npc) {
historyPoint = &followData->moveHistory[followData->targetPointIdx]; historyPoint = &followData->moveHistory[followData->targetPointIdx];
targetX = historyPoint->pos.x; targetX = historyPoint->pos.x;
targetZ = historyPoint->pos.z; targetZ = historyPoint->pos.z;
if (npc->flags & NPC_FLAG_FALLING) { if (npc->flags & NPC_FLAG_GROUNDED) {
if (historyPoint->isAirborne) { if (historyPoint->isAirborne) {
followData->followState = NPC_FOLLOW_STATE_JUMP; followData->followState = NPC_FOLLOW_STATE_JUMP;
break; break;
@ -185,12 +185,12 @@ void npc_follow_npc(Npc* npc) {
} }
} }
if (!(npc->flags & NPC_FLAG_FALLING)) { if (!(npc->flags & NPC_FLAG_GROUNDED)) {
npc->moveSpeed *= 0.5f; npc->moveSpeed *= 0.5f;
} }
npc->yaw = yaw; npc->yaw = yaw;
npc_move_heading(npc, npc->moveSpeed, yaw); npc_move_heading(npc, npc->moveSpeed, yaw);
if ((npc->flags & NPC_FLAG_COLLDING_FORWARD_WITH_WORLD) && (npc->flags & NPC_FLAG_FALLING)) { if ((npc->flags & NPC_FLAG_COLLDING_FORWARD_WITH_WORLD) && (npc->flags & NPC_FLAG_GROUNDED)) {
followData->followState = NPC_FOLLOW_STATE_JUMP; followData->followState = NPC_FOLLOW_STATE_JUMP;
} }
break; break;

View File

@ -1797,8 +1797,8 @@ s32 test_item_player_collision(ItemEntity* item) {
actionState = playerStatus->actionState; actionState = playerStatus->actionState;
if (item->flags & ITEM_ENTITY_FLAG_100) { if (item->flags & ITEM_ENTITY_FLAG_AUTO_COLLECT) {
item->flags &= ~ITEM_ENTITY_FLAG_100; item->flags &= ~ITEM_ENTITY_FLAG_AUTO_COLLECT;
return TRUE; return TRUE;
} }
@ -1810,7 +1810,7 @@ s32 test_item_player_collision(ItemEntity* item) {
return FALSE; return FALSE;
} }
if (item->flags & ITEM_ENTITY_FLAG_200000) { if (item->flags & ITEM_ENTITY_FLAG_CANT_COLLECT) {
return FALSE; return FALSE;
} }
@ -1949,7 +1949,7 @@ s32 test_item_entity_position(f32 x, f32 y, f32 z, f32 dist) {
continue; continue;
} }
if (item->flags & ITEM_ENTITY_FLAG_200000) { if (item->flags & ITEM_ENTITY_FLAG_CANT_COLLECT) {
continue; continue;
} }
@ -1967,7 +1967,7 @@ void set_item_entity_flags(s32 index, s32 flags) {
ItemEntity* itemEntity = gCurrentItemEntities[index]; ItemEntity* itemEntity = gCurrentItemEntities[index];
itemEntity->flags |= flags; itemEntity->flags |= flags;
if (itemEntity->flags & ITEM_ENTITY_FLAG_200000) { if (itemEntity->flags & ITEM_ENTITY_FLAG_CANT_COLLECT) {
D_801565A8 = 1; D_801565A8 = 1;
} }
} }
@ -1978,10 +1978,10 @@ void clear_item_entity_flags(s32 index, s32 flags) {
itemEntity->flags &= ~flags; itemEntity->flags &= ~flags;
} }
void func_801341B0(s32 index) { void auto_collect_item_entity(s32 index) {
ItemEntity* itemEntity = gCurrentItemEntities[index]; ItemEntity* itemEntity = gCurrentItemEntities[index];
gOverrideFlags |= GLOBAL_OVERRIDES_40; gOverrideFlags |= GLOBAL_OVERRIDES_40;
itemEntity->flags |= ITEM_ENTITY_FLAG_100; itemEntity->flags |= ITEM_ENTITY_FLAG_AUTO_COLLECT;
} }
/// @returns TRUE when "you got X" popup is on-screen /// @returns TRUE when "you got X" popup is on-screen
@ -2144,22 +2144,22 @@ void update_item_entity_collectable(ItemEntity* item) {
} }
if (item->spawnType != ITEM_SPAWN_MODE_TOSS_FADE1) { if (item->spawnType != ITEM_SPAWN_MODE_TOSS_FADE1) {
physData->unk_1C = 180; physData->timeLeft = 180;
physData->unk_20 = 0; physData->unk_20 = FALSE;
} else { } else {
if (!(item->flags & ITEM_ENTITY_FLAG_400000)) { if (!(item->flags & ITEM_ENTITY_FLAG_400000)) {
physData->unk_1C = 0x11; physData->timeLeft = 17;
} else { } else {
physData->unk_1C = 0x14; physData->timeLeft = 20;
} }
physData->unk_20 = 0; physData->unk_20 = FALSE;
physData->verticalVelocity = 15.0f; physData->verticalVelocity = 15.0f;
physData->gravity = 1.6f; physData->gravity = 1.6f;
} }
if (item->spawnType == ITEM_SPAWN_MODE_ITEM_BLOCK_SPAWN_ALWAYS) { if (item->spawnType == ITEM_SPAWN_MODE_ITEM_BLOCK_SPAWN_ALWAYS) {
physData->unk_1C = 60; physData->timeLeft = 60;
physData->unk_20 = 0; physData->unk_20 = FALSE;
physData->velx = 0.0f; physData->velx = 0.0f;
physData->velz = 0.0f; physData->velz = 0.0f;
} }
@ -2168,14 +2168,14 @@ void update_item_entity_collectable(ItemEntity* item) {
physData->verticalVelocity = 0.0f; physData->verticalVelocity = 0.0f;
physData->velx = 0.0f; physData->velx = 0.0f;
physData->velz = 0.0f; physData->velz = 0.0f;
physData->unk_20 = 1; physData->unk_20 = TRUE;
} }
if (item->spawnType == ITEM_SPAWN_MODE_FIXED_SPAWN_ALWAYS) { if (item->spawnType == ITEM_SPAWN_MODE_FIXED_SPAWN_ALWAYS) {
physData->verticalVelocity = 0.0f; physData->verticalVelocity = 0.0f;
physData->velx = 0.0f; physData->velx = 0.0f;
physData->velz = 0.0f; physData->velz = 0.0f;
physData->unk_20 = 1; physData->unk_20 = TRUE;
} }
if (item->flags & ITEM_ENTITY_FLAG_800) { if (item->flags & ITEM_ENTITY_FLAG_800) {
@ -2185,29 +2185,28 @@ void update_item_entity_collectable(ItemEntity* item) {
break; break;
case 1: case 1:
physData = item->physicsData; physData = item->physicsData;
if (item->spawnType != ITEM_SPAWN_MODE_ITEM_BLOCK_SPAWN_ALWAYS && if (item->spawnType != ITEM_SPAWN_MODE_ITEM_BLOCK_SPAWN_ALWAYS
item->spawnType != ITEM_SPAWN_MODE_TOSS_FADE1 && && item->spawnType != ITEM_SPAWN_MODE_TOSS_FADE1
physData->unk_20 != 0 && && physData->unk_20
test_item_player_collision(item)) && test_item_player_collision(item)
{ ) {
item->state = 3; item->state = 3;
break; break;
} }
if (!(item->flags & ITEM_ENTITY_FLAG_NEVER_VANISH)) { if (!(item->flags & ITEM_ENTITY_FLAG_NEVER_VANISH)
if (!(gOverrideFlags & (GLOBAL_OVERRIDES_200 | GLOBAL_OVERRIDES_DISABLE_BATTLES))) { && !(gOverrideFlags & (GLOBAL_OVERRIDES_200 | GLOBAL_OVERRIDES_DISABLE_BATTLES))
if (!(item->flags & ITEM_ENTITY_FLAG_200000)) { && !(item->flags & ITEM_ENTITY_FLAG_CANT_COLLECT)
physData->unk_1C--; ) {
if (physData->unk_1C < 0) { physData->timeLeft--;
if (physData->timeLeft < 0) {
item->state = 2; item->state = 2;
break; break;
} }
} }
}
}
if (!(item->flags & ITEM_ENTITY_FLAG_FIXED)) { if (!(item->flags & ITEM_ENTITY_FLAG_FIXED)) {
if (!(item->flags & ITEM_ENTITY_FLAG_200000)) { if (!(item->flags & ITEM_ENTITY_FLAG_CANT_COLLECT)) {
physData->verticalVelocity -= physData->gravity; physData->verticalVelocity -= physData->gravity;
if (physData->verticalVelocity < -16.0) { if (physData->verticalVelocity < -16.0) {
physData->verticalVelocity = -16.0f; physData->verticalVelocity = -16.0f;
@ -2236,7 +2235,7 @@ void update_item_entity_collectable(ItemEntity* item) {
outZ = item->position.z; outZ = item->position.z;
outDepth = temp + physData->verticalVelocity; outDepth = temp + physData->verticalVelocity;
if (physData->unk_20 == 0) { if (!physData->unk_20) {
hit = npc_raycast_up(COLLISION_CHANNEL_20000, &outX, &outY, &outZ, &outDepth); hit = npc_raycast_up(COLLISION_CHANNEL_20000, &outX, &outY, &outZ, &outDepth);
} else { } else {
hit = npc_raycast_up(COLLISION_CHANNEL_20000, &outX, &outY, &outZ, &outDepth); hit = npc_raycast_up(COLLISION_CHANNEL_20000, &outX, &outY, &outZ, &outDepth);
@ -2257,7 +2256,7 @@ void update_item_entity_collectable(ItemEntity* item) {
outY = item->position.y; outY = item->position.y;
outZ = item->position.z; outZ = item->position.z;
if (physData->unk_20 == 0) { if (!physData->unk_20) {
hit = npc_test_move_complex_with_slipping(COLLISION_CHANNEL_20000, &outX, &outY, &outZ, 0.0f, physData->moveAngle, physData->constVelocity, physData->unk_08); hit = npc_test_move_complex_with_slipping(COLLISION_CHANNEL_20000, &outX, &outY, &outZ, 0.0f, physData->moveAngle, physData->constVelocity, physData->unk_08);
} else { } else {
hit = npc_test_move_simple_with_slipping(COLLISION_CHANNEL_20000, &outX, &outY, &outZ, 0.0f, physData->moveAngle, physData->constVelocity, physData->unk_08); hit = npc_test_move_simple_with_slipping(COLLISION_CHANNEL_20000, &outX, &outY, &outZ, 0.0f, physData->moveAngle, physData->constVelocity, physData->unk_08);
@ -2280,13 +2279,13 @@ void update_item_entity_collectable(ItemEntity* item) {
item->spawnType != ITEM_SPAWN_MODE_ITEM_BLOCK_SPAWN_ALWAYS && item->spawnType != ITEM_SPAWN_MODE_ITEM_BLOCK_SPAWN_ALWAYS &&
physData->verticalVelocity <= 0.0) physData->verticalVelocity <= 0.0)
{ {
physData->unk_20 = 1; physData->unk_20 = TRUE;
if (item->spawnType != ITEM_SPAWN_MODE_TOSS_FADE1) { if (item->spawnType != ITEM_SPAWN_MODE_TOSS_FADE1) {
outX = item->position.x; outX = item->position.x;
outY = (item->position.y - physData->verticalVelocity) + 12.0f; outY = (item->position.y - physData->verticalVelocity) + 12.0f;
outZ = item->position.z; outZ = item->position.z;
outDepth = -physData->verticalVelocity + 12.0f; outDepth = -physData->verticalVelocity + 12.0f;
if (physData->unk_20 == 0) { if (!physData->unk_20) {
hit = npc_raycast_down_sides(COLLISION_CHANNEL_20000, &outX, &outY, &outZ, &outDepth); hit = npc_raycast_down_sides(COLLISION_CHANNEL_20000, &outX, &outY, &outZ, &outDepth);
} else { } else {
hit = npc_raycast_down_around(COLLISION_CHANNEL_20000, &outX, &outY, &outZ, &outDepth, 180.0f, 20.0f); hit = npc_raycast_down_around(COLLISION_CHANNEL_20000, &outX, &outY, &outZ, &outDepth, 180.0f, 20.0f);
@ -2462,16 +2461,16 @@ void func_8013559C(ItemEntity* itemEntity) {
if (itemEntity->spawnType != ITEM_SPAWN_MODE_ITEM_BLOCK_SPAWN_ALWAYS) { if (itemEntity->spawnType != ITEM_SPAWN_MODE_ITEM_BLOCK_SPAWN_ALWAYS) {
if (itemEntity->spawnType != ITEM_SPAWN_MODE_TOSS_FADE1) { if (itemEntity->spawnType != ITEM_SPAWN_MODE_TOSS_FADE1) {
if (physicsData->unk_1C < 60) { if (physicsData->timeLeft < 60) {
if ((itemEntity->flags & ITEM_ENTITY_FLAG_200000) || ((gGameStatusPtr->frameCounter + flag) & 1)) { if ((itemEntity->flags & ITEM_ENTITY_FLAG_CANT_COLLECT) || ((gGameStatusPtr->frameCounter + flag) & 1)) {
itemEntity->flags &= ~ITEM_ENTITY_FLAG_HIDDEN; itemEntity->flags &= ~ITEM_ENTITY_FLAG_HIDDEN;
} else { } else {
itemEntity->flags |= ITEM_ENTITY_FLAG_HIDDEN; itemEntity->flags |= ITEM_ENTITY_FLAG_HIDDEN;
} }
} }
} else { } else {
if (physicsData->unk_1C < 10) { if (physicsData->timeLeft < 10) {
itemEntity->alpha = physicsData->unk_1C * 28; itemEntity->alpha = physicsData->timeLeft * 28;
itemEntity->flags |= ITEM_ENTITY_FLAG_TRANSPARENT; itemEntity->flags |= ITEM_ENTITY_FLAG_TRANSPARENT;
} }
} }

View File

@ -1745,8 +1745,8 @@ s32 entity_get_collision_flags(Entity* entity) {
return entityFlags; return entityFlags;
} }
s32 entity_interacts_with_current_partner(s32 entityIdx) { s32 entity_try_partner_interaction_trigger(s32 entityIdx) {
s32 ret = FALSE; s32 interacted = FALSE;
u32 entityType = get_entity_type(entityIdx); u32 entityType = get_entity_type(entityIdx);
s32 partnerID = get_current_partner_id(); s32 partnerID = get_current_partner_id();
Entity* entity; Entity* entity;
@ -1772,7 +1772,7 @@ s32 entity_interacts_with_current_partner(s32 entityIdx) {
case ENTITY_TYPE_BOMBABLE_ROCK: case ENTITY_TYPE_BOMBABLE_ROCK:
entity = get_entity_by_index(entityIdx); entity = get_entity_by_index(entityIdx);
entity->flags |= ENTITY_FLAG_PARTNER_COLLISION; entity->flags |= ENTITY_FLAG_PARTNER_COLLISION;
ret = TRUE; interacted = TRUE;
} }
break; break;
case PARTNER_KOOPER: case PARTNER_KOOPER:
@ -1795,11 +1795,11 @@ s32 entity_interacts_with_current_partner(s32 entityIdx) {
case ENTITY_TYPE_SUPER_BLOCK: case ENTITY_TYPE_SUPER_BLOCK:
entity = get_entity_by_index(entityIdx); entity = get_entity_by_index(entityIdx);
entity->flags |= ENTITY_FLAG_PARTNER_COLLISION; entity->flags |= ENTITY_FLAG_PARTNER_COLLISION;
ret = TRUE; interacted = TRUE;
} }
break; break;
} }
return ret; return interacted;
} }
s32 test_player_entity_aabb(Entity* entity) { s32 test_player_entity_aabb(Entity* entity) {

View File

@ -284,7 +284,7 @@ void entity_CymbalPlant_idle(Entity* entity) {
data->unk_01++; data->unk_01++;
data->state++; data->state++;
disable_player_input(); disable_player_input();
set_action_state(0); set_action_state(ACTION_STATE_IDLE);
play_model_animation(entity->virtualModelIndex, Entity_CymbalPlant_AnimationGrab); play_model_animation(entity->virtualModelIndex, Entity_CymbalPlant_AnimationGrab);
sfx_play_sound(SOUND_F2); sfx_play_sound(SOUND_F2);
func_802BB8D4_E2E204(entity); func_802BB8D4_E2E204(entity);

View File

@ -269,9 +269,9 @@ ApiStatus NpcMoveTo(Evt* script, s32 isInitialCall) {
npc_move_heading(npc, npc->moveSpeed, npc->yaw); npc_move_heading(npc, npc->moveSpeed, npc->yaw);
if (npc->moveSpeed < 4.0) { if (npc->moveSpeed < 4.0) {
func_8003D660(npc, 0); spawn_surface_effects(npc, SURFACE_INTERACT_WALK);
} else { } else {
func_8003D660(npc, 1); spawn_surface_effects(npc, SURFACE_INTERACT_RUN);
} }
dist = dist2D(npc->pos.x, npc->pos.z, npc->moveToPos.x, npc->moveToPos.z); dist = dist2D(npc->pos.x, npc->pos.z, npc->moveToPos.x, npc->moveToPos.z);
@ -351,7 +351,7 @@ ApiStatus _npc_jump_to(Evt* script, s32 isInitialCall, s32 snapYaw) {
npc->pos.y = npc->moveToPos.y; npc->pos.y = npc->moveToPos.y;
npc->pos.z = npc->moveToPos.z; npc->pos.z = npc->moveToPos.z;
npc->flags &= ~NPC_FLAG_JUMPING; npc->flags &= ~NPC_FLAG_JUMPING;
func_8003D660(npc, 2); spawn_surface_effects(npc, SURFACE_INTERACT_LAND);
return ApiStatus_DONE1; return ApiStatus_DONE1;
} }
return ApiStatus_BLOCK; return ApiStatus_BLOCK;

View File

@ -313,7 +313,7 @@ s32 player_jump(Evt* script, s32 isInitialCall, s32 mode) {
anim = ANIM_Mario1_TiredIdle; anim = ANIM_Mario1_TiredIdle;
} }
suggest_player_anim_allow_backward(anim); suggest_player_anim_allow_backward(anim);
func_8003D660(playerNpc, 2); spawn_surface_effects(playerNpc, SURFACE_INTERACT_LAND);
} }
if (mode == 0 || mode == 2) { if (mode == 0 || mode == 2) {

151
src/npc.c
View File

@ -540,57 +540,59 @@ s32 npc_do_player_collision(Npc* npc) {
INCLUDE_ASM(s32, "npc", npc_do_player_collision, Npc* npc); INCLUDE_ASM(s32, "npc", npc_do_player_collision, Npc* npc);
#endif #endif
void npc_do_gravity(Npc* npc) { // update NPC position using gravitational acceleration = 1.0
if (npc->flags & NPC_FLAG_GRAVITY) { // if the NPC is within 16 units of the floor, they are snapped to it
void npc_try_apply_gravity(Npc* npc) {
f32 x, y, z, testLength;
f32 length;
s32 hitID;
if (!(npc->flags & NPC_FLAG_GRAVITY)) {
return;
}
if (npc->flags & NPC_FLAG_JUMPING) { if (npc->flags & NPC_FLAG_JUMPING) {
npc->flags &= ~NPC_FLAG_FALLING; npc->flags &= ~NPC_FLAG_GROUNDED;
} else { return;
f32 xTemp; }
f32 yTemp;
f32 zTemp;
f32 length, oldLength;
s32 hit;
npc->jumpScale = 1.0f; npc->jumpScale = 1.0f;
xTemp = npc->pos.x;
zTemp = npc->pos.z;
npc->jumpVelocity -= npc->jumpScale; npc->jumpVelocity -= npc->jumpScale;
npc->pos.y += npc->jumpVelocity; npc->pos.y += npc->jumpVelocity;
oldLength = length = fabsf(npc->jumpVelocity) + 16.0f;
yTemp = npc->pos.y + 13.0f; x = npc->pos.x;
y = npc->pos.y + 13;
z = npc->pos.z;
testLength = length = fabsf(npc->jumpVelocity) + 16;
if (!(npc->flags & NPC_FLAG_PARTNER)) { if (!(npc->flags & NPC_FLAG_PARTNER)) {
hit = npc_raycast_down_sides(npc->collisionChannel, &xTemp, &yTemp, &zTemp, &length); hitID = npc_raycast_down_sides(npc->collisionChannel, &x, &y, &z, &length);
} else { } else {
hit = npc_raycast_down_around(npc->collisionChannel, &xTemp, &yTemp, &zTemp, &length, npc->yaw, hitID = npc_raycast_down_around(npc->collisionChannel, &x, &y, &z, &length, npc->yaw, npc->collisionRadius);
npc->collisionRadius);
} }
if (hit && length <= oldLength) { if (hitID && length <= testLength) {
npc->jumpVelocity = 0.0f; npc->jumpVelocity = 0.0f;
npc->flags |= NPC_FLAG_FALLING; npc->flags |= NPC_FLAG_GROUNDED;
npc->pos.y = yTemp; npc->pos.y = y;
npc->currentFloor = NpcHitQueryColliderID; npc->currentFloor = NpcHitQueryColliderID;
} else { } else {
npc->flags &= ~NPC_FLAG_FALLING; npc->flags &= ~NPC_FLAG_GROUNDED;
}
}
} }
} }
s32 func_800397E8(Npc* npc, f32 velocity) { // perform only collision traces and snapping to ground from gravity code
if (!(npc->flags & (NPC_FLAG_GRAVITY | NPC_FLAG_8))) { s32 npc_try_snap_to_ground(Npc* npc, f32 velocity) {
f32 x; f32 x, y, z, testLength;
f32 y;
f32 z;
f32 length; f32 length;
f32 testLength; s32 hitID;
s32 phi_v0;
if (npc->flags & (NPC_FLAG_GRAVITY | NPC_FLAG_8)) {
return FALSE;
}
if (npc->flags & NPC_FLAG_JUMPING) { if (npc->flags & NPC_FLAG_JUMPING) {
npc->flags &= ~NPC_FLAG_FALLING; npc->flags &= ~NPC_FLAG_GROUNDED;
return FALSE; return FALSE;
} }
@ -600,22 +602,19 @@ s32 func_800397E8(Npc* npc, f32 velocity) {
z = npc->pos.z; z = npc->pos.z;
if (!(npc->flags & NPC_FLAG_PARTNER)) { if (!(npc->flags & NPC_FLAG_PARTNER)) {
phi_v0 = npc_raycast_down_sides(npc->collisionChannel, &x, &y, &z, &length); hitID = npc_raycast_down_sides(npc->collisionChannel, &x, &y, &z, &length);
} else { } else {
phi_v0 = npc_raycast_down_around(npc->collisionChannel, &x, &y, &z, &length, npc->yaw, npc->collisionRadius); hitID = npc_raycast_down_around(npc->collisionChannel, &x, &y, &z, &length, npc->yaw, npc->collisionRadius);
} }
if (phi_v0 != 0 && length <= testLength) { if (hitID != 0 && length <= testLength) {
npc->pos.y = y; npc->pos.y = y;
npc->currentFloor = NpcHitQueryColliderID; npc->currentFloor = NpcHitQueryColliderID;
npc->flags |= NPC_FLAG_FALLING; npc->flags |= NPC_FLAG_GROUNDED;
return TRUE; return TRUE;
} }
} else {
return FALSE;
}
npc->flags &= ~NPC_FLAG_FALLING; npc->flags &= ~NPC_FLAG_GROUNDED;
return FALSE; return FALSE;
} }
@ -650,8 +649,8 @@ void update_npcs(void) {
npc->flags &= ~(NPC_FLAG_COLLDING_FORWARD_WITH_WORLD | NPC_FLAG_COLLDING_WITH_WORLD); npc->flags &= ~(NPC_FLAG_COLLDING_FORWARD_WITH_WORLD | NPC_FLAG_COLLDING_WITH_WORLD);
npc_do_world_collision(npc); npc_do_world_collision(npc);
npc_do_gravity(npc); npc_try_apply_gravity(npc);
func_800397E8(npc, 0.0f); npc_try_snap_to_ground(npc, 0.0f);
npc_do_player_collision(npc); npc_do_player_collision(npc);
npc_do_other_npc_collision(npc); npc_do_other_npc_collision(npc);
@ -1705,7 +1704,7 @@ s32 npc_draw_palswap_mode_4(Npc* npc, s32 arg1, Matrix4f mtx) {
blendAlpha = npc->alpha * npc->alpha2 / 255; blendAlpha = npc->alpha * npc->alpha2 / 255;
temp = blendAlpha < 255; temp = blendAlpha < 255;
spriteInstanceMask = ((temp) << 31) | 0x20000000; spriteInstanceMask = ((temp) << 31) | DRAW_SPRITE_OVERRIDE_PALETTES;
spr_draw_npc_sprite(npc->spriteInstanceID | spriteInstanceMask, arg1, blendAlpha, npc->localPalettes, mtx); spr_draw_npc_sprite(npc->spriteInstanceID | spriteInstanceMask, arg1, blendAlpha, npc->localPalettes, mtx);
} }
} }
@ -1713,14 +1712,14 @@ s32 npc_draw_palswap_mode_4(Npc* npc, s32 arg1, Matrix4f mtx) {
} }
void npc_set_decoration(Npc* npc, s32 idx, s32 decorationType) { void npc_set_decoration(Npc* npc, s32 idx, s32 decorationType) {
npc__remove_decoration(npc, idx); npc_remove_decoration_impl(npc, idx);
npc->decorationType[idx] = decorationType; npc->decorationType[idx] = decorationType;
npc->changedDecoration[idx] = 1; npc->changedDecoration[idx] = 1;
npc->decorationInitialised[idx] = 0; npc->decorationInitialised[idx] = 0;
} }
void npc_remove_decoration(Npc* npc, s32 idx) { void npc_remove_decoration(Npc* npc, s32 idx) {
npc__remove_decoration(npc, idx); npc_remove_decoration_impl(npc, idx);
} }
s32 npc_update_decorations(Npc* npc) { s32 npc_update_decorations(Npc* npc) {
@ -1753,7 +1752,7 @@ s32 npc_update_decorations(Npc* npc) {
} }
} }
void npc__remove_decoration(Npc* npc, s32 idx) { void npc_remove_decoration_impl(Npc* npc, s32 idx) {
switch (npc->decorationType[idx]) { switch (npc->decorationType[idx]) {
case 0: case 0:
npc_remove_decoration_none(npc, idx); npc_remove_decoration_none(npc, idx);
@ -2160,7 +2159,9 @@ void func_8003D624(Npc* npc, s32 foldType, s32 arg2, s32 arg3, s32 arg4, s32 arg
func_8003D3BC(npc); func_8003D3BC(npc);
} }
void func_8003D660(Npc* npc, s32 arg1) { //TODO begin split for npc_surfaces
void spawn_surface_effects(Npc* npc, SurfaceInteractMode mode) {
PartnerActionStatus* temp = &gPartnerActionStatus; PartnerActionStatus* temp = &gPartnerActionStatus;
if ((npc->flags & (NPC_FLAG_TOUCHES_GROUND | NPC_FLAG_INVISIBLE)) == NPC_FLAG_TOUCHES_GROUND) { if ((npc->flags & (NPC_FLAG_TOUCHES_GROUND | NPC_FLAG_INVISIBLE)) == NPC_FLAG_TOUCHES_GROUND) {
@ -2168,61 +2169,58 @@ void func_8003D660(Npc* npc, s32 arg1) {
s32 surfaceType = get_collider_flags((u16)npc->currentFloor) & COLLIDER_FLAGS_SURFACE_TYPE_MASK; s32 surfaceType = get_collider_flags((u16)npc->currentFloor) & COLLIDER_FLAGS_SURFACE_TYPE_MASK;
switch (surfaceType) { switch (surfaceType) {
case SURFACE_TYPE_FLOWERS: case SURFACE_TYPE_FLOWERS:
func_8003DA38(npc, arg1); spawn_flower_surface_effects(npc, mode);
return; break;
case SURFACE_TYPE_CLOUD: case SURFACE_TYPE_CLOUD:
func_8003DC38(npc, arg1); spawn_cloud_surface_effects(npc, mode);
return; break;
case SURFACE_TYPE_SNOW: case SURFACE_TYPE_SNOW:
if ((temp->partnerActionState == PARTNER_ACTION_NONE) || (temp->actingPartner != PARTNER_LAKILESTER)) { if ((temp->partnerActionState == PARTNER_ACTION_NONE) || (temp->actingPartner != PARTNER_LAKILESTER)) {
func_8003DFA0(npc, arg1); spawn_snow_surface_effects(npc, mode);
return;
} }
break; break;
case SURFACE_TYPE_HEDGES: case SURFACE_TYPE_HEDGES:
func_8003E0D4(npc, arg1); spawn_hedge_surface_effects(npc, mode);
return; break;
case SURFACE_TYPE_WATER: case SURFACE_TYPE_WATER:
func_8003E1D0(npc, arg1); spawn_water_surface_effects(npc, mode);
return; break;
case SURFACE_TYPE_SPIKES: case SURFACE_TYPE_SPIKES:
case SURFACE_TYPE_LAVA: case SURFACE_TYPE_LAVA:
case SURFACE_TYPE_DOCK_WALL: case SURFACE_TYPE_DOCK_WALL:
case SURFACE_TYPE_SLIDE: case SURFACE_TYPE_SLIDE:
default: default:
func_8003D788(npc, arg1); spawn_default_surface_effects(npc, mode);
return; break;
} }
} }
} }
} }
static const f32 padding[2] = { 0.0f, 0.0f }; // todo remove when below funcs are decompiled void spawn_default_surface_effects(Npc* npc, SurfaceInteractMode mode) {
s32 mapIsStarWay;
void func_8003D788(Npc* npc, s32 arg1) {
s32 phi_a2;
f32 sinTheta; f32 sinTheta;
f32 cosTheta; f32 cosTheta;
phi_a2 = 0; mapIsStarWay = FALSE;
if (gGameStatusPtr->areaID == AREA_HOS) { if (gGameStatusPtr->areaID == AREA_HOS) {
phi_a2 = gGameStatusPtr->mapID == 2; mapIsStarWay = gGameStatusPtr->mapID == 2; //TODO hard-coded map ID
} }
if (arg1 == 2) { if (mode == SURFACE_INTERACT_LAND) {
f32 x = npc->pos.x; f32 x = npc->pos.x;
f32 y = npc->pos.y + 0.0f; f32 y = npc->pos.y + 0.0f;
f32 z = npc->pos.z; f32 z = npc->pos.z;
if (phi_a2 == 0) { if (!mapIsStarWay) {
fx_landing_dust(0, x, y, z, D_80077C10); fx_landing_dust(0, x, y, z, D_80077C10);
D_80077C10 = clamp_angle(D_80077C10 + 35.0f); D_80077C10 = clamp_angle(D_80077C10 + 35.0f);
} else { } else {
fx_misc_particles(3, x, y, z, 13.0f, 10.0f, 1.0f, 5, 30); fx_misc_particles(3, x, y, z, 13.0f, 10.0f, 1.0f, 5, 30);
} }
} else if (arg1 != 0) { } else if (mode != SURFACE_INTERACT_WALK) {
if (D_80077C14++ >= 4) { if (D_80077C14++ >= 4) {
D_80077C14 = 0; D_80077C14 = 0;
if (phi_a2 == 0) { if (!mapIsStarWay) {
sin_cos_rad(DEG_TO_RAD(clamp_angle(-npc->yaw)), &sinTheta, &cosTheta); sin_cos_rad(DEG_TO_RAD(clamp_angle(-npc->yaw)), &sinTheta, &cosTheta);
fx_walking_dust(0, npc->pos.x + (npc->collisionRadius * sinTheta * 0.2f), npc->pos.y + 1.5f, fx_walking_dust(0, npc->pos.x + (npc->collisionRadius * sinTheta * 0.2f), npc->pos.y + 1.5f,
npc->pos.z + (npc->collisionRadius * cosTheta * 0.2f), sinTheta, cosTheta); npc->pos.z + (npc->collisionRadius * cosTheta * 0.2f), sinTheta, cosTheta);
@ -2235,13 +2233,13 @@ void func_8003D788(Npc* npc, s32 arg1) {
} }
} }
void func_8003DA38(Npc* npc, s32 arg1) { void spawn_flower_surface_effects(Npc* npc, SurfaceInteractMode mode) {
f32 theta; f32 theta;
f32 sinTheta; f32 sinTheta;
f32 cosTheta; f32 cosTheta;
f32 x, y, z; f32 x, y, z;
if (arg1 == 2 && D_80077C1E == 5) { if (mode == SURFACE_INTERACT_LAND && D_80077C1E == 5) {
x = npc->pos.x; x = npc->pos.x;
y = npc->pos.y + + 14.0f; y = npc->pos.y + + 14.0f;
z = npc->pos.z; z = npc->pos.z;
@ -2272,7 +2270,7 @@ void func_8003DA38(Npc* npc, s32 arg1) {
} }
} }
void func_8003DC38(Npc* npc, s32 arg1) { void spawn_cloud_surface_effects(Npc* npc, SurfaceInteractMode mode) {
PlayerStatus* playerStatus = &gPlayerStatus; PlayerStatus* playerStatus = &gPlayerStatus;
f32 xTemp, yTemp, zTemp; f32 xTemp, yTemp, zTemp;
f32 xTemp2, yTemp2, zTemp2; f32 xTemp2, yTemp2, zTemp2;
@ -2283,7 +2281,7 @@ void func_8003DC38(Npc* npc, s32 arg1) {
s32 i; s32 i;
D_80077C2C += 0.1f; D_80077C2C += 0.1f;
if (arg1 == 2) { if (mode == SURFACE_INTERACT_LAND) {
fx_cloud_puff(npc->pos.x, (npc->pos.y + 14.0f) - 5.0f, npc->pos.z, D_80077C24); fx_cloud_puff(npc->pos.x, (npc->pos.y + 14.0f) - 5.0f, npc->pos.z, D_80077C24);
D_80077C24 = clamp_angle(D_80077C24 + 35.0f); D_80077C24 = clamp_angle(D_80077C24 + 35.0f);
@ -2324,7 +2322,7 @@ void func_8003DC38(Npc* npc, s32 arg1) {
} }
} }
void func_8003DFA0(Npc* npc, s32 arg1) { void spawn_snow_surface_effects(Npc* npc, SurfaceInteractMode mode) {
if (D_80077C30++ >= 4) { if (D_80077C30++ >= 4) {
f32 temp_f20; f32 temp_f20;
f32 x; f32 x;
@ -2340,7 +2338,7 @@ void func_8003DFA0(Npc* npc, s32 arg1) {
} }
} }
void func_8003E0D4(Npc* npc, s32 arg1) { void spawn_hedge_surface_effects(Npc* npc, SurfaceInteractMode mode) {
if (D_80077C38++ >= 4) { if (D_80077C38++ >= 4) {
f32 theta; f32 theta;
f32 sinTheta; f32 sinTheta;
@ -2355,7 +2353,7 @@ void func_8003E0D4(Npc* npc, s32 arg1) {
} }
} }
void func_8003E1D0(Npc* npc, s32 arg1) { void spawn_water_surface_effects(Npc* npc, SurfaceInteractMode mode) {
if (D_80077C3A++ >= 4) { if (D_80077C3A++ >= 4) {
f32 temp_f20; f32 temp_f20;
f32 x; f32 x;
@ -2370,6 +2368,9 @@ void func_8003E1D0(Npc* npc, s32 arg1) {
} }
} }
//TODO end split for npc_surfaces
static const f32 padding[2] = { 0.0f, 0.0f }; // remove after splitting
void COPY_set_defeated(s32 mapID, s32 encounterID) { void COPY_set_defeated(s32 mapID, s32 encounterID) {
EncounterStatus* currentEncounter = &gCurrentEncounter; EncounterStatus* currentEncounter = &gCurrentEncounter;
s32 encounterIdx = encounterID / 32; s32 encounterIdx = encounterID / 32;

View File

@ -189,7 +189,7 @@ EvtScript N(EVS_NpcInit_Tubba_Floor1) = {
EvtScript N(EVS_NpcInit_Sentinel_01) = { EvtScript N(EVS_NpcInit_Sentinel_01) = {
EVT_SET(LVar0, GB_StoryProgress) EVT_SET(LVar0, GB_StoryProgress)
EVT_IF_GE(LVar0, -29) EVT_IF_GE(LVar0, STORY_CH3_TUBBA_WOKE_UP)
EVT_CALL(SetNpcFlagBits, NPC_SELF, NPC_FLAG_8 | NPC_FLAG_IGNORE_WORLD_COLLISION, TRUE) EVT_CALL(SetNpcFlagBits, NPC_SELF, NPC_FLAG_8 | NPC_FLAG_IGNORE_WORLD_COLLISION, TRUE)
EVT_CALL(EnableNpcShadow, NPC_SELF, FALSE) EVT_CALL(EnableNpcShadow, NPC_SELF, FALSE)
EVT_CALL(SetNpcAnimation, NPC_SELF, ANIM_Sentinel_Anim01) EVT_CALL(SetNpcAnimation, NPC_SELF, ANIM_Sentinel_Anim01)
@ -203,7 +203,7 @@ EvtScript N(EVS_NpcInit_Sentinel_01) = {
EvtScript N(EVS_NpcInit_Sentinel_02) = { EvtScript N(EVS_NpcInit_Sentinel_02) = {
EVT_SET(LVar0, GB_StoryProgress) EVT_SET(LVar0, GB_StoryProgress)
EVT_IF_GE(LVar0, -29) EVT_IF_GE(LVar0, STORY_CH3_TUBBA_WOKE_UP)
EVT_CALL(SetNpcFlagBits, NPC_SELF, NPC_FLAG_8 | NPC_FLAG_IGNORE_WORLD_COLLISION, TRUE) EVT_CALL(SetNpcFlagBits, NPC_SELF, NPC_FLAG_8 | NPC_FLAG_IGNORE_WORLD_COLLISION, TRUE)
EVT_CALL(EnableNpcShadow, NPC_SELF, FALSE) EVT_CALL(EnableNpcShadow, NPC_SELF, FALSE)
EVT_CALL(SetNpcAnimation, NPC_SELF, ANIM_Sentinel_Anim01) EVT_CALL(SetNpcAnimation, NPC_SELF, ANIM_Sentinel_Anim01)
@ -217,7 +217,7 @@ EvtScript N(EVS_NpcInit_Sentinel_02) = {
EvtScript N(EVS_NpcInit_Sentinel_03) = { EvtScript N(EVS_NpcInit_Sentinel_03) = {
EVT_SET(LVar0, GB_StoryProgress) EVT_SET(LVar0, GB_StoryProgress)
EVT_IF_GE(LVar0, -29) EVT_IF_GE(LVar0, STORY_CH3_TUBBA_WOKE_UP)
EVT_CALL(SetNpcFlagBits, NPC_SELF, NPC_FLAG_8 | NPC_FLAG_IGNORE_WORLD_COLLISION, TRUE) EVT_CALL(SetNpcFlagBits, NPC_SELF, NPC_FLAG_8 | NPC_FLAG_IGNORE_WORLD_COLLISION, TRUE)
EVT_CALL(EnableNpcShadow, NPC_SELF, FALSE) EVT_CALL(EnableNpcShadow, NPC_SELF, FALSE)
EVT_CALL(SetNpcAnimation, NPC_SELF, ANIM_Sentinel_Anim01) EVT_CALL(SetNpcAnimation, NPC_SELF, ANIM_Sentinel_Anim01)
@ -231,7 +231,7 @@ EvtScript N(EVS_NpcInit_Sentinel_03) = {
EvtScript N(EVS_NpcInit_Sentinel_04) = { EvtScript N(EVS_NpcInit_Sentinel_04) = {
EVT_SET(LVar0, GB_StoryProgress) EVT_SET(LVar0, GB_StoryProgress)
EVT_IF_GE(LVar0, -29) EVT_IF_GE(LVar0, STORY_CH3_TUBBA_WOKE_UP)
EVT_CALL(SetNpcFlagBits, NPC_SELF, NPC_FLAG_8 | NPC_FLAG_IGNORE_WORLD_COLLISION, TRUE) EVT_CALL(SetNpcFlagBits, NPC_SELF, NPC_FLAG_8 | NPC_FLAG_IGNORE_WORLD_COLLISION, TRUE)
EVT_CALL(EnableNpcShadow, NPC_SELF, FALSE) EVT_CALL(EnableNpcShadow, NPC_SELF, FALSE)
EVT_CALL(SetNpcAnimation, NPC_SELF, ANIM_Sentinel_Anim01) EVT_CALL(SetNpcAnimation, NPC_SELF, ANIM_Sentinel_Anim01)

View File

@ -22,7 +22,7 @@ BSS u8 oldEnvR, oldEnvG, oldEnvB;
#include "world/common/util/ChangeNpcToPartner.inc.c" #include "world/common/util/ChangeNpcToPartner.inc.c"
API_CALLABLE(N(func_80242014_8B2084)) { API_CALLABLE(N(func_80242014_8B2084)) {
if (get_npc_unsafe(NPC_PARTNER)->flags & NPC_FLAG_FALLING) { if (get_npc_unsafe(NPC_PARTNER)->flags & NPC_FLAG_GROUNDED) {
return ApiStatus_DONE2; return ApiStatus_DONE2;
} else { } else {
return ApiStatus_BLOCK; return ApiStatus_BLOCK;

View File

@ -132,9 +132,9 @@ void N(AvoidPlayerAI_Chase)(Evt* script, MobileAISettings* npcAISettings, EnemyD
} else { } else {
if (npc->currentAnim != enemy->animList[ENEMY_ANIM_INDEX_MELEE_PRE]) { if (npc->currentAnim != enemy->animList[ENEMY_ANIM_INDEX_MELEE_PRE]) {
if (npc->moveSpeed < 4.0) { if (npc->moveSpeed < 4.0) {
func_8003D660(npc, 0); spawn_surface_effects(npc, SURFACE_INTERACT_WALK);
} else { } else {
func_8003D660(npc, 1); spawn_surface_effects(npc, SURFACE_INTERACT_RUN);
} }
npc_move_heading(npc, npc->moveSpeed, npc->yaw); npc_move_heading(npc, npc->moveSpeed, npc->yaw);
} }

View File

@ -185,7 +185,7 @@ void N(CleftAI_Tackle)(Evt* script, MobileAISettings* aiSettings, EnemyDetectVol
f32 posX, posY, posZ; f32 posX, posY, posZ;
s32 phi_s1 = FALSE; s32 phi_s1 = FALSE;
func_8003D660(npc, 1); spawn_surface_effects(npc, SURFACE_INTERACT_RUN);
npc_move_heading(npc, npc->moveSpeed, npc->yaw); npc_move_heading(npc, npc->moveSpeed, npc->yaw);
if (is_point_within_region(enemy->territory->wander.detectShape, if (is_point_within_region(enemy->territory->wander.detectShape,

View File

@ -121,7 +121,7 @@ void N(GuardAI_Chase)(Evt* script, GuardAISettings* aiSettings, EnemyDetectVolum
script->AI_TEMP_STATE = AI_STATE_LOSE_PLAYER; script->AI_TEMP_STATE = AI_STATE_LOSE_PLAYER;
} else { } else {
npc_move_heading(npc, npc->moveSpeed, npc->yaw); npc_move_heading(npc, npc->moveSpeed, npc->yaw);
func_8003D660(npc, 1); spawn_surface_effects(npc, SURFACE_INTERACT_RUN);
npc->duration--; npc->duration--;
if (npc->duration == 0) { if (npc->duration == 0) {
script->AI_TEMP_STATE = AI_STATE_CHASE_INIT; script->AI_TEMP_STATE = AI_STATE_CHASE_INIT;

View File

@ -114,7 +114,7 @@ static void N(MontyMoleAI_Wander)(Evt* script, MobileAISettings* aiSettings, Ene
} }
script->functionTemp[1]--; script->functionTemp[1]--;
} }
if (!(npc->flags & (NPC_FLAG_8 | NPC_FLAG_FALLING))) { if (!(npc->flags & (NPC_FLAG_8 | NPC_FLAG_GROUNDED))) {
npc->homePos.x = npc->pos.x; npc->homePos.x = npc->pos.x;
npc->homePos.z = npc->pos.z; npc->homePos.z = npc->pos.z;
} }

View File

@ -69,9 +69,9 @@ void N(PatrolAI_Move)(Evt* script, MobileAISettings* aiSettings, EnemyDetectVolu
if (npc->turnAroundYawAdjustment == 0) { if (npc->turnAroundYawAdjustment == 0) {
if (npc->moveSpeed < 4.0) { if (npc->moveSpeed < 4.0) {
func_8003D660(npc, 0); spawn_surface_effects(npc, SURFACE_INTERACT_WALK);
} else { } else {
func_8003D660(npc, 1); spawn_surface_effects(npc, SURFACE_INTERACT_RUN);
} }
//TODO strange match -- index and array are backwards! //TODO strange match -- index and array are backwards!
x = script->AI_PATROL_GOAL_INDEX[enemy->territory->patrol.points].x; x = script->AI_PATROL_GOAL_INDEX[enemy->territory->patrol.points].x;
@ -219,7 +219,7 @@ ApiStatus N(PatrolAI_Chase)(Evt* script, MobileAISettings* aiSettings, EnemyDete
npc->duration = 25; npc->duration = 25;
script->AI_TEMP_STATE = AI_STATE_LOSE_PLAYER; script->AI_TEMP_STATE = AI_STATE_LOSE_PLAYER;
} else { } else {
func_8003D660(npc, 1); spawn_surface_effects(npc, SURFACE_INTERACT_RUN);
npc_move_heading(npc, npc->moveSpeed, npc->yaw); npc_move_heading(npc, npc->moveSpeed, npc->yaw);
if (npc->duration > 0) { if (npc->duration > 0) {
npc->duration--; npc->duration--;

View File

@ -30,7 +30,7 @@ API_CALLABLE(N(func_802408B4_97BEE4)) {
npc->verticalRenderOffset = 0; npc->verticalRenderOffset = 0;
} }
if (npc->flags & NPC_FLAG_FALLING) { if (npc->flags & NPC_FLAG_GROUNDED) {
currentEncounter->encounterList[enemy->encounterIndex]->battle = enemy->varTable[0]; currentEncounter->encounterList[enemy->encounterIndex]->battle = enemy->varTable[0];
return ApiStatus_DONE2; return ApiStatus_DONE2;
} }

View File

@ -2,7 +2,7 @@
#include "npc.h" #include "npc.h"
API_CALLABLE(N(CheckPartnerFlags1000)) { API_CALLABLE(N(CheckPartnerFlags1000)) {
if (get_npc_unsafe(NPC_PARTNER)->flags & NPC_FLAG_FALLING) { if (get_npc_unsafe(NPC_PARTNER)->flags & NPC_FLAG_GROUNDED) {
return ApiStatus_DONE2; return ApiStatus_DONE2;
} else { } else {
return ApiStatus_BLOCK; return ApiStatus_BLOCK;

View File

@ -13,7 +13,7 @@ BSS s32 D_802BE938;
BSS s32 D_802BE93C; BSS s32 D_802BE93C;
BSS TweesterPhysics BombetteTweesterPhysics; BSS TweesterPhysics BombetteTweesterPhysics;
void entity_interacts_with_current_partner(s32 arg0); void entity_try_partner_interaction_trigger(s32 arg0);
void func_802BD100_317E50(Npc* npc) { void func_802BD100_317E50(Npc* npc) {
f32 x, y, z; f32 x, y, z;
@ -48,12 +48,12 @@ void func_802BD100_317E50(Npc* npc) {
if (!(angle >= 360.0f)) { if (!(angle >= 360.0f)) {
if (NpcHitQueryColliderID >= 0 && (NpcHitQueryColliderID & COLLISION_WITH_ENTITY_BIT) != 0) { if (NpcHitQueryColliderID >= 0 && (NpcHitQueryColliderID & COLLISION_WITH_ENTITY_BIT) != 0) {
entity_interacts_with_current_partner(NpcHitQueryColliderID & ~COLLISION_WITH_ENTITY_BIT); entity_try_partner_interaction_trigger(NpcHitQueryColliderID & ~COLLISION_WITH_ENTITY_BIT);
} }
} }
} else { } else {
if (NpcHitQueryColliderID >= 0 && (NpcHitQueryColliderID & COLLISION_WITH_ENTITY_BIT) != 0) { if (NpcHitQueryColliderID >= 0 && (NpcHitQueryColliderID & COLLISION_WITH_ENTITY_BIT) != 0) {
entity_interacts_with_current_partner(NpcHitQueryColliderID & ~COLLISION_WITH_ENTITY_BIT); entity_try_partner_interaction_trigger(NpcHitQueryColliderID & ~COLLISION_WITH_ENTITY_BIT);
} }
} }
} }
@ -226,7 +226,7 @@ ApiStatus func_802BD758_3184A8(Evt *evt, s32 isInitialCall) {
switch (evt->functionTemp[0]) { switch (evt->functionTemp[0]) {
case 20: case 20:
if ((playerStatus->inputEnabledCounter != 0) || (playerStatus->flags & PS_FLAG_JUMPING) || !(npc->flags & NPC_FLAG_FALLING)) { if ((playerStatus->inputEnabledCounter != 0) || (playerStatus->flags & PS_FLAG_JUMPING) || !(npc->flags & NPC_FLAG_GROUNDED)) {
return ApiStatus_DONE2; return ApiStatus_DONE2;
} }
disable_player_input(); disable_player_input();
@ -238,7 +238,7 @@ ApiStatus func_802BD758_3184A8(Evt *evt, s32 isInitialCall) {
npc->flags &= ~(NPC_FLAG_JUMPING | NPC_FLAG_GRAVITY | NPC_FLAG_IGNORE_WORLD_COLLISION | NPC_FLAG_8); npc->flags &= ~(NPC_FLAG_JUMPING | NPC_FLAG_GRAVITY | NPC_FLAG_IGNORE_WORLD_COLLISION | NPC_FLAG_8);
partnerActionStatus->partnerActionState = PARTNER_ACTION_USE; partnerActionStatus->partnerActionState = PARTNER_ACTION_USE;
partnerActionStatus->actingPartner = PARTNER_BOMBETTE; partnerActionStatus->actingPartner = PARTNER_BOMBETTE;
D_802BE920 = func_800EF4E0(); D_802BE920 = partner_force_player_flip_done();
enable_npc_blur(npc); enable_npc_blur(npc);
npc->duration = 4; npc->duration = 4;
npc->yaw = atan2(npc->pos.x, npc->pos.z, playerStatus->position.x, playerStatus->position.z); npc->yaw = atan2(npc->pos.x, npc->pos.z, playerStatus->position.x, playerStatus->position.z);
@ -316,7 +316,7 @@ ApiStatus func_802BD758_3184A8(Evt *evt, s32 isInitialCall) {
if (evt->functionTemp[1] < 45) { if (evt->functionTemp[1] < 45) {
if (!(npc->flags & NPC_FLAG_COLLDING_WITH_WORLD) && (D_802BE938 == 0)) { if (!(npc->flags & NPC_FLAG_COLLDING_WITH_WORLD) && (D_802BE938 == 0)) {
npc_move_heading(npc, npc->moveSpeed, npc->yaw); npc_move_heading(npc, npc->moveSpeed, npc->yaw);
func_8003D660(npc, 0); spawn_surface_effects(npc, SURFACE_INTERACT_WALK);
} else { } else {
D_802BE938 = 1; D_802BE938 = 1;
} }
@ -396,7 +396,7 @@ ApiStatus func_802BD758_3184A8(Evt *evt, s32 isInitialCall) {
break; break;
} }
exec_ShakeCam1(0, 0, 20); exec_ShakeCam1(0, 0, 20);
func_8003D660(npc, 2); spawn_surface_effects(npc, SURFACE_INTERACT_LAND);
collisionStatus->bombetteExploded = 0; collisionStatus->bombetteExploded = 0;
collisionStatus->bombetteExplosionPos.x = npc->pos.x; collisionStatus->bombetteExplosionPos.x = npc->pos.x;
collisionStatus->bombetteExplosionPos.y = npc->pos.y; collisionStatus->bombetteExplosionPos.y = npc->pos.y;
@ -460,7 +460,7 @@ ApiStatus func_802BD758_3184A8(Evt *evt, s32 isInitialCall) {
if (fabsf(playerStatus->position.y - npc->pos.y) < 500.0) { if (fabsf(playerStatus->position.y - npc->pos.y) < 500.0) {
evt->functionTemp[0] = 8; evt->functionTemp[0] = 8;
break; break;
} else if (func_800397E8(npc, npc->jumpVelocity)) { } else if (npc_try_snap_to_ground(npc, npc->jumpVelocity)) {
evt->functionTemp[0] = 7; evt->functionTemp[0] = 7;
break; break;
} }

View File

@ -238,7 +238,7 @@ ApiStatus BowUseAbility(Evt* script, s32 isInitialCall) {
partnerActionStatus->partnerActionState = 1; partnerActionStatus->partnerActionState = 1;
partnerActionStatus->actingPartner = 9; partnerActionStatus->actingPartner = 9;
playerStatus->flags |= PS_FLAG_HAZARD_INVINCIBILITY; playerStatus->flags |= PS_FLAG_HAZARD_INVINCIBILITY;
func_800EF4E0(); partner_force_player_flip_done();
bow->moveToPos.x = playerStatus->position.x; bow->moveToPos.x = playerStatus->position.x;
bow->moveToPos.y = playerStatus->position.y + (playerStatus->colliderHeight * 0.5f); bow->moveToPos.y = playerStatus->position.y + (playerStatus->colliderHeight * 0.5f);
bow->moveToPos.z = playerStatus->position.z; bow->moveToPos.z = playerStatus->position.z;

View File

@ -213,7 +213,7 @@ s32 world_goombario_can_pause(Npc* goombario) {
return FALSE; return FALSE;
} }
if ((goombario->flags & (NPC_FLAG_FALLING | NPC_FLAG_JUMPING)) != NPC_FLAG_FALLING) { if ((goombario->flags & (NPC_FLAG_GROUNDED | NPC_FLAG_JUMPING)) != NPC_FLAG_GROUNDED) {
return new_var = 0; return new_var = 0;
do { } while (new_var); // why though do { } while (new_var); // why though
} }
@ -247,7 +247,7 @@ ApiStatus func_802BD5D8_3174F8(Evt* script, s32 isInitialCall) {
switch (script->functionTemp[0]) { switch (script->functionTemp[0]) {
case 40: case 40:
if (!(goombario->flags & NPC_FLAG_FALLING) || playerStatus->inputEnabledCounter != 0) { if (!(goombario->flags & NPC_FLAG_GROUNDED) || playerStatus->inputEnabledCounter != 0) {
script->varTable[0] = -1; script->varTable[0] = -1;
return ApiStatus_DONE2; return ApiStatus_DONE2;
} }

View File

@ -2,86 +2,101 @@
#include "../src/world/partners.h" #include "../src/world/partners.h"
#include "sprite/npc/WorldKooper.h" #include "sprite/npc/WorldKooper.h"
s32 entity_interacts_with_current_partner(s32); s32 entity_try_partner_interaction_trigger(s32);
s32 test_item_entity_position(f32, f32, f32, f32); s32 test_item_entity_position(f32, f32, f32, f32);
s32 npc_raycast_up_corner(s32 ignoreFlags, f32* x, f32* y, f32* z, f32* length); s32 npc_raycast_up_corner(s32 ignoreFlags, f32* x, f32* y, f32* z, f32* length);
void fx_damage_stars(s32, f32, f32, f32, f32, f32, f32, s32); void fx_damage_stars(s32, f32, f32, f32, f32, f32, f32, s32);
void func_801341B0(s32); void auto_collect_item_entity(s32);
BSS s32 D_802BEC50; BSS s32 KooperShellTossHoldTime;
BSS s32 D_802BEC54; BSS s32 KooperTriggeredBattle;
BSS s32 D_802BEC58; BSS s32 ShellTossPlayerFacingLeft;
BSS s32 D_802BEC5C; BSS s32 D_802BEC5C;
BSS s32 D_802BEC60; BSS s32 ShellTossKickFalling;
BSS s32 D_802BEC64; BSS s32 ShellTossControlsPlayer;
BSS s32 D_802BEC68; BSS s32 KooperHeldItemIdx;
BSS s32 D_802BEC6C; BSS s32 KooperHasItem;
BSS f32 D_802BEC70; BSS f32 ShellTossPosX;
BSS f32 D_802BEC74; BSS f32 ShellTossPosY;
BSS f32 D_802BEC78; BSS f32 ShellTossPosZ;
BSS s32 D_802BEC7C; BSS s32 D_802BEC7C;
s32 D_802BEB40_31CB60 = 0; enum {
SHELL_TOSS_HITBOX_DISABLED = 0,
SHELL_TOSS_HITBOX_ENABLED = 1,
SHELL_TOSS_HITBOX_HIT_ENEMY = 2,
};
s32 func_802BD100_31B120(Npc* npc) { s32 ShellTossHitboxState = SHELL_TOSS_HITBOX_DISABLED;
s32 kooper_lateral_hit_interactable_entity(Npc* npc) {
if (NpcHitQueryColliderID < 0) { if (NpcHitQueryColliderID < 0) {
return 0; return FALSE;
} }
if (!(NpcHitQueryColliderID & COLLISION_WITH_ENTITY_BIT)) { if (!(NpcHitQueryColliderID & COLLISION_WITH_ENTITY_BIT)) {
return 0; return FALSE;
} }
return entity_interacts_with_current_partner(NpcHitQueryColliderID & ~COLLISION_WITH_ENTITY_BIT); return entity_try_partner_interaction_trigger(NpcHitQueryColliderID & ~COLLISION_WITH_ENTITY_BIT);
} }
void func_802BD144_31B164(Npc* kooper) { void kooper_vertical_hit_interactable_entity(Npc* kooper) {
if (NpcHitQueryColliderID >= 0 && NpcHitQueryColliderID & COLLISION_WITH_ENTITY_BIT) { if (NpcHitQueryColliderID < 0) {
entity_interacts_with_current_partner(NpcHitQueryColliderID & ~COLLISION_WITH_ENTITY_BIT); return;
} }
if (!(NpcHitQueryColliderID & COLLISION_WITH_ENTITY_BIT)) {
return;
}
entity_try_partner_interaction_trigger(NpcHitQueryColliderID & ~COLLISION_WITH_ENTITY_BIT);
} }
s32 func_802BD17C_31B19C(Npc* kooper) { s32 kooper_check_for_item_collision(Npc* kooper) {
D_802BEC68 = test_item_entity_position(kooper->pos.x, kooper->pos.y, kooper->pos.z, kooper->collisionRadius); KooperHeldItemIdx = test_item_entity_position(kooper->pos.x, kooper->pos.y, kooper->pos.z, kooper->collisionRadius);
if (D_802BEC68 < 0) { if (KooperHeldItemIdx < 0) {
return 0; return FALSE;
} else { }
D_802BEC6C = 1;
KooperHasItem = TRUE;
gOverrideFlags |= GLOBAL_OVERRIDES_40; gOverrideFlags |= GLOBAL_OVERRIDES_40;
set_item_entity_flags(D_802BEC68, ITEM_ENTITY_FLAG_200000); set_item_entity_flags(KooperHeldItemIdx, ITEM_ENTITY_FLAG_CANT_COLLECT);
return 1; return TRUE;
}
} }
void world_kooper_init(Npc* kooper) { void world_kooper_init(Npc* kooper) {
kooper->collisionHeight = 37; kooper->collisionHeight = 37;
kooper->collisionRadius = 24; kooper->collisionRadius = 24;
kooper->collisionChannel = COLLISION_CHANNEL_10000; kooper->collisionChannel = COLLISION_CHANNEL_10000;
D_802BEC54 = 0; KooperTriggeredBattle = FALSE;
} }
ApiStatus KooperTakeOut(Evt* script, s32 isInitialCall) { API_CALLABLE(KooperTakeOut) {
Npc* kooper = script->owner2.npc; Npc* kooper = script->owner2.npc;
if (isInitialCall) { if (isInitialCall) {
partner_init_get_out(kooper); partner_init_get_out(kooper);
} }
return partner_get_out(kooper) ? ApiStatus_DONE1 : ApiStatus_BLOCK; if (partner_get_out(kooper)) {
return ApiStatus_DONE1;
} else {
return ApiStatus_BLOCK;
}
} }
EvtScript world_kooper_take_out = { EvtScript EVS_WorldKooperTakeOut = {
EVT_CALL(KooperTakeOut) EVT_CALL(KooperTakeOut)
EVT_RETURN EVT_RETURN
EVT_END EVT_END
}; };
BSS TweesterPhysics KooperTweesterPhysics; BSS TweesterPhysics KooperTweesterPhysics;
TweesterPhysics* KooperTweesterPhysicsPtr = &KooperTweesterPhysics; TweesterPhysics* KooperTweesterPhysicsPtr = &KooperTweesterPhysics;
ApiStatus KooperUpdate(Evt* script, s32 isInitialCall) { API_CALLABLE(KooperUpdate) {
PlayerData* playerData = &gPlayerData; PlayerData* playerData = &gPlayerData;
Npc* kooper = script->owner2.npc; Npc* kooper = script->owner2.npc;
f32 sinAngle, cosAngle, liftoffVelocity; f32 sinAngle, cosAngle, liftoffVelocity;
@ -164,13 +179,13 @@ ApiStatus KooperUpdate(Evt* script, s32 isInitialCall) {
return ApiStatus_BLOCK; return ApiStatus_BLOCK;
} }
EvtScript world_kooper_update = { EvtScript EVS_WorldKooperUpdate = {
EVT_CALL(KooperUpdate) EVT_CALL(KooperUpdate)
EVT_RETURN EVT_RETURN
EVT_END EVT_END
}; };
void func_802BD5F4_31B614(Npc* kooper) { void kooper_try_cancel_tweester(Npc* kooper) {
if (TweesterTouchingPartner != NULL) { if (TweesterTouchingPartner != NULL) {
TweesterTouchingPartner = NULL; TweesterTouchingPartner = NULL;
kooper->flags = KooperTweesterPhysicsPtr->prevFlags; kooper->flags = KooperTweesterPhysicsPtr->prevFlags;
@ -179,101 +194,118 @@ void func_802BD5F4_31B614(Npc* kooper) {
} }
} }
ApiStatus func_802BD638_31B658(Evt* script, s32 isInitialCall) { API_CALLABLE(KooperUseAbility) {
Camera* cam; Camera* cam;
ItemEntity* itemGrabbed; ItemEntity* heldItem;
EncounterStatus* currentEncounter = &gCurrentEncounter; EncounterStatus* currentEncounter = &gCurrentEncounter;
PlayerStatus* playerStatus = &gPlayerStatus; PlayerStatus* playerStatus = &gPlayerStatus;
Npc* kooper = script->owner2.npc; Npc* kooper = script->owner2.npc;
PartnerActionStatus* partnerActionStatus = &gPartnerActionStatus; PartnerActionStatus* partnerActionStatus = &gPartnerActionStatus;
CollisionStatus* collisionStatus = &gCollisionStatus; CollisionStatus* collisionStatus = &gCollisionStatus;
f32 sp20, sp24, sp28, sp2C; f32 posX, posY, posZ, hitLength;
s32 phi_v0_4 = 0; f32 testLength;
f32 temp_f20_3; s32 actionState;
s32 tempVar; f32 moveAngle;
f32 clamp;
f32 colheight; f32 colheight;
f32 temp2; f32 angleToStartPos;
#define USE_STATE functionTemp[0]
enum {
SHELL_TOSS_STATE_BEGIN = 20,
SHELL_TOSS_STATE_GATHER = 21,
SHELL_TOSS_STATE_JUMP = 2,
SHELL_TOSS_STATE_KICK = 3,
SHELL_TOSS_STATE_PICKUP = 4,
SHELL_TOSS_STATE_HOLD = 5,
SHELL_TOSS_STATE_RETURN = 7,
SHELL_TOSS_STATE_FINISH = 0,
};
if (currentEncounter->unk_08 != 0) {
return ApiStatus_BLOCK;
}
if (currentEncounter->unk_08 == 0) {
if (isInitialCall) { if (isInitialCall) {
func_802BD5F4_31B614(kooper); kooper_try_cancel_tweester(kooper);
if (playerStatus->animFlags & PA_FLAG_CHANGING_MAP) { if (playerStatus->animFlags & PA_FLAG_CHANGING_MAP) {
return ApiStatus_DONE2; return ApiStatus_DONE2;
} }
if (D_802BEC54 == 0) { if (!KooperTriggeredBattle) {
tempVar = playerStatus->actionState; actionState = playerStatus->actionState;
if (tempVar == ACTION_STATE_IDLE || tempVar == ACTION_STATE_WALK || tempVar == ACTION_STATE_RUN) { if (actionState == ACTION_STATE_IDLE
script->functionTemp[0] = 20; || actionState == ACTION_STATE_WALK
|| actionState == ACTION_STATE_RUN
) {
script->USE_STATE = SHELL_TOSS_STATE_BEGIN;
} else { } else {
return ApiStatus_DONE2; return ApiStatus_DONE2;
} }
} else if (partnerActionStatus->partnerActionState == PARTNER_ACTION_NONE) { } else if (partnerActionStatus->partnerActionState == PARTNER_ACTION_NONE) {
partnerActionStatus->partnerActionState = PARTNER_ACTION_KOOPER_1; partnerActionStatus->partnerActionState = PARTNER_ACTION_KOOPER_GATHER;
partnerActionStatus->actingPartner = PARTNER_KOOPER; partnerActionStatus->actingPartner = PARTNER_KOOPER;
script->functionTemp[0] = 5; script->USE_STATE = SHELL_TOSS_STATE_HOLD;
kooper->currentAnim = ANIM_WorldKooper_SpinShell; kooper->currentAnim = ANIM_WorldKooper_SpinShell;
D_802BEC50 = 30; KooperShellTossHoldTime = 30;
} }
} }
switch (script->functionTemp[0]) { switch (script->USE_STATE) {
case 20: case SHELL_TOSS_STATE_BEGIN:
if (playerStatus->inputEnabledCounter == 0) { if (playerStatus->inputEnabledCounter != 0
if (playerStatus->timeInAir == 0) { || playerStatus->timeInAir != 0
if (kooper->flags & NPC_FLAG_FALLING) { || !(kooper->flags & NPC_FLAG_GROUNDED)
) {
return ApiStatus_DONE2;
}
disable_player_input(); disable_player_input();
script->functionTemp[2] = playerStatus->inputEnabledCounter; script->functionTemp[2] = playerStatus->inputEnabledCounter;
D_802BEC64 = 1; ShellTossControlsPlayer = TRUE;
D_802BEB40_31CB60 = 0; ShellTossHitboxState = SHELL_TOSS_HITBOX_DISABLED;
D_802BEC6C = 0; KooperHasItem = FALSE;
kooper->flags &= ~(NPC_FLAG_GRAVITY | NPC_FLAG_JUMPING | NPC_FLAG_8); kooper->flags &= ~(NPC_FLAG_GRAVITY | NPC_FLAG_JUMPING | NPC_FLAG_8);
kooper->flags |= (NPC_FLAG_IGNORE_PLAYER_COLLISION | NPC_FLAG_IGNORE_WORLD_COLLISION); kooper->flags |= (NPC_FLAG_IGNORE_PLAYER_COLLISION | NPC_FLAG_IGNORE_WORLD_COLLISION);
partnerActionStatus->actingPartner = PARTNER_KOOPER; partnerActionStatus->actingPartner = PARTNER_KOOPER;
partnerActionStatus->partnerActionState = PARTNER_ACTION_KOOPER_1; partnerActionStatus->partnerActionState = PARTNER_ACTION_KOOPER_GATHER;
D_802BEC58 = func_800EF4E0(); ShellTossPlayerFacingLeft = partner_force_player_flip_done();
enable_npc_blur(kooper); enable_npc_blur(kooper);
kooper->duration = 4; kooper->duration = 4;
kooper->yaw = atan2(kooper->pos.x, kooper->pos.z, kooper->yaw = atan2(kooper->pos.x, kooper->pos.z,
playerStatus->position.x, playerStatus->position.z); playerStatus->position.x, playerStatus->position.z);
script->functionTemp[0]++; script->USE_STATE++;
} else {
return ApiStatus_DONE2;
}
} else {
return ApiStatus_DONE2;
}
} else {
return ApiStatus_DONE2;
}
break; break;
case 21: case SHELL_TOSS_STATE_GATHER:
//TODO: make if statement less bad if (playerStatus->actionState == ACTION_STATE_HIT_FIRE
if ((((u8)playerStatus->actionState - 0x15) < 3U) || (playerStatus->timeInAir != 0)) { || playerStatus->actionState == ACTION_STATE_KNOCKBACK
|| playerStatus->actionState == ACTION_STATE_HIT_LAVA
|| playerStatus->timeInAir != 0
) {
suggest_player_anim_allow_backward(ANIM_Mario1_Idle); suggest_player_anim_allow_backward(ANIM_Mario1_Idle);
script->functionTemp[0] = 0; script->USE_STATE = SHELL_TOSS_STATE_FINISH;
break; break;
} else { }
suggest_player_anim_allow_backward(ANIM_Mario1_BeforeJump); suggest_player_anim_allow_backward(ANIM_Mario1_BeforeJump);
kooper->moveToPos.x = D_802BEC70 = playerStatus->position.x; kooper->moveToPos.x = ShellTossPosX = playerStatus->position.x;
kooper->moveToPos.y = D_802BEC74 = playerStatus->position.y; kooper->moveToPos.y = ShellTossPosY = playerStatus->position.y;
kooper->moveToPos.z = D_802BEC78 = playerStatus->position.z; kooper->moveToPos.z = ShellTossPosZ = playerStatus->position.z;
kooper->currentAnim = ANIM_WorldKooper_Run; kooper->currentAnim = ANIM_WorldKooper_Run;
add_vec2D_polar(&kooper->moveToPos.x, &kooper->moveToPos.z, add_vec2D_polar(&kooper->moveToPos.x, &kooper->moveToPos.z,
playerStatus->colliderDiameter / 3, playerStatus->targetYaw); playerStatus->colliderDiameter / 3, playerStatus->targetYaw);
clamp = clamp_angle(playerStatus->targetYaw + ((D_802BEC58 != 0) ? 90.0f : -90.0f)); moveAngle = clamp_angle(playerStatus->targetYaw + (ShellTossPlayerFacingLeft ? 90.0f : -90.0f));
add_vec2D_polar(&kooper->moveToPos.x, &kooper->moveToPos.z, add_vec2D_polar(&kooper->moveToPos.x, &kooper->moveToPos.z,
playerStatus->colliderDiameter / 4, clamp); playerStatus->colliderDiameter / 4, moveAngle);
kooper->pos.x = (kooper->pos.x + ((kooper->moveToPos.x - kooper->pos.x) / kooper->duration)); kooper->pos.x += (kooper->moveToPos.x - kooper->pos.x) / kooper->duration;
kooper->pos.y = (kooper->pos.y + ((kooper->moveToPos.y - kooper->pos.y) / kooper->duration)); kooper->pos.y += (kooper->moveToPos.y - kooper->pos.y) / kooper->duration;
kooper->pos.z = (kooper->pos.z + ((kooper->moveToPos.z - kooper->pos.z) / kooper->duration)); kooper->pos.z += (kooper->moveToPos.z - kooper->pos.z) / kooper->duration;
kooper->duration -= 1;
if (kooper->duration << 0x10) { kooper->duration--;
if (kooper->duration != 0) {
break; break;
} }
disable_npc_blur(kooper); disable_npc_blur(kooper);
if (script->functionTemp[2] < playerStatus->inputEnabledCounter) { if (script->functionTemp[2] < playerStatus->inputEnabledCounter) {
if (!(playerStatus->animFlags & PA_FLAG_CHANGING_MAP)) { if (!(playerStatus->animFlags & PA_FLAG_CHANGING_MAP)) {
@ -281,9 +313,10 @@ ApiStatus func_802BD638_31B658(Evt* script, s32 isInitialCall) {
} else { } else {
suggest_player_anim_allow_backward(ANIM_Mario1_Run); suggest_player_anim_allow_backward(ANIM_Mario1_Run);
} }
script->functionTemp[0] = 0; script->USE_STATE = SHELL_TOSS_STATE_FINISH;
break; break;
} else { }
kooper->yaw = playerStatus->targetYaw; kooper->yaw = playerStatus->targetYaw;
kooper->jumpVelocity = 18.0f; kooper->jumpVelocity = 18.0f;
kooper->jumpScale = 3.0f; kooper->jumpScale = 3.0f;
@ -296,188 +329,194 @@ ApiStatus func_802BD638_31B658(Evt* script, s32 isInitialCall) {
gCameras[CAM_DEFAULT].moveFlags |= CAMERA_MOVE_IGNORE_PLAYER_Y; gCameras[CAM_DEFAULT].moveFlags |= CAMERA_MOVE_IGNORE_PLAYER_Y;
suggest_player_anim_allow_backward(ANIM_Mario1_Jump); suggest_player_anim_allow_backward(ANIM_Mario1_Jump);
D_802BEC60 = 0; ShellTossKickFalling = FALSE;
sfx_play_sound_at_npc(SOUND_JUMP_2081, SOUND_SPACE_MODE_0, NPC_PARTNER); sfx_play_sound_at_npc(SOUND_JUMP_2081, SOUND_SPACE_MODE_0, NPC_PARTNER);
script->functionTemp[0] = 2; script->USE_STATE = SHELL_TOSS_STATE_JUMP;
} // fallthrough
case SHELL_TOSS_STATE_JUMP:
if (playerStatus->actionState == ACTION_STATE_HIT_FIRE
|| playerStatus->actionState == ACTION_STATE_KNOCKBACK
|| playerStatus->actionState == ACTION_STATE_HIT_LAVA
) {
script->USE_STATE = SHELL_TOSS_STATE_FINISH;
break;
} }
case 2:
if ((u8)playerStatus->actionState == ACTION_STATE_HIT_FIRE ||
(u8)playerStatus->actionState == ACTION_STATE_KNOCKBACK ||
(u8)playerStatus->actionState == ACTION_STATE_HIT_LAVA) {
script->functionTemp[0] = 0;
} else {
kooper->jumpVelocity -= kooper->jumpScale; kooper->jumpVelocity -= kooper->jumpScale;
playerStatus->position.y += kooper->jumpVelocity; playerStatus->position.y += kooper->jumpVelocity;
if (kooper->jumpVelocity < 0.0f) { if (kooper->jumpVelocity < 0.0f) {
if (D_802BEC60 == 0) { if (!ShellTossKickFalling) {
D_802BEC60 = 1; ShellTossKickFalling = TRUE;
suggest_player_anim_allow_backward(ANIM_Mario1_Fall); suggest_player_anim_allow_backward(ANIM_Mario1_Fall);
} }
} }
sp20 = playerStatus->position.x; posX = playerStatus->position.x;
sp24 = (playerStatus->position.y + playerStatus->colliderHeight / 2) - kooper->jumpVelocity; posY = (playerStatus->position.y + playerStatus->colliderHeight / 2) - kooper->jumpVelocity;
sp28 = playerStatus->position.z; posZ = playerStatus->position.z;
sp2C = playerStatus->colliderHeight / 2; testLength = hitLength = playerStatus->colliderHeight / 2;
temp_f20_3 = sp2C;
if ((npc_raycast_up(0x10000, &sp20, &sp24, &sp28, &sp2C) != 0) && (sp2C < temp_f20_3)) { if ((npc_raycast_up(COLLISION_CHANNEL_10000, &posX, &posY, &posZ, &hitLength)) && (hitLength < testLength)) {
collisionStatus->currentCeiling = NpcHitQueryColliderID; collisionStatus->currentCeiling = NpcHitQueryColliderID;
playerStatus->position.y = sp24 - playerStatus->colliderHeight; playerStatus->position.y = posY - playerStatus->colliderHeight;
func_802BD144_31B164(kooper); kooper_vertical_hit_interactable_entity(kooper);
} }
if (!(kooper->jumpVelocity > 0.0f) && (playerStatus->position.y < kooper->moveToPos.z)) { if (!(kooper->jumpVelocity > 0.0f) && (playerStatus->position.y < kooper->moveToPos.z)) {
D_802BEC5C = 0; D_802BEC5C = 0;
kooper->flags &= ~NPC_FLAG_IGNORE_PLAYER_COLLISION; kooper->flags &= ~NPC_FLAG_IGNORE_PLAYER_COLLISION;
partnerActionStatus->actingPartner = PARTNER_KOOPER; partnerActionStatus->actingPartner = PARTNER_KOOPER;
partnerActionStatus->partnerActionState = PARTNER_ACTION_KOOPER_2; partnerActionStatus->partnerActionState = PARTNER_ACTION_KOOPER_TOSS;
kooper->rotation.z = 0.0f; kooper->rotation.z = 0.0f;
kooper->planarFlyDist = 0.0f; kooper->planarFlyDist = 0.0f;
kooper->moveSpeed = 8.0f; kooper->moveSpeed = 8.0f;
kooper->currentAnim = ANIM_WorldKooper_SpinShell; kooper->currentAnim = ANIM_WorldKooper_SpinShell;
D_802BEB40_31CB60 = 1; ShellTossHitboxState = SHELL_TOSS_HITBOX_ENABLED;
fx_damage_stars(3, kooper->pos.x, kooper->pos.y + kooper->collisionHeight, kooper->pos.z, fx_damage_stars(3, kooper->pos.x, kooper->pos.y + kooper->collisionHeight, kooper->pos.z,
sin_deg(playerStatus->targetYaw), -1.0f, -cos_deg(playerStatus->targetYaw), 3); sin_deg(playerStatus->targetYaw), -1.0f, -cos_deg(playerStatus->targetYaw), 3);
start_bounce_b(); start_bounce_b();
if (D_802BEC64 != 0) { if (ShellTossControlsPlayer) {
enable_player_input(); enable_player_input();
D_802BEC64 = 0; ShellTossControlsPlayer = FALSE;
} }
script->functionTemp[0] = 3; script->USE_STATE = SHELL_TOSS_STATE_KICK;
D_802BEC60 = 0; ShellTossKickFalling = FALSE;
gCameras[CAM_DEFAULT].moveFlags |= CAMERA_MOVE_IGNORE_PLAYER_Y; gCameras[CAM_DEFAULT].moveFlags |= CAMERA_MOVE_IGNORE_PLAYER_Y;
sfx_play_sound_at_npc(SOUND_283, SOUND_SPACE_MODE_0, NPC_PARTNER); sfx_play_sound_at_npc(SOUND_283, SOUND_SPACE_MODE_0, NPC_PARTNER);
sfx_play_sound_at_npc(SOUND_284, SOUND_SPACE_MODE_0, NPC_PARTNER); sfx_play_sound_at_npc(SOUND_284, SOUND_SPACE_MODE_0, NPC_PARTNER);
} }
}
break; break;
case 3: case SHELL_TOSS_STATE_KICK:
//TODO: make if statement less bad if (playerStatus->actionState == ACTION_STATE_HIT_FIRE
if (((u8)playerStatus->actionState - 0x15) > 1U) { || playerStatus->actionState == ACTION_STATE_KNOCKBACK
sp20 = kooper->pos.x; ) {
sp24 = kooper->pos.y; script->USE_STATE = SHELL_TOSS_STATE_FINISH;
sp28 = kooper->pos.z; break;
}
if (npc_test_move_taller_with_slipping(0x8000, &sp20, &sp24, &sp28, kooper->moveSpeed, // check the forward collision for kooper
kooper->yaw - 20.0f, kooper->collisionHeight, #define TEST_COLLISION_AT_ANGLE(testAngle) \
(kooper->collisionRadius / 2)) != 0) { ( \
if (func_802BD100_31B120(kooper) == 0) { posX = kooper->pos.x, \
posY = kooper->pos.y, \
posZ = kooper->pos.z, \
npc_test_move_taller_with_slipping(COLLISION_CHANNEL_8000, \
&posX, &posY, &posZ, kooper->moveSpeed, testAngle, \
kooper->collisionHeight, kooper->collisionRadius / 2) \
)
if (TEST_COLLISION_AT_ANGLE(kooper->yaw - 20.0f)) {
if (!kooper_lateral_hit_interactable_entity(kooper)) {
sfx_play_sound_at_npc(SOUND_IMMUNE, SOUND_SPACE_MODE_0, NPC_PARTNER); sfx_play_sound_at_npc(SOUND_IMMUNE, SOUND_SPACE_MODE_0, NPC_PARTNER);
} }
temp_f20_3 = sin_deg(kooper->yaw);
fx_damage_stars(3, kooper->pos.x, kooper->pos.y + kooper->collisionHeight, kooper->pos.z, fx_damage_stars(3, kooper->pos.x, kooper->pos.y + kooper->collisionHeight, kooper->pos.z,
temp_f20_3, -1.0f, -cos_deg(kooper->yaw), 1); sin_deg(kooper->yaw), -1.0f, -cos_deg(kooper->yaw), 1);
sfx_play_sound_at_npc(SOUND_0, SOUND_SPACE_MODE_0, NPC_PARTNER); sfx_play_sound_at_npc(SOUND_0, SOUND_SPACE_MODE_0, NPC_PARTNER);
script->functionTemp[0] = 7; script->USE_STATE = SHELL_TOSS_STATE_RETURN;
break; break;
} }
sp20 = kooper->pos.x; if (TEST_COLLISION_AT_ANGLE(kooper->yaw + 20.0f)) {
sp24 = kooper->pos.y; if (!kooper_lateral_hit_interactable_entity(kooper)) {
sp28 = kooper->pos.z; sfx_play_sound_at_npc(SOUND_IMMUNE, SOUND_SPACE_MODE_0, NPC_PARTNER);
}
if ((npc_test_move_taller_with_slipping(0x8000, &sp20, &sp24, &sp28, kooper->moveSpeed, fx_damage_stars(3, kooper->pos.x, kooper->pos.y + kooper->collisionHeight, kooper->pos.z,
kooper->yaw + 20.0f, kooper->collisionHeight, sin_deg(kooper->yaw), -1.0f, -cos_deg(kooper->yaw), 1);
kooper->collisionRadius / 2) == 0) && sfx_play_sound_at_npc(SOUND_0, SOUND_SPACE_MODE_0, NPC_PARTNER);
(sp20 = kooper->pos.x, sp24 = kooper->pos.y, script->USE_STATE = SHELL_TOSS_STATE_RETURN;
sp28 = kooper->pos.z, break;
(npc_test_move_taller_with_slipping(0x8000, &sp20, &sp24, }
&sp28, kooper->moveSpeed, kooper->yaw,
kooper->collisionHeight, if (TEST_COLLISION_AT_ANGLE(kooper->yaw)) {
kooper->collisionRadius / 2)== 0))) { if (!kooper_lateral_hit_interactable_entity(kooper)) {
kooper->pos.x = sp20; sfx_play_sound_at_npc(SOUND_IMMUNE, SOUND_SPACE_MODE_0, NPC_PARTNER);
kooper->pos.y = sp24; }
kooper->pos.z = sp28;
fx_damage_stars(3, kooper->pos.x, kooper->pos.y + kooper->collisionHeight, kooper->pos.z,
sin_deg(kooper->yaw), -1.0f, -cos_deg(kooper->yaw), 1);
sfx_play_sound_at_npc(SOUND_0, SOUND_SPACE_MODE_0, NPC_PARTNER);
script->USE_STATE = SHELL_TOSS_STATE_RETURN;
break;
}
kooper->pos.x = posX;
kooper->pos.y = posY;
kooper->pos.z = posZ;
kooper->planarFlyDist += kooper->moveSpeed; kooper->planarFlyDist += kooper->moveSpeed;
func_8003D660(kooper, 1); spawn_surface_effects(kooper, SURFACE_INTERACT_RUN);
kooper->moveSpeed += 2.0;
kooper->moveSpeed += 2.0;
if (kooper->moveSpeed > 14.0) { if (kooper->moveSpeed > 14.0) {
kooper->moveSpeed = 14.0f; kooper->moveSpeed = 14.0f;
} }
if (!(func_800397E8(kooper, 6.0f) || playerStatus->flags & (PS_FLAG_JUMPING | PS_FLAG_FALLING))) { if (!(npc_try_snap_to_ground(kooper, 6.0f) || playerStatus->flags & (PS_FLAG_JUMPING | PS_FLAG_FALLING))) {
kooper->pos.y = (kooper->pos.y + ((playerStatus->position.y - kooper->pos.y) / 10.0f)); kooper->pos.y += (playerStatus->position.y - kooper->pos.y) / 10.0f;
} }
npc_do_other_npc_collision(kooper); npc_do_other_npc_collision(kooper);
if (!(kooper->flags & NPC_FLAG_COLLIDING_WITH_NPC)) { if ((kooper->flags & NPC_FLAG_COLLIDING_WITH_NPC)) {
if (func_802BD17C_31B19C(kooper) != 0) { script->USE_STATE = SHELL_TOSS_STATE_RETURN;
sfx_play_sound_at_npc(SOUND_286, SOUND_SPACE_MODE_0, NPC_PARTNER); kooper->moveSpeed = 0.0f;
temp_f20_3 = sin_deg(kooper->yaw);
fx_damage_stars(3, kooper->pos.x, kooper->pos.y + kooper->collisionHeight, kooper->pos.z,
temp_f20_3, -1.0f, -cos_deg(kooper->yaw), 1);
sfx_play_sound_at_npc(SOUND_0, SOUND_SPACE_MODE_0, NPC_PARTNER); sfx_play_sound_at_npc(SOUND_0, SOUND_SPACE_MODE_0, NPC_PARTNER);
script->functionTemp[0] = 4; break;
D_802BEC50 = 8; }
if (kooper_check_for_item_collision(kooper)) {
sfx_play_sound_at_npc(SOUND_286, SOUND_SPACE_MODE_0, NPC_PARTNER);
fx_damage_stars(3, kooper->pos.x, kooper->pos.y + kooper->collisionHeight, kooper->pos.z,
sin_deg(kooper->yaw), -1.0f, -cos_deg(kooper->yaw), 1);
sfx_play_sound_at_npc(SOUND_0, SOUND_SPACE_MODE_0, NPC_PARTNER);
script->USE_STATE = SHELL_TOSS_STATE_PICKUP;
KooperShellTossHoldTime = 8;
kooper->moveSpeed -= 4.0; kooper->moveSpeed -= 4.0;
if (kooper->moveSpeed < 0.01) { if (kooper->moveSpeed < 0.01) {
kooper->moveSpeed = 0.01f; kooper->moveSpeed = 0.01f;
kooper->planarFlyDist += 1.0; kooper->planarFlyDist += 1.0;
} }
} } else if (ShellTossHitboxState == SHELL_TOSS_HITBOX_HIT_ENEMY) {
else if (D_802BEB40_31CB60 == 2) {
sfx_play_sound_at_npc(SOUND_0, SOUND_SPACE_MODE_0, NPC_PARTNER); sfx_play_sound_at_npc(SOUND_0, SOUND_SPACE_MODE_0, NPC_PARTNER);
script->functionTemp[0] = 5; script->USE_STATE = SHELL_TOSS_STATE_HOLD;
D_802BEC50 = 30; KooperShellTossHoldTime = 30;
kooper->moveSpeed = 0.0f; kooper->moveSpeed = 0.0f;
} else { } else {
if (kooper->planarFlyDist > 140.0f) { if (kooper->planarFlyDist > 140.0f) {
label2: label2:
script->functionTemp[0] = 7; script->USE_STATE = SHELL_TOSS_STATE_RETURN;
kooper->moveSpeed = 0.0f; kooper->moveSpeed = 0.0f;
sfx_play_sound_at_npc(SOUND_0, SOUND_SPACE_MODE_0, NPC_PARTNER); sfx_play_sound_at_npc(SOUND_0, SOUND_SPACE_MODE_0, NPC_PARTNER);
} } else if (kooper->planarFlyDist > 105.0f) {
else if (kooper->planarFlyDist > 105.0f) {
kooper->moveSpeed -= 4.0; kooper->moveSpeed -= 4.0;
if (kooper->moveSpeed < 0.01) { if (kooper->moveSpeed < 0.01) {
kooper->moveSpeed = 0.01f; kooper->moveSpeed = 0.01f;
kooper->planarFlyDist += 1.0; kooper->planarFlyDist += 1.0;
} }
} }
break;
}
} else {
//TODO get rid of label
goto label2;
}
} else {
if (func_802BD100_31B120(kooper) == 0) {
sfx_play_sound_at_npc(SOUND_IMMUNE, SOUND_SPACE_MODE_0, NPC_PARTNER);
}
temp_f20_3 = sin_deg(kooper->yaw);
fx_damage_stars(3, kooper->pos.x, kooper->pos.y + kooper->collisionHeight, kooper->pos.z,
temp_f20_3, -1.0f, -cos_deg(kooper->yaw), 1);
sfx_play_sound_at_npc(SOUND_0, SOUND_SPACE_MODE_0, NPC_PARTNER);
script->functionTemp[0] = 7;
}
} else {
script->functionTemp[0] = 0;
} }
break; break;
case 4:
sp20 = kooper->pos.x;
sp24 = kooper->pos.y;
sp28 = kooper->pos.z;
npc_test_move_taller_with_slipping(0x8000, &sp20, &sp24, &sp28, kooper->moveSpeed, kooper->yaw, case SHELL_TOSS_STATE_PICKUP:
posX = kooper->pos.x;
posY = kooper->pos.y;
posZ = kooper->pos.z;
npc_test_move_taller_with_slipping(COLLISION_CHANNEL_8000,
&posX, &posY, &posZ, kooper->moveSpeed, kooper->yaw,
kooper->collisionHeight, ( kooper->collisionRadius / 2)); kooper->collisionHeight, ( kooper->collisionRadius / 2));
kooper->pos.x = sp20;
kooper->pos.y = sp24; kooper->pos.x = posX;
kooper->pos.z = sp28; kooper->pos.y = posY;
kooper->pos.z = posZ;
kooper->planarFlyDist += kooper->moveSpeed; kooper->planarFlyDist += kooper->moveSpeed;
func_8003D660(kooper, 1); spawn_surface_effects(kooper, SURFACE_INTERACT_RUN);
kooper->moveSpeed -= 6.0; kooper->moveSpeed -= 6.0;
if (kooper->moveSpeed < 0.01) { if (kooper->moveSpeed < 0.01) {
@ -485,74 +524,76 @@ ApiStatus func_802BD638_31B658(Evt* script, s32 isInitialCall) {
kooper->planarFlyDist += 1.0; kooper->planarFlyDist += 1.0;
} }
if (D_802BEC50 == 0) { if (KooperShellTossHoldTime == 0) {
script->functionTemp[0] = 7; script->USE_STATE = SHELL_TOSS_STATE_RETURN;
} }
D_802BEC50--; KooperShellTossHoldTime--;
break; break;
case 5: case SHELL_TOSS_STATE_HOLD:
if (D_802BEC50 != 0) { if (KooperShellTossHoldTime != 0) {
D_802BEC50--; KooperShellTossHoldTime--;
} else { } else {
script->functionTemp[0] = 7; script->USE_STATE = SHELL_TOSS_STATE_RETURN;
} }
break; break;
} }
if (script->functionTemp[0] == 7) { if (script->USE_STATE == SHELL_TOSS_STATE_RETURN) {
kooper->flags |= NPC_FLAG_IGNORE_PLAYER_COLLISION; kooper->flags |= NPC_FLAG_IGNORE_PLAYER_COLLISION;
//TODO: make if statement less bad if (playerStatus->actionState == ACTION_STATE_HIT_FIRE
if (((u8)playerStatus->actionState - 0x15) < 2U) { || playerStatus->actionState == ACTION_STATE_KNOCKBACK
script->functionTemp[0] = 0; ) {
script->USE_STATE = SHELL_TOSS_STATE_FINISH;
} else { } else {
temp2 = atan2(D_802BEC70, D_802BEC78, kooper->pos.x, kooper->pos.z); angleToStartPos = atan2(ShellTossPosX, ShellTossPosZ, kooper->pos.x, kooper->pos.z);
kooper->yaw = temp2 + (get_clamped_angle_diff(kooper->yaw, temp2) * 0.125f); kooper->yaw = angleToStartPos + get_clamped_angle_diff(kooper->yaw, angleToStartPos) * 0.125f;
npc_move_heading(kooper, -kooper->moveSpeed, kooper->yaw); npc_move_heading(kooper, -kooper->moveSpeed, kooper->yaw);
kooper->planarFlyDist -= kooper->moveSpeed; kooper->planarFlyDist -= kooper->moveSpeed;
func_8003D660(kooper, 1); spawn_surface_effects(kooper, SURFACE_INTERACT_RUN);
kooper->moveSpeed += 4.0/3.0; kooper->moveSpeed += 4.0/3.0;
if (kooper->moveSpeed > 14.0) { if (kooper->moveSpeed > 14.0) {
kooper->moveSpeed = 14.0f; kooper->moveSpeed = 14.0f;
} }
if (func_800397E8(kooper, 6.0f) == 0) { if (npc_try_snap_to_ground(kooper, 6.0f) == 0) {
kooper->pos.y += (playerStatus->position.y - kooper->pos.y) / 10.0f; kooper->pos.y += (playerStatus->position.y - kooper->pos.y) / 10.0f;
} }
sp20 = kooper->pos.x; posX = kooper->pos.x;
sp24 = kooper->pos.y; posY = kooper->pos.y;
sp28 = kooper->pos.z; posZ = kooper->pos.z;
if (npc_test_move_taller_with_slipping(0x8000, &sp20, &sp24, &sp28, kooper->moveSpeed, if (npc_test_move_taller_with_slipping(COLLISION_CHANNEL_8000,
clamp_angle(kooper->yaw + 180.0f), kooper->collisionHeight, &posX, &posY, &posZ, kooper->moveSpeed, clamp_angle(kooper->yaw + 180.0f),
kooper->collisionRadius) != 0) { kooper->collisionHeight, kooper->collisionRadius)
kooper->pos.x = sp20; ) {
kooper->pos.y = sp24; kooper->pos.x = posX;
kooper->pos.z = sp28; kooper->pos.y = posY;
kooper->pos.z = posZ;
sfx_play_sound_at_npc(SOUND_IMMUNE, SOUND_SPACE_MODE_0, NPC_PARTNER); sfx_play_sound_at_npc(SOUND_IMMUNE, SOUND_SPACE_MODE_0, NPC_PARTNER);
temp_f20_3 = sin_deg(kooper->yaw + 180.0f); testLength = sin_deg(kooper->yaw + 180.0f);
fx_damage_stars(3, kooper->pos.x, kooper->pos.y + kooper->collisionHeight, kooper->pos.z, fx_damage_stars(3, kooper->pos.x, kooper->pos.y + kooper->collisionHeight, kooper->pos.z,
temp_f20_3, -1.0f, -cos_deg(kooper->yaw + 180.0f), 1); testLength, -1.0f, -cos_deg(kooper->yaw + 180.0f), 1);
script->functionTemp[0] = 0; script->USE_STATE = SHELL_TOSS_STATE_FINISH;
} else { } else {
if (D_802BEC6C != 0) { if (KooperHasItem) {
itemGrabbed = get_item_entity(D_802BEC68); heldItem = get_item_entity(KooperHeldItemIdx);
sp20 = kooper->pos.x; posX = kooper->pos.x;
sp24 = kooper->pos.y + 8.0f; posY = kooper->pos.y + 8.0f;
sp28 = kooper->pos.z; posZ = kooper->pos.z;
clamp = clamp_angle(playerStatus->targetYaw - ((D_802BEC58) ? 90.0f : -90.0f)); moveAngle = clamp_angle(playerStatus->targetYaw - (ShellTossPlayerFacingLeft ? 90.0f : -90.0f));
add_vec2D_polar(&sp20, &sp28, 4.0f, clamp); add_vec2D_polar(&posX, &posZ, 4.0f, moveAngle);
itemGrabbed->position.x = sp20; heldItem->position.x = posX;
itemGrabbed->position.y = sp24; heldItem->position.y = posY;
itemGrabbed->position.z = sp28; heldItem->position.z = posZ;
} }
if (kooper->planarFlyDist + 15.0f < kooper->moveSpeed) { if (kooper->planarFlyDist + 15.0f < kooper->moveSpeed) {
script->functionTemp[0] = 0; script->USE_STATE = SHELL_TOSS_STATE_FINISH;
} else if (kooper->planarFlyDist + 15.0f < 35.0f) { } else if (kooper->planarFlyDist + 15.0f < 35.0f) {
kooper->moveSpeed -= 4.0; kooper->moveSpeed -= 4.0;
if (kooper->moveSpeed < 4.0) { if (kooper->moveSpeed < 4.0) {
@ -563,13 +604,13 @@ ApiStatus func_802BD638_31B658(Evt* script, s32 isInitialCall) {
} }
} }
if (script->functionTemp[0] == 0) { if (script->USE_STATE == SHELL_TOSS_STATE_FINISH) {
if (D_802BEC64 != 0) { if (ShellTossControlsPlayer) {
enable_player_input(); enable_player_input();
D_802BEC64 = 0; ShellTossControlsPlayer = FALSE;
} }
D_802BEB40_31CB60 = 0; ShellTossHitboxState = SHELL_TOSS_HITBOX_DISABLED;
kooper->flags |= NPC_FLAG_IGNORE_PLAYER_COLLISION; kooper->flags |= NPC_FLAG_IGNORE_PLAYER_COLLISION;
kooper->flags &= ~(NPC_FLAG_JUMPING | NPC_FLAG_IGNORE_WORLD_COLLISION); kooper->flags &= ~(NPC_FLAG_JUMPING | NPC_FLAG_IGNORE_WORLD_COLLISION);
partnerActionStatus->actingPartner = PARTNER_NONE; partnerActionStatus->actingPartner = PARTNER_NONE;
@ -580,26 +621,26 @@ ApiStatus func_802BD638_31B658(Evt* script, s32 isInitialCall) {
sfx_stop_sound(SOUND_284); sfx_stop_sound(SOUND_284);
disable_npc_blur(kooper); disable_npc_blur(kooper);
if (D_802BEC6C != 0) { if (KooperHasItem) {
func_801341B0(D_802BEC68); auto_collect_item_entity(KooperHeldItemIdx);
D_802BEC6C = 0; KooperHasItem = FALSE;
} }
D_802BEC54 = 0; KooperTriggeredBattle = FALSE;
partner_clear_player_tracking(kooper); partner_clear_player_tracking(kooper);
return ApiStatus_DONE2; return ApiStatus_DONE2;
} }
}
return ApiStatus_BLOCK; return ApiStatus_BLOCK;
} }
EvtScript world_kooper_use_ability = { EvtScript EVS_KooperUseAbility = {
EVT_CALL(func_802BD638_31B658) EVT_CALL(KooperUseAbility)
EVT_RETURN EVT_RETURN
EVT_END EVT_END
}; };
ApiStatus KooperPutAway(Evt* script, s32 isInitialCall) { API_CALLABLE(KooperPutAway) {
Npc* kooper = script->owner2.npc; Npc* kooper = script->owner2.npc;
if (isInitialCall) { if (isInitialCall) {
@ -609,7 +650,7 @@ ApiStatus KooperPutAway(Evt* script, s32 isInitialCall) {
return partner_put_away(kooper) ? ApiStatus_DONE1 : ApiStatus_BLOCK; return partner_put_away(kooper) ? ApiStatus_DONE1 : ApiStatus_BLOCK;
} }
EvtScript world_kooper_put_away = { EvtScript EVS_KooperPutAway = {
EVT_CALL(KooperPutAway) EVT_CALL(KooperPutAway)
EVT_RETURN EVT_RETURN
EVT_END EVT_END
@ -625,10 +666,10 @@ s32 world_kooper_test_first_strike(Npc* kooper, Npc* enemy) {
f32 kooperCollHeight; f32 kooperCollHeight;
f32 enemyCollRadius; f32 enemyCollRadius;
f32 kooperCollRadius; f32 kooperCollRadius;
f32 arctan; f32 angleToEnemy;
f32 dist; f32 distToEnemy;
if (D_802BEB40_31CB60 != 0) { if (ShellTossHitboxState != SHELL_TOSS_HITBOX_DISABLED) {
enemyX = enemy->pos.x; enemyX = enemy->pos.x;
enemyY = enemy->pos.y; enemyY = enemy->pos.y;
enemyZ = enemy->pos.z; enemyZ = enemy->pos.z;
@ -643,16 +684,16 @@ s32 world_kooper_test_first_strike(Npc* kooper, Npc* enemy) {
kooperCollHeight = kooper->collisionHeight; kooperCollHeight = kooper->collisionHeight;
kooperCollRadius = kooper->collisionRadius * 0.8; kooperCollRadius = kooper->collisionRadius * 0.8;
arctan = atan2(enemyX, enemyZ, kooperX, kooperZ); angleToEnemy = atan2(enemyX, enemyZ, kooperX, kooperZ);
dist = dist2D(enemyX, enemyZ, kooperX, kooperZ); distToEnemy = dist2D(enemyX, enemyZ, kooperX, kooperZ);
xTemp = kooper->pos.x; xTemp = kooper->pos.x;
yTemp = kooper->pos.y; yTemp = kooper->pos.y;
zTemp = kooper->pos.z; zTemp = kooper->pos.z;
if (npc_test_move_taller_with_slipping(0, &xTemp, &yTemp, &zTemp, dist, arctan, kooperCollHeight, if (npc_test_move_taller_with_slipping(0, &xTemp, &yTemp, &zTemp, distToEnemy, angleToEnemy,
kooperCollRadius + enemyCollRadius)) kooperCollHeight, kooperCollRadius + enemyCollRadius)
{ ) {
return FALSE; return FALSE;
} }
@ -666,10 +707,10 @@ s32 world_kooper_test_first_strike(Npc* kooper, Npc* enemy) {
kooperX = enemyX - kooperX; kooperX = enemyX - kooperX;
kooperZ = enemyZ - kooperZ; kooperZ = enemyZ - kooperZ;
dist = SQ(kooperX) + SQ(kooperZ); distToEnemy = SQ(kooperX) + SQ(kooperZ);
if (!(SQ(kooperCollRadius) + SQ(enemyCollRadius) <= dist)) { if (!(SQ(kooperCollRadius) + SQ(enemyCollRadius) <= distToEnemy)) {
D_802BEB40_31CB60 = 2; ShellTossHitboxState = SHELL_TOSS_HITBOX_HIT_ENEMY;
return TRUE; return TRUE;
} }
} }
@ -679,19 +720,19 @@ s32 world_kooper_test_first_strike(Npc* kooper, Npc* enemy) {
void world_kooper_pre_battle(Npc* kooper) { void world_kooper_pre_battle(Npc* kooper) {
PlayerStatus* playerStatus = &gPlayerStatus; PlayerStatus* playerStatus = &gPlayerStatus;
PartnerActionStatus* kooperActionStatus = &gPartnerActionStatus; PartnerActionStatus* kooperActionStatus = &gPartnerActionStatus;
D_802BEC54 = 0; KooperTriggeredBattle = FALSE;
if (kooperActionStatus->partnerActionState != PARTNER_ACTION_NONE) { if (kooperActionStatus->partnerActionState != PARTNER_ACTION_NONE) {
if (kooperActionStatus->partnerActionState == PARTNER_ACTION_KOOPER_2) { if (kooperActionStatus->partnerActionState == PARTNER_ACTION_KOOPER_TOSS) {
D_802BEC54 = 1; KooperTriggeredBattle = TRUE;
} }
if (D_802BEC64) { if (ShellTossControlsPlayer) {
enable_player_input(); enable_player_input();
D_802BEC64 = 0; ShellTossControlsPlayer = FALSE;
} }
D_802BEB40_31CB60 = 0; ShellTossHitboxState = SHELL_TOSS_HITBOX_DISABLED;
playerStatus->flags &= ~PS_FLAG_JUMPING; playerStatus->flags &= ~PS_FLAG_JUMPING;
kooper->jumpVelocity = 0.0f; kooper->jumpVelocity = 0.0f;
@ -699,7 +740,7 @@ void world_kooper_pre_battle(Npc* kooper) {
kooper->flags &= ~NPC_FLAG_IGNORE_WORLD_COLLISION; kooper->flags &= ~NPC_FLAG_IGNORE_WORLD_COLLISION;
sfx_stop_sound(SOUND_284); sfx_stop_sound(SOUND_284);
set_action_state(0); set_action_state(ACTION_STATE_IDLE);
partner_clear_player_tracking(kooper); partner_clear_player_tracking(kooper);
disable_npc_blur(kooper); disable_npc_blur(kooper);
@ -709,7 +750,7 @@ void world_kooper_pre_battle(Npc* kooper) {
} }
void world_kooper_post_battle(Npc* npc) { void world_kooper_post_battle(Npc* npc) {
if (D_802BEC54) { if (KooperTriggeredBattle) {
partner_clear_player_tracking(npc); partner_clear_player_tracking(npc);
partner_use_ability(); partner_use_ability();
} }

View File

@ -9,9 +9,9 @@ s32 world_kooper_test_first_strike(Npc*, Npc*);
void world_kooper_pre_battle(Npc*); void world_kooper_pre_battle(Npc*);
void world_kooper_post_battle(Npc*); void world_kooper_post_battle(Npc*);
extern EvtScript world_kooper_take_out; extern EvtScript EVS_WorldKooperTakeOut;
extern EvtScript world_kooper_update; extern EvtScript EVS_WorldKooperUpdate;
extern EvtScript world_kooper_use_ability; extern EvtScript EVS_KooperUseAbility;
extern EvtScript world_kooper_put_away; extern EvtScript EVS_KooperPutAway;
#endif #endif

View File

@ -438,7 +438,7 @@ void func_802BDDD8_321928(Npc* npc) {
npc->pos.z += (z - npc->pos.z) / 5.0f; npc->pos.z += (z - npc->pos.z) / 5.0f;
} }
func_8003D660(npc, 1); spawn_surface_effects(npc, SURFACE_INTERACT_RUN);
} else { } else {
yaw = 90.0f; yaw = 90.0f;
@ -679,7 +679,7 @@ ApiStatus func_802BE724_322274(Evt* script, s32 isInitialCall) {
npc->flags |= (NPC_FLAG_TOUCHES_GROUND | NPC_FLAG_IGNORE_PLAYER_COLLISION); npc->flags |= (NPC_FLAG_TOUCHES_GROUND | NPC_FLAG_IGNORE_PLAYER_COLLISION);
set_action_state(ACTION_STATE_RIDE); set_action_state(ACTION_STATE_RIDE);
D_802BFF0C = 1; D_802BFF0C = 1;
func_800EF4E0(); partner_force_player_flip_done();
npc->moveToPos.x = playerStatus->position.x; npc->moveToPos.x = playerStatus->position.x;
npc->moveToPos.y = playerStatus->position.y; npc->moveToPos.y = playerStatus->position.y;
npc->moveToPos.z = playerStatus->position.z; npc->moveToPos.z = playerStatus->position.z;

View File

@ -242,7 +242,7 @@ ApiStatus func_802BD660_319BD0(Evt* evt, s32 isInitialCall) {
parakarry->flags |= NPC_FLAG_IGNORE_WORLD_COLLISION | NPC_FLAG_8; parakarry->flags |= NPC_FLAG_IGNORE_WORLD_COLLISION | NPC_FLAG_8;
partnerActionStatus->actingPartner = PARTNER_PARAKARRY; partnerActionStatus->actingPartner = PARTNER_PARAKARRY;
partnerActionStatus->partnerActionState = PARTNER_ACTION_PARAKARRY_HOVER; partnerActionStatus->partnerActionState = PARTNER_ACTION_PARAKARRY_HOVER;
D_802BEBBC = func_800EF4E0(); D_802BEBBC = partner_force_player_flip_done();
enable_npc_blur(parakarry); enable_npc_blur(parakarry);
parakarry->yaw = atan2(parakarry->pos.x, parakarry->pos.z, playerStatus->position.x, playerStatus->position.z); parakarry->yaw = atan2(parakarry->pos.x, parakarry->pos.z, playerStatus->position.x, playerStatus->position.z);
parakarry->duration = 4; parakarry->duration = 4;
@ -489,7 +489,7 @@ ApiStatus func_802BD660_319BD0(Evt* evt, s32 isInitialCall) {
parakarry->pos.y = playerStatus->position.y + 32.0f, parakarry->pos.y = playerStatus->position.y + 32.0f,
y = parakarry->pos.y, y = parakarry->pos.y,
parakarry->pos.y = playerStatus->position.y, parakarry->pos.y = playerStatus->position.y,
func_8003D660(parakarry, 0), spawn_surface_effects(parakarry, SURFACE_INTERACT_WALK),
parakarry->pos.y = y, (!tempConditional))) { parakarry->pos.y = y, (!tempConditional))) {
if (!phys_adjust_cam_on_landing()) { if (!phys_adjust_cam_on_landing()) {
gCameras[0].moveFlags &= ~CAMERA_MOVE_FLAG_2; gCameras[0].moveFlags &= ~CAMERA_MOVE_FLAG_2;

View File

@ -303,7 +303,7 @@ ApiStatus func_802BD754_31D2C4(Evt* script, s32 isInitialCall) {
gGameStatusPtr->keepUsingPartnerOnMapChange = 0; gGameStatusPtr->keepUsingPartnerOnMapChange = 0;
partnerActionStatus->partnerActionState = PARTNER_ACTION_USE; partnerActionStatus->partnerActionState = PARTNER_ACTION_USE;
partnerActionStatus->actingPartner = PARTNER_WATT; partnerActionStatus->actingPartner = PARTNER_WATT;
func_800EF4E0(); partner_force_player_flip_done();
npc->moveToPos.x = playerStatus->position.x; npc->moveToPos.x = playerStatus->position.x;
npc->moveToPos.y = playerStatus->position.y + 5.0f; npc->moveToPos.y = playerStatus->position.y + 5.0f;
npc->moveToPos.z = playerStatus->position.z; npc->moveToPos.z = playerStatus->position.z;
@ -365,7 +365,7 @@ ApiStatus func_802BD754_31D2C4(Evt* script, s32 isInitialCall) {
D_802BE304 = 20; D_802BE304 = 20;
npc_set_palswap_mode_A(npc, 0); npc_set_palswap_mode_A(npc, 0);
if (!(playerStatus->flags & PS_FLAG_HIT_FIRE)) { if (!(playerStatus->flags & PS_FLAG_HIT_FIRE)) {
set_action_state(0); set_action_state(ACTION_STATE_IDLE);
} }
return ApiStatus_DONE1; return ApiStatus_DONE1;
} }

View File

@ -194,10 +194,10 @@ WorldPartner wPartners[12] = {
.dmaDest = &world_partner_kooper_VRAM, .dmaDest = &world_partner_kooper_VRAM,
.isFlying = FALSE, .isFlying = FALSE,
.init = world_kooper_init, .init = world_kooper_init,
.takeOut = &world_kooper_take_out, .takeOut = &EVS_WorldKooperTakeOut,
.update = &world_kooper_update, .update = &EVS_WorldKooperUpdate,
.useAbility = &world_kooper_use_ability, .useAbility = &EVS_KooperUseAbility,
.putAway = &world_kooper_put_away, .putAway = &EVS_KooperPutAway,
.idle = ANIM_WorldKooper_Idle, .idle = ANIM_WorldKooper_Idle,
.testFirstStrike = world_kooper_test_first_strike, .testFirstStrike = world_kooper_test_first_strike,
.canUseAbility = partner_is_idle, .canUseAbility = partner_is_idle,
@ -574,7 +574,7 @@ s32 partner_is_flying(void) {
} }
void func_800EA5B8(Npc* partner) { void func_800EA5B8(Npc* partner) {
partner->flags &= ~(NPC_FLAG_COLLIDING_WITH_NPC | NPC_FLAG_COLLDING_FORWARD_WITH_WORLD | NPC_FLAG_COLLDING_WITH_WORLD | NPC_FLAG_FALLING | partner->flags &= ~(NPC_FLAG_COLLIDING_WITH_NPC | NPC_FLAG_COLLDING_FORWARD_WITH_WORLD | NPC_FLAG_COLLDING_WITH_WORLD | NPC_FLAG_GROUNDED |
NPC_FLAG_JUMPING); NPC_FLAG_JUMPING);
} }
@ -1252,7 +1252,7 @@ void partner_walking_follow_player(Npc* partner) {
partner->moveSpeed = 4.0f; partner->moveSpeed = 4.0f;
} }
partner->currentAnim = gPartnerAnimations[wCurrentPartnerId].run; partner->currentAnim = gPartnerAnimations[wCurrentPartnerId].run;
if (!(partner->flags & NPC_FLAG_FALLING)) { if (!(partner->flags & NPC_FLAG_GROUNDED)) {
partner->currentAnim = gPartnerAnimations[wCurrentPartnerId].fall; partner->currentAnim = gPartnerAnimations[wCurrentPartnerId].fall;
} }
while (TRUE) { while (TRUE) {
@ -1300,28 +1300,23 @@ void partner_walking_follow_player(Npc* partner) {
break; break;
} }
if ((partner->flags & NPC_FLAG_FALLING) && currentSnapshot->isJumping) { if ((partner->flags & NPC_FLAG_GROUNDED) && currentSnapshot->isJumping) {
wPartnerFollowState = 1; wPartnerFollowState = 1;
break; break;
} }
} }
} }
if (!(partner->flags & NPC_FLAG_FALLING)) { if (!(partner->flags & NPC_FLAG_GROUNDED)) {
partner->moveSpeed *= 0.5f; partner->moveSpeed *= 0.5f;
} }
partner->yaw = yaw; partner->yaw = yaw;
npc_move_heading(partner, partner->moveSpeed, partner->yaw); npc_move_heading(partner, partner->moveSpeed, partner->yaw);
if (partner->moveSpeed < 4.0) { spawn_surface_effects(partner, (partner->moveSpeed < 4.0) ? SURFACE_INTERACT_WALK : SURFACE_INTERACT_RUN);
var_a1 = 0;
} else {
var_a1 = 1;
}
func_8003D660(partner, var_a1);
surfaceType = get_collider_flags(partner->currentFloor); surfaceType = get_collider_flags(partner->currentFloor);
if (surfaceType == SURFACE_TYPE_SPIKES || if (surfaceType == SURFACE_TYPE_SPIKES ||
surfaceType == SURFACE_TYPE_LAVA || surfaceType == SURFACE_TYPE_LAVA ||
(partner->flags & (NPC_FLAG_FALLING | NPC_FLAG_COLLDING_FORWARD_WITH_WORLD)) == (NPC_FLAG_FALLING | NPC_FLAG_COLLDING_FORWARD_WITH_WORLD)) { (partner->flags & (NPC_FLAG_GROUNDED | NPC_FLAG_COLLDING_FORWARD_WITH_WORLD)) == (NPC_FLAG_GROUNDED | NPC_FLAG_COLLDING_FORWARD_WITH_WORLD)) {
if (!func_800EA4B0(partner->currentWall)) { if (!func_800EA4B0(partner->currentWall)) {
D_8010CFBC++; D_8010CFBC++;
if (D_8010CFBC >= 40) { if (D_8010CFBC >= 40) {
@ -1433,7 +1428,7 @@ void partner_walking_follow_player(Npc* partner) {
partner->jumpVelocity = 0.0f; partner->jumpVelocity = 0.0f;
partner->pos.y = y; partner->pos.y = y;
partner->yaw = atan2(x, z, playerStatus->position.x, playerStatus->position.z); partner->yaw = atan2(x, z, playerStatus->position.x, playerStatus->position.z);
func_8003D660(partner, 2); spawn_surface_effects(partner, SURFACE_INTERACT_LAND);
wPartnerFollowState = 0; wPartnerFollowState = 0;
distance = dist2D(partner->pos.x, partner->pos.z, partner->moveToPos.x, partner->moveToPos.z); distance = dist2D(partner->pos.x, partner->pos.z, partner->moveToPos.x, partner->moveToPos.z);
if (distance < 5.0) { if (distance < 5.0) {
@ -1509,12 +1504,7 @@ void partner_walking_follow_player(Npc* partner) {
} }
partner->yaw = yaw; partner->yaw = yaw;
npc_move_heading(partner, partner->moveSpeed, yaw); npc_move_heading(partner, partner->moveSpeed, yaw);
if (partner->moveSpeed < 4.0) { spawn_surface_effects(partner, (partner->moveSpeed < 4.0) ? SURFACE_INTERACT_WALK : SURFACE_INTERACT_RUN);
var_a1 = 0;
} else {
var_a1 = 1;
}
func_8003D660(partner, var_a1);
distance = 1000.0f; distance = 1000.0f;
x = partner->pos.x; x = partner->pos.x;
z = partner->pos.z; z = partner->pos.z;
@ -1633,12 +1623,7 @@ void partner_walking_follow_player(Npc* partner) {
partner->moveSpeed = wPartnerMoveSpeed; partner->moveSpeed = wPartnerMoveSpeed;
partner->yaw = D_800F8034; partner->yaw = D_800F8034;
npc_move_heading(partner, partner->moveSpeed, partner->yaw); npc_move_heading(partner, partner->moveSpeed, partner->yaw);
if (partner->moveSpeed < 4.0) { spawn_surface_effects(partner, (partner->moveSpeed < 4.0) ? SURFACE_INTERACT_WALK : SURFACE_INTERACT_RUN);
var_a1 = 0;
} else {
var_a1 = 1;
}
func_8003D660(partner, var_a1);
} else { } else {
partner_clear_player_tracking(partner); partner_clear_player_tracking(partner);
partner->moveSpeed = 0.0f; partner->moveSpeed = 0.0f;
@ -1663,7 +1648,7 @@ void partner_walking_follow_player(Npc* partner) {
partner_move_to_goal(partner, FALSE); partner_move_to_goal(partner, FALSE);
break; break;
case 40: case 40:
if (partner->flags & NPC_FLAG_FALLING) { if (partner->flags & NPC_FLAG_GROUNDED) {
if (func_800EA4B0(partner->currentFloor)) { if (func_800EA4B0(partner->currentFloor)) {
wPartnerFollowState = 50; wPartnerFollowState = 50;
partner->currentAnim = gPartnerAnimations[wCurrentPartnerId].idle; partner->currentAnim = gPartnerAnimations[wCurrentPartnerId].idle;
@ -1699,7 +1684,7 @@ void partner_walking_follow_player(Npc* partner) {
partner->jumpVelocity = 0.0f; partner->jumpVelocity = 0.0f;
partner->pos.y = y; partner->pos.y = y;
partner->yaw = atan2(x, z, playerStatus->position.x, playerStatus->position.z); partner->yaw = atan2(x, z, playerStatus->position.x, playerStatus->position.z);
func_8003D660(partner, 2); spawn_surface_effects(partner, SURFACE_INTERACT_LAND);
wPartnerFollowState = 50; wPartnerFollowState = 50;
} }
break; break;
@ -2334,7 +2319,7 @@ s32 partner_get_out(Npc* partner) {
partner->currentAnim = gPartnerAnimations[wCurrentPartnerId].jump; partner->currentAnim = gPartnerAnimations[wCurrentPartnerId].jump;
break; break;
case 1: case 1:
if (partner->jumpVelocity < 0.0f && func_800397E8(partner, fabsf(partner->jumpVelocity))) { if (partner->jumpVelocity < 0.0f && npc_try_snap_to_ground(partner, fabsf(partner->jumpVelocity))) {
wPartnerFollowState = 2; wPartnerFollowState = 2;
break; break;
} }
@ -2378,9 +2363,9 @@ s32 partner_get_out(Npc* partner) {
partner->pos.x = partner->moveToPos.x; partner->pos.x = partner->moveToPos.x;
partner->pos.y = partner->moveToPos.y; partner->pos.y = partner->moveToPos.y;
partner->pos.z = partner->moveToPos.z; partner->pos.z = partner->moveToPos.z;
if (partner->flags & 0x1000) { if (partner->flags & NPC_FLAG_GROUNDED) {
if (!wPartner->isFlying) { if (!wPartner->isFlying) {
func_8003D660(partner, 2); spawn_surface_effects(partner, SURFACE_INTERACT_LAND);
} }
} }
return TRUE; return TRUE;
@ -2458,29 +2443,32 @@ void partner_clear_player_tracking(Npc* partner) {
} }
} }
s32 func_800EF4E0(void) { // forces the player to complete a direction flip if they are currently performing one
// the resulting camera-relative direction is returned as a boolean 'isFacingLeft'
s32 partner_force_player_flip_done(void) {
PlayerStatus* playerStatus = &gPlayerStatus; PlayerStatus* playerStatus = &gPlayerStatus;
Camera* cameras = gCameras; Camera* cameras = gCameras;
s32 ret; s32 isFacingLeft;
if (playerStatus->flipYaw[CAM_DEFAULT] == 0.0f) { if (playerStatus->flipYaw[CAM_DEFAULT] == 0.0f) {
if (!(playerStatus->spriteFacingAngle >= 90.0f) || !(playerStatus->spriteFacingAngle < 270.0f)) { if (!(playerStatus->spriteFacingAngle >= 90.0f) || !(playerStatus->spriteFacingAngle < 270.0f)) {
ret = 1; isFacingLeft = TRUE;
playerStatus->targetYaw = clamp_angle(cameras[CAM_DEFAULT].currentYaw - 90.0f); playerStatus->targetYaw = clamp_angle(cameras[CAM_DEFAULT].currentYaw - 90.0f);
} else { } else {
isFacingLeft = FALSE;
playerStatus->targetYaw = clamp_angle(cameras[CAM_DEFAULT].currentYaw + 90.0f); playerStatus->targetYaw = clamp_angle(cameras[CAM_DEFAULT].currentYaw + 90.0f);
ret = 0;
} }
} else if (get_clamped_angle_diff(cameras[CAM_DEFAULT].currentYaw, playerStatus->targetYaw) < 0.0f) { } else if (get_clamped_angle_diff(cameras[CAM_DEFAULT].currentYaw, playerStatus->targetYaw) < 0.0f) {
ret = 1; isFacingLeft = TRUE;
playerStatus->targetYaw = clamp_angle(cameras[CAM_DEFAULT].currentYaw - 90.0f); playerStatus->targetYaw = clamp_angle(cameras[CAM_DEFAULT].currentYaw - 90.0f);
} else { } else {
ret = 0; isFacingLeft = FALSE;
playerStatus->targetYaw = clamp_angle(cameras[CAM_DEFAULT].currentYaw + 90.0f); playerStatus->targetYaw = clamp_angle(cameras[CAM_DEFAULT].currentYaw + 90.0f);
} }
playerStatus->currentYaw = playerStatus->targetYaw; playerStatus->currentYaw = playerStatus->targetYaw;
return ret; return isFacingLeft;
} }
void partner_enable_input(void) { void partner_enable_input(void) {
@ -2548,7 +2536,7 @@ void partner_move_to_goal(Npc* partner, s32 isFlying) {
if (wPartnerMoveTime != 0) { if (wPartnerMoveTime != 0) {
wPartnerMoveTime--; wPartnerMoveTime--;
if (!isFlying) { if (!isFlying) {
if (!(partner->flags & NPC_FLAG_FALLING)) { if (!(partner->flags & NPC_FLAG_GROUNDED)) {
partner->pos.y = playerStatus->position.y; partner->pos.y = playerStatus->position.y;
} }
if (partner->jumpVelocity != 0.0f) { if (partner->jumpVelocity != 0.0f) {
@ -2592,12 +2580,7 @@ void partner_move_to_goal(Npc* partner, s32 isFlying) {
npc_move_heading(partner, partner->moveSpeed, partner->yaw); npc_move_heading(partner, partner->moveSpeed, partner->yaw);
} }
if (partner->moveSpeed < 4.0) { spawn_surface_effects(partner, (partner->moveSpeed < 4.0) ? SURFACE_INTERACT_WALK : SURFACE_INTERACT_RUN);
var_a1 = 0;
} else {
var_a1 = 1;
}
func_8003D660(partner, var_a1);
} else { } else {
partner->flags &= ~NPC_FLAG_IGNORE_WORLD_COLLISION; partner->flags &= ~NPC_FLAG_IGNORE_WORLD_COLLISION;
partner->currentAnim = gPartnerAnimations[wCurrentPartnerId].idle; partner->currentAnim = gPartnerAnimations[wCurrentPartnerId].idle;

View File

@ -35,7 +35,7 @@ s32 partner_use_ability(void);
void partner_do_player_collision(Npc* partner); void partner_do_player_collision(Npc* partner);
void partner_walking_follow_player(Npc* partner); void partner_walking_follow_player(Npc* partner);
s32 func_800EA52C(s32); s32 func_800EA52C(s32);
s32 func_800EF4E0(void); s32 partner_force_player_flip_done(void);
void partner_suspend_ability_script(void); void partner_suspend_ability_script(void);
void partner_resume_ability_script(void); void partner_resume_ability_script(void);
void partner_enable_input(void); void partner_enable_input(void);

View File

@ -252,7 +252,7 @@ dead_dma_copy = 0x8002AA2C;
dead_get_entity_by_index = 0x80118BB0; dead_get_entity_by_index = 0x80118BB0;
dead_cos_rad = 0x8002B4C0; dead_cos_rad = 0x8002B4C0;
dead_fx_sun = 0x80077BD0; dead_fx_sun = 0x80077BD0;
dead_func_8003D660 = 0x80041080; dead_spawn_surface_effects = 0x80041080;
dead_set_max_SP = 0x800F1D9C; dead_set_max_SP = 0x800F1D9C;
dead_sync_status_menu = 0x800F1730; dead_sync_status_menu = 0x800F1730;
dead_get_npc_by_index = 0x8003C43C; dead_get_npc_by_index = 0x8003C43C;

View File

@ -17,6 +17,31 @@ def next_8(n):
else: else:
return n return n
def get_palette_idx(charset_name, char_id):
pal_id = 0
if charset_name == "standard":
if char_id == 0x98:
pal_id = 0x10
elif char_id == 0x99:
pal_id = 0x11
elif char_id == 0x9A:
pal_id = 0x15
elif char_id == 0x9B:
pal_id = 0x15
elif char_id == 0x9C:
pal_id = 0x15
elif char_id == 0x9D:
pal_id = 0x13
elif char_id == 0x9E:
pal_id = 0x13
elif char_id == 0x9F:
pal_id = 0x13
elif char_id == 0xA0:
pal_id = 0x13
elif char_id == 0xA1:
pal_id = 0x12
return pal_id
class N64SegPm_charset(N64Segment): class N64SegPm_charset(N64Segment):
def scan(self, rom_bytes): def scan(self, rom_bytes):
data = rom_bytes[self.rom_start:self.rom_end] data = rom_bytes[self.rom_start:self.rom_end]
@ -39,7 +64,8 @@ class N64SegPm_charset(N64Segment):
fs_dir.mkdir(parents=True, exist_ok=True) fs_dir.mkdir(parents=True, exist_ok=True)
for i, raster in enumerate(self.rasters): for i, raster in enumerate(self.rasters):
palette = self.sibling.palettes[0] pal_idx = get_palette_idx(self.name, i)
palette = self.sibling.palettes[pal_idx]
w = png.Writer(self.width, self.height, palette=palette) w = png.Writer(self.width, self.height, palette=palette)
with open(fs_dir / f"{i:02X}.png", "wb") as f: with open(fs_dir / f"{i:02X}.png", "wb") as f:

View File

@ -253,8 +253,8 @@ get_npc_by_index = 0x80038ADC; // type:func rom:0x13EDC
npc_do_world_collision = 0x80038AFC; // type:func rom:0x13EFC npc_do_world_collision = 0x80038AFC; // type:func rom:0x13EFC
npc_do_other_npc_collision = 0x8003900C; // type:func rom:0x1440C npc_do_other_npc_collision = 0x8003900C; // type:func rom:0x1440C
npc_do_player_collision = 0x800392D8; // type:func rom:0x146D8 npc_do_player_collision = 0x800392D8; // type:func rom:0x146D8
npc_do_gravity = 0x80039688; // type:func rom:0x14A88 npc_try_apply_gravity = 0x80039688; // type:func rom:0x14A88
func_800397E8 = 0x800397E8; // type:func rom:0x14BE8 npc_try_snap_to_ground = 0x800397E8; // type:func rom:0x14BE8
update_npcs = 0x80039930; // type:func rom:0x14D30 update_npcs = 0x80039930; // type:func rom:0x14D30
npc_get_render_yaw = 0x80039DA4; // type:func rom:0x151A4 npc_get_render_yaw = 0x80039DA4; // type:func rom:0x151A4
appendGfx_npc = 0x80039FD0; // type:func rom:0x153D0 appendGfx_npc = 0x80039FD0; // type:func rom:0x153D0
@ -288,7 +288,7 @@ npc_draw_palswap_mode_4 = 0x8003BED8; // type:func rom:0x172D8
npc_set_decoration = 0x8003C3D8; // type:func rom:0x177D8 npc_set_decoration = 0x8003C3D8; // type:func rom:0x177D8
npc_remove_decoration = 0x8003C428; // type:func rom:0x17828 npc_remove_decoration = 0x8003C428; // type:func rom:0x17828
npc_update_decorations = 0x8003C444; // type:func rom:0x17844 npc_update_decorations = 0x8003C444; // type:func rom:0x17844
npc__remove_decoration = 0x8003C53C; // type:func rom:0x1793C npc_remove_decoration_impl = 0x8003C53C; // type:func rom:0x1793C
npc_reset_current_decoration = 0x8003C61C; // type:func rom:0x17A1C npc_reset_current_decoration = 0x8003C61C; // type:func rom:0x17A1C
npc_update_decoration_none = 0x8003C658; // type:func rom:0x17A58 npc_update_decoration_none = 0x8003C658; // type:func rom:0x17A58
npc_remove_decoration_none = 0x8003C660; // type:func rom:0x17A60 npc_remove_decoration_none = 0x8003C660; // type:func rom:0x17A60
@ -311,13 +311,13 @@ npc_find_standing_on_entity = 0x8003D1D4; // type:func rom:0x185D4
npc_get_collider_below = 0x8003D2F8; // type:func rom:0x186F8 npc_get_collider_below = 0x8003D2F8; // type:func rom:0x186F8
func_8003D3BC = 0x8003D3BC; // type:func rom:0x187BC func_8003D3BC = 0x8003D3BC; // type:func rom:0x187BC
func_8003D624 = 0x8003D624; // type:func rom:0x18A24 func_8003D624 = 0x8003D624; // type:func rom:0x18A24
func_8003D660 = 0x8003D660; // type:func rom:0x18A60 spawn_surface_effects = 0x8003D660; // type:func rom:0x18A60
func_8003D788 = 0x8003D788; // type:func rom:0x18B88 spawn_default_surface_effects = 0x8003D788; // type:func rom:0x18B88
func_8003DA38 = 0x8003DA38; // type:func rom:0x18E38 spawn_flower_surface_effects = 0x8003DA38; // type:func rom:0x18E38
func_8003DC38 = 0x8003DC38; // type:func rom:0x19038 spawn_cloud_surface_effects = 0x8003DC38; // type:func rom:0x19038
func_8003DFA0 = 0x8003DFA0; // type:func rom:0x193A0 spawn_snow_surface_effects = 0x8003DFA0; // type:func rom:0x193A0
func_8003E0D4 = 0x8003E0D4; // type:func rom:0x194D4 spawn_hedge_surface_effects = 0x8003E0D4; // type:func rom:0x194D4
func_8003E1D0 = 0x8003E1D0; // type:func rom:0x195D0 spawn_water_surface_effects = 0x8003E1D0; // type:func rom:0x195D0
COPY_set_defeated = 0x8003E2E0; // type:func rom:0x196E0 COPY_set_defeated = 0x8003E2E0; // type:func rom:0x196E0
init_encounter_status = 0x8003E338; // type:func rom:0x19738 init_encounter_status = 0x8003E338; // type:func rom:0x19738
clear_encounter_status = 0x8003E400; // type:func rom:0x19800 clear_encounter_status = 0x8003E400; // type:func rom:0x19800
@ -3012,7 +3012,7 @@ func_800EF3E4 = 0x800EF3E4; // type:func rom:0x88894
func_800EF414 = 0x800EF414; // type:func rom:0x888C4 func_800EF414 = 0x800EF414; // type:func rom:0x888C4
func_800EF43C = 0x800EF43C; // type:func rom:0x888EC func_800EF43C = 0x800EF43C; // type:func rom:0x888EC
partner_clear_player_tracking = 0x800EF45C; // type:func rom:0x8890C partner_clear_player_tracking = 0x800EF45C; // type:func rom:0x8890C
func_800EF4E0 = 0x800EF4E0; // type:func rom:0x88990 partner_force_player_flip_done = 0x800EF4E0; // type:func rom:0x88990
partner_enable_input = 0x800EF600; // type:func rom:0x88AB0 partner_enable_input = 0x800EF600; // type:func rom:0x88AB0
partner_disable_input = 0x800EF628; // type:func rom:0x88AD8 partner_disable_input = 0x800EF628; // type:func rom:0x88AD8
partner_do_player_collision = 0x800EF640; // type:func rom:0x88AF0 partner_do_player_collision = 0x800EF640; // type:func rom:0x88AF0
@ -3932,7 +3932,7 @@ delete_entity = 0x801106D0; // type:func rom:0xA6DD0
delete_entity_and_unload_data = 0x80110790; // type:func rom:0xA6E90 delete_entity_and_unload_data = 0x80110790; // type:func rom:0xA6E90
_delete_shadow = 0x8011085C; // type:func rom:0xA6F5C _delete_shadow = 0x8011085C; // type:func rom:0xA6F5C
entity_get_collision_flags = 0x801108B8; // type:func rom:0xA6FB8 entity_get_collision_flags = 0x801108B8; // type:func rom:0xA6FB8
entity_interacts_with_current_partner = 0x801109DC; // type:func rom:0xA70DC entity_try_partner_interaction_trigger = 0x801109DC; // type:func rom:0xA70DC
test_player_entity_aabb = 0x80110AAC; // type:func rom:0xA71AC test_player_entity_aabb = 0x80110AAC; // type:func rom:0xA71AC
is_player_action_state = 0x80110BB0; // type:func rom:0xA72B0 is_player_action_state = 0x80110BB0; // type:func rom:0xA72B0
entity_set_render_script = 0x80110BCC; // type:func rom:0xA72CC entity_set_render_script = 0x80110BCC; // type:func rom:0xA72CC
@ -4277,7 +4277,7 @@ test_item_player_collision = 0x80133B0C; // type:func rom:0xCA20C
test_item_entity_position = 0x80133FC8; // type:func rom:0xCA6C8 test_item_entity_position = 0x80133FC8; // type:func rom:0xCA6C8
set_item_entity_flags = 0x80134148; // type:func rom:0xCA848 set_item_entity_flags = 0x80134148; // type:func rom:0xCA848
clear_item_entity_flags = 0x80134188; // type:func rom:0xCA888 clear_item_entity_flags = 0x80134188; // type:func rom:0xCA888
func_801341B0 = 0x801341B0; // type:func rom:0xCA8B0 auto_collect_item_entity = 0x801341B0; // type:func rom:0xCA8B0
is_picking_up_item = 0x801341E8; // type:func rom:0xCA8E8 is_picking_up_item = 0x801341E8; // type:func rom:0xCA8E8
set_item_entity_position = 0x8013420C; // type:func rom:0xCA90C set_item_entity_position = 0x8013420C; // type:func rom:0xCA90C
set_current_item_entity_render_group = 0x80134230; // type:func rom:0xCA930 set_current_item_entity_render_group = 0x80134230; // type:func rom:0xCA930
@ -7744,30 +7744,30 @@ D_802BEB10_31B080 = 0x802BEB10; // type:data rom:0x31B080
D_802BEB98_31B108 = 0x802BEB98; // type:data rom:0x31B108 D_802BEB98_31B108 = 0x802BEB98; // type:data rom:0x31B108
D_802BEBA0_31B110 = 0x802BEBA0; // type:data rom:0x31B110 D_802BEBA0_31B110 = 0x802BEBA0; // type:data rom:0x31B110
D_802BEBA8_31B118 = 0x802BEBA8; // type:data rom:0x31B118 D_802BEBA8_31B118 = 0x802BEBA8; // type:data rom:0x31B118
func_802BD100_31B120 = 0x802BD100; // type:func rom:0x31B120 kooper_lateral_hit_interactable_entity = 0x802BD100; // type:func rom:0x31B120
D_802BEBB4 = 0x802BEBB4; // type:data rom:0x31B124 D_802BEBB4 = 0x802BEBB4; // type:data rom:0x31B124
D_802BEBB8 = 0x802BEBB8; // type:data rom:0x31B128 D_802BEBB8 = 0x802BEBB8; // type:data rom:0x31B128
D_802BEBBC = 0x802BEBBC; // type:data rom:0x31B12C D_802BEBBC = 0x802BEBBC; // type:data rom:0x31B12C
D_802BEBC0_31CBE0 = 0x802BEBC0; // type:data rom:0x31B130 D_802BEBC0_31CBE0 = 0x802BEBC0; // type:data rom:0x31B130
D_802BEBC4 = 0x802BEBC4; // type:data rom:0x31B134 D_802BEBC4 = 0x802BEBC4; // type:data rom:0x31B134
ParakarryTweesterPhysics = 0x802BEBC8; // type:data rom:0x31B138 ParakarryTweesterPhysics = 0x802BEBC8; // type:data rom:0x31B138
func_802BD144_31B164 = 0x802BD144; // type:func rom:0x31B164 kooper_vertical_hit_interactable_entity = 0x802BD144; // type:func rom:0x31B164
func_802BD17C_31B19C = 0x802BD17C; // type:func rom:0x31B19C kooper_check_for_item_collision = 0x802BD17C; // type:func rom:0x31B19C
world_kooper_init = 0x802BD200; // type:func rom:0x31B220 world_kooper_init = 0x802BD200; // type:func rom:0x31B220
KooperTakeOut = 0x802BD228; // type:func rom:0x31B248 KooperTakeOut = 0x802BD228; // type:func rom:0x31B248
KooperUpdate = 0x802BD260; // type:func rom:0x31B280 KooperUpdate = 0x802BD260; // type:func rom:0x31B280
func_802BD5F4_31B614 = 0x802BD5F4; // type:func rom:0x31B614 kooper_try_cancel_tweester = 0x802BD5F4; // type:func rom:0x31B614
func_802BD638_31B658 = 0x802BD638; // type:func rom:0x31B658 KooperUseAbility = 0x802BD638; // type:func rom:0x31B658
KooperPutAway = 0x802BE7E0; // type:func rom:0x31C800 KooperPutAway = 0x802BE7E0; // type:func rom:0x31C800
world_kooper_test_first_strike = 0x802BE818; // type:func rom:0x31C838 world_kooper_test_first_strike = 0x802BE818; // type:func rom:0x31C838
world_kooper_pre_battle = 0x802BEA24; // type:func rom:0x31CA44 world_kooper_pre_battle = 0x802BEA24; // type:func rom:0x31CA44
world_kooper_post_battle = 0x802BEB10; // type:func rom:0x31CB30 world_kooper_post_battle = 0x802BEB10; // type:func rom:0x31CB30
D_802BEB40_31CB60 = 0x802BEB40; // type:data rom:0x31CB60 ShellTossHitboxState = 0x802BEB40; // type:data rom:0x31CB60
world_kooper_take_out = 0x802BEB44; // type:data rom:0x31CB64 EVS_WorldKooperTakeOut = 0x802BEB44; // type:data rom:0x31CB64
KooperTweesterPhysicsPtr = 0x802BEB60; // type:data rom:0x31CB80 KooperTweesterPhysicsPtr = 0x802BEB60; // type:data rom:0x31CB80
world_kooper_update = 0x802BEB64; // type:data rom:0x31CB84 EVS_WorldKooperUpdate = 0x802BEB64; // type:data rom:0x31CB84
world_kooper_use_ability = 0x802BEB80; // type:data rom:0x31CBA0 EVS_KooperUseAbility = 0x802BEB80; // type:data rom:0x31CBA0
world_kooper_put_away = 0x802BEB9C; // type:data rom:0x31CBBC EVS_KooperPutAway = 0x802BEB9C; // type:data rom:0x31CBBC
D_802BEC18_31CC38 = 0x802BEC18; // type:data rom:0x31CC38 D_802BEC18_31CC38 = 0x802BEC18; // type:data rom:0x31CC38
D_802BEC20_31CC40 = 0x802BEC20; // type:data rom:0x31CC40 D_802BEC20_31CC40 = 0x802BEC20; // type:data rom:0x31CC40
D_802BEC28_31CC48 = 0x802BEC28; // type:data rom:0x31CC48 D_802BEC28_31CC48 = 0x802BEC28; // type:data rom:0x31CC48
@ -7775,16 +7775,16 @@ D_802BEC30_31CC50 = 0x802BEC30; // type:data rom:0x31CC50
D_802BEC38_31CC58 = 0x802BEC38; // type:data rom:0x31CC58 D_802BEC38_31CC58 = 0x802BEC38; // type:data rom:0x31CC58
D_802BEC40_31CC60 = 0x802BEC40; // type:data rom:0x31CC60 D_802BEC40_31CC60 = 0x802BEC40; // type:data rom:0x31CC60
func_802BD100_31CC70 = 0x802BD100; // type:func rom:0x31CC70 func_802BD100_31CC70 = 0x802BD100; // type:func rom:0x31CC70
D_802BEC54 = 0x802BEC54; // type:data rom:0x31CC74 KooperTriggeredBattle = 0x802BEC54; // type:data rom:0x31CC74
D_802BEC58 = 0x802BEC58; // type:data rom:0x31CC78 ShellTossPlayerFacingLeft = 0x802BEC58; // type:data rom:0x31CC78
D_802BEC5C = 0x802BEC5C; // type:data rom:0x31CC7C D_802BEC5C = 0x802BEC5C; // type:data rom:0x31CC7C
D_802BEC60 = 0x802BEC60; // type:data rom:0x31CC80 ShellTossKickFalling = 0x802BEC60; // type:data rom:0x31CC80
D_802BEC64 = 0x802BEC64; // type:data rom:0x31CC84 ShellTossControlsPlayer = 0x802BEC64; // type:data rom:0x31CC84
D_802BEC68 = 0x802BEC68; // type:data rom:0x31CC88 KooperHeldItemIdx = 0x802BEC68; // type:data rom:0x31CC88
D_802BEC6C = 0x802BEC6C; // type:data rom:0x31CC8C D_802BEC6C = 0x802BEC6C; // type:data rom:0x31CC8C
D_802BEC70 = 0x802BEC70; // type:data rom:0x31CC90 D_802BEC70 = 0x802BEC70; // type:data rom:0x31CC90
D_802BEC74 = 0x802BEC74; // type:data rom:0x31CC94 ShellTossPosY = 0x802BEC74; // type:data rom:0x31CC94
D_802BEC78 = 0x802BEC78; // type:data rom:0x31CC98 ShellTossPosZ = 0x802BEC78; // type:data rom:0x31CC98
D_802BEC7C = 0x802BEC7C; // type:data rom:0x31CC9C D_802BEC7C = 0x802BEC7C; // type:data rom:0x31CC9C
KooperTweesterPhysics = 0x802BEC80; // type:data rom:0x31CCA0 KooperTweesterPhysics = 0x802BEC80; // type:data rom:0x31CCA0
world_watt_dispose_static_effect = 0x802BD180; // type:func rom:0x31CCF0 world_watt_dispose_static_effect = 0x802BD180; // type:func rom:0x31CCF0
@ -27140,7 +27140,7 @@ D_802BE300 = 0x802BE300; // type:data
D_802BE920 = 0x802BE920; // type:data D_802BE920 = 0x802BE920; // type:data
D_802BEBB0 = 0x802BEBB0; // type:data D_802BEBB0 = 0x802BEBB0; // type:data
D_802BEBC0 = 0x802BEBC0; // type:data D_802BEBC0 = 0x802BEBC0; // type:data
D_802BEC50 = 0x802BEC50; // type:data KooperShellTossHoldTime = 0x802BEC50; // type:data
OriginalPlayerY = 0x802BFEE0; // type:data OriginalPlayerY = 0x802BFEE0; // type:data
D_802BFEF0 = 0x802BFEF0; // type:data D_802BFEF0 = 0x802BFEF0; // type:data
D_802BFEFC = 0x802BFEFC; // type:data D_802BFEFC = 0x802BFEFC; // type:data

View File

@ -148,7 +148,7 @@ dead_get_npc_unsafe = get_npc_unsafe + 0x39D0;
dead_get_npc_safe = get_npc_safe + 0x39EC; dead_get_npc_safe = get_npc_safe + 0x39EC;
dead_disable_npc_shadow = disable_npc_shadow + 0x39EC; dead_disable_npc_shadow = disable_npc_shadow + 0x39EC;
dead_set_npc_yaw = set_npc_yaw + 0x3A10; dead_set_npc_yaw = set_npc_yaw + 0x3A10;
dead_func_8003D660 = func_8003D660 + 0x3A20; dead_spawn_surface_effects = spawn_surface_effects + 0x3A20;
dead_get_enemy = get_enemy + 0x3E0C; dead_get_enemy = get_enemy + 0x3E0C;
dead_SetEncounterStatusFlags = SetEncounterStatusFlags + 0x40A0; dead_SetEncounterStatusFlags = SetEncounterStatusFlags + 0x40A0;
dead_IsStartingConversation = IsStartingConversation + 0x40A0; dead_IsStartingConversation = IsStartingConversation + 0x40A0;