Skip to content

Commit

Permalink
Rebase on 8.2 and add code suggestions
Browse files Browse the repository at this point in the history
  • Loading branch information
GSKirox committed Oct 1, 2024
1 parent 999d1cc commit 6f22bec
Show file tree
Hide file tree
Showing 10 changed files with 39,472 additions and 111,580 deletions.
2,850 changes: 1,432 additions & 1,418 deletions ASM/build/asm_symbols.txt

Large diffs are not rendered by default.

Binary file modified ASM/build/bundle.o
Binary file not shown.
853 changes: 432 additions & 421 deletions ASM/build/c_symbols.txt

Large diffs are not rendered by default.

1 change: 0 additions & 1 deletion ASM/c/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,6 @@ void after_game_state_update() {
#if DEBUG_MODE
debug_utilities(&debug_db);
#endif

}
close_rando_display_buffer();
give_sage_gifts();
Expand Down
63 changes: 23 additions & 40 deletions ASM/c/ocarina_buttons.c
Original file line number Diff line number Diff line change
@@ -1,41 +1,26 @@
#include "ocarina_buttons.h"
#include "gfx.h"

uint8_t has_a_button() {
return !SHUFFLE_OCARINA_BUTTONS || z64_file.scene_flags[0x50].unk_00_ & 1 << 0;
}

uint8_t has_cup_button() {
return !SHUFFLE_OCARINA_BUTTONS || z64_file.scene_flags[0x50].unk_00_ & 1 << 1;
}

uint8_t has_cdown_button() {
return !SHUFFLE_OCARINA_BUTTONS || z64_file.scene_flags[0x50].unk_00_ & 1 << 2;
}

uint8_t has_cleft_button() {
return !SHUFFLE_OCARINA_BUTTONS || z64_file.scene_flags[0x50].unk_00_ & 1 << 3;
}

