Skip to content

Commit

Permalink
code clean up and polish code a bit
Browse files Browse the repository at this point in the history
  • Loading branch information
owlisnotacat1 committed Dec 16, 2024
1 parent b9355aa commit b138c8a
Show file tree
Hide file tree
Showing 10 changed files with 14,877 additions and 15,171 deletions.
842 changes: 417 additions & 425 deletions ASM/build/asm_symbols.txt

Large diffs are not rendered by default.

Binary file modified ASM/build/bundle.o
Binary file not shown.
879 changes: 437 additions & 442 deletions ASM/build/c_symbols.txt

Large diffs are not rendered by default.

5 changes: 1 addition & 4 deletions ASM/c/audio.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,7 @@
#define AUDIO_H

#include <stdint.h>

typedef struct {
float x, y, z;
} Vec3f; // move this if needed elsewhere
#include "z64.h"

extern Vec3f z64_SfxDefaultPos;
extern float z64_SfxDefaultFreqAndVolScale;
Expand Down
93 changes: 35 additions & 58 deletions ASM/c/kaleido_scope.c
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
#include "z64.h"
#include "kaleido_scope.h"
#include "stdint.h"


extern SaveContext gSaveContext;
extern KaleidoMgrOverlay gKaleidoMgrOverlayTable[];
extern KaleidoMgrOverlay* gKaleidoMgrCurOvl;

Expand All @@ -12,6 +9,9 @@ s16* D_8082B25C_RELOCATED;
static s32 saveAndQuitConfig = 0;
extern void* ICON_STATIC_GAME_OVER;
extern s32 DmaMgr_RequestSync(void* ram, uintptr_t vrom, size_t size);
extern Vec3f z64_SfxDefaultPos;
extern f32 z64_SfxDefaultFreqAndVolScale;
extern u8 z64_SfxDefaultReverb;

