static void SummonActor (int command, int command2, FCommandLine argv) { if (CheckCheatmode ()) return; if (argv.argc() > 1) { PClassActor *type = PClass::FindActor(argv[1]); if (type == NULL) { Printf ("Unknown actor '%s'\n", argv[1]); return; } Net_WriteByte (argv.argc() > 2 ? command2 : command); Net_WriteString (type->TypeName.GetChars()); if (argv.argc () > 2) { Net_WriteWord (atoi (argv[2])); // angle Net_WriteWord ((argv.argc() > 3) ? atoi(argv[3]) : 0); // TID Net_WriteByte ((argv.argc() > 4) ? atoi(argv[4]) : 0); // special for (int i = 5; i < 10; i++) { // args[5] Net_WriteLong((i < argv.argc()) ? atoi(argv[i]) : 0); } } } }
static bool CheatCheckList (event_t *ev, cheatseq_t *cheats, int numcheats) { bool eat = false; if (ev->type == EV_KeyDown) { int i; for (i = 0; i < numcheats; i++, cheats++) { if (CheatAddKey (cheats, (BYTE)ev->data2, &eat)) { if (cheats->DontCheck || !CheckCheatmode ()) { eat |= cheats->Handler (cheats); } } else if (cheats->Pos - cheats->Sequence > 2) { // If more than two characters into the sequence, // eat the keypress, just so that the Hexen cheats // with T in them will work without unbinding T. eat = true; } } } return eat; }
static void SummonActor (int command, int command2, FCommandLine argv) { if (CheckCheatmode ()) return; if (argv.argc() > 1) { const PClass *type = PClass::FindClass (argv[1]); if (type == NULL) { Printf ("Unknown class '%s'\n", argv[1]); return; } Net_WriteByte (argv.argc() > 2 ? command2 : command); Net_WriteString (type->TypeName.GetChars()); if (argv.argc () > 2) { Net_WriteWord (atoi (argv[2])); // angle if (argv.argc () > 3) Net_WriteWord (atoi (argv[3])); // TID else Net_WriteWord (0); if (argv.argc () > 4) Net_WriteByte (atoi (argv[4])); // special else Net_WriteByte (0); for(int i = 5; i < 10; i++) { // args[5] if(i < argv.argc()) Net_WriteLong (atoi (argv[i])); else Net_WriteLong (0); } } } }
// 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; }