Advertisement
Guest User

Untitled

a guest
Dec 9th, 2019
142
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 4.79 KB | None | 0 0
  1. // NAME: RandomShopsInC(v2)
  2. // GAMES: MP3_USA
  3. // EXECUTION: Direct
  4.  
  5.  
  6.  
  7. typedef signed char            s8;
  8. typedef unsigned char          u8;
  9. typedef signed short int       s16;
  10. typedef unsigned short int     u16;
  11. typedef signed int             s32;
  12. typedef unsigned int           u32;
  13. typedef float  f32;
  14. typedef double f64;
  15.  
  16.  
  17. extern s16 GetCurrentPlayerIndex();
  18. extern struct player *GetPlayerStruct(s32 player_index);
  19. extern s32 PlayerHasEmptyItemSlot(s32 player_index);
  20.  
  21.  
  22. void main() {
  23.     s32 cur_player_index = GetCurrentPlayerIndex();
  24.     s32 open_index = PlayerHasEmptyItemSlot(cur_player_index);
  25.     if (open_index != -1) {
  26.       struct player *player = GetPlayerStruct(cur_player_index);
  27. //      player->items[open_index] = 0x0A; // Golden Mushroom (errors on this line)
  28.     }
  29. }
  30.  
  31.  
  32. //====================================================================
  33. // Data defined below
  34. //====================================================================
  35.  
  36. asm(".definelabel ShopFormatters, 0");
  37. asm(
  38. ".align 0x10\n"
  39. //"ShopMenuFormatters:
  40. ".byte 0x0B\n" // Start the message
  41. ".byte 0x06\n" // Blue font
  42. ".byte 0x0E, 0x0E\n" //Tab x2
  43. ".byte 0x0C\n" //start option
  44. ".ascii \"%s\"\n" //Item 1 String
  45. ".ascii \"%s\"\n" //specific item indentation
  46. ".byte 0x08\n" // White Font
  47. ".byte 0x29\n" //coin icon
  48. ".byte 0x3E\n" //x after coin icon
  49. ".ascii \"%s\"\n"//Item 1 Cost
  50. ".byte 0x0D\n" // End option
  51. ".byte 0x0A\n" // Newline
  52. //
  53. ".byte 0x06\n" // Blue font
  54. ".byte 0x0E, 0x0E\n" //Tab x2
  55. ".byte 0x0C\n" //start option
  56. ".ascii \"%s\"\n" //Item 2 String
  57. ".ascii \"%s\"\n" //specific item indentation
  58. ".byte 0x08\n" // White Font
  59. ".byte 0x29\n" //coin icon
  60. ".byte 0x3E\n" //x after coin icon
  61. ".ascii \"%s\"\n" //Item 2 Cost
  62. ".byte 0x0D\n" // End option
  63. ".byte 0x0A\n" // Newline
  64. //
  65. ".byte 0x06\n" // Blue font
  66. ".byte 0x0E, 0x0E\n" //Tab x2
  67. ".byte 0x0C\n" //start option
  68. ".ascii \"%s\"\n" //Item 3 String
  69. ".ascii \"%s\"\n" //specific item indentation
  70. ".byte 0x08\n" // White Font
  71. ".byte 0x29\n" //coin icon
  72. ".byte 0x3E\n" //x after coin icon
  73. ".ascii \"%s\"\n" //Item 3 Cost
  74. ".byte 0x0D\n" // End option
  75. //
  76. ".byte 0x00" //end of text box
  77.     );
  78.  
  79.  
  80. asm(".definelabel ItemChances, 1");
  81. asm(
  82. ".align 0x10\n"
  83. //ItemChances:
  84. ".byte 0x0B\n" // Mushroom (00-0B) 10%
  85. ".byte 0x15\n" // Skeleton Key (0C-14) 10%
  86. ".byte 0x1B\n" // Poison Mushroom 6%
  87. ".byte 0x21\n" // Reverse Mushroom 6%
  88. ".byte 0x27\n" // Cellular Shopper 6%
  89. ".byte 0x2D\n" // Warp Block 6%
  90. ".byte 0x33\n" // Plunder Chest 6%
  91. ".byte 0x39\n" // Bowser Phone 6%
  92. ".byte 0x3F\n" // Dueling Glove 6%
  93. ".byte 0x45\n" // Lucky Lamp 6%
  94. ".byte 0x4B\n" // Golden Mushroom 6%
  95. ".byte 0x51\n" // Boo Bell 6%
  96. ".byte 0x59\n" // Boo Repellant 8%
  97. ".byte 0x5F\n" // Bowser Suit 6%
  98. ".byte 0x64\n" // Magic Lamp 5%
  99. ".byte 0x64\n" // Koopa Kard
  100. ".byte 0x64\n" // Barter Box
  101. ".byte 0x64\n" // Lucky Charm
  102. ".byte 0x64\n" // Wacky Watch
  103.     );
  104.  
  105.  
  106. //ItemsEnum
  107. //byte 0x00 // Mushroom
  108. //byte 0x01 // Skeleton Key
  109. //byte 0x02 // Poison Mushroom
  110. //byte 0x03 // Reverse Mushroom
  111. //byte 0x04 // Cellular Shopper
  112. //byte 0x05 // Warp Block
  113. //byte 0x06 // Plunder Chest
  114. //byte 0x07 // Bowser Phone
  115. //byte 0x08 // Dueling Glove
  116. //byte 0x09 // Lucky Lamp
  117. //byte 0x0A // Golden Mushroom
  118. //byte 0x0B // Boo Bell
  119. //byte 0x0C // Boo Repellant
  120. //byte 0x0D // Bowser Suit
  121. //byte 0x0E // Magic Lamp
  122. //byte 0x0F // Koopa Kard
  123. //byte 0x10 // Barter Box
  124. //byte 0x11 // Lucky Charm
  125. //byte 0x12 // Wacky Watch
  126.  
  127. //====================================================================
  128. // Structs defined below
  129. //====================================================================
  130.  
  131. struct playermain {
  132.     s8 unk0;                //0x00
  133.     s8 cpu_difficulty;      //0x01
  134.     s8 controller;          //0x02
  135.     u8 character;           //0x03
  136.     u8 flags;               //0x04
  137.     s8 pad0[5];             //0x05-0x09
  138.     s16 coins;              //0x0A-0x0B
  139.     s16 minigame_coins;     //0x0C-0x0D
  140.     s8 stars;               //0x0E
  141.  
  142.     u8 cur_chain_index;     //0x0F
  143.     u8 cur_space_index;     //0x10
  144.     u8 next_chain_index;    //0x11
  145.     u8 next_space_index;    //0x12
  146.     u8 unk1_chain_index;    //0x13
  147.     u8 unk1_space_index;    //0x14
  148.     u8 reverse_chain_index; //0x15
  149.     u8 reverse_space_index; //0x16
  150.  
  151.     u8 flags2;              //0x17
  152.     u8 items[3];            //0x18-0x1A
  153.     u8 bowser_suit_flag;    //0x1B
  154.     u8 turn_color_status;   //0x1C
  155.  
  156.     s8 pad1[7];             //0x1D-0x23
  157.  
  158.     void *playerpos;        //0x24-0x27
  159.     s16 minigame_star;      //0x28-0x29
  160.     s16 coin_star;          //0x2A-0x2B
  161.     s8 happening_space_count;//0x2C
  162.     s8 red_space_count;     //0x2D
  163.     s8 blue_space_count;    //0x2E
  164.     s8 chance_space_count;  //0x2F
  165.     s8 bowser_space_count;  //0x30
  166.     s8 battle_space_count;  //0x31
  167.     s8 item_space_count;    //0x32
  168.     s8 bank_space_count;    //0x33
  169.     s8 game_guy_space_count;//0x34
  170.  
  171.     s8 pad3[3];             //0x35-0x37
  172. }; // sizeof == 56, 0x38
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement