Advertisement
Guest User

Untitled

a guest
Dec 16th, 2019
103
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 12.42 KB | None | 0 0
  1. proc TextDraw hdc,left,top,string,strlen,color ;Вывод текста
  2. ;locals
  3. ; newFont dd ?
  4. ;oldFont dd ?
  5. ; endl
  6. invoke SetBkColor,[hdc],0h
  7. invoke SetTextColor,[hdc],[color]
  8. invoke TextOut,[hdc],[left],[top],[string],[strlen]
  9. ;invoke SelectObject,[hdc],[oldFont]
  10. ;invoke DeleteObject,[oldFont]
  11. ;invoke DeleteObject,[newFont]
  12. ret
  13. endp
  14.  
  15. proc StopWalking,Player
  16. mov ecx,[Player]
  17. mov [ecx+PLAYER.Walk_Stopped],1
  18. mov [ecx+PLAYER.Action_State],3
  19. stdcall InitBitmap,[Player]
  20. ret
  21. endp
  22.  
  23. proc AnimateBitmap seg_w,seg_h,x0,y0,iterat,hbmImage,color,Player ;Анимация битмапа взависимости от числа замены кадров
  24. invoke GetObjectA,[hbmImage],sizeof.BITMAP, bm
  25. mov ecx,[Player]
  26. inc [ecx+PLAYER.Cadr_Change]
  27. mov ebx,[iterat]
  28. cmp [ecx+PLAYER.Cadr_Change],ebx
  29. jne @f
  30. stdcall Dinamics,[seg_w],[seg_h],[bm.bmWidth],[bm.bmHeight],[Player]
  31. mov [ecx+PLAYER.Cadr_Change],0
  32. @@:
  33. invoke SelectObject,[hdcMem], [hbmImage]
  34. mov ecx,[Player]
  35. invoke GdiTransparentBlt,[hdcBack],[x0],[y0],[seg_w],[seg_h],[hdcMem],[ecx+PLAYER.Bitmap_begX],[ecx+PLAYER.Bitmap_begY],[seg_w],[seg_h],[color]
  36. ret
  37. endp
  38.  
  39. proc Dinamics w,h,full_w,full_h,Player ;Нарезка битмапа на необходимые по текущему времени части
  40. mov ebx,[w]
  41. mov ecx,[Player]
  42. add [ecx+PLAYER.Bitmap_begX],ebx
  43. sub [full_w],50
  44. mov ebx,[full_w]
  45. cmp [ecx+PLAYER.Bitmap_begX],ebx
  46. jb .Stop
  47. mov [ecx+PLAYER.Bitmap_begX],0
  48. mov ebx,[h]
  49. add [ecx+PLAYER.Bitmap_begY],ebx
  50. sub [full_h],30
  51. mov ebx,[full_h]
  52. cmp [ecx+PLAYER.Bitmap_begY],ebx
  53. jb .Stop
  54. mov [ecx+PLAYER.Bitmap_begY],0
  55. .Stop:
  56. ret
  57. endp
  58.  
  59. proc InitBitmap Player ;Сброс кадров битмапа
  60. mov ecx,[Player]
  61. mov [ecx+PLAYER.Bitmap_begX],0
  62. mov [ecx+PLAYER.Bitmap_begY],0
  63. mov [ecx+PLAYER.Action_Time_End],0
  64. ret
  65. endp
  66.  
  67. proc DetectHitKey Animation_Priority,Animation_Interval,Player ;Инициаизация данных по клавишу удара
  68. mov ebx,[time]
  69. mov ecx,[Player]
  70. cmp ebx,[ecx+PLAYER.Action_Time_End]
  71. jb WindowProc.defwndproc
  72. je @f
  73. stdcall InitBitmap,[Player]
  74. mov ebx,[Animation_Priority]
  75. mov [ecx+PLAYER.Action_State],ebx
  76. mov eax,[time]
  77. add eax,[Animation_Interval]
  78. mov [ecx+PLAYER.Action_Time_End],eax
  79. jmp WindowProc.finish
  80. @@:
  81. mov [ecx+PLAYER.Action_Time_End],0
  82. mov [ecx+PLAYER.Action_State],3
  83. jmp WindowProc.finish
  84. ret
  85. endp
  86.  
  87. proc DetectMoveKey Animation_Priority,Animation_Interval,Player ;Инициализация данных под клавишу движения
  88. mov ecx,[Player]
  89. mov ebx,[time]
  90. cmp ebx,[ecx+PLAYER.Action_Time_End]
  91. jb WindowProc.defwndproc
  92. stdcall InitBitmap,[Player]
  93. mov ebx,[Animation_Priority]
  94. mov [ecx+PLAYER.Action_State],ebx
  95. mov eax,[time]
  96. add eax,[Animation_Interval]
  97. mov [ecx+PLAYER.Action_Time_End],eax
  98. mov [ecx+PLAYER.Walk_Stopped],3
  99. jmp WindowProc.finish
  100. ret
  101. endp
  102.  
  103. proc CheckForZero Player ;Проверка окончания анимации
  104. mov ecx,[Player]
  105. mov ebx,[time]
  106. cmp ebx,[ecx+PLAYER.Action_Time_End]
  107. jbe .Next
  108. mov [ecx+PLAYER.Action_State],3
  109. mov [ecx+PLAYER.Cadr_Change],0
  110. mov [ecx+PLAYER.Action_Time_End],0
  111. stdcall InitBitmap,[Player]
  112. .Next:
  113. ret
  114. endp
  115.  
  116.  
  117. proc DrawBackGround Bitmap_Name,f ;Вывод фона
  118. cmp [f],0
  119. jne @f
  120. invoke CreatePatternBrush,[Bitmap_Name]
  121. mov [hbr],eax
  122. jmp .Next
  123. @@:
  124. invoke CreateSolidBrush,0h
  125. mov [hbr],eax
  126. .Next:
  127. invoke FillRect,[hdcBack],rc,[hbr]
  128. invoke DeleteObject,[hbr]
  129. ret
  130. endp
  131.  
  132. proc ChooseBitmap
  133. .PaintRight:
  134. cmp [Right_Player.Action_State],4
  135. jne @f
  136. stdcall CheckForZero,Right_Player
  137. mov ebx,[time]
  138. cmp ebx,[Right_Player.Action_Time_End]
  139. ja @f
  140. ;stdcall TextDraw,[hdc],300,100,_string,13
  141. mov eax, [rc.bottom]
  142. sub eax, 530
  143. stdcall AnimateBitmap,222,499,[Right_Player.x],eax,1,[hbmImage15],0h,Right_Player
  144. jmp .PaintLeft
  145. @@:
  146. cmp [Right_Player.Action_State],2
  147. jne @f
  148. stdcall CheckForZero,Right_Player
  149. mov ebx,[time]
  150. cmp ebx,[Right_Player.Action_Time_End]
  151. ja @f
  152. mov eax, [rc.bottom]
  153. sub eax, 530
  154. stdcall AnimateBitmap,295,499,[Right_Player.x],eax,1,[hbmImage16],0h,Right_Player
  155. jmp .PaintLeft
  156. @@:
  157. cmp [Right_Player.Action_State],8
  158. jne @f
  159. stdcall CheckForZero,Right_Player
  160. mov ebx,[time]
  161. cmp ebx,[Right_Player.Action_Time_End]
  162. ja @f
  163. mov eax, [rc.bottom]
  164. sub eax, 630
  165. stdcall AnimateBitmap,355,599,[Right_Player.x],eax,1,[hbmImage20],0h,Right_Player
  166. mov ebx,[Right_Player.x]
  167. add ebx,200
  168. cmp [Left_Player.x],ebx
  169. jbe .PaintLeft
  170. add [Right_Player.x],10
  171. jmp .PaintLeft
  172. @@:
  173. cmp [Right_Player.Action_State],1
  174. jne @f
  175. stdcall CheckForZero,Right_Player
  176. mov ebx,[time]
  177. cmp ebx,[Right_Player.Action_Time_End]
  178. ja @f
  179. mov eax, [rc.bottom]
  180. sub eax, 630
  181. stdcall AnimateBitmap,262,599,[Right_Player.x],eax,1,[hbmImage21],0h,Right_Player
  182. mov ebx,[Right_Player.x]
  183. add ebx,150
  184. cmp [Left_Player.x],ebx
  185. jbe .PaintLeft
  186. add [Right_Player.x],10
  187. jmp .PaintLeft
  188. @@:
  189. cmp [Right_Player.Action_State],6
  190. jne @f
  191. cmp [Right_Player.Walk_Stopped],1
  192. je .PaintLeft
  193. mov eax, [rc.bottom]
  194. sub eax, 630
  195. stdcall AnimateBitmap,355,599,[Right_Player.x],eax,1,[hbmImage18],0h,Right_Player
  196. mov ebx,[Right_Player.x]
  197. add ebx,200
  198. cmp [Left_Player.x],ebx
  199. jbe .PaintLeft
  200. add [Right_Player.x],20
  201. jmp .PaintLeft
  202. @@:
  203. cmp [Right_Player.Action_State],5
  204. jne @f
  205. cmp [Right_Player.Walk_Stopped],1
  206. je .PaintLeft
  207. mov eax, [rc.bottom]
  208. sub eax, 630
  209. stdcall AnimateBitmap,355,599,[Right_Player.x],eax,1,[hbmImage10],0h,Right_Player
  210. ; mov ebx,[Right_Player.x]
  211. ;add ebx,200
  212. ;cmp [Left_Player.x],ebx
  213. ;mov ebx,0
  214. cmp [Right_Player.x],30
  215. jbe .PaintLeft
  216. sub [Right_Player.x],20
  217. jmp .PaintLeft
  218. @@:
  219. cmp [Right_Player.Action_State],3
  220. jne .PaintLeft
  221. mov eax, [rc.bottom]
  222. sub eax, 530
  223. stdcall AnimateBitmap,222,499,[Right_Player.x],eax,1,[hbmImage17],0h,Right_Player
  224. jmp .PaintLeft
  225.  
  226.  
  227. .PaintLeft:
  228. cmp [Left_Player.Action_State],4
  229. jne @f
  230. stdcall CheckForZero,Left_Player
  231. mov ebx,[time]
  232. cmp ebx,[Left_Player.Action_Time_End]
  233. ja @f
  234. mov eax, [rc.bottom]
  235. sub eax, 430
  236. stdcall AnimateBitmap,308,399,[Left_Player.x],eax,1,[hbmImage13],0h,Left_Player
  237. jmp .Next
  238. @@:
  239. cmp [Left_Player.Action_State],2
  240. jne @f
  241. stdcall CheckForZero,Left_Player
  242. mov ebx,[time]
  243. cmp ebx,[Left_Player.Action_Time_End]
  244. ja @f
  245. mov eax, [rc.bottom]
  246. sub eax, 430
  247. stdcall AnimateBitmap,283,399,[Left_Player.x],eax,1,[hbmImage1],0h,Left_Player
  248. jmp .Next
  249. @@:
  250. cmp [Left_Player.Action_State],8
  251. jne @f
  252. stdcall CheckForZero,Left_Player
  253. mov ebx,[time]
  254. cmp ebx,[Left_Player.Action_Time_End]
  255. ja @f
  256. mov eax, [rc.bottom]
  257. sub eax, 430
  258. stdcall AnimateBitmap,316,399,[Left_Player.x],eax,1,[hbmImage2],0h,Left_Player
  259. mov ebx,[Right_Player.x]
  260. add ebx,200
  261. cmp [Left_Player.x],ebx
  262. jbe .Next
  263. sub [Left_Player.x],10
  264. jmp .Next
  265. @@:
  266. cmp [Left_Player.Action_State],1
  267. jne @f
  268. stdcall CheckForZero,Left_Player
  269. mov ebx,[time]
  270. cmp ebx,[Left_Player.Action_Time_End]
  271. ja @f
  272. mov eax, [rc.bottom]
  273. sub eax, 630
  274. stdcall AnimateBitmap,300,599,[Left_Player.x],eax,1,[hbmImage26],0h,Left_Player
  275. mov ebx,[Right_Player.x]
  276. add ebx,150
  277. cmp [Left_Player.x],ebx
  278. jbe .Next
  279. sub [Left_Player.x],10
  280. jmp .Next
  281. @@:
  282. cmp [Left_Player.Action_State],6
  283. jne @f
  284. cmp [Left_Player.Walk_Stopped],1
  285. je .Next
  286. mov eax, [rc.bottom]
  287. sub eax, 430
  288. stdcall AnimateBitmap,236,399,[Left_Player.x],eax,1,[hbmImage28],0h,Left_Player
  289. mov ebx,[Left_Player.x]
  290. add ebx,200
  291. cmp ebx,1350
  292. jae .Next
  293. add [Left_Player.x],20
  294. jmp .Next
  295. @@:
  296. cmp [Left_Player.Action_State],5
  297. jne @f
  298. cmp [Left_Player.Walk_Stopped],1
  299. je .Next
  300. mov eax, [rc.bottom]
  301. sub eax, 430
  302. stdcall AnimateBitmap,236,399,[Left_Player.x],eax,1,[hbmImage27],0h,Left_Player
  303. mov ebx,[Right_Player.x]
  304. add ebx,100
  305. cmp [Left_Player.x],ebx
  306. jbe .Next
  307. sub [Left_Player.x],20
  308. jmp .Next
  309. @@:
  310. cmp [Left_Player.Action_State],3
  311. jne .Next
  312. mov eax, [rc.bottom]
  313. sub eax, 430
  314. stdcall AnimateBitmap,237,399,[Left_Player.x],eax,1,[hbmImage12],0h,Left_Player
  315. .Next:
  316. ret
  317. endp
  318.  
  319. proc DetectCursor
  320. cmp [Mouse_Enabled],1
  321. jne .End
  322. cmp [Game_State],0
  323. jne .Pause
  324. invoke GetCursorPos,pt
  325. invoke PtInRect,rcbtBeer,[pt.x],[pt.y]
  326. test eax,eax
  327. jz @f
  328. invoke mciSendString,_cmd_open,0,0,0
  329. invoke mciSendString,_cmd_eject,0,0,0
  330. invoke mciSendString,_cmd_close,0,0,0
  331. @@:
  332. invoke PtInRect,rcbtStart,[pt.x],[pt.y]
  333. test eax,eax
  334. jz @f
  335. mov eax,[time]
  336. mov [Init_time],eax
  337. mov [Fight_time],eax
  338. add [Init_time],80
  339. add [Fight_time],100
  340. mov [Game_State],1
  341. mov [Mouse_Enabled],0
  342. mov [Is_Keys_Enabled],0
  343. mov [Death_Duration],1
  344. mov [Death_time],0
  345. mov [tolpaduration],256
  346. stdcall InitPlayer,Left_Player
  347. mov ebx, [rc.bottom]
  348. sub ebx, 400
  349. mov [Right_Player.y], ebx
  350. stdcall InitPlayer,Right_Player
  351. mov eax, [rc.right]
  352. sub eax, 250
  353. mov [Left_Player.x],eax
  354. mov [Left_Player.y], ebx
  355. invoke PlaySound,SND_GONG,0,SND_ASYNC
  356. @@:
  357. invoke PtInRect,rcbtExit,[pt.x],[pt.y]
  358. test eax,eax
  359. jz .End
  360. jmp WindowProc.wmdestroy
  361. .Pause:
  362. ;cmp [Game_State],2
  363. ;jne .End
  364. invoke GetCursorPos,pt
  365. invoke PtInRect,rcbtStart,[pt.x],[pt.y]
  366. test eax,eax
  367. jz @f
  368. mov [Game_State],1
  369. mov [Mouse_Enabled],0
  370. mov [Is_Keys_Enabled],1
  371. @@:
  372. invoke PtInRect,rcbtExit,[pt.x],[pt.y]
  373. test eax,eax
  374. jz .End
  375. jmp WindowProc.wmdestroy
  376. .End:
  377. jmp WindowProc.finish
  378. ret
  379. endp
  380.  
  381. proc InitPlayer Player
  382. mov ecx,[Player]
  383. mov [ecx+PLAYER.Action_Time_End], 0
  384. mov [ecx+PLAYER.Action_State],3
  385. mov [ecx+PLAYER.Walk_Stopped],1
  386. mov [ecx+PLAYER.Cadr_Change],0
  387. mov [ecx+PLAYER.x],0
  388. mov [ecx+PLAYER.y],0
  389. mov [ecx+PLAYER.Bitmap_begX],0
  390. mov [ecx+PLAYER.Bitmap_begY],0
  391. mov [ecx+PLAYER.Health],300
  392. mov [ecx+PLAYER.Blood_Time],0
  393. mov [ecx+PLAYER.Kicks_for_Fall],0
  394. mov [ecx+PLAYER.Delta_Health],0
  395. mov [tolpaduration],120
  396. ret
  397. endp
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement