Merge pull request #433 from roukaour/master

More code cleanup
This commit is contained in:
yenatch
2017-12-25 19:01:36 -05:00
committed by GitHub
106 changed files with 997 additions and 1009 deletions

View File

@@ -539,7 +539,7 @@ PlayDanger: ; e8307
ld a, [Danger] ld a, [Danger]
bit DANGER_ON_F, a bit DANGER_ON_F, a
ret z ret z
and $ff - (1 << DANGER_ON_F) and $ff ^ (1 << DANGER_ON_F)
ld d, a ld d, a
call _CheckSFX call _CheckSFX
jr c, .asm_e8335 jr c, .asm_e8335
@@ -2299,7 +2299,7 @@ SetNoteDuration: ; e8a8d
; multiply NoteLength by delay units ; multiply NoteLength by delay units
ld l, 0 ; just multiply ld l, 0 ; just multiply
call .Multiply call .Multiply
ld a, l ; % $100 ld a, l ; low
; store Tempo in de ; store Tempo in de
ld hl, Channel1Tempo - Channel1 ld hl, Channel1Tempo - Channel1
add hl, bc add hl, bc
@@ -2310,7 +2310,7 @@ SetNoteDuration: ; e8a8d
ld hl, Channel1Field0x16 - Channel1 ld hl, Channel1Field0x16 - Channel1
add hl, bc add hl, bc
ld l, [hl] ld l, [hl]
; multiply Tempo by last result (NoteLength * delay % $100) ; multiply Tempo by last result (NoteLength * LOW(delay))
call .Multiply call .Multiply
; copy result to de ; copy result to de
ld e, l ld e, l

View File

@@ -141,7 +141,7 @@ AI_Setup: ; 385e0
.discourage .discourage
call Random call Random
cp 30 cp 12 percent
jr c, .checkmove jr c, .checkmove
inc [hl] inc [hl]
inc [hl] inc [hl]
@@ -453,7 +453,7 @@ AI_Smart_LeechHit: ; 387f7
.asm_38815 .asm_38815
call Random call Random
cp 100 cp 39 percent + 1
ret c ret c
inc [hl] inc [hl]
@@ -594,7 +594,7 @@ AI_Smart_Selfdestruct: ; 388a6
; If enemy's HP is between 25% and 50%, ; If enemy's HP is between 25% and 50%,
; over 90% chance to greatly discourage this move. ; over 90% chance to greatly discourage this move.
call Random call Random
cp 20 cp 9 percent - 2
ret c ret c
.asm_388c6 .asm_388c6
@@ -610,7 +610,7 @@ AI_Smart_DreamEater: ; 388ca
; The AI_Basic layer will make sure that ; The AI_Basic layer will make sure that
; Dream Eater is only used against sleeping targets. ; Dream Eater is only used against sleeping targets.
call Random call Random
cp 25 cp 10 percent
ret c ret c
dec [hl] dec [hl]
dec [hl] dec [hl]
@@ -637,7 +637,7 @@ AI_Smart_EvasionUp: ; 388d4
; ...70% chance to greatly encourage this move if player is not badly poisoned. ; ...70% chance to greatly encourage this move if player is not badly poisoned.
call Random call Random
cp $b2 cp 70 percent
jr nc, .asm_38911 jr nc, .asm_38911
.asm_388ef .asm_388ef
@@ -653,7 +653,7 @@ AI_Smart_EvasionUp: ; 388d4
; If enemy's HP is above 25% but not full, 4% chance to greatly encourage this move. ; If enemy's HP is above 25% but not full, 4% chance to greatly encourage this move.
call Random call Random
cp $a cp 4 percent
jr c, .asm_388ef jr c, .asm_388ef
; If enemy's HP is between 25% and 50%,... ; If enemy's HP is between 25% and 50%,...
@@ -710,11 +710,11 @@ AI_Smart_EvasionUp: ; 388d4
ret ret
; Player is badly poisoned. ; Player is badly poisoned.
; 80% chance to greatly encourage this move. ; 70% chance to greatly encourage this move.
; This would counter any previous discouragement. ; This would counter any previous discouragement.
.asm_38938 .asm_38938
call Random call Random
cp $50 cp 31 percent + 1
ret c ret c
dec [hl] dec [hl]
dec [hl] dec [hl]
@@ -791,7 +791,7 @@ AI_Smart_MirrorMove: ; 3895b
ret nc ret nc
call Random call Random
cp $19 cp 10 percent
ret c ret c
dec [hl] dec [hl]
@@ -816,7 +816,7 @@ AI_Smart_AccuracyDown: ; 38985
; ...70% chance to greatly encourage this move if player is not badly poisoned. ; ...70% chance to greatly encourage this move if player is not badly poisoned.
call Random call Random
cp $b2 cp 70 percent
jr nc, .asm_389bf jr nc, .asm_389bf
.asm_3899d .asm_3899d
@@ -832,7 +832,7 @@ AI_Smart_AccuracyDown: ; 38985
; If player's HP is above 25% but not full, 4% chance to greatly encourage this move. ; If player's HP is above 25% but not full, 4% chance to greatly encourage this move.
call Random call Random
cp $a cp 4 percent
jr c, .asm_3899d jr c, .asm_3899d
; If player's HP is between 25% and 50%,... ; If player's HP is between 25% and 50%,...
@@ -884,11 +884,11 @@ AI_Smart_AccuracyDown: ; 38985
ret ret
; Player is badly poisoned. ; Player is badly poisoned.
; 80% chance to greatly encourage this move. ; 70% chance to greatly encourage this move.
; This would counter any previous discouragement. ; This would counter any previous discouragement.
.asm_389e6 .asm_389e6
call Random call Random
cp $50 cp 31 percent + 1
ret c ret c
dec [hl] dec [hl]
dec [hl] dec [hl]
@@ -934,7 +934,7 @@ AI_Smart_ResetStats: ; 389f5
.asm_38a12 .asm_38a12
pop hl pop hl
call Random call Random
cp $28 cp 16 percent
ret c ret c
dec [hl] dec [hl]
ret ret
@@ -955,7 +955,7 @@ AI_Smart_Bide: ; 38a1e
call AICheckEnemyMaxHP call AICheckEnemyMaxHP
ret c ret c
call Random call Random
cp $19 cp 10 percent
ret c ret c
inc [hl] inc [hl]
ret ret
@@ -997,7 +997,7 @@ AI_Smart_Moonlight: ; 38a3a
.asm_38a45 .asm_38a45
call Random call Random
cp $19 cp 10 percent
ret c ret c
dec [hl] dec [hl]
dec [hl] dec [hl]
@@ -1023,7 +1023,7 @@ AI_Smart_Reflect: ; 38a54
call AICheckEnemyMaxHP call AICheckEnemyMaxHP
ret c ret c
call Random call Random
cp $14 cp 8 percent
ret c ret c
inc [hl] inc [hl]
ret ret
@@ -1126,7 +1126,7 @@ AI_Smart_Unused2B: ; 38a9c
.asm_38acd .asm_38acd
call Random call Random
cp $c8 cp 79 percent - 1
ret c ret c
.asm_38ad3 .asm_38ad3
@@ -1148,7 +1148,7 @@ AI_Smart_Confuse: ; 38adb
call AICheckPlayerHalfHP call AICheckPlayerHalfHP
ret c ret c
call Random call Random
cp $19 cp 10 percent
jr c, .asm_38ae7 jr c, .asm_38ae7
inc [hl] inc [hl]
@@ -1272,7 +1272,7 @@ AI_Smart_SpeedDownHit: ; 38b40
call AICompareSpeed call AICompareSpeed
ret c ret c
call Random call Random
cp 30 cp 12 percent
ret c ret c
dec [hl] dec [hl]
dec [hl] dec [hl]
@@ -1304,7 +1304,7 @@ AI_Smart_HyperBeam: ; 38b63
.asm_38b72 .asm_38b72
; If enemy's HP is above 50%, discourage this move at random ; If enemy's HP is above 50%, discourage this move at random
call Random call Random
cp 40 cp 16 percent
ret c ret c
inc [hl] inc [hl]
call AI_50_50 call AI_50_50
@@ -1457,7 +1457,7 @@ AI_Smart_Counter: ; 38bf1
.asm_38c30 .asm_38c30
call Random call Random
cp $64 cp 39 percent + 1
jr c, .asm_38c38 jr c, .asm_38c38
dec [hl] dec [hl]
@@ -1510,7 +1510,7 @@ AI_Smart_Encore: ; 38c3b
.asm_38c78 .asm_38c78
call Random call Random
cp $46 cp 28 percent - 1
ret c ret c
dec [hl] dec [hl]
dec [hl] dec [hl]
@@ -1657,7 +1657,7 @@ AI_Smart_Spite: ; 38cd5
jr nc, .asm_38d0b jr nc, .asm_38d0b
call Random call Random
cp $64 cp 39 percent + 1
ret nc ret nc
.asm_38d0b .asm_38d0b
@@ -1666,7 +1666,7 @@ AI_Smart_Spite: ; 38cd5
.asm_38d0d .asm_38d0d
call Random call Random
cp $64 cp 39 percent + 1
ret c ret c
dec [hl] dec [hl]
dec [hl] dec [hl]
@@ -1827,7 +1827,7 @@ AI_Smart_Conversion2: ; 38d98
.asm_38dc9 .asm_38dc9
call Random call Random
cp 25 cp 10 percent
ret c ret c
inc [hl] inc [hl]
ret ret
@@ -1848,7 +1848,7 @@ AI_Smart_Disable: ; 38dd1
jr nc, .asm_38dee jr nc, .asm_38dee
call Random call Random
cp 100 cp 39 percent + 1
ret c ret c
dec [hl] dec [hl]
ret ret
@@ -1860,7 +1860,7 @@ AI_Smart_Disable: ; 38dd1
.asm_38df3 .asm_38df3
call Random call Random
cp 20 cp 8 percent
ret c ret c
inc [hl] inc [hl]
ret ret
@@ -2096,7 +2096,7 @@ AI_Smart_Protect: ; 38ed2
.asm_38f14 .asm_38f14
call Random call Random
cp 20 cp 8 percent
ret c ret c
inc [hl] inc [hl]
inc [hl] inc [hl]
@@ -2120,14 +2120,14 @@ AI_Smart_Foresight: ; 38f1d
jr z, .asm_38f41 jr z, .asm_38f41
call Random call Random
cp 20 cp 8 percent
ret c ret c
inc [hl] inc [hl]
ret ret
.asm_38f41 .asm_38f41
call Random call Random
cp 100 cp 39 percent + 1
ret c ret c
dec [hl] dec [hl]
dec [hl] dec [hl]
@@ -2317,7 +2317,7 @@ AI_Smart_Rollout: ; 38fef
; Otherwise, 80% chance to greatly encourage this move. ; Otherwise, 80% chance to greatly encourage this move.
call Random call Random
cp 200 cp 79 percent - 1
ret nc ret nc
dec [hl] dec [hl]
dec [hl] dec [hl]
@@ -2347,7 +2347,7 @@ AI_Smart_Attract: ; 39026
.first_turn .first_turn
call Random call Random
cp 200 cp 79 percent - 1
ret nc ret nc
dec [hl] dec [hl]
ret ret
@@ -2850,7 +2850,7 @@ AI_Smart_Solarbeam: ; 3920b
ret nz ret nz
call Random call Random
cp 25 ; 1/10 cp 10 percent
ret c ret c
inc [hl] inc [hl]
@@ -2875,7 +2875,7 @@ AI_Smart_Thunder: ; 39225
ret nz ret nz
call Random call Random
cp 25 ; 1/10 cp 10 percent
ret c ret c
inc [hl] inc [hl]
@@ -3387,7 +3387,7 @@ AI_Cautious: ; 39418
jr nc, .asm_39425 jr nc, .asm_39425
call Random call Random
cp 230 cp 90 percent + 1
ret nc ret nc
inc [hl] inc [hl]
@@ -3513,7 +3513,7 @@ AI_Risky: ; 394a9
; Else, 80% chance to exclude them. ; Else, 80% chance to exclude them.
call Random call Random
cp 200 ; 1/5 cp 79 percent - 1
jr c, .nextmove jr c, .nextmove
.checkko .checkko
@@ -3586,13 +3586,13 @@ AIGetEnemyMove: ; 39508
AI_80_20: ; 39521 AI_80_20: ; 39521
call Random call Random
cp 50 ; 1/5 cp 20 percent - 1
ret ret
; 39527 ; 39527
AI_50_50: ; 39527 AI_50_50: ; 39527
call Random call Random
cp $80 ; 1/2 cp 50 percent + 1
ret ret
; 3952d ; 3952d

