bool P_AddSectorLinks(sector_t *control, int tag, INTBOOL ceiling, int movetype) { int param = movetype; // can't be done if the control sector is moving. if ((ceiling && control->PlaneMoving(sector_t::ceiling)) || (!ceiling && control->PlaneMoving(sector_t::floor))) return false; // Make sure we have only valid combinations movetype &= LINK_FLAGMASK; if ((movetype & LINK_FLOORMIRROR) == LINK_FLOORMIRRORFLAG) movetype &= ~LINK_FLOORMIRRORFLAG; if ((movetype & LINK_CEILINGMIRROR) == LINK_CEILINGMIRRORFLAG) movetype &= ~LINK_CEILINGMIRRORFLAG; // Don't remove any sector if the parameter is invalid. // Addition may still be performed based on the given value. if (param != 0 && movetype == 0) return false; extsector_t::linked::plane &scrollplane = ceiling? control->e->Linked.Ceiling : control->e->Linked.Floor; if (movetype > 0) { int sec; FSectorTagIterator itr(tag); while ((sec = itr.Next()) >= 0) { // Don't attach to self! if (control != §ors[sec]) { AddSingleSector(scrollplane, §ors[sec], movetype); } } } else { RemoveTaggedSectors(scrollplane, tag); } return true; }
void P_AddSectorLinksByID(sector_t *control, int id, INTBOOL ceiling) { extsector_t::linked::plane &scrollplane = ceiling? control->e->Linked.Ceiling : control->e->Linked.Floor; FLineIdIterator itr(id); int line; while ((line = itr.Next()) >= 0) { line_t *ld = &lines[line]; if (ld->special == Static_Init && ld->args[1] == Init_SectorLink) { int movetype = ld->args[3]; // [GZ] Eternity does allow the attached sector to be the control sector, // this permits elevator effects (ceiling attached to floors), so instead // of checking whether the two sectors are the same, we prevent a plane // from being attached to itself. This should be enough to do the trick. if (ld->frontsector == control) { if (ceiling) movetype &= ~LINK_CEILING; else movetype &= ~LINK_FLOOR; } // Make sure we have only valid combinations movetype &= LINK_FLAGMASK; if ((movetype & LINK_FLOORMIRROR) == LINK_FLOORMIRRORFLAG) movetype &= ~LINK_FLOORMIRRORFLAG; if ((movetype & LINK_CEILINGMIRROR) == LINK_CEILINGMIRRORFLAG) movetype &= ~LINK_CEILINGMIRRORFLAG; if (movetype != 0 && ld->frontsector != NULL)//&& ld->frontsector != control) Needs to be allowed! { AddSingleSector(scrollplane, ld->frontsector, movetype); } } } }
void P_AddSectorLinksByID(sector_t *control, int id, INTBOOL ceiling) { extsector_t::linked::plane &scrollplane = ceiling? control->e->Linked.Ceiling : control->e->Linked.Floor; for(int line = -1; (line = P_FindLineFromID(id, line)) >= 0; ) { line_t *ld = &lines[line]; if (ld->special == Static_Init && ld->args[1] == Init_SectorLink) { int movetype = ld->args[3]; // Make sure we have only valid combinations movetype &= LINK_FLAGMASK; if ((movetype & LINK_FLOORMIRROR) == LINK_FLOORMIRRORFLAG) movetype &= ~LINK_FLOORMIRRORFLAG; if ((movetype & LINK_CEILINGMIRROR) == LINK_CEILINGMIRRORFLAG) movetype &= ~LINK_CEILINGMIRRORFLAG; if (movetype != 0 && ld->frontsector != NULL && ld->frontsector != control) { AddSingleSector(scrollplane, ld->frontsector, movetype); } } } }