Fix https://github.com/jeffman/Mother2GbaTranslation/issues/46 and https://github.com/jeffman/Mother2GbaTranslation/issues/28 (#52)
Also improves formatting from previous pieces of code.
This commit is contained in:
parent
391182811f
commit
0b48ef5400
|
@ -206,10 +206,10 @@ int print_window_header_string(int *dest, byte *str, int x, int y)
|
||||||
return pixelX - (x & 7);
|
return pixelX - (x & 7);
|
||||||
}
|
}
|
||||||
|
|
||||||
void clear_window_header(int *dest)
|
void clear_window_header(int *dest, int length, int x, int y)
|
||||||
{
|
{
|
||||||
dest += (WINDOW_HEADER_X + (WINDOW_HEADER_Y * 32)) * 8;
|
dest += (x + (y * 32)) * 8;
|
||||||
clear_rect_ram(dest, 16, WINDOW_HEADER_BG);
|
clear_rect_ram(dest, length, WINDOW_HEADER_BG);
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned short* print_equip_header(int type, unsigned short *tilemap, unsigned int *dest, WINDOW *window)
|
unsigned short* print_equip_header(int type, unsigned short *tilemap, unsigned int *dest, WINDOW *window)
|
||||||
|
|
|
@ -38,7 +38,7 @@ byte print_character_with_callback(byte chr, int x, int y, int font, int foregro
|
||||||
int *dest, int (*getTileCallback)(int, int), int useTilemap);
|
int *dest, int (*getTileCallback)(int, int), int useTilemap);
|
||||||
byte print_character_to_ram(byte chr, int *dest, int xOffset, int font, int foreground);
|
byte print_character_to_ram(byte chr, int *dest, int xOffset, int font, int foreground);
|
||||||
int print_window_header_string(int *dest, byte *str, int x, int y);
|
int print_window_header_string(int *dest, byte *str, int x, int y);
|
||||||
void clear_window_header(int *dest);
|
void clear_window_header(int *dest, int length, int x, int y);
|
||||||
unsigned short* print_equip_header(int type, unsigned short *tilemap, unsigned int *dest,
|
unsigned short* print_equip_header(int type, unsigned short *tilemap, unsigned int *dest,
|
||||||
WINDOW *window);
|
WINDOW *window);
|
||||||
unsigned short format_tile(unsigned short tile, bool flip_x, bool flip_y);
|
unsigned short format_tile(unsigned short tile, bool flip_x, bool flip_y);
|
||||||
|
|
|
@ -116,6 +116,9 @@ b 0x80BADD8
|
||||||
.org 0x80C55F8
|
.org 0x80C55F8
|
||||||
mov r4,r0
|
mov r4,r0
|
||||||
mov r0,r9
|
mov r0,r9
|
||||||
|
mov r1,#0x10 //Tiles to clear
|
||||||
|
mov r2,#0x10 //x
|
||||||
|
mov r3,#0x11 //y
|
||||||
bl clear_window_header
|
bl clear_window_header
|
||||||
mov r0,r4
|
mov r0,r4
|
||||||
mov r1,r6 // tilemap
|
mov r1,r6 // tilemap
|
||||||
|
@ -794,6 +797,26 @@ nop
|
||||||
//---------------------------------------------------------
|
//---------------------------------------------------------
|
||||||
.org 0x802A75F :: db 0x30 //Add 8 extra frames before the game can start reading again.
|
.org 0x802A75F :: db 0x30 //Add 8 extra frames before the game can start reading again.
|
||||||
|
|
||||||
|
//---------------------------------------------------------
|
||||||
|
// Teleport header fix
|
||||||
|
//---------------------------------------------------------
|
||||||
|
.org 0x80C5DE0 :: bl c65da_clean_print //To:
|
||||||
|
.org 0x80C5E30 :: bl c6190_clean_print //Number on first entering the menu
|
||||||
|
.org 0x80C6190 :: bl c6190_clean_print //Number on page change
|
||||||
|
.org 0x80C5E04 :: nop :: strh r0,[r4,#0] :: add r4,#2 :: nop ::nop //Remove extra tile
|
||||||
|
|
||||||
|
//---------------------------------------------------------
|
||||||
|
// Stored Goods header fix
|
||||||
|
//---------------------------------------------------------
|
||||||
|
.org 0x80C656C :: mov r2,#0x10 :: mov r3,#0x11 :: bl c6570_clean_print_change_pos :: b 0x80C65C0 //Changes position and cleans tiles for Stored Goods
|
||||||
|
.org 0x80C65DA :: bl c65da_clean_print //Number on first entering the menu
|
||||||
|
.org 0x80C6996 :: bl c65da_clean_print //Number on page change
|
||||||
|
|
||||||
|
//---------------------------------------------------------
|
||||||
|
// Call header fix
|
||||||
|
//---------------------------------------------------------
|
||||||
|
.org 0x80BD26A :: bl c6190_clean_print //Call:
|
||||||
|
|
||||||
//---------------------------------------------------------
|
//---------------------------------------------------------
|
||||||
// Fix windows printing too many tiles due to not going off of pixels, but off of characters
|
// Fix windows printing too many tiles due to not going off of pixels, but off of characters
|
||||||
//---------------------------------------------------------
|
//---------------------------------------------------------
|
||||||
|
|
|
@ -1393,6 +1393,7 @@ lsl r0,r0,#3 //Re-multiply by 8
|
||||||
cmp r0,r1 //Can it stay in r0 pixels? (Was this a division by 8 without remainder?)
|
cmp r0,r1 //Can it stay in r0 pixels? (Was this a division by 8 without remainder?)
|
||||||
beq @@next
|
beq @@next
|
||||||
add r0,#8 //If it cannot stay in x tiles, add 1 to the amount of tiles needed
|
add r0,#8 //If it cannot stay in x tiles, add 1 to the amount of tiles needed
|
||||||
|
|
||||||
@@next:
|
@@next:
|
||||||
lsr r0,r0,#3 //Get the amount of tiles needed
|
lsr r0,r0,#3 //Get the amount of tiles needed
|
||||||
cmp r0,r2 //If it's not the same amout as the characters...
|
cmp r0,r2 //If it's not the same amout as the characters...
|
||||||
|
@ -1400,6 +1401,7 @@ beq @@end
|
||||||
sub r0,r2,r0
|
sub r0,r2,r0
|
||||||
lsl r0,r0,#1
|
lsl r0,r0,#1
|
||||||
sub r6,r6,r0 //Remove the amount of extra tiles
|
sub r6,r6,r0 //Remove the amount of extra tiles
|
||||||
|
|
||||||
@@end:
|
@@end:
|
||||||
pop {pc}
|
pop {pc}
|
||||||
|
|
||||||
|
@ -1451,3 +1453,65 @@ bl fix_char_tiles
|
||||||
mov r2,r8 //Clobbered code
|
mov r2,r8 //Clobbered code
|
||||||
ldrh r0,[r2,#0]
|
ldrh r0,[r2,#0]
|
||||||
pop {pc}
|
pop {pc}
|
||||||
|
|
||||||
|
//==============================================================================
|
||||||
|
//Routine which clears the header and THEN makes it so the string is printed
|
||||||
|
c6190_clean_print:
|
||||||
|
push {lr}
|
||||||
|
push {r0-r3}
|
||||||
|
mov r1,#6 //Number of tiles to clean
|
||||||
|
bl clear_window_header
|
||||||
|
pop {r0-r3}
|
||||||
|
bl 0x80CAB90
|
||||||
|
pop {pc}
|
||||||
|
|
||||||
|
//==============================================================================
|
||||||
|
//Routine which clears the header and THEN makes it so the string is printed
|
||||||
|
c65da_clean_print:
|
||||||
|
push {lr}
|
||||||
|
push {r0-r3}
|
||||||
|
mov r1,#3 //Number of tiles to clean
|
||||||
|
bl clear_window_header
|
||||||
|
pop {r0-r3}
|
||||||
|
bl 0x80CAB90
|
||||||
|
pop {pc}
|
||||||
|
|
||||||
|
//==============================================================================
|
||||||
|
//Routine which clears the header and THEN makes it so the string is printed
|
||||||
|
_0x10_clean_print:
|
||||||
|
push {lr}
|
||||||
|
push {r0-r3}
|
||||||
|
mov r1,#0x10 //Number of tiles to clean
|
||||||
|
bl clear_window_header
|
||||||
|
pop {r0-r3}
|
||||||
|
bl 0x80CAB90
|
||||||
|
pop {pc}
|
||||||
|
|
||||||
|
//==============================================================================
|
||||||
|
//Routine which calls the header clearer and changes the position of Stored Goods in the arrangement
|
||||||
|
c6570_clean_print_change_pos:
|
||||||
|
push {lr}
|
||||||
|
bl _0x10_clean_print
|
||||||
|
ldr r2,=#0x230 //Change starting position
|
||||||
|
mov r0,r2 //Clobbered code
|
||||||
|
ldrh r3,[r4,#0]
|
||||||
|
add r0,r0,r3
|
||||||
|
mov r2,r8
|
||||||
|
ldrh r1,[r2,#0]
|
||||||
|
orr r0,r1
|
||||||
|
mov r2,#0
|
||||||
|
|
||||||
|
@@cycle: //Print 9 tiles in the arrangement
|
||||||
|
lsl r0,r0,#0x10
|
||||||
|
lsr r0,r0,#0x10
|
||||||
|
mov r1,r0
|
||||||
|
add r0,r1,#1
|
||||||
|
strh r1,[r5,#0]
|
||||||
|
add r5,#2
|
||||||
|
add r2,#1
|
||||||
|
cmp r2,#9
|
||||||
|
bne @@cycle
|
||||||
|
|
||||||
|
pop {pc}
|
||||||
|
|
||||||
|
.pool
|
||||||
|
|
|
@ -126,7 +126,7 @@
|
||||||
810724
|
810724
|
||||||
],
|
],
|
||||||
"Old": "ばしょ[00 FF]",
|
"Old": "ばしょ[00 FF]",
|
||||||
"New": "To[00 FF]"
|
"New": "To:[00 FF]"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"OldPointer": 11647572,
|
"OldPointer": 11647572,
|
||||||
|
@ -134,7 +134,7 @@
|
||||||
813508
|
813508
|
||||||
],
|
],
|
||||||
"Old": "➨あずかりもの(1)へ[00 FF]",
|
"Old": "➨あずかりもの(1)へ[00 FF]",
|
||||||
"New": "➨Stored goods(1)[00 FF]"
|
"New": "➨Stored Goods(1)[00 FF]"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"OldPointer": 11647585,
|
"OldPointer": 11647585,
|
||||||
|
@ -143,13 +143,13 @@
|
||||||
813768
|
813768
|
||||||
],
|
],
|
||||||
"Old": "➨あずかりもの(2)へ[00 FF]",
|
"Old": "➨あずかりもの(2)へ[00 FF]",
|
||||||
"New": "➨Stored goods(2)[00 FF]"
|
"New": "➨Stored Goods(2)[00 FF]"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"OldPointer": 11647598,
|
"OldPointer": 11647598,
|
||||||
"PointerLocations": [],
|
"PointerLocations": [],
|
||||||
"Old": "➨あずかりもの(3)へ[00 FF]",
|
"Old": "➨あずかりもの(3)へ[00 FF]",
|
||||||
"New": "➨Stored goods(3)[00 FF]"
|
"New": "➨Stored Goods(3)[00 FF]"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"OldPointer": 11647611,
|
"OldPointer": 11647611,
|
||||||
|
@ -157,6 +157,6 @@
|
||||||
812788
|
812788
|
||||||
],
|
],
|
||||||
"Old": "あずかりもの[00 FF]",
|
"Old": "あずかりもの[00 FF]",
|
||||||
"New": "Stored goods[00 FF]"
|
"New": "Stored Goods[00 FF]"
|
||||||
}
|
}
|
||||||
]
|
]
|
Loading…
Reference in New Issue