Identify more sprite move data flag bits

This commit is contained in:
Rangi 2018-05-23 22:01:21 -04:00
parent 85f7328bf8
commit 1840af8b4f
6 changed files with 128 additions and 108 deletions

View File

@ -44,21 +44,32 @@ OW_LEFT EQU LEFT << 2
OW_RIGHT EQU RIGHT << 2
; object_struct OBJECT_FLAGS1 bit flags
INVISIBLE_F EQU 0
FIXED_FACING_F EQU 2
SLIDING_F EQU 3
EMOTE_OBJECT_F EQU 7
const_def
const INVISIBLE_F ; 0
const WONT_DELETE_F ; 1
const FIXED_FACING_F ; 2
const SLIDING_F ; 3
const NOCLIP_TILES_F ; 4
const MOVE_ANYWHERE_F ; 5
const NOCLIP_OBJS_F ; 6
const EMOTE_OBJECT_F ; 7
INVISIBLE EQU 1 << INVISIBLE_F
FIXED_FACING EQU 1 << FIXED_FACING_F
SLIDING EQU 1 << SLIDING_F
EMOTE_OBJECT EQU 1 << EMOTE_OBJECT_F
INVISIBLE EQU 1 << INVISIBLE_F
WONT_DELETE EQU 1 << WONT_DELETE_F
FIXED_FACING EQU 1 << FIXED_FACING_F
SLIDING EQU 1 << SLIDING_F
NOCLIP_TILES EQU 1 << NOCLIP_TILES_F
MOVE_ANYWHERE EQU 1 << MOVE_ANYWHERE_F
NOCLIP_OBJS EQU 1 << NOCLIP_OBJS_F
EMOTE_OBJECT EQU 1 << EMOTE_OBJECT_F
; object_struct OBJECT_FLAGS2 bit flags
LOW_PRIORITY_F EQU 0
HIGH_PRIORITY_F EQU 1
OVERHEAD_F EQU 3
USE_OBP1_F EQU 4
const_def
const LOW_PRIORITY_F ; 0
const HIGH_PRIORITY_F ; 1
const OBJ_FLAGS2_2 ; 2
const OVERHEAD_F ; 3
const USE_OBP1_F ; 4
LOW_PRIORITY EQU 1 << LOW_PRIORITY_F
HIGH_PRIORITY EQU 1 << HIGH_PRIORITY_F
@ -66,14 +77,22 @@ OVERHEAD EQU 1 << OVERHEAD_F
USE_OBP1 EQU 1 << USE_OBP1_F
; object_struct OBJECT_PALETTE bit flags
SWIMMING_F EQU 5
STRENGTH_BOULDER_F EQU 6
BIG_OBJECT_F EQU 7
const_def 5
const SWIMMING_F ; 5
const STRENGTH_BOULDER_F ; 6
const BIG_OBJECT_F ; 7
SWIMMING EQU 1 << SWIMMING_F
STRENGTH_BOULDER EQU 1 << STRENGTH_BOULDER_F
BIG_OBJECT EQU 1 << BIG_OBJECT_F
; facing attribute bit flags
RELATIVE_ATTRIBUTES_F EQU 1
ABSOLUTE_TILE_ID_F EQU 2
RELATIVE_ATTRIBUTES EQU 1 << RELATIVE_ATTRIBUTES_F
ABSOLUTE_TILE_ID EQU 1 << ABSOLUTE_TILE_ID_F
; map_object struct members (see macros/wram.asm)
const_def
const MAPOBJECT_OBJECT_STRUCT_ID ; 0
@ -104,8 +123,8 @@ OBJECT_LENGTH EQU const_value
const SPRITEMOVEATTR_PALFLAGS ; 5
NUM_SPRITEMOVEDATA_FIELDS EQU const_value
MAPOBJECT_SCREEN_HEIGHT EQU 11
MAPOBJECT_SCREEN_WIDTH EQU 12
MAPOBJECT_SCREEN_WIDTH EQU (SCREEN_WIDTH / 2) + 2
MAPOBJECT_SCREEN_HEIGHT EQU (SCREEN_HEIGHT / 2) + 2
; SpriteMovementData indexes (see data/sprites/map_objects.asm)

