// // EV_RemoteSlidingDoor // // villsa [STRIFE] new function // int EV_RemoteSlidingDoor(line_t* line, mobj_t* thing) { int secnum; sector_t* sec; int i; int rtn; line_t* secline; secnum = -1; rtn = 0; while((secnum = P_FindSectorFromLineTag(line,secnum)) >= 0) { sec = §ors[secnum]; if(sec->specialdata) continue; for(i = 0; i < 4; i++) { secline = sec->lines[i]; if(P_FindSlidingDoorType(secline) < 0) continue; EV_SlidingDoor(secline, thing); rtn = 1; } } return rtn; }
DAnimatedDoor::DAnimatedDoor (sector_t *sec, line_t *line, int speed, int delay) : DMovingCeiling (sec) { fixed_t topdist; FTextureID picnum; // The DMovingCeiling constructor automatically sets up an interpolation for us. // Stop it, since the ceiling is moving instantly here. StopInterpolation(); m_WhichDoorIndex = P_FindSlidingDoorType (line->sidedef[0]->GetTexture(side_t::top)); if (m_WhichDoorIndex < 0) { Printf ("EV_SlidingDoor: Textures are not defined for sliding door!"); m_Status = Dead; return; } m_Line1 = line; m_Line2 = line; for (int i = 0; i < sec->linecount; ++i) { if (sec->lines[i] == line) continue; if (sec->lines[i]->sidedef[0]->GetTexture(side_t::top) == line->sidedef[0]->GetTexture(side_t::top)) { m_Line2 = sec->lines[i]; break; } } picnum = m_Line1->sidedef[0]->GetTexture(side_t::top); m_Line1->sidedef[0]->SetTexture(side_t::mid, picnum); m_Line2->sidedef[0]->SetTexture(side_t::mid, picnum); // don't forget texture scaling here! FTexture *tex = TexMan[picnum]; topdist = tex ? tex->GetScaledHeight() : 64; topdist = m_Sector->ceilingplane.d - topdist * m_Sector->ceilingplane.c; m_Status = Opening; m_Speed = speed; m_Delay = delay; m_Timer = m_Speed; m_Frame = 0; m_Line1->flags |= ML_BLOCKING; m_Line2->flags |= ML_BLOCKING; m_BotDist = m_Sector->ceilingplane.d; MoveCeiling (2048*FRACUNIT, topdist, 1); if (DoorAnimations[m_WhichDoorIndex].OpenSound != NAME_None) { SN_StartSequence (m_Sector, CHAN_INTERIOR, DoorAnimations[m_WhichDoorIndex].OpenSound, 1); } }
void EV_SlidingDoor(line_t *line, mobj_t *thing) { sector_t *sec; slidedoor_t *door; // DOOM II ONLY... if (gamemode != commercial) return; // Make sure door isn't already being animated sec = line->frontsector; door = NULL; if (sec->ceilingdata) { if (!thing->player) return; door = sec->ceilingdata; if (door->type == sdt_openAndClose) { if (door->status == sd_waiting) { door->status = sd_closing; } } else return; } // Init sliding door vars if (!door) { door = Z_Malloc(sizeof(*door), PU_LEVSPEC, (void *)0); P_AddThinker(&door->thinker); sec->ceilingdata = door; door->type = sdt_openAndClose; door->status = sd_opening; door->whichDoorIndex = P_FindSlidingDoorType(line); if (door->whichDoorIndex < 0) I_Error("EV_SlidingDoor: Can't use texture for sliding door!"); door->frontsector = sec; door->backsector = line->backsector; door->thinker.function.acv = T_SlidingDoor; door->timer = SWAITTICS; door->frame = 0; door->line = line; S_StartSound((mobj_t *)&sec->soundorg, sfx_doropn); } }
void DAnimatedDoor::Serialize (FArchive &arc) { Super::Serialize (arc); FTextureID basetex = DoorAnimations[m_WhichDoorIndex].BaseTexture; arc << m_Line1 << m_Line2 << m_Frame << m_Timer << m_BotDist << m_Status << m_Speed << m_Delay << basetex; if (arc.IsLoading()) { m_WhichDoorIndex = P_FindSlidingDoorType (basetex); if (m_WhichDoorIndex == -1) { // Oh no! The door animation doesn't exist anymore! m_WhichDoorIndex = 0; } } }
bool EV_SlidingDoor (line_t *line, AActor *actor, int tag, int speed, int delay) { sector_t *sec; int secnum; bool rtn; secnum = -1; rtn = false; if (tag == 0) { // Manual sliding door sec = line->backsector; // Make sure door isn't already being animated if (sec->ceilingdata != NULL) { if (actor->player == NULL) return false; if (sec->ceilingdata->IsA (RUNTIME_CLASS(DAnimatedDoor))) { DAnimatedDoor *door = barrier_cast<DAnimatedDoor *>(sec->ceilingdata); if (door->m_Status == DAnimatedDoor::Waiting) { return door->StartClosing(); } } return false; } if (P_FindSlidingDoorType (line->sidedef[0]->GetTexture(side_t::top)) >= 0) { new DAnimatedDoor (sec, line, speed, delay); return true; } return false; } while ((secnum = P_FindSectorFromTag (tag, secnum)) >= 0) { sec = §ors[secnum]; if (sec->ceilingdata != NULL) { continue; } for (int i = 0; tag != 0 && i < sec->linecount; ++i) { line = sec->lines[i]; if (line->backsector == NULL) { continue; } if (P_FindSlidingDoorType (line->sidedef[0]->GetTexture(side_t::top)) >= 0) { rtn = true; new DAnimatedDoor (sec, line, speed, delay); break; } } } return rtn; }
// // EV_SlidingDoor // // villsa [STRIFE] // void EV_SlidingDoor(line_t* line, mobj_t* thing) { sector_t* sec; slidedoor_t* door; int i; line_t* secline; // Make sure door isn't already being animated sec = sides[line->sidenum[1]].sector; door = NULL; if(sec->specialdata) { if (!thing->player) return; door = sec->specialdata; if(door->type == sdt_openAndClose) { if(door->status == sd_waiting) { door->status = sd_closing; door->timer = SWAITTICS; // villsa [STRIFE] } } else return; } // Init sliding door vars if(!door) { door = Z_Malloc (sizeof(*door), PU_LEVSPEC, 0); P_AddThinker (&door->thinker); sec->specialdata = door; door->type = sdt_openAndClose; door->status = sd_opening; door->whichDoorIndex = P_FindSlidingDoorType(line); // villsa [STRIFE] different error message if(door->whichDoorIndex < 0) I_Error(DEH_String("EV_SlidingDoor: Textures are not defined for sliding door!")); sides[line->sidenum[0]].midtexture = sides[line->sidenum[0]].toptexture; // villsa [STRIFE] door->line1 = line; door->line2 = line; // villsa [STRIFE] this loop assumes that the sliding door is made up // of only four linedefs! for(i = 0; i < 4; i++) { secline = sec->lines[i]; if(secline != line) { side_t* side1; side_t* side2; side1 = &sides[secline->sidenum[0]]; side2 = &sides[line->sidenum[0]]; if(side1->toptexture == side2->toptexture) door->line2 = secline; } } door->thinker.function.acp1 = (actionf_p1)T_SlidingDoor; door->timer = SWAITTICS; door->frontsector = sec; door->frame = 0; // villsa [STRIFE] preset flags door->line1->flags |= ML_BLOCKING; door->line2->flags |= ML_BLOCKING; // villsa [STRIFE] set the closing sector T_MovePlane( door->frontsector, (128*FRACUNIT), P_FindLowestCeilingSurrounding(door->frontsector), 0, 1, 1); // villsa [STRIFE] play open sound S_StartSound(&door->frontsector->soundorg, slideOpenSounds[door->whichDoorIndex]); } }