appendGfx_shading_palette (#1010)

* cleanup & warnings for modern gcc

* clean

* stuff

* diff.py update

* Fix offset problem in struct

* Fix texture issue in chapter_change

* appendGfx_shading_palette
This commit is contained in:
Ethan Roseman 2023-04-08 23:04:45 +09:00 committed by GitHub
parent 93ed912319
commit 3e3558a37f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
31 changed files with 993 additions and 1572 deletions

1026
diff.py

File diff suppressed because it is too large Load Diff

View File

@ -8,4 +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/'
config['expected_dir'] = f'{ver_dir}/expected/'

View File

@ -160,7 +160,7 @@ typedef struct HeartBlockContentData {
/* 0x01C */ f32 sparkleTrailRadius;
/* 0x020 */ f32 bouncePhase;
/* 0x024 */ u16 yawBufferPos;
/* 0x024 */ s16 unk_26;
/* 0x026 */ s16 unk_26;
/* 0x028 */ f32 yawBuffer[10];
/* 0x050 */ f32 unk_50;
/* 0x054 */ f32 rotationRate;

View File

@ -12,8 +12,6 @@ f32 fabsf(f32 f);
f64 fabs(f64 f);
f32 cosine(s16 arg0);
s32 strcmp(const char* str1, const char* str2);
void nuBoot(void);
void boot_idle(void* data);
void boot_main(void* data);

View File

@ -37,7 +37,7 @@
#define ARRAY_COUNT(arr) (s32)(sizeof(arr) / sizeof(arr[0]))
#if !defined(PERMUTER)
#if !defined(PERMUTER) && !defined(M2CTX) && defined(OLD_GCC)
#define NOP_FIX __asm__(".set nogpopt");
#define NOP_UNFIX __asm__(".set gpopt");
#else

View File

@ -4,7 +4,7 @@
#include "ld_addrs.h"
#ifdef SHIFT
#define SPRITE_ROM_START _1943000_ROM_START + 0x10
#define SPRITE_ROM_START (u32) _1943000_ROM_START + 0x10
#else
#define SPRITE_ROM_START 0x1943000 + 0x10
#endif

View File

@ -72,19 +72,18 @@ void create_target_list(Actor* actor, s32 arg1) {
s32 i, j;
f32 targetX, targetY, targetZ;
f32 f2, f12, f14;
f32 f61;
u8 overlayType;
f32 overlayZoom;
s32 sp18 = FALSE;
s32 col;
s32 row;
s32 skip;
if (battleStatus->currentTargetListFlags & TARGET_FLAG_80000000) {
actor->targetListLength = -1;
return;
}
if (battleStatus->currentTargetListFlags & TARGET_FLAG_PLAYER) {
targetDataList->actorID = ACTOR_PLAYER;
targetDataList->partID = 1;
@ -98,7 +97,7 @@ void create_target_list(Actor* actor, s32 arg1) {
targetDataList->pos.z = playerActor->homePos.z;
}
targetDataList->unk_10 = -100;
numTargets += 1;
numTargets++;
targetDataList++;
}
@ -115,7 +114,7 @@ void create_target_list(Actor* actor, s32 arg1) {
targetDataList->pos.z = partnerActor->homePos.z;
}
targetDataList->unk_10 = -50;
numTargets += 1;
numTargets++;
targetDataList++;
}

View File

@ -55,10 +55,18 @@ s32 func_E0200044(s32 max, s32 idx) {
#ifdef NON_EQUIVALENT
void func_E02000AC(s32 arg0, s32 arg1) {
s32 i, j;
s32 newvar;
s32 width = 80;
s32 tmp = 0;
s32 x, y;
int new_var;
int new_var2;
gDPSetPrimColor(gMainGfxPos++, 0, 0, 128, 128, 128, 255);
for (i = 0; i < 10; i++) {
x = arg0;
newvar = i * 6;
gDPSetTextureImage(gMainGfxPos++, G_IM_FMT_RGBA, G_IM_SIZ_16b, 80, nuGfxCfb_ptr);
gDPSetTile(gMainGfxPos++, G_IM_FMT_RGBA, G_IM_SIZ_16b,
(((((79)-(0)+1) * G_IM_SIZ_16b_TILE_BYTES)+7)>>3), 0,
@ -77,37 +85,42 @@ void func_E02000AC(s32 arg0, s32 arg1) {
G_TX_RENDERTILE, 0,
G_TX_WRAP, 6, G_TX_NOLOD,
G_TX_WRAP, 7, G_TX_NOLOD);
gDPLoadTile(gMainGfxPos++, G_TX_RENDERTILE,
(arg0)<<G_TEXTURE_IMAGE_FRAC,
(arg1 + i * 6)<<G_TEXTURE_IMAGE_FRAC,
(arg0 + 79)<<G_TEXTURE_IMAGE_FRAC,
(arg1 + i * 6 + 5)<<G_TEXTURE_IMAGE_FRAC);
gDPLoadTile(gMainGfxPos++, G_TX_RENDERTILE + 1,
gDPSetTileSize(gMainGfxPos++, G_TX_RENDERTILE,
(arg0)<<G_TEXTURE_IMAGE_FRAC,
(arg1 + i * 6)<<G_TEXTURE_IMAGE_FRAC,
(arg0 + 79)<<G_TEXTURE_IMAGE_FRAC,
(arg1 + i * 6 + 5)<<G_TEXTURE_IMAGE_FRAC);
gDPSetTileSize(gMainGfxPos++, G_TX_RENDERTILE + 1,
(arg0)<<G_TEXTURE_IMAGE_FRAC,
(arg1 + i * 6)<<G_TEXTURE_IMAGE_FRAC,
(arg0 + 79)<<G_TEXTURE_IMAGE_FRAC,
(arg1 + i * 6 + 5)<<G_TEXTURE_IMAGE_FRAC);
new_var2 = arg0 + width;
for (j = 0; j < 1; j++) {
gDPSetTextureImage(gMainGfxPos++, G_IM_FMT_RGBA, G_IM_SIZ_16b, 320, nuGfxCfb_ptr);
gDPSetTile(gMainGfxPos++, G_IM_FMT_RGBA, G_IM_SIZ_16b,
(((((320)-(0)+1) * G_IM_SIZ_16b_TILE_BYTES)+7)>>3), 0x100,
(((((x+width-1)-(x)+1) * G_IM_SIZ_16b_TILE_BYTES)+7)>>3), 0x100,
G_TX_LOADTILE, 0,
G_TX_WRAP, 6, G_TX_NOLOD,
G_TX_WRAP, 7, G_TX_NOLOD);
gDPLoadSync(gMainGfxPos++);
gDPLoadTile(gMainGfxPos++, G_TX_LOADTILE,
(arg0)<<G_TEXTURE_IMAGE_FRAC,
(arg1 + i * 6)<<G_TEXTURE_IMAGE_FRAC,
(arg0 + 80 - 1)<<G_TEXTURE_IMAGE_FRAC,
(arg1 + i * 6 + 5)<<G_TEXTURE_IMAGE_FRAC);
(x)<<G_TEXTURE_IMAGE_FRAC,
(arg1 + newvar)<<G_TEXTURE_IMAGE_FRAC,
(new_var2 - 1)<<G_TEXTURE_IMAGE_FRAC,
(arg1 + newvar + 5)<<G_TEXTURE_IMAGE_FRAC);
gDPPipeSync(gMainGfxPos++);
gDPSetTile(gMainGfxPos++, G_IM_FMT_RGBA, G_IM_SIZ_16b,
(((((320)-(0)+1) * G_IM_SIZ_16b_TILE_BYTES)+7)>>3), 0,
(((((x+width-1)-(x)+1) * G_IM_SIZ_16b_TILE_BYTES)+7)>>3), 0x100,
G_TX_RENDERTILE + 1, 0,
G_TX_WRAP, 6, G_TX_NOLOD,
G_TX_WRAP, 7, G_TX_NOLOD);
gDPTextureRectangle(gMainGfxPos++, arg0 * 4, (arg1 + i * 6) * 4, (arg0 + 80) * 4, (arg1 + i * 6 + 6) * 4, 0, arg0 * 32, arg1 * 32, 0x400, 0x400);
gSPTextureRectangle(gMainGfxPos++, x * 4, (arg1 + newvar) * 4,
(x + width) * 4, (arg1 + newvar + 6) * 4, 0,
x * 32, (arg1 + i * 6) * 32,
0x400, 0x400);
}
gDPPipeSync(gMainGfxPos++);
}

View File

@ -1,5 +1,6 @@
#include "common.h"
#include "nu/nusys.h"
#include "gcc/string.h"
u16 heap_nextMallocID = 0;

View File

@ -7,6 +7,7 @@
#include "effects.h"
#include "nu/nusys.h"
#include "model_clear_render_tasks.h"
#include "gcc/string.h"
#if VERSION_IQUE
// TODO: remove if sections are split in iQue release
@ -36,10 +37,7 @@ extern Addr WorldEntityHeapBase;
typedef struct Fog {
/* 0x00 */ s32 enabled;
/* 0x04 */ s32 r;
/* 0x08 */ s32 g;
/* 0x0C */ s32 b;
/* 0x10 */ s32 a;
/* 0x04 */ Color4i color;
/* 0x14 */ s32 startDistance;
/* 0x18 */ s32 endDistance;
} Fog; // size = 0x1C
@ -3401,10 +3399,10 @@ void appendGfx_model(void* data) {
break;
}
gSPDisplayList((*gfxPos)++, D_8014AFC0[renderModeIdx]);
gDPSetFogColor((*gfxPos)++, gCurrentFogSettings->r,
gCurrentFogSettings->g,
gCurrentFogSettings->b,
gCurrentFogSettings->a);
gDPSetFogColor((*gfxPos)++, gCurrentFogSettings->color.r,
gCurrentFogSettings->color.g,
gCurrentFogSettings->color.b,
gCurrentFogSettings->color.a);
gSPFogPosition((*gfxPos)++, gCurrentFogSettings->startDistance, gCurrentFogSettings->endDistance);
break;
case 4:
@ -3472,9 +3470,9 @@ void appendGfx_model(void* data) {
gDPSetRenderMode(gMainGfxPos++, GBL_c1(G_BL_CLR_BL, G_BL_A_FOG, G_BL_CLR_IN, G_BL_1MA), G_RM_CLD_SURF2);
break;
}
gDPSetFogColor((*gfxPos)++, gCurrentFogSettings->r,
gCurrentFogSettings->g,
gCurrentFogSettings->b,
gDPSetFogColor((*gfxPos)++, gCurrentFogSettings->color.r,
gCurrentFogSettings->color.g,
gCurrentFogSettings->color.b,
mdl_bgMultiplyColorA);
gDPSetBlendColor((*gfxPos)++, mdl_bgMultiplyColorR,
mdl_bgMultiplyColorG,
@ -3546,14 +3544,14 @@ void appendGfx_model(void* data) {
}
gSPDisplayList((*gfxPos)++, D_8014AFC0[renderModeIdx]);
fogR = (gCurrentFogSettings->r * (255 - mdl_bgMultiplyColorA) + mdl_bgMultiplyColorR * mdl_bgMultiplyColorA) / 255;
fogG = (gCurrentFogSettings->g * (255 - mdl_bgMultiplyColorA) + mdl_bgMultiplyColorG * mdl_bgMultiplyColorA) / 255;
fogB = (gCurrentFogSettings->b * (255 - mdl_bgMultiplyColorA) + mdl_bgMultiplyColorB * mdl_bgMultiplyColorA) / 255;
fogR = (gCurrentFogSettings->color.r * (255 - mdl_bgMultiplyColorA) + mdl_bgMultiplyColorR * mdl_bgMultiplyColorA) / 255;
fogG = (gCurrentFogSettings->color.g * (255 - mdl_bgMultiplyColorA) + mdl_bgMultiplyColorG * mdl_bgMultiplyColorA) / 255;
fogB = (gCurrentFogSettings->color.b * (255 - mdl_bgMultiplyColorA) + mdl_bgMultiplyColorB * mdl_bgMultiplyColorA) / 255;
fogMin = (gCurrentFogSettings->startDistance * (255 - mdl_bgMultiplyColorA) + 900 * mdl_bgMultiplyColorA) / 255;
fogMax = (gCurrentFogSettings->endDistance * (255 - mdl_bgMultiplyColorA) + 1000 * mdl_bgMultiplyColorA) / 255;
gDPSetFogColor(gMainGfxPos++, fogR, fogG, fogB, gCurrentFogSettings->a);
gDPSetFogColor(gMainGfxPos++, fogR, fogG, fogB, gCurrentFogSettings->color.a);
gSPFogPosition((*gfxPos)++, fogMin, fogMax);
break;
case 10:
@ -4043,12 +4041,12 @@ void clear_model_data(void) {
}
*gBackgroundFogModePtr = FOG_MODE_0;
gCurrentFogSettings->r = 10;
gCurrentFogSettings->g = 10;
gCurrentFogSettings->b = 10;
gCurrentFogSettings->color.r = 10;
gCurrentFogSettings->color.g = 10;
gCurrentFogSettings->color.b = 10;
gCurrentFogSettings->startDistance = 950;
gCurrentFogSettings->enabled = FALSE;
gCurrentFogSettings->a = 0;
gCurrentFogSettings->color.a = 0;
gCurrentFogSettings->endDistance = 1000;
for (i = 0; i < ARRAY_COUNT(texPannerAuxV); i++) {
@ -5381,10 +5379,10 @@ void set_world_fog_dist(s32 start, s32 end) {
}
void set_world_fog_color(s32 r, s32 g, s32 b, s32 a) {
gCurrentFogSettings->r = r;
gCurrentFogSettings->g = g;
gCurrentFogSettings->b = b;
gCurrentFogSettings->a = a;
gCurrentFogSettings->color.r = r;
gCurrentFogSettings->color.g = g;
gCurrentFogSettings->color.b = b;
gCurrentFogSettings->color.a = a;
}
s32 is_world_fog_enabled(void) {
@ -5397,10 +5395,10 @@ void get_world_fog_distance(s32* start, s32* end) {
}
void get_world_fog_color(s32* r, s32* g, s32* b, s32* a) {
*r = gCurrentFogSettings->r;
*g = gCurrentFogSettings->g;
*b = gCurrentFogSettings->b;
*a = gCurrentFogSettings->a;
*r = gCurrentFogSettings->color.r;
*g = gCurrentFogSettings->color.g;
*b = gCurrentFogSettings->color.b;
*a = gCurrentFogSettings->color.a;
}
void set_tex_panner(Model* model, s32 texPannerID) {
@ -5682,7 +5680,7 @@ Gfx* mdl_get_copied_gfx(s32 copyIndex) {
Gfx* gfxCopy = mlvc->gfxCopy[selector];
mlvc->selector++;
if (mlvc->selector >= 2) {
if (mlvc->selector > ARRAY_COUNT(mlvc->gfxCopy) - 1) {
mlvc->selector = 0;
}
@ -6277,7 +6275,7 @@ void execute_render_tasks(void) {
}
mdl_renderTaskQueueIdx++;
if (mdl_renderTaskQueueIdx > 2) {
if (mdl_renderTaskQueueIdx > ARRAY_COUNT(mdl_renderTaskLists) - 1) {
mdl_renderTaskQueueIdx = 0;
}
mdl_renderTaskCount = 0;

View File

@ -9,7 +9,7 @@ extern f32 AlTuneScaling[];
#ifdef SHIFT
#define SBN_ROM_OFFSET SBN_ROM_START
#define SBN_ROM_OFFSET (s32) SBN_ROM_START
#elif VERSION_JP
#define SBN_ROM_OFFSET 0xFC0000
#else

View File

@ -1,5 +1,6 @@
#include "common.h"
#include "effects.h"
#include "gcc/string.h"
char* N(RightSunMaps)[] = {
"flo_03",

View File

@ -2,6 +2,7 @@
#include "stdlib/stdarg.h"
#include "PR/os_internal_thread.h"
#include "libc/xstdio.h"
#include "gcc/string.h"
typedef struct {
/* 0x000 */ OSThread thread;

View File

@ -1,5 +1,6 @@
#include "common.h"
#include "model.h"
#include "gcc/string.h"
char gCloudyFlowerFieldsBg[] = "fla_bg";
char gSunnyFlowerFieldsBg[] = "flb_bg";

View File

@ -5,7 +5,6 @@
#include "effects/gfx/D_09002080_3EDEE0.png.inc.c"
#include "effects/gfx/D_09002580_3EE3E0.png.inc.c"
#include "effects/gfx/world/text_end_of.png.inc.c"
#include "effects/gfx/D_090032A0_3EF100.png.inc.c"
#include "effects/gfx/world/exclamation_point.png.inc.c"
#include "effects/gfx/world/ch1.png.inc.c"
#include "effects/gfx/world/ch2.png.inc.c"
@ -30,7 +29,15 @@
#include "effects/gfx/D_0900C1B0_3F8010.gfx.inc.c"
#include "effects/gfx/D_0900C1F8_3F8058.gfx.inc.c"
#include "effects/gfx/D_0900C240_3F80A0.gfx.inc.c"
#include "effects/gfx/D_0900C328_3F8188.gfx.inc.c"
// TODO allow splat to output the reference to halfway into the texture
//#include "effects/gfx/D_0900C328_3F8188.gfx.inc.c"
Gfx D_0900C328_3F8188[] = {
gsDPSetTextureLUT(G_TT_NONE),
gsDPLoadTextureTile(&D_09002A80_3EE8E0[0x820], G_IM_FMT_IA, G_IM_SIZ_8b, 104, 0, 0, 0, 103, 19, 0, G_TX_NOMIRROR | G_TX_CLAMP, G_TX_NOMIRROR | G_TX_CLAMP, 7, 6, G_TX_NOLOD, G_TX_NOLOD),
gsSPEndDisplayList(),
};
#include "effects/gfx/D_0900C370_3F81D0.gfx.inc.c"
#include "effects/gfx/D_0900C458_3F82B8.gfx.inc.c"
#include "effects/gfx/D_0900C540_3F83A0.gfx.inc.c"

View File

@ -1,5 +1,6 @@
#include "fio.h"
#include "PR/os_flash.h"
#include "gcc/string.h"
extern SaveData D_8009A6B0;
extern s32 logicalSaveInfo[4][2];

View File

@ -21,8 +21,6 @@ extern s32 D_80073E10[];
extern u16* D_8009A680;
#ifdef SHIFT
void create_audio_system(void);
void load_engine_data(void);
#define shim_create_audio_system_obfuscated create_audio_system
#define shim_load_engine_data_obfuscated load_engine_data
#endif

View File

@ -446,17 +446,22 @@ void npc_do_other_npc_collision(Npc* npc) {
// float regalloc
#ifdef NON_MATCHING
s32 npc_do_player_collision(Npc* npc) {
f32 sp10;
PlayerStatus* playerStatus = &gPlayerStatus;
f32 xDiff, zDiff;
f32 xDiff2, zDiff2;
f32 npcColliderX, npcColliderZ;
f32 playerX, playerZ;
f32 tempX, tempZ;
f32 temp_f0;
f32 temp_f22_2;
f32 temp_f24;
f32 theta;
f32 dist;
f32 temp_f24_2;
f32 temp_f28;
f32 targetYaw;
f32 new_var;
f32 xSub;
f32 zSub;
f32 collRad, collDiam;
int new_var2;
if (npc->flags & NPC_FLAG_IGNORE_PLAYER_COLLISION) {
return FALSE;
@ -480,55 +485,55 @@ s32 npc_do_player_collision(Npc* npc) {
playerX = playerStatus->position.x;
playerZ = playerStatus->position.z;
tempX = npc->pos.x;
tempZ = npc->pos.z;
xDiff = playerX - npc->pos.x;
zDiff = playerZ - npc->pos.z;
xDiff = playerX - tempX;
zDiff = playerZ - tempZ;
temp_f22_2 = (npc->collisionRadius / 2) + (f32)(playerStatus->colliderDiameter / 2);
if (temp_f22_2 < sqrtf(SQ(xDiff) + SQ(zDiff))) {
sp10 = (npc->collisionRadius / 2) + (f32)(playerStatus->colliderDiameter / 2);
npcColliderZ = zDiff;
temp_f24_2 = xDiff;
dist = sqrtf(SQ(temp_f24_2) + SQ(npcColliderZ));
if (sp10 < dist) {
return FALSE;
}
playerStatus->animFlags |= 0x8000;
//playerX = playerStatus->position.x;
npcColliderX = npc->colliderPos.x;
npcColliderZ = npc->colliderPos.z;
tempX = playerX - npcColliderX;
tempZ = playerZ - npcColliderZ;
zSub = sp10;
xDiff = playerX - npcColliderX;
zDiff = playerZ - npcColliderZ;
//temp_f24 = sqrtf(SQ(tempX) + SQ(tempZ));
xDiff = tempZ;
temp_f24 = sqrtf((tempX * tempX) + (xDiff * xDiff));
dist = xSub = sqrtf(SQ(xDiff) + SQ(zDiff));
temp_f0 = atan2(playerX, playerZ, npcColliderX, npcColliderZ);
temp_f28 = playerStatus->targetYaw;
temp_f24_2 = temp_f22_2 - temp_f24;
temp_f24 = temp_f24_2 * sin_rad(DEG_TO_RAD(temp_f0));
playerZ = -temp_f24_2 * cos_rad(DEG_TO_RAD(temp_f0));
theta = atan2(playerX, playerZ, npcColliderX, npcColliderZ);
targetYaw = playerStatus->targetYaw;
temp_f24_2 = zSub - dist;
xSub = temp_f24_2 * sin_rad(DEG_TO_RAD(theta));
zSub = -temp_f24_2 * cos_rad(DEG_TO_RAD(theta));
if (playerStatus->animFlags & PA_FLAG_RIDING_PARTNER) {
if (fabsf(get_clamped_angle_diff(temp_f0, temp_f28)) < 45.0f) {
playerStatus->position.x -= temp_f24;
playerStatus->position.z -= playerZ;
wPartnerNpc->pos.x -= temp_f24;
wPartnerNpc->pos.z -= playerZ;
if (fabsf(get_clamped_angle_diff(theta, targetYaw)) < 45.0f) {
playerStatus->position.x -= xSub;
playerStatus->position.z -= zSub;
wPartnerNpc->pos.x -= xSub;
wPartnerNpc->pos.z -= zSub;
} else {
playerStatus->position.x -= temp_f24 * 0.5f;
playerStatus->position.z -= playerZ * 0.5f;
wPartnerNpc->pos.x -= temp_f24 * 0.5f;
wPartnerNpc->pos.z -= playerZ * 0.5f;
playerStatus->position.x -= xSub * 0.5f;
playerStatus->position.z -= zSub * 0.5f;
wPartnerNpc->pos.x -= xSub * 0.5f;
wPartnerNpc->pos.z -= zSub * 0.5f;
}
} else {
if (playerStatus->flags & (PS_FLAG_JUMPING | PS_FLAG_FALLING)) {
playerStatus->position.x -= temp_f24 * 0.4f;
playerStatus->position.z -= playerZ * 0.4f;
} else if (fabsf(get_clamped_angle_diff(temp_f0, temp_f28)) < 45.0f) {
playerStatus->position.x -= temp_f24;
playerStatus->position.z -= playerZ;
playerStatus->position.x -= xSub * 0.4f;
playerStatus->position.z -= zSub * 0.4f;
} else if (fabsf(get_clamped_angle_diff(theta, targetYaw)) < 45.0f) {
playerStatus->position.x -= xSub;
playerStatus->position.z -= zSub;
} else {
playerStatus->position.x -= temp_f24 * 0.5f;
playerStatus->position.z -= playerZ * 0.5f;
playerStatus->position.x -= xSub * 0.5f;
playerStatus->position.z -= zSub * 0.5f;
}
}
npc->pos.x = npc->colliderPos.x;
@ -546,7 +551,7 @@ void npc_try_apply_gravity(Npc* npc) {
f32 x, y, z, testLength;
f32 length;
s32 hitID;
if (!(npc->flags & NPC_FLAG_GRAVITY)) {
return;
}
@ -586,7 +591,7 @@ s32 npc_try_snap_to_ground(Npc* npc, f32 velocity) {
f32 x, y, z, testLength;
f32 length;
s32 hitID;
if (npc->flags & (NPC_FLAG_GRAVITY | NPC_FLAG_8)) {
return FALSE;
}

View File

@ -1269,7 +1269,7 @@ s32 func_802DE8DC(s32 spriteIdx, s32 compListIdx, s32* outX, s32* outY, s32* out
u32* spriteData;
if (sprite->componentList == NULL) {
return;
return; // bug: does not return a value
}
animID = sprite->currentAnimID;
@ -1297,7 +1297,7 @@ s32 func_802DE8DC(s32 spriteIdx, s32 compListIdx, s32* outX, s32* outY, s32* out
}
}
} else {
return;
return; // bug: does not return a value
}
return -1;
}

View File

@ -272,14 +272,6 @@ void create_shading_palette(Matrix4f mtx, s32 uls, s32 ult, s32 lrs, s32 lrt, s3
}
}
extern int ENVIRONMENT;
extern int SHADE;
extern int COMBINED;
extern int COMBINED_ALPHA;
extern int TEXEL0_ALPHA;
// float regalloc
#ifdef NON_MATCHING
void appendGfx_shading_palette(
Matrix4f mtx,
s32 uls, s32 ult, s32 lrs, s32 lrt,
@ -290,20 +282,20 @@ void appendGfx_shading_palette(
s32 ambientPower, s32 renderMode)
{
Camera* camera = &gCameras[gCurrentCameraID];
f32 temp_f0;
f32 temp_f1;
f32 temp_f2;
f32 var_f26;
f32 temp_f28 = 0;
f32 temp_f6_2;
f32 mtx01;
f32 mtx11;
f32 mtx21;
f32 offsetXComp;
f32 offsetYComp = 0;
f32 apMag;
f32 var_f12;
f32 var_f12_2;
f32 var_f20;
f32 var_f30;
f32 var_f26_2;
f32 facingDir;
f32 ex, ey, ez;
float new_var3;
f32 a1, a2;
f32 offsetX, offsetY;
f32 pm02, pm12, pm22;
f32 t1;
var_f12 = SQ(shadowX) + SQ(shadowY) + SQ(shadowZ);
@ -315,15 +307,16 @@ void appendGfx_shading_palette(
}
shadowX *= var_f12;
shadowY *= var_f12;
pm02 = var_f12; // TODO required to match
shadowZ *= var_f12;
if ((-mtx[0][2] * camera->perspectiveMatrix[0][2]) + (mtx[2][2] * camera->perspectiveMatrix[2][2]) < 0.0f) {
var_f30 = 1.0f;
if (((-mtx[0][2] * camera->perspectiveMatrix[0][2]) + (mtx[2][2] * camera->perspectiveMatrix[2][2])) < 0.0f) {
facingDir = 1.0f;
} else {
var_f30 = -1.0f;
facingDir = -1.0f;
}
if (var_f30 < 0.0f) {
if (facingDir < 0.0f) {
ex = mtx[0][2];
ey = mtx[1][2];
ez = -mtx[2][2];
@ -333,34 +326,41 @@ void appendGfx_shading_palette(
ez = mtx[2][2];
}
a1 = ((ex * shadowX) + (ey * shadowY)) + (ez * shadowZ);
new_var3 = a1;
temp_f2 = camera->perspectiveMatrix[2][2];
var_f12 = camera->perspectiveMatrix[0][2];
pm02 = camera->perspectiveMatrix[0][2];
pm12 = camera->perspectiveMatrix[1][2];
pm22 = camera->perspectiveMatrix[2][2];
var_f26 = var_f12;
a1 = shadowX * -temp_f2;
temp_f6_2 = a1 + (var_f26 * shadowZ) ;
if (new_var3 > 0.0f) {
var_f26 = ambientPower * temp_f6_2;
t1 = (ex * shadowX) + (ey * shadowY) + (ez * shadowZ);
apMag = (shadowX * -pm22) + (shadowZ * pm02);
if (t1 > 0.0f) {
offsetXComp = ambientPower * apMag;
} else if (ambientPower > 1.0f) {
offsetXComp = ambientPower * apMag;
} else {
temp_f2 = ambientPower;
var_f26 = temp_f2 * temp_f6_2;
}
// TODO grossness required to match
// a temp s16 for ambientPower works as well as the explicit casting in both places
offsetX = -1.0f;
offsetY = (s16) ambientPower > offsetX;
if ((s16) ambientPower > offsetX) {
offsetXComp = ambientPower * apMag;
} else {
offsetXComp = ambientPower * apMag;
}
}
var_f20 = SQ(shadowX) + SQ(shadowZ);
if (var_f20 != 0.0f) {
var_f20 = sqrtf(var_f20);
}
temp_f0 = -mtx[0][1];
temp_f1 = mtx[1][1];
temp_f2 = mtx[2][1];
var_f12 = SQ(temp_f0) + SQ(temp_f2);
if (var_f12 != 0.0f) {
var_f12 = sqrtf(var_f12);
mtx01 = -mtx[0][1];
mtx11 = mtx[1][1];
mtx21 = mtx[2][1];
var_f12_2 = SQ(mtx01) + SQ(mtx21);
if (var_f12_2 != 0.0f) {
var_f12_2 = sqrtf(var_f12_2);
}
temp_f28 = -((var_f20 * var_f12) + (shadowY * temp_f1)) * ambientPower;
offsetYComp = -((var_f20 * var_f12_2) + (shadowY * mtx11)) * ambientPower;
if (shadowR > 255) {
shadowR = 255;
@ -426,20 +426,17 @@ void appendGfx_shading_palette(
COMBINED, 0, 0, 0, COMBINED);
}
var_f26_2 = var_f26;
var_f26_2 *= var_f30;
offsetX = offsetXComp * facingDir;
offsetY = offsetYComp;
gDPSetTileSize(
gMainGfxPos++,
0,
((uls + 0x100) << 2) + (s32)var_f26_2,
((ult + 0x100) << 2) + (s32)temp_f28,
((lrs + 0x100 - 1) << 2) + (s32)var_f26_2,
((lrt + 0x100 - 1) << 2) + (s32)temp_f28
((uls + 0x100) << 2) + (s32)offsetX,
((ult + 0x100) << 2) + (s32)offsetY,
((lrs + 0x100 - 1) << 2) + (s32)offsetX,
((lrt + 0x100 - 1) << 2) + (s32)offsetY
);
}
#else
INCLUDE_ASM(s32, "de740_len_23f0", appendGfx_shading_palette);
#endif
void func_801491E4(Matrix4f mtx, s32 arg1, s32 arg2, s32 arg3, s32 arg4, s32 alpha) {
gDPSetPrimColor(gMainGfxPos++, 0, 0, 0, 0, 0, alpha);

View File

@ -1,3 +1,5 @@
#include "gcc/string.h"
// enum mapping itemIDs -> index in single recipe arrays and column/rows in double recipe matrix
enum CookingIngredientID {
iRSH = 0, // ITEM_MUSHROOM
@ -256,35 +258,35 @@ s8 SingleRecipesWithCookbook[] = {
s8 DoubleRecipesMatrix[] = {
/* iRSH iSSH iUSH iLSH iVSH iFFL iCOC iLIM iLEM iHSY iMSY iJAM iAPP iRBY iBBY iYBY iGMN iKLF iDRP iDRF iSLF iMIX iEGG iMEL iSTK iPOT iDSH iBUB iBMP */
/* iRSH */ rXXX, rHOT, rSHS, rSHS, rHOT, rHOT, rXXX, rXXX, rXXX, rHSH, rMSH, rJSH, rXXX, rXXX, rXXX, rXXX, rVSH, rVSH, rBLN, rVSH, rVSH, rSHC, rBLN, rXXX, rXXX, rBLN, rFRS, rXXX, rXXX,
/* iSSH */ -1, rXXX, rSHS, rSHS, rHOT, rBLN, rXXX, rXXX, rXXX, rHSU, rMSU, rJSU, rXXX, rXXX, rXXX, rXXX, rLSH, rLSH, rBLN, rVSH, rLSH, rSHC, rBLN, rXXX, rXXX, rBLN, rHOT, rXXX, rXXX,
/* iUSH */ -1, -1, rXXX, rSHS, rSHS, rYUM, rXXX, rXXX, rXXX, rHUL, rMUL, rJUL, rXXX, rXXX, rXXX, rXXX, rLSH, rLSH, rYUM, rVSH, rLSH, rSWS, rYUM, rXXX, rXXX, rYUM, rSHS, rXXX, rXXX,
/* iLSH */ -1, -1, -1, rXXX, rXXX, rBLN, rXXX, rXXX, rXXX, rHSU, rMSU, rJSU, rXXX, rXXX, rXXX, rXXX, rLSH, rLSH, rBLN, rVSH, rLSH, rSWS, rBLN, rXXX, rXXX, rBLN, rSHS, rXXX, rXXX,
/* iVSH */ -1, -1, -1, -1, rXXX, rBLN, rXXX, rXXX, rXXX, rHSU, rMSU, rJSU, rXXX, rXXX, rXXX, rXXX, rLSH, rLSH, rBLN, rTHR, rDZD, rELP, rBLN, rXXX, rXXX, rBLN, rHOT, rXXX, rXXX,
/* iFFL */ -1, -1, -1, -1, -1, rXXX, rXXX, rXXX, rXXX, rXXX, rXXX, rXXX, rXXX, rXXX, rXXX, rXXX, rBLN, rXXX, rXXX, rXXX, rXXX, rFIP, rEGM, rXXX, rXXX, rFZF, rFRS, rXXX, rXXX,
/* iCOC */ -1, -1, -1, -1, -1, -1, rXXX, rXXX, rXXX, rTTN, rSOD, rSSH, rSOD, rSOD, rSOD, rSOD, rXXX, rSOD, rBLN, rXXX, rXXX, rCOP, rXXX, rSOD, rXXX, rBLN, rXXX, rXXX, rXXX,
/* iLIM */ -1, -1, -1, -1, -1, -1, -1, rXXX, rSOD, rTTN, rSOD, rSSH, rSOD, rSOD, rSOD, rSOD, rXXX, rSOD, rXXX, rXXX, rXXX, rLIC, rXXX, rSSH, rXXX, rXXX, rXXX, rXXX, rXXX,
/* iLEM */ -1, -1, -1, -1, -1, -1, -1, -1, rXXX, rTTN, rSOD, rSSH, rSOD, rSOD, rSOD, rSOD, rXXX, rSOD, rXXX, rXXX, rXXX, rLEC, rXXX, rSSH, rXXX, rXXX, rXXX, rXXX, rXXX,
/* iHSY */ -1, -1, -1, -1, -1, -1, -1, -1, -1, rXXX, rSOD, rSSH, rTTN, rTTN, rTTN, rTTN, rXXX, rSOD, rXXX, rXXX, rXXX, rHNC, rXXX, rSSH, rXXX, rXXX, rXXX, rXXX, rXXX,
/* iMSY */ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, rXXX, rSSH, rSOD, rSOD, rSOD, rSOD, rXXX, rSOD, rXXX, rXXX, rXXX, rKCK, rXXX, rSSH, rXXX, rXXX, rXXX, rXXX, rXXX,
/* iJAM */ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, rXXX, rSSH, rSSH, rSSH, rSSH, rXXX, rSOD, rXXX, rXXX, rXXX, rJLP, rXXX, rSSH, rXXX, rXXX, rXXX, rXXX, rXXX,
/* iAPP */ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, rXXX, rSOD, rSOD, rSOD, rXXX, rXXX, rXXX, rXXX, rXXX, rPIE, rXXX, rSSH, rXXX, rXXX, rXXX, rXXX, rXXX,
/* iRBY */ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, rXXX, rSOD, rSOD, rXXX, rBLN, rBLN, rXXX, rSLS, rBCK, rXXX, rSSH, rXXX, rXXX, rXXX, rXXX, rXXX,
/* iBBY */ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, rXXX, rSOD, rXXX, rBLN, rBLN, rXXX, rSLS, rBCK, rXXX, rSSH, rXXX, rXXX, rXXX, rXXX, rXXX,
/* iYBY */ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, rXXX, rXXX, rBLN, rBLN, rXXX, rSLS, rBCK, rXXX, rSSH, rXXX, rXXX, rXXX, rXXX, rXXX,
/* iGMN */ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, rXXX, rBLN, rBLN, rXXX, rBLN, rBCK, rXXX, rXXX, rXXX, rXXX, rXXX, rXXX, rXXX,
/* iKLF */ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, rXXX, rKOO, rXXX, rXXX, rKCK, rXXX, rSSH, rXXX, rXXX, rXXX, rXXX, rXXX,
/* iDRP */ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, rXXX, rYUM, rBLN, rXXX, rBLN, rXXX, rXXX, rBLN, rXXX, rXXX, rXXX,
/* iDRF */ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, rXXX, rFFL, rXXX, rXXX, rXXX, rXXX, rYUM, rXXX, rXXX, rXXX,
/* iSLF */ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, rXXX, rSTR, rBEG, rSSH, rDZD, rYUM, rXXX, rXXX, rXXX,
/* iMIX */ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, rXXX, rBCK, rYCK, rKCK, rBLN, rXXX, rXXX, rXXX,
/* iEGG */ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, rXXX, rXXX, rBEG, rBLN, rXXX, rXXX, rXXX,
/* iMEL */ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, rXXX, rXXX, rXXX, rXXX, rXXX, rXXX,
/* iSTK */ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, rXXX, rXXX, rXXX, rXXX, rXXX,
/* iPOT */ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, rXXX, rXXX, rXXX, rXXX,
/* iDSH */ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, rXXX, rXXX, rXXX,
/* iBUB */ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, rXXX, rXXX,
/* iBMP */ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, rXXX,
/* iRSH */ rXXX, rHOT, rSHS, rSHS, rHOT, rHOT, rXXX, rXXX, rXXX, rHSH, rMSH, rJSH, rXXX, rXXX, rXXX, rXXX, rVSH, rVSH, rBLN, rVSH, rVSH, rSHC, rBLN, rXXX, rXXX, rBLN, rFRS, rXXX, rXXX,
/* iSSH */ -1, rXXX, rSHS, rSHS, rHOT, rBLN, rXXX, rXXX, rXXX, rHSU, rMSU, rJSU, rXXX, rXXX, rXXX, rXXX, rLSH, rLSH, rBLN, rVSH, rLSH, rSHC, rBLN, rXXX, rXXX, rBLN, rHOT, rXXX, rXXX,
/* iUSH */ -1, -1, rXXX, rSHS, rSHS, rYUM, rXXX, rXXX, rXXX, rHUL, rMUL, rJUL, rXXX, rXXX, rXXX, rXXX, rLSH, rLSH, rYUM, rVSH, rLSH, rSWS, rYUM, rXXX, rXXX, rYUM, rSHS, rXXX, rXXX,
/* iLSH */ -1, -1, -1, rXXX, rXXX, rBLN, rXXX, rXXX, rXXX, rHSU, rMSU, rJSU, rXXX, rXXX, rXXX, rXXX, rLSH, rLSH, rBLN, rVSH, rLSH, rSWS, rBLN, rXXX, rXXX, rBLN, rSHS, rXXX, rXXX,
/* iVSH */ -1, -1, -1, -1, rXXX, rBLN, rXXX, rXXX, rXXX, rHSU, rMSU, rJSU, rXXX, rXXX, rXXX, rXXX, rLSH, rLSH, rBLN, rTHR, rDZD, rELP, rBLN, rXXX, rXXX, rBLN, rHOT, rXXX, rXXX,
/* iFFL */ -1, -1, -1, -1, -1, rXXX, rXXX, rXXX, rXXX, rXXX, rXXX, rXXX, rXXX, rXXX, rXXX, rXXX, rBLN, rXXX, rXXX, rXXX, rXXX, rFIP, rEGM, rXXX, rXXX, rFZF, rFRS, rXXX, rXXX,
/* iCOC */ -1, -1, -1, -1, -1, -1, rXXX, rXXX, rXXX, rTTN, rSOD, rSSH, rSOD, rSOD, rSOD, rSOD, rXXX, rSOD, rBLN, rXXX, rXXX, rCOP, rXXX, rSOD, rXXX, rBLN, rXXX, rXXX, rXXX,
/* iLIM */ -1, -1, -1, -1, -1, -1, -1, rXXX, rSOD, rTTN, rSOD, rSSH, rSOD, rSOD, rSOD, rSOD, rXXX, rSOD, rXXX, rXXX, rXXX, rLIC, rXXX, rSSH, rXXX, rXXX, rXXX, rXXX, rXXX,
/* iLEM */ -1, -1, -1, -1, -1, -1, -1, -1, rXXX, rTTN, rSOD, rSSH, rSOD, rSOD, rSOD, rSOD, rXXX, rSOD, rXXX, rXXX, rXXX, rLEC, rXXX, rSSH, rXXX, rXXX, rXXX, rXXX, rXXX,
/* iHSY */ -1, -1, -1, -1, -1, -1, -1, -1, -1, rXXX, rSOD, rSSH, rTTN, rTTN, rTTN, rTTN, rXXX, rSOD, rXXX, rXXX, rXXX, rHNC, rXXX, rSSH, rXXX, rXXX, rXXX, rXXX, rXXX,
/* iMSY */ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, rXXX, rSSH, rSOD, rSOD, rSOD, rSOD, rXXX, rSOD, rXXX, rXXX, rXXX, rKCK, rXXX, rSSH, rXXX, rXXX, rXXX, rXXX, rXXX,
/* iJAM */ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, rXXX, rSSH, rSSH, rSSH, rSSH, rXXX, rSOD, rXXX, rXXX, rXXX, rJLP, rXXX, rSSH, rXXX, rXXX, rXXX, rXXX, rXXX,
/* iAPP */ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, rXXX, rSOD, rSOD, rSOD, rXXX, rXXX, rXXX, rXXX, rXXX, rPIE, rXXX, rSSH, rXXX, rXXX, rXXX, rXXX, rXXX,
/* iRBY */ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, rXXX, rSOD, rSOD, rXXX, rBLN, rBLN, rXXX, rSLS, rBCK, rXXX, rSSH, rXXX, rXXX, rXXX, rXXX, rXXX,
/* iBBY */ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, rXXX, rSOD, rXXX, rBLN, rBLN, rXXX, rSLS, rBCK, rXXX, rSSH, rXXX, rXXX, rXXX, rXXX, rXXX,
/* iYBY */ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, rXXX, rXXX, rBLN, rBLN, rXXX, rSLS, rBCK, rXXX, rSSH, rXXX, rXXX, rXXX, rXXX, rXXX,
/* iGMN */ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, rXXX, rBLN, rBLN, rXXX, rBLN, rBCK, rXXX, rXXX, rXXX, rXXX, rXXX, rXXX, rXXX,
/* iKLF */ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, rXXX, rKOO, rXXX, rXXX, rKCK, rXXX, rSSH, rXXX, rXXX, rXXX, rXXX, rXXX,
/* iDRP */ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, rXXX, rYUM, rBLN, rXXX, rBLN, rXXX, rXXX, rBLN, rXXX, rXXX, rXXX,
/* iDRF */ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, rXXX, rFFL, rXXX, rXXX, rXXX, rXXX, rYUM, rXXX, rXXX, rXXX,
/* iSLF */ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, rXXX, rSTR, rBEG, rSSH, rDZD, rYUM, rXXX, rXXX, rXXX,
/* iMIX */ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, rXXX, rBCK, rYCK, rKCK, rBLN, rXXX, rXXX, rXXX,
/* iEGG */ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, rXXX, rXXX, rBEG, rBLN, rXXX, rXXX, rXXX,
/* iMEL */ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, rXXX, rXXX, rXXX, rXXX, rXXX, rXXX,
/* iSTK */ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, rXXX, rXXX, rXXX, rXXX, rXXX,
/* iPOT */ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, rXXX, rXXX, rXXX, rXXX,
/* iDSH */ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, rXXX, rXXX, rXXX,
/* iBUB */ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, rXXX, rXXX,
/* iBMP */ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, rXXX,
};
typedef struct ExtraCookingPair {
@ -342,12 +344,12 @@ API_CALLABLE(N(GetCookResultForSingleRecipe)) {
s32 resultItemID;
s32 resultQuality;
s32 i;
outVarItemID = *args++;
outVarQuality = *args++;
inputItem = evt_get_variable(script, *args++);
hasCookbook = evt_get_variable(script, *args++);
if (inputItem == ITEM_MYSTERY) {
if (rand_int(1000) < 500) {
resultItemID = ITEM_MISTAKE;
@ -495,7 +497,7 @@ const s32 CookableDiscoveredFlags[] = {
GF_MAC02_DiscoveredRecipe_18, GF_MAC02_DiscoveredRecipe_19, GF_MAC02_DiscoveredRecipe_1A, GF_MAC02_DiscoveredRecipe_1B, GF_MAC02_DiscoveredRecipe_1C, GF_MAC02_DiscoveredRecipe_1D, GF_MAC02_DiscoveredRecipe_1E, GF_MAC02_DiscoveredRecipe_1F,
GF_MAC02_DiscoveredRecipe_20, GF_MAC02_DiscoveredRecipe_21, GF_MAC02_DiscoveredRecipe_22, GF_MAC02_DiscoveredRecipe_23, GF_MAC02_DiscoveredRecipe_24, GF_MAC02_DiscoveredRecipe_25, GF_MAC02_DiscoveredRecipe_26, GF_MAC02_DiscoveredRecipe_27,
GF_MAC02_DiscoveredRecipe_28, GF_MAC02_DiscoveredRecipe_29, GF_MAC02_DiscoveredRecipe_2A, GF_MAC02_DiscoveredRecipe_2B, GF_MAC02_DiscoveredRecipe_2C, GF_MAC02_DiscoveredRecipe_2D, GF_MAC02_DiscoveredRecipe_2E, GF_MAC02_DiscoveredRecipe_2F,
GF_MAC02_DiscoveredRecipe_30, GF_MAC02_DiscoveredRecipe_31, GF_MAC02_DiscoveredRecipe_32, GF_MAC02_DiscoveredRecipe_33
GF_MAC02_DiscoveredRecipe_30, GF_MAC02_DiscoveredRecipe_31, GF_MAC02_DiscoveredRecipe_32, GF_MAC02_DiscoveredRecipe_33
};
API_CALLABLE(N(SetRecipeDiscovered)) {
@ -610,7 +612,7 @@ EvtScript N(EVS_TayceT_FryingPanAndCake) = {
s32 N(ItemList_Cookbook)[] = {
ITEM_COOKBOOK,
ITEM_NONE
ITEM_NONE
};
EvtScript N(EVS_TayceT_RequestCookbook) = {

View File

@ -6,6 +6,7 @@
#include "rumble.h"
#include "sprite.h"
#include "model.h"
#include "gcc/string.h"
s32 WorldReverbModeMapping[] = { 0, 1, 2, 3 };

View File

@ -81,24 +81,29 @@ def read_symbol_addrs():
if "_ROM_START" in line or "_ROM_END" in line:
continue
main, ext = line.rstrip().split(";")
opt = ext.split("//")[-1].strip().split(" ")
main_split = line.rstrip().split(";")
main = main_split[0]
dead = False
opts = []
type = ""
rom = -1
for thing in list(opt):
if thing.strip() == "":
opt.remove(thing)
if "type:" in thing:
type = thing.split(":")[1]
opt.remove(thing)
elif "rom:" in thing:
rom = int(thing.split(":")[1], 16)
opt.remove(thing)
elif "dead:" in thing:
dead = True
if len(main_split) > 1:
ext = main_split[1]
opts = ext.split("//")[-1].strip().split(" ")
for opt in list(opts):
if opt.strip() == "":
opts.remove(opt)
if "type:" in opt:
type = opt.split(":")[1]
opts.remove(opt)
elif "rom:" in opt:
rom = int(opt.split(":")[1], 16)
opts.remove(opt)
elif "dead:" in opt:
dead = True
eqsplit = main.split(" = ")
if len(eqsplit) != 2:
@ -108,9 +113,9 @@ def read_symbol_addrs():
name, addr = main.split(" = ")
if not dead:
symbol_addrs.append([name, int(addr, 0), type, rom, opt])
symbol_addrs.append([name, int(addr, 0), type, rom, opts])
else:
dead_symbols.append([name, int(addr, 0), type, rom, opt])
dead_symbols.append([name, int(addr, 0), type, rom, opts])
def read_elf():
try:

View File

@ -1,547 +0,0 @@
.set noat /* allow manual use of $at */
.set noreorder /* don't insert nops after branches */
/* Generated by spimdisasm 1.11.1 */
glabel appendGfx_shading_palette
/* DE028 80147148 27BDFF90 */ addiu $sp, $sp, -0x70
/* DE02C 8014714C F7B60048 */ sdc1 $f22, 0x48($sp)
/* DE030 80147150 C7B60088 */ lwc1 $f22, 0x88($sp)
/* DE034 80147154 F7B80050 */ sdc1 $f24, 0x50($sp)
/* DE038 80147158 C7B8008C */ lwc1 $f24, 0x8C($sp)
/* DE03C 8014715C F7B40040 */ sdc1 $f20, 0x40($sp)
/* DE040 80147160 C7B40090 */ lwc1 $f20, 0x90($sp)
/* DE044 80147164 AFB30024 */ sw $s3, 0x24($sp)
/* DE048 80147168 8FB30094 */ lw $s3, 0x94($sp)
/* DE04C 8014716C AFB20020 */ sw $s2, 0x20($sp)
/* DE050 80147170 8FB20098 */ lw $s2, 0x98($sp)
/* DE054 80147174 AFB40028 */ sw $s4, 0x28($sp)
/* DE058 80147178 8FB4009C */ lw $s4, 0x9C($sp)
/* DE05C 8014717C AFB60030 */ sw $s6, 0x30($sp)
/* DE060 80147180 8FB600A0 */ lw $s6, 0xA0($sp)
/* DE064 80147184 AFB5002C */ sw $s5, 0x2C($sp)
/* DE068 80147188 8FB500A4 */ lw $s5, 0xA4($sp)
/* DE06C 8014718C AFB00018 */ sw $s0, 0x18($sp)
/* DE070 80147190 8FB000AC */ lw $s0, 0xAC($sp)
/* DE074 80147194 AFB1001C */ sw $s1, 0x1C($sp)
/* DE078 80147198 0080882D */ daddu $s1, $a0, $zero
/* DE07C 8014719C F7BC0060 */ sdc1 $f28, 0x60($sp)
/* DE080 801471A0 4480E000 */ mtc1 $zero, $f28
/* DE084 801471A4 3C038007 */ lui $v1, %hi(gCurrentCameraID)
/* DE088 801471A8 8C636070 */ lw $v1, %lo(gCurrentCameraID)($v1)
/* DE08C 801471AC 3C04800B */ lui $a0, %hi(gCameras)
/* DE090 801471B0 248407D0 */ addiu $a0, $a0, %lo(gCameras)
/* DE094 801471B4 AFBF003C */ sw $ra, 0x3C($sp)
/* DE098 801471B8 4616B002 */ mul.s $f0, $f22, $f22
/* DE09C 801471BC 00000000 */ nop
/* DE0A0 801471C0 AFBE0038 */ sw $fp, 0x38($sp)
/* DE0A4 801471C4 AFB70034 */ sw $s7, 0x34($sp)
/* DE0A8 801471C8 F7BE0068 */ sdc1 $f30, 0x68($sp)
/* DE0AC 801471CC F7BA0058 */ sdc1 $f26, 0x58($sp)
/* DE0B0 801471D0 4618C082 */ mul.s $f2, $f24, $f24
/* DE0B4 801471D4 00000000 */ nop
/* DE0B8 801471D8 AFA50074 */ sw $a1, 0x74($sp)
/* DE0BC 801471DC AFA60078 */ sw $a2, 0x78($sp)
/* DE0C0 801471E0 AFA7007C */ sw $a3, 0x7C($sp)
/* DE0C4 801471E4 00031080 */ sll $v0, $v1, 2
/* DE0C8 801471E8 4614A102 */ mul.s $f4, $f20, $f20
/* DE0CC 801471EC 00000000 */ nop
/* DE0D0 801471F0 00431021 */ addu $v0, $v0, $v1
/* DE0D4 801471F4 00021080 */ sll $v0, $v0, 2
/* DE0D8 801471F8 00431023 */ subu $v0, $v0, $v1
/* DE0DC 801471FC 000218C0 */ sll $v1, $v0, 3
/* DE0E0 80147200 46020000 */ add.s $f0, $f0, $f2
/* DE0E4 80147204 00431021 */ addu $v0, $v0, $v1
/* DE0E8 80147208 000210C0 */ sll $v0, $v0, 3
/* DE0EC 8014720C 46040300 */ add.s $f12, $f0, $f4
/* DE0F0 80147210 3C013FF0 */ lui $at, (0x3FF00000 >> 16)
/* DE0F4 80147214 44811800 */ mtc1 $at, $f3
/* DE0F8 80147218 44801000 */ mtc1 $zero, $f2
/* DE0FC 8014721C 46006021 */ cvt.d.s $f0, $f12
/* DE100 80147220 4622003C */ c.lt.d $f0, $f2
/* DE104 80147224 00000000 */ nop
/* DE108 80147228 45000008 */ bc1f .LIQUE_8014724C
/* DE10C 8014722C 0044F021 */ addu $fp, $v0, $a0
/* DE110 80147230 44900000 */ mtc1 $s0, $f0
/* DE114 80147234 00000000 */ nop
/* DE118 80147238 46800020 */ cvt.s.w $f0, $f0
/* DE11C 8014723C 460C0002 */ mul.s $f0, $f0, $f12
/* DE120 80147240 00000000 */ nop
/* DE124 80147244 4600028D */ trunc.w.s $f10, $f0
/* DE128 80147248 44105000 */ mfc1 $s0, $f10
.LIQUE_8014724C:
/* DE12C 8014724C 461C6032 */ c.eq.s $f12, $f28
/* DE130 80147250 00000000 */ nop
/* DE134 80147254 4501000D */ bc1t .LIQUE_8014728C
/* DE138 80147258 00000000 */ nop
/* DE13C 8014725C 46006084 */ sqrt.s $f2, $f12
/* DE140 80147260 46021032 */ c.eq.s $f2, $f2
/* DE144 80147264 00000000 */ nop
/* DE148 80147268 45010004 */ bc1t .LIQUE_8014727C
/* DE14C 8014726C 00000000 */ nop
/* DE150 80147270 0C0183A0 */ jal sqrtf
/* DE154 80147274 00000000 */ nop
/* DE158 80147278 46000086 */ mov.s $f2, $f0
.LIQUE_8014727C:
/* DE15C 8014727C 3C013F80 */ lui $at, (0x3F800000 >> 16)
/* DE160 80147280 44810000 */ mtc1 $at, $f0
/* DE164 80147284 00000000 */ nop
/* DE168 80147288 46020303 */ div.s $f12, $f0, $f2
.LIQUE_8014728C:
/* DE16C 8014728C 460CB582 */ mul.s $f22, $f22, $f12
/* DE170 80147290 00000000 */ nop
/* DE174 80147294 460CC602 */ mul.s $f24, $f24, $f12
/* DE178 80147298 00000000 */ nop
/* DE17C 8014729C 460CA502 */ mul.s $f20, $f20, $f12
/* DE180 801472A0 00000000 */ nop
/* DE184 801472A4 C6260008 */ lwc1 $f6, 0x8($s1)
/* DE188 801472A8 C7C200DC */ lwc1 $f2, 0xDC($fp)
/* DE18C 801472AC 46003107 */ neg.s $f4, $f6
/* DE190 801472B0 46022082 */ mul.s $f2, $f4, $f2
/* DE194 801472B4 00000000 */ nop
/* DE198 801472B8 C6280028 */ lwc1 $f8, 0x28($s1)
/* DE19C 801472BC C7C000FC */ lwc1 $f0, 0xFC($fp)
/* DE1A0 801472C0 46004002 */ mul.s $f0, $f8, $f0
/* DE1A4 801472C4 00000000 */ nop
/* DE1A8 801472C8 46001080 */ add.s $f2, $f2, $f0
/* DE1AC 801472CC 44800000 */ mtc1 $zero, $f0
/* DE1B0 801472D0 3C01BF80 */ lui $at, (0xBF800000 >> 16)
/* DE1B4 801472D4 4481F000 */ mtc1 $at, $f30
/* DE1B8 801472D8 4600103C */ c.lt.s $f2, $f0
/* DE1BC 801472DC 00000000 */ nop
/* DE1C0 801472E0 45000004 */ bc1f .LIQUE_801472F4
/* DE1C4 801472E4 00000000 */ nop
/* DE1C8 801472E8 3C013F80 */ lui $at, (0x3F800000 >> 16)
/* DE1CC 801472EC 4481F000 */ mtc1 $at, $f30
/* DE1D0 801472F0 00000000 */ nop
.LIQUE_801472F4:
/* DE1D4 801472F4 4600F03C */ c.lt.s $f30, $f0
/* DE1D8 801472F8 00000000 */ nop
/* DE1DC 801472FC 45000004 */ bc1f .LIQUE_80147310
/* DE1E0 80147300 46003086 */ mov.s $f2, $f6
/* DE1E4 80147304 C6200018 */ lwc1 $f0, 0x18($s1)
/* DE1E8 80147308 08051CC6 */ j .LIQUE_80147318
/* DE1EC 8014730C 46004207 */ neg.s $f8, $f8
.LIQUE_80147310:
/* DE1F0 80147310 46002086 */ mov.s $f2, $f4
/* DE1F4 80147314 C6200018 */ lwc1 $f0, 0x18($s1)
.LIQUE_80147318:
/* DE1F8 80147318 46161102 */ mul.s $f4, $f2, $f22
/* DE1FC 8014731C 00000000 */ nop
/* DE200 80147320 46180002 */ mul.s $f0, $f0, $f24
/* DE204 80147324 00000000 */ nop
/* DE208 80147328 46144202 */ mul.s $f8, $f8, $f20
/* DE20C 8014732C 00000000 */ nop
/* DE210 80147330 C7C200FC */ lwc1 $f2, 0xFC($fp)
/* DE214 80147334 46001087 */ neg.s $f2, $f2
/* DE218 80147338 4602B082 */ mul.s $f2, $f22, $f2
/* DE21C 8014733C 00000000 */ nop
/* DE220 80147340 C7C600DC */ lwc1 $f6, 0xDC($fp)
/* DE224 80147344 4606A182 */ mul.s $f6, $f20, $f6
/* DE228 80147348 00000000 */ nop
/* DE22C 8014734C 46002100 */ add.s $f4, $f4, $f0
/* DE230 80147350 46082100 */ add.s $f4, $f4, $f8
/* DE234 80147354 44800000 */ mtc1 $zero, $f0
/* DE238 80147358 00000000 */ nop
/* DE23C 8014735C 4604003C */ c.lt.s $f0, $f4
/* DE240 80147360 00000000 */ nop
/* DE244 80147364 45000007 */ bc1f .LIQUE_80147384
/* DE248 80147368 46061180 */ add.s $f6, $f2, $f6
/* DE24C 8014736C 44900000 */ mtc1 $s0, $f0
/* DE250 80147370 00000000 */ nop
/* DE254 80147374 46800020 */ cvt.s.w $f0, $f0
/* DE258 80147378 46060682 */ mul.s $f26, $f0, $f6
/* DE25C 8014737C 08051CE6 */ j .LIQUE_80147398
/* DE260 80147380 00000000 */ nop
.LIQUE_80147384:
/* DE264 80147384 44901000 */ mtc1 $s0, $f2
/* DE268 80147388 00000000 */ nop
/* DE26C 8014738C 468010A0 */ cvt.s.w $f2, $f2
/* DE270 80147390 46061682 */ mul.s $f26, $f2, $f6
/* DE274 80147394 00000000 */ nop
.LIQUE_80147398:
/* DE278 80147398 4616B002 */ mul.s $f0, $f22, $f22
/* DE27C 8014739C 00000000 */ nop
/* DE280 801473A0 4614A082 */ mul.s $f2, $f20, $f20
/* DE284 801473A4 00000000 */ nop
/* DE288 801473A8 46020500 */ add.s $f20, $f0, $f2
/* DE28C 801473AC 44800000 */ mtc1 $zero, $f0
/* DE290 801473B0 00000000 */ nop
/* DE294 801473B4 4600A032 */ c.eq.s $f20, $f0
/* DE298 801473B8 00000000 */ nop
/* DE29C 801473BC 45010009 */ bc1t .LIQUE_801473E4
/* DE2A0 801473C0 00000000 */ nop
/* DE2A4 801473C4 4600A004 */ sqrt.s $f0, $f20
/* DE2A8 801473C8 46000032 */ c.eq.s $f0, $f0
/* DE2AC 801473CC 00000000 */ nop
/* DE2B0 801473D0 45030004 */ bc1tl .LIQUE_801473E4
/* DE2B4 801473D4 46000506 */ mov.s $f20, $f0
/* DE2B8 801473D8 0C0183A0 */ jal sqrtf
/* DE2BC 801473DC 4600A306 */ mov.s $f12, $f20
/* DE2C0 801473E0 46000506 */ mov.s $f20, $f0
.LIQUE_801473E4:
/* DE2C4 801473E4 C6200004 */ lwc1 $f0, 0x4($s1)
/* DE2C8 801473E8 46000007 */ neg.s $f0, $f0
/* DE2CC 801473EC 46000002 */ mul.s $f0, $f0, $f0
/* DE2D0 801473F0 00000000 */ nop
/* DE2D4 801473F4 C6220024 */ lwc1 $f2, 0x24($s1)
/* DE2D8 801473F8 46021082 */ mul.s $f2, $f2, $f2
/* DE2DC 801473FC 00000000 */ nop
/* DE2E0 80147400 46020300 */ add.s $f12, $f0, $f2
/* DE2E4 80147404 44800000 */ mtc1 $zero, $f0
/* DE2E8 80147408 C6360014 */ lwc1 $f22, 0x14($s1)