opentext and breeding
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
Function16e1d: ; 16e1d
|
||||
call Function16ed6
|
||||
CheckBreedmonCompatibility: ; 16e1d
|
||||
call .CheckBreedingGroupCompatibility
|
||||
ld c, $0
|
||||
jp nc, .asm_16eb7
|
||||
jp nc, .done
|
||||
ld a, [wBreedMon1Species]
|
||||
ld [CurPartySpecies], a
|
||||
ld a, [wBreedMon1DVs]
|
||||
@@ -11,12 +11,12 @@ Function16e1d: ; 16e1d
|
||||
ld a, $3
|
||||
ld [MonType], a
|
||||
predef GetGender
|
||||
jr c, .asm_16e70
|
||||
jr c, .genderless
|
||||
ld b, $1
|
||||
jr nz, .asm_16e48
|
||||
jr nz, .breedmon2
|
||||
inc b
|
||||
|
||||
.asm_16e48
|
||||
.breedmon2
|
||||
push bc
|
||||
ld a, [wBreedMon2Species]
|
||||
ld [CurPartySpecies], a
|
||||
@@ -28,96 +28,105 @@ Function16e1d: ; 16e1d
|
||||
ld [MonType], a
|
||||
predef GetGender
|
||||
pop bc
|
||||
jr c, .asm_16e70
|
||||
jr c, .genderless
|
||||
ld a, $1
|
||||
jr nz, .asm_16e6d
|
||||
jr nz, .compare_gender
|
||||
inc a
|
||||
|
||||
.asm_16e6d
|
||||
.compare_gender
|
||||
cp b
|
||||
jr nz, .asm_16e89
|
||||
jr nz, .compute
|
||||
|
||||
.asm_16e70
|
||||
.genderless
|
||||
ld c, $0
|
||||
ld a, [wBreedMon1Species]
|
||||
cp DITTO
|
||||
jr z, .asm_16e82
|
||||
jr z, .ditto1
|
||||
ld a, [wBreedMon2Species]
|
||||
cp DITTO
|
||||
jr nz, .asm_16eb7
|
||||
jr .asm_16e89
|
||||
jr nz, .done
|
||||
jr .compute
|
||||
|
||||
.asm_16e82
|
||||
.ditto1
|
||||
ld a, [wBreedMon2Species]
|
||||
cp DITTO
|
||||
jr z, .asm_16eb7
|
||||
jr z, .done
|
||||
|
||||
.asm_16e89
|
||||
call Function16ebc
|
||||
ld c, $ff
|
||||
jp z, .asm_16eb7
|
||||
.compute
|
||||
call .CheckDVs
|
||||
ld c, 255
|
||||
jp z, .done
|
||||
ld a, [wBreedMon2Species]
|
||||
ld b, a
|
||||
ld a, [wBreedMon1Species]
|
||||
cp b
|
||||
ld c, $fe
|
||||
jr z, .asm_16e9f
|
||||
ld c, $80
|
||||
.asm_16e9f
|
||||
ld c, 254
|
||||
jr z, .compare_ids
|
||||
ld c, 128
|
||||
.compare_ids
|
||||
; Speed up
|
||||
ld a, [wBreedMon1ID]
|
||||
ld b, a
|
||||
ld a, [wBreedMon2ID]
|
||||
cp b
|
||||
jr nz, .asm_16eb7
|
||||
jr nz, .done
|
||||
ld a, [wBreedMon1ID + 1]
|
||||
ld b, a
|
||||
ld a, [wBreedMon2ID + 1]
|
||||
cp b
|
||||
jr nz, .asm_16eb7
|
||||
jr nz, .done
|
||||
ld a, c
|
||||
sub $4d
|
||||
sub 77
|
||||
ld c, a
|
||||
|
||||
.asm_16eb7
|
||||
.done
|
||||
ld a, c
|
||||
ld [wd265], a
|
||||
ret
|
||||
; 16ebc
|
||||
|
||||
|
||||
Function16ebc: ; 16ebc (5:6ebc)
|
||||
.CheckDVs: ; 16ebc (5:6ebc)
|
||||
; If Defense DVs match and the lower 3 bits of the Special DVs match,
|
||||
; maximize the chances of spawning an egg regardless of species.
|
||||
ld a, [wBreedMon1DVs]
|
||||
and $f
|
||||
and %1111
|
||||
ld b, a
|
||||
ld a, [wBreedMon2DVs]
|
||||
and $f
|
||||
and %1111
|
||||
cp b
|
||||
ret nz
|
||||
ld a, [wBreedMon1DVs + 1]
|
||||
and $7
|
||||
and %111
|
||||
ld b, a
|
||||
ld a, [wBreedMon2DVs + 1]
|
||||
and $7
|
||||
and %111
|
||||
cp b
|
||||
ret
|
||||
; 16ed6
|
||||
|
||||
Function16ed6: ; 16ed6
|
||||
.CheckBreedingGroupCompatibility: ; 16ed6
|
||||
; If either mon is in the No Eggs group,
|
||||
; they are not compatible.
|
||||
ld a, [wBreedMon2Species]
|
||||
ld [CurSpecies], a
|
||||
call GetBaseData
|
||||
ld a, [BaseEggGroups]
|
||||
cp $ff
|
||||
jr z, .asm_16f3a
|
||||
cp NO_EGGS * $11
|
||||
jr z, .Incompatible
|
||||
|
||||
ld a, [wBreedMon1Species]
|
||||
ld [CurSpecies], a
|
||||
call GetBaseData
|
||||
ld a, [BaseEggGroups]
|
||||
cp $ff
|
||||
jr z, .asm_16f3a
|
||||
cp NO_EGGS * $11
|
||||
jr z, .Incompatible
|
||||
|
||||
; Ditto is automatically compatible with everything.
|
||||
; If not Ditto, load the breeding groups into b/c and d/e.
|
||||
ld a, [wBreedMon2Species]
|
||||
cp DITTO
|
||||
jr z, .asm_16f3c
|
||||
jr z, .Compatible
|
||||
ld [CurSpecies], a
|
||||
call GetBaseData
|
||||
ld a, [BaseEggGroups]
|
||||
@@ -128,9 +137,10 @@ Function16ed6: ; 16ed6
|
||||
and $f0
|
||||
swap a
|
||||
ld c, a
|
||||
|
||||
ld a, [wBreedMon1Species]
|
||||
cp DITTO
|
||||
jr z, .asm_16f3c
|
||||
jr z, .Compatible
|
||||
ld [CurSpecies], a
|
||||
push bc
|
||||
call GetBaseData
|
||||
@@ -143,22 +153,24 @@ Function16ed6: ; 16ed6
|
||||
and $f0
|
||||
swap a
|
||||
ld e, a
|
||||
|
||||
ld a, d
|
||||
cp b
|
||||
jr z, .asm_16f3c
|
||||
jr z, .Compatible
|
||||
cp c
|
||||
jr z, .asm_16f3c
|
||||
jr z, .Compatible
|
||||
|
||||
ld a, e
|
||||
cp b
|
||||
jr z, .asm_16f3c
|
||||
jr z, .Compatible
|
||||
cp c
|
||||
jr z, .asm_16f3c
|
||||
jr z, .Compatible
|
||||
|
||||
.asm_16f3a
|
||||
.Incompatible
|
||||
and a
|
||||
ret
|
||||
|
||||
.asm_16f3c
|
||||
.Compatible
|
||||
scf
|
||||
ret
|
||||
; 16f3e
|
||||
@@ -448,7 +460,7 @@ endr
|
||||
jr .loop
|
||||
|
||||
.reached_end
|
||||
call Function1720b
|
||||
call GetBreedmonMovePointer
|
||||
ld b, NUM_MOVES
|
||||
.loop2
|
||||
ld a, [de]
|
||||
@@ -613,7 +625,7 @@ GetHeritableMoves: ; 17197
|
||||
ret
|
||||
; 1720b
|
||||
|
||||
Function1720b: ; 1720b
|
||||
GetBreedmonMovePointer: ; 1720b
|
||||
ld hl, wBreedMon1Moves
|
||||
ld a, [wBreedMon1Species]
|
||||
cp DITTO
|
||||
@@ -631,7 +643,7 @@ Function1720b: ; 1720b
|
||||
; 17224
|
||||
|
||||
|
||||
Function17224: ; 17224 (5:7224)
|
||||
GetEggFrontpic: ; 17224 (5:7224)
|
||||
push de
|
||||
ld [CurPartySpecies], a
|
||||
ld [CurSpecies], a
|
||||
@@ -641,7 +653,7 @@ Function17224: ; 17224 (5:7224)
|
||||
pop de
|
||||
predef_jump GetFrontpic
|
||||
|
||||
Function1723c: ; 1723c (5:723c)
|
||||
GetHatchlingFrontpic: ; 1723c (5:723c)
|
||||
push de
|
||||
ld [CurPartySpecies], a
|
||||
ld [CurSpecies], a
|
||||
@@ -701,10 +713,10 @@ EggHatch_AnimationSequence: ; 1728f (5:728f)
|
||||
callba ClearSpriteAnims
|
||||
ld de, VTiles2 tile $00
|
||||
ld a, [wJumptableIndex]
|
||||
call Function1723c
|
||||
call GetHatchlingFrontpic
|
||||
ld de, VTiles2 tile $31
|
||||
ld a, EGG
|
||||
call Function17224
|
||||
call GetEggFrontpic
|
||||
ld de, MUSIC_EVOLUTION
|
||||
call PlayMusic
|
||||
call EnableLCD
|
||||
@@ -915,7 +927,7 @@ Function1746c: ; 1746c
|
||||
ld de, StringBuffer1
|
||||
ld bc, NAME_LENGTH
|
||||
call CopyBytes
|
||||
call Function16e1d
|
||||
call CheckBreedmonCompatibility
|
||||
pop bc
|
||||
ld a, [wd265]
|
||||
ld hl, UnknownText_0x1749c
|
||||
|
@@ -137,7 +137,7 @@ Function8ade: ; 8ade SGB layout $fc
|
||||
.asm_8af7
|
||||
push de
|
||||
ld hl, wcda9 + 10
|
||||
ld bc, $0006
|
||||
ld bc, $6
|
||||
ld a, [wcda9]
|
||||
call AddNTimes
|
||||
pop de
|
||||
@@ -150,13 +150,13 @@ Function8b07: ; 8b07
|
||||
ret z
|
||||
ld hl, Palette8b2f
|
||||
ld de, UnknBGPals
|
||||
ld bc, $0008
|
||||
ld bc, 1 palettes
|
||||
ld a, $5
|
||||
call FarCopyWRAM
|
||||
|
||||
ld hl, Palette8b37
|
||||
ld de, MartPointer
|
||||
ld bc, $0008
|
||||
ld bc, 1 palettes
|
||||
ld a, $5
|
||||
call FarCopyWRAM
|
||||
|
||||
@@ -171,6 +171,7 @@ Palette8b2f: ; 8b2f
|
||||
RGB 18, 23, 31
|
||||
RGB 15, 20, 31
|
||||
RGB 00, 00, 00
|
||||
|
||||
; 8b37
|
||||
|
||||
Palette8b37: ; 8b37
|
||||
@@ -178,6 +179,7 @@ Palette8b37: ; 8b37
|
||||
RGB 31, 31, 12
|
||||
RGB 08, 16, 28
|
||||
RGB 00, 00, 00
|
||||
|
||||
; 8b3f
|
||||
|
||||
Function8b3f: ; 8b3f
|
||||
@@ -276,7 +278,7 @@ endr
|
||||
asm_8bd7
|
||||
push hl
|
||||
ld hl, UnknBGPals
|
||||
ld de, $0008
|
||||
ld de, $8
|
||||
.asm_8bde
|
||||
and a
|
||||
jr z, .asm_8be5
|
||||
@@ -304,7 +306,7 @@ Function8bec: ; 8bec
|
||||
ld c, a
|
||||
ld a, [EnemyReflectCount]
|
||||
hlcoord 0, 0, AttrMap
|
||||
ld de, $0014
|
||||
ld de, $14
|
||||
.asm_8c04
|
||||
and a
|
||||
jr z, .asm_8c0b
|
||||
@@ -357,11 +359,11 @@ Function8c43: ; 8c43
|
||||
ret
|
||||
|
||||
.asm_8c52
|
||||
ld de, BGPals + $10 + 2
|
||||
ld de, BGPals + 2 palettes + 2
|
||||
jr .asm_8c5a
|
||||
|
||||
.asm_8c57
|
||||
ld de, BGPals + $18 + 2
|
||||
ld de, BGPals + 3 palettes + 2
|
||||
|
||||
.asm_8c5a
|
||||
ld l, c
|
||||
@@ -371,7 +373,7 @@ rept 2
|
||||
endr
|
||||
ld bc, Palettes_a8be
|
||||
add hl, bc
|
||||
ld bc, $0004
|
||||
ld bc, $4
|
||||
ld a, $5
|
||||
call FarCopyWRAM
|
||||
ld a, $1
|
||||
@@ -382,7 +384,7 @@ endr
|
||||
ld e, c
|
||||
inc e
|
||||
hlcoord 11, 1, AttrMap
|
||||
ld bc, $0028
|
||||
ld bc, $28
|
||||
ld a, [CurPartyMon]
|
||||
.asm_8c7b
|
||||
and a
|
||||
@@ -459,7 +461,7 @@ endr
|
||||
|
||||
.asm_8cf0
|
||||
ld de, UnknBGPals
|
||||
ld bc, $0008
|
||||
ld bc, 1 palettes
|
||||
ld a, $5
|
||||
call FarCopyWRAM
|
||||
call Function96a4
|
||||
@@ -518,6 +520,7 @@ Palettes_8d05: ; 8d05
|
||||
RGB 31, 31, 00
|
||||
RGB 00, 21, 00
|
||||
RGB 00, 00, 00
|
||||
|
||||
; 8d55
|
||||
|
||||
INCLUDE "predef/cgb.asm"
|
||||
@@ -540,6 +543,7 @@ Palette_9608: ; 9608
|
||||
RGB 09, 31, 31
|
||||
RGB 10, 12, 31
|
||||
RGB 00, 03, 19
|
||||
|
||||
; 9610
|
||||
|
||||
|
||||
@@ -678,7 +682,7 @@ Function9699: ; 9699
|
||||
Function96a4: ; 96a4
|
||||
ld hl, UnknBGPals
|
||||
ld de, BGPals
|
||||
ld bc, $0080
|
||||
ld bc, 16 palettes
|
||||
ld a, $5
|
||||
call FarCopyWRAM
|
||||
ret
|
||||
@@ -740,7 +744,7 @@ Function96f3: ; 96f3 CGB layout $fc
|
||||
inc a
|
||||
ld e, a
|
||||
hlcoord 11, 2, AttrMap
|
||||
ld bc, $0028
|
||||
ld bc, $28
|
||||
ld a, [wcda9]
|
||||
.asm_970b
|
||||
and a
|
||||
@@ -760,7 +764,7 @@ Function96f3: ; 96f3 CGB layout $fc
|
||||
Function971a: ; 971a
|
||||
ld hl, Palettes_b681
|
||||
ld de, UnknOBPals
|
||||
ld bc, $0010
|
||||
ld bc, 2 palettes
|
||||
ld a, $5
|
||||
call FarCopyWRAM
|
||||
ret
|
||||
@@ -844,7 +848,7 @@ Function977a: ; 977a
|
||||
jr nz, .asm_9787
|
||||
ld hl, Palettes_979c
|
||||
ld de, UnknOBPals + 8 * 2
|
||||
ld bc, $0010
|
||||
ld bc, 2 palettes
|
||||
ld a, $5
|
||||
call FarCopyWRAM
|
||||
ret
|
||||
@@ -855,26 +859,32 @@ Palettes_979c: ; 979c
|
||||
RGB 25, 25, 25
|
||||
RGB 13, 13, 13
|
||||
RGB 00, 00, 00
|
||||
|
||||
RGB 31, 31, 31
|
||||
RGB 31, 31, 07
|
||||
RGB 31, 16, 01
|
||||
RGB 00, 00, 00
|
||||
|
||||
RGB 31, 31, 31
|
||||
RGB 31, 19, 24
|
||||
RGB 30, 10, 06
|
||||
RGB 00, 00, 00
|
||||
|
||||
RGB 31, 31, 31
|
||||
RGB 12, 25, 01
|
||||
RGB 05, 14, 00
|
||||
RGB 00, 00, 00
|
||||
|
||||
RGB 31, 31, 31
|
||||
RGB 08, 12, 31
|
||||
RGB 01, 04, 31
|
||||
RGB 00, 00, 00
|
||||
|
||||
RGB 31, 31, 31
|
||||
RGB 24, 18, 07
|
||||
RGB 20, 15, 03
|
||||
RGB 00, 00, 00
|
||||
|
||||
; 97cc
|
||||
|
||||
Function97cc: ; 97cc
|
||||
@@ -1217,20 +1227,20 @@ Function99d8: ; 99d8
|
||||
ld b, $12
|
||||
.asm_99ea
|
||||
push bc
|
||||
ld bc, $000c
|
||||
ld bc, $c
|
||||
call CopyData
|
||||
ld bc, $0028
|
||||
ld bc, $28
|
||||
call ClearBytes
|
||||
ld bc, $000c
|
||||
ld bc, $c
|
||||
call CopyData
|
||||
pop bc
|
||||
dec b
|
||||
jr nz, .asm_99ea
|
||||
ld bc, $0140
|
||||
ld bc, $140
|
||||
call CopyData
|
||||
ld bc, Start
|
||||
call ClearBytes
|
||||
ld bc, $0080
|
||||
ld bc, 16 palettes
|
||||
call CopyData
|
||||
call DrawDefaultTiles
|
||||
ld a, $e3
|
||||
@@ -1250,9 +1260,9 @@ Function9a24: ; 9a24
|
||||
ld b, $80
|
||||
.asm_9a30
|
||||
push bc
|
||||
ld bc, $0010
|
||||
ld bc, 2 palettes
|
||||
call CopyData
|
||||
ld bc, $0010
|
||||
ld bc, 2 palettes
|
||||
call ClearBytes
|
||||
pop bc
|
||||
dec b
|
||||
@@ -1803,6 +1813,7 @@ Palettes_9df6: ; 9df6
|
||||
RGB 08, 11, 11
|
||||
RGB 21, 21, 21
|
||||
RGB 31, 31, 31
|
||||
|
||||
; a06e
|
||||
|
||||
SGBBorderMap: ; a06e
|
||||
@@ -1916,6 +1927,7 @@ SGBBorderPalettes: ; a49e
|
||||
RGB 31, 31, 25
|
||||
RGB 31, 31, 25
|
||||
RGB 31, 31, 25
|
||||
|
||||
; a51e
|
||||
|
||||
SGBBorder: ; a51e
|
||||
@@ -2085,6 +2097,7 @@ Palette_b309: ; b309
|
||||
RGB 31, 19, 24
|
||||
RGB 30, 10, 06
|
||||
RGB 00, 00, 00
|
||||
|
||||
; b311
|
||||
|
||||
Palette_b311: ; b311
|
||||
@@ -2092,6 +2105,7 @@ Palette_b311: ; b311
|
||||
RGB 17, 19, 31
|
||||
RGB 14, 16, 31
|
||||
RGB 00, 00, 00
|
||||
|
||||
; b319
|
||||
|
||||
TilesetBGPalette: ; b319
|
||||
@@ -2143,6 +2157,7 @@ Palettes_b641: ; b641
|
||||
RGB 11, 11, 19
|
||||
RGB 07, 07, 12
|
||||
RGB 00, 00, 00
|
||||
|
||||
; b681
|
||||
|
||||
Palettes_b681: ; b681
|
||||
@@ -2216,6 +2231,7 @@ Palettes_b681: ; b681
|
||||
RGB 20, 15, 03
|
||||
RGB 07, 07, 07
|
||||
|
||||
|
||||
Palettes_b6f1: ; b6f1
|
||||
RGB 31, 31, 31
|
||||
RGB 18, 23, 31
|
||||
@@ -2242,6 +2258,7 @@ Palettes_b6f1: ; b6f1
|
||||
RGB 18, 23, 31
|
||||
RGB 00, 00, 00
|
||||
|
||||
|
||||
Palettes_b719: ; b719
|
||||
RGB 31, 31, 31
|
||||
RGB 07, 06, 03
|
||||
@@ -2252,6 +2269,7 @@ Palettes_b719: ; b719
|
||||
RGB 31, 31, 00
|
||||
RGB 26, 22, 00
|
||||
RGB 00, 00, 00
|
||||
|
||||
; b729
|
||||
|
||||
Palettes_b729: ; b729
|
||||
@@ -2284,6 +2302,7 @@ Palettes_b729: ; b729
|
||||
RGB 00, 31, 00
|
||||
RGB 15, 07, 00
|
||||
RGB 31, 00, 00
|
||||
|
||||
; b759
|
||||
|
||||
Palettes_b759: ; b759
|
||||
@@ -2316,6 +2335,7 @@ Palettes_b759: ; b759
|
||||
RGB 00, 31, 00
|
||||
RGB 15, 07, 00
|
||||
RGB 31, 00, 00
|
||||
|
||||
; b789
|
||||
|
||||
Palettes_b789: ; b789
|
||||
@@ -2338,6 +2358,7 @@ Palettes_b789: ; b789
|
||||
RGB 29, 26, 05
|
||||
RGB 18, 18, 18
|
||||
RGB 00, 00, 00
|
||||
|
||||
; b7a9
|
||||
|
||||
Palettes_b7a9: ; b7a9
|
||||
@@ -2420,4 +2441,5 @@ Palettes_b7a9: ; b7a9
|
||||
RGB 31, 31, 31
|
||||
RGB 00, 00, 00
|
||||
RGB 00, 00, 00
|
||||
|
||||
; b829
|
||||
|
@@ -1244,7 +1244,7 @@ DecorationDesc_PosterPointers: ; 26f84
|
||||
; 26f91
|
||||
|
||||
DecorationDesc_TownMapPoster: ; 0x26f91
|
||||
loadfont
|
||||
opentext
|
||||
writetext .TownMapText
|
||||
waitbutton
|
||||
special Special_TownMap
|
||||
|
@@ -1,6 +1,6 @@
|
||||
FruitTreeScript:: ; 44000
|
||||
callasm GetCurTreeFruit
|
||||
loadfont
|
||||
opentext
|
||||
copybytetovar CurFruit
|
||||
itemtotext $0, $0
|
||||
writetext FruitBearingTreeText
|
||||
|
572
engine/npc_movement.asm
Executable file
572
engine/npc_movement.asm
Executable file
@@ -0,0 +1,572 @@
|
||||
Function6ec1: ; 6ec1
|
||||
|
||||
ld hl, OBJECT_PALETTE
|
||||
add hl, bc
|
||||
bit 5, [hl]
|
||||
jr z, .not_bit_5
|
||||
|
||||
ld hl, OBJECT_FLAGS1
|
||||
add hl, bc
|
||||
bit 4, [hl] ; lost
|
||||
push hl
|
||||
push bc
|
||||
call Function6f2c
|
||||
pop bc
|
||||
pop hl
|
||||
ret c
|
||||
jr .resume
|
||||
|
||||
.not_bit_5
|
||||
ld hl, OBJECT_FLAGS1
|
||||
add hl, bc
|
||||
bit 4, [hl]
|
||||
jr nz, .resume
|
||||
push hl
|
||||
push bc
|
||||
call Function6f07
|
||||
pop bc
|
||||
pop hl
|
||||
ret c
|
||||
|
||||
.resume
|
||||
bit 6, [hl]
|
||||
jr nz, .bit_6
|
||||
|
||||
push hl
|
||||
push bc
|
||||
call WillPersonBumpIntoSomeoneElse
|
||||
pop bc
|
||||
pop hl
|
||||
ret c
|
||||
|
||||
.bit_6
|
||||
bit 5, [hl]
|
||||
jr nz, .bit_5
|
||||
push hl
|
||||
call HasPersonReachedMovementLimit
|
||||
pop hl
|
||||
ret c
|
||||
|
||||
push hl
|
||||
call IsPersonMovingOffEdgeOfScreen
|
||||
pop hl
|
||||
ret c
|
||||
|
||||
.bit_5
|
||||
and a
|
||||
ret
|
||||
; 6f07
|
||||
|
||||
|
||||
Function6f07: ; 6f07
|
||||
call Function6f5f
|
||||
ret c
|
||||
ld hl, OBJECT_NEXT_MAP_X
|
||||
add hl, bc
|
||||
ld d, [hl]
|
||||
ld hl, OBJECT_NEXT_MAP_Y
|
||||
add hl, bc
|
||||
ld e, [hl]
|
||||
ld hl, OBJECT_PALETTE
|
||||
add hl, bc
|
||||
bit 7, [hl]
|
||||
jp nz, Function6fa1
|
||||
ld hl, OBJECT_NEXT_TILE
|
||||
add hl, bc
|
||||
ld a, [hl]
|
||||
ld d, a
|
||||
call GetTileCollision
|
||||
and a
|
||||
jr z, Function6f3e
|
||||
scf
|
||||
ret
|
||||
; 6f2c
|
||||
|
||||
Function6f2c: ; 6f2c
|
||||
call Function6f5f
|
||||
ret c
|
||||
ld hl, OBJECT_NEXT_TILE
|
||||
add hl, bc
|
||||
ld a, [hl]
|
||||
call GetTileCollision
|
||||
cp $1
|
||||
jr z, Function6f3e
|
||||
scf
|
||||
ret
|
||||
; 6f3e
|
||||
|
||||
Function6f3e: ; 6f3e
|
||||
ld hl, OBJECT_NEXT_TILE
|
||||
add hl, bc
|
||||
ld a, [hl]
|
||||
call Function6f7f
|
||||
ret nc
|
||||
push af
|
||||
ld hl, OBJECT_DIRECTION_WALKING
|
||||
add hl, bc
|
||||
ld a, [hl]
|
||||
and 3
|
||||
ld e, a
|
||||
ld d, 0
|
||||
ld hl, .data_6f5b
|
||||
add hl, de
|
||||
pop af
|
||||
and [hl]
|
||||
ret z
|
||||
scf
|
||||
ret
|
||||
; 6f5b
|
||||
|
||||
.data_6f5b
|
||||
db 1 << DOWN, 1 << UP, 1 << RIGHT, 1 << LEFT
|
||||
; 6f5f
|
||||
|
||||
Function6f5f: ; 6f5f
|
||||
ld hl, OBJECT_STANDING_TILE
|
||||
add hl, bc
|
||||
ld a, [hl]
|
||||
call Function6f7f
|
||||
ret nc
|
||||
push af
|
||||
ld hl, OBJECT_DIRECTION_WALKING
|
||||
add hl, bc
|
||||
and 3
|
||||
ld e, a
|
||||
ld d, 0
|
||||
ld hl, .data_6f7b
|
||||
add hl, de
|
||||
pop af
|
||||
and [hl]
|
||||
ret z
|
||||
scf
|
||||
ret
|
||||
; 6f7b
|
||||
|
||||
.data_6f7b
|
||||
db 1 << UP, 1 << DOWN, 1 << LEFT, 1 << RIGHT
|
||||
; 6f7f
|
||||
|
||||
Function6f7f: ; 6f7f
|
||||
ld d, a
|
||||
and $f0
|
||||
cp $b0
|
||||
jr z, .done
|
||||
cp $c0
|
||||
jr z, .done
|
||||
xor a
|
||||
ret
|
||||
|
||||
.done
|
||||
ld a, d
|
||||
and 7
|
||||
ld e, a
|
||||
ld d, 0
|
||||
ld hl, .data_6f99
|
||||
add hl, de
|
||||
ld a, [hl]
|
||||
scf
|
||||
ret
|
||||
; 6f99
|
||||
|
||||
.data_6f99
|
||||
db 8, 4, 1, 2
|
||||
db 10, 6, 9, 5
|
||||
; 6fa1
|
||||
|
||||
Function6fa1: ; 6fa1
|
||||
ld hl, OBJECT_DIRECTION_WALKING
|
||||
add hl, bc
|
||||
ld a, [hl]
|
||||
and 3
|
||||
jr z, .asm_6fb2
|
||||
dec a
|
||||
jr z, .asm_6fb7
|
||||
dec a
|
||||
jr z, .asm_6fbb
|
||||
jr .asm_6fbf
|
||||
|
||||
.asm_6fb2
|
||||
inc e
|
||||
push de
|
||||
inc d
|
||||
jr .asm_6fc2
|
||||
|
||||
.asm_6fb7
|
||||
push de
|
||||
inc d
|
||||
jr .asm_6fc2
|
||||
|
||||
.asm_6fbb
|
||||
push de
|
||||
inc e
|
||||
jr .asm_6fc2
|
||||
|
||||
.asm_6fbf
|
||||
inc d
|
||||
push de
|
||||
inc e
|
||||
|
||||
.asm_6fc2
|
||||
call GetCoordTile
|
||||
call GetTileCollision
|
||||
pop de
|
||||
and a
|
||||
jr nz, .asm_6fd7
|
||||
call GetCoordTile
|
||||
call GetTileCollision
|
||||
and a
|
||||
jr nz, .asm_6fd7
|
||||
xor a
|
||||
ret
|
||||
|
||||
.asm_6fd7
|
||||
scf
|
||||
ret
|
||||
; 6fd9
|
||||
|
||||
|
||||
|
||||
CheckFacingObject:: ; 6fd9
|
||||
|
||||
call GetFacingTileCoord
|
||||
|
||||
; Double the distance for counter tiles.
|
||||
call CheckCounterTile
|
||||
jr nz, .asm_6ff1
|
||||
|
||||
ld a, [PlayerNextMapX]
|
||||
sub d
|
||||
cpl
|
||||
inc a
|
||||
add d
|
||||
ld d, a
|
||||
|
||||
ld a, [PlayerNextMapY]
|
||||
sub e
|
||||
cpl
|
||||
inc a
|
||||
add e
|
||||
ld e, a
|
||||
|
||||
.asm_6ff1
|
||||
ld bc, ObjectStructs ; redundant
|
||||
ld a, 0
|
||||
ld [hMapObjectIndexBuffer], a
|
||||
call IsNPCAtCoord
|
||||
ret nc
|
||||
ld hl, OBJECT_DIRECTION_WALKING
|
||||
add hl, bc
|
||||
ld a, [hl]
|
||||
cp STANDING
|
||||
jr z, .standing
|
||||
xor a
|
||||
ret
|
||||
|
||||
.standing
|
||||
scf
|
||||
ret
|
||||
; 7009
|
||||
|
||||
|
||||
WillPersonBumpIntoSomeoneElse: ; 7009
|
||||
ld hl, OBJECT_NEXT_MAP_X
|
||||
add hl, bc
|
||||
ld d, [hl]
|
||||
ld hl, OBJECT_NEXT_MAP_Y
|
||||
add hl, bc
|
||||
ld e, [hl]
|
||||
jr IsNPCAtCoord
|
||||
; 7015
|
||||
|
||||
Function7015: ; unreferenced
|
||||
ld a, [hMapObjectIndexBuffer]
|
||||
call GetObjectStruct
|
||||
call .CheckWillBeFacingNPC
|
||||
call IsNPCAtCoord
|
||||
ret
|
||||
|
||||
.CheckWillBeFacingNPC: ; 7021
|
||||
ld hl, OBJECT_NEXT_MAP_X
|
||||
add hl, bc
|
||||
ld d, [hl]
|
||||
ld hl, OBJECT_NEXT_MAP_Y
|
||||
add hl, bc
|
||||
ld e, [hl]
|
||||
call GetSpriteDirection
|
||||
and a
|
||||
jr z, .down
|
||||
cp OW_UP
|
||||
jr z, .up
|
||||
cp OW_LEFT
|
||||
jr z, .left
|
||||
inc d
|
||||
ret
|
||||
|
||||
.down
|
||||
inc e
|
||||
ret
|
||||
|
||||
.up
|
||||
dec e
|
||||
ret
|
||||
|
||||
.left
|
||||
dec d
|
||||
ret
|
||||
; 7041
|
||||
|
||||
IsNPCAtCoord: ; 7041
|
||||
ld bc, ObjectStructs
|
||||
xor a
|
||||
.loop
|
||||
ld [hObjectStructIndexBuffer], a
|
||||
call GetObjectSprite
|
||||
jr z, .next
|
||||
|
||||
ld hl, OBJECT_FLAGS1
|
||||
add hl, bc
|
||||
bit 7, [hl]
|
||||
jr nz, .next
|
||||
|
||||
ld hl, OBJECT_PALETTE
|
||||
add hl, bc
|
||||
bit 7, [hl]
|
||||
jr z, .got
|
||||
|
||||
call Function7171
|
||||
jr nc, .ok
|
||||
jr .ok2
|
||||
|
||||
.got
|
||||
ld hl, OBJECT_NEXT_MAP_X
|
||||
add hl, bc
|
||||
ld a, [hl]
|
||||
cp d
|
||||
jr nz, .ok
|
||||
ld hl, OBJECT_NEXT_MAP_Y
|
||||
add hl, bc
|
||||
ld a, [hl]
|
||||
cp e
|
||||
jr nz, .ok
|
||||
|
||||
.ok2
|
||||
ld a, [hMapObjectIndexBuffer]
|
||||
ld l, a
|
||||
ld a, [hObjectStructIndexBuffer]
|
||||
cp l
|
||||
jr nz, .setcarry
|
||||
|
||||
.ok
|
||||
ld hl, OBJECT_MAP_X
|
||||
add hl, bc
|
||||
ld a, [hl]
|
||||
cp d
|
||||
jr nz, .next
|
||||
ld hl, OBJECT_MAP_Y
|
||||
add hl, bc
|
||||
ld a, [hl]
|
||||
cp e
|
||||
jr nz, .next
|
||||
ld a, [hMapObjectIndexBuffer]
|
||||
ld l, a
|
||||
ld a, [hObjectStructIndexBuffer]
|
||||
cp l
|
||||
jr nz, .setcarry
|
||||
|
||||
.next
|
||||
ld hl, OBJECT_STRUCT_LENGTH
|
||||
add hl, bc
|
||||
ld b, h
|
||||
ld c, l
|
||||
ld a, [hObjectStructIndexBuffer]
|
||||
inc a
|
||||
cp NUM_OBJECT_STRUCTS
|
||||
jr nz, .loop
|
||||
and a
|
||||
ret
|
||||
|
||||
.setcarry
|
||||
scf
|
||||
ret
|
||||
; 70a4
|
||||
|
||||
HasPersonReachedMovementLimit: ; 70a4
|
||||
ld hl, OBJECT_RADIUS
|
||||
add hl, bc
|
||||
ld a, [hl]
|
||||
and a
|
||||
jr z, .nope
|
||||
and $f
|
||||
jr z, .check_y
|
||||
ld e, a
|
||||
ld d, a
|
||||
ld hl, OBJECT_INIT_X
|
||||
add hl, bc
|
||||
ld a, [hl]
|
||||
sub d
|
||||
ld d, a
|
||||
ld a, [hl]
|
||||
add e
|
||||
ld e, a
|
||||
ld hl, OBJECT_NEXT_MAP_X
|
||||
add hl, bc
|
||||
ld a, [hl]
|
||||
cp d
|
||||
jr z, .yes
|
||||
cp e
|
||||
jr z, .yes
|
||||
|
||||
.check_y
|
||||
ld hl, OBJECT_RADIUS
|
||||
add hl, bc
|
||||
ld a, [hl]
|
||||
swap a
|
||||
and $f
|
||||
jr z, .nope
|
||||
ld e, a
|
||||
ld d, a
|
||||
ld hl, OBJECT_INIT_Y
|
||||
add hl, bc
|
||||
ld a, [hl]
|
||||
sub d
|
||||
ld d, a
|
||||
ld a, [hl]
|
||||
add e
|
||||
ld e, a
|
||||
ld hl, OBJECT_NEXT_MAP_Y
|
||||
add hl, bc
|
||||
ld a, [hl]
|
||||
cp d
|
||||
jr z, .yes
|
||||
cp e
|
||||
jr z, .yes
|
||||
|
||||
.nope
|
||||
xor a
|
||||
ret
|
||||
|
||||
.yes
|
||||
scf
|
||||
ret
|
||||
; 70ed
|
||||
|
||||
IsPersonMovingOffEdgeOfScreen: ; 70ed
|
||||
ld hl, OBJECT_NEXT_MAP_X
|
||||
add hl, bc
|
||||
ld a, [XCoord]
|
||||
cp [hl]
|
||||
jr z, .check_y
|
||||
jr nc, .yes
|
||||
add $9
|
||||
cp [hl]
|
||||
jr c, .yes
|
||||
|
||||
.check_y
|
||||
ld hl, OBJECT_NEXT_MAP_Y
|
||||
add hl, bc
|
||||
ld a, [YCoord]
|
||||
cp [hl]
|
||||
jr z, .nope
|
||||
jr nc, .yes
|
||||
add $8
|
||||
cp [hl]
|
||||
jr c, .yes
|
||||
|
||||
.nope
|
||||
and a
|
||||
ret
|
||||
|
||||
.yes
|
||||
scf
|
||||
ret
|
||||
; 7113
|
||||
|
||||
Function7113: ; unreferenced
|
||||
ld a, [PlayerNextMapX]
|
||||
ld d, a
|
||||
ld a, [PlayerNextMapY]
|
||||
ld e, a
|
||||
ld bc, ObjectStructs
|
||||
xor a
|
||||
.loop
|
||||
ld [hObjectStructIndexBuffer], a
|
||||
call GetObjectSprite
|
||||
jr z, .next
|
||||
ld hl, OBJECT_MOVEMENTTYPE
|
||||
add hl, bc
|
||||
ld a, [hl]
|
||||
cp SPRITEMOVEDATA_SNORLAX
|
||||
jr nz, .not_snorlax
|
||||
call Function7171
|
||||
jr c, .yes
|
||||
jr .next
|
||||
|
||||
.not_snorlax
|
||||
ld hl, OBJECT_NEXT_MAP_Y
|
||||
add hl, bc
|
||||
ld a, [hl]
|
||||
cp e
|
||||
jr nz, .check_current_coords
|
||||
ld hl, OBJECT_NEXT_MAP_X
|
||||
add hl, bc
|
||||
ld a, [hl]
|
||||
cp d
|
||||
jr nz, .check_current_coords
|
||||
ld a, [hObjectStructIndexBuffer]
|
||||
cp $0
|
||||
jr z, .next
|
||||
jr .yes
|
||||
|
||||
.check_current_coords
|
||||
ld hl, OBJECT_MAP_Y
|
||||
add hl, bc
|
||||
ld a, [hl]
|
||||
cp e
|
||||
jr nz, .next
|
||||
ld hl, OBJECT_MAP_X
|
||||
add hl, bc
|
||||
ld a, [hl]
|
||||
cp d
|
||||
jr nz, .next
|
||||
jr .yes
|
||||
|
||||
.next
|
||||
ld hl, OBJECT_STRUCT_LENGTH
|
||||
add hl, bc
|
||||
ld b, h
|
||||
ld c, l
|
||||
ld a, [hObjectStructIndexBuffer]
|
||||
inc a
|
||||
cp NUM_OBJECT_STRUCTS
|
||||
jr nz, .loop
|
||||
xor a
|
||||
ret
|
||||
|
||||
.yes
|
||||
scf
|
||||
ret
|
||||
; 7171
|
||||
|
||||
|
||||
Function7171: ; 7171
|
||||
ld hl, OBJECT_NEXT_MAP_X
|
||||
add hl, bc
|
||||
ld a, d
|
||||
sub [hl]
|
||||
jr c, .nope
|
||||
cp $2
|
||||
jr nc, .nope
|
||||
ld hl, OBJECT_NEXT_MAP_Y
|
||||
add hl, bc
|
||||
ld a, e
|
||||
sub [hl]
|
||||
jr c, .nope
|
||||
cp $2
|
||||
jr nc, .nope
|
||||
scf
|
||||
ret
|
||||
|
||||
.nope
|
||||
and a
|
||||
ret
|
||||
; 718d
|
@@ -141,7 +141,7 @@ ScriptCommandTable: ; 96cb1
|
||||
dw Script_stringtotext ; 44
|
||||
dw Script_itemnotify ; 45
|
||||
dw Script_pocketisfull ; 46
|
||||
dw Script_loadfont ; 47
|
||||
dw Script_textbox ; 47
|
||||
dw Script_refreshscreen ; 48
|
||||
dw Script_closetext ; 49
|
||||
dw Script_loadbytec2cf ; 4a
|
||||
@@ -345,7 +345,7 @@ Script_jumptext: ; 96e5f
|
||||
JumpTextFacePlayerScript: ; 96e79
|
||||
faceplayer
|
||||
JumpTextScript: ; 96e7a
|
||||
loadfont
|
||||
opentext
|
||||
repeattext -1, -1
|
||||
waitbutton
|
||||
closetext
|
||||
@@ -3026,10 +3026,10 @@ Script_reloadandreturn: ; 97b16
|
||||
jp Script_end
|
||||
; 97b1c
|
||||
|
||||
Script_loadfont: ; 97b1c
|
||||
Script_textbox: ; 97b1c
|
||||
; script command 0x47
|
||||
|
||||
call LoadFont
|
||||
call OpenText
|
||||
ret
|
||||
; 97b20
|
||||
|
||||
|
@@ -5,7 +5,7 @@ SelectMenu:: ; 13327
|
||||
jp UseRegisteredItem
|
||||
|
||||
.NotRegistered
|
||||
call LoadFont
|
||||
call OpenText
|
||||
ld b, BANK(ItemMayBeRegisteredText)
|
||||
ld hl, ItemMayBeRegisteredText
|
||||
call MapTextbox
|
||||
@@ -139,7 +139,7 @@ UseRegisteredItem: ; 133c3
|
||||
; 133df
|
||||
|
||||
.NoFunction ; 133df
|
||||
call LoadFont
|
||||
call OpenText
|
||||
call CantUseItem
|
||||
call CloseText
|
||||
and a
|
||||
@@ -147,7 +147,7 @@ UseRegisteredItem: ; 133c3
|
||||
; 133ea
|
||||
|
||||
.Current ; 133ea
|
||||
call LoadFont
|
||||
call OpenText
|
||||
call DoItemEffect
|
||||
call CloseText
|
||||
and a
|
||||
|
@@ -55,7 +55,7 @@ StdScripts::
|
||||
PokeCenterNurseScript:
|
||||
; EVENT_WELCOMED_TO_POKECOM_CENTER is never set
|
||||
|
||||
loadfont
|
||||
opentext
|
||||
checkmorn
|
||||
iftrue .morn
|
||||
checkday
|
||||
@@ -181,7 +181,7 @@ MerchandiseShelfScript:
|
||||
farjumptext MerchandiseShelfText
|
||||
|
||||
TownMapScript:
|
||||
loadfont
|
||||
opentext
|
||||
farwritetext TownMapText
|
||||
waitbutton
|
||||
special Special_TownMap
|
||||
@@ -192,7 +192,7 @@ WindowScript:
|
||||
farjumptext WindowText
|
||||
|
||||
TVScript:
|
||||
loadfont
|
||||
opentext
|
||||
farwritetext TVText
|
||||
waitbutton
|
||||
closetext
|
||||
@@ -202,7 +202,7 @@ HomepageScript:
|
||||
farjumptext HomepageText
|
||||
|
||||
Radio1Script:
|
||||
loadfont
|
||||
opentext
|
||||
writebyte $0
|
||||
special MapRadio
|
||||
closetext
|
||||
@@ -210,7 +210,7 @@ Radio1Script:
|
||||
|
||||
Radio2Script:
|
||||
; Lucky Channel
|
||||
loadfont
|
||||
opentext
|
||||
writebyte $4
|
||||
special MapRadio
|
||||
closetext
|
||||
@@ -220,7 +220,7 @@ TrashCanScript: ; 0xbc1a5
|
||||
farjumptext TrashCanText
|
||||
|
||||
PCScript:
|
||||
loadfont
|
||||
opentext
|
||||
special PokemonCenterPC
|
||||
closetext
|
||||
end
|
||||
@@ -317,7 +317,7 @@ BugContestResultsScript:
|
||||
clearevent EVENT_CONTEST_OFFICER_HAS_EVERSTONE
|
||||
clearevent EVENT_CONTEST_OFFICER_HAS_GOLD_BERRY
|
||||
clearevent EVENT_CONTEST_OFFICER_HAS_BERRY
|
||||
loadfont
|
||||
opentext
|
||||
farwritetext ContestResults_ReadyToJudgeText
|
||||
waitbutton
|
||||
special BugContestJudging
|
||||
@@ -1385,7 +1385,7 @@ PackFullMScript:
|
||||
end
|
||||
|
||||
RematchGiftMScript:
|
||||
loadfont
|
||||
opentext
|
||||
checkcode VAR_CALLERID
|
||||
if_equal PHONE_SAILOR_HUEY, .Huey
|
||||
if_equal PHONE_YOUNGSTER_JOEY, .Joey
|
||||
@@ -1753,14 +1753,14 @@ RematchGiftFScript:
|
||||
if_equal PHONE_PICNICKER_ERIN, .Erin
|
||||
|
||||
.Erin
|
||||
loadfont
|
||||
opentext
|
||||
farwritetext ErinRematchGiftText
|
||||
buttonsound
|
||||
end
|
||||
|
||||
GymStatue1Script:
|
||||
mapnametotext $0
|
||||
loadfont
|
||||
opentext
|
||||
farwritetext GymStatue_CityGymText
|
||||
waitbutton
|
||||
closetext
|
||||
@@ -1768,7 +1768,7 @@ GymStatue1Script:
|
||||
|
||||
GymStatue2Script:
|
||||
mapnametotext $0
|
||||
loadfont
|
||||
opentext
|
||||
farwritetext GymStatue_CityGymText
|
||||
buttonsound
|
||||
farwritetext GymStatue_WinningTrainersText
|
||||
@@ -1794,7 +1794,7 @@ ReceiveTogepiEggScript: ; 0xbcdc3
|
||||
|
||||
GameCornerCoinVendorScript: ; 0xbcdcd
|
||||
faceplayer
|
||||
loadfont
|
||||
opentext
|
||||
farwritetext CoinVendor_WelcomeText
|
||||
buttonsound
|
||||
checkitem COIN_CASE
|
||||
@@ -1887,7 +1887,7 @@ CoinVendor_MenuData2: ; 0xbce5c
|
||||
|
||||
HappinessCheckScript:
|
||||
faceplayer
|
||||
loadfont
|
||||
opentext
|
||||
special GetFirstPokemonHappiness
|
||||
if_less_than 50, .Unhappy
|
||||
if_less_than 150, .KindaHappy
|
||||
|
Reference in New Issue
Block a user