Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ; ----------------------------------------------------------------------------
- ; Object EF - Swinging Vine (Ported from S3K)
- ; ----------------------------------------------------------------------------
- objEF:
- ;$3E - addresses
- ;$3C - addresses
- ;$42 ($14) - timer offset, based on a subtype value
- ;$44 ($34) - y detachement offset
- Obj_SwingVine:
- moveq #0,d0
- move.b routine(a0),d0
- move.w SwingObjIndex(pc,d0.w),d1
- jmp SwingObjIndex(pc,d1.w)
- ; ===========================================================================
- SwingObjIndex:
- dc.w Obj_SwingVine_Init-SwingObjIndex
- dc.w SwingVine_MarkObjGone-SwingObjIndex ; MarkObjGone
- dc.w SwingVine_Handle_Collide-SwingObjIndex ; init
- dc.w SwingVine_Rope-SwingObjIndex ; Rope
- dc.w SwingVine_Handle-SwingObjIndex ; Handle
- dc.w SwingVine_Something-SwingObjIndex ; Angle Handler?
- dc.w SwingVine_Handle_Colliding-SwingObjIndex
- ; ===========================================================================
- Obj_SwingVine_Init:
- movea.l a0,a1
- move.b (a0),(a1)
- move.b #2,routine(a1)
- bsr.w sub_2241A
- move.b #$21,mapping_frame(a1)
- move.w x_pos(a0),d2
- move.w y_pos(a0),d3
- move.b subtype(a0),d1
- andi.w #$F,d1
- jsr (SingleObjLoad).l
- bne.w loc_22418
- move.w #-$1B0,$34(a1)
- move.w a1,$3E(a0)
- move.b (a0),(a1)
- move.b #$A,routine(a1)
- move.w a0,$3C(a1)
- move.b subtype(a0),d0
- andi.b #-$10,d0
- move.b d0,$14(a1)
- bra.s loc_223EA
- ; ---------------------------------------------------------------------------
- loc_223D2:
- jsr (SingleObjLoad).l
- bne.w loc_22418
- move.b (a0),(a1)
- move.b #6,routine(a1)
- move.w a2,$3C(a1)
- move.w a1,$3E(a2)
- loc_223EA:
- movea.l a1,a2
- bsr.s sub_2241A
- move.w d2,x_pos(a1)
- move.w d3,y_pos(a1)
- addi.w #$10,d3
- addq.w #1,$36(a0)
- move.w $36(a0),$36(a1)
- dbf d1,loc_223D2
- move.b (a0),(a1)
- move.b #8,routine(a1)
- move.b #$40,collision_flags(a1)
- move.b #$20,mapping_frame(a1)
- loc_22418:
- bra.s SwingVine_MarkObjGone
- ; =============== S U B R O U T I N E =======================================
- sub_2241A:
- move.b #4,render_flags(a1) ; 00000100
- move.b #8,width_pixels(a1)
- ;move.b #8,6(a1) ; pixel_height
- move.b #$0,priority(a1)
- move.l #Map_Swing,mappings(a1)
- move.w #$4420,art_tile(a1)
- rts
- ; ---------------------------------------------------------------------------
- SwingVine_MarkObjGone:
- move.w x_pos(a0),d0
- andi.w #$FF80,d0
- sub.w (Camera_X_pos_coarse).w,d0
- cmpi.w #$280,d0
- bhi.w loc_2245C
- move.w y_pos(a0),d0
- andi.w #$FF80,d0
- sub.w (Camera_Y_pos_coarse).w,d0
- cmpi.w #$280,d0
- bhi.w loc_2245C
- jmp (DisplaySprite).l
- ; ---------------------------------------------------------------------------
- loc_2245C:
- move.w $36(a0),d2
- subq.w #1,d2
- bcs.s loc_22478
- movea.w $3E(a0),a2
- loc_22468:
- movea.l a2,a1
- movea.w $3E(a1),a2
- jsr (DeleteObject2).l
- dbf d2,loc_22468
- loc_22478:
- markObj_gone
- jmp (DeleteObject).l
- ; ---------------------------------------------------------------------------
- SwingVine_Something:
- move.b (Swing_Oscillation).w,d0 ; broken at $7B00, $FB00
- ;move.w (Swing_Oscillation).w,(DebugRAM).w
- add.b $14(a0),d0
- jsr (CalcSine).l
- muls.w #$2C,d0
- move.w d0,angle(a0)
- asr.w #3,d0
- move.w d0,$3A(a0)
- move.b angle(a0),d0
- addq.b #4,d0
- lsr.b #3,d0
- move.b d0,mapping_frame(a0)
- jmp (DisplaySprite).l ; ???
- ; ---------------------------------------------------------------------------
- SwingVine_Rope:
- movea.w $3C(a0),a1
- move.w $3A(a1),$3A(a0)
- move.w angle(a1),d0
- add.w $3A(a0),d0
- move.w d0,angle(a0)
- move.b angle(a0),d0
- addq.b #4,d0
- lsr.b #3,d0
- move.b d0,mapping_frame(a0)
- bsr.w sub_2254A
- jmp (DisplaySprite).l ; rope
- ; =============== S U B R O U T I N E =======================================
- sub_2254A:
- movea.w $3C(a0),a1
- move.b angle(a1),d0
- addq.b #4,d0
- andi.b #-8,d0
- jsr (CalcSine).l
- neg.w d0
- addi.w #8,d0
- addi.w #8,d1
- asr.w #4,d0
- asr.w #4,d1
- add.w x_pos(a1),d0
- move.w d0,x_pos(a0)
- add.w y_pos(a1),d1
- move.w d1,y_pos(a0)
- rts
- ; End of function sub_2254A
- ; ---------------------------------------------------------------------------
- SwingVine_Handle:
- tst.b $2E(a0)
- beq.s +
- sub.b #1,$2E(a0)
- cmp.b #1,$2E(a0)
- bne.s +
- move.b #$40,collision_flags(a0)
- +
- bsr.s SwingVine_Handle_DoStuff
- jmp (DisplaySprite).l ; handle
- SwingVine_Handle_DoStuff:
- move.w x_pos(a0),d4
- move.w y_pos(a0),d5
- bsr.w sub_2254A
- cmp.w x_pos(a0),d4
- beq.s +
- move.w d4,$14(a0)
- +
- cmp.w y_pos(a0),d5
- beq.s +
- move.w d5,$34(a0)
- + rts
- SwingVine_Handle_Collide:
- lea (MainCharacter).w,a1
- move.b #$81,obj_control(a1)
- clr.w inertia(a1)
- clr.w x_vel(a1)
- clr.w y_vel(a1)
- move.b #$C,routine(a0)
- move.b #$14,anim(a1)
- move.b #0,anim_frame(a1)
- SwingVine_Handle_Colliding:
- bsr.s SwingVine_Handle_DoStuff
- lea (MainCharacter).w,a1
- move.w x_pos(a0),x_pos(a1)
- move.w y_pos(a0),y_pos(a1)
- add.w #$14,y_pos(a1)
- move.b (Ctrl_1_Press_Logical).w,d0
- move.b d0,d1
- andi.b #$30,d1
- bne.w SwingVine_Handle_Escape
- move.b #0,anim_frame(a1)
- ;move.b #$6B,mapping_frame(a1)
- move.b (Swing_Oscillation).w,d0
- cmp.b #$80,d0
- blt.s +
- move.b #1,anim_frame(a1)
- ;move.b #$6C,mapping_frame(a1)
- +
- jmp (DisplaySprite).l ; handle
- SwingVine_Handle_Escape:
- clr.b obj_control(a1)
- move.b #$18,$2E(a0)
- clr.b collision_flags(a0)
- move.b #$8,routine(a0)
- bset #2,status(a1)
- move.b #2,anim(a1)
- move.w x_pos(a0),d1
- sub.w $14(a0),d1
- asl.w #7,d1
- move.w d1,x_vel(a1)
- move.w y_pos(a0),d1
- sub.w $34(a0),d1
- asl.w #7,d1
- move.w d1,y_vel(a1)
- btst #$A,d0
- beq.s +
- move.w #-$200,x_vel(a1)
- +
- btst #$B,d0
- beq.s +
- move.w #$200,x_vel(a1)
- +
- addi.w #-$380,y_vel(a1)
- jmp (DisplaySprite).l ; handle
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement