From c169073eed4f0362ef42170098a141a2fcbd71d0 Mon Sep 17 00:00:00 2001 From: YamaArashi Date: Sat, 18 Jul 2015 20:49:52 -0700 Subject: misc --- engine/evos_moves.asm | 68 ++++++++++++++++++++++++++++++--------------------- 1 file changed, 40 insertions(+), 28 deletions(-) (limited to 'engine/evos_moves.asm') diff --git a/engine/evos_moves.asm b/engine/evos_moves.asm index 4a253c68..9a0f2d84 100755 --- a/engine/evos_moves.asm +++ b/engine/evos_moves.asm @@ -1,6 +1,6 @@ ; try to evolve the mon in [wWhichPokemon] TryEvolvingMon: ; 3ad0e (e:6d0e) - ld hl, wccd3 + ld hl, wCanEvolveFlags xor a ld [hl], a ld a, [wWhichPokemon] @@ -31,17 +31,17 @@ Evolution_PartyMonLoop: ; loop over party mons ld a, [hl] cp $ff ; have we reached the end of the party? jp z, .done - ld [wHPBarMaxHP], a + ld [wEvoOldSpecies], a push hl ld a, [wWhichPokemon] ld c, a - ld hl, wccd3 + ld hl, wCanEvolveFlags ld b, $2 call Evolution_FlagAction ld a, c and a ; is the mon's bit set? jp z, Evolution_PartyMonLoop ; if not, go to the next mon - ld a, [wHPBarMaxHP] + ld a, [wEvoOldSpecies] dec a ld b, 0 ld hl, EvosMovesPointerTable @@ -110,7 +110,7 @@ Evolution_PartyMonLoop: ; loop over party mons ld [wd121], a push hl ld a, [hl] - ld [wHPBarMaxHP + 1], a + ld [wEvoNewSpecies], a ld a, [wWhichPokemon] ld hl, wPartyMonNicks call GetPartyMonName @@ -122,7 +122,7 @@ Evolution_PartyMonLoop: ; loop over party mons xor a ld [H_AUTOBGTRANSFERENABLED], a coord hl, 0, 0 - ld bc, $c14 + lb bc, 12, 20 call ClearScreenArea ld a, $1 ld [H_AUTOBGTRANSFERENABLED], a @@ -137,7 +137,7 @@ Evolution_PartyMonLoop: ; loop over party mons ld a, [hl] ld [wd0b5], a ld [wLoadedMonSpecies], a - ld [wHPBarMaxHP + 1], a + ld [wEvoNewSpecies], a ld a, MONSTER_NAME ld [wNameListType], a ld a, BANK(TrainerNames) ; bank is not used for monster names @@ -357,7 +357,7 @@ LearnMoveFromLevelUp: ; 3af5b (e:6f5b) ld bc, wPartyMon2 - wPartyMon1 call AddNTimes .next - ld b, $4 + ld b, NUM_MOVES .checkCurrentMovesLoop ; check if the move to learn is already known ld a, [hli] cp d @@ -377,14 +377,13 @@ LearnMoveFromLevelUp: ; 3af5b (e:6f5b) ; writes the moves a mon has at level [W_CURENEMYLVL] to [de] ; move slots are being filled up sequentially and shifted if all slots are full -; [wHPBarMaxHP]: (?) WriteMonMoves: ; 3afb8 (e:6fb8) call GetPredefRegisters push hl push de push bc ld hl, EvosMovesPointerTable - ld b, $0 + ld b, 0 ld a, [wcf91] ; cur mon ID dec a add a @@ -411,25 +410,30 @@ WriteMonMoves: ; 3afb8 (e:6fb8) ld a, [W_CURENEMYLVL] cp b jp c, .done ; mon level < move level (assumption: learnset is sorted by level) - ld a, [wHPBarMaxHP] + ld a, [wLearningMovesFromDayCare] and a jr z, .skipMinLevelCheck - ld a, [wWhichTrade] ; min move level) + ld a, [wDayCareStartLevel] cp b jr nc, .nextMove2 ; min level >= move level + .skipMinLevelCheck + +; check if the move is already known push de - ld c, $4 -.moveAlreadyLearnedCheckLoop + ld c, NUM_MOVES +.alreadyKnowsCheckLoop ld a, [de] inc de cp [hl] jr z, .nextMove dec c - jr nz, .moveAlreadyLearnedCheckLoop + jr nz, .alreadyKnowsCheckLoop + +; try to find an empty move slot pop de push de - ld c, $4 + ld c, NUM_MOVES .findEmptySlotLoop ld a, [de] and a @@ -437,47 +441,55 @@ WriteMonMoves: ; 3afb8 (e:6fb8) inc de dec c jr nz, .findEmptySlotLoop - pop de ; no empty move slots found + +; no empty move slots found + pop de push de push hl ld h, d ld l, e call WriteMonMoves_ShiftMoveData ; shift all moves one up (deleting move 1) - ld a, [wHPBarMaxHP] + ld a, [wLearningMovesFromDayCare] and a jr z, .writeMoveToSlot + +; shift PP as well if learning moves from day care push de - ld bc, $12 + ld bc, wPartyMon1PP - (wPartyMon1Moves + 3) add hl, bc ld d, h ld e, l call WriteMonMoves_ShiftMoveData ; shift all move PP data one up pop de + .writeMoveToSlot pop hl .writeMoveToSlot2 ld a, [hl] ld [de], a - ld a, [wHPBarMaxHP] + ld a, [wLearningMovesFromDayCare] and a jr z, .nextMove - push hl ; write move PP value + +; write move PP value if learning moves from day care + push hl ld a, [hl] - ld hl, $15 + ld hl, wPartyMon1PP - wPartyMon1Moves add hl, de push hl dec a ld hl, Moves - ld bc, $6 + ld bc, 6 call AddNTimes - ld de, wHPBarMaxHP + ld de, wBuffer ld a, BANK(Moves) call FarCopyData - ld a, [wHPBarNewHP + 1] + ld a, [wBuffer + 5] pop hl ld [hl], a pop hl jr .nextMove + .done pop bc pop de @@ -486,13 +498,13 @@ WriteMonMoves: ; 3afb8 (e:6fb8) ; shifts all move data one up (freeing 4th move slot) WriteMonMoves_ShiftMoveData: ; 3b04e (e:704e) - ld c, $3 -.asm_3b050 + ld c, NUM_MOVES - 1 +.loop inc de ld a, [de] ld [hli], a dec c - jr nz, .asm_3b050 + jr nz, .loop ret Evolution_FlagAction: ; 3b057 (e:7057) -- cgit v1.3.1-sl0p From d0526c036210d2ee186a2a45feac91747ef6fb85 Mon Sep 17 00:00:00 2001 From: YamaArashi Date: Sat, 18 Jul 2015 22:34:11 -0700 Subject: small changes --- engine/evos_moves.asm | 2 +- engine/overworld/elevator.asm | 22 ++++++++++++---------- engine/overworld/healing_machine.asm | 7 ++++--- home.asm | 4 ++-- home/overworld.asm | 2 +- home/vcopy.asm | 2 +- scripts/safarizoneentrance-yellow.asm | 4 ++-- 7 files changed, 23 insertions(+), 20 deletions(-) (limited to 'engine/evos_moves.asm') diff --git a/engine/evos_moves.asm b/engine/evos_moves.asm index 9a0f2d84..f8a4c234 100755 --- a/engine/evos_moves.asm +++ b/engine/evos_moves.asm @@ -145,7 +145,7 @@ Evolution_PartyMonLoop: ; loop over party mons call GetName push hl ld hl, IntoText - call Func_3c59 + call PrintText_NoCreatingTextBox ld a, (SFX_02_3b - SFX_Headers_02) / 3 call PlaySoundWaitForCurrent call WaitForSoundToFinish diff --git a/engine/overworld/elevator.asm b/engine/overworld/elevator.asm index f5b1d14c..63e9d710 100755 --- a/engine/overworld/elevator.asm +++ b/engine/overworld/elevator.asm @@ -1,17 +1,16 @@ ShakeElevator: ; 7bf15 (1e:7f15) - ld de, $ffe0 - call Func_7bf64 - ld de, $240 - call Func_7bf64 + ld de, -$20 + call ShakeElevatorRedrawRow + ld de, SCREEN_HEIGHT * $20 + call ShakeElevatorRedrawRow call Delay3 ld a, $ff call PlaySound ld a, [hSCY] ld d, a ld e, $1 - ; number of times to play collision sfx ld b, 100 -.asm_7bf30 +.shakeLoop ; scroll the BG up and down and play a sound effect ld a, e xor $fe ld e, a @@ -25,7 +24,7 @@ ShakeElevator: ; 7bf15 (1e:7f15) ld c, 2 call DelayFrames dec b - jr nz, .asm_7bf30 + jr nz, .shakeLoop ld a, d ld [hSCY], a ld a, $ff @@ -33,14 +32,17 @@ ShakeElevator: ; 7bf15 (1e:7f15) ld c, BANK(SFX_02_5f) ld a, (SFX_02_5f - SFX_Headers_02) / 3 call PlayMusic -.asm_7bf57 +.musicLoop ld a, [wc02a] cp $b9 - jr z, .asm_7bf57 + jr z, .musicLoop call UpdateSprites jp PlayDefaultMusic -Func_7bf64: ; 7bf64 (1e:7f64) +ShakeElevatorRedrawRow: ; 7bf64 (1e:7f64) +; This function is used to redraw certain portions of the screen, but it does +; not appear to ever result in any visible effect, so this function seems to +; be pointless. ld hl, wMapViewVRAMPointer + 1 ld a, [hld] push af diff --git a/engine/overworld/healing_machine.asm b/engine/overworld/healing_machine.asm index d00bbc05..303449a1 100755 --- a/engine/overworld/healing_machine.asm +++ b/engine/overworld/healing_machine.asm @@ -14,7 +14,7 @@ AnimateHealingMachine: ; 70433 (1c:4433) ld [rOBP1], a ld hl, wOAMBuffer + $84 ld de, PokeCenterOAMData - call Func_70503 + call CopyHealingMachineOAM ld a, $4 ld [wMusicHeaderPointer], a ld a, $ff @@ -27,7 +27,7 @@ AnimateHealingMachine: ; 70433 (1c:4433) ld a, [wPartyCount] ld b, a .asm_7046e - call Func_70503 + call CopyHealingMachineOAM ld a, (SFX_02_4a - SFX_Headers_02) / 3 call PlaySound ld c, 30 @@ -87,7 +87,8 @@ FlashSprite8Times: ; 704f3 (1c:44f3) jr nz, .loop ret -Func_70503: ; 70503 (1c:4503) +CopyHealingMachineOAM: ; 70503 (1c:4503) +; copy one OAM entry and advance the pointers ld a, [de] inc de ld [hli], a diff --git a/home.asm b/home.asm index 1b910054..11db47dd 100644 --- a/home.asm +++ b/home.asm @@ -1140,7 +1140,7 @@ DisplayTextID:: ; 2920 (0:2920) callab CableClubNPC jr AfterDisplayingTextID .notSpecialCase - call Func_3c59 ; display the text + call PrintText_NoCreatingTextBox ; display the text ld a,[wDoNotWaitForButtonPressAfterDisplayingText] and a jr nz,HoldTextDisplayOpen @@ -4206,7 +4206,7 @@ PrintText:: ; 3c49 (0:3c49) call UpdateSprites call Delay3 pop hl -Func_3c59:: ; 3c59 (0:3c59) +PrintText_NoCreatingTextBox:: ; 3c59 (0:3c59) coord bc, 1, 14 jp TextCommandProcessor diff --git a/home/overworld.asm b/home/overworld.asm index 0485335a..97c46b0f 100644 --- a/home/overworld.asm +++ b/home/overworld.asm @@ -1705,7 +1705,7 @@ ScheduleNorthRowRedraw:: ; 0e91 (0:0e91) CopyToScreenEdgeTiles:: ; 0ea6 (0:0ea6) ld de,wScreenEdgeTiles - ld c,2 * 20 + ld c,2 * SCREEN_WIDTH .loop ld a,[hli] ld [de],a diff --git a/home/vcopy.asm b/home/vcopy.asm index e90accb5..8de00e38 100644 --- a/home/vcopy.asm +++ b/home/vcopy.asm @@ -51,7 +51,7 @@ RedrawExposedScreenEdge:: ; 1d01 (0:1d01) ld e,a ld a,[H_SCREENEDGEREDRAWADDR + 1] ld d,a - ld c,18 ; screen height + ld c,SCREEN_HEIGHT .loop1 ld a,[hli] ld [de],a diff --git a/scripts/safarizoneentrance-yellow.asm b/scripts/safarizoneentrance-yellow.asm index 294c5993..74ecaa54 100644 --- a/scripts/safarizoneentrance-yellow.asm +++ b/scripts/safarizoneentrance-yellow.asm @@ -155,8 +155,8 @@ SafariZoneEntranceAutoWalk: ld bc,3 call FillMemory ld hl,.OhAllRightText - call Func_3c59 - ld a,$13 + call PrintText_NoCreatingTextBox + ld a,MONEY_BOX ld a,[$d124] call DisplayTextBoxID ld hl,.CantGive30BallsText -- cgit v1.3.1-sl0p