diff --git a/src/data/bigfont.bin b/src/data/bigfont.bin new file mode 100644 index 0000000..db21431 Binary files /dev/null and b/src/data/bigfont.bin differ diff --git a/src/data/flyovertextDalaam.bin b/src/data/flyovertextDalaam.bin new file mode 100644 index 0000000..8505481 Binary files /dev/null and b/src/data/flyovertextDalaam.bin differ diff --git a/src/data/flyovertextLater.bin b/src/data/flyovertextLater.bin new file mode 100644 index 0000000..98ce7bf Binary files /dev/null and b/src/data/flyovertextLater.bin differ diff --git a/src/data/flyovertextNess.bin b/src/data/flyovertextNess.bin new file mode 100644 index 0000000..c7badd6 Binary files /dev/null and b/src/data/flyovertextNess.bin differ diff --git a/src/data/flyovertextOnett.bin b/src/data/flyovertextOnett.bin new file mode 100644 index 0000000..7e380ec Binary files /dev/null and b/src/data/flyovertextOnett.bin differ diff --git a/src/data/flyovertextPoo.bin b/src/data/flyovertextPoo.bin new file mode 100644 index 0000000..4b7fd50 Binary files /dev/null and b/src/data/flyovertextPoo.bin differ diff --git a/src/data/flyovertextSnow.bin b/src/data/flyovertextSnow.bin new file mode 100644 index 0000000..bdae8ec Binary files /dev/null and b/src/data/flyovertextSnow.bin differ diff --git a/src/data/flyovertextWinters.bin b/src/data/flyovertextWinters.bin new file mode 100644 index 0000000..e2fb1c4 Binary files /dev/null and b/src/data/flyovertextWinters.bin differ diff --git a/src/data/flyovertextYear.bin b/src/data/flyovertextYear.bin new file mode 100644 index 0000000..8f8ac4e Binary files /dev/null and b/src/data/flyovertextYear.bin differ diff --git a/src/data/largewidths.bin b/src/data/largewidths.bin new file mode 100644 index 0000000..17a9811 --- /dev/null +++ b/src/data/largewidths.bin @@ -0,0 +1,8 @@ +  + + + +   +   +  +  \ No newline at end of file diff --git a/src/m2-flyover.asm b/src/m2-flyover.asm new file mode 100644 index 0000000..cba4361 --- /dev/null +++ b/src/m2-flyover.asm @@ -0,0 +1,105 @@ +//============================================================================== +//Writes the bigfont letters to RAM +largevwf: +push {r5,lr} +mov r0,r2 +ldrb r1,[r4] +add r4,r4,1 +ldr r2,=m2_widths_big +cmp r1,#0xFC //0xFC to 0xFF are used by us to print the party's names +bge @@name +ldrb r2,[r2,r1] +bl 0x80B3280 //Print the letter to RAM + +@@end: +pop {r5,pc} + +@@name: +mov r5,#0xFC +sub r1,r1,r5 +ldr r3,=#m2_ness_name //Base name address +lsl r5,r1,#3 +sub r5,r5,r1 //Get index * 7 to get the name's address +add r3,r3,r5 +mov r5,r2 //r5 now has m2_widths_big +mov r1,#0 + +@@name_loading_cycle: +ldrb r2,[r3,#1] +cmp r2,#0xFF //Does the name end? (00 FF) +beq @@end +push {r0-r3} +ldrb r2,[r3,#0] //If not, render the letter (So real letter - 80) +mov r1,#80 +sub r1,r2,r1 +ldrb r2,[r5,r1] +bl 0x80B3280 //Print the letter to RAM +pop {r0-r3} +add r3,#1 +add r1,#1 +cmp r1,#5 //Maximum name length, has it been reached? If not, continue printing +bne @@name_loading_cycle +b @@end + +.pool + +//============================================================================== +//Weld the odd-numbered flyover letters +flyoverweld: +push {r5-r7,lr} +add r1,r1,r3 +ldrb r0,[r1] //Load the width of the letter that has to be weld +ldr r5,=#0x30051D4 +ldr r5,[r5] +mov r6,#0x90 +lsl r6,r6,#6 +add r5,r5,r6 +ldrh r5,[r5] //Load the current X in pixels +mov r6,#1 +and r5,r6 +cmp r5,#1 //Is it even? +bne @@even + +ldrb r5,[r4] //If not, load the first nibble of the current width that is in r4 +mov r6,#0xF +and r5,r6 +lsl r6,r0,#4 +orr r5,r6 //Add 0xF0 to it +mov r6,#0xFF +and r5,r6 //Make sure it stays in one byte +strb r5,[r4] //Store it + +mov r7,r4 +mov r6,#3 +and r7,r6 +cmp r7,#3 //Do r4's bits end with a 3? +bne @@old +mov r7,r4 //If they do, make r7 = r4 + 0x1C +add r7,#0x1C +b @@ok + +@@old: //If they do not, make r7 = r4 +mov r7,r4 + +@@ok: +ldrb r5,[r7,#1] +mov r6,#0xF0 +and r5,r6 //Get the second nibble of what is in r7 + 1 +lsr r6,r0,#4 +orr r5,r6 //Make the first nibble 0xF +strb r5,[r7,#1] //Store it back in r7 + 1 +b @@end + +@@even: //If it is, store the width in r4 +strb r0,[r4] + +@@end: +pop {r5-r7,pc} + +.pool + +//.org 0x80c4c0c +//.byte 0x20,0x1C,0x51,0x46,0x2A,0x22 + + +//0x80B3256 \ No newline at end of file diff --git a/src/m2-hack.asm b/src/m2-hack.asm index 622bb49..e1f27e4 100644 --- a/src/m2-hack.asm +++ b/src/m2-hack.asm @@ -977,6 +977,53 @@ nop .org 0x80D3984 :: cmp r0,#3 //Now "PSI " is 4 letters long, not 2 .org 0x80D399E :: sub r0,#4 //Subtract from r0 the length of "PSI " +//--------------------------------------------------------- +// Flyover hacks +//--------------------------------------------------------- + +//Notes +//Flyover entries are made of 16 bits codes. Codes with the first byte between 0 and 9 are special cases. +//01 XX = Position at X tile XX (Changed to Position at X pixel XX) +//02 XX = Position at Y tile XX +//09 00 = END +//80 XX = Print character XX + +//Flyover pointer remapping +.org 0x873112c :: dw flyovertextYear //The year is 199x +.org 0x8731130 :: dw flyovertextOnett //Onett, a small town in eagleland +.org 0x8731134 :: dw flyovertextNess //Ness's House +.org 0x8731138 :: dw flyovertextWinters //Winters, a small country to the north +.org 0x873113C :: dw flyovertextSnow //Snow Wood Boarding House +.org 0x8731140 :: dw flyovertextDalaam //Dalaam, in the Far East +.org 0x8731144 :: dw flyovertextPoo //The palace of Poo\nThe Crown Prince +.org 0x8731148 :: dw flyovertextLater //Later that night... + +//Flyover remapping +.org 0x80B3482 :: bl largevwf :: b 0x80B348E + +// Weld the odd-numbered flyover letters +.org 0x80B3254 :: bl flyoverweld :: nop + +// Make it so the entire possible tileset is used +.org 0x80AE568 :: mov r0,#8 +.org 0x80AE56E :: mov r0,#7 +.org 0x80AE57A :: mov r1,#0x80 //Start at 0x100 instead of 0x120 + +// Change the [01 XX] flyover code to pixels from left of screen +.org 0x80B332C :: b 0x80B3334 + +// Alter the flyover palette so the borders don't show (orig 0x739C) +.org 0x80FCE50 :: .byte 0x00,0x00 + +//Insert the font +.org 0x80B3274 :: dw m2_font_big + +//Print all 16 rows +.org 0x80B3262 :: cmp r7,0xF + +//Print all 16 columns +.org 0x80B325C :: cmp r6,7 + //--------------------------------------------------------- // Names hacks //--------------------------------------------------------- @@ -1209,7 +1256,7 @@ m2_font_main: m2_font_saturn: .incbin "data/m2-font-saturn.bin" m2_font_big: -.incbin "data/m2-font-big.bin" +.incbin "data/bigfont.bin" m2_font_battle: .incbin "data/m2-font-battle.bin" m2_font_tiny: @@ -1237,7 +1284,7 @@ m2_widths_main: m2_widths_saturn: .incbin "data/m2-widths-saturn.bin" m2_widths_big: -.incbin "data/m2-widths-big.bin" +.incbin "data/largewidths.bin" m2_widths_battle: .incbin "data/m2-widths-battle.bin" m2_widths_tiny: @@ -1252,6 +1299,30 @@ m2_nybbles_to_bits: m2_enemy_attributes: .incbin "data/m2-enemy-attributes.bin" +flyovertextYear: +.incbin "data/flyovertextYear.bin" + +flyovertextOnett: +.incbin "data/flyovertextOnett.bin" + +flyovertextNess: +.incbin "data/flyovertextNess.bin" + +flyovertextWinters: +.incbin "data/flyovertextWinters.bin" + +flyovertextSnow: +.incbin "data/flyovertextSnow.bin" + +flyovertextDalaam: +.incbin "data/flyovertextDalaam.bin" + +flyovertextPoo: +.incbin "data/flyovertextPoo.bin" + +flyovertextLater: +.incbin "data/flyovertextLater.bin" + //============================================================================== // Existing subroutines/data //============================================================================== @@ -1331,5 +1402,6 @@ m2_enemy_attributes: .include "m2-formatting.asm" .include "m2-customcodes.asm" .include "m2-compiled.asm" +.include "m2-flyover.asm" .close