View File

@@ -237,16 +237,16 @@ Functioncc220: ; cc220
; Appears to be unused. ; Appears to be unused.
xor a xor a
ld [hBGMapMode], a ld [hBGMapMode], a
ld a, (VBGMap0 tile $28) % $100 ld a, LOW(VBGMap0 tile $28)
ld [hBGMapAddress], a ld [hBGMapAddress], a
ld a, (VBGMap0 tile $28) / $100 ld a, HIGH(VBGMap0 tile $28)
ld [hBGMapAddress + 1], a ld [hBGMapAddress + 1], a
call WaitBGMap2 call WaitBGMap2
ld a, $60 ld a, $60
ld [hWY], a ld [hWY], a
xor a xor a ; LOW(VBGMap0)
ld [hBGMapAddress], a ld [hBGMapAddress], a
ld a, VBGMap0 / $100 ld a, HIGH(VBGMap0)
ld [hBGMapAddress + 1], a ld [hBGMapAddress + 1], a
call BattleAnimDelayFrame call BattleAnimDelayFrame
ret ret
@@ -1501,10 +1501,10 @@ BattleAnim_UpdateOAM_All: ; cc96e
jr nz, .loop jr nz, .loop
ld a, [wBattleAnimOAMPointerLo] ld a, [wBattleAnimOAMPointerLo]
ld l, a ld l, a
ld h, Sprites / $100 ld h, HIGH(Sprites)
.loop2 .loop2
ld a, l ld a, l
cp SpritesEnd % $100 cp LOW(SpritesEnd)
jr nc, .done jr nc, .done
xor a xor a
ld [hli], a ld [hli], a

View File

@@ -1223,7 +1223,7 @@ BattleBGEffect_DoubleTeam: ; c8689 (32:4689)
xor $ff xor $ff
inc a inc a
ld d, a ld d, a
ld h, LYOverridesBackup / $100 ld h, HIGH(LYOverridesBackup)
ld a, [hLYOverrideStart] ld a, [hLYOverrideStart]
ld l, a ld l, a
ld a, [hLYOverrideEnd] ld a, [hLYOverrideEnd]
@@ -1264,7 +1264,7 @@ BattleBGEffect_AcidArmor: ; c8709 (32:4709)
ld e, [hl] ld e, [hl]
ld d, 2 ld d, 2
call Functionc8f2e call Functionc8f2e
ld h, LYOverridesBackup / $100 ld h, HIGH(LYOverridesBackup)
ld a, [hLYOverrideEnd] ld a, [hLYOverrideEnd]
ld l, a ld l, a
ld [hl], $0 ld [hl], $0
@@ -1275,7 +1275,7 @@ BattleBGEffect_AcidArmor: ; c8709 (32:4709)
.one .one
ld a, [hLYOverrideEnd] ld a, [hLYOverrideEnd]
ld l, a ld l, a
ld h, LYOverridesBackup / $100 ld h, HIGH(LYOverridesBackup)
ld e, l ld e, l
ld d, h ld d, h
dec de dec de
@@ -1554,7 +1554,7 @@ Functionc88a5: ; c88a5 (32:48a5)
ld a, [hLYOverrideEnd] ld a, [hLYOverrideEnd]
sub d sub d
ld d, a ld d, a
ld h, LYOverridesBackup / $100 ld h, HIGH(LYOverridesBackup)
ld a, [hSCY] ld a, [hSCY]
or a or a
jr nz, .skip1 jr nz, .skip1
@@ -1846,7 +1846,7 @@ BattleBGEffect_2a: ; c8a3a (32:4a3a)
ld [hLYOverrideEnd], a ld [hLYOverrideEnd], a
ld a, [hLYOverrideStart] ld a, [hLYOverrideStart]
ld l, a ld l, a
ld h, LYOverridesBackup / $100 ld h, HIGH(LYOverridesBackup)
.loop .loop
ld a, [hLYOverrideEnd] ld a, [hLYOverrideEnd]
cp l cp l
@@ -1900,7 +1900,7 @@ BattleBGEffect_2a: ; c8a3a (32:4a3a)
ld a, [hLYOverrideEnd] ld a, [hLYOverrideEnd]
sub l sub l
srl a srl a
ld h, LYOverridesBackup / $100 ld h, HIGH(LYOverridesBackup)
.loop2 .loop2
ld [hl], e ld [hl], e
inc hl inc hl
@@ -2851,7 +2851,7 @@ BattleBGEffect_WavyScreenFX: ; c8fef (32:4fef)
ld l, a ld l, a
inc a inc a
ld e, a ld e, a
ld h, LYOverridesBackup / $100 ld h, HIGH(LYOverridesBackup)
ld d, h ld d, h
ld a, [hLYOverrideEnd] ld a, [hLYOverrideEnd]
sub l sub l
@@ -2874,7 +2874,7 @@ BattleBGEffect_WavyScreenFX: ; c8fef (32:4fef)
BGEffect_FillLYOverridesBackup: ; c900b (32:500b) BGEffect_FillLYOverridesBackup: ; c900b (32:500b)
push af push af
ld h, LYOverridesBackup / $100 ld h, HIGH(LYOverridesBackup)
ld a, [hLYOverrideStart] ld a, [hLYOverrideStart]
ld l, a ld l, a
ld a, [hLYOverrideEnd] ld a, [hLYOverrideEnd]
@@ -2897,7 +2897,7 @@ BGEffect_DisplaceLYOverridesBackup: ; c901b (32:501b)
sub l sub l
sub e sub e
ld d, a ld d, a
ld h, LYOverridesBackup / $100 ld h, HIGH(LYOverridesBackup)
ld a, [hLYOverrideStart] ld a, [hLYOverrideStart]
ld l, a ld l, a
ld a, $90 ld a, $90

