MCPcopy Create free account
hub / github.com/bfbbdecomp/bfbb / zVarGameSlotInfo

Function zVarGameSlotInfo

src/SB/Game/zVar.cpp:213–270  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

211namespace
212{
213 char* zVarGameSlotInfo(S32 i, char* buffer, size_t something)
214 {
215 char date[0x20] = "";
216 char time[0x20] = "";
217 S32 hour;
218 char ampm[0x20] = "";
219 char biggerbuf[256] = "";
220
221 // Get the date
222 strncpy(date, zSaveLoadGameTable[i].date, 5);
223 date[2] = '/';
224
225 sprintf(biggerbuf, "%s/%c%c", date, zSaveLoadGameTable[i].date[0x8],
226 zSaveLoadGameTable[i].date[0x9]);
227 strncpy(date, biggerbuf, 0x20);
228 date[0x20 - 1] = '\0';
229
230 // Get the hour
231 sprintf(time, "%c%c", zSaveLoadGameTable[i].date[0xB],
232 zSaveLoadGameTable[i].date[0xC]);
233
234 // Get the AM/PM
235 hour = atoi(time);
236 if (hour >= 12)
237 {
238 strncpy(ampm, "PM", 3);
239 if (hour != 12)
240 {
241 hour -= 12;
242 }
243 }
244 else
245 {
246 strncpy(ampm, "AM", 3);
247 if (hour == 0)
248 {
249 hour = 12;
250 }
251 }
252
253 // Construct final date
254 sprintf(time, "%d:%c%c %s", hour, zSaveLoadGameTable[i].date[0xE],
255 zSaveLoadGameTable[i].date[0xF], ampm);
256 sprintf(date, "%s %s", date, time);
257 time[0x20 - 1] = '\0';
258 date[0x20 - 1] = '\0';
259
260 if (xStricmp(zSaveLoadGameTable[i].label, "Empty") == 0)
261 {
262 sprintf(buffer, "Empty");
263 }
264 else
265 {
266 zSaveLoad_BuildName(buffer, i);
267 }
268
269 return buffer;
270 }

Callers 8

var_text_GameSlot0Function · 0.70
var_text_GameSlot1Function · 0.70
var_text_GameSlot2Function · 0.70
var_text_GameSlot3Function · 0.70
var_text_GameSlot4Function · 0.70
var_text_GameSlot5Function · 0.70
var_text_GameSlot6Function · 0.70
var_text_GameSlot7Function · 0.70

Calls 5

strncpyFunction · 0.85
sprintfFunction · 0.85
atoiFunction · 0.85
zSaveLoad_BuildNameFunction · 0.70
xStricmpFunction · 0.50

Tested by

no test coverage detected