void IN_Start(void) { int i; AM_Stop(); SN_StopAllSequences(); // InFine handles the text. if(!deathmatch) { gameaction = ga_leavemap; return; } GL_SetFilter(0); InitStats(); LoadPics(); intermission = true; interstate = 0; skipintermission = false; intertime = 0; for(i = 0; i < MAXPLAYERS; i++) { players[i].messageTics = 0; players[i].message[0] = 0; } }
void VBasePlayer::DoClientFinale(VStr Type) { guard(VBasePlayer::DoClientFinale); ClGame->intermission = 2; #ifdef CLIENT AM_Stop(); #endif ClGame->eventStartFinale(*Type); unguard; }
// // I_StartFrame // void I_StartFrame (void) { // TODO: less hacky way to do this, make the "automap" key toggle something else instead if (gamestate == GS_LEVEL) { // if (!(automapmode & am_active)) { AM_Start(); // } } else { AM_Stop(); } }
// // D_Shutdown // // Called to shutdown subsystems when unloading a set of WAD resource files. // Should be called prior to D_Init when loading a new set of WADs. // void STACK_ARGS D_Shutdown() { if (gamestate == GS_LEVEL) G_ExitLevel(0, 0); // [ML] 9/11/10: Reset custom wad level information from MAPINFO et al. for (size_t i = 0; i < wadlevelinfos.size(); i++) { if (wadlevelinfos[i].snapshot) { delete wadlevelinfos[i].snapshot; wadlevelinfos[i].snapshot = NULL; } } wadlevelinfos.clear(); wadclusterinfos.clear(); F_EndFinale(); ST_Shutdown(); R_ShutdownViewBorder(); // stop sound effects and music S_Stop(); // shutdown automap AM_Stop(); DThinker::DestroyAllThinkers(); UndoDehPatch(); GStrings.FreeData(); // close all open WAD files W_Close(); V_UnloadFonts(); R_Shutdown(); HU_Shutdown(); C_ShutdownConsoleBackground(); R_ShutdownTextureManager(); // reset the Zone memory manager Z_Close(); }
void IN_Start(void) { I_SetPalette(W_CacheLumpName("PLAYPAL", PU_CACHE)); IN_LoadPics(); IN_InitStats(); intermission = true; interstate = -1; skipintermission = false; intertime = 0; oldintertime = 0; AM_Stop(); S_StartSong(mus_intr, true); }
// Called at new frame, if the video mode has changed // void SCR_Recalc(void) { if (dedicated) return; // bytes per pixel quick access scr_bpp = vid.bpp; // scale 1,2,3 times in x and y the patches for the menus and overlays... // calculated once and for all, used by routines in v_video.c vid.dupx = vid.width / BASEVIDWIDTH; vid.dupy = vid.height / BASEVIDHEIGHT; vid.fdupx = (float)vid.width / BASEVIDWIDTH; vid.fdupy = (float)vid.height / BASEVIDHEIGHT; vid.baseratio = FixedDiv(vid.height << FRACBITS, BASEVIDHEIGHT << FRACBITS); // patch the asm code depending on vid buffer rowbytes #ifdef RUSEASM if (R_ASM) ASM_PatchRowBytes(vid.rowbytes); // if (R_486 || R_586 || R_MMX) // MMX_PatchRowBytes(vid.rowbytes); #endif // toggle off automap because some screensize-dependent values will // be calculated next time the automap is activated. if (automapactive) AM_Stop(); // r_plane stuff: visplanes, openings, floorclip, ceilingclip, spanstart, // spanstop, yslope, distscale, cachedheight, cacheddistance, // cachedxstep, cachedystep // -> allocated at the maximum vidsize, static. // r_main: xtoviewangle, allocated at the maximum size. // r_things: negonearray, screenheightarray allocated max. size. // set the screen[x] ptrs on the new vidbuffers V_Init(); // scr_viewsize doesn't change, neither detailLevel, but the pixels // per screenblock is different now, since we've changed resolution. R_SetViewSize(); //just set setsizeneeded true now .. // vid.recalc lasts only for the next refresh... con_recalc = true; am_recalc = true; }
// // AM_Start() // // Start up automap operations, // if a new level, or game start, (re)initialize level variables // init map variables // load mark patches // // Passed nothing, returns nothing // void AM_Start() { static int lastlevel = -1, lastepisode = -1, last_hires = -1; if (!stopped) AM_Stop(); stopped = false; if (lastlevel != gamemap || lastepisode != gameepisode || hires!=last_hires) { last_hires = hires; // killough 11/98 AM_LevelInit(); lastlevel = gamemap; lastepisode = gameepisode; } AM_initVariables(); AM_loadPics(); }
void IN_Start(void) { int i; I_SetPalette(W_CacheLumpName("PLAYPAL", PU_CACHE)); InitStats(); LoadPics(); intermission = true; interstate = 0; skipintermission = false; intertime = 0; AM_Stop(); for (i = 0; i < MAXPLAYERS; i++) { players[i].messageTics = 0; players[i].message[0] = 0; } SN_StopAllSequences(); }
void AM_Start (void) { static int lastlevel = -1, lastepisode = -1; if (!stopped) AM_Stop(); stopped = false; if(gamestate != GS_LEVEL) { return; // don't show automap if we aren't in a game! } if (lastlevel != gamemap || lastepisode != gameepisode) { AM_LevelInit(); lastlevel = gamemap; lastepisode = gameepisode; } AM_initVariables(); AM_loadPics(); }
// // D_NewWadInit // // Client code that should be reset every time a new set of WADs are loaded // void D_NewWadInit() { AM_Stop(); HU_Init (); if (!(InitPalettes("PLAYPAL"))) I_Error("Could not reinitialize palette"); V_InitPalette(); G_SetLevelStrings (); G_ParseMapInfo (); G_ParseMusInfo (); S_ParseSndInfo(); M_Init(); R_Init(); P_InitEffects(); // [ML] Do this here so we don't have to put particle crap in server P_Init(); S_Init (snd_sfxvolume, snd_musicvolume); ST_Init(); }
void P_Start(void) { int i; mapdef_t* map; map = P_GetMapInfo(gamemap); for(i = 0; i < MAXPLAYERS; i++) { // players can't be hurt on title map if(map->forcegodmode) { players[i].cheats |= CF_GODMODE; } // turn off godmode on hectic map else if(map->clearchts) { players[i].cheats &= ~CF_GODMODE; } else { break; } } // turn off/clear some things AM_Reset(); AM_Stop(); M_ClearRandom(); // do a nice little fade in effect P_FadeInBrightness(); // autoactivate line specials P_ActivateLineByTag(999, players[0].mo); // enable menu and set gamestate allowmenu = true; gamestate = GS_LEVEL; S_StartMusic(map->music); }
void VBasePlayer::DoClientIntermission(VName NextMap) { guard(VBasePlayer::DoClientIntermission); im_t& im = ClGame->im; im.Text.Clean(); im.IMFlags = 0; const mapInfo_t& linfo = P_GetMapInfo(Level->XLevel->MapName); im.LeaveMap = Level->XLevel->MapName; im.LeaveCluster = linfo.Cluster; im.LeaveName = linfo.GetName(); im.LeaveTitlePatch = linfo.TitlePatch; im.ExitPic = linfo.ExitPic; im.InterMusic = linfo.InterMusic; const mapInfo_t& einfo = P_GetMapInfo(NextMap); im.EnterMap = NextMap; im.EnterCluster = einfo.Cluster; im.EnterName = einfo.GetName(); im.EnterTitlePatch = einfo.TitlePatch; im.EnterPic = einfo.EnterPic; if (linfo.Cluster != einfo.Cluster) { if (einfo.Cluster) { const VClusterDef* CDef = P_GetClusterDef(einfo.Cluster); if (CDef->EnterText.Length()) { if (CDef->Flags & CLUSTERF_LookupEnterText) { im.Text = GLanguage[*CDef->EnterText]; } else { im.Text = CDef->EnterText; } if (CDef->Flags & CLUSTERF_EnterTextIsLump) { im.IMFlags |= im_t::IMF_TextIsLump; } if (CDef->Flags & CLUSTERF_FinalePic) { im.TextFlat = NAME_None; im.TextPic = CDef->Flat; } else { im.TextFlat = CDef->Flat; im.TextPic = NAME_None; } im.TextMusic = CDef->Music; im.TextCDTrack = CDef->CDTrack; im.TextCDId = CDef->CDId; } } if (im.Text.Length() == 0 && linfo.Cluster) { const VClusterDef* CDef = P_GetClusterDef(linfo.Cluster); if (CDef->ExitText.Length()) { if (CDef->Flags & CLUSTERF_LookupExitText) { im.Text = GLanguage[*CDef->ExitText]; } else { im.Text = CDef->ExitText; } if (CDef->Flags & CLUSTERF_ExitTextIsLump) { im.IMFlags |= im_t::IMF_TextIsLump; } if (CDef->Flags & CLUSTERF_FinalePic) { im.TextFlat = NAME_None; im.TextPic = CDef->Flat; } else { im.TextFlat = CDef->Flat; im.TextPic = NAME_None; } im.TextMusic = CDef->Music; im.TextCDTrack = CDef->CDTrack; im.TextCDId = CDef->CDId; } } } ClGame->intermission = 1; #ifdef CLIENT AM_Stop(); GAudio->StopAllSequences(); #endif ClGame->eventIintermissionStart(); unguard; }
void AActor::Die (AActor *source, AActor *inflictor) { // [SO] 9/2/02 -- It's rather funny to see an exploded player body with the invuln sparkle active :) effects &= ~FX_RESPAWNINVUL; //flags &= ~MF_INVINCIBLE; if (debugfile && this->player) { static int dieticks[MAXPLAYERS]; int pnum = this->player-players; if (dieticks[pnum] == gametic) gametic=gametic; dieticks[pnum] = gametic; fprintf (debugfile, "died (%d) on tic %d (%s)\n", pnum, gametic, this->player->cheats&CF_PREDICTING?"predicting":"real"); } if (flags & MF_MISSILE) { // [RH] When missiles die, they just explode P_ExplodeMissile (this, NULL); return; } // [RH] Set the target to the thing that killed it. Strife apparently does this. if (source != NULL) { target = source; } flags &= ~(MF_SHOOTABLE|MF_FLOAT|MF_SKULLFLY); if (!(flags4 & MF4_DONTFALL)) flags&=~MF_NOGRAVITY; flags |= MF_DROPOFF; if (flags3 & MF3_ISMONSTER) { // [RH] Only monsters get to be corpses. flags |= MF_CORPSE; } // [RH] Allow the death height to be overridden using metadata. fixed_t metaheight = 0; if (DamageType == MOD_FIRE) { metaheight = GetClass()->Meta.GetMetaFixed (AMETA_BurnHeight); } if (metaheight == 0) { metaheight = GetClass()->Meta.GetMetaFixed (AMETA_DeathHeight); } if (metaheight != 0) { height = MAX<fixed_t> (metaheight, 0); } else { height >>= 2; } // [RH] If the thing has a special, execute and remove it // Note that the thing that killed it is considered // the activator of the script. // New: In Hexen, the thing that died is the activator, // so now a level flag selects who the activator gets to be. if (special && (!(flags & MF_SPECIAL) || (flags3 & MF3_ISMONSTER))) { LineSpecials[special] (NULL, level.flags & LEVEL_ACTOWNSPECIAL ? this : source, false, args[0], args[1], args[2], args[3], args[4]); special = 0; } if (source && source->player) { if (flags & MF_COUNTKILL) { // count for intermission source->player->killcount++; level.killed_monsters++; } // Don't count any frags at level start, because they're just telefrags // resulting from insufficient deathmatch starts, and it wouldn't be // fair to count them toward a player's score. if (player && level.time) { source->player->frags[player - players]++; if (player == source->player) // [RH] Cumulative frag count { char buff[256]; player->fragcount--; if (deathmatch && player->spreecount >= 5 && cl_showsprees) { SexMessage (GStrings("SPREEKILLSELF"), buff, player->userinfo.gender, player->userinfo.netname, player->userinfo.netname); StatusBar->AttachMessage (new DHUDMessageFadeOut (buff, 1.5f, 0.2f, 0, 0, CR_WHITE, 3.f, 0.5f), MAKE_ID('K','S','P','R')); } } else { ++source->player->fragcount; ++source->player->spreecount; if (source->player->morphTics) { // Make a super chicken source->GiveInventoryType (RUNTIME_CLASS(APowerWeaponLevel2)); } if (deathmatch && cl_showsprees) { const char *spreemsg; char buff[256]; switch (source->player->spreecount) { case 5: spreemsg = GStrings("SPREE5"); break; case 10: spreemsg = GStrings("SPREE10"); break; case 15: spreemsg = GStrings("SPREE15"); break; case 20: spreemsg = GStrings("SPREE20"); break; case 25: spreemsg = GStrings("SPREE25"); break; default: spreemsg = NULL; break; } if (spreemsg == NULL && player->spreecount >= 5) { if (!AnnounceSpreeLoss (this)) { SexMessage (GStrings("SPREEOVER"), buff, player->userinfo.gender, player->userinfo.netname, source->player->userinfo.netname); StatusBar->AttachMessage (new DHUDMessageFadeOut (buff, 1.5f, 0.2f, 0, 0, CR_WHITE, 3.f, 0.5f), MAKE_ID('K','S','P','R')); } } else if (spreemsg != NULL) { if (!AnnounceSpree (source)) { SexMessage (spreemsg, buff, player->userinfo.gender, player->userinfo.netname, source->player->userinfo.netname); StatusBar->AttachMessage (new DHUDMessageFadeOut (buff, 1.5f, 0.2f, 0, 0, CR_WHITE, 3.f, 0.5f), MAKE_ID('K','S','P','R')); } } } } // [RH] Multikills source->player->multicount++; if (source->player->lastkilltime > 0) { if (source->player->lastkilltime < level.time - 3*TICRATE) { source->player->multicount = 1; } if (deathmatch && source->CheckLocalView (consoleplayer) && cl_showmultikills) { const char *multimsg; switch (source->player->multicount) { case 1: multimsg = NULL; break; case 2: multimsg = GStrings("MULTI2"); break; case 3: multimsg = GStrings("MULTI3"); break; case 4: multimsg = GStrings("MULTI4"); break; default: multimsg = GStrings("MULTI5"); break; } if (multimsg != NULL) { char buff[256]; if (!AnnounceMultikill (source)) { SexMessage (multimsg, buff, player->userinfo.gender, player->userinfo.netname, source->player->userinfo.netname); StatusBar->AttachMessage (new DHUDMessageFadeOut (buff, 1.5f, 0.8f, 0, 0, CR_RED, 3.f, 0.5f), MAKE_ID('M','K','I','L')); } } } } source->player->lastkilltime = level.time; // [RH] Implement fraglimit if (deathmatch && fraglimit && fraglimit == D_GetFragCount (source->player)) { Printf ("%s\n", GStrings("TXT_FRAGLIMIT")); G_ExitLevel (0, false); } } } else if (!multiplayer && (flags & MF_COUNTKILL)) { // count all monster deaths, // even those caused by other monsters players[0].killcount++; level.killed_monsters++; } if (player) { // [RH] Death messages ClientObituary (this, inflictor, source); // Death script execution, care of Skull Tag FBehavior::StaticStartTypedScripts (SCRIPT_Death, this, true); // [RH] Force a delay between death and respawn player->respawn_time = level.time + TICRATE; //Added by MC: Respawn bots if (bglobal.botnum && consoleplayer == Net_Arbitrator && !demoplayback) { if (player->isbot) player->t_respawn = (pr_botrespawn()%15)+((bglobal.botnum-1)*2)+TICRATE+1; //Added by MC: Discard enemies. for (int i = 0; i < MAXPLAYERS; i++) { if (players[i].isbot && this == players[i].enemy) { if (players[i].dest == players[i].enemy) players[i].dest = NULL; players[i].enemy = NULL; } } player->spreecount = 0; player->multicount = 0; } // count environment kills against you if (!source) { player->frags[player - players]++; player->fragcount--; // [RH] Cumulative frag count } flags &= ~MF_SOLID; player->playerstate = PST_DEAD; P_DropWeapon (player); if (this == players[consoleplayer].camera && automapactive) { // don't die in auto map, switch view prior to dying AM_Stop (); } } // [RH] If this is the unmorphed version of another monster, destroy this // actor, because the morphed version is the one that will stick around in // the level. if (flags & MF_UNMORPHED) { Destroy (); return; } if (DamageType == MOD_DISINTEGRATE && EDeathState) { // Electrocution death SetState (EDeathState); } else if (DamageType == MOD_FIRE && BDeathState) { // Burn death SetState (BDeathState); } else if (DamageType == MOD_ICE && (IDeathState || ( (!deh.NoAutofreeze && !(flags4 & MF4_NOICEDEATH)) && (player || (flags3 & MF3_ISMONSTER))))) { // Ice death flags |= MF_ICECORPSE; if (IDeathState) { SetState (IDeathState); } else { SetState (&AActor::States[S_GENERICFREEZEDEATH]); } } else if (XDeathState && health < (gameinfo.gametype == GAME_Doom ? -GetDefault()->health : -GetDefault()->health/2)) { // Extreme death SetState (XDeathState); } else { // Normal death DamageType = MOD_UNKNOWN; // [RH] "Frozen" barrels shouldn't do freezing damage if (DeathState != NULL) // [RH] DeathState might be NULL, so try others as needed { SetState (DeathState); } else if (EDeathState != NULL) { SetState (EDeathState); } else if (BDeathState != NULL) { SetState (BDeathState); } else if (IDeathState != NULL) { SetState (IDeathState); } } tics -= pr_killmobj() & 3; if (tics < 1) tics = 1; }
boolean AM_Responder(event_t * ev) { int rc; int key; static int bigstate = 0; static int joywait = 0; key = ev->data1; rc = false; if (ev->type == ev_joystick && joybautomap >= 0 && (ev->data1 & (1 << joybautomap)) != 0 && joywait < I_GetTime()) { joywait = I_GetTime() + 5; if (!automapactive) { AM_Start (); viewactive = false; } else { bigstate = 0; viewactive = true; AM_Stop (); } } if (!automapactive) { if (ev->type == ev_keydown && key == key_map_toggle && gamestate == GS_LEVEL) { AM_Start(); viewactive = false; // viewactive = true; rc = true; } } else if (ev->type == ev_keydown) { rc = true; if (key == key_map_east) // pan right { if (!followplayer) m_paninc.x = FTOM(F_PANINC); else rc = false; } else if (key == key_map_west) // pan left { if (!followplayer) m_paninc.x = -FTOM(F_PANINC); else rc = false; } else if (key == key_map_north) // pan up { if (!followplayer) m_paninc.y = FTOM(F_PANINC); else rc = false; } else if (key == key_map_south) // pan down { if (!followplayer) m_paninc.y = -FTOM(F_PANINC); else rc = false; } else if (key == key_map_zoomout) // zoom out { mtof_zoommul = M_ZOOMOUT; ftom_zoommul = M_ZOOMIN; } else if (key == key_map_zoomin) // zoom in { mtof_zoommul = M_ZOOMIN; ftom_zoommul = M_ZOOMOUT; } else if (key == key_map_toggle) // toggle map (tab) { bigstate = 0; viewactive = true; AM_Stop(); } else if (key == key_map_maxzoom) { bigstate = !bigstate; if (bigstate) { AM_saveScaleAndLoc(); AM_minOutWindowScale(); } else AM_restoreScaleAndLoc(); } else if (key == key_map_follow) { followplayer = !followplayer; f_oldloc.x = INT_MAX; P_SetMessage(plr, followplayer ? AMSTR_FOLLOWON : AMSTR_FOLLOWOFF, true); } /* else if (key == key_map_grid) { grid = !grid; plr->message = grid ? AMSTR_GRIDON : AMSTR_GRIDOFF; } else if (key == key_map_mark) { M_snprintf(buffer, sizeof(buffer), "%s %d", AMSTR_MARKEDSPOT, markpointnum); plr->message = buffer; AM_addMark(); } else if (key == key_map_clearmark) { AM_clearMarks(); plr->message = AMSTR_MARKSCLEARED; } */ else { rc = false; } if (cheat_amap[cheatcount] == ev->data1 && !netgame) cheatcount++; else cheatcount = 0; if (cheatcount == 6) { cheatcount = 0; rc = false; cheating = (cheating + 1) % 3; } } else if (ev->type == ev_keyup) { rc = false; if (key == key_map_east) { if (!followplayer) m_paninc.x = 0; } else if (key == key_map_west) { if (!followplayer) m_paninc.x = 0; } else if (key == key_map_north) { if (!followplayer) m_paninc.y = 0; } else if (key == key_map_south) { if (!followplayer) m_paninc.y = 0; } else if (key == key_map_zoomout || key == key_map_zoomin) { mtof_zoommul = FRACUNIT; ftom_zoommul = FRACUNIT; } } return rc; }
boolean AM_Responder(event_t * ev) { int rc; int key; static int bigstate = 0; static int joywait = 0; key = ev->data1; if (ev->type == ev_joystick && joybautomap >= 0 && (ev->data1 & (1 << joybautomap)) != 0 && joywait < I_GetTime()) { joywait = I_GetTime() + 5; if (!automapactive) { AM_Start (); SB_state = -1; viewactive = false; } else { bigstate = 0; viewactive = true; AM_Stop (); SB_state = -1; } return true; } rc = false; if (!automapactive) { if (ev->type == ev_keydown && key == key_map_toggle && gamestate == GS_LEVEL) { AM_Start(); SB_state = -1; viewactive = false; rc = true; } } else if (ev->type == ev_keydown) { rc = true; if (key == key_map_east) // pan right { if (!followplayer) m_paninc.x = FTOM(F_PANINC); else rc = false; } else if (key == key_map_west) // pan left { if (!followplayer) m_paninc.x = -FTOM(F_PANINC); else rc = false; } else if (key == key_map_north) // pan up { if (!followplayer) m_paninc.y = FTOM(F_PANINC); else rc = false; } else if (key == key_map_south) // pan down { if (!followplayer) m_paninc.y = -FTOM(F_PANINC); else rc = false; } else if (key == key_map_zoomout) // zoom out { mtof_zoommul = M_ZOOMOUT; ftom_zoommul = M_ZOOMIN; } else if (key == key_map_zoomin) // zoom in { mtof_zoommul = M_ZOOMIN; ftom_zoommul = M_ZOOMOUT; } else if (key == key_map_toggle) { bigstate = 0; viewactive = true; AM_Stop(); SB_state = -1; } else if (key == key_map_maxzoom) { bigstate = !bigstate; if (bigstate) { AM_saveScaleAndLoc(); AM_minOutWindowScale(); } else AM_restoreScaleAndLoc(); } else if (key == key_map_follow) { followplayer = !followplayer; f_oldloc.x = INT_MAX; P_SetMessage(plr, followplayer ? AMSTR_FOLLOWON : AMSTR_FOLLOWOFF, true); } else { rc = false; } if (cheat_kills[ShowKillsCount] == ev->data1 && netgame && deathmatch) { ShowKillsCount++; if (ShowKillsCount == 5) { ShowKillsCount = 0; rc = false; ShowKills ^= 1; } } else { ShowKillsCount = 0; } } else if (ev->type == ev_keyup) { rc = false; if (key == key_map_east) { if (!followplayer) m_paninc.x = 0; } else if (key == key_map_west) { if (!followplayer) m_paninc.x = 0; } else if (key == key_map_north) { if (!followplayer) m_paninc.y = 0; } else if (key == key_map_south) { if (!followplayer) m_paninc.y = 0; } else if (key == key_map_zoomin || key == key_map_zoomout) { mtof_zoommul = FRACUNIT; ftom_zoommul = FRACUNIT; } } return rc; }
void G_DoCompleted (void) { int i; gameaction = ga_nothing; if (gamestate == GS_TITLELEVEL) { level.MapName = nextlevel; G_DoLoadLevel (startpos, false); startpos = 0; viewactive = true; return; } // [RH] Mark this level as having been visited if (!(level.flags & LEVEL_CHANGEMAPCHEAT)) FindLevelInfo (level.MapName)->flags |= LEVEL_VISITED; if (automapactive) AM_Stop (); wminfo.finished_ep = level.cluster - 1; wminfo.LName0 = TexMan[TexMan.CheckForTexture(level.info->PName, FTexture::TEX_MiscPatch)]; wminfo.current = level.MapName; if (deathmatch && (dmflags & DF_SAME_LEVEL) && !(level.flags & LEVEL_CHANGEMAPCHEAT)) { wminfo.next = level.MapName; wminfo.LName1 = wminfo.LName0; } else { level_info_t *nextinfo = FindLevelInfo (nextlevel, false); if (nextinfo == NULL || strncmp (nextlevel, "enDSeQ", 6) == 0) { wminfo.next = nextlevel; wminfo.LName1 = NULL; } else { wminfo.next = nextinfo->MapName; wminfo.LName1 = TexMan[TexMan.CheckForTexture(nextinfo->PName, FTexture::TEX_MiscPatch)]; } } CheckWarpTransMap (wminfo.next, true); nextlevel = wminfo.next; wminfo.next_ep = FindLevelInfo (wminfo.next)->cluster - 1; wminfo.maxkills = level.total_monsters; wminfo.maxitems = level.total_items; wminfo.maxsecret = level.total_secrets; wminfo.maxfrags = 0; wminfo.partime = TICRATE * level.partime; wminfo.sucktime = level.sucktime; wminfo.pnum = consoleplayer; wminfo.totaltime = level.totaltime; for (i=0 ; i<MAXPLAYERS ; i++) { wminfo.plyr[i].in = playeringame[i]; wminfo.plyr[i].skills = players[i].killcount; wminfo.plyr[i].sitems = players[i].itemcount; wminfo.plyr[i].ssecret = players[i].secretcount; wminfo.plyr[i].stime = level.time; memcpy (wminfo.plyr[i].frags, players[i].frags , sizeof(wminfo.plyr[i].frags)); wminfo.plyr[i].fragcount = players[i].fragcount; } // [RH] If we're in a hub and staying within that hub, take a snapshot // of the level. If we're traveling to a new hub, take stuff from // the player and clear the world vars. If this is just an // ordinary cluster (not a hub), take stuff from the player, but // leave the world vars alone. cluster_info_t *thiscluster = FindClusterInfo (level.cluster); cluster_info_t *nextcluster = FindClusterInfo (wminfo.next_ep+1); // next_ep is cluster-1 EFinishLevelType mode; if (thiscluster != nextcluster || deathmatch || !(thiscluster->flags & CLUSTER_HUB)) { if (nextcluster->flags & CLUSTER_HUB) { mode = FINISH_NextHub; } else { mode = FINISH_NoHub; } } else { mode = FINISH_SameHub; } // Intermission stats for entire hubs G_LeavingHub(mode, thiscluster, &wminfo); for (i = 0; i < MAXPLAYERS; i++) { if (playeringame[i]) { // take away appropriate inventory G_PlayerFinishLevel (i, mode, changeflags); } } if (mode == FINISH_SameHub) { // Remember the level's state for re-entry. if (!(level.flags2 & LEVEL2_FORGETSTATE)) { G_SnapshotLevel (); // Do not free any global strings this level might reference // while it's not loaded. FBehavior::StaticLockLevelVarStrings(); } else { // Make sure we don't have a snapshot lying around from before. level.info->ClearSnapshot(); } } else { // Forget the states of all existing levels. G_ClearSnapshots (); if (mode == FINISH_NextHub) { // Reset world variables for the new hub. P_ClearACSVars(false); } level.time = 0; level.maptime = 0; } if (!deathmatch && ((level.flags & LEVEL_NOINTERMISSION) || ((nextcluster == thiscluster) && (thiscluster->flags & CLUSTER_HUB)))) { G_WorldDone (); return; } gamestate = GS_INTERMISSION; viewactive = false; automapactive = false; // [RH] If you ever get a statistics driver operational, adapt this. // if (statcopy) // memcpy (statcopy, &wminfo, sizeof(wminfo)); WI_Start (&wminfo); }
void AActor::Die (AActor *source, AActor *inflictor, int dmgflags) { // Handle possible unmorph on death bool wasgibbed = (health < GibHealth()); AActor *realthis = NULL; int realstyle = 0; int realhealth = 0; if (P_MorphedDeath(this, &realthis, &realstyle, &realhealth)) { if (!(realstyle & MORPH_UNDOBYDEATHSAVES)) { if (wasgibbed) { int realgibhealth = realthis->GibHealth(); if (realthis->health >= realgibhealth) { realthis->health = realgibhealth -1; // if morphed was gibbed, so must original be (where allowed)l } } realthis->Die(source, inflictor, dmgflags); } return; } // [SO] 9/2/02 -- It's rather funny to see an exploded player body with the invuln sparkle active :) effects &= ~FX_RESPAWNINVUL; //flags &= ~MF_INVINCIBLE; if (debugfile && this->player) { static int dieticks[MAXPLAYERS]; // [ZzZombo] not used? Except if for peeking in debugger... int pnum = int(this->player-players); dieticks[pnum] = gametic; fprintf (debugfile, "died (%d) on tic %d (%s)\n", pnum, gametic, this->player->cheats&CF_PREDICTING?"predicting":"real"); } // [RH] Notify this actor's items. for (AInventory *item = Inventory; item != NULL; ) { AInventory *next = item->Inventory; item->OwnerDied(); item = next; } if (flags & MF_MISSILE) { // [RH] When missiles die, they just explode P_ExplodeMissile (this, NULL, NULL); return; } // [RH] Set the target to the thing that killed it. Strife apparently does this. if (source != NULL) { target = source; } flags &= ~(MF_SHOOTABLE|MF_FLOAT|MF_SKULLFLY); if (!(flags4 & MF4_DONTFALL)) flags&=~MF_NOGRAVITY; flags |= MF_DROPOFF; if ((flags3 & MF3_ISMONSTER) || FindState(NAME_Raise) != NULL || IsKindOf(RUNTIME_CLASS(APlayerPawn))) { // [RH] Only monsters get to be corpses. // Objects with a raise state should get the flag as well so they can // be revived by an Arch-Vile. Batman Doom needs this. // [RC] And disable this if DONTCORPSE is set, of course. if(!(flags6 & MF6_DONTCORPSE)) flags |= MF_CORPSE; } flags6 |= MF6_KILLED; // [RH] Allow the death height to be overridden using metadata. fixed_t metaheight = 0; if (DamageType == NAME_Fire) { metaheight = GetClass()->Meta.GetMetaFixed (AMETA_BurnHeight); } if (metaheight == 0) { metaheight = GetClass()->Meta.GetMetaFixed (AMETA_DeathHeight); } if (metaheight != 0) { height = MAX<fixed_t> (metaheight, 0); } else { height >>= 2; } // [RH] If the thing has a special, execute and remove it // Note that the thing that killed it is considered // the activator of the script. // New: In Hexen, the thing that died is the activator, // so now a level flag selects who the activator gets to be. // Everything is now moved to P_ActivateThingSpecial(). if (special && (!(flags & MF_SPECIAL) || (flags3 & MF3_ISMONSTER)) && !(activationtype & THINGSPEC_NoDeathSpecial)) { P_ActivateThingSpecial(this, source, true); } if (CountsAsKill()) level.killed_monsters++; if (source && source->player) { if (CountsAsKill()) { // count for intermission source->player->killcount++; } // Don't count any frags at level start, because they're just telefrags // resulting from insufficient deathmatch starts, and it wouldn't be // fair to count them toward a player's score. if (player && level.maptime) { source->player->frags[player - players]++; if (player == source->player) // [RH] Cumulative frag count { char buff[256]; player->fragcount--; if (deathmatch && player->spreecount >= 5 && cl_showsprees) { SexMessage (GStrings("SPREEKILLSELF"), buff, player->userinfo.GetGender(), player->userinfo.GetName(), player->userinfo.GetName()); StatusBar->AttachMessage (new DHUDMessageFadeOut (SmallFont, buff, 1.5f, 0.2f, 0, 0, CR_WHITE, 3.f, 0.5f), MAKE_ID('K','S','P','R')); } } else { if ((dmflags2 & DF2_YES_LOSEFRAG) && deathmatch) player->fragcount--; ++source->player->fragcount; ++source->player->spreecount; if (source->player->morphTics) { // Make a super chicken source->GiveInventoryType (RUNTIME_CLASS(APowerWeaponLevel2)); } if (deathmatch && cl_showsprees) { const char *spreemsg; char buff[256]; switch (source->player->spreecount) { case 5: spreemsg = GStrings("SPREE5"); break; case 10: spreemsg = GStrings("SPREE10"); break; case 15: spreemsg = GStrings("SPREE15"); break; case 20: spreemsg = GStrings("SPREE20"); break; case 25: spreemsg = GStrings("SPREE25"); break; default: spreemsg = NULL; break; } if (spreemsg == NULL && player->spreecount >= 5) { if (!AnnounceSpreeLoss (this)) { SexMessage (GStrings("SPREEOVER"), buff, player->userinfo.GetGender(), player->userinfo.GetName(), source->player->userinfo.GetName()); StatusBar->AttachMessage (new DHUDMessageFadeOut (SmallFont, buff, 1.5f, 0.2f, 0, 0, CR_WHITE, 3.f, 0.5f), MAKE_ID('K','S','P','R')); } } else if (spreemsg != NULL) { if (!AnnounceSpree (source)) { SexMessage (spreemsg, buff, player->userinfo.GetGender(), player->userinfo.GetName(), source->player->userinfo.GetName()); StatusBar->AttachMessage (new DHUDMessageFadeOut (SmallFont, buff, 1.5f, 0.2f, 0, 0, CR_WHITE, 3.f, 0.5f), MAKE_ID('K','S','P','R')); } } } } // [RH] Multikills if (player != source->player) { source->player->multicount++; if (source->player->lastkilltime > 0) { if (source->player->lastkilltime < level.time - 3*TICRATE) { source->player->multicount = 1; } if (deathmatch && source->CheckLocalView (consoleplayer) && cl_showmultikills) { const char *multimsg; switch (source->player->multicount) { case 1: multimsg = NULL; break; case 2: multimsg = GStrings("MULTI2"); break; case 3: multimsg = GStrings("MULTI3"); break; case 4: multimsg = GStrings("MULTI4"); break; default: multimsg = GStrings("MULTI5"); break; } if (multimsg != NULL) { char buff[256]; if (!AnnounceMultikill (source)) { SexMessage (multimsg, buff, player->userinfo.GetGender(), player->userinfo.GetName(), source->player->userinfo.GetName()); StatusBar->AttachMessage (new DHUDMessageFadeOut (SmallFont, buff, 1.5f, 0.8f, 0, 0, CR_RED, 3.f, 0.5f), MAKE_ID('M','K','I','L')); } } } } source->player->lastkilltime = level.time; } // [RH] Implement fraglimit if (deathmatch && fraglimit && fraglimit <= D_GetFragCount (source->player)) { Printf ("%s\n", GStrings("TXT_FRAGLIMIT")); G_ExitLevel (0, false); } } } else if (!multiplayer && CountsAsKill()) { // count all monster deaths, // even those caused by other monsters players[0].killcount++; } if (player) { // [RH] Death messages ClientObituary (this, inflictor, source, dmgflags); // Death script execution, care of Skull Tag FBehavior::StaticStartTypedScripts (SCRIPT_Death, this, true); // [RH] Force a delay between death and respawn player->respawn_time = level.time + TICRATE; //Added by MC: Respawn bots if (bglobal.botnum && !demoplayback) { if (player->Bot != NULL) player->Bot->t_respawn = (pr_botrespawn()%15)+((bglobal.botnum-1)*2)+TICRATE+1; //Added by MC: Discard enemies. for (int i = 0; i < MAXPLAYERS; i++) { if (players[i].Bot != NULL && this == players[i].Bot->enemy) { if (players[i].Bot->dest == players[i].Bot->enemy) players[i].Bot->dest = NULL; players[i].Bot->enemy = NULL; } } player->spreecount = 0; player->multicount = 0; } // count environment kills against you if (!source) { player->frags[player - players]++; player->fragcount--; // [RH] Cumulative frag count } flags &= ~MF_SOLID; player->playerstate = PST_DEAD; P_DropWeapon (player); if (this == players[consoleplayer].camera && automapactive) { // don't die in auto map, switch view prior to dying AM_Stop (); } // [GRB] Clear extralight. When you killed yourself with weapon that // called A_Light1/2 before it called A_Light0, extraligh remained. player->extralight = 0; } // [RH] If this is the unmorphed version of another monster, destroy this // actor, because the morphed version is the one that will stick around in // the level. if (flags & MF_UNMORPHED) { Destroy (); return; } FState *diestate = NULL; int gibhealth = GibHealth(); ActorFlags4 iflags4 = inflictor == NULL ? ActorFlags4::FromInt(0) : inflictor->flags4; bool extremelydead = ((health < gibhealth || iflags4 & MF4_EXTREMEDEATH) && !(iflags4 & MF4_NOEXTREMEDEATH)); // Special check for 'extreme' damage type to ensure that it gets recorded properly as an extreme death for subsequent checks. if (DamageType == NAME_Extreme) { extremelydead = true; DamageType = NAME_None; } // find the appropriate death state. The order is: // // 1. If damagetype is not 'none' and death is extreme, try a damage type specific extreme death state // 2. If no such state is found or death is not extreme try a damage type specific normal death state // 3. If damagetype is 'ice' and actor is a monster or player, try the generic freeze death (unless prohibited) // 4. If no state has been found and death is extreme, try the extreme death state // 5. If no such state is found or death is not extreme try the regular death state. // 6. If still no state has been found, destroy the actor immediately. if (DamageType != NAME_None) { if (extremelydead) { FName labels[] = { NAME_Death, NAME_Extreme, DamageType }; diestate = FindState(3, labels, true); } if (diestate == NULL) { diestate = FindState (NAME_Death, DamageType, true); if (diestate != NULL) extremelydead = false; } if (diestate == NULL) { if (DamageType == NAME_Ice) { // If an actor doesn't have an ice death, we can still give them a generic one. if (!deh.NoAutofreeze && !(flags4 & MF4_NOICEDEATH) && (player || (flags3 & MF3_ISMONSTER))) { diestate = FindState(NAME_GenericFreezeDeath); extremelydead = false; } } } } if (diestate == NULL) { // Don't pass on a damage type this actor cannot handle. // (most importantly, prevent barrels from passing on ice damage.) // Massacre must be preserved though. if (DamageType != NAME_Massacre) { DamageType = NAME_None; } if (extremelydead) { // Extreme death diestate = FindState (NAME_Death, NAME_Extreme, true); } if (diestate == NULL) { // Normal death extremelydead = false; diestate = FindState (NAME_Death); } } if (extremelydead) { // We'll only get here if an actual extreme death state was used. // For players, mark the appropriate flag. if (player != NULL) { player->cheats |= CF_EXTREMELYDEAD; } // If a non-player, mark as extremely dead for the crash state. else if (health >= gibhealth) { health = gibhealth - 1; } } if (diestate != NULL) { SetState (diestate); if (tics > 1) { tics -= pr_killmobj() & 3; if (tics < 1) tics = 1; } } else { Destroy(); } }
std::vector<size_t> D_DoomWadReboot( const std::vector<std::string> &wadnames, const std::vector<std::string> &patch_files, std::vector<std::string> needhashes ) { std::vector<size_t> fails; size_t i; // already loaded these? if (lastWadRebootSuccess && !wadhashes.empty() && needhashes == std::vector<std::string>(wadhashes.begin()+1, wadhashes.end())) { // fast track if files have not been changed // denis - todo - actually check the file timestamps Printf (PRINT_HIGH, "Currently loaded WADs match server checksum\n\n"); return std::vector<size_t>(); } // assume failure lastWadRebootSuccess = false; if (modifiedgame && (gameinfo.flags & GI_SHAREWARE)) I_Error ("\nYou cannot switch WAD with the shareware version. Register!"); if(gamestate == GS_LEVEL) G_ExitLevel(0, 0); AM_Stop(); S_Stop(); DThinker::DestroyAllThinkers(); // Close all open WAD files W_Close(); // [ML] 9/11/10: Reset custom wad level information from MAPINFO et al. // I have never used memset, I hope I am not invoking satan by doing this :( if (wadlevelinfos) { for (i = 0; i < numwadlevelinfos; i++) if (wadlevelinfos[i].snapshot) { delete wadlevelinfos[i].snapshot; wadlevelinfos[i].snapshot = NULL; } memset(wadlevelinfos,0,sizeof(wadlevelinfos)); numwadlevelinfos = 0; } if (wadclusterinfos) { memset(wadclusterinfos,0,sizeof(wadclusterinfos)); numwadclusterinfos = 0; } // Restart the memory manager Z_Init(); gamestate_t oldgamestate = gamestate; gamestate = GS_STARTUP; // prevent console from trying to use nonexistant font wadfiles.clear(); modifiedgame = false; std::string custwad; if(wadnames.empty() == false) custwad = wadnames[0]; D_AddDefWads(custwad); for(i = 0; i < wadnames.size(); i++) { std::string tmp = wadnames[i]; // strip absolute paths, as they present a security risk FixPathSeparator(tmp); size_t slash = tmp.find_last_of(PATHSEPCHAR); if(slash != std::string::npos) tmp = tmp.substr(slash + 1, tmp.length() - slash); // [Russell] - Generate a hash if it doesn't exist already if (needhashes[i].empty()) needhashes[i] = W_MD5(tmp); std::string file = BaseFileSearch(tmp, ".wad", needhashes[i]); if(file.length()) wadfiles.push_back(file); else { Printf (PRINT_HIGH, "could not find WAD: %s\n", tmp.c_str()); fails.push_back(i); } } if(wadnames.size() > 1) modifiedgame = true; wadhashes = W_InitMultipleFiles (wadfiles); UndoDehPatch(); // [RH] Initialize localizable strings. GStrings.ResetStrings (); GStrings.Compact (); D_DoDefDehackedPatch(patch_files); //gotconback = false; //C_InitConsole(DisplayWidth, DisplayHeight, true); HU_Init (); if(!(DefaultPalette = InitPalettes("PLAYPAL"))) I_Error("Could not reinitialize palette"); V_InitPalette(); G_SetLevelStrings (); G_ParseMapInfo (); G_ParseMusInfo (); S_ParseSndInfo(); M_Init(); R_Init(); P_InitEffects(); // [ML] Do this here so we don't have to put particle crap in server P_Init(); S_Init (snd_sfxvolume, snd_musicvolume); ST_Init(); // preserve state lastWadRebootSuccess = fails.empty(); gamestate = oldgamestate; // GS_STARTUP would prevent netcode connecting properly return fails; }
// Called at new frame, if the video mode has changed // void SCR_Recalc(void) { if (dedicated) return; // bytes per pixel quick access scr_bpp = vid.bpp; // scale 1,2,3 times in x and y the patches for the menus and overlays... // calculated once and for all, used by routines in v_video.c vid.dupx = vid.width / BASEVIDWIDTH; vid.dupy = vid.height / BASEVIDHEIGHT; vid.dupx = vid.dupy = (vid.dupx < vid.dupy ? vid.dupx : vid.dupy); vid.fdupx = FixedDiv(vid.width*FRACUNIT, BASEVIDWIDTH*FRACUNIT); vid.fdupy = FixedDiv(vid.height*FRACUNIT, BASEVIDHEIGHT*FRACUNIT); #ifdef HWRENDER //if (rendermode != render_opengl && rendermode != render_none) // This was just placing it incorrectly at non aspect correct resolutions in opengl // 13/11/18: // The above is no longer necessary, since we want OpenGL to be just like software now // -- Monster Iestyn #endif vid.fdupx = vid.fdupy = (vid.fdupx < vid.fdupy ? vid.fdupx : vid.fdupy); //vid.baseratio = FixedDiv(vid.height << FRACBITS, BASEVIDHEIGHT << FRACBITS); vid.baseratio = FRACUNIT; vid.meddupx = (UINT8)(vid.dupx >> 1) + 1; vid.meddupy = (UINT8)(vid.dupy >> 1) + 1; #ifdef HWRENDER vid.fmeddupx = vid.meddupx*FRACUNIT; vid.fmeddupy = vid.meddupy*FRACUNIT; #endif vid.smalldupx = (UINT8)(vid.dupx / 3) + 1; vid.smalldupy = (UINT8)(vid.dupy / 3) + 1; #ifdef HWRENDER vid.fsmalldupx = vid.smalldupx*FRACUNIT; vid.fsmalldupy = vid.smalldupy*FRACUNIT; #endif // toggle off automap because some screensize-dependent values will // be calculated next time the automap is activated. if (automapactive) AM_Stop(); // r_plane stuff: visplanes, openings, floorclip, ceilingclip, spanstart, // spanstop, yslope, distscale, cachedheight, cacheddistance, // cachedxstep, cachedystep // -> allocated at the maximum vidsize, static. // r_main: xtoviewangle, allocated at the maximum size. // r_things: negonearray, screenheightarray allocated max. size. // set the screen[x] ptrs on the new vidbuffers V_Init(); // scr_viewsize doesn't change, neither detailLevel, but the pixels // per screenblock is different now, since we've changed resolution. R_SetViewSize(); //just set setsizeneeded true now .. // vid.recalc lasts only for the next refresh... con_recalc = true; am_recalc = true; }
void P_Stop(void) { int i = 0; int action = gameaction; // // [d64] stop plasma buzz // S_StopSound(NULL, sfx_electric); for(i = 0; i < MAXPLAYERS; i++) { // take away cards and stuff if(playeringame[i]) { G_PlayerFinishLevel(i); } } // [kex] reset damage indicators if(p_damageindicator.value) { ST_ClearDamageMarkers(); } // free level tags Z_FreeTags(PU_LEVEL, PU_PURGELEVEL-1); if(automapactive) { AM_Stop(); } // music continues on exit if defined if(!P_GetMapInfo(gamemap)->contmusexit) { S_StopMusic(); } // end iwad demo playback here if(demoplayback && iwadDemo) { demoplayback = false; iwadDemo = false; } // do wipe/melt effect if(gameaction != ga_loadgame) { if(r_wipe.value) { if(gameaction != ga_warpquick) { WIPE_MeltScreen(); } else { S_StopMusic(); WIPE_FadeScreen(8); } } else { if(gameaction == ga_warpquick) { S_StopMusic(); } } } S_ResetSound(); // action is warpquick only because the user // cancelled demo playback... // boot the user back to the title screen if(gameaction == ga_warpquick && demoplayback) { gameaction = ga_title; demoplayback = false; } else { gameaction = action; } }
boolean AM_Responder (event_t *ev) { int rc; static int cheatstate=0; static int bigstate=0; rc = false; if (!automapactive) { if (ev->type == ev_keydown && ev->data1 == AM_STARTKEY && gamestate == GS_LEVEL) { AM_Start (); SB_state = -1; viewactive = false; rc = true; } } else if (ev->type == ev_keydown) { rc = true; switch(ev->data1) { case AM_PANRIGHTKEY: // pan right if (!followplayer) m_paninc.x = FTOM(F_PANINC); else rc = false; break; case AM_PANLEFTKEY: // pan left if (!followplayer) m_paninc.x = -FTOM(F_PANINC); else rc = false; break; case AM_PANUPKEY: // pan up if (!followplayer) m_paninc.y = FTOM(F_PANINC); else rc = false; break; case AM_PANDOWNKEY: // pan down if (!followplayer) m_paninc.y = -FTOM(F_PANINC); else rc = false; break; case AM_ZOOMOUTKEY: // zoom out mtof_zoommul = M_ZOOMOUT; ftom_zoommul = M_ZOOMIN; break; case AM_ZOOMINKEY: // zoom in mtof_zoommul = M_ZOOMIN; ftom_zoommul = M_ZOOMOUT; break; case AM_ENDKEY: bigstate = 0; viewactive = true; AM_Stop (); SB_state = -1; break; case AM_GOBIGKEY: bigstate = !bigstate; if (bigstate) { AM_saveScaleAndLoc(); AM_minOutWindowScale(); } else AM_restoreScaleAndLoc(); break; case AM_FOLLOWKEY: followplayer = !followplayer; f_oldloc.x = MAXINT; P_SetMessage(plr, followplayer ? AMSTR_FOLLOWON : AMSTR_FOLLOWOFF, true); break; default: cheatstate=0; rc = false; } if(cheat_kills[ShowKillsCount] == ev->data1 && netgame && deathmatch) { ShowKillsCount++; if(ShowKillsCount == 5) { ShowKillsCount = 0; rc = false; ShowKills ^= 1; } } else { ShowKillsCount = 0; } } else if (ev->type == ev_keyup) { rc = false; switch (ev->data1) { case AM_PANRIGHTKEY: if (!followplayer) m_paninc.x = 0; break; case AM_PANLEFTKEY: if (!followplayer) m_paninc.x = 0; break; case AM_PANUPKEY: if (!followplayer) m_paninc.y = 0; break; case AM_PANDOWNKEY: if (!followplayer) m_paninc.y = 0; break; case AM_ZOOMOUTKEY: case AM_ZOOMINKEY: mtof_zoommul = FRACUNIT; ftom_zoommul = FRACUNIT; break; } } return rc; }
// // AM_Responder() // // Handle events (user inputs) in automap mode // // Passed an input event, returns true if its handled // boolean AM_Responder ( event_t* ev ) { int rc; static int cheatstate=0; static int bigstate=0; static char buffer[20]; int ch; // phares rc = false; if (!automapactive) { if (ev->type == ev_keydown && ev->data1 == key_map) // phares { AM_Start (); viewactive = false; rc = true; } } else if (ev->type == ev_keydown) { rc = true; ch = ev->data1; // phares if (ch == key_map_right) // | if (!followplayer) // V m_paninc.x = FTOM(F_PANINC); else rc = false; else if (ch == key_map_left) if (!followplayer) m_paninc.x = -FTOM(F_PANINC); else rc = false; else if (ch == key_map_up) if (!followplayer) m_paninc.y = FTOM(F_PANINC); else rc = false; else if (ch == key_map_down) if (!followplayer) m_paninc.y = -FTOM(F_PANINC); else rc = false; else if (ch == key_map_zoomout) { mtof_zoommul = M_ZOOMOUT; ftom_zoommul = M_ZOOMIN; } else if (ch == key_map_zoomin) { mtof_zoommul = M_ZOOMIN; ftom_zoommul = M_ZOOMOUT; } else if (ch == key_map) { bigstate = 0; viewactive = true; AM_Stop (); } else if (ch == key_map_gobig) { bigstate = !bigstate; if (bigstate) { AM_saveScaleAndLoc(); AM_minOutWindowScale(); } else AM_restoreScaleAndLoc(); } else if (ch == key_map_follow) { followplayer = !followplayer; f_oldloc.x = MAXINT; // Ty 03/27/98 - externalized plr->message = followplayer ? s_AMSTR_FOLLOWON : s_AMSTR_FOLLOWOFF; } else if (ch == key_map_grid) { automap_grid = !automap_grid; // killough 2/28/98 // Ty 03/27/98 - *not* externalized plr->message = automap_grid ? s_AMSTR_GRIDON : s_AMSTR_GRIDOFF; } else if (ch == key_map_mark) { // Ty 03/27/98 - *not* externalized sprintf(buffer, "%s %d", s_AMSTR_MARKEDSPOT, markpointnum); plr->message = buffer; AM_addMark(); } else if (ch == key_map_clear) { AM_clearMarks(); // Ty 03/27/98 - *not* externalized plr->message = s_AMSTR_MARKSCLEARED; // ^ } // | else // phares { cheatstate=0; rc = false; } } else if (ev->type == ev_keyup) { rc = false; ch = ev->data1; if (ch == key_map_right) { if (!followplayer) m_paninc.x = 0; } else if (ch == key_map_left) { if (!followplayer) m_paninc.x = 0; } else if (ch == key_map_up) { if (!followplayer) m_paninc.y = 0; } else if (ch == key_map_down) { if (!followplayer) m_paninc.y = 0; } else if ((ch == key_map_zoomout) || (ch == key_map_zoomin)) { mtof_zoommul = FRACUNIT; ftom_zoommul = FRACUNIT; } } return rc; }
void P_KillMobj(mobj_t* source, mobj_t* target) { mobjtype_t item; mobj_t* mo; target->flags &= ~(MF_SHOOTABLE|MF_FLOAT|MF_SKULLFLY); if(target->type != MT_SKULL && (!(target->flags & MF_GRAVITY))) { target->flags |= MF_GRAVITY; } target->flags |= MF_CORPSE|MF_DROPOFF; target->height >>= 2; if(source && source->player) { // count for intermission if(target->flags & MF_COUNTKILL) { source->player->killcount++; } if(target->player) { source->player->frags[target->player-players]++; } } else if(!netgame && (target->flags & MF_COUNTKILL)) { // count all monster deaths, // even those caused by other monsters players[0].killcount++; } if(target->player) { // count environment kills against you if(!source) { target->player->frags[target->player-players]++; } target->flags &= ~MF_SOLID; target->player->playerstate = PST_DEAD; P_DropWeapon(target->player); deathmocktics = gametic; if(target->player == &players[consoleplayer] && automapactive) { // don't die in auto map, // switch view prior to dying AM_Stop(); } // 20120123 villsa - obituaries! if(netgame) { P_Obituary(source, target); } } if(target->health < -target->info->spawnhealth && target->info->xdeathstate) { P_SetMobjState(target, target->info->xdeathstate); } else { P_SetMobjState(target, target->info->deathstate); } target->tics -= P_Random(pr_killtics)&3; if(target->tics < 1) { target->tics = 1; } // Drop stuff. // This determines the kind of object spawned // during the death frame of a thing. switch(target->type) { case MT_POSSESSED1: item = MT_AMMO_CLIP; break; case MT_POSSESSED2: item = MT_WEAP_SHOTGUN; break; default: return; } mo = P_SpawnMobj(target->x,target->y,ONFLOORZ, item); mo->flags |= MF_DROPPED; // special versions of items }
boolean AM_Responder (event_t *ev) { int rc; static int cheatstate=0; static int bigstate=0; rc = false; if (!automapactive) { if (ev->type == ev_keydown && ev->data1 == AM_STARTKEY && gamestate == GS_LEVEL) { AM_Start (); viewactive = false; // viewactive = true; rc = true; } } else if (ev->type == ev_keydown) { rc = true; switch(ev->data1) { case AM_PANRIGHTKEY: // pan right if (!followplayer) m_paninc.x = FTOM(F_PANINC); else rc = false; break; case AM_PANLEFTKEY: // pan left if (!followplayer) m_paninc.x = -FTOM(F_PANINC); else rc = false; break; case AM_PANUPKEY: // pan up if (!followplayer) m_paninc.y = FTOM(F_PANINC); else rc = false; break; case AM_PANDOWNKEY: // pan down if (!followplayer) m_paninc.y = -FTOM(F_PANINC); else rc = false; break; case AM_ZOOMOUTKEY: // zoom out mtof_zoommul = M_ZOOMOUT; ftom_zoommul = M_ZOOMIN; break; case AM_ZOOMINKEY: // zoom in mtof_zoommul = M_ZOOMIN; ftom_zoommul = M_ZOOMOUT; break; case AM_ENDKEY: bigstate = 0; viewactive = true; AM_Stop (); break; case AM_GOBIGKEY: bigstate = !bigstate; if (bigstate) { AM_saveScaleAndLoc(); AM_minOutWindowScale(); } else AM_restoreScaleAndLoc(); break; case AM_FOLLOWKEY: followplayer = !followplayer; f_oldloc.x = MAXINT; P_SetMessage(plr, followplayer ? AMSTR_FOLLOWON : AMSTR_FOLLOWOFF, true); break; /* case AM_GRIDKEY: grid = !grid; plr->message = grid ? AMSTR_GRIDON : AMSTR_GRIDOFF; break; case AM_MARKKEY: sprintf(buffer, "%s %d", AMSTR_MARKEDSPOT, markpointnum); plr->message = buffer; AM_addMark(); break; case AM_CLEARMARKKEY: AM_clearMarks(); plr->message = AMSTR_MARKSCLEARED; break; */ default: cheatstate=0; rc = false; } if(cheat_amap[cheatcount]==ev->data1 && !netgame) cheatcount++; else cheatcount=0; if(cheatcount==6) { cheatcount=0; rc = false; cheating = (cheating+1) % 3; } } else if (ev->type == ev_keyup) { rc = false; switch (ev->data1) { case AM_PANRIGHTKEY: if (!followplayer) m_paninc.x = 0; break; case AM_PANLEFTKEY: if (!followplayer) m_paninc.x = 0; break; case AM_PANUPKEY: if (!followplayer) m_paninc.y = 0; break; case AM_PANDOWNKEY: if (!followplayer) m_paninc.y = 0; break; case AM_ZOOMOUTKEY: case AM_ZOOMINKEY: mtof_zoommul = FRACUNIT; ftom_zoommul = FRACUNIT; break; } } return rc; }