I've been trying to program in a projectile object into Sonic 3+K. While it's mostly working, I'm still having problems programming it to affect certain objects, the breakable wall/rock object likely being the most pivotal. Here's what I have in the ASM so far: loc_1FD4E: lea (Shield_P2).w,a1 move.w $30(a0),d1 move.w d6,d0 andi.w #1,d0 cmpi.l #Obj_Laser,(a1) ; if it's not sonic, branch all this stuff beq.w loc_1FDA4 lea (Player_1).w,a1 move.w $30(a0),d1 move.w d6,d0 andi.w #1,d0 beq.w loc_1FDEA tst.b $2C(a0) bpl.s loc_1FD72 cmpi.b #2,$38(a1) beq.s loc_1FDA4 cmpi.l #Obj_Laser,(a1) beq.s loc_1FDA4 cmpi.b #$24,$20(a1) beq.s loc_1FDA4 bra.w loc_1FDEA ; --------------------------------------------------------------------------- loc_1FD72: tst.b (Super_Sonic_Knux_flag).w bne.s loc_1FDA4 cmpi.b #2,$38(a1) beq.s loc_1FDA4 btst #4,$2B(a1) bne.s loc_1FD90 ;btst #5,$2A(a0) ;beq.s loc_1FDEA nop loc_1FD90: cmpi.l #Obj_Laser,(a1) beq.s loc_1FDA4 cmpi.b #$24,$20(a1) beq.s loc_1FDA4 cmpi.b #2,$20(a1) bne.s loc_1FDEA move.w d1,d0 bpl.s loc_1FD9E neg.w d0 loc_1FD9E: cmpi.w #$480,d0 bcs.s loc_1FDEA loc_1FDA4: bclr #5,$2A(a0) bsr.w sub_1FE34 btst #6,$2A(a0) beq.w loc_1FD38 lea (Player_2).w,a1 cmpi.b #2,$38(a1) beq.s loc_1FDCE cmpi.l #Obj_Laser,(a1) beq.s loc_1FDCE cmpi.b #$24,$20(a1) beq.s loc_1FDCE cmpi.b #2,$20(a1) bne.w loc_1FD38 As you can see it's pretty messy due to not knowing whether to program it through player 1 or as a separate object (it loads through the Shield_P2 Object). Thus far I can make it break the object, however it only does so when the player is right up close to it. If the object has to move to reach the wall/rock, it doesn't affect it for reason. Anyone know the problem?
I'm have no idea how S3Ks wall object works (and very little about S3K object coding in general), but I know for a fact that in both S1 and S2, the wall object first checks if the player is actually touching the side of it before loading the breaking code; you'll have to build an extra check in the wall object itself to see if it's touching the projectile, then load the break routine. Again, this could be wrong, but I don't see why it would be.
What I usually do with things like this (after I've backed up the file first of course), is start deleting (commenting out) some branches and then build and test to see what happens; to help narrow down the issue. If it's not getting to the code you want it to, take the branches that makes it divert it away. Without some comments (and little S3K knowledge), I'm not sure what your code is for. This is more of a trial-and-error. This is how I do some things and it's great because I get to learn what each thing is then doing.
Basically the branches are supposed to recognise when the laser is touching the rock object and to branch over the player 1 and 2 data (eg. whether they are spinning or not) over to the coding which orders it to break.