This commit is contained in:
PhoenixBound 2019-09-07 16:31:20 -05:00
commit 2c5004697d
51 changed files with 5584 additions and 375 deletions

View File

@ -3,6 +3,7 @@ Hacking, script tool, script compiler/decompiler:
Text conversion:
JeffMan
Lorenzooone
ItsIggy
TheZunar123
EBrent

View File

@ -1,3 +1,8 @@
| Branch | Status |
| --- | --- |
| Project | [![Build status](https://ci.appveyor.com/api/projects/status/9ml81r7fn0k7i8g1?svg=true)](https://ci.appveyor.com/project/jeffman/mother2gbatranslation) |
| `master` | [![Build status](https://ci.appveyor.com/api/projects/status/9ml81r7fn0k7i8g1/branch/master?svg=true)](https://ci.appveyor.com/project/jeffman/mother2gbatranslation/branch/master) |
# MOTHER 2 Translation for the GBA
This is a work-in-progress translation patch for MOTHER 2 on the GBA.
@ -22,7 +27,7 @@ A few years after that, I tried it again from scratch with the intent of having
This project aims to both complete the VWF codebase and to provide a tool for translating the game's dialogue. My new intent is to bring the hack to a state where I can just sit down and translate text efficiently in my spare time with a graphical tool. Not only that, but having such a tool means that other people can contribute!
## Screenshots
![](./screenshots/itshappening2.png) ![](./screenshots/itshappening4.png) ![](./screenshots/itshappening5.png) ![](./screenshots/m2-status2.png)
![](./screenshots/itshappening2.png) ![](./screenshots/itshappening4.png) ![](./screenshots/itshappening5.png) ![](./screenshots/m2-status2.png) ![](./screenshots/m2-battle-slugs.png) ![](./screenshots/m2-fileselect.png)
# Building
@ -47,7 +52,7 @@ This project aims to both complete the VWF codebase and to provide a tool for tr
- Windows: grab the latest release [here](https://github.com/Kingcom/armips/releases) and copy the executable to `bin/armips.exe`.
- Linux: follow the [README](https://github.com/Kingcom/armips/blob/master/Readme.md) to build `armips` and copy the executable to `bin/armips`.
2. Building the ROM
1. Run `build.ps1` (like in Step 4).
1. Run `build.ps1`.
2. The default compiled ROM is copied to `bin/m12.gba`.
3. (Optional) Build the GUI script tool:
1. `dotnet build tools/ScriptTool` (don't set the output directory)

View File

@ -14,7 +14,8 @@ $input_c_files =
"src/c/ext.c",
"src/c/vwf.c",
"src/c/locs.c",
"src/c/goods.c"
"src/c/goods.c",
"src/c/fileselect.c"
$base_c_address = 0x8100000;
$scripttool_cmd = "bin/ScriptTool/ScriptTool.dll"
@ -62,7 +63,7 @@ $combine_script_contents =
"SECTIONS { .text 0x$($base_c_address.ToString('X')) : { *(.text .rodata) } }"
$link_script_contents =
"SECTIONS { .text 0x$($base_c_address.ToString('X')) : { *(.text .data .rodata) } }"
"SECTIONS { .text 0x$($base_c_address.ToString('X')) : { *(.text .data .rodata*) } }"
#EndRegion Variables
#Region Functions

38
notes/m2-fileselect.txt Normal file
View File

@ -0,0 +1,38 @@
80035AC: print file select/naming string
r0: tile x
r1: tile y
r2: characters to print
r3: string buffer (0xFF terminated)
sp: arg4
g = arg4 * 20
row = 0 or 1 (note that it scans each string twice, once for the first row of tiles and once for the second row)
tileset destination = [82B79B4 + g] + (x * 2) + ((y + row) * [82B79BC + g] * 2)
----
A template tileset is decompressed from 86DB070 to 200A400 (note: "1: Ness" starts printing to 200A434)
It seems to get fully overwritten, so we can replace it with all blank tiles
----
We also need to blank out the font that gets decompressed from 86D9808 to VRAM at 6008000
----
Note that the palette on these screens uses 0x1 for background, 0x9 for foreground
----
We need to allocate more space for the strings... The same only allocates 32 bytes per file slot,
but we need at least 41:
"X: " 3
"NAME " 5
[FE 5F xx] 3
"Level: XX" 9
[FE 5F xx] 3
"Text speed: Medium" 18
= 41
However, the game allocates 32 bytes per row per file slot, which is actually 64 total, so we should be ok.

View File

@ -85,6 +85,11 @@ English names:
- 04: Body select
- 05: Arms select
- 06: Other select
- PSI:
- 01: character select
- 02: PSI select
- 03: target select
- 04: text box
0x3005228: current text palette, << 0xC
0x3005230: addresses of all 11 windows
[00]: A menu

291
notes/m2-sub1E30.txt Normal file
View File

@ -0,0 +1,291 @@
// Format file select strings
// r0: file select struct
08001E30 (T) push r4-r7,r14
08001E32 (T) mov r7,r10
08001E34 (T) mov r6,r9
08001E36 (T) mov r5,r8
08001E38 (T) push r5-r7
08001E3A (T) add sp,-1Ch
08001E3C (T) mov r7,r0
08001E3E (T) mov r0,r13
08001E40 (T) ldr r1,=80FC454h
08001E42 (T) ldmia [r1]!,r2-r4
08001E44 (T) stmia [r0]!,r2-r4
08001E46 (T) mov r1,0h
08001E48 (T) ldsh r0,[r7,r1] // 0 if file exists, -1 otherwise
08001E4A (T) cmp r0,0h
08001E4C (T) bge 8001E5Ch
08001E4E (T) mov r0,r7
08001E50 (T) bl 8001DC8h // presumably this formats the Start New Game string
08001E54 (T) b 8002062h
08001E56 (T) lsl r0,r0,0h
08001E58 (T) stmia [r4]!,r2,r4,r6
08001E5A (T) lsr r7,r1,20h
08001E5C (T) mov r4,0h
08001E5E (T) ldr r2,=205h
08001E60 (T) add r2,r2,r7
08001E62 (T) mov r9,r2 // address of file number colon (1st row)
08001E64 (T) ldr r3,=225h
08001E66 (T) add r3,r3,r7
08001E68 (T) mov r10,r3 // address of file number colon (2nd row)
08001E6A (T) ldr r0,=206h
08001E6C (T) add r0,r7,r0
08001E6E (T) str r0,[sp,0Ch] // address of space after colon (1st)
08001E70 (T) ldr r1,=226h
08001E72 (T) add r1,r7,r1
08001E74 (T) str r1,[sp,14h] // address of space after colon (2nd)
08001E76 (T) ldr r2,=207h
08001E78 (T) add r2,r7,r2
08001E7A (T) str r2,[sp,10h] // address of ness' name (1st)
08001E7C (T) ldr r3,=227h
08001E7E (T) add r3,r7,r3
08001E80 (T) str r3,[sp,18h] // address of ness' name (2nd)
08001E82 (T) mov r0,0Ch
08001E84 (T) add r0,r0,r7
08001E86 (T) mov r8,r0 // address of ness' name (source string)
08001E88 (T) mov r1,89h
08001E8A (T) lsl r1,r1,2h
08001E8C (T) add r5,r7,r1 // address of 2nd row
// Fill second row (32 bytes) with spaces
08001E8E (T) bl 80057B0h // literally just returns a space (0x4D)
08001E92 (T) add r1,r5,r4
08001E94 (T) strb r0,[r1]
08001E96 (T) add r4,1h
08001E98 (T) cmp r4,1Fh
08001E9A (T) ble 8001E8Eh
// Format file slot number
08001E9C (T) mov r2,81h
08001E9E (T) lsl r2,r2,2h
08001EA0 (T) add r5,r7,r2 // address of 1st row
08001EA2 (T) mov r3,89h
08001EA4 (T) lsl r3,r3,2h
08001EA6 (T) add r6,r7,r3 // address of 2nd row
08001EA8 (T) mov r4,2h
08001EAA (T) ldsh r0,[r7,r4] // file slot index (0-2)
08001EAC (T) add r0,1h
08001EAE (T) bl 80057A8h // format number (1 -> E1)
08001EB2 (T) strb r0,[r5]
08001EB4 (T) mov r5,r9
08001EB6 (T) mov r1,2h
08001EB8 (T) ldsh r0,[r7,r1]
08001EBA (T) add r0,1h
08001EBC (T) bl 80057A8h // literally doing exactly what it just did...
08001EC0 (T) strb r0,[r6]
// Format colon
08001EC2 (T) mov r6,r10
08001EC4 (T) ldr r4,=80FC438h
08001EC6 (T) mov r0,r4
08001EC8 (T) bl 80057B4h // some weird jump table that ultimately returns a colon tile (EE)
08001ECC (T) strb r0,[r5]
08001ECE (T) ldr r5,[sp,0Ch]
08001ED0 (T) mov r0,r4
08001ED2 (T) bl 80057B4h
08001ED6 (T) strb r0,[r6]
// Format space after colon
08001ED8 (T) ldr r6,[sp,14h]
08001EDA (T) bl 80057B0h
08001EDE (T) strb r0,[r5]
08001EE0 (T) ldr r5,[sp,10h]
08001EE2 (T) bl 80057B0h
08001EE6 (T) strb r0,[r6]
// Format Ness' name (1st row)
08001EE8 (T) ldr r6,[sp,18h] // address of ness' name (dest)
08001EEA (T) mov r4,0h
08001EEC (T) mov r2,r8
08001EEE (T) add r0,r2,r4 // address of ness' name (source); struct+0xC
08001EF0 (T) ldrb r1,[r0]
08001EF2 (T) mov r0,r1
08001EF4 (T) cmp r0,0FFh
08001EF6 (T) bne 8001F1Ch
// If 0xFF: write a space
08001EF8 (T) bl 80057B0h
08001EFC (T) strb r0,[r5]
08001EFE (T) b 8001F1Eh
08001F00 (T) lsl r5,r0,8h
08001F02 (T) lsl r0,r0,0h
08001F04 (T) lsl r5,r4,8h
08001F06 (T) lsl r0,r0,0h
08001F08 (T) lsl r6,r0,8h
08001F0A (T) lsl r0,r0,0h
08001F0C (T) lsl r6,r4,8h
08001F0E (T) lsl r0,r0,0h
08001F10 (T) lsl r7,r0,8h
08001F12 (T) lsl r0,r0,0h
08001F14 (T) lsl r7,r4,8h
08001F16 (T) lsl r0,r0,0h
08001F18 (T) stmia [r4]!,r3-r5
08001F1A (T) lsr r7,r1,20h
// Else: format the letter
08001F1C (T) strb r1,[r5]
08001F1E (T) add r5,1h
08001F20 (T) add r4,1h
08001F22 (T) cmp r4,4h
08001F24 (T) ble 8001EECh
// Format Ness' name (2nd row) + put spaces after both rows
08001F26 (T) mov r4,0h
08001F28 (T) ldrb r0,[r7,0Ch]
08001F2A (T) cmp r0,0FFh
08001F2C (T) beq 8001F44h
08001F2E (T) mov r1,r8
08001F30 (T) ldrb r0,[r1]
08001F32 (T) strb r0,[r6]
08001F34 (T) add r6,1h
08001F36 (T) add r1,1h
08001F38 (T) add r4,1h
08001F3A (T) cmp r4,4h
08001F3C (T) bgt 8001F44h
08001F3E (T) ldrb r0,[r1]
08001F40 (T) cmp r0,0FFh
08001F42 (T) bne 8001F30h
08001F44 (T) bl 80057B0h
08001F48 (T) strb r0,[r5]
08001F4A (T) add r5,1h
08001F4C (T) bl 80057B0h
08001F50 (T) strb r0,[r6]
08001F52 (T) add r6,1h
// Format "Level:" string (weirdly, it puts it at different spots in the two rows... bug?)
08001F54 (T) ldr r4,=80FC460h
08001F56 (T) mov r0,r4
08001F58 (T) bl 80057B4h
08001F5C (T) strb r0,[r5]
08001F5E (T) add r5,1h
08001F60 (T) mov r0,r4
08001F62 (T) bl 80057B4h
08001F66 (T) strb r0,[r6]
08001F68 (T) add r6,1h
08001F6A (T) ldr r4,=80FC464h
08001F6C (T) mov r0,r4
08001F6E (T) bl 80057B4h
08001F72 (T) strb r0,[r5]
08001F74 (T) add r5,1h
08001F76 (T) mov r0,r4
08001F78 (T) bl 80057B4h
08001F7C (T) strb r0,[r6]
08001F7E (T) add r6,1h
08001F80 (T) ldr r4,=80FC468h
08001F82 (T) mov r0,r4
08001F84 (T) bl 80057B4h
08001F88 (T) strb r0,[r5]
08001F8A (T) add r5,1h
08001F8C (T) mov r0,r4
08001F8E (T) bl 80057B4h
08001F92 (T) strb r0,[r6]
08001F94 (T) add r6,1h
08001F96 (T) ldr r4,=80FC438h
08001F98 (T) mov r0,r4
08001F9A (T) bl 80057B4h
08001F9E (T) strb r0,[r5]
08001FA0 (T) add r5,1h
08001FA2 (T) mov r0,r4
08001FA4 (T) bl 80057B4h
08001FA8 (T) strb r0,[r6]
08001FAA (T) add r6,1h
// Format level
08001FAC (T) ldrb r3,[r7,0Ah] // level
08001FAE (T) mov r8,r3
08001FB0 (T) mov r0,r8
08001FB2 (T) mov r1,0Ah
08001FB4 (T) bl 80F4A70h
08001FB8 (T) mov r8,r0 // ones digit
08001FBA (T) ldrb r0,[r7,0Ah]
08001FBC (T) mov r1,0Ah
08001FBE (T) bl m2_div
08001FC2 (T) mov r4,r0 // tens digit
08001FC4 (T) cmp r4,0h
08001FC6 (T) beq 8001FE8h
// If level is greater than nine: print tens digit
08001FC8 (T) bl 80057A8h
08001FCC (T) strb r0,[r5]
08001FCE (T) add r5,1h
08001FD0 (T) mov r0,r4
08001FD2 (T) bl 80057A8h
08001FD6 (T) b 8001FF4h
08001FD8 (T) stmia [r4]!,r5,r6
08001FDA (T) lsr r7,r1,20h
08001FDC (T) stmia [r4]!,r2,r5,r6
08001FDE (T) lsr r7,r1,20h
08001FE0 (T) stmia [r4]!,r3,r5,r6
08001FE2 (T) lsr r7,r1,20h
08001FE4 (T) stmia [r4]!,r3-r5
08001FE6 (T) lsr r7,r1,20h
// Else: print space
08001FE8 (T) bl 80057B0h
08001FEC (T) strb r0,[r5]
08001FEE (T) add r5,1h
08001FF0 (T) bl 80057B0h
// Print tens digit (2nd row)
08001FF4 (T) strb r0,[r6]
// Print tens digit
08001FF6 (T) add r6,1h
08001FF8 (T) mov r0,r8
08001FFA (T) bl 80057A8h
08001FFE (T) strb r0,[r5]
08002000 (T) add r5,1h
08002002 (T) mov r0,r8
08002004 (T) bl 80057A8h
08002008 (T) strb r0,[r6]
// Print "Text speed:"
0800200A (T) bl 80057B0h
0800200E (T) strb r0,[r5]
08002010 (T) add r5,1h
08002012 (T) ldr r0,=80FC46Ch
08002014 (T) bl 80057B4h
08002018 (T) strb r0,[r5]
0800201A (T) add r5,1h
0800201C (T) ldr r0,=80FC470h
0800201E (T) bl 80057B4h
08002022 (T) strb r0,[r5]
08002024 (T) add r5,1h
08002026 (T) ldr r0,=80FC474h
08002028 (T) bl 80057B4h
0800202C (T) strb r0,[r5]
0800202E (T) add r5,1h
08002030 (T) ldr r0,=80FC478h
08002032 (T) bl 80057B4h
08002036 (T) strb r0,[r5]
08002038 (T) add r5,1h
0800203A (T) ldr r0,=80FC438h
0800203C (T) bl 80057B4h
08002040 (T) strb r0,[r5]
08002042 (T) add r5,1h
// Print speed
08002044 (T) mov r4,0h
08002046 (T) mov r1,4h
08002048 (T) ldsh r0,[r7,r1]
0800204A (T) lsl r0,r0,2h
0800204C (T) add r0,r13
0800204E (T) lsl r1,r4,1h
08002050 (T) ldr r0,[r0]
08002052 (T) add r0,r0,r1
08002054 (T) bl 80057B4h
08002058 (T) strb r0,[r5]
0800205A (T) add r5,1h
0800205C (T) add r4,1h
0800205E (T) cmp r4,2h
08002060 (T) ble 8002046h
08002062 (T) add sp,1Ch
08002064 (T) pop r3-r5
08002066 (T) mov r8,r3
08002068 (T) mov r9,r4
0800206A (T) mov r10,r5
0800206C (T) pop r4-r7
0800206E (T) pop r0
08002070 (T) bx r0

1060
notes/m2-subB8BBC.txt Normal file

File diff suppressed because it is too large Load Diff

View File

@ -64,7 +64,7 @@
// ----------------------------------------------------------------------------
// Substate 1 (character select)
080BAF5C (T) ldr r6,=3005230h ;9 495
080BAF5E (T) ldr r0,[r6,18h] ;4 499
080BAF5E (T) ldr r0,[r6,18h] ;4 499 slot window pointer
080BAF60 (T) bl 80C4EB0h ;10 509
080BAF64 (T) lsl r0,r0,10h ;2 511
080BAF66 (T) asr r5,r0,10h ;2 513

View File

@ -1,71 +1,61 @@
080C1FBC (T) push {r4-r7,r14} ;9 178
080C1FBC (T) push {r4-r7,r14} ;9 178 m2_psiwindow(unsigned short partyMember, byte Status_PSI, byte Type_Of_Window)
080C1FBE (T) mov r7,r10 ;2 180
080C1FC0 (T) mov r6,r9 ;2 182
080C1FC2 (T) mov r5,r8 ;2 184
080C1FC4 (T) push {r5-r7} ;7 191
080C1FC6 (T) add sp,-#0x18 ;2 193
080C1FC8 (T) lsl r0,r0,#0x10 ;2 195
080C1FCA (T) lsr r6,r0,#0x10 ;2 197
080C1FCA (T) lsr r6,r0,#0x10 ;2 197 r6 = partyMember
080C1FCC (T) lsl r1,r1,#0x18 ;2 199
080C1FCE (T) lsr r1,r1,#0x18 ;2 201
080C1FD0 (T) str r1,[sp,#0x4] ;5 206
080C1FD0 (T) str r1,[sp,#0x4] ;5 206 sp + 4 = Status_Or_PSI
080C1FD2 (T) lsl r2,r2,#0x18 ;2 208
080C1FD4 (T) lsr r2,r2,#0x18 ;2 210
080C1FD6 (T) str r2,[sp,#0x8] ;5 215
080C1FD8 (T) mov r7,#0x0 ;2 217
080C1FDA (T) ldr r3,=#0x3000A00 ;9 226
080C1FDC (T) mov r2,#0x0 ;2 228
080C1FDE (T) add r5,r3,4 ;2 230
080C1FE0 (T) mov r4,r3 ;2 232
080C1FE2 (T) add r4,#0x8 ;2 234
080C1FE4 (T) lsl r0,r7,#0x10 ;2 236
080C1FE6 (T) asr r0,r0,#0x10 ;2 238
080C1FE8 (T) add r1,r0,r3 ;2 240
080C1FEA (T) strb r2,[r1] ;5 245
080C1FEC (T) add r1,r0,r5 ;2 247
080C1FEE (T) strb r2,[r1] ;5 252
080C1FF0 (T) add r1,r0,r4 ;2 254
080C1FF2 (T) strb r2,[r1] ;5 259
080C1FF4 (T) add r0,#0x1 ;2 261
080C1FF6 (T) lsl r0,r0,#0x10 ;2 263
080C1FF8 (T) lsr r7,r0,#0x10 ;2 265
080C1FFA (T) asr r0,r0,#0x10 ;2 267
080C1FFC (T) cmp r0,#0x3 ;2 269
080C1FFE (T) ble #0x80C1FE4 ;8 277
080C1FD6 (T) str r2,[sp,#0x8] ;5 215 sp + 8 = Type_Of_Window
080C1FD8 (T) mov r7,#0x0 ;2 217 r7 = 0
080C1FDA (T) ldr r3,=#0x3000A00 ;9 226 r3 = 0x3000A00
080C1FDC (T) mov r2,#0x0 ;2 228 r2 = 0
080C1FDE (T) add r5,r3,4 ;2 230 r5 = 0x3000A04
080C1FE2 (T) add r4,#0x8 ;2 234 r4 = 0x3000A08
r7 = 4 - Set all bytes between 0x3000A00 and 0x3000A0B included = 0 (Setup)
080C2000 (T) mov r0,#0x0 ;2 279
080C2002 (T) str r0,[sp,#0xC] ;5 284
080C2002 (T) str r0,[sp,#0xC] ;5 284 sp + 0xC = 0
080C2004 (T) mov r1,#0x0 ;2 286
080C2006 (T) str r1,[sp,#0x10] ;5 291
080C2006 (T) str r1,[sp,#0x10] ;5 291 sp + 0x10 = 0
080C2008 (T) lsl r0,r6,#0x10 ;2 293
080C200A (T) asr r1,r0,#0x10 ;2 295
080C200C (T) str r0,[sp,#0x14] ;5 300
080C200E (T) cmp r1,#0x3 ;2 302
080C200C (T) str r0,[sp,#0x14] ;5 300 sp + 0x14 = partyMember << 0x10
080C200E (T) cmp r1,#0x3 ;2 302 Is this Poo? If not go to End_Of_Poo
080C2010 (T) bne #0x80C20DA ;8 310
Poo:
080C2012 (T) mov r2,#0x2 ;2 312
080C2014 (T) ldr r0,[sp,#0x4] ;4 316
080C2016 (T) and r0,r2 ;2 318
080C2018 (T) cmp r0,#0x0 ;2 320
080C201A (T) beq #0x80C20DA ;8 328
080C201A (T) beq #0x80C20DA ;8 328 Is this the Status PSI window? If not go to End_Of_Poo
Status_PSI:
080C201C (T) mov r0,#0x1 ;2 330
080C201E (T) ldr r4,[sp,#0x8] ;4 334
080C2020 (T) and r0,r4 ;2 336
080C2022 (T) cmp r0,#0x0 ;2 338
080C2024 (T) beq #0x80C20DA ;8 346
080C2024 (T) beq #0x80C20DA ;8 346 Is Type_Of_Window Offense? If not go to End_Of_Poo
Offense_Status_PSI:
080C2026 (T) ldr r0,=#0x3001D40 ;9 355
080C2028 (T) ldr r1,=#0x22A ;9 364
080C202A (T) add r6,r0,r1 ;2 366
080C202A (T) add r6,r0,r1 ;2 366 r6 = 0x3001F6A
080C202C (T) ldrb r1,[r6] ;7 373
080C202E (T) mov r0,r2 ;2 375
080C2030 (T) and r0,r1 ;2 377
080C2032 (T) cmp r0,#0x0 ;2 379
080C2034 (T) beq #0x80C2084 ;8 387
080C2036 (T) ldr r5,=#0x8B2AB00 ;9 396
080C2038 (T) ldr r4,=#0x3005230 ;9 405
080C203A (T) ldr r0,[r4,#0x1C] ;4 409
080C203C (T) ldrb r2,[r5] ;4 413
080C2034 (T) beq #0x80C2084 ;8 387 Does Poo have Starstorm?
Starstorm:
080C2036 (T) ldr r5,=#0x8B2AB00 ;9 396 r5 = 0x8B2AB00
080C2038 (T) ldr r4,=#0x3005230 ;9 405 r4 = 0x3005230 = Base window address
080C203A (T) ldr r0,[r4,#0x1C] ;4 409 r0 = Window = Base Window address[7]
080C203C (T) ldrb r2,[r5] ;4 413 r2 = r5[0]
080C203E (T) mov r1,#0xD ;2 415
080C2040 (T) mul r1,r2 ;3 418
080C2042 (T) ldr r2,=#0x8B73E62 ;9 427
080C2040 (T) mul r1,r2 ;3 418 r1 = r2 * 0xD
080C2042 (T) ldr r2,=#0x8B73E62 ;9 427 r2 = 0x8B73E62
080C2044 (T) add r1,r1,r2 ;2 429
080C2046 (T) ldrb r3,[r5,#0xA] ;4 433
080C2048 (T) ldr r2,[sp,#0x10] ;4 437
@ -137,6 +127,7 @@
080C20D4 (T) add r1,r1,r2 ;2 711
080C20D6 (T) mov r0,#0x16 ;2 713
080C20D8 (T) strb r0,[r1] ;5 718
End_Of_Poo:
080C20DA (T) mov r7,#0x1 ;2 720
080C20DC (T) ldr r2,=#0x8B2A9B0 ;9 729
080C20DE (T) ldrb r0,[r2,#0x10] ;4 733

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.6 KiB

View File

@ -9,6 +9,8 @@ void __attribute__((naked)) m2_hpwindow_up(int character) {}
bool __attribute__((naked)) m2_isequipped(int item_index) {}
void __attribute__((naked)) m2_soundeffect(int index) {}
int __attribute__((naked)) m2_div(int dividend, int divisor) {}
int __attribute__((naked)) m2_remainder(int dividend, int divisor) {}
int __attribute__((naked)) m2_sub_a334c(int value) {}
int __attribute__((naked)) m2_sub_a3384(int value) {}
int __attribute__((naked)) m2_clearwindowtiles(WINDOW* window) {}
void __attribute__((naked)) m2_printstr(WINDOW* window, byte* str, unsigned short x, unsigned short y, bool highlight) {}

1186
src/c/fileselect.c Normal file

File diff suppressed because it is too large Load Diff

73
src/c/fileselect.h Normal file
View File

@ -0,0 +1,73 @@
#ifndef HEADER_FILE_SELECT_INCLUDED
#define HEADER_FILE_SELECT_INCLUDED
#include "types.h"
#include "vwf.h"
typedef struct FILE_SELECT {
short status; // 0 = used, -1 = empty
short slot; // 0-2
short text_speed; // 0-2
short unknown_a;
short unknown_b; // used when going to file setup
short ness_level;
byte ness_name[8];
byte unknown_c[64];
byte paula_name[8];
byte unknown_d[64];
byte jeff_name[8];
byte unknown_e[64];
byte poo_name[8];
byte unknown_f[68];
byte king_name[4];
byte unknown_g[64];
byte food_name[8];
byte unknown_h[64];
byte thing_name[8];
byte unknown_i[64];
byte formatted_str[64];
} FILE_SELECT;
int get_tile_number_file_select(int x, int y);
void clear_tile_file(int x, int y, int pixels);
void clear_rect_file(int x, int y, int width, int height, int pixels, unsigned short *tilesetDestPtr);
unsigned short* getTilesetDest(int window_selector, int *width);
unsigned short getPaletteFromFileWindow(int x, int y, int window_selector);
void setPaletteToFileWindow(int x, int y, int window_selector, unsigned short palette);
void setPaletteToZero(int x, int y, int window_selector);
void setPaletteOnAllFile(int x, int y, byte *str, int length, int window_selector);
void wrapper_file_string_selection(int x, int y, int length, byte *str, int window_selector);
void setPaletteOnFile(int x, int y, int window_selector, FILE_SELECT *file);
void print_file_string(int x, int y, int length, byte *str, int window_selector, int windowX, int windowY);
void wrapper_first_file_string(int x, int y, int length, byte *str, int window_selector);
void wrapper_delete_string(int x, int y, int length, byte *str, int window_selector);
void wrapper_name_string(int x, int y, int length, byte *str, int window_selector);
void wrapper_name_summary_string(int x, int y, int length, byte *str, int window_selector);
void wrapper_copy_string(int x, int y, int length, byte *str, int window_selector);
void clearArr(int x, int y, int width, unsigned short *tilesetDestPtr, int windowX);
void print_file_string(int x, int y, int length, byte *str, int window_selector, int windowX, int windowY);
unsigned short setupCursorAction(int *Pos1, int *Pos2);
void setupCursorMovement();
void setupCursorPosition(int *x, int *y);
void format_options_cc(char String[], int *index, byte cmd);
void options_setup(char String[], int selector);
void text_speed_setup(char String[], int selector);
void delete_setup(char String[], int selector);
void text_flavour_setup(char String[], int selector);
void description_setup(char String[], int selector);
void copy_setup(char String[]);
void letterSetup(char String[], int selector, bool capital, int *index);
void numbersSetup(char String[], int *index);
void alphabet_setup(char String[], int selector, bool capital);
void summary_setup(char String[], int selector);
void print_windows(int windowX, int windowY, int window_selector);
void format_file_cc(FILE_SELECT *file, int *index, byte cmd);
void format_file_string(FILE_SELECT *file);
extern unsigned short m2_coord_table_file[];
extern byte m2_cstm_last_printed[];
extern void cpufastset(void *source, void *dest, int mode);
#endif

View File

@ -6,12 +6,12 @@
// Process the outer Goods window (i.e. character selection)
// Called every frame. Replaces $80BF858 fully.
// Returns 1 if the user steps into the inner window,
// Returns 1 if the user steps into the inner window, or the chosen party member's number if it's the give window,
// -1 if the user steps back out to the previous window,
// and 0 for no action.
// y_offset is added to account for the Tracy goods window, which
// the game offsets by one tile downwards
int goods_outer_process(WINDOW* window, int y_offset)
int goods_outer_process(WINDOW* window, int y_offset, bool give)
{
// Get the weird signed parity value
short unknown = window->unknown6;
@ -129,7 +129,7 @@ int goods_outer_process(WINDOW* window, int y_offset)
{
if (current_pc != original_pc)
{
if (*window_flags & 0x800)
if ((!give) && (*window_flags & 0x800))
m2_soundeffect(0x131);
else
m2_soundeffect(0x12E);
@ -156,16 +156,18 @@ int goods_outer_process(WINDOW* window, int y_offset)
{
m2_soundeffect(0x12D);
window->counter = 0;
if(!give)
{
unsigned short first_item = current_items[0];
if (first_item > 0)
{
// If the first item isn't null, erase the arrow border tiles
clear_window_arrows(window);
}
return signed_parity + 1;
}
return current_pc + 1;
}
window->counter++;
@ -184,6 +186,33 @@ int goods_outer_process(WINDOW* window, int y_offset)
return ACTION_NONE;
}
//Returns in *String a string containing either "PSI \n Check" or "Check" based on the value of PSIValid
void setupShortMainMenu(char *String, byte PSIValid)
{
String[0] = 1;
String[1] = 0xFF;
char PSI[] = "PSI";
char Check[] = "Check";
int index = 2;
if(PSIValid != 0xFF)
{
String[index++] = 0x5F;
String[index++] = 0xFF;
String[index++] = 0x08;
for(int i = 0; i < (sizeof(PSI) - 1); i++)
String[index++] = encode_ascii(PSI[i]);
}
String[index++] = 1;
String[index++] = 0xFF;
String[index++] = 0x5F;
String[index++] = 0xFF;
String[index++] = 0x08;
for(int i = 0; i < (sizeof(Check) - 1); i++)
String[index++] = encode_ascii(Check[i]);
String[index++] = 0;
String[index++] = 0xFF;
}
// Process the inner Goods window (i.e. item selection)
// Called every frame. Replaces $80BEB6C fully.
// Returns
@ -476,3 +505,566 @@ void goods_print_items(WINDOW *window, unsigned short *items, int y_offset)
}
}
}
//This works. Gets price given the item (Could not get a proper thumb routine to work, it would automatically go to arm)
//What this routine does is: it receives the item value, multiplies it by 20 and then sums it with the address of m2_items to get the item price that is at that address.
//Original code is at 0x80C7D58
unsigned short getPrice(int item)
{
unsigned short *value = (unsigned short *)(&m2_items + (item * 5));
return value[0];
}
// Prints all itemsnum items to a shop window.
// Erases the slot before printing. Prints blanks for null items.
void shop_print_items(WINDOW *window, unsigned char *items, int y_offset, int itemsnum)
{
int item_x = (window->window_x << 3) + 8;
int item_y = (window->window_y + y_offset) << 3;
for (int i = 0; i < itemsnum; i++)
{
int item = items[i];
int x = item_x;
int y = item_y + (i * 16);
print_blankstr(x >> 3, y >> 3, 16);
if (item > 0)
{
int x_offset = 0;
byte *item_str = m2_strlookup(m2_items_offsets, m2_items_strings, item);
print_string(item_str, x + x_offset, y);
int digit_count;
int bcd = bin_to_bcd(getPrice(item), &digit_count); //Get the price in bcd, so it can be printed
int base = 120;
print_character(decode_character(0x56), x + base, y); //00, it will be at the end, always at the same position
print_character(decode_character(0x54), x + base - 6 - (digit_count * 6), y); //dollar, it must be before all digits
// Write the digits
for (int j = 0; j < digit_count; j++)
{
byte digit = ((bcd >> ((digit_count - 1 - j) * 4)) & 0xF) + ZERO;
print_character(decode_character(digit), x + base - 6 - ((digit_count - j - 1) * 6), y); //write a single digit
}
}
}
}
//Load proper give text into str and then go to it
//It's based on the party's status, whether the target's inventory is full or not and whether the source is the target
void give_print(byte item, byte target, byte source, WINDOW *window, byte *str)
{
bool notFullInventory = false;
int index;
struct PC *user_data = (&m2_ness_data[source]);
struct PC *target_data = (&m2_ness_data[target]);
bool incapable_user = false;
bool incapable_target = false;
for(index = 0; index < 0xE; index++)
if(target_data->goods[index] == 0)
{
notFullInventory = true;
break;
}
if((user_data->ailment == UNCONSCIOUS) ||(user_data->ailment == DIAMONDIZED))
incapable_user = true;
if((target_data->ailment == UNCONSCIOUS) ||(target_data->ailment == DIAMONDIZED))
incapable_target = true;
index = 0;
if(source == target)
{
if(incapable_user)
setupSelf_Dead(str, &index, source, item);
else
setupSelf_Alive(str, &index, source, item);
}
else if(!notFullInventory)
{
if(!incapable_target && !incapable_user)
setupFull_Both_Alive(str, &index, source, target, item);
else if(incapable_target && incapable_user)
setupFull_Both_Dead(str, &index, source, target, item);
else if(incapable_target && !incapable_user)
setupFull_Target_Dead(str, &index, source, target, item);
else
setupFull_User_Dead(str, &index, source, target, item);
}
else
{
if(!incapable_target && !incapable_user)
setup_Both_Alive(str, &index, source, target, item);
else if(incapable_target && !incapable_user)
setup_Target_Dead(str, &index, source, target, item);
else if(!incapable_target && incapable_user)
setup_User_Dead(str, &index, source, target, item);
else
setup_Both_Dead(str, &index, source, target, item);
}
str[index++] = 0x1D;
str[index++] = 0xFF; //END
str[index++] = 0;
str[index++] = 0xFF; //END
window->text_start = str;
window->text_start2 = str;
}
void setupSelf_Alive(byte *String, int *index, byte user, byte item)
{
char rearranged[] = " rearranged ";
char own[] = " own";
char items[] = " items and the ";
char moved[] = " moved.";
String[(*index)++] = 0x70; //Initial bullet
getCharName(user, String, index);
for (int i = 0; i < (sizeof(rearranged) - 1); i++)
String[(*index)++] = encode_ascii(rearranged[i]);
getPossessive(user, String, index);
for (int i = 0; i < (sizeof(own) - 1); i++)
String[(*index)++] = encode_ascii(own[i]);
String[(*index)++] = 1;
String[(*index)++] = 0xFF; //newline
for (int i = 0; i < (sizeof(items) - 1); i++)
String[(*index)++] = encode_ascii(items[i]);
String[(*index)++] = 1;
String[(*index)++] = 0xFF; //newline
String[(*index)++] = encode_ascii(' '); //Format
String[(*index)++] = encode_ascii(' ');
byte *item_str = m2_strlookup(m2_items_offsets, m2_items_strings, item);
copy_name(String, item_str, index, 0);
for (int i = 0; i < (sizeof(moved) - 1); i++)
String[(*index)++] = encode_ascii(moved[i]);
}
void setupSelf_Dead(byte *String, int *index, byte user, byte item)
{
struct PC *tmp; //Get alive character
byte alive = 0;
while((alive == user))
alive++;
for(int i = alive; i < 4; i++)
{
tmp = &(m2_ness_data[i]);
if((tmp->ailment != UNCONSCIOUS) && (tmp->ailment != DIAMONDIZED))
{
alive = i;
break;
}
}
char rearranged[] = " rearranged";
char items[] = "'s items and the";
char moved[] = " moved.";
String[(*index)++] = 0x70; //Initial bullet
getCharName(alive, String, index);
for (int i = 0; i < (sizeof(rearranged) - 1); i++)
String[(*index)++] = encode_ascii(rearranged[i]);
String[(*index)++] = 1;
String[(*index)++] = 0xFF; //newline
String[(*index)++] = encode_ascii(' ');
String[(*index)++] = encode_ascii(' '); //Format
getCharName(user, String, index);
for (int i = 0; i < (sizeof(items) - 1); i++)
String[(*index)++] = encode_ascii(items[i]);
String[(*index)++] = 1;
String[(*index)++] = 0xFF; //newline
String[(*index)++] = encode_ascii(' ');
String[(*index)++] = encode_ascii(' '); //Format
byte *item_str = m2_strlookup(m2_items_offsets, m2_items_strings, item);
copy_name(String, item_str, index, 0);
for (int i = 0; i < (sizeof(moved) - 1); i++)
String[(*index)++] = encode_ascii(moved[i]);
}
void setupFull_Both_Alive(byte *String, int *index, byte user, byte target, byte item)
{
char tried[] = " tried to give";
char the[] = " the ";
char to[] = " to ";
char but[] = "but ";
char was[] = " was already";
char carrying[] = " carrying too much stuff.";
String[(*index)++] = 0x70; //Initial bullet
getCharName(user, String, index);
for (int i = 0; i < (sizeof(tried) - 1); i++)
String[(*index)++] = encode_ascii(tried[i]);
String[(*index)++] = 1;
String[(*index)++] = 0xFF; //newline
for (int i = 0; i < (sizeof(the) - 1); i++)
String[(*index)++] = encode_ascii(the[i]);
byte *item_str = m2_strlookup(m2_items_offsets, m2_items_strings, item);
copy_name(String, item_str, index, 0);
String[(*index)++] = 1;
String[(*index)++] = 0xFF; //newline
for (int i = 0; i < (sizeof(to) - 1); i++)
String[(*index)++] = encode_ascii(to[i]);
getCharName(target, String, index);
String[(*index)++] = encode_ascii(',');
String[(*index)++] = 0x2;
String[(*index)++] = 0xFF; //prompt + newline
String[(*index)++] = 0x70; //Initial bullet
for (int i = 0; i < (sizeof(but) - 1); i++)
String[(*index)++] = encode_ascii(but[i]);
getPronoun(target, String, index);
for (int i = 0; i < (sizeof(was) - 1); i++)
String[(*index)++] = encode_ascii(was[i]);
String[(*index)++] = 1;
String[(*index)++] = 0xFF; //newline
for (int i = 0; i < (sizeof(carrying) - 1); i++)
String[(*index)++] = encode_ascii(carrying[i]);
}
void setupFull_Target_Dead(byte *String, int *index, byte user, byte target, byte item)
{
char tried[] = " tried to add";
char the[] = " the ";
char to[] = " to ";
char s_stuff[]= "'s stuff,";
char but[] = "but there was no room for it.";
String[(*index)++] = 0x70; //Initial bullet
getCharName(user, String, index);
for (int i = 0; i < (sizeof(tried) - 1); i++)
String[(*index)++] = encode_ascii(tried[i]);
String[(*index)++] = 1;
String[(*index)++] = 0xFF; //newline
for (int i = 0; i < (sizeof(the) - 1); i++)
String[(*index)++] = encode_ascii(the[i]);
byte *item_str = m2_strlookup(m2_items_offsets, m2_items_strings, item);
copy_name(String, item_str, index, 0);
String[(*index)++] = 1;
String[(*index)++] = 0xFF; //newline
for (int i = 0; i < (sizeof(to) - 1); i++)
String[(*index)++] = encode_ascii(to[i]);
getCharName(target, String, index);
for (int i = 0; i < (sizeof(s_stuff) - 1); i++)
String[(*index)++] = encode_ascii(s_stuff[i]);
String[(*index)++] = 0x2;
String[(*index)++] = 0xFF; //prompt + newline
String[(*index)++] = 0x70; //Initial bullet
for (int i = 0; i < (sizeof(but) - 1); i++)
String[(*index)++] = encode_ascii(but[i]);
}
void setupFull_User_Dead(byte *String, int *index, byte user, byte target, byte item)
{
char tried[] = " tried to take";
char the[] = " the ";
char from[] = " from ";
char s_stuff[]= "'s stuff,";
char but[] = "but ";
char was[] = " was already";
char carrying[] = " carrying too much stuff.";
String[(*index)++] = 0x70; //Initial bullet
getCharName(target, String, index);
for (int i = 0; i < (sizeof(tried) - 1); i++)
String[(*index)++] = encode_ascii(tried[i]);
String[(*index)++] = 1;
String[(*index)++] = 0xFF; //newline
for (int i = 0; i < (sizeof(the) - 1); i++)
String[(*index)++] = encode_ascii(the[i]);
byte *item_str = m2_strlookup(m2_items_offsets, m2_items_strings, item);
copy_name(String, item_str, index, 0);
String[(*index)++] = 1;
String[(*index)++] = 0xFF; //newline
for (int i = 0; i < (sizeof(from) - 1); i++)
String[(*index)++] = encode_ascii(from[i]);
getCharName(user, String, index);
for (int i = 0; i < (sizeof(s_stuff) - 1); i++)
String[(*index)++] = encode_ascii(s_stuff[i]);
String[(*index)++] = 0x2;
String[(*index)++] = 0xFF; //prompt + newline
String[(*index)++] = 0x70; //Initial bullet
for (int i = 0; i < (sizeof(but) - 1); i++)
String[(*index)++] = encode_ascii(but[i]);
getPronoun(target, String, index);
for (int i = 0; i < (sizeof(was) - 1); i++)
String[(*index)++] = encode_ascii(was[i]);
String[(*index)++] = 1;
String[(*index)++] = 0xFF; //newline
for (int i = 0; i < (sizeof(carrying) - 1); i++)
String[(*index)++] = encode_ascii(carrying[i]);
}
void setupFull_Both_Dead(byte *String, int *index, byte user, byte target, byte item)
{
struct PC *tmp; //Get alive character
byte alive = 0;
while((alive == user) || (alive == target))
alive++;
for(int i = alive; i < 4; i++)
{
tmp = &(m2_ness_data[i]);
if((tmp->ailment != UNCONSCIOUS) && (tmp->ailment != DIAMONDIZED))
{
alive = i;
break;
}
}
char tried[] = " tried to add";
char s_[] = "'s ";
char to[] = " to ";
char s_stuff[]= "'s stuff,";
char but[] = "but there was no room for it.";
String[(*index)++] = 0x70; //Initial bullet
getCharName(alive, String, index);
for (int i = 0; i < (sizeof(tried) - 1); i++)
String[(*index)++] = encode_ascii(tried[i]);
String[(*index)++] = 1;
String[(*index)++] = 0xFF; //newline
String[(*index)++] = encode_ascii(' ');
String[(*index)++] = encode_ascii(' '); //Format
getCharName(user, String, index);
for (int i = 0; i < (sizeof(s_) - 1); i++)
String[(*index)++] = encode_ascii(s_[i]);
byte *item_str = m2_strlookup(m2_items_offsets, m2_items_strings, item);
copy_name(String, item_str, index, 0);
String[(*index)++] = 1;
String[(*index)++] = 0xFF; //newline
for (int i = 0; i < (sizeof(to) - 1); i++)
String[(*index)++] = encode_ascii(to[i]);
getCharName(target, String, index);
for (int i = 0; i < (sizeof(s_stuff) - 1); i++)
String[(*index)++] = encode_ascii(s_stuff[i]);
String[(*index)++] = 0x2;
String[(*index)++] = 0xFF; //prompt + newline
String[(*index)++] = 0x70; //Initial bullet
for (int i = 0; i < (sizeof(but) - 1); i++)
String[(*index)++] = encode_ascii(but[i]);
}
void setup_Both_Alive(byte *String, int *index, byte user, byte target, byte item)
{
char gave[] = " gave";
char the[] = " the ";
char to[] = " to ";
String[(*index)++] = 0x70; //Initial bullet
getCharName(user, String, index);
for (int i = 0; i < (sizeof(gave) - 1); i++)
String[(*index)++] = encode_ascii(gave[i]);
String[(*index)++] = 1;
String[(*index)++] = 0xFF; //newline
for (int i = 0; i < (sizeof(the) - 1); i++)
String[(*index)++] = encode_ascii(the[i]);
byte *item_str = m2_strlookup(m2_items_offsets, m2_items_strings, item);
copy_name(String, item_str, index, 0);
String[(*index)++] = 1;
String[(*index)++] = 0xFF; //newline
for (int i = 0; i < (sizeof(to) - 1); i++)
String[(*index)++] = encode_ascii(to[i]);
getCharName(target, String, index);
String[(*index)++] = encode_ascii('.');
}
void setup_Target_Dead(byte *String, int *index, byte user, byte target, byte item)
{
char added[] = " added";
char the[] = " the ";
char to[] = " to ";
char s_stuff[] = "'s stuff.";
String[(*index)++] = 0x70; //Initial bullet
getCharName(user, String, index);
for (int i = 0; i < (sizeof(added) - 1); i++)
String[(*index)++] = encode_ascii(added[i]);
String[(*index)++] = 1;
String[(*index)++] = 0xFF; //newline
for (int i = 0; i < (sizeof(the) - 1); i++)
String[(*index)++] = encode_ascii(the[i]);
byte *item_str = m2_strlookup(m2_items_offsets, m2_items_strings, item);
copy_name(String, item_str, index, 0);
String[(*index)++] = 1;
String[(*index)++] = 0xFF; //newline
for (int i = 0; i < (sizeof(to) - 1); i++)
String[(*index)++] = encode_ascii(to[i]);
getCharName(target, String, index);
for (int i = 0; i < (sizeof(s_stuff) - 1); i++)
String[(*index)++] = encode_ascii(s_stuff[i]);
}
void setup_User_Dead(byte *String, int *index, byte user, byte target, byte item)
{
char took[] = " took";
char the[] = " the ";
char from[] = " from ";
char s_stuff[] = "'s stuff.";
String[(*index)++] = 0x70; //Initial bullet
getCharName(target, String, index);
for (int i = 0; i < (sizeof(took) - 1); i++)
String[(*index)++] = encode_ascii(took[i]);
String[(*index)++] = 1;
String[(*index)++] = 0xFF; //newline
for (int i = 0; i < (sizeof(the) - 1); i++)
String[(*index)++] = encode_ascii(the[i]);
byte *item_str = m2_strlookup(m2_items_offsets, m2_items_strings, item);
copy_name(String, item_str, index, 0);
String[(*index)++] = 1;
String[(*index)++] = 0xFF; //newline
for (int i = 0; i < (sizeof(from) - 1); i++)
String[(*index)++] = encode_ascii(from[i]);
getCharName(user, String, index);
for (int i = 0; i < (sizeof(s_stuff) - 1); i++)
String[(*index)++] = encode_ascii(s_stuff[i]);
}
void setup_Both_Dead(byte *String, int *index, byte user, byte target, byte item)
{
struct PC *tmp; //Get alive character
byte alive = 0;
while((alive == user) || (alive == target))
alive++;
for(int i = alive; i < 4; i++)
{
tmp = &(m2_ness_data[i]);
if((tmp->ailment != UNCONSCIOUS) && (tmp->ailment != DIAMONDIZED))
{
alive = i;
break;
}
}
char added[] = " added ";
char _s[] = "'s";
char to[] = " to";
char s_stuff[] = "'s stuff.";
String[(*index)++] = 0x70; //Initial bullet
getCharName(alive, String, index);
for (int i = 0; i < (sizeof(added) - 1); i++)
String[(*index)++] = encode_ascii(added[i]);
getCharName(user, String, index);
for (int i = 0; i < (sizeof(_s) - 1); i++)
String[(*index)++] = encode_ascii(_s[i]);
String[(*index)++] = 1;
String[(*index)++] = 0xFF; //newline
String[(*index)++] = encode_ascii(' '); //Format
String[(*index)++] = encode_ascii(' ');
byte *item_str = m2_strlookup(m2_items_offsets, m2_items_strings, item);
copy_name(String, item_str, index, 0);
for (int i = 0; i < (sizeof(to) - 1); i++)
String[(*index)++] = encode_ascii(to[i]);
String[(*index)++] = 1;
String[(*index)++] = 0xFF; //newline
String[(*index)++] = encode_ascii(' '); //Format
String[(*index)++] = encode_ascii(' ');
getCharName(target, String, index);
for (int i = 0; i < (sizeof(s_stuff) - 1); i++)
String[(*index)++] = encode_ascii(s_stuff[i]);
}

View File

@ -2,6 +2,7 @@
#define HEADER_GOODS_INCLUDED
#include "window.h"
#include "pc.h"
#include "input.h"
typedef enum DIRECTION_MOVED
@ -18,9 +19,21 @@ typedef enum GOODS_ACTION
ACTION_STEPOUT = -1
} GOODS_ACTION;
int goods_outer_process(WINDOW* window, int y_offset);
int goods_outer_process(WINDOW* window, int y_offset, bool give);
int goods_inner_process(WINDOW *window, unsigned short *items);
void goods_print_items(WINDOW *window, unsigned short *items, int y_offset);
void shop_print_items(WINDOW *window, unsigned char *items, int y_offset, int itemsnum);
void setupSelf_Alive(byte *String, int *index, byte user, byte item);
void setupSelf_Dead(byte *String, int *index, byte user, byte item);
void setupFull_Both_Alive(byte *String, int *index, byte user, byte target, byte item);
void setupFull_Target_Dead(byte *String, int *index, byte user, byte target, byte item);
void setupFull_User_Dead(byte *String, int *index, byte user, byte target, byte item);
void setupFull_Both_Dead(byte *String, int *index, byte user, byte target, byte item);
void setup_Both_Alive(byte *String, int *index, byte user, byte target, byte item);
void setup_Target_Dead(byte *String, int *index, byte user, byte target, byte item);
void setup_User_Dead(byte *String, int *index, byte user, byte target, byte item);
void setup_Both_Dead(byte *String, int *index, byte user, byte target, byte item);
void give_print(byte item, byte target, byte source, WINDOW *window, byte *str);
extern bool m2_isequipped(int item_index);
extern void m2_soundeffect(int index);
@ -28,5 +41,9 @@ extern int m2_div(int dividend, int divisor);
extern int m2_sub_a334c(int value);
extern int m2_sub_a3384(int value);
extern void m2_clearwindowtiles(WINDOW* window);
extern int bin_to_bcd(int value, int* digit_count);
extern int m2_items;
extern PC m2_ness_data[];
#endif

View File

@ -12,6 +12,7 @@ int *first_window_flag = (int*) 0x30051F0;
unsigned short *palette_mask = (unsigned short*) 0x3005228;
short *active_window_party_member = (short*) 0x3005264;
unsigned short **tilemap_pointer = (unsigned short**)0x3005270;
int *fileselect_pixels_location = (int*) 0x2015000;
int *vram = (int*) 0x6000000;
int *m2_misc_offsets = (int*) 0x8B17EE4;
byte *m2_misc_strings = (byte*) 0x8B17424;

View File

@ -17,6 +17,7 @@ extern int *first_window_flag;
extern unsigned short *palette_mask;
extern short *active_window_party_member;
extern unsigned short **tilemap_pointer;
extern int *fileselect_pixels_location;
extern int *vram;
extern int *m2_misc_offsets;
extern byte *m2_misc_strings;

View File

@ -3,6 +3,21 @@
#include "types.h"
typedef enum AILMENT
{
CONSCIOUS = 0,
UNCONSCIOUS = 1,
DIAMONDIZED = 2,
PARALYZED = 3,
NAUSEOUS = 4,
POISONED = 5,
SUNSTROKE = 6,
SNIFFLING = 7,
MASHROOMIZED = 8,
POSSESSED = 9,
HOMESICK = 0xA,
} AILMENT;
typedef struct PC {
unsigned short goods[14];
int experience;
@ -16,7 +31,7 @@ typedef struct PC {
unsigned short pp_current;
byte pp_unknown[2];
unsigned short pp_rolling;
byte ailment;
AILMENT ailment;
bool mashroomized;
bool sleep;
bool strange;

View File

@ -12,6 +12,11 @@ byte decode_character(byte chr)
return c;
}
byte encode_ascii(char chr)
{
return (byte)(chr + 48);
}
int get_tile_number(int x, int y)
{
x--;
@ -46,6 +51,90 @@ byte reduce_bit_depth(int row, int foreground)
return lower | (upper << 4);
}
byte getSex(byte character)
{
return character == 1 ? 1 : 0; //character 1 is Paula
}
void getPossessive(byte character, byte *str, int *index)
{
char his[] = "his";
char her[] = "her";
if(getSex(character) == 1)
for (int i = 0; i < (sizeof(her) - 1); i++)
str[(*index)++] = encode_ascii(her[i]);
else
for (int i = 0; i < (sizeof(his) - 1); i++)
str[(*index)++] = encode_ascii(his[i]);
}
void getPronoun(byte character, byte *str, int *index)
{
char he[] = "he";
char she[] = "she";
if(getSex(character) == 1)
for (int i = 0; i < (sizeof(she) - 1); i++)
str[(*index)++] = encode_ascii(she[i]);
else
for (int i = 0; i < (sizeof(he) - 1); i++)
str[(*index)++] = encode_ascii(he[i]);
}
void getCharName(byte character, byte *str, int *index)
{
copy_name(str, m2_ness_name, index, character * 7);
}
void copy_name(byte *str, byte *source, int *index, int pos)
{
while(source[pos + 1] != 0xFF)
str[(*index)++] = source[pos++];
}
int ascii_strlen(char *str)
{
int len = 0;
while (str[len] != 0)
len++;
return len;
}
int wrapper_count_pixels_to_tiles(byte *str, int length)
{
return count_pixels_to_tiles(str, length, 0);
}
int count_pixels_to_tiles(byte *str, int length, int startingPos)
{
int pixels = startingPos;
for(int i = 0; i < length; i++)
{
if((str[i] != 0xFF) && (str[i] != 0xFE)) //The latter one is not really needed
pixels += (m2_widths_table[0][decode_character(str[i])] & 0xFF);
else if(str[i] == 0xFE)
{
// Define 0xFE as a control code
byte cmd = str[++i];
switch (cmd)
{
case CUSTOMCC_ADD_X:
pixels += str[++i];
break;
case CUSTOMCC_SET_X:
pixels = str[++i];
break;
}
}
else
break;
}
int tiles = (pixels - startingPos)>> 3;
if((pixels & 7) != 0)
tiles +=1;
return tiles;
}
byte print_character(byte chr, int x, int y)
{
return print_character_formatted(chr, x, y, 0, 0xF);
@ -67,12 +156,12 @@ byte print_character_formatted(byte chr, int x, int y, int font, int foreground)
return 8;
}
return print_character_with_callback(chr, x, y, font, foreground, vram, &get_tile_number_with_offset, TRUE);
return print_character_with_callback(chr, x, y, font, foreground, vram, &get_tile_number_with_offset, *tilemap_pointer, 32);
}
byte print_character_to_ram(byte chr, int *dest, int xOffset, int font, int foreground)
{
return print_character_with_callback(chr, xOffset, 0, font, foreground, dest, &get_tile_number_grid, FALSE);
return print_character_with_callback(chr, xOffset, 0, font, foreground, dest, &get_tile_number_grid, NULL, 32);
}
// Prints a special tile. Pixels are copied to the VWF buffer.
@ -110,7 +199,7 @@ void map_tile(unsigned short tile, int x, int y)
}
byte print_character_with_callback(byte chr, int x, int y, int font, int foreground,
int *dest, int (*getTileCallback)(int, int), int useTilemap)
int *dest, int (*getTileCallback)(int, int), unsigned short *tilemapPtr, int tilemapWidth)
{
int tileWidth = m2_font_widths[font];
int tileHeight = m2_font_heights[font];
@ -125,6 +214,8 @@ byte print_character_with_callback(byte chr, int x, int y, int font, int foregro
int tileX = x >> 3;
int tileY = y >> 3;
int offsetY = y & 7;
for (int dTileY = 0; dTileY < tileHeight; dTileY++) // dest tile Y
{
int dTileX = 0;
@ -134,45 +225,71 @@ byte print_character_with_callback(byte chr, int x, int y, int font, int foregro
{
// Glue the leftmost part of the glyph onto the rightmost part of the canvas
int tileIndex = getTileCallback(tileX + dTileX, tileY + dTileY); //get_tile_number(tileX + dTileX, tileY + dTileY) + tileOffset;
bool availableSwap = (dTileY != (tileHeight - 1));
int realTileIndex = tileIndex;
bool useful = false; //Maybe we go over the maximum tile height, let's make sure the extra tile is properly set IF it's useful
for (int row = 0; row < 8; row++)
{
int canvasRow = dest[(tileIndex * 8) + row];
int canvasRow = dest[(realTileIndex * 8) + ((row + offsetY) & 7)];
byte glyphRow = glyphRows[row + (dTileY * 8 * tileWidth) + (dTileX * 8)] & ((1 << leftPortionWidth) - 1);
glyphRow <<= (8 - leftPortionWidth);
int expandedGlyphRow = expand_bit_depth(glyphRow, foreground);
int expandedGlyphRowMask = ~expand_bit_depth(glyphRow, 0xF);
int tmpCanvasRow = canvasRow;
canvasRow &= expandedGlyphRowMask;
canvasRow |= expandedGlyphRow;
dest[(tileIndex * 8) + row] = canvasRow;
if(!availableSwap && ((row + offsetY) >> 3) == 1 && canvasRow != tmpCanvasRow) //This changed the canvas, then it's useful... IF it's the extra vertical tile
useful = true;
dest[(realTileIndex * 8) + ((row + offsetY) & 7)] = canvasRow;
if(offsetY != 0 && ((row + offsetY) == 7))
realTileIndex = getTileCallback(tileX + dTileX, tileY + dTileY + 1);
}
if (useTilemap)
(*tilemap_pointer)[tileX + dTileX + ((tileY + dTileY) * 32)] = paletteMask | tileIndex;
if (tilemapPtr != NULL)
{
tilemapPtr[tileX + dTileX + ((tileY + dTileY) * tilemapWidth)] = paletteMask | tileIndex;
if(useful)
tilemapPtr[tileX + dTileX + ((tileY + dTileY + 1) * tilemapWidth)] = paletteMask | realTileIndex;
}
if (renderedWidth - leftPortionWidth > 0 && leftPortionWidth < 8)
{
// Glue the rightmost part of the glyph onto the leftmost part of the next tile
// on the canvas
tileIndex = getTileCallback(tileX + dTileX + 1, tileY + dTileY); //get_tile_number(tileX + dTileX + 1, tileY + dTileY) + tileOffset;
availableSwap = (dTileY != (tileHeight - 1));
realTileIndex = tileIndex;
useful = false; //Maybe we go over the maximum tile height, let's make sure the extra tile is properly set IF it's useful
for (int row = 0; row < 8; row++)
{
int canvasRow = dest[(tileIndex * 8) + row];
int canvasRow = dest[(realTileIndex * 8) + ((row + offsetY) & 7)];
byte glyphRow = glyphRows[row + (dTileY * 8 * tileWidth) + (dTileX * 8)] >> leftPortionWidth;
int expandedGlyphRow = expand_bit_depth(glyphRow, foreground);
int expandedGlyphRowMask = ~expand_bit_depth(glyphRow, 0xF);
int tmpCanvasRow = canvasRow;
canvasRow &= expandedGlyphRowMask;
canvasRow |= expandedGlyphRow;
dest[(tileIndex * 8) + row] = canvasRow;
if(!availableSwap && ((row + offsetY) >> 3) == 1 && canvasRow != tmpCanvasRow) //This changed the canvas, then it's useful... IF it's the extra vertical tile
useful = true;
dest[(realTileIndex * 8) + ((row + offsetY) & 7)] = canvasRow;
if(offsetY != 0 && ((row + offsetY) == 7))
realTileIndex = getTileCallback(tileX + dTileX + 1, tileY + dTileY + 1);
}
if (useTilemap)
(*tilemap_pointer)[tileX + dTileX + 1 + ((tileY + dTileY) * 32)] = paletteMask | tileIndex;
if (tilemapPtr != NULL)
{
tilemapPtr[tileX + dTileX + 1 + ((tileY + dTileY) * tilemapWidth)] = paletteMask | tileIndex ;
if(useful)
tilemapPtr[tileX + dTileX + 1 + ((tileY + dTileY + 1) * tilemapWidth)] = paletteMask | realTileIndex;
}
}
renderedWidth -= 8;
@ -206,10 +323,10 @@ int print_window_header_string(int *dest, byte *str, int x, int y)
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;
clear_rect_ram(dest, 16, WINDOW_HEADER_BG);
dest += (x + (y * 32)) * 8;
clear_rect_ram(dest, length, WINDOW_HEADER_BG);
}
unsigned short* print_equip_header(int type, unsigned short *tilemap, unsigned int *dest, WINDOW *window)
@ -649,6 +766,33 @@ void format_cash_window(int value, int padding, byte* str)
*str++ = 0xFF;
}
int player_name_printing_registration(byte* str, WINDOW* window)
{
char String[26];
bool ended = false;
int total = 24;
for(int i = 0; i < 24; i++)
{
if(ended)
{
String[i] = 0x53;
}
else if((i < 23 && str[i + 1] == 0xFF && str[i] == 0) || (i == 23 && str[i] == 0))
{
String[i] = 0x70;
total = i;
ended = true;
}
else
String[i] = str[i];
}
String[24] = 0;
String[25] = 0xFF;
print_blankstr_window(0, 2, 24, window);
m2_printstr(window, String, 0, 1, 0);
return total;
}
// The game draws windows lazily: no window will be drawn to the screen until
// a renderable token is encountered. So it's possible to have text that
// does stuff in the background without ever showing a window. Lots of doors

View File

@ -25,7 +25,11 @@
#define CUSTOMCC_ADD_X 0x60
byte decode_character(byte chr);
byte encode_ascii(char chr);
int get_tile_number(int x, int y);
int ascii_strlen(char *str);
int wrapper_count_pixels_to_tiles(byte *str, int length);
int count_pixels_to_tiles(byte *str, int length, int startingPos);
int expand_bit_depth(byte row, int foreground);
byte reduce_bit_depth(int row, int foreground);
byte print_character(byte chr, int x, int y);
@ -35,10 +39,10 @@ void print_special_character(int tile, int x, int y);
void map_special_character(unsigned short tile, int x, int y);
void map_tile(unsigned short tile, int x, int y);
byte print_character_with_callback(byte chr, int x, int y, int font, int foreground,
int *dest, int (*getTileCallback)(int, int), int useTilemap);
int *dest, int (*getTileCallback)(int, int), unsigned short *tilemapPtr, int tilemapWidth);
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);
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,
WINDOW *window);
unsigned short format_tile(unsigned short tile, bool flip_x, bool flip_y);
@ -65,8 +69,14 @@ void print_number_menu_current(byte digit, WINDOW* window);
void clear_number_menu(WINDOW* window);
void format_cash_window(int value, int padding, byte* str);
void handle_first_window(WINDOW* window);
void getCharName(byte character, byte *str, int *index);
void copy_name(byte *str, byte *source, int *index, int pos);
byte getSex(byte character);
void getPossessive(byte character, byte *str, int *index);
void getPronoun(byte character, byte *str, int *index);
extern unsigned short m2_coord_table[];
extern byte m2_ness_name[];
extern int m2_bits_to_nybbles[];
extern byte m2_nybbles_to_bits[];
extern byte *m2_font_table[];
@ -77,6 +87,7 @@ extern byte m12_other_str5[];
extern byte m12_other_str6[];
extern byte m12_other_str7[];
extern byte m12_other_str8[];
extern byte m2_cstm_last_printed[];
extern void cpufastset(void *source, void *dest, int mode);
extern byte* m2_strlookup(int *offset_table, byte *strings, int index);
@ -84,3 +95,7 @@ extern int bin_to_bcd(int value, int* digit_count);
extern int m2_drawwindow(WINDOW* window);
extern int m2_resetwindow(WINDOW* window, bool skip_redraw);
extern void m2_hpwindow_up(int character);
extern int m2_div(int dividend, int divisor);
extern int m2_remainder(int dividend, int divisor);
extern void m2_soundeffect(int index);
extern void m2_printstr(WINDOW* window, byte* str, unsigned short x, unsigned short y, bool highlight);

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

  
  
 
 

Binary file not shown.

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 896 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 448 B

After

Width:  |  Height:  |  Size: 504 B

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -0,0 +1 @@
MqMrMsMtMuMvMwMxMyMMMMM]MSMMMzM{M|M}M~MM€M丮侻MMMMWM甅MM僊凪匨哅嘙圡塎奙PMMMMM^M_MMM`MaMbMcMdMeMfMgMhMiMMMQM琈MMMMMMMMMMMMMMMMMMMMMMMMoM疢M<E796A2><4D><EFBFBD><EFBFBD>M慚扢揗擬昅朚桵楳橫MMMM]MSMMM歁汳淢滿濵烳燤<E783B3><E787A4>MMMMWM甅MM<4D><4D><EFBFBD><EFBFBD><EFBFBD>㎝狹PMMMMM^M_MMM`MaMbMcMdMeMfMgMhMiMMMQM琈MMMMMMMMMMMMMMMMMMMMMMMMoM疢M<E796A2><4D><EFBFBD><EFBFBD>

Binary file not shown.

Binary file not shown.

View File

@ -75,7 +75,7 @@ b @@store_x
//--------------------------------
// 5E FF XX: Load value into memory
cmp r4,0x5E
bne @@end
bne @@next3
mov r3,3
// Get the argument
@ -94,6 +94,57 @@ mov r0,r1 // the jump table is 1-indexed
mov r4,r3
bl 0x80A334C // store to window memory
mov r3,r4
b @@end
@@next3:
//--------------------------------
// 5D FF: Print give text
cmp r4,0x5D
bne @@end
// 5D FF should be treated as a renderable code
push {r0-r3}
mov r0,r2
bl handle_first_window
pop {r0-r3}
ldr r3,=#0x30009FB
ldrb r3,[r3,#0] //Source
ldr r2,=#m2_active_window_pc //Target
ldrb r2,[r2,#0]
ldr r1,=#0x3005230
ldr r1,[r1,#0x10] //Inventory Window
ldrh r4,[r1,#0x36] //Cursor Y
ldrh r1,[r1,#0x34] //Cursor X
lsl r4,r4,#1
cmp r1,#0
beq @@continue
add r4,r4,#1 //Selected Item number in inventory
@@continue:
lsl r4,r4,#1
ldr r0,=#0x3005200
ldr r0,[r0,#0]
push {r0} //String address
ldr r0,=#0x3001D40
mov r1,#0x6C
mul r1,r3
add r0,#0x14
add r0,r0,r1 //Inventory of source
add r0,r0,r4 //Item address
ldrh r0,[r0,#0] //Item
cmp r0,#0
beq @@EndOf5D
mov r1,r2
mov r2,r3
ldr r3,=#0x3005230
ldr r3,[r3,#0x08] //Dialogue Window
bl give_print
@@EndOf5D:
pop {r0}
mov r3,#0
sub r3,r3,#1 //r3 is now -1
//--------------------------------
@@end:

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

@ -50,15 +50,15 @@ mov r3,6
.include "m2-status-switch.asm"
//---------------------------------------------------------
// BAC18 hacks (status window switching)
// BAC18 hacks (status window)
//---------------------------------------------------------
.org 0x80BACFC :: bl bac18_redraw_status
.org 0x80BADE6 :: bl bac18_redraw_status
.org 0x80BACEA :: bl bacea_status_psi_window
.org 0x80BACEE :: bl bac18_clear_psi
.org 0x80BADC8
bl bac18_check_button
b 0x80BADD8
.org 0x80BADB0 :: bl badb0_status_inner_window
.org 0x80BADCC :: b 0x80BADD8
//---------------------------------------------------------
// BAEF8 hacks (equip window)
@ -103,10 +103,6 @@ b 0x80BADD8
// C5500 hacks (equip window switching)
//---------------------------------------------------------
// Clear offense/defense changes when moving cursor
.org 0x80C5AA2 :: bl c5500_clear_up
.org 0x80C5B12 :: bl c5500_clear_down
// Don't draw equip icon
.org 0x80C5A1A :: nop
.org 0x80C5A28 :: nop
@ -116,6 +112,9 @@ b 0x80BADD8
.org 0x80C55F8
mov r4,r0
mov r0,r9
mov r1,#0x10 //Tiles to clear
mov r2,#0x10 //x
mov r3,#0x11 //y
bl clear_window_header
mov r0,r4
mov r1,r6 // tilemap
@ -139,7 +138,7 @@ b 0x80C5726
.org 0x80C2192
mov r2,r8
str r2,[sp]
mov r2,0xFD
mov r2,0xFE
lsl r2,r2,1
add r0,r6,r2
mov r1,0x71
@ -163,15 +162,6 @@ mov r2,r1 // record X width
add r2,3 // add a space
.org 0x80C2468 :: bl print_string_hlight_pixels
//---------------------------------------------------------
// C438C hacks (PSI window cursor movement)
//---------------------------------------------------------
.org 0x80C4580 :: bl c438c_moveup
.org 0x80C4642 :: bl c438c_movedown
.org 0x80C4768 :: bl c438c_moveright
.org 0x80C48B2 :: bl c438c_moveleft
//---------------------------------------------------------
// PSI target window hacks
//---------------------------------------------------------
@ -195,10 +185,22 @@ add r1,0x60
.org 0x80CA712
mov r0,0x50
//---------------------------------------------------------
// C438C hacks (Inner PSI window input management + target window printing + header printing)
//---------------------------------------------------------
.org 0x80C495A :: bl c495a_status_target
//---------------------------------------------------------
// B8BBC hacks (PSI window)
//---------------------------------------------------------
//Do not redraw unless it is needed
.org 0x80B8CD2 :: bl b8cd2_psi_window
//Sets up for the target window
.org 0x80B8DB4 :: bl b8db4_psi_inner_window
// Redraw main menu when exiting PSI target window
.org 0x80B8E3A :: bl b8bbc_redraw_menu_2to1
@ -206,6 +208,16 @@ mov r0,0x50
.org 0x80B8CF8 :: bl b8bbc_redraw_menu_13to2 // 1 to 2
.org 0x80B920C :: bl b8bbc_redraw_menu_13to2 // 3 to 2
//---------------------------------------------------------
// E06EC hacks (PSI window in battle)
//---------------------------------------------------------
//Sets up for the target window
.org 0x80E0854 :: bl e0854_psi_inner_window_battle
//Do not redraw unless it is needed
.org 0x80E079A :: bl e079a_battle_psi_window
//---------------------------------------------------------
// C4B2C hacks (Equip window render)
//---------------------------------------------------------
@ -519,6 +531,33 @@ b 0x80D3A14
.org 0x80E0888 :: bl e06ec_redraw_psi
.org 0x80E0A16 :: bl e06ec_redraw_bash_psi
//---------------------------------------------------------
// Equipment number printing in dialogue window
//---------------------------------------------------------
.org 0x80D37EC :: bl d37ec_print_number :: b 0x80D381C //Offense
.org 0x80D36D0 :: bl d37ec_print_number :: b 0x80D3700 //Defense
//---------------------------------------------------------
// Remove continuous printing of outer equip window and also
// remove continuous printing of Offense and Defense numbers
// in both outer and innermost equipment windows
//---------------------------------------------------------
.org 0x80C518E :: bl c518e_outer_equip
.org 0x80BAF60 :: bl baf60_outer_equip_setup
.org 0x80BAFC8 :: bl bafc8_outer_equip_attack_defense
.org 0x80BB26E :: bl bb990_inner_equip_attack_defense_setup //Weapon
.org 0x80BB730 :: bl bb990_inner_equip_attack_defense_setup //Body
.org 0x80BB860 :: bl bb990_inner_equip_attack_defense_setup //Arms
.org 0x80BB990 :: bl bb990_inner_equip_attack_defense_setup //Other
.org 0x80BB6B2 :: bl bb6b2_inner_equip_attack_defense_weapon
.org 0x80BB64E :: bl bb64e_inner_equip_attack_defense_none_weapon
.org 0x80BB80E :: bl bbe7c_inner_equip_attack_defense_defensive_equipment //Body Offense/Defense printing
.org 0x80BB93E :: bl bbe7c_inner_equip_attack_defense_defensive_equipment //Arms Offense/Defense printing
.org 0x80BBE7C :: bl bbe7c_inner_equip_attack_defense_defensive_equipment //Other Offense/Defense printing
.org 0x80BBDDE :: bl bbe7c_inner_equip_attack_defense_defensive_equipment //Defensive equipment Offense/Defense none printing
//---------------------------------------------------------
// B89EC hacks (print current cash balance)
//---------------------------------------------------------
@ -646,6 +685,7 @@ pop {pc}
.org 0x80BF858
push {lr}
mov r1,0
mov r2,0
bl goods_outer_process
pop {pc}
@ -656,9 +696,102 @@ pop {pc}
.org 0x80C0420
push {lr}
mov r1,1
mov r2,0
bl goods_outer_process
pop {pc}
//---------------------------------------------------------
// C7CA4 hacks (Shop)
//---------------------------------------------------------
.org 0x80C7CA4
mov r0,r8 //Window
ldr r1,[sp,#0xC] //Items in shop
mov r2,#0 //y_offset | r3 already has the item total for this window
bl shop_print_items //Print the items
b 0x80C7E12 //Avoid the game's printing by jumping it
//---------------------------------------------------------
// BFE74 hacks (Goods outer menu for Give)
//---------------------------------------------------------
.org 0x80BFE74
push {lr}
mov r1,#1
mov r2,#1
bl goods_outer_process
pop {pc}
//---------------------------------------------------------
// BA61C hacks (Fixes inventory when out of Give via B button)
//---------------------------------------------------------
.org 0x80BA61C
bl ba61c_get_print_inventory_window
//---------------------------------------------------------
// B9ECC hacks (Fixes inventory when out of selecting a party member to give food to via B button)
//---------------------------------------------------------
.org 0x80B9ECC
bl b9ecc_get_print_inventory_window
//---------------------------------------------------------
// BA48E hacks (Fixes inventory when out of Give via text)
//---------------------------------------------------------
.org 0x80BA48E
bl ba48e_get_print_inventory_window
//---------------------------------------------------------
// B9F96 hacks (Fixes main window after consuming an item)
//---------------------------------------------------------
.org 0x80B9F96
bl _reprint_first_menu
//---------------------------------------------------------
// B9CF8 hacks (Fixes main window after an item prints a dialogue)
//---------------------------------------------------------
.org 0x80B9CF8
bl _reprint_first_menu
//---------------------------------------------------------
// B9C88 hacks (Fixes main window after an equippable item prints a dialogue)
//---------------------------------------------------------
.org 0x80B9C88
bl _reprint_first_menu
//---------------------------------------------------------
// BA52C hacks (Fixes main window after giving an item)
//---------------------------------------------------------
.org 0x80BA52C
bl _reprint_first_menu
//---------------------------------------------------------
// BA44E hacks (Fixes main window after not being able to give an item)
//---------------------------------------------------------
.org 0x80BA44E
bl _reprint_first_menu
//---------------------------------------------------------
// BA7BE hacks (Fixes main window after calling the help function)
//---------------------------------------------------------
.org 0x80BA7BE
bl ba7be_reprint_first_menu
//---------------------------------------------------------
// B9AA2 hacks (Fixes main window after exiting the item action window)
//---------------------------------------------------------
.org 0x80B9AA2
bl b9aa2_reprint_first_menu
//---------------------------------------------------------
// C6BA2 hacks (Fixes main window after exiting the Stored Goods window)
//---------------------------------------------------------
.org 0x80C6BA2
bl c6ba2_reprint_first_menu
//---------------------------------------------------------
// BCEB0 hacks (Fixes main window after exiting the pickup menu)
//---------------------------------------------------------
.org 0x80BCEB0
bl _reprint_first_menu
//---------------------------------------------------------
// C1C98 hacks (menu selection)
//---------------------------------------------------------
@ -739,6 +872,9 @@ b 0x080C959A
bl eeb1a_player_name //Call the new routine
b 0x80EEB7A //Do the rest of the original routine
//Remove subtract from player name printing
.org 0x80EEB94 :: mov r2,r3
//---------------------------------------------------------
// End of battle hacks
//---------------------------------------------------------
@ -789,6 +925,26 @@ lsl r0,r1,4
nop
nop
//---------------------------------------------------------
// 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
//---------------------------------------------------------
@ -800,6 +956,72 @@ nop
.org 0x80C4448 :: bl c4448_fix_char_tiles //Inner PSI window - part 2
.org 0x80DBF36 :: bl c009e_fix_char_tiles //Battle menu window
//---------------------------------------------------------
// Proper dollar and 00 symbols for [9C FF]
//---------------------------------------------------------
.org 0x80B8AA0 :: mov r0,#0x54 //Dollar
.org 0x80B8AA6 :: mov r0,#0x56 //00
//---------------------------------------------------------
// wvf_skip hacks
//---------------------------------------------------------
.org 0x80B8C2A :: bl b8c2a_set_proper_wvf_skip_and_window_type //Fixes bug of M2GBA
.org 0x80BE45A :: bl be45a_set_proper_wvf_skip
.org 0x80BE4CA :: bl be4ca_set_proper_wvf_skip_goods_battle_window
//---------------------------------------------------------
// PSI Rockin in battle text
//---------------------------------------------------------
.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
//---------------------------------------------------------
@ -875,9 +1097,6 @@ nop
.org 0x80C98CC :: mov r4,#0xEF
.org 0x80C98D4 :: bl c98d4_load_1e5
//Rockin's
.org 0x80C2196 :: mov r2,#0xFE
//Name writing
.org 0x80020B6 :: bl _2352_load_1d7
.org 0x80020C6 :: mov r0,#0xEF
@ -968,7 +1187,7 @@ nop
//Naming screen name length
.org 0x8004F54 :: mov r2,#5 //Ness
.org 0x8004F78 :: mov r0,#5 //Paula
.org 0x8004F78 :: mov r0,#5 :: str r0,[sp,#0x18] :: bl _4f7c_window_selector //Paula
.org 0x8004F9C :: mov r0,#5 //Jeff
.org 0x8004FC0 :: mov r1,#5 //Poo
@ -989,6 +1208,153 @@ nop
.org 0x802A75F :: db 0x30 //Add 8 extra frames before the game can start reading again.
//==============================================================================
// File select hacks
//==============================================================================
// Main file select window resize
.org 0x82B79BC :: dw 0x1C // new window width
.org 0x8003998 :: mov r0,1 // new window x
.org 0x8003F92 :: mov r0,1
.org 0x80053DC :: mov r0,1
.org 0x8003A04 :: bl _3a04_highlight_file //Changes window position and makes sure the file is properly highlighted
.org 0x8003B40 :: mov r0,0x10 // new cursor x
.org 0x86DB070 :: .incbin "data/m2-fileselect-template.bin"
.org 0x86D9808
.incbin "data/m2-fileselect-tileset.bin"
// Formatting
.org 0x80021E8 :: bl format_file_string
.org 0x8002284 :: bl format_file_string
//Load the pixels in fileselect_pixels_location
.org 0x80038C0 :: bl _38c0_load_pixels
// Printing
.org 0x80038CC :: mov r2,0x40 :: bl wrapper_first_file_string
.org 0x80038DE :: mov r2,0x40 :: bl wrapper_first_file_string
.org 0x80038F2 :: mov r2,0x40 :: bl wrapper_first_file_string :: bl _38f8_store_pixels
// Bump file select cursor up by 3 pixels - Not needed now that the text is 3 pixels lower
//.org 0x8003844 :: add r0,r5,1
// File select options
.org 0x8003F78 :: bl _3f78_highlight_file //Keeps highlight consistent when changing palette in the text flavour window
.org 0x8004072 :: bl _40e2_cursor_X //Removing highlight position
.org 0x8004080 :: mov r3,#4 //Remove highlight of 4 tiles maximum
.org 0x8004092 :: bl _4092_print_window_store //Printing + storing pixels
.org 0x80040E2 :: bl _40e2_cursor_X //Highlight position
.org 0x80040F4 :: mov r3,#4 //Print highlight of 4 tiles maximum
.org 0x80041D4 :: bl _41d4_cursor_X //New cursor's X
//Text Speed options
.org 0x8003BBC :: bl _4092_print_window_store //Printing + storing pixels
.org 0x8003FA2 :: bl _4092_print_window
.org 0x8003F8C :: mov r3,#4 //Print highlight of 4 tiles maximum
.org 0x8003E86 :: bl _3e86_special_setup //Avoid printing when not necessary
.org 0x8003EF2 :: bl _3e86_special_setup //Avoid printing when not necessary
.org 0x82B79D0 :: dw 0x10 //new window width
.org 0x86DB0FC :: .incbin "data/m2-textspeed-template.bin"
//Text Flavour options
.org 0x8003D8A :: bl _4092_print_window_store //Printing + storing pixels
.org 0x8003D86 :: mov r1,#4 //new window Y
.org 0x8003DB6 :: mov r1,#4
.org 0x8003E0C :: mov r1,#4
.org 0x8003E8C :: mov r1,#4
.org 0x8003EF8 :: mov r1,#4
.org 0x80053F2 :: mov r1,#4
.org 0x82B79E4 :: dw 0xF //new window width
.org 0x82B79E8 :: dw 0x10 //new window height
.org 0x8003DCE :: bl _3dce_fix_out_of_text_flavour
.org 0x86DB1F8 :: .incbin "data/m2-flavour-template.bin"
//Delete
.org 0x8004410 :: mov r1,#3 :: mov r2,#0x15 :: bl wrapper_delete_string
.org 0x800441E :: bl _4092_print_window_store //Printing + storing pixels
.org 0x82B7AFC :: dw 0x15 //new window width
.org 0x86DBE8C :: .incbin "data/m2-delete-template.bin"
//Copy
.org 0x8004294 :: bl _4294_print_window_store //Printing - 1 slot available
.org 0x80042BA :: bl _4092_print_window_store //Printing + storing pixels
.org 0x8004268 :: mov r2,#0x2 :: bl wrapper_copy_string
//Descriptions and Names
.org 0x80053F6 :: bl _53f6_fix_out_of_description
.org 0x8004ED2 :: bl wrapper_name_string //Printing names
.org 0x8004EDC :: bl _4edc_print_window_store //Printing + storing pixels
.org 0x86DB2B8 :: .incbin "data/m2-descriptions-template.bin"
.org 0x82B7A00 :: dw 0x86DB2B8 //Point all the descriptions + names to the same template
.org 0x82B7A14 :: dw 0x86DB2B8
.org 0x82B7A28 :: dw 0x86DB2B8
.org 0x82B7A3C :: dw 0x86DB2B8
.org 0x82B7A50 :: dw 0x86DB2B8
.org 0x82B7A64 :: dw 0x86DB2B8
//Alphabets
.org 0x80051A4 :: bl _4092_print_window_store //Printing + storing pixels - CAPITAL
.org 0x8004EA2 :: bl _4092_print_window_store //Printing + storing pixels - small
.org 0x82B7A8C :: dw 0x86DB5C4
.org 0x86DB5C4 :: .incbin "data/m2-alphabet-template.bin"
.org 0x8005222 :: bl setupCursorAction
.org 0x8005382 :: bl setupCursorMovement
.org 0x800538A :: bl setupCursorPosition //Cursor position
.org 0x800536C :: bl setupCursorPosition //Cursor position
.org 0x82B8FFC :: .incbin "data/m2-alphabet-table.bin"
.org 0x8002322 :: bl _2322_setup_windowing
//Summary
.org 0x80054F2 :: mov r2,#5 :: bl wrapper_name_summary_string //Printing Ness' name
.org 0x8005502 :: mov r2,#5 :: bl wrapper_name_summary_string //Printing Paula's name
.org 0x8005512 :: mov r2,#5 :: bl wrapper_name_summary_string //Printing Jeff's name
.org 0x8005522 :: mov r2,#5 :: bl wrapper_name_summary_string //Printing Poo's name
.org 0x800555C :: nop :: nop //Sends to a bunch of 0xFF
.org 0x800556A :: nop :: nop //Sends to a bunch of 0xFF
.org 0x8005530 :: mov r0,#0x11 //New x for King's name
.org 0x8005536 :: bl wrapper_name_summary_string //Printing King's name
.org 0x8005578 :: bl wrapper_count_pixels_to_tiles :: mov r2,#6 :: mov r4,#0x17 :: sub r0,r4,r0 //Count length of Food's name in tiles
.org 0x8005588 :: bl wrapper_name_summary_string //Printing Food's name
.org 0x8005596 :: bl wrapper_count_pixels_to_tiles :: mov r2,#6 :: sub r4,r4,r0 //Count length of Thing's name in tiles
.org 0x80055A6 :: bl wrapper_name_summary_string //Printing Thing's name
.org 0x80055B0 :: bl _4092_print_window_store //Printing + storing pixels
.org 0x80056F0 :: add r0,#0x90 //New cursor's X
.org 0x86DBC6C :: .incbin "data/m2-summary-template.bin"
//==============================================================================
// Overworld player name alphabet
//==============================================================================
//Player name printing - character is added
.org 0x80C75B4 :: bl c75b4_overworld_naming_top_printing :: b 0x80C777A
//Player name printing - character is deleted via add
.org 0x80C780E :: bl c780e_overworld_naming_top_printing :: b 0x80C789A
//Player name printing - character is deleted via backspace
.org 0x80C74CC :: bl c74cc_overworld_naming_top_printing :: b 0x80C755A
//Player name printing - menu is re-entered after the name has been inserted once
.org 0x80C6CC6 :: bl c6cc6_overworld_naming_top_printing :: b 0x80C6D5E
//Player name alphabet - cursor movement
.org 0x80C6F24 :: bl c6f24_overworld_alphabet_movement :: b 0x80C7340
//Alphabet - switching support - removal of unused alphabet
.org 0x80C7380 :: nop :: nop :: nop :: mov r0,r9 :: cmp r0,#0 :: beq 0x80C741A :: nop :: nop :: cmp r0,#1
//Print CAPITAL alphabet only if needed
.org 0x80C7394 :: bl c7394_CAPITAL_overworld_alphabet :: b 0x80C73B8
//Print small alphabet
.org 0x80C73B8 :: nop :: mov r0,r9 :: cmp r0,#2
//Print small alphabet only if needed
.org 0x80C73C0 :: bl c73c0_small_overworld_alphabet :: b 0x80C73E2
//Choose character table based on alphabet loaded in
.org 0x80C7578 :: bl c7578_load_letters
//==============================================================================
// Data files
//==============================================================================
@ -996,6 +1362,11 @@ nop
.org m2_default_names
.incbin "data/m2-default-names.bin"
.org 0x8B1BA88
m2_overworld_alphabet_table:
.incbin "data/m2-overworld-alphabet-table.bin"
.org 0x8B2C000
// Box font relocation
@ -1019,7 +1390,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:
@ -1047,7 +1418,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:
@ -1062,19 +1433,39 @@ 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"
m2_coord_table_file:
.incbin "data/m2-coord-table-file-select.bin"
//==============================================================================
// Existing subroutines/data
//==============================================================================
.definelabel m2_ness_goods ,0x3001D54
.definelabel m2_ness_exp ,0x3001D70
.definelabel m2_ness_maxhp ,0x3001D84
.definelabel m2_ness_curhp ,0x3001D86
.definelabel m2_ness_maxpp ,0x3001D8C
.definelabel m2_ness_curpp ,0x3001D8E
.definelabel m2_paula_goods ,0x3001DC0
.definelabel m2_jeff_goods ,0x3001E2C
.definelabel m2_poo_goods ,0x3001E98
.definelabel m2_ness_data ,0x3001D54
.definelabel m2_ness_name ,0x3001F10
.definelabel m2_old_paula_name ,0x3001F16
.definelabel m2_paula_name ,0x3001F17
@ -1092,6 +1483,7 @@ m2_enemy_attributes:
.definelabel m2_cstm_last_printed ,0x3001F4F
.definelabel m2_player1 ,0x3001F50
.definelabel m2_script_readability ,0x3004F08
.definelabel m2_psi_exist ,0x300525C
.definelabel m2_active_window_pc ,0x3005264
.definelabel m2_setup_naming_mem ,0x8001D5C
.definelabel m2_soundeffect ,0x8001720
@ -1105,14 +1497,17 @@ m2_enemy_attributes:
.definelabel m2_enable_script ,0x80A1F6C
.definelabel m2_sub_a334c ,0x80A334C
.definelabel m2_sub_a3384 ,0x80A3384
.definelabel m2_get_selected_item ,0x80A469C
.definelabel m2_psitargetwindow ,0x80B8AE0
.definelabel m2_isequipped ,0x80BC670
.definelabel m2_swapwindowbuf ,0x80BD7AC
.definelabel m2_setup_window ,0x80BD844
.definelabel m2_strlookup ,0x80BE260
.definelabel m2_initwindow ,0x80BE458
.definelabel m2_statuswindow_numbers,0x80C0A5C
.definelabel m2_psiwindow ,0x80C1FBC
.definelabel m2_drawwindow ,0x80C87D0
.definelabel m2_print_window ,0x80C8BE4
.definelabel m2_printstr ,0x80C9634
.definelabel m2_printstr_hlight ,0x80C96F0
.definelabel m2_printnextch ,0x80C980C
@ -1124,7 +1519,9 @@ m2_enemy_attributes:
.definelabel m2_hpwindow_up ,0x80D3F0C
.definelabel m2_curhpwindow_down ,0x80D41D8
.definelabel m2_div ,0x80F49D8
.definelabel m2_remainder ,0x80F4A70
.definelabel m2_default_names ,0x82B9330
.definelabel m2_items ,0x8B1D62C
//==============================================================================
// Code files
@ -1137,5 +1534,6 @@ m2_enemy_attributes:
.include "m2-formatting.asm"
.include "m2-customcodes.asm"
.include "m2-compiled.asm"
.include "m2-flyover.asm"
.close

File diff suppressed because it is too large Load Diff

View File

@ -719,7 +719,7 @@
"OffsetLocation": 11632760,
"OldPointer": 11631723,
"Old": "ひらがな カタカナ[00 FF]",
"New": "misc64[00 FF]"
"New": "[00 FF]"
},
{
"Index": 101,

View File

@ -126,7 +126,7 @@
810724
],
"Old": "ばしょ[00 FF]",
"New": "To[00 FF]"
"New": "To:[00 FF]"
},
{
"OldPointer": 11647572,
@ -134,7 +134,7 @@
813508
],
"Old": "➨あずかりもの(1)へ[00 FF]",
"New": "➨Stored goods(1)[00 FF]"
"New": "➨Stored Goods(1)[00 FF]"
},
{
"OldPointer": 11647585,
@ -143,13 +143,13 @@
813768
],
"Old": "➨あずかりもの(2)へ[00 FF]",
"New": "➨Stored goods(2)[00 FF]"
"New": "➨Stored Goods(2)[00 FF]"
},
{
"OldPointer": 11647598,
"PointerLocations": [],
"Old": "➨あずかりもの(3)へ[00 FF]",
"New": "➨Stored goods(3)[00 FF]"
"New": "➨Stored Goods(3)[00 FF]"
},
{
"OldPointer": 11647611,
@ -157,6 +157,6 @@
812788
],
"Old": "あずかりもの[00 FF]",
"New": "Stored goods[00 FF]"
"New": "Stored Goods[00 FF]"
}
]

View File

@ -2158,10 +2158,10 @@
^L2139^[00 FF]
^L2140^[86 FF _L4002_][09 FF B5 00][09 FF 85 02][86 FF _L4937_]@Hello![01 FF] This is Escargo Express.[01 FF] (hee, ha, he, ha)[02 FF]@I just (hee, ha, he, ha)[01 FF] couldn't find your location...[02 FF]@...You must be somewhere[01 FF] really strange.[01 FF] (hee, ha, he, ha)[02 FF]@I've decided, honestly, that...[01 FF] I should give up.[02 FF]@I'm outta here.[01 FF] (hee, ha, he, ha)[02 FF]@Sometimes this happens,[01 FF] you know?[02 FF][86 FF _L4938_][86 FF _L4024_][00 FF]
^L2141^[09 FF B4 00][09 FF B3 00][86 FF _L4937_]@Hello![01 FF] This is Mach Pizza.[01 FF] (hee, ha, he, ha)[02 FF]@...You must be somewhere[01 FF] really strange,[01 FF] (hee, ha, he, ha)...[02 FF]@I couldn't deliver the pizza.[01 FF] The pizza got really cold and[01 FF] hard, and my legs are tired...[02 FF]@I am going to give up and[01 FF] go back.[02 FF]@...I hope I can find the way[01 FF] home...[01 FF] (hee, ha, he, ha)[02 FF][86 FF _L4938_][86 FF _L4024_][00 FF]
^L2142^[AB FF 00 00][88 FF][86 FF _L3633_][89 FF][87 FF][00 FF]
^L2143^himself.[1D FF][00 FF]
^L2144^[88 FF][86 FF _L3633_][81 FF _L5455_][89 FF][87 FF][90 FF 00][1A FF 01 00].[02 FF][00 FF]
^L2145^[87 FF][90 FF 00][1A FF 01 00] ###failed.[02 FF][1D FF][00 FF]
^L2142^[5D FF][00 FF]
^L2143^[00 FF]
^L2144^[00 FF]
^L2145^[00 FF]
^L2146^[88 FF][AB FF 00 00][87 FF][9A FF C4 00][81 FF _L5456_][89 FF][AB FF 00 00][B7 FF 00][82 FF _L5457_][89 FF][B9 FF 00 00 00 00][88 FF][86 FF _L3633_][81 FF _L5458_][89 FF][87 FF]@[90 FF 00][1A FF 01 00] got rid of[01 FF] the [87 FF][90 FF 00][1A FF 02 00].[1D FF][00 FF]
^L2147^[AB FF 00 00][87 FF]@[90 FF 00][1A FF 01 00] is the only one who[01 FF] should carry[01 FF] the [87 FF][90 FF 00][1A FF 02 00].[1D FF][00 FF]
^L2148^[AB FF 00 00]@The [90 FF 00][1A FF 02 00] is one[01 FF] of the items that can be[01 FF] equipped.[1D FF][00 FF]
@ -3073,7 +3073,7 @@
^L3358^@But, you can't take it.[02 FF]@You have no space for it.[02 FF]@Go and do whatever you have[01 FF] to and come back.[1D FF][00 FF]
^L3360^@You have too much stuff to[01 FF] receive the book.[02 FF]@Get rid of something.[1D FF][00 FF]
^L3361^[FC FF 05 00]@.....![02 FF]@Book![02 FF]@Can fix shyness.[02 FF]@Thanks.[02 FF]@Relax.[02 FF]@I'll read to everyone.[02 FF]@Oh![02 FF]@Just holding this book in my[01 FF] hands makes me feel like[02 FF]@I'm overcoming my shyness[01 FF] already![02 FF]@I'll really take time to read it to[01 FF] everyone![D4 FF 79 00][02 FF][FC FF 43 00][C6 FF][A0 FF D0 07 13 00 01 00][9E FF]@(The leader of the Tenda tribe[01 FF] read <Overcoming Shyness> to[01 FF] everyone.)[02 FF][C6 FF][86 FF _L2185_][14 FF 5F 00][CE FF E4 04 07 00][EA FF FF 00][1B FF 01 00][C5 FF]@Chat, Chat whisper, whisper[02 FF]@I'd like to give you some[01 FF] <[90 FF 92][1A FF 02 00]> in return.[02 FF]@<[90 FF 92][1A FF 02 00]> is a type of dish[01 FF] that all Tenda like.[02 FF]@It stinks, but it tastes[01 FF] wonderful.[02 FF][C6 FF][6D FF FF 00 D1 00][93 FF 00 92][8A FF][D4 FF 74 00][1B FF 3C 00][C7 FF]@[0D FF] lends the leader of[01 FF] the Tenda tribe the book[01 FF] <Overcoming Shyness.>[02 FF][86 FF _L2238_][1D FF][C6 FF][08 FF 9B 00][1B FF 3C 00][08 FF FD 01][86 FF _L1689_][C3 FF FF 02 E4 04][D8 FF FF 00 00 00][86 FF _L3362_][EB FF FF 00][FC FF 06 00][00 FF]
^L3362^@Hey, you![1B FF 14 00] I have a happy little[01 FF] question for you...[02 FF]@.....[02 FF]@[86 FF _playername_]...[02 FF]@[86 FF _playername_],[02 FF]@are you sure this is the correct[01 FF] player's name?[02 FF]@If it's not right,[1B FF 0F 00] you can change[01 FF] it...[02 FF][C6 FF]^L4222^[6B FF 02 00][1B FF 1E 00][C4 FF 00 03][FC FF 04 00][6B FF 02 00][1B FF 1E 00][C5 FF]@[86 FF _playername_],[02 FF]@Are you sure it's what you[01 FF] want?[02 FF]@Are you happy with the name?[03 FF 00 00][04 FF _L4220_][05 FF _L4221_]^L4221^@Here's your chance to change[01 FF] it...[02 FF][C6 FF][80 FF _L4222_]^L4220^@Are you absolutely certain?[03 FF 00 00][04 FF _L4223_][05 FF _L4221_][80 FF _L4221_]^L4223^@Yeah, I thought that you had[01 FF] made up your mind...[1D FF][C6 FF][00 FF]^playername^[BC FF 01 00]^playername-loop^[67 FF][82 FF _playername-end_][A8 FF 01][87 FF][9A FF 11 00][82 FF _playername-skipnewline_][01 FF] ^playername-skipnewline^[1F FF 00 00][C0 FF][80 FF _playername-loop_]^playername-end^[00 FF]
^L3362^@Hey, you![1B FF 14 00] I have a happy little[01 FF] question for you...[02 FF]@.....[02 FF]@[86 FF _playername_]...[02 FF]@[86 FF _playername_],[02 FF]@are you sure this is the correct[01 FF] player's name?[02 FF]@If it's not right,[1B FF 0F 00] you can change[01 FF] it...[02 FF][C6 FF]^L4222^[6B FF 02 00][1B FF 1E 00][C4 FF 00 03][FC FF 03 00][6B FF 02 00][1B FF 1E 00][C5 FF]@[86 FF _playername_],[02 FF]@Are you sure it's what you[01 FF] want?[02 FF]@Are you happy with the name?[03 FF 00 00][04 FF _L4220_][05 FF _L4221_]^L4221^@Here's your chance to change[01 FF] it...[02 FF][C6 FF][80 FF _L4222_]^L4220^@Are you absolutely certain?[03 FF 00 00][04 FF _L4223_][05 FF _L4221_][80 FF _L4221_]^L4223^@Yeah, I thought that you had[01 FF] made up your mind...[1D FF][C6 FF][00 FF]^playername^[BC FF 01 00]^playername-loop^[67 FF][82 FF _playername-end_][A8 FF 01][87 FF][9A FF 11 00][82 FF _playername-skipnewline_][01 FF] ^playername-skipnewline^[1F FF 00 00][C0 FF][80 FF _playername-loop_]^playername-end^[00 FF]
^L3363^@Hi! (smile)[1D FF][00 FF]
^L3365^[86 FF _L3366_][00 FF]
^L3366^[1C FF AE 01 _L5303_]@I like the [90 FF DC][1A FF 02 00].[02 FF]@Give me[01 FF] the [90 FF DC][1A FF 02 00],[02 FF]@I give you something.[02 FF]@Look at list.[1C FF A8 01 _L5304_][76 FF 00 00][80 FF _L5305_]