ref: cb8505e022f7030d4a144b43bf1e6557a0cb49fa
parent: 25e12c9391878f474a9139950298a2ddc964ba0a
author: vulcandth <[email protected]>
date: Mon Dec 26 07:55:01 EST 2022
Define `InitDefaultEZChatMsgs` and `sEZChatMessages` (#1022)
--- a/constants/mobile_constants.asm
+++ b/constants/mobile_constants.asm
@@ -68,3 +68,6 @@
; + JP Mail struct $2a
DEF MOBILE_EMAIL_LENGTH EQU $1e
DEF TRADE_CORNER_REQUEST_LENGTH EQU $8f
+
+DEF EASY_CHAT_MESSAGE_WORD_COUNT EQU 6
+DEF EASY_CHAT_MESSAGE_LENGTH EQU EASY_CHAT_MESSAGE_WORD_COUNT * 2 ; every word uses 2 bytes
--- a/engine/events/battle_tower/battle_tower.asm
+++ b/engine/events/battle_tower/battle_tower.asm
@@ -147,10 +147,10 @@
dec a
jr nz, .CopyLoop
- ld a, BANK(s4_a013)
+ ld a, BANK(sEZChatBeginBattleMessage)
call OpenSRAM
- ld hl, s4_a013
- ld bc, 36
+ ld hl, sEZChatBattleMessages
+ ld bc, EASY_CHAT_MESSAGE_LENGTH * 3
call CopyBytes
call CloseSRAM
--- a/engine/link/mystery_gift.asm
+++ b/engine/link/mystery_gift.asm
@@ -1748,13 +1748,13 @@
ld a, [sCrystalData + 0]
ld [de], a
inc de
- ld a, BANK(s4_a603) ; aka BANK(s4_a007) ; MBC30 bank used by JP Crystal; inaccessible by MBC3
+ ld a, BANK(s4_a603) ; aka BANK(sEZChatMessages) ; MBC30 bank used by JP Crystal; inaccessible by MBC3
call OpenSRAM
ld hl, s4_a603 ; address of MBC30 bank
ld bc, 8
call CopyBytes
- ld hl, s4_a007 ; address of MBC30 bank
- ld bc, 12
+ ld hl, sEZChatIntroductionMessage ; address of MBC30 bank
+ ld bc, EASY_CHAT_MESSAGE_LENGTH
call CopyBytes
call CloseSRAM
ret
--- a/engine/menus/save.asm
+++ b/engine/menus/save.asm
@@ -401,20 +401,28 @@
call ByteFill
jp CloseSRAM
-Function14d18: ; unreferenced
- ld a, BANK(s4_a007) ; MBC30 bank used by JP Crystal; inaccessible by MBC3
+InitDefaultEZChatMsgs: ; unreferenced
+ ld a, BANK(sEZChatMessages) ; MBC30 bank used by JP Crystal; inaccessible by MBC3
call OpenSRAM
ld hl, .Data
- ld de, s4_a007
- ld bc, 4 * 12
+ ld de, sEZChatMessages
+ ld bc, EASY_CHAT_MESSAGE_LENGTH * 4
call CopyBytes
jp CloseSRAM
.Data:
- db $0d, $02, $00, $05, $00, $00, $22, $02, $01, $05, $00, $00
- db $03, $04, $05, $08, $03, $05, $0e, $06, $03, $02, $00, $00
- db $39, $07, $07, $04, $00, $05, $04, $07, $01, $05, $00, $00
- db $0f, $05, $14, $07, $05, $05, $11, $0c, $0c, $06, $06, $04
+; introduction
+ db $0d, EZCHAT_GREETINGS, $00, EZCHAT_EXCLAMATIONS, $00, EZCHAT_POKEMON
+ db $22, EZCHAT_GREETINGS, $01, EZCHAT_EXCLAMATIONS, $00, EZCHAT_POKEMON
+; begin battle
+ db $03, EZCHAT_BATTLE, $05, EZCHAT_CONDITIONS, $03, EZCHAT_EXCLAMATIONS
+ db $0e, EZCHAT_CONVERSATION, $03, EZCHAT_GREETINGS, $00, EZCHAT_POKEMON
+; win battle
+ db $39, EZCHAT_FEELINGS, $07, EZCHAT_BATTLE, $00, EZCHAT_EXCLAMATIONS
+ db $04, EZCHAT_FEELINGS, $01, EZCHAT_EXCLAMATIONS, $00, EZCHAT_POKEMON
+; lose battle
+ db $0f, EZCHAT_EXCLAMATIONS, $14, EZCHAT_FEELINGS, $05, EZCHAT_EXCLAMATIONS
+ db $11, EZCHAT_TIME, $0c, EZCHAT_CONVERSATION, $06, EZCHAT_BATTLE
EraseBattleTowerStatus:
ld a, BANK(sBattleTowerChallengeState)
--- a/mobile/fixed_words.asm
+++ b/mobile/fixed_words.asm
@@ -339,9 +339,9 @@
Function11c254:
push af
- ld a, BANK(s4_a007)
+ ld a, BANK(sEZChatMessages)
call OpenSRAM
- ld hl, s4_a007
+ ld hl, sEZChatMessages
pop af
sla a
sla a
@@ -352,7 +352,7 @@
ld b, 0
add hl, bc
ld de, wcd36
- ld bc, 12
+ ld bc, EASY_CHAT_MESSAGE_LENGTH
call CopyBytes
call CloseSRAM
ret
@@ -1762,9 +1762,9 @@
ld a, [hl]
and a
jr nz, .asm_11cbd4
- ld a, BANK(s4_a007)
+ ld a, BANK(sEZChatMessages)
call OpenSRAM
- ld hl, s4_a007
+ ld hl, sEZChatMessages
ld a, [wMenuCursorY]
dec a
sla a
@@ -1776,7 +1776,7 @@
ld b, 0
add hl, bc
ld de, wcd36
- ld c, 12
+ ld c, EASY_CHAT_MESSAGE_LENGTH
.asm_11cba2
ld a, [de]
ld [hli], a
--- a/mobile/mobile_40.asm
+++ b/mobile/mobile_40.asm
@@ -2423,14 +2423,14 @@
db -1 ; end
Unknown_100ff3:
- macro_100fc0 wdc41, 1
- macro_100fc0 wPlayerName, NAME_LENGTH
- macro_100fc0 wPlayerName, NAME_LENGTH
- macro_100fc0 wPlayerID, 2
- macro_100fc0 wSecretID, 2
- macro_100fc0 wPlayerGender, 1
- macro_100fc0 s4_a603, 8
- macro_100fc0 s4_a007, PARTYMON_STRUCT_LENGTH
+ macro_100fc0 wdc41, 1
+ macro_100fc0 wPlayerName, NAME_LENGTH
+ macro_100fc0 wPlayerName, NAME_LENGTH
+ macro_100fc0 wPlayerID, 2
+ macro_100fc0 wSecretID, 2
+ macro_100fc0 wPlayerGender, 1
+ macro_100fc0 s4_a603, 8
+ macro_100fc0 sEZChatMessages, EASY_CHAT_MESSAGE_LENGTH * 4
db -1 ; end
Unknown_10102c:
--- a/ram/sram.asm
+++ b/ram/sram.asm
@@ -201,11 +201,12 @@
ds $7
-s4_a007:: ; struct size $30
-
- ds $c
-
-s4_a013:: ds 36
+sEZChatMessages::
+sEZChatIntroductionMessage:: ds EASY_CHAT_MESSAGE_LENGTH
+sEZChatBattleMessages::
+sEZChatBeginBattleMessage:: ds EASY_CHAT_MESSAGE_LENGTH
+sEZChatWinBattleMessage:: ds EASY_CHAT_MESSAGE_LENGTH
+sEZChatLoseBattleMessage:: ds EASY_CHAT_MESSAGE_LENGTH
s4_a037:: ds 4