View File

@@ -2573,11 +2573,11 @@ WinTrainerBattle: ; 3cfa4
.CheckMaxedOutMomMoney: ; 3d0b1 .CheckMaxedOutMomMoney: ; 3d0b1
ld hl, wMomsMoney + 2 ld hl, wMomsMoney + 2
ld a, [hld] ld a, [hld]
cp MAX_MONEY % $100 cp LOW(MAX_MONEY)
ld a, [hld] ld a, [hld]
sbc MAX_MONEY / $100 % $100 sbc HIGH(MAX_MONEY) ; mid
ld a, [hl] ld a, [hl]
sbc MAX_MONEY / $10000 % $100 sbc HIGH(MAX_MONEY >> 8)
ret ret
; 3d0be ; 3d0be
@@ -2602,17 +2602,17 @@ AddBattleMoneyToAccount: ; 3d0be
jr nz, .loop jr nz, .loop
pop hl pop hl
ld a, [hld] ld a, [hld]
cp MAX_MONEY % $100 cp LOW(MAX_MONEY)
ld a, [hld] ld a, [hld]
sbc MAX_MONEY / $100 % $100 sbc HIGH(MAX_MONEY) ; mid
ld a, [hl] ld a, [hl]
sbc MAX_MONEY / $10000 % $100 sbc HIGH(MAX_MONEY >> 8)
ret c ret c
ld [hl], MAX_MONEY / $10000 % $100 ld [hl], HIGH(MAX_MONEY >> 8)
inc hl inc hl
ld [hl], MAX_MONEY / $100 % $100 ld [hl], HIGH(MAX_MONEY) ; mid
inc hl inc hl
ld [hl], MAX_MONEY % $100 ld [hl], LOW(MAX_MONEY)
ret ret
; 3d0ea ; 3d0ea
@@ -6384,25 +6384,25 @@ LoadEnemyMon: ; 3e8eb
; We're clear if the length is < 1536 ; We're clear if the length is < 1536
ld a, [wMagikarpLength] ld a, [wMagikarpLength]
cp $06 ; $600 = 1536 cp HIGH(1536)
jr nz, .CheckMagikarpArea jr nz, .CheckMagikarpArea
; 5% chance of skipping size checks ; 5% chance of skipping both size checks
call Random call Random
cp $0c ; / $100 cp 5 percent
jr c, .CheckMagikarpArea jr c, .CheckMagikarpArea
; Try again if > 1614 ; Try again if > 1614
ld a, [wMagikarpLength + 1] ld a, [wMagikarpLength + 1]
cp $50 cp LOW(1614) + 2
jr nc, .GenerateDVs jr nc, .GenerateDVs
; 20% chance of skipping this check ; 20% chance of skipping this check
call Random call Random
cp $32 ; / $100 cp 20 percent - 1
jr c, .CheckMagikarpArea jr c, .CheckMagikarpArea
; Try again if > 1598 ; Try again if > 1598
ld a, [wMagikarpLength + 1] ld a, [wMagikarpLength + 1]
cp $40 cp LOW(1598) + 2
jr nc, .GenerateDVs jr nc, .GenerateDVs
.CheckMagikarpArea: .CheckMagikarpArea:
@@ -6423,11 +6423,11 @@ LoadEnemyMon: ; 3e8eb
jr z, .Happiness jr z, .Happiness
; 40% chance of not flooring ; 40% chance of not flooring
call Random call Random
cp $64 ; / $100 cp 40 percent - 2
jr c, .Happiness jr c, .Happiness
; Floor at length 1024 ; Floor at length 1024
ld a, [wMagikarpLength] ld a, [wMagikarpLength]
cp 1024 >> 8 cp HIGH(1024)
jr c, .GenerateDVs ; try again jr c, .GenerateDVs ; try again
; Finally done with DVs ; Finally done with DVs
@@ -6462,7 +6462,7 @@ LoadEnemyMon: ; 3e8eb
.TreeMon: .TreeMon:
; If we're headbutting trees, some monsters enter battle asleep ; If we're headbutting trees, some monsters enter battle asleep
call CheckSleepingTreeMon call CheckSleepingTreeMon
ld a, SLP ; Asleep for 7 turns ld a, TREEMON_SLEEP_TURNS
jr c, .UpdateStatus jr c, .UpdateStatus
; Otherwise, no status ; Otherwise, no status
xor a xor a
@@ -7009,14 +7009,14 @@ ApplyStatLevelMultiplier: ; 3ecb7
; Cap at 999. ; Cap at 999.
ld a, [hQuotient + 2] ld a, [hQuotient + 2]
sub MAX_STAT_VALUE % $100 sub LOW(MAX_STAT_VALUE)
ld a, [hQuotient + 1] ld a, [hQuotient + 1]
sbc MAX_STAT_VALUE / $100 sbc HIGH(MAX_STAT_VALUE)
jp c, .okay3 jp c, .okay3
ld a, MAX_STAT_VALUE / $100 ld a, HIGH(MAX_STAT_VALUE)
ld [hQuotient + 1], a ld [hQuotient + 1], a
ld a, MAX_STAT_VALUE % $100 ld a, LOW(MAX_STAT_VALUE)
ld [hQuotient + 2], a ld [hQuotient + 2], a
.okay3 .okay3
@@ -7132,13 +7132,13 @@ BoostStat: ; 3ed7c
; Cap at 999. ; Cap at 999.
ld a, [hld] ld a, [hld]
sub MAX_STAT_VALUE % $100 sub LOW(MAX_STAT_VALUE)
ld a, [hl] ld a, [hl]
sbc MAX_STAT_VALUE / $100 sbc HIGH(MAX_STAT_VALUE)
ret c ret c
ld a, MAX_STAT_VALUE / $100 ld a, HIGH(MAX_STAT_VALUE)
ld [hli], a ld [hli], a
ld a, MAX_STAT_VALUE % $100 ld a, LOW(MAX_STAT_VALUE)
ld [hld], a ld [hld], a
ret ret
; 3ed9f ; 3ed9f
@@ -7217,7 +7217,7 @@ _BattleRandom:: ; 3edd8
ld b, 10 ; number of seeds ld b, 10 ; number of seeds
; Generate next number in the sequence for each seed ; Generate next number in the sequence for each seed
; The algorithm takes the form *5 + 1 % 256 ; a[n+1] = (a[n] * 5 + 1) % 256
.loop .loop
; get last # ; get last #
ld a, [hl] ld a, [hl]
@@ -9135,10 +9135,10 @@ AddLastMobileBattleToLinkRecord: ; 3fa42
dec hl dec hl
ld a, [hl] ld a, [hl]
inc hl inc hl
cp MAX_LINK_RECORD / $100 cp HIGH(MAX_LINK_RECORD)
ret c ret c
ld a, [hl] ld a, [hl]
cp MAX_LINK_RECORD % $100 cp LOW(MAX_LINK_RECORD)
ret ret
; 3fac8 ; 3fac8

