This commit is contained in:
Rangi 2018-04-04 23:56:40 -04:00
commit 81306889e3
274 changed files with 667 additions and 554 deletions

View File

@ -21,8 +21,8 @@ data/maps/map_data.o \
data/pokemon/dex_entries.o \
data/pokemon/egg_moves.o \
data/pokemon/evos_attacks.o \
engine/credits.o \
engine/events.o \
engine/movie/credits.o \
engine/overworld/events.o \
gfx/pics.o \
gfx/sprites.o \
lib/mobile/main.o

2
constants/audio_constants.asm Executable file → Normal file
View File

@ -17,7 +17,7 @@
const CC ; d (used for pitchoffset)
; channel
; ChannelPointers indexes (see engine/audio.asm)
; ChannelPointers indexes (see audio/engine.asm)
const_def
const CHAN1 ; 0
const CHAN2 ; 1

0
constants/battle_tower_constants.asm Executable file → Normal file
View File

0
constants/cry_constants.asm Executable file → Normal file
View File

View File

@ -35,7 +35,7 @@ const_value = 1
const YELLOW_CARPET
const GREEN_CARPET
; DoDecorationAction2.DecoActions indexes (see engine/decorations.asm)
; DoDecorationAction2.DecoActions indexes (see engine/overworld/decorations.asm)
const_value = 1
const SET_UP_BED
const PUT_AWAY_BED
@ -64,41 +64,41 @@ ENDM
; - DecorationIDs (see data/decorations/decorations.asm)
const_value = 1
__enum__ = 0
; FindOwnedBeds.beds values (see engine/decorations.asm)
; FindOwnedBeds.beds values (see engine/overworld/decorations.asm)
const BEDS
deco FEATHERY_BED
deco PINK_BED
deco POLKADOT_BED
deco PIKACHU_BED
; FindOwnedCarpets.carpets values (see engine/decorations.asm)
; FindOwnedCarpets.carpets values (see engine/overworld/decorations.asm)
const CARPETS
deco RED_CARPET
deco BLUE_CARPET
deco YELLOW_CARPET
deco GREEN_CARPET
; FindOwnedPlants.plants values (see engine/decorations.asm)
; FindOwnedPlants.plants values (see engine/overworld/decorations.asm)
const PLANTS
deco MAGNAPLANT
deco TROPICPLANT
deco JUMBOPLANT
; FindOwnedPosters.posters values (see engine/decorations.asm)
; FindOwnedPosters.posters values (see engine/overworld/decorations.asm)
const POSTERS
deco TOWN_MAP
deco PIKACHU_POSTER
deco CLEFAIRY_POSTER
deco JIGGLYPUFF_POSTER
; FindOwnedConsoles.consoles values (see engine/decorations.asm)
; FindOwnedConsoles.consoles values (see engine/overworld/decorations.asm)
const CONSOLES
deco FAMICOM
deco SNES
deco N64
deco VIRTUAL_BOY
; FindOwnedBigDolls.big_dolls values (see engine/decorations.asm)
; FindOwnedBigDolls.big_dolls values (see engine/overworld/decorations.asm)
const BIG_DOLLS
deco BIG_SNORLAX_DOLL
deco BIG_ONIX_DOLL
deco BIG_LAPRAS_DOLL
; FindOwnedOrnaments.ornaments values (see engine/decorations.asm)
; FindOwnedOrnaments.ornaments values (see engine/overworld/decorations.asm)
const DOLLS
deco PIKACHU_DOLL
deco SURF_PIKACHU_DOLL

View File

@ -1,4 +1,4 @@
; EngineFlags indexes (see engine/engine_flasg.asm)
; EngineFlags indexes (see engine/engine_flags.asm)
const_def
; wPokegearFlags
const ENGINE_RADIO_CARD

View File

@ -45,7 +45,7 @@ SPRITEOAMSTRUCT_LENGTH EQU const_value
NUM_SPRITE_OAM_STRUCTS EQU 40 ; see wVirtualOAM
; PokeAnims indexes (see engine/pic_animation.asm)
; PokeAnims indexes (see engine/gfx/pic_animation.asm)
const_def
const ANIM_MON_SLOW
const ANIM_MON_NORMAL

View File

@ -3,7 +3,7 @@
; - ItemNames (see data/items/names.asm)
; - ItemDescriptions (see data/items/descriptions.asm)
; - ItemAttributes (see data/items/attributes.asm)
; - ItemEffects (see engine/item_effects.asm)
; - ItemEffects (see engine/items/item_effects.asm)
const_def
const NO_ITEM ; 00
const MASTER_BALL ; 01

View File

@ -17,8 +17,8 @@ ITEMATTR_STRUCT_LENGTH EQU const_value
const TM_HM ; 4
; item menu types
; UseItem.dw indexes (see engine/pack.asm)
; UseRegisteredItem.SwitchTo indexes (see engine/select_menu.asm)
; UseItem.dw indexes (see engine/items/pack.asm)
; UseRegisteredItem.SwitchTo indexes (see engine/overworld/select_menu.asm)
ITEMMENU_NOUSE EQU 0
ITEMMENU_CURRENT EQU 4
ITEMMENU_PARTY EQU 5
@ -130,7 +130,7 @@ MAIL_STRUCT_LENGTH EQU $2f ; mailmsg struct
const HELD_FOCUS_BAND
; mart types (see engine/mart.asm)
; mart types (see engine/items/mart.asm)
const_def
const MARTTYPE_STANDARD
const MARTTYPE_BITTER

View File

@ -103,6 +103,6 @@ const_value = -1
NUM_SPAWNS EQU const_value
; outdoor sprite limits (see engine/overworld.asm)
; outdoor sprite limits (see engine/overworld/overworld.asm)
MAX_OUTDOOR_SPRITES EQU 23
SPRITE_GFX_LIST_CAPACITY EQU $20

View File

@ -121,7 +121,7 @@ MAPOBJECT_SCREEN_WIDTH EQU 12
NUM_SPRITEMOVEDATA EQU const_value
SPRITEMOVEDATA_FIELDS EQU 6
; MapObjectMovementPattern.Pointers indexes (see engine/map_objects.asm)
; MapObjectMovementPattern.Pointers indexes (see engine/overworld/map_objects.asm)
const_def
const SPRITEMOVEFN_00 ; 00
const SPRITEMOVEFN_RANDOM_WALK_Y ; 01
@ -152,7 +152,7 @@ SPRITEMOVEDATA_FIELDS EQU 6
const SPRITEMOVEFN_BOULDERDUST ; 1a
const SPRITEMOVEFN_GRASS ; 1b
; StepTypesJumptable indexes (see engine/map_objects.asm)
; StepTypesJumptable indexes (see engine/overworld/map_objects.asm)
const_def
const STEP_TYPE_00 ; 00
const STEP_TYPE_SLEEP ; 01
@ -181,7 +181,7 @@ SPRITEMOVEDATA_FIELDS EQU 6
const STEP_TYPE_18 ; 18
const STEP_TYPE_SKYFALL_TOP ; 19
; ObjectActionPairPointers indexes (see engine/map_object_action.asm)
; ObjectActionPairPointers indexes (see engine/overworld/map_object_action.asm)
const_def
const OBJECT_ACTION_00 ; 00
const OBJECT_ACTION_STAND ; 01
@ -237,7 +237,7 @@ SPRITEMOVEDATA_FIELDS EQU 6
const FACING_GRASS_2 ; 1f
; DoPlayerMovement.DoStep arguments (see engine/player_movement.asm)
; DoPlayerMovement.DoStep arguments (see engine/overworld/player_movement.asm)
const_def
const STEP_SLOW ; 0
const STEP_WALK ; 1

View File

@ -14,7 +14,7 @@
const MAPSETUP_BADWARP ; fb
const MAPSETUP_FLY ; fc
; MapSetupCommands indexes (see engine/map_setup.asm)
; MapSetupCommands indexes (see engine/overworld/map_setup.asm)
; Names taken from Condensation water's scripting compendium
; https://hax.iimarck.us/files/scriptingcodes_eng.htm
const_def

View File

@ -34,7 +34,7 @@
; MonMenuOptions indexes (see data/mon_menu.asm)
; used by PokemonActionSubmenu (see engine/start_menu.asm)
; used by PokemonActionSubmenu (see engine/menus/start_menu.asm)
const_def 1
; moves
const MONMENUITEM_CUT ; 1
@ -83,7 +83,7 @@ HMENURETURN_ASM EQU %11111111
const PARTYMENUACTION_GIVE_MON_FEMALE ; unused
const PARTYMENUACTION_GIVE_ITEM
const PARTYMENUACTION_MOBILE ; mobile
; PrintPartyMenuActionText arguments (see engine/party_menu.asm)
; PrintPartyMenuActionText arguments (see engine/pokemon/party_menu.asm)
const_def $f0
const PARTYMENUTEXT_HEAL_PSN
const PARTYMENUTEXT_HEAL_BRN

0
constants/printer_constants.asm Executable file → Normal file
View File

View File

@ -1,8 +1,8 @@
; radio channel ids
; indexes for:
; - RadioChannelSongs (see data/radio/channel_music.asm)
; - PlayRadioShow/RadioJumptable (see engine/radio.asm)
; - RadioChannels (see engine/radio.asm)
; - PlayRadioShow/RadioJumptable (see engine/pokegear/radio.asm)
; - RadioChannels (see engine/pokegear/radio.asm)
const_def
const OAKS_POKEMON_TALK ; 00
const POKEDEX_SHOW ; 01
@ -94,7 +94,7 @@
const POKEDEX_SHOW_7 ; 56
const POKEDEX_SHOW_8 ; 57
; PlayRadio.StationPointers indexes (see engine/pokegear.asm)
; PlayRadio.StationPointers indexes (see engine/pokegear/pokegear.asm)
const_def
const MAPRADIO_POKEMON_CHANNEL
const MAPRADIO_OAKS_POKEMON_TALK
@ -106,7 +106,7 @@
const MAPRADIO_LETS_ALL_SING
const MAPRADIO_ROCKET
; These tables in engine/radio.asm are all sized to a power of 2
; These tables in engine/pokegear/radio.asm are all sized to a power of 2
; so there's no need for a rejection sampling loop
NUM_OAKS_POKEMON_TALK_ADVERBS EQU 16 ; OaksPKMNTalk8.Adverbs
NUM_OAKS_POKEMON_TALK_ADJECTIVES EQU 16 ; OaksPKMNTalk9.Adjectives
@ -117,7 +117,7 @@ NUM_PNP_PLACES_ADJECTIVES EQU 16 ; PeoplePlaces7.Adjectives
NUM_PASSWORD_CATEGORIES EQU 11
NUM_PASSWORDS_PER_CATEGORY EQU 3
; GetBuenasPassword.StringFunctionJumpTable indexes (see engine/radio.asm)
; GetBuenasPassword.StringFunctionJumpTable indexes (see engine/pokegear/radio.asm)
const_def
const BUENA_MON
const BUENA_ITEM

4
constants/scgb_constants.asm Executable file → Normal file
View File

@ -1,4 +1,4 @@
; GetSGBLayout arguments (see engine/cgb_layouts.asm and engine/sgb_layouts.asm)
; GetSGBLayout arguments (see engine/gfx/cgb_layouts.asm and engine/gfx/sgb_layouts.asm)
const_def
const SCGB_BATTLE_GRAYSCALE
const SCGB_BATTLE_COLORS
@ -36,7 +36,7 @@ SCGB_PARTY_MENU_HP_PALS EQU -4
SCGB_RAM EQU -1
; PredefPals indexes (see gfx/sgb/predef.pal)
; GetPredefPal arguments (see engine/color.asm)
; GetPredefPal arguments (see engine/gfx/color.asm)
const_def
const PREDEFPAL_00
const PREDEFPAL_PALLET

View File

@ -38,7 +38,7 @@ NUM_MEM_BUFFERS EQU const_value
; writecode/checkcode arguments
; _GetVarAction.VarActionTable indexes (see engine/variables.asm)
; _GetVarAction.VarActionTable indexes (see engine/overworld/variables.asm)
const_def
const VAR_STRINGBUFFER2 ; 00
const VAR_PARTYCOUNT ; 01
@ -75,7 +75,7 @@ RETVAR_ADDR_DE EQU (1 << 6)
RETVAR_EXECUTE EQU (2 << 6)
; PlayerEventScriptPointers indexes (see engine/events.asm)
; PlayerEventScriptPointers indexes (see engine/overworld/events.asm)
const_def -1
const PLAYEREVENT_MAPSCRIPT
const PLAYEREVENT_NONE
@ -92,7 +92,7 @@ NUM_PLAYER_EVENTS EQU const_value
; bg_event types
; TryBGEvent arguments (see engine/events.asm)
; TryBGEvent arguments (see engine/overworld/events.asm)
const_def
const BGEVENT_READ
const BGEVENT_UP
@ -105,7 +105,7 @@ NUM_PLAYER_EVENTS EQU const_value
const BGEVENT_COPY
; object_event types
; TryObjectEvent arguments (see engine/events.asm)
; TryObjectEvent arguments (see engine/overworld/events.asm)
const_def
const OBJECTTYPE_SCRIPT
const OBJECTTYPE_ITEMBALL
@ -203,7 +203,7 @@ EMOTE_MEM EQU -1
NUM_FRUIT_TREES EQU const_value + -1
; describedecoration arguments
; DescribeDecoration.JumpTable indexes (see engine/decorations.asm)
; DescribeDecoration.JumpTable indexes (see engine/overworld/decorations.asm)
const_def
const DECODESC_POSTER ; 0
const DECODESC_LEFT_DOLL ; 1
@ -259,7 +259,7 @@ NUM_FRUIT_TREES EQU const_value + -1
const HEALMACHINE_HALL_OF_FAME ; 2
; UnownPuzzle writebyte arguments
; LoadUnownPuzzlePiecesGFX.LZPointers indexes (see engine/unown_puzzle.asm)
; LoadUnownPuzzlePiecesGFX.LZPointers indexes (see engine/games/unown_puzzle.asm)
const_def
const UNOWNPUZZLE_KABUTO ; 0
const UNOWNPUZZLE_OMANYTE ; 1

View File

@ -67,7 +67,7 @@ NUM_SPRITE_ANIM_STRUCTS EQU 10 ; see wSpriteAnimationStructs
const SPRITE_ANIM_INDEX_INTRO_SUICUNE_AWAY ; 2b
const SPRITE_ANIM_INDEX_CELEBI ; 2c
; DoAnimFrame.Jumptable indexes (see engine/sprite_anims.asm)
; DoAnimFrame.Jumptable indexes (see engine/gfx/sprite_anims.asm)
const_def
const SPRITE_ANIM_SEQ_NULL ; 00
const SPRITE_ANIM_SEQ_PARTY_MON ; 01

View File

@ -144,7 +144,7 @@ SPRITE_POKEMON EQU const_value
const SPRITE_LUGIA ; a1
const SPRITE_HO_OH ; a2
; special GetMonSprite values (see engine/overworld.asm)
; special GetMonSprite values (see engine/overworld/overworld.asm)
const_def $e0
const SPRITE_DAY_CARE_MON_1 ; e0
const SPRITE_DAY_CARE_MON_2 ; e1

View File

@ -36,7 +36,7 @@ TEXTBOX_INNERY EQU TEXTBOX_Y + 2
const PRINTNUM_RIGHTALIGN_F ; 6
const PRINTNUM_LEADINGZEROS_F ; 7
; PrintNum arguments (see engine/printnum.asm)
; PrintNum arguments (see engine/math/print_num.asm)
PRINTNUM_MONEY EQU 1 << PRINTNUM_MONEY_F
PRINTNUM_RIGHTALIGN EQU 1 << PRINTNUM_RIGHTALIGN_F
PRINTNUM_LEADINGZEROS EQU 1 << PRINTNUM_LEADINGZEROS_F

View File

@ -14,10 +14,10 @@ BattleCommandPointers: ; 3fd28
dw BattleCommand_DamageVariation ; 34cfd
dw BattleCommand_CheckHit ; 34d32
dw BattleCommand_LowerSub ; 34eee
dw BattleCommand_HitTargetNoSub ; 34f60
dw BattleCommand_MoveAnimNoSub ; 34f60
dw BattleCommand_RaiseSub ; 35004
dw BattleCommand_FailureText ; 35023
dw BattleCommand_CheckFaint ; 3505e
dw BattleCommand_ApplyDamage ; 3505e
dw BattleCommand_CriticalText ; 35175
dw BattleCommand_SuperEffectiveText ; 351ad
dw BattleCommand_CheckDestinyBond ; 351c0
@ -168,13 +168,13 @@ BattleCommandPointers: ; 3fd28
dw BattleCommand_RageDamage ; 3527b
dw BattleCommand_ResetTypeMatchup ; 34833
dw BattleCommand_AllStatsUp ; 36500
dw BattleCommanda5 ; 35165
dw BattleCommand_BideFailText ; 35165
dw BattleCommand_RaiseSubNoAnim ; 365af
dw BattleCommand_LowerSubNoAnim ; 365c3
dw BattleCommanda8 ; 355b5
dw BattleCommand_BeatUpFailText ; 355b5
dw BattleCommand_ClearMissDamage ; 355d5 - a9
dw BattleCommand_MoveDelay ; 37e80
dw BattleCommand_HitTarget ; 34f57
dw BattleCommand_MoveAnim ; 34f57
dw BattleCommand_TriStatusChance ; 3658f
dw BattleCommand_SuperEffectiveLoopText ; 351a5
dw BattleCommand_StartLoop ; 35197

0
data/battle_anims/framesets.asm Executable file → Normal file
View File

0
data/battle_anims/oam.asm Executable file → Normal file
View File

0
data/battle_anims/object_gfx.asm Executable file → Normal file
View File

0
data/battle_anims/objects.asm Executable file → Normal file
View File

