Skip to content

Commit

Permalink
Add eAvatar::SwimDoor pose
Browse files Browse the repository at this point in the history
  • Loading branch information
mdsteele committed Aug 29, 2024
1 parent bb28e13 commit 6911d01
Show file tree
Hide file tree
Showing 11 changed files with 217 additions and 199 deletions.
37 changes: 33 additions & 4 deletions src/avatar.asm
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,13 @@
.INCLUDE "sample.inc"

.IMPORT FuncA_Avatar_UpdateWaterDepth
.IMPORT FuncA_Objects_Draw2x2Shape
.IMPORT FuncA_Objects_Alloc2x2Shape
.IMPORT Func_MovePointUpByA
.IMPORT Func_PlaySfxSample
.IMPORT Func_SignedAtan2
.IMPORT Func_TryPushAvatarHorz
.IMPORT Func_TryPushAvatarVert
.IMPORT Ram_Oam_sObj_arr64
.IMPORTZP Zp_AvatarCollided_ePlatform
.IMPORTZP Zp_AvatarExit_ePassage
.IMPORTZP Zp_AvatarPushDelta_i8
Expand Down Expand Up @@ -846,13 +847,41 @@ _InAirReverseGravity:
@notInvincible:
_DrawObjects:
jsr FuncA_Objects_SetShapePosToAvatarCenter
lda Zp_AvatarPose_eAvatar ; param: first tile ID
lda Zp_AvatarPose_eAvatar
.assert eAvatar::Hidden = 0, error
beq _Done
ldy Zp_AvatarFlags_bObj ; param: object flags
jmp FuncA_Objects_Draw2x2Shape
mul #4
tax
lda Zp_AvatarFlags_bObj ; param: object flags
jsr FuncA_Objects_Alloc2x2Shape ; preserves X, returns C and Y
bcs _Done
.repeat 4, i
lda _Tiles_u8_arr4_arr + i, x
sta Ram_Oam_sObj_arr64 + .sizeof(sObj) * i + sObj::Tile_u8, y
.endrepeat
_Done:
rts
_Tiles_u8_arr4_arr:
D_ARRAY .enum, eAvatar, 4
d_byte Hidden, $00, $00, $00, $00
d_byte Standing, $10, $11, $12, $13
d_byte Looking, $14, $11, $16, $13
d_byte Reaching, $14, $11, $17, $15
d_byte Straining, $18, $19, $1a, $1b
d_byte Kneeling, $1c, $1d, $1e, $1f
d_byte Landing, $20, $21, $22, $23
d_byte Reading, $24, $25, $26, $27
d_byte Running1, $28, $29, $2a, $2b
d_byte Running2, $2c, $2d, $2a, $2f
d_byte Swimming1, $30, $31, $32, $33
d_byte Swimming2, $34, $35, $12, $37
d_byte SwimDoor, $38, $39, $3a, $37
d_byte Jumping, $3c, $3d, $3e, $3f
d_byte Hovering, $40, $41, $12, $43
d_byte Falling, $44, $45, $3e, $47
d_byte Slumping, $48, $49, $4a, $4b
d_byte Sleeping, $3b, $42, $3b, $46
D_END
.ENDPROC

;;; Sets Zp_ShapePosX_i16 and Zp_ShapePosY_i16 to the screen-space position of
Expand Down
40 changes: 20 additions & 20 deletions src/avatar.inc
Original file line number Diff line number Diff line change
Expand Up @@ -72,27 +72,27 @@ kPaletteObjAvatarDeath = 3

;;;=========================================================================;;;

;;; Poses that the player avatar can be in. The number for each of these enum
;;; values is the starting tile ID to use for the avatar objects when the
;;; avatar is in that pose.
;;; Poses that the player avatar can be in.
.ENUM eAvatar
Hidden = $00 ; not drawn (e.g. for cutscenes)
Standing = $10 ; (grounded) standing still on the ground
Looking = $14 ; (grounded) standing still and looking upward
Reaching = $18 ; (grounded) standing still and reaching upward
Straining = $1c ; (grounded) standing still and reaching way upward
Kneeling = $20 ; (grounded) kneeling down on the ground
Landing = $24 ; (grounded) just landed from a jump
Reading = $28 ; (grounded) facing away from camera (e.g. to read a sign)
Running1 = $2c ; (grounded) running along the ground (1st frame)
Running2 = $30 ; (grounded) running along the ground (2nd frame)
Swimming1 = $34 ; (swimming) swimming in water (1st frame)
Swimming2 = $38 ; (swimming) swimming in water (2nd frame)
Jumping = $3c ; (airborne) jumping up
Hovering = $40 ; (airborne) mid-jump hang time
Falling = $44 ; (airborne) falling down
Slumping = $48 ; (sleeping) falling down unconscious
Sleeping = $4c ; (sleeping) lying down unconscious
Hidden ; not drawn (e.g. for cutscenes)
Standing ; (grounded) standing still on the ground
Looking ; (grounded) standing still and looking upward
Reaching ; (grounded) standing still and reaching upward
Straining ; (grounded) standing still and reaching way upward
Kneeling ; (grounded) kneeling down on the ground
Landing ; (grounded) just landed from a jump
Reading ; (grounded) facing away from camera (e.g. to read a sign)
Running1 ; (grounded) running along the ground (1st frame)
Running2 ; (grounded) running along the ground (2nd frame)
Swimming1 ; (swimming) swimming in water (1st frame)
Swimming2 ; (swimming) swimming in water (2nd frame)
SwimDoor ; (swimming) facing into a doorway while swimming
Jumping ; (airborne) jumping up
Hovering ; (airborne) mid-jump hang time
Falling ; (airborne) falling down
Slumping ; (sleeping) falling down unconscious
Sleeping ; (sleeping) lying down unconscious
NUM_VALUES
.ENDENUM

