void DPillar::RunThink () { int r, s; if (m_Type == pillarBuild) { r = MoveFloor (m_FloorSpeed, m_FloorTarget, m_Crush, 1); s = MoveCeiling (m_CeilingSpeed, m_CeilingTarget, m_Crush, -1); } else { r = MoveFloor (m_FloorSpeed, m_FloorTarget, m_Crush, -1); s = MoveCeiling (m_CeilingSpeed, m_CeilingTarget, m_Crush, 1); } if (r == pastdest && s == pastdest) { m_Status = finished; PlayPillarSound(); P_SetPillarDestroy(this); } }
bool P_MoveLinkedSectors(sector_t *sector, int crush, fixed_t move, bool ceiling) { extsector_t::linked::plane &scrollplane = ceiling? sector->e->Linked.Ceiling : sector->e->Linked.Floor; bool ok = true; for(unsigned i = 0; i < scrollplane.Sectors.Size(); i++) { switch(scrollplane.Sectors[i].Type) { case LINK_FLOOR: ok &= MoveFloor(scrollplane.Sectors[i].Sector, crush, move); break; case LINK_CEILING: ok &= MoveCeiling(scrollplane.Sectors[i].Sector, crush, move); break; case LINK_BOTH: if (move < 0) { ok &= MoveFloor(scrollplane.Sectors[i].Sector, crush, move); ok &= MoveCeiling(scrollplane.Sectors[i].Sector, crush, move); } else { ok &= MoveCeiling(scrollplane.Sectors[i].Sector, crush, move); ok &= MoveFloor(scrollplane.Sectors[i].Sector, crush, move); } break; case LINK_FLOORMIRROR: ok &= MoveFloor(scrollplane.Sectors[i].Sector, crush, -move); break; case LINK_CEILINGMIRROR: ok &= MoveCeiling(scrollplane.Sectors[i].Sector, crush, -move); break; case LINK_BOTHMIRROR: if (move > 0) { ok &= MoveFloor(scrollplane.Sectors[i].Sector, crush, -move); ok &= MoveCeiling(scrollplane.Sectors[i].Sector, crush, -move); } else { ok &= MoveCeiling(scrollplane.Sectors[i].Sector, crush, -move); ok &= MoveFloor(scrollplane.Sectors[i].Sector, crush, -move); } break; case LINK_FLOOR+LINK_CEILINGMIRROR: ok &= MoveFloor(scrollplane.Sectors[i].Sector, crush, move); ok &= MoveCeiling(scrollplane.Sectors[i].Sector, crush, -move); break; case LINK_CEILING+LINK_FLOORMIRROR: ok &= MoveFloor(scrollplane.Sectors[i].Sector, crush, -move); ok &= MoveCeiling(scrollplane.Sectors[i].Sector, crush, move); break; default: // all other types are invalid and have to be elimintated in the attachment stage break; } } return ok; }
// // Move a plat up and down // void DPlat::RunThink () { EResult res; switch (m_Status) { case midup: case up: res = MoveFloor (m_Speed, m_High, m_Crush, 1); if (res == crushed && !m_Crush) { m_PlayedSound[waiting] = false; m_Count = m_Wait; m_Status = down; PlayPlatSound(); } else if (res == pastdest) { if (m_Type != platToggle) { m_Count = m_Wait; m_Status = waiting; switch (m_Type) { case platDownWaitUpStay: case platRaiseAndStay: case platUpByValueStay: case platDownToNearestFloor: case platDownToLowestCeiling: if (serverside) m_Status = destroy; else m_Status = finished; break; default: break; } } else { m_OldStatus = m_Status; //jff 3/14/98 after action wait m_Status = in_stasis; //for reactivation of toggle } PlayPlatSound(); } break; case middown: case down: res = MoveFloor (m_Speed, m_Low, false, -1); if (res == pastdest) { // if not an instant toggle, start waiting if (m_Type != platToggle) //jff 3/14/98 toggle up down { // is silent, instant, no waiting m_Count = m_Wait; m_Status = waiting; switch (m_Type) { case platUpWaitDownStay: case platUpByValue: if (serverside) m_Status = destroy; else m_Status = finished; break; default: break; } } else { // instant toggles go into stasis awaiting next activation m_OldStatus = m_Status; //jff 3/14/98 after action wait m_Status = in_stasis; //for reactivation of toggle } PlayPlatSound(); } //jff 1/26/98 remove the plat if it bounced so it can be tried again //only affects plats that raise and bounce // remove the plat if it's a pure raise type switch (m_Type) { case platUpByValueStay: case platRaiseAndStay: if (serverside) m_Status = destroy; else m_Status = finished; break; default: break; } break; case waiting: if (!--m_Count) { if (m_Sector->floorheight == m_Low) m_Status = up; else m_Status = down; /* if (m_Type == platToggle) SN_StartSequence (m_Sector, "Silence"); else PlayPlatSound ("Platform"); */ PlayPlatSound(); } break; case in_stasis: break; default: break; } if (clientside && m_Status == destroy) { if (serverside) // single player game { // make sure we play the finished sound because it doesn't // get called for servers otherwise m_Status = finished; PlayPlatSound(); m_Status = destroy; } m_Sector->floordata = NULL; Destroy(); return; } }
// // Move a plat up and down // void DPlat::RunThink () { EResult res; switch (m_Status) { case midup: case up: res = MoveFloor (m_Speed, m_High, m_Crush, 1); if (res == crushed && !m_Crush) { m_Count = m_Wait; m_Status = down; PlayPlatSound(); } else if (res == pastdest) { if (m_Type != platToggle) { m_Count = m_Wait; m_Status = waiting; switch (m_Type) { case platDownWaitUpStay: case platRaiseAndStay: case platUpByValueStay: case platDownToNearestFloor: case platDownToLowestCeiling: m_Status = finished; break; default: break; } } else { m_OldStatus = m_Status; //jff 3/14/98 after action wait m_Status = in_stasis; //for reactivation of toggle } PlayPlatSound(); } break; case middown: case down: res = MoveFloor (m_Speed, m_Low, false, -1); if (res == pastdest) { // if not an instant toggle, start waiting if (m_Type != platToggle) //jff 3/14/98 toggle up down { // is silent, instant, no waiting m_Count = m_Wait; m_Status = waiting; switch (m_Type) { case platUpWaitDownStay: case platUpByValue: m_Status = finished; break; default: break; } } else { // instant toggles go into stasis awaiting next activation m_OldStatus = m_Status; //jff 3/14/98 after action wait m_Status = in_stasis; //for reactivation of toggle } PlayPlatSound(); } //jff 1/26/98 remove the plat if it bounced so it can be tried again //only affects plats that raise and bounce // remove the plat if it's a pure raise type switch (m_Type) { case platUpByValueStay: case platRaiseAndStay: m_Status = finished; break; default: break; } break; case waiting: if (!--m_Count) { if (P_FloorHeight(m_Sector) <= m_Low) m_Status = up; else m_Status = down; PlayPlatSound(); } break; case in_stasis: break; default: break; } if (m_Status == finished) { PlayPlatSound(); m_Status = destroy; } if (m_Status == destroy) P_SetPlatDestroy(this); }