View File

@@ -3576,14 +3576,14 @@ BattleCommand_DamageCalc: ; 35612
jr nz, .Cap jr nz, .Cap
ld a, [hProduct + 2] ld a, [hProduct + 2]
cp 998 / $100 cp HIGH(MAX_STAT_VALUE - MIN_NEUTRAL_DAMAGE + 1)
jr c, .dont_cap_2 jr c, .dont_cap_2
cp 998 / $100 + 1 cp HIGH(MAX_STAT_VALUE - MIN_NEUTRAL_DAMAGE + 1) + 1
jr nc, .Cap jr nc, .Cap
ld a, [hProduct + 3] ld a, [hProduct + 3]
cp 998 % $100 cp LOW(MAX_STAT_VALUE - MIN_NEUTRAL_DAMAGE + 1)
jr nc, .Cap jr nc, .Cap
.dont_cap_2 .dont_cap_2
@@ -3601,21 +3601,21 @@ BattleCommand_DamageCalc: ; 35612
jr c, .Cap jr c, .Cap
ld a, [hl] ld a, [hl]
cp 998 / $100 cp HIGH(MAX_STAT_VALUE - MIN_NEUTRAL_DAMAGE + 1)
jr c, .dont_cap_3 jr c, .dont_cap_3
cp 998 / $100 + 1 cp HIGH(MAX_STAT_VALUE - MIN_NEUTRAL_DAMAGE + 1) + 1
jr nc, .Cap jr nc, .Cap
inc hl inc hl
ld a, [hld] ld a, [hld]
cp 998 % $100 cp LOW(MAX_STAT_VALUE - MIN_NEUTRAL_DAMAGE + 1)
jr c, .dont_cap_3 jr c, .dont_cap_3
.Cap: .Cap:
ld a, 997 / $100 ld a, HIGH(MAX_STAT_VALUE - MIN_NEUTRAL_DAMAGE)
ld [hli], a ld [hli], a
ld a, 997 % $100 ld a, LOW(MAX_STAT_VALUE - MIN_NEUTRAL_DAMAGE)
ld [hld], a ld [hld], a
@@ -3623,7 +3623,7 @@ BattleCommand_DamageCalc: ; 35612
; Minimum neutral damage is 2 (bringing the cap to 999). ; Minimum neutral damage is 2 (bringing the cap to 999).
inc hl inc hl
ld a, [hl] ld a, [hl]
add 2 add MIN_NEUTRAL_DAMAGE
ld [hld], a ld [hld], a
jr nc, .dont_floor jr nc, .dont_floor
inc [hl] inc [hl]
@@ -5651,10 +5651,10 @@ CheckIfStatCanBeRaised: ; 361ef
.no_carry .no_carry
pop bc pop bc
ld a, [hld] ld a, [hld]
sub MAX_STAT_VALUE % $100 sub LOW(MAX_STAT_VALUE)
jr nz, .not_already_max jr nz, .not_already_max
ld a, [hl] ld a, [hl]
sbc MAX_STAT_VALUE / $100 sbc HIGH(MAX_STAT_VALUE)
jp z, .stats_already_max jp z, .stats_already_max
.not_already_max .not_already_max
ld a, [hBattleTurn] ld a, [hBattleTurn]
@@ -6417,14 +6417,14 @@ CalcStats: ; 3661d
.check_maxed_out .check_maxed_out
ld a, [hQuotient + 2] ld a, [hQuotient + 2]
cp MAX_STAT_VALUE % $100 cp LOW(MAX_STAT_VALUE)
ld a, b ld a, b
sbc MAX_STAT_VALUE / $100 sbc HIGH(MAX_STAT_VALUE)
jr c, .not_maxed_out jr c, .not_maxed_out
ld a, MAX_STAT_VALUE % $100 ld a, LOW(MAX_STAT_VALUE)
ld [hQuotient + 2], a ld [hQuotient + 2], a
ld a, MAX_STAT_VALUE / $100 ld a, HIGH(MAX_STAT_VALUE)
ld [hQuotient + 1], a ld [hQuotient + 1], a
.not_maxed_out .not_maxed_out
@@ -8367,7 +8367,7 @@ BattleCommand_Heal: ; 3713e
call GetBattleVarAddr call GetBattleVarAddr
ld a, [hl] ld a, [hl]
and a and a
ld [hl], REST_TURNS + 1 ld [hl], REST_SLEEP_TURNS + 1
ld hl, WentToSleepText ld hl, WentToSleepText
jr z, .no_status_to_heal jr z, .no_status_to_heal
ld hl, RestedText ld hl, RestedText

View File

@@ -106,7 +106,7 @@ BattleAnimOAMUpdate: ; cca09
ld l, a ld l, a
ld a, [wBattleAnimOAMPointerLo] ld a, [wBattleAnimOAMPointerLo]
ld e, a ld e, a
ld d, Sprites / $100 ld d, HIGH(Sprites)
.loop .loop
ld a, [wBattleAnimTempYCoord] ld a, [wBattleAnimTempYCoord]
ld b, a ld b, a

View File

@@ -10,8 +10,12 @@ NUM_MOVES EQU 4
BASE_STAT_LEVEL EQU 7 BASE_STAT_LEVEL EQU 7
MAX_STAT_LEVEL EQU 13 MAX_STAT_LEVEL EQU 13
; turns that Rest sleep lasts ; minimum damage before type effectiveness
REST_TURNS EQU 2 MIN_NEUTRAL_DAMAGE EQU 2
; turns that sleep lasts
REST_SLEEP_TURNS EQU 2
TREEMON_SLEEP_TURNS EQU 7
; PlayerStatLevels and EnemyStatLevels indexes ; PlayerStatLevels and EnemyStatLevels indexes
; used for GetStatName ; used for GetStatName

View File

@@ -120,3 +120,5 @@ const_value = 1
const HAPPINESS_REVIVALHERB ; 11 const HAPPINESS_REVIVALHERB ; 11
const HAPPINESS_MASSAGE ; 12 const HAPPINESS_MASSAGE ; 12
const HAPPINESS_GAINLEVELATHOME ; 13 const HAPPINESS_GAINLEVELATHOME ; 13
MAX_DAY_CARE_EXP EQU $500000

View File

@@ -0,0 +1,35 @@
EnvironmentColorsPointers:
; entries correspond to environment constants (see constants/map_constants.asm)
dw .OutdoorColors ; unused
dw .OutdoorColors ; TOWN
dw .OutdoorColors ; ROUTE
dw .IndoorColors ; INDOOR
dw .DungeonColors ; CAVE
dw .Env5Colors ; ENVIRONMENT_5
dw .IndoorColors ; GATE
dw .DungeonColors ; DUNGEON
; Valid indices: $00 - $29
.OutdoorColors:
db $00, $01, $02, $28, $04, $05, $06, $07 ; morn
db $08, $09, $0a, $28, $0c, $0d, $0e, $0f ; day
db $10, $11, $12, $29, $14, $15, $16, $17 ; nite
db $18, $19, $1a, $1b, $1c, $1d, $1e, $1f ; dark
.IndoorColors:
db $20, $21, $22, $23, $24, $25, $26, $07 ; morn
db $20, $21, $22, $23, $24, $25, $26, $07 ; day
db $10, $11, $12, $13, $14, $15, $16, $07 ; nite
db $18, $19, $1a, $1b, $1c, $1d, $1e, $07 ; dark
.DungeonColors:
db $00, $01, $02, $03, $04, $05, $06, $07 ; morn
db $08, $09, $0a, $0b, $0c, $0d, $0e, $0f ; day
db $10, $11, $12, $13, $14, $15, $16, $17 ; nite
db $18, $19, $1a, $1b, $1c, $1d, $1e, $1f ; dark
.Env5Colors:
db $00, $01, $02, $03, $04, $05, $06, $07 ; morn
db $08, $09, $0a, $0b, $0c, $0d, $0e, $0f ; day
db $10, $11, $12, $13, $14, $15, $16, $17 ; nite
db $18, $19, $1a, $1b, $1c, $1d, $1e, $1f ; dark

View File

@@ -1,6 +1,5 @@
; valid roofs: 0, 1, 2, 3, 4, or -1 for none
MapGroupRoofs: ; 1c021i MapGroupRoofs: ; 1c021i
; entries correspond to Roofs (see below)
db -1 ; group 0 (unused) db -1 ; group 0 (unused)
db 3 ; group 1 (Olivine) db 3 ; group 1 (Olivine)
db 2 ; group 2 (Mahogany) db 2 ; group 2 (Mahogany)
@@ -29,3 +28,11 @@ MapGroupRoofs: ; 1c021i
db -1 ; group 25 db -1 ; group 25
db 0 ; group 26 (Cherrygrove) db 0 ; group 26 (Cherrygrove)
; 1c03c ; 1c03c
Roofs: ; 1c03c
INCBIN "gfx/tilesets/roofs/0.2bpp"
INCBIN "gfx/tilesets/roofs/1.2bpp"
INCBIN "gfx/tilesets/roofs/2.2bpp"
INCBIN "gfx/tilesets/roofs/3.2bpp"
INCBIN "gfx/tilesets/roofs/4.2bpp"
; 1c30c

View File

@@ -1,28 +1,29 @@
; gray
RGB 31, 31, 31 RGB 31, 31, 31
RGB 25, 25, 25 RGB 25, 25, 25
RGB 13, 13, 13 RGB 13, 13, 13
RGB 00, 00, 00 RGB 00, 00, 00
; yellow
RGB 31, 31, 31 RGB 31, 31, 31
RGB 31, 31, 07 RGB 31, 31, 07
RGB 31, 16, 01 RGB 31, 16, 01
RGB 00, 00, 00 RGB 00, 00, 00
; red
RGB 31, 31, 31 RGB 31, 31, 31
RGB 31, 19, 24 RGB 31, 19, 24
RGB 30, 10, 06 RGB 30, 10, 06
RGB 00, 00, 00 RGB 00, 00, 00
; green
RGB 31, 31, 31 RGB 31, 31, 31
RGB 12, 25, 01 RGB 12, 25, 01
RGB 05, 14, 00 RGB 05, 14, 00
RGB 00, 00, 00 RGB 00, 00, 00
; blue
RGB 31, 31, 31 RGB 31, 31, 31
RGB 08, 12, 31 RGB 08, 12, 31
RGB 01, 04, 31 RGB 01, 04, 31
RGB 00, 00, 00 RGB 00, 00, 00
; brown
RGB 31, 31, 31 RGB 31, 31, 31
RGB 24, 18, 07 RGB 24, 18, 07
RGB 20, 15, 03 RGB 20, 15, 03

View File

@@ -0,0 +1,40 @@
BlkPacket_9a86:
db $21, $01, $03, $00, $00, $00, $13, $11, $00, $00, $00, $00, $00, $00, $00, $00
BlkPacket_9a96:
db $21, $01, $07, $05, $00, $0a, $13, $0d, $00, $00, $00, $00, $00, $00, $00, $00
BlkPacket_9aa6:
db $22, $05, $07, $0a, $00, $0c, $13, $11, $03, $05, $01, $00, $0a, $03, $03, $00
db $0a, $08, $13, $0a, $03, $0a, $00, $04, $08, $0b, $03, $0f, $0b, $00, $13, $07
BlkPacket_9ac6:
db $21, $01, $07, $05, $00, $01, $07, $07, $00, $00, $00, $00, $00, $00, $00, $00
BlkPacket_9ad6:
db $21, $01, $07, $05, $0b, $01, $13, $02, $00, $00, $00, $00, $00, $00, $00, $00
BlkPacket_9ae6:
db $21, $01, $07, $05, $01, $01, $08, $08, $00, $00, $00, $00, $00, $00, $00, $00
BlkPacket_9af6:
db $21, $01, $07, $05, $07, $05, $0d, $0b, $00, $00, $00, $00, $00, $00, $00, $00
BlkPacket_9b06:
db $22, $05, $03, $05, $00, $00, $13, $0b, $03, $0a, $00, $04, $13, $09, $02, $0f
db $00, $06, $13, $07, $03, $00, $04, $04, $0f, $09, $03, $00, $00, $0c, $13, $11
BlkPacket_9b26:
db $23, $07, $07, $10, $00, $00, $02, $0c, $02, $00, $0c, $00, $12, $01, $02, $00
db $0c, $02, $12, $03, $02, $00, $0c, $04, $12, $05, $02, $00, $0c, $06, $12, $07
db $02, $00, $0c, $08, $12, $09, $02, $00, $0c, $0a, $12, $0b, $00, $00, $00, $00
BlkPacket_9b56:
db $22, $03, $07, $20, $00, $00, $13, $04, $03, $0f, $00, $06, $13, $11, $03, $05
db $0f, $01, $12, $04, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00
BlkPacket_9b76:
db $21, $01, $07, $10, $00, $00, $13, $05, $00, $00, $00, $00, $00, $00, $00, $00
BlkPacket_9b86:
db $21, $02, $07, $0a, $00, $04, $13, $0d, $03, $05, $00, $06, $13, $0b, $00, $00

View File

@@ -0,0 +1,3 @@
; blue
RGB 30, 26, 15
RGB 04, 17, 31

9
data/palettes/hp_bar.pal Normal file
View File

@@ -0,0 +1,9 @@
; green
RGB 30, 26, 15
RGB 00, 23, 00
; yellow
RGB 30, 26, 15
RGB 31, 21, 00
; red
RGB 30, 26, 15
RGB 31, 00, 00

View File

@@ -0,0 +1,4 @@
RGB 31, 31, 31
RGB 08, 19, 28
RGB 05, 05, 16
RGB 00, 00, 00

View File