uint8_t has_cright_button() {
return !SHUFFLE_OCARINA_BUTTONS || z64_file.scene_flags[0x50].unk_00_ & 1 << 4;
bool has_ocarina_button(uint8_t button) {
return !SHUFFLE_OCARINA_BUTTONS || z64_file.scene_flags[0x50].unk_00_ & button;
}

uint8_t c_block_ocarina() {
uint8_t res = 0;
if (!(has_a_button())) { // A
if (!has_ocarina_button(OCARINA_A_BUTTON)) {
res |= 1 << 0;
}
if (!(has_cup_button())) { // C up
if (!has_ocarina_button(OCARINA_C_UP_BUTTON)) {
res |= 1 << 1;
}
if (!(has_cdown_button())) { // C down
if (!has_ocarina_button(OCARINA_C_DOWN_BUTTON)) {
res |= 1 << 2;
}
if (!(has_cleft_button())) { // C left
if (!has_ocarina_button(OCARINA_C_LEFT_BUTTON)) {
res |= 1 << 3;
}
if (!(has_cright_button())) { // C right
if (!has_ocarina_button(OCARINA_C_RIGHT_BUTTON)) {
res |= 1 << 4;
}
return res;
Expand All @@ -53,7 +38,7 @@ void print_ocarina_a(z64_disp_buf_t* db, uint8_t left, uint8_t top) {
int icon_width = 8;
int icon_height = 8;
gDPSetPrimColor(db->p++, 0, 0, 0x5A, 0x5A, 0xFF, 0xFF);
if (!(has_a_button())) {
if (!has_ocarina_button(OCARINA_A_BUTTON)) {
gDPSetPrimColor(db->p++, 0, 0, 0x40, 0x40, 0x40, 0x90);
}
sprite_draw(db, &ocarina_button_sprite, 0, left, top, icon_width, icon_height);
Expand All @@ -63,7 +48,7 @@ void print_ocarina_cup(z64_disp_buf_t* db, uint8_t left, uint8_t top) {
int icon_width = 8;
int icon_height = 8;
gDPSetPrimColor(db->p++, 0, 0, 0xFA, 0xA0, 0x00, 0xFF);
if (!(has_cup_button())) {
if (!has_ocarina_button(OCARINA_C_UP_BUTTON)) {
gDPSetPrimColor(db->p++, 0, 0, 0x40, 0x40, 0x40, 0x90);
}
sprite_draw(db, &ocarina_button_sprite, 4, left, top, icon_width, icon_height);
Expand All @@ -73,7 +58,7 @@ void print_ocarina_cdown(z64_disp_buf_t* db, uint8_t left, uint8_t top) {
int icon_width = 8;
int icon_height = 8;
gDPSetPrimColor(db->p++, 0, 0, 0xFA, 0xA0, 0x00, 0xFF);
if (!(has_cdown_button())) {
if (!has_ocarina_button(OCARINA_C_DOWN_BUTTON)) {
gDPSetPrimColor(db->p++, 0, 0, 0x40, 0x40, 0x40, 0x90);
}
sprite_draw(db, &ocarina_button_sprite, 1, left, top, icon_width, icon_height);
Expand All @@ -83,7 +68,7 @@ void print_ocarina_cleft(z64_disp_buf_t* db, uint8_t left, uint8_t top) {
int icon_width = 8;
int icon_height = 8;
gDPSetPrimColor(db->p++, 0, 0, 0xFA, 0xA0, 0x00, 0xFF);
if (!(has_cleft_button())) {
if (!has_ocarina_button(OCARINA_C_LEFT_BUTTON)) {
gDPSetPrimColor(db->p++, 0, 0, 0x40, 0x40, 0x40, 0x90);
}
sprite_draw(db, &ocarina_button_sprite, 3, left, top, icon_width, icon_height);
Expand All @@ -93,7 +78,7 @@ void print_ocarina_cright(z64_disp_buf_t* db, uint8_t left, uint8_t top) {
int icon_width = 8;
int icon_height = 8;
gDPSetPrimColor(db->p++, 0, 0, 0xFA, 0xA0, 0x00, 0xFF);
if (!(has_cright_button())) {
if (!has_ocarina_button(OCARINA_C_RIGHT_BUTTON)) {
gDPSetPrimColor(db->p++, 0, 0, 0x40, 0x40, 0x40, 0x90);
}
sprite_draw(db, &ocarina_button_sprite, 2, left, top, icon_width, icon_height);
Expand All @@ -105,37 +90,35 @@ typedef struct {
uint8_t pos;
} song_color_and_position;
const song_color_and_position songs_colors_and_positions[12] = {
{{0x97, 0xFF, 0x63, 0xFF}, 6}, // Minuet
{{0xFF, 0x50, 0x28, 0xFF}, 7}, // Bolero
{{0x63, 0x97, 0xFF, 0xFF}, 8}, // Serenade
{{0xFF, 0x63, 0xFF, 0xFF}, 10}, // Nocturne
{{0xFF, 0x9F, 0x00, 0xFF}, 9}, // Requiem
{{0xFF, 0xF0, 0x63, 0xFF}, 11},// Prelude
{{0xFF, 0x50, 0x28, 0xFF}, 0}, // ZL
{{0xFF, 0x9F, 0x00, 0xFF}, 1}, // Epona
{{0x97, 0xFF, 0x63, 0xFF}, 2}, // Saria
{{0xFF, 0xF0, 0x63, 0xFF}, 3}, // Suns
{{0x63, 0x97, 0xFF, 0xFF}, 4}, // SoT
{{0xFF, 0x63, 0xFF, 0xFF}, 5}, // SoS
{{0x97, 0xFF, 0x63, 0xFF}, 6}, // Minuet
{{0xFF, 0x50, 0x28, 0xFF}, 7}, // Bolero
{{0x63, 0x97, 0xFF, 0xFF}, 8}, // Serenade
{{0xFF, 0x9F, 0x00, 0xFF}, 9}, // Requiem
{{0xFF, 0x63, 0xFF, 0xFF}, 10}, // Nocturne
{{0xFF, 0xF0, 0x63, 0xFF}, 11}, // Prelude
};

uint8_t ocarina_action_ok(uint16_t ocarinaAction) {

bool ocarina_action_ok(uint16_t ocarinaAction) {
if (ocarinaAction == 1) { // OCARINA_ACTION_FREE_PLAY
return 1;
return true;
}
if (ocarinaAction >= 0x1C && // OCARINA_ACTION_CHECK_MINUET
ocarinaAction <= 0x27) { // OCARINA_ACTION_CHECK_STORMS
return 1;
return true;
}
if (ocarinaAction == 0x30) { // OCARINA_ACTION_CHECK_NOWARP
return 1;
return true;
}
return 0;
return false;
}

void draw_ocarina_melodies(z64_disp_buf_t* db) {

if (!SHOW_OCARINA_MELODIES) {
return;
}
Expand Down
8 changes: 8 additions & 0 deletions ASM/c/ocarina_buttons.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,16 @@

uint8_t c_block_ocarina();
int8_t can_spawn_epona();
bool has_ocarina_button(uint8_t button);

extern uint8_t SHUFFLE_OCARINA_BUTTONS;

typedef enum {
OCARINA_A_BUTTON = 1 << 0,
OCARINA_C_UP_BUTTON = 1 << 1,
OCARINA_C_DOWN_BUTTON = 1 << 2,
OCARINA_C_LEFT_BUTTON = 1 << 3,
OCARINA_C_RIGHT_BUTTON = 1 << 4,
} OcarinaButtons;
void draw_ocarina_melodies(z64_disp_buf_t* db);
#endif
26 changes: 13 additions & 13 deletions OcarinaSongs.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,19 +70,19 @@
]

USUAL_SORT_ORDER: list[str] = [
'Zeldas Lullaby',
'Eponas Song',
'Sarias Song',
'Suns Song',
'Song of Time',
'Song of Storms',
'Minuet of Forest',
'Bolero of Fire',
'Serenade of Water',
'Requiem of Spirit',
'Nocturne of Shadow',
'Prelude of Light',
]
'Zeldas Lullaby',
'Eponas Song',
'Sarias Song',
'Suns Song',
'Song of Time',
'Song of Storms',
'Minuet of Forest',
'Bolero of Fire',
'Serenade of Water',
'Requiem of Spirit',
'Nocturne of Shadow',
'Prelude of Light',
]

# Song name: (rom index, warp, vanilla activation),
SONG_TABLE: dict[str, tuple[int, bool, str]] = {
Expand Down
Loading

0 comments on commit 6f22bec

Please sign in to comment.