mirror of
https://gitlab.com/xCrystal/pokecrystal-board.git
synced 2024-11-16 11:27:33 -08:00
Relabel some map_object
struct fields (#1029)
This commit is contained in:
parent
2d40e99d11
commit
c01409be5a
@ -104,10 +104,14 @@ DEF MAPOBJECT_Y_COORD rb ; 2
|
|||||||
DEF MAPOBJECT_X_COORD rb ; 3
|
DEF MAPOBJECT_X_COORD rb ; 3
|
||||||
DEF MAPOBJECT_MOVEMENT rb ; 4
|
DEF MAPOBJECT_MOVEMENT rb ; 4
|
||||||
DEF MAPOBJECT_RADIUS rb ; 5
|
DEF MAPOBJECT_RADIUS rb ; 5
|
||||||
DEF MAPOBJECT_HOUR rb ; 6
|
DEF MAPOBJECT_HOUR_1 rb ; 6
|
||||||
|
DEF MAPOBJECT_HOUR_2 rb ; 7
|
||||||
|
rsset MAPOBJECT_HOUR_2
|
||||||
DEF MAPOBJECT_TIMEOFDAY rb ; 7
|
DEF MAPOBJECT_TIMEOFDAY rb ; 7
|
||||||
DEF MAPOBJECT_COLOR rb ; 8
|
DEF MAPOBJECT_PALETTE rb ; 8
|
||||||
DEF MAPOBJECT_RANGE rb ; 9
|
rsset MAPOBJECT_PALETTE
|
||||||
|
DEF MAPOBJECT_TYPE rb ; 8
|
||||||
|
DEF MAPOBJECT_SIGHT_RANGE rb ; 9
|
||||||
DEF MAPOBJECT_SCRIPT_POINTER rw ; a
|
DEF MAPOBJECT_SCRIPT_POINTER rw ; a
|
||||||
DEF MAPOBJECT_EVENT_FLAG rw ; c
|
DEF MAPOBJECT_EVENT_FLAG rw ; c
|
||||||
rb_skip 2
|
rb_skip 2
|
||||||
@ -115,6 +119,9 @@ DEF MAPOBJECT_LENGTH EQU _RS
|
|||||||
DEF NUM_OBJECTS EQU 16
|
DEF NUM_OBJECTS EQU 16
|
||||||
DEF PLAYER_OBJECT EQU 0
|
DEF PLAYER_OBJECT EQU 0
|
||||||
|
|
||||||
|
DEF MAPOBJECT_PALETTE_MASK EQU %11110000
|
||||||
|
DEF MAPOBJECT_TYPE_MASK EQU %00001111
|
||||||
|
|
||||||
; SpriteMovementData struct members (see data/sprites/map_objects.asm)
|
; SpriteMovementData struct members (see data/sprites/map_objects.asm)
|
||||||
rsreset
|
rsreset
|
||||||
DEF SPRITEMOVEATTR_MOVEMENT rb ; 0
|
DEF SPRITEMOVEATTR_MOVEMENT rb ; 0
|
||||||
|
@ -546,10 +546,10 @@ TryObjectEvent:
|
|||||||
|
|
||||||
ldh a, [hLastTalked]
|
ldh a, [hLastTalked]
|
||||||
call GetMapObject
|
call GetMapObject
|
||||||
ld hl, MAPOBJECT_COLOR
|
ld hl, MAPOBJECT_TYPE
|
||||||
add hl, bc
|
add hl, bc
|
||||||
ld a, [hl]
|
ld a, [hl]
|
||||||
and %00001111
|
and MAPOBJECT_TYPE_MASK
|
||||||
|
|
||||||
; BUG: TryObjectEvent arbitrary code execution (see docs/bugs_and_glitches.md)
|
; BUG: TryObjectEvent arbitrary code execution (see docs/bugs_and_glitches.md)
|
||||||
push bc
|
push bc
|
||||||
|
@ -27,7 +27,7 @@ SpawnPlayer:
|
|||||||
call PlayerSpawn_ConvertCoords
|
call PlayerSpawn_ConvertCoords
|
||||||
ld a, PLAYER_OBJECT
|
ld a, PLAYER_OBJECT
|
||||||
call GetMapObject
|
call GetMapObject
|
||||||
ld hl, MAPOBJECT_COLOR
|
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]
|
ld a, [wPlayerSpriteSetupFlags]
|
||||||
@ -188,10 +188,10 @@ CopyMapObjectToObjectStruct:
|
|||||||
call GetSpritePalette
|
call GetSpritePalette
|
||||||
ld [wTempObjectCopyPalette], a
|
ld [wTempObjectCopyPalette], a
|
||||||
|
|
||||||
ld hl, MAPOBJECT_COLOR
|
ld hl, MAPOBJECT_PALETTE
|
||||||
add hl, bc
|
add hl, bc
|
||||||
ld a, [hl]
|
ld a, [hl]
|
||||||
and $f0
|
and MAPOBJECT_PALETTE_MASK
|
||||||
jr z, .skip_color_override
|
jr z, .skip_color_override
|
||||||
swap a
|
swap a
|
||||||
and PALETTE_MASK
|
and PALETTE_MASK
|
||||||
@ -203,7 +203,7 @@ CopyMapObjectToObjectStruct:
|
|||||||
ld a, [hl]
|
ld a, [hl]
|
||||||
ld [wTempObjectCopyMovement], a
|
ld [wTempObjectCopyMovement], a
|
||||||
|
|
||||||
ld hl, MAPOBJECT_RANGE
|
ld hl, MAPOBJECT_SIGHT_RANGE
|
||||||
add hl, bc
|
add hl, bc
|
||||||
ld a, [hl]
|
ld a, [hl]
|
||||||
ld [wTempObjectCopyRange], a
|
ld [wTempObjectCopyRange], a
|
||||||
|
@ -227,7 +227,7 @@ CheckObjectVisibility::
|
|||||||
ret
|
ret
|
||||||
|
|
||||||
CheckObjectTime::
|
CheckObjectTime::
|
||||||
ld hl, MAPOBJECT_HOUR
|
ld hl, MAPOBJECT_HOUR_1
|
||||||
add hl, bc
|
add hl, bc
|
||||||
ld a, [hl]
|
ld a, [hl]
|
||||||
cp -1
|
cp -1
|
||||||
@ -264,10 +264,10 @@ CheckObjectTime::
|
|||||||
db NITE
|
db NITE
|
||||||
|
|
||||||
.check_hour
|
.check_hour
|
||||||
ld hl, MAPOBJECT_HOUR
|
ld hl, MAPOBJECT_HOUR_1
|
||||||
add hl, bc
|
add hl, bc
|
||||||
ld d, [hl]
|
ld d, [hl]
|
||||||
ld hl, MAPOBJECT_TIMEOFDAY
|
ld hl, MAPOBJECT_HOUR_2
|
||||||
add hl, bc
|
add hl, bc
|
||||||
ld e, [hl]
|
ld e, [hl]
|
||||||
ld hl, hHours
|
ld hl, hHours
|
||||||
|
@ -31,10 +31,10 @@ _CheckTrainerBattle::
|
|||||||
jr z, .next
|
jr z, .next
|
||||||
|
|
||||||
; Is a trainer
|
; Is a trainer
|
||||||
ld hl, MAPOBJECT_COLOR
|
ld hl, MAPOBJECT_TYPE
|
||||||
add hl, de
|
add hl, de
|
||||||
ld a, [hl]
|
ld a, [hl]
|
||||||
and $f
|
and MAPOBJECT_TYPE_MASK
|
||||||
cp OBJECTTYPE_TRAINER
|
cp OBJECTTYPE_TRAINER
|
||||||
jr nz, .next
|
jr nz, .next
|
||||||
|
|
||||||
@ -51,7 +51,7 @@ _CheckTrainerBattle::
|
|||||||
jr nc, .next
|
jr nc, .next
|
||||||
|
|
||||||
; ...within their sight range
|
; ...within their sight range
|
||||||
ld hl, MAPOBJECT_RANGE
|
ld hl, MAPOBJECT_SIGHT_RANGE
|
||||||
add hl, de
|
add hl, de
|
||||||
ld a, [hl]
|
ld a, [hl]
|
||||||
cp b
|
cp b
|
||||||
|
@ -330,18 +330,20 @@ MACRO object_struct
|
|||||||
ENDM
|
ENDM
|
||||||
|
|
||||||
MACRO map_object
|
MACRO map_object
|
||||||
\1ObjectStructID:: db
|
\1ObjectStructID:: db
|
||||||
\1ObjectSprite:: db
|
\1ObjectSprite:: db
|
||||||
\1ObjectYCoord:: db
|
\1ObjectYCoord:: db
|
||||||
\1ObjectXCoord:: db
|
\1ObjectXCoord:: db
|
||||||
\1ObjectMovement:: db
|
\1ObjectMovement:: db
|
||||||
\1ObjectRadius:: db
|
\1ObjectRadius:: db
|
||||||
\1ObjectHour:: db
|
\1ObjectHour1:: db
|
||||||
\1ObjectTimeOfDay:: db
|
\1ObjectHour2::
|
||||||
\1ObjectColor:: db
|
\1ObjectTimeOfDay:: db
|
||||||
\1ObjectRange:: db
|
\1ObjectPalette::
|
||||||
\1ObjectScript:: dw
|
\1ObjectType:: db
|
||||||
\1ObjectEventFlag:: dw
|
\1ObjectSightRange:: db
|
||||||
|
\1ObjectScript:: dw
|
||||||
|
\1ObjectEventFlag:: dw
|
||||||
ds 2
|
ds 2
|
||||||
ENDM
|
ENDM
|
||||||
|
|
||||||
|
@ -114,7 +114,7 @@ MACRO object_event
|
|||||||
; * if h1 == h2, the object_event will always appear
|
; * if h1 == h2, the object_event will always appear
|
||||||
; * if h1 == -1, h2 is treated as a time-of-day value:
|
; * if h1 == -1, h2 is treated as a time-of-day value:
|
||||||
; a combo of MORN, DAY, and/or NITE, or -1 to always appear
|
; a combo of MORN, DAY, and/or NITE, or -1 to always appear
|
||||||
;\9: color: a PAL_NPC_* constant, or 0 for sprite default
|
;\9: palette: a PAL_NPC_* constant, or 0 for sprite default
|
||||||
;\<10>: function: a OBJECTTYPE_* constant
|
;\<10>: function: a OBJECTTYPE_* constant
|
||||||
;\<11>: sight range: applies to OBJECTTYPE_TRAINER
|
;\<11>: sight range: applies to OBJECTTYPE_TRAINER
|
||||||
;\<12>: script pointer
|
;\<12>: script pointer
|
||||||
|
Loading…
Reference in New Issue
Block a user