Most of player_api and 18F340 (#296)

* bss

* 3 audios

* d5a50 stuff

* some icon funcs

* get_icon_render_pos

* PlayerLandJump

* func_80248170

* cleanup

* splat update prep

* git subrepo pull --force tools/splat

subrepo:
  subdir:   "tools/splat"
  merged:   "81c4b35b89"
upstream:
  origin:   "https://github.com/ethteck/splat.git"
  branch:   "master"
  commit:   "81c4b35b89"
git-subrepo:
  version:  "0.4.3"
  origin:   "https://github.com/ingydotnet/git-subrepo.git"
  commit:   "2f68596"

* git subrepo pull tools/splat

subrepo:
  subdir:   "tools/splat"
  merged:   "9b791a654a"
upstream:
  origin:   "https://github.com/ethteck/splat.git"
  branch:   "master"
  commit:   "9b791a654a"
git-subrepo:
  version:  "0.4.3"
  origin:   "https://github.com/ingydotnet/git-subrepo.git"
  commit:   "2f68596"

* git subrepo pull tools/splat

subrepo:
  subdir:   "tools/splat"
  merged:   "2cf2a5e5d8"
upstream:
  origin:   "https://github.com/ethteck/splat.git"
  branch:   "master"
  commit:   "2cf2a5e5d8"
git-subrepo:
  version:  "0.4.3"
  origin:   "https://github.com/ingydotnet/git-subrepo.git"
  commit:   "2f68596"

* fix loop in PaperMarioNpcSprites

* git subrepo pull tools/splat

subrepo:
  subdir:   "tools/splat"
  merged:   "2fab217750"
upstream:
  origin:   "https://github.com/ethteck/splat.git"
  branch:   "master"
  commit:   "2fab217750"
git-subrepo:
  version:  "0.4.3"
  origin:   "https://github.com/ingydotnet/git-subrepo"
  commit:   "2f68596"

* add sha1 to yaml

* git subrepo pull tools/splat

subrepo:
  subdir:   "tools/splat"
  merged:   "426b08200d"
upstream:
  origin:   "https://github.com/ethteck/splat.git"
  branch:   "master"
  commit:   "426b08200d"
git-subrepo:
  version:  "0.4.3"
  origin:   "https://github.com/ingydotnet/git-subrepo"
  commit:   "2f68596"

* varTable -> union :( + player_api funcs

* 6 more

* 4 more

* 5 mo

* 1 mo

* 1 mo 2

* 5 mo

* player_jump

* 3 mo

* some 18F340

* 6 more

* 6 mo

* nm

* 1

* 1 more

* some PR feedback

* symbol addr update

* UnsetCamera0Flag1000

* SetPlayerSpriteSet2

* action 18

* encounter + a smol hammer

* git subrepo pull (merge) tools/splat

subrepo:
  subdir:   "tools/splat"
  merged:   "8cf482fe57"
upstream:
  origin:   "https://github.com/ethteck/splat.git"
  branch:   "master"
  commit:   "4c0a93eaed"
git-subrepo:
  version:  "0.4.3"
  origin:   "https://github.com/ingydotnet/git-subrepo"
  commit:   "2f68596"

* 3 and cleanup

* undo yucky union

* PR comments

* get_enemy_safe

* cleanup

* move VirtualEntity

* attempt to fix doxygen
This commit is contained in:
Ethan Roseman 2021-06-16 18:52:15 +09:00 committed by GitHub
parent e61e67ea9b
commit e9176cb08f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
195 changed files with 2207 additions and 4920 deletions

View File

@ -736,7 +736,7 @@ typedef struct BattleStatus {
/* 0x45B */ char unk_45B[5];
/* 0x460 */ s32 unk_460;
/* 0x464 */ s32 unk_464;
/* 0x468 */ char unk_468[4];
/* 0x468 */ s32 unk_468;
/* 0x46C */ s32 battleState; /* 0 = load assets, 1 = create actors, 4 = start scripts, 7 & 8 = unk */
/* 0x470 */ s32 unk_470;
/* 0x474 */ s32 unk_474;
@ -834,6 +834,19 @@ typedef struct AnimatedMesh {
typedef AnimatedMesh* AnimatedMeshList[MAX_ANIMATED_MESHES];
typedef struct EffectInstanceData {
/* 0x00 */ s32 unk_00;
/* 0x04 */ Vec3f pos;
/* 0x10 */ Vec3f rotation;
/* 0x1C */ Vec3f scale;
/* 0x28 */ char unk_28[0x4];
/* 0x2C */ s32 unk_2C;
/* 0x30 */ f32 unk_30;
/* 0x34 */ char unk_34[0x30];
/* 0x64 */ f32 unk_64;
/* 0x68 */ char unk_68[0x18];
} EffectInstanceData; // size = 0x80
typedef struct PrintHandle {
/* 0x000 */ char unk_00[16];
/* 0x010 */ s8* printbuf;
@ -929,7 +942,7 @@ typedef struct Effect {
/* 0x00 */ s32 flags;
/* 0x04 */ s32 effectIndex;
/* 0x08 */ s32 instanceCounter;
/* 0x0C */ s32 unk_0C; //? Maybe EffectInstanceData too ?
/* 0x0C */ EffectInstanceData* instanceData; //? Maybe EffectInstanceData too ?
/* 0x10 */ void (*update)(EffectInstance* effectInst);
/* 0x14 */ void (*renderWorld)(EffectInstance* effectInst);
/* 0x18 */ void (*unk_18)(EffectInstance* effectInst);
@ -1700,7 +1713,7 @@ typedef struct PlayerStatus {
/* 0x054 */ f32 currentSpeed;
/* 0x058 */ f32 walkSpeed;
/* 0x05C */ f32 runSpeed;
/* 0x060 */ char unk_60[4];
/* 0x060 */ s32 unk_60;
/* 0x064 */ f32 unk_64;
/* 0x068 */ f32 normalPitch;
/* 0x06C */ f32 unk_6C;
@ -1720,7 +1733,7 @@ typedef struct PlayerStatus {
/* 0x0B0 */ s16 colliderHeight;
/* 0x0B2 */ s16 colliderDiameter;
/* 0x0B4 */ s8 actionState;
/* 0x0B5 */ u8 prevActionState;
/* 0x0B5 */ s8 prevActionState;
/* 0x0B6 */ s8 fallState; ///< Also used as sleep state in Peach idle action
/* 0x0B7 */ char unk_B7;
/* 0x0B8 */ s32 anim;
@ -1778,7 +1791,7 @@ typedef struct EncounterStatus {
/* 0x01D */ s8 currentAreaIndex;
/* 0x01E */ u8 currentMapIndex;
/* 0x01F */ u8 currentEntryIndex;
/* 0x020 */ u8 mapID;
/* 0x020 */ s8 mapID;
/* 0x021 */ s8 resetMapEncounterFlags;
/* 0x021 */ char unk_22[2];
/* 0x024 */ s32* npcGroupList;
@ -1954,19 +1967,6 @@ typedef struct {
/* 0x11630 */ Matrix4s matrixStack[0x200];
} DisplayContext; // size = 0x19630
typedef struct EffectInstanceData {
/* 0x00 */ s32 unk_00;
/* 0x04 */ Vec3f pos;
/* 0x10 */ Vec3f rotation;
/* 0x1C */ Vec3f scale;
/* 0x28 */ char unk_28[0x4];
/* 0x2C */ s32 unk_2C;
/* 0x30 */ f32 unk_30;
/* 0x34 */ char unk_34[0x30];
/* 0x64 */ f32 unk_64;
/* 0x68 */ char unk_68[0x18];
} EffectInstanceData; // size = 0x80
typedef struct Temp8010F250 {
/* 0x00 */ s8 unk_00;
/* 0x01 */ s8 unk_01;
@ -2030,4 +2030,20 @@ typedef struct EntityModel {
typedef EntityModel* EntityModelList[MAX_ENTITY_MODELS];
typedef struct VirtualEntity {
/* 0x00 */ s32 entityModelIndex;
/* 0x04 */ Vec3f pos;
/* 0x10 */ Vec3f rot;
/* 0x1C */ Vec3f scale;
/* 0x28 */ Vec3f goalPos;
/* 0x34 */ f32 moveDist;
/* 0x38 */ f32 moveAngle;
/* 0x3C */ f32 moveSpeed;
/* 0x40 */ f32 jumpGravity;
/* 0x44 */ f32 jumpVelocity;
/* 0x48 */ f32 moveTime;
} VirtualEntity; // size = 0x4C
typedef VirtualEntity* VirtualEntityList[0x40];
#endif

View File

@ -49,11 +49,25 @@ void func_802666E4(Actor* actor, f32 arg1, f32 arg2, f32 arg3, s16);
void step_game_loop(void);
s32 resume_all_group(s32 groupFlags);
f32 length2D(f32 x, f32 y);
void input_to_move_vector(f32* angle, f32* magnitude);
void exec_ShakeCamX(s32 arg0, s32 arg1, s32 arg2, f32 arg3);
f32 func_800E5348(void);
void transform_point(Matrix4f mtx, f32, f32, f32, f32, f32*, f32*, f32*, f32*);
void draw_number(s32 value, s32 x, s32 y, s32 arg3, s32 palette, s32 opacity, s32 style);
void set_hud_element_scale(s32 index, f32 scale);
void set_entity_model_render_command_list(s32 idx, u32* commandList);
void set_entity_model_flags(s32 idx, s32 newFlags);
void clear_entity_model_flags(s32 idx, s32 newFlags);
void exec_entity_model_commandlist(s32 idx);
s32 load_entity_model(s32* cmdList);
f32 func_800E34D8(void);
f32 func_800E3514(f32, s32* colliderID);
s32 func_800E26C4(void);
void func_802667F0(s32, Actor*, f32, f32, f32);
void create_shadow_callback(Shadow* entity);
void func_802E10F4(Entity* entity);
void func_802E114C(void);
@ -310,6 +324,10 @@ void func_80070970(s32 arg0, f32 arg1, f32 arg2, f32 arg3, s32 arg4, s32 arg5);
void func_800709D0(s32 arg0, f32 arg1, f32 arg2, f32 arg3, f32 arg4, s32 arg5);
void func_80070130(s32 arg0, f32 arg1, f32 arg2, f32 arg3);
void func_800701F0(s32 arg0, f32 arg1, f32 arg2, f32 arg3);
void func_80070370(s32, f32, f32, f32, f32, s32, s32, s32);
void fx_sweat(s32, f32, f32, f32, f32, f32, s32);
void func_80070A30(s32, f32, f32, f32, f32, s32, EffectInstanceData**);
void func_80070EB0(s32, f32, f32, f32, f32, EffectInstanceData**);
void add_xz_vec3f(Vec3f* vector, f32 speed, f32 angleDeg);
void play_movement_dust_effects(s32 var0, f32 xPos, f32 yPos, f32 zPos, f32 angleDeg);
void fx_walk_large(s32, f32, f32, f32, f32);

View File

@ -250,6 +250,7 @@ extern UNK_TYPE D_800E92D8;
extern UNK_TYPE D_80147574;
extern UNK_TYPE D_80109270;
extern UNK_TYPE D_80108558;
extern s32 D_80108248;
extern s32 D_80108518;
extern s32 D_80108270;
@ -259,6 +260,20 @@ extern s32 D_801086AC;
extern s32 D_801083D8;
extern s32 D_80108068;
extern s32 D_80104BEC;
extern s32 D_8010C920;
extern s32 D_8010C940;
extern s32 D_8010C954;
extern s32 D_8010C958;
extern s32 D_8010C95C;
extern s32 D_8010C96C;
extern s32 D_8010C980;
extern s32 D_8010C9A0;
extern f32 D_800F7B40;
extern s32 D_800F7B44;
extern f32 D_8010C938;
extern f32 D_8010C990;
extern Temp8010EBB0 D_8010EBB0; // something with partners
extern Temp8010F250 D_8010F250; // sfx_play_sound state struct?
@ -339,7 +354,7 @@ extern s32 gCurrentDisplayContextIndex;
extern UNK_TYPE D_0A004350;
extern UNK_TYPE D_0A0026F0;
extern UNK_TYPE D_802EAE7C;
extern u32* D_802EAE7C;
extern s32 D_80291FA8[];
extern s32 D_80291FD0[];
@ -368,4 +383,9 @@ extern s32 D_803DA800;
// Dead code
extern PlayerStatus* dead_gPlayerStatusPtr;
extern s32 D_80108A64;
extern s32 bMarioIdleAnims[];
extern s32 bMarioDefendAnims[];
extern s32 bPeachIdleAnims[];
#endif

View File

@ -1,7 +1,7 @@
#include "common.h"
extern UNK_TYPE D_802EA728;
extern UNK_TYPE D_802EA760;
extern u32* D_802EA728;
extern u32* D_802EA760;
extern StaticEntityData D_802EA7BC;
extern UNK_TYPE D_802EB3C0;

View File

@ -1,6 +1,29 @@
#include "common.h"
INCLUDE_ASM(s32, "18F340", func_80260A60);
extern s32 D_80108AAC;
extern s32 D_80108AD4;
extern s32 D_8029FB90;
extern f32 D_8029FB94;
extern Effect* D_8029FB98;
extern Effect* D_8029FB9C;
extern HudElement* D_8029FBA0;
extern s16 D_8029FBA4;
extern s32 D_8029FBA8;
extern s32 D_8029FBAC;
extern s32 D_8029FBB0[];
void func_80260A60(void) {
BattleStatus* battleStatus = &gBattleStatus;
ActorPart* actorPart = &battleStatus->playerActor->partsTable[0];
if (battleStatus->flags2 & 0x40) {
actorPart->idleAnimations = &bPeachIdleAnims;
set_animation(0, 0, 0xA0002);
} else if (!battleStatus->outtaSightActive) {
actorPart->idleAnimations = &bMarioIdleAnims;
}
}
ApiStatus IsPartnerImmobile(ScriptInstance* script, s32 isInitialCall) {
BattleStatus* battleStatus = &gBattleStatus;
@ -20,9 +43,28 @@ ApiStatus IsPartnerImmobile(ScriptInstance* script, s32 isInitialCall) {
return ApiStatus_DONE2;
}
INCLUDE_ASM(s32, "18F340", activate_defend_command);
ApiStatus activate_defend_command(ScriptInstance* script, s32 isInitialCall) {
ActorPart* actorPart = &gBattleStatus.playerActor->partsTable[0];
INCLUDE_ASM(s32, "18F340", func_80260B70);
deduct_current_move_fp();
gBattleStatus.flags1 |= 0x400000;
actorPart->idleAnimations = &bMarioDefendAnims;
set_animation(0, 0, 0x10014);
return ApiStatus_DONE2;
}
ApiStatus func_80260B70(ScriptInstance* script, s32 isInitialCall) {
Actor* player = gBattleStatus.playerActor;
func_802667F0(2, player, player->currentPos.x, player->currentPos.y + 20.0f, player->currentPos.z);
sfx_play_sound(0x3FC);
script->varTable[0] = FALSE;
if (player->debuff == STATUS_FEAR || player->debuff == STATUS_DIZZY || player->debuff == STATUS_PARALYZE ||
player->debuff == STATUS_SLEEP ||player->debuff == STATUS_FROZEN || player->debuff == STATUS_STOP) {
script->varTable[0] = TRUE;
}
return ApiStatus_DONE2;
}
INCLUDE_ASM(s32, "18F340", func_80260BF4);
@ -60,17 +102,130 @@ ApiStatus func_80260E5C(ScriptInstance* script, s32 isInitialCall) {
return ApiStatus_DONE2;
}
INCLUDE_ASM(s32, "18F340", func_80260E90);
#define NAMESPACE base
ApiStatus N(GiveRefund)(ScriptInstance* script, s32 isInitialCall) {
BattleStatus* battleStatus = &gBattleStatus;
Actor* player = battleStatus->playerActor;
s32 sellValue = gItemTable[battleStatus->selectedItemID].sellValue;
f32 facingAngleSign = 0.0f;
s32 sleepTime = 0;
f32 posX, posY, posZ;
posY = player->currentPos.y + player->size.y;
INCLUDE_ASM(s32, "18F340", func_80261064);
if (heroes_is_ability_active(player, ABILITY_REFUND) && sellValue > 0) {
s32 i;
s32 iconPosX, iconPosY, iconPosZ;
INCLUDE_ASM(s32, "18F340", func_802610CC);
sellValue = (sellValue * 75 + 99) / 100;
INCLUDE_ASM(s32, "18F340", func_80261164);
for (i = 0; i < sellValue; i++) {
posX = player->currentPos.x;
posZ = player->currentPos.z;
INCLUDE_ASM(s32, "18F340", func_802611E8);
make_item_entity(ITEM_COIN, posX, posY, posZ, 0x17, (i * 3) + 1, facingAngleSign, 0);
add_coins(1);
facingAngleSign += 30.0f;
}
sleepTime = (i * 3) + 30;
posX = player->currentPos.x;
posY = player->currentPos.y;
posZ = player->currentPos.z;
get_screen_coords(gCurrentCameraID, posX, posY, posZ, &iconPosX, &iconPosY, &iconPosZ);
D_8029FBA0 = create_icon(&D_80108A64);
set_icon_render_pos(D_8029FBA0, iconPosX + 36, iconPosY - 63);
}
script->varTable[0] = sleepTime;
return ApiStatus_DONE2;
}
ApiStatus N(GiveRefundCleanup)(ScriptInstance* script, s32 isInitialCall) {
s32 sellValue = gItemTable[gBattleStatus.selectedItemID].sellValue;
if (heroes_is_ability_active(gBattleStatus.playerActor, ABILITY_REFUND) && sellValue > 0) {
free_icon(D_8029FBA0);
}
return ApiStatus_DONE2;
}
ApiStatus func_802610CC(ScriptInstance* script, s32 isInitialCall) {
if (isInitialCall) {
func_8011D82C(1);
*D_801512F0 = 1;
set_background_color_blend(0, 0, 0, 0);
script->functionTemp[0].s = 20;
}
set_background_color_blend(0, 0, 0, ((20 - script->functionTemp[0].s) * 12) & 0xFC);
script->functionTemp[0].s -= 1;
do {} while(0); // TODO required to match
return (script->functionTemp[0].s == 0) * ApiStatus_DONE2;
}
ApiStatus func_80261164(ScriptInstance* script, s32 isInitialCall) {
if (isInitialCall) {
script->functionTemp[0].s = 20;
unfreeze_cam();
}
set_background_color_blend(0, 0, 0, (script->functionTemp[0].s * 12) & 0xFC);
script->functionTemp[0].s -= 1;
if (script->functionTemp[0].s == 0) {
set_background_color_blend(0, 0, 0, 0);
return ApiStatus_DONE2;
}
return ApiStatus_BLOCK;
}
ApiStatus func_802611E8(ScriptInstance *script, s32 isInitialCall) {
PlayerData* playerData = &gPlayerData;
StaticItem* item = &gItemTable[0x95];
playerData->curHP += item->potencyA;
if (playerData->curMaxHP < playerData->curHP) {
playerData->curHP = playerData->curMaxHP;
}
playerData->invItems[find_item(0x95)] = ITEM_NONE;
sort_items();
script->varTable[3] = item->potencyA;
return ApiStatus_DONE2;
}
// TODO something wrong with the struct breakdown for BattleStatus
#ifdef NON_MATCHING
ApiStatus func_8026127C(ScriptInstance* script, s32 isInitialCall) {
PlayerData* playerData = &gPlayerData;
BattleStatus* battleStatus = &gBattleStatus;
battleStatus->dangerFlags = 0;
gBattleState = battleStatus->unk_474;
battleStatus->battleState = battleStatus->unk_468;
battleStatus->flags1 |= 8;
battleStatus->flags2 &= ~0x8000000;
if (!(battleStatus->flags2 & 0x40)) {
if (playerData->curHP <= 1 && is_ability_active(ABILITY_MEGA_RUSH)) {
battleStatus->flags2 |= 0x8000000;
gBattleStatus.dangerFlags |= 1;
}
if (playerData->curHP <= 5 && is_ability_active(ABILITY_POWER_RUSH) && !(battleStatus->dangerFlags & 1)) {
battleStatus->flags2 |= 0x8000000;
gBattleStatus.dangerFlags |= 2;
}
}
return ApiStatus_DONE2;
}
#else
INCLUDE_ASM(s32, "18F340", func_8026127C);
#endif
ApiStatus func_80261388(ScriptInstance* script, s32 isInitialCall) {
s32 partnerActorExists = gBattleStatus.partnerActor != NULL;
@ -87,21 +242,146 @@ ApiStatus func_802613A8(ScriptInstance* script, s32 isInitialCall) {
return ApiStatus_DONE2;
}
INCLUDE_ASM(s32, "18F340", func_802613BC);
ApiStatus func_802613BC(ScriptInstance* script, s32 isInitialCall) {
Bytecode* args = script->ptrReadPos;
s32 var1 = get_variable(script, *args++);
s32 var2 = get_variable(script, *args++);
s32 var3 = get_variable(script, *args++);
INCLUDE_ASM(s32, "18F340", func_80261478);
func_800720B0(6, var1, var2 + 15, var3, 1.2f, 30);
return ApiStatus_DONE2;
}
INCLUDE_ASM(s32, "18F340", func_80261530);
ApiStatus func_80261478(ScriptInstance* script, s32 isInitialCall) {
Bytecode* args = script->ptrReadPos;
s32 var1 = get_variable(script, *args++);
s32 var2 = get_variable(script, *args++);
s32 var3 = get_variable(script, *args++);
INCLUDE_ASM(s32, "18F340", func_802615C8);
func_80071750(9, var1, var2 + 15, var3, 5.0f, 15);
return ApiStatus_DONE2;
}
INCLUDE_ASM(s32, "18F340", func_80261648);
ApiStatus func_80261530(ScriptInstance* script, s32 isInitialCall) {
if (isInitialCall) {
func_8011D82C(1);
*D_801512F0 = 1;
set_background_color_blend(0, 0, 0, 0);
script->functionTemp[0].s = 25;
}
INCLUDE_ASM(s32, "18F340", func_802616B4);
set_background_color_blend(0, 0, 0, ((25 - script->functionTemp[0].s) * 10) & 0xFE);
INCLUDE_ASM(s32, "18F340", func_802616F4);
script->functionTemp[0].s--;
do {} while(0); // TODO required to match
return (script->functionTemp[0].s == 0) * ApiStatus_DONE2;
}
INCLUDE_ASM(s32, "18F340", func_802619B4);
ApiStatus func_802615C8(ScriptInstance* script, s32 isInitialCall) {
if (isInitialCall) {
script->functionTemp[0].s = 25;
}
set_background_color_blend(0, 0, 0, (script->functionTemp[0].s * 10) & 0xFF);
script->functionTemp[0].s -= 5;
if (script->functionTemp[0].s == 0) {
set_background_color_blend(0, 0, 0, 0);
return ApiStatus_DONE2;
}
return ApiStatus_BLOCK;
}
ApiStatus func_80261648(ScriptInstance* script, s32 isInitialCall) {
Npc* merlee = get_npc_unsafe(NPC_BTL_MERLEE);
if (isInitialCall) {
sfx_play_sound(0x24B);
merlee->alpha = 0;
}
merlee->alpha += 17;
if (merlee->alpha >= 0xFF) {
merlee->alpha = 0xFF;
return ApiStatus_DONE1;
}
return ApiStatus_BLOCK;
}
ApiStatus func_802616B4(ScriptInstance* script, s32 isInitialCall) {
Npc* merlee = get_npc_unsafe(NPC_BTL_MERLEE);
merlee->alpha -= 17;
if (merlee->alpha == 0) {
merlee->alpha = 0;
return ApiStatus_DONE1;
}
return ApiStatus_BLOCK;
}
ApiStatus func_802616F4(ScriptInstance* script, s32 isInitialCall) {
Npc* merlee = get_npc_unsafe(NPC_BTL_MERLEE);
EffectInstanceData* effectInstanceData;
if (isInitialCall) {
script->functionTemp[1].s = 0;
D_8029FB94 = merlee->pos.y;
D_8029FB98 = func_80071750(0, merlee->pos.x, merlee->pos.y, merlee->pos.z, 0.4f, 0);
D_8029FB9C = func_80071750(3, merlee->pos.x, merlee->pos.y, merlee->pos.z, 0.00001f, 0);
D_8029FBA4 = 0;
D_8029FB90 = 12;
sfx_play_sound(0x2074);
}
merlee->pos.y = D_8029FB94 + (sin_rad((script->functionTemp[1].s * TAU) / 360.0f) * 3.0f);
script->functionTemp[1].s += 10;
script->functionTemp[1].s = clamp_angle(script->functionTemp[1].s);
effectInstanceData = D_8029FB98->instanceData;
effectInstanceData->pos.x = merlee->pos.x;
effectInstanceData->pos.y = merlee->pos.y + 16.0f;
effectInstanceData->pos.z = merlee->pos.z;
effectInstanceData = D_8029FB9C->instanceData;
effectInstanceData->pos.x = merlee->pos.x;
effectInstanceData->pos.y = merlee->pos.y + 16.0f;
effectInstanceData->pos.z = merlee->pos.z + 5.0f;
if (D_8029FBA4 == 2) {
D_8029FB98->instanceData->unk_30 = 0.00001f;
D_8029FB9C->instanceData->unk_30 = 0.00001f;
D_8029FB98->flags |= 0x10;
D_8029FB9C->flags |= 0x10;
return ApiStatus_DONE1;
}
if (D_8029FBA4 == 1) {
effectInstanceData = D_8029FB98->instanceData;
effectInstanceData->unk_30 += 0.35;
if (effectInstanceData->unk_30 > 3.5) {
effectInstanceData->unk_30 = 3.5f;
}
if (D_8029FB90 != 0) {
D_8029FB90--;
} else {
effectInstanceData = D_8029FB9C->instanceData;
effectInstanceData->unk_30 += 0.5;
if (effectInstanceData->unk_30 > 5.0) {
D_8029FBA4 = 2;
}
}
}
return ApiStatus_BLOCK;
}
ApiStatus func_802619B4(ScriptInstance* script, s32 isInitialCall) {
D_8029FBA4 = 1;
return ApiStatus_DONE2;
}
ApiStatus HasMerleeCastsLeft(ScriptInstance* script, s32 isInitialCall) {
PlayerData* playerData = &gPlayerData;
@ -113,13 +393,64 @@ ApiStatus HasMerleeCastsLeft(ScriptInstance* script, s32 isInitialCall) {
return ApiStatus_DONE2;
}
INCLUDE_ASM(s32, "18F340", func_802619E8);
ApiStatus func_802619E8(ScriptInstance* script, s32 isInitialCall) {
Bytecode* args = script->ptrReadPos;
s32 x = get_variable(script, *args++);
s32 y = get_variable(script, *args++);
s32 z = get_variable(script, *args++);
s32 screenX;
s32 screenY;
s32 screenZ;
INCLUDE_ASM(s32, "18F340", func_80261B40);
get_screen_coords(gCurrentCameraID, x, y, z, &screenX, &screenY, &screenZ);
INCLUDE_ASM(s32, "18F340", FXRecoverHP);
screenX += 30;
screenY -= 19;
INCLUDE_ASM(s32, "18F340", FXRecoverFP);
if (script->varTable[10] > 0) {
D_8029FBAC = create_icon(&D_80108AD4);
set_icon_render_pos(D_8029FBAC, screenX, screenY);
screenY += 9;
}
if (script->varTable[11] > 0 || script->varTable[12] > 0) {
D_8029FBA8 = create_icon(&D_80108AAC);
set_icon_render_pos(D_8029FBA8, screenX, screenY);
}
return ApiStatus_DONE2;
}
ApiStatus func_80261B40(ScriptInstance* script, s32 isInitialCall) {
if (script->varTable[10] > 0) {
free_icon(D_8029FBAC);
}
if (script->varTable[11] > 0 || script->varTable[12] > 0) {
free_icon(D_8029FBA8);
}
return ApiStatus_DONE2;
}
ApiStatus FXRecoverHP(ScriptInstance* script, s32 isInitialCall) {
Bytecode* args = script->ptrReadPos;
s32 var1 = get_variable(script, *args++);
s32 var2 = get_variable(script, *args++);
s32 var3 = get_variable(script, *args++);
s32 var4 = get_variable(script, *args++);
func_80071090(0, var1, var2, var3, var4);
return ApiStatus_DONE2;
}
ApiStatus FXRecoverFP(ScriptInstance* script, s32 isInitialCall) {
Bytecode* args = script->ptrReadPos;
s32 var1 = get_variable(script, *args++);
s32 var2 = get_variable(script, *args++);
s32 var3 = get_variable(script, *args++);
s32 var4 = get_variable(script, *args++);
func_80071090(1, var1, var2, var3, var4);
return ApiStatus_DONE2;
}
ApiStatus IncrementPlayerHP(ScriptInstance* script, s32 isInitialCall) {
PlayerData* playerData = &gPlayerData;
@ -157,6 +488,53 @@ ApiStatus func_80261DD4(ScriptInstance* script, s32 isInitialCall) {
INCLUDE_ASM(s32, "18F340", func_80261DF4);
INCLUDE_ASM(s32, "18F340", func_80261FB4);
ApiStatus func_80261FB4(ScriptInstance* script, s32 isInitialCall) {
ItemEntity* item = get_item_entity(script->varTable[10]);
Actor* player = gBattleStatus.playerActor;
s32 ft1;
f32 deltaX;
f32 deltaY;
f32 deltaZ;
INCLUDE_ASM(s32, "18F340", func_802620F8);
if (isInitialCall) {
script->functionTemp[0].s = 0;
script->functionTemp[1].s = 10;
}
switch (script->functionTemp[0].s) {
case 0:
ft1 = script->functionTemp[1].s;
deltaX = player->currentPos.x - item->position.x;
deltaY = player->currentPos.y + 12.0f - item->position.y;
deltaZ = player->currentPos.z - 5.0f - item->position.z;
item->position.x += deltaX / ft1;
item->position.y += deltaY / ft1;
item->position.z += deltaZ / ft1;
item->position.y += dist2D(item->position.x, item->position.y, player->currentPos.x,
player->currentPos.y + 12.0f) / 5.0f;
if (script->functionTemp[1].s == 1) {
script->functionTemp[0].s = script->functionTemp[1].s;
}
script->functionTemp[1].s--;
break;
case 1:
return ApiStatus_DONE2;
}
return ApiStatus_BLOCK;
}
ApiStatus func_802620F8(ScriptInstance* script, s32 isInitialCall) {
// TODO get type correct
s32* temp_v1 = &D_8029FBB0[script->varTable[14]];
if (*temp_v1 != 0) {
(*temp_v1)--;
return ApiStatus_BLOCK;
}
return ApiStatus_DONE2;
}

View File

@ -1288,7 +1288,7 @@ INCLUDE_ASM(s32, "190B20", func_80266684);
INCLUDE_ASM(void, "190B20", func_802666E4, Actor* actor, f32 arg1, f32 arg2, f32 arg3, s16 arg4);
INCLUDE_ASM(s32, "190B20", func_802667F0);
INCLUDE_ASM(void, "190B20", func_802667F0, s32 arg0, Actor* arg1, f32 arg2, f32 arg3, f32 arg4);
INCLUDE_ASM(s32, "190B20", func_80266970);

View File

@ -63,7 +63,7 @@ INCLUDE_ASM(s32, "4ac90_len_3910", func_800702B0);
INCLUDE_ASM(s32, "4ac90_len_3910", func_80070310);
INCLUDE_ASM(s32, "4ac90_len_3910", func_80070370);
INCLUDE_ASM(void, "4ac90_len_3910", func_80070370, s32 arg0, f32 arg1, f32 arg2, f32 arg3, f32 arg4, s32 arg5, s32 arg6, s32 arg7);
INCLUDE_ASM(s32, "4ac90_len_3910", func_800703D0);
@ -86,7 +86,7 @@ INCLUDE_ASM(void, "4ac90_len_3910", func_800706D0, s32 arg0, f32 arg1, f32 arg2,
INCLUDE_ASM(s32, "4ac90_len_3910", func_80070730);
INCLUDE_ASM(s32, "4ac90_len_3910", fx_sweat);
INCLUDE_ASM(void, "4ac90_len_3910", fx_sweat, s32 arg0, f32 arg1, f32 arg2, f32 arg3, f32 arg4, f32 arg5, s32 arg6);
INCLUDE_ASM(s32, "4ac90_len_3910", fx_sleep_bubble);
@ -100,7 +100,7 @@ INCLUDE_ASM(void, "4ac90_len_3910", func_80070970, s32 arg0, f32 arg1, f32 arg2,
INCLUDE_ASM(void, "4ac90_len_3910", func_800709D0, s32 arg0, f32 arg1, f32 arg2, f32 arg3, f32 arg4, s32 arg5);
INCLUDE_ASM(s32, "4ac90_len_3910", func_80070A30);
INCLUDE_ASM(void, "4ac90_len_3910", func_80070A30, s32 arg0, f32 arg1, f32 arg2, f32 arg3, f32 arg4, s32 arg5, EffectInstanceData** arg6);
INCLUDE_ASM(void, "4ac90_len_3910", func_80070A90, s32 arg0, f32 arg1, f32 arg2, f32 arg3);
@ -124,7 +124,7 @@ INCLUDE_ASM(s32, "4ac90_len_3910", func_80070DF0);
INCLUDE_ASM(s32, "4ac90_len_3910", func_80070E50);
INCLUDE_ASM(s32, "4ac90_len_3910", func_80070EB0);
INCLUDE_ASM(void, "4ac90_len_3910", func_80070EB0, s32 arg0, f32 arg1, f32 arg2, f32 arg3, f32 arg4, EffectInstanceData** arg5);
INCLUDE_ASM(s32, "4ac90_len_3910", func_80070F10);

View File

@ -1,18 +1,5 @@
#include "common.h"
extern s32 D_8010C920;
extern s32 D_8010C940;
extern s32 D_8010C954;
extern s32 D_8010C958;
extern s32 D_8010C95C;
extern s32 D_8010C96C;
extern s32 D_8010C980;
extern s32 D_8010C9A0;
extern s32 D_800F7B40;
extern s32 D_800F7B44;
extern s32 D_8010C938;
extern s32 D_8010C990;
void update_player_input(void) {
PlayerStatus* playerStatus = &gPlayerStatus;
s32 inputBufPos = playerStatus->inputBufPos;
@ -68,7 +55,7 @@ void func_800E205C(void) {
D_800F7B40 = 0;
D_800F7B44 = 0;
D_8010C938 = 0;
D_8010C990 = 0;
D_8010C990 = 0.0f;
playerStatus->unk_0D = 1;
playerStatus->renderMode = 0xD;

View File

@ -1,9 +1,6 @@
#include "common.h"
#include "world/partners.h"
f32 func_800E34D8(void);
f32 func_800E3514(f32, s32* colliderID);
extern s32 D_8010C96C; // npc list index
extern s16 D_8010C9B0;
@ -22,16 +19,16 @@ s32 func_800E26C4(void) {
actionState == ACTION_STATE_USE_TWEESTER ||
actionState == ACTION_STATE_SPIN
) {
return 1;
return TRUE;
}
if (actionState == ACTION_STATE_RIDE) {
if (playerData->currentPartner == PARTNER_LAKILESTER || playerData->currentPartner == PARTNER_BOW) {
if (temp_8010EBB0->unk_00 != 0) {
return 1;
return TRUE;
} else {
gPlayerStatusPtr->animFlags |= 4;
return 0;
return FALSE;
}
} else {
if (temp_8010EBB0->unk_03 == 6 || temp_8010EBB0->unk_03 == 7) {
@ -39,11 +36,11 @@ s32 func_800E26C4(void) {
}
if (temp_8010EBB0->unk_03 == 4) {
gPlayerStatusPtr->animFlags |= 4;
return 0;
return FALSE;
}
}
}
return 0;
return FALSE;
}
void set_action_state(s32 actionState);
@ -317,7 +314,7 @@ INCLUDE_ASM(s32, "7bb60_len_41b0", func_800E5174);
INCLUDE_ASM(s32, "7bb60_len_41b0", can_player_interact);
INCLUDE_ASM(s32, "7bb60_len_41b0", func_800E5348);
INCLUDE_ASM(f32, "7bb60_len_41b0", func_800E5348, void);
void func_800E546C(void) {
f32 angle = 0.0f;

View File

@ -804,9 +804,9 @@ s32 is_player_action_state(ActionState actionState) {
return actionState == gPlayerActionState;
}
void func_80110BCC(Entity* entity) {
void func_80110BCC(Entity* entity, u32* commandList) {
if (!(entity->flags & 8)) {
set_entity_model_render_command_list(entity->virtualModelIndex);
set_entity_model_render_command_list(entity->virtualModelIndex, commandList);
}
}

View File

@ -1,6 +1,5 @@
#include "coconut.h"
void* D_80108A64; // an image
static HudElement* D_802A1E80;
// Returns time to sleep for on $x.

View File

@ -1,6 +1,5 @@
#include "dizzy_dial.h"
extern s32 D_80108A64;
static s32* D_802A1CD0;
static HudElement* D_802A1CD4;

View File

@ -1,6 +1,5 @@
#include "dried_shroom.h"
extern s32 D_80108A64;
static HudElement* D_802A1A90;
ApiStatus N(GiveRefund)(ScriptInstance* script, s32 isInitialCall) {

View File

@ -1,6 +1,5 @@
#include "dusty_hammer.h"
extern s32 D_80108A64;
static HudElement* D_802A1E80;
ApiStatus N(GiveRefund)(ScriptInstance* script, s32 isInitialCall) {

View File

@ -1,6 +1,5 @@
#include "egg_missile.h"
extern s32 D_80108A64;
static HudElement* D_802A2890;
ApiStatus N(GiveRefund)(ScriptInstance* script, s32 isInitialCall) {

View File

@ -1,6 +1,5 @@
#include "electro_pop.h"
extern s32 D_80108A64;
static HudElement* D_802A1D60;
ApiStatus N(GiveRefund)(ScriptInstance* script, s32 isInitialCall) {

View File

@ -1,6 +1,5 @@
#include "fire_flower.h"
extern s32 D_80108A64;
static HudElement* D_802A1D70;
ApiStatus N(GiveRefund)(ScriptInstance* script, s32 isInitialCall) {

View File

@ -1,6 +1,5 @@
#include "food.h"
extern s32 D_80108A64;
static HudElement* D_802A24D0;
ApiStatus N(GiveRefund)(ScriptInstance* script, s32 isInitialCall) {

View File

@ -1,6 +1,5 @@
#include "fright_jar.h"
extern s32 D_80108A64;
static HudElement* D_802A1CA0;
ApiStatus N(GiveRefund)(ScriptInstance* script, s32 isInitialCall) {

View File

@ -1,6 +1,5 @@
#include "hustle_drink.h"
extern s32 D_80108A64;
static HudElement* D_802A1E70;
ApiStatus N(GiveRefund)(ScriptInstance* script, s32 isInitialCall) {

View File

@ -1,6 +1,5 @@
#include "insecticide_herb.h"
extern s32 D_80108A64;
static HudElement* D_802A21C0;
ApiStatus N(GiveRefund)(ScriptInstance* script, s32 isInitialCall) {

View File

@ -1,6 +1,5 @@
#include "life_shroom.h"
extern s32 D_80108A64;
static HudElement* D_802A21F0;
ApiStatus N(GiveRefund)(ScriptInstance* script, s32 isInitialCall) {

View File

@ -1,6 +1,5 @@
#include "mushroom.h"
extern s32 D_80108A64;
static HudElement* D_802A2410;
ApiStatus N(GiveRefund)(ScriptInstance* script, s32 isInitialCall) {

View File

@ -1,6 +1,5 @@
#include "mystery.h"
extern s32 D_80108A64;
static HudElement* D_802A25C0;
ApiStatus N(GiveRefund)(ScriptInstance* script, s32 isInitialCall) {

View File

@ -1,6 +1,5 @@
#include "pebble.h"
extern s32 D_80108A64;
static HudElement* D_802A1E80;
ApiStatus N(GiveRefund)(ScriptInstance* script, s32 isInitialCall) {

View File

@ -1,6 +1,5 @@
#include "please_come_back.h"
extern s32 D_80108A64;
static HudElement* D_802A18E0;
ApiStatus N(GiveRefund)(ScriptInstance* script, s32 isInitialCall) {

View File

@ -1,6 +1,5 @@
#include "pow_block.h"
extern s32 D_80108A64;
static HudElement* D_802A2120;
ApiStatus N(GiveRefund)(ScriptInstance* script, s32 isInitialCall) {

View File

@ -1,6 +1,5 @@
#include "repel_gel.h"
extern s32 D_80108A64;
static HudElement* D_802A19C0;
ApiStatus N(GiveRefund)(ScriptInstance* script, s32 isInitialCall) {

View File

@ -1,6 +1,5 @@
#include "shooting_star.h"
extern s32 D_80108A64;
static HudElement* D_802A1EE0;
ApiStatus N(GiveRefund)(ScriptInstance* script, s32 isInitialCall) {

View File

@ -1,6 +1,5 @@
#include "sleepy_sheep.h"
extern s32 D_80108A64;
static HudElement* D_802A3F50;
ApiStatus N(GiveRefund)(ScriptInstance* script, s32 isInitialCall) {

View File

@ -1,6 +1,5 @@
#include "snowman_doll.h"
extern s32 D_80108A64;
static HudElement* D_802A1EB0;
ApiStatus N(GiveRefund)(ScriptInstance* script, s32 isInitialCall) {

View File

@ -1,6 +1,5 @@
#include "stone_cap.h"
extern s32 D_80108A64;
static HudElement* D_802A1A60;
ApiStatus N(GiveRefund)(ScriptInstance* script, s32 isInitialCall) {

View File

@ -1,6 +1,5 @@
#include "stop_watch.h"
extern s32 D_80108A64;
static HudElement* D_802A1B40;
ApiStatus N(GiveRefund)(ScriptInstance* script, s32 isInitialCall) {

View File

@ -1,6 +1,5 @@
#include "strange_cake.h"
extern s32 D_80108A64;
static HudElement* D_802A2DD0;
ApiStatus N(GiveRefund)(ScriptInstance* script, s32 isInitialCall) {

View File

@ -1,6 +1,5 @@
#include "super_soda.h"
extern s32 D_80108A64;
static HudElement* D_802A2280;
ApiStatus N(GiveRefund)(ScriptInstance* script, s32 isInitialCall) {

View File

@ -1,6 +1,5 @@
#include "tasty_tonic.h"
extern s32 D_80108A64;
static HudElement* D_802A1B40;
ApiStatus N(GiveRefund)(ScriptInstance* script, s32 isInitialCall) {

View File

@ -1,6 +1,5 @@
#include "thunder_bolt.h"
extern s32 D_80108A64;
static HudElement* D_802A1C40;
ApiStatus N(GiveRefund)(ScriptInstance* script, s32 isInitialCall) {

View File

@ -1,6 +1,5 @@
#include "thunder_rage.h"
extern s32 D_80108A64;
static HudElement* D_802A1C90;
ApiStatus N(GiveRefund)(ScriptInstance* script, s32 isInitialCall) {

View File

@ -1,6 +1,5 @@
#include "ultra_shroom.h"
extern s32 D_80108A64;
static HudElement* D_802A1AC0;
ApiStatus N(GiveRefund)(ScriptInstance* script, s32 isInitialCall) {

View File

@ -1,6 +1,5 @@
#include "unknown_item.h"
extern s32 D_80108A64;
static HudElement* D_802A1AA0;
ApiStatus N(GiveRefund)(ScriptInstance* script, s32 isInitialCall) {

View File

@ -1,6 +1,5 @@
#include "volt_shroom.h"
extern s32 D_80108A64;
static HudElement* D_802A19B0;
ApiStatus N(GiveRefund)(ScriptInstance* script, s32 isInitialCall) {

File diff suppressed because it is too large Load Diff

View File

@ -759,10 +759,7 @@ INCLUDE_ASM(s32, "npc", func_8003B44C);
INCLUDE_ASM(s32, "npc", func_8003B464);
#ifdef NON_MATCHING
// Rodata issues.
void func_8003B47C(Npc* npc, s32 arg1, s32 arg2) {
switch (npc->unk_B4) {
case 0:
func_8003B500(npc, arg1, arg2);
@ -781,18 +778,15 @@ void func_8003B47C(Npc* npc, s32 arg1, s32 arg2) {
break;
}
}
#else
INCLUDE_ASM(void, "npc", func_8003B47C, Npc* npc, s32 arg1, s32 arg2);
#endif
void func_8003B500(Npc* npc, s32 arg1, s32 arg2) {
if (npc->unk_B6 != 0) {
npc->screenSpaceOffset2D[0] = 0.0f;
npc->screenSpaceOffset2D[1] = 0.0f;
npc->unk_B6 = 0;
npc->verticalStretch = 1.0f;
}
if (!(npc->flags & NPC_FLAG_NO_ANIMS_LOADED)) {
s32 temp_a2 = (npc->alpha * npc->alpha2 / 255);
s32 temp = temp_a2 < 255; // TODO: better match?
@ -899,11 +893,6 @@ void func_8003C658(Npc* npc, s32 idx) {
void func_8003C660(Npc* npc, s32 idx) {
}
void fx_sweat(s32, f32, f32, f32, f32, f32, s32);
void func_80070A30(s32, f32, f32, f32, f32, s32, EffectInstanceData**);
void func_80070EB0(s32, f32, f32, f32, f32, EffectInstanceData**);
void func_8003C668(Npc* npc, s32 idx) {
EffectInstanceData* instanceData;
@ -1114,7 +1103,43 @@ Npc* npc_find_near_simple(f32 x, f32 y, f32 z, f32 radius) {
return closestNpc;
}
// Needs work
#ifdef NON_MATCHING
s32 func_8003D1D4(s32 arg0) {
s32 entityIndex = (arg0 | 0x4000);
s32 yTemp = get_entity_by_index(entityIndex)->position.y - 10.0f;
s32 i;
for (i = 0; i < ARRAY_COUNT(*gCurrentNpcListPtr); i++) {
Npc* npc = (*gCurrentNpcListPtr)[i];
if (npc != NULL && npc->flags != 0) {
if (!(npc->flags & (0x80000000 | 0x4))) {
if (!(npc->pos.y < yTemp)) {
s32 temp_v0;
if (npc->flags & 0x8008) {
temp_v0 = func_8003D2F8(npc);
if (temp_v0 != 0) {
if (entityIndex == temp_v0) {
return i;
}
}
} else if (npc->unk_84 & 0x4000) {
if (entityIndex == npc->unk_84) {
return i;
}
}
}
}
}
}
return -1;
}
#else
INCLUDE_ASM(s32, "npc", func_8003D1D4);
#endif
s32 func_8003D2F8(Npc* npc) {
f32 x;
@ -1279,12 +1304,13 @@ void func_8003D788(Npc* npc, s32 arg1) {
f32 x = npc->pos.x;
f32 y = npc->pos.y + 0.0f;
f32 z = npc->pos.z;
if (phi_a2 == 0) {
fx_walk_large(0, x, y, z, D_80077C10);
D_80077C10 = clamp_angle(D_80077C10 + 35.0f);
return;
}
} else {
func_80072350(3, x, y, z, 13.0f, 10.0f, 1.0f, 5, 30);
}
} else if (arg1 != 0) {
if (D_80077C14++ >= 4) {
D_80077C14 = 0;
@ -1698,8 +1724,6 @@ Enemy* get_enemy(s32 npcID) {
PANIC();
}
#ifdef NON_MATCHING
// Matching, but having a TU padding issue
Enemy* get_enemy_safe(s32 npcID) {
EncounterStatus* currentEncounterStatus = &gCurrentEncounter;
s32 i;
@ -1707,6 +1731,7 @@ Enemy* get_enemy_safe(s32 npcID) {
for (i = 0; i < currentEncounterStatus->numEncounters; i++) {
Encounter* currentEncounter = currentEncounterStatus->encounterList[i];
if (currentEncounter != NULL) {
for (j = 0; j < currentEncounter->count; j++) {
Enemy* currentEnemy = currentEncounter->enemy[j];
@ -1718,6 +1743,3 @@ Enemy* get_enemy_safe(s32 npcID) {
}
return NULL;
}
#else
INCLUDE_ASM(Enemy*, "npc", get_enemy_safe, s32 npcID);
#endif

View File

@ -1,7 +1,96 @@
#include "common.h"
#include "world/actions.h"
INCLUDE_ASM(s32, "world/action/18", func_802B6000_E245D0);
s32 D_802B6300_E248D0[] = {
0x000A0002, 0x000A002B, 0x000A002D, 0x000A002F, 0x000A0031, 0x000A0033, 0x000A0035, 0x000A0037, 0x000A0039,
0x000A003B, 0x000A003D, 0x000A003F, 0x000A0041, 0x000A0043, 0x000A0045, 0x000A0047, 0x000A0049, 0x000A004B,
0x000A004D
};
INCLUDE_ASM(s32, "world/action/18", func_802B6198_E24768);
void func_802B6000_E245D0(void) {
PlayerStatus* playerStatus = &gPlayerStatus;
f32 cosTheta;
f32 sinTheta;
s32 colliderID;
INCLUDE_ASM(s32, "world/action/18", func_802B6230_E24800);
if (playerStatus->flags < 0) {
playerStatus->flags &= ~0x80000000;
func_800E5530();
if (!(playerStatus->animFlags & 0x1000)) {
s32 temp;
if (!(playerStatus->animFlags & 1)) {
temp = 0x10004;
} else {
temp = 0x60000;
}
func_800DFEFC(temp);
} else {
func_802B6198_E24768();
}
playerStatus->fallState = 0;
playerStatus->decorationList = 0;
playerStatus->unk_C2 = 0;
playerStatus->gravityIntegrator[0] = 17.7566f;
playerStatus->gravityIntegrator[1] = -11.3862f;
playerStatus->gravityIntegrator[2] = 3.5f;
playerStatus->gravityIntegrator[3] = -0.75f;
}
integrate_gravity();
sin_cos_rad((playerStatus->targetYaw * TAU) / 360.0f, &sinTheta, &cosTheta);
colliderID = -1;
playerStatus->position.x += sinTheta * 3.0f;
playerStatus->position.z -= cosTheta * 3.0f;
if (playerStatus->gravityIntegrator[0] < 0.0f) {
playerStatus->position.y = func_800E3514(playerStatus->gravityIntegrator[0], &colliderID);
} else {
playerStatus->position.y += playerStatus->gravityIntegrator[0];
}
if (colliderID >= 0) {
if (playerStatus->prevActionState != ACTION_STATE_SPIN) {
set_action_state(playerStatus->prevActionState);
} else {
update_locomotion_state();
}
}
}
void func_802B6198_E24768(void) {
if (!(gPlayerStatus.animFlags & 0x2000)) {
if (!(gGameStatusPtr->peachFlags & 0x10)) {
func_800DFEFC((D_802B6300_E248D0)[gGameStatusPtr->peachAnimIdx]);
} else {
func_800DFEFC(0xD000D); // dood
}
} else {
func_800E636C(world_actions_peachDisguises[gPlayerStatus.peachDisguise].unk_04);
}
}
void func_802B6230_E24800(void) {
PlayerStatus* playerStatus = &gPlayerStatus;
if (playerStatus->flags < 0) {
playerStatus->flags &= ~0x80000000;
func_800DFEFC(0xA0005);
playerStatus->framesOnGround = 8;
}
if (playerStatus->framesOnGround != 0) {
playerStatus->framesOnGround--;
if (playerStatus->framesOnGround == 4) {
func_800E5098(1);
}
} else {
if (!(playerStatus->flags & 0x4000)) {
set_action_state(0);
} else if (playerStatus->currentSpeed >= playerStatus->runSpeed) {
set_action_state(2);
} else {
set_action_state(1);
}
}
}

View File

@ -1,15 +1,258 @@
#include "common.h"
#include "world/actions.h"
extern f32 D_802B6770_E27C80;
//wip - not good yet
#ifdef NON_MATCHING
void func_802B6000_E28A30(void) {
PlayerStatus* playerStatus = &gPlayerStatus;
if (playerStatus->flags < 0) {
playerStatus->flags &= 0x7FF7FFF1;
playerStatus->fallState = 0;
playerStatus->framesOnGround = 0;
playerStatus->decorationList = 0;
playerStatus->unk_C2 = 0;
playerStatus->currentSpeed = 0.0f;
playerStatus->unk_8C = 0.0f;
}
if (playerStatus->animFlags & 0x400000) {
if (D_8010EBB0.unk_03 == 8) {
func_802BD100_317020(playerStatus->flags);
} else if (D_8010EBB0.unk_03 == 7) {
func_802BD100_317020(playerStatus->flags);
}
}
}
#else
INCLUDE_ASM(s32, "world/action/encounter", func_802B6000_E28A30);
#endif
//wip - not good yet
#ifdef NON_MATCHING
void func_802B609C_E28ACC(void) {
PlayerStatus* playerStatus = &gPlayerStatus;
s32 sp4C;
s32 sp48;
s32 sp44;
s32 sp40;
f32 sp3C;
f32 sp38;
f32 sp34;
f32 sp30;
f32 cosTheta;
f32 sinTheta;
f32 *temp_a1;
f32 *temp_a2;
f32 *temp_a3;
f32 *temp_v0;
f32 temp_f20;
f32 temp_f4;
f32 temp_f6;
f32 phi_f4;
f32 zDelta;
f32 phi_f20;
if (playerStatus->flags < 0) {
playerStatus->flags &= ~(0x80080000 | 0x80000 | 0x8 | 0x4 | 0x2);
playerStatus->fallState = 0;
playerStatus->framesOnGround = 0;
playerStatus->decorationList = 0;
playerStatus->unk_C2 = 0;
playerStatus->currentSpeed = 0.0f;
playerStatus->unk_8C = 0.0f;
D_802B6770_E27C80 = D_8010C938;
}
switch (playerStatus->fallState) {
case 0:
playerStatus->fallState++;
case 1:
break;
default:
return;
}
sin_cos_rad((D_8010C990 * TAU) / 360.0f, &sinTheta, &cosTheta);
temp_f20 = sinTheta * 3.0f;
sin_cos_rad((D_802B6770_E27C80 * TAU) / 360.0f, &sinTheta, &cosTheta);
temp_f4 = sinTheta * temp_f20;
temp_f6 = cosTheta * temp_f20;
if (!(fabs(temp_f4) < 0.1)) {
phi_f4 = temp_f4;
} else {
phi_f4 = 0.1f;
if (temp_f4 < 0.0f) {
phi_f4 = -0.1f;
}
}
zDelta = temp_f6;
if (fabs(temp_f6) < 0.1) {
zDelta = 0.1f;
if (temp_f6 < 0.0f) {
zDelta = -0.1f;
}
}
temp_a1 = &sp30;
temp_a2 = &sp34;
temp_v0 = &sp3C;
playerStatus->position.x += phi_f4;
playerStatus->position.z -= zDelta;
temp_a3 = &sp38;
sp30 = playerStatus->position.x;
sp34 = playerStatus->position.y;
sp38 = playerStatus->position.z;
sp3C = 5.0f;
if (func_800DE46C(&gPlayerStatus, temp_a1, temp_a2, temp_a3, temp_v0, &sp40, &sp44, &sp48, &sp4C) >= 0) {
playerStatus->position.y = sp34;
}
phi_f20 = 60.0f;
if (gGameStatusPtr->areaID == AREA_SBK) {
phi_f20 = 30.0f;
}
if (D_8010C990 < phi_f20) {
set_action_state(ACTION_STATE_FALLING);
gravity_use_fall_params();
}
}
#else
INCLUDE_ASM(s32, "world/action/encounter", func_802B609C_E28ACC);
#endif
INCLUDE_ASM(s32, "world/action/encounter", func_802B6350_E28D80);
void func_802B6350_E28D80(void) {
PlayerStatus* playerStatus = &gPlayerStatus;
INCLUDE_ASM(s32, "world/action/encounter", func_802B63D4_E28E04);
if (playerStatus->flags < 0) {
playerStatus->flags &= ~(0x80000000 | 0x80000 | 0x8 | 0x4 | 0x2);
playerStatus->fallState = 0;
playerStatus->framesOnGround = 0;
playerStatus->decorationList = 0;
playerStatus->unk_C2 = 0;
playerStatus->currentSpeed = 0.0f;
playerStatus->unk_8C = 0.0f;
INCLUDE_ASM(s32, "world/action/encounter", func_802B6478_E28EA8);
if (playerStatus->animFlags & 0x1000) {
return;
}
playerStatus->framesOnGround = 5;
}
INCLUDE_ASM(s32, "world/action/encounter", func_802B6508_E28F38);
playerStatus->framesOnGround--;
if (playerStatus->framesOnGround == 0) {
set_action_state(ACTION_STATE_IDLE);
}
}
INCLUDE_ASM(void, "world/action/encounter", func_802B6638_E29068, void);
void func_802B63D4_E28E04(void) {
PlayerStatus* playerStatus = &gPlayerStatus;
if (playerStatus->flags < 0) {
playerStatus->flags &= ~(0x80000000 | 0x8 | 0x4 | 0x2);
playerStatus->fallState = 0;
playerStatus->decorationList = 0;
playerStatus->unk_C2 = 0;
playerStatus->currentSpeed = 0.0f;
playerStatus->unk_8C = 0.0f;
func_800DFF78(0x10017);
playerStatus->framesOnGround = 30;
}
if (playerStatus->framesOnGround != 0) {
playerStatus->framesOnGround--;
} else if (!gGameStatusPtr->isBattle) {
set_action_state(ACTION_STATE_IDLE);
}
}
void func_802B6478_E28EA8(void) {
PlayerStatus* playerStatus = &gPlayerStatus;
if (playerStatus->flags < 0) {
playerStatus->flags &= ~0x80000000;
playerStatus->flags |= 0x80000;
playerStatus->framesOnGround = 0;
playerStatus->fallState = 0;
playerStatus->currentSpeed = 0.0f;
playerStatus->unk_8C = 0.0f;
func_800DFF78(0x1001F);
}
if (!(playerStatus->animFlags & 0x200)) {
set_action_state(ACTION_STATE_IDLE);
playerStatus->flags &= ~0x80000;
}
}
void func_802B6508_E28F38(void) {
PlayerStatus* playerStatus = &gPlayerStatus;
if (playerStatus->flags < 0) {
f32 angle;
f32 magnitude;
playerStatus->flags &= ~0x80000000;
playerStatus->currentSpeed = 0.0f;
playerStatus->unk_60 = 0;
playerStatus->framesOnGround = 5;
input_to_move_vector(&angle, &magnitude);
if (((angle >= 45.0f) && (angle <= 135.0f)) || ((angle >= 225.0f) && (angle <= 315.0f))) {
func_800DFF78(0x80000 | 0x20);
} else {
func_800DFEFC(0x60000 | 0x4);
}
}
check_input_jump();
if (playerStatus->animFlags & 0x800000) {
if (playerStatus->framesOnGround != 0) {
playerStatus->framesOnGround--;
if (playerStatus->framesOnGround == 0) {
set_action_state(ACTION_STATE_IDLE);
}
}
}
}
void func_802B6638_E29068(void) {
PlayerStatus* playerStatus = &gPlayerStatus;
if (playerStatus->flags < 0) {
playerStatus->flags &= ~0x80000000;
playerStatus->currentSpeed = 0.0f;
playerStatus->unk_60 = 0;
if (!(playerStatus->animFlags & 0x1000)) {
func_800DFF78(0x80007);
} else if (playerStatus->unk_C4 == 0) {
if (!(playerStatus->animFlags & 0x2000)) {
func_800DFF78(0xC0000);
} else {
func_800E636C(world_actions_peachDisguises[playerStatus->peachDisguise].unk_0C);
}
}
playerStatus->framesOnGround = 30;
}
if (playerStatus->animFlags & 0x1000) {
if (playerStatus->framesOnGround != 0) {
playerStatus->framesOnGround--;
} else if (playerStatus->unk_C4 == 0) {
if (!(playerStatus->animFlags & 0x2000)) {
func_800DFF78(0xA0001);
} else {
func_800E636C(world_actions_peachDisguises[playerStatus->peachDisguise].idle);
}
}
}
}

View File

@ -1,8 +1,99 @@
#include "common.h"
INCLUDE_ASM(s32, "world/action/hammer", func_802B6000_E24ED0);
extern Vec3f* D_802B6DB0_E25C80;
INCLUDE_ASM(s32, "world/action/hammer", func_802B6048_E24F18);
s32 func_802B6000_E24ED0(s32 arg0) {
if (arg0 & 0x1000000) {
return TRUE;
}
switch (arg0 + ~0x6000F) {
case 1:
case 3:
case 5:
case 7:
case 9:
case 11:
return TRUE;
}
return FALSE;
}
void func_802B6048_E24F18(s32 arg0) {
PlayerStatus* playerStatus = &gPlayerStatus;
f32 phi_f24;
s32 s2temp;
s32 phi_s1;
s32 soundID;
f32 theta;
f32 sinTheta;
f32 cosTheta;
s32 phi_s3;
f32 xTemp;
f32 yTemp;
f32 zTemp;
if (gPlayerData.hammerLevel == 2) {
phi_f24 = 1.2f;
s2temp = 1;
phi_s1 = 28;
soundID = 0x211A;
} else if (gPlayerData.hammerLevel == 1) {
phi_f24 = 0.8f;
s2temp = 1;
phi_s1 = 16;
soundID = 0x2119;
} else {
phi_f24 = 0.4f;
s2temp = 1;
phi_s1 = 4;
soundID = 0x2118;
}
theta = (func_800E5348() * TAU) / 360.0f;
sinTheta = sin_rad(theta) * 25.0f;
cosTheta = cos_rad(theta) * -25.0f;
if (arg0 < 0) {
phi_s3 = 6;
xTemp = playerStatus->position.x + sinTheta;
yTemp = playerStatus->position.y;
zTemp = playerStatus->position.z + cosTheta;
} else {
phi_s3 = 3;
xTemp = D_802B6DB0_E25C80->x + sinTheta;
yTemp = D_802B6DB0_E25C80->y + playerStatus->colliderHeight - 5.0f;
zTemp = D_802B6DB0_E25C80->z + cosTheta;
phi_s1 = 1;
}
exec_ShakeCamX(0, 2, s2temp, phi_f24);
func_80070370(0, xTemp, yTemp, zTemp, phi_s1, phi_s3, 0, (s2temp + 3) * 3);
switch (is_ability_active(ABILITY_ATTACK_F_X)) {
case 1:
soundID = 0x372;
break;
case 2:
soundID = 0xF1;
break;
case 3:
soundID = 0xDC;
break;
case 4:
soundID = 0x2072;
break;
case 5:
soundID = 0x2073;
break;
case 6:
soundID = 0x205B;
break;
}
sfx_play_sound_at_player(soundID, 0);
start_rumble(0x100, 0x32);
}
INCLUDE_ASM(s32, "world/action/hammer", func_802B62A4_E25174);

View File

@ -6,6 +6,7 @@ INCLUDE_ASM(void, "world/action/walk", func_802B6000_E236E0, void);
// run
INCLUDE_ASM(void, "world/action/walk", func_802B6288_E23968, void);
// same as func_802B6198_E24768 but requires data stuff
INCLUDE_ASM(void, "world/action/walk", func_802B6550_E23C30, void);
INCLUDE_ASM(void, "world/action/walk", func_802B65E8_E23CC8, void);

View File

@ -12,11 +12,11 @@ typedef struct Action {
typedef struct DisguiseAnims {
/* 0x00 */ NpcAnimID idle;
/* 0x04 */ NpcAnimID unk4;
/* 0x08 */ NpcAnimID unk8;
/* 0x0C */ NpcAnimID unkC;
/* 0x10 */ NpcAnimID unk10;
/* 0x10 */ NpcAnimID unk14;
/* 0x04 */ NpcAnimID unk_04;
/* 0x08 */ NpcAnimID unk_08;
/* 0x0C */ NpcAnimID unk_0C;
/* 0x10 */ NpcAnimID unk_10;
/* 0x10 */ NpcAnimID unk_14;
} DisguiseAnims; // size = 0x18
extern f32 D_800F7B90;

View File

@ -4,7 +4,7 @@
#define NAMESPACE arn_08
f32 func_800E3514(f32, f32*);
f32 func_800E3514(f32, s32*);
f32 func_800E34D8(void);
ApiStatus N(func_80240000_BF47A0)(ScriptInstance* script, s32 isInitialCall);

View File

@ -1214,9 +1214,9 @@ ApiStatus N(func_802429D0_C38F00)(ScriptInstance* script, s32 isInitialCall) {
}
for (i = 0, userDataPtr = scriptPtr; i < 3; i++) {
((EffectInstanceData*)userDataPtr->unk_08[i]->unk_0C)->rotation.x = userDataPtr->unk_14[i];
((EffectInstanceData*)userDataPtr->unk_08[i]->unk_0C)->rotation.y = userDataPtr->unk_20[i];
((EffectInstanceData*)userDataPtr->unk_08[i]->unk_0C)->rotation.z = userDataPtr->unk_2C[i];
((EffectInstanceData*)userDataPtr->unk_08[i]->instanceData)->rotation.x = userDataPtr->unk_14[i];
((EffectInstanceData*)userDataPtr->unk_08[i]->instanceData)->rotation.y = userDataPtr->unk_20[i];
((EffectInstanceData*)userDataPtr->unk_08[i]->instanceData)->rotation.z = userDataPtr->unk_2C[i];
}
return ApiStatus_BLOCK;

View File

@ -30,7 +30,7 @@ enum {
NPC_DRYITE5,
};
typedef struct N(Unk_Struct_1) {
typedef struct Unk_Struct_1 {
s32 unk_00;
s32 unk_04;
s32 unk_08;
@ -46,7 +46,7 @@ typedef struct N(Unk_Struct_1) {
f32 unk_30;
f32 unk_34;
s32 unk_38;
} N(Unk_Struct_1);
} Unk_Struct_1;
typedef struct {
s32 unk_00;
@ -54,10 +54,10 @@ typedef struct {
s32 unk_08;
s32 unk_0C;
s32 unk_10;
void (*unk_14)(N(Unk_Struct_1)*, s32);
} N(Unk_Struct_2);
void (*unk_14)(Unk_Struct_1*, s32);
} Unk_Struct_2;
void N(func_802430C8_95E2C8)(N(Unk_Struct_1)* ptr, s32 arg1);
void N(func_802430C8_95E2C8)(Unk_Struct_1* ptr, s32 arg1);
Script N(80248504);
@ -3304,14 +3304,14 @@ ApiStatus N(func_802427BC_95D9BC)(ScriptInstance* script, s32 isInitialCall) {
ApiStatus N(func_80242858_95DA58)(ScriptInstance* script, s32 isInitialCall) {
PlayerStatus* playerStatus = &gPlayerStatus;
N(Unk_Struct_2)* temp_s1 = get_variable(script, *script->ptrReadPos);
N(Unk_Struct_1)* ptr;
Unk_Struct_2* temp_s1 = get_variable(script, *script->ptrReadPos);
Unk_Struct_1* ptr;
s32 atan_res1, atan_res2;
s32 clamp;
s32 res;
if (isInitialCall) {
script->functionTemp[1].s = (N(Unk_Struct_1)*)heap_malloc(0x3C);
script->functionTemp[1].s = (Unk_Struct_1*)heap_malloc(0x3C);
ptr = script->functionTemp[1].s;
ptr->unk_00 = temp_s1->unk_00;
ptr->unk_04 = temp_s1->unk_04;
@ -3449,7 +3449,7 @@ ApiStatus N(func_80243084_95E284)(ScriptInstance* script, s32 isInitialCall) {
#include "world/common/GetFloorCollider.inc.c"
void N(func_802430C8_95E2C8)(N(Unk_Struct_1)* ptr, s32 arg1) {
void N(func_802430C8_95E2C8)(Unk_Struct_1* ptr, s32 arg1) {
PlayerStatus* playerStatus = &gPlayerStatus;
switch (arg1) {

View File

@ -3203,7 +3203,7 @@ ApiStatus N(func_80240A70_969C30)(ScriptInstance* script, s32 isInitialCall) {
N(D_8024EFC8) = func_80072890(0, get_variable(script, SI_ARRAY(1)), get_variable(script, SI_ARRAY(2)),
get_variable(script, SI_ARRAY(3)), 1.0f, 0);
effectPtr = N(D_8024EFC0)->unk_0C;
effectPtr = N(D_8024EFC0)->instanceData;
effectPtr->unk_18 = 0;
effectPtr->unk_20 = 0;
effectPtr->unk_24.s = 0;
@ -3211,7 +3211,7 @@ ApiStatus N(func_80240A70_969C30)(ScriptInstance* script, s32 isInitialCall) {
effectPtr->unk_1C = 0;
}
effectPtr = N(D_8024EFC0)->unk_0C;
effectPtr = N(D_8024EFC0)->instanceData;
effectPtr->unk_20 += 10;
effectPtr->unk_28 += 10;
@ -3234,7 +3234,7 @@ ApiStatus N(func_80240C88_969E48)(ScriptInstance* script, s32 isInitialCall) {
N(D_8024EFC8)->flags |= 0x10;
}
effectPtr = N(D_8024EFC0)->unk_0C;
effectPtr = N(D_8024EFC0)->instanceData;
effectPtr->unk_18 -= 10;
effectPtr->unk_20 -= 10;
effectPtr->unk_24.s -= 10;
@ -3258,7 +3258,7 @@ ApiStatus N(func_80240D3C_969EFC)(ScriptInstance* script, s32 isInitialCall) {
ApiStatus N(func_80240D70_969F30)(ScriptInstance* script, s32 isInitialCall) {
s32 var = get_variable(script, *script->ptrReadPos);
EffectInstanceDataThing* effectPtr = N(D_8024EFC0)->unk_0C;
EffectInstanceDataThing* effectPtr = N(D_8024EFC0)->instanceData;
switch (var) {
case 0:

View File

@ -262,9 +262,9 @@ ApiStatus N(func_80240600_CAF340)(ScriptInstance* script, s32 isInitialCall) {
}
for (i = 0, userDataPtr = scriptPtr; i < 3; i++) {
((EffectInstanceData*)userDataPtr->unk_08[i]->unk_0C)->rotation.x = userDataPtr->unk_14[i];
((EffectInstanceData*)userDataPtr->unk_08[i]->unk_0C)->rotation.y = userDataPtr->unk_20[i];
((EffectInstanceData*)userDataPtr->unk_08[i]->unk_0C)->rotation.z = userDataPtr->unk_2C[i];
((EffectInstanceData*)userDataPtr->unk_08[i]->instanceData)->rotation.x = userDataPtr->unk_14[i];
((EffectInstanceData*)userDataPtr->unk_08[i]->instanceData)->rotation.y = userDataPtr->unk_20[i];
((EffectInstanceData*)userDataPtr->unk_08[i]->instanceData)->rotation.z = userDataPtr->unk_2C[i];
}
return ApiStatus_BLOCK;

View File

@ -669,9 +669,9 @@ ApiStatus N(func_802406E0_CD2510)(ScriptInstance* script, s32 isInitialCall) {
}
for (i = 0, userDataPtr = scriptPtr; i < 3; i++) {
((EffectInstanceData*)userDataPtr->unk_08[i]->unk_0C)->rotation.x = userDataPtr->unk_14[i];
((EffectInstanceData*)userDataPtr->unk_08[i]->unk_0C)->rotation.y = userDataPtr->unk_20[i];
((EffectInstanceData*)userDataPtr->unk_08[i]->unk_0C)->rotation.z = userDataPtr->unk_2C[i];
((EffectInstanceData*)userDataPtr->unk_08[i]->instanceData)->rotation.x = userDataPtr->unk_14[i];
((EffectInstanceData*)userDataPtr->unk_08[i]->instanceData)->rotation.y = userDataPtr->unk_20[i];
((EffectInstanceData*)userDataPtr->unk_08[i]->instanceData)->rotation.z = userDataPtr->unk_2C[i];
}
return ApiStatus_BLOCK;

View File

@ -3,7 +3,7 @@
ApiStatus N(func_80242940_CD4770)(ScriptInstance* script, s32 isInitialCall) {
script->varTable[0] = 0;
do {} while (0);
if ((gPlayerActionState == ACTION_STATE_GROUND_POUND) || (gPlayerActionState == ACTION_STATE_ULTRA_POUND)) {
if (gPlayerActionState == ACTION_STATE_GROUND_POUND || gPlayerActionState == ACTION_STATE_ULTRA_POUND) {
script->varTable[0] = 1;
}
return ApiStatus_DONE2;

View File

@ -1,3 +1,3 @@
#include "hos_10.h"
INCLUDE_ASM(s32, "world/area_hos/hos_10/A3F740", func_80240000_A3F740);
#include "world/common/SetPlayerSpriteSet2.inc.c"

View File

@ -24,4 +24,4 @@ INCLUDE_ASM(s32, "world/area_jan/jan_01/B28030", func_80240F30_B28F60);
INCLUDE_ASM(s32, "world/area_jan/jan_01/B28030", func_80241154_B29184);
INCLUDE_ASM(s32, "world/area_jan/jan_01/B28030", func_80241170_B291A0);
#include "world/common/UnsetCamera0Flag1000.inc.c"

View File

@ -189,7 +189,7 @@ ApiStatus N(func_80240E90_B85010)(ScriptInstance* script, s32 isInitialCall) {
INCLUDE_ASM(s32, "world/area_jan/jan_22/B84180", func_80240FA8_B85128);
INCLUDE_ASM(s32, "world/area_jan/jan_22/B84180", func_80240FC4_B85144);
#include "world/common/UnsetCamera0Flag1000.inc.c"
ApiStatus PostChapter5StatUpdate(ScriptInstance* script, s32 isInitialCall) {
PlayerData* playerData = &gPlayerData;

View File

@ -1,3 +1,3 @@
#include "kkj_03.h"
INCLUDE_ASM(s32, "world/area_kkj/kkj_03/AC9710", func_80240000_AC9710);
#include "world/common/SetPlayerSpriteSet2.inc.c"

View File

@ -1,3 +1,3 @@
#include "kkj_13.h"
INCLUDE_ASM(s32, "world/area_kkj/kkj_13/AD5ED0", func_80240000_AD5ED0);
#include "world/common/SetPlayerSpriteSet2.inc.c"

View File

@ -1,3 +1,3 @@
#include "kkj_23.h"
INCLUDE_ASM(s32, "world/area_kkj/kkj_23/B02880", func_80240000_B02880);
#include "world/common/SetPlayerSpriteSet2.inc.c"

View File

@ -1,3 +1,3 @@
#include "kkj_25.h"
INCLUDE_ASM(s32, "world/area_kkj/kkj_25/B06A00", func_80240000_B06A00);
#include "world/common/SetPlayerSpriteSet2.inc.c"

View File

@ -2,6 +2,6 @@
INCLUDE_ASM(s32, "world/area_kzn/kzn_18/C8C3F0", func_80240350_C8C3F0);
INCLUDE_ASM(s32, "world/area_kzn/kzn_18/C8C3F0", func_8024036C_C8C40C);
#include "world/common/UnsetCamera0Flag1000.inc.c"
#include "world/common/GetFloorCollider.inc.c"

View File

@ -2,4 +2,4 @@
INCLUDE_ASM(s32, "world/area_nok/nok_12/9FAAE0", func_802402F0_9FAAE0);
INCLUDE_ASM(s32, "world/area_nok/nok_12/9FAAE0", func_8024030C_9FAAFC);
#include "world/common/UnsetCamera0Flag1000.inc.c"

View File

@ -2,4 +2,4 @@
INCLUDE_ASM(s32, "world/area_nok/nok_14/A029C0", func_80240180_A029C0);
INCLUDE_ASM(s32, "world/area_nok/nok_14/A029C0", func_8024019C_A029DC);
#include "world/common/UnsetCamera0Flag1000.inc.c"

View File

@ -164,4 +164,4 @@ INCLUDE_ASM(s32, "world/area_omo/omo_04/DAD400", func_80241AD0_DAEED0);
INCLUDE_ASM(s32, "world/area_omo/omo_04/DAD400", func_80241E04_DAF204);
INCLUDE_ASM(s32, "world/area_omo/omo_04/DAD400", func_80241E20_DAF220);
#include "world/common/UnsetCamera0Flag1000.inc.c"

View File

@ -307,6 +307,6 @@ ApiStatus N(func_80242C84_DBFF34)(ScriptInstance* script, s32 isInitialCall) {
INCLUDE_ASM(s32, "world/area_omo/omo_07/DBD2B0", func_80242E70_DC0120);
INCLUDE_ASM(s32, "world/area_omo/omo_07/DBD2B0", func_80242E8C_DC013C);
#include "world/common/UnsetCamera0Flag1000.inc.c"
INCLUDE_ASM(s32, "world/area_omo/omo_07/DBD2B0", func_80242EA8_DC0158);

View File

@ -210,4 +210,4 @@ INCLUDE_ASM(s32, "world/area_omo/omo_09/DCD6B0", func_802435B8_DD0288);
INCLUDE_ASM(s32, "world/area_omo/omo_09/DCD6B0", func_802435CC_DD029C);
INCLUDE_ASM(s32, "world/area_omo/omo_09/DCD6B0", func_802435E8_DD02B8);
#include "world/common/UnsetCamera0Flag1000.inc.c"

View File

@ -6,7 +6,7 @@ INCLUDE_ASM(s32, "world/area_omo/omo_12/DDF310", func_80240184_DDF494);
INCLUDE_ASM(s32, "world/area_omo/omo_12/DDF310", func_802402DC_DDF5EC);
INCLUDE_ASM(s32, "world/area_omo/omo_12/DDF310", func_802402F8_DDF608);
#include "world/common/UnsetCamera0Flag1000.inc.c"
INCLUDE_ASM(s32, "world/area_omo/omo_12/DDF310", func_80240314_DDF624);

View File

@ -1,3 +1,3 @@
#include "osr_02.h"
INCLUDE_ASM(s32, "world/area_osr/osr_02/AB2170", func_80240000_AB2170);
#include "world/common/SetPlayerSpriteSet2.inc.c"

View File

@ -1,3 +1,3 @@
#include "osr_03.h"
INCLUDE_ASM(s32, "world/area_osr/osr_03/AB6290", func_80240000_AB6290);
#include "world/common/SetPlayerSpriteSet2.inc.c"

View File

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

View File

@ -0,0 +1,9 @@
#include "common.h"
#include "map.h"
ApiStatus N(UnsetCamera0Flag1000)(ScriptInstance* script, s32 isInitialCall) {
Camera* camera = CAM(0);
camera->flags &= ~0x1000;
return ApiStatus_DONE2;
}

View File

@ -6,7 +6,7 @@
[subrepo]
remote = https://github.com/ethteck/splat.git
branch = master
commit = 924414a51d0bcc52076b6ee7147b1bb1d20e804a
parent = 7515d21506205b43cccd28875f0d2765addb36ad
commit = 4c0a93eaed0df20d3c576cd10360cbf7a3506e23
parent = 567efbcb4b71f5c4c03080233b84750d6b144712
method = merge
cmdver = 0.4.3

View File

@ -1,35 +1,45 @@
#! /usr/bin/env python3
import argparse
from util.n64 import rominfo
from util.n64 import find_code_length
from util.n64 import rominfo, find_code_length
parser = argparse.ArgumentParser(description="Create a splat config from a rom (currently only n64 .z64 roms supported)")
parser.add_argument("rom", help="path to a .z64 rom")
parser = argparse.ArgumentParser(description="Create a splat config from a ROM. "
"Only n64 .z64 ROMs are supported")
parser.add_argument("rom", help="Path to a .z64 ROM")
def main(rom_path):
rom = rominfo.get_info(rom_path)
basename = rom.name.replace(" ", "").lower()
header = \
"""name: {0} ({1})
basename: {2}
header = f"""
name: {rom.name.title()} ({rom.get_country_name()})
sha1: {rom.sha1}
options:
find_file_boundaries: True
compiler: IDO
platform: n64
basename: {basename}
target_path: {rom_path}
base_path: .
target_path: baserom.z64
""".format(rom.name.title(), rom.get_country_name(), basename)
compiler: {rom.compiler}
find_file_boundaries: True
# platform: n64
# undefined_funcs_auto_path: undefined_funcs_auto.txt
# undefined_syms_auto_path: undefined_syms_auto.txt
# symbol_addrs_path: symbol_addrs.txt
# undefined_syms_path: undefined_syms.txt
# asm_path: asm
# src_path: src
# build_path: build
# extensions_path: tools/splat_ext
# section_order: [.text, .data, .rodata, .bss]
""".lstrip()
with open(rom_path, "rb") as f:
fbytes = f.read()
first_section_end = find_code_length.run(fbytes, 0x1000, rom.entry_point)
segments = \
"""segments:
segments = f"""
segments:
- name: header
type: header
start: 0x0
@ -39,19 +49,17 @@ options:
- name: main
type: code
start: 0x1000
vram: 0x{:X}
vram: 0x{rom.entry_point:X}
subsegments:
- [0x1000, asm]
- type: bin
start: 0x{:X}
- [0x{:X}]
""".format(rom.entry_point, first_section_end, rom.size)
start: 0x{first_section_end:X}
- [0x{rom.size:X}]
""".lstrip()
outstr = header + segments
with open(basename + ".yaml", "w", newline="\n") as f:
f.write(header + segments)
outname = rom.name.replace(" ", "").lower()
with open(outname + ".yaml", "w", newline="\n") as f:
f.write(outstr)
if __name__ == "__main__":
args = parser.parse_args()

View File

@ -78,7 +78,7 @@ class LinkerWriter():
if start % 0x10 != 0 and i != 0:
do_next = True
if entry.object_path:
if entry.object_path and entry.section == ".data":
path_cname = re.sub(r"[^0-9a-zA-Z_]", "_", str(entry.segment.dir / entry.segment.name) + ".".join(entry.object_path.suffixes[:-1]))
self._write_symbol(path_cname, ".")

View File

@ -9,8 +9,8 @@ if TYPE_CHECKING:
from segtypes.n64.palette import N64SegPalette as Palette
class N64SegCi8(N64SegRgba16):
def __init__(self, segment, rom_start, rom_end):
super().__init__(segment, rom_start, rom_end)
def __init__(self, rom_start, rom_end, type, name, vram_start, extract, given_subalign, given_is_overlay, given_dir, args, yaml):
super().__init__(rom_start, rom_end, type, name, vram_start, extract, given_subalign, given_is_overlay, given_dir, args, yaml)
self.palette: 'Optional[Palette]' = None
self.palette_name = self.name
@ -51,4 +51,4 @@ class N64SegCi8(N64SegRgba16):
return self.width * self.height
def cache(self):
return (self.config, self.rom_end, 1)
return (self.yaml, self.rom_end, 1)

View File

@ -6,8 +6,8 @@ from util.symbols import Symbol
# code group
class N64SegCode(N64SegGroup):
def __init__(self, segment, rom_start, rom_end):
super().__init__(segment, rom_start, rom_end)
def __init__(self, rom_start, rom_end, type, name, vram_start, extract, given_subalign, given_is_overlay, given_dir, args, yaml):
super().__init__(rom_start, rom_end, type, name, vram_start, extract, given_subalign, given_is_overlay, given_dir, args, yaml)
self.reported_file_split = False
self.labels_to_add = set()

View File

@ -360,7 +360,7 @@ class N64SegCodeSubsegment(Segment):
rom_offset += 4
def should_scan(self) -> bool:
return options.mode_active("code")
return options.mode_active("code") and self.rom_start != "auto" and self.rom_end != "auto"
def should_split(self) -> bool:
return self.extract and options.mode_active("code")

View File

@ -1,3 +1,4 @@
from collections import OrderedDict
from typing import List, Dict, Optional
import sys
from segtypes.n64.segment import N64Segment
@ -5,20 +6,20 @@ from segtypes.segment import RomAddr, Segment
from util.symbols import Symbol
class N64SegGroup(N64Segment):
def __init__(self, segment, rom_start, rom_end):
super().__init__(segment, rom_start, rom_end)
def __init__(self, rom_start, rom_end, type, name, vram_start, extract, given_subalign, given_is_overlay, given_dir, args, yaml):
super().__init__(rom_start, rom_end, type, name, vram_start, extract, given_subalign, given_is_overlay, given_dir, args, yaml)
self.rodata_syms: Dict[int, List[Symbol]] = {}
# TODO Note: These start/end vram options don't really do anything yet
self.data_vram_start: Optional[int] = segment.get("data_vram_start")
self.data_vram_end: Optional[int] = segment.get("data_vram_end")
self.rodata_vram_start: Optional[int] = segment.get("rodata_vram_start")
self.rodata_vram_end: Optional[int] = segment.get("rodata_vram_end")
self.bss_vram_start: Optional[int] = segment.get("bss_vram_start")
self.bss_vram_end: Optional[int] = segment.get("bss_vram_end")
self.data_vram_start: Optional[int] = yaml.get("data_vram_start")
self.data_vram_end: Optional[int] = yaml.get("data_vram_end")
self.rodata_vram_start: Optional[int] = yaml.get("rodata_vram_start")
self.rodata_vram_end: Optional[int] = yaml.get("rodata_vram_end")
self.bss_vram_start: Optional[int] = yaml.get("bss_vram_start")
self.bss_vram_end: Optional[int] = yaml.get("bss_vram_end")
self.subsegments = self.parse_subsegments(segment)
self.subsegments = self.parse_subsegments(yaml)
@property
def needs_symbols(self) -> bool:
@ -27,8 +28,27 @@ class N64SegGroup(N64Segment):
return True
return False
def handle_alls(self, segs, base_segs) -> bool:
for i, elem in enumerate(segs):
if elem.type.startswith("all_"):
alls = []
rep_type = f".{elem.type[4:]}"
replace_class = Segment.get_class_for_type(rep_type)
for base in base_segs.items():
rep = replace_class("auto", "auto", rep_type, base[0], "auto", extract=False)
rep.sibling = base[1]
rep.parent = self
alls.append(rep)
del segs[i]
segs[i:i] = alls
return True
return False
def parse_subsegments(self, segment_yaml) -> List[Segment]:
base_segments: Dict[str, Segment] = {}
base_segments: OrderedDict[str, Segment] = OrderedDict()
ret = []
prev_start: RomAddr = -1
@ -43,6 +63,10 @@ class N64SegGroup(N64Segment):
typ = Segment.parse_segment_type(subsection_yaml)
if typ.startswith("all_"):
ret.append(Segment("auto", "auto", typ, "", "auto"))
continue
segment_class = Segment.get_class_for_type(typ)
start = Segment.parse_segment_start(subsection_yaml)
@ -52,7 +76,7 @@ class N64SegGroup(N64Segment):
print(f"Error: Code segment {self.name} contains subsegments which are out of ascending rom order (0x{prev_start:X} followed by 0x{start:X})")
sys.exit(1)
segment: Segment = segment_class(subsection_yaml, start, end)
segment: Segment = Segment.from_yaml(segment_class, subsection_yaml, start, end)
segment.sibling = base_segments.get(segment.name, None)
segment.parent = self
@ -78,6 +102,11 @@ class N64SegGroup(N64Segment):
prev_start = start
check = True
while check:
check = self.handle_alls(ret, base_segments)
if self.rodata_vram_start != None and self.rodata_vram_end == None:
assert self.vram_end is not None
self.rodata_vram_end = self.vram_end

View File

@ -5,29 +5,29 @@ from util import options
from util import log
class N64SegImg(N64Segment):
def __init__(self, segment, rom_start, rom_end):
super().__init__(segment, rom_start, rom_end)
def __init__(self, rom_start, rom_end, type, name, vram_start, extract, given_subalign, given_is_overlay, given_dir, args, yaml):
super().__init__(rom_start, rom_end, type, name, vram_start, extract, given_subalign, given_is_overlay, given_dir, args, yaml)
if type(segment) is dict:
if isinstance(yaml, dict):
if self.extract:
self.width = segment["width"]
self.height = segment["height"]
self.width = yaml["width"]
self.height = yaml["height"]
self.flip_horizontal = bool(segment.get("flip_x", False))
self.flip_vertical = bool(segment.get("flip_y", False))
self.flip_horizontal = bool(yaml.get("flip_x", False))
self.flip_vertical = bool(yaml.get("flip_y", False))
if segment.get("flip"):
if yaml.get("flip"):
self.warn(f"'flip' parameter for img segments is deprecated; use flip_x and flip_y instead")
flip = segment.get("flip")
flip = yaml.get("flip")
self.flip_vertical = flip == "both" or flip.startswith("v") or flip == "y"
self.flip_horizontal = flip == "both" or flip.startswith("h") or flip == "x"
else:
if self.extract:
if len(segment) < 5:
if len(yaml) < 5:
log.error(f"Error: {self.name} is missing width and height parameters")
self.width = segment[3]
self.height = segment[4]
self.width = yaml[3]
self.height = yaml[4]
self.flip_horizontal = False
self.flip_vertical = False

View File

@ -13,8 +13,8 @@ if TYPE_CHECKING:
class N64SegPalette(N64Segment):
require_unique_name = False
def __init__(self, segment, rom_start, rom_end):
super().__init__(segment, rom_start, rom_end)
def __init__(self, rom_start, rom_end, type, name, vram_start, extract, given_subalign, given_is_overlay, given_dir, args, yaml):
super().__init__(rom_start, rom_end, type, name, vram_start, extract, given_subalign, given_is_overlay, given_dir, args, yaml)
self.raster: 'Optional[Raster]' = None
@ -22,10 +22,10 @@ class N64SegPalette(N64Segment):
# 1) same as the relevant raster segment name (max. 1 palette)
# 2) relevant raster segment name + "." + unique palette name
# 3) unique, referencing the relevant raster segment using `raster_name`
self.raster_name = segment.get(
self.raster_name = yaml.get(
"raster_name",
self.name.split(".")[0]
) if type(segment) is dict else self.name.split(".")[0]
) if isinstance(yaml, dict) else self.name.split(".")[0]
if self.extract:
if self.rom_end == "auto":

View File

@ -1,6 +1,7 @@
import importlib
from typing import Dict, TYPE_CHECKING, Union, Optional, List
from typing import Dict, TYPE_CHECKING, Type, Union, Optional, List
from pathlib import Path
from util import log
from util import options
from util.symbols import Symbol
@ -90,7 +91,8 @@ class Segment:
else:
return str(segment[1])
def parse_segment_name(self, segment: Union[dict, list]) -> str:
@staticmethod
def parse_segment_name(cls, rom_start, segment: Union[dict, list]) -> str:
if isinstance(segment, dict) and "name" in segment:
return str(segment["name"])
elif isinstance(segment, dict) and "dir" in segment:
@ -98,28 +100,29 @@ class Segment:
elif isinstance(segment, list) and len(segment) >= 3:
return str(segment[2])
else:
return str(self.__class__.get_default_name(self.rom_start))
return str(cls.get_default_name(rom_start))
def __init__(self, segment: Union[dict, list], rom_start: RomAddr, rom_end: RomAddr):
def __init__(self, rom_start, rom_end, type, name, vram_start, extract = True,
given_subalign = options.get_subalign(), given_is_overlay: Optional[bool] = False, given_dir: Path = Path(), args = [], yaml = {}):
self.rom_start = rom_start
self.rom_end = rom_end
self.type = Segment.parse_segment_type(segment)
self.name = self.parse_segment_name(segment)
self.given_dir = Path(segment.get("dir", "")) if isinstance(segment, dict) else Path()
self.vram_start = parse_segment_vram(segment)
self.extract = bool(segment.get("extract", True)) if isinstance(segment, dict) else True
self.config = segment
self.given_subalign = parse_segment_subalign(segment)
self.parent:Optional[Segment] = None
self.args:List[str] = [] if isinstance(segment, dict) else segment[3:]
self.given_is_overlay:Optional[bool] = segment.get("overlay", False) if isinstance(segment, dict) else False
self.sibling:Optional[Segment] = None
self.type = type
self.name = name
self.vram_start = vram_start
self.extract = extract
self.given_subalign = given_subalign
self.given_is_overlay = given_is_overlay
self.given_dir = given_dir
self.given_seg_symbols: Dict[int, Symbol] = {} # Symbols known to be in this segment
self.given_ext_symbols: Dict[int, Symbol] = {} # Symbols not in this segment but also not from other overlapping ram address ranges
self.parent:Optional[Segment] = None
self.sibling:Optional[Segment] = None
self.args:List[str] = args
self.yaml = yaml
if "skip" in self.args:
self.extract = False
@ -137,6 +140,19 @@ class Segment:
print(f"Error: segments out of order - ({self.name} starts at 0x{self.rom_start:X}, but next segment starts at 0x{self.rom_end:X})")
sys.exit(1)
@staticmethod
def from_yaml(cls: Type["Segment"], yaml: Union[dict, list], rom_start: RomAddr, rom_end: RomAddr):
type = Segment.parse_segment_type(yaml)
name = Segment.parse_segment_name(cls, rom_start, yaml)
vram_start = parse_segment_vram(yaml)
extract = bool(yaml.get("extract", True)) if isinstance(yaml, dict) else True
given_subalign = parse_segment_subalign(yaml)
given_is_overlay:Optional[bool] = yaml.get("overlay", False) if isinstance(yaml, dict) else False
given_dir = Path(yaml.get("dir", "")) if isinstance(yaml, dict) else Path()
args:List[str] = [] if isinstance(yaml, dict) else yaml[3:]
return cls(rom_start, rom_end, type, name, vram_start, extract, given_subalign, given_is_overlay, given_dir, args, yaml)
@property
def needs_symbols(self) -> bool:
return False
@ -234,7 +250,7 @@ class Segment:
pass
def cache(self):
return (self.config, self.rom_end)
return (self.yaml, self.rom_end)
def get_linker_section(self) -> str:
return ".data"

View File

@ -1,5 +1,6 @@
#! /usr/bin/python3
import hashlib
from typing import Dict, List, Union, Set, Any
import argparse
import pylibyaml
@ -48,7 +49,7 @@ def initialize_segments(config_segments: Union[dict, list]) -> List[Segment]:
this_start = Segment.parse_segment_start(seg_yaml)
next_start = Segment.parse_segment_start(config_segments[i + 1])
segment: Segment = segment_class(seg_yaml, this_start, next_start)
segment: Segment = Segment.from_yaml(segment_class, seg_yaml, this_start, next_start)
if segment.require_unique_name:
if segment.name in seen_segment_names:
@ -115,11 +116,19 @@ def main(config_path, base_dir, target_path, modes, verbose, use_cache=True):
options.initialize(config, config_path, base_dir, target_path)
options.set("modes", modes)
options.set("verbose", verbose)
if verbose:
options.set("verbose", True)
with options.get_target_path().open("rb") as f2:
rom_bytes = f2.read()
if "sha1" in config:
sha1 = hashlib.sha1(rom_bytes).hexdigest()
e_sha1 = config["sha1"]
if e_sha1 != sha1:
log.error(f"sha1 mismatch: expected {e_sha1}, was {sha1}")
# Create main output dir
options.get_base_path().mkdir(parents=True, exist_ok=True)

View File

@ -1,7 +1,7 @@
from collections import namedtuple
from typing import Any, Optional
Resolution = namedtuple('_Resolution', 'x y unit_is_meter')
Resolution = namedtuple('Resolution', 'x y unit_is_meter')
class Error(Exception): ...
class FormatError(Error): ...

View File

@ -3,6 +3,7 @@ import sys
import os
from ctypes import *
from struct import pack, unpack_from
from util import log
tried_loading = False
lib = None
@ -46,6 +47,10 @@ def decompress_yay0(in_bytes, byte_order="big"):
else:
hdr = Yay0.from_buffer_copy(in_bytes, 0)
magic = getattr(hdr, hdr._fields_[0][0])
if magic != int.from_bytes(str.encode("Yay0"), byteorder="big"):
log.error(f"Yay0 magic is incorrect: {magic}")
# create the input/output buffers, copying data to in
src = (c_uint8 * len(in_bytes)).from_buffer_copy(in_bytes, 0)
dst = (c_uint8 * hdr.uncompressedLength)()

View File

@ -1,6 +1,8 @@
#! /usr/bin/python3
from capstone import *
from capstone import Cs, CS_ARCH_MIPS, CS_MODE_MIPS64, CS_MODE_BIG_ENDIAN
from capstone.mips import *
import argparse

View File

@ -3,6 +3,7 @@
import argparse
from capstone import *
from capstone.mips import *
import hashlib
import zlib
parser = argparse.ArgumentParser(description='Gives information on n64 roms')
@ -90,11 +91,15 @@ def get_info_bytes(rom_bytes, encoding):
# if rom_bytes.find(bytes(format, "ASCII")) != -1:
# compression_formats.append(format)
return N64Rom(name, country_code, libultra_version, crc1, crc2, cic, entry_point, len(rom_bytes))
compiler = get_compiler_info(rom_bytes, entry_point, print_result=False)
sha1 = hashlib.sha1(rom_bytes).hexdigest()
return N64Rom(name, country_code, libultra_version, crc1, crc2, cic, entry_point, len(rom_bytes), compiler, sha1)
class N64Rom:
def __init__(self, name, country_code, libultra_version, crc1, crc2, cic, entry_point, size):
def __init__(self, name, country_code, libultra_version, crc1, crc2, cic, entry_point, size, compiler, sha1):
self.name = name
self.country_code = country_code
self.libultra_version = libultra_version
@ -103,11 +108,13 @@ class N64Rom:
self.cic = cic
self.entry_point = entry_point
self.size = size
self.compiler = compiler
self.sha1 = sha1
def get_country_name(self):
return country_codes[self.country_code]
def get_compiler_info(rom_bytes, entry_point):
def get_compiler_info(rom_bytes, entry_point, print_result=True):
md = Cs(CS_ARCH_MIPS, CS_MODE_MIPS64 + CS_MODE_BIG_ENDIAN)
md.detail = True
@ -121,8 +128,9 @@ def get_compiler_info(rom_bytes, entry_point):
branches += 1
compiler = "IDO" if branches > jumps else "GCC"
if (print_result):
print(f"{branches} branches and {jumps} jumps detected in the first code segment. Compiler is most likely {compiler}")
return compiler
# TODO: support .n64 extension
def main():

View File

@ -32,6 +32,9 @@ def get_platform() -> str:
def get_compiler() -> str:
return opts.get("compiler", "IDO")
def get_header_encoding() -> str:
return opts.get("header_encoding", "ASCII")
def get_subalign() -> int:
return opts.get("subalign", 16)
@ -66,7 +69,7 @@ def get_symbol_addrs_path():
return get_base_path() / opts.get("symbol_addrs_path", "symbol_addrs.txt")
def get_build_path():
return get_base_path() / opts.get("build_path", "build")
return (get_base_path() / opts.get("build_path", "build")).resolve()
def get_ld_script_path():
return get_base_path() / opts.get("ld_script_path", f"{opts.get('basename')}.ld")

View File

@ -37,10 +37,10 @@ def add_file_ext(name: str) -> str:
return name + ".bin"
class N64SegPaperMarioMapFS(N64Segment):
def __init__(self, segment, rom_start, rom_end):
super().__init__(segment, rom_start, rom_end)
def __init__(self, rom_start, rom_end, type, name, vram_start, extract, given_subalign, given_is_overlay, given_dir, args, yaml):
super().__init__(rom_start, rom_end, type, name, vram_start, extract, given_subalign, given_is_overlay, given_dir, args, yaml)
self.files = segment["files"]
self.files = yaml["files"]
def split(self, rom_bytes):
fs_dir = options.get_asset_path() / self.dir / self.name

View File

@ -367,9 +367,10 @@ CHARSET_CREDITS = {
}
class N64SegPaperMarioMessages(N64Segment):
def __init__(self, segment, rom_start, rom_end):
super().__init__(segment, rom_start, rom_end)
self.files = segment.get("files", []) if type(segment) is dict else []
def __init__(self, rom_start, rom_end, type, name, vram_start, extract, given_subalign, given_is_overlay, given_dir, args, yml):
super().__init__(rom_start, rom_end, type, name, vram_start, extract, given_subalign, given_is_overlay, given_dir, args, yml)
self.files = yml.get("files", []) if isinstance(yml, dict) else []
with (Path(__file__).parent / f"{self.name}.yaml").open("r") as f:
self.msg_names = yaml.load(f.read(), Loader=yaml.SafeLoader)
@ -493,4 +494,4 @@ class N64SegPaperMarioMessages(N64Segment):
self.root_charset = CHARSET
def cache(self):
return (self.config, self.rom_end, self.msg_names)
return (self.yaml, self.rom_end, self.msg_names)

View File

@ -7,6 +7,7 @@ from util.color import unpack_color
from util import options
import png
import xml.etree.ElementTree as ET
import struct
import pylibyaml
import yaml
@ -252,10 +253,10 @@ class Component:
class N64SegPaperMarioNpcSprites(N64Segment):
DEFAULT_SPRITE_NAMES = [f"{i:02X}" for i in range(0xEA)]
def __init__(self, segment, rom_start, rom_end):
super().__init__(segment, rom_start, rom_end)
def __init__(self, rom_start, rom_end, type, name, vram_start, extract, given_subalign, given_is_overlay, given_dir, args, yml):
super().__init__(rom_start, rom_end, type, name, vram_start, extract, given_subalign, given_is_overlay, given_dir, args, yml)
self.files = segment["files"]
self.files = yml["files"]
with (Path(__file__).parent / f"{self.name}.yaml").open("r") as f:
self.sprite_cfg = yaml.load(f.read(), Loader=yaml.SafeLoader)
@ -295,4 +296,4 @@ class N64SegPaperMarioNpcSprites(N64Segment):
return [LinkerEntry(self, out_paths, basepath, ".data")]
def cache(self):
return (self.config, self.rom_end, self.sprite_cfg)
return (self.yaml, self.rom_end, self.sprite_cfg)

View File

@ -23,6 +23,8 @@ elf_symbols = []
ignores = set()
verbose = False
def read_ignores():
with open(ignores_path) as f:
lines = f.readlines()

File diff suppressed because one or more lines are too long

View File

@ -1,6 +0,0 @@
.include "macro.inc"
.section .data
glabel D_802B6300_E248D0
.word 0x000A0002, 0x000A002B, 0x000A002D, 0x000A002F, 0x000A0031, 0x000A0033, 0x000A0035, 0x000A0037, 0x000A0039, 0x000A003B, 0x000A003D, 0x000A003F, 0x000A0041, 0x000A0043, 0x000A0045, 0x000A0047, 0x000A0049, 0x000A004B, 0x000A004D, 0x00000000

View File

@ -4,6 +4,3 @@
glabel D_802B6DB0_E25C80
.word D_802B6E90_E2A300, 0x00000000, 0x00000000, 0x00000000
glabel D_802B6DC0_E25C90
.word 0x802B6010, 0x802B6040, 0x802B6010, 0x802B6040, 0x802B6010, 0x802B6040, 0x802B6010, 0x802B6040, 0x802B6010, 0x802B6040, 0x802B6010, 0x00000000

View File

@ -21,7 +21,7 @@ glabel D_80241A70_B29AA0
.word 0x00000005, 0x00000001, 0x00000000, 0x00000043, 0x00000003, PlayerFaceNpc, 0xFFFFFFFF, 0x00000000, 0x00000008, 0x00000001, 0x00000001, 0x00000006, 0x00000000, 0x00000002, 0x00000000, 0x00000001, 0x00000000
glabel D_80241AB4_B29AE4
.word 0x00000045, 0x00000002, D_80241A70_B29AA0, 0xFE363C89, 0x00000043, 0x00000004, SetNpcFlagBits, 0xFFFFFFFF, 0x00000140, 0x00000001, 0x00000043, 0x00000003, SetNpcAnimation, 0xFFFFFFFF, 0x00B60006, 0x00000043, 0x00000003, SetNpcSpeed, 0xFFFFFFFF, 0xF24A8C80, 0x00000043, 0x00000004, GetPlayerPos, 0xFE363C80, 0xFE363C81, 0xFE363C82, 0x00000027, 0x00000002, 0xFE363C80, 0x00000096, 0x00000043, 0x00000005, NpcMoveTo, 0xFFFFFFFF, 0xFE363C80, 0x0000003C, 0x00000000, 0x00000043, 0x00000005, SetNpcPos, 0xFFFFFFFF, 0x00000000, 0xFFFFFC18, 0x00000000, 0x00000043, 0x00000004, SetNpcFlagBits, 0xFFFFFFFF, 0x00000200, 0x00000000, 0x00000049, 0x00000001, 0xFE363C89, 0x00000043, 0x00000001, func_80241170_B291A0, 0x00000043, 0x00000003, ResetCam, 0x00000000, 0xF24A8E80, 0x00000043, 0x00000003, SetSelfVar, 0x00000000, 0x00000003, 0x00000002, 0x00000000, 0x00000001, 0x00000000
.word 0x00000045, 0x00000002, D_80241A70_B29AA0, 0xFE363C89, 0x00000043, 0x00000004, SetNpcFlagBits, 0xFFFFFFFF, 0x00000140, 0x00000001, 0x00000043, 0x00000003, SetNpcAnimation, 0xFFFFFFFF, 0x00B60006, 0x00000043, 0x00000003, SetNpcSpeed, 0xFFFFFFFF, 0xF24A8C80, 0x00000043, 0x00000004, GetPlayerPos, 0xFE363C80, 0xFE363C81, 0xFE363C82, 0x00000027, 0x00000002, 0xFE363C80, 0x00000096, 0x00000043, 0x00000005, NpcMoveTo, 0xFFFFFFFF, 0xFE363C80, 0x0000003C, 0x00000000, 0x00000043, 0x00000005, SetNpcPos, 0xFFFFFFFF, 0x00000000, 0xFFFFFC18, 0x00000000, 0x00000043, 0x00000004, SetNpcFlagBits, 0xFFFFFFFF, 0x00000200, 0x00000000, 0x00000049, 0x00000001, 0xFE363C89, 0x00000043, 0x00000001, jan_01_UnsetCamera0Flag1000, 0x00000043, 0x00000003, ResetCam, 0x00000000, 0xF24A8E80, 0x00000043, 0x00000003, SetSelfVar, 0x00000000, 0x00000003, 0x00000002, 0x00000000, 0x00000001, 0x00000000
glabel D_80241BCC_B29BFC
.word 0x00000043, 0x00000003, SetNpcAnimation, 0xFFFFFFFF, 0x00B6000B, 0x00000043, 0x00000004, SetNpcFlagBits, 0xFFFFFFFF, 0x00000200, 0x00000001, 0x00000005, 0x00000001, 0x00000000, 0x00000008, 0x00000001, 0x00000001, 0x00000043, 0x00000004, GetPlayerPos, 0xFE363C80, 0xFE363C81, 0xFE363C82, 0x0000000D, 0x00000002, 0xFE363C80, 0xFFFFFDA8, 0x00000007, 0x00000000, 0x00000013, 0x00000000, 0x00000006, 0x00000000, 0x00000043, 0x00000002, DisablePlayerInput, 0x00000001, 0x00000043, 0x00000004, ShowMessageAtScreenPos, 0x0010000D, 0x00000140, 0x0000003C, 0x00000043, 0x00000003, PlaySoundAtPlayer, 0x00000262, 0x00000000, 0x00000043, 0x0000000A, ShowEmote, 0x00000000, 0x00000000, 0x00000000, 0x00000019, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000043, 0x00000004, PlaySoundAtNpc, 0xFFFFFFFC, 0x00000262, 0x00000000, 0x00000043, 0x0000000A, ShowEmote, 0xFFFFFFFC, 0x00000000, 0x00000000, 0x00000019, 0x00000001, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000008, 0x00000001, 0x00000019, 0x00000043, 0x00000002, DisablePlayerInput, 0x00000000, 0x00000003, 0x00000001, 0x00000000, 0x00000043, 0x00000003, GetSelfVar, 0x00000000, 0xFE363C80, 0x00000014, 0x00000001, 0xFE363C80, 0x00000016, 0x00000001, 0x00000000, 0x00000043, 0x00000004, GetPlayerPos, 0xFE363C80, 0xFE363C81, 0xFE363C82, 0x0000000D, 0x00000002, 0xFE363C80, 0x000001AE, 0x00000043, 0x00000002, GetCurrentPartner, 0xFE363C80, 0x0000000B, 0x00000002, 0xFE363C80, 0x00000000, 0x00000043, 0x00000001, func_802D2B6C, 0x00000013, 0x00000000, 0x00000043, 0x00000002, DisablePlayerInput, 0x00000001, 0x00000043, 0x00000002, RemoveNpc, 0x00000001, 0x00000043, 0x00000004, ShowMessageAtScreenPos, 0x00100010, 0x00000000, 0x0000003C, 0x00000043, 0x00000003, InterpPlayerYaw, 0x0000010E, 0x00000004, 0x00000043, 0x00000003, SetNpcAnimation, 0xFFFFFFFF, 0x00B60007, 0x00000043, 0x00000005, NpcMoveTo, 0xFFFFFFFF, 0x000000FA, 0x0000005A, 0x00000005, 0x00000043, 0x00000002, func_802CF56C, 0x00000002, 0x00000043, 0x00000004, GetPlayerPos, 0xFE363C80, 0xFE363C81, 0xFE363C82, 0x00000024, 0x00000002, 0xFE363C83, 0xFE363C80, 0x00000027, 0x00000002, 0xFE363C83, 0xFFFFFFCE, 0x00000043, 0x00000003, SetNpcSpeed, 0xFFFFFFFF, 0xF24A8E80, 0x00000043, 0x00000005, NpcMoveTo, 0xFFFFFFFF, 0xFE363C83, 0xFE363C82, 0x00000000, 0x00000027, 0x00000002, 0xFE363C80, 0xFE363C83, 0x0000002A, 0x00000002, 0xFE363C80, 0x00000002, 0x00000043, 0x00000005, UseSettingsFrom, 0x00000000, 0xFE363C80, 0xFE363C81, 0xFE363C82, 0x00000043, 0x00000005, SetPanTarget, 0x00000000, 0xFE363C80, 0xFE363C81, 0xFE363C82, 0x00000043, 0x00000003, SetCamDistance, 0x00000000, 0x0000012C, 0x00000043, 0x00000004, SetCamPitch, 0x00000000, 0xF24ABE80, 0xF24A5E80, 0x00000043, 0x00000003, SetCamSpeed, 0x00000000, 0xF24A8E80, 0x00000043, 0x00000004, PanToTarget, 0x00000000, 0x00000000, 0x00000001, 0x00000043, 0x00000001, func_80241154_B29184, 0x00000043, 0x00000003, WaitForCam, 0x00000000, 0xF24A7E80, 0x00000008, 0x00000001, 0x0000000A, 0x00000043, 0x00000006, SpeakToPlayer, 0xFFFFFFFF, 0x00B60008, 0x00B60001, 0x00000000, 0x00100011, 0x00000024, 0x00000002, 0xF5DE0180, 0x0000000C, 0x00000046, 0x00000001, D_80241AB4_B29AE4, 0x00000043, 0x00000002, DisablePlayerInput, 0x00000000, 0x00000013, 0x00000000, 0x00000016, 0x00000001, 0x00000001, 0x0000004D, 0x00000001, 0x00000000, 0x00000043, 0x00000002, func_802D5830, 0x00000001, 0x00000043, 0x00000002, func_802D2C14, 0x00000001, 0x00000008, 0x00000001, 0x0000000A, 0x00000043, 0x00000006, SpeakToPlayer, 0xFFFFFFFF, 0x00B60009, 0x00B60001, 0x00000000, 0x0010000F, 0x00000024, 0x00000002, 0xF8406044, 0x00000001, 0x00000043, 0x00000003, SetSelfVar, 0x00000000, 0x00000002, 0x00000024, 0x00000002, 0xF5DE0180, 0x0000000C, 0x00000046, 0x00000001, D_80241AB4_B29AE4, 0x00000043, 0x00000002, func_802D2C14, 0x00000000, 0x00000043, 0x00000002, func_802D5830, 0x00000000, 0x0000004D, 0x00000001, 0x0000000B, 0x00000043, 0x00000002, DisablePlayerInput, 0x00000000, 0x00000023, 0x00000000, 0x00000043, 0x00000003, GetSelfVar, 0x00000000, 0xFE363C80, 0x0000000B, 0x00000002, 0xFE363C80, 0x00000003, 0x00000008, 0x00000001, 0x00000001, 0x00000004, 0x00000001, 0x00000000, 0x00000013, 0x00000000, 0x00000002, 0x00000000, 0x00000001, 0x00000000

File diff suppressed because one or more lines are too long

View File

@ -51,7 +51,7 @@ glabel D_80241360_C8D400
.word 0x0000000C, 0x00000002, 0xF5DE0180, 0x00000022, 0x00000043, 0x00000003, BindNpcIdle, 0xFFFFFFFF, D_80240E44_C8CEE4, 0x00000012, 0x00000000, 0x00000043, 0x00000002, RemoveNpc, 0xFFFFFFFF, 0x00000013, 0x00000000, 0x00000002, 0x00000000, 0x00000001, 0x00000000
glabel D_802413B4_C8D454
.word 0x00000003, 0x00000001, 0x00000000, 0x00000008, 0x00000001, 0x00000001, 0x00000043, 0x00000004, GetPlayerPos, 0xFE363C80, 0xFE363C81, 0xFE363C82, 0x0000000D, 0x00000002, 0xFE363C81, 0x00000064, 0x00000004, 0x00000001, 0x00000000, 0x00000013, 0x00000000, 0x0000000C, 0x00000002, 0xFE363C80, 0x00000064, 0x00000004, 0x00000001, 0x00000000, 0x00000013, 0x00000000, 0x00000043, 0x00000002, DisablePlayerInput, 0x00000001, 0x00000043, 0x00000001, func_80240350_C8C3F0, 0x00000043, 0x00000005, UseSettingsFrom, 0x00000000, 0xFE363C80, 0xFE363C81, 0xFE363C82, 0x00000043, 0x00000005, SetPanTarget, 0x00000000, 0x0000011D, 0x00000019, 0x00000023, 0x00000043, 0x00000003, SetCamDistance, 0x00000000, 0x00000190, 0x00000043, 0x00000003, SetCamSpeed, 0x00000000, 0xF24A8480, 0x00000043, 0x00000004, PanToTarget, 0x00000000, 0x00000000, 0x00000001, 0x00000043, 0x00000003, WaitForCam, 0x00000000, 0xF24A7E80, 0x00000008, 0x00000001, 0x0000000A, 0x00000043, 0x00000005, SetNpcPos, 0xFFFFFFFF, 0x0000011D, 0x00000019, 0x00000023, 0x00000043, 0x00000004, PlaySoundAtNpc, 0xFFFFFFFF, 0x00000321, 0x00000000, 0x00000043, 0x00000003, SetNpcAnimation, 0xFFFFFFFF, 0x00360017, 0x00000008, 0x00000001, 0x0000001E, 0x00000043, 0x00000003, SetNpcAnimation, 0xFFFFFFFF, 0x00360001, 0x00000043, 0x00000006, SpeakToPlayer, 0xFFFFFFFF, 0x00360004, 0x00360001, 0x00000000, 0x001000FF, 0x00000008, 0x00000001, 0x0000000A, 0x00000043, 0x00000004, PlaySoundAtNpc, 0xFFFFFFFF, 0x00000322, 0x00000000, 0x00000043, 0x00000003, SetNpcAnimation, 0xFFFFFFFF, 0x00360018, 0x00000008, 0x00000001, 0x00000019, 0x00000043, 0x00000005, SetNpcPos, 0xFFFFFFFF, 0x00000000, 0xFFFFFC18, 0x00000000, 0x00000043, 0x00000001, func_8024036C_C8C40C, 0x00000043, 0x00000003, ResetCam, 0x00000000, 0xF24A8680, 0x00000024, 0x00000002, 0xF840609E, 0x00000001, 0x00000043, 0x00000002, DisablePlayerInput, 0x00000000, 0x00000002, 0x00000000, 0x00000001, 0x00000000
.word 0x00000003, 0x00000001, 0x00000000, 0x00000008, 0x00000001, 0x00000001, 0x00000043, 0x00000004, GetPlayerPos, 0xFE363C80, 0xFE363C81, 0xFE363C82, 0x0000000D, 0x00000002, 0xFE363C81, 0x00000064, 0x00000004, 0x00000001, 0x00000000, 0x00000013, 0x00000000, 0x0000000C, 0x00000002, 0xFE363C80, 0x00000064, 0x00000004, 0x00000001, 0x00000000, 0x00000013, 0x00000000, 0x00000043, 0x00000002, DisablePlayerInput, 0x00000001, 0x00000043, 0x00000001, func_80240350_C8C3F0, 0x00000043, 0x00000005, UseSettingsFrom, 0x00000000, 0xFE363C80, 0xFE363C81, 0xFE363C82, 0x00000043, 0x00000005, SetPanTarget, 0x00000000, 0x0000011D, 0x00000019, 0x00000023, 0x00000043, 0x00000003, SetCamDistance, 0x00000000, 0x00000190, 0x00000043, 0x00000003, SetCamSpeed, 0x00000000, 0xF24A8480, 0x00000043, 0x00000004, PanToTarget, 0x00000000, 0x00000000, 0x00000001, 0x00000043, 0x00000003, WaitForCam, 0x00000000, 0xF24A7E80, 0x00000008, 0x00000001, 0x0000000A, 0x00000043, 0x00000005, SetNpcPos, 0xFFFFFFFF, 0x0000011D, 0x00000019, 0x00000023, 0x00000043, 0x00000004, PlaySoundAtNpc, 0xFFFFFFFF, 0x00000321, 0x00000000, 0x00000043, 0x00000003, SetNpcAnimation, 0xFFFFFFFF, 0x00360017, 0x00000008, 0x00000001, 0x0000001E, 0x00000043, 0x00000003, SetNpcAnimation, 0xFFFFFFFF, 0x00360001, 0x00000043, 0x00000006, SpeakToPlayer, 0xFFFFFFFF, 0x00360004, 0x00360001, 0x00000000, 0x001000FF, 0x00000008, 0x00000001, 0x0000000A, 0x00000043, 0x00000004, PlaySoundAtNpc, 0xFFFFFFFF, 0x00000322, 0x00000000, 0x00000043, 0x00000003, SetNpcAnimation, 0xFFFFFFFF, 0x00360018, 0x00000008, 0x00000001, 0x00000019, 0x00000043, 0x00000005, SetNpcPos, 0xFFFFFFFF, 0x00000000, 0xFFFFFC18, 0x00000000, 0x00000043, 0x00000001, kzn_18_UnsetCamera0Flag1000, 0x00000043, 0x00000003, ResetCam, 0x00000000, 0xF24A8680, 0x00000024, 0x00000002, 0xF840609E, 0x00000001, 0x00000043, 0x00000002, DisablePlayerInput, 0x00000000, 0x00000002, 0x00000000, 0x00000001, 0x00000000
glabel D_80241618_C8D6B8
.word 0x0000000A, 0x00000002, 0xF840609E, 0x00000000, 0x00000043, 0x00000003, BindNpcIdle, 0xFFFFFFFF, D_802413B4_C8D454, 0x00000012, 0x00000000, 0x00000043, 0x00000002, RemoveNpc, 0xFFFFFFFF, 0x00000013, 0x00000000, 0x00000002, 0x00000000, 0x00000001, 0x00000000

File diff suppressed because one or more lines are too long

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