mirror of
https://gitlab.com/xCrystal/pokecrystal-board.git
synced 2024-11-16 11:27:33 -08:00
Player management [Commit 2] (#38)
This commit is contained in:
parent
dbb340515f
commit
ff35ce6d6b
@ -97,7 +97,7 @@ endc
|
||||
const ENGINE_GOLDENROD_DEPT_STORE_SALE_IS_ON
|
||||
; wGameTimer
|
||||
const ENGINE_62
|
||||
; wPlayerGender
|
||||
; wPlayerCharacter
|
||||
const ENGINE_PLAYER_IS_FEMALE
|
||||
; wCelebiEvent
|
||||
const ENGINE_FOREST_IS_RESTLESS
|
||||
|
@ -9,10 +9,11 @@ DEF NUM_PLAYER_CHARACTERS EQU const_value
|
||||
|
||||
; field ids in the Players table
|
||||
rsreset
|
||||
DEF PLAYERDATA_STATE_SPRITES rw
|
||||
DEF PLAYERDATA_NPC_PAL rb
|
||||
DEF PLAYERDATA_STATE_SPRITES rw
|
||||
DEF PLAYERDATA_OW_PAL rb
|
||||
DEF PLAYERDATA_DEFAULT_SPRITE rw
|
||||
DEF PLAYERDATA_FISHING_SPRITE rw
|
||||
DEF PLAYERDATA_FRONTPIC rw
|
||||
DEF PLAYERDATA_BACKPIC rw
|
||||
DEF PLAYERDATA_PIC_PAL rw
|
||||
DEF PLAYERDATA_FRONTPIC rw
|
||||
DEF PLAYERDATA_BACKPIC rw
|
||||
DEF PLAYERDATA_PIC_PAL rw
|
||||
DEF PLAYERDATA_LENGTH EQU _RS
|
||||
|
@ -27,6 +27,7 @@ DEF NUM_SPRITEDATA_FIELDS EQU _RS
|
||||
; object_events set bit 3 so as not to use the sprite's default palette
|
||||
; MapObjectPals indexes (see gfx/overworld/npc_sprites.pal)
|
||||
const_def 1 << 3
|
||||
DEF PAL_NPC EQU const_value
|
||||
const PAL_NPC_RED ; 8
|
||||
const PAL_NPC_BLUE ; 9
|
||||
const PAL_NPC_GREEN ; a
|
||||
|
@ -161,7 +161,7 @@ DEF PLAYERSPRITESETUP_CUSTOM_FACING_F EQU 5
|
||||
DEF PLAYERSPRITESETUP_SKIP_RELOAD_GFX_F EQU 6
|
||||
DEF PLAYERSPRITESETUP_RESET_ACTION_F EQU 7
|
||||
|
||||
; wPlayerGender::
|
||||
; wPlayerCharacter::
|
||||
DEF PLAYERGENDER_FEMALE_F EQU 0
|
||||
|
||||
; wMapStatus::
|
||||
|
@ -108,7 +108,7 @@ endc
|
||||
|
||||
engine_flag wGameTimer, 7 ; unused
|
||||
|
||||
engine_flag wPlayerGender, PLAYERGENDER_FEMALE_F
|
||||
engine_flag wPlayerCharacter, PLAYERGENDER_FEMALE_F
|
||||
|
||||
engine_flag wCelebiEvent, CELEBIEVENT_FOREST_IS_RESTLESS_F
|
||||
|
||||
|
@ -1,13 +1,14 @@
|
||||
MACRO player
|
||||
dw \1 ; ptr to ow state sprites
|
||||
db \2 ; ow sprite palette
|
||||
dw \3 ; ptr to ow fishing gfx
|
||||
dw \4, \5 ; ptr to (uncompressed) frontpic, ptr to (compressed) backpic
|
||||
dw \6 ; ptr to pic pallete
|
||||
dw \3 ; ptr to ow default gfx
|
||||
dw \4 ; ptr to ow fishing gfx
|
||||
dw \5, \6 ; ptr to (uncompressed) frontpic, ptr to (compressed) backpic
|
||||
dw \7 ; ptr to pic palette
|
||||
ENDM
|
||||
|
||||
Players::
|
||||
player ChrisStateSprites, PAL_NPC_RED, FishingGFX, ChrisPic, ChrisBackpic, PlayerPalette ; PLAYER_CHRIS
|
||||
player KrisStateSprites, PAL_NPC_BLUE, KrisFishingGFX, KrisPic, KrisBackpic, KrisPalette ; PLAYER_KRIS
|
||||
player GreenStateSprites, PAL_NPC_GREEN, FishingGFX, ChrisPic, ChrisBackpic, PlayerPalette ; PLAYER_GREEN
|
||||
db $ff
|
||||
; for each argument number across different players, all arguments that are pointers must point to something in the same bank
|
||||
player ChrisStateSprites, PAL_OW_RED, ChrisSpriteGFX, FishingGFX, ChrisPic, ChrisBackpic, PlayerPalette ; PLAYER_CHRIS
|
||||
player KrisStateSprites, PAL_OW_BLUE, KrisSpriteGFX, KrisFishingGFX, KrisPic, KrisBackpic, KrisPalette ; PLAYER_KRIS
|
||||
player GreenStateSprites, PAL_OW_GREEN, RivalSpriteGFX, FishingGFX, ChrisPic, ChrisBackpic, PlayerPalette ; PLAYER_GREEN
|
||||
|
BIN
docs/usage/img/players.bmp
Executable file
BIN
docs/usage/img/players.bmp
Executable file
Binary file not shown.
After Width: | Height: | Size: 68 KiB |
BIN
docs/usage/img/talker.bmp
Executable file
BIN
docs/usage/img/talker.bmp
Executable file
Binary file not shown.
After Width: | Height: | Size: 68 KiB |
@ -28,6 +28,7 @@ This documentation covers a mix of topics that include aspects ranging from how
|
||||
- [Map identifiers](#map-identifiers)
|
||||
- [Map environments](#map-environments)
|
||||
- [OAM management](#oam-management)
|
||||
- [Player characters](#player-characters)
|
||||
- [Gameplay design aspects](#gameplay-design-aspects)
|
||||
- [Game currency](#game-currency)
|
||||
- [Time counting](#time-counting)
|
||||
@ -37,7 +38,7 @@ This documentation covers a mix of topics that include aspects ranging from how
|
||||
|
||||
The level selection menu is essentially a world map that the player navigates to select a level to play. The player can move through landmarks that correspond to unlocked levels in the level selection menu. The level seleciton menu can have multiple map pages each with their own landmarks. When the player moves from a landmark in one page to a landmark in another page, the new page is loaded during the transition.
|
||||
|
||||
[Level selection menu](img/level_selection_menu.bmp)
|
||||
![Level selection menu](img/level_selection_menu.bmp)
|
||||
|
||||
The usual level:landmark relation is expected to be 1:1, but 1:n is also supported, for levels that may have alternative starting points.
|
||||
|
||||
@ -65,7 +66,7 @@ In addition to what is covered in this section, you can find more low level stuf
|
||||
|
||||
The board menu is shown to the player at the beginning of each turn. In allows for several choices. The only ones that are specific to the pokecrystal-board engine are "roll die", "view map", and "exit level". The other three choices point to the party menu, bag menu, and pokegear, and are placeholders from pokecrystal. The board menu can be navigated horizontally. All menu options are accessed by selecting the corresponding icon of the menu, except for "view map" which is accessible via the Select button. All menu options except for "roll die" and "exit level" eventually return back to the board menu.
|
||||
|
||||
[Board menu](img/board_menu.bmp)
|
||||
![Board menu](img/board_menu.bmp)
|
||||
|
||||
The implementation is located in [engine/board/menu.asm](engine/board/menu.asm). Icon tiles are drawn over the background of the textbox as if they were font characters. The current menu item is highlighted with a colored overlay using objects. This file includes also the animation logic for rolling a die when the "roll die" option is selected. These animations leverage the overworld sprite animation engine from pokecrystal. Finally, [gfx/board](gfx/board) contains GFX assets.
|
||||
|
||||
@ -204,6 +205,8 @@ Unlike trainer events, talker events are meant to be used for NPCs that interact
|
||||
|
||||
The script pointer of a talker NPC points to an struct that uses the *talker* macro. Its arguments are flag, OPTIONAL/MANDATORY, TEXT/SCRIPT, 2-byte pointer to text or script. *OPTIONAL* means that the player will receive a prompt to skip this NPC's event. *SCRIPT* means that the 2-byte pointer points to an arbitrary script to be executed, while *TEXT* is a shortcut to merely make the NPC display text (it just executes a simple script enclosed in opentext/closetext).
|
||||
|
||||
![Talker](img/talker.bmp)
|
||||
|
||||
Talkers can use turn-scoped flags that are cleared at the beginning of each turn, but like level-scoped trainer flags, this is just a predefined design choice.
|
||||
|
||||
For example:
|
||||
@ -311,7 +314,7 @@ Note that the map name sign feature is not used in pokecrystal-board, and, in fa
|
||||
|
||||
This fading engine is used in the level selection menu and in the transition from overworld to post-level screen. When designing the timing your own fading functions, be aware of the latency introduced by the engine itself: each color takes around 3.2 scanlines to fade (in normal speed mode), so up to around 10-11 palettes can be faded in a whole frame.
|
||||
|
||||
In addition to this engine, for manual fading you can automate the derivation of the RGB values of intermediate steps using the *rgbpals_\** macros available in [gfx/macros.asm](gfx/macros.asm), as done for example in [gfx/level_selection_menu/background_female.pal](gfx/level_selection_menu/background_female.pal).
|
||||
In addition to this engine, for manual fading you can automate the derivation of the RGB values of intermediate steps using the *rgbpals_\** macros available in [gfx/macros.asm](gfx/macros.asm), as done for example in [gfx/level_selection_menu/background.pal](gfx/level_selection_menu/background.pal).
|
||||
|
||||
# Internal design aspects
|
||||
|
||||
@ -371,6 +374,24 @@ To update just secondary sprites without processing NPC sprites, you can use *Up
|
||||
|
||||
The tiles reserved for secondary sprites in the overworld are 0x20 through 0x7e in VRAM bank 0. Tiles from 0x00 through 0x1f are reserved for NPC sprites. You may want to adjust the separation point according to your needs. [charmap.asm](charmap.asm) defines the placement of secondary sprite tiles for different use cases. The start tile of 0x20 is denoted by *SECONDARY_SPRITES_FIRST_TILE*. From there, it's a matter of managing which sprites may or may not overlap to place their tiles in VRAM in the way that most optimizes the available space.
|
||||
|
||||
## Player characters
|
||||
|
||||
Player data has been centralized into the *Players* table from [data/players/players.asm](data/players/players.asm), including overworld sprites and their states, player pictures, and their palettes. Player constants are defined in [constants/player_constants.asm](constants/player_constants.asm). When you define pointers in a *player* entry in the *Players* table, you must ensure the equivalent argument in all entries points to something in the same bank.
|
||||
|
||||
For example, in:
|
||||
|
||||
```
|
||||
Players::
|
||||
player ChrisStateSprites, PAL_OW_RED, ChrisSpriteGFX, FishingGFX, ChrisPic, ChrisBackpic, PlayerPalette ; PLAYER_CHRIS
|
||||
player KrisStateSprites, PAL_OW_BLUE, KrisSpriteGFX, KrisFishingGFX, KrisPic, KrisBackpic, KrisPalette ; PLAYER_KRIS
|
||||
player GreenStateSprites, PAL_OW_GREEN, RivalSpriteGFX, FishingGFX, ChrisPic, ChrisBackpic, PlayerPalette ; PLAYER_GREEN
|
||||
```
|
||||
*ChrisSpriteGFX*, *KrisSpriteGFX*, and *RivalSpriteGFX* must point to graphics located in the same bank as each other, and so on.
|
||||
|
||||
Note that for many pokecrystal features that are considered placeholder or discontinued in pokecrystal-board (e.g. player selection/naming screen, Pokegear, pack, trainer card, Magnet Train, etc.), pokecrystal-board still uses legacy *PLAYERGENDER_FEMALE_F* flag. The concept of gender is otherwise deprecated.
|
||||
|
||||
![Player](img/player.bmp)
|
||||
|
||||
# Gameplay design aspects
|
||||
|
||||
This section covers miscellaneous gameplay design aspects not yet fully covered in other sections.
|
||||
|
@ -8761,7 +8761,7 @@ GetTrainerBackpic:
|
||||
jr z, .Decompress
|
||||
|
||||
; What gender are we?
|
||||
ld a, [wPlayerGender]
|
||||
ld a, [wPlayerCharacter]
|
||||
ld e, PLAYERDATA_BACKPIC
|
||||
call GetPlayerField
|
||||
.Decompress
|
||||
|
@ -417,10 +417,10 @@ DebugRoom_PrintBattleSkip:
|
||||
DebugRoomMenu_ChangeSex:
|
||||
ld a, BANK(sGameData)
|
||||
call OpenSRAM
|
||||
ld a, [sGameData + (wPlayerGender - wGameData)]
|
||||
ld a, [sGameData + (wPlayerCharacter - wGameData)]
|
||||
inc a
|
||||
and 1
|
||||
ld [sGameData + (wPlayerGender - wGameData)], a
|
||||
ld [sGameData + (wPlayerCharacter - wGameData)], a
|
||||
call CloseSRAM
|
||||
ret
|
||||
|
||||
@ -430,7 +430,7 @@ DebugRoom_PrintGender:
|
||||
call PlaceString
|
||||
ld a, BANK(sGameData)
|
||||
call OpenSRAM
|
||||
ld a, [sGameData + (wPlayerGender - wGameData)]
|
||||
ld a, [sGameData + (wPlayerCharacter - wGameData)]
|
||||
call CloseSRAM
|
||||
or a
|
||||
ld a, "♂"
|
||||
|
@ -4,7 +4,7 @@ LoadFishingGFX:
|
||||
ld a, $1
|
||||
ldh [rVBK], a
|
||||
|
||||
ld a, [wPlayerGender]
|
||||
ld a, [wPlayerCharacter]
|
||||
ld e, PLAYERDATA_FISHING_SPRITE
|
||||
call GetPlayerField
|
||||
ld d, h
|
||||
|
@ -131,7 +131,7 @@ MagnetTrain_LoadGFX_PlayMusic:
|
||||
; Load the player sprite's standing frames
|
||||
ldh a, [rSVBK]
|
||||
push af
|
||||
ld a, BANK(wPlayerGender)
|
||||
ld a, BANK(wPlayerCharacter)
|
||||
ldh [rSVBK], a
|
||||
farcall GetPlayerIcon
|
||||
pop af
|
||||
@ -295,9 +295,9 @@ MagnetTrain_Jumptable:
|
||||
ld b, SPRITE_ANIM_OBJ_MAGNET_TRAIN_RED
|
||||
ldh a, [rSVBK]
|
||||
push af
|
||||
ld a, BANK(wPlayerGender)
|
||||
ld a, BANK(wPlayerCharacter)
|
||||
ldh [rSVBK], a
|
||||
ld a, [wPlayerGender]
|
||||
ld a, [wPlayerCharacter]
|
||||
bit PLAYERGENDER_FEMALE_F, a
|
||||
jr z, .got_gender
|
||||
ld b, SPRITE_ANIM_OBJ_MAGNET_TRAIN_BLUE
|
||||
|
@ -162,7 +162,7 @@ InitPartyMenuBGPal0:
|
||||
ret
|
||||
|
||||
_CGB_PokegearPals:
|
||||
ld a, [wPlayerGender]
|
||||
ld a, [wPlayerCharacter]
|
||||
bit PLAYERGENDER_FEMALE_F, a
|
||||
jr z, .male
|
||||
ld hl, FemalePokegearPals
|
||||
@ -556,7 +556,11 @@ _CGB_LevelSelectionMenu:
|
||||
ld bc, 8 palettes
|
||||
ld hl, MapObjectPals
|
||||
call AddNTimes
|
||||
gender_to_pal
|
||||
ld a, [wPlayerCharacter]
|
||||
ld e, PLAYERDATA_OW_PAL
|
||||
push hl
|
||||
call GetPlayerField
|
||||
pop hl
|
||||
ld bc, 1 palettes
|
||||
call AddNTimes
|
||||
ld de, wOBPals1
|
||||
@ -578,15 +582,8 @@ _CGB_LevelSelectionMenu:
|
||||
ld a, BANK(wOBPals1)
|
||||
call FarCopyWRAM
|
||||
|
||||
; load daytime and gender-based background pals
|
||||
ld a, [wPlayerGender]
|
||||
bit PLAYERGENDER_FEMALE_F, a
|
||||
jr z, .male
|
||||
ld hl, LevelSelectionMenuFemalePals
|
||||
jr .got_pals
|
||||
.male
|
||||
ld hl, LevelSelectionMenuMalePals
|
||||
.got_pals
|
||||
; load daytime background pals
|
||||
ld hl, LevelSelectionMenuPals
|
||||
ld a, [wTimeOfDay]
|
||||
maskbits NUM_DAYTIMES
|
||||
ld bc, 6 palettes
|
||||
@ -638,16 +635,8 @@ _CGB_LevelSelectionMenuToDChange:
|
||||
jr .loop
|
||||
|
||||
.match
|
||||
ld e, [hl]
|
||||
ld a, [wPlayerGender]
|
||||
bit PLAYERGENDER_FEMALE_F, a
|
||||
jr z, .male
|
||||
ld hl, LevelSelectionMenuFemalePals
|
||||
jr .got_pals
|
||||
.male
|
||||
ld hl, LevelSelectionMenuMalePals
|
||||
.got_pals
|
||||
ld a, e
|
||||
ld a, [hl]
|
||||
ld hl, LevelSelectionMenuPals
|
||||
ld bc, 6 palettes
|
||||
call AddNTimes
|
||||
ld de, wBGPals1
|
||||
@ -737,7 +726,7 @@ _CGB_TrainerCard:
|
||||
; fill screen with opposite-gender palette for the card border
|
||||
hlcoord 0, 0, wAttrmap
|
||||
ld bc, SCREEN_WIDTH * SCREEN_HEIGHT
|
||||
ld a, [wPlayerGender]
|
||||
ld a, [wPlayerCharacter]
|
||||
and a
|
||||
ld a, $1 ; kris
|
||||
jr z, .got_gender
|
||||
@ -747,7 +736,7 @@ _CGB_TrainerCard:
|
||||
; fill trainer sprite area with same-gender palette
|
||||
hlcoord 14, 1, wAttrmap
|
||||
lb bc, 7, 5
|
||||
ld a, [wPlayerGender]
|
||||
ld a, [wPlayerCharacter]
|
||||
and a
|
||||
ld a, $0 ; chris
|
||||
jr z, .got_gender2
|
||||
@ -786,7 +775,7 @@ _CGB_TrainerCard:
|
||||
ld a, $7 ; pryce
|
||||
call FillBoxCGB
|
||||
; clair uses kris's palette
|
||||
ld a, [wPlayerGender]
|
||||
ld a, [wPlayerCharacter]
|
||||
and a
|
||||
push af
|
||||
jr z, .got_gender3
|
||||
@ -861,7 +850,7 @@ _CGB_PackPals:
|
||||
cp BATTLETYPE_TUTORIAL
|
||||
jr z, .tutorial_male
|
||||
|
||||
ld a, [wPlayerGender]
|
||||
ld a, [wPlayerCharacter]
|
||||
bit PLAYERGENDER_FEMALE_F, a
|
||||
jr z, .tutorial_male
|
||||
|
||||
|
@ -503,7 +503,7 @@ GetEnemyFrontpicPalettePointer:
|
||||
GetPlayerOrMonPalettePointer:
|
||||
and a
|
||||
jp nz, GetMonNormalOrShinyPalettePointer
|
||||
ld a, [wPlayerGender]
|
||||
ld a, [wPlayerCharacter]
|
||||
ld e, PLAYERDATA_PIC_PAL
|
||||
call GetPlayerField
|
||||
ret
|
||||
@ -862,14 +862,9 @@ INCLUDE "gfx/beta_poker/beta_poker.pal"
|
||||
SlotMachinePals:
|
||||
INCLUDE "gfx/slots/slots.pal"
|
||||
|
||||
LevelSelectionMenuMalePals:
|
||||
table_width PAL_COLOR_SIZE * 4 * 6, LevelSelectionMenuMalePals
|
||||
INCLUDE "gfx/level_selection_menu/background_male.pal"
|
||||
assert_table_length (NUM_DAYTIMES + NUM_DAYTIMES * 2)
|
||||
|
||||
LevelSelectionMenuFemalePals:
|
||||
table_width PAL_COLOR_SIZE * 4 * 6, LevelSelectionMenuFemalePals
|
||||
INCLUDE "gfx/level_selection_menu/background_female.pal"
|
||||
LevelSelectionMenuPals:
|
||||
table_width PAL_COLOR_SIZE * 4 * 6, LevelSelectionMenuPals
|
||||
INCLUDE "gfx/level_selection_menu/background.pal"
|
||||
assert_table_length (NUM_DAYTIMES + NUM_DAYTIMES * 2)
|
||||
|
||||
LevelSelectionMenuStageTrophiesPals:
|
||||
|
@ -45,7 +45,7 @@ MovePlayerPic:
|
||||
|
||||
ShowPlayerNamingChoices:
|
||||
ld hl, ChrisNameMenuHeader
|
||||
ld a, [wPlayerGender]
|
||||
ld a, [wPlayerCharacter]
|
||||
bit PLAYERGENDER_FEMALE_F, a
|
||||
jr z, .got_header
|
||||
ld hl, KrisNameMenuHeader
|
||||
@ -61,19 +61,17 @@ ShowPlayerNamingChoices:
|
||||
INCLUDE "data/players/names.asm"
|
||||
|
||||
GetPlayerIcon:
|
||||
ld de, ChrisSpriteGFX
|
||||
ld a, [wPlayerCharacter]
|
||||
ld e, PLAYERDATA_DEFAULT_SPRITE
|
||||
call GetPlayerField
|
||||
ld d, h
|
||||
ld e, l
|
||||
ld b, BANK(ChrisSpriteGFX)
|
||||
ld a, [wPlayerGender]
|
||||
bit PLAYERGENDER_FEMALE_F, a
|
||||
jr z, .got_gfx
|
||||
ld de, KrisSpriteGFX
|
||||
ld b, BANK(KrisSpriteGFX)
|
||||
.got_gfx
|
||||
ret
|
||||
|
||||
GetCardPic:
|
||||
ld hl, ChrisCardPic
|
||||
ld a, [wPlayerGender]
|
||||
ld a, [wPlayerCharacter]
|
||||
bit PLAYERGENDER_FEMALE_F, a
|
||||
jr z, .got_pic
|
||||
ld hl, KrisCardPic
|
||||
@ -99,7 +97,7 @@ TrainerCardGFX:
|
||||
INCBIN "gfx/trainer_card/trainer_card.2bpp"
|
||||
|
||||
GetPlayerBackpic:
|
||||
ld a, [wPlayerGender]
|
||||
ld a, [wPlayerCharacter]
|
||||
ld e, PLAYERDATA_BACKPIC
|
||||
call GetPlayerField
|
||||
ld de, vTiles2 tile $31
|
||||
@ -115,7 +113,7 @@ HOF_LoadTrainerFrontpic:
|
||||
|
||||
; Get class
|
||||
ld e, CHRIS
|
||||
ld a, [wPlayerGender]
|
||||
ld a, [wPlayerCharacter]
|
||||
bit PLAYERGENDER_FEMALE_F, a
|
||||
jr z, .got_class
|
||||
ld e, KRIS
|
||||
@ -125,7 +123,7 @@ HOF_LoadTrainerFrontpic:
|
||||
|
||||
; Load pic
|
||||
ld de, ChrisPic
|
||||
ld a, [wPlayerGender]
|
||||
ld a, [wPlayerCharacter]
|
||||
bit PLAYERGENDER_FEMALE_F, a
|
||||
jr z, .got_pic
|
||||
ld de, KrisPic
|
||||
@ -145,7 +143,7 @@ DrawIntroPlayerPic:
|
||||
|
||||
; Get class
|
||||
ld e, CHRIS
|
||||
ld a, [wPlayerGender]
|
||||
ld a, [wPlayerCharacter]
|
||||
bit PLAYERGENDER_FEMALE_F, a
|
||||
jr z, .got_class
|
||||
ld e, KRIS
|
||||
@ -155,7 +153,7 @@ DrawIntroPlayerPic:
|
||||
|
||||
; Load pic
|
||||
ld de, ChrisPic
|
||||
ld a, [wPlayerGender]
|
||||
ld a, [wPlayerCharacter]
|
||||
bit PLAYERGENDER_FEMALE_F, a
|
||||
jr z, .got_pic
|
||||
ld de, KrisPic
|
||||
|
@ -1215,7 +1215,7 @@ DrawPackGFX:
|
||||
ld a, [wBattleType]
|
||||
cp BATTLETYPE_TUTORIAL
|
||||
jr z, .male_dude
|
||||
ld a, [wPlayerGender]
|
||||
ld a, [wPlayerCharacter]
|
||||
bit PLAYERGENDER_FEMALE_F, a
|
||||
jr nz, .female
|
||||
.male_dude
|
||||
|
@ -13,7 +13,7 @@ InitGender:
|
||||
call CloseWindow
|
||||
ld a, [wMenuCursorY]
|
||||
dec a
|
||||
ld [wPlayerGender], a
|
||||
ld [wPlayerCharacter], a
|
||||
ld c, 10
|
||||
call DelayFrames
|
||||
ret
|
||||
|
@ -527,7 +527,7 @@ NamePlayer:
|
||||
|
||||
ld hl, wPlayerName
|
||||
ld de, .Chris
|
||||
ld a, [wPlayerGender]
|
||||
ld a, [wPlayerCharacter]
|
||||
bit PLAYERGENDER_FEMALE_F, a
|
||||
jr z, .Male
|
||||
ld de, .Kris
|
||||
@ -682,13 +682,15 @@ Intro_PlacePlayerSprite:
|
||||
inc de
|
||||
ld [hli], a ; tile id
|
||||
|
||||
ld b, PAL_OW_RED
|
||||
ld a, [wPlayerGender]
|
||||
bit PLAYERGENDER_FEMALE_F, a
|
||||
jr z, .male
|
||||
ld b, PAL_OW_BLUE
|
||||
.male
|
||||
ld a, b
|
||||
ld a, [wPlayerCharacter]
|
||||
ld e, PLAYERDATA_OW_PAL
|
||||
push hl
|
||||
push de
|
||||
push bc
|
||||
call GetPlayerField
|
||||
pop bc
|
||||
pop de
|
||||
pop hl
|
||||
|
||||
ld [hli], a ; attributes
|
||||
dec c
|
||||
|
@ -3233,12 +3233,12 @@ InitBranchArrowsSprites:
|
||||
cp BRANCH_DIRECTION_INVALID
|
||||
jr z, .next1 ; skip this arrow if this direction is not valid
|
||||
cp BRANCH_DIRECTION_UNAVAILABLE
|
||||
gender_to_pal
|
||||
ld b, a
|
||||
jr nz, .available
|
||||
ld b, PAL_OW_GREY ; draw grey arrow if this direction is unavailable
|
||||
jr z, .got_pal
|
||||
call GetSecondarySpritesPal
|
||||
ld b, a
|
||||
|
||||
.available
|
||||
.got_pal
|
||||
; draw this arrow and advance hUsedSpriteIndex
|
||||
; preserve loop variables d, e, c
|
||||
push de
|
||||
@ -3281,7 +3281,7 @@ InitBranchArrowsSprites:
|
||||
; the palette byte overrides that data as it matches the player's color palette.
|
||||
ld e, a
|
||||
ld d, HIGH(wShadowOAM)
|
||||
gender_to_pal
|
||||
call GetSecondarySpritesPal
|
||||
ld b, a
|
||||
ld c, 8 ; number of objects
|
||||
ld hl, BranchLegendOAM
|
||||
@ -3322,7 +3322,7 @@ InitViewMapModeSprites:
|
||||
ld a, [de]
|
||||
cp $ff
|
||||
jr z, .next1 ; skip this arrow if this direction is not valid
|
||||
gender_to_pal
|
||||
call GetSecondarySpritesPal
|
||||
ld b, a
|
||||
; draw this arrow and advance hUsedSpriteIndex
|
||||
; preserve loop variables d, e, c
|
||||
@ -3366,7 +3366,7 @@ InitViewMapModeSprites:
|
||||
; the palette byte overrides that data as it matches the player's color palette.
|
||||
ld e, a
|
||||
ld d, HIGH(wShadowOAM)
|
||||
gender_to_pal
|
||||
call GetSecondarySpritesPal
|
||||
ld b, a
|
||||
ld c, 8 ; number of objects
|
||||
ld hl, ViewMapModeLegendOAM
|
||||
@ -3401,7 +3401,7 @@ InitTalkerEventSprites:
|
||||
; the palette byte overrides that data as it matches the player's color palette.
|
||||
ld e, a
|
||||
ld d, HIGH(wShadowOAM)
|
||||
gender_to_pal
|
||||
call GetSecondarySpritesPal
|
||||
ld b, a
|
||||
ld c, 8 ; number of objects
|
||||
ld hl, TalkerEventLegendOAM
|
||||
@ -3495,4 +3495,16 @@ InitGainOrLoseCoinsSprites:
|
||||
pop af
|
||||
ret
|
||||
|
||||
GetSecondarySpritesPal:
|
||||
push hl
|
||||
push de
|
||||
push bc
|
||||
ld a, [wPlayerCharacter]
|
||||
ld e, PLAYERDATA_OW_PAL
|
||||
call GetPlayerField
|
||||
pop bc
|
||||
pop de
|
||||
pop hl
|
||||
ret
|
||||
|
||||
INCLUDE "data/sprites/secondary_sprites.asm"
|
||||
|
@ -54,7 +54,7 @@ RefreshSprites::
|
||||
|
||||
DeterminePlayerSprite:
|
||||
; Return player's sprite in c and a.
|
||||
ld a, [wPlayerGender]
|
||||
ld a, [wPlayerCharacter]
|
||||
ld e, PLAYERDATA_STATE_SPRITES
|
||||
call GetPlayerField
|
||||
ld a, [wPlayerState]
|
||||
|
@ -29,14 +29,15 @@ SpawnPlayer:
|
||||
call GetMapObject
|
||||
ld hl, MAPOBJECT_PALETTE
|
||||
add hl, bc
|
||||
ln e, PAL_NPC_RED, OBJECTTYPE_SCRIPT
|
||||
ld a, [wPlayerGender]
|
||||
bit PLAYERGENDER_FEMALE_F, a
|
||||
jr z, .ok
|
||||
ln e, PAL_NPC_BLUE, OBJECTTYPE_SCRIPT
|
||||
|
||||
.ok
|
||||
ld [hl], e
|
||||
push hl
|
||||
ld a, [wPlayerCharacter]
|
||||
ld e, PLAYERDATA_OW_PAL
|
||||
call GetPlayerField
|
||||
add PAL_NPC ; convert from PAL_OW to PAL_NPC
|
||||
swap a
|
||||
or OBJECTTYPE_SCRIPT
|
||||
pop hl
|
||||
ld [hl], a
|
||||
ld a, PLAYER_OBJECT
|
||||
ldh [hMapObjectIndex], a
|
||||
ld bc, wMapObjects
|
||||
@ -945,9 +946,10 @@ MockPlayerObject::
|
||||
call CopyBytes
|
||||
|
||||
; adjust palette number
|
||||
ld a, [wPlayerGender]
|
||||
ld e, PLAYERDATA_NPC_PAL
|
||||
ld a, [wPlayerCharacter]
|
||||
ld e, PLAYERDATA_OW_PAL
|
||||
call GetPlayerField
|
||||
add PAL_NPC ; convert from PAL_OW to PAL_NPC
|
||||
swap a
|
||||
or OBJECTTYPE_SCRIPT
|
||||
ld [wMapObject{d:LAST_OBJECT}Palette], a ; also wMapObject{d:LAST_OBJECT}Type
|
||||
|
@ -561,7 +561,7 @@ PokegearMap_InitPlayerIcon:
|
||||
push af
|
||||
depixel 0, 0
|
||||
ld b, SPRITE_ANIM_OBJ_RED_WALK
|
||||
ld a, [wPlayerGender]
|
||||
ld a, [wPlayerCharacter]
|
||||
bit PLAYERGENDER_FEMALE_F, a
|
||||
jr z, .got_gender
|
||||
ld b, SPRITE_ANIM_OBJ_BLUE_WALK
|
||||
@ -2283,7 +2283,7 @@ Pokedex_GetArea:
|
||||
inc de
|
||||
push bc
|
||||
ld c, PAL_OW_RED
|
||||
ld a, [wPlayerGender]
|
||||
ld a, [wPlayerCharacter]
|
||||
bit PLAYERGENDER_FEMALE_F, a
|
||||
jr z, .male
|
||||
inc c ; PAL_OW_BLUE
|
||||
@ -2459,7 +2459,7 @@ TownMapPlayerIcon:
|
||||
; Animation/palette
|
||||
depixel 0, 0
|
||||
ld b, SPRITE_ANIM_OBJ_RED_WALK ; Male
|
||||
ld a, [wPlayerGender]
|
||||
ld a, [wPlayerCharacter]
|
||||
bit PLAYERGENDER_FEMALE_F, a
|
||||
jr z, .got_gender
|
||||
ld b, SPRITE_ANIM_OBJ_BLUE_WALK ; Female
|
||||
|
@ -177,7 +177,7 @@ SetBoxmonOrEggmonCaughtData:
|
||||
ld c, a
|
||||
call GetWorldMapLocation
|
||||
ld b, a
|
||||
ld a, [wPlayerGender]
|
||||
ld a, [wPlayerCharacter]
|
||||
rrca ; shift bit 0 (PLAYERGENDER_FEMALE_F) to bit 7 (CAUGHT_GENDER_MASK)
|
||||
or b
|
||||
ld [hl], a
|
||||
|
@ -17,7 +17,7 @@
|
||||
RGB 07, 31, 03
|
||||
RGB 19, 11, 00
|
||||
RGB 00, 00, 00
|
||||
; city (boy)
|
||||
; city
|
||||
RGB 28, 31, 20
|
||||
RGB 31, 15, 00
|
||||
RGB 15, 07, 00
|
||||
@ -54,7 +54,7 @@
|
||||
RGB 00, 31, 00
|
||||
RGB 15, 07, 00
|
||||
RGB 00, 00, 00
|
||||
; city (boy)
|
||||
; city
|
||||
RGB 28, 31, 20
|
||||
RGB 31, 15, 00
|
||||
RGB 15, 07, 00
|
||||
@ -91,7 +91,7 @@
|
||||
RGB 00, 15, 00
|
||||
RGB 09, 05, 00
|
||||
RGB 00, 00, 00
|
||||
; city (boy)
|
||||
; city
|
||||
RGB 28, 31, 20
|
||||
RGB 31, 15, 00
|
||||
RGB 15, 07, 00
|
||||
@ -128,7 +128,7 @@
|
||||
RGB 04, 22, 00
|
||||
RGB 13, 05, 00
|
||||
RGB 00, 00, 00
|
||||
; city (boy)
|
||||
; city
|
||||
RGB 28, 31, 20
|
||||
RGB 31, 15, 00
|
||||
RGB 15, 07, 00
|
@ -1,152 +0,0 @@
|
||||
; morn
|
||||
|
||||
rgbpals_fade_src "lsm_f_morn"
|
||||
|
||||
; border
|
||||
RGB 28, 31, 20
|
||||
RGB 21, 21, 21
|
||||
RGB 13, 13, 13
|
||||
RGB 00, 00, 00
|
||||
; earth
|
||||
RGB 28, 31, 20
|
||||
RGB 07, 31, 03
|
||||
RGB 05, 05, 31
|
||||
RGB 00, 00, 00
|
||||
; mountain
|
||||
RGB 28, 31, 20
|
||||
RGB 07, 31, 03
|
||||
RGB 19, 11, 00
|
||||
RGB 00, 00, 00
|
||||
; city (girl)
|
||||
RGB 28, 31, 20
|
||||
RGB 10, 18, 31
|
||||
RGB 13, 06, 31
|
||||
RGB 00, 00, 00
|
||||
; point of interest
|
||||
RGB 28, 31, 20
|
||||
RGB 07, 31, 03
|
||||
RGB 05, 05, 31
|
||||
RGB 31, 00, 00
|
||||
; mountain point of interest
|
||||
RGB 28, 31, 20
|
||||
RGB 07, 31, 03
|
||||
RGB 19, 11, 00
|
||||
RGB 31, 00, 00
|
||||
|
||||
rgbpals_fade_src_end
|
||||
|
||||
; day (original)
|
||||
|
||||
rgbpals_fade_src "lsm_f_day"
|
||||
|
||||
; border
|
||||
RGB 28, 31, 20
|
||||
RGB 21, 21, 21
|
||||
RGB 13, 13, 13
|
||||
RGB 00, 00, 00
|
||||
; earth
|
||||
RGB 28, 31, 20
|
||||
RGB 00, 31, 00
|
||||
RGB 00, 00, 31
|
||||
RGB 00, 00, 00
|
||||
; mountain
|
||||
RGB 28, 31, 20
|
||||
RGB 00, 31, 00
|
||||
RGB 15, 07, 00
|
||||
RGB 00, 00, 00
|
||||
; city (girl)
|
||||
RGB 28, 31, 20
|
||||
RGB 10, 18, 31
|
||||
RGB 13, 06, 31
|
||||
RGB 00, 00, 00
|
||||
; point of interest
|
||||
RGB 28, 31, 20
|
||||
RGB 00, 31, 00
|
||||
RGB 00, 00, 31
|
||||
RGB 31, 00, 00
|
||||
; mountain point of interest
|
||||
RGB 28, 31, 20
|
||||
RGB 00, 31, 00
|
||||
RGB 15, 07, 00
|
||||
RGB 31, 00, 00
|
||||
|
||||
rgbpals_fade_src_end
|
||||
|
||||
; nite
|
||||
|
||||
rgbpals_fade_src "lsm_f_nite"
|
||||
|
||||
; border
|
||||
RGB 28, 31, 20
|
||||
RGB 21, 21, 21
|
||||
RGB 13, 13, 13
|
||||
RGB 00, 00, 00
|
||||
; earth
|
||||
RGB 28, 31, 20
|
||||
RGB 00, 15, 00
|
||||
RGB 00, 00, 15
|
||||
RGB 00, 00, 00
|
||||
; mountain
|
||||
RGB 28, 31, 20
|
||||
RGB 00, 15, 00
|
||||
RGB 09, 05, 00
|
||||
RGB 00, 00, 00
|
||||
; city (girl)
|
||||
RGB 28, 31, 20
|
||||
RGB 10, 18, 31
|
||||
RGB 13, 06, 31
|
||||
RGB 00, 00, 00
|
||||
; point of interest
|
||||
RGB 28, 31, 20
|
||||
RGB 00, 15, 00
|
||||
RGB 00, 00, 15
|
||||
RGB 31, 00, 00
|
||||
; mountain point of interest
|
||||
RGB 28, 31, 20
|
||||
RGB 00, 15, 00
|
||||
RGB 09, 05, 00
|
||||
RGB 31, 00, 00
|
||||
|
||||
rgbpals_fade_src_end
|
||||
|
||||
; eve
|
||||
|
||||
rgbpals_fade_src "lsm_f_eve"
|
||||
|
||||
; border
|
||||
RGB 28, 31, 20
|
||||
RGB 21, 21, 21
|
||||
RGB 13, 13, 13
|
||||
RGB 00, 00, 00
|
||||
; earth
|
||||
RGB 28, 31, 20
|
||||
RGB 04, 22, 00
|
||||
RGB 04, 00, 22
|
||||
RGB 00, 00, 00
|
||||
; mountain
|
||||
RGB 28, 31, 20
|
||||
RGB 04, 22, 00
|
||||
RGB 13, 05, 00
|
||||
RGB 00, 00, 00
|
||||
; city (girl)
|
||||
RGB 28, 31, 20
|
||||
RGB 10, 18, 31
|
||||
RGB 13, 06, 31
|
||||
RGB 00, 00, 00
|
||||
; point of interest
|
||||
RGB 28, 31, 20
|
||||
RGB 04, 22, 00
|
||||
RGB 04, 00, 22
|
||||
RGB 31, 00, 00
|
||||
; mountain point of interest
|
||||
RGB 28, 31, 20
|
||||
RGB 04, 22, 00
|
||||
RGB 13, 05, 00
|
||||
RGB 31, 00, 00
|
||||
|
||||
rgbpals_fade_src_end
|
||||
|
||||
rgbpals_fade_apply "lsm_f_morn", "lsm_f_day", 2
|
||||
rgbpals_fade_apply "lsm_f_day", "lsm_f_eve", 2
|
||||
rgbpals_fade_apply "lsm_f_eve", "lsm_f_nite", 2
|
||||
rgbpals_fade_apply "lsm_f_nite", "lsm_f_morn", 2
|
@ -2,6 +2,8 @@ SECTION "Sprites 1", ROMX
|
||||
|
||||
ChrisSpriteGFX:: INCBIN "gfx/sprites/chris.2bpp"
|
||||
ChrisBikeSpriteGFX:: INCBIN "gfx/sprites/chris_bike.2bpp"
|
||||
KrisSpriteGFX:: INCBIN "gfx/sprites/kris.2bpp"
|
||||
KrisBikeSpriteGFX:: INCBIN "gfx/sprites/kris_bike.2bpp"
|
||||
GameboyKidSpriteGFX:: INCBIN "gfx/sprites/gameboy_kid.2bpp"
|
||||
RivalSpriteGFX:: INCBIN "gfx/sprites/rival.2bpp"
|
||||
OakSpriteGFX:: INCBIN "gfx/sprites/oak.2bpp"
|
||||
@ -42,12 +44,12 @@ YoungsterSpriteGFX:: INCBIN "gfx/sprites/youngster.2bpp"
|
||||
LassSpriteGFX:: INCBIN "gfx/sprites/lass.2bpp"
|
||||
TeacherSpriteGFX:: INCBIN "gfx/sprites/teacher.2bpp"
|
||||
BeautySpriteGFX:: INCBIN "gfx/sprites/beauty.2bpp"
|
||||
SuperNerdSpriteGFX:: INCBIN "gfx/sprites/super_nerd.2bpp"
|
||||
RockerSpriteGFX:: INCBIN "gfx/sprites/rocker.2bpp"
|
||||
|
||||
|
||||
SECTION "Sprites 2", ROMX
|
||||
|
||||
SuperNerdSpriteGFX:: INCBIN "gfx/sprites/super_nerd.2bpp"
|
||||
RockerSpriteGFX:: INCBIN "gfx/sprites/rocker.2bpp"
|
||||
PokefanMSpriteGFX:: INCBIN "gfx/sprites/pokefan_m.2bpp"
|
||||
PokefanFSpriteGFX:: INCBIN "gfx/sprites/pokefan_f.2bpp"
|
||||
GrampsSpriteGFX:: INCBIN "gfx/sprites/gramps.2bpp"
|
||||
@ -99,8 +101,6 @@ FamicomSpriteGFX:: INCBIN "gfx/sprites/famicom.2bpp"
|
||||
FruitTreeSpriteGFX:: INCBIN "gfx/sprites/fruit_tree.2bpp"
|
||||
GoldTrophySpriteGFX:: INCBIN "gfx/sprites/gold_trophy.2bpp"
|
||||
SilverTrophySpriteGFX:: INCBIN "gfx/sprites/silver_trophy.2bpp"
|
||||
KrisSpriteGFX:: INCBIN "gfx/sprites/kris.2bpp"
|
||||
KrisBikeSpriteGFX:: INCBIN "gfx/sprites/kris_bike.2bpp"
|
||||
KurtOutsideSpriteGFX:: INCBIN "gfx/sprites/kurt_outside.2bpp"
|
||||
SuicuneSpriteGFX:: INCBIN "gfx/sprites/suicune.2bpp"
|
||||
EnteiSpriteGFX:: INCBIN "gfx/sprites/entei.2bpp"
|
||||
|
@ -115,10 +115,3 @@ if _NARG == 0
|
||||
sine_table 32
|
||||
endc
|
||||
ENDM
|
||||
|
||||
; Abstractions
|
||||
|
||||
MACRO gender_to_pal
|
||||
; preserve all registers but a
|
||||
ld a, [wPlayerGender]
|
||||
ENDM
|
||||
|
@ -2317,7 +2317,7 @@ wRivalName:: ds NAME_LENGTH
|
||||
wRedsName:: ds NAME_LENGTH
|
||||
wGreensName:: ds NAME_LENGTH
|
||||
|
||||
wPlayerGender::
|
||||
wPlayerCharacter::
|
||||
; bit 0:
|
||||
; 0 male
|
||||
; 1 female
|
||||
|
Loading…
Reference in New Issue
Block a user