Adjust MAPSETUP_ENTERLEVEL (#4) and misc clean up

This commit is contained in:
xCrystal 2024-03-05 20:08:42 +01:00
parent ae992b01a3
commit f796199bab
16 changed files with 17 additions and 93 deletions

View File

@ -1,6 +1,6 @@
# pokecrystal-board # pokecrystal-board
pokecrystal-board is a board game engine for the GBC based on [pokecrystal](https://github.com/pret/pokecrystal). pokecrystal-board is a single-player RPG board game engine for the GBC based on [pokecrystal](https://github.com/pret/pokecrystal).
In pokecrystal-board **you will find**: In pokecrystal-board **you will find**:
- Content with new built-in features - Content with new built-in features

View File

@ -110,8 +110,6 @@ endc
; wDailyPhoneTimeOfDayFlags ; wDailyPhoneTimeOfDayFlags
; const ENGINE_JACK_MONDAY_MORNING ; const ENGINE_JACK_MONDAY_MORNING
; const ENGINE_HUEY_WEDNESDAY_NIGHT ; const ENGINE_HUEY_WEDNESDAY_NIGHT
; wPlayerSpriteSetupFlags
const ENGINE_KRIS_IN_CABLE_CLUB
; wSwarmFlags ; wSwarmFlags
const ENGINE_DUNSPARCE_SWARM const ENGINE_DUNSPARCE_SWARM
const ENGINE_YANMA_SWARM const ENGINE_YANMA_SWARM

View File

@ -11,10 +11,9 @@
const MAPSETUP_LINKRETURN ; f8 const MAPSETUP_LINKRETURN ; f8
const MAPSETUP_TRAIN ; f9 const MAPSETUP_TRAIN ; f9
const MAPSETUP_SUBMENU ; fa const MAPSETUP_SUBMENU ; fa
const MAPSETUP_BADWARP ; fb const MAPSETUP_FLY ; fb
const MAPSETUP_FLY ; fc const MAPSETUP_ENTERLEVEL ; fc
const MAPSETUP_ENTERLEVEL ; fd const MAPSETUP_EXITVIEWMAP ; fd
const MAPSETUP_EXITVIEWMAP ; fe
DEF NUM_MAPSETUP_SCRIPTS EQU const_value - $f1 DEF NUM_MAPSETUP_SCRIPTS EQU const_value - $f1
; callback types ; callback types

View File

@ -157,7 +157,6 @@ DEF DARKNESS_PALSET EQU $80
; wPlayerSpriteSetupFlags:: ; wPlayerSpriteSetupFlags::
DEF PLAYERSPRITESETUP_FACING_MASK EQU %11 DEF PLAYERSPRITESETUP_FACING_MASK EQU %11
DEF PLAYERSPRITESETUP_FEMALE_TO_MALE_F EQU 2
DEF PLAYERSPRITESETUP_CUSTOM_FACING_F EQU 5 DEF PLAYERSPRITESETUP_CUSTOM_FACING_F EQU 5
DEF PLAYERSPRITESETUP_SKIP_RELOAD_GFX_F EQU 6 DEF PLAYERSPRITESETUP_SKIP_RELOAD_GFX_F EQU 6
DEF PLAYERSPRITESETUP_RESET_ACTION_F EQU 7 DEF PLAYERSPRITESETUP_RESET_ACTION_F EQU 7

View File

@ -122,8 +122,6 @@ endc
; engine_flag wDailyPhoneTimeOfDayFlags, 0 ; jack ; engine_flag wDailyPhoneTimeOfDayFlags, 0 ; jack
; engine_flag wDailyPhoneTimeOfDayFlags, 1 ; huey ; engine_flag wDailyPhoneTimeOfDayFlags, 1 ; huey
engine_flag wPlayerSpriteSetupFlags, PLAYERSPRITESETUP_FEMALE_TO_MALE_F
engine_flag wSwarmFlags, SWARMFLAGS_DUNSPARCE_SWARM_F engine_flag wSwarmFlags, SWARMFLAGS_DUNSPARCE_SWARM_F
engine_flag wSwarmFlags, SWARMFLAGS_YANMA_SWARM_F engine_flag wSwarmFlags, SWARMFLAGS_YANMA_SWARM_F

View File

@ -11,7 +11,6 @@ MapSetupScripts:
dw MapSetupScript_LinkReturn dw MapSetupScript_LinkReturn
dw MapSetupScript_Train dw MapSetupScript_Train
dw MapSetupScript_Submenu dw MapSetupScript_Submenu
dw MapSetupScript_BadWarp
dw MapSetupScript_Fly dw MapSetupScript_Fly
dw MapSetupScript_EnterLevel dw MapSetupScript_EnterLevel
dw MapSetupScript_ExitViewMap dw MapSetupScript_ExitViewMap
@ -43,7 +42,6 @@ MapSetupScript_EnterLevel:
mapsetup SpawnInFacingDown mapsetup SpawnInFacingDown
mapsetup RefreshMapSprites mapsetup RefreshMapSprites
mapsetup PlayMapMusicBike mapsetup PlayMapMusicBike
mapsetup FadeInToMusic
mapsetup FadeInFromWhite mapsetup FadeInFromWhite
mapsetup ConstructAndEnableOverworldHUD mapsetup ConstructAndEnableOverworldHUD
mapsetup ActivateMapAnims mapsetup ActivateMapAnims
@ -85,34 +83,6 @@ MapSetupScript_Warp:
mapsetup MapCallbackAtEndMapSetup mapsetup MapCallbackAtEndMapSetup
db -1 ; end db -1 ; end
MapSetupScript_BadWarp:
mapsetup BackupMapObjects
mapsetup EnterMapSpawnPoint
mapsetup LoadMapAttributes
mapsetup HandleNewMap
mapsetup SpawnPlayer
mapsetup RefreshPlayerCoords
mapsetup GetMapScreenCoords
mapsetup LoadBlockData
mapsetup LoadDisabledSpaces
mapsetup BufferScreen
mapsetup DisableLCD
mapsetup LoadMapGraphics
mapsetup LoadMapTimeOfDay
mapsetup FadeOutMapMusic
mapsetup EnableLCD
mapsetup LoadMapObjects
mapsetup LoadMapPalettes
mapsetup SpawnInFacingDown
mapsetup RefreshMapSprites
mapsetup FadeToMapMusic
mapsetup FadeInFromWhite
mapsetup ActivateMapAnims
mapsetup LoadWildMonData
mapsetup AnchorPointAfterWarp
mapsetup MapCallbackAtEndMapSetup
db -1 ; end
MapSetupScript_Connection: MapSetupScript_Connection:
mapsetup SuspendMapAnims mapsetup SuspendMapAnims
mapsetup BackupMapObjects mapsetup BackupMapObjects

View File

@ -9,7 +9,6 @@ ChrisNameMenuHeader:
db STATICMENU_CURSOR | STATICMENU_PLACE_TITLE | STATICMENU_DISABLE_B ; flags db STATICMENU_CURSOR | STATICMENU_PLACE_TITLE | STATICMENU_DISABLE_B ; flags
db 5 ; items db 5 ; items
db "NEW NAME@" db "NEW NAME@"
MalePlayerNameArray:
db "CHRIS@" db "CHRIS@"
db "MAT@" db "MAT@"
db "ALLAN@" db "ALLAN@"
@ -28,7 +27,6 @@ KrisNameMenuHeader:
db STATICMENU_CURSOR | STATICMENU_PLACE_TITLE | STATICMENU_DISABLE_B ; flags db STATICMENU_CURSOR | STATICMENU_PLACE_TITLE | STATICMENU_DISABLE_B ; flags
db 5 ; items db 5 ; items
db "NEW NAME@" db "NEW NAME@"
FemalePlayerNameArray:
db "KRIS@" db "KRIS@"
db "AMANDA@" db "AMANDA@"
db "JUANA@" db "JUANA@"

View File

@ -2,29 +2,30 @@
- **hCurBoardEvent**: holds a *BOARDEVENT_* value. - **hCurBoardEvent**: holds a *BOARDEVENT_* value.
- **wTurnData** ~ **wTurnDataEnd**: not preserved on save, and cleared at the beginning of BoardMenuScript (i.e. on turn begin). It's part of *wMapStatus* ~ *wMapStatusEnd*, so it's also cleared by *StartMap*. Includes: - **wTurnData** ~ **wTurnDataEnd**: turn-scoped, not preserved on save, and cleared at the beginning of BoardMenuScript (i.e. on turn begin). It's part of *wMapStatus* ~ *wMapStatusEnd*, so it's also cleared by *StartMap*. Includes:
- **wDieRoll** - **wDieRoll**
- **wSpacesLeft** - **wSpacesLeft**
- Addresses within *wCurMapData* ~ *wCurMapDataEnd*: preserved on save. Initialized when entering a level (in StartMap), and updated accordingly throughout the level. Includes: - Addresses within *wCurMapData* ~ *wCurMapDataEnd*: level-scoped or turn-scoped, preserved on save. Initialized when entering a level if required (in StartMap), and updated accordingly throughout the level. Includes:
- **wCurTurn** - **wCurTurn**: initialized when entering a level (in StartMap)
- **wCurSpace** - **wCurSpace**: initialized when entering a level (in StartMap)
- **wCurLevelCoins** - **wCurLevelCoins**: initialized when entering a level (in StartMap)
- **wCurLevelExp** - **wCurLevelExp**: initialized when entering a level (in StartMap)
- **wCurSpaceStruct**: - **wCurSpaceStruct**:
- **wCurSpaceXCoord** - **wCurSpaceXCoord**
- **wCurSpaceYCoord** - **wCurSpaceYCoord**
- **wCurSpaceEffect** for non-branch spaces, or **wCurSpaceBranchStructPtr** (two bytes) for branch spaces - **wCurSpaceEffect** for non-branch spaces, or **wCurSpaceBranchStructPtr** (two bytes) for branch spaces
- **wCurSpaceNextSpace** for non-branch spaces - **wCurSpaceNextSpace** for non-branch spaces
- **wCurOverworldMiscPal**
- Addresses within *wPlayerData* ~ *wPlayerDataEnd*: preserved on save. Includes: - Addresses within *wPlayerData* ~ *wPlayerDataEnd*: game-scoped (change between levels or on level start/end, but now within), preserved on save. Includes:
- **wUnlockedLevels**: flag array that tracks progression regarding which levels have been unlocked. - **wUnlockedLevels**: flag array that tracks progression regarding which levels have been unlocked.
- **wClearedLevelsStage\<N\>**: flag array that tracks progression regarding which levels have been cleared. Each level can have up to four stages (clearable endings). - **wClearedLevelsStage\<N\>**: flag array that tracks progression regarding which levels have been cleared. Each level can have up to four stages (clearable endings).
- **wUnlockedTechniques**: flag array that tracks progression regarding which techniques have been unlocked. - **wUnlockedTechniques**: flag array that tracks progression regarding which techniques have been unlocked.
- **wCurLevel**: initialized in LevelSelectionMenu (where it is also used), and stays static during the level. - **wCurLevel**: initialized in LevelSelectionMenu (where it is also used), and stays static during the level.
- **wDefaultLevelSelectionMenuLandmark**: used to know in which landmark to place the player when entering level selection menu. - **wDefaultLevelSelectionMenuLandmark**: used to know in which landmark to place the player when entering level selection menu.
- **wCurOverworldMiscPal**
- **wLevelSelectionMenuEntryEventQueue**: which events have to be triggered the next time the player enters the level selection menu. - **wLevelSelectionMenuEntryEventQueue**: which events have to be triggered the next time the player enters the level selection menu.
- **wLastUnlockedLevelsCount**, **wLastUnlockedLevels**: temporary list of unlocked levels during post-level screen
- These addresses share memory region with string buffers from *wStringBuffer3* onwards. They are placed in memory in the following order. - These addresses share memory region with string buffers from *wStringBuffer3* onwards. They are placed in memory in the following order.
- **wTempSpaceStruct**: Temporary scope. Same structure as *wCurSpaceStruct* - **wTempSpaceStruct**: Temporary scope. Same structure as *wCurSpaceStruct*
@ -44,7 +45,7 @@
- **wDisabledSpacesBackups**: preserved on save to **sDisabledSpacesBackups**. - **wDisabledSpacesBackups**: preserved on save to **sDisabledSpacesBackups**.
- **wMapObjectsBackups**: preserved on save to **sMapObjectsBackups**. - **wMapObjectsBackups**: preserved on save to **sMapObjectsBackups**.
- **wLevelSelectionMenu\*** addresses, union under the *"Miscellaneous WRAM 1"* section. Temporary scope during level selection menu, except for *wLevelSelectionMenuEntryEventQueue*. - **wLevelSelectionMenu\*** addresses, union under the *"Miscellaneous WRAM 1"* section. Temporary scope during level selection menu (not the case for *wLevelSelectionMenuEntryEventQueue*, which is in *wPlayerData* instead, as mentioned above).
- Other WRAM 0 addresses (not preserved on save): - Other WRAM 0 addresses (not preserved on save):
- **wText2bpp** - **wText2bpp**

View File

@ -8762,9 +8762,6 @@ GetTrainerBackpic:
jr z, .Decompress jr z, .Decompress
; What gender are we? ; What gender are we?
ld a, [wPlayerSpriteSetupFlags]
bit PLAYERSPRITESETUP_FEMALE_TO_MALE_F, a
jr nz, .Chris
ld a, [wPlayerGender] ld a, [wPlayerGender]
bit PLAYERGENDER_FEMALE_F, a bit PLAYERGENDER_FEMALE_F, a
jr z, .Chris jr z, .Chris

View File

@ -503,9 +503,6 @@ GetEnemyFrontpicPalettePointer:
GetPlayerOrMonPalettePointer: GetPlayerOrMonPalettePointer:
and a and a
jp nz, GetMonNormalOrShinyPalettePointer jp nz, GetMonNormalOrShinyPalettePointer
ld a, [wPlayerSpriteSetupFlags]
bit PLAYERSPRITESETUP_FEMALE_TO_MALE_F, a
jr nz, .male
ld a, [wPlayerGender] ld a, [wPlayerGender]
and a and a
jr z, .male jr z, .male

View File

@ -71,17 +71,6 @@ ShowPlayerNamingChoices:
INCLUDE "data/player_names.asm" INCLUDE "data/player_names.asm"
GetPlayerNameArray: ; unreferenced
ld hl, wPlayerName
ld de, MalePlayerNameArray
ld a, [wPlayerGender]
bit PLAYERGENDER_FEMALE_F, a
jr z, .got_array
ld de, FemalePlayerNameArray
.got_array
call InitName
ret
GetPlayerIcon: GetPlayerIcon:
ld de, ChrisSpriteGFX ld de, ChrisSpriteGFX
ld b, BANK(ChrisSpriteGFX) ld b, BANK(ChrisSpriteGFX)

View File

@ -55,9 +55,6 @@ RefreshSprites::
GetPlayerSprite: GetPlayerSprite:
; Get Chris or Kris's sprite. ; Get Chris or Kris's sprite.
ld hl, ChrisStateSprites ld hl, ChrisStateSprites
ld a, [wPlayerSpriteSetupFlags]
bit PLAYERSPRITESETUP_FEMALE_TO_MALE_F, a
jr nz, .go
ld a, [wPlayerGender] ld a, [wPlayerGender]
bit PLAYERGENDER_FEMALE_F, a bit PLAYERGENDER_FEMALE_F, a
jr z, .go jr z, .go

View File

@ -30,9 +30,6 @@ SpawnPlayer:
ld hl, MAPOBJECT_PALETTE ld hl, MAPOBJECT_PALETTE
add hl, bc add hl, bc
ln e, PAL_NPC_RED, OBJECTTYPE_SCRIPT ln e, PAL_NPC_RED, OBJECTTYPE_SCRIPT
ld a, [wPlayerSpriteSetupFlags]
bit PLAYERSPRITESETUP_FEMALE_TO_MALE_F, a
jr nz, .ok
ld a, [wPlayerGender] ld a, [wPlayerGender]
bit PLAYERGENDER_FEMALE_F, a bit PLAYERGENDER_FEMALE_F, a
jr z, .ok jr z, .ok

View File

@ -2188,10 +2188,6 @@ Script_warpfacing:
; fallthrough ; fallthrough
Script_warp: Script_warp:
; This seems to be some sort of error handling case.
call GetScriptByte
and a
jr z, .not_ok
ld [wMapGroup], a ld [wMapGroup], a
call GetScriptByte call GetScriptByte
ld [wMapNumber], a ld [wMapNumber], a
@ -2208,19 +2204,6 @@ Script_warp:
call StopScript call StopScript
ret ret
.not_ok
call GetScriptByte
call GetScriptByte
call GetScriptByte
ld a, SPAWN_N_A
ld [wDefaultSpawnpoint], a
ld a, MAPSETUP_BADWARP
ldh [hMapEntryMethod], a
ld a, MAPSTATUS_ENTER
call LoadMapStatus
call StopScript
ret
Script_warpmod: Script_warpmod:
call GetScriptByte call GetScriptByte
ld [wBackupWarpNumber], a ld [wBackupWarpNumber], a

View File

@ -305,7 +305,7 @@ RefreshMapSprites:
call SafeUpdateSprites call SafeUpdateSprites
.skip .skip
ld a, [wPlayerSpriteSetupFlags] ld a, [wPlayerSpriteSetupFlags]
and (1 << PLAYERSPRITESETUP_FEMALE_TO_MALE_F) | (1 << 3) | (1 << 4) and (1 << 3) | (1 << 4)
ld [wPlayerSpriteSetupFlags], a ld [wPlayerSpriteSetupFlags], a
ret ret

View File

@ -2545,7 +2545,6 @@ wKurtApricornQuantity:: db
wCurLevel:: db wCurLevel:: db
wDefaultLevelSelectionMenuLandmark:: db wDefaultLevelSelectionMenuLandmark:: db
wCurOverworldMiscPal:: db
wLevelSelectionMenuEntryEventQueue:: flag_array NUM_LSM_EVENTS wLevelSelectionMenuEntryEventQueue:: flag_array NUM_LSM_EVENTS
; list of unlocked levels during post-level screen ; list of unlocked levels during post-level screen
@ -2586,6 +2585,8 @@ wCurLevelExp:: ds 3
wCurSpaceStruct:: space_struct wCurSpace wCurSpaceStruct:: space_struct wCurSpace
wCurSpaceStructEnd:: wCurSpaceStructEnd::
wCurOverworldMiscPal:: db
wCurMapDataEnd:: wCurMapDataEnd::