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; }