* monty mole AI pt 1

* monty mole AI #2

* enum values for evt priority and flags

* enemy ai flags

* done monty mole + partner enums

* removed union for partner action state

* missed parter action states + cam move flags + entity collision bit

* basic ai

* piranha plant stuff

* attack ahead

* consistent hitbox names

* idk

* organized piranha plant

* delete matches

* start fuzzy

* naming

* bzzap pt 1

* bzzap 2

* bzzap names done

* rename bzzap to flyingAI

* complete flying names

* done for today

* file reorganizing

* world AI

* starting clubba dedupe

* suggested changes

* bullet bills

* sentinel start

* dedupe sentinel complete

* sentinel AI done

* melee ai organization

* piranha plant dedupe

* resolved some bad dead syms

* patrol start

* patrol AI almost done

* enough

* more ai work

* clean up clubba ai enum

* dedupe all clubbae

* started cleft extraction

* ready to dedupe cleft

* dedupe one cleft

* iwa_04

* iwa_01

* iwa_02

* ai state file reorganization

* enemy anim enum

* extracted shy guy

* dedupe shy guy ai

* shy guy patrol ai

* done shy guy ai dedupe

* added NON_MATCHING wrap

* ai etc

* more dead ai

* most dead ai merged with living

* lakitu etc

* paratroopas

* fix warnings

* fix other warning

* ParatroopaAI

* lakituAI parameter fix

* dead_flo_13 debug strings

* misc map matches

* flying magikoopa start

* name npc field

* lungeAI renamed to tackleAI

* magikoopa ai foothold

* extrated one magikoopa

* starting clubba dedupe

* addressed PR comments

* consolidated magikoopa helper funcs

* misc map stuff

* flying magikoopa dedupe

* zipline funcs

* delete matched

* grind out another 0.05%

* started letter delivery dedupe

* more delivery dedupe

* special delivery

* rest of letter delivery

* slight delivery reorg

* delivery func names

* cleft doc start

* name enemy field

* more renamins

* unk_28.f

* changed field names to facilitate renaming

* done cleft cleanup

* hopping ai

* cleanup some ai

* name field + patrol reorg

* filled out NpcAISettings fields

* assembling ai includes

* elimated state files

* remove X32 for alertOffsetDist

* removed other NpcAISettings union

* new NpcAISettings for UnkAI_4

* stationary AI cleanup

* smalls

* 0 new warnings

Co-authored-by: HailSanta <Hail2Santa@gmail.com>
Co-authored-by: Ethan Roseman <ethteck@gmail.com>
This commit is contained in:
HailSanta 2022-04-29 00:32:16 -04:00 committed by GitHub
parent e85761f7ad
commit aee5626e5b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
863 changed files with 11209 additions and 36855 deletions

View File

@ -180,7 +180,7 @@ typedef struct Npc {
/* 0x0A6 */ s16 collisionRadius;
/* 0x0A8 */ s16 collisionHeight;
/* 0x0AA */ s8 renderMode;
/* 0x0AB */ s8 unk_AB;
/* 0x0AB */ s8 verticalRenderOffset;
/* 0x0AC */ u8 alpha;
/* 0x0AD */ u8 alpha2; ///< Multiplied with Npc::alpha
/* 0x0AE */ char unk_AE[2];

View File

@ -1,6 +1,7 @@
#ifndef _DEAD_H_
#define _DEAD_H_
// There can be multiple invalid references to a symbol from the dead code,
// so some symbols here have a "2" suffix.
@ -31,7 +32,7 @@
#define gPlayerActionState dead_gPlayerActionState
#define is_point_within_region dead_is_point_within_region
#define npc_raycast_down_sides dead_npc_raycast_down_sides
#define func_800490B4 func_8004D1A4
#define basic_ai_check_player_dist dead_basic_ai_check_player_dist
#define fx_emote dead_fx_emote
#define ai_enemy_play_sound dead_ai_enemy_play_sound
#define npc_move_heading dead_npc_move_heading
@ -39,8 +40,7 @@
#define get_enemy dead_get_enemy
#define npc_test_move_simple_with_slipping dead_npc_test_move_simple_with_slipping
#define get_screen_coords dead_get_screen_coords
#define func_800495A0 func_800495A0
#define func_8004A73C func_8004EB8C
#define basic_ai_suspend dead_basic_ai_suspend
#define gCurrentCameraID dead_gCurrentCameraID
#define add_vec2D_polar dead_add_vec2D_polar
#define gCurrentCamID dead_gCurrentCamID
@ -92,15 +92,15 @@
#define get_model_list_index_from_tree_index dead_get_model_list_index_from_tree_index
#define guMtxCatF dead_guMtxCatF
#define guMtxIdentF dead_guMtxIdentF
#define func_800495A0 func_8004D9C0
#define func_800496B8 func_8004DAD8
#define base_UnkNpcAIFunc1 func_8004DF64
#define func_80049C04 func_8004E024
#define func_80049E3C func_8004E25C
#define func_80049ECC func_8004E2EC
#define func_80049F7C func_8004E39C
#define func_8004A124 func_8004E544
#define func_8004A3E8 func_8004E808
#define basic_ai_wander_init dead_basic_ai_wander_init
#define basic_ai_wander dead_basic_ai_wander
#define basic_ai_loiter_init dead_basic_ai_loiter_init
#define basic_ai_loiter dead_basic_ai_loiter
#define basic_ai_found_player_jump_init dead_basic_ai_found_player_jump_init
#define basic_ai_found_player_jump dead_basic_ai_found_player_jump
#define basic_ai_chase_init dead_basic_ai_chase_init
#define basic_ai_chase dead_basic_ai_chase
#define basic_ai_lose_player dead_basic_ai_lose_player
#define gCurrentEncounter dead_gCurrentEncounter
#define fx_motion_blur_flame dead_fx_motion_blur_flame
#define wPartnerHudScripts dead_wPartnerHudScripts
@ -110,5 +110,6 @@
#define destroy_popup_menu dead_destroy_popup_menu
#define heap_free dead_heap_free
#define entity_upgrade_block_hide_content dead_entity_upgrade_block_hide_content
#define func_8003D660 dead_func_80041080
#endif

View File

@ -37,9 +37,9 @@ typedef struct DeadEnemy {
/* 0x064 */ void* unk_64;
/* 0x068 */ char unk_68[4];
/* 0x06C */ s32 varTable[16];
/* 0x0AC */ char unk_AC[4];
/* 0x0B0 */ s32 unk_B0;
/* 0x0B4 */ s8 unk_B4;
/* 0x0AC */ s32 aiDetectFlags;
/* 0x0B0 */ s32 aiFlags;
/* 0x0B4 */ s8 aiPaused;
/* 0x0B5 */ s8 unk_B5;
/* 0x0B6 */ char unk_B6[2];
/* 0x0B8 */ EvtScript* unk_B8; // some bytecode

View File

@ -545,8 +545,10 @@ enum SoundIDs {
SOUND_ENTER_PIPE = 0x00000163,
SOUND_SMASH_GOOMNUT_TREE = 0x00000165,
SOUND_167 = 0x00000167,
SOUND_168 = 0x00000168,
SOUND_172 = 0x00000172,
SOUND_17B = 0x0000017B,
SOUND_185 = 0x00000185,
SOUND_194 = 0x00000194,
SOUND_1A5 = 0x000001A5,
SOUND_1A6 = 0x000001A6,
@ -600,7 +602,9 @@ enum SoundIDs {
SOUND_MOLE_SURFACE = 0x00000321,
SOUND_MOLE_DIG = 0x00000322,
SOUND_MOLE_POP = 0x00000323,
SOUND_328 = 0x00000328,
SOUND_32E = 0x0000032E,
SOUND_32F = 0x0000032F,
SOUND_359 = 0x00000359,
SOUND_361 = 0x00000361,
SOUND_362 = 0x00000362,
@ -620,6 +624,7 @@ enum SoundIDs {
SOUND_HIT_SHOCK = 0x0000037B,
SOUND_GENERAL_WHISTLE = 0x00000395,
SOUND_OPEN_SHELL = 0x000003D4,
SOUND_3E1 = 0x000003E1,
SOUND_JUMP_3E2 = 0x000003E2,
SOUND_MISS_JUMP = 0x000003E3,
SOUND_DEATH = 0x000003E5,
@ -640,6 +645,7 @@ enum SoundIDs {
SOUND_CANNON1 = 0x00002016,
SOUND_CANNON2 = 0x00002017,
SOUND_CANNON3 = 0x00002018,
SOUND_20C1 = 0x000020C1,
SOUND_202C = 0x0000202C,
SOUND_202D = 0x0000202D,
SOUND_202E = 0x0000202E,
@ -687,6 +693,9 @@ enum SoundIDs {
SOUND_211A = 0x0000211A,
SOUND_212D = 0x0000212D,
SOUND_212E = 0x0000212E,
SOUND_80000011 = 0x80000011,
SOUND_B0000017 = 0xB0000017,
SOUND_B0000018 = 0xB0000018,
};
enum Cams {
@ -1940,9 +1949,9 @@ enum NpcFlags {
NPC_FLAG_40 = 0x00000040,
NPC_FLAG_UPSIDE_DOWN = 0x00000080, ///< Render NPCs upside-down
NPC_FLAG_100 = 0x00000100, // TODO
NPC_FLAG_GRAVITY = 0x00000200, ///< Enables gravity. Does nothing if NPC_FLAG_NO_Y_MOVEMENT is set.
NPC_FLAG_GRAVITY = 0x00000200, ///< Enables gravity. Does nothing if NPC_FLAG_JUMPING is set.
NPC_FLAG_LOCK_ANIMS = 0x00000400, ///< Do not allow scripts to change animation
NPC_FLAG_NO_Y_MOVEMENT = 0x00000800, ///< Causes NpcMoveTo() to ignore stairs
NPC_FLAG_JUMPING = 0x00000800, ///< Causes NpcMoveTo() to ignore stairs
NPC_FLAG_1000 = 0x00001000,
NPC_FLAG_NO_PROJECT_SHADOW = 0x00002000, ///< Draw shadow at base of sprite instead of projecting to ground
NPC_FLAG_4000 = 0x00004000,
@ -1959,7 +1968,7 @@ enum NpcFlags {
NPC_FLAG_SIMPLIFIED_PHYSICS = 0x02000000,
/// Use simpler, faster physics calculations:
/// - Perform only one lateral collision test during motion
/// - Allow falling below Y=-2000 (by default, NPC_FLAG_NO_Y_MOVEMENT is set when an NPC falls out-of-bounds)
/// - Allow falling below Y=-2000 (by default, NPC_FLAG_JUMPING is set when an NPC falls out-of-bounds)
NPC_FLAG_PARTICLE = 0x04000000,
NPC_FLAG_8000000 = 0x08000000,
NPC_FLAG_10000000 = 0x10000000,
@ -2748,15 +2757,15 @@ enum EnemyFlags {
ENEMY_FLAGS_8000000 = 0x08000000,
ENEMY_FLAGS_10000000 = 0x10000000,
ENEMY_FLAGS_20000000 = 0x20000000,
ENEMY_FLAGS_40000000 = 0x40000000,
ENEMY_FLAGS_40000000 = 0x40000000, // spawn in AI_STATE_CHASE_INIT
ENEMY_FLAGS_80000000 = 0x80000000,
};
// used with enemy->unk_B0
// used with enemy->aiFlags
enum EnemyAIFlags {
ENEMY_AI_FLAGS_1 = 0x00000001,
ENEMY_AI_FLAGS_2 = 0x00000002,
ENEMY_AI_FLAGS_4 = 0x00000004,
ENEMY_AI_FLAGS_2 = 0x00000002, // do not move; do not sense player
ENEMY_AI_FLAGS_4 = 0x00000004, // pause ai
ENEMY_AI_FLAGS_8 = 0x00000008,
ENEMY_AI_FLAGS_10 = 0x00000010,
ENEMY_AI_FLAGS_20 = 0x00000020,
@ -2764,6 +2773,98 @@ enum EnemyAIFlags {
ENEMY_AI_FLAGS_80 = 0x00000080,
};
enum EnemyAIStates {
// basic states
AI_STATE_WANDER_INIT = 0,
AI_STATE_WANDER = 1,
AI_STATE_PATROL_INIT = 0,
AI_STATE_PATROL = 1,
AI_STATE_HOP_INIT = 0,
AI_STATE_HOP = 1,
AI_STATE_LOITER_INIT = 2,
AI_STATE_LOITER = 3,
AI_STATE_LOITER_POST = 4,
AI_STATE_ALERT_INIT = 10,
AI_STATE_ALERT = 11,
AI_STATE_CHASE_INIT = 12,
AI_STATE_CHASE = 13,
AI_STATE_LOSE_PLAYER = 14,
AI_STATE_PATROL_15 = 15,
AI_RETURN_HOME_INIT = 40,
AI_RETURN_HOME = 41,
AI_STATE_SUSPEND = 99,
// melee hitboxes
AI_STATE_MELEE_HITBOX_INIT = 30,
AI_STATE_MELEE_HITBOX_PRE = 31,
AI_STATE_MELEE_HITBOX_ACTIVE = 32,
AI_STATE_MELEE_HITBOX_MISS = 33,
// projectile hitboxes
AI_STATE_PROJECTILE_HITBOX_30 = 30,
AI_STATE_PROJECTILE_HITBOX_31 = 31,
AI_STATE_PROJECTILE_HITBOX_32 = 32,
AI_STATE_PROJECTILE_HITBOX_33 = 33,
};
enum EnemyAIAnims {
ENEMY_ANIM_IDLE = 0,
ENEMY_ANIM_WALK = 1,
ENEMY_ANIM_RUN = 2,
ENEMY_ANIM_CHASE = 3,
ENEMY_ANIM_JUMP = 4,
ENEMY_ANIM_05 = 5,
ENEMY_ANIM_DEATH = 6,
ENEMY_ANIM_HIT = 7,
ENEMY_ANIM_MELEE_PRE = 8,
ENEMY_ANIM_MELEE_HIT = 9,
};
enum EnemyActionFlags {
AI_ACTION_JUMP_WHEN_SEE_PLAYER = 0x01,
AI_ACTION_02 = 0x02,
AI_ACTION_04 = 0x04,
AI_ACTION_08 = 0x08,
AI_ACTION_LOOK_AROUND_DURING_LOITER = 0x10,
AI_ACTION_20 = 0x20
};
enum EnemyDetectFlags {
AI_DETECT_SIGHT = 0x01,
AI_DETECT_SENSITIVE_MOTION = 0x02,
};
enum EnemyTerritoryFlags {
AI_TERRITORY_IGNORE_HIDING = 0x01, // bow and sushi dont prevent enemy detection
AI_TERRITORY_IGNORE_ELEVATION = 0x02, // vertical size of detection volume is ignored
};
enum PiranhaPlantStates {
AI_STATE_PIRANHA_PLANT_00 = 0,
AI_STATE_PIRANHA_PLANT_01 = 1,
AI_STATE_PIRANHA_PLANT_10 = 10,
AI_STATE_PIRANHA_PLANT_11 = 11,
AI_STATE_PIRANHA_PLANT_12 = 12,
AI_STATE_PIRANHA_PLANT_13 = 13,
AI_STATE_PIRANHA_PLANT_14 = 14,
AI_STATE_PIRANHA_PLANT_SUSPEND = 99
};
enum MeleeHitboxAttackStates {
MELEE_HITBOX_STATE_NONE = 0,
MELEE_HITBOX_STATE_INIT = 1,
MELEE_HITBOX_STATE_PRE = 2,
MELEE_HITBOX_STATE_ACTIVE = 3, // hitbox is active
MELEE_HITBOX_STATE_POST = 4
};
enum ProjectileHitboxAttackStates {
PROJECTILE_HITBOX_STATE_NONE = 0,
PROJECTILE_HITBOX_STATE_INIT = 1,
PROJECTILE_HITBOX_STATE_PRE = 2,
PROJECTILE_HITBOX_STATE_ACTIVE = 3, // hitbox is active
PROJECTILE_HITBOX_STATE_POST = 4,
PROJECTILE_HITBOX_STATE_DONE = 100
};
enum MusicSettingsFlags {
MUSIC_SETTINGS_FLAGS_1 = 0x00000001,
MUSIC_SETTINGS_FLAGS_2 = 0x00000002,

View File

@ -92,7 +92,7 @@ void get_msg_properties(s32 msgID, s32* height, s32* width, s32* maxLineChars, s
void replace_window_update(s32 idx, s8 arg1, WindowUpdateFunc pendingFunc);
void decode_yay0(void* src, void* dst);
s32 func_800493EC(Enemy* enemy, s32 arg1, f32 arg2, f32 arg3);
s32 ai_check_player_dist(Enemy* enemy, s32 arg1, f32 arg2, f32 arg3);
//pause
void pause_init(void);
@ -398,6 +398,7 @@ s32 npc_test_move_simple_with_slipping(s32, f32*, f32*, f32*, f32, f32, f32, f32
s32 npc_test_move_complex_with_slipping(s32, f32*, f32*, f32*, f32, f32, f32, f32);
// Partner
void partner_handle_before_battle(void);
void partner_walking_update_player_tracking(Npc* partner);
void partner_walking_update_motion(Npc* partner);
void enable_partner_ai(void);
@ -669,15 +670,15 @@ void set_curtain_fade(f32 fade);
void crash_screen_init(void);
void crash_screen_set_draw_info(u16* frameBufPtr, s16 width, s16 height);
void func_800495A0(Evt* script, NpcAISettings* npcAISettings, EnemyTerritoryThing* territory);
void func_800496B8(Evt* script, NpcAISettings* npcAISettings, EnemyTerritoryThing* territory);
void func_80049C04(Evt* script, NpcAISettings* npcAISettings, EnemyTerritoryThing* territory);
void func_80049E3C(Evt* script, NpcAISettings* npcAISettings, EnemyTerritoryThing* territory);
void func_80049ECC(Evt* script, NpcAISettings* npcAISettings, EnemyTerritoryThing* territory);
void func_80049F7C(Evt* script, NpcAISettings* npcAISettings, EnemyTerritoryThing* territory);
void func_8004A124(Evt* script, NpcAISettings* npcAISettings, EnemyTerritoryThing* territory);
void func_8004A3E8(Evt* script, NpcAISettings* npcAISettings, EnemyTerritoryThing* territory);
void func_8004A73C(Evt* script);
void basic_ai_wander_init(Evt* script, NpcAISettings* npcAISettings, EnemyDetectVolume* territory);
void basic_ai_wander(Evt* script, NpcAISettings* npcAISettings, EnemyDetectVolume* territory);
void basic_ai_loiter(Evt* script, NpcAISettings* npcAISettings, EnemyDetectVolume* territory);
void basic_ai_found_player_jump_init(Evt* script, NpcAISettings* npcAISettings, EnemyDetectVolume* territory);
void basic_ai_found_player_jump(Evt* script, NpcAISettings* npcAISettings, EnemyDetectVolume* territory);
void basic_ai_chase_init(Evt* script, NpcAISettings* npcAISettings, EnemyDetectVolume* territory);
void basic_ai_chase(Evt* script, NpcAISettings* npcAISettings, EnemyDetectVolume* territory);
void basic_ai_lose_player(Evt* script, NpcAISettings* npcAISettings, EnemyDetectVolume* territory);
void basic_ai_suspend(Evt* script);
// This legally allows all functions to be pointers without warnings.
// Perhaps the void arg functions can be changed later to remove this need.
@ -696,9 +697,9 @@ void free_generic_entity(s32);
void sfx_get_spatialized_sound_params(f32 arg0, f32 arg1, f32 arg2, s16* arg3, s16* arg4, s32 arg5);
void sfx_play_sound_with_params(s32 arg0, u8 arg1, u8 arg2, s16 arg3);
s32 func_8004A784(Npc* npc, f32 arg1, f32* arg2, f32* arg3, f32* arg4, f32* arg5);
void base_UnkNpcAIFunc1(Evt* script, NpcAISettings* aiSettings, EnemyTerritoryThing* territory);
void UnkNpcAIFunc1(Evt* script, NpcAISettings* aiSettings, EnemyTerritoryThing* territory);
s32 ai_check_fwd_collisions(Npc* npc, f32 arg1, f32* arg2, f32* arg3, f32* arg4, f32* arg5);
void basic_ai_loiter_init(Evt* script, NpcAISettings* aiSettings, EnemyDetectVolume* territory);
void PatrolAI_LoiterInit(Evt* script, NpcAISettings* aiSettings, EnemyDetectVolume* territory);
s32 func_80263230(Actor*, Actor*);
void func_80266EA8(ActorPart*, s32);

View File

@ -98,6 +98,28 @@
#define SPRITE_PIXEL_SCALE (5.0 / 7.0)
/* common AI function and script variables */
// ai script
#define AI_TEMP_STATE functionTemp[0]
#define AI_TEMP_STATE_AFTER_SUSPEND functionTemp[1]
#define AI_PATROL_GOAL_INDEX functionTemp[2]
// melee enemy
#define AI_VAR_ATTACK_STATE varTable[0]
#define AI_VAR_MELEE_PRE_TIME varTable[1]
#define AI_VAR_MELEE_HIT_TIME varTable[2]
#define AI_VAR_MELEE_MISS_TIME varTable[3]
#define AI_VAR_NEXT_STATE varTable[7]
// melee hitbox
#define AI_VAR_HITNPC_YOFFSET varTable[0]
#define AI_VAR_HITNPC_DIST varTable[1]
#define AI_VAR_HITNPC_2 varTable[2]
#define AI_VAR_HITNPC_3 varTable[3]
#define AI_VAR_HITNPC_4 varTable[4]
#define AI_VAR_HITNPC_SOUND varTable[15]
// projectile hitbox
#define VAR_PROJECTILE_HITBOX_STATE varTable[0]
#define AI_PROJECTILE_AMMO_COUNT varTable[3]
#ifdef PERMUTER
#undef SCRIPT
#define SCRIPT(...) {}

View File

@ -75,14 +75,14 @@ typedef struct NpcAISettings {
/* 0x04 */ s32 moveTime;
/* 0x08 */ s32 waitTime;
/* 0x0C */ f32 alertRadius;
/* 0x10 */ X32 unk_10;
/* 0x14 */ s32 unk_14;
/* 0x10 */ f32 alertOffsetDist; // offset along npc->yaw of the test point for alert volume overlap, creates directionality to enemy 'sight'
/* 0x14 */ s32 playerSearchInterval; // how often to search for player (frames)
/* 0x18 */ f32 chaseSpeed;
/* 0x1C */ X32 unk_1C; // chase turn step?
/* 0x20 */ s32 unk_20;
/* 0x1C */ s32 chaseTurnRate; // how many degrees this NPC can turn per frame while chasing
/* 0x20 */ s32 chaseUpdateInterval; // how often to re-run chase init and re-acquire player position (frames)
/* 0x24 */ f32 chaseRadius;
/* 0x28 */ X32 unk_28;
/* 0x2C */ s32 unk_2C; // bool
/* 0x28 */ f32 chaseOffsetDist; // offset along npc->yaw of the test point for chase volume overlap, creates directionality to enemy 'sight'
/* 0x2C */ s32 unk_AI_2C; // unk time
} NpcAISettings; // size = 0x30
typedef struct NpcSettings {
@ -98,7 +98,7 @@ typedef struct NpcSettings {
/* 0x20 */ s32 flags;
/* 0x24 */ char unk_24[4];
/* 0x28 */ s16 level;
/* 0x2A */ s16 unk_2A;
/* 0x2A */ s16 unk_2A; // action flags: 1 = jump on seeing player
} NpcSettings; // size = 0x2C
typedef struct ItemDrop {
@ -190,15 +190,15 @@ typedef struct EnemyDrops {
enum TerritoryShape { SHAPE_CYLINDER, SHAPE_RECT };
typedef struct {
/* 0x00 */ s32 unk_00;
/* 0x00 */ s32 skipPlayerDetectChance;
/* 0x04 */ enum TerritoryShape shape;
/* 0x08 */ s32 pointX;
/* 0x0C */ s32 pointZ;
/* 0x10 */ s32 sizeX;
/* 0x14 */ s32 sizeZ;
/* 0x18 */ f32 unk_18;
/* 0x1C */ s16 unk_1C;
} EnemyTerritoryThing; // size = 0x20
/* 0x18 */ f32 halfHeight;
/* 0x1C */ s16 detectFlags; // 1 = ignore partner hiding (bow/sushie dont work) | 2 = ignore elevation
} EnemyDetectVolume; // size = 0x20
typedef struct {
/* 0x00 */ Vec3i point;
@ -231,7 +231,7 @@ typedef union {
} EnemyTerritory; // size = 0xC0
// function signature used for state handlers in AI main functions
typedef void AIStateHandler(Evt* script, NpcAISettings* settings, EnemyTerritoryThing* territory);
typedef void AIStateHandler(Evt* script, NpcAISettings* settings, EnemyDetectVolume* territory);
typedef struct Enemy {
/* 0x00 */ s32 flags;
@ -269,10 +269,10 @@ typedef struct Enemy {
/* */ f32 varTableF[16];
/* */ void* varTablePtr[16];
/* */ };
/* 0xAC */ u8 unk_AC;
/* 0xAC */ u8 aiDetectFlags; // detect player flags: 1 = require line of sight | 2 = adjust hitbox for moving player
/* 0xAD */ char unk_AD[3];
/* 0xB0 */ u32 unk_B0;
/* 0xB4 */ s8 unk_B4;
/* 0xB0 */ u32 aiFlags;
/* 0xB4 */ s8 aiPaused;
/* 0xB5 */ s8 unk_B5;
/* 0xB6 */ char unk_B6[2];
/* 0xB8 */ EvtScript* unk_B8; // some bytecode
@ -287,7 +287,7 @@ typedef struct Enemy {
/* 0xDC */ char unk_DC[20];
} Enemy; // size = 0xF0
s32 func_800490B4(EnemyTerritoryThing* arg0, Enemy* arg1, f32 arg2, f32 arg3, s8 arg4);
s32 basic_ai_check_player_dist(EnemyDetectVolume* arg0, Enemy* arg1, f32 arg2, f32 arg3, s8 arg4);
/// The default Npc::onUpdate and Npc::onRender callback.
void STUB_npc_callback(Npc*);

View File

@ -17,7 +17,7 @@
/// Decimal constant.
/// Despite the name, "floats" are actually stored as fixed-point values.
// This fixes an issue with fixed point numbers not being correct. POtentially a truncation vs round difference.
// This fixes an issue with fixed point numbers not being correct. Potentially a truncation vs round difference.
#define EVT_FLOAT_ROUND(x) ((x)>=0?(f64)((x) + 0.9):(f64)(x))
#define EVT_FLOAT(DOUBLE) (((Bytecode)EVT_FLOAT_ROUND((DOUBLE * 1024.0f)) + -230000000))

View File

@ -7,7 +7,7 @@
#include "script_api/common.h"
ApiStatus MakeNpcs(Evt* script, s32 isInitialCall);
ApiStatus DoBasicAI(Evt* script, s32 isInitialCall);
ApiStatus BasicAI_Main(Evt* script, s32 isInitialCall);
ApiStatus ResetFromLava(Evt* script, s32 isInitialCall);
ApiStatus MakeShop(Evt* script, s32 isInitialCall);
ApiStatus MakeShopOwner(Evt* script, s32 isInitialCall);

View File

@ -333,7 +333,4 @@ extern EntityBlueprint Entity_ShatteringHammer2BlockTiny;
extern EntityBlueprint Entity_ShatteringHammer3BlockTiny;
extern EntityBlueprint Entity_ShatteringBrickBlock;
// Temporary dead stuff
extern PartnerActionStatus dead_gPartnerActionStatus2;
#endif

View File

@ -246,8 +246,7 @@ ApiStatus OnDefeatEnemy(Evt* script, s32 isInitialCall) {
}
}
script->functionTemp[1] -= 1;
script->functionTemp[1]--;
if (script->functionTemp[1] == 0) {
npc->flags |= NPC_FLAG_2;
return ApiStatus_DONE1;

View File

@ -121,36 +121,42 @@ s32 is_point_within_region(s32 shape, f32 pointX, f32 pointY, f32 centerX, f32 c
}
}
s32 func_800490B4(EnemyTerritoryThing* territory, Enemy* enemy, f32 radius, f32 moveSpeed, s8 arg4) {
s32 basic_ai_check_player_dist(EnemyDetectVolume* territory, Enemy* enemy, f32 radius, f32 fwdPosOffset, s8 useWorldYaw) {
Npc* npc = get_npc_unsafe(enemy->npcID);
PlayerStatus* playerStatus = &gPlayerStatus;
PartnerActionStatus* partnerActionStatus;
f32 x, y, z;
f32 dist;
s32 phi_v0;
s32 skipCheckForPlayer;
if (enemy->unk_B0 & ENEMY_AI_FLAGS_2) {
if (enemy->aiFlags & ENEMY_AI_FLAGS_2) {
return FALSE;
}
partnerActionStatus = &gPartnerActionStatus;
if (partnerActionStatus->actingPartner == PARTNER_BOW && partnerActionStatus->partnerActionState && !(territory->unk_1C & 1)) {
if (partnerActionStatus->actingPartner == PARTNER_BOW && partnerActionStatus->partnerActionState
&& !(territory->detectFlags & AI_TERRITORY_IGNORE_HIDING)) {
return FALSE;
}
if (partnerActionStatus->actingPartner == PARTNER_SUSHIE && partnerActionStatus->partnerActionState && !(territory->unk_1C & 1)) {
if (partnerActionStatus->actingPartner == PARTNER_SUSHIE && partnerActionStatus->partnerActionState
&& !(territory->detectFlags & AI_TERRITORY_IGNORE_HIDING)) {
return FALSE;
}
if (territory->unk_00 < 0) {
if (territory->skipPlayerDetectChance < 0) {
return FALSE;
}
if (territory->unk_18 <= fabsf(npc->pos.y - playerStatus->position.y) && !(territory->unk_1C & 2)) {
if (territory->halfHeight <= fabsf(npc->pos.y - playerStatus->position.y)
&& !(territory->detectFlags & AI_TERRITORY_IGNORE_ELEVATION)) {
return FALSE;
}
if (territory->sizeX | territory->sizeZ && is_point_within_region(territory->shape, territory->pointX, territory->pointZ, playerStatus->position.x, playerStatus->position.z, territory->sizeX, territory->sizeZ)) {
if (territory->sizeX | territory->sizeZ && is_point_within_region(territory->shape,
territory->pointX, territory->pointZ,
playerStatus->position.x, playerStatus->position.z,
territory->sizeX, territory->sizeZ)) {
return FALSE;
}
@ -158,24 +164,28 @@ s32 func_800490B4(EnemyTerritoryThing* territory, Enemy* enemy, f32 radius, f32
return FALSE;
}
if (enemy->unk_AC & 1) {
// check for unbroken line of sight
if (enemy->aiDetectFlags & AI_DETECT_SIGHT) {
x = npc->pos.x;
y = npc->pos.y + npc->collisionHeight * 0.5;
z = npc->pos.z;
dist = dist2D(npc->pos.x, npc->pos.z, playerStatus->position.x, playerStatus->position.z);
if (npc_test_move_simple_with_slipping(0x50000, &x, &y, &z, dist, atan2(npc->pos.x, npc->pos.z, playerStatus->position.x, playerStatus->position.z), 0.1f, 0.1f)) {
if (npc_test_move_simple_with_slipping(0x50000,
&x, &y, &z,
dist, atan2(npc->pos.x, npc->pos.z, playerStatus->position.x, playerStatus->position.z),
0.1f, 0.1f)) {
return FALSE;
}
}
if (territory->unk_00 == 0) {
phi_v0 = 0;
if (territory->skipPlayerDetectChance == 0) {
skipCheckForPlayer = 0;
} else {
phi_v0 = rand_int(territory->unk_00 + 1);
skipCheckForPlayer = rand_int(territory->skipPlayerDetectChance + 1);
}
if (phi_v0 == 0) {
if (enemy->unk_AC & 2) {
if (skipCheckForPlayer == 0) {
if (enemy->aiDetectFlags & AI_DETECT_SENSITIVE_MOTION) {
if (playerStatus->actionState == ACTION_STATE_WALK) {
radius *= 1.15;
} else if (playerStatus->actionState == ACTION_STATE_RUN) {
@ -184,10 +194,10 @@ s32 func_800490B4(EnemyTerritoryThing* territory, Enemy* enemy, f32 radius, f32
}
x = npc->pos.x;
z = npc->pos.z;
if (arg4 & 0xFF) {
add_vec2D_polar(&x, &z, moveSpeed, npc->yaw);
if (useWorldYaw & 0xFF) {
add_vec2D_polar(&x, &z, fwdPosOffset, npc->yaw);
} else {
add_vec2D_polar(&x, &z, moveSpeed, 270.0f - npc->renderYaw);
add_vec2D_polar(&x, &z, fwdPosOffset, 270.0f - npc->renderYaw);
}
if (dist2D(x, z, playerStatus->position.x, playerStatus->position.z) <= radius) {
return TRUE;
@ -197,26 +207,26 @@ s32 func_800490B4(EnemyTerritoryThing* territory, Enemy* enemy, f32 radius, f32
return FALSE;
}
s32 func_800493EC(Enemy* enemy, s32 arg1, f32 arg2, f32 arg3) {
s32 ai_check_player_dist(Enemy* enemy, s32 chance, f32 radius, f32 moveSpeed) {
PlayerStatus* playerStatus = &gPlayerStatus;
Npc* npc = get_npc_unsafe(enemy->npcID);
f32 posX, posZ;
if (arg1 >= 0) {
s32 temp;
if (chance >= 0) {
s32 skipCheckForPlayer;
if (arg1 != 0) {
temp = rand_int(arg1 + 1);
if (chance != 0) {
skipCheckForPlayer = rand_int(chance + 1);
} else {
temp = 0;
skipCheckForPlayer = 0;
}
if (temp == 0) {
f32 f1 = npc->pos.x;
f32 f2 = npc->pos.z;
if (skipCheckForPlayer == 0) {
posX = npc->pos.x;
posZ = npc->pos.z;
add_vec2D_polar(&posX, &posZ, moveSpeed, 270.0f - npc->renderYaw);
add_vec2D_polar(&f1, &f2, arg3, 270.0f - npc->renderYaw);
if (dist2D(f1, f2, playerStatus->position.x, playerStatus->position.z) <= arg2) {
if (dist2D(posX, posZ, playerStatus->position.x, playerStatus->position.z) <= radius) {
return TRUE;
}
}
@ -225,37 +235,38 @@ s32 func_800493EC(Enemy* enemy, s32 arg1, f32 arg2, f32 arg3) {
return FALSE;
}
void ai_enemy_play_sound(Npc* npc, s32 arg1, s32 arg2) {
void ai_enemy_play_sound(Npc* npc, s32 soundID, s32 upperSoundFlags) {
Enemy* enemy = get_enemy(npc->npcID);
s32 value2 = (arg2 & 0xFFFF0000) | 2;
s32 soundFlags = (upperSoundFlags & 0xFFFF0000) | 2;
if (arg2 & 1) {
value2 |= 0x10000;
if (upperSoundFlags & 1) {
soundFlags |= 0x10000;
}
if (enemy->npcSettings->unk_2A & 0x20) {
value2 |= 0x20000;
if (enemy->npcSettings->unk_2A & AI_ACTION_20) {
soundFlags |= 0x20000;
}
sfx_play_sound_at_position(arg1, value2, npc->pos.x, npc->pos.y, npc->pos.z);
sfx_play_sound_at_position(soundID, soundFlags, npc->pos.x, npc->pos.y, npc->pos.z);
}
void func_80049550(Evt* script, s32 arg1) {
void ai_try_set_state(Evt* script, s32 state) {
Npc* npc = get_npc_unsafe(script->owner1.enemy->npcID);
npc->duration--;
if (npc->duration <= 0) {
script->functionTemp[0] = arg1;
script->AI_TEMP_STATE = state;
}
}
void func_800495A0(Evt* script, NpcAISettings* npcAISettings, EnemyTerritoryThing* territory) {
void basic_ai_wander_init(Evt* script, NpcAISettings* npcAISettings, EnemyDetectVolume* territory) {
Enemy* enemy = script->owner1.enemy;
Npc* npc = get_npc_unsafe(enemy->npcID);
// chose a random direction and move time
npc->duration = (npcAISettings->moveTime / 2) + rand_int((npcAISettings->moveTime / 2) + 1);
npc->yaw = clamp_angle(npc->yaw + rand_int(60) - 30.0f);
npc->currentAnim.w = enemy->animList[1];
npc->currentAnim.w = enemy->animList[ENEMY_ANIM_WALK];
script->functionTemp[1] = 0;
if (enemy->territory->wander.moveSpeedOverride < 0) {
@ -264,23 +275,23 @@ void func_800495A0(Evt* script, NpcAISettings* npcAISettings, EnemyTerritoryThin
npc->moveSpeed = enemy->territory->wander.moveSpeedOverride / 32767.0;
}
enemy->unk_B0 &= ~ENEMY_AI_FLAGS_40;
enemy->unk_B0 &= ~ENEMY_AI_FLAGS_20;
script->functionTemp[0] = 1;
enemy->aiFlags &= ~ENEMY_AI_FLAGS_40;
enemy->aiFlags &= ~ENEMY_AI_FLAGS_20;
script->functionTemp[0] = AI_STATE_WANDER;
}
void func_800496B8(Evt* script, NpcAISettings* aiSettings, EnemyTerritoryThing* territory) {
void basic_ai_wander(Evt* script, NpcAISettings* aiSettings, EnemyDetectVolume* territory) {
Enemy* enemy = script->owner1.enemy;
Npc* npc = get_npc_unsafe(enemy->npcID);
s32 phi_s5 = 0;
s32 stillWithinTerritory = FALSE;
f32 x, y, z;
s32 sp34;
f32 yaw;
if (aiSettings->unk_14 >= 0) {
if (aiSettings->playerSearchInterval >= 0) {
if (script->functionTemp[1] <= 0) {
script->functionTemp[1] = aiSettings->unk_14;
if (func_800490B4(territory, enemy, aiSettings->alertRadius, aiSettings->unk_10.f, 0)) {
script->functionTemp[1] = aiSettings->playerSearchInterval;
if (basic_ai_check_player_dist(territory, enemy, aiSettings->alertRadius, aiSettings->alertOffsetDist, 0)) {
x = npc->pos.x;
y = npc->pos.y;
z = npc->pos.z;
@ -289,13 +300,13 @@ void func_800496B8(Evt* script, NpcAISettings* aiSettings, EnemyTerritoryThing*
npc->yaw = yaw;
ai_enemy_play_sound(npc, SOUND_2F4, 0x200000);
fx_emote(EMOTE_EXCLAMATION, npc, 0, npc->collisionHeight, 1.0f, 2.0f, -20.0f, 15, &sp34);
enemy->unk_B0 &= ~ENEMY_AI_FLAGS_40;
enemy->unk_B0 &= ~ENEMY_AI_FLAGS_20;
enemy->aiFlags &= ~ENEMY_AI_FLAGS_40;
enemy->aiFlags &= ~ENEMY_AI_FLAGS_20;
if (enemy->npcSettings->unk_2A & 1) {
script->functionTemp[0] = 10;
if (enemy->npcSettings->unk_2A & AI_ACTION_JUMP_WHEN_SEE_PLAYER) {
script->AI_TEMP_STATE = AI_STATE_ALERT_INIT;
} else {
script->functionTemp[0] = 12;
script->AI_TEMP_STATE = AI_STATE_CHASE_INIT;
}
return;
}
@ -304,6 +315,7 @@ void func_800496B8(Evt* script, NpcAISettings* aiSettings, EnemyTerritoryThing*
script->functionTemp[1]--;
}
// check if the wander we've reached the boundary of the territory
if (is_point_within_region(enemy->territory->wander.wanderShape,
enemy->territory->wander.point.x,
enemy->territory->wander.point.z,
@ -312,13 +324,13 @@ void func_800496B8(Evt* script, NpcAISettings* aiSettings, EnemyTerritoryThing*
enemy->territory->wander.wanderSizeX,
enemy->territory->wander.wanderSizeZ)
&& npc->moveSpeed < dist2D(enemy->territory->wander.point.x, enemy->territory->wander.point.z, npc->pos.x, npc->pos.z)) {
if (!(enemy->unk_B0 & ENEMY_AI_FLAGS_20)) {
enemy->unk_B0 |= (ENEMY_AI_FLAGS_20 | ENEMY_AI_FLAGS_40);
if (!(enemy->aiFlags & ENEMY_AI_FLAGS_20)) {
enemy->aiFlags |= (ENEMY_AI_FLAGS_20 | ENEMY_AI_FLAGS_40);
}
if (enemy->unk_B0 & ENEMY_AI_FLAGS_40) {
if (enemy->aiFlags & ENEMY_AI_FLAGS_40) {
npc->yaw = clamp_angle(atan2(npc->pos.x, npc->pos.z, enemy->territory->wander.point.x, enemy->territory->wander.point.z));
enemy->unk_B0 &= ~ENEMY_AI_FLAGS_40;
enemy->aiFlags &= ~ENEMY_AI_FLAGS_40;
}
x = npc->pos.x;
@ -326,17 +338,18 @@ void func_800496B8(Evt* script, NpcAISettings* aiSettings, EnemyTerritoryThing*
z = npc->pos.z;
if (npc_test_move_simple_with_slipping(npc->collisionChannel, &x, &y, &z, 2.0 * npc->moveSpeed, npc->yaw, npc->collisionHeight, npc->collisionRadius)) {
yaw = clamp_angle(atan2(npc->pos.x, npc->pos.z, enemy->territory->wander.point.x, enemy->territory->wander.point.z));
enemy->unk_B0 &= ~ENEMY_AI_FLAGS_40;
func_8004A784(npc, 5.0f, &yaw, NULL, NULL, NULL);
enemy->aiFlags &= ~ENEMY_AI_FLAGS_40;
ai_check_fwd_collisions(npc, 5.0f, &yaw, NULL, NULL, NULL);
npc->yaw = yaw;
}
phi_s5 = 1;
} else if (enemy->unk_B0 & ENEMY_AI_FLAGS_20) {
enemy->unk_B0 &= ~ENEMY_AI_FLAGS_20;
enemy->unk_B0 &= ~ENEMY_AI_FLAGS_40;
stillWithinTerritory = TRUE;
} else if (enemy->aiFlags & ENEMY_AI_FLAGS_20) {
enemy->aiFlags &= ~ENEMY_AI_FLAGS_20;
enemy->aiFlags &= ~ENEMY_AI_FLAGS_40;
}
if (enemy->territory->wander.wanderSizeX | enemy->territory->wander.wanderSizeZ | phi_s5) {
// perform the motion
if (enemy->territory->wander.wanderSizeX | enemy->territory->wander.wanderSizeZ | stillWithinTerritory) {
if (!npc->turnAroundYawAdjustment) {
npc_move_heading(npc, npc->moveSpeed, npc->yaw);
} else {
@ -344,155 +357,164 @@ void func_800496B8(Evt* script, NpcAISettings* aiSettings, EnemyTerritoryThing*
}
}
// decide to loiter or continue wandering
if (aiSettings->moveTime > 0) {
npc->duration--;
if (npc->duration <= 0) {
script->functionTemp[0] = 2;
script->functionTemp[0] = AI_STATE_LOITER_INIT;
script->functionTemp[1] = rand_int(1000) % 3 + 2;
if (aiSettings->unk_2C <= 0 || aiSettings->waitTime <= 0) {
script->functionTemp[0] = 0;
if (aiSettings->unk_AI_2C <= 0 || aiSettings->waitTime <= 0) {
script->AI_TEMP_STATE = AI_STATE_WANDER_INIT;
}
}
}
}
#define NAMESPACE base
#include "world/common/UnkNpcAIFunc1.inc.c"
void basic_ai_loiter_init(Evt* script, NpcAISettings* aiSettings, EnemyDetectVolume* territory) {
Enemy* enemy = script->owner1.enemy;
Npc* npc = get_npc_unsafe(enemy->npcID);
void func_80049C04(Evt* script, NpcAISettings* aiSettings, EnemyTerritoryThing* territory) {
npc->duration = (aiSettings->waitTime / 2) + rand_int((aiSettings->waitTime / 2) + 1);
npc->yaw = clamp_angle(npc->yaw + rand_int(180) - 90.0f);
npc->currentAnim.w = enemy->animList[ENEMY_ANIM_IDLE];
script->AI_TEMP_STATE = AI_STATE_LOITER;
}
void basic_ai_loiter(Evt* script, NpcAISettings* aiSettings, EnemyDetectVolume* territory) {
Enemy* enemy = script->owner1.enemy;
Npc* npc = get_npc_unsafe(enemy->npcID);
f32 x, y, z;
f32 yaw;
s32 sp34;
s32 emoteTemp;
if (aiSettings->unk_14 >= 0 && func_800490B4(territory, enemy, aiSettings->chaseRadius, aiSettings->unk_28.f, 0)) {
if (aiSettings->playerSearchInterval >= 0 && basic_ai_check_player_dist(territory, enemy, aiSettings->chaseRadius, aiSettings->chaseOffsetDist, 0)) {
x = npc->pos.x;
y = npc->pos.y;
z = npc->pos.z;
yaw = atan2(npc->pos.x, npc->pos.z, gPlayerStatusPtr->position.x, gPlayerStatusPtr->position.z);
if (!npc_test_move_simple_with_slipping(npc->collisionChannel, &x, &y, &z, aiSettings->chaseSpeed, yaw, npc->collisionHeight, npc->collisionRadius)) {
npc->yaw = yaw;
ai_enemy_play_sound(npc, 0x2F4, 0x200000);
fx_emote(EMOTE_EXCLAMATION, npc, 0, npc->collisionHeight, 1.0f, 2.0f, -20.0f, 0xF, &sp34);
if (enemy->npcSettings->unk_2A & 1) {
script->functionTemp[0] = 10;
ai_enemy_play_sound(npc, SOUND_2F4, 0x200000);
fx_emote(EMOTE_EXCLAMATION, npc, 0, npc->collisionHeight, 1.0f, 2.0f, -20.0f, 15, &emoteTemp);
if (enemy->npcSettings->unk_2A & AI_ACTION_JUMP_WHEN_SEE_PLAYER) {
script->AI_TEMP_STATE = AI_STATE_ALERT_INIT;
} else {
script->functionTemp[0] = 12;
script->AI_TEMP_STATE = AI_STATE_CHASE_INIT;
}
return;
}
}
// look around randomly
if (npc->turnAroundYawAdjustment == 0) {
npc->duration--;
if (npc->duration <= 0) {
script->functionTemp[1]--;
if (script->functionTemp[1]) {
if (!(enemy->npcSettings->unk_2A & 0x10)) {
if (!(enemy->npcSettings->unk_2A & AI_ACTION_LOOK_AROUND_DURING_LOITER)) {
npc->yaw = clamp_angle(npc->yaw + 180.0f);
}
npc->duration = (aiSettings->waitTime / 2) + rand_int(aiSettings->waitTime / 2 + 1);
return;
}
script->functionTemp[0] = 0;
script->AI_TEMP_STATE = AI_STATE_WANDER_INIT;
}
}
}
void func_80049E3C(Evt* script, NpcAISettings* npcAISettings, EnemyTerritoryThing* territory) {
void basic_ai_found_player_jump_init(Evt* script, NpcAISettings* npcAISettings, EnemyDetectVolume* territory) {
Enemy* enemy = script->owner1.enemy;
Npc* npc = get_npc_unsafe(enemy->npcID);
ai_enemy_play_sound(npc, 0x3E1, 0);
npc->currentAnim.w = enemy->animList[4];
ai_enemy_play_sound(npc, SOUND_3E1, 0);
npc->currentAnim.w = enemy->animList[ENEMY_ANIM_JUMP];
npc->jumpVelocity = 10.0f;
npc->jumpScale = 2.5f;
npc->moveToPos.y = npc->pos.y;
npc->flags |= 0x800;
script->functionTemp[0] = 11;
npc->flags |= NPC_FLAG_JUMPING;
script->functionTemp[0] = AI_STATE_ALERT;
}
void func_80049ECC(Evt* script, NpcAISettings* npcAISettings, EnemyTerritoryThing* territory) {
void basic_ai_found_player_jump(Evt* script, NpcAISettings* npcAISettings, EnemyDetectVolume* territory) {
Npc* npc = get_npc_unsafe(script->owner1.enemy->npcID);
s32 flag = FALSE;
s32 done = FALSE;
if (npc->jumpVelocity <= 0.0) {
if (npc->pos.y <= npc->moveToPos.y) {
npc->pos.y = npc->moveToPos.y;
flag = TRUE;
done = TRUE;
}
}
if (!flag) {
if (!done) {
npc->pos.y += npc->jumpVelocity;
npc->jumpVelocity -= npc->jumpScale;
} else {
npc->jumpVelocity = 0.0f;
npc->flags &= ~0x800;
script->functionTemp[0] = 12;
npc->flags &= ~NPC_FLAG_JUMPING;
script->functionTemp[0] = AI_STATE_CHASE_INIT;
}
}
void func_80049F7C(Evt* script, NpcAISettings* npcAISettings, EnemyTerritoryThing* territory) {
void basic_ai_chase_init(Evt* script, NpcAISettings* npcAISettings, EnemyDetectVolume* territory) {
Enemy* enemy = script->owner1.enemy;
Npc* npc = get_npc_unsafe(enemy->npcID);
s32 cond = FALSE;
s32 skipTurnAround = FALSE;
if ((gPlayerStatusPtr->actionState == ACTION_STATE_JUMP || gPlayerStatusPtr->actionState == ACTION_STATE_BOUNCE ||
gPlayerStatusPtr->actionState == ACTION_STATE_HOP || gPlayerStatusPtr->actionState == ACTION_STATE_FALLING) &&
(f64)dist2D(npc->pos.x, npc->pos.z, gPlayerStatusPtr->position.x, gPlayerStatusPtr->position.z) < npc->collisionRadius)
{
cond = TRUE;
skipTurnAround = TRUE;
}
if (!cond) {
f32 yaw = atan2(npc->pos.x, npc->pos.z, gPlayerStatusPtr->position.x, gPlayerStatusPtr->position.z);
f32 angleDiff = get_clamped_angle_diff(npc->yaw, yaw);
s32 temp_f4 = npcAISettings->unk_1C.s;
if (!skipTurnAround) {
f32 angle = atan2(npc->pos.x, npc->pos.z, gPlayerStatusPtr->position.x, gPlayerStatusPtr->position.z);
f32 deltaAngleToPlayer = get_clamped_angle_diff(npc->yaw, angle);
if (temp_f4 < fabsf(angleDiff)) {
yaw = npc->yaw;
if (angleDiff < 0.0f) {
yaw += -npcAISettings->unk_1C.s;
if (npcAISettings->chaseTurnRate < fabsf(deltaAngleToPlayer)) {
angle = npc->yaw;
if (deltaAngleToPlayer < 0.0f) {
angle += -npcAISettings->chaseTurnRate;
} else {
yaw += temp_f4;
angle += npcAISettings->chaseTurnRate;
}
}
npc->yaw = clamp_angle(yaw);
npc->duration = (npcAISettings->unk_20 / 2) + rand_int((npcAISettings->unk_20 / 2) + 1);
npc->yaw = clamp_angle(angle);
npc->duration = (npcAISettings->chaseUpdateInterval / 2) + rand_int((npcAISettings->chaseUpdateInterval / 2) + 1);
} else {
npc->duration = 0;
}
npc->currentAnim.w = enemy->animList[3];
npc->currentAnim.w = enemy->animList[ENEMY_ANIM_CHASE];
npc->moveSpeed = npcAISettings->chaseSpeed;
script->functionTemp[0] = 13;
script->functionTemp[0] = AI_STATE_CHASE;
}
void func_8004A124(Evt* script, NpcAISettings* aiSettings, EnemyTerritoryThing* territory) {
void basic_ai_chase(Evt* script, NpcAISettings* aiSettings, EnemyDetectVolume* territory) {
Enemy* enemy = script->owner1.enemy;
Npc* npc = get_npc_unsafe(enemy->npcID);
s32 sp28;
f32 x, y, z;
if (!func_800490B4(territory, enemy, aiSettings->chaseRadius, aiSettings->unk_28.f, 1)) {
if (!basic_ai_check_player_dist(territory, enemy, aiSettings->chaseRadius, aiSettings->chaseOffsetDist, 1)) {
fx_emote(EMOTE_QUESTION, npc, 0, npc->collisionHeight, 1.0f, 2.0f, -20.0f, 15, &sp28);
npc->currentAnim.w = enemy->animList[0];
npc->currentAnim.w = enemy->animList[ENEMY_ANIM_IDLE];
npc->duration = 20;
script->functionTemp[0] = 14;
script->functionTemp[0] = AI_STATE_LOSE_PLAYER;
return;
}
if (enemy->npcSettings->unk_2A & 4) {
if (enemy->npcSettings->unk_2A & AI_ACTION_04) {
if (dist2D(npc->pos.x, npc->pos.z, gPlayerStatusPtr->position.x, gPlayerStatusPtr->position.z) > (npc->moveSpeed * 5.0)) {
x = npc->pos.x;
y = npc->pos.y;
z = npc->pos.z;
if (npc_test_move_simple_with_slipping(npc->collisionChannel, &x, &y, &z, 1.0f, npc->yaw, npc->collisionHeight, npc->collisionRadius)) {
fx_emote(EMOTE_QUESTION, npc, 0, npc->collisionHeight, 1.0f, 2.0f, -20.0f, 0xC, &sp28);
npc->currentAnim.w = enemy->animList[0];
npc->currentAnim.w = enemy->animList[ENEMY_ANIM_IDLE];
npc->duration = 15;
script->functionTemp[0] = 14;
script->functionTemp[0] = AI_STATE_LOSE_PLAYER;
return;
}
}
@ -502,53 +524,52 @@ void func_8004A124(Evt* script, NpcAISettings* aiSettings, EnemyTerritoryThing*
npc_move_heading(npc, npc->moveSpeed, npc->yaw);
if (npc->moveSpeed > 8.0 && !(gGameStatusPtr->frameCounter % 5)) {
ai_enemy_play_sound(npc, 0x20C1, 0);
ai_enemy_play_sound(npc, SOUND_20C1, 0);
}
if (npc->duration > 0) {
npc->duration--;
} else {
script->functionTemp[0] = 12;
script->functionTemp[0] = AI_STATE_CHASE_INIT;
}
}
void func_8004A3E8(Evt* script, NpcAISettings* npcAISettings, EnemyTerritoryThing* territory) {
void basic_ai_lose_player(Evt* script, NpcAISettings* npcAISettings, EnemyDetectVolume* territory) {
Enemy* enemy = script->owner1.enemy;
Npc* npc = get_npc_unsafe(enemy->npcID);
npc->duration--;
if (npc->duration == 0) {
npc->yaw = clamp_angle(atan2(npc->pos.x, npc->pos.z, enemy->territory->wander.point.x,
enemy->territory->wander.point.z));
script->functionTemp[0] = 0;
// turn to face home position
npc->yaw = clamp_angle(atan2(npc->pos.x, npc->pos.z, enemy->territory->wander.point.x, enemy->territory->wander.point.z));
script->functionTemp[0] = AI_STATE_WANDER_INIT;
}
}
ApiStatus DoBasicAI(Evt* script, s32 isInitialCall) {
ApiStatus BasicAI_Main(Evt* script, s32 isInitialCall) {
Enemy* enemy = script->owner1.enemy;
Npc* npc = get_npc_unsafe(enemy->npcID);
Bytecode* args = script->ptrReadPos;
EnemyTerritoryThing territory;
EnemyTerritoryThing* pTerritory = &territory;
EnemyDetectVolume territory;
EnemyDetectVolume* pTerritory = &territory;
NpcAISettings* aiSettings = (NpcAISettings*) evt_get_variable(script, *args++);
territory.unk_00 = 0;
territory.skipPlayerDetectChance = 0;
territory.shape = enemy->territory->wander.detectShape;
territory.pointX = enemy->territory->wander.detect.x;
territory.pointZ = enemy->territory->wander.detect.z;
territory.sizeX = enemy->territory->wander.detectSizeX;
territory.sizeZ = enemy->territory->wander.detectSizeZ;
territory.unk_18 = 65.0f;
territory.unk_1C = 0;
territory.halfHeight = 65.0f;
territory.detectFlags = 0;
if (isInitialCall || enemy->unk_B0 & ENEMY_AI_FLAGS_4) {
script->functionTemp[0] = 0;
if (isInitialCall || enemy->aiFlags & ENEMY_AI_FLAGS_4) {
script->functionTemp[0] = AI_STATE_WANDER_INIT;
npc->duration = 0;
npc->currentAnim.w = enemy->animList[0];
npc->currentAnim.w = enemy->animList[ENEMY_ANIM_IDLE];
npc->flags &= ~NPC_FLAG_NO_Y_MOVEMENT;
npc->flags &= ~NPC_FLAG_JUMPING;
if (!enemy->territory->wander.isFlying) {
npc->flags |= NPC_FLAG_GRAVITY;
npc->flags &= ~NPC_FLAG_ENABLE_HIT_SCRIPT;
@ -557,50 +578,50 @@ ApiStatus DoBasicAI(Evt* script, s32 isInitialCall) {
npc->flags |= NPC_FLAG_ENABLE_HIT_SCRIPT;
}
if (enemy->unk_B0 & ENEMY_AI_FLAGS_4) {
script->functionTemp[0] = 99;
script->functionTemp[1] = 0;
if (enemy->aiFlags & ENEMY_AI_FLAGS_4) {
script->functionTemp[0] = AI_STATE_SUSPEND;
script->functionTemp[1] = AI_STATE_WANDER_INIT;
} else if (enemy->flags & ENEMY_FLAGS_40000000) {
script->functionTemp[0] = 12;
script->functionTemp[0] = AI_STATE_CHASE_INIT;
}
enemy->unk_B0 &= ~ENEMY_AI_FLAGS_4;
enemy->aiFlags &= ~ENEMY_AI_FLAGS_4;
enemy->flags &= ~ENEMY_FLAGS_40000000;
}
switch (script->functionTemp[0]) {
case 0x0:
func_800495A0(script, aiSettings, pTerritory);
/* fallthrough */
case 0x1:
func_800496B8(script, aiSettings, pTerritory);
case AI_STATE_WANDER_INIT:
basic_ai_wander_init(script, aiSettings, pTerritory);
// fallthrough
case AI_STATE_WANDER:
basic_ai_wander(script, aiSettings, pTerritory);
break;
case 0x2:
base_UnkNpcAIFunc1(script, aiSettings, pTerritory);
/* fallthrough */
case 0x3:
func_80049C04(script, aiSettings, pTerritory);
case AI_STATE_LOITER_INIT:
basic_ai_loiter_init(script, aiSettings, pTerritory);
// fallthrough
case AI_STATE_LOITER:
basic_ai_loiter(script, aiSettings, pTerritory);
break;
case 0xA:
func_80049E3C(script, aiSettings, pTerritory);
/* fallthrough */
case 0xB:
func_80049ECC(script, aiSettings, pTerritory);
case AI_STATE_ALERT_INIT:
basic_ai_found_player_jump_init(script, aiSettings, pTerritory);
// fallthrough
case AI_STATE_ALERT:
basic_ai_found_player_jump(script, aiSettings, pTerritory);
break;
case 0xC:
func_80049F7C(script, aiSettings, pTerritory);
/* fallthrough */
case 0xD:
func_8004A124(script, aiSettings, pTerritory);
if (script->functionTemp[0] != 0xE) {
case AI_STATE_CHASE_INIT:
basic_ai_chase_init(script, aiSettings, pTerritory);
// fallthrough
case AI_STATE_CHASE:
basic_ai_chase(script, aiSettings, pTerritory);
if (script->functionTemp[0] != AI_STATE_LOSE_PLAYER) {
break;
}
/* fallthrough */
case 0xE:
func_8004A3E8(script, aiSettings, pTerritory);
// fallthrough
case AI_STATE_LOSE_PLAYER:
basic_ai_lose_player(script, aiSettings, pTerritory);
break;
case 0x63:
func_8004A73C(script);
case AI_STATE_SUSPEND:
basic_ai_suspend(script);
break;
}
return ApiStatus_BLOCK;

View File

@ -1,7 +1,7 @@
#include "common.h"
#include "npc.h"
void func_8004A6F0(Evt* script) {
void ai_suspend_for_time(Evt* script) {
Npc* npc = get_npc_unsafe(script->owner1.enemy->npcID);
npc->duration--;
@ -10,58 +10,68 @@ void func_8004A6F0(Evt* script) {
}
}
void func_8004A73C(Evt* script) {
void basic_ai_suspend(Evt* script) {
Enemy* enemy = script->owner1.enemy;
get_npc_unsafe(enemy->npcID);
if (enemy->unk_B4 == 0) {
if (enemy->aiPaused == 0) {
script->functionTemp[0] = script->functionTemp[1];
}
}
s32 func_8004A784(Npc* npc, f32 arg1, f32* outYaw, f32* outDist1, f32* outDist2, f32* outDist3) {
s32 ai_check_fwd_collisions(Npc* npc, f32 time, f32* outYaw, f32* outDistFwd, f32* outDistCW, f32* outDistCCW) {
f32 x1, y1, z1;
f32 x2, y2, z2;
f32 x3, y3, z3;
f32 dist1 = -1.0f;
f32 dist2 = -1.0f;
f32 dist3 = -1.0f;
f32 fwdHitDist = -1.0f;
f32 cwHitDist = -1.0f;
f32 ccwHitDist = -1.0f;
f32 yaw;
s32 ret;
s32 fwdHit;
x1 = npc->pos.x;
y1 = npc->pos.y;
z1 = npc->pos.z;
yaw = *outYaw;
ret = npc_test_move_simple_with_slipping(npc->collisionChannel, &x1, &y1, &z1, npc->moveSpeed * arg1,
yaw, npc->collisionHeight, npc->collisionRadius);
if (ret != 0) {
dist1 = dist2D(npc->pos.x, npc->pos.z, x1, z1);
fwdHit = npc_test_move_simple_with_slipping(npc->collisionChannel,
&x1, &y1, &z1,
npc->moveSpeed * time,
yaw,
npc->collisionHeight,
npc->collisionRadius);
if (fwdHit != 0) {
fwdHitDist = dist2D(npc->pos.x, npc->pos.z, x1, z1);
x2 = npc->pos.x;
y2 = npc->pos.y;
z2 = npc->pos.z;
if (npc_test_move_simple_with_slipping(npc->collisionChannel, &x2, &y2, &z2, npc->moveSpeed * arg1,
clamp_angle(yaw + 35.0f), npc->collisionHeight,
npc->collisionRadius) != 0) {
dist2 = dist2D(npc->pos.x, npc->pos.z, x2, z2);
if (npc_test_move_simple_with_slipping(npc->collisionChannel,
&x2, &y2, &z2, npc->moveSpeed * time,
clamp_angle(yaw + 35.0f),
npc->collisionHeight,
npc->collisionRadius) != 0) {
cwHitDist = dist2D(npc->pos.x, npc->pos.z, x2, z2);
}
x3 = npc->pos.x;
y3 = npc->pos.y;
z3 = npc->pos.z;
if (npc_test_move_simple_with_slipping(npc->collisionChannel, &x3, &y3, &z3, npc->moveSpeed * arg1,
clamp_angle(yaw - 35.0f), npc->collisionHeight, npc->collisionRadius)
!= 0) {
dist3 = dist2D(npc->pos.x, npc->pos.z, x3, z3);
if (npc_test_move_simple_with_slipping(npc->collisionChannel,
&x3, &y3, &z3,
npc->moveSpeed * time,
clamp_angle(yaw - 35.0f),
npc->collisionHeight,
npc->collisionRadius) != 0) {
ccwHitDist = dist2D(npc->pos.x, npc->pos.z, x3, z3);
}
if ((dist2 < dist1 && dist3 < dist2) || (dist3 < dist1 && dist2 < dist3)) {
if ((cwHitDist < fwdHitDist && ccwHitDist < cwHitDist) || (ccwHitDist < fwdHitDist && cwHitDist < ccwHitDist)) {
yaw = npc->yaw;
} else if ((dist1 < dist2 && dist3 < dist1) || (dist3 < dist2 && dist1 < dist3)) {
} else if ((fwdHitDist < cwHitDist && ccwHitDist < fwdHitDist) || (ccwHitDist < cwHitDist && fwdHitDist < ccwHitDist)) {
yaw = npc->yaw + 35.0f;
} else if ((dist1 < dist3 && dist2 < dist1) || (dist2 < dist3 && dist1 < dist2)) {
} else if ((fwdHitDist < ccwHitDist && cwHitDist < fwdHitDist) || (cwHitDist < ccwHitDist && fwdHitDist < cwHitDist)) {
yaw = npc->yaw - 35.0f;
}
}
@ -69,14 +79,14 @@ s32 func_8004A784(Npc* npc, f32 arg1, f32* outYaw, f32* outDist1, f32* outDist2,
if (outYaw != NULL) {
*outYaw = clamp_angle(yaw);
}
if (outDist1 != NULL) {
*outDist1 = dist1;
if (outDistFwd != NULL) {
*outDistFwd = fwdHitDist;
}
if (outDist2 != NULL) {
*outDist2 = dist2;
if (outDistCW != NULL) {
*outDistCW = cwHitDist;
}
if (outDist3 != NULL) {
*outDist3 = dist3;
if (outDistCCW != NULL) {
*outDistCCW = ccwHitDist;
}
return ret;
return fwdHit;
}

View File

@ -11,327 +11,22 @@ const char ascii_EA6D78[] = "kzn_18";
extern s32 D_802466D0[];
void func_8004D8E0(DeadEnemy*);
void func_80240DC4_EA16C4(Evt* script, NpcAISettings* aiSettings, EnemyTerritoryThing* territory);
void func_80240DC4_EA16C4(Evt* script, NpcAISettings* aiSettings, EnemyDetectVolume* territory);
#include "world/common/UnkNpcAIFunc6.inc.c"
#include "world/common/enemy/WanderMeleeAI.inc.c"
#include "world/common/enemy/wip/PiranhaPlantAI_00.inc.c"
#include "world/common/enemy/wip/PiranhaPlantAI_01.inc.c"
#include "world/common/UnkNpcAIFunc7.inc.c"
#include "world/common/UnkNpcAIFunc8.inc.c"
#include "world/common/UnkNpcAIFunc5.inc.c"
//Basically UnkNpcAIFunc26.inc.c, but gPartnerActionStatus.partnerActionState access 0, instead of 3
s32 N(UnkNpcAIFunc26)(Evt* script) {
Enemy* enemy = script->owner1.enemy;
Npc* npc = get_npc_unsafe(enemy->npcID);
Camera* camera = &gCameras[gCurrentCamID];
Enemy* enemy2 = get_enemy(enemy->npcID + 1);
f32 phi_f20;
s32 ret = TRUE;
if (dist2D(npc->pos.x, npc->pos.z, gPlayerStatusPtr->position.x, gPlayerStatusPtr->position.z) > enemy2->varTable[2]) {
ret = FALSE;
}
if (clamp_angle(get_clamped_angle_diff(camera->currentYaw, npc->yaw)) < 180.0) {
phi_f20 = 90.0f;
} else {
phi_f20 = 270.0f;
}
if (fabsf(get_clamped_angle_diff(phi_f20, atan2(npc->pos.x, npc->pos.z, gPlayerStatusPtr->position.x,
gPlayerStatusPtr->position.z))) > enemy2->varTable[3]) {
ret = FALSE;
}
if ((2.0 * npc->collisionHeight) <= fabsf(npc->pos.y - gPlayerStatusPtr->position.y)) {
ret = FALSE;
}
if (gPartnerActionStatus.partnerActionState == PARTNER_BOW) {
ret = FALSE;
}
if (gPartnerActionStatus.partnerActionState == PARTNER_SUSHIE) {
ret = FALSE;
}
return ret;
}
// Similar to UnkFunc7
ApiStatus func_802406CC_EA0FCC(Evt* script, s32 isInitialCall) {
DeadEnemy* enemy = (DeadEnemy*) script->owner1.enemy;
Npc* npc = get_npc_unsafe(enemy->npcID);
Enemy* enemy2;
Npc* npc2;
f32 posX, posZ;
enemy->unk_108.x = npc->pos.x;
enemy->unk_108.y = npc->pos.y;
enemy->unk_108.z = npc->pos.z;
enemy->unk_114 = 0.0001f;
enemy->unk_118 = 0.0001f;
if (isInitialCall || enemy->unk_B0 & ENEMY_AI_FLAGS_4) {
script->functionTemp[0] = 0;
npc->duration = 0;
npc->flags |= NPC_FLAG_2 | NPC_FLAG_100;
enemy->flags |= ENEMY_FLAGS_100000 | ENEMY_FLAGS_200000 | ENEMY_FLAGS_IGNORE_TOUCH | ENEMY_FLAGS_IGNORE_JUMP | ENEMY_FLAGS_IGNORE_HAMMER | ENEMY_FLAGS_8000000 | ENEMY_FLAGS_10000000;
npc->pos.x = 0.0f;
npc->pos.y = -1000.0f;
npc->pos.z = 0.0f;
if (enemy->unk_B0 & ENEMY_AI_FLAGS_4) {
enemy->unk_B0 &= ~ENEMY_AI_FLAGS_4;
}
}
switch (script->functionTemp[0]) {
case 0:
enemy2 = get_enemy(enemy->npcID - 1);
npc2 = get_npc_unsafe(enemy2->npcID);
enemy->unk_07 = 1;
if (enemy2->varTable[0] == 3) {
if (enemy->varTable[15] != 0) {
ai_enemy_play_sound(npc2, enemy->varTable[15], 0);
}
posX = npc2->pos.x;
posZ = npc2->pos.z;
add_vec2D_polar(&posX, &posZ, enemy->varTable[1], 270.0f - npc2->renderYaw);
npc->pos.x = posX;
enemy->unk_10.x = npc->pos.x;
npc->pos.y = npc2->pos.y + enemy->varTable[0];
enemy->unk_10.y = npc->pos.y;
npc->pos.z = posZ;
enemy->unk_10.z = npc->pos.z;
npc->yaw = atan2(npc->pos.x, npc->pos.z, gPlayerStatusPtr->position.x, gPlayerStatusPtr->position.z);
enemy->flags &= ~(ENEMY_FLAGS_100000 | ENEMY_FLAGS_IGNORE_TOUCH | ENEMY_FLAGS_IGNORE_JUMP | ENEMY_FLAGS_IGNORE_HAMMER | ENEMY_FLAGS_8000000 | ENEMY_FLAGS_10000000);
npc->duration = 0;
script->functionTemp[0] = 1;
}
break;
case 1:
enemy2 = get_enemy(enemy->npcID - 1);
get_npc_unsafe(enemy2->npcID);
npc->duration++;
if (npc->duration >= enemy->varTable[4]) {
enemy->unk_07 = 0;
}
if (enemy2->varTable[0] == 4) {
enemy->flags |= ENEMY_FLAGS_100000 | ENEMY_FLAGS_IGNORE_TOUCH | ENEMY_FLAGS_IGNORE_JUMP | ENEMY_FLAGS_IGNORE_HAMMER | ENEMY_FLAGS_8000000 | ENEMY_FLAGS_10000000;
npc->pos.x = 0.0f;
npc->pos.y = -1000.0f;
npc->pos.z = 0.0f;
enemy->unk_07 = 1;
script->functionTemp[0] = 0;
}
break;
}
if (enemy->unk_07 != 0) {
enemy->unk_114 = 7.0f;
enemy->unk_118 = 1.0f;
}
return ApiStatus_BLOCK;
}
// Similar to UnkNpcAIFunc27
ApiStatus func_8024097C_EA127C(Evt* script, s32 isInitialCall) {
DeadEnemy* enemy = (DeadEnemy*) script->owner1.enemy;
Npc* npc = get_npc_unsafe(enemy->npcID);
Bytecode* args = script->ptrReadPos;
EnemyTerritoryThing territory;
EnemyTerritoryThing* territoryPtr = &territory;
NpcAISettings* npcAISettings = (NpcAISettings*)evt_get_variable(script, *args++);
territory.unk_00 = 0;
territory.shape = enemy->territory->wander.detectShape;
territory.pointX = enemy->territory->wander.detect.x;
territory.pointZ = enemy->territory->wander.detect.z;
territory.sizeX = enemy->territory->wander.detectSizeX;
territory.sizeZ = enemy->territory->wander.detectSizeZ;
territory.unk_18 = 65.0f;
territory.unk_1C = 0;
enemy->unk_108.x = npc->pos.x;
enemy->unk_108.y = npc->pos.y;
enemy->unk_108.z = npc->pos.z;
enemy->unk_114 = 0.0001f;
enemy->unk_118 = 0.0001f;
if (isInitialCall || enemy->unk_B0 & ENEMY_AI_FLAGS_4) {
script->functionTemp[0] = 0;
npc->duration = 0;
npc->currentAnim.w = enemy->animList[0];
npc->flags &= ~NPC_FLAG_NO_Y_MOVEMENT;
if (!enemy->territory->wander.isFlying) {
npc->flags = (npc->flags | NPC_FLAG_GRAVITY) & ~NPC_FLAG_ENABLE_HIT_SCRIPT;
} else {
npc->flags = (npc->flags & ~NPC_FLAG_GRAVITY) | NPC_FLAG_ENABLE_HIT_SCRIPT;
}
if (enemy->unk_B0 & ENEMY_AI_FLAGS_4) {
script->functionTemp[0] = 99;
script->functionTemp[1] = 0;
enemy->unk_B0 &= ~ENEMY_AI_FLAGS_4;
}
enemy->varTable[0] = 0;
}
if (script->functionTemp[0] < 30 && enemy->varTable[0] == 0 && N(UnkNpcAIFunc26)(script)) {
script->functionTemp[0] = 30;
}
switch (script->functionTemp[0]) {
case 0:
func_800495A0(script, npcAISettings, territoryPtr);
// fallthrough
case 1:
func_800496B8(script, npcAISettings, territoryPtr);
break;
case 2:
base_UnkNpcAIFunc1(script, npcAISettings, territoryPtr);
// fallthrough
case 3:
func_80049C04(script, npcAISettings, territoryPtr);
break;
case 10:
func_80049E3C(script, npcAISettings, territoryPtr);
// fallthrough
case 11:
func_80049ECC(script, npcAISettings, territoryPtr);
break;
case 12:
func_80049F7C(script, npcAISettings, territoryPtr);
// fallthrough
case 13:
func_8004A124(script, npcAISettings, territoryPtr);
break;
case 14:
func_8004A3E8(script, npcAISettings, territoryPtr);
break;
case 30:
N(UnkNpcAIFunc6)(script);
// fallthrough
case 31:
N(UnkNpcAIFunc7)(script);
if (script->functionTemp[0] != 32) {
break;
}
case 32:
N(UnkNpcAIFunc8)(script);
if (script->functionTemp[0] != 33) {
break;
}
case 33:
N(UnkNpcAIFunc5)(script);
break;
case 99:
func_8004A73C(script);
break;
}
return ApiStatus_BLOCK;
}
#include "world/common/UnkNpcAIFunc31.inc.c"
#include "world/common/UnkNpcAIFunc32.inc.c"
// sqrtf issue - Would be UnkNpcAiFunc46
// sqrtf issue - Would be PiranhaPlantAI_10
INCLUDE_ASM(s32, "EA0C10", func_80240DC4_EA16C4);
#include "world/common/UnkNpcDurationFlagFunc3.inc.c"
#include "world/common/enemy/wip/PiranhaPlantAI_11.inc.c"
#include "world/common/enemy/wip/PiranhaPlantAI_12.inc.c"
#include "world/common/enemy/wip/PiranhaPlantAI_13.inc.c"
#include "world/common/enemy/wip/PiranhaPlantAI_14.inc.c"
#include "world/common/enemy/wip/Dead_PiranhaPlantAI_Main.inc.c"
#include "world/common/UnkNpcAIFunc33.inc.c"
#include "world/common/UnkNpcDurationFlagFunc2.inc.c"
#include "world/common/UnkNpcAIFunc30.inc.c"
ApiStatus func_80241AE0_EA23E0(Evt* script, s32 isInitialCall) {
DeadEnemy* enemy = (DeadEnemy*) script->owner1.enemy;
Npc* npc = get_npc_unsafe(enemy->npcID);
NpcAISettings* settings = (NpcAISettings*) evt_get_variable(script, *script->ptrReadPos);
EnemyTerritoryThing territory;
EnemyTerritoryThing* territoryPtr = &territory;
territory.unk_00 = 0;
territory.shape = enemy->territory->wander.detectShape;
territory.pointX = enemy->territory->wander.detect.x;
territory.pointZ = enemy->territory->wander.detect.z;
territory.sizeX = enemy->territory->wander.detectSizeX;
territory.sizeZ = enemy->territory->wander.detectSizeZ;
territory.unk_18 = 200.0f;
territory.unk_1C = 0;
// Dead Func that doesn't seem to have an alive counterpart, probably because of the
// difference in the Enemy and DeadEnemy struct.
func_8004D8E0(enemy);
if (enemy->flags & ENEMY_FLAGS_100000) {
enemy->unk_114 = 10.0f;
enemy->unk_118 = 0.7f;
}
if (isInitialCall || enemy->unk_B0 & ENEMY_AI_FLAGS_4) {
script->functionTemp[0] = 0;
npc->duration = 0;
npc->currentAnim.w = enemy->animList[0];
enemy->varTable[0] = 0;
if (enemy->unk_B0 & ENEMY_AI_FLAGS_4) {
script->functionTemp[0] = 99;
script->functionTemp[1] = 0;
enemy->unk_B0 &= ~ENEMY_AI_FLAGS_4;
}
}
switch (script->functionTemp[0]) {
case 0:
N(UnkNpcAIFunc31)(script, settings, territoryPtr);
/* fallthrough */
case 1:
N(UnkNpcAIFunc32)(script, settings, territoryPtr);
break;
case 10:
func_80240DC4_EA16C4(script, settings, territoryPtr);
if (script->functionTemp[0] != 11) {
break;
}
case 11:
N(UnkNpcDurationFlagFunc3)(script, settings, territoryPtr);
if (script->functionTemp[0] != 12) {
break;
}
case 12:
N(UnkNpcAIFunc33)(script, settings, territoryPtr);
if (script->functionTemp[0] != 13) {
break;
}
case 13:
N(UnkNpcDurationFlagFunc2)(script, settings, territoryPtr);
if (script->functionTemp[0] != 14) {
break;
}
case 14:
N(UnkNpcAIFunc30)(script, settings, territoryPtr);
break;
case 99:
func_8004A73C(script);
break;
}
return ApiStatus_BLOCK;
}
#include "world/common/atomic/enemy/UnkAI_StateHandlers_A.inc.c"
#include "world/common/DeadUnkNpcAIMainFunc5.inc.c"
#include "world/common/enemy/TackleAI.inc.c"
#include "world/common/AwaitPlayerNearNpc.inc.c"
@ -397,31 +92,5 @@ ApiStatus func_80242A4C_EA334C(Evt* script, s32 isInitialCall) {
return ApiStatus_DONE2;
}
#include "world/common/SetManyVars.inc.c"
#include "world/common/UnkYawFunc.inc.c"
// Requires data migration
#ifdef NON_MATCHING
ApiStatus func_80242D64_EA3664(Evt* script, s32 isInitialCall) {
Npc* npc = get_npc_unsafe(script->varTable[2]);
D_80246894 = npc->currentAnim.w;
npc->currentAnim.w = script->varTable[4];
return ApiStatus_DONE2;
}
#else
INCLUDE_ASM(s32, "EA0C10", func_80242D64_EA3664);
#endif
// Requires data migration
#ifdef NON_MATCHING
ApiStatus func_80242DA8_EA36A8(Evt* script, s32 isInitialCall) {
get_npc_unsafe(script->varTable[2])->currentAnim.w = D_80246894;
return ApiStatus_DONE2;
}
#else
INCLUDE_ASM(s32, "EA0C10", func_80242DA8_EA36A8);
#endif
extern s32 N(LetterDelivery_SavedNpcAnim);
#include "world/common/LetterDelivery.inc.c"

View File

@ -13,7 +13,14 @@ ApiStatus N(SpinyTrompHit)(Evt* script, s32 isInitialCall) {
return ApiStatus_DONE2;
}
INCLUDE_ASM(s32, "EA36E0", func_80242E00_EA3700);
ApiStatus N(GetActingPartner)(Evt* script, s32 isInitialCall) {
if (gPartnerActionStatus.partnerActionState != 0) {
script->varTable[0] = gPartnerActionStatus.actingPartner;
} else {
script->varTable[0] = -1;
}
return ApiStatus_DONE2;
}
#include "world/common/UnkFunc46.inc.c"

View File

@ -67,12 +67,7 @@ ApiStatus func_80241838_EAA318(Evt* script, s32 isInitialCall) {
return ApiStatus_DONE2;
}
#include "world/common/SetManyVars.inc.c"
#include "world/common/UnkYawFunc.inc.c"
INCLUDE_ASM(s32, "EA8AE0", func_80241B50_EAA630);
INCLUDE_ASM(s32, "EA8AE0", func_80241B94_EAA674);
extern s32 N(LetterDelivery_SavedNpcAnim);
#include "world/common/LetterDelivery.inc.c"
INCLUDE_ASM(s32, "EA8AE0", func_80241BC0_EAA6A0);

View File

@ -9,7 +9,7 @@ extern s32 func_80059AC8(s32, s32);
extern s32 D_802417E4_EB2644;
extern s32 D_802417E8_EB2648;
extern s32 D_802442D0[];
extern u32 D_80244494;
extern s32 EB1170_LetterDelivery_SavedNpcAnim;
extern s32 D_800B8DEC;
#include "world/common/StashVars.inc.c"
@ -66,23 +66,8 @@ ApiStatus func_802406E0_EB1540(Evt* script, s32 isInitialCall) {
return ApiStatus_DONE2;
}
#include "world/common/SetManyVars.inc.c"
#include "world/common/UnkYawFunc.inc.c"
ApiStatus func_802409F8_EB1858(Evt* script, s32 isInitialCall) {
Npc* npc = get_npc_unsafe(script->varTable[2]);
D_80244494 = npc->currentAnim.w;
npc->currentAnim.w = (u32)script->varTable[4];
return ApiStatus_DONE2;
}
ApiStatus func_80240A3C_EB189C(Evt* script, s32 isInitialCall) {
get_npc_unsafe(script->varTable[2])->currentAnim.w = D_80244494;
return ApiStatus_DONE2;
}
extern s32 N(LetterDelivery_SavedNpcAnim);
#include "world/common/LetterDelivery.inc.c"
ApiStatus func_80240A68_EB18C8(Evt* script, s32 isInitialCall) {
func_80059AC8(0, 1);

View File

@ -5,7 +5,7 @@
#define NAMESPACE EB8E90
#include "world/common/atomic/enemy/Dead_UnkAI_1.inc.c"
#include "world/common/enemy/PatrolNoAttackAI.inc.c"
ApiStatus N(PostChapter6StatUpdate)(Evt* script, s32 isInitialCall) {
PlayerData* playerData = &gPlayerData;

View File

@ -55,18 +55,18 @@ ApiStatus func_80240158_EC2358(Evt* script, s32 isInitialCall) {
osSyncPrintf("cccc\n");
}
}
npc->currentAnim.w = enemy->animList[2];
npc->currentAnim.w = enemy->animList[ENEMY_ANIM_RUN];
npc->yaw = atan2(npc->pos.x, npc->pos.z, sp10, sp14);
npc_move_heading(npc, 2.0f, npc->yaw);
} else if (temp_f4 > 0.2) {
npc->yaw = atan2(npc->pos.x, npc->pos.z, sp10, sp14);
npc->pos.x = sp10;
npc->pos.z = sp14;
npc->currentAnim.w = enemy->animList[1];
npc->currentAnim.w = enemy->animList[ENEMY_ANIM_WALK];
} else {
npc->pos.x = sp10;
npc->pos.z = sp14;
npc->currentAnim.w = enemy->animList[0];
npc->currentAnim.w = enemy->animList[ENEMY_ANIM_IDLE];
}
return ApiStatus_BLOCK;
}

View File

@ -5,6 +5,4 @@
#define NAMESPACE EC9D00
#define gPartnerActionStatus dead_gPartnerActionStatus2
#include "world/common/atomic/SuperBlock.inc.c"

View File

@ -1,5 +1,6 @@
#include "dead.h"
#include "common.h"
#include "effects.h"
#include "dead_structs.h"
// Copy of flo_08 (CAFAC0.c)
@ -9,203 +10,9 @@
extern s32 N(ItemChoiceList)[];
extern s32 N(FlowerGuard_ItemChoiceList)[91];
void func_80241364_ECB064(Evt* script, NpcAISettings* npcAISettings, EnemyTerritoryThing* territory);
void ECAA80_UnkFloAI_Chase(Evt* script, NpcAISettings* aiSettings, EnemyDetectVolume* territory);
void func_80240D80_ECAA80(Evt* script, NpcAISettings* npcAISettings, EnemyTerritoryThing* territory) {
Enemy* enemy = script->owner1.enemy;
Npc* npc = get_npc_unsafe(enemy->npcID);
f32 temp_f0;
f32 temp_f20;
f64 temp_f2;
f32 phi_f22;
f32 phi_f24;
f32 phi_f26;
s32 phi_s3;
f32 subroutine_arg8;
f32 subroutine_arg9;
f32 subroutine_argA;
f32 subroutine_argB;
f32 subroutine_argC;
f32 subroutine_argD;
f32 subroutine_argE;
f32 subroutine_argF;
f32 subroutine_arg10;
npc->duration = npcAISettings->unk_20 / 2 + rand_int(npcAISettings->unk_20 / 2 + 1);
npc->currentAnim.w = enemy->animList[3];
npc->moveSpeed = npcAISettings->chaseSpeed;
phi_s3 = FALSE;
temp_f20 = clamp_angle(atan2(npc->pos.x, npc->pos.z, gPlayerStatusPtr->position.x,
gPlayerStatusPtr->position.z) + 180.0f);
temp_f0 = get_clamped_angle_diff(npc->yaw, temp_f20);
if (npcAISettings->unk_1C.s < fabsf(temp_f0)) {
temp_f20 = npc->yaw;
if (temp_f0 < 0.0f) {
temp_f20 += -npcAISettings->unk_1C.s;
} else {
temp_f20 += npcAISettings->unk_1C.s;
}
}
npc->yaw = clamp_angle(temp_f20);
subroutine_arg8 = npc->pos.x;
subroutine_arg9 = npc->pos.y;
subroutine_argA = npc->pos.z;
temp_f20 = clamp_angle(atan2(npc->pos.x, npc->pos.z, gPlayerStatusPtr->position.x,
gPlayerStatusPtr->position.z) + 180.0f);
phi_f22 = 0.0f;
phi_f24 = 0.0f;
phi_f26 = 0.0f;
if (npc_test_move_simple_without_slipping(npc->collisionChannel, &subroutine_arg8, &subroutine_arg9, &subroutine_argA, npc->moveSpeed * 4.5, temp_f20,
npc->collisionHeight, npc->collisionRadius)) {
phi_f22 = dist2D(npc->pos.x, npc->pos.z, subroutine_arg8, subroutine_argA);
subroutine_argB = npc->pos.x;
subroutine_argC = npc->pos.y;
subroutine_argD = npc->pos.z;
if (npc_test_move_simple_without_slipping(npc->collisionChannel, &subroutine_argB, &subroutine_argC, &subroutine_argD, npc->moveSpeed * 4.5,
clamp_angle(temp_f20 + 35.0f), npc->collisionHeight, npc->collisionRadius)) {
phi_f24 = dist2D(npc->pos.x, npc->pos.z, subroutine_argB, subroutine_argD);
}
subroutine_argE = npc->pos.x;
subroutine_argF = npc->pos.y;
subroutine_arg10 = npc->pos.z;
if (npc_test_move_simple_without_slipping(npc->collisionChannel, &subroutine_argE, &subroutine_argF, &subroutine_arg10, npc->moveSpeed * 4.5,
clamp_angle(temp_f20 - 35.0f), npc->collisionHeight, npc->collisionRadius)) {
phi_f26 = dist2D(npc->pos.x, npc->pos.z, subroutine_argE, subroutine_arg10);
}
dist2D(npc->pos.x, npc->pos.z, gPlayerStatusPtr->position.x, gPlayerStatusPtr->position.z);
if ((phi_f22 < npc->moveSpeed * 1.5) && (phi_f24 < npc->moveSpeed * 1.5) && (phi_f26 < npc->moveSpeed * 1.5) &&
(func_800490B4(territory, enemy, npcAISettings->alertRadius, npcAISettings->unk_10.f, 0))) {
phi_s3 = TRUE;
}
if (!phi_s3) {
if ((phi_f24 < phi_f22) && (phi_f26 < phi_f24)) {
temp_f20 = atan2(npc->pos.x, npc->pos.z, subroutine_arg8, subroutine_argA);
} else if ((phi_f24 < phi_f22) && (phi_f24 < phi_f26)) {
temp_f20 = atan2(npc->pos.x, npc->pos.z, subroutine_arg8, subroutine_argA);
} else if ((phi_f22 < phi_f24) && (phi_f26 < phi_f22)) {
temp_f20 = atan2(npc->pos.x, npc->pos.z, subroutine_argB, subroutine_argD);
} else if ((phi_f26 < phi_f24) && (phi_f22 < phi_f26)) {
temp_f20 = atan2(npc->pos.x, npc->pos.z, subroutine_argB, subroutine_argD);
} else if ((phi_f22 < phi_f26) && (phi_f24 < phi_f22)) {
temp_f20 = atan2(npc->pos.x, npc->pos.z, subroutine_argE, subroutine_arg10);
} else if ((phi_f24 < phi_f26) && (phi_f22 < phi_f24)) {
temp_f20 = atan2(npc->pos.x, npc->pos.z, subroutine_argE, subroutine_arg10);
}
temp_f0 = get_clamped_angle_diff(npc->yaw, temp_f20);
if (npcAISettings->unk_1C.s < fabsf(temp_f0)) {
temp_f20 = npc->yaw;
if (temp_f0 < 0.0f) {
temp_f20 += -npcAISettings->unk_1C.s;
} else {
temp_f20 += npcAISettings->unk_1C.s;
}
}
npc->yaw = clamp_angle(temp_f20);
}
}
if (phi_s3) {
npc->duration = 0xA;
npc->currentAnim.w = enemy->animList[8];
}
script->functionTemp[0] = 0xD;
}
INCLUDE_ASM(s32, "ECAA80", func_80241364_ECB064);
void func_802414C8_ECB1C8(Evt* script, NpcAISettings* aiSettings, EnemyTerritoryThing* territory) {
Npc* npc = get_npc_unsafe(script->owner1.enemy->npcID);
npc->duration--;
if (npc->duration == 0) {
script->functionTemp[0] = 0;
}
}
ApiStatus func_8024150C_ECB20C(Evt* script, s32 isInitialCall) {
DeadEnemy* enemy = (DeadEnemy*) script->owner1.enemy;
Npc *npc = get_npc_unsafe(enemy->npcID);
Bytecode* args = script->ptrReadPos;
EnemyTerritoryThing territory;
EnemyTerritoryThing* territoryPtr = &territory;
NpcAISettings* npcAISettings = (NpcAISettings*)evt_get_variable(script, *args++);
territory.unk_00 = 0;
territory.shape = enemy->territory->wander.detectShape;
territory.pointX = enemy->territory->wander.detect.x;
territory.pointZ = enemy->territory->wander.detect.z;
territory.sizeX = enemy->territory->wander.detectSizeX;
territory.sizeZ = enemy->territory->wander.detectSizeZ;
territory.unk_18 = 100.0f;
territory.unk_1C = 0;
enemy->unk_108.x = npc->pos.x;
enemy->unk_108.y = npc->pos.y;
enemy->unk_108.z = npc->pos.z;
enemy->unk_114 = 0.01f;
enemy->unk_118 = 0.01f;
if (isInitialCall || (enemy->unk_B0 & ENEMY_AI_FLAGS_4)) {
script->functionTemp[0] = 0;
npc->duration = 0;
npc->currentAnim.w = enemy->animList[0];
npc->flags &= ~NPC_FLAG_NO_Y_MOVEMENT;
if (!enemy->territory->wander.isFlying) {
npc->flags = (npc->flags | NPC_FLAG_GRAVITY) & ~NPC_FLAG_ENABLE_HIT_SCRIPT;
} else {
npc->flags = (npc->flags & ~NPC_FLAG_GRAVITY) | NPC_FLAG_ENABLE_HIT_SCRIPT;
}
if (enemy->unk_B0 & ENEMY_AI_FLAGS_4) {
script->functionTemp[0] = 99;
script->functionTemp[1] = 0;
enemy->unk_B0 &= ~ENEMY_AI_FLAGS_4;
}
}
switch (script->functionTemp[0]) {
case 0:
func_800495A0(script, npcAISettings, territoryPtr);
case 1:
func_800496B8(script, npcAISettings, territoryPtr);
break;
case 2:
base_UnkNpcAIFunc1(script, npcAISettings, territoryPtr);
case 3:
func_80049C04(script, npcAISettings, territoryPtr);
break;
case 10:
func_80049E3C(script, npcAISettings, territoryPtr);
case 11:
func_80049ECC(script, npcAISettings, territoryPtr);
break;
case 12:
func_80240D80_ECAA80(script, npcAISettings, territoryPtr);
case 13:
func_80241364_ECB064(script, npcAISettings, territoryPtr);
break;
case 14:
func_802414C8_ECB1C8(script, npcAISettings, territoryPtr);
break;
case 99:
func_8004A73C(script);
}
return ApiStatus_BLOCK;
}
#include "world/common/enemy/UnkFloAI.inc.c"
// following four functions can be folded into this combined include when the last two are done
// #include "world/common/atomic/ItemChoice_PartA.inc.c"

View File

@ -5,4 +5,4 @@
#define NAMESPACE ED0310
#include "world/common/atomic/enemy/Dead_UnkAI_9.inc.c"
#include "world/common/enemy/FlyingAI.inc.c"

View File

@ -7,158 +7,17 @@
#include "world/common/UnkFunc41.inc.c"
#include "world/common/atomic/enemy/Dead_UnkAI_9.inc.c"
// must include this before LakituAI for the debug string to end up in the right position
#include "world/common/enemy/FlyingAI.inc.c"
const char D_80247B44_EE6504[] = "JUGEMU MOVE";
s32 func_802416E8_EE00A8(void) {
s32 i;
#define AI_LAKITU_FIRST_SPINY_ID 50
#define AI_LAKITU_LAST_SPINY_ID 55
#include "world/common/enemy/LakituAI.inc.c"
#include "world/common/enemy/SpinyAI.inc.c"
for (i = 50; i < 56; i++) {
if (get_enemy(i)->varTable[10] == 0) {
return i;
}
}
return -1;
}
void func_80241730_EE00F0(Evt* script, NpcAISettings* aiSettings, EnemyTerritoryThing* territory) {
Enemy* enemy = script->owner1.enemy;
Npc* npc = get_npc_unsafe(enemy->npcID);
f32 x, y, z, w;
s32 var;
f32 temp_f20;
f32 temp_f22;
f32 temp_f24;
f32 var1 = enemy->varTable[4];
f32 var2 = enemy->varTable[3];
f32 var3;
temp_f22 = var1 / 100.0;
temp_f24 = var2 / 100.0;
if (npc->duration > 0) {
npc->duration--;
}
var3 = enemy->varTable[1];
temp_f20 = var3 / 100.0;
x = npc->pos.x;
y = npc->pos.y;
z = npc->pos.z;
w = 1000.0f;
npc_raycast_down_sides(npc->collisionChannel, &x, &y, &z, &w);
npc->pos.y = y + temp_f24 + (sin_deg(enemy->varTable[2]) * temp_f20);
enemy->varTable[2] = clamp_angle(enemy->varTable[2] + 0xC);
if (aiSettings->unk_14 >= 0) {
if (script->functionTemp[1] <= 0) {
script->functionTemp[1] = aiSettings->unk_14;
if (func_800490B4(territory, enemy, aiSettings->alertRadius, aiSettings->unk_10.f, 0) != 0) {
fx_emote(EMOTE_EXCLAMATION, npc, 0.0f, npc->collisionHeight, 1.0f, 2.0f, -20.0f, 0xF, &var);
ai_enemy_play_sound(npc, 0x2F4, 0x200000);
x = npc->pos.x;
y = npc->pos.y;
z = npc->pos.z;
w = 1000.0f;
npc_raycast_down_sides(npc->collisionChannel, &x, &y, &z, &w);
npc->moveToPos.y = y + temp_f24;
script->functionTemp[0] = 12;
return;
}
}
script->functionTemp[1]--;
}
if (is_point_within_region(enemy->territory->wander.wanderShape, enemy->territory->wander.point.x,
enemy->territory->wander.point.z, npc->pos.x, npc->pos.z, enemy->territory->wander.wanderSizeX,
enemy->territory->wander.wanderSizeZ) != 0) {
npc->yaw = atan2(npc->pos.x, npc->pos.z, enemy->territory->wander.point.x, enemy->territory->wander.point.z);
}
if (npc->turnAroundYawAdjustment == 0) {
if (npc->duration > 0) {
npc_move_heading(npc, npc->moveSpeed, npc->yaw);
if (enemy->varTable[0] & 1) {
x = npc->pos.x;
y = temp_f22;
z = npc->pos.z;
w = 1000.0f;
npc_raycast_down_sides(npc->collisionChannel, &x, &y, &z, &w);
y += temp_f24;
w = y - temp_f22;
if (w > 2.0) {
temp_f22 += 2.0;
} else if (w < -2.0) {
temp_f22 -= 2.0;
} else {
temp_f22 = y;
}
enemy->varTable[4] = (temp_f22 * 100.0);
}
if (npc->duration > 0) {
return;
}
}
script->functionTemp[0] = 2;
script->functionTemp[1] = (rand_int(1000) % 3) + 2;
if ((aiSettings->unk_2C <= 0) || (aiSettings->moveTime <= 0) || (script->functionTemp[1] == 0)) {
script->functionTemp[0] = 0;
}
}
}
void func_80241B94_EE0554(Evt* script, NpcAISettings* aiSettings, EnemyTerritoryThing* territory) {
Enemy* enemy = script->owner1.enemy;
Npc* npc = get_npc_unsafe(enemy->npcID);
f32 x, y, z, w;
s32 var;
f32 var1 = enemy->varTable[3];
f32 var2;
f32 temp_f20;
f32 temp_f22;
temp_f22 = var1 / 100.0;
if (npc->duration > 0) {
npc->duration--;
}
var2 = enemy->varTable[1];
temp_f20 = var2 / 100.0;
x = npc->pos.x;
y = npc->pos.y;
z = npc->pos.z;
w = 1000.0f;
npc_raycast_down_sides(npc->collisionChannel, &x, &y, &z, &w);
npc->pos.y = y + temp_f22 + (sin_deg(enemy->varTable[2]) * temp_f20);
enemy->varTable[2] = clamp_angle(enemy->varTable[2] + 0xC);
if (func_800490B4(territory, enemy, aiSettings->chaseRadius, aiSettings->unk_28.f, 1) != 0) {
fx_emote(EMOTE_EXCLAMATION, npc, 0.0f, npc->collisionHeight, 1.0f, 2.0f, -20.0f, 0xF, &var);
ai_enemy_play_sound(npc, 0x2F4, 0x200000);
script->functionTemp[0] = 12;
return;
}
if ((npc->turnAroundYawAdjustment == 0) && (npc->duration <= 0)) {
script->functionTemp[1]--;
if (script->functionTemp[1] > 0) {
npc->yaw = clamp_angle(npc->yaw + 180.0f);
npc->duration = (rand_int(1000) % 11) + 5;
return;
}
script->functionTemp[0] = 0;
}
}
INCLUDE_ASM(s32, "EDEA00", func_80241DE4_EE07A4);
#include "world/common/atomic/enemy/UnkAI_StateHandlers_A.inc.c"
INCLUDE_ASM(s32, "EDEA00", func_80242684_EE1044);
INCLUDE_ASM(s32, "EDEA00", func_80242AF0_EE14B0);
const char D_80247BB8_EE6578[] = "TOGEZO TYPE1 : NORMAL MOVE";
#include "world/common/UnkFunc42.inc.c"

View File

@ -8,7 +8,7 @@
extern const s32 D_802453E0_EEB990[];
#include "world/common/atomic/enemy/Dead_UnkAI_9.inc.c"
#include "world/common/enemy/FlyingAI.inc.c"
#include "world/common/GetNpcCollisionHeight.inc.c"

View File

@ -5,8 +5,6 @@
#define NAMESPACE EED1E0
#define gPartnerActionStatus dead_gPartnerActionStatus2
#include "world/common/atomic/SuperBlock.inc.c"
#include "world/common/UnkFunc44.inc.c"

View File

@ -5,12 +5,7 @@
#define NAMESPACE EEDF50
#include "world/common/atomic/enemy/Dead_UnkAI_9.inc.c"
#include "world/common/enemy/FlyingAI.inc.c"
#include "world/common/UnkNpcAIFunc13.inc.c"
#include "world/common/enemy/FlyingNoAttackAI.inc.c"
#include "world/common/UnkNpcAIFunc34.inc.c"
#include "world/common/UnkFunc45.inc.c"
INCLUDE_ASM(s32, "EEDF50", func_80242780_EEF880);

View File

@ -5,7 +5,7 @@
#define NAMESPACE EF2680
#include "world/common/atomic/enemy/Dead_UnkAI_9.inc.c"
#include "world/common/enemy/FlyingAI.inc.c"
s32 func_80241594_EF3BA4(void) {
s32 i;
@ -19,7 +19,7 @@ s32 func_80241594_EF3BA4(void) {
return -1;
}
void func_802415DC_EF3BEC(Evt* script, NpcAISettings* aiSettings, EnemyTerritoryThing* territory) {
void func_802415DC_EF3BEC(Evt* script, NpcAISettings* aiSettings, EnemyDetectVolume* territory) {
Enemy* enemy = script->owner1.enemy;
Npc* npc = get_npc_unsafe(enemy->npcID);
f32 x, y, z, w;
@ -48,10 +48,10 @@ void func_802415DC_EF3BEC(Evt* script, NpcAISettings* aiSettings, EnemyTerritory
npc->pos.y = y + temp_f24 + (sin_deg(enemy->varTable[2]) * temp_f20);
enemy->varTable[2] = clamp_angle(enemy->varTable[2] + 0xC);
if (aiSettings->unk_14 >= 0) {
if (aiSettings->playerSearchInterval >= 0) {
if (script->functionTemp[1] <= 0) {
script->functionTemp[1] = aiSettings->unk_14;
if (func_800490B4(territory, enemy, aiSettings->alertRadius, aiSettings->unk_10.f, 0) != 0) {
script->functionTemp[1] = aiSettings->playerSearchInterval;
if (basic_ai_check_player_dist(territory, enemy, aiSettings->alertRadius, aiSettings->alertOffsetDist, 0)) {
fx_emote(EMOTE_EXCLAMATION, npc, 0.0f, npc->collisionHeight, 1.0f, 2.0f, -20.0f, 0xF, &var);
ai_enemy_play_sound(npc, 0x2F4, 0x200000);
x = npc->pos.x;
@ -99,13 +99,13 @@ void func_802415DC_EF3BEC(Evt* script, NpcAISettings* aiSettings, EnemyTerritory
}
script->functionTemp[0] = 2;
script->functionTemp[1] = (rand_int(1000) % 3) + 2;
if ((aiSettings->unk_2C <= 0) || (aiSettings->moveTime <= 0) || (script->functionTemp[1] == 0)) {
if ((aiSettings->unk_AI_2C <= 0) || (aiSettings->moveTime <= 0) || (script->functionTemp[1] == 0)) {
script->functionTemp[0] = 0;
}
}
}
void func_80241A40_EF4050(Evt* script, NpcAISettings* aiSettings, EnemyTerritoryThing* territory) {
void func_80241A40_EF4050(Evt* script, NpcAISettings* aiSettings, EnemyDetectVolume* territory) {
Enemy* enemy = script->owner1.enemy;
Npc* npc = get_npc_unsafe(enemy->npcID);
f32 x, y, z, w;
@ -130,7 +130,7 @@ void func_80241A40_EF4050(Evt* script, NpcAISettings* aiSettings, EnemyTerritory
npc_raycast_down_sides(npc->collisionChannel, &x, &y, &z, &w);
npc->pos.y = y + temp_f22 + (sin_deg(enemy->varTable[2]) * temp_f20);
enemy->varTable[2] = clamp_angle(enemy->varTable[2] + 0xC);
if (func_800490B4(territory, enemy, aiSettings->chaseRadius, aiSettings->unk_28.f, 1) != 0) {
if (basic_ai_check_player_dist(territory, enemy, aiSettings->chaseRadius, aiSettings->chaseOffsetDist, 1)) {
fx_emote(EMOTE_EXCLAMATION, npc, 0.0f, npc->collisionHeight, 1.0f, 2.0f, -20.0f, 0xF, &var);
ai_enemy_play_sound(npc, 0x2F4, 0x200000);
script->functionTemp[0] = 12;
@ -150,8 +150,4 @@ void func_80241A40_EF4050(Evt* script, NpcAISettings* aiSettings, EnemyTerritory
INCLUDE_ASM(s32, "EF2680", func_80241C90_EF42A0);
#include "world/common/atomic/enemy/UnkAI_StateHandlers_A.inc.c"
#include "world/common/DeadUnkNpcAIMainFunc5.inc.c"
#include "world/common/DeadUnkNpcAIMainFunc6.inc.c"
#include "world/common/enemy/SpinyAI.inc.c"

View File

@ -469,33 +469,33 @@ void load_demo_battle(u32 index) {
switch (mode) {
case 0:
gCurrentEncounter.eFirstStrike = 0;
gCurrentEncounter.hitType = 1;
gCurrentEncounter.eFirstStrike = FIRST_STRIKE_NONE;
gCurrentEncounter.hitType = ENCOUNTER_TRIGGER_NONE;
gCurrentEncounter.hitTier = 0;
gGameStatusPtr->demoFlags |= 0x10;
gGameStatusPtr->demoFlags |= 0x20;
gGameStatusPtr->demoFlags |= 0x40;
break;
case 1:
gCurrentEncounter.eFirstStrike = 1;
gCurrentEncounter.hitType = 4;
gCurrentEncounter.eFirstStrike = FIRST_STRIKE_PLAYER;
gCurrentEncounter.hitType = ENCOUNTER_TRIGGER_HAMMER;
gCurrentEncounter.hitTier = playerData->hammerLevel;
gGameStatusPtr->demoFlags |= 0x10;
break;
case 2:
gCurrentEncounter.eFirstStrike = 1;
gCurrentEncounter.hitType = 2;
gCurrentEncounter.eFirstStrike = FIRST_STRIKE_PLAYER;
gCurrentEncounter.hitType = ENCOUNTER_TRIGGER_JUMP;
gCurrentEncounter.hitTier = playerData->bootsLevel;
gGameStatusPtr->demoFlags |= 0x10;
break;
case 3:
gCurrentEncounter.eFirstStrike = 1;
gCurrentEncounter.hitType = 6;
gCurrentEncounter.eFirstStrike = FIRST_STRIKE_PLAYER;
gCurrentEncounter.hitType = ENCOUNTER_TRIGGER_PARTNER;
gGameStatusPtr->demoFlags |= 0x20;
break;
case 4:
gCurrentEncounter.eFirstStrike = 2;
gCurrentEncounter.hitType = 1;
gCurrentEncounter.eFirstStrike = FIRST_STRIKE_ENEMY;
gCurrentEncounter.hitType = ENCOUNTER_TRIGGER_NONE;
gCurrentEncounter.hitTier = 0;
gGameStatusPtr->demoFlags |= 0x40;
break;

View File

@ -18,7 +18,11 @@ MusicSettings D_8014F6F0 = {
};
s32 gSongsUsingVariationFlag[] = {
SONG_SPECIAL_BATTLE, SONG_TUBBA_BLUBBA_BATTLE, SONG_JR_TROOPA_BATTLE, SONG_YOSHI_KIDS_FOUND, SONG_ITEM_UPGRADE,
SONG_SPECIAL_BATTLE,
SONG_TUBBA_BLUBBA_BATTLE,
SONG_JR_TROOPA_BATTLE,
SONG_YOSHI_KIDS_FOUND,
SONG_ITEM_UPGRADE,
SONG_NEW_PARTNER,
};

View File

@ -797,7 +797,7 @@ ApiStatus func_80045838(Evt* script, s32 isInitialCall) {
}
ApiStatus func_800458CC(Evt* script, s32 isInitialCall) {
evt_set_variable(script, *script->ptrReadPos, script->owner1.enemy->npcSettings->unk_2A & 8);
evt_set_variable(script, *script->ptrReadPos, script->owner1.enemy->npcSettings->unk_2A & AI_ACTION_08);
return ApiStatus_DONE2;
}
@ -806,16 +806,16 @@ ApiStatus func_80045900(Evt* script, s32 isInitialCall) {
Npc* npc = get_npc_unsafe(enemy->npcID);
s32 var0 = evt_get_variable(script, *script->ptrReadPos);
enemy->unk_B0 |= ENEMY_AI_FLAGS_4;
enemy->aiFlags |= ENEMY_AI_FLAGS_4;
if (var0 == 0) {
s32 unk;
if (!(enemy->unk_B0 & ENEMY_AI_FLAGS_10)) {
if (!(enemy->aiFlags & ENEMY_AI_FLAGS_10)) {
npc->currentAnim.w = *enemy->animList;
}
if (!(enemy->unk_B0 & ENEMY_AI_FLAGS_8)) {
if (!(enemy->aiFlags & ENEMY_AI_FLAGS_8)) {
fx_emote(EMOTE_QUESTION, npc, 0.0f, npc->collisionHeight, 1.0f, 0.0f, -20.0f, 40, &unk);
}

View File

@ -107,7 +107,7 @@ s32 _create_npc(NpcBlueprint* blueprint, s32** animList, s32 skipLoadingAnims) {
npc->homePos.y = 0.0f;
npc->homePos.z = 0.0f;
npc->unk_96 = 0; // TODO: fix
npc->unk_AB = 0;
npc->verticalRenderOffset = 0;
npc->alpha = 255;
npc->alpha2 = 255;
npc->jumpScale = 1.0f;
@ -425,7 +425,7 @@ INCLUDE_ASM(s32, "npc", npc_do_player_collision, Npc* npc);
void npc_do_gravity(Npc* npc) {
if (npc->flags & NPC_FLAG_GRAVITY) {
if (npc->flags & NPC_FLAG_NO_Y_MOVEMENT) {
if (npc->flags & NPC_FLAG_JUMPING) {
npc->flags &= ~NPC_FLAG_1000;
} else {
f32 xTemp;
@ -472,7 +472,7 @@ s32 func_800397E8(Npc* npc, f32 arg1) {
f32 oldLength;
s32 phi_v0;
if (npc->flags & NPC_FLAG_NO_Y_MOVEMENT) {
if (npc->flags & NPC_FLAG_JUMPING) {
npc->flags &= ~NPC_FLAG_1000;
return 0;
}
@ -547,7 +547,7 @@ void update_npcs(void) {
npc->jumpVelocity = 0.0f;
npc->moveSpeed = 0.0f;
npc->jumpScale = 0.0f;
npc->flags &= ~NPC_FLAG_NO_Y_MOVEMENT;
npc->flags &= ~NPC_FLAG_JUMPING;
}
if (!(npc->flags & NPC_FLAG_NO_ANIMS_LOADED)) {
@ -698,7 +698,7 @@ void appendGfx_npc(Npc* npc) {
Matrix4f mtx1, mtx2;
f32 renderYaw = npc_get_render_yaw(npc);
guTranslateF(mtx1, npc->pos.x, npc->pos.y + npc->unk_AB, npc->pos.z);
guTranslateF(mtx1, npc->pos.x, npc->pos.y + npc->verticalRenderOffset, npc->pos.z);
if (npc->flags & NPC_FLAG_UPSIDE_DOWN) {
mtx_ident_mirror_y(mtx2);
guMtxCatF(mtx2, mtx1, mtx1);
@ -752,7 +752,7 @@ void appendGfx_npc(Npc* npc) {
}
if (npc->flags & NPC_FLAG_REFLECT_WALL) {
guTranslateF(mtx1, npc->pos.x, npc->pos.y + npc->unk_AB, -npc->pos.z);
guTranslateF(mtx1, npc->pos.x, npc->pos.y + npc->verticalRenderOffset, -npc->pos.z);
if (npc->flags & NPC_FLAG_UPSIDE_DOWN) {
mtx_ident_mirror_y(mtx2);
guMtxCatF(mtx2, mtx1, mtx1);
@ -785,7 +785,7 @@ void appendGfx_npc(Npc* npc) {
}
if (npc->flags & NPC_FLAG_REFLECT_FLOOR) {
guTranslateF(mtx1, npc->pos.x, -(npc->pos.y + npc->unk_AB), npc->pos.z);
guTranslateF(mtx1, npc->pos.x, -(npc->pos.y + npc->verticalRenderOffset), npc->pos.z);
mtx_ident_mirror_y(mtx2);
guMtxCatF(mtx2, mtx1, mtx1);

View File

@ -7,7 +7,7 @@
#define NAMESPACE arn_02
ApiStatus N(func_80240C90_BDDE40)(Evt *script, s32 isInitialCall);
ApiStatus N(CleftAI_Main)(Evt *script, s32 isInitialCall);
extern EvtScript N(main);
extern EvtScript N(80241040);

View File

@ -52,16 +52,16 @@ NpcAISettings N(npcAISettings_802413D0) = {
.moveTime = 40,
.waitTime = 15,
.alertRadius = 150.0f,
.unk_14 = 2,
.playerSearchInterval = 2,
.chaseSpeed = 3.3f,
.unk_1C = { .s = 70 },
.unk_20 = 1,
.chaseTurnRate= 70,
.chaseUpdateInterval = 1,
.chaseRadius = 180.0f,
.unk_2C = 1,
.unk_AI_2C = 1,
};
EvtScript N(npcAI_80241400) = {
EVT_CALL(DoBasicAI, EVT_PTR(N(npcAISettings_802413D0)))
EVT_CALL(BasicAI_Main, EVT_PTR(N(npcAISettings_802413D0)))
EVT_RETURN
EVT_END
};
@ -80,17 +80,17 @@ NpcAISettings N(npcAISettings_8024144C) = {
.moveTime = 30,
.waitTime = 30,
.alertRadius = 120.0f,
.unk_14 = 3,
.playerSearchInterval = 3,
.chaseSpeed = 8.5f,
.unk_1C = { .s = 60 },
.unk_20 = 3,
.chaseTurnRate= 60,
.chaseUpdateInterval = 3,
.chaseRadius = 100.0f,
.unk_28 = { .f = 60.0f },
.unk_2C = 1,
.chaseOffsetDist = 60.0f,
.unk_AI_2C = 1,
};
EvtScript N(npcAI_8024147C) = {
EVT_CALL(N(func_80240C90_BDDE40), EVT_PTR(N(npcAISettings_8024144C)), 8)
EVT_CALL(N(CleftAI_Main), EVT_PTR(N(npcAISettings_8024144C)), 8)
EVT_RETURN
EVT_END
};
@ -211,225 +211,4 @@ NpcGroupList N(npcGroupList_80241A9C) = {
{},
};
s32 N(func_80240000_BDD1B0)(Evt* script, NpcAISettings* aiSettings, EnemyTerritoryThing* territory) {
Enemy* enemy = script->owner1.enemy;
Npc* npc = get_npc_unsafe(enemy->npcID);
Camera* camera = &gCameras[gCurrentCamID];
f32 phi_f20;
s32 ret = FALSE;
if (func_800493EC(enemy, 0, aiSettings->alertRadius, aiSettings->unk_10.f)) {
ret = TRUE;
}
if (clamp_angle(get_clamped_angle_diff(camera->currentYaw, npc->yaw)) < 180.0) {
phi_f20 = 90.0f;
} else {
phi_f20 = 270.0f;
}
if (fabsf(get_clamped_angle_diff(phi_f20,
atan2(npc->pos.x, npc->pos.z,
gPlayerStatusPtr->position.x, gPlayerStatusPtr->position.z))) > 75.0) {
ret = FALSE;
}
if (fabsf(npc->pos.y - gPlayerStatusPtr->position.y) >= 40.0f) {
ret = FALSE;
}
if (gPartnerActionStatus.actingPartner == PARTNER_BOW) {
ret = FALSE;
}
return ret;
}
#include "world/common/UnkNpcAIFunc18.inc.c"
void N(func_802401D4_BDD384)(Evt* script, NpcAISettings* aiSettings, EnemyTerritoryThing* territory) {
Enemy* enemy = script->owner1.enemy;
Npc* npc = get_npc_unsafe(enemy->npcID);
s32 var;
if (script->functionTemp[1] <= 0) {
script->functionTemp[1] = aiSettings->unk_14;
if (func_800490B4(territory, enemy, aiSettings->alertRadius * 0.85, aiSettings->unk_10.f, 0)) {
npc->currentAnim.w = enemy->animList[9];
fx_emote(EMOTE_EXCLAMATION, npc, 0.0f, npc->collisionHeight, 1.0f, 2.0f, -20.0f, 15, &var);
ai_enemy_play_sound(npc, 0x2F4, 0x200000);
npc->duration = 12;
script->functionTemp[0] = 2;
}
}
script->functionTemp[1]--;
}
#include "world/common/UnkNpcAIFunc21.inc.c"
#include "world/common/UnkNpcAIFunc20.inc.c"
#include "world/common/UnkNpcAIFunc22.inc.c"
#include "world/common/UnkFunc8.inc.c"
#include "world/common/UnkNpcAIFunc16.inc.c"
void N(func_80240694_BDD844)(Evt* script, NpcAISettings* aiSettings, EnemyTerritoryThing* territory) {
Enemy* enemy = script->owner1.enemy;
Npc* npc = get_npc_unsafe(enemy->npcID);
npc->yaw = atan2(npc->pos.x, npc->pos.z, gPlayerStatusPtr->position.x, gPlayerStatusPtr->position.z);
if (npc->duration % 3 == 0) {
fx_walking_dust(2, npc->pos.x, npc->pos.y, npc->pos.z + 2.0f, 0, 0);
}
npc->duration--;
if (npc->duration <= 0) {
enemy->unk_10.x = npc->pos.x;
enemy->unk_10.y = npc->pos.y;
enemy->unk_10.z = npc->pos.z;
enemy->unk_07 = 1;
npc->moveSpeed = aiSettings->chaseSpeed;
npc->duration = dist2D(npc->pos.x, npc->pos.z, gPlayerStatusPtr->position.x,
gPlayerStatusPtr->position.z) / npc->moveSpeed + 0.9;
if (npc->duration < 15) {
npc->duration = 15;
}
script->functionTemp[0] = 0x16;
}
}
#include "world/common/UnkFunc10.inc.c"
void N(func_80240984_BDDB34)(Evt* script, NpcAISettings* aiSettings, EnemyTerritoryThing* territory) {
Enemy* enemy = script->owner1.enemy;
Npc* npc = get_npc_unsafe(enemy->npcID);
npc->duration--;
if (npc->duration <= 0) {
npc->currentAnim.w = enemy->animList[1];
if (enemy->territory->wander.moveSpeedOverride < 0) {
npc->moveSpeed = aiSettings->moveSpeed;
} else {
npc->moveSpeed = enemy->territory->wander.moveSpeedOverride / 32767.0;
}
script->functionTemp[0] = 0x29;
}
}
#include "world/common/UnkFunc9.inc.c"
#include "world/common/UnkNpcAIFunc19.inc.c"
#include "world/common/UnkNpcAIFunc17.inc.c"
#include "world/common/UnkDurationCheck.inc.c"
s32 N(func_80240C90_BDDE40)(Evt* script, s32 isInitialCall) {
Enemy* enemy = script->owner1.enemy;
Npc* npc = get_npc_unsafe(enemy->npcID);
Bytecode* args = script->ptrReadPos;
NpcAISettings* npcAISettings = (NpcAISettings*)evt_get_variable(script, *args++);
EnemyTerritoryThing territory;
EnemyTerritoryThing* territoryPtr = &territory;
enemy->varTable[10] = evt_get_variable(script, *args++);
territory.unk_00 = 0;
territory.shape = enemy->territory->wander.detectShape;
territory.pointX = enemy->territory->wander.detect.x;
territory.pointZ = enemy->territory->wander.detect.z;
territory.sizeX = enemy->territory->wander.detectSizeX;
territory.sizeZ = enemy->territory->wander.detectSizeZ;
territory.unk_18 = 40.0f;
territory.unk_1C = 0;
if (isInitialCall) {
script->functionTemp[0] = 0;
npc->duration = 0;
npc->flags &= ~0x800;
if (!enemy->territory->wander.isFlying) {
npc->flags = (npc->flags | 0x200) & ~0x8;
} else {
npc->flags = (npc->flags & ~0x200) | 0x8;
}
}
if (enemy->unk_B0 & ENEMY_AI_FLAGS_4) {
if (enemy->unk_B4 != 0) {
return ApiStatus_BLOCK;
}
enemy->unk_B0 &= ~ENEMY_AI_FLAGS_4;
}
if ((u32)script->functionTemp[0] - 12 < 3 && N(func_80240000_BDD1B0)(script, npcAISettings, territoryPtr)) {
script->functionTemp[0] = 20;
}
switch (script->functionTemp[0]) {
case 0:
N(UnkNpcAIFunc18)(script, npcAISettings, territoryPtr);
case 1:
N(func_802401D4_BDD384)(script, npcAISettings, territoryPtr);
if (script->functionTemp[0] != 2) {
return ApiStatus_BLOCK;
}
case 2:
N(UnkNpcAIFunc21)(script, npcAISettings, territoryPtr);
if (script->functionTemp[0] != 3) {
return ApiStatus_BLOCK;
}
case 3:
N(UnkNpcAIFunc20)(script, npcAISettings, territoryPtr);
if (script->functionTemp[0] != 4) {
return ApiStatus_BLOCK;
}
case 4:
N(UnkNpcAIFunc22)(script, npcAISettings, territoryPtr);
case 5:
N(UnkFunc8)(script, npcAISettings, territoryPtr);
return ApiStatus_BLOCK;
case 12:
func_80049F7C(script, npcAISettings, territoryPtr);
if (script->functionTemp[0] != 13) {
return ApiStatus_BLOCK;
}
case 13:
func_8004A124(script, npcAISettings, territoryPtr);
if (script->functionTemp[0] != 14) {
return ApiStatus_BLOCK;
}
case 14:
npc->duration--;
if (npc->duration == 0) {
script->functionTemp[0] = 40;
}
return ApiStatus_BLOCK;
case 20:
N(UnkNpcAIFunc16)(script, npcAISettings, territoryPtr);
case 21:
N(func_80240694_BDD844)(script, npcAISettings, territoryPtr);
return ApiStatus_BLOCK;
case 22:
N(UnkFunc10)(script, npcAISettings, territoryPtr);
return ApiStatus_BLOCK;
case 40:
N(func_80240984_BDDB34)(script, npcAISettings, territoryPtr);
if (script->functionTemp[0] != 41) {
return ApiStatus_BLOCK;
}
case 41:
N(UnkFunc9)(script, npcAISettings, territoryPtr);
return ApiStatus_BLOCK;
case 50:
N(UnkNpcAIFunc19)(script, npcAISettings, territoryPtr);
case 51:
N(UnkNpcAIFunc17)(script, npcAISettings, territoryPtr);
if (script->functionTemp[0] != 52) {
return ApiStatus_BLOCK;
}
case 52:
N(UnkDurationCheck)(script, npcAISettings, territoryPtr);
return ApiStatus_BLOCK;
}
return ApiStatus_BLOCK;
}
#include "world/common/enemy/CleftAI.inc.c"

View File

@ -73,11 +73,11 @@ NpcAISettings N(npcAISettings_80241BC0) = {
.moveTime = 25,
.waitTime = 30,
.alertRadius = 50.0f,
.unk_10 = { .f = 50.0f },
.unk_14 = 10,
.alertOffsetDist = 50.0f,
.playerSearchInterval = 10,
.chaseRadius = 100.0f,
.unk_28 = { .f = 80.0f },
.unk_2C = 1,
.chaseOffsetDist = 80.0f,
.unk_AI_2C = 1,
};
EvtScript N(npcAI_80241BF0) = {
@ -99,9 +99,9 @@ NpcSettings N(npcSettings_80241C3C) = {
.level = 99,
};
#include "world/common/atomic/enemy/UnkAI_1.inc.c"
#include "world/common/enemy/PatrolNoAttackAI.inc.c"
void N(func_80240E90_BDFC20)(Evt* script, NpcAISettings* aiSettings, EnemyTerritoryThing* territory) {
void N(func_80240E90_BDFC20)(Evt* script, NpcAISettings* aiSettings, EnemyDetectVolume* territory) {
Enemy* enemy = script->owner1.enemy;
Npc* npc = get_npc_unsafe(enemy->npcID);
f32 posX, posY, posZ, posW;
@ -137,7 +137,7 @@ void N(func_80240E90_BDFC20)(Evt* script, NpcAISettings* aiSettings, EnemyTerrit
}
}
void N(func_80241068_BDFDF8)(Evt* script, NpcAISettings* aiSettings, EnemyTerritoryThing* territory) {
void N(func_80241068_BDFDF8)(Evt* script, NpcAISettings* aiSettings, EnemyDetectVolume* territory) {
Enemy* enemy = script->owner1.enemy;
Npc* npc = get_npc_unsafe(enemy->npcID);
@ -149,7 +149,7 @@ void N(func_80241068_BDFDF8)(Evt* script, NpcAISettings* aiSettings, EnemyTerrit
npc->duration = aiSettings->waitTime / 2 + rand_int(aiSettings->waitTime / 2 + 1);
} else {
script->functionTemp[0] = 4;
npc->currentAnim.w = enemy->animList[0];
npc->currentAnim.w = enemy->animList[ENEMY_ANIM_IDLE];
}
}
}
@ -158,18 +158,18 @@ ApiStatus N(func_8024113C_BDFECC)(Evt* script, s32 isInitialCall) {
Enemy* enemy = script->owner1.enemy;
Bytecode* args = script->ptrReadPos;
Npc* npc = get_npc_unsafe(enemy->npcID);
EnemyTerritoryThing territory;
EnemyTerritoryThing* territoryPtr = &territory;
EnemyDetectVolume territory;
EnemyDetectVolume* territoryPtr = &territory;
NpcAISettings* npcAISettings = (NpcAISettings*)evt_get_variable(script, *args++);
territory.unk_00 = 0;
territory.skipPlayerDetectChance = 0;
territory.shape = enemy->territory->patrol.detectShape;
territory.pointX = enemy->territory->patrol.detect.x;
territory.pointZ = enemy->territory->patrol.detect.z;
territory.sizeX = enemy->territory->patrol.detectSizeX;
territory.sizeZ = enemy->territory->patrol.detectSizeZ;
territory.unk_18 = 100.0f;
territory.unk_1C = 0;
territory.halfHeight = 100.0f;
territory.detectFlags = 0;
if (isInitialCall) {
script->functionTemp[0] = 0;
@ -179,17 +179,17 @@ ApiStatus N(func_8024113C_BDFECC)(Evt* script, s32 isInitialCall) {
switch (script->functionTemp[0]) {
case 0:
N(UnkNpcAIFunc24)(script, npcAISettings, territoryPtr);
N(PatrolAI_MoveInit)(script, npcAISettings, territoryPtr);
case 1:
N(func_80240E90_BDFC20)(script, npcAISettings, territoryPtr);
break;
case 2:
N(UnkNpcAIFunc1)(script, npcAISettings, territoryPtr);
N(PatrolAI_LoiterInit)(script, npcAISettings, territoryPtr);
case 3:
N(func_80241068_BDFDF8)(script, npcAISettings, territoryPtr);
break;
case 4:
N(UnkNpcAIFunc25)(script, npcAISettings, territoryPtr);
N(PatrolAI_PostLoiter)(script, npcAISettings, territoryPtr);
break;
}

View File

@ -7,9 +7,9 @@
#define NAMESPACE arn_04
ApiStatus N(UnkNpcAIMainFunc)(Evt* script, s32 isInitialCall);
ApiStatus N(UnkNpcAIMainFunc9)(Evt* script, s32 isInitialCall);
ApiStatus N(func_80243018_BE67C8)(Evt* script, s32 isInitialCall);
ApiStatus N(PatrolNoAttackAI_Main)(Evt* script, s32 isInitialCall);
ApiStatus N(FlyingAI_Main)(Evt* script, s32 isInitialCall);
ApiStatus N(CleftAI_Main)(Evt* script, s32 isInitialCall);
extern EvtScript N(main);
extern EvtScript N(802433D0);

View File

@ -40,16 +40,16 @@ NpcAISettings N(npcAISettings_80243660) = {
.moveTime = 30,
.waitTime = 30,
.alertRadius = 130.0f,
.unk_14 = 1,
.playerSearchInterval = 1,
.chaseSpeed = 2.5f,
.unk_1C = { .s = 180 },
.unk_20 = 3,
.chaseTurnRate= 180,
.chaseUpdateInterval = 3,
.chaseRadius = 150.0f,
.unk_2C = 1,
.unk_AI_2C = 1,
};
EvtScript N(npcAI_80243690) = {
EVT_CALL(N(UnkNpcAIMainFunc), EVT_PTR(N(npcAISettings_80243660)))
EVT_CALL(N(PatrolNoAttackAI_Main), EVT_PTR(N(npcAISettings_80243660)))
EVT_RETURN
EVT_END
};
@ -63,26 +63,26 @@ NpcSettings N(npcSettings_802436B0) = {
.level = 12,
};
#include "world/common/atomic/enemy/UnkAI_1.inc.c"
#include "world/common/enemy/PatrolNoAttackAI.inc.c"
f32 N(sixFloats)[] = {
f32 N(FlyingAI_JumpVels)[] = {
4.5f, 3.5f, 2.6f, 2.0f,
1.5f, 20.0f,
};
#include "world/common/atomic/enemy/UnkAI_9.inc.c"
#include "world/common/enemy/FlyingAI.inc.c"
NpcAISettings N(npcAISettings_802436F4) = {
.moveSpeed = 1.8f,
.moveTime = 60,
.waitTime = 15,
.alertRadius = 120.0f,
.unk_14 = 3,
.playerSearchInterval = 3,
.chaseSpeed = 4.0f,
.unk_1C = { .s = 5 },
.unk_20 = 1,
.chaseTurnRate= 5,
.chaseUpdateInterval = 1,
.chaseRadius = 150.0f,
.unk_2C = 1,
.unk_AI_2C = 1,
};
EvtScript N(npcAI_80243724) = {
@ -90,7 +90,7 @@ EvtScript N(npcAI_80243724) = {
EVT_CALL(SetSelfVar, 5, -850)
EVT_CALL(SetSelfVar, 6, 60)
EVT_CALL(SetSelfVar, 1, 700)
EVT_CALL(N(UnkNpcAIMainFunc9), EVT_PTR(N(npcAISettings_802436F4)))
EVT_CALL(N(FlyingAI_Main), EVT_PTR(N(npcAISettings_802436F4)))
EVT_RETURN
EVT_END
};
@ -110,17 +110,17 @@ NpcAISettings N(npcAISettings_802437C0) = {
.moveTime = 30,
.waitTime = 30,
.alertRadius = 120.0f,
.unk_14 = 3,
.playerSearchInterval = 3,
.chaseSpeed = 8.5f,
.unk_1C = { .s = 60 },
.unk_20 = 3,
.chaseTurnRate= 60,
.chaseUpdateInterval = 3,
.chaseRadius = 100.0f,
.unk_28 = { .f = 60.0f },
.unk_2C = 1,
.chaseOffsetDist = 60.0f,
.unk_AI_2C = 1,
};
EvtScript N(npcAI_802437F0) = {
EVT_CALL(N(func_80243018_BE67C8), EVT_PTR(N(npcAISettings_802437C0)), 8)
EVT_CALL(N(CleftAI_Main), EVT_PTR(N(npcAISettings_802437C0)), 8)
EVT_RETURN
EVT_END
};
@ -292,229 +292,4 @@ EvtScript N(makeEntities) = {
EVT_END
};
s32 N(func_80242388_BE5B38)(Evt* script, NpcAISettings* aiSettings, EnemyTerritoryThing* territory) {
Enemy* enemy = script->owner1.enemy;
Npc* npc = get_npc_unsafe(enemy->npcID);
Camera* camera = &gCameras[gCurrentCamID];
f32 phi_f20;
s32 ret = FALSE;
if (func_800493EC(enemy, 0, aiSettings->alertRadius, aiSettings->unk_10.f)) {
ret = TRUE;
}
if (clamp_angle(get_clamped_angle_diff(camera->currentYaw, npc->yaw)) < 180.0) {
phi_f20 = 90.0f;
} else {
phi_f20 = 270.0f;
}
if (fabsf(get_clamped_angle_diff(phi_f20,
atan2(npc->pos.x, npc->pos.z,
gPlayerStatusPtr->position.x, gPlayerStatusPtr->position.z))) > 75.0) {
ret = FALSE;
}
if (fabsf(npc->pos.y - gPlayerStatusPtr->position.y) >= 40.0f) {
ret = FALSE;
}
if (gPartnerActionStatus.actingPartner == PARTNER_BOW) {
ret = FALSE;
}
return ret;
}
#include "world/common/UnkNpcAIFunc18.inc.c"
void N(func_8024255C_BE5D0C)(Evt* script, NpcAISettings* aiSettings, EnemyTerritoryThing* territory) {
Enemy* enemy = script->owner1.enemy;
Npc* npc = get_npc_unsafe(enemy->npcID);
s32 var;
if (script->functionTemp[1] <= 0) {
script->functionTemp[1] = aiSettings->unk_14;
if (func_800490B4(territory, enemy, aiSettings->alertRadius * 0.85, aiSettings->unk_10.f, 0)) {
npc->currentAnim.w = enemy->animList[9];
fx_emote(EMOTE_EXCLAMATION, npc, 0.0f, npc->collisionHeight, 1.0f, 2.0f, -20.0f, 15, &var);
ai_enemy_play_sound(npc, 0x2F4, 0x200000);
npc->duration = 12;
script->functionTemp[0] = 2;
}
}
script->functionTemp[1]--;
}
#include "world/common/UnkNpcAIFunc21.inc.c"
#include "world/common/UnkNpcAIFunc20.inc.c"
#include "world/common/UnkNpcAIFunc22.inc.c"
#include "world/common/UnkFunc8.inc.c"
#include "world/common/UnkNpcAIFunc16.inc.c"
void N(func_80242A1C_BE61CC)(Evt* script, NpcAISettings* aiSettings, EnemyTerritoryThing* territory) {
Enemy* enemy = script->owner1.enemy;
Npc* npc = get_npc_unsafe(enemy->npcID);
npc->yaw = atan2(npc->pos.x, npc->pos.z, gPlayerStatusPtr->position.x, gPlayerStatusPtr->position.z);
if (npc->duration % 3 == 0) {
fx_walking_dust(2, npc->pos.x, npc->pos.y, npc->pos.z + 2.0f, 0, 0);
}
npc->duration--;
if (npc->duration <= 0) {
enemy->unk_10.x = npc->pos.x;
enemy->unk_10.y = npc->pos.y;
enemy->unk_10.z = npc->pos.z;
enemy->unk_07 = 1;
npc->moveSpeed = aiSettings->chaseSpeed;
npc->duration = dist2D(npc->pos.x, npc->pos.z, gPlayerStatusPtr->position.x,
gPlayerStatusPtr->position.z) / npc->moveSpeed + 0.9;
if (npc->duration < 15) {
npc->duration = 15;
}
script->functionTemp[0] = 0x16;
}
}
#include "world/common/UnkFunc10.inc.c"
void N(func_80242D0C_BE64BC)(Evt* script, NpcAISettings* aiSettings, EnemyTerritoryThing* territory) {
Enemy* enemy = script->owner1.enemy;
Npc* npc = get_npc_unsafe(enemy->npcID);
npc->duration--;
if (npc->duration <= 0) {
npc->currentAnim.w = enemy->animList[1];
if (enemy->territory->wander.moveSpeedOverride < 0) {
npc->moveSpeed = aiSettings->moveSpeed;
} else {
npc->moveSpeed = enemy->territory->wander.moveSpeedOverride / 32767.0;
}
script->functionTemp[0] = 0x29;
}
}
#include "world/common/UnkFunc9.inc.c"
#include "world/common/UnkNpcAIFunc19.inc.c"
#include "world/common/UnkNpcAIFunc17.inc.c"
#include "world/common/UnkDurationCheck.inc.c"
ApiStatus N(func_80243018_BE67C8)(Evt* script, s32 isInitialCall) {
Enemy* enemy = script->owner1.enemy;
Npc* npc = get_npc_unsafe(enemy->npcID);
Bytecode* args = script->ptrReadPos;
NpcAISettings* aiSettings = (NpcAISettings*)evt_get_variable(script, *args++);
EnemyTerritoryThing territory;
EnemyTerritoryThing* territoryPtr = &territory;
u32 var;
enemy->varTable[10] = evt_get_variable(script, *args++);
territory.unk_00 = 0;
territory.shape = enemy->territory->wander.detectShape;
territory.pointX = enemy->territory->wander.detect.x;
territory.pointZ = enemy->territory->wander.detect.z;
territory.sizeX = enemy->territory->wander.detectSizeX;
territory.sizeZ = enemy->territory->wander.detectSizeZ;
territory.unk_18 = 40.0f;
territory.unk_1C = 0;
if (isInitialCall) {
script->functionTemp[0] = 0;
npc->duration = 0;
npc->flags &= ~0x800;
if (!enemy->territory->wander.isFlying) {
npc->flags |= 0x200;
npc->flags &= ~0x8;
} else {
npc->flags &= ~0x200;
npc->flags |= 0x8;
}
}
if (enemy->unk_B0 & ENEMY_AI_FLAGS_4) {
if (enemy->unk_B4 != 0) {
return ApiStatus_BLOCK;
}
enemy->unk_B0 &= ~ENEMY_AI_FLAGS_4;
}
if ((u32)script->functionTemp[0] - 12 < 3 && N(func_80242388_BE5B38)(script, aiSettings, territoryPtr)) {
script->functionTemp[0] = 20;
}
switch (script->functionTemp[0]) {
case 0:
N(UnkNpcAIFunc18)(script, aiSettings, territoryPtr);
case 1:
N(func_8024255C_BE5D0C)(script, aiSettings, territoryPtr);
if (script->functionTemp[0] != 2) {
return ApiStatus_BLOCK;
}
case 2:
N(UnkNpcAIFunc21)(script, aiSettings, territoryPtr);
if (script->functionTemp[0] != 3) {
return ApiStatus_BLOCK;
}
case 3:
N(UnkNpcAIFunc20)(script, aiSettings, territoryPtr);
if (script->functionTemp[0] != 4) {
return ApiStatus_BLOCK;
}
case 4:
N(UnkNpcAIFunc22)(script, aiSettings, territoryPtr);
case 5:
N(UnkFunc8)(script, aiSettings, territoryPtr);
return ApiStatus_BLOCK;
case 12:
func_80049F7C(script, aiSettings, territoryPtr);
if (script->functionTemp[0] != 13) {
return ApiStatus_BLOCK;
}
case 13:
func_8004A124(script, aiSettings, territoryPtr);
if (script->functionTemp[0] != 14) {
return ApiStatus_BLOCK;
}
case 14:
npc->duration--;
if (npc->duration == 0) {
script->functionTemp[0] = 40;
}
return ApiStatus_BLOCK;
case 20:
N(UnkNpcAIFunc16)(script, aiSettings, territoryPtr);
case 21:
N(func_80242A1C_BE61CC)(script, aiSettings, territoryPtr);
return ApiStatus_BLOCK;
case 22:
N(UnkFunc10)(script, aiSettings, territoryPtr);
return ApiStatus_BLOCK;
case 40:
N(func_80242D0C_BE64BC)(script, aiSettings, territoryPtr);
if (script->functionTemp[0] != 41) {
return ApiStatus_BLOCK;
}
case 41:
N(UnkFunc9)(script, aiSettings, territoryPtr);
return ApiStatus_BLOCK;
case 50:
N(UnkNpcAIFunc19)(script, aiSettings, territoryPtr);
case 51:
N(UnkNpcAIFunc17)(script, aiSettings, territoryPtr);
if (script->functionTemp[0] != 52) {
return ApiStatus_BLOCK;
}
case 52:
N(UnkDurationCheck)(script, aiSettings, territoryPtr);
return ApiStatus_BLOCK;
}
return ApiStatus_BLOCK;
}
#include "world/common/enemy/CleftAI.inc.c"

View File

@ -77,11 +77,11 @@ NpcAISettings N(npcAISettings_802416DC) = {
.moveTime = 25,
.waitTime = 30,
.alertRadius = 50.0f,
.unk_10 = { .f = 50.0f },
.unk_14 = 10,
.alertOffsetDist = 50.0f,
.playerSearchInterval = 10,
.chaseRadius = 100.0f,
.unk_28 = { .f = 80.0f },
.unk_2C = 1,
.chaseOffsetDist = 80.0f,
.unk_AI_2C = 1,
};
EvtScript N(npcAI_8024170C) = {
@ -320,7 +320,7 @@ StaticNpc N(npcGroup_8024223C)[] = {
.id = NPC_BOO0,
.settings = &N(npcSettings_8024172C),
.pos = { 55.0f, 195.0f, 160.0f },
.flags = NPC_FLAG_PASSIVE | NPC_FLAG_100 | NPC_FLAG_LOCK_ANIMS | NPC_FLAG_NO_Y_MOVEMENT,
.flags = NPC_FLAG_PASSIVE | NPC_FLAG_100 | NPC_FLAG_LOCK_ANIMS | NPC_FLAG_JUMPING,
.init = &N(init_80241FB8),
.yaw = 270,
.dropFlags = NPC_DROP_FLAGS_80,
@ -351,7 +351,7 @@ StaticNpc N(npcGroup_8024223C)[] = {
.id = NPC_BOO1,
.settings = &N(npcSettings_80241758),
.pos = { 160.0f, 191.0f, 250.0f },
.flags = NPC_FLAG_PASSIVE | NPC_FLAG_100 | NPC_FLAG_LOCK_ANIMS | NPC_FLAG_NO_Y_MOVEMENT,
.flags = NPC_FLAG_PASSIVE | NPC_FLAG_100 | NPC_FLAG_LOCK_ANIMS | NPC_FLAG_JUMPING,
.init = &N(init_80242008),
.yaw = 270,
.dropFlags = NPC_DROP_FLAGS_80,
@ -381,7 +381,7 @@ StaticNpc N(npcGroup_8024223C)[] = {
.id = NPC_BOO2,
.settings = &N(npcSettings_80241758),
.pos = { 390.0f, 190.0f, 255.0f },
.flags = NPC_FLAG_PASSIVE | NPC_FLAG_100 | NPC_FLAG_LOCK_ANIMS | NPC_FLAG_NO_Y_MOVEMENT,
.flags = NPC_FLAG_PASSIVE | NPC_FLAG_100 | NPC_FLAG_LOCK_ANIMS | NPC_FLAG_JUMPING,
.init = &N(init_8024202C),
.yaw = 270,
.dropFlags = NPC_DROP_FLAGS_80,
@ -411,7 +411,7 @@ StaticNpc N(npcGroup_8024223C)[] = {
.id = NPC_BOO3,
.settings = &N(npcSettings_80241758),
.pos = { 503.0f, 206.0f, 210.0f },
.flags = NPC_FLAG_PASSIVE | NPC_FLAG_100 | NPC_FLAG_LOCK_ANIMS | NPC_FLAG_NO_Y_MOVEMENT,
.flags = NPC_FLAG_PASSIVE | NPC_FLAG_100 | NPC_FLAG_LOCK_ANIMS | NPC_FLAG_JUMPING,
.init = &N(init_8024212C),
.yaw = 270,
.dropFlags = NPC_DROP_FLAGS_80,
@ -441,7 +441,7 @@ StaticNpc N(npcGroup_8024223C)[] = {
.id = NPC_BOO4,
.settings = &N(npcSettings_8024172C),
.pos = { 350.0f, 185.0f, 197.0f },
.flags = NPC_FLAG_PASSIVE | NPC_FLAG_100 | NPC_FLAG_LOCK_ANIMS | NPC_FLAG_NO_Y_MOVEMENT,
.flags = NPC_FLAG_PASSIVE | NPC_FLAG_100 | NPC_FLAG_LOCK_ANIMS | NPC_FLAG_JUMPING,
.init = &N(init_802421EC),
.yaw = 270,
.dropFlags = NPC_DROP_FLAGS_80,
@ -794,7 +794,7 @@ StaticNpc N(npcGroup_802443AC) = {
.id = NPC_WORLD_TUBBA,
.settings = &N(npcSettings_802416B0),
.pos = { 0.0f, -1000.0f, 0.0f },
.flags = NPC_FLAG_PASSIVE | NPC_FLAG_100 | NPC_FLAG_GRAVITY | NPC_FLAG_NO_Y_MOVEMENT,
.flags = NPC_FLAG_PASSIVE | NPC_FLAG_100 | NPC_FLAG_GRAVITY | NPC_FLAG_JUMPING,
.init = &N(init_80244358),
.yaw = 270,
.dropFlags = NPC_DROP_FLAGS_80,
@ -1015,9 +1015,9 @@ EvtScript N(makeEntities) = {
EVT_END
};
#include "world/common/atomic/enemy/UnkAI_1.inc.c"
#include "world/common/enemy/PatrolNoAttackAI.inc.c"
void N(func_80240E90_BE8A70)(Evt* script, NpcAISettings* aiSettings, EnemyTerritoryThing* territory) {
void N(func_80240E90_BE8A70)(Evt* script, NpcAISettings* aiSettings, EnemyDetectVolume* territory) {
Enemy* enemy = script->owner1.enemy;
Npc* npc = get_npc_unsafe(enemy->npcID);
f32 posX, posY, posZ, posW;
@ -1053,7 +1053,7 @@ void N(func_80240E90_BE8A70)(Evt* script, NpcAISettings* aiSettings, EnemyTerrit
}
}
void N(func_80241068_BE8C48)(Evt* script, NpcAISettings* aiSettings, EnemyTerritoryThing* territory) {
void N(func_80241068_BE8C48)(Evt* script, NpcAISettings* aiSettings, EnemyDetectVolume* territory) {
Enemy* enemy = script->owner1.enemy;
Npc* npc = get_npc_unsafe(enemy->npcID);
@ -1065,7 +1065,7 @@ void N(func_80241068_BE8C48)(Evt* script, NpcAISettings* aiSettings, EnemyTerrit
npc->duration = aiSettings->waitTime / 2 + rand_int(aiSettings->waitTime / 2 + 1);
} else {
script->functionTemp[0] = 4;
npc->currentAnim.w = enemy->animList[0];
npc->currentAnim.w = enemy->animList[ENEMY_ANIM_IDLE];
}
}
}
@ -1074,18 +1074,18 @@ ApiStatus N(func_8024113C_BE8D1C)(Evt* script, s32 isInitialCall) {
Enemy* enemy = script->owner1.enemy;
Bytecode* args = script->ptrReadPos;
Npc* npc = get_npc_unsafe(enemy->npcID);
EnemyTerritoryThing territory;
EnemyTerritoryThing* territoryPtr = &territory;
EnemyDetectVolume territory;
EnemyDetectVolume* territoryPtr = &territory;
NpcAISettings* aiSettings = (NpcAISettings*)evt_get_variable(script, *args++);
territory.unk_00 = 0;
territory.skipPlayerDetectChance = 0;
territory.shape = enemy->territory->patrol.detectShape;
territory.pointX = enemy->territory->patrol.detect.x;
territory.pointZ = enemy->territory->patrol.detect.z;
territory.sizeX = enemy->territory->patrol.detectSizeX;
territory.sizeZ = enemy->territory->patrol.detectSizeZ;
territory.unk_18 = 100.0f;
territory.unk_1C = 0;
territory.halfHeight = 100.0f;
territory.detectFlags = 0;
if (isInitialCall) {
script->functionTemp[0] = 0;
@ -1095,17 +1095,17 @@ ApiStatus N(func_8024113C_BE8D1C)(Evt* script, s32 isInitialCall) {
switch (script->functionTemp[0]) {
case 0:
N(UnkNpcAIFunc24)(script, aiSettings, territoryPtr);
N(PatrolAI_MoveInit)(script, aiSettings, territoryPtr);
case 1:
N(func_80240E90_BE8A70)(script, aiSettings, territoryPtr);
break;
case 2:
N(UnkNpcAIFunc1)(script, aiSettings, territoryPtr);
N(PatrolAI_LoiterInit)(script, aiSettings, territoryPtr);
case 3:
N(func_80241068_BE8C48)(script, aiSettings, territoryPtr);
break;
case 4:
N(UnkNpcAIFunc25)(script, aiSettings, territoryPtr);
N(PatrolAI_PostLoiter)(script, aiSettings, territoryPtr);
}
enemy->varTable[0] = npc->pos.y;

View File

@ -31,7 +31,7 @@ ApiStatus N(arn_07_StarSpiritEffectFunc4)(Evt* script, s32 isInitialCall);
ApiStatus N(arn_07_StarSpiritEffectFunc5)(Evt* script, s32 isInitialCall);
ApiStatus N(arn_07_StarSpiritEffectFunc6)(Evt* script, s32 isInitialCall);
ApiStatus N(func_80240800_BED5F0)(Evt* script, s32 isInitialCall);
ApiStatus N(UnkNpcAIMainFunc9)(Evt* script, s32 isInitialCall);
ApiStatus N(FlyingAI_Main)(Evt* script, s32 isInitialCall);
ApiStatus N(SetEntityFlags100000)(Evt* script, s32 isInitialCall);
ApiStatus N(GetEntityPosition)(Evt* script, s32 isInitialCall);
ApiStatus PostChapter3StatUpdate(Evt* script, s32 isInitialCall);

View File

@ -95,7 +95,7 @@ EvtScript N(makeEntities) = {
EVT_END
};
f32 N(sixFloats)[] = {
f32 N(FlyingAI_JumpVels)[] = {
4.5f, 3.5f, 2.6f, 2.0f,
1.5f, 20.0f,
};
@ -105,12 +105,12 @@ NpcAISettings N(npcAISettings_80243BD8) = {
.moveTime = 60,
.waitTime = 15,
.alertRadius = 120.0f,
.unk_14 = 3,
.playerSearchInterval = 3,
.chaseSpeed = 4.0f,
.unk_1C = { .s = 5 },
.unk_20 = 1,
.chaseTurnRate= 5,
.chaseUpdateInterval = 1,
.chaseRadius = 150.0f,
.unk_2C = 1,
.unk_AI_2C = 1,
};
EvtScript N(npcAI_80243C08) = {
@ -118,7 +118,7 @@ EvtScript N(npcAI_80243C08) = {
EVT_CALL(SetSelfVar, 5, -850)
EVT_CALL(SetSelfVar, 6, 60)
EVT_CALL(SetSelfVar, 1, 700)
EVT_CALL(N(UnkNpcAIMainFunc9), EVT_PTR(N(npcAISettings_80243BD8)))
EVT_CALL(N(FlyingAI_Main), EVT_PTR(N(npcAISettings_80243BD8)))
EVT_RETURN
EVT_END
};
@ -731,7 +731,7 @@ StaticNpc N(npcGroup_80245D0C)[] = {
.id = NPC_WORLD_TUBBA,
.settings = &N(npcSettings_80243CF0),
.pos = { 309.0f, 0.0f, 11.0f },
.flags = NPC_FLAG_4 | NPC_FLAG_100 | NPC_FLAG_GRAVITY | NPC_FLAG_LOCK_ANIMS | NPC_FLAG_NO_Y_MOVEMENT | NPC_FLAG_40000 | NPC_FLAG_200000,
.flags = NPC_FLAG_4 | NPC_FLAG_100 | NPC_FLAG_GRAVITY | NPC_FLAG_LOCK_ANIMS | NPC_FLAG_JUMPING | NPC_FLAG_40000 | NPC_FLAG_200000,
.init = &N(init_80245090),
.yaw = 270,
.dropFlags = NPC_DROP_FLAGS_80,
@ -761,7 +761,7 @@ StaticNpc N(npcGroup_80245D0C)[] = {
.id = NPC_TUBBAS_HEART,
.settings = &N(npcSettings_80243CC4),
.pos = { -10.0f, 50.0f, -170.0f },
.flags = NPC_FLAG_PASSIVE | NPC_FLAG_4 | NPC_FLAG_100 | NPC_FLAG_GRAVITY | NPC_FLAG_LOCK_ANIMS | NPC_FLAG_NO_Y_MOVEMENT | NPC_FLAG_40000 | NPC_FLAG_200000,
.flags = NPC_FLAG_PASSIVE | NPC_FLAG_4 | NPC_FLAG_100 | NPC_FLAG_GRAVITY | NPC_FLAG_LOCK_ANIMS | NPC_FLAG_JUMPING | NPC_FLAG_40000 | NPC_FLAG_200000,
.init = &N(init_80245058),
.yaw = 90,
.dropFlags = NPC_DROP_FLAGS_80,
@ -793,7 +793,7 @@ StaticNpc N(npcGroup_802460EC)[] = {
.id = NPC_BOO0,
.settings = &N(npcSettings_80243D1C),
.pos = { 0.0f, -1000.0f, 0.0f },
.flags = NPC_FLAG_PASSIVE | NPC_FLAG_4 | NPC_FLAG_ENABLE_HIT_SCRIPT | NPC_FLAG_100 | NPC_FLAG_GRAVITY | NPC_FLAG_LOCK_ANIMS | NPC_FLAG_NO_Y_MOVEMENT | NPC_FLAG_200000,
.flags = NPC_FLAG_PASSIVE | NPC_FLAG_4 | NPC_FLAG_ENABLE_HIT_SCRIPT | NPC_FLAG_100 | NPC_FLAG_GRAVITY | NPC_FLAG_LOCK_ANIMS | NPC_FLAG_JUMPING | NPC_FLAG_200000,
.init = &N(init_80245104),
.yaw = 270,
.dropFlags = NPC_DROP_FLAGS_80,
@ -823,7 +823,7 @@ StaticNpc N(npcGroup_802460EC)[] = {
.id = NPC_BOO1,
.settings = &N(npcSettings_80243D1C),
.pos = { 0.0f, -1000.0f, 0.0f },
.flags = NPC_FLAG_PASSIVE | NPC_FLAG_4 | NPC_FLAG_ENABLE_HIT_SCRIPT | NPC_FLAG_100 | NPC_FLAG_GRAVITY | NPC_FLAG_LOCK_ANIMS | NPC_FLAG_NO_Y_MOVEMENT | NPC_FLAG_200000,
.flags = NPC_FLAG_PASSIVE | NPC_FLAG_4 | NPC_FLAG_ENABLE_HIT_SCRIPT | NPC_FLAG_100 | NPC_FLAG_GRAVITY | NPC_FLAG_LOCK_ANIMS | NPC_FLAG_JUMPING | NPC_FLAG_200000,
.init = &N(init_80245104),
.yaw = 270,
.dropFlags = NPC_DROP_FLAGS_80,
@ -853,7 +853,7 @@ StaticNpc N(npcGroup_802460EC)[] = {
.id = NPC_BOO2,
.settings = &N(npcSettings_80243D1C),
.pos = { 0.0f, -1000.0f, 0.0f },
.flags = NPC_FLAG_PASSIVE | NPC_FLAG_4 | NPC_FLAG_ENABLE_HIT_SCRIPT | NPC_FLAG_100 | NPC_FLAG_GRAVITY | NPC_FLAG_LOCK_ANIMS | NPC_FLAG_NO_Y_MOVEMENT | NPC_FLAG_200000,
.flags = NPC_FLAG_PASSIVE | NPC_FLAG_4 | NPC_FLAG_ENABLE_HIT_SCRIPT | NPC_FLAG_100 | NPC_FLAG_GRAVITY | NPC_FLAG_LOCK_ANIMS | NPC_FLAG_JUMPING | NPC_FLAG_200000,
.init = &N(init_80245104),
.yaw = 270,
.dropFlags = NPC_DROP_FLAGS_80,
@ -883,7 +883,7 @@ StaticNpc N(npcGroup_802460EC)[] = {
.id = NPC_BOO3,
.settings = &N(npcSettings_80243D1C),
.pos = { 0.0f, -1000.0f, 0.0f },
.flags = NPC_FLAG_PASSIVE | NPC_FLAG_4 | NPC_FLAG_ENABLE_HIT_SCRIPT | NPC_FLAG_100 | NPC_FLAG_GRAVITY | NPC_FLAG_LOCK_ANIMS | NPC_FLAG_NO_Y_MOVEMENT | NPC_FLAG_200000,
.flags = NPC_FLAG_PASSIVE | NPC_FLAG_4 | NPC_FLAG_ENABLE_HIT_SCRIPT | NPC_FLAG_100 | NPC_FLAG_GRAVITY | NPC_FLAG_LOCK_ANIMS | NPC_FLAG_JUMPING | NPC_FLAG_200000,
.init = &N(init_80245104),
.yaw = 270,
.dropFlags = NPC_DROP_FLAGS_80,
@ -913,7 +913,7 @@ StaticNpc N(npcGroup_802460EC)[] = {
.id = NPC_BOO4,
.settings = &N(npcSettings_80243D1C),
.pos = { 0.0f, -1000.0f, 0.0f },
.flags = NPC_FLAG_PASSIVE | NPC_FLAG_4 | NPC_FLAG_ENABLE_HIT_SCRIPT | NPC_FLAG_100 | NPC_FLAG_GRAVITY | NPC_FLAG_LOCK_ANIMS | NPC_FLAG_NO_Y_MOVEMENT | NPC_FLAG_200000,
.flags = NPC_FLAG_PASSIVE | NPC_FLAG_4 | NPC_FLAG_ENABLE_HIT_SCRIPT | NPC_FLAG_100 | NPC_FLAG_GRAVITY | NPC_FLAG_LOCK_ANIMS | NPC_FLAG_JUMPING | NPC_FLAG_200000,
.init = &N(init_80245104),
.yaw = 270,
.dropFlags = NPC_DROP_FLAGS_80,
@ -943,7 +943,7 @@ StaticNpc N(npcGroup_802460EC)[] = {
.id = NPC_BOO5,
.settings = &N(npcSettings_80243D1C),
.pos = { 0.0f, -1000.0f, 0.0f },
.flags = NPC_FLAG_PASSIVE | NPC_FLAG_4 | NPC_FLAG_ENABLE_HIT_SCRIPT | NPC_FLAG_100 | NPC_FLAG_GRAVITY | NPC_FLAG_LOCK_ANIMS | NPC_FLAG_NO_Y_MOVEMENT | NPC_FLAG_200000,
.flags = NPC_FLAG_PASSIVE | NPC_FLAG_4 | NPC_FLAG_ENABLE_HIT_SCRIPT | NPC_FLAG_100 | NPC_FLAG_GRAVITY | NPC_FLAG_LOCK_ANIMS | NPC_FLAG_JUMPING | NPC_FLAG_200000,
.init = &N(init_80245104),
.yaw = 270,
.dropFlags = NPC_DROP_FLAGS_80,
@ -975,7 +975,7 @@ StaticNpc N(npcGroup_80246C8C) = {
.id = NPC_WORLD_BOW,
.settings = &N(npcSettings_80243D1C),
.pos = { 0.0f, -1000.0f, 0.0f },
.flags = NPC_FLAG_PASSIVE | NPC_FLAG_4 | NPC_FLAG_100 | NPC_FLAG_GRAVITY | NPC_FLAG_LOCK_ANIMS | NPC_FLAG_NO_Y_MOVEMENT | NPC_FLAG_200000,
.flags = NPC_FLAG_PASSIVE | NPC_FLAG_4 | NPC_FLAG_100 | NPC_FLAG_GRAVITY | NPC_FLAG_LOCK_ANIMS | NPC_FLAG_JUMPING | NPC_FLAG_200000,
.init = &N(init_80245164),
.yaw = 0,
.dropFlags = NPC_DROP_FLAGS_80,
@ -1005,7 +1005,7 @@ StaticNpc N(npcGroup_80246E7C) = {
.id = NPC_BOOTLER,
.settings = &N(npcSettings_80243D1C),
.pos = { 0.0f, -1000.0f, 0.0f },
.flags = NPC_FLAG_PASSIVE | NPC_FLAG_4 | NPC_FLAG_100 | NPC_FLAG_LOCK_ANIMS | NPC_FLAG_NO_Y_MOVEMENT | NPC_FLAG_200000,
.flags = NPC_FLAG_PASSIVE | NPC_FLAG_4 | NPC_FLAG_100 | NPC_FLAG_LOCK_ANIMS | NPC_FLAG_JUMPING | NPC_FLAG_200000,
.init = &N(init_8024519C),
.yaw = 0,
.dropFlags = NPC_DROP_FLAGS_80,
@ -1046,7 +1046,7 @@ StaticNpc N(npcGroup_802470BC) = {
.id = NPC_PARAGOOMBA0,
.settings = &N(npcSettings_80243C78),
.pos = { -216.0f, 60.0f, -10.0f },
.flags = NPC_FLAG_LOCK_ANIMS | NPC_FLAG_NO_Y_MOVEMENT,
.flags = NPC_FLAG_LOCK_ANIMS | NPC_FLAG_JUMPING,
.init = &N(init_8024706C),
.yaw = 90,
.dropFlags = NPC_DROP_FLAGS_80,
@ -1083,7 +1083,7 @@ StaticNpc N(npcGroup_802472AC) = {
.id = NPC_PARAGOOMBA1,
.settings = &N(npcSettings_80243C78),
.pos = { 0.0f, 60.0f, 150.0f },
.flags = NPC_FLAG_LOCK_ANIMS | NPC_FLAG_NO_Y_MOVEMENT,
.flags = NPC_FLAG_LOCK_ANIMS | NPC_FLAG_JUMPING,
.init = &N(init_8024706C),
.yaw = 270,
.dropFlags = NPC_DROP_FLAGS_80,
@ -1120,7 +1120,7 @@ StaticNpc N(npcGroup_8024749C) = {
.id = NPC_PARAGOOMBA2,
.settings = &N(npcSettings_80243C78),
.pos = { 260.0f, 60.0f, 30.0f },
.flags = NPC_FLAG_LOCK_ANIMS | NPC_FLAG_NO_Y_MOVEMENT,
.flags = NPC_FLAG_LOCK_ANIMS | NPC_FLAG_JUMPING,
.init = &N(init_8024706C),
.yaw = 90,
.dropFlags = NPC_DROP_FLAGS_80,
@ -1157,7 +1157,7 @@ StaticNpc N(npcGroup_8024768C) = {
.id = NPC_WORLD_SKOLAR,
.settings = &N(npcSettings_80243D48),
.pos = { 0.0f, -1000.0f, 0.0f },
.flags = NPC_FLAG_PASSIVE | NPC_FLAG_100 | NPC_FLAG_LOCK_ANIMS | NPC_FLAG_NO_Y_MOVEMENT,
.flags = NPC_FLAG_PASSIVE | NPC_FLAG_100 | NPC_FLAG_LOCK_ANIMS | NPC_FLAG_JUMPING,
.init = &N(init_80245C9C),
.yaw = 0,
.dropFlags = NPC_DROP_FLAGS_80,
@ -1203,7 +1203,7 @@ NpcGroupList N(npcGroupList_802478E8) = {
{},
};
#include "world/common/atomic/enemy/UnkAI_9.inc.c"
#include "world/common/enemy/FlyingAI.inc.c"
ApiStatus PostChapter3StatUpdate(Evt* script, s32 isInitialCall) {
PlayerData* playerData = &gPlayerData;

View File

@ -367,7 +367,7 @@ StaticNpc N(npcGroup_80241448) = {
.id = NPC_TUBBAS_HEART,
.settings = &N(npcSettings_80241220),
.pos = { -23.0f, 75.0f, 31.0f },
.flags = NPC_FLAG_PASSIVE | NPC_FLAG_4 | NPC_FLAG_100 | NPC_FLAG_LOCK_ANIMS | NPC_FLAG_NO_Y_MOVEMENT,
.flags = NPC_FLAG_PASSIVE | NPC_FLAG_4 | NPC_FLAG_100 | NPC_FLAG_LOCK_ANIMS | NPC_FLAG_JUMPING,
.init = &N(init_80241288),
.yaw = 270,
.dropFlags = NPC_DROP_FLAGS_80,
@ -397,7 +397,7 @@ StaticNpc N(npcGroup_80241638) = {
.id = NPC_YAKKEY,
.settings = &N(npcSettings_8024124C),
.pos = { 38.0f, 0.0f, 97.0f },
.flags = NPC_FLAG_PASSIVE | NPC_FLAG_NO_Y_MOVEMENT,
.flags = NPC_FLAG_PASSIVE | NPC_FLAG_JUMPING,
.init = &N(init_802413E8),
.yaw = 270,
.dropFlags = NPC_DROP_FLAGS_80,

View File

@ -163,7 +163,7 @@ StaticNpc N(npcGroup_80240784) = {
.id = 0,
.settings = &N(npcSettings_802405D0),
.pos = { 0.0f, 25.0f, 0.0f },
.flags = NPC_FLAG_PASSIVE | NPC_FLAG_4 | NPC_FLAG_100 | NPC_FLAG_LOCK_ANIMS | NPC_FLAG_NO_Y_MOVEMENT,
.flags = NPC_FLAG_PASSIVE | NPC_FLAG_4 | NPC_FLAG_100 | NPC_FLAG_LOCK_ANIMS | NPC_FLAG_JUMPING,
.init = &N(init_80240730),
.yaw = 270,
.dropFlags = NPC_DROP_FLAGS_80,

View File

@ -100,16 +100,16 @@ NpcAISettings N(npcAISettings_8024047C) = {
.moveTime = 40,
.waitTime = 15,
.alertRadius = 150.0f,
.unk_14 = 2,
.playerSearchInterval = 2,
.chaseSpeed = 3.3f,
.unk_1C = { .s = 70 },
.unk_20 = 1,
.chaseTurnRate= 70,
.chaseUpdateInterval = 1,
.chaseRadius = 180.0f,
.unk_2C = 1,
.unk_AI_2C = 1,
};
EvtScript N(npcAI_802404AC) = {
EVT_CALL(DoBasicAI, EVT_PTR(N(npcAISettings_8024047C)))
EVT_CALL(BasicAI_Main, EVT_PTR(N(npcAISettings_8024047C)))
EVT_RETURN
EVT_END
};
@ -183,7 +183,7 @@ StaticNpc N(npcGroup_802407D8) = {
.id = 0,
.settings = &N(npcSettings_80240450),
.pos = { 80.0f, 50.0f, 0.0f },
.flags = NPC_FLAG_PASSIVE | NPC_FLAG_4 | NPC_FLAG_100 | NPC_FLAG_LOCK_ANIMS | NPC_FLAG_NO_Y_MOVEMENT,
.flags = NPC_FLAG_PASSIVE | NPC_FLAG_4 | NPC_FLAG_100 | NPC_FLAG_LOCK_ANIMS | NPC_FLAG_JUMPING,
.init = &N(init_80240720),
.yaw = 270,
.dropFlags = NPC_DROP_FLAGS_80,
@ -212,7 +212,7 @@ StaticNpc N(npcGroup_802407D8) = {
StaticNpc N(npcGroup_802409C8) = {
.id = 1,
.settings = &N(npcSettings_802404CC),
.flags = NPC_FLAG_LOCK_ANIMS | NPC_FLAG_NO_Y_MOVEMENT,
.flags = NPC_FLAG_LOCK_ANIMS | NPC_FLAG_JUMPING,
.init = &N(init_8024076C),
.yaw = 270,
.dropFlags = NPC_DROP_FLAGS_80,

View File

@ -275,7 +275,7 @@ StaticNpc N(npcGroup_80240EEC) = {
.id = NPC_TUBBAS_HEART,
.settings = &N(npcSettings_802406A0),
.pos = { 119.0f, 60.0f, 0.0f },
.flags = NPC_FLAG_PASSIVE | NPC_FLAG_4 | NPC_FLAG_100 | NPC_FLAG_GRAVITY | NPC_FLAG_NO_Y_MOVEMENT | NPC_FLAG_40000,
.flags = NPC_FLAG_PASSIVE | NPC_FLAG_4 | NPC_FLAG_100 | NPC_FLAG_GRAVITY | NPC_FLAG_JUMPING | NPC_FLAG_40000,
.init = &N(init_80240E70),
.yaw = 270,
.dropFlags = NPC_DROP_FLAGS_80,

View File

@ -99,16 +99,16 @@ NpcAISettings N(npcAISettings_8024046C) = {
.moveTime = 40,
.waitTime = 15,
.alertRadius = 150.0f,
.unk_14 = 2,
.playerSearchInterval = 2,
.chaseSpeed = 3.3f,
.unk_1C = { .s = 70 },
.unk_20 = 1,
.chaseTurnRate= 70,
.chaseUpdateInterval = 1,
.chaseRadius = 180.0f,
.unk_2C = 1,
.unk_AI_2C = 1,
};
EvtScript N(npcAI_8024049C) = {
EVT_CALL(DoBasicAI, EVT_PTR(N(npcAISettings_8024046C)))
EVT_CALL(BasicAI_Main, EVT_PTR(N(npcAISettings_8024046C)))
EVT_RETURN
EVT_END
};
@ -183,7 +183,7 @@ StaticNpc N(npcGroup_802407DC) = {
.id = 0,
.settings = &N(npcSettings_80240440),
.pos = { 80.0f, 50.0f, 0.0f },
.flags = NPC_FLAG_PASSIVE | NPC_FLAG_4 | NPC_FLAG_100 | NPC_FLAG_LOCK_ANIMS | NPC_FLAG_NO_Y_MOVEMENT,
.flags = NPC_FLAG_PASSIVE | NPC_FLAG_4 | NPC_FLAG_100 | NPC_FLAG_LOCK_ANIMS | NPC_FLAG_JUMPING,
.init = &N(init_80240710),
.yaw = 270,
.dropFlags = NPC_DROP_FLAGS_80,
@ -212,7 +212,7 @@ StaticNpc N(npcGroup_802407DC) = {
StaticNpc N(npcGroup_802409CC) = {
.id = 1,
.settings = &N(npcSettings_802404BC),
.flags = NPC_FLAG_LOCK_ANIMS | NPC_FLAG_NO_Y_MOVEMENT,
.flags = NPC_FLAG_LOCK_ANIMS | NPC_FLAG_JUMPING,
.init = &N(init_8024075C),
.yaw = 270,
.dropFlags = NPC_DROP_FLAGS_80,

View File

@ -100,16 +100,16 @@ NpcAISettings N(npcAISettings_8024047C) = {
.moveTime = 40,
.waitTime = 15,
.alertRadius = 150.0f,
.unk_14 = 2,
.playerSearchInterval = 2,
.chaseSpeed = 3.3f,
.unk_1C = { .s = 70 },
.unk_20 = 1,
.chaseTurnRate= 70,
.chaseUpdateInterval = 1,
.chaseRadius = 180.0f,
.unk_2C = 1,
.unk_AI_2C = 1,
};
EvtScript N(npcAI_802404AC) = {
EVT_CALL(DoBasicAI, EVT_PTR(N(npcAISettings_8024047C)))
EVT_CALL(BasicAI_Main, EVT_PTR(N(npcAISettings_8024047C)))
EVT_RETURN
EVT_END
};
@ -184,7 +184,7 @@ StaticNpc N(npcGroup_802407EC) = {
.id = 0,
.settings = &N(npcSettings_80240450),
.pos = { 80.0f, 50.0f, 0.0f },
.flags = NPC_FLAG_PASSIVE | NPC_FLAG_4 | NPC_FLAG_100 | NPC_FLAG_LOCK_ANIMS | NPC_FLAG_NO_Y_MOVEMENT,
.flags = NPC_FLAG_PASSIVE | NPC_FLAG_4 | NPC_FLAG_100 | NPC_FLAG_LOCK_ANIMS | NPC_FLAG_JUMPING,
.init = &N(init_80240720),
.yaw = 270,
.dropFlags = NPC_DROP_FLAGS_80,
@ -213,7 +213,7 @@ StaticNpc N(npcGroup_802407EC) = {
StaticNpc N(npcGroup_802409DC) = {
.id = 1,
.settings = &N(npcSettings_802404CC),
.flags = NPC_FLAG_LOCK_ANIMS | NPC_FLAG_NO_Y_MOVEMENT,
.flags = NPC_FLAG_LOCK_ANIMS | NPC_FLAG_JUMPING,
.init = &N(init_8024076C),
.yaw = 270,
.dropFlags = NPC_DROP_FLAGS_80,

View File

@ -783,7 +783,7 @@ StaticNpc N(npcGroup_802434FC) = {
.id = NPC_SENTINEL,
.settings = &N(npcSettings_8024066C),
.pos = { 0.0f, 0.0f, -1000.0f },
.flags = NPC_FLAG_PASSIVE | NPC_FLAG_4 | NPC_FLAG_100 | NPC_FLAG_GRAVITY | NPC_FLAG_LOCK_ANIMS | NPC_FLAG_NO_Y_MOVEMENT | NPC_FLAG_400000,
.flags = NPC_FLAG_PASSIVE | NPC_FLAG_4 | NPC_FLAG_100 | NPC_FLAG_GRAVITY | NPC_FLAG_LOCK_ANIMS | NPC_FLAG_JUMPING | NPC_FLAG_400000,
.init = &N(init_802434EC),
.yaw = 90,
.dropFlags = NPC_DROP_FLAGS_80,
@ -837,6 +837,6 @@ EvtScript N(makeEntities) = {
ApiStatus N(func_80240060_BFA100)(Evt* script, s32 isInitialCall) {
Npc* npc = get_npc_unsafe(get_enemy(6)->npcID);
sfx_adjust_env_sound_pos(0x32E, 0, npc->pos.x, npc->pos.y, npc->pos.z);
sfx_adjust_env_sound_pos(SOUND_32E, 0, npc->pos.x, npc->pos.y, npc->pos.z);
return ApiStatus_DONE2;
}

View File

@ -478,14 +478,14 @@ EvtScript N(makeEntities) = {
EVT_END
};
f32 N(sixFloats)[] = {
f32 N(FlyingAI_JumpVels)[] = {
4.5f, 3.5f, 2.6f, 2.0f,
1.5f, 20.0f,
};
EvtScript N(80244CE8) = {
EVT_CALL(SetSelfEnemyFlagBits, ((NPC_FLAG_MOTION_BLUR | NPC_FLAG_1000000 | NPC_FLAG_SIMPLIFIED_PHYSICS | NPC_FLAG_PARTICLE | NPC_FLAG_8000000 | NPC_FLAG_10000000 | NPC_FLAG_20000000)), TRUE)
EVT_CALL(SetNpcFlagBits, NPC_SELF, ((NPC_FLAG_100 | NPC_FLAG_LOCK_ANIMS | NPC_FLAG_NO_Y_MOVEMENT)), TRUE)
EVT_CALL(SetNpcFlagBits, NPC_SELF, ((NPC_FLAG_100 | NPC_FLAG_LOCK_ANIMS | NPC_FLAG_JUMPING)), TRUE)
EVT_RETURN
EVT_END
};
@ -495,329 +495,17 @@ NpcAISettings N(npcAISettings_80244D24) = {
.moveTime = 90,
.waitTime = 30,
.alertRadius = 240.0f,
.unk_14 = 1,
.playerSearchInterval = 1,
.chaseSpeed = 5.3f,
.unk_1C = { .s = 180 },
.unk_20 = 1,
.chaseTurnRate= 180,
.chaseUpdateInterval = 1,
.chaseRadius = 240.0f,
.unk_2C = 1,
.unk_AI_2C = 1,
};
#include "world/common/atomic/enemy/UnkAI_9.inc.c"
void N(func_80241618_BFEE98)(Evt* script, NpcAISettings* aiSettings, EnemyTerritoryThing* territory) {
Enemy* enemy = script->owner1.enemy;
Npc* npc = get_npc_unsafe(enemy->npcID);
f32 temp_f0;
f32 phi_f20;
npc->duration--;
if (npc->duration <= 0) {
npc->flags &= ~0x00200000;
npc->duration = aiSettings->unk_20 / 2 + rand_int(aiSettings->unk_20 / 2 + 1);
npc->currentAnim.w = enemy->animList[8];
npc->moveSpeed = aiSettings->chaseSpeed;
phi_f20 = atan2(npc->pos.x, npc->pos.z, gPlayerStatusPtr->position.x, gPlayerStatusPtr->position.z);
temp_f0 = get_clamped_angle_diff(npc->yaw, phi_f20);
if (aiSettings->unk_1C.s < fabsf(temp_f0)) {
phi_f20 = npc->yaw;
if (temp_f0 < 0.0f) {
phi_f20 += -aiSettings->unk_1C.s;
} else {
phi_f20 += aiSettings->unk_1C.s;
}
}
npc->yaw = clamp_angle(phi_f20);
script->functionTemp[0] = 13;
}
}
void N(func_80241770_BFEFF0)(Evt* script, NpcAISettings* aiSettings, EnemyTerritoryThing* territory) {
Enemy* enemy = script->owner1.enemy;
Npc* npc = get_npc_unsafe(enemy->npcID);
if (func_800490B4(territory, enemy, aiSettings->chaseRadius, aiSettings->unk_28.f, 1)) {
npc_move_heading(npc, npc->moveSpeed, npc->yaw);
if (dist2D(npc->pos.x, npc->pos.z, gPlayerStatusPtr->position.x,
gPlayerStatusPtr->position.z) <= (npc->moveSpeed * 2.5)) {
npc->duration = 0;
script->functionTemp[0] = 14;
} else {
npc->duration--;
if (npc->duration <= 0) {
npc->flags |= 0x200000;
script->functionTemp[0] = 12;
}
}
} else {
script->functionTemp[0] = 16;
}
}
void N(func_80241874_BFF0F4)(Evt* script, NpcAISettings* aiSettings, EnemyTerritoryThing* territory) {
Enemy* enemy = script->owner1.enemy;
Npc* npc = get_npc_unsafe(enemy->npcID);
s32 i;
for (i = 0; i < 4; i++) {
if (i != npc->npcID && (get_enemy(i)->varTable[0] & 0x100)) {
return;
}
}
enemy->varTable[0] |= 0x100;
npc->pos.x = gPlayerStatusPtr->position.x;
npc->pos.z = gPlayerStatusPtr->position.z;
if (!(enemy->varTable[0] & 0x1000)) {
enemy->varTable[0] |= 0x1000;
}
sfx_play_sound_at_position(0x80000011, 2, npc->pos.x, npc->pos.y, npc->pos.z);
npc->duration = 0;
script->functionTemp[0] = 15;
}
void N(func_80241954_BFF1D4)(Evt* script, NpcAISettings* aiSettings, EnemyTerritoryThing* territory) {
Enemy* enemy = script->owner1.enemy;
Npc* npc = get_npc_unsafe(enemy->npcID);
f32 posX, posY, posZ, posW;
s32 temp_f8_2;
sfx_adjust_env_sound_pos(0x80000011, 2, npc->pos.x, npc->pos.y, npc->pos.z);
if (!func_800490B4(territory, enemy, aiSettings->chaseRadius, aiSettings->unk_28.f, 1)) {
enemy->varTable[0] &= ~0x100;
npc->rotation.y = 0.0f;
npc->flags &= ~0x00200000;
script->functionTemp[0] = 16;
} else {
npc->pos.x = gPlayerStatusPtr->position.x;
npc->pos.z = gPlayerStatusPtr->position.z + 2.0f;
npc->rotation.y += 25.0f;
if (npc->rotation.y > 360.0) {
npc->rotation.y -= 360.0;
}
temp_f8_2 = 255.0f - (cosine((s32)npc->rotation.y % 180) * 56.0f);
func_802DE894(npc->spriteInstanceID, 6, temp_f8_2, temp_f8_2, temp_f8_2, 255, 0);
posX = gPlayerStatusPtr->position.x;
posY = gPlayerStatusPtr->position.y;
posZ = gPlayerStatusPtr->position.z;
posW = 1000.0f;
npc_raycast_down_sides(npc->collisionChannel, &posX, &posY, &posZ, &posW);
if (fabsf(npc->pos.y - posY) > 24.0) {
npc->pos.y -= 1.8;
} else {
npc->rotation.y = 0.0f;
npc->flags &= ~0x00200000;
if (gPartnerActionStatus.actingPartner != 9) {
disable_player_input();
partner_disable_input();
npc->duration = 0;
script->functionTemp[0] = 20;
} else {
script->functionTemp[0] = 16;
}
}
}
}
void N(func_80241BF0_BFF470)(Evt* script, NpcAISettings* aiSettings, EnemyTerritoryThing* territory) {
Enemy* enemy = script->owner1.enemy;
Npc* npc = get_npc_unsafe(enemy->npcID);
enemy->varTable[0] &= ~0x100;
func_802DE894(npc->spriteInstanceID, 0, 0, 0, 0, 0, 0);
if (enemy->varTable[0] & 0x1000) {
sfx_stop_sound(0x80000011);
enemy->varTable[0] &= ~0x1000;
}
npc->currentAnim.w = enemy->animList[9];
npc->duration = 20;
script->functionTemp[0] = 17;
}
void N(func_80241CA8_BFF528)(Evt* script, NpcAISettings* aiSettings, EnemyTerritoryThing* territory) {
Enemy* enemy = script->owner1.enemy;
Npc* npc = get_npc_unsafe(enemy->npcID);
f32 posX, posY, posZ, posW;
f32 tmp = enemy->varTable[3];
f32 temp_f20 = tmp / 100.0;
s32 var;
npc->pos.y += 2.5;
posX = npc->pos.x;
posY = npc->pos.y;
posZ = npc->pos.z;
posW = 1000.0f;
npc_raycast_down_sides(npc->collisionChannel, &posX, &posY, &posZ, &posW);
if (!(npc->pos.y < (posY + temp_f20))) {
npc->yaw = atan2(npc->pos.x, npc->pos.z, enemy->territory->wander.point.x, enemy->territory->wander.point.z);
npc->pos.y = posY + temp_f20;
fx_emote(EMOTE_QUESTION, npc, 0, npc->collisionHeight, 1.0f, 2.0f, -20.0f, 10, &var);
npc->duration = 10;
script->functionTemp[0] = 18;
}
}
void N(func_80241E28_BFF6A8)(Evt* script, NpcAISettings* aiSettings, EnemyTerritoryThing* territory) {
Enemy* enemy = script->owner1.enemy;
Npc* npc = get_npc_unsafe(enemy->npcID);
npc->duration--;
if (npc->duration <= 0) {
script->functionTemp[0] = 30;
}
}
void N(func_80241E70_BFF6F0)(Evt* script, NpcAISettings* aiSettings, EnemyTerritoryThing* territory) {
Enemy* enemy = script->owner1.enemy;
Npc* npc = get_npc_unsafe(enemy->npcID);
npc->duration++;
if (npc->duration >= 3) {
if (gPartnerActionStatus.actingPartner != 9) {
npc->duration = 0;
script->functionTemp[0] = 100;
} else {
enable_player_input();
partner_enable_input();
script->functionTemp[0] = 16;
}
}
}
void N(func_80241EF0_BFF770)(Evt* script, NpcAISettings* aiSettings, EnemyTerritoryThing* territory) {
Enemy* enemy = script->owner1.enemy;
Npc* npc = get_npc_unsafe(enemy->npcID);
enemy->varTable[0] &= ~0x100;
npc->flags &= ~0x00200000;
npc->moveSpeed = 2.0 * aiSettings->moveSpeed;
enemy->varTable[2] = 0;
enemy->varTable[4] = npc->pos.y * 100.0;
script->functionTemp[1] = 0x1E;
}
void N(func_80241F98_BFF818)(Evt* script, NpcAISettings* aiSettings, EnemyTerritoryThing* territory) {
Enemy* enemy = script->owner1.enemy;
Npc* npc = get_npc_unsafe(enemy->npcID);
f32 posX = npc->pos.x;
f32 posY = npc->pos.y;
f32 posZ = npc->pos.z;
f32 posW = 1000.0f;
f32 temp_f26 = (f32)enemy->varTable[3] / 100.0;
f32 temp_f24 = temp_f26 + (f32)((f32)enemy->varTable[7] / 100.0);
f32 temp_f22 = (f32)enemy->varTable[1] / 100.0;
f32 temp_f20 = sin_deg(enemy->varTable[2]);
s32 var;
s32 var2;
if (npc_raycast_down_sides(npc->collisionChannel, &posX, &posY, &posZ, &posW)) {
npc->pos.y = posY + temp_f26 + (temp_f20 * temp_f22);
} else {
npc->pos.y = temp_f24 + (temp_f20 * temp_f22);
}
enemy->varTable[2] = clamp_angle(enemy->varTable[2] + 12);
if (script->functionTemp[1] <= 0) {
script->functionTemp[1] = aiSettings->unk_14;
if (func_800490B4(territory, enemy, aiSettings->alertRadius * 0.5, aiSettings->unk_10.f * 0.5, 0)) {
fx_emote(EMOTE_EXCLAMATION, npc, 0, npc->collisionHeight, 1.0f, 2.0f, -20.0f, 12, &var);
ai_enemy_play_sound(npc, 0x2F4, 0x200000);
npc->moveToPos.y = npc->pos.y;
script->functionTemp[0] = 12;
return;
}
}
script->functionTemp[1]--;
if (npc->turnAroundYawAdjustment == 0) {
npc->yaw = atan2(npc->pos.x, npc->pos.z, enemy->territory->wander.point.x, enemy->territory->wander.point.z);
npc_move_heading(npc, npc->moveSpeed, npc->yaw);
posW = dist2D(npc->pos.x, npc->pos.z, enemy->territory->wander.point.x, enemy->territory->wander.point.z);
if (posW <= (2.0f * npc->moveSpeed)) {
script->functionTemp[1] = (rand_int(1000) % 3) + 2;
script->functionTemp[0] = 2;
}
}
}
ApiStatus N(func_802422B0_BFFB30)(Evt* script, s32 isInitialCall) {
Enemy* enemy = script->owner1.enemy;
Npc* npc = get_npc_unsafe(enemy->npcID);
Bytecode* args = script->ptrReadPos;
EnemyTerritoryThing territory;
EnemyTerritoryThing* territoryPtr = &territory;
NpcAISettings* aiSettings =(NpcAISettings*) evt_get_variable(script, *args);
territory.unk_00 = 0;
territory.shape = enemy->territory->wander.detectShape;
territory.pointX = enemy->territory->wander.detect.x;
territory.pointZ = enemy->territory->wander.detect.z;
territory.sizeX = enemy->territory->wander.detectSizeX;
territory.sizeZ = enemy->territory->wander.detectSizeZ;
territory.unk_18 = 125.0f;
territory.unk_1C = 0;
if (isInitialCall) {
script->functionTemp[0] = 0;
N(UnkFunc5)(npc, enemy, script, aiSettings);
}
switch (script->functionTemp[0]) {
case 0:
N(UnkNpcAIFunc23)(script, aiSettings, territoryPtr);
func_802DE894(npc->spriteInstanceID, 0, 0, 0, 0, 0, 0);
case 1:
N(UnkNpcAIFunc35)(script, aiSettings, territoryPtr);
if (script->functionTemp[0] == 12) {
npc->duration = 6;
}
break;
case 2:
N(UnkNpcAIFunc1_copy)(script, aiSettings, territoryPtr);
case 3:
N(UnkFunc4)(script, aiSettings, territoryPtr);
if (script->functionTemp[0] == 12) {
npc->duration = 6;
}
break;
case 12:
N(func_80241618_BFEE98)(script, aiSettings, territoryPtr);
if (script->functionTemp[0] != 13) {
break;
}
case 13:
N(func_80241770_BFEFF0)(script, aiSettings, territoryPtr);
break;
case 14:
N(func_80241874_BFF0F4)(script, aiSettings, territoryPtr);
if (script->functionTemp[0] != 15) {
break;
}
case 15:
N(func_80241954_BFF1D4)(script, aiSettings, territoryPtr);
break;
case 16:
N(func_80241BF0_BFF470)(script, aiSettings, territoryPtr);
case 17:
N(func_80241CA8_BFF528)(script, aiSettings, territoryPtr);
break;
case 18:
N(func_80241E28_BFF6A8)(script, aiSettings, territoryPtr);
break;
case 20:
N(func_80241E70_BFF6F0)(script, aiSettings, territoryPtr);
break;
case 30:
N(func_80241EF0_BFF770)(script, aiSettings, territoryPtr);
case 31:
N(func_80241F98_BFF818)(script, aiSettings, territoryPtr);
}
return (script->functionTemp[0] == 100) * ApiStatus_DONE2;
}
#define AI_SENTINEL_FIRST_NPC 0
#define AI_SENTINEL_LAST_NPC 4
#include "world/common/enemy/SentinelAI.inc.c"
extern const char N(dgb_00_name_hack)[];
@ -826,7 +514,7 @@ EvtScript N(npcAI_80244D54) = {
EVT_CALL(SetSelfVar, 5, -650)
EVT_CALL(SetSelfVar, 6, 30)
EVT_CALL(SetSelfVar, 1, 600)
EVT_CALL(N(func_802422B0_BFFB30), EVT_PTR(N(npcAISettings_80244D24)))
EVT_CALL(N(SentinelAI_Main), EVT_PTR(N(npcAISettings_80244D24)))
EVT_CALL(DisablePlayerInput, TRUE)
EVT_WAIT_FRAMES(2)
EVT_LABEL(20)
@ -920,18 +608,18 @@ NpcSettings N(npcSettings_8024526C) = {
NpcAISettings N(npcAISettings_80245298) = {
.moveSpeed = 4.5f,
.alertRadius = 170.0f,
.unk_10 = { .f = 90.0f },
.unk_14 = 1,
.alertOffsetDist = 90.0f,
.playerSearchInterval = 1,
.chaseSpeed = 3.9f,
.unk_1C = { .s = 180 },
.unk_20 = 2,
.chaseTurnRate= 180,
.chaseUpdateInterval = 2,
.chaseRadius = 170.0f,
.unk_28 = { .f = 90.0f },
.unk_2C = 1,
.chaseOffsetDist = 90.0f,
.unk_AI_2C = 1,
};
EvtScript N(npcAI_802452C8) = {
EVT_CALL(N(UnkNpcAIMainFunc), EVT_PTR(N(npcAISettings_80245298)))
EVT_CALL(N(PatrolNoAttackAI_Main), EVT_PTR(N(npcAISettings_80245298)))
EVT_RETURN
EVT_END
};
@ -1033,7 +721,7 @@ EvtScript N(init_80245784) = {
const char N(dgb_00_name_hack)[] = "dgb_00";
#include "world/common/atomic/enemy/UnkAI_1.inc.c"
#include "world/common/enemy/PatrolNoAttackAI.inc.c"
#include "world/common/UnkFunc1.inc.c"
@ -1118,7 +806,7 @@ EvtScript N(idle_8024598C) = {
EVT_END_THREAD
EVT_CALL(SetNpcSpeed, NPC_SELF, EVT_FIXED(5.0))
EVT_CALL(NpcMoveTo, NPC_SELF, 259, 167, 0)
EVT_CALL(N(UnkNpcAIMainFunc), EVT_PTR(N(npcAISettings_80245298)))
EVT_CALL(N(PatrolNoAttackAI_Main), EVT_PTR(N(npcAISettings_80245298)))
EVT_RETURN
EVT_END
};
@ -1203,7 +891,7 @@ StaticNpc N(npcGroup_80246090) = {
.id = NPC_SENTINEL0,
.settings = &N(npcSettings_8024526C),
.pos = { -180.0f, 100.0f, 230.0f },
.flags = NPC_FLAG_LOCK_ANIMS | NPC_FLAG_NO_Y_MOVEMENT,
.flags = NPC_FLAG_LOCK_ANIMS | NPC_FLAG_JUMPING,
.init = &N(init_80245D80),
.yaw = 90,
.dropFlags = NPC_DROP_FLAGS_80,
@ -1234,7 +922,7 @@ StaticNpc N(npcGroup_80246280) = {
.id = NPC_SENTINEL1,
.settings = &N(npcSettings_8024526C),
.pos = { 180.0f, 100.0f, 230.0f },
.flags = NPC_FLAG_LOCK_ANIMS | NPC_FLAG_NO_Y_MOVEMENT,
.flags = NPC_FLAG_LOCK_ANIMS | NPC_FLAG_JUMPING,
.init = &N(init_80245E44),
.yaw = 270,
.dropFlags = NPC_DROP_FLAGS_80,
@ -1265,7 +953,7 @@ StaticNpc N(npcGroup_80246470) = {
.id = NPC_SENTINEL2,
.settings = &N(npcSettings_8024526C),
.pos = { -180.0f, 100.0f, -230.0f },
.flags = NPC_FLAG_LOCK_ANIMS | NPC_FLAG_NO_Y_MOVEMENT,
.flags = NPC_FLAG_LOCK_ANIMS | NPC_FLAG_JUMPING,
.init = &N(init_80245F08),
.yaw = 90,
.dropFlags = NPC_DROP_FLAGS_80,
@ -1296,7 +984,7 @@ StaticNpc N(npcGroup_80246660) = {
.id = NPC_SENTINEL3,
.settings = &N(npcSettings_8024526C),
.pos = { 180.0f, 100.0f, -230.0f },
.flags = NPC_FLAG_LOCK_ANIMS | NPC_FLAG_NO_Y_MOVEMENT,
.flags = NPC_FLAG_LOCK_ANIMS | NPC_FLAG_JUMPING,
.init = &N(init_80245FCC),
.yaw = 270,
.dropFlags = NPC_DROP_FLAGS_80,

View File

@ -22,8 +22,8 @@ ApiStatus N(func_80240000_BFD880)(void);
ApiStatus N(GetEntityPosition)(Evt* script, s32 isInitialCall);
ApiStatus N(SetEntityFlags100000)(Evt* script, s32 isInitialCall);
ApiStatus N(UnkFunc1)(Evt* script, s32 isInitialCall);
ApiStatus N(func_802422B0_BFFB30)(Evt* script, s32 isInitialCall);
ApiStatus N(UnkNpcAIMainFunc)(Evt* script, s32 isInitialCall);
ApiStatus N(SentinelAI_Main)(Evt* script, s32 isInitialCall);
ApiStatus N(PatrolNoAttackAI_Main)(Evt* script, s32 isInitialCall);
extern EvtScript N(802449C4);
extern EvtScript N(80244AD0);

View File

@ -2,8 +2,6 @@
#include "sprite/npc/world_clubba.h"
#include "message_ids.h"
extern Npc* wPartnerNpc;
enum {
NPC_WORLD_CLUBBA0 = 10,
NPC_WORLD_CLUBBA1,
@ -22,7 +20,7 @@ MapConfig N(config) = {
.main = &N(main),
.entryList = &N(entryList),
.entryCount = ENTRY_COUNT(N(entryList)),
.tattle = 0x1900C2,
.tattle = { 0x1900C2 },
};
EvtScript N(802414B0) = {
@ -196,14 +194,14 @@ NpcAISettings N(npcAISettings_80241B9C) = {
.moveTime = 120,
.waitTime = 30,
.alertRadius = 85.0f,
.unk_10 = { .f = 65.0f },
.unk_14 = 5,
.alertOffsetDist = 65.0f,
.playerSearchInterval = 5,
.chaseSpeed = 3.5f,
.unk_1C = { .s = 90 },
.unk_20 = 12,
.chaseTurnRate= 90,
.chaseUpdateInterval = 12,
.chaseRadius = 110.0f,
.unk_28 = { .f = 90.0f },
.unk_2C = 3,
.chaseOffsetDist = 90.0f,
.unk_AI_2C = 3,
};
EvtScript N(npcAI_80241BCC) = {
@ -211,7 +209,7 @@ EvtScript N(npcAI_80241BCC) = {
EVT_CALL(SetSelfVar, 1, 5)
EVT_CALL(SetSelfVar, 2, 8)
EVT_CALL(SetSelfVar, 3, 12)
EVT_CALL(N(func_8024061C_C2F1BC), EVT_PTR(N(npcAISettings_80241B9C)))
EVT_CALL(N(WanderMeleeAI_Main), EVT_PTR(N(npcAISettings_80241B9C)))
EVT_RETURN
EVT_END
};
@ -230,14 +228,14 @@ NpcAISettings N(npcAISettings_80241C68) = {
.moveTime = 120,
.waitTime = 30,
.alertRadius = 100.0f,
.unk_10 = { .f = 40.0f },
.unk_14 = 10,
.alertOffsetDist = 40.0f,
.playerSearchInterval = 10,
.chaseSpeed = 3.5f,
.unk_1C = { .s = 90 },
.unk_20 = 15,
.chaseTurnRate= 90,
.chaseUpdateInterval = 15,
.chaseRadius = 200.0f,
.unk_28 = { .f = 160.0f },
.unk_2C = 1,
.chaseOffsetDist = 160.0f,
.unk_AI_2C = 1,
};
EvtScript N(npcAI_80241C98) = {
@ -245,7 +243,7 @@ EvtScript N(npcAI_80241C98) = {
EVT_CALL(SetSelfVar, 1, 10)
EVT_CALL(SetSelfVar, 2, 14)
EVT_CALL(SetSelfVar, 3, 18)
EVT_CALL(N(func_802410D4_C2FC74), EVT_PTR(N(npcAISettings_80241C68)))
EVT_CALL(N(ClubbaNappingAI_Main), EVT_PTR(N(npcAISettings_80241C68)))
EVT_RETURN
EVT_END
};
@ -267,7 +265,7 @@ EvtScript N(npcAI_80241D34) = {
EVT_CALL(SetSelfVar, 3, 32)
EVT_CALL(SetSelfVar, 4, 3)
EVT_CALL(SetSelfVar, 15, 8389)
EVT_CALL(N(UnkFunc7))
EVT_CALL(N(MeleeHitbox_Main))
EVT_RETURN
EVT_END
};
@ -286,7 +284,7 @@ StaticNpc N(npcGroup_80241E08)[] = {
.id = NPC_WORLD_CLUBBA0,
.settings = &N(npcSettings_80241C3C),
.pos = { -200.0f, 0.0f, 180.0f },
.flags = NPC_FLAG_LOCK_ANIMS | NPC_FLAG_NO_Y_MOVEMENT,
.flags = NPC_FLAG_LOCK_ANIMS | NPC_FLAG_JUMPING,
.yaw = 270,
.dropFlags = NPC_DROP_FLAGS_80,
.itemDropChance = 5,
@ -323,7 +321,7 @@ StaticNpc N(npcGroup_80241E08)[] = {
.id = NPC_WORLD_CLUBBA1,
.settings = &N(npcSettings_80241DDC),
.pos = { 0.0f, -1000.0f, 0.0f },
.flags = NPC_FLAG_100 | NPC_FLAG_LOCK_ANIMS | NPC_FLAG_NO_Y_MOVEMENT | NPC_FLAG_NO_DROPS,
.flags = NPC_FLAG_100 | NPC_FLAG_LOCK_ANIMS | NPC_FLAG_JUMPING | NPC_FLAG_NO_DROPS,
.yaw = 0,
.dropFlags = NPC_DROP_FLAGS_80,
.heartDrops = NO_DROPS,
@ -355,7 +353,7 @@ StaticNpc N(npcGroup_802421E8)[] = {
.id = NPC_WORLD_CLUBBA2,
.settings = &N(npcSettings_80241D08),
.pos = { 375.0f, 0.0f, 100.0f },
.flags = NPC_FLAG_LOCK_ANIMS | NPC_FLAG_NO_Y_MOVEMENT,
.flags = NPC_FLAG_LOCK_ANIMS | NPC_FLAG_JUMPING,
.yaw = 270,
.dropFlags = NPC_DROP_FLAGS_80,
.itemDropChance = 5,
@ -391,7 +389,7 @@ StaticNpc N(npcGroup_802421E8)[] = {
.id = NPC_WORLD_CLUBBA3,
.settings = &N(npcSettings_80241DDC),
.pos = { 0.0f, -1000.0f, 0.0f },
.flags = NPC_FLAG_100 | NPC_FLAG_LOCK_ANIMS | NPC_FLAG_NO_Y_MOVEMENT | NPC_FLAG_NO_DROPS,
.flags = NPC_FLAG_100 | NPC_FLAG_LOCK_ANIMS | NPC_FLAG_JUMPING | NPC_FLAG_NO_DROPS,
.yaw = 0,
.dropFlags = NPC_DROP_FLAGS_80,
.heartDrops = NO_DROPS,
@ -424,380 +422,5 @@ NpcGroupList N(npcGroupList_802425C8) = {
{},
};
#include "world/common/UnkNpcAIFunc6.inc.c"
#include "world/common/UnkNpcAIFunc7.inc.c"
#include "world/common/UnkNpcAIFunc8.inc.c"
#include "world/common/UnkNpcAIFunc5.inc.c"
#include "world/common/UnkNpcAIFunc26.inc.c"
#include "world/common/UnkFunc7.inc.c"
ApiStatus N(func_8024061C_C2F1BC)(Evt* script, s32 isInitialCall) {
Enemy* enemy = script->owner1.enemy;
Npc* npc = get_npc_unsafe(enemy->npcID);
Bytecode* args = script->ptrReadPos;
EnemyTerritoryThing territory;
EnemyTerritoryThing* territoryPtr = &territory;
NpcAISettings* npcAISettings = (NpcAISettings*)evt_get_variable(script, *args++);
territory.unk_00 = 0;
territory.shape = enemy->territory->wander.detectShape;
territory.pointX = enemy->territory->wander.detect.x;
territory.pointZ = enemy->territory->wander.detect.z;
territory.sizeX = enemy->territory->wander.detectSizeX;
territory.sizeZ = enemy->territory->wander.detectSizeZ;
territory.unk_18 = 65.0f;
territory.unk_1C = 0;
if (isInitialCall || (enemy->unk_B0 & ENEMY_AI_FLAGS_4)) {
script->functionTemp[0] = 0;
npc->duration = 0;
npc->currentAnim.w = enemy->animList[0];
npc->flags &= ~0x800;
if (!enemy->territory->wander.isFlying) {
npc->flags = (npc->flags | 0x200) & ~0x8;
} else {
npc->flags = (npc->flags & ~0x200) | 0x8;
}
if (enemy->unk_B0 & ENEMY_AI_FLAGS_4) {
script->functionTemp[0] = 99;
script->functionTemp[1] = 0;
enemy->unk_B0 &= ~ENEMY_AI_FLAGS_4;
}
enemy->varTable[0] = 0;
}
if ((script->functionTemp[0] < 30) && (enemy->varTable[0] == 0) && N(UnkNpcAIFunc26)(script)) {
script->functionTemp[0] = 30;
}
switch (script->functionTemp[0]) {
case 0:
func_800495A0(script, npcAISettings, territoryPtr);
case 1:
func_800496B8(script, npcAISettings, territoryPtr);
break;
case 2:
base_UnkNpcAIFunc1(script, npcAISettings, territoryPtr);
case 3:
func_80049C04(script, npcAISettings, territoryPtr);
break;
case 10:
func_80049E3C(script, npcAISettings, territoryPtr);
case 11:
func_80049ECC(script, npcAISettings, territoryPtr);
break;
case 12:
func_80049F7C(script, npcAISettings, territoryPtr);
case 13:
func_8004A124(script, npcAISettings, territoryPtr);
break;
case 14:
func_8004A3E8(script, npcAISettings, territoryPtr);
break;
case 30:
N(UnkNpcAIFunc6)(script);
case 31:
N(UnkNpcAIFunc7)(script);
if (script->functionTemp[0] != 32) {
break;
}
case 32:
N(UnkNpcAIFunc8)(script);
if (script->functionTemp[0] != 33) {
break;
}
case 33:
N(UnkNpcAIFunc5)(script);
break;
case 99:
func_8004A73C(script);
}
return ApiStatus_BLOCK;
}
void N(func_802408D0_C2F470)(Evt* script, NpcAISettings* aiSettings, EnemyTerritoryThing* territory) {
Enemy* enemy = script->owner1.enemy;
Npc* npc = get_npc_unsafe(enemy->npcID);
if (npc->duration > 0) {
npc->duration--;
}
if (npc->duration == 1) {
npc->currentAnim.w = enemy->animList[12];
} else if (npc->duration <= 0) {
npc->currentAnim.w = enemy->animList[10];
npc->duration = 0;
script->functionTemp[0] = 1;
}
}
void N(func_80240958_C2F4F8)(Evt* script, NpcAISettings* aiSettings, EnemyTerritoryThing* territory) {
Enemy* enemy = script->owner1.enemy;
Npc* npc = get_npc_unsafe(enemy->npcID);
PlayerData* playerData = get_player_data();
s32 phi_s2 = FALSE;
s32 var;
f32 posX, posZ;
if (func_800490B4(territory, enemy, 80.0f, 0.0f, 0)) {
if ((gPlayerStatusPtr->actionState == 2) || (gPlayerStatusPtr->actionState == 26) ||
(gPlayerStatusPtr->actionState == 3) || (gPlayerStatusPtr->actionState == 14) ||
(gPlayerStatusPtr->actionState == 16) || (gPlayerStatusPtr->actionState == 11) ||
(gPlayerStatusPtr->actionState == 10) || (gPlayerStatusPtr->actionState == 18) ||
(gPlayerStatusPtr->actionState == 19) || (gPlayerStatusPtr->actionState == 37)) {
phi_s2 = TRUE;
}
if (playerData->currentPartner == PARTNER_KOOPER) {
if (gPartnerActionStatus.partnerActionState == PARTNER_ACTION_KOOPER_2) {
phi_s2 = TRUE;
}
}
}
if (((playerData->currentPartner == PARTNER_GOOMBARIO) && (gPartnerActionStatus.partnerActionState != PARTNER_ACTION_NONE)) ||
((playerData->currentPartner == PARTNER_BOMBETTE) && (gPartnerActionStatus.partnerActionState == PARTNER_ACTION_BOMBETTE_2))) {
posX = npc->pos.x;
posZ = npc->pos.z;
add_vec2D_polar(&posX, &posZ, 0.0f, npc->yaw);
if (dist2D(posX, posZ, wPartnerNpc->pos.x, wPartnerNpc->pos.z) <= 80.0f) {
phi_s2 = TRUE;
}
}
if (phi_s2) {
ai_enemy_play_sound(npc, 0xB000000E, 0);
npc->currentAnim.w = enemy->animList[11];
npc->duration = 10;
fx_emote(EMOTE_EXCLAMATION, npc, 0.0f, npc->collisionHeight, 1.0f, 2.0f, -20.0f, 15, &var);
ai_enemy_play_sound(npc, 0x2F4, 0x200000);
script->functionTemp[0] = 2;
}
npc->duration++;
if (npc->duration == 27) {
ai_enemy_play_sound(npc, 0xB000000C, 0);
} else if (npc->duration == 57) {
ai_enemy_play_sound(npc, 0xB000000D, 0);
} else if (npc->duration == 59) {
npc->currentAnim.w = enemy->animList[12];
} else if (npc->duration == 60) {
npc->currentAnim.w = enemy->animList[10];
npc->duration = 0;
}
}
void N(func_80240C10_C2F7B0)(Evt* script, NpcAISettings* aiSettings, EnemyTerritoryThing* territory) {
Enemy* enemy = script->owner1.enemy;
Npc* npc = get_npc_unsafe(enemy->npcID);
npc->duration--;
if (npc->duration <= 0) {
npc->duration = 1;
enemy->varTable[7] = 40;
script->functionTemp[0] = 3;
}
}
void N(func_80240C74_C2F814)(Evt* script, NpcAISettings* aiSettings, EnemyTerritoryThing* territory) {
Enemy* enemy = script->owner1.enemy;
Npc* npc = get_npc_unsafe(enemy->npcID);
npc->yaw = clamp_angle((npc->yaw + rand_int(180)) - 90.0f);
npc->currentAnim.w = enemy->animList[0];
script->functionTemp[1] = (rand_int(1000) % 2) + 2;
script->functionTemp[0] = 4;
}
void N(func_80240D1C_C2F8BC)(Evt* script, NpcAISettings* aiSettings, EnemyTerritoryThing* territory) {
Enemy* enemy = script->owner1.enemy;
Npc* npc = get_npc_unsafe(enemy->npcID);
s32 var;
if (func_800490B4(territory, enemy, aiSettings->chaseRadius, aiSettings->unk_28.f, 0)) {
npc->yaw = atan2(npc->pos.x, npc->pos.z, gPlayerStatusPtr->position.x, gPlayerStatusPtr->position.z);
script->functionTemp[0] = 12;
return;
}
npc->duration--;
if (npc->duration <= 0) {
script->functionTemp[1]--;
if (script->functionTemp[1] > 0) {
npc->yaw = clamp_angle(npc->yaw + 180.0f);
npc->duration = aiSettings->waitTime / 2 + rand_int(aiSettings->waitTime / 2 + 1);
return;
}
var = enemy->varTable[7];
if (var == 40) {
npc->duration = 20;
script->functionTemp[0] = var;
} else if (var == 50) {
npc->duration = 25;
script->functionTemp[0] = var;
}
}
}
void N(func_80240E54_C2F9F4)(Evt* script, NpcAISettings* aiSettings, EnemyTerritoryThing* territory) {
Enemy* enemy = script->owner1.enemy;
Npc* npc = get_npc_unsafe(enemy->npcID);
npc->duration--;
if (npc->duration <= 0) {
npc->currentAnim.w = enemy->animList[1];
if (enemy->territory->wander.moveSpeedOverride < 0) {
npc->moveSpeed = aiSettings->moveSpeed;
} else {
npc->moveSpeed = enemy->territory->wander.moveSpeedOverride / 32767.0;
}
script->functionTemp[0] = 0x29;
}
}
void N(func_80240F00_C2FAA0)(Evt* script, NpcAISettings* aiSettings, EnemyTerritoryThing* territory) {
Enemy* enemy = script->owner1.enemy;
Npc* npc = get_npc_unsafe(enemy->npcID);
f32 var;
if (func_800490B4(territory, enemy, aiSettings->chaseRadius, aiSettings->unk_28.f, 0)) {
npc->yaw = atan2(npc->pos.x, npc->pos.z, gPlayerStatusPtr->position.x, gPlayerStatusPtr->position.z);
script->functionTemp[0] = 12;
} else if (dist2D(npc->pos.x, npc->pos.z, enemy->territory->wander.point.x,
enemy->territory->wander.point.z) <= npc->moveSpeed) {
npc->currentAnim.w = enemy->animList[0];
npc->duration = 15;
enemy->varTable[7] = 50;
script->functionTemp[0] = 3;
} else if (npc->turnAroundYawAdjustment == 0) {
var = npc->yaw;
func_8004A784(npc, 5.0f, &var, 0, 0, 0);
npc->yaw = var;
npc->yaw = atan2(npc->pos.x, npc->pos.z, enemy->territory->wander.point.x, enemy->territory->wander.point.z);
npc_move_heading(npc, npc->moveSpeed, npc->yaw);
}
}
void N(func_80241078_C2FC18)(Evt* script, NpcAISettings* aiSettings, EnemyTerritoryThing* territory) {
Enemy* enemy = script->owner1.enemy;
Npc* npc = get_npc_unsafe(enemy->npcID);
if (npc->turnAroundYawAdjustment == 0) {
npc->duration--;
if (npc->duration <= 0) {
npc->duration = 0;
script->functionTemp[0] = 0;
}
}
}
ApiStatus N(func_802410D4_C2FC74)(Evt* script, s32 isInitialCall) {
Enemy* enemy = script->owner1.enemy;
Npc* npc = get_npc_unsafe(enemy->npcID);
Bytecode* args = script->ptrReadPos;
EnemyTerritoryThing territory;
EnemyTerritoryThing* territoryPtr = &territory;
NpcAISettings* npcAISettings = (NpcAISettings*)evt_get_variable(script, *args++);
territory.unk_00 = 0;
territory.shape = enemy->territory->wander.detectShape;
territory.pointX = enemy->territory->wander.detect.x;
territory.pointZ = enemy->territory->wander.detect.z;
territory.sizeX = enemy->territory->wander.detectSizeX;
territory.sizeZ = enemy->territory->wander.detectSizeZ;
territory.unk_18 = 40.0f;
territory.unk_1C = 0;
if (isInitialCall || (enemy->unk_B0 & ENEMY_AI_FLAGS_4)) {
script->functionTemp[0] = 0;
npc->duration = 30;
npc->currentAnim.w = enemy->animList[10];
npc->flags &= ~0x800;
enemy->varTable[0] = 0;
if (!enemy->territory->wander.isFlying) {
npc->flags = (npc->flags | 0x200) & ~0x8;
} else {
npc->flags = (npc->flags & ~0x200) | 0x8;
}
if (enemy->unk_B0 & ENEMY_AI_FLAGS_4) {
script->functionTemp[0] = 99;
script->functionTemp[1] = 40;
npc->currentAnim.w = enemy->animList[0];
}
enemy->unk_B0 &= ~ENEMY_AI_FLAGS_4;
}
if (((u32)script->functionTemp[0] - 10 < 20) && (enemy->varTable[0] == 0) && N(UnkNpcAIFunc26)(script)) {
script->functionTemp[0] = 30;
}
switch (script->functionTemp[0]) {
case 0:
N(func_802408D0_C2F470)(script, npcAISettings, territoryPtr);
break;
case 1:
N(func_80240958_C2F4F8)(script, npcAISettings, territoryPtr);
break;
case 2:
N(func_80240C10_C2F7B0)(script, npcAISettings, territoryPtr);
break;
case 3:
N(func_80240C74_C2F814)(script, npcAISettings, territoryPtr);
break;
case 4:
N(func_80240D1C_C2F8BC)(script, npcAISettings, territoryPtr);
break;
case 12:
func_80049F7C(script, npcAISettings, territoryPtr);
if (script->functionTemp[0] != 13) {
break;
}
case 13:
func_8004A124(script, npcAISettings, territoryPtr);
break;
case 14:
func_8004A3E8(script, npcAISettings, territoryPtr);
npc->duration = 15;
enemy->varTable[7] = 40;
script->functionTemp[0] = 3;
break;
case 30:
N(UnkNpcAIFunc6)(script);
if (script->functionTemp[0] != 31) {
break;
}
case 31:
N(UnkNpcAIFunc7)(script);
if (script->functionTemp[0] != 32) {
break;
}
case 32:
N(UnkNpcAIFunc8)(script);
break;
case 33:
N(UnkNpcAIFunc5)(script);
break;
case 40:
N(func_80240E54_C2F9F4)(script, npcAISettings, territoryPtr);
if (script->functionTemp[0] != 41) {
break;
}
case 41:
N(func_80240F00_C2FAA0)(script, npcAISettings, territoryPtr);
break;
case 50:
N(func_80241078_C2FC18)(script, npcAISettings, territoryPtr);
break;
case 99:
func_8004A73C(script);
}
return 0;
}
#include "world/common/enemy/WanderMeleeAI.inc.c"
#include "world/common/enemy/ClubbaNappingAI.inc.c"

View File

@ -6,9 +6,9 @@
#define NAMESPACE dgb_02
ApiStatus N(func_8024061C_C2F1BC)(Evt* script, s32 isInitialCall);
ApiStatus N(func_802410D4_C2FC74)(Evt* script, s32 isInitialCall);
ApiStatus N(UnkFunc7)(Evt *script, s32 isInitialCall);
ApiStatus N(WanderMeleeAI_Main)(Evt* script, s32 isInitialCall);
ApiStatus N(ClubbaNappingAI_Main)(Evt* script, s32 isInitialCall);
ApiStatus N(MeleeHitbox_Main)(Evt *script, s32 isInitialCall);
extern NpcGroupList N(npcGroupList_802425C8);
extern EvtScript N(main);

View File

@ -2,8 +2,6 @@
#include "sprite/npc/world_clubba.h"
#include "message_ids.h"
extern Npc* wPartnerNpc;
enum {
NPC_WORLD_CLUBBA0,
NPC_WORLD_CLUBBA1,
@ -425,14 +423,14 @@ NpcAISettings N(npcAISettings_80243A5C) = {
.moveTime = 120,
.waitTime = 30,
.alertRadius = 85.0f,
.unk_10 = { .f = 65.0f },
.unk_14 = 5,
.alertOffsetDist = 65.0f,
.playerSearchInterval = 5,
.chaseSpeed = 3.5f,
.unk_1C = { .s = 90 },
.unk_20 = 12,
.chaseTurnRate= 90,
.chaseUpdateInterval = 12,
.chaseRadius = 110.0f,
.unk_28 = { .f = 90.0f },
.unk_2C = 3,
.chaseOffsetDist = 90.0f,
.unk_AI_2C = 3,
};
EvtScript N(npcAI_80243A8C) = {
@ -440,7 +438,7 @@ EvtScript N(npcAI_80243A8C) = {
EVT_CALL(SetSelfVar, 1, 5)
EVT_CALL(SetSelfVar, 2, 8)
EVT_CALL(SetSelfVar, 3, 12)
EVT_CALL(N(func_8024086C_C31D4C), EVT_PTR(N(npcAISettings_80243A5C)))
EVT_CALL(N(WanderMeleeAI_Main), EVT_PTR(N(npcAISettings_80243A5C)))
EVT_RETURN
EVT_END
};
@ -459,14 +457,14 @@ NpcAISettings N(npcAISettings_80243B28) = {
.moveTime = 20,
.waitTime = 30,
.alertRadius = 85.0f,
.unk_10 = { .f = 65.0f },
.unk_14 = 5,
.alertOffsetDist = 65.0f,
.playerSearchInterval = 5,
.chaseSpeed = 3.5f,
.unk_1C = { .s = 90 },
.unk_20 = 12,
.chaseTurnRate= 90,
.chaseUpdateInterval = 12,
.chaseRadius = 110.0f,
.unk_28 = { .f = 90.0f },
.unk_2C = 3,
.chaseOffsetDist = 90.0f,
.unk_AI_2C = 3,
};
EvtScript N(npcAI_80243B58) = {
@ -474,7 +472,7 @@ EvtScript N(npcAI_80243B58) = {
EVT_CALL(SetSelfVar, 1, 5)
EVT_CALL(SetSelfVar, 2, 8)
EVT_CALL(SetSelfVar, 3, 12)
EVT_CALL(N(func_802419B0_C32E90), EVT_PTR(N(npcAISettings_80243B28)))
EVT_CALL(N(ClubbaPatrolAI_Main), EVT_PTR(N(npcAISettings_80243B28)))
EVT_RETURN
EVT_END
};
@ -493,14 +491,14 @@ NpcAISettings N(npcAISettings_80243BF4) = {
.moveTime = 120,
.waitTime = 30,
.alertRadius = 100.0f,
.unk_10 = { .f = 40.0f },
.unk_14 = 10,
.alertOffsetDist = 40.0f,
.playerSearchInterval = 10,
.chaseSpeed = 3.5f,
.unk_1C = { .s = 90 },
.unk_20 = 15,
.chaseTurnRate= 90,
.chaseUpdateInterval = 15,
.chaseRadius = 200.0f,
.unk_28 = { .f = 160.0f },
.unk_2C = 1,
.chaseOffsetDist = 160.0f,
.unk_AI_2C = 1,
};
EvtScript N(npcAI_80243C24) = {
@ -508,7 +506,7 @@ EvtScript N(npcAI_80243C24) = {
EVT_CALL(SetSelfVar, 1, 10)
EVT_CALL(SetSelfVar, 2, 14)
EVT_CALL(SetSelfVar, 3, 18)
EVT_CALL(N(func_80242480_C33960), EVT_PTR(N(npcAISettings_80243BF4)))
EVT_CALL(N(ClubbaNappingAI_Main), EVT_PTR(N(npcAISettings_80243BF4)))
EVT_RETURN
EVT_END
};
@ -530,7 +528,7 @@ EvtScript N(npcAI_80243CC0) = {
EVT_CALL(SetSelfVar, 3, 32)
EVT_CALL(SetSelfVar, 4, 3)
EVT_CALL(SetSelfVar, 15, 8389)
EVT_CALL(N(UnkFunc7))
EVT_CALL(N(MeleeHitbox_Main))
EVT_RETURN
EVT_END
};
@ -558,7 +556,7 @@ StaticNpc N(npcGroup_80243DE8)[] = {
.id = NPC_WORLD_CLUBBA0,
.settings = &N(npcSettings_80243AFC),
.pos = { 180.0f, 0.0f, -122.0f },
.flags = NPC_FLAG_LOCK_ANIMS | NPC_FLAG_NO_Y_MOVEMENT,
.flags = NPC_FLAG_LOCK_ANIMS | NPC_FLAG_JUMPING,
.yaw = 270,
.dropFlags = NPC_DROP_FLAGS_80,
.itemDropChance = 5,
@ -594,7 +592,7 @@ StaticNpc N(npcGroup_80243DE8)[] = {
.id = NPC_WORLD_CLUBBA1,
.settings = &N(npcSettings_80243D68),
.pos = { 0.0f, -1000.0f, 0.0f },
.flags = NPC_FLAG_100 | NPC_FLAG_LOCK_ANIMS | NPC_FLAG_NO_Y_MOVEMENT | NPC_FLAG_NO_DROPS,
.flags = NPC_FLAG_100 | NPC_FLAG_LOCK_ANIMS | NPC_FLAG_JUMPING | NPC_FLAG_NO_DROPS,
.yaw = 0,
.dropFlags = NPC_DROP_FLAGS_80,
.heartDrops = NO_DROPS,
@ -626,7 +624,7 @@ StaticNpc N(npcGroup_802441C8)[] = {
.id = NPC_WORLD_CLUBBA2,
.settings = &N(npcSettings_80243BC8),
.pos = { -272.0f, 0.0f, -135.0f },
.flags = NPC_FLAG_LOCK_ANIMS | NPC_FLAG_NO_Y_MOVEMENT,
.flags = NPC_FLAG_LOCK_ANIMS | NPC_FLAG_JUMPING,
.yaw = 270,
.dropFlags = NPC_DROP_FLAGS_80,
.itemDropChance = 5,
@ -662,7 +660,7 @@ StaticNpc N(npcGroup_802441C8)[] = {
.id = NPC_WORLD_CLUBBA3,
.settings = &N(npcSettings_80243D68),
.pos = { 0.0f, -1000.0f, 0.0f },
.flags = NPC_FLAG_100 | NPC_FLAG_LOCK_ANIMS | NPC_FLAG_NO_Y_MOVEMENT | NPC_FLAG_NO_DROPS,
.flags = NPC_FLAG_100 | NPC_FLAG_LOCK_ANIMS | NPC_FLAG_JUMPING | NPC_FLAG_NO_DROPS,
.yaw = 0,
.dropFlags = NPC_DROP_FLAGS_80,
.heartDrops = NO_DROPS,
@ -694,7 +692,7 @@ StaticNpc N(npcGroup_802445A8)[] = {
.id = NPC_WORLD_CLUBBA4,
.settings = &N(npcSettings_80243C94),
.pos = { -326.0f, 210.0f, 80.0f },
.flags = NPC_FLAG_LOCK_ANIMS | NPC_FLAG_NO_Y_MOVEMENT,
.flags = NPC_FLAG_LOCK_ANIMS | NPC_FLAG_JUMPING,
.init = &N(init_80243D94),
.yaw = 90,
.dropFlags = NPC_DROP_FLAGS_80,
@ -731,7 +729,7 @@ StaticNpc N(npcGroup_802445A8)[] = {
.id = NPC_WORLD_CLUBBA5,
.settings = &N(npcSettings_80243D68),
.pos = { 0.0f, -1000.0f, 0.0f },
.flags = NPC_FLAG_100 | NPC_FLAG_LOCK_ANIMS | NPC_FLAG_NO_Y_MOVEMENT | NPC_FLAG_NO_DROPS,
.flags = NPC_FLAG_100 | NPC_FLAG_LOCK_ANIMS | NPC_FLAG_JUMPING | NPC_FLAG_NO_DROPS,
.yaw = 0,
.dropFlags = NPC_DROP_FLAGS_80,
.heartDrops = NO_DROPS,
@ -765,471 +763,10 @@ NpcGroupList N(npcGroupList_80244988) = {
{},
};
#include "world/common/UnkNpcAIFunc6.inc.c"
#include "world/common/enemy/WanderMeleeAI.inc.c"
#include "world/common/UnkNpcAIFunc7.inc.c"
#include "world/common/enemy/PatrolNoAttackAI.inc.c"
#include "world/common/UnkNpcAIFunc8.inc.c"
#include "world/common/enemy/ClubbaPatrolAI.inc.c"
#include "world/common/UnkNpcAIFunc5.inc.c"
#include "world/common/UnkNpcAIFunc26.inc.c"
#include "world/common/UnkFunc7.inc.c"
ApiStatus N(func_8024086C_C31D4C)(Evt* script, s32 isInitialCall) {
Enemy* enemy = script->owner1.enemy;
Npc* npc = get_npc_unsafe(enemy->npcID);
Bytecode* args = script->ptrReadPos;
EnemyTerritoryThing territory;
EnemyTerritoryThing* territoryPtr = &territory;
NpcAISettings* npcAISettings = (NpcAISettings*)evt_get_variable(script, *args++);
territory.unk_00 = 0;
territory.shape = enemy->territory->wander.detectShape;
territory.pointX = enemy->territory->wander.detect.x;
territory.pointZ = enemy->territory->wander.detect.z;
territory.sizeX = enemy->territory->wander.detectSizeX;
territory.sizeZ = enemy->territory->wander.detectSizeZ;
territory.unk_18 = 65.0f;
territory.unk_1C = 0;
if (isInitialCall || (enemy->unk_B0 & ENEMY_AI_FLAGS_4)) {
script->functionTemp[0] = 0;
npc->duration = 0;
npc->currentAnim.w = enemy->animList[0];
npc->flags &= ~0x800;
if (!enemy->territory->wander.isFlying) {
npc->flags = (npc->flags | 0x200) & ~0x8;
} else {
npc->flags = (npc->flags & ~0x200) | 0x8;
}
if (enemy->unk_B0 & ENEMY_AI_FLAGS_4) {
script->functionTemp[0] = 99;
script->functionTemp[1] = 0;
enemy->unk_B0 &= ~ENEMY_AI_FLAGS_4;
}
enemy->varTable[0] = 0;
}
if ((script->functionTemp[0] < 30) && (enemy->varTable[0] == 0) && N(UnkNpcAIFunc26)(script)) {
script->functionTemp[0] = 30;
}
switch (script->functionTemp[0]) {
case 0:
func_800495A0(script, npcAISettings, territoryPtr);
case 1:
func_800496B8(script, npcAISettings, territoryPtr);
break;
case 2:
base_UnkNpcAIFunc1(script, npcAISettings, territoryPtr);
case 3:
func_80049C04(script, npcAISettings, territoryPtr);
break;
case 10:
func_80049E3C(script, npcAISettings, territoryPtr);
case 11:
func_80049ECC(script, npcAISettings, territoryPtr);
break;
case 12:
func_80049F7C(script, npcAISettings, territoryPtr);
case 13:
func_8004A124(script, npcAISettings, territoryPtr);
break;
case 14:
func_8004A3E8(script, npcAISettings, territoryPtr);
break;
case 30:
N(UnkNpcAIFunc6)(script);
case 31:
N(UnkNpcAIFunc7)(script);
if (script->functionTemp[0] != 32) {
break;
}
case 32:
N(UnkNpcAIFunc8)(script);
if (script->functionTemp[0] != 33) {
break;
}
case 33:
N(UnkNpcAIFunc5)(script);
break;
case 99:
func_8004A73C(script);
}
return ApiStatus_BLOCK;
}
#include "world/common/atomic/enemy/UnkAI_1.inc.c"
ApiStatus N(func_802419B0_C32E90)(Evt* script, s32 isInitialCall) {
Enemy* enemy = script->owner1.enemy;
Npc* npc = get_npc_unsafe(enemy->npcID);
Bytecode* args = script->ptrReadPos;
EnemyTerritoryThing territory;
EnemyTerritoryThing* territoryPtr = &territory;
NpcAISettings* npcAISettings = (NpcAISettings*)evt_get_variable(script, *args++);
territory.unk_00 = 0;
territory.shape = enemy->territory->patrol.detectShape;
territory.pointX = enemy->territory->patrol.detect.x;
territory.pointZ = enemy->territory->patrol.detect.z;
territory.sizeX = enemy->territory->patrol.detectSizeX;
territory.sizeZ = enemy->territory->patrol.detectSizeZ;
territory.unk_18 = 65.0f;
territory.unk_1C = 0;
if (isInitialCall || (enemy->unk_B0 & ENEMY_AI_FLAGS_4)) {
script->functionTemp[0] = 0;
npc->duration = 0;
npc->currentAnim.w = enemy->animList[0];
npc->flags &= ~0x800;
if (!enemy->territory->patrol.isFlying) {
npc->flags = (npc->flags | 0x200) & ~0x8;
} else {
npc->flags = (npc->flags & ~0x200) | 0x8;
}
if (enemy->unk_B0 & ENEMY_AI_FLAGS_4) {
script->functionTemp[0] = 99;
script->functionTemp[1] = 0;
enemy->unk_B0 &= ~ENEMY_AI_FLAGS_4;
}
enemy->varTable[0] = 0;
}
if ((script->functionTemp[0] < 30) && (enemy->varTable[0] == 0) && N(UnkNpcAIFunc26)(script)) {
script->functionTemp[0] = 30;
}
switch (script->functionTemp[0]) {
case 0:
N(UnkNpcAIFunc24)(script, npcAISettings, territoryPtr);
case 1:
N(UnkFunc13)(script, npcAISettings, territoryPtr);
break;
case 2:
N(UnkNpcAIFunc1)(script, npcAISettings, territoryPtr);
case 3:
N(UnkFunc14)(script, npcAISettings, territoryPtr);
break;
case 4:
N(UnkNpcAIFunc25)(script, npcAISettings, territoryPtr);
break;
case 10:
N(NpcJumpFunc2)(script, npcAISettings, territoryPtr);
case 11:
N(NpcJumpFunc)(script, npcAISettings, territoryPtr);
break;
case 12:
N(UnkNpcAIFunc13)(script, npcAISettings, territoryPtr);
case 13:
N(UnkFunc15)(script, npcAISettings, territoryPtr);
break;
case 14:
N(UnkNpcDurationFlagFunc)(script, npcAISettings, territoryPtr);
break;
case 30:
N(UnkNpcAIFunc6)(script);
case 31:
N(UnkNpcAIFunc7)(script);
if (script->functionTemp[0] != 32) {
break;
}
case 32:
N(UnkNpcAIFunc8)(script);
if (script->functionTemp[0] != 33) {
break;
}
case 33:
N(UnkNpcAIFunc5)(script);
break;
case 99:
func_8004A73C(script);
}
return ApiStatus_BLOCK;
}
void N(func_80241C7C_C3315C)(Evt* script, NpcAISettings* aiSettings, EnemyTerritoryThing* territory) {
Enemy* enemy = script->owner1.enemy;
Npc* npc = get_npc_unsafe(enemy->npcID);
if (npc->duration > 0) {
npc->duration--;
}
if (npc->duration == 1) {
npc->currentAnim.w = enemy->animList[12];
} else if (npc->duration <= 0) {
npc->currentAnim.w = enemy->animList[10];
npc->duration = 0;
script->functionTemp[0] = 1;
}
}
void N(func_80241D04_C331E4)(Evt* script, NpcAISettings* aiSettings, EnemyTerritoryThing* territory) {
Enemy* enemy = script->owner1.enemy;
Npc* npc = get_npc_unsafe(enemy->npcID);
PlayerData* playerData = get_player_data();
s32 phi_s2 = FALSE;
s32 var;
f32 posX, posZ;
if (func_800490B4(territory, enemy, 80.0f, 0.0f, 0)) {
if ((gPlayerStatusPtr->actionState == 2) || (gPlayerStatusPtr->actionState == 26) ||
(gPlayerStatusPtr->actionState == 3) || (gPlayerStatusPtr->actionState == 14) ||
(gPlayerStatusPtr->actionState == 16) || (gPlayerStatusPtr->actionState == 11) ||
(gPlayerStatusPtr->actionState == 10) || (gPlayerStatusPtr->actionState == 18) ||
(gPlayerStatusPtr->actionState == 19) || (gPlayerStatusPtr->actionState == 37)) {
phi_s2 = TRUE;
}
if (playerData->currentPartner == PARTNER_KOOPER) {
if (gPartnerActionStatus.partnerActionState == playerData->currentPartner) {
phi_s2 = TRUE;
}
}
}
if (((playerData->currentPartner == PARTNER_GOOMBARIO) && (gPartnerActionStatus.partnerActionState != PARTNER_ACTION_NONE)) ||
((playerData->currentPartner == PARTNER_BOMBETTE) && (gPartnerActionStatus.partnerActionState == PARTNER_ACTION_BOMBETTE_2))) {
posX = npc->pos.x;
posZ = npc->pos.z;
add_vec2D_polar(&posX, &posZ, 0.0f, npc->yaw);
if (dist2D(posX, posZ, wPartnerNpc->pos.x, wPartnerNpc->pos.z) <= 80.0f) {
phi_s2 = TRUE;
}
}
if (phi_s2) {
ai_enemy_play_sound(npc, 0xB000000E, 0);
npc->currentAnim.w = enemy->animList[11];
npc->duration = 10;
fx_emote(EMOTE_EXCLAMATION, npc, 0.0f, npc->collisionHeight, 1.0f, 2.0f, -20.0f, 15, &var);
ai_enemy_play_sound(npc, 0x2F4, 0x200000);
script->functionTemp[0] = 2;
}
npc->duration++;
if (npc->duration == 27) {
ai_enemy_play_sound(npc, 0xB000000C, 0);
} else if (npc->duration == 57) {
ai_enemy_play_sound(npc, 0xB000000D, 0);
} else if (npc->duration == 59) {
npc->currentAnim.w = enemy->animList[12];
} else if (npc->duration == 60) {
npc->currentAnim.w = enemy->animList[10];
npc->duration = 0;
}
}
void N(func_80241FBC_C3349C)(Evt* script, NpcAISettings* aiSettings, EnemyTerritoryThing* territory) {
Enemy* enemy = script->owner1.enemy;
Npc* npc = get_npc_unsafe(enemy->npcID);
npc->duration--;
if (npc->duration <= 0) {
npc->duration = 1;
enemy->varTable[7] = 40;
script->functionTemp[0] = 3;
}
}
void N(func_80242020_C33500)(Evt* script, NpcAISettings* aiSettings, EnemyTerritoryThing* territory) {
Enemy* enemy = script->owner1.enemy;
Npc* npc = get_npc_unsafe(enemy->npcID);
npc->yaw = clamp_angle((npc->yaw + rand_int(180)) - 90.0f);
npc->currentAnim.w = enemy->animList[0];
script->functionTemp[1] = (rand_int(1000) % 2) + 2;
script->functionTemp[0] = 4;
}
void N(func_802420C8_C335A8)(Evt* script, NpcAISettings* aiSettings, EnemyTerritoryThing* territory) {
Enemy* enemy = script->owner1.enemy;
Npc* npc = get_npc_unsafe(enemy->npcID);
s32 var;
if (func_800490B4(territory, enemy, aiSettings->chaseRadius, aiSettings->unk_28.f, 0)) {
npc->yaw = atan2(npc->pos.x, npc->pos.z, gPlayerStatusPtr->position.x, gPlayerStatusPtr->position.z);
script->functionTemp[0] = 12;
return;
}
npc->duration--;
if (npc->duration <= 0) {
script->functionTemp[1]--;
if (script->functionTemp[1] > 0) {
npc->yaw = clamp_angle(npc->yaw + 180.0f);
npc->duration = aiSettings->waitTime / 2 + rand_int(aiSettings->waitTime / 2 + 1);
return;
}
var = enemy->varTable[7];
if (var == 40) {
npc->duration = 20;
script->functionTemp[0] = var;
} else if (var == 50) {
npc->duration = 25;
script->functionTemp[0] = var;
}
}
}
void N(func_80242200_C336E0)(Evt* script, NpcAISettings* aiSettings, EnemyTerritoryThing* territory) {
Enemy* enemy = script->owner1.enemy;
Npc* npc = get_npc_unsafe(enemy->npcID);
npc->duration--;
if (npc->duration <= 0) {
npc->currentAnim.w = enemy->animList[1];
if (enemy->territory->wander.moveSpeedOverride < 0) {
npc->moveSpeed = aiSettings->moveSpeed;
} else {
npc->moveSpeed = enemy->territory->wander.moveSpeedOverride / 32767.0;
}
script->functionTemp[0] = 0x29;
}
}
void N(func_802422AC_C3378C)(Evt* script, NpcAISettings* aiSettings, EnemyTerritoryThing* territory) {
Enemy* enemy = script->owner1.enemy;
Npc* npc = get_npc_unsafe(enemy->npcID);
f32 var;
if (func_800490B4(territory, enemy, aiSettings->chaseRadius, aiSettings->unk_28.f, 0)) {
npc->yaw = atan2(npc->pos.x, npc->pos.z, gPlayerStatusPtr->position.x, gPlayerStatusPtr->position.z);
script->functionTemp[0] = 12;
} else if (dist2D(npc->pos.x, npc->pos.z, enemy->territory->wander.point.x,
enemy->territory->wander.point.z) <= npc->moveSpeed) {
npc->currentAnim.w = enemy->animList[0];
npc->duration = 15;
enemy->varTable[7] = 50;
script->functionTemp[0] = 3;
} else if (npc->turnAroundYawAdjustment == 0) {
var = npc->yaw;
func_8004A784(npc, 5.0f, &var, 0, 0, 0);
npc->yaw = var;
npc->yaw = atan2(npc->pos.x, npc->pos.z, enemy->territory->wander.point.x, enemy->territory->wander.point.z);
npc_move_heading(npc, npc->moveSpeed, npc->yaw);
}
}
void N(func_80242424_C33904)(Evt* script, NpcAISettings* aiSettings, EnemyTerritoryThing* territory) {
Enemy* enemy = script->owner1.enemy;
Npc* npc = get_npc_unsafe(enemy->npcID);
if (npc->turnAroundYawAdjustment == 0) {
npc->duration--;
if (npc->duration <= 0) {
npc->duration = 0;
script->functionTemp[0] = 0;
}
}
}
ApiStatus N(func_80242480_C33960)(Evt* script, s32 isInitialCall) {
Enemy* enemy = script->owner1.enemy;
Npc* npc = get_npc_unsafe(enemy->npcID);
Bytecode* args = script->ptrReadPos;
EnemyTerritoryThing territory;
EnemyTerritoryThing* territoryPtr = &territory;
NpcAISettings* npcAISettings = (NpcAISettings*)evt_get_variable(script, *args++);
territory.unk_00 = 0;
territory.shape = enemy->territory->wander.detectShape;
territory.pointX = enemy->territory->wander.detect.x;
territory.pointZ = enemy->territory->wander.detect.z;
territory.sizeX = enemy->territory->wander.detectSizeX;
territory.sizeZ = enemy->territory->wander.detectSizeZ;
territory.unk_18 = 40.0f;
territory.unk_1C = 0;
if (isInitialCall || (enemy->unk_B0 & ENEMY_AI_FLAGS_4)) {
script->functionTemp[0] = 0;
npc->duration = 30;
npc->currentAnim.w = enemy->animList[10];
npc->flags &= ~0x800;
enemy->varTable[0] = 0;
if (!enemy->territory->wander.isFlying) {
npc->flags = (npc->flags | 0x200) & ~0x8;
} else {
npc->flags = (npc->flags & ~0x200) | 0x8;
}
if (enemy->unk_B0 & ENEMY_AI_FLAGS_4) {
script->functionTemp[0] = 99;
script->functionTemp[1] = 40;
npc->currentAnim.w = enemy->animList[0];
}
enemy->unk_B0 &= ~ENEMY_AI_FLAGS_4;
}
if (((u32)script->functionTemp[0] - 10 < 20) && (enemy->varTable[0] == 0) && N(UnkNpcAIFunc26)(script)) {
script->functionTemp[0] = 30;
}
switch (script->functionTemp[0]) {
case 0:
N(func_80241C7C_C3315C)(script, npcAISettings, territoryPtr);
break;
case 1:
N(func_80241D04_C331E4)(script, npcAISettings, territoryPtr);
break;
case 2:
N(func_80241FBC_C3349C)(script, npcAISettings, territoryPtr);
break;
case 3:
N(func_80242020_C33500)(script, npcAISettings, territoryPtr);
break;
case 4:
N(func_802420C8_C335A8)(script, npcAISettings, territoryPtr);
break;
case 12:
func_80049F7C(script, npcAISettings, territoryPtr);
if (script->functionTemp[0] != 13) {
break;
}
case 13:
func_8004A124(script, npcAISettings, territoryPtr);
break;
case 14:
func_8004A3E8(script, npcAISettings, territoryPtr);
npc->duration = 15;
enemy->varTable[7] = 40;
script->functionTemp[0] = 3;
break;
case 30:
N(UnkNpcAIFunc6)(script);
if (script->functionTemp[0] != 31) {
break;
}
case 31:
N(UnkNpcAIFunc7)(script);
if (script->functionTemp[0] != 32) {
break;
}
case 32:
N(UnkNpcAIFunc8)(script);
break;
case 33:
N(UnkNpcAIFunc5)(script);
break;
case 40:
N(func_80242200_C336E0)(script, npcAISettings, territoryPtr);
if (script->functionTemp[0] != 41) {
break;
}
case 41:
N(func_802422AC_C3378C)(script, npcAISettings, territoryPtr);
break;
case 50:
N(func_80242424_C33904)(script, npcAISettings, territoryPtr);
break;
case 99:
func_8004A73C(script);
}
return ApiStatus_BLOCK;
}
#include "world/common/enemy/ClubbaNappingAI.inc.c"

View File

@ -8,10 +8,10 @@
ApiStatus N(UnkFunc11)(Evt* script, s32 isInitialCall);
ApiStatus N(UnkFunc12)(Evt* script, s32 isInitialCall);
ApiStatus N(UnkFunc7)(Evt* script, s32 isInitialCall);
ApiStatus N(func_8024086C_C31D4C)(Evt* script, s32 isInitialCall);
ApiStatus N(func_802419B0_C32E90)(Evt* script, s32 isInitialCall);
ApiStatus N(func_80242480_C33960)(Evt* script, s32 isInitialCall);
ApiStatus N(MeleeHitbox_Main)(Evt* script, s32 isInitialCall);
ApiStatus N(WanderMeleeAI_Main)(Evt* script, s32 isInitialCall);
ApiStatus N(ClubbaPatrolAI_Main)(Evt* script, s32 isInitialCall);
ApiStatus N(ClubbaNappingAI_Main)(Evt* script, s32 isInitialCall);
ApiStatus N(SetEntityFlags100000)(Evt* script, s32 isInitialCall);
ApiStatus N(GetEntityPosition)(Evt* script, s32 isInitialCall);

View File

@ -110,14 +110,14 @@ static s32 N(pad_3558)[] = {
0x00000000, 0x00000000,
};
f32 N(sixFloats)[] = {
f32 N(FlyingAI_JumpVels)[] = {
4.5f, 3.5f, 2.6f, 2.0f,
1.5f, 20.0f,
};
EvtScript N(80243578) = {
EVT_CALL(SetSelfEnemyFlagBits, ((NPC_FLAG_MOTION_BLUR | NPC_FLAG_1000000 | NPC_FLAG_SIMPLIFIED_PHYSICS | NPC_FLAG_PARTICLE | NPC_FLAG_8000000 | NPC_FLAG_10000000 | NPC_FLAG_20000000)), TRUE)
EVT_CALL(SetNpcFlagBits, NPC_SELF, ((NPC_FLAG_100 | NPC_FLAG_LOCK_ANIMS | NPC_FLAG_NO_Y_MOVEMENT)), TRUE)
EVT_CALL(SetNpcFlagBits, NPC_SELF, ((NPC_FLAG_100 | NPC_FLAG_LOCK_ANIMS | NPC_FLAG_JUMPING)), TRUE)
EVT_RETURN
EVT_END
};
@ -127,12 +127,12 @@ NpcAISettings N(npcAISettings_802435B4) = {
.moveTime = 90,
.waitTime = 30,
.alertRadius = 240.0f,
.unk_14 = 1,
.playerSearchInterval = 1,
.chaseSpeed = 5.3f,
.unk_1C = { .s = 180 },
.unk_20 = 1,
.chaseTurnRate= 180,
.chaseUpdateInterval = 1,
.chaseRadius = 240.0f,
.unk_2C = 1,
.unk_AI_2C = 1,
};
extern const char N(dgb_00_name_hack)[];
@ -142,7 +142,7 @@ EvtScript N(npcAI_802435E4) = {
EVT_CALL(SetSelfVar, 5, -650)
EVT_CALL(SetSelfVar, 6, 30)
EVT_CALL(SetSelfVar, 1, 600)
EVT_CALL(N(func_80242154_C38684), EVT_PTR(N(npcAISettings_802435B4)))
EVT_CALL(N(SentinelAI_Main), EVT_PTR(N(npcAISettings_802435B4)))
EVT_CALL(DisablePlayerInput, TRUE)
EVT_WAIT_FRAMES(2)
EVT_LABEL(20)
@ -237,7 +237,7 @@ StaticNpc N(npcGroup_80243B28) = {
.id = NPC_SENTINEL,
.settings = &N(npcSettings_80243AFC),
.pos = { 70.0f, -220.0f, 186.0f },
.flags = NPC_FLAG_LOCK_ANIMS | NPC_FLAG_NO_Y_MOVEMENT,
.flags = NPC_FLAG_LOCK_ANIMS | NPC_FLAG_JUMPING,
.yaw = 90,
.dropFlags = NPC_DROP_FLAGS_80,
.heartDrops = NO_DROPS,
@ -280,312 +280,9 @@ EvtScript N(makeEntities) = {
EVT_END
};
#include "world/common/atomic/enemy/UnkAI_9.inc.c"
void N(func_802414F8_C37A28)(Evt* script, NpcAISettings* aiSettings, EnemyTerritoryThing* territory) {
Enemy* enemy = script->owner1.enemy;
Npc* npc = get_npc_unsafe(enemy->npcID);
f32 temp_f0;
f32 phi_f20;
npc->duration--;
if (npc->duration <= 0) {
npc->flags &= ~0x00200000;
npc->duration = aiSettings->unk_20 / 2 + rand_int(aiSettings->unk_20 / 2 + 1);
npc->currentAnim.w = enemy->animList[8];
npc->moveSpeed = aiSettings->chaseSpeed;
phi_f20 = atan2(npc->pos.x, npc->pos.z, gPlayerStatusPtr->position.x, gPlayerStatusPtr->position.z);
temp_f0 = get_clamped_angle_diff(npc->yaw, phi_f20);
if (aiSettings->unk_1C.s < fabsf(temp_f0)) {
phi_f20 = npc->yaw;
if (temp_f0 < 0.0f) {
phi_f20 += -aiSettings->unk_1C.s;
} else {
phi_f20 += aiSettings->unk_1C.s;
}
}
npc->yaw = clamp_angle(phi_f20);
script->functionTemp[0] = 13;
}
}
void N(func_80241650_C37B80)(Evt* script, NpcAISettings* aiSettings, EnemyTerritoryThing* territory) {
Enemy* enemy = script->owner1.enemy;
Npc* npc = get_npc_unsafe(enemy->npcID);
if (func_800490B4(territory, enemy, aiSettings->chaseRadius, aiSettings->unk_28.f, 1)) {
npc_move_heading(npc, npc->moveSpeed, npc->yaw);
if (dist2D(npc->pos.x, npc->pos.z, gPlayerStatusPtr->position.x,
gPlayerStatusPtr->position.z) <= (npc->moveSpeed * 2.5)) {
npc->duration = 0;
script->functionTemp[0] = 14;
} else {
npc->duration--;
if (npc->duration <= 0) {
npc->flags |= 0x200000;
script->functionTemp[0] = 12;
}
}
} else {
script->functionTemp[0] = 16;
}
}
void N(func_80241754_C37C84)(Evt* script, NpcAISettings* aiSettings, EnemyTerritoryThing* territory) {
Enemy* enemy = script->owner1.enemy;
Npc* npc = get_npc_unsafe(enemy->npcID);
do { enemy->varTable[0] |= 0x100; npc->pos.x = gPlayerStatusPtr->position.x; } while (0);
npc->pos.z = gPlayerStatusPtr->position.z;
if (!(enemy->varTable[0] & 0x1000)) {
enemy->varTable[0] |= 0x1000;
}
sfx_play_sound_at_position(0x80000011, 2, npc->pos.x, npc->pos.y, npc->pos.z);
npc->duration = 0;
script->functionTemp[0] = 15;
}
void N(func_802417F8_C37D28)(Evt* script, NpcAISettings* aiSettings, EnemyTerritoryThing* territory) {
Enemy* enemy = script->owner1.enemy;
Npc* npc = get_npc_unsafe(enemy->npcID);
f32 posX, posY, posZ, posW;
s32 temp_f8_2;
sfx_adjust_env_sound_pos(0x80000011, 2, npc->pos.x, npc->pos.y, npc->pos.z);
if (!func_800490B4(territory, enemy, aiSettings->chaseRadius, aiSettings->unk_28.f, 1)) {
enemy->varTable[0] &= ~0x100;
npc->rotation.y = 0.0f;
npc->flags &= ~0x00200000;
script->functionTemp[0] = 16;
} else {
npc->pos.x = gPlayerStatusPtr->position.x;
npc->pos.z = gPlayerStatusPtr->position.z + 2.0f;
npc->rotation.y += 25.0f;
if (npc->rotation.y > 360.0) {
npc->rotation.y -= 360.0;
}
temp_f8_2 = 255.0f - (cosine((s32)npc->rotation.y % 180) * 56.0f);
func_802DE894(npc->spriteInstanceID, 6, temp_f8_2, temp_f8_2, temp_f8_2, 255, 0);
posX = gPlayerStatusPtr->position.x;
posY = gPlayerStatusPtr->position.y;
posZ = gPlayerStatusPtr->position.z;
posW = 1000.0f;
npc_raycast_down_sides(npc->collisionChannel, &posX, &posY, &posZ, &posW);
if (fabsf(npc->pos.y - posY) > 24.0) {
npc->pos.y -= 1.8;
} else {
npc->rotation.y = 0.0f;
npc->flags &= ~0x00200000;
if (gPartnerActionStatus.actingPartner != 9) {
disable_player_input();
partner_disable_input();
npc->duration = 0;
script->functionTemp[0] = 20;
} else {
script->functionTemp[0] = 16;
}
}
}
}
void N(func_80241A94_C37FC4)(Evt* script, NpcAISettings* aiSettings, EnemyTerritoryThing* territory) {
Enemy* enemy = script->owner1.enemy;
Npc* npc = get_npc_unsafe(enemy->npcID);
enemy->varTable[0] &= ~0x100;
func_802DE894(npc->spriteInstanceID, 0, 0, 0, 0, 0, 0);
if (enemy->varTable[0] & 0x1000) {
sfx_stop_sound(0x80000011);
enemy->varTable[0] &= ~0x1000;
}
npc->currentAnim.w = enemy->animList[9];
npc->duration = 20;
script->functionTemp[0] = 17;
}
void N(func_80241B4C_C3807C)(Evt* script, NpcAISettings* aiSettings, EnemyTerritoryThing* territory) {
Enemy* enemy = script->owner1.enemy;
Npc* npc = get_npc_unsafe(enemy->npcID);
f32 posX, posY, posZ, posW;
f32 tmp = enemy->varTable[3];
f32 temp_f20 = tmp / 100.0;
s32 var;
npc->pos.y += 2.5;
posX = npc->pos.x;
posY = npc->pos.y;
posZ = npc->pos.z;
posW = 1000.0f;
npc_raycast_down_sides(npc->collisionChannel, &posX, &posY, &posZ, &posW);
if (!(npc->pos.y < (posY + temp_f20))) {
npc->yaw = atan2(npc->pos.x, npc->pos.z, enemy->territory->wander.point.x, enemy->territory->wander.point.z);
npc->pos.y = posY + temp_f20;
fx_emote(EMOTE_QUESTION, npc, 0.0f, npc->collisionHeight, 1.0f, 2.0f, -20.0f, 10, &var);
npc->duration = 10;
script->functionTemp[0] = 18;
}
}
void N(func_80241CCC_C381FC)(Evt* script, NpcAISettings* aiSettings, EnemyTerritoryThing* territory) {
Enemy* enemy = script->owner1.enemy;
Npc* npc = get_npc_unsafe(enemy->npcID);
npc->duration--;
if (npc->duration <= 0) {
script->functionTemp[0] = 30;
}
}
void N(func_80241D14_C38244)(Evt* script, NpcAISettings* aiSettings, EnemyTerritoryThing* territory) {
Enemy* enemy = script->owner1.enemy;
Npc* npc = get_npc_unsafe(enemy->npcID);
npc->duration++;
if (npc->duration >= 3) {
if (gPartnerActionStatus.actingPartner != 9) {
npc->duration = 0;
script->functionTemp[0] = 100;
} else {
enable_player_input();
partner_enable_input();
script->functionTemp[0] = 16;
}
}
}
void N(func_80241D94_C382C4)(Evt* script, NpcAISettings* aiSettings, EnemyTerritoryThing* territory) {
Enemy* enemy = script->owner1.enemy;
Npc* npc = get_npc_unsafe(enemy->npcID);
enemy->varTable[0] &= ~0x100;
npc->flags &= ~0x00200000;
npc->moveSpeed = 2.0 * aiSettings->moveSpeed;
enemy->varTable[2] = 0;
enemy->varTable[4] = npc->pos.y * 100.0;
script->functionTemp[1] = 0x1E;
}
void N(func_80241E3C_C3836C)(Evt* script, NpcAISettings* aiSettings, EnemyTerritoryThing* territory) {
Enemy* enemy = script->owner1.enemy;
Npc* npc = get_npc_unsafe(enemy->npcID);
f32 posX = npc->pos.x;
f32 posY = npc->pos.y;
f32 posZ = npc->pos.z;
f32 posW = 1000.0f;
f32 temp_f26 = (f32)enemy->varTable[3] / 100.0;
f32 temp_f24 = temp_f26 + (f32)((f32)enemy->varTable[7] / 100.0);
f32 temp_f22 = (f32)enemy->varTable[1] / 100.0;
f32 temp_f20 = sin_deg(enemy->varTable[2]);
s32 var;
s32 var2;
if (npc_raycast_down_sides(npc->collisionChannel, &posX, &posY, &posZ, &posW)) {
npc->pos.y = posY + temp_f26 + (temp_f20 * temp_f22);
} else {
npc->pos.y = temp_f24 + (temp_f20 * temp_f22);
}
enemy->varTable[2] = clamp_angle(enemy->varTable[2] + 12);
if (script->functionTemp[1] <= 0) {
script->functionTemp[1] = aiSettings->unk_14;
if (func_800490B4(territory, enemy, aiSettings->alertRadius * 0.5, aiSettings->unk_10.f * 0.5, 0)) {
fx_emote(EMOTE_EXCLAMATION, npc, 0.0f, npc->collisionHeight, 1.0f, 2.0f, -20.0f, 12, &var);
ai_enemy_play_sound(npc, 0x2F4, 0x200000);
npc->moveToPos.y = npc->pos.y;
script->functionTemp[0] = 12;
return;
}
}
script->functionTemp[1]--;
if (npc->turnAroundYawAdjustment == 0) {
npc->yaw = atan2(npc->pos.x, npc->pos.z, enemy->territory->wander.point.x, enemy->territory->wander.point.z);
npc_move_heading(npc, npc->moveSpeed, npc->yaw);
posW = dist2D(npc->pos.x, npc->pos.z, enemy->territory->wander.point.x, enemy->territory->wander.point.z);
if (posW <= (2.0f * npc->moveSpeed)) {
script->functionTemp[1] = (rand_int(1000) % 3) + 2;
script->functionTemp[0] = 2;
}
}
}
ApiStatus N(func_80242154_C38684)(Evt* script, s32 isInitialCall) {
Enemy* enemy = script->owner1.enemy;
Npc* npc = get_npc_unsafe(enemy->npcID);
Bytecode* args = script->ptrReadPos;
EnemyTerritoryThing territory;
EnemyTerritoryThing* territoryPtr = &territory;
NpcAISettings* aiSettings =(NpcAISettings*) evt_get_variable(script, *args);
territory.unk_00 = 0;
territory.shape = enemy->territory->wander.detectShape;
territory.pointX = enemy->territory->wander.detect.x;
territory.pointZ = enemy->territory->wander.detect.z;
territory.sizeX = enemy->territory->wander.detectSizeX;
territory.sizeZ = enemy->territory->wander.detectSizeZ;
territory.unk_18 = 125.0f;
territory.unk_1C = 0;
if (isInitialCall) {
script->functionTemp[0] = 0;
N(UnkFunc5)(npc, enemy, script, aiSettings);
}
switch (script->functionTemp[0]) {
case 0:
N(UnkNpcAIFunc23)(script, aiSettings, territoryPtr);
func_802DE894(npc->spriteInstanceID, 0, 0, 0, 0, 0, 0);
case 1:
N(UnkNpcAIFunc35)(script, aiSettings, territoryPtr);
if (script->functionTemp[0] == 12) {
npc->duration = 6;
}
break;
case 2:
N(UnkNpcAIFunc1_copy)(script, aiSettings, territoryPtr);
case 3:
N(UnkFunc4)(script, aiSettings, territoryPtr);
if (script->functionTemp[0] == 12) {
npc->duration = 6;
}
break;
case 12:
N(func_802414F8_C37A28)(script, aiSettings, territoryPtr);
if (script->functionTemp[0] != 13) {
break;
}
case 13:
N(func_80241650_C37B80)(script, aiSettings, territoryPtr);
break;
case 14:
N(func_80241754_C37C84)(script, aiSettings, territoryPtr);
if (script->functionTemp[0] != 15) {
break;
}
case 15:
N(func_802417F8_C37D28)(script, aiSettings, territoryPtr);
break;
case 16:
N(func_80241A94_C37FC4)(script, aiSettings, territoryPtr);
case 17:
N(func_80241B4C_C3807C)(script, aiSettings, territoryPtr);
break;
case 18:
N(func_80241CCC_C381FC)(script, aiSettings, territoryPtr);
break;
case 20:
N(func_80241D14_C38244)(script, aiSettings, territoryPtr);
break;
case 30:
N(func_80241D94_C382C4)(script, aiSettings, territoryPtr);
case 31:
N(func_80241E3C_C3836C)(script, aiSettings, territoryPtr);
}
return (script->functionTemp[0] == 100) * ApiStatus_DONE2;
}
#define AI_SENTINEL_FIRST_NPC 0
#define AI_SENTINEL_LAST_NPC 0
#include "world/common/enemy/SentinelAI.inc.c"
#include "world/common/atomic/SuperBlock.inc.c"

View File

@ -6,7 +6,7 @@
#define NAMESPACE dgb_04
ApiStatus N(func_80242154_C38684)(Evt* script, s32 isInitialCall);
ApiStatus N(SentinelAI_Main)(Evt* script, s32 isInitialCall);
extern NpcGroupList N(npcGroupList_80243D18);
extern EvtScript N(main);

View File

@ -2,8 +2,6 @@
#include "sprite/npc/world_clubba.h"
#include "message_ids.h"
extern Npc* wPartnerNpc;
enum {
NPC_WORLD_CLUBBA0,
NPC_WORLD_CLUBBA1,
@ -151,14 +149,14 @@ NpcAISettings N(npcAISettings_802419AC) = {
.moveTime = 120,
.waitTime = 30,
.alertRadius = 100.0f,
.unk_10 = { .f = 40.0f },
.unk_14 = 10,
.alertOffsetDist = 40.0f,
.playerSearchInterval = 10,
.chaseSpeed = 3.5f,
.unk_1C = { .s = 90 },
.unk_20 = 15,
.chaseTurnRate= 90,
.chaseUpdateInterval = 15,
.chaseRadius = 200.0f,
.unk_28 = { .f = 160.0f },
.unk_2C = 1,
.chaseOffsetDist = 160.0f,
.unk_AI_2C = 1,
};
EvtScript N(npcAI_802419DC) = {
@ -166,7 +164,7 @@ EvtScript N(npcAI_802419DC) = {
EVT_CALL(SetSelfVar, 1, 10)
EVT_CALL(SetSelfVar, 2, 14)
EVT_CALL(SetSelfVar, 3, 18)
EVT_CALL(N(func_80240E80_C3B890), EVT_PTR(N(npcAISettings_802419AC)))
EVT_CALL(N(ClubbaNappingAI_Main), EVT_PTR(N(npcAISettings_802419AC)))
EVT_RETURN
EVT_END
};
@ -188,7 +186,7 @@ EvtScript N(npcAI_80241A78) = {
EVT_CALL(SetSelfVar, 3, 32)
EVT_CALL(SetSelfVar, 4, 3)
EVT_CALL(SetSelfVar, 15, 8389)
EVT_CALL(N(UnkFunc7))
EVT_CALL(N(MeleeHitbox_Main))
EVT_RETURN
EVT_END
};
@ -243,7 +241,7 @@ StaticNpc N(npcGroup_80241B4C)[] = {
.id = NPC_WORLD_CLUBBA1,
.settings = &N(npcSettings_80241B20),
.pos = { 0.0f, -1000.0f, 0.0f },
.flags = NPC_FLAG_100 | NPC_FLAG_LOCK_ANIMS | NPC_FLAG_NO_Y_MOVEMENT | NPC_FLAG_NO_DROPS,
.flags = NPC_FLAG_100 | NPC_FLAG_LOCK_ANIMS | NPC_FLAG_JUMPING | NPC_FLAG_NO_DROPS,
.yaw = 0,
.dropFlags = NPC_DROP_FLAGS_80,
.heartDrops = NO_DROPS,
@ -311,7 +309,7 @@ StaticNpc N(npcGroup_80241F2C)[] = {
.id = NPC_WORLD_CLUBBA3,
.settings = &N(npcSettings_80241B20),
.pos = { 0.0f, -1000.0f, 0.0f },
.flags = NPC_FLAG_100 | NPC_FLAG_LOCK_ANIMS | NPC_FLAG_NO_Y_MOVEMENT | NPC_FLAG_NO_DROPS,
.flags = NPC_FLAG_100 | NPC_FLAG_LOCK_ANIMS | NPC_FLAG_JUMPING | NPC_FLAG_NO_DROPS,
.yaw = 0,
.dropFlags = NPC_DROP_FLAGS_80,
.heartDrops = NO_DROPS,
@ -358,381 +356,5 @@ ApiStatus N(func_80240030_C3AA40)(Evt* script, s32 isInitialCall) {
return ApiStatus_DONE2;
}
#include "world/common/UnkNpcAIFunc6.inc.c"
#include "world/common/UnkNpcAIFunc7.inc.c"
#include "world/common/UnkNpcAIFunc8.inc.c"
#include "world/common/UnkNpcAIFunc5.inc.c"
#include "world/common/UnkNpcAIFunc26.inc.c"
#include "world/common/UnkFunc7.inc.c"
void N(func_8024067C_C3B08C)(Evt* script, NpcAISettings* aiSettings, EnemyTerritoryThing* territory) {
Enemy* enemy = script->owner1.enemy;
Npc* npc = get_npc_unsafe(enemy->npcID);
if (npc->duration > 0) {
npc->duration--;
}
if (npc->duration == 1) {
npc->currentAnim.w = enemy->animList[12];
} else if (npc->duration <= 0) {
npc->currentAnim.w = enemy->animList[10];
npc->duration = 0;
script->functionTemp[0] = 1;
}
}
void N(func_80240704_C3B114)(Evt* script, NpcAISettings* aiSettings, EnemyTerritoryThing* territory) {
Enemy* enemy = script->owner1.enemy;
Npc* npc = get_npc_unsafe(enemy->npcID);
PlayerData* playerData = get_player_data();
s32 phi_s2 = FALSE;
s32 var;
f32 posX, posZ;
if (func_800490B4(territory, enemy, 80.0f, 0.0f, 0)) {
if ((gPlayerStatusPtr->actionState == 2) || (gPlayerStatusPtr->actionState == 26) ||
(gPlayerStatusPtr->actionState == 3) || (gPlayerStatusPtr->actionState == 14) ||
(gPlayerStatusPtr->actionState == 16) || (gPlayerStatusPtr->actionState == 11) ||
(gPlayerStatusPtr->actionState == 10) || (gPlayerStatusPtr->actionState == 18) ||
(gPlayerStatusPtr->actionState == 19) || (gPlayerStatusPtr->actionState == 37)) {
phi_s2 = TRUE;
}
if (playerData->currentPartner == PARTNER_KOOPER) {
if (gPartnerActionStatus.partnerActionState == playerData->currentPartner) {
phi_s2 = TRUE;
}
}
}
if (((playerData->currentPartner == PARTNER_GOOMBARIO) && (gPartnerActionStatus.partnerActionState != PARTNER_ACTION_NONE)) ||
((playerData->currentPartner == PARTNER_BOMBETTE) && (gPartnerActionStatus.partnerActionState == PARTNER_ACTION_BOMBETTE_2))) {
posX = npc->pos.x;
posZ = npc->pos.z;
add_vec2D_polar(&posX, &posZ, 0.0f, npc->yaw);
if (dist2D(posX, posZ, wPartnerNpc->pos.x, wPartnerNpc->pos.z) <= 80.0f) {
phi_s2 = TRUE;
}
}
if (phi_s2) {
ai_enemy_play_sound(npc, 0xB000000E, 0);
npc->currentAnim.w = enemy->animList[11];
npc->duration = 10;
fx_emote(EMOTE_EXCLAMATION, npc, 0.0f, npc->collisionHeight, 1.0f, 2.0f, -20.0f, 15, &var);
ai_enemy_play_sound(npc, 0x2F4, 0x200000);
script->functionTemp[0] = 2;
}
npc->duration++;
if (npc->duration == 27) {
ai_enemy_play_sound(npc, 0xB000000C, 0);
} else if (npc->duration == 57) {
ai_enemy_play_sound(npc, 0xB000000D, 0);
} else if (npc->duration == 59) {
npc->currentAnim.w = enemy->animList[12];
} else if (npc->duration == 60) {
npc->currentAnim.w = enemy->animList[10];
npc->duration = 0;
}
}
void N(func_802409BC_C3B3CC)(Evt* script, NpcAISettings* aiSettings, EnemyTerritoryThing* territory) {
Enemy* enemy = script->owner1.enemy;
Npc* npc = get_npc_unsafe(enemy->npcID);
npc->duration--;
if (npc->duration <= 0) {
npc->duration = 1;
enemy->varTable[7] = 40;
script->functionTemp[0] = 3;
}
}
void N(func_80240A20_C3B430)(Evt* script, NpcAISettings* aiSettings, EnemyTerritoryThing* territory) {
Enemy* enemy = script->owner1.enemy;
Npc* npc = get_npc_unsafe(enemy->npcID);
npc->yaw = clamp_angle((npc->yaw + rand_int(180)) - 90.0f);
npc->currentAnim.w = enemy->animList[0];
script->functionTemp[1] = (rand_int(1000) % 2) + 2;
script->functionTemp[0] = 4;
}
void N(func_80240AC8_C3B4D8)(Evt* script, NpcAISettings* aiSettings, EnemyTerritoryThing* territory) {
Enemy* enemy = script->owner1.enemy;
Npc* npc = get_npc_unsafe(enemy->npcID);
s32 var;
if (func_800490B4(territory, enemy, aiSettings->chaseRadius, aiSettings->unk_28.f, 0)) {
npc->yaw = atan2(npc->pos.x, npc->pos.z, gPlayerStatusPtr->position.x, gPlayerStatusPtr->position.z);
script->functionTemp[0] = 12;
return;
}
npc->duration--;
if (npc->duration <= 0) {
script->functionTemp[1]--;
if (script->functionTemp[1] > 0) {
npc->yaw = clamp_angle(npc->yaw + 180.0f);
npc->duration = aiSettings->waitTime / 2 + rand_int(aiSettings->waitTime / 2 + 1);
return;
}
var = enemy->varTable[7];
if (var == 40) {
npc->duration = 20;
script->functionTemp[0] = var;
} else if (var == 50) {
npc->duration = 25;
script->functionTemp[0] = var;
}
}
}
void N(func_80240C00_C3B610)(Evt* script, NpcAISettings* aiSettings, EnemyTerritoryThing* territory) {
Enemy* enemy = script->owner1.enemy;
Npc* npc = get_npc_unsafe(enemy->npcID);
npc->duration--;
if (npc->duration <= 0) {
npc->currentAnim.w = enemy->animList[1];
if (enemy->territory->wander.moveSpeedOverride < 0) {
npc->moveSpeed = aiSettings->moveSpeed;
} else {
npc->moveSpeed = enemy->territory->wander.moveSpeedOverride / 32767.0;
}
script->functionTemp[0] = 0x29;
}
}
void N(func_80240CAC_C3B6BC)(Evt* script, NpcAISettings* aiSettings, EnemyTerritoryThing* territory) {
Enemy* enemy = script->owner1.enemy;
Npc* npc = get_npc_unsafe(enemy->npcID);
f32 var;
if (func_800490B4(territory, enemy, aiSettings->chaseRadius, aiSettings->unk_28.f, 0)) {
npc->yaw = atan2(npc->pos.x, npc->pos.z, gPlayerStatusPtr->position.x, gPlayerStatusPtr->position.z);
script->functionTemp[0] = 12;
} else if (dist2D(npc->pos.x, npc->pos.z, enemy->territory->wander.point.x,
enemy->territory->wander.point.z) <= npc->moveSpeed) {
npc->currentAnim.w = enemy->animList[0];
npc->duration = 15;
enemy->varTable[7] = 50;
script->functionTemp[0] = 3;
} else if (npc->turnAroundYawAdjustment == 0) {
var = npc->yaw;
func_8004A784(npc, 5.0f, &var, 0, 0, 0);
npc->yaw = var;
npc->yaw = atan2(npc->pos.x, npc->pos.z, enemy->territory->wander.point.x, enemy->territory->wander.point.z);
npc_move_heading(npc, npc->moveSpeed, npc->yaw);
}
}
void N(func_80240E24_C3B834)(Evt* script, NpcAISettings* aiSettings, EnemyTerritoryThing* territory) {
Enemy* enemy = script->owner1.enemy;
Npc* npc = get_npc_unsafe(enemy->npcID);
if (npc->turnAroundYawAdjustment == 0) {
npc->duration--;
if (npc->duration <= 0) {
npc->duration = 0;
script->functionTemp[0] = 0;
}
}
}
ApiStatus N(func_80240E80_C3B890)(Evt* script, s32 isInitialCall) {
Enemy* enemy = script->owner1.enemy;
Npc* npc = get_npc_unsafe(enemy->npcID);
Bytecode* args = script->ptrReadPos;
EnemyTerritoryThing territory;
EnemyTerritoryThing* territoryPtr = &territory;
NpcAISettings* npcAISettings = (NpcAISettings*)evt_get_variable(script, *args++);
territory.unk_00 = 0;
territory.shape = enemy->territory->wander.detectShape;
territory.pointX = enemy->territory->wander.detect.x;
territory.pointZ = enemy->territory->wander.detect.z;
territory.sizeX = enemy->territory->wander.detectSizeX;
territory.sizeZ = enemy->territory->wander.detectSizeZ;
territory.unk_18 = 40.0f;
territory.unk_1C = 0;
if (isInitialCall || (enemy->unk_B0 & ENEMY_AI_FLAGS_4)) {
script->functionTemp[0] = 0;
npc->duration = 30;
npc->currentAnim.w = enemy->animList[10];
npc->flags &= ~0x800;
enemy->varTable[0] = 0;
if (!enemy->territory->wander.isFlying) {
npc->flags = (npc->flags | 0x200) & ~0x8;
} else {
npc->flags = (npc->flags & ~0x200) | 0x8;
}
if (enemy->unk_B0 & ENEMY_AI_FLAGS_4) {
script->functionTemp[0] = 99;
script->functionTemp[1] = 40;
npc->currentAnim.w = enemy->animList[0];
}
enemy->unk_B0 &= ~ENEMY_AI_FLAGS_4;
}
if (((u32)script->functionTemp[0] - 10 < 20) && (enemy->varTable[0] == 0) && N(UnkNpcAIFunc26)(script)) {
script->functionTemp[0] = 30;
}
switch (script->functionTemp[0]) {
case 0:
N(func_8024067C_C3B08C)(script, npcAISettings, territoryPtr);
break;
case 1:
N(func_80240704_C3B114)(script, npcAISettings, territoryPtr);
break;
case 2:
N(func_802409BC_C3B3CC)(script, npcAISettings, territoryPtr);
break;
case 3:
N(func_80240A20_C3B430)(script, npcAISettings, territoryPtr);
break;
case 4:
N(func_80240AC8_C3B4D8)(script, npcAISettings, territoryPtr);
break;
case 12:
func_80049F7C(script, npcAISettings, territoryPtr);
if (script->functionTemp[0] != 13) {
break;
}
case 13:
func_8004A124(script, npcAISettings, territoryPtr);
break;
case 14:
func_8004A3E8(script, npcAISettings, territoryPtr);
npc->duration = 0xF;
enemy->varTable[7] = 40;
script->functionTemp[0] = 3;
break;
case 30:
N(UnkNpcAIFunc6)(script);
if (script->functionTemp[0] != 31) {
break;
}
case 31:
N(UnkNpcAIFunc7)(script);
if (script->functionTemp[0] != 32) {
break;
}
case 32:
N(UnkNpcAIFunc8)(script);
break;
case 33:
N(UnkNpcAIFunc5)(script);
break;
case 40:
N(func_80240C00_C3B610)(script, npcAISettings, territoryPtr);
if (script->functionTemp[0] != 41) {
break;
}
case 41:
N(func_80240CAC_C3B6BC)(script, npcAISettings, territoryPtr);
break;
case 50:
N(func_80240E24_C3B834)(script, npcAISettings, territoryPtr);
break;
case 99:
func_8004A73C(script);
}
return ApiStatus_BLOCK;
}
ApiStatus N(func_802411D0_C3BBE0)(Evt* script, s32 isInitialCall) {
Enemy* enemy = script->owner1.enemy;
Npc* npc = get_npc_unsafe(enemy->npcID);
Bytecode* args = script->ptrReadPos;
EnemyTerritoryThing territory;
EnemyTerritoryThing* territoryPtr = &territory;
NpcAISettings* npcAISettings = (NpcAISettings*)evt_get_variable(script, *args++);
territory.unk_00 = 0;
territory.shape = enemy->territory->wander.detectShape;
territory.pointX = enemy->territory->wander.detect.x;
territory.pointZ = enemy->territory->wander.detect.z;
territory.sizeX = enemy->territory->wander.detectSizeX;
territory.sizeZ = enemy->territory->wander.detectSizeZ;
territory.unk_18 = 65.0f;
territory.unk_1C = 0;
if (isInitialCall || (enemy->unk_B0 & ENEMY_AI_FLAGS_4)) {
script->functionTemp[0] = 0;
npc->duration = 0;
npc->currentAnim.w = enemy->animList[0];
npc->flags &= ~0x800;
if (!enemy->territory->wander.isFlying) {
npc->flags = (npc->flags | 0x200) & ~0x8;
} else {
npc->flags = (npc->flags & ~0x200) | 0x8;
}
if (enemy->unk_B0 & ENEMY_AI_FLAGS_4) {
script->functionTemp[0] = 99;
script->functionTemp[1] = 0;
enemy->unk_B0 &= ~ENEMY_AI_FLAGS_4;
}
enemy->varTable[0] = 0;
}
if ((script->functionTemp[0] < 30) && (enemy->varTable[0] == 0) && N(UnkNpcAIFunc26)(script)) {
script->functionTemp[0] = 30;
}
switch (script->functionTemp[0]) {
case 0:
func_800495A0(script, npcAISettings, territoryPtr);
case 1:
func_800496B8(script, npcAISettings, territoryPtr);
break;
case 2:
base_UnkNpcAIFunc1(script, npcAISettings, territoryPtr);
case 3:
func_80049C04(script, npcAISettings, territoryPtr);
break;
case 10:
func_80049E3C(script, npcAISettings, territoryPtr);
case 11:
func_80049ECC(script, npcAISettings, territoryPtr);
break;
case 12:
func_80049F7C(script, npcAISettings, territoryPtr);
case 13:
func_8004A124(script, npcAISettings, territoryPtr);
break;
case 14:
func_8004A3E8(script, npcAISettings, territoryPtr);
break;
case 30:
N(UnkNpcAIFunc6)(script);
case 31:
N(UnkNpcAIFunc7)(script);
if (script->functionTemp[0] != 32) {
break;
}
case 32:
N(UnkNpcAIFunc8)(script);
if (script->functionTemp[0] != 33) {
break;
}
case 33:
N(UnkNpcAIFunc5)(script);
break;
case 99:
func_8004A73C(script);
}
return ApiStatus_BLOCK;
}
#include "world/common/enemy/ClubbaNappingAI.inc.c"
#include "world/common/enemy/WanderMeleeAI.inc.c"

View File

@ -8,8 +8,8 @@
ApiStatus N(func_80240000_C3AA10)(Evt* script, s32 isInitialCall);
ApiStatus N(func_80240030_C3AA40)(Evt* script, s32 isInitialCall);
ApiStatus N(UnkFunc7)(Evt* script, s32 isInitialCall);
ApiStatus N(func_80240E80_C3B890)(Evt* script, s32 isInitialCall);
ApiStatus N(MeleeHitbox_Main)(Evt* script, s32 isInitialCall);
ApiStatus N(ClubbaNappingAI_Main)(Evt* script, s32 isInitialCall);
extern NpcGroupList N(npcGroupList_8024230C);
extern EvtScript N(802417F0);

View File

@ -2,8 +2,6 @@
#include "message_ids.h"
#include "sprite/npc/world_clubba.h"
extern Npc* wPartnerNpc;
enum {
NPC_WORLD_CLUBBA0,
NPC_WORLD_CLUBBA1,
@ -136,14 +134,14 @@ NpcAISettings N(npcAISettings_802418DC) = {
.moveTime = 120,
.waitTime = 30,
.alertRadius = 100.0f,
.unk_10 = { .f = 40.0f },
.unk_14 = 10,
.alertOffsetDist = 40.0f,
.playerSearchInterval = 10,
.chaseSpeed = 3.5f,
.unk_1C = { .s = 90 },
.unk_20 = 15,
.chaseTurnRate= 90,
.chaseUpdateInterval = 15,
.chaseRadius = 200.0f,
.unk_28 = { .f = 160.0f },
.unk_2C = 1,
.chaseOffsetDist = 160.0f,
.unk_AI_2C = 1,
};
EvtScript N(npcAI_8024190C) = {
@ -151,7 +149,7 @@ EvtScript N(npcAI_8024190C) = {
EVT_CALL(SetSelfVar, 1, 10)
EVT_CALL(SetSelfVar, 2, 14)
EVT_CALL(SetSelfVar, 3, 18)
EVT_CALL(N(func_80240E20_C3EA10), EVT_PTR(N(npcAISettings_802418DC)))
EVT_CALL(N(ClubbaNappingAI_Main), EVT_PTR(N(npcAISettings_802418DC)))
EVT_RETURN
EVT_END
};
@ -173,7 +171,7 @@ EvtScript N(npcAI_802419A8) = {
EVT_CALL(SetSelfVar, 3, 32)
EVT_CALL(SetSelfVar, 4, 3)
EVT_CALL(SetSelfVar, 15, 8389)
EVT_CALL(N(UnkFunc7))
EVT_CALL(N(MeleeHitbox_Main))
EVT_RETURN
EVT_END
};
@ -192,7 +190,7 @@ StaticNpc N(npcGroup_80241A7C)[] = {
.id = NPC_WORLD_CLUBBA0,
.settings = &N(npcSettings_8024197C),
.pos = { -500.0f, 0.0f, -240.0f },
.flags = NPC_FLAG_NO_Y_MOVEMENT,
.flags = NPC_FLAG_JUMPING,
.yaw = 270,
.dropFlags = NPC_DROP_FLAGS_80,
.itemDropChance = 5,
@ -229,7 +227,7 @@ StaticNpc N(npcGroup_80241A7C)[] = {
.id = NPC_WORLD_CLUBBA1,
.settings = &N(npcSettings_80241A50),
.pos = { 0.0f, -1000.0f, 0.0f },
.flags = NPC_FLAG_100 | NPC_FLAG_LOCK_ANIMS | NPC_FLAG_NO_Y_MOVEMENT | NPC_FLAG_NO_DROPS,
.flags = NPC_FLAG_100 | NPC_FLAG_LOCK_ANIMS | NPC_FLAG_JUMPING | NPC_FLAG_NO_DROPS,
.yaw = 0,
.dropFlags = NPC_DROP_FLAGS_80,
.heartDrops = NO_DROPS,
@ -265,381 +263,6 @@ static const s32 N(pad_1E74)[] = {
0x00000000, 0x00000000
};
#include "world/common/UnkNpcAIFunc6.inc.c"
#include "world/common/enemy/ClubbaNappingAI.inc.c"
#include "world/common/UnkNpcAIFunc7.inc.c"
#include "world/common/UnkNpcAIFunc8.inc.c"
#include "world/common/UnkNpcAIFunc5.inc.c"
#include "world/common/UnkNpcAIFunc26.inc.c"
#include "world/common/UnkFunc7.inc.c"
void N(func_8024061C_C3E20C)(Evt* script, NpcAISettings* aiSettings, EnemyTerritoryThing* territory) {
Enemy* enemy = script->owner1.enemy;
Npc* npc = get_npc_unsafe(enemy->npcID);
if (npc->duration > 0) {
npc->duration--;
}
if (npc->duration == 1) {
npc->currentAnim.w = enemy->animList[12];
} else if (npc->duration <= 0) {
npc->currentAnim.w = enemy->animList[10];
npc->duration = 0;
script->functionTemp[0] = 1;
}
}
void N(func_802406A4_C3E294)(Evt* script, NpcAISettings* aiSettings, EnemyTerritoryThing* territory) {
Enemy* enemy = script->owner1.enemy;
Npc* npc = get_npc_unsafe(enemy->npcID);
PlayerData* playerData = get_player_data();
s32 phi_s2 = FALSE;
s32 var;
f32 posX, posZ;
if (func_800490B4(territory, enemy, 80.0f, 0.0f, 0)) {
if ((gPlayerStatusPtr->actionState == 2) || (gPlayerStatusPtr->actionState == 26) ||
(gPlayerStatusPtr->actionState == 3) || (gPlayerStatusPtr->actionState == 14) ||
(gPlayerStatusPtr->actionState == 16) || (gPlayerStatusPtr->actionState == 11) ||
(gPlayerStatusPtr->actionState == 10) || (gPlayerStatusPtr->actionState == 18) ||
(gPlayerStatusPtr->actionState == 19) || (gPlayerStatusPtr->actionState == 37)) {
phi_s2 = TRUE;
}
if (playerData->currentPartner == PARTNER_KOOPER) {
if (gPartnerActionStatus.partnerActionState == playerData->currentPartner) {
phi_s2 = TRUE;
}
}
}
if (((playerData->currentPartner == PARTNER_GOOMBARIO) && (gPartnerActionStatus.partnerActionState != PARTNER_ACTION_NONE)) ||
((playerData->currentPartner == PARTNER_BOMBETTE) && (gPartnerActionStatus.partnerActionState == PARTNER_ACTION_BOMBETTE_2))) {
posX = npc->pos.x;
posZ = npc->pos.z;
add_vec2D_polar(&posX, &posZ, 0.0f, npc->yaw);
if (dist2D(posX, posZ, wPartnerNpc->pos.x, wPartnerNpc->pos.z) <= 80.0f) {
phi_s2 = TRUE;
}
}
if (phi_s2) {
ai_enemy_play_sound(npc, 0xB000000E, 0);
npc->currentAnim.w = enemy->animList[11];
npc->duration = 10;
fx_emote(EMOTE_EXCLAMATION, npc, 0.0f, npc->collisionHeight, 1.0f, 2.0f, -20.0f, 15, &var);
ai_enemy_play_sound(npc, 0x2F4, 0x200000);
script->functionTemp[0] = 2;
}
npc->duration++;
if (npc->duration == 27) {
ai_enemy_play_sound(npc, 0xB000000C, 0);
} else if (npc->duration == 57) {
ai_enemy_play_sound(npc, 0xB000000D, 0);
} else if (npc->duration == 59) {
npc->currentAnim.w = enemy->animList[12];
} else if (npc->duration == 60) {
npc->currentAnim.w = enemy->animList[10];
npc->duration = 0;
}
}
void N(func_8024095C_C3E54C)(Evt* script, NpcAISettings* aiSettings, EnemyTerritoryThing* territory) {
Enemy* enemy = script->owner1.enemy;
Npc* npc = get_npc_unsafe(enemy->npcID);
npc->duration--;
if (npc->duration <= 0) {
npc->duration = 1;
enemy->varTable[7] = 40;
script->functionTemp[0] = 3;
}
}
void N(func_802409C0_C3E5B0)(Evt* script, NpcAISettings* aiSettings, EnemyTerritoryThing* territory) {
Enemy* enemy = script->owner1.enemy;
Npc* npc = get_npc_unsafe(enemy->npcID);
npc->yaw = clamp_angle((npc->yaw + rand_int(180)) - 90.0f);
npc->currentAnim.w = enemy->animList[0];
script->functionTemp[1] = (rand_int(1000) % 2) + 2;
script->functionTemp[0] = 4;
}
void N(func_80240A68_C3E658)(Evt* script, NpcAISettings* aiSettings, EnemyTerritoryThing* territory) {
Enemy* enemy = script->owner1.enemy;
Npc* npc = get_npc_unsafe(enemy->npcID);
s32 var;
if (func_800490B4(territory, enemy, aiSettings->chaseRadius, aiSettings->unk_28.f, 0)) {
npc->yaw = atan2(npc->pos.x, npc->pos.z, gPlayerStatusPtr->position.x, gPlayerStatusPtr->position.z);
script->functionTemp[0] = 12;
return;
}
npc->duration--;
if (npc->duration <= 0) {
script->functionTemp[1]--;
if (script->functionTemp[1] > 0) {
npc->yaw = clamp_angle(npc->yaw + 180.0f);
npc->duration = aiSettings->waitTime / 2 + rand_int(aiSettings->waitTime / 2 + 1);
return;
}
var = enemy->varTable[7];
if (var == 40) {
npc->duration = 20;
script->functionTemp[0] = var;
} else if (var == 50) {
npc->duration = 25;
script->functionTemp[0] = var;
}
}
}
void N(func_80240BA0_C3E790)(Evt* script, NpcAISettings* aiSettings, EnemyTerritoryThing* territory) {
Enemy* enemy = script->owner1.enemy;
Npc* npc = get_npc_unsafe(enemy->npcID);
npc->duration--;
if (npc->duration <= 0) {
npc->currentAnim.w = enemy->animList[1];
if (enemy->territory->wander.moveSpeedOverride < 0) {
npc->moveSpeed = aiSettings->moveSpeed;
} else {
npc->moveSpeed = enemy->territory->wander.moveSpeedOverride / 32767.0;
}
script->functionTemp[0] = 0x29;
}
}
void N(func_80240C4C_C3E83C)(Evt* script, NpcAISettings* aiSettings, EnemyTerritoryThing* territory) {
Enemy* enemy = script->owner1.enemy;
Npc* npc = get_npc_unsafe(enemy->npcID);
f32 var;
if (func_800490B4(territory, enemy, aiSettings->chaseRadius, aiSettings->unk_28.f, 0)) {
npc->yaw = atan2(npc->pos.x, npc->pos.z, gPlayerStatusPtr->position.x, gPlayerStatusPtr->position.z);
script->functionTemp[0] = 12;
} else if (dist2D(npc->pos.x, npc->pos.z, enemy->territory->wander.point.x,
enemy->territory->wander.point.z) <= npc->moveSpeed) {
npc->currentAnim.w = enemy->animList[0];
npc->duration = 15;
enemy->varTable[7] = 50;
script->functionTemp[0] = 3;
} else if (npc->turnAroundYawAdjustment == 0) {
var = npc->yaw;
func_8004A784(npc, 5.0f, &var, 0, 0, 0);
npc->yaw = var;
npc->yaw = atan2(npc->pos.x, npc->pos.z, enemy->territory->wander.point.x, enemy->territory->wander.point.z);
npc_move_heading(npc, npc->moveSpeed, npc->yaw);
}
}
void N(func_80240DC4_C3E9B4)(Evt* script, NpcAISettings* aiSettings, EnemyTerritoryThing* territory) {
Enemy* enemy = script->owner1.enemy;
Npc* npc = get_npc_unsafe(enemy->npcID);
if (npc->turnAroundYawAdjustment == 0) {
npc->duration--;
if (npc->duration <= 0) {
npc->duration = 0;
script->functionTemp[0] = 0;
}
}
}
ApiStatus N(func_80240E20_C3EA10)(Evt* script, s32 isInitialCall) {
Enemy* enemy = script->owner1.enemy;
Npc* npc = get_npc_unsafe(enemy->npcID);
Bytecode* args = script->ptrReadPos;
EnemyTerritoryThing territory;
EnemyTerritoryThing* territoryPtr = &territory;
NpcAISettings* npcAISettings = (NpcAISettings*)evt_get_variable(script, *args++);
territory.unk_00 = 0;
territory.shape = enemy->territory->wander.detectShape;
territory.pointX = enemy->territory->wander.detect.x;
territory.pointZ = enemy->territory->wander.detect.z;
territory.sizeX = enemy->territory->wander.detectSizeX;
territory.sizeZ = enemy->territory->wander.detectSizeZ;
territory.unk_18 = 40.0f;
territory.unk_1C = 0;
if (isInitialCall || (enemy->unk_B0 & ENEMY_AI_FLAGS_4)) {
script->functionTemp[0] = 0;
npc->duration = 30;
npc->currentAnim.w = enemy->animList[10];
npc->flags &= ~0x800;
enemy->varTable[0] = 0;
if (!enemy->territory->wander.isFlying) {
npc->flags = (npc->flags | 0x200) & ~0x8;
} else {
npc->flags = (npc->flags & ~0x200) | 0x8;
}
if (enemy->unk_B0 & ENEMY_AI_FLAGS_4) {
script->functionTemp[0] = 99;
script->functionTemp[1] = 40;
npc->currentAnim.w = enemy->animList[0];
}
enemy->unk_B0 &= ~ENEMY_AI_FLAGS_4;
}
if (((u32)script->functionTemp[0] - 10 < 20) && (enemy->varTable[0] == 0) && N(UnkNpcAIFunc26)(script)) {
script->functionTemp[0] = 30;
}
switch (script->functionTemp[0]) {
case 0:
N(func_8024061C_C3E20C)(script, npcAISettings, territoryPtr);
break;
case 1:
N(func_802406A4_C3E294)(script, npcAISettings, territoryPtr);
break;
case 2:
N(func_8024095C_C3E54C)(script, npcAISettings, territoryPtr);
break;
case 3:
N(func_802409C0_C3E5B0)(script, npcAISettings, territoryPtr);
break;
case 4:
N(func_80240A68_C3E658)(script, npcAISettings, territoryPtr);
break;
case 12:
func_80049F7C(script, npcAISettings, territoryPtr);
if (script->functionTemp[0] != 13) {
break;
}
case 13:
func_8004A124(script, npcAISettings, territoryPtr);
break;
case 14:
func_8004A3E8(script, npcAISettings, territoryPtr);
npc->duration = 15;
enemy->varTable[7] = 40;
script->functionTemp[0] = 3;
break;
case 30:
N(UnkNpcAIFunc6)(script);
if (script->functionTemp[0] != 31) {
break;
}
case 31:
N(UnkNpcAIFunc7)(script);
if (script->functionTemp[0] != 32) {
break;
}
case 32:
N(UnkNpcAIFunc8)(script);
break;
case 33:
N(UnkNpcAIFunc5)(script);
break;
case 40:
N(func_80240BA0_C3E790)(script, npcAISettings, territoryPtr);
if (script->functionTemp[0] != 41) {
break;
}
case 41:
N(func_80240C4C_C3E83C)(script, npcAISettings, territoryPtr);
break;
case 50:
N(func_80240DC4_C3E9B4)(script, npcAISettings, territoryPtr);
break;
case 99:
func_8004A73C(script);
}
return ApiStatus_BLOCK;
}
ApiStatus N(func_80241170_C3ED60)(Evt* script, s32 isInitialCall) {
Enemy* enemy = script->owner1.enemy;
Npc* npc = get_npc_unsafe(enemy->npcID);
Bytecode* args = script->ptrReadPos;
EnemyTerritoryThing territory;
EnemyTerritoryThing* territoryPtr = &territory;
NpcAISettings* npcAISettings = (NpcAISettings*)evt_get_variable(script, *args++);
territory.unk_00 = 0;
territory.shape = enemy->territory->wander.detectShape;
territory.pointX = enemy->territory->wander.detect.x;
territory.pointZ = enemy->territory->wander.detect.z;
territory.sizeX = enemy->territory->wander.detectSizeX;
territory.sizeZ = enemy->territory->wander.detectSizeZ;
territory.unk_18 = 65.0f;
territory.unk_1C = 0;
if (isInitialCall || (enemy->unk_B0 & ENEMY_AI_FLAGS_4)) {
script->functionTemp[0] = 0;
npc->duration = 0;
npc->currentAnim.w = enemy->animList[0];
npc->flags &= ~0x800;
if (!enemy->territory->wander.isFlying) {
npc->flags = (npc->flags | 0x200) & ~0x8;
} else {
npc->flags = (npc->flags & ~0x200) | 0x8;
}
if (enemy->unk_B0 & ENEMY_AI_FLAGS_4) {
script->functionTemp[0] = 99;
script->functionTemp[1] = 0;
enemy->unk_B0 &= ~ENEMY_AI_FLAGS_4;
}
enemy->varTable[0] = 0;
}
if ((script->functionTemp[0] < 30) && (enemy->varTable[0] == 0) && N(UnkNpcAIFunc26)(script)) {
script->functionTemp[0] = 30;
}
switch (script->functionTemp[0]) {
case 0:
func_800495A0(script, npcAISettings, territoryPtr);
case 1:
func_800496B8(script, npcAISettings, territoryPtr);
break;
case 2:
base_UnkNpcAIFunc1(script, npcAISettings, territoryPtr);
case 3:
func_80049C04(script, npcAISettings, territoryPtr);
break;
case 10:
func_80049E3C(script, npcAISettings, territoryPtr);
case 11:
func_80049ECC(script, npcAISettings, territoryPtr);
break;
case 12:
func_80049F7C(script, npcAISettings, territoryPtr);
case 13:
func_8004A124(script, npcAISettings, territoryPtr);
break;
case 14:
func_8004A3E8(script, npcAISettings, territoryPtr);
break;
case 30:
N(UnkNpcAIFunc6)(script);
case 31:
N(UnkNpcAIFunc7)(script);
if (script->functionTemp[0] != 32) {
break;
}
case 32:
N(UnkNpcAIFunc8)(script);
if (script->functionTemp[0] != 33) {
break;
}
case 33:
N(UnkNpcAIFunc5)(script);
break;
case 99:
func_8004A73C(script);
}
return ApiStatus_BLOCK;
}
#include "world/common/enemy/WanderMeleeAI.inc.c"

View File

@ -6,8 +6,8 @@
#define NAMESPACE dgb_07
ApiStatus N(func_80240E20_C3EA10)(Evt* script, s32 isInitialCall);
ApiStatus N(UnkFunc7)(Evt *script, s32 isInitialCall);
ApiStatus N(ClubbaNappingAI_Main)(Evt* script, s32 isInitialCall);
ApiStatus N(MeleeHitbox_Main)(Evt *script, s32 isInitialCall);
NpcGroupList N(npcGroupList_80241E5C);
extern EvtScript N(main);

View File

@ -132,18 +132,18 @@ static s32 N(pad_40FC) = {
NpcAISettings N(npcAI_80244100) = {
.moveSpeed = 4.5f,
.alertRadius = 170.0f,
.unk_10 = { .f = 90.0f },
.unk_14 = 1,
.alertOffsetDist = 90.0f,
.playerSearchInterval = 1,
.chaseSpeed = 3.9f,
.unk_1C = { .s = 180 },
.unk_20 = 2,
.chaseTurnRate= 180,
.chaseUpdateInterval = 2,
.chaseRadius = 170.0f,
.unk_28 = { .f = 90.0f },
.unk_2C = 1,
.chaseOffsetDist = 90.0f,
.unk_AI_2C = 1,
};
EvtScript N(80244130) = {
EVT_CALL(N(UnkNpcAIMainFunc), EVT_PTR(N(npcAI_80244100)))
EVT_CALL(N(PatrolNoAttackAI_Main), EVT_PTR(N(npcAI_80244100)))
EVT_RETURN
EVT_END
};
@ -210,14 +210,14 @@ NpcAISettings N(npcAISettings_802442C0) = {
.moveTime = 120,
.waitTime = 30,
.alertRadius = 85.0f,
.unk_10 = { .f = 65.0f },
.unk_14 = 5,
.alertOffsetDist = 65.0f,
.playerSearchInterval = 5,
.chaseSpeed = 3.5f,
.unk_1C = { .s = 90 },
.unk_20 = 12,
.chaseTurnRate= 90,
.chaseUpdateInterval = 12,
.chaseRadius = 110.0f,
.unk_28 = { .f = 90.0f },
.unk_2C = 3,
.chaseOffsetDist = 90.0f,
.unk_AI_2C = 3,
};
EvtScript N(npcAI_802442F0) = {
@ -225,7 +225,7 @@ EvtScript N(npcAI_802442F0) = {
EVT_CALL(SetSelfVar, 1, 5)
EVT_CALL(SetSelfVar, 2, 8)
EVT_CALL(SetSelfVar, 3, 12)
EVT_CALL(N(func_802414AC_C4125C), EVT_PTR(N(npcAISettings_802442C0)))
EVT_CALL(N(WanderMeleeAI_Main), EVT_PTR(N(npcAISettings_802442C0)))
EVT_RETURN
EVT_END
};
@ -247,7 +247,7 @@ EvtScript N(npcAI_8024438C) = {
EVT_CALL(SetSelfVar, 3, 32)
EVT_CALL(SetSelfVar, 4, 3)
EVT_CALL(SetSelfVar, 15, 8389)
EVT_CALL(N(UnkFunc7))
EVT_CALL(N(MeleeHitbox_Main))
EVT_RETURN
EVT_END
};
@ -261,14 +261,14 @@ NpcSettings N(npcSettings_80244434) = {
.unk_2A = 8,
};
f32 N(sixFloats)[] = {
f32 N(FlyingAI_JumpVels)[] = {
4.5f, 3.5f, 2.6f, 2.0f,
1.5f, 20.0f,
};
EvtScript N(80244478) = {
EVT_CALL(SetSelfEnemyFlagBits, ((NPC_FLAG_MOTION_BLUR | NPC_FLAG_1000000 | NPC_FLAG_SIMPLIFIED_PHYSICS | NPC_FLAG_PARTICLE | NPC_FLAG_8000000 | NPC_FLAG_10000000 | NPC_FLAG_20000000)), TRUE)
EVT_CALL(SetNpcFlagBits, NPC_SELF, ((NPC_FLAG_100 | NPC_FLAG_LOCK_ANIMS | NPC_FLAG_NO_Y_MOVEMENT)), TRUE)
EVT_CALL(SetNpcFlagBits, NPC_SELF, ((NPC_FLAG_100 | NPC_FLAG_LOCK_ANIMS | NPC_FLAG_JUMPING)), TRUE)
EVT_RETURN
EVT_END
};
@ -278,12 +278,12 @@ NpcAISettings N(npcAISettings_802444B4) = {
.moveTime = 90,
.waitTime = 30,
.alertRadius = 240.0f,
.unk_14 = 1,
.playerSearchInterval = 1,
.chaseSpeed = 5.3f,
.unk_1C = { .s = 180 },
.unk_20 = 1,
.chaseTurnRate= 180,
.chaseUpdateInterval = 1,
.chaseRadius = 240.0f,
.unk_2C = 1,
.unk_AI_2C = 1,
};
extern const char N(dgb_00_name_hack)[];
@ -293,7 +293,7 @@ EvtScript N(npcAI_802444E4) = {
EVT_CALL(SetSelfVar, 5, -650)
EVT_CALL(SetSelfVar, 6, 30)
EVT_CALL(SetSelfVar, 1, 600)
EVT_CALL(N(func_802438F0_C436A0), EVT_PTR(N(npcAISettings_802444B4)))
EVT_CALL(N(SentinelAI_Main), EVT_PTR(N(npcAISettings_802444B4)))
EVT_CALL(DisablePlayerInput, TRUE)
EVT_WAIT_FRAMES(2)
EVT_LABEL(20)
@ -460,7 +460,7 @@ EvtScript N(npcAI_80244D7C) = {
EVT_WAIT_FRAMES(8)
EVT_END_LOOP
EVT_END_THREAD
EVT_CALL(N(UnkNpcAIMainFunc), EVT_PTR(N(npcAI_80244100)))
EVT_CALL(N(PatrolNoAttackAI_Main), EVT_PTR(N(npcAI_80244100)))
EVT_RETURN
EVT_END
};
@ -590,7 +590,7 @@ StaticNpc N(npcGroup_80245290)[] = {
.id = NPC_WORLD_CLUBBA1,
.settings = &N(npcSettings_80244434),
.pos = { 0.0f, -1000.0f, 0.0f },
.flags = NPC_FLAG_100 | NPC_FLAG_LOCK_ANIMS | NPC_FLAG_NO_Y_MOVEMENT | NPC_FLAG_NO_DROPS,
.flags = NPC_FLAG_100 | NPC_FLAG_LOCK_ANIMS | NPC_FLAG_JUMPING | NPC_FLAG_NO_DROPS,
.yaw = 0,
.dropFlags = NPC_DROP_FLAGS_80,
.heartDrops = NO_DROPS,
@ -659,7 +659,7 @@ StaticNpc N(npcGroup_80245670)[] = {
.id = NPC_WORLD_CLUBBA3,
.settings = &N(npcSettings_80244434),
.pos = { 0.0f, -1000.0f, 0.0f },
.flags = NPC_FLAG_100 | NPC_FLAG_LOCK_ANIMS | NPC_FLAG_NO_Y_MOVEMENT | NPC_FLAG_NO_DROPS,
.flags = NPC_FLAG_100 | NPC_FLAG_LOCK_ANIMS | NPC_FLAG_JUMPING | NPC_FLAG_NO_DROPS,
.yaw = 0,
.dropFlags = NPC_DROP_FLAGS_80,
.heartDrops = NO_DROPS,
@ -728,7 +728,7 @@ StaticNpc N(npcGroup_80245A50)[] = {
.id = NPC_WORLD_CLUBBA5,
.settings = &N(npcSettings_80244434),
.pos = { 0.0f, -1000.0f, 0.0f },
.flags = NPC_FLAG_100 | NPC_FLAG_LOCK_ANIMS | NPC_FLAG_NO_Y_MOVEMENT | NPC_FLAG_NO_DROPS,
.flags = NPC_FLAG_100 | NPC_FLAG_LOCK_ANIMS | NPC_FLAG_JUMPING | NPC_FLAG_NO_DROPS,
.yaw = 0,
.dropFlags = NPC_DROP_FLAGS_80,
.heartDrops = NO_DROPS,
@ -879,7 +879,7 @@ StaticNpc N(npcGroup_80246528) = {
.id = NPC_WORLD_CLUBBA6,
.settings = &N(npcSettings_80244A28),
.pos = { 426.0f, 0.0f, 38.0f },
.flags = NPC_FLAG_PASSIVE | NPC_FLAG_100 | NPC_FLAG_LOCK_ANIMS | NPC_FLAG_NO_Y_MOVEMENT | NPC_FLAG_200000 | NPC_FLAG_400000,
.flags = NPC_FLAG_PASSIVE | NPC_FLAG_100 | NPC_FLAG_LOCK_ANIMS | NPC_FLAG_JUMPING | NPC_FLAG_200000 | NPC_FLAG_400000,
.init = &N(init_802464C4),
.yaw = 270,
.dropFlags = NPC_DROP_FLAGS_80,
@ -988,421 +988,13 @@ EvtScript N(802469E0) = {
EVT_END
};
#include "world/common/atomic/enemy/UnkAI_1.inc.c"
#include "world/common/enemy/PatrolNoAttackAI.inc.c"
#include "world/common/UnkNpcAIFunc6.inc.c"
#include "world/common/enemy/WanderMeleeAI.inc.c"
#include "world/common/UnkNpcAIFunc7.inc.c"
#include "world/common/UnkNpcAIFunc8.inc.c"
#include "world/common/UnkNpcAIFunc5.inc.c"
#include "world/common/UnkNpcAIFunc26.inc.c"
#include "world/common/UnkFunc7.inc.c"
ApiStatus N(func_802414AC_C4125C)(Evt* script, s32 isInitialCall) {
Enemy* enemy = script->owner1.enemy;
Npc* npc = get_npc_unsafe(enemy->npcID);
Bytecode* args = script->ptrReadPos;
EnemyTerritoryThing territory;
EnemyTerritoryThing* territoryPtr = &territory;
NpcAISettings* npcAISettings = (NpcAISettings*)evt_get_variable(script, *args++);
territory.unk_00 = 0;
territory.shape = enemy->territory->wander.detectShape;
territory.pointX = enemy->territory->wander.detect.x;
territory.pointZ = enemy->territory->wander.detect.z;
territory.sizeX = enemy->territory->wander.detectSizeX;
territory.sizeZ = enemy->territory->wander.detectSizeZ;
territory.unk_18 = 65.0f;
territory.unk_1C = 0;
if (isInitialCall || (enemy->unk_B0 & ENEMY_AI_FLAGS_4)) {
script->functionTemp[0] = 0;
npc->duration = 0;
npc->currentAnim.w = enemy->animList[0];
npc->flags &= ~0x800;
if (!enemy->territory->wander.isFlying) {
npc->flags = (npc->flags | 0x200) & ~0x8;
} else {
npc->flags = (npc->flags & ~0x200) | 0x8;
}
if (enemy->unk_B0 & ENEMY_AI_FLAGS_4) {
script->functionTemp[0] = 99;
script->functionTemp[1] = 0;
enemy->unk_B0 &= ~ENEMY_AI_FLAGS_4;
}
enemy->varTable[0] = 0;
}
if ((script->functionTemp[0] < 30) && (enemy->varTable[0] == 0) && N(UnkNpcAIFunc26)(script)) {
script->functionTemp[0] = 30;
}
switch (script->functionTemp[0]) {
case 0:
func_800495A0(script, npcAISettings, territoryPtr);
case 1:
func_800496B8(script, npcAISettings, territoryPtr);
break;
case 2:
base_UnkNpcAIFunc1(script, npcAISettings, territoryPtr);
case 3:
func_80049C04(script, npcAISettings, territoryPtr);
break;
case 10:
func_80049E3C(script, npcAISettings, territoryPtr);
case 11:
func_80049ECC(script, npcAISettings, territoryPtr);
break;
case 12:
func_80049F7C(script, npcAISettings, territoryPtr);
case 13:
func_8004A124(script, npcAISettings, territoryPtr);
break;
case 14:
func_8004A3E8(script, npcAISettings, territoryPtr);
break;
case 30:
N(UnkNpcAIFunc6)(script);
case 31:
N(UnkNpcAIFunc7)(script);
if (script->functionTemp[0] != 32) {
break;
}
case 32:
N(UnkNpcAIFunc8)(script);
if (script->functionTemp[0] != 33) {
break;
}
case 33:
N(UnkNpcAIFunc5)(script);
break;
case 99:
func_8004A73C(script);
}
return ApiStatus_BLOCK;
}
#include "world/common/atomic/enemy/UnkAI_9.inc.c"
void N(func_80242C58_C42A08)(Evt* script, NpcAISettings* aiSettings, EnemyTerritoryThing* territory) {
Enemy* enemy = script->owner1.enemy;
Npc* npc = get_npc_unsafe(enemy->npcID);
f32 temp_f0;
f32 phi_f20;
npc->duration--;
if (npc->duration <= 0) {
npc->flags &= ~0x00200000;
npc->duration = aiSettings->unk_20 / 2 + rand_int(aiSettings->unk_20 / 2 + 1);
npc->currentAnim.w = enemy->animList[8];
npc->moveSpeed = aiSettings->chaseSpeed;
phi_f20 = atan2(npc->pos.x, npc->pos.z, gPlayerStatusPtr->position.x, gPlayerStatusPtr->position.z);
temp_f0 = get_clamped_angle_diff(npc->yaw, phi_f20);
if (aiSettings->unk_1C.s < fabsf(temp_f0)) {
phi_f20 = npc->yaw;
if (temp_f0 < 0.0f) {
phi_f20 += -aiSettings->unk_1C.s;
} else {
phi_f20 += aiSettings->unk_1C.s;
}
}
npc->yaw = clamp_angle(phi_f20);
script->functionTemp[0] = 13;
}
}
void N(func_80242DB0_C42B60)(Evt* script, NpcAISettings* aiSettings, EnemyTerritoryThing* territory) {
Enemy* enemy = script->owner1.enemy;
Npc* npc = get_npc_unsafe(enemy->npcID);
if (func_800490B4(territory, enemy, aiSettings->chaseRadius, aiSettings->unk_28.f, 1)) {
npc_move_heading(npc, npc->moveSpeed, npc->yaw);
if (dist2D(npc->pos.x, npc->pos.z, gPlayerStatusPtr->position.x,
gPlayerStatusPtr->position.z) <= (npc->moveSpeed * 2.5)) {
npc->duration = 0;
script->functionTemp[0] = 14;
} else {
npc->duration--;
if (npc->duration <= 0) {
npc->flags |= 0x200000;
script->functionTemp[0] = 12;
}
}
} else {
script->functionTemp[0] = 16;
}
}
void N(func_80242EB4_C42C64)(Evt* script, NpcAISettings* aiSettings, EnemyTerritoryThing* territory) {
Enemy* enemy = script->owner1.enemy;
Npc* npc = get_npc_unsafe(enemy->npcID);
s32 i;
for (i = 7; i < 9; i++) {
if ((i != npc->npcID) && (get_enemy(i)->varTable[0] & 0x100)) {
return;
}
}
enemy->varTable[0] |= 0x100;
npc->pos.x = gPlayerStatusPtr->position.x;
npc->pos.z = gPlayerStatusPtr->position.z;
if (!(enemy->varTable[0] & 0x1000)) {
enemy->varTable[0] |= 0x1000;
}
sfx_play_sound_at_position(0x80000011, 2, npc->pos.x, npc->pos.y, npc->pos.z);
npc->duration = 0;
script->functionTemp[0] = 15;
}
void N(func_80242F94_C42D44)(Evt* script, NpcAISettings* aiSettings, EnemyTerritoryThing* territory) {
Enemy* enemy = script->owner1.enemy;
Npc* npc = get_npc_unsafe(enemy->npcID);
f32 posX, posY, posZ, posW;
s32 temp_f8_2;
sfx_adjust_env_sound_pos(0x80000011, 2, npc->pos.x, npc->pos.y, npc->pos.z);
if (!func_800490B4(territory, enemy, aiSettings->chaseRadius, aiSettings->unk_28.f, 1)) {
enemy->varTable[0] &= ~0x100;
npc->rotation.y = 0.0f;
npc->flags &= ~0x00200000;
script->functionTemp[0] = 16;
} else {
PlayerStatus** playerStatus = &gPlayerStatusPtr;
npc->pos.x = gPlayerStatusPtr->position.x;
npc->pos.z = gPlayerStatusPtr->position.z + 2.0f;
npc->rotation.y += 25.0f;
if (npc->rotation.y > 360.0) {
npc->rotation.y -= 360.0;
}
temp_f8_2 = 255.0f - (cosine((s32)npc->rotation.y % 180) * 56.0f);
func_802DE894(npc->spriteInstanceID, 6, temp_f8_2, temp_f8_2, temp_f8_2, 255, 0);
posX = gPlayerStatusPtr->position.x;
posY = gPlayerStatusPtr->position.y;
posZ = gPlayerStatusPtr->position.z;
posW = 1000.0f;
npc_raycast_down_sides(npc->collisionChannel, &posX, &posY, &posZ, &posW);
if (fabsf(npc->pos.y - posY) > 24.0) {
npc->pos.y -= 1.8;
} else {
npc->rotation.y = 0.0f;
npc->flags &= ~0x00200000;
if (gPartnerActionStatus.actingPartner != 9) {
disable_player_input();
partner_disable_input();
npc->duration = 0;
script->functionTemp[0] = 20;
} else {
script->functionTemp[0] = 16;
}
}
}
}
void N(func_80243230_C42FE0)(Evt* script, NpcAISettings* aiSettings, EnemyTerritoryThing* territory) {
Enemy* enemy = script->owner1.enemy;
Npc* npc = get_npc_unsafe(enemy->npcID);
enemy->varTable[0] &= ~0x100;
func_802DE894(npc->spriteInstanceID, 0, 0, 0, 0, 0, 0);
if (enemy->varTable[0] & 0x1000) {
sfx_stop_sound(0x80000011);
enemy->varTable[0] &= ~0x1000;
}
npc->currentAnim.w = enemy->animList[9];
npc->duration = 20;
script->functionTemp[0] = 17;
}
void N(func_802432E8_C43098)(Evt* script, NpcAISettings* aiSettings, EnemyTerritoryThing* territory) {
Enemy* enemy = script->owner1.enemy;
Npc* npc = get_npc_unsafe(enemy->npcID);
f32 posX, posY, posZ, posW;
f32 tmp = enemy->varTable[3];
f32 temp_f20 = tmp / 100.0;
s32 var;
npc->pos.y += 2.5;
posX = npc->pos.x;
posY = npc->pos.y;
posZ = npc->pos.z;
posW = 1000.0f;
npc_raycast_down_sides(npc->collisionChannel, &posX, &posY, &posZ, &posW);
if (!(npc->pos.y < (posY + temp_f20))) {
npc->yaw = atan2(npc->pos.x, npc->pos.z, enemy->territory->wander.point.x, enemy->territory->wander.point.z);
npc->pos.y = posY + temp_f20;
fx_emote(EMOTE_QUESTION, npc, 0.0f, npc->collisionHeight, 1.0f, 2.0f, -20.0f, 10, &var);
npc->duration = 10;
script->functionTemp[0] = 18;
}
}
void N(filemenu_update_show_options_right_C43218)(Evt* script, NpcAISettings* aiSettings, EnemyTerritoryThing* territory) {
Enemy* enemy = script->owner1.enemy;
Npc* npc = get_npc_unsafe(enemy->npcID);
npc->duration--;
if (npc->duration <= 0) {
script->functionTemp[0] = 30;
}
}
void N(func_802434B0_C43260)(Evt* script, NpcAISettings* aiSettings, EnemyTerritoryThing* territory) {
Enemy* enemy = script->owner1.enemy;
Npc* npc = get_npc_unsafe(enemy->npcID);
npc->duration++;
if (npc->duration >= 3) {
if (gPartnerActionStatus.actingPartner != 9) {
npc->duration = 0;
script->functionTemp[0] = 100;
} else {
enable_player_input();
partner_enable_input();
script->functionTemp[0] = 16;
}
}
}
void N(func_80243530_C432E0)(Evt* script, NpcAISettings* aiSettings, EnemyTerritoryThing* territory) {
Enemy* enemy = script->owner1.enemy;
Npc* npc = get_npc_unsafe(enemy->npcID);
enemy->varTable[0] &= ~0x100;
npc->flags &= ~0x00200000;
npc->moveSpeed = 2.0 * aiSettings->moveSpeed;
enemy->varTable[2] = 0;
enemy->varTable[4] = npc->pos.y * 100.0;
script->functionTemp[1] = 0x1E;
}
void N(func_802435D8_C43388)(Evt* script, NpcAISettings* aiSettings, EnemyTerritoryThing* territory) {
Enemy* enemy = script->owner1.enemy;
Npc* npc = get_npc_unsafe(enemy->npcID);
f32 posX = npc->pos.x;
f32 posY = npc->pos.y;
f32 posZ = npc->pos.z;
f32 posW = 1000.0f;
f32 temp_f26 = (f32)enemy->varTable[3] / 100.0;
f32 temp_f24 = temp_f26 + (f32)((f32)enemy->varTable[7] / 100.0);
f32 temp_f22 = (f32)enemy->varTable[1] / 100.0;
f32 temp_f20 = sin_deg(enemy->varTable[2]);
s32 var;
s32 var2;
if (npc_raycast_down_sides(npc->collisionChannel, &posX, &posY, &posZ, &posW)) {
npc->pos.y = posY + temp_f26 + (temp_f20 * temp_f22);
} else {
npc->pos.y = temp_f24 + (temp_f20 * temp_f22);
}
enemy->varTable[2] = clamp_angle(enemy->varTable[2] + 12);
if (script->functionTemp[1] <= 0) {
script->functionTemp[1] = aiSettings->unk_14;
if (func_800490B4(territory, enemy, aiSettings->alertRadius * 0.5, aiSettings->unk_10.f * 0.5, 0)) {
fx_emote(EMOTE_EXCLAMATION, npc, 0.0f, npc->collisionHeight, 1.0f, 2.0f, -20.0f, 12, &var);
ai_enemy_play_sound(npc, 0x2F4, 0x200000);
npc->moveToPos.y = npc->pos.y;
script->functionTemp[0] = 12;
return;
}
}
script->functionTemp[1]--;
if (npc->turnAroundYawAdjustment == 0) {
npc->yaw = atan2(npc->pos.x, npc->pos.z, enemy->territory->wander.point.x, enemy->territory->wander.point.z);
npc_move_heading(npc, npc->moveSpeed, npc->yaw);
posW = dist2D(npc->pos.x, npc->pos.z, enemy->territory->wander.point.x, enemy->territory->wander.point.z);
if (posW <= (2.0f * npc->moveSpeed)) {
script->functionTemp[1] = (rand_int(1000) % 3) + 2;
script->functionTemp[0] = 2;
}
}
}
ApiStatus N(func_802438F0_C436A0)(Evt* script, s32 isInitialCall) {
Enemy* enemy = script->owner1.enemy;
Npc* npc = get_npc_unsafe(enemy->npcID);
Bytecode* args = script->ptrReadPos;
EnemyTerritoryThing territory;
EnemyTerritoryThing* territoryPtr = &territory;
NpcAISettings* npcAISettings = (NpcAISettings*) evt_get_variable(script, *args);
territory.unk_00 = 0;
territory.shape = enemy->territory->wander.detectShape;
territory.pointX = enemy->territory->wander.detect.x;
territory.pointZ = enemy->territory->wander.detect.z;
territory.sizeX = enemy->territory->wander.detectSizeX;
territory.sizeZ = enemy->territory->wander.detectSizeZ;
territory.unk_18 = 125.0f;
territory.unk_1C = 0;
if (isInitialCall) {
script->functionTemp[0] = 0;
N(UnkFunc5)(npc, enemy, script, npcAISettings);
}
switch (script->functionTemp[0]) {
case 0:
N(UnkNpcAIFunc23)(script, npcAISettings, territoryPtr);
func_802DE894(npc->spriteInstanceID, 0, 0, 0, 0, 0, 0);
case 1:
N(UnkNpcAIFunc35)(script, npcAISettings, territoryPtr);
if (script->functionTemp[0] == 12) {
npc->duration = 6;
}
break;
case 2:
N(UnkNpcAIFunc1_copy)(script, npcAISettings, territoryPtr);
case 3:
N(UnkFunc4)(script, npcAISettings, territoryPtr);
if (script->functionTemp[0] == 12) {
npc->duration = 6;
}
break;
case 12:
N(func_80242C58_C42A08)(script, npcAISettings, territoryPtr);
if (script->functionTemp[0] != 13) {
break;
}
case 13:
N(func_80242DB0_C42B60)(script, npcAISettings, territoryPtr);
break;
case 14:
N(func_80242EB4_C42C64)(script, npcAISettings, territoryPtr);
if (script->functionTemp[0] != 15) {
break;
}
case 15:
N(func_80242F94_C42D44)(script, npcAISettings, territoryPtr);
break;
case 16:
N(func_80243230_C42FE0)(script, npcAISettings, territoryPtr);
case 17:
N(func_802432E8_C43098)(script, npcAISettings, territoryPtr);
break;
case 18:
N(filemenu_update_show_options_right_C43218)(script, npcAISettings, territoryPtr);
break;
case 20:
N(func_802434B0_C43260)(script, npcAISettings, territoryPtr);
break;
case 30:
N(func_80243530_C432E0)(script, npcAISettings, territoryPtr);
case 31:
N(func_802435D8_C43388)(script, npcAISettings, territoryPtr);
}
return (script->functionTemp[0] == 100) * ApiStatus_DONE2;
}
#define AI_SENTINEL_FIRST_NPC 7
#define AI_SENTINEL_LAST_NPC 9
#include "world/common/enemy/SentinelAI.inc.c"
#include "world/common/UnkFunc1.inc.c"
@ -1410,12 +1002,12 @@ ApiStatus N(func_80243B98_C43948)(Evt* script, s32 isInitialCall) {
if (get_enemy_safe(9) != 0) {
Enemy* enemy = get_enemy(9);
enemy->territory->wander.point.x = 2;
enemy->territory->wander.point.y = -0x1C2;
enemy->territory->wander.point.y = -450;
enemy->territory->wander.point.z = 0;
enemy->territory->wander.wanderSizeX = 0xAF;
enemy->territory->wander.wanderSizeZ = 0x12C;
enemy->territory->wander.wanderSizeX = 175;
enemy->territory->wander.wanderSizeZ = 300;
enemy->territory->wander.moveSpeedOverride = 0;
enemy->territory->wander.wanderShape = 0xAF;
enemy->territory->wander.wanderShape = 175;
return ApiStatus_DONE2;
}
@ -1425,7 +1017,7 @@ ApiStatus N(func_80243B98_C43948)(Evt* script, s32 isInitialCall) {
ApiStatus N(func_80243C10_C439C0)(Evt* script, s32 isInitialCall) {
if (get_enemy_safe(9)) {
Enemy* enemy = get_enemy(9);
enemy->unk_B0 |= 0x80;
enemy->aiFlags |= 0x80;
return ApiStatus_DONE2;
}
@ -1433,7 +1025,7 @@ ApiStatus N(func_80243C10_C439C0)(Evt* script, s32 isInitialCall) {
}
ApiStatus N(func_80243C50_C43A00)(Evt* script, s32 isInitialCall) {
ai_enemy_play_sound(get_npc_unsafe(script->owner1.enemy->npcID), 0x32F, 0);
ai_enemy_play_sound(get_npc_unsafe(script->owner1.enemy->npcID), SOUND_32F, 0);
return ApiStatus_DONE2;
}

View File

@ -7,10 +7,10 @@
#define NAMESPACE dgb_08
ApiStatus N(UnkFunc1)(Evt* script, s32 isInitialCall);
ApiStatus N(UnkNpcAIMainFunc)(Evt* script, s32 isInitialCall);
ApiStatus N(UnkFunc7)(Evt* script, s32 isInitialCall);
ApiStatus N(func_802414AC_C4125C)(Evt* script, s32 isInitialCall);
ApiStatus N(func_802438F0_C436A0)(Evt* script, s32 isInitialCall);
ApiStatus N(PatrolNoAttackAI_Main)(Evt* script, s32 isInitialCall);
ApiStatus N(MeleeHitbox_Main)(Evt* script, s32 isInitialCall);
ApiStatus N(WanderMeleeAI_Main)(Evt* script, s32 isInitialCall);
ApiStatus N(SentinelAI_Main)(Evt* script, s32 isInitialCall);
ApiStatus N(func_80243B98_C43948)(Evt* script, s32 isInitialCall);
ApiStatus N(func_80243C10_C439C0)(Evt* script, s32 isInitialCall);
ApiStatus N(func_80243C50_C43A00)(Evt* script, s32 isInitialCall);

View File

@ -228,14 +228,14 @@ NpcAISettings N(npcAISettings_802440EC) = {
.moveTime = 120,
.waitTime = 30,
.alertRadius = 85.0f,
.unk_10 = { .f = 65.0f },
.unk_14 = 5,
.alertOffsetDist = 65.0f,
.playerSearchInterval = 5,
.chaseSpeed = 3.5f,
.unk_1C = { .s = 90 },
.unk_20 = 12,
.chaseTurnRate= 90,
.chaseUpdateInterval = 12,
.chaseRadius = 110.0f,
.unk_28 = { .f = 90.0f },
.unk_2C = 3,
.chaseOffsetDist = 90.0f,
.unk_AI_2C = 3,
};
EvtScript N(npcAI_8024411C) = {
@ -243,7 +243,7 @@ EvtScript N(npcAI_8024411C) = {
EVT_CALL(SetSelfVar, 1, 5)
EVT_CALL(SetSelfVar, 2, 8)
EVT_CALL(SetSelfVar, 3, 12)
EVT_CALL(N(func_8024061C_C471FC), EVT_PTR(N(npcAISettings_802440EC)))
EVT_CALL(N(WanderMeleeAI_Main), EVT_PTR(N(npcAISettings_802440EC)))
EVT_RETURN
EVT_END
};
@ -262,14 +262,14 @@ NpcAISettings N(npcAISettings_802441B8) = {
.moveTime = 120,
.waitTime = 30,
.alertRadius = 100.0f,
.unk_10 = { .f = 40.0f },
.unk_14 = 10,
.alertOffsetDist = 40.0f,
.playerSearchInterval = 10,
.chaseSpeed = 3.5f,
.unk_1C = { .s = 90 },
.unk_20 = 15,
.chaseTurnRate= 90,
.chaseUpdateInterval = 15,
.chaseRadius = 200.0f,
.unk_28 = { .f = 160.0f },
.unk_2C = 1,
.chaseOffsetDist = 160.0f,
.unk_AI_2C = 1,
};
EvtScript N(npcAI_802441E8) = {
@ -277,7 +277,7 @@ EvtScript N(npcAI_802441E8) = {
EVT_CALL(SetSelfVar, 1, 10)
EVT_CALL(SetSelfVar, 2, 14)
EVT_CALL(SetSelfVar, 3, 18)
EVT_CALL(N(func_802410D4_C47CB4), EVT_PTR(N(npcAISettings_802441B8)))
EVT_CALL(N(ClubbaNappingAI_Main), EVT_PTR(N(npcAISettings_802441B8)))
EVT_RETURN
EVT_END
};
@ -299,7 +299,7 @@ EvtScript N(npcAI_80244284) = {
EVT_CALL(SetSelfVar, 3, 32)
EVT_CALL(SetSelfVar, 4, 3)
EVT_CALL(SetSelfVar, 15, 8389)
EVT_CALL(N(UnkFunc7))
EVT_CALL(N(MeleeHitbox_Main))
EVT_RETURN
EVT_END
};
@ -313,14 +313,14 @@ NpcSettings N(npcSettings_8024432C) = {
.unk_2A = 8,
};
f32 N(sixFloats)[] = {
f32 N(FlyingAI_JumpVels)[] = {
4.5f, 3.5f, 2.6f, 2.0f,
1.5f, 20.0f,
};
EvtScript N(80244370) = {
EVT_CALL(SetSelfEnemyFlagBits, ((NPC_FLAG_MOTION_BLUR | NPC_FLAG_1000000 | NPC_FLAG_SIMPLIFIED_PHYSICS | NPC_FLAG_PARTICLE | NPC_FLAG_8000000 | NPC_FLAG_10000000 | NPC_FLAG_20000000)), TRUE)
EVT_CALL(SetNpcFlagBits, NPC_SELF, ((NPC_FLAG_100 | NPC_FLAG_LOCK_ANIMS | NPC_FLAG_NO_Y_MOVEMENT)), TRUE)
EVT_CALL(SetNpcFlagBits, NPC_SELF, ((NPC_FLAG_100 | NPC_FLAG_LOCK_ANIMS | NPC_FLAG_JUMPING)), TRUE)
EVT_RETURN
EVT_END
};
@ -330,12 +330,12 @@ NpcAISettings N(npcAISettings_802443AC) = {
.moveTime = 90,
.waitTime = 30,
.alertRadius = 240.0f,
.unk_14 = 1,
.playerSearchInterval = 1,
.chaseSpeed = 5.3f,
.unk_1C = { .s = 180 },
.unk_20 = 1,
.chaseTurnRate= 180,
.chaseUpdateInterval = 1,
.chaseRadius = 240.0f,
.unk_2C = 1,
.unk_AI_2C = 1,
};
extern const char N(dgb_00_name_hack)[];
@ -345,7 +345,7 @@ EvtScript N(npcAI_802443DC) = {
EVT_CALL(SetSelfVar, 5, -650)
EVT_CALL(SetSelfVar, 6, 30)
EVT_CALL(SetSelfVar, 1, 600)
EVT_CALL(N(func_80243578_C4A158), EVT_PTR(N(npcAISettings_802443AC)))
EVT_CALL(N(SentinelAI_Main), EVT_PTR(N(npcAISettings_802443AC)))
EVT_CALL(DisablePlayerInput, TRUE)
EVT_WAIT_FRAMES(2)
EVT_LABEL(20)
@ -441,7 +441,7 @@ StaticNpc N(npcGroup_80244920)[] = {
.id = NPC_WORLD_CLUBBA0,
.settings = &N(npcSettings_8024418C),
.pos = { -350.0f, 0.0f, 180.0f },
.flags = NPC_FLAG_100 | NPC_FLAG_LOCK_ANIMS | NPC_FLAG_NO_Y_MOVEMENT,
.flags = NPC_FLAG_100 | NPC_FLAG_LOCK_ANIMS | NPC_FLAG_JUMPING,
.yaw = 270,
.dropFlags = NPC_DROP_FLAGS_80,
.itemDropChance = 5,
@ -478,7 +478,7 @@ StaticNpc N(npcGroup_80244920)[] = {
.id = NPC_WORLD_CLUBBA1,
.settings = &N(npcSettings_8024432C),
.pos = { 0.0f, -1000.0f, 0.0f },
.flags = NPC_FLAG_100 | NPC_FLAG_LOCK_ANIMS | NPC_FLAG_NO_Y_MOVEMENT | NPC_FLAG_NO_DROPS,
.flags = NPC_FLAG_100 | NPC_FLAG_LOCK_ANIMS | NPC_FLAG_JUMPING | NPC_FLAG_NO_DROPS,
.yaw = 0,
.dropFlags = NPC_DROP_FLAGS_80,
.heartDrops = NO_DROPS,
@ -520,7 +520,7 @@ StaticNpc N(npcGroup_80244D6C)[] = {
.id = NPC_WORLD_CLUBBA2,
.settings = &N(npcSettings_80244258),
.pos = { 310.0f, 0.0f, 88.0f },
.flags = NPC_FLAG_100 | NPC_FLAG_LOCK_ANIMS | NPC_FLAG_NO_Y_MOVEMENT,
.flags = NPC_FLAG_100 | NPC_FLAG_LOCK_ANIMS | NPC_FLAG_JUMPING,
.init = &N(init_80244D00),
.yaw = 270,
.dropFlags = NPC_DROP_FLAGS_80,
@ -558,7 +558,7 @@ StaticNpc N(npcGroup_80244D6C)[] = {
.id = NPC_WORLD_CLUBBA3,
.settings = &N(npcSettings_8024432C),
.pos = { 0.0f, -1000.0f, 0.0f },
.flags = NPC_FLAG_100 | NPC_FLAG_LOCK_ANIMS | NPC_FLAG_NO_Y_MOVEMENT | NPC_FLAG_NO_DROPS,
.flags = NPC_FLAG_100 | NPC_FLAG_LOCK_ANIMS | NPC_FLAG_JUMPING | NPC_FLAG_NO_DROPS,
.yaw = 0,
.dropFlags = NPC_DROP_FLAGS_80,
.heartDrops = NO_DROPS,
@ -622,692 +622,12 @@ NpcGroupList N(npcGroupList_8024533C) = {
{},
};
#include "world/common/UnkNpcAIFunc6.inc.c"
#include "world/common/enemy/WanderMeleeAI.inc.c"
#include "world/common/UnkNpcAIFunc7.inc.c"
#include "world/common/enemy/ClubbaNappingAI.inc.c"
#include "world/common/UnkNpcAIFunc8.inc.c"
#include "world/common/UnkNpcAIFunc5.inc.c"
#include "world/common/UnkNpcAIFunc26.inc.c"
#include "world/common/UnkFunc7.inc.c"
ApiStatus N(func_8024061C_C471FC)(Evt* script, s32 isInitialCall) {
Enemy* enemy = script->owner1.enemy;
Npc* npc = get_npc_unsafe(enemy->npcID);
Bytecode* args = script->ptrReadPos;
EnemyTerritoryThing territory;
EnemyTerritoryThing* territoryPtr = &territory;
NpcAISettings* npcAISettings = (NpcAISettings*)evt_get_variable(script, *args++);
territory.unk_00 = 0;
territory.shape = enemy->territory->wander.detectShape;
territory.pointX = enemy->territory->wander.detect.x;
territory.pointZ = enemy->territory->wander.detect.z;
territory.sizeX = enemy->territory->wander.detectSizeX;
territory.sizeZ = enemy->territory->wander.detectSizeZ;
territory.unk_18 = 65.0f;
territory.unk_1C = 0;
if (isInitialCall || (enemy->unk_B0 & ENEMY_AI_FLAGS_4)) {
script->functionTemp[0] = 0;
npc->duration = 0;
npc->currentAnim.w = enemy->animList[0];
npc->flags &= ~0x800;
if (!enemy->territory->wander.isFlying) {
npc->flags = (npc->flags | 0x200) & ~0x8;
} else {
npc->flags = (npc->flags & ~0x200) | 0x8;
}
if (enemy->unk_B0 & ENEMY_AI_FLAGS_4) {
script->functionTemp[0] = 99;
script->functionTemp[1] = 0;
enemy->unk_B0 &= ~ENEMY_AI_FLAGS_4;
}
enemy->varTable[0] = 0;
}
if ((script->functionTemp[0] < 30) && (enemy->varTable[0] == 0) && N(UnkNpcAIFunc26)(script)) {
script->functionTemp[0] = 30;
}
switch (script->functionTemp[0]) {
case 0:
func_800495A0(script, npcAISettings, territoryPtr);
case 1:
func_800496B8(script, npcAISettings, territoryPtr);
break;
case 2:
base_UnkNpcAIFunc1(script, npcAISettings, territoryPtr);
case 3:
func_80049C04(script, npcAISettings, territoryPtr);
break;
case 10:
func_80049E3C(script, npcAISettings, territoryPtr);
case 11:
func_80049ECC(script, npcAISettings, territoryPtr);
break;
case 12:
func_80049F7C(script, npcAISettings, territoryPtr);
case 13:
func_8004A124(script, npcAISettings, territoryPtr);
break;
case 14:
func_8004A3E8(script, npcAISettings, territoryPtr);
break;
case 30:
N(UnkNpcAIFunc6)(script);
case 31:
N(UnkNpcAIFunc7)(script);
if (script->functionTemp[0] != 32) {
break;
}
case 32:
N(UnkNpcAIFunc8)(script);
if (script->functionTemp[0] != 33) {
break;
}
case 33:
N(UnkNpcAIFunc5)(script);
break;
case 99:
func_8004A73C(script);
}
return ApiStatus_BLOCK;
}
void N(func_802408D0_C474B0)(Evt* script, NpcAISettings* aiSettings, EnemyTerritoryThing* territory) {
Enemy* enemy = script->owner1.enemy;
Npc* npc = get_npc_unsafe(enemy->npcID);
if (npc->duration > 0) {
npc->duration--;
}
if (npc->duration == 1) {
npc->currentAnim.w = enemy->animList[12];
} else if (npc->duration <= 0) {
npc->currentAnim.w = enemy->animList[10];
npc->duration = 0;
script->functionTemp[0] = 1;
}
}
void N(func_80240958_C47538)(Evt* script, NpcAISettings* aiSettings, EnemyTerritoryThing* territory) {
Enemy* enemy = script->owner1.enemy;
Npc* npc = get_npc_unsafe(enemy->npcID);
PlayerData* playerData = get_player_data();
s32 phi_s2 = FALSE;
s32 var;
f32 posX, posZ;
if (func_800490B4(territory, enemy, 80.0f, 0.0f, 0)) {
if ((gPlayerStatusPtr->actionState == 2) || (gPlayerStatusPtr->actionState == 26) ||
(gPlayerStatusPtr->actionState == 3) || (gPlayerStatusPtr->actionState == 14) ||
(gPlayerStatusPtr->actionState == 16) || (gPlayerStatusPtr->actionState == 11) ||
(gPlayerStatusPtr->actionState == 10) || (gPlayerStatusPtr->actionState == 18) ||
(gPlayerStatusPtr->actionState == 19) || (gPlayerStatusPtr->actionState == 37)) {
phi_s2 = TRUE;
}
if (playerData->currentPartner == PARTNER_KOOPER) {
if (gPartnerActionStatus.partnerActionState == playerData->currentPartner) {
phi_s2 = TRUE;
}
}
}
if (((playerData->currentPartner == PARTNER_GOOMBARIO) && (gPartnerActionStatus.partnerActionState != PARTNER_ACTION_NONE)) ||
((playerData->currentPartner == PARTNER_BOMBETTE) && (gPartnerActionStatus.partnerActionState == PARTNER_ACTION_BOMBETTE_2))) {
posX = npc->pos.x;
posZ = npc->pos.z;
add_vec2D_polar(&posX, &posZ, 0.0f, npc->yaw);
if (dist2D(posX, posZ, wPartnerNpc->pos.x, wPartnerNpc->pos.z) <= 80.0f) {
phi_s2 = TRUE;
}
}
if (phi_s2) {
ai_enemy_play_sound(npc, 0xB000000E, 0);
npc->currentAnim.w = enemy->animList[11];
npc->duration = 10;
fx_emote(EMOTE_EXCLAMATION, npc, 0.0f, npc->collisionHeight, 1.0f, 2.0f, -20.0f, 15, &var);
ai_enemy_play_sound(npc, 0x2F4, 0x200000);
script->functionTemp[0] = 2;
}
npc->duration++;
if (npc->duration == 27) {
ai_enemy_play_sound(npc, 0xB000000C, 0);
} else if (npc->duration == 57) {
ai_enemy_play_sound(npc, 0xB000000D, 0);
} else if (npc->duration == 59) {
npc->currentAnim.w = enemy->animList[12];
} else if (npc->duration == 60) {
npc->currentAnim.w = enemy->animList[10];
npc->duration = 0;
}
}
void N(func_80240C10_C477F0)(Evt* script, NpcAISettings* aiSettings, EnemyTerritoryThing* territory) {
Enemy* enemy = script->owner1.enemy;
Npc* npc = get_npc_unsafe(enemy->npcID);
npc->duration--;
if (npc->duration <= 0) {
npc->duration = 1;
enemy->varTable[7] = 40;
script->functionTemp[0] = 3;
}
}
void N(func_80240C74_C47854)(Evt* script, NpcAISettings* aiSettings, EnemyTerritoryThing* territory) {
Enemy* enemy = script->owner1.enemy;
Npc* npc = get_npc_unsafe(enemy->npcID);
npc->yaw = clamp_angle((npc->yaw + rand_int(180)) - 90.0f);
npc->currentAnim.w = enemy->animList[0];
script->functionTemp[1] = (rand_int(1000) % 2) + 2;
script->functionTemp[0] = 4;
}
void N(func_80240D1C_C478FC)(Evt* script, NpcAISettings* aiSettings, EnemyTerritoryThing* territory) {
Enemy* enemy = script->owner1.enemy;
Npc* npc = get_npc_unsafe(enemy->npcID);
s32 var;
if (func_800490B4(territory, enemy, aiSettings->chaseRadius, aiSettings->unk_28.f, 0)) {
npc->yaw = atan2(npc->pos.x, npc->pos.z, gPlayerStatusPtr->position.x, gPlayerStatusPtr->position.z);
script->functionTemp[0] = 12;
return;
}
npc->duration--;
if (npc->duration <= 0) {
script->functionTemp[1]--;
if (script->functionTemp[1] > 0) {
npc->yaw = clamp_angle(npc->yaw + 180.0f);
npc->duration = aiSettings->waitTime / 2 + rand_int(aiSettings->waitTime / 2 + 1);
return;
}
var = enemy->varTable[7];
if (var == 40) {
npc->duration = 20;
script->functionTemp[0] = var;
} else if (var == 50) {
npc->duration = 25;
script->functionTemp[0] = var;
}
}
}
void N(func_80240E54_C47A34)(Evt* script, NpcAISettings* aiSettings, EnemyTerritoryThing* territory) {
Enemy* enemy = script->owner1.enemy;
Npc* npc = get_npc_unsafe(enemy->npcID);
npc->duration--;
if (npc->duration <= 0) {
npc->currentAnim.w = enemy->animList[1];
if (enemy->territory->wander.moveSpeedOverride < 0) {
npc->moveSpeed = aiSettings->moveSpeed;
} else {
npc->moveSpeed = enemy->territory->wander.moveSpeedOverride / 32767.0;
}
script->functionTemp[0] = 0x29;
}
}
void N(func_80240F00_C47AE0)(Evt* script, NpcAISettings* aiSettings, EnemyTerritoryThing* territory) {
Enemy* enemy = script->owner1.enemy;
Npc* npc = get_npc_unsafe(enemy->npcID);
f32 var;
if (func_800490B4(territory, enemy, aiSettings->chaseRadius, aiSettings->unk_28.f, 0)) {
npc->yaw = atan2(npc->pos.x, npc->pos.z, gPlayerStatusPtr->position.x, gPlayerStatusPtr->position.z);
script->functionTemp[0] = 12;
} else if (dist2D(npc->pos.x, npc->pos.z, enemy->territory->wander.point.x,
enemy->territory->wander.point.z) <= npc->moveSpeed) {
npc->currentAnim.w = enemy->animList[0];
npc->duration = 15;
enemy->varTable[7] = 50;
script->functionTemp[0] = 3;
} else if (npc->turnAroundYawAdjustment == 0) {
var = npc->yaw;
func_8004A784(npc, 5.0f, &var, 0, 0, 0);
npc->yaw = var;
npc->yaw = atan2(npc->pos.x, npc->pos.z, enemy->territory->wander.point.x, enemy->territory->wander.point.z);
npc_move_heading(npc, npc->moveSpeed, npc->yaw);
}
}
void N(func_80241078_C47C58)(Evt* script, NpcAISettings* aiSettings, EnemyTerritoryThing* territory) {
Enemy* enemy = script->owner1.enemy;
Npc* npc = get_npc_unsafe(enemy->npcID);
if (npc->turnAroundYawAdjustment == 0) {
npc->duration--;
if (npc->duration <= 0) {
npc->duration = 0;
script->functionTemp[0] = 0;
}
}
}
ApiStatus N(func_802410D4_C47CB4)(Evt* script, s32 isInitialCall) {
Enemy* enemy = script->owner1.enemy;
Npc* npc = get_npc_unsafe(enemy->npcID);
Bytecode* args = script->ptrReadPos;
EnemyTerritoryThing territory;
EnemyTerritoryThing* territoryPtr = &territory;
NpcAISettings* npcAISettings = (NpcAISettings*)evt_get_variable(script, *args++);
territory.unk_00 = 0;
territory.shape = enemy->territory->wander.detectShape;
territory.pointX = enemy->territory->wander.detect.x;
territory.pointZ = enemy->territory->wander.detect.z;
territory.sizeX = enemy->territory->wander.detectSizeX;
territory.sizeZ = enemy->territory->wander.detectSizeZ;
territory.unk_18 = 40.0f;
territory.unk_1C = 0;
if (isInitialCall || (enemy->unk_B0 & ENEMY_AI_FLAGS_4)) {
script->functionTemp[0] = 0;
npc->duration = 30;
npc->currentAnim.w = enemy->animList[10];
npc->flags &= ~0x800;
enemy->varTable[0] = 0;
if (!enemy->territory->wander.isFlying) {
npc->flags = (npc->flags | 0x200) & ~0x8;
} else {
npc->flags = (npc->flags & ~0x200) | 0x8;
}
if (enemy->unk_B0 & ENEMY_AI_FLAGS_4) {
script->functionTemp[0] = 99;
script->functionTemp[1] = 40;
npc->currentAnim.w = enemy->animList[0];
}
enemy->unk_B0 &= ~ENEMY_AI_FLAGS_4;
}
if (((u32)script->functionTemp[0] - 10 < 20) && (enemy->varTable[0] == 0) && N(UnkNpcAIFunc26)(script)) {
script->functionTemp[0] = 30;
}
switch (script->functionTemp[0]) {
case 0:
N(func_802408D0_C474B0)(script, npcAISettings, territoryPtr);
break;
case 1:
N(func_80240958_C47538)(script, npcAISettings, territoryPtr);
break;
case 2:
N(func_80240C10_C477F0)(script, npcAISettings, territoryPtr);
break;
case 3:
N(func_80240C74_C47854)(script, npcAISettings, territoryPtr);
break;
case 4:
N(func_80240D1C_C478FC)(script, npcAISettings, territoryPtr);
break;
case 12:
func_80049F7C(script, npcAISettings, territoryPtr);
if (script->functionTemp[0] != 13) {
break;
}
case 13:
func_8004A124(script, npcAISettings, territoryPtr);
break;
case 14:
func_8004A3E8(script, npcAISettings, territoryPtr);
npc->duration = 15;
enemy->varTable[7] = 40;
script->functionTemp[0] = 3;
break;
case 30:
N(UnkNpcAIFunc6)(script);
if (script->functionTemp[0] != 31) {
break;
}
case 31:
N(UnkNpcAIFunc7)(script);
if (script->functionTemp[0] != 32) {
break;
}
case 32:
N(UnkNpcAIFunc8)(script);
break;
case 33:
N(UnkNpcAIFunc5)(script);
break;
case 40:
N(func_80240E54_C47A34)(script, npcAISettings, territoryPtr);
if (script->functionTemp[0] != 41) {
break;
}
case 41:
N(func_80240F00_C47AE0)(script, npcAISettings, territoryPtr);
break;
case 50:
N(func_80241078_C47C58)(script, npcAISettings, territoryPtr);
break;
case 99:
func_8004A73C(script);
}
return ApiStatus_BLOCK;
}
#include "world/common/atomic/enemy/UnkAI_9.inc.c"
void N(func_8024291C_C494FC)(Evt* script, NpcAISettings* aiSettings, EnemyTerritoryThing* territory) {
Enemy* enemy = script->owner1.enemy;
Npc* npc = get_npc_unsafe(enemy->npcID);
f32 temp_f0;
f32 phi_f20;
npc->duration--;
if (npc->duration <= 0) {
npc->flags &= ~0x00200000;
npc->duration = aiSettings->unk_20 / 2 + rand_int(aiSettings->unk_20 / 2 + 1);
npc->currentAnim.w = enemy->animList[8];
npc->moveSpeed = aiSettings->chaseSpeed;
phi_f20 = atan2(npc->pos.x, npc->pos.z, gPlayerStatusPtr->position.x, gPlayerStatusPtr->position.z);
temp_f0 = get_clamped_angle_diff(npc->yaw, phi_f20);
if (aiSettings->unk_1C.s < fabsf(temp_f0)) {
phi_f20 = npc->yaw;
if (temp_f0 < 0.0f) {
phi_f20 += -aiSettings->unk_1C.s;
} else {
phi_f20 += aiSettings->unk_1C.s;
}
}
npc->yaw = clamp_angle(phi_f20);
script->functionTemp[0] = 13;
}
}
void N(func_80242A74_C49654)(Evt* script, NpcAISettings* aiSettings, EnemyTerritoryThing* territory) {
Enemy* enemy = script->owner1.enemy;
Npc* npc = get_npc_unsafe(enemy->npcID);
if (func_800490B4(territory, enemy, aiSettings->chaseRadius, aiSettings->unk_28.f, 1)) {
npc_move_heading(npc, npc->moveSpeed, npc->yaw);
if (dist2D(npc->pos.x, npc->pos.z, gPlayerStatusPtr->position.x,
gPlayerStatusPtr->position.z) <= (npc->moveSpeed * 2.5)) {
npc->duration = 0;
script->functionTemp[0] = 14;
} else {
npc->duration--;
if (npc->duration <= 0) {
npc->flags |= 0x200000;
script->functionTemp[0] = 12;
}
}
} else {
script->functionTemp[0] = 16;
}
}
void N(func_80242B78_C49758)(Evt* script, NpcAISettings* aiSettings, EnemyTerritoryThing* territory) {
Enemy* enemy = script->owner1.enemy;
Npc* npc = get_npc_unsafe(enemy->npcID);
do { enemy->varTable[0] |= 0x100; npc->pos.x = gPlayerStatusPtr->position.x; } while (0);
npc->pos.z = gPlayerStatusPtr->position.z;
if (!(enemy->varTable[0] & 0x1000)) {
enemy->varTable[0] |= 0x1000;
}
sfx_play_sound_at_position(0x80000011, 2, npc->pos.x, npc->pos.y, npc->pos.z);
npc->duration = 0;
script->functionTemp[0] = 15;
}
void N(func_80242C1C_C497FC)(Evt* script, NpcAISettings* aiSettings, EnemyTerritoryThing* territory) {
Enemy* enemy = script->owner1.enemy;
Npc* npc = get_npc_unsafe(enemy->npcID);
f32 posX, posY, posZ, posW;
s32 temp_f8_2;
sfx_adjust_env_sound_pos(0x80000011, 2, npc->pos.x, npc->pos.y, npc->pos.z);
if (!func_800490B4(territory, enemy, aiSettings->chaseRadius, aiSettings->unk_28.f, 1)) {
enemy->varTable[0] &= ~0x100;
npc->rotation.y = 0.0f;
npc->flags &= ~0x00200000;
script->functionTemp[0] = 16;
} else {
PlayerStatus** playerStatus = &gPlayerStatusPtr;
npc->pos.x = gPlayerStatusPtr->position.x;
npc->pos.z = gPlayerStatusPtr->position.z + 2.0f;
npc->rotation.y += 25.0f;
if (npc->rotation.y > 360.0) {
npc->rotation.y -= 360.0;
}
temp_f8_2 = 255.0f - (cosine((s32)npc->rotation.y % 180) * 56.0f);
func_802DE894(npc->spriteInstanceID, 6, temp_f8_2, temp_f8_2, temp_f8_2, 255, 0);
posX = gPlayerStatusPtr->position.x;
posY = gPlayerStatusPtr->position.y;
posZ = gPlayerStatusPtr->position.z;
posW = 1000.0f;
npc_raycast_down_sides(npc->collisionChannel, &posX, &posY, &posZ, &posW);
if (fabsf(npc->pos.y - posY) > 24.0) {
npc->pos.y -= 1.8;
} else {
npc->rotation.y = 0.0f;
npc->flags &= ~0x00200000;
if (gPartnerActionStatus.actingPartner != 9) {
disable_player_input();
partner_disable_input();
npc->duration = 0;
script->functionTemp[0] = 20;
} else {
script->functionTemp[0] = 16;
}
}
}
}
void N(func_80242EB8_C49A98)(Evt* script, NpcAISettings* aiSettings, EnemyTerritoryThing* territory) {
Enemy* enemy = script->owner1.enemy;
Npc* npc = get_npc_unsafe(enemy->npcID);
enemy->varTable[0] &= ~0x100;
func_802DE894(npc->spriteInstanceID, 0, 0, 0, 0, 0, 0);
if (enemy->varTable[0] & 0x1000) {
sfx_stop_sound(0x80000011);
enemy->varTable[0] &= ~0x1000;
}
npc->currentAnim.w = enemy->animList[9];
npc->duration = 20;
script->functionTemp[0] = 17;
}
void N(func_80242F70_C49B50)(Evt* script, NpcAISettings* aiSettings, EnemyTerritoryThing* territory) {
Enemy* enemy = script->owner1.enemy;
Npc* npc = get_npc_unsafe(enemy->npcID);
f32 posX, posY, posZ, posW;
f32 tmp = enemy->varTable[3];
f32 temp_f20 = tmp / 100.0;
s32 var;
npc->pos.y += 2.5;
posX = npc->pos.x;
posY = npc->pos.y;
posZ = npc->pos.z;
posW = 1000.0f;
npc_raycast_down_sides(npc->collisionChannel, &posX, &posY, &posZ, &posW);
if (!(npc->pos.y < (posY + temp_f20))) {
npc->yaw = atan2(npc->pos.x, npc->pos.z, enemy->territory->wander.point.x, enemy->territory->wander.point.z);
npc->pos.y = posY + temp_f20;
fx_emote(EMOTE_QUESTION, npc, 0.0f, npc->collisionHeight, 1.0f, 2.0f, -20.0f, 10, &var);
npc->duration = 10;
script->functionTemp[0] = 18;
}
}
void N(func_802430F0_C49CD0)(Evt* script, NpcAISettings* aiSettings, EnemyTerritoryThing* territory) {
Enemy* enemy = script->owner1.enemy;
Npc* npc = get_npc_unsafe(enemy->npcID);
npc->duration--;
if (npc->duration <= 0) {
script->functionTemp[0] = 30;
}
}
void N(func_80243138_C49D18)(Evt* script, NpcAISettings* aiSettings, EnemyTerritoryThing* territory) {
Enemy* enemy = script->owner1.enemy;
Npc* npc = get_npc_unsafe(enemy->npcID);
npc->duration++;
if (npc->duration >= 3) {
if (gPartnerActionStatus.actingPartner != 9) {
npc->duration = 0;
script->functionTemp[0] = 100;
} else {
enable_player_input();
partner_enable_input();
script->functionTemp[0] = 16;
}
}
}
void N(func_802431B8_C49D98)(Evt* script, NpcAISettings* aiSettings, EnemyTerritoryThing* territory) {
Enemy* enemy = script->owner1.enemy;
Npc* npc = get_npc_unsafe(enemy->npcID);
enemy->varTable[0] &= ~0x100;
npc->flags &= ~0x00200000;
npc->moveSpeed = 2.0 * aiSettings->moveSpeed;
enemy->varTable[2] = 0;
enemy->varTable[4] = npc->pos.y * 100.0;
script->functionTemp[1] = 0x1E;
}
void N(func_80243260_C49E40)(Evt* script, NpcAISettings* aiSettings, EnemyTerritoryThing* territory) {
Enemy* enemy = script->owner1.enemy;
Npc* npc = get_npc_unsafe(enemy->npcID);
f32 posX = npc->pos.x;
f32 posY = npc->pos.y;
f32 posZ = npc->pos.z;
f32 posW = 1000.0f;
f32 temp_f26 = (f32)enemy->varTable[3] / 100.0;
f32 temp_f24 = temp_f26 + (f32)((f32)enemy->varTable[7] / 100.0);
f32 temp_f22 = (f32)enemy->varTable[1] / 100.0;
f32 temp_f20 = sin_deg(enemy->varTable[2]);
s32 var;
s32 var2;
if (npc_raycast_down_sides(npc->collisionChannel, &posX, &posY, &posZ, &posW)) {
npc->pos.y = posY + temp_f26 + (temp_f20 * temp_f22);
} else {
npc->pos.y = temp_f24 + (temp_f20 * temp_f22);
}
enemy->varTable[2] = clamp_angle(enemy->varTable[2] + 12);
if (script->functionTemp[1] <= 0) {
script->functionTemp[1] = aiSettings->unk_14;
if (func_800490B4(territory, enemy, aiSettings->alertRadius * 0.5, aiSettings->unk_10.f * 0.5, 0)) {
fx_emote(EMOTE_EXCLAMATION, npc, 0.0f, npc->collisionHeight, 1.0f, 2.0f, -20.0f, 12, &var);
ai_enemy_play_sound(npc, 0x2F4, 0x200000);
npc->moveToPos.y = npc->pos.y;
script->functionTemp[0] = 12;
return;
}
}
script->functionTemp[1]--;
if (npc->turnAroundYawAdjustment == 0) {
npc->yaw = atan2(npc->pos.x, npc->pos.z, enemy->territory->wander.point.x, enemy->territory->wander.point.z);
npc_move_heading(npc, npc->moveSpeed, npc->yaw);
posW = dist2D(npc->pos.x, npc->pos.z, enemy->territory->wander.point.x, enemy->territory->wander.point.z);
if (posW <= (2.0f * npc->moveSpeed)) {
script->functionTemp[1] = (rand_int(1000) % 3) + 2;
script->functionTemp[0] = 2;
}
}
}
ApiStatus N(func_80243578_C4A158)(Evt* script, s32 isInitialCall) {
Enemy* enemy = script->owner1.enemy;
Npc* npc = get_npc_unsafe(enemy->npcID);
Bytecode* args = script->ptrReadPos;
EnemyTerritoryThing territory;
EnemyTerritoryThing* territoryPtr = &territory;
NpcAISettings* aiSettings =(NpcAISettings*) evt_get_variable(script, *args);
territory.unk_00 = 0;
territory.shape = enemy->territory->wander.detectShape;
territory.pointX = enemy->territory->wander.detect.x;
territory.pointZ = enemy->territory->wander.detect.z;
territory.sizeX = enemy->territory->wander.detectSizeX;
territory.sizeZ = enemy->territory->wander.detectSizeZ;
territory.unk_18 = 125.0f;
territory.unk_1C = 0;
if (isInitialCall) {
script->functionTemp[0] = 0;
N(UnkFunc5)(npc, enemy, script, aiSettings);
}
switch (script->functionTemp[0]) {
case 0:
N(UnkNpcAIFunc23)(script, aiSettings, territoryPtr);
func_802DE894(npc->spriteInstanceID, 0, 0, 0, 0, 0, 0);
case 1:
N(UnkNpcAIFunc35)(script, aiSettings, territoryPtr);
if (script->functionTemp[0] == 12) {
npc->duration = 6;
}
break;
case 2:
N(UnkNpcAIFunc1_copy)(script, aiSettings, territoryPtr);
case 3:
N(UnkFunc4)(script, aiSettings, territoryPtr);
if (script->functionTemp[0] == 12) {
npc->duration = 6;
}
break;
case 12:
N(func_8024291C_C494FC)(script, aiSettings, territoryPtr);
if (script->functionTemp[0] != 13) {
break;
}
case 13:
N(func_80242A74_C49654)(script, aiSettings, territoryPtr);
break;
case 14:
N(func_80242B78_C49758)(script, aiSettings, territoryPtr);
if (script->functionTemp[0] != 15) {
break;
}
case 15:
N(func_80242C1C_C497FC)(script, aiSettings, territoryPtr);
break;
case 16:
N(func_80242EB8_C49A98)(script, aiSettings, territoryPtr);
case 17:
N(func_80242F70_C49B50)(script, aiSettings, territoryPtr);
break;
case 18:
N(func_802430F0_C49CD0)(script, aiSettings, territoryPtr);
break;
case 20:
N(func_80243138_C49D18)(script, aiSettings, territoryPtr);
break;
case 30:
N(func_802431B8_C49D98)(script, aiSettings, territoryPtr);
case 31:
N(func_80243260_C49E40)(script, aiSettings, territoryPtr);
}
return (script->functionTemp[0] == 100) * ApiStatus_DONE2;
}
#define AI_SENTINEL_FIRST_NPC 0
#define AI_SENTINEL_LAST_NPC 0
#include "world/common/enemy/SentinelAI.inc.c"
const char N(dgb_00_name_hack)[] = "dgb_00";

View File

@ -6,10 +6,10 @@
#define NAMESPACE dgb_09
ApiStatus N(func_8024061C_C471FC)(Evt* script, s32 isInitialCall);
ApiStatus N(func_802410D4_C47CB4)(Evt* script, s32 isInitialCall);
ApiStatus N(func_80243578_C4A158)(Evt* script, s32 isInitialCall);
ApiStatus N(UnkFunc7)(Evt *script, s32 isInitialCall);
ApiStatus N(WanderMeleeAI_Main)(Evt* script, s32 isInitialCall);
ApiStatus N(ClubbaNappingAI_Main)(Evt* script, s32 isInitialCall);
ApiStatus N(SentinelAI_Main)(Evt* script, s32 isInitialCall);
ApiStatus N(MeleeHitbox_Main)(Evt *script, s32 isInitialCall);
extern NpcGroupList N(npcGroupList_8024533C);
extern EvtScript N(80243F6C);

View File

@ -184,7 +184,7 @@ EvtScript N(80241FBC) = {
EVT_CALL(SetSelfVar, 1, 5)
EVT_CALL(SetSelfVar, 2, 8)
EVT_CALL(SetSelfVar, 3, 12)
EVT_CALL(N(func_8024061C_C4FB2C), EVT_PTR(N(D_80241F8C_C5149C)))
EVT_CALL(N(WanderMeleeAI_Main), EVT_PTR(N(D_80241F8C_C5149C)))
EVT_RETURN
EVT_END
};
@ -202,7 +202,7 @@ EvtScript N(80242058) = {
EVT_CALL(SetSelfVar, 3, 32)
EVT_CALL(SetSelfVar, 4, 3)
EVT_CALL(SetSelfVar, 15, 8389)
EVT_CALL(N(UnkFunc7))
EVT_CALL(N(MeleeHitbox_Main))
EVT_RETURN
EVT_END
};
@ -325,14 +325,14 @@ NpcAISettings N(npcAISettings_8024271C) = {
.moveTime = 30,
.waitTime = 30,
.alertRadius = 150.0f,
.unk_10 = { .f = 80.0f },
.unk_14 = 1,
.alertOffsetDist = 80.0f,
.playerSearchInterval = 1,
.chaseSpeed = 3.5f,
.unk_1C = { .s = 180 },
.unk_20 = 2,
.chaseTurnRate= 180,
.chaseUpdateInterval = 2,
.chaseRadius = 160.0f,
.unk_28 = { .f = 80.0f },
.unk_2C = 1,
.chaseOffsetDist = 80.0f,
.unk_AI_2C = 1,
};
EvtScript N(npcAI_8024274C) = {
@ -340,7 +340,7 @@ EvtScript N(npcAI_8024274C) = {
EVT_CALL(SetNpcFlagBits, NPC_SELF, ((NPC_FLAG_GRAVITY)), TRUE)
EVT_CALL(SetNpcAnimation, 0, NPC_ANIM_world_tubba_Palette_00_Anim_C)
EVT_EXEC(N(802424E8))
EVT_CALL(N(UnkNpcAIMainFunc), EVT_PTR(N(npcAISettings_8024271C)))
EVT_CALL(N(PatrolNoAttackAI_Main), EVT_PTR(N(npcAISettings_8024271C)))
EVT_RETURN
EVT_END
};
@ -376,7 +376,7 @@ StaticNpc N(npcGroup_802428C0) = {
.id = NPC_WORLD_TUBBA,
.settings = &N(npcSettings_8024212C),
.pos = { 0.0f, -1000.0f, 0.0f },
.flags = NPC_FLAG_100 | NPC_FLAG_NO_Y_MOVEMENT | NPC_FLAG_40000 | NPC_FLAG_200000 | NPC_FLAG_NO_DROPS,
.flags = NPC_FLAG_100 | NPC_FLAG_JUMPING | NPC_FLAG_40000 | NPC_FLAG_200000 | NPC_FLAG_NO_DROPS,
.init = &N(init_802427EC),
.yaw = 270,
.dropFlags = NPC_DROP_FLAGS_80,
@ -464,104 +464,9 @@ EvtScript N(makeEntities) = {
EVT_END
};
#include "world/common/UnkNpcAIFunc6.inc.c"
#include "world/common/enemy/WanderMeleeAI.inc.c"
#include "world/common/UnkNpcAIFunc7.inc.c"
#include "world/common/UnkNpcAIFunc8.inc.c"
#include "world/common/UnkNpcAIFunc5.inc.c"
#include "world/common/UnkNpcAIFunc26.inc.c"
#include "world/common/UnkFunc7.inc.c"
ApiStatus N(func_8024061C_C4FB2C)(Evt* script, s32 isInitialCall) {
Enemy* enemy = script->owner1.enemy;
Npc* npc = get_npc_unsafe(enemy->npcID);
Bytecode* args = script->ptrReadPos;
EnemyTerritoryThing territory;
EnemyTerritoryThing* territoryPtr = &territory;
NpcAISettings* npcAISettings = (NpcAISettings*)evt_get_variable(script, *args++);
territory.unk_00 = 0;
territory.shape = enemy->territory->wander.detectShape;
territory.pointX = enemy->territory->wander.detect.x;
territory.pointZ = enemy->territory->wander.detect.z;
territory.sizeX = enemy->territory->wander.detectSizeX;
territory.sizeZ = enemy->territory->wander.detectSizeZ;
territory.unk_18 = 65.0f;
territory.unk_1C = 0;
if (isInitialCall || (enemy->unk_B0 & ENEMY_AI_FLAGS_4)) {
script->functionTemp[0] = 0;
npc->duration = 0;
npc->currentAnim.w = enemy->animList[0];
npc->flags &= ~0x800;
if (!enemy->territory->wander.isFlying) {
npc->flags = (npc->flags | 0x200) & ~0x8;
} else {
npc->flags = (npc->flags & ~0x200) | 0x8;
}
if (enemy->unk_B0 & ENEMY_AI_FLAGS_4) {
script->functionTemp[0] = 99;
script->functionTemp[1] = 0;
enemy->unk_B0 &= ~ENEMY_AI_FLAGS_4;
}
enemy->varTable[0] = 0;
}
if ((script->functionTemp[0] < 30) && (enemy->varTable[0] == 0) && N(UnkNpcAIFunc26)(script)) {
script->functionTemp[0] = 30;
}
switch (script->functionTemp[0]) {
case 0:
func_800495A0(script, npcAISettings, territoryPtr);
case 1:
func_800496B8(script, npcAISettings, territoryPtr);
break;
case 2:
base_UnkNpcAIFunc1(script, npcAISettings, territoryPtr);
case 3:
func_80049C04(script, npcAISettings, territoryPtr);
break;
case 10:
func_80049E3C(script, npcAISettings, territoryPtr);
case 11:
func_80049ECC(script, npcAISettings, territoryPtr);
break;
case 12:
func_80049F7C(script, npcAISettings, territoryPtr);
case 13:
func_8004A124(script, npcAISettings, territoryPtr);
break;
case 14:
func_8004A3E8(script, npcAISettings, territoryPtr);
break;
case 30:
N(UnkNpcAIFunc6)(script);
case 31:
N(UnkNpcAIFunc7)(script);
if (script->functionTemp[0] != 32) {
break;
}
case 32:
N(UnkNpcAIFunc8)(script);
if (script->functionTemp[0] != 33) {
break;
}
case 33:
N(UnkNpcAIFunc5)(script);
break;
case 99:
func_8004A73C(script);
}
return ApiStatus_BLOCK;
}
#include "world/common/atomic/enemy/UnkAI_1.inc.c"
#include "world/common/enemy/PatrolNoAttackAI.inc.c"
#include "world/common/UnkFunc1.inc.c"

View File

@ -9,9 +9,9 @@
ApiStatus N(GetEntityPosition)(Evt* script, s32 isInitialCall);
ApiStatus N(SetEntityFlags100000)(Evt* script, s32 isInitialCall);
ApiStatus N(UnkFunc1)(Evt* script, s32 isInitialCall);
ApiStatus N(func_8024061C_C4FB2C)(Evt* script, s32 isInitialCall);
ApiStatus N(UnkNpcAIMainFunc)(Evt* script, s32 isInitialCall);
ApiStatus N(UnkFunc7)(Evt* script, s32 isInitialCall);
ApiStatus N(WanderMeleeAI_Main)(Evt* script, s32 isInitialCall);
ApiStatus N(PatrolNoAttackAI_Main)(Evt* script, s32 isInitialCall);
ApiStatus N(MeleeHitbox_Main)(Evt* script, s32 isInitialCall);
extern NpcGroupList N(npcGroupList_80242AB0);
extern EvtScript N(80242AD0);

View File

@ -2,8 +2,6 @@
#include "message_ids.h"
#include "sprite/npc/world_clubba.h"
extern Npc* wPartnerNpc;
enum {
NPC_WORLD_CLUBBA0,
NPC_WORLD_CLUBBA1,
@ -152,14 +150,14 @@ NpcAISettings N(npcAISettings_802418AC) = {
.moveTime = 120,
.waitTime = 30,
.alertRadius = 100.0f,
.unk_10 = { .f = 40.0f },
.unk_14 = 10,
.alertOffsetDist = 40.0f,
.playerSearchInterval = 10,
.chaseSpeed = 3.5f,
.unk_1C = { .s = 90 },
.unk_20 = 15,
.chaseTurnRate= 90,
.chaseUpdateInterval = 15,
.chaseRadius = 200.0f,
.unk_28 = { .f = 160.0f },
.unk_2C = 1,
.chaseOffsetDist = 160.0f,
.unk_AI_2C = 1,
};
EvtScript N(npcAI_802418DC) = {
@ -167,7 +165,7 @@ EvtScript N(npcAI_802418DC) = {
EVT_CALL(SetSelfVar, 1, 10)
EVT_CALL(SetSelfVar, 2, 14)
EVT_CALL(SetSelfVar, 3, 18)
EVT_CALL(N(func_80240E20_C53360), EVT_PTR(N(npcAISettings_802418AC)))
EVT_CALL(N(ClubbaNappingAI_Main), EVT_PTR(N(npcAISettings_802418AC)))
EVT_RETURN
EVT_END
};
@ -189,7 +187,7 @@ EvtScript N(npcAI_80241978) = {
EVT_CALL(SetSelfVar, 3, 32)
EVT_CALL(SetSelfVar, 4, 3)
EVT_CALL(SetSelfVar, 15, 8389)
EVT_CALL(N(UnkFunc7))
EVT_CALL(N(MeleeHitbox_Main))
EVT_RETURN
EVT_END
};
@ -208,7 +206,7 @@ StaticNpc N(npcGroup_80241A4C)[] = {
.id = NPC_WORLD_CLUBBA0,
.settings = &N(npcSettings_8024194C),
.pos = { -70.0f, 0.0f, -100.0f },
.flags = NPC_FLAG_LOCK_ANIMS | NPC_FLAG_NO_Y_MOVEMENT,
.flags = NPC_FLAG_LOCK_ANIMS | NPC_FLAG_JUMPING,
.yaw = 270,
.dropFlags = NPC_DROP_FLAGS_80,
.itemDropChance = 5,
@ -245,7 +243,7 @@ StaticNpc N(npcGroup_80241A4C)[] = {
.id = NPC_WORLD_CLUBBA1,
.settings = &N(npcSettings_80241A20),
.pos = { 0.0f, -1000.0f, 0.0f },
.flags = NPC_FLAG_100 | NPC_FLAG_LOCK_ANIMS | NPC_FLAG_NO_Y_MOVEMENT | NPC_FLAG_NO_DROPS,
.flags = NPC_FLAG_100 | NPC_FLAG_LOCK_ANIMS | NPC_FLAG_JUMPING | NPC_FLAG_NO_DROPS,
.yaw = 0,
.dropFlags = NPC_DROP_FLAGS_80,
.heartDrops = NO_DROPS,
@ -277,7 +275,7 @@ StaticNpc N(npcGroup_80241E2C)[] = {
.id = NPC_WORLD_CLUBBA2,
.settings = &N(npcSettings_8024194C),
.pos = { 0.0f, 0.0f, -235.0f },
.flags = NPC_FLAG_LOCK_ANIMS | NPC_FLAG_NO_Y_MOVEMENT,
.flags = NPC_FLAG_LOCK_ANIMS | NPC_FLAG_JUMPING,
.yaw = 90,
.dropFlags = NPC_DROP_FLAGS_80,
.itemDropChance = 5,
@ -313,7 +311,7 @@ StaticNpc N(npcGroup_80241E2C)[] = {
.id = NPC_WORLD_CLUBBA3,
.settings = &N(npcSettings_80241A20),
.pos = { 0.0f, -1000.0f, 0.0f },
.flags = NPC_FLAG_100 | NPC_FLAG_LOCK_ANIMS | NPC_FLAG_NO_Y_MOVEMENT | NPC_FLAG_NO_DROPS,
.flags = NPC_FLAG_100 | NPC_FLAG_LOCK_ANIMS | NPC_FLAG_JUMPING | NPC_FLAG_NO_DROPS,
.yaw = 0,
.dropFlags = NPC_DROP_FLAGS_80,
.heartDrops = NO_DROPS,
@ -345,7 +343,7 @@ StaticNpc N(npcGroup_8024220C)[] = {
.id = NPC_WORLD_CLUBBA4,
.settings = &N(npcSettings_8024194C),
.pos = { 70.0f, 0.0f, -100.0f },
.flags = NPC_FLAG_LOCK_ANIMS | NPC_FLAG_NO_Y_MOVEMENT,
.flags = NPC_FLAG_LOCK_ANIMS | NPC_FLAG_JUMPING,
.yaw = 90,
.dropFlags = NPC_DROP_FLAGS_80,
.itemDropChance = 5,
@ -381,7 +379,7 @@ StaticNpc N(npcGroup_8024220C)[] = {
.id = NPC_WORLD_CLUBBA5,
.settings = &N(npcSettings_80241A20),
.pos = { 0.0f, -1000.0f, 0.0f },
.flags = NPC_FLAG_100 | NPC_FLAG_LOCK_ANIMS | NPC_FLAG_NO_Y_MOVEMENT | NPC_FLAG_NO_DROPS,
.flags = NPC_FLAG_100 | NPC_FLAG_LOCK_ANIMS | NPC_FLAG_JUMPING | NPC_FLAG_NO_DROPS,
.yaw = 0,
.dropFlags = NPC_DROP_FLAGS_80,
.heartDrops = NO_DROPS,
@ -413,7 +411,7 @@ StaticNpc N(npcGroup_802425EC)[] = {
.id = NPC_WORLD_CLUBBA6,
.settings = &N(npcSettings_8024194C),
.pos = { 140.0f, 0.0f, -235.0f },
.flags = NPC_FLAG_LOCK_ANIMS | NPC_FLAG_NO_Y_MOVEMENT,
.flags = NPC_FLAG_LOCK_ANIMS | NPC_FLAG_JUMPING,
.yaw = 270,
.dropFlags = NPC_DROP_FLAGS_80,
.itemDropChance = 5,
@ -449,7 +447,7 @@ StaticNpc N(npcGroup_802425EC)[] = {
.id = NPC_WORLD_CLUBBA7,
.settings = &N(npcSettings_80241A20),
.pos = { 0.0f, -1000.0f, 0.0f },
.flags = NPC_FLAG_100 | NPC_FLAG_LOCK_ANIMS | NPC_FLAG_NO_Y_MOVEMENT | NPC_FLAG_NO_DROPS,
.flags = NPC_FLAG_100 | NPC_FLAG_LOCK_ANIMS | NPC_FLAG_JUMPING | NPC_FLAG_NO_DROPS,
.yaw = 0,
.dropFlags = NPC_DROP_FLAGS_80,
.heartDrops = NO_DROPS,
@ -481,7 +479,7 @@ StaticNpc N(npcGroup_802429CC)[] = {
.id = NPC_WORLD_CLUBBA8,
.settings = &N(npcSettings_8024194C),
.pos = { 210.0f, 0.0f, -100.0f },
.flags = NPC_FLAG_LOCK_ANIMS | NPC_FLAG_NO_Y_MOVEMENT,
.flags = NPC_FLAG_LOCK_ANIMS | NPC_FLAG_JUMPING,
.yaw = 270,
.dropFlags = NPC_DROP_FLAGS_80,
.itemDropChance = 5,
@ -517,7 +515,7 @@ StaticNpc N(npcGroup_802429CC)[] = {
.id = NPC_WORLD_CLUBBA9,
.settings = &N(npcSettings_80241A20),
.pos = { 0.0f, -1000.0f, 0.0f },
.flags = NPC_FLAG_100 | NPC_FLAG_LOCK_ANIMS | NPC_FLAG_NO_Y_MOVEMENT | NPC_FLAG_NO_DROPS,
.flags = NPC_FLAG_100 | NPC_FLAG_LOCK_ANIMS | NPC_FLAG_JUMPING | NPC_FLAG_NO_DROPS,
.yaw = 0,
.dropFlags = NPC_DROP_FLAGS_80,
.heartDrops = NO_DROPS,
@ -549,7 +547,7 @@ StaticNpc N(npcGroup_80242DAC)[] = {
.id = NPC_WORLD_CLUBBA10,
.settings = &N(npcSettings_8024194C),
.pos = { 280.0f, 0.0f, -235.0f },
.flags = NPC_FLAG_LOCK_ANIMS | NPC_FLAG_NO_Y_MOVEMENT,
.flags = NPC_FLAG_LOCK_ANIMS | NPC_FLAG_JUMPING,
.yaw = 90,
.dropFlags = NPC_DROP_FLAGS_80,
.itemDropChance = 5,
@ -585,7 +583,7 @@ StaticNpc N(npcGroup_80242DAC)[] = {
.id = NPC_WORLD_CLUBBA11,
.settings = &N(npcSettings_80241A20),
.pos = { 0.0f, -1000.0f, 0.0f },
.flags = NPC_FLAG_100 | NPC_FLAG_LOCK_ANIMS | NPC_FLAG_NO_Y_MOVEMENT | NPC_FLAG_NO_DROPS,
.flags = NPC_FLAG_100 | NPC_FLAG_LOCK_ANIMS | NPC_FLAG_JUMPING | NPC_FLAG_NO_DROPS,
.yaw = 0,
.dropFlags = NPC_DROP_FLAGS_80,
.heartDrops = NO_DROPS,
@ -622,381 +620,6 @@ NpcGroupList N(npcGroupList_8024318C) = {
{},
};
#include "world/common/UnkNpcAIFunc6.inc.c"
#include "world/common/enemy/ClubbaNappingAI.inc.c"
#include "world/common/UnkNpcAIFunc7.inc.c"
#include "world/common/UnkNpcAIFunc8.inc.c"
#include "world/common/UnkNpcAIFunc5.inc.c"
#include "world/common/UnkNpcAIFunc26.inc.c"
#include "world/common/UnkFunc7.inc.c"
void N(func_8024061C_C52B5C)(Evt* script, NpcAISettings* aiSettings, EnemyTerritoryThing* territory) {
Enemy* enemy = script->owner1.enemy;
Npc* npc = get_npc_unsafe(enemy->npcID);
if (npc->duration > 0) {
npc->duration--;
}
if (npc->duration == 1) {
npc->currentAnim.w = enemy->animList[12];
} else if (npc->duration <= 0) {
npc->currentAnim.w = enemy->animList[10];
npc->duration = 0;
script->functionTemp[0] = 1;
}
}
void N(func_802406A4_C52BE4)(Evt* script, NpcAISettings* aiSettings, EnemyTerritoryThing* territory) {
Enemy* enemy = script->owner1.enemy;
Npc* npc = get_npc_unsafe(enemy->npcID);
PlayerData* playerData = get_player_data();
s32 phi_s2 = FALSE;
s32 var;
f32 posX, posZ;
if (func_800490B4(territory, enemy, 80.0f, 0.0f, 0)) {
if ((gPlayerStatusPtr->actionState == 2) || (gPlayerStatusPtr->actionState == 26) ||
(gPlayerStatusPtr->actionState == 3) || (gPlayerStatusPtr->actionState == 14) ||
(gPlayerStatusPtr->actionState == 16) || (gPlayerStatusPtr->actionState == 11) ||
(gPlayerStatusPtr->actionState == 10) || (gPlayerStatusPtr->actionState == 18) ||
(gPlayerStatusPtr->actionState == 19) || (gPlayerStatusPtr->actionState == 37)) {
phi_s2 = TRUE;
}
if (playerData->currentPartner == PARTNER_KOOPER) {
if (gPartnerActionStatus.partnerActionState == playerData->currentPartner) {
phi_s2 = TRUE;
}
}
}
if (((playerData->currentPartner == PARTNER_GOOMBARIO) && (gPartnerActionStatus.partnerActionState != PARTNER_ACTION_NONE)) ||
((playerData->currentPartner == PARTNER_BOMBETTE) && (gPartnerActionStatus.partnerActionState == PARTNER_ACTION_BOMBETTE_2))) {
posX = npc->pos.x;
posZ = npc->pos.z;
add_vec2D_polar(&posX, &posZ, 0.0f, npc->yaw);
if (dist2D(posX, posZ, wPartnerNpc->pos.x, wPartnerNpc->pos.z) <= 80.0f) {
phi_s2 = TRUE;
}
}
if (phi_s2) {
ai_enemy_play_sound(npc, 0xB000000E, 0);
npc->currentAnim.w = enemy->animList[11];
npc->duration = 10;
fx_emote(EMOTE_EXCLAMATION, npc, 0.0f, npc->collisionHeight, 1.0f, 2.0f, -20.0f, 15, &var);
ai_enemy_play_sound(npc, 0x2F4, 0x200000);
script->functionTemp[0] = 2;
}
npc->duration++;
if (npc->duration == 27) {
ai_enemy_play_sound(npc, 0xB000000C, 0);
} else if (npc->duration == 57) {
ai_enemy_play_sound(npc, 0xB000000D, 0);
} else if (npc->duration == 59) {
npc->currentAnim.w = enemy->animList[12];
} else if (npc->duration == 60) {
npc->currentAnim.w = enemy->animList[10];
npc->duration = 0;
}
}
void N(func_8024095C_C52E9C)(Evt* script, NpcAISettings* aiSettings, EnemyTerritoryThing* territory) {
Enemy* enemy = script->owner1.enemy;
Npc* npc = get_npc_unsafe(enemy->npcID);
npc->duration--;
if (npc->duration <= 0) {
npc->duration = 1;
enemy->varTable[7] = 40;
script->functionTemp[0] = 3;
}
}
void N(func_802409C0_C52F00)(Evt* script, NpcAISettings* aiSettings, EnemyTerritoryThing* territory) {
Enemy* enemy = script->owner1.enemy;
Npc* npc = get_npc_unsafe(enemy->npcID);
npc->yaw = clamp_angle((npc->yaw + rand_int(180)) - 90.0f);
npc->currentAnim.w = enemy->animList[0];
script->functionTemp[1] = (rand_int(1000) % 2) + 2;
script->functionTemp[0] = 4;
}
void N(func_80240A68_C52FA8)(Evt* script, NpcAISettings* aiSettings, EnemyTerritoryThing* territory) {
Enemy* enemy = script->owner1.enemy;
Npc* npc = get_npc_unsafe(enemy->npcID);
s32 var;
if (func_800490B4(territory, enemy, aiSettings->chaseRadius, aiSettings->unk_28.f, 0)) {
npc->yaw = atan2(npc->pos.x, npc->pos.z, gPlayerStatusPtr->position.x, gPlayerStatusPtr->position.z);
script->functionTemp[0] = 12;
return;
}
npc->duration--;
if (npc->duration <= 0) {
script->functionTemp[1]--;
if (script->functionTemp[1] > 0) {
npc->yaw = clamp_angle(npc->yaw + 180.0f);
npc->duration = aiSettings->waitTime / 2 + rand_int(aiSettings->waitTime / 2 + 1);
return;
}
var = enemy->varTable[7];
if (var == 40) {
npc->duration = 20;
script->functionTemp[0] = var;
} else if (var == 50) {
npc->duration = 25;
script->functionTemp[0] = var;
}
}
}
void N(func_80240BA0_C530E0)(Evt* script, NpcAISettings* aiSettings, EnemyTerritoryThing* territory) {
Enemy* enemy = script->owner1.enemy;
Npc* npc = get_npc_unsafe(enemy->npcID);
npc->duration--;
if (npc->duration <= 0) {
npc->currentAnim.w = enemy->animList[1];
if (enemy->territory->wander.moveSpeedOverride < 0) {
npc->moveSpeed = aiSettings->moveSpeed;
} else {
npc->moveSpeed = enemy->territory->wander.moveSpeedOverride / 32767.0;
}
script->functionTemp[0] = 0x29;
}
}
void N(func_80240C4C_C5318C)(Evt* script, NpcAISettings* aiSettings, EnemyTerritoryThing* territory) {
Enemy* enemy = script->owner1.enemy;
Npc* npc = get_npc_unsafe(enemy->npcID);
f32 var;
if (func_800490B4(territory, enemy, aiSettings->chaseRadius, aiSettings->unk_28.f, 0)) {
npc->yaw = atan2(npc->pos.x, npc->pos.z, gPlayerStatusPtr->position.x, gPlayerStatusPtr->position.z);
script->functionTemp[0] = 12;
} else if (dist2D(npc->pos.x, npc->pos.z, enemy->territory->wander.point.x,
enemy->territory->wander.point.z) <= npc->moveSpeed) {
npc->currentAnim.w = enemy->animList[0];
npc->duration = 15;
enemy->varTable[7] = 50;
script->functionTemp[0] = 3;
} else if (npc->turnAroundYawAdjustment == 0) {
var = npc->yaw;
func_8004A784(npc, 5.0f, &var, 0, 0, 0);
npc->yaw = var;
npc->yaw = atan2(npc->pos.x, npc->pos.z, enemy->territory->wander.point.x, enemy->territory->wander.point.z);
npc_move_heading(npc, npc->moveSpeed, npc->yaw);
}
}
void N(func_80240DC4_C53304)(Evt* script, NpcAISettings* aiSettings, EnemyTerritoryThing* territory) {
Enemy* enemy = script->owner1.enemy;
Npc* npc = get_npc_unsafe(enemy->npcID);
if (npc->turnAroundYawAdjustment == 0) {
npc->duration--;
if (npc->duration <= 0) {
npc->duration = 0;
script->functionTemp[0] = 0;
}
}
}
ApiStatus N(func_80240E20_C53360)(Evt* script, s32 isInitialCall) {
Enemy* enemy = script->owner1.enemy;
Npc* npc = get_npc_unsafe(enemy->npcID);
Bytecode* args = script->ptrReadPos;
EnemyTerritoryThing territory;
EnemyTerritoryThing* territoryPtr = &territory;
NpcAISettings* npcAISettings = (NpcAISettings*)evt_get_variable(script, *args++);
territory.unk_00 = 0;
territory.shape = enemy->territory->wander.detectShape;
territory.pointX = enemy->territory->wander.detect.x;
territory.pointZ = enemy->territory->wander.detect.z;
territory.sizeX = enemy->territory->wander.detectSizeX;
territory.sizeZ = enemy->territory->wander.detectSizeZ;
territory.unk_18 = 40.0f;
territory.unk_1C = 0;
if (isInitialCall || (enemy->unk_B0 & ENEMY_AI_FLAGS_4)) {
script->functionTemp[0] = 0;
npc->duration = 30;
npc->currentAnim.w = enemy->animList[10];
npc->flags &= ~0x800;
enemy->varTable[0] = 0;
if (!enemy->territory->wander.isFlying) {
npc->flags = (npc->flags | 0x200) & ~0x8;
} else {
npc->flags = (npc->flags & ~0x200) | 0x8;
}
if (enemy->unk_B0 & ENEMY_AI_FLAGS_4) {
script->functionTemp[0] = 99;
script->functionTemp[1] = 40;
npc->currentAnim.w = enemy->animList[0];
}
enemy->unk_B0 &= ~ENEMY_AI_FLAGS_4;
}
if (((u32)script->functionTemp[0] - 10 < 20) && (enemy->varTable[0] == 0) && N(UnkNpcAIFunc26)(script)) {
script->functionTemp[0] = 30;
}
switch (script->functionTemp[0]) {
case 0:
N(func_8024061C_C52B5C)(script, npcAISettings, territoryPtr);
break;
case 1:
N(func_802406A4_C52BE4)(script, npcAISettings, territoryPtr);
break;
case 2:
N(func_8024095C_C52E9C)(script, npcAISettings, territoryPtr);
break;
case 3:
N(func_802409C0_C52F00)(script, npcAISettings, territoryPtr);
break;
case 4:
N(func_80240A68_C52FA8)(script, npcAISettings, territoryPtr);
break;
case 12:
func_80049F7C(script, npcAISettings, territoryPtr);
if (script->functionTemp[0] != 13) {
break;
}
case 13:
func_8004A124(script, npcAISettings, territoryPtr);
break;
case 14:
func_8004A3E8(script, npcAISettings, territoryPtr);
npc->duration = 15;
enemy->varTable[7] = 40;
script->functionTemp[0] = 3;
break;
case 30:
N(UnkNpcAIFunc6)(script);
if (script->functionTemp[0] != 31) {
break;
}
case 31:
N(UnkNpcAIFunc7)(script);
if (script->functionTemp[0] != 32) {
break;
}
case 32:
N(UnkNpcAIFunc8)(script);
break;
case 33:
N(UnkNpcAIFunc5)(script);
break;
case 40:
N(func_80240BA0_C530E0)(script, npcAISettings, territoryPtr);
if (script->functionTemp[0] != 41) {
break;
}
case 41:
N(func_80240C4C_C5318C)(script, npcAISettings, territoryPtr);
break;
case 50:
N(func_80240DC4_C53304)(script, npcAISettings, territoryPtr);
break;
case 99:
func_8004A73C(script);
}
return ApiStatus_BLOCK;
}
ApiStatus N(func_80241170_C536B0)(Evt* script, s32 isInitialCall) {
Enemy* enemy = script->owner1.enemy;
Npc* npc = get_npc_unsafe(enemy->npcID);
Bytecode* args = script->ptrReadPos;
EnemyTerritoryThing territory;
EnemyTerritoryThing* territoryPtr = &territory;
NpcAISettings* npcAISettings = (NpcAISettings*)evt_get_variable(script, *args++);
territory.unk_00 = 0;
territory.shape = enemy->territory->wander.detectShape;
territory.pointX = enemy->territory->wander.detect.x;
territory.pointZ = enemy->territory->wander.detect.z;
territory.sizeX = enemy->territory->wander.detectSizeX;
territory.sizeZ = enemy->territory->wander.detectSizeZ;
territory.unk_18 = 65.0f;
territory.unk_1C = 0;
if (isInitialCall || (enemy->unk_B0 & ENEMY_AI_FLAGS_4)) {
script->functionTemp[0] = 0;
npc->duration = 0;
npc->currentAnim.w = enemy->animList[0];
npc->flags &= ~0x800;
if (!enemy->territory->wander.isFlying) {
npc->flags = (npc->flags | 0x200) & ~0x8;
} else {
npc->flags = (npc->flags & ~0x200) | 0x8;
}
if (enemy->unk_B0 & ENEMY_AI_FLAGS_4) {
script->functionTemp[0] = 99;
script->functionTemp[1] = 0;
enemy->unk_B0 &= ~ENEMY_AI_FLAGS_4;
}
enemy->varTable[0] = 0;
}
if ((script->functionTemp[0] < 30) && (enemy->varTable[0] == 0) && N(UnkNpcAIFunc26)(script)) {
script->functionTemp[0] = 30;
}
switch (script->functionTemp[0]) {
case 0:
func_800495A0(script, npcAISettings, territoryPtr);
case 1:
func_800496B8(script, npcAISettings, territoryPtr);
break;
case 2:
base_UnkNpcAIFunc1(script, npcAISettings, territoryPtr);
case 3:
func_80049C04(script, npcAISettings, territoryPtr);
break;
case 10:
func_80049E3C(script, npcAISettings, territoryPtr);
case 11:
func_80049ECC(script, npcAISettings, territoryPtr);
break;
case 12:
func_80049F7C(script, npcAISettings, territoryPtr);
case 13:
func_8004A124(script, npcAISettings, territoryPtr);
break;
case 14:
func_8004A3E8(script, npcAISettings, territoryPtr);
break;
case 30:
N(UnkNpcAIFunc6)(script);
case 31:
N(UnkNpcAIFunc7)(script);
if (script->functionTemp[0] != 32) {
break;
}
case 32:
N(UnkNpcAIFunc8)(script);
if (script->functionTemp[0] != 33) {
break;
}
case 33:
N(UnkNpcAIFunc5)(script);
break;
case 99:
func_8004A73C(script);
}
return ApiStatus_BLOCK;
}
#include "world/common/enemy/WanderMeleeAI.inc.c"

View File

@ -6,8 +6,8 @@
#define NAMESPACE dgb_16
ApiStatus N(func_80240E20_C53360)(Evt* script, s32 isInitialCall);
ApiStatus N(UnkFunc7)(Evt* script, s32 isInitialCall);
ApiStatus N(ClubbaNappingAI_Main)(Evt* script, s32 isInitialCall);
ApiStatus N(MeleeHitbox_Main)(Evt* script, s32 isInitialCall);
extern NpcGroupList N(npcGroupList_8024318C);
extern EvtScript N(80241780);

View File

@ -93,18 +93,18 @@ static s32 N(pad_1578)[] = {
NpcAISettings N(npcAISettings_80241580) = {
.moveSpeed = 4.5f,
.alertRadius = 170.0f,
.unk_10 = { .f = 90.0f },
.unk_14 = 1,
.alertOffsetDist = 90.0f,
.playerSearchInterval = 1,
.chaseSpeed = 3.9f,
.unk_1C = { .s = 180 },
.unk_20 = 2,
.chaseTurnRate= 180,
.chaseUpdateInterval = 2,
.chaseRadius = 170.0f,
.unk_28 = { .f = 90.0f },
.unk_2C = 1,
.chaseOffsetDist = 90.0f,
.unk_AI_2C = 1,
};
EvtScript N(802415B0) = {
EVT_CALL(N(UnkNpcAIMainFunc), EVT_PTR(N(npcAISettings_80241580)))
EVT_CALL(N(PatrolNoAttackAI_Main), EVT_PTR(N(npcAISettings_80241580)))
EVT_RETURN
EVT_END
};
@ -421,7 +421,7 @@ EvtScript N(npcAI_80242834) = {
EVT_WAIT_FRAMES(8)
EVT_END_LOOP
EVT_END_THREAD
EVT_CALL(N(UnkNpcAIMainFunc), EVT_PTR(N(npcAISettings_80241580)))
EVT_CALL(N(PatrolNoAttackAI_Main), EVT_PTR(N(npcAISettings_80241580)))
EVT_RETURN
EVT_END
};
@ -584,7 +584,7 @@ StaticNpc N(npcGroup_802432D4) = {
.id = NPC_WORLD_TUBBA,
.settings = &N(npcSettings_802415FC),
.pos = { 0.0f, -1000.0f, 0.0f },
.flags = NPC_FLAG_NO_Y_MOVEMENT | NPC_FLAG_40000 | NPC_FLAG_200000 | NPC_FLAG_NO_DROPS,
.flags = NPC_FLAG_JUMPING | NPC_FLAG_40000 | NPC_FLAG_200000 | NPC_FLAG_NO_DROPS,
.init = &N(init_80242924),
.yaw = 270,
.dropFlags = NPC_DROP_FLAGS_80,
@ -615,7 +615,7 @@ StaticNpc N(npcGroup_802434C4) = {
.id = NPC_YAKKEY,
.settings = &N(npcSettings_80241628),
.pos = { 0.0f, -1000.0f, 0.0f },
.flags = NPC_FLAG_PASSIVE | NPC_FLAG_NO_Y_MOVEMENT,
.flags = NPC_FLAG_PASSIVE | NPC_FLAG_JUMPING,
.init = &N(init_8024329C),
.yaw = 270,
.dropFlags = NPC_DROP_FLAGS_80,
@ -700,7 +700,7 @@ EvtScript N(makeEntities) = {
EVT_END
};
#include "world/common/atomic/enemy/UnkAI_1.inc.c"
#include "world/common/enemy/PatrolNoAttackAI.inc.c"
#include "world/common/UnkFunc1.inc.c"

View File

@ -7,7 +7,7 @@
#define NAMESPACE dgb_18
ApiStatus N(UnkFunc1)(Evt* script, s32 isInitialCall);
ApiStatus N(UnkNpcAIMainFunc)(Evt* script, s32 isInitialCall);
ApiStatus N(PatrolNoAttackAI_Main)(Evt* script, s32 isInitialCall);
extern s32** N(varStash);

View File

@ -70,7 +70,7 @@ static EffectInstance* N(Quizmo_VannaTEffect);
static s8 N(pad_D_8024DFEC)[0x4];
static s32 N(bigArray)[112];
static s8 N(pad_D_8024E1B0)[0x4]; // Probably part of the above
static s32 N(D_8024E1B4);
static s32 N(LetterDelivery_SavedNpcAnim);
EntryList N(entryList) = {
{ -342.0f, 0.0f, 316.0f, 45.0f },
@ -240,12 +240,12 @@ NpcAISettings N(npcAISettings_80245010) = {
.moveSpeed = 1.5f,
.moveTime = 60,
.waitTime = 30,
.unk_14 = -1,
.unk_2C = 1,
.playerSearchInterval = -1,
.unk_AI_2C = 1,
};
EvtScript N(npcAI_80245040) = {
EVT_CALL(DoBasicAI, EVT_PTR(N(npcAISettings_80245010)))
EVT_CALL(BasicAI_Main, EVT_PTR(N(npcAISettings_80245010)))
EVT_RETURN
EVT_END
};
@ -262,12 +262,12 @@ NpcAISettings N(npcAISettings_8024508C) = {
.moveSpeed = 1.5f,
.moveTime = 30,
.waitTime = 30,
.unk_14 = -1,
.unk_2C = 1,
.playerSearchInterval = -1,
.unk_AI_2C = 1,
};
EvtScript N(npcAI_802450BC) = {
EVT_CALL(N(UnkNpcAIMainFunc), EVT_PTR(N(npcAISettings_8024508C)))
EVT_CALL(N(PatrolNoAttackAI_Main), EVT_PTR(N(npcAISettings_8024508C)))
EVT_RETURN
EVT_END
};
@ -350,7 +350,7 @@ EvtScript N(8024792C) = {
EvtScript N(8024797C) = {
EVT_LOOP(0)
EVT_CALL(GetNpcPos, NPC_PARTNER, EVT_VAR(3), EVT_VAR(4), EVT_VAR(5))
EVT_CALL(N(UnkYawFunc), EVT_VAR(3), EVT_VAR(4), EVT_VAR(5))
EVT_CALL(N(LetterDelivery_CalcLetterPos), EVT_VAR(3), EVT_VAR(4), EVT_VAR(5))
EVT_CALL(SetItemPos, EVT_VAR(0), EVT_VAR(3), EVT_VAR(4), EVT_VAR(5))
EVT_WAIT_FRAMES(1)
EVT_END_LOOP
@ -369,7 +369,7 @@ EvtScript N(802479FC) = {
EVT_CALL(RemoveKeyItemAt, EVT_VAR(1))
EVT_CALL(DisablePartnerAI, 0)
EVT_CALL(GetNpcPos, NPC_PARTNER, EVT_VAR(3), EVT_VAR(4), EVT_VAR(5))
EVT_CALL(N(UnkYawFunc), EVT_VAR(3), EVT_VAR(4), EVT_VAR(5))
EVT_CALL(N(LetterDelivery_CalcLetterPos), EVT_VAR(3), EVT_VAR(4), EVT_VAR(5))
EVT_BITWISE_OR_CONST(EVT_VAR(0), 0x50000)
EVT_CALL(MakeItemEntity, EVT_VAR(0), EVT_VAR(3), EVT_VAR(4), EVT_VAR(5), 1, 0)
EVT_EXEC_GET_TID(N(8024797C), EVT_VAR(10))
@ -423,7 +423,7 @@ EvtScript N(80247D90) = {
EVT_IF_LT(EVT_SAVE_VAR(0), -70)
EVT_RETURN
EVT_END_IF
EVT_CALL(N(func_80243014_95E214))
EVT_CALL(N(LetterDelivery_SaveNpcAnim))
EVT_CALL(GetCurrentPartnerID, EVT_VAR(0))
EVT_CALL(FindKeyItem, EVT_VAR(5), EVT_VAR(1))
EVT_IF_EQ(EVT_VAR(0), 4)
@ -464,17 +464,18 @@ EvtScript N(80247D90) = {
EVT_END_SWITCH
EVT_END_IF
EVT_END_IF
EVT_CALL(N(func_80243058_95E258))
EVT_CALL(N(LetterDelivery_RestoreNpcAnim))
EVT_RETURN
EVT_END
};
s32 N(D_80248088_963288)[] = {
0x0000004C, 0x00000000,
ITEM_LETTER19, ITEM_NONE
};
EvtScript N(80248090) = {
EVT_CALL(N(SetManyVars), 6, 9699589, 9699585, 76, 69, 852105, 852106, 852107, 852108, EVT_PTR(N(D_80248088_963288)))
EVT_CALL(N(LetterDelivery_Init), 6, NPC_ANIM_mouser_Palette_01_Anim_5, NPC_ANIM_mouser_Palette_01_Anim_1, 76, 69,
MESSAGE_ID(0xD,0x89), MESSAGE_ID(0xD,0x8A), MESSAGE_ID(0xD,0x8B), MESSAGE_ID(0xD,0x8C), EVT_PTR(N(D_80248088_963288)))
EVT_EXEC_WAIT(N(80247D90))
EVT_RETURN
EVT_END
@ -957,7 +958,7 @@ StaticNpc N(npcGroup_80249B34)[] = {
.id = NPC_MOUSER0,
.settings = &N(npcSettings_80245134),
.pos = { -332.0f, 0.0f, 188.0f },
.flags = NPC_FLAG_PASSIVE | NPC_FLAG_100 | NPC_FLAG_LOCK_ANIMS | NPC_FLAG_NO_Y_MOVEMENT | NPC_FLAG_NO_PROJECT_SHADOW,
.flags = NPC_FLAG_PASSIVE | NPC_FLAG_100 | NPC_FLAG_LOCK_ANIMS | NPC_FLAG_JUMPING | NPC_FLAG_NO_PROJECT_SHADOW,
.init = &N(init_802481F8),
.yaw = 90,
.dropFlags = NPC_DROP_FLAGS_80,
@ -987,7 +988,7 @@ StaticNpc N(npcGroup_80249B34)[] = {
.id = NPC_DRYITE0,
.settings = &N(npcSettings_80245060),
.pos = { -235.0f, 0.0f, 160.0f },
.flags = NPC_FLAG_PASSIVE | NPC_FLAG_100 | NPC_FLAG_LOCK_ANIMS | NPC_FLAG_NO_Y_MOVEMENT | NPC_FLAG_NO_PROJECT_SHADOW,
.flags = NPC_FLAG_PASSIVE | NPC_FLAG_100 | NPC_FLAG_LOCK_ANIMS | NPC_FLAG_JUMPING | NPC_FLAG_NO_PROJECT_SHADOW,
.init = &N(init_802483A8),
.yaw = 90,
.dropFlags = NPC_DROP_FLAGS_80,
@ -1018,7 +1019,7 @@ StaticNpc N(npcGroup_80249B34)[] = {
.id = NPC_DRYITE1,
.settings = &N(npcSettings_80245108),
.pos = { -380.0f, 0.0f, -15.0f },
.flags = NPC_FLAG_PASSIVE | NPC_FLAG_100 | NPC_FLAG_LOCK_ANIMS | NPC_FLAG_NO_Y_MOVEMENT | NPC_FLAG_NO_PROJECT_SHADOW,
.flags = NPC_FLAG_PASSIVE | NPC_FLAG_100 | NPC_FLAG_LOCK_ANIMS | NPC_FLAG_JUMPING | NPC_FLAG_NO_PROJECT_SHADOW,
.init = &N(init_802484E0),
.yaw = 61,
.dropFlags = NPC_DROP_FLAGS_80,
@ -1048,7 +1049,7 @@ StaticNpc N(npcGroup_80249B34)[] = {
.id = NPC_DRYITE2,
.settings = &N(npcSettings_80245108),
.pos = { 195.0f, 0.0f, -75.0f },
.flags = NPC_FLAG_PASSIVE | NPC_FLAG_100 | NPC_FLAG_LOCK_ANIMS | NPC_FLAG_NO_Y_MOVEMENT | NPC_FLAG_NO_PROJECT_SHADOW,
.flags = NPC_FLAG_PASSIVE | NPC_FLAG_100 | NPC_FLAG_LOCK_ANIMS | NPC_FLAG_JUMPING | NPC_FLAG_NO_PROJECT_SHADOW,
.init = &N(init_80248AE4),
.yaw = 74,
.dropFlags = NPC_DROP_FLAGS_80,
@ -1078,7 +1079,7 @@ StaticNpc N(npcGroup_80249B34)[] = {
.id = NPC_DRYITE3,
.settings = &N(npcSettings_80245108),
.pos = { 225.0f, 0.0f, -83.0f },
.flags = NPC_FLAG_PASSIVE | NPC_FLAG_100 | NPC_FLAG_LOCK_ANIMS | NPC_FLAG_NO_Y_MOVEMENT | NPC_FLAG_NO_PROJECT_SHADOW,
.flags = NPC_FLAG_PASSIVE | NPC_FLAG_100 | NPC_FLAG_LOCK_ANIMS | NPC_FLAG_JUMPING | NPC_FLAG_NO_PROJECT_SHADOW,
.init = &N(init_80248CC8),
.yaw = 257,
.dropFlags = NPC_DROP_FLAGS_80,
@ -1108,7 +1109,7 @@ StaticNpc N(npcGroup_80249B34)[] = {
.id = NPC_ARTIST_TOAD,
.settings = &N(npcSettings_80245108),
.pos = { 285.0f, 0.0f, -274.0f },
.flags = NPC_FLAG_PASSIVE | NPC_FLAG_100 | NPC_FLAG_LOCK_ANIMS | NPC_FLAG_NO_Y_MOVEMENT | NPC_FLAG_NO_PROJECT_SHADOW,
.flags = NPC_FLAG_PASSIVE | NPC_FLAG_100 | NPC_FLAG_LOCK_ANIMS | NPC_FLAG_JUMPING | NPC_FLAG_NO_PROJECT_SHADOW,
.init = &N(init_80249168),
.yaw = 271,
.dropFlags = NPC_DROP_FLAGS_80,
@ -1138,7 +1139,7 @@ StaticNpc N(npcGroup_80249B34)[] = {
.id = NPC_MOUSER1,
.settings = &N(npcSettings_80245134),
.pos = { 31.0f, 0.0f, -374.0f },
.flags = NPC_FLAG_PASSIVE | NPC_FLAG_100 | NPC_FLAG_LOCK_ANIMS | NPC_FLAG_NO_Y_MOVEMENT | NPC_FLAG_NO_PROJECT_SHADOW,
.flags = NPC_FLAG_PASSIVE | NPC_FLAG_100 | NPC_FLAG_LOCK_ANIMS | NPC_FLAG_JUMPING | NPC_FLAG_NO_PROJECT_SHADOW,
.init = &N(init_8024981C),
.yaw = 180,
.dropFlags = NPC_DROP_FLAGS_80,
@ -1168,7 +1169,7 @@ StaticNpc N(npcGroup_80249B34)[] = {
.id = NPC_CHUCK_QUIZMO,
.settings = &N(Quizmo_NpcSettings),
.pos = { -400.0f, 0.0f, 100.0f },
.flags = NPC_FLAG_PASSIVE | NPC_FLAG_100 | NPC_FLAG_LOCK_ANIMS | NPC_FLAG_NO_Y_MOVEMENT,
.flags = NPC_FLAG_PASSIVE | NPC_FLAG_100 | NPC_FLAG_LOCK_ANIMS | NPC_FLAG_JUMPING,
.unk_1C = { 00, 00, 00, 01, 00, 03, 02, 00},
.yaw = 263,
.dropFlags = NPC_DROP_FLAGS_80,
@ -1198,7 +1199,7 @@ StaticNpc N(npcGroup_80249B34)[] = {
.id = NPC_DRYITE4,
.settings = &N(npcSettings_80245060),
.pos = { -120.0f, 0.0f, 134.0f },
.flags = NPC_FLAG_PASSIVE | NPC_FLAG_100 | NPC_FLAG_LOCK_ANIMS | NPC_FLAG_NO_Y_MOVEMENT | NPC_FLAG_NO_PROJECT_SHADOW,
.flags = NPC_FLAG_PASSIVE | NPC_FLAG_100 | NPC_FLAG_LOCK_ANIMS | NPC_FLAG_JUMPING | NPC_FLAG_NO_PROJECT_SHADOW,
.init = &N(init_80249ABC),
.yaw = 257,
.dropFlags = NPC_DROP_FLAGS_80,
@ -1229,7 +1230,7 @@ StaticNpc N(npcGroup_80249B34)[] = {
.id = NPC_DRYITE5,
.settings = &N(npcSettings_802450DC),
.pos = { 40.0f, 0.0f, 105.0f },
.flags = NPC_FLAG_PASSIVE | NPC_FLAG_ENABLE_HIT_SCRIPT | NPC_FLAG_100 | NPC_FLAG_LOCK_ANIMS | NPC_FLAG_NO_Y_MOVEMENT | NPC_FLAG_NO_PROJECT_SHADOW,
.flags = NPC_FLAG_PASSIVE | NPC_FLAG_ENABLE_HIT_SCRIPT | NPC_FLAG_100 | NPC_FLAG_LOCK_ANIMS | NPC_FLAG_JUMPING | NPC_FLAG_NO_PROJECT_SHADOW,
.init = &N(init_80249B10),
.yaw = 270,
.dropFlags = NPC_DROP_FLAGS_80,
@ -1263,7 +1264,7 @@ StaticNpc N(npcGroup_8024AE94)[] = {
.id = NPC_THREE_SISTERS0,
.settings = &N(npcSettings_80245160),
.pos = { -141.0f, 0.0f, -18.0f },
.flags = NPC_FLAG_PASSIVE | NPC_FLAG_100 | NPC_FLAG_LOCK_ANIMS | NPC_FLAG_NO_Y_MOVEMENT | NPC_FLAG_NO_PROJECT_SHADOW,
.flags = NPC_FLAG_PASSIVE | NPC_FLAG_100 | NPC_FLAG_LOCK_ANIMS | NPC_FLAG_JUMPING | NPC_FLAG_NO_PROJECT_SHADOW,
.init = &N(init_802498C4),
.yaw = 62,
.dropFlags = NPC_DROP_FLAGS_80,
@ -1293,7 +1294,7 @@ StaticNpc N(npcGroup_8024AE94)[] = {
.id = NPC_THREE_SISTERS1,
.settings = &N(npcSettings_80245160),
.pos = { -124.0f, 0.0f, -61.0f },
.flags = NPC_FLAG_PASSIVE | NPC_FLAG_100 | NPC_FLAG_LOCK_ANIMS | NPC_FLAG_NO_Y_MOVEMENT | NPC_FLAG_NO_PROJECT_SHADOW,
.flags = NPC_FLAG_PASSIVE | NPC_FLAG_100 | NPC_FLAG_LOCK_ANIMS | NPC_FLAG_JUMPING | NPC_FLAG_NO_PROJECT_SHADOW,
.init = &N(init_802498C4),
.yaw = 63,
.dropFlags = NPC_DROP_FLAGS_80,
@ -1323,7 +1324,7 @@ StaticNpc N(npcGroup_8024AE94)[] = {
.id = NPC_THREE_SISTERS2,
.settings = &N(npcSettings_80245160),
.pos = { -80.0f, 0.0f, -35.0f },
.flags = NPC_FLAG_PASSIVE | NPC_FLAG_100 | NPC_FLAG_LOCK_ANIMS | NPC_FLAG_NO_Y_MOVEMENT | NPC_FLAG_NO_PROJECT_SHADOW,
.flags = NPC_FLAG_PASSIVE | NPC_FLAG_100 | NPC_FLAG_LOCK_ANIMS | NPC_FLAG_JUMPING | NPC_FLAG_NO_PROJECT_SHADOW,
.init = &N(init_802498C4),
.yaw = 244,
.dropFlags = NPC_DROP_FLAGS_80,
@ -1997,7 +1998,7 @@ EvtScript N(makeEntities) = {
EVT_END
};
#include "world/common/atomic/enemy/UnkAI_1.inc.c"
#include "world/common/enemy/PatrolNoAttackAI.inc.c"
#include "world/common/atomic/Quizmo.inc.c"
@ -2044,8 +2045,8 @@ ApiStatus N(func_80242858_95DA58)(Evt* script, s32 isInitialCall) {
s32 res;
if (isInitialCall) {
script->functionTemp[1] = (s32) heap_malloc(0x3C);
ptr = (Unk_Struct_1*) script->functionTemp[1];
script->functionTempPtr[1] = heap_malloc(0x3C);
ptr = script->functionTempPtr[1];
ptr->unk_00 = temp_s1->unk_00;
ptr->unk_04 = temp_s1->unk_04;
ptr->unk_08 = temp_s1->unk_08;
@ -2063,7 +2064,7 @@ ApiStatus N(func_80242858_95DA58)(Evt* script, s32 isInitialCall) {
ptr->unk_38 = 0;
}
ptr = (Unk_Struct_1*) script->functionTemp[1];
ptr = script->functionTempPtr[1];
switch (ptr->unk_20) {
case 0:
res = get_xz_dist_to_player(ptr->unk_00, ptr->unk_08);
@ -2156,22 +2157,7 @@ ApiStatus N(func_80242858_95DA58)(Evt* script, s32 isInitialCall) {
return ApiStatus_BLOCK;
}
#include "world/common/SetManyVars.inc.c"
#include "world/common/UnkYawFunc.inc.c"
ApiStatus N(func_80243014_95E214)(Evt* script, s32 isInitialCall) {
Npc* npc = get_npc_unsafe(script->varTable[2]);
N(D_8024E1B4) = npc->currentAnim.w;
npc->currentAnim.w = script->varTable[4];
return ApiStatus_DONE2;
}
ApiStatus N(func_80243058_95E258)(Evt* script, s32 isInitialCall) {
get_npc_unsafe(script->varTable[2])->currentAnim.w = N(D_8024E1B4);
return ApiStatus_DONE2;
}
#include "world/common/LetterDelivery.inc.c"
ApiStatus N(func_80243084_95E284)(Evt* script, s32 isInitialCall) {
PlayerData* playerData = &gPlayerData;

View File

@ -24,7 +24,7 @@ ApiStatus N(Quizmo_NPC_Aux_Impl)(Evt* script, s32 isInitialCall);
ApiStatus N(Quizmo_ShowEntities)(Evt* script, s32 isInitialCall);
ApiStatus N(Quizmo_HideEntities)(Evt* script, s32 isInitialCall);
ApiStatus N(Quizmo_SetCamVfov)(Evt* script, s32 isInitialCall);
ApiStatus N(SetManyVars)(Evt* script, s32 isInitialCall);
ApiStatus N(LetterDelivery_Init)(Evt* script, s32 isInitialCall);
ApiStatus N(TransformFoliage)(Evt* script, s32 isInitialCall);
ApiStatus N(AddPlayerHandsOffset)(Evt* script, s32 isInitialCall);
ApiStatus N(Quizmo_HideWorld)(Evt* script, s32 isInitialCall);
@ -32,10 +32,10 @@ ApiStatus N(Quizmo_AddViewRelativeOffset)(Evt* script, s32 isInitialCall);
ApiStatus N(Quizmo_UpdatePartnerPosition)(Evt* script, s32 isInitialCall);
ApiStatus N(Quizmo_SpinPartner)(Evt* script, s32 isInitialCall);
ApiStatus N(Quizmo_SpinPlayer)(Evt* script, s32 isInitialCall);
ApiStatus N(UnkYawFunc)(Evt* script, s32 isInitialCall);
ApiStatus N(LetterDelivery_CalcLetterPos)(Evt* script, s32 isInitialCall);
ApiStatus N(UnkFunc27)(Evt* script, s32 isInitialCall);
ApiStatus N(UnkFunc26)(Evt* script, s32 isInitialCall);
ApiStatus N(UnkNpcAIMainFunc)(Evt* script, s32 isInitialCall);
ApiStatus N(PatrolNoAttackAI_Main)(Evt* script, s32 isInitialCall);
ApiStatus N(Quizmo_ShouldAppear)(Evt* script, s32 isInitialCall);
ApiStatus N(Quizmo_RenderInit)(Evt* script, s32 isInitialCall);
ApiStatus N(Quizmo_FadeInWorld)(Evt* script, s32 isInitialCall);
@ -52,8 +52,8 @@ ApiStatus N(func_80242730_95D930)(Evt* script, s32 isInitialCall);
ApiStatus N(func_80242784_95D984)(Evt* script, s32 isInitialCall);
ApiStatus N(BigArrayFunc)(Evt* script, s32 isInitialCall);
ApiStatus N(func_80242858_95DA58)(Evt* script, s32 isInitialCall);
ApiStatus N(func_80243014_95E214)(Evt* script, s32 isInitialCall);
ApiStatus N(func_80243058_95E258)(Evt* script, s32 isInitialCall);
ApiStatus N(LetterDelivery_SaveNpcAnim)(Evt* script, s32 isInitialCall);
ApiStatus N(LetterDelivery_RestoreNpcAnim)(Evt* script, s32 isInitialCall);
ApiStatus N(func_80243084_95E284)(Evt* script, s32 isInitialCall);
ApiStatus N(GetFloorCollider)(Evt* script, s32 isInitialCall);
ApiStatus N(func_802431B4_95E3B4)(Evt* script, s32 isInitialCall);

View File

@ -72,7 +72,7 @@ static D_8024F010_Struct N(D_8024F010)[3];
static s8 N(pad_D_8024F07C)[0x4];
static s32 N(KeyItemChoiceList)[(ITEM_LAST_KEY - ITEM_FIRST_VALID_KEY) + 3];
static s32 N(ItemChoiceList)[(ITEM_LAST_VALID_CONSUMABLE - ITEM_FIRST_CONSUMABLE) + 2]; // extra entry for list terminator
static s32 N(D_8024F3B8);
static s32 N(LetterDelivery_SavedNpcAnim);
// DATA
@ -470,12 +470,12 @@ NpcAISettings N(npcAISettings_80247408) = {
.moveSpeed = 1.5f,
.moveTime = 60,
.waitTime = 30,
.unk_14 = -1,
.unk_2C = 1,
.playerSearchInterval = -1,
.unk_AI_2C = 1,
};
EvtScript N(npcAI_80247438) = {
EVT_CALL(DoBasicAI, EVT_PTR(N(npcAISettings_80247408)))
EVT_CALL(BasicAI_Main, EVT_PTR(N(npcAISettings_80247408)))
EVT_RETURN
EVT_END
};
@ -499,12 +499,12 @@ NpcAISettings N(npcAISettings_802474B0) = {
.moveSpeed = 1.5f,
.moveTime = 60,
.waitTime = 30,
.unk_14 = -1,
.unk_2C = 1,
.playerSearchInterval = -1,
.unk_AI_2C = 1,
};
EvtScript N(npcAI_802474E0) = {
EVT_CALL(DoBasicAI, EVT_PTR(N(npcAISettings_802474B0)))
EVT_CALL(BasicAI_Main, EVT_PTR(N(npcAISettings_802474B0)))
EVT_RETURN
EVT_END
};
@ -1310,7 +1310,7 @@ EvtScript N(interact_8024ADE4) = {
EvtScript N(8024B18C) = {
EVT_LOOP(0)
EVT_CALL(GetNpcPos, NPC_PARTNER, EVT_VAR(3), EVT_VAR(4), EVT_VAR(5))
EVT_CALL(N(UnkYawFunc), EVT_VAR(3), EVT_VAR(4), EVT_VAR(5))
EVT_CALL(N(LetterDelivery_CalcLetterPos), EVT_VAR(3), EVT_VAR(4), EVT_VAR(5))
EVT_CALL(SetItemPos, EVT_VAR(0), EVT_VAR(3), EVT_VAR(4), EVT_VAR(5))
EVT_WAIT_FRAMES(1)
EVT_END_LOOP
@ -1329,7 +1329,7 @@ EvtScript N(8024B20C) = {
EVT_CALL(RemoveKeyItemAt, EVT_VAR(1))
EVT_CALL(DisablePartnerAI, 0)
EVT_CALL(GetNpcPos, NPC_PARTNER, EVT_VAR(3), EVT_VAR(4), EVT_VAR(5))
EVT_CALL(N(UnkYawFunc), EVT_VAR(3), EVT_VAR(4), EVT_VAR(5))
EVT_CALL(N(LetterDelivery_CalcLetterPos), EVT_VAR(3), EVT_VAR(4), EVT_VAR(5))
EVT_BITWISE_OR_CONST(EVT_VAR(0), 0x50000)
EVT_CALL(MakeItemEntity, EVT_VAR(0), EVT_VAR(3), EVT_VAR(4), EVT_VAR(5), 1, 0)
EVT_EXEC_GET_TID(N(8024B18C), EVT_VAR(10))
@ -1383,7 +1383,7 @@ EvtScript N(8024B5A0) = {
EVT_IF_LT(EVT_SAVE_VAR(0), -70)
EVT_RETURN
EVT_END_IF
EVT_CALL(N(func_802439FC_96CBBC))
EVT_CALL(N(LetterDelivery_SaveNpcAnim))
EVT_CALL(GetCurrentPartnerID, EVT_VAR(0))
EVT_CALL(FindKeyItem, EVT_VAR(5), EVT_VAR(1))
EVT_IF_EQ(EVT_VAR(0), 4)
@ -1424,7 +1424,7 @@ EvtScript N(8024B5A0) = {
EVT_END_SWITCH
EVT_END_IF
EVT_END_IF
EVT_CALL(N(func_80243A40_96CC00))
EVT_CALL(N(LetterDelivery_RestoreNpcAnim))
EVT_RETURN
EVT_END
};
@ -1434,7 +1434,7 @@ s32 N(D_8024B898_974A58)[] = {
};
EvtScript N(8024B8A0) = {
EVT_CALL(N(SetManyVars), 1, 9634308, 9634305, 74, 75, 852117, 852118, 852119, 852120, EVT_PTR(N(D_8024B898_974A58)))
EVT_CALL(N(LetterDelivery_Init), 1, 9634308, 9634305, 74, 75, 852117, 852118, 852119, 852120, EVT_PTR(N(D_8024B898_974A58)))
EVT_EXEC_WAIT(N(8024B5A0))
EVT_RETURN
EVT_END
@ -1997,7 +1997,7 @@ StaticNpc N(npcGroup_8024D7B4)[] = {
.id = NPC_ARCHEOLOGIST,
.settings = &N(npcSettings_80247484),
.pos = { -320.0f, 0.0f, -14.0f },
.flags = NPC_FLAG_PASSIVE | NPC_FLAG_100 | NPC_FLAG_LOCK_ANIMS | NPC_FLAG_NO_Y_MOVEMENT | NPC_FLAG_NO_PROJECT_SHADOW,
.flags = NPC_FLAG_PASSIVE | NPC_FLAG_100 | NPC_FLAG_LOCK_ANIMS | NPC_FLAG_JUMPING | NPC_FLAG_NO_PROJECT_SHADOW,
.init = &N(init_8024BA50),
.yaw = 90,
.dropFlags = NPC_DROP_FLAGS_80,
@ -2028,7 +2028,7 @@ StaticNpc N(npcGroup_8024D7B4)[] = {
.id = NPC_DRYITE0,
.settings = &N(npcSettings_80247500),
.pos = { -20.0f, 0.0f, 40.0f },
.flags = NPC_FLAG_PASSIVE | NPC_FLAG_100 | NPC_FLAG_LOCK_ANIMS | NPC_FLAG_NO_Y_MOVEMENT | NPC_FLAG_NO_PROJECT_SHADOW,
.flags = NPC_FLAG_PASSIVE | NPC_FLAG_100 | NPC_FLAG_LOCK_ANIMS | NPC_FLAG_JUMPING | NPC_FLAG_NO_PROJECT_SHADOW,
.init = &N(init_8024BBAC),
.yaw = 270,
.dropFlags = NPC_DROP_FLAGS_80,
@ -2059,7 +2059,7 @@ StaticNpc N(npcGroup_8024D7B4)[] = {
.id = NPC_DISGUISED_MOUSTAFA,
.settings = &N(npcSettings_80247558),
.pos = { 245.0f, 0.0f, -35.0f },
.flags = NPC_FLAG_PASSIVE | NPC_FLAG_100 | NPC_FLAG_LOCK_ANIMS | NPC_FLAG_NO_Y_MOVEMENT | NPC_FLAG_NO_PROJECT_SHADOW,
.flags = NPC_FLAG_PASSIVE | NPC_FLAG_100 | NPC_FLAG_LOCK_ANIMS | NPC_FLAG_JUMPING | NPC_FLAG_NO_PROJECT_SHADOW,
.init = &N(init_8024D04C),
.yaw = 90,
.dropFlags = NPC_DROP_FLAGS_80,
@ -2089,7 +2089,7 @@ StaticNpc N(npcGroup_8024D7B4)[] = {
.id = NPC_TOAD,
.settings = &N(npcSettings_80247584),
.pos = { -143.0f, 0.0f, -170.0f },
.flags = NPC_FLAG_PASSIVE | NPC_FLAG_100 | NPC_FLAG_LOCK_ANIMS | NPC_FLAG_NO_Y_MOVEMENT | NPC_FLAG_NO_PROJECT_SHADOW,
.flags = NPC_FLAG_PASSIVE | NPC_FLAG_100 | NPC_FLAG_LOCK_ANIMS | NPC_FLAG_JUMPING | NPC_FLAG_NO_PROJECT_SHADOW,
.init = &N(init_8024D790),
.yaw = 180,
.dropFlags = NPC_DROP_FLAGS_80,
@ -2119,7 +2119,7 @@ StaticNpc N(npcGroup_8024D7B4)[] = {
.id = NPC_WORLD_MERLEE,
.settings = &N(npcSettings_80248754),
.pos = { -130.0f, 0.0f, -400.0f },
.flags = NPC_FLAG_PASSIVE | NPC_FLAG_100 | NPC_FLAG_LOCK_ANIMS | NPC_FLAG_NO_Y_MOVEMENT | NPC_FLAG_NO_PROJECT_SHADOW,
.flags = NPC_FLAG_PASSIVE | NPC_FLAG_100 | NPC_FLAG_LOCK_ANIMS | NPC_FLAG_JUMPING | NPC_FLAG_NO_PROJECT_SHADOW,
.init = &N(init_80247A80),
.yaw = 180,
.dropFlags = NPC_DROP_FLAGS_80,
@ -2149,7 +2149,7 @@ StaticNpc N(npcGroup_8024D7B4)[] = {
.id = NPC_MOUSTAFA,
.settings = &N(npcSettings_80247558),
.pos = { 0.0f, -1000.0f, 0.0f },
.flags = NPC_FLAG_PASSIVE | NPC_FLAG_100 | NPC_FLAG_LOCK_ANIMS | NPC_FLAG_NO_Y_MOVEMENT | NPC_FLAG_NO_PROJECT_SHADOW,
.flags = NPC_FLAG_PASSIVE | NPC_FLAG_100 | NPC_FLAG_LOCK_ANIMS | NPC_FLAG_JUMPING | NPC_FLAG_NO_PROJECT_SHADOW,
.init = &N(init_8024D130),
.yaw = 0,
.dropFlags = NPC_DROP_FLAGS_80,
@ -2179,7 +2179,7 @@ StaticNpc N(npcGroup_8024D7B4)[] = {
.id = NPC_DRYITE1,
.settings = &N(npcSettings_8024752C),
.pos = { 25.0f, 0.0f, -38.0f },
.flags = NPC_FLAG_PASSIVE | NPC_FLAG_100 | NPC_FLAG_LOCK_ANIMS | NPC_FLAG_NO_Y_MOVEMENT | NPC_FLAG_NO_PROJECT_SHADOW,
.flags = NPC_FLAG_PASSIVE | NPC_FLAG_100 | NPC_FLAG_LOCK_ANIMS | NPC_FLAG_JUMPING | NPC_FLAG_NO_PROJECT_SHADOW,
.init = &N(init_8024BCD4),
.yaw = 270,
.dropFlags = NPC_DROP_FLAGS_80,
@ -2209,7 +2209,7 @@ StaticNpc N(npcGroup_8024D7B4)[] = {
.id = NPC_DRYITE2,
.settings = &N(npcSettings_8024752C),
.pos = { -375.0f, 0.0f, -10.0f },
.flags = NPC_FLAG_PASSIVE | NPC_FLAG_100 | NPC_FLAG_LOCK_ANIMS | NPC_FLAG_NO_Y_MOVEMENT | NPC_FLAG_NO_PROJECT_SHADOW,
.flags = NPC_FLAG_PASSIVE | NPC_FLAG_100 | NPC_FLAG_LOCK_ANIMS | NPC_FLAG_JUMPING | NPC_FLAG_NO_PROJECT_SHADOW,
.init = &N(init_8024BD28),
.yaw = 270,
.dropFlags = NPC_DROP_FLAGS_80,
@ -2239,7 +2239,7 @@ StaticNpc N(npcGroup_8024D7B4)[] = {
.id = NPC_MOUSER0,
.settings = &N(npcSettings_80247558),
.pos = { -50.0f, 0.0f, -470.0f },
.flags = NPC_FLAG_PASSIVE | NPC_FLAG_100 | NPC_FLAG_LOCK_ANIMS | NPC_FLAG_NO_Y_MOVEMENT | NPC_FLAG_NO_PROJECT_SHADOW,
.flags = NPC_FLAG_PASSIVE | NPC_FLAG_100 | NPC_FLAG_LOCK_ANIMS | NPC_FLAG_JUMPING | NPC_FLAG_NO_PROJECT_SHADOW,
.init = &N(init_8024BF10),
.yaw = 180,
.dropFlags = NPC_DROP_FLAGS_80,
@ -2269,7 +2269,7 @@ StaticNpc N(npcGroup_8024D7B4)[] = {
.id = NPC_MOUSER1,
.settings = &N(npcSettings_80247558),
.pos = { -270.0f, 0.0f, 91.0f },
.flags = NPC_FLAG_PASSIVE | NPC_FLAG_100 | NPC_FLAG_LOCK_ANIMS | NPC_FLAG_NO_Y_MOVEMENT | NPC_FLAG_NO_PROJECT_SHADOW,
.flags = NPC_FLAG_PASSIVE | NPC_FLAG_100 | NPC_FLAG_LOCK_ANIMS | NPC_FLAG_JUMPING | NPC_FLAG_NO_PROJECT_SHADOW,
.init = &N(init_8024C038),
.yaw = 270,
.dropFlags = NPC_DROP_FLAGS_80,
@ -2299,7 +2299,7 @@ StaticNpc N(npcGroup_8024D7B4)[] = {
.id = NPC_MOUSER2,
.settings = &N(npcSettings_80247558),
.pos = { 210.0f, 0.0f, -35.0f },
.flags = NPC_FLAG_PASSIVE | NPC_FLAG_100 | NPC_FLAG_LOCK_ANIMS | NPC_FLAG_NO_Y_MOVEMENT | NPC_FLAG_NO_PROJECT_SHADOW,
.flags = NPC_FLAG_PASSIVE | NPC_FLAG_100 | NPC_FLAG_LOCK_ANIMS | NPC_FLAG_JUMPING | NPC_FLAG_NO_PROJECT_SHADOW,
.init = &N(init_8024D3E8),
.yaw = 90,
.dropFlags = NPC_DROP_FLAGS_80,
@ -2328,7 +2328,7 @@ StaticNpc N(npcGroup_8024D7B4)[] = {
.id = NPC_CHUCK_QUIZMO,
.settings = &N(Quizmo_NpcSettings),
.pos = { -335.0f, 0.0f, 90.0f },
.flags = NPC_FLAG_PASSIVE | NPC_FLAG_ENABLE_HIT_SCRIPT | NPC_FLAG_100 | NPC_FLAG_LOCK_ANIMS | NPC_FLAG_NO_Y_MOVEMENT | NPC_FLAG_NO_PROJECT_SHADOW,
.flags = NPC_FLAG_PASSIVE | NPC_FLAG_ENABLE_HIT_SCRIPT | NPC_FLAG_100 | NPC_FLAG_LOCK_ANIMS | NPC_FLAG_JUMPING | NPC_FLAG_NO_PROJECT_SHADOW,
.unk_1C = { 00, 00, 00, 01, 00, 03, 02, 01},
.yaw = 270,
.dropFlags = NPC_DROP_FLAGS_80,
@ -2553,19 +2553,4 @@ ApiStatus N(func_80243068_96C228)(Evt* script, s32 isInitialCall) {
#include "world/common/atomic/ToadHouse.inc.c"
#include "world/common/SetManyVars.inc.c"
#include "world/common/UnkYawFunc.inc.c"
ApiStatus N(func_802439FC_96CBBC)(Evt* script, s32 isInitialCall) {
Npc* npc = get_npc_unsafe(script->varTable[2]);
N(D_8024F3B8) = npc->currentAnim.w;
npc->currentAnim.w = script->varTable[4];
return ApiStatus_DONE2;
}
ApiStatus N(func_80243A40_96CC00)(Evt* script, s32 isInitialCall) {
get_npc_unsafe(script->varTable[2])->currentAnim.w = N(D_8024F3B8);
return ApiStatus_DONE2;
}
#include "world/common/LetterDelivery.inc.c"

View File

@ -16,7 +16,7 @@ ApiStatus N(ToadHouse_PutPartnerAway)(Evt* script, s32 isInitialCall);
ApiStatus N(Quizmo_ShowEntities)(Evt* script, s32 isInitialCall);
ApiStatus N(Quizmo_HideEntities)(Evt* script, s32 isInitialCall);
ApiStatus N(Quizmo_SetCamVfov)(Evt* script, s32 isInitialCall);
ApiStatus N(SetManyVars)(Evt* script, s32 isInitialCall);
ApiStatus N(LetterDelivery_Init)(Evt* script, s32 isInitialCall);
ApiStatus N(AddPlayerHandsOffset)(Evt* script, s32 isInitialCall);
ApiStatus N(Quizmo_HideWorld)(Evt* script, s32 isInitialCall);
ApiStatus N(Quizmo_AddViewRelativeOffset)(Evt* script, s32 isInitialCall);
@ -26,7 +26,7 @@ ApiStatus N(Quizmo_FadeInWorld)(Evt* script, s32 isInitialCall);
ApiStatus N(Quizmo_UpdatePartnerPosition)(Evt* script, s32 isInitialCall);
ApiStatus N(Quizmo_SpinPartner)(Evt* script, s32 isInitialCall);
ApiStatus N(Quizmo_SpinPlayer)(Evt* script, s32 isInitialCall);
ApiStatus N(UnkYawFunc)(Evt* script, s32 isInitialCall);
ApiStatus N(LetterDelivery_CalcLetterPos)(Evt* script, s32 isInitialCall);
ApiStatus N(Quizmo_ShouldAppear)(Evt* script, s32 isInitialCall);
ApiStatus N(Quizmo_RenderInit)(Evt* script, s32 isInitialCall);
ApiStatus N(Quizmo_UpdateRecords)(Evt* script, s32 isInitialCall);
@ -53,8 +53,8 @@ ApiStatus N(ToadHouse_UpdateScreenOverlay)(Evt* script, s32 isInitialCall);
ApiStatus N(ToadHouse_CamSetFOV)(Evt* script, s32 isInitialCall);
ApiStatus N(ToadHouse_DoesPlayerNeedSleep)(Evt* script, s32 isInitialCall);
ApiStatus N(ToadHouse_InitScreenOverlay)(Evt* script, s32 isInitialCall);
ApiStatus N(func_802439FC_96CBBC)(Evt* script, s32 isInitialCall);
ApiStatus N(func_80243A40_96CC00)(Evt* script, s32 isInitialCall);
ApiStatus N(LetterDelivery_SaveNpcAnim)(Evt* script, s32 isInitialCall);
ApiStatus N(LetterDelivery_RestoreNpcAnim)(Evt* script, s32 isInitialCall);
void N(func_8024240C_96B5CC)(Evt *script, s32 isInitialCall);
void N(func_80242EAC_96C06C)(Evt *script, s32 isInitialCall);

View File

@ -366,12 +366,12 @@ NpcAISettings N(npcAISettings_8024286C) = {
.moveSpeed = 1.5f,
.moveTime = 30,
.waitTime = 30,
.unk_14 = -1,
.unk_2C = 1,
.playerSearchInterval = -1,
.unk_AI_2C = 1,
};
EvtScript N(npcAI_8024289C) = SCRIPT({
N(UnkNpcAIMainFunc)(N(npcAISettings_8024286C));
N(PatrolNoAttackAI_Main)(N(npcAISettings_8024286C));
});
NpcSettings N(npcSettings_802428BC) = {
@ -1034,7 +1034,7 @@ StaticNpc N(npcGroup_80244E64) = {
.id = NPC_BUBULB0,
.settings = &N(npcSettings_80242840),
.pos = { -72.0f, 60.0f, -100.0f },
.flags = NPC_FLAG_PASSIVE | NPC_FLAG_GRAVITY | NPC_FLAG_NO_Y_MOVEMENT,
.flags = NPC_FLAG_PASSIVE | NPC_FLAG_GRAVITY | NPC_FLAG_JUMPING,
.init = &N(init_80243474),
.yaw = 270,
.dropFlags = NPC_DROP_FLAGS_80,
@ -1065,7 +1065,7 @@ StaticNpc N(npcGroup_80245054)[] = {
.id = NPC_BUBULB1,
.settings = &N(npcSettings_802428BC),
.pos = { -59.0f, 0.0f, -40.0f },
.flags = NPC_FLAG_PASSIVE | NPC_FLAG_NO_Y_MOVEMENT | NPC_FLAG_NO_PROJECT_SHADOW,
.flags = NPC_FLAG_PASSIVE | NPC_FLAG_JUMPING | NPC_FLAG_NO_PROJECT_SHADOW,
.init = &N(init_80243B7C),
.yaw = 90,
.dropFlags = NPC_DROP_FLAGS_80,
@ -1096,7 +1096,7 @@ StaticNpc N(npcGroup_80245054)[] = {
.id = NPC_BUBULB2,
.settings = &N(npcSettings_802428BC),
.pos = { 67.0f, 0.0f, 85.0f },
.flags = NPC_FLAG_PASSIVE | NPC_FLAG_NO_Y_MOVEMENT | NPC_FLAG_NO_PROJECT_SHADOW,
.flags = NPC_FLAG_PASSIVE | NPC_FLAG_JUMPING | NPC_FLAG_NO_PROJECT_SHADOW,
.init = &N(init_80243BB0),
.yaw = 270,
.dropFlags = NPC_DROP_FLAGS_80,
@ -1127,7 +1127,7 @@ StaticNpc N(npcGroup_80245054)[] = {
.id = NPC_BUBULB3,
.settings = &N(npcSettings_802428BC),
.pos = { 90.0f, 0.0f, 410.0f },
.flags = NPC_FLAG_PASSIVE | NPC_FLAG_NO_Y_MOVEMENT | NPC_FLAG_NO_PROJECT_SHADOW,
.flags = NPC_FLAG_PASSIVE | NPC_FLAG_JUMPING | NPC_FLAG_NO_PROJECT_SHADOW,
.init = &N(init_80243BE4),
.yaw = 90,
.dropFlags = NPC_DROP_FLAGS_80,
@ -1158,7 +1158,7 @@ StaticNpc N(npcGroup_80245054)[] = {
.id = NPC_BUBULB4,
.settings = &N(npcSettings_802428BC),
.pos = { 200.0f, 0.0f, 430.0f },
.flags = NPC_FLAG_PASSIVE | NPC_FLAG_NO_Y_MOVEMENT | NPC_FLAG_NO_PROJECT_SHADOW,
.flags = NPC_FLAG_PASSIVE | NPC_FLAG_JUMPING | NPC_FLAG_NO_PROJECT_SHADOW,
.init = &N(init_80243C18),
.yaw = 270,
.dropFlags = NPC_DROP_FLAGS_80,
@ -1191,7 +1191,7 @@ StaticNpc N(npcGroup_80245814) = {
.id = NPC_TOLIELUP,
.settings = &N(npcSettings_802428E8),
.pos = { -400.0f, 0.0f, 190.0f },
.flags = NPC_FLAG_PASSIVE | NPC_FLAG_100 | NPC_FLAG_LOCK_ANIMS | NPC_FLAG_NO_Y_MOVEMENT | NPC_FLAG_NO_PROJECT_SHADOW | NPC_FLAG_400000,
.flags = NPC_FLAG_PASSIVE | NPC_FLAG_100 | NPC_FLAG_LOCK_ANIMS | NPC_FLAG_JUMPING | NPC_FLAG_NO_PROJECT_SHADOW | NPC_FLAG_400000,
.init = &N(init_8024414C),
.yaw = 90,
.dropFlags = NPC_DROP_FLAGS_80,
@ -1222,7 +1222,7 @@ StaticNpc N(npcGroup_80245A04) = {
.id = NPC_WORLD_KLEVAR,
.settings = &N(npcSettings_80242914),
.pos = { 0.0f, -1000.0f, 0.0f },
.flags = NPC_FLAG_PASSIVE | NPC_FLAG_100 | NPC_FLAG_LOCK_ANIMS | NPC_FLAG_NO_Y_MOVEMENT,
.flags = NPC_FLAG_PASSIVE | NPC_FLAG_100 | NPC_FLAG_LOCK_ANIMS | NPC_FLAG_JUMPING,
.init = &N(init_80244BF4),
.yaw = 0,
.dropFlags = NPC_DROP_FLAGS_80,
@ -1252,7 +1252,7 @@ StaticNpc N(npcGroup_80245BF4) = {
.id = NPC_LAKILULU,
.settings = &N(npcSettings_80242840),
.pos = { 198.0f, 0.0f, 363.0f },
.flags = NPC_FLAG_PASSIVE | NPC_FLAG_100 | NPC_FLAG_LOCK_ANIMS | NPC_FLAG_NO_Y_MOVEMENT,
.flags = NPC_FLAG_PASSIVE | NPC_FLAG_100 | NPC_FLAG_LOCK_ANIMS | NPC_FLAG_JUMPING,
.init = &N(init_80244DD0),
.yaw = 270,
.dropFlags = NPC_DROP_FLAGS_80,
@ -1372,7 +1372,7 @@ StaticNpc N(npcGroup_80246264)[] = {
.id = NPC_BUBULB0,
.settings = &N(npcSettings_80245E30),
.pos = { 144.0f, 0.0f, 374.0f },
.flags = NPC_FLAG_PASSIVE | NPC_FLAG_NO_Y_MOVEMENT,
.flags = NPC_FLAG_PASSIVE | NPC_FLAG_JUMPING,
.init = &N(init_80246170),
.yaw = 90,
.dropFlags = NPC_DROP_FLAGS_80,
@ -1401,7 +1401,7 @@ StaticNpc N(npcGroup_80246264)[] = {
.id = NPC_BUBULB1,
.settings = &N(npcSettings_80245E30),
.pos = { 198.0f, 0.0f, 363.0f },
.flags = NPC_FLAG_PASSIVE | NPC_FLAG_NO_Y_MOVEMENT,
.flags = NPC_FLAG_PASSIVE | NPC_FLAG_JUMPING,
.init = &N(init_802461E4),
.yaw = 270,
.dropFlags = NPC_DROP_FLAGS_80,
@ -1430,7 +1430,7 @@ StaticNpc N(npcGroup_80246264)[] = {
.id = NPC_BUBULB2,
.settings = &N(npcSettings_80245E5C),
.pos = { 266.0f, 0.0f, 322.0f },
.flags = NPC_FLAG_PASSIVE | NPC_FLAG_NO_Y_MOVEMENT,
.flags = NPC_FLAG_PASSIVE | NPC_FLAG_JUMPING,
.init = &N(init_80246224),
.yaw = 0,
.dropFlags = NPC_DROP_FLAGS_80,
@ -2080,7 +2080,7 @@ EvtScript N(makeEntities) = SCRIPT({
}
});
#include "world/common/atomic/enemy/UnkAI_1.inc.c"
#include "world/common/enemy/PatrolNoAttackAI.inc.c"
ApiStatus N(PostChapter6StatUpdate)(Evt* script, s32 isInitialCall) {
PlayerData* playerData = &gPlayerData;

View File

@ -10,7 +10,7 @@ ApiStatus N(SyncStatusMenu)(Evt* script, s32 isInitialCall);
ApiStatus N(PostChapter6StatUpdate)(Evt* script, s32 isInitialCall);
ApiStatus N(UnkFloatFunc)(Evt* script, s32 isInitialCall);
ApiStatus N(func_80240000_C9DF20)(Evt* script, s32 isInitialCall);
ApiStatus N(UnkNpcAIMainFunc)(Evt* script, s32 isInitialCall);
ApiStatus N(PatrolNoAttackAI_Main)(Evt* script, s32 isInitialCall);
ApiStatus N(func_80240ED0_C9EDF0)(Evt* script, s32 isInitialCall);
ApiStatus N(func_80240F10_C9EE30)(Evt* script, s32 isInitialCall);
ApiStatus N(func_80240F80_C9EEA0)(Evt* script, s32 isInitialCall);

View File

@ -904,7 +904,7 @@ StaticNpc N(npcGroup_8024388C) = {
.id = NPC_PETUNIA,
.settings = &N(npcSettings_80240EDC),
.pos = { -30.0f, 0.0f, 100.0f },
.flags = NPC_FLAG_PASSIVE | NPC_FLAG_100 | NPC_FLAG_LOCK_ANIMS | NPC_FLAG_NO_Y_MOVEMENT,
.flags = NPC_FLAG_PASSIVE | NPC_FLAG_100 | NPC_FLAG_LOCK_ANIMS | NPC_FLAG_JUMPING,
.init = &N(init_80241DA4),
.yaw = 270,
.dropFlags = NPC_DROP_FLAGS_80,
@ -935,7 +935,7 @@ StaticNpc N(npcGroup_80243A7C) = {
.id = NPC_DAYZEE,
.settings = &N(npcSettings_80240EB0),
.pos = { -233.0f, 0.0f, -217.0f },
.flags = NPC_FLAG_PASSIVE | NPC_FLAG_100 | NPC_FLAG_LOCK_ANIMS | NPC_FLAG_NO_Y_MOVEMENT,
.flags = NPC_FLAG_PASSIVE | NPC_FLAG_100 | NPC_FLAG_LOCK_ANIMS | NPC_FLAG_JUMPING,
.init = &N(init_80241E10),
.yaw = 90,
.dropFlags = NPC_DROP_FLAGS_80,
@ -965,7 +965,7 @@ StaticNpc N(npcGroup_80243C6C) = {
.id = NPC_MONTY_MOLE0,
.settings = &N(npcSettings_80240EB0),
.pos = { -100.0f, 0.0f, 210.0f },
.flags = NPC_FLAG_PASSIVE | NPC_FLAG_100 | NPC_FLAG_GRAVITY | NPC_FLAG_LOCK_ANIMS | NPC_FLAG_NO_Y_MOVEMENT,
.flags = NPC_FLAG_PASSIVE | NPC_FLAG_100 | NPC_FLAG_GRAVITY | NPC_FLAG_LOCK_ANIMS | NPC_FLAG_JUMPING,
.init = &N(init_8024338C),
.yaw = 90,
.dropFlags = NPC_DROP_FLAGS_80,
@ -995,7 +995,7 @@ StaticNpc N(npcGroup_80243E5C) = {
.id = NPC_MONTY_MOLE1,
.settings = &N(npcSettings_80240EB0),
.pos = { -130.0f, 0.0f, 0.0f },
.flags = NPC_FLAG_PASSIVE | NPC_FLAG_100 | NPC_FLAG_GRAVITY | NPC_FLAG_LOCK_ANIMS | NPC_FLAG_NO_Y_MOVEMENT,
.flags = NPC_FLAG_PASSIVE | NPC_FLAG_100 | NPC_FLAG_GRAVITY | NPC_FLAG_LOCK_ANIMS | NPC_FLAG_JUMPING,
.init = &N(init_802434CC),
.yaw = 90,
.dropFlags = NPC_DROP_FLAGS_80,
@ -1025,7 +1025,7 @@ StaticNpc N(npcGroup_8024404C) = {
.id = NPC_MONTY_MOLE2,
.settings = &N(npcSettings_80240EB0),
.pos = { 75.0f, 0.0f, 20.0f },
.flags = NPC_FLAG_PASSIVE | NPC_FLAG_100 | NPC_FLAG_GRAVITY | NPC_FLAG_LOCK_ANIMS | NPC_FLAG_NO_Y_MOVEMENT,
.flags = NPC_FLAG_PASSIVE | NPC_FLAG_100 | NPC_FLAG_GRAVITY | NPC_FLAG_LOCK_ANIMS | NPC_FLAG_JUMPING,
.init = &N(init_8024360C),
.yaw = 270,
.dropFlags = NPC_DROP_FLAGS_80,
@ -1055,7 +1055,7 @@ StaticNpc N(npcGroup_8024423C) = {
.id = NPC_MONTY_MOLE3,
.settings = &N(npcSettings_80240EB0),
.pos = { 71.0f, 0.0f, 200.0f },
.flags = NPC_FLAG_PASSIVE | NPC_FLAG_100 | NPC_FLAG_GRAVITY | NPC_FLAG_LOCK_ANIMS | NPC_FLAG_NO_Y_MOVEMENT,
.flags = NPC_FLAG_PASSIVE | NPC_FLAG_100 | NPC_FLAG_GRAVITY | NPC_FLAG_LOCK_ANIMS | NPC_FLAG_JUMPING,
.init = &N(init_8024374C),
.yaw = 270,
.dropFlags = NPC_DROP_FLAGS_80,
@ -1132,18 +1132,18 @@ ApiStatus N(func_80240158_CA73F8)(Evt* script, s32 isInitialCall) {
add_vec2D_polar(&sp10, &sp14, 46.0f, clamp);
}
}
npc->currentAnim.w = enemy->animList[2];
npc->currentAnim.w = enemy->animList[ENEMY_ANIM_RUN];
npc->yaw = atan2(npc->pos.x, npc->pos.z, sp10, sp14);
npc_move_heading(npc, 2.0f, npc->yaw);
} else if (temp_f4 > 0.2) {
npc->yaw = atan2(npc->pos.x, npc->pos.z, sp10, sp14);
npc->pos.x = sp10;
npc->pos.z = sp14;
npc->currentAnim.w = enemy->animList[1];
npc->currentAnim.w = enemy->animList[ENEMY_ANIM_WALK];
} else {
npc->pos.x = sp10;
npc->pos.z = sp14;
npc->currentAnim.w = enemy->animList[0];
npc->currentAnim.w = enemy->animList[ENEMY_ANIM_IDLE];
}
return ApiStatus_BLOCK;
}

View File

@ -480,7 +480,7 @@ StaticNpc N(npcGroup_8024291C) = {
.id = NPC_POSIE,
.settings = &N(npcSettings_80241220),
.pos = { -260.0f, 0.0f, 0.0f },
.flags = NPC_FLAG_PASSIVE | NPC_FLAG_100 | NPC_FLAG_LOCK_ANIMS | NPC_FLAG_NO_Y_MOVEMENT,
.flags = NPC_FLAG_PASSIVE | NPC_FLAG_100 | NPC_FLAG_LOCK_ANIMS | NPC_FLAG_JUMPING,
.init = &N(init_80242428),
.yaw = 90,
.dropFlags = NPC_DROP_FLAGS_80,

View File

@ -192,18 +192,18 @@ NpcAISettings N(npcAISettings_80242EB0) = {
.moveTime = 30,
.waitTime = 30,
.alertRadius = 100.0f,
.unk_10 = { .f = 30.0f },
.unk_14 = 3,
.alertOffsetDist = 30.0f,
.playerSearchInterval = 3,
.chaseSpeed = 2.4f,
.unk_1C = { .s = 15 },
.unk_20 = 1,
.chaseTurnRate= 15,
.chaseUpdateInterval = 1,
.chaseRadius = 140.0f,
.unk_28 = { .f = 30.0f },
.unk_2C = 1,
.chaseOffsetDist = 30.0f,
.unk_AI_2C = 1,
};
EvtScript N(npcAI_80242EE0) = {
EVT_CALL(N(func_8024150C_CB024C), EVT_PTR(N(npcAISettings_80242EB0)))
EVT_CALL(N(UnkFloAI_Main), EVT_PTR(N(npcAISettings_80242EB0)))
EVT_RETURN
EVT_END
};
@ -241,18 +241,18 @@ NpcAISettings N(npcAISettings_8024300C) = {
.moveTime = 500,
.waitTime = 10,
.alertRadius = 50.0f,
.unk_10 = { .f = 30.0f },
.unk_14 = 3,
.alertOffsetDist = 30.0f,
.playerSearchInterval = 3,
.chaseSpeed = 3.5f,
.unk_1C = { .s = 40 },
.unk_20 = 3,
.chaseTurnRate= 40,
.chaseUpdateInterval = 3,
.chaseRadius = 100.0f,
.unk_28 = { .f = 30.0f },
.unk_2C = 1,
.chaseOffsetDist = 30.0f,
.unk_AI_2C = 1,
};
EvtScript N(npcAI_8024303C) = {
EVT_CALL(DoBasicAI, EVT_PTR(N(npcAISettings_8024300C)))
EVT_CALL(BasicAI_Main, EVT_PTR(N(npcAISettings_8024300C)))
EVT_RETURN
EVT_END
};
@ -458,7 +458,7 @@ StaticNpc N(npcGroup_80243C48) = {
.id = NPC_GATE_FLOWER,
.settings = &N(npcSettings_80242FE0),
.pos = { -695.0f, 0.0f, -30.0f },
.flags = NPC_FLAG_PASSIVE | NPC_FLAG_ENABLE_HIT_SCRIPT | NPC_FLAG_100 | NPC_FLAG_LOCK_ANIMS | NPC_FLAG_NO_Y_MOVEMENT | NPC_FLAG_NO_PROJECT_SHADOW | NPC_FLAG_400000,
.flags = NPC_FLAG_PASSIVE | NPC_FLAG_ENABLE_HIT_SCRIPT | NPC_FLAG_100 | NPC_FLAG_LOCK_ANIMS | NPC_FLAG_JUMPING | NPC_FLAG_NO_PROJECT_SHADOW | NPC_FLAG_400000,
.init = &N(init_80243B20),
.yaw = 270,
.dropFlags = NPC_DROP_FLAGS_80,
@ -489,7 +489,7 @@ StaticNpc N(npcGroup_80243E38) = {
.id = NPC_DAYZEE0,
.settings = &N(npcSettings_8024305C),
.pos = { 205.0f, 0.0f, -80.0f },
.flags = NPC_FLAG_LOCK_ANIMS | NPC_FLAG_NO_Y_MOVEMENT,
.flags = NPC_FLAG_LOCK_ANIMS | NPC_FLAG_JUMPING,
.yaw = 90,
.dropFlags = NPC_DROP_FLAGS_80,
.itemDropChance = 15,
@ -526,7 +526,7 @@ StaticNpc N(npcGroup_80244028) = {
.id = NPC_DAYZEE1,
.settings = &N(npcSettings_8024305C),
.pos = { 275.0f, 0.0f, -115.0f },
.flags = NPC_FLAG_LOCK_ANIMS | NPC_FLAG_NO_Y_MOVEMENT,
.flags = NPC_FLAG_LOCK_ANIMS | NPC_FLAG_JUMPING,
.yaw = 270,
.dropFlags = NPC_DROP_FLAGS_80,
.itemDropChance = 15,
@ -563,7 +563,7 @@ StaticNpc N(npcGroup_80244218) = {
.id = NPC_DAYZEE2,
.settings = &N(npcSettings_8024305C),
.pos = { -230.0f, 60.0f, -110.0f },
.flags = NPC_FLAG_LOCK_ANIMS | NPC_FLAG_NO_Y_MOVEMENT | NPC_FLAG_NO_PROJECT_SHADOW,
.flags = NPC_FLAG_LOCK_ANIMS | NPC_FLAG_JUMPING | NPC_FLAG_NO_PROJECT_SHADOW,
.yaw = 90,
.dropFlags = NPC_DROP_FLAGS_80,
.itemDropChance = 15,
@ -600,7 +600,7 @@ StaticNpc N(npcGroup_80244408) = {
.id = NPC_DAYZEE3,
.settings = &N(npcSettings_8024305C),
.pos = { -330.0f, 60.0f, -110.0f },
.flags = NPC_FLAG_LOCK_ANIMS | NPC_FLAG_NO_Y_MOVEMENT | NPC_FLAG_NO_PROJECT_SHADOW,
.flags = NPC_FLAG_LOCK_ANIMS | NPC_FLAG_JUMPING | NPC_FLAG_NO_PROJECT_SHADOW,
.yaw = 270,
.dropFlags = NPC_DROP_FLAGS_80,
.itemDropChance = 15,
@ -637,7 +637,7 @@ StaticNpc N(npcGroup_802445F8) = {
.id = NPC_DAYZEE4,
.settings = &N(npcSettings_8024305C),
.pos = { -430.0f, 60.0f, -110.0f },
.flags = NPC_FLAG_LOCK_ANIMS | NPC_FLAG_NO_Y_MOVEMENT | NPC_FLAG_NO_PROJECT_SHADOW,
.flags = NPC_FLAG_LOCK_ANIMS | NPC_FLAG_JUMPING | NPC_FLAG_NO_PROJECT_SHADOW,
.yaw = 90,
.dropFlags = NPC_DROP_FLAGS_80,
.itemDropChance = 15,
@ -674,7 +674,7 @@ StaticNpc N(npcGroup_802447E8) = {
.id = NPC_DAYZEE5,
.settings = &N(npcSettings_8024305C),
.pos = { -530.0f, 60.0f, -110.0f },
.flags = NPC_FLAG_LOCK_ANIMS | NPC_FLAG_NO_Y_MOVEMENT | NPC_FLAG_NO_PROJECT_SHADOW,
.flags = NPC_FLAG_LOCK_ANIMS | NPC_FLAG_JUMPING | NPC_FLAG_NO_PROJECT_SHADOW,
.yaw = 270,
.dropFlags = NPC_DROP_FLAGS_80,
.itemDropChance = 15,
@ -711,7 +711,7 @@ StaticNpc N(npcGroup_802449D8) = {
.id = NPC_DAYZEE6,
.settings = &N(npcSettings_8024305C),
.pos = { -630.0f, 60.0f, -110.0f },
.flags = NPC_FLAG_LOCK_ANIMS | NPC_FLAG_NO_Y_MOVEMENT | NPC_FLAG_NO_PROJECT_SHADOW,
.flags = NPC_FLAG_LOCK_ANIMS | NPC_FLAG_JUMPING | NPC_FLAG_NO_PROJECT_SHADOW,
.yaw = 90,
.dropFlags = NPC_DROP_FLAGS_80,
.itemDropChance = 15,
@ -769,7 +769,7 @@ StaticNpc N(npcGroup_80244CD4) = {
.id = NPC_DAYZEE7,
.settings = &N(npcSettings_80242FB4),
.pos = { 240.0f, 0.0f, -90.0f },
.flags = NPC_FLAG_LOCK_ANIMS | NPC_FLAG_NO_Y_MOVEMENT | NPC_FLAG_NO_PROJECT_SHADOW,
.flags = NPC_FLAG_LOCK_ANIMS | NPC_FLAG_JUMPING | NPC_FLAG_NO_PROJECT_SHADOW,
.init = &N(init_80244BC8),
.yaw = 270,
.dropFlags = NPC_DROP_FLAGS_80,
@ -822,222 +822,7 @@ static s32 N(pad_4F3C) = {
0x00000000,
};
void N(func_80240D80_CAFAC0)(Evt* script, NpcAISettings* npcAISettings, EnemyTerritoryThing* territory) {
Enemy* enemy = script->owner1.enemy;
Npc* npc = get_npc_unsafe(enemy->npcID);
f32 temp_f0;
f32 temp_f20;
f64 temp_f2;
f32 phi_f22;
f32 phi_f24;
f32 phi_f26;
s32 phi_s3;
f32 subroutine_arg8;
f32 subroutine_arg9;
f32 subroutine_argA;
f32 subroutine_argB;
f32 subroutine_argC;
f32 subroutine_argD;
f32 subroutine_argE;
f32 subroutine_argF;
f32 subroutine_arg10;
npc->duration = npcAISettings->unk_20 / 2 + rand_int(npcAISettings->unk_20 / 2 + 1);
npc->currentAnim.w = enemy->animList[3];
npc->moveSpeed = npcAISettings->chaseSpeed;
phi_s3 = FALSE;
temp_f20 = clamp_angle(atan2(npc->pos.x, npc->pos.z, gPlayerStatusPtr->position.x,
gPlayerStatusPtr->position.z) + 180.0f);
temp_f0 = get_clamped_angle_diff(npc->yaw, temp_f20);
if (npcAISettings->unk_1C.s < fabsf(temp_f0)) {
temp_f20 = npc->yaw;
if (temp_f0 < 0.0f) {
temp_f20 += -npcAISettings->unk_1C.s;
} else {
temp_f20 += npcAISettings->unk_1C.s;
}
}
npc->yaw = clamp_angle(temp_f20);
subroutine_arg8 = npc->pos.x;
subroutine_arg9 = npc->pos.y;
subroutine_argA = npc->pos.z;
temp_f20 = clamp_angle(atan2(npc->pos.x, npc->pos.z, gPlayerStatusPtr->position.x,
gPlayerStatusPtr->position.z) + 180.0f);
phi_f22 = 0.0f;
phi_f24 = 0.0f;
phi_f26 = 0.0f;
if (npc_test_move_simple_without_slipping(npc->collisionChannel, &subroutine_arg8, &subroutine_arg9, &subroutine_argA, npc->moveSpeed * 4.5, temp_f20,
npc->collisionHeight, npc->collisionRadius) != 0) {
phi_f22 = dist2D(npc->pos.x, npc->pos.z, subroutine_arg8, subroutine_argA);
subroutine_argB = npc->pos.x;
subroutine_argC = npc->pos.y;
subroutine_argD = npc->pos.z;
if (npc_test_move_simple_without_slipping(npc->collisionChannel, &subroutine_argB, &subroutine_argC, &subroutine_argD, npc->moveSpeed * 4.5,
clamp_angle(temp_f20 + 35.0f), npc->collisionHeight, npc->collisionRadius) != 0) {
phi_f24 = dist2D(npc->pos.x, npc->pos.z, subroutine_argB, subroutine_argD);
}
subroutine_argE = npc->pos.x;
subroutine_argF = npc->pos.y;
subroutine_arg10 = npc->pos.z;
if (npc_test_move_simple_without_slipping(npc->collisionChannel, &subroutine_argE, &subroutine_argF, &subroutine_arg10, npc->moveSpeed * 4.5,
clamp_angle(temp_f20 - 35.0f), npc->collisionHeight, npc->collisionRadius) != 0) {
phi_f26 = dist2D(npc->pos.x, npc->pos.z, subroutine_argE, subroutine_arg10);
}
dist2D(npc->pos.x, npc->pos.z, gPlayerStatusPtr->position.x, gPlayerStatusPtr->position.z);
if ((phi_f22 < npc->moveSpeed * 1.5) && (phi_f24 < npc->moveSpeed * 1.5) && (phi_f26 < npc->moveSpeed * 1.5) &&
(func_800490B4(territory, enemy, npcAISettings->alertRadius, npcAISettings->unk_10.f, 0) != 0)) {
phi_s3 = TRUE;
}
if (!phi_s3) {
if ((phi_f24 < phi_f22) && (phi_f26 < phi_f24)) {
temp_f20 = atan2(npc->pos.x, npc->pos.z, subroutine_arg8, subroutine_argA);
} else if ((phi_f24 < phi_f22) && (phi_f24 < phi_f26)) {
temp_f20 = atan2(npc->pos.x, npc->pos.z, subroutine_arg8, subroutine_argA);
} else if ((phi_f22 < phi_f24) && (phi_f26 < phi_f22)) {
temp_f20 = atan2(npc->pos.x, npc->pos.z, subroutine_argB, subroutine_argD);
} else if ((phi_f26 < phi_f24) && (phi_f22 < phi_f26)) {
temp_f20 = atan2(npc->pos.x, npc->pos.z, subroutine_argB, subroutine_argD);
} else if ((phi_f22 < phi_f26) && (phi_f24 < phi_f22)) {
temp_f20 = atan2(npc->pos.x, npc->pos.z, subroutine_argE, subroutine_arg10);
} else if ((phi_f24 < phi_f26) && (phi_f22 < phi_f24)) {
temp_f20 = atan2(npc->pos.x, npc->pos.z, subroutine_argE, subroutine_arg10);
}
temp_f0 = get_clamped_angle_diff(npc->yaw, temp_f20);
if (npcAISettings->unk_1C.s < fabsf(temp_f0)) {
temp_f20 = npc->yaw;
if (temp_f0 < 0.0f) {
temp_f20 += -npcAISettings->unk_1C.s;
} else {
temp_f20 += npcAISettings->unk_1C.s;
}
}
npc->yaw = clamp_angle(temp_f20);
}
}
if (phi_s3) {
npc->duration = 0xA;
npc->currentAnim.w = enemy->animList[8];
}
script->functionTemp[0] = 0xD;
}
void N(func_80241364_CB00A4)(Evt* script, NpcAISettings* npcAISettings, EnemyTerritoryThing* territory) {
Enemy* enemy = script->owner1.enemy;
Npc* npc = get_npc_unsafe(enemy->npcID);
s32 var;
if (func_800490B4(territory, enemy, npcAISettings->chaseRadius, npcAISettings->unk_28.f, 1) == 0) {
fx_emote(EMOTE_QUESTION, npc, 0.0f, npc->collisionHeight, 1.0f, 2.0f, -20.0f, 0xF, &var);
npc->currentAnim.w = enemy->animList[0];
npc->duration = 25;
script->functionTemp[0] = 14;
} else {
if (npc->currentAnim.w != enemy->animList[8]) {
if (npc->moveSpeed < 4.0) {
func_8003D660(npc, 0);
} else {
func_8003D660(npc, 1);
}
npc_move_heading(npc, npc->moveSpeed, npc->yaw);
}
if (npc->duration > 0) {
npc->duration--;
return;
} else {
script->functionTemp[0] = 12;
}
}
}
void N(func_802414C8_CB0208)(Evt* script, NpcAISettings* npcAISettings, EnemyTerritoryThing* territory) {
Enemy* enemy = script->owner1.enemy;
Npc* npc = get_npc_unsafe(enemy->npcID);
npc->duration--;
if (npc->duration == 0) {
script->functionTemp[0] = NULL;
}
}
ApiStatus N(func_8024150C_CB024C)(Evt* script, s32 isInitialCall) {
Enemy* enemy = script->owner1.enemy;
Npc* npc = get_npc_unsafe(enemy->npcID);
Bytecode* args = script->ptrReadPos;
EnemyTerritoryThing territory;
EnemyTerritoryThing* territoryPtr = &territory;
NpcAISettings* npcAISettings = (NpcAISettings*)evt_get_variable(script, *args++);
territory.unk_00 = 0;
territory.shape = enemy->territory->wander.detectShape;
territory.pointX = enemy->territory->wander.detect.x;
territory.pointZ = enemy->territory->wander.detect.z;
territory.sizeX = enemy->territory->wander.detectSizeX;
territory.sizeZ = enemy->territory->wander.detectSizeZ;
territory.unk_18 = 100.0f;
territory.unk_1C = 0;
if (isInitialCall || (enemy->unk_B0 & ENEMY_AI_FLAGS_4)) {
script->functionTemp[0] = 0;
npc->duration = 0;
npc->currentAnim.w = enemy->animList[0];
npc->flags &= ~0x800;
if (!enemy->territory->wander.isFlying) {
npc->flags = (npc->flags | 0x200) & ~0x8;
} else {
npc->flags = (npc->flags & ~0x200) | 0x8;
}
if (enemy->unk_B0 & ENEMY_AI_FLAGS_4) {
script->functionTemp[0] = 99;
script->functionTemp[1] = 0;
enemy->unk_B0 &= ~ENEMY_AI_FLAGS_4;
}
}
switch (script->functionTemp[0]) {
case 0:
func_800495A0(script, npcAISettings, territoryPtr);
case 1:
func_800496B8(script, npcAISettings, territoryPtr);
break;
case 2:
base_UnkNpcAIFunc1(script, npcAISettings, territoryPtr);
case 3:
func_80049C04(script, npcAISettings, territoryPtr);
break;
case 10:
func_80049E3C(script, npcAISettings, territoryPtr);
case 11:
func_80049ECC(script, npcAISettings, territoryPtr);
break;
case 12:
N(func_80240D80_CAFAC0)(script, npcAISettings, territoryPtr);
case 13:
N(func_80241364_CB00A4)(script, npcAISettings, territoryPtr);
break;
case 14:
N(func_802414C8_CB0208)(script, npcAISettings, territoryPtr);
break;
case 99:
func_8004A73C(script);
}
return ApiStatus_BLOCK;
}
#include "world/common/enemy/UnkFloAI.inc.c"
#include "world/common/atomic/ItemChoice_PartA.inc.c"

View File

@ -9,7 +9,7 @@
ApiStatus N(AddPlayerHandsOffset)(Evt* script, s32 isInitialCall);
ApiStatus N(TransformFoliage)(Evt* script, s32 isInitialCall);
ApiStatus N(func_80240D40_CAFA80)(Evt* script, s32 isInitialCall);
ApiStatus N(func_8024150C_CB024C)(Evt* script, s32 isInitialCall);
ApiStatus N(UnkFloAI_Main)(Evt* script, s32 isInitialCall);
ApiStatus N(ItemChoice_WaitForSelection)(Evt* script, s32 isInitialCall);
ApiStatus N(ItemChoice_SaveSelected)(Evt* script, s32 isInitialCall);
ApiStatus N(BuildItemChoiceList)(Evt* script, s32 isInitialCall);

View File

@ -421,18 +421,18 @@ NpcAISettings N(npcAISettings_802435B0) = {
.moveTime = 500,
.waitTime = 10,
.alertRadius = 50.0f,
.unk_10 = { .f = 30.0f },
.unk_14 = 3,
.alertOffsetDist = 30.0f,
.playerSearchInterval = 3,
.chaseSpeed = 3.5f,
.unk_1C = { .s = 40 },
.unk_20 = 3,
.chaseTurnRate= 40,
.chaseUpdateInterval = 3,
.chaseRadius = 100.0f,
.unk_28 = { .f = 30.0f },
.unk_2C = 1,
.chaseOffsetDist = 30.0f,
.unk_AI_2C = 1,
};
EvtScript N(npcAI_802435E0) = {
EVT_CALL(DoBasicAI, EVT_PTR(N(npcAISettings_802435B0)))
EVT_CALL(BasicAI_Main, EVT_PTR(N(npcAISettings_802435B0)))
EVT_RETURN
EVT_END
};
@ -446,7 +446,7 @@ NpcSettings N(npcSettings_80243600) = {
.level = 19,
};
f32 N(sixFloats)[] = {
f32 N(FlyingAI_JumpVels)[] = {
4.5f, 3.5f, 2.6f, 2.0f,
1.5f, 20.0f,
};
@ -456,14 +456,14 @@ NpcAISettings N(npcAISettings_80243644) = {
.moveTime = 30,
.waitTime = 5,
.alertRadius = 80.0f,
.unk_10 = { .f = 30.0f },
.unk_14 = 2,
.alertOffsetDist = 30.0f,
.playerSearchInterval = 2,
.chaseSpeed = 4.5f,
.unk_1C = { .s = 6 },
.unk_20 = 1,
.chaseTurnRate= 6,
.chaseUpdateInterval = 1,
.chaseRadius = 90.0f,
.unk_28 = { .f = 30.0f },
.unk_2C = 1,
.chaseOffsetDist = 30.0f,
.unk_AI_2C = 1,
};
EvtScript N(npcAI_80243674) = {
@ -471,7 +471,7 @@ EvtScript N(npcAI_80243674) = {
EVT_CALL(SetSelfVar, 5, -630)
EVT_CALL(SetSelfVar, 6, 50)
EVT_CALL(SetSelfVar, 1, 200)
EVT_CALL(N(UnkNpcAIMainFunc9), EVT_PTR(N(npcAISettings_80243644)))
EVT_CALL(N(FlyingAI_Main), EVT_PTR(N(npcAISettings_80243644)))
EVT_RETURN
EVT_END
};
@ -543,7 +543,7 @@ StaticNpc N(npcGroup_8024398C) = {
.id = NPC_DAYZEE0,
.settings = &N(npcSettings_80243600),
.pos = { -350.0f, 0.0f, 40.0f },
.flags = NPC_FLAG_100 | NPC_FLAG_LOCK_ANIMS | NPC_FLAG_NO_Y_MOVEMENT | NPC_FLAG_NO_PROJECT_SHADOW,
.flags = NPC_FLAG_100 | NPC_FLAG_LOCK_ANIMS | NPC_FLAG_JUMPING | NPC_FLAG_NO_PROJECT_SHADOW,
.yaw = 90,
.dropFlags = NPC_DROP_FLAGS_80,
.itemDropChance = 15,
@ -580,7 +580,7 @@ StaticNpc N(npcGroup_80243B7C) = {
.id = NPC_DAYZEE1,
.settings = &N(npcSettings_80243600),
.pos = { 260.0f, 0.0f, 75.0f },
.flags = NPC_FLAG_100 | NPC_FLAG_LOCK_ANIMS | NPC_FLAG_NO_Y_MOVEMENT | NPC_FLAG_NO_PROJECT_SHADOW,
.flags = NPC_FLAG_100 | NPC_FLAG_LOCK_ANIMS | NPC_FLAG_JUMPING | NPC_FLAG_NO_PROJECT_SHADOW,
.yaw = 270,
.dropFlags = NPC_DROP_FLAGS_80,
.itemDropChance = 15,
@ -617,7 +617,7 @@ StaticNpc N(npcGroup_80243D6C) = {
.id = NPC_BZZAP0,
.settings = &N(npcSettings_802436E4),
.pos = { -50.0f, 55.0f, 90.0f },
.flags = NPC_FLAG_100 | NPC_FLAG_LOCK_ANIMS | NPC_FLAG_NO_Y_MOVEMENT | NPC_FLAG_NO_PROJECT_SHADOW,
.flags = NPC_FLAG_100 | NPC_FLAG_LOCK_ANIMS | NPC_FLAG_JUMPING | NPC_FLAG_NO_PROJECT_SHADOW,
.yaw = 90,
.dropFlags = NPC_DROP_FLAGS_80,
.itemDropChance = 15,
@ -655,7 +655,7 @@ StaticNpc N(npcGroup_80243F5C) = {
.id = NPC_BZZAP1,
.settings = &N(npcSettings_80243710),
.pos = { 0.0f, -1000.0f, 0.0f },
.flags = NPC_FLAG_4 | NPC_FLAG_100 | NPC_FLAG_LOCK_ANIMS | NPC_FLAG_NO_Y_MOVEMENT | NPC_FLAG_NO_PROJECT_SHADOW,
.flags = NPC_FLAG_4 | NPC_FLAG_100 | NPC_FLAG_LOCK_ANIMS | NPC_FLAG_JUMPING | NPC_FLAG_NO_PROJECT_SHADOW,
.init = &N(init_80243954),
.yaw = 90,
.dropFlags = NPC_DROP_FLAGS_80,

View File

@ -1,3 +1,3 @@
#include "flo_09.h"
#include "world/common/atomic/enemy/UnkAI_9.inc.c"
#include "world/common/enemy/FlyingAI.inc.c"

View File

@ -9,9 +9,9 @@
ApiStatus N(TransformFoliage)(Evt* script, s32 isInitialCall);
ApiStatus N(func_80240000_CB5000)(Evt* script, s32 isInitialCall);
ApiStatus N(UnkFunc43)(Evt* script, s32 isInitialCall);
ApiStatus N(UnkNpcAIMainFunc9)(Evt* script, s32 isInitialCall);
ApiStatus N(FlyingAI_Main)(Evt* script, s32 isInitialCall);
extern f32 N(sixFloats)[];
extern f32 N(FlyingAI_JumpVels)[];
extern NpcGroupList N(npcGroupList_8024414C);
extern EvtScript N(802425DC);
extern EvtScript N(802434A8);

View File

@ -757,7 +757,7 @@ StaticNpc N(npcGroup_80243E64) = {
.id = NPC_LILY,
.settings = &N(npcSettings_80243220),
.pos = { 80.0f, -60.0f, 0.0f },
.flags = NPC_FLAG_PASSIVE | NPC_FLAG_100 | NPC_FLAG_LOCK_ANIMS | NPC_FLAG_NO_Y_MOVEMENT,
.flags = NPC_FLAG_PASSIVE | NPC_FLAG_100 | NPC_FLAG_LOCK_ANIMS | NPC_FLAG_JUMPING,
.init = &N(init_80243D78),
.yaw = 270,
.dropFlags = NPC_DROP_FLAGS_80,

View File

@ -562,7 +562,7 @@ StaticNpc N(npcGroup_80242CF4)[] = {
.id = NPC_LAKITU0,
.settings = &N(npcSettings_80241AC0),
.pos = { 553.0f, 60.0f, 52.0f },
.flags = NPC_FLAG_PASSIVE | NPC_FLAG_100 | NPC_FLAG_LOCK_ANIMS | NPC_FLAG_NO_Y_MOVEMENT | NPC_FLAG_40000,
.flags = NPC_FLAG_PASSIVE | NPC_FLAG_100 | NPC_FLAG_LOCK_ANIMS | NPC_FLAG_JUMPING | NPC_FLAG_40000,
.init = &N(init_80242B58),
.yaw = 270,
.dropFlags = NPC_DROP_FLAGS_80,
@ -599,7 +599,7 @@ StaticNpc N(npcGroup_80242CF4)[] = {
.id = NPC_LAKITU1,
.settings = &N(npcSettings_80241AC0),
.pos = { 553.0f, 60.0f, 52.0f },
.flags = NPC_FLAG_PASSIVE | NPC_FLAG_100 | NPC_FLAG_LOCK_ANIMS | NPC_FLAG_NO_Y_MOVEMENT | NPC_FLAG_40000,
.flags = NPC_FLAG_PASSIVE | NPC_FLAG_100 | NPC_FLAG_LOCK_ANIMS | NPC_FLAG_JUMPING | NPC_FLAG_40000,
.init = &N(init_80242C38),
.yaw = 270,
.dropFlags = NPC_DROP_FLAGS_80,

View File

@ -413,7 +413,7 @@ StaticNpc N(npcGroup_802425D8)[] = {
.id = NPC_ROSIE0,
.settings = &N(npcSettings_80240E30),
.pos = { -70.0f, 0.0f, 20.0f },
.flags = NPC_FLAG_PASSIVE | NPC_FLAG_100 | NPC_FLAG_LOCK_ANIMS | NPC_FLAG_NO_Y_MOVEMENT | NPC_FLAG_400000,
.flags = NPC_FLAG_PASSIVE | NPC_FLAG_100 | NPC_FLAG_LOCK_ANIMS | NPC_FLAG_JUMPING | NPC_FLAG_400000,
.init = &N(init_802423D0),
.yaw = 90,
.dropFlags = NPC_DROP_FLAGS_80,

View File

@ -229,7 +229,7 @@ NpcSettings N(npcSettings_80244100) = {
.level = 20,
};
f32 N(sixFloats)[] = {
f32 N(FlyingAI_JumpVels)[] = {
4.5f, 3.5f, 2.6f, 2.0f,
1.5f, 20.0f,
};
@ -239,14 +239,14 @@ NpcAISettings N(npcAISettings_80244144) = {
.moveTime = 60,
.waitTime = 30,
.alertRadius = 60.0f,
.unk_10 = { .f = 50.0f },
.unk_14 = 3,
.alertOffsetDist = 50.0f,
.playerSearchInterval = 3,
.chaseSpeed = 3.5f,
.unk_1C = { .s = 60 },
.unk_20 = 10,
.chaseTurnRate= 60,
.chaseUpdateInterval = 10,
.chaseRadius = 80.0f,
.unk_28 = { .f = 70.0f },
.unk_2C = 1,
.chaseOffsetDist = 70.0f,
.unk_AI_2C = 1,
};
EvtScript N(npcAI_80244174) = {
@ -254,7 +254,7 @@ EvtScript N(npcAI_80244174) = {
EVT_CALL(SetSelfVar, 5, -650)
EVT_CALL(SetSelfVar, 6, 30)
EVT_CALL(SetSelfVar, 1, 400)
EVT_CALL(N(func_80241DB8_CC55C8), EVT_PTR(N(npcAISettings_80244144)))
EVT_CALL(N(LakituAI_Main), EVT_PTR(N(npcAISettings_80244144)))
EVT_RETURN
EVT_END
};
@ -273,12 +273,12 @@ NpcAISettings N(npcAISettings_80244210) = {
.moveTime = 30,
.waitTime = 50,
.alertRadius = 60.0f,
.unk_10 = { .f = 30.0f },
.unk_14 = 3,
.alertOffsetDist = 30.0f,
.playerSearchInterval = 3,
.chaseSpeed = 6.0f,
.chaseRadius = 100.0f,
.unk_28 = { .f = 30.0f },
.unk_2C = 3,
.chaseOffsetDist = 30.0f,
.unk_AI_2C = 3,
};
EvtScript N(npcAI_80244240) = {
@ -286,7 +286,7 @@ EvtScript N(npcAI_80244240) = {
EVT_CALL(SetSelfVar, 3, 18)
EVT_CALL(SetSelfVar, 5, 3)
EVT_CALL(SetSelfVar, 7, 4)
EVT_CALL(N(UnkNpcAIMainFunc6), EVT_PTR(N(npcAISettings_80244210)))
EVT_CALL(N(SpinyAI_Main), EVT_PTR(N(npcAISettings_80244210)))
EVT_RETURN
EVT_END
};
@ -839,7 +839,7 @@ StaticNpc N(npcGroup_80246434) = {
.id = NPC_WORLD_LAKILESTER,
.settings = &N(npcSettings_80244100),
.pos = { 0.0f, -1000.0f, 0.0f },
.flags = NPC_FLAG_PASSIVE | NPC_FLAG_4 | NPC_FLAG_100 | NPC_FLAG_GRAVITY | NPC_FLAG_LOCK_ANIMS | NPC_FLAG_NO_Y_MOVEMENT | NPC_FLAG_40000,
.flags = NPC_FLAG_PASSIVE | NPC_FLAG_4 | NPC_FLAG_100 | NPC_FLAG_GRAVITY | NPC_FLAG_LOCK_ANIMS | NPC_FLAG_JUMPING | NPC_FLAG_40000,
.init = &N(init_80246280),
.yaw = 90,
.dropFlags = NPC_DROP_FLAGS_80,
@ -869,7 +869,7 @@ StaticNpc N(npcGroup_80246624) = {
.id = NPC_LAKILULU0,
.settings = &N(npcSettings_80244100),
.pos = { 0.0f, -1000.0f, 0.0f },
.flags = NPC_FLAG_PASSIVE | NPC_FLAG_100 | NPC_FLAG_LOCK_ANIMS | NPC_FLAG_NO_Y_MOVEMENT,
.flags = NPC_FLAG_PASSIVE | NPC_FLAG_100 | NPC_FLAG_LOCK_ANIMS | NPC_FLAG_JUMPING,
.init = &N(init_802462D0),
.yaw = 90,
.dropFlags = NPC_DROP_FLAGS_80,
@ -900,7 +900,7 @@ StaticNpc N(npcGroup_80246814) = {
.id = NPC_LAKILULU1,
.settings = &N(npcSettings_80244100),
.pos = { 0.0f, -1000.0f, 0.0f },
.flags = NPC_FLAG_PASSIVE | NPC_FLAG_100 | NPC_FLAG_GRAVITY | NPC_FLAG_LOCK_ANIMS | NPC_FLAG_NO_Y_MOVEMENT,
.flags = NPC_FLAG_PASSIVE | NPC_FLAG_100 | NPC_FLAG_GRAVITY | NPC_FLAG_LOCK_ANIMS | NPC_FLAG_JUMPING,
.init = &N(init_80246370),
.yaw = 90,
.dropFlags = NPC_DROP_FLAGS_80,
@ -930,7 +930,7 @@ StaticNpc N(npcGroup_80246A04) = {
.id = NPC_LAKITU0,
.settings = &N(npcSettings_802441E4),
.pos = { 335.0f, 90.0f, 45.0f },
.flags = NPC_FLAG_LOCK_ANIMS | NPC_FLAG_NO_Y_MOVEMENT,
.flags = NPC_FLAG_LOCK_ANIMS | NPC_FLAG_JUMPING,
.init = &N(init_802463B0),
.yaw = 270,
.dropFlags = NPC_DROP_FLAGS_80,
@ -970,7 +970,7 @@ StaticNpc N(npcGroup_80246BF4) = {
.id = NPC_LAKITU1,
.settings = &N(npcSettings_802441E4),
.pos = { -320.0f, 90.0f, 0.0f },
.flags = NPC_FLAG_LOCK_ANIMS | NPC_FLAG_NO_Y_MOVEMENT,
.flags = NPC_FLAG_LOCK_ANIMS | NPC_FLAG_JUMPING,
.init = &N(init_802463B0),
.yaw = 90,
.dropFlags = NPC_DROP_FLAGS_80,
@ -1221,286 +1221,10 @@ NpcGroupList N(npcGroupList_80247984) = {
#include "world/common/UnkFunc41.inc.c"
#include "world/common/atomic/enemy/UnkAI_9.inc.c"
s32 N(func_802416BC_CC4ECC)(void) {
s32 i;
for (i = 50; i < 56; i++) {
if (get_enemy(i)->varTable[10] == 0) {
return i;
}
}
return -1;
}
void N(func_80241704_CC4F14)(Evt* script, NpcAISettings* aiSettings, EnemyTerritoryThing* territory) {
Enemy* enemy = script->owner1.enemy;
Npc* npc = get_npc_unsafe(enemy->npcID);
f32 x, y, z, w;
s32 var;
f32 temp_f20;
f32 temp_f22;
f32 temp_f24;
f32 var1 = enemy->varTable[4];
f32 var2 = enemy->varTable[3];
f32 var3;
temp_f22 = var1 / 100.0;
temp_f24 = var2 / 100.0;
if (npc->duration > 0) {
npc->duration--;
}
var3 = enemy->varTable[1];
temp_f20 = var3 / 100.0;
x = npc->pos.x;
y = npc->pos.y;
z = npc->pos.z;
w = 1000.0f;
npc_raycast_down_sides(npc->collisionChannel, &x, &y, &z, &w);
npc->pos.y = y + temp_f24 + (sin_deg(enemy->varTable[2]) * temp_f20);
enemy->varTable[2] = clamp_angle(enemy->varTable[2] + 0xC);
if (aiSettings->unk_14 >= 0) {
if (script->functionTemp[1] <= 0) {
script->functionTemp[1] = aiSettings->unk_14;
if (func_800490B4(territory, enemy, aiSettings->alertRadius, aiSettings->unk_10.f, 0) != 0) {
fx_emote(EMOTE_EXCLAMATION, npc, 0.0f, npc->collisionHeight, 1.0f, 2.0f, -20.0f, 0xF, &var);
ai_enemy_play_sound(npc, 0x2F4, 0x200000);
x = npc->pos.x;
y = npc->pos.y;
z = npc->pos.z;
w = 1000.0f;
npc_raycast_down_sides(npc->collisionChannel, &x, &y, &z, &w);
npc->moveToPos.y = y + temp_f24;
script->functionTemp[0] = 12;
return;
}
}
script->functionTemp[1]--;
}
if (is_point_within_region(enemy->territory->wander.wanderShape, enemy->territory->wander.point.x,
enemy->territory->wander.point.z, npc->pos.x, npc->pos.z, enemy->territory->wander.wanderSizeX,
enemy->territory->wander.wanderSizeZ) != 0) {
npc->yaw = atan2(npc->pos.x, npc->pos.z, enemy->territory->wander.point.x, enemy->territory->wander.point.z);
}
if (npc->turnAroundYawAdjustment == 0) {
if (npc->duration > 0) {
npc_move_heading(npc, npc->moveSpeed, npc->yaw);
if (enemy->varTable[0] & 1) {
x = npc->pos.x;
y = temp_f22;
z = npc->pos.z;
w = 1000.0f;
npc_raycast_down_sides(npc->collisionChannel, &x, &y, &z, &w);
y += temp_f24;
w = y - temp_f22;
if (w > 2.0) {
temp_f22 += 2.0;
} else if (w < -2.0) {
temp_f22 -= 2.0;
} else {
temp_f22 = y;
}
enemy->varTable[4] = (temp_f22 * 100.0);
}
if (npc->duration > 0) {
return;
}
}
script->functionTemp[0] = 2;
script->functionTemp[1] = (rand_int(1000) % 3) + 2;
if ((aiSettings->unk_2C <= 0) || (aiSettings->moveTime <= 0) || (script->functionTemp[1] == 0)) {
script->functionTemp[0] = 0;
}
}
}
void N(func_80241B68_CC5378)(Evt* script, NpcAISettings* aiSettings, EnemyTerritoryThing* territory) {
Enemy* enemy = script->owner1.enemy;
Npc* npc = get_npc_unsafe(enemy->npcID);
f32 x, y, z, w;
s32 var;
f32 var1 = enemy->varTable[3];
f32 var2;
f32 temp_f20;
f32 temp_f22;
temp_f22 = var1 / 100.0;
if (npc->duration > 0) {
npc->duration--;
}
var2 = enemy->varTable[1];
temp_f20 = var2 / 100.0;
x = npc->pos.x;
y = npc->pos.y;
z = npc->pos.z;
w = 1000.0f;
npc_raycast_down_sides(npc->collisionChannel, &x, &y, &z, &w);
npc->pos.y = y + temp_f22 + (sin_deg(enemy->varTable[2]) * temp_f20);
enemy->varTable[2] = clamp_angle(enemy->varTable[2] + 0xC);
if (func_800490B4(territory, enemy, aiSettings->chaseRadius, aiSettings->unk_28.f, 1) != 0) {
fx_emote(EMOTE_EXCLAMATION, npc, 0.0f, npc->collisionHeight, 1.0f, 2.0f, -20.0f, 0xF, &var);
ai_enemy_play_sound(npc, 0x2F4, 0x200000);
script->functionTemp[0] = 12;
return;
}
if ((npc->turnAroundYawAdjustment == 0) && (npc->duration <= 0)) {
script->functionTemp[1]--;
if (script->functionTemp[1] > 0) {
npc->yaw = clamp_angle(npc->yaw + 180.0f);
npc->duration = (rand_int(1000) % 11) + 5;
return;
}
script->functionTemp[0] = 0;
}
}
// enemy2 is being copied to a0
#ifdef NON_EQUIVALENT
ApiStatus N(func_80241DB8_CC55C8)(Evt* script, s32 isInitialCall) {
Enemy* enemy = script->owner1.enemy;
Bytecode* args = script->ptrReadPos;
Npc* npc = get_npc_unsafe(enemy->npcID);
EnemyTerritoryThing territory;
EnemyTerritoryThing* territoryPtr = &territory;
NpcAISettings* aiSettings =(NpcAISettings*) evt_get_variable(script, *args);
f32 temp_f4;
f32 dist;
territory.unk_00 = 0;
territory.shape = enemy->territory->wander.detectShape;
territory.pointX = enemy->territory->wander.detect.x;
territory.pointZ = enemy->territory->wander.detect.z;
territory.sizeX = enemy->territory->wander.detectSizeX;
territory.sizeZ = enemy->territory->wander.detectSizeZ;
territory.unk_18 = 120.0f;
territory.unk_1C = 0;
if (isInitialCall) {
N(UnkFunc5)(npc, enemy, script, aiSettings);
script->functionTemp[0] = 0;
}
npc->unk_AB = -3;
if (enemy->unk_B0 & ENEMY_AI_FLAGS_4) {
if (enemy->unk_B4 != 0) {
return ApiStatus_BLOCK;
}
enemy->unk_B0 &= ~ENEMY_AI_FLAGS_4;
}
switch (script->functionTemp[0]) {
case 0:
N(UnkNpcAIFunc23)(script, aiSettings, territoryPtr);
case 1:
N(func_80241704_CC4F14)(script, aiSettings, territoryPtr);
break;
case 2:
N(UnkNpcAIFunc1)(script, aiSettings, territoryPtr);
case 3:
N(func_80241B68_CC5378)(script, aiSettings, territoryPtr);
break;
}
if (script->functionTemp[0] == 12) {
npc->yaw = atan2(npc->pos.x, npc->pos.z, gPlayerStatusPtr->position.x, gPlayerStatusPtr->position.z);
enemy->varTable[4] = N(func_802416BC_CC4ECC)();
if (enemy->varTable[4] >= 0) {
Enemy* enemy2 = get_enemy(enemy->varTable[4]);
enemy2->varTable[10] = 1;
enemy2->varTable[11] = enemy->npcID;
npc->duration = 15;
npc->currentAnim.w = 0x490014;
script->functionTemp[0] = 30;
}
}
switch (script->functionTemp[0]) {
case 12:
N(UnkNpcAIFunc14)(script, aiSettings, territoryPtr);
case 13:
N(UnkNpcAIFunc3)(script, aiSettings, territoryPtr);
break;
case 14:
N(UnkFunc6)(script, aiSettings, territoryPtr);
break;
}
switch (script->functionTemp[0]) {
case 30:
npc->duration--;
if (npc->duration <= 0) {
get_enemy(enemy->varTable[4])->varTable[10] = 2;
npc->duration = 5;
script->functionTemp[0] = 31;
}
case 31:
npc->duration--;
if (npc->duration <= 0) {
npc->currentAnim.w = 0x490015;
get_enemy(enemy->varTable[4])->varTable[10] = 3;
npc->duration = 10;
script->functionTemp[0] = 32;
}
case 32:
npc->duration--;
if (npc->duration <= 0) {
npc->duration = 3;
script->functionTemp[0] = 33;
}
case 33:
npc->duration--;
if (npc->duration <= 0) {
script->functionTemp[0] = 0;
}
break;
}
if (((u32)script->functionTemp[0] - 30) < 2) {
npc->yaw = atan2(npc->pos.x, npc->pos.z, gPlayerStatusPtr->position.x, gPlayerStatusPtr->position.z);
dist = dist2D(gPlayerStatusPtr->position.x, gPlayerStatusPtr->position.z, npc->pos.x, npc->pos.z);
if (!is_point_within_region(territoryPtr->shape, territoryPtr->pointX, territoryPtr->pointZ, npc->pos.x, npc->pos.z,
territoryPtr->sizeX, territoryPtr->sizeZ)) {
if ((dist > 30.0) && (npc->turnAroundYawAdjustment == 0)) {
temp_f4 = dist - 20.0;
if (temp_f4 < 0.0) {
temp_f4 = 0.0f;
}
if (temp_f4 > 200.0) {
temp_f4 = 200.0f;
}
npc->moveSpeed = update_lerp(0, aiSettings->moveSpeed, aiSettings->chaseSpeed, temp_f4, 200);
npc_move_heading(npc, npc->moveSpeed, npc->yaw);
}
}
}
return ApiStatus_BLOCK;
}
#else
INCLUDE_ASM(ApiStatus, "world/area_flo/flo_13/CC3850", flo_13_func_80241DB8_CC55C8, Evt* script,
s32 isInitialCall);
#endif
#include "world/common/atomic/enemy/UnkAI_6.inc.c"
#define AI_LAKITU_FIRST_SPINY_ID 50
#define AI_LAKITU_LAST_SPINY_ID 55
#include "world/common/enemy/LakituAI.inc.c"
#include "world/common/enemy/SpinyAI.inc.c"
#include "world/common/UnkFunc42.inc.c"

View File

@ -8,8 +8,8 @@
ApiStatus N(func_80240000_CC3810)(Evt* script, s32 isInitialCall);
ApiStatus N(UnkFunc41)(Evt* script, s32 isInitialCall);
ApiStatus N(func_80241DB8_CC55C8)(Evt* script, s32 isInitialCall);
ApiStatus N(UnkNpcAIMainFunc6)(Evt* script, s32 isInitialCall);
ApiStatus N(LakituAI_Main)(Evt* script, s32 isInitialCall);
ApiStatus N(SpinyAI_Main)(Evt* script, s32 isInitialCall);
ApiStatus N(UnkFunc42)(Evt* script, s32 isInitialCall);
ApiStatus N(func_802433C0_CC6BD0)(Evt* script, s32 isInitialCall);
ApiStatus N(func_802434D4_CC6CE4)(Evt* script, s32 isInitialCall);

View File

@ -9,7 +9,7 @@ enum {
BSS s32 N(ItemChoiceList)[91];
f32 N(sixFloats)[] = {
f32 N(FlyingAI_JumpVels)[] = {
4.5f, 3.5f, 2.6f, 2.0f,
1.5f, 20.0f,
};
@ -19,14 +19,14 @@ NpcAISettings N(npcAISettings_802444D8) = {
.moveTime = 30,
.waitTime = 5,
.alertRadius = 80.0f,
.unk_10 = { .f = 30.0f },
.unk_14 = 2,
.alertOffsetDist = 30.0f,
.playerSearchInterval = 2,
.chaseSpeed = 4.5f,
.unk_1C = { .s = 6 },
.unk_20 = 1,
.chaseTurnRate= 6,
.chaseUpdateInterval = 1,
.chaseRadius = 90.0f,
.unk_28 = { .f = 30.0f },
.unk_2C = 1,
.chaseOffsetDist = 30.0f,
.unk_AI_2C = 1,
};
EvtScript N(npcAI_80244508) = {
@ -34,7 +34,7 @@ EvtScript N(npcAI_80244508) = {
EVT_CALL(SetSelfVar, 5, -630)
EVT_CALL(SetSelfVar, 6, 50)
EVT_CALL(SetSelfVar, 1, 200)
EVT_CALL(N(UnkNpcAIMainFunc9), EVT_PTR(N(npcAISettings_802444D8)))
EVT_CALL(N(FlyingAI_Main), EVT_PTR(N(npcAISettings_802444D8)))
EVT_RETURN
EVT_END
};
@ -169,7 +169,7 @@ StaticNpc N(npcGroup_80244B20) = {
.id = NPC_BUBULB,
.settings = &N(npcSettings_802445A4),
.pos = { 617.0f, 0.0f, 108.0f },
.flags = NPC_FLAG_PASSIVE | NPC_FLAG_100 | NPC_FLAG_LOCK_ANIMS | NPC_FLAG_NO_Y_MOVEMENT | NPC_FLAG_4000,
.flags = NPC_FLAG_PASSIVE | NPC_FLAG_100 | NPC_FLAG_LOCK_ANIMS | NPC_FLAG_JUMPING | NPC_FLAG_4000,
.init = &N(init_80244ADC),
.yaw = 270,
.dropFlags = NPC_DROP_FLAGS_80,
@ -200,7 +200,7 @@ StaticNpc N(npcGroup_80244D10) = {
.id = NPC_BZZAP,
.settings = &N(npcSettings_80244578),
.pos = { -175.0f, 55.0f, 15.0f },
.flags = NPC_FLAG_LOCK_ANIMS | NPC_FLAG_NO_Y_MOVEMENT,
.flags = NPC_FLAG_LOCK_ANIMS | NPC_FLAG_JUMPING,
.yaw = 90,
.dropFlags = NPC_DROP_FLAGS_80,
.itemDropChance = 15,
@ -323,7 +323,7 @@ EvtScript N(80245224) = {
EVT_END
};
#include "world/common/atomic/enemy/UnkAI_9.inc.c"
#include "world/common/enemy/FlyingAI.inc.c"
#include "world/common/atomic/ItemChoice_PartA.inc.c"

View File

@ -17,7 +17,7 @@ ApiStatus N(func_8024042C_CCB73C)(Evt* script, s32 isInitialCall);
ApiStatus N(func_8024046C_CCB77C)(Evt* script, s32 isInitialCall);
void N(func_80240504_CCB814)(void);
void N(func_802407D4_CCBAE4)(void);
ApiStatus N(UnkNpcAIMainFunc9)(Evt* script, s32 isInitialCall);
ApiStatus N(FlyingAI_Main)(Evt* script, s32 isInitialCall);
ApiStatus N(ItemChoice_WaitForSelection)(Evt* script, s32 isInitialCall);
ApiStatus N(ItemChoice_SaveSelected)(Evt* script, s32 isInitialCall);
ApiStatus N(BuildItemChoiceList)(Evt* script, s32 isInitialCall);

View File

@ -282,7 +282,7 @@ StaticNpc N(npcGroup_80240EE0)[] = {
.id = NPC_SUN0,
.settings = &N(npcSettings_80240300),
.pos = { 0.0f, 250.0f, 0.0f },
.flags = NPC_FLAG_PASSIVE | NPC_FLAG_100 | NPC_FLAG_LOCK_ANIMS | NPC_FLAG_NO_Y_MOVEMENT | NPC_FLAG_400000,
.flags = NPC_FLAG_PASSIVE | NPC_FLAG_100 | NPC_FLAG_LOCK_ANIMS | NPC_FLAG_JUMPING | NPC_FLAG_400000,
.init = &N(init_80240CD0),
.yaw = 270,
.dropFlags = NPC_DROP_FLAGS_80,
@ -312,7 +312,7 @@ StaticNpc N(npcGroup_80240EE0)[] = {
.id = NPC_SUN1,
.settings = &N(npcSettings_80240300),
.pos = { 0.0f, 250.0f, 0.0f },
.flags = NPC_FLAG_PASSIVE | NPC_FLAG_100 | NPC_FLAG_GRAVITY | NPC_FLAG_LOCK_ANIMS | NPC_FLAG_NO_Y_MOVEMENT | NPC_FLAG_8000,
.flags = NPC_FLAG_PASSIVE | NPC_FLAG_100 | NPC_FLAG_GRAVITY | NPC_FLAG_LOCK_ANIMS | NPC_FLAG_JUMPING | NPC_FLAG_8000,
.init = &N(init_80240DB4),
.yaw = 270,
.dropFlags = NPC_DROP_FLAGS_80,

View File

@ -8,7 +8,7 @@ enum {
NPC_TUFF_PUFF1,
};
f32 N(sixFloats)[] = {
f32 N(FlyingAI_JumpVels)[] = {
4.5f, 3.5f, 2.6f, 2.0f,
1.5f, 20.0f,
};
@ -18,12 +18,12 @@ NpcAISettings N(npcAISettings_80244028) = {
.moveTime = 45,
.waitTime = 60,
.alertRadius = 100.0f,
.unk_14 = 3,
.playerSearchInterval = 3,
.chaseSpeed = 3.6f,
.unk_1C = { .s = 10 },
.unk_20 = 1,
.chaseTurnRate= 10,
.chaseUpdateInterval = 1,
.chaseRadius = 120.0f,
.unk_2C = 1,
.unk_AI_2C = 1,
};
EvtScript N(npcAI_80244058) = {
@ -31,7 +31,7 @@ EvtScript N(npcAI_80244058) = {
EVT_CALL(SetSelfVar, 5, 0)
EVT_CALL(SetSelfVar, 6, 0)
EVT_CALL(SetSelfVar, 1, 600)
EVT_CALL(N(UnkNpcAIMainFunc10), EVT_PTR(N(npcAISettings_80244028)))
EVT_CALL(N(FlyingNoAttackAI_Main), EVT_PTR(N(npcAISettings_80244028)))
EVT_RETURN
EVT_END
};
@ -49,7 +49,7 @@ StaticNpc N(npcGroup_802440F4) = {
.id = NPC_TUFF_PUFF0,
.settings = &N(npcSettings_802440C8),
.pos = { 440.0f, 145.0f, 15.0f },
.flags = NPC_FLAG_LOCK_ANIMS | NPC_FLAG_NO_Y_MOVEMENT,
.flags = NPC_FLAG_LOCK_ANIMS | NPC_FLAG_JUMPING,
.yaw = 90,
.dropFlags = NPC_DROP_FLAGS_80,
.itemDropChance = 10,
@ -85,7 +85,7 @@ StaticNpc N(npcGroup_802442E4) = {
.id = NPC_TUFF_PUFF1,
.settings = &N(npcSettings_802440C8),
.pos = { 600.0f, 145.0f, 15.0f },
.flags = NPC_FLAG_LOCK_ANIMS | NPC_FLAG_NO_Y_MOVEMENT,
.flags = NPC_FLAG_LOCK_ANIMS | NPC_FLAG_JUMPING,
.yaw = 270,
.dropFlags = NPC_DROP_FLAGS_80,
.itemDropChance = 10,
@ -353,6 +353,6 @@ EvtScript N(802451C4) = {
EVT_END
};
#include "world/common/atomic/enemy/UnkAI_9.inc.c"
#include "world/common/enemy/FlyingAI.inc.c"
#include "world/common/atomic/enemy/UnkAI_10.inc.c"
#include "world/common/enemy/FlyingNoAttackAI.inc.c"

View File

@ -9,7 +9,7 @@
ApiStatus N(UnkFunc43)(Evt* script, s32 isInitialCall);
ApiStatus N(func_80240000_CD1E30)(Evt* script, s32 isInitialCall);
ApiStatus N(UnkFunc44)(Evt* script, s32 isInitialCall);
ApiStatus N(UnkNpcAIMainFunc10)(Evt* script, s32 isInitialCall);
ApiStatus N(FlyingNoAttackAI_Main)(Evt* script, s32 isInitialCall);
ApiStatus N(func_80242940_CD4770)(Evt* script, s32 isInitialCall);
extern NpcGroupList N(npcGroupList_802444D4);

View File

@ -309,7 +309,7 @@ NpcSettings N(npcSettings_802443D8) = {
.level = 99,
};
f32 N(sixFloats)[] = {
f32 N(FlyingAI_JumpVels)[] = {
4.5f, 3.5f, 2.6f, 2.0f,
1.5f, 20.0f,
};
@ -319,14 +319,14 @@ NpcAISettings N(npcAISettings_80244424) = {
.moveTime = 60,
.waitTime = 30,
.alertRadius = 60.0f,
.unk_10 = { .f = 50.0f },
.unk_14 = 3,
.alertOffsetDist = 50.0f,
.playerSearchInterval = 3,
.chaseSpeed = 3.5f,
.unk_1C = { .s = 60 },
.unk_20 = 10,
.chaseTurnRate= 60,
.chaseUpdateInterval = 10,
.chaseRadius = 80.0f,
.unk_28 = { .f = 70.0f },
.unk_2C = 1,
.chaseOffsetDist = 70.0f,
.unk_AI_2C = 1,
};
EvtScript N(npcAI_80244454) = {
@ -334,7 +334,7 @@ EvtScript N(npcAI_80244454) = {
EVT_CALL(SetSelfVar, 5, -650)
EVT_CALL(SetSelfVar, 6, 30)
EVT_CALL(SetSelfVar, 1, 400)
EVT_CALL(N(func_80241C64_CD8F44), EVT_PTR(N(npcAISettings_80244424)))
EVT_CALL(N(LakituAI_Main), EVT_PTR(N(npcAISettings_80244424)))
EVT_RETURN
EVT_END
};
@ -353,12 +353,12 @@ NpcAISettings N(npcAISettings_802444F0) = {
.moveTime = 30,
.waitTime = 50,
.alertRadius = 60.0f,
.unk_10 = { .f = 30.0f },
.unk_14 = 3,
.alertOffsetDist = 30.0f,
.playerSearchInterval = 3,
.chaseSpeed = 6.0f,
.chaseRadius = 100.0f,
.unk_28 = { .f = 30.0f },
.unk_2C = 3,
.chaseOffsetDist = 30.0f,
.unk_AI_2C = 3,
};
EvtScript N(npcAI_80244520) = {
@ -366,7 +366,7 @@ EvtScript N(npcAI_80244520) = {
EVT_CALL(SetSelfVar, 3, 18)
EVT_CALL(SetSelfVar, 5, 3)
EVT_CALL(SetSelfVar, 7, 4)
EVT_CALL(N(UnkNpcAIMainFunc6), EVT_PTR(N(npcAISettings_802444F0)))
EVT_CALL(N(SpinyAI_Main), EVT_PTR(N(npcAISettings_802444F0)))
EVT_RETURN
EVT_END
};
@ -401,7 +401,7 @@ StaticNpc N(npcGroup_80244688) = {
.id = NPC_LAKITU0,
.settings = &N(npcSettings_802444C4),
.pos = { -185.0f, 90.0f, 10.0f },
.flags = NPC_FLAG_LOCK_ANIMS | NPC_FLAG_NO_Y_MOVEMENT,
.flags = NPC_FLAG_LOCK_ANIMS | NPC_FLAG_JUMPING,
.yaw = 270,
.dropFlags = NPC_DROP_FLAGS_80,
.itemDropChance = 25,
@ -440,7 +440,7 @@ StaticNpc N(npcGroup_80244878) = {
.id = NPC_LAKITU1,
.settings = &N(npcSettings_802444C4),
.pos = { 200.0f, 90.0f, -25.0f },
.flags = NPC_FLAG_LOCK_ANIMS | NPC_FLAG_NO_Y_MOVEMENT,
.flags = NPC_FLAG_LOCK_ANIMS | NPC_FLAG_JUMPING,
.yaw = 90,
.dropFlags = NPC_DROP_FLAGS_80,
.itemDropChance = 25,
@ -479,7 +479,7 @@ StaticNpc N(npcGroup_80244A68) = {
.id = NPC_SPINY0,
.settings = &N(npcSettings_8024465C),
.pos = { 0.0f, -1000.0f, 0.0f },
.flags = NPC_FLAG_4 | NPC_FLAG_LOCK_ANIMS | NPC_FLAG_NO_Y_MOVEMENT,
.flags = NPC_FLAG_4 | NPC_FLAG_LOCK_ANIMS | NPC_FLAG_JUMPING,
.yaw = 0,
.dropFlags = NPC_DROP_FLAGS_80,
.heartDrops = STANDARD_HEART_DROPS(3),
@ -511,7 +511,7 @@ StaticNpc N(npcGroup_80244C58) = {
.id = NPC_SPINY1,
.settings = &N(npcSettings_8024465C),
.pos = { 0.0f, -1000.0f, 0.0f },
.flags = NPC_FLAG_4 | NPC_FLAG_LOCK_ANIMS | NPC_FLAG_NO_Y_MOVEMENT,
.flags = NPC_FLAG_4 | NPC_FLAG_LOCK_ANIMS | NPC_FLAG_JUMPING,
.yaw = 0,
.dropFlags = NPC_DROP_FLAGS_80,
.heartDrops = STANDARD_HEART_DROPS(3),
@ -543,7 +543,7 @@ StaticNpc N(npcGroup_80244E48) = {
.id = NPC_SPINY2,
.settings = &N(npcSettings_8024465C),
.pos = { 0.0f, -1000.0f, 0.0f },
.flags = NPC_FLAG_4 | NPC_FLAG_LOCK_ANIMS | NPC_FLAG_NO_Y_MOVEMENT,
.flags = NPC_FLAG_4 | NPC_FLAG_LOCK_ANIMS | NPC_FLAG_JUMPING,
.yaw = 0,
.dropFlags = NPC_DROP_FLAGS_80,
.heartDrops = STANDARD_HEART_DROPS(3),
@ -575,7 +575,7 @@ StaticNpc N(npcGroup_80245038) = {
.id = NPC_SPINY3,
.settings = &N(npcSettings_8024465C),
.pos = { 0.0f, -1000.0f, 0.0f },
.flags = NPC_FLAG_4 | NPC_FLAG_LOCK_ANIMS | NPC_FLAG_NO_Y_MOVEMENT,
.flags = NPC_FLAG_4 | NPC_FLAG_LOCK_ANIMS | NPC_FLAG_JUMPING,
.yaw = 0,
.dropFlags = NPC_DROP_FLAGS_80,
.heartDrops = STANDARD_HEART_DROPS(3),
@ -625,283 +625,7 @@ EvtScript N(makeEntities) = {
EVT_END
};
#include "world/common/atomic/enemy/UnkAI_9.inc.c"
s32 N(func_80241568_CD8848)(void) {
s32 i;
for (i = 50; i < 54; i++) {
if (get_enemy(i)->varTable[10] == 0) {
return i;
}
}
return -1;
}
void N(func_802415B0_CD8890)(Evt* script, NpcAISettings* aiSettings, EnemyTerritoryThing* territory) {
Enemy* enemy = script->owner1.enemy;
Npc* npc = get_npc_unsafe(enemy->npcID);
f32 x, y, z, w;
s32 var;
f32 temp_f20;
f32 temp_f22;
f32 temp_f24;
f32 var1 = enemy->varTable[4];
f32 var2 = enemy->varTable[3];
f32 var3;
temp_f22 = var1 / 100.0;
temp_f24 = var2 / 100.0;
if (npc->duration > 0) {
npc->duration--;
}
var3 = enemy->varTable[1];
temp_f20 = var3 / 100.0;
x = npc->pos.x;
y = npc->pos.y;
z = npc->pos.z;
w = 1000.0f;
npc_raycast_down_sides(npc->collisionChannel, &x, &y, &z, &w);
npc->pos.y = y + temp_f24 + (sin_deg(enemy->varTable[2]) * temp_f20);
enemy->varTable[2] = clamp_angle(enemy->varTable[2] + 0xC);
if (aiSettings->unk_14 >= 0) {
if (script->functionTemp[1] <= 0) {
script->functionTemp[1] = aiSettings->unk_14;
if (func_800490B4(territory, enemy, aiSettings->alertRadius, aiSettings->unk_10.f, 0) != 0) {
fx_emote(EMOTE_EXCLAMATION, npc, 0.0f, npc->collisionHeight, 1.0f, 2.0f, -20.0f, 0xF, &var);
ai_enemy_play_sound(npc, 0x2F4, 0x200000);
x = npc->pos.x;
y = npc->pos.y;
z = npc->pos.z;
w = 1000.0f;
npc_raycast_down_sides(npc->collisionChannel, &x, &y, &z, &w);
npc->moveToPos.y = y + temp_f24;
script->functionTemp[0] = 12;
return;
}
}
script->functionTemp[1]--;
}
if (is_point_within_region(enemy->territory->wander.wanderShape, enemy->territory->wander.point.x,
enemy->territory->wander.point.z, npc->pos.x, npc->pos.z, enemy->territory->wander.wanderSizeX,
enemy->territory->wander.wanderSizeZ) != 0) {
npc->yaw = atan2(npc->pos.x, npc->pos.z, enemy->territory->wander.point.x, enemy->territory->wander.point.z);
}
if (npc->turnAroundYawAdjustment == 0) {
if (npc->duration > 0) {
npc_move_heading(npc, npc->moveSpeed, npc->yaw);
if (enemy->varTable[0] & 1) {
x = npc->pos.x;
y = temp_f22;
z = npc->pos.z;
w = 1000.0f;
npc_raycast_down_sides(npc->collisionChannel, &x, &y, &z, &w);
y += temp_f24;
w = y - temp_f22;
if (w > 2.0) {
temp_f22 += 2.0;
} else if (w < -2.0) {
temp_f22 -= 2.0;
} else {
temp_f22 = y;
}
enemy->varTable[4] = (temp_f22 * 100.0);
}
if (npc->duration > 0) {
return;
}
}
script->functionTemp[0] = 2;
script->functionTemp[1] = (rand_int(1000) % 3) + 2;
if ((aiSettings->unk_2C <= 0) || (aiSettings->moveTime <= 0) || (script->functionTemp[1] == 0)) {
script->functionTemp[0] = 0;
}
}
}
void N(func_80241A14_CD8CF4)(Evt* script, NpcAISettings* aiSettings, EnemyTerritoryThing* territory) {
Enemy* enemy = script->owner1.enemy;
Npc* npc = get_npc_unsafe(enemy->npcID);
f32 x, y, z, w;
s32 var;
f32 var1 = enemy->varTable[3];
f32 var2;
f32 temp_f20;
f32 temp_f22;
temp_f22 = var1 / 100.0;
if (npc->duration > 0) {
npc->duration--;
}
var2 = enemy->varTable[1];
temp_f20 = var2 / 100.0;
x = npc->pos.x;
y = npc->pos.y;
z = npc->pos.z;
w = 1000.0f;
npc_raycast_down_sides(npc->collisionChannel, &x, &y, &z, &w);
npc->pos.y = y + temp_f22 + (sin_deg(enemy->varTable[2]) * temp_f20);
enemy->varTable[2] = clamp_angle(enemy->varTable[2] + 0xC);
if (func_800490B4(territory, enemy, aiSettings->chaseRadius, aiSettings->unk_28.f, 1) != 0) {
fx_emote(EMOTE_EXCLAMATION, npc, 0.0f, npc->collisionHeight, 1.0f, 2.0f, -20.0f, 0xF, &var);
ai_enemy_play_sound(npc, 0x2F4, 0x200000);
script->functionTemp[0] = 12;
return;
}
if ((npc->turnAroundYawAdjustment == 0) && (npc->duration <= 0)) {
script->functionTemp[1]--;
if (script->functionTemp[1] > 0) {
npc->yaw = clamp_angle(npc->yaw + 180.0f);
npc->duration = (rand_int(1000) % 11) + 5;
return;
}
script->functionTemp[0] = 0;
}
}
// enemy2 is being copied to a0
#ifdef NON_EQUIVALENT
ApiStatus N(func_80241C64_CD8F44)(Evt* script, s32 isInitialCall) {
Enemy* enemy = script->owner1.enemy;
Bytecode* args = script->ptrReadPos;
Npc* npc = get_npc_unsafe(enemy->npcID);
EnemyTerritoryThing territory;
EnemyTerritoryThing* territoryPtr = &territory;
NpcAISettings* aiSettings =(NpcAISettings*) evt_get_variable(script, *args);
f32 temp_f4;
f32 dist;
territory.unk_00 = 0;
territory.shape = enemy->territory->wander.detectShape;
territory.pointX = enemy->territory->wander.detect.x;
territory.pointZ = enemy->territory->wander.detect.z;
territory.sizeX = enemy->territory->wander.detectSizeX;
territory.sizeZ = enemy->territory->wander.detectSizeZ;
territory.unk_18 = 120.0f;
territory.unk_1C = 0;
if (isInitialCall) {
N(UnkFunc5)(npc, enemy, script, aiSettings);
script->functionTemp[0] = 0;
}
npc->unk_AB = -3;
if (enemy->unk_B0 & ENEMY_AI_FLAGS_4) {
if (enemy->unk_B4 != 0) {
return ApiStatus_BLOCK;
}
enemy->unk_B0 &= ~ENEMY_AI_FLAGS_4;
}
switch (script->functionTemp[0]) {
case 0:
N(UnkNpcAIFunc23)(script, aiSettings, territoryPtr);
case 1:
N(func_802415B0_CD8890)(script, aiSettings, territoryPtr);
break;
case 2:
N(UnkNpcAIFunc1_copy)(script, aiSettings, territoryPtr);
case 3:
N(func_80241A14_CD8CF4)(script, aiSettings, territoryPtr);
break;
}
if (script->functionTemp[0] == 12) {
npc->yaw = atan2(npc->pos.x, npc->pos.z, gPlayerStatusPtr->position.x, gPlayerStatusPtr->position.z);
enemy->varTable[4] = N(func_80241568_CD8848)();
if (enemy->varTable[4] >= 0) {
Enemy* enemy2 = get_enemy(enemy->varTable[4]);
enemy2->varTable[10] = 1;
enemy2->varTable[11] = enemy->npcID;
npc->duration = 15;
npc->currentAnim.w = 0x490014;
script->functionTemp[0] = 30;
}
}
switch (script->functionTemp[0]) {
case 12:
N(UnkNpcAIFunc14)(script, aiSettings, territoryPtr);
case 13:
N(UnkNpcAIFunc3)(script, aiSettings, territoryPtr);
break;
case 14:
N(UnkFunc6)(script, aiSettings, territoryPtr);
break;
}
switch (script->functionTemp[0]) {
case 30:
npc->duration--;
if (npc->duration <= 0) {
get_enemy(enemy->varTable[4])->varTable[10] = 2;
npc->duration = 5;
script->functionTemp[0] = 31;
}
case 31:
npc->duration--;
if (npc->duration <= 0) {
npc->currentAnim.w = 0x490015;
get_enemy(enemy->varTable[4])->varTable[10] = 3;
npc->duration = 10;
script->functionTemp[0] = 32;
}
case 32:
npc->duration--;
if (npc->duration <= 0) {
npc->duration = 3;
script->functionTemp[0] = 33;
}
case 33:
npc->duration--;
if (npc->duration <= 0) {
script->functionTemp[0] = 0;
}
break;
}
if (((u32)script->functionTemp[0] - 30) < 2) {
npc->yaw = atan2(npc->pos.x, npc->pos.z, gPlayerStatusPtr->position.x, gPlayerStatusPtr->position.z);
dist = dist2D(gPlayerStatusPtr->position.x, gPlayerStatusPtr->position.z, npc->pos.x, npc->pos.z);
if (!is_point_within_region(territoryPtr->shape, territoryPtr->pointX, territoryPtr->pointZ, npc->pos.x, npc->pos.z,
territoryPtr->sizeX, territoryPtr->sizeZ)) {
if ((dist > 30.0) && (npc->turnAroundYawAdjustment == 0)) {
temp_f4 = dist - 20.0;
if (temp_f4 < 0.0) {
temp_f4 = 0.0f;
}
if (temp_f4 > 200.0) {
temp_f4 = 200.0f;
}
npc->moveSpeed = update_lerp(0, aiSettings->moveSpeed, aiSettings->chaseSpeed, temp_f4, 200);
npc_move_heading(npc, npc->moveSpeed, npc->yaw);
}
}
}
return ApiStatus_BLOCK;
}
#else
INCLUDE_ASM(ApiStatus, "world/area_flo/flo_17/CD7350", flo_17_func_80241C64_CD8F44, Evt* script,
s32 isInitialCall);
#endif
#include "world/common/atomic/enemy/UnkAI_6.inc.c"
#define AI_LAKITU_FIRST_SPINY_ID 50
#define AI_LAKITU_LAST_SPINY_ID 53
#include "world/common/enemy/LakituAI.inc.c"
#include "world/common/enemy/SpinyAI.inc.c"

View File

@ -7,8 +7,8 @@
#define NAMESPACE flo_17
ApiStatus N(func_80240000_CD72E0)(Evt* script, s32 isInitialCall);
ApiStatus N(func_80241C64_CD8F44)(Evt* script, s32 isInitialCall);
ApiStatus N(UnkNpcAIMainFunc6)(Evt* script, s32 isInitialCall);
ApiStatus N(LakituAI_Main)(Evt* script, s32 isInitialCall);
ApiStatus N(SpinyAI_Main)(Evt* script, s32 isInitialCall);
ApiStatus N(func_80240040_CD7320)(Evt *script, s32 isInitialCall);
extern NpcGroupList N(npcGroupList_80245228);

View File

@ -1535,7 +1535,7 @@ StaticNpc N(npcGroup_80245CEC)[] = {
.id = NPC_LAKITU0,
.settings = &N(npcSettings_80243F10),
.pos = { 0.0f, 15.0f, 60.0f },
.flags = NPC_FLAG_PASSIVE | NPC_FLAG_4 | NPC_FLAG_100 | NPC_FLAG_LOCK_ANIMS | NPC_FLAG_NO_Y_MOVEMENT | NPC_FLAG_40000 | NPC_FLAG_400000,
.flags = NPC_FLAG_PASSIVE | NPC_FLAG_4 | NPC_FLAG_100 | NPC_FLAG_LOCK_ANIMS | NPC_FLAG_JUMPING | NPC_FLAG_40000 | NPC_FLAG_400000,
.init = &N(init_80245B90),
.yaw = 90,
.dropFlags = NPC_DROP_FLAGS_80,
@ -1573,7 +1573,7 @@ StaticNpc N(npcGroup_80245CEC)[] = {
.id = NPC_LAKITU1,
.settings = &N(npcSettings_80243F10),
.pos = { 65.0f, 15.0f, 60.0f },
.flags = NPC_FLAG_PASSIVE | NPC_FLAG_4 | NPC_FLAG_100 | NPC_FLAG_LOCK_ANIMS | NPC_FLAG_NO_Y_MOVEMENT | NPC_FLAG_40000 | NPC_FLAG_400000,
.flags = NPC_FLAG_PASSIVE | NPC_FLAG_4 | NPC_FLAG_100 | NPC_FLAG_LOCK_ANIMS | NPC_FLAG_JUMPING | NPC_FLAG_40000 | NPC_FLAG_400000,
.init = &N(init_80245C04),
.yaw = 270,
.dropFlags = NPC_DROP_FLAGS_80,
@ -1611,7 +1611,7 @@ StaticNpc N(npcGroup_80245CEC)[] = {
.id = NPC_LAKITU2,
.settings = &N(npcSettings_80243F10),
.pos = { 135.0f, 15.0f, 35.0f },
.flags = NPC_FLAG_PASSIVE | NPC_FLAG_4 | NPC_FLAG_100 | NPC_FLAG_LOCK_ANIMS | NPC_FLAG_NO_Y_MOVEMENT | NPC_FLAG_40000 | NPC_FLAG_400000,
.flags = NPC_FLAG_PASSIVE | NPC_FLAG_4 | NPC_FLAG_100 | NPC_FLAG_LOCK_ANIMS | NPC_FLAG_JUMPING | NPC_FLAG_40000 | NPC_FLAG_400000,
.init = &N(init_80245C78),
.yaw = 270,
.dropFlags = NPC_DROP_FLAGS_80,
@ -1649,7 +1649,7 @@ StaticNpc N(npcGroup_80245CEC)[] = {
.id = NPC_MAGIKOOPA,
.settings = &N(npcSettings_80243F3C),
.pos = { -60.0f, 0.0f, 50.0f },
.flags = NPC_FLAG_PASSIVE | NPC_FLAG_4 | NPC_FLAG_100 | NPC_FLAG_LOCK_ANIMS | NPC_FLAG_NO_Y_MOVEMENT | NPC_FLAG_40000 | NPC_FLAG_400000,
.flags = NPC_FLAG_PASSIVE | NPC_FLAG_4 | NPC_FLAG_100 | NPC_FLAG_LOCK_ANIMS | NPC_FLAG_JUMPING | NPC_FLAG_40000 | NPC_FLAG_400000,
.init = &N(init_80245AA8),
.yaw = 90,
.dropFlags = NPC_DROP_FLAGS_80,
@ -1687,7 +1687,7 @@ StaticNpc N(npcGroup_80245CEC)[] = {
.id = NPC_FLYING_MAGIKOOPA,
.settings = &N(npcSettings_80243F3C),
.pos = { 0.0f, -1000.0f, 0.0f },
.flags = NPC_FLAG_PASSIVE | NPC_FLAG_4 | NPC_FLAG_100 | NPC_FLAG_LOCK_ANIMS | NPC_FLAG_NO_Y_MOVEMENT | NPC_FLAG_40000 | NPC_FLAG_400000,
.flags = NPC_FLAG_PASSIVE | NPC_FLAG_4 | NPC_FLAG_100 | NPC_FLAG_LOCK_ANIMS | NPC_FLAG_JUMPING | NPC_FLAG_40000 | NPC_FLAG_400000,
.init = &N(init_80245B30),
.yaw = 270,
.dropFlags = NPC_DROP_FLAGS_80,

View File

@ -831,7 +831,7 @@ StaticNpc N(npcGroup_80243804)[] = {
.id = NPC_HUFF_N_PUFF0,
.settings = &N(npcSettings_802417EC),
.pos = { 650.0f, -1000.0f, 0.0f },
.flags = NPC_FLAG_PASSIVE | NPC_FLAG_100 | NPC_FLAG_LOCK_ANIMS | NPC_FLAG_NO_Y_MOVEMENT | NPC_FLAG_40000,
.flags = NPC_FLAG_PASSIVE | NPC_FLAG_100 | NPC_FLAG_LOCK_ANIMS | NPC_FLAG_JUMPING | NPC_FLAG_40000,
.init = &N(init_802435E4),
.yaw = 270,
.dropFlags = NPC_DROP_FLAGS_80,
@ -861,7 +861,7 @@ StaticNpc N(npcGroup_80243804)[] = {
.id = NPC_HUFF_N_PUFF1,
.settings = &N(npcSettings_802417EC),
.pos = { 650.0f, 100.0f, 0.0f },
.flags = NPC_FLAG_PASSIVE | NPC_FLAG_100 | NPC_FLAG_GRAVITY | NPC_FLAG_LOCK_ANIMS | NPC_FLAG_NO_Y_MOVEMENT | NPC_FLAG_40000,
.flags = NPC_FLAG_PASSIVE | NPC_FLAG_100 | NPC_FLAG_GRAVITY | NPC_FLAG_LOCK_ANIMS | NPC_FLAG_JUMPING | NPC_FLAG_40000,
.init = &N(init_80243684),
.yaw = 270,
.dropFlags = NPC_DROP_FLAGS_80,
@ -891,7 +891,7 @@ StaticNpc N(npcGroup_80243804)[] = {
.id = NPC_HUFF_N_PUFF2,
.settings = &N(npcSettings_802417EC),
.pos = { 650.0f, -1000.0f, 0.0f },
.flags = NPC_FLAG_PASSIVE | NPC_FLAG_100 | NPC_FLAG_GRAVITY | NPC_FLAG_LOCK_ANIMS | NPC_FLAG_NO_Y_MOVEMENT | NPC_FLAG_40000,
.flags = NPC_FLAG_PASSIVE | NPC_FLAG_100 | NPC_FLAG_GRAVITY | NPC_FLAG_LOCK_ANIMS | NPC_FLAG_JUMPING | NPC_FLAG_40000,
.init = &N(init_8024371C),
.yaw = 270,
.dropFlags = NPC_DROP_FLAGS_80,
@ -929,7 +929,7 @@ StaticNpc N(npcGroup_80243DDC)[] = {
.id = NPC_TUFF_PUFF0,
.settings = &N(npcSettings_802417C0),
.pos = { 0.0f, -1000.0f, 0.0f },
.flags = NPC_FLAG_PASSIVE | NPC_FLAG_100 | NPC_FLAG_GRAVITY | NPC_FLAG_LOCK_ANIMS | NPC_FLAG_NO_Y_MOVEMENT,
.flags = NPC_FLAG_PASSIVE | NPC_FLAG_100 | NPC_FLAG_GRAVITY | NPC_FLAG_LOCK_ANIMS | NPC_FLAG_JUMPING,
.init = &N(init_802437A8),
.yaw = 270,
.dropFlags = NPC_DROP_FLAGS_80,
@ -959,7 +959,7 @@ StaticNpc N(npcGroup_80243DDC)[] = {
.id = NPC_TUFF_PUFF1,
.settings = &N(npcSettings_802417C0),
.pos = { 0.0f, -1000.0f, 0.0f },
.flags = NPC_FLAG_PASSIVE | NPC_FLAG_100 | NPC_FLAG_GRAVITY | NPC_FLAG_LOCK_ANIMS | NPC_FLAG_NO_Y_MOVEMENT,
.flags = NPC_FLAG_PASSIVE | NPC_FLAG_100 | NPC_FLAG_GRAVITY | NPC_FLAG_LOCK_ANIMS | NPC_FLAG_JUMPING,
.init = &N(init_802437A8),
.yaw = 270,
.dropFlags = NPC_DROP_FLAGS_80,
@ -989,7 +989,7 @@ StaticNpc N(npcGroup_80243DDC)[] = {
.id = NPC_TUFF_PUFF2,
.settings = &N(npcSettings_802417C0),
.pos = { 0.0f, -1000.0f, 0.0f },
.flags = NPC_FLAG_PASSIVE | NPC_FLAG_100 | NPC_FLAG_GRAVITY | NPC_FLAG_LOCK_ANIMS | NPC_FLAG_NO_Y_MOVEMENT,
.flags = NPC_FLAG_PASSIVE | NPC_FLAG_100 | NPC_FLAG_GRAVITY | NPC_FLAG_LOCK_ANIMS | NPC_FLAG_JUMPING,
.init = &N(init_802437A8),
.yaw = 270,
.dropFlags = NPC_DROP_FLAGS_80,
@ -1019,7 +1019,7 @@ StaticNpc N(npcGroup_80243DDC)[] = {
.id = NPC_TUFF_PUFF3,
.settings = &N(npcSettings_802417C0),
.pos = { 0.0f, -1000.0f, 0.0f },
.flags = NPC_FLAG_PASSIVE | NPC_FLAG_100 | NPC_FLAG_GRAVITY | NPC_FLAG_LOCK_ANIMS | NPC_FLAG_NO_Y_MOVEMENT,
.flags = NPC_FLAG_PASSIVE | NPC_FLAG_100 | NPC_FLAG_GRAVITY | NPC_FLAG_LOCK_ANIMS | NPC_FLAG_JUMPING,
.init = &N(init_802437A8),
.yaw = 270,
.dropFlags = NPC_DROP_FLAGS_80,
@ -1049,7 +1049,7 @@ StaticNpc N(npcGroup_80243DDC)[] = {
.id = NPC_TUFF_PUFF4,
.settings = &N(npcSettings_802417C0),
.pos = { 0.0f, -1000.0f, 0.0f },
.flags = NPC_FLAG_PASSIVE | NPC_FLAG_100 | NPC_FLAG_GRAVITY | NPC_FLAG_LOCK_ANIMS | NPC_FLAG_NO_Y_MOVEMENT,
.flags = NPC_FLAG_PASSIVE | NPC_FLAG_100 | NPC_FLAG_GRAVITY | NPC_FLAG_LOCK_ANIMS | NPC_FLAG_JUMPING,
.init = &N(init_802437A8),
.yaw = 270,
.dropFlags = NPC_DROP_FLAGS_80,
@ -1079,7 +1079,7 @@ StaticNpc N(npcGroup_80243DDC)[] = {
.id = NPC_TUFF_PUFF5,
.settings = &N(npcSettings_802417C0),
.pos = { 0.0f, -1000.0f, 0.0f },
.flags = NPC_FLAG_PASSIVE | NPC_FLAG_100 | NPC_FLAG_GRAVITY | NPC_FLAG_LOCK_ANIMS | NPC_FLAG_NO_Y_MOVEMENT,
.flags = NPC_FLAG_PASSIVE | NPC_FLAG_100 | NPC_FLAG_GRAVITY | NPC_FLAG_LOCK_ANIMS | NPC_FLAG_JUMPING,
.init = &N(init_802437A8),
.yaw = 270,
.dropFlags = NPC_DROP_FLAGS_80,
@ -1109,7 +1109,7 @@ StaticNpc N(npcGroup_80243DDC)[] = {
.id = NPC_TUFF_PUFF6,
.settings = &N(npcSettings_802417C0),
.pos = { 0.0f, -1000.0f, 0.0f },
.flags = NPC_FLAG_PASSIVE | NPC_FLAG_100 | NPC_FLAG_GRAVITY | NPC_FLAG_LOCK_ANIMS | NPC_FLAG_NO_Y_MOVEMENT,
.flags = NPC_FLAG_PASSIVE | NPC_FLAG_100 | NPC_FLAG_GRAVITY | NPC_FLAG_LOCK_ANIMS | NPC_FLAG_JUMPING,
.init = &N(init_802437A8),
.yaw = 270,
.dropFlags = NPC_DROP_FLAGS_80,
@ -1139,7 +1139,7 @@ StaticNpc N(npcGroup_80243DDC)[] = {
.id = NPC_TUFF_PUFF7,
.settings = &N(npcSettings_802417C0),
.pos = { 0.0f, -1000.0f, 0.0f },
.flags = NPC_FLAG_PASSIVE | NPC_FLAG_100 | NPC_FLAG_GRAVITY | NPC_FLAG_LOCK_ANIMS | NPC_FLAG_NO_Y_MOVEMENT,
.flags = NPC_FLAG_PASSIVE | NPC_FLAG_100 | NPC_FLAG_GRAVITY | NPC_FLAG_LOCK_ANIMS | NPC_FLAG_JUMPING,
.init = &N(init_802437A8),
.yaw = 270,
.dropFlags = NPC_DROP_FLAGS_80,
@ -1169,7 +1169,7 @@ StaticNpc N(npcGroup_80243DDC)[] = {
.id = NPC_TUFF_PUFF8,
.settings = &N(npcSettings_802417C0),
.pos = { 0.0f, -1000.0f, 0.0f },
.flags = NPC_FLAG_PASSIVE | NPC_FLAG_100 | NPC_FLAG_GRAVITY | NPC_FLAG_LOCK_ANIMS | NPC_FLAG_NO_Y_MOVEMENT,
.flags = NPC_FLAG_PASSIVE | NPC_FLAG_100 | NPC_FLAG_GRAVITY | NPC_FLAG_LOCK_ANIMS | NPC_FLAG_JUMPING,
.init = &N(init_802437A8),
.yaw = 270,
.dropFlags = NPC_DROP_FLAGS_80,
@ -1199,7 +1199,7 @@ StaticNpc N(npcGroup_80243DDC)[] = {
.id = NPC_TUFF_PUFF9,
.settings = &N(npcSettings_802417C0),
.pos = { 0.0f, -1000.0f, 0.0f },
.flags = NPC_FLAG_PASSIVE | NPC_FLAG_100 | NPC_FLAG_GRAVITY | NPC_FLAG_LOCK_ANIMS | NPC_FLAG_NO_Y_MOVEMENT,
.flags = NPC_FLAG_PASSIVE | NPC_FLAG_100 | NPC_FLAG_GRAVITY | NPC_FLAG_LOCK_ANIMS | NPC_FLAG_JUMPING,
.init = &N(init_802437A8),
.yaw = 270,
.dropFlags = NPC_DROP_FLAGS_80,
@ -1229,7 +1229,7 @@ StaticNpc N(npcGroup_80243DDC)[] = {
.id = NPC_TUFF_PUFF10,
.settings = &N(npcSettings_802417C0),
.pos = { 0.0f, -1000.0f, 0.0f },
.flags = NPC_FLAG_PASSIVE | NPC_FLAG_100 | NPC_FLAG_GRAVITY | NPC_FLAG_LOCK_ANIMS | NPC_FLAG_NO_Y_MOVEMENT,
.flags = NPC_FLAG_PASSIVE | NPC_FLAG_100 | NPC_FLAG_GRAVITY | NPC_FLAG_LOCK_ANIMS | NPC_FLAG_JUMPING,
.init = &N(init_802437A8),
.yaw = 270,
.dropFlags = NPC_DROP_FLAGS_80,
@ -1259,7 +1259,7 @@ StaticNpc N(npcGroup_80243DDC)[] = {
.id = NPC_TUFF_PUFF11,
.settings = &N(npcSettings_802417C0),
.pos = { 0.0f, -1000.0f, 0.0f },
.flags = NPC_FLAG_PASSIVE | NPC_FLAG_100 | NPC_FLAG_GRAVITY | NPC_FLAG_LOCK_ANIMS | NPC_FLAG_NO_Y_MOVEMENT,
.flags = NPC_FLAG_PASSIVE | NPC_FLAG_100 | NPC_FLAG_GRAVITY | NPC_FLAG_LOCK_ANIMS | NPC_FLAG_JUMPING,
.init = &N(init_802437A8),
.yaw = 270,
.dropFlags = NPC_DROP_FLAGS_80,
@ -1289,7 +1289,7 @@ StaticNpc N(npcGroup_80243DDC)[] = {
.id = NPC_TUFF_PUFF12,
.settings = &N(npcSettings_802417C0),
.pos = { 0.0f, -1000.0f, 0.0f },
.flags = NPC_FLAG_PASSIVE | NPC_FLAG_100 | NPC_FLAG_GRAVITY | NPC_FLAG_LOCK_ANIMS | NPC_FLAG_NO_Y_MOVEMENT,
.flags = NPC_FLAG_PASSIVE | NPC_FLAG_100 | NPC_FLAG_GRAVITY | NPC_FLAG_LOCK_ANIMS | NPC_FLAG_JUMPING,
.init = &N(init_802437A8),
.yaw = 270,
.dropFlags = NPC_DROP_FLAGS_80,
@ -1319,7 +1319,7 @@ StaticNpc N(npcGroup_80243DDC)[] = {
.id = NPC_TUFF_PUFF13,
.settings = &N(npcSettings_802417C0),
.pos = { 0.0f, -1000.0f, 0.0f },
.flags = NPC_FLAG_PASSIVE | NPC_FLAG_100 | NPC_FLAG_GRAVITY | NPC_FLAG_LOCK_ANIMS | NPC_FLAG_NO_Y_MOVEMENT,
.flags = NPC_FLAG_PASSIVE | NPC_FLAG_100 | NPC_FLAG_GRAVITY | NPC_FLAG_LOCK_ANIMS | NPC_FLAG_JUMPING,
.init = &N(init_802437A8),
.yaw = 270,
.dropFlags = NPC_DROP_FLAGS_80,
@ -1349,7 +1349,7 @@ StaticNpc N(npcGroup_80243DDC)[] = {
.id = NPC_TUFF_PUFF14,
.settings = &N(npcSettings_802417C0),
.pos = { 0.0f, -1000.0f, 0.0f },
.flags = NPC_FLAG_PASSIVE | NPC_FLAG_100 | NPC_FLAG_GRAVITY | NPC_FLAG_LOCK_ANIMS | NPC_FLAG_NO_Y_MOVEMENT,
.flags = NPC_FLAG_PASSIVE | NPC_FLAG_100 | NPC_FLAG_GRAVITY | NPC_FLAG_LOCK_ANIMS | NPC_FLAG_JUMPING,
.init = &N(init_802437A8),
.yaw = 270,
.dropFlags = NPC_DROP_FLAGS_80,

View File

@ -175,7 +175,7 @@ StaticNpc N(npcGroup_80240A04) = {
.id = NPC_BZZAP,
.settings = &N(npcSettings_80240520),
.pos = { 0.0f, -1000.0f, 0.0f },
.flags = NPC_FLAG_4 | NPC_FLAG_100 | NPC_FLAG_GRAVITY | NPC_FLAG_LOCK_ANIMS | NPC_FLAG_NO_Y_MOVEMENT,
.flags = NPC_FLAG_4 | NPC_FLAG_100 | NPC_FLAG_GRAVITY | NPC_FLAG_LOCK_ANIMS | NPC_FLAG_JUMPING,
.init = &N(init_80240740),
.yaw = 270,
.dropFlags = NPC_DROP_FLAGS_80,
@ -205,7 +205,7 @@ StaticNpc N(npcGroup_80240BF4) = {
.id = NPC_DAYZEE,
.settings = &N(npcSettings_80240520),
.pos = { 0.0f, -1000.0f, 0.0f },
.flags = NPC_FLAG_4 | NPC_FLAG_100 | NPC_FLAG_GRAVITY | NPC_FLAG_LOCK_ANIMS | NPC_FLAG_NO_Y_MOVEMENT,
.flags = NPC_FLAG_4 | NPC_FLAG_100 | NPC_FLAG_GRAVITY | NPC_FLAG_LOCK_ANIMS | NPC_FLAG_JUMPING,
.init = &N(init_802409CC),
.yaw = 270,
.dropFlags = NPC_DROP_FLAGS_80,

View File

@ -172,12 +172,12 @@ NpcAISettings N(npcAISettings_80241498) = {
.moveTime = 30,
.waitTime = 50,
.alertRadius = 60.0f,
.unk_10 = { .f = 30.0f },
.unk_14 = 3,
.alertOffsetDist = 30.0f,
.playerSearchInterval = 3,
.chaseSpeed = 6.0f,
.chaseRadius = 100.0f,
.unk_28 = { .f = 30.0f },
.unk_2C = 3,
.chaseOffsetDist = 30.0f,
.unk_AI_2C = 3,
};
EvtScript N(npcAI_802414C8) = {
@ -185,7 +185,7 @@ EvtScript N(npcAI_802414C8) = {
EVT_CALL(SetSelfVar, 3, 18)
EVT_CALL(SetSelfVar, 5, 3)
EVT_CALL(SetSelfVar, 7, 4)
EVT_CALL(N(UnkNpcAIMainFunc5), EVT_PTR(N(npcAISettings_80241498)))
EVT_CALL(N(TackleAI_Main), EVT_PTR(N(npcAISettings_80241498)))
EVT_RETURN
EVT_END
};
@ -353,7 +353,7 @@ StaticNpc N(npcGroup_80241F98) = {
.id = NPC_GATE_FLOWER,
.settings = &N(npcSettings_802412E0),
.pos = { 385.0f, 0.0f, -35.0f },
.flags = NPC_FLAG_PASSIVE | NPC_FLAG_ENABLE_HIT_SCRIPT | NPC_FLAG_100 | NPC_FLAG_LOCK_ANIMS | NPC_FLAG_NO_Y_MOVEMENT | NPC_FLAG_NO_PROJECT_SHADOW | NPC_FLAG_400000,
.flags = NPC_FLAG_PASSIVE | NPC_FLAG_ENABLE_HIT_SCRIPT | NPC_FLAG_100 | NPC_FLAG_LOCK_ANIMS | NPC_FLAG_JUMPING | NPC_FLAG_NO_PROJECT_SHADOW | NPC_FLAG_400000,
.init = &N(init_80241E70),
.yaw = 90,
.dropFlags = NPC_DROP_FLAGS_80,
@ -384,7 +384,7 @@ StaticNpc N(npcGroup_80242188) = {
.id = NPC_SPINY0,
.settings = &N(npcSettings_80241538),
.pos = { 80.0f, 0.0f, 0.0f },
.flags = NPC_FLAG_NO_Y_MOVEMENT | NPC_FLAG_NO_PROJECT_SHADOW,
.flags = NPC_FLAG_JUMPING | NPC_FLAG_NO_PROJECT_SHADOW,
.yaw = 90,
.dropFlags = NPC_DROP_FLAGS_80,
.heartDrops = STANDARD_HEART_DROPS(3),
@ -415,7 +415,7 @@ StaticNpc N(npcGroup_80242378) = {
.id = NPC_SPINY1,
.settings = &N(npcSettings_80241538),
.pos = { -320.0f, 0.0f, 0.0f },
.flags = NPC_FLAG_NO_Y_MOVEMENT | NPC_FLAG_NO_PROJECT_SHADOW,
.flags = NPC_FLAG_JUMPING | NPC_FLAG_NO_PROJECT_SHADOW,
.yaw = 270,
.dropFlags = NPC_DROP_FLAGS_80,
.heartDrops = STANDARD_HEART_DROPS(3),
@ -468,6 +468,6 @@ EvtScript N(makeEntities) = {
#include "world/common/atomic/MakeConsumableChoice.inc.c"
#include "world/common/atomic/enemy/UnkAI_5.inc.c"
#include "world/common/enemy/TackleAI.inc.c"
#include "world/common/atomic/ItemChoice_FlowerGuard.inc.c"

View File

@ -13,7 +13,7 @@ ApiStatus N(func_80240000_CEE260)(Evt* script, s32 isInitialCall);
ApiStatus N(ItemChoice_WaitForSelection)(Evt* script, s32 isInitialCall);
ApiStatus N(ItemChoice_SaveSelected)(Evt* script, s32 isInitialCall);
ApiStatus N(BuildItemChoiceList)(Evt* script, s32 isInitialCall);
ApiStatus N(UnkNpcAIMainFunc5)(Evt* script, s32 isInitialCall);
ApiStatus N(TackleAI_Main)(Evt* script, s32 isInitialCall);
ApiStatus N(FlowerGuard_SetItemEntityPosition)(Evt* script, s32 isInitialCall);
ApiStatus N(FlowerGuard_JudgeItemTastiness)(Evt* script, s32 isInitialCall);
ApiStatus N(FlowerGuard_MakeItemList)(Evt* script, s32 isInitialCall);

View File

@ -125,7 +125,7 @@ NpcSettings N(npcSettings_802428F0) = {
.level = 99,
};
f32 N(sixFloats)[] = {
f32 N(FlyingAI_JumpVels)[] = {
4.5f, 3.5f, 2.6f, 2.0f,
1.5f, 20.0f,
};
@ -135,12 +135,12 @@ NpcAISettings N(npcAISettings_80242934) = {
.moveTime = 45,
.waitTime = 60,
.alertRadius = 100.0f,
.unk_14 = 3,
.playerSearchInterval = 3,
.chaseSpeed = 3.6f,
.unk_1C = { .s = 10 },
.unk_20 = 1,
.chaseTurnRate= 10,
.chaseUpdateInterval = 1,
.chaseRadius = 120.0f,
.unk_2C = 1,
.unk_AI_2C = 1,
};
EvtScript N(npcAI_80242964) = {
@ -148,7 +148,7 @@ EvtScript N(npcAI_80242964) = {
EVT_CALL(SetSelfVar, 5, 0)
EVT_CALL(SetSelfVar, 6, 0)
EVT_CALL(SetSelfVar, 1, 600)
EVT_CALL(N(UnkNpcAIMainFunc10), EVT_PTR(N(npcAISettings_80242934)))
EVT_CALL(N(FlyingNoAttackAI_Main), EVT_PTR(N(npcAISettings_80242934)))
EVT_RETURN
EVT_END
};
@ -167,14 +167,14 @@ NpcAISettings N(npcAISettings_80242A00) = {
.moveTime = 30,
.waitTime = 5,
.alertRadius = 80.0f,
.unk_10 = { .f = 30.0f },
.unk_14 = 2,
.alertOffsetDist = 30.0f,
.playerSearchInterval = 2,
.chaseSpeed = 4.5f,
.unk_1C = { .s = 6 },
.unk_20 = 1,
.chaseTurnRate= 6,
.chaseUpdateInterval = 1,
.chaseRadius = 90.0f,
.unk_28 = { .f = 30.0f },
.unk_2C = 1,
.chaseOffsetDist = 30.0f,
.unk_AI_2C = 1,
};
EvtScript N(npcAI_80242A30) = {
@ -182,7 +182,7 @@ EvtScript N(npcAI_80242A30) = {
EVT_CALL(SetSelfVar, 5, -630)
EVT_CALL(SetSelfVar, 6, 50)
EVT_CALL(SetSelfVar, 1, 200)
EVT_CALL(N(UnkNpcAIMainFunc9), EVT_PTR(N(npcAISettings_80242A00)))
EVT_CALL(N(FlyingAI_Main), EVT_PTR(N(npcAISettings_80242A00)))
EVT_RETURN
EVT_END
};
@ -390,7 +390,7 @@ StaticNpc N(npcGroup_8024368C) = {
.id = NPC_GATE_FLOWER,
.settings = &N(npcSettings_802428F0),
.pos = { 505.0f, 0.0f, -25.0f },
.flags = NPC_FLAG_PASSIVE | NPC_FLAG_ENABLE_HIT_SCRIPT | NPC_FLAG_100 | NPC_FLAG_LOCK_ANIMS | NPC_FLAG_NO_Y_MOVEMENT | NPC_FLAG_NO_PROJECT_SHADOW | NPC_FLAG_400000,
.flags = NPC_FLAG_PASSIVE | NPC_FLAG_ENABLE_HIT_SCRIPT | NPC_FLAG_100 | NPC_FLAG_LOCK_ANIMS | NPC_FLAG_JUMPING | NPC_FLAG_NO_PROJECT_SHADOW | NPC_FLAG_400000,
.init = &N(init_80243564),
.yaw = 90,
.dropFlags = NPC_DROP_FLAGS_80,
@ -513,9 +513,9 @@ static s32 N(pad_3CD8)[] = {
0x00000000, 0x00000000,
};
#include "world/common/atomic/enemy/UnkAI_9.inc.c"
#include "world/common/enemy/FlyingAI.inc.c"
#include "world/common/atomic/enemy/UnkAI_10.inc.c"
#include "world/common/enemy/FlyingNoAttackAI.inc.c"
#include "world/common/atomic/ItemChoice_PartA.inc.c"

View File

@ -10,8 +10,8 @@ ApiStatus N(AddPlayerHandsOffset)(Evt* script, s32 isInitialCall);
ApiStatus N(TransformFoliage)(Evt* script, s32 isInitialCall);
ApiStatus N(UnkFunc43)(Evt* script, s32 isInitialCall);
ApiStatus N(func_80240000_CF2BD0)(Evt* script, s32 isInitialCall);
ApiStatus N(UnkNpcAIMainFunc9)(Evt* script, s32 isInitialCall);
ApiStatus N(UnkNpcAIMainFunc10)(Evt* script, s32 isInitialCall);
ApiStatus N(FlyingAI_Main)(Evt* script, s32 isInitialCall);
ApiStatus N(FlyingNoAttackAI_Main)(Evt* script, s32 isInitialCall);
ApiStatus N(ItemChoice_WaitForSelection)(Evt* script, s32 isInitialCall);
ApiStatus N(ItemChoice_SaveSelected)(Evt* script, s32 isInitialCall);
ApiStatus N(BuildItemChoiceList)(Evt* script, s32 isInitialCall);

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