void OpenableContainerEntity::ToggleState() { if (isOpen) { StartClosing(); } else { StartOpening(); } }
void P2PConnection::OnSocketReceiveError(OpSocket* socket, OpSocket::Error socket_error) { ENTER_METHOD; AddRef(); // blocking is not an error if (m_closing == FALSE && socket_error != OpSocket::SOCKET_BLOCKING) { Observer().AddRef(); Observer().OnP2PReceiveError(this, socket_error); Observer().Release(); StartClosing(); m_socket.Release(); } Release(); LEAVE_METHOD; }
void P2PConnection::Close() { ENTER_METHOD; AddRef(); if(m_socket.Get()) { DEBUGTRACE_CONNECT(UNI_L("Closing socket to host: %s, refcount: "), (uni_char *)m_address); DEBUGTRACE_CONNECT(UNI_L("%d\n"), m_refcount); StartClosing(); m_connected = FALSE; // m_socket.Get()->SetObserver(&m_nullobserver); DEBUGTRACE8_RES(UNI_L("DELETING SOCKET 2: 0x%08x\n"), m_socket.Get()); m_socket.Release(); } Release(); LEAVE_METHOD; }
void DAnimatedDoor::Tick () { if (m_DoorAnim == NULL) { // can only happen when a bad savegame is loaded. Destroy(); return; } switch (m_Status) { case Dead: m_Sector->ceilingdata = NULL; Destroy (); break; case Opening: if (!m_Timer--) { if (++m_Frame >= m_DoorAnim->NumTextureFrames) { // IF DOOR IS DONE OPENING... m_Line1->flags &= ~ML_BLOCKING; m_Line2->flags &= ~ML_BLOCKING; if (m_Delay == 0) { m_Sector->ceilingdata = NULL; Destroy (); break; } m_Timer = m_Delay; m_Status = Waiting; } else { // IF DOOR NEEDS TO ANIMATE TO NEXT FRAME... m_Timer = m_Speed; m_Line1->sidedef[0]->SetTexture(side_t::mid, m_DoorAnim->TextureFrames[m_Frame]); m_Line1->sidedef[1]->SetTexture(side_t::mid, m_DoorAnim->TextureFrames[m_Frame]); m_Line2->sidedef[0]->SetTexture(side_t::mid, m_DoorAnim->TextureFrames[m_Frame]); m_Line2->sidedef[1]->SetTexture(side_t::mid, m_DoorAnim->TextureFrames[m_Frame]); } } break; case Waiting: // IF DOOR IS DONE WAITING... if (!m_Timer--) { if (!StartClosing()) { m_Timer = m_Delay; } } break; case Closing: if (!m_Timer--) { if (--m_Frame < 0) { // IF DOOR IS DONE CLOSING... MoveCeiling (2048*FRACUNIT, m_BotDist, -1); m_Sector->ceilingdata = NULL; Destroy (); // Unset blocking flags on lines that didn't start with them. Since the // ceiling is down now, we shouldn't need this flag anymore to keep things // from getting through. if (!m_SetBlocking1) { m_Line1->flags &= ~ML_BLOCKING; } if (!m_SetBlocking2) { m_Line2->flags &= ~ML_BLOCKING; } break; } else { // IF DOOR NEEDS TO ANIMATE TO NEXT FRAME... m_Timer = m_Speed; m_Line1->sidedef[0]->SetTexture(side_t::mid, m_DoorAnim->TextureFrames[m_Frame]); m_Line1->sidedef[1]->SetTexture(side_t::mid, m_DoorAnim->TextureFrames[m_Frame]); m_Line2->sidedef[0]->SetTexture(side_t::mid, m_DoorAnim->TextureFrames[m_Frame]); m_Line2->sidedef[1]->SetTexture(side_t::mid, m_DoorAnim->TextureFrames[m_Frame]); } } break; } }
void DAnimatedDoor::Tick () { FDoorAnimation &ani = DoorAnimations[m_WhichDoorIndex]; switch (m_Status) { case Dead: m_Sector->ceilingdata = NULL; Destroy (); break; case Opening: if (!m_Timer--) { if (++m_Frame >= ani.NumTextureFrames) { // IF DOOR IS DONE OPENING... m_Line1->flags &= ~ML_BLOCKING; m_Line2->flags &= ~ML_BLOCKING; if (m_Delay == 0) { m_Sector->ceilingdata = NULL; Destroy (); break; } m_Timer = m_Delay; m_Status = Waiting; } else { // IF DOOR NEEDS TO ANIMATE TO NEXT FRAME... m_Timer = m_Speed; m_Line1->sidedef[0]->SetTexture(side_t::mid, ani.TextureFrames[m_Frame]); m_Line1->sidedef[1]->SetTexture(side_t::mid, ani.TextureFrames[m_Frame]); m_Line2->sidedef[0]->SetTexture(side_t::mid, ani.TextureFrames[m_Frame]); m_Line2->sidedef[1]->SetTexture(side_t::mid, ani.TextureFrames[m_Frame]); } } break; case Waiting: // IF DOOR IS DONE WAITING... if (!m_Timer--) { if (!StartClosing()) { m_Timer = m_Delay; } } break; case Closing: if (!m_Timer--) { if (--m_Frame < 0) { // IF DOOR IS DONE CLOSING... MoveCeiling (2048*FRACUNIT, m_BotDist, -1); m_Sector->ceilingdata = NULL; Destroy (); break; } else { // IF DOOR NEEDS TO ANIMATE TO NEXT FRAME... m_Timer = m_Speed; m_Line1->sidedef[0]->SetTexture(side_t::mid, ani.TextureFrames[m_Frame]); m_Line1->sidedef[1]->SetTexture(side_t::mid, ani.TextureFrames[m_Frame]); m_Line2->sidedef[0]->SetTexture(side_t::mid, ani.TextureFrames[m_Frame]); m_Line2->sidedef[1]->SetTexture(side_t::mid, ani.TextureFrames[m_Frame]); } } break; } }