Merge pull request #65 from Lorenzooone/flyover-thingy

Polish up and complete Flyover-temp
This commit is contained in:
jeffman 2019-08-21 21:09:49 -04:00 committed by GitHub
commit 5e7a321532
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
12 changed files with 187 additions and 2 deletions

BIN
src/data/bigfont.bin Normal file

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

BIN
src/data/flyovertextPoo.bin Normal file

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

8
src/data/largewidths.bin Normal file
View File

@ -0,0 +1,8 @@
 

  
  
 
 

105
src/m2-flyover.asm Normal file
View File

@ -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

View File

@ -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