Advertisement
Guest User

Kills if no coins remain

a guest
Jan 1st, 2018
148
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.99 KB | None | 0 0
  1. #include "nsmb.h"
  2.  
  3. //Where is some function!?!?!
  4. extern "C" {
  5.         int getPtrToPlayerActor();
  6. }
  7.  
  8. int looseSpeed = 1; //Speed of loosing coins
  9. int startingCoins = 50; //Coins to start with
  10. int warning = 15; //when warning sound appear
  11.  
  12. int timer = 0;
  13. int counter = 0;
  14. int *Coins = (int*) (0x0208B37C);
  15.  
  16. void hook_0200696C_main()
  17. {
  18.         *Coins = startingCoins;
  19. }
  20.  
  21. void hook_0211F83C_ov_0A()
  22. {
  23.   if(timer == 100)
  24.   {
  25.     //Kill Mario if 0 coins
  26.     MarioActor* mario = (MarioActor*)getPtrToPlayerActor();
  27.     if(*Coins == 0)
  28.     {
  29.       mario->DeathState = 0x21197FC;
  30.       *Coins = startingCoins;
  31.     }
  32.  
  33.     //Take Coins from Mario
  34.     if(counter == looseSpeed)
  35.     {
  36.       counter = 0;
  37.       *Coins = *Coins - 1;
  38.     }
  39.     counter = counter + 1;
  40.  
  41.     //Play sound if Mario Low on coins
  42.     if(*Coins < warning + 1)
  43.     {
  44.       PlaySNDEffect(0x13D, 0);
  45.     }
  46.     timer = 0;
  47.   }
  48.  
  49.   timer = timer + 1;
  50. }
  51.  
  52. void nsub_02020354()
  53. {
  54.   *Coins = *Coins + 1;
  55. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement