Merge pull request #4 from kanzure/fix-split-predefs-specials-stds

Fix split predefs specials stds
This commit is contained in:
yenatch 2013-09-09 14:14:33 -07:00
commit d3fa77253a
6 changed files with 246 additions and 760 deletions

View File

@ -1,3 +1,4 @@
PYTHON := python
.SUFFIXES: .asm .tx .o .gbc .png .2bpp .lz
TEXTFILES := $(shell find ./ -type f -name '*.asm' | grep -v pokecrystal.asm | grep -v constants.asm | grep -v gbhw.asm | grep -v hram.asm | grep -v constants | grep -v wram.asm)
@ -14,35 +15,35 @@ clean:
@echo 'rm -f $(TEXTFILES:.asm=.tx)'
@rm -f $(TEXTFILES:.asm=.tx)
pokecrystal.o: $(TEXTFILES:.asm=.tx) wram.asm constants.asm $(shell find constants/ -type f -name '*.asm') hram.asm gbhw.asm $(LZ_GFX) $(TWOBPP_GFX)
python prequeue.py $(TEXTQUEUE)
$(PYTHON) prequeue.py $(TEXTQUEUE)
rgbasm -o pokecrystal.o pokecrystal.asm
.asm.tx:
$(eval TEXTQUEUE := $(TEXTQUEUE) $<)
@rm -f $@
baserom.gbc:
python -c "import os; assert 'baserom.gbc' in os.listdir('.'), 'Wait! Need baserom.gbc first. Check README and INSTALL for details.';"
$(PYTHON) -c "import os; assert 'baserom.gbc' in os.listdir('.'), 'Wait! Need baserom.gbc first. Check README and INSTALL for details.';"
pokecrystal.gbc: pokecrystal.o
rgblink -n pokecrystal.sym -m pokecrystal.map -o $@ $<
rgbfix -Cjv -i BYTE -k 01 -l 0x33 -m 0x10 -p 0 -r 3 -t PM_CRYSTAL $@
pngs:
python extras/pokemontools/gfx.py mass-decompress
python extras/pokemontools/gfx.py dump-pngs
$(PYTHON) extras/pokemontools/gfx.py mass-decompress
$(PYTHON) extras/pokemontools/gfx.py dump-pngs
lzs: $(LZ_GFX) $(TWOBPP_GFX)
@:
gfx/pics/%/front.lz: gfx/pics/%/tiles.2bpp gfx/pics/%/front.png
python extras/pokemontools/gfx.py png-to-lz --front $^
$(PYTHON) extras/pokemontools/gfx.py png-to-lz --front $^
gfx/pics/%/tiles.2bpp: gfx/pics/%/tiles.png
python extras/pokemontools/gfx.py png-to-2bpp $<
$(PYTHON) extras/pokemontools/gfx.py png-to-2bpp $<
gfx/pics/%/back.lz: gfx/pics/%/back.png
python extras/pokemontools/gfx.py png-to-lz --vert $<
$(PYTHON) extras/pokemontools/gfx.py png-to-lz --vert $<
gfx/trainers/%.lz: gfx/trainers/%.png
python extras/pokemontools/gfx.py png-to-lz --vert $<
$(PYTHON) extras/pokemontools/gfx.py png-to-lz --vert $<
.png.lz:
python extras/pokemontools/gfx.py png-to-lz $<
$(PYTHON) extras/pokemontools/gfx.py png-to-lz $<
.png.2bpp:
python extras/pokemontools/gfx.py png-to-lz $<
$(PYTHON) extras/pokemontools/gfx.py png-to-lz $<

View File

