| 1147 | } |
| 1148 | |
| 1149 | std::string cFodder::GUI_Select_File(const char* pTitle, const std::vector<sSavedGame>& pSave, const std::vector<std::string> &pMaps) { |
| 1150 | mPhase_Aborted = false; |
| 1151 | mGUI_SaveLoadAction = 0; |
| 1152 | |
| 1153 | mGraphics->SetActiveSpriteSheet(eGFX_RECRUIT); |
| 1154 | |
| 1155 | mGUI_Select_File_CurrentIndex = 0; |
| 1156 | mGUI_Select_File_Count = (pSave.size() == 0 ? (int16)pMaps.size() : (int16)pSave.size()); |
| 1157 | |
| 1158 | do { |
| 1159 | size_t YOffset = PLATFORM_BASED(0, 25); |
| 1160 | |
| 1161 | mSurface->clearBuffer(); |
| 1162 | GUI_Element_Reset(); |
| 1163 | GUI_Render_Text_Centred(pTitle, 0x0C); |
| 1164 | |
| 1165 | GUI_Button_Draw("UP", 0x24); |
| 1166 | GUI_Button_Setup(&cFodder::GUI_Button_Load_Up); |
| 1167 | |
| 1168 | GUI_Button_Draw("DOWN", 0x99 + YOffset); |
| 1169 | GUI_Button_Setup(&cFodder::GUI_Button_Load_Down); |
| 1170 | |
| 1171 | GUI_Button_Draw("CONTINUE GAME", 0xB3 + YOffset); |
| 1172 | GUI_Button_Setup(&cFodder::GUI_Button_Load_Exit); |
| 1173 | |
| 1174 | mSurface->Save(); |
| 1175 | |
| 1176 | int16 DataC = 0; |
| 1177 | |
| 1178 | // Draw the raw files list? |
| 1179 | if (!pSave.size()) { |
| 1180 | auto FileIT = pMaps.begin() + mGUI_Select_File_CurrentIndex; |
| 1181 | |
| 1182 | for (; DataC < mGUI_Select_File_ShownItems && FileIT != pMaps.end(); ++DataC) { |
| 1183 | size_t Pos = FileIT->find_first_of("."); |
| 1184 | |
| 1185 | GUI_Button_Draw(FileIT->substr(0, Pos), 0x3E + (DataC * 0x15), 0xB2, 0xB3); |
| 1186 | GUI_Button_Setup(&cFodder::GUI_Button_Filename); |
| 1187 | ++FileIT; |
| 1188 | } |
| 1189 | } |
| 1190 | else { |
| 1191 | // Or the save game list |
| 1192 | auto FileIT = pSave.begin() + mGUI_Select_File_CurrentIndex; |
| 1193 | |
| 1194 | for (; DataC < mGUI_Select_File_ShownItems && FileIT != pSave.end(); ++DataC) { |
| 1195 | |
| 1196 | GUI_Button_Draw(FileIT->mName, 0x3E + (DataC * 0x15), 0xB2, 0xB3); |
| 1197 | GUI_Button_Setup(&cFodder::GUI_Button_Filename); |
| 1198 | ++FileIT; |
| 1199 | } |
| 1200 | } |
| 1201 | |
| 1202 | GUI_Select_File_Loop(false); |
| 1203 | mSurface->Restore(); |
| 1204 | |
| 1205 | } while (mGUI_SaveLoadAction == 3); |
| 1206 |
nothing calls this directly
no test coverage detected