mirror of
https://gitlab.com/xCrystal/pokecrystal-board.git
synced 2024-09-09 09:51:34 -07:00
Implement View Map mode [commit 2]: mock player object (#29)
This commit is contained in:
parent
147c9f2add
commit
d2bb82bc3c
@ -118,6 +118,7 @@ DEF MAPOBJECT_EVENT_FLAG rw ; c
|
|||||||
rb_skip 2
|
rb_skip 2
|
||||||
DEF MAPOBJECT_LENGTH EQU _RS
|
DEF MAPOBJECT_LENGTH EQU _RS
|
||||||
DEF NUM_OBJECTS EQU 16
|
DEF NUM_OBJECTS EQU 16
|
||||||
|
DEF LAST_OBJECT EQU NUM_OBJECTS - 1
|
||||||
DEF PLAYER_OBJECT EQU 0
|
DEF PLAYER_OBJECT EQU 0
|
||||||
|
|
||||||
DEF MAPOBJECT_PALETTE_MASK EQU %11110000
|
DEF MAPOBJECT_PALETTE_MASK EQU %11110000
|
||||||
|
@ -75,6 +75,7 @@ BoardMenuScript::
|
|||||||
|
|
||||||
.ViewMap:
|
.ViewMap:
|
||||||
callasm .EnterViewMapMode
|
callasm .EnterViewMapMode
|
||||||
|
appearplayermock
|
||||||
closetext
|
closetext
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -208,11 +208,15 @@ MapEvents:
|
|||||||
.no_events:
|
.no_events:
|
||||||
ret
|
ret
|
||||||
|
|
||||||
MaxOverworldDelay:
|
DEF MAX_OVERWORLD_DELAY EQU 2
|
||||||
db 2
|
DEF VIEW_MAP_OVERWORLD_DELAY EQU 1
|
||||||
|
|
||||||
ResetOverworldDelay:
|
ResetOverworldDelay:
|
||||||
ld a, [MaxOverworldDelay]
|
ldh a, [hCurBoardEvent]
|
||||||
|
cp BOARDEVENT_VIEW_MAP_MODE
|
||||||
|
ld a, MAX_OVERWORLD_DELAY
|
||||||
|
jr nz, .set_delay
|
||||||
|
ld a, VIEW_MAP_OVERWORLD_DELAY
|
||||||
|
.set_delay
|
||||||
ldh [hOverworldDelay], a
|
ldh [hOverworldDelay], a
|
||||||
ret
|
ret
|
||||||
|
|
||||||
|
@ -235,7 +235,8 @@ ScriptCommandTable:
|
|||||||
dw Script_wait ; a8
|
dw Script_wait ; a8
|
||||||
dw Script_checksave ; a9
|
dw Script_checksave ; a9
|
||||||
dw Script_exitoverworld ; aa
|
dw Script_exitoverworld ; aa
|
||||||
dw Script_reloadmapafterviewmapmode ; db
|
dw Script_reloadmapafterviewmapmode ; ab
|
||||||
|
dw Script_appearplayermock ; ac
|
||||||
assert_table_length NUM_EVENT_COMMANDS
|
assert_table_length NUM_EVENT_COMMANDS
|
||||||
|
|
||||||
StartScript:
|
StartScript:
|
||||||
@ -961,6 +962,69 @@ Script_variablesprite:
|
|||||||
ld [hl], a
|
ld [hl], a
|
||||||
ret
|
ret
|
||||||
|
|
||||||
|
Script_appearplayermock:
|
||||||
|
ld hl, .DefaultPlayerObject
|
||||||
|
ld de, wMap{d:LAST_OBJECT}Object
|
||||||
|
ld bc, OBJECT_EVENT_SIZE + 1
|
||||||
|
call CopyBytes
|
||||||
|
|
||||||
|
; adjust sprite id and palette number
|
||||||
|
ld hl, .PlayerObjectFields
|
||||||
|
.loop
|
||||||
|
ld a, [wPlayerGender]
|
||||||
|
cp [hl]
|
||||||
|
inc hl
|
||||||
|
jr nz, .next1
|
||||||
|
ld a, [wPlayerState]
|
||||||
|
cp [hl]
|
||||||
|
inc hl
|
||||||
|
jr nz, .next2
|
||||||
|
; found a match
|
||||||
|
ld a, [hli] ; sprite
|
||||||
|
ld [wMap{d:LAST_OBJECT}ObjectSprite], a
|
||||||
|
ld a, [hl] ; palette | objecttype
|
||||||
|
ld [wMap{d:LAST_OBJECT}ObjectPalette], a ; also wMap{d:LAST_OBJECT}ObjectType
|
||||||
|
jr .copy_player_coords
|
||||||
|
.next1
|
||||||
|
inc hl
|
||||||
|
.next2
|
||||||
|
inc hl
|
||||||
|
inc hl
|
||||||
|
ld a, [hl]
|
||||||
|
cp -1
|
||||||
|
jr nz, .loop
|
||||||
|
|
||||||
|
.copy_player_coords
|
||||||
|
; copy player's coordinates
|
||||||
|
ld hl, wPlayerObjectYCoord
|
||||||
|
ld de, wMap{d:LAST_OBJECT}ObjectYCoord
|
||||||
|
ld a, [hli]
|
||||||
|
ld [de], a
|
||||||
|
inc de
|
||||||
|
ld a, [hl] ; wPlayerObjectXCoord
|
||||||
|
ld [de], a ; wMap{d:LAST_OBJECT}ObjectXCoord
|
||||||
|
|
||||||
|
; display mocked player object
|
||||||
|
; it will go to the last wMapObjects slot and to whichever wObjectStructs slot
|
||||||
|
; wObjectStructs[n][MAPOBJECT_OBJECT_STRUCT_ID] links both structs
|
||||||
|
ld a, NUM_OBJECTS - 1
|
||||||
|
call UnmaskCopyMapObjectStruct
|
||||||
|
ret
|
||||||
|
|
||||||
|
.DefaultPlayerObject:
|
||||||
|
db -1 ; MAPOBJECT_OBJECT_STRUCT_ID
|
||||||
|
object_event 0, 0, SPRITE_CHRIS, SPRITEMOVEDATA_STANDING_DOWN, 0, 0, -1, -1, PAL_NPC_RED, OBJECTTYPE_SCRIPT, 0, ObjectEvent, -1
|
||||||
|
|
||||||
|
.PlayerObjectFields:
|
||||||
|
; [wPlayerGender], [wPlayerState], sprite id, palette
|
||||||
|
db 0, PLAYER_NORMAL, SPRITE_CHRIS, PAL_NPC_RED << 4 | OBJECTTYPE_SCRIPT
|
||||||
|
db 1 << PLAYERGENDER_FEMALE_F, PLAYER_NORMAL, SPRITE_KRIS, PAL_NPC_BLUE << 4 | OBJECTTYPE_SCRIPT
|
||||||
|
db 0, PLAYER_SURF, SPRITE_SURF, PAL_NPC_RED << 4 | OBJECTTYPE_SCRIPT
|
||||||
|
db 1 << PLAYERGENDER_FEMALE_F, PLAYER_SURF, SPRITE_SURF, PAL_NPC_BLUE << 4 | OBJECTTYPE_SCRIPT
|
||||||
|
db 0, PLAYER_BIKE, SPRITE_CHRIS_BIKE, PAL_NPC_RED << 4 | OBJECTTYPE_SCRIPT
|
||||||
|
db 1 << PLAYERGENDER_FEMALE_F, PLAYER_BIKE, SPRITE_KRIS_BIKE, PAL_NPC_BLUE << 4 | OBJECTTYPE_SCRIPT
|
||||||
|
db -1
|
||||||
|
|
||||||
Script_appear:
|
Script_appear:
|
||||||
call GetScriptByte
|
call GetScriptByte
|
||||||
call GetScriptObject
|
call GetScriptObject
|
||||||
|
@ -1076,4 +1076,9 @@ MACRO reloadmapafterviewmapmode
|
|||||||
db reloadmapafterviewmapmode_command
|
db reloadmapafterviewmapmode_command
|
||||||
ENDM
|
ENDM
|
||||||
|
|
||||||
|
const appearplayermock_command ; $ac
|
||||||
|
MACRO appearplayermock
|
||||||
|
db appearplayermock_command
|
||||||
|
ENDM
|
||||||
|
|
||||||
DEF NUM_EVENT_COMMANDS EQU const_value
|
DEF NUM_EVENT_COMMANDS EQU const_value
|
||||||
|
Loading…
Reference in New Issue
Block a user