0
data/battle_tower/unknown.asm Executable file → Normal file
View File

View File

@ -10,9 +10,9 @@ NormalHit:
stab
damagevariation
checkhit
hittarget
moveanim
failuretext
checkfaint
applydamage
criticaltext
supereffectivetext
checkdestinybond
@ -40,9 +40,9 @@ PoisonHit:
damagevariation
checkhit
effectchance
hittarget
moveanim
failuretext
checkfaint
applydamage
criticaltext
supereffectivetext
checkdestinybond
@ -60,9 +60,9 @@ LeechHit:
stab
damagevariation
checkhit
hittarget
moveanim
failuretext
checkfaint
applydamage
criticaltext
supereffectivetext
draintarget
@ -82,9 +82,9 @@ BurnHit:
damagevariation
checkhit
effectchance
hittarget
moveanim
failuretext
checkfaint
applydamage
criticaltext
supereffectivetext
checkdestinybond
@ -103,9 +103,9 @@ FreezeHit:
damagevariation
checkhit
effectchance
hittarget
moveanim
failuretext
checkfaint
applydamage
criticaltext
supereffectivetext
checkdestinybond
@ -124,9 +124,9 @@ ParalyzeHit:
damagevariation
checkhit
effectchance
hittarget
moveanim
failuretext
checkfaint
applydamage
criticaltext
supereffectivetext
checkdestinybond
@ -145,9 +145,9 @@ Selfdestruct:
damagevariation
checkhit
selfdestruct
hittargetnosub
moveanimnosub
failuretext
checkfaint
applydamage
criticaltext
supereffectivetext
checkdestinybond
@ -165,9 +165,9 @@ DreamEater:
stab
damagevariation
checkhit
hittarget
moveanim
failuretext
checkfaint
applydamage
criticaltext
supereffectivetext
eatdream
@ -544,9 +544,9 @@ AttackDownHit:
damagevariation
checkhit
effectchance
hittarget
moveanim
failuretext
checkfaint
applydamage
criticaltext
supereffectivetext
checkdestinybond
@ -566,9 +566,9 @@ DefenseDownHit:
damagevariation
checkhit
effectchance
hittarget
moveanim
failuretext
checkfaint
applydamage
criticaltext
supereffectivetext
checkdestinybond
@ -589,9 +589,9 @@ SpeedDownHit:
damagevariation
checkhit
effectchance
hittarget
moveanim
failuretext
checkfaint
applydamage
criticaltext
supereffectivetext
checkdestinybond
@ -611,9 +611,9 @@ SpecialAttackDownHit:
damagevariation
checkhit
effectchance
hittarget
moveanim
failuretext
checkfaint
applydamage
criticaltext
supereffectivetext
checkdestinybond
@ -633,9 +633,9 @@ SpecialDefenseDownHit:
damagevariation
checkhit
effectchance
hittarget
moveanim
failuretext
checkfaint
applydamage
criticaltext
supereffectivetext
checkdestinybond
@ -655,9 +655,9 @@ AccuracyDownHit:
damagevariation
checkhit
effectchance
hittarget
moveanim
failuretext
checkfaint
applydamage
criticaltext
supereffectivetext
checkdestinybond
@ -677,9 +677,9 @@ EvasionDownHit:
damagevariation
checkhit
effectchance
hittarget
moveanim
failuretext
checkfaint
applydamage
criticaltext
supereffectivetext
checkdestinybond
@ -699,9 +699,9 @@ DefenseUpHit:
damagevariation
checkhit
effectchance
hittarget
moveanim
failuretext
checkfaint
applydamage
criticaltext
supereffectivetext
checkdestinybond
@ -721,9 +721,9 @@ AttackUpHit:
damagevariation
checkhit
effectchance
hittarget
moveanim
failuretext
checkfaint
applydamage
criticaltext
supereffectivetext
checkdestinybond
@ -743,9 +743,9 @@ AllUpHit:
damagevariation
checkhit
effectchance
hittarget
moveanim
failuretext
checkfaint
applydamage
criticaltext
supereffectivetext
checkdestinybond
@ -763,9 +763,9 @@ PayDay:
stab
damagevariation
checkhit
hittarget
moveanim
failuretext
checkfaint
applydamage
criticaltext
supereffectivetext
payday
@ -796,9 +796,9 @@ Bide:
unleashenergy
resettypematchup
checkhit
hittarget
effect0xa5
checkfaint
moveanim
bidefailtext
applydamage
checkdestinybond
buildopponentrage
kingsrock
@ -817,9 +817,9 @@ Rampage:
stab
damagevariation
clearmissdamage
hittarget
moveanim
failuretext
checkfaint
applydamage
criticaltext
supereffectivetext
checkdestinybond
@ -848,9 +848,9 @@ MultiHit:
stab
damagevariation
clearmissdamage
hittargetnosub
moveanimnosub
failuretext
checkfaint
applydamage
criticaltext
cleartext
supereffectivelooptext
@ -875,9 +875,9 @@ PoisonMultiHit:
stab
damagevariation
clearmissdamage
hittargetnosub
moveanimnosub
failuretext
checkfaint
applydamage
criticaltext
cleartext
supereffectivelooptext
@ -900,9 +900,9 @@ FlinchHit:
damagevariation
checkhit
effectchance
hittarget
moveanim
failuretext
checkfaint
applydamage
criticaltext
supereffectivetext
checkdestinybond
@ -916,9 +916,9 @@ OHKOHit:
doturn
stab
ohko
hittarget
moveanim
failuretext
checkfaint
applydamage
criticaltext
supereffectivetext
checkdestinybond
@ -935,9 +935,9 @@ RecoilHit:
stab
damagevariation
checkhit
hittarget
moveanim
failuretext
checkfaint
applydamage
criticaltext
supereffectivetext
recoil
@ -980,9 +980,9 @@ ConfuseHit:
damagevariation
checkhit
effectchance
hittarget
moveanim
failuretext
checkfaint
applydamage
criticaltext
supereffectivetext
checkdestinybond
@ -1022,9 +1022,9 @@ TriAttack:
stab
damagevariation
checkhit
hittarget
moveanim
failuretext
checkfaint
applydamage
criticaltext
supereffectivetext
checkdestinybond
@ -1066,9 +1066,9 @@ SkyAttack:
damagevariation
checkhit
effectchance
hittarget
moveanim
failuretext
checkfaint
applydamage
criticaltext
supereffectivetext
checkdestinybond
@ -1094,9 +1094,9 @@ HyperBeam:
stab
damagevariation
checkhit
hittarget
moveanim
failuretext
checkfaint
applydamage
criticaltext
supereffectivetext
rechargenextturn
@ -1115,10 +1115,10 @@ Rage:
checkhit
ragedamage
damagevariation
hittarget
moveanim
failuretext
rage
checkfaint
applydamage
criticaltext
supereffectivetext
checkdestinybond
@ -1176,9 +1176,9 @@ RazorWind:
stab
damagevariation
checkhit
hittarget
moveanim
failuretext
checkfaint
applydamage
criticaltext
supereffectivetext
checkdestinybond
@ -1198,10 +1198,10 @@ Fly:
stab
damagevariation
checkhit
hittargetnosub
moveanimnosub
raisesub
failuretext
checkfaint
applydamage
criticaltext
supereffectivetext
checkdestinybond
@ -1220,9 +1220,9 @@ TrapTarget:
stab
damagevariation
clearmissdamage
hittarget
moveanim
failuretext
checkfaint
applydamage
criticaltext
supereffectivetext
checkdestinybond
@ -1239,9 +1239,9 @@ StaticDamage:
constantdamage
checkhit
resettypematchup
hittarget
moveanim
failuretext
checkfaint
applydamage
checkdestinybond
buildopponentrage
kingsrock
@ -1254,9 +1254,9 @@ Reversal:
constantdamage
stab
checkhit
hittarget
moveanim
failuretext
checkfaint
applydamage
supereffectivetext
checkdestinybond
buildopponentrage
@ -1268,9 +1268,9 @@ Counter:
usedmovetext
doturn
counter
hittarget
moveanim
failuretext
checkfaint
applydamage
checkdestinybond
buildopponentrage
kingsrock
@ -1304,9 +1304,9 @@ Snore:
checkhit
effectchance
snore
hittarget
moveanim
failuretext
checkfaint
applydamage
criticaltext
supereffectivetext
checkdestinybond
@ -1378,9 +1378,9 @@ FalseSwipe:
damagevariation
falseswipe
checkhit
hittarget
moveanim
failuretext
checkfaint
applydamage
criticaltext
supereffectivetext
checkdestinybond
@ -1409,9 +1409,9 @@ TripleKick:
stab
damagevariation
clearmissdamage
hittargetnosub
moveanimnosub
failuretext
checkfaint
applydamage
criticaltext
cleartext
supereffectivelooptext
@ -1434,9 +1434,9 @@ Thief:
damagevariation
checkhit
effectchance
hittarget
moveanim
failuretext
checkfaint
applydamage
criticaltext
supereffectivetext
thief
@ -1470,9 +1470,9 @@ FlameWheel:
damagevariation
checkhit
effectchance
hittarget
moveanim
failuretext
checkfaint
applydamage
criticaltext
supereffectivetext
defrost
@ -1543,9 +1543,9 @@ Rollout:
checkhit
rolloutpower
damagevariation
hittarget
moveanim
failuretext
checkfaint
applydamage
criticaltext
supereffectivetext
checkdestinybond
@ -1582,9 +1582,9 @@ FuryCutter:
checkhit
furycutter
damagevariation
hittarget
moveanim
failuretext
checkfaint
applydamage
criticaltext
supereffectivetext
checkdestinybond
@ -1611,9 +1611,9 @@ Return:
stab
damagevariation
checkhit
hittarget
moveanim
failuretext
checkfaint
applydamage
criticaltext
supereffectivetext
checkdestinybond
@ -1634,7 +1634,7 @@ Present:
damagevariation
clearmissdamage
failuretext
checkfaint
applydamage
criticaltext
supereffectivetext
checkdestinybond
@ -1653,9 +1653,9 @@ Frustration:
stab
damagevariation
checkhit
hittarget
moveanim
failuretext
checkfaint
applydamage
criticaltext
supereffectivetext
checkdestinybond
@ -1681,9 +1681,9 @@ SacredFire:
damagevariation
checkhit
effectchance
hittarget
moveanim
failuretext
checkfaint
applydamage
criticaltext
supereffectivetext
defrost
@ -1704,9 +1704,9 @@ Magnitude:
damagevariation
checkhit
doubleundergrounddamage
hittarget
moveanim
failuretext
checkfaint
applydamage
criticaltext
supereffectivetext
checkdestinybond
@ -1732,9 +1732,9 @@ Pursuit:
damagevariation
pursuit
checkhit
hittarget
moveanim
failuretext
checkfaint
applydamage
criticaltext
supereffectivetext
checkdestinybond
@ -1752,9 +1752,9 @@ RapidSpin:
stab
damagevariation
checkhit
hittarget
moveanim
failuretext
checkfaint
applydamage
criticaltext
supereffectivetext
clearhazards
@ -1794,9 +1794,9 @@ HiddenPower:
stab
damagevariation
checkhit
hittarget
moveanim
failuretext
checkfaint
applydamage
criticaltext
supereffectivetext
checkdestinybond
@ -1824,7 +1824,7 @@ FakeOut:
doturn
checkhit
fakeout
hittarget
moveanim
failuretext
endmove
@ -1847,9 +1847,9 @@ MirrorCoat:
usedmovetext
doturn
mirrorcoat
hittarget
moveanim
failuretext
checkfaint
applydamage
checkdestinybond
buildopponentrage
kingsrock
@ -1867,9 +1867,9 @@ SkullBash:
stab
damagevariation
checkhit
hittarget
moveanim
failuretext
checkfaint
applydamage
criticaltext
supereffectivetext
checkdestinybond
@ -1892,9 +1892,9 @@ Twister:
doubleflyingdamage
checkhit
effectchance
hittarget
moveanim
failuretext
checkfaint
applydamage
criticaltext
supereffectivetext
checkdestinybond
@ -1914,9 +1914,9 @@ Earthquake:
doubleundergrounddamage
checkhit
effectchance
hittarget
moveanim
failuretext
checkfaint
applydamage
criticaltext
supereffectivetext
checkdestinybond
@ -1933,9 +1933,9 @@ FutureSight:
futuresight
damagevariation ; skip here if last turn
checkhit
hittargetnosub
moveanimnosub
failuretext
checkfaint
applydamage
checkdestinybond
buildopponentrage
endmove
@ -1951,9 +1951,9 @@ Gust:
damagevariation
doubleflyingdamage
checkhit
hittarget
moveanim
failuretext
checkfaint
applydamage
criticaltext
supereffectivetext
checkdestinybond
@ -1972,9 +1972,9 @@ Stomp:
doubleminimizedamage
checkhit
effectchance
hittarget
moveanim
failuretext
checkfaint
applydamage
criticaltext
supereffectivetext
checkdestinybond
@ -1995,9 +1995,9 @@ Solarbeam:
stab
damagevariation
checkhit
hittarget
moveanim
failuretext
checkfaint
applydamage
criticaltext
supereffectivetext
checkdestinybond
@ -2017,9 +2017,9 @@ Thunder:
effectchance
stab
damagevariation
hittarget
moveanim
failuretext
checkfaint
applydamage
criticaltext
supereffectivetext
checkdestinybond
@ -2047,16 +2047,16 @@ BeatUp:
damagecalc
damagevariation
clearmissdamage
hittargetnosub
moveanimnosub
failuretext
checkfaint
applydamage
criticaltext
cleartext
supereffectivetext
checkdestinybond
buildopponentrage
endloop
effect0xa8
beatupfailtext
raisesub
kingsrock
endmove