@@ -0,0 +1,61 @@
; morn
RGB 28,31,16, 21,21,21, 13,13,13, 07,07,07 ; gray
RGB 28,31,16, 31,19,24, 30,10,06, 07,07,07 ; red
RGB 22,31,10, 12,25,01, 05,14,00, 07,07,07 ; green
RGB 31,31,31, 08,12,31, 01,04,31, 07,07,07 ; water
RGB 28,31,16, 31,31,07, 31,16,01, 07,07,07 ; yellow
RGB 28,31,16, 24,18,07, 20,15,03, 07,07,07 ; brown
RGB 28,31,16, 15,31,31, 05,17,31, 07,07,07 ; roof
RGB 31,31,16, 31,31,16, 14,09,00, 00,00,00 ; text
; day
RGB 27,31,27, 21,21,21, 13,13,13, 07,07,07 ; gray
RGB 27,31,27, 31,19,24, 30,10,06, 07,07,07 ; red
RGB 22,31,10, 12,25,01, 05,14,00, 07,07,07 ; green
RGB 31,31,31, 08,12,31, 01,04,31, 07,07,07 ; water
RGB 27,31,27, 31,31,07, 31,16,01, 07,07,07 ; yellow
RGB 27,31,27, 24,18,07, 20,15,03, 07,07,07 ; brown
RGB 27,31,27, 15,31,31, 05,17,31, 07,07,07 ; roof
RGB 31,31,16, 31,31,16, 14,09,00, 00,00,00 ; text
; nite
RGB 15,14,24, 11,11,19, 07,07,12, 00,00,00 ; gray
RGB 15,14,24, 14,07,17, 13,00,08, 00,00,00 ; red
RGB 15,14,24, 08,13,19, 00,11,13, 00,00,00 ; green
RGB 15,14,24, 05,05,17, 03,03,10, 00,00,00 ; water
RGB 30,30,11, 16,14,18, 16,14,10, 00,00,00 ; yellow
RGB 15,14,24, 12,09,15, 08,04,05, 00,00,00 ; brown
RGB 15,14,24, 13,12,23, 11,09,20, 00,00,00 ; roof
RGB 31,31,16, 31,31,16, 14,09,00, 00,00,00 ; text
; dark
RGB 01,01,02, 00,00,00, 00,00,00, 00,00,00 ; gray
RGB 01,01,02, 00,00,00, 00,00,00, 00,00,00 ; red
RGB 01,01,02, 00,00,00, 00,00,00, 00,00,00 ; green
RGB 01,01,02, 00,00,00, 00,00,00, 00,00,00 ; water
RGB 30,30,11, 00,00,00, 00,00,00, 00,00,00 ; yellow
RGB 01,01,02, 00,00,00, 00,00,00, 00,00,00 ; brown
RGB 01,01,02, 00,00,00, 00,00,00, 00,00,00 ; roof
RGB 31,31,16, 31,31,16, 14,09,00, 00,00,00 ; text
; indoor
RGB 30,28,26, 19,19,19, 13,13,13, 07,07,07 ; gray
RGB 30,28,26, 31,19,24, 30,10,06, 07,07,07 ; red
RGB 18,24,09, 15,20,01, 09,13,00, 07,07,07 ; green
RGB 30,28,26, 15,16,31, 09,09,31, 07,07,07 ; water
RGB 30,28,26, 31,31,07, 31,16,01, 07,07,07 ; yellow
RGB 26,24,17, 21,17,07, 16,13,03, 07,07,07 ; brown
RGB 30,28,26, 17,19,31, 14,16,31, 07,07,07 ; roof
RGB 31,31,16, 31,31,16, 14,09,00, 00,00,00 ; text
; overworld water
; morn/day
RGB 23, 23, 31
RGB 18, 19, 31
RGB 13, 12, 31
RGB 07, 07, 07
; nite
RGB 15, 13, 27
RGB 10, 09, 20
RGB 04, 03, 18
RGB 00, 00, 00

View File

@@ -0,0 +1,113 @@
PalPacket_9b96:
db $51, $48, $00, $49, $00, $4a, $00, $4b, $00, $00, $00, $00, $00, $00, $00, $00
PalPacket_9ba6:
db $51, $2b, $00, $24, $00, $20, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00
PalPacket_9bb6:
db $51, $41, $00, $42, $00, $43, $00, $44, $00, $00, $00, $00, $00, $00, $00, $00
PalPacket_9bc6:
db $51, $4c, $00, $4c, $00, $4c, $00, $4c, $00, $00, $00, $00, $00, $00, $00, $00
PalPacket_9bd6:
db $51, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00
PalPacket_9be6:
db $51, $36, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00
PalPacket_9bf6:
db $51, $37, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00
PalPacket_9c06:
db $51, $38, $00, $39, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00
PalPacket_9c16:
db $51, $3a, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00
PalPacket_9c26:
db $51, $3b, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00
PalPacket_9c36:
db $51, $3c, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00
PalPacket_9c46:
db $51, $39, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00
PalPacket_9c56:
db $51, $2e, $00, $2f, $00, $30, $00, $31, $00, $00, $00, $00, $00, $00, $00, $00
PalPacket_9c66:
db $51, $1a, $00, $1a, $00, $1a, $00, $1a, $00, $00, $00, $00, $00, $00, $00, $00
PalPacket_9c76:
db $51, $32, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00
PalPacket_9c86:
db $51, $3c, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00
PalPacket_9c96:
db $51, $3d, $00, $3e, $00, $3f, $00, $40, $00, $00, $00, $00, $00, $00, $00, $00
PalPacket_9ca6:
db $51, $33, $00, $34, $00, $1b, $00, $1f, $00, $00, $00, $00, $00, $00, $00, $00
PalPacket_9cb6:
db $51, $1b, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00
PalPacket_9cc6:
db $51, $1c, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00
PalPacket_9cd6:
db $51, $35, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00
PalPacket_9ce6:
db $01, $ff, $7f, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00
PalPacket_9cf6:
db $09, $ff, $7f, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00
PalPacket_9d06:
db $59, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00
PalPacket_9d16:
db $89, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00
PalPacket_9d26:
db $89, $01, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00
PalPacket_9d36:
db $99, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00
PalPacket_9d46:
db $a1, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00
PalPacket_9d56:
db $b9, $01, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00
PalPacket_9d66:
db $b9, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00
PalPacket_9d76:
db $79, $5d, $08, $00, $0b, $8c, $d0, $f4, $60, $00, $00, $00, $00, $00, $00, $00
PalPacket_9d86:
db $79, $52, $08, $00, $0b, $a9, $e7, $9f, $01, $c0, $7e, $e8, $e8, $e8, $e8, $e0
PalPacket_9d96:
db $79, $47, $08, $00, $0b, $c4, $d0, $16, $a5, $cb, $c9, $05, $d0, $10, $a2, $28
PalPacket_9da6:
db $79, $3c, $08, $00, $0b, $f0, $12, $a5, $c9, $c9, $c8, $d0, $1c, $a5, $ca, $c9
PalPacket_9db6:
db $79, $31, $08, $00, $0b, $0c, $a5, $ca, $c9, $7e, $d0, $06, $a5, $cb, $c9, $7e
PalPacket_9dc6:
db $79, $26, $08, $00, $0b, $39, $cd, $48, $0c, $d0, $34, $a5, $c9, $c9, $80, $d0
PalPacket_9dd6:
db $79, $1b, $08, $00, $0b, $ea, $ea, $ea, $ea, $ea, $a9, $01, $cd, $4f, $0c, $d0
PalPacket_9de6:
db $79, $10, $08, $00, $0b, $4c, $20, $08, $ea, $ea, $ea, $ea, $ea, $60, $ea, $ea

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