|
| 1 | +#include <common.h> |
| 2 | + |
| 3 | +void DECOMP_MM_MenuProc_Main(struct RectMenu* mainMenu) |
| 4 | +{ |
| 5 | + int choose; |
| 6 | + struct GameTracker* gGT = sdata->gGT; |
| 7 | + |
| 8 | + // disabled for CustomLevel3 |
| 9 | + |
| 10 | + //// if scrapbook is unlocked |
| 11 | + //if ((sdata->gameProgress.unlocks[1] & 0x10) != 0) |
| 12 | + //{ |
| 13 | + //// change D230.rowsMainMenuBasic |
| 14 | + //// to D230.rowsMainMenuWithScrapbook |
| 15 | + //mainMenu->rows = &D230.rowsMainMenuWithScrapbook[0]; |
| 16 | + //} |
| 17 | + |
| 18 | +#if 1 |
| 19 | + char* info = "Raw Track Tester: 1P Version"; |
| 20 | + DecalFont_DrawLine(info, 5, 197, FONT_SMALL, ORANGE); |
| 21 | + DecalFont_DrawLine(__DATE__, 5, 206, FONT_SMALL, ORANGE); |
| 22 | + DecalFont_DrawLine(__TIME__, 170, 206, FONT_SMALL, ORANGE); |
| 23 | +#endif |
| 24 | + |
| 25 | + MM_ParseCheatCodes(); |
| 26 | + |
| 27 | + MM_ToggleRows_Difficulty(); |
| 28 | + |
| 29 | + MM_ToggleRows_PlayerCount(); |
| 30 | + |
| 31 | + // If you are at the highest hierarchy level of main menu |
| 32 | + if (mainMenu->unk1e == 1) |
| 33 | + { |
| 34 | + MM_Title_MenuUpdate(); |
| 35 | + |
| 36 | + if ( |
| 37 | + ( |
| 38 | + // If you are in main menu |
| 39 | + (D230.MM_State == 1) && |
| 40 | + |
| 41 | + // if "title" object exists |
| 42 | + (D230.titleObj != NULL) |
| 43 | + ) && |
| 44 | + (FPS_DOUBLE(229) < D230.timerInTitle) |
| 45 | + ) |
| 46 | + { |
| 47 | + // "TM" trademark string |
| 48 | + DecalFont_DrawLineOT( |
| 49 | + sdata->lngStrings[0x244],0x10e,0x9c,FONT_SMALL,ORANGE, |
| 50 | + &gGT->backBuffer->otMem.startPlusFour[3]); |
| 51 | + } |
| 52 | + |
| 53 | +#if 0 |
| 54 | + // DISABLED DEMO MODE |
| 55 | +#endif |
| 56 | + |
| 57 | + // 900 = 30 seconds at 30fps |
| 58 | + gGT->demoCountdownTimer = FPS_DOUBLE(900); |
| 59 | + } |
| 60 | + |
| 61 | + MM_Title_Init(); |
| 62 | + |
| 63 | + // if drawing ptrNextBox_InHierarchy |
| 64 | + if ((mainMenu->state & 0x10) != 0) { |
| 65 | + D230.timerInTitle = 1000; |
| 66 | + } |
| 67 | + |
| 68 | + if ((mainMenu->state & 0x400) == 0) { |
| 69 | + return; |
| 70 | + } |
| 71 | + |
| 72 | + struct Title* titleObj = D230.titleObj; |
| 73 | + |
| 74 | + // if "title" object exists |
| 75 | + if (titleObj != NULL) |
| 76 | + { |
| 77 | + // CameraPosOffset X |
| 78 | + titleObj->cameraPosOffset[0] = 0; |
| 79 | + } |
| 80 | + |
| 81 | + // if you are at highest level of menu hierarchy |
| 82 | + if (mainMenu->unk1e != 0) |
| 83 | + { |
| 84 | + // leave the function |
| 85 | + return; |
| 86 | + } |
| 87 | + |
| 88 | + // If you are here, then you must not be |
| 89 | + // at the highest level of menu hierarchy |
| 90 | + |
| 91 | + // if row is negative, do nothing |
| 92 | + if ((mainMenu->rowSelected) < 0) { |
| 93 | + return; |
| 94 | + } |
| 95 | + |
| 96 | + // clear flags from game mode |
| 97 | + gGT->gameMode1 &= ~(BATTLE_MODE | ADVENTURE_MODE | TIME_TRIAL | ADVENTURE_ARENA | ARCADE_MODE | ADVENTURE_CUP); |
| 98 | + |
| 99 | + // clear more game mode flags |
| 100 | + gGT->gameMode2 &= ~(CUP_ANY_KIND); |
| 101 | + |
| 102 | + // set a flag that you're in main menu |
| 103 | + mainMenu->state |= 4; |
| 104 | + |
| 105 | + // number of laps is 3 |
| 106 | + gGT->numLaps = 3; |
| 107 | + |
| 108 | + // get LNG index of row selected |
| 109 | + choose = (int)mainMenu->rows[mainMenu->rowSelected].stringIndex; |
| 110 | + |
| 111 | + // choose Adventure |
| 112 | + if (choose == 0x4c) |
| 113 | + { |
| 114 | + // Turn on Adventure Mode, turn off item cheats |
| 115 | + gGT->gameMode1 |= ADVENTURE_MODE; |
| 116 | + gGT->gameMode2 &= ~(CHEAT_WUMPA | CHEAT_MASK | CHEAT_TURBO | CHEAT_ENGINE | CHEAT_BOMBS); |
| 117 | + |
| 118 | + // menu for new/load |
| 119 | + mainMenu->ptrNextBox_InHierarchy = &D230.menuAdventure; |
| 120 | + mainMenu->state |= 0x10; |
| 121 | + return; |
| 122 | + } |
| 123 | + |
| 124 | + // If you choose Time Trial in Main Menu |
| 125 | + if (choose == 0x4d) |
| 126 | + { |
| 127 | + // Leave main menu hierarchy |
| 128 | + D230.MM_State = 2; |
| 129 | + |
| 130 | + // Set next stage to 2 for Time Trial |
| 131 | + D230.desiredMenuIndex = 2; |
| 132 | + |
| 133 | + // set number of players to 1 |
| 134 | + gGT->numPlyrNextGame = 1; |
| 135 | + |
| 136 | + // set game mode to Time Trial Mode |
| 137 | + gGT->gameMode1 |= TIME_TRIAL; |
| 138 | + gGT->gameMode2 &= ~(CHEAT_WUMPA | CHEAT_MASK | CHEAT_TURBO | CHEAT_ENGINE | CHEAT_BOMBS); |
| 139 | + return; |
| 140 | + } |
| 141 | + |
| 142 | + // if one-lap-race cheat is enabled |
| 143 | + // works in Arcade, VS, not Adv, not Time Trial |
| 144 | + if ((gGT->gameMode2 & CHEAT_ONELAP) != 0) |
| 145 | + { |
| 146 | + gGT->numLaps = 1; |
| 147 | + } |
| 148 | + |
| 149 | + if (choose == 0x4e) |
| 150 | + { |
| 151 | + // set game mode to Arcade Mode |
| 152 | + gGT->gameMode1 |= ARCADE_MODE; |
| 153 | + |
| 154 | + // set next menu |
| 155 | + mainMenu->ptrNextBox_InHierarchy = &D230.menuRaceType; |
| 156 | + mainMenu->state |= 0x10; |
| 157 | + return; |
| 158 | + } |
| 159 | + |
| 160 | + // if you entered VS mode |
| 161 | + if (choose == 0x4f) |
| 162 | + { |
| 163 | + // next menu is choosing single+cup |
| 164 | + mainMenu->ptrNextBox_InHierarchy = &D230.menuRaceType; |
| 165 | + mainMenu->state |= 0x10; |
| 166 | + return; |
| 167 | + } |
| 168 | + |
| 169 | + // if you chose Battle |
| 170 | + if (choose == 0x50) |
| 171 | + { |
| 172 | + D230.characterSelect_transitionState = 2; |
| 173 | + |
| 174 | + // set game mode to Battle Mode |
| 175 | + gGT->gameMode1 |= BATTLE_MODE; |
| 176 | + |
| 177 | + // set next menu to 2P,3P,4P |
| 178 | + mainMenu->ptrNextBox_InHierarchy = &D230.menuPlayers2P3P4P; |
| 179 | + mainMenu->state |= 0x10; |
| 180 | + return; |
| 181 | + } |
| 182 | + |
| 183 | + // if you chose High Score |
| 184 | + if (choose == 0x51) |
| 185 | + { |
| 186 | + // Set next stage to high score menu |
| 187 | + D230.desiredMenuIndex = 3; |
| 188 | + |
| 189 | + // Leave main menu hierarchy |
| 190 | + D230.MM_State = 2; |
| 191 | + |
| 192 | + return; |
| 193 | + } |
| 194 | + |
| 195 | + // if you chose Scrapbook |
| 196 | + if (choose == 0x234) |
| 197 | + { |
| 198 | + // Set next stage to Scrapbook |
| 199 | + D230.desiredMenuIndex = 5; |
| 200 | + |
| 201 | + // Leave main menu hierarchy |
| 202 | + D230.MM_State = 2; |
| 203 | + |
| 204 | + return; |
| 205 | + } |
| 206 | +} |
| 207 | + |
0 commit comments