bunnytaur

Untitled

Jan 3rd, 2016
198
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. ;Copyright Liquid Unicorn Productions, 2013
  2. ;Coded by Jennifer "Ryn Inaba" Stears
  3.  
  4. ;TODO:  Realistic odds
  5.        
  6.  
  7. .686p
  8. .mmx
  9. .model flat,stdcall
  10. option casemap:none
  11.  
  12. include windows.inc
  13. include kernel32.inc
  14. include user32.inc
  15. include ntdll.inc
  16. include masm32.inc
  17. includelib masm32.lib
  18. includelib kernel32.lib
  19. includelib user32.lib
  20. includelib ntdll.lib
  21.  
  22. .data
  23. caption     db  "Russian Roluette",0
  24. text        db  "Do you want to play a game? Hit YES to go on or hit NO to exit.",0
  25. aClick      db  "CLICK! Chamber empty!",0
  26. aBang       db  "BANG! You're dead. Game over.",0
  27. aPlayagain  db  "Do you want to play again?",0
  28.  
  29. .data?
  30. chambers dd ?
  31. random_init dd ?
  32.  
  33. .code
  34. start:
  35. ;We'll seed the random number generator here just to get
  36. ; our random numbers random on start and all that
  37. ; it isn't the best way since everytime we jump here
  38. ; it'll give us a new number, instead of the old one
  39. ; this will fuck up our odds, but hell.
  40. invoke GetTickCount
  41. invoke nseed, eax
  42.  
  43. ;If user clicks yes it'll jump to the simulated gun
  44. ; generating a random number and checking it against
  45. ; a chosen static number(05h).
  46.  
  47. ;If user clicks no the program will just exit
  48. invoke MessageBox,NULL,addr text,addr caption,MB_YESNO
  49. .if eax==IDYES
  50.     jmp @gun
  51. .elseif eax==IDNO
  52.     jmp @exit
  53. .endif
  54.  
  55. @gun:
  56. invoke nrandom, 06h ;Six chambers, 00h to 05h.
  57. ;Looking for our number.
  58. ;TODO: "Realistic odds"
  59. cmp eax, 05h
  60. je @bang
  61. jne @click
  62.  
  63. @bang:
  64. invoke MessageBoxEx,NULL,addr aBang,addr caption,MB_OK,NULL
  65. push esp
  66. invoke RtlAdjustPrivilege,19,2,0,esp ;Not needed but still works in Win9X, suprisingly works on Vista/7.
  67. invoke ExitWindowsEx,EWX_SHUTDOWN,NULL
  68.  
  69.  
  70. ;Does nothing but asks the user to either play again or quit.
  71. @click:
  72. invoke MessageBox,NULL,addr aClick,addr aPlayagain,MB_YESNO
  73. .if eax==IDYES
  74.     jmp start
  75. .elseif eax==IDNO
  76.     jmp @exit
  77. .endif
  78.  
  79. @exit:
  80. invoke ExitProcess,0
  81. end start
Advertisement
Add Comment
Please, Sign In to add comment