A couple map funcs (#835)

* find_similar_areas improvement

* func_sizes in find_similar_areas

* 4 funqz

* another

* clean

* sams

* more sams

* osr, pra

* omo

* some obk

* cleanup + funcz

* wip

* warnings

* more

* 3 mo

* 7 more

* render_models (thanks Unnunu\!)

* cleanup

* PR comments
This commit is contained in:
Ethan Roseman 2022-10-25 06:04:54 -04:00 committed by GitHub
parent ec25f51281
commit b64886fa8c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
362 changed files with 3598 additions and 12538 deletions

View File

@ -1753,13 +1753,17 @@ typedef struct ActorMovement {
/* 0x00 */ Vec3f currentPos;
/* 0x0C */ Vec3f goalPos;
/* 0x18 */ Vec3f unk_18;
/* 0x24 */ char unk_24[24];
/* 0x24 */ char unk_24[0x18];
/* 0x3C */ f32 acceleration;
/* 0x40 */ f32 speed;
/* 0x44 */ f32 velocity;
/* 0x48 */ f32 angle;
/* 0x4C */ f32 distance;
} ActorMovement; // size = 0x50;
/* 0x50 */ f32 flyElapsed;
/* 0x54 */ char unk_11C[4];
/* 0x58 */ s16 flyTime;
/* 0x5A */ s16 flyArcAmplitude;
} ActorMovement; // size = 0x5C;
typedef struct ChompChainAnimationState {
/* 0x00 */ Vec3f currentPos;
@ -1812,10 +1816,6 @@ typedef struct Actor {
/* 0x008 */ struct ActorBlueprint* actorBlueprint;
/* 0x00C */ ActorState state;
/* 0x0C8 */ ActorMovement fly;
/* 0x118 */ f32 flyElapsed;
/* 0x11C */ char unk_11C[4];
/* 0x120 */ s16 flyTime;
/* 0x122 */ s16 flyArcAmplitude;
/* 0x124 */ char unk_124[16];
/* 0x134 */ u8 unk_134;
/* 0x135 */ u8 footStepCounter;

View File

@ -118,6 +118,6 @@
#define mdl_get_copied_gfx dead_mdl_get_copied_gfx
#define gMatrixListPos dead_gMatrixListPos
#define gDisplayContext dead_gDisplayContext
#define fx_sun_undeclared fx_sun
#define fx_sun_undeclared dead_fx_sun_undeclared
#endif

View File

@ -2674,4 +2674,6 @@ EffectInstance* fx_pink_sparkles(s32, f32, f32, f32, f32, f32);
EffectInstance* fx_star_outline(s32, f32, f32, f32, f32, s32);
EffectInstance* fx_86(s32, f32, f32, f32, f32, s32);
void fx_sun_undeclared(s32, s32, s32, s32, s32, s32);
#endif

View File

@ -534,6 +534,7 @@ enum SoundIDs {
SOUND_JR_TROOPA_SWIM = 0x00000046,
SOUND_BOO_SPOOK = 0x00000047,
SOUND_48 = 0x00000048,
SOUND_4E = 0x0000004E,
SOUND_51 = 0x00000051,
SOUND_52 = 0x00000052,
SOUND_53 = 0x00000053,

View File

@ -528,6 +528,7 @@ void add_vec2D_polar(f32* x, f32* y, f32 r, f32 theta);
//TODO -- remove these and use audio/public.h instead
enum AuResult bgm_set_track_volumes(s32 playerIndex, s16 trackVolSet);
enum AuResult bgm_clear_track_volumes(s32 playerIndex, s16 trackVolSet);
enum AuResult bgm_set_variation(s32 playerIndex, s16 arg1);
void bgm_quiet_max_volume(void);
void bgm_reset_max_volume(void);
@ -592,6 +593,7 @@ void step_current_game_mode(void);
void update_entities(void);
void func_80138198(void);
void bgm_update_music_settings(void);
s32 func_8014AD40(void);
void update_ambient_sounds(void);
void update_windows(void);
void player_render_interact_prompts(void);

View File

@ -157,6 +157,10 @@ typedef ModelTreeInfo ModelTreeInfoList[0x200];
extern ModelTreeInfoList* mdl_currentModelTreeNodeInfo;
extern ModelList* gCurrentModels;
void set_model_fog_color_parameters(u8 primR, u8 primG, u8 primB, u8 primA, u8 fogR, u8 fogG, u8 fogB, s32 fogStart, s32 fogEnd);
void set_model_env_color_parameters(u8 primR, u8 primG, u8 primB, u8 envR, u8 envG, u8 envB);
void get_model_env_color_parameters(u8* primR, u8* primG, u8* primB, u8* envR, u8* envG, u8* envB);
void init_model_data(void);
void update_model_animator(s32);
void update_model_animator_with_transform(s32 animatorID, Mtx* mtx);

View File

@ -1057,23 +1057,16 @@ ApiStatus GetMenuSelection(Evt* script, s32 isInitialCall) {
return ApiStatus_DONE2;
}
// float regz
#ifdef NON_MATCHING
ApiStatus func_80273444(Evt* script, s32 isInitialCall) {
BattleStatus* battleStatus = &gBattleStatus;
Bytecode* args = script->ptrReadPos;
Actor* player = battleStatus->playerActor;
ActorState* playerState = &player->state;
f32 playerVel;
f32 currentX;
f32 currentY;
f32 currentZ;
f32 goalX;
f32 goalY;
f32 goalZ;
f32 x, y, z;
f32 goalX, goalY, goalZ;
f32 var_f8;
f64 temp_f20_2;
f32 sub;
f64 playerSpeed;
if (isInitialCall) {
script->functionTemp[0] = FALSE;
@ -1084,20 +1077,21 @@ ApiStatus func_80273444(Evt* script, s32 isInitialCall) {
player->state.moveArcAmplitude = evt_get_variable(script, *args++);
script->functionTemp[1] = evt_get_variable(script, *args++);
goalX = player->state.goalPos.x;
goalY = player->state.goalPos.y;
goalZ = player->state.goalPos.z;
player->state.currentPos.x = player->currentPos.x;
player->state.currentPos.y = player->currentPos.y;
player->state.currentPos.z = player->currentPos.z;
currentX = player->currentPos.x;
currentY = player->currentPos.y;
currentZ = player->currentPos.z;
player->state.angle = atan2(currentX, currentZ, goalX, goalZ);
player->state.distance = dist2D(currentX, currentZ, goalX, goalZ);
x = player->state.currentPos.x;
y = player->state.currentPos.y;
z = player->state.currentPos.z;
goalX = player->state.goalPos.x;
goalY = player->state.goalPos.y;
goalZ = player->state.goalPos.z;
sub = goalY - currentY;
player->state.angle = atan2(x, z, goalX, goalZ);
player->state.distance = dist2D(x, z, goalX, goalZ);
y = goalY - y;
if (player->state.moveTime == 0) {
player->state.moveTime = player->state.distance / player->state.speed;
@ -1108,7 +1102,7 @@ ApiStatus func_80273444(Evt* script, s32 isInitialCall) {
}
playerState->speed += var_f8 / playerState->moveTime;
playerState->velocity = (playerState->acceleration * playerState->moveTime * 0.5f) + (sub / playerState->moveTime);
playerState->velocity = (playerState->acceleration * playerState->moveTime * 0.5f) + (y / playerState->moveTime);
set_animation(0, 0, playerState->animJumpRise);
playerState->unk_24 = 90.0f;
playerState->unk_28 = 180 / playerState->moveTime;
@ -1141,8 +1135,8 @@ ApiStatus func_80273444(Evt* script, s32 isInitialCall) {
playerState->currentPos.y += playerVel;
playerState->velocity -= playerState->acceleration;
temp_f20_2 = playerState->speed;
add_xz_vec3f(&playerState->currentPos, temp_f20_2 + sin_rad(DEG_TO_RAD(playerState->unk_24)), playerState->angle);
playerSpeed = playerState->speed;
add_xz_vec3f(&playerState->currentPos, playerSpeed + sin_rad(DEG_TO_RAD(playerState->unk_24)), playerState->angle);
playerState->unk_24 += playerState->unk_28;
playerState->unk_24 = clamp_angle(playerState->unk_24);
player->currentPos.x = playerState->currentPos.x;
@ -1164,26 +1158,13 @@ ApiStatus func_80273444(Evt* script, s32 isInitialCall) {
return ApiStatus_DONE1;
}
#else
INCLUDE_ASM(s32, "19FAF0", func_80273444);
#endif
//float bs
#ifdef NON_MATCHING
s32 PlayerFallToGoal(Evt* script, s32 isInitialCall) {
ApiStatus PlayerFallToGoal(Evt* script, s32 isInitialCall) {
Bytecode* args = script->ptrReadPos;
Actor* player = gBattleStatus.playerActor;
ActorState* state = &player->state;
f32 temp_f0_2;
f32 temp_f20;
f32 goalX;
f32 goalY;
f32 goalZ;
f32 currentX, currentY, currentZ;
f32 new_var2;
f32 temp;
f32 xTemp, yTemp, zTemp;
f32 goalPosX, goalPosZ;
f32 x, y, z;
f32 goalX, goalY, goalZ;
if (isInitialCall) {
script->functionTemp[0] = FALSE;
@ -1192,23 +1173,23 @@ s32 PlayerFallToGoal(Evt* script, s32 isInitialCall) {
if (!script->functionTemp[0]) {
s32 moveTime = evt_get_variable(script, *args++);
state->currentPos.x = player->currentPos.x;
state->currentPos.z = player->currentPos.z;
currentX = state->currentPos.x;
state->currentPos.y = player->currentPos.y;
currentY = state->currentPos.y;
temp = state->currentPos.z;
player->state.currentPos.x = player->currentPos.x;
player->state.currentPos.y = player->currentPos.y;
player->state.currentPos.z = player->currentPos.z;
goalX = state->goalPos.x;
goalY = state->goalPos.y;
goalZ = state->goalPos.z;
x = player->state.currentPos.x;
y = player->state.currentPos.y;
z = player->state.currentPos.z;
goalX = player->state.goalPos.x;
goalY = player->state.goalPos.y;
goalZ = player->state.goalPos.z;
state->moveTime = moveTime;
state->angle = atan2(currentX, temp, goalX, goalZ);
state->distance = dist2D(currentX, temp, goalX, goalZ);
player->state.angle = atan2(x, z, goalX, goalZ);
player->state.distance = dist2D(x, z, goalX, goalZ);
temp = goalY - currentY;
y = goalY - y;
if (state->moveTime == 0) {
state->moveTime = state->distance / state->speed;
@ -1217,13 +1198,13 @@ s32 PlayerFallToGoal(Evt* script, s32 isInitialCall) {
}
state->velocity = 0.0f;
state->acceleration = (((temp / state->moveTime) - state->velocity) / (-state->moveTime * 0.5));
state->acceleration = ((y / state->moveTime) - state->velocity) / (-state->moveTime * 0.5);
set_animation(ACTOR_PLAYER, 0, state->animJumpRise);
script->functionTemp[0] = TRUE;
}
if (state->velocity < 0.0f) {
set_animation(0, 0, state->animJumpFall);
set_animation(ACTOR_PLAYER, 0, state->animJumpFall);
}
state->currentPos.y += state->velocity;
@ -1245,9 +1226,6 @@ s32 PlayerFallToGoal(Evt* script, s32 isInitialCall) {
}
return ApiStatus_BLOCK;
}
#else
INCLUDE_ASM(s32, "19FAF0", PlayerFallToGoal, Evt* script, s32 isInitialCall);
#endif
ApiStatus PlayerLandJump(Evt *script, s32 isInitialCall) {
Actor* player = gBattleStatus.playerActor;

View File

@ -1003,9 +1003,171 @@ ApiStatus BindNextTurn(Evt* script, s32 isInitialCall) {
INCLUDE_ASM(s32, "1A5830", JumpToGoal);
INCLUDE_ASM(s32, "1A5830", IdleJumpToGoal);
ApiStatus IdleJumpToGoal(Evt* script, s32 isInitialCall) {
Bytecode* args = script->ptrReadPos;
ActorMovement* fly;
f32 x, y, z;
f32 goalX, goalY, goalZ;
f32 var_f8;
Actor* actor;
INCLUDE_ASM(s32, "1A5830", JumpToGoalSimple2);
if (isInitialCall) {
script->functionTemp[0] = FALSE;
}
if (!script->functionTemp[0]) {
s32 actorID = evt_get_variable(script, *args++);
if (actorID == ACTOR_SELF) {
actorID = script->owner1.actorID;
}
script->functionTempPtr[1] = actor = get_actor(actorID);
fly = &actor->fly;
actor->fly.flyTime = evt_get_variable(script, *args++);
script->functionTemp[2] = evt_get_variable(script, *args++);
script->functionTemp[3] = evt_get_variable(script, *args++);
fly->currentPos.x = actor->currentPos.x;
fly->currentPos.y = actor->currentPos.y;
fly->currentPos.z = actor->currentPos.z;
x = fly->currentPos.x;
y = fly->currentPos.y;
z = fly->currentPos.z;
goalX = fly->goalPos.x;
goalY = fly->goalPos.y;
goalZ = fly->goalPos.z;
fly->angle = atan2(x, z, goalX, goalZ);
fly->distance = dist2D(x, z, goalX, goalZ);
y = goalY - y;
if (fly->flyTime == 0) {
fly->flyTime = fly->distance / fly->speed;
var_f8 = fly->distance - (fly->flyTime * fly->speed);
} else {
fly->speed = fly->distance / fly->flyTime;
var_f8 = fly->distance - (fly->flyTime * fly->speed);
}
if (fly->flyTime == 0) {
return ApiStatus_DONE2;
}
fly->velocity = ((fly->acceleration * fly->flyTime) * 0.5f) + (y / fly->flyTime);
fly->speed += var_f8 / fly->flyTime;
script->functionTemp[0] = TRUE;
}
actor = script->functionTempPtr[1];
fly = &actor->fly;
fly->currentPos.y += fly->velocity;
fly->velocity -= fly->acceleration;
if (fly->velocity < 0.0f && fly->goalPos.y > fly->currentPos.y) {
fly->currentPos.y = fly->goalPos.y;
}
add_xz_vec3f_copy2(&fly->currentPos, fly->speed, fly->angle);
actor->currentPos.x = fly->currentPos.x;
actor->currentPos.y = fly->currentPos.y;
actor->currentPos.z = fly->currentPos.z;
fly->flyTime--;
if (fly->flyTime <= 0) {
if (script->functionTemp[3] != 0) {
play_movement_dust_effects(2, fly->goalPos.x, fly->goalPos.y, fly->goalPos.z, fly->angle);
}
actor->currentPos.x = fly->goalPos.x;
actor->currentPos.y = fly->goalPos.y;
actor->currentPos.z = fly->goalPos.z;
return ApiStatus_DONE1;
}
return ApiStatus_BLOCK;
}
ApiStatus JumpToGoalSimple2(Evt* script, s32 isInitialCall) {
Bytecode* args = script->ptrReadPos;
ActorState* state;
f32 x, y, z;
f32 goalX, goalY, goalZ;
f32 var_f8;
Actor* actor;
if (isInitialCall) {
script->functionTemp[0] = FALSE;
}
if (!script->functionTemp[0]) {
s32 actorID = evt_get_variable(script, *args++);
if (actorID == ACTOR_SELF) {
actorID = script->owner1.actorID;
}
script->functionTempPtr[1] = actor = get_actor(actorID);
state = &actor->state;
state->moveTime = evt_get_variable(script, *args++);
state->currentPos.x = actor->currentPos.x;
state->currentPos.y = actor->currentPos.y;
state->currentPos.z = actor->currentPos.z;
x = state->currentPos.x;
y = state->currentPos.y;
z = state->currentPos.z;
goalX = state->goalPos.x;
goalY = state->goalPos.y;
goalZ = state->goalPos.z;
state->angle = atan2(x, z, goalX, goalZ);
state->distance = dist2D(x, z, goalX, goalZ);
y -= goalY;
if (state->moveTime == 0) {
state->moveTime = state->distance / state->speed;
var_f8 = state->distance - (state->moveTime * state->speed);
} else {
state->speed = state->distance / state->moveTime;
var_f8 = state->distance - (state->moveTime * state->speed);
}
if (state->moveTime == 0) {
return ApiStatus_DONE2;
}
state->velocity = ((state->acceleration * state->moveTime) * 0.5f) + (y / state->moveTime);
state->speed += var_f8 / state->moveTime;
if (actor->actorTypeData1[4] != 0) {
sfx_play_sound_at_position(actor->actorTypeData1[4], 0, actor->currentPos.x, actor->currentPos.y, actor->currentPos.z);
}
script->functionTemp[0] = TRUE;
}
actor = script->functionTempPtr[1];
state = &actor->state;
state->currentPos.y -= state->velocity;
state->velocity -= state->acceleration;
if (state->velocity > 0.0f && state->goalPos.y < state->currentPos.y) {
state->currentPos.y = state->goalPos.y;
}
add_xz_vec3f(&state->currentPos, state->speed, state->angle);
actor->currentPos.x = state->currentPos.x;
actor->currentPos.y = state->currentPos.y;
actor->currentPos.z = state->currentPos.z;
state->moveTime--;
if (state->moveTime <= 0) {
play_movement_dust_effects(2, state->goalPos.x, state->goalPos.y, state->goalPos.z, state->angle);
actor->currentPos.x = state->goalPos.x;
actor->currentPos.y = state->goalPos.y;
actor->currentPos.z = state->goalPos.z;
return ApiStatus_DONE1;
}
return ApiStatus_BLOCK;
}
INCLUDE_ASM(s32, "1A5830", JumpWithBounce);
@ -1572,10 +1734,17 @@ s32 FlyPartTo(Evt* script, s32 isInitialCall) {
Actor* actor;
ActorPart* part;
ActorPartMovement* partMovement;
s32 actorID, partIndex;
s32 actorID;
s32 partIndex;
f32 f2, f4;
f32 d1, d2, d3, delta;
f32 d1_, d2_, d3_, delta_;
f32 temp_f0;
f32 xComp;
f32 temp_f0_2;
f32 temp_f0_3;
f32 yComp;
f32 zComp;
f32 temp_f2_4;
if (isInitialCall) {
actorID = evt_get_variable(script, *args++);
@ -1597,14 +1766,21 @@ s32 FlyPartTo(Evt* script, s32 isInitialCall) {
partMovement->unk_3A = evt_get_variable(script, *args++);
script->functionTemp[3] = evt_get_variable(script, *args++);
partMovement->unk_18.x = partMovement->unk_00.x = part->absolutePosition.x;
d1_ = SQ((partMovement->unk_00.x - partMovement->goalPos.x));
partMovement->unk_18.y = partMovement->unk_00.y = part->absolutePosition.y;
d2_ = SQ((partMovement->unk_00.y - partMovement->goalPos.z));
partMovement->unk_18.z = partMovement->unk_00.z = part->absolutePosition.z;
d3_ = SQ((partMovement->unk_00.z - partMovement->goalPos.z));
partMovement->distance = sqrtf(d1_ + d2_ + d3_);
temp_f0 = part->absolutePosition.x;
partMovement->unk_00.x = temp_f0;
partMovement->unk_18.x = temp_f0;
temp_f0_2 = part->absolutePosition.y;
partMovement->unk_00.y = temp_f0_2;
partMovement->unk_18.y = temp_f0_2;
temp_f0_3 = part->absolutePosition.z;
partMovement->unk_00.z = temp_f0_3;
partMovement->unk_18.z = temp_f0_3;
//xComp = temp_f0 - partMovement->goalPos.x;
f2 = partMovement->goalPos.x;
xComp = temp_f0 - f2;
yComp = temp_f0_2 - partMovement->goalPos.y;
zComp = temp_f0_3 - partMovement->goalPos.z;
partMovement->distance = sqrtf(SQ(xComp) + SQ(yComp) + SQ(zComp));
if (partMovement->moveTime == 0) {
partMovement->moveTime = partMovement->distance / partMovement->moveSpeed;
@ -1630,8 +1806,8 @@ s32 FlyPartTo(Evt* script, s32 isInitialCall) {
}
part = script->functionTempPtr[2];
partMovement = part->movement;
actor = script->functionTempPtr[1];
partMovement = part->movement;
partMovement->unk_00.x = update_lerp_battle(script->functionTemp[3], partMovement->unk_18.x, partMovement->goalPos.x, partMovement->unk_3C, partMovement->moveTime);
partMovement->unk_00.y = update_lerp_battle(script->functionTemp[3], partMovement->unk_18.y, partMovement->goalPos.y, partMovement->unk_3C, partMovement->moveTime);
partMovement->unk_00.z = update_lerp_battle(script->functionTemp[3], partMovement->unk_18.z, partMovement->goalPos.z, partMovement->unk_3C, partMovement->moveTime);
@ -1681,16 +1857,12 @@ s32 FlyPartTo(Evt* script, s32 isInitialCall) {
}
}
delta = partMovement->goalPos.x;
delta -= partMovement->unk_00.x;
d1 = SQ(delta);
delta = partMovement->goalPos.y - partMovement->unk_00.y;
d2 = SQ(delta);
delta = partMovement->goalPos.z - partMovement->unk_00.z;
d3 = SQ(delta);
f2 = sqrtf(d1 + d2 + d3);
f2 = sqrtf(
SQ(partMovement->goalPos.x - partMovement->unk_00.x) +
SQ(partMovement->goalPos.y - partMovement->unk_00.y) +
SQ(partMovement->goalPos.z - partMovement->unk_00.z)
);
//f2 = sqrtf(SQ((partMovement->unk_00.x - partMovement->goalPos.x)) + SQ((partMovement->unk_00.y - partMovement->goalPos.y)) + SQ((partMovement->unk_00.z - partMovement->goalPos.z)));
if (f2 == 0.0f) {
f2 = 1.0f;
}

View File

@ -6,6 +6,15 @@
#include "hud_element.h"
#include "effects.h"
#ifdef SHIFT
#define AREA_SPECIFIC_ENTITY_VRAM entity_default_VRAM
#else
#define MODEL_TEXTURE_BASE_ADDRESS 0x8028E000 // TODO shift
#define BATTLE_ENTITY_HEAP_BASE 0x80267FF0 // TODO shift
#define AREA_SPECIFIC_ENTITY_VRAM 0x802BAE00
#define BATTLE_ENTITY_HEAP_BOTTOM 0x80250000 // TODO shift
#endif
typedef struct Fog {
/* 0x00 */ s32 enabled;
/* 0x04 */ s32 r;
@ -385,7 +394,7 @@ Gfx D_8014B400[21][5] = {
},
};
void* mdl_textureBaseAddress = 0x8028E000;
void* mdl_textureBaseAddress = (void*) MODEL_TEXTURE_BASE_ADDRESS;
u8 mdl_bgMultiplyColorA = 0;
u8 mdl_bgMultiplyColorR = 0;
@ -1085,9 +1094,9 @@ void entity_free_static_data(EntityBlueprint* data);
s32 create_entity_shadow(Entity* entity, f32 x, f32 y, f32 z);
void update_entity_shadow_position(Entity* entity);
void func_80117D00(Model* model);
void appendGfx_model_group(Model* model);
void appendGfx_model_group(void* model);
void render_transform_group_node(ModelNode* node);
void render_transform_group(ModelTransformGroup* group);
void render_transform_group(void* group);
void func_801180E8(TextureHeader*, void**, u8* raster, u16* palette, u8* auxRaster, u16* auxPalette, s32, s32, s32, s32);
void load_model_transforms(ModelNode* model, ModelNode* parent, Matrix4f mdlTxMtx, s32 treeDepth);
s32 is_identity_fixed_mtx(Mtx* mtx);
@ -1772,12 +1781,6 @@ void entity_reset_collision(Entity* entity) {
entity->flags &= ~ENTITY_FLAGS_DETECTED_COLLISION;
}
#ifdef SHIFT
#define AREA_SPECIFIC_ENTITY_VRAM entity_default_VRAM
#else
#define AREA_SPECIFIC_ENTITY_VRAM 0x802BAE00
#endif
void load_area_specific_entity_data(void) {
if (!entity_area_specific_data_is_loaded) {
if (gGameStatusPtr->areaID == AREA_JAN || gGameStatusPtr->areaID == AREA_IWA) {
@ -1826,8 +1829,8 @@ void clear_entity_data(s32 arg0) {
}
if (!gGameStatusPtr->isBattle) {
gEntityHeapBottom = 0x80250000;
gEntityHeapBase = 0x80267FF0;
gEntityHeapBottom = BATTLE_ENTITY_HEAP_BOTTOM;
gEntityHeapBase = BATTLE_ENTITY_HEAP_BASE;
} else {
gEntityHeapBottom = (s32)&D_801A7000;
gEntityHeapBase = gEntityHeapBottom + 0x3000;
@ -1847,8 +1850,8 @@ void clear_entity_data(s32 arg0) {
void init_entity_data(void) {
if (!gGameStatusPtr->isBattle) {
gEntityHeapBottom = 0x80250000;
gEntityHeapBase = 0x80267FF0;
gEntityHeapBottom = BATTLE_ENTITY_HEAP_BOTTOM;
gEntityHeapBase = BATTLE_ENTITY_HEAP_BASE;
reload_world_entity_data();
} else {
s32 i;
@ -2053,19 +2056,15 @@ void load_simple_entity_data(Entity* entity, EntityBlueprint* bp, s32 listIndex)
void load_split_entity_data(Entity* entity, EntityBlueprint* entityData, s32 listIndex) {
s32 swizzlePointers = FALSE;
s32 s2;
s32 loadedStart, loadedEnd;
void* animBaseAddr;
s32 v0, v00;
s16* animationScript;
StaticAnimatorNode** animationNodes;
s32 s00;
s32 specialSize;
s32 dma1size;
s32 dma2size_1;
s32 dma2size_2;
s32 totalLoaded;
s32 totalLoadedBytes;
if (entityData->flags & ENTITY_FLAGS_HAS_ANIMATED_MODEL) {
DmaEntry* dmaList = entityData->dmaList;
@ -2959,7 +2958,7 @@ void state_render_frontUI(void) {
}
}
void appendGfx_model(Model* model);
void appendGfx_model(void* data);
INCLUDE_ASM(void, "a5dd0_len_114e0", appendGfx_model, Model*);
void func_80114B58(u32 romOffset, TextureHandle* handle, TextureHeader* header, s32 mainSize, s32 mainPalSize, s32 auxSize, s32 auxPalSize) {
@ -3307,280 +3306,216 @@ INCLUDE_ASM(s32, "a5dd0_len_114e0", func_80116674);
INCLUDE_ASM(s32, "a5dd0_len_114e0", func_80116698);
// this function has weird control flow and suqqz
#ifdef NON_EQUIVALENT
void render_models(void) {
RenderTask rt;
RenderTask* rtPtr = &rt;
f32 outX, outY, outZ, outS;
f32 m00, m01, m02, m03;
f32 m10, m11, m12, m13;
f32 m20, m21, m22, m23;
f32 m30, m31, m32, m33;
f32 x, y, z;
f32 bbx, bby, bbz;
Camera* camera = &gCameras[gCurrentCameraID];
Model* model;
ModelBoundingBox* boundingBox;
ModelTransformGroup* transformGroup;
f32 xComp, yComp, zComp;
s32 distance;
s32 cond;
s32 i;
RenderTask rt;
RenderTask* rtPtr = &rt;
f32 sp38;
f32 sp3C;
f32 sp40;
f32 sp44;
f32 sp48;
f32 sp4C;
f32 sp50;
f32 sp54;
f32 sp58;
f32 sp5C;
f32 sp60;
f32 sp64;
f32 sp68;
f32 sp6C;
f32 sp70;
f32 sp74;
f32 sp78;
f32 sp7C;
f32 sp80;
f32 sp84;
f32 centerX, centerY, centerZ;
f32 sp98;
f32 spA0;
#define COMMON_RENDER_MODELS \
outX = (m00 * xComp) + (m10 * yComp) + (m20 * zComp) + m30; \
outY = (m01 * xComp) + (m11 * yComp) + (m21 * zComp) + m31; \
outZ = (m02 * xComp) + (m12 * yComp) + (m22 * zComp) + m32; \
outS = (m03 * xComp) + (m13 * yComp) + (m23 * zComp) + m33; \
if (outS == 0.0f) { \
break; \
} \
outS = 1.0f / outS; \
xComp = outX * outS; \
yComp = outY * outS; \
zComp = outZ * outS; \
if (zComp > -1.0f && xComp >= -1.0f && xComp <= 1.0f && yComp >= -1.0f && yComp <= 1.0f) { \
break; \
}
f32 temp_f0;
f32 temp_f0_2;
f32 temp_f0_3;
f32 temp_f0_4;
f32 temp_f0_5;
f32 temp_f0_6;
f32 temp_f0_7;
f32 temp_f0_8;
f32 temp_f12;
f32 temp_f12_10;
f32 temp_f12_11;
f32 temp_f12_12;
f32 temp_f12_13;
f32 temp_f12_14;
f32 temp_f12_15;
f32 temp_f12_16;
f32 temp_f12_2;
f32 temp_f12_3;
f32 temp_f12_4;
f32 temp_f12_5;
f32 temp_f12_6;
f32 temp_f12_7;
f32 temp_f12_8;
f32 temp_f12_9;
f32 temp_f20;
f32 temp_f20_2;
f32 temp_f20_3;
f32 temp_f20_4;
f32 temp_f20_5;
f32 temp_f20_6;
f32 temp_f20_7;
f32 temp_f20_8;
f32 temp_f26;
f32 temp_f28;
f32 temp_f2;
f32 temp_f2_2;
f32 temp_f2_3;
f32 temp_f2_4;
f32 temp_f2_5;
f32 temp_f2_6;
f32 temp_f2_7;
f32 temp_f2_8;
f32 temp_f4;
f32 temp_f4_10;
f32 temp_f4_11;
f32 temp_f4_12;
f32 temp_f4_13;
f32 temp_f4_14;
f32 temp_f4_15;
f32 temp_f4_16;
f32 temp_f4_17;
f32 temp_f4_18;
f32 temp_f4_19;
f32 temp_f4_20;
f32 temp_f4_21;
f32 temp_f4_22;
f32 temp_f4_23;
f32 temp_f4_24;
f32 temp_f4_2;
f32 temp_f4_3;
f32 temp_f4_4;
f32 temp_f4_5;
f32 temp_f4_6;
f32 temp_f4_7;
f32 temp_f4_8;
f32 temp_f4_9;
f32 temp_f6;
f32 temp_f6_2;
f32 temp_f6_3;
f32 temp_f6_4;
f32 temp_f6_5;
f32 temp_f6_6;
f32 temp_f6_7;
f32 temp_f6_8;
f32 temp_f8;
f32 temp_f8_2;
f32 temp_f8_3;
f32 temp_f8_4;
f32 temp_f8_5;
f32 temp_f8_6;
f32 temp_f8_7;
f32 temp_f8_8;
sp48 = camera->perspectiveMatrix[0][0];
sp4C = camera->perspectiveMatrix[0][1];
sp50 = camera->perspectiveMatrix[0][2];
sp54 = camera->perspectiveMatrix[0][3];
sp58 = camera->perspectiveMatrix[1][0];
sp5C = camera->perspectiveMatrix[1][1];
sp60 = camera->perspectiveMatrix[1][2];
sp64 = camera->perspectiveMatrix[1][3];
sp68 = camera->perspectiveMatrix[2][0];
sp6C = camera->perspectiveMatrix[2][1];
sp70 = camera->perspectiveMatrix[2][2];
sp74 = camera->perspectiveMatrix[2][3];
sp78 = camera->perspectiveMatrix[3][0];
sp7C = camera->perspectiveMatrix[3][1];
sp80 = camera->perspectiveMatrix[3][2];
sp84 = camera->perspectiveMatrix[3][3];
m00 = camera->perspectiveMatrix[0][0];
m01 = camera->perspectiveMatrix[0][1];
m02 = camera->perspectiveMatrix[0][2];
m03 = camera->perspectiveMatrix[0][3];
m10 = camera->perspectiveMatrix[1][0];
m11 = camera->perspectiveMatrix[1][1];
m12 = camera->perspectiveMatrix[1][2];
m13 = camera->perspectiveMatrix[1][3];
m20 = camera->perspectiveMatrix[2][0];
m21 = camera->perspectiveMatrix[2][1];
m22 = camera->perspectiveMatrix[2][2];
m23 = camera->perspectiveMatrix[2][3];
m30 = camera->perspectiveMatrix[3][0];
m31 = camera->perspectiveMatrix[3][1];
m32 = camera->perspectiveMatrix[3][2];
m33 = camera->perspectiveMatrix[3][3];
for (i = 0; i < ARRAY_COUNT(*gCurrentModels); i++) {
Model* model = (*gCurrentModels)[i];
if (model != NULL) {
if (model->flags == 0) {
continue;
}
if (model->flags & 4) {
continue;
}
if (model->flags & 2) {
continue;
}
if (model->flags & 0x20) {
continue;
}
if (model->flags & 0x8) {
continue;
}
centerX = model->center.x;
centerY = model->center.y;
centerZ = model->center.z;
if (model->flags & 0x200) {
ModelNodeProperty* propertyList = model->modelNode->propertyList;
temp_f26 = (f32) propertyList->dataType;
sp98 = temp_f26;
spA0 = (f32) propertyList[1].dataType;
temp_f28 = (f32) propertyList[1].key;
temp_f4 = centerX - temp_f26;
temp_f12 = centerY - spA0;
temp_f20 = centerZ - temp_f28;
temp_f6 = (sp48 * temp_f4) + (sp58 * temp_f12) + (sp68 * temp_f20) + sp78;
temp_f8 = (sp4C * temp_f4) + (sp5C * temp_f12) + (sp6C * temp_f20) + sp7C;
temp_f2 = (sp50 * temp_f4) + (sp60 * temp_f12) + (sp70 * temp_f20) + sp80;
temp_f4_2 = (sp54 * temp_f4) + (sp64 * temp_f12) + (sp74 * temp_f20) + sp84;
cond = FALSE;
if ((temp_f4_2 != 0.0f) &&
((temp_f0 = 1.0f / temp_f4_2, temp_f4_3 = temp_f6 * temp_f0, temp_f12_2 = temp_f8 * temp_f0, !((temp_f2 * temp_f0) > -1.0f)) || !(temp_f4_3 >= -1.0f) || !(temp_f4_3 <= 1.0f) || !(temp_f12_2 >= -1.0f) || !(temp_f12_2 <= 1.0f)) && ((sp98 == 0.0f) || ((temp_f4_4 = centerX + sp98, temp_f12_3 = centerY - spA0, temp_f20_2 = centerZ - temp_f28, temp_f6_2 = (sp48 * temp_f4_4) + (sp58 * temp_f12_3) + (sp68 * temp_f20_2) + sp78, temp_f8_2 = (sp4C * temp_f4_4) + (sp5C * temp_f12_3) + (sp6C * temp_f20_2) + sp7C, temp_f2_2 = (sp50 * temp_f4_4) + (sp60 * temp_f12_3) + (sp70 * temp_f20_2) + sp80, temp_f4_5 = (sp54 * temp_f4_4) + (sp64 * temp_f12_3) + (sp74 * temp_f20_2) + sp84, (temp_f4_5 != 0.0f)) && ((temp_f0_2 = 1.0f / temp_f4_5, temp_f4_6 = temp_f6_2 * temp_f0_2, temp_f12_4 = temp_f8_2 * temp_f0_2, !((temp_f2_2 * temp_f0_2) > -1.0f)) || !(temp_f4_6 >= -1.0f) || !(temp_f4_6 <= 1.0f) || !(temp_f12_4 >= -1.0f) || !(temp_f12_4 <= 1.0f)))) && ((spA0 == 0.0f) || ((temp_f4_7 = centerX - sp98, temp_f12_5 = centerY + spA0, temp_f20_3 = centerZ - temp_f28, temp_f6_3 = (sp48 * temp_f4_7) + (sp58 * temp_f12_5) + (sp68 * temp_f20_3) + sp78, temp_f8_3 = (sp4C * temp_f4_7) + (sp5C * temp_f12_5) + (sp6C * temp_f20_3) + sp7C, temp_f2_3 = (sp50 * temp_f4_7) + (sp60 * temp_f12_5) + (sp70 * temp_f20_3) + sp80, temp_f4_8 = (sp54 * temp_f4_7) + (sp64 * temp_f12_5) + (sp74 * temp_f20_3) + sp84, (temp_f4_8 != 0.0f)) && ((temp_f0_3 = 1.0f / temp_f4_8, temp_f4_9 = temp_f6_3 * temp_f0_3, temp_f12_6 = temp_f8_3 * temp_f0_3, !((temp_f2_3 * temp_f0_3) > -1.0f)) || !(temp_f4_9 >= -1.0f) || !(temp_f4_9 <= 1.0f) || !(temp_f12_6 >= -1.0f) || !(temp_f12_6 <= 1.0f))))) {
if ((sp98 != 0.0f) && (spA0 != 0.0f)) {
temp_f4_10 = centerX + sp98;
temp_f12_7 = centerY + spA0;
temp_f20_4 = centerZ - temp_f28;
temp_f6_4 = (sp48 * temp_f4_10) + (sp58 * temp_f12_7) + (sp68 * temp_f20_4) + sp78;
temp_f8_4 = (sp4C * temp_f4_10) + (sp5C * temp_f12_7) + (sp6C * temp_f20_4) + sp7C;
temp_f2_4 = (sp50 * temp_f4_10) + (sp60 * temp_f12_7) + (sp70 * temp_f20_4) + sp80;
temp_f4_11 = (sp54 * temp_f4_10) + (sp64 * temp_f12_7) + (sp74 * temp_f20_4) + sp84;
if (temp_f4_11 != 0.0f) {
temp_f0_4 = 1.0f / temp_f4_11;
temp_f4_12 = temp_f6_4 * temp_f0_4;
temp_f12_8 = temp_f8_4 * temp_f0_4;
if (((temp_f2_4 * temp_f0_4) > -1.0f) && (temp_f4_12 >= -1.0f) && (temp_f4_12 <= 1.0f) && (temp_f12_8 >= -1.0f)) {
if (!(temp_f12_8 <= 1.0f)) {
goto block_36;
}
} else {
goto block_37;
}
}
} else {
block_36:
block_37:
if (((temp_f28 == 0.0f) || ((temp_f4_13 = centerX - sp98, temp_f12_9 = centerY - spA0, temp_f20_5 = centerZ + temp_f28, temp_f6_5 = (sp48 * temp_f4_13) + (sp58 * temp_f12_9) + (sp68 * temp_f20_5) + sp78, temp_f8_5 = (sp4C * temp_f4_13) + (sp5C * temp_f12_9) + (sp6C * temp_f20_5) + sp7C, temp_f2_5 = (sp50 * temp_f4_13) + (sp60 * temp_f12_9) + (sp70 * temp_f20_5) + sp80, temp_f4_14 = (sp54 * temp_f4_13) + (sp64 * temp_f12_9) + (sp74 * temp_f20_5) + sp84, (temp_f4_14 != 0.0f)) && ((temp_f0_5 = 1.0f / temp_f4_14, temp_f4_15 = temp_f6_5 * temp_f0_5, temp_f12_10 = temp_f8_5 * temp_f0_5, !((temp_f2_5 * temp_f0_5) > -1.0f)) || !(temp_f4_15 >= -1.0f) || !(temp_f4_15 <= 1.0f) || !(temp_f12_10 >= -1.0f) || !(temp_f12_10 <= 1.0f)))) && ((sp98 == 0.0f) || (temp_f28 == 0.0f) || ((temp_f4_16 = centerX + sp98, temp_f12_11 = centerY - spA0, temp_f20_6 = centerZ + temp_f28, temp_f6_6 = (sp48 * temp_f4_16) + (sp58 * temp_f12_11) + (sp68 * temp_f20_6) + sp78, temp_f8_6 = (sp4C * temp_f4_16) + (sp5C * temp_f12_11) + (sp6C * temp_f20_6) + sp7C, temp_f2_6 = (sp50 * temp_f4_16) + (sp60 * temp_f12_11) + (sp70 * temp_f20_6) + sp80, temp_f4_17 = (sp54 * temp_f4_16) + (sp64 * temp_f12_11) + (sp74 * temp_f20_6) + sp84, (temp_f4_17 != 0.0f)) && ((temp_f0_6 = 1.0f / temp_f4_17, temp_f4_18 = temp_f6_6 * temp_f0_6, temp_f12_12 = temp_f8_6 * temp_f0_6, !((temp_f2_6 * temp_f0_6) > -1.0f)) || !(temp_f4_18 >= -1.0f) || !(temp_f4_18 <= 1.0f) || !(temp_f12_12 >= -1.0f) || !(temp_f12_12 <= 1.0f)))) && ((spA0 == 0.0f) || (temp_f28 == 0.0f) || ((temp_f4_19 = centerX - sp98, temp_f12_13 = centerY + spA0, temp_f20_7 = centerZ + temp_f28, temp_f6_7 = (sp48 * temp_f4_19) + (sp58 * temp_f12_13) + (sp68 * temp_f20_7) + sp78, temp_f8_7 = (sp4C * temp_f4_19) + (sp5C * temp_f12_13) + (sp6C * temp_f20_7) + sp7C, temp_f2_7 = (sp50 * temp_f4_19) + (sp60 * temp_f12_13) + (sp70 * temp_f20_7) + sp80, temp_f4_20 = (sp54 * temp_f4_19) + (sp64 * temp_f12_13) + (sp74 * temp_f20_7) + sp84, (temp_f4_20 != 0.0f)) && ((temp_f0_7 = 1.0f / temp_f4_20, temp_f4_21 = temp_f6_7 * temp_f0_7, temp_f12_14 = temp_f8_7 * temp_f0_7, !((temp_f2_7 * temp_f0_7) > -1.0f)) || !(temp_f4_21 >= -1.0f) || !(temp_f4_21 <= 1.0f) || !(temp_f12_14 >= -1.0f) || !(temp_f12_14 <= 1.0f)))) && ((sp98 == 0.0f) || (spA0 == 0.0f) || (temp_f28 == 0.0f) || ((temp_f4_22 = centerX + sp98, temp_f12_15 = centerY + spA0, temp_f20_8 = centerZ + temp_f28, temp_f6_8 = (sp48 * temp_f4_22) + (sp58 * temp_f12_15) + (sp68 * temp_f20_8) + sp78, temp_f8_8 = (sp4C * temp_f4_22) + (sp5C * temp_f12_15) + (sp6C * temp_f20_8) + sp7C, temp_f2_8 = (sp50 * temp_f4_22) + (sp60 * temp_f12_15) + (sp70 * temp_f20_8) + sp80, temp_f4_23 = (sp54 * temp_f4_22) + (sp64 * temp_f12_15) + (sp74 * temp_f20_8) + sp84, (temp_f4_23 != 0.0f)) && ((temp_f0_8 = 1.0f / temp_f4_23, temp_f4_24 = temp_f6_8 * temp_f0_8, temp_f12_16 = temp_f8_8 * temp_f0_8, !((temp_f2_8 * temp_f0_8) > -1.0f)) || !(temp_f4_24 >= -1.0f) || !(temp_f4_24 <= 1.0f) || !(temp_f12_16 >= -1.0f) || !(temp_f12_16 <= 1.0f))))) {
cond = TRUE;
}
}
}
if (cond) {
continue;
}
}
transform_point(camera->perspectiveMatrix[0], centerX, centerY, centerZ, 1.0f, &sp38, &sp3C, &sp40, &sp44);
distance = sp40 + 5000.0f;
if (distance < 0) {
distance = 0;
} else if (distance > 10000) {
distance = 10000;
}
rtPtr->appendGfxArg = model;
if (model->modelNode->type == SHAPE_TYPE_GROUP) {
rtPtr->appendGfx = appendGfx_model_group;
} else {
rtPtr->appendGfx = appendGfx_model;
}
rtPtr->distance = -distance;
rtPtr->renderMode = model->renderMode;
queue_render_task(rtPtr);
model = (*gCurrentModels)[i];
if (model == NULL) {
continue;
}
if (model->flags == 0) {
continue;
}
if (model->flags & 4) {
continue;
}
if (model->flags & 2) {
continue;
}
if (model->flags & 0x20) {
continue;
}
if (model->flags & 8) {
continue;
}
x = model->center.x;
y = model->center.y;
z = model->center.z;
if (model->flags & 0x200) {
cond = FALSE;
boundingBox = (ModelBoundingBox*) model->modelNode->propertyList;
bbx = boundingBox->halfSizeX;
bby = boundingBox->halfSizeY;
bbz = boundingBox->halfSizeZ;
while (TRUE) {
if (TRUE) {
xComp = x - bbx;
yComp = y - bby;
zComp = z - bbz;
COMMON_RENDER_MODELS;
}
if (bbx != 0.0f) {
xComp = x + bbx;
yComp = y - bby;
zComp = z - bbz;
COMMON_RENDER_MODELS;
}
if (bby != 0.0f) {
xComp = x - bbx;
yComp = y + bby;
zComp = z - bbz;
COMMON_RENDER_MODELS;
}
if (bbx != 0.0f && bby != 0.0f) {
xComp = x + bbx;
yComp = y + bby;
zComp = z - bbz;
COMMON_RENDER_MODELS;
}
if (bbz != 0.0f) {
xComp = x - bbx;
yComp = y - bby;
zComp = z + bbz;
COMMON_RENDER_MODELS;
}
if (bbx != 0.0f && bbz != 0.0f) {
xComp = x + bbx;
yComp = y - bby;
zComp = z + bbz;
COMMON_RENDER_MODELS;
}
if (bby != 0.0f && bbz != 0.0f) {
xComp = x - bbx;
yComp = y + bby;
zComp = z + bbz;
COMMON_RENDER_MODELS;
}
if (bbx != 0.0f && bby != 0.0f && bbz != 0.0f) {
xComp = x + bbx;
yComp = y + bby;
zComp = z + bbz;
COMMON_RENDER_MODELS;
}
cond = TRUE;
break;
}
if (cond) {
continue;
}
}
transform_point(camera->perspectiveMatrix, x, y, z, 1.0f, &outX, &outY, &outZ, &outS);
distance = outZ + 5000.0f;
if (distance < 0) {
distance = 0;
} else if (distance > 10000) {
distance = 10000;
}
rtPtr->appendGfxArg = model;
if (model->modelNode->type == SHAPE_TYPE_GROUP) {
rtPtr->appendGfx = appendGfx_model_group;
} else {
rtPtr->appendGfx = appendGfx_model;
}
rtPtr->distance = -distance;
rtPtr->renderMode = model->renderMode;
queue_render_task(rtPtr);
}
for (i = 0; i < ARRAY_COUNT(*gCurrentTransformGroups); i++) {
ModelTransformGroup* group = (*gCurrentTransformGroups)[i];
f32 centerX, centerY, centerZ;
s32 distance;
if (group == NULL) {
continue;
}
if (group->flags == 0) {
continue;
}
if (group->flags & MODEL_TRANSFORM_GROUP_FLAGS_4) {
transformGroup = (*gCurrentTransformGroups)[i];
if (transformGroup == NULL) {
continue;
}
centerX = group->center.x;
centerY = group->center.y;
centerZ = group->center.z;
transform_point(camera->perspectiveMatrix, centerX, centerY, centerZ, 1.0f, &sp38, &sp3C, &sp40, &sp44);
if (sp44 == 0.0f) {
sp44 = 1.0f;
if (transformGroup->flags == 0) {
continue;
}
distance = (sp40 / sp44) * 10000.0f;
if (transformGroup->flags & 4) {
continue;
}
if (!(group->flags & MODEL_TRANSFORM_GROUP_FLAGS_2)) {
xComp = transformGroup->center.x;
yComp = transformGroup->center.y;
zComp = transformGroup->center.z;
transform_point(
camera->perspectiveMatrix,
xComp, yComp, zComp, 1.0f,
&outX, &outY, &outZ, &outS
);
if (outS == 0.0f) {
outS = 1.0f;
}
distance = ((outZ / outS) * 10000.0f);
if (!(transformGroup->flags & 2)) {
rtPtr->appendGfx = render_transform_group;
rtPtr->appendGfxArg = group;
rtPtr->appendGfxArg = transformGroup;
rtPtr->distance = -distance;
rtPtr->renderMode = group->renderMode;
rtPtr->renderMode = transformGroup->renderMode;
queue_render_task(rtPtr);
}
}
}
#else
INCLUDE_ASM(s32, "a5dd0_len_114e0", render_models);
#endif
void appendGfx_model_group(Model* model) {
void appendGfx_model_group(void* data) {
Model* model = data;
s32 modelTreeDepth = (*mdl_currentModelTreeNodeInfo)[model->modelID].treeDepth;
s32 i;
@ -3689,19 +3624,19 @@ void render_transform_group_node(ModelNode* node) {
}
// arg0 and gfx temps needed
void render_transform_group(ModelTransformGroup* group) {
ModelTransformGroup* mtg = group;
// gfx temps needed
void render_transform_group(void* data) {
ModelTransformGroup* group = data;
Gfx** gfx = &gMasterGfxPos;
if (!(mtg->flags & MODEL_TRANSFORM_GROUP_FLAGS_4)) {
mdl_currentTransformGroupChildIndex = mtg->minChildModelIndex;
if (!(mtg->flags & MODEL_TRANSFORM_GROUP_FLAGS_2000)) {
gSPMatrix((*gfx)++, mtg->transformMtx, (G_MTX_PUSH | G_MTX_LOAD) | G_MTX_MODELVIEW);
if (!(group->flags & MODEL_TRANSFORM_GROUP_FLAGS_4)) {
mdl_currentTransformGroupChildIndex = group->minChildModelIndex;
if (!(group->flags & MODEL_TRANSFORM_GROUP_FLAGS_2000)) {
gSPMatrix((*gfx)++, group->transformMtx, (G_MTX_PUSH | G_MTX_LOAD) | G_MTX_MODELVIEW);
}
render_transform_group_node(mtg->modelNode);
if (!(mtg->flags & MODEL_TRANSFORM_GROUP_FLAGS_2000)) {
render_transform_group_node(group->modelNode);
if (!(group->flags & MODEL_TRANSFORM_GROUP_FLAGS_2000)) {
gSPPopMatrix((*gfx)++, G_MTX_MODELVIEW);
}
gDPPipeSync((*gfx)++);

View File

@ -1119,7 +1119,7 @@ void func_8013CFA8(FoldState* state, Matrix4f mtx) {
i = state->firstVtxIdx;
while (1) {
while (TRUE) {
Camera* cam;
s32 uls = (fold_vtxBuf[i + 0].v.tc[0] >> 0x5) - 0x100;
s32 ult = (fold_vtxBuf[i + 0].v.tc[1] >> 0x5) - 0x100;

View File

@ -1,4 +1,5 @@
#include "common.h"
#include "model.h"
char gCloudyFlowerFieldsBg[] = "fla_bg";
char gSunnyFlowerFieldsBg[] = "flb_bg";
@ -10,8 +11,6 @@ f32 gBackroundWavePhase = 0.0f;
extern PAL_BIN gBackgroundPalette[256];
extern f32 gBackroundLastScrollValue;
void get_model_env_color_parameters(u8* primR, u8* primG, u8* primB, u8* envR, u8* envG, u8* envB);
void load_map_bg(char* optAssetName) {
if (optAssetName != NULL) {
UNK_PTR compressedData;

View File

@ -95,23 +95,18 @@ void blast_render(EffectInstance* effect) {
#ifdef NON_MATCHING
void blast_appendGfx(void* effect) {
Matrix4f sp18, sp58, sp98;
Gfx* dlist;
Gfx* dlist2;
BlastFXData* data = ((EffectInstance*)effect)->data;
f32 temp_f2;
Gfx* dlist = D_090017B0_37F190;
BlastFXData* data = ((EffectInstance*)effect)->data.blast;
s32 temp_f4;
s32 alpha;
f32 new_var;
dlist = D_090017B0_37F190;
dlist2 = D_09001300_37ECD0;
temp_f2 = data->unk_20;
temp_f4 = temp_f2;
alpha = (temp_f2 - temp_f4) * 256.0f;
new_var = (temp_f4 = data->unk_20);
alpha = (new_var - ((s32) data->unk_20)) * 256.0f;
gDPPipeSync(gMasterGfxPos++);
gSPSegment(gMasterGfxPos++, 0x09, VIRTUAL_TO_PHYSICAL(((EffectInstance*)effect)->graphics->data));
gSPDisplayList(gMasterGfxPos++, dlist2);
gSPDisplayList(gMasterGfxPos++, D_09001300_37ECD0);
gSPDisplayList(gMasterGfxPos++, D_E007C510[temp_f4]);
shim_guTranslateF(sp18, data->pos.x, data->pos.y, data->pos.z);

View File

@ -2107,12 +2107,10 @@ void func_8003DA38(Npc* npc, s32 arg1) {
}
}
// floats suqqz
#ifdef NON_EQUIVALENT
void func_8003DC38(Npc* npc, s32 arg1) {
f32 xTemp;
f32 zTemp;
f32 yTemp;
PlayerStatus* playerStatus = &gPlayerStatus;
f32 xTemp, yTemp, zTemp;
f32 xTemp2, yTemp2, zTemp2;
f32 theta;
f32 sinTheta;
f32 cosTheta;
@ -2127,15 +2125,14 @@ void func_8003DC38(Npc* npc, s32 arg1) {
for (i = 0; i < 4; i++) {
xTemp = rand_int(10) - 5;
yTemp = -2.0f;
zTemp = rand_int(10) - 5;
yTemp -= (SQ(xTemp) + SQ(zTemp)) / 5.0f;
yTemp = -2.0f - ((SQ(xTemp) + SQ(zTemp)) / 5.0f);
D_80077C28 = 0;
theta = DEG_TO_RAD(clamp_angle(-npc->yaw + i * 90));
theta = DEG_TO_RAD(clamp_angle(-npc->yaw + (i * 90)));
sinTheta = sin_rad(theta);
cosTheta = cos_rad(theta);
fx_cloud_trail(
1,
npc->pos.x + (npc->collisionRadius * sinTheta * -0.3f) + xTemp,
@ -2144,11 +2141,10 @@ void func_8003DC38(Npc* npc, s32 arg1) {
);
}
} else {
xTemp = rand_int(10) - 5;
yTemp = -2.0f;
zTemp = rand_int(10) - 5;
xTemp2 = rand_int(10) - 5;
zTemp2 = rand_int(10) - 5;
yTemp2 = -2.0f - ((SQ(xTemp2) + SQ(zTemp2)) / 5.0f);
yTemp -= (SQ(xTemp) + SQ(zTemp)) / 5.0f;
D_80077C28 = 0;
theta = DEG_TO_RAD(clamp_angle(-npc->yaw));
@ -2156,15 +2152,12 @@ void func_8003DC38(Npc* npc, s32 arg1) {
cosTheta = cos_rad(theta);
fx_cloud_trail(
1,
npc->pos.x + (npc->collisionRadius * sinTheta * -0.3f) + xTemp,
npc->pos.y + 15.5f + yTemp,
npc->pos.z + (npc->collisionRadius * cosTheta * -0.3f) + zTemp
npc->pos.x + (npc->collisionRadius * sinTheta * -0.3f) + xTemp2,
npc->pos.y + 15.5f + yTemp2,
npc->pos.z + (npc->collisionRadius * cosTheta * -0.3f) + zTemp2
);
}
}
#else
INCLUDE_ASM(s32, "npc", func_8003DC38);
#endif
void func_8003DFA0(Npc* npc, s32 arg1) {
if (D_80077C30++ >= 4) {

View File

@ -817,7 +817,9 @@ s32 spr_draw_player_sprite(s32 spriteInstanceID, s32 yaw, s32 alphaIn, u16** pal
s32 camRelativeYaw;
s32 alpha;
f32 zscale;
u32 animIdx;
PAL_PTR* drawPalettes;
SpriteAnimData* animData;
camRelativeYaw = yaw;
spriteAnimIndex = spriteInstanceID & 0xFF;
@ -830,12 +832,17 @@ s32 spr_draw_player_sprite(s32 spriteInstanceID, s32 yaw, s32 alphaIn, u16** pal
spriteIndex = ((animID >> 0x10) & 0xFF) - 1;
D_802DF57C = spriteIndex;
if (spr_playerSprites[spriteIndex] == NULL) {
animData = spr_playerSprites[spriteIndex];
if (animData == NULL) {
return 0;
}
rasterList = spr_playerSprites[spriteIndex]->rastersOffset;
animList = &spr_playerSprites[spriteIndex]->animListStart[animID & 0xFF];
drawPalettes = spr_playerSprites[spriteIndex]->palettesOffset;
animIdx = animID & 0xFF;
animIdx++;
rasterList = animData->rastersOffset;
animList = animData->animListStart[animIdx];
drawPalettes = animData->palettesOffset;
if (animID & SPRITE_ID_BACK_FACING) {
switch (spriteIndex) {
case 0:
@ -843,7 +850,7 @@ s32 spr_draw_player_sprite(s32 spriteInstanceID, s32 yaw, s32 alphaIn, u16** pal
case 9:
spriteIndex++;
D_802DF57C = spriteIndex;
rasterList = spr_playerSprites[spriteIndex]->rastersOffset;
rasterList = spr_playerSprites[D_802DF57C]->rastersOffset;
break;
}
}

View File

@ -1,8 +1,7 @@
#include "flo_00.h"
#include "effects.h"
// Same as SpawnSunEffect, but doesn't touch float regs like SpawnSunEffect does
void fx_sun_undeclared(s32, s32, s32, s32, s32, s32);
ApiStatus N(func_80240000_C9DF20)(Evt* script, s32 isInitialCall) {
fx_sun_undeclared(0, 0, 0, 0, 0, 0);
return ApiStatus_DONE2;

View File

@ -1,6 +1,5 @@
#include "flo_03.h"
void fx_sun_undeclared(s32, s32, s32, s32, s32, s32);
#include "effects.h"
ApiStatus N(func_80240000_CA72A0)(Evt* script, s32 isInitialCall) {
fx_sun_undeclared(1, 0, 0, 0, 0, 0);

View File

@ -1,6 +1,5 @@
#include "flo_09.h"
void fx_sun_undeclared(s32, s32, s32, s32, s32, s32);
#include "effects.h"
ApiStatus N(func_80240000_CB5000)(Evt* script, s32 isInitialCall) {
fx_sun_undeclared(1, 0, 0, 0, 0, 0);

View File

@ -1,6 +1,5 @@
#include "flo_10.h"
void fx_sun_undeclared(s32, s32, s32, s32, s32, s32);
#include "effects.h"
ApiStatus N(func_80240040_CB9240)(Evt* script, s32 isInitialCall) {
fx_sun_undeclared(1, 0, 0, 0, 0, 0);

View File

@ -2,6 +2,7 @@
#include "message_ids.h"
#include "sprite/npc/Lakitu.h"
#include "entity.h"
#include "effects.h"
enum {
NPC_LAKITU0,
@ -657,8 +658,6 @@ EvtScript N(makeEntities) = {
#include "world/common/entity/Pipe.inc.c"
void fx_sun_undeclared(s32, s32, s32, s32, s32, s32);
ApiStatus N(func_802402E0_CBDFB0)(Evt* script, s32 isInitialCall) {
fx_sun_undeclared(0, 0, 0, 0, 0, 0);
return ApiStatus_DONE2;

View File

@ -1,6 +1,5 @@
#include "flo_12.h"
void fx_sun_undeclared(s32, s32, s32, s32, s32, s32);
#include "effects.h"
ApiStatus N(func_80240000_CC0E30)(Evt* script, s32 isInitialCall) {
fx_sun_undeclared(0, 0, 0, 0, 0, 0);

View File

@ -1,6 +1,5 @@
#include "flo_13.h"
void fx_sun_undeclared(s32, s32, s32, s32, s32, s32);
#include "effects.h"
ApiStatus N(func_80240000_CC3810)(Evt* script, s32 isInitialCall) {
fx_sun_undeclared(0, 0, 0, 0, 0, 0);

View File

@ -1,5 +1,6 @@
#include "flo_14.h"
#include "message_ids.h"
#include "effects.h"
EntryList N(entryList) = {
{ 720.0f, 0.0f, 0.0f, 270.0f },
@ -570,8 +571,6 @@ EvtScript N(80243E78) = {
#include "world/common/atomic/TexturePan.inc.c"
void fx_sun_undeclared(s32, s32, s32, s32, s32, s32);
ApiStatus N(func_8024030C_CCB61C)(Evt* script, s32 isInitialCall) {
fx_sun_undeclared(0, 0, 0, 0, 0, 0);
return ApiStatus_DONE2;

View File

@ -1,6 +1,5 @@
#include "flo_16.h"
void fx_sun_undeclared(s32, s32, s32, s32, s32, s32);
#include "effects.h"
ApiStatus N(func_80240000_CD1E30)(Evt* script, s32 isInitialCall) {
fx_sun_undeclared(1, 0, 0, 0, 0, 0);

View File

@ -1,6 +1,5 @@
#include "flo_17.h"
void fx_sun_undeclared(s32, s32, s32, s32, s32, s32);
#include "effects.h"
ApiStatus N(func_80240000_CD72E0)(Evt* script, s32 isInitialCall) {
fx_sun_undeclared(1, 0, 0, 0, 0, 0);

View File

@ -1745,15 +1745,6 @@ static s32 N(pad_66B4)[] = {
#include "world/common/atomic/TexturePan.inc.c"
// It seems like fx_sun was not properly defined for this file. Having a proper
// declaration makes it not match.
#ifdef AVOID_UB
void fx_sun_undeclared(s32, f32, f32, f32, f32, s32);
#else
void fx_sun_undeclared(s32, s32, s32, s32, s32, s32);
#endif
ApiStatus N(func_8024030C_CDC9AC)(Evt* script, s32 isInitialCall) {
fx_sun_undeclared(1, 0, 0, 0, 0, 0);
return ApiStatus_DONE2;

View File

@ -1421,8 +1421,6 @@ NpcGroupList N(npcGroupList_80245AEC) = {
#include "world/common/atomic/TexturePan.inc.c"
EffectInstance* fx_sun_undeclared(s32, s32, s32, s32, s32, s32);
ApiStatus N(func_80240B00_CE7200)(Evt* script, s32 isInitialCall) {
fx_sun_undeclared(1, 0, 0, 0, 0, 0);
return ApiStatus_DONE2;

View File

@ -2,6 +2,7 @@
#include "message_ids.h"
#include "sprite/npc/Bzzap.h"
#include "sprite/npc/Dayzee.h"
#include "effects.h"
enum {
NPC_BZZAP,
@ -385,8 +386,6 @@ static s32 N(pad_1594)[] = {
0x00000000, 0x00000000, 0x00000000,
};
void fx_sun_undeclared(s32, s32, s32, s32, s32, s32);
ApiStatus N(func_80240000_CEC240)(Evt* script, s32 isInitialCall) {
fx_sun_undeclared(1, 0, 0, 0, 0, 0);
return ApiStatus_DONE2;

View File

@ -1,6 +1,5 @@
#include "flo_23.h"
void fx_sun_undeclared(s32, s32, s32, s32, s32, s32);
#include "effects.h"
ApiStatus N(func_80240000_CEE260)(Evt* script, s32 isInitialCall) {
fx_sun_undeclared(0, 0, 0, 0, 0, 0);

View File

@ -1,6 +1,5 @@
#include "flo_24.h"
void fx_sun_undeclared(s32, s32, s32, s32, s32, s32);
#include "effects.h"
ApiStatus N(func_80240000_CF0940)(Evt* script, s32 isInitialCall) {
fx_sun_undeclared(1, 0, 0, 0, 0, 0);

View File

@ -1,6 +1,5 @@
#include "flo_25.h"
void fx_sun_undeclared(s32, s32, s32, s32, s32, s32);
#include "effects.h"
ApiStatus N(func_80240000_CF2BD0)(Evt* script, s32 isInitialCall) {
fx_sun_undeclared(0, 0, 0, 0, 0, 0);

View File

@ -1,11 +1,8 @@
#include "hos_05.h"
#include "model.h"
extern Gfx D_8024AA28_A34C68[];
void set_model_fog_color_parameters(u8 var2, u8 var3, u8 var4, u8 var5, u8 var6, u8 var7, u8 var8, s32 var9, s32 var10);
void set_model_env_color_parameters(u8 primR, u8 primG, u8 primB, u8 envR, u8 envG, u8 envB);
void get_model_env_color_parameters(u8* primR, u8* primG, u8* primB, u8* envR, u8* envG, u8* envB);
ApiStatus func_80240880_A2AAC0(Evt* script, s32 isInitialCall) {
Bytecode* args = script->ptrReadPos;
s32 primR = evt_get_variable(script, *args++);

View File

@ -1,4 +1,5 @@
#include "hos_05.h"
#include "model.h"
extern u8 D_8024DCCF_A37F0F;
extern u8 D_8024DCD3_A37F13;
@ -13,9 +14,6 @@ extern u8 D_802D9D73;
// should match when preceding bss is worked out
#ifdef NON_MATCHING
void set_model_env_color_parameters(u8 primR, u8 primG, u8 primB, u8 envR, u8 envG, u8 envB);
void get_model_env_color_parameters(u8* primR, u8* primG, u8* primB, u8* envR, u8* envG, u8* envB);
ApiStatus func_802452C4_A2F504(Evt* script, s32 isInitialCall) {
Bytecode* args;
static u8 oldPrimR, oldPrimG, oldPrimB;
@ -36,7 +34,7 @@ ApiStatus func_802452C4_A2F504(Evt* script, s32 isInitialCall) {
duration = evt_get_variable(script, *args++);
time = 0;
}
if (duration > 0) {
time++;
set_model_env_color_parameters(
@ -83,4 +81,25 @@ void func_80245744_A2F984(void) {
INCLUDE_ASM(s32, "world/area_hos/hos_05/A2EF00", func_80245794_A2F9D4);
INCLUDE_ASM(s32, "world/area_hos/hos_05/A2EF00", func_802457C0_A2FA00);
ApiStatus func_802457C0_A2FA00(Evt* script, s32 isInitialCall) {
Camera* camera = &gCameras[CAM_DEFAULT];
if (isInitialCall) {
script->functionTemp[0] = 40;
}
script->functionTemp[0]--;
if (camera->currentController != NULL) {
camera->currentController->viewPitch -= 1.0 - ((f32) (40 - script->functionTemp[0]) * 0.01);
} else if (camera->prevController != NULL) {
camera->prevController->viewPitch -= 1.0 - ((f32) (40 - script->functionTemp[0]) * 0.01);
}
if (script->functionTemp[0] == 0) {
return ApiStatus_DONE2;
} else {
return ApiStatus_BLOCK;
}
}
const char* N(exit_str_0) = "hos_20";
const char* N(exit_str_1) = "hos_04";

View File

@ -8,6 +8,27 @@ INCLUDE_ASM(s32, "world/area_hos/hos_10/A3FEB0", func_80240B44_A40284);
INCLUDE_ASM(s32, "world/area_hos/hos_10/A3FEB0", func_80240B98_A402D8);
INCLUDE_ASM(s32, "world/area_hos/hos_10/A3FEB0", func_80240BEC_A4032C);
ApiStatus func_80240BEC_A4032C(Evt* script, s32 isInitialCall) {
gPlayerData.currentPartner = PARTNER_NONE;
return ApiStatus_DONE2;
}
INCLUDE_ASM(s32, "world/area_hos/hos_10/A3FEB0", func_80240BFC_A4033C);
ApiStatus func_80240BFC_A4033C(Evt* script, s32 isInitialCall) {
if (isInitialCall) {
script->functionTemp[1] = 0;
}
set_screen_overlay_color(0, 208, 208, 208);
set_screen_overlay_params_front(1, script->functionTemp[1]);
if (script->functionTemp[1] == 255) {
return ApiStatus_DONE2;
}
script->functionTemp[1] += 7;
if (script->functionTemp[1] > 255) {
script->functionTemp[1] = 255;
}
return ApiStatus_BLOCK;
}

View File

@ -9,13 +9,14 @@ extern EvtScript N(EVS_MakeEntities);
extern EvtScript N(EVS_802467AC);
extern EvtScript N(EVS_80247A2C);
API_CALLABLE(func_8024030C_B2084C);
#include "world/common/atomic/TexturePan.inc.c"
#include "world/common/atomic/TexturePan.data.inc.c"
INCLUDE_ASM(s32, "world/area_jan/jan_00/B20540", func_8024030C_B2084C);
MAP_DATA_SECTION_START
API_CALLABLE(func_8024030C_B2084C) {
fx_sun_undeclared(0, 0, 0, 0, 0, 0);
return ApiStatus_DONE2;
}
EvtScript N(EVS_ExitWalk_jan_01_0) = EVT_EXIT_WALK(60, jan_00_ENTRY_1, "jan_01", jan_01_ENTRY_0);
EvtScript N(EVS_ExitWalk_jan_08_0) = EVT_EXIT_WALK(60, jan_00_ENTRY_2, "jan_08", jan_08_ENTRY_0);

View File

@ -98,8 +98,52 @@ EvtScript N(EVS_Kolorado_LetterReward) = {
EVT_END
};
// float regalloc
API_CALLABLE(func_80240B4C_B2108C);
#ifdef NON_EQUIVALENT
API_CALLABLE(func_80240B4C_B2108C) {
Bytecode* args = script->ptrReadPos;
Npc* npc;
f32 temp_f20;
f32 var_f22;
f32 x, y, z;
s32 temp_s1;
s32 outX, outY, outZ;
temp_s1 = evt_get_variable(script, *args++);
x = y = z = 0.0f;
outX = *args++;
outY = *args++;
outZ = *args++;
npc = get_npc_safe(0);
switch (temp_s1) {
case 0:
var_f22 = 130.0f;
break;
case 1:
var_f22 = 160.0f;
break;
case 2:
var_f22 = 100.0f;
break;
default:
var_f22 = 80.0f;
break;
}
if (temp_s1 < 4) {
temp_f20 = -npc->yaw;
x = npc->pos.x + 30.0f + sin_deg(temp_f20) * var_f22;
z = npc->pos.z + cos_deg(temp_f20) * var_f22;
y = npc->pos.y + 50.0f;
}
evt_set_float_variable(script, outX, x);
evt_set_float_variable(script, outY, y);
evt_set_float_variable(script, outZ, z);
return ApiStatus_DONE2;
}
#else
INCLUDE_ASM(s32, "world/area_jan/jan_00/B20540", func_80240B4C_B2108C);
#endif
API_CALLABLE(func_80240CF8_B21238);
INCLUDE_ASM(s32, "world/area_jan/jan_00/B20540", func_80240CF8_B21238);
@ -107,8 +151,17 @@ INCLUDE_ASM(s32, "world/area_jan/jan_00/B20540", func_80240CF8_B21238);
API_CALLABLE(func_80240F14_B21454);
INCLUDE_ASM(s32, "world/area_jan/jan_00/B20540", func_80240F14_B21454);
API_CALLABLE(func_80241134_B21674);
INCLUDE_ASM(s32, "world/area_jan/jan_00/B20540", func_80241134_B21674);
API_CALLABLE(func_80241134_B21674) {
Npc* npc = get_npc_safe(2);
f32 x = npc->pos.x;
f32 y = npc->pos.y;
f32 z = npc->pos.z - 20.0f;
if (y < 0.0f) {
fx_rising_bubble(0, x, y, z, 0.0f);
}
return ApiStatus_BLOCK;
}
MAP_DATA_SECTION_START

View File

@ -1,13 +1,11 @@
#include "jan_01.h"
#include "effects.h"
static char* N(exit_str_0) = "jan_00";
static char* N(exit_str_1) = "jan_02";
#include "world/common/atomic/TexturePan.inc.c"
void fx_sun_undeclared(s32, s32, s32, s32, s32, s32);
// will not match with correct function definition
ApiStatus func_8024030C_B2833C(Evt* script, s32 isInitialCall) {
fx_sun_undeclared(0, 0, 0, 0, 0, 0);
return ApiStatus_DONE2;

View File

@ -1,9 +1,34 @@
#include "jan_02.h"
#include "effects.h"
#include "mapfs/jan_02_hit.h"
#include "world/common/atomic/TexturePan.inc.c"
INCLUDE_ASM(s32, "world/area_jan/jan_02/B2C4A0", func_8024033C_B2C7AC);
extern s32 D_80242BD8_B2F048;
INCLUDE_ASM(s32, "world/area_jan/jan_02/B2C4A0", func_80240360_B2C7D0);
ApiStatus func_8024033C_B2C7AC(Evt* script, s32 isInitialCall) {
bgm_clear_track_volumes(0, 0);
return ApiStatus_DONE2;
}
INCLUDE_ASM(s32, "world/area_jan/jan_02/B2C4A0", func_802403F8_B2C868);
ApiStatus func_80240360_B2C7D0(Evt* script, s32 isInitialCall) {
u16 currentFloor = gCollisionStatus.currentFloor;
if (D_80242BD8_B2F048 != 0) {
if (currentFloor == COLLIDER_o327 || currentFloor == COLLIDER_o330) {
func_8011B7C0(9, 2, 0);
D_80242BD8_B2F048 = 0;
}
} else {
if (currentFloor == COLLIDER_o319 || currentFloor == COLLIDER_o316) {
func_8011B7C0(9, 2, 1);
D_80242BD8_B2F048 = 1;
}
}
return ApiStatus_BLOCK;
}
ApiStatus func_802403F8_B2C868(Evt* script, s32 isInitialCall) {
fx_sun_undeclared(0, 0, 0, 0, 0, 0);
return ApiStatus_DONE2;
}

View File

@ -1,4 +1,5 @@
#include "jan_03.h"
#include "effects.h"
static char* N(exit_str_0) = "jan_02";
static char* N(exit_str_1) = "jan_05";
@ -11,7 +12,10 @@ static char* N(exit_str_3) = "";
#include "world/common/atomic/TexturePan.inc.c"
INCLUDE_ASM(s32, "world/area_jan/jan_03/B34BD0", func_802405EC_B351BC);
ApiStatus func_802405EC_B351BC(Evt* script, s32 isInitialCall) {
fx_sun_undeclared(0, 0, 0, 0, 0, 0);
return ApiStatus_DONE2;
}
#include "world/common/enemy/ai/PatrolNoAttackAI.inc.c"

View File

@ -1,3 +1,10 @@
#include "jan_03.h"
INCLUDE_ASM(s32, "world/area_jan/jan_03/B37B70", func_80242FA0_B37B70);
ApiStatus func_80242FA0_B37B70(Evt* script, s32 isInitialCall) {
f32 x = gPlayerStatus.currentSpeed * 5.0f * sin_deg(gPlayerStatus.targetYaw);
f32 z = gPlayerStatus.currentSpeed * 5.0f * -cos_deg(gPlayerStatus.targetYaw);
script->varTable[0] = gPlayerStatus.position.x + x;
script->varTable[1] = gPlayerStatus.position.z + z;
return ApiStatus_DONE2;
}

View File

@ -1,13 +1,9 @@
#include "jan_04.h"
//static f64 D_802462E0_B4AA50[4] = {990.0, 2.732579860045591e+204, 2.732579860045591e+204, 0.0}; /* const */
#include "world/common/todo/SetEntityPositionF.inc.c"
#include "world/common/todo/GetEntityPosition.inc.c"
// Can't get this to match because the const array above is in "discarded section .data"
#ifdef NON_EQUIVALENT
ApiStatus func_80240BE8_B45358(Evt* script, s32 isInitialCall) {
Entity* entity = get_entity_by_index(script->varTable[10]);
@ -19,7 +15,7 @@ ApiStatus func_80240BE8_B45358(Evt* script, s32 isInitialCall) {
entity->scale.x = (60 - script->functionTemp[1]) / 60.0f;
entity->scale.y = (60 - script->functionTemp[1]) / 60.0f;
entity->scale.z = (60 - script->functionTemp[1]) / 60.0f;
entity->rotation.y = (1.0f - cos_rad(entity->scale.y * PI)) * D_802462E0_B4AA50[0] * 0.25f;
entity->rotation.y = (1.0f - cos_rad(entity->scale.y * PI)) * 990.0 * 0.25f;
script->functionTemp[1]--;
if (script->functionTemp[1] == -1) {
@ -27,11 +23,25 @@ ApiStatus func_80240BE8_B45358(Evt* script, s32 isInitialCall) {
}
return ApiStatus_BLOCK;
}
#else
INCLUDE_ASM(s32, "world/area_jan/jan_04/B451F0", func_80240BE8_B45358);
#endif
INCLUDE_ASM(s32, "world/area_jan/jan_04/B451F0", func_80240D0C_B4547C);
const char* N(exit_str_0) = "jan_04\0"; // remove \0 when this is part of a script and not an isolated symbol
const char* N(exit_str_1) = "jan_04";
ApiStatus func_80240D0C_B4547C(Evt* script, s32 isInitialCall) {
Entity* entity = get_entity_by_index(script->varTable[10]);
if (isInitialCall) {
script->functionTemp[0] = -30;
}
entity->rotation.x = script->functionTemp[0];
entity->rotation.z = script->functionTemp[0];
script->functionTemp[0]++;
if (script->functionTemp[0] == 1) {
return ApiStatus_DONE2;
}
return ApiStatus_BLOCK;
}
#define NAMESPACE dup_jan_04
#include "common/foliage.inc.c"

View File

@ -1,3 +1,39 @@
#include "jan_04.h"
#include "world/partners.h"
INCLUDE_ASM(s32, "world/area_jan/jan_04/B45730", func_80240FC0_B45730);
extern s32 D_8024625C_B4A9CC;
extern Evt* D_8024A290;
ApiStatus func_80240FC0_B45730(Evt* script, s32 isInitialCall) {
PlayerStatus* playerStatus = &gPlayerStatus;
EvtScript* rideScript;
switch (D_8024625C_B4A9CC) {
case 0:
rideScript = partner_get_ride_script();
if (rideScript != NULL) {
Evt* newScript;
D_8024625C_B4A9CC++;
newScript = start_script(rideScript, 0, 0x20);
newScript->varTable[1] = playerStatus->position.x - 10.0f;
newScript->varTable[2] = playerStatus->position.y;
newScript->varTable[3] = playerStatus->position.z;
D_8024A290 = newScript;
newScript->varTable[12] = 1;
}
break;
case 1:
case 2:
D_8024625C_B4A9CC++;
break;
case 3:
wPartnerNpc->yaw = 270.0f;
playerStatus->targetYaw = 270.0f;
playerStatus->currentYaw = 270.0f;
playerStatus->spriteFacingAngle = 180.0f;
D_8024A290->functionTemp[1] = 1;
return ApiStatus_DONE2;
}
return ApiStatus_BLOCK;
}

View File

@ -1,7 +1,6 @@
#include "jan_05.h"
#include "model.h"
#include "common/foliage.inc.c"
INCLUDE_ASM(s32, "world/area_jan/jan_05/B4AF10", func_802406DC_B4B14C);
INCLUDE_ASM(s32, "world/area_jan/jan_05/B4AF10", func_80240738_B4B1A8);
#include "world/common/todo/PullVineSub.inc.c"

View File

@ -2,7 +2,4 @@
#include "common/foliage.inc.c"
INCLUDE_ASM(s32, "world/area_jan/jan_08/B5E5C0", func_8024054C_B5E7FC);
INCLUDE_ASM(s32, "world/area_jan/jan_08/B5E5C0", func_802405A8_B5E858);
#include "world/common/todo/PullVineSub.inc.c"

View File

@ -2,6 +2,4 @@
#include "common/foliage.inc.c"
INCLUDE_ASM(s32, "world/area_jan/jan_09/B660A0", func_8024082C_B662DC);
INCLUDE_ASM(s32, "world/area_jan/jan_09/B660A0", func_80240888_B66338);
#include "world/common/todo/PullVineSub.inc.c"

View File

@ -3,13 +3,53 @@
static char* N(exit_str_0) = "jan_14";
static char* N(exit_str_1) = "jan_12";
INCLUDE_ASM(s32, "world/area_jan/jan_13/B767B0", func_80240000_B767B0);
extern u16 D_80240850_B77000;
INCLUDE_ASM(s32, "world/area_jan/jan_13/B767B0", func_802401AC_B7695C);
void func_80240000_B767B0(void) {
f64 temp_f20 = ((sin_rad((f32) D_80240850_B77000 * 0.02) + 1.0f) * 0.3) + 0.6;
f64 temp_f21 = (sin_rad((f32) D_80240850_B77000 * 0.1) + 1.0f) * 0.1;
f32 scale = temp_f20 + temp_f21;
INCLUDE_ASM(s32, "world/area_jan/jan_13/B767B0", func_80240214_B769C4);
guScale(&gDisplayContext->matrixStack[gMatrixListPos], (scale * 0.3) + 0.5, scale, (scale * 0.3) + 0.5);
gSPMatrix(gMasterGfxPos++, &gDisplayContext->matrixStack[gMatrixListPos++], G_MTX_NOPUSH | G_MTX_MUL | G_MTX_MODELVIEW);
D_80240850_B77000++;
}
INCLUDE_ASM(s32, "world/area_jan/jan_13/B767B0", func_802402B8_B76A68);
ApiStatus func_802401AC_B7695C(Evt* script, s32 isInitialCall) {
script->varTable[2] = EVT_FLOAT_TO_FIXED(script->varTable[1] / 100.0f);
script->varTable[3] = EVT_FLOAT_TO_FIXED(script->varTable[1] / 100.0f);
return ApiStatus_DONE2;
}
ApiStatus func_80240214_B769C4(Evt* script, s32 isInitialCall) {
Bytecode* args = script->ptrReadPos;
if (*args++ != 0) {
script->functionTemp[0] = evt_get_variable(script, *args++);
script->functionTemp[1] = evt_get_variable(script, *args++);
script->functionTemp[2] = evt_get_variable(script, *args++);
sfx_adjust_env_sound_pos(SOUND_4E, 0, script->functionTemp[0], script->functionTemp[1], script->functionTemp[2]);
}
return ApiStatus_DONE2;
}
ApiStatus func_802402B8_B76A68(Evt* script, s32 isInitialCall) {
PlayerStatus* playerStatus = &gPlayerStatus;
s32 vt0 = script->varTable[0];
s32 vt2 = script->varTable[2];
if (script->varTable[1] >= -99) {
f32 theta = (playerStatus->targetYaw / 180.0f) * 3.141592f;
vt0 -= (s32) (sin_rad(theta) * 25.0f);
vt2 -= (s32) (-cos_rad(theta) * 25.0f);
} else {
vt2 += 25;
}
script->varTable[0] = vt0;
script->varTable[2] = vt2;
return ApiStatus_DONE2;
}
#include "common/foliage.inc.c"

View File

@ -32,11 +32,11 @@ ApiStatus func_80241168_B852E8(Evt* script, s32 isInitialCall) {
f32 dx = array[3] - array[0];
f32 dy = array[4] - array[1];
f32 dz = array[5] - array[2];
script->varTable[5] = (dx / 1000.0f) * script->varTable[0];
script->varTable[6] = (dy / 1000.0f) * script->varTable[0];
script->varTable[7] = (dz / 1000.0f) * script->varTable[0];
if (mode == 0) {
Npc* partner = get_npc_safe(-4);
gPlayerStatus.position.x = (script->varTable[2] + script->varTable[5]);
@ -69,32 +69,4 @@ ApiStatus func_802412E0_B85460(Evt* script, s32 isInitialCall) {
#include "common/foliage.inc.c"
void func_8024160C_B8578C(Matrix4f mtx, f32 shearAmt) {
guMtxIdentF(mtx);
mtx[1][2] = 0;
mtx[1][1] = 1.0f;
mtx[1][0] = shearAmt * 0.2;
}
ApiStatus func_80241668_B857E8(Evt* script, s32 isInitialCall) {
Bytecode* args = script->ptrReadPos;
Matrix4f mtx;
s32 treeIndex;
s32 listIndex;
Model* model;
f32 shearAmt;
treeIndex = evt_get_variable(script, *args++);
listIndex = get_model_list_index_from_tree_index(treeIndex);
shearAmt = evt_get_float_variable(script, *args++);
model = get_model_from_list_index(listIndex);
if (!(model->flags & MODEL_FLAGS_HAS_TRANSFORM_APPLIED)) {
func_8024160C_B8578C(model->transformMatrix, shearAmt);
model->flags |= (MODEL_FLAGS_HAS_TRANSFORM_APPLIED | MODEL_FLAGS_USES_TRANSFORM_MATRIX);
} else {
func_8024160C_B8578C(mtx, shearAmt);
guMtxCatF(mtx, model->transformMatrix, model->transformMatrix);
}
return ApiStatus_DONE2;
}
#include "world/common/todo/PullVineSub.inc.c"

View File

@ -150,7 +150,44 @@ ApiStatus func_80240CE8_B076E8(Evt* script, s32 isInitialCall) {
return ApiStatus_DONE2;
}
INCLUDE_ASM(s32, "world/area_kkj/kkj_25/B06D10", func_80240D30_B07730);
ApiStatus func_80240D30_B07730(Evt* script, s32 isInitialCall) {
if (isInitialCall) {
script->functionTemp[1] = 0;
script->functionTemp[2] = 0;
}
switch (script->functionTemp[2]) {
case 0:
set_screen_overlay_color(0, 208, 0, 0);
set_screen_overlay_params_front(1, script->functionTemp[1]);
if (script->functionTemp[1] == 255) {
script->functionTemp[1] = 0;
script->functionTemp[2] = 1;
} else {
script->functionTemp[1] += 7;
if (script->functionTemp[1] > 255) {
script->functionTemp[1] = 255;
}
}
break;
case 1:
set_screen_overlay_color(
0,
208,
(script->functionTemp[1] * 208) / 255,
(script->functionTemp[1] * 208) / 255
);
set_screen_overlay_params_front(1, 255.0f);
if (script->functionTemp[1] == 255) {
script->functionTemp[2] = 2;
}
script->functionTemp[1] += 14;
if (script->functionTemp[1] > 255) {
script->functionTemp[1] = 255;
}
}
return (script->functionTemp[2] == 2) * 2;
}
ApiStatus func_80240E54_B07854(Evt* script, s32 isInitialCall) {
if (isInitialCall) {

View File

@ -1,8 +1,6 @@
#include "kmr_00.h"
#include "effects.h"
void set_model_env_color_parameters(u8 primR, u8 primG, u8 primB, u8 envR, u8 envG, u8 envB);
void get_model_env_color_parameters(u8* primR, u8* primG, u8* primB, u8* envR, u8* envG, u8* envB);
#include "model.h"
API_CALLABLE(N(func_80240000_8ABF90)) {
Bytecode* args;

View File

@ -12,7 +12,10 @@ static char* N(exit_str_3) = "";
INCLUDE_ASM(s32, "world/area_kmr/kmr_02/8B0070", func_802402E0_8B0350);
INCLUDE_ASM(s32, "world/area_kmr/kmr_02/8B0070", func_80240370_8B03E0);
ApiStatus func_80240370_8B03E0(Evt* script, s32 isInitialCall) {
set_map_change_fade_rate(1);
return ApiStatus_DONE2;
}
extern s32 N(Quizmo_Worker);
extern s32 N(Quizmo_AnswerResult);
@ -30,7 +33,13 @@ static char* N(exit_str_6) = "\0\0\0\0";
#include "world/common/util/ChangeNpcToPartner.inc.c"
INCLUDE_ASM(s32, "world/area_kmr/kmr_02/8B0070", func_80242014_8B2084);
ApiStatus func_80242014_8B2084(Evt* script, s32 isInitialCall) {
if (get_npc_unsafe(NPC_PARTNER)->flags & NPC_FLAG_1000) {
return ApiStatus_DONE2;
} else {
return ApiStatus_BLOCK;
}
}
#include "world/common/todo/GetNpcCollisionHeight.inc.c"
@ -66,28 +75,108 @@ INCLUDE_ASM(s32, "world/area_kmr/kmr_02/8B0070", func_80242394_8B2404);
extern s32 N(LetterDelivery_SavedNpcAnim);
#include "world/common/todo/LetterDelivery.inc.c"
INCLUDE_ASM(s32, "world/area_kmr/kmr_02/8B0070", func_80242710_8B2780);
ApiStatus func_80242710_8B2780(Evt* script, s32 isInitialCall) {
script->varTable[0] = gPlayerData.curHP == gPlayerData.curMaxHP;
return ApiStatus_DONE2;
}
INCLUDE_ASM(s32, "world/area_kmr/kmr_02/8B0070", func_80242734_8B27A4);
extern u8 D_80257B00_8C7B70;
extern u16 D_80257D00_8C7D70;
extern MessageImageData D_80258120;
INCLUDE_ASM(s32, "world/area_kmr/kmr_02/8B0070", func_80242788_8B27F8);
ApiStatus func_80242734_8B27A4(void) {
D_80258120.raster = &D_80257B00_8C7B70; // TODO extract image
D_80258120.palette = &D_80257D00_8C7D70; // TODO extract pal
D_80258120.width = 32; // TOOD image header define
D_80258120.height = 32; // TOOD image header define
D_80258120.format = G_IM_FMT_CI;
D_80258120.bitDepth = 0;
set_message_images(&D_80258120);
return ApiStatus_DONE1;
}
INCLUDE_ASM(s32, "world/area_kmr/kmr_02/8B0070", func_802427B0_8B2820);
ApiStatus func_80242788_8B27F8(Evt* script, s32 isInitialCall) {
gPlayerData.partners[PARTNER_GOOMPA].enabled = FALSE;
func_800EB2A4(0);
return ApiStatus_DONE1;
}
INCLUDE_ASM(s32, "world/area_kmr/kmr_02/8B0070", func_802427CC_8B283C);
ApiStatus func_802427B0_8B2820(Evt* script, s32 isInitialCall) {
if (gGameStatusPtr->pressedButtons[0] & BUTTON_START) {
return ApiStatus_DONE2;
} else {
return ApiStatus_BLOCK;
}
}
INCLUDE_ASM(s32, "world/area_kmr/kmr_02/8B0070", func_802427EC_8B285C);
ApiStatus func_802427CC_8B283C(Evt* script, s32 isInitialCall) {
set_game_mode(GAME_MODE_PAUSE);
return ApiStatus_DONE1;
}
INCLUDE_ASM(s32, "world/area_kmr/kmr_02/8B0070", func_8024280C_8B287C);
ApiStatus func_802427EC_8B285C(Evt* script, s32 isInitialCall) {
close_status_menu();
return ApiStatus_DONE2;
}
ApiStatus func_8024280C_8B287C(Evt* script) {
Bytecode* args = script->ptrReadPos;
Npc* npc = resolve_npc(script, 0);
npc->renderYaw += evt_get_float_variable(script, *args++);
return ApiStatus_DONE2;
}
#define UNK_NPC_POS_FUNC_NUM 7
#include "world/common/todo/UnkNpcPosFunc.inc.c"
#include "world/common/todo/SyncStatusMenu.inc.c"
INCLUDE_ASM(s32, "world/area_kmr/kmr_02/8B0070", func_8024295C_8B29CC);
#ifdef NON_EQUIVALENT
extern u8 D_80257F20;
extern u8 D_80257F21;
extern u8 D_80257F22;
extern u8 D_80257F23;
INCLUDE_ASM(s32, "world/area_kmr/kmr_02/8B0070", func_80242BA8_8B2C18);
// control flow + data migration
ApiStatus func_8024295C_8B29CC(Evt* script, s32 isInitialCall) {
Bytecode* args = script->ptrReadPos;
s32 r = evt_get_variable(script, *args++);
s32 g = evt_get_variable(script, *args++);
s32 b = evt_get_variable(script, *args++);
s32 a = evt_get_variable(script, *args++);
s32 temp_s0_5 = evt_get_variable(script, *args++);
if (isInitialCall) {
get_background_color_blend(&D_80257F20, &D_80257F21, &D_80257F22, &D_80257F23);
script->functionTemp[0] = 0;
}
if (temp_s0_5 > 0) {
set_background_color_blend(
D_80257F20 + (((r - D_80257F20) * script->functionTemp[0]) / temp_s0_5),
D_80257F21 + (((g - D_80257F21) * script->functionTemp[0]) / temp_s0_5),
D_80257F22 + (((b - D_80257F22) * script->functionTemp[0]) / temp_s0_5),
D_80257F23 + (((a - D_80257F23) * script->functionTemp[0]) / temp_s0_5)
);
script->functionTemp[0]++;
if (temp_s0_5 < script->functionTemp[0]) {
return ApiStatus_BLOCK;
}
} else {
set_background_color_blend(r, g, b, a);
}
return ApiStatus_DONE2;
}
#else
INCLUDE_ASM(s32, "world/area_kmr/kmr_02/8B0070", func_8024295C_8B29CC);
#endif
ApiStatus func_80242BA8_8B2C18(Evt* script, s32 isInitialCall) {
*gBgRenderTypePtr = 1;
return ApiStatus_DONE2;
}
// will match when preceding bss is worked out
#ifdef NON_MATCHING
@ -135,10 +224,23 @@ s32 func_80242BC0_8B2C30(Evt* script, s32 isInitialCall) {
INCLUDE_ASM(s32, "world/area_kmr/kmr_02/8B0070", func_80242BC0_8B2C30);
#endif
INCLUDE_ASM(s32, "world/area_kmr/kmr_02/8B0070", func_80242F08_8B2F78);
ApiStatus func_80242F08_8B2F78(Evt* script, s32 isInitialCall) {
mdl_set_all_fog_mode(3);
return ApiStatus_DONE2;
}
INCLUDE_ASM(s32, "world/area_kmr/kmr_02/8B0070", func_80242F28_8B2F98);
ApiStatus func_80242F28_8B2F98(Evt* script, s32 isInitialCall) {
func_8011B950(0x9C, -1, 1, 1);
set_background_color_blend(0, 0, 0, 255);
gCameras[CAM_DEFAULT].bgColor[0] = 0;
gCameras[CAM_DEFAULT].bgColor[1] = 0;
gCameras[CAM_DEFAULT].bgColor[2] = 0;
return ApiStatus_DONE2;
}
INCLUDE_ASM(s32, "world/area_kmr/kmr_02/8B0070", func_80242F7C_8B2FEC);
INCLUDE_ASM(s32, "world/area_kmr/kmr_02/8B0070", func_80243034_8B30A4);
ApiStatus func_80243034_8B30A4(Evt* script, s32 isInitialCall) {
get_item_entity(script->varTable[0])->scale = 0.6f;
return ApiStatus_DONE2;
}

View File

@ -1,6 +1,20 @@
#include "kmr_02.h"
INCLUDE_ASM(s32, "world/area_kmr/kmr_02/8B33E0", func_80243370_8B33E0);
ApiStatus func_80243370_8B33E0(Evt* script, s32 isInitialCall) {
PlayerData* playerData = &gPlayerData;
s32 cond = FALSE;
s32 i;
for (i = 0; i < ARRAY_COUNT(playerData->equippedBadges); i++) {
if (playerData->equippedBadges[i] != 0) {
cond = TRUE;
break;
}
}
script->varTable[0] = cond;
return ApiStatus_DONE2;
}
#include "world/common/todo/SetEntityPositionF.inc.c"

View File

@ -9,4 +9,7 @@ static char* N(exit_str_3) = "";
#include "common/UnkFogFunc.inc.c"
INCLUDE_ASM(s32, "world/area_kmr/kmr_11/8DA100", func_8024027C_8DA37C);
ApiStatus func_8024027C_8DA37C(Evt* script, s32 isInitialCall) {
set_map_change_fade_rate(10);
return ApiStatus_DONE2;
}

View File

@ -1,8 +1,22 @@
#include "kmr_11.h"
#include "effects.h"
INCLUDE_ASM(s32, "world/area_kmr/kmr_11/8DA3A0", func_802402A0_8DA3A0);
ApiStatus func_802402A0_8DA3A0(Evt* script) {
Bytecode* args = script->ptrReadPos;
f32 temp_f24 = evt_get_float_variable(script, *args++);
f32 temp_f22 = evt_get_float_variable(script, *args++);
f32 temp_f20 = evt_get_float_variable(script, *args++);
s32 t4 = evt_get_variable(script, *args++);
INCLUDE_ASM(s32, "world/area_kmr/kmr_11/8DA3A0", func_80240344_8DA444);
fx_lens_flare(0, temp_f24, temp_f22, temp_f20, t4);
return ApiStatus_DONE2;
}
ApiStatus func_80240344_8DA444(Evt* script) {
Bytecode* args = script->ptrReadPos;
gCameras[CAM_DEFAULT].vfov = evt_get_float_variable(script, *args++);
return ApiStatus_DONE2;
}
#include "world/common/enemy/ai/StationaryAI.inc.c"

View File

@ -23,7 +23,10 @@ ApiStatus func_80240358_8EC178(Evt* script, s32 isInitialCall) {
INCLUDE_ASM(s32, "world/area_kmr/kmr_20/8EBE50", func_802405BC_8EC3DC);
INCLUDE_ASM(s32, "world/area_kmr/kmr_20/8EBE50", func_802406BC_8EC4DC);
ApiStatus func_802406BC_8EC4DC(Evt* script, s32 isInitialCall) {
script->functionTemp[3] = 0;
return ApiStatus_DONE2;
}
INCLUDE_ASM(s32, "world/area_kmr/kmr_20/8EBE50", func_802406C8_8EC4E8);
@ -32,7 +35,10 @@ ApiStatus func_80240B20_8EC940(Evt* script, s32 isInitialCall) {
return ApiStatus_DONE2;
}
INCLUDE_ASM(s32, "world/area_kmr/kmr_20/8EBE50", func_80240B48_8EC968);
ApiStatus func_80240B48_8EC968(Evt* script, s32 isInitialCall) {
script->functionTemp[3] = 0;
return ApiStatus_DONE2;
}
INCLUDE_ASM(s32, "world/area_kmr/kmr_20/8EBE50", func_80240B54_8EC974);

View File

@ -4,4 +4,15 @@
#include "world/common/todo/GetItemName.inc.c"
INCLUDE_ASM(s32, "world/area_kmr/kmr_20/8ED440", func_80241738_8ED558);
extern Addr EntityModel_Spring_ReboundAnim;
ApiStatus func_80241738_8ED558(Evt* script, s32 isInitialCall) {
Entity* entity = get_entity_by_index(0);
if (entity == NULL) {
return ApiStatus_BLOCK;
}
play_model_animation(entity->virtualModelIndex, (s16*)EntityModel_Spring_ReboundAnim);
return ApiStatus_DONE2;
}

View File

@ -2,9 +2,18 @@
INCLUDE_ASM(s32, "world/area_kmr/kmr_20/8EDFC0", func_802421A0_8EDFC0);
void func_80242870_8EE690(void*);
INCLUDE_ASM(s32, "world/area_kmr/kmr_20/8EDFC0", func_80242870_8EE690);
INCLUDE_ASM(s32, "world/area_kmr/kmr_20/8EDFC0", func_80242A04_8EE824);
void func_80242A04_8EE824(void) {
RenderTask rt;
rt.renderMode = RENDER_MODE_2D;
rt.appendGfxArg = NULL;
rt.appendGfx = func_80242870_8EE690;
rt.distance = 0;
queue_render_task(&rt);
}
INCLUDE_ASM(s32, "world/area_kmr/kmr_20/8EDFC0", func_80242A3C_8EE85C);

View File

@ -11,4 +11,6 @@ static char* N(exit_str_7) = "nok_11";
static char* N(exit_str_8) = "kmr_00";
static char* N(exit_str_9) = "";
INCLUDE_ASM(s32, "world/area_kmr/kmr_22/8FF670", func_80240000_8FF670);
ApiStatus func_80240000_8FF670(Evt* script, s32 isInitialCall) {
return ApiStatus_DONE1;
}

View File

@ -2,6 +2,23 @@
INCLUDE_ASM(s32, "world/area_kmr/kmr_22/8FF680", func_80240010_8FF680);
INCLUDE_ASM(s32, "world/area_kmr/kmr_22/8FF680", func_802401E0_8FF850);
ApiStatus func_802401E0_8FF850(Evt* script, s32 isInitialCall) {
set_curtain_scale_goal(2.0f);
return ApiStatus_DONE2;
}
INCLUDE_ASM(s32, "world/area_kmr/kmr_22/8FF680", func_80240208_8FF878);
ApiStatus func_80240208_8FF878(Evt* script, s32 isInitialCall) {
ApiStatus ret;
if (gGameStatusPtr->pressedButtons[0] & BUTTON_START) {
ret = ApiStatus_DONE2;
} else {
ret = ApiStatus_BLOCK;
}
if (gGameStatusPtr->pressedButtons[0] & BUTTON_A) {
ret = ApiStatus_DONE2;
script->varTable[0] = -1;
}
return ret;
}

View File

@ -6,13 +6,37 @@ INCLUDE_ASM(s32, "world/area_kmr/kmr_22/8FF8B0", func_80240314_8FF984);
INCLUDE_ASM(s32, "world/area_kmr/kmr_22/8FF8B0", func_80240418_8FFA88);
INCLUDE_ASM(s32, "world/area_kmr/kmr_22/8FF8B0", func_802404E4_8FFB54);
ApiStatus func_802404E4_8FFB54(Evt* script) {
Bytecode* args = script->ptrReadPos;
evt_get_variable(script, *args++);
evt_get_variable(script, *args++);
evt_get_variable(script, *args++);
evt_get_variable(script, *args++);
evt_get_variable(script, *args++);
evt_get_variable(NULL, MapVar(0));
return ApiStatus_DONE2;
}
void func_8024056C_8FFBDC(void*);
INCLUDE_ASM(s32, "world/area_kmr/kmr_22/8FF8B0", func_8024056C_8FFBDC);
INCLUDE_ASM(s32, "world/area_kmr/kmr_22/8FF8B0", func_80240B00_900170);
void func_80240B00_900170(void) {
RenderTask rt;
INCLUDE_ASM(s32, "world/area_kmr/kmr_22/8FF8B0", func_80240B3C_9001AC);
rt.appendGfx = &func_8024056C_8FFBDC;
rt.distance = 10;
rt.appendGfxArg = NULL;
rt.renderMode = RENDER_MODE_SURFACE_OPA;
queue_render_task(&rt);
}
extern s32 D_802483D0;
ApiStatus func_80240B3C_9001AC(Evt* script, s32 isInitialCall) {
D_802483D0 = 0;
return ApiStatus_DONE2;
}
INCLUDE_ASM(s32, "world/area_kmr/kmr_22/8FF8B0", func_80240B4C_9001BC);

View File

@ -5,11 +5,59 @@ ApiStatus func_80240310_AA92B0(Evt* script, s32 isInitialCall) {
return ApiStatus_DONE2;
}
INCLUDE_ASM(s32, "world/area_kpa/kpa_134/AA92B0", func_8024033C_AA92DC);
ApiStatus func_8024033C_AA92DC(Evt* script, s32 isInitialCall) {
PlayerStatus* playerStatus = &gPlayerStatus;
if (playerStatus->actionState != ACTION_STATE_FALLING) {
return ApiStatus_BLOCK;
}
if (fabs(playerStatus->position.x - 50.0f) > 14.0) {
return ApiStatus_BLOCK;
}
if (fabs(playerStatus->position.y - 150.0f) > 14.0) {
return ApiStatus_BLOCK;
}
if (fabs(playerStatus->position.z - -34.0f) > 14.0) {
return ApiStatus_BLOCK;
}
playerStatus->position.x = 50.0f;
playerStatus->position.y = 150.0f;
playerStatus->position.z = -34.0f;
playerStatus->currentSpeed = 0.0f;
return ApiStatus_DONE2;
}
ApiStatus func_80240408_AA93A8(Evt* script, s32 isInitialCall) {
create_shadow_type(0, 680.0f, 240.0f, -35.0f);
return ApiStatus_DONE2;
}
INCLUDE_ASM(s32, "world/area_kpa/kpa_134/AA92B0", func_80240434_AA93D4);
ApiStatus func_80240434_AA93D4(Evt* script, s32 isInitialCall) {
PlayerStatus* playerStatus = &gPlayerStatus;
if (playerStatus->actionState != ACTION_STATE_FALLING) {
return ApiStatus_BLOCK;
}
if (fabs(playerStatus->position.x - 680.0f) > 14.0) {
return ApiStatus_BLOCK;
}
if (fabs(playerStatus->position.y - 275.0f) > 14.0) {
return ApiStatus_BLOCK;
}
if (fabs(playerStatus->position.z - -35.0f) > 14.0) {
return ApiStatus_BLOCK;
}
playerStatus->position.x = 680.0f;
playerStatus->position.y = 275.0f;
playerStatus->position.z = -35.0f;
playerStatus->currentSpeed = 0.0f;
return ApiStatus_DONE2;
}

View File

@ -81,7 +81,14 @@ ApiStatus N(SetDojoBattle)(Evt* script, s32 isInitialCall) {
return ApiStatus_DONE2;
}
INCLUDE_ASM(s32, "world/area_mac/mac_00/7EB340", func_802421D0_7ECEE0);
ApiStatus func_802421D0_7ECEE0(Evt* script, s32 isInitialCall) {
func_8011B950(0x8A, -1, 1, 1);
set_background_color_blend(0, 0, 0, 255);
gCameras[CAM_DEFAULT].bgColor[0] = 0;
gCameras[CAM_DEFAULT].bgColor[1] = 0;
gCameras[CAM_DEFAULT].bgColor[2] = 0;
return ApiStatus_DONE2;
}
ApiStatus func_80242224_7ECF34(Evt* script, s32 isInitialCall) {
gPlayerData.curHP = 1;
@ -89,7 +96,10 @@ ApiStatus func_80242224_7ECF34(Evt* script, s32 isInitialCall) {
return ApiStatus_DONE2;
}
INCLUDE_ASM(s32, "world/area_mac/mac_00/7EB340", func_80242250_7ECF60);
ApiStatus func_80242250_7ECF60(Evt* script, s32 isInitialCall) {
script->varTable[0] = (s32) ((gPlayerData.frameCounter - gPlayerData.tradeEventStartTime) / 3600) < script->varTable[0];
return ApiStatus_DONE2;
}
ApiStatus func_8024228C_7ECF9C(Evt* script, s32 isInitialCall) {
script->varTable[0] = get_item_count();

View File

@ -147,7 +147,40 @@ ApiStatus func_80244848_8050C8(Evt* script, s32 isInitialCall) {
return ApiStatus_BLOCK;
}
INCLUDE_ASM(s32, "world/area_mac/mac_01/8017D0", func_802448A0_805120);
ApiStatus func_802448A0_805120(Evt* script, s32 isInitialCall) {
s32 alpha;
if (isInitialCall) {
if (script->varTable[0] == 0) {
func_8011B950(script->varTable[15], -1, 1, 1);
}
script->functionTemp[0] = 0;
}
script->functionTemp[0] += 32;
if (script->functionTemp[0] > 255) {
script->functionTemp[0] = 255;
}
if (script->varTable[0] == 0) {
alpha = script->functionTemp[0];
} else {
alpha = 255 - script->functionTemp[0];
}
set_background_color_blend(0, 0, 0, alpha);
gCameras[CAM_DEFAULT].bgColor[0] = 0;
gCameras[CAM_DEFAULT].bgColor[1] = 0;
gCameras[CAM_DEFAULT].bgColor[2] = 0;
if (script->functionTemp[0] >= 255) {
if (script->varTable[0] == 3) {
func_8011B950(script->varTable[15], -1, 0, 1);
}
return ApiStatus_DONE2;
}
return ApiStatus_BLOCK;
}
INCLUDE_ASM(s32, "world/area_mac/mac_01/8017D0", func_80244984_805204);

View File

@ -45,6 +45,15 @@ ApiStatus func_802417FC_832FFC(Evt* script, s32 isInitialCall) {
extern s32 N(LetterDelivery_SavedNpcAnim);
#include "world/common/todo/LetterDelivery.inc.c"
INCLUDE_ASM(s32, "world/area_mac/mac_03/831B20", func_80241B84_833384);
ApiStatus func_80241B84_833384(Evt* script, s32 isInitialCall) {
s32 gb29 = evt_get_variable(script, GameByte(29));
if (gb29 == 0) {
script->varTable[0] = -1;
} else {
script->varTable[0] = evt_get_variable(script, gb29 + GameByte(29));
}
return ApiStatus_DONE2;
}
INCLUDE_ASM(s32, "world/area_mac/mac_03/831B20", func_80241BD8_8333D8);

View File

@ -1,3 +1,15 @@
#include "mac_04.h"
INCLUDE_ASM(s32, "world/area_mac/mac_04/842BD0", func_80240000_842BD0);
extern char wMapBgName[];
ApiStatus func_80240000_842BD0(Evt* script, s32 isInitialCall) {
if (gGameStatusPtr->entryID == 4) {
sprintf(wMapBgName, "hos_bg");
}
return ApiStatus_BLOCK;
}
const char N(exit_str_0)[] = "mac_05";
const char N(exit_str_1)[] = "mac_02";
const char N(exit_str_2)[] = "omo_03";
const char N(exit_str_3)[] = "hos_20\0\0"; // todo remove padding after these are moved

View File

@ -1,5 +1,23 @@
#include "mac_04.h"
#include "model.h"
INCLUDE_ASM(s32, "world/area_mac/mac_04/842C20", func_80240050_842C20);
ApiStatus func_80240050_842C20(Evt* script, s32 isInitialCall) {
Bytecode* args = script->ptrReadPos;
s32 primR = evt_get_variable(script, *args++);
s32 primG = evt_get_variable(script, *args++);
s32 primB = evt_get_variable(script, *args++);
s32 primA = evt_get_variable(script, *args++);
s32 fogR = evt_get_variable(script, *args++);
s32 fogG = evt_get_variable(script, *args++);
s32 fogB = evt_get_variable(script, *args++);
s32 fogStart = evt_get_variable(script, *args++);
s32 fogEnd = evt_get_variable(script, *args++);
INCLUDE_ASM(s32, "world/area_mac/mac_04/842C20", func_80240194_842D64);
set_model_fog_color_parameters(primR, primG, primB, primA, fogR, fogG, fogB, fogStart, fogEnd);
return ApiStatus_DONE2;
}
ApiStatus func_80240194_842D64(Evt* script, s32 isInitialCall) {
mdl_set_all_fog_mode(3);
return ApiStatus_DONE2;
}

View File

@ -1,3 +1,15 @@
#include "mac_04.h"
// matches if func_8011B950 is declared to return s32, but that breaks other funcs
#ifdef NON_MATCHING
ApiStatus func_802401C0_842D90(Evt* script, s32 isInitialCall) {
func_8011B950(0x9E, -1, 1, 1);
set_background_color_blend(0, 0, 0, 255);
gCameras[CAM_DEFAULT].bgColor[0] = 0;
gCameras[CAM_DEFAULT].bgColor[1] = 0;
gCameras[CAM_DEFAULT].bgColor[2] = 0;
return ApiStatus_DONE2;
}
#else
INCLUDE_ASM(s32, "world/area_mac/mac_04/842D90", func_802401C0_842D90);
#endif

View File

@ -40,9 +40,42 @@ ApiStatus func_802417AC_84437C(Evt* script, s32 isInitialCall) {
return ApiStatus_DONE2;
}
INCLUDE_ASM(s32, "world/area_mac/mac_04/843030", func_80241848_844418);
s32 func_80241848_844418(void) {
s32 bpCost = 0;
s32 i = 0;
ItemData* itemTable = gItemTable;
INCLUDE_ASM(s32, "world/area_mac/mac_04/843030", func_802418AC_84447C);
for (; i < ARRAY_COUNT(gPlayerData.equippedBadges); i++) {
s16 badge = gPlayerData.equippedBadges[i];
if (badge != 0) {
bpCost += gMoveTable[itemTable[badge].moveID].costBP;
}
}
return bpCost;
}
ApiStatus func_802418AC_84447C(Evt* script, s32 isInitialCall) {
PlayerData* playerData = &gPlayerData;
Bytecode* args = script->ptrReadPos;
s32 outVar = *args++;
s32 bpCost = func_80241848_844418();
s32 i;
if (gPlayerData.maxBP >= bpCost) {
evt_set_variable(script, outVar, FALSE);
return ApiStatus_DONE2;
} else {
s16* badges = gPlayerData.equippedBadges;
for (i = 0; i < ARRAY_COUNT(gPlayerData.equippedBadges); i++) {
badges[i] = 0;
}
enforce_hpfp_limits();
evt_set_variable(script, outVar, TRUE);
return ApiStatus_DONE2;
}
}
ApiStatus PostChapter4StatUpdate(Evt* script, s32 isInitialCall) {
PlayerData* playerData = &gPlayerData;
@ -67,11 +100,73 @@ ApiStatus N(IsPartnerBow)(Evt* script, s32 isInitialCall) {
#include "world/common/todo/GetPlayerCoins.inc.c"
INCLUDE_ASM(s32, "world/area_mac/mac_04/843030", func_802419E4_8445B4);
ApiStatus func_802419E4_8445B4(Evt* script, s32 isInitialCall) {
Bytecode* args = script->ptrReadPos;
s32 out1 = *args++;
s32 out2 = *args++;
s32 out3 = *args++;
INCLUDE_ASM(s32, "world/area_mac/mac_04/843030", func_80241A64_844634);
evt_set_variable(script, out1, gPlayerData.hardMaxHP);
evt_set_variable(script, out2, gPlayerData.hardMaxFP);
evt_set_variable(script, out3, gPlayerData.maxBP);
return ApiStatus_DONE2;
}
INCLUDE_ASM(s32, "world/area_mac/mac_04/843030", func_80241B90_844760);
ApiStatus func_80241A64_844634(Evt* script, s32 isInitialCall) {
PlayerData* playerData = &gPlayerData;
s32 bp = 0;
s32 fp = 0;
s32 hp = 0;
switch (script->varTable[10]) {
case 0:
hp = 10;
fp = -5;
bp = -3;
break;
case 1:
hp = -5;
fp = 10;
bp = -3;
break;
case 2:
hp = -5;
fp = -5;
bp = 6;
break;
}
playerData->hardMaxHP += hp;
playerData->curMaxHP += hp;
if (playerData->curMaxHP > 75) {
playerData->curMaxHP = 75;
}
if (playerData->curHP > playerData->curMaxHP) {
playerData->curHP = playerData->curMaxHP;
}
playerData->hardMaxFP += fp;
playerData->curMaxFP += fp;
if (playerData->curMaxFP > 75) {
playerData->curMaxFP = 75;
}
if (playerData->curFP > playerData->curMaxFP) {
playerData->curFP = playerData->curMaxFP;
}
playerData->maxBP += bp;
if (playerData->maxBP > 30) {
playerData->maxBP = 30;
}
return ApiStatus_DONE2;
}
ApiStatus func_80241B90_844760(Evt* script, s32 isInitialCall) {
PlayerData* playerData = &gPlayerData;
script->varTable[0] = playerData->curMaxHP;
script->varTable[1] = playerData->curMaxFP;
script->varTable[2] = playerData->maxBP;
return ApiStatus_DONE2;
}
ApiStatus N(SetNpcShadowScale)(Evt* script, s32 isInitialCall) {
Bytecode* args = script->ptrReadPos;
@ -87,6 +182,13 @@ ApiStatus N(80241C20_8447F0)(Evt* script, s32 isInitialCall) {
return ApiStatus_DONE2;
}
INCLUDE_ASM(s32, "world/area_mac/mac_04/843030", func_80241C40_844810);
ApiStatus func_80241C40_844810(Evt* script, s32 isInitialCall) {
func_800E98C4();
return ApiStatus_DONE2;
}
INCLUDE_ASM(s32, "world/area_mac/mac_04/843030", func_80241C60_844830);
ApiStatus func_80241C60_844830(Evt* script, s32 isInitialCall) {
func_800E98C4();
open_status_menu_long();
return ApiStatus_DONE2;
}

View File

@ -1,4 +1,5 @@
#include "mac_04.h"
#include "sprite.h"
void func_80241D30_844900(void);
void func_80241DAC_84497C(void*);
@ -32,25 +33,22 @@ void func_80241D30_844900(void) {
queue_render_task(&renderTask);
}
// problem with asm file improperly including strings "omo_03" and "kmr_22"
#ifdef NON_MATCHING
void func_80241DAC_84497C(PlayerStatus* playerStatus) {
void func_80241DAC_84497C(void* data) {
PlayerStatus* playerStatus = data;
f32 scale = evt_get_float_variable(NULL, MapVar(10));
f32 scale_2;
Matrix4f transformMtx;
Matrix4f tempMtx;
guRotateF(transformMtx, playerStatus->spriteFacingAngle, 0.0f, 1.0f, 0.0f);
scale_2 = (f32) ((f64) scale * SPRITE_WORLD_SCALE_D);
guScaleF(tempMtx, scale_2, scale_2, scale_2);
guScaleF(tempMtx, scale * SPRITE_WORLD_SCALE_D, scale * SPRITE_WORLD_SCALE_D, scale * SPRITE_WORLD_SCALE_D);
guMtxCatF(transformMtx, tempMtx, transformMtx);
guTranslateF(tempMtx, playerStatus->position.x, playerStatus->position.y, playerStatus->position.z);
guMtxCatF(transformMtx, tempMtx, transformMtx);
playerStatus->unk_BC = spr_update_player_sprite(0, playerStatus->trueAnimation, 1.0f);
playerStatus->animNotifyValue = spr_update_player_sprite(0, playerStatus->trueAnimation, 1.0f);
spr_draw_player_sprite(0, 0, 0, NULL, transformMtx);
}
#else
INCLUDE_ASM(s32, "world/area_mac/mac_04/844860", func_80241DAC_84497C);
#endif
const char* N(exit_str_4) = "omo_03";
const char* N(exit_str_5) = "kmr_22";
#include "world/common/todo/RemovePadlock.inc.c"

View File

@ -1,4 +1,5 @@
#include "mac_05.h"
#include "effects.h"
static char* N(exit_str_0) = "mac_04";
static char* N(exit_str_1) = "kgr_01";
@ -11,7 +12,10 @@ static char* N(exit_str_1) = "kgr_01";
#include "world/common/todo/UnkFloatFunc001.inc.c"
#define NAMESPACE mac_05
INCLUDE_ASM(s32, "world/area_mac/mac_05/852170", func_8024047C_8525EC);
ApiStatus func_8024047C_8525EC(Evt* script, s32 isInitialCall) {
gGameStatusPtr->exitTangent = 0.0f;
return ApiStatus_BLOCK;
}
#include "world/common/enemy/ai/PatrolNoAttackAI.inc.c"
@ -76,24 +80,198 @@ ApiStatus func_80242708_854878(Evt* script, s32 isInitialCall) {
extern s32 N(LetterDelivery_SavedNpcAnim);
#include "world/common/todo/LetterDelivery.inc.c"
// float stuff
#ifdef NON_MATCHING
ApiStatus func_80242A90_854C00(Evt* script) {
Bytecode* args = script->ptrReadPos;
s32 temp_s1 = evt_get_variable(script, *args++);
s32 temp_s3 = *args++;
s32 temp_s4 = *args++;
s32 temp_s5 = *args++;
Npc* npc = get_npc_safe(0);
f32 temp_f20;
f32 var_f20;
f32 var_f22;
f32 var_f24;
f32 var_f26;
switch (temp_s1) {
case 0:
var_f26 = 55.0f;
break;
case 1:
var_f26 = 85.0f;
break;
case 2:
var_f26 = 25.0f;
break;
case 3:
var_f24 = -295.0f;
var_f22 = -10.0f;
var_f20 = 400.0f;
break;
case 4:
var_f24 = -285.0f;
var_f22 = -10.0f;
var_f20 = 380.0f;
break;
default:
var_f24 = -295.0f;
var_f22 = -10.0f;
var_f20 = 420.0f;
break;
}
if (temp_s1 < 3) {
temp_f20 = -npc->yaw;
var_f24 = npc->pos.x + 30.0f + (sin_deg(temp_f20) * var_f26);
var_f22 = npc->pos.y + 50.0f;
var_f20 = npc->pos.z + (cos_deg(temp_f20) * var_f26);
}
evt_set_float_variable(script, temp_s3, var_f24);
evt_set_float_variable(script, temp_s4, var_f22);
evt_set_float_variable(script, temp_s5, var_f20);
return ApiStatus_DONE2;
}
#else
INCLUDE_ASM(s32, "world/area_mac/mac_05/852170", func_80242A90_854C00);
#endif
static char* N(exit_str_2) = "mac_06";
INCLUDE_ASM(s32, "world/area_mac/mac_05/852170", func_80242C78_854DE8);
INCLUDE_ASM(s32, "world/area_mac/mac_05/852170", func_80242E84_854FF4);
ApiStatus func_80242E84_854FF4(Evt* script, s32 isInitialCall) {
Bytecode* args = script->ptrReadPos;
Npc* npc = get_npc_safe(0);
if (isInitialCall) {
script->functionTemp[0] = evt_get_variable(script, *args++);
if (script->functionTemp[0] == 0) {
script->functionTemp[2] = 0;
script->functionTemp[1] = 90;
} else {
script->functionTemp[2] = 10;
script->functionTemp[1] = 290;
npc->pos.x = 650.0f;
npc->pos.y = -30.0f;
npc->pos.z = 372.0f;
}
}
switch (script->functionTemp[2]) {
case 0:
npc->currentAnim = 0xB60001;
npc->yaw -= 1.0f;
npc->pos.x += 3.0f;
script->functionTemp[1]--;
if (script->functionTemp[1] <= 0) {
script->functionTemp[2] = 1;
script->functionTemp[1] = 200;
}
break;
case 1:
if (evt_get_variable(NULL, MapFlag(1)) != 0) {
npc->pos.x += 3.0f;
script->functionTemp[1]--;
if (script->functionTemp[1] <= 0) {
return ApiStatus_DONE1;
}
}
break;
case 10:
npc->yaw = 270.0f;
npc->pos.x -= 3.0f;
script->functionTemp[1]--;
if (script->functionTemp[1] <= 0) {
script->functionTemp[2] = 11;
script->functionTemp[1] = 90;
}
break;
case 11:
npc->yaw -= 1.0f;
script->functionTemp[1]--;
if (script->functionTemp[1] <= 0) {
return ApiStatus_DONE1;
}
break;
}
return ApiStatus_BLOCK;
}
#include "world/common/todo/GetFloorCollider.inc.c"
INCLUDE_ASM(s32, "world/area_mac/mac_05/852170", func_802430B4_855224);
ApiStatus func_802430B4_855224(Evt* script, s32 isInitialCall) {
Bytecode* args = script->ptrReadPos;
Npc* npc = get_npc_safe(-4);
s32 outVal = -1;
INCLUDE_ASM(s32, "world/area_mac/mac_05/852170", func_802431B0_855320);
if (gCollisionStatus.bombetteExploded >= 0) {
f32 temp = 11.0f;
f32 x = npc->pos.x;
f32 y = npc->pos.y + temp;
f32 z = npc->pos.z;
INCLUDE_ASM(s32, "world/area_mac/mac_05/852170", func_80243254_8553C4);
temp = 12.0f;
if (npc_raycast_down_around(npc->collisionChannel, &x, &y, &z, &temp, npc->yaw, npc->collisionRadius) &&
temp <= 12.0f)
{
outVal = D_8010C978;
}
}
evt_set_variable(script, *args++, outVal);
return ApiStatus_DONE2;
}
INCLUDE_ASM(s32, "world/area_mac/mac_05/852170", func_8024335C_8554CC);
ApiStatus func_802431B0_855320(Evt* script, s32 isInitialCall) {
Npc* npc = get_npc_safe(4);
f32 x = npc->pos.x + 20.0f;
f32 y = npc->pos.y;
f32 z = npc->pos.z - 15.0f;
INCLUDE_ASM(s32, "world/area_mac/mac_05/852170", func_80243380_8554F0);
if (y < 0.0f) {
fx_rising_bubble(0, x, y, z, 0.0f);
sfx_adjust_env_sound_pos(SOUND_JR_TROOPA_SWIM, 0, x, y, z);
}
return ApiStatus_DONE2;
}
INCLUDE_ASM(s32, "world/area_mac/mac_05/852170", func_802433BC_85552C);
ApiStatus func_80243254_8553C4(Evt* script, s32 isInitialCall) {
PlayerStatus* playerStatus = &gPlayerStatus;
Bytecode* args = script->ptrReadPos;
s32 npcID = evt_get_variable(script, *args++);
s32 outVar0 = *args++;
s32 outVar1 = *args++;
Npc* npc = resolve_npc(script, npcID);
f32 theta;
f32 x;
f32 z;
if (npc == NULL) {
return ApiStatus_DONE2;
}
theta = clamp_angle(atan2(playerStatus->position.x, playerStatus->position.z, npc->pos.x, npc->pos.z));
x = playerStatus->position.x + (sin_deg(theta) * 40.0f);
z = playerStatus->position.z - (cos_deg(theta) * 40.0f);
evt_set_variable(script, outVar0, x);
evt_set_variable(script, outVar1, z);
return ApiStatus_DONE2;
}
ApiStatus func_8024335C_8554CC(Evt* script, s32 isInitialCall) {
if (func_8014AD40() == 0) {
return ApiStatus_DONE2;
} else {
return ApiStatus_BLOCK;
}
}
ApiStatus func_80243380_8554F0(Evt* script, s32 isInitialCall) {
script->varTable[0] = (s32) ((gPlayerData.frameCounter - gPlayerData.tradeEventStartTime) / 3600) < script->varTable[0];
return ApiStatus_DONE2;
}
ApiStatus func_802433BC_85552C(Evt* script, s32 isInitialCall) {
script->varTable[0] = get_item_count();
return ApiStatus_DONE2;
}

View File

@ -1,3 +1,40 @@
#include "machi.h"
INCLUDE_ASM(s32, "world/area_mac/machi/7E7850", func_802404B0_7E7850);
ApiStatus func_802404B0_7E7850(Evt* script, s32 isInitialCall) {
Npc* npc = get_npc_unsafe(0x37);
if (isInitialCall) {
script->functionTemp[0] = 0;
}
switch (script->functionTemp[0]) {
case 0:
npc->moveToPos.x = npc->pos.x + 500.0f;
npc->moveToPos.y = npc->pos.y + 120.0f;
npc->moveToPos.z = npc->pos.z - 500.0f;
npc->duration = 20;
npc->moveToPos.x = (npc->moveToPos.x - npc->pos.x) / npc->duration;
npc->moveToPos.y = (npc->moveToPos.y - npc->pos.y) / npc->duration;
npc->moveToPos.z = (npc->moveToPos.z - npc->pos.z) / npc->duration;
npc->duration = 100;
npc->moveToPos.x /= 10.0f;
npc->moveToPos.y /= 10.0f;
npc->moveToPos.z /= 10.0f;
enable_npc_blur(npc);
script->functionTemp[0] = 1;
break;
case 1:
npc->pos.x += npc->moveToPos.x;
npc->pos.y += npc->moveToPos.y;
npc->pos.z += npc->moveToPos.z;
npc->moveToPos.x = npc->moveToPos.x * 1.05;
npc->moveToPos.y = npc->moveToPos.y * 1.05;
npc->moveToPos.z = npc->moveToPos.z * 1.05;
npc->duration--;
if (npc->duration == 0) {
return ApiStatus_DONE1;
}
break;
}
return ApiStatus_BLOCK;
}

View File

@ -1,6 +1,33 @@
#include "nok_02.h"
INCLUDE_ASM(s32, "world/area_nok/nok_02/9DA8F0", func_802438D0_9DA8F0);
extern s32 D_802523B4_9E93D4;
extern Npc* wPartnerNpc;
// SetupDemoScene
ApiStatus func_802438D0_9DA8F0(Evt* script, s32 isInitialCall) {
PlayerStatus* playerStatus = &gPlayerStatus;
switch (D_802523B4_9E93D4) {
case 0:
D_802523B4_9E93D4 = 1;
break;
case 1:
case 2:
D_802523B4_9E93D4++;
break;
case 3:
partner_clear_player_tracking(wPartnerNpc);
partner_set_goal_pos(playerStatus->position.x, playerStatus->position.z);
func_800EF3D4(0);
set_npc_yaw(wPartnerNpc, 90.0f);
playerStatus->targetYaw = 90.0f;
playerStatus->currentYaw = 90.0f;
playerStatus->spriteFacingAngle = 0.0f;
return ApiStatus_DONE2;
}
return ApiStatus_BLOCK;
}
#define NAMESPACE dup2_nok_02
#include "world/common/todo/GetNpcCollisionHeight.inc.c"
@ -64,7 +91,16 @@ ApiStatus func_80243D14_9DAD34(Evt* script, s32 isInitialCall) {
#include "world/common/todo/GetItemName.inc.c"
#define NAMESPACE nok_02
INCLUDE_ASM(s32, "world/area_nok/nok_02/9DA8F0", func_80243EC8_9DAEE8);
ApiStatus func_80243EC8_9DAEE8(Evt* script) {
Bytecode* args = script->ptrReadPos;
if ((evt_get_variable(script, *args++) % 4) != 0) {
script->varTable[0] = 0;
} else {
script->varTable[0] = 1;
}
return ApiStatus_DONE2;
}
INCLUDE_ASM(s32, "world/area_nok/nok_02/9DA8F0", func_80243F10_9DAF30);

View File

@ -1,5 +1,57 @@
#include "nok_12.h"
INCLUDE_ASM(s32, "world/area_nok/nok_12/9FC6D0", func_80241EE0_9FC6D0);
extern s32 D_802459CC_A001BC;
extern s32 D_80245A14_A00204;
extern Npc* wPartnerNpc;
INCLUDE_ASM(s32, "world/area_nok/nok_12/9FC6D0", func_80241FD0_9FC7C0);
// SetupDemoScene
ApiStatus func_80241EE0_9FC6D0(Evt* script, s32 isInitialCall) {
PlayerStatus* playerStatus = &gPlayerStatus;
switch (D_802459CC_A001BC) {
case 0:
D_802459CC_A001BC = 1;
break;
case 1:
case 2:
D_802459CC_A001BC++;
break;
case 3:
partner_clear_player_tracking(wPartnerNpc);
partner_set_goal_pos(playerStatus->position.x, playerStatus->position.z);
func_800EF3D4(0);
set_npc_yaw(wPartnerNpc, 90.0f);
playerStatus->targetYaw = 90.0f;
playerStatus->currentYaw = 90.0f;
playerStatus->spriteFacingAngle = 0.0f;
return ApiStatus_DONE2;
}
return ApiStatus_BLOCK;
}
// SetupDemoScene
ApiStatus func_80241FD0_9FC7C0(Evt* script, s32 isInitialCall) {
PlayerStatus* playerStatus = &gPlayerStatus;
switch (D_80245A14_A00204) {
case 0:
D_80245A14_A00204 = 1;
break;
case 1:
case 2:
D_80245A14_A00204++;
break;
case 3:
partner_clear_player_tracking(wPartnerNpc);
partner_set_goal_pos(playerStatus->position.x, playerStatus->position.z);
func_800EF3D4(0);
set_npc_yaw(wPartnerNpc, 90.0f);
playerStatus->targetYaw = 90.0f;
playerStatus->currentYaw = 90.0f;
playerStatus->spriteFacingAngle = 0.0f;
return ApiStatus_DONE2;
}
return ApiStatus_BLOCK;
}

View File

@ -11,7 +11,12 @@ static char* N(exit_str_5) = "obk_09";
#include "world/common/todo/SetCamera0MoveFlag1.inc.c"
INCLUDE_ASM(s32, "world/area_obk/obk_01/BBD1A0", func_80240038_BBD1D8);
ApiStatus func_80240038_BBD1D8(Evt* script, s32 isInitialCall) {
Bytecode* args = script->ptrReadPos;
gCameras[CAM_DEFAULT].vfov = (s32) evt_get_float_variable(script, *args++);
return ApiStatus_DONE2;
}
INCLUDE_ASM(s32, "world/area_obk/obk_01/BBD1A0", func_8024007C_BBD21C);

View File

@ -17,6 +17,65 @@ INCLUDE_ASM(s32, "world/area_obk/obk_01/BBD980", func_80240BB0_BBDD50);
extern s32 N(LetterDelivery_SavedNpcAnim);
#include "world/common/todo/LetterDelivery.inc.c"
INCLUDE_ASM(s32, "world/area_obk/obk_01/BBD980", func_80240F38_BBE0D8);
ApiStatus func_80240F38_BBE0D8(Evt* script, s32 isInitialCall) {
Npc* npc = get_npc_safe(script->owner2.npcID);
INCLUDE_ASM(s32, "world/area_obk/obk_01/BBD980", func_80241094_BBE234);
if (isInitialCall) {
script->functionTemp[1] = 0;
}
switch (script->functionTemp[1]) {
case 0:
npc->pos.z = rand_int(100) + 180;
npc->pos.y = rand_int(100) - 200;
npc->moveSpeed = (2.0f * rand_float()) + 2.0f;
if (rand_int(100) < 50) {
npc->pos.x = 920.0f;
npc->yaw = 270.0f;
} else {
npc->pos.x = -20.0f;
npc->yaw = 90.0f;
}
script->functionTemp[1] = 1;
break;
case 1:
npc_move_heading(npc, npc->moveSpeed, npc->yaw);
if (npc->pos.x < -30.0f || npc->pos.x > 930.0f) {
script->functionTemp[1] = 0;
}
break;
}
return ApiStatus_BLOCK;
}
extern s16 D_80244A54_BC1BF4[];
ApiStatus func_80241094_BBE234(Evt* script, s32 isInitialCall) {
s32 var0 = script->varTable[0];
s32 var1 = script->varTable[1];
s32 temp;
if (var1 == 0) {
script->functionTemp[2] = D_80244A54_BC1BF4[rand_int(3)];
var1 = rand_int(50) + 30;
}
var1--;
temp = script->functionTemp[2];
if (var0 < temp) {
var0 += 10;
if (temp < var0) {
var0 = temp;
}
}
if (temp < var0) {
var0 -= 10;
if (var0 < temp) {
var0 = temp;
}
}
script->varTable[0] = var0;
script->varTable[1] = var1;
return ApiStatus_DONE2;
}

View File

@ -5,8 +5,41 @@ static char* N(exit_str_1) = "obk_03";
static char* N(exit_str_2) = "obk_06";
static char* N(exit_str_3) = "";
INCLUDE_ASM(s32, "world/area_obk/obk_02/BC2A90", func_80240000_BC2A90);
ApiStatus func_80240000_BC2A90(Evt* script, s32 isInitialCall) {
script->functionTemp[1] = 0;
return ApiStatus_DONE2;
}
#include "world/common/todo/UnkAngleFunc004.inc.c"
INCLUDE_ASM(s32, "world/area_obk/obk_02/BC2A90", func_80240194_BC2C24);
extern s16 D_80240CBC_BC374C[];
ApiStatus func_80240194_BC2C24(Evt* script, s32 isInitialCall) {
s32 var0 = script->varTable[0];
s32 var1 = script->varTable[1];
s32 temp;
if (var1 == 0) {
script->functionTemp[2] = D_80240CBC_BC374C[rand_int(3)];
var1 = rand_int(50) + 30;
}
var1--;
temp = script->functionTemp[2];
if (var0 < temp) {
var0 += 10;
if (temp < var0) {
var0 = temp;
}
}
if (temp < var0) {
var0 -= 10;
if (var0 < temp) {
var0 = temp;
}
}
script->varTable[0] = var0;
script->varTable[1] = var1;
return ApiStatus_DONE2;
}

View File

@ -1,3 +1,7 @@
#include "obk_02.h"
INCLUDE_ASM(s32, "world/area_obk/obk_02/BC2CD0", func_80240240_BC2CD0);
ApiStatus func_80240240_BC2CD0(Evt* script, s32 isInitialCall) {
script->varTable[0] = sin_deg(script->varTable[1]) * 10.0f;
script->varTable[1] = clamp_angle(script->varTable[1] + 6);
return ApiStatus_DONE2;
}

View File

@ -1,3 +1,9 @@
#include "obk_04.h"
INCLUDE_ASM(s32, "world/area_obk/obk_04/BC7E60", func_80240000_BC7E60);
ApiStatus func_80240000_BC7E60(Evt* script, s32 isInitialCall) {
ItemEntity* item = get_item_entity(script->varTable[0]);
set_item_entity_flags(script->varTable[0], ITEM_ENTITY_FLAGS_TRANSPARENT);
item->alpha = 255;
return ApiStatus_DONE2;
}

View File

@ -2,39 +2,267 @@
static char* N(exit_str_0) = "obk_03";
INCLUDE_ASM(s32, "world/area_obk/obk_04/BC7EB0", func_80240050_BC7EB0);
ApiStatus func_80240050_BC7EB0(Evt* script, s32 isInitialCall) {
Npc* npc = get_npc_unsafe(script->owner2.npcID);
s32* ptr = heap_malloc(4); // todo what is this
INCLUDE_ASM(s32, "world/area_obk/obk_04/BC7EB0", func_802400D0_BC7F30);
npc->blur.any = ptr;
*ptr = NULL;
npc->planarFlyDist = 125.0f;
npc->yaw = 0.0f;
npc->pos.x = 0.0f;
npc->pos.y = -875.0f;
npc->pos.z = 0.0f;
npc->duration = 60;
script->functionTemp[1] = 0;
return ApiStatus_DONE2;
}
INCLUDE_ASM(s32, "world/area_obk/obk_04/BC7EB0", func_80240198_BC7FF8);
void func_802400D0_BC7F30(Npc* npc) {
if (npc->yaw > 340.0f || npc->yaw < 20.0f) {
npc->renderMode = RENDER_MODE_ALPHATEST;
npc->unk_A2 = 0;
func_8003D624(npc, 0, 0, 0, 0, 0, npc->unk_A2);
} else {
npc->renderMode = RENDER_MODE_SURFACE_XLU_LAYER2;
func_8003D624(npc, 7, gPlayerStatusPtr->alpha1, 255, 0, 0, npc->unk_A2);
npc->unk_9A = 255;
}
}
INCLUDE_ASM(s32, "world/area_obk/obk_04/BC7EB0", func_8024022C_BC808C);
void func_80240198_BC7FF8(void) {
func_802400D0_BC7F30(get_npc_unsafe(1));
func_802400D0_BC7F30(get_npc_unsafe(2));
func_802400D0_BC7F30(get_npc_unsafe(3));
func_802400D0_BC7F30(get_npc_unsafe(4));
func_802400D0_BC7F30(get_npc_unsafe(5));
func_802400D0_BC7F30(get_npc_unsafe(6));
func_802400D0_BC7F30(get_npc_unsafe(7));
func_802400D0_BC7F30(get_npc_unsafe(8));
}
void func_8024022C_BC808C(void) {
get_npc_unsafe(1)->unk_A2 = 0;
get_npc_unsafe(2)->unk_A2 = 0;
get_npc_unsafe(3)->unk_A2 = 0;
get_npc_unsafe(4)->unk_A2 = 0;
get_npc_unsafe(5)->unk_A2 = 0;
get_npc_unsafe(6)->unk_A2 = 0;
get_npc_unsafe(7)->unk_A2 = 0;
get_npc_unsafe(8)->unk_A2 = 0;
}
s32 func_802402A0_BC8100(s32);
INCLUDE_ASM(s32, "world/area_obk/obk_04/BC7EB0", func_802402A0_BC8100);
INCLUDE_ASM(s32, "world/area_obk/obk_04/BC7EB0", func_802402F4_BC8154);
ApiStatus func_802402F4_BC8154(Evt* script, s32 isInitialCall) {
Npc* npc = get_npc_unsafe(script->owner2.npcID);
s32* temp_s3 = npc->blur.any;
s32 temp_v0;
INCLUDE_ASM(s32, "world/area_obk/obk_04/BC7EB0", func_802405B4_BC8414);
switch (script->functionTemp[1]) {
case 0:
temp_v0 = evt_get_variable(script, MapVar(1));
if (temp_v0 == 1) {
*temp_s3 = temp_v0;
script->functionTemp[1] = 10;
}
break;
case 1:
break;
case 10:
npc->yaw = clamp_angle(npc->yaw + 2.0f);
npc->duration--;
if (npc->duration == 0) {
script->functionTemp[1] = 11;
}
break;
case 11:
if (npc->pos.y <= -920.0f) {
func_80240198_BC7FF8();
}
npc->yaw = clamp_angle(npc->yaw + 2.0f);
npc->pos.y -= 0.5f;
if (npc->pos.y <= -988.0f) {
evt_set_variable(script, MapVar(2), 1);
func_8024022C_BC808C();
script->functionTemp[1] = 12;
}
break;
case 12:
script->functionTemp[1] = func_802402A0_BC8100(evt_get_variable(script, MapVar(3)));
npc->yaw = clamp_angle(npc->yaw + 2.0f);
break;
case 13:
script->functionTemp[1] = func_802402A0_BC8100(evt_get_variable(script, MapVar(3)));
npc->yaw = clamp_angle(npc->yaw - 2.0f);
break;
case 14:
evt_set_variable(script, MapVar(3), 0);
npc->duration++;
if (npc->duration == 50) {
script->functionTemp[1] = 15;
}
npc->planarFlyDist -= 2.0f;
npc->yaw = clamp_angle(npc->yaw + 2.0f);
break;
case 15:
npc->duration--;
if (npc->duration == 0) {
script->functionTemp[1] = 12;
}
npc->planarFlyDist += 2.0f;
npc->yaw = clamp_angle(npc->yaw + 2.0f);
break;
case 100:
script->functionTemp[1] = func_802402A0_BC8100(evt_get_variable(script, MapVar(3)));
break;
}
return ApiStatus_DONE2;
}
ApiStatus func_802405B4_BC8414(Evt* script, s32 isInitialCall) {
Npc* npc = get_npc_unsafe(script->owner2.npcID);
npc->blur.any = get_npc_unsafe(0); // TODO what is this?
script->functionTemp[2] = script->owner2.npcID * 45;
npc->flags |= NPC_FLAG_40000;
script->functionTemp[1] = 0;
return ApiStatus_DONE2;
}
INCLUDE_ASM(s32, "world/area_obk/obk_04/BC7EB0", func_80240624_BC8484);
INCLUDE_ASM(s32, "world/area_obk/obk_04/BC7EB0", func_80240910_BC8770);
ApiStatus func_80240910_BC8770(Evt* script, s32 isInitialCall) {
if (gPlayerStatus.position.y < -50.0f) {
return ApiStatus_DONE2;
}
return ApiStatus_BLOCK;
}
#include "world/common/todo/StashVars.inc.c"
#include "world/common/todo/GetItemName.inc.c"
INCLUDE_ASM(s32, "world/area_obk/obk_04/BC7EB0", func_80240A58_BC88B8);
ApiStatus func_80240A58_BC88B8(Evt* script, s32 isInitialCall) {
Npc* npc1 = get_npc_unsafe(1);
Npc* npc2 = get_npc_unsafe(2);
Npc* npc3 = get_npc_unsafe(3);
Npc* npc4 = get_npc_unsafe(4);
Npc* npc5 = get_npc_unsafe(5);
Npc* npc6 = get_npc_unsafe(6);
Npc* npc7 = get_npc_unsafe(7);
Npc* npc8 = get_npc_unsafe(8);
INCLUDE_ASM(s32, "world/area_obk/obk_04/BC7EB0", func_80240C10_BC8A70);
switch (script->varTable[0]) {
case 0:
script->varTable[0] = npc1->yaw;
evt_set_variable(NULL, MapVar(5), 1);
break;
case 1:
script->varTable[0] = npc2->yaw;
evt_set_variable(NULL, MapVar(5), 2);
break;
case 2:
script->varTable[0] = npc3->yaw;
evt_set_variable(NULL, MapVar(5), 3);
break;
case 3:
script->varTable[0] = npc4->yaw;
evt_set_variable(NULL, MapVar(5), 4);
break;
case 4:
script->varTable[0] = npc5->yaw;
evt_set_variable(NULL, MapVar(5), 5);
break;
case 5:
script->varTable[0] = npc6->yaw;
evt_set_variable(NULL, MapVar(5), 6);
break;
case 6:
script->varTable[0] = npc7->yaw;
evt_set_variable(NULL, MapVar(5), 7);
break;
case 7:
script->varTable[0] = npc8->yaw;
evt_set_variable(NULL, MapVar(5), 8);
break;
}
script->varTable[0] += script->varTable[1];
return ApiStatus_DONE2;
}
INCLUDE_ASM(s32, "world/area_obk/obk_04/BC7EB0", func_80240CA0_BC8B00);
ApiStatus func_80240C10_BC8A70(Evt* script) {
Npc npc;
npc.pos.x = 0;
npc.pos.y = 0.0f;
npc.pos.z = 0.0f;
npc.planarFlyDist = 125.0f;
npc_move_heading(&npc, 125.0f, script->varTable[0]);
script->varTable[0] = npc.pos.x;
script->varTable[1] = npc.pos.y + 10.0f;
script->varTable[2] = npc.pos.z + 20.0f;
return ApiStatus_DONE2;
}
ApiStatus func_80240CA0_BC8B00(Evt* script, s32 isInitialCall) {
Npc* npc = get_npc_unsafe(evt_get_variable(NULL, MapVar(5)));
script->varTable[0] = npc->pos.x;
script->varTable[1] = npc->pos.y;
script->varTable[2] = npc->pos.z;
return ApiStatus_DONE2;
}
ApiStatus func_80240D00_BC8B60(Evt* script, s32 isInitialCall) {
gPlayerData.bootsLevel = 1;
return ApiStatus_DONE2;
}
INCLUDE_ASM(s32, "world/area_obk/obk_04/BC7EB0", func_80240D14_BC8B74);
ApiStatus func_80240D14_BC8B74(Evt* script, s32 isInitialCall) {
PlayerStatus* playerStatus = &gPlayerStatus;
Npc npc;
f32 dist = dist2D(playerStatus->position.x, playerStatus->position.z, 0.0f, 0.0f);
f32 yaw;
s32 gt, lt;
INCLUDE_ASM(s32, "world/area_obk/obk_04/BC7EB0", func_80240E58_BC8CB8);
if (!(dist > 90.0f)) {
gt = FALSE;
} else {
gt = TRUE;
}
if (!(dist < 150.0f)) {
lt = FALSE;
} else {
lt = TRUE;
}
if ((gt | lt) != 0) {
yaw = atan2(playerStatus->position.x, playerStatus->position.z, 0.0f, 0.0f) + 180.0f;
npc.pos.x = 0.0f;
npc.pos.y = 0.0f;
npc.pos.z = 0.0f;
npc_move_heading(&npc, 80.0f, yaw);
script->varTable[0] = npc.pos.x;
script->varTable[1] = npc.pos.y;
script->varTable[2] = npc.pos.z;
script->varTable[3] = 1;
} else {
script->varTable[0] = playerStatus->position.x;
script->varTable[1] = playerStatus->position.y;
script->varTable[2] = playerStatus->position.z;
script->varTable[3] = 0;
}
return ApiStatus_DONE2;
}
ApiStatus func_80240E58_BC8CB8(Evt* script, s32 isInitialCall) {
if (get_npc_unsafe(1)->duration == 0) {
return ApiStatus_DONE2;
} else {
return ApiStatus_BLOCK;
}
}

View File

@ -1,7 +1,40 @@
#include "obk_07.h"
INCLUDE_ASM(s32, "world/area_obk/obk_07/BCEEB0", func_802402C0_BCEEB0);
ApiStatus func_802402C0_BCEEB0(Evt* script, s32 isInitialCall) {
script->functionTemp[1] = 0;
return ApiStatus_DONE2;
}
#include "world/common/todo/UnkAngleFunc004.inc.c"
INCLUDE_ASM(s32, "world/area_obk/obk_07/BCEEB0", func_80240454_BCF044);
extern s16 D_8024292C_BD151C[];
ApiStatus func_80240454_BCF044(Evt* script, s32 isInitialCall) {
s32 var0 = script->varTable[0];
s32 var1 = script->varTable[1];
s32 temp;
if (var1 == 0) {
script->functionTemp[2] = D_8024292C_BD151C[rand_int(3)];
var1 = rand_int(50) + 30;
}
var1--;
temp = script->functionTemp[2];
if (var0 < temp) {
var0 += 10;
if (temp < var0) {
var0 = temp;
}
}
if (temp < var0) {
var0 -= 10;
if (var0 < temp) {
var0 = temp;
}
}
script->varTable[0] = var0;
script->varTable[1] = var1;
return ApiStatus_DONE2;
}

View File

@ -14,4 +14,10 @@ INCLUDE_ASM(s32, "world/area_obk/obk_08/BD3870", func_802406DC_BD3F4C);
INCLUDE_ASM(s32, "world/area_obk/obk_08/BD3870", func_8024079C_BD400C);
INCLUDE_ASM(s32, "world/area_obk/obk_08/BD3870", func_80240808_BD4078);
ApiStatus func_80240808_BD4078(Evt* script, s32 isInitialCall) {
if (gPlayerData.curHP < 2) {
return ApiStatus_DONE2;
}
gPlayerData.curHP--;
return ApiStatus_DONE2;
}

View File

@ -2,21 +2,119 @@
static char* N(exit_str_0) = "obk_01";
INCLUDE_ASM(s32, "world/area_obk/obk_08/BD4110", func_802408A0_BD4110);
ApiStatus func_802408A0_BD4110(Evt* script, s32 isInitialCall) {
Npc* npc = get_npc_unsafe(script->owner2.npcID);
s32* ptr = heap_malloc(4); // todo what is this
INCLUDE_ASM(s32, "world/area_obk/obk_08/BD4110", func_80240920_BD4190);
npc->blur.any = ptr;
*ptr = NULL;
npc->planarFlyDist = 125.0f;
npc->yaw = 0.0f;
npc->pos.x = 0.0f;
npc->pos.y = -875.0f;
npc->pos.z = 0.0f;
npc->duration = 60;
script->functionTemp[1] = 0;
return ApiStatus_DONE2;
}
INCLUDE_ASM(s32, "world/area_obk/obk_08/BD4110", func_802409E8_BD4258);
void func_80240920_BD4190(Npc* npc) {
if (npc->yaw > 340.0f || npc->yaw < 20.0f) {
npc->renderMode = RENDER_MODE_ALPHATEST;
npc->unk_A2 = 0;
func_8003D624(npc, 0, 0, 0, 0, 0, npc->unk_A2);
} else {
npc->renderMode = RENDER_MODE_SURFACE_XLU_LAYER2;
func_8003D624(npc, 7, gPlayerStatusPtr->alpha1, 0, 0, 0, npc->unk_A2);
npc->unk_9A = 255;
}
}
INCLUDE_ASM(s32, "world/area_obk/obk_08/BD4110", func_80240A7C_BD42EC);
void func_802409E8_BD4258(void) {
func_80240920_BD4190(get_npc_unsafe(1));
func_80240920_BD4190(get_npc_unsafe(2));
func_80240920_BD4190(get_npc_unsafe(3));
func_80240920_BD4190(get_npc_unsafe(4));
func_80240920_BD4190(get_npc_unsafe(5));
func_80240920_BD4190(get_npc_unsafe(6));
func_80240920_BD4190(get_npc_unsafe(7));
func_80240920_BD4190(get_npc_unsafe(8));
}
INCLUDE_ASM(s32, "world/area_obk/obk_08/BD4110", func_80240AF0_BD4360);
void func_80240A7C_BD42EC(void) {
get_npc_unsafe(1)->unk_A2 = 0;
get_npc_unsafe(2)->unk_A2 = 0;
get_npc_unsafe(3)->unk_A2 = 0;
get_npc_unsafe(4)->unk_A2 = 0;
get_npc_unsafe(5)->unk_A2 = 0;
get_npc_unsafe(6)->unk_A2 = 0;
get_npc_unsafe(7)->unk_A2 = 0;
get_npc_unsafe(8)->unk_A2 = 0;
}
INCLUDE_ASM(s32, "world/area_obk/obk_08/BD4110", func_80240CA0_BD4510);
ApiStatus func_80240AF0_BD4360(Evt* script, s32 isInitialCall) {
Npc* npc = get_npc_unsafe(script->owner2.npcID);
s32* temp_s2 = npc->blur.any;
s32 temp_v0;
switch (script->functionTemp[1]) {
case 0:
temp_v0 = evt_get_variable(script, AreaFlag(8));
if (temp_v0 == 1) {
*temp_s2 = temp_v0;
script->functionTemp[1] = 10;
}
break;
case 10:
npc->yaw = clamp_angle(npc->yaw + 2.0f);
npc->duration--;
if (npc->duration == 0) {
script->functionTemp[1] = 11;
}
break;
case 11:
if (npc->pos.y <= -920.0f) {
func_802409E8_BD4258();
}
npc->yaw = clamp_angle(npc->yaw + 2.0f);
npc->pos.y -= 0.5f;
if (npc->pos.y <= -988.0f) {
evt_set_variable(script, MapVar(1), 1);
func_80240A7C_BD42EC();
script->functionTemp[1] = 12;
}
break;
case 12:
if (evt_get_variable(script, MapVar(2)) == 1) {
script->functionTemp[1] = 13;
}
npc->yaw = clamp_angle(npc->yaw + 2.0f);
break;
case 13:
if (evt_get_variable(script, MapVar(2)) == 0) {
script->functionTemp[1] = 12;
}
break;
}
return ApiStatus_DONE2;
}
ApiStatus func_80240CA0_BD4510(Evt* script, s32 isInitialCall) {
Npc* npc = get_npc_unsafe(script->owner2.npcID);
npc->blur.any = get_npc_unsafe(0);
script->functionTemp[2] = script->owner2.npcID * 45;
npc->flags |= NPC_FLAG_40000;
script->functionTemp[1] = 0;
return ApiStatus_DONE2;
}
INCLUDE_ASM(s32, "world/area_obk/obk_08/BD4110", func_80240D10_BD4580);
INCLUDE_ASM(s32, "world/area_obk/obk_08/BD4110", func_80240FD8_BD4848);
ApiStatus func_80240FD8_BD4848(Evt* script, s32 isInitialCall) {
script->functionTemp[1] = 0;
return ApiStatus_DONE2;
}
ApiStatus func_80240FE4_BD4854(Evt* script, s32 isInitialCall) {
Npc* npc = get_npc_safe(script->owner2.npcID);
@ -52,4 +150,34 @@ ApiStatus func_80240FE4_BD4854(Evt* script, s32 isInitialCall) {
return ApiStatus_DONE2;
}
INCLUDE_ASM(s32, "world/area_obk/obk_08/BD4110", func_8024116C_BD49DC);
extern s16 D_80244FEC_BD885C[];
ApiStatus func_8024116C_BD49DC(Evt* script, s32 isInitialCall) {
s32 var0 = script->varTable[0];
s32 var1 = script->varTable[1];
s32 temp;
if (var1 == 0) {
script->functionTemp[2] = D_80244FEC_BD885C[rand_int(3)];
var1 = rand_int(50) + 30;
}
var1--;
temp = script->functionTemp[2];
if (var0 < temp) {
var0 += 10;
if (temp < var0) {
var0 = temp;
}
}
if (temp < var0) {
var0 -= 10;
if (var0 < temp) {
var0 = temp;
}
}
script->varTable[0] = var0;
script->varTable[1] = var1;
return ApiStatus_DONE2;
}

View File

@ -1,9 +1,106 @@
#include "obk_08.h"
INCLUDE_ASM(s32, "world/area_obk/obk_08/BD4A90", func_80241220_BD4A90);
ApiStatus func_80241220_BD4A90(Evt* script, s32 isInitialCall) {
Npc* npc1 = get_npc_unsafe(0xB);
Npc* npc2 = get_npc_unsafe(0);
INCLUDE_ASM(s32, "world/area_obk/obk_08/BD4A90", func_802412BC_BD4B2C);
npc1->pos.x = npc2->pos.x;
npc1->pos.z = npc2->pos.z;
npc_move_heading(npc1, npc2->planarFlyDist, script->varTable[0]);
npc1->pos.y = npc2->pos.y + 1000.0f + 25.0f;
return ApiStatus_DONE2;
}
INCLUDE_ASM(s32, "world/area_obk/obk_08/BD4A90", func_80241300_BD4B70);
ApiStatus func_802412BC_BD4B2C(Evt* script, s32 isInitialCall) {
script->varTable[0] = clamp_angle(script->varTable[0] - 2);
return ApiStatus_DONE2;
}
INCLUDE_ASM(s32, "world/area_obk/obk_08/BD4A90", func_80241658_BD4EC8);
ApiStatus func_80241300_BD4B70(Evt* script, s32 isInitialCall) {
Npc* npc1 = get_npc_unsafe(1);
Npc* npc2 = get_npc_unsafe(2);
Npc* npc3 = get_npc_unsafe(3);
Npc* npc4 = get_npc_unsafe(4);
Npc* npc5 = get_npc_unsafe(5);
Npc* npc6 = get_npc_unsafe(6);
Npc* npc7 = get_npc_unsafe(7);
Npc* npc8 = get_npc_unsafe(8);
s32 outVal = 0;
script->varTable[1] = FALSE;
evt_set_variable(script, MapVar(3), 0);
if (npc1->yaw <= script->varTable[0] - 23 && script->varTable[0] - 27 <= npc1->yaw) {
script->varTable[1] = TRUE;
outVal = 1;
}
if (npc2->yaw <= script->varTable[0] - 23 && script->varTable[0] - 27 <= npc2->yaw) {
script->varTable[1] = TRUE;
outVal = 2;
}
if (npc3->yaw <= script->varTable[0] - 23 && script->varTable[0] - 27 <= npc3->yaw) {
script->varTable[1] = TRUE;
outVal = 3;
}
if (npc4->yaw <= script->varTable[0] - 23 && script->varTable[0] - 27 <= npc4->yaw) {
script->varTable[1] = TRUE;
outVal = 4;
}
if (npc5->yaw <= script->varTable[0] - 23 && script->varTable[0] - 27 <= npc5->yaw) {
script->varTable[1] = TRUE;
outVal = 5;
}
if (npc6->yaw <= script->varTable[0] - 23 && script->varTable[0] - 27 <= npc6->yaw) {
script->varTable[1] = TRUE;
outVal = 6;
}
if (npc7->yaw <= script->varTable[0] - 23 && script->varTable[0] - 27 <= npc7->yaw) {
script->varTable[1] = TRUE;
outVal = 7;
}
if (npc8->yaw <= script->varTable[0] - 23 && script->varTable[0] - 27 <= npc8->yaw) {
script->varTable[1] = TRUE;
outVal = 8;
}
evt_set_variable(script, MapVar(3), outVal);
return ApiStatus_DONE2;
}
ApiStatus func_80241658_BD4EC8(Evt* script, s32 isInitialCall) {
PlayerStatus* playerStatus = &gPlayerStatus;
f32 dist = dist2D(playerStatus->position.x, playerStatus->position.z, 0.0f, 0.0f);
Npc npc;
f32 temp_a2;
s32 gt;
s32 lt;
if (!(dist > 90.0f)) {
gt = FALSE;
} else {
gt = TRUE;
}
if (!(dist < 150.0f)) {
lt = FALSE;
} else {
lt = TRUE;
}
if ((gt | lt) != 0) {
temp_a2 = atan2(playerStatus->position.x, playerStatus->position.z, 0.0f, 0.0f) + 180.0f;
npc.pos.x = 0.0f;
npc.pos.y = 0.0f;
npc.pos.z = 0.0f;
npc_move_heading(&npc, 80.0f, temp_a2);
script->varTable[0] = npc.pos.x;
script->varTable[1] = npc.pos.y;
script->varTable[2] = npc.pos.z;
script->varTable[3] = 1;
} else {
script->varTable[0] = playerStatus->position.x;
script->varTable[1] = playerStatus->position.y;
script->varTable[2] = playerStatus->position.z;
script->varTable[3] = 0;
}
return ApiStatus_DONE2;
}

View File

@ -1,3 +1,6 @@
#include "obk_09.h"
INCLUDE_ASM(s32, "world/area_obk/obk_09/BDABA0", func_802403F0_BDABA0);
ApiStatus func_802403F0_BDABA0(Evt* script) {
get_item_entity(script->varTable[0])->scale = 0.6f;
return ApiStatus_DONE2;
}

View File

@ -1,3 +1,61 @@
#include "omo_01.h"
#include "model.h"
INCLUDE_ASM(s32, "world/area_omo/omo_01/D9AEF0", func_80240000_D9AEF0);
typedef struct UnkOmo {
/* 0x00 */ f32 unk_00;
/* 0x04 */ f32 unk_04;
/* 0x08 */ f32 unk_08;
/* 0x0C */ f32 unk_0C;
/* 0x10 */ f32 unk_10;
/* 0x14 */ s32 treeIndex;
} UnkOmo; // size = 0x18
extern s32 D_802412A0_D9C190[];
ApiStatus func_80240000_D9AEF0(Evt* script, s32 isInitialCall) {
Matrix4f sp18, sp58;
UnkOmo* it;
Model* model;
f32 temp_f20;
f32 temp_f24;
u32 i;
if (isInitialCall) {
it = heap_malloc(sizeof(*it) * 2);
script->functionTempPtr[0] = it;
for (i = 0; i < 2; i++, it++) {
s32 treeIndex = D_802412A0_D9C190[i];
it->treeIndex = treeIndex;
model = get_model_from_list_index(get_model_list_index_from_tree_index(treeIndex));
it->unk_00 = model->center.x;
it->unk_04 = model->center.z;
it->unk_0C = 3.5f;
it->unk_10 = 0;
it->unk_08 = 0;
}
}
it = script->functionTempPtr[0];
for (i = 0; i < 2; i++, it++) {
it->unk_10 += it->unk_0C;
it->unk_10 = clamp_angle(it->unk_10);
temp_f20 = sin_deg(it->unk_10) * 20.0f;
temp_f24 = SQ(temp_f20) / 90.0f;
if (i == 0) {
if ((it->unk_08 >= 0.0f && temp_f20 < 0.0f) || (it->unk_08 < 0.0f && temp_f20 >= 0.0f)) {
sfx_play_sound_at_position(0x1D6, 0, -185.0f, 0.0f, 160.0f);
}
it->unk_08 = temp_f20;
}
model = get_model_from_list_index(get_model_list_index_from_tree_index(it->treeIndex));
model->flags |= MODEL_FLAGS_USES_TRANSFORM_MATRIX | MODEL_FLAGS_HAS_TRANSFORM_APPLIED;
guTranslateF(sp18, -it->unk_00, 0.0f, -it->unk_04);
guRotateF(sp58, temp_f20, 0.0f, 0.0f, 1.0f);
guMtxCatF(sp18, sp58, model->transformMatrix);
guTranslateF(sp18, it->unk_00, temp_f24, it->unk_04);
guMtxCatF(model->transformMatrix, sp18, model->transformMatrix);
}
return ApiStatus_BLOCK;
}

View File

@ -1,11 +1,8 @@
#include "omo_01.h"
#include "common.h"
#include "npc.h"
static char* N(exit_str_0) = "omo_13";
INCLUDE_ASM(s32, "world/area_omo/omo_01/D9B150", func_80240260_D9B150);
INCLUDE_ASM(s32, "world/area_omo/omo_01/D9B150", func_80240844_D9B734);
INCLUDE_ASM(s32, "world/area_omo/omo_01/D9B150", func_802409A8_D9B898);
INCLUDE_ASM(s32, "world/area_omo/omo_01/D9B150", func_802409EC_D9B8DC);
// TODO rename UnkFloAI since it's not exclusive to flo
#include "world/common/enemy/ai/UnkFloAI.inc.c"

View File

@ -38,8 +38,35 @@ ApiStatus func_80242204_DB44C4(Evt* script, s32 isInitialCall) {
return ApiStatus_DONE2;
}
INCLUDE_ASM(s32, "world/area_omo/omo_05/DB22C0", func_802422A0_DB4560);
ApiStatus func_802422A0_DB4560(Evt* script, s32 isInitialCall) {
Bytecode* args = script->ptrReadPos;
s32 itemID = evt_get_variable(script, *args++);
ItemData* item = &gItemTable[itemID];
INCLUDE_ASM(s32, "world/area_omo/omo_05/DB22C0", func_80242328_DB45E8);
if (itemID == ITEM_CAKE || itemID == ITEM_STRANGE_CAKE || itemID == ITEM_SHROOM_CAKE) {
script->varTable[9] = 2;
} else if (item->typeFlags & ITEM_TYPE_FLAG_FOOD_OR_DRINK) {
script->varTable[9] = 1;
} else {
script->varTable[9] = 0;
}
return ApiStatus_DONE2;
}
ApiStatus func_80242328_DB45E8(Evt* script, s32 isInitialCall) {
Camera* camera = &gCameras[CAM_DEFAULT];
if (isInitialCall) {
camera->flags |= CAMERA_FLAGS_SHAKING;
script->functionTempF[0] = 0.0f;
}
script->functionTempF[0] += 10.0f;
guRotateF(camera->viewMtxShaking, script->functionTempF[0], 0.0f, 0.0f, -1.0f);
if (script->functionTempF[0] >= 360.0) {
return ApiStatus_DONE2;
}
return ApiStatus_BLOCK;
}
INCLUDE_ASM(s32, "world/area_omo/omo_05/DB22C0", func_802423C8_DB4688);

View File

@ -13,4 +13,19 @@ static char* N(exit_str_1) = "";
#include "world/common/todo/UnsetCamera0Flag1000.inc.c"
INCLUDE_ASM(s32, "world/area_omo/omo_07/DBD2B0", func_80242EA8_DC0158);
ApiStatus func_80242EA8_DC0158(Evt* script, s32 isInitialCall) {
Bytecode* args = script->ptrReadPos;
s32 temp_s1;
s32 t0;
s32 t1;
temp_s1 = AreaFlag(7);
do {
t0 = evt_get_variable(script, *(args++));
} while (0); // TODO required to match
t0 += temp_s1;
t1 = evt_get_variable(script, *args++);
evt_set_variable(script, t0, t1);
return ApiStatus_DONE2;
}

View File

@ -3,8 +3,14 @@
static char* N(exit_str_0) = "omo_08";
static char* N(exit_str_1) = "";
ApiStatus func_80240000_DCCCD0(Evt* script, s32 isInitialCall);
INCLUDE_ASM(s32, "world/area_omo/omo_09/DCCCD0", func_80240000_DCCCD0);
INCLUDE_ASM(s32, "world/area_omo/omo_09/DCCCD0", func_80240054_DCCD24);
ApiStatus func_80240054_DCCD24(Evt* script, s32 isInitialCall) {
if (func_80240000_DCCCD0(script, isInitialCall) == ApiStatus_BLOCK) {
return ApiStatus_DONE2;
}
return ApiStatus_BLOCK;
}
INCLUDE_ASM(s32, "world/area_omo/omo_09/DCCCD0", func_80240078_DCCD48);

View File

@ -1,3 +1,8 @@
#include "omo_09.h"
INCLUDE_ASM(s32, "world/area_omo/omo_09/DCD3B0", func_802406E0_DCD3B0);
ApiStatus func_802406E0_DCD3B0(Evt* script, s32 isInitialCall) {
if (gPlayerStatus.position.x < 850.0f) {
return ApiStatus_BLOCK;
}
return ApiStatus_DONE2;
}

View File

@ -8,6 +8,21 @@
#include "world/common/todo/UnsetCamera0Flag1000.inc.c"
INCLUDE_ASM(s32, "world/area_omo/omo_12/DDF310", func_80240314_DDF624);
ApiStatus func_80240314_DDF624(Evt* script, s32 isInitialCall) {
Bytecode* args = script->ptrReadPos;
s32 x = evt_get_variable(script, *args++);
s32 y = evt_get_variable(script, *args++);
s32 z = evt_get_variable(script, *args++);
s32 temp_s0_5 = evt_get_variable(script, *args++);
INCLUDE_ASM(s32, "world/area_omo/omo_12/DDF310", func_802403D8_DDF6E8);
set_screen_overlay_center_worldpos(1, 1, x, y, z);
set_screen_overlay_alpha(1, temp_s0_5);
set_screen_overlay_params_back(0xB, 255.0f);
return ApiStatus_DONE2;
}
ApiStatus func_802403D8_DDF6E8(Evt* script, s32 isInitialCall) {
set_screen_overlay_alpha(1, 0.0f);
set_screen_overlay_params_back(0xB, 0.0f);
return ApiStatus_DONE2;
}

View File

@ -12,17 +12,17 @@
#ifdef NON_MATCHING
ApiStatus func_80240F00_DE3390(Evt* script, s32 isInitialCall) {
Bytecode* args = script->ptrReadPos;
if (isInitialCall) {
D_80241C04_DE4094 = FALSE;
}
if (D_80241C04_DE4094) {
D_80241C04_DE4094 = FALSE;
evt_set_variable(script, *args++, D_80241C08_DE4098);
return ApiStatus_DONE2;
}
return ApiStatus_BLOCK;
}
#else
@ -52,4 +52,54 @@ ApiStatus func_80240F8C_DE341C(Evt* script, s32 isInitialCall) {
return ApiStatus_DONE2;
}
// control flow
#ifdef NON_MATCHING
ApiStatus func_80241028_DE34B8(Evt* script, s32 isInitialCall) {
PlayerStatus* playerStatus = &gPlayerStatus;
Npc* npc = get_npc_safe(0);
f32 theta;
f32 x, y, z;
dist2D(110.0f, -45.0f, playerStatus->position.x, playerStatus->position.z);
theta = clamp_angle(atan2(110.0f, -45.0f, playerStatus->position.x, playerStatus->position.z));
x = (sin_deg(theta) * 30.0f) + 110.0f;
if (script->varTable[11] != 0) {
y = playerStatus->position.y * 0.7f;
} else {
y = npc->pos.y;
}
z = -45.0f - (cos_deg(theta) * 30.0f);
if (script->varTable[11] != 0 && npc->pos.y == 0.0f) {
script->varTable[11] = 0;
}
if (npc->pos.x == x && npc->pos.y == y) {
if (npc->pos.z == z) {
if (npc->currentAnim != 0x3B0501) {
npc->currentAnim = 0x3B0501;
}
} else {
goto block_10;
}
} else {
block_10:
if (npc->currentAnim != 0x3B0502) {
if (script->varTable[10]++ >= 6) {
npc->currentAnim = 0x3B0502;
script->varTable[10] = 0;
}
}
npc->pos.x = x;
npc->pos.z = z;
npc->colliderPos.x = npc->pos.x;
npc->colliderPos.y = npc->pos.y;
npc->colliderPos.z = npc->pos.z;
npc->flags |= 0x10000;
}
npc->yaw = atan2(npc->pos.x, npc->pos.z, playerStatus->position.x, playerStatus->position.z);
return ApiStatus_DONE2;
}
#else
INCLUDE_ASM(s32, "world/area_omo/omo_13/DE2710", func_80241028_DE34B8);
#endif

View File

@ -1,10 +1,71 @@
#include "omo_14.h"
INCLUDE_ASM(s32, "world/area_omo/omo_14/DE5810", func_80240160_DE5810);
ApiStatus func_80240160_DE5810(Evt* script, s32 isInitialCall) {
PlayerStatus* playerStatus = &gPlayerStatus;
Npc* npc = get_npc_unsafe(script->owner1.enemy->npcID);
f32 x = playerStatus->position.x +
((playerStatus->colliderDiameter + npc->collisionRadius) * 0.5f * sin_deg((npc->npcID * 360.0f) / 10.0f));
f32 z = playerStatus->position.z -
((playerStatus->colliderDiameter + npc->collisionRadius) * 0.5f * cos_deg((npc->npcID * 360.0f) / 10.0f));
f32 dist = dist2D(npc->pos.x, npc->pos.z, x, z);
INCLUDE_ASM(s32, "world/area_omo/omo_14/DE5810", func_802403FC_DE5AAC);
if (npc->moveSpeed < dist) {
if (npc->flags & 0x2000) {
if (npc->yaw < 180.0f) {
npc->yaw = npc->pos.z > 0.0f ? 45.0f : 135.0f;
} else {
npc->yaw = npc->pos.z > 0.0f ? 315.0f : 225.0f;
}
} else {
npc->yaw = atan2(npc->pos.x, npc->pos.z, x, z);
}
npc_move_heading(npc, npc->moveSpeed, npc->yaw);
} else {
npc->yaw = atan2(npc->pos.x, npc->pos.z, playerStatus->position.x, playerStatus->position.z);
}
INCLUDE_ASM(s32, "world/area_omo/omo_14/DE5810", func_80240564_DE5C14);
if (script->varTableF[11] == playerStatus->position.x && script->varTableF[13] == playerStatus->position.z) {
if (dist < 20.0f) {
script->varTable[14]++;
} else {
script->varTable[14] = 0;
}
}
script->varTableF[11] = playerStatus->position.x;
script->varTableF[12] = playerStatus->position.y;
script->varTableF[13] = playerStatus->position.z;
return ApiStatus_DONE2;
}
ApiStatus func_802403FC_DE5AAC(Evt* script, s32 isInitialCall) {
Bytecode* args = script->ptrReadPos;
Npc* npc = get_npc_unsafe(script->owner1.enemy->npcID);
f32 x = evt_get_float_variable(script, *args++);
f32 z = evt_get_float_variable(script, *args++);
if (npc->moveSpeed < dist2D(npc->pos.x, npc->pos.z, x, z)) {
if (npc->flags & NPC_FLAG_NO_PROJECT_SHADOW) {
if (npc->yaw < 180.0f) {
npc->yaw = npc->pos.z > 0.0f ? 45.0f : 135.0f;
} else {
npc->yaw = npc->pos.z > 0.0f ? 315.0f : 225.0f;
}
} else {
npc->yaw = atan2(npc->pos.x, npc->pos.z, x, z);
}
npc_move_heading(npc, npc->moveSpeed, npc->yaw);
}
return ApiStatus_DONE2;
}
ApiStatus func_80240564_DE5C14(Evt* script, s32 isInitialCall) {
if (gPartnerActionStatus.partnerActionState != 0) {
script->varTable[9] = gPartnerActionStatus.actingPartner;
} else {
script->varTable[9] = -1;
}
return ApiStatus_DONE2;
}
ApiStatus N(IsPartnerWatt)(Evt* script, s32 isInitialCall) {
if (gPartnerActionStatus.actingPartner == PARTNER_WATT) {

View File

@ -21,4 +21,16 @@ static char* N(exit_str_3) = "omo_03";
#include "common/IsAOrBPressed.inc.c"
INCLUDE_ASM(s32, "world/area_omo/omo_16/DEBED0", func_8024055C_DEC42C);
ApiStatus func_8024055C_DEC42C(Evt* script, s32 isInitialCall) {
f32 temp_f0 = evt_get_float_variable(script, MapVar(11));
script->varTable[0] = 0;
if (fabsf(temp_f0) < 2000.0f && (gGameStatusPtr->pressedButtons[0] & BUTTON_A)) {
script->varTable[0] = 1;
}
if (fabsf(temp_f0) < 2000.0f && (gGameStatusPtr->pressedButtons[0] & BUTTON_B)) {
script->varTable[0] = 1;
}
return ApiStatus_DONE2;
}

View File

@ -1,4 +1,5 @@
#include "osr_00.h"
#include "ld_addrs.h"
#include "world/common/atomic/UnkFunc27.inc.c"

View File

@ -1,3 +1,23 @@
#include "osr_02.h"
INCLUDE_ASM(s32, "world/area_osr/osr_02/AB21D0", func_80240060_AB21D0);
extern s16 D_8024253C_AB46AC[];
ApiStatus func_80240060_AB21D0(Evt* script, s32 isInitialCall) {
Npc* npc;
if (isInitialCall) {
script->functionTemp[1] = 0.0f;
script->functionTempPtr[2] = get_npc_safe(script->owner2.npcID);
script->functionTemp[3] = D_8024253C_AB46AC[script->owner2.npcID - 2];
}
if (script->functionTemp[3] != 0) {
script->functionTemp[3]--;
return ApiStatus_BLOCK;
}
npc = script->functionTempPtr[2];
npc->verticalRenderOffset = sin_deg(script->functionTempF[1]) * 1.5f;
script->functionTempF[1] = clamp_angle(script->functionTempF[1] + 18.0f);
return ApiStatus_BLOCK;
}

View File

@ -39,7 +39,25 @@ ApiStatus func_80241274_D51264(Evt* script, s32 isInitialCall) {
#include "world/common/todo/UnkFunc44.inc.c"
INCLUDE_ASM(s32, "world/area_pra/pra_02/D50010", func_802414A8_D51498);
ApiStatus func_802414A8_D51498(Evt* script) {
Bytecode* args = script->ptrReadPos;
s32 entityIdx = 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++);
f32 temp = evt_get_float_variable(script, MapVar(0));
Entity* entity;
if (entityIdx == -1) {
return ApiStatus_DONE2;
}
entity = get_entity_by_index(entityIdx);
entity->position.x = x;
entity->position.y = y + temp;
entity->position.z = z;
return ApiStatus_DONE2;
}
#include "world/common/todo/RemovePadlock.inc.c"

View File

@ -1,7 +1,37 @@
#include "pra_03.h"
INCLUDE_ASM(s32, "world/area_pra/pra_03/D53CD0", func_80240020_D53CD0);
ApiStatus func_80240020_D53CD0(Evt* script, s32 isInitialCall) {
PlayerStatus* playerStatus = &gPlayerStatus;
INCLUDE_ASM(s32, "world/area_pra/pra_03/D53CD0", func_802400AC_D53D5C);
if (playerStatus->targetYaw >= 0.0f && playerStatus->targetYaw < 180.0f) {
script->varTable[0] = 150;
}
if (playerStatus->targetYaw >= 180.0f && playerStatus->targetYaw < 360.0f) {
script->varTable[0] = 95;
}
return ApiStatus_DONE2;
}
INCLUDE_ASM(s32, "world/area_pra/pra_03/D53CD0", func_80240138_D53DE8);
ApiStatus func_802400AC_D53D5C(Evt* script, s32 isInitialCall) {
PlayerStatus* playerStatus = &gPlayerStatus;
if (playerStatus->targetYaw >= 0.0f && playerStatus->targetYaw < 180.0f) {
script->varTable[0] = 165;
}
if (playerStatus->targetYaw >= 180.0f && playerStatus->targetYaw < 360.0f) {
script->varTable[0] = 70;
}
return ApiStatus_DONE2;
}
ApiStatus func_80240138_D53DE8(Evt* script, s32 isInitialCall) {
PlayerStatus* playerStatus = &gPlayerStatus;
if (playerStatus->lastGoodPosition.y == 0) {
evt_set_variable(script, MapVar(0), 0);
}
if (playerStatus->lastGoodPosition.y == -200) {
evt_set_variable(script, MapVar(0), 1);
}
return ApiStatus_BLOCK;
}

View File

@ -1,7 +1,37 @@
#include "pra_04.h"
INCLUDE_ASM(s32, "world/area_pra/pra_04/D546B0", func_80240020_D546B0);
ApiStatus func_80240020_D546B0(Evt* script, s32 isInitialCall) {
PlayerStatus* playerStatus = &gPlayerStatus;
INCLUDE_ASM(s32, "world/area_pra/pra_04/D546B0", func_802400AC_D5473C);
if (playerStatus->targetYaw >= 0.0f && playerStatus->targetYaw < 180.0f) {
script->varTable[0] = 150;
}
if (playerStatus->targetYaw >= 180.0f && playerStatus->targetYaw < 360.0f) {
script->varTable[0] = 95;
}
return ApiStatus_DONE2;
}
INCLUDE_ASM(s32, "world/area_pra/pra_04/D546B0", func_80240138_D547C8);
ApiStatus func_802400AC_D5473C(Evt* script, s32 isInitialCall) {
PlayerStatus* playerStatus = &gPlayerStatus;
if (playerStatus->targetYaw >= 0.0f && playerStatus->targetYaw < 180.0f) {
script->varTable[0] = 165;
}
if (playerStatus->targetYaw >= 180.0f && playerStatus->targetYaw < 360.0f) {
script->varTable[0] = 70;
}
return ApiStatus_DONE2;
}
ApiStatus func_80240138_D547C8(Evt* script, s32 isInitialCall) {
PlayerStatus* playerStatus = &gPlayerStatus;
if (playerStatus->lastGoodPosition.y == 0) {
evt_set_variable(script, MapVar(0), 0);
}
if (playerStatus->lastGoodPosition.y == -200) {
evt_set_variable(script, MapVar(0), 1);
}
return ApiStatus_BLOCK;
}

View File

@ -1,5 +1,12 @@
#include "pra_06.h"
INCLUDE_ASM(s32, "world/area_pra/pra_06/D57430", func_80240000_D57430);
ApiStatus func_80240000_D57430(void) {
gGameStatusPtr->playerSpriteSet = 1;
sprintf(wMapShapeName, "pra_05_shape");
sprintf(wMapHitName, "pra_05_hit");
return ApiStatus_BLOCK;
}
const char N(exit_str_0)[] = "pra_39";
#include "world/common/atomic/Reflection.inc.c"

View File

@ -1,4 +1,5 @@
#include "pra_09.h"
#include "effects.h"
#include "world/common/atomic/Reflection.inc.c"
@ -52,10 +53,78 @@ ApiStatus func_80241274_D59B04(Evt* script, s32 isInitialCall) {
return ApiStatus_DONE2;
}
INCLUDE_ASM(s32, "world/area_pra/pra_09/D588B0", func_80241310_D59BA0);
#include "world/common/todo/PlayBigSmokePuff.inc.c"
INCLUDE_ASM(s32, "world/area_pra/pra_09/D588B0", func_802413A4_D59C34);
ApiStatus func_802413A4_D59C34(Evt* script, s32 isInitialCall) {
EncounterStatus* currentEncounter = &gCurrentEncounter;
Bytecode* args = script->ptrReadPos;
Enemy* enemy = script->owner1.enemy;
s32 var_s1 = evt_get_variable(script, *args++) == 0;
Encounter* encounter;
INCLUDE_ASM(s32, "world/area_pra/pra_09/D588B0", func_802414F4_D59D84);
if (evt_get_variable(script, *args++) == 0) {
var_s1 += 1;
}
if (evt_get_variable(script, *args++) == 0) {
var_s1 += 1;
}
if (evt_get_variable(script, *args++) == 0) {
var_s1 += 1;
}
INCLUDE_ASM(s32, "world/area_pra/pra_09/D588B0", func_802415F8_D59E88);
switch (var_s1) {
case 1:
encounter = currentEncounter->encounterList[enemy->encounterIndex];
encounter->battle = 0x2101;
break;
case 2:
encounter = currentEncounter->encounterList[enemy->encounterIndex];
encounter->battle = 0x2102;
break;
case 3:
encounter = currentEncounter->encounterList[enemy->encounterIndex];
encounter->battle = 0x2103;
break;
case 4:
encounter = currentEncounter->encounterList[enemy->encounterIndex];
encounter->battle = 0x2104;
break;
}
return ApiStatus_DONE2;
}
ApiStatus func_802414F4_D59D84(Evt* script, s32 isInitialCall) {
Npc* npc = resolve_npc(script, script->varTable[0]);
if (isInitialCall) {
npc->pos.x = script->varTable[1];
npc->pos.y = script->varTable[2];
npc->pos.z = script->varTable[3];
npc->jumpVelocity = 0.0f;
npc->currentAnim = 0x30011;
npc->jumpScale = 0.8f;
}
npc->rotation.z -= 39.0f;
npc->rotation.x -= 33.0f;
npc->pos.y -= npc->jumpVelocity;
npc->jumpVelocity += npc->jumpScale;
if (npc->pos.y <= 0.0f) {
npc->pos.y = 0.0f;
npc->rotation.z = 0.0f;
npc->rotation.x = 0.0f;
npc->jumpVelocity = 0.0f;
npc->jumpScale = 0.0f;
npc->currentAnim = 0x30003;
return ApiStatus_DONE2;
}
return ApiStatus_BLOCK;
}
ApiStatus func_802415F8_D59E88(Evt* script, s32 isInitialCall) {
Npc* npc1 = resolve_npc(script, script->varTable[3]);
Npc* npc2 = resolve_npc(script, script->varTable[4]);
npc1->collisionRadius = npc2->collisionRadius;
npc1->collisionHeight = npc2->collisionHeight;
return ApiStatus_DONE2;
}

View File

@ -1,6 +1,13 @@
#include "pra_12.h"
INCLUDE_ASM(s32, "world/area_pra/pra_12/D62D10", func_80240000_D62D10);
ApiStatus func_80240000_D62D10(Evt* script, s32 isInitialCall) {
gGameStatusPtr->playerSpriteSet = 1;
sprintf(wMapShapeName, "pra_05_shape");
sprintf(wMapHitName, "pra_05_hit");
return ApiStatus_BLOCK;
}
const char N(exit_str_0)[] = "pra_10";
#include "world/common/atomic/Reflection.inc.c"

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