// September 2015 // Levee Patroller / Dijk Patrouille // This source file is (c) by Deltares. This source file is open source but only available to select users. Do not redistribute without written permission of Stichting Deltares, Delft, The Netherlands. // This header has been automatically generated. Class DebugInfoTips extends interaction; #exec OBJ LOAD FILE=PrimDikeSM.usx #exec OBJ LOAD FILE=SecDikeSM.usx var GameReplicationInfo GRI; var String LevelName; event Initialized() { log("Interaction Initialized"); foreach ViewportOwner.Actor.DynamicActors(class'GameReplicationInfo', GRI) If (GRI != None) Break; LevelName = Left(String(ViewportOwner.Actor.PlayerReplicationInfo), InStr(String(ViewportOwner.Actor.PlayerReplicationInfo), ".")); } event NotifyLevelChange() { log("Interaction removed"); Master.RemoveInteraction(self); // (destroy any actors spawned by this interaction) // (clean up any uscript objects that have been loaded) } Function Tick(Float TimeDelta) { Local int i; Local bool FoundIt; // If (GRI == None) //If the GRI becomes none for some reason, restore it. // RestoreGRI(); //If the level name has changed If (Left(String(ViewportOwner.Actor.PlayerReplicationInfo), InStr(String(ViewportOwner.Actor.PlayerReplicationInfo), ".")) != LevelName) { Log("Removing Self -- Level Different"); ViewportOwner.InteractionMaster.RemoveInteraction(Self); //Destroy self } //Start at newest, and work backwards to oldest. Means the newest one will always be the one that stays. For (i = ViewPortOwner.LocalInteractions.Length - 1; i >= 0; i--) { If (ViewPortOwner.LocalInteractions[i].IsA('DebugInfoTips')) { If (!FoundIt) { FoundIt = True; } Else If (FoundIt) { Log("Dupicate Found -- Destroying!"); ViewportOwner.InteractionMaster.RemoveInteraction(ViewPortOwner.LocalInteractions[i]); //More than one, destroy et! } } } } function PostRender( canvas Canvas ) { // return; // local Pawn P; local vector CameraLocation, dir, ScreenLocation; local rotator CameraRotation; local float dist; //, draw_scale; local LeveeFailure A; local Actor AV; local vector hudposition; local bool SkipStaticActors; /// Skip static actors? SkipStaticActors = true; Canvas.Style = 3; Canvas.SetDrawColor(255,255,255); ViewPortOwner.Actor.PlayerCalcView(AV, CameraLocation, CameraRotation); //Log("ViewPort owner: " @ ViewPortOwner.Actor @ " " @ CameraLocation); //CameraLocation = ViewPortOwner.Actor.Pawn.Location; //CameraRotation = ViewPortOwner.Actor.Pawn.Rotation; foreach ViewportOwner.Actor.AllActors (class'LeveeFailure', A) //, 8000, CameraLocation) { ScreenLocation = WorldToScreen(A.location); if (A.bStatic == false || (SkipStaticActors == false)) { if (A.bHidden == false) { dir = A.Location - CameraLocation; dist = Abs(VSize(dir)); //Distance between me and them if (dist < 8000 && (dir dot vector(CameraRotation) > 0)) { //draw_scale = 128 / dist; //Calculate the drawscale, 512 is the "1:1" distance. //Set drawing params hudposition.x = ScreenLocation.X;// - (32 * draw_scale); hudposition.y = ScreenLocation.Y;// - (32 * draw_scale); if (A.IsA('Mover')) { Canvas.SetDrawColor(255,255,0); } else if (A.IsA('Emitter')) { Canvas.SetDrawColor(50,255,128); } else if (A.IsA('LeveeFailure')){ /// Move position: hudposition.x -= 50; hudposition.y += 64; Canvas.SetDrawColor(255,0,0); } else if (A.IsA('Trigger')) { Canvas.SetDrawColor(200,128,50); } else if (A.IsA('ScriptedTrigger')) { Canvas.SetDrawColor(255,0,0); } else { Canvas.SetDrawColor(255,255,255); } Canvas.SetPos(hudposition.x, hudposition.y); Canvas.DrawText("C: " @ A.Class @ " (" @ A.Name @ ")"); Canvas.SetPos(hudposition.x, hudposition.y + 10); Canvas.DrawText("T: " @ A.Tag); Canvas.SetPos(hudposition.x, hudposition.y + 20); Canvas.DrawText("E: " @ A.Event); Canvas.SetPos(hudposition.x, hudposition.y + 30); Canvas.DrawText("M: " @ A.StaticMesh); if (A.IsA('LeveeFailure')) { Canvas.SetPos(hudposition.x, hudposition.y + 40); Canvas.DrawText("Act: " @ (A).LinkedTile.bActive @ " State: " @ GetEnum( enum'GeoStates', (A).LinkedTile.CurrentState ) @ "Relevant: " @ (A).LinkedTile.bRelevant @ "Reportable: " @ (A).LinkedTile.bReportable @ " Critical: " @ (A).LinkedTile.bCritical); Canvas.SetPos(hudposition.x, hudposition.y + 50); Canvas.DrawText( "Mechanism: " @ GetEnum( enum'FailingMechanisms', (A).LinkedTile.Mechanism ) ); } Canvas.SetPos(hudposition.x, hudposition.y + 60); Canvas.DrawText("R: " @ A.Rotation); } } } } } defaultproperties { bVisible=true bActive=true bRequiresTick=True }