News:

Don't forget to visit the main site! There's lots of helpful docs, patches, and more!

Main Menu

[SM] Samus' beam offsets

Started by Munchy, March 11, 2020, 01:30:28 PM

Previous topic - Next topic

Munchy

Hiya,

I wanna add the ability to change the X/Y at which the beam is shot from samus' character in Smunch.  It looks like it'll be something to do with the instructions in bank 93: http://patrickjohnston.org/bank/93#fA231

so for example:


;;; $86F3: Instruction list - power - right ;;;
{
$93:86F3             dx 000F,A269,08,04,0000,
                        8239,86F3             ; Go to $86F3
}


i'm guessing one of the instructions here is what I need to be looking at right?

thanx

P.JBoy

I believe the X/Y offsets of the beam origins is these two arrays:

$90:C204             dw 0002,000D,000B,000D,0002,FFFB,FFF2,FFF5,FFED,FFFE
$90:C218             dw FFF8,FFF3,0001,0004,000D,000D,0004,0001,FFED,FFF8
...

Munchy

#2
Ok, finally had the time to sit and check out these offsets. here's the results of my research:

STANDING STILL/CROUCHING

90:C204 - C217 = X AXIS

0000/FFFF = dead centre of Samus
values: FFFF-FFF0 = move offset left by 0-15 pixels
values: 0000-000F = move offset right by 0-15 pixels

C204-C205 : Samus facing-right pointing straight up
C206-C207 : Samus pointing diag-up-right standing still
C208-C209 : Samus standing still facing right
C20A-C20B : Samus mid-air diag-down-right
C20C-C20D : Samus mid-air facing-right straight-down
C20E-C20F : Samus mid-air facing-left straight-down
C210-C211 : Samus pointing diag-down-left standing still
C212-C213 : Samus standing still facing right
C214-C215 : Samus pointing diag-up-left standing still
C216-C217 : Samus facing-left pointing straight up


90:C218 - C22B = Y AXIS

0000/FFFF = dead centre of Samus
values: FFFF-FFF0 = move offset up by 0-15 pixels
values: 0000-000F = move offset down by 0-15 pixels

C218-C219 : Samus facing-right pointing straight up
C21A-C21B : Samus pointing diag-up-right standing still
C21C-C21D : Samus standing still facing right
C21E-C21F : Samus mid-air diag-down-right
C220-C221 : Samus mid-air facing-right straight-down
C222-C223 : Samus mid-air facing-left straight-down
C224-C225 : Samus pointing diag-down-left standing still
C226-C227 : Samus standing still facing right
C228-C229 : Samus pointing diag-up-left standing still
C22A-C22B : Samus facing-left pointing straight up


Running offset tables in next post...

Munchy

#3
continued:

RUNNING

90:C22C-C23F = X AXIS

C22C-C22D : ?
C22E-C22F : Samus running-right pointing diag-up
C230-C231 : Samus running-right pointing dead-ahead
C232-C233 : Samus running-right pointing diag-down
(C234-C235 : Something to do with diag-down running ?)
(C236-C237 : Something to do with diag-down running ?)
C238-C239 : Samus running-left pointing diag-down
C23A-C23B : Samus running-left pointing dead-ahead
C23C-C23D : Samus running-left pointing diag-up



90:C240-C253 = Y AXIS
C240-C241 : ?
C242-C243 : Samus running-right pointing diag-up
C244-C245 : Samus running-right pointing dead-ahead
C246-C247 : Samus running-right pointing diag-down
(C248-C249 : Something to do with diag-down running ?)
(C24A-C24B : Something to do with diag-down running ?)
C24C-C24D : Samus running-left pointing diag-down
C24E-C24F : Samus running-left pointing dead-ahead
C250-C251 : Samus running-left pointing diag-up

Munchy

#4
Further research suggests that the beam AND missile offsets apply across all the different beams (except grapple as expected)

Munchy

