// // P_GiveItemToPlayer // // [STRIFE] New function // haleyjd 09/03/10: Sorts out how to give something to the player. // Not strictly just for inventory items. // villsa 09/09/10: Fleshed out function // boolean P_GiveItemToPlayer(player_t *player, int sprnum, mobjtype_t type) { int i = 0; line_t junk; int sound = sfx_itemup; // haleyjd 09/21/10: different sounds for items // set quest if mf_givequest flag is set if(mobjinfo[type].flags & MF_GIVEQUEST) player->questflags |= 1 << (mobjinfo[type].speed - 1); // check for keys if(type >= MT_KEY_BASE && type <= MT_NEWKEY5) { P_GiveCard(player, type - MT_KEY_BASE); return true; } // check for quest tokens if(type >= MT_TOKEN_QUEST1 && type <= MT_TOKEN_QUEST31) { if(mobjinfo[type].name) { M_StringCopy(pickupstring, DEH_String(mobjinfo[type].name), 39); player->message = pickupstring; } player->questflags |= 1 << (type - MT_TOKEN_QUEST1); if(player == &players[consoleplayer]) S_StartSound(NULL, sound); return true; } // haleyjd 09/22/10: Refactored to give sprites higher priority than // mobjtypes and to implement missing logic. switch(sprnum) { case SPR_HELT: // This is given only by the "DONNYTRUMP" cheat (aka Midas) P_GiveInventoryItem(player, SPR_HELT, MT_TOKEN_TOUGHNESS); P_GiveInventoryItem(player, SPR_GUNT, MT_TOKEN_ACCURACY); // [STRIFE] Bizarre... for(i = 0; i < 5 * player->accuracy + 300; i++) P_GiveInventoryItem(player, SPR_COIN, MT_MONY_1); break; case SPR_ARM1: // Armor 1 if(!P_GiveArmor(player, -2)) P_GiveInventoryItem(player, sprnum, type); break; case SPR_ARM2: // Armor 2 if(!P_GiveArmor(player, -1)) P_GiveInventoryItem(player, sprnum, type); break; case SPR_COIN: // 1 Gold P_GiveInventoryItem(player, SPR_COIN, MT_MONY_1); break; case SPR_CRED: // 10 Gold for(i = 0; i < 10; i++) P_GiveInventoryItem(player, SPR_COIN, MT_MONY_1); break; case SPR_SACK: // 25 gold for(i = 0; i < 25; i++) P_GiveInventoryItem(player, SPR_COIN, MT_MONY_1); break; case SPR_CHST: // 50 gold for(i = 0; i < 50; i++) P_GiveInventoryItem(player, SPR_COIN, MT_MONY_1); case SPR_BBOX: // Box of Bullets if(!P_GiveAmmo(player, am_bullets, 5)) return false; break; case SPR_BLIT: // Bullet Clip if(!P_GiveAmmo(player, am_bullets, 1)) return false; break; case SPR_PMAP: // Map powerup if(!P_GivePower(player, pw_allmap)) return false; sound = sfx_yeah; // bluh-doop! break; case SPR_COMM: // Communicator if(!P_GivePower(player, pw_communicator)) return false; sound = sfx_yeah; // bluh-doop! break; case SPR_MSSL: // Mini-missile if(!P_GiveAmmo(player, am_missiles, 1)) return false; break; case SPR_ROKT: // Crate of missiles if(!P_GiveAmmo(player, am_missiles, 5)) return false; break; case SPR_BRY1: // Battery cell if(!P_GiveAmmo(player, am_cell, 1)) return false; break; case SPR_CPAC: // Cell pack if(!P_GiveAmmo(player, am_cell, 5)) return false; break; case SPR_PQRL: // Poison bolts if(!P_GiveAmmo(player, am_poisonbolts, 5)) return false; break; case SPR_XQRL: // Electric bolts if(!P_GiveAmmo(player, am_elecbolts, 5)) return false; break; case SPR_GRN1: // HE Grenades if(!P_GiveAmmo(player, am_hegrenades, 1)) return false; break; case SPR_GRN2: // WP Grenades if(!P_GiveAmmo(player, am_wpgrenades, 1)) return false; break; case SPR_BKPK: // Backpack (aka Ammo Satchel) if(!player->backpack) { for(i = 0; i < NUMAMMO; i++) player->maxammo[i] *= 2; player->backpack = true; } for(i = 0; i < NUMAMMO; i++) P_GiveAmmo(player, i, 1); break; case SPR_RIFL: // Assault Rifle if(player->weaponowned[wp_rifle]) return false; if(!P_GiveWeapon(player, wp_rifle, false)) return false; sound = sfx_wpnup; // SHK-CHK! break; case SPR_FLAM: // Flamethrower if(player->weaponowned[wp_flame]) return false; if(!P_GiveWeapon(player, wp_flame, false)) return false; sound = sfx_wpnup; // SHK-CHK! break; case SPR_MMSL: // Mini-missile Launcher if(player->weaponowned[wp_missile]) return false; if(!P_GiveWeapon(player, wp_missile, false)) return false; sound = sfx_wpnup; // SHK-CHK! break; case SPR_TRPD: // Mauler if(player->weaponowned[wp_mauler]) return false; if(!P_GiveWeapon(player, wp_mauler, false)) return false; sound = sfx_wpnup; // SHK-CHK! break; case SPR_CBOW: // Here's a crossbow. Just aim straight, and *SPLAT!* if(player->weaponowned[wp_elecbow]) return false; if(!P_GiveWeapon(player, wp_elecbow, false)) return false; sound = sfx_wpnup; // SHK-CHK! break; case SPR_TOKN: // Miscellaneous items - These are determined by thingtype. switch(type) { case MT_KEY_HAND: // Severed hand P_GiveCard(player, key_SeveredHand); break; case MT_MONY_300: // 300 Gold (this is the only way to get it, in fact) for(i = 0; i < 300; i++) P_GiveInventoryItem(player, SPR_COIN, MT_MONY_1); break; case MT_TOKEN_AMMO: // Ammo token - you get this from the Weapons Trainer if(player->ammo[am_bullets] >= 50) return false; player->ammo[am_bullets] = 50; break; case MT_TOKEN_HEALTH: // Health token - from the Front's doctor if(!P_GiveBody(player, healthamounts[gameskill])) return false; break; case MT_TOKEN_ALARM: // Alarm token - particularly from the Oracle. P_NoiseAlert(player->mo, player->mo); A_AlertSpectreC(dialogtalker); // BUG: assumes in a dialog o_O break; case MT_TOKEN_DOOR1: // Door special 1 junk.tag = 222; EV_DoDoor(&junk, vld_open); break; case MT_TOKEN_PRISON_PASS: // Door special 1 - Prison pass junk.tag = 223; EV_DoDoor(&junk, vld_open); if(gamemap == 2) // If on Tarnhill, give Prison pass object P_GiveInventoryItem(player, sprnum, type); break; case MT_TOKEN_SHOPCLOSE: // Door special 3 - "Shop close" - unused? junk.tag = 222; EV_DoDoor(&junk, vld_close); break; case MT_TOKEN_DOOR3: // Door special 4 (or 3? :P ) junk.tag = 224; EV_DoDoor(&junk, vld_close); break; case MT_TOKEN_STAMINA: // Stamina upgrade if(player->stamina >= 100) return false; player->stamina += 10; P_GiveBody(player, 200); // full healing break; case MT_TOKEN_NEW_ACCURACY: // Accuracy upgrade if(player->accuracy >= 100) return false; player->accuracy += 10; break; case MT_SLIDESHOW: // Slideshow (start a finale) gameaction = ga_victory; if(gamemap == 10) P_GiveItemToPlayer(player, SPR_TOKN, MT_TOKEN_QUEST17); break; default: // The default is to just give it as an inventory item. P_GiveInventoryItem(player, sprnum, type); break; } break; default: // The ultimate default: Give it as an inventory item. if(!P_GiveInventoryItem(player, sprnum, type)) return false; break; } // Play sound. if(player == &players[consoleplayer]) S_StartSound(NULL, sound); return true; }
// // P_DialogDoChoice // // [STRIFE] New function // haleyjd 09/05/10: Handles making a choice in a dialog. Installed as the // callback for all items in the dialogmenu structure. // void P_DialogDoChoice(int choice) { int i = 0, nextdialog = 0; boolean candochoice = true; char *message = NULL; mapdlgchoice_t *currentchoice; if(choice == -1) choice = dialogmenu.numitems - 1; currentchoice = &(currentdialog->choices[choice]); I_StartVoice(NULL); // STRIFE-TODO: verify (should stop previous voice I believe) // villsa 09/08/10: converted into for loop for(i = 0; i < MDLG_MAXITEMS; i++) { if(P_PlayerHasItem(dialogplayer, currentchoice->needitems[i]) < currentchoice->needamounts[i]) { candochoice = false; // nope, missing something } } if(choice != dialogmenu.numitems - 1 && candochoice) { int item; message = currentchoice->textok; if(dialogtalkerstates->yes) P_SetMobjState(dialogtalker, dialogtalkerstates->yes); item = currentchoice->giveitem; if(item < 0 || P_GiveItemToPlayer(dialogplayer, states[mobjinfo[item].spawnstate].sprite, item)) { // if successful, take needed items int count = 0; // villsa 09/08/10: converted into for loop for(count = 0; count < MDLG_MAXITEMS; count++) { P_TakeDialogItem(dialogplayer, currentchoice->needitems[count], currentchoice->needamounts[count]); } } else message = DEH_String("You seem to have enough!"); // store next dialog into the talking actor nextdialog = currentchoice->next; if(nextdialog != 0) dialogtalker->miscdata = (byte)(abs(nextdialog)); } else { // not successful message = currentchoice->textno; if(dialogtalkerstates->no) P_SetMobjState(dialogtalker, dialogtalkerstates->no); } if(choice != dialogmenu.numitems - 1) { int objective; char *objlump; if((objective = currentchoice->objective)) { DEH_snprintf(mission_objective, OBJECTIVE_LEN, "log%i", objective); objlump = W_CacheLumpName(mission_objective, PU_CACHE); M_StringCopy(mission_objective, objlump, OBJECTIVE_LEN); } // haleyjd 20130301: v1.31 hack: if first char of message is a period, // clear the player's message. Is this actually used anywhere? if(gameversion == exe_strife_1_31 && message[0] == '.') message = NULL; dialogplayer->message = message; } dialogtalker->angle = dialogtalkerangle; dialogplayer->st_update = true; M_ClearMenus(0); if(nextdialog >= 0 || gameaction == ga_victory) // Macil hack menuindialog = false; else P_DialogStart(dialogplayer); }
// // Function that changes wall texture. // Tell it if switch is ok to use again (1=yes, it's a button). // void P_ChangeSwitchTexture(line_t* line, int useAgain) { int texTop; int texMid; int texBot; int i; int sound; boolean breakglass; // villsa [STRIFE] switchlist_t* sl; // villsa [STRIFE] breakglass = false; // villsa [STRIFE] texTop = sides[line->sidenum[0]].toptexture; texMid = sides[line->sidenum[0]].midtexture; texBot = sides[line->sidenum[0]].bottomtexture; sound = sfx_swtchn; // villsa [STRIFE] check for linetype 182 (break glass) if(line->special == 182) { line->flags &= ~ML_BLOCKING; breakglass = true; if(useAgain) { // haleyjd 09/21/10: Corrected (>> 16 == next field) texTop = 0; texBot = 0; } if(texMid) // haleyjd 09/21/10: Corrected (>> 16 == next field) useAgain = 0; sound = sfx_bglass; } if(!useAgain) line->special = 0; for(i = 0; i < numswitches*2; i++) { sl = &alphSwitchList[i / 2]; // villsa [STRIFE] if(switchlist[i] == texTop) { // villsa [STRIFE] set sound if(sl->sound) sound = sl->sound; S_StartSound(buttonlist->soundorg, sound); sides[line->sidenum[0]].toptexture = switchlist[i^1]; if(useAgain) P_StartButton(line,top,switchlist[i],BUTTONTIME); if(breakglass) P_SpawnBrokenGlass(line); return; } else { if(switchlist[i] == texMid) { // villsa [STRIFE] set sound if(sl->sound) sound = sl->sound; S_StartSound(buttonlist->soundorg,sound); sides[line->sidenum[0]].midtexture = switchlist[i^1]; // villsa [STRIFE] affect second side of line // BUG: will crash if 1S line is marked with TWOSIDED flag! if(line->flags & ML_TWOSIDED) sides[line->sidenum[1]].midtexture = switchlist[i^1]; if(useAgain) P_StartButton(line, middle,switchlist[i],BUTTONTIME); // villsa [STRIFE]: Mines Transmitter hack if(sound == sfx_firxpl) { breakglass = true; // give quest flag 29 to player players[0].questflags |= QF_QUEST29; // give stamina/accuracy items if(!netgame) { P_GiveItemToPlayer(players, SPR_TOKN, MT_TOKEN_STAMINA); P_GiveItemToPlayer(players, SPR_TOKN, MT_TOKEN_NEW_ACCURACY); } } // villsa [STRIFE] if(breakglass || sound == sfx_bglass) P_SpawnBrokenGlass(line); return; } else { if(switchlist[i] == texBot) { // villsa [STRIFE] set sound if(sl->sound) sound = sl->sound; S_StartSound(buttonlist->soundorg,sound); sides[line->sidenum[0]].bottomtexture = switchlist[i^1]; if(useAgain) P_StartButton(line, bottom,switchlist[i],BUTTONTIME); if(breakglass) P_SpawnBrokenGlass(line); return; } } } } }
// // P_UseSpecialLine // Called when a thing uses a special line. // Only the front sides of lines are usable. // boolean P_UseSpecialLine(mobj_t* thing, line_t* line, int side) { // Err... // Use the back sides of VERY SPECIAL lines... if (side) { switch(line->special) { case 148: // haleyjd [STRIFE] break; default: return false; } } // Switches that other things can activate. if (!thing->player) { // never open secret doors if (line->flags & ML_SECRET) return false; switch(line->special) { case 1: // MANUAL DOOR RAISE case 31: // haleyjd [STRIFE] case 144: // haleyjd [STRIFE] Manual sliding door break; default: return false; break; } } // do something switch(line->special) { // MANUALS case 1: // Vertical Door case 26: // DR ID Card case 27: // DR Pass Card case 28: // DR ID Badge case 31: // Manual door open case 32: // D1 ID Card case 33: // D1 ID Badge case 34: // D1 Pass Card case 117: // Blazing door raise case 118: // Blazing door open case 156: // haleyjd [STRIFE] D1 Brass Key case 157: // haleyjd [STRIFE] D1 Silver Key case 158: // haleyjd [STRIFE] D1 Gold Key case 159: // haleyjd [STRIFE] DR Gold Key case 160: // haleyjd [STRIFE] DR Silver Key case 161: // haleyjd [STRIFE] DR Brass Key case 165: // villsa [STRIFE] That doesn't seem to work case 166: // haleyjd [STRIFE] DR Hand Print case 169: // haleyjd [STRIFE] DR Base Key case 170: // haleyjd [STRIFE] DR Gov's Key case 190: // haleyjd [STRIFE] DR Order Key case 205: // villsa [STRIFE] Available in retail only case 213: // haleyjd [STRIFE] DR Chalice case 217: // haleyjd [STRIFE] DR Core Key case 221: // haleyjd [STRIFE] DR Mauler Key case 224: // haleyjd [STRIFE] DR Chapel Key case 225: // haleyjd [STRIFE] DR Catacomb Key case 232: // villsa [STRIFE] DR Oracle Pass EV_VerticalDoor (line, thing); break; // haleyjd: For the sake of our sanity, I have reordered all the line // specials from this point down so that they are strictly in numeric // order, and not divided up in a semi-arbitrary fashion. case 7: // Build Stairs - [STRIFE] Verified unmodified if (EV_BuildStairs(line,build8)) P_ChangeSwitchTexture(line,0); break; case 9: // Change Donut - [STRIFE] Verified unmodified if (EV_DoDonut(line)) P_ChangeSwitchTexture(line,0); break; case 11: // Exit level - [STRIFE] Modified to take tag, etc. P_ChangeSwitchTexture(line, 1); if(levelTimer && levelTimeCount) break; G_ExitLevel(line->tag); break; case 14: // Raise Floor 32 and change texture - [STRIFE] Verified unmodified if (EV_DoPlat(line, raiseAndChange,32)) P_ChangeSwitchTexture(line,0); break; case 15: // Raise Floor 24 and change texture if (EV_DoPlat(line, raiseAndChange,24)) P_ChangeSwitchTexture(line,0); break; case 18: // Raise Floor to next highest floor - [STRIFE] Verified unmodified if (EV_DoFloor(line, raiseFloorToNearest)) P_ChangeSwitchTexture(line,0); break; case 20: // Raise Plat next highest floor and change texture - [STRIFE] Verified unmodified if(EV_DoPlat(line, raiseToNearestAndChange, 0)) P_ChangeSwitchTexture(line,0); break; case 21: // PlatDownWaitUpStay - [STRIFE] Verified unmodified if (EV_DoPlat(line, downWaitUpStay,0)) P_ChangeSwitchTexture(line,0); break; case 23: // Lower Floor to Lowest - [STRIFE] Verified unmodified if (EV_DoFloor(line,lowerFloorToLowest)) P_ChangeSwitchTexture(line,0); break; case 29: // Raise Door - [STRIFE] Verified unmodified if (EV_DoDoor(line,normal)) P_ChangeSwitchTexture(line,0); break; case 40: // villsa [STRIFE] Split Open Door if(EV_DoDoor(line, splitOpen)) P_ChangeSwitchTexture(line, 0); break; // haleyjd case 41: // Lower Ceiling to Floor - [STRIFE] Verified unmodified if (EV_DoCeiling(line,lowerToFloor)) P_ChangeSwitchTexture(line,0); break; case 42: // Close Door - [STRIFE] Verified unmodified if (EV_DoDoor(line,close)) P_ChangeSwitchTexture(line,1); break; case 43: // Lower Ceiling to Floor - [STRIFE] Verified unmodified if (EV_DoCeiling(line,lowerToFloor)) P_ChangeSwitchTexture(line,1); break; case 45: // Lower Floor to Surrounding floor height - [STRIFE] Verified unmodified if (EV_DoFloor(line,lowerFloor)) P_ChangeSwitchTexture(line,1); break; case 49: // Ceiling Crush And Raise - [STRIFE] Verified unmodified if (EV_DoCeiling(line,crushAndRaise)) P_ChangeSwitchTexture(line,0); break; case 50: // Close Door - [STRIFE] Verified unmodified if (EV_DoDoor(line,close)) P_ChangeSwitchTexture(line,0); break; case 51: // [STRIFE] Modifed into S1 Start Finale (was Secret Exit) P_ChangeSwitchTexture(line,0); G_StartFinale(); break; case 55: // Raise Floor Crush - [STRIFE] Verified unmodified if (EV_DoFloor(line,raiseFloorCrush)) P_ChangeSwitchTexture(line,0); break; case 60: // Lower Floor to Lowest - [STRIFE] Verified unmodified if (EV_DoFloor(line,lowerFloorToLowest)) P_ChangeSwitchTexture(line,1); break; case 61: // Open Door - [STRIFE] Verified unmodified if (EV_DoDoor(line,open)) P_ChangeSwitchTexture(line,1); break; case 62: // PlatDownWaitUpStay - [STRIFE] Verified unmodified if (EV_DoPlat(line, downWaitUpStay,1)) P_ChangeSwitchTexture(line,1); break; case 63: // Raise Door - [STRIFE] Verified unmodified if (EV_DoDoor(line,normal)) P_ChangeSwitchTexture(line,1); break; case 64: // Raise Floor to ceiling - [STRIFE] Verified unmodified if (EV_DoFloor(line,raiseFloor)) P_ChangeSwitchTexture(line,1); break; case 65: // Raise Floor Crush - [STRIFE] Verified unmodified if (EV_DoFloor(line,raiseFloorCrush)) P_ChangeSwitchTexture(line,1); break; case 66: // Raise Floor 24 and change texture - [STRIFE] Verified unmodified if (EV_DoPlat(line, raiseAndChange, 24)) P_ChangeSwitchTexture(line,1); break; case 67: // Raise Floor 32 and change texture - [STRIFE] Verified unmodified if (EV_DoPlat(line, raiseAndChange, 32)) P_ChangeSwitchTexture(line,1); break; case 68: // Raise Plat to next highest floor and change texture - [STRIFE] Verified unmodified if (EV_DoPlat(line, raiseToNearestAndChange, 0)) P_ChangeSwitchTexture(line,1); break; case 69: // Raise Floor to next highest floor - [STRIFE] Verified unmodified if (EV_DoFloor(line, raiseFloorToNearest)) P_ChangeSwitchTexture(line,1); break; case 70: // Turbo Lower Floor - [STRIFE] Verified unmodified if (EV_DoFloor(line,turboLower)) P_ChangeSwitchTexture(line,1); break; case 71: // Turbo Lower Floor - [STRIFE] Verified unmodified if (EV_DoFloor(line,turboLower)) P_ChangeSwitchTexture(line,0); break; case 101: // Raise Floor - [STRIFE] Verified unmodified if (EV_DoFloor(line,raiseFloor)) P_ChangeSwitchTexture(line,0); break; case 102: // Lower Floor to Surrounding floor height - [STRIFE] Verified unmodified if (EV_DoFloor(line,lowerFloor)) P_ChangeSwitchTexture(line,0); break; case 103: // Open Door - [STRIFE] Verified unmodified if (EV_DoDoor(line,open)) P_ChangeSwitchTexture(line,0); break; case 111: // Blazing Door Raise (faster than TURBO!) - [STRIFE] Verified unmodified if (EV_DoDoor (line,blazeRaise)) P_ChangeSwitchTexture(line,0); break; case 112: // Blazing Door Open (faster than TURBO!) - [STRIFE] Verified unmodified if (EV_DoDoor (line,blazeOpen)) P_ChangeSwitchTexture(line,0); break; case 113: // Blazing Door Close (faster than TURBO!) - [STRIFE] Verified unmodified if (EV_DoDoor (line,blazeClose)) P_ChangeSwitchTexture(line,0); break; case 114: // Blazing Door Raise (faster than TURBO!) - [STRIFE] Verified unmodified if (EV_DoDoor (line,blazeRaise)) P_ChangeSwitchTexture(line,1); break; case 115: // Blazing Door Open (faster than TURBO!) - [STRIFE] Verified unmodified if (EV_DoDoor (line,blazeOpen)) P_ChangeSwitchTexture(line,1); break; case 116: // Blazing Door Close (faster than TURBO!) - [STRIFE] Verified unmodified if (EV_DoDoor (line,blazeClose)) P_ChangeSwitchTexture(line,1); break; case 122: // Blazing PlatDownWaitUpStay - [STRIFE] Verified unmodified if(EV_DoPlat(line, blazeDWUS, 0)) P_ChangeSwitchTexture(line,0); break; case 123: // Blazing PlatDownWaitUpStay - [STRIFE] Verified unmodified if(EV_DoPlat(line, blazeDWUS, 0)) P_ChangeSwitchTexture(line,1); break; case 127: // Build Stairs Turbo 16 - [STRIFE] Verified unmodified if (EV_BuildStairs(line,turbo16)) P_ChangeSwitchTexture(line,0); break; case 131: // Raise Floor Turbo - [STRIFE] Verified unmodified if (EV_DoFloor(line,raiseFloorTurbo)) P_ChangeSwitchTexture(line,0); break; case 132: // Raise Floor Turbo - [STRIFE] Verified unmodified if (EV_DoFloor(line,raiseFloorTurbo)) P_ChangeSwitchTexture(line,1); break; case 133: // [STRIFE] TODO - which key is it? case 135: // [STRIFE] TODO - which key is it? case 137: // [STRIFE] TODO - which key is it? if (EV_DoLockedDoor (line,blazeOpen,thing)) P_ChangeSwitchTexture(line,0); break; case 99: // [STRIFE] TODO: which key is it? case 134: // [STRIFE] TODO: which key is it? case 136: // [STRIFE] TODO: which key is it? if (EV_DoLockedDoor (line,blazeOpen,thing)) P_ChangeSwitchTexture(line,1); break; case 138: // Light Turn On - [STRIFE] Verified unmodified EV_LightTurnOn(line,255); P_ChangeSwitchTexture(line,1); break; case 139: // Light Turn Off - [STRIFE] Verified unmodified EV_LightTurnOn(line,35); P_ChangeSwitchTexture(line,1); break; case 140: // Raise Floor 512 - [STRIFE] Verified unmodified if (EV_DoFloor(line,raiseFloor512)) P_ChangeSwitchTexture(line,0); break; case 144: // villsa [STRIFE] manual sliding door EV_SlidingDoor(line, thing); break; case 146: // haleyjd 09/24/10: [STRIFE] S1 Build Stairs Down 16 (new type) if(EV_BuildStairs(line, buildDown16)) P_ChangeSwitchTexture(line, 0); break; case 147: // haleyjd 09/24/10: [STRIFE] S1 Clear Force Fields if(EV_ClearForceFields(line)) P_ChangeSwitchTexture(line, 0); break; case 148: // haleyjd 09/16/10: [STRIFE] using forcefields hurts P_DamageMobj(thing, NULL, NULL, 16); P_Thrust(thing->player, thing->angle + ANG180, 125*FRACUNIT/16); break; case 151: // villsa [STRIFE] BlzOpenDoor Gold key case 152: // [STRIFE] TODO: which key is it? case 153: // [STRIFE] TODO: which key is it? if(EV_DoLockedDoor(line, blazeOpen, thing)) P_ChangeSwitchTexture(line, 1); break; case 154: // villsa [STRIFE] plat lower wait rise if have gold key if(thing->player->cards[key_GoldKey]) { if(EV_DoPlat(line, downWaitUpStay, 0)) P_ChangeSwitchTexture(line, 1); } else { thing->player->message = DEH_String("You need a gold key"); S_StartSound(thing, sfx_oof); } break; case 155: // villsa [STRIFE] raise plat wait lower if(EV_DoPlat(line, upWaitDownStay, 0)) P_ChangeSwitchTexture(line, 1); break; case 162: // [STRIFE] TODO: which key is it? case 163: // [STRIFE] TODO: which key is it? case 164: // villsa [STRIFE] BlzOpenDoor Gold key case 167: // [STRIFE] TODO: which key is it? if(EV_DoLockedDoor(line, blazeOpen, thing)) P_ChangeSwitchTexture(line, 0); break; case 168: // [STRIFE] TODO: which key is it? // haleyjd 09/25/10: [STRIFE] SR Blaze Open Door ???? Key if(EV_DoLockedDoor(line, blazeOpen, thing)) P_ChangeSwitchTexture(line, 1); break; case 171: // [STRIFE] TODO: which key is it? // haleyjd 09/25/10: [STRIFE] S1 Open Door ???? Key if(EV_DoLockedDoor(line, open, thing)) P_ChangeSwitchTexture(line, 0); break; case 172: // [STRIFE] TODO: which key is it? case 173: // [STRIFE] TODO: which key is it? case 176: // [STRIFE] TODO: which key is it? case 191: // [STRIFE] TODO: which key is it? case 192: // [STRIFE] TODO: which key is it? case 223: // [STRIFE] TODO: which key is it? if(EV_DoLockedDoor(line, normal, thing)) P_ChangeSwitchTexture(line, 1); break; case 177: // villsa [STRIFE] plat lower wait rise if have power3 key if(thing->player->cards[key_Power3Key]) { if(EV_DoPlat(line, downWaitUpStay, 0)) P_ChangeSwitchTexture(line, 1); } else { thing->player->message = DEH_String("You don't have the key"); S_StartSound(thing, sfx_oof); } break; case 181: // haleyjd 09/25/10: [STRIFE] S1 Floor Raise 512 & Change if(EV_DoFloor(line, raiseFloor512AndChange)) P_ChangeSwitchTexture(line, 0); break; case 189: // [STRIFE] TODO: which key is it??? // haleyjd 09/25/10: [STRIFE] S1 Split Open Door ???? Key if(EV_DoLockedDoor(line, splitOpen, thing)) P_ChangeSwitchTexture(line, 0); break; case 194: // villsa [STRIFE] S1 Free Prisoners if(EV_DoDoor(line, open)) { P_ChangeSwitchTexture(line, 0); P_FreePrisoners(); } break; case 199: // haleyjd 09/25/10: [STRIFE] S1 Destroy Converter if(EV_DoCeiling(line, lowerAndCrush)) { P_ChangeSwitchTexture(line, 0); P_DestroyConverter(); } break; case 207: // villsa [STRIFE] SR Remote Sliding Door if(EV_RemoteSlidingDoor(line, thing)) P_ChangeSwitchTexture(line, 1); break; // haleyjd case 209: // haleyjd 09/24/10: [STRIFE] S1 Build Stairs Down 16 if Have Chalice if(!P_PlayerHasItem(thing->player, MT_INV_CHALICE)) { DEH_snprintf(usemessage, sizeof(usemessage), "You need the chalice!"); thing->player->message = usemessage; S_StartSound(thing, sfx_oof); break; } else if(EV_BuildStairs(line, buildDown16)) P_ChangeSwitchTexture(line, 0); break; case 211: // villsa [STRIFE] S1 Play VOC## sound if(&players[consoleplayer] == thing->player && thing->player->powers[pw_communicator]) { DEH_snprintf(usemessage, sizeof(usemessage), "voc%i", line->tag); I_StartVoice(usemessage); line->special = 0; } break; case 214: // villsa [STRIFE] S1 slow lift lower wait up stay if(EV_DoPlat(line, slowDWUS, 1)) P_ChangeSwitchTexture(line, 1); break; case 219: // haleyjd 09/25/10: S1 Lower Floor Blue Crystal if(!thing->player->cards[key_BlueCrystalKey]) { thing->player->message = DEH_String("You need the Blue Crystal"); S_StartSound(thing, sfx_oof); } else if(EV_DoFloor(line, lowerFloor)) P_ChangeSwitchTexture(line, 0); break; case 220: // haleyjd 09/25/10: S1 Lower Floor Red Crystal if(!thing->player->cards[key_RedCrystalKey]) { thing->player->message = DEH_String("You need the Red Crystal"); S_StartSound(thing, sfx_oof); } else if(EV_DoFloor(line, lowerFloor)) P_ChangeSwitchTexture(line, 0); break; case 226: // villsa [STRIFE] S1 Complete Training Area if(EV_DoFloor(line, lowerFloor)) { P_GiveItemToPlayer(thing->player, SPR_TOKN, MT_TOKEN_STAMINA); P_GiveItemToPlayer(thing->player, SPR_TOKN, MT_TOKEN_NEW_ACCURACY); P_ChangeSwitchTexture(line, 0); DEH_snprintf(usemessage, sizeof(usemessage), DEH_String("Congratulations! You have completed the training area.")); thing->player->message = usemessage; } break; case 229: // villsa [STRIFE] SR Sigil Sliding Door if(thing->player->sigiltype == 4) { if(EV_RemoteSlidingDoor(line, thing)) P_ChangeSwitchTexture(line, 1); } break; // haleyjd case 233: // villsa [STRIFE] objective given after revealing the computer if(!EV_DoDoor(line, splitOpen)) return true; P_ChangeSwitchTexture(line, 1); GiveVoiceObjective("voc70", "log70", 0); // haleyjd: Strife used sprintf here, not a direct set. DEH_snprintf(usemessage, sizeof(usemessage), "Incoming Message from BlackBird..."); thing->player->message = usemessage; break; case 234: // haleyjd 09/24/10: [STRIFE] SR Raise Door if Quest 3 if(!(thing->player->questflags & QF_QUEST3)) // QUEST3 == Irale { // BUG: doesn't make sfx_oof sound like all other message- // giving door types. I highly doubt this was intentional. DEH_snprintf(usemessage, sizeof(usemessage), "That doesn't seem to work!"); thing->player->message = usemessage; } else if(EV_DoDoor(line, normal)) P_ChangeSwitchTexture(line, 1); break; case 235: // haleyjd 09/25/10: [STRIFE] S1 Split Open Door if Have Sigil 4 if(thing->player->sigiltype == 4) { if(EV_DoDoor(line, splitOpen)) P_ChangeSwitchTexture(line, 0); } break; case 666: // villsa [STRIFE] SR Move Wall P_MoveWall(line, thing); break; } return true; }
// 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; }