shop_routines.s 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128
  1. BORDER_SPRITE_HEIGHT EQU 61
  2. BORDER_SPRITE_WIDTH EQU 60
  3. PRODUCT_LIST_WINDOW_LENGTH EQU (2+2+8)*9
  4. SHOP_SPRITES_LENGTH EQU 16128
  5. **********************************************
  6. *** OPEN SHOP ***
  7. **********************************************
  8. Open_Shop
  9. bsr Clear_Channels
  10. bsr Set_Up_All_Gun_Levels
  11. clr.w box
  12. clr.b nasty_user
  13. move.w #BORDER_START_X,box_x_pos
  14. move.w #BORDER_START_Y,box_y_pos
  15. bsr Copy_Shop_Sprites
  16. bsr Load_Shop_Screen_Tune
  17. bsr Load_Shop_Picture
  18. bsr Mt_Init
  19. move.w #1,Music_Flag
  20. move.l #shop_cols1+2,a0
  21. bsr Insert_Cols
  22. move.l memory_base,d0
  23. move.w d0,ShopPlane1_Lo
  24. swap d0
  25. move.w d0,ShopPlane1_Hi
  26. swap d0
  27. add.l #LO_RES_PLANE,d0
  28. move.w d0,ShopPlane2_Lo
  29. swap d0
  30. move.w d0,ShopPlane2_Hi
  31. swap d0
  32. add.l #LO_RES_PLANE,d0
  33. move.w d0,ShopPlane3_Lo
  34. swap d0
  35. move.w d0,ShopPlane3_Hi
  36. swap d0
  37. add.l #LO_RES_PLANE,d0
  38. move.w d0,ShopPlane4_Lo
  39. swap d0
  40. move.w d0,ShopPlane4_Hi
  41. swap d0
  42. add.l #LO_RES_PLANE,d0
  43. move.w d0,ShopPlane5_Lo
  44. swap d0
  45. move.w d0,ShopPlane5_Hi
  46. move.w #40,text_bpr
  47. bsr Set_Up_Product_List_Memory
  48. bsr Set_Up_Product_List ;strings in mem
  49. add.l #9*40,product_list_ptr
  50. bsr Insert_Product_List_Ptr
  51. move.w #27-1,d0
  52. move.w #$a801,d3
  53. move.l #product_cols,a0
  54. move.l #product_list_cols,a1
  55. fill_colours
  56. move.w #$1a0,(a0)+
  57. move.w (a1),(a0)+
  58. move.w #$1a2,(a0)+
  59. move.w (a1),(a0)+
  60. move.w #$1a4,(a0)+
  61. move.w (a1),(a0)+
  62. move.w #$1a6,(a0)+
  63. move.w (a1),(a0)+
  64. move.w #$1a8,(a0)+
  65. move.w (a1),(a0)+
  66. move.w #$1aa,(a0)+
  67. move.w (a1),(a0)+
  68. move.w #$1ac,(a0)+
  69. move.w (a1),(a0)+
  70. move.w #$1ae,(a0)+
  71. move.w (a1)+,(a0)+
  72. add.w #$0100,d3
  73. move.w d3,(a0)+
  74. move.w #$fffe,(a0)+
  75. dbra d0,fill_colours
  76. move.l memory_base,d0
  77. add.l #LO_RES_PLANE*4,d0
  78. add.l #40*(151),d0
  79. move.w d0,RestorePlane5_Lo
  80. swap d0
  81. move.w d0,RestorePlane5_Hi
  82. move.w #8-1,d1
  83. move.l #shop_cols1+(16*4)+2,a0
  84. move.l #restore_cols,a1
  85. move.w #$1a0,d0
  86. restore_cols_loop
  87. move.w d0,(a1)+
  88. move.w (a0),(a1)+
  89. add.w #$2,d0
  90. addq.l #4,a0
  91. dbra d1,restore_cols_loop
  92. bsr Display_Border
  93. bsr Insert_Sprite_Data
  94. jsr Sync
  95. move.l #shop_copper,cop1lch(a6)
  96. clr.w copjmp1(a6)
  97. move.w #$8000+BIT_PLANE_DMA+SPRITE_DMA,dmacon(a6)
  98. bsr Display_Cash_Amount
  99. Shop_Loop
  100. jsr Sync
  101. bsr Insert_Product_List_Ptr
  102. bsr Display_Border
  103. bsr Insert_Sprite_Data
  104. tst.w Cash_Update_Counter
  105. beq.s User_Not_Purchased
  106. addq.w #1,current_spr_frame
  107. andi.w #$7,current_spr_frame
  108. move.w current_item_diff,d0
  109. sub.w d0,cash
  110. subq.w #1,Cash_Update_Counter
  111. bne.s not_final_update
  112. move.w new_cash_amount,cash
  113. not_final_update
  114. bsr Remove_Old_Cash
  115. bsr Display_Cash_Amount
  116. bra.s Shop_Loop
  117. User_Not_Purchased
  118. bsr Get_Stick_Readings
  119. bsr Test_Buy_Item
  120. tst d0
  121. bne.s shop_fin
  122. bsr Move_Box
  123. bra.s Shop_Loop
  124. Shop_Fin
  125. jsr Sync
  126. bsr Display_Border
  127. bsr Insert_Sprite_Data
  128. addq.w #1,current_spr_frame
  129. andi.w #$7,current_spr_frame
  130. subq.w #1,master_volume
  131. bne.s Shop_Fin
  132. bsr Wait_For_Blit_To_Finish
  133. clr.w Music_Flag
  134. bsr Mt_End
  135. move.w #BIT_PLANE_DMA,dmacon(a6)
  136. move.w #NEXT_LEVEL,Schedule_Entry
  137. rts
  138. ****************************************
  139. **** COPY SHOP SPRITES ********
  140. ****************************************
  141. Copy_Shop_Sprites
  142. move.l memory_base,a0
  143. add.l #(LO_RES_PLANE*5)+40*PRODUCT_LIST_WINDOW_LENGTH,a0
  144. move.l a0,sprite_base
  145. move.l #Spr_Box_Data,a1
  146. move.w #(SHOP_SPRITES_LENGTH/2)-1,d0
  147. copy_spr_data
  148. move.w (a1)+,(a0)+
  149. move.w (a1)+,(a0)+
  150. dbra d0,copy_spr_data
  151. rts
  152. BORDER_START_X EQU 34
  153. BORDER_START_Y EQU 90-16-9-1
  154. BORDER_START_Y2 EQU 150-1-1
  155. BORDER_X_DIST EQU 64
  156. ****************************************
  157. **** INSERT SPRITE DATA ********
  158. ****************************************
  159. Insert_Sprite_Data
  160. move.l sprite_base,d0
  161. move.w current_spr_frame,d1
  162. mulu #(BORDER_SPRITE_HEIGHT+2)*4*8,d1
  163. add.l d1,d0
  164. move.w d0,shsprite0l
  165. swap d0
  166. move.w d0,shsprite0h
  167. swap d0
  168. add.l #(BORDER_SPRITE_HEIGHT+2)*4,d0
  169. move.w d0,shsprite1l
  170. swap d0
  171. move.w d0,shsprite1h
  172. swap d0
  173. add.l #(BORDER_SPRITE_HEIGHT+2)*4,d0
  174. move.w d0,shsprite2l
  175. swap d0
  176. move.w d0,shsprite2h
  177. swap d0
  178. add.l #(BORDER_SPRITE_HEIGHT+2)*4,d0
  179. move.w d0,shsprite3l
  180. swap d0
  181. move.w d0,shsprite3h
  182. swap d0
  183. add.l #(BORDER_SPRITE_HEIGHT+2)*4,d0
  184. move.w d0,shsprite4l
  185. swap d0
  186. move.w d0,shsprite4h
  187. swap d0
  188. add.l #(BORDER_SPRITE_HEIGHT+2)*4,d0
  189. move.w d0,shsprite5l
  190. swap d0
  191. move.w d0,shsprite5h
  192. swap d0
  193. add.l #(BORDER_SPRITE_HEIGHT+2)*4,d0
  194. move.w d0,shsprite6l
  195. swap d0
  196. move.w d0,shsprite6h
  197. swap d0
  198. add.l #(BORDER_SPRITE_HEIGHT+2)*4,d0
  199. move.w d0,shsprite7l
  200. swap d0
  201. move.w d0,shsprite7h
  202. rts
  203. current_spr_frame
  204. dc.w 0
  205. current_spr_dir
  206. dc.w 0
  207. ****************************************
  208. **** DISPLAY_BORDER ********
  209. ****************************************
  210. Display_Border
  211. move.w box_x_pos,d0
  212. move.w box_y_pos,d1
  213. move.l sprite_base,a0
  214. move.w current_spr_frame,d2
  215. mulu #(BORDER_SPRITE_HEIGHT+2)*4*8,d2
  216. add.l d2,a0
  217. move.w #BORDER_SPRITE_HEIGHT,d2
  218. movem.l d0-d1,-(sp)
  219. jsr Position_Any_Sprite
  220. movem.l (sp)+,d0-d1
  221. bset.b #ATTACH,3(a0)
  222. add.l #(BORDER_SPRITE_HEIGHT+2)*4,a0
  223. movem.l d0-d1,-(sp)
  224. jsr Position_Any_Sprite
  225. movem.l (sp)+,d0-d1
  226. bset.b #ATTACH,3(a0)
  227. add.w #16,d0
  228. add.l #(BORDER_SPRITE_HEIGHT+2)*4,a0
  229. movem.l d0-d1,-(sp)
  230. jsr Position_Any_Sprite
  231. movem.l (sp)+,d0-d1
  232. bset.b #ATTACH,3(a0)
  233. add.l #(BORDER_SPRITE_HEIGHT+2)*4,a0
  234. movem.l d0-d1,-(sp)
  235. jsr Position_Any_Sprite
  236. movem.l (sp)+,d0-d1
  237. bset.b #ATTACH,3(a0)
  238. add.w #16,d0
  239. add.l #(BORDER_SPRITE_HEIGHT+2)*4,a0
  240. movem.l d0-d1,-(sp)
  241. jsr Position_Any_Sprite
  242. movem.l (sp)+,d0-d1
  243. bset.b #ATTACH,3(a0)
  244. add.l #(BORDER_SPRITE_HEIGHT+2)*4,a0
  245. movem.l d0-d1,-(sp)
  246. jsr Position_Any_Sprite
  247. movem.l (sp)+,d0-d1
  248. bset.b #ATTACH,3(a0)
  249. add.w #16,d0
  250. add.l #(BORDER_SPRITE_HEIGHT+2)*4,a0
  251. movem.l d0-d1,-(sp)
  252. jsr Position_Any_Sprite
  253. movem.l (sp)+,d0-d1
  254. bset.b #ATTACH,3(a0)
  255. add.l #(BORDER_SPRITE_HEIGHT+2)*4,a0
  256. movem.l d0-d1,-(sp)
  257. jsr Position_Any_Sprite
  258. movem.l (sp)+,d0-d1
  259. bset.b #ATTACH,3(a0)
  260. rts
  261. ****************************************
  262. **** MOVE BOX ********
  263. ****************************************
  264. Move_Box
  265. tst.b nasty_user
  266. bne update_slide_box_to_option
  267. box_stopped
  268. tst xdirec
  269. beq.s test_box_y
  270. bpl.s right_box
  271. tst box
  272. beq box_not_moved
  273. cmp.w #4,box
  274. beq box_not_moved
  275. subq.w #1,box
  276. move.w #-1,move_box_dir
  277. move.b #1,nasty_user
  278. bra slide_box_to_option
  279. right_box
  280. cmp.w #3,box
  281. beq.s box_not_moved
  282. cmp.w #7,box
  283. beq.s box_not_moved
  284. addq.w #1,box
  285. move.w #1,move_box_dir
  286. move.b #1,nasty_user
  287. bra slide_box_to_option
  288. test_box_y
  289. tst ydirec
  290. beq.s box_not_moved
  291. bpl.s move_box_up
  292. cmp.w #4,box
  293. bge.s box_not_moved
  294. addq.w #4,box
  295. move.b #1,nasty_user
  296. move.w #2,move_box_dir
  297. bra.s slide_box_to_option
  298. move_box_up
  299. cmp.w #3,box
  300. ble.s box_not_moved
  301. subq.w #4,box
  302. move.b #1,nasty_user
  303. move.w #-2,move_box_dir
  304. bra.s slide_box_to_option
  305. box_not_moved
  306. rts
  307. slide_box_to_option
  308. move.w move_box_dir,d0
  309. bpl.s dont_negb
  310. neg d0
  311. dont_negb
  312. cmp.w #2,d0
  313. blt.s x_slide
  314. move.w #84/12,box_dist
  315. move.w #12,box_offset
  316. move.w #((9*4)/7)+1,prod_dist ;num pixels per movement
  317. bra.s update_slide_box_to_option
  318. x_slide
  319. move.w #2,prod_dist ;num pixels per movement
  320. move.w #64/8,box_dist
  321. move.w #8,box_offset
  322. tst move_box_dir
  323. bmi.s sld_rght
  324. move.w #8,current_spr_frame
  325. move.w #-1,current_spr_dir
  326. bra.s update_slide_box_to_option
  327. sld_rght
  328. clr.w current_spr_frame
  329. move.w #1,current_spr_dir
  330. update_slide_box_to_option
  331. move.w box_offset,d0
  332. move.w prod_dist,d2
  333. cmp.w #2,d2
  334. beq.s alter_prod_dist
  335. cmp.w #6,d2
  336. beq.s alter_prod_dist
  337. bra.s skip_prod_dist
  338. alter_prod_dist
  339. sub.w #1,prod_dist ;fix
  340. skip_prod_dist
  341. move.w move_box_dir,d1
  342. bpl.s slide_pos
  343. neg.w d0
  344. neg.w d2
  345. neg.w d1
  346. slide_pos
  347. *for planes
  348. muls #40,d2
  349. add.l d2,product_list_ptr
  350. *****
  351. cmp.w #2,d1
  352. beq.s slide_y_update
  353. add.w d0,box_x_pos
  354. move.w current_spr_dir,d0
  355. not_last_spr_frame
  356. add.w d0,current_spr_frame
  357. cmp.w #8,current_spr_frame
  358. bne.s test_other_spr_frame
  359. clr.w current_spr_frame
  360. test_other_spr_frame
  361. cmp.w #-1,current_spr_frame
  362. bne.s test_end_slide
  363. clr.w current_spr_frame
  364. bra.s test_end_slide
  365. slide_y_update
  366. add.w d0,box_y_pos
  367. test_end_slide
  368. subq.w #1,box_dist
  369. beq.s end_slide
  370. rts
  371. end_slide
  372. clr.b nasty_user
  373. rts
  374. cash_update_counter dc.w 0
  375. move_box_dir dc.w 0
  376. box_dist dc.w 0
  377. box_offset dc.w 0
  378. ****************************************
  379. **** REMOVE OLD CASH ********
  380. ****************************************
  381. Remove_Old_Cash
  382. btst #14,dmaconr(a6)
  383. bne.s Remove_Old_Cash
  384. clr.w bltadat(a6)
  385. move.l memory_base,a0
  386. add.l #LO_RES_PLANE*4,a0
  387. move.w #CASH_Y,d0
  388. mulu #40,d0
  389. add.l d0,a0
  390. move.w #CASH_X,d0
  391. andi.w #$fff0,d0
  392. asr #3,d0
  393. ext.l d0
  394. add.l d0,a0
  395. move.l a0,bltdpth(a6)
  396. move.w #40-CASH_WORDS*2,bltdmod(a6)
  397. move.l #$01f00000,bltcon0(a6)
  398. move.l #$ffffffff,bltafwm(a6)
  399. move.w #(MALFONT_HEIGHT-9)<<6+CASH_WORDS,bltsize(a6)
  400. rts
  401. ITEM_PRICE_X EQU 138
  402. ITEM_PRICE_Y EQU 123+18
  403. ITEM_PRICE_WORDS EQU 3
  404. ITEM_DESC_X EQU 113
  405. ITEM_DESC_Y EQU 123
  406. ITEM_DESC_WORDS EQU 6
  407. CASH_X EQU 192
  408. CASH_Y EQU 221
  409. CASH_WORDS EQU 3
  410. ****************************************
  411. **** DISPLAY CASH AMOUNT ********
  412. ****************************************
  413. Display_Cash_Amount
  414. move.w cash,d0
  415. move.l #cash_price,a0
  416. bsr Convert_Num_To_String
  417. move.w #CASH_X,d0
  418. move.w #CASH_Y,d1
  419. move.l memory_base,a3
  420. add.l #LO_RES_PLANE*4,a3
  421. move.l #Cash_price,a4
  422. bsr Display_String
  423. rts
  424. ****************************************
  425. **** CONVERT NUM TO STRING ********
  426. ****************************************
  427. Convert_Num_To_String
  428. *send num in d0
  429. *send pointer to mem in a0
  430. clr.w d7
  431. ext.l d0
  432. move.l #10000,d1
  433. convert_word_loop
  434. divu d1,d0
  435. move.w d0,d2 ;units
  436. clr.w d0
  437. swap d0
  438. tst.b d2
  439. bne.s not_a_zero
  440. tst.w d7
  441. bne.s not_a_zero
  442. move.b #' ',(a0)+
  443. bra.s carry_on_couting
  444. not_a_zero
  445. moveq.w #1,d7
  446. add.b #'0',d2
  447. move.b d2,(a0)+
  448. carry_on_couting
  449. cmp.w #1,d1
  450. beq.s done_word_convert
  451. divu #10,d1
  452. bra.s convert_word_loop
  453. done_word_convert
  454. rts
  455. long_num_vals
  456. dc.l 10000000
  457. dc.l 1000000
  458. dc.l 100000
  459. dc.l 10000
  460. dc.l 1000
  461. dc.l 100
  462. dc.l 10
  463. dc.l 1
  464. ****************************************
  465. **** SET UP SHOP PRICES ********
  466. ****************************************
  467. Set_Up_Shop_Prices
  468. move.l #default_shop_prices,a0
  469. move.l #game_shop_prices,a1
  470. move.l (a0)+,(a1)+
  471. move.l (a0)+,(a1)+
  472. move.l (a0)+,(a1)+
  473. move.l (a0)+,(a1)+
  474. rts
  475. ****************************************
  476. **** TEST BUY ITEM ********
  477. ****************************************
  478. Test_Buy_Item
  479. tst.b nasty_user
  480. bne.s quit_buy
  481. tst.w fire
  482. beq.s quit_buy
  483. cmp.w #7,box
  484. beq.s player_exit
  485. *Test if player has enough money
  486. move.l #game_shop_prices,a0
  487. moveq #0,d0
  488. move.w box,d0
  489. asl d0
  490. move.w (a0,d0),d0
  491. move.w d0,current_item_price
  492. cmp.w cash,d0
  493. bgt.s quit_buy
  494. move.l #purchase_code,a0
  495. move.w box,d0
  496. ext.l d0
  497. asl #2,d0
  498. move.l (a0,d0),a0
  499. jsr (a0)
  500. tst.w d0
  501. bne.s quit_buy
  502. move.w cash,new_cash_amount
  503. clr.l d0
  504. move.w current_item_price,d0
  505. sub.w d0,new_cash_amount
  506. move.w #8*3,cash_update_counter
  507. divu.w #24,d0 ;div factor
  508. move.w d0,current_item_diff
  509. quit_buy
  510. moveq #0,d0
  511. rts
  512. player_exit
  513. moveq #1,d0
  514. rts
  515. box dc.w 0
  516. current_item_price dc.w 0
  517. current_item_diff dc.w 0
  518. new_cash_amount dc.w 0
  519. purchase_code
  520. dc.l Power_Up_Grenade
  521. dc.l Power_Up_Rocket
  522. dc.l Add_Energy_Module
  523. dc.l Gun_Power_Up
  524. dc.l Add_Grenade_Pack
  525. dc.l Add_Rocket_Pack
  526. dc.l fill_up_energy
  527. **************************************
  528. *** POWER UP GRENADE ****
  529. **************************************
  530. Power_Up_Grenade
  531. cmp.w #2,grenade_level
  532. beq.s max_grenade_power
  533. addq.w #1,grenade_level
  534. move.l #game_shop_prices,a0
  535. cmp.w #2,grenade_level
  536. beq.s maxxed_gren
  537. add.w #500,grenade_price(a0)
  538. bsr Set_Up_Grenade_Level_Num
  539. bra.s Re_Do_Gren_Line
  540. maxxed_gren
  541. move.w #-1,grenade_price(a0)
  542. Re_Do_Gren_Line
  543. bsr Re_Do_Product_Line
  544. clr.w d0 ;indicate item purchased
  545. rts
  546. max_grenade_power
  547. move.w #1,d0
  548. rts
  549. **************************************
  550. *** POWER UP ROCKET ****
  551. **************************************
  552. Power_Up_Rocket
  553. cmp.w #2,rocket_level
  554. beq.s max_rocket_power
  555. addq.w #1,rocket_level
  556. move.l #game_shop_prices,a0
  557. cmp.w #2,rocket_level
  558. blt.s rock_not_maxxed
  559. move.w #-1,rocket_price(a0)
  560. bra.s Re_Do_Rock_Line
  561. rock_not_maxxed
  562. add.w #500,rocket_price(a0)
  563. bsr Set_Up_Rocket_Level_Num
  564. Re_Do_Rock_Line
  565. bsr Re_Do_Product_Line
  566. clr.w d0
  567. rts
  568. max_rocket_power
  569. move.w #1,d0
  570. rts
  571. **************************************
  572. *** FILL UP ENERGY ****
  573. **************************************
  574. fill_up_energy
  575. move.w player_energy_limit,d1
  576. cmp.w player_current_energy,d1
  577. beq.s cant_buy_full_up
  578. add.w #NUMBER_HITS_PER_UNIT*4,player_current_energy
  579. cmp.w player_current_energy,d1
  580. bgt.s energy_not_maxxed
  581. move.w player_energy_limit,player_current_energy
  582. energy_not_maxxed
  583. bsr Set_Up_Energy_Num
  584. bsr Re_Do_Product_Line
  585. clr.w d0
  586. rts
  587. cant_buy_full_up
  588. move.w #1,d0
  589. rts
  590. **************************************
  591. *** ADD ENERGY MODULE ****
  592. **************************************
  593. Add_Energy_Module
  594. cmp.w #4,current_energy_modules
  595. beq.s energy_modules_max
  596. addq.w #1,current_energy_modules
  597. bsr Set_Up_Energy_Modules_Num
  598. bsr Set_Up_Energy_Num
  599. move.l #game_shop_prices,a0
  600. cmp.w #4,current_energy_modules
  601. beq.s Energy_Maxxed
  602. add.w #1000,extra_module_price(a0)
  603. bra.s Re_Do_Energy_Line
  604. Energy_Maxxed
  605. move.w #-1,extra_module_price(a0)
  606. Re_Do_Energy_Line
  607. bsr Re_Do_Product_Line
  608. bsr Frig_Energy_Update
  609. clr.w d0
  610. rts
  611. energy_modules_max
  612. move.w #1,d0
  613. rts
  614. **************************************
  615. *** GUN POWER UP ****
  616. **************************************
  617. Gun_Power_Up
  618. move.l #game_shop_prices,a0
  619. move_gun_up_power
  620. cmp.w #STANDARD_GUN_TRIPLE,gun_type
  621. beq.s gun_max_power
  622. addq.w #4,gun_type
  623. cmp.w #STANDARD_GUN_TRIPLE,gun_type
  624. beq.s gun_maxxed
  625. add.w #2000,gun_power_price(a0)
  626. bsr Set_Up_Gun_Level_Num
  627. bra.s Re_Do_Gun_Line
  628. gun_maxxed
  629. move.w #-1,gun_power_price(a0)
  630. Re_Do_Gun_Line
  631. bsr Re_Do_Product_Line
  632. clr.w d0
  633. rts
  634. gun_max_power
  635. move.w #1,d0
  636. rts
  637. **************************************
  638. *** ADD GRENADE PACK ****
  639. **************************************
  640. Add_Grenade_Pack
  641. cmp.w #4,grenade_packs
  642. beq.s max_gren_packs
  643. tst.w grenades_in_pack
  644. bne.s dont_need_to_init
  645. move.w #5,grenades_in_pack
  646. dont_need_to_init
  647. addq.w #1,grenade_packs
  648. bsr Set_Up_Grenade_Pack_Num
  649. bsr Re_Do_Product_Line
  650. clr.w d0
  651. rts
  652. max_gren_packs
  653. move.w #1,d0
  654. rts
  655. **************************************
  656. *** ADD ROCKET PACK ****
  657. **************************************
  658. Add_Rocket_Pack
  659. cmp.w #4,rocket_packs
  660. beq.s max_rock_packs
  661. tst.w rockets_in_pack
  662. bne.s dont_need_to_init_rocks
  663. move.w #5,rockets_in_pack
  664. dont_need_to_init_rocks
  665. addq.w #1,rocket_packs
  666. bsr Set_Up_Rocket_Pack_Num
  667. bsr Re_Do_Product_Line
  668. clr.w d0
  669. rts
  670. max_rock_packs
  671. move.w #1,d0
  672. rts
  673. **************************************
  674. *** SET UP ALL GUN LEVELS ****
  675. **************************************
  676. Set_Up_All_Gun_Levels
  677. bsr Set_Up_Rocket_Pack_Num
  678. bsr Set_Up_Grenade_Pack_Num
  679. bsr Set_Up_Rocket_Level_Num
  680. bsr Set_Up_Grenade_Level_Num
  681. bsr Set_Up_Energy_Modules_Num
  682. bsr Set_Up_Energy_Num
  683. bsr Set_Up_Gun_Level_Num
  684. bsr Set_Up_Cash_Levels
  685. rts
  686. **************************************
  687. *** SET UP CASH LEVELS ****
  688. **************************************
  689. Set_Up_Cash_Levels
  690. move.l #game_shop_prices,a1
  691. move.l #product_list_strings,a2
  692. move.w #total_prod_prices-1,d7
  693. convert_all_cash
  694. move.w (a1)+,d0
  695. move.l #cash_price,a0
  696. bsr Convert_Num_To_String
  697. move.b cash_price+1,(a2) ;who gives a flying fuck
  698. move.b cash_price+2,1(a2)
  699. move.b cash_price+3,2(a2)
  700. move.b cash_price+4,3(a2)
  701. add.l #42,a2
  702. dbra d7,convert_all_cash
  703. rts
  704. **************************************
  705. *** SET UP ROCKET PACK NUM ****
  706. **************************************
  707. Set_Up_Rocket_Pack_Num
  708. move.w rocket_packs,d0
  709. add.w #'0',d0
  710. move.b d0,prod_rocket_pack+40
  711. rts
  712. **************************************
  713. *** SET UP GRENADE PACK NUM ****
  714. **************************************
  715. Set_Up_Grenade_Pack_Num
  716. move.w grenade_packs,d0
  717. add.w #'0',d0
  718. move.b d0,prod_grenade_pack+40
  719. rts
  720. **************************************
  721. *** SET UP ROCKET LEVEL NUM ****
  722. **************************************
  723. Set_Up_Rocket_Level_Num
  724. move.w rocket_level,d0
  725. add.w #'1',d0
  726. move.b d0,prod_rocket_level+40
  727. rts
  728. **************************************
  729. *** SET UP GRENADE LEVEL NUM ****
  730. **************************************
  731. Set_Up_Grenade_Level_Num
  732. move.w grenade_level,d0
  733. add.w #'1',d0
  734. move.b d0,prod_grenade_level+40
  735. rts
  736. **************************************
  737. *** SET UP GUN LEVEL NUM ****
  738. **************************************
  739. Set_Up_Gun_Level_Num
  740. move.w gun_type,d0
  741. asr #2,d0
  742. mulu #6,d0
  743. move.l #Gun_Types,a1
  744. add.l d0,a1
  745. move.w #6-1,d0
  746. move.l #prod_gun_level+7,a0
  747. copy_gun_type
  748. move.b (a1)+,(a0)+
  749. dbra d0,copy_gun_type
  750. rts
  751. Gun_Types
  752. dc.b "SINGLE"
  753. dc.b "DOUBLE"
  754. dc.b "TRIPLE"
  755. even
  756. **************************************
  757. *** SET UP ENERGY MODULES NUM ****
  758. **************************************
  759. Set_Up_Energy_Modules_Num
  760. move.w current_energy_modules,d0
  761. move.w d0,d1
  762. add.w #'0',d0
  763. move.b d0,prod_energy_bars+40
  764. asl #2,d1
  765. mulu #NUMBER_HITS_PER_UNIT,d1
  766. move.w d1,Player_Energy_Limit
  767. rts
  768. **************************************
  769. *** SET UP ENERGY NUM ****
  770. **************************************
  771. Set_Up_Energy_Num
  772. move.w player_current_energy,d0
  773. move.w player_energy_limit,d1
  774. mulu #100,d0
  775. divu d1,d0
  776. cmp.w #100,d0
  777. bge.s max_en_limit
  778. ext.l d0
  779. divu #10,d0
  780. add.b #'0',d0
  781. move.b #' ',prod_extra_energy+29
  782. move.b d0,prod_extra_energy+27
  783. swap d0
  784. add.b #'0',d0
  785. move.b d0,prod_extra_energy+28
  786. rts
  787. max_en_limit
  788. move.b #'1',prod_extra_energy+27
  789. move.b #'0',prod_extra_energy+28
  790. move.b #'0',prod_extra_energy+29
  791. rts
  792. game_shop_prices
  793. ds.w 8
  794. cash_price
  795. dc.b "00000",0
  796. even
  797. shop_middle_cols
  798. dc.w $000,$254,$043,$276
  799. dc.w $410,$443,$feb,$c94
  800. dc.w $550,$650,$852,$962
  801. dc.w $a72,$b82,$eb5,$ed6
  802. dc.w $741,$530,$420,$100
  803. dc.w $b7e,$970,$862,$440
  804. dc.w $740,$b72,$a83,$751
  805. dc.w $9eb,$110,$311,$ba7
  806. box_x_pos dc.w BORDER_START_X
  807. box_y_pos dc.w BORDER_START_Y
  808. *****************************************
  809. *** SET UP PRODUCT LIST ***
  810. *****************************************
  811. Set_Up_Product_List
  812. move.w #SMALLFONT_HEIGHT*2,d1
  813. move.l #product_list_strings,a4
  814. move.l #game_shop_prices,a5
  815. moveq.w #7,d7
  816. draw_product_strings_loop
  817. move.w #60,d0
  818. move.l product_list_ptr,a3
  819. movem.l d1/a4-a5/d7,-(sp)
  820. cmp.w #-1,(a5)
  821. bne.s prd_not_max
  822. move.l #prod_max,a4
  823. prd_not_max
  824. bsr Display_Small_String_Skip ;basic draw
  825. movem.l (sp)+,d1/a4-a5/d7
  826. addq.l #2,a5
  827. add.l #42,a4
  828. add.w #SMALLFONT_HEIGHT,d1
  829. dbra d7,draw_product_strings_loop
  830. rts
  831. ****************************************
  832. *** SET UP PRODUCT LIST MEMORY ***
  833. ****************************************
  834. Set_Up_Product_List_Memory
  835. move.l memory_base,a0
  836. add.l #LO_RES_PLANE*5,a0
  837. move.l a0,product_list_ptr
  838. move.w #((PRODUCT_LIST_WINDOW_LENGTH*40)/4)-1,d0
  839. clear_product_list_mem
  840. clr.l (a0)+
  841. dbra d0,clear_product_list_mem
  842. rts
  843. **************************************
  844. *** FRIG ENERGY UPDATE ****
  845. **************************************
  846. Frig_Energy_Update
  847. *I dont like doing this - but I have given up caring about neat code
  848. move.w box,d0
  849. move.l product_list_ptr,d1
  850. movem.l d0-d1,-(sp)
  851. move.w #6,box ;energy
  852. move.l memory_base,a0
  853. add.l #(LO_RES_PLANE*5)+((SMALLFONT_HEIGHT*40)*7),a0
  854. move.l a0,product_list_ptr
  855. bsr Re_Do_Frig
  856. movem.l (sp)+,d0-d1
  857. move.w d0,box
  858. move.l d1,product_list_ptr
  859. rts
  860. **************************************
  861. *** RE DO PRODUCT LINE ****
  862. **************************************
  863. Re_Do_Product_line
  864. bsr Set_Up_Cash_Levels
  865. jsr Sync
  866. Re_Do_Frig
  867. move.l product_list_ptr,a0
  868. add.l #(SMALLFONT_HEIGHT)*40,a0
  869. Remove_Old_Product
  870. btst #14,dmaconr(a6)
  871. bne.s Remove_Old_Product
  872. clr.w bltadat(a6)
  873. move.l a0,bltdpth(a6)
  874. clr.w bltdmod(a6) ;clear whole screen line
  875. move.l #$01f00000,bltcon0(a6)
  876. move.l #$ffffffff,bltafwm(a6)
  877. move.w #SMALLFONT_HEIGHT<<6+20,bltsize(a6)
  878. clr.l d0
  879. move.w box,d0
  880. move.l #game_shop_prices,a4
  881. lsl.w d0
  882. cmp.w #-1,(a4,d0)
  883. bne.s not_a_maxxed_product
  884. move.l #prod_max,a4
  885. bra.s insert_prod_str
  886. not_a_maxxed_product
  887. mulu #21,d0
  888. move.l #product_list_strings,a4
  889. add.l d0,a4
  890. insert_prod_str
  891. move.l product_list_ptr,a3
  892. move.w #SMALLFONT_HEIGHT,d1
  893. move.w #60,d0
  894. bsr Display_Small_String_Skip
  895. rts
  896. *****************************************
  897. *** INSERT PRODUCT LIST PTR ***
  898. *****************************************
  899. Insert_Product_List_Ptr
  900. move.l product_list_ptr,d0
  901. move.w d0,ProductPlane5_Lo
  902. swap d0
  903. move.w d0,productPlane5_Hi
  904. rts
  905. product_list_strings
  906. prod_grenade_level
  907. dc.b "0000 : GRENADE POWER UP : CURRENT LEVEL 1",0
  908. prod_rocket_level
  909. dc.b "0000 : ROCKET POWER UP : CURRENT LEVEL 1",0
  910. prod_energy_bars
  911. dc.b "0000 : ADD ENERGY BAR : CURRENT BARS 1",0
  912. prod_gun_level
  913. dc.b "0000 : SINGLE POWER UP ",0
  914. prod_grenade_pack
  915. dc.b "0000 : GRENADE PACK : CURRENT PACKS 1",0
  916. prod_rocket_pack
  917. dc.b "0000 : ROCKET PACK : CURRENT PACKS 1",0
  918. prod_extra_energy
  919. dc.b "0000 : TOP UP ENERGY : %00 FULL ",0
  920. dc.b " - EXIT FROM SHOP - ",0
  921. even
  922. prod_max
  923. dc.b "xxxx : * MAXIMUM REACHED! * ",0
  924. even
  925. product_list_ptr dc.l 0
  926. sprite_base dc.l 0
  927. prod_dist dc.w 0
  928. product_list_cols
  929. dc.w $000,$111,$222,$333,$333,$444
  930. dc.w $555,$777,$999,$bbb,$ddd,$eee,$fff,$fff,$fff
  931. dc.w $eee,$ddd,$bbb,$999,$777,$555
  932. dc.w $444,$333,$333,$222,$111,$000
  933. rsreset
  934. grenade_price rs.w 1
  935. rocket_price rs.w 1
  936. extra_module_price rs.w 1
  937. gun_power_price rs.w 1
  938. grenade_pack_price rs.w 1
  939. rocket_pack_price rs.w 1
  940. energy_refill_price rs.w 1
  941. total_prod_prices rs.w 1
  942. default_shop_prices
  943. dc.w 1000
  944. dc.w 1100
  945. dc.w 1500
  946. dc.w 2000
  947. dc.w 150
  948. dc.w 250
  949. dc.w 300
  950. dc.w 0
  951. Spr_Box_Data
  952. incbin "data/boxset.spr"