mirror of
https://github.com/pmret/papermario.git
synced 2024-11-08 12:02:30 +01:00
Misc decomp 3: Oh baby a triple (#882)
* clean * git subrepo pull --force tools/splat subrepo: subdir: "tools/splat" merged: "901241040d" upstream: origin: "https://github.com/ethteck/splat.git" branch: "master" commit: "901241040d" git-subrepo: version: "0.4.5" origin: "https://github.com/ingydotnet/git-subrepo" commit: "aa416e4" * splat update * more matches after nop hack * git subrepo pull --force tools/splat subrepo: subdir: "tools/splat" merged: "715ee0ad55" upstream: origin: "https://github.com/ethteck/splat.git" branch: "master" commit: "715ee0ad55" git-subrepo: version: "0.4.5" origin: "https://github.com/ingydotnet/git-subrepo" commit: "aa416e4" * Renames, match boot_idle * one mo * wips * fish func Co-authored-by: @JaThePlayer * sushie dun * warnings * clean * match a nok func * nok_02 stuff * nok_04 party image * func_802BD5D8_3174F8 * LoadPartyImage & stuff * warnings
This commit is contained in:
parent
abd49f653a
commit
29c3ffa2e0
@ -8,3 +8,4 @@ def apply(config, args):
|
||||
config['source_directories'] = ['src', f'{ver_dir}asm', 'include', f'{ver_dir}assets']
|
||||
config['make_command'] = ['ninja']
|
||||
config['objdump_flags'] = ['-M','reg-names=32']
|
||||
config['expected_directory'] = f'{ver_dir}/expected/'
|
||||
|
@ -2120,8 +2120,10 @@ typedef struct MenuPanel {
|
||||
typedef struct WindowBackground {
|
||||
/* 0x00 */ IMG_PTR imgData;
|
||||
/* 0x04 */ s8 packedTileFormat; // upper = fmt, lower = depth; e.g., 31 = CI-8
|
||||
/* 0x05 */ s8 width;
|
||||
/* 0x06 */ s8 height;
|
||||
// /* 0x04 */ u8 packedTileFormatHigh : 4;
|
||||
// /* 0x04 */ u8 packedTileFormatLow : 4;
|
||||
/* 0x05 */ u8 width;
|
||||
/* 0x06 */ u8 height;
|
||||
/* 0x07 */ char unk_07[4];
|
||||
/* 0x0B */ s8 size;
|
||||
} WindowBackground; // size = 0xC
|
||||
@ -2129,6 +2131,8 @@ typedef struct WindowBackground {
|
||||
typedef struct WindowCorners {
|
||||
/* 0x00 */ IMG_PTR imgData;
|
||||
/* 0x04 */ s8 packedTileFormat; // upper = fmt, lower = depth; e.g., 31 = CI-8
|
||||
// /* 0x04 */ u8 packedTileFormatHigh : 4;
|
||||
// /* 0x04 */ u8 packedTileFormatLow : 4;
|
||||
/* 0x05 */ Vec2b size1;
|
||||
/* 0x07 */ Vec2b size2;
|
||||
/* 0x09 */ Vec2b size3;
|
||||
|
@ -864,6 +864,7 @@ enum SoundIDs {
|
||||
SOUND_BOW_SPOOK = 0x00000291,
|
||||
SOUND_292 = 0x00000292,
|
||||
SOUND_293 = 0x00000293,
|
||||
SOUND_294 = 0x00000294,
|
||||
SOUND_295 = 0x00000295,
|
||||
SOUND_297 = 0x00000297,
|
||||
SOUND_298 = 0x00000298,
|
||||
@ -1128,6 +1129,7 @@ enum SoundIDs {
|
||||
SOUND_62B = 0x0000062B,
|
||||
SOUND_648 = 0x00000648,
|
||||
SOUND_649 = 0x00000649,
|
||||
SOUND_694 = 0x00000694,
|
||||
SOUND_6A2 = 0x000006A2,
|
||||
SOUND_749 = 0x00000749,
|
||||
SOUND_759 = 0x00000759,
|
||||
@ -1150,6 +1152,9 @@ enum SoundIDs {
|
||||
SOUND_2010 = 0x00002010,
|
||||
SOUND_WATT_REPEL_DARKNESS = 0x00002011,
|
||||
SOUND_WATT_RESUME_DARKNESS = 0x00002012,
|
||||
SOUND_2013 = 0x00002013,
|
||||
SOUND_2014 = 0x00002014,
|
||||
SOUND_2015 = 0x00002015,
|
||||
SOUND_CANNON1 = 0x00002016,
|
||||
SOUND_CANNON2 = 0x00002017,
|
||||
SOUND_CANNON3 = 0x00002018,
|
||||
|
@ -16,7 +16,7 @@ s32 strcmp(const char* str1, const char* str2);
|
||||
|
||||
void nuBoot(void);
|
||||
void boot_idle(void* data);
|
||||
void boot_main(void);
|
||||
void boot_main(void* data);
|
||||
|
||||
void is_debug_init(void);
|
||||
|
||||
@ -406,6 +406,7 @@ PlayerData* get_player_data(void);
|
||||
s32 npc_raycast_down_around(s32, f32*, f32*, f32*, f32*, f32, f32);
|
||||
s32 npc_raycast_down_sides(s32 ignoreFlags, f32* posX, f32* posY, f32* posZ, f32* hitDepth);
|
||||
s32 npc_raycast_up(s32, f32*, f32*, f32*, f32*);
|
||||
s32 npc_raycast_up_corners(s32 ignoreFlags, f32* posX, f32* posY, f32* posZ, f32* hitDepth, f32 yaw, f32 radius);
|
||||
s32 player_raycast_up_corners(PlayerStatus*, f32*, f32*, f32*, f32*, f32);
|
||||
s32 player_raycast_below_cam_relative(PlayerStatus* playerStatus, f32* outX, f32* outY, f32* outZ, f32* outLength,
|
||||
f32* hitRx, f32* hitRz, f32* hitDirX, f32* hitDirZ);
|
||||
|
@ -23,6 +23,8 @@
|
||||
|
||||
#define ARRAY_COUNT(arr) (s32)(sizeof(arr) / sizeof(arr[0]))
|
||||
|
||||
#define NOP_FIX __asm__(".set nogpopt");
|
||||
|
||||
#define PTR_LIST_END ((void*) -1)
|
||||
|
||||
#define API_CALLABLE(name) ApiStatus name(Evt* script, s32 isInitialCall)
|
||||
|
@ -191,8 +191,8 @@ extern EvtScript ShakeCamX;
|
||||
extern MusicSettings gMusicSettings[4];
|
||||
|
||||
// OS
|
||||
extern OSThread D_800A4270; // idle thread, id 1
|
||||
extern OSThread D_800A4420; // id 3
|
||||
extern OSThread IdleThread; // idle thread, id 1
|
||||
extern OSThread MainThread; // id 3
|
||||
extern OSDevMgr __osPiDevMgr;
|
||||
|
||||
// gfx
|
||||
|
31
src/16c8e0.c
31
src/16c8e0.c
@ -13,17 +13,14 @@ s16 D_802809F6 = -1;
|
||||
s16 D_802809F8 = 0;
|
||||
u16 gTattleBgTextureYOffset = 0;
|
||||
|
||||
BSS s32 bSavedPartner = 0;
|
||||
BSS s32 bSavedOverrideFlags = 0;
|
||||
BSS s32 D_8029DA38 = 0; // unused?
|
||||
BSS s32 D_8029DA3C = 0; // unused?
|
||||
BSS s32 D_8029DA40 = 0;
|
||||
BSS s32 D_8029DA44 = 0;
|
||||
BSS s32 D_8029DA48 = 0;
|
||||
// The following var has a nop issue, and the only way to fix it is by initializing it.
|
||||
// However, this puts it at the beginning of the BSS section, so all preceeding BSS needs to be initialized as well.
|
||||
BSS s32 D_8029DA4C = 0;
|
||||
|
||||
BSS s32 bSavedPartner;
|
||||
BSS s32 bSavedOverrideFlags;
|
||||
BSS s32 D_8029DA38; // unused?
|
||||
BSS s32 D_8029DA3C; // unused?
|
||||
BSS s32 D_8029DA40;
|
||||
BSS s32 D_8029DA44;
|
||||
BSS s32 D_8029DA48;
|
||||
BSS s32 D_8029DA4C;
|
||||
BSS Camera D_8029DA50[ARRAY_COUNT(gCameras)];
|
||||
BSS f32 D_8029EFB0;
|
||||
BSS f32 D_8029EFB4;
|
||||
@ -118,19 +115,19 @@ void get_dpad_input_radial(f32* angle, f32* magnitude) {
|
||||
u16 currentButtonsDown = battleStatus->currentButtonsDown;
|
||||
f32 mag;
|
||||
|
||||
if (currentButtonsDown & 0xF00) {
|
||||
if (currentButtonsDown & (BUTTON_D_UP | BUTTON_D_DOWN | BUTTON_D_LEFT | BUTTON_D_RIGHT)) {
|
||||
stickY = 0.0f;
|
||||
stickX = 0.0f;
|
||||
if (currentButtonsDown & 0x800) {
|
||||
if (currentButtonsDown & BUTTON_D_UP) {
|
||||
stickY = maxMagnitude;
|
||||
}
|
||||
if (currentButtonsDown & 0x400) {
|
||||
if (currentButtonsDown & BUTTON_D_DOWN) {
|
||||
stickY = -maxMagnitude;
|
||||
}
|
||||
if (currentButtonsDown & 0x200) {
|
||||
if (currentButtonsDown & BUTTON_D_LEFT) {
|
||||
stickX = -maxMagnitude;
|
||||
}
|
||||
if (currentButtonsDown & 0x100) {
|
||||
if (currentButtonsDown & BUTTON_D_RIGHT) {
|
||||
stickX = maxMagnitude;
|
||||
}
|
||||
}
|
||||
@ -939,6 +936,8 @@ void btl_draw_enemy_health_bars(void) {
|
||||
}
|
||||
}
|
||||
|
||||
NOP_FIX
|
||||
|
||||
void btl_update_starpoints_display(void) {
|
||||
BattleStatus* battleStatus = &gBattleStatus;
|
||||
s32 cond;
|
||||
|
@ -1,4 +1,6 @@
|
||||
#include "common.h"
|
||||
#include "nu/nusys.h"
|
||||
|
||||
typedef struct DefaultWindowStyle {
|
||||
/* 0x00 */ u8 bgIndex;
|
||||
/* 0x01 */ u8 cornersIndex;
|
||||
@ -330,8 +332,520 @@ Mtx D_8010BC08 = {
|
||||
}
|
||||
};
|
||||
|
||||
// ordering and stack
|
||||
#ifdef NON_MATCHING
|
||||
#define _INTEGER_LOG2(x) ( \
|
||||
(x) <= 1 ? 0 : \
|
||||
(x) <= 2 ? 1 : \
|
||||
(x) <= 4 ? 2 : \
|
||||
(x) <= 8 ? 3 : \
|
||||
(x) <= 16 ? 4 : \
|
||||
(x) <= 32 ? 5 : \
|
||||
(x) <= 64 ? 6 : \
|
||||
(x) <= 128 ? 7 : \
|
||||
(x) <= 256 ? 8 : \
|
||||
(x) <= 512 ? 9 : 10)
|
||||
|
||||
s32 draw_box(s32 flags, WindowStyleCustom* windowStyle, s32 posX, s32 posY, s32 posZ, s32 width, s32 height, u8 opacity,
|
||||
u8 darkening, f32 scaleX, f32 scaleY, f32 rotX, f32 rotY, f32 rotZ,
|
||||
void (*fpDrawContents)(s32, s32, s32, s32, s32, s32, s32), s32 drawContentsArg0,
|
||||
Matrix4f rotScaleMtx, s32 translateX, s32 translateY, Matrix4f outMtx)
|
||||
{
|
||||
Matrix4f sp20;
|
||||
Matrix4f sp60;
|
||||
Matrix4f spA0;
|
||||
|
||||
u8 spF7;
|
||||
u8 spFF;
|
||||
u8 sp107;
|
||||
u8 sp10F;
|
||||
u8 sp117;
|
||||
u8 sp11F;
|
||||
u8 sp127;
|
||||
u8 sp12F;
|
||||
|
||||
u8* backgroundImageData;
|
||||
u8* sp13C;
|
||||
s32 sp140;
|
||||
s32 sp144;
|
||||
Vec2bu* sp148;
|
||||
u32 sp14C;
|
||||
u32 packedTileFormat;
|
||||
Mtx* sp154;
|
||||
|
||||
WindowCorners* corners;
|
||||
WindowBackground* background;
|
||||
u32 bgWidth, bgHeight;
|
||||
u32 cornerWidth, cornerHeight;
|
||||
s32 a3;
|
||||
s32 t0;
|
||||
s32 s6;
|
||||
Vtx* fp;
|
||||
s32 i, j, k;
|
||||
Gfx* combineMode;
|
||||
s32 tmem = 0x100;
|
||||
u32 bgScrollOffset;
|
||||
DefaultWindowStyle* defaultStyle = NULL;
|
||||
WindowStyleCustom* customStyle = NULL;
|
||||
s32 alpha = opacity;
|
||||
s32 new_var;
|
||||
|
||||
if ((u32)windowStyle < 23) {
|
||||
defaultStyle = &D_801098E0[(u32)windowStyle];
|
||||
|
||||
spF7 = defaultStyle->color1.r;
|
||||
spFF = defaultStyle->color1.g;
|
||||
sp107 = defaultStyle->color1.b;
|
||||
sp10F = defaultStyle->color1.a * alpha / 255;
|
||||
sp117 = defaultStyle->color2.r;
|
||||
sp11F = defaultStyle->color2.g;
|
||||
sp127 = defaultStyle->color2.b;
|
||||
sp12F = defaultStyle->color2.a;
|
||||
|
||||
background = &D_8010BAE8[defaultStyle->bgIndex];
|
||||
corners = &D_8010BB00[defaultStyle->cornersIndex];
|
||||
} else {
|
||||
spF7 = windowStyle->color1.r;
|
||||
spFF = windowStyle->color1.g;
|
||||
sp107 = windowStyle->color1.b;
|
||||
sp10F = windowStyle->color1.a * alpha / 255;
|
||||
sp117 = windowStyle->color2.r;
|
||||
sp11F = windowStyle->color2.g;
|
||||
sp127 = windowStyle->color2.b;
|
||||
sp12F = windowStyle->color2.a;
|
||||
|
||||
customStyle = windowStyle;
|
||||
background = &windowStyle->background;
|
||||
corners = &windowStyle->corners;
|
||||
}
|
||||
|
||||
backgroundImageData = background->imgData;
|
||||
|
||||
bgWidth = background->width;
|
||||
bgHeight = background->height;
|
||||
sp13C = corners->imgData;
|
||||
sp140 = background->packedTileFormatHigh;
|
||||
new_var = 1; // TODO hack
|
||||
sp144 = _INTEGER_LOG2(bgWidth);
|
||||
s6 = _INTEGER_LOG2(bgHeight);
|
||||
|
||||
fp = NULL;
|
||||
sp154 = NULL;
|
||||
sp148 = (Vec2bu*)&corners->size1;
|
||||
sp14C = corners->packedTileFormatHigh;
|
||||
packedTileFormat = corners->packedTileFormatLow;
|
||||
|
||||
if (width <= 0 || height <= 0 || opacity == 0 || posX <= -768 || posY <= -768) {
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
if (posX >= SCREEN_WIDTH || posY >= SCREEN_HEIGHT) {
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
if (posX + width >= 768 || posY + height >= 768 || posX + width <= 0 || posY + height <= 0) {
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
if (flags & DRAW_FLAGS_ROTSCALE) {
|
||||
fp = D_8010D6B0[D_8010BBB0++].vert;
|
||||
if (D_8010BBB0 > 20) {
|
||||
D_8010BBB0 = 0;
|
||||
}
|
||||
}
|
||||
|
||||
gDPPipeSync(gMasterGfxPos++);
|
||||
gDPSetCycleType(gMasterGfxPos++, G_CYC_2CYCLE);
|
||||
gDPSetBlendColor(gMasterGfxPos++, 0, 0, 0, 0);
|
||||
gDPSetFogColor(gMasterGfxPos++, 0, 0, 0, darkening);
|
||||
gDPSetRenderMode(gMasterGfxPos++, GBL_c1(G_BL_CLR_BL, G_BL_A_FOG, G_BL_CLR_IN, G_BL_1MA), G_RM_XLU_SURF2);
|
||||
if (!(flags & DRAW_FLAGS_CLIP)) {
|
||||
gDPSetScissor(gMasterGfxPos++, G_SC_NON_INTERLACE, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT);
|
||||
}
|
||||
|
||||
if (defaultStyle != NULL) {
|
||||
Gfx* gfxPos = gMasterGfxPos;
|
||||
*gfxPos = D_8010BB90[defaultStyle->unk_2 + (sp10F != 255 ? 2 : 0)];
|
||||
} else {
|
||||
Gfx* gfxPos = gMasterGfxPos;
|
||||
if (sp10F != 255) {
|
||||
*gfxPos = customStyle->transparentCombineMode;
|
||||
} else {
|
||||
*gfxPos = customStyle->opaqueCombineMode;
|
||||
}
|
||||
}
|
||||
|
||||
gMasterGfxPos++;
|
||||
gDPSetTextureFilter(gMasterGfxPos++, G_TF_POINT);
|
||||
|
||||
if (fp) {
|
||||
gSPViewport(gMasterGfxPos++, &D_8010BBB8);
|
||||
guFrustumF(sp20, -80.0f, 80.0f, 60.0f, -60.0f, 160.0f, 480.0f, 1.0f);
|
||||
guMtxF2L(sp20, &gDisplayContext->matrixStack[gMatrixListPos]);
|
||||
sp154 = &gDisplayContext->matrixStack[gMatrixListPos];
|
||||
gSPMatrix(gMasterGfxPos++, &gDisplayContext->matrixStack[gMatrixListPos++], G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_PROJECTION);
|
||||
guPositionF(sp20, rotX, rotY, rotZ, 1.0f, posX + width / 2, posY + height / 2, posZ);
|
||||
if ((scaleX != 1.0f) || (scaleY != 1.0f)) {
|
||||
guScaleF(sp60, scaleX, scaleY, 1.0f);
|
||||
guMtxCatF(sp60, sp20, sp20);
|
||||
}
|
||||
if (rotScaleMtx != 0) {
|
||||
guTranslateF(sp60, -translateX / 2, -translateY / 2, 0.0f);
|
||||
guMtxCatF(sp20, sp60, sp60);
|
||||
guMtxCatF(sp60, rotScaleMtx, sp20);
|
||||
}
|
||||
if (outMtx) {
|
||||
for (k = 0; k < 4; k++) {
|
||||
for (j = 0; j < 4; j++) {
|
||||
outMtx[k][j] = sp20[k][j];
|
||||
}
|
||||
}
|
||||
}
|
||||
guTranslateF(sp60, -160.0f, -120.0f, -320.0f);
|
||||
guMtxCatF(sp20, sp60, sp20);
|
||||
gSPClearGeometryMode(gMasterGfxPos++, G_CULL_BOTH | G_LIGHTING);
|
||||
if (flags & DRAW_FLAGS_CULL_BACK) {
|
||||
gSPSetGeometryMode(gMasterGfxPos++, G_CULL_BACK);
|
||||
}
|
||||
guMtxF2L(sp20, &gDisplayContext->matrixStack[gMatrixListPos]);
|
||||
gSPMatrix(gMasterGfxPos++, &gDisplayContext->matrixStack[gMatrixListPos++], G_MTX_PUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
|
||||
gDPSetTexturePersp(gMasterGfxPos++, G_TP_PERSP);
|
||||
gSPPerspNormalize(gMasterGfxPos++, 20);
|
||||
} else {
|
||||
gDPSetTexturePersp(gMasterGfxPos++, G_TP_NONE);
|
||||
}
|
||||
|
||||
gSPTexture(gMasterGfxPos++, 0xFFFF, 0xFFFF, 0, G_TX_RENDERTILE, G_ON);
|
||||
gDPSetTextureLUT(gMasterGfxPos++, G_TT_NONE);
|
||||
gDPSetTextureDetail(gMasterGfxPos++, G_TD_CLAMP);
|
||||
gDPSetTextureLOD(gMasterGfxPos++, G_TL_TILE);
|
||||
gDPSetPrimColor(gMasterGfxPos++, 0, 0, spF7, spFF, sp107, sp10F);
|
||||
gDPSetEnvColor(gMasterGfxPos++, sp117, sp11F, sp127, sp12F);
|
||||
if (backgroundImageData) {
|
||||
switch (background->packedTileFormatLow) {
|
||||
case G_IM_SIZ_4b:
|
||||
gDPLoadTextureTile_4b(gMasterGfxPos++, backgroundImageData, sp140, bgWidth, bgHeight, 0, 0, bgWidth - 1, bgHeight - 1, 0, G_TX_WRAP, G_TX_WRAP, sp144, s6, G_TX_NOLOD, G_TX_NOLOD);
|
||||
break;
|
||||
case G_IM_SIZ_8b:
|
||||
gDPLoadTextureTile(gMasterGfxPos++, backgroundImageData, sp140, G_IM_SIZ_8b, bgWidth, bgHeight, 0, 0, bgWidth - 1, bgHeight - 1, 0, G_TX_WRAP, G_TX_WRAP, sp144, s6, G_TX_NOLOD, G_TX_NOLOD);
|
||||
break;
|
||||
case G_IM_SIZ_16b:
|
||||
gDPLoadTextureTile(gMasterGfxPos++, backgroundImageData, sp140, G_IM_SIZ_16b, bgWidth, bgHeight, 0, 0, bgWidth - 1, bgHeight - 1, 0, G_TX_WRAP, G_TX_WRAP, sp144, s6, G_TX_NOLOD, G_TX_NOLOD);
|
||||
break;
|
||||
case G_IM_SIZ_32b:
|
||||
gDPLoadTextureTile(gMasterGfxPos++, backgroundImageData, sp140, G_IM_SIZ_32b, bgWidth, bgHeight, 0, 0, bgWidth - 1, bgHeight - 1, 0, G_TX_WRAP, G_TX_WRAP, sp144, s6, G_TX_NOLOD, G_TX_NOLOD);
|
||||
break;
|
||||
}
|
||||
|
||||
if (flags & DRAW_FLAGS_2) {
|
||||
bgScrollOffset = 511 - ((gGameStatusPtr->frameCounter * 4) & 0x1FF);
|
||||
gDPSetTileSize(gMasterGfxPos++, G_TX_RENDERTILE,
|
||||
(width / 2 * 4) + (bgScrollOffset),
|
||||
(height / 2 * 4) + (bgScrollOffset),
|
||||
(width / 2 + bgWidth - 1) * 4 + (bgScrollOffset),
|
||||
(height / 2 + bgHeight - 1) * 4 + (bgScrollOffset));
|
||||
} else {
|
||||
gDPSetTileSize(gMasterGfxPos++, G_TX_RENDERTILE, (width / 2 * 4), (height / 2 * 4), (width / 2 + bgWidth - new_var) * 4, (height / 2 + bgHeight - 1)* 4);
|
||||
}
|
||||
}
|
||||
|
||||
if (sp13C != NULL) {
|
||||
for (i = 0; i < 4; i++) {
|
||||
cornerWidth = sp148[i].x;
|
||||
cornerHeight = sp148[i].y;
|
||||
a3 = _INTEGER_LOG2(cornerWidth);
|
||||
t0 = _INTEGER_LOG2(cornerHeight);
|
||||
|
||||
|
||||
switch (packedTileFormat) {
|
||||
case G_IM_SIZ_4b:
|
||||
gDPLoadMultiTile_4b(gMasterGfxPos++, sp13C, tmem, 1, sp14C, cornerWidth, cornerHeight, 0, 0, cornerWidth - 1, cornerHeight - 1, 0, G_TX_CLAMP, G_TX_CLAMP, a3, t0, G_TX_NOLOD, G_TX_NOLOD);
|
||||
sp13C += cornerWidth * cornerHeight / 2;
|
||||
break;
|
||||
case G_IM_SIZ_8b:
|
||||
gDPLoadMultiTile(gMasterGfxPos++, sp13C, tmem, 1, sp14C, G_IM_SIZ_8b, cornerWidth, cornerHeight, 0, 0, cornerWidth - 1, cornerHeight - 1, 0, G_TX_CLAMP, G_TX_CLAMP, a3, t0, G_TX_NOLOD, G_TX_NOLOD);
|
||||
sp13C += cornerWidth * cornerHeight;
|
||||
break;
|
||||
case G_IM_SIZ_16b:
|
||||
gDPLoadMultiTile(gMasterGfxPos++, sp13C, tmem, 1, sp14C, G_IM_SIZ_16b, cornerWidth, cornerHeight, 0, 0, cornerWidth - 1, cornerHeight - 1, 0, G_TX_CLAMP, G_TX_CLAMP, a3, t0, G_TX_NOLOD, G_TX_NOLOD);
|
||||
sp13C += cornerWidth * cornerHeight * 2;
|
||||
break;
|
||||
case G_IM_SIZ_32b:
|
||||
gDPLoadMultiTile(gMasterGfxPos++, sp13C, tmem, 1, sp14C, G_IM_SIZ_32b, cornerWidth, cornerHeight, 0, 0, cornerWidth - 1, cornerHeight - 1, 0, G_TX_CLAMP, G_TX_CLAMP, a3, t0, G_TX_NOLOD, G_TX_NOLOD);
|
||||
sp13C += cornerWidth * cornerHeight * 4;
|
||||
break;
|
||||
}
|
||||
|
||||
switch (i) {
|
||||
case 1:
|
||||
gDPSetTileSize(gMasterGfxPos++, 1, (width - cornerWidth) * 4, 0, (width - 1) * 4, (cornerHeight - 1) * 4);
|
||||
break;
|
||||
case 2:
|
||||
gDPSetTileSize(gMasterGfxPos++, 1, 0, (height - cornerHeight) * 4, (cornerWidth - 1) * 4, (height - 1) * 4);
|
||||
break;
|
||||
case 3:
|
||||
gDPSetTileSize(gMasterGfxPos++, 1, (width - cornerWidth) * 4, (height - cornerHeight) * 4, (width - 1) * 4, (height - 1) * 4);
|
||||
break;
|
||||
}
|
||||
|
||||
if (fp) {
|
||||
switch (i) {
|
||||
case 0:
|
||||
fp[0].v.ob[0] = -width / 2;
|
||||
fp[0].v.ob[1] = -height / 2;
|
||||
fp[0].v.ob[2] = 0;
|
||||
|
||||
fp[1].v.ob[0] = 0;
|
||||
fp[1].v.ob[1] = -height / 2;
|
||||
fp[1].v.ob[2] = 0;
|
||||
|
||||
fp[2].v.ob[0] = -width / 2;
|
||||
fp[2].v.ob[1] = 0;
|
||||
fp[2].v.ob[2] = 0;
|
||||
|
||||
fp[3].v.ob[0] = 0;
|
||||
fp[3].v.ob[1] = 0;
|
||||
fp[3].v.ob[2] = 0;
|
||||
|
||||
fp[0].v.tc[0] = 0;
|
||||
fp[0].v.tc[1] = 0;
|
||||
|
||||
fp[1].v.tc[0] = (width / 2) * 32;
|
||||
fp[1].v.tc[1] = 0;
|
||||
|
||||
fp[2].v.tc[0] = 0;
|
||||
fp[2].v.tc[1] = (height / 2) * 32;
|
||||
|
||||
fp[3].v.tc[0] = (width / 2) * 32;
|
||||
fp[3].v.tc[1] = (height / 2) * 32;
|
||||
break;
|
||||
case 1:
|
||||
fp[4].v.ob[0] = 0;
|
||||
fp[4].v.ob[1] = -height / 2;
|
||||
fp[4].v.ob[2] = 0;
|
||||
|
||||
fp[5].v.ob[0] = (-width / 2) + width;
|
||||
fp[5].v.ob[1] = -height / 2;
|
||||
fp[5].v.ob[2] = 0;
|
||||
|
||||
fp[6].v.ob[0] = 0;
|
||||
fp[6].v.ob[1] = 0;
|
||||
fp[6].v.ob[2] = 0;
|
||||
|
||||
fp[7].v.ob[0] = (-width / 2) + width;
|
||||
fp[7].v.ob[1] = 0;
|
||||
fp[7].v.ob[2] = 0;
|
||||
|
||||
fp[4].v.tc[0] = (width / 2) * 32;
|
||||
fp[4].v.tc[1] = 0;
|
||||
|
||||
fp[5].v.tc[0] = width * 32;
|
||||
fp[5].v.tc[1] = 0;
|
||||
|
||||
fp[6].v.tc[0] = (width / 2) * 32;
|
||||
fp[6].v.tc[1] = (height / 2) * 32;
|
||||
|
||||
fp[7].v.tc[0] = width * 32;
|
||||
fp[7].v.tc[1] = (height / 2) * 32;
|
||||
|
||||
fp += 4;
|
||||
break;
|
||||
case 2:
|
||||
fp[8].v.ob[0] = -width / 2;
|
||||
fp[8].v.ob[1] = 0;
|
||||
fp[8].v.ob[2] = 0;
|
||||
|
||||
fp[9].v.ob[0] = 0;
|
||||
fp[9].v.ob[1] = 0;
|
||||
fp[9].v.ob[2] = 0;
|
||||
|
||||
fp[10].v.ob[0] = -width / 2;
|
||||
fp[10].v.ob[1] = height / 2;
|
||||
fp[10].v.ob[2] = 0;
|
||||
|
||||
fp[11].v.ob[0] = 0;
|
||||
fp[11].v.ob[1] = height / 2;
|
||||
fp[11].v.ob[2] = 0;
|
||||
|
||||
fp[8].v.tc[0] = 0;
|
||||
fp[8].v.tc[1] = (height / 2) * 32;
|
||||
|
||||
fp[9].v.tc[0] = (width / 2) * 32;
|
||||
fp[9].v.tc[1] = (height / 2) * 32;
|
||||
|
||||
fp[10].v.tc[0] = 0;
|
||||
fp[10].v.tc[1] = height * 32;
|
||||
|
||||
fp[11].v.tc[0] = (width / 2) * 32;
|
||||
fp[11].v.tc[1] = height * 32;
|
||||
|
||||
fp += 8;
|
||||
break;
|
||||
case 3:
|
||||
fp[12].v.ob[0] = 0;
|
||||
fp[12].v.ob[1] = 0;
|
||||
fp[12].v.ob[2] = 0;
|
||||
|
||||
fp[13].v.ob[0] = (-width / 2) + width;
|
||||
fp[13].v.ob[1] = 0;
|
||||
fp[13].v.ob[2] = 0;
|
||||
|
||||
fp[14].v.ob[0] = 0;
|
||||
fp[14].v.ob[1] = height / 2;
|
||||
fp[14].v.ob[2] = 0;
|
||||
|
||||
fp[15].v.ob[0] = (-width / 2) + width;
|
||||
fp[15].v.ob[1] = height / 2;
|
||||
fp[15].v.ob[2] = 0;
|
||||
|
||||
fp[12].v.tc[0] = (width / 2) * 32;
|
||||
fp[12].v.tc[1] = (height / 2) * 32;
|
||||
|
||||
fp[13].v.tc[0] = width * 32;
|
||||
fp[13].v.tc[1] = (height / 2) * 32;
|
||||
|
||||
fp[14].v.tc[0] = (width / 2) * 32;
|
||||
fp[14].v.tc[1] = height * 32;
|
||||
|
||||
fp[15].v.tc[0] = width * 32;
|
||||
fp[15].v.tc[1] = height * 32;
|
||||
|
||||
fp += 12;
|
||||
break;
|
||||
}
|
||||
gSPVertex(gMasterGfxPos++, fp, 4, 0);
|
||||
gSP2Triangles(gMasterGfxPos++, 0, 3, 1, 0, 0, 2, 3, 0);
|
||||
} else {
|
||||
switch (i) {
|
||||
case 0:
|
||||
gSPScisTextureRectangle(gMasterGfxPos++, posX * 4, posY * 4, (posX + width / 2) * 4, (posY + height / 2) * 4, G_TX_RENDERTILE, 0, 0, 0x400, 0x400);
|
||||
break;
|
||||
case 1:
|
||||
gSPScisTextureRectangle(gMasterGfxPos++, (posX + width / 2) * 4, posY * 4, (posX + width) * 4, (posY + height / 2) * 4, G_TX_RENDERTILE, (width / 2) * 32, 0, 0x400, 0x400);
|
||||
break;
|
||||
case 2:
|
||||
gSPScisTextureRectangle(gMasterGfxPos++, posX * 4, (posY + height / 2) * 4, (posX + width / 2) * 4, (posY + height) * 4, G_TX_RENDERTILE, 0, (height / 2) * 32, 0x400, 0x400);
|
||||
break;
|
||||
case 3:
|
||||
gSPScisTextureRectangle(gMasterGfxPos++, (posX + width / 2) * 4, (posY + height / 2) * 4, (posX + width) * 4, (posY + height) * 4, G_TX_RENDERTILE, (width / 2) * 32, (height / 2) * 32, 0x400, 0x400);
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
gDPPipeSync(gMasterGfxPos++);
|
||||
}
|
||||
} else if (backgroundImageData != NULL) {
|
||||
if (fp != NULL) {
|
||||
fp[0].v.ob[0] = -width / 2;
|
||||
fp[0].v.ob[1] = -height / 2;
|
||||
fp[0].v.ob[2] = 0;
|
||||
|
||||
fp[1].v.ob[0] = (-width / 2) + width;
|
||||
fp[1].v.ob[1] = -height / 2;
|
||||
fp[1].v.ob[2] = 0;
|
||||
|
||||
fp[2].v.ob[0] = -width / 2;
|
||||
fp[2].v.ob[1] = height / 2;
|
||||
fp[2].v.ob[2] = 0;
|
||||
|
||||
fp[3].v.ob[0] = (-width / 2) + width;
|
||||
fp[3].v.ob[1] = height / 2;
|
||||
fp[3].v.ob[2] = 0;
|
||||
|
||||
|
||||
fp[0].v.tc[0] = 0;
|
||||
fp[0].v.tc[1] = 0;
|
||||
|
||||
fp[1].v.tc[1] = 0;
|
||||
fp[1].v.tc[0] = width * 32;
|
||||
|
||||
fp[2].v.tc[0] = 0;
|
||||
fp[2].v.tc[1] = height * 32;
|
||||
|
||||
fp[3].v.tc[0] = width * 32;
|
||||
fp[3].v.tc[1] = height * 32;
|
||||
|
||||
gSPVertex(gMasterGfxPos++, &fp[0], 4, 0);
|
||||
gSP2Triangles(gMasterGfxPos++, 0, 3, 1, 0, 0, 2, 3, 0);
|
||||
} else {
|
||||
gSPScisTextureRectangle(gMasterGfxPos++, posX * 4, posY * 4, (posX + width) * 4, (posY + height) * 4,
|
||||
G_TX_RENDERTILE, 0, 0, 0x0400, 0x0400);
|
||||
}
|
||||
gDPPipeSync(gMasterGfxPos++);
|
||||
}
|
||||
|
||||
gDPSetTexturePersp(gMasterGfxPos++, G_TP_NONE);
|
||||
gDPSetCycleType(gMasterGfxPos++, G_CYC_1CYCLE);
|
||||
if (fpDrawContents != NULL) {
|
||||
if (fp != NULL) {
|
||||
s32 mdl_address = mdl_get_next_texture_address(width * height * 2);
|
||||
if (mdl_address != 0) {
|
||||
gDPSetColorImage(gMasterGfxPos++, G_IM_FMT_RGBA, G_IM_SIZ_16b, width, OS_K0_TO_PHYSICAL(mdl_address));
|
||||
gDPSetScissorFrac(gMasterGfxPos++, G_SC_NON_INTERLACE, 0, 0, width * 4.0f, height * 4.0f);
|
||||
gDPSetCycleType(gMasterGfxPos++, G_CYC_FILL);
|
||||
gDPSetFillColor(gMasterGfxPos++, PACK_FILL_COLOR(spF7, spFF, sp107, 0));
|
||||
gDPSetRenderMode(gMasterGfxPos++, G_RM_NOOP, G_RM_NOOP2);
|
||||
gDPFillRectangle(gMasterGfxPos++, 0, 0, width - 1, height - 1);
|
||||
gDPPipeSync(gMasterGfxPos++);
|
||||
gDPSetScissorFrac(gMasterGfxPos++, G_SC_NON_INTERLACE, 4, 4, (width - 1) * 4.0f, (height - 1) * 4.0f);
|
||||
gDPSetCycleType(gMasterGfxPos++, G_CYC_1CYCLE);
|
||||
|
||||
fpDrawContents(drawContentsArg0, 0, 0, width, height, opacity, darkening);
|
||||
|
||||
gDPPipeSync(gMasterGfxPos++);
|
||||
gDPSetColorImage(gMasterGfxPos++, G_IM_FMT_RGBA, G_IM_SIZ_16b, 320, OS_K0_TO_PHYSICAL(nuGfxCfb_ptr));
|
||||
gDPSetScissor(gMasterGfxPos++, G_SC_NON_INTERLACE, 0, 0, 320, 240);
|
||||
gSPViewport(gMasterGfxPos++, &D_8010BBB8);
|
||||
gSPMatrix(gMasterGfxPos++, sp154, G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_PROJECTION);
|
||||
gSPTexture(gMasterGfxPos++, 0xFFFF, 0xFFFF, 0, G_TX_RENDERTILE, G_ON);
|
||||
gDPSetCycleType(gMasterGfxPos++, G_CYC_1CYCLE);
|
||||
gDPSetTextureLUT(gMasterGfxPos++, G_TT_NONE);
|
||||
gDPSetCombineMode(gMasterGfxPos++, G_CC_DECALRGBA, G_CC_DECALRGBA);
|
||||
gDPSetRenderMode(gMasterGfxPos++, G_RM_CLD_SURF, G_RM_NOOP2);
|
||||
gDPSetTexturePersp(gMasterGfxPos++, G_TP_PERSP);
|
||||
gDPSetTextureFilter(gMasterGfxPos++, G_TF_BILERP);
|
||||
guTranslateF(spA0, 0.0f, 6.0f, 0.0f);
|
||||
guMtxF2L(spA0, &D_8010BC08);
|
||||
guTranslateF(spA0, 0.0f, -height / 2, 0.0f);
|
||||
guMtxF2L(spA0, &gDisplayContext->matrixStack[gMatrixListPos]);
|
||||
gSPMatrix(gMasterGfxPos++, &gDisplayContext->matrixStack[gMatrixListPos++],
|
||||
G_MTX_NOPUSH | G_MTX_MUL | G_MTX_MODELVIEW);
|
||||
for (i = 0; i < height / 6; i++) {
|
||||
s32 v0, a2;
|
||||
if (i == height / 6 - 1) {
|
||||
v0 = 0;
|
||||
if (height % 6 != 0) {
|
||||
v0 = 1;
|
||||
}
|
||||
} else {
|
||||
v0 = 1;
|
||||
}
|
||||
a2 = v0 + 5;
|
||||
gDPLoadTextureTile(gMasterGfxPos++, OS_K0_TO_PHYSICAL(mdl_address), G_IM_FMT_RGBA, G_IM_SIZ_16b, width, 0,
|
||||
0, i * 6, width - 1, i * 6 + a2, 0,
|
||||
G_TX_CLAMP, G_TX_CLAMP, 9, 3, G_TX_NOLOD, G_TX_NOLOD);
|
||||
gDPSetTileSize(gMasterGfxPos++, G_TX_RENDERTILE, (160 - width / 2) * 4, 0, ((160 - width / 2) + width - 1) * 4, a2 * 4);
|
||||
gSPVertex(gMasterGfxPos++, &vtx_drawbox1, 4, 0);
|
||||
gSP2Triangles(gMasterGfxPos++, 0, 3, 1, 0, 0, 2, 3, 0);
|
||||
gDPPipeSync(gMasterGfxPos++);
|
||||
gSPMatrix(gMasterGfxPos++, &D_8010BC08, G_MTX_NOPUSH | G_MTX_MUL | G_MTX_MODELVIEW);
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
fpDrawContents(drawContentsArg0, posX, posY, width, height, opacity, darkening);
|
||||
}
|
||||
}
|
||||
if (fp != NULL) {
|
||||
gSPPopMatrix(gMasterGfxPos++, G_MTX_MODELVIEW);
|
||||
gDPSetTexturePersp(gMasterGfxPos++, G_TP_NONE);
|
||||
gDPPipeSync(gMasterGfxPos++);
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
#else
|
||||
INCLUDE_ASM(void, "8e790_len_2850", draw_box, s32 flags, WindowStyle windowStyle, s32 posX, s32 posY, s32 posZ, s32 width,
|
||||
s32 height, s32 opacity, s32 darkening, f32 scaleX, f32 scaleY, f32 rotX, f32 rotY, f32 rotZ,
|
||||
void (*fpDrawContents)(s32),s32 drawContentsArg0, Matrix4f rotScaleMtx, s32 translateX, s32 translateY,
|
||||
f32 (*outMtx)[4]);
|
||||
|
||||
#endif
|
||||
|
@ -3,6 +3,8 @@
|
||||
#include "nu/nualsgi.h"
|
||||
#include "audio.h"
|
||||
|
||||
NOP_FIX
|
||||
|
||||
u8 nuAuPreNMI = 0;
|
||||
NUAuPreNMIFunc nuAuPreNMIFunc = NULL;
|
||||
s32 nuAuDmaNext = 0;
|
||||
@ -293,10 +295,7 @@ void nuAuCleanDMABuffers(void) {
|
||||
} while (0);
|
||||
}
|
||||
|
||||
// Nop issue
|
||||
// try again when bss is figured out up until this file
|
||||
// rename: default_nuAuPreNMIFunc
|
||||
#ifdef NON_MATCHING
|
||||
void func_8004B328(NUScMsg mesg_type, u32 frameCounter) {
|
||||
s16 temp;
|
||||
s32 temp2;
|
||||
@ -323,9 +322,6 @@ void func_8004B328(NUScMsg mesg_type, u32 frameCounter) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
#else
|
||||
INCLUDE_ASM(s32, "audio/25f00_len_940", func_8004B328);
|
||||
#endif
|
||||
|
||||
void alLink(ALLink* element, ALLink* after) {
|
||||
element->next = after->next;
|
||||
|
@ -1,6 +1,7 @@
|
||||
#include "common.h"
|
||||
#include "stdlib/stdarg.h"
|
||||
#include "PR/os_internal_thread.h"
|
||||
#include "libc/xstdio.h"
|
||||
|
||||
typedef struct {
|
||||
/* 0x000 */ OSThread thread;
|
||||
@ -142,7 +143,7 @@ void crash_screen_draw_glyph(s32 x, s32 y, s32 glyph) {
|
||||
}
|
||||
}
|
||||
|
||||
void* crash_screen_copy_to_buf(void* dest, const char* src, u32 size) {
|
||||
char* crash_screen_copy_to_buf(char* dest, const char* src, size_t size) {
|
||||
memcpy(dest, src, size);
|
||||
return dest + size;
|
||||
}
|
||||
|
@ -26,7 +26,7 @@ extern s16 D_80073E0A;
|
||||
extern s32 D_80073E10[];
|
||||
extern u16* D_8009A680;
|
||||
|
||||
void boot_main(void) {
|
||||
void boot_main(void* data) {
|
||||
#ifdef VERSION_JP
|
||||
if (osTvType == OS_TV_NTSC) {
|
||||
nuGfxDisplayOff();
|
||||
|
@ -805,7 +805,7 @@ void appendGfx_npc(void* data) {
|
||||
spr_draw_npc_sprite(npc->spriteInstanceID, renderYaw, 0, 0, mtx1);
|
||||
}
|
||||
} else {
|
||||
spr_draw_player_sprite(0x40000001, renderYaw, 0, 0, mtx1);
|
||||
spr_draw_player_sprite(1 | DRAW_SPRITE_OVERRIDE_YAW, renderYaw, 0, 0, mtx1);
|
||||
}
|
||||
}
|
||||
|
||||
@ -835,7 +835,7 @@ void appendGfx_npc(void* data) {
|
||||
spr_draw_npc_sprite(npc->spriteInstanceID, renderYaw, 0, 0, mtx1);
|
||||
}
|
||||
} else {
|
||||
spr_draw_player_sprite(0x40000001, renderYaw, 0, 0, mtx1);
|
||||
spr_draw_player_sprite(1 | DRAW_SPRITE_OVERRIDE_YAW, renderYaw, 0, 0, mtx1);
|
||||
}
|
||||
}
|
||||
npc->onRender(npc);
|
||||
@ -1095,7 +1095,7 @@ void appendGfx_npc_blur(Npc* npc) {
|
||||
spr_draw_npc_sprite(npc->spriteInstanceID, (s32) yaw, 0, 0, sp20);
|
||||
}
|
||||
} else {
|
||||
spr_draw_player_sprite(0x40000001, (s32) yaw, 0, 0, sp20);
|
||||
spr_draw_player_sprite(1 | DRAW_SPRITE_OVERRIDE_YAW, (s32) yaw, 0, 0, sp20);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1244,7 +1244,7 @@ void npc_draw_palswap_mode_0(Npc* npc, s32 arg1, Matrix4f mtx) {
|
||||
}
|
||||
spr_draw_npc_sprite(npc->spriteInstanceID | mask, arg1, alpha, NULL, mtx);
|
||||
} else {
|
||||
spr_draw_player_sprite(0x40000001, arg1, 0, 0, mtx);
|
||||
spr_draw_player_sprite(1 | DRAW_SPRITE_OVERRIDE_YAW, arg1, 0, 0, mtx);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -3,25 +3,25 @@
|
||||
#include "functions.h"
|
||||
#include "variables.h"
|
||||
|
||||
// TODO: create src/os/nusys/nuSched.h?
|
||||
NOP_FIX
|
||||
|
||||
extern u64 nuScStack[NU_SC_STACK_SIZE / sizeof(u64)];
|
||||
|
||||
void nuBoot(void) {
|
||||
osInitialize();
|
||||
osCreateThread(&D_800A4270, NU_IDLE_THREAD_ID, boot_idle, NULL, &nuScStack, 10);
|
||||
osStartThread(&D_800A4270);
|
||||
osCreateThread(&IdleThread, NU_IDLE_THREAD_ID, boot_idle, NULL, &nuScStack, 10);
|
||||
osStartThread(&IdleThread);
|
||||
}
|
||||
|
||||
#ifdef NON_EQUIVALENT
|
||||
void boot_idle(void* data) {
|
||||
nuIdleFunc = NULL;
|
||||
|
||||
nuPiInit();
|
||||
nuScCreateScheduler(OS_VI_NTSC_LAN1, 1);
|
||||
osViSetSpecialFeatures(OS_VI_GAMMA_OFF | OS_VI_GAMMA_DITHER_OFF | OS_VI_DIVOT_ON | OS_VI_DITHER_FILTER_ON);
|
||||
osCreateThread(&D_800A4420, NU_MAIN_THREAD_ID, boot_main, NULL, &nuYieldBuf, NU_MAIN_THREAD_PRI);
|
||||
osStartThread(&D_800A4420);
|
||||
osSetThreadPri(&D_800A4270, NU_IDLE_THREAD_PRI);
|
||||
osCreateThread(&MainThread, NU_MAIN_THREAD_ID, boot_main, NULL, &nuYieldBuf, NU_MAIN_THREAD_PRI);
|
||||
osStartThread(&MainThread);
|
||||
osSetThreadPri(&IdleThread, NU_IDLE_THREAD_PRI);
|
||||
|
||||
while (1) {
|
||||
if (nuIdleFunc != NULL) {
|
||||
@ -29,6 +29,3 @@ void boot_idle(void* data) {
|
||||
}
|
||||
}
|
||||
}
|
||||
#else
|
||||
INCLUDE_ASM(void, "os/39cb0_len_100", boot_idle, void);
|
||||
#endif
|
@ -1,15 +1,17 @@
|
||||
#include "common.h"
|
||||
#include "nu/nusys.h"
|
||||
|
||||
s32 contRetrace(void);
|
||||
s32 contReadData(s32* arg0);
|
||||
NOP_FIX
|
||||
|
||||
s32 contRetrace(NUSiCommonMesg* mesg);
|
||||
s32 contReadData(OSContPad* pad, u32 lockflag);
|
||||
s32 contReadNW(void);
|
||||
s32 contQuery(void);
|
||||
|
||||
u32 D_80093D20 = 0;
|
||||
NUContReadFunc nuContReadFunc = NULL;
|
||||
|
||||
s32(*D_80093D24[4])(void) = {
|
||||
contRetrace,
|
||||
(s32 (*) (void)) contRetrace,
|
||||
(s32 (*) (void)) contReadData,
|
||||
contReadNW,
|
||||
contQuery,
|
||||
@ -24,9 +26,9 @@ NUCallBackList nuContCallBack = {
|
||||
0,
|
||||
};
|
||||
|
||||
OSMesg nuContWaitMesgBuf;
|
||||
OSMesg nuContDataMutexBuf;
|
||||
OSMesgQueue nuContDataMutexQ;
|
||||
extern OSMesg nuContWaitMesgBuf;
|
||||
extern OSMesg nuContDataMutexBuf;
|
||||
extern OSMesgQueue nuContDataMutexQ;
|
||||
|
||||
u8 nuContMgrInit(void) {
|
||||
s32 i;
|
||||
@ -64,21 +66,18 @@ void nuContMgrRemove(void) {
|
||||
|
||||
void nuContDataClose(void) {
|
||||
osSendMesg(&nuContDataMutexQ, NULL, OS_MESG_BLOCK);
|
||||
|
||||
}
|
||||
|
||||
void nuContDataOpen(void) {
|
||||
osRecvMesg(&nuContDataMutexQ, NULL, OS_MESG_BLOCK);
|
||||
}
|
||||
|
||||
INCLUDE_ASM(s32, "os/nusys/nuContMgr", contRetrace);
|
||||
INCLUDE_ASM(s32, "os/nusys/nucontmgr", contRetrace);
|
||||
|
||||
INCLUDE_ASM(s32, "os/nusys/nuContMgr", contReadData);
|
||||
INCLUDE_ASM(s32, "os/nusys/nucontmgr", contReadData);
|
||||
|
||||
INCLUDE_ASM(s32, "os/nusys/nuContMgr", contReadNW);
|
||||
INCLUDE_ASM(s32, "os/nusys/nucontmgr", contReadNW);
|
||||
|
||||
// nuContStatus needs to be declared in this file.
|
||||
#ifdef NON_MATCHING
|
||||
s32 contQuery(void) {
|
||||
s32 ret = osContStartQuery(&nuSiMesgQ);
|
||||
|
||||
@ -91,6 +90,3 @@ s32 contQuery(void) {
|
||||
|
||||
return ret;
|
||||
}
|
||||
#else
|
||||
INCLUDE_ASM(s32, "os/nusys/nuContMgr", contQuery);
|
||||
#endif
|
@ -1,17 +1,18 @@
|
||||
#include "common.h"
|
||||
#include "nu/nusys.h"
|
||||
|
||||
s32 D_80093B80 = 0;
|
||||
NOP_FIX
|
||||
|
||||
s32 D_80093B84[] = {
|
||||
0x4E755379, 0x7374656D, 0x322E3035, 0x00000000
|
||||
};
|
||||
NUScPreNMIFunc nuScPreNMIFunc = NULL;
|
||||
|
||||
s32* D_80093B94 = D_80093B84;
|
||||
char nusys_version[] = "NuSystem2.05";
|
||||
|
||||
u32 nuScRetraceCounter = (u32) nusys_version; // wtf?
|
||||
|
||||
void nuScEventHandler(void);
|
||||
void nuScExecuteAudio(void);
|
||||
void nuScExecuteGraphics(void);
|
||||
void nuScEventBroadcast(NUScMsg* msg);
|
||||
void nuScWaitTaskReady(NUScTask* task);
|
||||
|
||||
extern u64 nuScStack[NU_SC_STACK_SIZE / sizeof(u64)];
|
||||
@ -204,43 +205,22 @@ void nuScResetClientMesgType(NUScClient* client, NUScMsg msgType) {
|
||||
osSetIntMask(mask);
|
||||
}
|
||||
|
||||
#ifdef NON_MATCHING
|
||||
// This should match when data is decompiled.
|
||||
OSMesgQueue* nuScGetGfxMQ(void) {
|
||||
return &nusched.graphicsRequestMQ;
|
||||
}
|
||||
#else
|
||||
INCLUDE_ASM(OSMesgQueue*, "os/nusys/nuSched", nuScGetGfxMQ, void);
|
||||
#endif
|
||||
|
||||
#ifdef NON_MATCHING
|
||||
// This should match when data is decompiled.
|
||||
OSMesgQueue* nuScGetAudioMQ(void) {
|
||||
return &nusched.audioRequestMQ;
|
||||
}
|
||||
#else
|
||||
INCLUDE_ASM(OSMesgQueue*, "os/nusys/nuSched", nuScGetAudioMQ, void);
|
||||
#endif
|
||||
|
||||
#ifdef NON_MATCHING
|
||||
// This should match when data is decompiled.
|
||||
void nuScSetFrameBufferNum(u8 frameBufferNum) {
|
||||
nusched.frameBufferNum = frameBufferNum;
|
||||
}
|
||||
#else
|
||||
INCLUDE_ASM(void, "os/nusys/nuSched", nuScSetFrameBufferNum, u8 frameBufferNum);
|
||||
#endif
|
||||
|
||||
#ifdef NON_MATCHING
|
||||
// This should match when data is decompiled.
|
||||
s32 nuScGetFrameRate(void) {
|
||||
return nusched.frameRate;
|
||||
}
|
||||
#else
|
||||
INCLUDE_ASM(s32, "os/nusys/nuSched", nuScGetFrameRate, void);
|
||||
#endif
|
||||
|
||||
#ifdef NON_MATCHING
|
||||
void nuScEventHandler(void) {
|
||||
OSMesg msg;
|
||||
s32 beforeResetFrame;
|
||||
@ -282,9 +262,6 @@ void nuScEventHandler(void) {
|
||||
}
|
||||
}
|
||||
}
|
||||
#else
|
||||
INCLUDE_ASM(s32, "os/nusys/nuSched", nuScEventHandler, void);
|
||||
#endif
|
||||
|
||||
void nuScEventBroadcast(NUScMsg* msg) {
|
||||
NUScClient* clientList = nusched.clientList;
|
||||
@ -297,4 +274,4 @@ void nuScEventBroadcast(NUScMsg* msg) {
|
||||
}
|
||||
}
|
||||
|
||||
INCLUDE_ASM(void, "os/nusys/nuSched", nuScWaitTaskReady);
|
||||
INCLUDE_ASM(void, "os/nusys/nusched", nuScWaitTaskReady);
|
@ -8,7 +8,7 @@ dlabel D_802429E8_BDD198
|
||||
|
||||
.section .text
|
||||
|
||||
glabel func_80240350_BDAB00
|
||||
glabel obk_09_LoadPartyImage
|
||||
/* BDAB00 80240350 27BDFFD8 */ addiu $sp, $sp, -0x28
|
||||
/* BDAB04 80240354 3C048024 */ lui $a0, %hi(D_802429E8_BDD198)
|
||||
/* BDAB08 80240358 248429E8 */ addiu $a0, $a0, %lo(D_802429E8_BDD198)
|
||||
|
@ -1,6 +1,26 @@
|
||||
#include "jan_04.h"
|
||||
|
||||
// TODO(data)
|
||||
//#define PARTY_IMAGE "party_opuku"
|
||||
//#include "world/common/todo/LoadPartyImage.inc.c"
|
||||
INCLUDE_ASM(s32, "world/area_jan/jan_04/B45150", func_802409E0_B45150);
|
||||
#define PARTY_IMAGE "party_opuku"
|
||||
// #include "world/common/todo/LoadPartyImage.inc.c"
|
||||
API_CALLABLE(N(LoadPartyImage)) {
|
||||
static PAL_BIN palette[256];
|
||||
static IMG_BIN raster[0x3DA0]; // similar to LoadPartyImage include but with 0x10 bytes added for padding
|
||||
static MessageImageData image;
|
||||
|
||||
u32 decompressedSize;
|
||||
void* compressed = load_asset_by_name(PARTY_IMAGE, &decompressedSize);
|
||||
|
||||
decode_yay0(compressed, &palette);
|
||||
general_heap_free(compressed);
|
||||
|
||||
image.raster = raster;
|
||||
image.palette = palette;
|
||||
image.width = 150;
|
||||
image.height = 105;
|
||||
image.format = G_IM_FMT_CI;
|
||||
image.bitDepth = G_IM_SIZ_8b;
|
||||
set_message_images(&image);
|
||||
return ApiStatus_DONE2;
|
||||
}
|
||||
|
||||
const char* N(exit_str_2) = "flo_00\0\0\0\0\0\0\0";
|
||||
|
@ -1,4 +1,3 @@
|
||||
#include "kmr_02.h"
|
||||
|
||||
#include "common/foliage.inc.c"
|
||||
|
||||
|
@ -1,3 +1,8 @@
|
||||
#include "kmr_02.h"
|
||||
|
||||
INCLUDE_ASM(s32, "world/area_kmr/kmr_02/8B3A10", func_802439A0_8B3A10);
|
||||
INCLUDE_ASM(s32, "world/area_kmr/kmr_02/8B3A10", kmr_02_LoadPartyImage);
|
||||
|
||||
// #define PARTY_IMAGE "party_kurio"
|
||||
// #include "world/common/todo/LoadPartyImage.inc.c"
|
||||
|
||||
// const char padding[0x220] = {0};
|
||||
|
@ -163,20 +163,14 @@ ApiStatus func_802428B8_9C7C98(Evt* script, s32 isInitialCall) {
|
||||
return ApiStatus_DONE2;
|
||||
}
|
||||
|
||||
// Requires BSS
|
||||
#ifdef NON_MATCHING
|
||||
ApiStatus func_802428D8_9C7CB8(Evt* script, s32 isInitialCall) {
|
||||
static s16 D_80250810_9D5BF0[] = { 0, 2, 1, 4 };
|
||||
|
||||
Bytecode* args = script->ptrReadPos;
|
||||
s32 index = evt_get_variable(script, *args++);
|
||||
|
||||
NOP_FIX // TODO: REMOVE WHEN DATA (D_80250810_9D5BF0) IS MIGRATED
|
||||
snd_ambient_80055848(D_80250810_9D5BF0[index]);
|
||||
return ApiStatus_DONE2;
|
||||
}
|
||||
#else
|
||||
INCLUDE_ASM(s32, "world/area_nok/nok_01/9C53E0", func_802428D8_9C7CB8);
|
||||
#endif
|
||||
|
||||
ApiStatus func_80242910_9C7CF0(Evt* script, s32 isInitialCall) {
|
||||
gPlayerData.tradeEventStartTime = gPlayerData.frameCounter;
|
||||
|
@ -75,13 +75,11 @@ ApiStatus func_80243010_9DA030(Evt* script, s32 isInitialCall) {
|
||||
return ApiStatus_DONE2;
|
||||
}
|
||||
|
||||
// float regalloc
|
||||
#ifdef NON_MATCHING
|
||||
ApiStatus func_802430CC_9DA0EC(Evt* script, s32 isInitialCall) {
|
||||
PlayerStatus* playerStatus = &gPlayerStatus;
|
||||
Bytecode* args = script->ptrReadPos;
|
||||
Npc* npc1 = evt_get_variable(script, *args++);
|
||||
Npc* npc2 = evt_get_variable(script, *args++);
|
||||
Npc* npc1 = (Npc*) evt_get_variable(script, *args++);
|
||||
Npc* npc2 = (Npc*) evt_get_variable(script, *args++);
|
||||
s32 outVal = FALSE;
|
||||
f32 xDiff, zDiff;
|
||||
|
||||
@ -94,24 +92,25 @@ ApiStatus func_802430CC_9DA0EC(Evt* script, s32 isInitialCall) {
|
||||
script->varTable[2] = 0;
|
||||
}
|
||||
|
||||
xDiff = npc1->pos.x - playerStatus->position.x;
|
||||
zDiff = npc1->pos.z - playerStatus->position.z;
|
||||
if ((SQ(xDiff) + SQ(zDiff) < 6400.0f) && (script->varTable[2] >= 2)) {
|
||||
outVal = TRUE;
|
||||
}
|
||||
do {
|
||||
xDiff = npc1->pos.x - playerStatus->position.x;
|
||||
zDiff = npc1->pos.z - playerStatus->position.z;
|
||||
if ((SQ(xDiff) + SQ(zDiff) < 6400.0f) && (script->varTable[2] >= 2)) {
|
||||
do {
|
||||
outVal = TRUE;
|
||||
} while (0); // TODO required to match
|
||||
}
|
||||
|
||||
xDiff = npc1->pos.x - npc2->pos.x;
|
||||
zDiff = npc1->pos.z - npc2->pos.z;
|
||||
if (SQ(xDiff) + SQ(zDiff) < 1600.0f) {
|
||||
outVal = TRUE;
|
||||
}
|
||||
xDiff = npc1->pos.x - npc2->pos.x;
|
||||
zDiff = npc1->pos.z - npc2->pos.z;
|
||||
if (SQ(xDiff) + SQ(zDiff) < 1600.0f) {
|
||||
outVal = TRUE;
|
||||
}
|
||||
} while (0); // TODO required to match
|
||||
|
||||
script->varTable[0] = outVal;
|
||||
return ApiStatus_DONE2;
|
||||
}
|
||||
#else
|
||||
INCLUDE_ASM(s32, "world/area_nok/nok_02/9D7AA0", func_802430CC_9DA0EC);
|
||||
#endif
|
||||
|
||||
ApiStatus func_80243214_9DA234(Evt* script, s32 isInitialCall) {
|
||||
PlayerStatus* playerStatus = &gPlayerStatus;
|
||||
|
@ -109,12 +109,51 @@ ApiStatus func_80243EC8_9DAEE8(Evt* script, s32 isInitialCall) {
|
||||
return ApiStatus_DONE2;
|
||||
}
|
||||
|
||||
typedef struct UnkNok02 {
|
||||
/* 0x00 */ s32 unk_00;
|
||||
/* 0x04 */ s32 unk_04;
|
||||
/* 0x08 */ s32 unk_08;
|
||||
/* 0x0C */ char unk_0C[0x4];
|
||||
/* 0x10 */ s32 unk_10;
|
||||
/* 0x14 */ s32 unk_14;
|
||||
/* 0x18 */ s32 unk_18;
|
||||
} UnkNok02; // size = 0x1C
|
||||
|
||||
extern UnkNok02 D_80252784_9E97A4[20];
|
||||
extern s32 D_802529B4_9E99D4;
|
||||
|
||||
ApiStatus func_80243F10_9DAF30(Evt* script, s32 isInitialCall);
|
||||
INCLUDE_ASM(s32, "world/area_nok/nok_02/9DA8F0", func_80243F10_9DAF30);
|
||||
|
||||
ApiStatus func_80244078_9DB098(Evt* script, s32 isInitialCall);
|
||||
INCLUDE_ASM(s32, "world/area_nok/nok_02/9DA8F0", func_80244078_9DB098);
|
||||
|
||||
INCLUDE_ASM(s32, "world/area_nok/nok_02/9DA8F0", func_80244224_9DB244);
|
||||
ApiStatus func_80244224_9DB244(Evt* script, s32 isInitialCall) {
|
||||
Bytecode* args = script->ptrReadPos;
|
||||
s32 idx = evt_get_variable(script, *args++) - 1;
|
||||
UnkNok02* temp_v1 = &D_80252784_9E97A4[idx];
|
||||
|
||||
INCLUDE_ASM(s32, "world/area_nok/nok_02/9DA8F0", func_80244288_9DB2A8);
|
||||
script->varTable[0] = temp_v1->unk_00;
|
||||
script->varTable[1] = temp_v1->unk_04;
|
||||
script->varTable[2] = temp_v1->unk_08;
|
||||
return ApiStatus_DONE2;
|
||||
}
|
||||
|
||||
INCLUDE_ASM(s32, "world/area_nok/nok_02/9DA8F0", func_802442E0_9DB300);
|
||||
ApiStatus func_80244288_9DB2A8(Evt* script, s32 isInitialCall) {
|
||||
Bytecode* args = script->ptrReadPos;
|
||||
|
||||
evt_set_variable(script, D_80252784_9E97A4[evt_get_variable(script, *args++) - 1].unk_14, 1);
|
||||
return ApiStatus_DONE2;
|
||||
}
|
||||
|
||||
ApiStatus func_802442E0_9DB300(Evt* script, s32 isInitialCall) {
|
||||
Bytecode *args = script->ptrReadPos;
|
||||
s32 idx = evt_get_variable(script, *(args++)) - 1;
|
||||
s32 val = D_80252784_9E97A4[idx].unk_18;
|
||||
s16* typeFlags = &gItemTable[val].typeFlags;
|
||||
|
||||
D_802529B4_9E99D4 = val;
|
||||
script->varTable[0] = (*typeFlags & ITEM_TYPE_FLAG_CONSUMABLE) > 0;
|
||||
script->varTable[1] = val;
|
||||
return ApiStatus_DONE2;
|
||||
}
|
||||
|
@ -1,6 +1,4 @@
|
||||
#include "nok_04.h"
|
||||
|
||||
// TODO(data)
|
||||
//#define PARTY_IMAGE "party_kameki"
|
||||
//#include "world/common/todo/LoadPartyImage.inc.c"
|
||||
INCLUDE_ASM(s32, "world/area_nok/nok_04/9EEA80", func_80240E90_9EEA80);
|
||||
#define PARTY_IMAGE "party_kameki"
|
||||
#include "world/common/todo/LoadPartyImage.inc.c"
|
||||
|
@ -18,7 +18,19 @@ ApiStatus func_80240038_BBD1D8(Evt* script, s32 isInitialCall) {
|
||||
return ApiStatus_DONE2;
|
||||
}
|
||||
|
||||
INCLUDE_ASM(s32, "world/area_obk/obk_01/BBD1A0", func_8024007C_BBD21C);
|
||||
ApiStatus func_8024007C_BBD21C(Evt* script, s32 isInitialCall) {
|
||||
u32 pressedButtons = gGameStatusPtr->pressedButtons[0];
|
||||
s32 val;
|
||||
|
||||
if (pressedButtons & BUTTON_A) {
|
||||
val = TRUE;
|
||||
} else {
|
||||
val = FALSE;
|
||||
}
|
||||
script->varTable[6] = val;
|
||||
return ApiStatus_DONE2;
|
||||
}
|
||||
|
||||
|
||||
INCLUDE_ASM(s32, "world/area_obk/obk_01/BBD1A0", func_80240098_BBD238);
|
||||
|
||||
|
@ -2,4 +2,7 @@
|
||||
|
||||
static char* N(exit_str_0) = "obk_01\0";
|
||||
|
||||
INCLUDE_ASM(s32, "world/area_obk/obk_09/BDAB00", func_80240350_BDAB00);
|
||||
#define PARTY_IMAGE "party_resa"
|
||||
#include "world/common/todo/LoadPartyImage.inc.c"
|
||||
|
||||
static char* N(exit_str_1) = "omo_03";
|
||||
|
@ -26,3 +26,5 @@ ApiStatus func_802403D8_DDF6E8(Evt* script, s32 isInitialCall) {
|
||||
set_screen_overlay_params_back(0xB, 0.0f);
|
||||
return ApiStatus_DONE2;
|
||||
}
|
||||
|
||||
BSS char N(bss_80241380)[0x10];
|
||||
|
@ -2,7 +2,5 @@
|
||||
|
||||
static char* N(exit_str_0) = "omo_11\0";
|
||||
|
||||
// TODO(data)
|
||||
//#define PARTY_IMAGE "party_akari"
|
||||
//#include "world/common/todo/LoadPartyImage.inc.c"
|
||||
INCLUDE_ASM(s32, "world/area_omo/omo_12/DDF730", func_80240420_DDF730);
|
||||
#define PARTY_IMAGE "party_akari"
|
||||
#include "world/common/todo/LoadPartyImage.inc.c"
|
||||
|
@ -208,8 +208,6 @@ ApiStatus func_802BD758_3184A8(Evt* evt, s32 isInitialCall) {
|
||||
f32* xPtr;
|
||||
|
||||
f32 temp_f0;
|
||||
f32 temp_f0_2;
|
||||
f32 temp_f0_5;
|
||||
s32 var_v0_5;
|
||||
f32 temp1;
|
||||
|
||||
@ -285,32 +283,31 @@ ApiStatus func_802BD758_3184A8(Evt* evt, s32 isInitialCall) {
|
||||
evt->functionTemp[1] = 10;
|
||||
}
|
||||
case 1:
|
||||
if (!(playerStatus->actionState == 0x15 || playerStatus->actionState == 0x16)) {
|
||||
npc->pos.y = playerStatus->position.y + playerStatus->colliderHeight;
|
||||
npc->yaw = playerStatus->targetYaw;
|
||||
if (evt->functionTemp[1] == 1) {
|
||||
suggest_player_anim_clearUnkFlag(ANIM_Mario_60006);
|
||||
}
|
||||
|
||||
if (evt->functionTemp[1] != 0) {
|
||||
evt->functionTemp[1]--;
|
||||
break;
|
||||
}
|
||||
|
||||
sfx_play_sound_at_npc(SOUND_80000000, 0, -4);
|
||||
D_802BE924 = 1;
|
||||
add_vec2D_polar(&npc->pos.x, &npc->pos.z, 0.0f, npc->yaw);
|
||||
npc->currentAnim = ANIM_WorldBombette_WalkLit;
|
||||
npc->jumpVelocity = 0.0f;
|
||||
D_802BE938 = 0;
|
||||
npc->flags = (npc->flags | 0x200) & ~0x100;
|
||||
npc->moveSpeed = 1.0f;
|
||||
evt->functionTemp[0] = 2;
|
||||
evt->functionTemp[1] = 50;
|
||||
} else {
|
||||
if (playerStatus->actionState == 0x15 || playerStatus->actionState == 0x16) {
|
||||
evt->functionTemp[1] = 7;
|
||||
break;
|
||||
}
|
||||
npc->pos.y = playerStatus->position.y + playerStatus->colliderHeight;
|
||||
npc->yaw = playerStatus->targetYaw;
|
||||
if (evt->functionTemp[1] == 1) {
|
||||
suggest_player_anim_clearUnkFlag(ANIM_Mario_60006);
|
||||
}
|
||||
|
||||
if (evt->functionTemp[1] != 0) {
|
||||
evt->functionTemp[1]--;
|
||||
break;
|
||||
}
|
||||
|
||||
sfx_play_sound_at_npc(SOUND_80000000, 0, -4);
|
||||
D_802BE924 = 1;
|
||||
add_vec2D_polar(&npc->pos.x, &npc->pos.z, 0.0f, npc->yaw);
|
||||
npc->currentAnim = ANIM_WorldBombette_WalkLit;
|
||||
npc->jumpVelocity = 0.0f;
|
||||
D_802BE938 = 0;
|
||||
npc->flags = (npc->flags | 0x200) & ~0x100;
|
||||
npc->moveSpeed = 1.0f;
|
||||
evt->functionTemp[0] = 2;
|
||||
evt->functionTemp[1] = 50;
|
||||
case 2:
|
||||
if ((playerStatus->animFlags & 4) || (playerStatus->actionState == 0x15 || playerStatus->actionState == 0x16)) {
|
||||
evt->functionTemp[0] = 7;
|
||||
@ -345,9 +342,9 @@ ApiStatus func_802BD758_3184A8(Evt* evt, s32 isInitialCall) {
|
||||
} else {
|
||||
if (!(evt->functionTemp[1] & 3)) {
|
||||
if (gGameStatusPtr->frameCounter & 1) {
|
||||
sfx_play_sound_at_npc(SOUND_141, 0, -4);
|
||||
sfx_play_sound_at_npc(SOUND_STEP_NORMAL1, 0, -4);
|
||||
} else {
|
||||
sfx_play_sound_at_npc(SOUND_142, 0, -4);
|
||||
sfx_play_sound_at_npc(SOUND_STEP_NORMAL2, 0, -4);
|
||||
}
|
||||
}
|
||||
if (evt->functionTemp[1] == 40) {
|
||||
@ -397,13 +394,13 @@ ApiStatus func_802BD758_3184A8(Evt* evt, s32 isInitialCall) {
|
||||
|
||||
switch (gPlayerData.partners[gPlayerData.currentPartner].level) {
|
||||
case 0:
|
||||
sfx_play_sound_at_npc(SOUND_2016, 0, -4);
|
||||
sfx_play_sound_at_npc(SOUND_CANNON1, 0, -4);
|
||||
break;
|
||||
case 1:
|
||||
sfx_play_sound_at_npc(SOUND_2017, 0, -4);
|
||||
sfx_play_sound_at_npc(SOUND_CANNON2, 0, -4);
|
||||
break;
|
||||
case 2:
|
||||
sfx_play_sound_at_npc(SOUND_2018, 0, -4);
|
||||
sfx_play_sound_at_npc(SOUND_CANNON3, 0, -4);
|
||||
break;
|
||||
}
|
||||
|
||||
@ -512,8 +509,8 @@ ApiStatus func_802BD758_3184A8(Evt* evt, s32 isInitialCall) {
|
||||
if (D_802BE924 == 0) {
|
||||
return ApiStatus_DONE2;
|
||||
}
|
||||
sfx_stop_sound(SOUND_80000000); // TODO swapping these causes tail merging that we don't want
|
||||
D_802BE924 = 0;
|
||||
sfx_stop_sound(SOUND_80000000);
|
||||
return ApiStatus_DONE2;
|
||||
case 8:
|
||||
if (D_802BE92C != 0) {
|
||||
@ -535,12 +532,11 @@ ApiStatus func_802BD758_3184A8(Evt* evt, s32 isInitialCall) {
|
||||
xPtr = &npc->pos.x;
|
||||
zPtr = &npc->pos.z;
|
||||
if (D_802BE920 == 0) {
|
||||
temp_f0_5 = clamp_angle(playerStatus->targetYaw + 90.0f);
|
||||
add_vec2D_polar(xPtr, zPtr, playerStatus->colliderDiameter / 4, clamp_angle(playerStatus->targetYaw + 90.0f));
|
||||
} else {
|
||||
temp_f0_5 = clamp_angle(playerStatus->targetYaw - 90.0f);
|
||||
add_vec2D_polar(xPtr, zPtr, playerStatus->colliderDiameter / 4, clamp_angle(playerStatus->targetYaw - 90.0f));
|
||||
}
|
||||
|
||||
add_vec2D_polar(xPtr, zPtr, playerStatus->colliderDiameter / 4, temp_f0_5);
|
||||
npc->jumpVelocity = 0.0f;
|
||||
partner_clear_player_tracking(npc);
|
||||
if (D_802BE924 == 0) {
|
||||
@ -548,7 +544,7 @@ ApiStatus func_802BD758_3184A8(Evt* evt, s32 isInitialCall) {
|
||||
}
|
||||
D_802BE924 = 0;
|
||||
sfx_stop_sound(SOUND_80000000);
|
||||
break;
|
||||
return ApiStatus_DONE2;
|
||||
}
|
||||
|
||||
return ApiStatus_BLOCK;
|
||||
|
@ -221,28 +221,25 @@ s32 world_goombario_can_pause(Npc* goombario) {
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
// get message for tattle routine
|
||||
#ifdef NON_MATCHING
|
||||
ApiStatus func_802BD5D8_3174F8(Evt* script, s32 isInitialCall) {
|
||||
PlayerStatus* playerStatus = &gPlayerStatus;
|
||||
Npc* goombario = script->owner2.npc;
|
||||
s32 msgID;
|
||||
s32 entityType;
|
||||
s32 triggerSomething;
|
||||
s32 temp; // TODO required to match (this temp needs to be used in two places for different things)
|
||||
s32 v1;
|
||||
s32 i;
|
||||
s32 v0;
|
||||
s32 i;
|
||||
|
||||
if (isInitialCall) {
|
||||
func_802BD564_317484(goombario);
|
||||
D_802BDF64 = 0;
|
||||
D_802BDF30 = 0;
|
||||
D_802BDF34 = 0;
|
||||
if (playerStatus->animFlags & 0x20) {
|
||||
if (playerStatus->animFlags & PA_FLAGS_SPEECH_PROMPT_AVAILABLE) {
|
||||
D_802BDF30 = 1;
|
||||
D_802BDF38 = D_802B79A8_E21858->unk_00;
|
||||
}
|
||||
if (playerStatus->animFlags & 0x10) {
|
||||
if (playerStatus->animFlags & PA_FLAGS_INTERACT_PROMPT_AVAILABLE) {
|
||||
D_802BDF34 = 1;
|
||||
}
|
||||
script->functionTemp[0] = 40;
|
||||
@ -250,7 +247,7 @@ ApiStatus func_802BD5D8_3174F8(Evt* script, s32 isInitialCall) {
|
||||
|
||||
switch (script->functionTemp[0]) {
|
||||
case 40:
|
||||
if (!(goombario->flags & 0x1000) || playerStatus->inputEnabledCounter != 0) {
|
||||
if (!(goombario->flags & NPC_FLAG_1000) || playerStatus->inputEnabledCounter != 0) {
|
||||
script->varTable[0] = -1;
|
||||
return ApiStatus_DONE2;
|
||||
}
|
||||
@ -275,7 +272,7 @@ ApiStatus func_802BD5D8_3174F8(Evt* script, s32 isInitialCall) {
|
||||
break;
|
||||
case 0:
|
||||
set_time_freeze_mode(1);
|
||||
playerStatus->flags &= ~0x2000000;
|
||||
playerStatus->flags &= ~PS_FLAGS_HAS_CONVERSATION_NPC;
|
||||
goombario->currentAnim = 0x010001;
|
||||
goombario->yaw = clamp_angle(gCameras[CAM_DEFAULT].currentYaw + playerStatus->spriteFacingAngle - 90.0f);
|
||||
gPartnerActionStatus.partnerActionState = 1;
|
||||
@ -289,58 +286,58 @@ ApiStatus func_802BD5D8_3174F8(Evt* script, s32 isInitialCall) {
|
||||
/* fallthrough */
|
||||
case 1:
|
||||
if (GoombarioGetTattleID >= 0 && (GoombarioGetTattleID & 0x4000)) {
|
||||
entityType = get_entity_type(GoombarioGetTattleID);
|
||||
temp = get_entity_type(GoombarioGetTattleID);
|
||||
msgID = -1;
|
||||
do {} while (0);
|
||||
for (i = 0; EntityTattles[2 * i] != -1; i++) {
|
||||
if (EntityTattles[2 * i] != entityType) {
|
||||
if (EntityTattles[2 * i] != temp) {
|
||||
continue;
|
||||
}
|
||||
switch (entityType) {
|
||||
switch (temp) {
|
||||
case 22:
|
||||
case 25:
|
||||
if (gPlayerData.hammerLevel >= 1) {
|
||||
msgID = 0x1B0002;
|
||||
msgID = MSG_EntityTattle_HammerBlock2_CanBreak;
|
||||
}
|
||||
break;
|
||||
case 23:
|
||||
case 26:
|
||||
if (gPlayerData.hammerLevel >= 2) {
|
||||
msgID = 0x1B0004;
|
||||
msgID = MSG_EntityTattle_HammerBlock3_CanBreak;
|
||||
}
|
||||
break;
|
||||
case 36:
|
||||
if (gPlayerData.bootsLevel == 1) {
|
||||
msgID = 0x1B0018;
|
||||
msgID = MSG_EntityTattle_WoodenCrate_SpinJump;
|
||||
} else if (gPlayerData.bootsLevel == 2) {
|
||||
msgID = 0x1B0019;
|
||||
msgID = MSG_EntityTattle_WoodenCrate_TornadoJump;
|
||||
}
|
||||
break;
|
||||
case 37:
|
||||
if (gPlayerData.bootsLevel == 1) {
|
||||
msgID = 0x1B001B;
|
||||
msgID = MSG_EntityTattle_BoardedFloor_SpinJump;
|
||||
} else if (gPlayerData.bootsLevel == 2) {
|
||||
msgID = 0x1B001C;
|
||||
msgID = MSG_EntityTattle_BoardedFloor_TornadoJump;
|
||||
}
|
||||
break;
|
||||
case 9:
|
||||
if (gPlayerData.bootsLevel >= 2) {
|
||||
msgID = 0x1B000D;
|
||||
msgID = MSG_EntityTattle_BigSwitch_TornadoJump;
|
||||
}
|
||||
break;
|
||||
case 10:
|
||||
if (gPlayerData.bootsLevel >= 2) {
|
||||
msgID = 0x1B000F;
|
||||
msgID = MSG_EntityTattle_FloorSwitch_TornadoJump;
|
||||
}
|
||||
break;
|
||||
case 49:
|
||||
if (gPlayerData.bootsLevel >= 2) {
|
||||
msgID = 0x1B001E;
|
||||
msgID = MSG_EntityTattle_JackInTheBox_TornadoJump;
|
||||
}
|
||||
break;
|
||||
case 50:
|
||||
if (get_entity_by_index(GoombarioGetTattleID & 0x3FFF)->dataBuf.chest->itemID == -1) {
|
||||
msgID = 0x1B0016;
|
||||
msgID = MSG_EntityTattle_EmptyChest;
|
||||
}
|
||||
break;
|
||||
}
|
||||
@ -359,7 +356,7 @@ ApiStatus func_802BD5D8_3174F8(Evt* script, s32 isInitialCall) {
|
||||
v0 = get_enemy(D_802BDF38->npcID)->tattleMsg;
|
||||
if (v0 != 0) {
|
||||
msgID = v0;
|
||||
if (msgID < -270000000) {
|
||||
if (msgID < EVT_LIMIT) {
|
||||
script->varTable[0] = ((s32(*)(void))msgID)();
|
||||
} else {
|
||||
script->varTable[0] = msgID;
|
||||
@ -370,21 +367,22 @@ ApiStatus func_802BD5D8_3174F8(Evt* script, s32 isInitialCall) {
|
||||
}
|
||||
|
||||
if (D_802BDF34 != 0) {
|
||||
script->varTable[0] = 0x1B0025;
|
||||
script->varTable[0] = MSG_EntityTattle_25;
|
||||
script->varTable[1] = 0;
|
||||
return ApiStatus_DONE2;
|
||||
}
|
||||
|
||||
temp = 0;
|
||||
if (GoombarioGetTattleID >= 0) {
|
||||
v1 = func_802BD100_317020(GoombarioGetTattleID);
|
||||
temp = func_802BD100_317020(GoombarioGetTattleID);
|
||||
} else {
|
||||
v1 = 0;
|
||||
temp = 0;
|
||||
}
|
||||
|
||||
if (v1 == 0) {
|
||||
if (temp == 0) {
|
||||
msgID = get_current_map_settings()->tattle.msgID;
|
||||
if (msgID != 0) {
|
||||
if (msgID < -270000000) {
|
||||
if (msgID < EVT_LIMIT) {
|
||||
script->varTable[0] = ((s32(*)(void))msgID)();
|
||||
} else {
|
||||
script->varTable[0] = msgID;
|
||||
@ -392,7 +390,7 @@ ApiStatus func_802BD5D8_3174F8(Evt* script, s32 isInitialCall) {
|
||||
}
|
||||
}
|
||||
} else {
|
||||
script->varTable[0] = v1;
|
||||
script->varTable[0] = temp;
|
||||
script->varTable[1] = 1;
|
||||
}
|
||||
return ApiStatus_DONE2;
|
||||
@ -402,7 +400,7 @@ ApiStatus func_802BD5D8_3174F8(Evt* script, s32 isInitialCall) {
|
||||
case 10:
|
||||
msgID = get_current_map_settings()->tattle.msgID;
|
||||
if (msgID != 0) {
|
||||
if (msgID < -270000000) {
|
||||
if (msgID < EVT_LIMIT) {
|
||||
script->varTable[0] = ((s32(*)(void))msgID)();
|
||||
} else {
|
||||
script->varTable[0] = msgID;
|
||||
@ -422,10 +420,6 @@ ApiStatus func_802BD5D8_3174F8(Evt* script, s32 isInitialCall) {
|
||||
}
|
||||
return ApiStatus_BLOCK;
|
||||
}
|
||||
#else
|
||||
ApiStatus func_802BD5D8_3174F8(Evt* script, s32 isInitialCall);
|
||||
INCLUDE_ASM(ApiStatus, "world/partner/goombario", func_802BD5D8_3174F8, Evt* script, s32 isInitialCall);
|
||||
#endif
|
||||
|
||||
ApiStatus func_802BDB30_317A50(Evt* script, s32 isInitialCall) {
|
||||
PartnerActionStatus* goombarioActionStatus = &gPartnerActionStatus;
|
||||
|
@ -3,34 +3,35 @@
|
||||
#include "npc.h"
|
||||
#include "effects.h"
|
||||
#include "sprite/npc/WorldSushie.h"
|
||||
#include "sprite.h"
|
||||
|
||||
extern s16 D_8010C97A;
|
||||
|
||||
BSS f32 OriginalPlayerY;
|
||||
BSS s32 bss_802BFEE4;
|
||||
BSS s32 bss_802BFEE8;
|
||||
BSS s32 D_802BFEEC;
|
||||
BSS s32 bss_802BFEEC;
|
||||
BSS s32 bss_802BFEF0;
|
||||
BSS s32 bss_802BFEF4;
|
||||
BSS s32 D_802BFEF8;
|
||||
BSS f32 bss_802BFEF8;
|
||||
BSS f32 bss_802BFEFC;
|
||||
BSS s32 bss_802BFF00;
|
||||
BSS s32 bss_802BFF04;
|
||||
BSS s32 bss_802BFF08;
|
||||
BSS f32 bss_802BFF00;
|
||||
BSS f32 bss_802BFF04;
|
||||
BSS f32 bss_802BFF08;
|
||||
BSS s32 bss_802BFF0C;
|
||||
BSS TweesterPhysics SushieTweesterPhysics;
|
||||
|
||||
|
||||
f32 D_802BFDB0_320B20 = 0.0f;
|
||||
f32 D_802BFDB4_320B24 = 0.0f;
|
||||
f32 D_802BFDB8_320B28 = 0.0f;
|
||||
f32 D_802BFDBC_320B2C = 0.0f;
|
||||
|
||||
void func_802BF920_320690(Npc* sushie);
|
||||
|
||||
void func_802BD100_31DE70(void) {
|
||||
Npc* partnerNPC = get_npc_unsafe(NPC_PARTNER);
|
||||
PlayerStatus* playerStatus = &gPlayerStatus;
|
||||
Camera* cam = &gCameras[CAM_DEFAULT];
|
||||
Camera* camera = &gCameras[CAM_DEFAULT];
|
||||
s32 phi_v1;
|
||||
|
||||
playerStatus->position.x = partnerNPC->pos.x;
|
||||
@ -45,18 +46,18 @@ void func_802BD100_31DE70(void) {
|
||||
}
|
||||
|
||||
playerStatus->position.z -= cos_rad(DEG_TO_RAD(
|
||||
cam->currentYaw + playerStatus->spriteFacingAngle - 90.0f + phi_v1)) * -4.0f;
|
||||
camera->currentYaw + playerStatus->spriteFacingAngle - 90.0f + phi_v1)) * -4.0f;
|
||||
}
|
||||
|
||||
void func_802BD20C_31DF7C(f32* arg0, f32* arg1) {
|
||||
f32 temp_f22;
|
||||
f32 phi_f20;
|
||||
f32 temp_f2 = gPartnerActionStatus.stickY;
|
||||
f32 temp_f0 = gPartnerActionStatus.stickX;
|
||||
f32 stickY = gPartnerActionStatus.stickY;
|
||||
f32 stickX = gPartnerActionStatus.stickX;
|
||||
|
||||
D_802BFDB0_320B20 = temp_f0;
|
||||
D_802BFDB4_320B24 = temp_f2;
|
||||
temp_f22 = clamp_angle(atan2(0.0f, 0.0f, temp_f0, -temp_f2) + gCameras[CAM_DEFAULT].currentYaw);
|
||||
D_802BFDB0_320B20 = stickX;
|
||||
D_802BFDB4_320B24 = stickY;
|
||||
temp_f22 = clamp_angle(atan2(0.0f, 0.0f, stickX, -stickY) + gCameras[CAM_DEFAULT].currentYaw);
|
||||
phi_f20 = 0.0f;
|
||||
|
||||
if (dist2D(0.0f, 0.0f, D_802BFDB0_320B20, -D_802BFDB4_320B24) >= 1.0) {
|
||||
@ -90,7 +91,223 @@ void func_802BD368_31E0D8(s32 arg0, f32 arg1, f32 arg2, f32 arg3, f32 arg4, f32
|
||||
}
|
||||
}
|
||||
|
||||
INCLUDE_ASM(s32, "world/partner/sushie", func_802BD414_31E184);
|
||||
// void func_802BD414_31E184(Npc*);
|
||||
// INCLUDE_ASM(s32, "world/partner/sushie", func_802BD414_31E184);
|
||||
void func_802BD414_31E184(Npc* npc) {
|
||||
PlayerStatus* playerStatus = &gPlayerStatus;
|
||||
PartnerActionStatus* partnerActionStatus = &gPartnerActionStatus;
|
||||
CollisionStatus* collisionStatus = &gCollisionStatus;
|
||||
f32 var_f20;
|
||||
f32 sp20;
|
||||
f32 sp24;
|
||||
f32 sinTheta, cosTheta;
|
||||
f32 x, y, z;
|
||||
f32 sp3C;
|
||||
|
||||
func_802BD20C_31DF7C(&sp20, &sp24);
|
||||
if (bss_802BFEE4 != 0) {
|
||||
var_f20 = 80.0f;
|
||||
} else {
|
||||
var_f20 = 32.0f;
|
||||
}
|
||||
|
||||
if (sp24 != 0.0f) {
|
||||
f32 t1;
|
||||
f32 t2;
|
||||
f32 t3;
|
||||
|
||||
t3 = D_802BFDB0_320B20 * D_802BFDB8_320B28;
|
||||
t1 = 8.0f;
|
||||
t2 = 32.0f;
|
||||
|
||||
if (t3 > 0.0f) {
|
||||
D_802BFDB8_320B28 += D_802BFDB0_320B20 / t2;
|
||||
} else {
|
||||
D_802BFDB8_320B28 += D_802BFDB0_320B20 / t1;
|
||||
}
|
||||
if (D_802BFDB0_320B20 > 0.0f) {
|
||||
if (D_802BFDB0_320B20 < D_802BFDB8_320B28) {
|
||||
D_802BFDB8_320B28 = D_802BFDB0_320B20;
|
||||
}
|
||||
} else {
|
||||
if (D_802BFDB8_320B28 < D_802BFDB0_320B20) {
|
||||
D_802BFDB8_320B28 = D_802BFDB0_320B20;
|
||||
}
|
||||
}
|
||||
|
||||
if (D_802BFDB4_320B24 * D_802BFDBC_320B2C > 0.0f) {
|
||||
D_802BFDBC_320B2C += D_802BFDB4_320B24 / t2;
|
||||
} else {
|
||||
D_802BFDBC_320B2C += D_802BFDB4_320B24 / t1;
|
||||
}
|
||||
if (D_802BFDB4_320B24 > 0.0f) {
|
||||
if (D_802BFDB4_320B24 < D_802BFDBC_320B2C) {
|
||||
D_802BFDBC_320B2C = D_802BFDB4_320B24;
|
||||
}
|
||||
} else {
|
||||
if (D_802BFDBC_320B2C < D_802BFDB4_320B24) {
|
||||
D_802BFDBC_320B2C = D_802BFDB4_320B24;
|
||||
}
|
||||
}
|
||||
|
||||
sp20 = clamp_angle(atan2(0.0f, 0.0f, D_802BFDB8_320B28, -D_802BFDBC_320B2C) + gCameras[CAM_DEFAULT].currentYaw);
|
||||
if (bss_802BFEF8 <= sp24) {
|
||||
bss_802BFEF8 = bss_802BFEF8 + ((sp24 - bss_802BFEF8) / var_f20);
|
||||
if (bss_802BFEF8 > sp24) {
|
||||
bss_802BFEF8 = sp24;
|
||||
}
|
||||
} else {
|
||||
bss_802BFEF8 += (sp24 - bss_802BFEF8) / var_f20;
|
||||
}
|
||||
sp24 = bss_802BFEF8;
|
||||
bss_802BFEFC = sp20;
|
||||
sin_cos_rad(DEG_TO_RAD(sp20), &sinTheta, &cosTheta);
|
||||
bss_802BFF00 += (sp24 * sinTheta) / var_f20;
|
||||
bss_802BFF04 += (-sp24 * cosTheta) / var_f20;
|
||||
} else {
|
||||
bss_802BFEF8 -= 0.15;
|
||||
if (bss_802BFEF8 < 0.0f) {
|
||||
bss_802BFEF8 = 0.0f;
|
||||
D_802BFDBC_320B2C = 0.0f;
|
||||
D_802BFDB8_320B28 = 0.0f;
|
||||
}
|
||||
sp24 = bss_802BFEF8;
|
||||
sp20 = bss_802BFEFC;
|
||||
sin_cos_rad(DEG_TO_RAD(bss_802BFEFC), &sinTheta, &cosTheta);
|
||||
bss_802BFF00 = sp24 * sinTheta;
|
||||
bss_802BFF04 = -sp24 * cosTheta;
|
||||
}
|
||||
npc->moveSpeed = sp24;
|
||||
if (sp24 != 0.0f) {
|
||||
npc->yaw = sp20;
|
||||
x = npc->pos.x;
|
||||
z = npc->pos.z;
|
||||
y = npc->moveToPos.y + -6.0f;
|
||||
sp3C = (npc->collisionHeight * 0.5f) + (playerStatus->colliderHeight * 0.8f);
|
||||
if (npc_test_move_taller_with_slipping(npc->collisionChannel, &x, &y, &z, npc->moveSpeed, sp20, sp3C,
|
||||
npc->collisionRadius) != 0)
|
||||
{
|
||||
collisionStatus->pushingAgainstWall = D_8010C978;
|
||||
if ((get_collider_flags(D_8010C978) & 0xFF) == 4) {
|
||||
bss_802BFEF0++;
|
||||
} else {
|
||||
bss_802BFEF0 = 0;
|
||||
}
|
||||
npc->pos.x += (x - npc->pos.x) * 0.5f;
|
||||
npc->pos.z += (z - npc->pos.z) * 0.5f;
|
||||
} else {
|
||||
npc_move_heading(npc, sp24, sp20);
|
||||
collisionStatus->pushingAgainstWall = -1;
|
||||
}
|
||||
sp24 = 2.0f;
|
||||
sp20 = clamp_angle(npc->yaw - 30.0f);
|
||||
x = npc->pos.x;
|
||||
z = npc->pos.z;
|
||||
y = npc->moveToPos.y + -6.0f;
|
||||
sp3C = (npc->collisionHeight * 0.5f) + (playerStatus->colliderHeight * 0.8f);
|
||||
if (npc_test_move_taller_with_slipping(npc->collisionChannel, &x, &y, &z, sp24, sp20, sp3C, npc->collisionRadius) != 0) {
|
||||
npc->pos.x += (x - npc->pos.x) / 5.0f;
|
||||
npc->pos.z += (z - npc->pos.z) / 5.0f;
|
||||
}
|
||||
sp20 = clamp_angle(npc->yaw + 30.0f);
|
||||
x = npc->pos.x;
|
||||
z = npc->pos.z;
|
||||
y = npc->moveToPos.y + -6.0f;
|
||||
sp3C = (npc->collisionHeight * 0.5f) + (playerStatus->colliderHeight * 0.8f);
|
||||
if (npc_test_move_taller_with_slipping(npc->collisionChannel, &x, &y, &z, sp24, sp20, sp3C, npc->collisionRadius) != 0) {
|
||||
npc->pos.x += (x - npc->pos.x) / 5.0f;
|
||||
npc->pos.z += (z - npc->pos.z) / 5.0f;
|
||||
}
|
||||
}
|
||||
if (bss_802BFEE4 == 0) {
|
||||
func_802BD368_31E0D8(npc->collisionChannel, npc->pos.x, npc->pos.y, npc->pos.z, npc->yaw,
|
||||
npc->collisionRadius * 0.5f);
|
||||
if (bss_802BFEE4 == 0) {
|
||||
npc->moveSpeed = 3.0f;
|
||||
npc->moveToPos.y = OriginalPlayerY - (npc->collisionHeight * 0.5f);
|
||||
bss_802BFEE8 = 0;
|
||||
if (partnerActionStatus->pressedButtons & BUTTON_C_DOWN) {
|
||||
bss_802BFEE4 = 1;
|
||||
npc->moveSpeed = 2.0f;
|
||||
} else {
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (bss_802BFEE4 == 1 && (partnerActionStatus->currentButtons & 4) && bss_802BFEE8 == 0) {
|
||||
bss_802BFEE4 = 2;
|
||||
}
|
||||
bss_802BFEE8++;
|
||||
if (bss_802BFEE4 == 2) {
|
||||
x = npc->pos.x;
|
||||
y = npc->pos.y;
|
||||
z = npc->pos.z;
|
||||
sp3C = npc->collisionHeight;
|
||||
if (npc_raycast_down_around(npc->collisionChannel, &x, &y, &z, &sp3C, npc->yaw, npc->collisionRadius) != 0) {
|
||||
var_f20 = ((OriginalPlayerY - (playerStatus->colliderHeight * 2)) - npc->moveToPos.y) * 0.1f;
|
||||
npc->moveToPos.y += var_f20;
|
||||
if (npc->moveToPos.y < y + 5.0f) {
|
||||
npc->moveToPos.y = y + 5.0f;
|
||||
}
|
||||
} else {
|
||||
var_f20 = ((OriginalPlayerY - (playerStatus->colliderHeight * 2)) - npc->moveToPos.y) * 0.1f;
|
||||
npc->moveToPos.y += var_f20;
|
||||
}
|
||||
if (bss_802BFEE8 == ((bss_802BFEE8 / 6) * 6)) {
|
||||
fx_rising_bubble(0, npc->pos.x, npc->moveToPos.y + (npc->collisionHeight * 0.5f), npc->pos.z,
|
||||
(OriginalPlayerY - npc->moveToPos.y) - (npc->collisionHeight * 0.5f));
|
||||
}
|
||||
if (bss_802BFEE8 == 1) {
|
||||
suggest_player_anim_setUnkFlag(ANIM_Mario_80010);
|
||||
npc->currentAnim = 0x7000A;
|
||||
}
|
||||
if (bss_802BFEF4 == 0 && (playerStatus->position.y + (playerStatus->colliderHeight * 0.5f) < OriginalPlayerY)) {
|
||||
bss_802BFEF4 = 1;
|
||||
playerStatus->renderMode = 0xD;
|
||||
func_802DDFF8(playerStatus->trueAnimation, 4, 2, 0, 0, 0, 0);
|
||||
func_8003D624(npc, 4, 2, 0, 0, 0, 0);
|
||||
}
|
||||
if (bss_802BFEE8 >= 10 && (!(partnerActionStatus->currentButtons & BUTTON_C_DOWN) || bss_802BFEE8 >= 30)) {
|
||||
npc->currentAnim = 0x7000C;
|
||||
sfx_play_sound_at_npc(SOUND_694, 0, NPC_PARTNER);
|
||||
bss_802BFEE4 = 3;
|
||||
}
|
||||
}
|
||||
|
||||
x = npc->pos.x;
|
||||
y = npc->moveToPos.y;
|
||||
z = npc->pos.z;
|
||||
sp3C = (npc->collisionHeight * 0.5f) + playerStatus->colliderHeight;
|
||||
if (npc_raycast_up_corners(npc->collisionChannel, &x, &y, &z, &sp3C, npc->yaw, npc->collisionRadius * 0.3f) >= 0) {
|
||||
npc->moveToPos.y += (((npc->moveToPos.y - y) + sp3C) - ((npc->collisionHeight * 0.5f) + playerStatus->colliderHeight)) * 0.2f;
|
||||
if (bss_802BFEE8 == ((bss_802BFEE8 / 9) * 9)) {
|
||||
fx_rising_bubble(0, npc->pos.x, npc->moveToPos.y + (npc->collisionHeight * 0.5f), npc->pos.z,
|
||||
(OriginalPlayerY - npc->moveToPos.y) - (npc->collisionHeight * 0.5f));
|
||||
}
|
||||
} else if (bss_802BFEE4 == 3) {
|
||||
bss_802BFF08 += 0.14;
|
||||
if (bss_802BFF08 > 1.8) {
|
||||
bss_802BFF08 = 1.8f;
|
||||
}
|
||||
npc->moveToPos.y += bss_802BFF08;
|
||||
if (bss_802BFEE8 == ((bss_802BFEE8 / 9) * 9)) {
|
||||
fx_rising_bubble(0, npc->pos.x, npc->moveToPos.y + npc->collisionHeight * 0.5f, npc->pos.z,
|
||||
(OriginalPlayerY - npc->moveToPos.y) - npc->collisionHeight * 0.5f);
|
||||
}
|
||||
if ((OriginalPlayerY - npc->moveToPos.y) - (npc->collisionHeight * 0.5f) <= 0.0f) {
|
||||
if (bss_802BFEF4 != 0) {
|
||||
bss_802BFEF4 = 0;
|
||||
func_802DDFF8(0x10002, 0, 0, 0, 0, 0, 0);
|
||||
func_8003D624(npc, 0, 0, 0, 0, 0, 0);
|
||||
}
|
||||
bss_802BFEE4 = 0;
|
||||
npc->currentAnim = 0x7000A;
|
||||
npc->moveToPos.y = OriginalPlayerY - (npc->collisionHeight * 0.5f);
|
||||
suggest_player_anim_setUnkFlag(ANIM_Mario_8000F);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
s32 func_802BE280_31EFF0(s32 arg0, f32* x, f32* y, f32* z, f32 length, f32 radius, f32* yaw) {
|
||||
f32 sinAngle, cosAngle, hitX, hitY, hitZ, totalLength, hitNx, hitNy, hitNz;
|
||||
@ -108,8 +325,358 @@ s32 func_802BE280_31EFF0(s32 arg0, f32* x, f32* y, f32* z, f32 length, f32 radiu
|
||||
return hitResult;
|
||||
}
|
||||
|
||||
void func_802BE3A4_31F114(Npc*);
|
||||
INCLUDE_ASM(s32, "world/partner/sushie", func_802BE3A4_31F114);
|
||||
ApiStatus func_802BE3A4_31F114(Evt* script, s32 isInitialCall) {
|
||||
PlayerStatus* playerStatus = &gPlayerStatus;
|
||||
PlayerData* playerData = &gPlayerData;
|
||||
CollisionStatus* collisionStatus = &gCollisionStatus;
|
||||
PartnerActionStatus* partnerActionStatus = &gPartnerActionStatus;
|
||||
Npc* npc = script->owner2.npc;
|
||||
s32 colliderFlags;
|
||||
f32 yTemp;
|
||||
f64 zTemp;
|
||||
f64 xTemp;
|
||||
f32 x, y, z;
|
||||
f32 angle;
|
||||
f32 dist;
|
||||
f32 sp34;
|
||||
f32 sinTheta;
|
||||
f32 cosTheta;
|
||||
s32 collider;
|
||||
s32 t;
|
||||
|
||||
if (isInitialCall) {
|
||||
func_802BF920_320690(npc);
|
||||
bss_802BFEFC = 0.0f;
|
||||
bss_802BFEF8 = 0.0f;
|
||||
bss_802BFF00 = 0.0f;
|
||||
bss_802BFF04 = 0.0f;
|
||||
bss_802BFF08 = 0.0f;
|
||||
script->functionTemp[0] = 0;
|
||||
}
|
||||
playerData->partnerUsedTime[PARTNER_SUSHIE]++;
|
||||
playerStatus->animFlags &= ~PA_FLAGS_RIDING_PARTNER;
|
||||
|
||||
switch (script->functionTemp[0]) {
|
||||
case 0:
|
||||
if (!gGameStatusPtr->keepUsingPartnerOnMapChange) {
|
||||
collider = collisionStatus->currentWall;
|
||||
if (collider >= 0 && !(collider & 0x4000)) {
|
||||
collider = get_collider_flags(collider) & 0xFF;
|
||||
if (collider != SURFACE_TYPE_DOCK_WALL) {
|
||||
return ApiStatus_DONE1;
|
||||
}
|
||||
script->functionTemp[0] = 20;
|
||||
break;
|
||||
}
|
||||
return ApiStatus_DONE1;
|
||||
}
|
||||
npc->moveToPos.y = npc->pos.y;
|
||||
playerStatus->position.y = npc->moveToPos.y + 16.0f;
|
||||
bss_802BFEEC = 1;
|
||||
npc->flags |= NPC_FLAG_ENABLE_HIT_SCRIPT;
|
||||
npc->flags &= ~NPC_FLAG_GRAVITY;
|
||||
npc->flags |= NPC_FLAG_100;
|
||||
suggest_player_anim_setUnkFlag(ANIM_Mario_8000F);
|
||||
disable_player_shadow();
|
||||
disable_npc_shadow(npc);
|
||||
func_8003D624(npc, 4, 2, 0, 0, 0, 0);
|
||||
npc->currentAnim = 0x7000A;
|
||||
npc->moveSpeed = playerStatus->runSpeed;
|
||||
npc->jumpScale = 0.0f;
|
||||
partnerActionStatus->partnerActionState = PARTNER_ACTION_USE;
|
||||
gGameStatusPtr->keepUsingPartnerOnMapChange = FALSE;
|
||||
partnerActionStatus->actingPartner = PARTNER_SUSHIE;
|
||||
bss_802BFEE4 = 0;
|
||||
bss_802BFEE8 = 0;
|
||||
script->functionTemp[2] = 0;
|
||||
script->functionTemp[0] = 1;
|
||||
break;
|
||||
case 20:
|
||||
if (collisionStatus->currentWall >= 0) {
|
||||
get_collider_center(collisionStatus->currentWall, &x, &y, &z);
|
||||
angle = atan2(x, z, playerStatus->position.x, playerStatus->position.z);
|
||||
x = playerStatus->position.x;
|
||||
y = playerStatus->position.y;
|
||||
z = playerStatus->position.z;
|
||||
collider = func_802BE280_31EFF0(0, &x, &y, &z, playerStatus->colliderDiameter * 0.5f,
|
||||
2.0f * playerStatus->colliderDiameter, &angle);
|
||||
colliderFlags = -1;
|
||||
if (collider >= 0) {
|
||||
colliderFlags = get_collider_flags(collider) & 0xFF;
|
||||
}
|
||||
if (colliderFlags == SURFACE_TYPE_DOCK_WALL) {
|
||||
bss_802BFEEC = 1;
|
||||
set_action_state(ACTION_STATE_RIDE);
|
||||
disable_player_static_collisions();
|
||||
disable_player_input();
|
||||
npc->collisionChannel = COLLISION_CHANNEL_80000;
|
||||
npc->moveToPos.x = playerStatus->position.x;
|
||||
npc->moveToPos.y = playerStatus->position.y;
|
||||
npc->moveToPos.z = playerStatus->position.z;
|
||||
npc->yaw = angle;
|
||||
playerStatus->targetYaw = angle;
|
||||
npc->renderYaw = 90.0f;
|
||||
add_vec2D_polar(&npc->moveToPos.x, &npc->moveToPos.z, 40.0f, npc->yaw);
|
||||
x = npc->moveToPos.x;
|
||||
y = npc->moveToPos.y;
|
||||
z = npc->moveToPos.z;
|
||||
dist = 100.0f;
|
||||
collider = npc_raycast_down_around(npc->collisionChannel, &x, &y, &z, &dist,
|
||||
npc->yaw, npc->collisionRadius);
|
||||
npc->currentAnim = 0x70003;
|
||||
npc->duration = 12;
|
||||
npc->moveToPos.y = y - (npc->collisionHeight * 0.5f);
|
||||
suggest_player_anim_clearUnkFlag(ANIM_Mario_10002);
|
||||
script->functionTemp[0]++;
|
||||
break;
|
||||
}
|
||||
}
|
||||
return ApiStatus_DONE1;
|
||||
case 21:
|
||||
npc->pos.x += ((npc->moveToPos.x - npc->pos.x) / npc->duration);
|
||||
npc->pos.y += ((npc->moveToPos.y - npc->pos.y) / npc->duration);
|
||||
npc->pos.z += ((npc->moveToPos.z - npc->pos.z) / npc->duration);
|
||||
npc->duration--;
|
||||
if (npc->duration != 0) {
|
||||
if (npc->duration == 2) {
|
||||
sfx_play_sound_at_npc(SOUND_JUMP_2081, 0, NPC_PARTNER);
|
||||
suggest_player_anim_clearUnkFlag(ANIM_Mario_BeforeJump);
|
||||
}
|
||||
break;
|
||||
}
|
||||
npc->collisionChannel = COLLISION_CHANNEL_10000;
|
||||
npc->flags |= NPC_FLAG_ENABLE_HIT_SCRIPT;
|
||||
npc->flags &= ~(NPC_FLAG_GRAVITY | NPC_FLAG_40);
|
||||
disable_npc_shadow(npc);
|
||||
func_8003D624(npc, 4, 2, 0, 0, 0, 0);
|
||||
npc->currentAnim = 0x7000A;
|
||||
playerStatus->flags |= PS_FLAGS_MOVEMENT_LOCKED;
|
||||
dist = dist2D(playerStatus->position.x, playerStatus->position.z, npc->moveToPos.x, npc->moveToPos.z);
|
||||
npc->jumpVelocity = 5.0f;
|
||||
npc->jumpScale = 0.6f;
|
||||
y = npc->moveToPos.y - playerStatus->position.y;
|
||||
npc->duration = (2.0f * npc->jumpVelocity) / 0.6f;
|
||||
npc->moveSpeed = dist / npc->duration;
|
||||
npc->jumpVelocity += y / npc->duration;
|
||||
suggest_player_anim_clearUnkFlag(ANIM_Mario_AnimMidairStill);
|
||||
script->functionTemp[0]++;
|
||||
fx_rising_bubble(0, npc->pos.x, npc->moveToPos.y + (npc->collisionHeight * 0.5f), npc->pos.z, 0.0f);
|
||||
return 0;
|
||||
case 23:
|
||||
fx_rising_bubble(0, npc->pos.x, npc->moveToPos.y + (npc->collisionHeight * 0.5f), npc->pos.z, 0.0f);
|
||||
// fallthrough
|
||||
case 22:
|
||||
case 24:
|
||||
script->functionTemp[0]++;
|
||||
// fallthrough
|
||||
case 25:
|
||||
playerStatus->position.y += npc->jumpVelocity;
|
||||
npc->jumpVelocity -= npc->jumpScale;
|
||||
add_vec2D_polar(&playerStatus->position.x, &playerStatus->position.z, npc->moveSpeed, npc->yaw);
|
||||
if (npc->jumpVelocity <= 0.0f) {
|
||||
suggest_player_anim_clearUnkFlag(ANIM_Mario_AnimMidair);
|
||||
}
|
||||
gCameras[CAM_DEFAULT].targetPos.x = playerStatus->position.x;
|
||||
gCameras[CAM_DEFAULT].targetPos.y = playerStatus->position.y;
|
||||
gCameras[CAM_DEFAULT].targetPos.z = playerStatus->position.z;
|
||||
|
||||
if (npc->duration == 0) {
|
||||
set_action_state(ACTION_STATE_RIDE);
|
||||
disable_player_shadow();
|
||||
playerStatus->flags &= ~PS_FLAGS_MOVEMENT_LOCKED;
|
||||
suggest_player_anim_setUnkFlag(ANIM_Mario_8000F);
|
||||
sfx_play_sound_at_npc(SOUND_2013, 0, NPC_PARTNER);
|
||||
playerStatus->position.x = npc->pos.x;
|
||||
playerStatus->position.y = npc->pos.y;
|
||||
playerStatus->position.z = npc->pos.z;
|
||||
playerStatus->targetYaw = npc->yaw;
|
||||
npc->moveSpeed = 3.0f;
|
||||
partnerActionStatus->partnerActionState = PARTNER_ACTION_USE;
|
||||
gGameStatusPtr->keepUsingPartnerOnMapChange = FALSE;
|
||||
partnerActionStatus->actingPartner = PARTNER_SUSHIE;
|
||||
bss_802BFEE4 = 0;
|
||||
bss_802BFEE8 = 0;
|
||||
script->functionTemp[2] = 0;
|
||||
script->functionTemp[0] = 1;
|
||||
} else {
|
||||
npc->duration--;
|
||||
}
|
||||
break;
|
||||
case 1:
|
||||
playerStatus->animFlags |= PA_FLAGS_RIDING_PARTNER;
|
||||
func_802BD414_31E184(npc);
|
||||
if (bss_802BFEE4 == 0) {
|
||||
script->functionTemp[2]++;
|
||||
if (script->functionTemp[2] > 20) {
|
||||
script->functionTemp[2] -= 40;
|
||||
}
|
||||
npc->pos.y = npc->moveToPos.y + (abs(script->functionTemp[2]) * 0.125f);
|
||||
if (script->functionTemp[2] == 5) {
|
||||
func_802BD20C_31DF7C(&angle, &sp34);
|
||||
if (bss_802BFEE4 == 0) {
|
||||
if (sp34 != 0.0f) {
|
||||
sfx_play_sound_at_npc(SOUND_2015, 0, NPC_PARTNER);
|
||||
} else {
|
||||
sfx_play_sound_at_npc(SOUND_2014, 0, NPC_PARTNER);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (bss_802BFEF8 == 0.0f && !((gGameStatusPtr->frameCounter % 10) & 0xFFFF)) {
|
||||
fx_rising_bubble(0, npc->pos.x, npc->moveToPos.y + (npc->collisionHeight * 0.5f), npc->pos.z, 0.0f);
|
||||
}
|
||||
} else {
|
||||
npc->pos.y = npc->moveToPos.y;
|
||||
}
|
||||
if (!(playerStatus->animFlags & PA_FLAGS_RIDING_PARTNER)) {
|
||||
func_802BD100_31DE70();
|
||||
}
|
||||
|
||||
if (bss_802BFEE4 == 1) {
|
||||
if (!(gGameStatusPtr->frameCounter % 19)) {
|
||||
yTemp = npc->moveToPos.y + (npc->collisionHeight * 0.5f);
|
||||
fx_rising_bubble(0,npc->pos.x, yTemp, npc->pos.z, OriginalPlayerY - npc->pos.y);
|
||||
}
|
||||
} else if (bss_802BFEF8 != 0.0f && bss_802BFEE4 < 2) {
|
||||
if (!(gGameStatusPtr->frameCounter % 7)) {
|
||||
yTemp = npc->moveToPos.y + (npc->collisionHeight * 0.5f);
|
||||
|
||||
fx_rising_bubble(0, npc->pos.x, yTemp, npc->pos.z, bss_802BFEE4 != 0 ? OriginalPlayerY - npc->pos.y : 0.0f);
|
||||
}
|
||||
}
|
||||
|
||||
gCameras[CAM_DEFAULT].targetPos.x = npc->pos.x;
|
||||
gCameras[CAM_DEFAULT].targetPos.y = OriginalPlayerY;
|
||||
gCameras[CAM_DEFAULT].targetPos.z = npc->pos.z;
|
||||
if ((partnerActionStatus->pressedButtons & (BUTTON_B | BUTTON_C_DOWN)) || bss_802BFEF0 >= 30) {
|
||||
if (bss_802BFEF4 == 0) {
|
||||
x = npc->pos.x;
|
||||
y = npc->moveToPos.y + npc->collisionHeight;
|
||||
z = npc->pos.z;
|
||||
|
||||
t = npc_test_move_taller_with_slipping(npc->collisionChannel, &x, &y, &z, 10.0f, npc->yaw,
|
||||
npc->collisionHeight, npc->collisionRadius);
|
||||
if (t != 0) {
|
||||
collisionStatus->pushingAgainstWall = npc->currentWall = D_8010C97A;
|
||||
} else {
|
||||
collisionStatus->pushingAgainstWall = -1;
|
||||
}
|
||||
|
||||
if (npc->currentWall < 0 ||
|
||||
(npc->currentWall & 0x4000) ||
|
||||
(collider = get_collider_flags(npc->currentWall) & 0xFF, (collider != SURFACE_TYPE_DOCK_WALL)))
|
||||
{
|
||||
if (bss_802BFEE4 == 2 && bss_802BFEE8 == 1) {
|
||||
sfx_play_sound_at_npc(SOUND_294, 0, NPC_PARTNER);
|
||||
}
|
||||
break;
|
||||
}
|
||||
bss_802BFEF0 = 0;
|
||||
x = npc->pos.x;
|
||||
z = npc->pos.z;
|
||||
y = npc->moveToPos.y + 100.0f;
|
||||
add_vec2D_polar(&x, &z, 40.0f, npc->yaw);
|
||||
dist = 100.0f;
|
||||
collider = npc_raycast_down_around(npc->collisionChannel, &x, &y, &z, &dist, npc->yaw, 0.0f);
|
||||
if (collider != 0) {
|
||||
get_collider_center(npc->currentWall, &x, &y, &z);
|
||||
dist = dist2D(npc->pos.x, npc->pos.z, x, z);
|
||||
sin_cos_rad(DEG_TO_RAD(atan2(npc->pos.x, npc->pos.z, x, z)), &sinTheta, &cosTheta);
|
||||
xTemp = npc->pos.x + ((sinTheta * dist) * 0.6);
|
||||
zTemp = npc->pos.z - ((cosTheta * dist) * 0.6);
|
||||
dist = 100.0f;
|
||||
x = xTemp;
|
||||
z = zTemp;
|
||||
npc_raycast_down_around(npc->collisionChannel, &x, &y, &z, &dist, npc->yaw, 0.0f);
|
||||
npc->moveToPos.y = y;
|
||||
npc->moveToPos.x = x;
|
||||
npc->moveToPos.z = z;
|
||||
playerStatus->targetYaw = atan2(playerStatus->position.x, playerStatus->position.z, x, z);
|
||||
npc->yaw = playerStatus->targetYaw;
|
||||
dist = dist2D(playerStatus->position.x, playerStatus->position.z, npc->moveToPos.x, npc->moveToPos.z);
|
||||
npc->jumpVelocity = 5.0f;
|
||||
npc->jumpScale = 0.6f;
|
||||
npc->duration = (2.0f * npc->jumpVelocity) / 0.6f;
|
||||
npc->moveSpeed = dist / npc->duration;
|
||||
npc->jumpVelocity += (npc->moveToPos.y - playerStatus->position.y) / npc->duration;
|
||||
sfx_play_sound_at_npc(SOUND_JUMP_2081, 0, NPC_PARTNER);
|
||||
suggest_player_anim_clearUnkFlag(ANIM_Mario_BeforeJump);
|
||||
enable_player_shadow();
|
||||
playerStatus->flags |= PS_FLAGS_MOVEMENT_LOCKED;
|
||||
script->functionTemp[0] = 3;
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 3:
|
||||
suggest_player_anim_clearUnkFlag(ANIM_Mario_AnimMidairStill);
|
||||
script->functionTemp[0]++;
|
||||
// fallthrough
|
||||
case 4:
|
||||
if (npc->jumpVelocity <= 0.0f) {
|
||||
suggest_player_anim_clearUnkFlag(ANIM_Mario_AnimMidair);
|
||||
script->functionTemp[0]++;
|
||||
}
|
||||
// fallthrough
|
||||
case 5:
|
||||
if (npc->jumpVelocity <= 0.0f) {
|
||||
playerStatus->position.y = y = player_check_collision_below(npc->jumpVelocity, &collider);
|
||||
if (collider > 0) {
|
||||
suggest_player_anim_clearUnkFlag(ANIM_Mario_10009);
|
||||
}
|
||||
} else {
|
||||
playerStatus->position.y += npc->jumpVelocity;
|
||||
}
|
||||
npc->jumpVelocity -= npc->jumpScale;
|
||||
gCameras[CAM_DEFAULT].targetPos.x = playerStatus->position.x;
|
||||
gCameras[CAM_DEFAULT].targetPos.y = playerStatus->position.y;
|
||||
gCameras[CAM_DEFAULT].targetPos.z = playerStatus->position.z;
|
||||
if (npc->duration != 0) {
|
||||
add_vec2D_polar(&playerStatus->position.x, &playerStatus->position.z, npc->moveSpeed, npc->yaw);
|
||||
npc->duration--;
|
||||
break;
|
||||
}
|
||||
if (collider >= 0) {
|
||||
playerStatus->flags &= ~PS_FLAGS_MOVEMENT_LOCKED;
|
||||
suggest_player_anim_clearUnkFlag(ANIM_Mario_10002);
|
||||
npc->flags |= NPC_FLAG_40;
|
||||
dist = dist2D(npc->pos.x, npc->pos.z, npc->moveToPos.x, npc->moveToPos.z) +
|
||||
(playerStatus->colliderDiameter * 0.5f);
|
||||
npc->jumpVelocity = 8.0f;
|
||||
npc->jumpScale = 1.0f;
|
||||
npc->moveSpeed = 4.0f;
|
||||
y = npc->moveToPos.y - npc->pos.y;
|
||||
npc->duration = (2.0f * npc->jumpVelocity) / npc->jumpScale;
|
||||
npc->moveSpeed = dist / npc->duration;
|
||||
npc->jumpVelocity += y / npc->duration;
|
||||
script->functionTemp[0] = 10;
|
||||
}
|
||||
break;
|
||||
case 10:
|
||||
npc->pos.y += npc->jumpVelocity;
|
||||
npc->jumpVelocity = npc->jumpVelocity - npc->jumpScale;
|
||||
add_vec2D_polar(&npc->pos.x, &npc->pos.z, npc->moveSpeed, npc->yaw);
|
||||
if (npc->duration == 0) {
|
||||
enable_player_static_collisions();
|
||||
enable_player_input();
|
||||
set_action_state(ACTION_STATE_IDLE);
|
||||
enable_npc_shadow(npc);
|
||||
partner_clear_player_tracking(npc);
|
||||
bss_802BFEEC = 0;
|
||||
npc->flags &= ~NPC_FLAG_ENABLE_HIT_SCRIPT;
|
||||
npc->flags |= NPC_FLAG_GRAVITY;
|
||||
npc->flags &= ~NPC_FLAG_40;
|
||||
gGameStatusPtr->keepUsingPartnerOnMapChange = FALSE;
|
||||
partnerActionStatus->partnerActionState = PARTNER_ACTION_NONE;
|
||||
partnerActionStatus->actingPartner = 0;
|
||||
func_802DDFF8(0x10002, 0, 0, 0, 0, 0, 0);
|
||||
func_8003D624(npc, 0, 0, 0, 0, 0, 0);
|
||||
return ApiStatus_DONE1;
|
||||
}
|
||||
npc->duration--;
|
||||
break;
|
||||
}
|
||||
return ApiStatus_BLOCK;
|
||||
}
|
||||
|
||||
EvtScript world_sushie_use_ability = {
|
||||
EVT_CALL(func_802BE3A4_31F114)
|
||||
@ -121,7 +688,7 @@ void world_sushie_init(Npc* sushie) {
|
||||
sushie->collisionHeight = 24;
|
||||
sushie->collisionRadius = 36;
|
||||
sushie->collisionChannel = COLLISION_CHANNEL_10000;
|
||||
D_802BFEEC = 0;
|
||||
bss_802BFEEC = 0;
|
||||
bss_802BFEE4 = 0;
|
||||
bss_802BFEE8 = 0;
|
||||
bss_802BFEF0 = 0;
|
||||
@ -262,7 +829,7 @@ EvtScript world_sushie_put_away = {
|
||||
void world_sushie_pre_battle(Npc* sushie) {
|
||||
PartnerActionStatus* sushieActionStatus = &gPartnerActionStatus;
|
||||
|
||||
if (D_802BFEEC) {
|
||||
if (bss_802BFEEC) {
|
||||
sushieActionStatus->npc = *sushie;
|
||||
sushieActionStatus->partnerAction_unk_1 = TRUE;
|
||||
enable_player_static_collisions();
|
||||
@ -294,7 +861,7 @@ s32 func_802BFAB8_320828(Evt* script, s32 isInitialCall) {
|
||||
|
||||
switch (script->functionTemp[0]) {
|
||||
case 0:
|
||||
gGameStatusPtr->keepUsingPartnerOnMapChange = 1;
|
||||
gGameStatusPtr->keepUsingPartnerOnMapChange = TRUE;
|
||||
disable_player_static_collisions();
|
||||
disable_player_input();
|
||||
partnerNPC->pos.x = playerStatus->position.x;
|
||||
|
@ -240,7 +240,7 @@ class Configure:
|
||||
|
||||
modes = ["ld"]
|
||||
if assets:
|
||||
modes.extend(["bin", "Yay0", "img", "vtx", "gfx", "pm_map_data", "pm_msg", "pm_npc_sprites", "pm_charset",
|
||||
modes.extend(["bin", "yay0", "img", "vtx", "gfx", "pm_map_data", "pm_msg", "pm_npc_sprites", "pm_charset",
|
||||
"pm_charset_palettes", "pm_effect_loads", "pm_effect_shims", "pm_sprite_shading_profiles"])
|
||||
if code:
|
||||
modes.extend(["code", "c", "data", "rodata"])
|
||||
@ -309,7 +309,7 @@ class Configure:
|
||||
def write_ninja(self, ninja: ninja_syntax.Writer, skip_outputs: Set[str], non_matching: bool, debug: bool):
|
||||
import segtypes
|
||||
import segtypes.common.data
|
||||
import segtypes.n64.Yay0
|
||||
import segtypes.n64.yay0
|
||||
|
||||
assert self.linker_entries is not None
|
||||
|
||||
@ -454,7 +454,7 @@ class Configure:
|
||||
build(inc_dir / (seg.name + ".pal.inc.c"), [bin_path], "pal_inc_c", vars)
|
||||
elif isinstance(seg, segtypes.common.bin.CommonSegBin):
|
||||
build(entry.object_path, entry.src_paths, "bin")
|
||||
elif isinstance(seg, segtypes.n64.Yay0.N64SegYay0):
|
||||
elif isinstance(seg, segtypes.n64.yay0.N64SegYay0):
|
||||
compressed_path = entry.object_path.with_suffix("") # remove .o
|
||||
build(compressed_path, entry.src_paths, "yay0")
|
||||
build(entry.object_path, [compressed_path], "bin")
|
||||
|
@ -6,7 +6,7 @@
|
||||
[subrepo]
|
||||
remote = https://github.com/ethteck/splat.git
|
||||
branch = master
|
||||
commit = ebadd64f07f744382786a5000b1667d4a21c48e6
|
||||
parent = 25780dbbc1b130021483bde6228d196f9998ab30
|
||||
commit = 715ee0ad551da41cffdf01430c3a0f817638e70a
|
||||
parent = 05e1ef8cb3c53d63683e33059c7f522619e6a69e
|
||||
method = merge
|
||||
cmdver = 0.4.5
|
||||
|
@ -1,6 +1,31 @@
|
||||
# splat Release Notes
|
||||
|
||||
### 0.12.7
|
||||
|
||||
* Allow setting a different macro for jumptable labels with `asm_jtbl_label_macro`
|
||||
* The currently recommended one is `jlabel` instead of `glabel`
|
||||
* Two new options for symbols: `force_migration` and `force_not_migration`
|
||||
* Useful for weird cases where the disassembler decided a rodata symbol must (or must not) be migrated when it really shouldn't (or should)
|
||||
* Fix `str_encoding` defaulting to `False` instead of `None`
|
||||
* Output empty rules in generated dependency files to avoid issues when the function file does not exist anymore (i.e. when it gets matched)
|
||||
* Allow changing the `include_macro_inc` option in the yaml
|
||||
|
||||
### 0.12.6
|
||||
|
||||
* Adds two new N64-specific segments:
|
||||
* IPL3: Allows setting its correct VRAM address without messing the global segment detection
|
||||
* RSP: Allows disassembling using the RSP instruction set instead of the default one
|
||||
* PS2 was added as a new platform option.
|
||||
* When this is selected the R5900 instruction set will be used when disassembling instead of the default one.
|
||||
|
||||
### 0.12.5
|
||||
|
||||
* Update minimal spimdisasm version to 1.7.1.
|
||||
* Fix spimdisasm>=1.7.0 non being able to see symbols which only are referenced by other data symbols.
|
||||
* An check was added to prevent segments marked with `exclusive_ram_id` have a vram address range which overlaps with segments not marked with said tag. If this happens it will be warned to the user.
|
||||
|
||||
### 0.12.4
|
||||
|
||||
* Fixed a bug involving the order of attributes in symbol_addrs preventing proper range searching during calls to `get_symbol`
|
||||
|
||||
### 0.12.3: Initial Gamecube Support
|
||||
|
@ -1,13 +1,13 @@
|
||||
#! /usr/bin/env python3
|
||||
|
||||
import sys
|
||||
import argparse
|
||||
import sys
|
||||
from pathlib import Path
|
||||
|
||||
from util.n64 import rominfo, find_code_length
|
||||
from segtypes.gc.rarc import GcSegRarc
|
||||
from util.gc import gcinfo
|
||||
|
||||
from segtypes.gc.rarc import GcSegRarc
|
||||
from util.n64 import find_code_length, rominfo
|
||||
|
||||
parser = argparse.ArgumentParser(
|
||||
description="Create a splat config from an N64 ROM or a GameCube disc image."
|
||||
|
@ -1,3 +1,4 @@
|
||||
[mypy]
|
||||
ignore_missing_imports = True
|
||||
check_untyped_defs = True
|
||||
mypy_path = stubs
|
||||
|
@ -3,7 +3,8 @@ pylibyaml
|
||||
tqdm
|
||||
intervaltree
|
||||
colorama
|
||||
spimdisasm>=1.5.6
|
||||
rabbitizer>=1.2.0
|
||||
# This value should be keep in sync with the version listed on split.py
|
||||
spimdisasm>=1.7.11
|
||||
rabbitizer>=1.3.1
|
||||
pygfxd
|
||||
n64img>=0.1.2
|
||||
|
@ -1,9 +1,10 @@
|
||||
from segtypes.common.codesubsegment import CommonSegCodeSubsegment
|
||||
from typing import Optional
|
||||
from pathlib import Path
|
||||
from typing import Optional
|
||||
|
||||
from util import options
|
||||
|
||||
from segtypes.common.codesubsegment import CommonSegCodeSubsegment
|
||||
|
||||
|
||||
class CommonSegAsm(CommonSegCodeSubsegment):
|
||||
def out_path(self) -> Optional[Path]:
|
||||
|
@ -1,8 +1,9 @@
|
||||
from pathlib import Path
|
||||
from typing import Optional
|
||||
|
||||
from util import log, options
|
||||
|
||||
from segtypes.common.segment import CommonSegment
|
||||
from util import options
|
||||
from util import log
|
||||
|
||||
|
||||
class CommonSegBin(CommonSegment):
|
||||
@ -11,6 +12,7 @@ class CommonSegBin(CommonSegment):
|
||||
|
||||
def split(self, rom_bytes):
|
||||
path = self.out_path()
|
||||
assert path is not None
|
||||
path.parent.mkdir(parents=True, exist_ok=True)
|
||||
|
||||
if self.rom_end == "auto":
|
||||
@ -19,5 +21,8 @@ class CommonSegBin(CommonSegment):
|
||||
)
|
||||
|
||||
with open(path, "wb") as f:
|
||||
assert isinstance(self.rom_start, int)
|
||||
assert isinstance(self.rom_end, int)
|
||||
|
||||
f.write(rom_bytes[self.rom_start : self.rom_end])
|
||||
self.log(f"Wrote {self.name} to {path}")
|
||||
|
@ -1,7 +1,7 @@
|
||||
import spimdisasm
|
||||
from util import symbols
|
||||
|
||||
from segtypes.common.data import CommonSegData
|
||||
from util import symbols
|
||||
|
||||
|
||||
class CommonSegBss(CommonSegData):
|
||||
|
@ -1,17 +1,18 @@
|
||||
from segtypes.common.codesubsegment import CommonSegCodeSubsegment
|
||||
from segtypes.common.group import CommonSegGroup
|
||||
from segtypes.common.rodata import CommonSegRodata
|
||||
from typing import Optional, Set
|
||||
import os
|
||||
import re
|
||||
from pathlib import Path
|
||||
from typing import Optional, Set
|
||||
|
||||
import spimdisasm
|
||||
|
||||
from util import log, options
|
||||
from util import symbols
|
||||
from util import log, options, symbols
|
||||
from util.compiler import GCC, SN64
|
||||
from util.symbols import Symbol
|
||||
|
||||
from segtypes.common.codesubsegment import CommonSegCodeSubsegment
|
||||
from segtypes.common.group import CommonSegGroup
|
||||
from segtypes.common.rodata import CommonSegRodata
|
||||
|
||||
|
||||
class CommonSegC(CommonSegCodeSubsegment):
|
||||
defined_funcs: Set[str] = set()
|
||||
@ -283,13 +284,19 @@ class CommonSegC(CommonSegCodeSubsegment):
|
||||
build_path = options.opts.build_path
|
||||
|
||||
dep_path = build_path / c_path.with_suffix(".asmproc.d")
|
||||
dep_path.parent.mkdir(parents=True, exist_ok=True)
|
||||
with dep_path.open("w") as f:
|
||||
o_path = build_path / c_path.with_suffix(".o")
|
||||
f.write(f"{o_path}:")
|
||||
depend_list = []
|
||||
for func in self.spim_section.symbolList:
|
||||
func_name = func.getName()
|
||||
|
||||
if func_name in self.global_asm_funcs or is_new_c_file:
|
||||
outpath = asm_out_dir / self.name / (func_name + ".s")
|
||||
depend_list.append(outpath)
|
||||
f.write(f" \\\n {outpath}")
|
||||
f.write("\n")
|
||||
|
||||
for depend_file in depend_list:
|
||||
f.write(f"{depend_file}:\n")
|
||||
|
@ -1,12 +1,14 @@
|
||||
import typing
|
||||
from collections import OrderedDict
|
||||
from typing import Dict, List, Optional, Tuple
|
||||
import typing
|
||||
from segtypes.common.group import CommonSegGroup
|
||||
from segtypes.segment import RomAddr, Segment
|
||||
|
||||
from util import log, options
|
||||
from util.range import Range
|
||||
from util.symbols import Symbol
|
||||
|
||||
from segtypes.common.group import CommonSegGroup
|
||||
from segtypes.segment import RomAddr, Segment
|
||||
|
||||
CODE_TYPES = ["c", "asm", "hasm"]
|
||||
|
||||
|
||||
@ -109,6 +111,8 @@ class CommonSegCode(CommonSegGroup):
|
||||
rep.given_symbol_name_format_no_rom = self.symbol_name_format_no_rom
|
||||
rep.sibling = base[1]
|
||||
rep.parent = self
|
||||
if rep.special_vram_segment:
|
||||
self.special_vram_segment = True
|
||||
alls.append(rep)
|
||||
|
||||
# Insert alls into segs at i
|
||||
@ -265,6 +269,8 @@ class CommonSegCode(CommonSegGroup):
|
||||
)
|
||||
segment.sibling = base_segments.get(segment.name, None)
|
||||
segment.parent = self
|
||||
if segment.special_vram_segment:
|
||||
self.special_vram_segment = True
|
||||
|
||||
for i, section in enumerate(self.section_order):
|
||||
if not self.section_boundaries[section].has_start() and dotless_type(
|
||||
|
@ -1,11 +1,14 @@
|
||||
from typing import Optional
|
||||
from util import options
|
||||
from segtypes.common.code import CommonSegCode
|
||||
|
||||
import spimdisasm
|
||||
import rabbitizer
|
||||
|
||||
from util import options, symbols
|
||||
|
||||
from segtypes import segment
|
||||
from segtypes.common.code import CommonSegCode
|
||||
|
||||
from segtypes.segment import Segment
|
||||
from segtypes import segment
|
||||
from util import symbols
|
||||
|
||||
# abstract class for c, asm, data, etc
|
||||
class CommonSegCodeSubsegment(Segment):
|
||||
@ -22,12 +25,13 @@ class CommonSegCodeSubsegment(Segment):
|
||||
)
|
||||
|
||||
self.str_encoding: Optional[str] = (
|
||||
self.yaml.get("str_encoding", False)
|
||||
if isinstance(self.yaml, dict)
|
||||
else None
|
||||
self.yaml.get("str_encoding", None) if isinstance(self.yaml, dict) else None
|
||||
)
|
||||
|
||||
self.spim_section: Optional[spimdisasm.mips.sections.SectionBase] = None
|
||||
self.instr_category = rabbitizer.InstrCategory.CPU
|
||||
if options.opts.platform == "ps2":
|
||||
self.instr_category = rabbitizer.InstrCategory.R5900
|
||||
|
||||
@property
|
||||
def needs_symbols(self) -> bool:
|
||||
@ -55,6 +59,7 @@ class CommonSegCodeSubsegment(Segment):
|
||||
)
|
||||
|
||||
self.spim_section.isHandwritten = is_hasm
|
||||
self.spim_section.instrCat = self.instr_category
|
||||
|
||||
self.spim_section.analyze()
|
||||
self.spim_section.setCommentOffset(self.rom_start)
|
||||
|
@ -1,10 +1,11 @@
|
||||
from pathlib import Path
|
||||
from typing import Optional
|
||||
|
||||
import spimdisasm
|
||||
from util import options, symbols
|
||||
|
||||
from segtypes.common.codesubsegment import CommonSegCodeSubsegment
|
||||
from segtypes.common.group import CommonSegGroup
|
||||
from pathlib import Path
|
||||
from typing import Optional
|
||||
from util import options, symbols
|
||||
|
||||
|
||||
class CommonSegData(CommonSegCodeSubsegment, CommonSegGroup):
|
||||
|
@ -1,11 +1,19 @@
|
||||
from typing import Optional, Any
|
||||
|
||||
from util import log, options
|
||||
from util.n64.decompressor import Decompressor
|
||||
|
||||
from segtypes.n64.segment import N64Segment
|
||||
from util.n64 import Yay0decompress
|
||||
from util import options
|
||||
from util import log
|
||||
|
||||
|
||||
class N64SegYay0(N64Segment):
|
||||
class CommonSegDecompressor(N64Segment):
|
||||
decompressor: Decompressor
|
||||
compression_type = "" # "Mio0" -> filename.Mio0.o
|
||||
|
||||
def split(self, rom_bytes):
|
||||
if self.decompressor is None:
|
||||
log.error("Decompressor is not a standalone segment type")
|
||||
|
||||
out_dir = options.opts.asset_path / self.dir
|
||||
out_dir.mkdir(parents=True, exist_ok=True)
|
||||
|
||||
@ -16,9 +24,12 @@ class N64SegYay0(N64Segment):
|
||||
|
||||
out_path = out_dir / f"{self.name}.bin"
|
||||
with open(out_path, "wb") as f:
|
||||
self.log(f"Decompressing {self.name}...")
|
||||
assert isinstance(self.rom_start, int)
|
||||
assert isinstance(self.rom_end, int)
|
||||
|
||||
self.log(f"Decompressing {self.name}")
|
||||
compressed_bytes = rom_bytes[self.rom_start : self.rom_end]
|
||||
decompressed_bytes = Yay0decompress.decompress_yay0(compressed_bytes)
|
||||
decompressed_bytes = self.decompressor.decompress(compressed_bytes)
|
||||
f.write(decompressed_bytes)
|
||||
self.log(f"Wrote {self.name} to {out_path}")
|
||||
|
||||
@ -29,7 +40,9 @@ class N64SegYay0(N64Segment):
|
||||
LinkerEntry(
|
||||
self,
|
||||
[options.opts.asset_path / self.dir / f"{self.name}.bin"],
|
||||
options.opts.asset_path / self.dir / f"{self.name}.Yay0",
|
||||
options.opts.asset_path
|
||||
/ self.dir
|
||||
/ f"{self.name}.{self.compression_type}",
|
||||
self.get_linker_section(),
|
||||
)
|
||||
]
|
@ -1,7 +1,9 @@
|
||||
from typing import List, Optional
|
||||
|
||||
from util import log
|
||||
|
||||
from segtypes.common.segment import CommonSegment
|
||||
from segtypes.segment import RomAddr, Segment
|
||||
from util import log
|
||||
|
||||
|
||||
class CommonSegGroup(CommonSegment):
|
||||
@ -72,6 +74,8 @@ class CommonSegGroup(CommonSegment):
|
||||
segment_class, subsection_yaml, start, end, vram
|
||||
)
|
||||
segment.parent = self
|
||||
if segment.special_vram_segment:
|
||||
self.special_vram_segment = True
|
||||
|
||||
ret.append(segment)
|
||||
prev_start = start
|
||||
|
@ -1,7 +1,9 @@
|
||||
from segtypes.common.segment import CommonSegment
|
||||
from pathlib import Path
|
||||
|
||||
from util import options
|
||||
|
||||
from segtypes.common.segment import CommonSegment
|
||||
|
||||
|
||||
class CommonSegHeader(CommonSegment):
|
||||
def should_split(self):
|
||||
|
@ -1,8 +1,9 @@
|
||||
from pathlib import Path
|
||||
from segtypes.n64.segment import N64Segment
|
||||
from segtypes.linker_entry import LinkerEntry
|
||||
|
||||
from util import options, log
|
||||
from util import log, options
|
||||
|
||||
from segtypes.linker_entry import LinkerEntry
|
||||
from segtypes.n64.segment import N64Segment
|
||||
|
||||
|
||||
class CommonSegLib(N64Segment):
|
||||
|
@ -1,7 +1,7 @@
|
||||
import spimdisasm
|
||||
from util import compiler, options, symbols
|
||||
|
||||
from segtypes.common.data import CommonSegData
|
||||
from util import symbols, options, compiler
|
||||
|
||||
|
||||
class CommonSegRodata(CommonSegData):
|
||||
@ -48,19 +48,17 @@ class CommonSegRodata(CommonSegData):
|
||||
super().split(rom_bytes)
|
||||
|
||||
if options.opts.migrate_rodata_to_functions:
|
||||
if self.spim_section and (
|
||||
not self.type.startswith(".") or self.partial_migration
|
||||
):
|
||||
path_folder = options.opts.data_path / self.dir
|
||||
path_folder.parent.mkdir(parents=True, exist_ok=True)
|
||||
if self.spim_section is not None and self.partial_migration:
|
||||
path_folder = options.opts.nonmatchings_path / self.dir / self.name
|
||||
path_folder.mkdir(parents=True, exist_ok=True)
|
||||
|
||||
for rodataSym in self.spim_section.symbolList:
|
||||
if not rodataSym.isRdata():
|
||||
if rodataSym.shouldMigrate():
|
||||
continue
|
||||
|
||||
path = path_folder / f"{rodataSym.getName()}.s"
|
||||
with open(path, "w", newline="\n") as f:
|
||||
if options.opts.compiler.include_macro_inc:
|
||||
if options.opts.include_macro_inc:
|
||||
f.write('.include "macro.inc"\n\n')
|
||||
preamble = options.opts.generated_s_preamble
|
||||
if preamble:
|
||||
|
6
tools/splat/segtypes/common/sbss.py
Normal file
6
tools/splat/segtypes/common/sbss.py
Normal file
@ -0,0 +1,6 @@
|
||||
from segtypes.common.data import CommonSegData
|
||||
|
||||
|
||||
class CommonSegSbss(CommonSegData):
|
||||
def get_linker_section(self) -> str:
|
||||
return ".sbss"
|
6
tools/splat/segtypes/common/sdata.py
Normal file
6
tools/splat/segtypes/common/sdata.py
Normal file
@ -0,0 +1,6 @@
|
||||
from segtypes.common.data import CommonSegData
|
||||
|
||||
|
||||
class CommonSegSdata(CommonSegData):
|
||||
def get_linker_section(self) -> str:
|
||||
return ".sdata"
|
@ -1,7 +1,7 @@
|
||||
import struct
|
||||
from pathlib import Path
|
||||
|
||||
from segtypes.gc.segment import GCSegment
|
||||
from pathlib import Path
|
||||
|
||||
|
||||
class GcSegApploader(GCSegment):
|
||||
|
@ -1,8 +1,9 @@
|
||||
import struct
|
||||
from pathlib import Path
|
||||
|
||||
from util import options
|
||||
|
||||
from segtypes.gc.segment import GCSegment
|
||||
from pathlib import Path
|
||||
from util import options
|
||||
|
||||
|
||||
class GcSegBi2(GCSegment):
|
||||
|
@ -1,8 +1,9 @@
|
||||
import struct
|
||||
from pathlib import Path
|
||||
|
||||
from util import options
|
||||
|
||||
from segtypes.gc.segment import GCSegment
|
||||
from pathlib import Path
|
||||
from util import options
|
||||
|
||||
|
||||
class GcSegBootinfo(GCSegment):
|
||||
|
@ -1,7 +1,7 @@
|
||||
import struct
|
||||
from pathlib import Path
|
||||
|
||||
from segtypes.gc.segment import GCSegment
|
||||
from pathlib import Path
|
||||
|
||||
|
||||
class GcSegDol(GCSegment):
|
||||
|
@ -1,6 +1,7 @@
|
||||
from segtypes.common.header import CommonSegHeader
|
||||
from util import options
|
||||
|
||||
from segtypes.common.header import CommonSegHeader
|
||||
|
||||
|
||||
class DolSegHeader(CommonSegHeader):
|
||||
def parse_header(self, dol_bytes):
|
||||
|
@ -1,7 +1,7 @@
|
||||
import struct
|
||||
from pathlib import Path
|
||||
|
||||
from segtypes.gc.segment import GCSegment
|
||||
from pathlib import Path
|
||||
|
||||
|
||||
class GcSegFst(GCSegment):
|
||||
|
@ -1,13 +1,14 @@
|
||||
import struct
|
||||
from enum import IntEnum
|
||||
from pathlib import Path
|
||||
|
||||
from typing import List, Optional
|
||||
|
||||
from util import options
|
||||
from util.gc.gcutil import read_string_from_bytes
|
||||
from util.n64.Yay0decompress import Yay0Decompressor
|
||||
|
||||
from segtypes.gc.segment import GCSegment
|
||||
from pathlib import Path
|
||||
from util import options
|
||||
from util.n64.Yay0decompress import decompress_yay0
|
||||
from util.gc.gcutil import read_string_from_bytes
|
||||
|
||||
from typing import List
|
||||
from enum import IntEnum
|
||||
|
||||
|
||||
# Represents the RARC archive format used by first-party Nintendo games.
|
||||
@ -16,6 +17,8 @@ class GcSegRarc(GCSegment):
|
||||
super().__init__(*args, **kwargs)
|
||||
|
||||
def split(self, file_bytes):
|
||||
assert self.file_path is not None
|
||||
|
||||
archive = GCRARCArchive(self.file_path, file_bytes)
|
||||
archive.build_hierarchy(file_bytes)
|
||||
|
||||
@ -53,7 +56,7 @@ class GCRARCArchive:
|
||||
# Yay0
|
||||
elif compression_scheme == 0x59617930:
|
||||
self.compression = "yay0"
|
||||
return decompress_yay0(file_bytes)
|
||||
return Yay0Decompressor().decompress(file_bytes)
|
||||
# Not compressed!
|
||||
else:
|
||||
return file_bytes
|
||||
@ -95,6 +98,8 @@ class GCRARCArchive:
|
||||
n.children.append(dir_node)
|
||||
|
||||
def emit(self, file_bytes):
|
||||
assert options.opts.filesystem_path is not None
|
||||
|
||||
rel_path = self.file_path.relative_to(options.opts.filesystem_path / "files")
|
||||
arc_root_path = options.opts.asset_path / rel_path.with_suffix("")
|
||||
|
||||
@ -180,7 +185,7 @@ class GCRARCNode:
|
||||
self.name = read_string_from_bytes(self.name_offset, string_table_bytes)
|
||||
self.entries = []
|
||||
|
||||
self.parent = None
|
||||
self.parent: Optional[GCRARCNode] = None
|
||||
self.children = []
|
||||
|
||||
def get_entries(self, file_entry_offset, file_bytes, string_table_bytes):
|
||||
@ -233,16 +238,13 @@ class GCRARCNode:
|
||||
n.print_recursive(level + 1)
|
||||
|
||||
def get_full_directory_path(self):
|
||||
path_components = []
|
||||
path_components: List[str] = []
|
||||
|
||||
node = self
|
||||
while True:
|
||||
node: Optional[GCRARCNode] = self
|
||||
while node is not None:
|
||||
path_components.insert(0, node.name)
|
||||
node = node.parent
|
||||
|
||||
if node == None:
|
||||
break
|
||||
|
||||
return Path(*path_components)
|
||||
|
||||
|
||||
@ -258,7 +260,7 @@ class GCRARCFileEntry:
|
||||
self.data_size = struct.unpack_from(">I", file_bytes, offset + 0x000C)[0]
|
||||
|
||||
self.name = read_string_from_bytes(self.name_offset, string_table_bytes)
|
||||
self.parent_node = None
|
||||
self.parent_node: Optional[GCRARCNode] = None
|
||||
|
||||
def emit_to_filesystem(self, dir_path: Path, file_data_offset, file_bytes):
|
||||
if self.flags & int(GCRARCFlags.IS_DIR) != 0x00:
|
||||
@ -302,13 +304,10 @@ class GCRARCFileEntry:
|
||||
path_components = [self.name]
|
||||
|
||||
node = self.parent_node
|
||||
while True:
|
||||
while node is not None:
|
||||
path_components.insert(0, node.name)
|
||||
node = node.parent
|
||||
|
||||
if node == None:
|
||||
break
|
||||
|
||||
return Path("/".join(path_components))
|
||||
|
||||
|
||||
|
@ -1,6 +1,7 @@
|
||||
from segtypes.common.header import CommonSegHeader
|
||||
from util import options
|
||||
|
||||
from segtypes.common.header import CommonSegHeader
|
||||
|
||||
|
||||
class RelSegHeader(CommonSegHeader):
|
||||
def __init__(self, *args, **kwargs):
|
||||
|
@ -1,12 +1,14 @@
|
||||
from dataclasses import dataclass
|
||||
from functools import lru_cache
|
||||
from typing import Dict, Optional, OrderedDict, Union, List
|
||||
from pathlib import Path
|
||||
from segtypes.n64.palette import N64SegPalette
|
||||
from util import options
|
||||
from segtypes.segment import Segment
|
||||
import os
|
||||
import re
|
||||
from dataclasses import dataclass
|
||||
from functools import lru_cache
|
||||
from pathlib import Path
|
||||
from typing import Dict, List, Optional, OrderedDict, Union
|
||||
|
||||
from util import options
|
||||
|
||||
from segtypes.n64.palette import N64SegPalette
|
||||
from segtypes.segment import Segment
|
||||
|
||||
# clean 'foo/../bar' to 'bar'
|
||||
@lru_cache(maxsize=None)
|
||||
@ -167,11 +169,7 @@ class LinkerWriter:
|
||||
leaving_bss = False
|
||||
cur_section = entry.section_type
|
||||
|
||||
if cur_section == "linker":
|
||||
self._end_block()
|
||||
self._begin_segment(entry.segment)
|
||||
continue
|
||||
elif cur_section == "linker_offset":
|
||||
if cur_section == "linker_offset":
|
||||
self._write_symbol(f"{get_segment_cname(entry.segment)}_OFFSET", ".")
|
||||
continue
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
from segtypes.common.asm import CommonSegAsm
|
||||
|
||||
from util import options
|
||||
|
||||
from segtypes.common.asm import CommonSegAsm
|
||||
|
||||
|
||||
class N64SegAsm(CommonSegAsm):
|
||||
@staticmethod
|
||||
|
@ -1,7 +1,9 @@
|
||||
from typing import TYPE_CHECKING, Optional
|
||||
from segtypes.n64.img import N64SegImg
|
||||
from typing import Optional, TYPE_CHECKING
|
||||
|
||||
from util import log
|
||||
|
||||
from segtypes.n64.img import N64SegImg
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from segtypes.n64.palette import N64SegPalette
|
||||
|
||||
@ -29,6 +31,7 @@ class N64SegCi(N64SegImg):
|
||||
log.error(
|
||||
f"no palette sibling segment exists\n(hint: add a segment with type 'palette' and name '{self.name}')"
|
||||
)
|
||||
assert self.palette is not None
|
||||
self.palette.extract = False
|
||||
self.n64img.palette = self.palette.parse_palette(rom_bytes)
|
||||
|
||||
|
@ -1,6 +1,7 @@
|
||||
from segtypes.n64.ci import N64SegCi
|
||||
import n64img.image
|
||||
|
||||
from segtypes.n64.ci import N64SegCi
|
||||
|
||||
|
||||
class N64SegCi4(N64SegCi):
|
||||
def __init__(self, *args, **kwargs):
|
||||
|
@ -1,6 +1,7 @@
|
||||
from segtypes.n64.ci import N64SegCi
|
||||
import n64img.image
|
||||
|
||||
from segtypes.n64.ci import N64SegCi
|
||||
|
||||
|
||||
class N64SegCi8(N64SegCi):
|
||||
def __init__(self, *args, **kwargs):
|
||||
|
@ -4,11 +4,39 @@ Dumps out Gfx[] as a .inc.c file.
|
||||
"""
|
||||
|
||||
from pathlib import Path
|
||||
from pygfxd import *
|
||||
from util import log
|
||||
|
||||
from pygfxd import (
|
||||
gfxd_buffer_to_string,
|
||||
gfxd_cimg_callback,
|
||||
gfxd_dl_callback,
|
||||
gfxd_endian,
|
||||
gfxd_execute,
|
||||
gfxd_input_buffer,
|
||||
gfxd_light_callback,
|
||||
gfxd_lookat_callback,
|
||||
gfxd_macro_dflt,
|
||||
gfxd_macro_fn,
|
||||
gfxd_mtx_callback,
|
||||
gfxd_output_buffer,
|
||||
gfxd_printf,
|
||||
gfxd_puts,
|
||||
gfxd_target,
|
||||
gfxd_timg_callback,
|
||||
gfxd_tlut_callback,
|
||||
gfxd_vp_callback,
|
||||
gfxd_vtx_callback,
|
||||
gfxd_zimg_callback,
|
||||
GfxdEndian,
|
||||
gfxd_f3d,
|
||||
gfxd_f3db,
|
||||
gfxd_f3dex,
|
||||
gfxd_f3dexb,
|
||||
gfxd_f3dex2,
|
||||
)
|
||||
|
||||
from util import log, options
|
||||
from util.log import error
|
||||
|
||||
from util import options
|
||||
from segtypes.common.codesubsegment import CommonSegCodeSubsegment
|
||||
|
||||
|
||||
@ -137,6 +165,9 @@ class N64SegGfx(CommonSegCodeSubsegment):
|
||||
return 0
|
||||
|
||||
def disassemble_data(self, rom_bytes):
|
||||
assert isinstance(self.rom_start, int)
|
||||
assert isinstance(self.rom_end, int)
|
||||
|
||||
gfx_data = rom_bytes[self.rom_start : self.rom_end]
|
||||
segment_length = len(gfx_data)
|
||||
if (segment_length) % 8 != 0:
|
||||
|
@ -1,7 +1,7 @@
|
||||
from segtypes.common.hasm import CommonSegHasm
|
||||
|
||||
from util import options
|
||||
|
||||
from segtypes.common.hasm import CommonSegHasm
|
||||
|
||||
|
||||
class N64SegHasm(CommonSegHasm):
|
||||
@staticmethod
|
||||
|
@ -1,6 +1,7 @@
|
||||
from segtypes.common.header import CommonSegHeader
|
||||
from util import options
|
||||
|
||||
from segtypes.common.header import CommonSegHeader
|
||||
|
||||
|
||||
class N64SegHeader(CommonSegHeader):
|
||||
def parse_header(self, rom_bytes):
|
||||
|
@ -1,7 +1,9 @@
|
||||
from segtypes.n64.img import N64SegImg
|
||||
import n64img.image
|
||||
|
||||
from segtypes.n64.img import N64SegImg
|
||||
|
||||
|
||||
class N64SegI4(N64SegImg):
|
||||
def __init__(self, *args, **kwargs):
|
||||
super().__init__(*args, **kwargs, img_cls=n64img.image.I4)
|
||||
kwargs["img_cls"] = n64img.image.I4
|
||||
super().__init__(*args, **kwargs)
|
||||
|
@ -1,7 +1,9 @@
|
||||
from segtypes.n64.img import N64SegImg
|
||||
import n64img.image
|
||||
|
||||
from segtypes.n64.img import N64SegImg
|
||||
|
||||
|
||||
class N64SegI8(N64SegImg):
|
||||
def __init__(self, *args, **kwargs):
|
||||
super().__init__(*args, **kwargs, img_cls=n64img.image.I8)
|
||||
kwargs["img_cls"] = n64img.image.I8
|
||||
super().__init__(*args, **kwargs)
|
||||
|
@ -1,7 +1,9 @@
|
||||
from segtypes.n64.img import N64SegImg
|
||||
import n64img.image
|
||||
|
||||
from segtypes.n64.img import N64SegImg
|
||||
|
||||
|
||||
class N64SegIa16(N64SegImg):
|
||||
def __init__(self, *args, **kwargs):
|
||||
super().__init__(*args, **kwargs, img_cls=n64img.image.IA16)
|
||||
kwargs["img_cls"] = n64img.image.IA16
|
||||
super().__init__(*args, **kwargs)
|
||||
|
@ -1,7 +1,9 @@
|
||||
from segtypes.n64.img import N64SegImg
|
||||
import n64img.image
|
||||
|
||||
from segtypes.n64.img import N64SegImg
|
||||
|
||||
|
||||
class N64SegIa4(N64SegImg):
|
||||
def __init__(self, *args, **kwargs):
|
||||
super().__init__(*args, **kwargs, img_cls=n64img.image.IA4)
|
||||
kwargs["img_cls"] = n64img.image.IA4
|
||||
super().__init__(*args, **kwargs)
|
||||
|
@ -1,7 +1,9 @@
|
||||
from segtypes.n64.img import N64SegImg
|
||||
import n64img.image
|
||||
|
||||
from segtypes.n64.img import N64SegImg
|
||||
|
||||
|
||||
class N64SegIa8(N64SegImg):
|
||||
def __init__(self, *args, **kwargs):
|
||||
super().__init__(*args, **kwargs, img_cls=n64img.image.IA8)
|
||||
kwargs["img_cls"] = n64img.image.IA8
|
||||
super().__init__(*args, **kwargs)
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user