static void P_v13_UnArchiveThinkers(void) { typedef enum { TC_END, TC_MOBJ } thinkerclass_t; byte tclass; // Remove all the current thinkers. Thinker_Iterate(NULL, removeThinker, NULL); Thinker_Init(); // read in saved thinkers for(;;) { tclass = Reader_ReadByte(svReader); switch(tclass) { case TC_END: return; // End of list. case TC_MOBJ: SV_v13_ReadMobj(); break; default: Con_Error("Unknown tclass %i in savegame", tclass); } } }
static mobj_t* getTeleportDestination(short tag) { iterlist_t* list; list = P_GetSectorIterListForTag(tag, false); if(list) { Sector* sec = NULL; findmobjparams_t params; params.type = MT_TELEPORTMAN; params.foundMobj = NULL; IterList_SetIteratorDirection(list, ITERLIST_FORWARD); IterList_RewindIterator(list); while((sec = IterList_MoveIterator(list)) != NULL) { params.sec = sec; if(Thinker_Iterate(P_MobjThinker, findMobj, ¶ms)) { // Found one. return params.foundMobj; } } } return NULL; }
int P_PlatDeactivate(short tag) { deactivateplatparams_t parm; parm.tag = tag; parm.count = 0; Thinker_Iterate(T_PlatRaise, deactivatePlat, &parm); return parm.count; }
/** * Activate a plat that has been put in stasis * (stopped perpetual floor, instant floor/ceil toggle) * * @param tag Tag of plats that should be reactivated. */ int P_PlatActivate(short tag) { activateplatparams_t params; params.tag = tag; params.count = 0; Thinker_Iterate(T_PlatRaise, activatePlat, ¶ms); return params.count; }
/** * Serializes thinkers for both client and server. * * @note Clients do not save data for all thinkers. In some cases the server will send it * anyway (so saving it would just bloat client save states). * * @note Some thinker classes are NEVER saved by clients. */ void writeThinkers() { beginSegment(ASEG_THINKERS); #if __JHEXEN__ Writer_WriteInt32(writer, thingArchive->size()); // number of mobjs. #endif // Serialize qualifying thinkers. writethinkerworker_params_t parm; de::zap(parm); parm.msw = thisPublic; parm.excludePlayers = thingArchive->excludePlayers(); Thinker_Iterate(0/*all thinkers*/, writeThinkerWorker, &parm); // Mark the end of the thinkers. // endSegment(); Writer_WriteByte(writer, TC_END); }