diff options
-rw-r--r-- | constants/map_object_constants.asm | 3 | ||||
-rw-r--r-- | constants/script_constants.asm | 2 | ||||
-rw-r--r-- | constants/wram_constants.asm | 28 | ||||
-rw-r--r-- | docs/bugs_and_glitches.md | 24 | ||||
-rw-r--r-- | engine/overworld/events.asm | 24 | ||||
-rw-r--r-- | engine/overworld/map_objects.asm | 58 | ||||
-rw-r--r-- | engine/overworld/player_step.asm | 6 | ||||
-rw-r--r-- | engine/overworld/scripting.asm | 28 | ||||
-rw-r--r-- | engine/tilesets/tileset_anims.asm | 4 | ||||
-rw-r--r-- | home/map.asm | 2 | ||||
-rw-r--r-- | wram.asm | 19 |
11 files changed, 116 insertions, 82 deletions
diff --git a/constants/map_object_constants.asm b/constants/map_object_constants.asm index 55a3f358b..00ddb772a 100644 --- a/constants/map_object_constants.asm +++ b/constants/map_object_constants.asm @@ -70,6 +70,9 @@ EMOTE_OBJECT EQU 1 << EMOTE_OBJECT_F const OBJ_FLAGS2_2 ; 2 const OVERHEAD_F ; 3 const USE_OBP1_F ; 4 + const OBJ_FLAGS2_5 ; 5 + const OBJ_FLAGS2_6 ; 6 + const OBJ_FLAGS2_7 ; 7 LOW_PRIORITY EQU 1 << LOW_PRIORITY_F HIGH_PRIORITY EQU 1 << HIGH_PRIORITY_F diff --git a/constants/script_constants.asm b/constants/script_constants.asm index a31394a36..34f2bc864 100644 --- a/constants/script_constants.asm +++ b/constants/script_constants.asm @@ -163,7 +163,7 @@ NUM_CMDQUEUE_TYPES EQU const_value const EMOTE_ROD ; 9 const EMOTE_BOULDER_DUST ; 10 const EMOTE_GRASS_RUSTLE ; 11 -EMOTE_MEM EQU -1 +EMOTE_FROM_MEM EQU -1 ; fruittree arguments ; FruitTreeItems indexes (see data/items/fruit_trees.asm) diff --git a/constants/wram_constants.asm b/constants/wram_constants.asm index abdef53e9..1c8ff5192 100644 --- a/constants/wram_constants.asm +++ b/constants/wram_constants.asm @@ -94,6 +94,13 @@ REMOVE_BOX EQU 1 DAY_CARE_WITHDRAW EQU 2 DAY_CARE_DEPOSIT EQU 3 +; wPlayerStepFlags:: ; d150 + const_def 4 + const PLAYERSTEP_MIDAIR_F ; 4 + const PLAYERSTEP_CONTINUE_F ; 5 + const PLAYERSTEP_STOP_F ; 6 + const PLAYERSTEP_START_F ; 7 + ; wInitListType:: ; d263 INIT_ENEMYOT_LIST EQU 1 INIT_BAG_ITEM_LIST EQU 2 @@ -126,14 +133,27 @@ PLAYERSPRITESETUP_RESET_ACTION_F EQU 7 ; wPlayerGender:: ; d472 PLAYERGENDER_FEMALE_F EQU 0 +; wMapStatus:: ; d432 + const_def + const MAPSTATUS_START ; 0 + const MAPSTATUS_ENTER ; 1 + const MAPSTATUS_HANDLE ; 2 + const MAPSTATUS_DONE ; 3 + +; wMapEventStatus:: ; d433 + const_def + const MAPEVENTS_ON ; 0 + const MAPEVENTS_OFF ; 1 + ; wScriptFlags:: ; d434 SCRIPT_RUNNING EQU 2 ; wScriptMode:: ; d437 -SCRIPT_OFF EQU 0 -SCRIPT_READ EQU 1 -SCRIPT_WAIT_MOVEMENT EQU 2 -SCRIPT_WAIT EQU 3 + const_def + const SCRIPT_OFF + const SCRIPT_READ + const SCRIPT_WAIT_MOVEMENT + const SCRIPT_WAIT ; wSpawnAfterChampion:: ; d4b5 SPAWN_LANCE EQU 1 diff --git a/docs/bugs_and_glitches.md b/docs/bugs_and_glitches.md index b74554823..0ee038a03 100644 --- a/docs/bugs_and_glitches.md +++ b/docs/bugs_and_glitches.md @@ -41,6 +41,7 @@ Fixes are written in the `diff` format. If you've used Git before, this should l - [Love Ball boosts catch rate for the wrong gender](#love-ball-boosts-catch-rate-for-the-wrong-gender) - [Fast Ball only boosts catch rate for three Pokémon](#fast-ball-only-boosts-catch-rate-for-three-pokémon) - [Dragon Scale, not Dragon Fang, boosts Dragon-type moves](#dragon-scale-not-dragon-fang-boosts-dragon-type-moves) +- [Clair can give TM24 Dragonbreath twice](#clair-can-give-tm24-dragonbreath-twice) - [Daisy's grooming doesn't always increase happiness](#daisys-grooming-doesnt-always-increase-happiness) - [Magikarp in Lake of Rage are shorter, not longer](#magikarp-in-lake-of-rage-are-shorter-not-longer) - [Magikarp length limits have a unit conversion error](#magikarp-length-limits-have-a-unit-conversion-error) @@ -90,8 +91,7 @@ Fixes are written in the `diff` format. If you've used Git before, this should l + ret nc + +.cap -+ ld h, HIGH(MAX_STAT_VALUE) -+ ld l, LOW(MAX_STAT_VALUE) ++ ld hl, MAX_STAT_VALUE ret ``` @@ -128,8 +128,7 @@ Fixes are written in the `diff` format. If you've used Git before, this should l + ret nc + +.cap -+ ld b, HIGH(MAX_STAT_VALUE) -+ ld c, LOW(MAX_STAT_VALUE) ++ ld bc, MAX_STAT_VALUE ret ``` @@ -782,6 +781,23 @@ This can bring Pokémon straight from level 1 to 100 by gaining just a few exper ``` +## Clair can give TM24 Dragonbreath twice + +([Video](https://www.youtube.com/watch?v=8BvBjqxmyOk)) + +**Fix:** Edit `DragonsDen1F_MapScripts` in [maps/DragonsDen1F.asm](/maps/DragonsDen1F.asm): + +```diff +- db 0 ; callbacks ++ db 1 ; callbacks ++ callback MAPCALLBACK_NEWMAP, .UnsetClairScene ++ ++.UnsetClairScene: ++ setmapscene DRAGONS_DEN_B1F, SCENE_DRAGONSDENB1F_NOTHING ++ end +``` + + ## Daisy's grooming doesn't always increase happiness This is a bug with `HaircutOrGrooming` in [engine/events/haircut.asm](/engine/events/haircut.asm): diff --git a/engine/overworld/events.asm b/engine/overworld/events.asm index e9fcc108c..ec81f1c27 100644 --- a/engine/overworld/events.asm +++ b/engine/overworld/events.asm @@ -4,19 +4,20 @@ INCLUDE "constants.asm" SECTION "Events", ROMX OverworldLoop:: - xor a + xor a ; MAPSTATUS_START ld [wMapStatus], a .loop ld a, [wMapStatus] ld hl, .jumps rst JumpTable ld a, [wMapStatus] - cp 3 ; done + cp MAPSTATUS_DONE jr nz, .loop .done ret .jumps +; entries correspond to MAPSTATUS_* constants dw StartMap dw EnterMap dw HandleMap @@ -130,7 +131,7 @@ EnterMap: xor a ; end map entry ldh [hMapEntryMethod], a - ld a, 2 ; HandleMap + ld a, MAPSTATUS_HANDLE ld [wMapStatus], a ret @@ -147,7 +148,7 @@ HandleMap: ; Not immediately entering a connected map will cause problems. ld a, [wMapStatus] - cp 2 ; HandleMap + cp MAPSTATUS_HANDLE ret nz call HandleMapObjects @@ -163,6 +164,7 @@ MapEvents: ret .jumps +; entries correspond to MAPEVENTS_* constants dw .events dw .no_events @@ -193,7 +195,7 @@ NextOverworldFrame: HandleMapTimeAndJoypad: ld a, [wMapEventStatus] - cp 1 ; no events + cp MAPEVENTS_OFF ret z call UpdateTime @@ -215,26 +217,26 @@ HandleMapBackground: CheckPlayerState: ld a, [wPlayerStepFlags] - bit 5, a ; in the middle of step + bit PLAYERSTEP_CONTINUE_F, a jr z, .events - bit 6, a ; stopping step + bit PLAYERSTEP_STOP_F, a jr z, .noevents - bit 4, a ; in midair + bit PLAYERSTEP_MIDAIR_F, a jr nz, .noevents call EnableEvents .events - ld a, 0 ; events + ld a, MAPEVENTS_ON ld [wMapEventStatus], a ret .noevents - ld a, 1 ; no events + ld a, MAPEVENTS_OFF ld [wMapEventStatus], a ret _CheckObjectEnteringVisibleRange: ld hl, wPlayerStepFlags - bit 6, [hl] + bit PLAYERSTEP_STOP_F, [hl] ret z farcall CheckObjectEnteringVisibleRange ret diff --git a/engine/overworld/map_objects.asm b/engine/overworld/map_objects.asm index 02b9cbdda..26152625d 100644 --- a/engine/overworld/map_objects.asm +++ b/engine/overworld/map_objects.asm @@ -36,7 +36,7 @@ Function437b: .CheckObjectStillVisible: ld hl, OBJECT_FLAGS2 add hl, bc - res 6, [hl] + res OBJ_FLAGS2_6, [hl] ld a, [wXCoord] ld e, a ld hl, OBJECT_NEXT_MAP_X @@ -62,7 +62,7 @@ Function437b: .ok ld hl, OBJECT_FLAGS2 add hl, bc - set 6, [hl] + set OBJ_FLAGS2_6, [hl] ld a, [wXCoord] ld e, a ld hl, OBJECT_INIT_X @@ -99,7 +99,7 @@ Function437b: .yes2 ld hl, OBJECT_FLAGS2 add hl, bc - set 6, [hl] + set OBJ_FLAGS2_6, [hl] and a ret @@ -111,7 +111,7 @@ Function437b: jr z, .zero ld hl, OBJECT_FLAGS2 add hl, bc - bit 5, [hl] + bit OBJ_FLAGS2_5, [hl] jr nz, .bit5 cp STEP_TYPE_SLEEP jr z, .one @@ -121,7 +121,7 @@ Function437b: call ObjectMovementReset ld hl, OBJECT_FLAGS2 add hl, bc - bit 5, [hl] + bit OBJ_FLAGS2_5, [hl] jr nz, .bit5 .one call MapObjectMovementPattern @@ -147,9 +147,9 @@ Function437b: jr nz, SetFacingStanding ld hl, OBJECT_FLAGS2 add hl, bc - bit 6, [hl] + bit OBJ_FLAGS2_6, [hl] jr nz, SetFacingStanding - bit 5, [hl] + bit OBJ_FLAGS2_5, [hl] jr nz, asm_4448 ld de, ObjectActionPairPointers ; use first column jr _HandleObjectAction @@ -399,7 +399,7 @@ UpdatePlayerStep: add e ld [wPlayerStepVectorY], a ld hl, wPlayerStepFlags - set 5, [hl] + set PLAYERSTEP_CONTINUE_F, [hl] ret Unreferenced_Function4759: @@ -657,8 +657,8 @@ MapObjectMovementPattern: jr z, .on_pit ld hl, OBJECT_FLAGS2 add hl, bc - bit 2, [hl] - res 2, [hl] + bit OBJ_FLAGS2_2, [hl] + res OBJ_FLAGS2_2, [hl] jr z, .ok ld hl, OBJECT_RANGE add hl, bc @@ -1124,7 +1124,7 @@ NPCJump: call GetNextTile ld hl, OBJECT_FLAGS2 add hl, bc - res 3, [hl] + res OVERHEAD_F, [hl] call IncrementObjectStructField1c ret @@ -1151,7 +1151,7 @@ PlayerJump: .initjump ld hl, wPlayerStepFlags - set 7, [hl] + set PLAYERSTEP_START_F, [hl] call IncrementObjectStructField1c .stepjump call UpdateJumpPosition @@ -1163,17 +1163,17 @@ PlayerJump: call CopyNextCoordsTileToStandingCoordsTile ld hl, OBJECT_FLAGS2 add hl, bc - res 3, [hl] + res OVERHEAD_F, [hl] ld hl, wPlayerStepFlags - set 6, [hl] - set 4, [hl] + set PLAYERSTEP_STOP_F, [hl] + set PLAYERSTEP_MIDAIR_F, [hl] call IncrementObjectStructField1c ret .initland call GetNextTile ld hl, wPlayerStepFlags - set 7, [hl] + set PLAYERSTEP_START_F, [hl] call IncrementObjectStructField1c .stepland call UpdateJumpPosition @@ -1183,7 +1183,7 @@ PlayerJump: dec [hl] ret nz ld hl, wPlayerStepFlags - set 6, [hl] + set PLAYERSTEP_STOP_F, [hl] call CopyNextCoordsTileToStandingCoordsTile ld hl, OBJECT_STEP_TYPE add hl, bc @@ -1229,7 +1229,7 @@ TeleportFrom: ld [hl], 16 ld hl, OBJECT_FLAGS2 add hl, bc - res 3, [hl] + res OVERHEAD_F, [hl] call IncrementObjectStructField1c .DoSpinRise: ld hl, OBJECT_ACTION @@ -1559,7 +1559,7 @@ PlayerStep: .init ld hl, wPlayerStepFlags - set 7, [hl] + set PLAYERSTEP_START_F, [hl] call IncrementObjectStructField1c .step call UpdatePlayerStep @@ -1568,7 +1568,7 @@ PlayerStep: dec [hl] ret nz ld hl, wPlayerStepFlags - set 6, [hl] + set PLAYERSTEP_STOP_F, [hl] call CopyNextCoordsTileToStandingCoordsTile ld hl, OBJECT_DIRECTION_WALKING add hl, bc @@ -1646,7 +1646,7 @@ StepType0f: pop bc ld hl, OBJECT_FLAGS2 add hl, bc - res 2, [hl] + res OBJ_FLAGS2_2, [hl] call CopyNextCoordsTileToStandingCoordsTile ld hl, OBJECT_DIRECTION_WALKING add hl, bc @@ -2408,7 +2408,7 @@ HandleNPCStep:: ld [wPlayerStepVectorX], a ld [wPlayerStepVectorY], a ld [wPlayerStepFlags], a - ld a, -1 + ld a, STANDING ld [wPlayerStepDirection], a ret @@ -2558,7 +2558,7 @@ SetFlagsForMovement_1:: pop bc ld hl, OBJECT_FLAGS2 add hl, bc - res 5, [hl] + res OBJ_FLAGS2_5, [hl] xor a ret @@ -2567,7 +2567,7 @@ Function586e: ret c ld hl, OBJECT_FLAGS2 add hl, bc - set 5, [hl] + set OBJ_FLAGS2_5, [hl] xor a ret @@ -2580,7 +2580,7 @@ Function587a: jr z, .next ld hl, OBJECT_FLAGS2 add hl, bc - set 5, [hl] + set OBJ_FLAGS2_5, [hl] .next ld hl, OBJECT_STRUCT_LENGTH add hl, bc @@ -2610,7 +2610,7 @@ _SetFlagsForMovement_2:: call GetObjectStruct ld hl, OBJECT_FLAGS2 add hl, bc - res 5, [hl] + res OBJ_FLAGS2_5, [hl] ret Function58b9:: @@ -2623,7 +2623,7 @@ Function58b9:: jr z, .next ld hl, OBJECT_FLAGS2 add hl, bc - res 5, [hl] + res OBJ_FLAGS2_5, [hl] .next ld hl, OBJECT_STRUCT_LENGTH add hl, bc @@ -2641,7 +2641,7 @@ Function58d8: ret c ld hl, OBJECT_FLAGS2 add hl, bc - res 5, [hl] + res OBJ_FLAGS2_5, [hl] ret Function58e3: @@ -2865,7 +2865,7 @@ InitSprites: ld hl, OBJECT_FLAGS2 add hl, bc ld e, [hl] - bit 7, e + bit OBJ_FLAGS2_7, e jr z, .skip2 or PRIORITY .skip2 diff --git a/engine/overworld/player_step.asm b/engine/overworld/player_step.asm index 797c4b12a..eb1e88cf4 100644 --- a/engine/overworld/player_step.asm +++ b/engine/overworld/player_step.asm @@ -2,11 +2,11 @@ _HandlePlayerStep:: ld a, [wPlayerStepFlags] and a ret z - bit 7, a ; starting step + bit PLAYERSTEP_START_F, a jr nz, .update_overworld_map - bit 6, a ; finishing step + bit PLAYERSTEP_STOP_F, a jr nz, .update_player_coords - bit 5, a ; ongoing step + bit PLAYERSTEP_CONTINUE_F, a jr nz, .finish ret diff --git a/engine/overworld/scripting.asm b/engine/overworld/scripting.asm index d1f4ceecf..f500d3c0e 100644 --- a/engine/overworld/scripting.asm +++ b/engine/overworld/scripting.asm @@ -511,7 +511,7 @@ Script_verbosegiveitem: call Script_giveitem call CurItemName ld de, wStringBuffer1 - ld a, 1 + ld a, MEM_BUFFER_1 call CopyConvertedText ld b, BANK(GiveItemScript) ld de, GiveItemScript @@ -544,7 +544,7 @@ Script_verbosegiveitem2: ; parameters: item, var call GetScriptByte - cp -1 + cp ITEM_FROM_MEM jr nz, .ok ld a, [wScriptVar] .ok @@ -562,7 +562,7 @@ Script_verbosegiveitem2: ld [wScriptVar], a call CurItemName ld de, wStringBuffer1 - ld a, 1 + ld a, MEM_BUFFER_1 call CopyConvertedText ld b, BANK(GiveItemScript) ld de, GiveItemScript @@ -1222,7 +1222,7 @@ Script_loademote: ; parameters: bubble call GetScriptByte - cp -1 + cp EMOTE_FROM_MEM jr nz, .not_var_emote ld a, [wScriptVar] .not_var_emote @@ -1249,7 +1249,7 @@ Script_showemote: jp ScriptCall ShowEmoteScript: - loademote EMOTE_MEM + loademote EMOTE_FROM_MEM applymovement2 .Show pause 0 applymovement2 .Hide @@ -1399,7 +1399,7 @@ Script_reloadmap: ld [wBattleScriptFlags], a ld a, MAPSETUP_RELOADMAP ldh [hMapEntryMethod], a - ld a, $1 + ld a, MAPSTATUS_ENTER call LoadMapStatus call StopScript ret @@ -2473,11 +2473,11 @@ Script_warp: ld [wXCoord], a call GetScriptByte ld [wYCoord], a - ld a, -1 + ld a, SPAWN_N_A ld [wDefaultSpawnpoint], a ld a, MAPSETUP_WARP ldh [hMapEntryMethod], a - ld a, 1 + ld a, MAPSTATUS_ENTER call LoadMapStatus call StopScript ret @@ -2486,11 +2486,11 @@ Script_warp: call GetScriptByte call GetScriptByte call GetScriptByte - ld a, -1 + ld a, SPAWN_N_A ld [wDefaultSpawnpoint], a ld a, MAPSETUP_BADWARP ldh [hMapEntryMethod], a - ld a, 1 + ld a, MAPSTATUS_ENTER call LoadMapStatus call StopScript ret @@ -2520,7 +2520,7 @@ Script_blackoutmod: Script_dontrestartmapmusic: ; script command 0x83 - ld a, 1 + ld a, TRUE ld [wDontPlayMapMusicOnReload], a ret @@ -2547,7 +2547,7 @@ Script_delcmdqueue: ld b, a farcall DelCmdQueue ; no need to farcall ret c - ld a, 1 + ld a, TRUE ld [wScriptVar], a ret @@ -2611,7 +2611,7 @@ Script_newloadmap: call GetScriptByte ldh [hMapEntryMethod], a - ld a, 1 + ld a, MAPSTATUS_ENTER call LoadMapStatus call StopScript ret @@ -2793,7 +2793,7 @@ Script_credits: farcall RedCredits ReturnFromCredits: call Script_endall - ld a, $3 + ld a, MAPSTATUS_DONE call LoadMapStatus call StopScript ret diff --git a/engine/tilesets/tileset_anims.asm b/engine/tilesets/tileset_anims.asm index 5553eec10..d596849d2 100644 --- a/engine/tilesets/tileset_anims.asm +++ b/engine/tilesets/tileset_anims.asm @@ -633,13 +633,13 @@ AnimateFlowerTile: ; Alternate tile graphic every other frame ld a, [wTileAnimationTimer] and %10 - ld e, a ; CGB has different color mappings for flowers. + ld e, a ldh a, [hCGB] and 1 - add e + swap a ld e, a ld d, 0 diff --git a/home/map.asm b/home/map.asm index bb88bebe6..5cd658727 100644 --- a/home/map.asm +++ b/home/map.asm @@ -102,8 +102,8 @@ LoadMapPart:: ld a, [wTilesetBlocksBank] rst Bankswitch - call LoadMetatiles + ld a, "■" hlcoord 0, 0 ld bc, SCREEN_WIDTH * SCREEN_HEIGHT @@ -1967,7 +1967,9 @@ wTempMon:: party_struct wTempMon ; d10e wSpriteFlags:: db ; d13e -wHandlePlayerStep:: dw ; d13f +wHandlePlayerStep:: db ; d13f + + ds 1 wPartyMenuActionText:: db ; d141 @@ -1993,14 +1995,8 @@ wPlayerBGMapOffsetY:: db ; used in FollowNotExact; unit is pixels ; Player movement wPlayerStepVectorX:: db ; d14e wPlayerStepVectorY:: db ; d14f -wPlayerStepFlags:: db ; d150 -wPlayerStepDirection:: ; d151 -; bit 7: Start step -; bit 6: Stop step -; bit 5: Doing step -; bit 4: In midair -; bits 0-3: unused - db +wPlayerStepFlags:: db ; d150 +wPlayerStepDirection:: db ; d151 wBGMapAnchor:: dw ; d152 @@ -2279,10 +2275,7 @@ wBattleAction:: db ; d430 wd431:: db wMapStatus:: db ; d432 -wMapEventStatus:: ; d433 -; 0: do map events -; 1: do background events - db +wMapEventStatus:: db ; d433 wScriptFlags:: ; d434 ; bit 3: priority jump |