You've already forked pokecrystal-board
mirror of
https://gitlab.com/xCrystal/pokecrystal-board.git
synced 2025-04-09 05:44:44 -07:00
Player management [Commit 2] (#38)
This commit is contained in:
@@ -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
|
||||
|
Reference in New Issue
Block a user