Beispiel #1
0
static int deactivatePlat(thinker_t *th, void *context)
{
    plat_t *plat = (plat_t *) th;
    deactivateplatparams_t *params = (deactivateplatparams_t *) context;

#if __JHEXEN__
    // For THE one with the tag.
    if(plat->tag == params->tag)
    {
        // Destroy it.
        stopPlat(plat);
        params->count++;
        return true; // Stop iteration.
    }
#else
    // For one with the tag and not in stasis.
    if(plat->tag == (int) params->tag && !Thinker_InStasis(&plat->thinker))
    {
        // Put it in stasis.
        plat->oldState = plat->state;
        Thinker_SetStasis(&plat->thinker, true);
        params->count++;
    }
#endif

    return false; // Continue iteration.
}
Beispiel #2
0
static int activatePlat(thinker_t *th, void *context)
{
    plat_t *plat = (plat_t *) th;
    activateplatparams_t *params = (activateplatparams_t *) context;

    if(plat->tag == (int) params->tag && Thinker_InStasis(&plat->thinker))
    {
        plat->state = plat->oldState;
        Thinker_SetStasis(&plat->thinker, false);
        params->count++;
    }

    return false; // Contiue iteration.
}
Beispiel #3
0
    /**
     * Serializes the specified thinker and writes it to save state.
     */
    static int writeThinkerWorker(thinker_t *th, void *context)
    {
        writethinkerworker_params_t const &p = *static_cast<writethinkerworker_params_t *>(context);

        // We are only concerned with thinkers we have save info for.
        ThinkerClassInfo *thInfo = SV_ThinkerInfo(*th);
        if (!thInfo) return false;

        // Are we excluding players?
        if (p.excludePlayers)
        {
            if (th->function == P_MobjThinker && ((mobj_t *) th)->player)
            {
                return false;
            }
        }

        // Only the server saves this class of thinker?
        if ((thInfo->flags & TSF_SERVERONLY) && IS_CLIENT)
        {
            return false;
        }

        // Write the header block for this thinker.
        Writer_WriteByte(p.msw->writer(), thInfo->thinkclass); // Thinker type byte.
        Writer_WriteByte(p.msw->writer(), Thinker_InStasis(th)? 1 : 0); // In stasis?

        // Private identifier of the thinker.
        de::Id::Type const privateId = (th->d? THINKER_DATA(*th, ThinkerData).id().asUInt32() : 0);
        Writer_WriteUInt32(p.msw->writer(), privateId);

        // Write the thinker data.
        thInfo->writeFunc(th, p.msw);

        return false;
    }