View File

@ -50,24 +50,24 @@ FacingWeirdTree2: ; standing down
db 4 ; #
db 0, 0, 0, $00
db 0, 8, 0, $01
db 8, 0, 2, $02
db 8, 8, 2, $03
db 8, 0, RELATIVE_ATTRIBUTES, $02
db 8, 8, RELATIVE_ATTRIBUTES, $03
; 409c
FacingStepDown1: ; walking down 1
db 4 ; #
db 0, 0, 0, $80
db 0, 8, 0, $81
db 8, 0, 2, $82
db 8, 8, 2, $83
db 8, 0, RELATIVE_ATTRIBUTES, $82
db 8, 8, RELATIVE_ATTRIBUTES, $83
; 40ad
FacingStepDown3: ; walking down 2
db 4 ; #
db 0, 8, X_FLIP, $80
db 0, 0, X_FLIP, $81
db 8, 8, 2 | X_FLIP, $82
db 8, 0, 2 | X_FLIP, $83
db 8, 8, RELATIVE_ATTRIBUTES | X_FLIP, $82
db 8, 0, RELATIVE_ATTRIBUTES | X_FLIP, $83
; 40be
FacingStepUp0:
@ -75,24 +75,24 @@ FacingStepUp2: ; standing up
db 4 ; #
db 0, 0, 0, $04
db 0, 8, 0, $05
db 8, 0, 2, $06
db 8, 8, 2, $07
db 8, 0, RELATIVE_ATTRIBUTES, $06
db 8, 8, RELATIVE_ATTRIBUTES, $07
; 40cf
FacingStepUp1: ; walking up 1
db 4 ; #
db 0, 0, 0, $84
db 0, 8, 0, $85
db 8, 0, 2, $86
db 8, 8, 2, $87
db 8, 0, RELATIVE_ATTRIBUTES, $86
db 8, 8, RELATIVE_ATTRIBUTES, $87
; 40e0
FacingStepUp3: ; walking up 2
db 4 ; #
db 0, 8, X_FLIP, $84
db 0, 0, X_FLIP, $85
db 8, 8, 2 | X_FLIP, $86
db 8, 0, 2 | X_FLIP, $87
db 8, 8, RELATIVE_ATTRIBUTES | X_FLIP, $86
db 8, 0, RELATIVE_ATTRIBUTES | X_FLIP, $87
; 40f1
FacingStepLeft0:
@ -100,8 +100,8 @@ FacingStepLeft2: ; standing left
db 4 ; #
db 0, 0, 0, $08
db 0, 8, 0, $09
db 8, 0, 2, $0a
db 8, 8, 2, $0b
db 8, 0, RELATIVE_ATTRIBUTES, $0a
db 8, 8, RELATIVE_ATTRIBUTES, $0b
; 4102
FacingStepRight0:
@ -109,8 +109,8 @@ FacingStepRight2: ; standing right
db 4 ; #
db 0, 8, X_FLIP, $08
db 0, 0, X_FLIP, $09
db 8, 8, 2 | X_FLIP, $0a
db 8, 0, 2 | X_FLIP, $0b
db 8, 8, RELATIVE_ATTRIBUTES | X_FLIP, $0a
db 8, 0, RELATIVE_ATTRIBUTES | X_FLIP, $0b
; 4113
FacingStepLeft1:
@ -118,8 +118,8 @@ FacingStepLeft3: ; walking left
db 4 ; #
db 0, 0, 0, $88
db 0, 8, 0, $89
db 8, 0, 2, $8a
db 8, 8, 2, $8b
db 8, 0, RELATIVE_ATTRIBUTES, $8a
db 8, 8, RELATIVE_ATTRIBUTES, $8b
; 4124
FacingStepRight1:
@ -127,58 +127,58 @@ FacingStepRight3: ; walking right
db 4 ; #
db 0, 8, X_FLIP, $88
db 0, 0, X_FLIP, $89
db 8, 8, 2 | X_FLIP, $8a
db 8, 0, 2 | X_FLIP, $8b
db 8, 8, RELATIVE_ATTRIBUTES | X_FLIP, $8a
db 8, 0, RELATIVE_ATTRIBUTES | X_FLIP, $8b
; 4135
FacingFishDown: ; fishing down
db 5 ; #
db 0, 0, 0, $00
db 0, 8, 0, $01
db 8, 0, 2, $02
db 8, 8, 2, $03
db 16, 0, 4, $fc
db 8, 0, RELATIVE_ATTRIBUTES, $02
db 8, 8, RELATIVE_ATTRIBUTES, $03
db 16, 0, ABSOLUTE_TILE_ID, $fc
; 414a
FacingFishUp: ; fishing up
db 5 ; #
db 0, 0, 0, $04
db 0, 8, 0, $05
db 8, 0, 2, $06
db 8, 8, 2, $07
db -8, 0, 4, $fc
db 8, 0, RELATIVE_ATTRIBUTES, $06
db 8, 8, RELATIVE_ATTRIBUTES, $07
db -8, 0, ABSOLUTE_TILE_ID, $fc
; 415f
FacingFishLeft: ; fishing left
db 5 ; #
db 0, 0, 0, $08
db 0, 8, 0, $09
db 8, 0, 2, $0a
db 8, 8, 2, $0b
db 5, -8, 4 | X_FLIP, $fd
db 8, 0, RELATIVE_ATTRIBUTES, $0a
db 8, 8, RELATIVE_ATTRIBUTES, $0b
db 5, -8, ABSOLUTE_TILE_ID | X_FLIP, $fd
; 4174
FacingFishRight: ; fishing right
db 5 ; #
db 0, 8, X_FLIP, $08
db 0, 0, X_FLIP, $09
db 8, 8, 2 | X_FLIP, $0a
db 8, 0, 2 | X_FLIP, $0b
db 5, 16, 4, $fd
db 8, 8, RELATIVE_ATTRIBUTES | X_FLIP, $0a
db 8, 0, RELATIVE_ATTRIBUTES | X_FLIP, $0b
db 5, 16, ABSOLUTE_TILE_ID, $fd
; 4189
FacingEmote: ; emote
db 4 ; #
db 0, 0, 4, $f8
db 0, 8, 4, $f9
db 8, 0, 4, $fa
db 8, 8, 4, $fb
db 0, 0, ABSOLUTE_TILE_ID, $f8
db 0, 8, ABSOLUTE_TILE_ID, $f9
db 8, 0, ABSOLUTE_TILE_ID, $fa
db 8, 8, ABSOLUTE_TILE_ID, $fb
; 419a
FacingShadow: ; shadow
db 2 ; #
db 0, 0, 4, $fc
db 0, 8, 4 | X_FLIP, $fc
db 0, 0, ABSOLUTE_TILE_ID, $fc
db 0, 8, ABSOLUTE_TILE_ID | X_FLIP, $fc
; 41a3
FacingBigDollSymmetric: ; big snorlax or lapras doll
@ -237,28 +237,28 @@ FacingBigDollAsymmetric: ; big doll other than snorlax or lapras
FacingBoulderDust1: ; boulder dust 1
db 4 ; #
db 0, 0, 4, $fe
db 0, 8, 4, $fe
db 8, 0, 4, $fe
db 8, 8, 4, $fe
db 0, 0, ABSOLUTE_TILE_ID, $fe
db 0, 8, ABSOLUTE_TILE_ID, $fe
db 8, 0, ABSOLUTE_TILE_ID, $fe
db 8, 8, ABSOLUTE_TILE_ID, $fe
; 4250
FacingBoulderDust2: ; boulder dust 2
db 4 ; #
db 0, 0, 4, $ff
db 0, 8, 4, $ff
db 8, 0, 4, $ff
db 8, 8, 4, $ff
db 0, 0, ABSOLUTE_TILE_ID, $ff
db 0, 8, ABSOLUTE_TILE_ID, $ff
db 8, 0, ABSOLUTE_TILE_ID, $ff
db 8, 8, ABSOLUTE_TILE_ID, $ff
; 4261
FacingGrass1: ; 4261
db 2 ; #
db 8, 0, 4, $fe
db 8, 8, 4 | X_FLIP, $fe
db 8, 0, ABSOLUTE_TILE_ID, $fe
db 8, 8, ABSOLUTE_TILE_ID | X_FLIP, $fe
; 426a
FacingGrass2: ; 426a
db 2 ; #
db 9, -1, 4, $fe
db 9, 9, 4 | X_FLIP, $fe
db 9, -1, ABSOLUTE_TILE_ID, $fe
db 9, 9, ABSOLUTE_TILE_ID | X_FLIP, $fe
; 4273

