mirror of
https://github.com/pmret/papermario.git
synced 2024-11-18 00:42:34 +01:00
world kooper cleanup (#963)
* kooper cleanup * second pass --------- Co-authored-by: HailSanta <Hail2Santa@gmail.com>
This commit is contained in:
parent
209457a32a
commit
288bb8511f
@ -1514,7 +1514,7 @@ typedef struct ItemEntityPhysicsData {
|
||||
/* 0x10 */ f32 velx;
|
||||
/* 0x14 */ f32 velz;
|
||||
/* 0x18 */ f32 moveAngle;
|
||||
/* 0x1C */ s32 unk_1C;
|
||||
/* 0x1C */ s32 timeLeft;
|
||||
/* 0x20 */ s32 unk_20;
|
||||
} ItemEntityPhysicsData; // size = 0x24
|
||||
|
||||
|
@ -71,7 +71,7 @@
|
||||
#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 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 gOverrideFlags dead_gOverrideFlags
|
||||
#define set_message_msg dead_set_message_msg
|
||||
|
@ -3245,7 +3245,7 @@ enum ItemEntityFlags {
|
||||
ITEM_ENTITY_FLAG_10 = 0x00000010,
|
||||
ITEM_ENTITY_FLAG_HIDDEN = 0x00000040, // do not render; player cant pickup
|
||||
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_400 = 0x00000400,
|
||||
ITEM_ENTITY_FLAG_800 = 0x00000800,
|
||||
@ -3258,7 +3258,7 @@ enum ItemEntityFlags {
|
||||
ITEM_ENTITY_FLAG_40000 = 0x00040000,
|
||||
ITEM_ENTITY_FLAG_TRANSPARENT = 0x00080000,
|
||||
ITEM_ENTITY_FLAG_100000 = 0x00100000,
|
||||
ITEM_ENTITY_FLAG_200000 = 0x00200000,
|
||||
ITEM_ENTITY_FLAG_CANT_COLLECT = 0x00200000,
|
||||
ITEM_ENTITY_FLAG_400000 = 0x00400000,
|
||||
ITEM_ENTITY_FLAG_800000 = 0x00800000,
|
||||
ITEM_ENTITY_FLAG_1000000 = 0x01000000,
|
||||
@ -3415,8 +3415,8 @@ enum EventSupressFlags {
|
||||
enum PartnerActions {
|
||||
PARTNER_ACTION_NONE = 0, // generic state
|
||||
PARTNER_ACTION_USE = 1, // generic state
|
||||
PARTNER_ACTION_KOOPER_1 = 1,
|
||||
PARTNER_ACTION_KOOPER_2 = 2,
|
||||
PARTNER_ACTION_KOOPER_GATHER = 1,
|
||||
PARTNER_ACTION_KOOPER_TOSS = 2,
|
||||
PARTNER_ACTION_BOMBETTE_1 = 1,
|
||||
PARTNER_ACTION_BOMBETTE_2 = 2,
|
||||
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_DONT_UPDATE_SHADOW_Y = 0x00000400, // When shadow raycasting is off, only X and Z update as NPC moves
|
||||
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_FORWARD_WITH_WORLD = 0x00004000, // Colliding with world directly in front of NPC
|
||||
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
|
||||
enum ColliderFlags {
|
||||
COLLIDER_FLAGS_UPPER_MASK = 0x7FFFFE00, // map data dumper needs this to be first
|
||||
|
@ -461,9 +461,9 @@ void npc_do_other_npc_collision(Npc* npc);
|
||||
/// @returns TRUE if a collision occurred
|
||||
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.
|
||||
void update_npcs(void);
|
||||
@ -528,7 +528,7 @@ void npc_remove_decoration(Npc* npc, s32 idx);
|
||||
|
||||
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);
|
||||
|
||||
@ -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_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().
|
||||
void COPY_set_defeated(s32 mapID, s32 encounterID);
|
||||
|
@ -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);
|
||||
|
||||
if (npc->moveSpeed > 8.0 && !(gGameStatusPtr->frameCounter % 5)) {
|
||||
|
@ -158,7 +158,7 @@ ApiStatus func_8005DD54(Evt* script, s32 isInitialCall) {
|
||||
}
|
||||
|
||||
ApiStatus func_8005DDF0(Evt* script, s32 isInitialCall) {
|
||||
if (~gCurrentEncounter.unk_08) {
|
||||
if (gCurrentEncounter.unk_08 != -1) {
|
||||
return ApiStatus_DONE1;
|
||||
} else {
|
||||
return ApiStatus_BLOCK;
|
||||
|
@ -130,7 +130,7 @@ void npc_follow_npc(Npc* npc) {
|
||||
}
|
||||
|
||||
npc->currentAnim = followData->anims->run;
|
||||
if (!(npc->flags & NPC_FLAG_FALLING)) {
|
||||
if (!(npc->flags & NPC_FLAG_GROUNDED)) {
|
||||
npc->currentAnim = followData->anims->fall;
|
||||
}
|
||||
|
||||
@ -177,7 +177,7 @@ void npc_follow_npc(Npc* npc) {
|
||||
historyPoint = &followData->moveHistory[followData->targetPointIdx];
|
||||
targetX = historyPoint->pos.x;
|
||||
targetZ = historyPoint->pos.z;
|
||||
if (npc->flags & NPC_FLAG_FALLING) {
|
||||
if (npc->flags & NPC_FLAG_GROUNDED) {
|
||||
if (historyPoint->isAirborne) {
|
||||
followData->followState = NPC_FOLLOW_STATE_JUMP;
|
||||
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->yaw = 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;
|
||||
}
|
||||
break;
|
||||
|
77
src/C50A0.c
77
src/C50A0.c
@ -1797,8 +1797,8 @@ s32 test_item_player_collision(ItemEntity* item) {
|
||||
|
||||
actionState = playerStatus->actionState;
|
||||
|
||||
if (item->flags & ITEM_ENTITY_FLAG_100) {
|
||||
item->flags &= ~ITEM_ENTITY_FLAG_100;
|
||||
if (item->flags & ITEM_ENTITY_FLAG_AUTO_COLLECT) {
|
||||
item->flags &= ~ITEM_ENTITY_FLAG_AUTO_COLLECT;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
@ -1810,7 +1810,7 @@ s32 test_item_player_collision(ItemEntity* item) {
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (item->flags & ITEM_ENTITY_FLAG_200000) {
|
||||
if (item->flags & ITEM_ENTITY_FLAG_CANT_COLLECT) {
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
@ -1949,7 +1949,7 @@ s32 test_item_entity_position(f32 x, f32 y, f32 z, f32 dist) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (item->flags & ITEM_ENTITY_FLAG_200000) {
|
||||
if (item->flags & ITEM_ENTITY_FLAG_CANT_COLLECT) {
|
||||
continue;
|
||||
}
|
||||
|
||||
@ -1967,7 +1967,7 @@ void set_item_entity_flags(s32 index, s32 flags) {
|
||||
ItemEntity* itemEntity = gCurrentItemEntities[index];
|
||||
|
||||
itemEntity->flags |= flags;
|
||||
if (itemEntity->flags & ITEM_ENTITY_FLAG_200000) {
|
||||
if (itemEntity->flags & ITEM_ENTITY_FLAG_CANT_COLLECT) {
|
||||
D_801565A8 = 1;
|
||||
}
|
||||
}
|
||||
@ -1978,10 +1978,10 @@ void clear_item_entity_flags(s32 index, s32 flags) {
|
||||
itemEntity->flags &= ~flags;
|
||||
}
|
||||
|
||||
void func_801341B0(s32 index) {
|
||||
void auto_collect_item_entity(s32 index) {
|
||||
ItemEntity* itemEntity = gCurrentItemEntities[index];
|
||||
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
|
||||
@ -2144,22 +2144,22 @@ void update_item_entity_collectable(ItemEntity* item) {
|
||||
}
|
||||
|
||||
if (item->spawnType != ITEM_SPAWN_MODE_TOSS_FADE1) {
|
||||
physData->unk_1C = 180;
|
||||
physData->unk_20 = 0;
|
||||
physData->timeLeft = 180;
|
||||
physData->unk_20 = FALSE;
|
||||
} else {
|
||||
if (!(item->flags & ITEM_ENTITY_FLAG_400000)) {
|
||||
physData->unk_1C = 0x11;
|
||||
physData->timeLeft = 17;
|
||||
} else {
|
||||
physData->unk_1C = 0x14;
|
||||
physData->timeLeft = 20;
|
||||
}
|
||||
physData->unk_20 = 0;
|
||||
physData->unk_20 = FALSE;
|
||||
physData->verticalVelocity = 15.0f;
|
||||
physData->gravity = 1.6f;
|
||||
}
|
||||
|
||||
if (item->spawnType == ITEM_SPAWN_MODE_ITEM_BLOCK_SPAWN_ALWAYS) {
|
||||
physData->unk_1C = 60;
|
||||
physData->unk_20 = 0;
|
||||
physData->timeLeft = 60;
|
||||
physData->unk_20 = FALSE;
|
||||
physData->velx = 0.0f;
|
||||
physData->velz = 0.0f;
|
||||
}
|
||||
@ -2168,14 +2168,14 @@ void update_item_entity_collectable(ItemEntity* item) {
|
||||
physData->verticalVelocity = 0.0f;
|
||||
physData->velx = 0.0f;
|
||||
physData->velz = 0.0f;
|
||||
physData->unk_20 = 1;
|
||||
physData->unk_20 = TRUE;
|
||||
}
|
||||
|
||||
if (item->spawnType == ITEM_SPAWN_MODE_FIXED_SPAWN_ALWAYS) {
|
||||
physData->verticalVelocity = 0.0f;
|
||||
physData->velx = 0.0f;
|
||||
physData->velz = 0.0f;
|
||||
physData->unk_20 = 1;
|
||||
physData->unk_20 = TRUE;
|
||||
}
|
||||
|
||||
if (item->flags & ITEM_ENTITY_FLAG_800) {
|
||||
@ -2185,29 +2185,28 @@ void update_item_entity_collectable(ItemEntity* item) {
|
||||
break;
|
||||
case 1:
|
||||
physData = item->physicsData;
|
||||
if (item->spawnType != ITEM_SPAWN_MODE_ITEM_BLOCK_SPAWN_ALWAYS &&
|
||||
item->spawnType != ITEM_SPAWN_MODE_TOSS_FADE1 &&
|
||||
physData->unk_20 != 0 &&
|
||||
test_item_player_collision(item))
|
||||
{
|
||||
if (item->spawnType != ITEM_SPAWN_MODE_ITEM_BLOCK_SPAWN_ALWAYS
|
||||
&& item->spawnType != ITEM_SPAWN_MODE_TOSS_FADE1
|
||||
&& physData->unk_20
|
||||
&& test_item_player_collision(item)
|
||||
) {
|
||||
item->state = 3;
|
||||
break;
|
||||
}
|
||||
|
||||
if (!(item->flags & ITEM_ENTITY_FLAG_NEVER_VANISH)) {
|
||||
if (!(gOverrideFlags & (GLOBAL_OVERRIDES_200 | GLOBAL_OVERRIDES_DISABLE_BATTLES))) {
|
||||
if (!(item->flags & ITEM_ENTITY_FLAG_200000)) {
|
||||
physData->unk_1C--;
|
||||
if (physData->unk_1C < 0) {
|
||||
item->state = 2;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!(item->flags & ITEM_ENTITY_FLAG_NEVER_VANISH)
|
||||
&& !(gOverrideFlags & (GLOBAL_OVERRIDES_200 | GLOBAL_OVERRIDES_DISABLE_BATTLES))
|
||||
&& !(item->flags & ITEM_ENTITY_FLAG_CANT_COLLECT)
|
||||
) {
|
||||
physData->timeLeft--;
|
||||
if (physData->timeLeft < 0) {
|
||||
item->state = 2;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
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;
|
||||
if (physData->verticalVelocity < -16.0) {
|
||||
physData->verticalVelocity = -16.0f;
|
||||
@ -2236,7 +2235,7 @@ void update_item_entity_collectable(ItemEntity* item) {
|
||||
outZ = item->position.z;
|
||||
outDepth = temp + physData->verticalVelocity;
|
||||
|
||||
if (physData->unk_20 == 0) {
|
||||
if (!physData->unk_20) {
|
||||
hit = npc_raycast_up(COLLISION_CHANNEL_20000, &outX, &outY, &outZ, &outDepth);
|
||||
} else {
|
||||
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;
|
||||
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);
|
||||
} else {
|
||||
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 &&
|
||||
physData->verticalVelocity <= 0.0)
|
||||
{
|
||||
physData->unk_20 = 1;
|
||||
physData->unk_20 = TRUE;
|
||||
if (item->spawnType != ITEM_SPAWN_MODE_TOSS_FADE1) {
|
||||
outX = item->position.x;
|
||||
outY = (item->position.y - physData->verticalVelocity) + 12.0f;
|
||||
outZ = item->position.z;
|
||||
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);
|
||||
} else {
|
||||
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_TOSS_FADE1) {
|
||||
if (physicsData->unk_1C < 60) {
|
||||
if ((itemEntity->flags & ITEM_ENTITY_FLAG_200000) || ((gGameStatusPtr->frameCounter + flag) & 1)) {
|
||||
if (physicsData->timeLeft < 60) {
|
||||
if ((itemEntity->flags & ITEM_ENTITY_FLAG_CANT_COLLECT) || ((gGameStatusPtr->frameCounter + flag) & 1)) {
|
||||
itemEntity->flags &= ~ITEM_ENTITY_FLAG_HIDDEN;
|
||||
} else {
|
||||
itemEntity->flags |= ITEM_ENTITY_FLAG_HIDDEN;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (physicsData->unk_1C < 10) {
|
||||
itemEntity->alpha = physicsData->unk_1C * 28;
|
||||
if (physicsData->timeLeft < 10) {
|
||||
itemEntity->alpha = physicsData->timeLeft * 28;
|
||||
itemEntity->flags |= ITEM_ENTITY_FLAG_TRANSPARENT;
|
||||
}
|
||||
}
|
||||
|
@ -1745,8 +1745,8 @@ s32 entity_get_collision_flags(Entity* entity) {
|
||||
return entityFlags;
|
||||
}
|
||||
|
||||
s32 entity_interacts_with_current_partner(s32 entityIdx) {
|
||||
s32 ret = FALSE;
|
||||
s32 entity_try_partner_interaction_trigger(s32 entityIdx) {
|
||||
s32 interacted = FALSE;
|
||||
u32 entityType = get_entity_type(entityIdx);
|
||||
s32 partnerID = get_current_partner_id();
|
||||
Entity* entity;
|
||||
@ -1772,7 +1772,7 @@ s32 entity_interacts_with_current_partner(s32 entityIdx) {
|
||||
case ENTITY_TYPE_BOMBABLE_ROCK:
|
||||
entity = get_entity_by_index(entityIdx);
|
||||
entity->flags |= ENTITY_FLAG_PARTNER_COLLISION;
|
||||
ret = TRUE;
|
||||
interacted = TRUE;
|
||||
}
|
||||
break;
|
||||
case PARTNER_KOOPER:
|
||||
@ -1795,11 +1795,11 @@ s32 entity_interacts_with_current_partner(s32 entityIdx) {
|
||||
case ENTITY_TYPE_SUPER_BLOCK:
|
||||
entity = get_entity_by_index(entityIdx);
|
||||
entity->flags |= ENTITY_FLAG_PARTNER_COLLISION;
|
||||
ret = TRUE;
|
||||
interacted = TRUE;
|
||||
}
|
||||
break;
|
||||
}
|
||||
return ret;
|
||||
return interacted;
|
||||
}
|
||||
|
||||
s32 test_player_entity_aabb(Entity* entity) {
|
||||
|
@ -284,7 +284,7 @@ void entity_CymbalPlant_idle(Entity* entity) {
|
||||
data->unk_01++;
|
||||
data->state++;
|
||||
disable_player_input();
|
||||
set_action_state(0);
|
||||
set_action_state(ACTION_STATE_IDLE);
|
||||
play_model_animation(entity->virtualModelIndex, Entity_CymbalPlant_AnimationGrab);
|
||||
sfx_play_sound(SOUND_F2);
|
||||
func_802BB8D4_E2E204(entity);
|
||||
|
@ -269,9 +269,9 @@ ApiStatus NpcMoveTo(Evt* script, s32 isInitialCall) {
|
||||
npc_move_heading(npc, npc->moveSpeed, npc->yaw);
|
||||
|
||||
if (npc->moveSpeed < 4.0) {
|
||||
func_8003D660(npc, 0);
|
||||
spawn_surface_effects(npc, SURFACE_INTERACT_WALK);
|
||||
} 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);
|
||||
@ -351,7 +351,7 @@ ApiStatus _npc_jump_to(Evt* script, s32 isInitialCall, s32 snapYaw) {
|
||||
npc->pos.y = npc->moveToPos.y;
|
||||
npc->pos.z = npc->moveToPos.z;
|
||||
npc->flags &= ~NPC_FLAG_JUMPING;
|
||||
func_8003D660(npc, 2);
|
||||
spawn_surface_effects(npc, SURFACE_INTERACT_LAND);
|
||||
return ApiStatus_DONE1;
|
||||
}
|
||||
return ApiStatus_BLOCK;
|
||||
|
@ -313,7 +313,7 @@ s32 player_jump(Evt* script, s32 isInitialCall, s32 mode) {
|
||||
anim = ANIM_Mario1_TiredIdle;
|
||||
}
|
||||
suggest_player_anim_allow_backward(anim);
|
||||
func_8003D660(playerNpc, 2);
|
||||
spawn_surface_effects(playerNpc, SURFACE_INTERACT_LAND);
|
||||
}
|
||||
|
||||
if (mode == 0 || mode == 2) {
|
||||
|
203
src/npc.c
203
src/npc.c
@ -540,82 +540,81 @@ s32 npc_do_player_collision(Npc* npc) {
|
||||
INCLUDE_ASM(s32, "npc", npc_do_player_collision, Npc* npc);
|
||||
#endif
|
||||
|
||||
void npc_do_gravity(Npc* npc) {
|
||||
if (npc->flags & NPC_FLAG_GRAVITY) {
|
||||
if (npc->flags & NPC_FLAG_JUMPING) {
|
||||
npc->flags &= ~NPC_FLAG_FALLING;
|
||||
} else {
|
||||
f32 xTemp;
|
||||
f32 yTemp;
|
||||
f32 zTemp;
|
||||
f32 length, oldLength;
|
||||
s32 hit;
|
||||
// update NPC position using gravitational acceleration = 1.0
|
||||
// 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;
|
||||
}
|
||||
|
||||
npc->jumpScale = 1.0f;
|
||||
xTemp = npc->pos.x;
|
||||
zTemp = npc->pos.z;
|
||||
if (npc->flags & NPC_FLAG_JUMPING) {
|
||||
npc->flags &= ~NPC_FLAG_GROUNDED;
|
||||
return;
|
||||
}
|
||||
|
||||
npc->jumpVelocity -= npc->jumpScale;
|
||||
npc->pos.y += npc->jumpVelocity;
|
||||
oldLength = length = fabsf(npc->jumpVelocity) + 16.0f;
|
||||
npc->jumpScale = 1.0f;
|
||||
npc->jumpVelocity -= npc->jumpScale;
|
||||
npc->pos.y += npc->jumpVelocity;
|
||||
|
||||
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)) {
|
||||
hit = npc_raycast_down_sides(npc->collisionChannel, &xTemp, &yTemp, &zTemp, &length);
|
||||
} else {
|
||||
hit = npc_raycast_down_around(npc->collisionChannel, &xTemp, &yTemp, &zTemp, &length, npc->yaw,
|
||||
npc->collisionRadius);
|
||||
}
|
||||
if (!(npc->flags & NPC_FLAG_PARTNER)) {
|
||||
hitID = npc_raycast_down_sides(npc->collisionChannel, &x, &y, &z, &length);
|
||||
} else {
|
||||
hitID = npc_raycast_down_around(npc->collisionChannel, &x, &y, &z, &length, npc->yaw, npc->collisionRadius);
|
||||
}
|
||||
|
||||
if (hit && length <= oldLength) {
|
||||
npc->jumpVelocity = 0.0f;
|
||||
npc->flags |= NPC_FLAG_FALLING;
|
||||
npc->pos.y = yTemp;
|
||||
npc->currentFloor = NpcHitQueryColliderID;
|
||||
} else {
|
||||
npc->flags &= ~NPC_FLAG_FALLING;
|
||||
}
|
||||
}
|
||||
if (hitID && length <= testLength) {
|
||||
npc->jumpVelocity = 0.0f;
|
||||
npc->flags |= NPC_FLAG_GROUNDED;
|
||||
npc->pos.y = y;
|
||||
npc->currentFloor = NpcHitQueryColliderID;
|
||||
} else {
|
||||
npc->flags &= ~NPC_FLAG_GROUNDED;
|
||||
}
|
||||
}
|
||||
|
||||
s32 func_800397E8(Npc* npc, f32 velocity) {
|
||||
if (!(npc->flags & (NPC_FLAG_GRAVITY | NPC_FLAG_8))) {
|
||||
f32 x;
|
||||
f32 y;
|
||||
f32 z;
|
||||
f32 length;
|
||||
f32 testLength;
|
||||
s32 phi_v0;
|
||||
|
||||
if (npc->flags & NPC_FLAG_JUMPING) {
|
||||
npc->flags &= ~NPC_FLAG_FALLING;
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
length = testLength = fabsf(velocity) + 16;
|
||||
x = npc->pos.x;
|
||||
y = npc->pos.y + 13;
|
||||
z = npc->pos.z;
|
||||
|
||||
if (!(npc->flags & NPC_FLAG_PARTNER)) {
|
||||
phi_v0 = npc_raycast_down_sides(npc->collisionChannel, &x, &y, &z, &length);
|
||||
} else {
|
||||
phi_v0 = npc_raycast_down_around(npc->collisionChannel, &x, &y, &z, &length, npc->yaw, npc->collisionRadius);
|
||||
}
|
||||
|
||||
if (phi_v0 != 0 && length <= testLength) {
|
||||
npc->pos.y = y;
|
||||
npc->currentFloor = NpcHitQueryColliderID;
|
||||
npc->flags |= NPC_FLAG_FALLING;
|
||||
return TRUE;
|
||||
}
|
||||
} else {
|
||||
// perform only collision traces and snapping to ground from gravity code
|
||||
s32 npc_try_snap_to_ground(Npc* npc, f32 velocity) {
|
||||
f32 x, y, z, testLength;
|
||||
f32 length;
|
||||
s32 hitID;
|
||||
|
||||
if (npc->flags & (NPC_FLAG_GRAVITY | NPC_FLAG_8)) {
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
npc->flags &= ~NPC_FLAG_FALLING;
|
||||
if (npc->flags & NPC_FLAG_JUMPING) {
|
||||
npc->flags &= ~NPC_FLAG_GROUNDED;
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
length = testLength = fabsf(velocity) + 16;
|
||||
x = npc->pos.x;
|
||||
y = npc->pos.y + 13;
|
||||
z = npc->pos.z;
|
||||
|
||||
if (!(npc->flags & NPC_FLAG_PARTNER)) {
|
||||
hitID = npc_raycast_down_sides(npc->collisionChannel, &x, &y, &z, &length);
|
||||
} else {
|
||||
hitID = npc_raycast_down_around(npc->collisionChannel, &x, &y, &z, &length, npc->yaw, npc->collisionRadius);
|
||||
}
|
||||
|
||||
if (hitID != 0 && length <= testLength) {
|
||||
npc->pos.y = y;
|
||||
npc->currentFloor = NpcHitQueryColliderID;
|
||||
npc->flags |= NPC_FLAG_GROUNDED;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
npc->flags &= ~NPC_FLAG_GROUNDED;
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
@ -650,8 +649,8 @@ void update_npcs(void) {
|
||||
npc->flags &= ~(NPC_FLAG_COLLDING_FORWARD_WITH_WORLD | NPC_FLAG_COLLDING_WITH_WORLD);
|
||||
|
||||
npc_do_world_collision(npc);
|
||||
npc_do_gravity(npc);
|
||||
func_800397E8(npc, 0.0f);
|
||||
npc_try_apply_gravity(npc);
|
||||
npc_try_snap_to_ground(npc, 0.0f);
|
||||
npc_do_player_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;
|
||||
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);
|
||||
}
|
||||
}
|
||||
@ -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) {
|
||||
npc__remove_decoration(npc, idx);
|
||||
npc_remove_decoration_impl(npc, idx);
|
||||
npc->decorationType[idx] = decorationType;
|
||||
npc->changedDecoration[idx] = 1;
|
||||
npc->decorationInitialised[idx] = 0;
|
||||
}
|
||||
|
||||
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) {
|
||||
@ -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]) {
|
||||
case 0:
|
||||
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);
|
||||
}
|
||||
|
||||
void func_8003D660(Npc* npc, s32 arg1) {
|
||||
//TODO begin split for npc_surfaces
|
||||
|
||||
void spawn_surface_effects(Npc* npc, SurfaceInteractMode mode) {
|
||||
PartnerActionStatus* temp = &gPartnerActionStatus;
|
||||
|
||||
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;
|
||||
switch (surfaceType) {
|
||||
case SURFACE_TYPE_FLOWERS:
|
||||
func_8003DA38(npc, arg1);
|
||||
return;
|
||||
spawn_flower_surface_effects(npc, mode);
|
||||
break;
|
||||
case SURFACE_TYPE_CLOUD:
|
||||
func_8003DC38(npc, arg1);
|
||||
return;
|
||||
spawn_cloud_surface_effects(npc, mode);
|
||||
break;
|
||||
case SURFACE_TYPE_SNOW:
|
||||
if ((temp->partnerActionState == PARTNER_ACTION_NONE) || (temp->actingPartner != PARTNER_LAKILESTER)) {
|
||||
func_8003DFA0(npc, arg1);
|
||||
return;
|
||||
spawn_snow_surface_effects(npc, mode);
|
||||
}
|
||||
break;
|
||||
case SURFACE_TYPE_HEDGES:
|
||||
func_8003E0D4(npc, arg1);
|
||||
return;
|
||||
spawn_hedge_surface_effects(npc, mode);
|
||||
break;
|
||||
case SURFACE_TYPE_WATER:
|
||||
func_8003E1D0(npc, arg1);
|
||||
return;
|
||||
spawn_water_surface_effects(npc, mode);
|
||||
break;
|
||||
case SURFACE_TYPE_SPIKES:
|
||||
case SURFACE_TYPE_LAVA:
|
||||
case SURFACE_TYPE_DOCK_WALL:
|
||||
case SURFACE_TYPE_SLIDE:
|
||||
default:
|
||||
func_8003D788(npc, arg1);
|
||||
return;
|
||||
spawn_default_surface_effects(npc, mode);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static const f32 padding[2] = { 0.0f, 0.0f }; // todo remove when below funcs are decompiled
|
||||
|
||||
void func_8003D788(Npc* npc, s32 arg1) {
|
||||
s32 phi_a2;
|
||||
void spawn_default_surface_effects(Npc* npc, SurfaceInteractMode mode) {
|
||||
s32 mapIsStarWay;
|
||||
f32 sinTheta;
|
||||
f32 cosTheta;
|
||||
|
||||
phi_a2 = 0;
|
||||
mapIsStarWay = FALSE;
|
||||
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 y = npc->pos.y + 0.0f;
|
||||
f32 z = npc->pos.z;
|
||||
|
||||
if (phi_a2 == 0) {
|
||||
if (!mapIsStarWay) {
|
||||
fx_landing_dust(0, x, y, z, D_80077C10);
|
||||
D_80077C10 = clamp_angle(D_80077C10 + 35.0f);
|
||||
} else {
|
||||
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) {
|
||||
D_80077C14 = 0;
|
||||
if (phi_a2 == 0) {
|
||||
if (!mapIsStarWay) {
|
||||
sin_cos_rad(DEG_TO_RAD(clamp_angle(-npc->yaw)), &sinTheta, &cosTheta);
|
||||
fx_walking_dust(0, npc->pos.x + (npc->collisionRadius * sinTheta * 0.2f), npc->pos.y + 1.5f,
|
||||
npc->pos.z + (npc->collisionRadius * cosTheta * 0.2f), sinTheta, cosTheta);
|
||||
@ -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 sinTheta;
|
||||
f32 cosTheta;
|
||||
f32 x, y, z;
|
||||
|
||||
if (arg1 == 2 && D_80077C1E == 5) {
|
||||
if (mode == SURFACE_INTERACT_LAND && D_80077C1E == 5) {
|
||||
x = npc->pos.x;
|
||||
y = npc->pos.y + + 14.0f;
|
||||
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;
|
||||
f32 xTemp, yTemp, zTemp;
|
||||
f32 xTemp2, yTemp2, zTemp2;
|
||||
@ -2283,7 +2281,7 @@ void func_8003DC38(Npc* npc, s32 arg1) {
|
||||
s32 i;
|
||||
|
||||
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);
|
||||
|
||||
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) {
|
||||
f32 temp_f20;
|
||||
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) {
|
||||
f32 theta;
|
||||
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) {
|
||||
f32 temp_f20;
|
||||
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) {
|
||||
EncounterStatus* currentEncounter = &gCurrentEncounter;
|
||||
s32 encounterIdx = encounterID / 32;
|
||||
|
@ -189,7 +189,7 @@ EvtScript N(EVS_NpcInit_Tubba_Floor1) = {
|
||||
|
||||
EvtScript N(EVS_NpcInit_Sentinel_01) = {
|
||||
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(EnableNpcShadow, NPC_SELF, FALSE)
|
||||
EVT_CALL(SetNpcAnimation, NPC_SELF, ANIM_Sentinel_Anim01)
|
||||
@ -203,7 +203,7 @@ EvtScript N(EVS_NpcInit_Sentinel_01) = {
|
||||
|
||||
EvtScript N(EVS_NpcInit_Sentinel_02) = {
|
||||
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(EnableNpcShadow, NPC_SELF, FALSE)
|
||||
EVT_CALL(SetNpcAnimation, NPC_SELF, ANIM_Sentinel_Anim01)
|
||||
@ -217,7 +217,7 @@ EvtScript N(EVS_NpcInit_Sentinel_02) = {
|
||||
|
||||
EvtScript N(EVS_NpcInit_Sentinel_03) = {
|
||||
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(EnableNpcShadow, NPC_SELF, FALSE)
|
||||
EVT_CALL(SetNpcAnimation, NPC_SELF, ANIM_Sentinel_Anim01)
|
||||
@ -231,7 +231,7 @@ EvtScript N(EVS_NpcInit_Sentinel_03) = {
|
||||
|
||||
EvtScript N(EVS_NpcInit_Sentinel_04) = {
|
||||
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(EnableNpcShadow, NPC_SELF, FALSE)
|
||||
EVT_CALL(SetNpcAnimation, NPC_SELF, ANIM_Sentinel_Anim01)
|
||||
|
@ -22,7 +22,7 @@ BSS u8 oldEnvR, oldEnvG, oldEnvB;
|
||||
#include "world/common/util/ChangeNpcToPartner.inc.c"
|
||||
|
||||
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;
|
||||
} else {
|
||||
return ApiStatus_BLOCK;
|
||||
|
@ -132,9 +132,9 @@ void N(AvoidPlayerAI_Chase)(Evt* script, MobileAISettings* npcAISettings, EnemyD
|
||||
} else {
|
||||
if (npc->currentAnim != enemy->animList[ENEMY_ANIM_INDEX_MELEE_PRE]) {
|
||||
if (npc->moveSpeed < 4.0) {
|
||||
func_8003D660(npc, 0);
|
||||
spawn_surface_effects(npc, SURFACE_INTERACT_WALK);
|
||||
} else {
|
||||
func_8003D660(npc, 1);
|
||||
spawn_surface_effects(npc, SURFACE_INTERACT_RUN);
|
||||
}
|
||||
npc_move_heading(npc, npc->moveSpeed, npc->yaw);
|
||||
}
|
||||
|
@ -185,7 +185,7 @@ void N(CleftAI_Tackle)(Evt* script, MobileAISettings* aiSettings, EnemyDetectVol
|
||||
f32 posX, posY, posZ;
|
||||
s32 phi_s1 = FALSE;
|
||||
|
||||
func_8003D660(npc, 1);
|
||||
spawn_surface_effects(npc, SURFACE_INTERACT_RUN);
|
||||
npc_move_heading(npc, npc->moveSpeed, npc->yaw);
|
||||
|
||||
if (is_point_within_region(enemy->territory->wander.detectShape,
|
||||
|
@ -121,7 +121,7 @@ void N(GuardAI_Chase)(Evt* script, GuardAISettings* aiSettings, EnemyDetectVolum
|
||||
script->AI_TEMP_STATE = AI_STATE_LOSE_PLAYER;
|
||||
} else {
|
||||
npc_move_heading(npc, npc->moveSpeed, npc->yaw);
|
||||
func_8003D660(npc, 1);
|
||||
spawn_surface_effects(npc, SURFACE_INTERACT_RUN);
|
||||
npc->duration--;
|
||||
if (npc->duration == 0) {
|
||||
script->AI_TEMP_STATE = AI_STATE_CHASE_INIT;
|
||||
|
@ -114,7 +114,7 @@ static void N(MontyMoleAI_Wander)(Evt* script, MobileAISettings* aiSettings, Ene
|
||||
}
|
||||
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.z = npc->pos.z;
|
||||
}
|
||||
|
@ -69,9 +69,9 @@ void N(PatrolAI_Move)(Evt* script, MobileAISettings* aiSettings, EnemyDetectVolu
|
||||
|
||||
if (npc->turnAroundYawAdjustment == 0) {
|
||||
if (npc->moveSpeed < 4.0) {
|
||||
func_8003D660(npc, 0);
|
||||
spawn_surface_effects(npc, SURFACE_INTERACT_WALK);
|
||||
} else {
|
||||
func_8003D660(npc, 1);
|
||||
spawn_surface_effects(npc, SURFACE_INTERACT_RUN);
|
||||
}
|
||||
//TODO strange match -- index and array are backwards!
|
||||
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;
|
||||
script->AI_TEMP_STATE = AI_STATE_LOSE_PLAYER;
|
||||
} else {
|
||||
func_8003D660(npc, 1);
|
||||
spawn_surface_effects(npc, SURFACE_INTERACT_RUN);
|
||||
npc_move_heading(npc, npc->moveSpeed, npc->yaw);
|
||||
if (npc->duration > 0) {
|
||||
npc->duration--;
|
||||
|
@ -30,7 +30,7 @@ API_CALLABLE(N(func_802408B4_97BEE4)) {
|
||||
npc->verticalRenderOffset = 0;
|
||||
}
|
||||
|
||||
if (npc->flags & NPC_FLAG_FALLING) {
|
||||
if (npc->flags & NPC_FLAG_GROUNDED) {
|
||||
currentEncounter->encounterList[enemy->encounterIndex]->battle = enemy->varTable[0];
|
||||
return ApiStatus_DONE2;
|
||||
}
|
||||
|
@ -2,7 +2,7 @@
|
||||
#include "npc.h"
|
||||
|
||||
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;
|
||||
} else {
|
||||
return ApiStatus_BLOCK;
|
||||
|
@ -13,7 +13,7 @@ BSS s32 D_802BE938;
|
||||
BSS s32 D_802BE93C;
|
||||
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) {
|
||||
f32 x, y, z;
|
||||
@ -48,12 +48,12 @@ void func_802BD100_317E50(Npc* npc) {
|
||||
|
||||
if (!(angle >= 360.0f)) {
|
||||
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 {
|
||||
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]) {
|
||||
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;
|
||||
}
|
||||
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);
|
||||
partnerActionStatus->partnerActionState = PARTNER_ACTION_USE;
|
||||
partnerActionStatus->actingPartner = PARTNER_BOMBETTE;
|
||||
D_802BE920 = func_800EF4E0();
|
||||
D_802BE920 = partner_force_player_flip_done();
|
||||
enable_npc_blur(npc);
|
||||
npc->duration = 4;
|
||||
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 (!(npc->flags & NPC_FLAG_COLLDING_WITH_WORLD) && (D_802BE938 == 0)) {
|
||||
npc_move_heading(npc, npc->moveSpeed, npc->yaw);
|
||||
func_8003D660(npc, 0);
|
||||
spawn_surface_effects(npc, SURFACE_INTERACT_WALK);
|
||||
} else {
|
||||
D_802BE938 = 1;
|
||||
}
|
||||
@ -396,7 +396,7 @@ ApiStatus func_802BD758_3184A8(Evt *evt, s32 isInitialCall) {
|
||||
break;
|
||||
}
|
||||
exec_ShakeCam1(0, 0, 20);
|
||||
func_8003D660(npc, 2);
|
||||
spawn_surface_effects(npc, SURFACE_INTERACT_LAND);
|
||||
collisionStatus->bombetteExploded = 0;
|
||||
collisionStatus->bombetteExplosionPos.x = npc->pos.x;
|
||||
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) {
|
||||
evt->functionTemp[0] = 8;
|
||||
break;
|
||||
} else if (func_800397E8(npc, npc->jumpVelocity)) {
|
||||
} else if (npc_try_snap_to_ground(npc, npc->jumpVelocity)) {
|
||||
evt->functionTemp[0] = 7;
|
||||
break;
|
||||
}
|
||||
|
@ -238,7 +238,7 @@ ApiStatus BowUseAbility(Evt* script, s32 isInitialCall) {
|
||||
partnerActionStatus->partnerActionState = 1;
|
||||
partnerActionStatus->actingPartner = 9;
|
||||
playerStatus->flags |= PS_FLAG_HAZARD_INVINCIBILITY;
|
||||
func_800EF4E0();
|
||||
partner_force_player_flip_done();
|
||||
bow->moveToPos.x = playerStatus->position.x;
|
||||
bow->moveToPos.y = playerStatus->position.y + (playerStatus->colliderHeight * 0.5f);
|
||||
bow->moveToPos.z = playerStatus->position.z;
|
||||
|
@ -213,7 +213,7 @@ s32 world_goombario_can_pause(Npc* goombario) {
|
||||
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;
|
||||
do { } while (new_var); // why though
|
||||
}
|
||||
@ -247,7 +247,7 @@ ApiStatus func_802BD5D8_3174F8(Evt* script, s32 isInitialCall) {
|
||||
|
||||
switch (script->functionTemp[0]) {
|
||||
case 40:
|
||||
if (!(goombario->flags & NPC_FLAG_FALLING) || playerStatus->inputEnabledCounter != 0) {
|
||||
if (!(goombario->flags & NPC_FLAG_GROUNDED) || playerStatus->inputEnabledCounter != 0) {
|
||||
script->varTable[0] = -1;
|
||||
return ApiStatus_DONE2;
|
||||
}
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -9,9 +9,9 @@ s32 world_kooper_test_first_strike(Npc*, Npc*);
|
||||
void world_kooper_pre_battle(Npc*);
|
||||
void world_kooper_post_battle(Npc*);
|
||||
|
||||
extern EvtScript world_kooper_take_out;
|
||||
extern EvtScript world_kooper_update;
|
||||
extern EvtScript world_kooper_use_ability;
|
||||
extern EvtScript world_kooper_put_away;
|
||||
extern EvtScript EVS_WorldKooperTakeOut;
|
||||
extern EvtScript EVS_WorldKooperUpdate;
|
||||
extern EvtScript EVS_KooperUseAbility;
|
||||
extern EvtScript EVS_KooperPutAway;
|
||||
|
||||
#endif
|
||||
|
@ -438,7 +438,7 @@ void func_802BDDD8_321928(Npc* npc) {
|
||||
npc->pos.z += (z - npc->pos.z) / 5.0f;
|
||||
}
|
||||
|
||||
func_8003D660(npc, 1);
|
||||
spawn_surface_effects(npc, SURFACE_INTERACT_RUN);
|
||||
|
||||
} else {
|
||||
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);
|
||||
set_action_state(ACTION_STATE_RIDE);
|
||||
D_802BFF0C = 1;
|
||||
func_800EF4E0();
|
||||
partner_force_player_flip_done();
|
||||
npc->moveToPos.x = playerStatus->position.x;
|
||||
npc->moveToPos.y = playerStatus->position.y;
|
||||
npc->moveToPos.z = playerStatus->position.z;
|
||||
|
@ -242,7 +242,7 @@ ApiStatus func_802BD660_319BD0(Evt* evt, s32 isInitialCall) {
|
||||
parakarry->flags |= NPC_FLAG_IGNORE_WORLD_COLLISION | NPC_FLAG_8;
|
||||
partnerActionStatus->actingPartner = PARTNER_PARAKARRY;
|
||||
partnerActionStatus->partnerActionState = PARTNER_ACTION_PARAKARRY_HOVER;
|
||||
D_802BEBBC = func_800EF4E0();
|
||||
D_802BEBBC = partner_force_player_flip_done();
|
||||
enable_npc_blur(parakarry);
|
||||
parakarry->yaw = atan2(parakarry->pos.x, parakarry->pos.z, playerStatus->position.x, playerStatus->position.z);
|
||||
parakarry->duration = 4;
|
||||
@ -489,7 +489,7 @@ ApiStatus func_802BD660_319BD0(Evt* evt, s32 isInitialCall) {
|
||||
parakarry->pos.y = playerStatus->position.y + 32.0f,
|
||||
y = parakarry->pos.y,
|
||||
parakarry->pos.y = playerStatus->position.y,
|
||||
func_8003D660(parakarry, 0),
|
||||
spawn_surface_effects(parakarry, SURFACE_INTERACT_WALK),
|
||||
parakarry->pos.y = y, (!tempConditional))) {
|
||||
if (!phys_adjust_cam_on_landing()) {
|
||||
gCameras[0].moveFlags &= ~CAMERA_MOVE_FLAG_2;
|
||||
|
@ -303,7 +303,7 @@ ApiStatus func_802BD754_31D2C4(Evt* script, s32 isInitialCall) {
|
||||
gGameStatusPtr->keepUsingPartnerOnMapChange = 0;
|
||||
partnerActionStatus->partnerActionState = PARTNER_ACTION_USE;
|
||||
partnerActionStatus->actingPartner = PARTNER_WATT;
|
||||
func_800EF4E0();
|
||||
partner_force_player_flip_done();
|
||||
npc->moveToPos.x = playerStatus->position.x;
|
||||
npc->moveToPos.y = playerStatus->position.y + 5.0f;
|
||||
npc->moveToPos.z = playerStatus->position.z;
|
||||
@ -365,7 +365,7 @@ ApiStatus func_802BD754_31D2C4(Evt* script, s32 isInitialCall) {
|
||||
D_802BE304 = 20;
|
||||
npc_set_palswap_mode_A(npc, 0);
|
||||
if (!(playerStatus->flags & PS_FLAG_HIT_FIRE)) {
|
||||
set_action_state(0);
|
||||
set_action_state(ACTION_STATE_IDLE);
|
||||
}
|
||||
return ApiStatus_DONE1;
|
||||
}
|
||||
|
@ -194,10 +194,10 @@ WorldPartner wPartners[12] = {
|
||||
.dmaDest = &world_partner_kooper_VRAM,
|
||||
.isFlying = FALSE,
|
||||
.init = world_kooper_init,
|
||||
.takeOut = &world_kooper_take_out,
|
||||
.update = &world_kooper_update,
|
||||
.useAbility = &world_kooper_use_ability,
|
||||
.putAway = &world_kooper_put_away,
|
||||
.takeOut = &EVS_WorldKooperTakeOut,
|
||||
.update = &EVS_WorldKooperUpdate,
|
||||
.useAbility = &EVS_KooperUseAbility,
|
||||
.putAway = &EVS_KooperPutAway,
|
||||
.idle = ANIM_WorldKooper_Idle,
|
||||
.testFirstStrike = world_kooper_test_first_strike,
|
||||
.canUseAbility = partner_is_idle,
|
||||
@ -574,7 +574,7 @@ s32 partner_is_flying(void) {
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
@ -1252,7 +1252,7 @@ void partner_walking_follow_player(Npc* partner) {
|
||||
partner->moveSpeed = 4.0f;
|
||||
}
|
||||
partner->currentAnim = gPartnerAnimations[wCurrentPartnerId].run;
|
||||
if (!(partner->flags & NPC_FLAG_FALLING)) {
|
||||
if (!(partner->flags & NPC_FLAG_GROUNDED)) {
|
||||
partner->currentAnim = gPartnerAnimations[wCurrentPartnerId].fall;
|
||||
}
|
||||
while (TRUE) {
|
||||
@ -1300,28 +1300,23 @@ void partner_walking_follow_player(Npc* partner) {
|
||||
break;
|
||||
}
|
||||
|
||||
if ((partner->flags & NPC_FLAG_FALLING) && currentSnapshot->isJumping) {
|
||||
if ((partner->flags & NPC_FLAG_GROUNDED) && currentSnapshot->isJumping) {
|
||||
wPartnerFollowState = 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!(partner->flags & NPC_FLAG_FALLING)) {
|
||||
if (!(partner->flags & NPC_FLAG_GROUNDED)) {
|
||||
partner->moveSpeed *= 0.5f;
|
||||
}
|
||||
partner->yaw = yaw;
|
||||
npc_move_heading(partner, partner->moveSpeed, partner->yaw);
|
||||
if (partner->moveSpeed < 4.0) {
|
||||
var_a1 = 0;
|
||||
} else {
|
||||
var_a1 = 1;
|
||||
}
|
||||
func_8003D660(partner, var_a1);
|
||||
spawn_surface_effects(partner, (partner->moveSpeed < 4.0) ? SURFACE_INTERACT_WALK : SURFACE_INTERACT_RUN);
|
||||
surfaceType = get_collider_flags(partner->currentFloor);
|
||||
if (surfaceType == SURFACE_TYPE_SPIKES ||
|
||||
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)) {
|
||||
D_8010CFBC++;
|
||||
if (D_8010CFBC >= 40) {
|
||||
@ -1433,7 +1428,7 @@ void partner_walking_follow_player(Npc* partner) {
|
||||
partner->jumpVelocity = 0.0f;
|
||||
partner->pos.y = y;
|
||||
partner->yaw = atan2(x, z, playerStatus->position.x, playerStatus->position.z);
|
||||
func_8003D660(partner, 2);
|
||||
spawn_surface_effects(partner, SURFACE_INTERACT_LAND);
|
||||
wPartnerFollowState = 0;
|
||||
distance = dist2D(partner->pos.x, partner->pos.z, partner->moveToPos.x, partner->moveToPos.z);
|
||||
if (distance < 5.0) {
|
||||
@ -1509,12 +1504,7 @@ void partner_walking_follow_player(Npc* partner) {
|
||||
}
|
||||
partner->yaw = yaw;
|
||||
npc_move_heading(partner, partner->moveSpeed, yaw);
|
||||
if (partner->moveSpeed < 4.0) {
|
||||
var_a1 = 0;
|
||||
} else {
|
||||
var_a1 = 1;
|
||||
}
|
||||
func_8003D660(partner, var_a1);
|
||||
spawn_surface_effects(partner, (partner->moveSpeed < 4.0) ? SURFACE_INTERACT_WALK : SURFACE_INTERACT_RUN);
|
||||
distance = 1000.0f;
|
||||
x = partner->pos.x;
|
||||
z = partner->pos.z;
|
||||
@ -1633,12 +1623,7 @@ void partner_walking_follow_player(Npc* partner) {
|
||||
partner->moveSpeed = wPartnerMoveSpeed;
|
||||
partner->yaw = D_800F8034;
|
||||
npc_move_heading(partner, partner->moveSpeed, partner->yaw);
|
||||
if (partner->moveSpeed < 4.0) {
|
||||
var_a1 = 0;
|
||||
} else {
|
||||
var_a1 = 1;
|
||||
}
|
||||
func_8003D660(partner, var_a1);
|
||||
spawn_surface_effects(partner, (partner->moveSpeed < 4.0) ? SURFACE_INTERACT_WALK : SURFACE_INTERACT_RUN);
|
||||
} else {
|
||||
partner_clear_player_tracking(partner);
|
||||
partner->moveSpeed = 0.0f;
|
||||
@ -1663,7 +1648,7 @@ void partner_walking_follow_player(Npc* partner) {
|
||||
partner_move_to_goal(partner, FALSE);
|
||||
break;
|
||||
case 40:
|
||||
if (partner->flags & NPC_FLAG_FALLING) {
|
||||
if (partner->flags & NPC_FLAG_GROUNDED) {
|
||||
if (func_800EA4B0(partner->currentFloor)) {
|
||||
wPartnerFollowState = 50;
|
||||
partner->currentAnim = gPartnerAnimations[wCurrentPartnerId].idle;
|
||||
@ -1699,7 +1684,7 @@ void partner_walking_follow_player(Npc* partner) {
|
||||
partner->jumpVelocity = 0.0f;
|
||||
partner->pos.y = y;
|
||||
partner->yaw = atan2(x, z, playerStatus->position.x, playerStatus->position.z);
|
||||
func_8003D660(partner, 2);
|
||||
spawn_surface_effects(partner, SURFACE_INTERACT_LAND);
|
||||
wPartnerFollowState = 50;
|
||||
}
|
||||
break;
|
||||
@ -2334,7 +2319,7 @@ s32 partner_get_out(Npc* partner) {
|
||||
partner->currentAnim = gPartnerAnimations[wCurrentPartnerId].jump;
|
||||
break;
|
||||
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;
|
||||
break;
|
||||
}
|
||||
@ -2378,9 +2363,9 @@ s32 partner_get_out(Npc* partner) {
|
||||
partner->pos.x = partner->moveToPos.x;
|
||||
partner->pos.y = partner->moveToPos.y;
|
||||
partner->pos.z = partner->moveToPos.z;
|
||||
if (partner->flags & 0x1000) {
|
||||
if (partner->flags & NPC_FLAG_GROUNDED) {
|
||||
if (!wPartner->isFlying) {
|
||||
func_8003D660(partner, 2);
|
||||
spawn_surface_effects(partner, SURFACE_INTERACT_LAND);
|
||||
}
|
||||
}
|
||||
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;
|
||||
Camera* cameras = gCameras;
|
||||
s32 ret;
|
||||
s32 isFacingLeft;
|
||||
|
||||
if (playerStatus->flipYaw[CAM_DEFAULT] == 0.0f) {
|
||||
if (!(playerStatus->spriteFacingAngle >= 90.0f) || !(playerStatus->spriteFacingAngle < 270.0f)) {
|
||||
ret = 1;
|
||||
isFacingLeft = TRUE;
|
||||
playerStatus->targetYaw = clamp_angle(cameras[CAM_DEFAULT].currentYaw - 90.0f);
|
||||
} else {
|
||||
isFacingLeft = FALSE;
|
||||
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) {
|
||||
ret = 1;
|
||||
isFacingLeft = TRUE;
|
||||
playerStatus->targetYaw = clamp_angle(cameras[CAM_DEFAULT].currentYaw - 90.0f);
|
||||
|
||||
} else {
|
||||
ret = 0;
|
||||
isFacingLeft = FALSE;
|
||||
playerStatus->targetYaw = clamp_angle(cameras[CAM_DEFAULT].currentYaw + 90.0f);
|
||||
}
|
||||
|
||||
playerStatus->currentYaw = playerStatus->targetYaw;
|
||||
return ret;
|
||||
return isFacingLeft;
|
||||
}
|
||||
|
||||
void partner_enable_input(void) {
|
||||
@ -2548,7 +2536,7 @@ void partner_move_to_goal(Npc* partner, s32 isFlying) {
|
||||
if (wPartnerMoveTime != 0) {
|
||||
wPartnerMoveTime--;
|
||||
if (!isFlying) {
|
||||
if (!(partner->flags & NPC_FLAG_FALLING)) {
|
||||
if (!(partner->flags & NPC_FLAG_GROUNDED)) {
|
||||
partner->pos.y = playerStatus->position.y;
|
||||
}
|
||||
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);
|
||||
}
|
||||
|
||||
if (partner->moveSpeed < 4.0) {
|
||||
var_a1 = 0;
|
||||
} else {
|
||||
var_a1 = 1;
|
||||
}
|
||||
func_8003D660(partner, var_a1);
|
||||
spawn_surface_effects(partner, (partner->moveSpeed < 4.0) ? SURFACE_INTERACT_WALK : SURFACE_INTERACT_RUN);
|
||||
} else {
|
||||
partner->flags &= ~NPC_FLAG_IGNORE_WORLD_COLLISION;
|
||||
partner->currentAnim = gPartnerAnimations[wCurrentPartnerId].idle;
|
||||
|
@ -35,7 +35,7 @@ s32 partner_use_ability(void);
|
||||
void partner_do_player_collision(Npc* partner);
|
||||
void partner_walking_follow_player(Npc* partner);
|
||||
s32 func_800EA52C(s32);
|
||||
s32 func_800EF4E0(void);
|
||||
s32 partner_force_player_flip_done(void);
|
||||
void partner_suspend_ability_script(void);
|
||||
void partner_resume_ability_script(void);
|
||||
void partner_enable_input(void);
|
||||
|
@ -252,7 +252,7 @@ dead_dma_copy = 0x8002AA2C;
|
||||
dead_get_entity_by_index = 0x80118BB0;
|
||||
dead_cos_rad = 0x8002B4C0;
|
||||
dead_fx_sun = 0x80077BD0;
|
||||
dead_func_8003D660 = 0x80041080;
|
||||
dead_spawn_surface_effects = 0x80041080;
|
||||
dead_set_max_SP = 0x800F1D9C;
|
||||
dead_sync_status_menu = 0x800F1730;
|
||||
dead_get_npc_by_index = 0x8003C43C;
|
||||
|
@ -17,6 +17,31 @@ def next_8(n):
|
||||
else:
|
||||
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):
|
||||
def scan(self, rom_bytes):
|
||||
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)
|
||||
|
||||
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)
|
||||
with open(fs_dir / f"{i:02X}.png", "wb") as f:
|
||||
|
@ -253,8 +253,8 @@ get_npc_by_index = 0x80038ADC; // type:func rom:0x13EDC
|
||||
npc_do_world_collision = 0x80038AFC; // type:func rom:0x13EFC
|
||||
npc_do_other_npc_collision = 0x8003900C; // type:func rom:0x1440C
|
||||
npc_do_player_collision = 0x800392D8; // type:func rom:0x146D8
|
||||
npc_do_gravity = 0x80039688; // type:func rom:0x14A88
|
||||
func_800397E8 = 0x800397E8; // type:func rom:0x14BE8
|
||||
npc_try_apply_gravity = 0x80039688; // type:func rom:0x14A88
|
||||
npc_try_snap_to_ground = 0x800397E8; // type:func rom:0x14BE8
|
||||
update_npcs = 0x80039930; // type:func rom:0x14D30
|
||||
npc_get_render_yaw = 0x80039DA4; // type:func rom:0x151A4
|
||||
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_remove_decoration = 0x8003C428; // type:func rom:0x17828
|
||||
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_update_decoration_none = 0x8003C658; // type:func rom:0x17A58
|
||||
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
|
||||
func_8003D3BC = 0x8003D3BC; // type:func rom:0x187BC
|
||||
func_8003D624 = 0x8003D624; // type:func rom:0x18A24
|
||||
func_8003D660 = 0x8003D660; // type:func rom:0x18A60
|
||||
func_8003D788 = 0x8003D788; // type:func rom:0x18B88
|
||||
func_8003DA38 = 0x8003DA38; // type:func rom:0x18E38
|
||||
func_8003DC38 = 0x8003DC38; // type:func rom:0x19038
|
||||
func_8003DFA0 = 0x8003DFA0; // type:func rom:0x193A0
|
||||
func_8003E0D4 = 0x8003E0D4; // type:func rom:0x194D4
|
||||
func_8003E1D0 = 0x8003E1D0; // type:func rom:0x195D0
|
||||
spawn_surface_effects = 0x8003D660; // type:func rom:0x18A60
|
||||
spawn_default_surface_effects = 0x8003D788; // type:func rom:0x18B88
|
||||
spawn_flower_surface_effects = 0x8003DA38; // type:func rom:0x18E38
|
||||
spawn_cloud_surface_effects = 0x8003DC38; // type:func rom:0x19038
|
||||
spawn_snow_surface_effects = 0x8003DFA0; // type:func rom:0x193A0
|
||||
spawn_hedge_surface_effects = 0x8003E0D4; // type:func rom:0x194D4
|
||||
spawn_water_surface_effects = 0x8003E1D0; // type:func rom:0x195D0
|
||||
COPY_set_defeated = 0x8003E2E0; // type:func rom:0x196E0
|
||||
init_encounter_status = 0x8003E338; // type:func rom:0x19738
|
||||
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_800EF43C = 0x800EF43C; // type:func rom:0x888EC
|
||||
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_disable_input = 0x800EF628; // type:func rom:0x88AD8
|
||||
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_shadow = 0x8011085C; // type:func rom:0xA6F5C
|
||||
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
|
||||
is_player_action_state = 0x80110BB0; // type:func rom:0xA72B0
|
||||
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
|
||||
set_item_entity_flags = 0x80134148; // type:func rom:0xCA848
|
||||
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
|
||||
set_item_entity_position = 0x8013420C; // type:func rom:0xCA90C
|
||||
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_802BEBA0_31B110 = 0x802BEBA0; // type:data rom:0x31B110
|
||||
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_802BEBB8 = 0x802BEBB8; // type:data rom:0x31B128
|
||||
D_802BEBBC = 0x802BEBBC; // type:data rom:0x31B12C
|
||||
D_802BEBC0_31CBE0 = 0x802BEBC0; // type:data rom:0x31B130
|
||||
D_802BEBC4 = 0x802BEBC4; // type:data rom:0x31B134
|
||||
ParakarryTweesterPhysics = 0x802BEBC8; // type:data rom:0x31B138
|
||||
func_802BD144_31B164 = 0x802BD144; // type:func rom:0x31B164
|
||||
func_802BD17C_31B19C = 0x802BD17C; // type:func rom:0x31B19C
|
||||
kooper_vertical_hit_interactable_entity = 0x802BD144; // type:func rom:0x31B164
|
||||
kooper_check_for_item_collision = 0x802BD17C; // type:func rom:0x31B19C
|
||||
world_kooper_init = 0x802BD200; // type:func rom:0x31B220
|
||||
KooperTakeOut = 0x802BD228; // type:func rom:0x31B248
|
||||
KooperUpdate = 0x802BD260; // type:func rom:0x31B280
|
||||
func_802BD5F4_31B614 = 0x802BD5F4; // type:func rom:0x31B614
|
||||
func_802BD638_31B658 = 0x802BD638; // type:func rom:0x31B658
|
||||
kooper_try_cancel_tweester = 0x802BD5F4; // type:func rom:0x31B614
|
||||
KooperUseAbility = 0x802BD638; // type:func rom:0x31B658
|
||||
KooperPutAway = 0x802BE7E0; // type:func rom:0x31C800
|
||||
world_kooper_test_first_strike = 0x802BE818; // type:func rom:0x31C838
|
||||
world_kooper_pre_battle = 0x802BEA24; // type:func rom:0x31CA44
|
||||
world_kooper_post_battle = 0x802BEB10; // type:func rom:0x31CB30
|
||||
D_802BEB40_31CB60 = 0x802BEB40; // type:data rom:0x31CB60
|
||||
world_kooper_take_out = 0x802BEB44; // type:data rom:0x31CB64
|
||||
ShellTossHitboxState = 0x802BEB40; // type:data rom:0x31CB60
|
||||
EVS_WorldKooperTakeOut = 0x802BEB44; // type:data rom:0x31CB64
|
||||
KooperTweesterPhysicsPtr = 0x802BEB60; // type:data rom:0x31CB80
|
||||
world_kooper_update = 0x802BEB64; // type:data rom:0x31CB84
|
||||
world_kooper_use_ability = 0x802BEB80; // type:data rom:0x31CBA0
|
||||
world_kooper_put_away = 0x802BEB9C; // type:data rom:0x31CBBC
|
||||
EVS_WorldKooperUpdate = 0x802BEB64; // type:data rom:0x31CB84
|
||||
EVS_KooperUseAbility = 0x802BEB80; // type:data rom:0x31CBA0
|
||||
EVS_KooperPutAway = 0x802BEB9C; // type:data rom:0x31CBBC
|
||||
D_802BEC18_31CC38 = 0x802BEC18; // type:data rom:0x31CC38
|
||||
D_802BEC20_31CC40 = 0x802BEC20; // type:data rom:0x31CC40
|
||||
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_802BEC40_31CC60 = 0x802BEC40; // type:data rom:0x31CC60
|
||||
func_802BD100_31CC70 = 0x802BD100; // type:func rom:0x31CC70
|
||||
D_802BEC54 = 0x802BEC54; // type:data rom:0x31CC74
|
||||
D_802BEC58 = 0x802BEC58; // type:data rom:0x31CC78
|
||||
KooperTriggeredBattle = 0x802BEC54; // type:data rom:0x31CC74
|
||||
ShellTossPlayerFacingLeft = 0x802BEC58; // type:data rom:0x31CC78
|
||||
D_802BEC5C = 0x802BEC5C; // type:data rom:0x31CC7C
|
||||
D_802BEC60 = 0x802BEC60; // type:data rom:0x31CC80
|
||||
D_802BEC64 = 0x802BEC64; // type:data rom:0x31CC84
|
||||
D_802BEC68 = 0x802BEC68; // type:data rom:0x31CC88
|
||||
ShellTossKickFalling = 0x802BEC60; // type:data rom:0x31CC80
|
||||
ShellTossControlsPlayer = 0x802BEC64; // type:data rom:0x31CC84
|
||||
KooperHeldItemIdx = 0x802BEC68; // type:data rom:0x31CC88
|
||||
D_802BEC6C = 0x802BEC6C; // type:data rom:0x31CC8C
|
||||
D_802BEC70 = 0x802BEC70; // type:data rom:0x31CC90
|
||||
D_802BEC74 = 0x802BEC74; // type:data rom:0x31CC94
|
||||
D_802BEC78 = 0x802BEC78; // type:data rom:0x31CC98
|
||||
ShellTossPosY = 0x802BEC74; // type:data rom:0x31CC94
|
||||
ShellTossPosZ = 0x802BEC78; // type:data rom:0x31CC98
|
||||
D_802BEC7C = 0x802BEC7C; // type:data rom:0x31CC9C
|
||||
KooperTweesterPhysics = 0x802BEC80; // type:data rom:0x31CCA0
|
||||
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_802BEBB0 = 0x802BEBB0; // type:data
|
||||
D_802BEBC0 = 0x802BEBC0; // type:data
|
||||
D_802BEC50 = 0x802BEC50; // type:data
|
||||
KooperShellTossHoldTime = 0x802BEC50; // type:data
|
||||
OriginalPlayerY = 0x802BFEE0; // type:data
|
||||
D_802BFEF0 = 0x802BFEF0; // type:data
|
||||
D_802BFEFC = 0x802BFEFC; // type:data
|
||||
|
@ -148,7 +148,7 @@ dead_get_npc_unsafe = get_npc_unsafe + 0x39D0;
|
||||
dead_get_npc_safe = get_npc_safe + 0x39EC;
|
||||
dead_disable_npc_shadow = disable_npc_shadow + 0x39EC;
|
||||
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_SetEncounterStatusFlags = SetEncounterStatusFlags + 0x40A0;
|
||||
dead_IsStartingConversation = IsStartingConversation + 0x40A0;
|
||||
|
Loading…
Reference in New Issue
Block a user