Add/update sequences 0, 1, 4, 5

This commit is contained in:
jeffman 2019-09-17 21:55:05 -04:00
parent 5756d24a46
commit 941057bfc6
2 changed files with 193 additions and 37 deletions

View File

@ -1483,6 +1483,25 @@ nop
// Title screen hacks
//==============================================================================
.definelabel m2_title_sequence_00, 0x80117E0
.definelabel m2_title_sequence_01, 0x8011802
.definelabel m2_title_sequence_02, 0x801182A
.definelabel m2_title_sequence_03, 0x8011858
.definelabel m2_title_sequence_04, 0x80118FA
.definelabel m2_title_sequence_05, 0x80118FE
.definelabel m2_title_sequence_06, 0x801195C
.definelabel m2_title_sequence_07, 0x8011972
.definelabel m2_title_sequence_08, 0x80119BA
.definelabel m2_title_sequence_09, 0x80119DE
.definelabel m2_title_sequence_0A, 0x8011A02
.definelabel m2_title_sequence_0B, 0x8011A1A
.definelabel m2_title_sequence_0C, 0x8011A80
.definelabel m2_title_sequence_0D, 0x8011A8A
.definelabel m2_title_sequence_0E, 0x8011AAA
.definelabel m2_title_sequence_0F, 0x8011B58
.definelabel m2_title_sequence_10, 0x8011B66
.definelabel m2_title_sequence_11, 0x8011B76
// m2_title_background_pal_copyright: File has two palettes separated by six palettes
// worth of nullspace. First palette is the copyright palette,
// last palette is a placeholder for the glow palette
@ -1555,8 +1574,19 @@ nop
// Setup hacks:
// Fade BG0 instead of OBJ
.org 0x80117E6 :: mov r0,0xC1
// Point to sequence hacks
.org 0x8011798 :: dw title_sequence_00
.org 0x801179C :: dw title_sequence_01
.org 0x80117A8 :: dw title_sequence_04
.org 0x80117AC :: dw title_sequence_05
// Commit hacks:
// Commit all things on every sequence
.org 0x8011500 :: b 0x8011516
// --- Animation 5 (quick title screen) ---
.org 0x82D6BD4 :: dh 0x008A // Enable 8-bit BG0

View File

