More map object work

This commit is contained in:
PikalaxALT 2015-11-14 14:41:47 -05:00
parent cc8c36ee14
commit ed44de4bb4
15 changed files with 450 additions and 409 deletions

View File

@ -529,18 +529,18 @@ const_value SET 1
const OBJECT_FACING
const OBJECT_09
const OBJECT_STEP_DURATION
const OBJECT_11
const OBJECT_ACTION
const OBJECT_12
const OBJECT_FACING_STEP
const OBJECT_STANDING_TILE
const OBJECT_NEXT_TILE
const OBJECT_MAP_X
const OBJECT_MAP_Y
const OBJECT_NEXT_MAP_X
const OBJECT_NEXT_MAP_Y
const OBJECT_20
const OBJECT_21
const OBJECT_22
const OBJECT_MAP_X
const OBJECT_MAP_Y
const OBJECT_INIT_X
const OBJECT_INIT_Y
const OBJECT_RADIUS
const OBJECT_SPRITE_X
const OBJECT_SPRITE_Y
const OBJECT_SPRITE_X_OFFSET
@ -550,7 +550,7 @@ const_value SET 1
const OBJECT_29
const OBJECT_30
const OBJECT_31
const OBJECT_32
const OBJECT_RANGE
; 33-39 are not used
; map object struct
@ -651,3 +651,5 @@ NUM_SPAWNS EQU const_value
const PALETTE_NITE
const PALETTE_MORN
const PALETTE_DARK
FIXED_FACING EQU 2

View File

@ -220,15 +220,15 @@ NUM_SPRITEHEADER_FIELDS EQU const_value
const SPRITEMOVEDATA_SMASHABLE_ROCK
const SPRITEMOVEDATA_STRENGTH_BOULDER
const SPRITEMOVEDATA_FOLLOWNOTEXACT
const SPRITEMOVEDATA_1B
const SPRITEMOVEDATA_1C
const SPRITEMOVEDATA_1D
const SPRITEMOVEDATA_SHADOW
const SPRITEMOVEDATA_EMOTE
const SPRITEMOVEDATA_SCREENSHAKE
const SPRITEMOVEDATA_SPINCOUNTERCLOCKWISE
const SPRITEMOVEDATA_SPINCLOCKWISE
const SPRITEMOVEDATA_20
const SPRITEMOVEDATA_BIGDOLL
const SPRITEMOVEDATA_22
const SPRITEMOVEDATA_23
const SPRITEMOVEDATA_BOULDERDUST
const SPRITEMOVEDATA_GRASS
const SPRITEMOVEDATA_LAPRAS
const SPRITEMOVEDATA_25
NUM_SPRITEMOVEDATA EQU const_value +- 1
@ -255,23 +255,23 @@ SPRITEMOVEDATA_FIELDS EQU 6
const SPRITEMOVEFN_SCRIPTED
const SPRITEMOVEFN_STRENGTH
const SPRITEMOVEFN_FOLLOWNOTEXACT
const SPRITEMOVEFN_13
const SPRITEMOVEFN_14
const SPRITEMOVEFN_SHADOW
const SPRITEMOVEFN_EMOTE
const SPRITEMOVEFN_BIG_SNORLAX
const SPRITEMOVEFN_BOUNCE
const SPRITEMOVEFN_17
const SPRITEMOVEFN_SCREENSHAKE
const SPRITEMOVEFN_SPIN_CLOCKWISE
const SPRITEMOVEFN_SPIN_COUNTERCLOCKWISE
const SPRITEMOVEFN_1A
const SPRITEMOVEFN_1B
const SPRITEMOVEFN_BOULDERDUST
const SPRITEMOVEFN_GRASS
MAX_OUTDOOR_SPRITES EQU 23
const_def
const OBJECT_09_VALUE_00
const OBJECT_09_VALUE_01
const OBJECT_09_VALUE_02
const OBJECT_09_VALUE_03
const OBJECT_09_VALUE_01 ; standing
const OBJECT_09_VALUE_02 ; walking
const OBJECT_09_VALUE_03 ; bumping
const OBJECT_09_VALUE_04
const OBJECT_09_VALUE_05
const OBJECT_09_VALUE_06

View File

@ -368,7 +368,7 @@ CheckTileEvent: ; 96874
call CheckCoordEventScriptFlag
jr z, .coord_events_disabled
call CheckCurrentMapXYTriggers
call CheckCurrentNextMapXYTriggers
jr c, .coord_event
.coord_events_disabled

File diff suppressed because it is too large Load Diff

View File

@ -311,10 +311,10 @@ SuspendMapAnims: ; 154d3
; 154d7
LoadObjectsRunCallback_02: ; 154d7
ld a, $2
ld a, 2
call RunMapCallback
callba LoadObjectMasks
callba Function8177
callba InitializeVisibleSprites
ret
; 154ea (5:54ea)

View File