@ -9328,72 +9328,102 @@ BattleCommand50: ; 37492
ld a, [hBattleTurn]
and a
jr nz, .asm_374ce ; 37495 $37
call .asm_37501
jr nz, .enemy
; The player needs to be able to steal an item.
call .playeritem
ld a, [hl]
and a
ret nz
call .asm_3750c
; The enemy needs to have an item to steal.
call .enemyitem
ld a, [hl]
and a
ret z
; Can't steal mail.
ld [$d265], a
ld d, a
ld a, $2e
ld hl, $5e76
rst FarCall
callba ItemIsMail
ret c
ld a, [EffectFailed]
and a
ret nz
ld a, [InLinkBattle]
and a
jr z, .asm_374be ; 374b7 $5
jr z, .stealenemyitem
ld a, [IsInBattle]
dec a
ret z
.asm_374be
call .asm_3750c
.stealenemyitem
call .enemyitem
xor a
ld [hl], a
ld [de], a
call .asm_37501
call .playeritem
ld a, [$d265]
ld [hl], a
ld [de], a
jr .asm_374f8 ; 374cc $2a
.asm_374ce
call .asm_3750c
jr .stole
.enemy
; The enemy can't already have an item.
call .enemyitem
ld a, [hl]
and a
ret nz
call .asm_37501
; The player must have an item to steal.
call .playeritem
ld a, [hl]
and a
ret z
; Can't steal mail!
ld [$d265], a
ld d, a
ld a, $2e
ld hl, $5e76
rst FarCall
callba ItemIsMail
ret c
ld a, [EffectFailed]
and a
ret nz
call .asm_37501
; If the enemy steals your item,
; it's gone for good if you don't get it back.
call .playeritem
xor a
ld [hl], a
ld [de], a
call .asm_3750c
call .enemyitem
ld a, [$d265]
ld [hl], a
ld [de], a
.asm_374f8
.stole
call GetItemName
ld hl, StoleText
jp StdBattleTextBox
.asm_37501
.playeritem
ld a, 1
call BattlePartyAttr
ld d, h
@ -9401,9 +9431,9 @@ BattleCommand50: ; 37492
ld hl, BattleMonItem
ret
.asm_3750c
.enemyitem
ld a, 1
call $396d ; GetOTStat_Battle
call OTPartyAttr
ld d, h
ld e, l
ld hl, EnemyMonItem
@ -9413,17 +9443,27 @@ BattleCommand50: ; 37492
BattleCommand51: ; 37517
; arenatrap
; Doesn't work on an absent opponent.
call CheckHiddenOpponent
jr nz, .asm_37530 ; 3751a $14
jr nz, .failed
; Don't trap if the opponent is already trapped.
ld a, BATTLE_VARS_SUBSTATUS5
call GetBattleVarPair
bit 7, [hl]
jr nz, .asm_37530 ; 37523 $b
set 7, [hl]
bit SUBSTATUS_CANT_RUN, [hl]
jr nz, .failed
; Otherwise trap the opponent.
set SUBSTATUS_CANT_RUN, [hl]
call Function0x37e01
ld hl, CantEscapeNowText
jp StdBattleTextBox
.asm_37530
.failed
call Function0x37e77
jp PrintButItFailed
; 37536
@ -9432,23 +9472,38 @@ BattleCommand51: ; 37517
BattleCommand52: ; 37536
; nightmare
; Can't hit an absent opponent.
call CheckHiddenOpponent
jr nz, .asm_3755d ; 37539 $22
jr nz, .failed
; Can't hit a substitute.
call CheckSubstituteOpp
jr nz, .asm_3755d ; 3753e $1d
jr nz, .failed
; Only works on a sleeping opponent.
ld a, BATTLE_VARS_STATUS_OPP
call GetBattleVarPair
and $7
jr z, .asm_3755d ; 37547 $14
and SLP
jr z, .failed
; Bail if the opponent is already having a nightmare.
ld a, BATTLE_VARS_SUBSTATUS1_OPP
call GetBattleVarPair
bit 0, [hl]
jr nz, .asm_3755d ; 37550 $b
set 0, [hl]
bit SUBSTATUS_NIGHTMARE, [hl]
jr nz, .failed
; Otherwise give the opponent a nightmare.
set SUBSTATUS_NIGHTMARE, [hl]
call Function0x37e01
ld hl, StartedNightmareText
jp StdBattleTextBox
.asm_3755d
.failed
call Function0x37e77
jp PrintButItFailed
; 37563
@ -9457,22 +9512,30 @@ BattleCommand52: ; 37536
BattleCommand53: ; 37563
; defrost
; Thaw the user.
ld a, BATTLE_VARS_STATUS
call GetBattleVarPair
bit 5, [hl]
bit FRZ, [hl]
ret z
res 5, [hl]
res FRZ, [hl]
; Don't update the enemy's party struct in a wild battle.
ld a, [hBattleTurn]
and a
jr z, .asm_37578 ; 37570 $6
jr z, .party
ld a, [IsInBattle]
dec a
jr z, .asm_3757f ; 37576 $7
.asm_37578
ld a, $20
jr z, .done
.party
ld a, PartyMon1Status - PartyMon1
call UserPartyAttr
res 5, [hl]
.asm_3757f
res FRZ, [hl]
.done
call RefreshBattleHuds
ld hl, WasDefrostedText
jp StdBattleTextBox
@ -9486,25 +9549,40 @@ BattleCommand54: ; 37588
ld bc, PlayerStatLevels
ld a, [hBattleTurn]
and a
jr z, .asm_37599 ; 37591 $6
jr z, .go
ld de, EnemyMonType1
ld bc, EnemyStatLevels
.asm_37599
.go
; Curse is different for Ghost-types.
ld a, [de]
cp $8
jr z, .asm_375d7 ; 3759c $39
cp GHOST
jr z, .ghost
inc de
ld a, [de]
cp $8
jr z, .asm_375d7 ; 375a2 $33
cp GHOST
jr z, .ghost
; If no stats can be increased, don't.
; Attack
ld a, [bc]
cp $d
jr c, .asm_375af ; 375a7 $6
cp 13 ; max
jr c, .raise
; Defense
inc bc
ld a, [bc]
cp $d
jr nc, .asm_3760a ; 375ad $5b
.asm_375af
cp 13 ; max
jr nc, .cantraise
.raise
; Raise Attack and Defense, and lower Speed.
ld a, $1
ld [$c689], a
call Function0x37e01
@ -9519,29 +9597,43 @@ BattleCommand54: ; 37588
call ResetMiss
call BattleCommand71
jp BattleCommand8c
.asm_375d7
.ghost
; Cut HP in half and put a curse on the opponent.
call CheckHiddenOpponent
jr nz, .asm_37604 ; 375da $28
jr nz, .failed
call CheckSubstituteOpp
jr nz, .asm_37604 ; 375df $23
jr nz, .failed
ld a, BATTLE_VARS_SUBSTATUS1_OPP
call GetBattleVarPair
bit 1, [hl]
jr nz, .asm_37604 ; 375e8 $1a
jr nz, .failed
set 1, [hl]
call Function0x37e01
ld hl, $4c9f
ld hl, GetHalfMaxHP
call CallBankF
ld hl, $4c3f
ld hl, Function3cc3f
call CallBankF
call UpdateUserInParty
ld hl, PutACurseText
jp StdBattleTextBox
.asm_37604
.failed
call Function0x37e77
jp PrintButItFailed
.asm_3760a
ld b, $8
.cantraise
; Can't raise either stat.
ld b, $8 ; ABILITY
call GetStatName
call Function0x37e77
ld hl, WontRiseAnymoreText

2
extras

@ -1 +1 @@
Subproject commit 016f0206b5029fc83a6200be29b0f980c76dfd90
Subproject commit 276111f04dcc3e937f1a16f4b7066934409f8ad4

128
main.asm
View File

@ -26733,11 +26733,11 @@ OpenMartDialog: ; 15a45
; 15a57
.dialogs
dw MartDialog
dw HerbShop
dw BargainShop
dw Pharmacist
dw VendingMachine
dw MartDialog
dw HerbShop
dw BargainShop
dw Pharmacist
dw VendingMachine
; 15a61
MartDialog: ; 15a61
@ -26865,12 +26865,12 @@ Function15b47: ; 15b47
ret
.table_15b56
dw Function15b62
dw Function15b6e
dw Function15b8d
dw Function15b9a
dw Function15ba3
dw Function15baf
dw Function15b62
dw Function15b6e
dw Function15b8d
dw Function15b9a
dw Function15ba3
dw Function15baf
; 15b62
Function15b62: ; 15b62
@ -27107,11 +27107,11 @@ Function15ca3: ; 15ca3
; 15cb0
.data_15cb0 ; 15cb0
dwb $5cbf, 0
dwb $5ccb, 0
dwb $5cd7, 1
dwb $5ce3, 0
dwb $5cbf, 2
dwb $5cbf, 0
dwb $5ccb, 0
dwb $5cd7, 1
dwb $5ce3, 0
dwb $5cbf, 2
; 15cbf
INCBIN "baserom.gbc", $15cbf, $15cef - $15cbf
@ -27791,7 +27791,7 @@ Function16798: ; 16798
ld a, [CurPartyMon]
call AddNTimes
ld d, [hl]
callba Functionb9e76
callba ItemIsMail
jr c, .asm_167ed
ld hl, PartyMon1Nickname
ld a, [CurPartyMon]
@ -30906,7 +30906,7 @@ Function24dd4: ; 24dd4
ld a, $1
call GetPartyParamLocation
ld d, [hl]
callba Functionb9e76
callba ItemIsMail
pop hl
ld a, $14
jr c, .asm_24e2c
@ -34522,7 +34522,7 @@ Function29bfb: ; 29bfb
push hl
push bc
ld d, [hl]
callba Functionb9e76
callba ItemIsMail
pop bc
pop hl
jr c, .asm_29c5e
@ -53392,14 +53392,14 @@ StatsScreenMain: ; 0x4dcd2
INCBIN "baserom.gbc", $4dcf7, $4dd2a - $4dcf7
StatsScreenPointerTable: ; 4dd2a
dw $5d72 ; regular pokémon
dw EggStatsInit ; egg
dw $5de6
dw $5dac
dw $5dc6
dw $5de6
dw $5dd6
dw $5d6c
dw $5d72 ; regular pokémon
dw EggStatsInit ; egg
dw $5de6
dw $5dac
dw $5dc6
dw $5de6
dw $5dd6
dw $5d6c
; 4dd3a
@ -53416,10 +53416,10 @@ EggStatsInit: ; 4dda1
INCBIN "baserom.gbc", $4ddac, $4e21e - $4ddac
IDNoString: ; 4e21e
db $73, "№.@"
db $73, "№.@"
OTString: ; 4e222
db "OT/@"
db "OT/@"
; 4e226
INCBIN "baserom.gbc", $4e226, $4e33a - $4e226
@ -53481,22 +53481,22 @@ EggStatsScreen: ; 4e33a
; 0x4e3c0
EggString: ; 4e3c0
db "EGG@"
db "EGG@"
FiveQMarkString: ; 4e3c4
db "?????@"
db "?????@"
EggSoonString: ; 0x4e3ca
db "It's making sounds", $4e, "inside. It's going", $4e, "to hatch soon!@"
db "It's making sounds", $4e, "inside. It's going", $4e, "to hatch soon!@"
EggCloseString: ; 0x4e3fd
db "It moves around", $4e, "inside sometimes.", $4e, "It must be close", $4e, "to hatching.@"
db "It moves around", $4e, "inside sometimes.", $4e, "It must be close", $4e, "to hatching.@"
EggMoreTimeString: ; 0x4e43d
db "Wonder what's", $4e, "inside? It needs", $4e, "more time, though.@"
db "Wonder what's", $4e, "inside? It needs", $4e, "more time, though.@"
EggALotMoreTimeString: ; 0x4e46e
db "This EGG needs a", $4e, "lot more time to", $4e, "hatch.@"
db "This EGG needs a", $4e, "lot more time to", $4e, "hatch.@"
; 0x4e497
@ -55357,35 +55357,35 @@ PrintPartyMenuText: ; 5049a
; 0x504d2
PartyMenuStrings: ; 0x504d2
dw ChooseAMonString
dw UseOnWhichPKMNString
dw WhichPKMNString
dw TeachWhichPKMNString
dw MoveToWhereString
dw UseOnWhichPKMNString
dw ChooseAMonString ; Probably used to be ChooseAFemalePKMNString
dw ChooseAMonString ; Probably used to be ChooseAMalePKMNString
dw ToWhichPKMNString
dw ChooseAMonString
dw UseOnWhichPKMNString
dw WhichPKMNString
dw TeachWhichPKMNString
dw MoveToWhereString
dw UseOnWhichPKMNString
dw ChooseAMonString ; Probably used to be ChooseAFemalePKMNString
dw ChooseAMonString ; Probably used to be ChooseAMalePKMNString
dw ToWhichPKMNString
ChooseAMonString: ; 0x504e4
db "Choose a #MON.@"
db "Choose a #MON.@"
UseOnWhichPKMNString: ; 0x504f3
db "Use on which ", $e1, $e2, "?@"
db "Use on which ", $e1, $e2, "?@"
WhichPKMNString: ; 0x50504
db "Which ", $e1, $e2, "?@"
db "Which ", $e1, $e2, "?@"
TeachWhichPKMNString: ; 0x5050e
db "Teach which ", $e1, $e2, "?@"
db "Teach which ", $e1, $e2, "?@"
MoveToWhereString: ; 0x5051e
db "Move to where?@"
db "Move to where?@"
ChooseAFemalePKMNString: ; 0x5052d ; UNUSED
db "Choose a ♀", $e1, $e2, ".@"
db "Choose a ♀", $e1, $e2, ".@"
ChooseAMalePKMNString: ; 0x5053b ; UNUSED
db "Choose a ♂", $e1, $e2, ".@"
db "Choose a ♂", $e1, $e2, ".@"
ToWhichPKMNString: ; 0x50549
db "To which ", $e1, $e2, "?@"
db "To which ", $e1, $e2, "?@"
YouHaveNoPKMNString: ; 0x50556
db "You have no ", $e1, $e2, "!@"
db "You have no ", $e1, $e2, "!@"
Function50566: ; 50566
@ -69675,14 +69675,26 @@ Functionb92b8: ; b92b8
INCBIN "baserom.gbc", $b92f7, $b9e76 - $b92f7
Functionb9e76: ; b9e76
ItemIsMail: ; b9e76
ld a, d
ld hl, $5e80
ld de, $0001
ld hl, .items
ld de, 1
jp IsInArray
; b9e80
INCBIN "baserom.gbc", $b9e80, $b9e8b - $b9e80
.items
db FLOWER_MAIL
db SURF_MAIL
db LITEBLUEMAIL
db PORTRAITMAIL
db LOVELY_MAIL
db EON_MAIL
db MORPH_MAIL
db BLUESKY_MAIL
db MUSIC_MAIL
db MIRAGE_MAIL
db $ff
; b9e8b
SECTION "bank2F",ROMX,BANK[$2F]
@ -86674,7 +86686,7 @@ RegionCheck: ; 0x1caea1
SECTION "bank73",ROMX,BANK[$73]
; Pokedex entries III
; Pokedex entries III
; 129-192
PokedexEntries3:
INCLUDE "stats/pokedex/entries_3.asm"

File diff suppressed because it is too large Load Diff

View File

@ -11,7 +11,7 @@ import preprocessor
def main():
macros = preprocessor.load_pokecrystal_macros()
macro_table = preprocessor.make_macro_table(macros)
macro_table = preprocessor.preprocessor.make_macro_table(macros)
stdout = sys.stdout