@ -11,7 +11,8 @@ ldr r0,=0x8011B8C
mov pc,r0
//---------------------------------------------------------
// r0 = pointer to pointer little struct
// In: r0 = pointer to pointer to little struct
// Out: r0 = pointer to our buffer area (0x2011B60)
title_get_buffer:
push {r1,lr}
ldr r0,[r0]
@ -21,12 +22,38 @@ ldr r1,=0x200
add r0,r0,r1
pop {r1,pc}
//---------------------------------------------------------
title_sequence_00:
// Normally the game enables BG0 in sequence 8, but we want
// it enabled from the start so copy that code to here
mov r1,r9
add r1,0x78
mov r0,0x88
lsl r0,r0,5
strh r0,[r1]
// Copy static palette to BG pal 8
ldr r3,[r3]
ldr r3,[r3,0x14]
ldr r1,=0x40000D4
ldr r2,[r3,0xC] // m2_title_text_pal_static
str r2,[r1]
ldr r0,=0x5000100
str r0,[r1,4]
ldr r0,=0x84000008
str r0,[r1,8]
ldr r0,[r1,8]
// Return to old sequence 0 code
ldr r0,=m2_title_sequence_00
mov pc,r0
//---------------------------------------------------------
title_sequence_01:
// EB has a 38 frame delay between starting the music
// and starting the fade-in
push {r0-r1}
mov r0,r3
bl title_get_buffer
@ -36,45 +63,144 @@ cmp r1,0
beq @@unset
@@set:
// Count to 3 like before
ldr r3,[r3]
ldr r0,[r3,4]
cmp r0,2
bgt @@next_fade
b @@end
@@next_fade:
mov r1,r9
add r1,0x7C
ldrh r0,[r1]
sub r0,1
mov r2,0
strh r0,[r1]
str r2,[r3,4]
ldrh r0,[r1]
cmp r0,0
beq @@fade_done
b @@end
@@fade_done:
mov r0,2
mov r4,r10
str r0,[r4]
b @@end
// Skip our code and return to the old sequence 1 code
ldr r0,=m2_title_sequence_01
mov pc,r0
@@unset:
// Count to 0x26 before starting the fade-in
ldr r3,[r3]
ldr r1,[r3,4]
cmp r1,0x26
bge @@unset_start_fade
b @@end
@@unset_start_fade:
mov r1,0
str r1,[r3,4]
mov r1,1
str r1,[r0]
// Count to 0x26 before starting the fade-in
ldr r3,[r3]
ldr r1,[r3,4]
cmp r1,0x26
bge @@unset_start_fade
b @@end
@@unset_start_fade:
mov r1,0
str r1,[r3,4]
mov r1,1
str r1,[r0]
@@end:
pop {r0-r1}
b title_return
//---------------------------------------------------------
title_sequence_04:
// Just need to reset the frame counter
ldr r2,[r3]
mov r0,1
neg r0,r0 // This gets incremented before calling the sequence subroutines,
// and we want it to be 0 on the first frame for sequence 5,
// so start it at -1
str r0,[r2,4]
ldr r0,=m2_title_sequence_04
mov pc,r0
//---------------------------------------------------------
title_sequence_05:
push {r4}
ldr r3,[r3]
mov r4,r3
ldr r0,[r4,4] // frame number
// Frame 0-1: inverted colours
cmp r0,1
bhi @@next1
// Only change the palette on frame 0
cmp r0,1
beq @@advance_frame
@@inverted:
// Load inverted BG palettes
// (all white for BG pal 0-7,
// all black for BG pal 8-F)
ldr r1,=0x40000D4
mov r2,1
neg r2,r2
push {r2}
mov r2,sp
str r2,[r1]
ldr r0,=0x5000000
str r0,[r1,4]
ldr r0,=0x85000040
str r0,[r1,8]
ldr r0,[r1,8]
mov r2,0
str r2,[sp]
mov r2,sp
str r2,[r1]
ldr r0,=0x5000100
str r0,[r1,4]
ldr r0,=0x85000040
str r0,[r1,8]
ldr r0,[r1,8]
pop {r2}
b @@advance_frame
@@next1:
// Frame 2-29: animated text, 2 frames per palette change
cmp r0,29
bhi @@next2
// Only change palette on the even frames
sub r0,2
lsl r1,r0,0x1F
bmi @@advance_frame
// On frame 2, we need to reset BG pal 0-7 to black
cmp r0,0
bne @@skip_black_palettes
ldr r1,=0x40000D4
push {r0}
mov r2,sp
str r2,[r1]
ldr r2,=0x5000000
str r2,[r1,4]
ldr r2,=0x85000040
str r2,[r1,8]
ldr r2,[r1,8]
add sp,4
@@skip_black_palettes:
// Get source palette address
ldr r3,[r3,0x14]
ldr r1,[r3,8] // m2_title_text_pal_animated
lsl r0,r0,4
add r0,r0,r1
// Copy to BG pal 8
ldr r1,=0x40000D4
str r0,[r1]
ldr r0,=0x5000100
str r0,[r1,4]
ldr r0,=0x84000008
str r0,[r1,8]
ldr r0,[r1,8]
b @@advance_frame
@@next2:
// For now let's just go to the next sequence, not sure what to do next yet
mov r0,0
str r0,[r4,4]
mov r0,6
ldr r1,[r4,0x14]
add r1,0x84
str r0,[r1]
pop {r4}
b title_return
@@advance_frame:
pop {r4}
ldr r0,[r4,4]
add r0,1
str r0,[r4,4]
b title_return
.pool