isBattle refactor (#1211)

This commit is contained in:
z64a 2024-09-30 22:50:46 -04:00 committed by GitHub
parent ba4499e2a7
commit 5929e49b72
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
84 changed files with 326 additions and 302 deletions

View File

@ -1427,7 +1427,7 @@ typedef struct GameStatus {
/* 0x06A */ s8 demoStickX;
/* 0x06B */ s8 demoStickY;
/* 0x06C */ s32 mainScriptID;
/* 0x070 */ s8 isBattle;
/* 0x070 */ s8 context;
/* 0x071 */ s8 demoState; // see DemoState enum
/* 0x072 */ s8 nextDemoScene; /* which part of the demo to play next */
/* 0x073 */ u8 contBitPattern;

View File

@ -26,7 +26,7 @@
#define cos_deg dead_cos_deg
#define sin_cos_deg dead_sin_cos_deg
#define gPlayerStatus dead_gPlayerStatus
#define is_point_within_region dead_is_point_within_region
#define is_point_outside_territory dead_is_point_outside_territory
#define npc_raycast_down_sides dead_npc_raycast_down_sides
#define basic_ai_check_player_dist dead_basic_ai_check_player_dist
#define fx_emote dead_fx_emote

View File

@ -3526,6 +3526,12 @@ enum EffectGfxDataFlags {
#include "move_enum.h"
enum GameContext {
CONTEXT_WORLD = 0,
CONTEXT_BATTLE = 1,
CONTEXT_PAUSE = 2,
};
enum DemoState {
DEMO_STATE_NONE = 0,
DEMO_STATE_ACTIVE = 1,
@ -4556,14 +4562,14 @@ enum EnemyFlags {
// used with enemy->aiFlags
enum EnemyAIFlags {
ENEMY_AI_FLAG_1 = 0x00000001,
ENEMY_AI_FLAG_2 = 0x00000002, // do not move; do not sense player
ENEMY_AI_FLAG_SUSPEND = 0x00000004,
ENEMY_AI_FLAG_8 = 0x00000008,
ENEMY_AI_FLAG_10 = 0x00000010,
ENEMY_AI_FLAG_20 = 0x00000020,
ENEMY_AI_FLAG_40 = 0x00000040,
ENEMY_AI_FLAG_80 = 0x00000080,
AI_FLAG_1 = 0x00000001,
AI_FLAG_CANT_DETECT_PLAYER = 0x00000002,
AI_FLAG_SUSPEND = 0x00000004,
AI_FLAG_SKIP_EMOTE_AFTER_FLEE = 0x00000008,
AI_FLAG_SKIP_IDLE_ANIM_AFTER_FLEE = 0x00000010,
AI_FLAG_OUTSIDE_TERRITORY = 0x00000020,
AI_FLAG_NEEDS_HEADING = 0x00000040,
AI_FLAG_80 = 0x00000080,
};
enum EnemyAIStates {
@ -4613,7 +4619,7 @@ enum EnemyDetectFlags {
AI_DETECT_FLAG_8 = 0x08,
};
enum EnemyTerritoryFlags {
enum TerritoryFlags {
AI_TERRITORY_IGNORE_HIDING = 0x01, // bow and sushi dont prevent enemy detection
AI_TERRITORY_IGNORE_ELEVATION = 0x02, // vertical size of detection volume is ignored
};

View File

@ -414,7 +414,7 @@ s32 suspend_all_script(s32 id);
s32 resume_all_script(s32 id);
s32 create_shadow_type(s32 type, f32 x, f32 y, f32 z);
s32 is_point_within_region(s32 shape, f32 pointX, f32 pointY, f32 centerX, f32 centerY, f32 sizeX, f32 sizeZ);
b32 is_point_outside_territory(s32 shape, f32 pointX, f32 pointY, f32 centerX, f32 centerY, f32 sizeX, f32 sizeZ);
PlayerData* get_player_data(void);
b32 npc_raycast_down_around(s32, f32*, f32*, f32*, f32*, f32, f32);

View File

@ -424,7 +424,7 @@ extern EncounterStatus gCurrentEncounter;
#endif
s32 basic_ai_check_player_dist(EnemyDetectVolume* arg0, Enemy* arg1, f32 arg2, f32 arg3, s8 arg4);
b32 basic_ai_check_player_dist(EnemyDetectVolume* arg0, Enemy* arg1, f32 arg2, f32 arg3, b8 arg4);
/// The default Npc::onUpdate and Npc::onRender callback.
void STUB_npc_callback(Npc*);

View File

@ -51,7 +51,7 @@ void state_step_enter_world(void) {
break;
}
gGameStatusPtr->isBattle = FALSE;
gGameStatusPtr->context = CONTEXT_WORLD;
gGameStatusPtr->debugScripts = DEBUG_SCRIPTS_NONE;
if (!gLoadedFromFileSelect) {
@ -155,7 +155,7 @@ void state_step_change_map(void) {
if (gMapTransitionStateTime != 0) {
gMapTransitionStateTime--;
} else {
gGameStatusPtr->isBattle = FALSE;
gGameStatusPtr->context = CONTEXT_WORLD;
gGameStatusPtr->debugScripts = DEBUG_SCRIPTS_NONE;
load_map_by_IDs(gGameStatusPtr->areaID, gGameStatusPtr->mapID, LOAD_FROM_MAP);
set_time_freeze_mode(TIME_FREEZE_NORMAL);
@ -230,7 +230,7 @@ void state_step_game_over(void) {
if (gMapTransitionStateTime != 0) {
gMapTransitionStateTime--;
} else {
gGameStatusPtr->isBattle = FALSE;
gGameStatusPtr->context = CONTEXT_WORLD;
gGameStatusPtr->debugScripts = DEBUG_SCRIPTS_NONE;
load_map_by_IDs(gGameStatusPtr->areaID, gGameStatusPtr->mapID, LOAD_FROM_MAP);
nuContRmbForceStopEnd();

View File

@ -295,16 +295,16 @@ void spawn_drops(Enemy* enemy) {
s32 get_coin_drop_amount(Enemy* enemy) {
EncounterStatus* currentEncounter = &gCurrentEncounter;
EnemyDrops* enemyDrops = enemy->drops;
s32 maxCoinBonus = enemyDrops->maxCoinBonus;
s32 max = enemyDrops->maxCoinBonus;
s32 amt = enemyDrops->minCoinBonus;
s32 minTemp = enemyDrops->minCoinBonus;
if (maxCoinBonus < amt) {
if (max < amt) {
amt = enemyDrops->maxCoinBonus;
maxCoinBonus = enemyDrops->minCoinBonus;
max = enemyDrops->minCoinBonus;
}
minTemp = maxCoinBonus - amt;
minTemp = max - amt;
if ((amt < 0) || (minTemp != 0)) {
amt = rand_int(minTemp) - -amt;
}
@ -392,24 +392,24 @@ s32 func_80048F0C(void) {
return 0;
}
s32 is_point_within_region(s32 shape, f32 pointX, f32 pointY, f32 centerX, f32 centerY, f32 sizeX, f32 sizeZ) {
b32 is_point_outside_territory(s32 shape, f32 centerX, f32 centerZ, f32 pointX, f32 pointZ, f32 sizeX, f32 sizeZ) {
f32 dist1;
f32 dist2;
switch (shape) {
case 0:
dist1 = dist2D(pointX, pointY, centerX, centerY);
case SHAPE_CYLINDER:
dist1 = dist2D(centerX, centerZ, pointX, pointZ);
return (sizeX < dist1);
case 1:
dist1 = dist2D(pointX, 0, centerX, 0);
dist2 = dist2D(0, pointY, 0, centerY);
case SHAPE_RECT:
dist1 = dist2D(centerX, 0, pointX, 0);
dist2 = dist2D(0, centerZ, 0, pointZ);
return ((sizeX < dist1) || (sizeZ < dist2));
default:
return FALSE;
}
}
s32 basic_ai_check_player_dist(EnemyDetectVolume* territory, Enemy* enemy, f32 radius, f32 fwdPosOffset, s8 useWorldYaw) {
b32 basic_ai_check_player_dist(EnemyDetectVolume* territory, Enemy* enemy, f32 radius, f32 fwdPosOffset, b8 useWorldYaw) {
Npc* npc = get_npc_unsafe(enemy->npcID);
PlayerStatus* playerStatus = &gPlayerStatus;
PartnerStatus* partnerStatus;
@ -417,7 +417,7 @@ s32 basic_ai_check_player_dist(EnemyDetectVolume* territory, Enemy* enemy, f32 r
f32 dist;
s32 skipCheckForPlayer;
if (enemy->aiFlags & ENEMY_AI_FLAG_2) {
if (enemy->aiFlags & AI_FLAG_CANT_DETECT_PLAYER) {
return FALSE;
}
@ -441,7 +441,7 @@ s32 basic_ai_check_player_dist(EnemyDetectVolume* territory, Enemy* enemy, f32 r
return FALSE;
}
if (territory->sizeX | territory->sizeZ && is_point_within_region(territory->shape,
if (territory->sizeX | territory->sizeZ && is_point_outside_territory(territory->shape,
territory->pointX, territory->pointZ,
playerStatus->pos.x, playerStatus->pos.z,
territory->sizeX, territory->sizeZ)) {
@ -563,8 +563,8 @@ void basic_ai_wander_init(Evt* script, MobileAISettings* npcAISettings, EnemyDet
npc->moveSpeed = enemy->territory->wander.moveSpeedOverride / 32767.0;
}
enemy->aiFlags &= ~ENEMY_AI_FLAG_40;
enemy->aiFlags &= ~ENEMY_AI_FLAG_20;
enemy->aiFlags &= ~AI_FLAG_NEEDS_HEADING;
enemy->aiFlags &= ~AI_FLAG_OUTSIDE_TERRITORY;
script->AI_TEMP_STATE = AI_STATE_WANDER;
}
@ -576,6 +576,7 @@ void basic_ai_wander(Evt* script, MobileAISettings* aiSettings, EnemyDetectVolum
EffectInstance* sp34;
f32 yaw;
// search for the player
if (aiSettings->playerSearchInterval >= 0) {
if (script->functionTemp[1] <= 0) {
script->functionTemp[1] = aiSettings->playerSearchInterval;
@ -588,8 +589,8 @@ void basic_ai_wander(Evt* script, MobileAISettings* aiSettings, EnemyDetectVolum
npc->yaw = yaw;
ai_enemy_play_sound(npc, SOUND_AI_ALERT_A, SOUND_PARAM_MORE_QUIET);
fx_emote(EMOTE_EXCLAMATION, npc, 0, npc->collisionHeight, 1.0f, 2.0f, -20.0f, 15, &sp34);
enemy->aiFlags &= ~ENEMY_AI_FLAG_40;
enemy->aiFlags &= ~ENEMY_AI_FLAG_20;
enemy->aiFlags &= ~AI_FLAG_NEEDS_HEADING;
enemy->aiFlags &= ~AI_FLAG_OUTSIDE_TERRITORY;
if (enemy->npcSettings->actionFlags & AI_ACTION_JUMP_WHEN_SEE_PLAYER) {
script->AI_TEMP_STATE = AI_STATE_ALERT_INIT;
@ -603,37 +604,39 @@ void basic_ai_wander(Evt* script, MobileAISettings* aiSettings, EnemyDetectVolum
script->functionTemp[1]--;
}
// check if the wander we've reached the boundary of the territory
if (is_point_within_region(enemy->territory->wander.wanderShape,
// check if we've wandered beyond the boundary of the territory
if (is_point_outside_territory(enemy->territory->wander.wanderShape,
enemy->territory->wander.centerPos.x,
enemy->territory->wander.centerPos.z,
npc->pos.x,
npc->pos.z,
enemy->territory->wander.wanderSize.x,
enemy->territory->wander.wanderSize.z)
&& npc->moveSpeed < dist2D(enemy->territory->wander.centerPos.x, enemy->territory->wander.centerPos.z, npc->pos.x, npc->pos.z)) {
if (!(enemy->aiFlags & ENEMY_AI_FLAG_20)) {
enemy->aiFlags |= (ENEMY_AI_FLAG_20 | ENEMY_AI_FLAG_40);
&& npc->moveSpeed < dist2D(enemy->territory->wander.centerPos.x, enemy->territory->wander.centerPos.z, npc->pos.x, npc->pos.z)
) {
if (!(enemy->aiFlags & AI_FLAG_OUTSIDE_TERRITORY)) {
enemy->aiFlags |= (AI_FLAG_OUTSIDE_TERRITORY | AI_FLAG_NEEDS_HEADING);
}
if (enemy->aiFlags & ENEMY_AI_FLAG_40) {
if (enemy->aiFlags & AI_FLAG_NEEDS_HEADING) {
npc->yaw = clamp_angle(atan2(npc->pos.x, npc->pos.z, enemy->territory->wander.centerPos.x, enemy->territory->wander.centerPos.z));
enemy->aiFlags &= ~ENEMY_AI_FLAG_40;
enemy->aiFlags &= ~AI_FLAG_NEEDS_HEADING;
}
// if current heading is deflected by a wall, recalculate yaw to continue pursuing centerPos
x = npc->pos.x;
y = npc->pos.y;
z = npc->pos.z;
if (npc_test_move_simple_with_slipping(npc->collisionChannel, &x, &y, &z, 2.0 * npc->moveSpeed, npc->yaw, npc->collisionHeight, npc->collisionDiameter)) {
yaw = clamp_angle(atan2(npc->pos.x, npc->pos.z, enemy->territory->wander.centerPos.x, enemy->territory->wander.centerPos.z));
enemy->aiFlags &= ~ENEMY_AI_FLAG_40;
enemy->aiFlags &= ~AI_FLAG_NEEDS_HEADING;
ai_check_fwd_collisions(npc, 5.0f, &yaw, NULL, NULL, NULL);
npc->yaw = yaw;
}
stillWithinTerritory = TRUE;
} else if (enemy->aiFlags & ENEMY_AI_FLAG_20) {
enemy->aiFlags &= ~ENEMY_AI_FLAG_20;
enemy->aiFlags &= ~ENEMY_AI_FLAG_40;
} else if (enemy->aiFlags & AI_FLAG_OUTSIDE_TERRITORY) {
enemy->aiFlags &= ~AI_FLAG_OUTSIDE_TERRITORY;
enemy->aiFlags &= ~AI_FLAG_NEEDS_HEADING;
}
// perform the motion
@ -853,7 +856,7 @@ API_CALLABLE(BasicAI_Main) {
territory.halfHeight = 65.0f;
territory.detectFlags = 0;
if (isInitialCall || enemy->aiFlags & ENEMY_AI_FLAG_SUSPEND) {
if (isInitialCall || enemy->aiFlags & AI_FLAG_SUSPEND) {
script->AI_TEMP_STATE = AI_STATE_WANDER_INIT;
npc->duration = 0;
@ -868,14 +871,14 @@ API_CALLABLE(BasicAI_Main) {
npc->flags |= NPC_FLAG_FLYING;
}
if (enemy->aiFlags & ENEMY_AI_FLAG_SUSPEND) {
if (enemy->aiFlags & AI_FLAG_SUSPEND) {
script->AI_TEMP_STATE = AI_STATE_SUSPEND;
script->functionTemp[1] = AI_STATE_WANDER_INIT;
} else if (enemy->flags & ENEMY_FLAG_BEGIN_WITH_CHASING) {
script->AI_TEMP_STATE = AI_STATE_CHASE_INIT;
}
enemy->aiFlags &= ~ENEMY_AI_FLAG_SUSPEND;
enemy->aiFlags &= ~AI_FLAG_SUSPEND;
enemy->flags &= ~ENEMY_FLAG_BEGIN_WITH_CHASING;
}

View File

@ -27,7 +27,7 @@ s32 ai_check_fwd_collisions(Npc* npc, f32 time, f32* outYaw, f32* outDistFwd, f3
f32 cwHitDist = -1.0f;
f32 ccwHitDist = -1.0f;
f32 yaw;
s32 fwdHit;
b32 fwdHit;
x1 = npc->pos.x;
y1 = npc->pos.y;

View File

@ -1052,7 +1052,7 @@ void check_for_pulse_stone(void) {
return;
}
if (gGameStatusPtr->areaID != AREA_SBK || gGameStatusPtr->isBattle) {
if (gGameStatusPtr->areaID != AREA_SBK || gGameStatusPtr->context != CONTEXT_WORLD) {
return;
}
@ -1318,7 +1318,7 @@ void clear_interact_prompt(void) {
void update_partner_timers(void) {
PlayerData* playerData = &gPlayerData;
if (!gGameStatusPtr->isBattle) {
if (gGameStatusPtr->context == CONTEXT_WORLD) {
s32 i;
for (i = 1; i < ARRAY_COUNT(playerData->partnerUnlockedTime); i++) {

View File

@ -241,7 +241,7 @@ void destroy_popup_menu(void) {
gPopupMenu->popupType == POPUP_TYPE_TRADE_FOR_BADGE ||
gPopupMenu->popupType == POPUP_TYPE_UPGRADE_PARTNER ||
gPopupMenu->popupType == POPUP_TYPE_USE_KEY
) && !gGameStatusPtr->isBattle) {
) && gGameStatusPtr->context == CONTEXT_WORLD) {
if (!PopupMenu_WasStatusBarIgnoringChanges) {
status_bar_respond_to_changes();
}

View File

@ -184,7 +184,7 @@ void free_animator_nodes(AnimatorNode* root) {
void clear_animator_list(void) {
s32 i;
if (!gGameStatusPtr->isBattle) {
if (gGameStatusPtr->context == CONTEXT_WORLD) {
gCurrentAnimMeshListPtr = &D_801539C0;
for (i = 0; i < ARRAY_COUNT(D_801533C0); i++) {
D_801533C0[i].ttl = -1;
@ -212,7 +212,7 @@ void clear_animator_list(void) {
}
void reset_animator_list(void) {
if (!gGameStatusPtr->isBattle) {
if (gGameStatusPtr->context == CONTEXT_WORLD) {
gCurrentAnimMeshListPtr = &D_801539C0;
} else {
gCurrentAnimMeshListPtr = &D_80153A00;
@ -311,7 +311,7 @@ s32 create_model_animator(s16* animPos) {
animator->staticNodeIDs[j] = j + 1;
}
if (gGameStatusPtr->isBattle) {
if (gGameStatusPtr->context != CONTEXT_WORLD) {
i |= BATTLE_ID_BIT;
}
return i;
@ -351,7 +351,7 @@ s32 create_mesh_animator(s16* animPos, s16* animBuffer) {
animator->staticNodeIDs[j] = j + 1;
}
if (gGameStatusPtr->isBattle) {
if (gGameStatusPtr->context != CONTEXT_WORLD) {
i |= BATTLE_ID_BIT;
}
return i;
@ -434,7 +434,7 @@ void update_model_animator(s32 animatorID) {
s32 temp;
s32 i;
if (gGameStatusPtr->isBattle && !(animatorID & BATTLE_ID_BIT)) {
if (gGameStatusPtr->context != CONTEXT_WORLD && !(animatorID & BATTLE_ID_BIT)) {
return;
}
@ -498,7 +498,7 @@ void update_model_animator_with_transform(s32 animatorID, Mtx* mtx) {
s32 temp;
s32 i;
if (gGameStatusPtr->isBattle && !(animatorID & BATTLE_ID_BIT)) {
if (gGameStatusPtr->context != CONTEXT_WORLD && !(animatorID & BATTLE_ID_BIT)) {
return;
}
@ -717,7 +717,7 @@ void render_animated_model(s32 animatorID, Mtx* rootTransform) {
RenderTask rt;
RenderTask* rtPtr = &rt;
if (gGameStatusPtr->isBattle && !(animatorID & BATTLE_ID_BIT)) {
if (gGameStatusPtr->context != CONTEXT_WORLD && !(animatorID & BATTLE_ID_BIT)) {
return;
}
@ -747,7 +747,7 @@ void render_animated_model_with_vertices(s32 animatorID, Mtx* rootTransform, s32
RenderTask rt;
RenderTask* rtPtr = &rt;
if (gGameStatusPtr->isBattle && !(animatorID & BATTLE_ID_BIT)) {
if (gGameStatusPtr->context != CONTEXT_WORLD && !(animatorID & BATTLE_ID_BIT)) {
return;
}

View File

@ -311,7 +311,7 @@ void sfx_clear_sounds(void) {
// name might be incorrect?
void sfx_clear_env_sounds(s16 playSounds) {
if (!gGameStatusPtr->isBattle) {
if (gGameStatusPtr->context == CONTEXT_WORLD) {
gCurrentEnvSounds = wEnvSounds;
} else {
gCurrentEnvSounds = bEnvSounds;
@ -362,7 +362,7 @@ void sfx_stop_env_sounds(void) {
SoundInstance* sound;
s32 i;
if (!gGameStatusPtr->isBattle) {
if (gGameStatusPtr->context == CONTEXT_WORLD) {
gCurrentEnvSounds = wEnvSounds;
} else {
gCurrentEnvSounds = bEnvSounds;
@ -619,7 +619,7 @@ void sfx_compute_spatialized_sound_params_ignore_depth(f32 x, f32 y, f32 z, s16*
*volume = 1;
}
if (!gGameStatusPtr->isBattle) {
if (gGameStatusPtr->context == CONTEXT_WORLD) {
// 25/75 at screen edge
*pan = (screenX * 0.2f) + 32.0f;
} else {

View File

@ -220,7 +220,7 @@ void load_demo_battle(u32 index) {
gGameStatusPtr->demoBattleFlags = 0;
gGameStatusPtr->areaID = 0;
gGameStatusPtr->mapID = 0;
gGameStatusPtr->isBattle = FALSE;
gGameStatusPtr->context = CONTEXT_WORLD;
general_heap_create();
clear_worker_list();

View File

@ -75,7 +75,7 @@ void update_effects(void) {
if (effectInstance != NULL && (effectInstance->flags & FX_INSTANCE_FLAG_ENABLED)) {
effectInstance->graphics->flags &= ~FX_GRAPHICS_CAN_FREE;
if (gGameStatusPtr->isBattle) {
if (gGameStatusPtr->context != CONTEXT_WORLD) {
if (effectInstance->flags & FX_INSTANCE_FLAG_BATTLE) {
effectInstance->graphics->update(effectInstance);
effectInstance->flags |= FX_INSTANCE_FLAG_HAS_UPDATED;
@ -118,7 +118,7 @@ void render_effects_world(void) {
if (effectInstance != NULL) {
if (effectInstance->flags & FX_INSTANCE_FLAG_ENABLED) {
if (effectInstance->flags & FX_INSTANCE_FLAG_HAS_UPDATED) {
if (gGameStatusPtr->isBattle) {
if (gGameStatusPtr->context != CONTEXT_WORLD) {
if (effectInstance->flags & FX_INSTANCE_FLAG_BATTLE) {
effectInstance->graphics->renderWorld(effectInstance);
}
@ -145,11 +145,11 @@ void render_effects_UI(void) {
if (effectInstance->flags & FX_INSTANCE_FLAG_HAS_UPDATED) {
void (*renderUI)(EffectInstance* effect);
if (gGameStatusPtr->isBattle && !(effectInstance->flags & FX_INSTANCE_FLAG_BATTLE)) {
if (gGameStatusPtr->context != CONTEXT_WORLD && !(effectInstance->flags & FX_INSTANCE_FLAG_BATTLE)) {
continue;
}
if (!gGameStatusPtr->isBattle && effectInstance->flags & FX_INSTANCE_FLAG_BATTLE) {
if (gGameStatusPtr->context == CONTEXT_WORLD && effectInstance->flags & FX_INSTANCE_FLAG_BATTLE) {
continue;
}
@ -245,7 +245,7 @@ EffectInstance* create_effect_instance(EffectBlueprint* effectBp) {
effectBp->init(newEffectInst);
}
if (gGameStatusPtr->isBattle) {
if (gGameStatusPtr->context != CONTEXT_WORLD) {
newEffectInst->flags |= FX_INSTANCE_FLAG_BATTLE;
}
return newEffectInst;

View File

@ -167,7 +167,7 @@ void fire_breath_render(EffectInstance* effect) {
renderTask.appendGfx = fire_breath_appendGfx;
renderTask.appendGfxArg = effect;
if (gGameStatusPtr->isBattle == TRUE) {
if (gGameStatusPtr->context == CONTEXT_BATTLE) {
renderTask.dist = data->pos.z + 1000.0f;
} else {
renderTask.dist = 0;

View File

@ -101,7 +101,7 @@ EffectInstance* lightning_main(
s32 effectArg0;
load_effect(EFFECT_FLASHING_BOX_SHOCKWAVE);
if (gGameStatusPtr->isBattle == TRUE) {
if (gGameStatusPtr->context == CONTEXT_BATTLE) {
effectArg0 = FX_SHOCK_OVERLAY_LIGHTNING_BATTLE;
} else {
effectArg0 = FX_SHOCK_OVERLAY_LIGHTNING_WORLD;

View File

@ -155,7 +155,7 @@ void lightning_bolt_render(EffectInstance *effect) {
renderTask.appendGfx = lightning_bolt_appendGfx;
renderTask.appendGfxArg = effect;
if (gGameStatusPtr->isBattle == TRUE) {
if (gGameStatusPtr->context == CONTEXT_BATTLE) {
renderTask.dist = data->tipPos.z + 1000.0f;
} else {
renderTask.dist = 10;

View File

@ -151,7 +151,7 @@ void star_update(EffectInstance* effect) {
load_effect(EFFECT_LANDING_DUST);
landing_dust_main(0, data->pos.x, data->pos.y - 5.0f, data->pos.z, 0.0f);
if (!gGameStatusPtr->isBattle) {
if (gGameStatusPtr->context == CONTEXT_WORLD) {
sfx_play_sound_at_position(SOUND_SEQ_SHOOTING_STAR_BOUNCE, SOUND_SPACE_DEFAULT, data->pos.x, data->pos.y, data->pos.z);
}

View File

@ -848,16 +848,16 @@ API_CALLABLE(OnPlayerFled) {
Bytecode* args = script->ptrReadPos;
s32 skipReaction = evt_get_variable(script, *args++);
enemy->aiFlags |= ENEMY_AI_FLAG_SUSPEND;
enemy->aiFlags |= AI_FLAG_SUSPEND;
if (!skipReaction) {
EffectInstance* emoteEffect;
if (!(enemy->aiFlags & ENEMY_AI_FLAG_10)) {
if (!(enemy->aiFlags & AI_FLAG_SKIP_IDLE_ANIM_AFTER_FLEE)) {
npc->curAnim = enemy->animList[ENEMY_ANIM_INDEX_IDLE];
}
if (!(enemy->aiFlags & ENEMY_AI_FLAG_8)) {
if (!(enemy->aiFlags & AI_FLAG_SKIP_EMOTE_AFTER_FLEE)) {
fx_emote(EMOTE_QUESTION, npc, 0.0f, npc->collisionHeight, 1.0f, 0.0f, -20.0f, 40, &emoteEffect);
}

View File

@ -345,7 +345,7 @@ void render_entities(void) {
Entity* entity = get_entity_by_index(i);
if (entity != NULL) {
if (!gGameStatusPtr->isBattle) {
if (gGameStatusPtr->context == CONTEXT_WORLD) {
if (gEntityHideMode != ENTITY_HIDE_MODE_0 &&
!(entity->flags & ENTITY_FLAG_IGNORE_DISTANCE_CULLING) &&
dist2D(gPlayerStatusPtr->pos.x,
@ -541,7 +541,7 @@ Shadow* get_shadow_by_index(s32 index) {
EntityList* get_entity_list(void) {
EntityList* ret;
if (!gGameStatusPtr->isBattle) {
if (gGameStatusPtr->context == CONTEXT_WORLD) {
ret = &gWorldEntityList;
} else {
ret = &gBattleEntityList;
@ -552,7 +552,7 @@ EntityList* get_entity_list(void) {
ShadowList* get_shadow_list(void) {
ShadowList* ret;
if (!gGameStatusPtr->isBattle) {
if (gGameStatusPtr->context == CONTEXT_WORLD) {
ret = &gWorldShadowList;
} else {
ret = &gBattleShadowList;
@ -795,7 +795,7 @@ void clear_entity_data(b32 arg0) {
entity_updateCounter = 0;
D_80151304 = 0;
if (!gGameStatusPtr->isBattle) {
if (gGameStatusPtr->context == CONTEXT_WORLD) {
gEntityHideMode = ENTITY_HIDE_MODE_0;
}
@ -807,7 +807,7 @@ void clear_entity_data(b32 arg0) {
}
D_8014AFB0 = 255;
if (!gGameStatusPtr->isBattle) {
if (gGameStatusPtr->context == CONTEXT_WORLD) {
wEntityDataLoadedSize = 0;
for (i = 0; i < MAX_ENTITIES; i++) {
wEntityBlueprint[i] = NULL;
@ -819,7 +819,7 @@ void clear_entity_data(b32 arg0) {
}
}
if (!gGameStatusPtr->isBattle) {
if (gGameStatusPtr->context == CONTEXT_WORLD) {
gEntityHeapBottom = WORLD_ENTITY_HEAP_BOTTOM;
gEntityHeapBase = WORLD_ENTITY_HEAP_BASE;
} else {
@ -840,7 +840,7 @@ void clear_entity_data(b32 arg0) {
}
void init_entity_data(void) {
if (!gGameStatusPtr->isBattle) {
if (gGameStatusPtr->context == CONTEXT_WORLD) {
gEntityHeapBottom = WORLD_ENTITY_HEAP_BOTTOM;
gEntityHeapBase = WORLD_ENTITY_HEAP_BASE;
reload_world_entity_data();
@ -957,7 +957,7 @@ s32 is_entity_data_loaded(Entity* entity, EntityBlueprint* blueprint, s32* loade
*loadedEnd = 0;
ret = FALSE;
if (!gGameStatusPtr->isBattle) {
if (gGameStatusPtr->context == CONTEXT_WORLD) {
blueprints = wEntityBlueprint;
} else {
blueprints = bEntityBlueprint;
@ -1016,7 +1016,7 @@ void load_simple_entity_data(Entity* entity, EntityBlueprint* bp, s32 listIndex)
s32 totalSize;
entity->vertexSegment = 0xA;
if (!gGameStatusPtr->isBattle) {
if (gGameStatusPtr->context == CONTEXT_WORLD) {
totalSize = wEntityDataLoadedSize;
} else {
totalSize = bEntityDataLoadedSize;
@ -1038,7 +1038,7 @@ void load_simple_entity_data(Entity* entity, EntityBlueprint* bp, s32 listIndex)
get_entity_type(entity->listIndex);
}
if (!gGameStatusPtr->isBattle) {
if (gGameStatusPtr->context == CONTEXT_WORLD) {
wEntityDataLoadedSize = totalSize;
} else {
bEntityDataLoadedSize = totalSize;
@ -1091,7 +1091,7 @@ void load_split_entity_data(Entity* entity, EntityBlueprint* entityData, s32 lis
animBaseAddr = (void*)(gEntityHeapBottom + specialSize * 4 + dma1size * 4);
swizzlePointers = TRUE;
} else if (is_entity_data_loaded(entity, entityData, &loadedStart, &loadedEnd)) {
if (!gGameStatusPtr->isBattle) {
if (gGameStatusPtr->context == CONTEXT_WORLD) {
totalLoaded = wEntityDataLoadedSize;
} else {
totalLoaded = bEntityDataLoadedSize;
@ -1116,7 +1116,7 @@ void load_split_entity_data(Entity* entity, EntityBlueprint* entityData, s32 lis
totalLoaded += dma2size_2;
get_entity_type(entity->listIndex);
if (!gGameStatusPtr->isBattle) {
if (gGameStatusPtr->context == CONTEXT_WORLD) {
wEntityDataLoadedSize = totalLoaded;
} else {
bEntityDataLoadedSize = totalLoaded;
@ -1688,7 +1688,7 @@ s32 entity_raycast_down(f32* x, f32* y, f32* z, f32* hitYaw, f32* hitPitch, f32*
}
void set_standard_shadow_scale(Shadow* shadow, f32 height) {
if (!gGameStatusPtr->isBattle) {
if (gGameStatusPtr->context == CONTEXT_WORLD) {
shadow->scale.x = 0.13 - (height / 2600.0f);
} else {
shadow->scale.x = 0.12 - (height / 3600.0f);
@ -1701,7 +1701,7 @@ void set_standard_shadow_scale(Shadow* shadow, f32 height) {
}
void set_npc_shadow_scale(Shadow* shadow, f32 height, f32 npcRadius) {
if (!gGameStatusPtr->isBattle) {
if (gGameStatusPtr->context == CONTEXT_WORLD) {
shadow->scale.x = 0.13 - (height / 2600.0f);
} else {
shadow->scale.x = 0.12 - (height / 3600.0f);
@ -1722,7 +1722,7 @@ void set_peach_shadow_scale(Shadow* shadow, f32 scale) {
PlayerStatus* playerStatus = &gPlayerStatus;
f32 phi_f2 = 0.12f;
if (!gGameStatusPtr->isBattle) {
if (gGameStatusPtr->context == CONTEXT_WORLD) {
switch (playerStatus->anim) {
case ANIM_Peach2_Carried:
case ANIM_Peach2_Thrown:

View File

@ -51,7 +51,7 @@ void free_entity_model_by_ref(EntityModel* entityModel);
void clear_entity_models(void) {
s32 i;
if (!gGameStatusPtr->isBattle) {
if (gGameStatusPtr->context == CONTEXT_WORLD) {
gCurrentEntityModelList = &gWorldEntityModelList;
} else {
gCurrentEntityModelList = &gBattleEntityModelList;
@ -74,7 +74,7 @@ void clear_entity_models(void) {
void init_entity_models(void) {
s32 i;
if (!gGameStatusPtr->isBattle) {
if (gGameStatusPtr->context == CONTEXT_WORLD) {
gCurrentEntityModelList = &gWorldEntityModelList;
} else {
gCurrentEntityModelList = &gBattleEntityModelList;
@ -121,7 +121,7 @@ s32 load_entity_model(EntityModelScript* cmdList) {
newEntityModel->fpSetupGfxCallback = NULL;
newEntityModel->cmdListSavedPos = newEntityModel->cmdListReadPos;
if (gGameStatusPtr->isBattle) {
if (gGameStatusPtr->context != CONTEXT_WORLD) {
i |= BATTLE_ENTITY_ID_BIT;
}
return i;
@ -163,7 +163,7 @@ s32 ALT_load_entity_model(EntityModelScript* cmdList) {
newEntityModel->fpSetupGfxCallback = NULL;
newEntityModel->cmdListSavedPos = newEntityModel->cmdListReadPos;
if (gGameStatusPtr->isBattle) {
if (gGameStatusPtr->context != CONTEXT_WORLD) {
i |= BATTLE_ENTITY_ID_BIT;
}
return i;
@ -172,7 +172,7 @@ s32 ALT_load_entity_model(EntityModelScript* cmdList) {
void exec_entity_model_commandlist(s32 idx) {
EntityModel* entityModel;
if (!gGameStatusPtr->isBattle || (idx & BATTLE_ENTITY_ID_BIT)) {
if (gGameStatusPtr->context == CONTEXT_WORLD || (idx & BATTLE_ENTITY_ID_BIT)) {
idx &= ~BATTLE_ENTITY_ID_BIT;
entityModel = (*gCurrentEntityModelList)[idx];
if (entityModel != NULL && (entityModel->flags)) {
@ -412,7 +412,7 @@ void draw_entity_model_A(s32 modelIdx, Mtx* transformMtx) {
f32 x, y, z, w;
f32 inX, inY, inZ;
if ((!gGameStatusPtr->isBattle) || (modelIdx & BATTLE_ENTITY_ID_BIT)) {
if ((gGameStatusPtr->context == CONTEXT_WORLD) || (modelIdx & BATTLE_ENTITY_ID_BIT)) {
modelIdx &= ~BATTLE_ENTITY_ID_BIT;
model = (*gCurrentEntityModelList)[modelIdx];
@ -450,7 +450,7 @@ void draw_entity_model_B(s32 modelIdx, Mtx* transformMtx, s32 vertexSegment, Vec
f32 x, y, z, w;
f32 inX, inY, inZ;
if ((!gGameStatusPtr->isBattle) || (modelIdx & BATTLE_ENTITY_ID_BIT)) {
if ((gGameStatusPtr->context == CONTEXT_WORLD) || (modelIdx & BATTLE_ENTITY_ID_BIT)) {
modelIdx &= ~BATTLE_ENTITY_ID_BIT;
model = (*gCurrentEntityModelList)[modelIdx];
@ -485,7 +485,7 @@ void draw_entity_model_C(s32 modelIdx, Mtx* transformMtx) {
RenderTask rt;
RenderTask* rtPtr = &rt;
if ((!gGameStatusPtr->isBattle) || (modelIdx & BATTLE_ENTITY_ID_BIT)) {
if ((gGameStatusPtr->context == CONTEXT_WORLD) || (modelIdx & BATTLE_ENTITY_ID_BIT)) {
modelIdx &= ~BATTLE_ENTITY_ID_BIT;
model = (*gCurrentEntityModelList)[modelIdx];
@ -515,7 +515,7 @@ void draw_entity_model_D(s32 modelIdx, Mtx* transformMtx, s32 arg2, Vec3s* verte
RenderTask rt;
RenderTask* rtPtr = &rt;
if ((!gGameStatusPtr->isBattle) || (modelIdx & BATTLE_ENTITY_ID_BIT)) {
if ((gGameStatusPtr->context == CONTEXT_WORLD) || (modelIdx & BATTLE_ENTITY_ID_BIT)) {
modelIdx &= ~BATTLE_ENTITY_ID_BIT;
model = (*gCurrentEntityModelList)[modelIdx];

View File

@ -278,7 +278,7 @@ API_CALLABLE(ShakeCam) {
*(f32*)&script->functionTemp[3] = 1.0f; //TODO functionTempF ?
script->functionTemp[1] = duration;
if (!gGameStatusPtr->isBattle) {
if (gGameStatusPtr->context == CONTEXT_WORLD) {
if (magnitude > 10.0f) {
magnitude = 10.0f;
}

View File

@ -50,7 +50,7 @@ void render_animated_models(void) {
// split here?
API_CALLABLE(InitAnimatedModels) {
if (!gGameStatusPtr->isBattle) {
if (gGameStatusPtr->context == CONTEXT_WORLD) {
gCurrentMeshAnimationListPtr = &gWorldMeshAnimationList;
} else {
gCurrentMeshAnimationListPtr = &gBattleMeshAnimationList;
@ -258,7 +258,7 @@ API_CALLABLE(SetAnimatorFlags) {
void reset_model_animators(void) {
s32 i;
if (!gGameStatusPtr->isBattle ) {
if (gGameStatusPtr->context == CONTEXT_WORLD ) {
gCurrentMeshAnimationListPtr = &gWorldMeshAnimationList;
} else {
gCurrentMeshAnimationListPtr = &gBattleMeshAnimationList;
@ -276,7 +276,7 @@ void reset_model_animators(void) {
}
void init_model_animators(void) {
if (!gGameStatusPtr->isBattle) {
if (gGameStatusPtr->context == CONTEXT_WORLD) {
gCurrentMeshAnimationListPtr = &gWorldMeshAnimationList;
} else {
gCurrentMeshAnimationListPtr = &gBattleMeshAnimationList;

View File

@ -170,7 +170,7 @@ void find_script_labels(Evt* script) {
void clear_script_list(void) {
s32 i;
if (!gGameStatusPtr->isBattle) {
if (gGameStatusPtr->context == CONTEXT_WORLD) {
gCurrentScriptListPtr = &gWorldScriptList;
gMapVars = gWorldMapVars;
gMapFlags = gWorldMapFlags;
@ -201,7 +201,7 @@ void clear_script_list(void) {
}
void init_script_list(void) {
if (!gGameStatusPtr->isBattle) {
if (gGameStatusPtr->context == CONTEXT_WORLD) {
gCurrentScriptListPtr = &gWorldScriptList;
gMapVars = gWorldMapVars;
gMapFlags = gWorldMapFlags;

View File

@ -119,7 +119,7 @@ void virtual_entity_list_render_UI(void) {
}
API_CALLABLE(InitVirtualEntityList) {
if (!gGameStatusPtr->isBattle) {
if (gGameStatusPtr->context == CONTEXT_WORLD) {
gCurrentVirtualEntityListPtr = &wWorldVirtualEntityList;
} else {
gCurrentVirtualEntityListPtr = &bBattleVirtualEntityList;
@ -654,7 +654,7 @@ void virtual_entity_delete_by_ref(VirtualEntity* obj) {
void clear_virtual_entity_list(void) {
s32 i;
if (!gGameStatusPtr->isBattle) {
if (gGameStatusPtr->context == CONTEXT_WORLD) {
gCurrentVirtualEntityListPtr = &wWorldVirtualEntityList;
} else {
gCurrentVirtualEntityListPtr = &bBattleVirtualEntityList;
@ -671,7 +671,7 @@ void clear_virtual_entity_list(void) {
}
void init_virtual_entity_list(void) {
if (!gGameStatusPtr->isBattle) {
if (gGameStatusPtr->context == CONTEXT_WORLD) {
gCurrentVirtualEntityListPtr = &wWorldVirtualEntityList;
} else {
gCurrentVirtualEntityListPtr = &bBattleVirtualEntityList;

View File

@ -32,7 +32,7 @@ s32 func_8002ACDC(void) {
}
void* heap_malloc(s32 size) {
if (!gGameStatusPtr->isBattle) {
if (gGameStatusPtr->context == CONTEXT_WORLD) {
return general_heap_malloc(size);
} else {
return _heap_malloc(&heap_battleHead, size);
@ -40,7 +40,7 @@ void* heap_malloc(s32 size) {
}
s32 heap_free(void* data) {
if (gGameStatusPtr->isBattle) {
if (gGameStatusPtr->context != CONTEXT_WORLD) {
return _heap_free(&heap_battleHead, data);
} else {
return general_heap_free(data);
@ -55,7 +55,7 @@ s32 collision_heap_create(void) {
}
void* collision_heap_malloc(s32 size) {
if (!gGameStatusPtr->isBattle) {
if (gGameStatusPtr->context == CONTEXT_WORLD) {
return _heap_malloc(&heap_collisionHead, size);
} else {
return _heap_malloc(&heap_battleHead, size);
@ -63,7 +63,7 @@ void* collision_heap_malloc(s32 size) {
}
s32 collision_heap_free(void* data) {
if (gGameStatusPtr->isBattle) {
if (gGameStatusPtr->context != CONTEXT_WORLD) {
return _heap_free(&heap_battleHead, data);
} else {
return _heap_free(&heap_collisionHead, data);

View File

@ -190,7 +190,7 @@ void hud_element_load_script(HudElement* hudElement, HudScript* anim) {
if (entry->id == -1) {
entry->id = raster;
entry->data = &gHudElementCacheBuffer[*gHudElementCacheSize];
if (!gGameStatusPtr->isBattle) {
if (gGameStatusPtr->context == CONTEXT_WORLD) {
capacity = gHudElementCacheCapacity;
} else {
capacity = gHudElementCacheCapacity / 2;
@ -198,7 +198,7 @@ void hud_element_load_script(HudElement* hudElement, HudScript* anim) {
ASSERT(capacity > *gHudElementCacheSize + gHudElementSizes[preset].size);
nuPiReadRom((s32)icon_ROM_START + raster, entry->data, gHudElementSizes[preset].size);
*gHudElementCacheSize += gHudElementSizes[preset].size;
if (!gGameStatusPtr->isBattle) {
if (gGameStatusPtr->context == CONTEXT_WORLD) {
*pos = i;
} else {
*pos = (u16)(*pos) | (i << 16);
@ -206,7 +206,7 @@ void hud_element_load_script(HudElement* hudElement, HudScript* anim) {
i++;
break;
} else if (entry->id == raster) {
if (!gGameStatusPtr->isBattle) {
if (gGameStatusPtr->context == CONTEXT_WORLD) {
*pos = i;
} else {
*pos = (u16)(*pos) | (i << 16);
@ -226,7 +226,7 @@ void hud_element_load_script(HudElement* hudElement, HudScript* anim) {
if (entry->id == -1) {
entry->id = palette;
entry->data = &gHudElementCacheBuffer[*gHudElementCacheSize];
if (!gGameStatusPtr->isBattle) {
if (gGameStatusPtr->context == CONTEXT_WORLD) {
capacity = gHudElementCacheCapacity;
} else {
capacity = gHudElementCacheCapacity / 2;
@ -234,7 +234,7 @@ void hud_element_load_script(HudElement* hudElement, HudScript* anim) {
ASSERT(capacity > *gHudElementCacheSize + 32);
nuPiReadRom((s32)icon_ROM_START + palette, entry->data, 32);
*gHudElementCacheSize += 32;
if (!gGameStatusPtr->isBattle) {
if (gGameStatusPtr->context == CONTEXT_WORLD) {
*pos = i;
} else {
*pos = (u16)(*pos) | (i << 16);
@ -242,7 +242,7 @@ void hud_element_load_script(HudElement* hudElement, HudScript* anim) {
i++;
break;
} else if (entry->id == palette) {
if (!gGameStatusPtr->isBattle) {
if (gGameStatusPtr->context == CONTEXT_WORLD) {
*pos = i;
} else {
*pos = (u16)(*pos) | (i << 16);
@ -610,7 +610,7 @@ void hud_element_clear_cache(void) {
HudCacheEntry* entryRaster;
HudCacheEntry* entryPalette;
if (!gGameStatusPtr->isBattle) {
if (gGameStatusPtr->context == CONTEXT_WORLD) {
gHudElements = &gHudElementsWorld;
gHudElementCacheSize = &gHudElementCacheSizeWorld;
gHudElementCacheTableRaster = gHudElementCacheTableRasterWorld;
@ -622,7 +622,7 @@ void hud_element_clear_cache(void) {
gHudElementCacheTablePalette = gHudElementCacheTablePaletteBattle;
}
if (!gGameStatusPtr->isBattle) {
if (gGameStatusPtr->context == CONTEXT_WORLD) {
gHudElementCacheBuffer = general_heap_malloc(gHudElementCacheCapacity);
ASSERT(gHudElementCacheBuffer);
gHudElementCacheBufferWorld = gHudElementCacheBuffer;
@ -664,7 +664,7 @@ extern Addr D_80200000;
#endif
void init_hud_element_list(void) {
if (!gGameStatusPtr->isBattle) {
if (gGameStatusPtr->context == CONTEXT_WORLD) {
if (gHudElementCacheBufferBattle != NULL) {
#if VERSION_PAL
if (gHudElementCacheBufferBattle != D_80200000) {
@ -755,7 +755,7 @@ s32 hud_element_create(HudScript* anim) {
hudElement->tint.g = 255;
hudElement->tint.b = 255;
if (gGameStatusPtr->isBattle) {
if (gGameStatusPtr->context != CONTEXT_WORLD) {
hudElement->flags |= HUD_ELEMENT_FLAG_BATTLE;
id |= HUD_ELEMENT_BATTLE_ID_MASK;
}
@ -2042,7 +2042,7 @@ void hud_element_clear_flags(s32 id, s32 flags) {
void ALT_clear_hud_element_cache(void) {
s32 i;
if (!gGameStatusPtr->isBattle) {
if (gGameStatusPtr->context == CONTEXT_WORLD) {
heap_free(gHudElementCacheBuffer);
gHudElementCacheBuffer = heap_malloc(gHudElementCacheCapacity);
ASSERT(gHudElementCacheBuffer);

View File

@ -1526,7 +1526,7 @@ void imgfx_appendGfx_mesh_basic(ImgFXState* state, Matrix4f mtx) {
) {
cam = &gCameras[gCurrentCamID];
if (gGameStatusPtr->isBattle == 2) {
if (gGameStatusPtr->context == CONTEXT_PAUSE) {
gSPViewport(gMainGfxPos++, &D_8014EE50);
} else {
gSPViewport(gMainGfxPos++, &cam->vpAlt);
@ -1565,7 +1565,7 @@ void imgfx_appendGfx_mesh_basic(ImgFXState* state, Matrix4f mtx) {
alpha2 = 255;
cam = &gCameras[gCurrentCamID];
if (gGameStatusPtr->isBattle == 2) {
if (gGameStatusPtr->context == CONTEXT_PAUSE) {
gSPViewport(gMainGfxPos++, &D_8014EE50);
} else {
gSPViewport(gMainGfxPos++, &cam->vpAlt);
@ -1620,7 +1620,7 @@ void imgfx_appendGfx_mesh_basic(ImgFXState* state, Matrix4f mtx) {
&& (state->flags & someFlags)
) {
cam = &gCameras[gCurrentCamID];
if (gGameStatusPtr->isBattle == 2) {
if (gGameStatusPtr->context == CONTEXT_PAUSE) {
gSPViewport(gMainGfxPos++, &D_8014EE40);
D_8014EE50.vp.vtrans[0] = D_8014EE40.vp.vtrans[0] + gGameStatusPtr->altViewportOffset.x;
D_8014EE50.vp.vtrans[1] = D_8014EE40.vp.vtrans[1] + gGameStatusPtr->altViewportOffset.y;

View File

@ -578,7 +578,7 @@ void update_status_bar(void) {
return;
}
if (!gGameStatusPtr->isBattle && playerData->coins != statusBar->displayCoins) {
if (gGameStatusPtr->context == CONTEXT_WORLD && playerData->coins != statusBar->displayCoins) {
status_bar_start_blinking_coins();
}
@ -626,7 +626,7 @@ void update_status_bar(void) {
// sync displayed HP toward true HP
if (statusBar->displayHP != playerData->curHP) {
if (!gGameStatusPtr->isBattle && playerData->curHP < statusBar->displayHP) {
if (gGameStatusPtr->context == CONTEXT_WORLD && playerData->curHP < statusBar->displayHP) {
status_bar_start_blinking_hp();
}
if (statusBar->displayHP < playerData->curHP) {
@ -645,7 +645,7 @@ void update_status_bar(void) {
// sync displayed FP toward true FP
if (statusBar->displayFP != playerData->curFP) {
if (!gGameStatusPtr->isBattle && playerData->curFP < statusBar->displayFP) {
if (gGameStatusPtr->context == CONTEXT_WORLD && playerData->curFP < statusBar->displayFP) {
status_bar_start_blinking_fp();
}
if (statusBar->displayFP < playerData->curFP) {
@ -700,7 +700,7 @@ void update_status_bar(void) {
} else {
if (!statusBar->ignoreChanges) {
if (!statusBar->unk_3B || playerStatus->actionState != ACTION_STATE_IDLE) {
if (!gGameStatusPtr->isBattle) {
if (gGameStatusPtr->context == CONTEXT_WORLD) {
statusBar->hidden = TRUE;
statusBar->showTimer = 0;
statusBar->unk_3C = FALSE;
@ -723,7 +723,7 @@ void update_status_bar(void) {
statusBar->showTimer++;
}
if (statusBar->showTimer >= 240 && !gGameStatusPtr->isBattle) {
if (statusBar->showTimer >= 240 && gGameStatusPtr->context == CONTEXT_WORLD) {
statusBar->showTimer = 210;
statusBar->hidden = FALSE;
statusBar->unk_3B = TRUE;
@ -1372,7 +1372,7 @@ s32 is_status_bar_visible(void) {
void status_bar_start_blinking_hp(void) {
StatusBar* statusBar = &gStatusBar;
if (!gGameStatusPtr->isBattle) {
if (gGameStatusPtr->context == CONTEXT_WORLD) {
statusBar->hpBlinkTimer = 120;
}
@ -1395,7 +1395,7 @@ void status_bar_stop_blinking_hp(void) {
void status_bar_start_blinking_fp(void) {
StatusBar* statusBar = &gStatusBar;
if (!gGameStatusPtr->isBattle) {
if (gGameStatusPtr->context == CONTEXT_WORLD) {
statusBar->fpBlinkTimer = 120;
}
@ -1417,7 +1417,7 @@ void status_bar_stop_blinking_fp(void) {
void status_bar_start_blinking_coins(void) {
StatusBar* statusBar = &gStatusBar;
if (!gGameStatusPtr->isBattle) {
if (gGameStatusPtr->context == CONTEXT_WORLD) {
statusBar->coinsBlinkTimer = 120;
}

View File

@ -242,7 +242,7 @@ void reveal_item_entity(ItemEntity* item) {
void clear_item_entity_data(void) {
s32 i;
if (!gGameStatusPtr->isBattle) {
if (gGameStatusPtr->context == CONTEXT_WORLD) {
gCurrentItemEntities = WorldItemEntities;
} else {
gCurrentItemEntities = BattleItemEntities;
@ -258,7 +258,7 @@ void clear_item_entity_data(void) {
CoinSparkleCenterZ = 0;
ItemEntityAlternatingSpawn = 0;
if (!gGameStatusPtr->isBattle) {
if (gGameStatusPtr->context == CONTEXT_WORLD) {
ItemEntityRenderGroup = 0;
}
@ -271,7 +271,7 @@ void clear_item_entity_data(void) {
}
void init_item_entity_list(void) {
if (!gGameStatusPtr->isBattle) {
if (gGameStatusPtr->context == CONTEXT_WORLD) {
gCurrentItemEntities = WorldItemEntities;
} else {
gCurrentItemEntities = BattleItemEntities;
@ -327,7 +327,7 @@ void item_entity_load(ItemEntity* item) {
ASSERT(*gHudElementCacheSize + size < 0x11000);
nuPiReadRom((s32)icon_ROM_START + raster, entry->data, size);
*gHudElementCacheSize += size;
if (!gGameStatusPtr->isBattle) {
if (gGameStatusPtr->context == CONTEXT_WORLD) {
*pos = i;
} else {
*pos = (u16)(*pos) | (i << 16);
@ -337,7 +337,7 @@ void item_entity_load(ItemEntity* item) {
} else {
cond = entry->id == raster; // TODO required to match
if (cond) {
if (!gGameStatusPtr->isBattle) {
if (gGameStatusPtr->context == CONTEXT_WORLD) {
*pos = i;
} else {
*pos = (u16)(*pos) | (i << 16);
@ -360,7 +360,7 @@ void item_entity_load(ItemEntity* item) {
ASSERT(*gHudElementCacheSize + 0x20 < 0x11000);
nuPiReadRom((s32)icon_ROM_START + palette, entry->data, 0x20);
*gHudElementCacheSize += 0x20;
if (!gGameStatusPtr->isBattle) {
if (gGameStatusPtr->context == CONTEXT_WORLD) {
*pos = i;
} else {
*pos = (u16)(*pos) | (i << 16);
@ -368,7 +368,7 @@ void item_entity_load(ItemEntity* item) {
pos++;
break;
} else if (entry->id == palette) {
if (!gGameStatusPtr->isBattle) {
if (gGameStatusPtr->context == CONTEXT_WORLD) {
*pos = i;
} else {
*pos = (u16)(*pos) | (i << 16);
@ -791,7 +791,7 @@ void item_entity_update(ItemEntity* entity) {
entity->nextUpdate = *args++;
*args++;
*args++;
if (!gGameStatusPtr->isBattle) {
if (gGameStatusPtr->context == CONTEXT_WORLD) {
entity->lookupRasterIndex = *args++;
entity->lookupPaletteIndex = *args++;
} else {

View File

@ -2318,7 +2318,7 @@ void mdl_load_all_textures(ModelNode* rootModel, s32 romOffset, s32 size) {
s32 baseOffset = 0;
// textures are loaded to the upper half of the texture heap when not in the world
if (gGameStatusPtr->isBattle != 0) {
if (gGameStatusPtr->context != CONTEXT_WORLD) {
baseOffset = WORLD_TEXTURE_MEMORY_SIZE;
}
@ -2359,7 +2359,7 @@ s32 mdl_get_child_count(ModelNode* model) {
void clear_model_data(void) {
s32 i;
if (!gGameStatusPtr->isBattle) {
if (gGameStatusPtr->context == CONTEXT_WORLD) {
gCurrentModels = &wModelList;
gCurrentTransformGroups = &wTransformGroups;
gCurrentCustomModelGfxPtr = &wCustomModelGfx;
@ -2424,7 +2424,7 @@ void clear_model_data(void) {
}
void init_model_data(void) {
if (!gGameStatusPtr->isBattle) {
if (gGameStatusPtr->context == CONTEXT_WORLD) {
gCurrentModels = &wModelList;
gCurrentTransformGroups = &wTransformGroups;
gCurrentCustomModelGfxPtr = &wCustomModelGfx;

View File

@ -77,7 +77,7 @@ void mtx_ident_mirror_y(Matrix4f mtx) {
void clear_npcs(void) {
s32 i;
if (!gGameStatusPtr->isBattle) {
if (gGameStatusPtr->context == CONTEXT_WORLD) {
gCurrentNpcListPtr = &gWorldNpcList;
} else {
gCurrentNpcListPtr = &gBattleNpcList;
@ -92,7 +92,7 @@ void clear_npcs(void) {
}
void init_npc_list(void) {
if (!gGameStatusPtr->isBattle) {
if (gGameStatusPtr->context == CONTEXT_WORLD) {
gCurrentNpcListPtr = &gWorldNpcList;
} else {
gCurrentNpcListPtr = &gBattleNpcList;
@ -207,7 +207,7 @@ s32 create_npc_impl(NpcBlueprint* blueprint, AnimID* animList, s32 isPeachNpc) {
npc->shadowIndex = create_shadow_type(SHADOW_VARYING_CIRCLE, npc->pos.x, npc->pos.y, npc->pos.z);
npc->shadowScale = 1.0f;
if (gGameStatusPtr->isBattle) {
if (gGameStatusPtr->context != CONTEXT_WORLD) {
i |= BATTLE_NPC_ID_BIT;
}
return i;

View File

@ -479,7 +479,7 @@ void func_80138198(void) {
void render_screen_overlay_frontUI(void) {
if (screen_overlay_frontType != OVERLAY_NONE
&& screen_overlay_frontZoom != -1.0f
&& gGameStatusPtr->isBattle != 2
&& gGameStatusPtr->context != CONTEXT_PAUSE
) {
_render_transition_stencil(screen_overlay_frontType, screen_overlay_frontZoom, &ScreenOverlays[0]);
}
@ -488,7 +488,7 @@ void render_screen_overlay_frontUI(void) {
void render_screen_overlay_backUI(void) {
if (screen_overlay_backType != OVERLAY_NONE
&& screen_overlay_backZoom != -1.0f
&& gGameStatusPtr->isBattle != 2
&& gGameStatusPtr->context != CONTEXT_PAUSE
) {
_render_transition_stencil(screen_overlay_backType, screen_overlay_backZoom, &ScreenOverlays[1]);
}

View File

@ -241,7 +241,7 @@ void spr_appendGfx_component_flat(
gDPSetTileSize(gMainGfxPos++, 2, 0, 0, 63 << 2, 0);
if (gSpriteShadingProfile->flags & SPR_SHADING_FLAG_SET_VIEWPORT) {
Camera* camera = &gCameras[gCurrentCamID];
if (gGameStatusPtr->isBattle == 2) {
if (gGameStatusPtr->context == CONTEXT_PAUSE) {
gSPViewport(gMainGfxPos++, &SprPauseVpAlt);
} else {
gSPViewport(gMainGfxPos++, &camera->vpAlt);
@ -268,7 +268,7 @@ void spr_appendGfx_component_flat(
256, 256);
if (gSpriteShadingProfile->flags & SPR_SHADING_FLAG_SET_VIEWPORT) {
Camera* camera = &gCameras[gCurrentCamID];
if (gGameStatusPtr->isBattle == 2) {
if (gGameStatusPtr->context == CONTEXT_PAUSE) {
gSPViewport(gMainGfxPos++, &SprPauseVpAlt);
} else {
gSPViewport(gMainGfxPos++, &camera->vpAlt);
@ -304,7 +304,7 @@ void spr_appendGfx_component_flat(
if (gSpriteShadingProfile->flags & SPR_SHADING_FLAG_SET_VIEWPORT) {
Camera* camera = &gCameras[gCurrentCamID];
if (gGameStatusPtr->isBattle == 2) {
if (gGameStatusPtr->context == CONTEXT_PAUSE) {
gSPViewport(gMainGfxPos++, &SprPauseVp);
SprPauseVpAlt.vp.vtrans[0] = SprPauseVp.vp.vtrans[0] + gGameStatusPtr->altViewportOffset.x;
SprPauseVpAlt.vp.vtrans[1] = SprPauseVp.vp.vtrans[1] + gGameStatusPtr->altViewportOffset.y;

View File

@ -37,7 +37,7 @@ void clear_sprite_shading_data(void) {
}
void init_sprite_shading_data(void) {
if (!gGameStatusPtr->isBattle) {
if (gGameStatusPtr->context == CONTEXT_WORLD) {
gSpriteShadingProfile = &wSpriteShadingProfile;
gAuxSpriteShadingProfile = &wSpriteShadingProfileAux;
} else {

View File

@ -57,7 +57,7 @@ void state_step_battle(void) {
nuContRmbForceStopEnd();
sfx_stop_env_sounds();
func_8003B1A8();
gGameStatusPtr->isBattle = TRUE;
gGameStatusPtr->context = CONTEXT_BATTLE;
backup_map_collision_data();
#if !VERSION_IQUE
@ -146,7 +146,7 @@ void state_step_end_battle(void) {
mapSettings = get_current_map_settings();
mapConfig = &gAreas[gGameStatusPtr->areaID].maps[gGameStatusPtr->mapID];
btl_restore_world_cameras();
gGameStatusPtr->isBattle = FALSE;
gGameStatusPtr->context = CONTEXT_WORLD;
func_8005AF84();
func_8002ACDC();
sfx_clear_env_sounds(1);

View File

@ -191,7 +191,7 @@ void state_step_demo(void) {
gGameStatusPtr->demoState = DEMO_STATE_NONE;
gGameStatusPtr->peachFlags = 0;
enable_sounds();
gGameStatusPtr->isBattle = FALSE;
gGameStatusPtr->context = CONTEXT_WORLD;
gGameStatusPtr->debugUnused1 = FALSE;
gGameStatusPtr->debugScripts = DEBUG_SCRIPTS_NONE;
gGameStatusPtr->keepUsingPartnerOnMapChange = FALSE;

View File

@ -139,7 +139,7 @@ void state_step_language_select(void) {
D_800A0930 = -1;
sfx_stop_env_sounds();
func_8003B1A8();
gGameStatusPtr->isBattle = 2;
gGameStatusPtr->context = CONTEXT_PAUSE;
backup_map_collision_data();
battle_heap_create();
sfx_clear_env_sounds(0);
@ -292,7 +292,7 @@ void state_step_exit_language_select(void) {
gOverrideFlags &= ~GLOBAL_OVERRIDES_DISABLE_DRAW_FRAME;
mapSettings = get_current_map_settings();
mapConfig = &gAreas[gGameStatusPtr->areaID].maps[gGameStatusPtr->mapID];
gGameStatusPtr->isBattle = FALSE;
gGameStatusPtr->context = CONTEXT_WORLD;
func_8005AF84();
func_8002ACDC();
sfx_clear_env_sounds(1);

View File

@ -156,7 +156,7 @@ void state_step_intro(void) {
break;
case INTRO_LOAD_MAP:
set_curtain_draw_callback(NULL);
gGameStatusPtr->isBattle = FALSE;
gGameStatusPtr->context = CONTEXT_WORLD;
gGameStatusPtr->debugUnused1 = FALSE;
gGameStatusPtr->debugScripts = DEBUG_SCRIPTS_NONE;
gGameStatusPtr->keepUsingPartnerOnMapChange = FALSE;

View File

@ -82,7 +82,7 @@ void state_step_pause(void) {
gGameStatusPtr->savedBackgroundDarkness = gGameStatusPtr->backgroundDarkness;
sfx_stop_env_sounds();
func_8003B1A8();
gGameStatusPtr->isBattle = 2;
gGameStatusPtr->context = CONTEXT_PAUSE;
backup_map_collision_data();
battle_heap_create();
nuContRmbForceStop();
@ -163,7 +163,7 @@ void state_step_unpause(void) {
gOverrideFlags &= ~GLOBAL_OVERRIDES_DISABLE_DRAW_FRAME;
mapSettings = get_current_map_settings();
mapConfig = &gAreas[gGameStatusPtr->areaID].maps[gGameStatusPtr->mapID];
gGameStatusPtr->isBattle = FALSE;
gGameStatusPtr->context = CONTEXT_WORLD;
gGameStatusPtr->backgroundFlags &= ~BACKGROUND_RENDER_STATE_MASK;
func_8005AF84();
func_8002ACDC();

View File

@ -20,7 +20,7 @@ void state_step_startup(void) {
gOverrideFlags = 0;
gGameStatusPtr->areaID = 0;
gGameStatusPtr->isBattle = 0;
gGameStatusPtr->context = CONTEXT_WORLD;
gameStatus->prevArea = -1;
gameStatus->mapID = 0;
gameStatus->entryID = 0;

View File

@ -126,7 +126,7 @@ void state_init_title_screen(void) {
sfx_set_reverb_mode(0);
gGameStatusPtr->startupState = TITLE_STATE_INIT;
gGameStatusPtr->logoTime = 0;
gGameStatusPtr->isBattle = FALSE;
gGameStatusPtr->context = CONTEXT_WORLD;
gGameStatusPtr->introPart = INTRO_PART_NONE;
startup_fade_screen_update();
titleData = load_asset_by_name("title_data", &titleDataSize);

View File

@ -615,7 +615,7 @@ void draw_all_status_icons(void* data) {
if (icon->status1.activeTask == STATUS_ICON_TASK_DRAW) {
if (icon->flags & STATUS_ICON_FLAG_DEBUFF) {
hud_element_set_flags(icon->status1.activeElementID, HUD_ELEMENT_FLAG_DISABLED);
} else if (icon->flags & STATUS_ICON_FLAG_BATTLE || gGameStatusPtr->isBattle != 1) {
} else if (icon->flags & STATUS_ICON_FLAG_BATTLE || gGameStatusPtr->context != CONTEXT_BATTLE) {
hud_element_clear_flags(icon->status1.activeElementID, HUD_ELEMENT_FLAG_DISABLED);
x = icon->worldPos.x;
@ -632,7 +632,9 @@ void draw_all_status_icons(void* data) {
}
}
if (icon->status1.removingTask == STATUS_ICON_TASK_DRAW && (icon->flags & STATUS_ICON_FLAG_BATTLE || gGameStatusPtr->isBattle != 1)) {
if (icon->status1.removingTask == STATUS_ICON_TASK_DRAW
&& (icon->flags & STATUS_ICON_FLAG_BATTLE || gGameStatusPtr->context != CONTEXT_BATTLE)
) {
hud_element_clear_flags(icon->status1.removingElementID, HUD_ELEMENT_FLAG_DISABLED);
if (isActiveDrawn == 0) {
@ -654,7 +656,7 @@ void draw_all_status_icons(void* data) {
if (icon->status2.activeTask == STATUS_ICON_TASK_DRAW) {
if (icon->flags & STATUS_ICON_FLAG_STATIC) {
hud_element_set_flags(icon->status2.activeElementID, HUD_ELEMENT_FLAG_DISABLED);
} else if (icon->flags & STATUS_ICON_FLAG_BATTLE || gGameStatusPtr->isBattle != 1) {
} else if (icon->flags & STATUS_ICON_FLAG_BATTLE || gGameStatusPtr->context != CONTEXT_BATTLE) {
hud_element_clear_flags(icon->status2.activeElementID, HUD_ELEMENT_FLAG_DISABLED);
offsetY = 0;
@ -677,7 +679,9 @@ void draw_all_status_icons(void* data) {
}
}
if (icon->status2.removingTask == STATUS_ICON_TASK_DRAW && (icon->flags & STATUS_ICON_FLAG_BATTLE || gGameStatusPtr->isBattle != 1)) {
if (icon->status2.removingTask == STATUS_ICON_TASK_DRAW
&& (icon->flags & STATUS_ICON_FLAG_BATTLE || gGameStatusPtr->context != CONTEXT_BATTLE)
) {
hud_element_clear_flags(icon->status2.removingElementID, HUD_ELEMENT_FLAG_DISABLED);
offsetY = 0;
@ -703,7 +707,7 @@ void draw_all_status_icons(void* data) {
if (icon->status3.activeTask == STATUS_ICON_TASK_DRAW) {
if (icon->flags & STATUS_ICON_FLAG_TRANSPARENT) {
hud_element_set_flags(icon->status3.activeElementID, HUD_ELEMENT_FLAG_DISABLED);
} else if (icon->flags & STATUS_ICON_FLAG_BATTLE || gGameStatusPtr->isBattle != 1) {
} else if (icon->flags & STATUS_ICON_FLAG_BATTLE || gGameStatusPtr->context != CONTEXT_BATTLE) {
hud_element_clear_flags(icon->status3.activeElementID, HUD_ELEMENT_FLAG_DISABLED);
offsetY = 0;
@ -727,7 +731,9 @@ void draw_all_status_icons(void* data) {
}
}
if (icon->status3.removingTask == STATUS_ICON_TASK_DRAW && (icon->flags & STATUS_ICON_FLAG_BATTLE || gGameStatusPtr->isBattle != 1)) {
if (icon->status3.removingTask == STATUS_ICON_TASK_DRAW
&& (icon->flags & STATUS_ICON_FLAG_BATTLE || gGameStatusPtr->context != CONTEXT_BATTLE)
) {
hud_element_clear_flags(icon->status3.removingElementID, HUD_ELEMENT_FLAG_DISABLED);
offsetY = 0;
@ -756,7 +762,7 @@ void draw_all_status_icons(void* data) {
if (icon->status4.activeTask == STATUS_ICON_TASK_DRAW) {
if (icon->flags & STATUS_ICON_FLAG_STATUS_CHILL_OUT) {
hud_element_set_flags(icon->status4.activeElementID, HUD_ELEMENT_FLAG_DISABLED);
} else if (icon->flags & STATUS_ICON_FLAG_BATTLE || gGameStatusPtr->isBattle != 1) {
} else if (icon->flags & STATUS_ICON_FLAG_BATTLE || gGameStatusPtr->context != CONTEXT_BATTLE) {
hud_element_clear_flags(icon->status4.activeElementID, HUD_ELEMENT_FLAG_DISABLED);
offsetY = 0;
@ -784,7 +790,9 @@ void draw_all_status_icons(void* data) {
}
}
if (icon->status4.removingTask == STATUS_ICON_TASK_DRAW && (icon->flags & STATUS_ICON_FLAG_BATTLE || gGameStatusPtr->isBattle != 1)) {
if (icon->status4.removingTask == STATUS_ICON_TASK_DRAW
&& (icon->flags & STATUS_ICON_FLAG_BATTLE || gGameStatusPtr->context != CONTEXT_BATTLE)
) {
hud_element_clear_flags(icon->status4.removingElementID, HUD_ELEMENT_FLAG_DISABLED);
offsetY = 0;
@ -816,7 +824,7 @@ void draw_all_status_icons(void* data) {
if (icon->boostJump.active) {
if (icon->flags & STATUS_ICON_FLAG_BOOST_JUMP) {
hud_element_set_flags(icon->boostJump.activeElementID, HUD_ELEMENT_FLAG_DISABLED);
} else if (icon->flags & STATUS_ICON_FLAG_BATTLE || gGameStatusPtr->isBattle != 1) {
} else if (icon->flags & STATUS_ICON_FLAG_BATTLE || gGameStatusPtr->context != CONTEXT_BATTLE) {
hud_element_clear_flags(icon->boostJump.activeElementID, HUD_ELEMENT_FLAG_DISABLED);
x = icon->worldPos.x;
@ -846,7 +854,7 @@ void draw_all_status_icons(void* data) {
if (icon->boostHammer.active) {
if (icon->flags & STATUS_ICON_FLAG_BOOST_HAMMER) {
hud_element_set_flags(icon->boostHammer.activeElementID, HUD_ELEMENT_FLAG_DISABLED);
} else if (icon->flags & STATUS_ICON_FLAG_BATTLE || gGameStatusPtr->isBattle != 1) {
} else if (icon->flags & STATUS_ICON_FLAG_BATTLE || gGameStatusPtr->context != CONTEXT_BATTLE) {
hud_element_clear_flags(icon->boostHammer.activeElementID, HUD_ELEMENT_FLAG_DISABLED);
x = icon->worldPos.x;
@ -876,7 +884,7 @@ void draw_all_status_icons(void* data) {
if (icon->boostPartner.active) {
if (icon->flags & STATUS_ICON_FLAG_BOOST_PARTNER) {
hud_element_set_flags(icon->boostPartner.activeElementID, HUD_ELEMENT_FLAG_DISABLED);
} else if (icon->flags & STATUS_ICON_FLAG_BATTLE || gGameStatusPtr->isBattle != 1) {
} else if (icon->flags & STATUS_ICON_FLAG_BATTLE || gGameStatusPtr->context != CONTEXT_BATTLE) {
hud_element_clear_flags(icon->boostPartner.activeElementID, HUD_ELEMENT_FLAG_DISABLED);
x = icon->worldPos.x;
@ -894,7 +902,7 @@ void draw_all_status_icons(void* data) {
if (icon->surprise.active) {
if (icon->flags & STATUS_ICON_FLAG_SURPRISE) {
hud_element_set_flags(icon->surprise.activeElementID, HUD_ELEMENT_FLAG_DISABLED);
} else if (icon->flags & STATUS_ICON_FLAG_BATTLE || gGameStatusPtr->isBattle != 1) {
} else if (icon->flags & STATUS_ICON_FLAG_BATTLE || gGameStatusPtr->context != CONTEXT_BATTLE) {
hud_element_clear_flags(icon->surprise.activeElementID, HUD_ELEMENT_FLAG_DISABLED);
x = icon->worldPos.x;
@ -912,7 +920,7 @@ void draw_all_status_icons(void* data) {
if (icon->peril.active) {
if (icon->flags & STATUS_ICON_FLAG_PERIL) {
hud_element_set_flags(icon->peril.activeElementID, HUD_ELEMENT_FLAG_DISABLED);
} else if (icon->flags & STATUS_ICON_FLAG_BATTLE || gGameStatusPtr->isBattle != 1) {
} else if (icon->flags & STATUS_ICON_FLAG_BATTLE || gGameStatusPtr->context != CONTEXT_BATTLE) {
hud_element_clear_flags(icon->peril.activeElementID, HUD_ELEMENT_FLAG_DISABLED);
x = icon->worldPos.x;
@ -930,7 +938,7 @@ void draw_all_status_icons(void* data) {
if (icon->danger.active) {
if (icon->flags & STATUS_ICON_FLAG_DANGER) {
hud_element_set_flags(icon->danger.activeElementID, HUD_ELEMENT_FLAG_DISABLED);
} else if (icon->flags & STATUS_ICON_FLAG_BATTLE || gGameStatusPtr->isBattle != 1) {
} else if (icon->flags & STATUS_ICON_FLAG_BATTLE || gGameStatusPtr->context != CONTEXT_BATTLE) {
hud_element_clear_flags(icon->danger.activeElementID, HUD_ELEMENT_FLAG_DISABLED);
x = icon->worldPos.x;
@ -959,8 +967,9 @@ s32 create_status_icon_set(void) {
ASSERT(i < MAX_ICONS);
icon->flags = STATUS_ICON_FLAG_USED;
if (gGameStatusPtr->isBattle) {
icon->flags = STATUS_ICON_FLAG_BATTLE | STATUS_ICON_FLAG_USED;
if (gGameStatusPtr->context != CONTEXT_WORLD) {
icon->flags |= STATUS_ICON_FLAG_BATTLE;
}
icon->worldPos.x = 0;

View File

@ -13,7 +13,7 @@ void clear_trigger_data(void) {
CollisionStatus* collisionStatus = &gCollisionStatus;
s32 i;
if (!gGameStatusPtr->isBattle) {
if (gGameStatusPtr->context == CONTEXT_WORLD) {
gCurrentTriggerListPtr = &wTriggerList;
} else {
gCurrentTriggerListPtr = &bTriggerList;
@ -42,7 +42,7 @@ void clear_trigger_data(void) {
}
void init_trigger_list(void) {
if (!gGameStatusPtr->isBattle) {
if (gGameStatusPtr->context == CONTEXT_WORLD) {
gCurrentTriggerListPtr = &wTriggerList;
} else {
gCurrentTriggerListPtr = &bTriggerList;

View File

@ -10,7 +10,7 @@ void worker_delegate_do_nothing(void) {
void clear_worker_list(void) {
s32 i;
if (!gGameStatusPtr->isBattle) {
if (gGameStatusPtr->context == CONTEXT_WORLD) {
gCurrentWorkerListPtr = &gWorldWorkerList;
} else {
gCurrentWorkerListPtr = &gBattleWorkerList;
@ -22,7 +22,7 @@ void clear_worker_list(void) {
}
void init_worker_list(void) {
if (!gGameStatusPtr->isBattle) {
if (gGameStatusPtr->context == CONTEXT_WORLD) {
gCurrentWorkerListPtr = &gWorldWorkerList;
} else {
gCurrentWorkerListPtr = &gBattleWorkerList;
@ -54,7 +54,7 @@ s32 create_worker_world(void (*updateFunc)(void), void (*drawFunc)(void)) {
worker->draw = worker_delegate_do_nothing;
}
if (gGameStatusPtr->isBattle) {
if (gGameStatusPtr->context != CONTEXT_WORLD) {
i |= BATTLE_ENTITY_ID_BIT;
}
return i;
@ -85,7 +85,7 @@ s32 create_worker_frontUI(void (*updateFunc)(void), void (*drawFunc)(void)) {
worker->draw = worker_delegate_do_nothing;
}
if (gGameStatusPtr->isBattle) {
if (gGameStatusPtr->context != CONTEXT_WORLD) {
i |= BATTLE_ENTITY_ID_BIT;
}
return i;
@ -116,7 +116,7 @@ s32 create_worker_backUI(void (*updateFunc)(void), void (*drawFunc)(void)) {
worker->draw = &worker_delegate_do_nothing;
}
if (gGameStatusPtr->isBattle) {
if (gGameStatusPtr->context != CONTEXT_WORLD) {
i |= BATTLE_ENTITY_ID_BIT;
}
return i;
@ -174,7 +174,7 @@ void render_workers_backUI(void) {
}
void free_worker(s32 idx) {
if (!gGameStatusPtr->isBattle || (idx & BATTLE_ENTITY_ID_BIT)) {
if (gGameStatusPtr->context == CONTEXT_WORLD || (idx & BATTLE_ENTITY_ID_BIT)) {
idx &= ~BATTLE_ENTITY_ID_BIT;
if ((*gCurrentWorkerListPtr)[idx] != NULL) {
heap_free((*gCurrentWorkerListPtr)[idx]);

View File

@ -155,7 +155,7 @@ void action_update_first_strike(void) {
if (playerStatus->curStateTime != 0) {
playerStatus->curStateTime--;
} else if (!gGameStatusPtr->isBattle) {
} else if (gGameStatusPtr->context == CONTEXT_WORLD) {
set_action_state(ACTION_STATE_IDLE);
}
}

View File

@ -90,7 +90,7 @@ API_CALLABLE(N(SetTubbaPatrolTerritory)) {
API_CALLABLE(N(SetTubbaPatrolMode)) {
if (get_enemy_safe(NPC_Tubba)) {
Enemy* enemy = get_enemy(NPC_Tubba);
enemy->aiFlags |= ENEMY_AI_FLAG_80;
enemy->aiFlags |= AI_FLAG_80;
return ApiStatus_DONE2;
}

View File

@ -34,7 +34,7 @@ NpcSettings N(NpcSettings_Archeologist_Wander) = {
.radius = 24,
.ai = &N(EVS_NpcAI_Archeologist),
.level = ACTOR_LEVEL_NONE,
.actionFlags = ENEMY_AI_FLAG_10,
.actionFlags = AI_FLAG_SKIP_IDLE_ANIM_AFTER_FLEE,
};
NpcSettings N(NpcSettings_Archeologist) = {

View File

@ -282,7 +282,7 @@ API_CALLABLE(N(FadeToTitleScreen)) {
}
API_CALLABLE(N(ChangeStateToTitleScreen)) {
gGameStatusPtr->isBattle = FALSE;
gGameStatusPtr->context = CONTEXT_WORLD;
gGameStatusPtr->debugUnused1 = FALSE;
gGameStatusPtr->debugScripts = DEBUG_SCRIPTS_NONE;
gGameStatusPtr->keepUsingPartnerOnMapChange = FALSE;

View File

@ -406,7 +406,7 @@ NpcData N(NpcData_ShyGuy_Thief) = {
.flags = ENEMY_FLAG_IGNORE_ENTITY_COLLISION | ENEMY_FLAG_FLYING,
.drops = SHY_GUY_DROPS,
.animations = YELLOW_SHY_GUY_ANIMS,
.aiFlags = ENEMY_AI_FLAG_1,
.aiFlags = AI_FLAG_1,
.aiDetectFlags = AI_DETECT_SIGHT,
};

View File

@ -181,7 +181,7 @@ API_CALLABLE(N(AvoidPlayerAI_Main)) {
enemy->unk_118 = 0.01f;
#endif
if (isInitialCall || (enemy->aiFlags & ENEMY_AI_FLAG_SUSPEND)) {
if (isInitialCall || (enemy->aiFlags & AI_FLAG_SUSPEND)) {
script->functionTemp[0] = AI_STATE_WANDER_INIT;
npc->duration = 0;
npc->curAnim = enemy->animList[ENEMY_ANIM_INDEX_IDLE];
@ -193,10 +193,10 @@ API_CALLABLE(N(AvoidPlayerAI_Main)) {
npc->flags &= ~NPC_FLAG_GRAVITY;
npc->flags |= NPC_FLAG_FLYING;
}
if (enemy->aiFlags & ENEMY_AI_FLAG_SUSPEND) {
if (enemy->aiFlags & AI_FLAG_SUSPEND) {
script->functionTemp[0] = AI_STATE_SUSPEND;
script->functionTemp[1] = AI_STATE_WANDER_INIT;
enemy->aiFlags &= ~ENEMY_AI_FLAG_SUSPEND;
enemy->aiFlags &= ~AI_FLAG_SUSPEND;
}
}

View File

@ -49,18 +49,18 @@ API_CALLABLE(N(BulletBillAI_Main)) {
if (isInitialCall || enemy->VAR_PROJECTILE_HITBOX_STATE == PROJECTILE_HITBOX_STATE_DONE) {
script->AI_TEMP_STATE = AI_STATE_BULLET_INIT;
npc->duration = 0;
enemy->aiFlags |= ENEMY_AI_FLAG_8;
enemy->aiFlags |= AI_FLAG_SKIP_EMOTE_AFTER_FLEE;
enemy->flags |= ENEMY_FLAG_ACTIVE_WHILE_OFFSCREEN;
npc->flags |= NPC_FLAG_IGNORE_CAMERA_FOR_YAW;
enemy->VAR_PROJECTILE_HITBOX_STATE = PROJECTILE_HITBOX_STATE_NONE;
enemy->AI_VAR_BULLET_BLASTER = -1;
}
if (enemy->aiFlags & ENEMY_AI_FLAG_SUSPEND) {
if (enemy->aiFlags & AI_FLAG_SUSPEND) {
if (enemy->aiSuspendTime != 0) {
return 0;
}
enemy->aiFlags &= ~ENEMY_AI_FLAG_SUSPEND;
enemy->aiFlags &= ~AI_FLAG_SUSPEND;
}
switch (script->AI_TEMP_STATE) {
@ -172,12 +172,12 @@ API_CALLABLE(N(BillBlasterAI_Main)) {
return ApiStatus_BLOCK;
}
if (enemy->aiFlags & ENEMY_AI_FLAG_SUSPEND) {
if (enemy->aiFlags & AI_FLAG_SUSPEND) {
npc->curAnim = enemy->animList[ENEMY_ANIM_INDEX_IDLE];
if (enemy->aiSuspendTime != 0) {
return ApiStatus_BLOCK;
}
enemy->aiFlags &= ~ENEMY_AI_FLAG_SUSPEND;
enemy->aiFlags &= ~AI_FLAG_SUSPEND;
}
switch (script->AI_TEMP_STATE) {

View File

@ -188,7 +188,7 @@ void N(CleftAI_Tackle)(Evt* script, MobileAISettings* aiSettings, EnemyDetectVol
spawn_surface_effects(npc, SURFACE_INTERACT_RUN);
npc_move_heading(npc, npc->moveSpeed, npc->yaw);
if (is_point_within_region(enemy->territory->wander.detectShape,
if (is_point_outside_territory(enemy->territory->wander.detectShape,
enemy->territory->wander.detectPos.x, enemy->territory->wander.detectPos.z,
npc->pos.x, npc->pos.z,
enemy->territory->wander.detectSize.x, enemy->territory->wander.detectSize.z)) {
@ -316,11 +316,11 @@ API_CALLABLE(N(CleftAI_Main)) {
}
}
if (enemy->aiFlags & ENEMY_AI_FLAG_SUSPEND) {
if (enemy->aiFlags & AI_FLAG_SUSPEND) {
if (enemy->aiSuspendTime) {
return ApiStatus_BLOCK;
}
enemy->aiFlags &= ~ENEMY_AI_FLAG_SUSPEND;
enemy->aiFlags &= ~AI_FLAG_SUSPEND;
}
if (((script->AI_TEMP_STATE == AI_STATE_CLEFT_CHASE_INIT)

View File

@ -216,7 +216,7 @@ API_CALLABLE(N(ClubbaNappingAI_Main)) {
territory.halfHeight = 40.0f;
territory.detectFlags = 0;
if (isInitialCall || (enemy->aiFlags & ENEMY_AI_FLAG_SUSPEND)) {
if (isInitialCall || (enemy->aiFlags & AI_FLAG_SUSPEND)) {
script->AI_TEMP_STATE = AI_STATE_NAPPING_CLUBBA_INIT;
npc->duration = 30;
npc->curAnim = enemy->animList[10];
@ -227,12 +227,12 @@ API_CALLABLE(N(ClubbaNappingAI_Main)) {
} else {
npc->flags = (npc->flags & ~NPC_FLAG_GRAVITY) | NPC_FLAG_FLYING;
}
if (enemy->aiFlags & ENEMY_AI_FLAG_SUSPEND) {
if (enemy->aiFlags & AI_FLAG_SUSPEND) {
script->AI_TEMP_STATE = AI_STATE_SUSPEND;
script->AI_TEMP_STATE_AFTER_SUSPEND = AI_RETURN_HOME_INIT;
npc->curAnim = enemy->animList[ENEMY_ANIM_INDEX_IDLE];
}
enemy->aiFlags &= ~ENEMY_AI_FLAG_SUSPEND;
enemy->aiFlags &= ~AI_FLAG_SUSPEND;
}
if (script->AI_TEMP_STATE >= AI_STATE_ALERT_INIT

View File

@ -22,7 +22,7 @@ API_CALLABLE(N(ClubbaPatrolAI_Main)) {
territory.halfHeight = 65.0f;
territory.detectFlags = 0;
if (isInitialCall || (enemy->aiFlags & ENEMY_AI_FLAG_SUSPEND)) {
if (isInitialCall || (enemy->aiFlags & AI_FLAG_SUSPEND)) {
script->AI_TEMP_STATE = AI_STATE_PATROL_INIT;
npc->duration = 0;
npc->curAnim = enemy->animList[ENEMY_ANIM_INDEX_IDLE];
@ -34,10 +34,10 @@ API_CALLABLE(N(ClubbaPatrolAI_Main)) {
npc->flags &= ~NPC_FLAG_GRAVITY;
npc->flags |= NPC_FLAG_FLYING;
}
if (enemy->aiFlags & ENEMY_AI_FLAG_SUSPEND) {
if (enemy->aiFlags & AI_FLAG_SUSPEND) {
script->AI_TEMP_STATE = AI_STATE_SUSPEND;
script->functionTemp[1] = AI_STATE_PATROL_INIT;
enemy->aiFlags &= ~ENEMY_AI_FLAG_SUSPEND;
enemy->aiFlags &= ~AI_FLAG_SUSPEND;
}
enemy->varTable[0] = 0;
}

View File

@ -20,7 +20,7 @@ void N(FlyingAI_WanderInit)(Evt* script, MobileAISettings* aiSettings, EnemyDete
Npc* npc = get_npc_unsafe(enemy->npcID);
npc->duration = aiSettings->moveTime / 2 + rand_int(aiSettings->moveTime / 2 + 1);
if (is_point_within_region(enemy->territory->wander.wanderShape,
if (is_point_outside_territory(enemy->territory->wander.wanderShape,
enemy->territory->wander.centerPos.x, enemy->territory->wander.centerPos.z,
npc->pos.x, npc->pos.z,
enemy->territory->wander.wanderSize.x, enemy->territory->wander.wanderSize.z)) {
@ -151,7 +151,7 @@ void N(FlyingAI_Wander)(Evt* script, MobileAISettings* aiSettings, EnemyDetectVo
enemy->varTable[9]--;
}
if (is_point_within_region(enemy->territory->wander.wanderShape,
if (is_point_outside_territory(enemy->territory->wander.wanderShape,
enemy->territory->wander.centerPos.x,
enemy->territory->wander.centerPos.z,
npc->pos.x, npc->pos.z,
@ -428,7 +428,7 @@ void N(FlyingAI_Init)(Npc* npc, Enemy* enemy, Evt* script, MobileAISettings* aiS
enemy->varTable[3] = (depth * 100.0) + 0.5;
enemy->varTable[7] = (posY * 100.0) + 0.5;
script->functionTemp[1] = aiSettings->playerSearchInterval;
enemy->aiFlags |= ENEMY_AI_FLAG_10;
enemy->aiFlags |= AI_FLAG_SKIP_IDLE_ANIM_AFTER_FLEE;
}
API_CALLABLE(N(FlyingAI_Main)) {
@ -466,11 +466,11 @@ API_CALLABLE(N(FlyingAI_Main)) {
npc->verticalRenderOffset = -2;
if (enemy->aiFlags & ENEMY_AI_FLAG_SUSPEND) {
if (enemy->aiFlags & AI_FLAG_SUSPEND) {
if (enemy->aiSuspendTime != 0) {
return ApiStatus_BLOCK;
}
enemy->aiFlags &= ~ENEMY_AI_FLAG_SUSPEND;
enemy->aiFlags &= ~AI_FLAG_SUSPEND;
}
switch (script->AI_TEMP_STATE) {

View File

@ -60,7 +60,7 @@ void N(FlyingMagikoopaAI_15)(Evt* arg0, MobileAISettings* arg1, EnemyDetectVolum
if (npc->duration <= 0) {
randomDist = rand_int(30) + 180.0;
isCCW = FALSE;
if (is_point_within_region(enemy->territory->wander.wanderShape, enemy->territory->wander.centerPos.x, enemy->territory->wander.centerPos.z, npc->pos.x, npc->pos.z, enemy->territory->wander.wanderSize.x, enemy->territory->wander.wanderSize.z)) {
if (is_point_outside_territory(enemy->territory->wander.wanderShape, enemy->territory->wander.centerPos.x, enemy->territory->wander.centerPos.z, npc->pos.x, npc->pos.z, enemy->territory->wander.wanderSize.x, enemy->territory->wander.wanderSize.z)) {
npc->yaw = atan2(npc->pos.x, npc->pos.z, enemy->territory->wander.centerPos.x, enemy->territory->wander.centerPos.z) - iterations;
moveDist = dist2D(npc->pos.x, npc->pos.z, enemy->territory->wander.centerPos.x, enemy->territory->wander.centerPos.z);
if (randomDist > moveDist) {
@ -307,11 +307,11 @@ API_CALLABLE(N(FlyingMagikoopaAI_Main)) {
npc->verticalRenderOffset = -5;
if (enemy->aiFlags & ENEMY_AI_FLAG_SUSPEND) {
if (enemy->aiFlags & AI_FLAG_SUSPEND) {
if (enemy->aiSuspendTime != 0) {
return ApiStatus_BLOCK;
}
enemy->aiFlags &= ~ENEMY_AI_FLAG_SUSPEND;
enemy->aiFlags &= ~AI_FLAG_SUSPEND;
}
switch (script->AI_TEMP_STATE) {

View File

@ -127,11 +127,11 @@ API_CALLABLE(N(FlyingNoAttackAI_Main)) {
}
npc->verticalRenderOffset = -2;
if (enemy->aiFlags & ENEMY_AI_FLAG_SUSPEND) {
if (enemy->aiFlags & AI_FLAG_SUSPEND) {
if (enemy->aiSuspendTime) {
return ApiStatus_BLOCK;
}
enemy->aiFlags &= ~ENEMY_AI_FLAG_SUSPEND;
enemy->aiFlags &= ~AI_FLAG_SUSPEND;
}
switch (script->functionTemp[0]) {

View File

@ -86,7 +86,7 @@ API_CALLABLE(N(GrooveGuyAI_Main)) {
territory.halfHeight = 65.0f;
territory.detectFlags = 0;
if (isInitialCall || enemy->aiFlags & ENEMY_AI_FLAG_SUSPEND) {
if (isInitialCall || enemy->aiFlags & AI_FLAG_SUSPEND) {
script->functionTemp[0] = 0;
npc->duration = 0;
npc->curAnim = enemy->animList[ENEMY_ANIM_INDEX_IDLE];
@ -100,13 +100,13 @@ API_CALLABLE(N(GrooveGuyAI_Main)) {
npc->flags |= NPC_FLAG_FLYING;
}
if (enemy->aiFlags & ENEMY_AI_FLAG_SUSPEND) {
if (enemy->aiFlags & AI_FLAG_SUSPEND) {
script->functionTemp[0] = 99;
script->functionTemp[1] = 0;
} else if (enemy->flags & ENEMY_FLAG_BEGIN_WITH_CHASING) {
script->functionTemp[0] = 12;
}
enemy->aiFlags &= ~ENEMY_AI_FLAG_SUSPEND;
enemy->aiFlags &= ~AI_FLAG_SUSPEND;
enemy->flags &= ~ENEMY_FLAG_BEGIN_WITH_CHASING;
hitDepth = 100.0f;

View File

@ -205,7 +205,7 @@ API_CALLABLE(N(GuardAI_Main)) {
territory.halfHeight = 65.0f;
territory.detectFlags = 0;
if (isInitialCall || (enemy->aiFlags & ENEMY_AI_FLAG_SUSPEND)) {
if (isInitialCall || (enemy->aiFlags & AI_FLAG_SUSPEND)) {
script->AI_TEMP_STATE = AI_STATE_GUARD_IDLE_INIT;
npc->duration = 0;
enemy->varTable[0] = npc->yaw;
@ -220,10 +220,10 @@ API_CALLABLE(N(GuardAI_Main)) {
npc->flags |= NPC_FLAG_FLYING;
}
if (enemy->aiFlags & ENEMY_AI_FLAG_SUSPEND) {
if (enemy->aiFlags & AI_FLAG_SUSPEND) {
script->AI_TEMP_STATE = AI_STATE_SUSPEND;
script->functionTemp[1] = 15;
enemy->aiFlags &= ~ENEMY_AI_FLAG_SUSPEND;
enemy->aiFlags &= ~AI_FLAG_SUSPEND;
} else if (enemy->flags & ENEMY_FLAG_BEGIN_WITH_CHASING) {
script->AI_TEMP_STATE = AI_STATE_CHASE_INIT;
enemy->flags &= ~ENEMY_FLAG_BEGIN_WITH_CHASING;

View File

@ -14,7 +14,7 @@ void N(HoppingAI_HopInit)(Evt* script, MobileAISettings* aiSettings, EnemyDetect
npc->jumpScale = 1.5f;
ai_enemy_play_sound(npc, SOUND_SEQ_FUZZY_HOP, 0);
if (is_point_within_region(enemy->territory->wander.wanderShape,
if (is_point_outside_territory(enemy->territory->wander.wanderShape,
enemy->territory->wander.centerPos.x,
enemy->territory->wander.centerPos.z,
npc->pos.x, npc->pos.z,
@ -245,18 +245,18 @@ API_CALLABLE(N(HoppingAI_Main)) {
npc->flags &= ~NPC_FLAG_GRAVITY;
npc->flags |= NPC_FLAG_FLYING;
enemy->aiFlags |= (ENEMY_AI_FLAG_8 | ENEMY_AI_FLAG_10);
enemy->aiFlags |= (AI_FLAG_SKIP_EMOTE_AFTER_FLEE | AI_FLAG_SKIP_IDLE_ANIM_AFTER_FLEE);
if (enemy->flags & ENEMY_FLAG_BEGIN_WITH_CHASING) {
script->AI_TEMP_STATE = AI_STATE_CHASE_INIT;
enemy->flags &= ~ENEMY_FLAG_BEGIN_WITH_CHASING;
}
}
if (enemy->aiFlags & ENEMY_AI_FLAG_SUSPEND) {
if (enemy->aiFlags & AI_FLAG_SUSPEND) {
if (enemy->aiSuspendTime != 0) {
return ApiStatus_BLOCK;
}
enemy->aiFlags &= ~ENEMY_AI_FLAG_SUSPEND;
enemy->aiFlags &= ~AI_FLAG_SUSPEND;
}
switch (script->AI_TEMP_STATE) {

View File

@ -25,10 +25,10 @@ API_CALLABLE(N(KoopaPatrolAI_Main)) {
if (isInitialCall) {
enemy->varTable[6] = npc->collisionHeight;
enemy->aiFlags |= ENEMY_AI_FLAG_8;
enemy->aiFlags |= AI_FLAG_SKIP_EMOTE_AFTER_FLEE;
}
if (isInitialCall || (enemy->aiFlags & ENEMY_AI_FLAG_SUSPEND)) {
if (isInitialCall || (enemy->aiFlags & AI_FLAG_SUSPEND)) {
npc->duration = 0;
script->functionTemp[0] = 0;
enemy->hitboxIsActive = FALSE;
@ -46,13 +46,13 @@ API_CALLABLE(N(KoopaPatrolAI_Main)) {
npc->flags |= NPC_FLAG_FLYING;
}
if (enemy->aiFlags & ENEMY_AI_FLAG_SUSPEND) {
if (enemy->aiFlags & AI_FLAG_SUSPEND) {
EffectInstance* emoteTemp;
script->functionTemp[0] = 99;
script->functionTemp[1] = 0;
fx_emote(EMOTE_QUESTION, npc, 0.0f, npc->collisionHeight, 1.0f, 2.0f, -20.0f, 40, &emoteTemp);
enemy->aiFlags &= ~ENEMY_AI_FLAG_SUSPEND;
enemy->aiFlags &= ~AI_FLAG_SUSPEND;
} else if (enemy->flags & ENEMY_FLAG_BEGIN_WITH_CHASING) {
script->functionTemp[0] = AI_STATE_CHASE_INIT;
enemy->flags &= ~ENEMY_FLAG_BEGIN_WITH_CHASING;

View File

@ -75,7 +75,7 @@ void N(LakituAI_Wander)(Evt* script, MobileAISettings* aiSettings, EnemyDetectVo
script->functionTemp[1]--;
}
if (is_point_within_region(enemy->territory->wander.wanderShape, enemy->territory->wander.centerPos.x,
if (is_point_outside_territory(enemy->territory->wander.wanderShape, enemy->territory->wander.centerPos.x,
enemy->territory->wander.centerPos.z, npc->pos.x, npc->pos.z, enemy->territory->wander.wanderSize.x,
enemy->territory->wander.wanderSize.z) != 0) {
npc->yaw = atan2(npc->pos.x, npc->pos.z, enemy->territory->wander.centerPos.x, enemy->territory->wander.centerPos.z);
@ -192,11 +192,11 @@ API_CALLABLE(N(LakituAI_Main)) {
}
npc->verticalRenderOffset = -3;
if (enemy->aiFlags & ENEMY_AI_FLAG_SUSPEND) {
if (enemy->aiFlags & AI_FLAG_SUSPEND) {
if (enemy->aiSuspendTime != 0) {
return ApiStatus_BLOCK;
}
enemy->aiFlags &= ~ENEMY_AI_FLAG_SUSPEND;
enemy->aiFlags &= ~AI_FLAG_SUSPEND;
}
switch (script->AI_TEMP_STATE) {
@ -283,7 +283,7 @@ API_CALLABLE(N(LakituAI_Main)) {
npc->yaw = atan2(npc->pos.x, npc->pos.z, gPlayerStatusPtr->pos.x, gPlayerStatusPtr->pos.z);
playerDist = dist2D(gPlayerStatusPtr->pos.x, gPlayerStatusPtr->pos.z, npc->pos.x, npc->pos.z);
if (!is_point_within_region(territoryPtr->shape,
if (!is_point_outside_territory(territoryPtr->shape,
territoryPtr->pointX, territoryPtr->pointZ,
npc->pos.x, npc->pos.z,
territoryPtr->sizeX, territoryPtr->sizeZ)) {

View File

@ -248,14 +248,14 @@ API_CALLABLE(N(MagikoopaAI_Main)) {
territory.halfHeight = 100.0f;
territory.detectFlags = 0;
if (isInitialCall || (enemy->aiFlags & ENEMY_AI_FLAG_SUSPEND)) {
if (isInitialCall || (enemy->aiFlags & AI_FLAG_SUSPEND)) {
npc->curAnim = enemy->animList[0];
npc->flags &= ~NPC_FLAG_JUMPING;
npc->flags |= NPC_FLAG_200000;
enemy->flags |= ENEMY_FLAG_ACTIVE_WHILE_OFFSCREEN;
npc->duration = 0;
if (enemy->aiFlags & ENEMY_AI_FLAG_SUSPEND) {
enemy->aiFlags &= ~ENEMY_AI_FLAG_SUSPEND;
if (enemy->aiFlags & AI_FLAG_SUSPEND) {
enemy->aiFlags &= ~AI_FLAG_SUSPEND;
npc->alpha = 0xFF;
npc->duration = 20;
npc->scale.x = 1.0f;

View File

@ -48,7 +48,7 @@ API_CALLABLE(N(MagikoopaAI_SpellMain)) {
f32 t1;
f32 t2;
if (isInitialCall || (enemy->aiFlags & ENEMY_AI_FLAG_SUSPEND)) {
if (isInitialCall || (enemy->aiFlags & AI_FLAG_SUSPEND)) {
script->functionTemp[0] = 0;
npc1->duration = 0;
npc1->flags |= NPC_FLAG_200000 | NPC_FLAG_IGNORE_CAMERA_FOR_YAW | NPC_FLAG_IGNORE_PLAYER_COLLISION | NPC_FLAG_INVISIBLE;
@ -56,8 +56,8 @@ API_CALLABLE(N(MagikoopaAI_SpellMain)) {
ENEMY_FLAG_ACTIVE_WHILE_OFFSCREEN | ENEMY_FLAG_PROJECTILE;
npc1->scale.x = 0.4f;
npc1->scale.y = 0.4f;
if (enemy->aiFlags & ENEMY_AI_FLAG_SUSPEND) {
enemy->aiFlags &= ~ENEMY_AI_FLAG_SUSPEND;
if (enemy->aiFlags & AI_FLAG_SUSPEND) {
enemy->aiFlags &= ~AI_FLAG_SUSPEND;
}
}

View File

@ -112,7 +112,7 @@ API_CALLABLE(N(MeleeHitbox_Main)) {
hitboxEnemy->unk_118 = 0.0001f;
#endif
if (isInitialCall || (hitboxEnemy->aiFlags & ENEMY_AI_FLAG_SUSPEND)) {
if (isInitialCall || (hitboxEnemy->aiFlags & AI_FLAG_SUSPEND)) {
script->functionTemp[0] = 0;
hitboxNpc->duration = 0;
hitboxNpc->flags |= (NPC_FLAG_INVISIBLE | NPC_FLAG_IGNORE_PLAYER_COLLISION);
@ -120,8 +120,8 @@ API_CALLABLE(N(MeleeHitbox_Main)) {
hitboxNpc->pos.x = NPC_DISPOSE_POS_X;
hitboxNpc->pos.y = NPC_DISPOSE_POS_Y;
hitboxNpc->pos.z = NPC_DISPOSE_POS_Z;
if (hitboxEnemy->aiFlags & ENEMY_AI_FLAG_SUSPEND) {
hitboxEnemy->aiFlags &= ~ENEMY_AI_FLAG_SUSPEND;
if (hitboxEnemy->aiFlags & AI_FLAG_SUSPEND) {
hitboxEnemy->aiFlags &= ~AI_FLAG_SUSPEND;
}
}

View File

@ -27,7 +27,13 @@ enum AiStateMontyMole {
AI_STATE_MOLE_BURROW = 21, // burrow underground
};
#define MONTY_MOLE_UNK_NPC_FLAGS 0x1F100000
#define INTANGIBLE_MONTY_MOLE_NPC_FLAGS \
ENEMY_FLAG_100000 \
| ENEMY_FLAG_IGNORE_TOUCH \
| ENEMY_FLAG_IGNORE_JUMP \
| ENEMY_FLAG_IGNORE_HAMMER \
| ENEMY_FLAG_IGNORE_PARTNER \
| ENEMY_FLAG_CANT_INTERACT
static s32 N(MontyMoleAI_CanAttack)(Evt* script, EnemyDetectVolume* territory, f32 radius, f32 arg3) {
Camera* cam;
@ -74,7 +80,7 @@ static void N(MontyMoleAI_Init)(Evt* script, MobileAISettings* aiSettings, Enemy
} else {
npc->moveSpeed = enemy->territory->wander.moveSpeedOverride / 32767.0;
}
enemy->flags |= MONTY_MOLE_UNK_NPC_FLAGS;
enemy->flags |= INTANGIBLE_MONTY_MOLE_NPC_FLAGS;
npc->flags |= NPC_FLAG_INVISIBLE;
script->functionTemp[1] = 0;
script->AI_TEMP_STATE = AI_STATE_MOLE_WANDER;
@ -86,7 +92,7 @@ static void N(MontyMoleAI_Wander)(Evt* script, MobileAISettings* aiSettings, Ene
Npc dummyNpc;
f32 hitDepth;
if (is_point_within_region(enemy->territory->wander.wanderShape,
if (is_point_outside_territory(enemy->territory->wander.wanderShape,
enemy->territory->wander.centerPos.x, enemy->territory->wander.centerPos.z,
npc->pos.x, npc->pos.z,
enemy->territory->wander.wanderSize.x, enemy->territory->wander.wanderSize.z)) {
@ -142,7 +148,7 @@ static void N(MontyMoleAI_Surface)(Evt* script, MobileAISettings* aiSettings, En
npc->duration--;
if (npc->duration == 2) {
enemy->flags &= ~MONTY_MOLE_UNK_NPC_FLAGS;
enemy->flags &= ~(INTANGIBLE_MONTY_MOLE_NPC_FLAGS);
}
if (npc->duration <= 0) {
npc->curAnim = ANIM_MontyMole_Anim18; // get and throw rock
@ -217,7 +223,7 @@ static void N(MontyMoleAI_Burrow)(Evt* script, MobileAISettings* aiSettings, Ene
npc->duration--;
if (npc->duration == 3) {
enemy->flags |= MONTY_MOLE_UNK_NPC_FLAGS;
enemy->flags |= INTANGIBLE_MONTY_MOLE_NPC_FLAGS;
}
if (npc->duration <= 0) {
npc->flags |= NPC_FLAG_INVISIBLE;
@ -246,12 +252,12 @@ API_CALLABLE(N(MontyMoleAI_Main)) {
script->AI_TEMP_STATE = AI_STATE_MOLE_INIT;
npc->duration = 0;
npc->flags &= ~NPC_FLAG_JUMPING;
enemy->aiFlags |= (ENEMY_AI_FLAG_8 | ENEMY_AI_FLAG_10);
enemy->aiFlags |= (AI_FLAG_SKIP_EMOTE_AFTER_FLEE | AI_FLAG_SKIP_IDLE_ANIM_AFTER_FLEE);
}
if (enemy->aiFlags & ENEMY_AI_FLAG_SUSPEND) {
if (enemy->aiFlags & AI_FLAG_SUSPEND) {
if (enemy->aiSuspendTime == 0) {
enemy->aiFlags &= ~ENEMY_AI_FLAG_SUSPEND;
enemy->aiFlags &= ~AI_FLAG_SUSPEND;
} else {
return ApiStatus_BLOCK;
}

View File

@ -121,11 +121,11 @@ API_CALLABLE(N(ParatroopaAI_Main)) {
npc->verticalRenderOffset = -3;
if (enemy->aiFlags & ENEMY_AI_FLAG_SUSPEND) {
if (enemy->aiFlags & AI_FLAG_SUSPEND) {
if (enemy->aiSuspendTime != 0) {
return ApiStatus_BLOCK;
}
enemy->aiFlags &= ~ENEMY_AI_FLAG_SUSPEND;
enemy->aiFlags &= ~AI_FLAG_SUSPEND;
}
switch (script->AI_TEMP_STATE) {

View File

@ -33,7 +33,7 @@ API_CALLABLE(N(PatrolNoAttackAI_Main)) {
enemy->unk_118 = 0.0001f;
#endif
if (isInitialCall || enemy->aiFlags & ENEMY_AI_FLAG_SUSPEND) {
if (isInitialCall || enemy->aiFlags & AI_FLAG_SUSPEND) {
script->AI_TEMP_STATE = AI_STATE_PATROL_INIT;
npc->duration = 0;
npc->curAnim = enemy->animList[ENEMY_ANIM_INDEX_IDLE];
@ -47,10 +47,10 @@ API_CALLABLE(N(PatrolNoAttackAI_Main)) {
npc->flags |= NPC_FLAG_FLYING;
}
if (enemy->aiFlags & ENEMY_AI_FLAG_SUSPEND) {
if (enemy->aiFlags & AI_FLAG_SUSPEND) {
script->AI_TEMP_STATE = AI_STATE_SUSPEND;
script->functionTemp[1] = 0;
enemy->aiFlags &= ~ENEMY_AI_FLAG_SUSPEND;
enemy->aiFlags &= ~AI_FLAG_SUSPEND;
} else if (enemy->flags & ENEMY_FLAG_BEGIN_WITH_CHASING) {
script->AI_TEMP_STATE = AI_STATE_CHASE_INIT;
enemy->flags &= ~ENEMY_FLAG_BEGIN_WITH_CHASING;

View File

@ -164,7 +164,7 @@ void N(PiranhaPlantAI_10)(Evt* script, MobileAISettings* aiSettings, EnemyDetect
}
}
if (is_point_within_region(territory->shape, territory->pointX, territory->pointZ, npc->pos.x, npc->pos.z, territory->sizeX, territory->sizeZ)) {
if (is_point_outside_territory(territory->shape, territory->pointX, territory->pointZ, npc->pos.x, npc->pos.z, territory->sizeX, territory->sizeZ)) {
switch (territory->shape) {
case SHAPE_CYLINDER:
sp38 = dist2D(npc->pos.x, npc->pos.z, territory->pointX, territory->pointZ);
@ -319,16 +319,16 @@ API_CALLABLE(N(PiranhaPlantAI_Main)) {
}
#endif
if (isInitialCall || (enemy->aiFlags & ENEMY_AI_FLAG_SUSPEND)) {
if (isInitialCall || (enemy->aiFlags & AI_FLAG_SUSPEND)) {
script->AI_TEMP_STATE = AI_STATE_PIRANHA_PLANT_00;
npc->duration = 0;
npc->curAnim = enemy->animList[ENEMY_ANIM_INDEX_IDLE];
enemy->AI_VAR_ATTACK_STATE = MELEE_HITBOX_STATE_NONE;
if (enemy->aiFlags & ENEMY_AI_FLAG_SUSPEND) {
if (enemy->aiFlags & AI_FLAG_SUSPEND) {
script->AI_TEMP_STATE = AI_STATE_SUSPEND;
script->functionTemp[1] = AI_STATE_PIRANHA_PLANT_00;
enemy->aiFlags &= ~ENEMY_AI_FLAG_SUSPEND;
enemy->aiFlags &= ~AI_FLAG_SUSPEND;
}
}

View File

@ -149,7 +149,7 @@ API_CALLABLE(N(ProjectileAI_Main)) {
npc->verticalRenderOffset = npc->collisionHeight / 2;
}
if (isInitialCall || (enemy->aiFlags & ENEMY_AI_FLAG_SUSPEND)) {
if (isInitialCall || (enemy->aiFlags & AI_FLAG_SUSPEND)) {
script->functionTemp[0] = 0;
npc->duration = 0;
npc->flags |= NPC_FLAG_IGNORE_CAMERA_FOR_YAW | NPC_FLAG_IGNORE_PLAYER_COLLISION | NPC_FLAG_INVISIBLE;
@ -159,8 +159,8 @@ API_CALLABLE(N(ProjectileAI_Main)) {
enemy->flags |= ENEMY_FLAG_IGNORE_PARTNER | ENEMY_FLAG_CANT_INTERACT | ENEMY_FLAG_IGNORE_HAMMER |
ENEMY_FLAG_IGNORE_JUMP | ENEMY_FLAG_IGNORE_TOUCH | ENEMY_FLAG_ACTIVE_WHILE_OFFSCREEN |
ENEMY_FLAG_100000 | ENEMY_FLAG_PROJECTILE;
if (enemy->aiFlags & ENEMY_AI_FLAG_SUSPEND) {
enemy->aiFlags &= ~ENEMY_AI_FLAG_SUSPEND;
if (enemy->aiFlags & AI_FLAG_SUSPEND) {
enemy->aiFlags &= ~AI_FLAG_SUSPEND;
}
}

View File

@ -29,7 +29,7 @@ API_CALLABLE(N(RangedAttackAI_Main)) {
territory.halfHeight = 40.0f;
territory.detectFlags = 0;
if (isInitialCall || (enemy->aiFlags & ENEMY_AI_FLAG_SUSPEND)) {
if (isInitialCall || (enemy->aiFlags & AI_FLAG_SUSPEND)) {
script->AI_TEMP_STATE = 0;
npc->duration = 0;
npc->curAnim = enemy->animList[ENEMY_ANIM_INDEX_IDLE];
@ -43,14 +43,14 @@ API_CALLABLE(N(RangedAttackAI_Main)) {
npc->flags |= NPC_FLAG_FLYING;
}
if (enemy->aiFlags & ENEMY_AI_FLAG_SUSPEND) {
if (enemy->aiFlags & AI_FLAG_SUSPEND) {
script->AI_TEMP_STATE = AI_STATE_SUSPEND;
script->functionTemp[1] = 0;
enemy->aiFlags &= ~ENEMY_AI_FLAG_SUSPEND;
enemy->aiFlags &= ~AI_FLAG_SUSPEND;
} else if (enemy->flags & ENEMY_FLAG_BEGIN_WITH_CHASING) {
script->AI_TEMP_STATE = AI_STATE_CHASE_INIT;
}
enemy->aiFlags &= ~ENEMY_AI_FLAG_SUSPEND;
enemy->aiFlags &= ~AI_FLAG_SUSPEND;
enemy->flags &= ~ENEMY_FLAG_BEGIN_WITH_CHASING;
}

View File

@ -80,7 +80,7 @@ API_CALLABLE(N(ShyGuyPatrolAI_Main)) {
territory.halfHeight = 65.0f;
territory.detectFlags = 0;
if (isInitialCall || enemy->aiFlags & ENEMY_AI_FLAG_SUSPEND) {
if (isInitialCall || enemy->aiFlags & AI_FLAG_SUSPEND) {
script->functionTemp[0] = 0;
npc->duration = 0;
npc->curAnim = enemy->animList[ENEMY_ANIM_INDEX_IDLE];
@ -94,10 +94,10 @@ API_CALLABLE(N(ShyGuyPatrolAI_Main)) {
npc->flags |= NPC_FLAG_FLYING;
}
if (enemy->aiFlags & ENEMY_AI_FLAG_SUSPEND) {
if (enemy->aiFlags & AI_FLAG_SUSPEND) {
script->functionTemp[0] = 99;
script->functionTemp[1] = 0;
enemy->aiFlags &= ~ENEMY_AI_FLAG_SUSPEND;
enemy->aiFlags &= ~AI_FLAG_SUSPEND;
} else if (enemy->flags & ENEMY_FLAG_BEGIN_WITH_CHASING) {
script->functionTemp[0] = 12;
enemy->flags &= ~ENEMY_FLAG_BEGIN_WITH_CHASING;

View File

@ -78,7 +78,7 @@ API_CALLABLE(N(ShyGuyWanderAI_Main)) {
territory.halfHeight = 65.0f;
territory.detectFlags = 0;
if (isInitialCall || enemy->aiFlags & ENEMY_AI_FLAG_SUSPEND) {
if (isInitialCall || enemy->aiFlags & AI_FLAG_SUSPEND) {
script->functionTemp[0] = 0;
npc->duration = 0;
npc->curAnim = enemy->animList[ENEMY_ANIM_INDEX_IDLE];
@ -92,13 +92,13 @@ API_CALLABLE(N(ShyGuyWanderAI_Main)) {
npc->flags |= NPC_FLAG_FLYING;
}
if (enemy->aiFlags & ENEMY_AI_FLAG_SUSPEND) {
if (enemy->aiFlags & AI_FLAG_SUSPEND) {
script->functionTemp[0] = 99;
script->functionTemp[1] = 0;
} else if (enemy->flags & ENEMY_FLAG_BEGIN_WITH_CHASING) {
script->functionTemp[0] = 12;
}
enemy->aiFlags &= ~ENEMY_AI_FLAG_SUSPEND;
enemy->aiFlags &= ~AI_FLAG_SUSPEND;
enemy->flags &= ~ENEMY_FLAG_BEGIN_WITH_CHASING;
hitDepth = 100.0f;

View File

@ -97,7 +97,7 @@ API_CALLABLE(N(SpearGuyAI_Main)) {
territory.halfHeight = 65.0f;
territory.detectFlags = 0;
if (isInitialCall || (enemy->aiFlags & ENEMY_AI_FLAG_SUSPEND)) {
if (isInitialCall || (enemy->aiFlags & AI_FLAG_SUSPEND)) {
script->AI_TEMP_STATE = AI_STATE_WANDER_INIT;
npc->duration = 0;
npc->curAnim = enemy->animList[ENEMY_ANIM_INDEX_IDLE];
@ -111,10 +111,10 @@ API_CALLABLE(N(SpearGuyAI_Main)) {
npc->flags |= NPC_FLAG_FLYING;
}
if (enemy->aiFlags & ENEMY_AI_FLAG_SUSPEND) {
if (enemy->aiFlags & AI_FLAG_SUSPEND) {
script->AI_TEMP_STATE = AI_STATE_SUSPEND;
script->AI_TEMP_STATE_AFTER_SUSPEND = AI_STATE_WANDER_INIT;
enemy->aiFlags &= ~ENEMY_AI_FLAG_SUSPEND;
enemy->aiFlags &= ~AI_FLAG_SUSPEND;
}
enemy->varTable[0] = 0;
}

View File

@ -38,7 +38,7 @@ API_CALLABLE(N(SpinyAI_Main)) {
if (isInitialCall) {
enemy->varTable[6] = npc->collisionHeight;
enemy->aiFlags |= ENEMY_AI_FLAG_8;
enemy->aiFlags |= AI_FLAG_SKIP_EMOTE_AFTER_FLEE;
}
if (isInitialCall || (enemy->varTable[10] == 100)) {
@ -56,10 +56,10 @@ API_CALLABLE(N(SpinyAI_Main)) {
npc->pos.z = NPC_DISPOSE_POS_Z;
}
if (enemy->aiFlags & ENEMY_AI_FLAG_SUSPEND) {
if (enemy->aiFlags & AI_FLAG_SUSPEND) {
npc->duration = 0;
npc->collisionHeight = enemy->varTable[6];
enemy->aiFlags &= ~ENEMY_AI_FLAG_SUSPEND;
enemy->aiFlags &= ~AI_FLAG_SUSPEND;
if (npc->flags & NPC_FLAG_JUMPING) {
npc->curAnim = ANIM_Spiny_Anim18;
npc->moveSpeed = 0.0f;

View File

@ -235,7 +235,7 @@ void N(PatrolAI_LosePlayer)(Evt* script, MobileAISettings* aiSettings, EnemyDete
npc->duration--;
if (npc->duration == 0) {
if (enemy->aiFlags & ENEMY_AI_FLAG_80) {
if (enemy->aiFlags & AI_FLAG_80) {
script->AI_TEMP_STATE = AI_STATE_PATROL_15;
} else {
script->AI_TEMP_STATE = AI_STATE_WANDER_INIT;

View File

@ -24,7 +24,7 @@ API_CALLABLE(N(SwooperAI_Main)) {
if (isInitialCall) {
script->functionTemp[0] = 0;
npc->duration = 0;
enemy->aiFlags |= ENEMY_AI_FLAG_10;
enemy->aiFlags |= AI_FLAG_SKIP_IDLE_ANIM_AFTER_FLEE;
hitDepth = 1000.0f;
x = npc->pos.x;
y = npc->pos.y;
@ -33,9 +33,9 @@ API_CALLABLE(N(SwooperAI_Main)) {
enemy->varTable[1] = y;
}
if (enemy->aiFlags & ENEMY_AI_FLAG_SUSPEND) {
if (enemy->aiFlags & AI_FLAG_SUSPEND) {
if (enemy->aiSuspendTime == 0) {
enemy->aiFlags &= ~ENEMY_AI_FLAG_SUSPEND;
enemy->aiFlags &= ~AI_FLAG_SUSPEND;
} else {
return ApiStatus_BLOCK;
}

View File

@ -40,10 +40,10 @@ API_CALLABLE(N(TackleAI_Main)) {
enemy->varTable[6] = npc->collisionHeight;
enemy->varTable[8] = 0;
enemy->instigatorValue = 0;
enemy->aiFlags |= ENEMY_AI_FLAG_8;
enemy->aiFlags |= AI_FLAG_SKIP_EMOTE_AFTER_FLEE;
}
if (isInitialCall || (enemy->aiFlags & ENEMY_AI_FLAG_SUSPEND)) {
if (isInitialCall || (enemy->aiFlags & AI_FLAG_SUSPEND)) {
script->AI_TEMP_STATE = 0;
npc->duration = 0;
enemy->hitboxIsActive = FALSE;
@ -60,13 +60,13 @@ API_CALLABLE(N(TackleAI_Main)) {
npc->flags |= NPC_FLAG_FLYING;
}
if (enemy->aiFlags & ENEMY_AI_FLAG_SUSPEND) {
if (enemy->aiFlags & AI_FLAG_SUSPEND) {
EffectInstance* emoteTemp;
script->AI_TEMP_STATE = 99;
script->functionTemp[1] = 0;
fx_emote(EMOTE_QUESTION, npc, 0.0f, npc->collisionHeight, 1.0f, 2.0f, -20.0f, 40, &emoteTemp);
enemy->aiFlags &= ~ENEMY_AI_FLAG_SUSPEND;
enemy->aiFlags &= ~AI_FLAG_SUSPEND;
} else if (enemy->flags & ENEMY_FLAG_BEGIN_WITH_CHASING) {
script->AI_TEMP_STATE = 12;
enemy->flags &= ~ENEMY_FLAG_BEGIN_WITH_CHASING;

View File

@ -38,7 +38,7 @@ API_CALLABLE(N(WanderMeleeAI_Main)) {
enemy->unk_118 = 0.0001f;
#endif
if (isInitialCall || (enemy->aiFlags & ENEMY_AI_FLAG_SUSPEND)) {
if (isInitialCall || (enemy->aiFlags & AI_FLAG_SUSPEND)) {
script->AI_TEMP_STATE = AI_STATE_WANDER_INIT;
npc->duration = 0;
npc->curAnim = enemy->animList[ENEMY_ANIM_INDEX_IDLE];
@ -52,10 +52,10 @@ API_CALLABLE(N(WanderMeleeAI_Main)) {
npc->flags |= NPC_FLAG_FLYING;
}
if (enemy->aiFlags & ENEMY_AI_FLAG_SUSPEND) {
if (enemy->aiFlags & AI_FLAG_SUSPEND) {
script->AI_TEMP_STATE = AI_STATE_SUSPEND;
script->functionTemp[1] = AI_STATE_WANDER_INIT;
enemy->aiFlags &= ~ENEMY_AI_FLAG_SUSPEND;
enemy->aiFlags &= ~AI_FLAG_SUSPEND;
}
enemy->AI_VAR_ATTACK_STATE = MELEE_HITBOX_STATE_NONE;
}

View File

@ -26,7 +26,7 @@ dead_npc_move_heading = 0x8003E424;
dead_sqrtf = 0x80067040;
dead_npc_test_move_simple_with_slipping = 0x800E5304;
dead_npc_raycast_down_sides = 0x800E423C;
dead_is_point_within_region = 0x8004D0C4;
dead_is_point_outside_territory = 0x8004D0C4;
dead_rand_int = 0x8002ACEC;
dead_get_npc_safe = 0x8003E534; // get_npc_safe
dead_heap_malloc = 0x8002BFD4;

View File

@ -140,7 +140,7 @@ remove_status_debuff = 0x80047D88;
remove_status_static = 0x80047E90;
remove_status_chill_out = 0x80048074;
spawn_drops = 0x80048860;
is_point_within_region = 0x800495B4;
is_point_outside_territory = 0x800495B4;
basic_ai_check_player_dist = 0x80049694;
ai_check_player_dist = 0x800499CC;
ai_enemy_play_sound = 0x80049AA0;

View File

@ -470,7 +470,7 @@ spawn_drops = 0x80048280; // type:func rom:0x23680
get_coin_drop_amount = 0x80048D50; // type:func rom:0x24150
func_80048E34 = 0x80048E34; // type:func rom:0x24234
func_80048F0C = 0x80048F0C; // type:func rom:0x2430C
is_point_within_region = 0x80048FD4; // type:func rom:0x243D4
is_point_outside_territory = 0x80048FD4; // type:func rom:0x243D4
basic_ai_check_player_dist = 0x800490B4; // type:func rom:0x244B4
ai_check_player_dist = 0x800493EC; // type:func rom:0x247EC
ai_enemy_play_sound = 0x800494C0; // type:func rom:0x248C0

View File

@ -96,7 +96,7 @@ dead_GetSelfNpcID = GetSelfNpcID + 0x40B0;
dead_SetEnemyFlagBits = SetEnemyFlagBits + 0x40B0;
dead_GetSelfAnimationFromTable = GetSelfAnimationFromTable + 0x40B0;
dead_OnPlayerFled = OnPlayerFled + 0x40B0;
dead_is_point_within_region = is_point_within_region + 0x40F0;
dead_is_point_outside_territory = is_point_outside_territory + 0x40F0;
dead_basic_ai_check_player_dist = basic_ai_check_player_dist + 0x40F0;
dead_ai_enemy_play_sound = ai_enemy_play_sound + 0x4340;
dead_basic_ai_wander_init = basic_ai_wander_init + 0x4420;