Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ; the thing I'm having issues with
- loc_42C8:
- tst.b (Water_flag).w
- beq.s loc_42E8
- moveq #$15,d0
- cmpi.b #8,(Current_Zone).w
- beq.s loc_42E4
- moveq #$16,d0
- cmpi.b #$D,(Current_Zone).w
- beq.s loc_42E4
- moveq #$17,d0
- cmpi.b #$F,(Current_Zone).w
- beq.s loc_42E4
- moveq #$30,d0
- loc_42E4:
- bsr.w PalLoad4_Water
- ; everything else, just in case it's important
- ; water height
- loc_402C:
- move.w (Hint_counter_reserve).w,(a6)
- clr.w (VDP_Command_Buffer).w
- move.l #VDP_Command_Buffer,(VDP_Command_Buffer_Slot).w
- tst.b (Water_flag).w ; does level have water?
- beq.s Level_LoadPal ; if not, branch
- move.w #$8014,(a6)
- moveq #0,d0
- move.w (Current_ZoneAndAct).w,d0
- lsl.b #6,d0
- lsr.w #4,d0
- andi.w #$FFFE,d0
- lea (WaterHeight).l,a1 ; load water height array
- move.w (a1,d0.w),d0
- move.w d0,(Water_Level_1).w ; set water heights
- move.w d0,(Water_Level_2).w
- move.w d0,(Water_Level_3).w
- clr.b (Water_routine).w ; clear water routine counter
- clr.b (Water_move).w ; clear water movement
- move.b #1,(Water_on).w ; enable water
- ; dynamic water
- ; sub_45A4: ; LZDynamicWater:
- DynamicWater:
- moveq #0,d0
- move.w (Current_ZoneAndAct).w,d0
- lsl.b #6,d0
- lsr.w #4,d0
- andi.w #$FFFE,d0
- move.w (Dynamic_water_routine_table,pc,d0.w),d0
- jsr (Dynamic_water_routine_table,pc,d0.w)
- moveq #0,d1
- move.b (Water_on).w,d1
- move.w (Water_Level_3).w,d0
- sub.w (Water_Level_2).w,d0
- beq.s return_45D6
- bcc.s loc_45D2
- neg.w d1
- loc_45D2:
- add.w d1,(Water_Level_2).w
- return_45D6:
- rts ; Return to whatever code was running before this routine was run.
- ; End of function DynamicWater
- ; level end type
- ; sub_4BD2:
- SetLevelEndType:
- move.w #0,(Level_Has_Signpost).w ; set level type to non-signpost
- tst.w (Two_player_mode).w ; is it two-player competitive mode?
- bne.w LevelEnd_SetSignpost ; if yes, branch
- cmpi.w #$0003,(Current_ZoneAndAct).w
- beq.w return_4C46
- ; loc_4C40:
- LevelEnd_SetSignpost:
- move.w #1,(Level_Has_Signpost).w ; set level type to signpost
- return_4C46:
- rts ; Return to whatever code was running before this routine was run.
- ; End of function SetLevelEndType
- ; level size and start location
- ; sub_BFBC:
- LevelSizeLoad:
- clr.w ($FFFFEE50).w
- clr.w ($FFFFEE52).w
- clr.w ($FFFFEE54).w
- clr.w ($FFFFEE56).w
- clr.w ($FFFFEE58).w
- clr.w ($FFFFEE5A).w
- clr.w ($FFFFEE5C).w
- clr.w ($FFFFEE5E).w
- clr.w ($FFFFEEA0).w
- clr.w ($FFFFEEA2).w
- clr.w ($FFFFEEA4).w
- clr.w ($FFFFEEA6).w
- clr.w ($FFFFEEA8).w
- clr.w ($FFFFEEAA).w
- clr.w ($FFFFEEAC).w
- clr.w ($FFFFEEAE).w
- clr.b ($FFFFEEDC).w
- clr.b ($FFFFEEBC).w
- clr.b ($FFFFEEBD).w
- clr.b ($FFFFEEBE).w
- clr.b ($FFFFEEBF).w
- moveq #0,d0
- move.b d0,(Dynamic_Resize_Routine).w ; Prepare to load the level boundaries by resetting the dynamic resize routine.
- move.w (Current_ZoneAndAct).w,d0
- lsl.b #6,d0
- lsr.w #4,d0
- add.w d0,d0
- lea WrdArr_LvlSize(pc,d0.w),a0
- move.l (a0)+,d0
- move.l d0,(Camera_Min_X_pos).w
- move.l d0,($FFFFEEC0).w ; unused besides this one write...
- move.l d0,(Tails_Min_X_pos).w
- move.l (a0)+,d0
- move.l d0,(Camera_Min_Y_pos).w
- move.l d0,($FFFFEEC4).w ; unused besides this one write...
- move.l d0,($FFFFEEFC).w
- move.w #$1010,($FFFFEE40).w
- move.w #$60,(Camera_Y_pos_bias).w
- move.w #$60,(Camera_Y_pos_bias_2P).w
- bra.w loc_C164
- ; ===========================================================================
- ; ----------------------------------------------------------------------------
- ; LEVEL SIZE ARRAY
- ; This array defines the screen boundaries for each act in the game.
- ; ----------------------------------------------------------------------------
- ; xstart xend ystart yend ; Zone ID ; Zone
- WrdArr_LvlSize:
- dc.w $0, $2600, $80, $720 ; $00 ; Frosty Dusk Zone Act 1.
- dc.w $0, $1980, $80, $720 ; Frosty Dusk Zone Act 2.
- dc.w $0, $3FFF, $0, $720 ; $01
- dc.w $0, $3FFF, $0, $720
- dc.w $0, $3FFF, $0, $720 ; $02
- dc.w $0, $3FFF, $0, $720
- dc.w $0, $3FFF, $0, $720 ; $03
- dc.w $0, $3FFF, $0, $720
- dc.w $0, $2280, -$100, $800 ; $04 ; MTZ act 1
- dc.w $0, $1E80, -$100, $800 ; MTZ act 2
- dc.w $0, $2A80, -$100, $800 ; $05 ; MTZ act 3
- dc.w $0, $3FFF, -$100, $800
- dc.w $0, $3FFF, $0, $720 ; $06 ; WFZ
- dc.w $0, $3FFF, $0, $720
- dc.w $0, $2800, $0, $720 ; $07 ; HTZ act 1
- dc.w $0, $3280, $0, $720 ; HTZ act 2
- dc.w $0, $3FFF, $0, $720 ; $08
- dc.w $0, $3FFF, $0, $720
- dc.w $0, $3FFF, $0, $720 ; $09
- dc.w $0, $3FFF, $0, $720
- dc.w $0, $2F80, $0, $680 ; $0A ; OOZ act 1
- dc.w $0, $2D00, $0, $680 ; OOZ act 2
- dc.w $0, $2380, $3C0, $720 ; $0B ; MCZ act 1
- dc.w $0, $3FFF, $60, $720 ; MCZ act 2
- dc.w $0, $27A0, $0, $720 ; $0C ; CNZ act 1
- dc.w $0, $2A80, $0, $720 ; CNZ act 2
- dc.w $0, $2780, $0, $720 ; $0D ; CPZ act 1
- dc.w $0, $2A80, $0, $720 ; CPZ act 2
- dc.w $0, $1000, $C8, $C8 ; $0F ; DEZ
- dc.w $0, $1000, $C8, $C8
- dc.w $0, $28C0, $200, $600 ; $10 ; ARZ act 1
- dc.w $0, $3FFF, $180, $710 ; ARZ act 2
- dc.w $0, $3FFF, $0, $000 ; $11 ; SCZ
- dc.w $0, $3FFF, $0, $720
- ; ===========================================================================
- loc_C164:
- tst.b (Last_star_pole_hit).w
- beq.s loc_C17A
- jsr (Obj79_LoadData).l
- move.w (MainCharacter+x_pos).w,d1
- move.w (MainCharacter+y_pos).w,d0
- bra.s loc_C196
- ; ===========================================================================
- loc_C17A:
- move.w (Current_ZoneAndAct).w,d0
- lsl.b #6,d0
- lsr.w #4,d0
- lea WrdArr_StartLoc(pc,d0.w),a1
- moveq #0,d1
- move.w (a1)+,d1
- move.w d1,(MainCharacter+x_pos).w
- moveq #0,d0
- move.w (a1),d0
- move.w d0,(MainCharacter+y_pos).w
- loc_C196:
- subi.w #$A0,d1
- bcc.s loc_C19E
- moveq #0,d1
- loc_C19E:
- move.w (Camera_Max_X_pos).w,d2
- cmp.w d2,d1
- bcs.s loc_C1A8
- move.w d2,d1
- loc_C1A8:
- move.w d1,(Camera_X_pos).w
- move.w d1,($FFFFEE20).w
- subi.w #$60,d0
- bcc.s loc_C1B8
- moveq #0,d0
- loc_C1B8:
- cmp.w (Camera_Max_Y_pos_now).w,d0
- blt.s loc_C1C2
- move.w (Camera_Max_Y_pos_now).w,d0
- loc_C1C2:
- move.w d0,(Camera_Y_pos).w
- move.w d0,($FFFFEE24).w
- bsr.w sub_C258
- rts ; Return to whatever code was running before this routine was run.
- ; End of function LevelSizeLoad
- ; ===========================================================================
- ; --------------------------------------------------------------------------------------
- ; CHARACTER START LOCATION ARRAY
- ; 2 entries per act, corresponding to the X and Y locations that you want the player to
- ; appear at when the level starts.
- ; --------------------------------------------------------------------------------------
- WrdArr_StartLoc:
- dc.w $40, $46C ; $00
- dc.w $28, $4EC
- dc.w $28, $4EC ; $01
- dc.w $60, $2AF
- dc.w $60, $1AC ; $02
- dc.w $60, $1AC
- dc.w $60, $28F ; $03
- dc.w $60, $2AF
- dc.w $60, $28C ; $04
- dc.w $60, $5EC
- dc.w $60, $20C ; $05
- dc.w $60, $2AF
- dc.w $60, $4CC ; $06
- dc.w $1E0, $4CC
- dc.w $60, $3EF ; $07
- dc.w $60, $6AF
- dc.w $230, $1AC ; $08
- dc.w $230, $1AC
- dc.w $60, $28F ; $09
- dc.w $60, $2AF
- dc.w $60, $6AC ; $0A
- dc.w $60, $56C
- dc.w $60, $6AC ; $0B
- dc.w $60, $5AC
- dc.w $60, $2AC ; $0C
- dc.w $60, $58C
- dc.w $60, $1EC ; $0D
- dc.w $60, $12C
- dc.w $60, $12D ; $0E
- dc.w $60, $12D
- dc.w $60, $37E ; $0F
- dc.w $60, $37E
- dc.w $120, $70 ; $10
- dc.w $140, $70
- ; level layout loading
- loadLevelLayout:
- moveq #0,d0 ; XREF: LevelLayoutLoad
- move.w (Current_ZoneAndAct).w,d0
- lsl.b #6,d0
- lsr.w #5,d0
- lea (Off_Level).l,a0
- move.w (a0,d0.w),d0
- lea (a0,d0.l),a0
- lea (Level_Layout).w,a1
- bra.w JmpTo_KosDec
- ; End of function loadLevelLayout
- ; level order stuff (after end-of-level results screen)
- loc_14270:
- moveq #0,d0
- move.w (Current_ZoneAndAct).w,d0
- lsl.b #6,d0
- lsr.w #4,d0
- lea LevelOrder(pc),a1
- move.w (a1,d0.w),d2
- tst.w d0
- bpl.s loc_1429C
- move.b #0,(Game_Mode).w ; => SegaScreen
- rts ; Return to whatever code was running before this routine was run.
- ; ===========================================================================
- ; ---------------------------------------------------------------------------
- ; Main game level order
- ; One value per act. That value is the level/act number of the level to load
- ; when that act finishes.
- ; ---------------------------------------------------------------------------
- ; word_142F8:
- LevelOrder:
- dc.w 1 ; $0000 -> $0001 ; Frosty Dusk Zone Act 1 --> Frosty Dusk Zone Act 2
- dc.w 2 ; $0001 -> $0002 ; Frosty Dusk Zone Act 2 --> Frosty Dusk Zone Act 3
- dc.w $FFFF ; $0002 -> SegaScreen ; Frosty Dusk Zone Act 3 --> SEGA Screen for the time being
- dc.w $D00 ; $0003 -> $0D00 ; Frosty Dusk Zone Boss Act --> Corrosive Factory Zone Act 1
- dc.w 0 ; $0100 -> $0000 ; Zone $01 Act 1 --> Frosty Dusk Zone Act 1
- dc.w 0 ; $0101 -> $0000 ; Zone $01 Act 2 --> Frosty Dusk Zone Act 1
- dc.w 0 ; $0102 -> $0000 ; Zone $01 Act 3 --> Frosty Dusk Zone Act 1
- dc.w 0 ; $0103 -> $0000 ; Zone $01 Act 4 --> Frosty Dusk Zone Act 1
- dc.w $201 ; 4
- dc.w $400 ; 5
- dc.w 0 ; 2
- dc.w 0 ; 3
- dc.w 0 ; 6
- dc.w 0 ; 7
- dc.w 0 ; 2
- dc.w 0 ; 3
- dc.w $401 ; 8
- dc.w $500 ; 9
- dc.w 0 ; 2
- dc.w 0 ; 3
- dc.w $1000 ; 10
- dc.w 0 ; 11
- dc.w 0 ; 2
- dc.w 0 ; 3
- dc.w $E00 ; 12
- dc.w 0 ; 13
- dc.w 0 ; 2
- dc.w 0 ; 3
- dc.w $701 ; 14
- dc.w $B00 ; 15
- dc.w 0 ; 2
- dc.w 0 ; 3
- dc.w $801 ; 16
- dc.w $A00 ; 17
- dc.w 0 ; 2
- dc.w 0 ; 3
- dc.w 0 ; 18
- dc.w 0 ; 19
- dc.w 0 ; 2
- dc.w 0 ; 3
- dc.w $A01 ; 20
- dc.w $400 ; 21
- dc.w 0 ; 2
- dc.w 0 ; 3
- dc.w $B01 ; 22
- dc.w $A00 ; 23
- dc.w 0 ; 2
- dc.w 0 ; 3
- dc.w $C01 ; 24
- dc.w $700 ; 25
- dc.w 0 ; 2
- dc.w 0 ; 3
- dc.w $D01 ; 26
- dc.w $F00 ; 27
- dc.w 0 ; 2
- dc.w 0 ; 3
- dc.w $FFFF ; 28
- dc.w 0 ; 29
- dc.w 0 ; 2
- dc.w 0 ; 3
- dc.w $F01 ; 30
- dc.w $C00 ; 31
- dc.w 0 ; 2
- dc.w 0 ; 3
- dc.w $600 ; 32
- dc.w 0 ; 33
- dc.w 0 ; 2
- dc.w 0 ; 3
- ; rings manager setup (mind you, I've ported the S3K rings manager)
- RingsManager_Setup:
- clearRAM Ring_Positions,Rings_Space
- ; d0 = 0
- lea ($FFFFEF80).w,a1
- move.w #bytesToLcnt($80),d1
- - move.l d0,(a1)+
- dbf d1,-
- moveq #0,d5
- moveq #0,d0
- move.w (Current_ZoneAndAct).w,d0
- lsl.b #6,d0
- lsr.w #5,d0
- lea (Off_Rings).l,a1
- move.w (a1,d0.w),d0
- lea (a1,d0.w),a1
- move.l a1,(Ring_start_addr_ROM).w
- addq.w #4,a1
- moveq #0,d5
- move.w #(Max_Rings-1),d0
- -
- tst.l (a1)+
- bmi.s +
- addq.w #1,d5
- dbf d0,-
- +
- move.w d5,(Perfect_rings_left).w
- move.w #0,($FFFFFF42).w ; no idea what this is
- rts ; Return to whatever code was running before this routine was run.
- ; object layout loading
- loc_17AB8:
- addq.b #2,(Obj_placement_routine).w
- move.w (Current_ZoneAndAct).w,d0
- lsl.b #6,d0
- lsr.w #5,d0
- lea (Off_Objects).l,a0 ; Next, load the first pointer in the object layout list pointer index.
- movea.l a0,a1 ; Now copy it for quicker use later.
- adda.w (a0,d0.w),a0 ; (Point1 * 2) + $0002
- move.l a0,(Obj_load_addr_0).w ; set object placement list
- move.l a0,(Obj_load_addr_1).w
- move.l a0,(Obj_load_addr_2).w
- move.l a0,(Obj_load_addr_3).w
- lea (Object_Respawn_Table).w,a2 ; load respawn list
- move.w #$101,(a2)+ ; $01 $01
- move.w #$5E,d0 ; set loop counter
Advertisement