hQuotient is a four-byte buffer (fixes #558)

This commit is contained in:
Rangi
2018-08-26 13:49:38 -04:00
parent cb32c895e4
commit 557ce82073
22 changed files with 107 additions and 110 deletions

View File

@@ -58,12 +58,12 @@ CalcExpAtLevel:
ld b, 4
call Divide
; Push the cubic term to the stack
ldh a, [hQuotient + 0]
push af
ldh a, [hQuotient + 1]
push af
ldh a, [hQuotient + 2]
push af
ldh a, [hQuotient + 3]
push af
; Square the level and multiply by the lower 7 bits of c
call .LevelSquared
ld a, [hl]

View File

@@ -91,7 +91,7 @@ ComputeHPBarPixels:
ldh [hDivisor], a
ld b, 4
call Divide
ldh a, [hQuotient + 2]
ldh a, [hQuotient + 3]
ld e, a
pop hl
and a

View File

@@ -766,10 +766,10 @@ MonMenu_Softboiled_MilkDrink:
call Divide
ld a, MON_HP + 1
call GetPartyParamLocation
ldh a, [hQuotient + 2]
ldh a, [hQuotient + 3]
sub [hl]
dec hl
ldh a, [hQuotient + 1]
ldh a, [hQuotient + 2]
sbc [hl]
ret

View File

@@ -1570,11 +1570,11 @@ CalcMonStatC:
jr nz, .not_hp
ld a, [wCurPartyLevel]
ld b, a
ldh a, [hQuotient + 2]
ldh a, [hQuotient + 3]
add b
ldh [hMultiplicand + 2], a
jr nc, .no_overflow_3
ldh a, [hQuotient + 1]
ldh a, [hQuotient + 2]
inc a
ldh [hMultiplicand + 1], a
@@ -1583,21 +1583,21 @@ CalcMonStatC:
.not_hp
ld b, a
ldh a, [hQuotient + 2]
ldh a, [hQuotient + 3]
add b
ldh [hMultiplicand + 2], a
jr nc, .no_overflow_4
ldh a, [hQuotient + 1]
ldh a, [hQuotient + 2]
inc a
ldh [hMultiplicand + 1], a
.no_overflow_4
ldh a, [hQuotient + 1]
ldh a, [hQuotient + 2]
cp HIGH(MAX_STAT_VALUE + 1) + 1
jr nc, .max_stat
cp HIGH(MAX_STAT_VALUE + 1)
jr c, .stat_value_okay
ldh a, [hQuotient + 2]
ldh a, [hQuotient + 3]
cp LOW(MAX_STAT_VALUE + 1)
jr c, .stat_value_okay

View File

@@ -636,15 +636,15 @@ StatsScreen_LoadGFX:
farcall CalcExpAtLevel
ld hl, wTempMonExp + 2
ld hl, wTempMonExp + 2
ldh a, [hQuotient + 2]
ldh a, [hQuotient + 3]
sub [hl]
dec hl
ld [wBuffer3], a
ldh a, [hQuotient + 1]
ldh a, [hQuotient + 2]
sbc [hl]
dec hl
ld [wBuffer2], a
ldh a, [hQuotient]
ldh a, [hQuotient + 1]
sbc [hl]
ld [wBuffer1], a
ret