//========================================================================== // P_SpawnPlayers // Spawns all players, using the method appropriate for current game mode. // Called during level setup. //========================================================================== void P_SpawnPlayers(void) { int i; // If deathmatch, randomly spawn the active players. if(deathmatch) { for(i = 0; i < MAXPLAYERS; i++) if(players[i].plr->ingame) { players[i].plr->mo = NULL; G_DeathMatchSpawnPlayer(i); } } else { #ifdef __JDOOM__ if(!IS_NETGAME) { mapthing_t *it; // Spawn all unused player starts. This will create 'zombies'. // FIXME: Also in netgames? for(it = playerstarts; it != playerstart_p; it++) if(players[0].startspot != it - playerstarts && it->type == 1) { P_SpawnPlayer(it, 0); } } #endif // Spawn everybody at their assigned places. // Might get messy if there aren't enough starts. for(i = 0; i < MAXPLAYERS; i++) if(players[i].plr->ingame) { ddplayer_t *ddpl = players[i].plr; if(!P_FuzzySpawn (&playerstarts[players[i].startspot], i, false)) { // Gib anything at the spot. P_Telefrag(ddpl->mo); } } } }
void G_DoReborn (int playernum) { int i; if (!netgame) { gameaction = ga_died; /* reload the level from scratch */ return; } /* */ /* respawn this player while the other players keep going */ /* */ players[playernum].mo->player = NULL; /* dissasociate the corpse */ /* spawn at random spot if in death match */ if (netgame == gt_deathmatch) { G_DeathMatchSpawnPlayer (playernum); return; } if (G_CheckSpot (playernum, &playerstarts[playernum]) ) { P_SpawnPlayer (&playerstarts[playernum]); return; } /* try to spawn at one of the other players spots */ for (i=0 ; i<MAXPLAYERS ; i++) if (G_CheckSpot (playernum, &playerstarts[i]) ) { playerstarts[i].type = playernum+1; /* fake as other player */ P_SpawnPlayer (&playerstarts[i]); playerstarts[i].type = i+1; /* restore */ return; } /* he's going to be inside something. Too bad. */ P_SpawnPlayer (&playerstarts[playernum]); }
void G_DoReborn(int playernum) { int i; // quit demo unless -demoextend if (!demoextend && G_CheckDemoStatus()) return; if (!netgame) gameaction = ga_loadlevel; // reload the level from scratch else { // respawn at the start players[playernum].mo->player = NULL; // dissasociate the corpse // spawn at random spot if in death match if (deathmatch) { G_DeathMatchSpawnPlayer(playernum); return; } if (G_CheckSpot(playernum, &playerstarts[playernum])) { P_SpawnPlayer(&playerstarts[playernum]); return; } // try to spawn at one of the other players spots for (i = 0; i < MAXPLAYERS; i++) if (G_CheckSpot(playernum, &playerstarts[i])) { playerstarts[i].type = playernum + 1; // fake as other player P_SpawnPlayer(&playerstarts[i]); playerstarts[i].type = i + 1; // restore return; } // he's going to be inside something. Too bad. P_SpawnPlayer(&playerstarts[playernum]); } }
void G_DoReborn(int playernum) { if(!netgame) { gameaction = ga_loadlevel; // reload the level from scratch } else { // respawn at the start int i; // first dissasociate the corpse if(players[playernum].mo == NULL) { I_Error("G_DoReborn: Player start #%i not found!", playernum+1); } players[playernum].mo->player = NULL; // spawn at random spot if in death match if(deathmatch) { G_DeathMatchSpawnPlayer(playernum); return; } if(G_CheckSpot(playernum, &playerstarts[playernum])) { P_SpawnPlayer(&playerstarts[playernum]); return; } // try to spawn at one of the other players spots for(i = 0; i < MAXPLAYERS; i++) { if(G_CheckSpot(playernum, &playerstarts[i])) { playerstarts[i].type = playernum+1; // fake as other player P_SpawnPlayer(&playerstarts[i]); playerstarts[i].type = i+1; // restore return; } // he's going to be inside something. Too bad. } P_SpawnPlayer(&playerstarts[playernum]); } }
void P_SetupLevel(int episode, int map, int playermask, skill_t skill) { int i; int parm; char lumpname[9]; int lumpnum; mobj_t *mobj; for (i = 0; i < MAXPLAYERS; i++) { players[i].killcount = players[i].secretcount = players[i].itemcount = 0; } players[consoleplayer].viewz = 1; // will be set by player think // Waiting-for-level-load song; not played if playing music from CD // (the seek time will be so long it will just make loading take // longer) if (!cdmusic) { S_StartSongName("chess", true); } Z_FreeTags(PU_LEVEL, PU_PURGELEVEL - 1); P_InitThinkers(); leveltime = 0; sprintf(lumpname, "MAP%02d", map); lumpnum = W_GetNumForName(lumpname); // // Begin processing map lumps // Note: most of this ordering is important // P_LoadBlockMap(lumpnum + ML_BLOCKMAP); P_LoadVertexes(lumpnum + ML_VERTEXES); P_LoadSectors(lumpnum + ML_SECTORS); P_LoadSideDefs(lumpnum + ML_SIDEDEFS); P_LoadLineDefs(lumpnum + ML_LINEDEFS); P_LoadSubsectors(lumpnum + ML_SSECTORS); P_LoadNodes(lumpnum + ML_NODES); P_LoadSegs(lumpnum + ML_SEGS); rejectmatrix = W_CacheLumpNum(lumpnum + ML_REJECT, PU_LEVEL); P_GroupLines(); bodyqueslot = 0; po_NumPolyobjs = 0; deathmatch_p = deathmatchstarts; P_LoadThings(lumpnum + ML_THINGS); PO_Init(lumpnum + ML_THINGS); // Initialize the polyobjs P_LoadACScripts(lumpnum + ML_BEHAVIOR); // ACS object code // // End of map lump processing // // If deathmatch, randomly spawn the active players TimerGame = 0; if (deathmatch) { for (i = 0; i < MAXPLAYERS; i++) { if (playeringame[i]) { // must give a player spot before deathmatchspawn mobj = P_SpawnMobj(playerstarts[0][i].x << 16, playerstarts[0][i].y << 16, 0, MT_PLAYER_FIGHTER); players[i].mo = mobj; G_DeathMatchSpawnPlayer(i); P_RemoveMobj(mobj); } } //! // @arg <n> // @category net // @vanilla // // For multiplayer games: exit each level after n minutes. // parm = M_CheckParmWithArgs("-timer", 1); if (parm) { TimerGame = atoi(myargv[parm + 1]) * 35 * 60; } } // set up world state P_SpawnSpecials(); // build subsector connect matrix // P_ConnectSubsectors (); // Load colormap and set the fullbright flag i = P_GetMapFadeTable(gamemap); W_ReadLump(i, colormaps); if (i == W_GetNumForName("COLORMAP")) { LevelUseFullBright = true; } else { // Probably fog ... don't use fullbright sprites LevelUseFullBright = false; } // preload graphics if (precache) R_PrecacheLevel(); // Check if the level is a lightning level P_InitLightning(); S_StopAllSound(); SN_StopAllSequences(); S_StartSong(gamemap, true); //printf ("free memory: 0x%x\n", Z_FreeMemory()); }
// // P_SetupLevel // void P_SetupLevel ( int episode, int map, int playermask, skill_t skill) { int i; char lumpname[9]; int lumpnum; totalkills = totalitems = totalsecret = wminfo.maxfrags = 0; wminfo.partime = 180; for (i=0 ; i<MAXPLAYERS ; i++) { players[i].killcount = players[i].secretcount = players[i].itemcount = 0; } // Initial height of PointOfView // will be set by player think. players[consoleplayer].viewz = 1; // Make sure all sounds are stopped before Z_FreeTags. S_Start (); #if 0 // UNUSED if (debugfile) { Z_FreeTags (PU_LEVEL, MAXINT); Z_FileDumpHeap (debugfile); } else #endif Z_FreeTags (PU_LEVEL, PU_PURGELEVEL-1); // UNUSED W_Profile (); P_InitThinkers (); // if working with a devlopment map, reload it W_Reload (); // find map name if ( gamemode == commercial) { if (map<10) sprintf (lumpname,"map0%i", map); else sprintf (lumpname,"map%i", map); } else { lumpname[0] = 'E'; lumpname[1] = '0' + episode; lumpname[2] = 'M'; lumpname[3] = '0' + map; lumpname[4] = 0; } lumpnum = W_GetNumForName (lumpname); leveltime = 0; // note: most of this ordering is important P_LoadBlockMap (lumpnum+ML_BLOCKMAP); P_LoadVertexes (lumpnum+ML_VERTEXES); P_LoadSectors (lumpnum+ML_SECTORS); P_LoadSideDefs (lumpnum+ML_SIDEDEFS); P_LoadLineDefs (lumpnum+ML_LINEDEFS); P_LoadSubsectors (lumpnum+ML_SSECTORS); P_LoadNodes (lumpnum+ML_NODES); P_LoadSegs (lumpnum+ML_SEGS); rejectmatrix = W_CacheLumpNum (lumpnum+ML_REJECT,PU_LEVEL); P_GroupLines (); bodyqueslot = 0; deathmatch_p = deathmatchstarts; P_LoadThings (lumpnum+ML_THINGS); // if deathmatch, randomly spawn the active players if (deathmatch) { for (i=0 ; i<MAXPLAYERS ; i++) if (playeringame[i]) { players[i].mo = NULL; G_DeathMatchSpawnPlayer (i); } } // clear special respawning que iquehead = iquetail = 0; // set up world state P_SpawnSpecials (); // build subsector connect matrix // UNUSED P_ConnectSubsectors (); // preload graphics if (precache) R_PrecacheLevel (); //printf ("free memory: 0x%x\n", Z_FreeMemory()); }
//***************************************************************************** // void DUEL_DoFight( void ) { ULONG ulIdx; DHUDMessageFadeOut *pMsg; // No longer waiting to duel. if ( NETWORK_GetState( ) != NETSTATE_CLIENT ) DUEL_SetState( DS_INDUEL ); // Make sure this is 0. Can be non-zero in network games if they're slightly out of sync. g_ulDuelCountdownTicks = 0; // Reset level time to 0. level.time = 0; for ( ulIdx = 0; ulIdx < MAXPLAYERS; ulIdx++ ) { // Since the level time is being reset, also reset the last frag/excellent time for // each player. players[ulIdx].ulLastExcellentTick = 0; players[ulIdx].ulLastFragTick = 0; players[ulIdx].ulLastBFGFragTick = 0; players[ulIdx].ulDeathsWithoutFrag = 0; players[ulIdx].ulFragsWithoutDeath = 0; players[ulIdx].ulRailgunShots = 0; } // Tell clients to "fight!". if ( NETWORK_GetState( ) == NETSTATE_SERVER ) SERVERCOMMANDS_DoGameModeFight( 0 ); if ( NETWORK_GetState( ) != NETSTATE_SERVER ) { // Play fight sound. ANNOUNCER_PlayEntry( cl_announcer, "Fight" ); screen->SetFont( BigFont ); // Display "FIGHT!" HUD message. pMsg = new DHUDMessageFadeOut( "FIGHT!", 160.4f, 75.0f, 320, 200, CR_RED, 2.0f, 1.0f ); StatusBar->AttachMessage( pMsg, 'CNTR' ); screen->SetFont( SmallFont ); } // Display a little thing in the server window so servers can know when matches begin. else Printf( "FIGHT!\n" ); // Reset the map. if ( NETWORK_GetState( ) != NETSTATE_CLIENT ) GAME_ResetMap( ); if ( NETWORK_GetState( ) != NETSTATE_CLIENT ) { // Respawn the players. for ( ulIdx = 0; ulIdx < MAXPLAYERS; ulIdx++ ) { if (( playeringame[ulIdx] ) && ( PLAYER_IsTrueSpectator( &players[ulIdx] ) == false )) { if ( players[ulIdx].mo ) { if ( NETWORK_GetState( ) == NETSTATE_SERVER ) SERVERCOMMANDS_DestroyThing( players[ulIdx].mo ); players[ulIdx].mo->Destroy( ); players[ulIdx].mo = NULL; } // Set the player's state to PST_REBORNNOINVENTORY so they everything is cleared (weapons, etc.) players[ulIdx].playerstate = PST_REBORNNOINVENTORY; G_DeathMatchSpawnPlayer( ulIdx, true ); if ( players[ulIdx].pSkullBot ) players[ulIdx].pSkullBot->PostEvent( BOTEVENT_DUEL_FIGHT ); } } } SCOREBOARD_RefreshHUD( ); }
void P_SetupLevel(int episode, int map, int playermask, skill_t skill) { int i; int parm; char lumpname[9]; char auxName[128]; int lumpnum; mobj_t *mobj; for(i = 0; i < MAXPLAYERS; i++) { players[i].killcount = players[i].secretcount = players[i].itemcount = 0; } players[consoleplayer].viewz = 1; // will be set by player think #ifdef __WATCOMC__ if(i_CDMusic == false) { S_StartSongName("chess", true); // Waiting-for-level-load song } #endif Z_FreeTags(PU_LEVEL, PU_PURGELEVEL-1); P_InitThinkers(); leveltime = 0; if(DevMaps) { sprintf(auxName, "%sMAP%02d.WAD", DevMapsDir, map); W_OpenAuxiliary(auxName); } sprintf(lumpname, "MAP%02d", map); lumpnum = W_GetNumForName(lumpname); // // Begin processing map lumps // Note: most of this ordering is important // P_LoadBlockMap(lumpnum+ML_BLOCKMAP); P_LoadVertexes(lumpnum+ML_VERTEXES); P_LoadSectors(lumpnum+ML_SECTORS); P_LoadSideDefs(lumpnum+ML_SIDEDEFS); P_LoadLineDefs(lumpnum+ML_LINEDEFS); P_LoadSubsectors(lumpnum+ML_SSECTORS); P_LoadNodes(lumpnum+ML_NODES); P_LoadSegs(lumpnum+ML_SEGS); rejectmatrix = W_CacheLumpNum(lumpnum+ML_REJECT, PU_LEVEL); P_GroupLines(); bodyqueslot = 0; po_NumPolyobjs = 0; deathmatch_p = deathmatchstarts; P_LoadThings(lumpnum+ML_THINGS); PO_Init(lumpnum+ML_THINGS); // Initialize the polyobjs P_LoadACScripts(lumpnum+ML_BEHAVIOR); // ACS object code // // End of map lump processing // if(DevMaps) { // Close the auxiliary file, but don't free its loaded lumps. // The next call to W_OpenAuxiliary() will do a full shutdown // of the current auxiliary WAD (free lumps and info lists). W_CloseAuxiliaryFile(); W_UsePrimary(); } // If deathmatch, randomly spawn the active players TimerGame = 0; if(deathmatch) { for (i=0 ; i<MAXPLAYERS ; i++) { if (playeringame[i]) { // must give a player spot before deathmatchspawn mobj = P_SpawnMobj (playerstarts[0][i].x<<16, playerstarts[0][i].y<<16,0, MT_PLAYER_FIGHTER); players[i].mo = mobj; G_DeathMatchSpawnPlayer (i); P_RemoveMobj (mobj); } } parm = M_CheckParm("-timer"); if(parm && parm < myargc-1) { TimerGame = atoi(myargv[parm+1])*35*60; } } // set up world state P_SpawnSpecials (); // build subsector connect matrix // P_ConnectSubsectors (); // Load colormap and set the fullbright flag i = P_GetMapFadeTable(gamemap); W_ReadLump(i, colormaps); if(i == W_GetNumForName("COLORMAP")) { LevelUseFullBright = true; } else { // Probably fog ... don't use fullbright sprites LevelUseFullBright = false; } // preload graphics if (precache) R_PrecacheLevel (); // Check if the level is a lightning level P_InitLightning(); S_StopAllSound(); SN_StopAllSequences(); S_StartSong(gamemap, true); //printf ("free memory: 0x%x\n", Z_FreeMemory()); }
void P_SetupLevel(int map, skill_t skill) { int i; static char lumpname[16]; int lumpnum; mobj_t *mobj; extern int cy; M_ClearRandom(); P_LoadingPlaque(); D_printf("P_SetupLevel(%i,%i)\n", map, skill); totalkills = totalitems = totalsecret = 0; for(i = 0; i < MAXPLAYERS; i++) players[i].killcount = players[i].secretcount = players[i].itemcount = 0; Z_CheckHeap(mainzone); Z_CheckHeap(refzone); Z_FreeTags(mainzone); P_InitThinkers(); // // look for a regular (development) map first // lumpname[0] = 'M'; lumpname[1] = 'A'; lumpname[2] = 'P'; lumpname[3] = '0' + map / 10; lumpname[4] = '0' + map % 10; lumpname[5] = 0; lumpnum = W_GetNumForName(lumpname); // note: most of this ordering is important P_LoadBlockMap(lumpnum+ML_BLOCKMAP); P_LoadVertexes(lumpnum+ML_VERTEXES); P_LoadSectors(lumpnum+ML_SECTORS); P_LoadSideDefs(lumpnum+ML_SIDEDEFS); P_LoadLineDefs(lumpnum+ML_LINEDEFS); P_LoadSubsectors(lumpnum+ML_SSECTORS); P_LoadNodes(lumpnum+ML_NODES); P_LoadSegs(lumpnum+ML_SEGS); rejectmatrix = W_CacheLumpNum(lumpnum + ML_REJECT, PU_LEVEL); P_GroupLines(); deathmatch_p = deathmatchstarts; P_LoadThings(lumpnum + ML_THINGS); // // if deathmatch, randomly spawn the active players // if(netgame == gt_deathmatch) { for(i = 0; i < MAXPLAYERS; i++) { if(playeringame[i]) { // must give a player spot before deathmatchspawn mobj = P_SpawnMobj(deathmatchstarts[0].x << 16 ,deathmatchstarts[0].y << 16, 0, MT_PLAYER); players[i].mo = mobj; G_DeathMatchSpawnPlayer(i); P_RemoveMobj(mobj); } } } // set up world state P_SpawnSpecials(); ST_InitEveryLevel(); cy = 4; iquehead = iquetail = 0; gamepaused = false; }
void P_SetupLevel (int map, skill_t skill) { int i; static char lumpname[16]; int lumpnum; mobj_t *mobj; extern int cy; M_ClearRandom (); P_LoadingPlaque (); D_printf ("P_SetupLevel(%i,%i)\n",map,skill); totalkills = totalitems = totalsecret = 0; for (i=0 ; i<MAXPLAYERS ; i++) { players[i].killcount = players[i].secretcount = players[i].itemcount = 0; } Z_CheckHeap (mainzone); #ifndef MARS Z_CheckHeap (refzone); #endif Z_FreeTags (mainzone); /*PrintHex (1,1,Z_FreeMemory (mainzone)); */ P_InitThinkers (); /* */ /* look for a regular (development) map first */ /* */ lumpname[0] = 'M'; lumpname[1] = 'A'; lumpname[2] = 'P'; lumpname[3] = '0' + map/10; lumpname[4] = '0' + map%10; lumpname[5] = 0; lumpnum = W_GetNumForName (lumpname); /* note: most of this ordering is important */ P_LoadBlockMap (lumpnum+ML_BLOCKMAP); P_LoadVertexes (lumpnum+ML_VERTEXES); P_LoadSectors (lumpnum+ML_SECTORS); P_LoadSideDefs (lumpnum+ML_SIDEDEFS); P_LoadLineDefs (lumpnum+ML_LINEDEFS); P_LoadSubsectors (lumpnum+ML_SSECTORS); P_LoadNodes (lumpnum+ML_NODES); P_LoadSegs (lumpnum+ML_SEGS); #ifdef MARS rejectmatrix = (byte *)(wadfileptr+BIGLONG(lumpinfo[lumpnum+ML_REJECT].filepos)); #else rejectmatrix = W_CacheLumpNum (lumpnum+ML_REJECT,PU_LEVEL); #endif P_GroupLines (); deathmatch_p = deathmatchstarts; P_LoadThings (lumpnum+ML_THINGS); /* */ /* if deathmatch, randomly spawn the active players */ /* */ if (netgame == gt_deathmatch) { for (i=0 ; i<MAXPLAYERS ; i++) if (playeringame[i]) { /* must give a player spot before deathmatchspawn */ mobj = P_SpawnMobj (deathmatchstarts[0].x<<16 ,deathmatchstarts[0].y<<16,0, MT_PLAYER); players[i].mo = mobj; G_DeathMatchSpawnPlayer (i); P_RemoveMobj (mobj); } } /* set up world state */ P_SpawnSpecials (); ST_InitEveryLevel (); /*printf ("free memory: 0x%x\n", Z_FreeMemory(mainzone)); */ cy = 4; #ifdef JAGUAR { extern byte *debugscreen; D_memset (debugscreen,0,32*224); } #endif iquehead = iquetail = 0; gamepaused = false; }