diff options
Diffstat (limited to 'engine')
-rwxr-xr-x | engine/battle/core.asm | 44 | ||||
-rw-r--r-- | engine/battle/effects.asm | 15 | ||||
-rwxr-xr-x | engine/gfx/mon_icons.asm | 2 | ||||
-rw-r--r-- | engine/gfx/oam_dma.asm | 4 | ||||
-rw-r--r-- | engine/gfx/sprite_oam.asm | 8 | ||||
-rw-r--r-- | engine/items/inventory.asm | 4 | ||||
-rwxr-xr-x | engine/link/cable_club.asm | 4 | ||||
-rw-r--r-- | engine/movie/oak_speech/init_player_data.asm | 4 | ||||
-rwxr-xr-x | engine/movie/title.asm | 12 | ||||
-rwxr-xr-x | engine/movie/trade.asm | 4 | ||||
-rwxr-xr-x | engine/overworld/elevator.asm | 2 | ||||
-rw-r--r-- | engine/overworld/movement.asm | 22 | ||||
-rw-r--r-- | engine/overworld/sprite_collisions.asm | 4 | ||||
-rwxr-xr-x | engine/slots/slot_machine.asm | 10 |
14 files changed, 70 insertions, 69 deletions
diff --git a/engine/battle/core.asm b/engine/battle/core.asm index 4d999d2a..9a66265c 100755 --- a/engine/battle/core.asm +++ b/engine/battle/core.asm @@ -4182,8 +4182,8 @@ GetDamageVarsForPlayerAttack: ; if the enemy has used Light Screen, double the enemy's special sla c rl b -; reflect and light screen boosts do not cap the stat at 999, so weird things will happen during stats scaling if -; a Pokemon with 512 or more Defense has used Reflect, or if a Pokemon with 512 or more Special has used Light Screen +; reflect and light screen boosts do not cap the stat at MAX_STAT_VALUE, so weird things will happen during stats scaling +; if a Pokemon with 512 or more Defense has used Reflect, or if a Pokemon with 512 or more Special has used Light Screen .specialAttackCritCheck ld hl, wBattleMonSpecial ld a, [wCriticalHitOrOHKO] @@ -4295,8 +4295,8 @@ GetDamageVarsForEnemyAttack: ; if the player has used Light Screen, double the player's special sla c rl b -; reflect and light screen boosts do not cap the stat at 999, so weird things will happen during stats scaling if -; a Pokemon with 512 or more Defense has used Reflect, or if a Pokemon with 512 or more Special has used Light Screen +; reflect and light screen boosts do not cap the stat at MAX_STAT_VALUE, so weird things will happen during stats scaling +; if a Pokemon with 512 or more Defense has used Reflect, or if a Pokemon with 512 or more Special has used Light Screen .specialAttackCritCheck ld hl, wEnemyMonSpecial ld a, [wCriticalHitOrOHKO] @@ -4508,14 +4508,14 @@ CalculateDamage: jr nz, .cap ldh a, [hQuotient + 2] - cp (MAX_NEUTRAL_DAMAGE - MIN_NEUTRAL_DAMAGE + 1) / $100 + cp HIGH(MAX_NEUTRAL_DAMAGE - MIN_NEUTRAL_DAMAGE + 1) jr c, .dont_cap_2 - cp (MAX_NEUTRAL_DAMAGE - MIN_NEUTRAL_DAMAGE + 1) / $100 + 1 + cp HIGH(MAX_NEUTRAL_DAMAGE - MIN_NEUTRAL_DAMAGE + 1) + 1 jr nc, .cap ldh a, [hQuotient + 3] - cp (MAX_NEUTRAL_DAMAGE - MIN_NEUTRAL_DAMAGE + 1) % $100 + cp LOW(MAX_NEUTRAL_DAMAGE - MIN_NEUTRAL_DAMAGE + 1) jr nc, .cap .dont_cap_2 @@ -4533,21 +4533,21 @@ CalculateDamage: jr c, .cap ld a, [hl] - cp (MAX_NEUTRAL_DAMAGE - MIN_NEUTRAL_DAMAGE + 1) / $100 + cp HIGH(MAX_NEUTRAL_DAMAGE - MIN_NEUTRAL_DAMAGE + 1) jr c, .dont_cap_3 - cp (MAX_NEUTRAL_DAMAGE - MIN_NEUTRAL_DAMAGE + 1) / $100 + 1 + cp HIGH(MAX_NEUTRAL_DAMAGE - MIN_NEUTRAL_DAMAGE + 1) + 1 jr nc, .cap inc hl ld a, [hld] - cp (MAX_NEUTRAL_DAMAGE - MIN_NEUTRAL_DAMAGE + 1) % $100 + cp LOW(MAX_NEUTRAL_DAMAGE - MIN_NEUTRAL_DAMAGE + 1) jr c, .dont_cap_3 .cap - ld a, (MAX_NEUTRAL_DAMAGE - MIN_NEUTRAL_DAMAGE) / $100 + ld a, HIGH(MAX_NEUTRAL_DAMAGE - MIN_NEUTRAL_DAMAGE) ld [hli], a - ld a, (MAX_NEUTRAL_DAMAGE - MIN_NEUTRAL_DAMAGE) % $100 + ld a, LOW(MAX_NEUTRAL_DAMAGE - MIN_NEUTRAL_DAMAGE) ld [hld], a .dont_cap_3 @@ -6526,14 +6526,14 @@ CalculateModifiedStat: call Divide pop hl ldh a, [hDividend + 3] - sub 999 % $100 + sub LOW(MAX_STAT_VALUE) ldh a, [hDividend + 2] - sbc 999 / $100 + sbc HIGH(MAX_STAT_VALUE) jp c, .storeNewStatValue -; cap the stat at 999 - ld a, 999 / $100 +; cap the stat at MAX_STAT_VALUE (999) + ld a, HIGH(MAX_STAT_VALUE) ldh [hDividend + 2], a - ld a, 999 % $100 + ld a, LOW(MAX_STAT_VALUE) ldh [hDividend + 3], a .storeNewStatValue ldh a, [hDividend + 2] @@ -6573,7 +6573,7 @@ ApplyBadgeStatBoosts: ret ; multiply stat at hl by 1.125 -; cap stat at 999 +; cap stat at MAX_STAT_VALUE .applyBoostToStat ld a, [hli] ld d, a @@ -6591,13 +6591,13 @@ ApplyBadgeStatBoosts: adc d ld [hli], a ld a, [hld] - sub 999 % $100 + sub LOW(MAX_STAT_VALUE) ld a, [hl] - sbc 999 / $100 + sbc HIGH(MAX_STAT_VALUE) ret c - ld a, 999 / $100 + ld a, HIGH(MAX_STAT_VALUE) ld [hli], a - ld a, 999 % $100 + ld a, LOW(MAX_STAT_VALUE) ld [hld], a ret diff --git a/engine/battle/effects.asm b/engine/battle/effects.asm index fe050937..441d6c1c 100644 --- a/engine/battle/effects.asm +++ b/engine/battle/effects.asm @@ -399,11 +399,12 @@ StatModifierUpEffect: inc d ; de = unmodified (original) stat .checkIf999 pop bc + ; check if stat is already 999 ld a, [hld] - sub 999 % $100 ; check if stat is already 999 + sub LOW(MAX_STAT_VALUE) jr nz, .recalculateStat ld a, [hl] - sbc 999 / $100 + sbc HIGH(MAX_STAT_VALUE) jp z, RestoreOriginalStatModifier .recalculateStat ; recalculate affected stat ; paralysis and burn penalties, as well as badge boosts are ignored @@ -431,15 +432,15 @@ StatModifierUpEffect: ld b, $4 call Divide pop hl -; cap at 999 +; cap at MAX_STAT_VALUE (999) ldh a, [hProduct + 3] - sub 999 % $100 + sub LOW(MAX_STAT_VALUE) ldh a, [hProduct + 2] - sbc 999 / $100 + sbc HIGH(MAX_STAT_VALUE) jp c, UpdateStat - ld a, 999 / $100 + ld a, HIGH(MAX_STAT_VALUE) ldh [hMultiplicand + 1], a - ld a, 999 % $100 + ld a, LOW(MAX_STAT_VALUE) ldh [hMultiplicand + 2], a UpdateStat: diff --git a/engine/gfx/mon_icons.asm b/engine/gfx/mon_icons.asm index 19008c05..253fca35 100755 --- a/engine/gfx/mon_icons.asm +++ b/engine/gfx/mon_icons.asm @@ -236,7 +236,7 @@ WriteMonPartySpriteOAM: ; make a copy at wMonPartySpritesSavedOAM. push af ld c, $10 - ld h, wOAMBuffer / $100 + ld h, HIGH(wOAMBuffer) ldh a, [hPartyMonIndex] swap a ld l, a diff --git a/engine/gfx/oam_dma.asm b/engine/gfx/oam_dma.asm index d8d8839a..84bb4b5c 100644 --- a/engine/gfx/oam_dma.asm +++ b/engine/gfx/oam_dma.asm @@ -1,7 +1,7 @@ WriteDMACodeToHRAM:: ; Since no other memory is available during OAM DMA, ; DMARoutine is copied to HRAM and executed there. - ld c, hDMARoutine % $100 + ld c, LOW(hDMARoutine) ld b, DMARoutineEnd - DMARoutine ld hl, DMARoutine .copy @@ -14,7 +14,7 @@ WriteDMACodeToHRAM:: DMARoutine: ; initiate DMA - ld a, wOAMBuffer / $100 + ld a, HIGH(wOAMBuffer) ldh [rDMA], a ; wait for DMA to finish diff --git a/engine/gfx/sprite_oam.asm b/engine/gfx/sprite_oam.asm index 1a96286d..7e9bf739 100644 --- a/engine/gfx/sprite_oam.asm +++ b/engine/gfx/sprite_oam.asm @@ -18,7 +18,7 @@ PrepareOAMData:: .spriteLoop ldh [hSpriteOffset2], a - ld d, wSpriteStateData1 / $100 + ld d, HIGH(wSpriteStateData1) ldh a, [hSpriteOffset2] ld e, a ld a, [de] ; c1x0 @@ -79,7 +79,7 @@ PrepareOAMData:: ldh a, [hOAMBufferOffset] ld e, a - ld d, wOAMBuffer / $100 + ld d, HIGH(wOAMBuffer) .tileLoop ldh a, [hSpriteScreenY] ; temp for sprite Y position @@ -141,13 +141,13 @@ PrepareOAMData:: .nextSprite ldh a, [hSpriteOffset2] add $10 - cp $100 % $100 + cp LOW($100) jp nz, .spriteLoop ; Clear unused OAM. ldh a, [hOAMBufferOffset] ld l, a - ld h, wOAMBuffer / $100 + ld h, HIGH(wOAMBuffer) ld de, $4 ld b, $a0 ld a, [wd736] diff --git a/engine/items/inventory.asm b/engine/items/inventory.asm index 7ce61cb9..bf433175 100644 --- a/engine/items/inventory.asm +++ b/engine/items/inventory.asm @@ -12,10 +12,10 @@ AddItemToInventory_:: push hl push hl ld d, PC_ITEM_CAPACITY ; how many items the PC can hold - ld a, wNumBagItems & $FF + ld a, LOW(wNumBagItems) cp l jr nz, .checkIfInventoryFull - ld a, wNumBagItems >> 8 + ld a, HIGH(wNumBagItems) cp h jr nz, .checkIfInventoryFull ; if the destination is the bag diff --git a/engine/link/cable_club.asm b/engine/link/cable_club.asm index 03e1c50a..dd93ebba 100755 --- a/engine/link/cable_club.asm +++ b/engine/link/cable_club.asm @@ -255,9 +255,9 @@ CableClub_DoBattleOrTradeAgain: ld hl, wEnemyMons + (SERIAL_PREAMBLE_BYTE - 1) dec c jr nz, .unpatchEnemyMonsLoop - ld a, wEnemyMonOT % $100 + ld a, LOW(wEnemyMonOT) ld [wUnusedCF8D], a - ld a, wEnemyMonOT / $100 + ld a, HIGH(wEnemyMonOT) ld [wUnusedCF8D + 1], a xor a ld [wTradeCenterPointerTableIndex], a diff --git a/engine/movie/oak_speech/init_player_data.asm b/engine/movie/oak_speech/init_player_data.asm index bd181bbd..53ca24f3 100644 --- a/engine/movie/oak_speech/init_player_data.asm +++ b/engine/movie/oak_speech/init_player_data.asm @@ -23,9 +23,9 @@ InitPlayerData2: START_MONEY EQU $3000 ld hl, wPlayerMoney + 1 - ld a, START_MONEY / $100 + ld a, HIGH(START_MONEY) ld [hld], a - xor a + xor a ; LOW(START_MONEY) ld [hli], a inc hl ld [hl], a diff --git a/engine/movie/title.asm b/engine/movie/title.asm index efdf2f07..00e639ae 100755 --- a/engine/movie/title.asm +++ b/engine/movie/title.asm @@ -126,13 +126,13 @@ ENDC ld [wTitleMonSpecies], a call LoadTitleMonSprite - ld a, (vBGMap0 + $300) / $100 + ld a, HIGH(vBGMap0 + $300) call TitleScreenCopyTileMapToVRAM call SaveScreenTilesToBuffer1 ld a, $40 ldh [hWY], a call LoadScreenTilesFromBuffer2 - ld a, vBGMap0 / $100 + ld a, HIGH(vBGMap0) call TitleScreenCopyTileMapToVRAM ld b, SET_PAL_TITLE_SCREEN call RunPaletteCommand @@ -205,7 +205,7 @@ ENDC and a jr nz, .scrollTitleScreenGameVersionLoop - ld a, vBGMap1 / $100 + ld a, HIGH(vBGMap1) call TitleScreenCopyTileMapToVRAM call LoadScreenTilesFromBuffer2 call PrintGameVersionOnTitleScreen @@ -241,9 +241,9 @@ ENDC inc a ldh [hAutoBGTransferEnabled], a call ClearScreen - ld a, vBGMap0 / $100 + ld a, HIGH(vBGMap0) call TitleScreenCopyTileMapToVRAM - ld a, vBGMap1 / $100 + ld a, HIGH(vBGMap1) call TitleScreenCopyTileMapToVRAM call Delay3 call LoadGBPal @@ -258,7 +258,7 @@ ENDC farjp DoClearSaveDialogue TitleScreenPickNewMon: - ld a, vBGMap0 / $100 + ld a, HIGH(vBGMap0) call TitleScreenCopyTileMapToVRAM .loop diff --git a/engine/movie/trade.asm b/engine/movie/trade.asm index 518742aa..6aac7e23 100755 --- a/engine/movie/trade.asm +++ b/engine/movie/trade.asm @@ -237,7 +237,7 @@ Trade_ShowPlayerMon: ld c, 10 call TextBoxBorder call Trade_PrintPlayerMonInfoText - ld b, vBGMap0 / $100 + ld b, HIGH(vBGMap0) call CopyScreenTileBufferToVRAM call ClearScreen ld a, [wTradedPlayerMonSpecies] @@ -266,7 +266,7 @@ Trade_ShowPlayerMon: Trade_DrawOpenEndOfLinkCable: call Trade_ClearTileMap - ld b, vBGMap0 / $100 + ld b, HIGH(vBGMap0) call CopyScreenTileBufferToVRAM ld b, SET_PAL_GENERIC call RunPaletteCommand diff --git a/engine/overworld/elevator.asm b/engine/overworld/elevator.asm index 7a6aca85..fa404602 100755 --- a/engine/overworld/elevator.asm +++ b/engine/overworld/elevator.asm @@ -56,7 +56,7 @@ ShakeElevatorRedrawRow: add hl, de ld a, h and $3 - or vBGMap0 / $100 + or HIGH(vBGMap0) ld d, a ld a, l pop hl diff --git a/engine/overworld/movement.asm b/engine/overworld/movement.asm index ac7e1b46..a20b3174 100644 --- a/engine/overworld/movement.asm +++ b/engine/overworld/movement.asm @@ -23,7 +23,7 @@ UpdatePlayerSprite: ret .lowerLeftTileIsMapTile call DetectCollisionBetweenSprites - ld h, wSpriteStateData1 / $100 + ld h, HIGH(wSpriteStateData1) ld a, [wWalkCounter] and a jr nz, .moving @@ -395,7 +395,7 @@ UpdateSpriteMovementDelay: ld l, a ld [hl], $1 ; c1x1 = 1 (mark as ready to move) notYetMoving: - ld h, wSpriteStateData1 / $100 + ld h, HIGH(wSpriteStateData1) ldh a, [hCurrentSpriteOffset] add wSpritePlayerStateData1AnimFrameCounter - wSpritePlayerStateData1 ld l, a @@ -450,7 +450,7 @@ InitializeSpriteStatus: ; calculates the sprite's screen position form its map position and the player position InitializeSpriteScreenPosition: - ld h, wSpriteStateData2 / $100 + ld h, HIGH(wSpriteStateData2) ldh a, [hCurrentSpriteOffset] add wSpritePlayerStateData2MapY - wSpritePlayerStateData2 ld l, a @@ -478,7 +478,7 @@ CheckSpriteAvailability: ldh a, [hIsHiddenMissableObject] and a jp nz, .spriteInvisible - ld h, wSpriteStateData2 / $100 + ld h, HIGH(wSpriteStateData2) ldh a, [hCurrentSpriteOffset] add wSpritePlayerStateData2MovementByte1 - wSpritePlayerStateData2 ld l, a @@ -526,7 +526,7 @@ CheckSpriteAvailability: cp d jr c, .spriteVisible ; standing on tile with ID >=MAP_TILESET_SIZE (top right tile) .spriteInvisible - ld h, wSpriteStateData1 / $100 + ld h, HIGH(wSpriteStateData1) ldh a, [hCurrentSpriteOffset] add wSpritePlayerStateData1ImageIndex - wSpritePlayerStateData1 ld l, a @@ -580,7 +580,7 @@ UpdateSpriteImage: ; e: X movement delta (-1, 0 or 1) ; set carry on failure, clears carry on success CanWalkOntoTile: - ld h, wSpriteStateData2 / $100 + ld h, HIGH(wSpriteStateData2) ldh a, [hCurrentSpriteOffset] add wSpritePlayerStateData2MovementByte1 - wSpritePlayerStateData2 ld l, a @@ -608,7 +608,7 @@ CanWalkOntoTile: ld a, [hl] ; $c2x6 (movement byte 1) inc a jr z, .impassable ; if $ff, no movement allowed (however, changing direction is) - ld h, wSpriteStateData1 / $100 + ld h, HIGH(wSpriteStateData1) ldh a, [hCurrentSpriteOffset] add wSpritePlayerStateData1YPixels - wSpritePlayerStateData1 ld l, a @@ -627,14 +627,14 @@ CanWalkOntoTile: call DetectCollisionBetweenSprites pop bc pop de - ld h, wSpriteStateData1 / $100 + ld h, HIGH(wSpriteStateData1) ldh a, [hCurrentSpriteOffset] add $c ld l, a ld a, [hl] ; c1xc (directions in which sprite collision would occur) and b ; check against chosen direction (1,2,4 or 8) jr nz, .impassable ; collision between sprites, don't go there - ld h, wSpriteStateData2 / $100 + ld h, HIGH(wSpriteStateData2) ldh a, [hCurrentSpriteOffset] add wSpritePlayerStateData2YDisplacement - wSpritePlayerStateData2 ld l, a @@ -665,7 +665,7 @@ CanWalkOntoTile: and a ; clear carry (marking success) ret .impassable - ld h, wSpriteStateData1 / $100 + ld h, HIGH(wSpriteStateData1) ldh a, [hCurrentSpriteOffset] inc a ld l, a @@ -691,7 +691,7 @@ CanWalkOntoTile: ; this is always the lower left tile of the 2x2 tile blocks all sprites are snapped to ; hl: output pointer GetTileSpriteStandsOn: - ld h, wSpriteStateData1 / $100 + ld h, HIGH(wSpriteStateData1) ldh a, [hCurrentSpriteOffset] add wSpritePlayerStateData1YPixels - wSpritePlayerStateData1 ld l, a diff --git a/engine/overworld/sprite_collisions.asm b/engine/overworld/sprite_collisions.asm index e6c415ab..6f8e3c2c 100644 --- a/engine/overworld/sprite_collisions.asm +++ b/engine/overworld/sprite_collisions.asm @@ -53,9 +53,9 @@ UpdateNonPlayerSprite: DetectCollisionBetweenSprites: nop - ld h, wSpriteStateData1 / $100 + ld h, HIGH(wSpriteStateData1) ldh a, [hCurrentSpriteOffset] - add wSpriteStateData1 % $100 + add LOW(wSpriteStateData1) ld l, a ld a, [hl] ; a = [$c1i0] (picture) (0 if slot is unused) diff --git a/engine/slots/slot_machine.asm b/engine/slots/slot_machine.asm index b6eda6d1..64c14997 100755 --- a/engine/slots/slot_machine.asm +++ b/engine/slots/slot_machine.asm @@ -294,7 +294,7 @@ SlotMachine_StopWheel1Early: ; Stop early if the middle symbol is not a cherry. inc hl ld a, [hl] - cp SLOTSCHERRY >> 8 + cp HIGH(SLOTSCHERRY) jr nz, .stopWheel ret ; It looks like this was intended to make the wheel stop when a 7 symbol was @@ -303,7 +303,7 @@ SlotMachine_StopWheel1Early: ld c, $3 .loop ld a, [hli] - cp SLOTS7 >> 8 + cp HIGH(SLOTS7) jr c, .stopWheel ; condition never true dec c jr nz, .loop @@ -330,7 +330,7 @@ SlotMachine_StopWheel2Early: .sevenAndBarMode call SlotMachine_FindWheel1Wheel2Matches ld a, [de] - cp (SLOTSBAR >> 8) + 1 + cp HIGH(SLOTSBAR) + 1 ret nc .stopWheel xor a @@ -427,7 +427,7 @@ SlotMachine_CheckForMatches: jr nz, .acceptMatch ; if 7/bar matches aren't enabled and the match was a 7/bar symbol, roll wheel ld a, [hl] - cp (SLOTSBAR >> 8) + 1 + cp HIGH(SLOTSBAR) + 1 jr c, .rollWheel3DownByOneSymbol .acceptMatch ld a, [hl] @@ -702,7 +702,7 @@ SlotMachine_PayCoinsToPlayer: .skip1 ld [wAnimCounter], a ld a, [wSlotMachineWinningSymbol] - cp (SLOTSBAR >> 8) + 1 + cp HIGH(SLOTSBAR) + 1 ld c, 8 jr nc, .skip2 srl c ; c = 4 (make the the coins transfer faster if the symbol was 7 or bar) |