void kaleidoScope_Case7(z64_game_t* play) {
z64_pause_ctxt_t* pauseCtx = &play->pause_ctxt;
Expand All @@ -28,47 +28,41 @@ void kaleidoScope_Case7(z64_game_t* play) {

case 1:
if (play->common.input[0].pad_pressed.a) {
//config variable check here
if (CFG_SAVE_AND_QUIT == 0) {

if (play->pause_ctxt.prompt_choice != 0) {

Interface_SetDoAction(play, DO_ACTION_NONE);
gSaveContext.buttonStatus[0] = gSaveContext.buttonStatus[1] = gSaveContext.buttonStatus[2] =
gSaveContext.buttonStatus[3] = 0;
gSaveContext.hudVisibilityMode = HUD_VISIBILITY_NO_CHANGE;
z64_file.button_status[0] = z64_file.button_status[1] = z64_file.button_status[2] =
z64_file.button_status[3] = 0;
z64_file.hudVisibilityMode = HUD_VISIBILITY_NO_CHANGE;
Interface_ChangeHudVisibilityMode(HUD_VISIBILITY_ALL);
play->pause_ctxt.unk_1EC = 2;
WREG(2) = -6240;
YREG(8) = play->pause_ctxt.unk_204;
func_800F64E0(0);
} else {
Audio_PlaySfxGeneral(18467, &gSfxDefaultPos, 4,
&gSfxDefaultFreqAndVolScale, &gSfxDefaultFreqAndVolScale,
&gSfxDefaultReverb);
Audio_PlaySfxGeneral(18467, &z64_SfxDefaultPos, 4,
&z64_SfxDefaultFreqAndVolScale, &z64_SfxDefaultFreqAndVolScale,
&z64_SfxDefaultReverb);
Play_SaveSceneFlags(play);

gSaveContext.save.info.playerData.savedSceneId = play->scene_index;
z64_file.scene_index = play->scene_index;
Sram_WriteSave_call(&play->unk_0F_[0x0207]);
play->pause_ctxt.unk_1EC = 4;
(*D_8082B25C_RELOCATED) = 90;
}
} else {
if (play->pause_ctxt.prompt_choice != 0) {
// no
play->pause_ctxt.prompt_choice = 0;
Audio_PlaySfxGeneral(NA_SE_SY_DECIDE, &gSfxDefaultPos, 4, &gSfxDefaultFreqAndVolScale,
&gSfxDefaultFreqAndVolScale, &gSfxDefaultReverb);
Audio_PlaySfxGeneral(NA_SE_SY_DECIDE, &z64_SfxDefaultPos, 4, &z64_SfxDefaultFreqAndVolScale,
&z64_SfxDefaultFreqAndVolScale, &z64_SfxDefaultReverb);
play->pause_ctxt.state = PAUSE_STATE_RETURN_TO_TITLE_PROMPT;
DmaMgr_RequestSync(ICON_STATIC_GAME_OVER, 0x00860000, 0x3300);
//gameOverCtx->state++;
} else {
// yes
Audio_PlaySfxGeneral(18467, &gSfxDefaultPos, 4, &gSfxDefaultFreqAndVolScale,
&gSfxDefaultFreqAndVolScale, &gSfxDefaultReverb);
Audio_PlaySfxGeneral(18467, &z64_SfxDefaultPos, 4, &z64_SfxDefaultFreqAndVolScale,
&z64_SfxDefaultFreqAndVolScale, &z64_SfxDefaultReverb);
play->pause_ctxt.prompt_choice = 0;
Play_SaveSceneFlags(play);
gSaveContext.save.info.playerData.savedSceneId = play->scene_index;
z64_file.scene_index = play->scene_index;
Sram_WriteSave_call(&play->unk_0F_[0x0207]);
play->pause_ctxt.state = PAUSE_STATE_RETURN_TO_TITLE_PROMPT_TIMER;
(*D_8082B25C_RELOCATED) = 3;
Expand All @@ -83,9 +77,9 @@ void kaleidoScope_Case7(z64_game_t* play) {
WREG(2) = -6240;
YREG(8) = play->pause_ctxt.unk_204;
func_800F64E0(0);
gSaveContext.buttonStatus[0] = gSaveContext.buttonStatus[1] = gSaveContext.buttonStatus[2] =
gSaveContext.buttonStatus[3] = 0;
gSaveContext.hudVisibilityMode = HUD_VISIBILITY_NO_CHANGE;
z64_file.button_status[0] = z64_file.button_status[1] = z64_file.button_status[2] =
z64_file.button_status[3] = 0;
z64_file.hudVisibilityMode = HUD_VISIBILITY_NO_CHANGE;
Interface_ChangeHudVisibilityMode(HUD_VISIBILITY_ALL);
}
break;
Expand All @@ -94,9 +88,9 @@ void kaleidoScope_Case7(z64_game_t* play) {
if (play->common.input[0].pad_pressed.b || play->common.input[0].pad_pressed.a ||
play->common.input[0].pad_pressed.s || (--(*D_8082B25C_RELOCATED) == 0)) {
Interface_SetDoAction(play, DO_ACTION_NONE);
gSaveContext.buttonStatus[0] = gSaveContext.buttonStatus[1] = gSaveContext.buttonStatus[2] =
gSaveContext.buttonStatus[3] = 0;
gSaveContext.hudVisibilityMode = HUD_VISIBILITY_NO_CHANGE;
z64_file.button_status[0] = z64_file.button_status[1] = z64_file.button_status[2] =
z64_file.button_status[3] = 0;
z64_file.hudVisibilityMode = HUD_VISIBILITY_NO_CHANGE;
Interface_ChangeHudVisibilityMode(HUD_VISIBILITY_ALL);
play->pause_ctxt.unk_1EC = 5;
WREG(2) = -6240;
Expand Down Expand Up @@ -150,30 +144,28 @@ void kaleidoScope_Case7(z64_game_t* play) {

void kaleidoScope_Case21(z64_game_t* play) {
z64_pause_ctxt_t* pauseCtx = &play->pause_ctxt;
Input* input = &play->common.input[0];

if (play->common.input[0].pad_pressed.a || play->common.input[0].pad_pressed.s) {
if (play->pause_ctxt.prompt_choice == 0) {
Audio_PlaySfxGeneral(NA_SE_SY_DECIDE, &gSfxDefaultPos, 4, &gSfxDefaultFreqAndVolScale,
&gSfxDefaultFreqAndVolScale, &gSfxDefaultReverb);
//Audio_PlaySfxGeneral(NA_SE_SY_DECIDE, &z64_SfxDefaultPos, 4, &z64_SfxDefaultFreqAndVolScale,
// &z64_SfxDefaultFreqAndVolScale, &z64_SfxDefaultReverb);
Interface_SetDoAction(play, DO_ACTION_NONE);
play->pause_ctxt.unk_1EC = 2;
WREG(2) = -6240;
YREG(8) = play->pause_ctxt.unk_204;
func_800F64E0(0);
gSaveContext.buttonStatus[0] = gSaveContext.buttonStatus[1] = gSaveContext.buttonStatus[2] =
gSaveContext.buttonStatus[3] = 0;
gSaveContext.hudVisibilityMode = HUD_VISIBILITY_NO_CHANGE;
z64_file.button_status[0] = z64_file.button_status[1] = z64_file.button_status[2] =
z64_file.button_status[3] = 0;
z64_file.hudVisibilityMode = HUD_VISIBILITY_NO_CHANGE;
Interface_ChangeHudVisibilityMode(HUD_VISIBILITY_ALL);
play->pause_ctxt.state = PAUSE_STATE_SAVE_PROMPT;
return;
} else {
Audio_PlaySfxGeneral(NA_SE_SY_DECIDE, &gSfxDefaultPos, 4, &gSfxDefaultFreqAndVolScale,
&gSfxDefaultFreqAndVolScale, &gSfxDefaultReverb);
Audio_PlaySfxGeneral(NA_SE_SY_DECIDE, &z64_SfxDefaultPos, 4, &z64_SfxDefaultFreqAndVolScale,
&z64_SfxDefaultFreqAndVolScale, &z64_SfxDefaultReverb);
func_800F64E0(0);
// returns to title
//SEQCMD_STOP_SEQUENCE(0, 10);
//SEQCMD_STOP_SEQUENCE(3, 10);
SEQCMD_STOP_SEQUENCE(0, 5);
SEQCMD_STOP_SEQUENCE(3, 5);
play->pause_ctxt.state = PAUSE_STATE_REUTRN_TO_TITLE;
}
}
Expand All @@ -188,24 +180,9 @@ void kaleidoScope_Case20(z64_game_t* play) {
} else if (((*D_8082B25C_RELOCATED) <= 80) &&
(play->common.input[0].pad_pressed.a || play->common.input[0].pad_pressed.s)) {
play->pause_ctxt.state = PAUSE_STATE_RETURN_TO_TITLE_PROMPT;
//func_800F64E0(0);
}
}

//void KaleidoScopeCall_Draw(z64_game_t* play) {
// KaleidoMgrOverlay* kaleidoScopeOvl = &gKaleidoMgrOverlayTable[0];
//
// if (R_PAUSE_BG_PRERENDER_STATE >= PAUSE_BG_PRERENDER_READY) {
// if (((play->pause_ctxt.state >= PAUSE_STATE_OPENING_1) && (play->pause_ctxt.state <= PAUSE_STATE_SAVE_PROMPT)) ||
// ((play->pause_ctxt.state == PAUSE_STATE_RETURN_TO_TITLE_PROMPT) || (play->pause_ctxt.state == PAUSE_STATE_RETURN_TO_TITLE_PROMPT_TIMER)) ||
// ((play->pause_ctxt.state >= PAUSE_STATE_11) && (play->pause_ctxt.state <= PAUSE_STATE_CLOSING))) {
// if (gKaleidoMgrCurOvl == kaleidoScopeOvl) {
// sKaleidoScopeDrawFunc(play);
// }
// }
// }
//}

static s16 D_8082A6E0[] = { 100, 255 };

void KaleidoScope_UpdatePrompt(z64_game_t* play) {
Expand All @@ -215,12 +192,12 @@ void KaleidoScope_UpdatePrompt(z64_game_t* play) {
if (((play->pause_ctxt.state == PAUSE_STATE_SAVE_PROMPT) && (play->pause_ctxt.unk_1EC == 1)) ||
(play->pause_ctxt.state == PAUSE_STATE_14) || (play->pause_ctxt.state == PAUSE_STATE_16) || (play->pause_ctxt.state == PAUSE_STATE_RETURN_TO_TITLE_PROMPT)) {
if ((play->pause_ctxt.prompt_choice == 0) && (stickAdjX >= 30)) {
Audio_PlaySfxGeneral(NA_SE_SY_CURSOR, &gSfxDefaultPos, 4, &gSfxDefaultFreqAndVolScale,
&gSfxDefaultFreqAndVolScale, &gSfxDefaultReverb);
Audio_PlaySfxGeneral(NA_SE_SY_CURSOR, &z64_SfxDefaultPos, 4, &z64_SfxDefaultFreqAndVolScale,
&z64_SfxDefaultFreqAndVolScale, &z64_SfxDefaultReverb);
play->pause_ctxt.prompt_choice = 4;
} else if ((play->pause_ctxt.prompt_choice != 0) && (stickAdjX <= -30)) {
Audio_PlaySfxGeneral(NA_SE_SY_CURSOR, &gSfxDefaultPos, 4, &gSfxDefaultFreqAndVolScale,
&gSfxDefaultFreqAndVolScale, &gSfxDefaultReverb);
Audio_PlaySfxGeneral(NA_SE_SY_CURSOR, &z64_SfxDefaultPos, 4, &z64_SfxDefaultFreqAndVolScale,
&z64_SfxDefaultFreqAndVolScale, &z64_SfxDefaultReverb);
play->pause_ctxt.prompt_choice = 0;
}

Expand All @@ -238,4 +215,4 @@ void KaleidoScope_UpdatePrompt(z64_game_t* play) {
VREG(62) ^= 1;
}
}
}
}
Loading

0 comments on commit b138c8a

Please sign in to comment.