mirror of
https://gitlab.com/xCrystal/pokecrystal-board.git
synced 2025-04-09 05:44:44 -07:00
commit
a71b28e5b7
2
STYLE.md
2
STYLE.md
@ -74,11 +74,11 @@ PascalCase:: ; global label
|
|||||||
wPascalCase: ; wram
|
wPascalCase: ; wram
|
||||||
sPascalCase: ; sram
|
sPascalCase: ; sram
|
||||||
vPascalCase: ; vram
|
vPascalCase: ; vram
|
||||||
|
hPascalCase: ; hram
|
||||||
PascalCase: ; rom
|
PascalCase: ; rom
|
||||||
|
|
||||||
; Some constants are also prefixed
|
; Some constants are also prefixed
|
||||||
rBGP EQU $ff47 ; hardware register
|
rBGP EQU $ff47 ; hardware register
|
||||||
hPascalCase EQU $ff80 ; hram
|
|
||||||
|
|
||||||
; Most other constants should be upper case
|
; Most other constants should be upper case
|
||||||
UPPER_CASE EQU 1
|
UPPER_CASE EQU 1
|
||||||
|
@ -763,9 +763,9 @@ Function3851e: ; This appears to be unused
|
|||||||
ldh [hDividend + 1], a
|
ldh [hDividend + 1], a
|
||||||
ld b, 2
|
ld b, 2
|
||||||
call Divide
|
call Divide
|
||||||
ldh a, [hQuotient + 2]
|
ldh a, [hQuotient + 3]
|
||||||
ld c, a
|
ld c, a
|
||||||
ldh a, [hQuotient + 1]
|
ldh a, [hQuotient + 2]
|
||||||
ld b, a
|
ld b, a
|
||||||
ld hl, wEnemyMonHP + 1
|
ld hl, wEnemyMonHP + 1
|
||||||
ld a, [hld]
|
ld a, [hld]
|
||||||
|
@ -352,7 +352,7 @@ HandleBerserkGene:
|
|||||||
|
|
||||||
.reverse
|
.reverse
|
||||||
call .enemy
|
call .enemy
|
||||||
; jr .player
|
; fallthrough
|
||||||
|
|
||||||
.player
|
.player
|
||||||
call SetPlayerTurn
|
call SetPlayerTurn
|
||||||
@ -366,7 +366,7 @@ HandleBerserkGene:
|
|||||||
ld de, wOTPartyMon1Item
|
ld de, wOTPartyMon1Item
|
||||||
ld a, [wCurOTMon]
|
ld a, [wCurOTMon]
|
||||||
ld b, a
|
ld b, a
|
||||||
; jr .go
|
; fallthrough
|
||||||
|
|
||||||
.go
|
.go
|
||||||
push de
|
push de
|
||||||
@ -3715,23 +3715,23 @@ TryToRunAwayFromBattle:
|
|||||||
inc a
|
inc a
|
||||||
ld [wNumFleeAttempts], a
|
ld [wNumFleeAttempts], a
|
||||||
ld a, [hli]
|
ld a, [hli]
|
||||||
ldh [hPartyMon1Speed + 0], a
|
ldh [hMultiplicand + 1], a
|
||||||
ld a, [hl]
|
ld a, [hl]
|
||||||
ldh [hPartyMon1Speed + 1], a
|
ldh [hMultiplicand + 2], a
|
||||||
ld a, [de]
|
ld a, [de]
|
||||||
inc de
|
inc de
|
||||||
ldh [hEnemyMonSpeed + 0], a
|
ldh [hEnemyMonSpeed + 0], a
|
||||||
ld a, [de]
|
ld a, [de]
|
||||||
ldh [hEnemyMonSpeed + 1], a
|
ldh [hEnemyMonSpeed + 1], a
|
||||||
call Call_LoadTempTileMapToTileMap
|
call Call_LoadTempTileMapToTileMap
|
||||||
ld de, hPartyMon1Speed
|
ld de, hMultiplicand + 1
|
||||||
ld hl, hEnemyMonSpeed
|
ld hl, hEnemyMonSpeed
|
||||||
ld c, 2
|
ld c, 2
|
||||||
call CompareBytes
|
call CompareBytes
|
||||||
jr nc, .can_escape
|
jr nc, .can_escape
|
||||||
|
|
||||||
xor a
|
xor a
|
||||||
ldh [hMultiplicand], a
|
ldh [hMultiplicand + 0], a
|
||||||
ld a, 32
|
ld a, 32
|
||||||
ldh [hMultiplier], a
|
ldh [hMultiplier], a
|
||||||
call Multiply
|
call Multiply
|
||||||
@ -3751,7 +3751,7 @@ TryToRunAwayFromBattle:
|
|||||||
ldh [hDivisor], a
|
ldh [hDivisor], a
|
||||||
ld b, 2
|
ld b, 2
|
||||||
call Divide
|
call Divide
|
||||||
ldh a, [hQuotient + 1]
|
ldh a, [hQuotient + 2]
|
||||||
and a
|
and a
|
||||||
jr nz, .can_escape
|
jr nz, .can_escape
|
||||||
ld a, [wNumFleeAttempts]
|
ld a, [wNumFleeAttempts]
|
||||||
@ -3760,16 +3760,16 @@ TryToRunAwayFromBattle:
|
|||||||
dec c
|
dec c
|
||||||
jr z, .cant_escape_2
|
jr z, .cant_escape_2
|
||||||
ld b, 30
|
ld b, 30
|
||||||
ldh a, [hQuotient + 2]
|
ldh a, [hQuotient + 3]
|
||||||
add b
|
add b
|
||||||
ldh [hQuotient + 2], a
|
ldh [hQuotient + 3], a
|
||||||
jr c, .can_escape
|
jr c, .can_escape
|
||||||
jr .loop
|
jr .loop
|
||||||
|
|
||||||
.cant_escape_2
|
.cant_escape_2
|
||||||
call BattleRandom
|
call BattleRandom
|
||||||
ld b, a
|
ld b, a
|
||||||
ldh a, [hQuotient + 2]
|
ldh a, [hQuotient + 3]
|
||||||
cp b
|
cp b
|
||||||
jr nc, .can_escape
|
jr nc, .can_escape
|
||||||
ld a, BATTLEPLAYERACTION_USEITEM
|
ld a, BATTLEPLAYERACTION_USEITEM
|
||||||
@ -4787,7 +4787,7 @@ DrawEnemyHUD:
|
|||||||
|
|
||||||
.not_fainted
|
.not_fainted
|
||||||
xor a
|
xor a
|
||||||
ldh [hMultiplicand], a
|
ldh [hMultiplicand + 0], a
|
||||||
ld a, HP_BAR_LENGTH_PX
|
ld a, HP_BAR_LENGTH_PX
|
||||||
ldh [hMultiplier], a
|
ldh [hMultiplier], a
|
||||||
call Multiply
|
call Multiply
|
||||||
@ -4824,7 +4824,7 @@ DrawEnemyHUD:
|
|||||||
ld a, 2
|
ld a, 2
|
||||||
ld b, a
|
ld b, a
|
||||||
call Divide
|
call Divide
|
||||||
ldh a, [hQuotient + 2]
|
ldh a, [hQuotient + 3]
|
||||||
ld e, a
|
ld e, a
|
||||||
ld a, HP_BAR_LENGTH
|
ld a, HP_BAR_LENGTH
|
||||||
ld d, a
|
ld d, a
|
||||||
@ -6723,22 +6723,22 @@ ApplyStatLevelMultiplier:
|
|||||||
pop hl
|
pop hl
|
||||||
|
|
||||||
; Cap at 999.
|
; Cap at 999.
|
||||||
ldh a, [hQuotient + 2]
|
ldh a, [hQuotient + 3]
|
||||||
sub LOW(MAX_STAT_VALUE)
|
sub LOW(MAX_STAT_VALUE)
|
||||||
ldh a, [hQuotient + 1]
|
ldh a, [hQuotient + 2]
|
||||||
sbc HIGH(MAX_STAT_VALUE)
|
sbc HIGH(MAX_STAT_VALUE)
|
||||||
jp c, .okay3
|
jp c, .okay3
|
||||||
|
|
||||||
ld a, HIGH(MAX_STAT_VALUE)
|
ld a, HIGH(MAX_STAT_VALUE)
|
||||||
ldh [hQuotient + 1], a
|
|
||||||
ld a, LOW(MAX_STAT_VALUE)
|
|
||||||
ldh [hQuotient + 2], a
|
ldh [hQuotient + 2], a
|
||||||
|
ld a, LOW(MAX_STAT_VALUE)
|
||||||
|
ldh [hQuotient + 3], a
|
||||||
|
|
||||||
.okay3
|
.okay3
|
||||||
ldh a, [hQuotient + 1]
|
ldh a, [hQuotient + 2]
|
||||||
ld [hli], a
|
ld [hli], a
|
||||||
ld b, a
|
ld b, a
|
||||||
ldh a, [hQuotient + 2]
|
ldh a, [hQuotient + 3]
|
||||||
ld [hl], a
|
ld [hl], a
|
||||||
or b
|
or b
|
||||||
jr nz, .okay4
|
jr nz, .okay4
|
||||||
@ -7095,9 +7095,9 @@ GiveExperiencePoints:
|
|||||||
ld a, [hl]
|
ld a, [hl]
|
||||||
cp LUCKY_EGG
|
cp LUCKY_EGG
|
||||||
call z, BoostExp
|
call z, BoostExp
|
||||||
ldh a, [hQuotient + 2]
|
ldh a, [hQuotient + 3]
|
||||||
ld [wStringBuffer2 + 1], a
|
ld [wStringBuffer2 + 1], a
|
||||||
ldh a, [hQuotient + 1]
|
ldh a, [hQuotient + 2]
|
||||||
ld [wStringBuffer2], a
|
ld [wStringBuffer2], a
|
||||||
ld a, [wCurPartyMon]
|
ld a, [wCurPartyMon]
|
||||||
ld hl, wPartyMonNicknames
|
ld hl, wPartyMonNicknames
|
||||||
@ -7105,9 +7105,9 @@ GiveExperiencePoints:
|
|||||||
ld hl, Text_MonGainedExpPoint
|
ld hl, Text_MonGainedExpPoint
|
||||||
call BattleTextBox
|
call BattleTextBox
|
||||||
ld a, [wStringBuffer2 + 1]
|
ld a, [wStringBuffer2 + 1]
|
||||||
ldh [hQuotient + 2], a
|
ldh [hQuotient + 3], a
|
||||||
ld a, [wStringBuffer2]
|
ld a, [wStringBuffer2]
|
||||||
ldh [hQuotient + 1], a
|
ldh [hQuotient + 2], a
|
||||||
pop bc
|
pop bc
|
||||||
call AnimateExpBar
|
call AnimateExpBar
|
||||||
push bc
|
push bc
|
||||||
@ -7116,11 +7116,11 @@ GiveExperiencePoints:
|
|||||||
ld hl, MON_EXP + 2
|
ld hl, MON_EXP + 2
|
||||||
add hl, bc
|
add hl, bc
|
||||||
ld d, [hl]
|
ld d, [hl]
|
||||||
ldh a, [hQuotient + 2]
|
ldh a, [hQuotient + 3]
|
||||||
add d
|
add d
|
||||||
ld [hld], a
|
ld [hld], a
|
||||||
ld d, [hl]
|
ld d, [hl]
|
||||||
ldh a, [hQuotient + 1]
|
ldh a, [hQuotient + 2]
|
||||||
adc d
|
adc d
|
||||||
ld [hl], a
|
ld [hl], a
|
||||||
jr nc, .skip2
|
jr nc, .skip2
|
||||||
@ -7148,11 +7148,11 @@ GiveExperiencePoints:
|
|||||||
ld hl, MON_EXP + 2
|
ld hl, MON_EXP + 2
|
||||||
add hl, bc
|
add hl, bc
|
||||||
push bc
|
push bc
|
||||||
ldh a, [hQuotient]
|
|
||||||
ld b, a
|
|
||||||
ldh a, [hQuotient + 1]
|
ldh a, [hQuotient + 1]
|
||||||
ld c, a
|
ld b, a
|
||||||
ldh a, [hQuotient + 2]
|
ldh a, [hQuotient + 2]
|
||||||
|
ld c, a
|
||||||
|
ldh a, [hQuotient + 3]
|
||||||
ld d, a
|
ld d, a
|
||||||
ld a, [hld]
|
ld a, [hld]
|
||||||
sub d
|
sub d
|
||||||
@ -7371,7 +7371,7 @@ GiveExperiencePoints:
|
|||||||
ldh [hDivisor], a
|
ldh [hDivisor], a
|
||||||
ld b, 2
|
ld b, 2
|
||||||
call Divide
|
call Divide
|
||||||
ldh a, [hQuotient + 2]
|
ldh a, [hQuotient + 3]
|
||||||
ld [hli], a
|
ld [hli], a
|
||||||
dec c
|
dec c
|
||||||
jr nz, .count_loop2
|
jr nz, .count_loop2
|
||||||
@ -7646,7 +7646,7 @@ SendOutMonText:
|
|||||||
ldh [hDivisor], a
|
ldh [hDivisor], a
|
||||||
call Divide
|
call Divide
|
||||||
|
|
||||||
ldh a, [hQuotient + 2]
|
ldh a, [hQuotient + 3]
|
||||||
ld hl, JumpText_GoMon
|
ld hl, JumpText_GoMon
|
||||||
cp 70
|
cp 70
|
||||||
jr nc, .skip_to_textbox
|
jr nc, .skip_to_textbox
|
||||||
@ -7728,7 +7728,7 @@ WithdrawMonText:
|
|||||||
call Divide
|
call Divide
|
||||||
pop bc
|
pop bc
|
||||||
pop de
|
pop de
|
||||||
ldh a, [hQuotient + 2]
|
ldh a, [hQuotient + 3]
|
||||||
ld hl, TextJump_ThatsEnoughComeBack
|
ld hl, TextJump_ThatsEnoughComeBack
|
||||||
and a
|
and a
|
||||||
ret z
|
ret z
|
||||||
@ -7868,8 +7868,7 @@ CalcExpBar:
|
|||||||
ld [hld], a
|
ld [hld], a
|
||||||
xor a
|
xor a
|
||||||
ld [hl], a
|
ld [hl], a
|
||||||
; multiply by 64
|
ld a, 64
|
||||||
ld a, $40
|
|
||||||
ldh [hMultiplier], a
|
ldh [hMultiplier], a
|
||||||
call Multiply
|
call Multiply
|
||||||
pop af
|
pop af
|
||||||
@ -7897,7 +7896,7 @@ CalcExpBar:
|
|||||||
ldh [hDivisor], a
|
ldh [hDivisor], a
|
||||||
ld b, 4
|
ld b, 4
|
||||||
call Divide
|
call Divide
|
||||||
ldh a, [hQuotient + 2]
|
ldh a, [hQuotient + 3]
|
||||||
ld b, a
|
ld b, a
|
||||||
ld a, $40
|
ld a, $40
|
||||||
sub b
|
sub b
|
||||||
|
@ -1368,9 +1368,9 @@ BattleCommand_Stab:
|
|||||||
ldh [hDivisor], a
|
ldh [hDivisor], a
|
||||||
ld b, 4
|
ld b, 4
|
||||||
call Divide
|
call Divide
|
||||||
ldh a, [hQuotient + 1]
|
|
||||||
ld b, a
|
|
||||||
ldh a, [hQuotient + 2]
|
ldh a, [hQuotient + 2]
|
||||||
|
ld b, a
|
||||||
|
ldh a, [hQuotient + 3]
|
||||||
or b
|
or b
|
||||||
jr nz, .ok
|
jr nz, .ok
|
||||||
|
|
||||||
@ -1469,7 +1469,7 @@ CheckTypeMatchup:
|
|||||||
ld b, 4
|
ld b, 4
|
||||||
call Divide
|
call Divide
|
||||||
pop bc
|
pop bc
|
||||||
ldh a, [hQuotient + 2]
|
ldh a, [hQuotient + 3]
|
||||||
ld [wTypeMatchup], a
|
ld [wTypeMatchup], a
|
||||||
jr .TypesLoop
|
jr .TypesLoop
|
||||||
|
|
||||||
@ -1547,10 +1547,10 @@ BattleCommand_DamageVariation:
|
|||||||
call Divide
|
call Divide
|
||||||
|
|
||||||
; ...to get .85-1.00x damage.
|
; ...to get .85-1.00x damage.
|
||||||
ldh a, [hQuotient + 1]
|
ldh a, [hQuotient + 2]
|
||||||
ld hl, wCurDamage
|
ld hl, wCurDamage
|
||||||
ld [hli], a
|
ld [hli], a
|
||||||
ldh a, [hQuotient + 2]
|
ldh a, [hQuotient + 3]
|
||||||
ld [hl], a
|
ld [hl], a
|
||||||
ret
|
ret
|
||||||
|
|
||||||
@ -1832,14 +1832,14 @@ BattleCommand_CheckHit:
|
|||||||
ld b, 4
|
ld b, 4
|
||||||
call Divide
|
call Divide
|
||||||
; minimum accuracy is $0001
|
; minimum accuracy is $0001
|
||||||
ldh a, [hQuotient + 2]
|
ldh a, [hQuotient + 3]
|
||||||
ld b, a
|
ld b, a
|
||||||
ldh a, [hQuotient + 1]
|
ldh a, [hQuotient + 2]
|
||||||
or b
|
or b
|
||||||
jr nz, .min_accuracy
|
jr nz, .min_accuracy
|
||||||
ldh [hQuotient + 1], a
|
|
||||||
ld a, 1
|
|
||||||
ldh [hQuotient + 2], a
|
ldh [hQuotient + 2], a
|
||||||
|
ld a, 1
|
||||||
|
ldh [hQuotient + 3], a
|
||||||
|
|
||||||
.min_accuracy
|
.min_accuracy
|
||||||
; do the same thing to the target's evasion
|
; do the same thing to the target's evasion
|
||||||
@ -1848,9 +1848,9 @@ BattleCommand_CheckHit:
|
|||||||
jr nz, .accuracy_loop
|
jr nz, .accuracy_loop
|
||||||
|
|
||||||
; if the result is more than 2 bytes, max out at 100%
|
; if the result is more than 2 bytes, max out at 100%
|
||||||
ldh a, [hQuotient + 1]
|
|
||||||
and a
|
|
||||||
ldh a, [hQuotient + 2]
|
ldh a, [hQuotient + 2]
|
||||||
|
and a
|
||||||
|
ldh a, [hQuotient + 3]
|
||||||
jr z, .finish_accuracy
|
jr z, .finish_accuracy
|
||||||
ld a, $ff
|
ld a, $ff
|
||||||
|
|
||||||
@ -2984,7 +2984,7 @@ BattleCommand_DamageCalc:
|
|||||||
ld a, e
|
ld a, e
|
||||||
add a
|
add a
|
||||||
jr nc, .level_not_overflowing
|
jr nc, .level_not_overflowing
|
||||||
ld [hl], $1
|
ld [hl], 1
|
||||||
.level_not_overflowing
|
.level_not_overflowing
|
||||||
inc hl
|
inc hl
|
||||||
ld [hli], a
|
ld [hli], a
|
||||||
@ -2993,7 +2993,7 @@ BattleCommand_DamageCalc:
|
|||||||
ld a, 5
|
ld a, 5
|
||||||
ld [hld], a
|
ld [hld], a
|
||||||
push bc
|
push bc
|
||||||
ld b, $4
|
ld b, 4
|
||||||
call Divide
|
call Divide
|
||||||
pop bc
|
pop bc
|
||||||
|
|
||||||
@ -3012,7 +3012,7 @@ BattleCommand_DamageCalc:
|
|||||||
|
|
||||||
; / Defense
|
; / Defense
|
||||||
ld [hl], c
|
ld [hl], c
|
||||||
ld b, $4
|
ld b, 4
|
||||||
call Divide
|
call Divide
|
||||||
|
|
||||||
; / 50
|
; / 50
|
||||||
@ -3146,11 +3146,11 @@ BattleCommand_DamageCalc:
|
|||||||
ret z
|
ret z
|
||||||
|
|
||||||
; x2
|
; x2
|
||||||
ldh a, [hQuotient + 2]
|
ldh a, [hQuotient + 3]
|
||||||
add a
|
add a
|
||||||
ldh [hProduct + 3], a
|
ldh [hProduct + 3], a
|
||||||
|
|
||||||
ldh a, [hQuotient + 1]
|
ldh a, [hQuotient + 2]
|
||||||
rl a
|
rl a
|
||||||
ldh [hProduct + 2], a
|
ldh [hProduct + 2], a
|
||||||
|
|
||||||
@ -3257,7 +3257,7 @@ BattleCommand_ConstantDamage:
|
|||||||
ldh [hMultiplicand + 1], a
|
ldh [hMultiplicand + 1], a
|
||||||
ld a, [hli]
|
ld a, [hli]
|
||||||
ldh [hMultiplicand + 2], a
|
ldh [hMultiplicand + 2], a
|
||||||
ld a, $30
|
ld a, 48
|
||||||
ldh [hMultiplier], a
|
ldh [hMultiplier], a
|
||||||
call Multiply
|
call Multiply
|
||||||
ld a, [hli]
|
ld a, [hli]
|
||||||
@ -3288,7 +3288,7 @@ BattleCommand_ConstantDamage:
|
|||||||
.skip_to_divide
|
.skip_to_divide
|
||||||
ld b, 4
|
ld b, 4
|
||||||
call Divide
|
call Divide
|
||||||
ldh a, [hQuotient + 2]
|
ldh a, [hQuotient + 3]
|
||||||
ld b, a
|
ld b, a
|
||||||
ld hl, FlailReversalPower
|
ld hl, FlailReversalPower
|
||||||
|
|
||||||
@ -4918,34 +4918,34 @@ CalcStats:
|
|||||||
ld b, 4
|
ld b, 4
|
||||||
call Divide
|
call Divide
|
||||||
|
|
||||||
ldh a, [hQuotient + 1]
|
|
||||||
ld b, a
|
|
||||||
ldh a, [hQuotient + 2]
|
ldh a, [hQuotient + 2]
|
||||||
|
ld b, a
|
||||||
|
ldh a, [hQuotient + 3]
|
||||||
or b
|
or b
|
||||||
jr nz, .check_maxed_out
|
jr nz, .check_maxed_out
|
||||||
|
|
||||||
ld a, 1
|
ld a, 1
|
||||||
ldh [hQuotient + 2], a
|
ldh [hQuotient + 3], a
|
||||||
jr .not_maxed_out
|
jr .not_maxed_out
|
||||||
|
|
||||||
.check_maxed_out
|
.check_maxed_out
|
||||||
ldh a, [hQuotient + 2]
|
ldh a, [hQuotient + 3]
|
||||||
cp LOW(MAX_STAT_VALUE)
|
cp LOW(MAX_STAT_VALUE)
|
||||||
ld a, b
|
ld a, b
|
||||||
sbc HIGH(MAX_STAT_VALUE)
|
sbc HIGH(MAX_STAT_VALUE)
|
||||||
jr c, .not_maxed_out
|
jr c, .not_maxed_out
|
||||||
|
|
||||||
ld a, LOW(MAX_STAT_VALUE)
|
ld a, LOW(MAX_STAT_VALUE)
|
||||||
ldh [hQuotient + 2], a
|
ldh [hQuotient + 3], a
|
||||||
ld a, HIGH(MAX_STAT_VALUE)
|
ld a, HIGH(MAX_STAT_VALUE)
|
||||||
ldh [hQuotient + 1], a
|
ldh [hQuotient + 2], a
|
||||||
|
|
||||||
.not_maxed_out
|
.not_maxed_out
|
||||||
pop bc
|
pop bc
|
||||||
ldh a, [hQuotient + 1]
|
ldh a, [hQuotient + 2]
|
||||||
ld [bc], a
|
ld [bc], a
|
||||||
inc bc
|
inc bc
|
||||||
ldh a, [hQuotient + 2]
|
ldh a, [hQuotient + 3]
|
||||||
ld [bc], a
|
ld [bc], a
|
||||||
inc bc
|
inc bc
|
||||||
pop hl
|
pop hl
|
||||||
|
@ -100,10 +100,10 @@ DetermineLinkBattleResult:
|
|||||||
ldh [hDivisor], a
|
ldh [hDivisor], a
|
||||||
ld b, $4
|
ld b, $4
|
||||||
call Divide
|
call Divide
|
||||||
ldh a, [hQuotient + 2]
|
ldh a, [hQuotient + 3]
|
||||||
add e
|
add e
|
||||||
ld e, a
|
ld e, a
|
||||||
ldh a, [hQuotient + 1]
|
ldh a, [hQuotient + 2]
|
||||||
adc d
|
adc d
|
||||||
ld d, a
|
ld d, a
|
||||||
dec hl
|
dec hl
|
||||||
|
@ -119,14 +119,14 @@ DoWeatherModifiers:
|
|||||||
ld b, 4
|
ld b, 4
|
||||||
call Divide
|
call Divide
|
||||||
|
|
||||||
ldh a, [hQuotient + 0]
|
ldh a, [hQuotient + 1]
|
||||||
and a
|
and a
|
||||||
ld bc, -1
|
ld bc, -1
|
||||||
jr nz, .Update
|
jr nz, .Update
|
||||||
|
|
||||||
ldh a, [hQuotient + 1]
|
|
||||||
ld b, a
|
|
||||||
ldh a, [hQuotient + 2]
|
ldh a, [hQuotient + 2]
|
||||||
|
ld b, a
|
||||||
|
ldh a, [hQuotient + 3]
|
||||||
ld c, a
|
ld c, a
|
||||||
or b
|
or b
|
||||||
jr nz, .Update
|
jr nz, .Update
|
||||||
|
@ -21,7 +21,7 @@ BattleCommand_FrustrationPower:
|
|||||||
ldh [hDivisor], a
|
ldh [hDivisor], a
|
||||||
ld b, 4
|
ld b, 4
|
||||||
call Divide
|
call Divide
|
||||||
ldh a, [hQuotient + 2]
|
ldh a, [hQuotient + 3]
|
||||||
ld d, a
|
ld d, a
|
||||||
pop bc
|
pop bc
|
||||||
ret
|
ret
|
||||||
|
@ -19,7 +19,7 @@ BattleCommand_HappinessPower:
|
|||||||
ldh [hDivisor], a
|
ldh [hDivisor], a
|
||||||
ld b, 4
|
ld b, 4
|
||||||
call Divide
|
call Divide
|
||||||
ldh a, [hQuotient + 2]
|
ldh a, [hQuotient + 3]
|
||||||
ld d, a
|
ld d, a
|
||||||
pop bc
|
pop bc
|
||||||
ret
|
ret
|
||||||
|
@ -305,12 +305,12 @@ ComputeTrainerReward:
|
|||||||
ld hl, hProduct
|
ld hl, hProduct
|
||||||
xor a
|
xor a
|
||||||
ld [hli], a
|
ld [hli], a
|
||||||
ld [hli], a
|
ld [hli], a ; hMultiplicand + 0
|
||||||
ld [hli], a
|
ld [hli], a ; hMultiplicand + 1
|
||||||
ld a, [wEnemyTrainerBaseReward]
|
ld a, [wEnemyTrainerBaseReward]
|
||||||
ld [hli], a
|
ld [hli], a ; hMultiplicand + 2
|
||||||
ld a, [wCurPartyLevel]
|
ld a, [wCurPartyLevel]
|
||||||
ld [hl], a
|
ld [hl], a ; hMultiplier
|
||||||
call Multiply
|
call Multiply
|
||||||
ld hl, wBattleReward
|
ld hl, wBattleReward
|
||||||
xor a
|
xor a
|
||||||
|
@ -205,7 +205,7 @@ CalcMagikarpLength:
|
|||||||
ldh [hDivisor], a
|
ldh [hDivisor], a
|
||||||
ld b, 2
|
ld b, 2
|
||||||
call Divide
|
call Divide
|
||||||
ldh a, [hQuotient + 2]
|
ldh a, [hQuotient + 3]
|
||||||
ld c, a
|
ld c, a
|
||||||
|
|
||||||
; de = c + 100 × (2 + i)
|
; de = c + 100 × (2 + i)
|
||||||
|
@ -250,9 +250,9 @@ GetTreeScore:
|
|||||||
ld b, 2
|
ld b, 2
|
||||||
call Divide
|
call Divide
|
||||||
|
|
||||||
ldh a, [hQuotient + 1]
|
|
||||||
ldh [hDividend], a
|
|
||||||
ldh a, [hQuotient + 2]
|
ldh a, [hQuotient + 2]
|
||||||
|
ldh [hDividend], a
|
||||||
|
ldh a, [hQuotient + 3]
|
||||||
ldh [hDividend + 1], a
|
ldh [hDividend + 1], a
|
||||||
ld a, 10
|
ld a, 10
|
||||||
ldh [hDivisor], a
|
ldh [hDivisor], a
|
||||||
|
@ -43,7 +43,7 @@ GetUnownLetter:
|
|||||||
call Divide
|
call Divide
|
||||||
|
|
||||||
; Increment to get 1-26
|
; Increment to get 1-26
|
||||||
ldh a, [hQuotient + 2]
|
ldh a, [hQuotient + 3]
|
||||||
inc a
|
inc a
|
||||||
ld [wUnownLetter], a
|
ld [wUnownLetter], a
|
||||||
ret
|
ret
|
||||||
|
@ -310,10 +310,10 @@ PokeBallEffect:
|
|||||||
|
|
||||||
ld a, b
|
ld a, b
|
||||||
ldh [hDivisor], a
|
ldh [hDivisor], a
|
||||||
ld b, $4
|
ld b, 4
|
||||||
call Divide
|
call Divide
|
||||||
|
|
||||||
ldh a, [hQuotient + 2]
|
ldh a, [hQuotient + 3]
|
||||||
and a
|
and a
|
||||||
jr nz, .statuscheck
|
jr nz, .statuscheck
|
||||||
ld a, 1
|
ld a, 1
|
||||||
@ -1313,7 +1313,7 @@ RareCandyEffect:
|
|||||||
ld a, MON_EXP
|
ld a, MON_EXP
|
||||||
call GetPartyParamLocation
|
call GetPartyParamLocation
|
||||||
|
|
||||||
ldh a, [hMultiplicand]
|
ldh a, [hMultiplicand + 0]
|
||||||
ld [hli], a
|
ld [hli], a
|
||||||
ldh a, [hMultiplicand + 1]
|
ldh a, [hMultiplicand + 1]
|
||||||
ld [hli], a
|
ld [hli], a
|
||||||
@ -1963,9 +1963,9 @@ GetOneFifthMaxHP:
|
|||||||
ldh [hDivisor], a
|
ldh [hDivisor], a
|
||||||
ld b, 2
|
ld b, 2
|
||||||
call Divide
|
call Divide
|
||||||
ldh a, [hQuotient + 1]
|
|
||||||
ld d, a
|
|
||||||
ldh a, [hQuotient + 2]
|
ldh a, [hQuotient + 2]
|
||||||
|
ld d, a
|
||||||
|
ldh a, [hQuotient + 3]
|
||||||
ld e, a
|
ld e, a
|
||||||
pop bc
|
pop bc
|
||||||
ret
|
ret
|
||||||
@ -2814,7 +2814,7 @@ ComputeMaxPP:
|
|||||||
; Since this would overflow into bit 6, we prevent that from happening
|
; Since this would overflow into bit 6, we prevent that from happening
|
||||||
; by decreasing the extra amount of PP each PP Up provides, resulting
|
; by decreasing the extra amount of PP each PP Up provides, resulting
|
||||||
; in a maximum of 61.
|
; in a maximum of 61.
|
||||||
ldh a, [hQuotient + 2]
|
ldh a, [hQuotient + 3]
|
||||||
cp $8
|
cp $8
|
||||||
jr c, .okay
|
jr c, .okay
|
||||||
ld a, $7
|
ld a, $7
|
||||||
|
@ -786,10 +786,10 @@ Link_PrepPartyData_Gen1:
|
|||||||
pop bc
|
pop bc
|
||||||
pop de
|
pop de
|
||||||
|
|
||||||
ldh a, [hQuotient + 1]
|
ldh a, [hQuotient + 2]
|
||||||
ld [de], a
|
ld [de], a
|
||||||
inc de
|
inc de
|
||||||
ldh a, [hQuotient + 2]
|
ldh a, [hQuotient + 3]
|
||||||
ld [de], a
|
ld [de], a
|
||||||
inc de
|
inc de
|
||||||
ld h, b
|
ld h, b
|
||||||
@ -1059,10 +1059,10 @@ Function2868a:
|
|||||||
predef CalcMonStatC
|
predef CalcMonStatC
|
||||||
pop bc
|
pop bc
|
||||||
pop hl
|
pop hl
|
||||||
ldh a, [hQuotient + 1]
|
|
||||||
ld [hli], a
|
|
||||||
ldh a, [hQuotient + 2]
|
ldh a, [hQuotient + 2]
|
||||||
ld [hli], a
|
ld [hli], a
|
||||||
|
ldh a, [hQuotient + 3]
|
||||||
|
ld [hli], a
|
||||||
push hl
|
push hl
|
||||||
push bc
|
push bc
|
||||||
ld hl, MON_STAT_EXP - 1
|
ld hl, MON_STAT_EXP - 1
|
||||||
@ -1072,10 +1072,10 @@ Function2868a:
|
|||||||
predef CalcMonStatC
|
predef CalcMonStatC
|
||||||
pop bc
|
pop bc
|
||||||
pop hl
|
pop hl
|
||||||
ldh a, [hQuotient + 1]
|
|
||||||
ld [hli], a
|
|
||||||
ldh a, [hQuotient + 2]
|
ldh a, [hQuotient + 2]
|
||||||
ld [hli], a
|
ld [hli], a
|
||||||
|
ldh a, [hQuotient + 3]
|
||||||
|
ld [hli], a
|
||||||
push hl
|
push hl
|
||||||
ld hl, $1b
|
ld hl, $1b
|
||||||
add hl, bc
|
add hl, bc
|
||||||
|
@ -172,18 +172,18 @@ _Divide::
|
|||||||
|
|
||||||
.done
|
.done
|
||||||
ldh a, [hDividend + 1]
|
ldh a, [hDividend + 1]
|
||||||
ldh [hDivisor], a
|
ldh [hRemainder], a
|
||||||
|
|
||||||
ldh a, [hMathBuffer + 4]
|
ldh a, [hMathBuffer + 4]
|
||||||
ldh [hDividend + 3], a
|
ldh [hQuotient + 3], a
|
||||||
|
|
||||||
ldh a, [hMathBuffer + 3]
|
ldh a, [hMathBuffer + 3]
|
||||||
ldh [hDividend + 2], a
|
ldh [hQuotient + 2], a
|
||||||
|
|
||||||
ldh a, [hMathBuffer + 2]
|
ldh a, [hMathBuffer + 2]
|
||||||
ldh [hDividend + 1], a
|
ldh [hQuotient + 1], a
|
||||||
|
|
||||||
ldh a, [hMathBuffer + 1]
|
ldh a, [hMathBuffer + 1]
|
||||||
ldh [hDividend + 0], a
|
ldh [hQuotient + 0], a
|
||||||
|
|
||||||
ret
|
ret
|
||||||
|
@ -20,9 +20,12 @@ Credits::
|
|||||||
call ClearTileMap
|
call ClearTileMap
|
||||||
call ClearSprites
|
call ClearSprites
|
||||||
|
|
||||||
ld hl, wCreditsFaux2bpp
|
ld hl, wCreditsBlankFrame2bpp
|
||||||
ld c, $80
|
ld c, (wCreditsBlankFrame2bppEnd - wCreditsBlankFrame2bpp) / 2
|
||||||
ld de, $ff00
|
ld de, `22222222 ; eight pixels, each color #2 (dark)
|
||||||
|
|
||||||
|
; Fill wCreditsBlankFrame2bpp with 4x4=16 tiles, all solid dark color
|
||||||
|
; (the same color used for the four border frame mons' backgrounds)
|
||||||
|
|
||||||
.load_loop
|
.load_loop
|
||||||
ld a, e
|
ld a, e
|
||||||
@ -561,7 +564,7 @@ Credits_LoadBorderGFX:
|
|||||||
ret
|
ret
|
||||||
|
|
||||||
.init
|
.init
|
||||||
ld hl, wCreditsFaux2bpp
|
ld hl, wCreditsBlankFrame2bpp
|
||||||
ret
|
ret
|
||||||
|
|
||||||
.Frames:
|
.Frames:
|
||||||
|
@ -795,7 +795,7 @@ IntroScene9:
|
|||||||
call DelayFrame
|
call DelayFrame
|
||||||
call DelayFrame
|
call DelayFrame
|
||||||
call DelayFrame
|
call DelayFrame
|
||||||
ld a, $c ; $980c
|
ld a, LOW(vBGMap0 + $c) ; $c
|
||||||
ldh [hBGMapAddress], a
|
ldh [hBGMapAddress], a
|
||||||
call DelayFrame
|
call DelayFrame
|
||||||
call DelayFrame
|
call DelayFrame
|
||||||
|
@ -58,12 +58,12 @@ CalcExpAtLevel:
|
|||||||
ld b, 4
|
ld b, 4
|
||||||
call Divide
|
call Divide
|
||||||
; Push the cubic term to the stack
|
; Push the cubic term to the stack
|
||||||
ldh a, [hQuotient + 0]
|
|
||||||
push af
|
|
||||||
ldh a, [hQuotient + 1]
|
ldh a, [hQuotient + 1]
|
||||||
push af
|
push af
|
||||||
ldh a, [hQuotient + 2]
|
ldh a, [hQuotient + 2]
|
||||||
push af
|
push af
|
||||||
|
ldh a, [hQuotient + 3]
|
||||||
|
push af
|
||||||
; Square the level and multiply by the lower 7 bits of c
|
; Square the level and multiply by the lower 7 bits of c
|
||||||
call .LevelSquared
|
call .LevelSquared
|
||||||
ld a, [hl]
|
ld a, [hl]
|
||||||
|
@ -91,7 +91,7 @@ ComputeHPBarPixels:
|
|||||||
ldh [hDivisor], a
|
ldh [hDivisor], a
|
||||||
ld b, 4
|
ld b, 4
|
||||||
call Divide
|
call Divide
|
||||||
ldh a, [hQuotient + 2]
|
ldh a, [hQuotient + 3]
|
||||||
ld e, a
|
ld e, a
|
||||||
pop hl
|
pop hl
|
||||||
and a
|
and a
|
||||||
|
@ -766,10 +766,10 @@ MonMenu_Softboiled_MilkDrink:
|
|||||||
call Divide
|
call Divide
|
||||||
ld a, MON_HP + 1
|
ld a, MON_HP + 1
|
||||||
call GetPartyParamLocation
|
call GetPartyParamLocation
|
||||||
ldh a, [hQuotient + 2]
|
ldh a, [hQuotient + 3]
|
||||||
sub [hl]
|
sub [hl]
|
||||||
dec hl
|
dec hl
|
||||||
ldh a, [hQuotient + 1]
|
ldh a, [hQuotient + 2]
|
||||||
sbc [hl]
|
sbc [hl]
|
||||||
ret
|
ret
|
||||||
|
|
||||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user