//======================================================================================================================== void COFFTrade::CreateOfflineTrade(int aIndex) { int OfftradeMapN = GetPrivateProfileInt("OffTrade","OfftradeMap",0,".\\Config\\OffTrade.cfg"); int OfftradeSendAll = GetPrivateProfileInt("OffTrade","OfftradeSendAll",0,".\\Config\\OffTrade.cfg"); char OfftradeShopM[50]; OBJECTSTRUCT *gObj = (OBJECTSTRUCT*)OBJECT_POINTER(aIndex); if(gObj->m_bPShopOpen == false) { MsgNormal(aIndex,"First Open you Store!"); return; } if(gObj->MapNumber != OfftradeMapN) { MsgNormal(aIndex,"OffTrade can be only in %s",GetMapName(OfftradeMapN)); return; } if (gObj->OffTradeCoin == 1) { char TextShop[36] = "<<COIN SHOP>>"; PMSG_ANS_PSHOP_TEXT_CHANGED pMsg; PHeadSubSetB((LPBYTE)&pMsg, 0x3F, 0x10, sizeof(pMsg)); pMsg.NumberH = SET_NUMBERH(aIndex); pMsg.NumberL = SET_NUMBERL(aIndex); memcpy(gObj->m_szPShopText, TextShop, sizeof(pMsg.btPShopText)); memcpy(pMsg.btPShopText, TextShop, sizeof(pMsg.btPShopText)); memcpy(pMsg.btName, gObj->Name, sizeof(pMsg.btName)); DataSendB(aIndex, (char*)&pMsg, pMsg.h.size); MsgAll("[OffTrade] %s now state in %s X:%d Y:%d Exchange:COIN",gObj->Name,GetMapName(gObj->MapNumber),gObj->X,gObj->Y); } if (gObj->OffTradeZen == 1) { char TextShop[36] = "<<ZEN SHOP>>"; PMSG_ANS_PSHOP_TEXT_CHANGED pMsg; PHeadSubSetB((LPBYTE)&pMsg, 0x3F, 0x10, sizeof(pMsg)); pMsg.NumberH = SET_NUMBERH(aIndex); pMsg.NumberL = SET_NUMBERL(aIndex); memcpy(gObj->m_szPShopText, TextShop, sizeof(pMsg.btPShopText)); memcpy(pMsg.btPShopText, TextShop, sizeof(pMsg.btPShopText)); memcpy(pMsg.btName, gObj->Name, sizeof(pMsg.btName)); DataSendB(aIndex, (char*)&pMsg, pMsg.h.size); MsgAll("[OffTrade] %s now state in %s:X %d Y:%d Exchange:COIN",gObj->Name,GetMapName(gObj->MapNumber),gObj->X,gObj->Y); } OfflineShop[aIndex].IsOffTrade=1; CloseClient(aIndex); }
/* ======================== idMenuScreen_Shell_MatchSettings::idMenuDataSource_MatchSettings::LoadData ======================== */ void idMenuScreen_Shell_MatchSettings::idMenuDataSource_MatchSettings::LoadData() { updateMap = false; idMatchParameters matchParameters = session->GetActivePlatformLobbyBase().GetMatchParms(); idStr val; GetMapName( matchParameters.gameMap, val ); fields[ MATCH_FIELD_MAP ].SetString( val ); GetModeName( matchParameters.gameMode, val ); fields[ MATCH_FIELD_MODE ].SetString( val ); int time = matchParameters.serverInfo.GetInt( "si_timeLimit" ); if( time == 0 ) { fields[ MATCH_FIELD_TIME ].SetString( "#str_02844" ); // none } else { fields[ MATCH_FIELD_TIME ].SetString( va( "%i", time ) ); } int fragLimit = matchParameters.serverInfo.GetInt( "si_fragLimit" ); fields[ MATCH_FIELD_SCORE ].SetInteger( fragLimit ); originalFields = fields; }
void CServer::SendMap(int ClientId) { CMsgPacker Msg(NETMSG_MAP_CHANGE); Msg.AddString(GetMapName(), 0); Msg.AddInt(m_CurrentMapCrc); SendMsgEx(&Msg, MSGFLAG_VITAL|MSGFLAG_FLUSH, ClientId, true); }
void CServer::SendMap(int ClientID) { CMsgPacker Msg(NETMSG_MAP_CHANGE, true); Msg.AddString(GetMapName(), 0); Msg.AddInt(m_CurrentMapCrc); Msg.AddInt(m_CurrentMapSize); Msg.AddInt(m_MapChunksPerRequest); Msg.AddInt(MAP_CHUNK_SIZE); SendMsg(&Msg, MSGFLAG_VITAL|MSGFLAG_FLUSH, ClientID); }
void CServerDlg::OnLbnSelchangeMapList() { return; // TODO: Add your control notification handler code here char MapName[1024]; if (GetMapName(MapName)) m_pStartServerBtn.EnableWindow(TRUE); else m_pStartServerBtn.EnableWindow(FALSE); }
void CCharSelect::UserConn_CharacterList_Ack( void* pMsg ) { // 090529 LUJ, 카메라 설정 정보를 갱신한다 mCameraConfiguration->UpdateCamera(); SEND_CHARSELECT_INFO* pmsg = (SEND_CHARSELECT_INFO*)pMsg; ZeroMemory( m_pPlayer, sizeof(m_pPlayer)); const DWORD basiccolor = RGBA_MAKE(255, 255, 255,255); const DWORD overcolor = RGBA_MAKE(255,255,0,255); const DWORD presscolor = RGBA_MAKE(255,255,0,255); for(int i = 0; i < pmsg->CharNum ; i++) { WORD standpoint = pmsg->StandingArrayNum[i]; // YH 일단 선택창에서 무기 빼놓음. pmsg->ChrTotalInfo[i].WearedItemIdx[eWearedItem_Weapon] = 0; pmsg->ChrTotalInfo[i].MunpaID = 0; pmsg->ChrTotalInfo[i].MarkName = 0; m_pPlayer[standpoint] = OBJECTMGR->AddPlayer(&pmsg->BaseObjectInfo[i], 0, &pmsg->ChrTotalInfo[i]); CPlayer* pPlayer = m_pPlayer[standpoint]; pPlayer->GetEngineObject()->ApplyHeightField(FALSE); pPlayer->SetOverInfoOption(0); char LevelName[255]; cPushupButton * btn = (cPushupButton *)WINDOWMGR->GetWindowForIDEx(MT_FIRSTCHOSEBTN+standpoint); wsprintf(LevelName,"[Lv%2d] %-16s",pmsg->ChrTotalInfo[i].Level,pmsg->BaseObjectInfo[i].ObjectName ); btn->SetText(LevelName, basiccolor, overcolor, presscolor); cImage ToolTipImg; SCRIPTMGR->GetImage( 0, &ToolTipImg, PFT_HARDPATH ); { btn->SetToolTip( GetMapName(pmsg->ChrTotalInfo[i].LoginMapNum), RGB_HALF(255,255,255), &ToolTipImg, TTCLR_ITEM_CANEQUIP ); } pPlayer->ChangeBaseMotion(Motion_SelBefore); pPlayer->ChangeMotion(Motion_SelBefore, 0); pPlayer->ShowObjectName( FALSE ); pPlayer->GetEngineObject()->EnableShadow(TRUE); VECTOR3 scale = { 0.4f, 0.4f, 0.4f }; pPlayer->GetEngineObject()->SetScale( &scale ); // 090529 LUJ, 순서에 따른 플레이어 위치 값을 가져온다. VECTOR3 position( mCameraConfiguration->GetPlayerPosition( standpoint ) ); pPlayer->SetPosition( &position ); pPlayer->SetAngle( 0 ); pPlayer->GetEyeTime()->Init(random(0, 8)*500); pPlayer->GetEyeTime()->Start() ; } }
void CServer::SendMap(int ClientID) { lastsent[ClientID] = 0; lastask[ClientID] = 0; lastasktick[ClientID] = Tick(); CMsgPacker Msg(NETMSG_MAP_CHANGE); Msg.AddString(GetMapName(), 0); Msg.AddInt(m_CurrentMapCrc); Msg.AddInt(m_CurrentMapSize); SendMsgEx(&Msg, MSGFLAG_VITAL|MSGFLAG_FLUSH, ClientID, true); }
void CMiniMapDlg::InitMiniMap(MAPTYPE MapNum) { LoadMinimapImageInfo( m_MapNum = MapNum ); if( m_pMapName ) { m_pMapName->SetStaticText(GetMapName(MapNum)) ; } // 090703 ShinJS --- 초기화시 SetActive()를 실행하여 필요하지 않은 맵에서 보이지 않도록 한다 SetActive( TRUE ); }
BOOL CheckMap(const char* MapPath) { char MapName[MAX_PATH]; char* Map = NULL; int len = 0; BOOL bSuccess = FALSE; if (SFile281(NULL, MapPath, &Map, &len, 0, 1, NULL)) { GetMapName(MapPath, MapName, 0x104); bSuccess = CheckMapInRSA(MapName, Map, len, RSA_n, 0x100, RSA_e, 0x4, 0); SFile280(Map); } return bSuccess; }
HRESULT KSceneSettingPageRegionSplit::AddRIM(const CString csLoadPath, KG3DREGION_INFORMER_LOADFILE_PARAM* pLoadParam, LPCTSTR lpName,DWORD* pdwHandle ) { IEKG3DRegionInfoManagerTable* pTable = KSH::GetEngineCombinativeInterface<KG3DTYPE_RESOURCE_TABLE_TYPE ,KG3DTYPE_REGION_INFO_MANAGER>(); KG_PROCESS_ERROR(pTable); DWORD dwHandle = NULL; HRESULT hr = pTable->Add(csLoadPath, 0, 0, (DWORD_PTR)pLoadParam, NULL, NULL, &dwHandle); KG_COM_PROCESS_ERROR(hr); if (pdwHandle) { *pdwHandle = dwHandle; } { std::tstring csItemName(_T("")); if (! lpName) { GetMapName(csItemName); } else { csItemName = lpName; } _ASSERTE(dwHandle && pLoadParam); HTREEITEM hItem = this->AddAnRIMToTree(dwHandle, csItemName.c_str(), (LPCSTR)csLoadPath, pLoadParam); KG_PROCESS_ERROR(hItem); m_Tree.SelectItem(hItem); } //检查Tree和内部Table中的RIM数量相等 #if defined(_DEBUG) | defined(DEBUG) INT nCount = 0; hr = pTable->GetCount(&nCount); _ASSERTE(SUCCEEDED(hr)); _ASSERTE(m_Tree.GetCount() == (UINT)nCount); #endif return SynFromInnerToInterface(); Exit0: MessageBox(pLoadParam->strError.c_str(), _T("添加没有成功,原因如下"), MB_OK|MB_ICONWARNING); return E_FAIL; }
void vote_check_map () { int vt_req = get_votes_req( OV_MAP, true ); char *m = ""; if ( maps_voted_idx < 0 || strnull( m = GetMapName(maps_voted[maps_voted_idx].map_id) ) ) return; if ( !k_matchLess ) if ( match_in_progress ) return; if ( maps_voted[maps_voted_idx].admins ) G_bprint(2, "%s\n", redtext("Admin veto")); else if( !vt_req ) G_bprint(2, "%s votes for mapchange.\n", redtext("Majority")); else return; vote_clear( OV_MAP ); changelevel( m ); }
/* * Class: aflobby_CUnitSyncJNIBindings * Method: GetMapName * Signature: (I)Ljava/lang/String; */ JNIEXPORT jstring JNICALL Java_aflobby_CUnitSyncJNIBindings_GetMapName (JNIEnv *env, jclass myobject, jint index){ return env->NewStringUTF(GetMapName((signed)index)); }
int CreateMaps(struct Session *s, unsigned int number) { int i; struct Map *temp; char *filename = s->input; temp = NULL; s->maps = NULL; for(i = 0; i < number; i++) { if(!(temp = (struct Map *) calloc(1, sizeof(struct Map)))) { perror("[!] CreateMaps()::malloc"); goto err; } temp->next = s->maps; s->maps = temp; set_id(temp, i); /* Build a map name */ if((temp->name = GetMapName(temp, filename)) == NULL) { fprintf(stderr, "[!] Cannot get the map name\n"); goto err; } /* Duplicate the file */ if(CopyFile(filename, temp->name) != 0) { fprintf(stderr, "[!] Cannot copy from map\n"); free(temp->name); goto err; } /* Do the real mmap */ if((temp->size = MapFile(temp->name, &(temp->address))) <= 0) { fprintf(stderr, "[!] Error mapping file\n"); free(temp->name); goto err; } } return 0; err: /* FIXME: just wrong, lazzy ... :| */ if(temp != NULL) { s->maps = temp->next; } /* Free the memory mapped files */ FreeMaps(s->maps); /* Free the linked list of mappings */ FreeMapList(s->maps); free(temp); return -1; }
// -------------------------------------------------------------------------------------------------------------------------------------------------- void CMoveSystem::CheckRequirements(int aIndex, int MapNumber, BYTE X, BYTE Y) { LPOBJ lpObj = &gObj[aIndex]; // ----- //-- Check Target Map Status if ( MapNumberCheck(MapNumber) == FALSE) { CLog.LogAddC(TColor.Red(), "Error: [%s][%s] Unknown Map Number [%d].", lpObj->AccountID, lpObj->Name, MapNumber); SendMsg.MessageOut(aIndex, 0x01, "[WARNING]: You are attempting to move to Unknown Map."); return; } // ----- //-- Check The Coordonates Status if ( X > MOVMAX || X < MOVMIN ) return; if ( Y > MOVMAX || Y < MOVMIN ) return; // ----- //-- Checking Required Money if ( lpObj->Money < MOVSTR[MapNumber].Money ) { if ( HRB_CheckMoveMoneyMsg == TRUE ) { SendMsg.MessageOut(aIndex, 0x01, "[WARNING]: You don't have enough zen to warp."); } return; } // ----- //-- Checking Required Level if( !REQ_LEVEL_MOVE_RANGE(lpObj->Level) ) { CLog.LogAddC(TColor.Red(), "Error: [%s][%s]: Trying to moving, While he is out of Range of Required Level!", lpObj->AccountID, lpObj->Name); // ---- if ( HRB_CheckMoveLevelMsg == TRUE ) { SendMsg.MessageOut(aIndex, 0x01, "[WARNING]: You are Out Of Range Of Required Level."); SendMsg.MessageOut(aIndex, 0x01, "MinLevel:(%d) - MaxLevel:(%d) to warp to [%s].", MOVSTR[MapNumber].MinLevel, MOVSTR[MapNumber].MaxLevel, GetMapName(MapNumber)); } return; } // ----- //-- Characters Type Specificity & Ability to Move if ( MOVSTR[MapNumber].MoveForChar == 1 ) //------------> For Normal Players Only { if ( (lpObj->AuthorityCode&1) == TRUE ) { SendMsg.MessageOut(aIndex, 0x01, "[WARNING]: This Map is Only available for Normal Players Only."); return; } } else if ( MOVSTR[MapNumber].MoveForChar == 2 ) //-------> For Game Masters Only { if ( (lpObj->AuthorityCode&1) == FALSE ) { SendMsg.MessageOut(aIndex, 0x01, "[WARNING]: This Map is Only available for Game Masters Only."); return; } } else if ( MOVSTR[MapNumber].MoveForChar == -1 ) //------> For All ( Normal & Game Masters ) { } else { CLog.LogAddC(TColor.Red(), "Error: [%s][%s]: There is a Wrong Value in MoveSystem.txt in 'MoveForChar'.", lpObj->AccountID, lpObj->Name); return; } // ----- //-- Checking BattleZones if ( MOVSTR[MapNumber].IsBattleZone == 1 ) { } else { } // ----- //-- Check Equipment To Move Atlans if ( MapNumber == MAP_INDEX_ATLANS ) { if ( lpObj->pInventory[GUARDIAN].IsItem() != FALSE ) { if ( lpObj->pInventory[GUARDIAN].m_Type == ITEMGET(13,2) ) // Horn Of Uniria { SendMsg.MessageOut(aIndex, 0x01, "You unable to warp to %s While Riding a Uniria.",GetMapName(MapNumber)); return; } // ---- if ( lpObj->pInventory[GUARDIAN].m_Type == ITEMGET(13,3) ) // Dinorant { SendMsg.MessageOut(aIndex, 0x01, "You unable to warp to %s While Riding a Dinorant.",GetMapName(MapNumber)); return; } } } // ----- //-- Check Equipment To Move Icarus if ( MapNumber == MAP_INDEX_ICARUS ) { if( lpObj->pInventory[GUARDIAN].m_Type != ITEMGET(13,3) && lpObj->pInventory[WINGS].m_Type != ITEMGET(13,30) && lpObj->pInventory[GUARDIAN].m_Type != ITEMGET(13,37) && (lpObj->pInventory[WINGS].m_Type < ITEMGET(12,0) || lpObj->pInventory[WINGS].m_Type > ITEMGET(12,6) ) && (lpObj->pInventory[WINGS].m_Type < ITEMGET(12,36) || lpObj->pInventory[WINGS].m_Type > ITEMGET(12,43)) ) { SendMsg.MessageOut(aIndex, 0x01, "You unable to warp to %s without Wing or Dinorant or Fernir.", GetMapName(MapNumber)); return; } // ---- if(lpObj->pInventory[GUARDIAN].m_Type == ITEMGET(13,2)) { SendMsg.MessageOut(aIndex, 0x01, "You unable to warp to %s while Riding a Uniria.",GetMapName(MapNumber)); return; } // ---- if(lpObj->pInventory[RING_02].m_Type == ITEMGET(13,10) || lpObj->pInventory[RING_01].m_Type == ITEMGET(13,10)) { SendMsg.MessageOut(aIndex, 0x01, "You unable to warp to %s while wearing Transformation Ring.",GetMapName(MapNumber)); return; } } // ----- //-- Checking Character If in Trade. if ( lpObj->m_IfState.use == 1 && lpObj->m_IfState.type == 1 ) { CGTradeCancelButtonRecv(lpObj->m_Index); } // ----- //-- Checking Personal Shop Status if ( lpObj->m_bPShopOpen == 1 ) { CPShop.ClosePersonalShop(lpObj->m_Index); } // ----- //-- Checking The Vault Status if ( lpObj->m_IfState.use == 1 && lpObj->m_IfState.type == 6 ) { CGWarehouseUseEnd(lpObj->m_Index); } // ----- //-- Checking NPC Status if ( lpObj->m_IfState.use == 1 && lpObj->m_IfState.type == 3 ) { lpObj->TargetShopNumber = -1; lpObj->m_IfState.type = 0; lpObj->m_IfState.use = 0; } // ----- //-- Checking If the User in Duel if( gDuel.IsOnDuel(lpObj) == true ) { SendMsg.MessageOut(aIndex, 0x01, "You are in a Duel. You can't warp"); return; } }
void CServerDlg::OnBnClickedStartServer() { // TODO: Add your control notification handler code here char MapName[1024]; if (!GetMapName(MapName)) return; SaveMapList(); int iCatchInput = 1; int iDedicated = 0; int iSpectatorOnly = 0; int iBuild = 0; int iPrefetch = 1; int iR2 = 0; int iDistort = 1; int NameLen = 0; char Name[1024]; char NameAdd[1024]; char pTeam[2][1024] = {"/team=1", "/team=2"}; char sLogsPath[1024] = ""; char sCDKeyStr[1024] = ""; int FragLimit = 0; int TimeLimit = 0; char FragLimStr[1024]; char TimeLimStr[1024]; char SpectrStr[1024]; char ArtefactNumStr[1024]; int ArtefactDelay = 0; char ArtefactDelayStr[1024]; int ArtefactStay = 0; char ArtefactStayStr[1024]; char ReinforcementStr[1024]; if (m_pSVGameOptDlg->m_pFragLimit.GetWindowTextLength()) { CString tmpText; m_pSVGameOptDlg->m_pFragLimit.GetWindowText(tmpText); FragLimit = atoi(tmpText); sprintf(FragLimStr, "/fraglimit=%d", FragLimit); }; if (m_pSVGameOptDlg->m_pTimeLimit.GetWindowTextLength()) { CString tmpText; m_pSVGameOptDlg->m_pTimeLimit.GetWindowText(tmpText); TimeLimit = atoi(tmpText); sprintf(TimeLimStr, "/timelimit=%d", TimeLimit); }; char FriendlyFireStr[1024]; sprintf(FriendlyFireStr, "/ffire=%d", m_pSVGameOptDlg->m_pFriedlyFire.GetPos()); char AutoTeamBalanceStr[1024] = ""; if (m_pSVGameOptDlg->m_pAutoTeamBalance.IsWindowEnabled()) if (m_pSVGameOptDlg->m_pAutoTeamBalance.GetCheck()) sprintf(AutoTeamBalanceStr, "/abalance=1"); char AutoTeamSwapStr[1024] = ""; if (m_pSVGameOptDlg->m_pAutoTeamSwap.IsWindowEnabled()) if (m_pSVGameOptDlg->m_pAutoTeamSwap.GetCheck()) sprintf(AutoTeamSwapStr, "/aswap=1"); if (m_GameType == GAME_ARTEFACTHUNT) { DWORD_PTR ItemData = m_pSVGameOptDlg->m_pArtefactsNum.GetItemData(m_pSVGameOptDlg->m_pArtefactsNum.GetCurSel()); sprintf(ArtefactNumStr, "/anum=%d", ItemData); CString tmpText; m_pSVGameOptDlg->m_pArtefactDelay.GetWindowText(tmpText); ArtefactDelay = atoi(tmpText); sprintf(ArtefactDelayStr, "/ardelta=%d", ArtefactDelay); m_pSVGameOptDlg->m_pArtefactStay.GetWindowText(tmpText); ArtefactStay = atoi(tmpText); sprintf(ArtefactStayStr, "/astime=%d", ArtefactStay); if (m_pSVRepawnDlg->m_pACaptured.GetCheck()) { sprintf(ReinforcementStr, "/reinf=-1", tmpText); } else { m_pSVRepawnDlg->m_pReinforcementTime.GetWindowText(tmpText); int ReinfTime = atoi(tmpText); if (ReinfTime > 0) sprintf(ReinforcementStr, "/reinf=%s", tmpText); else sprintf(ReinforcementStr, ""); };; } CStalker_netDlg* pMainDlg = (CStalker_netDlg*) (GetParent()->GetParent()); if (pMainDlg) { iCatchInput = pMainDlg->m_pCatchInput.GetCheck(); NameLen = pMainDlg->m_pPlayerName.GetWindowTextLength(); if (NameLen) { pMainDlg->m_pPlayerName.GetWindowText(Name, 1023); Name[32] = 0; sprintf(NameAdd, "/name=%s", Name); }; iBuild = pMainDlg->m_pBuild.GetCheck(); iPrefetch = pMainDlg->m_pPrefetch.GetCheck(); iR2 = pMainDlg->m_pR2.GetCheck(); iDistort = pMainDlg->m_pDistort.GetCheck(); if (pMainDlg->m_pLogsPath.GetWindowTextLength() != 0) { char tmp[1024]; pMainDlg->m_pLogsPath.GetWindowText(tmp, 1024); sprintf(sLogsPath, "-overlaypath %s ", tmp); } if (pMainDlg->m_pCDKeyBtn.GetWindowTextLength() != 0) { char tmp[1024]; pMainDlg->m_pCDKeyBtn.GetWindowText(tmp, 1024); if (xr_strcmp(tmp, "- No CD Key -") != 0) sprintf(sCDKeyStr, "/cdkey=%s", tmp); } }; //--------- Server Options ----------------------------- char HostNameStr[1024] = ""; if (m_pSVServerOptDlg->m_pHostName.GetWindowTextLength() > 0) { char tmp[1024]; m_pSVServerOptDlg->m_pHostName.GetWindowText(tmp, 1024); sprintf(HostNameStr, "/hname=%s", tmp); }; char PasswordStr[1024] = ""; if (m_pSVServerOptDlg->m_pPassword.GetWindowTextLength() > 0) { char tmp[1024]; m_pSVServerOptDlg->m_pPassword.GetWindowText(tmp, 1024); sprintf(PasswordStr, "/psw=%s", tmp); } char MaxPlayersStr[1024] = ""; if (m_pSVServerOptDlg->m_pMaxPlayers.GetWindowTextLength() > 0) { char tmp[1024]; m_pSVServerOptDlg->m_pMaxPlayers.GetWindowText(tmp, 1024); sprintf(MaxPlayersStr, "/maxplayers=%s", tmp); }; iDedicated = m_pSVServerOptDlg->m_pDedicated.GetCheck(); iSpectatorOnly = m_pSVServerOptDlg->m_pSpectrMode.GetCheck(); if (iSpectatorOnly) { CString tmpText; m_pSVServerOptDlg->m_pSpectrSwitchTime.GetWindowText(tmpText); int SpectrTime = atoi(tmpText); sprintf(SpectrStr, "/spectr=%d", SpectrTime); }; int iPublic = m_pSVServerOptDlg->m_pPublic.GetCheck(); int iCheckCDKey = 0; if (m_pSVServerOptDlg->m_pCheckCDKey.IsWindowEnabled()) iCheckCDKey = m_pSVServerOptDlg->m_pCheckCDKey.GetCheck(); int iRPFreezeTime = 0; char RPFreezeTimeStr[1024] = ""; if (m_pSVRepawnDlg->m_pRPFreezeTime.GetWindowTextLength()) { CString tmpText; m_pSVRepawnDlg->m_pRPFreezeTime.GetWindowText(tmpText); iRPFreezeTime = atoi(tmpText); sprintf(RPFreezeTimeStr, "/rpfrz=%i", iRPFreezeTime); } char MapRotStr[1024] = ""; // if (m_pSVServerOptDlg->m_pMapRotation.GetCheck() && // m_pSVServerOptDlg->m_pMapRotationFile.GetWindowTextLength()) // { // CString MapRotFileName; // m_pSVServerOptDlg->m_pMapRotationFile.GetWindowText(MapRotFileName); // MapRotFileName += ".ltx"; // sprintf(MapRotStr, "/maprot=%s", MapRotFileName); // } char VoteStr[1024] = ""; if (m_pSVServerOptDlg->m_pVotingAllowed.GetCheck()) { sprintf(VoteStr, "/vote=1"); } char FIStr[1024] = ""; if (m_pSVGameOptDlg->m_pFriendlyIndicators.IsWindowEnabled() && m_pSVGameOptDlg->m_pFriendlyIndicators.GetCheck()) { sprintf(FIStr, "/fi=1"); } char FNStr[1024] = ""; if (m_pSVGameOptDlg->m_pFriendlyNames.IsWindowEnabled() && m_pSVGameOptDlg->m_pFriendlyNames.GetCheck()) { sprintf(FNStr, "/fn=1"); } char DmgBlkStr[1024] = ""; if (m_pSVRepawnDlg->m_pDmBlockLimit.GetWindowTextLength()) { CString DmgBlkLimit; m_pSVRepawnDlg->m_pDmBlockLimit.GetWindowText(DmgBlkLimit); sprintf(DmgBlkStr, "/dmgblock=%d", atol(DmgBlkLimit)); } char DmgBlkStrInd[1024] = ""; if (m_pSVRepawnDlg->m_pDmgBlkInd.IsWindowEnabled() && m_pSVRepawnDlg->m_pDmgBlkInd.GetCheck()) { sprintf(DmgBlkStrInd, "/dmbi=1"); } char ForceRespawnStr[1024] = ""; if (m_pSVRepawnDlg->m_pForceRespawn.IsWindowEnabled() && m_pSVRepawnDlg->m_pForceRespawn.GetCheck()) { CString ForceRespawnTime; m_pSVRepawnDlg->m_pForceRespawnTime.GetWindowText(ForceRespawnTime); if (atol(ForceRespawnTime)) { sprintf(DmgBlkStr, "/frcrspwn=%d", atol(ForceRespawnTime)); } }; //------------------------------------------- char AnomalySetTimeStr[1024] = ""; if (m_pSVGameOptDlg->m_pNoAnomalies.GetCheck()==0) { CString AnomalySetTime; m_pSVGameOptDlg->m_pAnomalySetTime.GetWindowText(AnomalySetTime); sprintf(DmgBlkStr, "/anslen=%d", atol(AnomalySetTime)); } //----------------------------------------------------------------------------- char WarmUpStr[1024] = ""; if (m_pSVGameOptDlg->m_pWarmUpTime.GetWindowTextLength()>0) { CString WarmUpTime; m_pSVGameOptDlg->m_pWarmUpTime.GetWindowText(WarmUpTime); if (atol(WarmUpTime)>0) sprintf(WarmUpStr, "/warmup=%d", atol(WarmUpTime)); } //----------------------------------------------------------------------------- //------------- Weather --------------------------- char WeatherCoeff[1024] = ""; char WeatherTime[1024] = ""; if (m_pSVWeatherOptDlg->m_pWeatherSpeedCoeff.GetWindowTextLength()) { CString WeatherSpeedCoeff; m_pSVWeatherOptDlg->m_pWeatherSpeedCoeff.GetWindowText(WeatherSpeedCoeff); sprintf(WeatherCoeff, "/etimef=%d", atol(WeatherSpeedCoeff)); }; if (m_pSVWeatherOptDlg->m_pStartWeather.GetCount()) { DWORD Time = DWORD(m_pSVWeatherOptDlg->m_pStartWeather.GetItemData(m_pSVWeatherOptDlg->m_pStartWeather.GetCurSel())); sprintf(WeatherTime, "/estime=%d:%d", Time/60, Time%60); } //------------------------------------------------- //ports string512 SVPortStr = ""; if (m_pSVServerOptDlg->m_pSVPort.GetWindowTextLength() > 0) { char tmp[1024]; m_pSVServerOptDlg->m_pSVPort.GetWindowText(tmp, 1024); int Port = atol(tmp); clamp(Port, START_PORT, END_PORT); sprintf(SVPortStr, "/portsv=%d", Port); }; string512 CLPortStr = ""; if (m_pSVServerOptDlg->m_pCLPort.GetWindowTextLength() > 0) { char tmp[1024]; m_pSVServerOptDlg->m_pCLPort.GetWindowText(tmp, 1024); int Port = atol(tmp); clamp(Port, START_PORT, END_PORT); sprintf(CLPortStr, "/portcl=%d", Port); }; string512 GSPortStr = ""; if (m_pSVServerOptDlg->m_pGSPort.GetWindowTextLength() > 0) { char tmp[1024]; m_pSVServerOptDlg->m_pGSPort.GetWindowText(tmp, 1024); int Port = atol(tmp); clamp(Port, START_PORT, END_PORT); sprintf(GSPortStr, "/portgs=%d", Port); }; // -noprefetch string512 temp; char cmdline[4096]; sprintf(cmdline, "%sxr_3da.exe %s -xclsx %s%s%s%s%s%s%s -nointro -external -nocache -start Server(%s/%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s) client(localhost%s%s%s)", (iDedicated == 1) ? "dedicated\\" : "", (iDedicated == 1) ? "-nosound" : "", //--------------------------------- (iCatchInput == 1 || iDedicated == 1) ? "-i " : "", (iBuild == 1) ? "-build " : "", (iPrefetch == 1) ? "" : "-noprefetch ", (iR2 == 1) ? "-r2 " : "", (iDistort == 1) ? "" : "-nodistort ", (sLogsPath[0] == 0) ? "" : sLogsPath, //--------------------------------- LTX, //--------------------------------- MapName, //--------------------------------- g_GameTypeName[m_GameType], HostNameStr, PasswordStr, MaxPlayersStr, (iPublic) ? "/public=1" : "", (iCheckCDKey) ? "/cdkey=1" : "", (iSpectatorOnly) ? SpectrStr : "", (FragLimit) ? FragLimStr : "", (TimeLimit) ? TimeLimStr : "", AutoTeamBalanceStr, AutoTeamSwapStr, (m_GameType != GAME_DEATHMATCH) ? FriendlyFireStr :"", (m_GameType == GAME_ARTEFACTHUNT) ? ArtefactNumStr : "", (m_GameType == GAME_ARTEFACTHUNT) ? ArtefactStayStr : "", (m_GameType == GAME_ARTEFACTHUNT) ? ArtefactDelayStr : "", (m_GameType == GAME_ARTEFACTHUNT) ? ReinforcementStr : "", (iRPFreezeTime) ? RPFreezeTimeStr : "", (m_pSVGameOptDlg->m_pNoAnomalies.GetCheck() == 1) ? "/ans=0" : "/ans=1", (AnomalySetTimeStr[0]) ? AnomalySetTimeStr : "", (MapRotStr[0]) ? MapRotStr : "", (VoteStr[0]) ? VoteStr : "", (FIStr[0]) ? FIStr : "", (FNStr[0]) ? FNStr : "", (DmgBlkStr[0]) ? DmgBlkStr : "", (DmgBlkStrInd[0]) ? DmgBlkStrInd : "", (WeatherTime[0]) ? WeatherTime : "", (WeatherCoeff[0]) ? WeatherCoeff : "", (WarmUpStr[0]) ? WarmUpStr : "", m_pSVSpectatorOptsDlg->GetSpectatorModesStr(temp,sizeof(temp)), (SVPortStr[0]) ? SVPortStr : "", (GSPortStr[0]) ? GSPortStr : "", //------------------------------------- (NameLen) ? NameAdd : "", (CLPortStr[0]) ? CLPortStr : "", (sCDKeyStr[0]) ? sCDKeyStr : "" ); // if (xr_strlen(cmdline) > 4096) _ASSERT(0); OutputDebugString( cmdline ); int res = WinExec(cmdline, SW_SHOW); //------------------------------------------------------- /* char* _args[3]; // check for need to execute something external { string4096 ModuleFileName = ""; GetModuleFileName(NULL, ModuleFileName, 4096); string4096 ModuleFilePath = ""; char* ModuleName = NULL; GetFullPathName(ModuleFileName, 4096, ModuleFilePath, &ModuleName); ModuleName[0] = 0; if (iDedicated == 1) { char* envpath =getenv("PATH"); string4096 NewEnvPath = ""; sprintf(NewEnvPath , "PATH=%s;%s", ModuleFilePath,envpath); _putenv(NewEnvPath); strcat(ModuleFilePath, "dedicated\\xr_3DA.exe"); } else strcat(ModuleFilePath, "xr_3da.exe"); _args[0] = ModuleFilePath;//g_sLaunchOnExit_app; _args[1] = cmdline;//g_sLaunchOnExit_params; _args[2] = NULL; _spawnv(_P_NOWAIT, _args[0], _args);//, _envvar); } */ }
/* ======================== idMenuScreen_Shell_MatchSettings::idMenuDataSource_MatchSettings::AdjustField ======================== */ void idMenuScreen_Shell_MatchSettings::idMenuDataSource_MatchSettings::AdjustField( const int fieldIndex, const int adjustAmount ) { const idStrList & modes = common->GetModeList(); const idList< mpMap_t > maps = common->GetMapList(); idMatchParameters matchParameters = session->GetActivePlatformLobbyBase().GetMatchParms(); if ( fieldIndex == MATCH_FIELD_MAP ) { for ( int i = 0; i < maps.Num(); i++ ) { // Don't allow random maps in the game lobby matchParameters.gameMap += adjustAmount; if ( matchParameters.gameMap < 0 ) { matchParameters.gameMap = maps.Num() - 1; } matchParameters.gameMap %= maps.Num(); matchParameters.mapName = maps[ matchParameters.gameMap ].mapFile; if ( ( maps[matchParameters.gameMap].supportedModes & BIT(matchParameters.gameMode) ) != 0 ) { // This map supports this mode break; } } session->UpdateMatchParms( matchParameters ); idStr val; GetMapName( matchParameters.gameMap, val ); si_map.SetInteger( matchParameters.gameMap ); fields[ MATCH_FIELD_MAP ].SetString( val ); } else if ( fieldIndex == MATCH_FIELD_MODE ) { // Don't allow random modes in the game lobby matchParameters.gameMode += adjustAmount; if ( matchParameters.gameMode < 0 ) { matchParameters.gameMode = modes.Num() - 1; } matchParameters.gameMode %= modes.Num(); updateMap = false; if ( ( maps[matchParameters.gameMap].supportedModes & BIT(matchParameters.gameMode) ) == 0 ) { for ( int i = 0; i < maps.Num(); ++i ) { if ( ( maps[i].supportedModes & BIT(matchParameters.gameMode) ) != 0 ) { matchParameters.gameMap = i; updateMap = true; break; } } } session->UpdateMatchParms( matchParameters ); idStr val; GetModeName( matchParameters.gameMode, val ); si_mode.SetInteger( matchParameters.gameMode ); fields[ MATCH_FIELD_MODE ].SetString( val ); if ( updateMap ) { GetMapName( matchParameters.gameMap, val ); si_map.SetInteger( matchParameters.gameMap ); fields[ MATCH_FIELD_MAP ].SetString( val ); } } else if ( fieldIndex == MATCH_FIELD_TIME ) { int time = si_timeLimit.GetInteger() + ( adjustAmount * 5 ); if ( time < 0 ) { time = 60; } else if ( time > 60 ) { time = 0; } if ( time == 0 ) { fields[ MATCH_FIELD_TIME ].SetString( "#str_02844" ); // none } else { fields[ MATCH_FIELD_TIME ].SetString( va( "%i", time ) ); } si_timeLimit.SetInteger( time ); matchParameters.serverInfo.SetInt( "si_timeLimit", si_timeLimit.GetInteger() ); session->UpdateMatchParms( matchParameters ); } else if ( fieldIndex == MATCH_FIELD_SCORE ) { int val = fields[ fieldIndex ].ToInteger() + ( adjustAmount * 5 ); if ( val < 5 ) { val = MP_PLAYER_MAXFRAGS; } else if ( val > MP_PLAYER_MAXFRAGS ) { val = 5; } fields[ fieldIndex ].SetInteger( val ); si_fragLimit.SetInteger( val ); matchParameters.serverInfo.SetInt( "si_fragLimit", si_fragLimit.GetInteger() ); session->UpdateMatchParms( matchParameters ); } cvarSystem->ClearModifiedFlags( CVAR_ARCHIVE ); }
int get_votes_req( int fofs, qbool diff ) { float percent = 51; int votes, vt_req, idx, el_type; votes = get_votes( fofs ); switch ( fofs ) { case OV_BREAK: percent = cvar(k_matchLess ? "k_vp_map" : "k_vp_break"); break; // in matchless mode there is no /break but /next_map so using "k_vp_map" case OV_PICKUP: percent = cvar("k_vp_pickup"); break; case OV_RPICKUP: percent = cvar("k_vp_rpickup"); break; case OV_MAP: percent = cvar("k_vp_map"); idx = vote_get_maps (); if ( idx >= 0 && !strnull( GetMapName(maps_voted[idx].map_id) ) ) votes = maps_voted[idx].map_votes; else votes = 0; break; case OV_ELECT: if ( (el_type = get_elect_type ()) == etAdmin ) { percent = cvar("k_vp_admin"); break; } else if ( el_type == etCaptain ) { percent = cvar("k_vp_captain"); break; } else { percent = 100; break; // unknown/none election break; } break; case OV_NOSPECS: percent = cvar("k_vp_nospecs"); break; case OV_COOP: percent = cvar("k_vp_coop"); break; case OV_ANTILAG: percent = cvar("k_vp_antilag"); break; } percent = bound(0.51, bound(51, percent, 100)/100, 1); // calc and bound percentage between 50% to 100% vt_req = ceil( percent * CountPlayers() ); if ( fofs == OV_ELECT ) vt_req = max(2, vt_req); // if election, at least 2 votes needed else if ( fofs == OV_BREAK && k_matchLess && match_in_progress == 1 ) vt_req = max(2, vt_req); // at least 2 votes in this case else if ( fofs == OV_BREAK ) vt_req = max(1, vt_req); // at least 1 vote in any case else if ( fofs == OV_RPICKUP ) vt_req = max(3, vt_req); // at least 3 votes in this case else if ( fofs == OV_NOSPECS ) vt_req = max(2, vt_req); // at least 2 votes in this case else if ( fofs == OV_COOP ) vt_req = max(1, vt_req); // at least 1 votes in this case else if ( fofs == OV_ANTILAG ) vt_req = max(2, vt_req); // at least 2 votes in this case if ( diff ) return max(0, vt_req - votes); return max(0, vt_req); }