diff --git a/audio/engine.asm b/audio/engine.asm index 2842288b2..7a907bccc 100644 --- a/audio/engine.asm +++ b/audio/engine.asm @@ -413,10 +413,9 @@ UpdateChannels: ; e8125 ; hl << 4 ; each wavepattern is $0f bytes long ; so seeking is done in $10s +rept 4 add hl, hl - add hl, hl - add hl, hl - add hl, hl +endr ld de, WaveSamples add hl, de ; load wavepattern into $ff30-$ff3f @@ -1292,8 +1291,9 @@ GetNoiseSample: ; e86c5 ld d, $00 ; load ptr to noise sample set in hl ld hl, Drumkits +rept 2 add hl, de - add hl, de +endr ld a, [hli] ld h, [hl] ld l, a @@ -1306,8 +1306,9 @@ GetNoiseSample: ; e86c5 ; use 'pitch' to seek noise sample set ld e, a ld d, $00 +rept 2 add hl, de - add hl, de +endr ; load sample pointer into NoiseSampleAddress ld a, [hli] ld [NoiseSampleAddressLo], a @@ -1328,8 +1329,9 @@ ParseMusicCommand: ; e870f ld d, $00 ; seek command pointer ld hl, MusicCommands +rept 2 add hl, de - add hl, de +endr ; jump to the new pointer ld a, [hli] ld h, [hl] @@ -1572,8 +1574,9 @@ MusicFB: ; e8817 inc hl ld d, [hl] ; skip pointer +rept 2 inc de - inc de +endr ; update address ld [hl], d dec hl @@ -1623,8 +1626,9 @@ MusicEE; e883e inc hl ld d, [hl] ; skip pointer +rept 2 inc de - inc de +endr ; update address ld [hl], d dec hl @@ -2378,9 +2382,9 @@ _PlayCryHeader:: ; e8b79 ; 3-byte pointers (bank, address) ld hl, Cries +rept 3 add hl, de - add hl, de - add hl, de +endr ld a, [hli] ld [MusicBank], a @@ -2595,9 +2599,9 @@ PlayStereoSFX:: ; e8ca6 ; get sfx ptr ld hl, SFX +rept 3 add hl, de - add hl, de - add hl, de +endr ; bank ld a, [hli] @@ -2692,8 +2696,9 @@ LoadChannel: ; e8d1b ld c, a ld b, $00 ld hl, ChannelPointers +rept 2 add hl, bc - add hl, bc +endr ld c, [hl] inc hl ld b, [hl] ; bc = channel pointer @@ -3157,8 +3162,9 @@ ClearChannels:: ; e8fe9 ; doesn't seem to be used, but functionally identical to SoundRestart ld hl, rNR50 xor a +rept 2 ld [hli], a - ld [hli], a +endr ld a, $80 ld [hli], a ld hl, rNR10 diff --git a/audio/music/goldenrodcity.asm b/audio/music/goldenrodcity.asm index e0e919d5c..cf92246b6 100644 --- a/audio/music/goldenrodcity.asm +++ b/audio/music/goldenrodcity.asm @@ -275,8 +275,9 @@ Music_GoldenrodCity_Ch3: ; eb584 vibrato $8, $23 notetype $c, $25 Music_GoldenrodCity_branch_eb58c: ; eb58c +rept 2 callchannel Music_GoldenrodCity_branch_eb5aa - callchannel Music_GoldenrodCity_branch_eb5aa +endr callchannel Music_GoldenrodCity_branch_eb5d2 note __, 3 octave 3 diff --git a/audio/music/johtowildbattle.asm b/audio/music/johtowildbattle.asm index 505687382..ac53dac2a 100644 --- a/audio/music/johtowildbattle.asm +++ b/audio/music/johtowildbattle.asm @@ -492,8 +492,9 @@ Music_JohtoWildBattle_branch_f5fdb: ; f5fdb note G_, 2 loopchannel 7, Music_JohtoWildBattle_branch_f5fdb note F#, 4 +rept 2 callchannel Music_JohtoWildBattle_branch_f6055 - callchannel Music_JohtoWildBattle_branch_f6055 +endr Music_JohtoWildBattle_branch_f5fe8: ; f5fe8 note D_, 2 note G_, 2 diff --git a/audio/music/kantowildbattle.asm b/audio/music/kantowildbattle.asm index c23a867e3..8eccf2e6b 100644 --- a/audio/music/kantowildbattle.asm +++ b/audio/music/kantowildbattle.asm @@ -325,22 +325,25 @@ Music_KantoWildBattle_branch_ed1c8: ; ed1c8 note F_, 1 note F#, 1 notetype $6, $b7 +rept 2 callchannel Music_KantoWildBattle_branch_ed307 - callchannel Music_KantoWildBattle_branch_ed307 +endr forceoctave $1 +rept 2 callchannel Music_KantoWildBattle_branch_ed307 - callchannel Music_KantoWildBattle_branch_ed307 +endr forceoctave $0 +rept 4 callchannel Music_KantoWildBattle_branch_ed307 - callchannel Music_KantoWildBattle_branch_ed307 - callchannel Music_KantoWildBattle_branch_ed307 - callchannel Music_KantoWildBattle_branch_ed307 +endr forceoctave $1 +rept 2 callchannel Music_KantoWildBattle_branch_ed307 - callchannel Music_KantoWildBattle_branch_ed307 +endr forceoctave $0 +rept 2 callchannel Music_KantoWildBattle_branch_ed307 - callchannel Music_KantoWildBattle_branch_ed307 +endr note __, 16 octave 3 note A#, 16 diff --git a/battle/ai/items.asm b/battle/ai/items.asm index 3a880a00c..5cd3fd7fc 100644 --- a/battle/ai/items.asm +++ b/battle/ai/items.asm @@ -193,9 +193,9 @@ AI_TryItem: ; 38105 jr z, .has_item dec de +rept 3 inc hl - inc hl - inc hl +endr jr .loop .has_item @@ -213,8 +213,9 @@ AI_TryItem: ; 38105 pop de pop hl +rept 2 inc hl - inc hl +endr jr c, .loop .used_item diff --git a/battle/ai/scoring.asm b/battle/ai/scoring.asm index 425d6911b..101d4e188 100644 --- a/battle/ai/scoring.asm +++ b/battle/ai/scoring.asm @@ -133,16 +133,18 @@ AI_Setup: ; 385e0 call AI_50_50 jr c, .checkmove +rept 2 dec [hl] - dec [hl] +endr jr .checkmove .discourage call Random cp 30 jr c, .checkmove +rept 2 inc [hl] - inc [hl] +endr jr .checkmove ; 38635 @@ -151,7 +153,7 @@ AI_Setup: ; 385e0 AI_Types: ; 38635 ; Dismiss any move that the player is immune to. ; Encourage super-effective moves. -; Discourage not very effective moves unless +; Discourage not very effective moves unless ; all damaging moves are of the same type. ld hl, Buffer1 - 1 @@ -262,8 +264,9 @@ AI_Offensive: ; 386a2 and a jr nz, .checkmove +rept 2 inc [hl] - inc [hl] +endr jr .checkmove ; 386be @@ -417,8 +420,9 @@ AI_Smart_Sleep: ; 387e3 .asm_387f0 call AI_50_50 ret c +rept 2 dec [hl] - dec [hl] +endr ret ; 387f7 @@ -529,8 +533,9 @@ AI_Smart_LockOn: ; 3881d call AI_50_50 ret c +rept 2 dec [hl] - dec [hl] +endr ret .asm_38882 @@ -555,8 +560,9 @@ AI_Smart_LockOn: ; 3881d cp 180 jr nc, .asm_3888b +rept 2 dec [hl] - dec [hl] +endr jr .asm_3888b .asm_388a2 @@ -596,9 +602,9 @@ AI_Smart_Explosion: ; 388a6 ret c .asm_388c6 +rept 3 inc [hl] - inc [hl] - inc [hl] +endr ret ; 388ca @@ -610,9 +616,9 @@ AI_Smart_DreamEater: ; 388ca call Random cp 25 ret c +rept 3 dec [hl] - dec [hl] - dec [hl] +endr ret ; 388d4 @@ -639,8 +645,9 @@ AI_Smart_EvasionUp: ; 388d4 jr nc, .asm_38911 .asm_388ef +rept 2 dec [hl] - dec [hl] +endr ret .asm_388f2 @@ -669,8 +676,9 @@ AI_Smart_EvasionUp: ; 388d4 jr c, .asm_38911 .asm_3890f +rept 2 inc [hl] - inc [hl] +endr ; 30% chance to end up here if enemy's HP is full and player is not badly poisoned. ; 77% chance to end up here if enemy's HP is above 50% but not full. @@ -714,8 +722,9 @@ AI_Smart_EvasionUp: ; 388d4 call Random cp $50 ret c +rept 2 dec [hl] - dec [hl] +endr ret ; Player is seeded. @@ -747,8 +756,9 @@ AI_Smart_AlwaysHit: ; 38947 call AI_80_20 ret c +rept 2 dec [hl] - dec [hl] +endr ret ; 3895b @@ -818,8 +828,9 @@ AI_Smart_AccuracyDown: ; 38985 jr nc, .asm_389bf .asm_3899d +rept 2 dec [hl] - dec [hl] +endr ret .asm_389a0 @@ -848,8 +859,9 @@ AI_Smart_AccuracyDown: ; 38985 jr c, .asm_389bf .asm_389bd +rept 2 inc [hl] - inc [hl] +endr ; We only end up here if the move has not been already encouraged. .asm_389bf @@ -888,8 +900,9 @@ AI_Smart_AccuracyDown: ; 38985 call Random cp $50 ret c +rept 2 dec [hl] - dec [hl] +endr ret ; Player is seeded. @@ -963,9 +976,9 @@ AI_Smart_Bide: ; 38a1e AI_Smart_Whirlwind: ; 38a2a ; Whirlwind, Roar. -; Discourage this move if the player has not shown +; Discourage this move if the player has not shown ; a super-effective move against the enemy. -; Consider player's type(s) if its moves are unknown. +; Consider player's type(s) if its moves are unknown. push hl callab Function3484e @@ -997,8 +1010,9 @@ AI_Smart_Moonlight: ; 38a3a call Random cp $19 ret c +rept 2 dec [hl] - dec [hl] +endr ret ; 38a4e @@ -1079,8 +1093,9 @@ AI_Smart_Bind: ; 38a71 ret nc call AI_50_50 ret c +rept 2 dec [hl] - dec [hl] +endr ret ; 38a9c @@ -1185,8 +1200,9 @@ AI_Smart_SpDefenseUp2: ; 38aed .asm_38b09 call AI_80_20 ret c +rept 2 dec [hl] - dec [hl] +endr ret .asm_38b10 @@ -1208,9 +1224,9 @@ AI_Smart_Fly: ; 38b12 call AICompareSpeed ret nc +rept 3 dec [hl] - dec [hl] - dec [hl] +endr ret ; 38b20 @@ -1231,7 +1247,7 @@ AI_Smart_Paralyze: ; 38b26 call AICheckPlayerQuarterHP jr nc, .asm_38b3a -; 80% chance to greatly encourage this move +; 80% chance to greatly encourage this move ; if enemy is slower than player and its HP is above 25%. call AICompareSpeed ret c @@ -1239,8 +1255,9 @@ AI_Smart_Paralyze: ; 38b26 ret nc call AI_80_20 ret c +rept 2 dec [hl] - dec [hl] +endr ret .asm_38b3a @@ -1272,8 +1289,9 @@ AI_Smart_SpeedDownHit: ; 38b40 call Random cp 30 ret c +rept 2 dec [hl] - dec [hl] +endr ret ; 38b5c @@ -1510,14 +1528,15 @@ AI_Smart_Encore: ; 38c3b call Random cp $46 ret c +rept 2 dec [hl] - dec [hl] +endr ret .asm_38c81 +rept 3 inc [hl] - inc [hl] - inc [hl] +endr ret .EncoreMoves: @@ -1587,15 +1606,15 @@ AI_Smart_SleepTalk: ; 38cba cp $1 jr z, .asm_38cc7 +rept 3 dec [hl] - dec [hl] - dec [hl] +endr ret .asm_38cc7 +rept 3 inc [hl] - inc [hl] - inc [hl] +endr ret ; 38ccb @@ -1607,9 +1626,9 @@ AI_Smart_DefrostOpponent: ; 38ccb ld a, [EnemyMonStatus] and $20 ret z +rept 3 dec [hl] - dec [hl] - dec [hl] +endr ret ; 38cd5 @@ -1666,8 +1685,9 @@ AI_Smart_Spite: ; 38cd5 call Random cp $64 ret c +rept 2 dec [hl] - dec [hl] +endr ret ; 38d16 @@ -1708,9 +1728,9 @@ AI_Smart_HealBell: ; 38d1f jr z, .next ; status +rept 3 dec hl - dec hl - dec hl +endr ld a, [hl] or c ld c, a @@ -1735,8 +1755,9 @@ AI_Smart_HealBell: ; 38d1f ret z call AI_50_50 ret c +rept 2 dec [hl] - dec [hl] +endr ret .no_status @@ -1774,9 +1795,9 @@ AI_Smart_PriorityHit: ; 38d5a ld a, [BattleMonHP] sbc b ret nc +rept 3 dec [hl] - dec [hl] - dec [hl] +endr ret ; 38d93 @@ -1879,7 +1900,7 @@ AI_Smart_MeanLook: ; 38dfb bit SUBSTATUS_TOXIC, a jr nz, .asm_38e26 -; 80% chance to greatly encourage this move if the player is either +; 80% chance to greatly encourage this move if the player is either ; in love, identified, stuck in Rollout, or has a Nightmare. ld a, [PlayerSubStatus1] and 1<