Skip to content

Commit

Permalink
Fixed sticky sand!
Browse files Browse the repository at this point in the history
  • Loading branch information
DrMelon committed Oct 30, 2020
1 parent bb587e4 commit 8fd907e
Show file tree
Hide file tree
Showing 4 changed files with 43 additions and 24 deletions.
53 changes: 29 additions & 24 deletions sonic3k.asm
Original file line number Diff line number Diff line change
Expand Up @@ -8694,6 +8694,7 @@ loc_7402:
move.b (V_int_run_count+3).w,d0
andi.b #$F,d0
bne.s locret_7446
move.w #1,(Golf_force_temp).w ; Temporarily turn on golf force on this object
moveq #sfx_SlideSkidQuiet,d0
jsr (Play_Sound_2).l

Expand Down Expand Up @@ -22974,6 +22975,8 @@ GolfButtonPressed:
move.w ground_vel(a0),d0; cannot enter golf mode while still moving, unless override set
cmpi.w #1,(Golf_force_allow).w
beq.s +
cmpi.w #1,(Golf_force_temp).w
beq.s +
cmpi.w #$0040,d0
bhi.s GolfButtonNotPressed
+
Expand Down Expand Up @@ -23023,6 +23026,7 @@ SkipGolf:

GolfSwing:
bclr #0,(Golf_mode_status).w ; strike mode cleared!
move.w #0,(Golf_force_temp).w; clear temp force flag

; set x veloc, set y veloc, set rolling/jumping
move.w (Golf_meter_y).w,y_vel(a0)
Expand Down Expand Up @@ -31748,7 +31752,7 @@ loc_173B0:
move.b $26(a0),d0
add.b d1,d0
move.w d0,-(sp)
bsr.w sub_F61C
jsr sub_F61C ; was bsr.w -- golf edit for compile
move.w (sp)+,d0
tst.w d1
bpl.s locret_17426
Expand Down Expand Up @@ -39814,9 +39818,9 @@ Obj_3A_2:
andi.w #3,d0
add.w d0,d0
move.w word_1D178(pc,d0.w),$32(a0)
move.w $14(a0),d1
lea (Player_1).w,a1
cmp.w $14(a1),d1
move.w $14(a0),d1 ; move y pos of this object into d1
lea (Player_1).w,a1 ; move player into a1
cmp.w $14(a1),d1 ; compare player y pos against d1 (this object's Y pos)
bhs.s loc_1D15E
move.b #1,$34(a0)

Expand All @@ -39842,8 +39846,8 @@ loc_1D180:
add.w d0,d0
move.w word_1D178(pc,d0.w),$32(a0)
move.w $10(a0),d1
lea (Player_1).w,a1
cmp.w $10(a1),d1
lea (Player_1).w,a1 ; load player 1 into a1
cmp.w $10(a1),d1 ; check player 1's x position against d1 (this object's x pos)
bhs.s loc_1D1A4
move.b #1,$34(a0)

Expand All @@ -39857,11 +39861,11 @@ loc_1D1B4:
move.l #loc_1D1BA,(a0)

loc_1D1BA:
tst.w (Debug_placement_mode).w
tst.w (Debug_placement_mode).w ; is the player in debug mode?
bne.w loc_1D1DC
move.w $10(a0),d1
lea $34(a0),a2
lea (Player_1).w,a1
lea (Player_1).w,a1 ; load player into a1 again
bsr.s sub_1D1E2
lea (Player_2).w,a1
bsr.s sub_1D1E2
Expand Down Expand Up @@ -39892,7 +39896,7 @@ sub_1D1E2:
bge.w locret_1D38E
move.b $2C(a0),d0
bpl.s loc_1D224
btst #1,$2A(a1)
btst #1,$2A(a1) ; check rolling / jumping on a1's status flags.
bne.w locret_1D38E

loc_1D224:
Expand All @@ -39908,7 +39912,7 @@ loc_1D22E:
bne.s loc_1D2A6
btst #3,d0
bne.s loc_1D276
cmpi.b #$C,$46(a1)
cmpi.b #$C,$46(a1) ; top/bottom bitmask check on player
bne.s loc_1D254
move.b #0,1(a2)
bra.s loc_1D268
Expand All @@ -39923,8 +39927,8 @@ loc_1D254:
; ---------------------------------------------------------------------------

loc_1D268:
move.b #$C,$46(a1)
move.b #$D,$47(a1)
move.b #$C,$46(a1) ; set top bitmask
move.b #$D,$47(a1) ; same with bottom bitmask
bra.s loc_1D2A6
; ---------------------------------------------------------------------------

Expand All @@ -39948,7 +39952,7 @@ loc_1D29A:
move.b #$F,$47(a1)

loc_1D2A6:
andi.w #$7FFF,$A(a1)
andi.w #$7FFF,$A(a1)
btst #5,d0
beq.w locret_1D38E
ori.w #$8000,$A(a1)
Expand All @@ -39971,7 +39975,7 @@ loc_1D2BE:
bge.w locret_1D38E
move.b $2C(a0),d0
bpl.s loc_1D2FA
btst #1,$2A(a1)
btst #1,$2A(a1) ; check jumping/rolling status bitfield again
bne.w locret_1D38E

loc_1D2FA:
Expand Down Expand Up @@ -40002,7 +40006,7 @@ loc_1D32A:
; ---------------------------------------------------------------------------

loc_1D33E:
move.b #$C,$46(a1)
move.b #$C,$46(a1) ; set top/bottom bitmasks
move.b #$D,$47(a1)
bra.s loc_1D37C
; ---------------------------------------------------------------------------
Expand Down Expand Up @@ -40043,7 +40047,7 @@ loc_1D390:
bne.w loc_1D3B2
move.w $14(a0),d1
lea $34(a0),a2
lea (Player_1).w,a1
lea (Player_1).w,a1 ; shift player 1 into a1
bsr.s sub_1D3B8
lea (Player_2).w,a1
bsr.s sub_1D3B8
Expand Down Expand Up @@ -40074,7 +40078,7 @@ sub_1D3B8:
bge.w locret_1D564
move.b $2C(a0),d0
bpl.s loc_1D3FA
btst #1,$2A(a1)
btst #1,$2A(a1) ; another test against roll/jump bitfield
bne.w locret_1D564

loc_1D3FA:
Expand Down Expand Up @@ -85587,7 +85591,7 @@ Obj_3B_2:
move.l #loc_4045E,(a0)

loc_4045E:
lea (Player_1).w,a1
lea (Player_1).w,a1 ; copy player 1 into a1
moveq #3,d6
bsr.s sub_40474
lea (Player_2).w,a1
Expand All @@ -85611,20 +85615,21 @@ sub_40474:
addi.w #$10,d0
cmpi.w #$20,d0
bhs.s locret_40506
btst #3,$2A(a1)
btst #3,$2A(a1) ; test for "onobj" on a1
bne.s locret_40506
cmpi.b #4,5(a1)
cmpi.b #4,5(a1) ; test for rolling routine on a1
bhs.s locret_40506
tst.b $2E(a1)
bne.s locret_40506
cmpi.w #$800,$1A(a1)
cmpi.w #$800,$1A(a1) ; check player speed against 0x800
blt.s locret_40506
bset #3,$2A(a1)
bset #3,$2A(a1) ; set status 3 on a1 - set "onobj" on.
; since this is maybe the slide object, let's set golf mode override on here
bset d6,$2A(a0)
move.b #$E,$1E(a1)
move.b #7,$1F(a1)
move.b #2,$20(a1)
bset #2,$2A(a1)
bset #2,$2A(a1) ; set status 2 on a1 - set "roll" on.
bclr #4,$2A(a1)
move.b #0,double_jump_flag(a1)
move.b #0,$40(a1)
Expand All @@ -85642,7 +85647,7 @@ loc_40508:
lsl.l #8,d0
add.l d0,$10(a1)
move.w $1A(a1),d0
addi.w #$38,$1A(a1)
addi.w #$38,$1A(a1) ; add velocity to a1.
ext.l d0
lsl.l #8,d0
add.l d0,$14(a1)
Expand Down
1 change: 1 addition & 0 deletions sonic3k.constants.asm
Original file line number Diff line number Diff line change
Expand Up @@ -954,6 +954,7 @@ Golf_accumulator: ds.w 1; 2 bytes - to be used instead of timer_frames for golf
Golf_swings_total: ds.w 1; 2 bytes - swing total over whole game. hopefully nobody takes more than 65535 swings...
Golf_did_just_swing: ds.w 1; 2 bytes - did we just swing?
Golf_force_allow: ds.w 1; 2 bytes - force allow swings. for autoscroll sections
Golf_force_temp: ds.w 1; 2 bytes - same as golf force allow, but only for 1 swing

Checksum_string := * ; set to 'SM&K' once the checksum routine has run
ds.l 1 ; Sonic 3 has a different address... So uh... Yes
Expand Down
12 changes: 12 additions & 0 deletions sonic3k.wch
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
SystemID GEN
00FFE0 w u 1 68K RAM Swings
00FFE2 w b 1 68K RAM ModeFlag
00FFE4 w u 1 68K RAM PosX
00FFE6 w u 1 68K RAM PosY
00FFE8 b u 1 68K RAM Reset Timer
00FFEA w u 1 68K RAM Accumulator
00FFEC w b 1 68K RAM TotalSwings
00FFEE w b 1 68K RAM DidSwing
00FFF0 w b 1 68K RAM ForceAllow
00FFF2 w b 1 68K RAM ForceATemp

1 change: 1 addition & 0 deletions todo.todo
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
✔ Hyper music sucks. Replace with speedshoe logic. @done(20-10-29 22:10)
✔ Snoh no! Fix the MHZ boss (and AIZ flying battery sequence?) @done(20-10-29 21:53)
✔ Fix sticky sandopolis sand @done(20-10-30 22:40)

0 comments on commit 8fd907e

Please sign in to comment.