// Player Died, Called on all users void ARadeCharacter::GlobalDeath_Implementation() { // save third person mesh Relative Location and rotation before ragdoll if (GetMesh()) { Mesh_InGameRelativeLoc = GetMesh()->RelativeLocation; Mesh_InGameRelativeRot = GetMesh()->RelativeRotation; } // Disable player input DisableInput(Cast<APlayerController>(Controller)); // If Player can revive, revive hit after a delay if (bCanRevive) { FTimerHandle MyHandle; GetWorldTimerManager().SetTimer(MyHandle, this, &ARadeCharacter::Revive, ReviveTime, false); } // Event and Ragdoll Super::GlobalDeath_Implementation(); // Update Visibility UpdateComponentsVisibility(); // Call on Blueprint BP_PlayerDied(); }
/*Description: Disables the player input and sets the variables to start the Death Animation*/ void APoseidonCharacter::DamagePlayer() { if (!mGodModeActive) { DisableInput(PlayerController); mWasDamaged = true; mHealth = 0.0f; } }
void ARTJamCharacter::OnHit(AActor* OtherActor, UPrimitiveComponent* OtherComp, FVector NormalImpulse, const FHitResult& Hit) { APickupBase *Item = Cast<APickupBase>(OtherActor); if (!Item) { bIsDead = true; DisableInput(GetWorld()->GetFirstPlayerController()); GetWorldTimerManager().SetTimer(DeathHandle, this, &ARTJamCharacter::DeathTimer, 2.f, false); } }
void MyPipeFrame::OnProcessTerm(wxProcessEvent& WXUNUSED(event)) { DoGet(); wxDELETE(m_process); wxLogWarning(wxT("The other process has terminated, closing")); DisableInput(); DisableOutput(); }
int CCSocketHandler::handle_output() { log_debug("*STEP: send data, len:[%d] netfd[%d]", _w.data_len(), netfd); if (_w.data_len() != 0) { int ret = ::send (netfd, _w.data(), _w.data_len(), 0); if(-1 == ret) { if(errno == EINTR || errno == EAGAIN || errno == EINPROGRESS) { log_boot("sending,INTR|EAGAIN|EINPROGRESS,errno:[%d]", errno); EnableOutput (); ApplyEvents (); _stage = CONN_DATA_SENDING; return _stage; } log_boot ("sending package to client failed, ret[%d]", ret); DisableInput (); DisableOutput (); ApplyEvents (); _stage = CONN_FATAL_ERROR; return _stage; } if(ret == (int)_w.data_len()) { log_debug("send complete, send len=[%d]",ret); DisableOutput(); ApplyEvents (); _w.skip(ret); _stage = CONN_SEND_DONE; return _stage; } else if (ret < (int)_w.data_len()) { log_debug("had sent part of data, send len=[%d]",ret); EnableOutput (); ApplyEvents (); _w.skip(ret); _stage = CONN_DATA_SENDING; return _stage; } } DisableOutput(); ApplyEvents (); _stage = CONN_FATAL_ERROR; log_debug("send process failure"); return _stage; }
void CCSocketHandler::Reset(){ log_debug("reset socket handler"); _w.skip( _w.data_len() ); _r.skip( _r.data_len() ); DisableInput(); DisableOutput(); ApplyEvents(); CPollerObject::DetachPoller(); if(netfd > 0) { ::close(netfd); } netfd = -1; _stage = CONN_IDLE; return; }
void LiveInLight (void){ PORTB &= ~(1<<LedPin); // Light-up LED PWMStop(); while (1){ EnableInput (); DeepSleep(); DisableInput (); if (Valto != None) { EventHandler (); // if key pressed then shutdown if (Valto==KeyPressed) break; } } PWMStart(250); PORTB |= (1<<LedPin); // Shutdown LED }
// // Process the debriefing block // void Cineractive::ProcessDebrief(FScope *fScope) { // Disable some default stuff, this can be overriden after the Debrief scope DisableInput(FALSE); DisableIFace(FALSE); DisableShroud(TRUE); // Restore speeds GameTime::SetFastMode(FALSE); GameTime::SetDisplayMode(TRUE); // Kill all game windows IFace::PurgeNonSystem(); // Create the debrief primitive AddPrim(primitiveList, new DebriefPrim(this, fScope)); }
void LightUp (void){ uint8_t i; PWMStart(0); // Enable shutdown at Light-up for (i=0; i<=250; i++){ PWMSet (i); EnableInput (); if (i<PWMStepOver) Wait (PWMSlowDelay); else Wait (PWMQuickDelay); DisableInput (); if (Valto != None) { EventHandler (); // if key pressed then shutdown if (Valto==KeyPressed) break; } } }
int main (void){ // Setup IO DDRB = (0<<PB0)|(1<<PB1)|(0<<PB2)|(0<<PB3)|(0<<PB4); PORTB = (1<<PB0)|(1<<PB1)|(1<<PB2)|(0<<PB3)|(0<<PB4); // VCC-based LED while (1){ EnableInput (); DeepSleep(); DisableInput (); // **** Why wake? **** EventHandler(); if (Valto==KeyPressed) { Valto = None; Wait (_2_s); LightUp(); if (Valto == None) LiveInLight(); LightDown(); } } }
// // End the cineractive // void Cineractive::Terminate() { LOG_VIEWER(("Terminate: %d left", cineractives.GetCount() - 1)) // Delete primitives primitiveList.DisposeAll(); done = TRUE; Vid::renderState.status.alphaNear = alphaNearStart; // if this is the last one if (cineractives.GetCount() == 1) { // Restore everything DisableIFace(FALSE); DisableInput(FALSE); DisableShroud(FALSE); RestoreDisplay(); ASSERT(!flags) flags = 0; } }
int CCSocketHandler::handle_input() { int ret = 0 ; int packet_len = 0 ; int curr_recv_len = 0; char curr_recv_buf[MAX_WEB_RECV_LEN] = {'\0'}; curr_recv_len = ::recv (netfd, curr_recv_buf, MAX_WEB_RECV_LEN, 0); log_debug ("*STEP: receiving data, length[%d]", curr_recv_len); if(-1 == curr_recv_len)//接收数据有误 { if(errno != EAGAIN && errno != EINTR && errno != EINPROGRESS) { DisableInput(); _stage = CONN_FATAL_ERROR; log_boot ("recv failed from fd[%d], msg[%s]", netfd, strerror(errno)); } else _stage = CONN_DATA_RECVING; } else if( 0 == curr_recv_len )//客户端关闭连接 { DisableInput (); _stage = CONN_DISCONNECT; log_boot ("connection disconnect by user fd[%d], msg[%s]", netfd, strerror(errno)); } else { if(curr_recv_len==23 && curr_recv_buf[0]=='<' && curr_recv_buf[1]=='p') { std::string policy = "<policy-file-request/>"; for(int i=0; i<23; ++i) { if(curr_recv_buf[i] != policy[i]) { _stage = CONN_DATA_ERROR; return _stage; } } std::string resPolicy ="<cross-domain-policy><allow-access-from domain=\"*\" to-ports=\"*\" /></cross-domain-policy>\0"; this->Send(resPolicy.c_str(), resPolicy.size()); _stage = CONN_XML_POLICY; log_notice ("flash policy-file-request"); return _stage; } log_debug ("1111111111111111111"); _r.append(curr_recv_buf, curr_recv_len); while(_r.data_len() > 0) { log_debug ("2222222222222"); packet_len = this->_decode->ParsePacket(_r.data(), _r.data_len()); log_debug ("333333333333"); if(packet_len == -1) //数据错误 { DisableInput (); _stage = CONN_DATA_ERROR; break ; } else if(packet_len == 0) //包头解析完,等待包体 { _stage = CONN_DATA_RECVING; break; } else //解析到完整包 inputRet=完整包长度 { log_debug ("55555555555555"); ret = this->OnPacketComplete(_r.data(), packet_len); log_debug ("66666666666666 ret = %d",ret); if( ret < 0 ) { _stage = CONN_FATAL_ERROR; break; } _stage = CONN_RECV_DONE; _r.skip(packet_len); } } } return _stage; }
int CHelperUnit::send_to_cgi(void) { int ret = 0; int reConnectCount = 0; log_debug("_w data size:[%d]", _w.data_len()); logic: if (_w.data_len() != 0) { ret = ::send (netfd, _w.data(), _w.data_len(), 0); log_debug("sent packet size:[%d]", ret); if(-1 == ret) { if(errno == EINTR || errno == EAGAIN || errno == EINPROGRESS) { _send_error_times++; if(_send_error_times >= 50) { g_pErrorLog->logMsg("CHelperUnit::send_to_cgi, send error more"); reset_helper(); _stage = CONN_FATAL_ERROR; return -1; } EnableOutput (); ApplyEvents (); return CONN_DATA_SENDING; } log_error("*STEP: sending package to logic server failed, ret code[%d], errno:[%d], ip:[%s], port:[%d]", ret, errno, addr.c_str(), port); reset_helper(); _stage = CONN_FATAL_ERROR; return -1; } if(ret == (int)_w.data_len()) { _w.skip(ret); DisableOutput (); ApplyEvents(); _stage = CONN_SEND_DONE; //重置发送错误次数 _send_error_times = 0; log_debug ("*STEP: sent package to logic server, netfd[%d] packet size[%d]", netfd, ret); return ret; } else if (ret < (int)_w.data_len()) { EnableOutput (); ApplyEvents (); _w.skip(ret); _stage = CONN_DATA_SENDING; //重置发送错误次数 _send_error_times = 0; return ret; } DisableInput (); DisableOutput (); ApplyEvents(); _stage = CONN_FATAL_ERROR; log_debug ("*STEP: sending package to logic server in exception, netfd[%d]", netfd); return ret; } return ret; }
static BOOL Login_OnInitDialog(HWND hwnd, HWND hwndFocus, LPARAM lParam) { wchar_t szBuffer[256], szTemp[128]; g_hLoginDialog = hwnd; DisableInput(true); GetPNotesMessage(L"invalid_pwrd", L"Incorrect password", m_InvalidPassword); GetPNotesMessage(L"invalid_old_pwrd", L"Incorrect old password", m_InvalidOldPassword); GetPNotesMessage(L"both_pwrd", L"Both password strings should be identical. Please, check the spelling.", m_BothPasswords); switch(m_DlgId){ case DLG_LOGIN_MAIN:{ GetPrivateProfileStringW(S_LOGIN_CAPTIONS, IK_ENTER_PWRD, L"Enter password", szBuffer, 256, g_NotePaths.CurrLanguagePath); SetDlgItemTextW(hwnd, IDC_ST_PWRD_MAIN, szBuffer); GetPrivateProfileStringW(L"captions", L"enter_pwrd", L"Enter Password", szBuffer, 256, g_NotePaths.CurrLanguagePath); if(m_LoginType == LDT_NOTE){ PMEMNOTE pNote = (PMEMNOTE)m_pParam; GetPrivateProfileStringW(L"captions", L"note", L"note", szTemp, 128, g_NotePaths.CurrLanguagePath); wcscat(szBuffer, L" ["); wcscat(szBuffer, szTemp); wcscat(szBuffer, L" '"); wcscat(szBuffer, pNote->pData->szName); wcscat(szBuffer, L"']"); } else if(m_LoginType == LDT_GROUP){ LPPNGROUP pGroup = (LPPNGROUP)m_pParam; GetPrivateProfileStringW(L"captions", L"group", L"group", szTemp, 128, g_NotePaths.CurrLanguagePath); wcscat(szBuffer, L" ["); wcscat(szBuffer, szTemp); wcscat(szBuffer, L" '"); wcscat(szBuffer, pGroup->szName); wcscat(szBuffer, L"']"); } else if(m_LoginType == LDT_DIARY){ GetPrivateProfileStringW(L"captions", L"group", L"group", szTemp, 128, g_NotePaths.CurrLanguagePath); wcscat(szBuffer, L" ["); wcscat(szBuffer, szTemp); wcscat(szBuffer, L" '"); GetPrivateProfileStringW(L"left_panel", L"209", L"Diary", szTemp, 128, g_NotePaths.CurrLanguagePath); wcscat(szBuffer, szTemp); wcscat(szBuffer, L"']"); } break; } case DLG_LOGIN_CREATE: GetPrivateProfileStringW(S_LOGIN_CAPTIONS, IK_ENTER_PWRD, L"Enter password", szBuffer, 256, g_NotePaths.CurrLanguagePath); SetDlgItemTextW(hwnd, IDC_ST_PWRD_MAIN, szBuffer); GetPrivateProfileStringW(S_LOGIN_CAPTIONS, IK_CONF_PWRD, L"Confirm password", szBuffer, 256, g_NotePaths.CurrLanguagePath); SetDlgItemTextW(hwnd, IDC_ST_PWRD_SECOND, szBuffer); GetPrivateProfileStringW(L"captions", L"create_pwrd", L"Password Setting", szBuffer, 256, g_NotePaths.CurrLanguagePath); if(m_LoginType == LDT_NOTE){ PMEMNOTE pNote = (PMEMNOTE)m_pParam; GetPrivateProfileStringW(L"captions", L"note", L"note", szTemp, 128, g_NotePaths.CurrLanguagePath); wcscat(szBuffer, L" ["); wcscat(szBuffer, szTemp); wcscat(szBuffer, L" '"); wcscat(szBuffer, pNote->pData->szName); wcscat(szBuffer, L"']"); } else if(m_LoginType == LDT_GROUP){ LPPNGROUP pGroup = (LPPNGROUP)m_pParam; GetPrivateProfileStringW(L"captions", L"group", L"group", szTemp, 128, g_NotePaths.CurrLanguagePath); wcscat(szBuffer, L" ["); wcscat(szBuffer, szTemp); wcscat(szBuffer, L" '"); wcscat(szBuffer, pGroup->szName); wcscat(szBuffer, L"']"); } else if(m_LoginType == LDT_DIARY){ GetPrivateProfileStringW(L"captions", L"group", L"group", szTemp, 128, g_NotePaths.CurrLanguagePath); wcscat(szBuffer, L" ["); wcscat(szBuffer, szTemp); wcscat(szBuffer, L" '"); GetPrivateProfileStringW(L"left_panel", L"209", L"Diary", szTemp, 128, g_NotePaths.CurrLanguagePath); wcscat(szBuffer, szTemp); wcscat(szBuffer, L"']"); } break; case DLG_LOGIN_CHANGE: GetPrivateProfileStringW(S_LOGIN_CAPTIONS, IK_OLD_PWRD, L"Old password", szBuffer, 256, g_NotePaths.CurrLanguagePath); SetDlgItemTextW(hwnd, IDC_ST_PWRD_MAIN, szBuffer); GetPrivateProfileStringW(S_LOGIN_CAPTIONS, IK_NEW_PWRD, L"New password", szBuffer, 256, g_NotePaths.CurrLanguagePath); SetDlgItemTextW(hwnd, IDC_ST_PWRD_NEW, szBuffer); GetPrivateProfileStringW(S_LOGIN_CAPTIONS, IK_CONF_PWRD, L"Confirm password", szBuffer, 256, g_NotePaths.CurrLanguagePath); SetDlgItemTextW(hwnd, IDC_ST_PWRD_SECOND, szBuffer); GetPrivateProfileStringW(L"captions", L"change_pwrd", L"Password Changing", szBuffer, 256, g_NotePaths.CurrLanguagePath); break; default: break; } SetWindowTextW(hwnd, szBuffer); SetDlgCtlText(hwnd, IDOK, g_NotePaths.CurrLanguagePath, DS_OK); SetDlgCtlText(hwnd, IDCANCEL, g_NotePaths.CurrLanguagePath, DS_CANCEL); // SetForegroundWindow(hwnd); SetFocus(GetDlgItem(hwnd, IDC_EDT_PWRD_MAIN)); return FALSE; }
static void Login_OnDestroy(HWND hwnd) { lpNewPwrd = NULL; g_hLoginDialog = NULL; DisableInput(false); }
// // Execute a block of commands // void Cineractive::ExecBlock(FScope *fScope) { FScope *sScope; while ((sScope = fScope->NextFunction()) != NULL) { LOG_VIEWER(("Exec: [%s]", sScope->NameStr())) switch (sScope->NameCrc()) { case 0x9D71F205: // "Movie" { // Disable movies in multiplayer campaigns if (!MultiPlayer::Data::Online()) { if (moviePrim) { delete moviePrim; } moviePrim = new Movie(this, sScope); } break; } case 0x0DA67726: // "AlphaNear" Vid::renderState.status.alphaNear = alphaNear = sScope->NextArgInteger(); break; case 0x70600744: // "DisableIFace" { DisableIFace(sScope->NextArgInteger()); break; } case 0x72C1779F: // "DisableHUD" { DisableHUD(sScope->NextArgInteger()); break; } case 0x288F19CB: // "DisableInput" { DisableInput(sScope->NextArgInteger()); break; } case 0xAA268B85: // "DisableShroud" { DisableShroud(sScope->NextArgInteger()); break; } case 0x47518EE4: // "EndCineractive" { Terminate(); break; } case 0x7E8E3E05: // "SkipPoint" { RestoreDisplay(); break; } case 0xEA4227E1: // "SetBookmark" { SetBookmark(sScope); break; } case 0xDDD6437A: // "DefaultCamera" { LOG_VIEWER(("DefaultCamera")) if (Demo::IsPlaying()) { SetCurrent("Playback0", StdLoad::TypeU32(sScope, U32(FALSE), Range<U32>::flag), sScope); } else { SetCurrent("default", StdLoad::TypeU32(sScope, U32(FALSE), Range<U32>::flag), sScope); } break; } case 0xF4356EC8: // "SetCamera" { SetCurrent(sScope->NextArgString(), FALSE, sScope); break; } case 0x9805A0A6: // "Mesh" { AddPrim(primitiveList, new Mesh(this, sScope)); break; } case 0x16556EBC: // "Letterbox" { AddPrim(primitiveList, new Letterbox(this, sScope)); break; } case 0x10A95B64: // "Fade" { AddPrim(primitiveList, new Fade(this, sScope)); break; } case 0x76802A4E: // "Image" { AddPrim(primitiveList, new Image(this, sScope)); break; } case 0x64DD3931: // "Wallpaper" { AddPrim(primitiveList, new Wallpaper(this, sScope)); break; } case 0xCB28D32D: // "Text" { AddPrim(primitiveList, new Text(this, sScope)); break; } case 0x8E18DC65: // "Subtitle" { AddPrim(primitiveList, new Subtitle(this, sScope)); break; } case 0x37345010: // "Pause" { if (!GameTime::Paused()) { GameTime::Pause(FALSE); } break; } case 0x0642D599: // "Unpause" { if (GameTime::Paused()) { GameTime::Pause(FALSE); } break; } case 0x3F159CC9: // "DefineDebriefing" { debriefings.Add(Crc::CalcStr(sScope->NextArgString()), sScope); break; } case 0x311D74EF: // "Debrief" { ProcessDebrief(sScope); break; } case 0x06A3B1BA: // "Action" { // Execute an objective action block ::Action::Execute(team, sScope); break; } default: { LOG_WARN(("Unknown function [%s] in Cineractive", sScope->NameStr())) break; } } } }
void MyPipeFrame::DoClose() { m_process->CloseOutput(); DisableInput(); }