Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ; ---------------------------------------------------------------------------
- ; Object 4F - blank.
- ;!@ Now Socket bonus stage Door!
- ;Using object $19 (unused switch) object as codebase to modify
- ; ---------------------------------------------------------------------------
- obj4F:
- moveq #0,d0
- move.b obRoutine(a0),d0
- move.w Door_Index(pc,d0.w),d1
- jmp Door_Index(pc,d1.w)
- ; ===========================================================================
- Door_Index: dc.w Door_Main-Door_Index
- dc.w Door_Action-Door_Index
- dc.w Door_Delete-Door_Index
- ;origY: = $30 ; original y-axis position
- ; ===========================================================================
- Door_Main: ; Routine 0
- addq.b #2,obRoutine(a0)
- ;!@
- move.l #Map_Bonus_Door,obMap(a0)
- move.w #$6BE,obGfx(a0)
- move.b #4,obRender(a0)
- ;move.w obY(a0),origY(a0) ; save position on y-axis
- move.b #$10,obActWid(a0)
- move.b #2,obPriority(a0)
- Door_Action: ; Routine 2
- ;move.w origY(a0),obY(a0) ; restore position on y-axis
- move.w #$10,d1
- bsr.w Door_ChkTouch ; check if Sonic touches the Doortch
- beq.s Door_ChkDel ; if not, branch
- ;addq.w #2,obY(a0) ; move object 2 pixels
- ;moveq #1,d0
- ;move.w d0,(f_Doortch).w ; set Doortch 0 as "pressed"
- moveq #0,d0
- moveq #0,d1
- move.b obSubtype(a0),d0
- add.w d0,d0
- move.w Door_TypeIndex(pc,d0.w),d1
- jsr Door_TypeIndex(pc,d1.w)
- rts
- Door_ChkDel:
- bsr.w DisplaySprite
- ;out_of_range Door_Delete
- rts
- ; ===========================================================================
- Door_Delete: ; Routine 4
- ;bsr.w DeleteObject
- rts
- ; ---------------------------------------------------------------------------
- ; Subroutine to check if Sonic touches the object
- ; ---------------------------------------------------------------------------
- ; ||||||||||||||| S U B R O U T I N E |||||||||||||||||||||||||||||||||||||||
- Door_ChkTouch:
- lea (v_player).w,a1
- move.w obX(a1),d0
- sub.w obX(a0),d0
- add.w d1,d0
- bmi.s Door_NoTouch
- add.w d1,d1
- cmp.w d1,d0
- bcc.s Door_NoTouch
- move.w obY(a1),d2
- move.b obHeight(a1),d1
- ext.w d1
- add.w d2,d1
- move.w obY(a0),d0
- subi.w #$10,d0
- sub.w d1,d0
- bhi.s Door_NoTouch
- cmpi.w #-$10,d0
- bcs.s Door_NoTouch
- moveq #-1,d0 ; Sonic has touched it
- rts
- ; ===========================================================================
- Door_NoTouch:
- moveq #0,d0 ; Sonic hasn't touched it
- rts
- ; End of function Door_ChkTouch
- ; ===========================================================================
- Door_TypeIndex:
- dc.w Door_Type00-Door_TypeIndex, Door_Type01-Door_TypeIndex
- dc.w Door_Type02-Door_TypeIndex, Door_Type03-Door_TypeIndex
- dc.w Door_Type04-Door_TypeIndex, Door_Type05-Door_TypeIndex
- dc.w Door_Type06-Door_TypeIndex, Door_Type07-Door_TypeIndex
- dc.w Door_Type08-Door_TypeIndex, Door_Type09-Door_TypeIndex
- dc.w Door_Type0A-Door_TypeIndex, Door_Type0B-Door_TypeIndex
- dc.w Door_Type0C-Door_TypeIndex, Door_Type0D-Door_TypeIndex
- dc.w Door_Type0E-Door_TypeIndex, Door_Type0F-Door_TypeIndex
- dc.w Door_Type10-Door_TypeIndex, Door_Type11-Door_TypeIndex
- dc.w Door_Type12-Door_TypeIndex, Door_Type13-Door_TypeIndex
- rts
- ;Bonus Stage return door
- ;Returns Sonic back to zone (the one prior to warping to a bonus stage level)
- Door_Type00:
- ;Fetch hard-coded positions for each level to return to here into d2 and d3 from an array
- ;!@ Copied from StartLocArray (in "LevelSizeLoad & BgScrollSpeed.asm")
- move.w (v_warp_zone).w,d0
- lsl.b #6,d0
- lsr.w #4,d0
- lea Warp00Array(pc,d0.w),a1 ; load Sonic's start location
- moveq #0,d1
- move.w (a1)+,d1
- move.w d1,d2 ;x location
- moveq #0,d0
- move.w (a1),d0 ;y location
- move.w d0,d3
- ;move.w #$E20, d2
- ;move.w #$60, d3
- move.w (v_warp_zone).w, d4
- move.b #2, d5 ;Set warp flag!
- bsr.w DoWarp
- rts
- ;!@ When adding more zones, modify this! Based off Start Location Array - Levels.asm
- Warp00Array:
- ;GHZ
- dc.w $80,$A8
- dc.w $80,$A8
- dc.w $80,$A8
- dc.w $80,$A8
- ;LZ/SBZ3
- dc.w $80,$A8
- dc.w $80,$A8
- dc.w $80,$A8
- dc.w $80,$A8
- ;MZ
- dc.w $0570,$0440
- dc.w $00BA,$0545
- dc.w $0C65,$0055
- dc.w $80,$A8
- ;SLZ
- dc.w $80,$A8
- dc.w $80,$A8
- dc.w $80,$A8
- dc.w $80,$A8
- ;SYZ
- dc.w $80,$A8
- dc.w $128C,$0265
- dc.w $0415,$0050
- dc.w $80,$A8
- ;SBZ/FZ/Nada
- dc.w $80,$A8
- dc.w $80,$A8
- dc.w $80,$A8
- dc.w $80,$A8
- ;END1,2,Null,Null
- dc.w $80,$A8
- dc.w $80,$A8
- dc.w $80,$A8
- dc.w $80,$A8
- ;BZL
- dc.w $80,$A8
- dc.w $80,$A8
- dc.w $80,$A8
- dc.w $80,$A8
- ;BZF
- dc.w $80,$A8
- dc.w $80,$A8
- dc.w $80,$A8
- dc.w $80,$A8
- ;BZC
- dc.w $80,$A8
- dc.w $80,$A8
- dc.w $80,$A8
- dc.w $80,$A8
- ;BZLa
- dc.w $80,$A8
- dc.w $80,$A8
- dc.w $80,$A8
- dc.w $80,$A8
- even
- zonewarning Warp00Array,$10
- ;Goes to Bonus stage levels
- ;Hack will have 4 bonus stage types
- ;Currently setting all to SBZ A3 (Final Zone) for testing
- ;Bonus Stage 1 - Lights
- Door_Type0F:
- move.w #$0702, d4 ;BZL3
- jmp Door_Bonus
- Door_Type0B:
- move.w #$0701, d4 ;BZL2
- jmp Door_Bonus
- Door_Type01:
- move.w #$0700, d4 ;BZL1
- jmp Door_Bonus
- ;!@ Debug door (goto any level)
- Door_Type13:
- move.w #$0403, d4 ;OCZ4 (HSZ3)
- jmp Door_Bonus
- Door_Bonus:
- ;If options set to skip bonus zone, skip it
- tst.b (f_Bonus).w
- bne.s SkipBonus
- move.w (v_zone).w, (v_warp_zone).w
- move.w #0, d2 ;Goto start posx
- move.w #0, d3 ;Goto start posy
- move.b #2, d5 ;Set warp flag!
- bsr.w DoWarp
- rts
- SkipBonus:
- move.w (v_zone).w, (v_warp_zone).w
- bra.w Door_Type00
- rts
- ;Bonus Stage 2 - Fence
- Door_Type10:
- move.w #$0802, d4 ;!@Goto SBZ2 (FZ) for now
- jmp Door_Bonus
- Door_Type0C:
- move.w #$0801, d4 ;!@Goto SBZ2 (FZ) for now
- jmp Door_Bonus
- Door_Type02:
- move.w #$0800, d4 ;!@Goto SBZ2 (FZ) for now
- jmp Door_Bonus
- ;Bonus Stage 3 - Castle
- Door_Type11:
- move.w #$0902, d4 ;!@Goto SBZ2 (FZ) for now
- jmp Door_Bonus
- Door_Type0D:
- move.w #$0901, d4 ;!@Goto SBZ2 (FZ) for now
- jmp Door_Bonus
- Door_Type03:
- move.w #$0900, d4 ;!@Goto SBZ2 (FZ) for now
- jmp Door_Bonus
- rts
- ;Bonus Stage 4 - Lava
- Door_Type12:
- move.w #$0A02, d4 ;!@Goto SBZ2 (FZ) for now
- jmp Door_Bonus
- Door_Type0E:
- move.w #$0A01, d4 ;!@Goto SBZ2 (FZ) for now
- jmp Door_Bonus
- Door_Type04:
- move.w #$0A00, d4 ;!@Goto SBZ2 (FZ) for now
- jmp Door_Bonus
- rts
- ;Inter-level door 1
- Door_Type05:
- ;Fetch hard-coded positions for each level to return to here into d2 and d3 from an array
- ;!@ Copied from StartLocArray (in "LevelSizeLoad & BgScrollSpeed.asm")
- move.w (v_zone).w,d0
- lsl.b #6,d0
- lsr.w #4,d0
- lea Warp05Array(pc,d0.w),a1 ; load Sonic's start location
- moveq #0,d1
- move.w (a1)+,d1
- move.w d1,d2 ;x location
- moveq #0,d0
- move.w (a1),d0 ;y location
- move.w d0,d3
- move.w (v_zone).w, d4
- move.b #1, d5 ;Set warp flag!
- bsr.w DoWarp
- rts
- ;!@NEW Level
- Warp05Array:
- ;GHZ
- dc.w $80,$A8
- dc.w $80,$A8
- dc.w $80,$A8
- dc.w $80,$A8
- ;LZ/SBZ3
- dc.w $80,$A8
- dc.w $80,$A8
- dc.w $80,$A8
- dc.w $80,$A8
- ;MZ
- dc.w $80,$A8
- dc.w $09C0, $0230
- dc.w $1755,$0270 ;Boss door (with pal change)
- dc.w $80,$A8
- ;SLZ
- dc.w $80,$A8
- dc.w $80,$A8
- dc.w $80,$A8
- dc.w $80,$A8
- ;SYZ
- dc.w $80,$A8
- dc.w $0AB5,$80
- dc.w $10A0,$0275 ;Boss door (with pal change)
- dc.w $80,$A8
- ;SBZ/FZ/Nada
- dc.w $80,$A8
- dc.w $80,$A8
- dc.w $80,$A8
- dc.w $80,$A8
- ;END1,2,Null,Null
- dc.w $80,$A8
- dc.w $80,$A8
- dc.w $80,$A8
- dc.w $80,$A8
- ;BZL
- dc.w $80,$A8
- dc.w $80,$A8
- dc.w $80,$A8
- dc.w $80,$A8
- ;BZF
- dc.w $80,$A8
- dc.w $80,$A8
- dc.w $80,$A8
- dc.w $80,$A8
- ;BZC
- dc.w $80,$A8
- dc.w $80,$A8
- dc.w $80,$A8
- dc.w $80,$A8
- ;BZLa
- dc.w $80,$A8
- dc.w $80,$A8
- dc.w $80,$A8
- dc.w $80,$A8
- even
- zonewarning Warp05Array,$10
- ;Inter-level door 2
- Door_Type06:
- ;Fetch hard-coded positions for each level to return to here into d2 and d3 from an array
- ;!@ Copied from StartLocArray (in "LevelSizeLoad & BgScrollSpeed.asm")
- move.w (v_zone).w,d0
- lsl.b #6,d0
- lsr.w #4,d0
- lea Warp06Array(pc,d0.w),a1 ; load Sonic's start location
- moveq #0,d1
- move.w (a1)+,d1
- move.w d1,d2 ;x location
- moveq #0,d0
- move.w (a1),d0 ;y location
- move.w d0,d3
- move.w (v_zone).w, d4
- move.b #1, d5 ;Set warp flag!
- bsr.w DoWarp
- rts
- ;!@NEW Level
- Warp06Array:
- ;GHZ
- dc.w $80,$A8
- dc.w $80,$A8
- dc.w $80,$A8
- dc.w $80,$A8
- ;LZ/SBZ3
- dc.w $80,$A8
- dc.w $80,$A8
- dc.w $80,$A8
- dc.w $80,$A8
- ;MZ
- dc.w $80,$A8
- dc.w $80,$A8
- dc.w $80,$A8
- dc.w $80,$A8
- ;SLZ
- dc.w $80,$A8
- dc.w $80,$A8
- dc.w $80,$A8
- dc.w $80,$A8
- ;SYZ
- dc.w $80,$A8
- dc.w $0268,$0540
- dc.w $80,$A8
- dc.w $80,$A8
- ;SBZ/FZ/Nada
- dc.w $80,$A8
- dc.w $80,$A8
- dc.w $80,$A8
- dc.w $80,$A8
- ;END1,2,Null,Null
- dc.w $80,$A8
- dc.w $80,$A8
- dc.w $80,$A8
- dc.w $80,$A8
- ;BZL
- dc.w $80,$A8
- dc.w $80,$A8
- dc.w $80,$A8
- dc.w $80,$A8
- ;BZF
- dc.w $80,$A8
- dc.w $80,$A8
- dc.w $80,$A8
- dc.w $80,$A8
- ;BZC
- dc.w $80,$A8
- dc.w $80,$A8
- dc.w $80,$A8
- dc.w $80,$A8
- ;BZLa
- dc.w $80,$A8
- dc.w $80,$A8
- dc.w $80,$A8
- dc.w $80,$A8
- even
- zonewarning Warp06Array,$10
- ;Inter-level door 3
- Door_Type07:
- ;Fetch hard-coded positions for each level to return to here into d2 and d3 from an array
- ;!@ Copied from StartLocArray (in "LevelSizeLoad & BgScrollSpeed.asm")
- move.w (v_zone).w,d0
- lsl.b #6,d0
- lsr.w #4,d0
- lea Warp07Array(pc,d0.w),a1 ; load Sonic's start location
- moveq #0,d1
- move.w (a1)+,d1
- move.w d1,d2 ;x location
- moveq #0,d0
- move.w (a1),d0 ;y location
- move.w d0,d3
- move.w (v_zone).w, d4
- move.b #1, d5 ;Set warp flag!
- bsr.w DoWarp
- rts
- ;!@NEW Level
- Warp07Array:
- ;GHZ
- dc.w $80,$A8
- dc.w $80,$A8
- dc.w $80,$A8
- dc.w $80,$A8
- ;LZ/SBZ3
- dc.w $80,$A8
- dc.w $80,$A8
- dc.w $80,$A8
- dc.w $80,$A8
- ;MZ
- dc.w $80,$A8
- dc.w $80,$A8
- dc.w $80,$A8
- dc.w $80,$A8
- ;SLZ
- dc.w $80,$A8
- dc.w $80,$A8
- dc.w $80,$A8
- dc.w $80,$A8
- ;SYZ
- dc.w $80,$A8
- dc.w $0398,$0560
- dc.w $80,$A8
- dc.w $80,$A8
- ;SBZ/FZ/Nada
- dc.w $80,$A8
- dc.w $80,$A8
- dc.w $80,$A8
- dc.w $80,$A8
- ;END1,2,Null,Null
- dc.w $80,$A8
- dc.w $80,$A8
- dc.w $80,$A8
- dc.w $80,$A8
- ;BZL
- dc.w $80,$A8
- dc.w $80,$A8
- dc.w $80,$A8
- dc.w $80,$A8
- ;BZF
- dc.w $80,$A8
- dc.w $80,$A8
- dc.w $80,$A8
- dc.w $80,$A8
- ;BZC
- dc.w $80,$A8
- dc.w $80,$A8
- dc.w $80,$A8
- dc.w $80,$A8
- ;BZLa
- dc.w $80,$A8
- dc.w $80,$A8
- dc.w $80,$A8
- dc.w $80,$A8
- even
- zonewarning Warp07Array,$10
- ;Inter-level door 4
- Door_Type08:
- ;Fetch hard-coded positions for each level to return to here into d2 and d3 from an array
- ;!@ Copied from StartLocArray (in "LevelSizeLoad & BgScrollSpeed.asm")
- move.w (v_zone).w,d0
- lsl.b #6,d0
- lsr.w #4,d0
- lea Warp08Array(pc,d0.w),a1 ; load Sonic's start location
- moveq #0,d1
- move.w (a1)+,d1
- move.w d1,d2 ;x location
- moveq #0,d0
- move.w (a1),d0 ;y location
- move.w d0,d3
- move.w (v_zone).w, d4
- move.b #1, d5 ;Set warp flag!
- bsr.w DoWarp
- rts
- ;!@NEW Level
- Warp08Array:
- ;GHZ
- dc.w $80,$A8
- dc.w $80,$A8
- dc.w $80,$A8
- dc.w $80,$A8
- ;LZ/SBZ3
- dc.w $80,$A8
- dc.w $80,$A8
- dc.w $80,$A8
- dc.w $80,$A8
- ;MZ
- dc.w $80,$A8
- dc.w $80,$A8
- dc.w $80,$A8
- dc.w $80,$A8
- ;SLZ
- dc.w $80,$A8
- dc.w $80,$A8
- dc.w $80,$A8
- dc.w $80,$A8
- ;SYZ
- dc.w $80,$A8
- dc.w $047B,$0560
- dc.w $80,$A8
- dc.w $80,$A8
- ;SBZ/FZ/Nada
- dc.w $80,$A8
- dc.w $80,$A8
- dc.w $80,$A8
- dc.w $80,$A8
- ;END1,2,Null,Null
- dc.w $80,$A8
- dc.w $80,$A8
- dc.w $80,$A8
- dc.w $80,$A8
- ;BZL
- dc.w $80,$A8
- dc.w $80,$A8
- dc.w $80,$A8
- dc.w $80,$A8
- ;BZF
- dc.w $80,$A8
- dc.w $80,$A8
- dc.w $80,$A8
- dc.w $80,$A8
- ;BZC
- dc.w $80,$A8
- dc.w $80,$A8
- dc.w $80,$A8
- dc.w $80,$A8
- ;BZLa
- dc.w $80,$A8
- dc.w $80,$A8
- dc.w $80,$A8
- dc.w $80,$A8
- even
- zonewarning Warp08Array,$10
- ;Inter-level door 5
- Door_Type09:
- ;Fetch hard-coded positions for each level to return to here into d2 and d3 from an array
- ;!@ Copied from StartLocArray (in "LevelSizeLoad & BgScrollSpeed.asm")
- move.w (v_zone).w,d0
- lsl.b #6,d0
- lsr.w #4,d0
- lea Warp09Array(pc,d0.w),a1 ; load Sonic's start location
- moveq #0,d1
- move.w (a1)+,d1
- move.w d1,d2 ;x location
- moveq #0,d0
- move.w (a1),d0 ;y location
- move.w d0,d3
- move.w (v_zone).w, d4
- move.b #1, d5 ;Set warp flag!
- bsr.w DoWarp
- rts
- ;!@NEW Level
- Warp09Array:
- ;GHZ
- dc.w $80,$A8
- dc.w $80,$A8
- dc.w $80,$A8
- dc.w $80,$A8
- ;LZ/SBZ3
- dc.w $80,$A8
- dc.w $80,$A8
- dc.w $80,$A8
- dc.w $80,$A8
- ;MZ
- dc.w $80,$A8
- dc.w $80,$A8
- dc.w $80,$A8
- dc.w $80,$A8
- ;SLZ
- dc.w $80,$A8
- dc.w $80,$A8
- dc.w $80,$A8
- dc.w $80,$A8
- ;SYZ
- dc.w $80,$A8
- dc.w $0740,$05A5
- dc.w $80,$A8
- dc.w $80,$A8
- ;SBZ/FZ/Nada
- dc.w $80,$A8
- dc.w $80,$A8
- dc.w $80,$A8
- dc.w $80,$A8
- ;END1,2,Null,Null
- dc.w $80,$A8
- dc.w $80,$A8
- dc.w $80,$A8
- dc.w $80,$A8
- ;BZL
- dc.w $80,$A8
- dc.w $80,$A8
- dc.w $80,$A8
- dc.w $80,$A8
- ;BZF
- dc.w $80,$A8
- dc.w $80,$A8
- dc.w $80,$A8
- dc.w $80,$A8
- ;BZC
- dc.w $80,$A8
- dc.w $80,$A8
- dc.w $80,$A8
- dc.w $80,$A8
- ;BZLa
- dc.w $80,$A8
- dc.w $80,$A8
- dc.w $80,$A8
- dc.w $80,$A8
- even
- zonewarning Warp09Array,$10
- ;Inter-level door 6
- Door_Type0A:
- ;Fetch hard-coded positions for each level to return to here into d2 and d3 from an array
- ;!@ Copied from StartLocArray (in "LevelSizeLoad & BgScrollSpeed.asm")
- move.w (v_zone).w,d0
- lsl.b #6,d0
- lsr.w #4,d0
- lea Warp0AArray(pc,d0.w),a1 ; load Sonic's start location
- moveq #0,d1
- move.w (a1)+,d1
- move.w d1,d2 ;x location
- moveq #0,d0
- move.w (a1),d0 ;y location
- move.w d0,d3
- move.w (v_zone).w, d4
- move.b #1, d5 ;Set warp flag!
- bsr.w DoWarp
- rts
- ;!@NEW Level
- Warp0AArray:
- ;GHZ
- dc.w $80,$A8
- dc.w $80,$A8
- dc.w $80,$A8
- dc.w $80,$A8
- ;LZ/SBZ3
- dc.w $80,$A8
- dc.w $80,$A8
- dc.w $80,$A8
- dc.w $80,$A8
- ;MZ
- dc.w $80,$A8
- dc.w $80,$A8
- dc.w $80,$A8
- dc.w $80,$A8
- ;SLZ
- dc.w $80,$A8
- dc.w $80,$A8
- dc.w $80,$A8
- dc.w $80,$A8
- ;SYZ
- dc.w $80,$A8
- dc.w $1338,$0345
- dc.w $80,$A8
- dc.w $80,$A8
- ;SBZ/FZ/Nada
- dc.w $80,$A8
- dc.w $80,$A8
- dc.w $80,$A8
- dc.w $80,$A8
- ;END1,2,Null,Null
- dc.w $80,$A8
- dc.w $80,$A8
- dc.w $80,$A8
- dc.w $80,$A8
- ;BZL
- dc.w $80,$A8
- dc.w $80,$A8
- dc.w $80,$A8
- dc.w $80,$A8
- ;BZF
- dc.w $80,$A8
- dc.w $80,$A8
- dc.w $80,$A8
- dc.w $80,$A8
- ;BZC
- dc.w $80,$A8
- dc.w $80,$A8
- dc.w $80,$A8
- dc.w $80,$A8
- ;BZLa
- dc.w $80,$A8
- dc.w $80,$A8
- dc.w $80,$A8
- dc.w $80,$A8
- even
- zonewarning Warp09Array,$10
- ; ---------------------------------------------------------------------------
- ; Subroutine to apply warp params and do the warp
- ; ---------------------------------------------------------------------------
- DoWarp:
- ;Params for $4f obj:
- ;d2 - X coord to warp to
- ;d3 - Y coord to warp to
- ;d4 - Zone/Act to warp to (zzaa, 2 bytes)
- ;d5 - Warp type (1 or 2 value for f_warp)
- ;0=no warp
- ;1=inter-level warp (skip Title cards, keep rings/time. If die, go back to previous starpost (if any)
- ;2=bonus stage warp (keep rings/time. If die, go back to previous stage.)
- ;3=you died in High Speed Zone special stage, go back to previous stage (internally set in game).
- ;Move the data from regs to appropriate vars for warp
- ;sfx sfx_EnterSS,0,1,0 ; play special stage entry sound
- move.w d2, (v_warp_x).w
- move.w d3, (v_warp_y).w
- move.w d4, (v_zone).w ;Zone/Act
- move.b d5, (f_warp).w ;Set warp flag!
- move.b #1, (f_restart).w ;Do the warp!
- rts
- ; ===========================================================================
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement