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

Function zGameCheats

src/SB/Game/zGameExtras.cpp:363–444  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

361}
362
363void zGameCheats(float dt)
364{
365 if (zGameModeGet() != eGameMode_Pause)
366 {
367 return;
368 }
369
370 S32 startover = false;
371 if ((globals.pad0->pressed & ~(L1 | R1 | X | Y)) || (globals.pad0->on & ~(L1 | R1 | X | Y)))
372 {
373 startover = true;
374 }
375 else if ((globals.pad0->on & (L1 | R1)) != (L1 | R1))
376 {
377 startover = true;
378 }
379 else if ((globals.pad0->pressed & (X | Y)) == 0)
380 {
381 sCheatTimer -= dt;
382 if (!(sCheatTimer <= 0.0f))
383 {
384 return;
385 }
386 startover = true;
387 // For some reason there's a double branch here where the first just jumps past the second one.
388 }
389
390 if (!startover)
391 {
392 if (sCheatInputCount > 32)
393 {
394 startover = true;
395 }
396 sCheatInputCount++;
397 }
398
399 if (startover)
400 {
401 sCheatTimer = 0.3f;
402 sCheatInputCount = 0;
403 memset(&sCheatPressed, 0, sizeof(sCheatPressed));
404 return;
405 }
406
407 AddToCheatPressed(globals.pad0->pressed & 0x60000);
408
409 S32 match = 0;
410 sCheatTimer = 0.3f;
411 GECheat* rec_next = cheatList;
412 while (rec_next->key_code != NULL)
413 {
414 GECheat* rec_curr = rec_next;
415 rec_next++;
416
417 if (!TestCheat(rec_curr->key_code))
418 {
419 continue;
420 }

Callers

nothing calls this directly

Calls 6

zGameModeGetFunction · 0.85
memsetFunction · 0.85
AddToCheatPressedFunction · 0.85
TestCheatFunction · 0.85
GEC_CheatFlagToggleFunction · 0.85
GEC_CheatFlagAddFunction · 0.85

Tested by

no test coverage detected