#5
Also realised I needed to say: big thanks @P.JBoy  :^_^:

Anyone got any idea where the grapple beam offsets are for when Samus isn't grappled on but is just shooting it out? doesn't seem to be any of the tables around there :/

Munchy

Found em :) they're a little more complex (no surprises there really) but essentially I just need to manage 2 values per position/routine instead of 1:

next time I sit down I'll map the below out

$9B:C122             dw 0002,000A,0002,000A,0003,FFFC,FFF6,FFFE,FFF6,FFFE ; Initial grapple beam origin X offset - not running
$9B:C136             dw FFF0,FFF4,0002,0000,0006,0006,0000,0002,FFF4,FFF0 ; Initial grapple beam origin Y offset - not running
$9B:C14A             dw 0002,0012,000F,0011,0003,FFFC,FFEF,FFF1,FFEE,FFFE ; Initial $0D1A offset - not running
$9B:C15E             dw FFE4,FFED,0001,0006,0011,0011,0006,0001,FFEC,FFE4 ; Initial $0D1C offset - not running

$9B:C172             dw 0002,000A,0002,000A,0003,FFFC,FFF6,FFFE,FFF6,FFFE ; Initial grapple beam origin X offset - running
$9B:C186             dw FFF0,FFF4,FFFE,0000,0006,0006,0000,FFFE,FFF4,FFF0 ; Initial grapple beam origin Y offset - running
$9B:C19A             dw 0002,0013,0014,0012,0003,FFFC,FFEE,FFEC,FFED,FFFE ; Initial $0D1A offset - running
$9B:C1AE             dw FFE0,FFEA,FFFD,0006,0019,0019,0006,FFFD,FFEC,FFE0 ; Initial $0D1C offset - running


tell you what, it's amazing how much you can pick up from a RAM map and Geiger's debugger!

Munchy

GRAPPLE OFFSETS 1


BEAM DESTINATION X OFFSET - Not running
C122-C123 : Samus facing right, aiming up
C124-C125 : Samus facing right, aiming diag-up
C126-C127 : Samus facing right, dead ahead
C128-C129 : Samus mid-air diag-down-right
C12A-C12B : Samus mid-air facing-right straight-down
C12C-C12D : Samus mid-air facing-left straight-down
C12E-C12F : Samus pointing diag-down-left standing still
C130-C131 : Samus standing still facing right
C132-C133 : Samus pointing diag-up-left standing still
C134-C135 : Samus facing-left pointing straight up



BEAM ORIGIN X OFFSET - Not running
C14A-C14B : Samus facing right, aiming up
C14C-C14D : Samus facing right, aiming diag-up
C14E-C14F : Samus facing right, dead ahead
C150-C151 : Samus mid-air diag-down-right
C152-C153 : Samus mid-air facing-right straight-down
C154-C155 : Samus mid-air facing-left straight-down
C156-C157 : Samus pointing diag-down-left standing still
C158-C159 : Samus standing still facing right
C15A-C15B : Samus pointing diag-up-left standing still
C15C-C15D : Samus facing-left pointing straight up

Munchy

GRAPPLE OFFSETS 2


BEAM DESTINATION Y OFFSET - Not running
C136-C137 : Samus facing right, aiming up
C138-C139 : Samus facing right, aiming diag-up
C13A-C13B : Samus facing right, dead ahead
C13C-C13D : Samus mid-air diag-down-right
C13E-C13F : Samus mid-air facing-right straight-down
C140-C141 : Samus mid-air facing-left straight-down
C142-C143 : Samus pointing diag-down-left standing still
C144-C145 : Samus standing still facing right
C146-C147 : Samus pointing diag-up-left standing still
C148-C149 : Samus facing-left pointing straight up


BEAM ORIGIN Y OFFSET - Not running
C15E-C15F : Samus facing right, aiming up
C160-C161 : Samus facing right, aiming diag-up
C162-C163 : Samus facing right, dead ahead
C164-C165 : Samus mid-air diag-down-right
C166-C167 : Samus mid-air facing-right straight-down
C168-C169 : Samus mid-air facing-left straight-down
C16A-C16B : Samus pointing diag-down-left standing still
C16C-C16D : Samus standing still facing right
C16E-C16F : Samus pointing diag-up-left standing still
C170-C171 : Samus facing-left pointing straight up

Munchy

GRAPPLE OFFSETS 3

BEAM DESTINATION X OFFSET - running
C172-C173 : UNUSED POSE?
C174-C175 : Samus running-right pointing diag-up
C176-C177 : Samus running-right pointing dead-ahead
C178-C179 : Samus running-right pointing diag-down
(C17A-C17B : Something to do with diag-down running ?)
(C17C-C17D : Something to do with diag-down running ?)
C17E-C17F : Samus running-left pointing diag-down
C180-C181 : Samus running-left pointing dead-ahead
C182-C183 : Samus running-left pointing diag-up
C184-C185 : UNUSED POSE?


BEAM ORIGIN X OFFSET - running
C19A-C19B : UNUSED POSE?
C19C-C19D : Samus running-right pointing diag-up
C19E-C19F : Samus running-right pointing dead-ahead
C1A0-C1A1 : Samus running-right pointing diag-down
(C1A2-C1A3 : Something to do with diag-down running ?)
(C1A4-C1A5 : Something to do with diag-down running ?)
C1A6-C1A7 : Samus running-left pointing diag-down
C1A8-C1A9 : Samus running-left pointing dead-ahead
C1AA-C1AB : Samus running-left pointing diag-up
C1AC-C1AD : UNUSED POSE?


BEAM DESTINATION Y OFFSET - running
C186-C187 : UNUSED POSE?
C188-C189 : Samus running-right pointing diag-up
C18A-C18B : Samus running-right pointing dead-ahead
C18C-C18D : Samus running-right pointing diag-down
(C18E-C18F : Something to do with diag-down running ?)
(C190-C191 : Something to do with diag-down running ?)
C192-C193 : Samus running-left pointing diag-down
C194-C195 : Samus running-left pointing dead-ahead
C196-C197 : Samus running-left pointing diag-up
C198-C199 : UNUSED POSE?


BEAM ORIGIN Y OFFSET - running
C1AE-C1AF : UNUSED POSE?
C1B0-C1B1 : Samus running-right pointing diag-up
C1B2-C1B3 : Samus running-right pointing dead-ahead
C1B4-C1B5 : Samus running-right pointing diag-down
(C1B6-C1B7 : Something to do with diag-down running ?)
(C1B8-C1B9 : Something to do with diag-down running ?)
C1BA-C1BB : Samus running-left pointing diag-down
C1BC-C1BD : Samus running-left pointing dead-ahead
C1BE-C1BF : Samus running-left pointing diag-up
C1C0-C1C1 : UNUSED POSE?

Munchy

All of which, combined with what I've seen coding SMunch, leads me to believe that there was a phase in Super Metroid's development where they were planning for Samus to be able to shoot straight up while running (possibly straight down as well). I'm glad they changed that haha!

also, I think they had a hell of a time getting grapple working given the broken frames and just how much more work it took to code compared to the rest of her abilities.  Much as I love grapple beam, it can feel a little janky compared to other aspects of the game (that whole thing with not connecting with grapple while she's standing shooting dead ahead for example and some of the weird wall stuff you can do with it).

Crashtour99

It's probably that the tables are being indexed by Samus' firing angle, which isn't always fully used in certain poses.
So 0 & 9 - Samus facing left/right aiming straight up.
4 & 5 - Samus facing left/right aiming straight down.

I haven't looked into it at all, but it wouldn't surprise me if they used different tables depending on hitbox height or something, just to tell if she's running/standing, jumping, crouching, etc.