You've already forked pokecrystal-board
mirror of
https://gitlab.com/xCrystal/pokecrystal-board.git
synced 2025-09-08 08:13:02 -07:00
Use maskbits some more
This commit is contained in:
@@ -56,7 +56,7 @@ AIChooseMove: ; 440ce
|
||||
inc hl
|
||||
ld a, [de]
|
||||
inc de
|
||||
and $3f
|
||||
and PP_MASK
|
||||
jr nz, .CheckMovePP
|
||||
ld [hl], 80
|
||||
jr .CheckMovePP
|
||||
@@ -186,7 +186,7 @@ AIChooseMove: ; 440ce
|
||||
.ChooseMove:
|
||||
ld hl, Buffer1
|
||||
call Random
|
||||
and 3
|
||||
maskbits NUM_MOVES +- 1
|
||||
ld c, a
|
||||
ld b, 0
|
||||
add hl, bc
|
||||
|
@@ -640,8 +640,8 @@ StartTrainerBattle_LoadPokeBallGraphics: ; 8c5dc (23:45dc)
|
||||
.cgb
|
||||
ld hl, .daypals
|
||||
ld a, [TimeOfDayPal]
|
||||
and $3
|
||||
cp 3
|
||||
maskbits NUM_DAYTIMES +- 1
|
||||
cp DARKNESS_F
|
||||
jr nz, .daytime
|
||||
ld hl, .nightpals
|
||||
.daytime
|
||||
|
@@ -730,7 +730,7 @@ HandleEncore: ; 3c4df
|
||||
ld b, 0
|
||||
add hl, bc
|
||||
ld a, [hl]
|
||||
and $3f
|
||||
and PP_MASK
|
||||
ret nz
|
||||
|
||||
.end_player_encore
|
||||
@@ -754,7 +754,7 @@ HandleEncore: ; 3c4df
|
||||
ld b, 0
|
||||
add hl, bc
|
||||
ld a, [hl]
|
||||
and $3f
|
||||
and PP_MASK
|
||||
ret nz
|
||||
|
||||
.end_enemy_encore
|
||||
@@ -1401,7 +1401,7 @@ HandleMysteryberry: ; 3c93c
|
||||
and a
|
||||
jr z, .quit
|
||||
ld a, [de]
|
||||
and $3f
|
||||
and PP_MASK
|
||||
jr z, .restore
|
||||
inc hl
|
||||
inc de
|
||||
@@ -5650,7 +5650,7 @@ MoveSelectionScreen: ; 3e4bc
|
||||
ld b, 0
|
||||
add hl, bc
|
||||
ld a, [hl]
|
||||
and $3f
|
||||
and PP_MASK
|
||||
jr z, .no_pp_left
|
||||
ld a, [PlayerDisableCount]
|
||||
swap a
|
||||
@@ -5849,7 +5849,7 @@ MoveInfoBox: ; 3e6c8
|
||||
ld hl, BattleMonPP
|
||||
add hl, bc
|
||||
ld a, [hl]
|
||||
and $3f
|
||||
and PP_MASK
|
||||
ld [StringBuffer1], a
|
||||
call .PrintPP
|
||||
|
||||
@@ -5912,7 +5912,7 @@ CheckPlayerHasUsableMoves: ; 3e786
|
||||
or [hl]
|
||||
inc hl
|
||||
or [hl]
|
||||
and $3f
|
||||
and PP_MASK
|
||||
ret nz
|
||||
jr .force_struggle
|
||||
|
||||
@@ -5934,8 +5934,7 @@ CheckPlayerHasUsableMoves: ; 3e786
|
||||
|
||||
.done
|
||||
; Bug: this will result in a move with PP Up confusing the game.
|
||||
; Replace with "and $3f" to fix.
|
||||
and a
|
||||
and a ; should be "and PP_MASK"
|
||||
ret nz
|
||||
|
||||
.force_struggle
|
||||
@@ -6014,7 +6013,7 @@ ParseEnemyAction: ; 3e7c1
|
||||
cp [hl]
|
||||
jr z, .disabled
|
||||
ld a, [de]
|
||||
and $3f
|
||||
and PP_MASK
|
||||
jr nz, .enough_pp
|
||||
|
||||
.disabled
|
||||
@@ -6032,7 +6031,7 @@ ParseEnemyAction: ; 3e7c1
|
||||
.loop2
|
||||
ld hl, EnemyMonMoves
|
||||
call BattleRandom
|
||||
and 3 ; TODO factor in NUM_MOVES
|
||||
maskbits NUM_MOVES +- 1
|
||||
ld c, a
|
||||
ld b, 0
|
||||
add hl, bc
|
||||
@@ -6049,7 +6048,7 @@ ParseEnemyAction: ; 3e7c1
|
||||
add hl, bc
|
||||
ld b, a
|
||||
ld a, [hl]
|
||||
and $3f
|
||||
and PP_MASK
|
||||
jr z, .loop2
|
||||
ld a, c
|
||||
ld [CurEnemyMoveNum], a
|
||||
|
@@ -846,19 +846,20 @@ BattleCommand_CheckObedience: ; 343db
|
||||
|
||||
|
||||
.DoNothing:
|
||||
; 4 random choices
|
||||
call BattleRandom
|
||||
and 3
|
||||
and %11
|
||||
|
||||
ld hl, LoafingAroundText
|
||||
and a
|
||||
and a ; 0
|
||||
jr z, .Print
|
||||
|
||||
ld hl, WontObeyText
|
||||
dec a
|
||||
dec a ; 1
|
||||
jr z, .Print
|
||||
|
||||
ld hl, TurnedAwayText
|
||||
dec a
|
||||
dec a ; 2
|
||||
jr z, .Print
|
||||
|
||||
ld hl, IgnoredOrdersText
|
||||
@@ -888,7 +889,7 @@ BattleCommand_CheckObedience: ; 343db
|
||||
|
||||
.GetTotalPP:
|
||||
ld a, [hli]
|
||||
and $3f ; exclude pp up
|
||||
and PP_MASK
|
||||
add b
|
||||
ld b, a
|
||||
|
||||
@@ -911,7 +912,7 @@ BattleCommand_CheckObedience: ; 343db
|
||||
|
||||
; Can't use another move if only one move has PP.
|
||||
ld a, [hl]
|
||||
and $3f
|
||||
and PP_MASK
|
||||
cp b
|
||||
jr z, .DoNothing
|
||||
|
||||
@@ -931,7 +932,7 @@ BattleCommand_CheckObedience: ; 343db
|
||||
|
||||
.RandomMove:
|
||||
call BattleRandom
|
||||
and 3 ; TODO NUM_MOVES
|
||||
maskbits NUM_MOVES +- 1
|
||||
|
||||
cp b
|
||||
jr nc, .RandomMove
|
||||
@@ -947,7 +948,7 @@ BattleCommand_CheckObedience: ; 343db
|
||||
ld d, 0
|
||||
add hl, de
|
||||
ld a, [hl]
|
||||
and $3f
|
||||
and PP_MASK
|
||||
jr z, .RandomMove
|
||||
|
||||
|
||||
@@ -1118,7 +1119,7 @@ BattleCommand_DoTurn: ; 34555
|
||||
ld b, 0
|
||||
add hl, bc
|
||||
ld a, [hl]
|
||||
and $3f
|
||||
and PP_MASK
|
||||
jr z, .out_of_pp
|
||||
dec [hl]
|
||||
ld b, 0
|
||||
@@ -3906,7 +3907,7 @@ BattleCommand_Encore: ; 35864
|
||||
ld bc, BattleMonPP - BattleMonMoves - 1
|
||||
add hl, bc
|
||||
ld a, [hl]
|
||||
and $3f
|
||||
and PP_MASK
|
||||
jp z, .failed
|
||||
ld a, [AttackMissed]
|
||||
and a
|
||||
@@ -4386,7 +4387,7 @@ BattleCommand_SleepTalk: ; 35b33
|
||||
.sample_move
|
||||
push hl
|
||||
call BattleRandom
|
||||
and 3 ; TODO factor in NUM_MOVES
|
||||
maskbits NUM_MOVES +- 1
|
||||
ld c, a
|
||||
ld b, 0
|
||||
add hl, bc
|
||||
@@ -4550,17 +4551,18 @@ BattleCommand_Spite: ; 35c0f
|
||||
add hl, bc
|
||||
pop bc
|
||||
ld a, [hl]
|
||||
and $3f
|
||||
and PP_MASK
|
||||
jr z, .failed
|
||||
push bc
|
||||
call GetMoveName
|
||||
; lose 2-5 PP
|
||||
call BattleRandom
|
||||
and 3
|
||||
and %11
|
||||
inc a
|
||||
inc a
|
||||
ld b, a
|
||||
ld a, [hl]
|
||||
and $3f
|
||||
and PP_MASK
|
||||
cp b
|
||||
jr nc, .deplete_pp
|
||||
ld b, a
|
||||
@@ -6208,13 +6210,12 @@ BattleCommand_TriStatusChance: ; 3658f
|
||||
|
||||
call BattleCommand_EffectChance
|
||||
|
||||
; 1/3 chance of each status
|
||||
.loop
|
||||
; 1/3 chance of each status
|
||||
call BattleRandom
|
||||
swap a
|
||||
and 3
|
||||
and %11
|
||||
jr z, .loop
|
||||
; jump
|
||||
dec a
|
||||
ld hl, .ptrs
|
||||
rst JumpTable
|
||||
@@ -7392,7 +7393,8 @@ BattleCommand_TrapTarget: ; 36c2d
|
||||
bit SUBSTATUS_SUBSTITUTE, a
|
||||
ret nz
|
||||
call BattleRandom
|
||||
and 3
|
||||
; trapped for 2-5 turns
|
||||
and %11
|
||||
inc a
|
||||
inc a
|
||||
inc a
|
||||
@@ -7590,8 +7592,9 @@ BattleCommand_FinishConfusingTarget: ; 36d70
|
||||
|
||||
.got_confuse_count
|
||||
set SUBSTATUS_CONFUSED, [hl]
|
||||
; confused for 2-5 turns
|
||||
call BattleRandom
|
||||
and 3
|
||||
and %11
|
||||
inc a
|
||||
inc a
|
||||
ld [bc], a
|
||||
@@ -8201,7 +8204,7 @@ BattleCommand_Conversion: ; 3707f
|
||||
.done
|
||||
.loop3
|
||||
call BattleRandom
|
||||
and 3 ; TODO factor in NUM_MOVES
|
||||
maskbits NUM_MOVES +- 1
|
||||
ld c, a
|
||||
ld b, 0
|
||||
ld hl, StringBuffer1
|
||||
|
@@ -1207,7 +1207,7 @@ BattleAnimCmd_Sound: ; cc7cd (33:47cd)
|
||||
srl a
|
||||
ld [wSFXDuration], a
|
||||
call .GetCryTrack
|
||||
and 3
|
||||
maskbits NUM_NOISE_CHANS +- 1
|
||||
ld [CryTracks], a ; CryTracks
|
||||
|
||||
ld e, a
|
||||
@@ -1244,7 +1244,7 @@ BattleAnimCmd_Sound: ; cc7cd (33:47cd)
|
||||
|
||||
BattleAnimCmd_Cry: ; cc807 (33:4807)
|
||||
call GetBattleAnimByte
|
||||
and 3
|
||||
maskbits NUM_NOISE_CHANS +- 1
|
||||
ld e, a
|
||||
ld d, 0
|
||||
ld hl, .CryData
|
||||
|
@@ -136,7 +136,7 @@ _DepositPKMN: ; e2391 (38:6391)
|
||||
jp c, BillsPCDepositFuncCancel
|
||||
ld a, [wMenuCursorY]
|
||||
dec a
|
||||
and $3
|
||||
and %11
|
||||
ld e, a
|
||||
ld d, 0
|
||||
ld hl, BillsPCDepositJumptable
|
||||
@@ -401,7 +401,7 @@ BillsPC_Withdraw: ; e2675 (38:6675)
|
||||
jp c, .cancel
|
||||
ld a, [wMenuCursorY]
|
||||
dec a
|
||||
and 3
|
||||
and %11
|
||||
ld e, a
|
||||
ld d, 0
|
||||
ld hl, .dw
|
||||
@@ -663,7 +663,7 @@ _MovePKMNWithoutMail: ; e2759
|
||||
jp c, .Cancel
|
||||
ld a, [wMenuCursorY]
|
||||
dec a
|
||||
and 3
|
||||
and %11
|
||||
ld e, a
|
||||
ld d, 0
|
||||
ld hl, .Jumptable2
|
||||
|
@@ -7,17 +7,17 @@ CheckPartyFullAfterContest: ; 4d9e5
|
||||
call GetBaseData
|
||||
ld hl, PartyCount
|
||||
ld a, [hl]
|
||||
cp 6
|
||||
cp PARTY_LENGTH
|
||||
jp nc, .TryAddToBox
|
||||
inc a
|
||||
ld [hl], a
|
||||
ld c, a
|
||||
ld b, $0
|
||||
ld b, 0
|
||||
add hl, bc
|
||||
ld a, [wContestMon]
|
||||
ld [hli], a
|
||||
ld [CurSpecies], a
|
||||
ld a, $ff
|
||||
ld a, -1
|
||||
ld [hl], a
|
||||
ld hl, PartyMon1Species
|
||||
ld a, [PartyCount]
|
||||
@@ -75,8 +75,8 @@ CheckPartyFullAfterContest: ; 4d9e5
|
||||
ld hl, PartyMon1CaughtLocation
|
||||
call GetPartyLocation
|
||||
ld a, [hl]
|
||||
and $80
|
||||
ld b, $13
|
||||
and CAUGHT_GENDER_MASK
|
||||
ld b, NATIONAL_PARK
|
||||
or b
|
||||
ld [hl], a
|
||||
xor a
|
||||
@@ -135,8 +135,8 @@ CheckPartyFullAfterContest: ; 4d9e5
|
||||
call GetSRAMBank
|
||||
ld hl, sBoxMon1CaughtLocation
|
||||
ld a, [hl]
|
||||
and $80
|
||||
ld b, $13
|
||||
and CAUGHT_GENDER_MASK
|
||||
ld b, NATIONAL_PARK
|
||||
or b
|
||||
ld [hl], a
|
||||
call CloseSRAM
|
||||
@@ -227,7 +227,7 @@ SetGiftPartyMonCaughtData: ; 4dba3
|
||||
SetGiftMonCaughtData: ; 4dbaf
|
||||
xor a
|
||||
ld [hli], a
|
||||
ld a, $7e
|
||||
ld a, GIFT_LOCATION
|
||||
rrc b
|
||||
or b
|
||||
ld [hl], a
|
||||
@@ -239,7 +239,7 @@ SetEggMonCaughtData: ; 4dbb8 (13:5bb8)
|
||||
call GetPartyLocation
|
||||
ld a, [CurPartyLevel]
|
||||
push af
|
||||
ld a, $1
|
||||
ld a, CAUGHT_EGG_LEVEL
|
||||
ld [CurPartyLevel], a
|
||||
call SetBoxmonOrEggmonCaughtData
|
||||
pop af
|
||||
|
@@ -1240,7 +1240,7 @@ LoadMapPals:
|
||||
ld l, a
|
||||
; Futher refine by time of day
|
||||
ld a, [TimeOfDayPal]
|
||||
and 3
|
||||
maskbits NUM_DAYTIMES +- 1
|
||||
add a
|
||||
add a
|
||||
add a
|
||||
@@ -1286,7 +1286,7 @@ LoadMapPals:
|
||||
|
||||
.got_pals
|
||||
ld a, [TimeOfDayPal]
|
||||
and 3
|
||||
maskbits NUM_DAYTIMES +- 1
|
||||
ld bc, 8 palettes
|
||||
ld hl, MapObjectPals
|
||||
call AddNTimes
|
||||
@@ -1310,7 +1310,7 @@ LoadMapPals:
|
||||
ld de, RoofPals
|
||||
add hl, de
|
||||
ld a, [TimeOfDayPal]
|
||||
and 3
|
||||
maskbits NUM_DAYTIMES +- 1
|
||||
cp NITE_F
|
||||
jr c, .morn_day
|
||||
rept 4
|
||||
|
@@ -504,7 +504,7 @@ GetCreditsPalette: ; 109b2c
|
||||
.GetPalAddress:
|
||||
; Each set of palette data is 24 bytes long.
|
||||
ld a, [wCreditsBorderMon] ; scene
|
||||
and 3
|
||||
and %11
|
||||
add a
|
||||
add a ; * 8
|
||||
add a
|
||||
@@ -549,13 +549,13 @@ Credits_LoadBorderGFX: ; 109bca (42:5bca)
|
||||
cp $ff
|
||||
jr z, .init
|
||||
|
||||
and 3
|
||||
and %11
|
||||
ld e, a
|
||||
inc a
|
||||
and 3
|
||||
and %11
|
||||
ld [hl], a
|
||||
ld a, [wCreditsBorderMon]
|
||||
and 3
|
||||
and %11
|
||||
add a
|
||||
add a
|
||||
add e
|
||||
|
@@ -247,10 +247,10 @@ GameFreakLogoScene2: ; e470d (39:470d)
|
||||
ld hl, SPRITEANIMSTRUCT_0D
|
||||
add hl, bc
|
||||
ld a, [hl]
|
||||
and $3f
|
||||
cp $20
|
||||
and %111111
|
||||
cp %100000
|
||||
jr nc, .asm_e4723
|
||||
add $20
|
||||
add %100000
|
||||
.asm_e4723
|
||||
ld e, a
|
||||
farcall BattleAnim_Sine_e
|
||||
@@ -1604,12 +1604,12 @@ CrystalIntro_UnownFade: ; e5223 (39:5223)
|
||||
inc hl
|
||||
inc hl
|
||||
ld a, [wcf65]
|
||||
and $3f
|
||||
cp $1f
|
||||
and %111111
|
||||
cp %011111
|
||||
jr z, .okay
|
||||
jr c, .okay
|
||||
ld c, a
|
||||
ld a, $3f
|
||||
ld a, %111111
|
||||
sub c
|
||||
.okay
|
||||
|
||||
|
@@ -17,7 +17,7 @@ SpecialBuenasPassword: ; 8af6b
|
||||
ld a, [MenuSelection]
|
||||
ld c, a
|
||||
ld a, [wBuenasPassword]
|
||||
and $3
|
||||
maskbits NUM_PASSWORDS_PER_CATEGORY +- 1
|
||||
cp c
|
||||
jr nz, .wrong
|
||||
ld b, $1
|
||||
@@ -46,7 +46,7 @@ SpecialBuenasPassword: ; 8af6b
|
||||
; 0x8afb4
|
||||
|
||||
.PasswordIndices: ; 8afb8
|
||||
db 3
|
||||
db NUM_PASSWORDS_PER_CATEGORY
|
||||
db 0, 1, 2
|
||||
db -1
|
||||
|
||||
|
@@ -2,7 +2,7 @@ Special_SelectRandomBugContestContestants: ; 139a8
|
||||
; Select five random people to participate in the current contest.
|
||||
|
||||
; First we have to make sure that any old data is cleared away.
|
||||
ld c, 10 ; Number of people to choose from.
|
||||
ld c, NUM_BUG_CONTESTANTS
|
||||
ld hl, BugCatchingContestantEventFlagTable
|
||||
.loop1
|
||||
push bc
|
||||
@@ -26,9 +26,9 @@ Special_SelectRandomBugContestContestants: ; 139a8
|
||||
.next
|
||||
; Choose a flag at uniform random to be set.
|
||||
call Random
|
||||
cp 250
|
||||
cp $ff / NUM_BUG_CONTESTANTS * NUM_BUG_CONTESTANTS
|
||||
jr nc, .next
|
||||
ld c, 25
|
||||
ld c, $ff / NUM_BUG_CONTESTANTS
|
||||
call SimpleDivide
|
||||
ld e, b
|
||||
ld d, 0
|
||||
@@ -59,7 +59,7 @@ Special_SelectRandomBugContestContestants: ; 139a8
|
||||
Special_CheckBugContestContestantFlag: ; 139ed
|
||||
; Checks the flag of the Bug Catching Contestant whose index is loaded in a.
|
||||
|
||||
; Bug: If a >= 10 when this is called, it will read beyond the table.
|
||||
; Bug: If a >= NUM_BUG_CONTESTANTS when this is called, it will read beyond the table.
|
||||
|
||||
ld hl, BugCatchingContestantEventFlagTable
|
||||
ld e, a
|
||||
@@ -74,18 +74,7 @@ Special_CheckBugContestContestantFlag: ; 139ed
|
||||
ret
|
||||
; 139fe
|
||||
|
||||
BugCatchingContestantEventFlagTable: ; 139fe
|
||||
dw EVENT_BUG_CATCHING_CONTESTANT_1A
|
||||
dw EVENT_BUG_CATCHING_CONTESTANT_2A
|
||||
dw EVENT_BUG_CATCHING_CONTESTANT_3A
|
||||
dw EVENT_BUG_CATCHING_CONTESTANT_4A
|
||||
dw EVENT_BUG_CATCHING_CONTESTANT_5A
|
||||
dw EVENT_BUG_CATCHING_CONTESTANT_6A
|
||||
dw EVENT_BUG_CATCHING_CONTESTANT_7A
|
||||
dw EVENT_BUG_CATCHING_CONTESTANT_8A
|
||||
dw EVENT_BUG_CATCHING_CONTESTANT_9A
|
||||
dw EVENT_BUG_CATCHING_CONTESTANT_10A
|
||||
; 13a12
|
||||
INCLUDE "data/bug_contest_flags.asm"
|
||||
|
||||
ContestDropOffMons: ; 13a12
|
||||
ld hl, PartyMon1HP
|
||||
@@ -101,7 +90,7 @@ ContestDropOffMons: ; 13a12
|
||||
ld a, [hl]
|
||||
ld [wBugContestSecondPartySpecies], a
|
||||
; ... and replacing it with the terminator byte
|
||||
ld [hl], $ff
|
||||
ld [hl], -1
|
||||
xor a
|
||||
ld [ScriptVar], a
|
||||
ret
|
||||
@@ -118,7 +107,7 @@ ContestReturnMons: ; 13a31
|
||||
ld a, [wBugContestSecondPartySpecies]
|
||||
ld [hl], a
|
||||
; Restore the party count, which must be recomputed.
|
||||
ld b, $1
|
||||
ld b, 1
|
||||
.loop
|
||||
ld a, [hli]
|
||||
cp -1
|
||||
|
@@ -77,9 +77,8 @@ BugContest_ThirdPlaceScoreText: ; 0x1372b
|
||||
; 0x13730
|
||||
|
||||
LoadContestantName: ; 13730
|
||||
|
||||
; If a = 0, get your name.
|
||||
dec a
|
||||
; If a = 1, get your name.
|
||||
dec a ; BUG_CONTEST_PLAYER
|
||||
jr z, .player
|
||||
; Find the pointer for the trainer class of the Bug Catching Contestant whose ID is in a.
|
||||
ld c, a
|
||||
@@ -141,11 +140,11 @@ INCLUDE "data/bug_contest_winners.asm"
|
||||
|
||||
BugContest_GetPlayersResult: ; 13807
|
||||
ld hl, wBugContestThirdPlaceWinnerID
|
||||
ld de, -4
|
||||
ld b, 3
|
||||
ld de, - BUG_CONTESTANT_SIZE
|
||||
ld b, 3 ; 3rd, 2nd, or 1st
|
||||
.loop
|
||||
ld a, [hl]
|
||||
cp 1 ; Player
|
||||
cp BUG_CONTEST_PLAYER
|
||||
jr z, .done
|
||||
add hl, de
|
||||
dec b
|
||||
@@ -159,7 +158,7 @@ BugContest_JudgeContestants: ; 13819
|
||||
call ClearContestResults
|
||||
call ComputeAIContestantScores
|
||||
ld hl, wBugContestTempWinnerID
|
||||
ld a, 1 ; Player
|
||||
ld a, BUG_CONTEST_PLAYER
|
||||
ld [hli], a
|
||||
ld a, [wContestMon]
|
||||
ld [hli], a
|
||||
@@ -190,11 +189,11 @@ DetermineContestWinners: ; 1383e
|
||||
jr c, .not_first_place
|
||||
ld hl, wBugContestSecondPlaceWinnerID
|
||||
ld de, wBugContestThirdPlaceWinnerID
|
||||
ld bc, 4
|
||||
ld bc, BUG_CONTESTANT_SIZE
|
||||
call CopyBytes
|
||||
ld hl, wBugContestFirstPlaceWinnerID
|
||||
ld de, wBugContestSecondPlaceWinnerID
|
||||
ld bc, 4
|
||||
ld bc, BUG_CONTESTANT_SIZE
|
||||
call CopyBytes
|
||||
ld hl, wBugContestFirstPlaceWinnerID
|
||||
call CopyTempContestant
|
||||
@@ -208,7 +207,7 @@ DetermineContestWinners: ; 1383e
|
||||
jr c, .not_second_place
|
||||
ld hl, wBugContestSecondPlaceWinnerID
|
||||
ld de, wBugContestThirdPlaceWinnerID
|
||||
ld bc, 4
|
||||
ld bc, BUG_CONTESTANT_SIZE
|
||||
call CopyBytes
|
||||
ld hl, wBugContestSecondPlaceWinnerID
|
||||
call CopyTempContestant
|
||||
@@ -230,7 +229,7 @@ DetermineContestWinners: ; 1383e
|
||||
CopyTempContestant: ; 138a0
|
||||
; Could've just called CopyBytes.
|
||||
ld de, wBugContestTempWinnerID
|
||||
rept 3
|
||||
rept BUG_CONTESTANT_SIZE +- 1
|
||||
ld a, [de]
|
||||
inc de
|
||||
ld [hli], a
|
||||
@@ -264,6 +263,7 @@ ComputeAIContestantScores: ; 138b0
|
||||
inc hl
|
||||
inc hl
|
||||
.loop2
|
||||
; 0, 1, or 2 for 1st, 2nd, or 3rd
|
||||
call Random
|
||||
and 3
|
||||
cp 3
|
||||
@@ -278,8 +278,9 @@ ComputeAIContestantScores: ; 138b0
|
||||
ld a, [hli]
|
||||
ld h, [hl]
|
||||
ld l, a
|
||||
; randomly perturb score
|
||||
call Random
|
||||
and 7
|
||||
and %111
|
||||
ld c, a
|
||||
ld b, 0
|
||||
add hl, bc
|
||||
@@ -294,7 +295,7 @@ ComputeAIContestantScores: ; 138b0
|
||||
.done
|
||||
inc e
|
||||
ld a, e
|
||||
cp 10
|
||||
cp NUM_BUG_CONTESTANTS
|
||||
jr nz, .loop
|
||||
ret
|
||||
; 13900
|
||||
@@ -337,26 +338,26 @@ ContestScore: ; 13900
|
||||
; DVs
|
||||
ld a, [wContestMonDVs + 0]
|
||||
ld b, a
|
||||
and 2
|
||||
and %0010
|
||||
add a
|
||||
add a
|
||||
ld c, a
|
||||
|
||||
swap b
|
||||
ld a, b
|
||||
and 2
|
||||
and %0010
|
||||
add a
|
||||
add c
|
||||
ld d, a
|
||||
|
||||
ld a, [wContestMonDVs + 1]
|
||||
ld b, a
|
||||
and 2
|
||||
and %0010
|
||||
ld c, a
|
||||
|
||||
swap b
|
||||
ld a, b
|
||||
and 2
|
||||
and %0010
|
||||
srl a
|
||||
add c
|
||||
add c
|
||||
|
@@ -80,7 +80,7 @@ rept 4
|
||||
endr
|
||||
|
||||
ld a, [TimeOfDay]
|
||||
and 3
|
||||
maskbits NUM_DAYTIMES +- 1
|
||||
cp NITE_F
|
||||
jr c, .time_species
|
||||
inc hl
|
||||
|
@@ -435,7 +435,7 @@ MagnetTrain_Jumptable_FirstRunThrough: ; 8ceae
|
||||
ld a, [wEnvironment]
|
||||
push af
|
||||
ld a, [TimeOfDay]
|
||||
and $3
|
||||
maskbits NUM_DAYTIMES +- 1
|
||||
ld [TimeOfDayPal], a
|
||||
ld a, $1
|
||||
ld [wEnvironment], a
|
||||
|
@@ -10,8 +10,8 @@ LoadPoisonBGPals: ; cbcdd
|
||||
and a
|
||||
jr nz, .cgb
|
||||
ld a, [TimeOfDayPal]
|
||||
and $3
|
||||
cp $3
|
||||
maskbits NUM_DAYTIMES +- 1
|
||||
cp DARKNESS_F
|
||||
ld a, %00000000
|
||||
jr z, .convert_pals
|
||||
ld a, %10101010
|
||||
|
@@ -20,7 +20,7 @@ SpecialPokeSeer: ; 4f0bc
|
||||
call PrintSeerText
|
||||
call JoyWaitAorB
|
||||
|
||||
ld b, $6
|
||||
ld b, PARTY_LENGTH
|
||||
farcall SelectMonFromParty
|
||||
jr c, .cancel
|
||||
|
||||
@@ -163,11 +163,11 @@ GetCaughtLevel: ; 4f18c
|
||||
call ByteFill
|
||||
|
||||
; caught level
|
||||
; Limited to between 1 and 63 for some reason.
|
||||
; Limited to between 1 and 63 since it's a 6-bit quantity.
|
||||
ld a, [wSeerCaughtData]
|
||||
and $3f
|
||||
and CAUGHT_LEVEL_MASK
|
||||
jr z, .unknown
|
||||
cp 1 ; hatched from an egg
|
||||
cp CAUGHT_EGG_LEVEL ; egg marker value
|
||||
jr nz, .print
|
||||
ld a, EGG_LEVEL ; egg hatch level
|
||||
|
||||
@@ -193,7 +193,7 @@ GetCaughtLevel: ; 4f18c
|
||||
|
||||
GetCaughtTime: ; 4f1c5
|
||||
ld a, [wSeerCaughtData]
|
||||
and $c0
|
||||
and CAUGHT_TIME_MASK
|
||||
jr z, .none
|
||||
|
||||
rlca
|
||||
@@ -233,11 +233,11 @@ UnknownCaughtData: ; 4f1f8
|
||||
|
||||
GetCaughtLocation: ; 4f20a
|
||||
ld a, [wSeerCaughtGender]
|
||||
and $7f
|
||||
and CAUGHT_LOCATION_MASK
|
||||
jr z, .Unknown
|
||||
cp $7f
|
||||
cp EVENT_LOCATION
|
||||
jr z, .event
|
||||
cp $7e
|
||||
cp GIFT_LOCATION
|
||||
jr z, .fail
|
||||
ld e, a
|
||||
farcall GetLandmarkName
|
||||
@@ -440,22 +440,22 @@ GetCaughtGender: ; 4f301
|
||||
add hl, bc
|
||||
|
||||
ld a, [hl]
|
||||
and $7f
|
||||
and CAUGHT_LOCATION_MASK
|
||||
jr z, .genderless
|
||||
cp $7f
|
||||
cp EVENT_LOCATION
|
||||
jr z, .genderless
|
||||
|
||||
ld a, [hl]
|
||||
and $80
|
||||
and CAUGHT_GENDER_MASK
|
||||
jr nz, .male
|
||||
ld c, 1
|
||||
ld c, CAUGHT_BY_GIRL
|
||||
ret
|
||||
|
||||
.male
|
||||
ld c, 2
|
||||
ld c, CAUGHT_BY_BOY
|
||||
ret
|
||||
|
||||
.genderless
|
||||
ld c, 0
|
||||
ld c, CAUGHT_BY_UNKNOWN
|
||||
ret
|
||||
; 4f31c
|
||||
|
@@ -1333,7 +1333,7 @@ ResetClock: ; 6392
|
||||
Function639b: ; unreferenced
|
||||
; If bit 0 or 1 of [wTitleScreenTimer] is set, we don't need to be here.
|
||||
ld a, [wTitleScreenTimer]
|
||||
and $3
|
||||
and %00000011
|
||||
ret nz
|
||||
ld bc, SpriteAnim10
|
||||
ld hl, SPRITEANIMSTRUCT_FRAME
|
||||
|
@@ -775,7 +775,7 @@ GetPokedexEntryBank:
|
||||
ld a, [EnemyMonSpecies]
|
||||
rlca
|
||||
rlca
|
||||
and 3
|
||||
maskbits NUM_DEX_ENTRY_BANKS +- 1
|
||||
ld hl, .PokedexEntryBanks
|
||||
ld d, 0
|
||||
ld e, a
|
||||
@@ -786,12 +786,6 @@ GetPokedexEntryBank:
|
||||
ret
|
||||
|
||||
.PokedexEntryBanks:
|
||||
|
||||
GLOBAL PokedexEntries1
|
||||
GLOBAL PokedexEntries2
|
||||
GLOBAL PokedexEntries3
|
||||
GLOBAL PokedexEntries4
|
||||
|
||||
db BANK(PokedexEntries1)
|
||||
db BANK(PokedexEntries2)
|
||||
db BANK(PokedexEntries3)
|
||||
|
@@ -80,8 +80,8 @@ RegionCheck: ; 0x1caea1
|
||||
jr c, .kanto
|
||||
|
||||
.johto
|
||||
ld e, 0
|
||||
ld e, JOHTO_REGION
|
||||
ret
|
||||
.kanto
|
||||
ld e, 1
|
||||
ld e, KANTO_REGION
|
||||
ret
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user