diff options
Diffstat (limited to 'main.asm')
-rwxr-xr-x | main.asm | 176 |
1 files changed, 88 insertions, 88 deletions
@@ -24,7 +24,7 @@ ResetStatusAndHalveMoneyOnBlackout:: xor a ld [wBattleResult], a ld [wWalkBikeSurfState], a - ld [W_ISINBATTLE], a + ld [wIsInBattle], a ld [wMapPalOffset], a ld [wNPCMovementScriptFunctionNum], a ld [hJoyHeld], a @@ -86,7 +86,7 @@ LoadMonData_: ; 2: boxmon ; 3: daycaremon ; Return monster id at wcf91 and its data at wLoadedMon. -; Also load base stats at W_MONHEADER for convenience. +; Also load base stats at wMonHeader for convenience. ld a, [wDayCareMonSpecies] ld [wcf91], a @@ -161,7 +161,7 @@ PrintWaitingText: coord hl, 3, 10 ld b, $1 ld c, $b - ld a, [W_ISINBATTLE] + ld a, [wIsInBattle] and a jr z, .asm_4c17 call TextBoxBorder @@ -545,9 +545,9 @@ TestBattle: ; Don't mess around ; with obedience. ld a, %10000000 ; EARTHBADGE - ld [W_OBTAINEDBADGES], a + ld [wObtainedBadges], a - ld hl, W_FLAGS_D733 + ld hl, wFlags_D733 set BIT_TEST_BATTLE, [hl] ; Reset the party. @@ -562,16 +562,16 @@ TestBattle: ld a, RHYDON ld [wcf91], a ld a, 20 - ld [W_CURENEMYLVL], a + ld [wCurEnemyLVL], a xor a ld [wMonDataLocation], a - ld [W_CURMAP], a + ld [wCurMap], a call AddPartyMon ; Fight against a ; level 20 Rhydon. ld a, RHYDON - ld [W_CUROPPONENT], a + ld [wCurOpponent], a predef InitOpponent @@ -655,7 +655,7 @@ LoadSpecialWarpData: ; 62ff (1:62ff) jr nz, .notFirstMap ld hl, FirstMapSpec .copyWarpData - ld de, W_CURMAP + ld de, wCurMap ld c, $7 .copyWarpDataLoop ld a, [hli] @@ -664,7 +664,7 @@ LoadSpecialWarpData: ; 62ff (1:62ff) dec c jr nz, .copyWarpDataLoop ld a, [hli] - ld [W_CURMAPTILESET], a + ld [wCurMapTileset], a xor a jr .done .notFirstMap @@ -683,7 +683,7 @@ LoadSpecialWarpData: ; 62ff (1:62ff) res 4, [hl] ld a, [wDungeonWarpDestinationMap] ld b, a - ld [W_CURMAP], a + ld [wCurMap], a ld a, [wWhichDungeonWarp] ld c, a ld hl, DungeonWarpList @@ -713,7 +713,7 @@ LoadSpecialWarpData: ; 62ff (1:62ff) ld a, [wDestinationMap] .usedFlyWarp ld b, a - ld [W_CURMAP], a + ld [wCurMap], a ld hl, FlyWarpDataPtr .flyWarpDataPtrLoop ld a, [hli] @@ -737,7 +737,7 @@ LoadSpecialWarpData: ; 62ff (1:62ff) dec c jr nz, .copyWarpDataLoop2 xor a ; OVERWORLD - ld [W_CURMAPTILESET], a + ld [wCurMapTileset], a .done ld [wYOffsetSinceLastSpecialWarp], a ld [wXOffsetSinceLastSpecialWarp], a @@ -765,7 +765,7 @@ SetIshiharaTeam: ; 64ca (1:64ca) ld [wcf91], a inc de ld a, [de] - ld [W_CURENEMYLVL], a + ld [wCurEnemyLVL], a inc de call AddPartyMon jr .loop @@ -966,7 +966,7 @@ SetLastBlackoutMap: push hl ld hl, SafariZoneRestHouses - ld a, [W_CURMAP] + ld a, [wCurMap] ld b, a .loop ld a, [hli] @@ -1931,7 +1931,7 @@ _RemovePokemon: ; 7b68 (1:7b68) ld a, [wRemoveMonFromBox] and a jr z, .asm_7b74 - ld hl, W_NUMINBOX + ld hl, wNumInBox .asm_7b74 ld a, [hl] dec a @@ -2058,7 +2058,7 @@ ClearVariablesAfterLoadingMapData: ; c335 (3:4335) xor a ld [H_AUTOBGTRANSFERENABLED], a ld [wStepCounter], a - ld [W_LONEATTACKNO], a + ld [wLoneAttackNo], a ld [hJoyPressed], a ld [hJoyReleased], a ld [hJoyHeld], a @@ -2080,11 +2080,11 @@ IsPlayerStandingOnWarp: ; c35f (3:435f) ld c, a ld hl, wWarpEntries .loop - ld a, [W_YCOORD] + ld a, [wYCoord] cp [hl] jr nz, .nextWarp1 inc hl - ld a, [W_XCOORD] + ld a, [wXCoord] cp [hl] jr nz, .nextWarp2 inc hl @@ -2110,11 +2110,11 @@ CheckForceBikeOrSurf: ; c38b (3:438b) bit 5, [hl] ret nz ld hl, ForcedBikeOrSurfMaps - ld a, [W_YCOORD] + ld a, [wYCoord] ld b, a - ld a, [W_XCOORD] + ld a, [wXCoord] ld c, a - ld a, [W_CURMAP] + ld a, [wCurMap] ld d, a .loop ld a, [hli] @@ -2128,15 +2128,15 @@ CheckForceBikeOrSurf: ; c38b (3:438b) ld a, [hli] cp c ;compare x-coord jr nz, .loop ; incorrect x-coord, check next item - ld a, [W_CURMAP] + ld a, [wCurMap] cp SEAFOAM_ISLANDS_4 ld a, $2 - ld [W_SEAFOAMISLANDS4CURSCRIPT], a + ld [wSeafoamIslands4CurScript], a jr z, .forceSurfing - ld a, [W_CURMAP] + ld a, [wCurMap] cp SEAFOAM_ISLANDS_5 ld a, $2 - ld [W_SEAFOAMISLANDS5CURSCRIPT], a + ld [wSeafoamIslands5CurScript], a jr z, .forceSurfing ;force bike riding ld hl, wd732 @@ -2171,9 +2171,9 @@ IsPlayerFacingEdgeOfMap: ; c3ff (3:43ff) ld a, [hli] ld h, [hl] ld l, a - ld a, [W_YCOORD] + ld a, [wYCoord] ld b, a - ld a, [W_XCOORD] + ld a, [wXCoord] ld c, a ld de, .asm_c41e push de @@ -2191,7 +2191,7 @@ IsPlayerFacingEdgeOfMap: ; c3ff (3:43ff) dw .facingRight .facingDown - ld a, [W_CURMAPHEIGHT] + ld a, [wCurMapHeight] add a dec a cp b @@ -2211,7 +2211,7 @@ IsPlayerFacingEdgeOfMap: ; c3ff (3:43ff) jr .resetCarry .facingRight - ld a, [W_CURMAPWIDTH] + ld a, [wCurMapWidth] add a dec a cp c @@ -2229,7 +2229,7 @@ IsWarpTileInFrontOfPlayer: ; c44e (3:444e) push de push bc call _GetTileAndCoordsInFrontOfPlayer - ld a, [W_CURMAP] + ld a, [wCurMap] cp SS_ANNE_5 jr z, .ssAnne5 ld a, [wSpriteStateData1 + 9] ; player sprite's facing direction @@ -2284,7 +2284,7 @@ IsPlayerStandingOnDoorTileOrWarpTile: ; c49d (3:449d) push bc callba IsPlayerStandingOnDoorTile jr c, .done - ld a, [W_CURMAPTILESET] + ld a, [wCurMapTileset] add a ld c, a ld b, $0 @@ -2308,7 +2308,7 @@ IsPlayerStandingOnDoorTileOrWarpTile: ; c49d (3:449d) INCLUDE "data/warp_tile_ids.asm" PrintSafariZoneSteps: ; c52f (3:452f) - ld a, [W_CURMAP] + ld a, [wCurMap] cp SAFARI_ZONE_EAST ret c cp UNKNOWN_DUNGEON_2 @@ -2327,7 +2327,7 @@ PrintSafariZoneSteps: ; c52f (3:452f) coord hl, 1, 3 ld de, SafariBallText call PlaceString - ld a, [W_NUMSAFARIBALLS] + ld a, [wNumSafariBalls] cp 10 jr nc, .asm_c56d coord hl, 5, 3 @@ -2335,7 +2335,7 @@ PrintSafariZoneSteps: ; c52f (3:452f) ld [hl], a .asm_c56d coord hl, 6, 3 - ld de, W_NUMSAFARIBALLS + ld de, wNumSafariBalls lb bc, 1, 2 jp PrintNumber @@ -2349,9 +2349,9 @@ GetTileAndCoordsInFrontOfPlayer: ; c586 (3:4586) call GetPredefRegisters _GetTileAndCoordsInFrontOfPlayer: ; c589 (3:4589) - ld a, [W_YCOORD] + ld a, [wYCoord] ld d, a - ld a, [W_XCOORD] + ld a, [wXCoord] ld e, a ld a, [wSpriteStateData1 + 9] ; player's sprite facing direction and a ; cp SPRITE_FACING_DOWN @@ -2388,7 +2388,7 @@ _GetTileAndCoordsInFrontOfPlayer: ; c589 (3:4589) GetTileTwoStepsInFrontOfPlayer: ; c5be (3:45be) xor a ld [$ffdb], a - ld hl, W_YCOORD + ld hl, wYCoord ld a, [hli] ld d, a ld e, [hl] @@ -2435,7 +2435,7 @@ GetTileTwoStepsInFrontOfPlayer: ; c5be (3:45be) CheckForCollisionWhenPushingBoulder: ; c60b (3:460b) call GetTileTwoStepsInFrontOfPlayer - ld hl, W_TILESETCOLLISIONPTR + ld hl, wTileSetCollisionPtr ld a, [hli] ld h, [hl] ld l, a @@ -2471,7 +2471,7 @@ CheckForBoulderCollisionWithSprites: ; c636 (3:4636) ld [$ffdc], a ld a, [hl] ; map X position ld [$ffdd], a - ld a, [W_NUMSPRITES] + ld a, [wNumSprites] ld c, a ld de, $f ld hl, wSpriteStateData2 + $14 @@ -2653,7 +2653,7 @@ LoadTilesetHeader: ; c754 (3:4754) call GetPredefRegisters push hl ld d, 0 - ld a, [W_CURMAPTILESET] + ld a, [wCurMapTileset] add a add a ld b, a @@ -2665,7 +2665,7 @@ LoadTilesetHeader: ; c754 (3:4754) ld e, a ld hl, Tilesets add hl, de - ld de, W_TILESETBANK + ld de, wTileSetBank ld c, $b .copyTilesetHeaderLoop ld a, [hli] @@ -2678,7 +2678,7 @@ LoadTilesetHeader: ; c754 (3:4754) xor a ld [$ffd8], a pop hl - ld a, [W_CURMAPTILESET] + ld a, [wCurMapTileset] push hl push de ld hl, DungeonTilesets @@ -2687,7 +2687,7 @@ LoadTilesetHeader: ; c754 (3:4754) pop de pop hl jr c, .asm_c797 - ld a, [W_CURMAPTILESET] + ld a, [wCurMapTileset] ld b, a ld a, [hPreviousTileset] cp b @@ -2697,12 +2697,12 @@ LoadTilesetHeader: ; c754 (3:4754) cp $ff jr z, .done call LoadDestinationWarpPosition - ld a, [W_YCOORD] + ld a, [wYCoord] and $1 - ld [W_YBLOCKCOORD], a - ld a, [W_XCOORD] + ld [wYBlockCoord], a + ld a, [wXCoord] and $1 - ld [W_XBLOCKCOORD], a + ld [wXBlockCoord], a .done ret @@ -2711,7 +2711,7 @@ INCLUDE "data/dungeon_tilesets.asm" INCLUDE "data/tileset_headers.asm" IncrementDayCareMonExp: ; c8de (3:48de) - ld a, [W_DAYCARE_IN_USE] + ld a, [wDayCareInUse] and a ret z ld hl, wDayCareMonExp + 2 @@ -2760,7 +2760,7 @@ IsSurfingAllowed: ; cdc0 (3:4dc0) ld a, [wd732] bit 5, a jr nz, .forcedToRideBike - ld a, [W_CURMAP] + ld a, [wCurMap] cp SEAFOAM_ISLANDS_5 ret nz CheckBothEventsSet EVENT_SEAFOAM4_BOULDER1_DOWN_HOLE, EVENT_SEAFOAM4_BOULDER2_DOWN_HOLE @@ -2944,7 +2944,7 @@ RemoveItemFromInventory_: ; ce74 (3:4e74) LoadWildData: ; ceb8 (3:4eb8) ld hl,WildDataPointers - ld a,[W_CURMAP] + ld a,[wCurMap] ; get wild data for current map ld c,a @@ -2955,11 +2955,11 @@ LoadWildData: ; ceb8 (3:4eb8) ld h,[hl] ld l,a ; hl now points to wild data for current map ld a,[hli] - ld [W_GRASSRATE],a + ld [wGrassRate],a and a jr z,.NoGrassData ; if no grass data, skip to surfing data push hl - ld de,W_GRASSMONS ; otherwise, load grass data + ld de,wGrassMons ; otherwise, load grass data ld bc,$0014 call CopyData pop hl @@ -3000,7 +3000,7 @@ DrawBadges: ; ea03 (3:6a03) ; Alter these based on owned badges. ld de, wTempObtainedBadgesBooleans ld hl, wBadgeOrFaceTiles - ld a, [W_OBTAINEDBADGES] + ld a, [wObtainedBadges] ld b, a ld c, 8 .CheckBadge @@ -3106,7 +3106,7 @@ GymLeaderFaceAndBadgeTileGraphics: ; ea9e (3:6a9e) ReplaceTileBlock: ; ee9e (3:6e9e) call GetPredefRegisters ld hl, wOverworldMap - ld a, [W_CURMAPWIDTH] + ld a, [wCurMapWidth] add $6 ld e, a ld d, $0 @@ -3148,7 +3148,7 @@ ReplaceTileBlock: ; ee9e (3:6e9e) ret c ; return if the replaced tile block is above the map view in memory RedrawMapView: ; eedc (3:6edc) - ld a, [W_ISINBATTLE] + ld a, [wIsInBattle] inc a ret z ld a, [H_AUTOBGTRANSFERENABLED] @@ -3229,16 +3229,16 @@ CompareHLWithBC: ; ef4e (3:6f4e) INCLUDE "engine/overworld/cut.asm" MarkTownVisitedAndLoadMissableObjects: ; f113 (3:7113) - ld a, [W_CURMAP] + ld a, [wCurMap] cp ROUTE_1 jr nc, .notInTown ld c, a ld b, FLAG_SET - ld hl, W_TOWNVISITEDFLAG ; mark town as visited (for flying) + ld hl, wTownVisitedFlag ; mark town as visited (for flying) predef FlagActionPredef .notInTown ld hl, MapHSPointers - ld a, [W_CURMAP] + ld a, [wCurMap] ld b, $0 ld c, a add hl, bc @@ -3271,11 +3271,11 @@ LoadMissableObjects: ; f132 (3:7132) ld [H_DIVISOR], a ld b, $2 call Divide ; divide difference by 3, resulting in the global offset (number of missable items before ours) - ld a, [W_CURMAP] + ld a, [wCurMap] ld b, a ld a, [H_DIVIDEND+3] ld c, a ; store global offset in c - ld de, W_MISSABLEOBJECTLIST + ld de, wMissableObjectList pop hl .writeMissableObjectsListLoop ld a, [hli] @@ -3298,8 +3298,8 @@ LoadMissableObjects: ; f132 (3:7132) ret InitializeMissableObjectsFlags: ; f175 (3:7175) - ld hl, W_MISSABLEOBJECTFLAGS - ld bc, wMissableObjectFlagsEnd - W_MISSABLEOBJECTFLAGS + ld hl, wMissableObjectFlags + ld bc, wMissableObjectFlagsEnd - wMissableObjectFlags xor a call FillMemory ; clear missable objects flags ld hl, MapHS00 @@ -3314,7 +3314,7 @@ InitializeMissableObjectsFlags: ; f175 (3:7175) ld a, [hl] cp Hide jr nz, .skip - ld hl, W_MISSABLEOBJECTFLAGS + ld hl, wMissableObjectFlags ld a, [wMissableObjectCounter] ld c, a ld b, FLAG_SET @@ -3332,7 +3332,7 @@ IsObjectHidden: ; f1a6 (3:71a6) ld a, [H_CURRENTSPRITEOFFSET] swap a ld b, a - ld hl, W_MISSABLEOBJECTLIST + ld hl, wMissableObjectList .loop ld a, [hli] cp $ff @@ -3342,7 +3342,7 @@ IsObjectHidden: ; f1a6 (3:71a6) jr nz, .loop ld c, a ld b, FLAG_TEST - ld hl, W_MISSABLEOBJECTFLAGS + ld hl, wMissableObjectFlags call MissableObjectFlagAction ld a, c and a @@ -3357,7 +3357,7 @@ IsObjectHidden: ; f1a6 (3:71a6) ; [wMissableObjectIndex]: index of the missable object to be added (global index) ShowObject: ; f1c8 (3:71c8) ShowObject2: - ld hl, W_MISSABLEOBJECTFLAGS + ld hl, wMissableObjectFlags ld a, [wMissableObjectIndex] ld c, a ld b, FLAG_RESET @@ -3367,7 +3367,7 @@ ShowObject2: ; removes missable object (items, leg. pokemon, etc.) from the map ; [wMissableObjectIndex]: index of the missable object to be removed (global index) HideObject: ; f1d7 (3:71d7) - ld hl, W_MISSABLEOBJECTFLAGS + ld hl, wMissableObjectFlags ld a, [wMissableObjectIndex] ld c, a ld b, FLAG_SET @@ -3619,7 +3619,7 @@ _AddPartyMon: ; f2e5 (3:72e5) ld a, [wcf91] ld [wd0b5], a call GetMonHeader - ld hl, W_MONHEADER + ld hl, wMonHeader ld a, [hli] ld [de], a ; species inc de @@ -3658,7 +3658,7 @@ _AddPartyMon: ; f2e5 (3:72e5) pop hl push hl - ld a, [W_ISINBATTLE] + ld a, [wIsInBattle] and a ; is this a wild mon caught in battle? jr nz, .copyEnemyMonData @@ -3713,7 +3713,7 @@ _AddPartyMon: ; f2e5 (3:72e5) ld [de], a inc de .copyMonTypesAndMoves - ld hl, W_MONHTYPES + ld hl, wMonHTypes ld a, [hli] ; type 1 ld [de], a inc de @@ -3722,7 +3722,7 @@ _AddPartyMon: ; f2e5 (3:72e5) inc de ld a, [hli] ; catch rate (held item in gen 2) ld [de], a - ld hl, W_MONHMOVES + ld hl, wMonHMoves ld a, [hli] inc de push de @@ -3751,7 +3751,7 @@ _AddPartyMon: ; f2e5 (3:72e5) inc de ld [de], a push de - ld a, [W_CURENEMYLVL] + ld a, [wCurEnemyLVL] ld d, a callab CalcExperience pop de @@ -3776,10 +3776,10 @@ _AddPartyMon: ; f2e5 (3:72e5) pop hl call AddPartyMon_WriteMovePP inc de - ld a, [W_CURENEMYLVL] + ld a, [wCurEnemyLVL] ld [de], a inc de - ld a, [W_ISINBATTLE] + ld a, [wIsInBattle] dec a jr nz, .calcFreshStats ld hl, wEnemyMonMaxHP @@ -3899,7 +3899,7 @@ _MoveMon: ; f51e (3:751e) cp PARTY_TO_DAYCARE ld hl, wDayCareMon jr z, .asm_f575 - ld hl, W_NUMINBOX + ld hl, wNumInBox ld a, [hl] cp MONS_PER_BOX jr nz, .partyOrBoxNotFull @@ -3934,7 +3934,7 @@ _MoveMon: ; f51e (3:751e) jr nz, .skipToNewMonEntry ld hl, wBoxMons ld bc, wBoxMon2 - wBoxMon1 ; $21 - ld a, [W_NUMINBOX] + ld a, [wNumInBox] .skipToNewMonEntry dec a call AddNTimes @@ -3977,14 +3977,14 @@ _MoveMon: ; f51e (3:751e) .asm_f5b4 ld a, [wMoveMonType] cp PARTY_TO_DAYCARE - ld de, W_DAYCAREMONOT + ld de, wDayCareMonOT jr z, .asm_f5d3 dec a ld hl, wPartyMonOT ld a, [wPartyCount] jr nz, .asm_f5cd ld hl, wBoxMonOT - ld a, [W_NUMINBOX] + ld a, [wNumInBox] .asm_f5cd dec a call SkipFixedLengthTextEntries @@ -3995,7 +3995,7 @@ _MoveMon: ; f51e (3:751e) ld a, [wMoveMonType] and a jr z, .asm_f5e6 - ld hl, W_DAYCAREMONOT + ld hl, wDayCareMonOT cp DAYCARE_TO_PARTY jr z, .asm_f5ec ld hl, wPartyMonOT @@ -4007,14 +4007,14 @@ _MoveMon: ; f51e (3:751e) call CopyData ld a, [wMoveMonType] cp PARTY_TO_DAYCARE - ld de, W_DAYCAREMONNAME + ld de, wDayCareMonName jr z, .asm_f611 dec a ld hl, wPartyMonNicks ld a, [wPartyCount] jr nz, .asm_f60b ld hl, wBoxMonNicks - ld a, [W_NUMINBOX] + ld a, [wNumInBox] .asm_f60b dec a call SkipFixedLengthTextEntries @@ -4025,7 +4025,7 @@ _MoveMon: ; f51e (3:751e) ld a, [wMoveMonType] and a jr z, .asm_f624 - ld hl, W_DAYCAREMONNAME + ld hl, wDayCareMonName cp DAYCARE_TO_PARTY jr z, .asm_f62a ld hl, wPartyMonNicks @@ -4048,7 +4048,7 @@ _MoveMon: ; f51e (3:751e) call LoadMonData callba CalcLevelFromExperience ld a, d - ld [W_CURENEMYLVL], a + ld [wCurEnemyLVL], a pop hl ld bc, wBoxMon2 - wBoxMon1 add hl, bc @@ -4470,7 +4470,7 @@ InitPlayerData2: ld hl, wPartyCount call InitializeEmptyList - ld hl, W_NUMINBOX + ld hl, wNumInBox call InitializeEmptyList ld hl, wNumBagItems call InitializeEmptyList @@ -4488,7 +4488,7 @@ START_MONEY EQU $3000 ld [wMonDataLocation], a - ld hl, W_OBTAINEDBADGES + ld hl, wObtainedBadges ld [hli], a ld [hl], a @@ -4497,8 +4497,8 @@ START_MONEY EQU $3000 ld [hli], a ld [hl], a - ld hl, W_GAMEPROGRESSFLAGS - ld bc, wGameProgressFlagsEnd - W_GAMEPROGRESSFLAGS + ld hl, wGameProgressFlags + ld bc, wGameProgressFlagsEnd - wGameProgressFlags call FillMemory ; clear all game progress flags jp InitializeMissableObjectsFlags |