;;;=========================================================================;;;
6 changes: 4 additions & 2 deletions src/chr.asm
Original file line number Diff line number Diff line change
Expand Up @@ -1091,7 +1091,8 @@ _chr_begin:
CHR2_BANK $00
chr_inc "device"
chr_inc "upgrade_bottom", kTileIdObjUpgradeBottomFirst
chr_inc "player_flower", eAvatar::Standing
chr_res $02
chr_inc "player_flower"
chr_inc "font_hilight"
chr_inc "crate", kTileIdObjCrateFirst
END_CHR_BANK
Expand All @@ -1106,7 +1107,8 @@ _chr_begin:
CHR2_BANK $00
chr_inc "device"
chr_inc "upgrade_bottom", kTileIdObjUpgradeBottomFirst
chr_inc "player_normal", eAvatar::Standing
chr_res $02
chr_inc "player_normal"
chr_inc "font_hilight"
chr_inc "crate", kTileIdObjCrateFirst
END_CHR_BANK
Expand Down
4 changes: 2 additions & 2 deletions src/devices/lever.asm
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@
;;;=========================================================================;;;

;;; OBJ tile IDs used for drawing lever handles.
kTileIdObjLeverHandleDown = $0c
kTileIdObjLeverHandleUp = $0d
kTileIdObjLeverHandleDown = $04
kTileIdObjLeverHandleUp = $05

;;; The OBJ palette number used for drawing lever handles.
kPaletteObjLeverHandle = 0
Expand Down
2 changes: 1 addition & 1 deletion src/devices/paper.asm
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
;;;=========================================================================;;;

;;; The OBJ tile ID used for drawing paper devices.
kTileIdObjPaper = $05
kTileIdObjPaper = $64

;;; The OBJ palette number to use for drawing paper devices.
kPaletteObjPaper = 0
Expand Down
5 changes: 5 additions & 0 deletions src/explore.asm
Original file line number Diff line number Diff line change
Expand Up @@ -368,6 +368,11 @@ _DeviceFakeConsole:
bmi _ReturnYA ; unconditional
_DeviceDoor:
lda #eAvatar::Reading
bit Zp_AvatarState_bAvatar
.assert bAvatar::Swimming = bProc::Overflow, error
bvc @setPose ; not swimming
lda #eAvatar::SwimDoor
@setPose:
sta Zp_AvatarPose_eAvatar
_SetSpawnPoint:
;; We'll soon be setting the entrance door in the destination room as the
Expand Down
48 changes: 15 additions & 33 deletions src/tiles/device.ahi
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
ahi1 f0 p1 i14 w8 h8
ahi1 f0 p1 i12 w8 h8

;0;982220;ECEEEC;FF0;FF0;007628;FF0;FF0;FF0;54;FF0;FF0;FF0;FF0;FF0

Expand Down Expand Up @@ -40,21 +40,21 @@ ahi1 f0 p1 i14 w8 h8

00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
3A000000
A3A00000
0A300000
000A0000
0000A000
00000A00

00033000
A0A33AAA
AAAAAAA0
A11A1AAA
AA1A111A
A11AA1AA
AAAAAAAA
AA00A00A
00000A00
0000A3A0
0000A3A0
00000AA0
000000A0
000000A0
0000000A
0000000A

11111111
11111111
Expand Down Expand Up @@ -109,21 +109,3 @@ AA00A00A
00000600
00006000
00006000

00000000
00000000
3A000000
A3A00000
0A300000
000A0000
0000A000
00000A00

00000A00
0000A3A0
0000A3A0
00000AA0
000000A0
000000A0
0000000A
0000000A
16 changes: 8 additions & 8 deletions src/tiles/font_hilight.ahi
Original file line number Diff line number Diff line change
Expand Up @@ -182,14 +182,14 @@ ahi1 f0 p1 i44 w8 h8
23332222
02222222

00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00033000
A0A33AAA
AAAAAAA0
A11A1AAA
AA1A111A
A11AA1AA
AAAAAAAA
AA00A00A

02222222
23333322
Expand Down
Loading

0 comments on commit 6911d01

Please sign in to comment.