// Respond to keyboard input events, // intercept cheats. boolean ST_Responder (event_t* ev) { int i; // Filter automap on/off. if (ev->type == ev_keyup && ((ev->data1 & 0xffff0000) == AM_MSGHEADER)) { switch(ev->data1) { case AM_MSGENTERED: st_gamestate = AutomapState; st_firsttime = true; break; case AM_MSGEXITED: // fprintf(stderr, "AM exited\n"); st_gamestate = FirstPersonState; break; } } // if a user keypress... else if (ev->type == ev_keydown) { if (!netgame) { // b. - enabled for more debug fun. // if (gameskill != sk_nightmare) { // 'dqd' cheat for toggleable god mode if (cht_CheckCheat(&cheat_god, ev->data1)) { plyr->cheats ^= CF_GODMODE; if (plyr->cheats & CF_GODMODE) { if (plyr->mo) plyr->mo->health = 100; plyr->health = 100; plyr->message = STSTR_DQDON; } else plyr->message = STSTR_DQDOFF; } // 'fa' cheat for killer f*****g arsenal else if (cht_CheckCheat(&cheat_ammonokey, ev->data1)) { plyr->armorpoints = 200; plyr->armortype = 2; for (i=0; i<NUMWEAPONS; i++) plyr->weaponowned[i] = true; for (i=0; i<NUMAMMO; i++) plyr->ammo[i] = plyr->maxammo[i]; plyr->message = STSTR_FAADDED; } // 'kfa' cheat for key full ammo else if (cht_CheckCheat(&cheat_ammo, ev->data1)) { plyr->armorpoints = 200; plyr->armortype = 2; for (i=0; i<NUMWEAPONS; i++) plyr->weaponowned[i] = true; for (i=0; i<NUMAMMO; i++) plyr->ammo[i] = plyr->maxammo[i]; for (i=0; i<NUMCARDS; i++) plyr->cards[i] = true; plyr->message = STSTR_KFAADDED; } // 'mus' cheat for changing music else if (cht_CheckCheat(&cheat_mus, ev->data1)) { char buf[3]; int musnum; plyr->message = STSTR_MUS; cht_GetParam(&cheat_mus, buf); if (gamemode == commercial) { musnum = mus_runnin + (buf[0]-'0')*10 + buf[1]-'0' - 1; if (((buf[0]-'0')*10 + buf[1]-'0') > 35) plyr->message = STSTR_NOMUS; else S_ChangeMusic(musnum, 1); } else { musnum = mus_e1m1 + (buf[0]-'1')*9 + (buf[1]-'1'); if (((buf[0]-'1')*9 + buf[1]-'1') > 31) plyr->message = STSTR_NOMUS; else S_ChangeMusic(musnum, 1); } } // Simplified, accepting both "noclip" and "idspispopd". // no clipping mode cheat else if ( cht_CheckCheat(&cheat_noclip, ev->data1) || cht_CheckCheat(&cheat_commercial_noclip,ev->data1) ) { plyr->cheats ^= CF_NOCLIP; if (plyr->cheats & CF_NOCLIP) plyr->message = STSTR_NCON; else plyr->message = STSTR_NCOFF; } // 'behold?' power-up cheats for (i=0; i<6; i++) { if (cht_CheckCheat(&cheat_powerup[i], ev->data1)) { if (!plyr->powers[i]) P_GivePower( plyr, i); else if (i!=pw_strength) plyr->powers[i] = 1; else plyr->powers[i] = 0; plyr->message = STSTR_BEHOLDX; } } // 'behold' power-up menu if (cht_CheckCheat(&cheat_powerup[6], ev->data1)) { plyr->message = STSTR_BEHOLD; } // 'choppers' invulnerability & chainsaw else if (cht_CheckCheat(&cheat_choppers, ev->data1)) { plyr->weaponowned[wp_chainsaw] = true; plyr->powers[pw_invulnerability] = true; plyr->message = STSTR_CHOPPERS; } // 'mypos' for player position else if (cht_CheckCheat(&cheat_mypos, ev->data1)) { static char buf[ST_MSGWIDTH]; sprintf(buf, "ang=0x%x;x,y=(0x%x,0x%x)", players[consoleplayer].mo->angle, players[consoleplayer].mo->x, players[consoleplayer].mo->y); plyr->message = buf; } } // 'clev' change-level cheat if (cht_CheckCheat(&cheat_clev, ev->data1)) { char buf[3]; int epsd; int map; cht_GetParam(&cheat_clev, buf); if (gamemode == commercial) { epsd = 0; map = (buf[0] - '0')*10 + buf[1] - '0'; } else { epsd = buf[0] - '0'; map = buf[1] - '0'; } // Catch invalid maps. if (epsd < 1) return false; if (map < 1) return false; // Ohmygod - this is not going to work. if ((gamemode == retail) && ((epsd > 4) || (map > 9))) return false; if ((gamemode == registered) && ((epsd > 3) || (map > 9))) return false; if ((gamemode == shareware) && ((epsd > 1) || (map > 9))) return false; if ((gamemode == commercial) && (( epsd > 1) || (map > 34))) return false; // So be it. plyr->message = STSTR_CLEV; G_DeferedInitNew(gameskill, epsd, map); } } return false; }
// Respond to keyboard input events, // intercept cheats. boolean ST_Responder(event_t *ev) { int i; // Filter automap on/off. if(ev->type == ev_keyup && ((ev->data1 & 0xffff0000) == AM_MSGHEADER)) { switch (ev->data1) { case AM_MSGENTERED: st_gamestate = AutomapState; st_firsttime = true; break; case AM_MSGEXITED: st_gamestate = FirstPersonState; break; } } // if a user keypress... else if(ev->type == ev_keydown) { if(!IS_NETGAME) { // b. - enabled for more debug fun. // if (gameskill != sk_nightmare) { // 'dqd' cheat for toggleable god mode if(cht_CheckCheat(&cheat_god, ev->data1)) { cht_GodFunc(plyr); } // 'fa' cheat for killer f*****g arsenal else if(cht_CheckCheat(&cheat_ammonokey, ev->data1)) { cht_GiveFunc(plyr, true, true, true, false); P_SetMessage(plyr, STSTR_FAADDED); } // 'kfa' cheat for key full ammo else if(cht_CheckCheat(&cheat_ammo, ev->data1)) { cht_GiveFunc(plyr, true, true, true, true); P_SetMessage(plyr, STSTR_KFAADDED); } // 'mus' cheat for changing music else if(cht_CheckCheat(&cheat_mus, ev->data1)) { char buf[3]; P_SetMessage(plyr, STSTR_MUS); cht_GetParam(&cheat_mus, buf); cht_MusicFunc(plyr, buf); // Might set plyr->message. } // Simplified, accepting both "noclip" and "idspispopd". // no clipping mode cheat else if(cht_CheckCheat(&cheat_noclip, ev->data1) || cht_CheckCheat(&cheat_commercial_noclip, ev->data1)) { cht_NoClipFunc(plyr); } // 'behold?' power-up cheats for(i = 0; i < 6; i++) { if(cht_CheckCheat(&cheat_powerup[i], ev->data1)) { cht_PowerUpFunc(plyr, i); P_SetMessage(plyr, STSTR_BEHOLDX); } } // 'behold' power-up menu if(cht_CheckCheat(&cheat_powerup[6], ev->data1)) { P_SetMessage(plyr, STSTR_BEHOLD); } // 'choppers' invulnerability & chainsaw else if(cht_CheckCheat(&cheat_choppers, ev->data1)) { cht_ChoppersFunc(plyr); P_SetMessage(plyr, STSTR_CHOPPERS); } // 'mypos' for player position else if(cht_CheckCheat(&cheat_mypos, ev->data1)) { cht_PosFunc(plyr); } } // 'clev' change-level cheat if(cht_CheckCheat(&cheat_clev, ev->data1)) { char buf[3]; cht_GetParam(&cheat_clev, buf); cht_WarpFunc(plyr, buf); } } return false; }
// Respond to keyboard input events, intercept cheats. // [RH] Cheats eatkey the last keypress used to trigger them bool ST_Responder (event_t *ev) { player_t *plyr = &consoleplayer(); bool eatkey = false; int i; // Filter automap on/off. if (ev->type == ev_keyup && ((ev->data1 & 0xffff0000) == AM_MSGHEADER)) { switch(ev->data1) { case AM_MSGENTERED: st_gamestate = AutomapState; st_firsttime = true; break; case AM_MSGEXITED: st_gamestate = FirstPersonState; break; } } // if a user keypress... else if (ev->type == ev_keydown) { // 'dqd' cheat for toggleable god mode if (cht_CheckCheat(&cheat_god, (char)ev->data2)) { if (CheckCheatmode ()) return false; // [Russell] - give full health plyr->mo->health = deh.StartHealth; plyr->health = deh.StartHealth; AddCommandString("god"); // Net_WriteByte (DEM_GENERICCHEAT); // Net_WriteByte (CHT_IDDQD); eatkey = true; } // 'fa' cheat for killer f*****g arsenal else if (cht_CheckCheat(&cheat_ammonokey, (char)ev->data2)) { if (CheckCheatmode ()) return false; Printf(PRINT_HIGH, "Ammo (No keys) Added\n"); plyr->armorpoints = deh.FAArmor; plyr->armortype = deh.FAAC; weapontype_t pendweap = plyr->pendingweapon; for (i = 0; i<NUMWEAPONS; i++) P_GiveWeapon (plyr, (weapontype_t)i, false); plyr->pendingweapon = pendweap; for (i=0; i<NUMAMMO; i++) plyr->ammo[i] = plyr->maxammo[i]; MSG_WriteMarker(&net_buffer, clc_cheatpulse); MSG_WriteByte(&net_buffer, 1); eatkey = true; } // 'kfa' cheat for key full ammo else if (cht_CheckCheat(&cheat_ammo, (char)ev->data2)) { if (CheckCheatmode ()) return false; Printf(PRINT_HIGH, "Very Happy Ammo Added\n"); plyr->armorpoints = deh.KFAArmor; plyr->armortype = deh.KFAAC; weapontype_t pendweap = plyr->pendingweapon; for (i = 0; i<NUMWEAPONS; i++) P_GiveWeapon (plyr, (weapontype_t)i, false); plyr->pendingweapon = pendweap; for (i=0; i<NUMAMMO; i++) plyr->ammo[i] = plyr->maxammo[i]; for (i=0; i<NUMCARDS; i++) plyr->cards[i] = true; MSG_WriteMarker(&net_buffer, clc_cheatpulse); MSG_WriteByte(&net_buffer, 2); eatkey = true; } // [Russell] - Only doom 1/registered can have idspispopd and // doom 2/final can have idclip else if (cht_CheckCheat(&cheat_noclip, (char)ev->data2)) { if (CheckCheatmode ()) return false; if ((gamemode != shareware) && (gamemode != registered) && (gamemode != retail)) return false; AddCommandString("noclip"); // Net_WriteByte (DEM_GENERICCHEAT); // Net_WriteByte (CHT_NOCLIP); eatkey = true; } else if (cht_CheckCheat(&cheat_commercial_noclip, (char)ev->data2)) { if (CheckCheatmode ()) return false; if (gamemode != commercial) return false; AddCommandString("noclip"); // Net_WriteByte (DEM_GENERICCHEAT); // Net_WriteByte (CHT_NOCLIP); eatkey = true; } // 'behold?' power-up cheats for (i=0; i<6; i++) { if (cht_CheckCheat(&cheat_powerup[i], (char)ev->data2)) { if (CheckCheatmode ()) return false; Printf(PRINT_HIGH, "Power-up toggled\n"); if (!plyr->powers[i]) P_GivePower( plyr, i); else if (i!=pw_strength) plyr->powers[i] = 1; else plyr->powers[i] = 0; MSG_WriteMarker(&net_buffer, clc_cheatpulse); MSG_WriteByte(&net_buffer, 3); MSG_WriteByte(&net_buffer, (byte)i); eatkey = true; } } // 'behold' power-up menu if (cht_CheckCheat(&cheat_powerup[6], (char)ev->data2)) { if (CheckCheatmode ()) return false; Printf (PRINT_HIGH, "%s\n", STSTR_BEHOLD); } // 'choppers' invulnerability & chainsaw else if (cht_CheckCheat(&cheat_choppers, (char)ev->data2)) { if (CheckCheatmode ()) return false; Printf(PRINT_HIGH, "... Doesn't suck - GM\n"); plyr->weaponowned[wp_chainsaw] = true; MSG_WriteMarker(&net_buffer, clc_cheatpulse); MSG_WriteByte(&net_buffer, 4); eatkey = true; } // 'clev' change-level cheat else if (cht_CheckCheat(&cheat_clev, (char)ev->data2)) { if (CheckCheatmode ()) return false; char buf[16]; //char *bb; cht_GetParam(&cheat_clev, buf); buf[2] = 0; // [ML] Chex mode: always set the episode number to 1. // FIXME: This is probably a horrible hack, it sure looks like one at least if (gamemode == retail_chex) sprintf(buf,"1%c",buf[1]); sprintf (buf + 3, "map %s\n", buf); AddCommandString (buf + 3); eatkey = true; } // 'mypos' for player position else if (cht_CheckCheat(&cheat_mypos, (char)ev->data2)) { AddCommandString ("toggle idmypos"); eatkey = true; } // 'idmus' change-music cheat else if (cht_CheckCheat(&cheat_mus, (char)ev->data2)) { char buf[16]; cht_GetParam(&cheat_mus, buf); buf[2] = 0; sprintf (buf + 3, "idmus %s\n", buf); AddCommandString (buf + 3); eatkey = true; } } return eatkey; }
boolean cht_Responder(event_t *ev) { static player_t *plyr; if (ev->type == ev_keydown && 0x00 <= ev->data1 && ev->data1 <= 0xFF) // SRB2CBTODO: && 0x00 <= ev->data1 && ev->data1 <= 0xFF? { plyr = &players[consoleplayer]; // devmode cheat if (cht_CheckCheat(&cheat_bulmer, (char)ev->data1)) { sfxenum_t sfxid; const char *emoticon; byte mrandom; /* Shows a picture of David Bulmer with one the following messages: "*B^C", "*B^D", "*B^I", "*B^J", "*B^L", "*B^O", "*B^P", "*B^S", "*B^X" Accompany each emoticon with sound clip. */ M_StartControlPanel(); M_SetupNextMenu(&ReadDef2); mrandom = M_Random(); if (mrandom < 64) { emoticon = "*B^O"; sfxid = sfx_beeoh; } else if (mrandom < 128) { emoticon = "*B^L"; sfxid = sfx_beeel; } else if (mrandom < 192) { emoticon = "*B^J"; sfxid = sfx_beejay; } else { emoticon = "*B^D"; sfxid = sfx_beedee; } HU_DoCEcho(emoticon); COM_BufExecute(); S_StartSound(0, sfxid); } else if (cht_CheckCheat(&cheat_poksoc, (char)ev->data1)) { sfxenum_t sfxid; byte mrandom = M_Random(); /* Plays one of these sounds: "You cheating, lying GIT!" "Hey... are you my Grandma?" "PIIIKKAAA!" "You little bugger!" "Oxy-pad, Oxy-pad, Oxy-pad, Ox--eeaygggh!" "(Eggman's Japanese) That's not fair, now two of your players have to die!" */ if (mrandom < 48) sfxid = sfx_poksoc1; else if (mrandom < 96) sfxid = sfx_poksoc2; else if (mrandom < 144) sfxid = sfx_poksoc3; else if (mrandom < 192) sfxid = sfx_poksoc4; else if (mrandom < 240) sfxid = sfx_poksoc5; else sfxid = sfx_poksoc6; S_StartSound(0, sfxid); } else if (cht_CheckCheat(&cheat_apl, (char)ev->data1)) { sfxenum_t sfxid; byte mrandom = M_Random(); /* Plays one of these sounds: "You do realize those are prohibited on planes, right?" "IT'S A HUNKY DUNKY SUPER SIZE BIG FAT REALLY REALLY BIG BOMB!" "Let's order a pizza!" "Tails, you made the engines quit! "Buggery! What happened out here?!" "Oh no! A GigaDoomBot!" */ if (mrandom < 48) sfxid = sfx_apl1; else if (mrandom < 96) sfxid = sfx_apl2; else if (mrandom < 144) sfxid = sfx_apl3; else if (mrandom < 192) sfxid = sfx_apl4; else if (mrandom < 240) sfxid = sfx_apl5; else sfxid = sfx_apl6; S_StartSound(0, sfxid); } else if (cht_CheckCheat(&cheat_ultimate, (char)ev->data1)) // SRB2CBTODO: USE THIS FOR OTHER COOL STUFF! { // Plays the ring sound effect, then begins a single player game at ultimate difficulty. S_StartSound(0, sfx_itemup); ultmode = true; startmap = spstage_start; M_SetupNextMenu(&PlayerDef); } } return false; }
// Respond to keyboard input events, // intercept cheats. boolean ST_Responder (event_t* ev) { int i; // Filter automap on/off. if (ev->type == ev_keyup && ((ev->data1 & 0xffff0000) == AM_MSGHEADER)) { switch(ev->data1) { case AM_MSGENTERED: st_gamestate = AutomapState; st_firsttime = true; break; case AM_MSGEXITED: // fprintf(stderr, "AM exited\n"); st_gamestate = FirstPersonState; break; } } // if a user keypress... else if (ev->type == ev_keydown) { if (!netgame && gameskill != sk_nightmare) { // 'dqd' cheat for toggleable god mode if (cht_CheckCheat(&cheat_god, ev->data2)) { plyr->cheats ^= CF_GODMODE; if (plyr->cheats & CF_GODMODE) { if (plyr->mo) plyr->mo->health = 100; plyr->health = deh_god_mode_health; plyr->message = DEH_String(STSTR_DQDON); } else plyr->message = DEH_String(STSTR_DQDOFF); } // 'fa' cheat for killer f*****g arsenal else if (cht_CheckCheat(&cheat_ammonokey, ev->data2)) { plyr->armorpoints = deh_idfa_armor; plyr->armortype = deh_idfa_armor_class; for (i=0;i<NUMWEAPONS;i++) plyr->weaponowned[i] = true; for (i=0;i<NUMAMMO;i++) plyr->ammo[i] = plyr->maxammo[i]; plyr->message = DEH_String(STSTR_FAADDED); } // 'kfa' cheat for key full ammo else if (cht_CheckCheat(&cheat_ammo, ev->data2)) { plyr->armorpoints = deh_idkfa_armor; plyr->armortype = deh_idkfa_armor_class; for (i=0;i<NUMWEAPONS;i++) plyr->weaponowned[i] = true; for (i=0;i<NUMAMMO;i++) plyr->ammo[i] = plyr->maxammo[i]; for (i=0;i<NUMCARDS;i++) plyr->cards[i] = true; plyr->message = DEH_String(STSTR_KFAADDED); } // 'mus' cheat for changing music else if (cht_CheckCheat(&cheat_mus, ev->data2)) { char buf[3]; int musnum; plyr->message = DEH_String(STSTR_MUS); cht_GetParam(&cheat_mus, buf); // Note: The original v1.9 had a bug that tried to play back // the Doom II music regardless of gamemode. This was fixed // in the Ultimate Doom executable so that it would work for // the Doom 1 music as well. if (gamemode == commercial || gameversion < exe_ultimate) { musnum = mus_runnin + (buf[0]-'0')*10 + buf[1]-'0' - 1; if (((buf[0]-'0')*10 + buf[1]-'0') > 35 && gameversion >= exe_doom_1_8) plyr->message = DEH_String(STSTR_NOMUS); else S_ChangeMusic(musnum, 1); } else { musnum = mus_e1m1 + (buf[0]-'1')*9 + (buf[1]-'1'); if (((buf[0]-'1')*9 + buf[1]-'1') > 31) plyr->message = DEH_String(STSTR_NOMUS); else S_ChangeMusic(musnum, 1); } } else if ( (logical_gamemission == doom && cht_CheckCheat(&cheat_noclip, ev->data2)) || (logical_gamemission != doom && cht_CheckCheat(&cheat_commercial_noclip,ev->data2))) { // Noclip cheat. // For Doom 1, use the idspipsopd cheat; for all others, use // idclip plyr->cheats ^= CF_NOCLIP; if (plyr->cheats & CF_NOCLIP) plyr->message = DEH_String(STSTR_NCON); else plyr->message = DEH_String(STSTR_NCOFF); } // 'behold?' power-up cheats for (i=0;i<6;i++) { if (cht_CheckCheat(&cheat_powerup[i], ev->data2)) { if (!plyr->powers[i]) P_GivePower( plyr, i); else if (i!=pw_strength) plyr->powers[i] = 1; else plyr->powers[i] = 0; plyr->message = DEH_String(STSTR_BEHOLDX); } } // 'behold' power-up menu if (cht_CheckCheat(&cheat_powerup[6], ev->data2)) { plyr->message = DEH_String(STSTR_BEHOLD); } // 'choppers' invulnerability & chainsaw else if (cht_CheckCheat(&cheat_choppers, ev->data2)) { plyr->weaponowned[wp_chainsaw] = true; plyr->powers[pw_invulnerability] = true; plyr->message = DEH_String(STSTR_CHOPPERS); } // 'mypos' for player position else if (cht_CheckCheat(&cheat_mypos, ev->data2)) { static char buf[ST_MSGWIDTH]; M_snprintf(buf, sizeof(buf), "ang=0x%x;x,y=(0x%x,0x%x)", players[consoleplayer].mo->angle, players[consoleplayer].mo->x, players[consoleplayer].mo->y); plyr->message = buf; } } // 'clev' change-level cheat if (!netgame && cht_CheckCheat(&cheat_clev, ev->data2)) { char buf[3]; int epsd; int map; cht_GetParam(&cheat_clev, buf); if (gamemode == commercial) { epsd = 1; map = (buf[0] - '0')*10 + buf[1] - '0'; } else { epsd = buf[0] - '0'; map = buf[1] - '0'; } // Chex.exe always warps to episode 1. if (gameversion == exe_chex) { epsd = 1; } // Catch invalid maps. if (epsd < 1) return false; if (map < 1) return false; // Ohmygod - this is not going to work. if ((gamemode == retail) && ((epsd > 4) || (map > 9))) return false; if ((gamemode == registered) && ((epsd > 3) || (map > 9))) return false; if ((gamemode == shareware) && ((epsd > 1) || (map > 9))) return false; // The source release has this check as map > 34. However, Vanilla // Doom allows IDCLEV up to MAP40 even though it normally crashes. if ((gamemode == commercial) && (( epsd > 1) || (map > 40))) return false; // So be it. plyr->message = DEH_String(STSTR_CLEV); G_DeferedInitNew(gameskill, epsd, map); } } return false; }
// Respond to keyboard input events, // intercept cheats. boolean ST_Responder (event_t* ev) { int i; // Filter automap on/off. if (ev->type == ev_keyup && ((ev->data1 & 0xffff0000) == AM_MSGHEADER)) { switch(ev->data1) { case AM_MSGENTERED: st_gamestate = AutomapState; st_firsttime = true; break; case AM_MSGEXITED: // fprintf(stderr, "AM exited\n"); st_gamestate = FirstPersonState; break; } } // if a user keypress... else if (ev->type == ev_keydown) { if (!netgame && gameskill != sk_nightmare) { // 'dqd' cheat for toggleable god mode if (cht_CheckCheat(&cheat_god, ev->data2)) { plyr->cheats ^= CF_GODMODE; if (plyr->cheats & CF_GODMODE) { if (plyr->mo) plyr->mo->health = 100; plyr->health = deh_god_mode_health; plyr->message = DEH_String(STSTR_DQDON); } else plyr->message = DEH_String(STSTR_DQDOFF); } // 'fa' cheat for killer f*****g arsenal else if (cht_CheckCheat(&cheat_ammonokey, ev->data2)) { plyr->armorpoints = deh_idfa_armor; plyr->armortype = deh_idfa_armor_class; // [crispy] give backpack if (!plyr->backpack) { for (i=0 ; i<NUMAMMO ; i++) plyr->maxammo[i] *= 2; plyr->backpack = true; } for (i=0;i<NUMWEAPONS;i++) plyr->weaponowned[i] = true; for (i=0;i<NUMAMMO;i++) plyr->ammo[i] = plyr->maxammo[i]; plyr->message = DEH_String(STSTR_FAADDED); } // 'kfa' cheat for key full ammo else if (cht_CheckCheat(&cheat_ammo, ev->data2)) { plyr->armorpoints = deh_idkfa_armor; plyr->armortype = deh_idkfa_armor_class; // [crispy] give backpack if (!plyr->backpack) { for (i=0 ; i<NUMAMMO ; i++) plyr->maxammo[i] *= 2; plyr->backpack = true; } for (i=0;i<NUMWEAPONS;i++) plyr->weaponowned[i] = true; for (i=0;i<NUMAMMO;i++) plyr->ammo[i] = plyr->maxammo[i]; for (i=0;i<NUMCARDS;i++) plyr->cards[i] = true; plyr->message = DEH_String(STSTR_KFAADDED); } // [crispy] implement Boom's "tntem" cheat else if (cht_CheckCheat(&cheat_massacre, ev->data2)) { static char msg[32]; int killcount = ST_cheat_massacre(); M_snprintf(msg, sizeof(msg), "\x1b%c%d \x1b%cMonster%s Killed", '0' + CR_GOLD, killcount, '0' + CR_RED, (killcount == 1) ? "" : "s"); plyr->message = msg; } // [crispy] implement Crispy Doom's "spechits" cheat else if (cht_CheckCheat(&cheat_spechits, ev->data2)) { static char msg[32]; int triggeredlines = ST_cheat_spechits(); M_snprintf(msg, sizeof(msg), "\x1b%c%d \x1b%cSpecial Line%s Triggered", '0' + CR_GOLD, triggeredlines, '0' + CR_RED, (triggeredlines == 1) ? "" : "s"); plyr->message = msg; } // [crispy] implement Boom's "tnthom" cheat else if (cht_CheckCheat(&cheat_hom, ev->data2)) { static char msg[32]; crispy_flashinghom = !crispy_flashinghom; M_snprintf(msg, sizeof(msg), "HOM Detection \x1b%c%s", '0' + CR_GREEN, (crispy_flashinghom) ? "ON" : "OFF"); plyr->message = msg; } // 'mus' cheat for changing music else if (cht_CheckCheat(&cheat_mus, ev->data2)) { char buf[3]; int musnum; plyr->message = DEH_String(STSTR_MUS); cht_GetParam(&cheat_mus, buf); // Note: The original v1.9 had a bug that tried to play back // the Doom II music regardless of gamemode. This was fixed // in the Ultimate Doom executable so that it would work for // the Doom 1 music as well. if (gamemode == commercial || gameversion < exe_ultimate) { musnum = mus_runnin + (buf[0]-'0')*10 + buf[1]-'0' - 1; // [crispy] prevent crash with IDMUS00 if (((buf[0]-'0')*10 + buf[1]-'0') > 35 || musnum < mus_runnin) plyr->message = DEH_String(STSTR_NOMUS); else S_ChangeMusic(musnum, 1); } else { musnum = mus_e1m1 + (buf[0]-'1')*9 + (buf[1]-'1'); // [crispy] prevent crash with IDMUS0x or IDMUSx0 if (((buf[0]-'1')*9 + buf[1]-'1') > 31 || buf[0] < '1' || buf[1] < '1') plyr->message = DEH_String(STSTR_NOMUS); else S_ChangeMusic(musnum, 1); } } // [crispy] allow both idspispopd and idclip cheats in all gamemissions else if ( ( /* logical_gamemission == doom && */ cht_CheckCheat(&cheat_noclip, ev->data2)) || ( /* logical_gamemission != doom && */ cht_CheckCheat(&cheat_commercial_noclip,ev->data2))) { // Noclip cheat. // For Doom 1, use the idspipsopd cheat; for all others, use // idclip plyr->cheats ^= CF_NOCLIP; if (plyr->cheats & CF_NOCLIP) plyr->message = DEH_String(STSTR_NCON); else plyr->message = DEH_String(STSTR_NCOFF); } // [crispy] implement PrBoom+'s "notarget" cheat else if (cht_CheckCheat(&cheat_notarget, ev->data2)) { static char msg[32]; plyr->cheats ^= CF_NOTARGET; M_snprintf(msg, sizeof(msg), "Notarget Mode \x1b%c%s", '0' + CR_GREEN, (plyr->cheats & CF_NOTARGET) ? "ON" : "OFF"); plyr->message = msg; } // 'behold?' power-up cheats for (i=0;i<6;i++) { if (cht_CheckCheat(&cheat_powerup[i], ev->data2)) { if (!plyr->powers[i]) P_GivePower( plyr, i); else if (i!=pw_strength) plyr->powers[i] = 1; else plyr->powers[i] = 0; plyr->message = DEH_String(STSTR_BEHOLDX); } } // 'behold' power-up menu if (cht_CheckCheat(&cheat_powerup[6], ev->data2)) { plyr->message = DEH_String(STSTR_BEHOLD); } // [crispy] implement Boom's "tntweap?" weapon cheats else if (cht_CheckCheat(&cheat_weapon, ev->data2)) { char buf[2]; int w; static char msg[32]; cht_GetParam(&cheat_weapon, buf); w = *buf - '1'; if (w < 0 || w >= NUMWEAPONS) return false; if (w == wp_supershotgun && !crispy_havessg) return false; if ((w == wp_bfg || w == wp_plasma) && gamemode == shareware) return false; // make '1' apply beserker strength toggle if (w == wp_fist) { if (!plyr->powers[pw_strength]) P_GivePower(plyr, pw_strength); else plyr->powers[pw_strength] = 0; M_snprintf(msg, sizeof(msg), DEH_String(STSTR_BEHOLDX)); } else { if ((plyr->weaponowned[w] = !plyr->weaponowned[w])) M_snprintf(msg, sizeof(msg), "Weapon \x1b%c%d\x1b%c Added", '0' + CR_GOLD, w + 1, '0' + CR_RED); else { M_snprintf(msg, sizeof(msg), "Weapon \x1b%c%d\x1b%c Removed", '0' + CR_GOLD, w + 1, '0' + CR_RED); // [crispy] removed current weapon, select another one if (w == plyr->readyweapon) { extern boolean P_CheckAmmo (player_t* player); P_CheckAmmo(plyr); } } } plyr->message = msg; } // 'choppers' invulnerability & chainsaw else if (cht_CheckCheat(&cheat_choppers, ev->data2)) { plyr->weaponowned[wp_chainsaw] = true; plyr->powers[pw_invulnerability] = true; plyr->message = DEH_String(STSTR_CHOPPERS); } // 'mypos' for player position else if (cht_CheckCheat(&cheat_mypos, ev->data2)) { // [crispy] show (human readable) map coordinates // in the upper right corner (like automap stats) /* static char buf[ST_MSGWIDTH]; M_snprintf(buf, sizeof(buf), "ang=0x%x;x,y=(0x%x,0x%x)", players[consoleplayer].mo->angle, players[consoleplayer].mo->x, players[consoleplayer].mo->y); plyr->message = buf; */ p2fromp(plyr)->mapcoords ^= 1; } } // 'clev' change-level cheat if (!netgame && cht_CheckCheat(&cheat_clev, ev->data2)) { char buf[3]; int epsd; int map; cht_GetParam(&cheat_clev, buf); if (gamemission == pack_nerve) { epsd = 2; map = (buf[0] - '0')*10 + buf[1] - '0'; } else if (gamemode == commercial) { epsd = 1; map = (buf[0] - '0')*10 + buf[1] - '0'; } else { epsd = buf[0] - '0'; map = buf[1] - '0'; } // Chex.exe always warps to episode 1. if (gameversion == exe_chex) { epsd = 1; } // Catch invalid maps. if (epsd == 0) // [crispy] allow IDCLEV0x to work in Doom 1 epsd = gameepisode; else if (epsd < 1) return false; if ((map == 0) && (buf[0] - '0' == 0)) // [crispy] IDCLEV00 restarts current map map = gamemap; else if (map < 1) return false; // Ohmygod - this is not going to work. if ((gamemode == retail) && ((epsd > 4) || (map > 9))) return false; if ((gamemode == registered) && ((epsd > 3) || (map > 9))) return false; if ((gamemode == shareware) && ((epsd > 1) || (map > 9))) return false; // The source release has this check as map > 34. However, Vanilla // Doom allows IDCLEV up to MAP40 even though it normally crashes. if ((gamemode == commercial && gamemission != pack_nerve) && (( epsd > 1) || (map > 40))) return false; if ((gamemission == pack_nerve) && (( epsd > 2) || (map > 9))) return false; // So be it. plyr->message = DEH_String(STSTR_CLEV); G_DeferedInitNew(gameskill, epsd, map); // [crispy] eat key press, i.e. don't change weapon upon level change return true; } } return false; }
// Respond to keyboard input events, // intercept cheats. boolean ST_Responder(event_t* ev) { // haleyjd 09/27/10: made static to ST_Responder static boolean st_keystate = false; int i; // Filter automap on/off. if(ev->type == ev_keyup) { if((ev->data1 & 0xffff0000) == AM_MSGHEADER) { switch(ev->data1) { case AM_MSGENTERED: st_gamestate = AutomapState; st_firsttime = true; break; case AM_MSGEXITED: st_gamestate = FirstPersonState; break; } return false; } // villsa [STRIFE] if(ev->data1 != key_invpop && ev->data1 != key_mission && ev->data1 != key_invkey) return false; // villsa [STRIFE] if(ev->data1 == key_invpop) st_showinvpop = false; else { if(ev->data1 == key_mission) st_showobjective = false; else { if(ev->data1 == key_invkey) { st_showkeys = false; st_keystate = false; } } } if(!st_showkeys && !st_showobjective && !st_showinvpop) { if(!st_popupdisplaytics) { st_displaypopup = false; if(st_dosizedisplay) M_SizeDisplay(true); st_dosizedisplay = false; } } return true; } // if a user keypress... if(ev->type != ev_keydown) return false; // haleyjd 20100927: No input allowed when the player is dead if(plyr->mo->health <= 0) return false; // keydown events if(ev->data1 == key_invquery) // inventory query { inventory_t *inv = &(plyr->inventory[plyr->inventorycursor]); if(inv->amount) { DEH_snprintf(st_msgbuf, sizeof(st_msgbuf), "%d %s", inv->amount, DEH_String(mobjinfo[inv->type].name)); plyr->message = st_msgbuf; } } // villsa [STRIFE] if(ev->data1 == key_invpop || ev->data1 == key_invkey || ev->data1 == key_mission) { if(ev->data1 == key_invkey) { st_showobjective = false; st_showinvpop = false; if(!st_keystate) { st_keystate = true; if(++st_keypage > 2) { st_popupdisplaytics = 0; st_showkeys = false; st_displaypopup = false; st_keypage = -1; return true; } } if(netgame) st_popupdisplaytics = 20; else st_popupdisplaytics = 50; st_showkeys = true; } else { if(ev->data1 != key_mission || netgame) { if(ev->data1 == key_invpop) { st_keypage = -1; st_popupdisplaytics = false; st_showkeys = false; st_showobjective = false; st_showinvpop = true; } } else { st_showkeys = netgame; st_showinvpop = netgame; st_keypage = -1; st_popupdisplaytics = ev->data2 ^ key_mission; st_showobjective = true; } } if(st_showkeys || st_showobjective || st_showinvpop) { st_displaypopup = true; if(viewheight == SCREENHEIGHT) { M_SizeDisplay(false); st_dosizedisplay = true; } } } if(ev->data1 == key_invleft) // inventory move left { if(plyr->inventorycursor > 0) plyr->inventorycursor--; return true; } else if(ev->data1 == key_invright) { if(plyr->inventorycursor < plyr->numinventory - 1) plyr->inventorycursor++; return true; } else if(ev->data1 == key_invhome) { plyr->inventorycursor = 0; return true; } else if(ev->data1 == key_invend) { if(plyr->numinventory) plyr->inventorycursor = plyr->numinventory - 1; else plyr->inventorycursor = 0; return true; } // // [STRIFE] Cheats which are allowed in netgames/demos: // // 'spin' cheat for changing music if (cht_CheckCheat(&cheat_mus, ev->data2)) { char buf[3]; int musnum; plyr->message = DEH_String(STSTR_MUS); cht_GetParam(&cheat_mus, buf); musnum = (buf[0] - '0') * 10 + buf[1] - '0'; if (((buf[0]-'0')*10 + buf[1]-'0') > 35) plyr->message = DEH_String(STSTR_NOMUS); else S_ChangeMusic(musnum, 1); } // [STRIFE]: "dev" cheat - "DOTS" else if (cht_CheckCheat(&cheat_dev, ev->data2)) { devparm = !devparm; if (devparm) plyr->message = DEH_String("devparm ON"); else plyr->message = DEH_String("devparm OFF"); } // [STRIFE] Cheats below are not allowed in netgames or demos if(netgame || !usergame) return false; if (cht_CheckCheat(&cheat_god, ev->data2)) { // 'omnipotent' cheat for toggleable god mode plyr->cheats ^= CF_GODMODE; if (plyr->cheats & CF_GODMODE) { if (plyr->mo) plyr->mo->health = 100; plyr->health = deh_god_mode_health; plyr->st_update = true; // [STRIFE] plyr->message = DEH_String(STSTR_DQDON); } else { plyr->st_update = true; plyr->message = DEH_String(STSTR_DQDOFF); } } else if (cht_CheckCheat(&cheat_ammo, ev->data2)) { // [STRIFE]: "BOOMSTIX" cheat for all normal weapons plyr->armorpoints = deh_idkfa_armor; plyr->armortype = deh_idkfa_armor_class; for (i = 0; i < NUMWEAPONS; i++) if(!isdemoversion || weaponinfo[i].availabledemo) plyr->weaponowned[i] = true; // Takes away the Sigil, even if you already had it... plyr->weaponowned[wp_sigil] = false; for (i=0;i<NUMAMMO;i++) plyr->ammo[i] = plyr->maxammo[i]; plyr->message = DEH_String(STSTR_FAADDED); } else if(cht_CheckCheat(&cheat_keys, ev->data2)) { // villsa [STRIFE]: "JIMMY" cheat for all keys #define FIRSTKEYSETAMOUNT 16 if(plyr->cards[FIRSTKEYSETAMOUNT - 1]) { if(plyr->cards[NUMCARDS - 1] || isdemoversion) { for(i = 0; i < NUMCARDS; i++) plyr->cards[i] = false; plyr->message = DEH_String("Keys removed"); } else { for(i = 0; i < NUMCARDS; i++) plyr->cards[i] = true; plyr->message = DEH_String("Cheater Keys Added"); } } else { for(i = 0; i < FIRSTKEYSETAMOUNT; i++) plyr->cards[i] = true; plyr->message = DEH_String("Cheater Keys Added"); } } else if (cht_CheckCheat(&cheat_noclip, ev->data2)) { // [STRIFE] Removed idspispopd, added NOCLIP flag setting/removal // Noclip cheat - "ELVIS" (hah-hah :P ) plyr->cheats ^= CF_NOCLIP; if (plyr->cheats & CF_NOCLIP) { plyr->message = DEH_String(STSTR_NCON); plyr->mo->flags |= MF_NOCLIP; } else { plyr->message = DEH_String(STSTR_NCOFF); plyr->mo->flags &= ~MF_NOCLIP; } } else if(cht_CheckCheat(&cheat_stealth, ev->data2)) { // villsa [STRIFE]: "GRIPPER" cheat; nothing to do with stealth... plyr->cheats ^= CF_NOMOMENTUM; if(plyr->cheats & CF_NOMOMENTUM) plyr->message = DEH_String("STEALTH BOOTS ON"); else plyr->message = DEH_String("STEALTH BOOTS OFF"); } for(i = 0; i < ST_PUMPUP_B + 3; ++i) { // [STRIFE]: Handle berserk, invisibility, and envirosuit if(cht_CheckCheat(&cheat_powerup[i], ev->data2)) { if(plyr->powers[i]) plyr->powers[i] = (i != 1); else P_GivePower(plyr, i); plyr->message = DEH_String(STSTR_BEHOLDX); } } if(cht_CheckCheat(&cheat_powerup[ST_PUMPUP_H], ev->data2)) { // [STRIFE]: PUMPUPH gives medical inventory items P_GiveItemToPlayer(plyr, SPR_STMP, MT_INV_MED1); P_GiveItemToPlayer(plyr, SPR_MDKT, MT_INV_MED2); P_GiveItemToPlayer(plyr, SPR_FULL, MT_INV_MED3); plyr->message = DEH_String("you got the stuff!"); } if(cht_CheckCheat(&cheat_powerup[ST_PUMPUP_P], ev->data2)) { // [STRIFE]: PUMPUPP gives backpack if(!plyr->backpack) { for(i = 0; i < NUMAMMO; ++i) plyr->maxammo[i] = 2 * plyr->maxammo[i]; } plyr->backpack = true; for(i = 0; i < NUMAMMO; ++i) P_GiveAmmo(plyr, i, 1); plyr->message = DEH_String("you got the stuff!"); } if(cht_CheckCheat(&cheat_powerup[ST_PUMPUP_S], ev->data2)) { // [STRIFE]: PUMPUPS gives stamina and accuracy upgrades P_GiveItemToPlayer(plyr, SPR_TOKN, MT_TOKEN_STAMINA); P_GiveItemToPlayer(plyr, SPR_TOKN, MT_TOKEN_NEW_ACCURACY); plyr->message = DEH_String("you got the stuff!"); } if(cht_CheckCheat(&cheat_powerup[ST_PUMPUP_T], ev->data2)) { // [STRIFE] PUMPUPT gives targeter P_GivePower(plyr, pw_targeter); plyr->message = DEH_String("you got the stuff!"); } // [STRIFE]: PUMPUP if (cht_CheckCheat(&cheat_powerup[ST_PUMPUP], ev->data2)) { // 'behold' power-up menu plyr->message = DEH_String(STSTR_BEHOLD); return false; } if (cht_CheckCheat(&cheat_mypos, ev->data2)) { // [STRIFE] 'GPS' for player position static char buf[ST_MSGWIDTH]; M_snprintf(buf, sizeof(buf), "ang=0x%x;x,y=(0x%x,0x%x)", players[consoleplayer].mo->angle, players[consoleplayer].mo->x, players[consoleplayer].mo->y); plyr->message = buf; } // 'rift' change-level cheat if (cht_CheckCheat(&cheat_clev, ev->data2)) { char buf[3]; int map; cht_GetParam(&cheat_clev, buf); map = (buf[0] - '0') * 10 + buf[1] - '0'; // haleyjd 20100901: Removed Chex Quest stuff. // haleyjd 20100915: Removed retail/registered/shareware stuff // haleyjd 20130301: different bounds in v1.31 // Ohmygod - this is not going to work. if(gameversion == exe_strife_1_31) { if ((isdemoversion && (map < 32 || map > 34)) || (isregistered && (map <= 0 || map > 34))) return false; } else { if (map <= 0 || map > 40) return false; } // So be it. plyr->message = DEH_String(STSTR_CLEV); G_RiftExitLevel(map, 0, plyr->mo->angle); } else if(cht_CheckCheat(&cheat_scoot, ev->data2)) { char buf[3]; int spot; cht_GetParam(&cheat_scoot, buf); spot = buf[0] - '0'; // BUG: should be <= 9. Shouldn't do anything bad though... if(spot <= 10) { plyr->message = DEH_String("Spawning to spot"); G_RiftCheat(spot); return false; } } // villsa [STRIFE] if(cht_CheckCheat(&cheat_nuke, ev->data2)) { stonecold ^= 1; plyr->message = DEH_String("Kill 'em. Kill 'em All"); return false; } // villsa [STRIFE] if(cht_CheckCheat(&cheat_midas, ev->data2)) { plyr->message = DEH_String("YOU GOT THE MIDAS TOUCH, BABY"); P_GiveItemToPlayer(plyr, SPR_HELT, MT_TOKEN_TOUGHNESS); } // villsa [STRIFE] // haleyjd 20110224: No sigil in demo version if(!isdemoversion && cht_CheckCheat(&cheat_lego, ev->data2)) { plyr->st_update = true; if(plyr->weaponowned[wp_sigil]) { if(++plyr->sigiltype > 4) { plyr->sigiltype = -1; plyr->pendingweapon = wp_fist; plyr->weaponowned[wp_sigil] = false; } } else { plyr->weaponowned[wp_sigil] = true; plyr->sigiltype = 0; } // BUG: This brings up a bad version of the Sigil (sigiltype -1) which // causes some VERY interesting behavior, when you type LEGO for the // sixth time. This shouldn't be done when taking it away, and yet it // is here... verified with vanilla. plyr->pendingweapon = wp_sigil; } return false; }