diff options
Diffstat (limited to 'engine')
-rw-r--r-- | engine/battle/ai/items.asm | 1 | ||||
-rw-r--r-- | engine/battle/ai/scoring.asm | 69 | ||||
-rwxr-xr-x | engine/events/happiness_egg.asm | 6 | ||||
-rw-r--r-- | engine/events/pokerus/pokerus.asm | 30 | ||||
-rwxr-xr-x | engine/events/shuckle.asm | 3 | ||||
-rwxr-xr-x | engine/events/specials.asm | 3 | ||||
-rwxr-xr-x | engine/events/whiteout.asm | 6 | ||||
-rw-r--r-- | engine/gfx/load_push_oam.asm | 3 | ||||
-rwxr-xr-x | engine/items/item_effects.asm | 4 | ||||
-rwxr-xr-x | engine/items/tmhm2.asm | 91 | ||||
-rwxr-xr-x | engine/link/place_waiting_text.asm | 3 | ||||
-rwxr-xr-x | engine/math/math.asm | 23 | ||||
-rw-r--r-- | engine/math/sine.asm | 39 | ||||
-rw-r--r-- | engine/movie/title.asm | 2 | ||||
-rwxr-xr-x | engine/overworld/npc_movement.asm | 4 | ||||
-rwxr-xr-x | engine/overworld/player_movement.asm | 13 | ||||
-rwxr-xr-x | engine/overworld/player_object.asm | 5 | ||||
-rwxr-xr-x | engine/overworld/time.asm | 4 | ||||
-rw-r--r-- | engine/pokemon/breeding.asm | 6 | ||||
-rw-r--r-- | engine/pokemon/correct_nick_errors.asm | 33 | ||||
-rwxr-xr-x | engine/pokemon/move_mon.asm | 2 | ||||
-rw-r--r-- | engine/smallflag.asm | 3 | ||||
-rw-r--r-- | engine/tilesets/map_palettes.asm | 2 |
23 files changed, 142 insertions, 213 deletions
diff --git a/engine/battle/ai/items.asm b/engine/battle/ai/items.asm index bf65c683..0f30199e 100644 --- a/engine/battle/ai/items.asm +++ b/engine/battle/ai/items.asm @@ -692,7 +692,6 @@ AI_Switch: ld a, [wLinkMode] cp LINK_COLOSSEUM ret z - scf ret diff --git a/engine/battle/ai/scoring.asm b/engine/battle/ai/scoring.asm index 2ff0c2da..bfb9c282 100644 --- a/engine/battle/ai/scoring.asm +++ b/engine/battle/ai/scoring.asm @@ -1,5 +1,6 @@ AIScoring: ; used only for BANK(AIScoring) + AI_Basic: ; Don't do anything redundant: ; -Using status-only moves if the player can't be statused @@ -458,15 +459,15 @@ AI_Smart_LockOn: .asm_38826 ld a, [wPlayerEvaLevel] - cp $a + cp BASE_STAT_LEVEL + 3 jr nc, .asm_3886c - cp $8 + cp BASE_STAT_LEVEL + 1 jr nc, .asm_38867 ld a, [wEnemyAccLevel] - cp $5 + cp BASE_STAT_LEVEL - 2 jr c, .asm_3886c - cp $7 + cp BASE_STAT_LEVEL jr c, .asm_38867 ld hl, wEnemyMonMoves @@ -559,7 +560,7 @@ AI_Smart_Selfdestruct: ; If enemy's HP is between 25% and 50%, ; over 90% chance to greatly discourage this move. call Random - cp 9 percent - 2 + cp 8 percent ret c .asm_388a7 @@ -583,7 +584,7 @@ AI_Smart_DreamEater: AI_Smart_EvasionUp: ; Dismiss this move if enemy's evasion can't raise anymore. ld a, [wEnemyEvaLevel] - cp $d + cp MAX_STAT_LEVEL jp nc, AIDiscourageMove ; If enemy's HP is full... @@ -694,12 +695,12 @@ AI_Smart_AlwaysHit: ; ...enemy's accuracy level has been lowered three or more stages ld a, [wEnemyAccLevel] - cp $5 + cp BASE_STAT_LEVEL - 2 jr c, .asm_38935 ; ...or player's evasion level has been raised three or more stages. ld a, [wPlayerEvaLevel] - cp $a + cp BASE_STAT_LEVEL + 3 ret c .asm_38935 @@ -859,12 +860,12 @@ AI_Smart_ResetStats: ; 85% chance to encourage this move if any of enemy's stat levels is lower than -2. push hl ld hl, wEnemyAtkLevel - ld c, $8 + ld c, NUM_LEVEL_STATS .asm_389dc dec c jr z, .asm_389e6 ld a, [hli] - cp $5 + cp BASE_STAT_LEVEL - 2 jr c, .asm_389f3 jr .asm_389dc @@ -876,7 +877,7 @@ AI_Smart_ResetStats: dec c jr z, .asm_389fc ld a, [hli] - cp $a + cp BASE_STAT_LEVEL + 3 jr c, .asm_389eb .asm_389f3 @@ -1032,7 +1033,7 @@ AI_Smart_Unused2B: .asm_38a8b push hl ld hl, wPlayerUsedMoves - ld c, 4 + ld c, NUM_MOVES .asm_38a91 ld a, [hli] @@ -1095,12 +1096,12 @@ AI_Smart_SpDefenseUp2: ; Discourage this move if enemy's special defense level is higher than +3. ld a, [wEnemySDefLevel] - cp $b + cp BASE_STAT_LEVEL + 4 jr nc, .asm_38af1 ; 80% chance to greatly encourage this move if ; enemy's Special Defense level is lower than +2, and the player is of a special type. - cp $9 + cp BASE_STAT_LEVEL + 2 ret nc ld a, [wBattleMonType1] @@ -1239,11 +1240,11 @@ AI_Smart_Rage: ; Encourage this move based on Rage's counter. .asm_38b6d ld a, [wEnemyRageCounter] - cp $2 + cp 2 ret c dec [hl] ld a, [wEnemyRageCounter] - cp $3 + cp 3 ret c dec [hl] ret @@ -1315,7 +1316,7 @@ AI_Smart_Mimic: AI_Smart_Counter: push hl ld hl, wPlayerUsedMoves - ld c, 4 + ld c, NUM_MOVES ld b, 0 .asm_38bda @@ -1454,8 +1455,8 @@ AI_Smart_SleepTalk: ; Greatly discourage this move otherwise. ld a, [wEnemyMonStatus] - and $7 - cp $1 + and SLP + cp 1 jr z, .asm_38ca8 dec [hl] @@ -1497,7 +1498,7 @@ AI_Smart_Spite: .asm_38cc8 push hl ld b, a - ld c, 4 + ld c, NUM_MOVES ld hl, wBattleMonMoves ld de, wBattleMonPP @@ -1516,9 +1517,9 @@ AI_Smart_Spite: .asm_38cdc pop hl ld a, [de] - cp $6 + cp 6 jr c, .asm_38cee - cp $f + cp 15 jr nc, .asm_38cec call Random @@ -1815,9 +1816,9 @@ AI_Smart_Curse: jr nc, .asm_38e72 ld a, [wEnemyAtkLevel] - cp $b + cp BASE_STAT_LEVEL + 4 jr nc, .asm_38e72 - cp $9 + cp BASE_STAT_LEVEL + 2 ret nc ld a, [wBattleMonType1] @@ -1915,10 +1916,10 @@ AI_Smart_Protect: AI_Smart_Foresight: ld a, [wEnemyAccLevel] - cp $5 + cp BASE_STAT_LEVEL - 2 jr c, .asm_38f02 ld a, [wPlayerEvaLevel] - cp $a + cp BASE_STAT_LEVEL + 3 jr nc, .asm_38f02 ld a, [wBattleMonType1] @@ -2107,10 +2108,10 @@ AI_Smart_Rollout: jr nc, .asm_38fe1 ld a, [wEnemyAccLevel] - cp 7 + cp BASE_STAT_LEVEL jr c, .asm_38fe1 ld a, [wPlayerEvaLevel] - cp 8 + cp BASE_STAT_LEVEL + 1 jr nc, .asm_38fe1 ; Otherwise, 80% chance to greatly encourage this move. @@ -2378,7 +2379,7 @@ AI_Smart_BellyDrum: ; Else, discourage this move if enemy's HP is not full. ld a, [wEnemyAtkLevel] - cp $a + cp BASE_STAT_LEVEL + 3 jr nc, .asm_3910e call AICheckEnemyMaxHP @@ -2433,15 +2434,15 @@ AI_Smart_PsychUp: ; This block will always ret, since the comparisons to wPlayerEvaLevel capture every possible value ld a, [wPlayerAccLevel] - cp $6 + cp BASE_STAT_LEVEL - 1 ret c ld a, [wPlayerEvaLevel] - cp $9 + cp BASE_STAT_LEVEL + 2 ret c ld a, [wPlayerEvaLevel] - cp $8 + cp BASE_STAT_LEVEL + 1 ret nc ; unused @@ -2458,8 +2459,8 @@ AI_Smart_PsychUp: AI_Smart_MirrorCoat: push hl ld hl, wPlayerUsedMoves - ld c, $4 - ld b, $0 + ld c, NUM_MOVES + ld b, 0 .asm_39159 ld a, [hli] diff --git a/engine/events/happiness_egg.asm b/engine/events/happiness_egg.asm index 85b6f710..bb2e949c 100755 --- a/engine/events/happiness_egg.asm +++ b/engine/events/happiness_egg.asm @@ -140,11 +140,13 @@ StepHappiness:: ret DayCareStep:: +; Raise the experience of Day-Care Pokémon every step cycle. + ld a, [wDayCareMan] bit DAYCAREMAN_HAS_MON_F, a jr z, .day_care_lady - ld a, [wBreedMon1Level] + ld a, [wBreedMon1Level] ; level cp MAX_LEVEL jr nc, .day_care_lady ld hl, wBreedMon1Exp + 2 ; exp @@ -196,7 +198,7 @@ DayCareStep:: callfar CheckBreedmonCompatibility ld a, [wBreedingCompatibility] cp 230 - ld b, 32 percent - 1 + ld b, 31 percent + 1 jr nc, .okay ld a, [wBreedingCompatibility] cp 170 diff --git a/engine/events/pokerus/pokerus.asm b/engine/events/pokerus/pokerus.asm index 63eb7fe1..99a5652c 100644 --- a/engine/events/pokerus/pokerus.asm +++ b/engine/events/pokerus/pokerus.asm @@ -26,8 +26,8 @@ GivePokerusAndConvertBerries: and a ret nz ldh a, [hRandomSub] - cp $3 - ret nc ; 3/65536 chance (00 00, 00 01 or 00 02) + cp 3 + ret nc ; 3/65536 chance (00 00, 00 01 or 00 02) ld a, [wPartyCount] ld b, a .randomMonSelectLoop @@ -36,11 +36,11 @@ GivePokerusAndConvertBerries: cp b jr nc, .randomMonSelectLoop ld hl, wPartyMon1PokerusStatus - call GetPartyLocation ; get pokerus byte of random mon + call GetPartyLocation ; get pokerus byte of random mon ld a, [hl] and $f0 - ret nz ; if it already has pokerus, do nothing -.randomPokerusLoop ; Simultaneously sample the strain and duration + ret nz ; if it already has pokerus, do nothing +.randomPokerusLoop ; Simultaneously sample the strain and duration call Random and a jr z, .randomPokerusLoop @@ -62,20 +62,20 @@ GivePokerusAndConvertBerries: .TrySpreadPokerus: call Random cp 33 percent + 1 - ret nc ; 1/3 chance + ret nc ; 1/3 chance ld a, [wPartyCount] cp 1 - ret z ; only one mon, nothing to do + ret z ; only one mon, nothing to do ld c, [hl] ld a, b cp 2 - jr c, .checkPreviousMonsLoop ; no more mons after this one, go backwards + jr c, .checkPreviousMonsLoop ; no more mons after this one, go backwards call Random cp 50 percent + 1 - jr c, .checkPreviousMonsLoop ; 1/2 chance, go backwards + jr c, .checkPreviousMonsLoop ; 1/2 chance, go backwards .checkFollowingMonsLoop add hl, de ld a, [hl] @@ -83,8 +83,8 @@ GivePokerusAndConvertBerries: jr z, .infectMon ld c, a and $3 - ret z ; if mon has cured pokerus, stop searching - dec b ; go on to next mon + ret z ; if mon has cured pokerus, stop searching + dec b ; go on to next mon ld a, b cp 1 jr nz, .checkFollowingMonsLoop ; no more mons left @@ -93,7 +93,7 @@ GivePokerusAndConvertBerries: .checkPreviousMonsLoop ld a, [wPartyCount] cp b - ret z ; no more mons + ret z ; no more mons ld a, l sub e ld l, a @@ -105,8 +105,8 @@ GivePokerusAndConvertBerries: jr z, .infectMon ld c, a and $3 - ret z ; if mon has cured pokerus, stop searching - inc b ; go on to next mon + ret z ; if mon has cured pokerus, stop searching + inc b ; go on to next mon jr .checkPreviousMonsLoop .infectMon @@ -128,7 +128,7 @@ ConvertBerriesToBerryJuice: bit STATUSFLAGS2_REACHED_GOLDENROD_F, [hl] ret z call Random - cp 6 percent + 1 ; 1/16 chance + cp 1 out_of 16 ; 6.25% chance ret nc ld hl, wPartyMons ld a, [wPartyCount] diff --git a/engine/events/shuckle.asm b/engine/events/shuckle.asm index db6db8f9..668a99b0 100755 --- a/engine/events/shuckle.asm +++ b/engine/events/shuckle.asm @@ -2,7 +2,7 @@ MANIA_OT_ID EQU 00518 GiveShuckle: ; Adding to the party. - xor a + xor a ; PARTYMON ld [wMonType], a ; Level 15 Shuckle. @@ -63,6 +63,7 @@ GiveShuckle: SpecialShuckleOT: db "MANIA@" + SpecialShuckleNick: db "SHUCKIE@" diff --git a/engine/events/specials.asm b/engine/events/specials.asm index f4b6437d..91ca4208 100755 --- a/engine/events/specials.asm +++ b/engine/events/specials.asm @@ -458,3 +458,6 @@ TrainerHouse: ld a, [sMysteryGiftTrainerHouseFlag] ld [wScriptVar], a jp CloseSRAM + +; unused + nop diff --git a/engine/events/whiteout.asm b/engine/events/whiteout.asm index f8bfce12..635be636 100755 --- a/engine/events/whiteout.asm +++ b/engine/events/whiteout.asm @@ -61,11 +61,7 @@ GetWhiteoutSpawn: ld d, a ld a, [wLastSpawnMapNumber] ld e, a - - ld a, $05 - ld hl, $5465 - rst $08 - + farcall IsSpawnPoint ld a, c jr c, .yes xor a ; SPAWN_HOME diff --git a/engine/gfx/load_push_oam.asm b/engine/gfx/load_push_oam.asm index 641439ec..2e43c1ff 100644 --- a/engine/gfx/load_push_oam.asm +++ b/engine/gfx/load_push_oam.asm @@ -1,6 +1,3 @@ -DummyPredef1: - ret - WriteOAMDMACodeToHRAM:: ld c, LOW(hTransferVirtualOAM) ld b, .PushOAMEnd - .PushOAM diff --git a/engine/items/item_effects.asm b/engine/items/item_effects.asm index 29f72831..35a7cd6c 100755 --- a/engine/items/item_effects.asm +++ b/engine/items/item_effects.asm @@ -872,7 +872,7 @@ MoonBallMultiplier: pop bc push bc - ld a, BANK(EvosAttacksPointers) + ld a, BANK("Evolutions and Attacks") call GetFarByte cp EVOLVE_ITEM pop bc @@ -886,7 +886,7 @@ MoonBallMultiplier: ; No Pokémon evolve with Burn Heal, ; so Moon Balls always have a catch rate of 1×. push bc - ld a, BANK(EvosAttacksPointers) + ld a, BANK("Evolutions and Attacks") call GetFarByte cp MOON_STONE_RED ; BURN_HEAL pop bc diff --git a/engine/items/tmhm2.asm b/engine/items/tmhm2.asm index 18218a06..eb3eb58e 100755 --- a/engine/items/tmhm2.asm +++ b/engine/items/tmhm2.asm @@ -1,107 +1,46 @@ -CanLearnTMHMMove: ; 11a25 (4:5a25) +CanLearnTMHMMove: ld a, [wCurPartySpecies] ld [wCurSpecies], a call GetBaseData - ld hl, wd138 + ld hl, wBaseTMHM push hl + ld a, [wPutativeTMHMMove] ld b, a - ld c, $0 + ld c, 0 ld hl, TMHMMoves -.asm_11a3b +.loop ld a, [hli] and a - jr z, .asm_11a52 + jr z, .end cp b jr z, .asm_11a45 inc c - jr .asm_11a3b + jr .loop .asm_11a45 pop hl ld b, CHECK_FLAG push de - ld d, $0 + ld d, 0 predef SmallFarFlagAction pop de ret -.asm_11a52 +.end pop hl - ld c, $0 + ld c, 0 ret -GetTMHMMove: ; 11a56 (4:5a56) - ld a, [wd151] +GetTMHMMove: + ld a, [wTempTMHM] dec a ld hl, TMHMMoves - ld b, $0 + ld b, 0 ld c, a add hl, bc ld a, [hl] - ld [wd151], a + ld [wTempTMHM], a ret -TMHMMoves: - db DYNAMICPUNCH - db HEADBUTT - db CURSE - db ROLLOUT - db ROAR - db TOXIC - db ZAP_CANNON - db ROCK_SMASH - db PSYCH_UP - db HIDDEN_POWER - db SUNNY_DAY - db SWEET_SCENT - db SNORE - db BLIZZARD - db HYPER_BEAM - db ICY_WIND - db PROTECT - db RAIN_DANCE - db GIGA_DRAIN - db ENDURE - db FRUSTRATION - db SOLARBEAM - db IRON_TAIL - db DRAGONBREATH - db THUNDER - db EARTHQUAKE - db RETURN - db DIG - db PSYCHIC_M - db SHADOW_BALL - db MUD_SLAP - db DOUBLE_TEAM - db ICE_PUNCH - db SWAGGER - db SLEEP_TALK - db SLUDGE_BOMB - db SANDSTORM - db FIRE_BLAST - db SWIFT - db DEFENSE_CURL - db THUNDERPUNCH - db DREAM_EATER - db DETECT - db REST - db ATTRACT - db THIEF - db STEEL_WING - db FIRE_PUNCH - db FURY_CUTTER - db NIGHTMARE - db CUT - db FLY - db SURF - db STRENGTH - db FLASH - db WHIRLPOOL - db WATERFALL - - db 0 - db 0 - db 0 - db 0 +INCLUDE "data/moves/tmhm_moves.asm" diff --git a/engine/link/place_waiting_text.asm b/engine/link/place_waiting_text.asm index dc1fe215..5c31c314 100755 --- a/engine/link/place_waiting_text.asm +++ b/engine/link/place_waiting_text.asm @@ -22,3 +22,6 @@ PlaceWaitingText:: .Waiting: db "Waiting...!@" + +DummyPredef1: + ret diff --git a/engine/math/math.asm b/engine/math/math.asm index cdac2d37..d5df3c34 100755 --- a/engine/math/math.asm +++ b/engine/math/math.asm @@ -1,11 +1,10 @@ -_Multiply:: ; 67bd - +_Multiply:: ; hMultiplier is one byte. ld a, 8 ld b, a xor a - ldh [hProduct], a + ldh [hMultiplicand - 1], a ldh [hMathBuffer + 1], a ldh [hMathBuffer + 2], a ldh [hMathBuffer + 3], a @@ -37,7 +36,7 @@ _Multiply:: ; 67bd ldh a, [hMathBuffer + 1] ld c, a - ldh a, [hProduct] + ldh a, [hMultiplicand - 1] adc c ldh [hMathBuffer + 1], a @@ -59,9 +58,9 @@ _Multiply:: ; 67bd rla ldh [hMultiplicand + 0], a - ldh a, [hProduct] + ldh a, [hMultiplicand - 1] rla - ldh [hProduct], a + ldh [hMultiplicand - 1], a jr .loop @@ -80,7 +79,7 @@ _Multiply:: ; 67bd ret -_Divide:: ; 681d +_Divide:: xor a ldh [hMathBuffer + 0], a ldh [hMathBuffer + 1], a @@ -173,18 +172,18 @@ _Divide:: ; 681d .done ldh a, [hDividend + 1] - ldh [hDivisor], a + ldh [hRemainder], a ldh a, [hMathBuffer + 4] - ldh [hDividend + 3], a + ldh [hQuotient + 3], a ldh a, [hMathBuffer + 3] - ldh [hDividend + 2], a + ldh [hQuotient + 2], a ldh a, [hMathBuffer + 2] - ldh [hDividend + 1], a + ldh [hQuotient + 1], a ldh a, [hMathBuffer + 1] - ldh [hDividend + 0], a + ldh [hQuotient + 0], a ret diff --git a/engine/math/sine.asm b/engine/math/sine.asm index e22d785a..5db3bd60 100644 --- a/engine/math/sine.asm +++ b/engine/math/sine.asm @@ -1,40 +1,7 @@ -_Sine:: ; 8ac9 (2:4ac9) +_Sine:: +; a = d * sin(e * pi/256) ld a, e - and $3f - cp $20 - jr nc, .negative - call .GetSine - ld a, h - ret -.negative - and $1f - call .GetSine - ld a, h - xor $ff - inc a - ret - -.GetSine: ; 8adf (2:4adf) - ld e, a - ld a, d - ld d, $0 - ld hl, .SineWave - add hl, de - add hl, de - ld e, [hl] - inc hl - ld d, [hl] - ld hl, $0 -.loop - srl a - jr nc, .no_add - add hl, de -.no_add - sla e - rl d - and a - jr nz, .loop - ret + calc_sine_wave .SineWave .SineWave: sine_table $100 diff --git a/engine/movie/title.asm b/engine/movie/title.asm index ece0a6eb..32b0f734 100644 --- a/engine/movie/title.asm +++ b/engine/movie/title.asm @@ -72,7 +72,7 @@ TitleScreen: ; Let LCD Stat know we're messing around with SCX ld a, LOW(rSCX) ldh [hLCDCPointer], a - ld b, SCGB_0C + ld b, SCGB_GS_TITLE_SCREEN call GetSGBLayout call Function6341 ld de, MUSIC_TITLE diff --git a/engine/overworld/npc_movement.asm b/engine/overworld/npc_movement.asm index 3a196508..01d49d21 100755 --- a/engine/overworld/npc_movement.asm +++ b/engine/overworld/npc_movement.asm @@ -274,7 +274,7 @@ WillObjectBumpIntoSomeoneElse: ld e, [hl] jr IsNPCAtCoord -Function70f4: +Unreferenced_Function70f4: ldh a, [hMapObjectIndexBuffer] call GetObjectStruct call .CheckWillBeFacingNPC @@ -473,7 +473,7 @@ IsObjectMovingOffEdgeOfScreen: scf ret -Function71f2: +Unreferenced_Function71f2: ld a, [wPlayerStandingMapX] ld d, a ld a, [wPlayerStandingMapY] diff --git a/engine/overworld/player_movement.asm b/engine/overworld/player_movement.asm index 165a8479..bdf23ec4 100755 --- a/engine/overworld/player_movement.asm +++ b/engine/overworld/player_movement.asm @@ -577,11 +577,14 @@ DoPlayerMovement:: ; Standing jr .update -.d_down add hl, de -.d_up add hl, de -.d_left add hl, de -.d_right add hl, de - +.d_down + add hl, de +.d_up + add hl, de +.d_left + add hl, de +.d_right + add hl, de .update ld a, [hli] ld [wWalkingDirection], a diff --git a/engine/overworld/player_object.asm b/engine/overworld/player_object.asm index 28323eba..339f7ee0 100755 --- a/engine/overworld/player_object.asm +++ b/engine/overworld/player_object.asm @@ -107,8 +107,9 @@ RefreshPlayerCoords: ld hl, wPlayerLastMapY ld [hl], e ld e, a +; the next three lines are useless ld a, [wObjectFollow_Leader] - cp $0 + cp PLAYER ret nz ret @@ -509,7 +510,7 @@ CopyTempObjectToObjectStruct: ld [hl], a ret -TrainerWalkToPlayer:: +TrainerWalkToPlayer: ldh a, [hLastTalked] call InitMovementBuffer ld a, movement_step_sleep diff --git a/engine/overworld/time.asm b/engine/overworld/time.asm index d5c45cc4..a829cd4f 100755 --- a/engine/overworld/time.asm +++ b/engine/overworld/time.asm @@ -92,8 +92,8 @@ CheckDailyResetTimer:: ret nc xor a ld hl, wDailyFlags1 - ld [hli], a - ld [hl], a + ld [hli], a ; wDailyFlags1 + ld [hl], a ; wDailyFlags2 jr RestartDailyResetTimer StartBugContestTimer: diff --git a/engine/pokemon/breeding.asm b/engine/pokemon/breeding.asm index b891df82..fd5d9a82 100644 --- a/engine/pokemon/breeding.asm +++ b/engine/pokemon/breeding.asm @@ -462,18 +462,18 @@ GetEggMove: ld a, BANK(EvosAttacksPointers) call GetFarHalfword .loop3 - ld a, BANK(EvosAttacksPointers) + ld a, BANK("Evolutions and Attacks") call GetFarByte inc hl and a jr nz, .loop3 .loop4 - ld a, BANK(EvosAttacksPointers) + ld a, BANK("Evolutions and Attacks") call GetFarByte and a jr z, .inherit_tmhm inc hl - ld a, BANK(EvosAttacksPointers) + ld a, BANK("Evolutions and Attacks") call GetFarByte ld b, a ld a, [de] diff --git a/engine/pokemon/correct_nick_errors.asm b/engine/pokemon/correct_nick_errors.asm index 44748a00..421bf92d 100644 --- a/engine/pokemon/correct_nick_errors.asm +++ b/engine/pokemon/correct_nick_errors.asm @@ -1,32 +1,52 @@ CorrectNickErrors:: +; error-check monster nick before use +; must be a peace offering to gamesharkers + +; input: de = nick location + push bc push de ld b, MON_NAME_LENGTH + .checkchar +; end of nick? ld a, [de] - cp "@" - jr z, .done + cp "@" ; terminator + jr z, .end + +; check if this char is a text command ld hl, .textcommands dec hl .loop +; next entry inc hl +; reached end of commands table? ld a, [hl] - cp $ff - jr z, .next + cp -1 + jr z, .done + +; is the current char between this value (inclusive)... ld a, [de] cp [hl] inc hl jr c, .loop +; ...and this one? cp [hl] jr nc, .loop + +; replace it with a "?" ld a, "?" ld [de], a jr .loop -.next +.done +; next char inc de +; reached end of nick without finding a terminator? dec b jr nz, .checkchar + +; change nick to "?@" pop de push de ld a, "?" @@ -34,7 +54,8 @@ CorrectNickErrors:: inc de ld a, "@" ld [de], a -.done +.end +; if the nick has any errors at this point it's out of our hands pop de pop bc ret diff --git a/engine/pokemon/move_mon.asm b/engine/pokemon/move_mon.asm index 0c50dd4e..b1988f68 100755 --- a/engine/pokemon/move_mon.asm +++ b/engine/pokemon/move_mon.asm @@ -1456,7 +1456,7 @@ CalcMonStatC: add hl, bc .sqrt_loop xor a - ldh [hMultiplicand], a + ldh [hMultiplicand + 0], a ldh [hMultiplicand + 1], a inc b ld a, b diff --git a/engine/smallflag.asm b/engine/smallflag.asm index f7d1406f..04cbfcc2 100644 --- a/engine/smallflag.asm +++ b/engine/smallflag.asm @@ -1,6 +1,3 @@ -Functionc660: - nop - SmallFarFlagAction: ; Perform action b on bit c in flag array hl. ; If checking a flag, check flag array d:hl unless d is 0. diff --git a/engine/tilesets/map_palettes.asm b/engine/tilesets/map_palettes.asm index c8a4a57d..858098e6 100644 --- a/engine/tilesets/map_palettes.asm +++ b/engine/tilesets/map_palettes.asm @@ -1,6 +1,6 @@ _SwapTextboxPalettes:: hlcoord 0, 0 - ld de, wAttrmap + decoord 0, 0, wAttrmap ld b, SCREEN_HEIGHT .loop ld c, SCREEN_WIDTH |