View File

@ -5,7 +5,7 @@ SpriteMovementData:: ; 4273
db SPRITEMOVEFN_00 ; movement function
db DOWN ; facing
db OBJECT_ACTION_STAND ; action
db 1 << 1 ; flags1
db WONT_DELETE ; flags1
db 0 ; flags2
db 0 ; palette flags
@ -93,7 +93,7 @@ SpriteMovementData:: ; 4273
db SPRITEMOVEFN_OBEY_DPAD ; movement function
db DOWN ; facing
db OBJECT_ACTION_STAND ; action
db 1 << 1 ; flags1
db WONT_DELETE ; flags1
db 0 ; flags2
db 0 ; palette flags
@ -157,7 +157,7 @@ SpriteMovementData:: ; 4273
db SPRITEMOVEFN_FOLLOW ; movement function
db DOWN ; facing
db OBJECT_ACTION_STAND ; action
db 1 << 1 ; flags1
db WONT_DELETE ; flags1
db 0 ; flags2
db 0 ; palette flags
@ -165,7 +165,7 @@ SpriteMovementData:: ; 4273
db SPRITEMOVEFN_SCRIPTED ; movement function
db DOWN ; facing
db OBJECT_ACTION_STAND ; action
db 1 << 1 ; flags1
db WONT_DELETE ; flags1
db 0 ; flags2
db 0 ; palette flags
@ -173,7 +173,7 @@ SpriteMovementData:: ; 4273
db SPRITEMOVEFN_BIG_SNORLAX ; movement function
db DOWN ; facing
db OBJECT_ACTION_BIG_DOLL_SYM ; action
db 1 << 1 | FIXED_FACING | SLIDING | 1 << 5 ; flags1
db WONT_DELETE | FIXED_FACING | SLIDING | MOVE_ANYWHERE ; flags1
db LOW_PRIORITY ; flags2
db STRENGTH_BOULDER | BIG_OBJECT ; palette flags
@ -181,7 +181,7 @@ SpriteMovementData:: ; 4273
db SPRITEMOVEFN_BOUNCE ; movement function
db DOWN ; facing
db OBJECT_ACTION_BOUNCE ; action
db 1 << 1 | FIXED_FACING | SLIDING | 1 << 5 ; flags1
db WONT_DELETE | FIXED_FACING | SLIDING | MOVE_ANYWHERE ; flags1
db 0 ; flags2
db 0 ; palette flags
@ -197,7 +197,7 @@ SpriteMovementData:: ; 4273
db SPRITEMOVEFN_STANDING ; movement function
db DOWN ; facing
db OBJECT_ACTION_STAND ; action
db 1 << 1 | FIXED_FACING | SLIDING | 1 << 5 ; flags1
db WONT_DELETE | FIXED_FACING | SLIDING | MOVE_ANYWHERE ; flags1
db USE_OBP1 ; flags2
db 0 ; palette flags
@ -205,7 +205,7 @@ SpriteMovementData:: ; 4273
db SPRITEMOVEFN_STRENGTH ; movement function
db DOWN ; facing
db OBJECT_ACTION_STAND ; action
db 1 << 1 | FIXED_FACING | SLIDING | 1 << 5 ; flags1
db WONT_DELETE | FIXED_FACING | SLIDING | MOVE_ANYWHERE ; flags1
db 0 ; flags2
db STRENGTH_BOULDER ; palette flags
@ -213,7 +213,7 @@ SpriteMovementData:: ; 4273
db SPRITEMOVEFN_FOLLOWNOTEXACT ; movement function
db DOWN ; facing
db OBJECT_ACTION_STAND ; action
db 1 << 1 ; flags1
db WONT_DELETE ; flags1
db 0 ; flags2
db 0 ; palette flags
@ -221,7 +221,7 @@ SpriteMovementData:: ; 4273
db SPRITEMOVEFN_SHADOW ; movement function
db DOWN ; facing
db OBJECT_ACTION_00 ; action
db 1 << 1 | FIXED_FACING | SLIDING | EMOTE_OBJECT ; flags1
db WONT_DELETE | FIXED_FACING | SLIDING | EMOTE_OBJECT ; flags1
db LOW_PRIORITY ; flags2
db 0 ; palette flags
@ -229,7 +229,7 @@ SpriteMovementData:: ; 4273
db SPRITEMOVEFN_EMOTE ; movement function
db DOWN ; facing
db OBJECT_ACTION_EMOTE ; action
db 1 << 1 | FIXED_FACING | SLIDING | EMOTE_OBJECT ; flags1
db WONT_DELETE | FIXED_FACING | SLIDING | EMOTE_OBJECT ; flags1
db HIGH_PRIORITY ; flags2
db 0 ; palette flags
@ -237,7 +237,7 @@ SpriteMovementData:: ; 4273
db SPRITEMOVEFN_SCREENSHAKE ; movement function
db DOWN ; facing
db OBJECT_ACTION_00 ; action
db 1 << 1 | EMOTE_OBJECT ; flags1
db WONT_DELETE | EMOTE_OBJECT ; flags1
db 0 ; flags2
db 0 ; palette flags
@ -261,7 +261,7 @@ SpriteMovementData:: ; 4273
db SPRITEMOVEFN_STRENGTH ; movement function
db DOWN ; facing
db OBJECT_ACTION_BIG_DOLL_ASYM ; action
db 1 << 1 | FIXED_FACING | SLIDING | 1 << 5 ; flags1
db WONT_DELETE | FIXED_FACING | SLIDING | MOVE_ANYWHERE ; flags1
db LOW_PRIORITY ; flags2
db STRENGTH_BOULDER | BIG_OBJECT ; palette flags
@ -269,7 +269,7 @@ SpriteMovementData:: ; 4273
db SPRITEMOVEFN_STRENGTH ; movement function
db DOWN ; facing
db OBJECT_ACTION_BIG_DOLL ; action
db 1 << 1 | FIXED_FACING | SLIDING | 1 << 5 ; flags1
db WONT_DELETE | FIXED_FACING | SLIDING | MOVE_ANYWHERE ; flags1
db LOW_PRIORITY ; flags2
db STRENGTH_BOULDER | BIG_OBJECT ; palette flags
@ -277,7 +277,7 @@ SpriteMovementData:: ; 4273
db SPRITEMOVEFN_BOULDERDUST ; movement function
db DOWN ; facing
db OBJECT_ACTION_BOULDER_DUST ; action
db 1 << 1 | FIXED_FACING | SLIDING | EMOTE_OBJECT ; flags1
db WONT_DELETE | FIXED_FACING | SLIDING | EMOTE_OBJECT ; flags1
db LOW_PRIORITY ; flags2
db 0 ; palette flags
@ -285,7 +285,7 @@ SpriteMovementData:: ; 4273
db SPRITEMOVEFN_GRASS ; movement function
db DOWN ; facing
db OBJECT_ACTION_GRASS_SHAKE ; action
db 1 << 1 | FIXED_FACING | SLIDING | EMOTE_OBJECT ; flags1
db WONT_DELETE | FIXED_FACING | SLIDING | EMOTE_OBJECT ; flags1
db HIGH_PRIORITY ; flags2
db 0 ; palette flags

View File

@ -1194,11 +1194,11 @@ In [engine/overworld/npc_movement.asm](/engine/overworld/npc_movement.asm):
```asm
ld hl, OBJECT_FLAGS1
add hl, bc
bit 4, [hl] ; lost, uncomment next line to fix
; jr nz, .resume
bit NOCLIP_TILES_F, [hl] ; lost, uncomment next line to fix
; jr nz, .noclip_tiles
```
**Fix:** Uncomment `jr nz, .resume`.
**Fix:** Uncomment `jr nz, .noclip_tiles`.
## `CheckOwnMon` only checks the first five letters of OT names

View File

@ -93,7 +93,7 @@ Function437b: ; 437b
.ok2
ld hl, OBJECT_FLAGS1
add hl, bc
bit 1, [hl]
bit WONT_DELETE_F, [hl]
jr nz, .yes2
call DeleteMapObject
scf
@ -3063,7 +3063,7 @@ InitSprites: ; 5991
ld e, [hl]
inc hl
ld a, [hFFC1]
bit 2, e
bit ABSOLUTE_TILE_ID_F, e
jr z, .nope1
xor a
.nope1
@ -3072,7 +3072,7 @@ InitSprites: ; 5991
ld [bc], a ; tile id
inc c
ld a, e
bit 1, a
bit RELATIVE_ATTRIBUTES_F, a
jr z, .nope2
ld a, [hFFC2]
or e

View File

@ -7,31 +7,32 @@ Function6ec1: ; 6ec1
ld hl, OBJECT_FLAGS1
add hl, bc
bit 4, [hl] ; lost, uncomment next line to fix
; jr nz, .resume
bit NOCLIP_TILES_F, [hl] ; lost, uncomment next line to fix
; jr nz, .noclip_tiles
push hl
push bc
call Function6f2c
call WillObjectBumpIntoLand
pop bc
pop hl
ret c
jr .resume
jr .continue
.not_swimming
ld hl, OBJECT_FLAGS1
add hl, bc
bit 4, [hl]
jr nz, .resume
bit NOCLIP_TILES_F, [hl]
jr nz, .noclip_tiles
push hl
push bc
call Function6f07
call WillObjectBumpIntoWater
pop bc
pop hl
ret c
.resume
bit 6, [hl]
jr nz, .bit_6
.noclip_tiles
.continue
bit NOCLIP_OBJS_F, [hl]
jr nz, .noclip_objs
push hl
push bc
@ -40,9 +41,9 @@ Function6ec1: ; 6ec1
pop hl
ret c
.bit_6
bit 5, [hl]
jr nz, .bit_5
.noclip_objs
bit MOVE_ANYWHERE_F, [hl]
jr nz, .move_anywhere
push hl
call HasObjectReachedMovementLimit
pop hl
@ -53,13 +54,13 @@ Function6ec1: ; 6ec1
pop hl
ret c
.bit_5
.move_anywhere
and a
ret
; 6f07
Function6f07: ; 6f07
WillObjectBumpIntoWater: ; 6f07
call Function6f5f
ret c
ld hl, OBJECT_NEXT_MAP_X
@ -78,12 +79,12 @@ Function6f07: ; 6f07
ld d, a
call GetTileCollision
and a ; LANDTILE
jr z, Function6f3e
jr z, WillObjectBumpIntoTile
scf
ret
; 6f2c
Function6f2c: ; 6f2c
WillObjectBumpIntoLand: ; 6f2c
call Function6f5f
ret c
ld hl, OBJECT_NEXT_TILE
@ -91,12 +92,12 @@ Function6f2c: ; 6f2c
ld a, [hl]
call GetTileCollision
cp WATERTILE
jr z, Function6f3e
jr z, WillObjectBumpIntoTile
scf
ret
; 6f3e
Function6f3e: ; 6f3e
WillObjectBumpIntoTile: ; 6f3e
ld hl, OBJECT_NEXT_TILE
add hl, bc
ld a, [hl]