Sign Problems

Discussion in 'Discussion and Q&A Archive' started by hfdshdgfhgn, Jul 30, 2010.

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

    hfdshdgfhgn fdsgfdgfhgfds Member

    Joined:
    Dec 28, 2009
    Messages:
    89
    I'm trying to make a sign for save games. So far it somewhat works, but only subtype $0 will show its sprite.


    Code:



    Obj4F: ; XREF: Obj_Index
    moveq #0,d0


    move.b $24(a0),d0


    move.w Obj4F_Index(pc,d0.w),d1


    jmp Obj4F_Index(pc,d1.w)


    rts


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


    Obj4F_Index: dc.w Obj4F_Main-Obj4F_Index ; Jumped to if #0 is in $24(a0)


    dc.w Obj4F_Subtype-Obj4F_Index ; Jumped to if #2 is in $24(a0)


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


    Obj4F_Main:


    addq.b #2,$24(a0) ; adds to the routine so this isn't run again


    move.w #$4000,2(a0) ; moves #$4000 to the art tile's SST (it's 2 in S1 and S2)


    move.l #HUBSignMap,4(a0) ; moves the mappings into the mapping's SST


    move.b #4,1(a0) ; use screen coordinates (such as the ones you see in debug mode)


    move.b #4,$18(a0) ; set priority (if other objects have a priority of a number less then 4 then the other object will be seen over this one if they interact)


    move.w $C(a0),$2C(a0) ; store a copy of the y coordinate ($C(a0) is y coordingate in S1 and S2 and $2C(a0) is scratch ram)


    move.w $C(a0),$34(a0) ; store another copy of the y coordinate


    move.w 8(a0),$32(a0) ; store a copy of the x coordinate


    move.w #$80,$26(a0) ; move #$80 into $26(a0) (to be used later)


    move.w #$3E8,$02(a0)


    Obj4F_Subtype:


    Obj4F_Subtype6:


    cmpi.w #$6,$28(a0) ; is object subtype 6?


    bne.s Obj4F_End ; If not, branch


    move.w #$5,$1A(a1) ; Use frame $5


    move.b #$47,$19(a0) ; width of object in pixels


    jmp DisplaySprite


    rts


    Obj4f_Subtype5:


    cmpi.w #$5,$28(a0) ; is object subtype 5?


    bne.s Obj4F_SubType4 ; If not, branch


    move.w #$4,$1A(a1) ; Use frame $4


    move.b #$38,$19(a0) ; width of object in pixels


    jmp DisplaySprite


    Obj4F_SubType4:


    cmpi.w #$4,$28(a0) ; is object subtype 4?


    bne.s Obj4F_Subtype3 ; If not, branch


    move.w #$3,$1A(a1) ; Use frame $3


    move.b #$30,$19(a0) ; width of object in pixels


    jmp DisplaySprite


    Obj4F_Subtype3:


    cmpi.w #$3,$28(a0) ; is object subtype 3?


    bne.s Obj4F_Subtype2 ; If not, branch


    move.w #$2,$1A(a1) ; Use frame $2


    move.b #$30,$19(a0) ; width of object in pixels


    jmp DisplaySprite


    Obj4F_Subtype2:


    cmpi.w #$2,$28(a0) ; is object subtype 2?


    beq.s Obj4F_Subtype1 ; If not, branch


    move.w #$1,$1A(a1) ; Use frame $1


    move.b #$30,$19(a0) ; width of object in pixels


    jmp DisplaySprite


    Obj4F_Subtype1:


    move.w #$0,$1A(a1) ; Use frame $0


    move.b #$30,$19(a0) ; width of object in pixels


    jmp DisplaySprite


    Obj4F_End:


    rts



    Screenshot too.


    [​IMG]
     
  2. Selbi

    Selbi The Euphonic Mess Member

    Joined:
    Jul 20, 2008
    Messages:
    2,429
    Location:
    Northern Germany
    The object subtype is a byte, not a word. So basically instead of this:



    cmpi.w #$6,$28(a0) ; is object subtype 6?



    You want this:


    Code:
    		cmpi.b	#$6,$28(a0) ; is object subtype 6?
    
     
  3. hfdshdgfhgn

    hfdshdgfhgn fdsgfdgfhgfds Member

    Joined:
    Dec 28, 2009
    Messages:
    89
    Still doesn't want to work. :(
     
  4. theocas

    theocas #! Member

    Joined:
    Apr 10, 2010
    Messages:
    375
    Never mind us, we put the wrong object ID and fucked up a branch.
     
Thread Status:
Not open for further replies.