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

File diff suppressed because it is too large Load Diff

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::