mirror of
https://github.com/zeldaret/oot.git
synced 2025-08-16 12:02:50 +00:00
Merge branch 'master' into ovl_En_Ik
This commit is contained in:
commit
2941fd3540
170 changed files with 3270 additions and 9073 deletions
|
@ -85,7 +85,7 @@ u8 Inventory_DeleteEquipment(GlobalContext* globalCtx, s16 equipment) {
|
|||
sp26 >>= gEquipShifts[equipment];
|
||||
|
||||
gSaveContext.equips.equipment &= gEquipNegMasks[equipment];
|
||||
gSaveContext.equipment ^= gBitFlags[sp26 - 1] << gEquipShifts[equipment];
|
||||
gSaveContext.inventory.equipment ^= gBitFlags[sp26 - 1] << gEquipShifts[equipment];
|
||||
|
||||
if (equipment == EQUIP_TUNIC) {
|
||||
gSaveContext.equips.equipment |= 0x0100;
|
||||
|
@ -104,6 +104,6 @@ u8 Inventory_DeleteEquipment(GlobalContext* globalCtx, s16 equipment) {
|
|||
}
|
||||
|
||||
void Inventory_ChangeUpgrade(s16 upgrade, s16 value) {
|
||||
gSaveContext.upgrades &= gUpgradeNegMasks[upgrade];
|
||||
gSaveContext.upgrades |= value << gUpgradeShifts[upgrade];
|
||||
gSaveContext.inventory.upgrades &= gUpgradeNegMasks[upgrade];
|
||||
gSaveContext.inventory.upgrades |= value << gUpgradeShifts[upgrade];
|
||||
}
|
||||
|
|
|
@ -67,7 +67,7 @@ void ActorShadow_DrawFunc_WhiteCircle(Actor* actor, Lights* lights, GlobalContex
|
|||
}
|
||||
|
||||
void ActorShadow_DrawFunc_Squiggly(Actor* actor, Lights* lights, GlobalContext* globalCtx) {
|
||||
func_8002B200(actor, lights, globalCtx, &D_04049AD0, NULL);
|
||||
func_8002B200(actor, lights, globalCtx, D_04049AD0, NULL);
|
||||
}
|
||||
|
||||
void func_8002B66C(GlobalContext* globalCtx, Light* light, MtxF* arg2, s32 arg3, f32 arg4, f32 arg5, f32 arg6) {
|
||||
|
@ -1949,10 +1949,10 @@ void func_800304B0(GlobalContext* globalCtx) {
|
|||
// Actor_InitContext
|
||||
void func_800304DC(GlobalContext* globalCtx, ActorContext* actorCtx, ActorEntry* actorEntry) {
|
||||
ActorOverlay* overlayEntry;
|
||||
SaveSceneFlags* saveSceneFlags;
|
||||
SavedSceneFlags* savedSceneFlags;
|
||||
s32 i;
|
||||
|
||||
saveSceneFlags = &gSaveContext.sceneFlags[globalCtx->sceneNum];
|
||||
savedSceneFlags = &gSaveContext.sceneFlags[globalCtx->sceneNum];
|
||||
|
||||
bzero(actorCtx, sizeof(*actorCtx));
|
||||
|
||||
|
@ -1967,10 +1967,10 @@ void func_800304DC(GlobalContext* globalCtx, ActorContext* actorCtx, ActorEntry*
|
|||
overlayEntry++;
|
||||
}
|
||||
|
||||
actorCtx->flags.chest = saveSceneFlags->chest;
|
||||
actorCtx->flags.swch = saveSceneFlags->swch;
|
||||
actorCtx->flags.clear = saveSceneFlags->clear;
|
||||
actorCtx->flags.collect = saveSceneFlags->collect;
|
||||
actorCtx->flags.chest = savedSceneFlags->chest;
|
||||
actorCtx->flags.swch = savedSceneFlags->swch;
|
||||
actorCtx->flags.clear = savedSceneFlags->clear;
|
||||
actorCtx->flags.collect = savedSceneFlags->collect;
|
||||
|
||||
func_8002CDE4(globalCtx, &actorCtx->titleCtx);
|
||||
|
||||
|
|
|
@ -199,7 +199,7 @@ void func_80110F68(GlobalContext* globalCtx) {
|
|||
__assert("message->fukidashiSegment != NULL", "../z_construct.c", 352);
|
||||
}
|
||||
|
||||
func_8006EF10(&globalCtx->msgCtx.unk_128);
|
||||
Font_LoadOrderedFont(&globalCtx->msgCtx.font);
|
||||
|
||||
YREG(31) = 0;
|
||||
}
|
||||
|
|
|
@ -2009,16 +2009,14 @@ void Cutscene_HandleEntranceTriggers(GlobalContext* globalCtx) {
|
|||
Flags_SetEventChkInf(entranceCutscene->flag);
|
||||
Cutscene_SetSegment(globalCtx, entranceCutscene->segAddr);
|
||||
gSaveContext.cutsceneTrigger = 2;
|
||||
gSaveContext.unk_13C7 = 0;
|
||||
gSaveContext.showTitleCard = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void Cutscene_HandleConditionalTriggers(GlobalContext* globalCtx) {
|
||||
s32 temp; // inline temp needed to match regalloc
|
||||
|
||||
osSyncPrintf("\ngame_info.mode=[%d] restart_flag", temp = gSaveContext.respawnFlag);
|
||||
osSyncPrintf("\ngame_info.mode=[%d] restart_flag", ((void)0, gSaveContext.respawnFlag));
|
||||
|
||||
if ((gSaveContext.gameMode == 0) && (gSaveContext.respawnFlag <= 0) && (gSaveContext.cutsceneIndex < 0xFFF0)) {
|
||||
if ((gSaveContext.entranceIndex == 0x01E1) && !Flags_GetEventChkInf(0xAC)) {
|
||||
|
@ -2037,12 +2035,12 @@ void Cutscene_HandleConditionalTriggers(GlobalContext* globalCtx) {
|
|||
gSaveContext.cutsceneIndex = 0xFFF0;
|
||||
} else if (CHECK_QUEST_ITEM(QUEST_MEDALLION_SPIRIT) && CHECK_QUEST_ITEM(QUEST_MEDALLION_SHADOW) &&
|
||||
LINK_IS_ADULT && !Flags_GetEventChkInf(0xC4) &&
|
||||
(gEntranceTable[temp = gSaveContext.entranceIndex].scene == SCENE_TOKINOMA)) {
|
||||
(gEntranceTable[((void)0, gSaveContext.entranceIndex)].scene == SCENE_TOKINOMA)) {
|
||||
Flags_SetEventChkInf(0xC4);
|
||||
gSaveContext.entranceIndex = 0x0053;
|
||||
gSaveContext.cutsceneIndex = 0xFFF8;
|
||||
} else if (!Flags_GetEventChkInf(0xC7) &&
|
||||
(gEntranceTable[temp = gSaveContext.entranceIndex].scene == SCENE_GANON_DEMO)) {
|
||||
(gEntranceTable[((void)0, gSaveContext.entranceIndex)].scene == SCENE_GANON_DEMO)) {
|
||||
Flags_SetEventChkInf(0xC7);
|
||||
gSaveContext.entranceIndex = 0x0517;
|
||||
gSaveContext.cutsceneIndex = 0xFFF0;
|
||||
|
|
|
@ -22,8 +22,8 @@ u32 ElfMessage_CheckCondition(ElfMessage* msg) {
|
|||
flag = 1 << (msg->byte1 & 0x0F);
|
||||
return ((msg->byte0 & 1) == 1) == ((flag & gSaveContext.eventChkInf[(msg->byte1 & 0xF0) >> 4]) != 0);
|
||||
case 2:
|
||||
return ((msg->byte0 & 1) == 1) ==
|
||||
((gSaveContext.dungeonItems[gSaveContext.mapIndex] & gBitFlags[msg->byte1 - ITEM_KEY_BOSS]) != 0);
|
||||
return ((msg->byte0 & 1) == 1) == ((gSaveContext.inventory.dungeonItems[gSaveContext.mapIndex] &
|
||||
gBitFlags[msg->byte1 - ITEM_KEY_BOSS]) != 0);
|
||||
case 4:
|
||||
return ((msg->byte0 & 1) == 1) == (msg->byte3 == INV_CONTENT(msg->byte1));
|
||||
case 6:
|
||||
|
@ -33,7 +33,7 @@ u32 ElfMessage_CheckCondition(ElfMessage* msg) {
|
|||
case 0x10:
|
||||
return ((msg->byte0 & 1) == 1) ==
|
||||
(((gBitFlags[msg->byte3 - ITEM_BOOTS_KOKIRI] << gEquipShifts[EQUIP_BOOTS]) &
|
||||
gSaveContext.equipment) != 0);
|
||||
gSaveContext.inventory.equipment) != 0);
|
||||
case 0x20:
|
||||
return ((msg->byte0 & 1) == 1) ==
|
||||
((CHECK_QUEST_ITEM(msg->byte3 - ITEM_SONG_MINUET + QUEST_SONG_MINUET)) != 0);
|
||||
|
|
|
@ -11,7 +11,9 @@ extern void KaleidoScope_Update(GlobalContext*);
|
|||
extern void KaleidoScope_Draw(GlobalContext*);
|
||||
|
||||
void KaleidoScopeCall_LoadPlayer() {
|
||||
if ((u32)gKaleidoMgrCurOvl != (u32)&gKaleidoMgrOverlayTable[KALEIDO_OVL_PLAYER_ACTOR]) {
|
||||
KaleidoManagerOvl* playerActorOvl = &gKaleidoMgrOverlayTable[KALEIDO_OVL_PLAYER_ACTOR];
|
||||
|
||||
if (gKaleidoMgrCurOvl != playerActorOvl) {
|
||||
if (gKaleidoMgrCurOvl) {
|
||||
osSyncPrintf(VT_FGCOL(GREEN));
|
||||
osSyncPrintf("カレイド領域 強制排除\n"); // Kaleido area forced exclusion
|
||||
|
@ -21,7 +23,7 @@ void KaleidoScopeCall_LoadPlayer() {
|
|||
osSyncPrintf(VT_FGCOL(GREEN));
|
||||
osSyncPrintf("プレイヤーアクター搬入\n"); // Player actor import
|
||||
osSyncPrintf(VT_RST);
|
||||
KaleidoManager_LoadOvl(&gKaleidoMgrOverlayTable[KALEIDO_OVL_PLAYER_ACTOR]);
|
||||
KaleidoManager_LoadOvl(playerActorOvl);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -44,13 +46,9 @@ void KaleidoScopeCall_Destroy(GlobalContext* globalCtx) {
|
|||
KaleidoSetup_Destroy(globalCtx);
|
||||
}
|
||||
|
||||
// regalloc
|
||||
#ifdef NON_MATCHING
|
||||
void KaleidoScopeCall_Update(GlobalContext* globalCtx) {
|
||||
s32 pad;
|
||||
PauseContext* pauseCtx;
|
||||
|
||||
pauseCtx = &globalCtx->pauseCtx;
|
||||
KaleidoManagerOvl* kaleidoScopeOvl = &gKaleidoMgrOverlayTable[KALEIDO_OVL_KALEIDO_SCOPE];
|
||||
PauseContext* pauseCtx = &globalCtx->pauseCtx;
|
||||
|
||||
if (pauseCtx->state != 0 || pauseCtx->flag != 0) {
|
||||
if (pauseCtx->state == 1) {
|
||||
|
@ -60,7 +58,7 @@ void KaleidoScopeCall_Update(GlobalContext* globalCtx) {
|
|||
R_PAUSE_MENU_MODE = 1;
|
||||
pauseCtx->unk_1E4 = 0;
|
||||
pauseCtx->unk_1EC = 0;
|
||||
pauseCtx->state++;
|
||||
pauseCtx->state = (pauseCtx->state & 0xFFFF) + 1;
|
||||
}
|
||||
} else if (pauseCtx->state == 8) {
|
||||
HREG(80) = 7;
|
||||
|
@ -68,15 +66,15 @@ void KaleidoScopeCall_Update(GlobalContext* globalCtx) {
|
|||
R_PAUSE_MENU_MODE = 1;
|
||||
pauseCtx->unk_1E4 = 0;
|
||||
pauseCtx->unk_1EC = 0;
|
||||
pauseCtx->state++;
|
||||
pauseCtx->state = (pauseCtx->state & 0xFFFF) + 1;
|
||||
} else if (pauseCtx->state == 2 || pauseCtx->state == 9) {
|
||||
osSyncPrintf("PR_KAREIDOSCOPE_MODE=%d\n", R_PAUSE_MENU_MODE);
|
||||
if (R_PAUSE_MENU_MODE >= 3) {
|
||||
pauseCtx->state++;
|
||||
}
|
||||
} else if (pauseCtx->state != 0) {
|
||||
if (&gKaleidoMgrOverlayTable[KALEIDO_OVL_KALEIDO_SCOPE] != gKaleidoMgrCurOvl) {
|
||||
if (gKaleidoMgrCurOvl) {
|
||||
if (gKaleidoMgrCurOvl != kaleidoScopeOvl) {
|
||||
if (gKaleidoMgrCurOvl != NULL) {
|
||||
osSyncPrintf(VT_FGCOL(GREEN));
|
||||
osSyncPrintf("カレイド領域 プレイヤー 強制排除\n"); // Kaleid Zone Player Forced Elimination
|
||||
osSyncPrintf(VT_RST);
|
||||
|
@ -85,32 +83,29 @@ void KaleidoScopeCall_Update(GlobalContext* globalCtx) {
|
|||
osSyncPrintf(VT_FGCOL(GREEN));
|
||||
osSyncPrintf("カレイド領域 カレイドスコープ搬入\n"); // Kaleid area Kaleidoscope loading
|
||||
osSyncPrintf(VT_RST);
|
||||
KaleidoManager_LoadOvl(&gKaleidoMgrOverlayTable[KALEIDO_OVL_KALEIDO_SCOPE]);
|
||||
KaleidoManager_LoadOvl(kaleidoScopeOvl);
|
||||
}
|
||||
if (&gKaleidoMgrOverlayTable[KALEIDO_OVL_KALEIDO_SCOPE] == gKaleidoMgrCurOvl) {
|
||||
|
||||
if (gKaleidoMgrCurOvl == kaleidoScopeOvl) {
|
||||
sKaleidoScopeUpdateFunc(globalCtx);
|
||||
if (globalCtx->pauseCtx.state == 0 && globalCtx->pauseCtx.flag == 0) {
|
||||
osSyncPrintf(VT_FGCOL(GREEN));
|
||||
osSyncPrintf("カレイド領域 カレイドスコープ排出\n"); // Kaleid area Kaleidoscope emission
|
||||
osSyncPrintf(VT_RST);
|
||||
KaleidoManager_ClearOvl(&gKaleidoMgrOverlayTable[KALEIDO_OVL_KALEIDO_SCOPE]);
|
||||
KaleidoManager_ClearOvl(kaleidoScopeOvl);
|
||||
KaleidoScopeCall_LoadPlayer();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
#else
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/code/z_kaleido_scope_call/KaleidoScopeCall_Update.s")
|
||||
#endif
|
||||
|
||||
void KaleidoScopeCall_Draw(GlobalContext* globalCtx) {
|
||||
KaleidoManagerOvl* kaleidoScopeOvl;
|
||||
KaleidoManagerOvl* kaleidoScopeOvl = &gKaleidoMgrOverlayTable[KALEIDO_OVL_KALEIDO_SCOPE];
|
||||
|
||||
if (R_PAUSE_MENU_MODE >= 3) {
|
||||
if ((globalCtx->pauseCtx.state >= 4 && globalCtx->pauseCtx.state < 8) ||
|
||||
(globalCtx->pauseCtx.state >= 11 && globalCtx->pauseCtx.state < 19)) {
|
||||
kaleidoScopeOvl = &gKaleidoMgrOverlayTable[KALEIDO_OVL_KALEIDO_SCOPE];
|
||||
if (gKaleidoMgrCurOvl == kaleidoScopeOvl) {
|
||||
sKaleidoScopeDrawFunc(globalCtx);
|
||||
}
|
||||
|
|
|
@ -141,6 +141,3 @@ void KaleidoSetup_Init(GlobalContext* globalCtx) {
|
|||
|
||||
void KaleidoSetup_Destroy(GlobalContext* globalCtx) {
|
||||
}
|
||||
|
||||
void func_8006EE50(UNK_PTR arg0, s16 arg1, s16 arg2) {
|
||||
}
|
||||
|
|
|
@ -1,7 +1,54 @@
|
|||
#include "global.h"
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/code/z_kanfont/func_8006EE60.s")
|
||||
// To be moved to message_data_static header
|
||||
#define MESSAGE_NEWLINE '\x01'
|
||||
#define MESSAGE_END '\x02'
|
||||
// message_data_static symbols
|
||||
extern const char D_07000000[]; // start of file
|
||||
extern const char D_070380D4[]; // charset message (id 0xFFFC)
|
||||
extern const char D_0703811C[]; // end marker of last message
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/code/z_kanfont/func_8006EEBC.s")
|
||||
void func_8006EE50(Font* font, s16 arg1, s16 arg2) {
|
||||
}
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/code/z_kanfont/func_8006EF10.s")
|
||||
void Font_LoadChar(u32 offset, u8 character, u16 codePointIndex) {
|
||||
DmaMgr_SendRequest1(((u32)offset + codePointIndex) + 8,
|
||||
&_nes_font_staticSegmentRomStart[character * FONT_CHAR_TEX_SIZE], FONT_CHAR_TEX_SIZE,
|
||||
"../z_kanfont.c", 93);
|
||||
}
|
||||
|
||||
void Font_LoadMessageBoxEndIcon(Font* font, u16 icon) {
|
||||
DmaMgr_SendRequest1(font->iconBuf, &_message_staticSegmentRomStart[4 * 0x1000 + icon * FONT_CHAR_TEX_SIZE],
|
||||
FONT_CHAR_TEX_SIZE, "../z_kanfont.c", 100);
|
||||
}
|
||||
|
||||
void Font_LoadOrderedFont(Font* font) {
|
||||
s32 len;
|
||||
s32 jj;
|
||||
s32 fontStatic;
|
||||
u32 fontBuf;
|
||||
s32 codePointIndex;
|
||||
s32 fontBufIndex;
|
||||
s32 offset;
|
||||
|
||||
font->msgOffset = D_070380D4 - D_07000000;
|
||||
len = font->msgLength = D_0703811C - D_070380D4;
|
||||
DmaMgr_SendRequest1(font->msgBuf, &_nes_message_data_staticSegmentRomStart[font->msgOffset], len,
|
||||
"../z_kanfont.c", 122);
|
||||
osSyncPrintf("msg_data=%x, msg_data0=%x jj=%x\n", font->msgOffset, font->msgLength, jj = len);
|
||||
len = jj;
|
||||
for (fontBufIndex = 0, codePointIndex = 0; font->msgBuf[codePointIndex] != MESSAGE_END; codePointIndex++) {
|
||||
if (codePointIndex > len) {
|
||||
osSyncPrintf("ERROR!! エラー!!! error───!!!!\n");
|
||||
return;
|
||||
}
|
||||
if (font->msgBuf[codePointIndex] != MESSAGE_NEWLINE) {
|
||||
fontBuf = font->fontBuf + fontBufIndex * 8;
|
||||
fontStatic = _nes_font_staticSegmentRomStart;
|
||||
osSyncPrintf("nes_mes_buf[%d]=%d\n", codePointIndex, font->msgBuf[codePointIndex]);
|
||||
offset = (font->msgBuf[codePointIndex] - '\x20') * FONT_CHAR_TEX_SIZE;
|
||||
DmaMgr_SendRequest1(fontBuf, fontStatic + offset, FONT_CHAR_TEX_SIZE, "../z_kanfont.c", 134);
|
||||
fontBufIndex += 0x10;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -77,7 +77,7 @@ void func_800775D8() {
|
|||
}
|
||||
|
||||
s32 func_800775E4() {
|
||||
return gSaveContext.unk_14;
|
||||
return gSaveContext.numDays;
|
||||
}
|
||||
|
||||
void func_800775F0(u16 arg0) {
|
||||
|
|
|
@ -204,7 +204,7 @@ void Health_Draw(GlobalContext* globalCtx) {
|
|||
f32 sp144 = interfaceCtx->unk_22A * 0.1f;
|
||||
s32 curCombineModeSet = 0;
|
||||
u8* curBgImgLoaded = NULL;
|
||||
s32 ddHeartCountMinusOne = gSaveContext.defenseHearts - 1;
|
||||
s32 ddHeartCountMinusOne = gSaveContext.inventory.defenseHearts - 1;
|
||||
|
||||
OPEN_DISPS(gfxCtx, "../z_lifemeter.c", 353);
|
||||
|
||||
|
|
|
@ -46,7 +46,7 @@ void Map_SetFloorPalettesData(GlobalContext* globalCtx, s16 floor) {
|
|||
interfaceCtx->unk_140[i + 16] = 0;
|
||||
}
|
||||
|
||||
if (gSaveContext.dungeonItems[mapIndex] & gBitFlags[DUNGEON_MAP]) {
|
||||
if (gSaveContext.inventory.dungeonItems[mapIndex] & gBitFlags[DUNGEON_MAP]) {
|
||||
interfaceCtx->unk_140[30] = 0;
|
||||
interfaceCtx->unk_140[31] = 1;
|
||||
}
|
||||
|
@ -383,7 +383,7 @@ void Minimap_Draw(GlobalContext* globalCtx) {
|
|||
gDPSetCombineLERP(oGfxCtx->overlay.p++, 1, 0, PRIMITIVE, 0, TEXEL0, 0, PRIMITIVE, 0, 1, 0,
|
||||
PRIMITIVE, 0, TEXEL0, 0, PRIMITIVE, 0);
|
||||
|
||||
if (gSaveContext.dungeonItems[mapIndex] & gBitFlags[DUNGEON_MAP]) {
|
||||
if (gSaveContext.inventory.dungeonItems[mapIndex] & gBitFlags[DUNGEON_MAP]) {
|
||||
gDPSetPrimColor(oGfxCtx->overlay.p++, 0, 0, 100, 255, 255, interfaceCtx->minimapAlpha);
|
||||
|
||||
gDPLoadTextureBlock_4b(oGfxCtx->overlay.p++, interfaceCtx->mapSegment, G_IM_FMT_I, 96, 85, 0,
|
||||
|
@ -395,7 +395,7 @@ void Minimap_Draw(GlobalContext* globalCtx) {
|
|||
0, 0, 1024, 1024);
|
||||
}
|
||||
|
||||
if (gSaveContext.dungeonItems[mapIndex] & gBitFlags[DUNGEON_COMPASS]) {
|
||||
if (gSaveContext.inventory.dungeonItems[mapIndex] & gBitFlags[DUNGEON_COMPASS]) {
|
||||
Minimap_DrawCompassIcons(globalCtx); // Draw icons for the player spawn and current position
|
||||
func_80094520(globalCtx->state.gfxCtx);
|
||||
MapMark_DrawConditionally(globalCtx);
|
||||
|
@ -525,7 +525,7 @@ void Map_Update(GlobalContext* globalCtx) {
|
|||
case SCENE_HAKADANCH:
|
||||
case SCENE_ICE_DOUKUTO:
|
||||
interfaceCtx->unk_140[30] = 0;
|
||||
if (gSaveContext.dungeonItems[mapIndex] & gBitFlags[DUNGEON_MAP]) {
|
||||
if (gSaveContext.inventory.dungeonItems[mapIndex] & gBitFlags[DUNGEON_MAP]) {
|
||||
interfaceCtx->unk_140[31] = 1;
|
||||
} else {
|
||||
interfaceCtx->unk_140[31] = 0;
|
||||
|
|
|
@ -636,7 +636,7 @@ void func_80083108(GlobalContext* globalCtx) {
|
|||
|
||||
Interface_LoadItemIcon1(globalCtx, 0);
|
||||
} else {
|
||||
if (gSaveContext.items[SLOT_BOW] == ITEM_NONE) {
|
||||
if (gSaveContext.inventory.items[SLOT_BOW] == ITEM_NONE) {
|
||||
gSaveContext.equips.buttonItems[0] = ITEM_NONE;
|
||||
} else {
|
||||
Interface_LoadItemIcon1(globalCtx, 0);
|
||||
|
@ -752,7 +752,7 @@ void func_80083108(GlobalContext* globalCtx) {
|
|||
if (player->stateFlags1 & 0x00800000) {
|
||||
if ((gSaveContext.equips.buttonItems[0] != ITEM_NONE) &&
|
||||
(gSaveContext.equips.buttonItems[0] != ITEM_BOW)) {
|
||||
if (gSaveContext.items[SLOT_BOW] == ITEM_NONE) {
|
||||
if (gSaveContext.inventory.items[SLOT_BOW] == ITEM_NONE) {
|
||||
gSaveContext.equips.buttonItems[0] = ITEM_NONE;
|
||||
} else {
|
||||
gSaveContext.equips.buttonItems[0] = ITEM_BOW;
|
||||
|
@ -1154,7 +1154,7 @@ void Inventory_SwapAgeEquipment(void) {
|
|||
if (gSaveContext.adultEquips.buttonItems[0] == ITEM_NONE) {
|
||||
gSaveContext.equips.buttonItems[0] = ITEM_SWORD_MASTER;
|
||||
|
||||
if (gSaveContext.items[SLOT_NUT] != ITEM_NONE) {
|
||||
if (gSaveContext.inventory.items[SLOT_NUT] != ITEM_NONE) {
|
||||
gSaveContext.equips.buttonItems[1] = ITEM_NUT;
|
||||
gSaveContext.equips.cButtonSlots[0] = SLOT_NUT;
|
||||
} else {
|
||||
|
@ -1162,7 +1162,7 @@ void Inventory_SwapAgeEquipment(void) {
|
|||
}
|
||||
|
||||
gSaveContext.equips.buttonItems[2] = ITEM_BOMB;
|
||||
gSaveContext.equips.buttonItems[3] = gSaveContext.items[SLOT_OCARINA];
|
||||
gSaveContext.equips.buttonItems[3] = gSaveContext.inventory.items[SLOT_OCARINA];
|
||||
gSaveContext.equips.cButtonSlots[1] = SLOT_BOMB;
|
||||
gSaveContext.equips.cButtonSlots[2] = SLOT_OCARINA;
|
||||
gSaveContext.equips.equipment = 0x1122;
|
||||
|
@ -1179,7 +1179,8 @@ void Inventory_SwapAgeEquipment(void) {
|
|||
((gSaveContext.equips.buttonItems[i] >= ITEM_WEIRD_EGG) &&
|
||||
(gSaveContext.equips.buttonItems[i] <= ITEM_CLAIM_CHECK))) {
|
||||
osSyncPrintf("Register_Item_Pt(%d)=%d\n", i, gSaveContext.equips.cButtonSlots[i - 1]);
|
||||
gSaveContext.equips.buttonItems[i] = gSaveContext.items[gSaveContext.equips.cButtonSlots[i - 1]];
|
||||
gSaveContext.equips.buttonItems[i] =
|
||||
gSaveContext.inventory.items[gSaveContext.equips.cButtonSlots[i - 1]];
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1209,7 +1210,8 @@ void Inventory_SwapAgeEquipment(void) {
|
|||
((gSaveContext.equips.buttonItems[i] >= ITEM_WEIRD_EGG) &&
|
||||
(gSaveContext.equips.buttonItems[i] <= ITEM_CLAIM_CHECK))) {
|
||||
osSyncPrintf("Register_Item_Pt(%d)=%d\n", i, gSaveContext.equips.cButtonSlots[i - 1]);
|
||||
gSaveContext.equips.buttonItems[i] = gSaveContext.items[gSaveContext.equips.cButtonSlots[i - 1]];
|
||||
gSaveContext.equips.buttonItems[i] =
|
||||
gSaveContext.inventory.items[gSaveContext.equips.cButtonSlots[i - 1]];
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1222,7 +1224,7 @@ void Inventory_SwapAgeEquipment(void) {
|
|||
temp = gEquipMasks[EQUIP_SHIELD] & gSaveContext.equips.equipment;
|
||||
if (temp != 0) {
|
||||
temp >>= gEquipShifts[EQUIP_SHIELD];
|
||||
if (!(gBitFlags[temp + 3] & gSaveContext.equipment)) {
|
||||
if (!(gBitFlags[temp + 3] & gSaveContext.inventory.equipment)) {
|
||||
gSaveContext.equips.equipment &= gEquipNegMasks[EQUIP_SHIELD];
|
||||
}
|
||||
}
|
||||
|
@ -1238,10 +1240,10 @@ void Interface_InitHorsebackArchery(GlobalContext* globalCtx) {
|
|||
}
|
||||
|
||||
void func_800849EC(GlobalContext* globalCtx) {
|
||||
gSaveContext.equipment |= gBitFlags[2] << gEquipShifts[EQUIP_SWORD];
|
||||
gSaveContext.equipment ^= 8 << gEquipShifts[EQUIP_SWORD];
|
||||
gSaveContext.inventory.equipment |= gBitFlags[2] << gEquipShifts[EQUIP_SWORD];
|
||||
gSaveContext.inventory.equipment ^= 8 << gEquipShifts[EQUIP_SWORD];
|
||||
|
||||
if (gBitFlags[3] & gSaveContext.equipment) {
|
||||
if (gBitFlags[3] & gSaveContext.inventory.equipment) {
|
||||
gSaveContext.equips.buttonItems[0] = ITEM_SWORD_KNIFE;
|
||||
} else {
|
||||
gSaveContext.equips.buttonItems[0] = ITEM_SWORD_BGS;
|
||||
|
@ -1318,15 +1320,15 @@ u8 Item_Give(GlobalContext* globalCtx, u8 item) {
|
|||
}
|
||||
|
||||
osSyncPrintf(VT_FGCOL(YELLOW));
|
||||
osSyncPrintf("item_get_setting=%d pt=%d z=%x\n", item, slot, gSaveContext.items[slot]);
|
||||
osSyncPrintf("item_get_setting=%d pt=%d z=%x\n", item, slot, gSaveContext.inventory.items[slot]);
|
||||
osSyncPrintf(VT_RST);
|
||||
|
||||
if ((item >= ITEM_MEDALLION_FOREST) && (item <= ITEM_MEDALLION_LIGHT)) {
|
||||
gSaveContext.questItems |= gBitFlags[item - ITEM_MEDALLION_FOREST + QUEST_MEDALLION_FOREST];
|
||||
gSaveContext.inventory.questItems |= gBitFlags[item - ITEM_MEDALLION_FOREST + QUEST_MEDALLION_FOREST];
|
||||
|
||||
osSyncPrintf(VT_FGCOL(YELLOW));
|
||||
// Translates to: "Seals = %x"
|
||||
osSyncPrintf("封印 = %x\n", gSaveContext.questItems);
|
||||
osSyncPrintf("封印 = %x\n", gSaveContext.inventory.questItems);
|
||||
osSyncPrintf(VT_RST);
|
||||
|
||||
if (item == ITEM_MEDALLION_WATER) {
|
||||
|
@ -1335,53 +1337,53 @@ u8 Item_Give(GlobalContext* globalCtx, u8 item) {
|
|||
|
||||
return ITEM_NONE;
|
||||
} else if ((item >= ITEM_SONG_MINUET) && (item <= ITEM_SONG_STORMS)) {
|
||||
gSaveContext.questItems |= gBitFlags[item - ITEM_SONG_MINUET + QUEST_SONG_MINUET];
|
||||
gSaveContext.inventory.questItems |= gBitFlags[item - ITEM_SONG_MINUET + QUEST_SONG_MINUET];
|
||||
|
||||
osSyncPrintf(VT_FGCOL(YELLOW));
|
||||
// Translates to: "Musical scores = %x"
|
||||
osSyncPrintf("楽譜 = %x\n", gSaveContext.questItems);
|
||||
osSyncPrintf("楽譜 = %x\n", gSaveContext.inventory.questItems);
|
||||
// Translates to: "Musical scores = %x (%x) (%x)"
|
||||
osSyncPrintf("楽譜 = %x (%x) (%x)\n", gSaveContext.questItems,
|
||||
osSyncPrintf("楽譜 = %x (%x) (%x)\n", gSaveContext.inventory.questItems,
|
||||
gBitFlags[item - ITEM_SONG_MINUET + QUEST_SONG_MINUET], gBitFlags[item - ITEM_SONG_MINUET]);
|
||||
osSyncPrintf(VT_RST);
|
||||
|
||||
return ITEM_NONE;
|
||||
} else if ((item >= ITEM_KOKIRI_EMERALD) && (item <= ITEM_ZORA_SAPPHIRE)) {
|
||||
gSaveContext.questItems |= gBitFlags[item - ITEM_KOKIRI_EMERALD + QUEST_KOKIRI_EMERALD];
|
||||
gSaveContext.inventory.questItems |= gBitFlags[item - ITEM_KOKIRI_EMERALD + QUEST_KOKIRI_EMERALD];
|
||||
|
||||
osSyncPrintf(VT_FGCOL(YELLOW));
|
||||
// Translates to: "Spiritual Stones = %x"
|
||||
osSyncPrintf("精霊石 = %x\n", gSaveContext.questItems);
|
||||
osSyncPrintf("精霊石 = %x\n", gSaveContext.inventory.questItems);
|
||||
osSyncPrintf(VT_RST);
|
||||
|
||||
return ITEM_NONE;
|
||||
} else if ((item == ITEM_STONE_OF_AGONY) || (item == ITEM_GERUDO_CARD)) {
|
||||
gSaveContext.questItems |= gBitFlags[item - ITEM_STONE_OF_AGONY + QUEST_STONE_OF_AGONY];
|
||||
gSaveContext.inventory.questItems |= gBitFlags[item - ITEM_STONE_OF_AGONY + QUEST_STONE_OF_AGONY];
|
||||
|
||||
osSyncPrintf(VT_FGCOL(YELLOW));
|
||||
// Translates to: "Items = %x"
|
||||
osSyncPrintf("アイテム = %x\n", gSaveContext.questItems);
|
||||
osSyncPrintf("アイテム = %x\n", gSaveContext.inventory.questItems);
|
||||
osSyncPrintf(VT_RST);
|
||||
|
||||
return ITEM_NONE;
|
||||
} else if (item == ITEM_SKULL_TOKEN) {
|
||||
gSaveContext.questItems |= gBitFlags[item - ITEM_SKULL_TOKEN + QUEST_SKULL_TOKEN];
|
||||
gSaveContext.gsTokens++;
|
||||
gSaveContext.inventory.questItems |= gBitFlags[item - ITEM_SKULL_TOKEN + QUEST_SKULL_TOKEN];
|
||||
gSaveContext.inventory.gsTokens++;
|
||||
|
||||
osSyncPrintf(VT_FGCOL(YELLOW));
|
||||
// Translates to: "N Coins = %x(%d)"
|
||||
osSyncPrintf("Nコイン = %x(%d)\n", gSaveContext.questItems, gSaveContext.gsTokens);
|
||||
osSyncPrintf("Nコイン = %x(%d)\n", gSaveContext.inventory.questItems, gSaveContext.inventory.gsTokens);
|
||||
osSyncPrintf(VT_RST);
|
||||
|
||||
return ITEM_NONE;
|
||||
} else if ((item >= ITEM_SWORD_KOKIRI) && (item <= ITEM_SWORD_BGS)) {
|
||||
gSaveContext.equipment |= gBitFlags[item - ITEM_SWORD_KOKIRI] << gEquipShifts[EQUIP_SWORD];
|
||||
gSaveContext.inventory.equipment |= gBitFlags[item - ITEM_SWORD_KOKIRI] << gEquipShifts[EQUIP_SWORD];
|
||||
|
||||
if (item == ITEM_SWORD_BGS) {
|
||||
gSaveContext.swordHealth = 8;
|
||||
|
||||
if (ALL_EQUIP_VALUE(EQUIP_SWORD) == 0xF) {
|
||||
gSaveContext.equipment ^= 8 << gEquipShifts[EQUIP_SWORD];
|
||||
gSaveContext.inventory.equipment ^= 8 << gEquipShifts[EQUIP_SWORD];
|
||||
if (gSaveContext.equips.buttonItems[0] == ITEM_SWORD_KNIFE) {
|
||||
gSaveContext.equips.buttonItems[0] = ITEM_SWORD_BGS;
|
||||
Interface_LoadItemIcon1(globalCtx, 0);
|
||||
|
@ -1396,23 +1398,23 @@ u8 Item_Give(GlobalContext* globalCtx, u8 item) {
|
|||
|
||||
return ITEM_NONE;
|
||||
} else if ((item >= ITEM_SHIELD_DEKU) && (item <= ITEM_SHIELD_MIRROR)) {
|
||||
gSaveContext.equipment |= (gBitFlags[item - ITEM_SHIELD_DEKU] << gEquipShifts[EQUIP_SHIELD]);
|
||||
gSaveContext.inventory.equipment |= (gBitFlags[item - ITEM_SHIELD_DEKU] << gEquipShifts[EQUIP_SHIELD]);
|
||||
return ITEM_NONE;
|
||||
} else if ((item >= ITEM_TUNIC_KOKIRI) && (item <= ITEM_TUNIC_ZORA)) {
|
||||
gSaveContext.equipment |= (gBitFlags[item - ITEM_TUNIC_KOKIRI] << gEquipShifts[EQUIP_TUNIC]);
|
||||
gSaveContext.inventory.equipment |= (gBitFlags[item - ITEM_TUNIC_KOKIRI] << gEquipShifts[EQUIP_TUNIC]);
|
||||
return ITEM_NONE;
|
||||
} else if ((item >= ITEM_BOOTS_KOKIRI) && (item <= ITEM_BOOTS_HOVER)) {
|
||||
gSaveContext.equipment |= (gBitFlags[item - ITEM_BOOTS_KOKIRI] << gEquipShifts[EQUIP_BOOTS]);
|
||||
gSaveContext.inventory.equipment |= (gBitFlags[item - ITEM_BOOTS_KOKIRI] << gEquipShifts[EQUIP_BOOTS]);
|
||||
return ITEM_NONE;
|
||||
} else if ((item == ITEM_KEY_BOSS) || (item == ITEM_COMPASS) || (item == ITEM_DUNGEON_MAP)) {
|
||||
gSaveContext.dungeonItems[gSaveContext.mapIndex] |= gBitFlags[item - ITEM_KEY_BOSS];
|
||||
gSaveContext.inventory.dungeonItems[gSaveContext.mapIndex] |= gBitFlags[item - ITEM_KEY_BOSS];
|
||||
return ITEM_NONE;
|
||||
} else if (item == ITEM_KEY_SMALL) {
|
||||
if (gSaveContext.dungeonKeys[gSaveContext.mapIndex] < 0) {
|
||||
gSaveContext.dungeonKeys[gSaveContext.mapIndex] = 1;
|
||||
if (gSaveContext.inventory.dungeonKeys[gSaveContext.mapIndex] < 0) {
|
||||
gSaveContext.inventory.dungeonKeys[gSaveContext.mapIndex] = 1;
|
||||
return ITEM_NONE;
|
||||
} else {
|
||||
gSaveContext.dungeonKeys[gSaveContext.mapIndex]++;
|
||||
gSaveContext.inventory.dungeonKeys[gSaveContext.mapIndex]++;
|
||||
return ITEM_NONE;
|
||||
}
|
||||
} else if ((item == ITEM_QUIVER_30) || (item == ITEM_BOW)) {
|
||||
|
@ -1485,28 +1487,28 @@ u8 Item_Give(GlobalContext* globalCtx, u8 item) {
|
|||
Inventory_ChangeUpgrade(UPG_WALLET, 2);
|
||||
return ITEM_NONE;
|
||||
} else if (item == ITEM_STICK_UPGRADE_20) {
|
||||
if (gSaveContext.items[slot] == ITEM_NONE) {
|
||||
if (gSaveContext.inventory.items[slot] == ITEM_NONE) {
|
||||
INV_CONTENT(ITEM_STICK) = ITEM_STICK;
|
||||
}
|
||||
Inventory_ChangeUpgrade(UPG_STICKS, 2);
|
||||
AMMO(ITEM_STICK) = CAPACITY(UPG_STICKS, 2);
|
||||
return ITEM_NONE;
|
||||
} else if (item == ITEM_STICK_UPGRADE_30) {
|
||||
if (gSaveContext.items[slot] == ITEM_NONE) {
|
||||
if (gSaveContext.inventory.items[slot] == ITEM_NONE) {
|
||||
INV_CONTENT(ITEM_STICK) = ITEM_STICK;
|
||||
}
|
||||
Inventory_ChangeUpgrade(UPG_STICKS, 3);
|
||||
AMMO(ITEM_STICK) = CAPACITY(UPG_STICKS, 3);
|
||||
return ITEM_NONE;
|
||||
} else if (item == ITEM_NUT_UPGRADE_30) {
|
||||
if (gSaveContext.items[slot] == ITEM_NONE) {
|
||||
if (gSaveContext.inventory.items[slot] == ITEM_NONE) {
|
||||
INV_CONTENT(ITEM_NUT) = ITEM_NUT;
|
||||
}
|
||||
Inventory_ChangeUpgrade(UPG_NUTS, 2);
|
||||
AMMO(ITEM_NUT) = CAPACITY(UPG_NUTS, 2);
|
||||
return ITEM_NONE;
|
||||
} else if (item == ITEM_NUT_UPGRADE_40) {
|
||||
if (gSaveContext.items[slot] == ITEM_NONE) {
|
||||
if (gSaveContext.inventory.items[slot] == ITEM_NONE) {
|
||||
INV_CONTENT(ITEM_NUT) = ITEM_NUT;
|
||||
}
|
||||
Inventory_ChangeUpgrade(UPG_NUTS, 3);
|
||||
|
@ -1522,7 +1524,7 @@ u8 Item_Give(GlobalContext* globalCtx, u8 item) {
|
|||
}
|
||||
return ITEM_NONE;
|
||||
} else if (item == ITEM_STICK) {
|
||||
if (gSaveContext.items[slot] == ITEM_NONE) {
|
||||
if (gSaveContext.inventory.items[slot] == ITEM_NONE) {
|
||||
Inventory_ChangeUpgrade(UPG_STICKS, 1);
|
||||
AMMO(ITEM_STICK) = 1;
|
||||
} else {
|
||||
|
@ -1532,7 +1534,7 @@ u8 Item_Give(GlobalContext* globalCtx, u8 item) {
|
|||
}
|
||||
}
|
||||
} else if ((item == ITEM_STICKS_5) || (item == ITEM_STICKS_10)) {
|
||||
if (gSaveContext.items[slot] == ITEM_NONE) {
|
||||
if (gSaveContext.inventory.items[slot] == ITEM_NONE) {
|
||||
Inventory_ChangeUpgrade(UPG_STICKS, 1);
|
||||
AMMO(ITEM_STICK) = sAmmoRefillCounts[item - ITEM_STICKS_5];
|
||||
} else {
|
||||
|
@ -1543,7 +1545,7 @@ u8 Item_Give(GlobalContext* globalCtx, u8 item) {
|
|||
}
|
||||
item = ITEM_STICK;
|
||||
} else if (item == ITEM_NUT) {
|
||||
if (gSaveContext.items[slot] == ITEM_NONE) {
|
||||
if (gSaveContext.inventory.items[slot] == ITEM_NONE) {
|
||||
Inventory_ChangeUpgrade(UPG_NUTS, 1);
|
||||
AMMO(ITEM_NUT) = ITEM_NUT;
|
||||
} else {
|
||||
|
@ -1553,7 +1555,7 @@ u8 Item_Give(GlobalContext* globalCtx, u8 item) {
|
|||
}
|
||||
}
|
||||
} else if ((item == ITEM_NUTS_5) || (item == ITEM_NUTS_10)) {
|
||||
if (gSaveContext.items[slot] == ITEM_NONE) {
|
||||
if (gSaveContext.inventory.items[slot] == ITEM_NONE) {
|
||||
Inventory_ChangeUpgrade(UPG_NUTS, 1);
|
||||
AMMO(ITEM_NUT) += sAmmoRefillCounts[item - ITEM_NUTS_5];
|
||||
// Translates to: "Deku Nuts %d(%d)=%d BS_count=%d"
|
||||
|
@ -1583,7 +1585,7 @@ u8 Item_Give(GlobalContext* globalCtx, u8 item) {
|
|||
}
|
||||
return ITEM_NONE;
|
||||
} else if (item == ITEM_BOMBCHU) {
|
||||
if (gSaveContext.items[slot] == ITEM_NONE) {
|
||||
if (gSaveContext.inventory.items[slot] == ITEM_NONE) {
|
||||
INV_CONTENT(ITEM_BOMBCHU) = ITEM_BOMBCHU;
|
||||
AMMO(ITEM_BOMBCHU) = 10;
|
||||
return ITEM_NONE;
|
||||
|
@ -1595,7 +1597,7 @@ u8 Item_Give(GlobalContext* globalCtx, u8 item) {
|
|||
return ITEM_NONE;
|
||||
}
|
||||
} else if ((item == ITEM_BOMBCHUS_5) || (item == ITEM_BOMBCHUS_20)) {
|
||||
if (gSaveContext.items[slot] == ITEM_NONE) {
|
||||
if (gSaveContext.inventory.items[slot] == ITEM_NONE) {
|
||||
INV_CONTENT(ITEM_BOMBCHU) = ITEM_BOMBCHU;
|
||||
AMMO(ITEM_BOMBCHU) += sAmmoRefillCounts[item - ITEM_BOMBCHUS_5 + 8];
|
||||
return ITEM_NONE;
|
||||
|
@ -1660,7 +1662,7 @@ u8 Item_Give(GlobalContext* globalCtx, u8 item) {
|
|||
}
|
||||
return ITEM_NONE;
|
||||
} else if (item == ITEM_BEAN) {
|
||||
if (gSaveContext.items[slot] == ITEM_NONE) {
|
||||
if (gSaveContext.inventory.items[slot] == ITEM_NONE) {
|
||||
INV_CONTENT(item) = item;
|
||||
AMMO(ITEM_BEAN) = 1;
|
||||
BEANS_BOUGHT = 1;
|
||||
|
@ -1670,7 +1672,7 @@ u8 Item_Give(GlobalContext* globalCtx, u8 item) {
|
|||
}
|
||||
return ITEM_NONE;
|
||||
} else if ((item == ITEM_HEART_PIECE_2) || (item == ITEM_HEART_PIECE)) {
|
||||
gSaveContext.questItems += 1 << (QUEST_HEART_PIECE + 4);
|
||||
gSaveContext.inventory.questItems += 1 << (QUEST_HEART_PIECE + 4);
|
||||
return ITEM_NONE;
|
||||
} else if (item == ITEM_HEART_CONTAINER) {
|
||||
gSaveContext.healthCapacity += 0x10;
|
||||
|
@ -1712,8 +1714,8 @@ u8 Item_Give(GlobalContext* globalCtx, u8 item) {
|
|||
return ITEM_NONE;
|
||||
} else if (item == ITEM_BOTTLE) {
|
||||
for (i = 0; i < 4; i++) {
|
||||
if (gSaveContext.items[SLOT(item) + i] == ITEM_NONE) {
|
||||
gSaveContext.items[SLOT(item) + i] = item;
|
||||
if (gSaveContext.inventory.items[SLOT(item) + i] == ITEM_NONE) {
|
||||
gSaveContext.inventory.items[SLOT(item) + i] = item;
|
||||
return ITEM_NONE;
|
||||
}
|
||||
}
|
||||
|
@ -1727,7 +1729,7 @@ u8 Item_Give(GlobalContext* globalCtx, u8 item) {
|
|||
}
|
||||
|
||||
for (i = 0; i < 4; i++) {
|
||||
if (gSaveContext.items[bottleSlot + i] == ITEM_BOTTLE) {
|
||||
if (gSaveContext.inventory.items[bottleSlot + i] == ITEM_BOTTLE) {
|
||||
// Translates to: "Item_Pt(1)=%d Item_Pt(2)=%d Item_Pt(3)=%d Empty Bottle=%d Content=%d"
|
||||
osSyncPrintf("Item_Pt(1)=%d Item_Pt(2)=%d Item_Pt(3)=%d 空瓶=%d 中味=%d\n",
|
||||
gSaveContext.equips.cButtonSlots[0], gSaveContext.equips.cButtonSlots[1],
|
||||
|
@ -1747,14 +1749,14 @@ u8 Item_Give(GlobalContext* globalCtx, u8 item) {
|
|||
gSaveContext.buttonStatus[3] = BTN_ENABLED;
|
||||
}
|
||||
|
||||
gSaveContext.items[bottleSlot + i] = item;
|
||||
gSaveContext.inventory.items[bottleSlot + i] = item;
|
||||
return ITEM_NONE;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
for (i = 0; i < 4; i++) {
|
||||
if (gSaveContext.items[bottleSlot + i] == ITEM_NONE) {
|
||||
gSaveContext.items[bottleSlot + i] = item;
|
||||
if (gSaveContext.inventory.items[bottleSlot + i] == ITEM_NONE) {
|
||||
gSaveContext.inventory.items[bottleSlot + i] = item;
|
||||
return ITEM_NONE;
|
||||
}
|
||||
}
|
||||
|
@ -1784,7 +1786,7 @@ u8 Item_Give(GlobalContext* globalCtx, u8 item) {
|
|||
return ITEM_NONE;
|
||||
}
|
||||
|
||||
oldItem = gSaveContext.items[slot];
|
||||
oldItem = gSaveContext.inventory.items[slot];
|
||||
osSyncPrintf("Item_Register(%d)=%d %d\n", slot, item, oldItem);
|
||||
INV_CONTENT(item) = item;
|
||||
|
||||
|
@ -1805,7 +1807,7 @@ u8 Item_CheckObtainability(u8 item) {
|
|||
}
|
||||
|
||||
osSyncPrintf(VT_FGCOL(GREEN));
|
||||
osSyncPrintf("item_get_non_setting=%d pt=%d z=%x\n", item, slot, gSaveContext.items[slot]);
|
||||
osSyncPrintf("item_get_non_setting=%d pt=%d z=%x\n", item, slot, gSaveContext.inventory.items[slot]);
|
||||
osSyncPrintf(VT_RST);
|
||||
|
||||
if ((item >= ITEM_MEDALLION_FOREST) && (item <= ITEM_MEDALLION_LIGHT)) {
|
||||
|
@ -1815,25 +1817,26 @@ u8 Item_CheckObtainability(u8 item) {
|
|||
} else if ((item >= ITEM_SWORD_KOKIRI) && (item <= ITEM_SWORD_BGS)) {
|
||||
if (item == ITEM_SWORD_BGS) {
|
||||
return ITEM_NONE;
|
||||
} else if ((gBitFlags[item - ITEM_SWORD_KOKIRI] << gEquipShifts[EQUIP_SWORD]) & gSaveContext.equipment) {
|
||||
} else if ((gBitFlags[item - ITEM_SWORD_KOKIRI] << gEquipShifts[EQUIP_SWORD]) &
|
||||
gSaveContext.inventory.equipment) {
|
||||
return item;
|
||||
} else {
|
||||
return ITEM_NONE;
|
||||
}
|
||||
} else if ((item >= ITEM_SHIELD_DEKU) && (item <= ITEM_SHIELD_MIRROR)) {
|
||||
if ((gBitFlags[item - ITEM_SHIELD_DEKU] << gEquipShifts[EQUIP_SHIELD]) & gSaveContext.equipment) {
|
||||
if ((gBitFlags[item - ITEM_SHIELD_DEKU] << gEquipShifts[EQUIP_SHIELD]) & gSaveContext.inventory.equipment) {
|
||||
return item;
|
||||
} else {
|
||||
return ITEM_NONE;
|
||||
}
|
||||
} else if ((item >= ITEM_TUNIC_KOKIRI) && (item <= ITEM_TUNIC_ZORA)) {
|
||||
if ((gBitFlags[item - ITEM_TUNIC_KOKIRI] << gEquipShifts[EQUIP_TUNIC]) & gSaveContext.equipment) {
|
||||
if ((gBitFlags[item - ITEM_TUNIC_KOKIRI] << gEquipShifts[EQUIP_TUNIC]) & gSaveContext.inventory.equipment) {
|
||||
return item;
|
||||
} else {
|
||||
return ITEM_NONE;
|
||||
}
|
||||
} else if ((item >= ITEM_BOOTS_KOKIRI) && (item <= ITEM_BOOTS_HOVER)) {
|
||||
if ((gBitFlags[item - ITEM_BOOTS_KOKIRI] << gEquipShifts[EQUIP_BOOTS]) & gSaveContext.equipment) {
|
||||
if ((gBitFlags[item - ITEM_BOOTS_KOKIRI] << gEquipShifts[EQUIP_BOOTS]) & gSaveContext.inventory.equipment) {
|
||||
return item;
|
||||
} else {
|
||||
return ITEM_NONE;
|
||||
|
@ -1904,13 +1907,13 @@ u8 Item_CheckObtainability(u8 item) {
|
|||
}
|
||||
|
||||
for (i = 0; i < 4; i++) {
|
||||
if (gSaveContext.items[bottleSlot + i] == ITEM_BOTTLE) {
|
||||
if (gSaveContext.inventory.items[bottleSlot + i] == ITEM_BOTTLE) {
|
||||
return ITEM_NONE;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
for (i = 0; i < 4; i++) {
|
||||
if (gSaveContext.items[bottleSlot + i] == ITEM_NONE) {
|
||||
if (gSaveContext.inventory.items[bottleSlot + i] == ITEM_NONE) {
|
||||
return ITEM_NONE;
|
||||
}
|
||||
}
|
||||
|
@ -1919,7 +1922,7 @@ u8 Item_CheckObtainability(u8 item) {
|
|||
return ITEM_NONE;
|
||||
}
|
||||
|
||||
return gSaveContext.items[slot];
|
||||
return gSaveContext.inventory.items[slot];
|
||||
}
|
||||
|
||||
void Inventory_DeleteItem(u16 item, u16 invSlot) {
|
||||
|
@ -1929,9 +1932,9 @@ void Inventory_DeleteItem(u16 item, u16 invSlot) {
|
|||
BEANS_BOUGHT = 0;
|
||||
}
|
||||
|
||||
gSaveContext.items[invSlot] = ITEM_NONE;
|
||||
gSaveContext.inventory.items[invSlot] = ITEM_NONE;
|
||||
|
||||
osSyncPrintf("\nItem_Register(%d)\n", invSlot, gSaveContext.items[invSlot]);
|
||||
osSyncPrintf("\nItem_Register(%d)\n", invSlot, gSaveContext.inventory.items[invSlot]);
|
||||
|
||||
for (i = 1; i < 4; i++) {
|
||||
if (gSaveContext.equips.buttonItems[i] == item) {
|
||||
|
@ -1944,9 +1947,9 @@ void Inventory_DeleteItem(u16 item, u16 invSlot) {
|
|||
s32 Inventory_ReplaceItem(GlobalContext* globalCtx, u16 oldItem, u16 newItem) {
|
||||
s16 i;
|
||||
|
||||
for (i = 0; i < ARRAY_COUNT(gSaveContext.items); i++) {
|
||||
if (gSaveContext.items[i] == oldItem) {
|
||||
gSaveContext.items[i] = newItem;
|
||||
for (i = 0; i < ARRAY_COUNT(gSaveContext.inventory.items); i++) {
|
||||
if (gSaveContext.inventory.items[i] == oldItem) {
|
||||
gSaveContext.inventory.items[i] = newItem;
|
||||
// Translates to: "Item Purge (%d)"
|
||||
osSyncPrintf("アイテム消去(%d)\n", i);
|
||||
for (i = 1; i < 4; i++) {
|
||||
|
@ -1964,7 +1967,7 @@ s32 Inventory_ReplaceItem(GlobalContext* globalCtx, u16 oldItem, u16 newItem) {
|
|||
}
|
||||
|
||||
s32 Inventory_HasEmptyBottle(void) {
|
||||
u8* items = gSaveContext.items;
|
||||
u8* items = gSaveContext.inventory.items;
|
||||
|
||||
if (items[SLOT_BOTTLE_1] == ITEM_BOTTLE) {
|
||||
return 1;
|
||||
|
@ -1980,7 +1983,7 @@ s32 Inventory_HasEmptyBottle(void) {
|
|||
}
|
||||
|
||||
s32 Inventory_HasSpecificBottle(u8 bottleItem) {
|
||||
u8* items = gSaveContext.items;
|
||||
u8* items = gSaveContext.inventory.items;
|
||||
|
||||
if (items[SLOT_BOTTLE_1] == bottleItem) {
|
||||
return 1;
|
||||
|
@ -1998,15 +2001,15 @@ s32 Inventory_HasSpecificBottle(u8 bottleItem) {
|
|||
void Inventory_UpdateBottleItem(GlobalContext* globalCtx, u8 item, u8 button) {
|
||||
osSyncPrintf("item_no=%x, c_no=%x, Pt=%x Item_Register=%x\n", item, button,
|
||||
gSaveContext.equips.cButtonSlots[button - 1],
|
||||
gSaveContext.items[gSaveContext.equips.cButtonSlots[button - 1]]);
|
||||
gSaveContext.inventory.items[gSaveContext.equips.cButtonSlots[button - 1]]);
|
||||
|
||||
// Special case to only empty half of a Lon Lon Milk Bottle
|
||||
if ((gSaveContext.items[gSaveContext.equips.cButtonSlots[button - 1]] == ITEM_MILK_BOTTLE) &&
|
||||
if ((gSaveContext.inventory.items[gSaveContext.equips.cButtonSlots[button - 1]] == ITEM_MILK_BOTTLE) &&
|
||||
(item == ITEM_BOTTLE)) {
|
||||
item = ITEM_MILK_HALF;
|
||||
}
|
||||
|
||||
gSaveContext.items[gSaveContext.equips.cButtonSlots[button - 1]] = item;
|
||||
gSaveContext.inventory.items[gSaveContext.equips.cButtonSlots[button - 1]] = item;
|
||||
gSaveContext.equips.buttonItems[button] = item;
|
||||
|
||||
Interface_LoadItemIcon1(globalCtx, button);
|
||||
|
@ -2023,7 +2026,7 @@ s32 Inventory_ConsumeFairy(GlobalContext* globalCtx) {
|
|||
bottleSlot = SLOT(ITEM_FAIRY);
|
||||
|
||||
for (i = 0; i < 4; i++) {
|
||||
if (gSaveContext.items[bottleSlot + i] == ITEM_FAIRY) {
|
||||
if (gSaveContext.inventory.items[bottleSlot + i] == ITEM_FAIRY) {
|
||||
for (j = 1; j < 4; j++) {
|
||||
if (gSaveContext.equips.buttonItems[j] == ITEM_FAIRY) {
|
||||
gSaveContext.equips.buttonItems[j] = ITEM_BOTTLE;
|
||||
|
@ -2035,7 +2038,7 @@ s32 Inventory_ConsumeFairy(GlobalContext* globalCtx) {
|
|||
}
|
||||
// Translates to: "Fairy Usage=%d"
|
||||
osSyncPrintf("妖精使用=%d\n", bottleSlot);
|
||||
gSaveContext.items[bottleSlot + i] = ITEM_BOTTLE;
|
||||
gSaveContext.inventory.items[bottleSlot + i] = ITEM_BOTTLE;
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
@ -2353,8 +2356,6 @@ s32 func_80087708(GlobalContext* globalCtx, s16 arg1, s16 arg2) {
|
|||
return 0;
|
||||
}
|
||||
|
||||
#ifdef NON_MATCHING
|
||||
// this function still needs some work
|
||||
void Interface_UpdateMagicBar(GlobalContext* globalCtx) {
|
||||
static s16 sMagicBorderColors[][3] = {
|
||||
{ 0xFF, 0xFF, 0xFF },
|
||||
|
@ -2365,28 +2366,33 @@ void Interface_UpdateMagicBar(GlobalContext* globalCtx) {
|
|||
static s16 sMagicBorderIndexes[] = { 0, 1, 1, 0 };
|
||||
static s16 sMagicBorderRatio = 2;
|
||||
static s16 sMagicBorderStep = 1;
|
||||
s16* color;
|
||||
s16 maxMagic;
|
||||
MessageContext* msgCtx = &globalCtx->msgCtx;
|
||||
InterfaceContext* interfaceCtx = &globalCtx->interfaceCtx;
|
||||
s16 borderChangeR;
|
||||
s16 borderChangeG;
|
||||
s16 borderChangeB;
|
||||
s16 temp;
|
||||
|
||||
switch (gSaveContext.unk_13F0) {
|
||||
case 8:
|
||||
maxMagic = gSaveContext.magicLevel * 0x30;
|
||||
if (gSaveContext.unk_13F4 != maxMagic) {
|
||||
if (gSaveContext.unk_13F4 < maxMagic) {
|
||||
temp = gSaveContext.magicLevel * 0x30;
|
||||
if (gSaveContext.unk_13F4 != temp) {
|
||||
if (gSaveContext.unk_13F4 < temp) {
|
||||
gSaveContext.unk_13F4 += 8;
|
||||
if (gSaveContext.unk_13F4 > maxMagic) {
|
||||
gSaveContext.unk_13F4 = maxMagic;
|
||||
if (gSaveContext.unk_13F4 > temp) {
|
||||
gSaveContext.unk_13F4 = temp;
|
||||
}
|
||||
} else {
|
||||
gSaveContext.unk_13F4 -= 8;
|
||||
if (gSaveContext.unk_13F4 <= maxMagic) {
|
||||
gSaveContext.unk_13F4 = maxMagic;
|
||||
if (gSaveContext.unk_13F4 <= temp) {
|
||||
gSaveContext.unk_13F4 = temp;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
gSaveContext.unk_13F0 = 9;
|
||||
}
|
||||
break;
|
||||
|
||||
case 9:
|
||||
gSaveContext.magic += 4;
|
||||
|
||||
|
@ -2395,60 +2401,61 @@ void Interface_UpdateMagicBar(GlobalContext* globalCtx) {
|
|||
&D_801333E8);
|
||||
}
|
||||
|
||||
// Translates to: "Storage MAGIC_NOW=%d (%d)"
|
||||
osSyncPrintf("蓄電 MAGIC_NOW=%d (%d)\n", gSaveContext.magic, gSaveContext.unk_13F6);
|
||||
// Translates to: "Storage MAGIC_NOW=%d (%d)"
|
||||
osSyncPrintf("蓄電 MAGIC_NOW=%d (%d)\n", gSaveContext.magic, gSaveContext.unk_13F6);
|
||||
if (gSaveContext.magic >= gSaveContext.unk_13F6) {
|
||||
gSaveContext.magic = gSaveContext.unk_13F6;
|
||||
gSaveContext.unk_13F0 = gSaveContext.unk_13F2;
|
||||
gSaveContext.unk_13F2 = 0;
|
||||
}
|
||||
break;
|
||||
|
||||
case 1:
|
||||
sMagicBorderRatio = 2;
|
||||
gSaveContext.unk_13F0 = 2;
|
||||
break;
|
||||
|
||||
case 2:
|
||||
gSaveContext.magic -= 2;
|
||||
if (gSaveContext.magic <= 0) {
|
||||
gSaveContext.magic = 0;
|
||||
gSaveContext.unk_13F0 = 3;
|
||||
sMagicBorderB = 255;
|
||||
sMagicBorderG = 255;
|
||||
sMagicBorderR = 255;
|
||||
sMagicBorderR = sMagicBorderG = sMagicBorderB = 255;
|
||||
} else if (gSaveContext.magic == gSaveContext.unk_13F8) {
|
||||
gSaveContext.unk_13F0 = 3;
|
||||
sMagicBorderB = 255;
|
||||
sMagicBorderG = 255;
|
||||
sMagicBorderR = 255;
|
||||
sMagicBorderR = sMagicBorderG = sMagicBorderB = 255;
|
||||
}
|
||||
case 3:
|
||||
case 4:
|
||||
case 6:
|
||||
color = sMagicBorderColors[sMagicBorderIndexes[sMagicBorderStep]];
|
||||
temp = sMagicBorderIndexes[sMagicBorderStep];
|
||||
borderChangeR = ABS(sMagicBorderR - sMagicBorderColors[temp][0]) / sMagicBorderRatio;
|
||||
borderChangeG = ABS(sMagicBorderG - sMagicBorderColors[temp][1]) / sMagicBorderRatio;
|
||||
borderChangeB = ABS(sMagicBorderB - sMagicBorderColors[temp][2]) / sMagicBorderRatio;
|
||||
|
||||
if (sMagicBorderR >= color[0]) {
|
||||
sMagicBorderR -= ABS(sMagicBorderR - color[0]) / sMagicBorderRatio;
|
||||
if (sMagicBorderR >= sMagicBorderColors[temp][0]) {
|
||||
sMagicBorderR -= borderChangeR;
|
||||
} else {
|
||||
sMagicBorderR += ABS(sMagicBorderR - color[0]) / sMagicBorderRatio;
|
||||
sMagicBorderR += borderChangeR;
|
||||
}
|
||||
|
||||
if (sMagicBorderG >= color[1]) {
|
||||
sMagicBorderG -= ABS(sMagicBorderG - color[1]) / sMagicBorderRatio;
|
||||
if (sMagicBorderG >= sMagicBorderColors[temp][1]) {
|
||||
sMagicBorderG -= borderChangeG;
|
||||
} else {
|
||||
sMagicBorderG += ABS(sMagicBorderG - color[1]) / sMagicBorderRatio;
|
||||
sMagicBorderG += borderChangeG;
|
||||
}
|
||||
|
||||
if (sMagicBorderB >= color[2]) {
|
||||
sMagicBorderB -= ABS(sMagicBorderB - color[2]) / sMagicBorderRatio;
|
||||
if (sMagicBorderB >= sMagicBorderColors[temp][2]) {
|
||||
sMagicBorderB -= borderChangeB;
|
||||
} else {
|
||||
sMagicBorderB += ABS(sMagicBorderB - color[2]) / sMagicBorderRatio;
|
||||
sMagicBorderB += borderChangeB;
|
||||
}
|
||||
|
||||
sMagicBorderRatio--;
|
||||
if (sMagicBorderRatio == 0) {
|
||||
sMagicBorderR = color[0];
|
||||
sMagicBorderG = color[1];
|
||||
sMagicBorderB = color[2];
|
||||
sMagicBorderR = sMagicBorderColors[temp][0];
|
||||
sMagicBorderG = sMagicBorderColors[temp][1];
|
||||
sMagicBorderB = sMagicBorderColors[temp][2];
|
||||
sMagicBorderRatio = YREG(40 + sMagicBorderStep);
|
||||
sMagicBorderStep++;
|
||||
if (sMagicBorderStep >= 4) {
|
||||
|
@ -2456,16 +2463,16 @@ void Interface_UpdateMagicBar(GlobalContext* globalCtx) {
|
|||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case 5:
|
||||
sMagicBorderB = 255;
|
||||
sMagicBorderG = 255;
|
||||
sMagicBorderR = 255;
|
||||
sMagicBorderR = sMagicBorderG = sMagicBorderB = 255;
|
||||
gSaveContext.unk_13F0 = 0;
|
||||
break;
|
||||
|
||||
case 7:
|
||||
if ((globalCtx->pauseCtx.state == 0) && (globalCtx->pauseCtx.flag == 0) &&
|
||||
(globalCtx->msgCtx.msgMode == 0) && (globalCtx->unk_10A20 == 0) && (globalCtx->sceneLoadFlag == 0) &&
|
||||
(globalCtx->transitionMode == 0) && !Gameplay_InCsMode(globalCtx)) {
|
||||
if ((globalCtx->pauseCtx.state == 0) && (globalCtx->pauseCtx.flag == 0) && (msgCtx->msgMode == 0) &&
|
||||
(globalCtx->unk_10A20 == 0) && (globalCtx->sceneLoadFlag == 0) && (globalCtx->transitionMode == 0) &&
|
||||
!Gameplay_InCsMode(globalCtx)) {
|
||||
if ((gSaveContext.magic == 0) || ((func_8008F2F8(globalCtx) >= 2) && (func_8008F2F8(globalCtx) < 5)) ||
|
||||
((gSaveContext.equips.buttonItems[1] != ITEM_LENS) &&
|
||||
(gSaveContext.equips.buttonItems[2] != ITEM_LENS) &&
|
||||
|
@ -2479,38 +2486,41 @@ void Interface_UpdateMagicBar(GlobalContext* globalCtx) {
|
|||
break;
|
||||
}
|
||||
|
||||
globalCtx->interfaceCtx.unk_230--;
|
||||
if (globalCtx->interfaceCtx.unk_230 == 0) {
|
||||
interfaceCtx->unk_230--;
|
||||
if (interfaceCtx->unk_230 == 0) {
|
||||
gSaveContext.magic--;
|
||||
globalCtx->interfaceCtx.unk_230 = 80;
|
||||
interfaceCtx->unk_230 = 80;
|
||||
}
|
||||
}
|
||||
|
||||
color = sMagicBorderColors[sMagicBorderIndexes[sMagicBorderStep]];
|
||||
temp = sMagicBorderIndexes[sMagicBorderStep];
|
||||
borderChangeR = ABS(sMagicBorderR - sMagicBorderColors[temp][0]) / sMagicBorderRatio;
|
||||
borderChangeG = ABS(sMagicBorderG - sMagicBorderColors[temp][1]) / sMagicBorderRatio;
|
||||
borderChangeB = ABS(sMagicBorderB - sMagicBorderColors[temp][2]) / sMagicBorderRatio;
|
||||
|
||||
if (sMagicBorderR >= color[0]) {
|
||||
sMagicBorderR -= ABS(sMagicBorderR - color[0]) / sMagicBorderRatio;
|
||||
if (sMagicBorderR >= sMagicBorderColors[temp][0]) {
|
||||
sMagicBorderR -= borderChangeR;
|
||||
} else {
|
||||
sMagicBorderR += ABS(sMagicBorderR - color[0]) / sMagicBorderRatio;
|
||||
sMagicBorderR += borderChangeR;
|
||||
}
|
||||
|
||||
if (sMagicBorderG >= color[1]) {
|
||||
sMagicBorderG -= ABS(sMagicBorderG - color[1]) / sMagicBorderRatio;
|
||||
if (sMagicBorderG >= sMagicBorderColors[temp][1]) {
|
||||
sMagicBorderG -= borderChangeG;
|
||||
} else {
|
||||
sMagicBorderG += ABS(sMagicBorderG - color[1]) / sMagicBorderRatio;
|
||||
sMagicBorderG += borderChangeG;
|
||||
}
|
||||
|
||||
if (sMagicBorderB >= color[2]) {
|
||||
sMagicBorderB -= ABS(sMagicBorderB - color[2]) / sMagicBorderRatio;
|
||||
if (sMagicBorderB >= sMagicBorderColors[temp][2]) {
|
||||
sMagicBorderB -= borderChangeB;
|
||||
} else {
|
||||
sMagicBorderB += ABS(sMagicBorderB - color[2]) / sMagicBorderRatio;
|
||||
sMagicBorderB += borderChangeB;
|
||||
}
|
||||
|
||||
sMagicBorderRatio--;
|
||||
if (sMagicBorderRatio == 0) {
|
||||
sMagicBorderR = color[0];
|
||||
sMagicBorderG = color[1];
|
||||
sMagicBorderB = color[2];
|
||||
sMagicBorderR = sMagicBorderColors[temp][0];
|
||||
sMagicBorderG = sMagicBorderColors[temp][1];
|
||||
sMagicBorderB = sMagicBorderColors[temp][2];
|
||||
sMagicBorderRatio = YREG(40 + sMagicBorderStep);
|
||||
sMagicBorderStep++;
|
||||
if (sMagicBorderStep >= 4) {
|
||||
|
@ -2518,6 +2528,7 @@ void Interface_UpdateMagicBar(GlobalContext* globalCtx) {
|
|||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case 10:
|
||||
gSaveContext.magic += 4;
|
||||
Audio_PlaySoundGeneral(NA_SE_SY_GAUGE_UP - SFX_FLAG, &D_801333D4, 4, &D_801333E0, &D_801333E0, &D_801333E8);
|
||||
|
@ -2527,24 +2538,12 @@ void Interface_UpdateMagicBar(GlobalContext* globalCtx) {
|
|||
gSaveContext.unk_13F2 = 0;
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
gSaveContext.unk_13F0 = 0;
|
||||
break;
|
||||
}
|
||||
}
|
||||
#else
|
||||
s16 sMagicBorderColors[][3] = {
|
||||
{ 0xFF, 0xFF, 0xFF },
|
||||
{ 0x96, 0x96, 0x96 },
|
||||
{ 0xFF, 0xFF, 0x96 },
|
||||
{ 0xFF, 0xFF, 0x32 },
|
||||
};
|
||||
s16 sMagicBorderIndexes[] = { 0, 1, 1, 0 };
|
||||
s16 sMagicBorderRatio = 2;
|
||||
s16 sMagicBorderStep = 1;
|
||||
void Interface_UpdateMagicBar(GlobalContext* globalCtx);
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/code/z_parameter/Interface_UpdateMagicBar.s")
|
||||
#endif
|
||||
|
||||
void Interface_DrawMagicBar(GlobalContext* globalCtx) {
|
||||
InterfaceContext* interfaceCtx = &globalCtx->interfaceCtx;
|
||||
|
@ -2686,15 +2685,14 @@ u8* sCUpLabelTextures[] = { D_02002FC0, D_02002FC0, D_02002FC0 };
|
|||
|
||||
s16 sStartButtonLeftPos[] = { 132, 130, 130 };
|
||||
|
||||
#ifdef NON_MATCHING
|
||||
// regalloc and ordering differences
|
||||
void Interface_DrawItemButtons(GlobalContext* globalCtx) {
|
||||
InterfaceContext* interfaceCtx = &globalCtx->interfaceCtx;
|
||||
Player* player = PLAYER;
|
||||
f32 temp;
|
||||
s16 i; // sp+0x14A
|
||||
s16 cUpAlpha;
|
||||
s32 pad;
|
||||
PauseContext* pauseCtx = &globalCtx->pauseCtx;
|
||||
s16 temp;
|
||||
s16 dxdy;
|
||||
s16 width;
|
||||
s16 height;
|
||||
|
||||
OPEN_DISPS(globalCtx->state.gfxCtx, "../z_parameter.c", 2900);
|
||||
|
||||
|
@ -2731,7 +2729,7 @@ void Interface_DrawItemButtons(GlobalContext* globalCtx) {
|
|||
(R_ITEM_BTN_X(3) + R_ITEM_BTN_WIDTH(3)) << 2, (R_ITEM_BTN_Y(3) + R_ITEM_BTN_WIDTH(3)) << 2,
|
||||
G_TX_RENDERTILE, 0, 0, R_ITEM_BTN_DD(3) * 2, R_ITEM_BTN_DD(3) * 2);
|
||||
|
||||
if ((globalCtx->pauseCtx.state < 8) || (globalCtx->pauseCtx.state >= 18)) {
|
||||
if ((pauseCtx->state < 8) || (pauseCtx->state >= 18)) {
|
||||
if ((globalCtx->pauseCtx.state != 0) || (globalCtx->pauseCtx.flag != 0)) {
|
||||
// Start Button Texture, Color & Label
|
||||
gDPPipeSync(oGfxCtx->overlay.p++);
|
||||
|
@ -2758,12 +2756,13 @@ void Interface_DrawItemButtons(GlobalContext* globalCtx) {
|
|||
G_TX_NOLOD);
|
||||
gDPSetTileSize(oGfxCtx->overlay.p++, G_TX_RENDERTILE, 0, 0, 188, 60);
|
||||
|
||||
temp = R_START_LABEL_DD(gSaveContext.language) / 100.0f;
|
||||
gSPTextureRectangle(oGfxCtx->overlay.p++, R_START_LABEL_X(gSaveContext.language) << 2,
|
||||
R_START_LABEL_Y(gSaveContext.language) << 2,
|
||||
(R_START_LABEL_X(gSaveContext.language) + (s16)(16.0f / temp)) << 2,
|
||||
(R_START_LABEL_Y(gSaveContext.language) + (s16)(48.0f / temp)) << 2, G_TX_RENDERTILE, 0,
|
||||
0, (s16)(1024.0f / temp), (s16)(1024.0f / temp));
|
||||
dxdy = 1024.0f / (R_START_LABEL_DD(gSaveContext.language) / 100.0f);
|
||||
width = 48.0f / (R_START_LABEL_DD(gSaveContext.language) / 100.0f);
|
||||
height = 16.0f / (R_START_LABEL_DD(gSaveContext.language) / 100.0f);
|
||||
gSPTextureRectangle(
|
||||
oGfxCtx->overlay.p++, R_START_LABEL_X(gSaveContext.language) << 2,
|
||||
R_START_LABEL_Y(gSaveContext.language) << 2, (R_START_LABEL_X(gSaveContext.language) + width) << 2,
|
||||
(R_START_LABEL_Y(gSaveContext.language) + height) << 2, G_TX_RENDERTILE, 0, 0, dxdy, dxdy);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2774,20 +2773,20 @@ void Interface_DrawItemButtons(GlobalContext* globalCtx) {
|
|||
gDPPipeSync(oGfxCtx->overlay.p++);
|
||||
|
||||
if ((gSaveContext.unk_13EA == 1) || (gSaveContext.unk_13EA == 2) || (gSaveContext.unk_13EA == 5)) {
|
||||
cUpAlpha = 0;
|
||||
} else if ((player->stateFlags2 & 0x00200000) || (func_8008F2F8(globalCtx) == 4) ||
|
||||
temp = 0;
|
||||
} else if ((player->stateFlags1 & 0x00200000) || (func_8008F2F8(globalCtx) == 4) ||
|
||||
(player->stateFlags2 & 0x00040000)) {
|
||||
cUpAlpha = 70;
|
||||
temp = 70;
|
||||
} else {
|
||||
cUpAlpha = interfaceCtx->healthAlpha;
|
||||
temp = interfaceCtx->healthAlpha;
|
||||
}
|
||||
|
||||
gDPSetPrimColor(oGfxCtx->overlay.p++, 0, 0, R_C_BTN_COLOR(0), R_C_BTN_COLOR(1), R_C_BTN_COLOR(2), cUpAlpha);
|
||||
gDPSetPrimColor(oGfxCtx->overlay.p++, 0, 0, R_C_BTN_COLOR(0), R_C_BTN_COLOR(1), R_C_BTN_COLOR(2), temp);
|
||||
gDPSetCombineMode(oGfxCtx->overlay.p++, G_CC_MODULATEIA_PRIM, G_CC_MODULATEIA_PRIM);
|
||||
gSPTextureRectangle(oGfxCtx->overlay.p++, R_C_UP_BTN_X << 2, R_C_UP_BTN_Y << 2, (R_C_UP_BTN_X + 16) << 2,
|
||||
(R_C_UP_BTN_Y + 16) << 2, G_TX_RENDERTILE, 0, 0, 2048, 2048);
|
||||
gDPPipeSync(oGfxCtx->overlay.p++);
|
||||
gDPSetPrimColor(oGfxCtx->overlay.p++, 0, 0, 255, 255, 255, cUpAlpha);
|
||||
gDPSetPrimColor(oGfxCtx->overlay.p++, 0, 0, 255, 255, 255, temp);
|
||||
gDPSetEnvColor(oGfxCtx->overlay.p++, 0, 0, 0, 0);
|
||||
gDPSetCombineLERP(oGfxCtx->overlay.p++, PRIMITIVE, ENVIRONMENT, TEXEL0, ENVIRONMENT, TEXEL0, 0, PRIMITIVE,
|
||||
0, PRIMITIVE, ENVIRONMENT, TEXEL0, ENVIRONMENT, TEXEL0, 0, PRIMITIVE, 0);
|
||||
|
@ -2811,20 +2810,20 @@ void Interface_DrawItemButtons(GlobalContext* globalCtx) {
|
|||
|
||||
sCUpTimer--;
|
||||
if (sCUpTimer == 0) {
|
||||
sCUpTimer = 10;
|
||||
sCUpInvisible ^= 1;
|
||||
sCUpTimer = 10;
|
||||
}
|
||||
}
|
||||
|
||||
gDPPipeSync(oGfxCtx->overlay.p++);
|
||||
|
||||
// Empty C Button Arrows
|
||||
for (i = 1; i < 4; i++) {
|
||||
if (gSaveContext.equips.buttonItems[i] > 0xF0) {
|
||||
if (i == 1) {
|
||||
for (temp = 1; temp < 4; temp++) {
|
||||
if (gSaveContext.equips.buttonItems[temp] > 0xF0) {
|
||||
if (temp == 1) {
|
||||
gDPSetPrimColor(oGfxCtx->overlay.p++, 0, 0, R_C_BTN_COLOR(0), R_C_BTN_COLOR(1), R_C_BTN_COLOR(2),
|
||||
interfaceCtx->cLeftAlpha);
|
||||
} else if (i == 2) {
|
||||
} else if (temp == 2) {
|
||||
gDPSetPrimColor(oGfxCtx->overlay.p++, 0, 0, R_C_BTN_COLOR(0), R_C_BTN_COLOR(1), R_C_BTN_COLOR(2),
|
||||
interfaceCtx->cDownAlpha);
|
||||
} else {
|
||||
|
@ -2832,18 +2831,14 @@ void Interface_DrawItemButtons(GlobalContext* globalCtx) {
|
|||
interfaceCtx->cRightAlpha);
|
||||
}
|
||||
|
||||
oGfxCtx->overlay.p =
|
||||
Gfx_TextureIA8(oGfxCtx->overlay.p, &D_02000A00[i + 1], 0x20, 0x20, R_ITEM_BTN_X(i), R_ITEM_BTN_Y(i),
|
||||
R_ITEM_BTN_WIDTH(i), R_ITEM_BTN_WIDTH(i), R_ITEM_BTN_DD(i) * 2, R_ITEM_BTN_DD(i) * 2);
|
||||
oGfxCtx->overlay.p = Gfx_TextureIA8(
|
||||
oGfxCtx->overlay.p, &D_02000A00[temp + 1], 0x20, 0x20, R_ITEM_BTN_X(temp), R_ITEM_BTN_Y(temp),
|
||||
R_ITEM_BTN_WIDTH(temp), R_ITEM_BTN_WIDTH(temp), R_ITEM_BTN_DD(temp) * 2, R_ITEM_BTN_DD(temp) * 2);
|
||||
}
|
||||
}
|
||||
|
||||
CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_parameter.c", 3071);
|
||||
}
|
||||
#else
|
||||
void Interface_DrawItemButtons(GlobalContext* globalCtx);
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/code/z_parameter/Interface_DrawItemButtons.s")
|
||||
#endif
|
||||
|
||||
void Interface_DrawItemIconTexture(GlobalContext* globalCtx, void* texture, s16 button) {
|
||||
OPEN_DISPS(globalCtx->state.gfxCtx, "../z_parameter.c", 3079);
|
||||
|
@ -3124,7 +3119,7 @@ void Interface_Draw(GlobalContext* globalCtx) {
|
|||
case SCENE_GANON_SONOGO:
|
||||
case SCENE_GANONTIKA_SONOGO:
|
||||
case SCENE_TAKARAYA:
|
||||
if (gSaveContext.dungeonKeys[gSaveContext.mapIndex] >= 0) {
|
||||
if (gSaveContext.inventory.dungeonKeys[gSaveContext.mapIndex] >= 0) {
|
||||
// Small Key Icon
|
||||
gDPPipeSync(oGfxCtx->overlay.p++);
|
||||
gDPSetPrimColor(oGfxCtx->overlay.p++, 0, 0, 200, 230, 255, interfaceCtx->magicAlpha);
|
||||
|
@ -3139,7 +3134,7 @@ void Interface_Draw(GlobalContext* globalCtx) {
|
|||
PRIMITIVE, TEXEL0, 0, PRIMITIVE, 0);
|
||||
|
||||
interfaceCtx->counterDigits[2] = 0;
|
||||
interfaceCtx->counterDigits[3] = gSaveContext.dungeonKeys[gSaveContext.mapIndex];
|
||||
interfaceCtx->counterDigits[3] = gSaveContext.inventory.dungeonKeys[gSaveContext.mapIndex];
|
||||
|
||||
while (interfaceCtx->counterDigits[3] >= 10) {
|
||||
interfaceCtx->counterDigits[2]++;
|
||||
|
|
|
@ -146,8 +146,8 @@ Gfx* func_800BC8A0(GlobalContext* globalCtx, Gfx* gfx) {
|
|||
globalCtx->lightCtx.unk_0A, 1000);
|
||||
}
|
||||
|
||||
void Gameplay_Destroy(GlobalContext* globalCtx) {
|
||||
s32 pad;
|
||||
void Gameplay_Destroy(GameState* thisx) {
|
||||
GlobalContext* globalCtx = (GlobalContext*)thisx;
|
||||
Player* player = PLAYER;
|
||||
|
||||
globalCtx->state.gfxCtx->callback = NULL;
|
||||
|
@ -191,7 +191,8 @@ void Gameplay_Destroy(GlobalContext* globalCtx) {
|
|||
#ifdef NON_MATCHING
|
||||
// regalloc and stack usage differences
|
||||
// also missing some extra duplicated instructions
|
||||
void Gameplay_Init(GlobalContext* globalCtx) {
|
||||
void Gameplay_Init(GameState* thisx) {
|
||||
GlobalContext* globalCtx = (GlobalContext*)thisx;
|
||||
GraphicsContext* gfxCtx;
|
||||
void* zAlloc; // 0x84
|
||||
void* zAllocAligned;
|
||||
|
@ -234,7 +235,7 @@ void Gameplay_Init(GlobalContext* globalCtx) {
|
|||
globalCtx->cameraPtrs[0]->uid = 0;
|
||||
globalCtx->activeCamera = 0;
|
||||
func_8005AC48(&globalCtx->mainCamera, 0xFF);
|
||||
func_800A9D28(globalCtx, &globalCtx->sub_1F74);
|
||||
Sram_Init(globalCtx, &globalCtx->sramCtx);
|
||||
func_80112098(globalCtx);
|
||||
func_80110F68(globalCtx);
|
||||
func_80110450(globalCtx);
|
||||
|
@ -317,7 +318,7 @@ void Gameplay_Init(GlobalContext* globalCtx) {
|
|||
|
||||
if (gSaveContext.nextDayTime != 0xFFFF) {
|
||||
if (gSaveContext.nextDayTime == 0x8001) {
|
||||
gSaveContext.unk_14++;
|
||||
gSaveContext.numDays++;
|
||||
gSaveContext.unk_18++;
|
||||
gSaveContext.dogIsLost = true;
|
||||
if (Inventory_ReplaceItem(globalCtx, ITEM_WEIRD_EGG, ITEM_CHICKEN) ||
|
||||
|
@ -1329,7 +1330,9 @@ void Gameplay_Draw(GlobalContext* globalCtx) {
|
|||
#pragma GLOBAL_ASM("asm/non_matchings/code/z_play/Gameplay_Draw.s")
|
||||
#endif
|
||||
|
||||
void Gameplay_Main(GlobalContext* globalCtx) {
|
||||
void Gameplay_Main(GameState* thisx) {
|
||||
GlobalContext* globalCtx = (GlobalContext*)thisx;
|
||||
|
||||
D_8012D1F8 = &globalCtx->state.input[0];
|
||||
|
||||
DebugDisplay_Init();
|
||||
|
@ -1724,12 +1727,12 @@ s16 func_800C09D8(GlobalContext* globalCtx, s16 camId, s16 arg2) {
|
|||
}
|
||||
|
||||
void Gameplay_SaveSceneFlags(GlobalContext* globalCtx) {
|
||||
SaveSceneFlags* sceneFlags = &gSaveContext.sceneFlags[globalCtx->sceneNum];
|
||||
SavedSceneFlags* savedSceneFlags = &gSaveContext.sceneFlags[globalCtx->sceneNum];
|
||||
|
||||
sceneFlags->chest = globalCtx->actorCtx.flags.chest;
|
||||
sceneFlags->swch = globalCtx->actorCtx.flags.swch;
|
||||
sceneFlags->clear = globalCtx->actorCtx.flags.clear;
|
||||
sceneFlags->collect = globalCtx->actorCtx.flags.collect;
|
||||
savedSceneFlags->chest = globalCtx->actorCtx.flags.chest;
|
||||
savedSceneFlags->swch = globalCtx->actorCtx.flags.swch;
|
||||
savedSceneFlags->clear = globalCtx->actorCtx.flags.clear;
|
||||
savedSceneFlags->collect = globalCtx->actorCtx.flags.collect;
|
||||
}
|
||||
|
||||
void Gameplay_SetRespawnData(GlobalContext* globalCtx, s32 respawnMode, s16 entranceIndex, s32 roomIndex,
|
||||
|
|
|
@ -1,30 +1,30 @@
|
|||
#include "global.h"
|
||||
#include "vt.h"
|
||||
|
||||
void func_80092320(PreNMIContext* prenmiCtx) {
|
||||
prenmiCtx->state.running = false;
|
||||
prenmiCtx->state.init = NULL;
|
||||
prenmiCtx->state.size = 0;
|
||||
void func_80092320(PreNMIContext* this) {
|
||||
this->state.running = false;
|
||||
this->state.init = NULL;
|
||||
this->state.size = 0;
|
||||
}
|
||||
|
||||
void PreNMI_Update(PreNMIContext* prenmiCtx) {
|
||||
void PreNMI_Update(PreNMIContext* this) {
|
||||
osSyncPrintf(VT_COL(YELLOW, BLACK) "prenmi_move\n" VT_RST);
|
||||
|
||||
// Strings existing only in rodata
|
||||
("../z_prenmi.c");
|
||||
("(int)volume = %d\n");
|
||||
|
||||
if (prenmiCtx->timer == 0) {
|
||||
if (this->timer == 0) {
|
||||
ViConfig_UpdateVi(1);
|
||||
func_80092320(prenmiCtx);
|
||||
func_80092320(this);
|
||||
return;
|
||||
}
|
||||
|
||||
prenmiCtx->timer--;
|
||||
this->timer--;
|
||||
}
|
||||
|
||||
void PreNMI_Draw(PreNMIContext* prenmiCtx) {
|
||||
GraphicsContext* gfxCtx = prenmiCtx->state.gfxCtx;
|
||||
void PreNMI_Draw(PreNMIContext* this) {
|
||||
GraphicsContext* gfxCtx = this->state.gfxCtx;
|
||||
|
||||
osSyncPrintf(VT_COL(YELLOW, BLACK) "prenmi_draw\n" VT_RST);
|
||||
|
||||
|
@ -34,26 +34,30 @@ void PreNMI_Draw(PreNMIContext* prenmiCtx) {
|
|||
func_80095248(gfxCtx, 0, 0, 0);
|
||||
func_800940B0(gfxCtx);
|
||||
gDPSetFillColor(oGfxCtx->polyOpa.p++, (GPACK_RGBA5551(255, 255, 255, 1) << 16) | GPACK_RGBA5551(255, 255, 255, 1));
|
||||
gDPFillRectangle(oGfxCtx->polyOpa.p++, 0, prenmiCtx->timer + 100, SCREEN_WIDTH - 1, prenmiCtx->timer + 100);
|
||||
gDPFillRectangle(oGfxCtx->polyOpa.p++, 0, this->timer + 100, SCREEN_WIDTH - 1, this->timer + 100);
|
||||
|
||||
CLOSE_DISPS(gfxCtx, "../z_prenmi.c", 112);
|
||||
}
|
||||
|
||||
void PreNMI_Main(PreNMIContext* prenmiCtx) {
|
||||
PreNMI_Update(prenmiCtx);
|
||||
PreNMI_Draw(prenmiCtx);
|
||||
void PreNMI_Main(GameState* thisx) {
|
||||
PreNMIContext* this = (PreNMIContext*)thisx;
|
||||
|
||||
prenmiCtx->state.unk_A0 = 1;
|
||||
PreNMI_Update(this);
|
||||
PreNMI_Draw(this);
|
||||
|
||||
this->state.unk_A0 = 1;
|
||||
}
|
||||
|
||||
void PreNMI_Destroy(PreNMIContext* prenmiCtx) {
|
||||
void PreNMI_Destroy(GameState* thisx) {
|
||||
}
|
||||
|
||||
void PreNMI_Init(PreNMIContext* prenmiCtx) {
|
||||
prenmiCtx->state.main = PreNMI_Main;
|
||||
prenmiCtx->state.destroy = PreNMI_Destroy;
|
||||
prenmiCtx->timer = 30;
|
||||
prenmiCtx->unk_A8 = 10;
|
||||
void PreNMI_Init(GameState* thisx) {
|
||||
PreNMIContext* this = (PreNMIContext*)thisx;
|
||||
|
||||
this->state.main = PreNMI_Main;
|
||||
this->state.destroy = PreNMI_Destroy;
|
||||
this->timer = 30;
|
||||
this->unk_A8 = 10;
|
||||
|
||||
R_UPDATE_RATE = 1;
|
||||
}
|
||||
|
|
|
@ -38,12 +38,14 @@ void Sample_Draw(SampleContext* this) {
|
|||
CLOSE_DISPS(gfxCtx, "../z_sample.c", 111);
|
||||
}
|
||||
|
||||
void Sample_Main(SampleContext* this) {
|
||||
void Sample_Main(GameState* thisx) {
|
||||
SampleContext* this = (SampleContext*)thisx;
|
||||
|
||||
Sample_Draw(this);
|
||||
Sample_HandleStateChange(this);
|
||||
}
|
||||
|
||||
void Sample_Destroy(SampleContext* this) {
|
||||
void Sample_Destroy(GameState* thisx) {
|
||||
}
|
||||
|
||||
void Sample_SetupView(SampleContext* this) {
|
||||
|
@ -83,7 +85,9 @@ void Sample_LoadTitleStatic(SampleContext* this) {
|
|||
DmaMgr_SendRequest1(this->staticSegment, _title_staticSegmentRomStart, size, "../z_sample.c", 164);
|
||||
}
|
||||
|
||||
void Sample_Init(SampleContext* this) {
|
||||
void Sample_Init(GameState* thisx) {
|
||||
SampleContext* this = (SampleContext*)thisx;
|
||||
|
||||
this->state.main = Sample_Main;
|
||||
this->state.destroy = Sample_Destroy;
|
||||
R_UPDATE_RATE = 1;
|
||||
|
|
|
@ -1,25 +1,905 @@
|
|||
#include "global.h"
|
||||
#include "vt.h"
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/code/z_sram/func_800A81A0.s")
|
||||
// these are the main substructs of save context.
|
||||
// we are going to hold off on splitting save context until later on,
|
||||
// so these temporary structs will live here for now.
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/code/z_sram/func_800A82C8.s")
|
||||
typedef struct {
|
||||
/* 0x00 */ char newf[6]; // string "ZELDAZ"
|
||||
/* 0x06 */ s16 deaths;
|
||||
/* 0x08 */ char playerName[8];
|
||||
/* 0x10 */ s16 n64ddFlag;
|
||||
/* 0x12 */ s16 healthCapacity; // "max_life"
|
||||
/* 0x14 */ s16 health; // "now_life"
|
||||
/* 0x16 */ s8 magicLevel;
|
||||
/* 0x17 */ s8 magic;
|
||||
/* 0x18 */ s16 rupees;
|
||||
/* 0x1A */ u16 swordHealth;
|
||||
/* 0x1C */ u16 naviTimer;
|
||||
/* 0x1E */ u8 magicAcquired;
|
||||
/* 0x1F */ u8 unk_1F;
|
||||
/* 0x20 */ u8 doubleMagic;
|
||||
/* 0x21 */ u8 doubleDefense;
|
||||
/* 0x22 */ u8 bgsFlag;
|
||||
/* 0x23 */ u8 ocarinaGameReward;
|
||||
/* 0x24 */ ItemEquips childEquips;
|
||||
/* 0x2E */ ItemEquips adultEquips;
|
||||
/* 0x38 */ u32 unk_38; // this may be incorrect, currently used for alignement
|
||||
/* 0x3C */ char unk_3C[0x0E];
|
||||
/* 0x4A */ s16 savedSceneNum;
|
||||
} SavePlayerData; // size = 0x4C
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/code/z_sram/func_800A8484.s")
|
||||
typedef struct {
|
||||
/* 0x0000 */ SavePlayerData playerData; // "S_Private" substruct name
|
||||
/* 0x004C */ ItemEquips equips;
|
||||
/* 0x0058 */ Inventory inventory;
|
||||
/* 0x00B8 */ SavedSceneFlags sceneFlags[124];
|
||||
/* 0x0E48 */ FaroresWindData fw;
|
||||
/* 0x0E70 */ char unk_E70[0x10];
|
||||
/* 0x0E80 */ s32 gsFlags[6];
|
||||
/* 0x0E98 */ char unk_E98[0x10];
|
||||
/* 0x0EA8 */ s32 horseRaceRecord;
|
||||
/* 0x0EAC */ char unk_EAC[0x0C];
|
||||
/* 0x0EB8 */ u16 eventChkInf[14]; // "event_chk_inf"
|
||||
/* 0x0ED4 */ u16 itemGetInf[4]; // "item_get_inf"
|
||||
/* 0x0EDC */ u16 infTable[30]; // "inf_table"
|
||||
/* 0x0F18 */ char unk_F18[0x04];
|
||||
/* 0x0F1C */ u32 worldMapAreaData; // "area_arrival"
|
||||
/* 0x0F20 */ char unk_F20[0x4];
|
||||
/* 0x0F24 */ u8 scarecrowCustomSongSet;
|
||||
/* 0x0F25 */ u8 scarecrowCustomSong[0x360];
|
||||
/* 0x1285 */ char unk_1285[0x24];
|
||||
/* 0x12A9 */ u8 scarecrowSpawnSongSet;
|
||||
/* 0x12AA */ u8 scarecrowSpawnSong[0x80];
|
||||
/* 0x132A */ char unk_132A[0x02];
|
||||
/* 0x132C */ HorseData horseData;
|
||||
/* 0x1336 */ u16 checksum; // "check_sum"
|
||||
} SaveInfo; // size = 0x1338
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/code/z_sram/func_800A88D4.s")
|
||||
typedef struct {
|
||||
/* 0x00 */ s32 entranceIndex;
|
||||
/* 0x04 */ s32 linkAge; // 0: Adult; 1: Child
|
||||
/* 0x08 */ s32 cutsceneIndex;
|
||||
/* 0x0C */ u16 dayTime; // "zelda_time"
|
||||
/* 0x10 */ s32 nightFlag;
|
||||
/* 0x14 */ s32 numDays;
|
||||
/* 0x18 */ s32 unk_18; // increments with numDays, gets reset by goron for bgs and one other use
|
||||
/* 0x1C */ SaveInfo info; // "information"
|
||||
} Save; // size = 0x1354
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/code/z_sram/func_800A8A20.s")
|
||||
#define SAVE_PLAYER_DATA (*((SavePlayerData*)&gSaveContext.newf))
|
||||
#define SAVE_INFO (*((SaveInfo*)&gSaveContext.newf))
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/code/z_sram/func_800A9258.s")
|
||||
#define SLOT_SIZE (sizeof(SaveContext) + 0x28)
|
||||
#define CHECKSUM_SIZE (sizeof(Save) / 2)
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/code/z_sram/func_800A96D0.s")
|
||||
#define DEATHS OFFSETOF(SaveContext, deaths)
|
||||
#define NAME OFFSETOF(SaveContext, playerName)
|
||||
#define N64DD OFFSETOF(SaveContext, n64ddFlag)
|
||||
#define HEALTH_CAP OFFSETOF(SaveContext, healthCapacity)
|
||||
#define QUEST OFFSETOF(SaveContext, inventory.questItems)
|
||||
#define DEFENSE OFFSETOF(SaveContext, inventory.defenseHearts)
|
||||
#define HEALTH OFFSETOF(SaveContext, health)
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/code/z_sram/func_800A97F0.s")
|
||||
#define SLOT_OFFSET(idx) (SLOT_SIZE * idx + 0x20)
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/code/z_sram/func_800A9A9C.s")
|
||||
u16 gSramSlotOffsets[][3] = {
|
||||
{
|
||||
SLOT_OFFSET(0),
|
||||
SLOT_OFFSET(1),
|
||||
SLOT_OFFSET(2),
|
||||
},
|
||||
{
|
||||
SLOT_OFFSET(3),
|
||||
SLOT_OFFSET(4),
|
||||
SLOT_OFFSET(5),
|
||||
},
|
||||
};
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/code/z_sram/func_800A9AD0.s")
|
||||
char sZeldaMagic[] = { '\0', '\0', '\0', '\x98', '\x09', '\x10', '\x21', 'Z', 'E', 'L', 'D', 'A' };
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/code/z_sram/func_800A9CD4.s")
|
||||
SavePlayerData sNewSavePlayerData = {
|
||||
{ '\0', '\0', '\0', '\0', '\0', '\0' }, // newf
|
||||
0, // deaths
|
||||
{ 0x3E, 0x3E, 0x3E, 0x3E, 0x3E, 0x3E, 0x3E, 0x3E }, // playerName
|
||||
0, // n64ddFlag
|
||||
0x30, // healthCapacity
|
||||
0x30, // heartStatus
|
||||
0, // magicLevel
|
||||
0x30, // magic
|
||||
0, // rupees
|
||||
0, // swordHealth
|
||||
0, // naviTimer
|
||||
0, // magicAcquired
|
||||
0, // unk_1F
|
||||
0, // doubleMagic
|
||||
0, // doubleDefense
|
||||
0, // bgsFlag
|
||||
0, // ocarinaGameReward
|
||||
{
|
||||
{ ITEM_NONE, ITEM_NONE, ITEM_NONE, ITEM_NONE }, // buttonItems
|
||||
{ SLOT_NONE, SLOT_NONE, SLOT_NONE }, // cButtonSlots
|
||||
0, // equipment
|
||||
}, // childEquips
|
||||
{
|
||||
{ ITEM_NONE, ITEM_NONE, ITEM_NONE, ITEM_NONE }, // buttonItems
|
||||
{ SLOT_NONE, SLOT_NONE, SLOT_NONE }, // cButtonSlots
|
||||
0, // equipment
|
||||
}, // adultEquips
|
||||
0, // unk_38
|
||||
{ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, // unk_3C
|
||||
0x34, // savedSceneNum
|
||||
};
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/code/z_sram/func_800A9D28.s")
|
||||
ItemEquips sNewSaveEquips = {
|
||||
{ ITEM_NONE, ITEM_NONE, ITEM_NONE, ITEM_NONE }, // buttonItems
|
||||
{ SLOT_NONE, SLOT_NONE, SLOT_NONE }, // cButtonSlots
|
||||
0x1100, // equipment
|
||||
};
|
||||
|
||||
Inventory sNewSaveInventory = {
|
||||
{ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
|
||||
0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF }, // items
|
||||
{ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, // ammo
|
||||
0x1100, // equipment
|
||||
0, // upgrades
|
||||
0, // questItems
|
||||
{ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, // dungeonItems
|
||||
{
|
||||
0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
|
||||
0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
|
||||
}, // dungeonKeys
|
||||
0, // defenseHearts
|
||||
0, // gsTokens
|
||||
};
|
||||
|
||||
u16 sNewSaveChecksum = 0;
|
||||
|
||||
/**
|
||||
* Initialize new save.
|
||||
* This save has an empty inventory with 3 hearts and single magic.
|
||||
*/
|
||||
void Sram_InitNewSave(void) {
|
||||
SaveContext* temp = &gSaveContext;
|
||||
|
||||
bzero(&SAVE_INFO, sizeof(SaveInfo));
|
||||
gSaveContext.numDays = 0;
|
||||
gSaveContext.unk_18 = 0;
|
||||
|
||||
SAVE_PLAYER_DATA = sNewSavePlayerData;
|
||||
gSaveContext.equips = sNewSaveEquips;
|
||||
gSaveContext.inventory = sNewSaveInventory;
|
||||
|
||||
temp->checksum = sNewSaveChecksum;
|
||||
gSaveContext.horseData.scene = SCENE_SPOT00;
|
||||
gSaveContext.horseData.pos.x = -1840;
|
||||
gSaveContext.horseData.pos.y = 72;
|
||||
gSaveContext.horseData.pos.z = 5497;
|
||||
gSaveContext.horseData.angle = -0x6AD9;
|
||||
gSaveContext.magicLevel = 0;
|
||||
gSaveContext.infTable[29] = 1;
|
||||
gSaveContext.sceneFlags[5].swch = 0x40000000;
|
||||
}
|
||||
|
||||
SavePlayerData sDebugSavePlayerData = {
|
||||
{ 'Z', 'E', 'L', 'D', 'A', 'Z' }, // newf
|
||||
0, // deaths
|
||||
{ 0x15, 0x12, 0x17, 0x14, 0x3E, 0x3E, 0x3E, 0x3E }, // playerName ( "LINK" )
|
||||
0, // n64ddFlag
|
||||
0xE0, // healthCapacity
|
||||
0xE0, // health
|
||||
0, // magicLevel
|
||||
0x30, // magic
|
||||
150, // rupees
|
||||
8, // swordHealth
|
||||
0, // naviTimer
|
||||
1, // magicAcquired
|
||||
0, // unk_1F
|
||||
0, // doubleMagic
|
||||
0, // doubleDefense
|
||||
0, // bgsFlag
|
||||
0, // ocarinaGameReward
|
||||
{
|
||||
{ ITEM_NONE, ITEM_NONE, ITEM_NONE, ITEM_NONE }, // buttonItems
|
||||
{ SLOT_NONE, SLOT_NONE, SLOT_NONE }, // cButtonSlots
|
||||
0, // equipment
|
||||
}, // childEquips
|
||||
{
|
||||
{ ITEM_NONE, ITEM_NONE, ITEM_NONE, ITEM_NONE }, // buttonItems
|
||||
{ SLOT_NONE, SLOT_NONE, SLOT_NONE }, // cButtonSlots
|
||||
0, // equipment
|
||||
}, // adultEquips
|
||||
0, // unk_38
|
||||
{ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, // unk_3C
|
||||
0x51, // savedSceneNum
|
||||
};
|
||||
|
||||
ItemEquips sDebugSaveEquips = {
|
||||
{ ITEM_SWORD_MASTER, ITEM_BOW, ITEM_BOMB, ITEM_OCARINA_FAIRY }, // buttonItems
|
||||
{ SLOT_BOW, SLOT_BOMB, SLOT_OCARINA }, // cButtonSlots
|
||||
0x1122, // equipment
|
||||
};
|
||||
|
||||
Inventory sDebugSaveInventory = {
|
||||
{ ITEM_STICK, ITEM_NUT, ITEM_BOMB, ITEM_BOW, ITEM_ARROW_FIRE, ITEM_DINS_FIRE,
|
||||
ITEM_SLINGSHOT, ITEM_OCARINA_FAIRY, ITEM_BOMBCHU, ITEM_HOOKSHOT, ITEM_ARROW_ICE, ITEM_FARORES_WIND,
|
||||
ITEM_BOOMERANG, ITEM_LENS, ITEM_BEAN, ITEM_HAMMER, ITEM_ARROW_LIGHT, ITEM_NAYRUS_LOVE,
|
||||
ITEM_BOTTLE, ITEM_POTION_RED, ITEM_POTION_GREEN, ITEM_POTION_BLUE, ITEM_POCKET_EGG, ITEM_WEIRD_EGG }, // items
|
||||
{ 50, 50, 10, 30, 1, 1, 30, 1, 50, 1, 1, 1, 1, 1, 1, 1 }, // ammo
|
||||
0x7777, // equipment
|
||||
0x125249, // upgrades
|
||||
0x1E3FFFF, // questItems
|
||||
{ 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, // dungeonItems
|
||||
{ 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8 }, // dungeonKeys
|
||||
0, // defenseHearts
|
||||
0, // gsTokens
|
||||
};
|
||||
|
||||
u16 sDebugSaveChecksum = 0;
|
||||
|
||||
/**
|
||||
* Initialize debug save. This is also used on the Title Screen
|
||||
* This save has a mostly full inventory with 10 hearts and single magic.
|
||||
*
|
||||
* Some noteable flags that are set:
|
||||
* Showed Mido sword/shield, met Deku Tree, Deku Tree mouth opened,
|
||||
* used blue warp in Gohmas room, Zelda fled castle, light arrow cutscene watched,
|
||||
* and set water level in Water Temple to lowest level.
|
||||
*/
|
||||
void Sram_InitDebugSave(void) {
|
||||
SaveContext* temp = &gSaveContext;
|
||||
|
||||
bzero(&SAVE_INFO, sizeof(SaveInfo));
|
||||
gSaveContext.numDays = 0;
|
||||
gSaveContext.unk_18 = 0;
|
||||
|
||||
SAVE_PLAYER_DATA = sDebugSavePlayerData;
|
||||
gSaveContext.equips = sDebugSaveEquips;
|
||||
gSaveContext.inventory = sDebugSaveInventory;
|
||||
|
||||
temp->checksum = sDebugSaveChecksum;
|
||||
gSaveContext.horseData.scene = SCENE_SPOT00;
|
||||
gSaveContext.horseData.pos.x = -1840;
|
||||
gSaveContext.horseData.pos.y = 72;
|
||||
gSaveContext.horseData.pos.z = 5497;
|
||||
gSaveContext.horseData.angle = -0x6AD9;
|
||||
gSaveContext.infTable[0] |= 0x5009;
|
||||
gSaveContext.eventChkInf[0] |= 0x123F;
|
||||
gSaveContext.eventChkInf[8] |= 1;
|
||||
gSaveContext.eventChkInf[12] |= 0x10;
|
||||
|
||||
if (LINK_AGE_IN_YEARS == YEARS_CHILD) {
|
||||
gSaveContext.equips.buttonItems[0] = ITEM_SWORD_KOKIRI;
|
||||
Inventory_ChangeEquipment(EQUIP_SWORD, 1);
|
||||
if (gSaveContext.fileNum == 0xFF) {
|
||||
gSaveContext.equips.buttonItems[1] = ITEM_SLINGSHOT;
|
||||
gSaveContext.equips.cButtonSlots[0] = SLOT_SLINGSHOT;
|
||||
Inventory_ChangeEquipment(EQUIP_SHIELD, 1);
|
||||
}
|
||||
}
|
||||
|
||||
gSaveContext.entranceIndex = 0xCD;
|
||||
gSaveContext.magicLevel = 0;
|
||||
gSaveContext.sceneFlags[5].swch = 0x40000000;
|
||||
}
|
||||
|
||||
/**
|
||||
* Copy save currently on the buffer to Save Context and complete various tasks to open the save.
|
||||
* This includes:
|
||||
* - Set proper entrance depending on where the game was saved
|
||||
* - If health is less than 3 hearts, give 3 hearts
|
||||
* - If either scarecrow song is set, copy them from save context to the proper location
|
||||
* - Handle a case where the player saved and quit after zelda cutscene but didnt get the song
|
||||
* - Give and equip master sword if player is adult and doesnt have kokiri sword (bug?)
|
||||
* - Revert any trade items that spoil
|
||||
*/
|
||||
#ifdef NON_MATCHING
|
||||
// regalloc differences at the end
|
||||
void Sram_OpenSave(SramContext* sramCtx) {
|
||||
static s16 dungeonEntrances[] = {
|
||||
0x0000, 0x0004, 0x0028, 0x0169, 0x0165, 0x0010, 0x0082, 0x0037,
|
||||
0x0098, 0x0088, 0x041B, 0x0008, 0x0486, 0x0467, 0x0179, 0x056C,
|
||||
};
|
||||
u16 i;
|
||||
u16 j;
|
||||
u8* ptr;
|
||||
|
||||
osSyncPrintf("個人File作成\n"); // Create personal file
|
||||
i = gSramSlotOffsets[0][gSaveContext.fileNum];
|
||||
osSyncPrintf("ぽいんと=%x(%d)\n", i, gSaveContext.fileNum); // Point=
|
||||
|
||||
MemCopy(&gSaveContext, sramCtx->readBuff + i, sizeof(Save));
|
||||
|
||||
osSyncPrintf(VT_FGCOL(YELLOW));
|
||||
osSyncPrintf("SCENE_DATA_ID = %d SceneNo = %d\n", gSaveContext.savedSceneNum,
|
||||
((void)0, gSaveContext.entranceIndex));
|
||||
|
||||
switch (gSaveContext.savedSceneNum) {
|
||||
case SCENE_YDAN:
|
||||
case SCENE_DDAN:
|
||||
case SCENE_BDAN:
|
||||
case SCENE_BMORI1:
|
||||
case SCENE_HIDAN:
|
||||
case SCENE_MIZUSIN:
|
||||
case SCENE_JYASINZOU:
|
||||
case SCENE_HAKADAN:
|
||||
case SCENE_HAKADANCH:
|
||||
case SCENE_ICE_DOUKUTO:
|
||||
case SCENE_GANON:
|
||||
case SCENE_MEN:
|
||||
case SCENE_GERUDOWAY:
|
||||
case SCENE_GANONTIKA:
|
||||
gSaveContext.entranceIndex = dungeonEntrances[gSaveContext.savedSceneNum];
|
||||
break;
|
||||
case SCENE_YDAN_BOSS:
|
||||
gSaveContext.entranceIndex = 0;
|
||||
break;
|
||||
case SCENE_DDAN_BOSS:
|
||||
gSaveContext.entranceIndex = 4;
|
||||
break;
|
||||
case SCENE_BDAN_BOSS:
|
||||
gSaveContext.entranceIndex = 0x28;
|
||||
break;
|
||||
case SCENE_MORIBOSSROOM:
|
||||
gSaveContext.entranceIndex = 0x169;
|
||||
break;
|
||||
case SCENE_FIRE_BS:
|
||||
gSaveContext.entranceIndex = 0x165;
|
||||
break;
|
||||
case SCENE_MIZUSIN_BS:
|
||||
gSaveContext.entranceIndex = 0x10;
|
||||
break;
|
||||
case SCENE_JYASINBOSS:
|
||||
gSaveContext.entranceIndex = 0x82;
|
||||
break;
|
||||
case SCENE_HAKADAN_BS:
|
||||
gSaveContext.entranceIndex = 0x37;
|
||||
break;
|
||||
case SCENE_GANON_SONOGO:
|
||||
case SCENE_GANONTIKA_SONOGO:
|
||||
case SCENE_GANON_BOSS:
|
||||
case SCENE_GANON_FINAL:
|
||||
case SCENE_GANON_DEMO:
|
||||
gSaveContext.entranceIndex = 0x41B;
|
||||
break;
|
||||
|
||||
default:
|
||||
if (gSaveContext.savedSceneNum != SCENE_LINK_HOME) {
|
||||
gSaveContext.entranceIndex = (LINK_AGE_IN_YEARS == YEARS_CHILD) ? 0xBB : 0x5F4;
|
||||
} else {
|
||||
gSaveContext.entranceIndex = 0xBB;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
osSyncPrintf("scene_no = %d\n", gSaveContext.entranceIndex);
|
||||
osSyncPrintf(VT_RST);
|
||||
|
||||
if (gSaveContext.health < 0x30) {
|
||||
gSaveContext.health = 0x30;
|
||||
}
|
||||
|
||||
if (gSaveContext.scarecrowCustomSongSet) {
|
||||
osSyncPrintf(VT_FGCOL(BLUE));
|
||||
osSyncPrintf("\n====================================================================\n");
|
||||
|
||||
MemCopy(gScarecrowCustomSongPtr, &gSaveContext.scarecrowCustomSong, 0x360);
|
||||
|
||||
ptr = gScarecrowCustomSongPtr;
|
||||
for (i = 0; i < 0x360; i++, ptr++) {
|
||||
osSyncPrintf("%d, ", *ptr);
|
||||
}
|
||||
|
||||
osSyncPrintf("\n====================================================================\n");
|
||||
osSyncPrintf(VT_RST);
|
||||
}
|
||||
|
||||
if (gSaveContext.scarecrowSpawnSongSet) {
|
||||
osSyncPrintf(VT_FGCOL(GREEN));
|
||||
osSyncPrintf("\n====================================================================\n");
|
||||
|
||||
MemCopy(gScarecrowSpawnSongPtr, &gSaveContext.scarecrowSpawnSong, 0x80);
|
||||
|
||||
ptr = gScarecrowSpawnSongPtr;
|
||||
for (i = 0; i < 0x80; i++, ptr++) {
|
||||
osSyncPrintf("%d, ", *ptr);
|
||||
}
|
||||
|
||||
osSyncPrintf("\n====================================================================\n");
|
||||
osSyncPrintf(VT_RST);
|
||||
}
|
||||
|
||||
// if zelda cutscene has been watched but lullaby was not obtained, restore cutscene and take away letter
|
||||
if ((gSaveContext.eventChkInf[4] & 1) && !CHECK_QUEST_ITEM(QUEST_SONG_LULLABY)) {
|
||||
gSaveContext.eventChkInf[4] &= ~1;
|
||||
INV_CONTENT(ITEM_LETTER_ZELDA) = ITEM_CHICKEN;
|
||||
|
||||
for (i = 1; i < 4; i++) {
|
||||
if (gSaveContext.equips.buttonItems[i] == ITEM_LETTER_ZELDA) {
|
||||
gSaveContext.equips.buttonItems[i] = ITEM_CHICKEN;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// check for owning kokiri sword.. to restore master sword? bug or debug feature?
|
||||
if (LINK_AGE_IN_YEARS == YEARS_ADULT && !CHECK_OWNED_EQUIP(EQUIP_SWORD, 1)) {
|
||||
gSaveContext.inventory.equipment |= gBitFlags[1] << gEquipShifts[EQUIP_SWORD];
|
||||
gSaveContext.equips.buttonItems[0] = ITEM_SWORD_MASTER;
|
||||
gSaveContext.equips.equipment &= ~0xF;
|
||||
gSaveContext.equips.equipment |= 2;
|
||||
}
|
||||
|
||||
for (i = 0; i < ARRAY_COUNT(gSpoilingItems); i++) {
|
||||
if (INV_CONTENT(ITEM_TRADE_ADULT) == gSpoilingItems[i]) {
|
||||
INV_CONTENT(gSpoilingItemReverts[i]) = gSpoilingItemReverts[i];
|
||||
|
||||
for (j = 1; j < 4; j++) {
|
||||
if (gSaveContext.equips.buttonItems[j] == gSpoilingItems[i]) {
|
||||
gSaveContext.equips.buttonItems[j] = gSpoilingItemReverts[i];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
gSaveContext.magicLevel = 0;
|
||||
}
|
||||
#else
|
||||
s16 dungeonEntrances[] = {
|
||||
0x0000, 0x0004, 0x0028, 0x0169, 0x0165, 0x0010, 0x0082, 0x0037,
|
||||
0x0098, 0x0088, 0x041B, 0x0008, 0x0486, 0x0467, 0x0179, 0x056C,
|
||||
};
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/code/z_sram/Sram_OpenSave.s")
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Write the contents of the Save Context to a main and backup slot in SRAM.
|
||||
* Note: The whole Save Context is written even though only the `save` substruct is read back later
|
||||
*/
|
||||
void Sram_WriteSave(s32 unused) {
|
||||
u16 offset;
|
||||
u16 checksum;
|
||||
u16 j;
|
||||
u16* ptr;
|
||||
|
||||
gSaveContext.checksum = 0;
|
||||
|
||||
ptr = (u16*)&gSaveContext;
|
||||
checksum = 0;
|
||||
j = 0;
|
||||
|
||||
for (offset = 0; offset < CHECKSUM_SIZE; offset++) {
|
||||
if (++j == 0x20U) {
|
||||
j = 0;
|
||||
}
|
||||
checksum += *ptr++;
|
||||
}
|
||||
|
||||
gSaveContext.checksum = checksum;
|
||||
|
||||
ptr = (u16*)&gSaveContext;
|
||||
checksum = 0;
|
||||
|
||||
for (offset = 0; offset < CHECKSUM_SIZE; offset++) {
|
||||
if (++j == 0x20U) {
|
||||
j = 0;
|
||||
}
|
||||
checksum += *ptr++;
|
||||
}
|
||||
|
||||
offset = gSramSlotOffsets[0][gSaveContext.fileNum];
|
||||
SsSram_ReadWrite(OS_K1_TO_PHYSICAL(0xA8000000) + offset, &gSaveContext, SLOT_SIZE, OS_WRITE);
|
||||
|
||||
ptr = (u16*)&gSaveContext;
|
||||
checksum = 0;
|
||||
|
||||
for (offset = 0; offset < CHECKSUM_SIZE; offset++) {
|
||||
if (++j == 0x20U) {
|
||||
j = 0;
|
||||
}
|
||||
checksum += *ptr++;
|
||||
}
|
||||
|
||||
offset = gSramSlotOffsets[1][gSaveContext.fileNum];
|
||||
SsSram_ReadWrite(OS_K1_TO_PHYSICAL(0xA8000000) + offset, &gSaveContext, SLOT_SIZE, OS_WRITE);
|
||||
}
|
||||
|
||||
/**
|
||||
* For all 3 slots, verify that the checksum is correct. If corrupted, attempt to load a backup save.
|
||||
* If backup is also corrupted, default to a new save (or debug save for slot 0 on debug rom).
|
||||
*
|
||||
* After verifying all 3 saves, pass relevant data to File Select to be displayed.
|
||||
*/
|
||||
#ifdef NON_MATCHING
|
||||
// There's a problem with how "offset" is loaded
|
||||
void Sram_VerifyAndLoadAllSaves(FileChooseContext* fileChooseCtx, SramContext* sramCtx) {
|
||||
u16 slotNum; // 0x72
|
||||
u16 oldChecksum;
|
||||
u16 newChecksum;
|
||||
u16 dayTime; // 0x66
|
||||
// u16* offPtr;
|
||||
s32 offset;
|
||||
u16 i;
|
||||
u16 j;
|
||||
u16* ptr;
|
||||
|
||||
osSyncPrintf("SRAM START─LOAD\n");
|
||||
bzero(sramCtx->readBuff, SRAM_SIZE);
|
||||
SsSram_ReadWrite(OS_K1_TO_PHYSICAL(0xA8000000), sramCtx->readBuff, SRAM_SIZE, OS_READ);
|
||||
|
||||
dayTime = gSaveContext.dayTime;
|
||||
|
||||
for (slotNum = 0; slotNum < 3; slotNum++) {
|
||||
offset = gSramSlotOffsets[0][slotNum];
|
||||
osSyncPrintf("ぽいんと=%x(%d) SAVE_MAX=%d\n", offset, gSaveContext.fileNum, sizeof(Save));
|
||||
MemCopy(&gSaveContext, sramCtx->readBuff + offset, sizeof(Save));
|
||||
|
||||
oldChecksum = gSaveContext.checksum;
|
||||
gSaveContext.checksum = 0;
|
||||
osSyncPrintf("\n============= S(%d) =============\n", slotNum);
|
||||
|
||||
// j = 0;
|
||||
newChecksum = 0;
|
||||
ptr = (u16*)&gSaveContext;
|
||||
for (i = 0; i < CHECKSUM_SIZE; i++) {
|
||||
j += 2;
|
||||
newChecksum += *ptr++;
|
||||
}
|
||||
|
||||
// SAVE checksum calculation
|
||||
osSyncPrintf("\nSAVEチェックサム計算 j=%x mmm=%x ", newChecksum, oldChecksum);
|
||||
|
||||
if (oldChecksum != newChecksum) {
|
||||
// checksum didnt match, try backup save
|
||||
osSyncPrintf("ERROR!!! = %x(%d)\n", offset, slotNum);
|
||||
offset = gSramSlotOffsets[1][slotNum];
|
||||
MemCopy(&gSaveContext, sramCtx->readBuff + offset, sizeof(Save));
|
||||
|
||||
oldChecksum = gSaveContext.checksum;
|
||||
gSaveContext.checksum = 0;
|
||||
osSyncPrintf("================= BACK─UP ========================\n");
|
||||
|
||||
newChecksum = 0;
|
||||
ptr = (u16*)&gSaveContext;
|
||||
for (i = 0; i < CHECKSUM_SIZE; i++) {
|
||||
j += 2;
|
||||
newChecksum += *ptr++;
|
||||
}
|
||||
// (B) SAVE checksum calculation
|
||||
osSyncPrintf("\n(B)SAVEチェックサム計算 j=%x mmm=%x ", newChecksum, oldChecksum);
|
||||
|
||||
if (oldChecksum != newChecksum) {
|
||||
// backup save didnt work, make new save
|
||||
// offPtr = &gSramSlotOffsets[1][slotNum];
|
||||
osSyncPrintf("ERROR!!! = %x(%d+3)\n", offset, slotNum);
|
||||
bzero(&gSaveContext.entranceIndex, sizeof(gSaveContext.entranceIndex));
|
||||
bzero(&gSaveContext.linkAge, sizeof(gSaveContext.linkAge));
|
||||
bzero(&gSaveContext.cutsceneIndex, sizeof(gSaveContext.cutsceneIndex));
|
||||
bzero(&gSaveContext.dayTime, sizeof(gSaveContext.dayTime));
|
||||
bzero(&gSaveContext.nightFlag, sizeof(gSaveContext.nightFlag));
|
||||
bzero(&gSaveContext.numDays, sizeof(gSaveContext.numDays));
|
||||
bzero(&gSaveContext.unk_18, sizeof(gSaveContext.unk_18));
|
||||
|
||||
if (slotNum == 0) {
|
||||
Sram_InitDebugSave();
|
||||
gSaveContext.newf[0] = 'Z';
|
||||
gSaveContext.newf[1] = 'E';
|
||||
gSaveContext.newf[2] = 'L';
|
||||
gSaveContext.newf[3] = 'D';
|
||||
gSaveContext.newf[4] = 'A';
|
||||
gSaveContext.newf[5] = 'Z';
|
||||
osSyncPrintf("newf=%x,%x,%x,%x,%x,%x\n", gSaveContext.newf[0], gSaveContext.newf[1],
|
||||
gSaveContext.newf[2], gSaveContext.newf[3], gSaveContext.newf[4],
|
||||
gSaveContext.newf[5]);
|
||||
} else {
|
||||
Sram_InitNewSave();
|
||||
}
|
||||
|
||||
osSyncPrintf("\n--------------------------------------------------------------\n");
|
||||
|
||||
j = 0;
|
||||
newChecksum = 0;
|
||||
ptr = (u16*)&gSaveContext;
|
||||
for (i = 0; i < CHECKSUM_SIZE; i++) {
|
||||
osSyncPrintf("%x ", *ptr);
|
||||
if (++j == 0x20) {
|
||||
osSyncPrintf("\n");
|
||||
j = 0;
|
||||
}
|
||||
newChecksum += *ptr++;
|
||||
}
|
||||
|
||||
gSaveContext.checksum = newChecksum;
|
||||
osSyncPrintf("\nCheck_Sum=%x(%x)\n", gSaveContext.checksum, newChecksum);
|
||||
|
||||
offset = gSramSlotOffsets[1][slotNum];
|
||||
SsSram_ReadWrite(OS_K1_TO_PHYSICAL(0xA8000000) + offset, &gSaveContext, SLOT_SIZE, OS_WRITE);
|
||||
|
||||
osSyncPrintf("????#%x,%x,%x,%x,%x,%x\n", gSaveContext.newf[0], gSaveContext.newf[1],
|
||||
gSaveContext.newf[2], gSaveContext.newf[3], gSaveContext.newf[4], gSaveContext.newf[5]);
|
||||
osSyncPrintf("\nぽいんと=%x(%d+3) check_sum=%x(%x)\n", offset, slotNum, gSaveContext.checksum,
|
||||
newChecksum);
|
||||
}
|
||||
|
||||
offset = gSramSlotOffsets[0][slotNum];
|
||||
SsSram_ReadWrite(OS_K1_TO_PHYSICAL(0xA8000000) + offset, &gSaveContext, SLOT_SIZE, OS_WRITE);
|
||||
|
||||
osSyncPrintf("ぽいんと=%x(%d) check_sum=%x(%x)\n", offset, slotNum, gSaveContext.checksum, newChecksum);
|
||||
} else {
|
||||
// SAVE data OK! ! ! !
|
||||
osSyncPrintf("\nSAVEデータ OK!!!!\n");
|
||||
}
|
||||
}
|
||||
|
||||
bzero(sramCtx->readBuff, SRAM_SIZE);
|
||||
SsSram_ReadWrite(OS_K1_TO_PHYSICAL(0xA8000000), sramCtx->readBuff, SRAM_SIZE, OS_READ);
|
||||
gSaveContext.dayTime = dayTime;
|
||||
|
||||
osSyncPrintf("SAVECT=%x, NAME=%x, LIFE=%x, ITEM=%x, 64DD=%x, HEART=%x\n", DEATHS, NAME, HEALTH_CAP, QUEST, N64DD,
|
||||
DEFENSE);
|
||||
|
||||
MemCopy(&fileChooseCtx->deaths[0], sramCtx->readBuff + SLOT_OFFSET(0) + DEATHS, sizeof(fileChooseCtx->deaths[0]));
|
||||
MemCopy(&fileChooseCtx->deaths[1], sramCtx->readBuff + SLOT_OFFSET(1) + DEATHS, sizeof(fileChooseCtx->deaths[0]));
|
||||
MemCopy(&fileChooseCtx->deaths[2], sramCtx->readBuff + SLOT_OFFSET(2) + DEATHS, sizeof(fileChooseCtx->deaths[0]));
|
||||
|
||||
MemCopy(&fileChooseCtx->fileNames[0], sramCtx->readBuff + SLOT_OFFSET(0) + NAME,
|
||||
sizeof(fileChooseCtx->fileNames[0]));
|
||||
MemCopy(&fileChooseCtx->fileNames[1], sramCtx->readBuff + SLOT_OFFSET(1) + NAME,
|
||||
sizeof(fileChooseCtx->fileNames[0]));
|
||||
MemCopy(&fileChooseCtx->fileNames[2], sramCtx->readBuff + SLOT_OFFSET(2) + NAME,
|
||||
sizeof(fileChooseCtx->fileNames[0]));
|
||||
|
||||
MemCopy(&fileChooseCtx->healthCapacities[0], sramCtx->readBuff + SLOT_OFFSET(0) + HEALTH_CAP,
|
||||
sizeof(fileChooseCtx->healthCapacities[0]));
|
||||
MemCopy(&fileChooseCtx->healthCapacities[1], sramCtx->readBuff + SLOT_OFFSET(1) + HEALTH_CAP,
|
||||
sizeof(fileChooseCtx->healthCapacities[0]));
|
||||
MemCopy(&fileChooseCtx->healthCapacities[2], sramCtx->readBuff + SLOT_OFFSET(2) + HEALTH_CAP,
|
||||
sizeof(fileChooseCtx->healthCapacities[0]));
|
||||
|
||||
MemCopy(&fileChooseCtx->questItems[0], sramCtx->readBuff + SLOT_OFFSET(0) + QUEST,
|
||||
sizeof(fileChooseCtx->questItems[0]));
|
||||
MemCopy(&fileChooseCtx->questItems[1], sramCtx->readBuff + SLOT_OFFSET(1) + QUEST,
|
||||
sizeof(fileChooseCtx->questItems[0]));
|
||||
MemCopy(&fileChooseCtx->questItems[2], sramCtx->readBuff + SLOT_OFFSET(2) + QUEST,
|
||||
sizeof(fileChooseCtx->questItems[0]));
|
||||
|
||||
MemCopy(&fileChooseCtx->n64ddFlags[0], sramCtx->readBuff + SLOT_OFFSET(0) + N64DD,
|
||||
sizeof(fileChooseCtx->n64ddFlags[0]));
|
||||
MemCopy(&fileChooseCtx->n64ddFlags[1], sramCtx->readBuff + SLOT_OFFSET(1) + N64DD,
|
||||
sizeof(fileChooseCtx->n64ddFlags[0]));
|
||||
MemCopy(&fileChooseCtx->n64ddFlags[2], sramCtx->readBuff + SLOT_OFFSET(2) + N64DD,
|
||||
sizeof(fileChooseCtx->n64ddFlags[0]));
|
||||
|
||||
MemCopy(&fileChooseCtx->heartStatus[0], sramCtx->readBuff + SLOT_OFFSET(0) + DEFENSE,
|
||||
sizeof(fileChooseCtx->heartStatus[0]));
|
||||
MemCopy(&fileChooseCtx->heartStatus[1], sramCtx->readBuff + SLOT_OFFSET(1) + DEFENSE,
|
||||
sizeof(fileChooseCtx->heartStatus[0]));
|
||||
MemCopy(&fileChooseCtx->heartStatus[2], sramCtx->readBuff + SLOT_OFFSET(2) + DEFENSE,
|
||||
sizeof(fileChooseCtx->heartStatus[0]));
|
||||
|
||||
MemCopy(&fileChooseCtx->nowLife[0], sramCtx->readBuff + SLOT_OFFSET(0) + HEALTH, sizeof(fileChooseCtx->nowLife[0]));
|
||||
MemCopy(&fileChooseCtx->nowLife[1], sramCtx->readBuff + SLOT_OFFSET(1) + HEALTH, sizeof(fileChooseCtx->nowLife[0]));
|
||||
MemCopy(&fileChooseCtx->nowLife[2], sramCtx->readBuff + SLOT_OFFSET(2) + HEALTH, sizeof(fileChooseCtx->nowLife[0]));
|
||||
|
||||
osSyncPrintf("f_64dd=%d, %d, %d\n", fileChooseCtx->n64ddFlags[0], fileChooseCtx->n64ddFlags[1],
|
||||
fileChooseCtx->n64ddFlags[2]);
|
||||
osSyncPrintf("heart_status=%d, %d, %d\n", fileChooseCtx->heartStatus[0], fileChooseCtx->heartStatus[1],
|
||||
fileChooseCtx->heartStatus[2]);
|
||||
osSyncPrintf("now_life=%d, %d, %d\n", fileChooseCtx->nowLife[0], fileChooseCtx->nowLife[1],
|
||||
fileChooseCtx->nowLife[2]);
|
||||
}
|
||||
#else
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/code/z_sram/Sram_VerifyAndLoadAllSaves.s")
|
||||
#endif
|
||||
|
||||
void Sram_InitSave(FileChooseContext* fileChooseCtx, SramContext* sramCtx) {
|
||||
u16 offset;
|
||||
u16 j;
|
||||
u16* ptr;
|
||||
u16 checksum;
|
||||
|
||||
if (fileChooseCtx->btnIdx != 0) {
|
||||
Sram_InitNewSave();
|
||||
} else {
|
||||
Sram_InitDebugSave();
|
||||
}
|
||||
|
||||
gSaveContext.entranceIndex = 0xBB;
|
||||
gSaveContext.linkAge = 1;
|
||||
gSaveContext.dayTime = 0x6AAB;
|
||||
gSaveContext.cutsceneIndex = 0xFFF1;
|
||||
|
||||
if (fileChooseCtx->btnIdx == 0) {
|
||||
gSaveContext.cutsceneIndex = 0;
|
||||
}
|
||||
|
||||
for (offset = 0; offset < 8; offset++) {
|
||||
gSaveContext.playerName[offset] = fileChooseCtx->fileNames[fileChooseCtx->btnIdx][offset];
|
||||
}
|
||||
|
||||
gSaveContext.newf[0] = 'Z';
|
||||
gSaveContext.newf[1] = 'E';
|
||||
gSaveContext.newf[2] = 'L';
|
||||
gSaveContext.newf[3] = 'D';
|
||||
gSaveContext.newf[4] = 'A';
|
||||
gSaveContext.newf[5] = 'Z';
|
||||
|
||||
gSaveContext.n64ddFlag = fileChooseCtx->n64ddFlag;
|
||||
osSyncPrintf("64DDフラグ=%d\n", fileChooseCtx->n64ddFlag);
|
||||
osSyncPrintf("newf=%x,%x,%x,%x,%x,%x\n", gSaveContext.newf[0], gSaveContext.newf[1], gSaveContext.newf[2],
|
||||
gSaveContext.newf[3], gSaveContext.newf[4], gSaveContext.newf[5]);
|
||||
osSyncPrintf("\n$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$\n");
|
||||
|
||||
ptr = (u16*)&gSaveContext;
|
||||
j = 0;
|
||||
checksum = 0;
|
||||
|
||||
for (offset = 0; offset < CHECKSUM_SIZE; offset++) {
|
||||
osSyncPrintf("%x ", *ptr);
|
||||
checksum += *ptr++;
|
||||
if (++j == 0x20u) {
|
||||
osSyncPrintf("\n");
|
||||
j = 0;
|
||||
}
|
||||
}
|
||||
|
||||
gSaveContext.checksum = checksum;
|
||||
osSyncPrintf("\nチェックサム=%x\n", gSaveContext.checksum); // Checksum = %x
|
||||
|
||||
offset = gSramSlotOffsets[0][gSaveContext.fileNum];
|
||||
osSyncPrintf("I=%x no=%d\n", offset, gSaveContext.fileNum);
|
||||
MemCopy(sramCtx->readBuff + offset, &gSaveContext, sizeof(Save));
|
||||
|
||||
offset = gSramSlotOffsets[1][gSaveContext.fileNum];
|
||||
osSyncPrintf("I=%x no=%d\n", offset, gSaveContext.fileNum + 3);
|
||||
MemCopy(sramCtx->readBuff + offset, &gSaveContext, sizeof(Save));
|
||||
|
||||
SsSram_ReadWrite(OS_K1_TO_PHYSICAL(0xA8000000), sramCtx->readBuff, SRAM_SIZE, OS_WRITE);
|
||||
|
||||
// SAVE end
|
||||
osSyncPrintf("SAVE終了\n");
|
||||
osSyncPrintf("z_common_data.file_no = %d\n", gSaveContext.fileNum);
|
||||
osSyncPrintf("SAVECT=%x, NAME=%x, LIFE=%x, ITEM=%x, SAVE_64DD=%x\n", DEATHS, NAME, HEALTH_CAP, QUEST, N64DD);
|
||||
|
||||
j = gSramSlotOffsets[0][gSaveContext.fileNum];
|
||||
|
||||
MemCopy(&fileChooseCtx->deaths[gSaveContext.fileNum], sramCtx->readBuff + j + DEATHS,
|
||||
sizeof(fileChooseCtx->deaths[0]));
|
||||
MemCopy(&fileChooseCtx->fileNames[gSaveContext.fileNum], sramCtx->readBuff + j + NAME,
|
||||
sizeof(fileChooseCtx->fileNames[0]));
|
||||
MemCopy(&fileChooseCtx->healthCapacities[gSaveContext.fileNum], sramCtx->readBuff + j + HEALTH_CAP,
|
||||
sizeof(fileChooseCtx->healthCapacities[0]));
|
||||
MemCopy(&fileChooseCtx->questItems[gSaveContext.fileNum], sramCtx->readBuff + j + QUEST,
|
||||
sizeof(fileChooseCtx->questItems[0]));
|
||||
MemCopy(&fileChooseCtx->n64ddFlags[gSaveContext.fileNum], sramCtx->readBuff + j + N64DD,
|
||||
sizeof(fileChooseCtx->n64ddFlags[0]));
|
||||
MemCopy(&fileChooseCtx->heartStatus[gSaveContext.fileNum], sramCtx->readBuff + j + DEFENSE,
|
||||
sizeof(fileChooseCtx->heartStatus[0]));
|
||||
MemCopy(&fileChooseCtx->nowLife[gSaveContext.fileNum], sramCtx->readBuff + j + HEALTH,
|
||||
sizeof(fileChooseCtx->nowLife[0]));
|
||||
|
||||
osSyncPrintf("f_64dd[%d]=%d\n", gSaveContext.fileNum, fileChooseCtx->n64ddFlags[gSaveContext.fileNum]);
|
||||
osSyncPrintf("heart_status[%d]=%d\n", gSaveContext.fileNum, fileChooseCtx->heartStatus[gSaveContext.fileNum]);
|
||||
osSyncPrintf("now_life[%d]=%d\n", gSaveContext.fileNum, fileChooseCtx->nowLife[gSaveContext.fileNum]);
|
||||
}
|
||||
|
||||
void Sram_EraseSave(FileChooseContext* fileChooseCtx, SramContext* sramCtx) {
|
||||
s32 offset;
|
||||
|
||||
Sram_InitNewSave();
|
||||
|
||||
offset = gSramSlotOffsets[0][fileChooseCtx->selectedFileIdx];
|
||||
MemCopy(sramCtx->readBuff + offset, &gSaveContext, sizeof(Save));
|
||||
SsSram_ReadWrite(OS_K1_TO_PHYSICAL(0xA8000000) + offset, &gSaveContext, SLOT_SIZE, OS_WRITE);
|
||||
|
||||
MemCopy(&fileChooseCtx->n64ddFlags[fileChooseCtx->selectedFileIdx], sramCtx->readBuff + offset + N64DD,
|
||||
sizeof(fileChooseCtx->n64ddFlags[0]));
|
||||
|
||||
offset = gSramSlotOffsets[1][fileChooseCtx->selectedFileIdx];
|
||||
MemCopy(sramCtx->readBuff + offset, &gSaveContext, sizeof(Save));
|
||||
SsSram_ReadWrite(OS_K1_TO_PHYSICAL(0xA8000000) + offset, &gSaveContext, SLOT_SIZE, OS_WRITE);
|
||||
|
||||
osSyncPrintf("CLEAR終了\n");
|
||||
}
|
||||
|
||||
void Sram_CopySave(FileChooseContext* fileChooseCtx, SramContext* sramCtx) {
|
||||
s32 offset;
|
||||
|
||||
osSyncPrintf("READ=%d(%x) COPY=%d(%x)\n", fileChooseCtx->selectedFileIdx,
|
||||
gSramSlotOffsets[0][fileChooseCtx->selectedFileIdx], fileChooseCtx->copyDestFileIdx,
|
||||
gSramSlotOffsets[0][fileChooseCtx->copyDestFileIdx]);
|
||||
|
||||
offset = gSramSlotOffsets[0][fileChooseCtx->selectedFileIdx];
|
||||
MemCopy(&gSaveContext, sramCtx->readBuff + offset, sizeof(Save));
|
||||
|
||||
offset = gSramSlotOffsets[0][fileChooseCtx->copyDestFileIdx];
|
||||
MemCopy(sramCtx->readBuff + offset, &gSaveContext, sizeof(Save));
|
||||
|
||||
offset = gSramSlotOffsets[1][fileChooseCtx->copyDestFileIdx];
|
||||
MemCopy(sramCtx->readBuff + offset, &gSaveContext, sizeof(Save));
|
||||
|
||||
SsSram_ReadWrite(OS_K1_TO_PHYSICAL(0xA8000000), sramCtx->readBuff, SRAM_SIZE, OS_WRITE);
|
||||
|
||||
offset = gSramSlotOffsets[0][fileChooseCtx->copyDestFileIdx];
|
||||
|
||||
MemCopy(&fileChooseCtx->deaths[fileChooseCtx->copyDestFileIdx], sramCtx->readBuff + offset + DEATHS,
|
||||
sizeof(fileChooseCtx->deaths[0]));
|
||||
MemCopy(&fileChooseCtx->fileNames[fileChooseCtx->copyDestFileIdx], sramCtx->readBuff + offset + NAME,
|
||||
sizeof(fileChooseCtx->fileNames[0]));
|
||||
MemCopy(&fileChooseCtx->healthCapacities[fileChooseCtx->copyDestFileIdx], sramCtx->readBuff + offset + HEALTH_CAP,
|
||||
sizeof(fileChooseCtx->healthCapacities[0]));
|
||||
MemCopy(&fileChooseCtx->questItems[fileChooseCtx->copyDestFileIdx], sramCtx->readBuff + offset + QUEST,
|
||||
sizeof(fileChooseCtx->questItems[0]));
|
||||
MemCopy(&fileChooseCtx->n64ddFlags[fileChooseCtx->copyDestFileIdx], sramCtx->readBuff + offset + N64DD,
|
||||
sizeof(fileChooseCtx->n64ddFlags[0]));
|
||||
MemCopy(&fileChooseCtx->heartStatus[fileChooseCtx->copyDestFileIdx], sramCtx->readBuff + offset + DEFENSE,
|
||||
sizeof(fileChooseCtx->heartStatus[0]));
|
||||
MemCopy(&fileChooseCtx->nowLife[fileChooseCtx->copyDestFileIdx], (sramCtx->readBuff + offset) + HEALTH,
|
||||
sizeof(fileChooseCtx->nowLife[0]));
|
||||
|
||||
osSyncPrintf("f_64dd[%d]=%d\n", gSaveContext.fileNum, fileChooseCtx->n64ddFlags[gSaveContext.fileNum]);
|
||||
osSyncPrintf("heart_status[%d]=%d\n", gSaveContext.fileNum, fileChooseCtx->heartStatus[gSaveContext.fileNum]);
|
||||
osSyncPrintf("COPY終了\n"); // Copy end
|
||||
}
|
||||
|
||||
void Sram_Write16Bytes(SramContext* sramCtx) {
|
||||
SsSram_ReadWrite(OS_K1_TO_PHYSICAL(0xA8000000), sramCtx->readBuff, 0x10, OS_WRITE);
|
||||
}
|
||||
|
||||
void Sram_InitSram(GameState* gameState, SramContext* sramCtx) {
|
||||
u16 i;
|
||||
|
||||
osSyncPrintf("sram_initialize( Game *game, Sram *sram )\n");
|
||||
SsSram_ReadWrite(OS_K1_TO_PHYSICAL(0xA8000000), sramCtx->readBuff, SRAM_SIZE, OS_READ);
|
||||
|
||||
for (i = 0; i < ARRAY_COUNTU(sZeldaMagic) - 3; i++) {
|
||||
if (sZeldaMagic[i + 3] != sramCtx->readBuff[i + 3]) {
|
||||
// SRAM destruction! ! ! ! ! !
|
||||
osSyncPrintf("SRAM破壊!!!!!!\n");
|
||||
gSaveContext.language = sramCtx->readBuff[2];
|
||||
MemCopy(sramCtx->readBuff, sZeldaMagic, sizeof(sZeldaMagic));
|
||||
sramCtx->readBuff[2] = gSaveContext.language;
|
||||
Sram_Write16Bytes(sramCtx);
|
||||
}
|
||||
}
|
||||
|
||||
gSaveContext.audioSetting = sramCtx->readBuff[0] & 3;
|
||||
gSaveContext.zTargetSetting = sramCtx->readBuff[1] & 1;
|
||||
gSaveContext.language = sramCtx->readBuff[2];
|
||||
|
||||
if (gSaveContext.language > 2) {
|
||||
gSaveContext.language = 0;
|
||||
sramCtx->readBuff[2] = gSaveContext.language;
|
||||
Sram_Write16Bytes(sramCtx);
|
||||
}
|
||||
|
||||
if (CHECK_BTN_ANY(gameState->input[2].cur.button, BTN_DRIGHT)) {
|
||||
bzero(sramCtx->readBuff, SRAM_SIZE);
|
||||
for (i = 0; i < CHECKSUM_SIZE; i++) {
|
||||
sramCtx->readBuff[i] = i;
|
||||
}
|
||||
SsSram_ReadWrite(OS_K1_TO_PHYSICAL(0xA8000000), sramCtx->readBuff, SRAM_SIZE, OS_WRITE);
|
||||
// SRAM destruction! ! ! ! ! !
|
||||
osSyncPrintf("SRAM破壊!!!!!!\n");
|
||||
}
|
||||
|
||||
// GOOD! GOOD! Size =% d +% d =% d
|
||||
osSyncPrintf("GOOD!GOOD! サイズ=%d + %d = %d\n", sizeof(SaveInfo), 4, sizeof(SaveInfo) + 4);
|
||||
osSyncPrintf(VT_FGCOL(BLUE));
|
||||
osSyncPrintf("Na_SetSoundOutputMode = %d\n", gSaveContext.audioSetting);
|
||||
osSyncPrintf("Na_SetSoundOutputMode = %d\n", gSaveContext.audioSetting);
|
||||
osSyncPrintf("Na_SetSoundOutputMode = %d\n", gSaveContext.audioSetting);
|
||||
osSyncPrintf(VT_RST);
|
||||
func_800F6700(gSaveContext.audioSetting);
|
||||
}
|
||||
|
||||
void Sram_Alloc(GameState* gameState, SramContext* sramCtx) {
|
||||
sramCtx->readBuff = GameState_Alloc(gameState, SRAM_SIZE, "../z_sram.c", 1294);
|
||||
|
||||
if (!(sramCtx->readBuff != NULL)) {
|
||||
__assert("sram->read_buff != NULL", "../z_sram.c", 1295);
|
||||
}
|
||||
}
|
||||
|
||||
void Sram_Init(GlobalContext* globalCtx, SramContext* sramCtx) {
|
||||
}
|
||||
|
|
53
src/code/z_ss_sram.c
Normal file
53
src/code/z_ss_sram.c
Normal file
|
@ -0,0 +1,53 @@
|
|||
#include "ultra64.h"
|
||||
#include "global.h"
|
||||
|
||||
typedef struct {
|
||||
/* 0x00 */ OSPiHandle piHandle;
|
||||
/* 0x74 */ OSIoMesg ioMesg;
|
||||
/* 0x8C */ OSMesgQueue mesgQ;
|
||||
} SsSramContext; // size = 0xA4
|
||||
|
||||
SsSramContext sSsSramContext = { 0 };
|
||||
|
||||
void SsSram_Init(u32 addr, u8 handleType, u8 handleDomain, u8 handleLatency, u8 handlePageSize, u8 handleRelDuration,
|
||||
u8 handlePulse, u32 handleSpeed) {
|
||||
u32 intDisabled;
|
||||
OSPiHandle* handle = &sSsSramContext.piHandle;
|
||||
|
||||
if ((u32)OS_PHYSICAL_TO_K1(addr) != (*handle).baseAddress) {
|
||||
sSsSramContext.piHandle.type = handleType;
|
||||
(*handle).baseAddress = OS_PHYSICAL_TO_K1(addr);
|
||||
sSsSramContext.piHandle.latency = handleLatency;
|
||||
sSsSramContext.piHandle.pulse = handlePulse;
|
||||
sSsSramContext.piHandle.pageSize = handlePageSize;
|
||||
sSsSramContext.piHandle.relDuration = handleRelDuration;
|
||||
sSsSramContext.piHandle.domain = handleDomain;
|
||||
sSsSramContext.piHandle.speed = handleSpeed;
|
||||
bzero(&sSsSramContext.piHandle.transferInfo, sizeof(__OSTranxInfo));
|
||||
intDisabled = __osDisableInt();
|
||||
sSsSramContext.piHandle.next = __osPiTable;
|
||||
__osPiTable = &sSsSramContext.piHandle;
|
||||
__osRestoreInt(intDisabled);
|
||||
sSsSramContext.ioMesg.hdr.pri = 0;
|
||||
sSsSramContext.ioMesg.hdr.retQueue = &sSsSramContext.mesgQ;
|
||||
sSsSramContext.ioMesg.devAddr = addr;
|
||||
}
|
||||
}
|
||||
|
||||
void SsSram_Dma(void* dramAddr, size_t size, s32 direction) {
|
||||
OSMesg mesg;
|
||||
|
||||
osCreateMesgQueue(&sSsSramContext.mesgQ, &mesg, 1);
|
||||
sSsSramContext.ioMesg.dramAddr = dramAddr;
|
||||
sSsSramContext.ioMesg.size = size;
|
||||
osWritebackDCache(dramAddr, size);
|
||||
osEPiStartDma(&sSsSramContext.piHandle, &sSsSramContext.ioMesg, direction);
|
||||
osRecvMesg(&sSsSramContext.mesgQ, &mesg, OS_MESG_BLOCK);
|
||||
osInvalDCache(dramAddr, size);
|
||||
}
|
||||
|
||||
void SsSram_ReadWrite(u32 addr, void* dramAddr, size_t size, s32 direction) {
|
||||
osSyncPrintf("ssSRAMReadWrite:%08x %08x %08x %d\n", addr, dramAddr, size, direction);
|
||||
SsSram_Init(addr, DEVICE_TYPE_SRAM, 1, 5, 0xD, 2, 0xC, 0);
|
||||
SsSram_Dma(dramAddr, size, direction);
|
||||
}
|
|
@ -5,6 +5,7 @@
|
|||
*/
|
||||
|
||||
#include "z_bg_gnd_soulmeiro.h"
|
||||
#include "global.h"
|
||||
|
||||
#define FLAGS 0x00000000
|
||||
|
||||
|
@ -19,7 +20,6 @@ void func_8087AF38(BgGndSoulmeiro* this, GlobalContext* globalCtx);
|
|||
void func_8087B284(BgGndSoulmeiro* this, GlobalContext* globalCtx);
|
||||
void func_8087B350(BgGndSoulmeiro* this, GlobalContext* globalCtx);
|
||||
|
||||
/*
|
||||
const ActorInit Bg_Gnd_Soulmeiro_InitVars = {
|
||||
ACTOR_BG_GND_SOULMEIRO,
|
||||
ACTORTYPE_PROP,
|
||||
|
@ -31,17 +31,183 @@ const ActorInit Bg_Gnd_Soulmeiro_InitVars = {
|
|||
(ActorFunc)BgGndSoulmeiro_Update,
|
||||
(ActorFunc)BgGndSoulmeiro_Draw,
|
||||
};
|
||||
*/
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_Bg_Gnd_Soulmeiro/BgGndSoulmeiro_Init.s")
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_Bg_Gnd_Soulmeiro/BgGndSoulmeiro_Destroy.s")
|
||||
static ColliderCylinderInit sCylinderInit = {
|
||||
{ COLTYPE_UNK10, 0x00, 0x09, 0x00, 0x10, COLSHAPE_CYLINDER },
|
||||
{ 0x00, { 0xFFCFFFFF, 0x00, 0x00 }, { 0x00020800, 0x00, 0x00 }, 0x00, 0x01, 0x00 },
|
||||
{ 50, 20, 20, { 0, 0, 0 } },
|
||||
};
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_Bg_Gnd_Soulmeiro/func_8087AF38.s")
|
||||
static InitChainEntry sInitChain[] = {
|
||||
ICHAIN_VEC3F_DIV1000(scale, 100, ICHAIN_CONTINUE),
|
||||
ICHAIN_F32(uncullZoneForward, 1000, ICHAIN_CONTINUE),
|
||||
ICHAIN_F32(uncullZoneScale, 1000, ICHAIN_CONTINUE),
|
||||
ICHAIN_F32(uncullZoneDownward, 1000, ICHAIN_STOP),
|
||||
};
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_Bg_Gnd_Soulmeiro/func_8087B284.s")
|
||||
static Vec3f sZeroVec = { 0.0f, 0.0f, 0.0f };
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_Bg_Gnd_Soulmeiro/func_8087B350.s")
|
||||
Gfx* D_8087B578[] = { 0x06007C00, 0x06002320, 0x060035A0 };
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_Bg_Gnd_Soulmeiro/BgGndSoulmeiro_Update.s")
|
||||
void BgGndSoulmeiro_Init(Actor* thisx, GlobalContext* globalCtx) {
|
||||
BgGndSoulmeiro* this = THIS;
|
||||
s32 pad;
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_Bg_Gnd_Soulmeiro/BgGndSoulmeiro_Draw.s")
|
||||
Actor_ProcessInitChain(&this->actor, sInitChain);
|
||||
this->actionFunc = NULL;
|
||||
|
||||
switch (this->actor.params & 0xFF) {
|
||||
case 0:
|
||||
Collider_InitCylinder(globalCtx, &this->collider);
|
||||
Collider_SetCylinder(globalCtx, &this->collider, &this->actor, &sCylinderInit);
|
||||
this->actionFunc = func_8087B284;
|
||||
if (Flags_GetSwitch(globalCtx, (this->actor.params >> 8) & 0x3F)) {
|
||||
|
||||
Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_MIR_RAY, this->actor.posRot.pos.x,
|
||||
this->actor.posRot.pos.y, this->actor.posRot.pos.z, 0, 0, 0, 9);
|
||||
this->actor.draw = NULL;
|
||||
Actor_Kill(&this->actor);
|
||||
return;
|
||||
} else {
|
||||
this->actor.draw = BgGndSoulmeiro_Draw;
|
||||
}
|
||||
break;
|
||||
case 1:
|
||||
case 2:
|
||||
if (Flags_GetSwitch(globalCtx, (this->actor.params >> 8) & 0x3F)) {
|
||||
this->actor.draw = BgGndSoulmeiro_Draw;
|
||||
} else {
|
||||
this->actor.draw = NULL;
|
||||
}
|
||||
this->actionFunc = func_8087B350;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void BgGndSoulmeiro_Destroy(Actor* thisx, GlobalContext* globalCtx) {
|
||||
BgGndSoulmeiro* this = THIS;
|
||||
|
||||
if ((this->actor.params & 0xFF) == 0) {
|
||||
Collider_DestroyCylinder(globalCtx, &this->collider);
|
||||
}
|
||||
}
|
||||
|
||||
void func_8087AF38(BgGndSoulmeiro* this, GlobalContext* globalCtx) {
|
||||
Vec3f vecA;
|
||||
Vec3f vecB;
|
||||
s16 temp_1;
|
||||
s16 temp_2;
|
||||
f32 temp_3;
|
||||
f32 temp_4;
|
||||
f32 distXZ;
|
||||
s32 i;
|
||||
BgGndSoulmeiro* this2;
|
||||
|
||||
if (this->unk_198 != 0) {
|
||||
this->unk_198--;
|
||||
}
|
||||
|
||||
if (this->unk_198 == 20) {
|
||||
Flags_SetSwitch(globalCtx, (this->actor.params >> 8) & 0x3F);
|
||||
this->actor.draw = NULL;
|
||||
}
|
||||
|
||||
// This should be this->unk_198 == 0, this is required to match
|
||||
if (!this->unk_198) {
|
||||
Flags_SetSwitch(globalCtx, (this->actor.params >> 8) & 0x3F);
|
||||
Actor_Kill(&this->actor);
|
||||
Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_MIR_RAY, this->actor.posRot.pos.x, this->actor.posRot.pos.y,
|
||||
this->actor.posRot.pos.z, 0, 0, 0, 9);
|
||||
return;
|
||||
}
|
||||
|
||||
if (1) {}
|
||||
|
||||
if ((this->unk_198 % 6) == 0) {
|
||||
temp_2 = Math_Rand_ZeroOne() * (10922.0f); // This should be: 0x10000 / 6.0f
|
||||
vecA.y = 0.0f;
|
||||
vecB.y = this->actor.posRot.pos.y;
|
||||
|
||||
this2 = this;
|
||||
for (i = 0; i < 6; i++) {
|
||||
temp_1 = Math_Rand_CenteredFloat(0x2800) + temp_2;
|
||||
temp_3 = Math_Sins(temp_1);
|
||||
temp_4 = Math_Coss(temp_1);
|
||||
vecB.x = this2->actor.posRot.pos.x + (120.0f * temp_3);
|
||||
vecB.z = this2->actor.posRot.pos.z + (120.0f * temp_4);
|
||||
distXZ = Math_Vec3f_DistXZ(&this2->actor.initPosRot.pos, &vecB) * (1.0f / 120.f);
|
||||
if (distXZ < 0.7f) {
|
||||
temp_3 = Math_Sins(temp_1 + 0x8000);
|
||||
temp_4 = Math_Coss(temp_1 + 0x8000);
|
||||
vecB.x = this->actor.posRot.pos.x + (120.0f * temp_3);
|
||||
vecB.z = this->actor.posRot.pos.z + (120.0f * temp_4);
|
||||
distXZ = Math_Vec3f_DistXZ(&this->actor.initPosRot.pos, &vecB) * (1.0f / 120.f);
|
||||
}
|
||||
|
||||
vecA.x = 4.0f * temp_3 * distXZ;
|
||||
vecA.y = 0.0f;
|
||||
vecA.z = 4.0f * temp_4 * distXZ;
|
||||
EffectSsDeadDb_Spawn(globalCtx, &this->actor.initPosRot.pos, &vecA, &sZeroVec, 60, 6, 255, 255, 150, 170,
|
||||
255, 0, 0, 1, 14, true);
|
||||
temp_2 += 0x2AAA;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void func_8087B284(BgGndSoulmeiro* this, GlobalContext* globalCtx) {
|
||||
s32 pad;
|
||||
|
||||
if (!Flags_GetSwitch(globalCtx, (this->actor.params >> 8) & 0x3F)) {
|
||||
this->actor.draw = BgGndSoulmeiro_Draw;
|
||||
if (this->collider.base.acFlags & 2) {
|
||||
Audio_PlaySoundGeneral(NA_SE_SY_CORRECT_CHIME, &D_801333D4, 4, &D_801333E0, &D_801333E0, &D_801333E8);
|
||||
this->unk_198 = 40;
|
||||
this->actionFunc = func_8087AF38;
|
||||
return;
|
||||
}
|
||||
Collider_CylinderUpdate(&this->actor, &this->collider);
|
||||
CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->collider.base);
|
||||
}
|
||||
}
|
||||
|
||||
void func_8087B350(BgGndSoulmeiro* this, GlobalContext* globalCtx) {
|
||||
|
||||
if (Flags_GetSwitch(globalCtx, (this->actor.params >> 8) & 0x3F)) {
|
||||
this->actor.draw = BgGndSoulmeiro_Draw;
|
||||
} else {
|
||||
this->actor.draw = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
void BgGndSoulmeiro_Update(Actor* thisx, GlobalContext* globalCtx) {
|
||||
BgGndSoulmeiro* this = THIS;
|
||||
|
||||
if (this->actionFunc != NULL) {
|
||||
this->actionFunc(this, globalCtx);
|
||||
}
|
||||
}
|
||||
|
||||
void BgGndSoulmeiro_Draw(Actor* thisx, GlobalContext* globalCtx) {
|
||||
s32 params = thisx->params & 0xFF;
|
||||
|
||||
if (1) {}
|
||||
|
||||
switch (params) {
|
||||
case 0:
|
||||
OPEN_DISPS(globalCtx->state.gfxCtx, "../z_bg_gnd_soulmeiro.c", 398);
|
||||
|
||||
func_80093D84(globalCtx->state.gfxCtx);
|
||||
gSPMatrix(oGfxCtx->polyXlu.p++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_bg_gnd_soulmeiro.c", 400),
|
||||
G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
|
||||
|
||||
gSPDisplayList(oGfxCtx->polyXlu.p++, D_8087B578[params]);
|
||||
CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_bg_gnd_soulmeiro.c", 403);
|
||||
break;
|
||||
case 1:
|
||||
Gfx_DrawDListXlu(globalCtx, D_8087B578[params]);
|
||||
break;
|
||||
case 2:
|
||||
Gfx_DrawDListOpa(globalCtx, D_8087B578[params]);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -10,7 +10,8 @@ typedef void (*BgGndSoulmeiroActionFunc)(struct BgGndSoulmeiro*, GlobalContext*)
|
|||
|
||||
typedef struct BgGndSoulmeiro {
|
||||
/* 0x0000 */ Actor actor;
|
||||
/* 0x014C */ char unk_14C[0x50];
|
||||
/* 0x014C */ ColliderCylinder collider;
|
||||
/* 0x0198 */ u16 unk_198;
|
||||
/* 0x019C */ BgGndSoulmeiroActionFunc actionFunc;
|
||||
} BgGndSoulmeiro; // size = 0x01A0
|
||||
|
||||
|
|
|
@ -1,3 +1,9 @@
|
|||
/*
|
||||
* File: z_bg_haka_meganebg.c
|
||||
* Overlay: ovl_Bg_Haka_MeganeBG
|
||||
* Description:
|
||||
*/
|
||||
|
||||
#include "z_bg_haka_meganebg.h"
|
||||
|
||||
#define FLAGS 0x00000000
|
||||
|
@ -9,12 +15,15 @@ void BgHakaMeganeBG_Destroy(Actor* thisx, GlobalContext* globalCtx);
|
|||
void BgHakaMeganeBG_Update(Actor* thisx, GlobalContext* globalCtx);
|
||||
void BgHakaMeganeBG_Draw(Actor* thisx, GlobalContext* globalCtx);
|
||||
|
||||
void func_8087DFF8(BgHakaMeganeBG* this, GlobalContext* globalCtx);
|
||||
void func_8087E040(BgHakaMeganeBG* this, GlobalContext* globalCtx);
|
||||
void func_8087E10C(BgHakaMeganeBG* this, GlobalContext* globalCtx);
|
||||
void func_8087E1E0(BgHakaMeganeBG* this, GlobalContext* globalCtx);
|
||||
void func_8087E258(BgHakaMeganeBG* this, GlobalContext* globalCtx);
|
||||
void func_8087E288(BgHakaMeganeBG* this, GlobalContext* globalCtx);
|
||||
void func_8087E2D8(BgHakaMeganeBG* this, GlobalContext* globalCtx);
|
||||
void func_8087E34C(BgHakaMeganeBG* this, GlobalContext* globalCtx);
|
||||
|
||||
/*
|
||||
const ActorInit Bg_Haka_MeganeBG_InitVars = {
|
||||
ACTOR_BG_HAKA_MEGANEBG,
|
||||
ACTORTYPE_BG,
|
||||
|
@ -26,27 +35,193 @@ const ActorInit Bg_Haka_MeganeBG_InitVars = {
|
|||
(ActorFunc)BgHakaMeganeBG_Update,
|
||||
(ActorFunc)BgHakaMeganeBG_Draw,
|
||||
};
|
||||
*/
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_Bg_Haka_MeganeBG/BgHakaMeganeBG_Init.s")
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_Bg_Haka_MeganeBG/BgHakaMeganeBG_Destroy.s")
|
||||
static InitChainEntry sInitChain[] = {
|
||||
ICHAIN_F32(uncullZoneScale, 1000, ICHAIN_CONTINUE),
|
||||
ICHAIN_F32(uncullZoneDownward, 1000, ICHAIN_CONTINUE),
|
||||
ICHAIN_VEC3F_DIV1000(scale, 100, ICHAIN_STOP),
|
||||
};
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_Bg_Haka_MeganeBG/func_8087DFF8.s")
|
||||
// Unused
|
||||
static u32 D_8087E3FC[] = {
|
||||
0x00000000, 0x00000000, 0x00000000, 0xC8C800FF, 0xFF0000FF,
|
||||
};
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_Bg_Haka_MeganeBG/func_8087E040.s")
|
||||
static Gfx* D_8087E410[] = {
|
||||
0x06008EB0,
|
||||
0x0600A1A0,
|
||||
0x06005000,
|
||||
0x06000040,
|
||||
};
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_Bg_Haka_MeganeBG/func_8087E10C.s")
|
||||
extern UNK_TYPE D_06000118;
|
||||
extern UNK_TYPE D_06005334;
|
||||
extern Gfx D_06008EB0[];
|
||||
extern UNK_TYPE D_06009168;
|
||||
extern UNK_TYPE D_0600A7F4;
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_Bg_Haka_MeganeBG/func_8087E1E0.s")
|
||||
void BgHakaMeganeBG_Init(Actor* thisx, GlobalContext* globalCtx) {
|
||||
s32 pad;
|
||||
BgHakaMeganeBG* this = THIS;
|
||||
s32 localC = 0;
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_Bg_Haka_MeganeBG/func_8087E258.s")
|
||||
Actor_ProcessInitChain(&this->dyna.actor, sInitChain);
|
||||
this->unk_168 = (thisx->params >> 8) & 0xFF;
|
||||
thisx->params &= 0xFF;
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_Bg_Haka_MeganeBG/func_8087E288.s")
|
||||
if (thisx->params == 2) {
|
||||
DynaPolyInfo_SetActorMove(&this->dyna, 3);
|
||||
thisx->flags |= 0x10;
|
||||
DynaPolyInfo_Alloc(&D_06005334, &localC);
|
||||
this->actionFunc = func_8087E258;
|
||||
} else {
|
||||
DynaPolyInfo_SetActorMove(&this->dyna, 1);
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_Bg_Haka_MeganeBG/func_8087E2D8.s")
|
||||
if (thisx->params == 0) {
|
||||
DynaPolyInfo_Alloc(&D_06009168, &localC);
|
||||
thisx->flags |= 0x80;
|
||||
this->unk_16A = 20;
|
||||
this->actionFunc = func_8087DFF8;
|
||||
} else if (thisx->params == 3) {
|
||||
DynaPolyInfo_Alloc(&D_06000118, &localC);
|
||||
thisx->initPosRot.pos.y += 100.0f;
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_Bg_Haka_MeganeBG/func_8087E34C.s")
|
||||
if (Flags_GetSwitch(globalCtx, this->unk_168)) {
|
||||
this->actionFunc = func_8087E34C;
|
||||
thisx->posRot.pos.y = thisx->initPosRot.pos.y;
|
||||
} else {
|
||||
thisx->flags |= 0x10;
|
||||
this->actionFunc = func_8087E288;
|
||||
}
|
||||
} else {
|
||||
DynaPolyInfo_Alloc(&D_0600A7F4, &localC);
|
||||
this->unk_16A = 80;
|
||||
this->actionFunc = func_8087E10C;
|
||||
thisx->uncullZoneScale = 3000.0f;
|
||||
thisx->uncullZoneDownward = 3000.0f;
|
||||
}
|
||||
}
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_Bg_Haka_MeganeBG/BgHakaMeganeBG_Update.s")
|
||||
this->dyna.dynaPolyId = DynaPolyInfo_RegisterActor(globalCtx, &globalCtx->colCtx.dyna, &this->dyna.actor, localC);
|
||||
}
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_Bg_Haka_MeganeBG/BgHakaMeganeBG_Draw.s")
|
||||
void BgHakaMeganeBG_Destroy(Actor* thisx, GlobalContext* globalCtx) {
|
||||
BgHakaMeganeBG* this = THIS;
|
||||
|
||||
DynaPolyInfo_Free(globalCtx, &globalCtx->colCtx.dyna, this->dyna.dynaPolyId);
|
||||
}
|
||||
|
||||
void func_8087DFF8(BgHakaMeganeBG* this, GlobalContext* globalCtx) {
|
||||
if (this->unk_16A != 0) {
|
||||
this->unk_16A--;
|
||||
}
|
||||
|
||||
if (this->unk_16A == 0) {
|
||||
this->unk_16A = 40;
|
||||
this->dyna.actor.posRot.rot.y += 0x8000;
|
||||
this->actionFunc = func_8087E040;
|
||||
}
|
||||
}
|
||||
|
||||
void func_8087E040(BgHakaMeganeBG* this, GlobalContext* globalCtx) {
|
||||
f32 xSub;
|
||||
|
||||
if (this->unk_16A != 0) {
|
||||
this->unk_16A--;
|
||||
}
|
||||
|
||||
xSub = (sinf(((this->unk_16A * 0.025f) + 0.5f) * M_PI) + 1.0f) * 160.0f;
|
||||
|
||||
if (this->dyna.actor.posRot.rot.y != this->dyna.actor.shape.rot.y) {
|
||||
xSub = 320.0f - xSub;
|
||||
}
|
||||
|
||||
this->dyna.actor.posRot.pos.x = this->dyna.actor.initPosRot.pos.x - xSub;
|
||||
|
||||
if (this->unk_16A == 0) {
|
||||
this->unk_16A = 20;
|
||||
this->actionFunc = func_8087DFF8;
|
||||
}
|
||||
}
|
||||
|
||||
void func_8087E10C(BgHakaMeganeBG* this, GlobalContext* globalCtx) {
|
||||
this->dyna.actor.velocity.y += 1.0f;
|
||||
|
||||
if (this->dyna.actor.velocity.y > 20.0f) {
|
||||
this->dyna.actor.velocity.y = 20.0f;
|
||||
} else {
|
||||
this->dyna.actor.velocity.y = this->dyna.actor.velocity.y;
|
||||
}
|
||||
|
||||
if (this->unk_16A != 0) {
|
||||
this->unk_16A--;
|
||||
}
|
||||
|
||||
if (!Math_ApproxF(&this->dyna.actor.posRot.pos.y, this->dyna.actor.initPosRot.pos.y - 640.0f,
|
||||
this->dyna.actor.velocity.y)) {
|
||||
func_8002F974(&this->dyna.actor, NA_SE_EV_CHINETRAP_DOWN - SFX_FLAG);
|
||||
}
|
||||
|
||||
if (this->unk_16A == 0) {
|
||||
this->unk_16A = 120;
|
||||
this->actionFunc = func_8087E1E0;
|
||||
this->dyna.actor.velocity.y = 0.0f;
|
||||
}
|
||||
}
|
||||
|
||||
void func_8087E1E0(BgHakaMeganeBG* this, GlobalContext* globalCtx) {
|
||||
Math_ApproxF(&this->dyna.actor.posRot.pos.y, this->dyna.actor.initPosRot.pos.y, 16.0f / 3.0f);
|
||||
func_8002F974(&this->dyna.actor, NA_SE_EV_BRIDGE_CLOSE - SFX_FLAG);
|
||||
|
||||
if (this->unk_16A != 0) {
|
||||
this->unk_16A--;
|
||||
}
|
||||
|
||||
if (this->unk_16A == 0) {
|
||||
this->unk_16A = 80;
|
||||
this->actionFunc = func_8087E10C;
|
||||
}
|
||||
}
|
||||
|
||||
void func_8087E258(BgHakaMeganeBG* this, GlobalContext* globalCtx) {
|
||||
this->dyna.actor.shape.rot.y += 0x180;
|
||||
func_8002F974(&this->dyna.actor, NA_SE_EV_ELEVATOR_MOVE - SFX_FLAG);
|
||||
}
|
||||
|
||||
void func_8087E288(BgHakaMeganeBG* this, GlobalContext* globalCtx) {
|
||||
if (Flags_GetSwitch(globalCtx, this->unk_168)) {
|
||||
func_80080480(globalCtx, &this->dyna.actor);
|
||||
this->actionFunc = func_8087E2D8;
|
||||
}
|
||||
}
|
||||
|
||||
void func_8087E2D8(BgHakaMeganeBG* this, GlobalContext* globalCtx) {
|
||||
Math_ApproxF(&this->dyna.actor.speedXZ, 30.0f, 2.0f);
|
||||
|
||||
if (Math_ApproxF(&this->dyna.actor.posRot.pos.y, this->dyna.actor.initPosRot.pos.y, this->dyna.actor.speedXZ)) {
|
||||
Actor_SetHeight(&this->dyna.actor, 50.0f);
|
||||
this->actionFunc = func_8087E34C;
|
||||
} else {
|
||||
func_8002F974(&this->dyna.actor, NA_SE_EV_METALDOOR_OPEN);
|
||||
}
|
||||
}
|
||||
|
||||
void func_8087E34C(BgHakaMeganeBG* this, GlobalContext* globalCtx) {
|
||||
}
|
||||
|
||||
void BgHakaMeganeBG_Update(Actor* thisx, GlobalContext* globalCtx) {
|
||||
BgHakaMeganeBG* this = THIS;
|
||||
|
||||
this->actionFunc(this, globalCtx);
|
||||
}
|
||||
|
||||
void BgHakaMeganeBG_Draw(Actor* thisx, GlobalContext* globalCtx) {
|
||||
BgHakaMeganeBG* this = THIS;
|
||||
s16 params = this->dyna.actor.params;
|
||||
|
||||
if (params == 0) {
|
||||
Gfx_DrawDListXlu(globalCtx, D_06008EB0);
|
||||
} else {
|
||||
Gfx_DrawDListOpa(globalCtx, D_8087E410[params]);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -11,9 +11,8 @@ typedef void (*BgHakaMeganeBGActionFunc)(struct BgHakaMeganeBG*, GlobalContext*)
|
|||
typedef struct BgHakaMeganeBG {
|
||||
/* 0x0000 */ DynaPolyActor dyna;
|
||||
/* 0x0164 */ BgHakaMeganeBGActionFunc actionFunc;
|
||||
/* 0x0168 */ char unk_168[0x1];
|
||||
/* 0x0169 */ s8 unk_169; // objBankIndex ?
|
||||
/* 0x016A */ char unk_16A[0x2];
|
||||
/* 0x0168 */ u8 unk_168;
|
||||
/* 0x016A */ s16 unk_16A;
|
||||
} BgHakaMeganeBG; // size = 0x016C
|
||||
|
||||
extern const ActorInit Bg_Haka_Meganebg_InitVars;
|
||||
|
|
|
@ -104,7 +104,7 @@ s32 func_80994750(DoorGerudo* this, GlobalContext* globalCtx) {
|
|||
void func_8099485C(DoorGerudo* this, GlobalContext* globalCtx) {
|
||||
if (this->unk_164 != 0) {
|
||||
this->actionFunc = func_8099496C;
|
||||
gSaveContext.dungeonKeys[gSaveContext.mapIndex] -= 1;
|
||||
gSaveContext.inventory.dungeonKeys[gSaveContext.mapIndex] -= 1;
|
||||
Flags_SetSwitch(globalCtx, this->dyna.actor.params & 0x3F);
|
||||
Audio_PlayActorSound2(&this->dyna.actor, NA_SE_EV_CHAIN_KEY_UNLOCK);
|
||||
} else {
|
||||
|
@ -113,7 +113,7 @@ void func_8099485C(DoorGerudo* this, GlobalContext* globalCtx) {
|
|||
if (direction != 0) {
|
||||
Player* player = PLAYER;
|
||||
|
||||
if (gSaveContext.dungeonKeys[gSaveContext.mapIndex] <= 0) {
|
||||
if (gSaveContext.inventory.dungeonKeys[gSaveContext.mapIndex] <= 0) {
|
||||
player->naviMessageId = -0x203;
|
||||
} else if (!Flags_GetCollectible(globalCtx, (this->dyna.actor.params >> 8) & 0x1F)) {
|
||||
player->naviMessageId = -0x225;
|
||||
|
|
|
@ -1,3 +1,9 @@
|
|||
/*
|
||||
* File: z_en_butte.c
|
||||
* Overlay: ovl_En_Butte
|
||||
* Description: Butterfly
|
||||
*/
|
||||
|
||||
#include "z_en_butte.h"
|
||||
|
||||
#define FLAGS 0x00000000
|
||||
|
@ -9,7 +15,25 @@ void EnButte_Destroy(Actor* thisx, GlobalContext* globalCtx);
|
|||
void EnButte_Update(Actor* thisx, GlobalContext* globalCtx);
|
||||
void EnButte_Draw(Actor* thisx, GlobalContext* globalCtx);
|
||||
|
||||
/*
|
||||
void EnButte_SetupFlyAround(EnButte* this);
|
||||
void EnButte_FlyAround(EnButte* this, GlobalContext* globalCtx);
|
||||
void EnButte_SetupFollowLink(EnButte* this);
|
||||
void EnButte_FollowLink(EnButte* this, GlobalContext* globalCtx);
|
||||
void EnButte_SetupTransformIntoFairy(EnButte* this);
|
||||
void EnButte_TransformIntoFairy(EnButte* this, GlobalContext* globalCtx);
|
||||
void EnButte_SetupWaitToDie(EnButte* this);
|
||||
void EnButte_WaitToDie(EnButte* this, GlobalContext* globalCtx);
|
||||
|
||||
static ColliderJntSphItemInit sColliderItemInit[] = {
|
||||
{ { 0x00, { 0x00000000, 0x00, 0x00 }, { 0xFFCFFFFF, 0x000, 0x00 }, 0x00, 0x00, 0x01 },
|
||||
{ 0, { { 0, 0, 0 }, 5 }, 100 } }
|
||||
};
|
||||
static ColliderJntSphInit sColliderInit = {
|
||||
{ COLTYPE_UNK10, 0x00, 0x00, 0x19, 0x10, COLSHAPE_JNTSPH },
|
||||
1,
|
||||
sColliderItemInit,
|
||||
};
|
||||
|
||||
const ActorInit En_Butte_InitVars = {
|
||||
ACTOR_EN_BUTTE,
|
||||
ACTORTYPE_ITEMACTION,
|
||||
|
@ -21,41 +45,374 @@ const ActorInit En_Butte_InitVars = {
|
|||
(ActorFunc)EnButte_Update,
|
||||
(ActorFunc)EnButte_Draw,
|
||||
};
|
||||
*/
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Butte/func_809CD070.s")
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Butte/func_809CD0F8.s")
|
||||
typedef struct {
|
||||
/* 0x00 */ s16 minTime;
|
||||
/* 0x02 */ s16 maxTime;
|
||||
/* 0x04 */ f32 speedXZTarget;
|
||||
/* 0x08 */ f32 speedXZScale;
|
||||
/* 0x0C */ f32 speedXZStep;
|
||||
/* 0x10 */ s16 rotYStep;
|
||||
} EnButteFlightParams; // size = 0x14
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Butte/func_809CD110.s")
|
||||
static EnButteFlightParams sFlyAroundParams[] = {
|
||||
{ 5, 35, 0.0f, 0.1f, 0.5f, 0 },
|
||||
{ 10, 45, 1.1f, 0.1f, 0.25f, 1000 },
|
||||
{ 10, 40, 1.5f, 0.1f, 0.3f, 2000 },
|
||||
};
|
||||
static EnButteFlightParams sFollowLinkParams[] = {
|
||||
{ 3, 3, 0.8f, 0.1f, 0.2f, 0 },
|
||||
{ 10, 20, 2.0f, 0.3f, 1.0f, 0 },
|
||||
{ 10, 20, 2.4f, 0.3f, 1.0f, 0 },
|
||||
};
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Butte/func_809CD144.s")
|
||||
extern AnimationHeader D_05002470;
|
||||
extern SkeletonHeader D_050036F0;
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Butte/EnButte_Init.s")
|
||||
void EnButte_SelectFlightParams(EnButte* this, EnButteFlightParams* flightParams) {
|
||||
if (this->flightParamsIdx == 0) {
|
||||
if (Math_Rand_ZeroOne() < 0.6f) {
|
||||
this->flightParamsIdx = 1;
|
||||
} else {
|
||||
this->flightParamsIdx = 2;
|
||||
}
|
||||
} else {
|
||||
this->flightParamsIdx = 0;
|
||||
}
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Butte/EnButte_Destroy.s")
|
||||
this->timer = Math_Rand_S16Offset(flightParams->minTime, flightParams->maxTime);
|
||||
}
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Butte/func_809CD56C.s")
|
||||
static f32 sTransformationEffectScale = 0.0f;
|
||||
static s16 sTransformationEffectAlpha = 0;
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Butte/func_809CD634.s")
|
||||
void EnButte_ResetTransformationEffect(void) {
|
||||
sTransformationEffectScale = 0.0f;
|
||||
sTransformationEffectAlpha = 0;
|
||||
}
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Butte/func_809CD6FC.s")
|
||||
void EnButte_UpdateTransformationEffect(void) {
|
||||
sTransformationEffectScale += 0.003f;
|
||||
sTransformationEffectAlpha += 4000;
|
||||
}
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Butte/func_809CD79C.s")
|
||||
void EnButte_DrawTransformationEffect(EnButte* this, GlobalContext* globalCtx) {
|
||||
static Vec3f D_809CE3C4 = { 0.0f, 0.0f, -3.0f };
|
||||
Vec3f sp5C;
|
||||
s32 alpha;
|
||||
Vec3s camDir;
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Butte/func_809CD7E8.s")
|
||||
OPEN_DISPS(globalCtx->state.gfxCtx, "../z_en_choo.c", 295);
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Butte/func_809CDBCC.s")
|
||||
func_80093C14(globalCtx->state.gfxCtx);
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Butte/func_809CDC18.s")
|
||||
alpha = Math_Sins(sTransformationEffectAlpha) * 250;
|
||||
alpha = CLAMP(alpha, 0, 255);
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Butte/func_809CDFC4.s")
|
||||
func_8005A970(&camDir, ACTIVE_CAM);
|
||||
Matrix_RotateY(camDir.y * (M_PI / 0x8000), MTXMODE_NEW);
|
||||
Matrix_RotateX(camDir.x * (M_PI / 0x8000), MTXMODE_APPLY);
|
||||
Matrix_RotateZ(camDir.z * (M_PI / 0x8000), MTXMODE_APPLY);
|
||||
Matrix_MultVec3f(&D_809CE3C4, &sp5C);
|
||||
func_800D1694(this->actor.posRot2.pos.x + sp5C.x, this->actor.posRot2.pos.y + sp5C.y,
|
||||
this->actor.posRot2.pos.z + sp5C.z, &camDir);
|
||||
Matrix_Scale(sTransformationEffectScale, sTransformationEffectScale, sTransformationEffectScale, MTXMODE_APPLY);
|
||||
gSPMatrix(oGfxCtx->polyXlu.p++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_en_choo.c", 317),
|
||||
G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
|
||||
gDPSetPrimColor(oGfxCtx->polyXlu.p++, 0x80, 0x80, 200, 200, 180, alpha);
|
||||
gDPSetEnvColor(oGfxCtx->polyXlu.p++, 200, 200, 210, 255);
|
||||
gSPDisplayList(oGfxCtx->polyXlu.p++, SEGMENTED_TO_VIRTUAL(&D_04010130));
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Butte/func_809CE014.s")
|
||||
CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_en_choo.c", 326);
|
||||
}
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Butte/func_809CE0D0.s")
|
||||
static InitChainEntry sInitChain[] = {
|
||||
ICHAIN_VEC3F_DIV1000(scale, 10, ICHAIN_CONTINUE),
|
||||
ICHAIN_F32(uncullZoneForward, 700, ICHAIN_CONTINUE),
|
||||
ICHAIN_F32(uncullZoneScale, 20, ICHAIN_CONTINUE),
|
||||
ICHAIN_F32(uncullZoneDownward, 600, ICHAIN_STOP),
|
||||
};
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Butte/func_809CE0EC.s")
|
||||
void EnButte_Init(Actor* thisx, GlobalContext* globalCtx) {
|
||||
EnButte* this = THIS;
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Butte/EnButte_Update.s")
|
||||
if (this->actor.params == -1) {
|
||||
this->actor.params = 0;
|
||||
}
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Butte/EnButte_Draw.s")
|
||||
Actor_ProcessInitChain(&this->actor, sInitChain);
|
||||
|
||||
if ((this->actor.params & 1) == 1) {
|
||||
this->actor.uncullZoneScale = 200.0f;
|
||||
}
|
||||
|
||||
SkelAnime_Init(globalCtx, &this->skelAnime, &D_050036F0, &D_05002470, this->limbDrawTable,
|
||||
this->transitionDrawTable, 8);
|
||||
Collider_InitJntSph(globalCtx, &this->collider);
|
||||
Collider_SetJntSph(globalCtx, &this->collider, &this->actor, &sColliderInit, this->colliderItems);
|
||||
this->actor.colChkInfo.mass = 0;
|
||||
this->unk_25C = Math_Rand_ZeroOne() * 0xFFFF;
|
||||
this->unk_25E = Math_Rand_ZeroOne() * 0xFFFF;
|
||||
this->unk_260 = Math_Rand_ZeroOne() * 0xFFFF;
|
||||
SkelAnime_ChangeAnim(&this->skelAnime, &D_05002470, 1.0f, 0.0f, 0.0f, 1, 0.0f);
|
||||
EnButte_SetupFlyAround(this);
|
||||
this->actor.shape.rot.x -= 0x2320;
|
||||
this->drawSkelAnime = true;
|
||||
// "field keep butterfly"
|
||||
osSyncPrintf("(field keep 蝶)(%x)(arg_data 0x%04x)\n", this, this->actor.params);
|
||||
}
|
||||
|
||||
void EnButte_Destroy(Actor* thisx, GlobalContext* globalCtx) {
|
||||
Collider_DestroyJntSph(globalCtx, &THIS->collider);
|
||||
}
|
||||
|
||||
void func_809CD56C(EnButte* this) {
|
||||
static f32 D_809CE3E0[] = { 50.0f, 80.0f, 100.0f };
|
||||
static f32 D_809CE3EC[] = { 30.0f, 40.0f, 50.0f };
|
||||
|
||||
this->actor.shape.unk_08 += Math_Sins(this->unk_25C) * D_809CE3E0[this->flightParamsIdx] +
|
||||
Math_Sins(this->unk_25E) * D_809CE3EC[this->flightParamsIdx];
|
||||
this->actor.shape.unk_08 = CLAMP(this->actor.shape.unk_08, -2000.0f, 2000.0f);
|
||||
}
|
||||
|
||||
void func_809CD634(EnButte* this) {
|
||||
static f32 D_809CE3F8[] = { 15.0f, 20.0f, 25.0f };
|
||||
static f32 D_809CE404[] = { 7.5f, 10.0f, 12.5f };
|
||||
|
||||
this->actor.shape.unk_08 += Math_Sins(this->unk_25C) * D_809CE3F8[this->flightParamsIdx] +
|
||||
Math_Sins(this->unk_25E) * D_809CE404[this->flightParamsIdx];
|
||||
this->actor.shape.unk_08 = CLAMP(this->actor.shape.unk_08, -500.0f, 500.0f);
|
||||
}
|
||||
|
||||
void EnButte_Turn(EnButte* this) {
|
||||
s16 target = this->actor.posRot.rot.y + 0x8000;
|
||||
s16 diff = target - this->actor.shape.rot.y;
|
||||
|
||||
Math_ApproxUpdateScaledS(&this->actor.shape.rot.y, target, ABS(diff) >> 3);
|
||||
this->actor.shape.rot.x = (s16)(sinf(this->unk_260) * 600.0f) - 0x2320;
|
||||
}
|
||||
|
||||
void EnButte_SetupFlyAround(EnButte* this) {
|
||||
EnButte_SelectFlightParams(this, &sFlyAroundParams[this->flightParamsIdx]);
|
||||
this->actionFunc = EnButte_FlyAround;
|
||||
}
|
||||
|
||||
void EnButte_FlyAround(EnButte* this, GlobalContext* globalCtx) {
|
||||
EnButteFlightParams* flightParams = &sFlyAroundParams[this->flightParamsIdx];
|
||||
s16 yaw;
|
||||
Player* player = PLAYER;
|
||||
f32 distSqFromHome;
|
||||
f32 maxDistSqFromHome;
|
||||
f32 minAnimSpeed;
|
||||
f32 animSpeed;
|
||||
s16 rotStep;
|
||||
|
||||
distSqFromHome = Math3D_Dist2DSq(this->actor.posRot.pos.x, this->actor.posRot.pos.z, this->actor.initPosRot.pos.x,
|
||||
this->actor.initPosRot.pos.z);
|
||||
func_809CD56C(this);
|
||||
Math_SmoothScaleMaxMinF(&this->actor.speedXZ, flightParams->speedXZTarget, flightParams->speedXZScale,
|
||||
flightParams->speedXZStep, 0.0f);
|
||||
|
||||
if (this->unk_257 == 1) {
|
||||
maxDistSqFromHome = SQ(100.0f);
|
||||
rotStep = 1000;
|
||||
} else {
|
||||
maxDistSqFromHome = SQ(35.0f);
|
||||
rotStep = 600;
|
||||
}
|
||||
|
||||
minAnimSpeed = 0.0f;
|
||||
this->posYTarget = this->actor.initPosRot.pos.y;
|
||||
|
||||
if ((this->flightParamsIdx != 0) && ((distSqFromHome > maxDistSqFromHome) || (this->timer < 4))) {
|
||||
yaw = Math_Vec3f_Yaw(&this->actor.posRot.pos, &this->actor.initPosRot.pos);
|
||||
if (Math_ApproxUpdateScaledS(&this->actor.posRot.rot.y, yaw, flightParams->rotYStep) == 0) {
|
||||
minAnimSpeed = 0.5f;
|
||||
}
|
||||
} else if ((this->unk_257 == 0) && (this->actor.child != NULL) && (this->actor.child != &this->actor)) {
|
||||
yaw = Math_Vec3f_Yaw(&this->actor.posRot.pos, &this->actor.child->posRot.pos);
|
||||
if (Math_ApproxUpdateScaledS(&this->actor.posRot.rot.y, yaw, rotStep) == 0) {
|
||||
minAnimSpeed = 0.3f;
|
||||
}
|
||||
} else if (this->unk_257 == 1) {
|
||||
yaw = this->actor.yawTowardsLink + 0x8000 + (s16)((Math_Rand_ZeroOne() - 0.5f) * 0x6000);
|
||||
if (Math_ApproxUpdateScaledS(&this->actor.posRot.rot.y, yaw, rotStep) == 0) {
|
||||
minAnimSpeed = 0.4f;
|
||||
}
|
||||
} else {
|
||||
this->actor.posRot.rot.y += (s16)(sinf(this->unk_25C) * 100.0f);
|
||||
}
|
||||
|
||||
EnButte_Turn(this);
|
||||
|
||||
animSpeed = this->actor.speedXZ / 2.0f + Math_Rand_ZeroOne() * 0.2f + (1.0f - Math_Sins(this->unk_260)) * 0.15f +
|
||||
(1.0f - Math_Sins(this->unk_25E)) * 0.3f + minAnimSpeed;
|
||||
this->skelAnime.animPlaybackSpeed = CLAMP(animSpeed, 0.2f, 1.5f);
|
||||
SkelAnime_FrameUpdateMatrix(&this->skelAnime);
|
||||
|
||||
if (this->timer <= 0) {
|
||||
EnButte_SelectFlightParams(this, &sFlyAroundParams[this->flightParamsIdx]);
|
||||
}
|
||||
|
||||
if (((this->actor.params & 1) == 1) && (player->heldItemActionParam == 6) && (this->swordDownTimer <= 0) &&
|
||||
((Math3D_Dist2DSq(player->actor.posRot.pos.x, player->actor.posRot.pos.z, this->actor.initPosRot.pos.x,
|
||||
this->actor.initPosRot.pos.z) < SQ(120.0f)) ||
|
||||
(this->actor.xzDistFromLink < 60.0f))) {
|
||||
EnButte_SetupFollowLink(this);
|
||||
this->unk_257 = 2;
|
||||
} else if (this->actor.xzDistFromLink < 120.0) {
|
||||
this->unk_257 = 1;
|
||||
} else {
|
||||
this->unk_257 = 0;
|
||||
}
|
||||
}
|
||||
|
||||
void EnButte_SetupFollowLink(EnButte* this) {
|
||||
EnButte_SelectFlightParams(this, &sFollowLinkParams[this->flightParamsIdx]);
|
||||
this->actionFunc = EnButte_FollowLink;
|
||||
}
|
||||
|
||||
void EnButte_FollowLink(EnButte* this, GlobalContext* globalCtx) {
|
||||
static s32 D_809CE410 = 1500;
|
||||
EnButteFlightParams* flightParams = &sFollowLinkParams[this->flightParamsIdx];
|
||||
Player* player = PLAYER;
|
||||
f32 distSqFromHome;
|
||||
Vec3f swordTip;
|
||||
f32 animSpeed;
|
||||
f32 minAnimSpeed;
|
||||
f32 distSqFromSword;
|
||||
s16 yaw;
|
||||
|
||||
func_809CD634(this);
|
||||
Math_SmoothScaleMaxMinF(&this->actor.speedXZ, flightParams->speedXZTarget, flightParams->speedXZScale,
|
||||
flightParams->speedXZStep, 0.0f);
|
||||
minAnimSpeed = 0.0f;
|
||||
|
||||
if ((this->flightParamsIdx != 0) && (this->timer < 12)) {
|
||||
swordTip.x = player->swordInfo[0].tip.x + Math_Sins(player->actor.shape.rot.y) * 10.0f;
|
||||
swordTip.y = player->swordInfo[0].tip.y;
|
||||
swordTip.z = player->swordInfo[0].tip.z + Math_Coss(player->actor.shape.rot.y) * 10.0f;
|
||||
|
||||
yaw = Math_Vec3f_Yaw(&this->actor.posRot.pos, &swordTip) + (s16)(Math_Rand_ZeroOne() * D_809CE410);
|
||||
if (Math_ApproxUpdateScaledS(&this->actor.posRot.rot.y, yaw, 2000) != 0) {
|
||||
if (globalCtx->gameplayFrames % 2) {
|
||||
this->actor.posRot.rot.y += (s16)(sinf(this->unk_25C) * 60.0f);
|
||||
}
|
||||
} else {
|
||||
minAnimSpeed = 0.3f;
|
||||
}
|
||||
}
|
||||
|
||||
this->posYTarget = MAX(player->actor.posRot.pos.y + 30.0f, player->swordInfo[0].tip.y);
|
||||
|
||||
EnButte_Turn(this);
|
||||
|
||||
animSpeed = this->actor.speedXZ / 2.0f + Math_Rand_ZeroOne() * 0.2f + (1.0f - Math_Sins(this->unk_260)) * 0.15f +
|
||||
(1.0f - Math_Sins(this->unk_25E)) * 0.3f + minAnimSpeed;
|
||||
this->skelAnime.animPlaybackSpeed = CLAMP(animSpeed, 0.2f, 1.5f);
|
||||
SkelAnime_FrameUpdateMatrix(&this->skelAnime);
|
||||
|
||||
if (this->timer <= 0) {
|
||||
EnButte_SelectFlightParams(this, &sFollowLinkParams[this->flightParamsIdx]);
|
||||
D_809CE410 = -D_809CE410;
|
||||
}
|
||||
|
||||
distSqFromHome = Math3D_Dist2DSq(this->actor.posRot.pos.x, this->actor.posRot.pos.z, this->actor.initPosRot.pos.x,
|
||||
this->actor.initPosRot.pos.z);
|
||||
if (!((player->heldItemActionParam == 6) && (fabsf(player->actor.speedXZ) < 1.8f) && (this->swordDownTimer <= 0) &&
|
||||
(distSqFromHome < SQ(320.0f)))) {
|
||||
EnButte_SetupFlyAround(this);
|
||||
} else if (distSqFromHome > SQ(240.0f)) {
|
||||
distSqFromSword = Math3D_Dist2DSq(player->swordInfo[0].tip.x, player->swordInfo[0].tip.z,
|
||||
this->actor.posRot.pos.x, this->actor.posRot.pos.z);
|
||||
if (distSqFromSword < SQ(60.0f)) {
|
||||
EnButte_SetupTransformIntoFairy(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void EnButte_SetupTransformIntoFairy(EnButte* this) {
|
||||
this->timer = 9;
|
||||
this->actor.flags |= 0x10;
|
||||
this->skelAnime.animPlaybackSpeed = 1.0f;
|
||||
EnButte_ResetTransformationEffect();
|
||||
this->actionFunc = EnButte_TransformIntoFairy;
|
||||
}
|
||||
|
||||
void EnButte_TransformIntoFairy(EnButte* this, GlobalContext* globalCtx) {
|
||||
SkelAnime_FrameUpdateMatrix(&this->skelAnime);
|
||||
EnButte_UpdateTransformationEffect();
|
||||
|
||||
if (this->timer == 5) {
|
||||
Audio_PlaySoundAtPosition(globalCtx, &this->actor.posRot.pos, 60, NA_SE_EV_BUTTERFRY_TO_FAIRY);
|
||||
} else if (this->timer == 4) {
|
||||
Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_ELF, this->actor.posRot2.pos.x, this->actor.posRot2.pos.y,
|
||||
this->actor.posRot2.pos.z, 0, this->actor.shape.rot.y, 0, 2);
|
||||
this->drawSkelAnime = false;
|
||||
} else if (this->timer <= 0) {
|
||||
EnButte_SetupWaitToDie(this);
|
||||
}
|
||||
}
|
||||
|
||||
void EnButte_SetupWaitToDie(EnButte* this) {
|
||||
this->timer = 64;
|
||||
this->actionFunc = EnButte_WaitToDie;
|
||||
this->actor.draw = NULL;
|
||||
}
|
||||
|
||||
void EnButte_WaitToDie(EnButte* this, GlobalContext* globalCtx) {
|
||||
if (this->timer <= 0) {
|
||||
Actor_Kill(&this->actor);
|
||||
}
|
||||
}
|
||||
|
||||
void EnButte_Update(Actor* thisx, GlobalContext* globalCtx) {
|
||||
EnButte* this = THIS;
|
||||
|
||||
if ((this->actor.child != NULL) && (this->actor.child->update == NULL) && (this->actor.child != &this->actor)) {
|
||||
this->actor.child = NULL;
|
||||
}
|
||||
|
||||
if (this->timer > 0) {
|
||||
this->timer--;
|
||||
}
|
||||
|
||||
this->unk_25C += 0x222;
|
||||
this->unk_25E += 0x1000;
|
||||
this->unk_260 += 0x600;
|
||||
|
||||
if ((this->actor.params & 1) == 1) {
|
||||
if (PLAYER->swordState == 0) {
|
||||
if (this->swordDownTimer > 0) {
|
||||
this->swordDownTimer--;
|
||||
}
|
||||
} else {
|
||||
this->swordDownTimer = 80;
|
||||
}
|
||||
}
|
||||
|
||||
this->actionFunc(this, globalCtx);
|
||||
|
||||
if (this->actor.update != NULL) {
|
||||
Actor_MoveForward(&this->actor);
|
||||
Math_ApproxF(&this->actor.posRot.pos.y, this->posYTarget, 0.6f);
|
||||
if (this->actor.xyzDistFromLinkSq < 5000.0f) {
|
||||
CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->collider.base);
|
||||
}
|
||||
Actor_SetHeight(&this->actor, this->actor.shape.unk_08 * this->actor.scale.y);
|
||||
}
|
||||
}
|
||||
|
||||
void EnButte_Draw(Actor* thisx, GlobalContext* globalCtx) {
|
||||
EnButte* this = THIS;
|
||||
|
||||
if (this->drawSkelAnime) {
|
||||
func_80093D18(globalCtx->state.gfxCtx);
|
||||
SkelAnime_Draw(globalCtx, this->skelAnime.skeleton, this->skelAnime.limbDrawTbl, NULL, NULL, NULL);
|
||||
func_800628A4(0, &this->collider);
|
||||
}
|
||||
|
||||
if (((this->actor.params & 1) == 1) && (this->actionFunc == EnButte_TransformIntoFairy)) {
|
||||
EnButte_DrawTransformationEffect(this, globalCtx);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -6,9 +6,25 @@
|
|||
|
||||
struct EnButte;
|
||||
|
||||
typedef void (*EnButteActionFunc)(struct EnButte*, GlobalContext*);
|
||||
|
||||
typedef struct EnButte {
|
||||
/* 0x0000 */ Actor actor;
|
||||
/* 0x014C */ char unk_14C[0x11C];
|
||||
/* 0x014C */ ColliderJntSph collider;
|
||||
/* 0x016C */ ColliderJntSphItem colliderItems[1];
|
||||
/* 0x01AC */ SkelAnime skelAnime;
|
||||
/* 0x01F0 */ Vec3s limbDrawTable[8];
|
||||
/* 0x0220 */ Vec3s transitionDrawTable[8];
|
||||
/* 0x0250 */ EnButteActionFunc actionFunc;
|
||||
/* 0x0254 */ s16 timer;
|
||||
/* 0x0256 */ u8 flightParamsIdx;
|
||||
/* 0x0257 */ u8 unk_257;
|
||||
/* 0x0258 */ u8 drawSkelAnime;
|
||||
/* 0x025A */ s16 swordDownTimer;
|
||||
/* 0x025C */ s16 unk_25C;
|
||||
/* 0x025E */ s16 unk_25E;
|
||||
/* 0x0260 */ s16 unk_260;
|
||||
/* 0x0264 */ f32 posYTarget;
|
||||
} EnButte; // size = 0x0268
|
||||
|
||||
extern const ActorInit En_Butte_InitVars;
|
||||
|
|
|
@ -426,7 +426,7 @@ s32 func_80A3AEBC(GlobalContext* globalCtx, EnGirlA* this) {
|
|||
}
|
||||
|
||||
s32 func_80A3AF30(GlobalContext* globalCtx, EnGirlA* this) {
|
||||
if ((gBitFlags[2] & gSaveContext.equipment) && !(gBitFlags[3] & gSaveContext.equipment)) {
|
||||
if ((gBitFlags[2] & gSaveContext.inventory.equipment) && !(gBitFlags[3] & gSaveContext.inventory.equipment)) {
|
||||
return 2;
|
||||
}
|
||||
if (gSaveContext.rupees < this->unk_1C8) {
|
||||
|
@ -439,7 +439,7 @@ s32 func_80A3AF30(GlobalContext* globalCtx, EnGirlA* this) {
|
|||
}
|
||||
|
||||
s32 func_80A3AFC4(GlobalContext* globalCtx, EnGirlA* this) {
|
||||
if (gBitFlags[5] & gSaveContext.equipment) {
|
||||
if (gBitFlags[5] & gSaveContext.inventory.equipment) {
|
||||
return 2;
|
||||
}
|
||||
if (gSaveContext.rupees < this->unk_1C8) {
|
||||
|
@ -452,7 +452,7 @@ s32 func_80A3AFC4(GlobalContext* globalCtx, EnGirlA* this) {
|
|||
}
|
||||
|
||||
s32 func_80A3B040(GlobalContext* globalCtx, EnGirlA* this) {
|
||||
if (gBitFlags[4] & gSaveContext.equipment) {
|
||||
if (gBitFlags[4] & gSaveContext.inventory.equipment) {
|
||||
return 2;
|
||||
}
|
||||
if (gSaveContext.rupees < this->unk_1C8) {
|
||||
|
@ -468,7 +468,7 @@ s32 func_80A3B0BC(GlobalContext* globalCtx, EnGirlA* this) {
|
|||
if (LINK_AGE_IN_YEARS == YEARS_CHILD) {
|
||||
return 2;
|
||||
}
|
||||
if (gBitFlags[9] & gSaveContext.equipment) {
|
||||
if (gBitFlags[9] & gSaveContext.inventory.equipment) {
|
||||
return 2;
|
||||
}
|
||||
if (gSaveContext.rupees < this->unk_1C8) {
|
||||
|
@ -484,7 +484,7 @@ s32 func_80A3B160(GlobalContext* globalCtx, EnGirlA* this) {
|
|||
if (LINK_AGE_IN_YEARS == YEARS_CHILD) {
|
||||
return 2;
|
||||
}
|
||||
if (gBitFlags[10] & gSaveContext.equipment) {
|
||||
if (gBitFlags[10] & gSaveContext.inventory.equipment) {
|
||||
return 2;
|
||||
}
|
||||
if (gSaveContext.rupees < this->unk_1C8) {
|
||||
|
|
|
@ -1,15 +1,44 @@
|
|||
/*
|
||||
* File: z_en_horse_normal.c
|
||||
* Overlay: ovl_En_Horse_Normal
|
||||
* Description: Non-rideable horses (Lon Lon Ranch and Stable)
|
||||
*/
|
||||
|
||||
#include "z_en_horse_normal.h"
|
||||
|
||||
#define FLAGS 0x00000000
|
||||
|
||||
#define THIS ((EnHorseNormal*)thisx)
|
||||
|
||||
typedef struct {
|
||||
Vec3s pos;
|
||||
u8 unk_06; // this may be a s16 if the always-0 following byte is actually not padding
|
||||
} EnHorseNormalUnkStruct1;
|
||||
|
||||
typedef struct {
|
||||
s32 len;
|
||||
EnHorseNormalUnkStruct1* items;
|
||||
} EnHorseNormalUnkStruct2;
|
||||
|
||||
typedef enum {
|
||||
/* 0x00 */ HORSE_CYCLE_ANIMATIONS,
|
||||
/* 0x01 */ HORSE_WANDER,
|
||||
/* 0x02 */ HORSE_WAIT,
|
||||
/* 0x03 */ HORSE_WAIT_CLONE,
|
||||
/* 0x04 */ HORSE_FOLLOW_PATH
|
||||
} EnHorseNormalAction;
|
||||
|
||||
void EnHorseNormal_Init(Actor* thisx, GlobalContext* globalCtx);
|
||||
void EnHorseNormal_Destroy(Actor* thisx, GlobalContext* globalCtx);
|
||||
void EnHorseNormal_Update(Actor* thisx, GlobalContext* globalCtx);
|
||||
void EnHorseNormal_Draw(Actor* thisx, GlobalContext* globalCtx);
|
||||
|
||||
/*
|
||||
void func_80A6B91C(EnHorseNormal* this, GlobalContext* globalCtx);
|
||||
void func_80A6BC48(EnHorseNormal* this);
|
||||
void func_80A6BCEC(EnHorseNormal* this);
|
||||
void func_80A6C4CC(EnHorseNormal* this);
|
||||
void func_80A6C6B0(EnHorseNormal* this);
|
||||
|
||||
const ActorInit En_Horse_Normal_InitVars = {
|
||||
ACTOR_EN_HORSE_NORMAL,
|
||||
ACTORTYPE_BG,
|
||||
|
@ -21,45 +50,633 @@ const ActorInit En_Horse_Normal_InitVars = {
|
|||
(ActorFunc)EnHorseNormal_Update,
|
||||
(ActorFunc)EnHorseNormal_Draw,
|
||||
};
|
||||
*/
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Horse_Normal/func_80A6B250.s")
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Horse_Normal/func_80A6B30C.s")
|
||||
extern AnimationHeader D_06000608;
|
||||
extern AnimationHeader D_06000C20;
|
||||
extern AnimationHeader D_060013A8;
|
||||
extern AnimationHeader D_06001A1C;
|
||||
extern AnimationHeader D_06002458;
|
||||
extern AnimationHeader D_060035D4;
|
||||
extern AnimationHeader D_06004580;
|
||||
extern AnimationHeader D_06004C20;
|
||||
extern AnimationHeader D_060054BC;
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Horse_Normal/EnHorseNormal_Init.s")
|
||||
extern SkeletonHeader D_06009FAC;
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Horse_Normal/EnHorseNormal_Destroy.s")
|
||||
static AnimationHeader* sAnimations[] = {
|
||||
&D_06004580, &D_06004C20, &D_060035D4, &D_06002458, &D_060054BC, &D_06001A1C, &D_06000608, &D_06000C20, &D_060013A8,
|
||||
};
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Horse_Normal/func_80A6B91C.s")
|
||||
static ColliderCylinderInit sCylinderInit1 = {
|
||||
{ COLTYPE_UNK10, 0x00, 0x00, 0x39, 0x10, COLSHAPE_CYLINDER },
|
||||
{ 0x00, { 0x00000000, 0x00, 0x00 }, { 0x00000000, 0x00, 0x00 }, 0x00, 0x00, 0x01 },
|
||||
{ 40, 100, 0, { 0, 0, 0 } },
|
||||
};
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Horse_Normal/func_80A6B9D0.s")
|
||||
static ColliderCylinderInit sCylinderInit2 = {
|
||||
{ COLTYPE_UNK10, 0x00, 0x00, 0x39, 0x10, COLSHAPE_CYLINDER },
|
||||
{ 0x00, { 0x00000000, 0x00, 0x00 }, { 0x00000000, 0x00, 0x00 }, 0x00, 0x00, 0x01 },
|
||||
{ 60, 100, 0, { 0, 0, 0 } },
|
||||
};
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Horse_Normal/func_80A6BBAC.s")
|
||||
static ColliderJntSphItemInit sJntSphItemsInit[] = {
|
||||
{
|
||||
{ 0x00, { 0x00000000, 0x00, 0x00 }, { 0x00000000, 0x00, 0x00 }, 0x00, 0x00, 0x01 },
|
||||
{ 11, { { 0, 0, 0 }, 20 }, 100 },
|
||||
},
|
||||
};
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Horse_Normal/func_80A6BC00.s")
|
||||
static ColliderJntSphInit sJntSphInit = {
|
||||
{ COLTYPE_UNK10, 0x00, 0x00, 0x39, 0x10, COLSHAPE_JNTSPH },
|
||||
ARRAY_COUNT(sJntSphItemsInit),
|
||||
sJntSphItemsInit,
|
||||
};
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Horse_Normal/func_80A6BC48.s")
|
||||
static CollisionCheckInfoInit sColChkInfoInit = { 10, 35, 100, 0xFE };
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Horse_Normal/func_80A6BCEC.s")
|
||||
// Unused
|
||||
static EnHorseNormalUnkStruct1 D_80A6D428[] = {
|
||||
{ { 1058, 1, 384 }, 7 }, { { 1653, 39, -381 }, 6 }, { { 1606, 1, -1048 }, 6 }, { { 1053, 1, -1620 }, 6 },
|
||||
{ { -1012, 1, -1633 }, 7 }, { { -1655, 1, -918 }, 6 }, { { -1586, 1, -134 }, 6 }, { { -961, 1, 403 }, 7 },
|
||||
};
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Horse_Normal/func_80A6BD7C.s")
|
||||
// Unused
|
||||
static EnHorseNormalUnkStruct2 D_80A6D468 = { ARRAY_COUNT(D_80A6D428), D_80A6D428 };
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Horse_Normal/func_80A6BE6C.s")
|
||||
// Unused
|
||||
static EnHorseNormalUnkStruct1 D_80A6D470[] = {
|
||||
{ { 88, 0, 2078 }, 10 }, { { 2482, 376, 4631 }, 7 }, { { 2228, -28, 6605 }, 12 },
|
||||
{ { 654, -100, 8864 }, 7 }, { { -297, -500, 10667 }, 12 }, { { -5303, -420, 10640 }, 10 },
|
||||
{ { -6686, -500, 7760 }, 10 }, { { -5260, 100, 5411 }, 7 }, { { -3573, -269, 3893 }, 10 },
|
||||
};
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Horse_Normal/func_80A6C4CC.s")
|
||||
// Unused
|
||||
static EnHorseNormalUnkStruct2 D_80A6D4B8 = { ARRAY_COUNT(D_80A6D470), D_80A6D470 };
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Horse_Normal/func_80A6C570.s")
|
||||
void func_80A6B250(EnHorseNormal* this) {
|
||||
static s32 D_80A6D4C0[] = { 0, 16 };
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Horse_Normal/func_80A6C6B0.s")
|
||||
if (D_80A6D4C0[this->unk_200] < this->skin.skelAnime.animCurrentFrame &&
|
||||
((this->unk_200 != 0) || !(D_80A6D4C0[1] < this->skin.skelAnime.animCurrentFrame))) {
|
||||
Audio_PlaySoundGeneral(NA_SE_EV_HORSE_WALK, &this->actor.projectedPos, 4, &D_801333E0, &D_801333E0,
|
||||
&D_801333E8);
|
||||
this->unk_200++;
|
||||
if (this->unk_200 >= ARRAY_COUNT(D_80A6D4C0)) {
|
||||
this->unk_200 = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Horse_Normal/func_80A6C760.s")
|
||||
f32 func_80A6B30C(EnHorseNormal* this) {
|
||||
static f32 D_80A6D4C8[] = { 1.0f, 1.0f, 1.0f, 1.0f, 1.5f, 1.5f, 1.5f, 1.5f, 1.0f };
|
||||
f32 result;
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Horse_Normal/func_80A6C8E0.s")
|
||||
if (this->animationIdx == 4) {
|
||||
result = D_80A6D4C8[this->animationIdx] * this->actor.speedXZ * (1 / 2.0f);
|
||||
} else if (this->animationIdx == 5) {
|
||||
result = D_80A6D4C8[this->animationIdx] * this->actor.speedXZ * (1 / 3.0f);
|
||||
} else if (this->animationIdx == 6) {
|
||||
result = D_80A6D4C8[this->animationIdx] * this->actor.speedXZ * (1 / 5.0f);
|
||||
} else {
|
||||
result = D_80A6D4C8[this->animationIdx];
|
||||
}
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Horse_Normal/EnHorseNormal_Update.s")
|
||||
return result;
|
||||
}
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Horse_Normal/func_80A6CAFC.s")
|
||||
static InitChainEntry sInitChain[] = {
|
||||
ICHAIN_F32(uncullZoneScale, 1200, ICHAIN_CONTINUE),
|
||||
ICHAIN_F32(uncullZoneDownward, 300, ICHAIN_STOP),
|
||||
};
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Horse_Normal/func_80A6CC88.s")
|
||||
void EnHorseNormal_Init(Actor* thisx, GlobalContext* globalCtx) {
|
||||
EnHorseNormal* this = THIS;
|
||||
s32 pad;
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Horse_Normal/EnHorseNormal_Draw.s")
|
||||
Actor_ProcessInitChain(&this->actor, sInitChain);
|
||||
Actor_SetScale(&this->actor, 0.01f);
|
||||
this->actor.gravity = -3.5f;
|
||||
ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawFunc_Squiggly, 20.0f);
|
||||
this->actor.speedXZ = 0.0f;
|
||||
this->actor.posRot2.pos = this->actor.posRot.pos;
|
||||
this->actor.posRot2.pos.y += 70.0f;
|
||||
this->action = HORSE_CYCLE_ANIMATIONS;
|
||||
this->animationIdx = 0;
|
||||
Collider_InitCylinder(globalCtx, &this->bodyCollider);
|
||||
Collider_SetCylinder(globalCtx, &this->bodyCollider, &this->actor, &sCylinderInit1);
|
||||
Collider_InitJntSph(globalCtx, &this->headCollider);
|
||||
Collider_SetJntSph(globalCtx, &this->headCollider, &this->actor, &sJntSphInit, this->headColliderItems);
|
||||
Collider_InitCylinder(globalCtx, &this->cloneCollider);
|
||||
Collider_SetCylinder(globalCtx, &this->cloneCollider, &this->actor, &sCylinderInit2);
|
||||
func_80061ED4(&this->actor.colChkInfo, NULL, &sColChkInfoInit);
|
||||
if (globalCtx->sceneNum == SCENE_SPOT20) {
|
||||
if (this->actor.posRot.rot.z == 0 || gSaveContext.nightFlag) {
|
||||
Actor_Kill(&this->actor);
|
||||
return;
|
||||
}
|
||||
if (LINK_IS_CHILD) {
|
||||
if (Flags_GetEventChkInf(0x14)) {
|
||||
if (this->actor.posRot.rot.z != 3) {
|
||||
Actor_Kill(&this->actor);
|
||||
return;
|
||||
}
|
||||
} else if (this->actor.posRot.rot.z != 1) {
|
||||
Actor_Kill(&this->actor);
|
||||
return;
|
||||
}
|
||||
} else if (Flags_GetEventChkInf(0x18) || (DREG(1) != 0)) {
|
||||
if (this->actor.posRot.rot.z != 7) {
|
||||
Actor_Kill(&this->actor);
|
||||
return;
|
||||
}
|
||||
} else if (this->actor.posRot.rot.z != 5) {
|
||||
Actor_Kill(&this->actor);
|
||||
return;
|
||||
}
|
||||
this->actor.initPosRot.rot.z = this->actor.posRot.rot.z = this->actor.shape.rot.z = 0;
|
||||
func_800A663C(globalCtx, &this->skin, &D_06009FAC, &D_06004580);
|
||||
SkelAnime_ChangeAnimDefaultStop(&this->skin.skelAnime, sAnimations[this->animationIdx]);
|
||||
if ((this->actor.posRot.pos.x == -730.0f && this->actor.posRot.pos.y == 0.0f &&
|
||||
this->actor.posRot.pos.z == -1100.0f) ||
|
||||
(this->actor.posRot.pos.x == 880.0f && this->actor.posRot.pos.y == 0.0f &&
|
||||
this->actor.posRot.pos.z == -1170.0f)) {
|
||||
func_80A6C6B0(this);
|
||||
return;
|
||||
}
|
||||
} else if (globalCtx->sceneNum == SCENE_MALON_STABLE) {
|
||||
if (!gSaveContext.nightFlag) {
|
||||
Actor_Kill(&this->actor);
|
||||
return;
|
||||
} else {
|
||||
func_800A663C(globalCtx, &this->skin, &D_06009FAC, &D_06004580);
|
||||
SkelAnime_ChangeAnimDefaultStop(&this->skin.skelAnime, sAnimations[this->animationIdx]);
|
||||
func_80A6C6B0(this);
|
||||
return;
|
||||
}
|
||||
} else if (globalCtx->sceneNum == SCENE_SPOT12) {
|
||||
if (this->actor.posRot.pos.x == 3707.0f && this->actor.posRot.pos.y == 1413.0f &&
|
||||
this->actor.posRot.pos.z == -665.0f) {
|
||||
func_800A663C(globalCtx, &this->skin, &D_06009FAC, &D_06004580);
|
||||
SkelAnime_ChangeAnimDefaultStop(&this->skin.skelAnime, sAnimations[this->animationIdx]);
|
||||
func_80A6C4CC(this);
|
||||
return;
|
||||
}
|
||||
func_800A663C(globalCtx, &this->skin, &D_06009FAC, &D_06004580);
|
||||
SkelAnime_ChangeAnimDefaultStop(&this->skin.skelAnime, sAnimations[this->animationIdx]);
|
||||
} else {
|
||||
func_800A663C(globalCtx, &this->skin, &D_06009FAC, &D_06004580);
|
||||
SkelAnime_ChangeAnimDefaultStop(&this->skin.skelAnime, sAnimations[this->animationIdx]);
|
||||
}
|
||||
if ((this->actor.params & 0xF0) == 0x10 && (this->actor.params & 0xF) != 0xF) {
|
||||
func_80A6B91C(this, globalCtx);
|
||||
} else {
|
||||
func_80A6BC48(this);
|
||||
}
|
||||
}
|
||||
|
||||
void EnHorseNormal_Destroy(Actor* thisx, GlobalContext* globalCtx) {
|
||||
EnHorseNormal* this = THIS;
|
||||
|
||||
func_800A6888(globalCtx, &this->skin);
|
||||
Collider_DestroyCylinder(globalCtx, &this->bodyCollider);
|
||||
Collider_DestroyCylinder(globalCtx, &this->cloneCollider);
|
||||
Collider_DestroyJntSph(globalCtx, &this->headCollider);
|
||||
}
|
||||
|
||||
void func_80A6B91C(EnHorseNormal* this, GlobalContext* globalCtx) {
|
||||
this->actor.flags |= 0x10;
|
||||
this->action = HORSE_FOLLOW_PATH;
|
||||
this->animationIdx = 6;
|
||||
this->waypoint = 0;
|
||||
this->actor.speedXZ = 7.0f;
|
||||
SkelAnime_ChangeAnim(&this->skin.skelAnime, sAnimations[this->animationIdx], func_80A6B30C(this), 0.0f,
|
||||
SkelAnime_GetFrameCount(&sAnimations[this->animationIdx]->genericHeader), 2, 0.0f);
|
||||
}
|
||||
|
||||
void EnHorseNormal_FollowPath(EnHorseNormal* this, GlobalContext* globalCtx) {
|
||||
Path* path = &globalCtx->setupPathList[this->actor.params & 0xF];
|
||||
Vec3s* pointPos = SEGMENTED_TO_VIRTUAL(path->points);
|
||||
f32 dx;
|
||||
f32 dz;
|
||||
s32 pad;
|
||||
|
||||
pointPos += this->waypoint;
|
||||
dx = pointPos->x - this->actor.posRot.pos.x;
|
||||
dz = pointPos->z - this->actor.posRot.pos.z;
|
||||
Math_SmoothScaleMaxMinS(&this->actor.posRot.rot.y, Math_atan2f(dx, dz) * (0x8000 / M_PI), 0xA, 0x7D0, 1);
|
||||
this->actor.shape.rot.y = this->actor.posRot.rot.y;
|
||||
if (SQ(dx) + SQ(dz) < 600.0f) {
|
||||
this->waypoint++;
|
||||
if (this->waypoint >= path->count) {
|
||||
this->waypoint = 0;
|
||||
}
|
||||
}
|
||||
this->skin.skelAnime.animPlaybackSpeed = func_80A6B30C(this);
|
||||
if (SkelAnime_FrameUpdateMatrix(&this->skin.skelAnime)) {
|
||||
SkelAnime_ChangeAnim(&this->skin.skelAnime, sAnimations[this->animationIdx], func_80A6B30C(this), 0.0f,
|
||||
SkelAnime_GetFrameCount(&sAnimations[this->animationIdx]->genericHeader), 2, 0.0f);
|
||||
func_80A6BCEC(this);
|
||||
}
|
||||
}
|
||||
|
||||
void EnHorseNormal_NextAnimation(EnHorseNormal* this) {
|
||||
this->action = HORSE_CYCLE_ANIMATIONS;
|
||||
this->animationIdx++;
|
||||
|
||||
if (this->animationIdx >= ARRAY_COUNT(sAnimations)) {
|
||||
this->animationIdx = 0;
|
||||
}
|
||||
|
||||
SkelAnime_ChangeAnimDefaultStop(&this->skin.skelAnime, sAnimations[this->animationIdx]);
|
||||
}
|
||||
|
||||
void EnHorseNormal_CycleAnimations(EnHorseNormal* this, GlobalContext* globalCtx) {
|
||||
this->actor.speedXZ = 0.0f;
|
||||
|
||||
if (SkelAnime_FrameUpdateMatrix(&this->skin.skelAnime)) {
|
||||
EnHorseNormal_NextAnimation(this);
|
||||
}
|
||||
}
|
||||
|
||||
void func_80A6BC48(EnHorseNormal* this) {
|
||||
this->action = HORSE_WANDER;
|
||||
this->animationIdx = 0;
|
||||
this->unk_21C = 0;
|
||||
this->unk_21E = 0;
|
||||
this->actor.speedXZ = 0.0f;
|
||||
this->unk_218 = 0.0f;
|
||||
SkelAnime_ChangeAnim(&this->skin.skelAnime, sAnimations[this->animationIdx], func_80A6B30C(this), 0.0f,
|
||||
SkelAnime_GetFrameCount(&sAnimations[this->animationIdx]->genericHeader), 2, 0.0f);
|
||||
}
|
||||
|
||||
void func_80A6BCEC(EnHorseNormal* this) {
|
||||
if (this->animationIdx == 5) {
|
||||
Audio_PlaySoundGeneral(NA_SE_EV_HORSE_RUN, &this->actor.projectedPos, 4, &D_801333E0, &D_801333E0, &D_801333E8);
|
||||
} else if (this->animationIdx == 6) {
|
||||
Audio_PlaySoundGeneral(NA_SE_EV_HORSE_RUN, &this->actor.projectedPos, 4, &D_801333E0, &D_801333E0, &D_801333E8);
|
||||
}
|
||||
}
|
||||
|
||||
void func_80A6BD7C(EnHorseNormal* this) {
|
||||
f32 frame = this->skin.skelAnime.animCurrentFrame;
|
||||
|
||||
if (this->animationIdx == 0 && frame > 28.0f && !(this->unk_1E4 & 1)) {
|
||||
this->unk_1E4 |= 1;
|
||||
Audio_PlaySoundGeneral(NA_SE_EV_HORSE_SANDDUST, &this->actor.projectedPos, 4, &D_801333E0, &D_801333E0,
|
||||
&D_801333E8);
|
||||
} else if (this->animationIdx == 3 && frame > 25.0f && !(this->unk_1E4 & 2)) {
|
||||
this->unk_1E4 |= 2;
|
||||
Audio_PlaySoundGeneral(NA_SE_EV_HORSE_LAND2, &this->actor.projectedPos, 4, &D_801333E0, &D_801333E0,
|
||||
&D_801333E8);
|
||||
}
|
||||
}
|
||||
|
||||
void EnHorseNormal_Wander(EnHorseNormal* this, GlobalContext* globalCtx) {
|
||||
static s32 D_80A6D4F4[] = { 0, 1, 4, 5, 6, 2, 3 };
|
||||
static s32 D_80A6D510[] = { 0, 0, 2, 2, 1, 1, 1, 3, 3 };
|
||||
s32 phi_t0 = this->animationIdx;
|
||||
s32 pad;
|
||||
|
||||
switch (D_80A6D510[this->animationIdx]) {
|
||||
case 0:
|
||||
func_80A6BD7C(this);
|
||||
this->actor.speedXZ = 0.0f;
|
||||
this->unk_218 = 0.0f;
|
||||
break;
|
||||
case 1:
|
||||
if (Math_Rand_ZeroOne() < 0.1f) {
|
||||
this->unk_218 = 2.0f * Math_Rand_ZeroOne() - 1.0f;
|
||||
}
|
||||
this->actor.speedXZ += this->unk_218;
|
||||
if (this->actor.speedXZ <= 0.0f) {
|
||||
this->actor.speedXZ = 0.0f;
|
||||
this->unk_218 = 0.0f;
|
||||
phi_t0 = 0;
|
||||
} else if (this->actor.speedXZ < 3.0f) {
|
||||
func_80A6B250(this);
|
||||
phi_t0 = 4;
|
||||
} else if (this->actor.speedXZ < 6.0f) {
|
||||
phi_t0 = 5;
|
||||
} else if (this->actor.speedXZ < 8.0f) {
|
||||
phi_t0 = 6;
|
||||
} else {
|
||||
this->actor.speedXZ = 8.0f;
|
||||
phi_t0 = 6;
|
||||
}
|
||||
if (Math_Rand_ZeroOne() < 0.1f ||
|
||||
(this->unk_21E == 0 && (this->actor.bgCheckFlags & 8 || this->bodyCollider.base.maskA & 2 ||
|
||||
this->headCollider.base.maskA & 2))) {
|
||||
this->unk_21E += (Math_Rand_ZeroOne() * 30.0f) - 15.0f;
|
||||
if (this->unk_21E > 50) {
|
||||
this->unk_21E = 50;
|
||||
} else if (this->unk_21E < -50) {
|
||||
this->unk_21E = -50;
|
||||
}
|
||||
}
|
||||
this->unk_21C += this->unk_21E;
|
||||
if (this->unk_21C < -300) {
|
||||
this->unk_21C = -300;
|
||||
} else if (this->unk_21C > 300) {
|
||||
this->unk_21C = 300;
|
||||
} else if (Math_Rand_ZeroOne() < 0.25f && fabsf(this->unk_21C) < 100.0f) {
|
||||
this->unk_21C = 0;
|
||||
this->unk_21E = 0;
|
||||
}
|
||||
this->actor.posRot.rot.y += this->unk_21C;
|
||||
this->actor.shape.rot.y = this->actor.posRot.rot.y;
|
||||
break;
|
||||
case 2:
|
||||
case 3:
|
||||
break;
|
||||
}
|
||||
|
||||
if (phi_t0 != this->animationIdx || SkelAnime_FrameUpdateMatrix(&this->skin.skelAnime)) {
|
||||
if (phi_t0 != this->animationIdx) {
|
||||
this->animationIdx = phi_t0;
|
||||
this->unk_1E4 &= ~1;
|
||||
this->unk_1E4 &= ~2;
|
||||
if (phi_t0 == 1) {
|
||||
Audio_PlaySoundGeneral(NA_SE_EV_HORSE_GROAN, &this->unk_204, 4, &D_801333E0, &D_801333E0, &D_801333E8);
|
||||
} else if (phi_t0 == 3) {
|
||||
Audio_PlaySoundGeneral(NA_SE_EV_HORSE_NEIGH, &this->unk_204, 4, &D_801333E0, &D_801333E0, &D_801333E8);
|
||||
} else {
|
||||
func_80A6BCEC(this);
|
||||
}
|
||||
SkelAnime_ChangeAnim(&this->skin.skelAnime, sAnimations[this->animationIdx], func_80A6B30C(this), 0.0f,
|
||||
SkelAnime_GetFrameCount(&sAnimations[this->animationIdx]->genericHeader), 2, -3.0f);
|
||||
} else {
|
||||
switch (D_80A6D510[this->animationIdx]) {
|
||||
case 0:
|
||||
if (Math_Rand_ZeroOne() < 0.25f) {
|
||||
this->unk_218 = 1.0f;
|
||||
phi_t0 = 4;
|
||||
} else {
|
||||
phi_t0 = D_80A6D4F4[(s32)(Math_Rand_ZeroOne() * 2)];
|
||||
this->actor.speedXZ = 0.0f;
|
||||
this->unk_218 = 0.0f;
|
||||
}
|
||||
break;
|
||||
case 1:
|
||||
case 2:
|
||||
case 3:
|
||||
break;
|
||||
}
|
||||
|
||||
this->unk_1E4 &= ~1;
|
||||
this->unk_1E4 &= ~2;
|
||||
if (phi_t0 == 1) {
|
||||
Audio_PlaySoundGeneral(NA_SE_EV_HORSE_GROAN, &this->unk_204, 4, &D_801333E0, &D_801333E0, &D_801333E8);
|
||||
} else if (phi_t0 == 3) {
|
||||
Audio_PlaySoundGeneral(NA_SE_EV_HORSE_NEIGH, &this->unk_204, 4, &D_801333E0, &D_801333E0, &D_801333E8);
|
||||
} else {
|
||||
func_80A6BCEC(this);
|
||||
}
|
||||
if (phi_t0 != this->animationIdx) {
|
||||
this->animationIdx = phi_t0;
|
||||
SkelAnime_ChangeAnim(&this->skin.skelAnime, sAnimations[this->animationIdx], func_80A6B30C(this), 0.0f,
|
||||
SkelAnime_GetFrameCount(&sAnimations[this->animationIdx]->genericHeader), 2,
|
||||
-3.0f);
|
||||
} else {
|
||||
SkelAnime_ChangeAnim(&this->skin.skelAnime, sAnimations[this->animationIdx], func_80A6B30C(this), 0.0f,
|
||||
SkelAnime_GetFrameCount(&sAnimations[this->animationIdx]->genericHeader), 2, 0.0f);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void func_80A6C4CC(EnHorseNormal* this) {
|
||||
this->action = HORSE_WAIT;
|
||||
this->animationIdx = 0;
|
||||
this->unk_21C = 0;
|
||||
this->unk_21E = 0;
|
||||
this->actor.speedXZ = 0.0f;
|
||||
this->unk_218 = 0.0f;
|
||||
SkelAnime_ChangeAnim(&this->skin.skelAnime, sAnimations[this->animationIdx], func_80A6B30C(this), 0.0f,
|
||||
SkelAnime_GetFrameCount(&sAnimations[this->animationIdx]->genericHeader), 2, 0.0f);
|
||||
}
|
||||
|
||||
void EnHorseNormal_Wait(EnHorseNormal* this, GlobalContext* globalCtx) {
|
||||
if (SkelAnime_FrameUpdateMatrix(&this->skin.skelAnime)) {
|
||||
f32 rand = Math_Rand_ZeroOne();
|
||||
|
||||
if (rand < 0.4f) {
|
||||
this->animationIdx = 0;
|
||||
} else if (rand < 0.8f) {
|
||||
this->animationIdx = 1;
|
||||
Audio_PlaySoundGeneral(NA_SE_EV_HORSE_GROAN, &this->unk_204, 4, &D_801333E0, &D_801333E0, &D_801333E8);
|
||||
} else {
|
||||
this->animationIdx = 3;
|
||||
Audio_PlaySoundGeneral(NA_SE_EV_HORSE_NEIGH, &this->unk_204, 4, &D_801333E0, &D_801333E0, &D_801333E8);
|
||||
}
|
||||
|
||||
SkelAnime_ChangeAnim(&this->skin.skelAnime, sAnimations[this->animationIdx], func_80A6B30C(this), 0.0f,
|
||||
SkelAnime_GetFrameCount(&sAnimations[this->animationIdx]->genericHeader), 2, 0.0f);
|
||||
}
|
||||
}
|
||||
|
||||
void func_80A6C6B0(EnHorseNormal* this) {
|
||||
this->action = HORSE_WAIT_CLONE;
|
||||
this->animationIdx = 0;
|
||||
this->unk_21C = 0;
|
||||
this->unk_21E = 0;
|
||||
this->actor.flags |= 0x30;
|
||||
this->actor.speedXZ = 0.0f;
|
||||
this->unk_218 = 0.0f;
|
||||
SkelAnime_ChangeAnim(&this->skin.skelAnime, sAnimations[this->animationIdx], func_80A6B30C(this), 0.0f,
|
||||
SkelAnime_GetFrameCount(&sAnimations[this->animationIdx]->genericHeader), 2, 0.0f);
|
||||
}
|
||||
|
||||
void EnHorseNormal_WaitClone(EnHorseNormal* this, GlobalContext* globalCtx) {
|
||||
func_80A6BD7C(this);
|
||||
|
||||
if (SkelAnime_FrameUpdateMatrix(&this->skin.skelAnime)) {
|
||||
f32 rand = Math_Rand_ZeroOne();
|
||||
|
||||
if (rand < 0.4f) {
|
||||
this->animationIdx = 0;
|
||||
} else if (rand < 0.8f) {
|
||||
this->animationIdx = 1;
|
||||
this->unk_1E4 |= 0x20;
|
||||
Audio_PlaySoundGeneral(NA_SE_EV_HORSE_GROAN, &this->unk_204, 4, &D_801333E0, &D_801333E0, &D_801333E8);
|
||||
} else {
|
||||
this->animationIdx = 3;
|
||||
this->unk_1E4 |= 0x20;
|
||||
Audio_PlaySoundGeneral(NA_SE_EV_HORSE_NEIGH, &this->unk_204, 4, &D_801333E0, &D_801333E0, &D_801333E8);
|
||||
}
|
||||
|
||||
SkelAnime_ChangeAnim(&this->skin.skelAnime, sAnimations[this->animationIdx], func_80A6B30C(this), 0.0f,
|
||||
SkelAnime_GetFrameCount(&sAnimations[this->animationIdx]->genericHeader), 2, 0.0f);
|
||||
|
||||
this->unk_1E4 &= ~1;
|
||||
this->unk_1E4 &= ~2;
|
||||
this->unk_1E4 &= ~8;
|
||||
this->unk_1E4 &= ~0x10;
|
||||
}
|
||||
}
|
||||
|
||||
void func_80A6C8E0(EnHorseNormal* this, GlobalContext* globalCtx) {
|
||||
s32 pad;
|
||||
CollisionPoly* sp38;
|
||||
s32 pad2;
|
||||
Vec3f sp28;
|
||||
s32 sp24;
|
||||
|
||||
sp28.x = (Math_Sins(this->actor.shape.rot.y) * 30.0f) + this->actor.posRot.pos.x;
|
||||
sp28.y = this->actor.posRot.pos.y + 60.0f;
|
||||
sp28.z = (Math_Coss(this->actor.shape.rot.y) * 30.0f) + this->actor.posRot.pos.z;
|
||||
this->unk_220 = func_8003C940(&globalCtx->colCtx, &sp38, &sp24, &sp28);
|
||||
this->actor.shape.rot.x = Math_atan2f(this->actor.posRot.pos.y - this->unk_220, 30.0f) * (0x8000 / M_PI);
|
||||
}
|
||||
|
||||
static EnHorseNormalActionFunc sActionFuncs[] = {
|
||||
EnHorseNormal_CycleAnimations, EnHorseNormal_Wander, EnHorseNormal_Wait,
|
||||
EnHorseNormal_WaitClone, EnHorseNormal_FollowPath,
|
||||
};
|
||||
|
||||
void EnHorseNormal_Update(Actor* thisx, GlobalContext* globalCtx) {
|
||||
EnHorseNormal* this = THIS;
|
||||
s32 pad;
|
||||
|
||||
sActionFuncs[this->action](this, globalCtx);
|
||||
Actor_MoveForward(&this->actor);
|
||||
func_8002E4B4(globalCtx, &this->actor, 20.0f, 35.0f, 100.0f, 0x1D);
|
||||
if (globalCtx->sceneNum == SCENE_SPOT20 && this->actor.posRot.pos.z < -2400.0f) {
|
||||
this->actor.posRot.pos.z = -2400.0f;
|
||||
}
|
||||
this->actor.posRot2.pos = this->actor.posRot.pos;
|
||||
this->actor.posRot2.pos.y += 70.0f;
|
||||
this->unk_204 = this->actor.projectedPos;
|
||||
this->unk_204.y += 120.0f;
|
||||
Collider_CylinderUpdate(&this->actor, &this->bodyCollider);
|
||||
CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->bodyCollider.base);
|
||||
if (this->actor.speedXZ == 0.0f) {
|
||||
this->actor.colChkInfo.mass = 0xFF;
|
||||
} else {
|
||||
this->actor.colChkInfo.mass = 0xFE;
|
||||
}
|
||||
}
|
||||
|
||||
void func_80A6CAFC(Actor* thisx, GlobalContext* globalCtx, ColliderJntSphItem* collider) {
|
||||
Vec3f sp4C;
|
||||
Vec3f sp40;
|
||||
EnHorseNormal* this = THIS;
|
||||
s32 i;
|
||||
|
||||
for (i = 0; i < this->headCollider.count; i++) {
|
||||
sp4C.x = this->headCollider.list[i].dim.modelSphere.center.x;
|
||||
sp4C.y = this->headCollider.list[i].dim.modelSphere.center.y;
|
||||
sp4C.z = this->headCollider.list[i].dim.modelSphere.center.z;
|
||||
func_800A6408(collider, this->headCollider.list[i].dim.joint, &sp4C, &sp40);
|
||||
this->headCollider.list[i].dim.worldSphere.center.x = sp40.x;
|
||||
this->headCollider.list[i].dim.worldSphere.center.y = sp40.y;
|
||||
this->headCollider.list[i].dim.worldSphere.center.z = sp40.z;
|
||||
this->headCollider.list[i].dim.worldSphere.radius =
|
||||
this->headCollider.list[i].dim.modelSphere.radius * this->headCollider.list[i].dim.scale;
|
||||
}
|
||||
|
||||
CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->headCollider.base);
|
||||
}
|
||||
|
||||
void func_80A6CC88(GlobalContext* globalCtx, EnHorseNormal* this, Vec3f* arg2) {
|
||||
f32 animCurrentFrame = this->skin.skelAnime.animCurrentFrame;
|
||||
f32 wDest;
|
||||
|
||||
SkinMatrix_Vec3fMtxFMultXYZW(&globalCtx->mf_11D60, arg2, &this->unk_1E8, &wDest);
|
||||
this->unk_1F4 = this->unk_1E8;
|
||||
this->unk_1F4.y += 120.0f;
|
||||
|
||||
if (this->animationIdx == 0 && animCurrentFrame > 28.0f && !(this->unk_1E4 & 8)) {
|
||||
this->unk_1E4 |= 8;
|
||||
Audio_PlaySoundGeneral(NA_SE_EV_HORSE_SANDDUST, &this->unk_1E8, 4, &D_801333E0, &D_801333E0, &D_801333E8);
|
||||
} else if (this->animationIdx == 3 && animCurrentFrame > 25.0f && !(this->unk_1E4 & 0x10)) {
|
||||
this->unk_1E4 |= 0x10;
|
||||
Audio_PlaySoundGeneral(NA_SE_EV_HORSE_LAND2, &this->unk_1E8, 4, &D_801333E0, &D_801333E0, &D_801333E8);
|
||||
} else if (this->animationIdx == 3 && this->unk_1E4 & 0x20) {
|
||||
this->unk_1E4 &= ~0x20;
|
||||
Audio_PlaySoundGeneral(NA_SE_EV_HORSE_NEIGH, &this->unk_1F4, 4, &D_801333E0, &D_801333E0, &D_801333E8);
|
||||
} else if (this->animationIdx == 1 && this->unk_1E4 & 0x20) {
|
||||
this->unk_1E4 &= ~0x20;
|
||||
Audio_PlaySoundGeneral(NA_SE_EV_HORSE_GROAN, &this->unk_1F4, 4, &D_801333E0, &D_801333E0, &D_801333E8);
|
||||
}
|
||||
}
|
||||
|
||||
void EnHorseNormal_Draw(Actor* thisx, GlobalContext* globalCtx) {
|
||||
EnHorseNormal* this = THIS;
|
||||
Mtx* mtx2;
|
||||
|
||||
OPEN_DISPS(globalCtx->state.gfxCtx, "../z_en_horse_normal.c", 2224);
|
||||
|
||||
if (globalCtx->sceneNum != SCENE_SPOT20 || globalCtx->sceneNum != SCENE_MALON_STABLE) {
|
||||
func_80A6C8E0(this, globalCtx);
|
||||
}
|
||||
func_80093D18(globalCtx->state.gfxCtx);
|
||||
func_800A6330(&this->actor, globalCtx, &this->skin, func_80A6CAFC, 1);
|
||||
|
||||
if (this->action == HORSE_WAIT_CLONE) {
|
||||
MtxF skinMtx;
|
||||
Mtx* mtx1;
|
||||
Vec3f clonePos = { 0.0f, 0.0f, 0.0f };
|
||||
s16 cloneRotY;
|
||||
f32 distFromGround = this->actor.posRot.pos.y - this->actor.groundY;
|
||||
f32 temp_f0_4;
|
||||
|
||||
if (globalCtx->sceneNum == SCENE_MALON_STABLE) {
|
||||
if (this->actor.posRot.pos.x == 355.0f && this->actor.posRot.pos.y == 0.0f &&
|
||||
this->actor.posRot.pos.z == -245.0f) {
|
||||
clonePos.x = 235.0f;
|
||||
clonePos.y = 0.0f;
|
||||
clonePos.z = 100.0f;
|
||||
cloneRotY = 0x7FFF;
|
||||
} else if (this->actor.posRot.pos.x == 238.0f && this->actor.posRot.pos.y == 0.0f &&
|
||||
this->actor.posRot.pos.z == -245.0f) {
|
||||
clonePos.x = 478.0f;
|
||||
clonePos.y = 0.0f;
|
||||
clonePos.z = 100.0f;
|
||||
cloneRotY = 0x7FFF;
|
||||
}
|
||||
} else if (globalCtx->sceneNum == SCENE_SPOT20) {
|
||||
if (this->actor.posRot.pos.x == -730.0f && this->actor.posRot.pos.y == 0.0f &&
|
||||
this->actor.posRot.pos.z == -1100.0f) {
|
||||
clonePos.x = 780.0f;
|
||||
clonePos.y = 0.0f;
|
||||
clonePos.z = -80.0f;
|
||||
cloneRotY = 0;
|
||||
} else if (this->actor.posRot.pos.x == 880.0f && this->actor.posRot.pos.y == 0.0f &&
|
||||
this->actor.posRot.pos.z == -1170.0f) {
|
||||
clonePos.x = -1000.0f;
|
||||
clonePos.y = 0.0f;
|
||||
clonePos.z = -70.0f;
|
||||
cloneRotY = 0;
|
||||
}
|
||||
}
|
||||
func_80A6CC88(globalCtx, this, &clonePos);
|
||||
SkinMatrix_SetScaleRotateYRPTranslate(&skinMtx, this->actor.scale.x, this->actor.scale.y, this->actor.scale.z,
|
||||
this->actor.shape.rot.x, cloneRotY, this->actor.shape.rot.z, clonePos.x,
|
||||
(this->actor.shape.unk_08 * this->actor.scale.y) + clonePos.y,
|
||||
clonePos.z);
|
||||
mtx1 = SkinMatrix_MtxFToNewMtx(globalCtx->state.gfxCtx, &skinMtx);
|
||||
if (mtx1 == NULL) {
|
||||
return;
|
||||
}
|
||||
gSPMatrix(oGfxCtx->polyOpa.p++, &gMtxClear, G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
|
||||
gSPMatrix(oGfxCtx->polyOpa.p++, mtx1, G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
|
||||
func_800A63CC(&this->actor, globalCtx, &this->skin, 0, 0, 1, 0, 3);
|
||||
this->cloneCollider.dim.pos.x = clonePos.x;
|
||||
this->cloneCollider.dim.pos.y = clonePos.y;
|
||||
this->cloneCollider.dim.pos.z = clonePos.z;
|
||||
CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->cloneCollider.base);
|
||||
func_80094044(globalCtx->state.gfxCtx);
|
||||
gDPSetPrimColor(oGfxCtx->polyXlu.p++, 0, 0, 0, 0, 0, 255);
|
||||
Matrix_Translate(clonePos.x, clonePos.y, clonePos.z, MTXMODE_NEW);
|
||||
temp_f0_4 = (1.0f - (distFromGround * 0.01f)) * this->actor.shape.unk_10;
|
||||
Matrix_Scale(this->actor.scale.x * temp_f0_4, 1.0f, this->actor.scale.z * temp_f0_4, MTXMODE_APPLY);
|
||||
Matrix_RotateY(cloneRotY * (2.0f * M_PI / 0x10000), MTXMODE_APPLY);
|
||||
mtx2 = Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_en_horse_normal.c", 2329);
|
||||
if (mtx2 != NULL) {
|
||||
gSPMatrix(oGfxCtx->polyXlu.p++, mtx2, G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
|
||||
gSPDisplayList(oGfxCtx->polyXlu.p++, D_04049AD0);
|
||||
}
|
||||
}
|
||||
|
||||
CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_en_horse_normal.c", 2339);
|
||||
}
|
||||
|
|
|
@ -6,9 +6,30 @@
|
|||
|
||||
struct EnHorseNormal;
|
||||
|
||||
typedef void (*EnHorseNormalActionFunc)(struct EnHorseNormal*, GlobalContext*);
|
||||
|
||||
typedef struct EnHorseNormal {
|
||||
/* 0x0000 */ Actor actor;
|
||||
/* 0x014C */ char unk_14C[0x1DC];
|
||||
/* 0x014C */ s32 action;
|
||||
/* 0x0150 */ s32 animationIdx;
|
||||
/* 0x0154 */ PSkinAwb skin;
|
||||
/* 0x01E4 */ u16 unk_1E4;
|
||||
/* 0x01E8 */ Vec3f unk_1E8;
|
||||
/* 0x01F4 */ Vec3f unk_1F4;
|
||||
/* 0x0200 */ s32 unk_200;
|
||||
/* 0x0204 */ Vec3f unk_204;
|
||||
/* 0x0210 */ char unk_210[0x08];
|
||||
/* 0x0218 */ f32 unk_218;
|
||||
/* 0x021C */ s16 unk_21C;
|
||||
/* 0x021E */ s16 unk_21E;
|
||||
/* 0x0220 */ f32 unk_220;
|
||||
/* 0x0224 */ char unk_224[0x04];
|
||||
/* 0x0228 */ ColliderCylinder bodyCollider;
|
||||
/* 0x0274 */ ColliderJntSph headCollider;
|
||||
/* 0x0294 */ ColliderJntSphItem headColliderItems[1];
|
||||
/* 0x02D4 */ ColliderCylinder cloneCollider;
|
||||
/* 0x0320 */ char unk_320[0x04];
|
||||
/* 0x0324 */ s32 waypoint;
|
||||
} EnHorseNormal; // size = 0x0328
|
||||
|
||||
extern const ActorInit En_Horse_Normal_InitVars;
|
||||
|
|
|
@ -234,7 +234,7 @@ void EnIshi_DropCollectible(EnIshi* this, GlobalContext* globalCtx) {
|
|||
if (dropParams >= 0xD) {
|
||||
dropParams = 0;
|
||||
}
|
||||
|
||||
|
||||
Item_DropCollectibleRandom(globalCtx, NULL, &this->actor.posRot.pos, dropParams << 4);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -169,13 +169,13 @@ void func_80A8F660(EnKakasi* this, GlobalContext* globalCtx) {
|
|||
this->unk_196 = 6;
|
||||
if (LINK_IS_CHILD) {
|
||||
this->unk_194 = false;
|
||||
if (gSaveContext.unk_F3C[4] != 0) {
|
||||
if (gSaveContext.scarecrowCustomSongSet) {
|
||||
this->actor.textId = 0x407A;
|
||||
this->unk_196 = 5;
|
||||
}
|
||||
} else {
|
||||
this->unk_194 = true;
|
||||
if (gSaveContext.unk_F3C[4] != 0) {
|
||||
if (gSaveContext.scarecrowCustomSongSet) {
|
||||
this->actor.textId = 0x4079;
|
||||
this->unk_196 = 5;
|
||||
}
|
||||
|
@ -335,7 +335,7 @@ void EnKakasi_Draw(Actor* thisx, GlobalContext* globalCtx) {
|
|||
if (BREG(3) != 0) {
|
||||
osSyncPrintf("\n\n");
|
||||
// flag!
|
||||
osSyncPrintf(VT_FGCOL(YELLOW) "☆☆☆☆☆ フラグ! ☆☆☆☆☆ %d\n" VT_RST, gSaveContext.unk_F3C[4]);
|
||||
osSyncPrintf(VT_FGCOL(YELLOW) "☆☆☆☆☆ フラグ! ☆☆☆☆☆ %d\n" VT_RST, gSaveContext.scarecrowCustomSongSet);
|
||||
}
|
||||
func_80093D18(globalCtx->state.gfxCtx);
|
||||
SkelAnime_DrawSV(globalCtx, this->skelanime.skeleton, this->skelanime.limbDrawTbl, this->skelanime.dListCount, NULL,
|
||||
|
|
|
@ -205,7 +205,8 @@ void EnKakasi2_Update(Actor* thisx, GlobalContext* globalCtx) {
|
|||
}
|
||||
if (BREG(0) != 0) {
|
||||
if (BREG(5) != 0) {
|
||||
osSyncPrintf(VT_FGCOL(YELLOW) "☆☆☆☆☆ this->actor.player_distance ☆☆☆☆☆ %f\n" VT_RST, this->actor.xzDistFromLink);
|
||||
osSyncPrintf(VT_FGCOL(YELLOW) "☆☆☆☆☆ this->actor.player_distance ☆☆☆☆☆ %f\n" VT_RST,
|
||||
this->actor.xzDistFromLink);
|
||||
osSyncPrintf(VT_FGCOL(YELLOW) "☆☆☆☆☆ this->hosei.x ☆☆☆☆☆ %f\n" VT_RST, this->maxSpawnDistance.x);
|
||||
osSyncPrintf("\n\n");
|
||||
}
|
||||
|
|
|
@ -179,14 +179,14 @@ void func_80A91284(EnKakasi3* this, GlobalContext* globalCtx) {
|
|||
|
||||
if (LINK_IS_CHILD) {
|
||||
this->unk_194 = false;
|
||||
if (gSaveContext.unk_12C5 != 0) {
|
||||
if (gSaveContext.scarecrowSpawnSongSet) {
|
||||
this->actor.textId = 0x40A0;
|
||||
this->dialogState = 5;
|
||||
this->unk_1A8 = 1;
|
||||
}
|
||||
} else {
|
||||
this->unk_194 = true;
|
||||
if (gSaveContext.unk_12C5 != 0) {
|
||||
if (gSaveContext.scarecrowSpawnSongSet) {
|
||||
if (this->unk_195) {
|
||||
this->actor.textId = 0x40A2;
|
||||
} else {
|
||||
|
@ -238,7 +238,7 @@ void func_80A91348(EnKakasi3* this, GlobalContext* globalCtx) {
|
|||
if (this->actor.xzDistFromLink < 80.0f) {
|
||||
player->stateFlags2 |= 0x800000;
|
||||
}
|
||||
} else if (gSaveContext.unk_12C5 != 0 && !this->unk_195) {
|
||||
} else if (gSaveContext.scarecrowSpawnSongSet && !this->unk_195) {
|
||||
|
||||
if (player->stateFlags2 & 0x1000000) {
|
||||
this->camId = func_800800F8(globalCtx, 0x8D4, -0x63, &this->actor, 0);
|
||||
|
@ -341,7 +341,7 @@ void func_80A918E4(EnKakasi3* this, GlobalContext* globalCtx) {
|
|||
}
|
||||
if ((globalCtx->msgCtx.unk_E3EE == 4 || (globalCtx->msgCtx.unk_E3EE >= 5 && globalCtx->msgCtx.unk_E3EE < 11)) &&
|
||||
globalCtx->msgCtx.msgMode == 0) {
|
||||
|
||||
|
||||
func_8010B680(globalCtx, 0x40A6, NULL);
|
||||
this->dialogState = 5;
|
||||
func_800803F0(globalCtx, this->camId);
|
||||
|
@ -405,7 +405,7 @@ void EnKakasi3_Update(Actor* thisx, GlobalContext* globalCtx) {
|
|||
if (BREG(2) != 0) {
|
||||
osSyncPrintf("\n\n");
|
||||
// flag!
|
||||
osSyncPrintf(VT_FGCOL(YELLOW) "☆☆☆☆☆ フラグ! ☆☆☆☆☆ %d\n" VT_RST, gSaveContext.unk_12C5);
|
||||
osSyncPrintf(VT_FGCOL(YELLOW) "☆☆☆☆☆ フラグ! ☆☆☆☆☆ %d\n" VT_RST, gSaveContext.scarecrowSpawnSongSet);
|
||||
}
|
||||
|
||||
this->unk_198++;
|
||||
|
|
|
@ -83,13 +83,13 @@ u16 func_80AA2AA0(GlobalContext* globalCtx, Actor* thisx) {
|
|||
if (gSaveContext.timer1Value >= 0xD3) {
|
||||
return 0x208E;
|
||||
}
|
||||
if ((gSaveContext.unk_EC4 == 0) || (gSaveContext.unk_EC4 >= 0xB4)) {
|
||||
gSaveContext.unk_EC4 = 0xB4;
|
||||
if ((gSaveContext.horseRaceRecord == 0) || (gSaveContext.horseRaceRecord >= 0xB4)) {
|
||||
gSaveContext.horseRaceRecord = 0xB4;
|
||||
gSaveContext.timer1Value = *timer1ValuePtr;
|
||||
}
|
||||
if (!(gSaveContext.eventChkInf[1] & 0x4000) && (gSaveContext.timer1Value < 0x32)) {
|
||||
return 0x208F;
|
||||
} else if (gSaveContext.timer1Value < gSaveContext.unk_EC4) {
|
||||
} else if (gSaveContext.timer1Value < gSaveContext.horseRaceRecord) {
|
||||
return 0x2012;
|
||||
} else {
|
||||
return 0x2004;
|
||||
|
@ -126,7 +126,7 @@ s16 func_80AA2BD4(GlobalContext* globalCtx, Actor* thisx) {
|
|||
if (globalCtx->msgCtx.choiceIndex == 0) {
|
||||
if (gSaveContext.eventChkInf[1] & 0x4000) {
|
||||
func_8010B720(globalCtx, 0x2091);
|
||||
} else if (gSaveContext.unk_EC4 == 0) {
|
||||
} else if (gSaveContext.horseRaceRecord == 0) {
|
||||
func_8010B720(globalCtx, 0x2092);
|
||||
} else {
|
||||
func_8010B720(globalCtx, 0x2090);
|
||||
|
@ -144,8 +144,8 @@ s16 func_80AA2BD4(GlobalContext* globalCtx, Actor* thisx) {
|
|||
gSaveContext.eventChkInf[1] |= 0x4000;
|
||||
case 0x2004:
|
||||
case 0x2012:
|
||||
if (gSaveContext.unk_EC4 > gSaveContext.timer1Value) {
|
||||
gSaveContext.unk_EC4 = gSaveContext.timer1Value;
|
||||
if (gSaveContext.horseRaceRecord > gSaveContext.timer1Value) {
|
||||
gSaveContext.horseRaceRecord = gSaveContext.timer1Value;
|
||||
}
|
||||
case 0x208E:
|
||||
gSaveContext.eventInf[0] &= ~0x400;
|
||||
|
|
|
@ -98,7 +98,7 @@ void EnMag_Init(Actor* thisx, GlobalContext* globalCtx) {
|
|||
gSaveContext.unk_1419 = 255;
|
||||
}
|
||||
|
||||
func_8006EF10(&this->unk_150);
|
||||
Font_LoadOrderedFont(&this->font);
|
||||
|
||||
this->unk_E316 = 0;
|
||||
this->unk_E318 = 0;
|
||||
|
@ -394,7 +394,7 @@ void EnMag_DrawInner(Actor* thisx, GlobalContext* globalCtx, Gfx** gfxp) {
|
|||
0x06020000, 0x06020800, 0x06021000, 0x06021800, 0x06022000, 0x06022800, 0x06023000, 0x06023800, 0x06024000,
|
||||
};
|
||||
EnMag* this = THIS;
|
||||
u8* buf = this->unk_150;
|
||||
Font* font = &this->font;
|
||||
s32 pad;
|
||||
Gfx* gfx = *gfxp;
|
||||
u16 i, j, k;
|
||||
|
@ -496,7 +496,8 @@ void EnMag_DrawInner(Actor* thisx, GlobalContext* globalCtx, Gfx** gfxp) {
|
|||
|
||||
rectLeft = VREG(19) + 1;
|
||||
for (i = 0; i < ARRAY_COUNT(noControllerFontIndexes); i++) {
|
||||
EnMag_DrawCharTexture(&gfx, buf + 0x3C88 + (noControllerFontIndexes[i] * 0x80), rectLeft, YREG(10) + 172);
|
||||
EnMag_DrawCharTexture(&gfx, font->fontBuf + noControllerFontIndexes[i] * FONT_CHAR_TEX_SIZE, rectLeft,
|
||||
YREG(10) + 172);
|
||||
rectLeft += VREG(21);
|
||||
if (i == 1) {
|
||||
rectLeft += VREG(23);
|
||||
|
@ -509,7 +510,8 @@ void EnMag_DrawInner(Actor* thisx, GlobalContext* globalCtx, Gfx** gfxp) {
|
|||
|
||||
rectLeft = VREG(19);
|
||||
for (i = 0; i < ARRAY_COUNT(noControllerFontIndexes); i++) {
|
||||
EnMag_DrawCharTexture(&gfx, buf + 0x3C88 + (noControllerFontIndexes[i] * 0x80), rectLeft, YREG(10) + 171);
|
||||
EnMag_DrawCharTexture(&gfx, font->fontBuf + noControllerFontIndexes[i] * FONT_CHAR_TEX_SIZE, rectLeft,
|
||||
YREG(10) + 171);
|
||||
rectLeft += VREG(21);
|
||||
if (i == 1) {
|
||||
rectLeft += VREG(23);
|
||||
|
@ -530,7 +532,8 @@ void EnMag_DrawInner(Actor* thisx, GlobalContext* globalCtx, Gfx** gfxp) {
|
|||
|
||||
rectLeft = YREG(7) + 1;
|
||||
for (i = 0; i < ARRAY_COUNT(pressStartFontIndexes); i++) {
|
||||
EnMag_DrawCharTexture(&gfx, buf + 0x3C88 + (pressStartFontIndexes[i] * 0x80), rectLeft, YREG(10) + 172);
|
||||
EnMag_DrawCharTexture(&gfx, font->fontBuf + pressStartFontIndexes[i] * FONT_CHAR_TEX_SIZE, rectLeft,
|
||||
YREG(10) + 172);
|
||||
rectLeft += YREG(8);
|
||||
if (i == 4) {
|
||||
rectLeft += YREG(9);
|
||||
|
@ -543,7 +546,8 @@ void EnMag_DrawInner(Actor* thisx, GlobalContext* globalCtx, Gfx** gfxp) {
|
|||
|
||||
rectLeft = YREG(7);
|
||||
for (i = 0; i < ARRAY_COUNT(pressStartFontIndexes); i++) {
|
||||
EnMag_DrawCharTexture(&gfx, buf + 0x3C88 + (pressStartFontIndexes[i] * 0x80), rectLeft, YREG(10) + 171);
|
||||
EnMag_DrawCharTexture(&gfx, font->fontBuf + pressStartFontIndexes[i] * FONT_CHAR_TEX_SIZE, rectLeft,
|
||||
YREG(10) + 171);
|
||||
rectLeft += YREG(8);
|
||||
if (i == 4) {
|
||||
rectLeft += YREG(9);
|
||||
|
|
|
@ -9,7 +9,7 @@ struct EnMag;
|
|||
typedef struct EnMag {
|
||||
/* 0x0000 */ Actor actor;
|
||||
/* 0x014C */ char unk_14C[0x0004];
|
||||
/* 0x0150 */ u8 unk_150[0xE188]; // kanfont struct/buffer
|
||||
/* 0x0150 */ Font font;
|
||||
/* 0xE2D8 */ s16 effectFadeInState;
|
||||
/* 0xE2DA */ s16 effectFadeInTimer;
|
||||
/* 0xE2DC */ s16 globalState;
|
||||
|
|
|
@ -117,7 +117,7 @@ void func_80ABEF2C(EnOkarinaTag* this, GlobalContext* globalCtx) {
|
|||
if ((this->switchFlag >= 0) && (Flags_GetSwitch(globalCtx, this->switchFlag))) {
|
||||
this->actor.flags &= ~1;
|
||||
} else {
|
||||
if ((this->unk_152 != 6) || (gSaveContext.unk_12C5 != 0)) {
|
||||
if ((this->unk_152 != 6) || (gSaveContext.scarecrowSpawnSongSet)) {
|
||||
if (player->stateFlags2 & 0x1000000) {
|
||||
// "North! ! ! ! !"
|
||||
osSyncPrintf(VT_FGCOL(RED) "☆☆☆☆☆ 北!!!!! ☆☆☆☆☆ %f\n" VT_RST, this->actor.xzDistFromLink);
|
||||
|
@ -189,7 +189,7 @@ void func_80ABF28C(EnOkarinaTag* this, GlobalContext* globalCtx) {
|
|||
Player* player = PLAYER;
|
||||
|
||||
this->unk_15A++;
|
||||
if ((this->unk_152 != 6) || (gSaveContext.unk_12C5 != 0)) {
|
||||
if ((this->unk_152 != 6) || (gSaveContext.scarecrowSpawnSongSet)) {
|
||||
if ((this->switchFlag >= 0) && Flags_GetSwitch(globalCtx, this->switchFlag)) {
|
||||
this->actor.flags &= ~1;
|
||||
} else if (((this->unk_150 != 4) || !(gSaveContext.eventChkInf[4] & 0x800)) &&
|
||||
|
|
|
@ -682,42 +682,28 @@ void func_80AE3ECC(EnRd* this, GlobalContext* globalCtx) {
|
|||
}
|
||||
}
|
||||
|
||||
// Regalloc..I can get the score lower by using permuter suggestions, but they all seem silly
|
||||
#ifdef NON_MATCHING
|
||||
void func_80AE3F9C(EnRd* this, GlobalContext* globalCtx) {
|
||||
s16 unk_310;
|
||||
s16 shapeRotY;
|
||||
s16 yawTowardsLink;
|
||||
s16 new_var;
|
||||
s16 temp_v0;
|
||||
s16 phi_a3;
|
||||
s16 phi_v0;
|
||||
s16 temp1;
|
||||
s16 temp2;
|
||||
s16 temp3;
|
||||
|
||||
unk_310 = this->unk_310;
|
||||
shapeRotY = this->actor.shape.rot.y;
|
||||
yawTowardsLink = this->actor.yawTowardsLink;
|
||||
new_var = unk_310 + shapeRotY;
|
||||
temp1 = this->actor.yawTowardsLink - (s16)(this->actor.shape.rot.y + this->unk_310);
|
||||
temp2 = CLAMP(temp1, -500, 500);
|
||||
|
||||
temp_v0 = yawTowardsLink - new_var;
|
||||
phi_a3 = CLAMP(temp_v0, -500, 500);
|
||||
temp1 -= this->unk_30E;
|
||||
temp3 = CLAMP(temp1, -500, 500);
|
||||
|
||||
temp_v0 -= this->unk_30E;
|
||||
phi_v0 = CLAMP(temp_v0, -500, 500);
|
||||
|
||||
if ((s16)(yawTowardsLink - shapeRotY) >= 0) {
|
||||
this->unk_310 += ABS(phi_a3);
|
||||
this->unk_30E += ABS(phi_v0);
|
||||
if ((s16)(this->actor.yawTowardsLink - this->actor.shape.rot.y) >= 0) {
|
||||
this->unk_310 += ABS(temp2);
|
||||
this->unk_30E += ABS(temp3);
|
||||
} else {
|
||||
this->unk_310 -= ABS(phi_a3);
|
||||
this->unk_30E -= ABS(phi_v0);
|
||||
this->unk_310 -= ABS(temp2);
|
||||
this->unk_30E -= ABS(temp3);
|
||||
}
|
||||
|
||||
this->unk_310 = CLAMP(this->unk_310, -18783, 18783);
|
||||
this->unk_30E = CLAMP(this->unk_30E, -9583, 9583);
|
||||
}
|
||||
#else
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Rd/func_80AE3F9C.s")
|
||||
#endif
|
||||
|
||||
void func_80AE4114(EnRd* this, GlobalContext* globalCtx) {
|
||||
s32 pad;
|
||||
|
|
|
@ -229,12 +229,11 @@ void func_80AE5270(EnReeba* this, GlobalContext* globalCtx) {
|
|||
this->actionfunc = func_80AE5688;
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
if (this->unk_274 == 0) {
|
||||
Audio_PlayActorSound2(&this->actor, NA_SE_EN_RIVA_MOVE);
|
||||
this->unk_274 = 10;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void func_80AE538C(EnReeba* this, GlobalContext* globalCtx) {
|
||||
|
|
|
@ -396,4 +396,4 @@ const ActorInit En_Rl_InitVars = {
|
|||
(ActorFunc)EnRl_Destroy,
|
||||
(ActorFunc)EnRl_Update,
|
||||
(ActorFunc)EnRl_Draw,
|
||||
};
|
||||
};
|
||||
|
|
|
@ -57,7 +57,7 @@ void EnTakaraMan_Init(Actor* thisx, GlobalContext* globalCtx) {
|
|||
osSyncPrintf(VT_FGCOL(PURPLE) "☆☆☆☆☆ ばぅん! ☆☆☆☆☆ %x\n" VT_RST,
|
||||
globalCtx->actorCtx.flags.chest); // "Bun! %x" (needs a better translation)
|
||||
globalCtx->actorCtx.flags.chest = 0;
|
||||
gSaveContext.dungeonKeys[gSaveContext.mapIndex] = -1;
|
||||
gSaveContext.inventory.dungeonKeys[gSaveContext.mapIndex] = -1;
|
||||
SkelAnime_InitSV(globalCtx, &this->skelAnime, &D_06004FE0, &D_06000498, this->limbDrawTbl, this->transitionDrawTbl,
|
||||
10);
|
||||
thisx->posRot2.pos = thisx->posRot.pos;
|
||||
|
|
|
@ -268,10 +268,8 @@ void ObjSyokudai_Draw(Actor* thisx, GlobalContext* globalCtx) {
|
|||
gDPSetEnvColor(oGfxCtx->polyXlu.p++, 255, 0, 0, 0);
|
||||
|
||||
Matrix_Translate(0.0f, 52.0f, 0.0f, MTXMODE_APPLY);
|
||||
Matrix_RotateY(
|
||||
(s16)(func_8005A9F4(ACTIVE_CAM) - this->actor.shape.rot.y + 0x8000) *
|
||||
(M_PI / 0x8000),
|
||||
MTXMODE_APPLY);
|
||||
Matrix_RotateY((s16)(func_8005A9F4(ACTIVE_CAM) - this->actor.shape.rot.y + 0x8000) * (M_PI / 0x8000),
|
||||
MTXMODE_APPLY);
|
||||
Matrix_Scale(flameScale, flameScale, flameScale, MTXMODE_APPLY);
|
||||
|
||||
gSPMatrix(oGfxCtx->polyXlu.p++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_obj_syokudai.c", 745),
|
||||
|
|
|
@ -3056,7 +3056,7 @@ void func_80836BEC(Player* this, GlobalContext* globalCtx) {
|
|||
actorToTarget = &PLAYER->actor;
|
||||
}
|
||||
|
||||
holdTarget = (gSaveContext.zTargetingSetting != 0) || (this->actor.type != ACTORTYPE_PLAYER);
|
||||
holdTarget = (gSaveContext.zTargetSetting != 0) || (this->actor.type != ACTORTYPE_PLAYER);
|
||||
this->stateFlags1 |= 0x8000;
|
||||
|
||||
if ((actorToTarget != NULL) && !(actorToTarget->flags & 0x8000000)) {
|
||||
|
@ -4042,9 +4042,9 @@ s32 func_80839034(GlobalContext* globalCtx, Player* this, CollisionPoly* arg2, u
|
|||
}
|
||||
|
||||
if (linearVel > R_RUN_SPEED_LIMIT / 100.0f) {
|
||||
gSaveContext.unk_13BC = R_RUN_SPEED_LIMIT / 100.0f;
|
||||
gSaveContext.entranceSpeed = R_RUN_SPEED_LIMIT / 100.0f;
|
||||
} else {
|
||||
gSaveContext.unk_13BC = linearVel;
|
||||
gSaveContext.entranceSpeed = linearVel;
|
||||
}
|
||||
|
||||
if (D_808535F4 != 0) {
|
||||
|
@ -4273,8 +4273,8 @@ s32 func_80839800(Player* this, GlobalContext* globalCtx) {
|
|||
func_8003C890(&globalCtx->colCtx, &sp58, &sp4C);
|
||||
|
||||
if (func_80839034(globalCtx, this, sp58, 50)) {
|
||||
gSaveContext.unk_13BC = 2.0f;
|
||||
gSaveContext.unk_13C0 = NA_SE_OC_DOOR_OPEN;
|
||||
gSaveContext.entranceSpeed = 2.0f;
|
||||
gSaveContext.entranceSound = NA_SE_OC_DOOR_OPEN;
|
||||
}
|
||||
} else {
|
||||
func_8005AD40(Gameplay_GetCamera(globalCtx, 0), doorActor,
|
||||
|
@ -5356,18 +5356,18 @@ void func_8083CA20(GlobalContext* globalCtx, Player* this) {
|
|||
|
||||
void func_8083CA54(GlobalContext* globalCtx, Player* this) {
|
||||
this->linearVelocity = 2.0f;
|
||||
gSaveContext.unk_13BC = 2.0f;
|
||||
gSaveContext.entranceSpeed = 2.0f;
|
||||
if (func_8083C910(globalCtx, this, 120.0f)) {
|
||||
this->unk_850 = -15;
|
||||
}
|
||||
}
|
||||
|
||||
void func_8083CA9C(GlobalContext* globalCtx, Player* this) {
|
||||
if (gSaveContext.unk_13BC < 0.1f) {
|
||||
gSaveContext.unk_13BC = 0.1f;
|
||||
if (gSaveContext.entranceSpeed < 0.1f) {
|
||||
gSaveContext.entranceSpeed = 0.1f;
|
||||
}
|
||||
|
||||
this->linearVelocity = gSaveContext.unk_13BC;
|
||||
this->linearVelocity = gSaveContext.entranceSpeed;
|
||||
|
||||
if (func_8083C910(globalCtx, this, 800.0f)) {
|
||||
this->unk_850 = -80 / this->linearVelocity;
|
||||
|
@ -8676,7 +8676,7 @@ void func_80845CA4(Player* this, GlobalContext* globalCtx) {
|
|||
sp30 = 20;
|
||||
|
||||
if (this->stateFlags1 & 1) {
|
||||
sp34 = gSaveContext.unk_13BC;
|
||||
sp34 = gSaveContext.entranceSpeed;
|
||||
|
||||
if (D_808535F4 != 0) {
|
||||
this->unk_450.x = (Math_Sins(D_808535FC) * 400.0f) + this->actor.posRot.pos.x;
|
||||
|
@ -8685,7 +8685,7 @@ void func_80845CA4(Player* this, GlobalContext* globalCtx) {
|
|||
} else if (this->unk_850 < 0) {
|
||||
this->unk_850++;
|
||||
|
||||
sp34 = gSaveContext.unk_13BC;
|
||||
sp34 = gSaveContext.entranceSpeed;
|
||||
sp30 = -1;
|
||||
}
|
||||
|
||||
|
@ -9071,7 +9071,7 @@ void Player_Init(Actor* thisx, GlobalContext* globalCtx) {
|
|||
s32 sp4C;
|
||||
s32 initMode;
|
||||
s16 params;
|
||||
u16 unk_13C0;
|
||||
u16 entranceSound;
|
||||
|
||||
globalCtx->unk_11E5C = globalCtx->bombchuBowlingAmmo = 0;
|
||||
|
||||
|
@ -9125,7 +9125,7 @@ void Player_Init(Actor* thisx, GlobalContext* globalCtx) {
|
|||
}
|
||||
|
||||
if ((sp50 == 0) || (sp50 < -1)) {
|
||||
if ((scene->titleFile.vromStart != scene->titleFile.vromEnd) && (gSaveContext.unk_13C7 != 0) &&
|
||||
if ((scene->titleFile.vromStart != scene->titleFile.vromEnd) && (gSaveContext.showTitleCard) &&
|
||||
(gSaveContext.sceneSetupIndex < 4) &&
|
||||
(gEntranceTable[gSaveContext.entranceIndex + gSaveContext.sceneSetupIndex].field & 0x4000) &&
|
||||
((globalCtx->sceneNum != SCENE_DDAN) || (gSaveContext.eventChkInf[11] & 1)) &&
|
||||
|
@ -9133,7 +9133,7 @@ void Player_Init(Actor* thisx, GlobalContext* globalCtx) {
|
|||
TitleCard_InitPlaceName(globalCtx, &globalCtx->actorCtx.titleCtx, this->giObjectSegment, 0xA0, 0x78, 0x90,
|
||||
0x18, 0x14);
|
||||
}
|
||||
gSaveContext.unk_13C7 = 1;
|
||||
gSaveContext.showTitleCard = true;
|
||||
}
|
||||
|
||||
if (sp50 == 2) {
|
||||
|
@ -9177,10 +9177,10 @@ void Player_Init(Actor* thisx, GlobalContext* globalCtx) {
|
|||
this->stateFlags3 &= ~0x40;
|
||||
}
|
||||
|
||||
if (gSaveContext.unk_13C0 != 0) {
|
||||
unk_13C0 = gSaveContext.unk_13C0;
|
||||
Audio_PlayActorSound2(&this->actor, unk_13C0);
|
||||
gSaveContext.unk_13C0 = 0;
|
||||
if (gSaveContext.entranceSound != 0) {
|
||||
entranceSound = gSaveContext.entranceSound;
|
||||
Audio_PlayActorSound2(&this->actor, entranceSound);
|
||||
gSaveContext.entranceSound = 0;
|
||||
}
|
||||
|
||||
Map_SavePlayerInitialInfo(globalCtx);
|
||||
|
@ -11818,7 +11818,8 @@ s32 func_8084DFF4(GlobalContext* globalCtx, Player* this) {
|
|||
Audio_PlaySoundGeneral(NA_SE_SY_GET_BOXITEM, &D_801333D4, 4, &D_801333E0, &D_801333E0, &D_801333E8);
|
||||
} else {
|
||||
if ((this->getItemId == GI_HEART_CONTAINER_2) || (this->getItemId == GI_HEART_CONTAINER) ||
|
||||
((this->getItemId == GI_HEART_PIECE) && ((gSaveContext.questItems & 0xF0000000) == 0x40000000))) {
|
||||
((this->getItemId == GI_HEART_PIECE) &&
|
||||
((gSaveContext.inventory.questItems & 0xF0000000) == 0x40000000))) {
|
||||
temp1 = 0x924;
|
||||
} else {
|
||||
temp1 = temp2 = (this->getItemId == GI_HEART_PIECE) ? 0x39 : 0x922;
|
||||
|
|
|
@ -10,7 +10,7 @@ void Opening_SetupTitleScreen(OpeningContext* this) {
|
|||
gSaveContext.gameMode = 1;
|
||||
this->state.running = false;
|
||||
gSaveContext.linkAge = 0;
|
||||
func_800A82C8();
|
||||
Sram_InitDebugSave();
|
||||
gSaveContext.cutsceneIndex = 0xFFF3;
|
||||
gSaveContext.sceneSetupIndex = 7;
|
||||
SET_NEXT_GAMESTATE(&this->state, Gameplay_Init, GlobalContext);
|
||||
|
@ -19,16 +19,20 @@ void Opening_SetupTitleScreen(OpeningContext* this) {
|
|||
void func_80803C5C(OpeningContext* this) {
|
||||
}
|
||||
|
||||
void Opening_Main(OpeningContext* this) {
|
||||
void Opening_Main(GameState* thisx) {
|
||||
OpeningContext* this = (OpeningContext*)thisx;
|
||||
|
||||
func_80095248(this->state.gfxCtx, 0, 0, 0);
|
||||
Opening_SetupTitleScreen(this);
|
||||
func_80803C5C(this);
|
||||
}
|
||||
|
||||
void Opening_Destroy(OpeningContext* this) {
|
||||
void Opening_Destroy(GameState* thisx) {
|
||||
}
|
||||
|
||||
void Opening_Init(OpeningContext* this) {
|
||||
void Opening_Init(GameState* thisx) {
|
||||
OpeningContext* this = (OpeningContext*)thisx;
|
||||
|
||||
R_UPDATE_RATE = 1;
|
||||
Matrix_Init(&this->state);
|
||||
View_Init(&this->view, this->state.gfxCtx);
|
||||
|
|
|
@ -19,7 +19,7 @@ void Select_LoadGame(SelectContext* this, s32 entranceIndex) {
|
|||
osSyncPrintf("\n\n\nFILE_NO=%x\n\n\n", gSaveContext.fileNum);
|
||||
osSyncPrintf(VT_RST);
|
||||
if (gSaveContext.fileNum == 0xFF) {
|
||||
func_800A82C8();
|
||||
Sram_InitDebugSave();
|
||||
gSaveContext.unk_13F6 = gSaveContext.magic;
|
||||
gSaveContext.magic = 0;
|
||||
gSaveContext.unk_13F4 = 0;
|
||||
|
@ -37,7 +37,7 @@ void Select_LoadGame(SelectContext* this, s32 entranceIndex) {
|
|||
gSaveContext.respawn[RESPAWN_MODE_DOWN].entranceIndex = -1;
|
||||
gSaveContext.seqIndex = 0xFF;
|
||||
gSaveContext.nightSeqIndex = 0xFF;
|
||||
gSaveContext.unk_13C7 = 1;
|
||||
gSaveContext.showTitleCard = true;
|
||||
D_8011FB30 = 0;
|
||||
this->state.running = false;
|
||||
SET_NEXT_GAMESTATE(&this->state, Gameplay_Init, GlobalContext);
|
||||
|
@ -566,20 +566,23 @@ void Select_Draw(SelectContext* this) {
|
|||
CLOSE_DISPS(gfxCtx, "../z_select.c", 1037);
|
||||
}
|
||||
|
||||
void Select_Main(SelectContext* this) {
|
||||
void Select_Main(GameState* thisx) {
|
||||
SelectContext* this = (SelectContext*)thisx;
|
||||
|
||||
Select_UpdateMenu(this);
|
||||
Select_Draw(this);
|
||||
}
|
||||
|
||||
void Select_Destroy(SelectContext* this) {
|
||||
void Select_Destroy(GameState* thisx) {
|
||||
osSyncPrintf("%c", 7);
|
||||
// "view_cleanup will hang, so it won't be called"
|
||||
osSyncPrintf("*** view_cleanupはハングアップするので、呼ばない ***\n");
|
||||
}
|
||||
|
||||
void Select_Init(SelectContext* this) {
|
||||
void Select_Init(GameState* thisx) {
|
||||
SelectContext* this = (SelectContext*)thisx;
|
||||
u32 size;
|
||||
s32 pad[2];
|
||||
s32 pad;
|
||||
|
||||
this->state.main = Select_Main;
|
||||
this->state.destroy = Select_Destroy;
|
||||
|
|
|
@ -124,8 +124,8 @@ void Title_Draw(TitleContext* this) {
|
|||
CLOSE_DISPS(this->state.gfxCtx, "../z_title.c", 483);
|
||||
}
|
||||
|
||||
void Title_Main(TitleContext* this) {
|
||||
s32 pad;
|
||||
void Title_Main(GameState* thisx) {
|
||||
TitleContext* this = (TitleContext*)thisx;
|
||||
|
||||
OPEN_DISPS(this->state.gfxCtx, "../z_title.c", 494);
|
||||
|
||||
|
@ -154,13 +154,15 @@ void Title_Main(TitleContext* this) {
|
|||
CLOSE_DISPS(this->state.gfxCtx, "../z_title.c", 541);
|
||||
}
|
||||
|
||||
void Title_Destroy(TitleContext* this) {
|
||||
func_800A9AD0(this, &this->sram);
|
||||
void Title_Destroy(GameState* thisx) {
|
||||
TitleContext* this = (TitleContext*)thisx;
|
||||
|
||||
Sram_InitSram(this, &this->sramCtx);
|
||||
}
|
||||
|
||||
void Title_Init(TitleContext* this) {
|
||||
void Title_Init(GameState* thisx) {
|
||||
u32 size = (u32)_nintendo_rogo_staticSegmentRomEnd - (u32)_nintendo_rogo_staticSegmentRomStart;
|
||||
s32 pad;
|
||||
TitleContext* this = (TitleContext*)thisx;
|
||||
|
||||
this->staticSegment = GameState_Alloc(&this->state, size, "../z_title.c", 611);
|
||||
osSyncPrintf("z_title.c\n");
|
||||
|
@ -175,7 +177,7 @@ void Title_Init(TitleContext* this) {
|
|||
this->state.destroy = Title_Destroy;
|
||||
this->exit = false;
|
||||
gSaveContext.fileNum = 0xFF;
|
||||
func_800A9CD4(&this->state, &this->sram);
|
||||
Sram_Alloc(&this->state, &this->sramCtx);
|
||||
this->ult = 0;
|
||||
this->unk_1D4 = 0x14;
|
||||
this->coverAlpha = 255;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue