Help with pointing to other solidity data

Discussion in 'Discussion and Q&A Archive' started by JoenickROS, Jul 8, 2013.

Thread Status:
Not open for further replies.
  1. JoenickROS

    JoenickROS ROS (bug fixing in progress) Member

    Joined:
    Feb 5, 2012
    Messages:
    930
    Ok so I have ported, ICZ, SLZ, and WWB and I want them to load their own solidity data, but I have a little issue


    loc_1E7F0:
    cmpi.b #3,(Current_Zone).w
    bne.w LocS1_C1
    movea.l (Collision_addr).w,a2
    move.b (a2,d0.w),d0
    andi.w #$FF,d0
    beq.s loc_1E7E2
    lea (ColCurveMap).l,a2
    move.b (a2,d0.w),(a4)

    LocS1_C1:
    movea.l (Collision_addr).w,a2
    move.b (a2,d0.w),d0
    andi.w #$FF,d0
    beq.s loc_1E7E2
    lea (ColCurveMap_S1).l,a2
    move.b (a2,d0.w),(a4)
    +
    lsl.w #4,d0
    move.w d3,d1
    btst #$A,d4
    beq.s +
    not.w d1
    neg.b (a4)
    +
    btst #$B,d4
    beq.s +
    addi.b #$40,(a4)
    neg.b (a4)
    subi.b #$40,(a4)
    +
    andi.w #$F,d1
    add.w d0,d1
    lea (ColArray).l,a2
    move.b (a2,d1.w),d0
    ext.w d0
    eor.w d6,d4
    btst #$B,d4
    beq.s +
    neg.w d0
    +
    tst.w d0
    beq.w loc_1E7E2
    bmi.s loc_1E85E
    cmpi.b #$10,d0
    beq.s loc_1E86A
    move.w d2,d1
    andi.w #$F,d1
    add.w d1,d0
    move.w #$F,d1
    sub.w d0,d1
    rts

    As you can see I  have checked if zone 3 (SLZ) is in play and to load the Sonic 1 collision with it but it messed up the curve data for the Sonic 2 zones. My guess is that I have used incorrect branch's, wondering if anyone could help me figure out the problem. There are 5 more routines like this that must be changed, but I cant move on to them until this first one works.

    Edit: Thought I could just use Sonic 2 collision but some solids that are in Sonic 1, 3, and CD don't exist in Sonic 2

    Edit2: All the solidity data has been converted already and added in the ASM file.
     
    Last edited by a moderator: Jul 8, 2013
  2. JoenickROS

    JoenickROS ROS (bug fixing in progress) Member

    Joined:
    Feb 5, 2012
    Messages:
    930
    Sorry for double post but I got it, although I had to copy a lot of code but to have it load the s1 collision instead if act 3 is in play, if there is a way that I don't have to do that so I can use less code let me know.
     
  3. MarkeyJester

    MarkeyJester ♡ ! Member

    Joined:
    Jun 27, 2009
    Messages:
    2,870
    When it doesn't branch to "LocS1_C1", it does Sonic 2's collision, but then it continues down to do "LocS1_C1" anyway, consider putting a branch above the lable "LocS1_C1" which branches to that next "+":

    Code:
    loc_1E7F0:
            cmpi.b  #3,(Current_Zone).w
            bne.w   LocS1_C1
    	movea.l	(Collision_addr).w,a2
    	move.b	(a2,d0.w),d0
    	andi.w	#$FF,d0
    	beq.s	loc_1E7E2
    	lea	(ColCurveMap).l,a2
    	move.b	(a2,d0.w),(a4)
    	bra.s	+			; <-
    
    LocS1_C1:       
            movea.l	(Collision_addr).w,a2
    	move.b	(a2,d0.w),d0
    	andi.w	#$FF,d0
    	beq.s	loc_1E7E2
    	lea	(ColCurveMap_S1).l,a2
    	move.b	(a2,d0.w),(a4)
    +
    	lsl.w	#4,d0
    	move.w	d3,d1
    	...
    
     
  4. JoenickROS

    JoenickROS ROS (bug fixing in progress) Member

    Joined:
    Feb 5, 2012
    Messages:
    930
    Sweet it worked, that saves a lot of code from my original plan, thank you very much Markey!
     
  5. MarkeyJester

    MarkeyJester ♡ ! Member

    Joined:
    Jun 27, 2009
    Messages:
    2,870
    I normaly wouldn't care, but you seem to be interested in reducing code, so you could try this:

    Code:
    loc_1E7F0:
    	movea.l	(Collision_addr).w,a2
    	move.b	(a2,d0.w),d0
    	andi.w	#$FF,d0
    	beq.s	loc_1E7E2
    	lea	(ColCurveMap).l,a2
            cmpi.b  #3,(Current_Zone).w
            beq.w   LocS2_C1
    	lea	(ColCurveMap_S1).l,a2
    
    LocS2_C1:
    	move.b	(a2,d0.w),(a4)
    
    +
    	lsl.w	#4,d0
    	move.w	d3,d1
    	...
    
     
Thread Status:
Not open for further replies.