Merge branch 'yenatch/split-predefs-specials-stds' into fix-split-predefs-specials-stds
https://github.com/kanzure/pokecrystal/pull/198
This commit is contained in:
113
common/flag.asm
Normal file
113
common/flag.asm
Normal file
@@ -0,0 +1,113 @@
|
|||||||
|
Function2e50: ; 2e50
|
||||||
|
xor a
|
||||||
|
ld hl, EventFlags
|
||||||
|
ld [hli], a
|
||||||
|
ret
|
||||||
|
; 2e56
|
||||||
|
|
||||||
|
Function2e56: ; 2e56
|
||||||
|
xor a
|
||||||
|
ld hl, BikeFlags
|
||||||
|
ld [hli], a
|
||||||
|
ld [hl], a
|
||||||
|
ret
|
||||||
|
; 2e5d
|
||||||
|
|
||||||
|
Function2e5d: ; 2e5d
|
||||||
|
ld a, [$d19a]
|
||||||
|
cp $2
|
||||||
|
jr z, .asm_2e69
|
||||||
|
cp $1
|
||||||
|
jr z, .asm_2e69
|
||||||
|
ret
|
||||||
|
|
||||||
|
.asm_2e69
|
||||||
|
ld hl, StatusFlags
|
||||||
|
res 2, [hl]
|
||||||
|
ret
|
||||||
|
; 2e6f
|
||||||
|
|
||||||
|
|
||||||
|
EventFlagAction: ; 0x2e6f
|
||||||
|
ld hl, EventFlags
|
||||||
|
call FlagAction
|
||||||
|
ret
|
||||||
|
|
||||||
|
FlagAction: ; 0x2e76
|
||||||
|
; Perform action b on bit de in flag array hl.
|
||||||
|
|
||||||
|
; inputs:
|
||||||
|
; b: function
|
||||||
|
; 0 clear bit
|
||||||
|
; 1 set bit
|
||||||
|
; 2 check bit
|
||||||
|
; de: bit number
|
||||||
|
; hl: index within bit table
|
||||||
|
|
||||||
|
; get index within the byte
|
||||||
|
ld a, e
|
||||||
|
and 7
|
||||||
|
|
||||||
|
; shift de right by three bits (get the index within memory)
|
||||||
|
srl d
|
||||||
|
rr e
|
||||||
|
srl d
|
||||||
|
rr e
|
||||||
|
srl d
|
||||||
|
rr e
|
||||||
|
add hl, de
|
||||||
|
|
||||||
|
; implement a decoder
|
||||||
|
ld c, 1
|
||||||
|
rrca
|
||||||
|
jr nc, .one
|
||||||
|
rlc c
|
||||||
|
.one
|
||||||
|
rrca
|
||||||
|
jr nc, .two
|
||||||
|
rlc c
|
||||||
|
rlc c
|
||||||
|
.two
|
||||||
|
rrca
|
||||||
|
jr nc, .three
|
||||||
|
swap c
|
||||||
|
.three
|
||||||
|
|
||||||
|
; check b's value: 0, 1, 2
|
||||||
|
ld a, b
|
||||||
|
cp 1
|
||||||
|
jr c, .clearbit ; 0
|
||||||
|
jr z, .setbit ; 1
|
||||||
|
|
||||||
|
; check bit
|
||||||
|
ld a, [hl]
|
||||||
|
and c
|
||||||
|
ld c, a
|
||||||
|
ret
|
||||||
|
|
||||||
|
.setbit
|
||||||
|
; set bit
|
||||||
|
ld a, [hl]
|
||||||
|
or c
|
||||||
|
ld [hl], a
|
||||||
|
ret
|
||||||
|
|
||||||
|
.clearbit
|
||||||
|
; clear bit
|
||||||
|
ld a, c
|
||||||
|
cpl
|
||||||
|
and [hl]
|
||||||
|
ld [hl], a
|
||||||
|
ret
|
||||||
|
; 0x2ead
|
||||||
|
|
||||||
|
|
||||||
|
Function2ead: ; 2ead
|
||||||
|
ld de, ENGINE_POKEDEX
|
||||||
|
ld b, CHECK_FLAG
|
||||||
|
callba EngineFlagAction
|
||||||
|
ld a, c
|
||||||
|
and a
|
||||||
|
ret
|
||||||
|
; 2ebb
|
||||||
|
|
@@ -101,8 +101,8 @@ Joypad: ; 935
|
|||||||
; Now that we have the input, we can do stuff with it.
|
; Now that we have the input, we can do stuff with it.
|
||||||
|
|
||||||
; For example, soft reset:
|
; For example, soft reset:
|
||||||
and BUTTON_A | BUTTON_B | SELECT | START
|
and A_BUTTON | B_BUTTON | SELECT | START
|
||||||
cp BUTTON_A | BUTTON_B | SELECT | START
|
cp A_BUTTON | B_BUTTON | SELECT | START
|
||||||
jp z, Reset
|
jp z, Reset
|
||||||
|
|
||||||
ret
|
ret
|
||||||
@@ -283,11 +283,11 @@ Functiona1b: ; a1b
|
|||||||
pop bc
|
pop bc
|
||||||
|
|
||||||
ld a, [hJoyDown]
|
ld a, [hJoyDown]
|
||||||
cp D_UP | SELECT | BUTTON_B
|
cp D_UP | SELECT | B_BUTTON
|
||||||
jr z, .asm_a34
|
jr z, .asm_a34
|
||||||
|
|
||||||
ld a, [$ffa9]
|
ld a, [$ffa9]
|
||||||
and START | BUTTON_A
|
and START | A_BUTTON
|
||||||
jr nz, .asm_a34
|
jr nz, .asm_a34
|
||||||
|
|
||||||
dec c
|
dec c
|
||||||
@@ -306,7 +306,7 @@ Functiona36: ; a36
|
|||||||
call DelayFrame
|
call DelayFrame
|
||||||
call GetJoypadPublic
|
call GetJoypadPublic
|
||||||
ld a, [hJoyPressed]
|
ld a, [hJoyPressed]
|
||||||
and BUTTON_A | BUTTON_B
|
and A_BUTTON | B_BUTTON
|
||||||
ret nz
|
ret nz
|
||||||
call RTC
|
call RTC
|
||||||
jr Functiona36
|
jr Functiona36
|
||||||
@@ -382,7 +382,7 @@ Functiona80: ; a80
|
|||||||
Functionaa5: ; aa5
|
Functionaa5: ; aa5
|
||||||
call Functiona57
|
call Functiona57
|
||||||
ld a, [$ffa9]
|
ld a, [$ffa9]
|
||||||
and BUTTON_A | BUTTON_B
|
and A_BUTTON | B_BUTTON
|
||||||
jr z, Functionaa5
|
jr z, Functionaa5
|
||||||
ret
|
ret
|
||||||
; aaf
|
; aaf
|
2369
common/map.asm
Normal file
2369
common/map.asm
Normal file
File diff suppressed because it is too large
Load Diff
39
common/string.asm
Normal file
39
common/string.asm
Normal file
@@ -0,0 +1,39 @@
|
|||||||
|
InitString: ; 2ef6
|
||||||
|
; Init a string of length c.
|
||||||
|
push hl
|
||||||
|
jr _InitString
|
||||||
|
; 2ef9
|
||||||
|
|
||||||
|
InitName: ; 2ef9
|
||||||
|
; Intended for names, so this function is limited to ten characters.
|
||||||
|
push hl
|
||||||
|
ld c, 10
|
||||||
|
; 2efc
|
||||||
|
|
||||||
|
_InitString: ; 2efc
|
||||||
|
; if the string pointed to by hl is empty (defined as "zero or more spaces
|
||||||
|
; followed by a null"), then initialize it to the string pointed to by de.
|
||||||
|
push bc
|
||||||
|
.loop
|
||||||
|
ld a, [hli]
|
||||||
|
cp "@"
|
||||||
|
jr z, .blank
|
||||||
|
cp " "
|
||||||
|
jr nz, .notblank
|
||||||
|
dec c
|
||||||
|
jr nz, .loop
|
||||||
|
.blank
|
||||||
|
pop bc
|
||||||
|
ld l, e
|
||||||
|
ld h, d
|
||||||
|
pop de
|
||||||
|
ld b, 0
|
||||||
|
inc c
|
||||||
|
call CopyBytes
|
||||||
|
ret
|
||||||
|
.notblank
|
||||||
|
pop bc
|
||||||
|
pop hl
|
||||||
|
ret
|
||||||
|
; 2f17
|
||||||
|
|
@@ -1054,7 +1054,7 @@ Text_0A: ; 14ed
|
|||||||
push bc
|
push bc
|
||||||
call GetJoypadPublic
|
call GetJoypadPublic
|
||||||
ld a, [hJoyDown]
|
ld a, [hJoyDown]
|
||||||
and BUTTON_A | BUTTON_B
|
and A_BUTTON | B_BUTTON
|
||||||
jr nz, .asm_14fd
|
jr nz, .asm_14fd
|
||||||
ld c, 30
|
ld c, 30
|
||||||
call DelayFrames
|
call DelayFrames
|
||||||
@@ -1136,7 +1136,7 @@ Text_0C: ; 1543
|
|||||||
ld [hli], a
|
ld [hli], a
|
||||||
call GetJoypadPublic
|
call GetJoypadPublic
|
||||||
ld a, [hJoyDown]
|
ld a, [hJoyDown]
|
||||||
and BUTTON_A | BUTTON_B
|
and A_BUTTON | B_BUTTON
|
||||||
jr nz, .asm_155a
|
jr nz, .asm_155a
|
||||||
ld c, 10
|
ld c, 10
|
||||||
call DelayFrames
|
call DelayFrames
|
@@ -170,8 +170,8 @@ BUTTONS EQU %00010000
|
|||||||
D_PAD EQU %00100000
|
D_PAD EQU %00100000
|
||||||
|
|
||||||
NO_INPUT EQU %00000000
|
NO_INPUT EQU %00000000
|
||||||
BUTTON_A EQU %00000001
|
A_BUTTON EQU %00000001
|
||||||
BUTTON_B EQU %00000010
|
B_BUTTON EQU %00000010
|
||||||
SELECT EQU %00000100
|
SELECT EQU %00000100
|
||||||
START EQU %00001000
|
START EQU %00001000
|
||||||
D_RIGHT EQU %00010000
|
D_RIGHT EQU %00010000
|
||||||
|
165
engine/fruit_trees.asm
Normal file
165
engine/fruit_trees.asm
Normal file
@@ -0,0 +1,165 @@
|
|||||||
|
FruitTreeScript: ; 44000
|
||||||
|
3callasm BANK(GetCurTreeFruit), GetCurTreeFruit
|
||||||
|
loadfont
|
||||||
|
copybytetovar CurFruit
|
||||||
|
itemtotext $0, $0
|
||||||
|
2writetext FruitBearingTreeText
|
||||||
|
keeptextopen
|
||||||
|
3callasm BANK(TryResetFruitTrees), TryResetFruitTrees
|
||||||
|
3callasm BANK(CheckFruitTree), CheckFruitTree
|
||||||
|
iffalse .fruit
|
||||||
|
2writetext NothingHereText
|
||||||
|
closetext
|
||||||
|
2jump .end
|
||||||
|
|
||||||
|
.fruit
|
||||||
|
2writetext HeyItsFruitText
|
||||||
|
copybytetovar CurFruit
|
||||||
|
giveitem $ff, 1
|
||||||
|
iffalse .packisfull
|
||||||
|
keeptextopen
|
||||||
|
2writetext ObtainedFruitText
|
||||||
|
3callasm BANK(PickedFruitTree), PickedFruitTree
|
||||||
|
specialsound
|
||||||
|
itemnotify
|
||||||
|
2jump .end
|
||||||
|
|
||||||
|
.packisfull
|
||||||
|
keeptextopen
|
||||||
|
2writetext FruitPackIsFullText
|
||||||
|
closetext
|
||||||
|
|
||||||
|
.end
|
||||||
|
loadmovesprites
|
||||||
|
end
|
||||||
|
; 44041
|
||||||
|
|
||||||
|
GetCurTreeFruit: ; 44041
|
||||||
|
ld a, [CurFruitTree]
|
||||||
|
dec a
|
||||||
|
call GetFruitTreeItem
|
||||||
|
ld [CurFruit], a
|
||||||
|
ret
|
||||||
|
; 4404c
|
||||||
|
|
||||||
|
TryResetFruitTrees: ; 4404c
|
||||||
|
ld hl, $dc1e
|
||||||
|
bit 4, [hl]
|
||||||
|
ret nz
|
||||||
|
jp ResetFruitTrees
|
||||||
|
; 44055
|
||||||
|
|
||||||
|
CheckFruitTree: ; 44055
|
||||||
|
ld b, 2
|
||||||
|
call GetFruitTreeFlag
|
||||||
|
ld a, c
|
||||||
|
ld [ScriptVar], a
|
||||||
|
ret
|
||||||
|
; 4405f
|
||||||
|
|
||||||
|
PickedFruitTree: ; 4405f
|
||||||
|
ld a, $41
|
||||||
|
ld hl, $609b
|
||||||
|
rst FarCall ; empty function
|
||||||
|
|
||||||
|
ld b, 1
|
||||||
|
jp GetFruitTreeFlag
|
||||||
|
; 4406a
|
||||||
|
|
||||||
|
ResetFruitTrees: ; 4406a
|
||||||
|
xor a
|
||||||
|
ld hl, FruitTreeFlags
|
||||||
|
ld [hli], a
|
||||||
|
ld [hli], a
|
||||||
|
ld [hli], a
|
||||||
|
ld [hl], a
|
||||||
|
ld hl, $dc1e
|
||||||
|
set 4, [hl]
|
||||||
|
ret
|
||||||
|
; 44078
|
||||||
|
|
||||||
|
GetFruitTreeFlag: ; 44078
|
||||||
|
push hl
|
||||||
|
push de
|
||||||
|
ld a, [CurFruitTree]
|
||||||
|
dec a
|
||||||
|
ld e, a
|
||||||
|
ld d, 0
|
||||||
|
ld hl, FruitTreeFlags
|
||||||
|
call FlagAction
|
||||||
|
pop de
|
||||||
|
pop hl
|
||||||
|
ret
|
||||||
|
; 4408a
|
||||||
|
|
||||||
|
GetFruitTreeItem: ; 4408a
|
||||||
|
push hl
|
||||||
|
push de
|
||||||
|
ld e, a
|
||||||
|
ld d, 0
|
||||||
|
ld hl, FruitTreeItems
|
||||||
|
add hl, de
|
||||||
|
ld a, [hl]
|
||||||
|
pop de
|
||||||
|
pop hl
|
||||||
|
ret
|
||||||
|
; 44097
|
||||||
|
|
||||||
|
FruitTreeItems: ; 44097
|
||||||
|
db BERRY
|
||||||
|
db BERRY
|
||||||
|
db BERRY
|
||||||
|
db BERRY
|
||||||
|
db PSNCUREBERRY
|
||||||
|
db PSNCUREBERRY
|
||||||
|
db BITTER_BERRY
|
||||||
|
db BITTER_BERRY
|
||||||
|
db PRZCUREBERRY
|
||||||
|
db PRZCUREBERRY
|
||||||
|
db MYSTERYBERRY
|
||||||
|
db MYSTERYBERRY
|
||||||
|
db ICE_BERRY
|
||||||
|
db ICE_BERRY
|
||||||
|
db MINT_BERRY
|
||||||
|
db BURNT_BERRY
|
||||||
|
db RED_APRICORN
|
||||||
|
db BLU_APRICORN
|
||||||
|
db BLK_APRICORN
|
||||||
|
db WHT_APRICORN
|
||||||
|
db PNK_APRICORN
|
||||||
|
db GRN_APRICORN
|
||||||
|
db YLW_APRICORN
|
||||||
|
db BERRY
|
||||||
|
db PSNCUREBERRY
|
||||||
|
db BITTER_BERRY
|
||||||
|
db PRZCUREBERRY
|
||||||
|
db ICE_BERRY
|
||||||
|
db MINT_BERRY
|
||||||
|
db BURNT_BERRY
|
||||||
|
; 440b5
|
||||||
|
|
||||||
|
FruitBearingTreeText: ; 440b5
|
||||||
|
text_jump _FruitBearingTreeText, BANK(_FruitBearingTreeText)
|
||||||
|
db "@"
|
||||||
|
; 440ba
|
||||||
|
|
||||||
|
HeyItsFruitText: ; 440ba
|
||||||
|
text_jump _HeyItsFruitText, BANK(_HeyItsFruitText)
|
||||||
|
db "@"
|
||||||
|
; 440bf
|
||||||
|
|
||||||
|
ObtainedFruitText: ; 440bf
|
||||||
|
text_jump _ObtainedFruitText, BANK(_ObtainedFruitText)
|
||||||
|
db "@"
|
||||||
|
; 440c4
|
||||||
|
|
||||||
|
FruitPackIsFullText: ; 440c4
|
||||||
|
text_jump _FruitPackIsFullText, BANK(_FruitPackIsFullText)
|
||||||
|
db "@"
|
||||||
|
; 440c9
|
||||||
|
|
||||||
|
NothingHereText: ; 440c9
|
||||||
|
text_jump _NothingHereText, BANK(_NothingHereText)
|
||||||
|
db "@"
|
||||||
|
; 440ce
|
||||||
|
|
162
text/types.asm
Normal file
162
text/types.asm
Normal file
@@ -0,0 +1,162 @@
|
|||||||
|
PrintMonTypes: ; 5090d
|
||||||
|
; Print both types of CurSpecies on the stats screen at hl.
|
||||||
|
|
||||||
|
push hl
|
||||||
|
call GetBaseData
|
||||||
|
pop hl
|
||||||
|
|
||||||
|
push hl
|
||||||
|
ld a, [BaseType1]
|
||||||
|
call .PrintType
|
||||||
|
|
||||||
|
ld a, [BaseType1]
|
||||||
|
ld b, a
|
||||||
|
ld a, [BaseType2]
|
||||||
|
cp b
|
||||||
|
pop hl
|
||||||
|
jr z, .HideSecondType
|
||||||
|
|
||||||
|
; Next row
|
||||||
|
ld bc, 20
|
||||||
|
add hl, bc
|
||||||
|
|
||||||
|
.PrintType
|
||||||
|
ld b, a
|
||||||
|
jr PrintType
|
||||||
|
|
||||||
|
.HideSecondType
|
||||||
|
; This doesn't actually do anything.
|
||||||
|
ld a, " "
|
||||||
|
ld bc, 20 - 3
|
||||||
|
add hl, bc
|
||||||
|
ld [hl], a
|
||||||
|
inc bc
|
||||||
|
add hl, bc
|
||||||
|
ld bc, 5
|
||||||
|
jp ByteFill
|
||||||
|
; 5093a
|
||||||
|
|
||||||
|
PrintMoveType: ; 5093a
|
||||||
|
; Print the type of move b at hl.
|
||||||
|
|
||||||
|
push hl
|
||||||
|
ld a, b
|
||||||
|
dec a
|
||||||
|
ld bc, Move2 - Move1
|
||||||
|
ld hl, Moves
|
||||||
|
call AddNTimes
|
||||||
|
ld de, StringBuffer1
|
||||||
|
ld a, BANK(Moves)
|
||||||
|
call FarCopyBytes
|
||||||
|
ld a, [StringBuffer1 + PlayerMoveType - PlayerMoveStruct]
|
||||||
|
pop hl
|
||||||
|
|
||||||
|
ld b, a
|
||||||
|
; 50953
|
||||||
|
|
||||||
|
PrintType: ; 50953
|
||||||
|
; Print type b at hl.
|
||||||
|
ld a, b
|
||||||
|
|
||||||
|
push hl
|
||||||
|
add a
|
||||||
|
ld hl, TypeNames
|
||||||
|
ld e, a
|
||||||
|
ld d, 0
|
||||||
|
add hl, de
|
||||||
|
ld a, [hli]
|
||||||
|
ld e, a
|
||||||
|
ld d, [hl]
|
||||||
|
pop hl
|
||||||
|
|
||||||
|
jp PlaceString
|
||||||
|
; 50964
|
||||||
|
|
||||||
|
|
||||||
|
GetTypeName: ; 50964
|
||||||
|
; Copy the name of type $d265 to StringBuffer1.
|
||||||
|
ld a, [$d265]
|
||||||
|
ld hl, TypeNames
|
||||||
|
ld e, a
|
||||||
|
ld d, 0
|
||||||
|
add hl, de
|
||||||
|
add hl, de
|
||||||
|
ld a, [hli]
|
||||||
|
ld h, [hl]
|
||||||
|
ld l, a
|
||||||
|
ld de, StringBuffer1
|
||||||
|
ld bc, $000d
|
||||||
|
jp CopyBytes
|
||||||
|
; 5097b
|
||||||
|
|
||||||
|
|
||||||
|
TypeNames: ; 5097b
|
||||||
|
dw Normal
|
||||||
|
dw Fighting
|
||||||
|
dw Flying
|
||||||
|
dw Poison
|
||||||
|
dw Ground
|
||||||
|
dw Rock
|
||||||
|
dw Bird
|
||||||
|
dw Bug
|
||||||
|
dw Ghost
|
||||||
|
dw Steel
|
||||||
|
dw Normal
|
||||||
|
dw Normal
|
||||||
|
dw Normal
|
||||||
|
dw Normal
|
||||||
|
dw Normal
|
||||||
|
dw Normal
|
||||||
|
dw Normal
|
||||||
|
dw Normal
|
||||||
|
dw Normal
|
||||||
|
dw UnknownType
|
||||||
|
dw Fire
|
||||||
|
dw Water
|
||||||
|
dw Grass
|
||||||
|
dw Electric
|
||||||
|
dw Psychic
|
||||||
|
dw Ice
|
||||||
|
dw Dragon
|
||||||
|
dw Dark
|
||||||
|
|
||||||
|
Normal:
|
||||||
|
db "NORMAL@"
|
||||||
|
Fighting:
|
||||||
|
db "FIGHTING@"
|
||||||
|
Flying:
|
||||||
|
db "FLYING@"
|
||||||
|
Poison:
|
||||||
|
db "POISON@"
|
||||||
|
UnknownType:
|
||||||
|
db "???@"
|
||||||
|
Fire:
|
||||||
|
db "FIRE@"
|
||||||
|
Water:
|
||||||
|
db "WATER@"
|
||||||
|
Grass:
|
||||||
|
db "GRASS@"
|
||||||
|
Electric:
|
||||||
|
db "ELECTRIC@"
|
||||||
|
Psychic:
|
||||||
|
db "PSYCHIC@"
|
||||||
|
Ice:
|
||||||
|
db "ICE@"
|
||||||
|
Ground:
|
||||||
|
db "GROUND@"
|
||||||
|
Rock:
|
||||||
|
db "ROCK@"
|
||||||
|
Bird:
|
||||||
|
db "BIRD@"
|
||||||
|
Bug:
|
||||||
|
db "BUG@"
|
||||||
|
Ghost:
|
||||||
|
db "GHOST@"
|
||||||
|
Steel:
|
||||||
|
db "STEEL@"
|
||||||
|
Dragon:
|
||||||
|
db "DRAGON@"
|
||||||
|
Dark:
|
||||||
|
db "DARK@"
|
||||||
|
; 50a28
|
||||||
|
|
Reference in New Issue
Block a user