Esempio n. 1
0
/**
 * Called when a moving plat needs to be removed.
 *
 * @param plat  Ptr to the plat to remove.
 */
static void stopPlat(plat_t *plat)
{
    DENG2_ASSERT(plat);
    P_ToXSector(plat->sector)->specialData = nullptr;
    P_NotifySectorFinished(P_ToXSector(plat->sector)->tag);
    Thinker_Remove(&plat->thinker);
}
Esempio n. 2
0
void T_BuildPillar(pillar_t *pillar)
{
    DENG2_ASSERT(pillar);

    // First, raise the floor
    result_e res1 = T_MovePlane(pillar->sector, pillar->floorSpeed, pillar->floorDest, pillar->crush, 0, pillar->direction); // floorOrCeiling, direction
    // Then, lower the ceiling
    result_e res2 = T_MovePlane(pillar->sector, pillar->ceilingSpeed, pillar->ceilingDest, pillar->crush, 1, -pillar->direction);
    if(res1 == pastdest && res2 == pastdest)
    {
        P_ToXSector(pillar->sector)->specialData = 0;
        SN_StopSequenceInSec(pillar->sector);
        P_NotifySectorFinished(P_ToXSector(pillar->sector)->tag);
        Thinker_Remove(&pillar->thinker);
    }
}
Esempio n. 3
0
void T_FloorWaggle(waggle_t *waggle)
{
    DENG_ASSERT(waggle != 0);

    switch(waggle->state)
    {
    default:
    case WS_STABLE:
        if(waggle->ticker != -1)
        {
            if(!--waggle->ticker)
            {
                waggle->state = WS_REDUCE;
            }
        }
        break;

    case WS_EXPAND:
        if((waggle->scale += waggle->scaleDelta) >= waggle->targetScale)
        {
            waggle->scale = waggle->targetScale;
            waggle->state = WS_STABLE;
        }
        break;

    case WS_REDUCE:
        if((waggle->scale -= waggle->scaleDelta) <= 0)
        {
            // Remove.
            P_SetDoublep(waggle->sector, DMU_FLOOR_HEIGHT, waggle->originalHeight);
            P_ChangeSector(waggle->sector, 1 /*crush damage*/);
            P_ToXSector(waggle->sector)->specialData = nullptr;
            P_NotifySectorFinished(P_ToXSector(waggle->sector)->tag);
            Thinker_Remove(&waggle->thinker);
            return;
        }
        break;
    }

    waggle->accumulator += waggle->accDelta;
    coord_t fh = waggle->originalHeight +
        FLOATBOBOFFSET(((int) waggle->accumulator) & 63) * waggle->scale;
    P_SetDoublep(waggle->sector, DMU_FLOOR_HEIGHT, fh);
    P_SetDoublep(waggle->sector, DMU_FLOOR_TARGET_HEIGHT, fh);
    P_SetFloatp(waggle->sector, DMU_FLOOR_SPEED, 0);
    P_ChangeSector(waggle->sector, 1 /*crush damage*/);
}