void P_LoadThings(int lump) { byte *data; int i; mapthing_t spawnthing; mapthing_t *mt; int numthings; int playerCount; int deathSpotsCount; data = W_CacheLumpNum(lump, PU_STATIC); numthings = W_LumpLength(lump) / sizeof(mapthing_t); mt = (mapthing_t *) data; for (i = 0; i < numthings; i++, mt++) { spawnthing.tid = SHORT(mt->tid); spawnthing.x = SHORT(mt->x); spawnthing.y = SHORT(mt->y); spawnthing.height = SHORT(mt->height); spawnthing.angle = SHORT(mt->angle); spawnthing.type = SHORT(mt->type); spawnthing.options = SHORT(mt->options); spawnthing.special = mt->special; spawnthing.arg1 = mt->arg1; spawnthing.arg2 = mt->arg2; spawnthing.arg3 = mt->arg3; spawnthing.arg4 = mt->arg4; spawnthing.arg5 = mt->arg5; P_SpawnMapThing(&spawnthing); } P_CreateTIDList(); P_InitCreatureCorpseQueue(false); // false = do NOT scan for corpses W_ReleaseLumpNum(lump); if (!deathmatch) { // Don't need to check deathmatch spots return; } playerCount = 0; for (i = 0; i < MAXPLAYERS; i++) { playerCount += playeringame[i]; } deathSpotsCount = deathmatch_p - deathmatchstarts; if (deathSpotsCount < playerCount) { I_Error("P_LoadThings: Player count (%d) exceeds deathmatch " "spots (%d)", playerCount, deathSpotsCount); } }
// // P_LoadThings // void P_LoadThings (int lump) { byte* data; int i; mapthing_t* mt; int numthings; boolean spawn; data = W_CacheLumpNum (lump,PU_STATIC); numthings = W_LumpLength (lump) / sizeof(mapthing_t); mt = (mapthing_t *)data; for (i=0 ; i<numthings ; i++, mt++) { spawn = true; // Do not spawn cool, new monsters if !commercial if ( gamemode != commercial) { switch(mt->type) { case 68: // Arachnotron case 64: // Archvile case 88: // Boss Brain case 89: // Boss Shooter case 69: // Hell Knight case 67: // Mancubus case 71: // Pain Elemental case 65: // Former Human Commando case 66: // Revenant case 84: // Wolf SS spawn = false; break; } } if (spawn == false) break; // Do spawn all other stuff. mt->x = SHORT(mt->x); mt->y = SHORT(mt->y); mt->angle = SHORT(mt->angle); mt->type = SHORT(mt->type); mt->options = SHORT(mt->options); P_SpawnMapThing (mt); } Z_Free (data); }
void P_LoadThings(int lump) { byte *data; int i; mapthing_t *mt; int numthings; data = I_TempBuffer(); W_ReadLump(lump, data); numthings = W_LumpLength(lump) / sizeof(mapthing_t); mt = (mapthing_t *)data; for(i = 0; i < numthings; i++, mt++) { mt->x = LITTLESHORT(mt->x); mt->y = LITTLESHORT(mt->y); mt->angle = LITTLESHORT(mt->angle); mt->type = LITTLESHORT(mt->type); mt->options = LITTLESHORT(mt->options); P_SpawnMapThing(mt); } }
// // Loads things // bool UDMFParser::loadThings() { mapthing_t *mapthings; numthings = (int)mThings.getLength(); mapthings = ecalloc(mapthing_t *, numthings, sizeof(mapthing_t)); for(int i = 0; i < numthings; ++i) { mapthing_t *ft = &mapthings[i]; const uthing_t &ut = mThings[i]; ft->type = ut.type; // no Doom thing ban in UDMF ft->tid = ut.identifier; ft->x = ut.x; ft->y = ut.y; ft->height = ut.height; ft->angle = ut.angle; if(ut.skill1 ^ ut.skill2) ft->extOptions |= MTF_EX_BABY_TOGGLE; if(ut.skill2) ft->options |= MTF_EASY; if(ut.skill3) ft->options |= MTF_NORMAL; if(ut.skill4) ft->options |= MTF_HARD; if(ut.skill4 ^ ut.skill5) ft->extOptions |= MTF_EX_NIGHTMARE_TOGGLE; if(ut.ambush) ft->options |= MTF_AMBUSH; if(!ut.single) ft->options |= MTF_NOTSINGLE; if(!ut.dm) ft->options |= MTF_NOTDM; if(!ut.coop) ft->options |= MTF_NOTCOOP; if(ut.friendly && (mNamespace == namespace_Doom || mNamespace == namespace_Eternity)) ft->options |= MTF_FRIEND; if(ut.dormant && (mNamespace == namespace_Hexen || mNamespace == namespace_Eternity)) ft->options |= MTF_DORMANT; // TODO: class1, 2, 3 // TODO: STRIFE if(mNamespace == namespace_Hexen || mNamespace == namespace_Eternity) { ft->special = ut.special; ft->args[0] = ut.arg[0]; ft->args[1] = ut.arg[1]; ft->args[2] = ut.arg[2]; ft->args[3] = ut.arg[3]; ft->args[4] = ut.arg[4]; } // haleyjd 10/05/05: convert heretic things if(mNamespace == namespace_Heretic) P_ConvertHereticThing(ft); P_ConvertDoomExtendedSpawnNum(ft); P_SpawnMapThing(ft); } // haleyjd: all player things for players in this game should now be valid if(GameType != gt_dm) { for(int i = 0; i < MAXPLAYERS; i++) { if(playeringame[i] && !players[i].mo) { mError = "Missing required player start"; efree(mapthings); return false; } } } efree(mapthings); return true; }