pokecrystal-board/home/battle_vars.asm

112 lines
3.0 KiB
NASM
Raw Normal View History

2018-06-24 07:09:41 -07:00
GetBattleVar::
; Preserves hl.
push hl
call GetBattleVarAddr
pop hl
ret
2018-06-24 07:09:41 -07:00
GetBattleVarAddr::
; Get variable from pair a, depending on whose turn it is.
; There are 21 variable pairs.
push bc
ld hl, BattleVarPairs
ld c, a
ld b, 0
add hl, bc
add hl, bc
ld a, [hli]
ld h, [hl]
ld l, a
; Enemy turn uses the second byte instead.
; This lets battle variable calls be side-neutral.
ld a, [hBattleTurn]
and a
jr z, .getvar
inc hl
.getvar
; var id
ld a, [hl]
ld c, a
ld b, 0
ld hl, BattleVarLocations
add hl, bc
add hl, bc
ld a, [hli]
ld h, [hl]
ld l, a
ld a, [hl]
pop bc
ret
BattleVarPairs:
; entries correspond to BATTLE_VARS_* constants
Merge branch 'master' of https://github.com/pret/pokecrystal # Conflicts: # audio/engine.asm # constants/gfx_constants.asm # constants/map_data_constants.asm # constants/pokemon_data_constants.asm # constants/sprite_constants.asm # constants/wram_constants.asm # data/maps/data.asm # engine/battle/ai/scoring.asm # engine/battle/core.asm # engine/battle/effect_commands.asm # engine/battle/misc.asm # engine/battle_anims/getpokeballwobble.asm # engine/breeding.asm # engine/buy_sell_toss.asm # engine/decorations.asm # engine/events/battle_tower/battle_tower.asm # engine/events/battle_tower/rules.asm # engine/events/buena.asm # engine/events/bug_contest/contest_2.asm # engine/events/daycare.asm # engine/events/dratini.asm # engine/events/halloffame.asm # engine/events/happiness_egg.asm # engine/events/kurt.asm # engine/events/lucky_number.asm # engine/events/magnet_train.asm # engine/events/overworld.asm # engine/events/pokerus/pokerus.asm # engine/events/print_unown.asm # engine/events/print_unown_2.asm # engine/events/unown_walls.asm # engine/item_effects.asm # engine/link.asm # engine/mon_menu.asm # engine/player_object.asm # engine/routines/playslowcry.asm # engine/scripting.asm # engine/search.asm # engine/search2.asm # engine/specials.asm # engine/start_menu.asm # engine/timeset.asm # home/battle_vars.asm # home/map.asm # maps/GoldenrodUndergroundSwitchRoomEntrances.asm # maps/IlexForest.asm # maps/KrissHouse2F.asm # maps/Route39Barn.asm # mobile/mobile_12_2.asm # mobile/mobile_40.asm # mobile/mobile_5f.asm # wram.asm
2018-02-03 15:21:53 -08:00
dw .Substatus1
dw .Substatus2
dw .Substatus3
dw .Substatus4
dw .Substatus5
dw .Substatus1Opp
dw .Substatus2Opp
dw .Substatus3Opp
dw .Substatus4Opp
dw .Substatus5Opp
dw .Status
dw .StatusOpp
dw .MoveAnim
dw .MoveEffect
dw .MovePower
dw .MoveType
dw .CurMove
dw .LastCounter
dw .LastCounterOpp
dw .LastMove
dw .LastMoveOpp
; player enemy
Merge branch 'master' of https://github.com/pret/pokecrystal # Conflicts: # audio/engine.asm # constants/gfx_constants.asm # constants/map_data_constants.asm # constants/pokemon_data_constants.asm # constants/sprite_constants.asm # constants/wram_constants.asm # data/maps/data.asm # engine/battle/ai/scoring.asm # engine/battle/core.asm # engine/battle/effect_commands.asm # engine/battle/misc.asm # engine/battle_anims/getpokeballwobble.asm # engine/breeding.asm # engine/buy_sell_toss.asm # engine/decorations.asm # engine/events/battle_tower/battle_tower.asm # engine/events/battle_tower/rules.asm # engine/events/buena.asm # engine/events/bug_contest/contest_2.asm # engine/events/daycare.asm # engine/events/dratini.asm # engine/events/halloffame.asm # engine/events/happiness_egg.asm # engine/events/kurt.asm # engine/events/lucky_number.asm # engine/events/magnet_train.asm # engine/events/overworld.asm # engine/events/pokerus/pokerus.asm # engine/events/print_unown.asm # engine/events/print_unown_2.asm # engine/events/unown_walls.asm # engine/item_effects.asm # engine/link.asm # engine/mon_menu.asm # engine/player_object.asm # engine/routines/playslowcry.asm # engine/scripting.asm # engine/search.asm # engine/search2.asm # engine/specials.asm # engine/start_menu.asm # engine/timeset.asm # home/battle_vars.asm # home/map.asm # maps/GoldenrodUndergroundSwitchRoomEntrances.asm # maps/IlexForest.asm # maps/KrissHouse2F.asm # maps/Route39Barn.asm # mobile/mobile_12_2.asm # mobile/mobile_40.asm # mobile/mobile_5f.asm # wram.asm
2018-02-03 15:21:53 -08:00
.Substatus1: db PLAYER_SUBSTATUS_1, ENEMY_SUBSTATUS_1
.Substatus1Opp: db ENEMY_SUBSTATUS_1, PLAYER_SUBSTATUS_1
.Substatus2: db PLAYER_SUBSTATUS_2, ENEMY_SUBSTATUS_2
.Substatus2Opp: db ENEMY_SUBSTATUS_2, PLAYER_SUBSTATUS_2
.Substatus3: db PLAYER_SUBSTATUS_3, ENEMY_SUBSTATUS_3
.Substatus3Opp: db ENEMY_SUBSTATUS_3, PLAYER_SUBSTATUS_3
.Substatus4: db PLAYER_SUBSTATUS_4, ENEMY_SUBSTATUS_4
.Substatus4Opp: db ENEMY_SUBSTATUS_4, PLAYER_SUBSTATUS_4
.Substatus5: db PLAYER_SUBSTATUS_5, ENEMY_SUBSTATUS_5
.Substatus5Opp: db ENEMY_SUBSTATUS_5, PLAYER_SUBSTATUS_5
.Status: db PLAYER_STATUS, ENEMY_STATUS
.StatusOpp: db ENEMY_STATUS, PLAYER_STATUS
.MoveAnim: db PLAYER_MOVE_ANIMATION, ENEMY_MOVE_ANIMATION
.MoveEffect: db PLAYER_MOVE_EFFECT, ENEMY_MOVE_EFFECT
.MovePower: db PLAYER_MOVE_POWER, ENEMY_MOVE_POWER
.MoveType: db PLAYER_MOVE_TYPE, ENEMY_MOVE_TYPE
.CurMove: db PLAYER_CUR_MOVE, ENEMY_CUR_MOVE
.LastCounter: db PLAYER_COUNTER_MOVE, ENEMY_COUNTER_MOVE
.LastCounterOpp: db ENEMY_COUNTER_MOVE, PLAYER_COUNTER_MOVE
.LastMove: db PLAYER_LAST_MOVE, ENEMY_LAST_MOVE
.LastMoveOpp: db ENEMY_LAST_MOVE, PLAYER_LAST_MOVE
BattleVarLocations:
; entries correspond to PLAYER_* and ENEMY_* constants
Merge branch 'master' of https://github.com/pret/pokecrystal # Conflicts: # audio/engine.asm # constants/gfx_constants.asm # constants/map_data_constants.asm # constants/pokemon_data_constants.asm # constants/sprite_constants.asm # constants/wram_constants.asm # data/maps/data.asm # engine/battle/ai/scoring.asm # engine/battle/core.asm # engine/battle/effect_commands.asm # engine/battle/misc.asm # engine/battle_anims/getpokeballwobble.asm # engine/breeding.asm # engine/buy_sell_toss.asm # engine/decorations.asm # engine/events/battle_tower/battle_tower.asm # engine/events/battle_tower/rules.asm # engine/events/buena.asm # engine/events/bug_contest/contest_2.asm # engine/events/daycare.asm # engine/events/dratini.asm # engine/events/halloffame.asm # engine/events/happiness_egg.asm # engine/events/kurt.asm # engine/events/lucky_number.asm # engine/events/magnet_train.asm # engine/events/overworld.asm # engine/events/pokerus/pokerus.asm # engine/events/print_unown.asm # engine/events/print_unown_2.asm # engine/events/unown_walls.asm # engine/item_effects.asm # engine/link.asm # engine/mon_menu.asm # engine/player_object.asm # engine/routines/playslowcry.asm # engine/scripting.asm # engine/search.asm # engine/search2.asm # engine/specials.asm # engine/start_menu.asm # engine/timeset.asm # home/battle_vars.asm # home/map.asm # maps/GoldenrodUndergroundSwitchRoomEntrances.asm # maps/IlexForest.asm # maps/KrissHouse2F.asm # maps/Route39Barn.asm # mobile/mobile_12_2.asm # mobile/mobile_40.asm # mobile/mobile_5f.asm # wram.asm
2018-02-03 15:21:53 -08:00
dw wPlayerSubStatus1, wEnemySubStatus1
dw wPlayerSubStatus2, wEnemySubStatus2
dw wPlayerSubStatus3, wEnemySubStatus3
dw wPlayerSubStatus4, wEnemySubStatus4
dw wPlayerSubStatus5, wEnemySubStatus5
dw wBattleMonStatus, wEnemyMonStatus
dw wPlayerMoveStructAnimation, wEnemyMoveStructAnimation
dw wPlayerMoveStructEffect, wEnemyMoveStructEffect
dw wPlayerMoveStructPower, wEnemyMoveStructPower
dw wPlayerMoveStructType, wEnemyMoveStructType
Merge branch 'master' of https://github.com/pret/pokecrystal # Conflicts: # audio/engine.asm # constants/gfx_constants.asm # constants/map_data_constants.asm # constants/pokemon_data_constants.asm # constants/sprite_constants.asm # constants/wram_constants.asm # data/maps/data.asm # engine/battle/ai/scoring.asm # engine/battle/core.asm # engine/battle/effect_commands.asm # engine/battle/misc.asm # engine/battle_anims/getpokeballwobble.asm # engine/breeding.asm # engine/buy_sell_toss.asm # engine/decorations.asm # engine/events/battle_tower/battle_tower.asm # engine/events/battle_tower/rules.asm # engine/events/buena.asm # engine/events/bug_contest/contest_2.asm # engine/events/daycare.asm # engine/events/dratini.asm # engine/events/halloffame.asm # engine/events/happiness_egg.asm # engine/events/kurt.asm # engine/events/lucky_number.asm # engine/events/magnet_train.asm # engine/events/overworld.asm # engine/events/pokerus/pokerus.asm # engine/events/print_unown.asm # engine/events/print_unown_2.asm # engine/events/unown_walls.asm # engine/item_effects.asm # engine/link.asm # engine/mon_menu.asm # engine/player_object.asm # engine/routines/playslowcry.asm # engine/scripting.asm # engine/search.asm # engine/search2.asm # engine/specials.asm # engine/start_menu.asm # engine/timeset.asm # home/battle_vars.asm # home/map.asm # maps/GoldenrodUndergroundSwitchRoomEntrances.asm # maps/IlexForest.asm # maps/KrissHouse2F.asm # maps/Route39Barn.asm # mobile/mobile_12_2.asm # mobile/mobile_40.asm # mobile/mobile_5f.asm # wram.asm
2018-02-03 15:21:53 -08:00
dw wCurPlayerMove, wCurEnemyMove
dw wLastPlayerCounterMove, wLastEnemyCounterMove
dw wLastPlayerMove, wLastEnemyMove