// // CPT operator / SondeerGame // This source file is (c) by Deltares. // - October 2014 // class GeoPlayerController extends PlayerController config(GeoUser); #exec OBJ LOAD FILE=VehiclesA.ukx /* Cutscene vars */ var float animationtime; /* End */ /// jln - 25-09-2008 Interaction loadeD? (for office/sondeer work); var bool bHasInteraction; /// Language string ("NL", "EN", "DE",etc...); var globalconfig string PlayerLanguage; var globalconfig String DetailSetting; /// Variables regarding the company var string CompanyName; var class SondeerWagenClass; var SkeletalMesh SondeerWagenMesh; var Texture SondeerWagenSkin; /// Mouse: var vector PlayerMouse; var float LastHUDSizeX; var float LastHUDSizeY; /// Mouse coordinates in screen space: var float MouseScreenX; var float MouseScreenY; /// jln - 01-12-2008 When space is pressed this is set to true, so we can skip animations: var bool SkipAnimation; var SondeerLocation CurrentSondeerLocation; var globalconfig int ScenarioNumber; // is player currently on the special location var bool bPositionTriggered; // is the cable in the sondeerwagen broken var bool bCableBroken; // did player receive a KLIC-melding (requiring him/her to read it) var bool bKLIC; /// Respawn at which Z position? Determine at start var float RespawnZPosition; /// Struct which tells us which things were performed by the player struct PlayerPerformedActions { var int nrErrorsInChecks; /// How many errors (out of 4) when checking the assignment? var int nrObjectsHit; /// How many objects were hit with the truck? var int nrTimesTractor; /// How many times did the tractor rescue the player? var float AverageSondeerSpeed; /// How fast (in cm/s) did the player sondeer on average var float MaxSondeerSpeed; /// How fast (in cm/s) did the player sondeer maximally? var float SondeerDepth; /// The final result, how deep did the player go? var float ManualDepth; /// Until what depth did player sondeer manually? (from the start) var bool PlayerHasSelectedCone; /// Did the player choose a cone? Otherwise we cannot start the sondeer proces. var bool ApprovedAssignment; /// Did the player approve the opdrachtbon? var bool ConsultedKLIC; /// Did the player take a look at the KLIC-melding? var bool ClosedGates; /// Did player close the gates? var bool PerformedPreDig; /// First did some pre drilling? var bool ReturnedSand; /// Returned sand of predrill var bool OnlyReturnedSand; /// Only returned sand instead of garbage, of predrill var bool PutOnClothes; /// Did player put on working clothes? var byte SonderingStopPhase; /// 0 = on time, 1 = too early, 2 = too late var bool LevelledVehicle; /// 'stempelen', Vehicle levelled? var bool CheckedCone; /// Cone still okay, not damaged? var bool HasCorrectCone; /// Has correct cone? var bool CheckedCalibration; /// Cone calibrated? var bool CheckedCleaned; /// Cone cleaned? var bool CheckedForAir; /// Cone checked for air? var bool ReplacedCable; /// Replaced electrical cable for cone. var bool FinishedPreparations; /// Did player finish preparations? var bool RaisedHood; /// Raised hood? var bool AskedForBoorBeschrijving; /// Did player request boor beschrijving? var bool ForgotStempels; /// Did player forget the stempels BEFORE the sonderen var bool ZeroValuesErrorBefore; /// Did player say zerovalues were correct BEFORE the sondering var bool ZeroValuesErrorAfter; /// Did player say zerovalues were correct AFTER the sondering /// scenario specific var bool CalledForLocation; /// L1 - Did player ask for different location? var bool AskedPermission; /// L1 - Did player ask for permission from land owner? var bool DidBringPermit; /// L3 - Did player bring "Heetwerk vergunning" var bool DidBringClayColumn; /// L4 - Did player bring the clay column to fill hole afterwards var bool TalkedToDoorkeeper; /// L3 - Did player talk to portier before starting the sondering var bool UsingCasing; /// L3 - Did player decide to use casing (deep sondering) var int CasingDepth; /// When was the casing placed? (depth); var byte TimesCalledLandOwner; /// How many times called landowner? var byte TimesCalledContractor; /// How many times called contractor? var byte TimesCalledContractorLocation; /// L1 - How many times called contractor from important location (changing dialog)? var byte TimesCalledOffice; /// How many times called office? var byte TimesCalledOfficeLocation; /// L1 - How many times called office from important location (changing dialog)? var bool ConusBroken; /// Conus broke! var bool HasMap; /// Did player get the map check correctly (true) or not (false) or asked for a map anyway (true) var bool Level1HitCable; /// Did player 1 hit a cable? }; //// Actions performed by player. var PlayerPerformedActions playeractions; /// Array with tag names of conuses which have been ontlucht. var array ontluchteconussen; /// Gameover already, or not? var bool bIsGameOver; var name nTempName; var float cinrat; var bool bRelocateSondeerWagen; var vector vSondeerWagenLocation; var SondeerWagen aSondeerWagenToMove; var Rotator rSondeerWagenRotation; var Tractor puller; /// jln - 30-09-2008 The sondeerlocation we have to skip because the player asked us to. var SondeerLocation SondeerLocationToSkip; /// Race mode or not? var bool RaceMode; var int RaceTimeStart; /// nulmeting struct: struct NulMetingType { var float Diepte; var float PuntWeerstand; var float Kleef; var float Waterspanning; var float Helling; }; /// nulmeting after calibration in mV var NulMetingType NulmetingAfterCalibration; /// nulmeting before sondering in mV var NulMetingType NulmetingBefore; var bool NulMetingErrorBefore; var bool NulMetingErrorAfter; /// jln - 15-12-2008 Class name used as sondeercomputer; var string SondeerComputerClass; function RespawnPoint FindNearestRespawn() { local float distance, t; local RespawnPoint node, nearest; /// foundnode opnieuw doen distance = 999999999; ForEach AllActors(class'RespawnPoint', node) { t = VSize(Pawn.Location - node.Location); if (t < distance) { distance = t; nearest = node; } } Log("Using: " @ nearest); /// return nearest found node: return nearest; } //// Radar testing: exec function setrangex(int x) { GeoHud(myHud).RadarRangeX = x; } exec function setrangey(int y) { GeoHud(myHud).RadarRangeY = Y; } exec function setx(int x) { GeoHud(myHud).MapCenter.X = x; } exec function sety(int y) { GeoHud(myHud).MapCenter.Y = Y; } exec function dorespawn() { local PathNode foundnode; local SVehicle DrivenVehicle; /// Inverted yaw. local Rotator invertnode; local vector pullerpos; /// Start sondeerwagen animation... playeractions.nrTimesTractor++; ConsoleCommand("CINEMATICSRATIO 1.0"); ConsoleCommand("CINEMATICS"); /// Find nearest node: foundnode = FindNearestRespawn(); if (foundnode != None) { DrivenVehicle = SVehicle(Pawn); if( DrivenVehicle != None ) { DrivenVehicle.KDriverLeave(false); /// Set puller position: invertnode = foundnode.Rotation; invertnode.Yaw += 32768; pullerpos = foundnode.Location + (vect(900,0,0) >> invertnode); puller = Spawn(class'GeoSimulator.Tractor', self,, pullerpos, invertnode); puller.Throttle=10; /// Destroy old vehicle: DrivenVehicle.Destroy(); /// Spawn new sondeer wagen: aSondeerWagenToMove = Spawn(SondeerWagenClass, self,, foundnode.Location, foundnode.Rotation); vSondeerWagenLocation = foundnode.location; rSondeerWagenRotation = foundnode.rotation; /// Raise hood again: if (PlayerActions.RaisedHood) RaiseHood(); /// The new spawned object should take over the enabled stuff (hood, tracks, etc) /// Which is a thing 'todo'. /// jln - 25-09-2008 TODO /// Hide midgmae menu: //FindAndHide("MenuInGame"); /// Goto cutscene state GotoState('CutScene'); } } TriggerActions("carrespawn"); } exec function GivePlayerMap() { /// Give player map: playeractions.HasMap = true; } /// This function will remove the sondeerwagen interior and put a verhicle back: exec function EndGameAnimation() { local Actor interior; local rotator rot; local vector pos; local SVehicle DrivenVehicle; local DynamicMeshActor A; ConsoleCommand("CINEMATICSRATIO 1.0"); ConsoleCommand("CINEMATICS"); DrivenVehicle = SVehicle(Pawn); if( DrivenVehicle != None ) { DrivenVehicle.KDriverLeave(false); } /// SondeerWagenInterior does not exist, cheat using tag! ForEach AllActors(class'Actor', interior, 'SondeerWagenInterior') { break; } if (interior != None) { pos = interior.Location; rot = interior.rotation; rot.Yaw += 16384; /// jln - 17-11-2008 (SONDEER-59) /// Remove reflector pols in the nearby area (otherwise they show up inside the interior ForEach RadiusActors(class'DynamicMeshActor', a, 2000, pos) { if (a.StaticMesh == StaticMesh'HumanLandscapeSM.ConstructionStuff.ReflectorPole') { a.bHidden = true; } } ///Remove interior: interior.Destroy(); /// Spawn new vehicle pos.z -= 128; aSondeerWagenToMove = Spawn(SondeerWagenClass, self,, pos, rot); vSondeerWagenLocation = pos; rSondeerWagenRotation = rot; /// Goto cutscene state GotoState('EndScene'); } } /// jln - 16-09-2008 Set scenario number function SetScenarioNumber(int scenario) { Log("New scenario index: " @ scenario); ScenarioNumber = scenario; } /// jln - 16-09-2008 Get scenario number. function int GetScenarioNumber() { return ScenarioNumber; } //// Return scenario filename as used by IL8n; function string GetScenarioFile() { return "Scenario" $ self.ScenarioNumber; } /// jln - 10-09-2008 Write down ALL actions which have been performed by the player. Exec function PrintActions() { log(""); log("---------------------------------------------------------------------------"); Log("nrErrorsInChecks:" @ playeractions.nrErrorsInChecks); /// How many errors (out of 4) when checking the assignment? Log("nrObjectsHit:" @ playeractions.nrObjectsHit); /// How many objects were hit with the truck? Log("nrTimesTractor:" @ playeractions.nrTimesTractor); /// How many times did the tractor rescue the player? Log("AverageSondeerSpeed:" @ playeractions.AverageSondeerSpeed); /// Average Sondeer speed Log("MaxSondeerSpeed:" @ playeractions.MaxSondeerSpeed); /// Max Sondeer speed Log("SondeerDepth:" @ playeractions.SondeerDepth); /// Sondeer depth Log("ManualDepth:" @ playeractions.ManualDepth); /// Until what depth did player sondeer manually? (from the start) log("---------------------------------------------------------------------------"); Log("ConsultedKLIC:" @ playeractions.ConsultedKLIC); /// Did the player take a look at the KLIC-melding? Log("ClosedGates:" @ playeractions.ClosedGates); /// Did player close the gates? Log("PerformedPreDig:" @ playeractions.PerformedPreDig); /// First did some pre drilling? Log("ReturnedSand:" @ playeractions.ReturnedSand); /// Returned sand of predrill Log("OnlyReturnedSand:" @ playeractions.OnlyReturnedSand); /// Only returned sand instead of garbage, of predrill Log("PutOnClothes:" @ playeractions.PutOnClothes); /// Did player put on working clothes? //Log("SonderingStopPhase:" @ playeractions.SonderingStopPhase); /// 0 = on time, 1 = too early, 2 = too late Log("LevelledVehicle:" @ playeractions.LevelledVehicle); /// 'stempelen', Vehicle levelled? //Log("CheckedCone:" @ playeractions.CheckedCone); /// Cone still okay, not damaged? Log("HasCorrectCone:" @ playeractions.HasCorrectCone); /// Has correct cone? //Log("CheckedCalibration:" @ playeractions.CheckedCalibration); /// Cone calibrated? //Log("CheckedCleaned:" @ playeractions.CheckedCleaned); /// Cone cleaned? Log("CheckedForAir:" @ playeractions.CheckedForAir); /// Cone checked for air? Log("ReplacedCable:" @ playeractions.ReplacedCable); /// Replaced electrical cable for cone. Log("FinishedPreparations:" @ playeractions.FinishedPreparations); /// Did player finish preparations? Log("RaisedHood:" @ playeractions.RaisedHood); /// Raised hood? Log("AskedForBoorBeschrijving:" @ playeractions.AskedForBoorBeschrijving); /// Did player request boor beschrijving? Log("ForgotStempels:" @ playeractions.ForgotStempels); /// Did player forget to level BEFORE trying to sondeer.. Log("ZeroValuesErrorBefore:" @ playeractions.ZeroValuesErrorBefore); /// Did player say zerovalues were correct BEFORE the sondering Log("ZeroValuesErrorAfter:" @ playeractions.ZeroValuesErrorAfter); /// Did player say zerovalues were correct AFTER the sondering log("---------------------------------------------------------------------------"); Log("CalledForLocation:" @ playeractions.CalledForLocation); /// L1 - Did player ask for different location? Log("AskedPermission:" @ playeractions.AskedPermission); /// L1 - Did player ask for permission from land owner to sondeer? Log("DidBringPermit:" @ playeractions.DidBringPermit); /// L3 - Did player bring "Heetwerk vergunning" Log("DidBringClayColumn:" @ playeractions.DidBringClayColumn); /// L4 - Did player bring the clay column to fill hole afterwards Log("TalkedToDoorkeeper:" @ playeractions.TalkedToDoorkeeper); /// L3 - Did player talk to portier before starting the sondering Log("UsingCasing:" @ playeractions.UsingCasing); /// L3 - Did player decide to use casing (deep sondering) log("---------------------------------------------------------------------------"); Log("TimesCalledLandOwner:" @ playeractions.TimesCalledLandOwner); /// Times Called landowner? Log("TimesCalledContractor:" @ playeractions.TimesCalledContractor); /// Times Called contractor? Log("TimesCalledContractorLocation:" @ playeractions.TimesCalledContractorLocation); /// Times Called contractor from important location (changing dialog)? Log("TimesCalledOffice:" @ playeractions.TimesCalledOffice); /// Times Called office? Log("BrokenCable:" @ bCableBroken); /// Times Called office? log("---------------------------------------------------------------------------"); log(""); } exec function BrakeVehicle() { local SCar DrivenSVehicle; Pawn.Velocity = vect(0,0,0); Velocity = vect(0,0,0); DrivenSVehicle = SCar(Pawn); if(DrivenSVehicle != None) { DrivenSVehicle.Throttle=-10; DrivenSVehicle.Steering=0; DrivenSVehicle.Rise=0; Log("Braking vehicle"); DrivenSVehicle.OutputBrake=1; DrivenSVehicle.OutputHandbrake=true; DrivenSVehicle.StopThreshold=10000; DrivenSVehicle.MaxBrakeTorque=10000; DrivenSVehicle.MinBrakeFriction=100; //DrivenSVehicle.EngineBrakeFactor=0.7; SondeerWagen(Pawn).BrakeVehicle = 2; } } exec function ResetBrake() { local SVehicle DrivenSVehicle; DrivenSVehicle = SVehicle(Pawn); if(DrivenSVehicle != None) { SCar(Pawn).OutputBrake=0; SCar(Pawn).OutputHandbrake=false; SCar(Pawn).StopThreshold=100; SCar(Pawn).MaxBrakeTorque=120; SCar(Pawn).MinBrakeFriction=1; SondeerWagen(Pawn).BrakeVehicle = 0; // SCar(Pawn).EngineBrakeFactor=0.001; } } exec function OpenHandbook() { ClientOpenMenu("GeoInterface.MenuHandbook"); } exec function OpenEndSondering() { ClientOpenMenu("GeoInterface.dialogPreparation"); } exec function OpenMidGameMenu() { /// Check if we can open the dialog which allows player to call landowners and everything. if ( self.IsInState('PlayerDriving') ) { ClientOpenMenu("GeoInterface.MenuInGame"); } } exec function ShowScore() { ClientOpenMenu("GeoInterface.MenuEndGame"); } exec function ShowBoorbeschrijving() { ClientOpenMenu("GeoInterface.MenuBoorBeschrijving"); } /// Kind of a hack to be able to create dynamic names for the various triggers. function name GetName(string NameString) { SetPropertyText("nTempName", NameString); return nTempName; } exec function TriggerActions( string EventName ) { if(Len(EventName) > 0) { if(ScenarioNumber == 1 && Right(EventName, 7) == "elocate") { TriggerEvent( GetName(EventName), Pawn, Pawn); playeractions.CalledForLocation = true; } else if(ScenarioNumber == 1 && Right(EventName, 9) == "ermission") { // asked permission playeractions.AskedPermission = true; } else if(ScenarioNumber == 3 && Left(EventName, 8) == "opengate") { TriggerEvent( GetName(EventName), Pawn, Pawn); playeractions.TalkedToDoorkeeper = true; } else { /// jln - 28-11-2008 KEEP THIS! /// Trigger event if nothing else matches: TriggerEvent( GetName(EventName), Pawn, Pawn); } } } // removed this, replaced with bPositionTriggered. Maybe do it differently later. /* function UpdatePhoneIndex(int index) { ConversationIndex = index; } */ function GameOver(bool bLevelCompleted) { } function SetSticky(bool newval, optional bool force) { /// forced? if (force == true) { SondeerWagen(Pawn).bSticky = newval; return; } if (SondeerWagen(Pawn).bSticky == false) { GeoHud(myHud).SetMessage( IL8N("informstuck", "ingame"), 1, 10); SondeerWagen(Pawn).bSticky = newval; } } function RegisterObjectHit() { playeractions.nrObjectsHit += 1; /// jln - 18-11-2008 /// Show hud message: GeoHud(myHud).SetMessage( IL8N("objectbump" $ (Rand(2)), "ingame"), 1, 5); } function PreBeginPlay() { Super.PreBeginPlay(); cinrat = 1; /// jln Get race var: RaceMode = bool(Localize("Game", "RaceMode", "SondeerGame")); /// jln - 10-02-2009 Force language: //PlayerLanguage = Localize("Game","PlayerLanguage", "SondeerGame"); InitCompany(); /// jln 16-12-2008 Find respawn z FindRespawnZPosition(); /// jln - 04-09-2008 Replace all SondeerWagenStarts with the company sondeerwagen ReplaceSondeerStarts(); /// jln - 12-12-2008 /// Set sondeerlocation state SetSondeerLocationStates(); } function FindRespawnZPosition() { local RespawnPlaneDummy dum; foreach AllActors(class'RespawnPlaneDummy', dum) { RespawnZPosition = dum.location.z; break; } } function PostBeginPlay() { super.PostBeginPlay(); } function InitCompany() { CompanyName = Localize("Game", "Company", "SondeerGame"); CompanyName = "Deltares"; SondeerWagenClass = class'SondeerWagen_Deltares'; SondeerWagenMesh = SkeletalMesh'VehiclesA.SondeerWagen'; SondeerWagenSkin = Texture'SondeerMeester.SondeerWagen.Wagen_Deltares'; SondeerComputerClass = "dialogSondeerComputer_APBerg"; Log("Sondeer class: " @ SondeerComputerClass); } /// Get sondeercomputer class. function string GetSondeercomputerclass() { return SondeerComputerClass; } function SetSondeerLocationStates() { local bool alreadypredigged; local SondeerLocation loc; foreach AllActors(class'SondeerLocation', loc) { alreadypredigged = bool(Localize("SondeerLocation", "AlreadyPredigged" , GetScenarioFile())); /// Default state: if (alreadypredigged == false) { loc.SetState(0); } else { /// Already predigged, make open: loc.SetState(1); } } } /// jln - 04-09-2008 Replace all SondeerWagenStarts with the company sondeerwagen function ReplaceSondeerStarts() { local SondeerWagenStart starts; foreach AllActors(class'SondeerWagenStart', starts) { Log("Replace sondeerwagen start: " @ starts @ "- " @ SondeerWagenClass @ "- " @ starts.Location); /// Spawn object at the position and rotation of the SondeerWagenStart: Spawn(SondeerWagenClass, self,, starts.Location, starts.Rotation); /// Remove sondeerwagen start: starts.Destroy(); } } exec function SetLocState(int newstate) { local SondeerLocation starts; foreach AllActors(class'SondeerLocation', starts) { starts.SetState(newstate); } } function string GetCompany() { return CompanyName; } function SkeletalMesh GetSondeerWagenMesh() { return SondeerWagenMesh; } function Texture GetSondeerWagenSkin() { return SondeerWagenSkin; } function string GetLanguage() { return PlayerLanguage; } function ChangeLanguage(string lang) { PlayerLanguage = lang; SaveConfig(); } function EnterStartState() { super.EnterStartState(); MouseScreenX = 0; MouseScreenY = 0; /// Add our new interaction. if (bHasInteraction == false) { Player.InteractionMaster.AddInteraction("GeoInterface.MouseItemInteraction", Player); bHasInteraction = true; /// If we got here, it means the game just started, so check for startmode: /// If startmode is "mousing", then we need to start the game in the menu/mouse mode instead of normal walking. if (Localize("Game","StartMode","SondeerGame") == "mouse") { Log("Mousing state"); GotoState('PlayerMousing'); } } // GotoState('Normal'); startTimer(); } exec function RestorePosition() { local vector v; v = Pawn.Location; v.z += 3000; v.y += 1000; SetLocation(v); Pawn.SetLocation(v); } exec function CinUp() { if (cinrat < 1.3) { cinrat += 0.01; ConsoleCommand("CINEMATICSRATIO " $ cinrat); } else { ConsoleCommand("CINEMATICSRATIO 1.3"); } } exec function CinDown() { if (cinrat > 1.0) { cinrat -= 0.01; ConsoleCommand("CINEMATICSRATIO " $ cinrat); } else { ConsoleCommand("CINEMATICSRATIO 1.0"); } } exec function KarmaON() { local SondeerWagen S; ForEach DynamicActors(class'SondeerWagen', S) S.ModifyKarmaOn(); } exec function KarmaOff() { local SondeerWagen S; ForEach DynamicActors(class'SondeerWagen', S) S.ModifyKarmaOff(); } exec function Raiserups() { local SondeerWagen S; ForEach DynamicActors(class'SondeerWagen', S) S.RaiseRups(); } exec function Lowerrups() { local SondeerWagen S; ForEach DynamicActors(class'SondeerWagen', S) S.LowerRups(); } exec function RaiseStairs() { local SondeerWagen S; ForEach DynamicActors(class'SondeerWagen', S) S.RaiseTrap(); } exec function LowerStairs() { local SondeerWagen S; ForEach DynamicActors(class'SondeerWagen', S) S.LowerTrap(); } exec function bool Lowerstempels() { local SondeerWagen S; if (playeractions.LevelledVehicle == true) return false; ForEach DynamicActors(class'SondeerWagen', S) S.LowerStempels(); /// Update player actions: playeractions.LevelledVehicle = true; return true; } exec function Raisestempels() { local SondeerWagen S; ForEach DynamicActors(class'SondeerWagen', S) S.RaiseStempels(); } exec function RaiseHood() { local SondeerWagen S; ForEach DynamicActors(class'SondeerWagen', S) S.RaiseHoed(); } exec function LowerHood() { local SondeerWagen S; ForEach DynamicActors(class'SondeerWagen', S) S.LowerHoed(); } function int GetVelocity() { local SondeerWagen S; ForEach DynamicActors(class'SondeerWagen', S) return S.CarMPH * 1.6; //return int(VSize(Pawn.Velocity) / 25); } exec function Leave() { local SVehicle DrivenVehicle; DrivenVehicle = SVehicle(Pawn); if( DrivenVehicle != None ) { DrivenVehicle.KDriverLeave(false); } } //============================================================================= // calls Timer() every second // Date Id Modification // 2006-10-09 The Created this header //============================================================================= function startTimer() { //log("STARTED TIMER"); SetTimer(1.0,true); } function GUIPage FindMenu(string sname) { return GUIController(Player.GUIController).FindMenu(sname); } /// jln - 07-08-2008 Find and close menu function bool FindAndHide(string sname) { local GUIPage p; p = GUIController(Player.GUIController).FindMenu(sname); if (p != None) { /// Show and try to close: p.Show(); GUIController(Player.GUIController).CloseMenu(false); return true; } return false; } /// jln - 07-08-2008 Leave vehicle function LeaveVehicle() { local SVehicle DrivenSVehicle; local bool gotOut; DrivenSVehicle = SVehicle(Pawn); if(DrivenSVehicle != None) { gotOut = DrivenSVehicle.KDriverLeave(true); if(!gotOut ) { Log("Couldn't Leave - staying in!"); } } } /// jln - 08-08-2008 Internationalize an item (IL8N); function string IL8N(string item, string section, optional bool uselevel) { if (uselevel) { return Localize(section $ "." $ self.PlayerLanguage, item , "Scenario" $ self.ScenarioNumber); } else { return Localize(section, item , "Language_" $ self.PlayerLanguage); } } function ChangeSondeerWagenView() { // local SondeerWagen sondeerwagen; /// Find sondeerwagen and change special view: // foreach GeoPC.AllActors(class'SondeerWagen', sondeerwagen) // { // sondeerwagen.bSpecialCalcView=true; // } } //============================================================================= // ShowMenu created to be able to open score instead of MidGameMenu // Date Id Modification // 2007-07-01 gui Created function //============================================================================= exec function ShowMenu() { Log("mid game menu: " @ MidGameMenuClasS); // Pause if not already if(Level.Pauser == None && Level.NetMode == NM_StandAlone) SetPause(true); StopForceFeedback(); // Open menu if (!bIsGameOver) { ClientOpenMenu(MidGameMenuClass); } else { //ClientOpenMenu("GeoSimulator.MenuScore"); } } exec function Test() { GUIController(Player.GUIController).OpenMenu("GeoInterface.MenuLevelMap"); } exec function before() { GUIController(Player.GUIController).OpenMenu("GeoInterface.MenuNulMeting", "before"); } exec function after() { GUIController(Player.GUIController).OpenMenu("GeoInterface.MenuNulMeting", "after"); } exec function Chat() { GUIController(Player.GUIController).OpenMenu("GeoInterface.MenuCallLandOwner"); } exec function comp() { GUIController(Player.GUIController).OpenMenu("GeoInterface." $ GetSondeercomputerclass()); // GUIController(Player.GUIController).OpenMenu("GeoInterface.dialogSondeerComputer"); } /* function PlayerTick(float delta) { super.Playertick(delta); } */ function Timer() { local vector v; local SondeeRLocation sl; ///Check if player is driving, and if the car is placed on a sondeer location. if (self.IsInState('PlayerDriving')) { CurrentSondeerLocation = None; v.x = self.Pawn.Location.x; v.y = self.Pawn.Location.y; v.z = -48; //self.Pawn.Location.z; ForEach CollidingActors ( class'SondeerLocation', SL, 1024, v ) { /// We found an item. CurrentSondeerLocation = SL; break; } /// jln - 30-09-2008 Do we have to skip a sondeerlocation? /// We set it back to none if the location has changed to none or something else. if (SondeerLocationToSkip != None) { if (CurrentsondeerLocation == None || CurrentsondeerLocation != SondeerLocationToSkip) { SondeerLocationToSkip = None; } } /// Respawn when too low... level 2 only. //if (self.Pawn.Location.z < -612 && ScenarioNumber == 2) //{ // DoRespawn(); //} /// Respawn for below z: /// Respawn when too low... level 2 only. if (self.Pawn.Location.z < RespawnZPosition) { DoRespawn(); } } } /* state DoNormal { exec function Fire(float f) { // do stuff here for when players click their fire/select button return; } simulated function PlayerMove(float DeltaTime) { super.PlayerMove(DeltaTime); } }*/ state PlayerMousing { function EnterStartState() { Log("Playermousing state"); //super.EnterStartState(); If (Pawn != None) { Pawn.SetPhysics(PHYS_None); } SetPhysics(PHYS_None); Log(Level.Title); /// jln - 28-11-2008 Hacj alert, anti crash: if (Level.title != "Untitled" && Level.title != "Intro") { /// Player did not approve assignment yet? if (PlayerActions.ApprovedAssignment == false) { /// Phase 1 //ClientOpenMenu("GeoInterface.dialogPhaseIntro", false, "Phase1"); } } } exec function Fire(float f) { // do stuff here for when players click their fire/select button return; } simulated function PlayerMove(float DeltaTime) { local vector MouseV, ScreenV; local rotator NewRot; local int iOffset; local int iHudXOffset, iHudYOffset; iOffset = 64; iHudXOffset = LastHudSizeX - iOffset; iHudYOffset = LastHudSizeY - iOffset; // get the new mouse position offset MouseV.X = DeltaTime * aMouseX / (InputClass.default.MouseSensitivity * DesiredFOV * 0.01111); MouseV.Y = DeltaTime * aMouseY / (InputClass.default.MouseSensitivity * DesiredFOV * -0.01111); //Log(MouseV.X @ " " @ MouseV.Y); // update mouse position PlayerMouse += MouseV; // convert mouse position to screen coords, but only if we have good screen sizes if ((LastHUDSizeX > 0) && (LastHUDSizeY > 0)) { ScreenV.X = PlayerMouse.X + LastHUDSizeX * 0.5; ScreenV.Y = PlayerMouse.Y + LastHUDSizeY * 0.5; } NewRot = Rotation; /// Rotate player to left: if (ScreenV.X < iOffset) { NewRot.Yaw += (DeltaTime * (ScreenV.X - iOffset)) * 128; } /// Rotate player to right: if (ScreenV.X > iHudXOffset) { NewRot.Yaw -= (DeltaTime * (iHudXOffset - ScreenV.X)) * 128; } /// Rotate player to left: /// temp hardcoded values!! if (ScreenV.Y < iOffset) { NewRot.Pitch -= (DeltaTime * (ScreenV.Y - iOffset)) * 128; } /// Rotate player to right: if (ScreenV.Y > iHudYOffset) { NewRot.Pitch += (DeltaTime * (iHudYOffset - ScreenV.Y)) * 128; } /// Pitch limiter: if (NewRot.Pitch > 8000) NewRot.Pitch = 8000; if (NewRot.Pitch < -7000) NewRot.Pitch = -7000; SetRotation(NewRot); /// update global coordinates: MouseScreenX = ScreenV.X; MouseScreenY = ScreenV.Y; return; } } //============================================================================= // Date Id Modification // 2007-02-03 Gui Function for having scores updated //============================================================================= function SaveScore(string MyScore) { local GlobalScore GScore; GScore = new class'GlobalScore'; GScore.SaveScores(MyScore); } /// Get the time that the player took to race to the destination: function string GetRaceTime() { local TimerActor ta; /// Find timer and stop: ForEach DynamicActors ( class'TimerActor', ta ) { break; } if (ta != None) { return string(int(ta.totaltime)); } return "9999"; } /// Test // Player movement. // Player Driving a Karma vehicle. state PlayerDriving { /// test, do nothing: // Set the throttle, steering etc. for the vehicle based on the input provided function ProcessDrive(float InForward, float InStrafe, float InUp, bool InJump) { local SondeerWagen A; /// Test, make the sondeerwagen slow down if necessary: ForEach DynamicActors( class 'SondeerWagen', A,) { if (A.bSticky == true) { // Decrease throttle: if (A.Throttle > 0) { A.Throttle *= A.fStickyFactor; } if (A.Throttle < 0.1) A.Throttle = 0; } else { Super.ProcessDrive(InForward, InStrafe, InUp, InJump); } break; } } } function CleanOutSavedMoves() { Log("Clean out do nothing"); } state CutScene { // Not used. function ProcessDrive(float InForward, float InStrafe, float InUp, bool InJump) { } function BeginState() { animationtime = 0; Log("Begin CutScene - Disable collisions " @ Pawn); /// Disable collision on player Pawn.SetCollision(false, false, false); Pawn.bCollideWorld = false; } function EndState() { Log("End CutScene - Enable collisions " @ Pawn); GotoState('PlayerWalking'); } function PlayerTick(float DeltaTime) { local vector v; local vector dir; local rotator lookdir; local vector loc; Super.Playertick(deltatime); animationtime += deltatime; if (animationtime < 3) { CinUp(); } if (animationtime > 5 && animationtime < 7) { CinDown(); } if (animationtime > 6.5 || SkipAnimation == true) { cinrat = 1; ConsoleCommand("CINEMATICSRATIO 1.0"); SkipAnimation = false; /// Exit cinematics... ConsoleCommand("CINEMATICS"); Pawn.SetCollision(true, true, true); Pawn.bCollideWorld = true; /// Break animation after 4 seconds: /// Try to drive sondeerwagen again: aSondeerWagenToMove.TryToDrive(Pawn); /// Destroy puller: puller.Destroy(); puller = None; } if (puller != None) { puller.Throttle = 1; } v = vSondeerWagenLocation; v.x += 1500; v.y -= 1500; v.z += 3000; Dir = (v - Pawn.Location); Pawn.MoveSmooth( Dir * (DeltaTime)); loc = vSondeerWagenLocation; loc.x = int(loc.x); loc.y = int(loc.y); loc.z = int(loc.z); lookdir = rotator( Normal(loc - Pawn.Location)); BlendedTargetViewRotation.Pitch = BlendRot(DeltaTime / 2, BlendedTargetViewRotation.Pitch, lookdir.Pitch); BlendedTargetViewRotation.Yaw = BlendRot(DeltaTime / 2, BlendedTargetViewRotation.Yaw, lookdir.Yaw ); BlendedTargetViewRotation.Roll = BlendRot(DeltaTime / 2, BlendedTargetViewRotation.Roll, lookdir.Roll ); //GetAxes(Rotation,X,Y,Z); if (Abs(Rotation.Yaw - BlendedTargetViewRotation.Yaw) > 2) { SetRotation(BlendedTargetViewRotation); } //OldRotation = Rotation; //Rotation = BlendedTargetViewRotation; //Acceleration = 0.02 * (aForward*X + aStrafe*Y + aUp*vect(0,0,1)); //UpdateRotation(DeltaTime, 1); /// Look at: //Pawn.SetRotation(lookdir); //SetRotation(lookdir); } } state EndScene { // Not used. function ProcessDrive(float InForward, float InStrafe, float InUp, bool InJump) { } function BeginState() { animationtime = 0; Log("Begin CutScene - Disable collisions " @ Pawn); /// Disable collision on player Pawn.SetCollision(false, false, false); Pawn.bCollideWorld = false; /// Automatically brake: aSondeerWagenToMove.BrakeVehicle = 2; } function EndState() { Log("End CutScene - Enable collisions " @ Pawn); GotoState('PlayerWalking'); } function PlayerTick(float DeltaTime) { local vector v; local vector dir; local rotator lookdir; local vector loc; Super.Playertick(deltatime); animationtime += deltatime; if (animationtime < 3) { CinUp(); } if (animationtime > 10 || SkipAnimation == true) { cinrat = 1; ConsoleCommand("CINEMATICSRATIO 1.0"); SkipAnimation = false; Leave(); ClientOpenMenu(GUIController(Player.GUIController).GetMainMenuClass()); ClientOpenMenu("GeoInterface.MenuMainMenu"); ConsoleCommand( "DISCONNECT" ); } v = vSondeerWagenLocation; /// Look at: v.x += 1500; v.y -= 1500; v.z += 3000; Dir = (v - Pawn.Location); Pawn.MoveSmooth( Dir * (DeltaTime)); loc = vSondeerWagenLocation; loc.x = int(loc.x); loc.y = int(loc.y); loc.z = int(loc.z); lookdir = rotator( Normal(loc - Pawn.Location)); BlendedTargetViewRotation.Pitch = BlendRot(DeltaTime / 2, BlendedTargetViewRotation.Pitch, lookdir.Pitch); BlendedTargetViewRotation.Yaw = BlendRot(DeltaTime / 2, BlendedTargetViewRotation.Yaw, lookdir.Yaw ); BlendedTargetViewRotation.Roll = BlendRot(DeltaTime / 2, BlendedTargetViewRotation.Roll, lookdir.Roll ) ; //GetAxes(Rotation,X,Y,Z); SetRotation(BlendedTargetViewRotation); } } defaultproperties { PlayerLanguage="NL" ScenarioNumber=1 }