From 6911d01c43090b305bb4b944043692b8a43d3b51 Mon Sep 17 00:00:00 2001 From: "Matthew D. Steele" Date: Thu, 29 Aug 2024 17:51:07 -0400 Subject: [PATCH] Add eAvatar::SwimDoor pose --- src/avatar.asm | 37 +++++++++-- src/avatar.inc | 40 +++++------ src/chr.asm | 6 +- src/devices/lever.asm | 4 +- src/devices/paper.asm | 2 +- src/explore.asm | 5 ++ src/tiles/device.ahi | 48 +++++--------- src/tiles/font_hilight.ahi | 16 ++--- src/tiles/player_flower.ahi | 128 ++++++++++++++++++------------------ src/tiles/player_normal.ahi | 128 ++++++++++++++++++------------------ src/upgrade.inc | 2 +- 11 files changed, 217 insertions(+), 199 deletions(-) diff --git a/src/avatar.asm b/src/avatar.asm index 8f2ec593..a00f0869 100644 --- a/src/avatar.asm +++ b/src/avatar.asm @@ -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 @@ -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 diff --git a/src/avatar.inc b/src/avatar.inc index d61dbb66..ec1e8080 100644 --- a/src/avatar.inc +++ b/src/avatar.inc @@ -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 ;;;=========================================================================;;; diff --git a/src/chr.asm b/src/chr.asm index 05d42d49..f5ec9d73 100644 --- a/src/chr.asm +++ b/src/chr.asm @@ -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 @@ -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 diff --git a/src/devices/lever.asm b/src/devices/lever.asm index b58440e7..a33322d4 100644 --- a/src/devices/lever.asm +++ b/src/devices/lever.asm @@ -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 diff --git a/src/devices/paper.asm b/src/devices/paper.asm index 757295bc..1ff7749e 100644 --- a/src/devices/paper.asm +++ b/src/devices/paper.asm @@ -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 diff --git a/src/explore.asm b/src/explore.asm index 55e9dd6b..ead8758c 100644 --- a/src/explore.asm +++ b/src/explore.asm @@ -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 diff --git a/src/tiles/device.ahi b/src/tiles/device.ahi index 4e6465e3..eb852e8d 100644 --- a/src/tiles/device.ahi +++ b/src/tiles/device.ahi @@ -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 @@ -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 @@ -109,21 +109,3 @@ AA00A00A 00000600 00006000 00006000 - -00000000 -00000000 -3A000000 -A3A00000 -0A300000 -000A0000 -0000A000 -00000A00 - -00000A00 -0000A3A0 -0000A3A0 -00000AA0 -000000A0 -000000A0 -0000000A -0000000A diff --git a/src/tiles/font_hilight.ahi b/src/tiles/font_hilight.ahi index ee3e9756..d4301345 100644 --- a/src/tiles/font_hilight.ahi +++ b/src/tiles/font_hilight.ahi @@ -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 diff --git a/src/tiles/player_flower.ahi b/src/tiles/player_flower.ahi index 1affb8ee..3666ee65 100644 --- a/src/tiles/player_flower.ahi +++ b/src/tiles/player_flower.ahi @@ -27,31 +27,14 @@ ahi1 f0 p1 i16 w16 h16 0002213333300000 0002211333000000 0002211111000000 -0002113333000000 -0000133333300000 -0000333333330000 -0000313333130000 -0000133333310000 -0000333313330000 -0000011111100000 -0000033113300000 - -0000022222000000 -0003221111200000 -0033211333100000 -0003213131300000 -0002213333300000 -0002213333303000 -0002211333130000 -0002211111330000 -0002113333330000 -0000133333310000 -0000333333100000 -0000313333100000 -0000133333300000 -0000333313330000 -0000011111100000 -0000033113300000 +3333000022000000 +3331000011200000 +3310000033100000 +3310000031300000 +3330000033300000 +1333000033303000 +1110000033130000 +1330000011330000 0000022220000000 0000211112000000 @@ -138,14 +121,14 @@ ahi1 f0 p1 i16 w16 h16 0003131111110000 0000000013300000 -0000302222200000 -0003332222220000 -0000322111110000 -0000221133330000 -0000221313130000 -0002221333330000 -0002211333300000 -0002211111100000 +0000302200000000 +0003332200000000 +0000322100000000 +0000221100000000 +0000221300000000 +0002221300000000 +0002211300000000 +0002211100000000 0002013333000000 0000033113000000 0000013331330000 @@ -172,14 +155,14 @@ ahi1 f0 p1 i16 w16 h16 0001111111000000 0003310133000000 -0003022222000000 -0033222222200000 -0002221111100000 -0002211333300000 -0002213131300000 -0022213333300000 -0222113333000000 -0000011111000000 +0003022200000000 +0033222200000000 +0002221100000000 +0002211300000000 +0002213100000000 +0022213300000000 +0222113300000000 +0000011100000000 0003333333333000 0001133333311000 0000033333300000 @@ -189,6 +172,23 @@ ahi1 f0 p1 i16 w16 h16 0000331330000000 0000000000000000 +0000022223000000 +0000222233300000 +0000222223200000 +0002222222200000 +0002222222200000 +0022222222200000 +0222222222100000 +0000011111000000 +0003333300000000 +0001133300000000 +0000033300000000 +0000333300000000 +0003333300000000 +0000111100000000 +0000331300000000 +0000000000000000 + 0003022222000000 0033322222200000 0003221111100000 @@ -206,14 +206,14 @@ ahi1 f0 p1 i16 w16 h16 0003133101110000 0000000000330000 -0000322222000000 -0003322222200000 -0022221111100000 -0012211333300000 -0022213131300000 -0222113333300000 -0000013333000000 -0000011111000000 +0000322200000000 +0003322200000000 +0022221100000002 +0012211303310331 +0022213101113312 +0222113300333331 +0000013331333333 +0000011131333333 0003333333333000 0000133333310000 0000013333100000 @@ -223,14 +223,14 @@ ahi1 f0 p1 i16 w16 h16 0000111111110000 0000331001330000 -0000322222000000 -0022222222200000 -0012221111100000 -0222211333300000 -0022213131300000 -0000113333300000 -0000113333000000 -0003111111003000 +0000322200000000 +0022222202222000 +0012221122222230 +0222211312222333 +0022213122222232 +0000113311222222 +0000113333111221 +0003111133333113 0001333333331000 0000133333310000 0000013333100000 @@ -266,10 +266,10 @@ ahi1 f0 p1 i16 w16 h16 0000000000000000 0000000000000000 0000000000000000 -0000000002222000 -0000000222222230 -0331033112222333 -0111331222222232 -0033333111222222 -3133333333111221 -3133333333333113 +0000000000000000 +0000000000000000 +0000000000000000 +0000000000000000 +0000000000000000 +0000000000000000 +0000000000000000 diff --git a/src/tiles/player_normal.ahi b/src/tiles/player_normal.ahi index 19357a96..ca026ed1 100644 --- a/src/tiles/player_normal.ahi +++ b/src/tiles/player_normal.ahi @@ -27,31 +27,14 @@ ahi1 f0 p1 i16 w16 h16 0002213333300000 0002211333000000 0002211111000000 -0002113333000000 -0000133333300000 -0000333333330000 -0000313333130000 -0000133333310000 -0000333313330000 -0000011111100000 -0000033113300000 - -0000022222000000 -0000221111200000 -0000211333100000 -0000213131300000 -0002213333300000 -0002213333303000 -0002211333130000 -0002211111330000 -0002113333330000 -0000133333310000 -0000333333100000 -0000313333100000 -0000133333300000 -0000333313330000 -0000011111100000 -0000033113300000 +3333000022000000 +3331000011200000 +3310000033100000 +3310000031300000 +3330000033300000 +1333000033303000 +1110000033130000 +1330000011330000 0000022220000000 0000211112000000 @@ -138,14 +121,14 @@ ahi1 f0 p1 i16 w16 h16 0003131111110000 0000000013300000 -0000002222200000 -0000022222220000 -0000222111110000 -0000221133330000 -0000221313130000 -0002221333330000 -0002211333300000 -0002211111100000 +0000002200000000 +0000022200000000 +0000222100000000 +0000221100000000 +0000221300000000 +0002221300000000 +0002211300000000 +0002211100000000 0002013333000000 0000033113000000 0000013331330000 @@ -172,14 +155,14 @@ ahi1 f0 p1 i16 w16 h16 0001111111000000 0003310133000000 -0000022222000000 -0000222222200000 -0000221111100000 -0002211333300000 -0002213131300000 -0022213333300000 -0222113333000000 -0000011111000000 +0000022200000000 +0000222200000000 +0000221100000000 +0002211300000000 +0002213100000000 +0022213300000000 +0222113300000000 +0000011100000000 0003333333333000 0001133333311000 0000033333300000 @@ -189,6 +172,23 @@ ahi1 f0 p1 i16 w16 h16 0000331330000000 0000000000000000 +0000022222000000 +0000222222200000 +0000222222200000 +0002222222200000 +0002222222200000 +0022222222200000 +0222222222100000 +0000011111000000 +0003333300000000 +0001133300000000 +0000033300000000 +0000333300000000 +0003333300000000 +0000111100000000 +0000331300000000 +0000000000000000 + 0000022222000000 0000222222200000 0000221111100000 @@ -206,14 +206,14 @@ ahi1 f0 p1 i16 w16 h16 0003133101110000 0000000000330000 -0000022222000000 -0000222222200000 -0022221111100000 -0012211333300000 -0022213131300000 -0222113333300000 -0000013333000000 -0000011111000000 +0000022200000000 +0000222200000000 +0022221100000002 +0012211303310331 +0022213101113312 +0222113300333331 +0000013331333333 +0000011131333333 0003333333333000 0000133333310000 0000013333100000 @@ -223,14 +223,14 @@ ahi1 f0 p1 i16 w16 h16 0000111111110000 0000331001330000 -0000022222000000 -0022222222200000 -0012221111100000 -0222211333300000 -0022213131300000 -0000113333300000 -0000113333000000 -0003111111003000 +0000022200000000 +0022222202222000 +0012221122222220 +0222211312222222 +0022213122222222 +0000113311222222 +0000113333111221 +0003111133333113 0001333333331000 0000133333310000 0000013333100000 @@ -266,10 +266,10 @@ ahi1 f0 p1 i16 w16 h16 0000000000000000 0000000000000000 0000000000000000 -0000000002222000 -0000000222222220 -0331033112222222 -0111331222222222 -0033333111222222 -3133333333111221 -3133333333333113 +0000000000000000 +0000000000000000 +0000000000000000 +0000000000000000 +0000000000000000 +0000000000000000 +0000000000000000 diff --git a/src/upgrade.inc b/src/upgrade.inc index c8b85933..60562711 100644 --- a/src/upgrade.inc +++ b/src/upgrade.inc @@ -18,7 +18,7 @@ ;;;=========================================================================;;; ;;; Various OBJ tile IDs used for drawing upgrades. -kTileIdObjUpgradeBottomFirst = $0e +kTileIdObjUpgradeBottomFirst = $0c kTileIdObjUpgradeRamFirst = $82 kTileIdObjUpgradeBRemoteFirst = $84 kTileIdObjUpgradeOpIfFirst = $86