MCPcopy Create free account
hub / github.com/DescentDevelopers/Descent3 / DemoCheats

Function DemoCheats

Descent3/GameCheat.cpp:336–654  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

334}
335
336void DemoCheats(int key) {
337 static int snd_cheat = -1;
338 int i;
339 const char *cryptstring, *oldcryptstring;
340
341 if (snd_cheat == -1) {
342 snd_cheat = SOUND_CHEATER;
343 }
344
345 key = ddio_KeyToAscii(key);
346
347 for (i = 0; i < 15; i++) {
348 CheatBuffer[i] = CheatBuffer[i + 1];
349 OldCheatBuffer[i] = OldCheatBuffer[i + 1];
350 }
351
352 CheatBuffer[CHEATSPOT] = key;
353 OldCheatBuffer[CHEATSPOT] = key;
354
355 cryptstring = jcrypt(&CheatBuffer[7]);
356 oldcryptstring = oldjcrypt(&OldCheatBuffer[7]);
357
358 for (i = 0; i < N_LAMER_CHEATS; i++) {
359 if (!(strcmp(oldcryptstring, LamerCheats[i]))) {
360 if (snd_cheat != -1)
361 Sound_system.Play2dSound(snd_cheat);
362
363 if (Game_mode & GM_MULTI) {
364 SendCheaterAttemptText();
365 } else {
366 AddHUDMessage(TXT_LAMER);
367 Objects[Players[Player_num].objnum].shields = 1;
368 Players[Player_num].energy = 1;
369 }
370 }
371 }
372
373 if (!(memcmp(cryptstring, FrametimeCheat, 8)) || !(memcmp(oldcryptstring, OLDDEMO_FrametimeCheat, 8)) ||
374 !(memcmp(oldcryptstring, OLDOEM_FrametimeCheat, 8))) {
375 Hud_stat_mask ^= STAT_FPS;
376 bool enabled = (bool)((Hud_stat_mask & STAT_FPS) != 0);
377 AddHUDMessage(TXT_FRAMETIMEMSG, (enabled) ? TXT_ENABLED : TXT_DISABLED);
378 }
379
380 if (!(memcmp(cryptstring, CoolTextures, 8)) || !(memcmp(oldcryptstring, OLDDEMO_CoolTextures, 8)) ||
381 !(memcmp(oldcryptstring, OLDOEM_CoolTextures, 8))) {
382 Force_one_texture = !Force_one_texture;
383 AddHUDMessage("%s", (Force_one_texture) ? TXT_COOLTEXTURES : TXT_NORMALTEXTURES);
384 }
385
386 if (!(memcmp(cryptstring, CameraCheat, 8))) {
387 Player_has_camera = !Player_has_camera;
388 }
389
390#ifdef USE_RTP
391 if (!(memcmp(cryptstring, StartLogCheat, 8))) {
392 rtp_StartLog();
393 }

Callers 1

ProcessKeysFunction · 0.85

Calls 15

ddio_KeyToAsciiFunction · 0.85
jcryptFunction · 0.85
oldjcryptFunction · 0.85
SendCheaterAttemptTextFunction · 0.85
AddHUDMessageFunction · 0.85
rtp_StartLogFunction · 0.85
rtp_StopLogFunction · 0.85
FindTextureNameFunction · 0.85
MakePlayerVulnerableFunction · 0.85
MakePlayerInvulnerableFunction · 0.85
MakeObjectVisibleFunction · 0.85
MakeObjectInvisibleFunction · 0.85

Tested by

no test coverage detected