Merge pull request #256 from yenatch/master

Fix predefs and battle code.
This commit is contained in:
Bryan Bishop 2014-06-27 21:33:08 -05:00
commit 1ecfe6bd23
51 changed files with 5266 additions and 5945 deletions

View File

@ -5,14 +5,13 @@ PYTHON := python
.PHONY: all clean crystal pngs
.SECONDEXPANSION:
POKEMONTOOLS := extras/pokemontools
GFX := $(PYTHON) $(POKEMONTOOLS)/gfx.py
INCLUDES := $(PYTHON) $(POKEMONTOOLS)/scan_includes.py
PREPROCESS := $(PYTHON) prequeue.py
poketools := extras/pokemontools
gfx := $(PYTHON) $(poketools)/gfx.py
includes := $(PYTHON) $(poketools)/scan_includes.py
pre := $(PYTHON) prequeue.py
TEXTQUEUE :=
CRYSTAL_OBJS := \
crystal_obj := \
wram.o \
main.o \
lib/mobile/main.o \
@ -29,20 +28,21 @@ data/pokedex/entries_crystal.o \
misc/crystal_misc.o \
gfx/pics.o
OBJS := $(CRYSTAL_OBJS)
ROMS := pokecrystal.gbc
all_obj := $(crystal_obj)
# object dependencies
$(shell $(foreach obj, $(OBJS), $(eval $(obj:.o=)_DEPENDENCIES := $(shell $(INCLUDES) $(obj:.o=.asm)))))
$(foreach obj, $(all_obj), \
$(eval $(obj:.o=)_dep := $(shell $(includes) $(obj:.o=.asm))) \
)
all: $(ROMS)
roms := pokecrystal.gbc
all: $(roms)
crystal: pokecrystal.gbc
clean:
rm -f $(ROMS)
rm -f $(OBJS)
rm -f $(roms) $(all_obj)
find -iname '*.tx' -exec rm {} +
baserom.gbc: ;
@ -50,30 +50,31 @@ baserom.gbc: ;
%.asm: ;
.asm.tx:
$(eval TEXTQUEUE += $<)
@rm -f $@
%.tx: %.asm ; $(eval txq += $<) @rm -f $@
$(OBJS): $$*.tx $$(patsubst %.asm, %.tx, $$($$*_DEPENDENCIES))
@$(PREPROCESS) $(TEXTQUEUE)
$(eval TEXTQUEUE :=)
$(all_obj): $$*.tx $$(patsubst %.asm, %.tx, $$($$*_dep))
@$(pre) $(txq); $(eval txq :=)
@$(gfx) 2bpp $(2bppq); $(eval 2bppq :=)
@$(gfx) 1bpp $(1bppq); $(eval 1bppq :=)
@$(gfx) lz $(lzq); $(eval lzq :=)
rgbasm -o $@ $*.tx
pokecrystal.gbc: $(CRYSTAL_OBJS)
pokecrystal.gbc: $(crystal_obj)
rgblink -n $*.sym -m $*.map -o $@ $^
rgbfix -Cjv -i BYTE -k 01 -l 0x33 -m 0x10 -p 0 -r 3 -t PM_CRYSTAL $@
cmp baserom.gbc $@
pngs:
find . -iname "*.lz" -exec $(GFX) unlz {} +
find . -iname "*.[12]bpp" -exec $(GFX) png {} +
find . -iname "*.[12]bpp" -exec touch {} +
find . -iname "*.lz" -exec $(gfx) unlz {} +
find . -iname "*.[12]bpp" -exec $(gfx) png {} +
find . -iname "*.lz" -exec touch {} +
find . -iname "*.[12]bpp" -exec touch {} +
%.2bpp: %.png ; $(eval 2bppq += $<) @rm -f $@
%.1bpp: %.png ; $(eval 1bppq += $<) @rm -f $@
%.lz: % ; $(eval lzq += $<) @rm -f $@
%.2bpp: %.png ; $(GFX) 2bpp $<
%.1bpp: %.png ; $(GFX) 1bpp $<
%.lz: % ; $(GFX) lz $<
%.pal: ;
%.bin: ;

847
battle/ai/items.asm Normal file

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -954,22 +954,18 @@ BattleAnimCmd_DC: ; cc5dc (33:45dc)
ld a, [TempBattleMonSpecies] ; $d205
ld [CurPartySpecies], a ; $d108
ld hl, BattleMonDVs ; $c632
ld a, PREDEF_GET_UNOWN_LETTER
call Predef
predef GetUnownLetter
ld de, $8000
ld a, $3c
call Predef
predef GetFrontpic
jr .done
.player
ld a, [TempEnemyMonSpecies] ; $d204
ld [CurPartySpecies], a ; $d108
ld hl, EnemyMonDVs ; $d20c
ld a, PREDEF_GET_UNOWN_LETTER
call Predef
predef GetUnownLetter
ld de, $8000
ld a, $3d
call Predef
predef GetBackpic
.done
pop af
@ -1194,20 +1190,16 @@ BattleAnimCmd_E6: ; cc776 (33:4776)
jr z, .player
ld hl, BattleMonDVs ; $c632
ld a, PREDEF_GET_UNOWN_LETTER
call Predef
predef GetUnownLetter
ld de, $9000
ld a, $3c
call Predef
predef GetFrontpic
jr .done
.player
ld hl, EnemyMonDVs ; $d20c
ld a, PREDEF_GET_UNOWN_LETTER
call Predef
predef GetUnownLetter
ld de, $9310
ld a, $3d
call Predef
predef GetBackpic
.done
pop af

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -66,11 +66,11 @@ BattleCommand54: ; 37588
jr nz, .failed
ld a, BATTLE_VARS_SUBSTATUS1_OPP
call _GetBattleVar
bit 1, [hl]
call GetBattleVarAddr
bit SUBSTATUS_CURSE, [hl]
jr nz, .failed
set 1, [hl]
set SUBSTATUS_CURSE, [hl]
call AnimateCurrentMove
ld hl, GetHalfMaxHP
call CallBattleCore

View File

@ -7,7 +7,7 @@ BattleCommand5a: ; 3766f
ret c
ld a, BATTLE_VARS_SUBSTATUS1
call _GetBattleVar
call GetBattleVarAddr
set SUBSTATUS_ENDURE, [hl]
call AnimateCurrentMove

View File

@ -9,7 +9,7 @@ BattleCommand57: ; 376a0
jr nz, .failed
ld a, BATTLE_VARS_SUBSTATUS1_OPP
call _GetBattleVar
call GetBattleVarAddr
bit SUBSTATUS_IDENTIFIED, [hl]
jr nz, .failed

View File

@ -36,7 +36,7 @@ BattleCommand34: ; 37418
ld a, BATTLE_VARS_MOVE
call _GetBattleVar
call GetBattleVarAddr
ld [hl], b
call UpdateMoveData
jp ResetTurn

View File

@ -4,7 +4,7 @@ BattleCommand1b: ; 373c9
call Function372d8
ld a, BATTLE_VARS_MOVE
call _GetBattleVar
call GetBattleVarAddr
ld a, BATTLE_VARS_LAST_COUNTER_MOVE_OPP
call GetBattleVar
@ -28,7 +28,7 @@ BattleCommand1b: ; 373c9
push af
ld a, BATTLE_VARS_MOVE_ANIM
call _GetBattleVar
call GetBattleVarAddr
ld d, h
ld e, l
pop af

View File

@ -14,14 +14,14 @@ BattleCommand52: ; 37536
; Only works on a sleeping opponent.
ld a, BATTLE_VARS_STATUS_OPP
call _GetBattleVar
call GetBattleVarAddr
and SLP
jr z, .failed
; Bail if the opponent is already having a nightmare.
ld a, BATTLE_VARS_SUBSTATUS1_OPP
call _GetBattleVar
call GetBattleVarAddr
bit SUBSTATUS_NIGHTMARE, [hl]
jr nz, .failed

View File

@ -4,7 +4,7 @@ BattleCommand55: ; 37618
ret c
ld a, BATTLE_VARS_SUBSTATUS1
call _GetBattleVar
call GetBattleVarAddr
set SUBSTATUS_PROTECT, [hl]
call AnimateCurrentMove

View File

@ -1,22 +1,24 @@
MAX_ROLLOUT_COUNT EQU 5
BattleCommand5b: ; 37718
; checkcurl
ld de, PlayerRolloutCount
ld a, [hBattleTurn]
and a
jr z, .asm_37723
jr z, .ok
ld de, EnemyRolloutCount
.asm_37723
.ok
ld a, BATTLE_VARS_SUBSTATUS1
call GetBattleVar
bit SUBSTATUS_ENCORED, a
jr z, .asm_37731
bit SUBSTATUS_ROLLOUT, a
jr z, .reset
ld b, $4 ; doturn
jp SkipToBattleCommand
.asm_37731
.reset
xor a
ld [de], a
ret
@ -28,7 +30,7 @@ BattleCommand5c: ; 37734
ld a, BATTLE_VARS_STATUS
call GetBattleVar
and 7
and SLP
ret nz
ld hl, PlayerRolloutCount
@ -50,7 +52,7 @@ BattleCommand5c: ; 37734
jr z, .hit
ld a, BATTLE_VARS_SUBSTATUS1
call _GetBattleVar
call GetBattleVarAddr
res 6, [hl]
ret
@ -58,23 +60,23 @@ BattleCommand5c: ; 37734
inc [hl]
ld a, [hl]
ld b, a
cp $5
cp MAX_ROLLOUT_COUNT
jr c, .asm_3776e
ld a, BATTLE_VARS_SUBSTATUS1
call _GetBattleVar
res 6, [hl]
call GetBattleVarAddr
res SUBSTATUS_ROLLOUT, [hl]
jr .asm_37775
.asm_3776e
ld a, BATTLE_VARS_SUBSTATUS1
call _GetBattleVar
set 6, [hl]
call GetBattleVarAddr
set SUBSTATUS_ROLLOUT, [hl]
.asm_37775
ld a, BATTLE_VARS_SUBSTATUS2
call GetBattleVar
bit 0, a
bit SUBSTATUS_CURLED, a
jr z, .asm_3777f
inc b
.asm_3777f

View File

@ -96,7 +96,7 @@ HiddenPowerDamage: ; fbced
; Overwrite the current move type.
push af
ld a, BATTLE_VARS_MOVE_TYPE
call _GetBattleVar
call GetBattleVarAddr
pop af
ld [hl], a

View File

@ -1,22 +1,17 @@
Moves: ; 41afb
; Characteristics of each move
; animation, effect, power, type, accuracy, PP, effect chance
; Characteristics of each move.
move: MACRO
db \1 ; animation
db \2 ; effect
db \3 ; power
db \4 ; type
db \5 * $ff / 100 ; accuracy (percent)
db \5 percent ; accuracy
db \6 ; pp
db \7 * $ff / 100 ; effect chance (percent)
db \7 percent ; effect chance
ENDM
Move1:
move POUND, EFFECT_NORMAL_HIT, 40, NORMAL, 100, 35, 0
Move2:
move KARATE_CHOP, EFFECT_NORMAL_HIT, 50, FIGHTING, 100, 25, 0
move DOUBLESLAP, EFFECT_MULTI_HIT, 15, NORMAL, 85, 10, 0
move COMET_PUNCH, EFFECT_MULTI_HIT, 18, NORMAL, 85, 15, 0

View File

@ -1,6 +1,8 @@
MAX_LEVEL EQU 100
NUM_MOVES EQU 4
REST_TURNS EQU 2
ATTACK EQU 0
DEFENSE EQU 1
SPEED EQU 2
@ -44,9 +46,12 @@ BATTLETYPE_CANLOSE EQU $01
BATTLETYPE_TUTORIAL EQU $03
BATTLETYPE_FISH EQU $04
BATTLETYPE_ROAMING EQU $05
BATTLETYPE_CONTEST EQU $06
BATTLETYPE_SHINY EQU $07
BATTLETYPE_TREE EQU $08
BATTLETYPE_TRAP EQU $09
BATTLETYPE_FORCEITEM EQU $0a
BATTLETYPE_CELEBI EQU $0b
BATTLETYPE_SUICUNE EQU $0c
; battle variables
@ -81,7 +86,7 @@ PAR EQU 6
; substatus
SUBSTATUS_IN_LOVE EQU 7
SUBSTATUS_ENCORED EQU 6
SUBSTATUS_ROLLOUT EQU 6
SUBSTATUS_ENDURE EQU 5
SUBSTATUS_PERISH EQU 4
SUBSTATUS_IDENTIFIED EQU 3
@ -96,7 +101,8 @@ SUBSTATUS_FLYING EQU 6
SUBSTATUS_UNDERGROUND EQU 5
SUBSTATUS_CHARGED EQU 4
SUBSTATUS_FLINCHED EQU 3
SUBSTATUS_ROLLOUT EQU 1
SUBSTATUS_IN_LOOP EQU 2
SUBSTATUS_RAMPAGE EQU 1
SUBSTATUS_BIDE EQU 0
SUBSTATUS_LEECH_SEED EQU 7
@ -110,6 +116,8 @@ SUBSTATUS_UNLEASH EQU 0
SUBSTATUS_CANT_RUN EQU 7
SUBSTATUS_DESTINY_BOND EQU 6
SUBSTATUS_LOCK_ON EQU 5
SUBSTATUS_ENCORED EQU 4
SUBSTATUS_TRANSFORMED EQU 3
SUBSTATUS_TOXIC EQU 0
; environmental
@ -119,6 +127,7 @@ SCREENS_SAFEGUARD EQU 2
SCREENS_SPIKES EQU 0
; weather
WEATHER_NONE EQU 0
WEATHER_RAIN EQU 1
WEATHER_SUN EQU 2
WEATHER_SANDSTORM EQU 3

View File

@ -267,6 +267,7 @@ HELD_BERRY EQU $01
HELD_LEFTOVERS EQU $03
HELD_RESTORE_PP EQU $06
HELD_CLEANSE_TAG EQU $08
HELD_HEAL_POISON EQU $0a
HELD_HEAL_FREEZE EQU $0b
HELD_HEAL_BURN EQU $0c
@ -274,7 +275,24 @@ HELD_HEAL_SLEEP EQU $0d
HELD_HEAL_PARALYZE EQU $0e
HELD_HEAL_STATUS EQU $0f
HELD_HEAL_CONFUSION EQU $10
HELD_PREVENT_POISON EQU $14
HELD_PREVENT_BURN EQU $15
HELD_PREVENT_FREEZE EQU $16
HELD_PREVENT_SLEEP EQU $17
HELD_PREVENT_PARALYZE EQU $18
HELD_PREVENT_CONFUSE EQU $19
HELD_ATTACK_UP EQU $1f
HELD_DEFENSE_UP EQU $20
HELD_SPEED_UP EQU $21
HELD_SP_ATTACK_UP EQU $22
HELD_SP_DEFENSE_UP EQU $23
HELD_ACCURACY_UP EQU $24
HELD_EVASION_UP EQU $25
HELD_METAL_POWDER EQU $2a
HELD_NORMAL_BOOST EQU $32
HELD_FIGHTING_BOOST EQU $33
HELD_FLYING_BOOST EQU $34
@ -292,6 +310,7 @@ HELD_ICE_BOOST EQU $3f
HELD_DRAGON_BOOST EQU $40
HELD_DARK_BOOST EQU $41
HELD_STEEL_BOOST EQU $42
HELD_ESCAPE EQU $48
HELD_CRITICAL_UP EQU $49
HELD_QUICK_CLAW EQU $4a

View File

@ -1,40 +1,28 @@
PARTY_LENGTH EQU 6
; strings
PLAYER_NAME_LENGTH EQU 8
PKMN_NAME_LENGTH EQU 11
MOVE_NAME_LENGTH EQU 13
NAME_LENGTH EQU 11
LV_CHAR EQU $6e
; GetName types
PKMN_NAME EQU 1
MOVE_NAME EQU 2
ITEM_NAME EQU 4
PARTY_OT_NAME EQU 5
ENEMY_OT_NAME EQU 6
TRAINER_NAME EQU 7
; hp
HP_GREEN EQU 0
HP_YELLOW EQU 1
HP_RED EQU 2
; boxes
NUM_BOXES EQU 14
; predefs
PREDEF_FLAG EQU $03
PREDEF_FILLPP EQU $05
PREDEF_ADDPARTYMON EQU $06
PREDEF_FILLSTATS EQU $0C
PREDEF_PRINT_MOVE_DESCRIPTION EQU $11
PREDEF_UPDATE_PLAYER_HUD EQU $12
PREDEF_FILL_BOX EQU $13
PREDEF_UPDATE_ENEMY_HUD EQU $15
PREDEF_START_BATTLE EQU $16
PREDEF_FILL_IN_EXP_BAR EQU $17
PREDEF_FILLMOVES EQU $1B
PREDEF_GET_GENDER EQU $24
PREDEF_STATS_SCREEN EQU $25
PREDEF_DRAW_PLAYER_HP EQU $26
PREDEF_DRAW_ENEMY_HP EQU $27
PREDEF_GET_TYPE_NAME EQU $29
PREDEF_PRINT_MOVE_TYPE EQU $2A
PREDEF_PRINT_TYPE EQU $2B
PREDEF_GET_UNOWN_LETTER EQU $2D
PREDEF_LOAD_SGB_LAYOUT EQU $31
PREDEF_CHECK_CONTEST_MON EQU $33
PREDEF_BATTLE_TRANSITION EQU $34
PREDEF_PARTYMON_ITEM_NAME EQU $3B
PREDEF_DECOMPRESS EQU $40
MONS_PER_BOX EQU 20
NUM_BOXES EQU 14
; flag manipulation
@ -60,9 +48,9 @@ D_DOWN EQU %10000000
; screen
HP_BAR_LENGTH EQU 6
HP_BAR_LENGTH_PX EQU 48
HP_BAR_LENGTH_PX EQU HP_BAR_LENGTH * 8
EXP_BAR_LENGTH EQU 8
EXP_BAR_LENGTH_PX EQU 64
EXP_BAR_LENGTH_PX EQU EXP_BAR_LENGTH * 8
SCREEN_WIDTH EQU 20
SCREEN_HEIGHT EQU 18

View File

@ -25,7 +25,7 @@ UNUSED_TYPES EQU const_value
const TYPE_17
const TYPE_18
const CURSE_T
UNUSED_TYPES_END EQU const_value
SPECIAL EQU const_value
const FIRE
@ -37,3 +37,4 @@ SPECIAL EQU const_value
const DRAGON
const DARK
TYPES_END EQU const_value

Some files were not shown because too many files have changed in this diff Show More