// 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. /* /// jln - 26-03-2009 /// End game feedback window */ #exec OBJ LOAD FILE=GeoGamePlayTextures.utx class MenuEndGameFeedback extends GUIPage; var int SelectedFailure ; var RedMarker SelectedMarker; var LeveeTile SelectedTile; var GUIImage Img_failurelevelmap; /// Top-Left var GUIScrollTextBox txtFeedback; /// Bottom-Left var GUIImage Img_failuredrawing; /// Bottom-Right; var GUIImage Img_failureingame; /// Top-Right var automated GUIButton but_Next, but_Prev; var GUIButton xbut_Next, xbut_Prev; //Variables for map texture (can be easilly changed this way) var float MapHeight, MapWidth, MapCenterX, MapCenterY; var GeoPlayerController GeoPC; /// Start/end loop values: const MAX_MARKERS_POS = 39; const MIN_MARKERS_POS = 6; struct ExtraCompressedPosition { var vector Location; var rotator Rotation; var LeveeTile failuretile; var bool bUnreported; /// not reported? var bool bCalledAC; /// Called AC for it? var bool bNoTile; var array Signals; }; var ExtraCompressedPosition ArrayPositions[MAX_MARKERS_POS]; var int ScorePossible; // Total possible player score var int ScorePlayer; // Total player score var int ScorePercentage; // Total player score in percentage var string EvaluationText; // Total player score in text /* Scoring code */ // Begin of constants also defined in GeoScoreboard and MenuScore const SCORE_INDEX_FAILURES = 0; const SCORE_INDEX_LOCATIONS = 1; const SCORE_INDEX_SIGNALS = 2; const SCORE_INDEX_REPORTS = 3; const SCORE_INDEX_ASSESSMENTS = 4; const SCORE_INDEX_DIAGNOSES = 5; const SCORE_INDEX_MEASURES = 6; const SCORE_INDEX_COUNT = 7; // End of constants also defined in GeoScoreboard and MenuScore var GeoLevelDetails GeoLD; const POINTS_FAILURES = 10; const POINTS_LOCATIONS = 1; const POINTS_SIGNALS = 5; const POINTS_REPORTS = 1; const POINTS_ASSESSMENTS = 2; const POINTS_DIAGNOSES = 5; const POINTS_MEASURES = 5; const CReportScoreFractionThreshold = 0.7; var array ActiveLeveeTiles; var array PlacedMarkers; struct ScoreInfo { var int UserCount; // how often did a user do something, not used to calculate the score yet... the UserCount for Assessment is not yet set right. var int CorrectCount; var int MaxCount; var int SingleScore; var int Score; var int MaxScore; }; var array ScoreArray; // The ScoreArray contains the detailed scoring struct FailureStateInfo{ var name FailureName; var GeoEnums.GeoStates FailureState; var GeoEnums.GeoStates CurrentState; var string NL_MechanismName; var string EN_MechanismName; var LocationNameSign MapLocationSign; var int ScoreLocation; var int ScoreLocationMax; var int ScoreReport; var int ScoreReportMax; var int ScoreAssessment; var int ScoreAssessmentMax; var int ScoreDiagnosis; var int ScoreDiagnosisMax; var int ScoreMeasure; var int ScoreMeasureMax; var int ScoreTotal; var int ScoreTotalMax; }; var array FailureArray; // The FailureArray contains the scoring data per failure and the failure properties // The failure properties are determined in InitFailureData and FillFailureData // The scores are determined in CalculateScore /// Current mechanism for animation var string mechname; /// total frames; var int totalframes; /// current frame. var int curframe; /// Canvas cache: var Canvas myC; var int MinPercentageToPassLevel; var bool IsPlayerAllowedNextLevel; function InternalOnClose(optional Bool bCanceled) { Super.OnClose(bCanceled); GeoPC.SetPause(false); } function InitComponent(GUIController MyController, GUIComponent MyOwner) { local string MapName; Super.InitComponent(MyController, MyOwner); GeoPC=GeoPlayerController(PlayerOwner()); GeoPC.SetPause(true); OnClose = InternalOnClose; MapName=string(GeoPC.Outer); //MapName="Scenario1DG"; Img_failurelevelmap = GUIImage(Controls[0]); txtFeedback = GUIScrollTextBox(Controls[1]); Img_failureingame = GUIImage(Controls[2]); Img_failuredrawing = GUIImage(Controls[3]); xbut_Next = GUIButton(Controls[4]); xbut_Prev = GUIButton(Controls[5]); /// Top-left (map) Img_failurelevelmap.WinWidth = 0.5; Img_failurelevelmap.WinHeight = 0.5; Img_failurelevelmap.WinLeft = 0.5; Img_failurelevelmap.WinTop = 0; Img_failurelevelmap.Image = Material(DynamicLoadObject(MapName$".LevelMap.MapPreview", class'Material')); /// Bottom-left (feedback) txtFeedback.WinWidth = 0.5; txtFeedback.WinHeight = 0.95; txtFeedback.WinLeft = 0; txtFeedback.WinTop = 0; txtFeedback.SetContent( IL8N("click_item") ); /// Top-Right (image) Img_failureingame.WinWidth = 0.5; Img_failureingame.WinHeight = 0.45; Img_failureingame.WinLeft = 0.5; Img_failureingame.WinTop = 0.5; Img_failureingame.Image = Material(DynamicLoadObject("FailureImagesT.Signals.unknownsignal", class'Material')); /// Active tiles: FillActivetiles(); totalframes = 0; curframe = 0; SelectedFailure = 0; PrevNextClick(None); /// Bottom-Right /* Img_failuredrawing.WinWidth = 0.5; Img_failuredrawing.WinHeight = 0.5; Img_failuredrawing.WinLeft = 0.5; Img_failuredrawing.WinTop = 0.5; Img_failuredrawing.Image = Material(DynamicLoadObject("IngameMenuImagesT.Handbook.ErosionInner", class'Material')); */ UpdateLimits(); UpdateMarkers(); } function FillActivetiles() { local LeveeTile T; local RedMarker A; local bool reported; local int i; ForEach GeoPC.DynamicActors( class 'RedMarker', A, 'RedMarker') { /// If it is already in the list PlacedMarkers.Insert(0,1); PlacedMarkers[0] = A; } ForEach GeoPC.DynamicActors( class 'LeveeTile', T) { /// Check if the tile is already reported. reported = false; /// Active? if (T.bActive) { for (i = 0; i < PlacedMarkers.Length; i++) { if (PlacedMarkers[i].LTile == T) { reported = true; break; } } if (reported == false) { /// Store: ActiveLeveeTiles.Insert(0,1); ActiveLeveeTiles[0] = T; } } } } function bool PrevNextClick(GUIComponent Sender) { local int ifailurecount; local GeoLevelDetails GLD; local GeoCompleteExercise GCE; local string PreviousLevelURL; ifailurecount = FailureCount(); switch(Sender) { case Controls[4]: Log("Next"); SelectedFailure++; if (SelectedFailure >= ifailurecount) { SelectedFailure = ifailurecount-1; GLD = new class'GeoLevelDetails'; GCE = new class'GeoCompleteExercise'; /// Exit this dialog if (GeoPC.PlayerInvokedQuit == true) { Controller.OpenMenu(Controller.GetMainMenuClass()); Controller.OpenMenu("GeoInterface.MainMenuOptions"); return true; } if(!(GeoPC.IsBreachOccurred) && GeoPC.ScorePercentage >= MinPercentageToPassLevel) { IsPlayerAllowedNextLevel = true; } if(GLD.IsCompleteExercise && IsPlayerAllowedNextLevel) { if(GCE.IsLastLevel()) { GCE.bIsCompleteExerciseWinner=true; GCE.SaveConfig(); PreviousLevelURL=GCE.GetWinnerLevelString(); GeoPC.Level.ServerTravel(PreviousLevelURL, false); Controller.CloseMenu(); // Close _all_ menus return true; }else { GeoPC.InMenu(false); GCE.NextLevel(); GCE.SetDetails(); PreviousLevelURL=GCE.GetLevelString(); GeoPC.Level.ServerTravel(PreviousLevelURL, false); Controller.CloseMenu(); // Close _all_ menus return true; } } Controller.OpenMenu(Controller.GetMainMenuClass()); Controller.OpenMenu("GeoInterface.MainMenuOptions"); // Controller.CloseMenu(); return true; } if (SelectedFailure >= ifailurecount-1) { GUIButton(Controls[4]).Caption = "Sluiten"; } else { GUIButton(Controls[4]).Caption = "Volgende"; } break; case Controls[5]: Log("Previous"); SelectedFailure--; if (SelectedFailure < 0) { SelectedFailure = 0; } break; } Log( SelectedFailure @ "/" @ ifailurecount ); SelectedMarker = None; SelectedTile = None; /// Show current item: if (SelectedFailure < PlacedMarkers.Length) { Log("Show Marker"); /// Use red marker ShowFailure(PlacedMarkers[SelectedFailure].LTile, PlacedMarkers[SelectedFailure]); SelectedMarker = PlacedMarkers[SelectedFailure]; } else { Log("Show tile"); /// Use the forgotten leveetiles: ShowFailure(ActiveLeveeTiles[ (SelectedFailure - PlacedMarkers.Length)], None); SelectedTile = ActiveLeveeTiles[ (SelectedFailure - PlacedMarkers.Length)]; } SelectMarker(SelectedFailure); /// Update: return true; } function SelectMarker(int index) { local int i; local int pos; for (i = 0; i < PlacedMarkers.Length; i++) { pos = MIN_MARKERS_POS + i; if (PlacedMarkers[i].LTile != None) { GUIImage(Controls[pos]).Image=Material'GeoGameplayTextures.MapIcons.MapX'; } else { GUIImage(Controls[pos]).Image=Material'GeoGameplayTextures.MapIcons.MiniMarker'; } if (SelectedMarker != None) { if (PlacedMarkers[i] == SelectedMarker) { GUIImage(Controls[pos]).Image=Material'GeoGameplayTextures.MapIcons.Player'; } } } /// Set selected: // Log("SelectMarker: " $ index $ " " $ PlacedMarkers.Length); // if (index >= 0 && index < PlacedMarkers.Length) // { // } } function bool OnDraw(Canvas MyCanvas) { Super.OnDraw(MyCanvas); myC = MyCanvas; UpdateFailures(MyCanvas); return true; } function UpdateLimits() { local GeoMapDetails GMD; local GeoLevelDetails GLD; local int MapNumber; GMD = new class'GeoMapDetails'; GLD = new class'GeoLevelDetails'; MapNumber = GLD.CurrentLevelScenarioNumber; MapHeight=GMD.GetHeight(MapNumber); MapWidth=GMD.GetWidth(MapNumber); MapCenterX=GMD.GetCenterX(MapNumber); MapCenterY=GMD.GetCenterY(MapNumber); Log("Update limits - mapnumber: " @ MapNumber); } function int FailureCount() { local int i; //local LeveeTile T; i = ActiveLeveeTiles.Length + PlacedMarkers.Length; Log("Not reported tiles: " $ ActiveLeveeTiles.Length $ " Placedmarkers: " $ PlacedMarkers.Length); /* ForEach GeoPC.DynamicActors( class 'LeveeTile', T) { if (T.bActive) { i++; } } */ return i; } /// jln - 05-03-2009 New code, display failure mechanism rectangles function UpdateFailures(Canvas C) { local LeveeFailure F; local int i; local float TempWidth, TempHeight; local vector coords[4]; local Color WhiteColor; TempWidth= (Img_failurelevelmap.WinWidth) / 2; TempHeight=(Img_failurelevelmap.WinHeight) / 2; ForEach GeoPC.DynamicActors( class 'LeveeFailure', F) { for ( i = 0; i < 4; i++) { coords[i].x = (0.5*C.SizeX) + (((0.25 - (((F.BoundingBoxCache[i].x - MapCenterX) / MapWidth) * TempWidth)) * C.SizeX)); coords[i].y = (0.25 - (((F.BoundingBoxCache[i].y - MapCenterY) / MapHeight) * TempHeight)) * C.SizeY; } if (F.LinkedTile != SelectedTile) { WhiteColor = class'Canvas'.Static.MakeColor(255,255,255); C.DrawColor = WhiteColor; } else { /// Set selected color: WhiteColor = class'Canvas'.Static.MakeColor(255,0,255); C.DrawColor = WhiteColor; } DrawLine(C, coords[0].x,coords[0].y, coords[1].x,coords[1].y); DrawLine(C, coords[1].x,coords[1].y, coords[2].x,coords[2].y); DrawLine(C, coords[2].x,coords[2].y, coords[3].x,coords[3].y); DrawLine(C, coords[3].x,coords[3].y, coords[0].x,coords[0].y); } /// Reset WhiteColor = class'Canvas'.Static.MakeColor(255,255,255); C.DrawColor = WhiteColor; } function UpdateMarkers() { local int i; local float TempWidth, TempHeight; local RedMarker A; local LeveeTile t; local bool isreported; local int j; local vector coords[4]; // FIND ALL RED MARKER ONCE i = MIN_MARKERS_POS; //First controller for markers TempWidth=(Img_failurelevelmap.WinWidth) / 2; TempHeight=(Img_failurelevelmap.WinHeight) / 2; ForEach GeoPC.DynamicActors( class 'RedMarker', A, 'RedMarker') { Log("marker: " @ i); if (A.bActionCenterCalled == true) { Controls[i].WinLeft= Img_failurelevelmap.WinLeft + (0.25 - ((A.Location.x - MapCenterX) / MapWidth) * TempWidth - (Controls[i].WinWidth / 2)); Controls[i].WinTop= 0.25 - ((A.Location.y - MapCenterY) / MapHeight) * TempHeight - (Controls[i].WinHeight); Controls[i].bVisible=true; ArrayPositions[i].Location=A.Location; ArrayPositions[i].Rotation=A.Rotation; ArrayPositions[i].failuretile=A.LTile; /// is none when there is no tile. ArrayPositions[i].bCalledAC=A.bActionCenterCalled; ArrayPositions[i].Signals = A.Signals; if (i TODO: see how to create object here i++; } } /// Loop through all failure tiles, and mark those which are NOT reported. ForEach GeoPC.DynamicActors( class 'LeveeTile', T) { if (T.bActive) { isreported = false; Log("r: " @ T.bReported @ " d: " @ T.bDetected); ForEach GeoPC.DynamicActors( class 'RedMarker', A, 'RedMarker') { if (T == A.LTile) { isreported = A.bActionCenterCalled; } } if (isreported == false) /// not reported yet? { /// Not reported: GUIImage(Controls[i]).Image=Material'GeoGameplayTextures.MapIcons.MapX'; Controls[i].bVisible=true; TempWidth=(Img_failurelevelmap.WinWidth) / 2; TempHeight=(Img_failurelevelmap.WinHeight) / 2; for ( j = 0; j < 4; j++) { coords[j].x = ((((T.MyFailure.BoundingBoxCache[j].x - MapCenterX) / MapWidth) * TempWidth)) ; coords[j].y = ((((T.MyFailure.BoundingBoxCache[j].y - MapCenterY) / MapHeight) * TempHeight)) ; } Controls[i].WinLeft= 0.5 + (0.25 - ((coords[0].x + coords[2].x) / 2) - (Controls[i].WinWidth / 2)); Controls[i].WinTop= 0.25 - ((coords[0].y + coords[2].y) / 2) - (Controls[i].WinHeight); ArrayPositions[i].Location=T.Location; ArrayPositions[i].Rotation=T.Rotation; ArrayPositions[i].failuretile=T; /// is none when there is no tile. ArrayPositions[i].bUnreported = true; ArrayPositions[i].bCalledAC=A.bActionCenterCalled; i++; } } } } function string ModifyRightTopImage(LeveeTile T) { local string s; /// Determine string name: switch (T.Mechanism) { case FM_Piping: s = "Piping"; totalframes = 3; break; case FM_Macro: s = "Macro"; totalframes = 3; break; case FM_Micro: case FM_MicroTutorial: s = "Micro"; totalframes = 3; break; case FM_ErosionInner: s = "ErosionInner"; totalframes = 2; break; case FM_ErosionInnerMicro: s = "ErosionInnerOver3"; totalframes = 2; break; case FM_ErosionOuterFloatingWaste: s = "Dirt"; totalframes = 1; break; case FM_ErosionOuterRipRap: s = "ErosionOuter"; totalframes = 2; break; default: s = "unknownsignal"; totalframes = 1; break; }; curframe = 0; mechname = s; SetTimer(5, true); Timer(); return s; } function Timer() { Log("curframe: " @ curframe @ " / " @ totalframes); curframe++; if (curframe > totalframes+1) { curframe = 1; } if (curframe <= totalframes) { Img_failureingame.Image = Material(DynamicLoadObject("FailureImagesT.Signals." $ mechname $ "Phase" $ curframe, class'Material')); } else { /// Drawn version: Img_failureingame.Image = Img_failuredrawing.Image; } } function ShowFailure(LeveeTile t, RedMarker placedMarker) { local bool bCalledAC; local RedMarker A; /// Found control. //t = ActiveLeveeTiles[index]; InitFailureData(); FillFailureData(); if (t != None) { /// We did find a tile. /// Update texts: //Log("Found marker with tile:" @ t); //Log ("Did call?: " @ ArrayPositions[i].bCalledAC); //Log ("Did observe?: " @ ArrayPositions[i].bCalledAC); bCalledAC = false; ForEach GeoPC.DynamicActors( class 'RedMarker', A, 'RedMarker') { if (t == A.LTile) { bCalledAC = A.bActionCenterCalled; } } updatetextbox(t, bCalledAC, true); ModifyRightTopImage(t); UpdateFailureDrawing(t.Mechanism); } else { if (placedMarker != None) { Img_failuredrawing.Image = Material(DynamicLoadObject("FailureImagesT.Signals.unknownsignal", class'Material')); curframe = 0; totalframes = 0; /// Report about the redmarker instead: updatetextbox(None, placedMarker.bActionCenterCalled, placedMarker.bReported); } } } function bool MoveOnClick(GUIComponent Sender) { local int i; local LeveeTile t; return false; /// jln - 27-03-2009 Find control for(i=MIN_MARKERS_POS; i< MAX_MARKERS_POS + 1; i++) { if(Sender==Controls[i]) { /// Found control. t = ArrayPositions[i].failuretile; InitFailureData(); FillFailureData(); if (t != None) { /// We did find a tile. /// Update texts: Log("Found marker with tile:" @ t); Log ("Did call?: " @ ArrayPositions[i].bCalledAC); Log ("Did observe?: " @ ArrayPositions[i].bCalledAC); updatetextbox(t, ArrayPositions[i].bCalledAC, true); ModifyRightTopImage(t); UpdateFailureDrawing(t.Mechanism); } else { /// jln - 30-03-2009 The marker was placed on a location without a failure: Log("Found marker without tile:"); updatetextbox(t, ArrayPositions[i].bCalledAC, false); } } } return true; } /// jln - 08-08-2008 Internationalize an item (IL8N); function string IL8N(string item) { local string Language; Language="Language_NL"; if(GeoPC.Dutch) { Language="Language_NL"; } else { Language="Language_EN"; } return Localize("Feedback", item , Language); } function updatetextbox(LeveeTile t, bool calledac, bool reported) { local string str; str = "Item: " @ SelectedFailure+1 @ "/" @ (FailureCount()); /// if (t == none) { /// jln - 30-03-2009 Without leveetile. /// player did not call for this: if (calledac == false) { /// did not call str = str $ "||" $ IL8N("non_existing_failure_unreported"); } else { /// player did call str = str $ "||" $ IL8N("non_existing_failure_reported"); } txtFeedback.setContent(str); return; } if (calledac == true) { str = str $ "||" $ IL8N("observed_failure") $ getseriousness(T) @ IL8N("observed_failure_end") $ "||"; } else { /// Player did not report this one: str = str $ "||" $ IL8N("unobserved") $ "||"; } str = str $ IL8N(t.GetFeedBackName(calledac)); if (t != None && calledac == true) { str = str $ "||" $ IL8N("handled_situation") $ "||"; str = str $ getscoreitems(t); } txtFeedback.setContent(str); } function string getseriousness(Leveetile T) { if ( T.bReportable == true && T.bRelevant == true && T.bCritical == true) { return IL8N("state_veryserious"); } if (T.bRelevant == true && T.bReportable == true && T.bCritical == false) { return IL8N("state_serious"); } if (T.bRelevant == false && T.bReportable == true && T.bCritical == false) { return IL8N("state_notserious"); } return IL8N("state_notserious"); } function string getscoreitems(LeveeTile LFailure) { local RedMarker rm; // local int LSignalIndex, MaxSignals; // local Signal LSignal; local int i; local string str; /// Update score: /// Which marker is attached to this failure? Log(LFailure @ " attached marker " @ LFailure.CurrentRedMarker); rm = LFailure.CurrentRedMarker; if (rm != None) { CalculateScore(LFailure); /// If ScorePercentage >= 90 %, accept as perfect? Log("Score percentage: " @ ScorePercentage); if (ScorePercentage >= 70) { /// Serious or not serious? if (LFailure.bCritical == true) { /// very serious: str = str $ IL8N("result_perfect_veryserious") $ "||"; } else { /// less serious, different text: str = str $ IL8N("result_perfect_notveryserious") $ "||"; } } else { /// Inform player that score was not perfect: str = str $ IL8N("result_need_correction") $ "||"; } for (i = 0; i < SCORE_INDEX_COUNT; i++) { Log("Scores: " @ ScoreArray[i].CorrectCount @ " / " @ ScoreArray[i].MAxCount ); } /* const SCORE_INDEX_FAILURES = 0; const SCORE_INDEX_LOCATIONS = 1; const SCORE_INDEX_SIGNALS = 2; const SCORE_INDEX_REPORTS = 3; const SCORE_INDEX_ASSESSMENTS = 4; //ernstig enzo \ const SCORE_INDEX_DIAGNOSES = 5; const SCORE_INDEX_MEASURES = 6; */ // if (ScoreArray[1]..Score Log("Location score: " @ Scorearray[SCORE_INDEX_LOCATIONS].CorrectCount @ " / " @ Scorearray[SCORE_INDEX_LOCATIONS].MaxCount); /// Location text if (Scorearray[SCORE_INDEX_LOCATIONS].CorrectCount < Scorearray[SCORE_INDEX_LOCATIONS].MaxCount) { str = str $ IL8N("response_wrong_location") $ "||"; } if (Scorearray[SCORE_INDEX_SIGNALS].CorrectCount < Scorearray[SCORE_INDEX_SIGNALS].MaxCount) { str = str $ IL8N("response_wrong_signals") $ "||"; } if (Scorearray[SCORE_INDEX_REPORTS].CorrectCount < Scorearray[SCORE_INDEX_REPORTS].MaxCount) { str = str $ IL8N("response_wrong_rapports") $ "||"; } if (GeoPC.IsAllowedMakeDiagnoses) { if (Scorearray[SCORE_INDEX_DIAGNOSES].CorrectCount < Scorearray[SCORE_INDEX_DIAGNOSES].MaxCount) { str = str $ IL8N("response_wrong_diagnosis") $ "||"; } } if (Scorearray[SCORE_INDEX_ASSESSMENTS].UserCount < Scorearray[SCORE_INDEX_ASSESSMENTS].MaxCount) { str = str $ IL8N("response_wrong_observed") $ "||"; } if (GeoPC.IsAllowedTakeMeasures) { if (Scorearray[SCORE_INDEX_MEASURES].CorrectCount < Scorearray[SCORE_INDEX_MEASURES].MaxCount) { str = str $ IL8N("response_wrong_measure") $ "||"; } } Log("Signal score: " @ Scorearray[SCORE_INDEX_SIGNALS].CorrectCount @ " / " @ Scorearray[SCORE_INDEX_SIGNALS].MaxCount); Log("Report score: " @ Scorearray[SCORE_INDEX_REPORTS].CorrectCount @ " / " @ Scorearray[SCORE_INDEX_REPORTS].MaxCount); Log("Diagnose score: " @ Scorearray[SCORE_INDEX_DIAGNOSES].CorrectCount @ " / " @ Scorearray[SCORE_INDEX_DIAGNOSES].MaxCount); Log("Assesment score: " @ Scorearray[SCORE_INDEX_ASSESSMENTS].Usercount @ "/" @ Scorearray[SCORE_INDEX_ASSESSMENTS].CorrectCount @ " / " @ Scorearray[SCORE_INDEX_ASSESSMENTS].MaxCount); // Log("niet in de gaten gehouden? score: "); // Log("niet in de gaten gehouden? score: "); Log("Measure score: " @ Scorearray[SCORE_INDEX_MEASURES].CorrectCount @ " / " @ Scorearray[SCORE_INDEX_MEASURES].MaxCount); } return str; } function InitFlagsForCalculation(LeveeTile LFailure) { // local Failure LFailure; //local LeveeTile LFailure; local RedMarker LRedMarker; local int LSignalIndex; local int LReportIndex; //log("InitFlagsForCalculation() GeoPlayerController.InitFlagsForCalculation()"); // ForEach AllActors( class 'Leveetile', LFailure) // { //log("initflagsforcalc1" @ LFailure.NL_FailureName); LFailure.bDetected = False; for (LSignalIndex = 0; LSignalIndex < LFailure.Signals.Length; LSignalIndex++) { //log("initflagsforcalc2"); LFailure.Signals[LSignalIndex].bSignalUsedInScoreCalculations = False; for (LReportIndex = 0; LReportIndex < LFailure.Signals[LSignalIndex].SignalReports.Length; LReportIndex++) { LFailure.Signals[LSignalIndex].SignalReports[LReportIndex].bSignalReportUsedInScoreCalculations = False; //log("Set all failure signals tot not used in score calculations" @ LFailure.NL_FailureName); } //log("initflagsforcalc3"); if(LFailure.bCritical) { // don't set the used in Score calculations to true... }else if(LFailure.bRelevant){ // the first can be Relevant if(LFailure.Signals[LSignalIndex].FirstState == STA_Critical) { //this signal can't be seen by a player cause the failure will not reach that state. (So don't account for it in the scoring) LFailure.Signals[LSignalIndex].bSignalUsedInScoreCalculations = true; for (LReportIndex = 0; LReportIndex < LFailure.Signals[LSignalIndex].SignalReports.Length; LReportIndex++) { LFailure.Signals[LSignalIndex].SignalReports[LReportIndex].bSignalReportUsedInScoreCalculations = true; } }else { // the signal can be seen by the player. for (LReportIndex = 0; LReportIndex < LFailure.Signals[LSignalIndex].SignalReports.Length; LReportIndex++) { if(LFailure.Signals[LSignalIndex].SignalReports[LReportIndex].GeoState == STA_Critical) { // this signalreport can not be seen by the player... LFailure.Signals[LSignalIndex].SignalReports[LReportIndex].bSignalReportUsedInScoreCalculations = true; } } } }else if(LFailure.bReportable){ //log("initflagsforcalc4"); if(LFailure.Signals[LSignalIndex].FirstState != STA_Reportable) { //log("initflagsforcalc5" @LFailure.Signals[LSignalIndex].NL_DamageName ); //this signal can't be seen by a player cause the failure will not reach that state. (So don't account for it in the scoring) LFailure.Signals[LSignalIndex].bSignalUsedInScoreCalculations = true; for (LReportIndex = 0; LReportIndex < LFailure.Signals[LSignalIndex].SignalReports.Length; LReportIndex++) { LFailure.Signals[LSignalIndex].SignalReports[LReportIndex].bSignalReportUsedInScoreCalculations = true; } }else { //this signal can be seen by the player. //log("initflagsforcalc6"@LFailure.Signals[LSignalIndex].NL_DamageName); for (LReportIndex = 0; LReportIndex < LFailure.Signals[LSignalIndex].SignalReports.Length; LReportIndex++) { if(LFailure.Signals[LSignalIndex].SignalReports[LReportIndex].GeoState != STA_Reportable) { // these failures can not be seeen by the player LFailure.Signals[LSignalIndex].SignalReports[LReportIndex].bSignalReportUsedInScoreCalculations = true; } } } } } //} ForEach GeoPC.AllActors( class 'RedMarker', LRedMarker) { for (LSignalIndex = 0; LSignalIndex < LRedMarker.Signals.Length; LSignalIndex++) { LRedMarker.Signals[LSignalIndex].bSignalUsedInScoreCalculations = False; for (LReportIndex = 0; LReportIndex < LRedMarker.Signals[LSignalIndex].SignalReports.Length; LReportIndex++) { LRedMarker.Signals[LSignalIndex].SignalReports[LReportIndex].bSignalReportUsedInScoreCalculations = False; } } } } //============================================================================= // Date Id Modification // 2006-08-15 The Created // 2006-08-23 Gui Changed GeoLD Spawn to new object // 2006-08-31 The Finished new scoring system //============================================================================= function InitFailureData() { local int LFailureIndex; local int LFailureCount; GeoLD = new class'GeoLevelDetails'; //log("GeoPlayerController.InitFailureData() ArrayCriticalActiveFailureNames.Length = "$GeoLD.ArrayCriticalActiveFailureNames.Length); //log("GeoPlayerController.InitFailureData() ArrayRelevantActiveFailureNames.Length = "$GeoLD.ArrayRelevantActiveFailureNames.Length); //log("GeoPlayerController.InitFailureData() ArrayReportableActiveFailureNames.Length = "$GeoLD.ArrayReportableActiveFailureNames.Length); // Set options for player GeoPC.IsAllowedTakeMeasures = GeoLD.TakeMeasures; GeoPC.IsAllowedMakeDiagnoses = GeoLD.MakeDiagnoses; //IsBreachPossible = False; // Set states of failures LFailureCount = 0; for (LFailureIndex = 0; LFailureIndex < GeoLD.ArrayCriticalActiveFailureNames.Length; LFailureIndex++) { if (GeoLD.ArrayCriticalActiveFailureNames[LFailureIndex].FailureName != 'NONE') { LFailureCount++; //log("breach is possible because GeoLD.ArrayCriticalActiveFailureNames[LFailureIndex] != 'NONE'"); FailureArray.Length = LFailureCount; FailureArray[LFailureCount - 1].FailureName = GeoLD.ArrayCriticalActiveFailureNames[LFailureIndex].FailureName; FailureArray[LFailureCount - 1].FailureState = STA_Critical; //IsBreachPossible = True; } } for (LFailureIndex = 0; LFailureIndex < GeoLD.ArrayRelevantActiveFailureNames.Length; LFailureIndex++) { if (GeoLD.ArrayRelevantActiveFailureNames[LFailureIndex].FailureName != 'NONE') { LFailureCount++; FailureArray.Length = LFailureCount; FailureArray[LFailureCount - 1].FailureName = GeoLD.ArrayRelevantActiveFailureNames[LFailureIndex].FailureName; FailureArray[LFailureCount - 1].FailureState = STA_Relevant; } } for (LFailureIndex = 0; LFailureIndex < GeoLD.ArrayReportableActiveFailureNames.Length; LFailureIndex++) { if (GeoLD.ArrayReportableActiveFailureNames[LFailureIndex].FailureName != 'NONE') { LFailureCount++; FailureArray.Length = LFailureCount; FailureArray[LFailureCount - 1].FailureName = GeoLD.ArrayReportableActiveFailureNames[LFailureIndex].FailureName; FailureArray[LFailureCount - 1].FailureState = STA_Reportable; } } //log("GeoPlayerController.InitFailureData() LFailureCount = "$LFailureCount); } //============================================================================= // Date Id Modification // 2006-08-15 The Created // 2006-08-31 The Finished new scoring system // 2007-09-28 Jln Modified to use LeveeTiles instead. //============================================================================= function FillFailureData() { local LeveeTile LFailure; local int LFailureIndex; //log("FillFailureData()"); ForEach GeoPC.AllActors( class 'LeveeTile', LFailure) { if (LFailure.bActive) { LFailureIndex = IndexOfFailure(LFailure.name); //log("FillFailureData() LFailureIndex ("$LFailureIndex$") = "$LFailure.name @", failureState = "$LFailure.CurrentState); if (LFailureIndex >=0 ) { FailureArray[LFailureIndex].NL_MechanismName = LFailure.NL_FailureName; FailureArray[LFailureIndex].EN_MechanismName = LFailure.EN_FailureName; FailureArray[LFailureIndex].MapLocationSign = LFailure.MapLocationSign; FailureArray[LFailureIndex].CurrentState = LFailure.CurrentState; } } } } function CalculateScore(LeveeTile LFailure) { //local LeveeTile LFailure; local RedMarker LRedMarker; local RedMarker LActualRedMarker; local int LMeasureIndex; local int LSignalIndex; local int LReportIndex; local int LRedMarkerSignalIndex; local int LRedMarkerReportIndex; local int LFailureIndex; local bool LCorrectMeasure; local SignalReport LReport; local Signal LSignal; local int LScoreIndex; local int LReportScoreCount; local int LReportScorePossibleCount; local bool AssessmentAlreadyReportable, AssessmentAlreadyRelevent, AssessmentAlreadyCritical; //Whether the player has already score points for a certain failure state. For each failure these booleans are set to false. And they are also used to set the max score per failure. local LocationNameSign TempSign; local int ScorePossible, ScorePlayer; ScorePossible = 0; ScorePlayer = 0; InitFlagsForCalculation(LFailure); // Init score info array ScoreArray.Length = SCORE_INDEX_COUNT; for (LScoreIndex = 0; LScoreIndex < SCORE_INDEX_COUNT; LScoreIndex++) { ScoreArray[LScoreIndex].UserCount = 0; ScoreArray[LScoreIndex].CorrectCount = 0; ScoreArray[LScoreIndex].MaxCount = 0; ScoreArray[LScoreIndex].SingleScore = 1; ScoreArray[LScoreIndex].Score = 0; ScoreArray[LScoreIndex].MaxScore = 0; } ScoreArray[SCORE_INDEX_FAILURES].SingleScore = POINTS_FAILURES; ScoreArray[SCORE_INDEX_LOCATIONS].SingleScore = POINTS_LOCATIONS; ScoreArray[SCORE_INDEX_SIGNALS].SingleScore = POINTS_SIGNALS; ScoreArray[SCORE_INDEX_REPORTS].SingleScore = POINTS_REPORTS; ScoreArray[SCORE_INDEX_ASSESSMENTS].SingleScore = POINTS_ASSESSMENTS; ScoreArray[SCORE_INDEX_DIAGNOSES].SingleScore = POINTS_DIAGNOSES; ScoreArray[SCORE_INDEX_MEASURES].SingleScore = POINTS_MEASURES; // Determine user actions //ForEach GeoPC.DynamicActors( class 'RedMarker', LRedMarker) LRedMarker = LFailure.CurrentRedMarker; Log("Current red marker: " @ LRedMarker); if (LRedMArker != None) { ScoreArray[SCORE_INDEX_FAILURES].UserCount++; if (LRedMarker.GlobalLocation.LocationSign != None) { ScoreArray[SCORE_INDEX_LOCATIONS].UserCount++; } ScoreArray[SCORE_INDEX_SIGNALS].UserCount = ScoreArray[SCORE_INDEX_SIGNALS].UserCount + LRedMarker.Signals.Length; for (LRedMarkerSignalIndex = 0; LRedMarkerSignalIndex < LRedMarker.Signals.Length; LRedMarkerSignalIndex++) { ScoreArray[SCORE_INDEX_REPORTS].UserCount = ScoreArray[SCORE_INDEX_REPORTS].UserCount + LRedMarker.Signals[LRedMarkerSignalIndex].SignalReports.Length; } //Log("LRedMarker: " @ LRedMarker.ConvState.Length); //Log("User count:" @ ScoreArray[SCORE_INDEX_ASSESSMENTS].UserCount @ " - " @ LRedMarker.ConvState[LRedMarker.ConvState.Length-1].AmountOfAssessments); if(LRedMarker.ConvState.Length != 0) { //Log("ConvState != 0"); ScoreArray[SCORE_INDEX_ASSESSMENTS].UserCount += LRedMarker.ConvState[LRedMarker.ConvState.Length-1].AmountOfAssessments; } if (GeoPC.IsAllowedMakeDiagnoses) { if (LRedMarker.Mechanism != FM_NONE) { ScoreArray[SCORE_INDEX_DIAGNOSES].UserCount++; } } if (GeoPC.IsAllowedTakeMeasures) { if (LRedMarker.MeasureTaken != None) { ScoreArray[SCORE_INDEX_MEASURES].UserCount++; } } } //IsBreachOccurred = False; //ForEach AllActors( class 'LeveeTile', LFailure) //{ if (LFailure.bActive) { //log("***----***----***--- "$ LFailure.NL_FailureName $ " Current state "$LFailure.CurrentState @"bCritical"@LFailure.bCritical); // Init failure scores LFailureIndex = IndexOfFailure(LFailure.name); Log("Index: " @ LFailureIndex); FailureArray[LFailureIndex].ScoreLocation = 0; FailureArray[LFailureIndex].ScoreLocationMax = 0; FailureArray[LFailureIndex].ScoreReport = 0; FailureArray[LFailureIndex].ScoreReportMax = 0; FailureArray[LFailureIndex].ScoreAssessment = 0; FailureArray[LFailureIndex].ScoreAssessmentMax = 0; FailureArray[LFailureIndex].ScoreDiagnosis = 0; FailureArray[LFailureIndex].ScoreDiagnosisMax = 0; FailureArray[LFailureIndex].ScoreMeasure = 0; FailureArray[LFailureIndex].ScoreMeasureMax = 0; FailureArray[LFailureIndex].ScoreTotal = 0; FailureArray[LFailureIndex].ScoreTotalMax = 0; // Evaluate if a redmarker is placed correctly for this failure and select it ScoreArray[SCORE_INDEX_FAILURES].MaxCount++; FailureArray[LFailureIndex].ScoreLocationMax++; ScorePossible++; LActualRedMarker = None; ForEach GeoPC.DynamicActors( class 'RedMarker', LRedMarker) { //Log("Loop RedMarker"); if (!LFailure.bDetected) { //Log("Loop RedMarker detected"); if (LFailure.Encompasses(LRedMarker)) { //Log("CalculateScore() Correct marker position"); ScorePlayer++; ScoreArray[SCORE_INDEX_FAILURES].CorrectCount++; FailureArray[LFailureIndex].ScoreLocation++; LFailure.bDetected = True; LActualRedMarker = LRedMarker; } else { //Log("Loop RedMarker not encompassed"); } } } // Evaluate if correct map location is selected FailureArray[LFailureIndex].ScoreLocationMax++; ScoreArray[SCORE_INDEX_LOCATIONS].MaxCount++; ScorePossible++; if (LActualRedMarker != none) { // Log("CalculateScore() TopDistance = "$LActualRedMarker.GlobalLocation.TopDistance); //Log("CalculateScore() LeftDistance = "$LActualRedMarker.GlobalLocation.LeftDistance); if (LActualRedMarker.GlobalLocation.LocationSign != None) { /// Find the locationamesign of this marker, by distance. TempSign = CheckMarkerLocationSign(LActualRedMarker); //Log("CalculateScore() Location: Marker = "$LActualRedMarker.GlobalLocation.LocationSign$"; Failure = "$LFailure.MapLocationSign @ "; New Method = " @ TempSign); if (LActualRedMarker.GlobalLocation.LocationSign == TempSign) { //Log("CalculateScore() Correct map location"); ScorePlayer++; ScoreArray[SCORE_INDEX_LOCATIONS].CorrectCount++; FailureArray[LFailureIndex].ScoreLocation++; } } } // Evaluate how many points can be scored for the signals, // taken into account the FirstState of the signals for (LSignalIndex = 0; LSignalIndex < LFailure.Signals.Length; LSignalIndex++) { LSignal = LFailure.Signals[LSignalIndex]; switch (FailureArray[LFailureIndex].FailureState) { case STA_Reportable: if (LSignal.FirstState == STA_Reportable) { FailureArray[LFailureIndex].ScoreReportMax++; ScoreArray[SCORE_INDEX_SIGNALS].MaxCount++; ScorePossible++; } break; case STA_Relevant: if ((LSignal.FirstState == STA_Reportable) || (LSignal.FirstState == STA_Relevant)) { FailureArray[LFailureIndex].ScoreReportMax++; ScoreArray[SCORE_INDEX_SIGNALS].MaxCount++; ScorePossible++; } break; case STA_Critical: if ((LSignal.FirstState == STA_Reportable) || (LSignal.FirstState == STA_Relevant) || (LSignal.FirstState == STA_Critical)) { FailureArray[LFailureIndex].ScoreReportMax++; ScoreArray[SCORE_INDEX_SIGNALS].MaxCount++; ScorePossible++; } break; case STA_NONE: break; } } AssessmentAlreadyReportable = false; AssessmentAlreadyRelevent = false; AssessmentAlreadyCritical = false; // Evaluate how many points can be scored for the reports, // taken into account the GeoStates of the reports //Log("Failure: " @ LFailure); //Log("Number of Signals: " @ LFailure.Signals.Length); //Log("Reports: " @ LFailure.Signals[0].SignalReports.Length); for (LSignalIndex = 0; LSignalIndex < LFailure.Signals.Length; LSignalIndex++) { //Log("Number of Reports: " @ LFailure.Signals[LSignalIndex].SignalReports.Length); for (LReportIndex = 0; LReportIndex < LFailure.Signals[LSignalIndex].SignalReports.Length; LReportIndex++) { LReport = LFailure.Signals[LSignalIndex].SignalReports[LReportIndex]; //Log("Report: " @ LReport); switch (FailureArray[LFailureIndex].FailureState) { case STA_Reportable: if (LReport.GeoState == STA_Reportable) { FailureArray[LFailureIndex].ScoreReportMax++; ScoreArray[SCORE_INDEX_REPORTS].MaxCount++; ScorePossible++; } break; case STA_Relevant: if ((LReport.GeoState == STA_Reportable) || (LReport.GeoState == STA_Relevant)) { FailureArray[LFailureIndex].ScoreReportMax++; ScoreArray[SCORE_INDEX_REPORTS].MaxCount++; ScorePossible++; } break; case STA_Critical: if ((LReport.GeoState == STA_Reportable) || (LReport.GeoState == STA_Relevant) || (LReport.GeoState == STA_Critical)) { FailureArray[LFailureIndex].ScoreReportMax++; ScoreArray[SCORE_INDEX_REPORTS].MaxCount++; ScorePossible++; } break; case STA_NONE: break; } switch (LReport.GeoState) { case STA_Reportable: if(!AssessmentAlreadyReportable && LFailure.bReportable) { ScoreArray[SCORE_INDEX_ASSESSMENTS].MaxCount++; ScorePossible++; AssessmentAlreadyReportable = true; } break; case STA_Relevant: if(!AssessmentAlreadyRelevent && LFailure.bRelevant) { ScoreArray[SCORE_INDEX_ASSESSMENTS].MaxCount++; ScorePossible++; AssessmentAlreadyRelevent = true; } break; case STA_Critical: if(!AssessmentAlreadyCritical && LFailure.bCritical) { ScoreArray[SCORE_INDEX_ASSESSMENTS].MaxCount++; ScorePossible++; AssessmentAlreadyCritical = true; } break; case STA_NONE: break; } } } AssessmentAlreadyReportable = false; AssessmentAlreadyRelevent = false; AssessmentAlreadyCritical = false; // Evaluate if correct signals and reports are reported if (LActualRedMarker != none) { for (LSignalIndex = 0; LSignalIndex < LFailure.Signals.Length; LSignalIndex++) { // Check if any signal in redmarker signals equals signals in failure for (LRedMarkerSignalIndex = 0; LRedMarkerSignalIndex < LActualRedMarker.Signals.Length; LRedMarkerSignalIndex++) { if (LActualRedMarker.Signals[LRedMarkerSignalIndex].bApproved) { if (LActualRedMarker.Signals[LRedMarkerSignalIndex].SignalType == LFailure.Signals[LSignalIndex].SignalType) { if (!LFailure.Signals[LSignalIndex].bSignalUsedInScoreCalculations) { //log("Score past failure signals not used"); if(!LActualRedMarker.Signals[LRedMarkerSignalIndex].bSignalUsedInScoreCalculations) { //Log("CalculateScore() Correct signal"); FailureArray[LFailureIndex].ScoreReport++; ScoreArray[SCORE_INDEX_SIGNALS].CorrectCount++; ScorePlayer++; LFailure.Signals[LSignalIndex].bSignalUsedInScoreCalculations = True; LActualRedMarker.Signals[LRedMarkerSignalIndex].bSignalUsedInScoreCalculations = True; } } // Evaluate if correct reports are made for current signal (observation report) for (LReportIndex = 0; LReportIndex < LFailure.Signals[LSignalIndex].SignalReports.Length; LReportIndex++) { for (LRedMarkerReportIndex = 0; LRedMarkerReportIndex < LActualRedMarker.Signals[LRedMarkerSignalIndex].SignalReports.Length; LRedMarkerReportIndex++) { //Log("CalculateScore() Redmarker report state = "$LActualRedMarker.Signals[LRedMarkerSignalIndex].SignalReports[LRedMarkerReportIndex].GeoState); //Log("CalculateScore() Failure report state = "$LFailure.Signals[LSignalIndex].SignalReports[LReportIndex].GeoState); if (LActualRedMarker.Signals[LRedMarkerSignalIndex].IsSignalEqual(LRedMarkerReportIndex,LFailure.Signals[LSignalIndex],LReportIndex, CReportScoreFractionThreshold, LReportScoreCount, LReportScorePossibleCount)) { //log("Score past signal reports same"@!LFailure.Signals[LSignalIndex].SignalReports[LReportIndex].bSignalReportUsedInScoreCalculations@!LActualRedMarker.Signals[LRedMarkerSignalIndex].SignalReports[LRedMarkerReportIndex].bSignalReportUsedInScoreCalculations); if (!LFailure.Signals[LSignalIndex].SignalReports[LReportIndex].bSignalReportUsedInScoreCalculations && !LActualRedMarker.Signals[LRedMarkerSignalIndex].SignalReports[LRedMarkerReportIndex].bSignalReportUsedInScoreCalculations) { //Log("CalculateScore() Correct report"); FailureArray[LFailureIndex].ScoreReport++; ScoreArray[SCORE_INDEX_REPORTS].CorrectCount++; ScorePlayer++; LFailure.Signals[LSignalIndex].SignalReports[LReportIndex].bSignalReportUsedInScoreCalculations = True; LActualRedMarker.Signals[LRedMarkerSignalIndex].SignalReports[LRedMarkerReportIndex].bSignalReportUsedInScoreCalculations = True; } } //Log("CalculateScore() LActualRedMarker Assessment = "$LActualRedMarker.Signals[LRedMarkerSignalIndex].SignalReports[LRedMarkerReportIndex].Assessment); //Log("CalculateScore() LActualRedMarker GeoState = "$LActualRedMarker.Signals[LRedMarkerSignalIndex].SignalReports[LRedMarkerReportIndex].GeoState); } } } } } } // check whether there was a signalreport in the red marker with the right assessment at the right time. But with a maximum score of 1 per fase per failure for (LRedMarkerSignalIndex = 0; LRedMarkerSignalIndex < LActualRedMarker.Signals.Length; LRedMarkerSignalIndex++) { for (LRedMarkerReportIndex = 0; LRedMarkerReportIndex < LActualRedMarker.Signals[LRedMarkerSignalIndex].SignalReports.Length; LRedMarkerReportIndex++) { if(LActualRedMarker.Signals[LRedMarkerSignalIndex].SignalReports[LRedMarkerReportIndex].Assessment == LActualRedMarker.Signals[LRedMarkerSignalIndex].SignalReports[LRedMarkerReportIndex].GeoState) { if(LActualRedMarker.Signals[LRedMarkerSignalIndex].SignalReports[LRedMarkerReportIndex].Assessment == STA_Reportable && LFailure.bReportable) { if(!AssessmentAlreadyReportable) { FailureArray[LFailureIndex].ScoreReport++; ScoreArray[SCORE_INDEX_ASSESSMENTS].CorrectCount++; ScorePlayer++; AssessmentAlreadyReportable = true; } }else if(LActualRedMarker.Signals[LRedMarkerSignalIndex].SignalReports[LRedMarkerReportIndex].Assessment == STA_Relevant && LFailure.bRelevant) { if(!AssessmentAlreadyRelevent) { FailureArray[LFailureIndex].ScoreReport++; ScoreArray[SCORE_INDEX_ASSESSMENTS].CorrectCount++; ScorePlayer++; AssessmentAlreadyRelevent = true; }else if(LActualRedMarker.Signals[LRedMarkerSignalIndex].SignalReports[LRedMarkerReportIndex].Assessment == STA_Critical && LFailure.bCritical) { if(!AssessmentAlreadyCritical) { FailureArray[LFailureIndex].ScoreReport++; ScoreArray[SCORE_INDEX_ASSESSMENTS].CorrectCount++; ScorePlayer++; AssessmentAlreadyCritical = true; } } } } } } // Evaluate if correct failure mechanism selected (diagnosis report) Log("Allowed to make diagnoses " @ GeoPC.IsAllowedMakeDiagnoses); Log(GeoPC); if (GeoPC.IsAllowedMakeDiagnoses) { FailureArray[LFailureIndex].ScoreDiagnosisMax++; ScoreArray[SCORE_INDEX_DIAGNOSES].MaxCount++; ScorePossible++; Log("Allowed to make diagnoses"); if (LActualRedMarker != none) { //Log("CalculateScore() Failure = "$LFailure.Name); if (LActualRedMarker.Mechanism == LFailure.Mechanism) { //Log("CalculateScore() Correct failure mechanism"); ScoreArray[SCORE_INDEX_DIAGNOSES].CorrectCount++; ScorePlayer++; FailureArray[LFailureIndex].ScoreDiagnosis++; } } } // Evaluate if correct measure is taken Log("Allowed to take measures " @ GeoPC.IsAllowedTakeMeasures); if (GeoPC.IsAllowedTakeMeasures && LFailure.bCritical) { Log("Allowed to take measures"); FailureArray[LFailureIndex].ScoreMeasureMax++; ScoreArray[SCORE_INDEX_MEASURES].MaxCount++; ScorePossible++; if (LActualRedMarker != none) { //Log("CalculateScore() Measurecount = "$LFailure.Measures.Length); LCorrectMeasure = false; if (LActualRedMarker.MeasureTaken != None) { for (LMeasureIndex = 0; LMeasureIndex < LFailure.Measures.Length; LMeasureIndex++) { if (LActualRedMarker.MeasureTaken.MeasureType == LFailure.Measures[LMeasureIndex].MeasureType) { LCorrectMeasure = True; } } } Log(LActualRedMarker.MeasureTaken.MeasureType @ " - Correct measure: " @ LCorrectMeasure); if (LCorrectMeasure) { //Log("CalculateScore() Correct measure"); FailureArray[LFailureIndex].ScoreMeasure++; ScorePlayer++; ScoreArray[SCORE_INDEX_MEASURES].CorrectCount++; } } } // Evaluate if breach (if if (FailureArray[LFailureIndex].CurrentState == STA_Failed) { //log("This failure is in state failed "@String(FailureArray[LFailureIndex].FailureName)); GeoPC.IsBreachOccurred = True; } //} } // Determine points per item for (LScoreIndex = 0; LScoreIndex < SCORE_INDEX_COUNT; LScoreIndex++) { ScoreArray[LScoreIndex].Score = ScoreArray[LScoreIndex].CorrectCount * ScoreArray[LScoreIndex].SingleScore; ScoreArray[LScoreIndex].MaxScore = ScoreArray[LScoreIndex].MaxCount * ScoreArray[LScoreIndex].SingleScore; } // Determine total score ScorePossible = 0; ScorePlayer = 0; for (LScoreIndex = 0; LScoreIndex < SCORE_INDEX_COUNT; LScoreIndex++) { if(LScoreIndex != SCORE_INDEX_ASSESSMENTS || GeoPC.IsAllowedAssessment) { ScorePossible = ScorePossible + ScoreArray[LScoreIndex].MaxScore; ScorePlayer = ScorePlayer + ScoreArray[LScoreIndex].Score; } } ScorePercentage = 100; if (ScorePossible > 0) { ScorePercentage = 100 * ScorePlayer / ScorePossible; } /// jln - 03-10-2008 This is such an easy fix it feels like cheating... if (ScorePercentage > 100) ScorePercentage = 100; } } //***************************************************************************** // Find closest marker, and return it //***************************************************************************** function LocationNameSign CheckMarkerLocationSign(RedMarker marker) { local bool FirstSign; local actor A; local float TempDist; local float d; local vector Location; local LocationNameSign sign; TempDist = 999999999; /// CHECK THE CLOSEST LOCATION SIGN FirstSign = true; Location = marker.Location; foreach GeoPC.AllActors( class 'Actor', A, 'LocationNameSign') { d = Abs(VSize(Location - A.Location)); //Log("Redmarker Distance: " @ A @ " dist: " @ d); if((d < TempDist) || FirstSign) { TempDist = d; FirstSign = false; sign = LocationNameSign(A); } } return sign; } //============================================================================= // Date Id Modification // 2006-08-15 The Created //============================================================================= function int IndexOfFailure(name AFailureName) { local int LFailureIndex; local int LFailureFoundIndex; LFailureFoundIndex = -1; for (LFailureIndex = 0; LFailureIndex < FailureArray.Length; LFailureIndex++) { // Log("IndexOfFailure: " @ FailureArray[LFailureIndex].FailureName @ " - " @ AFailureName); if (FailureArray[LFailureIndex].FailureName == AFailureName) { LFailureFoundIndex = LFailureIndex; } } return LFailureFoundIndex; } function UpdateFailureDrawing(GeoEnums.FailingMechanisms failuretype) { switch (failuretype) { case FM_Piping: Img_failuredrawing.Image = Material(DynamicLoadObject("IngameMenuImagesT.Handbook.Sandboils", class'Material')); break; case FM_Macro: Img_failuredrawing.Image = Material(DynamicLoadObject("IngameMenuImagesT.Handbook.Macro", class'Material')); break; case FM_Micro: Img_failuredrawing.Image = Material(DynamicLoadObject("IngameMenuImagesT.Handbook.Micro", class'Material')); break; case FM_ErosionInner: Img_failuredrawing.Image = Material(DynamicLoadObject("IngameMenuImagesT.Handbook.ErosionInner", class'Material')); break; case FM_ErosionInnerMicro: Img_failuredrawing.Image = Material(DynamicLoadObject("IngameMenuImagesT.Handbook.ErosionInner", class'Material')); break; case FM_ErosionOuterFloatingWaste: case FM_ErosionOuterRipRap: Img_failuredrawing.Image = Material(DynamicLoadObject("IngameMenuImagesT.Handbook.ErosionOuter", class'Material')); break; case FM_MicroTutorial: Img_failuredrawing.Image = Material(DynamicLoadObject("IngameMenuImagesT.Handbook.Micro", class'Material')); break; } } /// Draw line on the canvas: function DrawLine(Canvas c, int x1, int y1, int x2, int y2) { local int deltax; // The difference in the x's local int deltay; // The difference in the y's local int y; // Start y off at the first pixel value local int ynum; // The starting value for the numerator local int x; local int prevx; local int prevy; local int xinc1; local int xinc2; local int yinc1; local int yinc2; local int den; local int num; local int numadd; local int numpixels; local int curpixel; curpixel = 0; deltax = abs(x2 - x1); deltay = abs(y2 - y1); y = y1; x = x1; ynum = deltax / 2; prevx = x1; prevy = y; if (x2 >= x1) // The x-values are increasing { xinc1 = 1; xinc2 = 1; } else // The x-values are decreasing { xinc1 = -1; xinc2 = -1; } if (y2 >= y1) // The y-values are increasing { yinc1 = 1; yinc2 = 1; } else // The y-values are decreasing { yinc1 = -1; yinc2 = -1; } if (deltax >= deltay) // There is at least one x-value for every y-value { xinc1 = 0; // Don't change the x when numerator >= denominator yinc2 = 0; // Don't change the y for every iteration den = deltax; num = deltax / 2; numadd = deltay; numpixels = deltax; // There are more x-values than y-values } else // There is at least one y-value for every x-value { xinc2 = 0; // Don't change the x for every iteration yinc1 = 0; // Don't change the y when numerator >= denominator den = deltay; num = deltay / 2; numadd = deltax; numpixels = deltay; // There are more y-values than x-values } for (curpixel = 0; curpixel <= numpixels; curpixel++) { c.SetPos( x, y); c.DrawLine(0, 1); //up num += numadd; // Increase the numerator by the top of the fraction prevx = x; prevy = y; if (num >= den) // Check if numerator >= denominator { num -= den; // Calculate the new numerator value x += xinc1; // Change the x as appropriate y += yinc1; // Change the y as appropriate } x += xinc2; // Change the x as appropriate y += yinc2; // Change the y as appropriate } } defaultproperties { bAllowedAsLast=true WinLeft=0; WinTop=0; WinWidth=1; winHeight=1; Background=Texture'GeoDelft.BackGround0' Begin Object Class=GUIImage Name=oImg_failurelevelmap ImageStyle=ISTY_Scaled ImageRenderStyle=MSTY_Normal ImageColor=(R=255,G=255,B=255,A=255); End Object Controls(0)=GUIImage'oImg_failurelevelmap' Begin Object Class=GUIScrollTextBox Name=otxtFeedback CharDelay=0.0021 EOLDelay=0.001 bNeverFocus=true bVisibleWhenEmpty=True bNoTeletype=true; End Object Controls(1)=GUIScrollTextBox'otxtFeedback' Begin Object Class=GUIImage Name=oImg_failureingame ImageStyle=ISTY_Scaled ImageRenderStyle=MSTY_Normal ImageColor=(R=255,G=255,B=255,A=255); End Object Controls(2)=GUIImage'oImg_failureingame' Begin Object Class=GUIImage Name=oImg_failuredrawing ImageStyle=ISTY_Scaled ImageRenderStyle=MSTY_Normal ImageColor=(R=255,G=255,B=255,A=255); End Object Controls(3)=GUIImage'oImg_failuredrawing' Begin Object class=GUIImage Name=MiniMarker WinWidth=0.014 WinHeight=0.02 ImageStyle=ISTY_Scaled Image=Material'GeoGameplayTextures.MapIcons.MiniMarker' bVisible=false OnClick=MoveOnClick RenderWeight=1; End Object Begin Object Class=GUIButton Name=NextButton Caption="Volgende" Hint="***" OnClick=PrevNextClick StyleName="SquareMenuButton" WinWidth=0.15 WinHeight=0.05 WinLeft=0.8 WinTop=0.95 bVisible=true End Object Controls(4)=GUIButton'NextButton' Begin Object Class=GUIButton Name=PrevButton Caption="Vorige" Hint="***" OnClick=PrevNextClick StyleName="SquareMenuButton" WinWidth=0.15 WinHeight=0.05 WinLeft=0.05 WinTop=0.95 bVisible=true End Object Controls(5)=GUIButton'PrevButton' but_Next=NextButton but_Prev=PrevButton IsPlayerAllowedNextLevel = false //Min percentage to pass level MinPercentageToPassLevel= 55 // <----- Percentage to set game minimum score Controls(6)=GUIImage'MiniMarker' Controls(7)=GUIImage'MiniMarker' Controls(8)=GUIImage'MiniMarker' Controls(9)=GUIImage'MiniMarker' Controls(10)=GUIImage'MiniMarker' Controls(11)=GUIImage'MiniMarker' Controls(12)=GUIImage'MiniMarker' Controls(13)=GUIImage'MiniMarker' Controls(14)=GUIImage'MiniMarker' Controls(15)=GUIImage'MiniMarker' Controls(16)=GUIImage'MiniMarker' Controls(17)=GUIImage'MiniMarker' Controls(18)=GUIImage'MiniMarker' Controls(19)=GUIImage'MiniMarker' Controls(20)=GUIImage'MiniMarker' Controls(21)=GUIImage'MiniMarker' Controls(22)=GUIImage'MiniMarker' Controls(23)=GUIImage'MiniMarker' Controls(24)=GUIImage'MiniMarker' Controls(25)=GUIImage'MiniMarker' Controls(26)=GUIImage'MiniMarker' Controls(27)=GUIImage'MiniMarker' Controls(28)=GUIImage'MiniMarker' Controls(29)=GUIImage'MiniMarker' Controls(30)=GUIImage'MiniMarker' Controls(31)=GUIImage'MiniMarker' Controls(32)=GUIImage'MiniMarker' Controls(33)=GUIImage'MiniMarker' Controls(34)=GUIImage'MiniMarker' Controls(35)=GUIImage'MiniMarker' Controls(36)=GUIImage'MiniMarker' Controls(37)=GUIImage'MiniMarker' Controls(38)=GUIImage'MiniMarker' Controls(39)=GUIImage'MiniMarker' }