0
data/sprite_anims/framesets.asm Executable file → Normal file
View File

0
data/sprites/map_objects.asm Executable file → Normal file
View File

0
data/trainers/class_names.asm Executable file → Normal file
View File

0
data/unused_53d84.asm Executable file → Normal file
View File

View File

@ -88,7 +88,7 @@ Temporarily creates sprites from the top row of the player backpic, so that the
## `$DB`: `anim_checkpokeball`
Sets `BattleAnimVar` to the result of [GetPokeBallWobble](/engine/battle_anims/getpokeballwobble.asm).
Sets `BattleAnimVar` to the result of [GetPokeBallWobble](/engine/battle_anims/pokeball_wobble.asm).
## `$DC`: `anim_transform`

View File

@ -15,6 +15,8 @@ These are known bugs and glitches in the original Pokémon Crystal game: code th
- [A Pokémon that fainted from Pursuit will have its old status condition when revived](#a-pokémon-that-fainted-from-pursuit-will-have-its-old-status-condition-when-revived)
- [Lock-On and Mind Reader don't always bypass Fly and Dig](#lock-on-and-mind-reader-dont-always-bypass-fly-and-dig)
- [Beat Up can desynchronize link battles](#beat-up-can-desynchronize-link-battles)
- [Beat Up may fail to raise substitute](#beat-up-may-fail-to-raise-substitute)
- [Beat Up may trigger King's Rock even if it failed](#beat-up-may-trigger-kings-rock-even-if-it-failed)
- [Present damage is incorrect in link battles](#present-damage-is-incorrect-in-link-battles)
- ["Smart" AI encourages Mean Look if its own Pokémon is badly poisoned](#smart-ai-encourages-mean-look-if-its-own-pokémon-is-badly-poisoned)
- [AI makes a false assumption about `CheckTypeMatchup`](#ai-makes-a-false-assumption-about-checktypematchup)
@ -339,6 +341,82 @@ This is a bug with `BattleCommand_BeatUp` in [engine/battle/move_effects/beat_up
**Fix:** Change `cp [hl]` to `cp c`.
## Beat Up may fail to raise substitute
*Fixing this bug will break compatibility with standard Pokémon Crystal for link battles.*
(Only the fixes denoted with "breaking" will actually break compatibility, the others just affect what's shown on the screen with the patched game)
This is a bug in `BattleCommand_EndLoop` in [engine/battle/effect_commands.asm](/engine/battle/effect_commands.asm) that prevents the rest of the move's effect from being executed if the player or enemy only has one mon in their party while using Beat Up.
It prevents the substitute from being raised and the King's Rock from working.
```asm
.only_one_beatup
ld a, BATTLE_VARS_SUBSTATUS3
call GetBattleVarAddr
res SUBSTATUS_IN_LOOP, [hl]
call BattleCommand_BeatUpFailText
jp EndMoveEffect
```
**Fix (breaking):** Replace the last two lines with `ret`.
**Fix (cosmetics):** Call `BattleCommand_RaiseSub` before the `jp`.
There's a similar oversight in `BattleCommand_FailureText` in [engine/battle/effect_commands.asm](/engine/battle/effect_commands.asm) that will prevent the substitute from being raised if Beat Up is protected against.
```asm
cp EFFECT_MULTI_HIT
jr z, .multihit
cp EFFECT_DOUBLE_HIT
jr z, .multihit
cp EFFECT_POISON_MULTI_HIT
jr z, .multihit
jp EndMoveEffect
.multihit
call BattleCommand_RaiseSub
jp EndMoveEffect
```
**Fix:** Check for `EFFECT_BEAT_UP` as well.
## Beat Up may trigger King's Rock even if it failed
*Fixing this bug will break compatibility with standard Pokémon Crystal for link battles.*
This is a bug in how `wAttackMissed` is never set by BeatUp, even when none of the 'mon have been able to attack (due to being fainted or having a status effect), the King's Rock may activate.
This bug can be fixed in a plethora of ways, but the most straight-forward would be in `BattleCommand_BeatUpFailText` in [engine/battle/move_effects/beat_up.asm](/engine/battle/move_effects/beat_up.asm), as that's always ran before the king's rock effect.
```asm
BattleCommand_BeatUpFailText: ; 355b5
; beatupfailtext
ld a, [wBeatUpHitAtLeastOnce]
and a
ret nz
jp PrintButItFailed
```
**Fix:**
```asm
BattleCommand_BeatUpFailText: ; 355b5
; beatupfailtext
ld a, [wBeatUpHitAtLeastOnce]
and a
ret nz
inc a
ld [wAttackMissed], a
jp PrintButItFailed
```
## Present damage is incorrect in link battles
*Fixing this bug will break compatibility with standard Pokémon Crystal for link battles.*
@ -490,7 +568,7 @@ This is a bug with `LongAnim_UpdateVariables` in [engine/battle/anim_hp_bar.asm]
([Video](https://www.youtube.com/watch?v=9KyNVIZxJvI))
This is a bug with `ShortHPBar_CalcPixelFrame` in [engine/anim_hp_bar.asm](/engine/anim_hp_bar.asm):
This is a bug with `ShortHPBar_CalcPixelFrame` in [engine/battle/anim_hp_bar.asm](/engine/battle/anim_hp_bar.asm):
```asm
ld b, 0
@ -519,7 +597,7 @@ This is a bug with `ShortHPBar_CalcPixelFrame` in [engine/anim_hp_bar.asm](/engi
This can bring Pokémon straight from level 1 to 100 by gaining just a few experience points.
This is a bug with `CalcExpAtLevel` in [engine/experience.asm](/engine/experience.asm):
This is a bug with `CalcExpAtLevel` in [engine/pokemon/experience.asm](/engine/pokemon/experience.asm):
```asm
CalcExpAtLevel: ; 50e47
@ -589,7 +667,7 @@ Text_StringBuffer2ExpPoints::
## BRN/PSN/PAR do not affect catch rate
This is a bug with `PokeBallEffect` in [engine/item_effects.asm](/engine/item_effects.asm):
This is a bug with `PokeBallEffect` in [engine/items/item_effects.asm](/engine/items/item_effects.asm):
```asm
; This routine is buggy. It was intended that SLP and FRZ provide a higher
@ -713,7 +791,7 @@ This is a bug with `ItemAttributes` in [data/items/attributes.asm](/data/items/a
## Daisy's grooming doesn't always increase happiness
This is a bug with `HaircutOrGrooming` in [engine/events/specials_2.asm](/engine/events/specials_2.asm):
This is a bug with `HaircutOrGrooming` in [engine/events/haircut.asm](/engine/events/haircut.asm):
```asm
; Bug: Subtracting $ff from $ff fails to set c.
@ -923,7 +1001,7 @@ This is a bug with `_HallOfFamePC.DisplayMonAndStrings` in [engine/events/hallof
([Video](https://www.youtube.com/watch?v=ojq3xqfRF6I))
This is a bug with `Slots_PayoutAnim` in [engine/slot_machine.asm](/engine/slot_machine.asm):
This is a bug with `Slots_PayoutAnim` in [engine/games/slot_machine.asm](/engine/games/slot_machine.asm):
```asm
.okay
@ -973,7 +1051,7 @@ This is a bug with `PlayBattleMusic` in [engine/battle/start_battle.asm](/engine
## No bump noise if standing on tile `$3E`
This is a bug with `DoPlayerMovement.CheckWarp` in [engine/player_movement.asm](/engine/player_movement.asm):
This is a bug with `DoPlayerMovement.CheckWarp` in [engine/overworld/player_movement.asm](/engine/overworld/player_movement.asm):
```asm
; Bug: Since no case is made for STANDING here, it will check
@ -1108,7 +1186,7 @@ In [home/map.asm](/home/map.asm):
This bug is why the Lapras in [maps/UnionCaveB2F.asm](/maps/UnionCaveB2F.asm), which uses `SPRITEMOVEDATA_SWIM_WANDER`, is not restricted by its `1, 1` movement radius.
In [engine/npc_movement.asm](/engine/npc_movement.asm):
In [engine/overworld/npc_movement.asm](/engine/overworld/npc_movement.asm):
```asm
ld hl, OBJECT_FLAGS1
@ -1126,7 +1204,7 @@ In [engine/npc_movement.asm](/engine/npc_movement.asm):
This bug can allow you to talk to Eusine in Celadon City and encounter Ho-Oh with only traded legendary beasts.
In [engine/search.asm](/engine/search.asm):
In [engine/pokemon/search.asm](/engine/pokemon/search.asm):
```asm
; check OT
@ -1157,7 +1235,7 @@ endr
This bug can affect Mew or Pokémon other than Ditto that used Transform via Mirror Move or Sketch.
This is a bug with `PokeBallEffect` in [engine/item_effects.asm](/engine/item_effects.asm):
This is a bug with `PokeBallEffect` in [engine/items/item_effects.asm](/engine/items/item_effects.asm):
```asm
ld hl, wEnemySubStatus5
@ -1229,7 +1307,7 @@ This is a bug with `PokeBallEffect` in [engine/item_effects.asm](/engine/item_ef
([Video](https://www.youtube.com/watch?v=v1ErZdLCIyU))
This is a bug with `PokeBallEffect` in [engine/item_effects.asm](/engine/item_effects.asm):
This is a bug with `PokeBallEffect` in [engine/items/item_effects.asm](/engine/items/item_effects.asm):
```asm
.room_in_party
@ -1254,7 +1332,7 @@ This is a bug with `PokeBallEffect` in [engine/item_effects.asm](/engine/item_ef
## `HELD_CATCH_CHANCE` has no effect
This is a bug with `PokeBallEffect` in [engine/item_effects.asm](/engine/item_effects.asm):
This is a bug with `PokeBallEffect` in [engine/items/item_effects.asm](/engine/items/item_effects.asm):
```asm
; BUG: farcall overwrites a, and GetItemHeldEffect takes b anyway.
@ -1281,7 +1359,7 @@ This is a bug with `PokeBallEffect` in [engine/item_effects.asm](/engine/item_ef
## Only the first three `EvosAttacks` evolution entries can have Stone compatibility reported correctly
This is a bug with `PlacePartyMonEvoStoneCompatibility.DetermineCompatibility` in [engine/party_menu.asm](/engine/party_menu.asm):
This is a bug with `PlacePartyMonEvoStoneCompatibility.DetermineCompatibility` in [engine/pokemon/party_menu.asm](/engine/pokemon/party_menu.asm):
```asm
.DetermineCompatibility: ; 50268
@ -1304,7 +1382,7 @@ This is a bug with `PlacePartyMonEvoStoneCompatibility.DetermineCompatibility` i
## `EVOLVE_STAT` can break Stone compatibility reporting
This is a bug with `PlacePartyMonEvoStoneCompatibility.DetermineCompatibility` in [engine/party_menu.asm](/engine/party_menu.asm):
This is a bug with `PlacePartyMonEvoStoneCompatibility.DetermineCompatibility` in [engine/pokemon/party_menu.asm](/engine/pokemon/party_menu.asm):
```asm
.loop2
@ -1337,7 +1415,7 @@ This is a bug with `PlacePartyMonEvoStoneCompatibility.DetermineCompatibility` i
## `ScriptCall` can overflow `wScriptStack` and crash
In [engine/scripting.asm](/engine/scripting.asm):
In [engine/overworld/scripting.asm](/engine/overworld/scripting.asm):
```asm
ScriptCall:
@ -1377,7 +1455,7 @@ ScriptCall:
## `LoadSpriteGFX` does not limit the capacity of `UsedSprites`
In [engine/overworld.asm](/engine/overworld.asm):
In [engine/overworld/overworld.asm](/engine/overworld/overworld.asm):
```asm
LoadSpriteGFX: ; 14306
@ -1414,7 +1492,7 @@ LoadSpriteGFX: ; 14306
## `ChooseWildEncounter` doesn't really validate the wild Pokémon species
In [engine/wildmons.asm](/engine/wildmons.asm):
In [engine/overworld/wildmons.asm](/engine/overworld/wildmons.asm):
```asm
ChooseWildEncounter: ; 2a14f
@ -1452,7 +1530,7 @@ ValidateTempWildMonSpecies: ; 2a4a0
## `TryObjectEvent` arbitrary code execution
In [engine/events.asm](/engine/events.asm):
In [engine/overworld/events.asm](/engine/overworld/events.asm):
```asm
; Bug: If IsInArray returns nc, data at bc will be executed as code.

View File

@ -25,7 +25,7 @@ dba_pic: MACRO ; dbw bank, address
ENDM
```
The offset is translated into a correct bank by `FixPicBank` in [engine/load_pics.asm](/engine/load_pics.asm):
The offset is translated into a correct bank by `FixPicBank` in [engine/gfx/load_pics.asm](/engine/gfx/load_pics.asm):
```asm
FixPicBank: ; 511c5
@ -107,7 +107,7 @@ ROMX $49
"Pics 2"
```
Two routines in [engine/load_pics.asm](/engine/load_pics.asm) make this assumption; `GetFrontpicPointer`:
Two routines in [engine/gfx/load_pics.asm](/engine/gfx/load_pics.asm) make this assumption; `GetFrontpicPointer`:
```asm
ld a, [wCurPartySpecies]
@ -295,7 +295,7 @@ Modify `Pokedex_LoadAnyFootprint`:
NUM_TMS = const_value - TM01 - 2 ; discount ITEM_C3 and ITEM_DC
```
`GetTMHMNumber` and `GetNumberedTMHM` in [engine/items.asm](/engine/items.asm) have to compensate for this:
`GetTMHMNumber` and `GetNumberedTMHM` in [engine/items/items.asm](/engine/items/items.asm) have to compensate for this:
```asm
GetTMHMNumber:: ; d407
@ -338,7 +338,7 @@ GetNumberedTMHM: ; d417
Move `ITEM_C3` and `ITEM_DC` above all the TMs in every table of item data.
Modify engine/items.asm:
Modify engine/items/items.asm:
```asm
GetTMHMNumber:: ; d407
@ -399,7 +399,7 @@ GetDexEntryPointer: ; 44333
db BANK(PokedexEntries4)
```
`GetPokedexEntryBank` in [engine/item_effects.asm](/engine/item_effects.asm):
`GetPokedexEntryBank` in [engine/items/item_effects.asm](/engine/items/item_effects.asm):
```asm
GetPokedexEntryBank:
@ -425,7 +425,7 @@ GetPokedexEntryBank:
db BANK(PokedexEntries4)
```
And `PokedexShow_GetDexEntryBank` in [engine/radio.asm](/engine/radio.asm):
And `PokedexShow_GetDexEntryBank` in [engine/pokegear/radio.asm](/engine/pokegear/radio.asm):
```asm
PokedexShow_GetDexEntryBank:
@ -457,7 +457,7 @@ PokedexShow_GetDexEntryBank:
## Identical sine wave code and data is repeated five times
`_Sine` in [engine/routines/sine.asm](/engine/routines/sine.asm):
`_Sine` in [engine/math/sine.asm](/engine/math/sine.asm):
```asm
_Sine:: ; 84d9
@ -466,7 +466,7 @@ _Sine:: ; 84d9
calc_sine_wave
```
`Sprites_Cosine` and `Sprites_Sine` in [engine/sprites.asm](/engine/sprites.asm):
`Sprites_Cosine` and `Sprites_Sine` in [engine/gfx/sprites.asm](/engine/gfx/sprites.asm):
```asm
Sprites_Cosine: ; 8e72a
@ -583,7 +583,7 @@ ENDM
## `GetForestTreeFrame` works, but it's still bad
In [engine/tileset_anims.asm](/engine/tileset_anims.asm):
In [engine/tilesets/tileset_anims.asm](/engine/tilesets/tileset_anims.asm):
```asm
GetForestTreeFrame: ; fc54c

View File

@ -1,6 +1,6 @@
# Event Commands
Defined in [macros/scripts/events.asm](/macros/scripts/events.asm) and [engine/scripting.asm:ScriptCommandTable](/engine/scripting.asm).
Defined in [macros/scripts/events.asm](/macros/scripts/events.asm) and [engine/overworld/scripting.asm:ScriptCommandTable](/engine/overworld/scripting.asm).
Until this document is filled out, the [G/S Scripting Compendium](https://hax.iimarckus.org/files/scriptingcodes_eng.htm) has descriptions for most of these commands. It was written for G/S binary hacking and not Crystal assembly hacking, so it's not 100% accurate for pokecrystal.

View File

@ -1,6 +1,6 @@
# Movement Commands
Defined in [macros/scripts/movement.asm](/macros/scripts/movement.asm) and [engine/movement.asm:MovementPointers](/engine/movement.asm).
Defined in [macros/scripts/movement.asm](/macros/scripts/movement.asm) and [engine/overworld/movement.asm:MovementPointers](/engine/overworld/movement.asm).
## `$00``$03`: <code>turn_head <i>direction</i></code>

0
engine/battle/ai/move.asm Executable file → Normal file
View File

0
engine/battle/ai/redundant.asm Executable file → Normal file
View File

0
engine/battle/ai/switch.asm Executable file → Normal file
View File

0
engine/battle/anim_hp_bar.asm Executable file → Normal file
View File

View File

@ -556,8 +556,8 @@ CheckEnemyTurn: ; 3421f
and 1 << SUBSTATUS_FLYING | 1 << SUBSTATUS_UNDERGROUND
call z, PlayFXAnimID
ld c, $1
call EnemyHurtItself
ld c, TRUE
call DoEnemyDamage
call BattleCommand_RaiseSub
call CantMove
jp EndTurn
@ -676,8 +676,8 @@ HitConfusion: ; 343a5
call CallBattleCore
ld a, $1
ld [hBGMapMode], a
ld c, $1
call PlayerHurtItself
ld c, TRUE
call DoPlayerDamage
jp BattleCommand_RaiseSub
; 343db
@ -2081,16 +2081,16 @@ BattleCommand_LowerSub: ; 34eee
; 34f57
BattleCommand_HitTarget: ; 34f57
; hittarget
BattleCommand_MoveAnim: ; 34f57
; moveanim
call BattleCommand_LowerSub
call BattleCommand_HitTargetNoSub
call BattleCommand_MoveAnimNoSub
jp BattleCommand_RaiseSub
; 34f60
BattleCommand_HitTargetNoSub: ; 34f60
BattleCommand_MoveAnimNoSub: ; 34f60
ld a, [wAttackMissed]
and a
jp nz, BattleCommand_MoveDelay
@ -2274,65 +2274,68 @@ BattleCommand_FailureText: ; 35023
; 3505e
BattleCommand_CheckFaint: ; 3505e
; checkfaint
BattleCommand_ApplyDamage: ; 3505e
; applydamage
ld a, BATTLE_VARS_SUBSTATUS1_OPP
call GetBattleVar
bit SUBSTATUS_ENDURE, a
jr z, .not_enduring
call BattleCommand_FalseSwipe
ld b, $0
jr nc, .okay
ld b, $1
jr .okay
jr z, .focus_band
.not_enduring
call BattleCommand_FalseSwipe
ld b, 0
jr nc, .damage
ld b, 1
jr .damage
.focus_band
call GetOpponentItem
ld a, b
cp HELD_FOCUS_BAND
ld b, $0
jr nz, .okay
ld b, 0
jr nz, .damage
call BattleRandom
cp c
jr nc, .okay
jr nc, .damage
call BattleCommand_FalseSwipe
ld b, $0
jr nc, .okay
ld b, $2
.okay
ld b, 0
jr nc, .damage
ld b, 2
.damage
push bc
call .check_sub
ld c, $0
call .update_damage_taken
ld c, FALSE
ld a, [hBattleTurn]
and a
jr nz, .damage_player
call EnemyHurtItself
call DoEnemyDamage
jr .done_damage
.damage_player
call PlayerHurtItself
call DoPlayerDamage
.done_damage
pop bc
ld a, b
and a
ret z
dec a
jr nz, .not_enduring2
jr nz, .focus_band_text
ld hl, EnduredText
jp StdBattleTextBox
.not_enduring2
.focus_band_text
call GetOpponentItem
ld a, [hl]
ld [wNamedObjectIndexBuffer], a
call GetItemName
ld hl, HungOnText
jp StdBattleTextBox
.check_sub
.update_damage_taken
ld a, BATTLE_VARS_SUBSTATUS4_OPP
call GetBattleVar
bit SUBSTATUS_SUBSTITUTE, a
@ -2341,10 +2344,10 @@ BattleCommand_CheckFaint: ; 3505e
ld de, wPlayerDamageTaken + 1
ld a, [hBattleTurn]
and a
jr nz, .damage_taken
jr nz, .got_damage_taken
ld de, wEnemyDamageTaken + 1
.damage_taken
.got_damage_taken
ld a, [wCurDamage + 1]
ld b, a
ld a, [de]
@ -2418,11 +2421,11 @@ GetFailureResultText: ; 350e4
ld a, $1
ld [wKickCounter], a
call LoadMoveAnim
ld c, $1
ld c, TRUE
ld a, [hBattleTurn]
and a
jp nz, EnemyHurtItself
jp PlayerHurtItself
jp nz, DoEnemyDamage
jp DoPlayerDamage
FailText_CheckOpponentProtect: ; 35157
ld a, BATTLE_VARS_SUBSTATUS1_OPP
@ -2437,7 +2440,7 @@ FailText_CheckOpponentProtect: ; 35157
; 35165
BattleCommanda5: ; 35165
BattleCommand_BideFailText: ; 35165
ld a, [wAttackMissed]
and a
ret z
@ -3620,15 +3623,13 @@ PlayFXAnimID: ; 35d08
ld c, 3
call DelayFrames
callfar PlayBattleAnim
ret
; 35d1c
EnemyHurtItself: ; 35d1c
DoEnemyDamage: ; 35d1c
ld hl, wCurDamage
ld a, [hli]
ld b, a
@ -3638,13 +3639,14 @@ EnemyHurtItself: ; 35d1c
ld a, c
and a
jr nz, .mimic_sub_check
jr nz, .ignore_substitute
ld a, [wEnemySubStatus4]
bit SUBSTATUS_SUBSTITUTE, a
jp nz, SelfInflictDamageToSubstitute
jp nz, DoSubstituteDamage
.mimic_sub_check
.ignore_substitute
; Substract wCurDamage from wEnemyMonHP.
; store original HP in little endian wBuffer3/4
ld a, [hld]
ld b, a
ld a, [wEnemyMonHP + 1]
@ -3657,19 +3659,18 @@ EnemyHurtItself: ; 35d1c
ld [wBuffer4], a
sbc b
ld [wEnemyMonHP], a
jr nc, .mimic_faint
jr nc, .no_underflow
ld a, [wBuffer4]
ld [hli], a
ld a, [wBuffer3]
ld [hl], a
xor a
ld hl, wEnemyMonHP
ld [hli], a
ld [hl], a
.mimic_faint
.no_underflow
ld hl, wEnemyMonMaxHP
ld a, [hli]
ld [wBuffer2], a
@ -3680,6 +3681,7 @@ EnemyHurtItself: ; 35d1c
ld [wBuffer6], a
ld a, [hl]
ld [wBuffer5], a
hlcoord 2, 2
xor a
ld [wWhichHPBar], a
@ -3690,7 +3692,7 @@ EnemyHurtItself: ; 35d1c
; 35d7e
PlayerHurtItself: ; 35d7e
DoPlayerDamage: ; 35d7e
ld hl, wCurDamage
ld a, [hli]
ld b, a
@ -3700,12 +3702,15 @@ PlayerHurtItself: ; 35d7e
ld a, c
and a
jr nz, .mimic_sub_check
jr nz, .ignore_substitute
ld a, [wPlayerSubStatus4]
bit SUBSTATUS_SUBSTITUTE, a
jp nz, SelfInflictDamageToSubstitute
.mimic_sub_check
jp nz, DoSubstituteDamage
.ignore_substitute
; Substract wCurDamage from wBattleMonHP.
; store original HP in little endian wBuffer3/4
; store new HP in little endian wBuffer5/6
ld a, [hld]
ld b, a
ld a, [wBattleMonHP + 1]
@ -3719,14 +3724,13 @@ PlayerHurtItself: ; 35d7e
sbc b
ld [wBattleMonHP], a
ld [wBuffer6], a
jr nc, .mimic_faint
jr nc, .no_underflow
ld a, [wBuffer4]
ld [hli], a
ld a, [wBuffer3]
ld [hl], a
xor a
ld hl, wBattleMonHP
ld [hli], a
ld [hl], a
@ -3734,14 +3738,15 @@ PlayerHurtItself: ; 35d7e
ld [hli], a
ld [hl], a
.mimic_faint
.no_underflow
ld hl, wBattleMonMaxHP
ld a, [hli]
ld [wBuffer2], a
ld a, [hl]
ld [wBuffer1], a
hlcoord 10, 9
ld a, $1
ld a, 1
ld [wWhichHPBar], a
predef AnimateHPBar
.did_no_damage
@ -3750,8 +3755,7 @@ PlayerHurtItself: ; 35d7e
; 35de0
SelfInflictDamageToSubstitute: ; 35de0
DoSubstituteDamage: ; 35de0
ld hl, SubTookDamageText
call StdBattleTextBox
@ -4136,6 +4140,7 @@ BattleCommand_EatDream: ; 36008
SapHealth: ; 36011
; Divide damage by 2, store it in hDividend
ld hl, wCurDamage
ld a, [hli]
srl a
@ -4145,10 +4150,11 @@ SapHealth: ; 36011
rr a
ld [hDividend + 1], a
or b
jr nz, .ok1
ld a, $1
jr nz, .at_least_one
ld a, 1
ld [hDividend + 1], a
.ok1
.at_least_one
ld hl, wBattleMonHP
ld de, wBattleMonMaxHP
ld a, [hBattleTurn]
@ -4157,12 +4163,16 @@ SapHealth: ; 36011
ld hl, wEnemyMonHP
ld de, wEnemyMonMaxHP
.battlemonhp
; Store current HP in little endian wBuffer3/4
ld bc, wBuffer4
ld a, [hli]
ld [bc], a
ld a, [hl]
dec bc
ld [bc], a
; Store max HP in little endian wBuffer1/2
ld a, [de]
dec bc
ld [bc], a
@ -4170,6 +4180,8 @@ SapHealth: ; 36011
ld a, [de]
dec bc
ld [bc], a
; Add hDividend to current HP and copy it to little endian wBuffer5/6
ld a, [hDividend + 1]
ld b, [hl]
add b
@ -4180,7 +4192,9 @@ SapHealth: ; 36011
adc b
ld [hli], a
ld [wBuffer6], a
jr c, .okay2
jr c, .max_hp
; Substract current HP from max HP (to see if we have more than max HP)
ld a, [hld]
ld b, a
ld a, [de]
@ -4191,8 +4205,10 @@ SapHealth: ; 36011
ld a, [de]
inc de
sbc b
jr nc, .okay3
.okay2
jr nc, .finish
.max_hp
; Load max HP into current HP and copy it to little endian wBuffer5/6
ld a, [de]
ld [hld], a
ld [wBuffer5], a
@ -4201,7 +4217,8 @@ SapHealth: ; 36011
ld [hli], a
ld [wBuffer6], a
inc de
.okay3
.finish
ld a, [hBattleTurn]
and a
hlcoord 10, 9
@ -5638,7 +5655,7 @@ CheckPlayerHasMonToSwitchTo: ; 36994
BattleCommand_EndLoop: ; 369b6
; endloop
; Loop back to the command before 'critical'.
; Loop back to 'critical'.
ld de, wPlayerRolloutCount
ld bc, wPlayerDamageTaken
@ -5701,7 +5718,7 @@ BattleCommand_EndLoop: ; 369b6
ld a, BATTLE_VARS_SUBSTATUS3
call GetBattleVarAddr
res SUBSTATUS_IN_LOOP, [hl]
call BattleCommanda8
call BattleCommand_BeatUpFailText
jp EndMoveEffect
.not_triple_kick
@ -5753,7 +5770,6 @@ BattleCommand_EndLoop: ; 369b6
ld [bc], a
ret
; Loop back to the command before 'critical'.
.loop_back_to_critical
ld a, [wBattleScriptBufferAddress + 1]
ld h, a

0
engine/battle/link_result.asm Executable file → Normal file
View File

0
engine/battle/menu.asm Executable file → Normal file
View File

0
engine/battle/move_effects/attract.asm Executable file → Normal file
View File

View File

@ -5,9 +5,11 @@ BattleCommand_BeatUp: ; 35461
ld a, [hBattleTurn]
and a
jp nz, .enemy_beats_up
ld a, [wPlayerSubStatus3]
bit SUBSTATUS_IN_LOOP, a
jr nz, .next_mon
ld c, 20
call DelayFrames
xor a
@ -51,11 +53,13 @@ BattleCommand_BeatUp: ; 35461
ld [wBeatUpHitAtLeastOnce], a
ld hl, BeatUpAttackText
call StdBattleTextBox
ld a, [wEnemyMonSpecies]
ld [wCurSpecies], a
call GetBaseData
ld a, [wBaseDefense]
ld c, a
push bc
ld a, MON_SPECIES
call GetBeatupMonLocation
@ -65,12 +69,14 @@ BattleCommand_BeatUp: ; 35461
ld a, [wBaseAttack]
pop bc
ld b, a
push bc
ld a, MON_LEVEL
call GetBeatupMonLocation
ld a, [hl]
ld e, a
pop bc
ld a, [wPlayerMoveStructPower]
ld d, a
ret
@ -78,21 +84,22 @@ BattleCommand_BeatUp: ; 35461
.enemy_beats_up
ld a, [wEnemySubStatus3]
bit SUBSTATUS_IN_LOOP, a
jr nz, .not_first_enemy_beatup
jr nz, .enemy_next_mon
xor a
ld [wEnemyRolloutCount], a
ld [wd002], a
ld [wBeatUpHitAtLeastOnce], a
jr .enemy_continue
jr .enemy_got_mon
.not_first_enemy_beatup
.enemy_next_mon
ld a, [wEnemyRolloutCount]
ld b, a
ld a, [wOTPartyCount]
sub b
ld [wd002], a
.enemy_continue
.enemy_got_mon
ld a, [wBattleMode]
dec a
jr z, .wild
@ -122,19 +129,20 @@ BattleCommand_BeatUp: ; 35461
call AddNTimes
ld de, wStringBuffer1
call CopyBytes
.got_enemy_nick
ld a, MON_HP
call GetBeatupMonLocation
ld a, [hli]
or [hl]
jp z, .beatup_fail
ld a, [wd002]
ld b, a
ld a, [wCurOTMon]
cp b
ld hl, wEnemyMonStatus
jr z, .active_enemy
ld a, MON_STATUS
call GetBeatupMonLocation
.active_enemy
@ -157,11 +165,13 @@ BattleCommand_BeatUp: ; 35461
.finish_beatup
ld hl, BeatUpAttackText
call StdBattleTextBox
ld a, [wBattleMonSpecies]
ld [wCurSpecies], a
call GetBaseData
ld a, [wBaseDefense]
ld c, a
push bc
ld a, MON_SPECIES
call GetBeatupMonLocation
@ -171,12 +181,14 @@ BattleCommand_BeatUp: ; 35461
ld a, [wBaseAttack]
pop bc
ld b, a
push bc
ld a, MON_LEVEL
call GetBeatupMonLocation
ld a, [hl]
ld e, a
pop bc
ld a, [wEnemyMoveStructPower]
ld d, a
ret
@ -191,7 +203,9 @@ BattleCommand_BeatUp: ; 35461
; 355b5
BattleCommanda8: ; 355b5
BattleCommand_BeatUpFailText: ; 355b5
; beatupfailtext
ld a, [wBeatUpHitAtLeastOnce]
and a
ret nz

View File

@ -1,6 +1,8 @@
BattleCommand_FalseSwipe: ; 35c94
; falseswipe
; Makes sure wCurDamage < MonHP
ld hl, wEnemyMonHP
ld a, [hBattleTurn]
and a
@ -15,12 +17,14 @@ BattleCommand_FalseSwipe: ; 35c94
pop de
pop hl
jr c, .done
ld a, [hli]
ld [de], a
inc de
ld a, [hl]
dec a
ld [de], a
inc a
jr nz, .okay
dec de
@ -28,11 +32,13 @@ BattleCommand_FalseSwipe: ; 35c94
dec a
ld [de], a
.okay
ld a, [wCriticalHit]
cp 2
jr nz, .carry
xor a
ld [wCriticalHit], a
.carry
scf
ret

0
engine/battle/move_effects/present.asm Executable file → Normal file
View File

0
engine/battle/move_effects/transform.asm Executable file → Normal file
View File

0
engine/battle/read_trainer_party.asm Executable file → Normal file
View File

0
engine/battle/sliding_intro.asm Executable file → Normal file
View File

0
engine/battle/trainer_huds.asm Executable file → Normal file
View File

0
engine/battle/used_move_text.asm Executable file → Normal file
View File

0
engine/battle_anims/core.asm Executable file → Normal file
View File

0
engine/battle_anims/functions.asm Executable file → Normal file
View File

0
engine/battle_anims/helpers.asm Executable file → Normal file
View File

0
engine/events/basement_key.asm Executable file → Normal file
View File

0
engine/events/battle_tower/battle_tower.asm Executable file → Normal file
View File

0
engine/events/battle_tower/trainer_text.asm Executable file → Normal file
View File

0
engine/events/bug_contest/contest_2.asm Executable file → Normal file
View File

0
engine/events/bug_contest/judging.asm Executable file → Normal file
View File

0
engine/events/card_key.asm Executable file → Normal file
View File

0
engine/events/celebi.asm Executable file → Normal file
View File

0
engine/events/daycare.asm Executable file → Normal file
View File

0
engine/events/elevator.asm Executable file → Normal file
View File

0
engine/events/field_moves.asm Executable file → Normal file
View File

0
engine/events/forced_movement.asm Executable file → Normal file
View File

82
engine/events/haircut.asm Normal file
View File

@ -0,0 +1,82 @@
BillsGrandfather: ; 73f7
farcall SelectMonFromParty
jr c, .cancel
ld a, [wCurPartySpecies]
ld [wScriptVar], a
ld [wNamedObjectIndexBuffer], a
call GetPokemonName
jp CopyPokemonName_Buffer1_Buffer3
.cancel
xor a
ld [wScriptVar], a
ret
YoungerHaircutBrother: ; 7413
ld hl, HappinessData_YoungerHaircutBrother
jr HaircutOrGrooming
OlderHaircutBrother: ; 7418
ld hl, HappinessData_OlderHaircutBrother
jr HaircutOrGrooming
DaisysGrooming: ; 741d
ld hl, HappinessData_DaisysGrooming
; fallthrough
HaircutOrGrooming: ; 7420
push hl
farcall SelectMonFromParty
pop hl
jr c, .nope
ld a, [wCurPartySpecies]
cp EGG
jr z, .egg
push hl
call GetCurNick
call CopyPokemonName_Buffer1_Buffer3
pop hl
call Random
; Bug: Subtracting $ff from $ff fails to set c.
; This can result in overflow into the next data array.
; In the case of getting a grooming from Daisy, we bleed
; into CopyPokemonName_Buffer1_Buffer3, which passes
; $d0 to ChangeHappiness and returns $73 to the script.
; The end result is that there is a 0.4% chance your
; Pokemon's happiness will not change at all.
.loop
sub [hl]
jr c, .ok
inc hl
inc hl
inc hl
jr .loop
.ok
inc hl
ld a, [hli]
ld [wScriptVar], a
ld c, [hl]
call ChangeHappiness
ret
.nope
xor a
ld [wScriptVar], a
ret
.egg
ld a, 1
ld [wScriptVar], a
ret
INCLUDE "data/events/happiness_probabilities.asm"
CopyPokemonName_Buffer1_Buffer3: ; 746e
ld hl, wStringBuffer1
ld de, wStringBuffer3
ld bc, MON_NAME_LENGTH
jp CopyBytes
DummyPredef1: ; 747a
ret

0
engine/events/halloffame.asm Executable file → Normal file
View File

0
engine/events/happiness_egg.asm Executable file → Normal file
View File

0
engine/events/heal_machine_anim.asm Executable file → Normal file
View File

0
engine/events/itemfinder.asm Executable file → Normal file
View File

0
engine/events/magnet_train.asm Executable file → Normal file
View File

0
engine/events/misc_scripts.asm Executable file → Normal file
View File

0
engine/events/mom_phone.asm Executable file → Normal file
View File

0
engine/money.asm → engine/events/money.asm Executable file → Normal file
View File

0
engine/events/npc_trade.asm Executable file → Normal file
View File

0
engine/events/overworld.asm Executable file → Normal file
View File

0
engine/events/poisonstep.asm Executable file → Normal file
View File

0
engine/events/pokecenter_pc.asm Executable file → Normal file
View File

0
engine/events/pokepic.asm Executable file → Normal file
View File

0
engine/events/print_photo.asm Executable file → Normal file
View File

0
engine/events/prof_oaks_pc.asm Executable file → Normal file
View File

0
engine/events/sacred_ash.asm Executable file → Normal file
View File

View File

@ -140,86 +140,3 @@ ReturnShuckle: ; 737e
ld a, SHUCKIE_FAINTED
ld [wScriptVar], a
ret
BillsGrandfather: ; 73f7
farcall SelectMonFromParty
jr c, .cancel
ld a, [wCurPartySpecies]
ld [wScriptVar], a
ld [wNamedObjectIndexBuffer], a
call GetPokemonName
jp CopyPokemonName_Buffer1_Buffer3
.cancel
xor a
ld [wScriptVar], a
ret
YoungerHaircutBrother: ; 7413
ld hl, HappinessData_YoungerHaircutBrother
jr HaircutOrGrooming
OlderHaircutBrother: ; 7418
ld hl, HappinessData_OlderHaircutBrother
jr HaircutOrGrooming
DaisysGrooming: ; 741d
ld hl, HappinessData_DaisysGrooming
; fallthrough
HaircutOrGrooming: ; 7420
push hl
farcall SelectMonFromParty
pop hl
jr c, .nope
ld a, [wCurPartySpecies]
cp EGG
jr z, .egg
push hl
call GetCurNick
call CopyPokemonName_Buffer1_Buffer3
pop hl
call Random
; Bug: Subtracting $ff from $ff fails to set c.
; This can result in overflow into the next data array.
; In the case of getting a grooming from Daisy, we bleed
; into CopyPokemonName_Buffer1_Buffer3, which passes
; $d0 to ChangeHappiness and returns $73 to the script.
; The end result is that there is a 0.4% chance your
; Pokemon's happiness will not change at all.
.loop
sub [hl]
jr c, .ok
inc hl
inc hl
inc hl
jr .loop
.ok
inc hl
ld a, [hli]
ld [wScriptVar], a
ld c, [hl]
call ChangeHappiness
ret
.nope
xor a
ld [wScriptVar], a
ret
.egg
ld a, 1
ld [wScriptVar], a
ret
INCLUDE "data/events/happiness_probabilities.asm"
CopyPokemonName_Buffer1_Buffer3: ; 746e
ld hl, wStringBuffer1
ld de, wStringBuffer3
ld bc, MON_NAME_LENGTH
jp CopyBytes
DummyPredef1: ; 747a
ret

0
engine/events/squirtbottle.asm Executable file → Normal file
View File

0
engine/events/sweet_scent.asm Executable file → Normal file
View File

0
engine/events/treemons.asm Executable file → Normal file
View File

0
engine/events/whiteout.asm Executable file → Normal file
View File

0
engine/card_flip.asm → engine/games/card_flip.asm Executable file → Normal file
View File

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