int EV_FloorCrushStop(line_t *line, byte *args) { thinker_t *think; floormove_t *floor; boolean rtn; rtn = 0; for(think = thinkercap.next; think != &thinkercap; think = think->next) { if(think->function != T_MoveFloor) { continue; } floor = (floormove_t *)think; if(floor->type != FLEV_RAISEFLOORCRUSH) { continue; } // Completely remove the crushing floor SN_StopSequence((mobj_t *)&floor->sector->soundorg); floor->sector->specialdata = NULL; P_TagFinished(floor->sector->tag); P_RemoveThinker(&floor->thinker); rtn = 1; } return rtn; }
/** * Called when a moving plat needs to be removed. * * @param plat Ptr to the plat to remove. */ static void stopPlat(plat_t* plat) { P_ToXSector(plat->sector)->specialData = NULL; #if __JHEXEN__ P_TagFinished(P_ToXSector(plat->sector)->tag); #endif Thinker_Remove(&plat->thinker); }
//================================================================== // // Remove a ceiling's thinker // //================================================================== void P_RemoveActiveCeiling(ceiling_t * c) { int i; for(i = 0; i < MAXCEILINGS; i++) if(activeceilings[i] == c) { activeceilings[i]->sector->specialdata = NULL; P_RemoveThinker(&activeceilings[i]->thinker); P_TagFinished(activeceilings[i]->sector->tag); activeceilings[i] = NULL; break; } }
void T_BuildPillar(pillar_t *pillar) { result_e res1; result_e res2; // First, raise the floor res1 = T_MovePlane(pillar->sector, pillar->floorSpeed, pillar->floordest, pillar->crush, 0, pillar->direction); // floorOrCeiling, direction // Then, lower the ceiling res2 = T_MovePlane(pillar->sector, pillar->ceilingSpeed, pillar->ceilingdest, pillar->crush, 1, -pillar->direction); if (res1 == RES_PASTDEST && res2 == RES_PASTDEST) { pillar->sector->specialdata = NULL; SN_StopSequence((mobj_t *)&pillar->sector->soundorg); P_TagFinished(pillar->sector->tag); P_RemoveThinker(&pillar->thinker); } }
int EV_CeilingCrushStop(line_t *line, byte *args) { int i; int rtn; rtn = 0; for(i = 0; i < MAXCEILINGS; i++) { if(activeceilings[i] && activeceilings[i]->tag == args[0]) { rtn = 1; SN_StopSequence((mobj_t *) &activeceilings[i]->sector->soundorg); activeceilings[i]->sector->specialdata = NULL; P_RemoveThinker(&activeceilings[i]->thinker); P_TagFinished(activeceilings[i]->sector->tag); activeceilings[i] = NULL; break; } } return rtn; }
void T_FloorWaggle(floorWaggle_t *waggle) { switch(waggle->state) { case WGLSTATE_EXPAND: if((waggle->scale += waggle->scaleDelta) >= waggle->targetScale) { waggle->scale = waggle->targetScale; waggle->state = WGLSTATE_STABLE; } break; case WGLSTATE_REDUCE: if((waggle->scale -= waggle->scaleDelta) <= 0) { // Remove waggle->sector->floorheight = waggle->originalHeight; P_ChangeSector(waggle->sector, true); waggle->sector->specialdata = NULL; P_TagFinished(waggle->sector->tag); P_RemoveThinker(&waggle->thinker); return; } break; case WGLSTATE_STABLE: if(waggle->ticker != -1) { if(!--waggle->ticker) { waggle->state = WGLSTATE_REDUCE; } } break; } waggle->accumulator += waggle->accDelta; waggle->sector->floorheight = waggle->originalHeight +FixedMul(FloatBobOffsets[(waggle->accumulator>>FRACBITS)&63], waggle->scale); P_ChangeSector(waggle->sector, true); }
//================================================================== // // T_VerticalDoor // //================================================================== void T_VerticalDoor(vldoor_t *door) { result_e res; switch(door->direction) { case 0: // WAITING if(!--door->topcountdown) switch(door->type) { case DREV_NORMAL: door->direction = -1; // time to go back down SN_StartSequence((mobj_t *)&door->sector->soundorg, SEQ_DOOR_STONE+door->sector->seqType); break; case DREV_CLOSE30THENOPEN: door->direction = 1; break; default: break; } break; case 2: // INITIAL WAIT if(!--door->topcountdown) { switch(door->type) { case DREV_RAISEIN5MINS: door->direction = 1; door->type = DREV_NORMAL; break; default: break; } } break; case -1: // DOWN res = T_MovePlane(door->sector, door->speed, door->sector->floorheight, false, 1, door->direction); if(res == RES_PASTDEST) { SN_StopSequence((mobj_t *)&door->sector->soundorg); switch(door->type) { case DREV_NORMAL: case DREV_CLOSE: door->sector->specialdata = NULL; P_TagFinished(door->sector->tag); P_RemoveThinker(&door->thinker); // unlink and free break; case DREV_CLOSE30THENOPEN: door->direction = 0; door->topcountdown = 35*30; break; default: break; } } else if(res == RES_CRUSHED) { switch(door->type) { case DREV_CLOSE: // DON'T GO BACK UP! break; default: door->direction = 1; break; } } break; case 1: // UP res = T_MovePlane(door->sector, door->speed, door->topheight, false, 1, door->direction); if(res == RES_PASTDEST) { SN_StopSequence((mobj_t *)&door->sector->soundorg); switch(door->type) { case DREV_NORMAL: door->direction = 0; // wait at top door->topcountdown = door->topwait; break; case DREV_CLOSE30THENOPEN: case DREV_OPEN: door->sector->specialdata = NULL; P_TagFinished(door->sector->tag); P_RemoveThinker (&door->thinker); // unlink and free break; default: break; } } break; } }
//================================================================== // // MOVE A FLOOR TO IT'S DESTINATION (UP OR DOWN) // //================================================================== void T_MoveFloor(floormove_t *floor) { result_e res; if(floor->resetDelayCount) { floor->resetDelayCount--; if(!floor->resetDelayCount) { floor->floordestheight = floor->resetHeight; floor->direction = -floor->direction; floor->resetDelay = 0; floor->delayCount = 0; floor->delayTotal = 0; } } if(floor->delayCount) { floor->delayCount--; if(!floor->delayCount && floor->textureChange) { floor->sector->floorpic += floor->textureChange; } return; } res = T_MovePlane(floor->sector,floor->speed, floor->floordestheight,floor->crush,0,floor->direction); if(floor->type == FLEV_RAISEBUILDSTEP) { if((floor->direction == 1 && floor->sector->floorheight >= floor->stairsDelayHeight) || (floor->direction == -1 && floor->sector->floorheight <= floor->stairsDelayHeight)) { floor->delayCount = floor->delayTotal; floor->stairsDelayHeight += floor->stairsDelayHeightDelta; } } if (res == RES_PASTDEST) { SN_StopSequence((mobj_t *)&floor->sector->soundorg); if(floor->delayTotal) { floor->delayTotal = 0; } if(floor->resetDelay) { // floor->resetDelayCount = floor->resetDelay; // floor->resetDelay = 0; return; } floor->sector->specialdata = NULL; /* if (floor->direction == 1) switch(floor->type) { case donutRaise: floor->sector->special = floor->newspecial; floor->sector->floorpic = floor->texture; default: break; } else if (floor->direction == -1) switch(floor->type) { case lowerAndChange: floor->sector->special = floor->newspecial; floor->sector->floorpic = floor->texture; default: break; } */ if(floor->textureChange) { floor->sector->floorpic -= floor->textureChange; } P_TagFinished(floor->sector->tag); P_RemoveThinker(&floor->thinker); } }