diff options
Diffstat (limited to 'home')
-rw-r--r-- | home/joypad.asm | 36 | ||||
-rw-r--r-- | home/map.asm | 54 | ||||
-rw-r--r-- | home/map_objects.asm | 31 | ||||
-rw-r--r-- | home/menu.asm | 12 | ||||
-rw-r--r-- | home/text.asm | 20 | ||||
-rw-r--r-- | home/tilemap.asm | 2 |
6 files changed, 79 insertions, 76 deletions
diff --git a/home/joypad.asm b/home/joypad.asm index d5bfc83f3..450fa28cb 100644 --- a/home/joypad.asm +++ b/home/joypad.asm @@ -356,14 +356,14 @@ JoyTextDelay:: ; a57 ; a80 Functiona80:: ; a80 - ld a, [hConnectionStripLength] + ld a, [hMapObjectIndexBuffer1] push af - ld a, [hConnectedMapWidth] + ld a, [hMapObjectIndexBuffer2] push af xor a - ld [hConnectionStripLength], a + ld [hMapObjectIndexBuffer1], a ld a, 6 - ld [hConnectedMapWidth], a + ld [hMapObjectIndexBuffer2], a .loop push hl @@ -377,9 +377,9 @@ Functiona80:: ; a80 jr z, .loop pop af - ld [hConnectedMapWidth], a + ld [hMapObjectIndexBuffer2], a pop af - ld [hConnectionStripLength], a + ld [hMapObjectIndexBuffer1], a ret ; aa5 @@ -459,37 +459,37 @@ Functionb06:: ; b06 cp b pop bc jr nz, .asm_b27 - ld a, [hConnectionStripLength] + ld a, [hMapObjectIndexBuffer1] dec a - ld [hConnectionStripLength], a + ld [hMapObjectIndexBuffer1], a ret nz - ld a, [hConnectedMapWidth] + ld a, [hMapObjectIndexBuffer2] dec a - ld [hConnectedMapWidth], a + ld [hMapObjectIndexBuffer2], a ret nz ld a, "─" ld [hl], a ld a, -1 - ld [hConnectionStripLength], a + ld [hMapObjectIndexBuffer1], a ld a, 6 - ld [hConnectedMapWidth], a + ld [hMapObjectIndexBuffer2], a ret .asm_b27 - ld a, [hConnectionStripLength] + ld a, [hMapObjectIndexBuffer1] and a ret z dec a - ld [hConnectionStripLength], a + ld [hMapObjectIndexBuffer1], a ret nz dec a - ld [hConnectionStripLength], a - ld a, [hConnectedMapWidth] + ld [hMapObjectIndexBuffer1], a + ld a, [hMapObjectIndexBuffer2] dec a - ld [hConnectedMapWidth], a + ld [hMapObjectIndexBuffer2], a ret nz ld a, $6 - ld [hConnectedMapWidth], a + ld [hMapObjectIndexBuffer2], a ld a, $ee ld [hl], a ret diff --git a/home/map.asm b/home/map.asm index f72c74ac2..07f6b468b 100644 --- a/home/map.asm +++ b/home/map.asm @@ -729,9 +729,9 @@ ChangeMap:: ; 24e4 ld hl, OverworldMap ld a, [MapWidth] - ld [hConnectedMapWidth], a + ld [hMapObjectIndexBuffer2], a add $6 - ld [hConnectionStripLength], a + ld [hMapObjectIndexBuffer1], a ld c, a ld b, 0 rept 3 @@ -750,7 +750,7 @@ endr ld b, a .asm_250c push hl - ld a, [hConnectedMapWidth] + ld a, [hMapObjectIndexBuffer2] ld c, a .asm_2510 ld a, [de] @@ -759,7 +759,7 @@ endr dec c jr nz, .asm_2510 pop hl - ld a, [hConnectionStripLength] + ld a, [hMapObjectIndexBuffer1] add l ld l, a jr nc, .asm_251e @@ -794,10 +794,10 @@ FillMapConnections:: ; 2524 ld e, a ld a, [NorthConnectionStripLocation + 1] ld d, a - ld a, [NorthConnectionStripLength] - ld [hConnectionStripLength], a - ld a, [NorthConnectedMapWidth] - ld [hConnectedMapWidth], a + ld a, [NorthMapObjectIndexBuffer1] + ld [hMapObjectIndexBuffer1], a + ld a, [NorthMapObjectIndexBuffer2] + ld [hMapObjectIndexBuffer2], a call FillNorthConnectionStrip .South @@ -817,10 +817,10 @@ FillMapConnections:: ; 2524 ld e, a ld a, [SouthConnectionStripLocation + 1] ld d, a - ld a, [SouthConnectionStripLength] - ld [hConnectionStripLength], a - ld a, [SouthConnectedMapWidth] - ld [hConnectedMapWidth], a + ld a, [SouthMapObjectIndexBuffer1] + ld [hMapObjectIndexBuffer1], a + ld a, [SouthMapObjectIndexBuffer2] + ld [hMapObjectIndexBuffer2], a call FillSouthConnectionStrip .West @@ -843,7 +843,7 @@ FillMapConnections:: ; 2524 ld a, [WestConnectionStripLength] ld b, a ld a, [WestConnectedMapWidth] - ld [hConnectionStripLength], a + ld [hMapObjectIndexBuffer1], a call FillWestConnectionStrip .East @@ -866,7 +866,7 @@ FillMapConnections:: ; 2524 ld a, [EastConnectionStripLength] ld b, a ld a, [EastConnectedMapWidth] - ld [hConnectionStripLength], a + ld [hMapObjectIndexBuffer1], a call FillEastConnectionStrip .Done @@ -882,7 +882,7 @@ FillSouthConnectionStrip:: ; 25d3 push de push hl - ld a, [hConnectionStripLength] + ld a, [hMapObjectIndexBuffer1] ld b, a .x ld a, [hli] @@ -892,7 +892,7 @@ FillSouthConnectionStrip:: ; 25d3 jr nz, .x pop hl - ld a, [hConnectedMapWidth] + ld a, [hMapObjectIndexBuffer2] ld e, a ld d, 0 add hl, de @@ -917,7 +917,7 @@ FillEastConnectionStrip:: ; 25f6 .asm_25f6 ld a, [MapWidth] add 6 - ld [hConnectedMapWidth], a + ld [hMapObjectIndexBuffer2], a push de @@ -933,13 +933,13 @@ FillEastConnectionStrip:: ; 25f6 inc de pop hl - ld a, [hConnectionStripLength] + ld a, [hMapObjectIndexBuffer1] ld e, a ld d, 0 add hl, de pop de - ld a, [hConnectedMapWidth] + ld a, [hMapObjectIndexBuffer2] add e ld e, a jr nc, .asm_2617 @@ -1171,7 +1171,7 @@ CoordinatesEventText:: ; 2702 Function2707:: ; 2707 - ld a, [hConnectionStripLength] + ld a, [hMapObjectIndexBuffer1] ld e, a ld d, $0 ld hl, wd81e @@ -1181,7 +1181,7 @@ Function2707:: ; 2707 ; 2712 Function2712:: ; 2712 - ld a, [hConnectionStripLength] + ld a, [hMapObjectIndexBuffer1] ld e, a ld d, $0 ld hl, wd81e @@ -1191,7 +1191,7 @@ Function2712:: ; 2712 ; 271e Function271e:: ; 271e - ld a, [hConnectionStripLength] + ld a, [hMapObjectIndexBuffer1] ld e, a ld d, $0 ld hl, wd81e @@ -1463,7 +1463,7 @@ SaveScreen:: ; 289d ld de, XCoord + 1 ld a, [MapWidth] add $6 - ld [hConnectionStripLength], a + ld [hMapObjectIndexBuffer1], a ld a, [wd151] and a jr z, .asm_28cb @@ -1477,7 +1477,7 @@ SaveScreen:: ; 289d .asm_28c0 ld de, wdcbf - ld a, [hConnectionStripLength] + ld a, [hMapObjectIndexBuffer1] ld c, a ld b, $0 add hl, bc @@ -1512,7 +1512,7 @@ LoadNeighboringBlockData:: ; 28e3 ld l, a ld a, [MapWidth] add $6 - ld [hConnectionStripLength], a + ld [hMapObjectIndexBuffer1], a ld de, XCoord + 1 ld b, $6 ld c, $5 @@ -1537,7 +1537,7 @@ Function28f7:: ; 28f7 .asm_2908 pop hl - ld a, [hConnectionStripLength] + ld a, [hMapObjectIndexBuffer1] ld c, a ld b, $0 add hl, bc @@ -2145,7 +2145,7 @@ GetMapBank:: ; 2c29 GetAnyMapBank:: ; 2c31 push hl push de - ld de, $0000 + ld de, NONE call GetAnyMapHeaderMember ld a, c pop de diff --git a/home/map_objects.asm b/home/map_objects.asm index ac363b31d..07a361340 100644 --- a/home/map_objects.asm +++ b/home/map_objects.asm @@ -21,7 +21,7 @@ Function180e:: ; 180e ld hl, UsedSprites + 2 ld c, SPRITE_GFX_LIST_CAPACITY - 1 ld b, a - ld a, [hConnectionStripLength] + ld a, [hMapObjectIndexBuffer1] cp 0 jr z, .nope ld a, b @@ -234,14 +234,14 @@ GetMapObject:: ; 18d2 Function18de:: ; 18de ; Sets carry if the object is not visible on the screen. - ld [hConnectionStripLength], a + ld [hMapObjectIndexBuffer1], a call GetMapObject ld hl, MAPOBJECT_OBJECT_STRUCT_ID add hl, bc ld a, [hl] cp -1 jr z, .not_visible - ld [hConnectedMapWidth], a + ld [hMapObjectIndexBuffer2], a call GetObjectStruct and a ret @@ -326,7 +326,7 @@ Function18f5:: ; 18f5 ; 194d Function194d:: ; 194d - ld [hConnectionStripLength], a + ld [hMapObjectIndexBuffer1], a call GetMapObject call CopyObjectStruct ret @@ -335,16 +335,16 @@ Function194d:: ; 194d _CopyObjectStruct:: ; 1956 - ld [hConnectionStripLength], a + ld [hMapObjectIndexBuffer1], a call Function271e - ld a, [hConnectionStripLength] + ld a, [hMapObjectIndexBuffer1] call GetMapObject callba CopyObjectStruct ret ; 1967 Function1967:: ; 1967 - ld [hConnectionStripLength], a + ld [hMapObjectIndexBuffer1], a call GetMapObject ld hl, MAPOBJECT_OBJECT_STRUCT_ID add hl, bc @@ -453,7 +453,10 @@ Function19e9:: ; 19e9 -Function1a13:: ; 1a13 +FindFirstEmptyObjectStruct:: ; 1a13 +; Returns the index of the first empty object struct in A and its address in HL, then sets carry. +; If all object structs are occupied, A = 0 and Z is set. +; Preserves BC and DE. push bc push de ld hl, ObjectStructs @@ -462,15 +465,15 @@ Function1a13:: ; 1a13 .loop ld a, [hl] and a - jr z, .empty + jr z, .break add hl, de dec c jr nz, .loop xor a jr .done -.empty - ld a, $d +.break + ld a, NUM_OBJECT_STRUCTS sub c scf @@ -547,7 +550,7 @@ Function1a71:: ; 1a71 push de ld e, a ld d, 0 - ld hl, ObjectStruct3_Data + 1 + ld hl, ObjectStruct3_Data + 1 ; facing? rept OBJECT_STRUCT_3_DATA_WIDTH add hl, de endr @@ -569,12 +572,12 @@ endr ld [hl], a ld a, [bc] inc bc - ld hl, OBJECT_04 + ld hl, OBJECT_FLAGS1 add hl, de ld [hl], a ld a, [bc] inc bc - ld hl, OBJECT_FLAGS + ld hl, OBJECT_FLAGS2 add hl, de ld [hl], a ld a, [bc] diff --git a/home/menu.asm b/home/menu.asm index 9dcbdff47..a88545713 100644 --- a/home/menu.asm +++ b/home/menu.asm @@ -16,7 +16,7 @@ CopyMenuDataHeader:: ; 0x1d4b Function1d4b:: ; 1d4b - ld [wPocketCursorBuffer], a + ld [wMenuCursorBuffer], a ret ; 1d4f @@ -62,7 +62,7 @@ MenuDataHeader_0x1d75:: ; 1d75 db $40 ; tile backup db 0, 0 ; start coords db 17, 19 ; end coords - dw $0000 + dw NONE db 1 ; default option ; 1d7d @@ -410,7 +410,7 @@ Function1f2a:: ; 1f2a ld a, [hl] ld [MenuSelection], a ld a, [wcfa9] - ld [wPocketCursorBuffer], a + ld [wMenuCursorBuffer], a and a ret @@ -571,7 +571,7 @@ InterpretMenu:: ; 202a ld a, [hROMBank] ld [wcf94], a callba Function2400e - ld a, [wPocketCursorBuffer] + ld a, [wMenuCursorBuffer] ret ; 2039 @@ -579,7 +579,7 @@ Function2039:: ; 2039 ld a, [hROMBank] ld [wcf94], a callba Function24022 - ld a, [wPocketCursorBuffer] + ld a, [wMenuCursorBuffer] ret ; 2048 @@ -587,7 +587,7 @@ Function2048:: ; 2048 ld a, [hROMBank] ld [wcf94], a callba Function2403c - ld a, [wPocketCursorBuffer] + ld a, [wMenuCursorBuffer] ret ; 2057 diff --git a/home/text.asm b/home/text.asm index 1445aa5ef..d400ddd66 100644 --- a/home/text.asm +++ b/home/text.asm @@ -175,7 +175,7 @@ RadioTerminator:: ; 1052 PrintText:: ; 1057 call SetUpTextBox -Function105a:: ; 105a +BuenaPrintText:: ; 105a push hl hlcoord TEXTBOX_INNERX, TEXTBOX_INNERY lb bc, TEXTBOX_INNERH - 1, TEXTBOX_INNERW @@ -1057,13 +1057,13 @@ Function1522:: ; 1522 ; 152d TextSFX:: ; 152d - dbw $0b, SFX_DEX_FANFARE_50_79 - dbw $12, SFX_FANFARE - dbw $0e, SFX_DEX_FANFARE_20_49 - dbw $0f, SFX_ITEM - dbw $10, SFX_CAUGHT_MON - dbw $11, SFX_DEX_FANFARE_80_109 - dbw $13, SFX_SLOT_MACHINE_START + dbw TX_SOUND_0B, SFX_DEX_FANFARE_50_79 + dbw TX_SOUND_12, SFX_FANFARE + dbw TX_SOUND_0E, SFX_DEX_FANFARE_20_49 + dbw TX_SOUND_0F, SFX_ITEM + dbw TX_SOUND_10, SFX_CAUGHT_MON + dbw TX_SOUND_11, SFX_DEX_FANFARE_80_109 + dbw TX_SOUND_13, SFX_SLOT_MACHINE_START db -1 ; 1543 @@ -1122,11 +1122,11 @@ Text_TX_STRINGBUFFER:: ; 156a push hl ld e, a ld d, 0 - ld hl, Unknown_24000 + ld hl, StringBufferPointers rept 2 add hl, de endr - ld a, BANK(Unknown_24000) + ld a, BANK(StringBufferPointers) call GetFarHalfword ld d, h ld e, l diff --git a/home/tilemap.asm b/home/tilemap.asm index d6a8f31b1..928c6a983 100644 --- a/home/tilemap.asm +++ b/home/tilemap.asm @@ -175,7 +175,7 @@ Function1cc6:: ; 1cc6 Function1ce1:: ; 1ce1 call GetMemTileCoord - ld bc, $0015 + lb bc, 0, 21 add hl, bc call GetMenuBoxDims dec b |