bool CServerMissionMgr::SwitchToCampaignIndex( int nCampaignIndex ) { TRACE( "CServerMissionMgr::SwitchToCampaignIndex\n" ); m_nCurCampaignIndex = nCampaignIndex - 1; return NextMission( ); }
bool CServerMissionMgr::NextRound( ) { TRACE( "CServerMissionMgr::NextRound\n" ); // Check if we're already exiting a level. if( m_bExitingLevel ) return true; // Get the mission... MISSION* pMission = g_pMissionButeMgr->GetMission(m_nCurrentMission); if( !pMission ) { ASSERT( !"CServerMissionMgr::NextMission: Invalid mission." ); return false; } // Advance to the next round... ++m_nCurrentRound; // Default to not a new mission. m_bNewMission = false; // See if we finished the rounds for this level... if( m_nCurrentRound >= m_ServerSettings.m_nRounds ) { // Just go to the next mission... if( !NextMission() ) return false; return true; } if( !ExitLevel( m_sCurrentWorldName, false )) return false; return true; }
bool CCheatMgr::Process( CheatCode nCheatCode, CParsedMsgW const& cMsg ) { if ( nCheatCode <= CHEAT_NONE || nCheatCode >= CHEAT_MAX ) return false; #ifdef _FINAL // Don't do cheats in multiplayer... if (IsMultiplayerGameClient()) { // Well, okay, let them toggle between 1st and 3rd person ;) // and, well, blood is pretty cool... switch ( nCheatCode ) { case CHEAT_EXITLEVEL: // exit the current level SetExitLevel(); break; case CHEAT_NEXTMISSION: // exit the current mission NextMission(); break; case CHEAT_BOOT: // boot players BootPlayer(cMsg); break; default : return false; break; } m_bPlayerCheated = true; return true; } #else // _FINAL // Only allow cheats in MP if console variable turned on. if( IsMultiplayerGameClient( )) { float fVal = 0.0f; g_pLTClient->GetSConValueFloat( "AllowMPCheats", fVal ); bool bAllowMPCheats = fVal != 0.0f; if( !bAllowMPCheats ) return false; } #endif // _FINAL // process cheat codes switch ( nCheatCode ) { case CHEAT_GOD: // god mode toggle SetGodMode(!s_CheatInfo[nCheatCode].bActive); break; case CHEAT_ARMOR: // full armor SetArmor(); break; case CHEAT_HEALTH: // full health SetHealth(); break; case CHEAT_EXITLEVEL: // exit the current level SetExitLevel(); break; case CHEAT_VERSION: // display version info Version(); break; case CHEAT_INVISIBLE: // time to mess with the AI SetInvisible(!s_CheatInfo[nCheatCode].bActive); break; case CHEAT_BODYGOLFING: // bodies fly far //currently unimplemented... // BodyGolfing(!s_CheatInfo[nCheatCode].bActive); break; case CHEAT_POS: // show/hide player position SetPos(!s_CheatInfo[nCheatCode].bActive); break; #ifndef _DEMO case CHEAT_KFA: // give em everything SetKFA(); break; case CHEAT_AMMO: // full ammo SetAmmo(); break; case CHEAT_MODSQUAD: // give all mods for current weapons ModSquad(); break; case CHEAT_CONSOLE: SetConsole(!s_CheatInfo[nCheatCode].bActive); break; case CHEAT_NEXTMISSION: // exit the current mission NextMission(); break; case CHEAT_BOOT: // exit the current mission BootPlayer(cMsg); break; case CHEAT_FULL_WEAPONS: // give all weapons SetFullWeapons(); break; case CHEAT_FULL_GEAR: // give all gear FullGear(); break; case CHEAT_TEARS: // toggle tears cheat Tears(!s_CheatInfo[nCheatCode].bActive); break; case CHEAT_GIMMEGUN: GimmeGun( cMsg ); break; case CHEAT_GIMMEMOD: GimmeMod( cMsg ); break; case CHEAT_GIMMEGEAR: GimmeGear( cMsg ); break; case CHEAT_GIMMEAMMO: GimmeAmmo( cMsg ); break; case CHEAT_ENDGAME: ToggleEndgameFlag(); break; #ifndef _FINAL case CHEAT_CHASETOGGLE: // toggle 3rd person view ChaseToggle(); break; case CHEAT_CLIP: // toggle clipping mode SetClipMode(!s_CheatInfo[nCheatCode].bActive); break; case CHEAT_TELEPORT: // teleport to beginning Teleport(); break; case CHEAT_CAM_POSROT: // show/hide camera position/rotation SetCamPosRot(!s_CheatInfo[nCheatCode].bActive); break; case CHEAT_POSWEAPON: // toggle adjust of weapon pos PosWeapon(!s_CheatInfo[nCheatCode].bActive); break; case CHEAT_REMOVEAI: // remove all ai RemoveAI(!s_CheatInfo[nCheatCode].bActive); break; case CHEAT_TRIGGERBOX: // toggle trigger boxes on/off TriggerBox(!s_CheatInfo[nCheatCode].bActive); break; case CHEAT_POS1STCAM: // toggle 1st person camera adjust on/off Pos1stCam(!s_CheatInfo[nCheatCode].bActive); break; case CHEAT_SAVEVEHICLE: // save the vehicle tweaks to the bute file SaveVehicle( ); break; #endif // _FINAL #endif // _DEMO default: return false; // skip setting global cheat indicator for unhandled cheats } m_bPlayerCheated = true; return true; }
bool CCheatMgr::Process( CheatCode nCheatCode, CParsedMsg &cMsg ) { if ( nCheatCode <= CHEAT_NONE || nCheatCode >= CHEAT_MAX ) return false; #ifdef _FINAL // Don't do cheats in multiplayer... if (IsMultiplayerGame()) { // Well, okay, let them toggle between 1st and 3rd person ;) // and, well, blood is pretty cool... switch ( nCheatCode ) { case CHEAT_CHASETOGGLE: ChaseToggle(); break; case CHEAT_EXITLEVEL: // exit the current level SetExitLevel(); break; case CHEAT_NEXTMISSION: // exit the current mission NextMission(); break; case CHEAT_BOOT: // boot players BootPlayer(cMsg); break; default : return false; break; } m_bPlayerCheated = LTTRUE; return true; } #endif // _FINAL // process cheat codes switch ( nCheatCode ) { case CHEAT_GOD: // god mode toggle SetGodMode(!s_CheatInfo[nCheatCode].bActive); break; case CHEAT_SKILLZ: // give em skill points GetSkills(); break; case CHEAT_ARMOR: // full armor SetArmor(); break; case CHEAT_HEALTH: // full health SetHealth(); break; case CHEAT_EXITLEVEL: // exit the current level SetExitLevel(); break; case CHEAT_VERSION: // display version info Version(); break; case CHEAT_BUILDGUID: // display build guid BuildGuid(); break; case CHEAT_INVISIBLE: // time to mess with the AI SetInvisible(!s_CheatInfo[nCheatCode].bActive); break; case CHEAT_BODYGOLFING: // bodies fly far BodyGolfing(!s_CheatInfo[nCheatCode].bActive); break; case CHEAT_POS: // show/hide player position SetPos(!s_CheatInfo[nCheatCode].bActive); break; #ifndef _TO2DEMO case CHEAT_KFA: // give em everything SetKFA(); break; case CHEAT_AMMO: // full ammo SetAmmo(); break; case CHEAT_MODSQUAD: // give all mods for current weapons ModSquad(); break; case CHEAT_CONSOLE: SetConsole(!s_CheatInfo[nCheatCode].bActive); break; case CHEAT_NEXTMISSION: // exit the current mission NextMission(); break; case CHEAT_BOOT: // exit the current mission BootPlayer(cMsg); break; case CHEAT_FULL_WEAPONS: // give all weapons SetFullWeapons(); break; case CHEAT_SNOWMOBILE: // spawn in snowmobile Snowmobile(!s_CheatInfo[nCheatCode].bActive); break; case CHEAT_FULL_GEAR: // give all gear FullGear(); break; case CHEAT_TEARS: // toggle tears cheat Tears(!s_CheatInfo[nCheatCode].bActive); break; case CHEAT_GIMMEGUN: GimmeGun( cMsg ); break; case CHEAT_GIMMEMOD: GimmeMod( cMsg ); break; case CHEAT_GIMMEGEAR: GimmeGear( cMsg ); break; case CHEAT_GIMMEAMMO: GimmeAmmo( cMsg ); break; case CHEAT_ENDGAME: ToggleEndgameFlag(); break; #ifndef _FINAL case CHEAT_CHASETOGGLE: // toggle 3rd person view ChaseToggle(); break; case CHEAT_CLIP: // toggle clipping mode SetClipMode(!s_CheatInfo[nCheatCode].bActive); break; case CHEAT_TELEPORT: // teleport to beginning Teleport(); break; case CHEAT_CAM_POSROT: // show/hide camera position/rotation SetCamPosRot(!s_CheatInfo[nCheatCode].bActive); break; case CHEAT_POSWEAPON: // toggle adjust of weapon pos PosWeapon(!s_CheatInfo[nCheatCode].bActive); break; case CHEAT_POSWEAPON_MUZZLE: // toggle adjust of weapon muzzle pos PosWeaponMuzzle(!s_CheatInfo[nCheatCode].bActive); break; case CHEAT_WEAPON_BREACHOFFSET: // toggle adjust of weapon breach offset pos WeaponBreachOffset(!s_CheatInfo[nCheatCode].bActive); break; case CHEAT_LIGHTSCALE: // toggle client light scale offset LightScale(!s_CheatInfo[nCheatCode].bActive); break; case CHEAT_LIGHTADD: // toggle client light add offset LightAdd(!s_CheatInfo[nCheatCode].bActive); break; case CHEAT_FOV: // toggle fov cheat FOV(!s_CheatInfo[nCheatCode].bActive); break; case CHEAT_REMOVEAI: // remove all ai RemoveAI(!s_CheatInfo[nCheatCode].bActive); break; case CHEAT_TRIGGERBOX: // toggle trigger boxes on/off TriggerBox(!s_CheatInfo[nCheatCode].bActive); break; case CHEAT_POS1STCAM: // toggle 1st person camera adjust on/off Pos1stCam(!s_CheatInfo[nCheatCode].bActive); break; #endif // _FINAL #endif // _TO2DEMO default: return false; // skip setting global cheat indicator for unhandled cheats } m_bPlayerCheated = LTTRUE; return true; }
bool SW_HunterSeeker::Activate(SuperClass* pThis, const CellStruct &Coords, bool IsPlayer) { HouseClass* pOwner = pThis->Owner; auto pExt = SWTypeExt::ExtMap.Find(pThis->Type); BuildingClass* pBld = nullptr; CellStruct cell = CellStruct::Empty; // get the appropriate launch buildings list auto HSBuilding = &RulesExt::Global()->HunterSeekerBuildings; if(pExt->HunterSeeker_Buildings.size()) { HSBuilding = &pExt->HunterSeeker_Buildings; } // find a hunter seeker building that can launch me for(auto i : pOwner->Buildings) { if(HSBuilding->Contains(i->Type)) { // verify the building coordinates CoordStruct crd = i->GetCoords(); CellStruct tmp = CellClass::Coord2Cell(crd); cell = MapClass::Instance->Pathfinding_Find(tmp, SpeedType::Foot, -1, MovementZone::Normal, false, 1, 1, false, false, false, true, CellStruct::Empty, false, false); if(MapClass::Instance->IsWithinUsableArea(cell, true)) { pBld = i; break; } } } // no launch building found if(!pBld) { Debug::DevLog(Debug::Warning, "HunterSeeker super weapon \"%s\" could not be launched. House \"%ls\" " "does not own any HSBuilding (%d types set).\n", pThis->Type->ID, pOwner->UIName, HSBuilding->size()); return false; } // get the appropriate hunter seeker type UnitTypeClass* pType = pExt->HunterSeeker_Type; if(!pType) { if(auto pSide = SideClass::Array->GetItemOrDefault(pOwner->SideIndex)) { auto pSideExt = SideExt::ExtMap.Find(pSide); pType = pSideExt->HunterSeeker; } } // no type found if(!pType) { Debug::DevLog(Debug::Warning, "HunterSeeker super weapon \"%s\" could not be launched. " "No HunterSeeker unit type set for house \"%ls\".\n", pThis->Type->ID, pOwner->UIName); return false; } // create a hunter seeker auto pHunter = GameCreate<UnitClass>(pType, pOwner); // put it on the map and let it go if(pHunter) { auto pData = TechnoExt::ExtMap.Find(pHunter); pData->SuperWeapon = pThis; CoordStruct crd = CellClass::Cell2Coord(cell); if(pHunter->Put(crd, 64)) { pHunter->Locomotor->Acquire_Hunter_Seeker_Target(); pHunter->QueueMission(Mission::Attack, false); pHunter->NextMission(); } else { GameDelete(pHunter); } } return true; }