Item funcs & ctx fixes (#649)

* stuffs

* func_80136A08

* C50A0

* WIP

* clean

* fix context issues

* clean
This commit is contained in:
Ethan Roseman 2022-02-17 12:11:27 -05:00 committed by GitHub
parent 32d2fde8e4
commit d02e72e78f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
12 changed files with 251 additions and 371 deletions

View File

@ -100,8 +100,7 @@ extern OSIntMask __OSGlobalIntMask; /* global interrupt mask */
* Function prototypes * Function prototypes
* *
*/ */
//extern void osInitialize(void);
extern void osInitialize(void);
extern void osExit(void); extern void osExit(void);
extern u32 osGetMemSize(void); extern u32 osGetMemSize(void);

View File

@ -1115,11 +1115,11 @@ typedef struct ItemData {
typedef struct ItemEntity { typedef struct ItemEntity {
/* 0x00 */ s32 flags; /* 0x00 */ s32 flags;
/* 0x04 */ s16 boundVar; /* see make_item_entity */ /* 0x04 */ s16 boundVar; /* see make_item_entity */
/* 0x06 */ char unk_06[2]; /* 0x06 */ s16 unk_06;
/* 0x08 */ Vec3f position; /* 0x08 */ Vec3f position;
/* 0x14 */ struct ItemEntityPhysicsData* physicsData; /* 0x14 */ struct ItemEntityPhysicsData* physicsData;
/* 0x18 */ s16 itemID; /* into item table, also worldIconID */ /* 0x18 */ s16 itemID; /* into item table, also worldIconID */
/* 0x1A */ u8 state; /* 0x1A */ s8 state;
/* 0x1B */ s8 type; /* 0x1B */ s8 type;
/* 0x1C */ u8 pickupDelay; /* num frames before item can be picked up */ /* 0x1C */ u8 pickupDelay; /* num frames before item can be picked up */
/* 0x1D */ char unk_1D; /* 0x1D */ char unk_1D;
@ -1451,12 +1451,13 @@ typedef struct PushBlockGrid {
typedef struct ItemEntityPhysicsData { typedef struct ItemEntityPhysicsData {
/* 0x00 */ f32 verticalVelocity; /* 0x00 */ f32 verticalVelocity;
/* 0x04 */ f32 gravity; /* 2 = normal, 1 = low gravity, higher values never 'settle' */ /* 0x04 */ f32 gravity; /* 2 = normal, 1 = low gravity, higher values never 'settle' */
/* 0x08 */ char unk_08[4]; /* 0x08 */ f32 unk_08;
/* 0x0C */ f32 constVelocity; /* 0x0C */ f32 constVelocity;
/* 0x10 */ f32 velx; /* 0x10 */ f32 velx;
/* 0x14 */ f32 velz; /* 0x14 */ f32 velz;
/* 0x18 */ f32 moveAngle; /* 0x18 */ f32 moveAngle;
/* 0x1C */ char unk_1C[8]; /* 0x1C */ s32 unk_1C;
/* 0x20 */ s32 unk_20;
} ItemEntityPhysicsData; // size = 0x24 } ItemEntityPhysicsData; // size = 0x24
typedef struct RenderTask { typedef struct RenderTask {
@ -2152,7 +2153,7 @@ typedef union {
int i; int i;
void (*func)(s32 windowIndex, s32* flags, s32* posX, s32* posY, s32* posZ, f32* scaleX, f32* scaleY, void (*func)(s32 windowIndex, s32* flags, s32* posX, s32* posY, s32* posZ, f32* scaleX, f32* scaleY,
f32* rotX, f32* rotY, f32* rotZ, s32* darkening, s32* opacity); f32* rotX, f32* rotY, f32* rotZ, s32* darkening, s32* opacity);
} WindowUpdateFunc __attribute__((transparent_union)); } WindowUpdateFunc TRANSPARENT_UNION;
typedef struct MenuWindowBP { typedef struct MenuWindowBP {
/* 0x00 */ s8 windowID; /* 0x00 */ s8 windowID;

View File

@ -90,7 +90,9 @@ typedef void *__gnuc_va_list;
(AP = ((__gnuc_va_list) __builtin_next_arg (LASTARG))) (AP = ((__gnuc_va_list) __builtin_next_arg (LASTARG)))
#undef va_end #undef va_end
#ifndef M2CTX
void va_end (__gnuc_va_list); /* Defined in libgcc.a */ void va_end (__gnuc_va_list); /* Defined in libgcc.a */
#endif
#define va_end(AP) ((void)0) #define va_end(AP) ((void)0)
/* We cast to void * and then to TYPE * because this avoids /* We cast to void * and then to TYPE * because this avoids

View File

@ -1,4 +1,5 @@
#include "common.h" #include "common.h"
#include "effects.h"
#define MAX_ITEM_ENTITIES 256 #define MAX_ITEM_ENTITIES 256
@ -14,8 +15,12 @@ extern s16 D_80155D8C;
extern s16 D_80155D8E; extern s16 D_80155D8E;
extern s16 D_80155D90; extern s16 D_80155D90;
void item_entity_load(ItemEntity* itemEntity);
void draw_item_entities(void); void draw_item_entities(void);
void func_80132D94(void); void func_80132D94(void);
void func_8013559C(ItemEntity* itemEntity);
void func_801356C4(void);
void func_801356D4(void);
INCLUDE_ASM(s32, "C50A0", draw_ci_image_with_clipping); INCLUDE_ASM(s32, "C50A0", draw_ci_image_with_clipping);
@ -181,11 +186,69 @@ INCLUDE_ASM(s32, "C50A0", item_entity_update);
INCLUDE_ASM(s32, "C50A0", update_item_entities); INCLUDE_ASM(s32, "C50A0", update_item_entities);
INCLUDE_ASM(s32, "C50A0", appendGfx_item_entity); INCLUDE_ASM(s32, "C50A0", appendGfx_item_entity);
void appendGfx_item_entity(ItemEntity* itemEntity); void appendGfx_item_entity(void* itemEntity);
INCLUDE_ASM(s32, "C50A0", draw_item_entities); void draw_item_entities(void) {
RenderTask rt;
RenderTask* rtPtr = &rt;
RenderTask* retTask;
s32 i;
INCLUDE_ASM(s32, "C50A0", func_80132D94); for (i = 0; i < MAX_ITEM_ENTITIES; i++) {
ItemEntity* itemEntity = D_801565A0[i];
if (itemEntity != NULL && itemEntity->flags != 0 && !(itemEntity->flags & 0x40) &&
(itemEntity->flags & (1 << gCurrentCamID)) && !(itemEntity->flags & 0x100000) &&
!(itemEntity->unk_1D != -1 && D_80155D88 != itemEntity->unk_1D))
{
if (!(itemEntity->flags & 0x80000)) {
rtPtr->renderMode = RENDER_MODE_ALPHATEST;
} else {
rtPtr->renderMode = RENDER_MODE_SURFACE_XLU_LAYER1;
}
rtPtr->appendGfxArg = itemEntity;
rtPtr->appendGfx = appendGfx_item_entity;
rtPtr->distance = 0;
retTask = queue_render_task(rtPtr);
retTask->renderMode |= RENDER_MODE_2;
}
do {} while (0); // required to match
}
}
void func_80132D94(void) {
if (!(gOverrideFlags & 0xC000)) {
s32 i;
for (i = 0; i < MAX_ITEM_ENTITIES; i++) {
ItemEntity* itemEntity = D_801565A0[i];
if (itemEntity != NULL && itemEntity->flags != 0) {
switch (itemEntity->type) {
case 0:
func_801356C4();
break;
case 1:
case 2:
func_801356D4();
break;
case 3:
case 12:
case 16:
case 20:
case 23:
func_8013559C(itemEntity);
break;
}
}
do {} while (0); // required to match
}
}
}
INCLUDE_ASM(s32, "C50A0", render_item_entities); INCLUDE_ASM(s32, "C50A0", render_item_entities);
@ -263,7 +326,9 @@ s32 test_item_entity_position(f32 x, f32 y, f32 z, f32 dist) {
f32 dx, dy, dz; f32 dx, dy, dz;
s32 i; s32 i;
if (is_starting_conversation() || D_801565A4 || get_time_freeze_mode() || gOverrideFlags & GLOBAL_OVERRIDES_CANT_PICK_UP_ITEMS) { if (is_starting_conversation() || D_801565A4 || get_time_freeze_mode() != 0 ||
gOverrideFlags & GLOBAL_OVERRIDES_CANT_PICK_UP_ITEMS)
{
return -1; return -1;
} }
@ -353,7 +418,29 @@ s32 func_80134240(void) {
INCLUDE_ASM(s32, "C50A0", update_item_entity_collectable); INCLUDE_ASM(s32, "C50A0", update_item_entity_collectable);
INCLUDE_ASM(s32, "C50A0", func_8013559C); void func_8013559C(ItemEntity* itemEntity) {
if (itemEntity->state == 1) {
ItemEntityPhysicsData* physicsData = itemEntity->physicsData;
s32 flag = (itemEntity->flags & 0x20000) > 0;
if (itemEntity->type != 0x14) {
if (itemEntity->type != 0x17) {
if (physicsData->unk_1C < 60) {
if ((itemEntity->flags & 0x200000) || ((gGameStatusPtr->frameCounter + flag) & 1)) {
itemEntity->flags &= ~0x40;
} else {
itemEntity->flags |= 0x40;
}
}
} else {
if (physicsData->unk_1C < 0xA) {
itemEntity->unk_2F = physicsData->unk_1C * 28;
itemEntity->flags |= 0x80000;
}
}
}
}
}
void update_item_entity_static(ItemEntity* itemEntity) { void update_item_entity_static(ItemEntity* itemEntity) {
if ((s8)itemEntity->state == 0 && test_item_player_collision(itemEntity)) { if ((s8)itemEntity->state == 0 && test_item_player_collision(itemEntity)) {
@ -384,4 +471,17 @@ void func_801369D0(s32 arg1, s32 x, s32 y) {
draw_msg(0x1D0060, x + 12, y + 4, 255, 52, 0); draw_msg(0x1D0060, x + 12, y + 4, 255, 52, 0);
} }
INCLUDE_ASM(s32, "C50A0", func_80136A08); void func_80136A08(ItemEntity* itemEntity, s32 posX, s32 arg2) {
ItemData* itemData = &gItemTable[itemEntity->itemID];
s32 itemMsg;
switch (itemEntity->state) {
case 2:
case 3:
case 10:
case 11:
itemMsg = itemData->itemMsg;
draw_msg(itemMsg, posX + 8, arg2, 255, 0xA, 0);
break;
}
}

View File

@ -1,4 +1,6 @@
#include "common.h" #include "common.h"
#include "sprite.h"
#include "nu/nusys.h"
extern SpriteShadingProfile D_801595C0; extern SpriteShadingProfile D_801595C0;
extern SpriteShadingProfile D_80159670; extern SpriteShadingProfile D_80159670;

View File

@ -5,25 +5,29 @@
EvtScript N(ExitWest) = EXIT_WALK_SCRIPT(60, 0, "kmr_07", 1); EvtScript N(ExitWest) = EXIT_WALK_SCRIPT(60, 0, "kmr_07", 1);
EvtScript N(ExitEast) = EXIT_WALK_SCRIPT(60, 1, "kmr_11", 0); EvtScript N(ExitEast) = EXIT_WALK_SCRIPT(60, 1, "kmr_11", 0);
EvtScript N(BindExits) = SCRIPT({ EvtScript N(BindExits) = {
bind N(ExitWest) TRIGGER_FLOOR_ABOVE 0; // deili1 EVT_BIND_TRIGGER(N(ExitWest), TRIGGER_FLOOR_ABOVE, 0, 1, 0) // deili1
bind N(ExitEast) TRIGGER_FLOOR_ABOVE 3; // deili2 EVT_BIND_TRIGGER(N(ExitEast), TRIGGER_FLOOR_ABOVE, 3, 1, 0) // deili2
}); EVT_RETURN
EVT_END
};
EvtScript N(main) = SCRIPT({ EvtScript N(main) = {
EVT_WORLD_LOCATION = LOCATION_GOOMBA_ROAD; EVT_SET(EVT_WORLD_LOCATION, LOCATION_GOOMBA_ROAD)
SetSpriteShading(-1); EVT_CALL(SetSpriteShading, -1)
SetCamPerspective(0, 3, 25, 16, 4096); EVT_CALL(SetCamPerspective, 0, 3, 25, 16, 4096)
SetCamBGColor(0, 0, 0, 0); EVT_CALL(SetCamBGColor, 0, 0, 0, 0)
SetCamEnabled(0, 1); EVT_CALL(SetCamEnabled, 0, 1)
MakeNpcs(0, N(npcGroupList)); EVT_CALL(MakeNpcs, 0, EVT_ADDR(N(npcGroupList)))
await N(MakeEntities); EVT_EXEC_WAIT(N(MakeEntities))
spawn N(PlayMusic); EVT_EXEC(N(PlayMusic))
EVT_VAR(0) = N(BindExits); EVT_SET(LW(0), EVT_ADDR(N(BindExits)))
spawn EnterWalk; EVT_EXEC(EnterWalk)
sleep 1; EVT_WAIT_FRAMES(1)
bind N(ReadWestSign) TRIGGER_WALL_PRESS_A 10; EVT_BIND_TRIGGER(N(ReadWestSign), TRIGGER_WALL_PRESS_A, 10, 1, 0)
}); EVT_RETURN
EVT_END
};
NpcAISettings N(goombaAISettings) = { NpcAISettings N(goombaAISettings) = {
.moveSpeed = 1.5f, .moveSpeed = 1.5f,
@ -40,9 +44,11 @@ NpcAISettings N(goombaAISettings) = {
.unk_2C = TRUE, .unk_2C = TRUE,
}; };
EvtScript N(GoombaAI) = SCRIPT({ EvtScript kmr_12_GoombaAI = {
DoBasicAI(N(goombaAISettings)); EVT_CALL(DoBasicAI, EVT_ADDR(N(goombaAISettings)))
}); EVT_RETURN
EVT_END
};
NpcSettings N(goombaNpcSettings) = { NpcSettings N(goombaNpcSettings) = {
.height = 20, .height = 20,
@ -54,101 +60,104 @@ NpcSettings N(goombaNpcSettings) = {
}; };
/// @bug Never returns /// @bug Never returns
EvtScript N(ReadWestSign) = SCRIPT({ EvtScript N(ReadWestSign) = {
group 0; EVT_SET_GROUP(0)
// "Eat a Mushroom to regain your energy!" // "Eat a Mushroom to regain your energy!"
suspend group 1; EVT_SUSPEND_GROUP(1)
DisablePlayerInput(TRUE); EVT_CALL(DisablePlayerInput, TRUE)
ShowMessageAtScreenPos(MSG_kmr_12_sign_trap, 160, 40); EVT_CALL(ShowMessageAtScreenPos, MSG_kmr_12_sign_trap, 160, 40)
resume group 1; EVT_RESUME_GROUP(1)
EVT_FLAG(0) = FALSE; EVT_SET(LF(0), FALSE)
GetGoomba(); EVT_CALL(GetGoomba)
if (EVT_VAR(0) != FALSE) { EVT_IF_NE(LW(0), FALSE)
GetNpcVar(NPC_GOOMBA, 0, EVT_VAR(0)); EVT_CALL(GetNpcVar, NPC_GOOMBA, 0, LW(0))
if (EVT_VAR(0) == FALSE) { EVT_IF_EQ(LW(0), FALSE)
// Trigger Goomba to peel off // Trigger Goomba to peel off
SetNpcVar(NPC_GOOMBA, 0, TRUE); EVT_CALL(SetNpcVar, NPC_GOOMBA, 0, TRUE)
EVT_FLAG(0) = TRUE; EVT_SET(LF(0), TRUE)
sleep 10; EVT_WAIT_FRAMES(10)
} EVT_END_IF
} EVT_END_IF
DisablePlayerInput(FALSE); EVT_CALL(DisablePlayerInput, FALSE)
if (EVT_FLAG(0) == TRUE) { EVT_IF_EQ(LF(0), TRUE)
unbind; EVT_UNBIND
} EVT_END_IF
EVT_END
EVT_RETURN
};
break; EvtScript N(GoombaIdle) = {
return; EVT_WAIT_FRAMES(1)
});
EvtScript N(GoombaIdle) = SCRIPT({ EVT_CALL(SetSelfVar, 0, FALSE)
sleep 1; EVT_CALL(SetNpcAnimation, NPC_SELF, NPC_ANIM_goomba_normal_fake_mushroom) // TODO: work out why palette 0 is used here
EVT_CALL(EnableNpcShadow, NPC_SELF, FALSE)
SetSelfVar(0, FALSE); EVT_CALL(SetSelfEnemyFlagBits, NPC_FLAG_NO_AI, TRUE)
SetNpcAnimation(NPC_SELF, NPC_ANIM_goomba_normal_fake_mushroom); // TODO: work out why palette 0 is used here
EnableNpcShadow(NPC_SELF, FALSE);
SetSelfEnemyFlagBits(NPC_FLAG_NO_AI, TRUE);
// Wait until read_sign sets NPC var 0 // Wait until read_sign sets NPC var 0
0: EVT_LABEL(0)
GetSelfVar(0, EVT_VAR(0)); EVT_CALL(GetSelfVar, 0, LW(0))
sleep 1; EVT_WAIT_FRAMES(1)
if (EVT_VAR(0) == FALSE) { EVT_IF_EQ(LW(0), FALSE)
goto 0; EVT_GOTO(0)
} EVT_END_IF
// Peel and jump off the sign // Peel and jump off the sign
SetNpcFlagBits(NPC_SELF, 0x240000, TRUE); EVT_CALL(SetNpcFlagBits, NPC_SELF, NPC_FLAG_40000 | NPC_FLAG_200000, TRUE)
sleep 3; EVT_WAIT_FRAMES(3)
EVT_VAR(0) = 0.0; EVT_SETF(LW(0), EVT_FLOAT(0.0))
loop 9 { EVT_LOOP(9)
EVT_VAR(0) += 10.0; EVT_ADDF(LW(0), EVT_FLOAT(10.0))
SetNpcRotation(NPC_SELF, 0, EVT_VAR(0), 0); EVT_CALL(SetNpcRotation, NPC_SELF, 0, LW(0), 0)
sleep 1; EVT_WAIT_FRAMES(1)
} EVT_END_LOOP
SetNpcAnimation(NPC_SELF, NPC_ANIM_goomba_normal_still); EVT_CALL(SetNpcAnimation, NPC_SELF, NPC_ANIM_goomba_normal_still)
loop 9 { EVT_LOOP(9)
EVT_VAR(0) += 10.0; EVT_ADDF(LW(0), EVT_FLOAT(10.0))
SetNpcRotation(NPC_SELF, 0, EVT_VAR(0), 0); EVT_CALL(SetNpcRotation, NPC_SELF, 0, LW(0), 0)
sleep 1; EVT_WAIT_FRAMES(1)
} EVT_END_LOOP
SetNpcAnimation(NPC_SELF, NPC_ANIM_goomba_normal_dizzy); EVT_CALL(SetNpcAnimation, NPC_SELF, NPC_ANIM_goomba_normal_dizzy)
sleep 20; EVT_WAIT_FRAMES(20)
SetNpcAnimation(NPC_SELF, NPC_ANIM_goomba_normal_idle); EVT_CALL(SetNpcAnimation, NPC_SELF, NPC_ANIM_goomba_normal_idle)
PlaySoundAtNpc(NPC_SELF, 248, 0); EVT_CALL(PlaySoundAtNpc, NPC_SELF, 0xF8, 0)
func_802CFE2C(NPC_SELF, 8192); EVT_CALL(func_802CFE2C, NPC_SELF, 8192)
func_802CFD30(NPC_SELF, 5, 6, 1, 1, 0); EVT_CALL(func_802CFD30, NPC_SELF, 5, 6, 1, 1, 0)
sleep 12; EVT_WAIT_FRAMES(12)
sleep 5; EVT_WAIT_FRAMES(5)
PlaySoundAtNpc(NPC_SELF, 812, 0); EVT_CALL(PlaySoundAtNpc, NPC_SELF, 0x32C, 0)
EnableNpcShadow(NPC_SELF, TRUE); EVT_CALL(EnableNpcShadow, NPC_SELF, TRUE)
SetNpcJumpscale(NPC_SELF, 0.6); EVT_CALL(SetNpcJumpscale, NPC_SELF, EVT_FLOAT(0.6))
NpcJump0(NPC_SELF, -35, 0, 30, 23); EVT_CALL(NpcJump0, NPC_SELF, -35, 0, 30, 23)
func_802CFD30(NPC_SELF, 0, 0, 0, 0, 0); EVT_CALL(func_802CFD30, NPC_SELF, 0, 0, 0, 0, 0)
InterpNpcYaw(NPC_SELF, 90, 0); EVT_CALL(InterpNpcYaw, NPC_SELF, 90, 0)
SetNpcFlagBits(NPC_SELF, 0x240000, FALSE); EVT_CALL(SetNpcFlagBits, NPC_SELF, NPC_FLAG_40000 | NPC_FLAG_200000, FALSE)
SetSelfEnemyFlagBits(NPC_FLAG_NO_AI, FALSE); EVT_CALL(SetSelfEnemyFlagBits, NPC_FLAG_NO_AI, FALSE)
SetSelfEnemyFlagBits(NPC_FLAG_NO_ANIMS_LOADED, TRUE); EVT_CALL(SetSelfEnemyFlagBits, NPC_FLAG_NO_ANIMS_LOADED, TRUE)
// We're done jumping off; the player can read the sign again // We're done jumping off; the player can read the sign again
bind N(ReadWestSign) TRIGGER_WALL_PRESS_A 10; EVT_BIND_TRIGGER(N(ReadWestSign), TRIGGER_WALL_PRESS_A, 10, 1, 0)
// Behave like a normal enemy from now on // Behave like a normal enemy from now on
BindNpcAI(NPC_SELF, N(GoombaAI)); EVT_CALL(BindNpcAI, NPC_SELF, EVT_ADDR(N(GoombaAI)))
}); EVT_RETURN
EVT_END
};
EvtScript N(GoombaInit) = SCRIPT({ EvtScript N(GoombaInit) = {
BindNpcIdle(NPC_SELF, N(GoombaIdle)); EVT_CALL(BindNpcIdle, NPC_SELF, EVT_ADDR(N(GoombaIdle)))
}); EVT_RETURN
EVT_END
};
StaticNpc N(goombaNpc) = { StaticNpc N(goombaNpc) = {
.id = NPC_GOOMBA, .id = NPC_GOOMBA,
.settings = &N(goombaNpcSettings), .settings = &N(goombaNpcSettings),
.pos = { -33.0f, 30.0f, -25.0f }, .pos = { -33.0f, 30.0f, -25.0f },
.flags = 0x00000C00, .flags = 0x00000C00,
.init = N(GoombaInit), .init = &N(GoombaInit),
.yaw = 90, .yaw = 90,
.dropFlags = NPC_DROP_FLAGS_80, .dropFlags = NPC_DROP_FLAGS_80,
.itemDropChance = 5, .itemDropChance = 5,
@ -194,22 +203,24 @@ NpcGroupList N(npcGroupList) = {
{}, {},
}; };
EvtScript N(ReadEastSign) = SCRIPT({ EvtScript N(ReadEastSign) = {
IsStartingConversation($a); EVT_CALL(IsStartingConversation, LW(0))
if ($a == 1) { EVT_IF_EQ(LW(0), 1)
return; EVT_RETURN
} EVT_END_IF
EVT_SET_GROUP(0)
EVT_CALL(SetTimeFreezeMode, 1)
EVT_CALL(DisablePlayerInput, TRUE)
EVT_CALL(ShowMessageAtScreenPos, MSG_kmr_12_sign_to_fortress, 160, 40)
EVT_CALL(DisablePlayerInput, FALSE)
EVT_CALL(SetTimeFreezeMode, 0)
EVT_RETURN
EVT_END
};
group 0; EvtScript N(MakeEntities) = {
EVT_CALL(MakeEntity, EVT_ADDR(D_802EAFDC), 436, 0, -42, 0, MAKE_ENTITY_END)
SetTimeFreezeMode(1); EVT_CALL(AssignScript, EVT_ADDR(N(ReadEastSign)))
DisablePlayerInput(TRUE); EVT_RETURN
ShowMessageAtScreenPos(MSG_kmr_12_sign_to_fortress, 160, 40); EVT_END
DisablePlayerInput(FALSE); };
SetTimeFreezeMode(0);
});
EvtScript N(MakeEntities) = SCRIPT({
MakeEntity(0x802EAFDC, 436, 0, -42, 0, MAKE_ENTITY_END);
AssignScript(N(ReadEastSign));
});

View File

@ -12,11 +12,10 @@
#define GetGoomba N(GetGoomba) #define GetGoomba N(GetGoomba)
ApiStatus GetGoomba(Evt* script, s32 isInitialCall); ApiStatus GetGoomba(Evt* script, s32 isInitialCall);
extern MapConfig N(config); extern EvtScript N(main);
extern EvtScript N(main); extern EvtScript N(PlayMusic);
extern EvtScript N(PlayMusic); extern EvtScript N(MakeEntities);
extern EvtScript N(MakeEntities); extern EvtScript N(ReadWestSign);
extern EvtScript N(ReadWestSign);
extern NpcGroupList N(npcGroupList); extern NpcGroupList N(npcGroupList);
extern s32 D_802EAFDC; extern s32 D_802EAFDC;

View File

@ -18,12 +18,11 @@ CPP_FLAGS = [
"-D_LANGUAGE_C", "-D_LANGUAGE_C",
"-DF3DEX_GBI_2", "-DF3DEX_GBI_2",
"-D_MIPS_SZLONG=32", "-D_MIPS_SZLONG=32",
"-DSCRIPT(...)={}" "-DSCRIPT(test...)={}"
"-D__attribute__(...)=", "-D__attribute__(test...)=",
"-D__asm__(...)=", "-D__asm__(test...)=",
"-ffreestanding", "-ffreestanding",
"-DM2CTX", "-DM2CTX",
"-DPERMUTER",
] ]
def import_c_file(in_file) -> str: def import_c_file(in_file) -> str:

View File

@ -1,78 +0,0 @@
.set noat # allow manual use of $at
.set noreorder # don't insert nops after branches
glabel draw_item_entities
/* C9380 80132C80 27BDFFC0 */ addiu $sp, $sp, -0x40
/* C9384 80132C84 AFB00020 */ sw $s0, 0x20($sp)
/* C9388 80132C88 27B00010 */ addiu $s0, $sp, 0x10
/* C938C 80132C8C AFB10024 */ sw $s1, 0x24($sp)
/* C9390 80132C90 0000882D */ daddu $s1, $zero, $zero
/* C9394 80132C94 AFB50034 */ sw $s5, 0x34($sp)
/* C9398 80132C98 24150001 */ addiu $s5, $zero, 1
/* C939C 80132C9C AFB40030 */ sw $s4, 0x30($sp)
/* C93A0 80132CA0 3C140010 */ lui $s4, 0x10
/* C93A4 80132CA4 AFB3002C */ sw $s3, 0x2c($sp)
/* C93A8 80132CA8 2413FFFF */ addiu $s3, $zero, -1
/* C93AC 80132CAC AFB20028 */ sw $s2, 0x28($sp)
/* C93B0 80132CB0 3C120008 */ lui $s2, 8
/* C93B4 80132CB4 AFBF0038 */ sw $ra, 0x38($sp)
.L80132CB8:
/* C93B8 80132CB8 3C038015 */ lui $v1, %hi(D_801565A0)
/* C93BC 80132CBC 8C6365A0 */ lw $v1, %lo(D_801565A0)($v1)
/* C93C0 80132CC0 00111080 */ sll $v0, $s1, 2
/* C93C4 80132CC4 00431021 */ addu $v0, $v0, $v1
/* C93C8 80132CC8 8C450000 */ lw $a1, ($v0)
/* C93CC 80132CCC 50A00025 */ beql $a1, $zero, .L80132D64
/* C93D0 80132CD0 26310001 */ addiu $s1, $s1, 1
/* C93D4 80132CD4 8CA40000 */ lw $a0, ($a1)
/* C93D8 80132CD8 10800021 */ beqz $a0, .L80132D60
/* C93DC 80132CDC 30820040 */ andi $v0, $a0, 0x40
/* C93E0 80132CE0 54400020 */ bnel $v0, $zero, .L80132D64
/* C93E4 80132CE4 26310001 */ addiu $s1, $s1, 1
/* C93E8 80132CE8 3C02800A */ lui $v0, %hi(gCurrentCamID)
/* C93EC 80132CEC 8442A634 */ lh $v0, %lo(gCurrentCamID)($v0)
/* C93F0 80132CF0 00551004 */ sllv $v0, $s5, $v0
/* C93F4 80132CF4 00821024 */ and $v0, $a0, $v0
/* C93F8 80132CF8 10400019 */ beqz $v0, .L80132D60
/* C93FC 80132CFC 00941024 */ and $v0, $a0, $s4
/* C9400 80132D00 54400018 */ bnel $v0, $zero, .L80132D64
/* C9404 80132D04 26310001 */ addiu $s1, $s1, 1
/* C9408 80132D08 80A3001D */ lb $v1, 0x1d($a1)
/* C940C 80132D0C 10730006 */ beq $v1, $s3, .L80132D28
/* C9410 80132D10 00921024 */ and $v0, $a0, $s2
/* C9414 80132D14 3C028015 */ lui $v0, %hi(D_80155D88)
/* C9418 80132D18 8C425D88 */ lw $v0, %lo(D_80155D88)($v0)
/* C941C 80132D1C 54430011 */ bnel $v0, $v1, .L80132D64
/* C9420 80132D20 26310001 */ addiu $s1, $s1, 1
/* C9424 80132D24 00921024 */ and $v0, $a0, $s2
.L80132D28:
/* C9428 80132D28 14400002 */ bnez $v0, .L80132D34
/* C942C 80132D2C 24020011 */ addiu $v0, $zero, 0x11
/* C9430 80132D30 2402000D */ addiu $v0, $zero, 0xd
.L80132D34:
/* C9434 80132D34 AE020000 */ sw $v0, ($s0)
/* C9438 80132D38 3C028013 */ lui $v0, %hi(appendGfx_item_entity)
/* C943C 80132D3C 244221A4 */ addiu $v0, $v0, %lo(appendGfx_item_entity)
/* C9440 80132D40 0200202D */ daddu $a0, $s0, $zero
/* C9444 80132D44 AE050008 */ sw $a1, 8($s0)
/* C9448 80132D48 AE02000C */ sw $v0, 0xc($s0)
/* C944C 80132D4C 0C047644 */ jal queue_render_task
/* C9450 80132D50 AE000004 */ sw $zero, 4($s0)
/* C9454 80132D54 8C430000 */ lw $v1, ($v0)
/* C9458 80132D58 34630002 */ ori $v1, $v1, 2
/* C945C 80132D5C AC430000 */ sw $v1, ($v0)
.L80132D60:
/* C9460 80132D60 26310001 */ addiu $s1, $s1, 1
.L80132D64:
/* C9464 80132D64 2A220100 */ slti $v0, $s1, 0x100
/* C9468 80132D68 1440FFD3 */ bnez $v0, .L80132CB8
/* C946C 80132D6C 00000000 */ nop
/* C9470 80132D70 8FBF0038 */ lw $ra, 0x38($sp)
/* C9474 80132D74 8FB50034 */ lw $s5, 0x34($sp)
/* C9478 80132D78 8FB40030 */ lw $s4, 0x30($sp)
/* C947C 80132D7C 8FB3002C */ lw $s3, 0x2c($sp)
/* C9480 80132D80 8FB20028 */ lw $s2, 0x28($sp)
/* C9484 80132D84 8FB10024 */ lw $s1, 0x24($sp)
/* C9488 80132D88 8FB00020 */ lw $s0, 0x20($sp)
/* C948C 80132D8C 03E00008 */ jr $ra
/* C9490 80132D90 27BD0040 */ addiu $sp, $sp, 0x40

View File

@ -1,64 +0,0 @@
.set noat # allow manual use of $at
.set noreorder # don't insert nops after branches
.section .rodata
dlabel D_80150CC8
.word 0x80132E08, 0x80132E18, 0x80132E18, 0x80132E28, 0x80132E30, 0x80132E30, 0x80132E30, 0x80132E30, 0x80132E30, 0x80132E30, 0x80132E30, 0x80132E30, 0x80132E28, 0x80132E30, 0x80132E30, 0x80132E30, 0x80132E28, 0x80132E30, 0x80132E30, 0x80132E30, 0x80132E28, 0x80132E30, 0x80132E30, 0x80132E28
.section .text
glabel func_80132D94
/* C9494 80132D94 3C02800A */ lui $v0, %hi(gOverrideFlags)
/* C9498 80132D98 8C42A650 */ lw $v0, %lo(gOverrideFlags)($v0)
/* C949C 80132D9C 27BDFFE0 */ addiu $sp, $sp, -0x20
/* C94A0 80132DA0 AFBF0018 */ sw $ra, 0x18($sp)
/* C94A4 80132DA4 AFB10014 */ sw $s1, 0x14($sp)
/* C94A8 80132DA8 3042C000 */ andi $v0, $v0, 0xc000
/* C94AC 80132DAC 14400024 */ bnez $v0, .L80132E40
/* C94B0 80132DB0 AFB00010 */ sw $s0, 0x10($sp)
/* C94B4 80132DB4 0000802D */ daddu $s0, $zero, $zero
/* C94B8 80132DB8 3C118015 */ lui $s1, %hi(D_80150CC8)
/* C94BC 80132DBC 26310CC8 */ addiu $s1, $s1, %lo(D_80150CC8)
.L80132DC0:
/* C94C0 80132DC0 3C038015 */ lui $v1, %hi(D_801565A0)
/* C94C4 80132DC4 8C6365A0 */ lw $v1, %lo(D_801565A0)($v1)
/* C94C8 80132DC8 00101080 */ sll $v0, $s0, 2
/* C94CC 80132DCC 00431021 */ addu $v0, $v0, $v1
/* C94D0 80132DD0 8C440000 */ lw $a0, ($v0)
/* C94D4 80132DD4 50800017 */ beql $a0, $zero, .L80132E34
/* C94D8 80132DD8 26100001 */ addiu $s0, $s0, 1
/* C94DC 80132DDC 8C820000 */ lw $v0, ($a0)
/* C94E0 80132DE0 50400014 */ beql $v0, $zero, .L80132E34
/* C94E4 80132DE4 26100001 */ addiu $s0, $s0, 1
/* C94E8 80132DE8 8083001B */ lb $v1, 0x1b($a0)
/* C94EC 80132DEC 2C620018 */ sltiu $v0, $v1, 0x18
/* C94F0 80132DF0 1040000F */ beqz $v0, .L80132E30
/* C94F4 80132DF4 00031080 */ sll $v0, $v1, 2
/* C94F8 80132DF8 00511021 */ addu $v0, $v0, $s1
/* C94FC 80132DFC 8C420000 */ lw $v0, ($v0)
/* C9500 80132E00 00400008 */ jr $v0
/* C9504 80132E04 00000000 */ nop
/* C9508 80132E08 0C04D5B1 */ jal func_801356C4
/* C950C 80132E0C 26100001 */ addiu $s0, $s0, 1
/* C9510 80132E10 0804CB8E */ j .L80132E38
/* C9514 80132E14 2A020100 */ slti $v0, $s0, 0x100
/* C9518 80132E18 0C04D5B5 */ jal func_801356D4
/* C951C 80132E1C 26100001 */ addiu $s0, $s0, 1
/* C9520 80132E20 0804CB8E */ j .L80132E38
/* C9524 80132E24 2A020100 */ slti $v0, $s0, 0x100
/* C9528 80132E28 0C04D567 */ jal func_8013559C
/* C952C 80132E2C 00000000 */ nop
.L80132E30:
/* C9530 80132E30 26100001 */ addiu $s0, $s0, 1
.L80132E34:
/* C9534 80132E34 2A020100 */ slti $v0, $s0, 0x100
.L80132E38:
/* C9538 80132E38 1440FFE1 */ bnez $v0, .L80132DC0
/* C953C 80132E3C 00000000 */ nop
.L80132E40:
/* C9540 80132E40 8FBF0018 */ lw $ra, 0x18($sp)
/* C9544 80132E44 8FB10014 */ lw $s1, 0x14($sp)
/* C9548 80132E48 8FB00010 */ lw $s0, 0x10($sp)
/* C954C 80132E4C 03E00008 */ jr $ra
/* C9550 80132E50 27BD0020 */ addiu $sp, $sp, 0x20

View File

@ -1,55 +0,0 @@
.set noat # allow manual use of $at
.set noreorder # don't insert nops after branches
glabel func_8013559C
/* CBC9C 8013559C 8083001A */ lb $v1, 0x1a($a0)
/* CBCA0 801355A0 24020001 */ addiu $v0, $zero, 1
/* CBCA4 801355A4 1462002A */ bne $v1, $v0, .L80135650
/* CBCA8 801355A8 3C020002 */ lui $v0, 2
/* CBCAC 801355AC 8C860000 */ lw $a2, ($a0)
/* CBCB0 801355B0 8083001B */ lb $v1, 0x1b($a0)
/* CBCB4 801355B4 8C850014 */ lw $a1, 0x14($a0)
/* CBCB8 801355B8 00C21024 */ and $v0, $a2, $v0
/* CBCBC 801355BC 0002382B */ sltu $a3, $zero, $v0
/* CBCC0 801355C0 24020014 */ addiu $v0, $zero, 0x14
/* CBCC4 801355C4 10620022 */ beq $v1, $v0, .L80135650
/* CBCC8 801355C8 24020017 */ addiu $v0, $zero, 0x17
/* CBCCC 801355CC 10620015 */ beq $v1, $v0, .L80135624
/* CBCD0 801355D0 00000000 */ nop
/* CBCD4 801355D4 8CA2001C */ lw $v0, 0x1c($a1)
/* CBCD8 801355D8 2842003C */ slti $v0, $v0, 0x3c
/* CBCDC 801355DC 1040001C */ beqz $v0, .L80135650
/* CBCE0 801355E0 3C020020 */ lui $v0, 0x20
/* CBCE4 801355E4 00C21024 */ and $v0, $a2, $v0
/* CBCE8 801355E8 14400008 */ bnez $v0, .L8013560C
/* CBCEC 801355EC 2402FFBF */ addiu $v0, $zero, -0x41
/* CBCF0 801355F0 3C028007 */ lui $v0, %hi(gGameStatusPtr)
/* CBCF4 801355F4 8C42419C */ lw $v0, %lo(gGameStatusPtr)($v0)
/* CBCF8 801355F8 94420134 */ lhu $v0, 0x134($v0)
/* CBCFC 801355FC 00471021 */ addu $v0, $v0, $a3
/* CBD00 80135600 30420001 */ andi $v0, $v0, 1
/* CBD04 80135604 10400004 */ beqz $v0, .L80135618
/* CBD08 80135608 2402FFBF */ addiu $v0, $zero, -0x41
.L8013560C:
/* CBD0C 8013560C 00C21024 */ and $v0, $a2, $v0
/* CBD10 80135610 03E00008 */ jr $ra
/* CBD14 80135614 AC820000 */ sw $v0, ($a0)
.L80135618:
/* CBD18 80135618 34C20040 */ ori $v0, $a2, 0x40
/* CBD1C 8013561C 03E00008 */ jr $ra
/* CBD20 80135620 AC820000 */ sw $v0, ($a0)
.L80135624:
/* CBD24 80135624 8CA3001C */ lw $v1, 0x1c($a1)
/* CBD28 80135628 2862000A */ slti $v0, $v1, 0xa
/* CBD2C 8013562C 10400008 */ beqz $v0, .L80135650
/* CBD30 80135630 000310C0 */ sll $v0, $v1, 3
/* CBD34 80135634 00431023 */ subu $v0, $v0, $v1
/* CBD38 80135638 00021080 */ sll $v0, $v0, 2
/* CBD3C 8013563C A082002F */ sb $v0, 0x2f($a0)
/* CBD40 80135640 8C820000 */ lw $v0, ($a0)
/* CBD44 80135644 3C030008 */ lui $v1, 8
/* CBD48 80135648 00431025 */ or $v0, $v0, $v1
/* CBD4C 8013564C AC820000 */ sw $v0, ($a0)
.L80135650:
/* CBD50 80135650 03E00008 */ jr $ra
/* CBD54 80135654 00000000 */ nop

View File

@ -1,36 +0,0 @@
.set noat # allow manual use of $at
.set noreorder # don't insert nops after branches
glabel func_80136A08
/* CD108 80136A08 27BDFFE0 */ addiu $sp, $sp, -0x20
/* CD10C 80136A0C 3C038008 */ lui $v1, %hi(gItemTable)
/* CD110 80136A10 246378E0 */ addiu $v1, $v1, %lo(gItemTable)
/* CD114 80136A14 AFBF0018 */ sw $ra, 0x18($sp)
/* CD118 80136A18 84820018 */ lh $v0, 0x18($a0)
/* CD11C 80136A1C 8084001A */ lb $a0, 0x1a($a0)
/* CD120 80136A20 00021140 */ sll $v0, $v0, 5
/* CD124 80136A24 00431821 */ addu $v1, $v0, $v1
/* CD128 80136A28 28820002 */ slti $v0, $a0, 2
/* CD12C 80136A2C 1440000E */ bnez $v0, .L80136A68
/* CD130 80136A30 28820004 */ slti $v0, $a0, 4
/* CD134 80136A34 14400006 */ bnez $v0, .L80136A50
/* CD138 80136A38 2402000A */ addiu $v0, $zero, 0xa
/* CD13C 80136A3C 2882000C */ slti $v0, $a0, 0xc
/* CD140 80136A40 10400009 */ beqz $v0, .L80136A68
/* CD144 80136A44 2882000A */ slti $v0, $a0, 0xa
/* CD148 80136A48 14400007 */ bnez $v0, .L80136A68
/* CD14C 80136A4C 2402000A */ addiu $v0, $zero, 0xa
.L80136A50:
/* CD150 80136A50 24A50008 */ addiu $a1, $a1, 8
/* CD154 80136A54 8C640014 */ lw $a0, 0x14($v1)
/* CD158 80136A58 240700FF */ addiu $a3, $zero, 0xff
/* CD15C 80136A5C AFA20010 */ sw $v0, 0x10($sp)
/* CD160 80136A60 0C04993B */ jal draw_msg
/* CD164 80136A64 AFA00014 */ sw $zero, 0x14($sp)
.L80136A68:
/* CD168 80136A68 8FBF0018 */ lw $ra, 0x18($sp)
/* CD16C 80136A6C 03E00008 */ jr $ra
/* CD170 80136A70 27BD0020 */ addiu $sp, $sp, 0x20
/* CD174 80136A74 00000000 */ nop
/* CD178 80136A78 00000000 */ nop
/* CD17C 80136A7C 00000000 */ nop