| 80 | } |
| 81 | |
| 82 | void phase_loop() { |
| 83 | static int16 result = -1; |
| 84 | |
| 85 | // No recruits left? |
| 86 | if (result != 1) { |
| 87 | if (!g_Fodder->mGame_Data.mRecruits_Available_Count) { |
| 88 | emscripten_cancel_main_loop(); |
| 89 | emscripten_set_main_loop(menu_loop, 24, 1); |
| 90 | |
| 91 | result = -1; |
| 92 | } |
| 93 | } |
| 94 | |
| 95 | if (result == 0) { |
| 96 | // Game Won? |
| 97 | if (!g_Fodder->mGame_Data.Phase_Next()) { |
| 98 | emscripten_cancel_main_loop(); |
| 99 | emscripten_set_main_loop(menu_loop, 24, 1); |
| 100 | // Break to version screen |
| 101 | return; |
| 102 | } |
| 103 | result = -1; |
| 104 | } |
| 105 | |
| 106 | if (result == -1) { |
| 107 | if (g_Fodder->mPhase_Aborted2) { |
| 108 | g_Fodder->mPhase_Aborted2 = false; |
| 109 | emscripten_cancel_main_loop(); |
| 110 | emscripten_set_main_loop(menu_loop, 24, 1); |
| 111 | return; |
| 112 | } |
| 113 | g_Fodder->Phase_EngineReset(); |
| 114 | g_Fodder->Phase_SquadPrepare(); |
| 115 | g_Fodder->Phase_Prepare(); |
| 116 | } |
| 117 | |
| 118 | // -1 = Phase Try Again |
| 119 | // 0 = Phase Won |
| 120 | // 1 = Phase Running |
| 121 | |
| 122 | result = g_Fodder->Phase_Cycle(); |
| 123 | g_Fodder->Cycle_End(); |
| 124 | } |
| 125 | |
| 126 | int start(int argc, char *argv[]) { |
| 127 |
nothing calls this directly
no test coverage detected