bool game_cl_ArtefactHunt::CanBeReady () { if (!local_player) return false; m_bMenuCalledFromReady = TRUE; SetCurrentSkinMenu(); SetCurrentBuyMenu(); if (!m_bTeamSelected) { if (CanCallTeamSelectMenu()) m_game_ui->m_pUITeamSelectWnd->ShowDialog(true); return false; }; if (!m_bSkinSelected) { if (CanCallSkinMenu()) pCurSkinMenu->ShowDialog(true); return false; }; if (pCurBuyMenu && !pCurBuyMenu->IsShown()) ClearBuyMenu(); m_bMenuCalledFromReady = FALSE; // return inherited::CanBeReady(); return true; };
void game_cl_Deathmatch::OnSkinMenu_Cancel () { if (!m_bSkinSelected && !m_bSpectatorSelected) { if (CanCallSkinMenu() && !pCurSkinMenu->IsShown()) { pCurSkinMenu->ShowDialog(true); return; } } m_bMenuCalledFromReady = FALSE; };
void game_cl_TeamDeathmatch::OnGameMenuRespond_ChangeTeam (NET_Packet& P) { s16 OldTeam = local_player->team; local_player->team = u8(P.r_s16() & 0x00ff); if (OldTeam != local_player->team) OnTeamChanged(); SetCurrentSkinMenu(); if (pCurSkinMenu) { pCurSkinMenu->SetCurSkin(local_player->skin); if (CanCallSkinMenu()) StartStopMenu(pCurSkinMenu, true); } };
bool game_cl_Deathmatch::CanBeReady () { if (!local_player) return false; m_bMenuCalledFromReady = TRUE; SetCurrentSkinMenu(); SetCurrentBuyMenu(); if (pCurBuyMenu && !pCurBuyMenu->IsShown()) { pCurBuyMenu->ResetItems(); SetBuyMenuItems (&PlayerDefItems); } if (!m_bSkinSelected) { m_bMenuCalledFromReady = FALSE; if (CanCallSkinMenu()) pCurSkinMenu->ShowDialog(true); return false; }; if (pCurBuyMenu) { const preset_items& _p = pCurBuyMenu->GetPreset(_preset_idx_last); bool Passed = false; Passed = (_p.size()==0) ? 1 : (s32(pCurBuyMenu->GetPresetCost(_preset_idx_last)) <= local_player->money_for_round); Passed |= pCurBuyMenu->IsIgnoreMoneyAndRank(); if (!Passed) { if (CanCallBuyMenu()) { ShowBuyMenu(); } return false; } m_bMenuCalledFromReady = FALSE; OnBuyMenu_Ok(); return true; }; //m_bMenuCalledFromReady = FALSE; return true; };
bool game_cl_Deathmatch::OnKeyboardPress (int key) { if(inherited::OnKeyboardPress(key)) return true; if (Level().IsDemoPlay() && (key != kSCORES) && (key != kCROUCH)) return false; if (kSCORES == key && Phase() == GAME_PHASE_INPROGRESS) { if(m_game_ui) m_game_ui->ShowFragList(true); return true; }; if (kINVENTORY == key ) { if (Level().CurrentControlEntity() && smart_cast<CActor*>(Level().CurrentControlEntity())) { if (m_game_ui) { if ( m_game_ui->ActorMenu().IsShown() ) { m_game_ui->HideActorMenu(); } else { if (CanCallInventoryMenu()) { m_game_ui->ShowActorMenu(); } } return true; } } } if (kBUY == key ) { if (pCurBuyMenu && pCurBuyMenu->IsShown()) HideBuyMenu(); else { if(CanCallBuyMenu()) { SetCurrentBuyMenu (); if (!pCurBuyMenu) return true; pCurBuyMenu->ResetItems(); if (!pCurBuyMenu->IsShown()) SetBuyMenuItems (&PlayerDefItems); // LoadDefItemsForRank(pCurBuyMenu); ShowBuyMenu(); } }; return true; }; if (kSKIN == key ) { if (pCurSkinMenu && pCurSkinMenu->IsShown()) pCurSkinMenu->HideDialog(); else { if (CanCallSkinMenu()) { SetCurrentSkinMenu(); pCurSkinMenu->ShowDialog(true); } } return true; }; /* if( kMAP == key) { if (m_game_ui) { if (m_game_ui->m_pPdaMenu && m_game_ui->m_pPdaMenu->IsShown()) StartStopMenu(m_game_ui->m_pPdaMenu,true); else { m_game_ui->m_pPdaMenu->SetActiveSubdialog(eptMap); StartStopMenu(m_game_ui->m_pPdaMenu,true); }; return true; } }; */ return false; }
void game_cl_Deathmatch::shedule_Update (u32 dt) { CStringTable st; inherited::shedule_Update(dt); if(g_dedicated_server) return; //fake if(m_game_ui) { m_game_ui->SetTimeMsgCaption (NULL); m_game_ui->SetRoundResultCaption (NULL); m_game_ui->SetSpectatorMsgCaption (NULL); m_game_ui->SetPressJumpMsgCaption (NULL); m_game_ui->SetPressBuyMsgCaption (NULL); m_game_ui->SetForceRespawnTimeCaption(NULL); m_game_ui->SetWarmUpCaption (NULL); }; // if (CurrentGameUI() && CurrentGameUI()->UIMainIngameWnd) // CurrentGameUI()->UIMainIngameWnd->ZoneCounter().SetText(""); switch (Phase()) { case GAME_PHASE_INPROGRESS: { //m_game_ui->ShowPlayersList(false); Check_Invincible_Players(); if (!m_game_ui) break; if (m_s32TimeLimit && m_cl_dwWarmUp_Time == 0) { if (Level().timeServer()<(m_start_time + m_s32TimeLimit)) { u32 lts = Level().timeServer(); u32 Rest = (m_start_time + m_s32TimeLimit) - lts; string64 S; ConvertTime2String(&S, Rest); m_game_ui->SetTimeMsgCaption(S); } else { m_game_ui->SetTimeMsgCaption("00:00:00"); } }; game_PlayerState* lookat_player = Game().lookat_player(); if(local_player && !local_player->IsSkip()) { if (m_bFirstRun) { m_bFirstRun = FALSE; if (!Level().IsDemoPlayStarted() && Level().CurrentEntity()) { VERIFY( m_game_ui ); m_bFirstRun = m_game_ui->ShowServerInfo() ? FALSE : TRUE; } GetActiveVoting(); }; if (lookat_player) { string256 MoneyStr; xr_sprintf(MoneyStr, "%d", lookat_player->money_for_round); m_game_ui->ChangeTotalMoneyIndicator(MoneyStr); } m_game_ui->SetPressJumpMsgCaption(NULL); m_game_ui->SetPressBuyMsgCaption(NULL); if (m_cl_dwWarmUp_Time > Level().timeServer()) { u32 TimeRemains = m_cl_dwWarmUp_Time - Level().timeServer(); string64 S; ConvertTime2String(&S, TimeRemains); string1024 tmpStr = ""; if (TimeRemains > 10000) strconcat(sizeof(tmpStr),tmpStr, *st.translate("mp_time2start"), " ", S); else { if (TimeRemains < 1000) strconcat(sizeof(tmpStr),tmpStr, *st.translate("mp_go"), ""); else { static u32 dwLastTimeRemains = 10; u32 dwCurTimeRemains = TimeRemains/1000; if (dwLastTimeRemains != dwCurTimeRemains) { if (dwCurTimeRemains > 0 && dwCurTimeRemains <= 5) PlaySndMessage(ID_COUNTDOWN_1 + dwCurTimeRemains - 1); } dwLastTimeRemains = dwCurTimeRemains; _itoa(dwCurTimeRemains, S, 10); strconcat(sizeof(tmpStr),tmpStr, *st.translate("mp_ready"), "...", S); } }; m_game_ui->SetWarmUpCaption(tmpStr); } if (Level().CurrentEntity() && smart_cast<CSpectator*>(Level().CurrentEntity())) { if (!(pCurBuyMenu && pCurBuyMenu->IsShown()) && !(pCurSkinMenu && pCurSkinMenu->IsShown()) && !m_game_ui->IsServerInfoShown() && (CurrentGameUI() && CurrentGameUI()->GameIndicatorsShown()) ) { if (!m_bSkinSelected) m_game_ui->SetPressJumpMsgCaption("mp_press_jump2select_skin"); else m_game_ui->SetPressJumpMsgCaption("mp_press_jump2start"); if (CanCallBuyMenu()) m_game_ui->SetPressBuyMsgCaption("mp_press_to_buy"); }; }; if (Level().CurrentControlEntity() && smart_cast<CSpectator*>(Level().CurrentControlEntity()) && (CurrentGameUI()->GameIndicatorsShown()) ) { CSpectator* pSpectator = smart_cast<CSpectator*>(Level().CurrentControlEntity()); if (pSpectator) { string1024 SpectatorStr = ""; pSpectator->GetSpectatorString(SpectatorStr); m_game_ui->SetSpectatorMsgCaption(SpectatorStr); } } u32 CurTime = Level().timeServer(); if (IsVotingEnabled() && IsVotingActive() && m_dwVoteEndTime>=CurTime) { u32 TimeLeft = m_dwVoteEndTime - Level().timeServer(); string1024 VoteTimeResStr; u32 SecsLeft = (TimeLeft % 60000) / 1000; u32 MinitsLeft = (TimeLeft - SecsLeft) / 60000; u32 NumAgreed = 0; PLAYERS_MAP_IT I; I = players.begin(); for(;I!=players.end(); ++I) { game_PlayerState* ps = I->second; if (ps->m_bCurrentVoteAgreed == 1) NumAgreed++; } xr_sprintf (VoteTimeResStr, st.translate("mp_timeleft").c_str(), MinitsLeft, SecsLeft, float(NumAgreed)/players.size()); m_game_ui->SetVoteTimeResultMsg(VoteTimeResStr); }; if ( local_player->testFlag(GAME_PLAYER_FLAG_VERY_VERY_DEAD) && m_u32ForceRespawn && !local_player->testFlag(GAME_PLAYER_FLAG_SPECTATOR) ) { u32 Rest = m_u32ForceRespawn - local_player->DeathTime; string64 S; ConvertTime2String (&S, Rest); string128 FullS; xr_sprintf (FullS, "%s : %s", *st.translate("mp_time2respawn"), S); m_game_ui->SetForceRespawnTimeCaption(FullS); }; if (Level().CurrentViewEntity()) { game_PlayerState* ps = GetPlayerByGameID(Level().CurrentViewEntity()->ID()); if (ps && m_game_ui) m_game_ui->SetRank(ps->team, ps->rank); if (ps && m_game_ui) m_game_ui->SetFraglimit(ps->frags(), m_s32FragLimit); } }; }break; case GAME_PHASE_PENDING: { if (!m_game_ui) break; m_game_ui->UpdateTeamPanels(); m_game_ui->ShowPlayersList(true); }break; case GAME_PHASE_PLAYER_SCORES: { if (!m_game_ui) break; string128 resstring; xr_sprintf(resstring, st.translate("mp_player_wins").c_str(), WinnerName); m_game_ui->SetRoundResultCaption(resstring); SetScore(); m_game_ui->UpdateTeamPanels(); m_game_ui->ShowPlayersList(true); }break; }; //----------------------------------------- if (!CanCallBuyMenu()) HideBuyMenu(); if (pCurSkinMenu && pCurSkinMenu->IsShown() && !CanCallSkinMenu()) pCurSkinMenu->HideDialog(); //----------------------------------------------- //----------------------------------------------- //if (m_game_ui->m_pInventoryMenu && m_game_ui->m_pInventoryMenu->IsShown() && !CanCallInventoryMenu()) // StartStopMenu(m_game_ui->m_pInventoryMenu,true); if ( m_game_ui && m_game_ui->ActorMenu().IsShown() && !CanCallInventoryMenu() ) { m_game_ui->HideActorMenu(); } //----------------------------------------- u32 cur_game_state = Phase(); //if(m_game_ui->m_pMapDesc && m_game_ui->m_pMapDesc->IsShown() && cur_game_state!=GAME_PHASE_INPROGRESS) //{ // m_game_ui->m_pMapDesc->HideDialog(); //} if(pCurSkinMenu && pCurSkinMenu->IsShown() && cur_game_state!=GAME_PHASE_INPROGRESS) { pCurSkinMenu->HideDialog(); } }
void game_cl_Deathmatch::OnMapInfoAccept () { if (CanCallSkinMenu()) pCurSkinMenu->ShowDialog(true); };
void game_cl_Deathmatch::OnMapInfoAccept () { if (CanCallSkinMenu()) StartStopMenu(pCurSkinMenu, true); };