diff options
Diffstat (limited to 'engine')
44 files changed, 716 insertions, 285 deletions
diff --git a/engine/anim_hp_bar.asm b/engine/anim_hp_bar.asm index c8a543ba1..21a378dee 100755 --- a/engine/anim_hp_bar.asm +++ b/engine/anim_hp_bar.asm @@ -273,9 +273,8 @@ HPBarAnim_UpdateHPRemaining: ; d784 push hl add hl, de ld a, " " -rept 2 ld [hli], a -endr + ld [hli], a ld [hld], a dec hl ld a, [Buffer3] diff --git a/engine/billspc.asm b/engine/billspc.asm index 5e9e7393b..3c8f7fc83 100755 --- a/engine/billspc.asm +++ b/engine/billspc.asm @@ -142,9 +142,8 @@ _DepositPKMN: ; e2391 (38:6391) ld e, a ld d, 0 ld hl, BillsPCDepositJumptable -rept 2 add hl, de -endr + add hl, de ld a, [hli] ld h, [hl] ld l, a @@ -411,9 +410,8 @@ BillsPC_Withdraw: ; e2675 (38:6675) ld e, a ld d, 0 ld hl, .dw -rept 2 add hl, de -endr + add hl, de ld a, [hli] ld h, [hl] ld l, a @@ -675,9 +673,8 @@ _MovePKMNWithoutMail: ; e2759 ld e, a ld d, 0 ld hl, .Jumptable2 -rept 2 add hl, de -endr + add hl, de ld a, [hli] ld h, [hl] ld l, a @@ -2010,9 +2007,8 @@ MovePKMNWitoutMail_InsertMon: ; e31e7 .moving_to_box ld hl, .Jumptable -rept 2 add hl, bc -endr + add hl, bc ld a, [hli] ld h, [hl] ld l, a @@ -2143,7 +2139,7 @@ endr ld hl, wBillsPC_ScrollPosition add [hl] ld [CurPartyMon], a - callba Function51322 + callba InsertPokemonIntoBox ret ; e3316 @@ -2172,7 +2168,7 @@ endr ld hl, wBillsPC_ScrollPosition add [hl] ld [CurPartyMon], a - callba Function5138b + callba InsertPokemonIntoParty ret ; e3357 @@ -2256,9 +2252,8 @@ BillsPC_ApplyPalettes: ; e33d0 (38:73d0) BillsPC_Jumptable: ; e33df (38:73df) ld e, a ld d, $0 -rept 2 add hl, de -endr + add hl, de ld a, [hli] ld h, [hl] ld l, a diff --git a/engine/breeding/egg.asm b/engine/breeding/egg.asm index b6f41743e..d86b1ef69 100755 --- a/engine/breeding/egg.asm +++ b/engine/breeding/egg.asm @@ -442,9 +442,8 @@ GLOBAL EggMoves ld c, a ld b, 0 ld hl, EggMovePointers -rept 2 add hl, bc -endr + add hl, bc ld a, BANK(EggMovePointers) call GetFarHalfword .loop @@ -477,9 +476,8 @@ endr ld c, a ld b, 0 ld hl, EvosAttacksPointers -rept 2 add hl, bc -endr + add hl, bc ld a, BANK(EvosAttacksPointers) call GetFarHalfword .loop3 diff --git a/engine/card_flip.asm b/engine/card_flip.asm index 2c334fc25..0479e8248 100755 --- a/engine/card_flip.asm +++ b/engine/card_flip.asm @@ -71,9 +71,8 @@ _CardFlip: ; e00ee (38:40ee) ld e, a ld d, 0 ld hl, .Jumptable -rept 2 add hl, de -endr + add hl, de ld a, [hli] ld h, [hl] ld l, a @@ -276,9 +275,8 @@ endr ld e, a ld d, 0 ld hl, wDeck -rept 2 add hl, de -endr + add hl, de ld a, [wCardFlipWhichCard] ld e, a add hl, de @@ -442,9 +440,8 @@ CardFlip_DisplayCardFaceUp: ; e03ec ld e, a ld d, 0 ld hl, .Deck -rept 2 add hl, de -endr + add hl, de ld a, [hli] ld e, a ld d, [hl] @@ -675,9 +672,8 @@ CardFlip_BlankDiscardedCardSlot: ; e0534 and a jr nz, .discarded2 hlcoord 13, 3 -rept 2 add hl, bc -endr + add hl, bc ld [hl], $36 ld bc, SCREEN_WIDTH add hl, bc @@ -686,9 +682,8 @@ endr .discarded2 hlcoord 13, 3 -rept 2 add hl, bc -endr + add hl, bc ld [hl], $36 ld bc, SCREEN_WIDTH add hl, bc @@ -703,9 +698,8 @@ endr and a jr nz, .discarded1 hlcoord 13, 4 -rept 2 add hl, bc -endr + add hl, bc ld [hl], $3b ld bc, SCREEN_WIDTH add hl, bc @@ -714,9 +708,8 @@ endr .discarded1 hlcoord 13, 4 -rept 2 add hl, bc -endr + add hl, bc ld [hl], $3d ld bc, SCREEN_WIDTH add hl, bc @@ -731,9 +724,8 @@ endr and a jr nz, .discarded4 hlcoord 13, 6 -rept 2 add hl, bc -endr + add hl, bc ld [hl], $36 ld bc, SCREEN_WIDTH add hl, bc @@ -742,9 +734,8 @@ endr .discarded4 hlcoord 13, 6 -rept 2 add hl, bc -endr + add hl, bc ld [hl], $36 ld bc, SCREEN_WIDTH add hl, bc @@ -759,9 +750,8 @@ endr and a jr nz, .discarded3 hlcoord 13, 7 -rept 2 add hl, bc -endr + add hl, bc ld [hl], $3c ld bc, SCREEN_WIDTH add hl, bc @@ -770,9 +760,8 @@ endr .discarded3 hlcoord 13, 7 -rept 2 add hl, bc -endr + add hl, bc ld [hl], $3d ld bc, SCREEN_WIDTH add hl, bc @@ -787,9 +776,8 @@ endr and a jr nz, .discarded6 hlcoord 13, 9 -rept 2 add hl, bc -endr + add hl, bc ld [hl], $36 ld bc, SCREEN_WIDTH add hl, bc @@ -798,9 +786,8 @@ endr .discarded6 hlcoord 13, 9 -rept 2 add hl, bc -endr + add hl, bc ld [hl], $36 ld bc, SCREEN_WIDTH add hl, bc @@ -815,9 +802,8 @@ endr and a jr nz, .discarded5 hlcoord 13, 10 -rept 2 add hl, bc -endr + add hl, bc ld [hl], $3c ld bc, SCREEN_WIDTH add hl, bc @@ -826,9 +812,8 @@ endr .discarded5 hlcoord 13, 10 -rept 2 add hl, bc -endr + add hl, bc ld [hl], $3d ld bc, SCREEN_WIDTH add hl, bc @@ -1296,9 +1281,8 @@ ChooseCard_HandleJoypad: ; e089c ld [hl], a cp $3 jr c, .left_to_number_gp -rept 2 dec [hl] -endr + dec [hl] jp .play_sound .left_to_number_gp @@ -1326,9 +1310,8 @@ endr ld [hl], a cp $4 ret nc -rept 2 inc [hl] -endr + inc [hl] jr .play_sound .d_up ; e090a @@ -1357,9 +1340,8 @@ endr ld [hl], a cp $3 jr c, .up_to_mon_group -rept 2 dec [hl] -endr + dec [hl] jr .play_sound .up_to_mon_group @@ -1387,9 +1369,8 @@ endr ld [hl], a cp $6 ret nc -rept 2 inc [hl] -endr + inc [hl] .play_sound ; e0959 ld de, SFX_POKEBALLS_PLACED_ON_TABLE @@ -1408,9 +1389,8 @@ CardFlip_UpdateCursorOAM: ; e0960 .skip call CollapseCursorPosition -rept 2 add hl, hl -endr + add hl, hl ld de, .OAMData add hl, de ld a, [hli] diff --git a/engine/credits.asm b/engine/credits.asm index 9074b9c65..4fd41342f 100644 --- a/engine/credits.asm +++ b/engine/credits.asm @@ -258,9 +258,8 @@ Credits_Jumptable: ; 109926 ld e, a ld d, 0 ld hl, .Jumptable -rept 2 add hl, de -endr + add hl, de ld a, [hli] ld h, [hl] ld l, a @@ -326,9 +325,8 @@ Credits_LYOverride: ; 109986 (42:5986) cp $30 jr c, Credits_LYOverride ld a, [wCreditsLYOverride] -rept 2 dec a -endr + dec a ld [wCreditsLYOverride], a ld hl, LYOverrides + $1f call .Fill @@ -398,9 +396,8 @@ ParseCredits: ; 1099aa ld e, a ld d, 0 ld hl, CreditsStrings -rept 2 add hl, de -endr + add hl, de ld a, [hli] ld d, [hl] ld e, a @@ -741,9 +738,8 @@ Credits_LoadBorderGFX: ; 109bca (42:5bca) ld [hl], a ld a, [wCreditsBorderMon] and 3 -rept 2 add a -endr + add a add e add a ld e, a diff --git a/engine/crystal_intro.asm b/engine/crystal_intro.asm index 2be7a375e..c40062c1a 100755 --- a/engine/crystal_intro.asm +++ b/engine/crystal_intro.asm @@ -13,7 +13,7 @@ Copyright_GFPresents: ; e4579 ld a, $90 ld [hWY], a call WaitBGMap - ld b, SCGB_19 + ld b, SCGB_GAMEFREAK_LOGO call GetSGBLayout call SetPalettes ld c, 10 @@ -82,13 +82,13 @@ Copyright_GFPresents: ; e4579 depixel 10, 11, 4, 0 ld a, SPRITE_ANIM_INDEX_GAMEFREAK_LOGO call _InitSpriteAnimStruct - ld hl, $7 + ld hl, SPRITEANIMSTRUCT_YOFFSET add hl, bc ld [hl], $a0 - ld hl, $c + ld hl, SPRITEANIMSTRUCT_0C add hl, bc ld [hl], $60 - ld hl, $d + ld hl, SPRITEANIMSTRUCT_0D add hl, bc ld [hl], $30 xor a @@ -101,7 +101,7 @@ Copyright_GFPresents: ; e4579 ld [hBGMapMode], a ld a, $90 ld [hWY], a - ld de, $e4e4 + lb de, %11100100, %11100100 call DmgToCgbObjPals ret ; e465e @@ -120,9 +120,8 @@ PlaceGameFreakPresents: ; e4670 ld e, a ld d, 0 ld hl, .dw -rept 2 add hl, de -endr + add hl, de ld a, [hli] ld h, [hl] ld l, a @@ -218,9 +217,8 @@ GameFreakLogoJumper: ; e46ed (39:46ed) ld e, [hl] ld d, 0 ld hl, GameFreakLogoScenes -rept 2 add hl, de -endr + add hl, de ld a, [hli] ld h, [hl] ld l, a @@ -317,9 +315,8 @@ GameFreakLogoScene4: ; e4776 (39:4776) ld e, a ld d, $0 ld hl, GameFreakLogoPalettes -rept 2 add hl, de -endr + add hl, de ld a, [rSVBK] push af ld a, $5 @@ -436,9 +433,8 @@ IntroSceneJumper: ; e490f ld e, a ld d, 0 ld hl, IntroScenes -rept 2 add hl, de -endr + add hl, de ld a, [hli] ld h, [hl] ld l, a @@ -986,9 +982,8 @@ IntroScene12: ; e4cfa (39:4cfa) ret z cp c jr z, .playsound -rept 2 inc hl -endr + inc hl jr .loop .playsound ld a, [hli] @@ -1667,9 +1662,8 @@ endr ld d, $0 ld hl, BGPals add hl, de -rept 2 inc hl -endr + inc hl ld a, [wcf65] and $3f cp $1f @@ -1698,9 +1692,8 @@ endr push hl ld hl, .BWFade -rept 2 add hl, bc -endr + add hl, bc ld a, [hli] ld d, [hl] ld e, a @@ -1712,9 +1705,8 @@ endr push hl ld hl, .BlackLBlueFade -rept 2 add hl, bc -endr + add hl, bc ld a, [hli] ld d, [hl] ld e, a @@ -1726,9 +1718,8 @@ endr push hl ld hl, .BlackBlueFade -rept 2 add hl, bc -endr + add hl, bc ld a, [hli] ld d, [hl] ld e, a @@ -2127,9 +2118,8 @@ Intro_PerspectiveScrollBG: ; e552f (39:552f) ; grass in the front ld hl, LYOverrides + $5f ld a, [hl] -rept 2 inc a -endr + inc a ld bc, $31 call ByteFill ld a, [LYOverrides + 0] diff --git a/engine/debug.asm b/engine/debug.asm index a02f536db..79d477dc1 100755 --- a/engine/debug.asm +++ b/engine/debug.asm @@ -300,9 +300,8 @@ Function81a74: ; 81a74 ld e, a ld d, 0 ld hl, Jumptable_81acf -rept 2 add hl, de -endr + add hl, de ld a, [hli] ld h, [hl] ld l, a @@ -482,9 +481,8 @@ Function81bf4: ; 81bf4 inc a ld l, a ld h, $0 -rept 2 add hl, hl -endr + add hl, hl ld de, OverworldMap add hl, de ld de, wc608 @@ -558,9 +556,8 @@ Function81c33: ; 81c33 ld a, [wc608 + 3] ld [hli], a xor a -rept 2 ld [hli], a -endr + ld [hli], a ld [hl], a ld hl, wSGBPals call Function81f0c @@ -609,9 +606,8 @@ Function81cc2: ; 81cc2 ld e, a ld d, 0 ld hl, Jumptable_81d02 -rept 2 add hl, de -endr + add hl, de ld a, [hli] ld h, [hl] ld l, a @@ -855,9 +851,8 @@ String_81e4d: db "おぼえられない@" ; cannot be taught Function81e55: ; 81e55 cp $32 jr c, .asm_81e5b -rept 2 inc a -endr + inc a .asm_81e5b add $bf @@ -938,9 +933,8 @@ Function81eca: ; 81eca inc a ld l, a ld h, $0 -rept 2 add hl, hl -endr + add hl, hl ld de, OverworldMap add hl, de ld e, l @@ -970,9 +964,8 @@ Function81ee3: ; 81ee3 inc de ld [hli], a xor a -rept 2 ld [hli], a -endr + ld [hli], a dec c jr nz, .asm_81ee3 ret @@ -1108,9 +1101,8 @@ Function81f5e: ; 81f5e ld a, b ld [hli], a ld a, [de] -rept 2 add a -endr + add a add $18 ld [hli], a xor a @@ -1356,9 +1348,8 @@ Function822f0: ; 822f0 ld e, a ld d, 0 ld hl, .dw -rept 2 add hl, de -endr + add hl, de ld a, [hli] ld h, [hl] ld l, a @@ -1400,9 +1391,8 @@ Function82309: ; 82309 ld e, a ld d, $0 ld hl, wc608 -rept 2 add hl, de -endr + add hl, de ld e, l ld d, h call Function81ea5 @@ -1500,9 +1490,8 @@ Function82391: ; 82391 ld c, a ld b, $0 ld hl, wc608 -rept 2 add hl, bc -endr + add hl, bc ld a, e ld [hli], a ld [hl], d diff --git a/engine/delete_save_change_clock.asm b/engine/delete_save_change_clock.asm new file mode 100755 index 000000000..b92698b49 --- /dev/null +++ b/engine/delete_save_change_clock.asm @@ -0,0 +1,298 @@ +_ResetClock: ; 4d3b1 + callba BlankScreen + ld b, SCGB_08 + call GetSGBLayout + call LoadStandardFont + call LoadFontsExtra + ld de, MUSIC_MAIN_MENU + call PlayMusic + ld hl, .text_askreset + call PrintText + ld hl, .NoYes_MenuDataHeader + call CopyMenuDataHeader + call VerticalMenu + ret c + ld a, [wMenuCursorY] + cp $1 + ret z + call ClockResetPassword + jr c, .wrongpassword + ld a, BANK(sRTCStatusFlags) + call GetSRAMBank + ld a, $80 + ld [sRTCStatusFlags], a + call CloseSRAM + ld hl, .text_okay + call PrintText + ret + +.wrongpassword + ld hl, .text_wrong + call PrintText + ret + +.text_okay ; 0x4d3fe + ; Password OK. Select CONTINUE & reset settings. + text_jump UnknownText_0x1c55db + db "@" + +.text_wrong ; 0x4d403 + ; Wrong password! + text_jump UnknownText_0x1c560b + db "@" + +.text_askreset ; 0x4d408 + ; Reset the clock? + text_jump UnknownText_0x1c561c + db "@" + +.NoYes_MenuDataHeader: ; 0x4d40d + db $00 ; flags + db 07, 14 ; start coords + db 11, 19 ; end coords + dw .NoYes_MenuData2 + db 1 ; default option + +.NoYes_MenuData2: ; 0x4d415 + db $c0 ; flags + db 2 ; items + db "NO@" + db "YES@" + +ClockResetPassword: ; 4d41e + call .CalculatePassword + push de + ld hl, StringBuffer2 + ld bc, 5 + xor a + call ByteFill + ld a, $4 + ld [StringBuffer2 + 5], a + ld hl, .pleaseenterpasswordtext + call PrintText +.loop + call .updateIDdisplay +.loop2 + call JoyTextDelay + ld a, [hJoyLast] + ld b, a + and A_BUTTON + jr nz, .confirm + ld a, b + and D_PAD + jr z, .loop2 + call .dpadinput + ld c, 3 + call DelayFrames + jr .loop + +.confirm + call .ConvertDecIDToBytes + pop de + ld a, e + cp l + jr nz, .nope + ld a, d + cp h + jr nz, .nope + and a + ret + +.nope + scf + ret + +.pleaseenterpasswordtext ; 0x4d463 + ; Please enter the password. + text_jump UnknownText_0x1c562e + db "@" + +.updateIDdisplay ; 4d468 + hlcoord 14, 15 + ld de, StringBuffer2 + ld c, 5 +.loop3 + ld a, [de] + add "0" + ld [hli], a + inc de + dec c + jr nz, .loop3 + hlcoord 14, 16 + ld bc, 5 + ld a, " " + call ByteFill + hlcoord 14, 16 + ld a, [StringBuffer2 + 5] + ld e, a + ld d, $0 + add hl, de + ld [hl], $61 + ret + +.dpadinput ; 4d490 + ld a, b + and D_LEFT + jr nz, .left + ld a, b + and D_RIGHT + jr nz, .right + ld a, b + and D_UP + jr nz, .up + ld a, b + and D_DOWN + jr nz, .down + ret + +.left + ld a, [StringBuffer2 + 5] + and a + ret z + dec a + ld [StringBuffer2 + 5], a + ret + +.right + ld a, [StringBuffer2 + 5] + cp $4 + ret z + inc a + ld [StringBuffer2 + 5], a + ret + +.up + call .getcurrentdigit + ld a, [hl] + cp 9 + jr z, .wraparound_up + inc a + ld [hl], a + ret + +.wraparound_up + ld [hl], $0 + ret + +.down + call .getcurrentdigit + ld a, [hl] + and a + jr z, .wraparound_down + dec a + ld [hl], a + ret + +.wraparound_down + ld [hl], 9 + ret + +.getcurrentdigit ; 4d4d5 + ld a, [StringBuffer2 + 5] + ld e, a + ld d, $0 + ld hl, StringBuffer2 + add hl, de + ret + +.ConvertDecIDToBytes: ; 4d4e0 + ld hl, 0 + ld de, StringBuffer2 + 4 + ld bc, 1 + call .ConvertToBytes + ld bc, 10 + call .ConvertToBytes + ld bc, 100 + call .ConvertToBytes + ld bc, 1000 + call .ConvertToBytes + ld bc, 10000 +.ConvertToBytes: ; 4d501 + ld a, [de] + dec de + push hl + ld hl, 0 + call AddNTimes + ld c, l + ld b, h + pop hl + add hl, bc + ret + +.CalculatePassword: ; 4d50f + ld a, BANK(sPlayerData) + call GetSRAMBank + ld de, 0 + ld hl, sPlayerData + (PlayerID - wPlayerData) + ld c, $2 + call .ComponentFromNumber + ld hl, sPlayerData + (PlayerName - wPlayerData) + ld c, $5 ; PLAYER_NAME_LENGTH_J + call .ComponentFromString + ld hl, sPlayerData + (Money - wPlayerData) + ld c, $3 + call .ComponentFromNumber + call CloseSRAM + ret + +.ComponentFromNumber: ; 4d533 + ld a, [hli] + add e + ld e, a + ld a, $0 + adc d + ld d, a + dec c + jr nz, .ComponentFromNumber + ret + +.ComponentFromString: ; 4d53e + ld a, [hli] + cp "@" + ret z + add e + ld e, a + ld a, $0 + adc d + ld d, a + dec c + jr nz, .ComponentFromString + ret + +_DeleteSaveData: ; 4d54c + callba BlankScreen + ld b, SCGB_08 + call GetSGBLayout + call LoadStandardFont + call LoadFontsExtra + ld de, MUSIC_MAIN_MENU + call PlayMusic + ld hl, .Text_ClearAllSaveData + call PrintText + ld hl, .NoYesMenuDataHeader + call CopyMenuDataHeader + call VerticalMenu + ret c + ld a, [wMenuCursorY] + cp $1 + ret z + callba EmptyAllSRAMBanks + ret + +.Text_ClearAllSaveData: ; 0x4d580 + ; Clear all save data? + text_jump UnknownText_0x1c564a + db "@" + +.NoYesMenuDataHeader: ; 0x4d585 + db $00 ; flags + db 07, 14 ; start coords + db 11, 19 ; end coords + dw .MenuData2 + db 1 ; default option + +.MenuData2: ; 0x4d58d + db $c0 ; flags + db 2 ; items + db "NO@" + db "YES@" diff --git a/engine/events_3.asm b/engine/events_3.asm index b1c142a27..7c737d1fb 100755 --- a/engine/events_3.asm +++ b/engine/events_3.asm @@ -184,12 +184,10 @@ PlaceMapNameCenterAlign: ; b80e1 (2e:40e1) InitMapSignAttrMap: ; b8115 ld de, AttrMap - TileMap add hl, de -rept 2 inc b -endr -rept 2 + inc b + inc c inc c -endr ld a, $87 .loop push bc @@ -261,15 +259,13 @@ PlaceMapNameFrame: ; b812f jr .enterloop .continueloop -rept 2 ld [hli], a -endr + ld [hli], a .enterloop inc a -rept 2 ld [hli], a -endr + ld [hli], a dec a dec c jr nz, .continueloop @@ -522,9 +518,8 @@ GetTreeMons: ; b82d2 ld e, a ld d, 0 ld hl, TreeMons -rept 2 add hl, de -endr + add hl, de ld a, [hli] ld h, [hl] diff --git a/engine/evolution_animation.asm b/engine/evolution_animation.asm index dc0ddd8f6..42df7eea4 100755 --- a/engine/evolution_animation.asm +++ b/engine/evolution_animation.asm @@ -187,9 +187,8 @@ EvolutionAnimation: ; 4e5e1 call .Flash pop bc inc b -rept 2 dec c -endr + dec c jr nz, .loop and a ret @@ -344,9 +343,8 @@ endr ld a, [hVBlankCounter] and %1110 srl a -rept 2 inc a -endr + inc a and $7 ld b, a ld hl, Sprites + 3 ; attributes diff --git a/engine/evolve.asm b/engine/evolve.asm index db7d7e946..9a70290f2 100755 --- a/engine/evolve.asm +++ b/engine/evolve.asm @@ -46,9 +46,8 @@ EvolveAfterBattle_MasterLoop ld b, 0 ld c, a ld hl, EvosAttacksPointers -rept 2 add hl, bc -endr + add hl, bc ld a, [hli] ld h, [hl] ld l, a @@ -437,9 +436,8 @@ LearnLevelMoves: ; 42487 ld b, 0 ld c, a ld hl, EvosAttacksPointers -rept 2 add hl, bc -endr + add hl, bc ld a, [hli] ld h, [hl] ld l, a @@ -638,9 +636,8 @@ GetPreEvolution: ; 42581 .loop ; For each Pokemon... ld hl, EvosAttacksPointers ld b, 0 -rept 2 add hl, bc -endr + add hl, bc ld a, [hli] ld h, [hl] ld l, a diff --git a/engine/fish.asm b/engine/fish.asm index 6aeec10a6..e21bab03d 100644 --- a/engine/fish.asm +++ b/engine/fish.asm @@ -38,9 +38,8 @@ endr inc hl ld e, b ld d, 0 -rept 2 add hl, de -endr + add hl, de ld a, [hli] ld h, [hl] ld l, a @@ -84,9 +83,8 @@ endr and 3 cp NITE jr c, .time_species -rept 2 inc hl -endr + inc hl .time_species ld d, [hl] diff --git a/engine/healmachineanim.asm b/engine/healmachineanim.asm index 01ed6d652..2b8f3b868 100755 --- a/engine/healmachineanim.asm +++ b/engine/healmachineanim.asm @@ -25,9 +25,8 @@ HealMachineAnim: ; 12324 ld e, a ld d, 0 ld hl, .Pointers -rept 2 add hl, de -endr + add hl, de ld a, [hli] ld h, [hl] ld l, a diff --git a/engine/landmarks.asm b/engine/landmarks.asm index 8fb7035f2..a0b4336aa 100644 --- a/engine/landmarks.asm +++ b/engine/landmarks.asm @@ -3,9 +3,8 @@ GetLandmarkCoords: ; 0x1ca896 push hl ld l, e ld h, 0 -rept 2 add hl, hl -endr + add hl, hl ld de, Landmarks add hl, de ld a, [hli] @@ -24,9 +23,8 @@ GetLandmarkName:: ; 0x1ca8a5 ld l, e ld h, 0 -rept 2 add hl, hl -endr + add hl, hl ld de, Landmarks + 2 add hl, de ld a, [hli] diff --git a/engine/link.asm b/engine/link.asm index 14c9c2f4d..788ee22a2 100755 --- a/engine/link.asm +++ b/engine/link.asm @@ -1094,14 +1094,12 @@ Function2868a: ; 2868a ld a, $46 ld [hli], a xor a -rept 2 ld [hli], a -endr + ld [hli], a ld [hl], a pop hl -rept 2 inc de -endr + inc de ret ; 28771 diff --git a/engine/mart.asm b/engine/mart.asm index f756d3bc2..dfe7d89cd 100755 --- a/engine/mart.asm +++ b/engine/mart.asm @@ -145,9 +145,8 @@ GetMart: ; 15b31 .IsAMart: ld hl, Marts -rept 2 add hl, de -endr + add hl, de ld e, [hl] inc hl ld d, [hl] @@ -393,9 +392,8 @@ LoadBuyMenuText: ; 15c7d pop af ld e, a ld d, 0 -rept 2 add hl, de -endr + add hl, de ld a, [hli] ld h, [hl] ld l, a @@ -405,9 +403,8 @@ endr MartAskPurchaseQuantity: ; 15c91 call GetMartDialogGroup ; gets a pointer from GetMartDialogGroup.MartTextFunctionPointers -rept 2 inc hl -endr + inc hl ld a, [hl] and a jp z, StandardMartAskPurchaseQuantity diff --git a/engine/move_mon.asm b/engine/move_mon.asm index 310eab8c2..100cb3f0e 100755 --- a/engine/move_mon.asm +++ b/engine/move_mon.asm @@ -654,7 +654,7 @@ SentGetPkmnIntoFromBox: ; db3f ld a, [sBoxCount] dec a ld b, a - call Functiondcb6 + call RestorePPofDepositedPokemon .CloseSRAM_And_ClearCarryFlag: call CloseSRAM and a @@ -667,7 +667,7 @@ CloseSRAM_And_SetCarryFlag: ; dcb1 ret ; dcb6 -Functiondcb6: ; dcb6 +RestorePPofDepositedPokemon: ; dcb6 ld a, b ld hl, sBoxMons ld bc, BOXMON_STRUCT_LENGTH @@ -696,10 +696,10 @@ Functiondcb6: ; dcb6 ld a, [MonType] push af ld b, 0 -.asm_dcec +.loop ld a, [hli] and a - jr z, .asm_dd18 + jr z, .done ld [TempMonMoves], a ld a, BOXMON ld [MonType], a @@ -722,9 +722,9 @@ Functiondcb6: ; dcb6 inc b ld a, b cp NUM_MOVES - jr c, .asm_dcec + jr c, .loop -.asm_dd18 +.done pop af ld [MonType], a pop af @@ -1025,7 +1025,7 @@ SentPkmnIntoBox: ; de6e call CopyBytes ld b, 0 - call Functiondcb6 + call RestorePPofDepositedPokemon call CloseSRAM scf diff --git a/engine/move_mon_wo_mail.asm b/engine/move_mon_wo_mail.asm new file mode 100755 index 000000000..d3b4e78a5 --- /dev/null +++ b/engine/move_mon_wo_mail.asm @@ -0,0 +1,133 @@ +InsertPokemonIntoBox: ; 51322 + ld a, BANK(sBoxCount) + call GetSRAMBank + ld hl, sBoxCount + call InsertSpeciesIntoBoxOrParty + ld a, [sBoxCount] + dec a + ld [wd265], a + ld hl, sBoxMonNicknames + ld bc, PKMN_NAME_LENGTH + ld de, wBufferMonNick + call InsertDataIntoBoxOrParty + ld a, [sBoxCount] + dec a + ld [wd265], a + ld hl, sBoxMonOT + ld bc, NAME_LENGTH + ld de, wBufferMonOT + call InsertDataIntoBoxOrParty + ld a, [sBoxCount] + dec a + ld [wd265], a + ld hl, sBoxMons + ld bc, BOXMON_STRUCT_LENGTH + ld de, wBufferMon + call InsertDataIntoBoxOrParty + ld hl, wBufferMonMoves + ld de, TempMonMoves + ld bc, NUM_MOVES + call CopyBytes + ld hl, wBufferMonPP + ld de, TempMonPP + ld bc, NUM_MOVES + call CopyBytes + ld a, [CurPartyMon] + ld b, a + callba RestorePPofDepositedPokemon + jp CloseSRAM + +InsertPokemonIntoParty: ; 5138b + ld hl, PartyCount + call InsertSpeciesIntoBoxOrParty + ld a, [PartyCount] + dec a + ld [wd265], a + ld hl, PartyMonNicknames + ld bc, PKMN_NAME_LENGTH + ld de, wBufferMonNick + call InsertDataIntoBoxOrParty + ld a, [PartyCount] + dec a + ld [wd265], a + ld hl, PartyMonOT + ld bc, NAME_LENGTH + ld de, wBufferMonOT + call InsertDataIntoBoxOrParty + ld a, [PartyCount] + dec a + ld [wd265], a + ld hl, PartyMons + ld bc, PARTYMON_STRUCT_LENGTH + ld de, wBufferMon + call InsertDataIntoBoxOrParty + ret + +InsertSpeciesIntoBoxOrParty: ; 513cb + inc [hl] + inc hl + ld a, [CurPartyMon] + ld c, a + ld b, 0 + add hl, bc + ld a, [CurPartySpecies] + ld c, a +.loop + ld a, [hl] + ld [hl], c + inc hl + inc c + ld c, a + jr nz, .loop + ret + +InsertDataIntoBoxOrParty: ; 513e0 + push de + push hl + push bc + ld a, [wd265] + dec a + call AddNTimes + push hl + add hl, bc + ld d, h + ld e, l + pop hl +.loop + push bc + ld a, [wd265] + ld b, a + ld a, [CurPartyMon] + cp b + pop bc + jr z, .insert + push hl + push de + push bc + call CopyBytes + pop bc + pop de + pop hl + push hl + ld a, l + sub c + ld l, a + ld a, h + sbc b + ld h, a + pop de + ld a, [wd265] + dec a + ld [wd265], a + jr .loop + +.insert + pop bc + pop hl + ld a, [CurPartyMon] + call AddNTimes + ld d, h + ld e, l + pop hl + call CopyBytes + ret diff --git a/engine/namingscreen.asm b/engine/namingscreen.asm index d9fe253fb..16a87b0c8 100755 --- a/engine/namingscreen.asm +++ b/engine/namingscreen.asm @@ -65,9 +65,8 @@ NamingScreen: ; 116c1 ld e, a ld d, 0 ld hl, .Jumptable -rept 2 add hl, de -endr + add hl, de ld a, [hli] ld h, [hl] ld l, a @@ -401,9 +400,8 @@ NamingScreenJoypadLoop: ; 11915 ld e, a ld d, $0 ld hl, .Jumptable -rept 2 add hl, de -endr + add hl, de ld a, [hli] ld h, [hl] ld l, a @@ -662,9 +660,8 @@ NamingScreen_AnimateCursor: ; 11a3b (4:5a3b) jr nz, .asm_11ade ld a, $4 .asm_11ade -rept 2 dec a -endr + dec a ld e, a add a add e @@ -1164,9 +1161,8 @@ INCBIN "gfx/icon/mail2.2bpp" ld e, a ld d, 0 ld hl, .Jumptable -rept 2 add hl, de -endr + add hl, de ld a, [hli] ld h, [hl] ld l, a @@ -1391,9 +1387,8 @@ ComposeMail_AnimateCursor: ; 120c1 (4:60c1) jr nz, .wrap_around_command_left ld a, $4 .wrap_around_command_left -rept 2 dec a -endr + dec a ld e, a add a add e @@ -1476,9 +1471,8 @@ MailComposition_TryAddLastCharacter: ; 121ac (4:61ac) jr nz, .asm_121c3 push hl ld hl, wNamingScreenCurrNameLength -rept 2 dec [hl] -endr + dec [hl] jr .asm_121c8 .asm_121c3 diff --git a/engine/npctrade.asm b/engine/npctrade.asm index a8d3b71aa..f28734ea9 100755 --- a/engine/npctrade.asm +++ b/engine/npctrade.asm @@ -311,9 +311,8 @@ GetTradeAttribute: ; 0xfcdc2 ld e, a ld d, 0 ld hl, NPCTrades -rept 2 add hl, de -endr + add hl, de pop de add hl, de ret @@ -458,9 +457,8 @@ PrintTradeText: ; fcf38 call AddNTimes ld a, [wcf64] ld c, a -rept 2 add hl, bc -endr + add hl, bc ld a, [hli] ld h, [hl] ld l, a diff --git a/engine/options_menu.asm b/engine/options_menu.asm index 00799395a..2986cc75b 100755 --- a/engine/options_menu.asm +++ b/engine/options_menu.asm @@ -85,9 +85,8 @@ GetOptionPointer: ; e42d6 ld e, a ; copy it to de ld d, 0 ld hl, .Pointers -rept 2 add hl, de -endr + add hl, de ld a, [hli] ld h, [hl] ld l, a @@ -143,9 +142,8 @@ Options_TextSpeed: ; e42f5 .NonePressed: ld b, 0 ld hl, .Strings -rept 2 add hl, bc -endr + add hl, bc ld e, [hl] inc hl ld d, [hl] @@ -363,9 +361,8 @@ Options_Print: ; e4424 .NonePressed: ld b, $0 ld hl, .Strings -rept 2 add hl, bc -endr + add hl, bc ld e, [hl] inc hl ld d, [hl] diff --git a/engine/overworld.asm b/engine/overworld.asm index 12c7f56c6..4d22e55b6 100755 --- a/engine/overworld.asm +++ b/engine/overworld.asm @@ -147,9 +147,8 @@ AddOutdoorSprites: ; 141ee ld c, a ld b, 0 ld hl, OutdoorSprites -rept 2 add hl, bc -endr + add hl, bc ld a, [hli] ld h, [hl] ld l, a @@ -364,9 +363,8 @@ AddSpriteGFX: ; 142e5 jr z, .exists and a jr z, .new -rept 2 inc hl -endr + inc hl dec c jr nz, .loop @@ -428,9 +426,8 @@ SortUsedSprites: ; 1431e ld a, [de] and a jr nz, .FoundLastSprite -rept 2 dec de -endr + dec de dec c jr nz, .FindLastSprite .FoundLastSprite: @@ -472,16 +469,14 @@ endr ; Keep doing this until everything's in order. .loop -rept 2 dec de -endr + dec de dec c jr nz, .CheckFollowing pop hl -rept 2 inc hl -endr + inc hl pop de pop bc dec c diff --git a/engine/pack.asm b/engine/pack.asm index ff80dce23..19b7fccbf 100644 --- a/engine/pack.asm +++ b/engine/pack.asm @@ -1252,9 +1252,8 @@ Pack_JumptableNext: ; 10866 (4:4866) Pack_GetJumptablePointer: ; 1086b ld e, a ld d, 0 -rept 2 add hl, de -endr + add hl, de ld a, [hli] ld h, [hl] ld l, a @@ -1300,9 +1299,8 @@ DrawPackGFX: ; 1089d jr nz, .female .male_dude ld hl, PackGFXPointers -rept 2 add hl, de -endr + add hl, de ld a, [hli] ld e, a ld d, [hl] diff --git a/engine/party_menu.asm b/engine/party_menu.asm index 934e1458a..985645a8c 100644 --- a/engine/party_menu.asm +++ b/engine/party_menu.asm @@ -110,9 +110,8 @@ PlacePartyNicknames: ; 5009b jr nz, .loop .end -rept 2 dec hl -endr + dec hl ld de, .CANCEL call PlaceString ret @@ -219,9 +218,8 @@ PlacePartyMenuHPDigits: ; 50138 pop de ld a, "/" ld [hli], a -rept 2 inc de -endr + inc de lb bc, 2, 3 call PrintNum @@ -390,9 +388,8 @@ PlacePartyMonEvoStoneCompatibility: ; 5022f ld e, a ld d, 0 ld hl, EvosAttacksPointers -rept 2 add hl, de -endr + add hl, de call .DetermineCompatibility pop hl call PlaceString @@ -426,19 +423,16 @@ endr ld a, [hli] and a jr z, .nope -rept 2 inc hl -endr + inc hl cp EVOLVE_ITEM jr nz, .loop2 -rept 2 dec hl -endr + dec hl ld a, [CurItem] cp [hl] -rept 2 inc hl -endr + inc hl jr nz, .loop2 ld de, .string_able ret @@ -613,9 +607,8 @@ GetPartyMenuTilemapPointers: ; 50396 ld e, a ld d, 0 ld hl, .Pointers -rept 2 add hl, de -endr + add hl, de ld a, [hli] ld h, [hl] ld l, a @@ -794,9 +787,8 @@ PrintPartyMenuText: ; 5049a ld hl, PartyMenuStrings ld e, a ld d, $0 -rept 2 add hl, de -endr + add hl, de ld a, [hli] ld d, [hl] ld e, a @@ -932,9 +924,8 @@ PrintPartyMenuActionText: ; 50566 .PrintText: ; 505c1 ld e, a ld d, 0 -rept 2 add hl, de -endr + add hl, de ld a, [hli] ld h, [hl] ld l, a diff --git a/engine/phone.asm b/engine/phone.asm index 7f96dd2c3..9d1376a62 100644 --- a/engine/phone.asm +++ b/engine/phone.asm @@ -266,9 +266,8 @@ CheckSpecialPhoneCall:: ; 90136 (24:4136) jr nc, .NoPhoneCall call .DoSpecialPhoneCall -rept 2 inc hl -endr + inc hl ld a, [hli] ld e, a push hl @@ -520,9 +519,8 @@ Phone_CallerTextboxWithName2: ; 902c9 call Phone_CallerTextbox hlcoord 1, 2 ld [hl], $62 -rept 2 inc hl -endr + inc hl ld a, [PhoneScriptBank] ld b, a ld a, [PhoneCallerLo] @@ -621,9 +619,8 @@ Function90363: ; 90363 (24:4363) call Phone_CallerTextbox hlcoord 1, 1 ld [hl], $62 -rept 2 inc hl -endr + inc hl ld d, h ld e, l pop bc @@ -699,9 +696,8 @@ GetCallerName: ; 903a9 (24:43a9) ld c, b ld b, 0 ld hl, NonTrainerCallerNames -rept 2 add hl, bc -endr + add hl, bc ld a, [hli] ld e, a ld d, [hl] diff --git a/engine/pokedex.asm b/engine/pokedex.asm index 761b38874..95536a970 100644 --- a/engine/pokedex.asm +++ b/engine/pokedex.asm @@ -2385,9 +2385,8 @@ Pokedex_ApplyUsualPals: ; 41427 Pokedex_LoadPointer: ; 41432 ld e, a ld d, 0 -rept 2 add hl, de -endr + add hl, de ld a, [hli] ld h, [hl] ld l, a diff --git a/engine/printer.asm b/engine/printer.asm index 876e59efc..409c8a461 100755 --- a/engine/printer.asm +++ b/engine/printer.asm @@ -21,9 +21,8 @@ Function84022: ; 84022 ld e, a ld d, 0 ld hl, .Jumptable -rept 2 add hl, de -endr + add hl, de ld a, [hli] ld h, [hl] ld l, a @@ -1133,9 +1132,8 @@ Function84785: ; 84785 ld e, a ld d, 0 ld hl, PrinterStatusStringPointers -rept 2 add hl, de -endr + add hl, de ld e, [hl] inc hl ld d, [hl] @@ -1166,9 +1164,8 @@ Function847bd: ; 847bd ld e, a ld d, 0 ld hl, PrinterStatusStringPointers -rept 2 add hl, de -endr + add hl, de ld e, [hl] inc hl ld d, [hl] diff --git a/engine/rtc.asm b/engine/rtc.asm index 1f5e1e27c..3018b5301 100755 --- a/engine/rtc.asm +++ b/engine/rtc.asm @@ -35,9 +35,8 @@ GetTimeOfDay:: ; 14032 cp [hl] jr c, .match ; else, get the next entry -rept 2 inc hl -endr + inc hl ; try again jr .check diff --git a/engine/search2.asm b/engine/search2.asm new file mode 100755 index 000000000..9ef5491f0 --- /dev/null +++ b/engine/search2.asm @@ -0,0 +1,134 @@ +_FindGreaterThanThatLevel: ; 4dbd2 + ld hl, PartyMon1Level + call FindGreaterThanThatLevel + ret + +_FindAtLeastThatHappy: ; 4dbd9 + ld hl, PartyMon1Happiness + call FindAtLeastThatHappy + ret + +_FindThatSpecies: ; 4dbe0 + ld hl, PartyMon1Species + jp FindThatSpecies + +_FindThatSpeciesYourTrainerID: ; 4dbe6 + ld hl, PartyMon1Species + call FindThatSpecies + ret z + ld a, c + ld hl, PartyMon1ID + ld bc, PARTYMON_STRUCT_LENGTH + call AddNTimes + ld a, [PlayerID] + cp [hl] + jr nz, .nope + inc hl + ld a, [PlayerID + 1] + cp [hl] + jr nz, .nope + ld a, $1 + and a + ret + +.nope + xor a + ret + +FindAtLeastThatHappy: ; 4dc0a +; Sets the bits for the Pokemon that have a happiness greater than or equal to b. +; The lowest bits are used. Sets z if no Pokemon in your party is at least that happy. + ld c, $0 + ld a, [PartyCount] + ld d, a +.loop + ld a, d + dec a + push hl + push bc + ld bc, PARTYMON_STRUCT_LENGTH + call AddNTimes + pop bc + ld a, b + cp [hl] + pop hl + jr z, .greater_equal + jr nc, .lower + +.greater_equal + ld a, c + or $1 + ld c, a + +.lower + sla c + dec d + jr nz, .loop + call RetroactivelyIgnoreEggs + ld a, c + and a + ret + +FindGreaterThanThatLevel: ; 4dc31 + ld c, $0 + ld a, [PartyCount] + ld d, a +.loop + ld a, d + dec a + push hl + push bc + ld bc, PARTYMON_STRUCT_LENGTH + call AddNTimes + pop bc + ld a, b + cp [hl] + pop hl + jr c, .greater + ld a, c + or $1 + ld c, a + +.greater + sla c + dec d + jr nz, .loop + call RetroactivelyIgnoreEggs + ld a, c + and a + ret + +FindThatSpecies: ; 4dc56 +; Find species b in your party. +; If you have no Pokemon, returns c = -1 and z. +; If that species is in your party, returns its location in c, and nz. +; Otherwise, returns z. + ld c, -1 + ld hl, PartySpecies +.loop + ld a, [hli] + cp -1 + ret z + inc c + cp b + jr nz, .loop + ld a, $1 + and a + ret + +RetroactivelyIgnoreEggs: ; 4dc67 + ld e, -2 + ld hl, PartySpecies +.loop + ld a, [hli] + cp -1 + ret z + cp EGG + jr nz, .skip_notegg + ld a, c + and e + ld c, a + +.skip_notegg + rlc e + jr .loop diff --git a/engine/selectmenu.asm b/engine/selectmenu.asm index 4e461a68e..838438a4c 100755 --- a/engine/selectmenu.asm +++ b/engine/selectmenu.asm @@ -45,9 +45,8 @@ CheckRegisteredItem: ; 13345 inc hl ld e, a ld d, 0 -rept 2 add hl, de -endr + add hl, de call .IsSameItem jr c, .NoRegisteredItem and a @@ -71,9 +70,8 @@ endr inc hl ld e, a ld d, 0 -rept 2 add hl, de -endr + add hl, de call .IsSameItem jr c, .NoRegisteredItem ret diff --git a/engine/sprites.asm b/engine/sprites.asm index 4335d45c5..b88c2a8ed 100755 --- a/engine/sprites.asm +++ b/engine/sprites.asm @@ -556,8 +556,8 @@ SpriteAnimSeqData: ; 8d1c4 db SPRITE_ANIM_FRAMESET_07, SPRITE_ANIM_SEQ_04, $00 ; 01 db SPRITE_ANIM_FRAMESET_08, SPRITE_ANIM_SEQ_05, $05 ; 02 db SPRITE_ANIM_FRAMESET_GAMEFREAK_LOGO, SPRITE_ANIM_SEQ_GAMEFREAK_LOGO, $00 ; 03 - db SPRITE_ANIM_FRAMESET_0B, SPRITE_ANIM_SEQ_07, $06 ; 04 - db SPRITE_ANIM_FRAMESET_0C, SPRITE_ANIM_SEQ_08, $06 ; 05 + db SPRITE_ANIM_FRAMESET_0B, SPRITE_ANIM_SEQ_07, $06 ; 04 gs intro star + db SPRITE_ANIM_FRAMESET_0C, SPRITE_ANIM_SEQ_08, $06 ; 05 gs intro sparkle db SPRITE_ANIM_FRAMESET_SLOT_GOLEM, SPRITE_ANIM_SEQ_SLOT_GOLEM, $07 ; 06 slots golem db SPRITE_ANIM_FRAMESET_SLOTS_CHANSEY, SPRITE_ANIM_SEQ_SLOTS_CHANSEY, $07 ; 07 slots chansey db SPRITE_ANIM_FRAMESET_SLOTS_EGG, SPRITE_ANIM_SEQ_SLOTS_EGG, $07 ; 08 slots egg diff --git a/engine/stats_screen.asm b/engine/stats_screen.asm index e3bc6069c..dd9dd9a50 100755 --- a/engine/stats_screen.asm +++ b/engine/stats_screen.asm @@ -641,9 +641,8 @@ StatsScreen_LoadGFX: ; 4dfb6 (13:5fb6) inc a ld d, a callba CalcExpAtLevel -rept 2 ld hl, TempMonExp + 2 -endr + ld hl, TempMonExp + 2 ld a, [hQuotient + 2] sub [hl] dec hl @@ -660,9 +659,8 @@ endr .AlreadyAtMaxLevel: ld hl, Buffer1 ; wd1ea (aliases: MagikarpLength) xor a -rept 2 ld [hli], a -endr + ld [hli], a ld [hl], a ret ; 4e119 (13:6119) diff --git a/engine/switch_items.asm b/engine/switch_items.asm index 0d4512876..b699d4719 100755 --- a/engine/switch_items.asm +++ b/engine/switch_items.asm @@ -231,9 +231,8 @@ ItemSwitch_ConvertSpacingToDW: ; 24a80 (9:4a80) ld c, a ld b, 0 ld hl, .spacing_dws -rept 2 add hl, bc -endr + add hl, bc ld c, [hl] inc hl ld b, [hl] diff --git a/engine/time.asm b/engine/time.asm index 255346c0a..8ea807972 100755 --- a/engine/time.asm +++ b/engine/time.asm @@ -374,9 +374,8 @@ CalcHoursDaysSince: ; 115d2 ; 115d6 CalcMinsHoursDaysSince: ; 115d6 -rept 2 inc hl -endr + inc hl xor a jr _CalcMinsHoursDaysSince ; 115db diff --git a/engine/time_capsule/conversion.asm b/engine/time_capsule/conversion.asm index 5d093d515..a6c507dae 100755 --- a/engine/time_capsule/conversion.asm +++ b/engine/time_capsule/conversion.asm @@ -46,9 +46,8 @@ ValidateOTTrademon: ; fb57e ld [CurSpecies], a call GetBaseData ld hl, wLinkOTPartyMonTypes -rept 2 add hl, bc -endr + add hl, bc ld a, [BaseType1] cp [hl] jr nz, .abnormal diff --git a/engine/timeofdaypals.asm b/engine/timeofdaypals.asm index 1bfc2457b..3bba41f53 100644 --- a/engine/timeofdaypals.asm +++ b/engine/timeofdaypals.asm @@ -245,9 +245,8 @@ GetTimePalette: ; 8c117 ld e, a ld d, 0 ld hl, .TimePalettes -rept 2 add hl, de -endr + add hl, de ld a, [hli] ld h, [hl] ld l, a @@ -346,9 +345,8 @@ GetTimePalFade: ; 8c17c ld c, a ld b, $0 ld hl, .dmgfades -rept 2 add hl, bc -endr + add hl, bc ld a, [hli] ld h, [hl] ld l, a diff --git a/engine/timeset.asm b/engine/timeset.asm index fd6b2de94..65bd6aac9 100755 --- a/engine/timeset.asm +++ b/engine/timeset.asm @@ -200,9 +200,8 @@ UnreferencedFunction907f1: ; 907f1 push hl call DisplayHourOClock pop de -rept 2 inc de -endr + inc de ld a, ":" ld [de], a inc de @@ -521,9 +520,8 @@ Special_SetDayOfWeek: ; 90913 ld e, a ld d, 0 ld hl, .WeekdayStrings -rept 2 add hl, de -endr + add hl, de ld a, [hli] ld d, [hl] ld e, a diff --git a/engine/title.asm b/engine/title.asm index 30804fbe8..31fbe091e 100644 --- a/engine/title.asm +++ b/engine/title.asm @@ -351,9 +351,8 @@ InitializeBackground: ; 10ef06 ld b, a ld a, e ld [hli], a -rept 2 inc e -endr + inc e ld a, $80 ld [hli], a dec c diff --git a/engine/tmhm2.asm b/engine/tmhm2.asm index 289857623..7062149f8 100755 --- a/engine/tmhm2.asm +++ b/engine/tmhm2.asm @@ -581,9 +581,8 @@ PrintMoveDesc: ; 2cb3e dec a ld c, a ld b, 0 -rept 2 add hl, bc -endr + add hl, bc ld a, [hli] ld e, a ld d, [hl] diff --git a/engine/trade/animation.asm b/engine/trade/animation.asm index 91e190075..228bb667c 100755 --- a/engine/trade/animation.asm +++ b/engine/trade/animation.asm @@ -224,9 +224,8 @@ DoTradeAnimation: ; 29082 ld e, a ld d, 0 ld hl, .JumpTable -rept 2 add hl, de -endr + add hl, de ld a, [hli] ld h, [hl] ld l, a @@ -519,9 +518,8 @@ Function29281: ; 29281 ld e, a ld d, 0 ld hl, Jumptable_2928f -rept 2 add hl, de -endr + add hl, de ld a, [hli] ld h, [hl] ld l, a @@ -1105,9 +1103,8 @@ Function29676: ; 29676 (a:5676) ld e, [hl] ld d, 0 ld hl, Jumptable_29686 -rept 2 add hl, de -endr + add hl, de ld a, [hli] ld h, [hl] ld l, a diff --git a/engine/unown_puzzle.asm b/engine/unown_puzzle.asm index ada5244a7..5e9ec66c0 100755 --- a/engine/unown_puzzle.asm +++ b/engine/unown_puzzle.asm @@ -178,9 +178,8 @@ UnownPuzzleJumptable: ; e12ca ld e, a ld d, 0 ld hl, .Jumptable -rept 2 add hl, de -endr + add hl, de ld a, [hli] ld h, [hl] ld l, a @@ -840,9 +839,8 @@ LoadUnownPuzzlePiecesGFX: ; e17a3 ld e, a ld d, 0 ld hl, .LZPointers -rept 2 add hl, de -endr + add hl, de ld a, [hli] ld h, [hl] ld l, a diff --git a/engine/unowndex.asm b/engine/unowndex.asm index 0b251da0b..d7fe63dc3 100755 --- a/engine/unowndex.asm +++ b/engine/unowndex.asm @@ -34,9 +34,8 @@ PrintUnownWord: ; fba2e (3e:7a2e) ld e, a ld d, 0 ld hl, UnownWords -rept 2 add hl, de -endr + add hl, de ld a, [hli] ld e, a ld d, [hl] diff --git a/engine/warp_connection.asm b/engine/warp_connection.asm index 9d1f35479..f0d5b5eab 100755 --- a/engine/warp_connection.asm +++ b/engine/warp_connection.asm @@ -369,7 +369,7 @@ CheckMovingOffEdgeOfMap:: ; 104820 (41:4820) .left ld a, [PlayerStandingMapX] - sub $4 + sub 4 cp -1 jr z, .ok and a diff --git a/engine/wildmons.asm b/engine/wildmons.asm index 140de9205..557630686 100755 --- a/engine/wildmons.asm +++ b/engine/wildmons.asm @@ -108,9 +108,8 @@ endr ld a, [wNamedObjectIndexBuffer] cp [hl] jr z, .found -rept 2 inc hl -endr + inc hl pop af dec a jr nz, .ScanMapLoop @@ -274,9 +273,8 @@ endr call CheckOnWater ld de, .WaterMonTable jr z, .watermon -rept 2 inc hl -endr + inc hl ld a, [TimeOfDay] ld bc, $e call AddNTimes @@ -702,9 +700,8 @@ UpdateRoamMons: ; 2a30d inc hl ld c, a ld b, $0 -rept 2 add hl, bc -endr + add hl, bc ld a, [wRoamMons_LastMapGroup] cp [hl] jr nz, .done @@ -866,9 +863,8 @@ RandomPhoneRareWildMon: ; 2a4ab dec a ld c, a ld b, $0 -rept 2 add hl, bc -endr + add hl, bc ; We now have the pointer to one of the last (rarest) three wild Pokemon found in that area. inc hl ld c, [hl] ; Contains the species index of this rare Pokemon @@ -942,9 +938,8 @@ RandomPhoneWildMon: ; 2a51f and $3 ld c, a ld b, $0 -rept 2 add hl, bc -endr + add hl, bc inc hl ld a, [hl] ld [wNamedObjectIndexBuffer], a @@ -963,9 +958,8 @@ RandomPhoneMon: ; 2a567 dec a ld c, a ld b, 0 -rept 2 add hl, bc -endr + add hl, bc ld a, BANK(TrainerGroups) call GetFarHalfword |