Advertisement
Guest User

Untitled

a guest
Nov 28th, 2014
193
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.65 KB | None | 0 0
  1. ; ----------------------------------------------------------------------------
  2. ; Object EF - Swinging Vine (Ported from S3K)
  3. ; ----------------------------------------------------------------------------
  4.  
  5. objEF:
  6. ;$3E - addresses
  7. ;$3C - addresses
  8. ;$42 ($14) - timer offset, based on a subtype value
  9. ;$44 ($34) - y detachement offset
  10.  
  11. Obj_SwingVine:
  12. moveq #0,d0
  13. move.b routine(a0),d0
  14. move.w SwingObjIndex(pc,d0.w),d1
  15. jmp SwingObjIndex(pc,d1.w)
  16. ; ===========================================================================
  17. SwingObjIndex:
  18. dc.w Obj_SwingVine_Init-SwingObjIndex
  19. dc.w SwingVine_MarkObjGone-SwingObjIndex ; MarkObjGone
  20. dc.w SwingVine_Handle_Collide-SwingObjIndex ; init
  21. dc.w SwingVine_Rope-SwingObjIndex ; Rope
  22. dc.w SwingVine_Handle-SwingObjIndex ; Handle
  23. dc.w SwingVine_Something-SwingObjIndex ; Angle Handler?
  24. dc.w SwingVine_Handle_Colliding-SwingObjIndex
  25. ; ===========================================================================
  26. Obj_SwingVine_Init:
  27. movea.l a0,a1
  28. move.b (a0),(a1)
  29. move.b #2,routine(a1)
  30.  
  31. bsr.w sub_2241A
  32. move.b #$21,mapping_frame(a1)
  33. move.w x_pos(a0),d2
  34. move.w y_pos(a0),d3
  35. move.b subtype(a0),d1
  36. andi.w #$F,d1
  37. jsr (SingleObjLoad).l
  38. bne.w loc_22418
  39. move.w #-$1B0,$34(a1)
  40. move.w a1,$3E(a0)
  41. move.b (a0),(a1)
  42. move.b #$A,routine(a1)
  43.  
  44. move.w a0,$3C(a1)
  45. move.b subtype(a0),d0
  46. andi.b #-$10,d0
  47. move.b d0,$14(a1)
  48. bra.s loc_223EA
  49. ; ---------------------------------------------------------------------------
  50.  
  51. loc_223D2:
  52. jsr (SingleObjLoad).l
  53. bne.w loc_22418
  54. move.b (a0),(a1)
  55. move.b #6,routine(a1)
  56.  
  57. move.w a2,$3C(a1)
  58. move.w a1,$3E(a2)
  59.  
  60. loc_223EA:
  61. movea.l a1,a2
  62. bsr.s sub_2241A
  63. move.w d2,x_pos(a1)
  64. move.w d3,y_pos(a1)
  65. addi.w #$10,d3
  66. addq.w #1,$36(a0)
  67. move.w $36(a0),$36(a1)
  68. dbf d1,loc_223D2
  69. move.b (a0),(a1)
  70. move.b #8,routine(a1)
  71. move.b #$40,collision_flags(a1)
  72.  
  73. move.b #$20,mapping_frame(a1)
  74.  
  75. loc_22418:
  76. bra.s SwingVine_MarkObjGone
  77.  
  78. ; =============== S U B R O U T I N E =======================================
  79.  
  80.  
  81. sub_2241A:
  82. move.b #4,render_flags(a1) ; 00000100
  83. move.b #8,width_pixels(a1)
  84. ;move.b #8,6(a1) ; pixel_height
  85. move.b #$0,priority(a1)
  86. move.l #Map_Swing,mappings(a1)
  87. move.w #$4420,art_tile(a1)
  88. rts
  89.  
  90. ; ---------------------------------------------------------------------------
  91.  
  92. SwingVine_MarkObjGone:
  93. move.w x_pos(a0),d0
  94. andi.w #$FF80,d0
  95. sub.w (Camera_X_pos_coarse).w,d0
  96. cmpi.w #$280,d0
  97. bhi.w loc_2245C
  98. move.w y_pos(a0),d0
  99. andi.w #$FF80,d0
  100. sub.w (Camera_Y_pos_coarse).w,d0
  101. cmpi.w #$280,d0
  102. bhi.w loc_2245C
  103. jmp (DisplaySprite).l
  104. ; ---------------------------------------------------------------------------
  105.  
  106. loc_2245C:
  107. move.w $36(a0),d2
  108. subq.w #1,d2
  109. bcs.s loc_22478
  110. movea.w $3E(a0),a2
  111.  
  112. loc_22468:
  113. movea.l a2,a1
  114. movea.w $3E(a1),a2
  115. jsr (DeleteObject2).l
  116. dbf d2,loc_22468
  117.  
  118. loc_22478:
  119. markObj_gone
  120. jmp (DeleteObject).l
  121. ; ---------------------------------------------------------------------------
  122.  
  123. SwingVine_Something:
  124. move.b (Swing_Oscillation).w,d0 ; broken at $7B00, $FB00
  125. ;move.w (Swing_Oscillation).w,(DebugRAM).w
  126. add.b $14(a0),d0
  127. jsr (CalcSine).l
  128. muls.w #$2C,d0
  129. move.w d0,angle(a0)
  130. asr.w #3,d0
  131. move.w d0,$3A(a0)
  132. move.b angle(a0),d0
  133. addq.b #4,d0
  134. lsr.b #3,d0
  135. move.b d0,mapping_frame(a0)
  136. jmp (DisplaySprite).l ; ???
  137. ; ---------------------------------------------------------------------------
  138.  
  139. SwingVine_Rope:
  140. movea.w $3C(a0),a1
  141. move.w $3A(a1),$3A(a0)
  142. move.w angle(a1),d0
  143. add.w $3A(a0),d0
  144. move.w d0,angle(a0)
  145. move.b angle(a0),d0
  146. addq.b #4,d0
  147. lsr.b #3,d0
  148. move.b d0,mapping_frame(a0)
  149. bsr.w sub_2254A
  150. jmp (DisplaySprite).l ; rope
  151.  
  152. ; =============== S U B R O U T I N E =======================================
  153.  
  154.  
  155. sub_2254A:
  156. movea.w $3C(a0),a1
  157. move.b angle(a1),d0
  158. addq.b #4,d0
  159. andi.b #-8,d0
  160. jsr (CalcSine).l
  161. neg.w d0
  162. addi.w #8,d0
  163. addi.w #8,d1
  164. asr.w #4,d0
  165. asr.w #4,d1
  166. add.w x_pos(a1),d0
  167. move.w d0,x_pos(a0)
  168. add.w y_pos(a1),d1
  169. move.w d1,y_pos(a0)
  170. rts
  171. ; End of function sub_2254A
  172.  
  173. ; ---------------------------------------------------------------------------
  174.  
  175. SwingVine_Handle:
  176. tst.b $2E(a0)
  177. beq.s +
  178. sub.b #1,$2E(a0)
  179. cmp.b #1,$2E(a0)
  180. bne.s +
  181. move.b #$40,collision_flags(a0)
  182. +
  183. bsr.s SwingVine_Handle_DoStuff
  184. jmp (DisplaySprite).l ; handle
  185.  
  186. SwingVine_Handle_DoStuff:
  187. move.w x_pos(a0),d4
  188. move.w y_pos(a0),d5
  189. bsr.w sub_2254A
  190. cmp.w x_pos(a0),d4
  191. beq.s +
  192. move.w d4,$14(a0)
  193. +
  194. cmp.w y_pos(a0),d5
  195. beq.s +
  196. move.w d5,$34(a0)
  197. + rts
  198.  
  199. SwingVine_Handle_Collide:
  200. lea (MainCharacter).w,a1
  201. move.b #$81,obj_control(a1)
  202. clr.w inertia(a1)
  203. clr.w x_vel(a1)
  204. clr.w y_vel(a1)
  205. move.b #$C,routine(a0)
  206. move.b #$14,anim(a1)
  207. move.b #0,anim_frame(a1)
  208.  
  209. SwingVine_Handle_Colliding:
  210. bsr.s SwingVine_Handle_DoStuff
  211. lea (MainCharacter).w,a1
  212. move.w x_pos(a0),x_pos(a1)
  213. move.w y_pos(a0),y_pos(a1)
  214. add.w #$14,y_pos(a1)
  215. move.b (Ctrl_1_Press_Logical).w,d0
  216. move.b d0,d1
  217. andi.b #$30,d1
  218. bne.w SwingVine_Handle_Escape
  219.  
  220. move.b #0,anim_frame(a1)
  221. ;move.b #$6B,mapping_frame(a1)
  222. move.b (Swing_Oscillation).w,d0
  223. cmp.b #$80,d0
  224. blt.s +
  225. move.b #1,anim_frame(a1)
  226. ;move.b #$6C,mapping_frame(a1)
  227. +
  228. jmp (DisplaySprite).l ; handle
  229.  
  230. SwingVine_Handle_Escape:
  231. clr.b obj_control(a1)
  232. move.b #$18,$2E(a0)
  233. clr.b collision_flags(a0)
  234. move.b #$8,routine(a0)
  235. bset #2,status(a1)
  236. move.b #2,anim(a1)
  237.  
  238. move.w x_pos(a0),d1
  239. sub.w $14(a0),d1
  240. asl.w #7,d1
  241. move.w d1,x_vel(a1)
  242. move.w y_pos(a0),d1
  243. sub.w $34(a0),d1
  244. asl.w #7,d1
  245. move.w d1,y_vel(a1)
  246. btst #$A,d0
  247. beq.s +
  248. move.w #-$200,x_vel(a1)
  249. +
  250. btst #$B,d0
  251. beq.s +
  252. move.w #$200,x_vel(a1)
  253. +
  254. addi.w #-$380,y_vel(a1)
  255.  
  256. jmp (DisplaySprite).l ; handle
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement