generic_entity -> worker (#865)

* workers

* broke out worker flags

* quick fix

* player sprite sets

* enum ws

* default -> world

* fix long line

* virtual entity split and minor cleanup

Co-authored-by: HailSanta <Hail2Santa@gmail.com>
This commit is contained in:
HailSanta 2022-11-21 23:12:28 -05:00 committed by GitHub
parent 697a050e12
commit c776b32bc6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
110 changed files with 1241 additions and 1167 deletions

View File

@ -619,13 +619,13 @@ typedef struct Shadow {
typedef Shadow* ShadowList[MAX_SHADOWS]; typedef Shadow* ShadowList[MAX_SHADOWS];
typedef struct DynamicEntity { typedef struct Worker {
/* 0x00 */ s32 flags; /* 0x00 */ s32 flags;
/* 0x04 */ void (*update)(void); /* 0x04 */ void (*update)(void);
/* 0x08 */ void (*draw)(void); /* 0x08 */ void (*draw)(void);
} DynamicEntity; } Worker;
typedef DynamicEntity* DynamicEntityList[MAX_DYNAMIC_ENTITIES]; typedef Worker* WorkerList[MAX_WORKERS];
typedef struct MusicSettings { typedef struct MusicSettings {
/* 0x00 */ u16 flags; /* 0x00 */ u16 flags;
@ -963,7 +963,7 @@ typedef struct BattleStatus {
/* 0x330 */ s32 pushInputBuffer[64]; /* 0x330 */ s32 pushInputBuffer[64];
/* 0x430 */ s8 holdInputBufferPos; /* 0x430 */ s8 holdInputBufferPos;
/* 0x431 */ s8 inputBufferPos; /* 0x431 */ s8 inputBufferPos;
/* 0x432 */ s8 unk_432; /* 0x432 */ s8 darknessMode;
/* 0x433 */ u8 unk_433; /* 0x433 */ u8 unk_433;
/* 0x434 */ s32* actionCmdDifficultyTable; /* 0x434 */ s32* actionCmdDifficultyTable;
/* 0x438 */ struct Stage* currentStage; /* 0x438 */ struct Stage* currentStage;

View File

@ -123,6 +123,6 @@
#define GetNextPathPos dead_GetNextPathPos #define GetNextPathPos dead_GetNextPathPos
#define queue_render_task dead_queue_render_task #define queue_render_task dead_queue_render_task
#define dma_copy dead_dma_copy #define dma_copy dead_dma_copy
#define create_generic_entity_world dead_create_generic_entity_world #define create_worker_world dead_create_worker_world
#endif #endif

View File

@ -3090,6 +3090,14 @@ enum ItemEntityFlags {
ITEM_ENTITY_FLAGS_80000000 = 0x80000000, ITEM_ENTITY_FLAGS_80000000 = 0x80000000,
}; };
// Worker
enum WorkerFlags {
WORKER_FLAG_1 = 0x00000001,
WORKER_FLAG_SKIP_DRAW_UNTIL_UPDATE = 0x00000002,
WORKER_FLAG_FRONT_UI = 0x00000004,
WORKER_FLAG_BACK_UI = 0x00000008,
};
enum Buttons { enum Buttons {
BUTTON_C_RIGHT = 0x00000001, BUTTON_C_RIGHT = 0x00000001,
BUTTON_C_LEFT = 0x00000002, BUTTON_C_LEFT = 0x00000002,
@ -5819,4 +5827,28 @@ enum EncounterPostBattleSubStates {
ENCOUNTER_SUBSTATE_POST_BATTLE_ENEMY_FLED_TO_NEUTRAL = 402, ENCOUNTER_SUBSTATE_POST_BATTLE_ENEMY_FLED_TO_NEUTRAL = 402,
}; };
enum PlayerSpriteSets {
PLAYER_SPRITES_MARIO_WORLD = 0,
PLAYER_SPRITES_MARIO_REFLECT_FLOOR = 1,
PLAYER_SPRITES_COMBINED_EPILOGUE = 2,
PLAYER_SPRITES_MARIO_PARADE = 3,
PLAYER_SPRITES_PEACH_WORLD = 4,
PLAYER_SPRITES_MARIO_BATTLE = 5,
PLAYER_SPRITES_PEACH_BATTLE = 6,
};
enum BattleDarknessMode {
BTL_DARKNESS_MODE_0 = 0,
BTL_DARKNESS_MODE_1 = 1,
BTL_DARKNESS_MODE_2 = 2,
BTL_DARKNESS_MODE_3 = 3,
};
enum BattleDarknessState {
BTL_DARKNESS_STATE_LOCKED = -2,
BTL_DARKNESS_STATE_DARK = -1,
BTL_DARKNESS_STATE_NONE = 0,
BTL_DARKNESS_STATE_WATT_BASED = 1,
};
#endif #endif

View File

@ -498,8 +498,8 @@ s32 make_item_entity_nodelay(s32 itemID, f32 x, f32 y, f32 z, s32 itemSpawnMode,
void set_item_entity_flags(s32 itemEntityIndex, s32 flag); void set_item_entity_flags(s32 itemEntityIndex, s32 flag);
void clear_item_entity_flags(s32 index, s32 flags); void clear_item_entity_flags(s32 index, s32 flags);
s32 create_generic_entity_frontUI(void (*updateFunc)(void), void (*drawFunc)(void)); s32 create_worker_frontUI(void (*updateFunc)(void), void (*drawFunc)(void));
DynamicEntity* get_generic_entity(s32 idx); Worker* get_worker(s32 idx);
Trigger* bind_trigger_1(EvtScript* script, s32 flags, s32 triggerFlagIndex, s32 triggerVar0, s32 triggerVar1, s32 priority); Trigger* bind_trigger_1(EvtScript* script, s32 flags, s32 triggerFlagIndex, s32 triggerVar0, s32 triggerVar1, s32 priority);
void set_cam_viewport(s16 id, s16 x, s16 y, s16 width, s16 height); void set_cam_viewport(s16 id, s16 x, s16 y, s16 width, s16 height);
@ -583,7 +583,7 @@ void start_bounce_b(void);
void update_input(void); void update_input(void);
void update_max_rumble_duration(void); void update_max_rumble_duration(void);
void func_8011BAE8(void); void func_8011BAE8(void);
void update_generic_entities(void); void update_workers(void);
void update_triggers(void); void update_triggers(void);
void update_scripts(void); void update_scripts(void);
void update_messages(void); void update_messages(void);
@ -597,12 +597,12 @@ void update_windows(void);
void player_render_interact_prompts(void); void player_render_interact_prompts(void);
void func_802C3EE4(void); void func_802C3EE4(void);
void render_screen_overlay_backUI(void); void render_screen_overlay_backUI(void);
void render_generic_entities_backUI(void); void render_workers_backUI(void);
void render_effects_UI(void); void render_effects_UI(void);
void state_render_backUI(void); void state_render_backUI(void);
void render_window_root(void); void render_window_root(void);
void render_messages(void); void render_messages(void);
void render_generic_entities_frontUI(void); void render_workers_frontUI(void);
void render_screen_overlay_frontUI(void); void render_screen_overlay_frontUI(void);
void render_curtains(void); void render_curtains(void);
void state_render_frontUI(void); void state_render_frontUI(void);
@ -792,7 +792,7 @@ typedef union {
void (*func2)(void); void (*func2)(void);
} WorldArgs TRANSPARENT_UNION; } WorldArgs TRANSPARENT_UNION;
s32 create_generic_entity_world(WorldArgs, WorldArgs); s32 create_worker_world(WorldArgs, WorldArgs);
void init_entity_models(void); void init_entity_models(void);
EntityModel* get_entity_model(s32 idx); EntityModel* get_entity_model(s32 idx);
@ -801,7 +801,7 @@ void fold_update(u32, FoldType, s32, s32, s32, s32, s32);
s32 fold_appendGfx_component(s32, FoldImageRecPart*, u32, Matrix4f); s32 fold_appendGfx_component(s32, FoldImageRecPart*, u32, Matrix4f);
void func_8013A6E8(void); void func_8013A6E8(void);
s32 func_8013A704(s32); s32 func_8013A704(s32);
void free_generic_entity(s32); void free_worker(s32);
s32 ai_check_fwd_collisions(Npc* npc, f32 arg1, f32* arg2, f32* arg3, f32* arg4, f32* arg5); s32 ai_check_fwd_collisions(Npc* npc, f32 arg1, f32* arg2, f32* arg3, f32* arg4, f32* arg5);
void basic_ai_loiter_init(Evt* script, MobileAISettings* aiSettings, EnemyDetectVolume* territory); void basic_ai_loiter_init(Evt* script, MobileAISettings* aiSettings, EnemyDetectVolume* territory);
@ -903,7 +903,7 @@ void remove_all_effects(void);
void update_effects(void); void update_effects(void);
void update_cameras(void); void update_cameras(void);
void clear_render_tasks(void); void clear_render_tasks(void);
void clear_generic_entity_list(void); void clear_worker_list(void);
void clear_printers(void); void clear_printers(void);
void clear_item_entity_data(void); void clear_item_entity_data(void);
void clear_player_data(void); void clear_player_data(void);
@ -1006,7 +1006,7 @@ void init_encounters_ui(void);
void initialize_collision(void); void initialize_collision(void);
void render_entities(void); void render_entities(void);
void render_player(void); void render_player(void);
void render_generic_entities_world(void); void render_workers_world(void);
void render_effects_world(void); void render_effects_world(void);
s32 get_asset_offset(char*, s32*); s32 get_asset_offset(char*, s32*);
void initialize_status_menu(void); void initialize_status_menu(void);

View File

@ -72,7 +72,7 @@
#define MAX_TRIGGERS 64 #define MAX_TRIGGERS 64
#define MAX_SHADOWS 60 #define MAX_SHADOWS 60
#define MAX_ENTITIES 30 #define MAX_ENTITIES 30
#define MAX_DYNAMIC_ENTITIES 16 #define MAX_WORKERS 16
#define MAX_TEX_PANNERS 16 #define MAX_TEX_PANNERS 16
#define MAX_ITEM_ENTITIES 256 #define MAX_ITEM_ENTITIES 256
@ -108,6 +108,9 @@
#define BATTLE_ENTITY_ID_MASK 0x800 #define BATTLE_ENTITY_ID_MASK 0x800
#define UNPACK_BTL_AREA(battleID) (((battleID) >> 8) & 0xFF)
#define UNPACK_BTL_INDEX(battleID) ((battleID) & 0xFF)
#define COLLISION_WITH_NPC_BIT 0x2000 #define COLLISION_WITH_NPC_BIT 0x2000
#define COLLISION_WITH_ENTITY_BIT 0x4000 #define COLLISION_WITH_ENTITY_BIT 0x4000

View File

@ -172,7 +172,7 @@ void animator_update_model_transforms(ModelAnimator* animator, Mtx* rootTransfor
void render_animated_model(s32 animatorID, Mtx* rootTransform); void render_animated_model(s32 animatorID, Mtx* rootTransform);
void animator_node_update_model_transform(ModelAnimator* animator, f32 (*flipMtx)[4], AnimatorNode* node, void animator_node_update_model_transform(ModelAnimator* animator, f32 (*flipMtx)[4], AnimatorNode* node,
Mtx* rootTransform); Mtx* rootTransform);
void init_generic_entity_list(void); void init_worker_list(void);
ModelAnimator* get_animator_by_index(s32 animModelID); ModelAnimator* get_animator_by_index(s32 animModelID);
void reset_animator_list(void); void reset_animator_list(void);
void delete_model_animator_node(AnimatorNode* node); void delete_model_animator_node(AnimatorNode* node);

View File

@ -600,7 +600,7 @@ void draw_encounter_ui(void);
void draw_first_strike_ui(void); void draw_first_strike_ui(void);
void npc_dyn_entity_draw_no_op(void); void npc_render_worker_do_nothing(void);
void make_npcs(s32 flags, s32 mapID, s32* npcGroupList); void make_npcs(s32 flags, s32 mapID, s32* npcGroupList);

View File

@ -23,9 +23,7 @@ extern s32 D_800DC4D4;
extern s32 D_800DC4D8; extern s32 D_800DC4D8;
extern s32 gBattleSubState; extern s32 gBattleSubState;
extern s32 D_800DC4E4; extern s32 D_800DC4E4;
extern s32 D_800DC4E8; extern s32 gCurrentBattleID;
extern u8 gCurrentBattleSection; // in the middle of the previous var
extern u8 D_800DC4EB; // in the middle of the previous var
extern s32 D_800DC4E0; extern s32 D_800DC4E0;
extern s32 D_800DC4EC; extern s32 D_800DC4EC;
extern s32 D_800DC4F0; extern s32 D_800DC4F0;
@ -38,9 +36,9 @@ extern EntityList gWorldEntityList;
extern EntityList gBattleEntityList; extern EntityList gBattleEntityList;
extern EntityList* gCurrentEntityListPtr; extern EntityList* gCurrentEntityListPtr;
extern DynamicEntityList gWorldDynamicEntityList; extern WorkerList gWorldWorkerList;
extern DynamicEntityList gBattleDynamicEntityList; extern WorkerList gBattleWorkerList;
extern DynamicEntityList* gCurrentDynamicEntityListPtr; extern WorkerList* gCurrentWorkerListPtr;
extern NpcList gWorldNpcList; extern NpcList gWorldNpcList;
extern NpcList gBattleNpcList; extern NpcList gBattleNpcList;

View File

@ -289,7 +289,7 @@ void btl_state_update_normal_start(void) {
battleStatus->unk_8C = 0; battleStatus->unk_8C = 0;
battleStatus->merleeAttackBoost = 0; battleStatus->merleeAttackBoost = 0;
battleStatus->merleeDefenseBoost = 0; battleStatus->merleeDefenseBoost = 0;
battleStatus->unk_432 = 0; battleStatus->darknessMode = BTL_DARKNESS_STATE_NONE;
battleStatus->unk_433 = -1; battleStatus->unk_433 = -1;
battleStatus->hustleTurns = 0; battleStatus->hustleTurns = 0;
battleStatus->unk_93 = 0; battleStatus->unk_93 = 0;
@ -420,7 +420,7 @@ void btl_state_update_normal_start(void) {
battleStatus->controlScript = script; battleStatus->controlScript = script;
battleStatus->controlScriptID = script->id; battleStatus->controlScriptID = script->id;
} }
if (battleStatus->unk_432 > 0) { if (battleStatus->darknessMode > BTL_DARKNESS_STATE_NONE) {
set_screen_overlay_color(1, 0, 0, 0); set_screen_overlay_color(1, 0, 0, 0);
set_screen_overlay_params_back(0, 215.0f); set_screen_overlay_params_back(0, 215.0f);
} }

View File

@ -200,7 +200,7 @@ void initialize_battle(void) {
gBattleStatus.flags2 &= ~BS_FLAGS2_40; gBattleStatus.flags2 &= ~BS_FLAGS2_40;
} }
create_generic_entity_world(NULL, func_8023ED5C); create_worker_world(NULL, func_8023ED5C);
btl_popup_messages_init(); btl_popup_messages_init();
func_80268E88(); func_80268E88();
set_windows_visible(WINDOW_GROUP_1); set_windows_visible(WINDOW_GROUP_1);
@ -415,13 +415,13 @@ void btl_update(void) {
btl_popup_messages_update(); btl_popup_messages_update();
update_actor_shadows(); update_actor_shadows();
if (battleStatus->unk_432 != -2) { if (battleStatus->darknessMode != BTL_DARKNESS_STATE_LOCKED) {
u8 paramType; u8 paramType;
f32 paramAmount; f32 paramAmount;
get_screen_overlay_params(1, &paramType, &paramAmount); get_screen_overlay_params(1, &paramType, &paramAmount);
if (battleStatus->unk_432 > 0) { if (battleStatus->darknessMode > BTL_DARKNESS_STATE_NONE) {
set_screen_overlay_color(1, 0, 0, 0); set_screen_overlay_color(1, 0, 0, 0);
if (partner == NULL) { if (partner == NULL) {
set_screen_overlay_params_back(0, 215.0f); set_screen_overlay_params_back(0, 215.0f);
@ -438,12 +438,12 @@ void btl_update(void) {
} }
set_screen_overlay_params_back(0, paramAmount); set_screen_overlay_params_back(0, paramAmount);
} }
} else if (battleStatus->unk_432 < 0) { } else if (battleStatus->darknessMode < BTL_DARKNESS_STATE_NONE) {
paramAmount -= 10.0f; paramAmount -= 10.0f;
if (paramAmount < 0.0f) { if (paramAmount < 0.0f) {
paramAmount = 0.0f; paramAmount = 0.0f;
set_screen_overlay_params_back(0xFF, -1.0f); set_screen_overlay_params_back(255, -1.0f);
battleStatus->unk_432 = 0; battleStatus->darknessMode = BTL_DARKNESS_STATE_NONE;
} else { } else {
set_screen_overlay_params_back(0, paramAmount); set_screen_overlay_params_back(0, paramAmount);
} }
@ -456,19 +456,19 @@ void btl_update(void) {
f32 paramAmount; f32 paramAmount;
get_screen_overlay_params(0, &paramType, &paramAmount); get_screen_overlay_params(0, &paramType, &paramAmount);
if (paramType == 0xFF) { if (paramType == 255) {
D_802809F6 = 0; D_802809F6 = 0;
set_screen_overlay_params_front(0, 0.0f); set_screen_overlay_params_front(0, 0.0f);
} }
} }
} else if (D_802809F6 == 0xFF) { } else if (D_802809F6 == 255) {
if (gBattleState != BATTLE_STATE_END_DEMO_BATTLE) { if (gBattleState != BATTLE_STATE_END_DEMO_BATTLE) {
btl_set_state(BATTLE_STATE_END_DEMO_BATTLE); btl_set_state(BATTLE_STATE_END_DEMO_BATTLE);
} }
} else { } else {
D_802809F6 += 10; D_802809F6 += 10;
if (D_802809F6 > 0xFF) { if (D_802809F6 > 255) {
D_802809F6 = 0xFF; D_802809F6 = 255;
} }
set_screen_overlay_params_front(0, D_802809F6); set_screen_overlay_params_front(0, D_802809F6);

View File

@ -227,16 +227,18 @@ ApiStatus OverrideBattleDmaDest(Evt* script, s32 isInitialCall) {
} }
ApiStatus LoadBattleDmaData(Evt* script, s32 isInitialCall) { ApiStatus LoadBattleDmaData(Evt* script, s32 isInitialCall) {
DmaTable* moveScript = &gBattleAreas[gCurrentBattleSection].dmaTable[evt_get_variable(script, *script->ptrReadPos)]; s32 dmaIndex = evt_get_variable(script, *script->ptrReadPos);
BattleArea* battleArea = &gBattleAreas[UNPACK_BTL_AREA(gCurrentBattleID)];
DmaTable* dmaEntry = &battleArea->dmaTable[dmaIndex];
if (moveScript == NULL) { if (dmaEntry == NULL) {
return ApiStatus_DONE2; return ApiStatus_DONE2;
} }
if (gBattleDmaDest == NULL) { if (gBattleDmaDest == NULL) {
dma_copy(moveScript->start, moveScript->end, moveScript->dest); dma_copy(dmaEntry->start, dmaEntry->end, dmaEntry->dest);
} else { } else {
dma_copy(moveScript->start, moveScript->end, gBattleDmaDest); dma_copy(dmaEntry->start, dmaEntry->end, gBattleDmaDest);
} }
return ApiStatus_DONE2; return ApiStatus_DONE2;
@ -262,17 +264,17 @@ ApiStatus func_80253734(Evt* script, s32 isInitialCall) {
s32 val = evt_get_variable(script, *script->ptrReadPos); s32 val = evt_get_variable(script, *script->ptrReadPos);
switch (val) { switch (val) {
case 0: case BTL_DARKNESS_MODE_0:
battleStatus->unk_432 = -1; battleStatus->darknessMode = BTL_DARKNESS_STATE_DARK;
break; break;
case 1: case BTL_DARKNESS_MODE_1:
battleStatus->unk_432 = 1; battleStatus->darknessMode = BTL_DARKNESS_STATE_WATT_BASED;
break; break;
case 2: case BTL_DARKNESS_MODE_2:
battleStatus->unk_432 = -2; battleStatus->darknessMode = BTL_DARKNESS_STATE_LOCKED;
break; break;
case 3: case BTL_DARKNESS_MODE_3:
battleStatus->unk_432 = 1; battleStatus->darknessMode = BTL_DARKNESS_STATE_WATT_BASED;
break; break;
} }

View File

@ -195,7 +195,7 @@ void render_frame(s32 flag) {
} }
render_player(); render_player();
render_npcs(); render_npcs();
render_generic_entities_world(); render_workers_world();
render_effects_world(); render_effects_world();
execute_render_tasks(); execute_render_tasks();
render_hud_elements_world(); render_hud_elements_world();
@ -209,7 +209,7 @@ void render_frame(s32 flag) {
render_item_entities(); render_item_entities();
} }
} else { } else {
render_generic_entities_world(); render_workers_world();
execute_render_tasks(); execute_render_tasks();
} }

View File

@ -805,12 +805,12 @@ s32 popup_menu_update(void) {
break; break;
} }
destroy_popup_menu(); destroy_popup_menu();
free_generic_entity(D_8010D694); free_worker(D_8010D694);
D_8010D640 = -5; D_8010D640 = -5;
gPopupMenu->result = 255; gPopupMenu->result = 255;
return 255; return 255;
case -4: case -4:
free_generic_entity(D_8010D694); free_worker(D_8010D694);
D_8010D640 = -5; D_8010D640 = -5;
gPopupMenu->result = 255; gPopupMenu->result = 255;
return 255; return 255;
@ -1258,7 +1258,7 @@ void create_popup_menu(PopupMenu* popup) {
D_8010D650 = 255; D_8010D650 = 255;
D_8010D691 = 4; D_8010D691 = 4;
D_8010D692 = 6; D_8010D692 = 6;
D_8010D694 = create_generic_entity_frontUI(popup_menu_update, NULL); D_8010D694 = create_worker_frontUI(popup_menu_update, NULL);
} }
void func_800F4FC4(PopupMenu* popup) { void func_800F4FC4(PopupMenu* popup) {
@ -1303,7 +1303,7 @@ void func_800F4FC4(PopupMenu* popup) {
D_8010D650 = 255; D_8010D650 = 255;
D_8010D691 = 4; D_8010D691 = 4;
D_8010D692 = 6; D_8010D692 = 6;
D_8010D694 = create_generic_entity_frontUI(popup_menu_update, NULL); D_8010D694 = create_worker_frontUI(popup_menu_update, NULL);
} }
void func_800F513C(PopupMenu* popup) { void func_800F513C(PopupMenu* popup) {
@ -1347,7 +1347,7 @@ void func_800F513C(PopupMenu* popup) {
D_8010D650 = 255; D_8010D650 = 255;
D_8010D691 = 9; D_8010D691 = 9;
D_8010D692 = 2; D_8010D692 = 2;
D_8010D694 = create_generic_entity_frontUI(popup_menu_update, NULL); D_8010D694 = create_worker_frontUI(popup_menu_update, NULL);
} }
void func_800F52BC(void) { void func_800F52BC(void) {

View File

@ -743,8 +743,8 @@ void clear_item_entity_data(void) {
ItemEntityRenderGroup = 0; ItemEntityRenderGroup = 0;
} }
create_generic_entity_world(NULL, draw_item_entities); create_worker_world(NULL, draw_item_entities);
create_generic_entity_frontUI(NULL, draw_item_entities_UI); create_worker_frontUI(NULL, draw_item_entities_UI);
isPickingUpItem = FALSE; isPickingUpItem = FALSE;
D_801565A8 = 0; D_801565A8 = 0;
} }

View File

@ -526,7 +526,7 @@ void action_command_free(void) {
void func_80268E88(void) { void func_80268E88(void) {
ActionCommandStatus* actionCmdStatus = &gActionCommandStatus; ActionCommandStatus* actionCmdStatus = &gActionCommandStatus;
actionCmdStatus->workerID = create_generic_entity_frontUI(action_command_update, action_command_draw); actionCmdStatus->workerID = create_worker_frontUI(action_command_update, action_command_draw);
actionCmdStatus->actionCommandID = 0; actionCmdStatus->actionCommandID = 0;
} }

View File

@ -134,7 +134,7 @@ EvtScript N(init_80218B70) = {
EVT_CALL(SetActorPos, ACTOR_SELF, 125, 33, -15) EVT_CALL(SetActorPos, ACTOR_SELF, 125, 33, -15)
EVT_CALL(SetHomePos, ACTOR_SELF, 125, 33, -15) EVT_CALL(SetHomePos, ACTOR_SELF, 125, 33, -15)
EVT_CALL(HPBarToHome, ACTOR_SELF) EVT_CALL(HPBarToHome, ACTOR_SELF)
EVT_CALL(func_80253734, 1) EVT_CALL(func_80253734, BTL_DARKNESS_MODE_1)
EVT_RETURN EVT_RETURN
EVT_END EVT_END
}; };

View File

@ -6,9 +6,9 @@
#define NAMESPACE b_area_kpa_kpa_03 #define NAMESPACE b_area_kpa_kpa_03
EvtScript N(beforeBattle) = { EvtScript N(beforeBattle) = {
EVT_CALL(SetSpriteShading, -1) EVT_CALL(SetSpriteShading, SHADING_NONE)
EVT_CALL(SetCamBGColor, 1, 0, 0, 0) EVT_CALL(SetCamBGColor, CAM_BATTLE, 0, 0, 0)
EVT_CALL(func_80253734, 1) EVT_CALL(func_80253734, BTL_DARKNESS_MODE_1)
EVT_RETURN EVT_RETURN
EVT_END EVT_END
}; };

View File

@ -6,9 +6,9 @@
#define NAMESPACE b_area_kpa4_kpa_03 #define NAMESPACE b_area_kpa4_kpa_03
EvtScript N(beforeBattle) = { EvtScript N(beforeBattle) = {
EVT_CALL(SetSpriteShading, -1) EVT_CALL(SetSpriteShading, SHADING_NONE)
EVT_CALL(SetCamBGColor, 1, 0, 0, 0) EVT_CALL(SetCamBGColor, CAM_BATTLE, 0, 0, 0)
EVT_CALL(func_80253734, 1) EVT_CALL(func_80253734, BTL_DARKNESS_MODE_1)
EVT_RETURN EVT_RETURN
EVT_END EVT_END
}; };

View File

@ -523,7 +523,7 @@ API_CALLABLE(N(MarkVineInterpolationDirty)) {
API_CALLABLE(N(CreateVineRenderer)) { API_CALLABLE(N(CreateVineRenderer)) {
N(VineRenderState) = -1; N(VineRenderState) = -1;
create_generic_entity_world(NULL, &N(worker_render_piranha_vines)); create_worker_world(NULL, &N(worker_render_piranha_vines));
return ApiStatus_DONE2; return ApiStatus_DONE2;
} }

View File

@ -430,7 +430,7 @@ EvtScript N(attack_lightning_shot) = {
EVT_WAIT(10) EVT_WAIT(10)
EVT_CALL(GetActorVar, ACTOR_ENEMY1, 7, LVar0) EVT_CALL(GetActorVar, ACTOR_ENEMY1, 7, LVar0)
EVT_IF_NE(LVar0, 0) EVT_IF_NE(LVar0, 0)
EVT_CALL(func_80253734, 2) EVT_CALL(func_80253734, BTL_DARKNESS_MODE_2)
EVT_END_IF EVT_END_IF
EVT_CALL(SetAnimation, ACTOR_SELF, 1, ANIM_GeneralGuy_Anim03) EVT_CALL(SetAnimation, ACTOR_SELF, 1, ANIM_GeneralGuy_Anim03)
EVT_WAIT(20) EVT_WAIT(20)
@ -479,7 +479,7 @@ EvtScript N(attack_lightning_shot) = {
EVT_END_IF EVT_END_IF
EVT_CALL(GetActorVar, ACTOR_ENEMY1, 7, LVar0) EVT_CALL(GetActorVar, ACTOR_ENEMY1, 7, LVar0)
EVT_IF_NE(LVar0, 0) EVT_IF_NE(LVar0, 0)
EVT_CALL(func_80253734, 3) EVT_CALL(func_80253734, BTL_DARKNESS_MODE_3)
EVT_END_IF EVT_END_IF
EVT_CALL(N(UnfadeBackgroundToBlack)) EVT_CALL(N(UnfadeBackgroundToBlack))
EVT_CALL(SetAnimation, ACTOR_ENEMY0, 1, ANIM_GeneralGuy_Anim02) EVT_CALL(SetAnimation, ACTOR_ENEMY0, 1, ANIM_GeneralGuy_Anim02)
@ -508,7 +508,7 @@ EvtScript N(attack_lightning_shot) = {
EVT_WAIT(12) EVT_WAIT(12)
EVT_CALL(GetActorVar, ACTOR_ENEMY1, 7, LVar0) EVT_CALL(GetActorVar, ACTOR_ENEMY1, 7, LVar0)
EVT_IF_NE(LVar0, 0) EVT_IF_NE(LVar0, 0)
EVT_CALL(func_80253734, 3) EVT_CALL(func_80253734, BTL_DARKNESS_MODE_3)
EVT_END_IF EVT_END_IF
EVT_CALL(N(UnfadeBackgroundToBlack)) EVT_CALL(N(UnfadeBackgroundToBlack))
EVT_CALL(SetAnimation, ACTOR_ENEMY0, 1, ANIM_GeneralGuy_Anim02) EVT_CALL(SetAnimation, ACTOR_ENEMY0, 1, ANIM_GeneralGuy_Anim02)
@ -556,7 +556,7 @@ EvtScript N(attack_lightning_shot) = {
EVT_CALL(EnemyDamageTarget, ACTOR_SELF, LVarF, DAMAGE_TYPE_ELECTRIC | DAMAGE_TYPE_NO_CONTACT, 0, 0, 2, BS_FLAGS1_SP_EVT_ACTIVE) EVT_CALL(EnemyDamageTarget, ACTOR_SELF, LVarF, DAMAGE_TYPE_ELECTRIC | DAMAGE_TYPE_NO_CONTACT, 0, 0, 2, BS_FLAGS1_SP_EVT_ACTIVE)
EVT_CALL(GetActorVar, ACTOR_ENEMY1, 7, LVar0) EVT_CALL(GetActorVar, ACTOR_ENEMY1, 7, LVar0)
EVT_IF_NE(LVar0, 0) EVT_IF_NE(LVar0, 0)
EVT_CALL(func_80253734, 3) EVT_CALL(func_80253734, BTL_DARKNESS_MODE_3)
EVT_END_IF EVT_END_IF
EVT_CALL(N(UnfadeBackgroundToBlack)) EVT_CALL(N(UnfadeBackgroundToBlack))
EVT_CALL(SetAnimation, ACTOR_ENEMY0, 1, ANIM_GeneralGuy_Anim02) EVT_CALL(SetAnimation, ACTOR_ENEMY0, 1, ANIM_GeneralGuy_Anim02)

View File

@ -643,7 +643,7 @@ EvtScript N(summon_tank_squad) = {
EVT_CALL(SetAnimation, ACTOR_ENEMY0, 1, ANIM_GeneralGuy_Anim03) EVT_CALL(SetAnimation, ACTOR_ENEMY0, 1, ANIM_GeneralGuy_Anim03)
EVT_CALL(SetActorVar, ACTOR_SELF, 6, 0) EVT_CALL(SetActorVar, ACTOR_SELF, 6, 0)
EVT_WAIT(10) EVT_WAIT(10)
EVT_CALL(func_80253734, 1) EVT_CALL(func_80253734, BTL_DARKNESS_MODE_1)
EVT_CALL(SetActorVar, ACTOR_SELF, 7, 1) EVT_CALL(SetActorVar, ACTOR_SELF, 7, 1)
EVT_EXEC(N(8022F2BC)) EVT_EXEC(N(8022F2BC))
EVT_WAIT(30) EVT_WAIT(30)

View File

@ -286,7 +286,7 @@ void reset_battle_status(void) {
D_800DC4D4 = 0; D_800DC4D4 = 0;
D_800DC4FC = NULL; D_800DC4FC = NULL;
D_800DC4F8 = 0; D_800DC4F8 = 0;
D_800DC4E8 = 0; gCurrentBattleID = 0;
D_800DC064 = NULL; D_800DC064 = NULL;
D_800DC060 = 0; D_800DC060 = 0;
D_800DC4EC = 0; D_800DC4EC = 0;
@ -302,8 +302,8 @@ void func_80072BCC(s32 arg0) {
} }
void load_battle_section(void) { void load_battle_section(void) {
BattleArea* battleArea = &gBattleAreas[gCurrentBattleSection]; BattleArea* battleArea = &gBattleAreas[UNPACK_BTL_AREA(gCurrentBattleID)];
s32 battleIdx = D_800DC4EB; s32 battleIdx = UNPACK_BTL_INDEX(gCurrentBattleID);
dma_copy(battleArea->dmaStart, battleArea->dmaEnd, battleArea->dmaDest); dma_copy(battleArea->dmaStart, battleArea->dmaEnd, battleArea->dmaDest);
@ -319,8 +319,8 @@ void load_battle_section(void) {
D_800DC4D0 = 0; D_800DC4D0 = 0;
} }
void load_battle(s32 arg0) { void load_battle(s32 battleID) {
D_800DC4E8 = arg0; gCurrentBattleID = battleID;
set_game_mode(GAME_MODE_BATTLE); set_game_mode(GAME_MODE_BATTLE);
gBattleState = 0; gBattleState = 0;
D_800DC4D0 = 0; D_800DC4D0 = 0;
@ -398,10 +398,10 @@ void load_demo_battle(u32 index) {
gGameStatusPtr->isBattle = FALSE; gGameStatusPtr->isBattle = FALSE;
general_heap_create(); general_heap_create();
clear_generic_entity_list(); clear_worker_list();
clear_script_list(); clear_script_list();
create_cameras_a(); create_cameras_a();
spr_init_sprites(0); spr_init_sprites(PLAYER_SPRITES_MARIO_WORLD);
clear_animator_list(); clear_animator_list();
clear_entity_models(); clear_entity_models();
clear_npcs(); clear_npcs();

View File

@ -1,4 +1,5 @@
#include "coconut.h" #include "coconut.h"
#include "entity.h"
#include "ld_addrs.h" #include "ld_addrs.h"
#include "battle/item/coconut.png.h" #include "battle/item/coconut.png.h"
@ -41,12 +42,10 @@ Gfx N(displayList)[] = {
gsSPEndDisplayList(), gsSPEndDisplayList(),
}; };
s32 N(modelCommandList)[] = { EntityModelScript N(modelCommandList) = STANDARD_ENTITY_MODEL_SCRIPT(N(displayList), RENDER_MODE_ALPHATEST);;
0x00000004, 0x0000000D, 0x00000001, sizeof(N(displayList)) / sizeof(s32), (s32) &N(displayList), 0x00000002, 0x00000000,
};
EvtScript N(main) = { EvtScript N(main) = {
EVT_SET_CONST(LVarA, 0x000000AC) EVT_SET_CONST(LVarA, ITEM_COCONUT)
EVT_EXEC_WAIT(N(UseItemWithEffect)) EVT_EXEC_WAIT(N(UseItemWithEffect))
EVT_CALL(UseBattleCamPreset, BTL_CAM_PRESET_D) EVT_CALL(UseBattleCamPreset, BTL_CAM_PRESET_D)
EVT_CALL(MoveBattleCamOver, 15) EVT_CALL(MoveBattleCamOver, 15)

View File

@ -23,7 +23,7 @@ ApiStatus N(func_802A1270_727B80)(Evt* script, s32 isInitialCall) {
script->functionTemp[2] = 0; script->functionTemp[2] = 0;
sfx_play_sound(SOUND_2033); sfx_play_sound(SOUND_2033);
camera->auxPitch = 0; camera->auxPitch = 0;
D_802A1CD0 = create_generic_entity_frontUI(NULL, func_802A123C_727B4C); D_802A1CD0 = create_worker_frontUI(NULL, func_802A123C_727B4C);
script->functionTemp[0] = 1; script->functionTemp[0] = 1;
case 1: case 1:
camera->flags |= CAMERA_FLAGS_SHAKING; camera->flags |= CAMERA_FLAGS_SHAKING;
@ -36,7 +36,7 @@ ApiStatus N(func_802A1270_727B80)(Evt* script, s32 isInitialCall) {
} }
camera->auxPitch = 0; camera->auxPitch = 0;
camera->flags &= ~CAMERA_FLAGS_SHAKING; camera->flags &= ~CAMERA_FLAGS_SHAKING;
free_generic_entity(D_802A1CD0); free_worker(D_802A1CD0);
return ApiStatus_DONE2; return ApiStatus_DONE2;
} }

View File

@ -1,4 +1,5 @@
#include "dusty_hammer.h" #include "dusty_hammer.h"
#include "entity.h"
#include "ld_addrs.h" #include "ld_addrs.h"
#include "battle/item/dusty_hammer.png.h" #include "battle/item/dusty_hammer.png.h"
@ -40,12 +41,10 @@ Gfx N(displayList)[] = {
gsSPEndDisplayList(), gsSPEndDisplayList(),
}; };
s32 N(modelCommandList)[] = { EntityModelScript N(modelCommandList) = STANDARD_ENTITY_MODEL_SCRIPT(N(displayList), RENDER_MODE_ALPHATEST);;
0x00000004, 0x0000000D, 0x00000001, sizeof(N(displayList)) / sizeof(s32), (s32) &N(displayList), 0x00000002, 0x00000000,
};
EvtScript N(main) = { EvtScript N(main) = {
EVT_SET_CONST(LVarA, 0x00000086) EVT_SET_CONST(LVarA, ITEM_DUSTY_HAMMER)
EVT_EXEC_WAIT(N(UseItemWithEffect)) EVT_EXEC_WAIT(N(UseItemWithEffect))
EVT_CALL(UseBattleCamPreset, BTL_CAM_PRESET_D) EVT_CALL(UseBattleCamPreset, BTL_CAM_PRESET_D)
EVT_CALL(MoveBattleCamOver, 15) EVT_CALL(MoveBattleCamOver, 15)

View File

@ -1,5 +1,6 @@
#include "egg_missile.h" #include "egg_missile.h"
#include "effects.h" #include "effects.h"
#include "entity.h"
#include "ld_addrs.h" #include "ld_addrs.h"
#include "battle/item/egg_missile1.png.h" #include "battle/item/egg_missile1.png.h"
#include "battle/item/egg_missile2.png.h" #include "battle/item/egg_missile2.png.h"
@ -128,26 +129,27 @@ Gfx N(frame4_displayList)[] = {
gsSPEndDisplayList(), gsSPEndDisplayList(),
}; };
s32 N(modelCommandList)[] = { EntityModelScript N(modelCommandList) = {
0x00000004, 0x0000000D, ems_SetRenderMode(RENDER_MODE_ALPHATEST)
0x00000001, 0x00000002, (s32) &N(frame1_displayList), ems_Draw(N(frame1_displayList), 2)
0x00000001, 0x00000002, (s32) &N(frame2_displayList), ems_Draw(N(frame2_displayList), 2)
0x00000001, 0x00000002, (s32) &N(frame3_displayList), ems_Draw(N(frame3_displayList), 2)
0x00000002, 0x00000000, ems_Restart
0x00000004, 0x0000000D, ems_End
0x00000001, sizeof(N(frame4_displayList)) / sizeof(s32), (s32) &N(frame4_displayList),
0x00000002, 0x00000000,
}; };
EntityModelScript unusedModelScript = STANDARD_ENTITY_MODEL_SCRIPT(
N(frame4_displayList), RENDER_MODE_ALPHATEST);
EvtScript N(main) = { EvtScript N(main) = {
EVT_SET_CONST(LVarA, 0xC8) EVT_SET_CONST(LVarA, ITEM_EGG_MISSILE)
EVT_EXEC_WAIT(battle_item_egg_missile_UseItemWithEffect) EVT_EXEC_WAIT(battle_item_egg_missile_UseItemWithEffect)
EVT_CALL(UseBattleCamPreset, BTL_CAM_PRESET_D) EVT_CALL(UseBattleCamPreset, BTL_CAM_PRESET_D)
EVT_CALL(MoveBattleCamOver, 15) EVT_CALL(MoveBattleCamOver, 15)
EVT_CALL(SetAnimation, 0, 0, 65558) EVT_CALL(SetAnimation, 0, 0, 65558)
EVT_CALL(PlaySound, 1018) EVT_CALL(PlaySound, 1018)
EVT_WAIT(3) EVT_WAIT(3)
EVT_CALL(CreateVirtualEntity, LVarA, (s32) battle_item_egg_missile_modelCommandList) EVT_CALL(CreateVirtualEntity, LVarA, EVT_PTR(battle_item_egg_missile_modelCommandList))
EVT_CALL(GetActorPos, 0, LVar0, LVar1, LVar2) EVT_CALL(GetActorPos, 0, LVar0, LVar1, LVar2)
EVT_ADD(LVar0, 20) EVT_ADD(LVar0, 20)
EVT_ADD(LVar1, 42) EVT_ADD(LVar1, 42)

View File

@ -1,5 +1,6 @@
#include "insecticide_herb.h" #include "insecticide_herb.h"
#include "effects.h" #include "effects.h"
#include "entity.h"
#include "ld_addrs.h" #include "ld_addrs.h"
#include "battle/item/insecticide_herb.png.h" #include "battle/item/insecticide_herb.png.h"
@ -84,12 +85,11 @@ Gfx N(displayList)[] = {
gsSPEndDisplayList(), gsSPEndDisplayList(),
}; };
s32 N(modelCommandList)[] = { EntityModelScript N(modelCommandList) = STANDARD_ENTITY_MODEL_SCRIPT(N(displayList), RENDER_MODE_ALPHATEST);;
0x00000004, 0x0000000D, 0x00000001, sizeof(N(displayList)) / sizeof(s32), &N(displayList), 0x00000002, 0x00000000,
};
EvtScript N(main) = { EvtScript N(main) = {
EVT_SET_CONST(LVarA, 0x00000087) EVT_SET_CONST(LVarA, ITEM_INSECTICIDE_HERB)
EVT_EXEC_WAIT(N(UseItemWithEffect)) EVT_EXEC_WAIT(N(UseItemWithEffect))
EVT_CALL(UseBattleCamPreset, BTL_CAM_PRESET_D) EVT_CALL(UseBattleCamPreset, BTL_CAM_PRESET_D)
EVT_CALL(MoveBattleCamOver, 15) EVT_CALL(MoveBattleCamOver, 15)

View File

@ -1,5 +1,6 @@
#include "mystery.h" #include "mystery.h"
#include "effects.h" #include "effects.h"
#include "entity.h"
#include "ld_addrs.h" #include "ld_addrs.h"
#include "battle/item/mystery.png.h" #include "battle/item/mystery.png.h"
@ -53,12 +54,12 @@ s32 N(func_802A13E4_72C994)(Evt* script, s32 isInitialCall) {
switch (D_802A25E4) { switch (D_802A25E4) {
case 0: case 0:
D_802A25F8 = create_generic_entity_frontUI(NULL, N(func_802A123C_72C7EC)); D_802A25F8 = create_worker_frontUI(NULL, N(func_802A123C_72C7EC));
D_802A25EC = rand_int(18200); D_802A25EC = rand_int(18200);
D_802A25F0 = 1000; D_802A25F0 = 1000;
D_802A25FC = N(D_802A227C_72D82C); D_802A25FC = N(D_802A227C_72D82C);
if (battleStatus->unk_432 > 0) { if (battleStatus->darknessMode > BTL_DARKNESS_STATE_NONE) {
u8 type; u8 type;
f32 zoom; f32 zoom;
@ -149,7 +150,7 @@ s32 N(func_802A13E4_72C994)(Evt* script, s32 isInitialCall) {
var_v0_3 = i = D_802A25E8 / 26; // use of i required to match var_v0_3 = i = D_802A25E8 / 26; // use of i required to match
battleStatus->selectedItemID = D_802A25FC[D_802A25E8 / 26]; battleStatus->selectedItemID = D_802A25FC[D_802A25E8 / 26];
script->varTable[0] = battleStatus->selectedItemID; script->varTable[0] = battleStatus->selectedItemID;
free_generic_entity(D_802A25F8); free_worker(D_802A25F8);
for (i = 0; i < ARRAY_COUNT(D_802A25C8); i++) { for (i = 0; i < ARRAY_COUNT(D_802A25C8); i++) {
hud_element_free(D_802A25C8[i]); hud_element_free(D_802A25C8[i]);
} }
@ -205,22 +206,32 @@ Gfx N(displayList)[] = {
gsSPEndDisplayList(), gsSPEndDisplayList(),
}; };
s32 N(modelCommandList)[] = { EntityModelScript N(modelCommandList) = STANDARD_ENTITY_MODEL_SCRIPT(N(displayList), RENDER_MODE_ALPHATEST);;
0x00000004, 0x0000000D, 0x00000001, sizeof(N(displayList)) / sizeof(s32), (s32) &N(displayList), 0x00000002, 0x00000000,
};
s32 N(D_802A227C_72D82C)[8] = { s32 N(D_802A227C_72D82C)[8] = {
0x0000008A, 0x0000008C, 0x00000080, 0x00000088, ITEM_MUSHROOM,
0x0000009A, 0x00000082, 0x00000085, 0x0000008A ITEM_SUPER_SHROOM,
ITEM_FIRE_FLOWER,
ITEM_STONE_CAP,
ITEM_DIZZY_DIAL,
ITEM_THUNDER_RAGE,
ITEM_PEBBLE,
ITEM_MUSHROOM
}; };
s32 N(D_802A229C_72D84C)[8] = { s32 N(D_802A229C_72D84C)[8] = {
0x0000008A, 0x0000008C, 0x00000085, 0x00000088, ITEM_MUSHROOM,
0x0000008A, 0x0000008C, 0x00000085, 0x0000008A ITEM_SUPER_SHROOM,
ITEM_PEBBLE,
ITEM_STONE_CAP,
ITEM_MUSHROOM,
ITEM_SUPER_SHROOM,
ITEM_PEBBLE,
ITEM_MUSHROOM
}; };
EvtScript N(main) = { EvtScript N(main) = {
EVT_SET_CONST(LVarA, 0x00000096) EVT_SET_CONST(LVarA, ITEM_MYSTERY)
EVT_EXEC_WAIT(N(UseItemWithEffect)) EVT_EXEC_WAIT(N(UseItemWithEffect))
EVT_THREAD EVT_THREAD
EVT_WAIT(220) EVT_WAIT(220)

View File

@ -45,7 +45,7 @@ s32 N(modelCommandList)[] = {
}; };
EvtScript N(main) = { EvtScript N(main) = {
EVT_SET_CONST(LVarA, 0x00000085) EVT_SET_CONST(LVarA, ITEM_PEBBLE)
EVT_EXEC_WAIT(N(UseItemWithEffect)) EVT_EXEC_WAIT(N(UseItemWithEffect))
EVT_CALL(UseBattleCamPreset, BTL_CAM_PRESET_D) EVT_CALL(UseBattleCamPreset, BTL_CAM_PRESET_D)
EVT_CALL(MoveBattleCamOver, 15) EVT_CALL(MoveBattleCamOver, 15)

View File

@ -1,4 +1,5 @@
#include "sleepy_sheep.h" #include "sleepy_sheep.h"
#include "entity.h"
#include "ld_addrs.h" #include "ld_addrs.h"
#include "battle/item/sleepy_sheep1.png.h" #include "battle/item/sleepy_sheep1.png.h"
#include "battle/item/sleepy_sheep2.png.h" #include "battle/item/sleepy_sheep2.png.h"
@ -312,31 +313,38 @@ Gfx N(frame3_displayList)[] = {
gsSPEndDisplayList(), gsSPEndDisplayList(),
}; };
s32 N(modelCommandList)[] = { EntityModelScript N(modelCommandList) = {
0x00000004, 0x0000000D, ems_SetRenderMode(RENDER_MODE_ALPHATEST)
0x00000001, 0x00000002, (s32) &N(frame1_displayList), ems_Draw(N(frame1_displayList), 2)
0x00000001, 0x00000003, (s32) &N(frame2_displayList), ems_Draw(N(frame2_displayList), 3)
0x00000001, 0x00000002, (s32) &N(frame1_displayList), ems_Draw(N(frame1_displayList), 2)
0x00000001, 0x00000002, (s32) &N(frame3_displayList), ems_Draw(N(frame3_displayList), 2)
0x00000002, 0x00000000, ems_Restart
ems_End
};
0x00000004, 0x0000000D, EntityModelScript N(modelCommandList_unused1) = {
0x00000001, 0x00000003, (s32) &N(frame2_displayList), ems_SetRenderMode(RENDER_MODE_ALPHATEST)
0x00000001, 0x00000002, (s32) &N(frame1_displayList), ems_Draw(N(frame2_displayList),3)
0x00000001, 0x00000002, (s32) &N(frame3_displayList), ems_Draw(N(frame1_displayList),2)
0x00000001, 0x00000002, (s32) &N(frame1_displayList), ems_Draw(N(frame3_displayList),2)
0x00000002, 0x00000000, ems_Draw(N(frame1_displayList),2)
ems_Restart
ems_End
};
0x00000004, 0x0000000D, EntityModelScript N(modelCommandList_unused2) = {
0x00000001, 0x00000002, (s32) &N(frame1_displayList), ems_SetRenderMode(RENDER_MODE_ALPHATEST)
0x00000001, 0x00000002, (s32) &N(frame3_displayList), ems_Draw(N(frame1_displayList), 2)
0x00000001, 0x00000002, (s32) &N(frame1_displayList), ems_Draw(N(frame3_displayList), 2)
0x00000001, 0x00000003, (s32) &N(frame2_displayList), ems_Draw(N(frame1_displayList), 2)
0x00000002, 0x00000000, ems_Draw(N(frame2_displayList), 3)
ems_Restart
ems_End
}; };
EvtScript N(main) = { EvtScript N(main) = {
EVT_SET_CONST(LVarA, 0x0000008F) EVT_SET_CONST(LVarA, ITEM_SLEEPY_SHEEP)
EVT_EXEC_WAIT(N(UseItemWithEffect)) EVT_EXEC_WAIT(N(UseItemWithEffect))
EVT_CALL(UseBattleCamPreset, BTL_CAM_PRESET_19) EVT_CALL(UseBattleCamPreset, BTL_CAM_PRESET_19)
EVT_CALL(SetBattleCamTarget, -67, -15, -5) EVT_CALL(SetBattleCamTarget, -67, -15, -5)

View File

@ -56,7 +56,7 @@ s32 N(func_802A13E4_7316E4)(Evt* script, s32 isInitialCall) {
switch (D_802A2DEC) { switch (D_802A2DEC) {
case 0: case 0:
D_802A2E00 = create_generic_entity_frontUI(NULL, N(func_802A123C_73153C)); D_802A2E00 = create_worker_frontUI(NULL, N(func_802A123C_73153C));
D_802A2DF4 = rand_int(13000); D_802A2DF4 = rand_int(13000);
D_802A2DF8 = 1000; D_802A2DF8 = 1000;
@ -142,7 +142,7 @@ s32 N(func_802A13E4_7316E4)(Evt* script, s32 isInitialCall) {
var_v0_3 = i = D_802A2DF0 / 26; // use of i required to match var_v0_3 = i = D_802A2DF0 / 26; // use of i required to match
battleStatus->selectedItemID = N(D_802A2858_732B58)[var_v0_3]; battleStatus->selectedItemID = N(D_802A2858_732B58)[var_v0_3];
script->varTable[0] = battleStatus->selectedItemID; script->varTable[0] = battleStatus->selectedItemID;
free_generic_entity(D_802A2E00); free_worker(D_802A2E00);
for (i = 0; i < ARRAY_COUNT(D_802A2DD8); i++) { for (i = 0; i < ARRAY_COUNT(D_802A2DD8); i++) {
hud_element_free(D_802A2DD8[i]); hud_element_free(D_802A2DD8[i]);
} }

View File

@ -40,7 +40,6 @@ extern Gfx D_8014BF18[];
extern Gfx D_8014BF40[]; extern Gfx D_8014BF40[];
extern Gfx D_8014BF68[]; extern Gfx D_8014BF68[];
s32 step_entity_model_commandlist(EntityModel* entityModel); s32 step_entity_model_commandlist(EntityModel* entityModel);
void free_entity_model_by_ref(EntityModel* entityModel); void free_entity_model_by_ref(EntityModel* entityModel);
@ -836,188 +835,3 @@ void get_entity_fog_color(s32* r, s32* g, s32* b, s32* a) {
*b = entity_fog_blue; *b = entity_fog_blue;
*a = entity_fog_alpha; *a = entity_fog_alpha;
} }
void stub_generic_entity_delegate(void) {
}
void clear_generic_entity_list(void) {
s32 i;
if (!gGameStatusPtr->isBattle) {
gCurrentDynamicEntityListPtr = &gWorldDynamicEntityList;
} else {
gCurrentDynamicEntityListPtr = &gBattleDynamicEntityList;
}
for (i = 0; i < MAX_DYNAMIC_ENTITIES; i++) {
(*gCurrentDynamicEntityListPtr)[i] = NULL;
}
}
void init_generic_entity_list(void) {
if (!gGameStatusPtr->isBattle) {
gCurrentDynamicEntityListPtr = &gWorldDynamicEntityList;
} else {
gCurrentDynamicEntityListPtr = &gBattleDynamicEntityList;
}
}
s32 create_generic_entity_world(void (*updateFunc)(void), void (*drawFunc)(void)) {
s32 i;
DynamicEntity* newDynEntity;
for (i = 0; i < MAX_DYNAMIC_ENTITIES; i++) {
DynamicEntity* dynEntity = (*gCurrentDynamicEntityListPtr)[i];
if (dynEntity == NULL) {
break;
}
}
ASSERT(i < MAX_DYNAMIC_ENTITIES);
(*gCurrentDynamicEntityListPtr)[i] = newDynEntity = heap_malloc(sizeof(*newDynEntity));
ASSERT(newDynEntity != NULL);
newDynEntity->flags = ENTITY_FLAGS_HIDDEN | ENTITY_FLAGS_DRAW_IF_CLOSE_HIDE_MODE1;
newDynEntity->update = updateFunc;
if (updateFunc == NULL) {
newDynEntity->update = stub_generic_entity_delegate;
}
newDynEntity->draw = drawFunc;
if (drawFunc == NULL) {
newDynEntity->draw = stub_generic_entity_delegate;
}
if (gGameStatusPtr->isBattle) {
i |= BATTLE_ENTITY_ID_MASK;
}
return i;
}
s32 create_generic_entity_frontUI(void (*updateFunc)(void), void (*drawFunc)(void)) {
s32 i;
DynamicEntity* newDynEntity;
for (i = 0; i < MAX_DYNAMIC_ENTITIES; i++) {
DynamicEntity* dynEntity = (*gCurrentDynamicEntityListPtr)[i];
if (dynEntity == NULL) {
break;
}
}
ASSERT(i < MAX_DYNAMIC_ENTITIES);
(*gCurrentDynamicEntityListPtr)[i] = newDynEntity = heap_malloc(sizeof(*newDynEntity));
ASSERT(newDynEntity != NULL);
newDynEntity->flags = ENTITY_FLAGS_HIDDEN | ENTITY_FLAGS_DRAW_IF_CLOSE_HIDE_MODE1 | ENTITY_FLAGS_HAS_DYNAMIC_SHADOW;
newDynEntity->update = updateFunc;
if (updateFunc == NULL) {
newDynEntity->update = stub_generic_entity_delegate;
}
newDynEntity->draw = drawFunc;
if (drawFunc == NULL) {
newDynEntity->draw = stub_generic_entity_delegate;
}
if (gGameStatusPtr->isBattle) {
i |= BATTLE_ENTITY_ID_MASK;
}
return i;
}
s32 create_generic_entity_backUI(void (*updateFunc)(void), void (*drawFunc)(void)) {
s32 i;
DynamicEntity* newDynEntity;
for (i = 0; i < MAX_DYNAMIC_ENTITIES; i++) {
DynamicEntity* dynEntity = (*gCurrentDynamicEntityListPtr)[i];
if (dynEntity == NULL) {
break;
}
}
ASSERT(i < MAX_DYNAMIC_ENTITIES);
(*gCurrentDynamicEntityListPtr)[i] = newDynEntity = heap_malloc(sizeof(*newDynEntity));
ASSERT(newDynEntity != NULL);
newDynEntity->flags = ENTITY_FLAGS_HIDDEN | ENTITY_FLAGS_DRAW_IF_CLOSE_HIDE_MODE1 | ENTITY_FLAGS_HAS_ANIMATED_MODEL;
newDynEntity->update = updateFunc;
if (updateFunc == NULL) {
newDynEntity->update = &stub_generic_entity_delegate;
}
newDynEntity->draw = drawFunc;
if (drawFunc == NULL) {
newDynEntity->draw = &stub_generic_entity_delegate;
}
if (gGameStatusPtr->isBattle) {
i |= BATTLE_ENTITY_ID_MASK;
}
return i;
}
void update_generic_entities(void) {
s32 i;
for (i = 0; i < MAX_DYNAMIC_ENTITIES; i++) {
DynamicEntity* entity = (*gCurrentDynamicEntityListPtr)[i];
if (entity != NULL) {
entity->flags &= ~ENTITY_FLAGS_DRAW_IF_CLOSE_HIDE_MODE1;
entity->update();
}
}
}
void render_generic_entities_world(void) {
s32 i;
for (i = 0; i < MAX_DYNAMIC_ENTITIES; i++) {
DynamicEntity* entity = (*gCurrentDynamicEntityListPtr)[i];
if (entity != NULL && !(entity->flags & ENTITY_FLAGS_DRAW_IF_CLOSE_HIDE_MODE1)) {
if (!(entity->flags & ENTITY_FLAGS_HAS_DYNAMIC_SHADOW)) {
entity->draw();
}
}
}
}
void render_generic_entities_frontUI(void) {
s32 i;
for (i = 0; i < MAX_DYNAMIC_ENTITIES; i++) {
DynamicEntity* entity = (*gCurrentDynamicEntityListPtr)[i];
if (entity != NULL && !(entity->flags & ENTITY_FLAGS_DRAW_IF_CLOSE_HIDE_MODE1)) {
if (entity->flags & ENTITY_FLAGS_HAS_DYNAMIC_SHADOW) {
entity->draw();
}
}
}
}
void render_generic_entities_backUI(void) {
s32 i;
for (i = 0; i < MAX_DYNAMIC_ENTITIES; i++) {
DynamicEntity* entity = (*gCurrentDynamicEntityListPtr)[i];
if (entity != NULL && !(entity->flags & ENTITY_FLAGS_DRAW_IF_CLOSE_HIDE_MODE1)) {
if (entity->flags & ENTITY_FLAGS_HAS_ANIMATED_MODEL) {
entity->draw();
}
}
}
}
void free_generic_entity(s32 idx) {
if (!gGameStatusPtr->isBattle || (idx & BATTLE_ENTITY_ID_MASK)) {
DynamicEntityList** curDynEntityList = &gCurrentDynamicEntityListPtr;
idx &= ~BATTLE_ENTITY_ID_MASK;
if ((**curDynEntityList)[idx] != NULL) {
heap_free((**curDynEntityList)[idx]);
(**curDynEntityList)[idx] = NULL;
}
}
}
DynamicEntity* get_generic_entity(s32 idx) {
return (*gCurrentDynamicEntityListPtr)[idx & ~BATTLE_ENTITY_ID_MASK];
}

View File

@ -272,7 +272,7 @@ void reset_model_animators(void) {
(*gCurrentMeshAnimationListPtr)[i]->animModelID = -1; (*gCurrentMeshAnimationListPtr)[i]->animModelID = -1;
} }
create_generic_entity_world(update_animated_models, render_animated_models); create_worker_world(update_animated_models, render_animated_models);
} }
void init_model_animators(void) { void init_model_animators(void) {

View File

@ -6,17 +6,9 @@
extern Npc playerNpcData; extern Npc playerNpcData;
extern u16 D_802DB5B0; extern u16 D_802DB5B0;
extern s32 D_802DB5B4[3]; // unused extern s32 D_802DB5B4[3]; // unused
extern VirtualEntityList D_802DB5C0;
extern VirtualEntityList D_802DB6C0;
extern VirtualEntityList* D_802DB7C0;
Npc* playerNpc = &playerNpcData; Npc* playerNpc = &playerNpcData;
void virtual_entity_list_render_world(void);
void virtual_entity_list_render_UI(void);
s32 ALT_load_entity_model(s32* cmdList);
s32 create_generic_entity_backUI(void (*updateFunc)(void), void (*drawFunc)(void));
ApiStatus HidePlayerShadow(Evt* script, s32 isInitialCall) { ApiStatus HidePlayerShadow(Evt* script, s32 isInitialCall) {
Bytecode* args = script->ptrReadPos; Bytecode* args = script->ptrReadPos;
s32 hideShadow = evt_get_variable(script, *args++); s32 hideShadow = evt_get_variable(script, *args++);
@ -844,672 +836,3 @@ ApiStatus PlaySoundAtPlayer(Evt* script, s32 isInitialCall) {
sfx_play_sound_at_player(soundID, flags); sfx_play_sound_at_player(soundID, flags);
return ApiStatus_DONE2; return ApiStatus_DONE2;
} }
void virtual_entity_appendGfx_quad(u8 r, u8 g, u8 b, u8 a, u16 left, u16 top, u16 right, u16 bottom) {
gDPPipeSync(gMasterGfxPos++);
if (a == 0xFF) {
gDPSetCombineLERP(gMasterGfxPos++, 0, 0, 0, PRIMITIVE, 0, 0, 0, 1, 0, 0, 0, PRIMITIVE, 0, 0, 0, 1);
} else {
gDPSetRenderMode(gMasterGfxPos++, G_RM_XLU_SURF, G_RM_XLU_SURF2);
gDPSetCombineMode(gMasterGfxPos++, G_CC_PRIMITIVE, G_CC_PRIMITIVE);
}
gDPSetPrimColor(gMasterGfxPos++, 0, 0, r, g, b, a);
gDPFillRectangle(gMasterGfxPos++, left, top, right, bottom);
gDPPipeSync(gMasterGfxPos++);
gDPSetRenderMode(gMasterGfxPos++, G_RM_TEX_EDGE, G_RM_TEX_EDGE2);
gDPSetCombineMode(gMasterGfxPos++, G_CC_DECALRGBA, G_CC_DECALRGBA);
}
void virtual_entity_render_quad(s32 arg0, s32 arg1, s32 arg2, s32 arg3, s32 arg4, s32 arg5, s32 arg6, s32 arg7) {
u16 temp1 = arg4 + arg6;
u16 temp2 = arg5 + arg7;
virtual_entity_appendGfx_quad(arg0, arg1, arg2, arg3, arg4, arg5, temp1, temp2);
}
void virtual_entity_move_polar(VirtualEntity* virtualEntity, f32 magnitude, f32 angle) {
f32 theta = DEG_TO_RAD(angle);
f32 sinTheta = sin_rad(theta);
f32 cosTheta = cos_rad(theta);
virtualEntity->pos.x += magnitude * sinTheta;
virtualEntity->pos.z += -magnitude * cosTheta;
}
void virtual_entity_list_update(void) {
s32 i;
for (i = 0; i < ARRAY_COUNT(*D_802DB7C0); i++) {
VirtualEntity* virtualEntity = (*D_802DB7C0)[i];
if (virtualEntity != NULL && virtualEntity->entityModelIndex >= 0) {
exec_entity_model_commandlist(virtualEntity->entityModelIndex);
}
}
}
void virtual_entity_list_render_world(void) {
Matrix4f translation;
Matrix4f xRot;
Matrix4f yRot;
Matrix4f zRot;
Matrix4f rotation;
Matrix4f temp;
Matrix4f transform;
Matrix4f scale;
Mtx transformMtxL;
VirtualEntity* virtualEntity;
s32 i;
for (i = 0; i < ARRAY_COUNT(*D_802DB7C0); i++) {
virtualEntity = (*D_802DB7C0)[i];
if (virtualEntity != NULL) {
if (!(virtualEntity->entityModelIndex < 0 || get_entity_model(virtualEntity->entityModelIndex)->flags & ENTITY_MODEL_FLAGS_CAM3)) {
guTranslateF(translation, virtualEntity->pos.x, virtualEntity->pos.y, virtualEntity->pos.z);
guRotateF(xRot, virtualEntity->rot.x, 1.0f, 0.0f, 0.0f);
guRotateF(yRot, virtualEntity->rot.y, 0.0f, 1.0f, 0.0f);
guRotateF(zRot, virtualEntity->rot.z, 0.0f, 0.0f, 1.0f);
guScaleF(scale, virtualEntity->scale.x, virtualEntity->scale.y, virtualEntity->scale.z);
guMtxCatF(zRot, xRot, temp);
guMtxCatF(temp, yRot, rotation);
guMtxCatF(scale, rotation, temp);
guMtxCatF(temp, translation, transform);
guMtxF2L(transform, &transformMtxL);
draw_entity_model_A(virtualEntity->entityModelIndex, &transformMtxL);
}
}
}
}
void virtual_entity_list_render_UI(void) {
Matrix4f translation;
Matrix4f xRot;
Matrix4f yRot;
Matrix4f zRot;
Matrix4f rotation;
Matrix4f temp;
Matrix4f transform;
Matrix4f scale;
Mtx transformMtxL;
VirtualEntity* virtualEntity;
s32 i;
for (i = 0; i < ARRAY_COUNT(*D_802DB7C0); i++) {
virtualEntity = (*D_802DB7C0)[i];
if (virtualEntity != NULL) {
if (!(virtualEntity->entityModelIndex < 0 || !(get_entity_model(virtualEntity->entityModelIndex)->flags & ENTITY_MODEL_FLAGS_CAM3))) {
guTranslateF(translation, virtualEntity->pos.x, virtualEntity->pos.y, virtualEntity->pos.z);
guRotateF(xRot, virtualEntity->rot.x, 1.0f, 0.0f, 0.0f);
guRotateF(yRot, virtualEntity->rot.y, 0.0f, 1.0f, 0.0f);
guRotateF(zRot, virtualEntity->rot.z, 0.0f, 0.0f, 1.0f);
guScaleF(scale, virtualEntity->scale.x, virtualEntity->scale.y, virtualEntity->scale.z);
guMtxCatF(zRot, xRot, temp);
guMtxCatF(temp, yRot, rotation);
guMtxCatF(scale, rotation, temp);
guMtxCatF(temp, translation, transform);
guMtxF2L(transform, &transformMtxL);
draw_entity_model_E(virtualEntity->entityModelIndex, &transformMtxL);
}
}
}
}
ApiStatus InitVirtualEntityList(Evt* script, s32 isInitialCall) {
if (!gGameStatusPtr->isBattle) {
D_802DB7C0 = &D_802DB6C0;
} else {
D_802DB7C0 = &D_802DB5C0;
}
return ApiStatus_DONE2;
}
ApiStatus CreateVirtualEntityAt(Evt* script, s32 isInitialCall) {
Bytecode* args = script->ptrReadPos;
s32 index = evt_get_variable(script, *args++);
u32* cmdList = (u32*)evt_get_variable(script, *args++);
VirtualEntity* virtualEntity = (*D_802DB7C0)[index];
virtualEntity->entityModelIndex = load_entity_model(cmdList);
virtualEntity->pos.x = 0.0f;
virtualEntity->pos.y = 0.0f;
virtualEntity->pos.z = 0.0f;
virtualEntity->rot.x = 0.0f;
virtualEntity->rot.y = 0.0f;
virtualEntity->rot.z = 0.0f;
virtualEntity->scale.x = 1.0f;
virtualEntity->scale.y = 1.0f;
virtualEntity->scale.z = 1.0f;
exec_entity_model_commandlist(virtualEntity->entityModelIndex);
return ApiStatus_DONE2;
}
ApiStatus CreateVirtualEntity(Evt* script, s32 isInitialCall) {
Bytecode* args = script->ptrReadPos;
s32 outVar = *args++;
s32* unkStructPtr = (s32*)evt_get_variable(script, *args++);
VirtualEntity* virtualEntity;
s32 i;
for (i = 0; i < ARRAY_COUNT(*D_802DB7C0); i++) {
virtualEntity = (*D_802DB7C0)[i];
if (virtualEntity->entityModelIndex < 0) {
break;
}
}
if (i >= ARRAY_COUNT(*D_802DB7C0)) {
return ApiStatus_DONE2;
}
virtualEntity->entityModelIndex = load_entity_model(unkStructPtr);
virtualEntity->pos.x = 0.0f;
virtualEntity->pos.y = 0.0f;
virtualEntity->pos.z = 0.0f;
virtualEntity->rot.x = 0.0f;
virtualEntity->rot.y = 0.0f;
virtualEntity->rot.z = 0.0f;
virtualEntity->scale.x = 1.0f;
virtualEntity->scale.y = 1.0f;
virtualEntity->scale.z = 1.0f;
exec_entity_model_commandlist(virtualEntity->entityModelIndex);
evt_set_variable(script, outVar, i);
return ApiStatus_DONE2;
}
ApiStatus CreateVirtualEntity_ALT(Evt* script, s32 isInitialCall) {
Bytecode* args = script->ptrReadPos;
s32 outVar = *args++;
s32* unkStructPtr = (s32*)evt_get_variable(script, *args++);
VirtualEntity* virtualEntity;
s32 i;
for (i = 0; i < ARRAY_COUNT(*D_802DB7C0); i++) {
virtualEntity = (*D_802DB7C0)[i];
if (virtualEntity->entityModelIndex < 0) {
break;
}
}
if (i >= ARRAY_COUNT(*D_802DB7C0)) {
return ApiStatus_DONE2;
}
virtualEntity->entityModelIndex = ALT_load_entity_model(unkStructPtr);
virtualEntity->pos.x = 0.0f;
virtualEntity->pos.y = 0.0f;
virtualEntity->pos.z = 0.0f;
virtualEntity->rot.x = 0.0f;
virtualEntity->rot.y = 0.0f;
virtualEntity->rot.z = 0.0f;
virtualEntity->scale.x = 1.0f;
virtualEntity->scale.y = 1.0f;
virtualEntity->scale.z = 1.0f;
exec_entity_model_commandlist(virtualEntity->entityModelIndex);
evt_set_variable(script, outVar, i);
return ApiStatus_DONE2;
}
ApiStatus DeleteVirtualEntity(Evt* script, s32 isInitialCall) {
VirtualEntity* virtualEntity = (*D_802DB7C0)[evt_get_variable(script, *script->ptrReadPos)];
free_entity_model_by_index(virtualEntity->entityModelIndex);
virtualEntity->entityModelIndex = -1;
return ApiStatus_DONE2;
}
ApiStatus SetVirtualEntityRenderCommands(Evt* script, s32 isInitialCall) {
Bytecode* args = script->ptrReadPos;
s32 index = evt_get_variable(script, *args++);
u32* commandList = (u32*)evt_get_variable(script, *args++);
set_entity_model_render_command_list((*D_802DB7C0)[index]->entityModelIndex, commandList);
return ApiStatus_DONE2;
}
ApiStatus SetVirtualEntityPosition(Evt* script, s32 isInitialCall) {
Bytecode* args = script->ptrReadPos;
s32 index = evt_get_variable(script, *args++);
f32 x = evt_get_float_variable(script, *args++);
f32 y = evt_get_float_variable(script, *args++);
f32 z = evt_get_float_variable(script, *args++);
VirtualEntity* virtualEntity = (*D_802DB7C0)[index];
virtualEntity->pos.x = x;
virtualEntity->pos.y = y;
virtualEntity->pos.z = z;
return ApiStatus_DONE2;
}
ApiStatus GetVirtualEntityPosition(Evt* script, s32 isInitialCall) {
Bytecode* args = script->ptrReadPos;
s32 index = evt_get_variable(script, *args++);
VirtualEntity* virtualEntity = (*D_802DB7C0)[index];
s32 outVar1 = *args++;
s32 outVar2 = *args++;
s32 outVar3 = *args++;
evt_set_variable(script, outVar1, virtualEntity->pos.x);
evt_set_variable(script, outVar2, virtualEntity->pos.y);
evt_set_variable(script, outVar3, virtualEntity->pos.z);
return ApiStatus_DONE2;
}
ApiStatus SetVirtualEntityRotation(Evt* script, s32 isInitialCall) {
Bytecode* args = script->ptrReadPos;
s32 index = evt_get_variable(script, *args++);
f32 x = evt_get_float_variable(script, *args++);
f32 y = evt_get_float_variable(script, *args++);
f32 z = evt_get_float_variable(script, *args++);
VirtualEntity* virtualEntity = (*D_802DB7C0)[index];
virtualEntity->rot.x = x;
virtualEntity->rot.y = y;
virtualEntity->rot.z = z;
return ApiStatus_DONE2;
}
ApiStatus SetVirtualEntityScale(Evt* script, s32 isInitialCall) {
Bytecode* args = script->ptrReadPos;
s32 index = evt_get_variable(script, *args++);
f32 x = evt_get_float_variable(script, *args++);
f32 y = evt_get_float_variable(script, *args++);
f32 z = evt_get_float_variable(script, *args++);
VirtualEntity* virtualEntity = (*D_802DB7C0)[index];
virtualEntity->scale.x = x;
virtualEntity->scale.y = y;
virtualEntity->scale.z = z;
return ApiStatus_DONE2;
}
ApiStatus SetVirtualEntityMoveSpeed(Evt* script, s32 isInitialCall) {
Bytecode* args = script->ptrReadPos;
s32 index = evt_get_variable(script, *args++);
(*D_802DB7C0)[index]->moveSpeed = evt_get_float_variable(script, *args++);
return ApiStatus_DONE2;
}
ApiStatus SetVirtualEntityJumpGravity(Evt* script, s32 isInitialCall) {
Bytecode* args = script->ptrReadPos;
s32 index = evt_get_variable(script, *args++);
(*D_802DB7C0)[index]->jumpGravity = evt_get_float_variable(script, *args++);
return ApiStatus_DONE2;
}
ApiStatus VirtualEntityMoveTo(Evt* script, s32 isInitialCall) {
Bytecode* args = script->ptrReadPos;
VirtualEntity* virtualEntity;
if (isInitialCall) {
script->functionTemp[0] = 0;
}
if (script->functionTemp[0] == 0) {
s32 index = evt_get_variable(script, *args++);
f32 xTemp = evt_get_variable(script, *args++);
f32 yTemp = evt_get_variable(script, *args++);
f32 zTemp = evt_get_variable(script, *args++);
s32 moveTime = evt_get_variable(script, *args++);
f32 goalPosX;
f32 goalPosZ;
virtualEntity = (*D_802DB7C0)[index];
script->functionTemp[1] = index;
virtualEntity->goalPos.x = xTemp;
virtualEntity->goalPos.y = yTemp;
virtualEntity->goalPos.z = zTemp;
xTemp = virtualEntity->pos.x;
zTemp = virtualEntity->pos.z;
goalPosX = virtualEntity->goalPos.x;
goalPosZ = virtualEntity->goalPos.z;
virtualEntity->moveTime = moveTime;
virtualEntity->moveAngle = atan2(xTemp, zTemp, goalPosX, goalPosZ);
virtualEntity->moveDist = dist2D(xTemp, zTemp, goalPosX, goalPosZ);
if (virtualEntity->moveTime == 0.0f) {
virtualEntity->moveTime = virtualEntity->moveDist / virtualEntity->moveSpeed;
} else {
virtualEntity->moveSpeed = virtualEntity->moveDist / virtualEntity->moveTime;
}
script->functionTemp[0] = 1;
}
virtualEntity = (*D_802DB7C0)[script->functionTemp[1]];
virtual_entity_move_polar(virtualEntity, virtualEntity->moveSpeed, virtualEntity->moveAngle);
virtualEntity->moveTime--;
if (virtualEntity->moveTime <= 0.0f) {
virtualEntity->pos.x = virtualEntity->goalPos.x;
virtualEntity->pos.z = virtualEntity->goalPos.z;
return ApiStatus_DONE1;
}
return ApiStatus_BLOCK;
}
ApiStatus VirtualEntityJumpTo(Evt* script, s32 isInitialCall) {
Bytecode* args = script->ptrReadPos;
VirtualEntity* virtualEntity;
s32 index;
f32 xTemp;
f32 yTemp;
f32 zTemp;
s32 moveTime;
f32 goalPosX;
f32 goalPosY;
f32 goalPosZ;
if (isInitialCall) {
script->functionTemp[0] = 0;
}
if (script->functionTemp[0] == 0) {
index = evt_get_variable(script, *args++);
xTemp = evt_get_variable(script, *args++);
yTemp = evt_get_variable(script, *args++);
zTemp = evt_get_variable(script, *args++);
moveTime = evt_get_variable(script, *args++);
virtualEntity = (*D_802DB7C0)[index];
script->functionTemp[1] = index;
virtualEntity->goalPos.x = xTemp;
virtualEntity->goalPos.y = yTemp;
virtualEntity->goalPos.z = zTemp;
xTemp = virtualEntity->pos.x;
yTemp = virtualEntity->pos.y;
zTemp = virtualEntity->pos.z;
goalPosX = virtualEntity->goalPos.x;
yTemp = virtualEntity->goalPos.y - yTemp;
goalPosZ = virtualEntity->goalPos.z;
virtualEntity->moveTime = moveTime;
virtualEntity->moveAngle = atan2(xTemp, zTemp, goalPosX, goalPosZ);
virtualEntity->moveDist = dist2D(xTemp, zTemp, goalPosX, goalPosZ);
if (virtualEntity->moveTime == 0.0f) {
virtualEntity->moveTime = virtualEntity->moveDist / virtualEntity->moveSpeed;
} else {
virtualEntity->moveSpeed = virtualEntity->moveDist / virtualEntity->moveTime;
}
virtualEntity->jumpVelocity = (virtualEntity->jumpGravity * virtualEntity->moveTime / 2) +
(yTemp / virtualEntity->moveTime);
script->functionTemp[0] = 1;
}
virtualEntity = (*D_802DB7C0)[script->functionTemp[1]];
virtualEntity->pos.y += virtualEntity->jumpVelocity;
virtualEntity->jumpVelocity -= virtualEntity->jumpGravity;
virtual_entity_move_polar(virtualEntity, virtualEntity->moveSpeed, virtualEntity->moveAngle);
virtualEntity->moveTime -= 1.0f;
if (virtualEntity->moveTime <= 0.0f) {
virtualEntity->pos.x = virtualEntity->goalPos.x;
virtualEntity->pos.y = virtualEntity->goalPos.y;
virtualEntity->pos.z = virtualEntity->goalPos.z;
return ApiStatus_DONE1;
}
return ApiStatus_BLOCK;
}
ApiStatus VirtualEntityLandJump(Evt* script, s32 isInitialCall) {
Bytecode* args = script->ptrReadPos;
VirtualEntity* virtualEntity;
if (isInitialCall) {
script->functionTemp[0] = 0;
}
if (script->functionTemp[0] == 0) {
script->functionTemp[1] = evt_get_variable(script, *args++);
script->functionTemp[0] = 1;
}
virtualEntity = (*D_802DB7C0)[script->functionTemp[1]];
virtualEntity->pos.y += virtualEntity->jumpVelocity;
virtualEntity->jumpVelocity -= virtualEntity->jumpGravity;
virtual_entity_move_polar(virtualEntity, virtualEntity->moveSpeed, virtualEntity->moveAngle);
if (virtualEntity->pos.y < 0.0f) {
virtualEntity->pos.y = 0.0f;
return ApiStatus_DONE1;
}
return ApiStatus_BLOCK;
}
ApiStatus SetVirtualEntityFlags(Evt* script, s32 isInitialCall) {
Bytecode* args = script->ptrReadPos;
s32 index = evt_get_variable(script, *args++);
s32 flags = *args++;
get_entity_model((*D_802DB7C0)[index]->entityModelIndex)->flags = flags;
return ApiStatus_DONE2;
}
ApiStatus SetVirtualEntityFlagBits(Evt* script, s32 isInitialCall) {
Bytecode* args = script->ptrReadPos;
s32 index = evt_get_variable(script, *args++);
s32 flags = *args++;
s32 cond = evt_get_variable(script, *args++);
VirtualEntity* virtualEntity = (*D_802DB7C0)[index];
if (cond) {
set_entity_model_flags(virtualEntity->entityModelIndex, flags);
} else {
clear_entity_model_flags(virtualEntity->entityModelIndex, flags);
}
return ApiStatus_DONE2;
}
ApiStatus SetVirtualEntityRenderMode(Evt* script, s32 isInitialCall) {
Bytecode* args = script->ptrReadPos;
s32 index = evt_get_variable(script, *args++);
s32 var2 = evt_get_variable(script, *args++);
EntityModel* entityModel = get_entity_model((*D_802DB7C0)[index]->entityModelIndex);
switch (var2) {
case -1:
entityModel->renderMode = 1;
break;
case 0:
entityModel->renderMode = 1;
evt_get_variable(script, *args++);
evt_get_variable(script, *args++);
evt_get_variable(script, *args++);
break;
case 2:
entityModel->renderMode = 0xD;
evt_get_variable(script, *args++);
evt_get_variable(script, *args++);
evt_get_variable(script, *args++);
break;
case 3:
entityModel->renderMode = 0x16;
evt_get_variable(script, *args++);
break;
case 4:
entityModel->renderMode = 0x16;
evt_get_variable(script, *args++);
evt_get_variable(script, *args++);
evt_get_variable(script, *args++);
evt_get_variable(script, *args++);
break;
}
return ApiStatus_DONE2;
}
VirtualEntity* virtual_entity_get_by_index(s32 index) {
return (*D_802DB7C0)[index];
}
VirtualEntity* virtual_entity_create_at_index(s32 index, s32* entityModelData) {
VirtualEntity* virtualEntity = (*D_802DB7C0)[index];
virtualEntity->entityModelIndex = load_entity_model(entityModelData);
virtualEntity->pos.x = 0.0f;
virtualEntity->pos.y = 0.0f;
virtualEntity->pos.z = 0.0f;
virtualEntity->rot.x = 0.0f;
virtualEntity->rot.y = 0.0f;
virtualEntity->rot.z = 0.0f;
virtualEntity->scale.x = 1.0f;
virtualEntity->scale.y = 1.0f;
virtualEntity->scale.z = 1.0f;
exec_entity_model_commandlist(virtualEntity->entityModelIndex);
return (*D_802DB7C0)[index];
}
s32 virtual_entity_create(s32* cmdList) {
s32 i;
VirtualEntity* virtualEntity;
for (i = 0; i < ARRAY_COUNT(*D_802DB7C0); i++) {
virtualEntity = (*D_802DB7C0)[i];
if (virtualEntity->entityModelIndex < 0) {
break;
}
}
if (i >= ARRAY_COUNT(*D_802DB7C0)) {
return 0;
}
virtualEntity->entityModelIndex = load_entity_model(cmdList);
virtualEntity->pos.x = 0.0f;
virtualEntity->pos.y = 0.0f;
virtualEntity->pos.z = 0.0f;
virtualEntity->rot.x = 0.0f;
virtualEntity->rot.y = 0.0f;
virtualEntity->rot.z = 0.0f;
virtualEntity->scale.x = 1.0f;
virtualEntity->scale.y = 1.0f;
virtualEntity->scale.z = 1.0f;
exec_entity_model_commandlist(virtualEntity->entityModelIndex);
return i;
}
VirtualEntity* ALT_virtual_entity_create(s32* cmdList) {
s32 i;
VirtualEntity* virtualEntity;
for (i = 0; i < ARRAY_COUNT(*D_802DB7C0); i++) {
virtualEntity = (*D_802DB7C0)[i];
if (virtualEntity->entityModelIndex < 0) {
break;
}
}
if (i >= ARRAY_COUNT(*D_802DB7C0)) {
return NULL;
}
virtualEntity->entityModelIndex = ALT_load_entity_model(cmdList);
virtualEntity->pos.x = 0.0f;
virtualEntity->pos.y = 0.0f;
virtualEntity->pos.z = 0.0f;
virtualEntity->rot.x = 0.0f;
virtualEntity->rot.y = 0.0f;
virtualEntity->rot.z = 0.0f;
virtualEntity->scale.x = 1.0f;
virtualEntity->scale.y = 1.0f;
virtualEntity->scale.z = 1.0f;
exec_entity_model_commandlist(virtualEntity->entityModelIndex);
return (*D_802DB7C0)[i];
}
void virtual_entity_set_pos(s32 index, s32 arg1, s32 arg2, s32 arg3) {
VirtualEntity* virtualEntity = (*D_802DB7C0)[index];
virtualEntity->pos.x = arg1;
virtualEntity->pos.y = arg2;
virtualEntity->pos.z = arg3;
}
void virtual_entity_set_scale(s32 index, f32 arg1, f32 arg2, f32 arg3) {
VirtualEntity* virtualEntity = (*D_802DB7C0)[index];
virtualEntity->scale.x = arg1;
virtualEntity->scale.y = arg2;
virtualEntity->scale.z = arg3;
}
void virtual_entity_set_rotation(s32 index, f32 arg1, f32 arg2, f32 arg3) {
VirtualEntity* virtualEntity = (*D_802DB7C0)[index];
virtualEntity->rot.x = arg1;
virtualEntity->rot.y = arg2;
virtualEntity->rot.z = arg3;
}
void virtual_entity_delete_by_index(s32 index) {
VirtualEntity* virtualEntity = (*D_802DB7C0)[index];
free_entity_model_by_index(virtualEntity->entityModelIndex);
virtualEntity->entityModelIndex = -1;
}
void virtual_entity_delete_by_ref(VirtualEntity* arg0) {
s32 i;
for (i = 0; i < ARRAY_COUNT(*D_802DB7C0); i++) {
if ((*D_802DB7C0)[i] == arg0) {
virtual_entity_delete_by_index(i);
return;
}
}
}
void clear_virtual_entity_list(void) {
s32 i;
if (!gGameStatusPtr->isBattle) {
D_802DB7C0 = &D_802DB6C0;
} else {
D_802DB7C0 = &D_802DB5C0;
}
for (i = 0; i < ARRAY_COUNT(*D_802DB7C0); i++) {
(*D_802DB7C0)[i] = heap_malloc(sizeof(VirtualEntity));
ASSERT((*D_802DB7C0)[i] != NULL);
(*D_802DB7C0)[i]->entityModelIndex = -1;
}
create_generic_entity_world(virtual_entity_list_update, virtual_entity_list_render_world);
create_generic_entity_backUI(NULL, virtual_entity_list_render_UI);
}
void init_virtual_entity_list(void) {
if (!gGameStatusPtr->isBattle) {
D_802DB7C0 = &D_802DB6C0;
} else {
D_802DB7C0 = &D_802DB5C0;
}
}

View File

@ -52,9 +52,9 @@ BSS s32 D_802DB26C; // unused?
BSS Npc playerNpcData; BSS Npc playerNpcData;
BSS u16 D_802DB5B0; BSS u16 D_802DB5B0;
BSS s32 D_802DB5B4[3]; // unused BSS s32 D_802DB5B4[3]; // unused
BSS VirtualEntityList D_802DB5C0; BSS VirtualEntityList bBattleVirtualEntityList;
BSS VirtualEntityList D_802DB6C0; BSS VirtualEntityList wWorldVirtualEntityList;
BSS VirtualEntityList* D_802DB7C0; BSS VirtualEntityList* gCurrentVirtualEntityListPtr;
BSS s32 D_802DB7C4[3]; // unused BSS s32 D_802DB7C4[3]; // unused
// fa4c0_len_3bf0 // fa4c0_len_3bf0

681
src/evt/virtual_entity.c Normal file
View File

@ -0,0 +1,681 @@
#include "common.h"
extern VirtualEntityList bBattleVirtualEntityList;
extern VirtualEntityList wWorldVirtualEntityList;
extern VirtualEntityList* gCurrentVirtualEntityListPtr;
void virtual_entity_list_render_world(void);
void virtual_entity_list_render_UI(void);
s32 ALT_load_entity_model(s32* cmdList);
s32 create_worker_backUI(void (*updateFunc)(void), void (*drawFunc)(void));
void virtual_entity_appendGfx_quad(u8 r, u8 g, u8 b, u8 a, u16 left, u16 top, u16 right, u16 bottom) {
gDPPipeSync(gMasterGfxPos++);
if (a == 0xFF) {
gDPSetCombineLERP(gMasterGfxPos++, 0, 0, 0, PRIMITIVE, 0, 0, 0, 1, 0, 0, 0, PRIMITIVE, 0, 0, 0, 1);
} else {
gDPSetRenderMode(gMasterGfxPos++, G_RM_XLU_SURF, G_RM_XLU_SURF2);
gDPSetCombineMode(gMasterGfxPos++, G_CC_PRIMITIVE, G_CC_PRIMITIVE);
}
gDPSetPrimColor(gMasterGfxPos++, 0, 0, r, g, b, a);
gDPFillRectangle(gMasterGfxPos++, left, top, right, bottom);
gDPPipeSync(gMasterGfxPos++);
gDPSetRenderMode(gMasterGfxPos++, G_RM_TEX_EDGE, G_RM_TEX_EDGE2);
gDPSetCombineMode(gMasterGfxPos++, G_CC_DECALRGBA, G_CC_DECALRGBA);
}
void virtual_entity_render_quad(s32 r, s32 g, s32 b, s32 a, s32 posX, s32 posY, s32 width, s32 height) {
u16 endX = posX + width;
u16 endY = posY + height;
virtual_entity_appendGfx_quad(r, g, b, a, posX, posY, endX, endY);
}
void virtual_entity_move_polar(VirtualEntity* virtualEntity, f32 magnitude, f32 angle) {
f32 theta = DEG_TO_RAD(angle);
f32 sinTheta = sin_rad(theta);
f32 cosTheta = cos_rad(theta);
virtualEntity->pos.x += magnitude * sinTheta;
virtualEntity->pos.z += -magnitude * cosTheta;
}
void virtual_entity_list_update(void) {
s32 i;
for (i = 0; i < ARRAY_COUNT(*gCurrentVirtualEntityListPtr); i++) {
VirtualEntity* virtualEntity = (*gCurrentVirtualEntityListPtr)[i];
if (virtualEntity != NULL && virtualEntity->entityModelIndex >= 0) {
exec_entity_model_commandlist(virtualEntity->entityModelIndex);
}
}
}
void virtual_entity_list_render_world(void) {
Matrix4f translation;
Matrix4f xRot;
Matrix4f yRot;
Matrix4f zRot;
Matrix4f rotation;
Matrix4f temp;
Matrix4f transform;
Matrix4f scale;
Mtx transformMtxL;
VirtualEntity* virtualEntity;
s32 i;
for (i = 0; i < ARRAY_COUNT(*gCurrentVirtualEntityListPtr); i++) {
virtualEntity = (*gCurrentVirtualEntityListPtr)[i];
if (virtualEntity != NULL) {
if (!(virtualEntity->entityModelIndex < 0 || get_entity_model(virtualEntity->entityModelIndex)->flags & ENTITY_MODEL_FLAGS_CAM3)) {
guTranslateF(translation, virtualEntity->pos.x, virtualEntity->pos.y, virtualEntity->pos.z);
guRotateF(xRot, virtualEntity->rot.x, 1.0f, 0.0f, 0.0f);
guRotateF(yRot, virtualEntity->rot.y, 0.0f, 1.0f, 0.0f);
guRotateF(zRot, virtualEntity->rot.z, 0.0f, 0.0f, 1.0f);
guScaleF(scale, virtualEntity->scale.x, virtualEntity->scale.y, virtualEntity->scale.z);
guMtxCatF(zRot, xRot, temp);
guMtxCatF(temp, yRot, rotation);
guMtxCatF(scale, rotation, temp);
guMtxCatF(temp, translation, transform);
guMtxF2L(transform, &transformMtxL);
draw_entity_model_A(virtualEntity->entityModelIndex, &transformMtxL);
}
}
}
}
void virtual_entity_list_render_UI(void) {
Matrix4f translation;
Matrix4f xRot;
Matrix4f yRot;
Matrix4f zRot;
Matrix4f rotation;
Matrix4f temp;
Matrix4f transform;
Matrix4f scale;
Mtx transformMtxL;
VirtualEntity* virtualEntity;
s32 i;
for (i = 0; i < ARRAY_COUNT(*gCurrentVirtualEntityListPtr); i++) {
virtualEntity = (*gCurrentVirtualEntityListPtr)[i];
if (virtualEntity != NULL) {
if (!(virtualEntity->entityModelIndex < 0 || !(get_entity_model(virtualEntity->entityModelIndex)->flags & ENTITY_MODEL_FLAGS_CAM3))) {
guTranslateF(translation, virtualEntity->pos.x, virtualEntity->pos.y, virtualEntity->pos.z);
guRotateF(xRot, virtualEntity->rot.x, 1.0f, 0.0f, 0.0f);
guRotateF(yRot, virtualEntity->rot.y, 0.0f, 1.0f, 0.0f);
guRotateF(zRot, virtualEntity->rot.z, 0.0f, 0.0f, 1.0f);
guScaleF(scale, virtualEntity->scale.x, virtualEntity->scale.y, virtualEntity->scale.z);
guMtxCatF(zRot, xRot, temp);
guMtxCatF(temp, yRot, rotation);
guMtxCatF(scale, rotation, temp);
guMtxCatF(temp, translation, transform);
guMtxF2L(transform, &transformMtxL);
draw_entity_model_E(virtualEntity->entityModelIndex, &transformMtxL);
}
}
}
}
ApiStatus InitVirtualEntityList(Evt* script, s32 isInitialCall) {
if (!gGameStatusPtr->isBattle) {
gCurrentVirtualEntityListPtr = &wWorldVirtualEntityList;
} else {
gCurrentVirtualEntityListPtr = &bBattleVirtualEntityList;
}
return ApiStatus_DONE2;
}
ApiStatus CreateVirtualEntityAt(Evt* script, s32 isInitialCall) {
Bytecode* args = script->ptrReadPos;
s32 index = evt_get_variable(script, *args++);
u32* cmdList = (u32*) evt_get_variable(script, *args++);
VirtualEntity* virtualEntity = (*gCurrentVirtualEntityListPtr)[index];
virtualEntity->entityModelIndex = load_entity_model(cmdList);
virtualEntity->pos.x = 0.0f;
virtualEntity->pos.y = 0.0f;
virtualEntity->pos.z = 0.0f;
virtualEntity->rot.x = 0.0f;
virtualEntity->rot.y = 0.0f;
virtualEntity->rot.z = 0.0f;
virtualEntity->scale.x = 1.0f;
virtualEntity->scale.y = 1.0f;
virtualEntity->scale.z = 1.0f;
exec_entity_model_commandlist(virtualEntity->entityModelIndex);
return ApiStatus_DONE2;
}
ApiStatus CreateVirtualEntity(Evt* script, s32 isInitialCall) {
Bytecode* args = script->ptrReadPos;
s32 outVar = *args++;
s32* unkStructPtr = (s32*)evt_get_variable(script, *args++);
VirtualEntity* virtualEntity;
s32 i;
for (i = 0; i < ARRAY_COUNT(*gCurrentVirtualEntityListPtr); i++) {
virtualEntity = (*gCurrentVirtualEntityListPtr)[i];
if (virtualEntity->entityModelIndex < 0) {
break;
}
}
if (i >= ARRAY_COUNT(*gCurrentVirtualEntityListPtr)) {
return ApiStatus_DONE2;
}
virtualEntity->entityModelIndex = load_entity_model(unkStructPtr);
virtualEntity->pos.x = 0.0f;
virtualEntity->pos.y = 0.0f;
virtualEntity->pos.z = 0.0f;
virtualEntity->rot.x = 0.0f;
virtualEntity->rot.y = 0.0f;
virtualEntity->rot.z = 0.0f;
virtualEntity->scale.x = 1.0f;
virtualEntity->scale.y = 1.0f;
virtualEntity->scale.z = 1.0f;
exec_entity_model_commandlist(virtualEntity->entityModelIndex);
evt_set_variable(script, outVar, i);
return ApiStatus_DONE2;
}
ApiStatus CreateVirtualEntity_ALT(Evt* script, s32 isInitialCall) {
Bytecode* args = script->ptrReadPos;
s32 outVar = *args++;
s32* unkStructPtr = (s32*) evt_get_variable(script, *args++);
VirtualEntity* virtualEntity;
s32 i;
for (i = 0; i < ARRAY_COUNT(*gCurrentVirtualEntityListPtr); i++) {
virtualEntity = (*gCurrentVirtualEntityListPtr)[i];
if (virtualEntity->entityModelIndex < 0) {
break;
}
}
if (i >= ARRAY_COUNT(*gCurrentVirtualEntityListPtr)) {
return ApiStatus_DONE2;
}
virtualEntity->entityModelIndex = ALT_load_entity_model(unkStructPtr);
virtualEntity->pos.x = 0.0f;
virtualEntity->pos.y = 0.0f;
virtualEntity->pos.z = 0.0f;
virtualEntity->rot.x = 0.0f;
virtualEntity->rot.y = 0.0f;
virtualEntity->rot.z = 0.0f;
virtualEntity->scale.x = 1.0f;
virtualEntity->scale.y = 1.0f;
virtualEntity->scale.z = 1.0f;
exec_entity_model_commandlist(virtualEntity->entityModelIndex);
evt_set_variable(script, outVar, i);
return ApiStatus_DONE2;
}
ApiStatus DeleteVirtualEntity(Evt* script, s32 isInitialCall) {
VirtualEntity* virtualEntity = (*gCurrentVirtualEntityListPtr)[evt_get_variable(script, *script->ptrReadPos)];
free_entity_model_by_index(virtualEntity->entityModelIndex);
virtualEntity->entityModelIndex = -1;
return ApiStatus_DONE2;
}
ApiStatus SetVirtualEntityRenderCommands(Evt* script, s32 isInitialCall) {
Bytecode* args = script->ptrReadPos;
s32 index = evt_get_variable(script, *args++);
u32* commandList = (u32*) evt_get_variable(script, *args++);
set_entity_model_render_command_list((*gCurrentVirtualEntityListPtr)[index]->entityModelIndex, commandList);
return ApiStatus_DONE2;
}
ApiStatus SetVirtualEntityPosition(Evt* script, s32 isInitialCall) {
Bytecode* args = script->ptrReadPos;
s32 index = evt_get_variable(script, *args++);
f32 x = evt_get_float_variable(script, *args++);
f32 y = evt_get_float_variable(script, *args++);
f32 z = evt_get_float_variable(script, *args++);
VirtualEntity* virtualEntity = (*gCurrentVirtualEntityListPtr)[index];
virtualEntity->pos.x = x;
virtualEntity->pos.y = y;
virtualEntity->pos.z = z;
return ApiStatus_DONE2;
}
ApiStatus GetVirtualEntityPosition(Evt* script, s32 isInitialCall) {
Bytecode* args = script->ptrReadPos;
s32 index = evt_get_variable(script, *args++);
VirtualEntity* virtualEntity = (*gCurrentVirtualEntityListPtr)[index];
s32 outVar1 = *args++;
s32 outVar2 = *args++;
s32 outVar3 = *args++;
evt_set_variable(script, outVar1, virtualEntity->pos.x);
evt_set_variable(script, outVar2, virtualEntity->pos.y);
evt_set_variable(script, outVar3, virtualEntity->pos.z);
return ApiStatus_DONE2;
}
ApiStatus SetVirtualEntityRotation(Evt* script, s32 isInitialCall) {
Bytecode* args = script->ptrReadPos;
s32 index = evt_get_variable(script, *args++);
f32 x = evt_get_float_variable(script, *args++);
f32 y = evt_get_float_variable(script, *args++);
f32 z = evt_get_float_variable(script, *args++);
VirtualEntity* virtualEntity = (*gCurrentVirtualEntityListPtr)[index];
virtualEntity->rot.x = x;
virtualEntity->rot.y = y;
virtualEntity->rot.z = z;
return ApiStatus_DONE2;
}
ApiStatus SetVirtualEntityScale(Evt* script, s32 isInitialCall) {
Bytecode* args = script->ptrReadPos;
s32 index = evt_get_variable(script, *args++);
f32 x = evt_get_float_variable(script, *args++);
f32 y = evt_get_float_variable(script, *args++);
f32 z = evt_get_float_variable(script, *args++);
VirtualEntity* virtualEntity = (*gCurrentVirtualEntityListPtr)[index];
virtualEntity->scale.x = x;
virtualEntity->scale.y = y;
virtualEntity->scale.z = z;
return ApiStatus_DONE2;
}
ApiStatus SetVirtualEntityMoveSpeed(Evt* script, s32 isInitialCall) {
Bytecode* args = script->ptrReadPos;
s32 index = evt_get_variable(script, *args++);
(*gCurrentVirtualEntityListPtr)[index]->moveSpeed = evt_get_float_variable(script, *args++);
return ApiStatus_DONE2;
}
ApiStatus SetVirtualEntityJumpGravity(Evt* script, s32 isInitialCall) {
Bytecode* args = script->ptrReadPos;
s32 index = evt_get_variable(script, *args++);
(*gCurrentVirtualEntityListPtr)[index]->jumpGravity = evt_get_float_variable(script, *args++);
return ApiStatus_DONE2;
}
ApiStatus VirtualEntityMoveTo(Evt* script, s32 isInitialCall) {
Bytecode* args = script->ptrReadPos;
VirtualEntity* virtualEntity;
if (isInitialCall) {
script->functionTemp[0] = 0;
}
if (script->functionTemp[0] == 0) {
s32 index = evt_get_variable(script, *args++);
f32 xTemp = evt_get_variable(script, *args++);
f32 yTemp = evt_get_variable(script, *args++);
f32 zTemp = evt_get_variable(script, *args++);
s32 moveTime = evt_get_variable(script, *args++);
f32 goalPosX;
f32 goalPosZ;
virtualEntity = (*gCurrentVirtualEntityListPtr)[index];
script->functionTemp[1] = index;
virtualEntity->goalPos.x = xTemp;
virtualEntity->goalPos.y = yTemp;
virtualEntity->goalPos.z = zTemp;
xTemp = virtualEntity->pos.x;
zTemp = virtualEntity->pos.z;
goalPosX = virtualEntity->goalPos.x;
goalPosZ = virtualEntity->goalPos.z;
virtualEntity->moveTime = moveTime;
virtualEntity->moveAngle = atan2(xTemp, zTemp, goalPosX, goalPosZ);
virtualEntity->moveDist = dist2D(xTemp, zTemp, goalPosX, goalPosZ);
if (virtualEntity->moveTime == 0.0f) {
virtualEntity->moveTime = virtualEntity->moveDist / virtualEntity->moveSpeed;
} else {
virtualEntity->moveSpeed = virtualEntity->moveDist / virtualEntity->moveTime;
}
script->functionTemp[0] = 1;
}
virtualEntity = (*gCurrentVirtualEntityListPtr)[script->functionTemp[1]];
virtual_entity_move_polar(virtualEntity, virtualEntity->moveSpeed, virtualEntity->moveAngle);
virtualEntity->moveTime--;
if (virtualEntity->moveTime <= 0.0f) {
virtualEntity->pos.x = virtualEntity->goalPos.x;
virtualEntity->pos.z = virtualEntity->goalPos.z;
return ApiStatus_DONE1;
}
return ApiStatus_BLOCK;
}
ApiStatus VirtualEntityJumpTo(Evt* script, s32 isInitialCall) {
Bytecode* args = script->ptrReadPos;
VirtualEntity* virtualEntity;
s32 index;
f32 xTemp;
f32 yTemp;
f32 zTemp;
s32 moveTime;
f32 goalPosX;
f32 goalPosY;
f32 goalPosZ;
if (isInitialCall) {
script->functionTemp[0] = 0;
}
if (script->functionTemp[0] == 0) {
index = evt_get_variable(script, *args++);
xTemp = evt_get_variable(script, *args++);
yTemp = evt_get_variable(script, *args++);
zTemp = evt_get_variable(script, *args++);
moveTime = evt_get_variable(script, *args++);
virtualEntity = (*gCurrentVirtualEntityListPtr)[index];
script->functionTemp[1] = index;
virtualEntity->goalPos.x = xTemp;
virtualEntity->goalPos.y = yTemp;
virtualEntity->goalPos.z = zTemp;
xTemp = virtualEntity->pos.x;
yTemp = virtualEntity->pos.y;
zTemp = virtualEntity->pos.z;
goalPosX = virtualEntity->goalPos.x;
yTemp = virtualEntity->goalPos.y - yTemp;
goalPosZ = virtualEntity->goalPos.z;
virtualEntity->moveTime = moveTime;
virtualEntity->moveAngle = atan2(xTemp, zTemp, goalPosX, goalPosZ);
virtualEntity->moveDist = dist2D(xTemp, zTemp, goalPosX, goalPosZ);
if (virtualEntity->moveTime == 0.0f) {
virtualEntity->moveTime = virtualEntity->moveDist / virtualEntity->moveSpeed;
} else {
virtualEntity->moveSpeed = virtualEntity->moveDist / virtualEntity->moveTime;
}
virtualEntity->jumpVelocity = (virtualEntity->jumpGravity * virtualEntity->moveTime / 2) +
(yTemp / virtualEntity->moveTime);
script->functionTemp[0] = 1;
}
virtualEntity = (*gCurrentVirtualEntityListPtr)[script->functionTemp[1]];
virtualEntity->pos.y += virtualEntity->jumpVelocity;
virtualEntity->jumpVelocity -= virtualEntity->jumpGravity;
virtual_entity_move_polar(virtualEntity, virtualEntity->moveSpeed, virtualEntity->moveAngle);
virtualEntity->moveTime -= 1.0f;
if (virtualEntity->moveTime <= 0.0f) {
virtualEntity->pos.x = virtualEntity->goalPos.x;
virtualEntity->pos.y = virtualEntity->goalPos.y;
virtualEntity->pos.z = virtualEntity->goalPos.z;
return ApiStatus_DONE1;
}
return ApiStatus_BLOCK;
}
ApiStatus VirtualEntityLandJump(Evt* script, s32 isInitialCall) {
Bytecode* args = script->ptrReadPos;
VirtualEntity* virtualEntity;
if (isInitialCall) {
script->functionTemp[0] = 0;
}
if (script->functionTemp[0] == 0) {
script->functionTemp[1] = evt_get_variable(script, *args++);
script->functionTemp[0] = 1;
}
virtualEntity = (*gCurrentVirtualEntityListPtr)[script->functionTemp[1]];
virtualEntity->pos.y += virtualEntity->jumpVelocity;
virtualEntity->jumpVelocity -= virtualEntity->jumpGravity;
virtual_entity_move_polar(virtualEntity, virtualEntity->moveSpeed, virtualEntity->moveAngle);
if (virtualEntity->pos.y < 0.0f) {
virtualEntity->pos.y = 0.0f;
return ApiStatus_DONE1;
}
return ApiStatus_BLOCK;
}
ApiStatus SetVirtualEntityFlags(Evt* script, s32 isInitialCall) {
Bytecode* args = script->ptrReadPos;
s32 index = evt_get_variable(script, *args++);
s32 flags = *args++;
VirtualEntity* virtualEntity = (*gCurrentVirtualEntityListPtr)[index];
get_entity_model(virtualEntity->entityModelIndex)->flags = flags;
return ApiStatus_DONE2;
}
ApiStatus SetVirtualEntityFlagBits(Evt* script, s32 isInitialCall) {
Bytecode* args = script->ptrReadPos;
s32 index = evt_get_variable(script, *args++);
s32 flags = *args++;
s32 mode = evt_get_variable(script, *args++);
VirtualEntity* virtualEntity = (*gCurrentVirtualEntityListPtr)[index];
if (mode) {
set_entity_model_flags(virtualEntity->entityModelIndex, flags);
} else {
clear_entity_model_flags(virtualEntity->entityModelIndex, flags);
}
return ApiStatus_DONE2;
}
ApiStatus SetVirtualEntityRenderMode(Evt* script, s32 isInitialCall) {
Bytecode* args = script->ptrReadPos;
s32 index = evt_get_variable(script, *args++);
s32 mode = evt_get_variable(script, *args++);
VirtualEntity* virtualEntity = (*gCurrentVirtualEntityListPtr)[index];
EntityModel* entityModel = get_entity_model(virtualEntity->entityModelIndex);
switch (mode) {
case -1:
entityModel->renderMode = RENDER_MODE_SURFACE_OPA;
break;
case 0:
entityModel->renderMode = RENDER_MODE_SURFACE_OPA;
evt_get_variable(script, *args++);
evt_get_variable(script, *args++);
evt_get_variable(script, *args++);
break;
case 2:
entityModel->renderMode = RENDER_MODE_ALPHATEST;
evt_get_variable(script, *args++);
evt_get_variable(script, *args++);
evt_get_variable(script, *args++);
break;
case 3:
entityModel->renderMode = RENDER_MODE_SURFACE_XLU_LAYER2;
evt_get_variable(script, *args++);
break;
case 4:
entityModel->renderMode = RENDER_MODE_SURFACE_XLU_LAYER2;
evt_get_variable(script, *args++);
evt_get_variable(script, *args++);
evt_get_variable(script, *args++);
evt_get_variable(script, *args++);
break;
}
return ApiStatus_DONE2;
}
VirtualEntity* virtual_entity_get_by_index(s32 index) {
return (*gCurrentVirtualEntityListPtr)[index];
}
VirtualEntity* virtual_entity_create_at_index(s32 index, s32* entityModelData) {
VirtualEntity* virtualEntity = (*gCurrentVirtualEntityListPtr)[index];
virtualEntity->entityModelIndex = load_entity_model(entityModelData);
virtualEntity->pos.x = 0.0f;
virtualEntity->pos.y = 0.0f;
virtualEntity->pos.z = 0.0f;
virtualEntity->rot.x = 0.0f;
virtualEntity->rot.y = 0.0f;
virtualEntity->rot.z = 0.0f;
virtualEntity->scale.x = 1.0f;
virtualEntity->scale.y = 1.0f;
virtualEntity->scale.z = 1.0f;
exec_entity_model_commandlist(virtualEntity->entityModelIndex);
return (*gCurrentVirtualEntityListPtr)[index];
}
s32 virtual_entity_create(s32* cmdList) {
s32 i;
VirtualEntity* virtualEntity;
for (i = 0; i < ARRAY_COUNT(*gCurrentVirtualEntityListPtr); i++) {
virtualEntity = (*gCurrentVirtualEntityListPtr)[i];
if (virtualEntity->entityModelIndex < 0) {
break;
}
}
if (i >= ARRAY_COUNT(*gCurrentVirtualEntityListPtr)) {
return 0;
}
virtualEntity->entityModelIndex = load_entity_model(cmdList);
virtualEntity->pos.x = 0.0f;
virtualEntity->pos.y = 0.0f;
virtualEntity->pos.z = 0.0f;
virtualEntity->rot.x = 0.0f;
virtualEntity->rot.y = 0.0f;
virtualEntity->rot.z = 0.0f;
virtualEntity->scale.x = 1.0f;
virtualEntity->scale.y = 1.0f;
virtualEntity->scale.z = 1.0f;
exec_entity_model_commandlist(virtualEntity->entityModelIndex);
return i;
}
VirtualEntity* ALT_virtual_entity_create(s32* cmdList) {
s32 i;
VirtualEntity* virtualEntity;
for (i = 0; i < ARRAY_COUNT(*gCurrentVirtualEntityListPtr); i++) {
virtualEntity = (*gCurrentVirtualEntityListPtr)[i];
if (virtualEntity->entityModelIndex < 0) {
break;
}
}
if (i >= ARRAY_COUNT(*gCurrentVirtualEntityListPtr)) {
return NULL;
}
virtualEntity->entityModelIndex = ALT_load_entity_model(cmdList);
virtualEntity->pos.x = 0.0f;
virtualEntity->pos.y = 0.0f;
virtualEntity->pos.z = 0.0f;
virtualEntity->rot.x = 0.0f;
virtualEntity->rot.y = 0.0f;
virtualEntity->rot.z = 0.0f;
virtualEntity->scale.x = 1.0f;
virtualEntity->scale.y = 1.0f;
virtualEntity->scale.z = 1.0f;
exec_entity_model_commandlist(virtualEntity->entityModelIndex);
return (*gCurrentVirtualEntityListPtr)[i];
}
void virtual_entity_set_pos(s32 index, s32 posX, s32 posY, s32 posZ) {
VirtualEntity* virtualEntity = (*gCurrentVirtualEntityListPtr)[index];
virtualEntity->pos.x = posX;
virtualEntity->pos.y = posY;
virtualEntity->pos.z = posZ;
}
void virtual_entity_set_scale(s32 index, f32 scaleX, f32 scaleY, f32 scaleZ) {
VirtualEntity* virtualEntity = (*gCurrentVirtualEntityListPtr)[index];
virtualEntity->scale.x = scaleX;
virtualEntity->scale.y = scaleY;
virtualEntity->scale.z = scaleZ;
}
void virtual_entity_set_rotation(s32 index, f32 angleX, f32 angleY, f32 angleZ) {
VirtualEntity* virtualEntity = (*gCurrentVirtualEntityListPtr)[index];
virtualEntity->rot.x = angleX;
virtualEntity->rot.y = angleY;
virtualEntity->rot.z = angleZ;
}
void virtual_entity_delete_by_index(s32 index) {
VirtualEntity* virtualEntity = (*gCurrentVirtualEntityListPtr)[index];
free_entity_model_by_index(virtualEntity->entityModelIndex);
virtualEntity->entityModelIndex = -1;
}
void virtual_entity_delete_by_ref(VirtualEntity* obj) {
s32 i;
for (i = 0; i < ARRAY_COUNT(*gCurrentVirtualEntityListPtr); i++) {
if ((*gCurrentVirtualEntityListPtr)[i] == obj) {
virtual_entity_delete_by_index(i);
return;
}
}
}
void clear_virtual_entity_list(void) {
s32 i;
if (!gGameStatusPtr->isBattle) {
gCurrentVirtualEntityListPtr = &wWorldVirtualEntityList;
} else {
gCurrentVirtualEntityListPtr = &bBattleVirtualEntityList;
}
for (i = 0; i < ARRAY_COUNT(*gCurrentVirtualEntityListPtr); i++) {
(*gCurrentVirtualEntityListPtr)[i] = heap_malloc(sizeof(VirtualEntity));
ASSERT((*gCurrentVirtualEntityListPtr)[i] != NULL);
(*gCurrentVirtualEntityListPtr)[i]->entityModelIndex = -1;
}
create_worker_world(virtual_entity_list_update, virtual_entity_list_render_world);
create_worker_backUI(NULL, virtual_entity_list_render_UI);
}
void init_virtual_entity_list(void) {
if (!gGameStatusPtr->isBattle) {
gCurrentVirtualEntityListPtr = &wWorldVirtualEntityList;
} else {
gCurrentVirtualEntityListPtr = &bBattleVirtualEntityList;
}
}

View File

@ -81,7 +81,7 @@ void step_game_loop(void) {
func_8011BAE8(); func_8011BAE8();
npc_iter_no_op(); npc_iter_no_op();
update_generic_entities(); update_workers();
update_triggers(); update_triggers();
update_scripts(); update_scripts();
update_messages(); update_messages();
@ -191,7 +191,7 @@ void gfx_draw_frame(void) {
player_render_interact_prompts(); player_render_interact_prompts();
func_802C3EE4(); func_802C3EE4();
render_screen_overlay_backUI(); render_screen_overlay_backUI();
render_generic_entities_backUI(); render_workers_backUI();
render_hud_elements_backUI(); render_hud_elements_backUI();
render_effects_UI(); render_effects_UI();
state_render_backUI(); state_render_backUI();
@ -208,7 +208,7 @@ void gfx_draw_frame(void) {
render_messages(); render_messages();
} }
render_generic_entities_frontUI(); render_workers_frontUI();
render_hud_elements_frontUI(); render_hud_elements_frontUI();
render_screen_overlay_frontUI(); render_screen_overlay_frontUI();
@ -275,11 +275,11 @@ void load_engine_data(void) {
func_80028838(); func_80028838();
general_heap_create(); general_heap_create();
clear_render_tasks(); clear_render_tasks();
clear_generic_entity_list(); clear_worker_list();
clear_script_list(); clear_script_list();
create_cameras_a(); create_cameras_a();
clear_player_status(); clear_player_status();
spr_init_sprites(0); spr_init_sprites(PLAYER_SPRITES_MARIO_WORLD);
clear_entity_models(); clear_entity_models();
clear_animator_list(); clear_animator_list();
clear_model_data(); clear_model_data();

View File

@ -2254,7 +2254,7 @@ void init_encounter_status(void) {
func_80045AC0(); func_80045AC0();
gEncounterState = ENCOUNTER_STATE_NONE; gEncounterState = ENCOUNTER_STATE_NONE;
create_generic_entity_world(0, npc_dyn_entity_draw_no_op); create_worker_world(NULL, npc_render_worker_do_nothing);
} }
void clear_encounter_status(void) { void clear_encounter_status(void) {
@ -2293,7 +2293,7 @@ void clear_encounter_status(void) {
func_80045AC0(); func_80045AC0();
gEncounterState = ENCOUNTER_STATE_NONE; gEncounterState = ENCOUNTER_STATE_NONE;
create_generic_entity_world(NULL, npc_dyn_entity_draw_no_op); create_worker_world(NULL, npc_render_worker_do_nothing);
} }
void func_8003E50C(void) { void func_8003E50C(void) {
@ -2361,7 +2361,7 @@ void draw_first_strike_ui(void) {
} }
} }
void npc_dyn_entity_draw_no_op(void) { void npc_render_worker_do_nothing(void) {
} }
void make_npcs(s32 flags, s32 mapID, s32* npcGroupList) { void make_npcs(s32 flags, s32 mapID, s32* npcGroupList) {

View File

@ -87,17 +87,40 @@ Gfx D_802DF490[] = {
f32 spr_animUpdateTimeScale = 1.0f; f32 spr_animUpdateTimeScale = 1.0f;
#define MARIO_SPRITE_COMMON_BITS \
1 << SPR_Mario_1 \
| 1 << SPR_Mario_2 \
#define MARIO_SPRITE_WORLD_BITS \
MARIO_SPRITE_COMMON_BITS \
| 1 << SPR_Mario_6 \
| 1 << SPR_Mario_7 \
| 1 << SPR_Mario_8 \
| 1 << SPR_Mario_9
#define MARIO_SPRITE_BATTLE_BITS \
MARIO_SPRITE_COMMON_BITS \
| 1 << SPR_Mario_3 \
| 1 << SPR_Mario_4 \
| 1 << SPR_Mario_5
#define PEACH_SPRITE_BITS \
1 << SPR_Peach_A \
| 1 << SPR_Peach_B \
| 1 << SPR_Peach_C \
| 1 << SPR_Peach_D \
// TODO(player raster splat header generation): // TODO(player raster splat header generation):
// - macroify rasterSize based on the biggest raster // - macroify rasterSize based on the biggest raster
// - OR values of a generated player raster name enum together for initiallyLoaded bits // - OR values of a generated player raster name enum together for initiallyLoaded bits
PlayerSpriteSet spr_playerSpriteSets[] = { PlayerSpriteSet spr_playerSpriteSets[] = {
/* Mario */ { 6, 0x700, 0x000003C6 }, [PLAYER_SPRITES_MARIO_WORLD] { 6, 0x700, MARIO_SPRITE_WORLD_BITS },
/* Mario */ { 18, 0x700, 0x000003C6 }, [PLAYER_SPRITES_MARIO_REFLECT_FLOOR] { 18, 0x700, MARIO_SPRITE_WORLD_BITS },
/* Mario */ { 10, 0x900, 0x00003FC6 }, [PLAYER_SPRITES_COMBINED_EPILOGUE] { 10, 0x900, MARIO_SPRITE_WORLD_BITS | PEACH_SPRITE_BITS },
/* Mario */ { 3, 0x700, 0x00000006 }, [PLAYER_SPRITES_MARIO_PARADE] { 3, 0x700, MARIO_SPRITE_COMMON_BITS },
/* Peach */ { 6, 0x900, 0x00003C00 }, [PLAYER_SPRITES_PEACH_WORLD] { 6, 0x900, PEACH_SPRITE_BITS },
/* Peach */ { 6, 0x700, 0x0000003E }, [PLAYER_SPRITES_MARIO_BATTLE] { 6, 0x700, MARIO_SPRITE_BATTLE_BITS },
/* Peach */ { 6, 0x900, 0x00003C00 }, [PLAYER_SPRITES_PEACH_BATTLE] { 6, 0x900, PEACH_SPRITE_BITS},
}; };
void spr_init_quad_cache(void) { void spr_init_quad_cache(void) {
@ -759,7 +782,7 @@ void spr_init_sprites(s32 playerSpriteSet) {
spr_playerMaxComponents = 0; spr_playerMaxComponents = 0;
if (gGameStatusPtr->peachFlags & PEACH_STATUS_FLAG_IS_PEACH) { if (gGameStatusPtr->peachFlags & PEACH_STATUS_FLAG_IS_PEACH) {
playerSpriteSet = 4; playerSpriteSet = PLAYER_SPRITES_PEACH_WORLD;
} }
loadedFlags = (&spr_playerSpriteSets[playerSpriteSet])->initiallyLoaded; loadedFlags = (&spr_playerSpriteSets[playerSpriteSet])->initiallyLoaded;

View File

@ -24,7 +24,7 @@ void state_init_battle(void) {
void state_step_battle(void) { void state_step_battle(void) {
u32 currentBattleSelection; u32 currentBattleSelection;
u32 temp; u32 currentBattleIndex;
if (D_800A0900 == 5) { if (D_800A0900 == 5) {
if (nuGfxCfb[1] != nuGfxCfb_ptr) { if (nuGfxCfb[1] != nuGfxCfb_ptr) {
@ -51,14 +51,15 @@ void state_step_battle(void) {
func_802B20B4(); func_802B20B4();
sfx_clear_env_sounds(0); sfx_clear_env_sounds(0);
currentBattleSelection = gCurrentBattleSection; currentBattleSelection = UNPACK_BTL_AREA(gCurrentBattleID);
temp = D_800DC4EB; currentBattleIndex = UNPACK_BTL_INDEX(gCurrentBattleID);
if (gGameStatusPtr->peachFlags & PEACH_STATUS_FLAG_IS_PEACH || (currentBattleSelection == BTL_AREA_KKJ && temp == 0)) { if (gGameStatusPtr->peachFlags & PEACH_STATUS_FLAG_IS_PEACH ||
(currentBattleSelection == BTL_AREA_KKJ && currentBattleIndex == 0)) {
gGameStatusPtr->peachFlags |= PEACH_STATUS_FLAG_IS_PEACH; gGameStatusPtr->peachFlags |= PEACH_STATUS_FLAG_IS_PEACH;
spr_init_sprites(6); spr_init_sprites(PLAYER_SPRITES_PEACH_BATTLE);
} else { } else {
spr_init_sprites(5); spr_init_sprites(PLAYER_SPRITES_MARIO_BATTLE);
} }
clear_model_data(); clear_model_data();
@ -66,7 +67,7 @@ void state_step_battle(void) {
reset_background_settings(); reset_background_settings();
clear_entity_models(); clear_entity_models();
clear_animator_list(); clear_animator_list();
clear_generic_entity_list(); clear_worker_list();
hud_element_set_aux_cache(NULL, 0); hud_element_set_aux_cache(NULL, 0);
hud_element_clear_cache(); hud_element_clear_cache();
reset_status_menu(); reset_status_menu();
@ -142,7 +143,7 @@ void state_step_end_battle(void) {
init_sprite_shading_data(); init_sprite_shading_data();
init_entity_models(); init_entity_models();
reset_animator_list(); reset_animator_list();
init_generic_entity_list(); init_worker_list();
hud_element_set_aux_cache(0, 0); hud_element_set_aux_cache(0, 0);
init_hud_element_list(); init_hud_element_list();
init_item_entity_list(); init_item_entity_list();

View File

@ -95,10 +95,10 @@ void state_step_demo(void) {
gOverrideFlags &= ~GLOBAL_OVERRIDES_8; gOverrideFlags &= ~GLOBAL_OVERRIDES_8;
general_heap_create(); general_heap_create();
clear_render_tasks(); clear_render_tasks();
clear_generic_entity_list(); clear_worker_list();
clear_script_list(); clear_script_list();
create_cameras_a(); create_cameras_a();
spr_init_sprites(0); spr_init_sprites(PLAYER_SPRITES_MARIO_WORLD);
clear_entity_models(); clear_entity_models();
clear_animator_list(); clear_animator_list();
clear_model_data(); clear_model_data();

View File

@ -121,13 +121,13 @@ void state_step_language_select(void) {
backup_map_collision_data(); backup_map_collision_data();
battle_heap_create(); battle_heap_create();
sfx_clear_env_sounds(0); sfx_clear_env_sounds(0);
spr_init_sprites(0); spr_init_sprites(PLAYER_SPRITES_MARIO_WORLD);
clear_model_data(); clear_model_data();
clear_sprite_shading_data(); clear_sprite_shading_data();
reset_background_settings(); reset_background_settings();
clear_entity_models(); clear_entity_models();
clear_animator_list(); clear_animator_list();
clear_generic_entity_list(); clear_worker_list();
hud_element_set_aux_cache(&D_80200000, 0x20000); hud_element_set_aux_cache(&D_80200000, 0x20000);
hud_element_clear_cache(); hud_element_clear_cache();
reset_status_menu(); reset_status_menu();
@ -279,7 +279,7 @@ void state_step_exit_language_select(void) {
init_sprite_shading_data(); init_sprite_shading_data();
init_entity_models(); init_entity_models();
reset_animator_list(); reset_animator_list();
init_generic_entity_list(); init_worker_list();
hud_element_set_aux_cache(0, 0); hud_element_set_aux_cache(0, 0);
init_hud_element_list(); init_hud_element_list();
init_item_entity_list(); init_item_entity_list();

View File

@ -144,10 +144,10 @@ void state_step_intro(void) {
if (gGameStatusPtr->creditsViewportMode == -1) { if (gGameStatusPtr->creditsViewportMode == -1) {
general_heap_create(); general_heap_create();
clear_render_tasks(); clear_render_tasks();
clear_generic_entity_list(); clear_worker_list();
clear_script_list(); clear_script_list();
create_cameras_a(); create_cameras_a();
spr_init_sprites(0); spr_init_sprites(PLAYER_SPRITES_MARIO_WORLD);
clear_entity_models(); clear_entity_models();
clear_animator_list(); clear_animator_list();
clear_model_data(); clear_model_data();

View File

@ -84,9 +84,9 @@ void state_init_logos(void) {
gCameras[CAM_DEFAULT].lookAt_eye.z = 1500.0f; gCameras[CAM_DEFAULT].lookAt_eye.z = 1500.0f;
gCameras[CAM_DEFAULT].lookAt_obj_target.z = 150.0f; gCameras[CAM_DEFAULT].lookAt_obj_target.z = 150.0f;
clear_script_list(); clear_script_list();
clear_generic_entity_list(); clear_worker_list();
clear_render_tasks(); clear_render_tasks();
spr_init_sprites(0); spr_init_sprites(PLAYER_SPRITES_MARIO_WORLD);
clear_animator_list(); clear_animator_list();
clear_entity_models(); clear_entity_models();
clear_npcs(); clear_npcs();

View File

@ -63,13 +63,13 @@ void state_step_pause(void) {
battle_heap_create(); battle_heap_create();
nuContRmbForceStop(); nuContRmbForceStop();
sfx_clear_env_sounds(0); sfx_clear_env_sounds(0);
spr_init_sprites(0); spr_init_sprites(PLAYER_SPRITES_MARIO_WORLD);
clear_model_data(); clear_model_data();
clear_sprite_shading_data(); clear_sprite_shading_data();
reset_background_settings(); reset_background_settings();
clear_entity_models(); clear_entity_models();
clear_animator_list(); clear_animator_list();
clear_generic_entity_list(); clear_worker_list();
hud_element_set_aux_cache(_3169F0_VRAM, 0x38000); hud_element_set_aux_cache(_3169F0_VRAM, 0x38000);
hud_element_clear_cache(); hud_element_clear_cache();
reset_status_menu(); reset_status_menu();
@ -151,7 +151,7 @@ void state_step_unpause(void) {
init_sprite_shading_data(); init_sprite_shading_data();
init_entity_models(); init_entity_models();
reset_animator_list(); reset_animator_list();
init_generic_entity_list(); init_worker_list();
hud_element_set_aux_cache(0, 0); hud_element_set_aux_cache(0, 0);
init_hud_element_list(); init_hud_element_list();
init_item_entity_list(); init_item_entity_list();

View File

@ -33,10 +33,10 @@ void state_step_startup(void) {
general_heap_create(); general_heap_create();
clear_render_tasks(); clear_render_tasks();
clear_generic_entity_list(); clear_worker_list();
clear_script_list(); clear_script_list();
create_cameras_a(); create_cameras_a();
spr_init_sprites(0); spr_init_sprites(PLAYER_SPRITES_MARIO_WORLD);
clear_entity_models(); clear_entity_models();
clear_animator_list(); clear_animator_list();
clear_model_data(); clear_model_data();

View File

@ -121,9 +121,9 @@ void state_init_title_screen(void) {
gCameras[CAM_DEFAULT].lookAt_eye.z = 1500.0f; gCameras[CAM_DEFAULT].lookAt_eye.z = 1500.0f;
gCameras[CAM_DEFAULT].lookAt_obj_target.z = 150.0f; gCameras[CAM_DEFAULT].lookAt_obj_target.z = 150.0f;
clear_script_list(); clear_script_list();
clear_generic_entity_list(); clear_worker_list();
clear_render_tasks(); clear_render_tasks();
spr_init_sprites(0); spr_init_sprites(PLAYER_SPRITES_MARIO_WORLD);
clear_animator_list(); clear_animator_list();
clear_entity_models(); clear_entity_models();
clear_npcs(); clear_npcs();
@ -247,7 +247,7 @@ void state_step_title_screen(void) {
clear_animator_list(); clear_animator_list();
clear_npcs(); clear_npcs();
hud_element_clear_cache(); hud_element_clear_cache();
spr_init_sprites(0); spr_init_sprites(PLAYER_SPRITES_MARIO_WORLD);
clear_entity_data(1); clear_entity_data(1);
clear_windows(); clear_windows();
gOverrideFlags &= ~GLOBAL_OVERRIDES_8; gOverrideFlags &= ~GLOBAL_OVERRIDES_8;

View File

@ -129,7 +129,7 @@ void func_80045AC0(void) {
popup->message = NULL; popup->message = NULL;
} }
create_generic_entity_world(NULL, func_80045BC8); create_worker_world(NULL, func_80045BC8);
init_all_status_icons(); init_all_status_icons();
} }

184
src/worker.c Normal file
View File

@ -0,0 +1,184 @@
#include "common.h"
void worker_delegate_do_nothing(void) {
}
void clear_worker_list(void) {
s32 i;
if (!gGameStatusPtr->isBattle) {
gCurrentWorkerListPtr = &gWorldWorkerList;
} else {
gCurrentWorkerListPtr = &gBattleWorkerList;
}
for (i = 0; i < MAX_WORKERS; i++) {
(*gCurrentWorkerListPtr)[i] = NULL;
}
}
void init_worker_list(void) {
if (!gGameStatusPtr->isBattle) {
gCurrentWorkerListPtr = &gWorldWorkerList;
} else {
gCurrentWorkerListPtr = &gBattleWorkerList;
}
}
s32 create_worker_world(void (*updateFunc)(void), void (*drawFunc)(void)) {
Worker* worker;
s32 i;
for (i = 0; i < MAX_WORKERS; i++) {
Worker* lastWorker = (*gCurrentWorkerListPtr)[i];
if (lastWorker == NULL) {
break;
}
}
ASSERT(i < MAX_WORKERS);
(*gCurrentWorkerListPtr)[i] = worker = heap_malloc(sizeof(*worker));
ASSERT(worker != NULL);
worker->flags = WORKER_FLAG_1 | WORKER_FLAG_SKIP_DRAW_UNTIL_UPDATE;
worker->update = updateFunc;
if (updateFunc == NULL) {
worker->update = worker_delegate_do_nothing;
}
worker->draw = drawFunc;
if (drawFunc == NULL) {
worker->draw = worker_delegate_do_nothing;
}
if (gGameStatusPtr->isBattle) {
i |= BATTLE_ENTITY_ID_MASK;
}
return i;
}
s32 create_worker_frontUI(void (*updateFunc)(void), void (*drawFunc)(void)) {
Worker* worker;
s32 i;
for (i = 0; i < MAX_WORKERS; i++) {
Worker* lastWorker = (*gCurrentWorkerListPtr)[i];
if (lastWorker == NULL) {
break;
}
}
ASSERT(i < MAX_WORKERS);
(*gCurrentWorkerListPtr)[i] = worker = heap_malloc(sizeof(*worker));
ASSERT(worker != NULL);
worker->flags = WORKER_FLAG_1 | WORKER_FLAG_SKIP_DRAW_UNTIL_UPDATE | WORKER_FLAG_FRONT_UI;
worker->update = updateFunc;
if (updateFunc == NULL) {
worker->update = worker_delegate_do_nothing;
}
worker->draw = drawFunc;
if (drawFunc == NULL) {
worker->draw = worker_delegate_do_nothing;
}
if (gGameStatusPtr->isBattle) {
i |= BATTLE_ENTITY_ID_MASK;
}
return i;
}
s32 create_worker_backUI(void (*updateFunc)(void), void (*drawFunc)(void)) {
Worker* worker;
s32 i;
for (i = 0; i < MAX_WORKERS; i++) {
Worker* lastWorker = (*gCurrentWorkerListPtr)[i];
if (lastWorker == NULL) {
break;
}
}
ASSERT(i < MAX_WORKERS);
(*gCurrentWorkerListPtr)[i] = worker = heap_malloc(sizeof(*worker));
ASSERT(worker != NULL);
worker->flags = WORKER_FLAG_1 | WORKER_FLAG_SKIP_DRAW_UNTIL_UPDATE | WORKER_FLAG_BACK_UI;
worker->update = updateFunc;
if (updateFunc == NULL) {
worker->update = &worker_delegate_do_nothing;
}
worker->draw = drawFunc;
if (drawFunc == NULL) {
worker->draw = &worker_delegate_do_nothing;
}
if (gGameStatusPtr->isBattle) {
i |= BATTLE_ENTITY_ID_MASK;
}
return i;
}
void update_workers(void) {
s32 i;
for (i = 0; i < MAX_WORKERS; i++) {
Worker* worker = (*gCurrentWorkerListPtr)[i];
if (worker != NULL) {
worker->flags &= ~WORKER_FLAG_SKIP_DRAW_UNTIL_UPDATE;
worker->update();
}
}
}
void render_workers_world(void) {
s32 i;
for (i = 0; i < MAX_WORKERS; i++) {
Worker* worker = (*gCurrentWorkerListPtr)[i];
if (worker != NULL && !(worker->flags & WORKER_FLAG_SKIP_DRAW_UNTIL_UPDATE)) {
if (!(worker->flags & WORKER_FLAG_FRONT_UI)) {
worker->draw();
}
}
}
}
void render_workers_frontUI(void) {
s32 i;
for (i = 0; i < MAX_WORKERS; i++) {
Worker* worker = (*gCurrentWorkerListPtr)[i];
if (worker != NULL && !(worker->flags & WORKER_FLAG_SKIP_DRAW_UNTIL_UPDATE)) {
if (worker->flags & WORKER_FLAG_FRONT_UI) {
worker->draw();
}
}
}
}
void render_workers_backUI(void) {
s32 i;
for (i = 0; i < MAX_WORKERS; i++) {
Worker* worker = (*gCurrentWorkerListPtr)[i];
if (worker != NULL && !(worker->flags & WORKER_FLAG_SKIP_DRAW_UNTIL_UPDATE)) {
if (worker->flags & WORKER_FLAG_BACK_UI) {
worker->draw();
}
}
}
}
void free_worker(s32 idx) {
if (!gGameStatusPtr->isBattle || (idx & BATTLE_ENTITY_ID_MASK)) {
idx &= ~BATTLE_ENTITY_ID_MASK;
if ((*gCurrentWorkerListPtr)[idx] != NULL) {
heap_free((*gCurrentWorkerListPtr)[idx]);
(*gCurrentWorkerListPtr)[idx] = NULL;
}
}
}
Worker* get_worker(s32 idx) {
return (*gCurrentWorkerListPtr)[idx & ~BATTLE_ENTITY_ID_MASK];
}

View File

@ -183,7 +183,7 @@ API_CALLABLE(N(CreateRitualCards)) {
fold_update(ret, FOLD_TYPE_5, 0x12, 1, 1, 0, 0x800); fold_update(ret, FOLD_TYPE_5, 0x12, 1, 1, 0, 0x800);
evt_set_variable(script, RITUAL_VAR_FOLDER_4, ret); evt_set_variable(script, RITUAL_VAR_FOLDER_4, ret);
evt_set_variable(script, RITUAL_VAR_WORKER, create_generic_entity_world( evt_set_variable(script, RITUAL_VAR_WORKER, create_worker_world(
N(card_worker_update), N(card_worker_update),
N(card_worker_render))); N(card_worker_render)));
return ApiStatus_DONE2; return ApiStatus_DONE2;
@ -194,7 +194,7 @@ API_CALLABLE(N(DestroyRitualCards)) {
func_8013A854(evt_get_variable(script, RITUAL_VAR_FOLDER_2)); func_8013A854(evt_get_variable(script, RITUAL_VAR_FOLDER_2));
func_8013A854(evt_get_variable(script, RITUAL_VAR_FOLDER_3)); func_8013A854(evt_get_variable(script, RITUAL_VAR_FOLDER_3));
func_8013A854(evt_get_variable(script, RITUAL_VAR_FOLDER_4)); func_8013A854(evt_get_variable(script, RITUAL_VAR_FOLDER_4));
free_generic_entity(evt_get_variable(script, RITUAL_VAR_WORKER)); free_worker(evt_get_variable(script, RITUAL_VAR_WORKER));
return ApiStatus_DONE2; return ApiStatus_DONE2;
} }

View File

@ -1,7 +1,7 @@
#include "end_00.h" #include "end_00.h"
s32 N(map_init)(void) { s32 N(map_init)(void) {
gGameStatusPtr->playerSpriteSet = 3; gGameStatusPtr->playerSpriteSet = PLAYER_SPRITES_MARIO_PARADE;
return FALSE; return FALSE;
} }

View File

@ -155,10 +155,10 @@ ApiStatus N(ChangeStateToTitleScreen)(Evt* script, s32 isInitialCall) {
gOverrideFlags &= ~GLOBAL_OVERRIDES_8; gOverrideFlags &= ~GLOBAL_OVERRIDES_8;
general_heap_create(); general_heap_create();
clear_render_tasks(); clear_render_tasks();
clear_generic_entity_list(); clear_worker_list();
clear_script_list(); clear_script_list();
create_cameras_a(); create_cameras_a();
spr_init_sprites(0); spr_init_sprites(PLAYER_SPRITES_MARIO_WORLD);
clear_entity_models(); clear_entity_models();
clear_animator_list(); clear_animator_list();
clear_model_data(); clear_model_data();

View File

@ -933,7 +933,7 @@ ApiStatus func_80244454_A2E694(Evt* script, s32 isInitialCall) {
return ApiStatus_BLOCK; return ApiStatus_BLOCK;
} else { } else {
D_8024AA20_A34C60->unk_5C = 0; D_8024AA20_A34C60->unk_5C = 0;
free_generic_entity(D_8024AA20_A34C60->unk_00); free_worker(D_8024AA20_A34C60->unk_00);
D_8024AA20_A34C60->unk_00 = 0; D_8024AA20_A34C60->unk_00 = 0;
return ApiStatus_DONE1; return ApiStatus_DONE1;
} }

View File

@ -106,14 +106,14 @@ ApiStatus func_80241B28_97F5F8(Evt* script, s32 isInitialCall) {
ambush->alpha = 0.0f; ambush->alpha = 0.0f;
ambush->foldID = 0; ambush->foldID = 0;
ambush->workerID = create_generic_entity_frontUI(NULL, func_80241610_97F0E0); ambush->workerID = create_worker_frontUI(NULL, func_80241610_97F0E0);
return ApiStatus_DONE2; return ApiStatus_DONE2;
} }
ApiStatus func_80241C34_97F704(Evt* script, s32 isInitialCall) { ApiStatus func_80241C34_97F704(Evt* script, s32 isInitialCall) {
StoneChompAmbushIsk05* ambush = &N(ChompAmbush); StoneChompAmbushIsk05* ambush = &N(ChompAmbush);
free_generic_entity(ambush->workerID); free_worker(ambush->workerID);
return ApiStatus_DONE2; return ApiStatus_DONE2;
} }

View File

@ -117,14 +117,14 @@ ApiStatus func_80241BA8_991388(Evt* script, s32 isInitialCall) {
ambush->color.a = 0.0f; ambush->color.a = 0.0f;
ambush->foldID = 0; ambush->foldID = 0;
ambush->workerID = create_generic_entity_frontUI(NULL, func_80241610_990DF0); ambush->workerID = create_worker_frontUI(NULL, func_80241610_990DF0);
evt_set_variable(script, MapVar(10), (s32) ambush); evt_set_variable(script, MapVar(10), (s32) ambush);
return ApiStatus_DONE2; return ApiStatus_DONE2;
} }
ApiStatus func_80241D08_9914E8(Evt* script, s32 isInitialCall) { ApiStatus func_80241D08_9914E8(Evt* script, s32 isInitialCall) {
StoneChompAmbushIsk13* ambush = (StoneChompAmbushIsk13*) evt_get_variable(script, MapVar(10)); StoneChompAmbushIsk13* ambush = (StoneChompAmbushIsk13*) evt_get_variable(script, MapVar(10));
free_generic_entity(ambush->workerID); free_worker(ambush->workerID);
return ApiStatus_DONE2; return ApiStatus_DONE2;
} }

View File

@ -103,14 +103,14 @@ ApiStatus func_80241AF0_994220(Evt* script, s32 isInitialCall) {
ambush->renderYaw = 270.0f; ambush->renderYaw = 270.0f;
ambush->foldID = 0; ambush->foldID = 0;
ambush->workerID = create_generic_entity_frontUI(NULL, func_80241610_993D40); ambush->workerID = create_worker_frontUI(NULL, func_80241610_993D40);
return ApiStatus_DONE2; return ApiStatus_DONE2;
} }
ApiStatus func_80241BC4_9942F4(Evt* script, s32 isInitialCall) { ApiStatus func_80241BC4_9942F4(Evt* script, s32 isInitialCall) {
StoneChompAmbushIsk14* ambush = &N(ChompAmbush); StoneChompAmbushIsk14* ambush = &N(ChompAmbush);
free_generic_entity(ambush->workerID); free_worker(ambush->workerID);
return ApiStatus_DONE2; return ApiStatus_DONE2;
} }

View File

@ -7,8 +7,8 @@ extern SlideParams D_8024160C_ABC89C;
extern SlideParams D_8024162C_ABC8BC; extern SlideParams D_8024162C_ABC8BC;
ApiStatus func_80240000_ABB290(Evt* script, s32 isInitialCall) { ApiStatus func_80240000_ABB290(Evt* script, s32 isInitialCall) {
if (evt_get_variable(NULL, GB_StoryProgress) >= 96) { if (evt_get_variable(NULL, GB_StoryProgress) >= STORY_EPILOGUE) {
gGameStatusPtr->playerSpriteSet = 2; gGameStatusPtr->playerSpriteSet = PLAYER_SPRITES_COMBINED_EPILOGUE;
} }
return ApiStatus_BLOCK; return ApiStatus_BLOCK;

View File

@ -65,7 +65,7 @@ ApiStatus func_802401FC_AF7B4C(Evt* script, s32 isInitialCall) {
D_80240E8C_AF87DC = 0; D_80240E8C_AF87DC = 0;
D_80240E90_AF87E0 = 0; D_80240E90_AF87E0 = 0;
get_generic_entity(create_generic_entity_frontUI(func_80240068_AF79B8, NULL)); get_worker(create_worker_frontUI(func_80240068_AF79B8, NULL));
setup_pause_menu_tab(D_80240EF0_AF8840, ARRAY_COUNT(D_80240EF0_AF8840)); setup_pause_menu_tab(D_80240EF0_AF8840, ARRAY_COUNT(D_80240EF0_AF8840));
for (i = 0; i < 10; i++) { for (i = 0; i < 10; i++) {

View File

@ -112,7 +112,7 @@ ApiStatus func_802406C4_AF8014(Evt* script, s32 isInitialCall) {
switch (D_80246558_kkj_19) { switch (D_80246558_kkj_19) {
case 0: case 0:
D_80246534 = evt_get_variable(script, *args++); D_80246534 = evt_get_variable(script, *args++);
D_80246554 = create_generic_entity_frontUI(NULL, func_802406A0_AF7FF0); D_80246554 = create_worker_frontUI(NULL, func_802406A0_AF7FF0);
dgb_08_npcGroup_80246528 = 0; dgb_08_npcGroup_80246528 = 0;
D_80246530 = 0; D_80246530 = 0;
for (i = 0; i < 10; i++) { for (i = 0; i < 10; i++) {
@ -206,7 +206,7 @@ ApiStatus func_802406C4_AF8014(Evt* script, s32 isInitialCall) {
script->varTable[0] = dgb_08_npcGroup_80246528; script->varTable[0] = dgb_08_npcGroup_80246528;
hud_element_free(D_80246568_C8C018[0]); hud_element_free(D_80246568_C8C018[0]);
hud_element_free(D_80246568_C8C018[1]); hud_element_free(D_80246568_C8C018[1]);
free_generic_entity(D_80246554); free_worker(D_80246554);
return ApiStatus_DONE2; return ApiStatus_DONE2;
} }

View File

@ -23,7 +23,7 @@ ApiStatus func_802406EC_B070EC(Evt* script, s32 isInitialCall) {
unkStruct->scale.y = SPRITE_WORLD_SCALE_F; unkStruct->scale.y = SPRITE_WORLD_SCALE_F;
unkStruct->scale.z = SPRITE_WORLD_SCALE_F; unkStruct->scale.z = SPRITE_WORLD_SCALE_F;
unkStruct->foldID = func_8013A704(1); unkStruct->foldID = func_8013A704(1);
unkStruct->entityID = create_generic_entity_world(NULL, kkj_25_UnkFoldFunc); unkStruct->entityID = create_worker_world(NULL, kkj_25_UnkFoldFunc);
evt_set_variable(script, MapVar(10), (s32) unkStruct); evt_set_variable(script, MapVar(10), (s32) unkStruct);
return ApiStatus_DONE2; return ApiStatus_DONE2;
@ -33,7 +33,7 @@ ApiStatus func_80240800_B07200(Evt* script, s32 isInitialCall) {
UnkEntityStruct* unkStruct = (UnkEntityStruct*) evt_get_variable(NULL, MapVar(10)); UnkEntityStruct* unkStruct = (UnkEntityStruct*) evt_get_variable(NULL, MapVar(10));
func_8013A854(unkStruct->foldID); func_8013A854(unkStruct->foldID);
free_generic_entity(unkStruct->entityID); free_worker(unkStruct->entityID);
heap_free(unkStruct); heap_free(unkStruct);
evt_set_variable(script, MapVar(10), 0); evt_set_variable(script, MapVar(10), 0);

View File

@ -108,7 +108,7 @@ API_CALLABLE(N(CreateSticker)) {
iconPal); iconPal);
sticker->folderID = func_8013A704(1); sticker->folderID = func_8013A704(1);
sticker->workerID = create_generic_entity_world(NULL, N(worker_render_sticker)); sticker->workerID = create_worker_world(NULL, N(worker_render_sticker));
evt_set_variable(script, MapVar(10), (s32) sticker); evt_set_variable(script, MapVar(10), (s32) sticker);
evt_set_variable(script, MapVar(11), (s32) iconImg); evt_set_variable(script, MapVar(11), (s32) iconImg);
evt_set_variable(script, MapVar(12), (s32) iconPal); evt_set_variable(script, MapVar(12), (s32) iconPal);
@ -204,7 +204,7 @@ API_CALLABLE(N(DeleteSticker)) {
IMG_PTR img = (IMG_PTR) evt_get_variable(script, MV_StickerImage); IMG_PTR img = (IMG_PTR) evt_get_variable(script, MV_StickerImage);
PAL_PTR pal = (PAL_PTR) evt_get_variable(script, MV_StickerPalette); PAL_PTR pal = (PAL_PTR) evt_get_variable(script, MV_StickerPalette);
free_generic_entity(data->workerID); free_worker(data->workerID);
heap_free(data); heap_free(data);
heap_free(img); heap_free(img);

View File

@ -31,7 +31,7 @@ ApiStatus func_802406BC_8EC4DC(Evt* script, s32 isInitialCall) {
INCLUDE_ASM(s32, "world/area_kmr/kmr_20/8EBE50", func_802406C8_8EC4E8); INCLUDE_ASM(s32, "world/area_kmr/kmr_20/8EBE50", func_802406C8_8EC4E8);
ApiStatus func_80240B20_8EC940(Evt* script, s32 isInitialCall) { ApiStatus func_80240B20_8EC940(Evt* script, s32 isInitialCall) {
free_generic_entity(D_8025B2A8); free_worker(D_8025B2A8);
return ApiStatus_DONE2; return ApiStatus_DONE2;
} }

View File

@ -64,7 +64,7 @@ API_CALLABLE(N(LoadTitleImage)) {
decode_yay0(compressed, TitleData); decode_yay0(compressed, TitleData);
general_heap_free(compressed); general_heap_free(compressed);
TitleImage = (IMG_PTR)(TitleData->img_offset_title + (s32)TitleData); TitleImage = (IMG_PTR)(TitleData->img_offset_title + (s32)TitleData);
create_generic_entity_frontUI(NULL, worker_render_title_image); create_worker_frontUI(NULL, worker_render_title_image);
return ApiStatus_DONE2; return ApiStatus_DONE2;
} }

View File

@ -41,7 +41,7 @@ ApiStatus func_80240B3C_9001AC(Evt* script, s32 isInitialCall) {
ApiStatus func_80240B4C_9001BC(Evt* script, s32 isInitialCall) { ApiStatus func_80240B4C_9001BC(Evt* script, s32 isInitialCall) {
evt_set_variable(script, MapVar(0), (s32) heap_malloc(0x780)); // TODO what is this evt_set_variable(script, MapVar(0), (s32) heap_malloc(0x780)); // TODO what is this
D_802483D0 = -1; D_802483D0 = -1;
create_generic_entity_world(NULL, func_80240B00_900170); create_worker_world(NULL, func_80240B00_900170);
return ApiStatus_DONE2; return ApiStatus_DONE2;
} }

View File

@ -1,7 +1,7 @@
#include "kpa_53.h" #include "kpa_53.h"
ApiStatus func_80240000_A6ACA0(Evt* script, s32 isInitialCall) { ApiStatus func_80240000_A6ACA0(Evt* script, s32 isInitialCall) {
gGameStatusPtr->playerSpriteSet = 2; gGameStatusPtr->playerSpriteSet = PLAYER_SPRITES_COMBINED_EPILOGUE;
sprintf(wMapShapeName, "kpa_50_shape"); sprintf(wMapShapeName, "kpa_50_shape");
sprintf(wMapHitName, "kpa_50_hit"); sprintf(wMapHitName, "kpa_50_hit");
return ApiStatus_BLOCK; return ApiStatus_BLOCK;

View File

@ -319,7 +319,7 @@ API_CALLABLE(N(CreateVineRenderer)) {
LavaPiranhaVine* data = heap_malloc(NUM_VINES * sizeof(*data)); LavaPiranhaVine* data = heap_malloc(NUM_VINES * sizeof(*data));
evt_set_variable(script, MV_VinesData, (s32) data); evt_set_variable(script, MV_VinesData, (s32) data);
N(VineRenderState) = -1; N(VineRenderState) = -1;
create_generic_entity_world(NULL, &N(worker_render_piranha_vines)); create_worker_world(NULL, &N(worker_render_piranha_vines));
return ApiStatus_DONE2; return ApiStatus_DONE2;
} }

View File

@ -48,7 +48,7 @@ ApiStatus func_80243380_803C00(Evt* script, s32 isInitialCall) {
temp_v0->scale.y = SPRITE_WORLD_SCALE_F; temp_v0->scale.y = SPRITE_WORLD_SCALE_F;
temp_v0->scale.z = SPRITE_WORLD_SCALE_F; temp_v0->scale.z = SPRITE_WORLD_SCALE_F;
temp_v0->foldID = func_8013A704(1); temp_v0->foldID = func_8013A704(1);
temp_v0->entityID = create_generic_entity_world(NULL, mac_01_UnkFoldFunc); temp_v0->entityID = create_worker_world(NULL, mac_01_UnkFoldFunc);
evt_set_variable(script, MapVar(10), (s32) temp_v0); evt_set_variable(script, MapVar(10), (s32) temp_v0);
return ApiStatus_DONE2; return ApiStatus_DONE2;
} }
@ -57,7 +57,7 @@ ApiStatus func_80243494_803D14(Evt* script, s32 isInitialCall) {
UnkEntityStruct* temp_v0 = (UnkEntityStruct*) evt_get_variable(NULL, MapVar(10)); UnkEntityStruct* temp_v0 = (UnkEntityStruct*) evt_get_variable(NULL, MapVar(10));
func_8013A854(temp_v0->foldID); func_8013A854(temp_v0->foldID);
free_generic_entity(temp_v0->entityID); free_worker(temp_v0->entityID);
heap_free(temp_v0); heap_free(temp_v0);
evt_set_variable(script, MapVar(10), NULL); evt_set_variable(script, MapVar(10), NULL);
return ApiStatus_DONE2; return ApiStatus_DONE2;

View File

@ -6,7 +6,7 @@ void func_80241DAC_84497C(void*);
ApiStatus func_80241C90_844860(Evt* script, s32 isInitialCall) { ApiStatus func_80241C90_844860(Evt* script, s32 isInitialCall) {
gPlayerStatus.animFlags |= PA_FLAGS_IN_DISGUISE; gPlayerStatus.animFlags |= PA_FLAGS_IN_DISGUISE;
evt_set_variable(script, MapVar(11), create_generic_entity_world(NULL, func_80241D30_844900)); evt_set_variable(script, MapVar(11), create_worker_world(NULL, func_80241D30_844900));
return ApiStatus_DONE2; return ApiStatus_DONE2;
} }
@ -14,7 +14,7 @@ ApiStatus func_80241C90_844860(Evt* script, s32 isInitialCall) {
ApiStatus func_80241CEC_8448BC(Evt* script, s32 isInitialCall) { ApiStatus func_80241CEC_8448BC(Evt* script, s32 isInitialCall) {
s32 index = evt_get_variable(script, MapVar(11)); s32 index = evt_get_variable(script, MapVar(11));
gPlayerStatus.animFlags &= ~PA_FLAGS_IN_DISGUISE; gPlayerStatus.animFlags &= ~PA_FLAGS_IN_DISGUISE;
free_generic_entity(index); free_worker(index);
return ApiStatus_DONE2; return ApiStatus_DONE2;
} }

View File

@ -141,13 +141,13 @@ API_CALLABLE(N(UpdateRecordDisplay)) {
script->functionTempPtr[0] = data; script->functionTempPtr[0] = data;
data->state = RECORD_START_SHOW; data->state = RECORD_START_SHOW;
data->alpha = 255; data->alpha = 255;
data->workerID = create_generic_entity_world(NULL, &N(work_draw_record)); data->workerID = create_worker_world(NULL, &N(work_draw_record));
data->gameType = gameType; data->gameType = gameType;
evt_set_variable(script, MV_RecordDisplayData, (s32)data); evt_set_variable(script, MV_RecordDisplayData, (s32)data);
} }
data = script->functionTempPtr[0]; data = script->functionTempPtr[0];
if (data->state == RECORD_STATE_DONE) { if (data->state == RECORD_STATE_DONE) {
free_generic_entity(data->workerID); free_worker(data->workerID);
heap_free(data); heap_free(data);
return ApiStatus_DONE1; return ApiStatus_DONE1;
} }

View File

@ -628,7 +628,7 @@ API_CALLABLE(N(CreateMinigame)) {
s32 hudElemID; s32 hudElemID;
scorekeeper->varTablePtr[JUMP_DATA_VAR_IDX] = data; scorekeeper->varTablePtr[JUMP_DATA_VAR_IDX] = data;
data->workerID = create_generic_entity_world(NULL, &mgm_01_worker_draw_score); data->workerID = create_worker_world(NULL, &mgm_01_worker_draw_score);
hudElemID = hud_element_create(&HES_StatusCoin); hudElemID = hud_element_create(&HES_StatusCoin);
data->hudElemID = hudElemID; data->hudElemID = hudElemID;
@ -646,7 +646,7 @@ API_CALLABLE(N(CreateMinigame)) {
API_CALLABLE(N(DestroyMinigame)) { API_CALLABLE(N(DestroyMinigame)) {
JumpGameData* data = get_enemy(SCOREKEEPER_ENEMY_IDX)->varTablePtr[JUMP_DATA_VAR_IDX]; JumpGameData* data = get_enemy(SCOREKEEPER_ENEMY_IDX)->varTablePtr[JUMP_DATA_VAR_IDX];
free_generic_entity(data->workerID); free_worker(data->workerID);
hud_element_free(data->hudElemID); hud_element_free(data->hudElemID);
return ApiStatus_DONE2; return ApiStatus_DONE2;

View File

@ -196,7 +196,7 @@ API_CALLABLE(N(CreateScoreDisplay)) {
s32 hudElemA, hudElemMeter; s32 hudElemA, hudElemMeter;
if (isInitialCall) { if (isInitialCall) {
data->workerID = create_generic_entity_world(NULL, &N(worker_draw_score)); data->workerID = create_worker_world(NULL, &N(worker_draw_score));
hudElemA = hud_element_create(&HES_AButton); hudElemA = hud_element_create(&HES_AButton);
data->hudElemID_AButton = hudElemA; data->hudElemID_AButton = hudElemA;
@ -967,7 +967,7 @@ API_CALLABLE(N(CreateMinigame)) {
API_CALLABLE(N(DestroyMinigame)) { API_CALLABLE(N(DestroyMinigame)) {
SmashGameData* data = get_enemy(SCOREKEEPER_ENEMY_IDX)->varTablePtr[SMASH_DATA_VAR_IDX]; SmashGameData* data = get_enemy(SCOREKEEPER_ENEMY_IDX)->varTablePtr[SMASH_DATA_VAR_IDX];
free_generic_entity(data->workerID); free_worker(data->workerID);
hud_element_free(data->hudElemID_AButton); hud_element_free(data->hudElemID_AButton);
hud_element_free(data->hudElemID_Meter); hud_element_free(data->hudElemID_Meter);

View File

@ -114,7 +114,7 @@ ApiStatus func_80241168_BCFD58(Evt* script, s32 isInitialCall) {
s32 i; s32 i;
gOverrideFlags |= GLOBAL_OVERRIDES_10; gOverrideFlags |= GLOBAL_OVERRIDES_10;
temp_s1->unk_2C = create_generic_entity_frontUI(func_80240A6C_BCF65C, func_802410C0_BCFCB0); temp_s1->unk_2C = create_worker_frontUI(func_80240A6C_BCF65C, func_802410C0_BCFCB0);
temp_s1->unk_30 = 0; temp_s1->unk_30 = 0;
temp_s1->unk_04 = 0; temp_s1->unk_04 = 0;
temp_s1->unk_08 = 0; temp_s1->unk_08 = 0;
@ -179,7 +179,7 @@ ApiStatus func_802413D0_BCFFC0(Evt* script, s32 isInitialCall) {
hud_element_free(temp_v0->unk_3C); hud_element_free(temp_v0->unk_3C);
hud_element_free(temp_v0->unk_40); hud_element_free(temp_v0->unk_40);
hud_element_free(temp_v0->unk_44); hud_element_free(temp_v0->unk_44);
free_generic_entity(temp_v0->unk_2C); free_worker(temp_v0->unk_2C);
return ApiStatus_DONE2; return ApiStatus_DONE2;
} }

View File

@ -8,7 +8,7 @@ ApiStatus func_802404F0_BD3D60(Evt* script, s32 isInitialCall) {
UnkEntityStruct* temp_v0 = (UnkEntityStruct*) evt_get_variable(NULL, MapVar(10)); UnkEntityStruct* temp_v0 = (UnkEntityStruct*) evt_get_variable(NULL, MapVar(10));
func_8013A854(temp_v0->foldID); func_8013A854(temp_v0->foldID);
free_generic_entity(temp_v0->entityID); free_worker(temp_v0->entityID);
heap_free(temp_v0); heap_free(temp_v0);
evt_set_variable(script, MapVar(10), NULL); evt_set_variable(script, MapVar(10), NULL);
return ApiStatus_DONE2; return ApiStatus_DONE2;

View File

@ -1,7 +1,7 @@
#include "osr_04.h" #include "osr_04.h"
ApiStatus func_80240000_AB92B0(Evt *script, s32 isInitialCall) { ApiStatus func_80240000_AB92B0(Evt *script, s32 isInitialCall) {
gGameStatusPtr->playerSpriteSet = 2; gGameStatusPtr->playerSpriteSet = PLAYER_SPRITES_COMBINED_EPILOGUE;
sprintf(wMapShapeName, "osr_03_shape"); sprintf(wMapShapeName, "osr_03_shape");
sprintf(wMapHitName, "osr_03_hit"); sprintf(wMapHitName, "osr_03_hit");
return ApiStatus_BLOCK; return ApiStatus_BLOCK;

View File

@ -1,7 +1,7 @@
#include "pra_06.h" #include "pra_06.h"
ApiStatus func_80240000_D57430(void) { ApiStatus func_80240000_D57430(void) {
gGameStatusPtr->playerSpriteSet = 1; gGameStatusPtr->playerSpriteSet = PLAYER_SPRITES_MARIO_REFLECT_FLOOR;
sprintf(wMapShapeName, "pra_05_shape"); sprintf(wMapShapeName, "pra_05_shape");
sprintf(wMapHitName, "pra_05_hit"); sprintf(wMapHitName, "pra_05_hit");
return ApiStatus_BLOCK; return ApiStatus_BLOCK;

View File

@ -1,7 +1,7 @@
#include "pra_12.h" #include "pra_12.h"
ApiStatus func_80240000_D62D10(Evt* script, s32 isInitialCall) { ApiStatus func_80240000_D62D10(Evt* script, s32 isInitialCall) {
gGameStatusPtr->playerSpriteSet = 1; gGameStatusPtr->playerSpriteSet = PLAYER_SPRITES_MARIO_REFLECT_FLOOR;
sprintf(wMapShapeName, "pra_05_shape"); sprintf(wMapShapeName, "pra_05_shape");
sprintf(wMapHitName, "pra_05_hit"); sprintf(wMapHitName, "pra_05_hit");
return ApiStatus_BLOCK; return ApiStatus_BLOCK;

View File

@ -74,7 +74,7 @@ void func_8024140C_D659EC(void);
void func_802414BC_D65A9C(void* npc); void func_802414BC_D65A9C(void* npc);
ApiStatus func_802413D0_D659B0(Evt* script, s32 isInitialCall) { ApiStatus func_802413D0_D659B0(Evt* script, s32 isInitialCall) {
script->array[0] = create_generic_entity_world(0, func_8024140C_D659EC); script->array[0] = create_worker_world(0, func_8024140C_D659EC);
return ApiStatus_DONE2; return ApiStatus_DONE2;
} }

View File

@ -105,7 +105,7 @@ void func_802415E0_D6FF90(void* data);
void func_80241530_D6FEE0(void); void func_80241530_D6FEE0(void);
ApiStatus func_802414F4_D6FEA4(Evt* script, s32 isInitialCall) { ApiStatus func_802414F4_D6FEA4(Evt* script, s32 isInitialCall) {
script->array[0] = create_generic_entity_world(0, func_80241530_D6FEE0); script->array[0] = create_worker_world(0, func_80241530_D6FEE0);
return ApiStatus_DONE2; return ApiStatus_DONE2;
} }

View File

@ -1,7 +1,7 @@
#include "pra_27.h" #include "pra_27.h"
ApiStatus func_80240000_D799F0(Evt* script, s32 isInitialCall) { ApiStatus func_80240000_D799F0(Evt* script, s32 isInitialCall) {
gGameStatusPtr->playerSpriteSet = 1; gGameStatusPtr->playerSpriteSet = PLAYER_SPRITES_MARIO_REFLECT_FLOOR;
sprintf(wMapShapeName, "pra_05_shape"); sprintf(wMapShapeName, "pra_05_shape");
sprintf(wMapHitName, "pra_05_hit"); sprintf(wMapHitName, "pra_05_hit");
return ApiStatus_BLOCK; return ApiStatus_BLOCK;

View File

@ -1,7 +1,7 @@
#include "pra_28.h" #include "pra_28.h"
ApiStatus func_80240000_D7B2A0(Evt* script, s32 isInitialCall) { ApiStatus func_80240000_D7B2A0(Evt* script, s32 isInitialCall) {
gGameStatusPtr->playerSpriteSet = 1; gGameStatusPtr->playerSpriteSet = PLAYER_SPRITES_MARIO_REFLECT_FLOOR;
sprintf(wMapShapeName, "pra_05_shape"); sprintf(wMapShapeName, "pra_05_shape");
sprintf(wMapHitName, "pra_05_hit"); sprintf(wMapHitName, "pra_05_hit");
return ApiStatus_BLOCK; return ApiStatus_BLOCK;

View File

@ -4,6 +4,6 @@ static char* N(exit_str_0) = "pra_34";
static char* N(exit_str_1) = "pra_40"; static char* N(exit_str_1) = "pra_40";
ApiStatus func_80240000_D7ED60(Evt* script, s32 isInitialCall) { ApiStatus func_80240000_D7ED60(Evt* script, s32 isInitialCall) {
gGameStatusPtr->playerSpriteSet = 1; gGameStatusPtr->playerSpriteSet = PLAYER_SPRITES_MARIO_REFLECT_FLOOR;
return ApiStatus_BLOCK; return ApiStatus_BLOCK;
} }

View File

@ -1,7 +1,7 @@
#include "pra_36.h" #include "pra_36.h"
ApiStatus func_80240000_D91700(Evt* script, s32 isInitialCall) { ApiStatus func_80240000_D91700(Evt* script, s32 isInitialCall) {
gGameStatusPtr->playerSpriteSet = 1; gGameStatusPtr->playerSpriteSet = PLAYER_SPRITES_MARIO_REFLECT_FLOOR;
sprintf(wMapShapeName, "pra_10_shape"); sprintf(wMapShapeName, "pra_10_shape");
sprintf(wMapHitName, "pra_10_hit"); sprintf(wMapHitName, "pra_10_hit");
return ApiStatus_BLOCK; return ApiStatus_BLOCK;

View File

@ -1,7 +1,7 @@
#include "pra_37.h" #include "pra_37.h"
ApiStatus func_80240000_D92F40(Evt* script, s32 isInitialCall) { ApiStatus func_80240000_D92F40(Evt* script, s32 isInitialCall) {
gGameStatusPtr->playerSpriteSet = 1; gGameStatusPtr->playerSpriteSet = PLAYER_SPRITES_MARIO_REFLECT_FLOOR;
sprintf(wMapShapeName, "pra_10_shape"); sprintf(wMapShapeName, "pra_10_shape");
sprintf(wMapHitName, "pra_10_hit"); sprintf(wMapHitName, "pra_10_hit");
return ApiStatus_BLOCK; return ApiStatus_BLOCK;

View File

@ -1,7 +1,7 @@
#include "pra_38.h" #include "pra_38.h"
ApiStatus func_80240000_D955F0(Evt* script, s32 isInitialCall) { ApiStatus func_80240000_D955F0(Evt* script, s32 isInitialCall) {
gGameStatusPtr->playerSpriteSet = 1; gGameStatusPtr->playerSpriteSet = PLAYER_SPRITES_MARIO_REFLECT_FLOOR;
sprintf(wMapShapeName, "pra_10_shape"); sprintf(wMapShapeName, "pra_10_shape");
sprintf(wMapHitName, "pra_10_hit"); sprintf(wMapHitName, "pra_10_hit");
return ApiStatus_BLOCK; return ApiStatus_BLOCK;

View File

@ -1,7 +1,7 @@
#include "pra_39.h" #include "pra_39.h"
ApiStatus func_80240000_D97890(Evt* script, s32 isInitialCall) { ApiStatus func_80240000_D97890(Evt* script, s32 isInitialCall) {
gGameStatusPtr->playerSpriteSet = 1; gGameStatusPtr->playerSpriteSet = PLAYER_SPRITES_MARIO_REFLECT_FLOOR;
sprintf(wMapShapeName, "pra_10_shape"); sprintf(wMapShapeName, "pra_10_shape");
sprintf(wMapHitName, "pra_10_hit"); sprintf(wMapHitName, "pra_10_hit");
return ApiStatus_BLOCK; return ApiStatus_BLOCK;

View File

@ -87,13 +87,13 @@ API_CALLABLE(N(InitializeFallingSprite)) {
falling->scale.y = SPRITE_WORLD_SCALE_F; falling->scale.y = SPRITE_WORLD_SCALE_F;
falling->scale.z = SPRITE_WORLD_SCALE_F; falling->scale.z = SPRITE_WORLD_SCALE_F;
falling->foldStateID = func_8013A704(1); falling->foldStateID = func_8013A704(1);
falling->workerID = create_generic_entity_world(0, &N(appendGfx_FallingSprite)); falling->workerID = create_worker_world(0, &N(appendGfx_FallingSprite));
return ApiStatus_DONE2; return ApiStatus_DONE2;
} }
API_CALLABLE(N(DeleteFallingSprite)) { API_CALLABLE(N(DeleteFallingSprite)) {
func_8013A854(N(Falling).foldStateID); func_8013A854(N(Falling).foldStateID);
free_generic_entity(N(Falling).workerID); free_worker(N(Falling).workerID);
return ApiStatus_DONE2; return ApiStatus_DONE2;
} }

View File

@ -95,13 +95,13 @@ API_CALLABLE(N(InitializeFallingSprite)) {
falling->scale.z = SPRITE_WORLD_SCALE_F; falling->scale.z = SPRITE_WORLD_SCALE_F;
falling->foldStateID = func_8013A704(1); falling->foldStateID = func_8013A704(1);
falling->workerID = create_generic_entity_world(0, &N(appendGfx_FallingSprite)); falling->workerID = create_worker_world(0, &N(appendGfx_FallingSprite));
return ApiStatus_DONE2; return ApiStatus_DONE2;
} }
API_CALLABLE(N(DeleteFallingSprite)) { API_CALLABLE(N(DeleteFallingSprite)) {
func_8013A854(N(Falling).foldStateID); func_8013A854(N(Falling).foldStateID);
free_generic_entity(N(Falling).workerID); free_worker(N(Falling).workerID);
return ApiStatus_DONE2; return ApiStatus_DONE2;
} }

View File

@ -9,7 +9,7 @@ void N(worker_update_partner_reflection)(void);
static s32 N(Animator); static s32 N(Animator);
API_CALLABLE(N(EnablePlayerReflection)) { API_CALLABLE(N(EnablePlayerReflection)) {
script->array[0] = (s32) create_generic_entity_frontUI(NULL, &N(worker_render_player_reflection)); script->array[0] = (s32) create_worker_frontUI(NULL, &N(worker_render_player_reflection));
return ApiStatus_DONE2; return ApiStatus_DONE2;
} }
@ -63,7 +63,7 @@ void N(appendGfx_test_player_reflection)(void* data) {
API_CALLABLE(N(EnablePartnerReflection)) { API_CALLABLE(N(EnablePartnerReflection)) {
Npc* partner; Npc* partner;
script->array[1] = create_generic_entity_world(&N(worker_update_partner_reflection), NULL); script->array[1] = create_worker_world(&N(worker_update_partner_reflection), NULL);
partner = get_npc_safe(NPC_PARTNER); partner = get_npc_safe(NPC_PARTNER);
if (partner == NULL) { if (partner == NULL) {
@ -101,7 +101,7 @@ void N(worker_render_animator)(void) {
} }
API_CALLABLE(N(SetupAnimatedModel)) { API_CALLABLE(N(SetupAnimatedModel)) {
create_generic_entity_world(N(worker_update_animator), N(worker_render_animator)); create_worker_world(N(worker_update_animator), N(worker_render_animator));
return ApiStatus_DONE2; return ApiStatus_DONE2;
} }

View File

@ -9,7 +9,7 @@ void N(test_reflection_worker_partner)(void);
// identical to final version // identical to final version
API_CALLABLE(N(EnableWallReflectionTest)) { API_CALLABLE(N(EnableWallReflectionTest)) {
script->array[0] = (s32) create_generic_entity_frontUI(NULL, N(test_reflection_worker_render_wall)); script->array[0] = (s32) create_worker_frontUI(NULL, N(test_reflection_worker_render_wall));
return ApiStatus_DONE2; return ApiStatus_DONE2;
} }
@ -60,7 +60,7 @@ void N(appendGfx_test_reflection_wall)(void* data) {
} }
API_CALLABLE(N(EnableFloorReflectionTest)) { API_CALLABLE(N(EnableFloorReflectionTest)) {
script->array[0] = (s32) create_generic_entity_frontUI(NULL, &N(test_reflection_worker_render_floor)); script->array[0] = (s32) create_worker_frontUI(NULL, &N(test_reflection_worker_render_floor));
return ApiStatus_DONE2; return ApiStatus_DONE2;
} }
@ -127,7 +127,7 @@ void N(appendGfx_test_reflection_floor)(void* data) {
API_CALLABLE(N(PartnerReflectTest)) { API_CALLABLE(N(PartnerReflectTest)) {
Npc* partner; Npc* partner;
script->array[1] = create_generic_entity_world(N(test_reflection_worker_partner), NULL); script->array[1] = create_worker_world(N(test_reflection_worker_partner), NULL);
partner = get_npc_safe(NPC_PARTNER); partner = get_npc_safe(NPC_PARTNER);
if (partner == NULL) { if (partner == NULL) {

View File

@ -791,7 +791,7 @@ void N(init_credits)(void) {
s32 i; s32 i;
N(CreditsDataPtr) = &N(CreditsData); N(CreditsDataPtr) = &N(CreditsData);
N(CreditsData).workerID = create_generic_entity_frontUI(NULL, N(credits_worker_render)); N(CreditsData).workerID = create_worker_frontUI(NULL, N(credits_worker_render));
for (i = 0; i < ARRAY_COUNT(N(CreditsData).lines); i++) { for (i = 0; i < ARRAY_COUNT(N(CreditsData).lines); i++) {
N(CreditsData).lines[i].flags = 0; N(CreditsData).lines[i].flags = 0;

View File

@ -292,7 +292,7 @@ ApiStatus N(Quizmo_DestroyEffects)(Evt* script, s32 isInitialCall) {
if (stageData->microphoneRaiseAmt <= 0) { if (stageData->microphoneRaiseAmt <= 0) {
stageData->microphoneRaiseAmt = 0; stageData->microphoneRaiseAmt = 0;
remove_effect(N(Quizmo_StageEffect)); remove_effect(N(Quizmo_StageEffect));
free_generic_entity(N(Quizmo_Worker)); free_worker(N(Quizmo_Worker));
return ApiStatus_DONE2; return ApiStatus_DONE2;
} }
@ -461,6 +461,6 @@ void N(Quizmo_CreateReactionEffect)(void) {
} }
ApiStatus N(Quizmo_CreateWorker)(Evt* script, s32 isInitialCall) { ApiStatus N(Quizmo_CreateWorker)(Evt* script, s32 isInitialCall) {
N(Quizmo_Worker) = create_generic_entity_frontUI(NULL, N(Quizmo_CreateReactionEffect)); N(Quizmo_Worker) = create_worker_frontUI(NULL, N(Quizmo_CreateReactionEffect));
return ApiStatus_DONE2; return ApiStatus_DONE2;
} }

View File

@ -63,7 +63,7 @@ s32 N(reflection_unk_change_anim_facing)(s32 playerAnim) {
} }
API_CALLABLE(N(EnableWallReflection)){ API_CALLABLE(N(EnableWallReflection)){
script->array[0] = (s32) create_generic_entity_world(NULL, N(worker_reflect_player_wall)); script->array[0] = (s32) create_worker_world(NULL, N(worker_reflect_player_wall));
return ApiStatus_DONE2; return ApiStatus_DONE2;
} }
@ -140,7 +140,7 @@ API_CALLABLE(N(EnableFloorReflection)){
switch (script->varTable[0]) { switch (script->varTable[0]) {
case REFLECTION_FLOOR_WALL: case REFLECTION_FLOOR_WALL:
case REFLECTION_FLOOR: case REFLECTION_FLOOR:
script->array[0] = create_generic_entity_world(NULL, N(worker_reflect_player_floor)); script->array[0] = create_worker_world(NULL, N(worker_reflect_player_floor));
gOverrideFlags |= GLOBAL_OVERRIDES_80; gOverrideFlags |= GLOBAL_OVERRIDES_80;
break; break;
case REFLECTION_WALL: case REFLECTION_WALL:
@ -320,20 +320,20 @@ API_CALLABLE(N(EnablePartnerReflection)){
if (script->varTable[1] == FALSE) { if (script->varTable[1] == FALSE) {
switch (script->varTable[0]) { switch (script->varTable[0]) {
case REFLECTION_FLOOR_WALL: case REFLECTION_FLOOR_WALL:
script->array[1] = create_generic_entity_world(N(worker_reflect_partner_all), NULL); script->array[1] = create_worker_world(N(worker_reflect_partner_all), NULL);
break; break;
case REFLECTION_FLOOR: case REFLECTION_FLOOR:
script->array[1] = create_generic_entity_world(N(worker_reflect_partner_floor), NULL); script->array[1] = create_worker_world(N(worker_reflect_partner_floor), NULL);
break; break;
case REFLECTION_WALL: case REFLECTION_WALL:
script->array[1] = create_generic_entity_world(N(worker_reflect_partner_wall), NULL); script->array[1] = create_worker_world(N(worker_reflect_partner_wall), NULL);
break; break;
} }
} else { } else {
switch (script->varTable[0]) { switch (script->varTable[0]) {
case REFLECTION_FLOOR_WALL: case REFLECTION_FLOOR_WALL:
case REFLECTION_FLOOR: case REFLECTION_FLOOR:
script->array[1] = create_generic_entity_world(N(worker_reflect_partner_floor), NULL); script->array[1] = create_worker_world(N(worker_reflect_partner_floor), NULL);
break; break;
case REFLECTION_WALL: case REFLECTION_WALL:
break; break;

View File

@ -345,7 +345,7 @@ API_CALLABLE(N(Quizmo_DestroyEffects)) {
if (stageData->microphoneRaiseAmt <= 0) { if (stageData->microphoneRaiseAmt <= 0) {
stageData->microphoneRaiseAmt = 0; stageData->microphoneRaiseAmt = 0;
remove_effect(N(Quizmo_StageEffect)); remove_effect(N(Quizmo_StageEffect));
free_generic_entity(N(Quizmo_Worker)); free_worker(N(Quizmo_Worker));
return ApiStatus_DONE2; return ApiStatus_DONE2;
} }
@ -514,7 +514,7 @@ void N(Quizmo_CreateReactionEffect)(void) {
} }
API_CALLABLE(N(Quizmo_CreateWorker)) { API_CALLABLE(N(Quizmo_CreateWorker)) {
N(Quizmo_Worker) = create_generic_entity_frontUI(NULL, N(Quizmo_CreateReactionEffect)); N(Quizmo_Worker) = create_worker_frontUI(NULL, N(Quizmo_CreateReactionEffect));
return ApiStatus_DONE2; return ApiStatus_DONE2;
} }

View File

@ -2,6 +2,6 @@
#include "npc.h" #include "npc.h"
ApiStatus N(SetGameStatusUnk84_1)(Evt* script, s32 isInitialCall) { ApiStatus N(SetGameStatusUnk84_1)(Evt* script, s32 isInitialCall) {
gGameStatusPtr->playerSpriteSet = 1; gGameStatusPtr->playerSpriteSet = PLAYER_SPRITES_MARIO_REFLECT_FLOOR;
return ApiStatus_BLOCK; return ApiStatus_BLOCK;
} }

View File

@ -1,6 +1,6 @@
#include "common.h" #include "common.h"
ApiStatus N(SetPlayerSpriteSet2)(Evt* script, s32 isInitialCall) { ApiStatus N(SetPlayerSpriteSet2)(Evt* script, s32 isInitialCall) {
gGameStatusPtr->playerSpriteSet = 2; gGameStatusPtr->playerSpriteSet = PLAYER_SPRITES_COMBINED_EPILOGUE;
return ApiStatus_BLOCK; return ApiStatus_BLOCK;
} }

View File

@ -280,7 +280,7 @@ ApiStatus func_8024140C_EA9EEC(Evt* script, s32 isInitialCall) {
LavaPiranhaVine* data = heap_malloc(NUM_VINES * sizeof(*data)); LavaPiranhaVine* data = heap_malloc(NUM_VINES * sizeof(*data));
evt_set_variable(script, MV_VinesData, (s32) data); evt_set_variable(script, MV_VinesData, (s32) data);
D_80248380 = -1; D_80248380 = -1;
create_generic_entity_world(0, &func_802413C0_EA9EA0); create_worker_world(0, &func_802413C0_EA9EA0);
return ApiStatus_DONE2; return ApiStatus_DONE2;
} }

View File

@ -990,7 +990,7 @@ void partner_reset_data(void) {
s32 currentPartner = gPlayerData.currentPartner; s32 currentPartner = gPlayerData.currentPartner;
mem_clear(&gPartnerActionStatus, sizeof(gPartnerActionStatus)); mem_clear(&gPartnerActionStatus, sizeof(gPartnerActionStatus));
get_generic_entity(create_generic_entity_frontUI(_use_partner_ability, NULL)); get_worker(create_worker_frontUI(_use_partner_ability, NULL));
D_8010CFE0 = 1; D_8010CFE0 = 1;
D_8010CFE8 = 9; D_8010CFE8 = 9;

View File

@ -924,7 +924,7 @@ ApiStatus MakeShop(Evt* script, s32 isInitialCall) {
shop->costIconID = hud_element_create(&HES_Item_Coin); shop->costIconID = hud_element_create(&HES_Item_Coin);
hud_element_set_flags(shop->costIconID, HUD_ELEMENT_FLAGS_80); hud_element_set_flags(shop->costIconID, HUD_ELEMENT_FLAGS_80);
hud_element_clear_flags(shop->costIconID, HUD_ELEMENT_FLAGS_FILTER_TEX); hud_element_clear_flags(shop->costIconID, HUD_ELEMENT_FLAGS_FILTER_TEX);
get_generic_entity(create_generic_entity_frontUI(NULL, draw_shop_items)); get_worker(create_worker_frontUI(NULL, draw_shop_items));
set_window_properties(WINDOW_ID_10, 100, 66, 120, 28, 0, shop_draw_item_name, NULL, -1); set_window_properties(WINDOW_ID_10, 100, 66, 120, 28, 0, shop_draw_item_name, NULL, -1);
set_window_properties(WINDOW_ID_11, 32, 184, 256, 32, 1, shop_draw_item_desc, NULL, -1); set_window_properties(WINDOW_ID_11, 32, 184, 256, 32, 1, shop_draw_item_desc, NULL, -1);
gWindowStyles[10].defaultStyleID = 9; gWindowStyles[10].defaultStyleID = 9;

View File

@ -48,11 +48,11 @@ void load_map_by_IDs(s16 areaID, s16 mapID, s16 loadType) {
gOverrideFlags &= ~GLOBAL_OVERRIDES_40; gOverrideFlags &= ~GLOBAL_OVERRIDES_40;
gOverrideFlags &= ~GLOBAL_OVERRIDES_80; gOverrideFlags &= ~GLOBAL_OVERRIDES_80;
gGameStatusPtr->playerSpriteSet = 0; gGameStatusPtr->playerSpriteSet = PLAYER_SPRITES_MARIO_WORLD;
func_8002D160(); func_8002D160();
func_802B2078(); func_802B2078();
clear_render_tasks(); clear_render_tasks();
clear_generic_entity_list(); clear_worker_list();
clear_script_list(); clear_script_list();
switch (loadType) { switch (loadType) {
@ -116,7 +116,7 @@ void load_map_by_IDs(s16 areaID, s16 mapID, s16 loadType) {
func_8002D160(); func_8002D160();
func_802B2078(); func_802B2078();
sfx_clear_env_sounds(0); sfx_clear_env_sounds(0);
clear_generic_entity_list(); clear_worker_list();
clear_script_list(); clear_script_list();
create_cameras_a(); create_cameras_a();
spr_init_sprites(gGameStatusPtr->playerSpriteSet); spr_init_sprites(gGameStatusPtr->playerSpriteSet);

View File

@ -48,7 +48,7 @@ func_8004D8E0 = 0x8004D8E0;
dead_LoadPath = 0x802E2A80; dead_LoadPath = 0x802E2A80;
dead_GetNextPathPos = 0x802E2B74; dead_GetNextPathPos = 0x802E2B74;
dead_queue_render_task = 0x80128510; dead_queue_render_task = 0x80128510;
dead_create_generic_entity_world = 0x8012DFE8; dead_create_worker_world = 0x8012DFE8;
dead_dma_copy = 0x8002AA2C; dead_dma_copy = 0x8002AA2C;
func_80059AC8 = 0x80059AC8; func_80059AC8 = 0x80059AC8;
dead_get_entity_by_index = 0x80118BB0; dead_get_entity_by_index = 0x80118BB0;

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