@ -127,7 +127,7 @@ Movement_step_wait5: ; 5145
ld hl, OBJECT_12
add hl, bc
ld [hl], a
ld hl, OBJECT_11
ld hl, OBJECT_ACTION
add hl, bc
ld [hl], $4
call GetMovementByte
@ -164,7 +164,7 @@ Movement_58: ; 516a
; 5189
Movement_fish_got_bite: ; 5189
ld hl, OBJECT_11
ld hl, OBJECT_ACTION
add hl, bc
ld [hl], $6
ld hl, OBJECT_09
@ -178,7 +178,7 @@ Movement_rock_smash: ; 5196
ld hl, OBJECT_STEP_DURATION
add hl, bc
ld [hl], a
ld hl, OBJECT_11
ld hl, OBJECT_ACTION
add hl, bc
ld [hl], $1
ld hl, OBJECT_09
@ -188,7 +188,7 @@ Movement_rock_smash: ; 5196
; 51ab
Movement_fish_cast_rod: ; 51ab
ld hl, OBJECT_11
ld hl, OBJECT_ACTION
add hl, bc
ld [hl], $6
ld hl, OBJECT_09
@ -262,7 +262,7 @@ Movement_remove_person: ; 51fd
; 5210
Movement_4b: ; 5210
ld hl, OBJECT_11
ld hl, OBJECT_ACTION
add hl, bc
ld [hl], $1
@ -323,7 +323,7 @@ Movement_step_sleep_common: ; 5247
add hl, bc
ld [hl], OBJECT_09_VALUE_03
ld hl, OBJECT_11
ld hl, OBJECT_ACTION
add hl, bc
ld [hl], $1
@ -341,7 +341,7 @@ Movement_step_bump: ; 525f
ld hl, OBJECT_09
add hl, bc
ld [hl], OBJECT_09_VALUE_0B
ld hl, OBJECT_11
ld hl, OBJECT_ACTION
add hl, bc
ld [hl], $3
ld hl, OBJECT_DIRECTION_WALKING
@ -358,7 +358,7 @@ Movement_56: ; 5279
ld hl, OBJECT_09
add hl, bc
ld [hl], OBJECT_09_VALUE_03
ld hl, OBJECT_11
ld hl, OBJECT_ACTION
add hl, bc
ld [hl], $b
ld hl, OBJECT_DIRECTION_WALKING
@ -384,14 +384,14 @@ Movement_39: ; 529c
Movement_remove_fixed_facing: ; 52a5
ld hl, OBJECT_FLAGS1
add hl, bc
res 2, [hl]
res FIXED_FACING, [hl]
jp ContinueReadingMovement
; 52ae
Movement_fix_facing: ; 52ae
ld hl, OBJECT_FLAGS1
add hl, bc
set 2, [hl]
set FIXED_FACING, [hl]
jp ContinueReadingMovement
; 52b7
@ -410,12 +410,12 @@ Movement_hide_person: ; 52c0
; 52c9
Movement_hide_emote: ; 52c9
call Function5579
call DespawnEmote
jp ContinueReadingMovement
; 52cf
Movement_show_emote: ; 52cf
call Function5547
call SpawnEmote
jp ContinueReadingMovement
; 52d5
@ -424,7 +424,7 @@ Movement_step_shake: ; 52d5
; displacement (DecimalParam)
call GetMovementByte
call Function5565
call ShakeScreen
jp ContinueReadingMovement
; 52de
@ -448,7 +448,7 @@ TurnHead: ; 52ee
ld hl, OBJECT_FACING
add hl, bc
ld [hl], a
ld hl, OBJECT_11
ld hl, OBJECT_ACTION
add hl, bc
ld [hl], $1
ld hl, OBJECT_DIRECTION_WALKING
@ -721,7 +721,7 @@ HalfStep: ; 5400
ld hl, OBJECT_29
add hl, bc
ld [hl], a
ld hl, OBJECT_11
ld hl, OBJECT_ACTION
add hl, bc
ld [hl], $2
ld hl, OBJECT_09
@ -733,7 +733,7 @@ HalfStep: ; 5400
NormalStep: ; 5412
call Function4690
call Function463f
ld hl, OBJECT_11
ld hl, OBJECT_ACTION
add hl, bc
ld [hl], $2
ld hl, OBJECT_STANDING_TILE
@ -746,7 +746,7 @@ NormalStep: ; 5412
jr c, .asm_5430
.asm_542d
call Function5556
call ShakeGrass
.asm_5430
ld hl, wd4cf
@ -769,7 +769,7 @@ NormalStep: ; 5412
TurningStep: ; 5446
call Function4690
call Function463f
ld hl, OBJECT_11
ld hl, OBJECT_ACTION
add hl, bc
ld [hl], $4
ld hl, wd4cf
@ -792,7 +792,7 @@ TurningStep: ; 5446
SlideStep: ; 5468
call Function4690
call Function463f
ld hl, OBJECT_11
ld hl, OBJECT_ACTION
add hl, bc
ld [hl], $1
ld hl, wd4cf
@ -820,10 +820,10 @@ JumpStep: ; 548a
ld hl, OBJECT_FLAGS2
add hl, bc
res 3, [hl]
ld hl, OBJECT_11
ld hl, OBJECT_ACTION
add hl, bc
ld [hl], $2
call Function5529
call SpawnShadow
ld hl, wd4cf
ld a, [hMapObjectIndexBuffer]
cp [hl]

View File

@ -732,9 +732,9 @@ EmotesPointers: ; 144d
emote_header BoltEmote, 4, VTiles1 tile $78
emote_header SleepEmote, 4, VTiles1 tile $78
emote_header FishEmote, 4, VTiles1 tile $78
emote_header FishingRodGFX1, 1, VTiles1 tile $7c
emote_header JumpShadowGFX, 1, VTiles1 tile $7c
emote_header FishingRodGFX2, 2, VTiles1 tile $7c
emote_header FishingRodGFX3, 2, VTiles1 tile $7e
emote_header BoulderDustGFX, 2, VTiles1 tile $7e
emote_header FishingRodGFX4, 1, VTiles1 tile $7e
; 14495

View File

@ -1508,19 +1508,19 @@ FacingPlayerDistance:: ; 36ad
; Return carry if the sprite at bc is facing the player,
; and its distance in d.
ld hl, OBJECT_MAP_X ; x
ld hl, OBJECT_NEXT_MAP_X ; x
add hl, bc
ld d, [hl]
ld hl, OBJECT_MAP_Y ; y
ld hl, OBJECT_NEXT_MAP_Y ; y
add hl, bc
ld e, [hl]
ld a, [PlayerMapX]
ld a, [PlayerNextMapX]
cp d
jr z, .CheckY
ld a, [PlayerMapY]
ld a, [PlayerNextMapY]
cp e
jr z, .CheckX
@ -1528,7 +1528,7 @@ FacingPlayerDistance:: ; 36ad
ret
.CheckY
ld a, [PlayerMapY]
ld a, [PlayerNextMapY]
sub e
jr z, .NotFacing
jr nc, .Above
@ -1546,7 +1546,7 @@ FacingPlayerDistance:: ; 36ad
jr .CheckFacing
.CheckX
ld a, [PlayerMapX]
ld a, [PlayerNextMapX]
sub d
jr z, .NotFacing
jr nc, .Left

View File

@ -258,10 +258,10 @@ GetDestinationWarpNumber:: ; 2252
; 2266
.GetDestinationWarpNumber ; 2266
ld a, [PlayerMapY]
ld a, [PlayerNextMapY]
sub $4
ld e, a
ld a, [PlayerMapX]
ld a, [PlayerNextMapX]
sub $4
ld d, a
ld a, [wCurrMapWarpCount]
@ -570,11 +570,11 @@ ReadWarps:: ; 23da
ReadCoordEvents:: ; 23f1
ld a, [hli]
ld c, a
ld [wCurrentMapXYTriggerCount], a
ld [wCurrentNextMapXYTriggerCount], a
ld a, l
ld [wCurrentMapXYTriggerHeaderPointer], a
ld [wCurrentNextMapXYTriggerHeaderPointer], a
ld a, h
ld [wCurrentMapXYTriggerHeaderPointer + 1], a
ld [wCurrentNextMapXYTriggerHeaderPointer + 1], a
ld a, c
and a
@ -1594,9 +1594,9 @@ Function2914:: ; 2914
call GetLeftRightCollision
call GetUpDownCollision
; get coords of current tile
ld a, [PlayerMapX]
ld a, [PlayerNextMapX]
ld d, a
ld a, [PlayerMapY]
ld a, [PlayerNextMapY]
ld e, a
call GetCoordTile
ld [PlayerStandingTile], a
@ -1623,9 +1623,9 @@ Function2914:: ; 2914
; 294d
GetUpDownCollision:: ; 294d
ld a, [PlayerMapX]
ld a, [PlayerNextMapX]
ld d, a
ld a, [PlayerMapY]
ld a, [PlayerNextMapY]
ld e, a
push de
@ -1643,9 +1643,9 @@ GetUpDownCollision:: ; 294d
; 296c
GetLeftRightCollision:: ; 296c
ld a, [PlayerMapX]
ld a, [PlayerNextMapX]
ld d, a
ld a, [PlayerMapY]
ld a, [PlayerNextMapY]
ld e, a
push de
@ -1772,10 +1772,10 @@ endr
ld h, [hl]
ld l, a
ld a, [PlayerMapX]
ld a, [PlayerNextMapX]
add d
ld d, a
ld a, [PlayerMapY]
ld a, [PlayerNextMapY]
add e
ld e, a
ld a, [hl]
@ -1928,9 +1928,9 @@ CheckIfFacingTileCoordIsSign:: ; 2aaa
ret
; 2ad4
CheckCurrentMapXYTriggers:: ; 2ad4
CheckCurrentNextMapXYTriggers:: ; 2ad4
; If there are no xy triggers, we don't need to be here.
ld a, [wCurrentMapXYTriggerCount]
ld a, [wCurrentNextMapXYTriggerCount]
and a
ret z
; Copy the trigger count into c.
@ -1947,7 +1947,7 @@ CheckCurrentMapXYTriggers:: ; 2ad4
CheckStandingOnXYTrigger:: ; 2ae7
; Checks to see if you are standing on an xy-trigger. If yes, copies the trigger to EngineBuffer1 and sets carry.
ld hl, wCurrentMapXYTriggerHeaderPointer
ld hl, wCurrentNextMapXYTriggerHeaderPointer
ld a, [hli]
ld h, [hl]
ld l, a
@ -1955,10 +1955,10 @@ CheckStandingOnXYTrigger:: ; 2ae7
call CheckTriggers
ld b, a
; Load your current coordinates into de. This will be used to check if your position is in the xy-trigger table for the current map.
ld a, [PlayerMapX]
ld a, [PlayerNextMapX]
sub 4
ld d, a
ld a, [PlayerMapY]
ld a, [PlayerNextMapY]
sub 4
ld e, a

View File

@ -6,7 +6,9 @@ GetSpritePalette:: ; 17ff
push de
push bc
ld c, a
callba _GetSpritePalette
ld a, c
pop bc
pop de
@ -15,7 +17,7 @@ GetSpritePalette:: ; 17ff
; 180e
Function180e:: ; 180e
GetSpriteVTile:: ; 180e
push hl
push bc
ld hl, UsedSprites + 2
@ -571,7 +573,7 @@ endr
ld [hl], a
ld a, [bc]
inc bc
ld hl, OBJECT_11
ld hl, OBJECT_ACTION
add hl, de
ld [hl], a
ld a, [bc]
@ -659,6 +661,7 @@ GetObjectSprite:: ; 1af1
; 1af8
SetSpriteDirection:: ; 1af8
; preserves other flags
push af
ld hl, OBJECT_FACING
add hl, bc

243
main.asm
View File

@ -2178,10 +2178,10 @@ Function6ec1: ; 6ec1
Function6f07: ; 6f07
call Function6f5f
ret c
ld hl, OBJECT_MAP_X
ld hl, OBJECT_NEXT_MAP_X
add hl, bc
ld d, [hl]
ld hl, OBJECT_MAP_Y
ld hl, OBJECT_NEXT_MAP_Y
add hl, bc
ld e, [hl]
ld hl, OBJECT_PALETTE
@ -2351,14 +2351,14 @@ CheckFacingObject:: ; 6fd9
call CheckCounterTile
jr nz, .asm_6ff1
ld a, [PlayerMapX]
ld a, [PlayerNextMapX]
sub d
cpl
inc a
add d
ld d, a
ld a, [PlayerMapY]
ld a, [PlayerNextMapY]
sub e
cpl
inc a
@ -2386,10 +2386,10 @@ CheckFacingObject:: ; 6fd9
Function7009: ; 7009
ld hl, OBJECT_MAP_X
ld hl, OBJECT_NEXT_MAP_X
add hl, bc
ld d, [hl]
ld hl, OBJECT_MAP_Y
ld hl, OBJECT_NEXT_MAP_Y
add hl, bc
ld e, [hl]
jr IsNPCAtCoord
@ -2403,10 +2403,10 @@ Function7015: ; unreferenced
ret
Function7021: ; 7021
ld hl, OBJECT_MAP_X
ld hl, OBJECT_NEXT_MAP_X
add hl, bc
ld d, [hl]
ld hl, OBJECT_MAP_Y
ld hl, OBJECT_NEXT_MAP_Y
add hl, bc
ld e, [hl]
call GetSpriteDirection
@ -2455,12 +2455,12 @@ IsNPCAtCoord: ; 7041
jr .ok2
.got
ld hl, OBJECT_MAP_X
ld hl, OBJECT_NEXT_MAP_X
add hl, bc
ld a, [hl]
cp d
jr nz, .ok
ld hl, OBJECT_MAP_Y
ld hl, OBJECT_NEXT_MAP_Y
add hl, bc
ld a, [hl]
cp e
@ -2474,12 +2474,12 @@ IsNPCAtCoord: ; 7041
jr nz, .setcarry
.ok
ld hl, OBJECT_NEXT_MAP_X
ld hl, OBJECT_MAP_X
add hl, bc
ld a, [hl]
cp d
jr nz, .next
ld hl, OBJECT_NEXT_MAP_Y
ld hl, OBJECT_MAP_Y
add hl, bc
ld a, [hl]
cp e
@ -2508,7 +2508,7 @@ IsNPCAtCoord: ; 7041
; 70a4
Function70a4: ; 70a4
ld hl, OBJECT_22
ld hl, OBJECT_RADIUS
add hl, bc
ld a, [hl]
and a
@ -2517,7 +2517,7 @@ Function70a4: ; 70a4
jr z, .asm_70c7
ld e, a
ld d, a
ld hl, OBJECT_20
ld hl, OBJECT_INIT_X
add hl, bc
ld a, [hl]
sub d
@ -2525,7 +2525,7 @@ Function70a4: ; 70a4
ld a, [hl]
add e
ld e, a
ld hl, OBJECT_MAP_X
ld hl, OBJECT_NEXT_MAP_X
add hl, bc
ld a, [hl]
cp d
@ -2534,7 +2534,7 @@ Function70a4: ; 70a4
jr z, .asm_70eb
.asm_70c7
ld hl, OBJECT_22
ld hl, OBJECT_RADIUS
add hl, bc
ld a, [hl]
swap a
@ -2542,7 +2542,7 @@ Function70a4: ; 70a4
jr z, .asm_70e9
ld e, a
ld d, a
ld hl, OBJECT_21
ld hl, OBJECT_INIT_Y
add hl, bc
ld a, [hl]
sub d
@ -2550,7 +2550,7 @@ Function70a4: ; 70a4
ld a, [hl]
add e
ld e, a
ld hl, OBJECT_MAP_Y
ld hl, OBJECT_NEXT_MAP_Y
add hl, bc
ld a, [hl]
cp d
@ -2568,7 +2568,7 @@ Function70a4: ; 70a4
; 70ed
Function70ed: ; 70ed
ld hl, OBJECT_MAP_X
ld hl, OBJECT_NEXT_MAP_X
add hl, bc
ld a, [XCoord]
cp [hl]
@ -2579,7 +2579,7 @@ Function70ed: ; 70ed
jr c, .asm_7111
.asm_70fe
ld hl, OBJECT_MAP_Y
ld hl, OBJECT_NEXT_MAP_Y
add hl, bc
ld a, [YCoord]
cp [hl]
@ -2599,9 +2599,9 @@ Function70ed: ; 70ed
; 7113
Function7113: ; unreferenced
ld a, [PlayerMapX]
ld a, [PlayerNextMapX]
ld d, a
ld a, [PlayerMapY]
ld a, [PlayerNextMapY]
ld e, a
ld bc, ObjectStructs
xor a
@ -2619,12 +2619,12 @@ Function7113: ; unreferenced
jr .asm_7160
.asm_7136
ld hl, OBJECT_MAP_Y
ld hl, OBJECT_NEXT_MAP_Y
add hl, bc
ld a, [hl]
cp e
jr nz, .asm_714e
ld hl, OBJECT_MAP_X
ld hl, OBJECT_NEXT_MAP_X
add hl, bc
ld a, [hl]
cp d
@ -2635,12 +2635,12 @@ Function7113: ; unreferenced
jr .asm_716f
.asm_714e
ld hl, OBJECT_NEXT_MAP_Y
ld hl, OBJECT_MAP_Y
add hl, bc
ld a, [hl]
cp e
jr nz, .asm_7160
ld hl, OBJECT_NEXT_MAP_X
ld hl, OBJECT_MAP_X
add hl, bc
ld a, [hl]
cp d
@ -2666,14 +2666,14 @@ Function7113: ; unreferenced
Function7171: ; 7171
ld hl, OBJECT_MAP_X
ld hl, OBJECT_NEXT_MAP_X
add hl, bc
ld a, d
sub [hl]
jr c, .asm_718b
cp $2
jr nc, .asm_718b
ld hl, OBJECT_MAP_Y
ld hl, OBJECT_NEXT_MAP_Y
add hl, bc
ld a, e
sub [hl]
@ -3235,7 +3235,7 @@ GetSpawnCoord: ; 8029
ld a, $0
ld [hObjectStructIndexBuffer], a
ld de, ObjectStructs
call Function8116
call CopyMapObjectToObjectStruct
ld a, $0
ld [wd4cf], a
ret
@ -3281,10 +3281,10 @@ WritePersonXY:: ; 80a1
call CheckObjectVisibility
ret c
ld hl, OBJECT_MAP_X
ld hl, OBJECT_NEXT_MAP_X
add hl, bc
ld d, [hl]
ld hl, OBJECT_MAP_Y
ld hl, OBJECT_NEXT_MAP_Y
add hl, bc
ld e, [hl]
ld a, [hMapObjectIndexBuffer]
@ -3298,23 +3298,23 @@ RefreshPlayerCoords: ; 80b8
ld a, [XCoord]
add 4
ld d, a
ld hl, PlayerMapX
ld hl, PlayerNextMapX
sub [hl]
ld [hl], d
ld hl, MapObjects + MAPOBJECT_X_COORD
ld [hl], d
ld hl, PlayerNextMapX
ld hl, PlayerMapX
ld [hl], d
ld d, a
ld a, [YCoord]
add 4
ld e, a
ld hl, PlayerMapY
ld hl, PlayerNextMapY
sub [hl]
ld [hl], e
ld hl, MapObjects + MAPOBJECT_Y_COORD
ld [hl], e
ld hl, PlayerNextMapY
ld hl, PlayerMapY
ld [hl], e
ld e, a
ld a, [wObjectFollow_Leader]
@ -3328,6 +3328,7 @@ CopyObjectStruct:: ; 80e7
call CheckObjectMask
and a
ret nz ; masked
ld hl, ObjectStructs + OBJECT_STRUCT_LENGTH * 1
ld a, 1
ld de, OBJECT_STRUCT_LENGTH
@ -3342,77 +3343,87 @@ CopyObjectStruct:: ; 80e7
cp NUM_OBJECT_STRUCTS
jr nz, .loop
scf
ret
ret ; overflow
.done
ld d, h
ld e, l
call Function8116
call CopyMapObjectToObjectStruct
ld hl, VramState
bit 7, [hl]
ret z
ld hl, OBJECT_FLAGS2
add hl, de
set 5, [hl]
ret
; 8116
Function8116: ; 8116
call Function811d
call Function8286
CopyMapObjectToObjectStruct: ; 8116
call .CopyMapObjectToTempObject
call CopyTempObjectToObjectStruct
ret
; 811d
Function811d: ; 811d
.CopyMapObjectToTempObject: ; 811d
ld a, [hObjectStructIndexBuffer]
ld hl, MAPOBJECT_OBJECT_STRUCT_ID
add hl, bc
ld [hl], a
ld a, [hMapObjectIndexBuffer]
ld [wc2f0], a
ld [wTempObjectCopyMapObjectIndex], a
ld hl, MAPOBJECT_SPRITE
add hl, bc
ld a, [hl]
ld [wc2f1], a
call Function180e
ld [wc2f2], a
ld [wTempObjectCopySprite], a
call GetSpriteVTile
ld [wTempObjectCopySpriteVTile], a
ld a, [hl]
call GetSpritePalette
ld [wc2f3], a
ld [wTempObjectCopyPalette], a
ld hl, MAPOBJECT_COLOR
add hl, bc
ld a, [hl]
and $f0
jr z, .no_color
jr z, .skip_color_override
swap a
and $7
ld [wc2f3], a
and $7 ; OAM_PALETTE
ld [wTempObjectCopyPalette], a
.no_color
.skip_color_override
ld hl, MAPOBJECT_MOVEMENT
add hl, bc
ld a, [hl]
ld [wc2f4], a
ld [wTempObjectCopyMovement], a
ld hl, MAPOBJECT_RANGE
add hl, bc
ld a, [hl]
ld [wc2f5], a
ld [wTempObjectCopyRange], a
ld hl, MAPOBJECT_X_COORD
add hl, bc
ld a, [hl]
ld [wc2f6], a
ld [wTempObjectCopyX], a
ld hl, MAPOBJECT_Y_COORD
add hl, bc
ld a, [hl]
ld [wc2f7], a
ld [wTempObjectCopyY], a
ld hl, MAPOBJECT_RADIUS
add hl, bc
ld a, [hl]
ld [wc2f8], a
ld [wTempObjectCopyRadius], a
ret
; 8177
Function8177: ; 8177
InitializeVisibleSprites: ; 8177
ld bc, MapObjects + OBJECT_LENGTH
ld a, 1
.loop
@ -3422,35 +3433,42 @@ Function8177: ; 8177
ld a, [hl]
and a
jr z, .next
ld hl, MAPOBJECT_OBJECT_STRUCT_ID
add hl, bc
ld a, [hl]
cp -1
jr nz, .next
ld a, [XCoord]
ld d, a
ld a, [YCoord]
ld e, a
ld hl, MAPOBJECT_X_COORD
add hl, bc
ld a, [hl]
add 1
sub d
jr c, .next
cp MAPOBJECT_SCREEN_WIDTH
jr nc, .next
ld hl, MAPOBJECT_Y_COORD
add hl, bc
ld a, [hl]
add 1
sub e
jr c, .next
cp MAPOBJECT_SCREEN_HEIGHT
jr nc, .next
push bc
call CopyObjectStruct
pop bc
jp c, Function81c9
jp c, .ret
.next
ld hl, OBJECT_LENGTH
@ -3464,7 +3482,7 @@ Function8177: ; 8177
ret
; 81c9
Function81c9: ; 81c9
.ret: ; 81c9
ret
; 81ca
@ -3473,12 +3491,12 @@ Function81ca:: ; 81ca
ld a, [wd151]
cp $ff
ret z
ld hl, Table81d6
ld hl, .jumptable
rst JumpTable
ret
; 81d6
Table81d6: ; 81d6
.jumptable: ; 81d6
dw Function81e5
dw Function81de
dw Function8232
@ -3602,32 +3620,33 @@ Function823e: ; 823e
; 8286
Function8286: ; 8286
ld a, [wc2f0]
CopyTempObjectToObjectStruct: ; 8286
ld a, [wTempObjectCopyMapObjectIndex]
ld hl, OBJECT_MAP_OBJECT_INDEX
add hl, de
ld [hl], a
ld a, [wc2f4]
ld a, [wTempObjectCopyMovement]
call Function1a61
ld a, [wc2f3]
ld a, [wTempObjectCopyPalette]
ld hl, OBJECT_PALETTE
add hl, de
or [hl]
ld [hl], a
ld a, [wc2f7]
call Function82d5
ld a, [wTempObjectCopyY]
call .InitYCoord
ld a, [wc2f6]
call Function82f1
ld a, [wTempObjectCopyX]
call .InitXCoord
ld a, [wc2f1]
ld a, [wTempObjectCopySprite]
ld hl, OBJECT_SPRITE
add hl, de
ld [hl], a
ld a, [wc2f2]
ld a, [wTempObjectCopySpriteVTile]
ld hl, OBJECT_SPRITE_TILE
add hl, de
ld [hl], a
@ -3638,13 +3657,13 @@ Function8286: ; 8286
ld hl, OBJECT_FACING_STEP
add hl, de
ld [hl], $ff
ld [hl], STANDING
ld a, [wc2f8]
call Function830d
ld a, [wTempObjectCopyRadius]
call .InitRadius
ld a, [wc2f5]
ld hl, OBJECT_32
ld a, [wTempObjectCopyRange]
ld hl, OBJECT_RANGE
add hl, de
ld [hl], a
@ -3652,13 +3671,15 @@ Function8286: ; 8286
ret
; 82d5
Function82d5: ; 82d5
ld hl, OBJECT_21
.InitYCoord: ; 82d5
ld hl, OBJECT_INIT_Y
add hl, de
ld [hl], a
ld hl, OBJECT_MAP_Y
ld hl, OBJECT_NEXT_MAP_Y
add hl, de
ld [hl], a
ld hl, YCoord
sub [hl]
and $f
@ -3671,11 +3692,11 @@ Function82d5: ; 82d5
ret
; 82f1
Function82f1: ; 82f1
ld hl, OBJECT_20
.InitXCoord: ; 82f1
ld hl, OBJECT_INIT_X
add hl, de
ld [hl], a
ld hl, OBJECT_MAP_X
ld hl, OBJECT_NEXT_MAP_X
add hl, de
ld [hl], a
ld hl, XCoord
@ -3690,7 +3711,7 @@ Function82f1: ; 82f1
ret
; 830d
Function830d: ; 830d
.InitRadius: ; 830d
ld h, a
inc a
and $f
@ -3699,7 +3720,7 @@ Function830d: ; 830d
add $10
and $f0
or l
ld hl, OBJECT_22
ld hl, OBJECT_RADIUS
add hl, de
ld [hl], a
ret
@ -3749,19 +3770,19 @@ TrainerWalkToPlayer: ; 831e
call GetObjectStruct
; get last talked coords, load to bc
ld hl, OBJECT_MAP_X
ld hl, OBJECT_NEXT_MAP_X
add hl, bc
ld a, [hl]
ld hl, OBJECT_MAP_Y
ld hl, OBJECT_NEXT_MAP_Y
add hl, bc
ld c, [hl]
ld b, a
; get player coords, load to de
ld hl, OBJECT_MAP_X
ld hl, OBJECT_NEXT_MAP_X
add hl, de
ld a, [hl]
ld hl, OBJECT_MAP_Y
ld hl, OBJECT_NEXT_MAP_Y
add hl, de
ld e, [hl]
ld d, a
@ -3815,15 +3836,15 @@ FollowNotExact:: ; 839e
ret c
; Person 2 is now in bc, person 1 is now in de
ld hl, OBJECT_MAP_X
ld hl, OBJECT_NEXT_MAP_X
add hl, bc
ld a, [hl]
ld hl, OBJECT_MAP_Y
ld hl, OBJECT_NEXT_MAP_Y
add hl, bc
ld c, [hl]
ld b, a
ld hl, OBJECT_MAP_X
ld hl, OBJECT_NEXT_MAP_X
add hl, de
ld a, [hl]
cp b
@ -3837,7 +3858,7 @@ FollowNotExact:: ; 839e
jr .continue
.same_x
ld hl, OBJECT_MAP_Y
ld hl, OBJECT_NEXT_MAP_Y
add hl, de
ld a, [hl]
cp c
@ -3850,7 +3871,7 @@ FollowNotExact:: ; 839e
dec c
.continue
ld hl, OBJECT_MAP_X
ld hl, OBJECT_NEXT_MAP_X
add hl, de
ld [hl], b
ld a, b
@ -3863,7 +3884,7 @@ FollowNotExact:: ; 839e
ld hl, OBJECT_SPRITE_X
add hl, de
ld [hl], a
ld hl, OBJECT_MAP_Y
ld hl, OBJECT_NEXT_MAP_Y
add hl, de
ld [hl], c
ld a, c
@ -3877,7 +3898,7 @@ FollowNotExact:: ; 839e
add hl, de
ld [hl], a
ld a, [hObjectStructIndexBuffer]
ld hl, OBJECT_32
ld hl, OBJECT_RANGE
add hl, de
ld [hl], a
ld hl, OBJECT_MOVEMENTTYPE
@ -3920,10 +3941,10 @@ GetRelativeFacing:: ; 8417
; load the coordinates of object d into bc
ld a, d
call GetObjectStruct
ld hl, OBJECT_MAP_X
ld hl, OBJECT_NEXT_MAP_X
add hl, bc
ld a, [hl]
ld hl, OBJECT_MAP_Y
ld hl, OBJECT_NEXT_MAP_Y
add hl, bc
ld c, [hl]
ld b, a
@ -3931,10 +3952,10 @@ GetRelativeFacing:: ; 8417
; load the coordinates of object e into de
ld a, e
call GetObjectStruct
ld hl, OBJECT_MAP_X
ld hl, OBJECT_NEXT_MAP_X
add hl, bc
ld d, [hl]
ld hl, OBJECT_MAP_Y
ld hl, OBJECT_NEXT_MAP_Y
add hl, bc
ld e, [hl]
pop bc
@ -4014,15 +4035,15 @@ Function848a: ; 848a
Function849d: ; 849d
ld a, [wObjectFollow_Leader]
call GetObjectStruct
ld hl, OBJECT_MAP_X
ld hl, OBJECT_NEXT_MAP_X
add hl, bc
ld d, [hl]
ld hl, OBJECT_MAP_Y
ld hl, OBJECT_NEXT_MAP_Y
add hl, bc
ld e, [hl]
ld a, [wObjectFollow_Follower]
call GetObjectStruct
ld hl, OBJECT_MAP_X
ld hl, OBJECT_NEXT_MAP_X
add hl, bc
ld a, d
cp [hl]
@ -4038,7 +4059,7 @@ Function849d: ; 849d
ret
.check_y
ld hl, OBJECT_MAP_Y
ld hl, OBJECT_NEXT_MAP_Y
add hl, bc
ld a, e
cp [hl]
@ -34646,13 +34667,13 @@ IsNPCInFront: ; 80341
ld a, 0
ld [hMapObjectIndexBuffer], a
; Load the next X coordinate into d
ld a, [PlayerMapX]
ld a, [PlayerNextMapX]
ld d, a
ld a, [WalkingX]
add d
ld d, a
; Load the next Y coordinate into e
ld a, [PlayerMapY]
ld a, [PlayerNextMapY]
ld e, a
ld a, [WalkingY]
add e
@ -34701,7 +34722,7 @@ Function8036f: ; 8036f
ld a, [WalkingDirection]
ld d, a
ld hl, OBJECT_32
ld hl, OBJECT_RANGE
add hl, bc
ld a, [hl]
and $fc
@ -50413,9 +50434,9 @@ HeartEmote: INCBIN "gfx/emotes/heart.2bpp"
BoltEmote: INCBIN "gfx/emotes/bolt.2bpp"
SleepEmote: INCBIN "gfx/emotes/sleep.2bpp"
FishEmote: INCBIN "gfx/emotes/fish.2bpp"
FishingRodGFX1: INCBIN "gfx/misc/fishing1.2bpp"
JumpShadowGFX: INCBIN "gfx/misc/shadow.2bpp"
FishingRodGFX2: INCBIN "gfx/misc/fishing2.2bpp"
FishingRodGFX3: INCBIN "gfx/misc/fishing3.2bpp"
BoulderDustGFX: INCBIN "gfx/misc/boulderdust.2bpp"
FishingRodGFX4: INCBIN "gfx/misc/fishing4.2bpp"
@ -50770,7 +50791,7 @@ CheckMovingOffEdgeOfMap:: ; 104820 (41:4820)
ret
.down
ld a, [PlayerMapY]
ld a, [PlayerNextMapY]
sub 4
ld b, a
ld a, [MapHeight]
@ -50781,7 +50802,7 @@ CheckMovingOffEdgeOfMap:: ; 104820 (41:4820)
ret
.up
ld a, [PlayerMapY]
ld a, [PlayerNextMapY]
sub 4
cp -1
jr z, .ok
@ -50789,7 +50810,7 @@ CheckMovingOffEdgeOfMap:: ; 104820 (41:4820)
ret
.left
ld a, [PlayerMapX]
ld a, [PlayerNextMapX]
sub $4
cp -1
jr z, .ok
@ -50797,7 +50818,7 @@ CheckMovingOffEdgeOfMap:: ; 104820 (41:4820)
ret
.right
ld a, [PlayerMapX]
ld a, [PlayerNextMapX]
sub 4
ld b, a
ld a, [MapWidth]

View File

@ -48,7 +48,7 @@ Tileset03Anim: ; 0xfc01b
dw NULL, AnimateFlowerTile
dw NULL, WaitTileAnimation
dw NULL, WaitTileAnimation
dw NULL, NextTileFrame8
dw NULL, CurTileFrame8
dw NULL, DoneTileAnimation
; 0xfc047
@ -62,7 +62,7 @@ Tileset25Anim: ; 0xfc047
dw NULL, AnimateFlowerTile
dw NULL, WaitTileAnimation
dw NULL, WaitTileAnimation
dw NULL, NextTileFrame8
dw NULL, CurTileFrame8
dw NULL, DoneTileAnimation
; 0xfc073
@ -77,7 +77,7 @@ Tileset31Anim: ; 0xfc073
dw NULL, AnimateFlowerTile
dw VTiles2 tile $14, AnimateWaterTile
dw NULL, TileAnimationPalette
dw NULL, NextTileFrame8
dw NULL, CurTileFrame8
dw NULL, DoneTileAnimation
; 0xfc0a3
@ -93,7 +93,7 @@ Tileset01Anim: ; 0xfc0a3
dw WhirlpoolFrames3, AnimateWhirlpoolTile
dw WhirlpoolFrames4, AnimateWhirlpoolTile
dw NULL, WaitTileAnimation
dw NULL, NextTileFrame8
dw NULL, CurTileFrame8
dw NULL, DoneTileAnimation
; 0xfc0d7
@ -136,7 +136,7 @@ Tileset09Anim: ; 0xfc12f
dw NULL, WaitTileAnimation
dw NULL, WaitTileAnimation
dw NULL, WaitTileAnimation
dw NULL, NextTileFrame8
dw NULL, CurTileFrame8
dw NULL, DoneTileAnimation
; 0xfc15f
@ -147,7 +147,7 @@ Tileset15Anim: ; 0xfc15f
dw NULL, WaitTileAnimation
dw NULL, SafariFountainAnim1
dw NULL, WaitTileAnimation
dw NULL, NextTileFrame8
dw NULL, CurTileFrame8
dw NULL, DoneTileAnimation
; 0xfc17f
@ -239,7 +239,7 @@ Tileset23Anim: ; 0xfc27f
dw SproutPillarTilePointer4, AnimateSproutPillarTile
dw SproutPillarTilePointer1, AnimateSproutPillarTile
dw SproutPillarTilePointer2, AnimateSproutPillarTile
dw NULL, NextTileFrame
dw NULL, CurTileFrame
dw NULL, WaitTileAnimation
dw NULL, WaitTileAnimation
dw NULL, WaitTileAnimation
@ -302,7 +302,7 @@ WaitTileAnimation: ; fc2fe
ret
; fc2ff
NextTileFrame8: ; fc2ff
CurTileFrame8: ; fc2ff
ld a, [TileAnimationTimer]
inc a
and a, 7
@ -806,7 +806,7 @@ AnimateSproutPillarTile: ; fc645
; fc673
NextTileFrame: ; fc673
CurTileFrame: ; fc673
ld hl, TileAnimationTimer
inc [hl]
ret

View File

@ -327,15 +327,17 @@ wc2e6:: ds 4
wc2ea:: ds 1
wMovementPointer:: ds 2 ; c2eb
ds 3
wc2f0:: ds 1
wc2f1:: ds 1
wc2f2:: ds 1
wc2f3:: ds 1
wc2f4:: ds 1
wc2f5:: ds 1
wc2f6:: ds 1
wc2f7:: ds 1
wc2f8:: ds 1
wTempObjectCopyMapObjectIndex:: ds 1 ; c2f0
wTempObjectCopySprite:: ds 1 ; c2f1
wTempObjectCopySpriteVTile:: ds 1 ; c2f2
wTempObjectCopyPalette:: ds 1 ; c2f3
wTempObjectCopyMovement:: ds 1 ; c2f4
wTempObjectCopyRange:: ds 1 ; c2f5
wTempObjectCopyX:: ds 1 ; c2f6
wTempObjectCopyY:: ds 1 ; c2f7
wTempObjectCopyRadius:: ds 1 ; c2f8
ds 1
TileDown:: ; c2fa
@ -1743,7 +1745,7 @@ wd152:: ds 1
wBGMapAnchorHi::
wd153:: ds 1
UsedSprites:: ds 64
UsedSprites:: ds 64 ; d154
UsedSpritesEnd::
ds UsedSprites - @
@ -2222,11 +2224,11 @@ object_struct: MACRO
\1Object12:: ds 1
\1Facing:: ds 1
\1StandingTile:: ds 1 ; collision
\1NextTile:: ds 1 ; collision
\1MapX:: ds 1
\1MapY:: ds 1
\1CurTile:: ds 1 ; collision
\1NextMapX:: ds 1
\1NextMapY:: ds 1
\1MapX:: ds 1
\1MapY:: ds 1
ds 3
\1SpriteX:: ds 1
\1SpriteY:: ds 1
@ -2548,8 +2550,8 @@ wCurrentCaller:: ds 2
wCurrMapWarpCount:: ds 1
wCurrMapWarpHeaderPointer:: ds 1
wdbfd:: ds 1
wCurrentMapXYTriggerCount:: ds 1
wCurrentMapXYTriggerHeaderPointer:: ds 1
wCurrentNextMapXYTriggerCount:: ds 1
wCurrentNextMapXYTriggerHeaderPointer:: ds 1
wdc00:: ds 1
wCurrentMapSignpostCount:: ds 1
wCurrentMapSignpostHeaderPointer::