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_FACING
const OBJECT_09 const OBJECT_09
const OBJECT_STEP_DURATION const OBJECT_STEP_DURATION
const OBJECT_11 const OBJECT_ACTION
const OBJECT_12 const OBJECT_12
const OBJECT_FACING_STEP const OBJECT_FACING_STEP
const OBJECT_STANDING_TILE const OBJECT_STANDING_TILE
const OBJECT_NEXT_TILE const OBJECT_NEXT_TILE
const OBJECT_MAP_X
const OBJECT_MAP_Y
const OBJECT_NEXT_MAP_X const OBJECT_NEXT_MAP_X
const OBJECT_NEXT_MAP_Y const OBJECT_NEXT_MAP_Y
const OBJECT_20 const OBJECT_MAP_X
const OBJECT_21 const OBJECT_MAP_Y
const OBJECT_22 const OBJECT_INIT_X
const OBJECT_INIT_Y
const OBJECT_RADIUS
const OBJECT_SPRITE_X const OBJECT_SPRITE_X
const OBJECT_SPRITE_Y const OBJECT_SPRITE_Y
const OBJECT_SPRITE_X_OFFSET const OBJECT_SPRITE_X_OFFSET
@ -550,7 +550,7 @@ const_value SET 1
const OBJECT_29 const OBJECT_29
const OBJECT_30 const OBJECT_30
const OBJECT_31 const OBJECT_31
const OBJECT_32 const OBJECT_RANGE
; 33-39 are not used ; 33-39 are not used
; map object struct ; map object struct
@ -651,3 +651,5 @@ NUM_SPAWNS EQU const_value
const PALETTE_NITE const PALETTE_NITE
const PALETTE_MORN const PALETTE_MORN
const PALETTE_DARK 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_SMASHABLE_ROCK
const SPRITEMOVEDATA_STRENGTH_BOULDER const SPRITEMOVEDATA_STRENGTH_BOULDER
const SPRITEMOVEDATA_FOLLOWNOTEXACT const SPRITEMOVEDATA_FOLLOWNOTEXACT
const SPRITEMOVEDATA_1B const SPRITEMOVEDATA_SHADOW
const SPRITEMOVEDATA_1C const SPRITEMOVEDATA_EMOTE
const SPRITEMOVEDATA_1D const SPRITEMOVEDATA_SCREENSHAKE
const SPRITEMOVEDATA_SPINCOUNTERCLOCKWISE const SPRITEMOVEDATA_SPINCOUNTERCLOCKWISE
const SPRITEMOVEDATA_SPINCLOCKWISE const SPRITEMOVEDATA_SPINCLOCKWISE
const SPRITEMOVEDATA_20 const SPRITEMOVEDATA_20
const SPRITEMOVEDATA_BIGDOLL const SPRITEMOVEDATA_BIGDOLL
const SPRITEMOVEDATA_22 const SPRITEMOVEDATA_BOULDERDUST
const SPRITEMOVEDATA_23 const SPRITEMOVEDATA_GRASS
const SPRITEMOVEDATA_LAPRAS const SPRITEMOVEDATA_LAPRAS
const SPRITEMOVEDATA_25 const SPRITEMOVEDATA_25
NUM_SPRITEMOVEDATA EQU const_value +- 1 NUM_SPRITEMOVEDATA EQU const_value +- 1
@ -255,23 +255,23 @@ SPRITEMOVEDATA_FIELDS EQU 6
const SPRITEMOVEFN_SCRIPTED const SPRITEMOVEFN_SCRIPTED
const SPRITEMOVEFN_STRENGTH const SPRITEMOVEFN_STRENGTH
const SPRITEMOVEFN_FOLLOWNOTEXACT const SPRITEMOVEFN_FOLLOWNOTEXACT
const SPRITEMOVEFN_13 const SPRITEMOVEFN_SHADOW
const SPRITEMOVEFN_14 const SPRITEMOVEFN_EMOTE
const SPRITEMOVEFN_BIG_SNORLAX const SPRITEMOVEFN_BIG_SNORLAX
const SPRITEMOVEFN_BOUNCE const SPRITEMOVEFN_BOUNCE
const SPRITEMOVEFN_17 const SPRITEMOVEFN_SCREENSHAKE
const SPRITEMOVEFN_SPIN_CLOCKWISE const SPRITEMOVEFN_SPIN_CLOCKWISE
const SPRITEMOVEFN_SPIN_COUNTERCLOCKWISE const SPRITEMOVEFN_SPIN_COUNTERCLOCKWISE
const SPRITEMOVEFN_1A const SPRITEMOVEFN_BOULDERDUST
const SPRITEMOVEFN_1B const SPRITEMOVEFN_GRASS
MAX_OUTDOOR_SPRITES EQU 23 MAX_OUTDOOR_SPRITES EQU 23
const_def const_def
const OBJECT_09_VALUE_00 const OBJECT_09_VALUE_00
const OBJECT_09_VALUE_01 const OBJECT_09_VALUE_01 ; standing
const OBJECT_09_VALUE_02 const OBJECT_09_VALUE_02 ; walking
const OBJECT_09_VALUE_03 const OBJECT_09_VALUE_03 ; bumping
const OBJECT_09_VALUE_04 const OBJECT_09_VALUE_04
const OBJECT_09_VALUE_05 const OBJECT_09_VALUE_05
const OBJECT_09_VALUE_06 const OBJECT_09_VALUE_06

View File

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

File diff suppressed because it is too large Load Diff

View File

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

View File

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

View File

@ -732,9 +732,9 @@ EmotesPointers: ; 144d
emote_header BoltEmote, 4, VTiles1 tile $78 emote_header BoltEmote, 4, VTiles1 tile $78
emote_header SleepEmote, 4, VTiles1 tile $78 emote_header SleepEmote, 4, VTiles1 tile $78
emote_header FishEmote, 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 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 emote_header FishingRodGFX4, 1, VTiles1 tile $7e
; 14495 ; 14495

View File

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

View File

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

View File

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

259
main.asm
View File

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

View File

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

View File

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