diff options
Diffstat (limited to 'engine')
-rw-r--r-- | engine/events.asm | 2 | ||||
-rw-r--r-- | engine/events_2.asm | 216 | ||||
-rwxr-xr-x | engine/mail.asm | 6 | ||||
-rw-r--r-- | engine/pack.asm | 6 | ||||
-rw-r--r-- | engine/party_menu.asm | 62 | ||||
-rw-r--r-- | engine/scripting.asm | 6 | ||||
-rwxr-xr-x | engine/startmenu.asm | 26 |
7 files changed, 162 insertions, 162 deletions
diff --git a/engine/events.asm b/engine/events.asm index 95c002042..40e863cdc 100644 --- a/engine/events.asm +++ b/engine/events.asm @@ -168,7 +168,7 @@ Function9676d: ; 9676d HandleMap: ; 96773 call ResetOverworldDelay call Function967c1 - callba Function97e08 + callba HandleCmdQueue ; no need to farcall call MapEvents ; Not immediately entering a connected map will cause problems. diff --git a/engine/events_2.asm b/engine/events_2.asm index 4597e92e5..972379e6d 100644 --- a/engine/events_2.asm +++ b/engine/events_2.asm @@ -335,8 +335,8 @@ DoBikeStep:: ; 97db3 ret ; 97df9 -Function97df9:: ; 97df9 - ld hl, wd6de +ClearCmdQueue:: ; 97df9 + ld hl, wCmdQueue ld de, 6 ld c, 4 xor a @@ -348,8 +348,8 @@ Function97df9:: ; 97df9 ret ; 97e08 -Function97e08:: ; 97e08 - ld hl, wd6de +HandleCmdQueue:: ; 97e08 + ld hl, wCmdQueue xor a .loop ld [hMapObjectIndexBuffer], a @@ -359,106 +359,106 @@ Function97e08:: ; 97e08 push hl ld b, h ld c, l - call Function97e79 + call HandleQueuedCommand pop hl .skip - ld de, $0006 + ld de, CMDQUEUE_ENTRY_SIZE add hl, de ld a, [hMapObjectIndexBuffer] inc a - cp $4 + cp CMDQUEUE_CAPACITY jr nz, .loop ret ; 97e25 -Function97e25: ; 97e25 - ld hl, wd6de - ld bc, 6 +GetNthCmdQueueEntry: ; 97e25 unreferenced + ld hl, wCmdQueue + ld bc, CMDQUEUE_ENTRY_SIZE call AddNTimes ld b, h ld c, l ret ; 97e31 -Function97e31:: ; 97e31 +WriteCmdQueue:: ; 97e31 push bc push de - call Function97e45 + call .GetNextEmptyEntry ld d, h ld e, l pop hl pop bc ret c ld a, b - ld bc, $0005 + ld bc, CMDQUEUE_ENTRY_SIZE - 1 call FarCopyBytes xor a ld [hl], a ret ; 97e45 -Function97e45: ; 97e45 - ld hl, wd6de - ld de, $0006 - ld c, $4 -.asm_97e4d +.GetNextEmptyEntry: ; 97e45 + ld hl, wCmdQueue + ld de, CMDQUEUE_ENTRY_SIZE + ld c, CMDQUEUE_CAPACITY +.loop ld a, [hl] and a - jr z, .asm_97e57 + jr z, .done add hl, de dec c - jr nz, .asm_97e4d + jr nz, .loop scf ret -.asm_97e57 - ld a, $4 +.done + ld a, CMDQUEUE_CAPACITY sub c and a ret ; 97e5c -Function97e5c:: ; 97e5c - ld hl, wd6de - ld de, $0006 - ld c, $4 -.asm_97e64 +DelCmdQueue:: ; 97e5c + ld hl, wCmdQueue + ld de, CMDQUEUE_ENTRY_SIZE + ld c, CMDQUEUE_CAPACITY +.loop ld a, [hl] cp b - jr z, .asm_97e6e + jr z, .done add hl, de dec c - jr nz, .asm_97e64 + jr nz, .loop and a ret -.asm_97e6e +.done xor a ld [hl], a scf ret ; 97e72 -Function97e72: ; 97e72 - ld hl, 0 +_DelCmdQueue: ; 97e72 + ld hl, CMDQUEUE_TYPE add hl, bc ld [hl], 0 ret ; 97e79 -Function97e79: ; 97e79 - ld hl, 0 +HandleQueuedCommand: ; 97e79 + ld hl, CMDQUEUE_TYPE add hl, bc ld a, [hl] cp 5 - jr c, .asm_97e83 + jr c, .okay xor a -.asm_97e83 +.okay ld e, a ld d, 0 - ld hl, Table97e94 + ld hl, .Jumptable_ba rept 3 add hl, de endr @@ -472,16 +472,16 @@ endr ret ; 97e94 -Table97e94: ; 97e94 - dba Function97eb7 - dba Function97eb8 - dba Function97f42 - dba Function97ef9 - dba Function97ebc +.Jumptable_ba: ; 97e94 + dba CmdQueue_Null + dba CmdQueue_Null2 + dba CmdQueue_StoneTable + dba CmdQueue_Type3 + dba CmdQueue_Type4 ; 97ea3 -Function97ea3: ; 97ea3 - ld hl, $0005 +CmdQueueAnonymousJumptable: ; 97ea3 + ld hl, CMDQUEUE_05 add hl, bc ld a, [hl] pop hl @@ -489,45 +489,44 @@ Function97ea3: ; 97ea3 ret ; 97eab -Function97eab: ; 97eab - ld hl, $0005 +CmdQueueAnonJT_Increment: ; 97eab + ld hl, CMDQUEUE_05 add hl, bc inc [hl] ret ; 97eb1 -Function97eb1: ; 97eb1 - ld hl, $0005 +CmdQueueAnonJT_Decrement: ; 97eb1 + ld hl, CMDQUEUE_05 add hl, bc dec [hl] ret ; 97eb7 -Function97eb7: ; 97eb7 +CmdQueue_Null: ; 97eb7 ret ; 97eb8 -Function97eb8: ; 97eb8 +CmdQueue_Null2: ; 97eb8 call ret_2f3e ret ; 97ebc -Function97ebc: ; 97ebc - call Function97ea3 - dw Function97ec3 - dw Function97ecd +CmdQueue_Type4: ; 97ebc + call CmdQueueAnonymousJumptable + ; anonymous jumptable + dw .zero + dw .one ; 97ec3 -Function97ec3: ; 97ec3 +.zero: ; 97ec3 ld a, [hSCY] - ld hl, $0004 + ld hl, 4 add hl, bc ld [hl], a - call Function97eab -; 97ecd - -Function97ecd: ; 97ecd - ld hl, $0001 + call CmdQueueAnonJT_Increment +.one: ; 97ecd + ld hl, 1 add hl, bc ld a, [hl] dec a @@ -535,7 +534,7 @@ Function97ecd: ; 97ecd jr z, .asm_97eee and $1 jr z, .asm_97ee4 - ld hl, $0002 + ld hl, 2 add hl, bc ld a, [hSCY] sub [hl] @@ -543,7 +542,7 @@ Function97ecd: ; 97ecd ret .asm_97ee4 - ld hl, $0002 + ld hl, 2 add hl, bc ld a, [hSCY] add [hl] @@ -551,61 +550,60 @@ Function97ecd: ; 97ecd ret .asm_97eee - ld hl, $0004 + ld hl, 4 add hl, bc ld a, [hl] ld [hSCY], a - call Function97e72 + call _DelCmdQueue ret ; 97ef9 -Function97ef9: ; 97ef9 - call Function97ea3 - dw Function97f02 - dw Function97f0a - dw Function97f1b +CmdQueue_Type3: ; 97ef9 + call CmdQueueAnonymousJumptable + ; anonymous jumptable + dw .zero + dw .one + dw .two ; 97f02 -Function97f02: ; 97f02 - call Function97f38 - jr z, Function97f2c - call Function97eab -; 97f0a - -Function97f0a: ; 97f0a - call Function97f38 - jr z, Function97f2c - call Function97eab +.zero: ; 97f02 + call .IsPlayerFacingDown + jr z, .PlayerNotFacingDown + call CmdQueueAnonJT_Increment +.one: ; 97f0a + call .IsPlayerFacingDown + jr z, .PlayerNotFacingDown + call CmdQueueAnonJT_Increment - ld hl, $0002 + ld hl, 2 add hl, bc ld a, [hl] ld [wd173], a ret ; 97f1b -Function97f1b: ; 97f1b - call Function97f38 - jr z, Function97f2c - call Function97eb1 +.two: ; 97f1b + call .IsPlayerFacingDown + jr z, .PlayerNotFacingDown + call CmdQueueAnonJT_Decrement - ld hl, $0003 + ld hl, 3 add hl, bc ld a, [hl] ld [wd173], a ret ; 97f2c -Function97f2c: ; 97f2c +.PlayerNotFacingDown: ; 97f2c ld a, $7f ld [wd173], a - ld hl, $0005 + ld hl, 5 add hl, bc ld [hl], 0 ret ; 97f38 -Function97f38: ; 97f38 +.IsPlayerFacingDown: ; 97f38 push bc ld bc, PlayerStruct call GetSpriteDirection @@ -614,50 +612,50 @@ Function97f38: ; 97f38 ret ; 97f42 -Function97f42: ; 97f42 +CmdQueue_StoneTable: ; 97f42 ld de, PlayerStruct - ld a, $d -.asm_97f47 + ld a, NUM_OBJECT_STRUCTS +.loop push af - ld hl, 0 + ld hl, OBJECT_SPRITE add hl, de ld a, [hl] and a - jr z, .asm_97f71 + jr z, .next - ld hl, $0003 + ld hl, OBJECT_MOVEMENTTYPE add hl, de ld a, [hl] - cp $19 - jr nz, .asm_97f71 + cp STEP_TYPE_19 + jr nz, .next - ld hl, $000e + ld hl, OBJECT_NEXT_TILE add hl, de ld a, [hl] call CheckPitTile - jr nz, .asm_97f71 + jr nz, .next - ld hl, $0007 + ld hl, OBJECT_DIRECTION_WALKING add hl, de ld a, [hl] - cp $ff - jr nz, .asm_97f71 - call Function3567 - jr c, .asm_97f7c + cp STANDING + jr nz, .next + call HandleStoneQueue + jr c, .fall_down_hole -.asm_97f71 - ld hl, $0028 +.next + ld hl, OBJECT_STRUCT_LENGTH add hl, de ld d, h ld e, l pop af dec a - jr nz, .asm_97f47 + jr nz, .loop ret -.asm_97f7c +.fall_down_hole pop af ret ; 97f7e diff --git a/engine/mail.asm b/engine/mail.asm index c0bc591b0..1cf1a13a7 100755 --- a/engine/mail.asm +++ b/engine/mail.asm @@ -503,9 +503,9 @@ Function4484a: ; 0x4484a ld [PartyMenuActionText], a call ClearBGPalettes .try_again - callba Function5004f - callba Function50405 - callba Function503e0 + callba LoadPartyMenuGFX + callba InitPartyMenuWithCancel + callba InitPartyMenuGFX callba WritePartyMenuTilemap callba PrintPartyMenuText call WaitBGMap diff --git a/engine/pack.asm b/engine/pack.asm index 2ba9c9d3a..e9b52606c 100644 --- a/engine/pack.asm +++ b/engine/pack.asm @@ -595,9 +595,9 @@ Function103fd: ; 103fd ld a, $8 ld [PartyMenuActionText], a call ClearBGPalettes - callba Function5004f - callba Function50405 - callba Function503e0 + callba LoadPartyMenuGFX + callba InitPartyMenuWithCancel + callba InitPartyMenuGFX .asm_10427 callba WritePartyMenuTilemap callba PrintPartyMenuText diff --git a/engine/party_menu.asm b/engine/party_menu.asm index 6b50ca620..e81355c7a 100644 --- a/engine/party_menu.asm +++ b/engine/party_menu.asm @@ -30,15 +30,15 @@ Function5001d: ; 5001d ; 5003f Function5003f: ; 5003f - call Function5004f - call Function50405 - call Function503e0 + call LoadPartyMenuGFX + call InitPartyMenuWithCancel + call InitPartyMenuGFX call WritePartyMenuTilemap call PrintPartyMenuText ret ; 5004f -Function5004f: ; 5004f +LoadPartyMenuGFX: ; 5004f call LoadFontsBattleExtra callab Function8ad1 ; engine/color.asm callab InefficientlyClear121BytesAtwc300 @@ -648,7 +648,7 @@ endr ; 503e0 -Function503e0: ; 503e0 +InitPartyMenuGFX: ; 503e0 ld hl, PartyCount ld a, [hli] and a @@ -656,7 +656,7 @@ Function503e0: ; 503e0 ld c, a xor a ld [hObjectStructIndexBuffer], a -.asm_503ea +.loop push bc push hl ld hl, Function8e83f @@ -669,60 +669,62 @@ Function503e0: ; 503e0 pop hl pop bc dec c - jr nz, .asm_503ea + jr nz, .loop callab Function8cf69 ret ; 50405 -Function50405: ; 50405 +InitPartyMenuWithCancel: ; 50405 +; with cancel xor a - ld [wd0e3], a - ld de, Unknown_5044f - call Function1bb1 + ld [wSwitchMon], a + ld de, PartyMenuAttributes + call InitMenu3 ld a, [PartyCount] inc a - ld [wcfa3], a + ld [wcfa3], a ; list length dec a ld b, a - ld a, [wd0d8] + ld a, [wPartyMenuCursor] and a - jr z, .asm_50422 + jr z, .skip inc b cp b - jr c, .asm_50424 + jr c, .done -.asm_50422 +.skip ld a, $1 -.asm_50424 +.done ld [MenuSelection2], a - ld a, $3 + ld a, A_BUTTON | B_BUTTON ld [wcfa8], a ret ; 5042d -Function5042d: ; 0x5042d - ld de, Unknown_5044f - call Function1bb1 +InitPartyMenuNoCancel: ; 0x5042d +; no cancel + ld de, PartyMenuAttributes + call InitMenu3 ld a, [PartyCount] - ld [wcfa3], a + ld [wcfa3], a ; list length ld b, a - ld a, [wd0d8] + ld a, [wPartyMenuCursor] and a - jr z, .asm_50444 + jr z, .skip inc b cp b - jr c, .asm_50446 -.asm_50444 + jr c, .done +.skip ld a, $1 -.asm_50446 +.done ld [MenuSelection2], a - ld a, $3 + ld a, A_BUTTON | B_BUTTON ld [wcfa8], a ret ; 5044f (14:444f) -Unknown_5044f: ; 5044f +PartyMenuAttributes: ; 5044f ; cursor y ; cursor x ; list length @@ -744,7 +746,7 @@ PartyMenuSelect: ; 0x50457 ld a, [MenuSelection2] ; menu selection? cp b jr z, .exitmenu ; CANCEL - ld [wd0d8], a + ld [wPartyMenuCursor], a ld a, [hJoyLast] ld b, a bit 1, b diff --git a/engine/scripting.asm b/engine/scripting.asm index f576fa3d4..6d87c2f1b 100644 --- a/engine/scripting.asm +++ b/engine/scripting.asm @@ -2153,7 +2153,7 @@ CopyConvertedText: ; 976c8 Script_itemtotext: ; 976d5 ; script command 0x41 ; parameters: -; item (ItemLabelByte) +; item (ItemLabelByte); use 0 to draw from ScriptVar ; memory (SingleByteParam) call GetScriptByte @@ -2923,7 +2923,7 @@ Script_writecmdqueue: ; 97a8b ld d, a ld a, [ScriptBank] ld b, a - callba Function97e31 + callba WriteCmdQueue ; no need to farcall ret ; 97a9e @@ -2936,7 +2936,7 @@ Script_delcmdqueue: ; 97a9e ld [ScriptVar], a call GetScriptByte ld b, a - callba Function97e5c + callba DelCmdQueue ; no need to farcall ret c ld a, 1 ld [ScriptVar], a diff --git a/engine/startmenu.asm b/engine/startmenu.asm index 290e6d6ea..bcf2247af 100755 --- a/engine/startmenu.asm +++ b/engine/startmenu.asm @@ -533,9 +533,9 @@ StartMenu_Pokemon: ; 12976 call ClearBGPalettes .menu - callba Function5004f - callba Function50405 - callba Function503e0 + callba LoadPartyMenuGFX + callba InitPartyMenuWithCancel + callba InitPartyMenuGFX .menunoreload callba WritePartyMenuTilemap @@ -684,7 +684,7 @@ PartyMonItemName: ; 12a6c CancelPokemonAction: ; 12a79 - callba Function50405 + callba InitPartyMenuWithCancel callba Function8ea71 ld a, 1 ret @@ -746,10 +746,10 @@ SwitchPartyMons: ; 12aec ld a, [CurPartyMon] inc a - ld [wd0e3], a + ld [wSwitchMon], a callba Function8ea8c - callba Function5042d + callba InitPartyMenuNoCancel ld a, 4 ld [PartyMenuActionText], a @@ -758,7 +758,7 @@ SwitchPartyMons: ; 12aec hlcoord 0, 1 ld bc, 20 * 2 - ld a, [wd0e3] + ld a, [wSwitchMon] dec a call AddNTimes ld [hl], "▷" @@ -775,9 +775,9 @@ SwitchPartyMons: ; 12aec xor a ld [PartyMenuActionText], a - callba Function5004f - callba Function50405 - callba Function503e0 + callba LoadPartyMenuGFX + callba InitPartyMenuWithCancel + callba InitPartyMenuGFX ld a, 1 ret @@ -1476,7 +1476,7 @@ Function12f5b: ; 12f5b Function12f73: ; 12f73 call SetUpMoveScreenBG ld de, Unknown_12fb2 - call Function1bb1 + call InitMenu3 call Function131ef ld hl, wcfa5 set 6, [hl] @@ -1505,7 +1505,7 @@ Function12f9f: ; 12f9f Function12fa0: ; 12fa0 push af xor a - ld [wd0e3], a + ld [wSwitchMon], a ld hl, wcfa5 res 6, [hl] call ClearSprites @@ -1543,7 +1543,7 @@ MoveScreenLoop: ; 12fd5 call SetUpMoveScreenBG call Function132d3 ld de, Unknown_13163 - call Function1bb1 + call InitMenu3 .loop call Function131ef ld hl, wcfa5 |