From f2072135c6936c7ee4e4f34d5166748ae6612e5e Mon Sep 17 00:00:00 2001 From: szapp Date: Sun, 16 Sep 2018 15:42:18 +0200 Subject: [PATCH] Remove reticle from game saves --- .../data/Scripts/Content/GFA/_intern/const.d | 6 ++-- .../Scripts/Content/GFA/_intern/reticle.d | 30 +++++++++---------- 2 files changed, 18 insertions(+), 18 deletions(-) diff --git a/_work/data/Scripts/Content/GFA/_intern/const.d b/_work/data/Scripts/Content/GFA/_intern/const.d index 15ed0bd..cad01b4 100644 --- a/_work/data/Scripts/Content/GFA/_intern/const.d +++ b/_work/data/Scripts/Content/GFA/_intern/const.d @@ -32,10 +32,10 @@ const string GFA_VERSION = "Gothic Free Aim v1.0.1"; const int GFA_LEGO_FLAGS = LeGo_HookEngine // For initializing all hooks | LeGo_ConsoleCommands // For console commands and debugging - | LeGo_View // For drawing reticle | LeGo_Random // For scattering and other uses of random numbers | LeGo_Draw3D // For debug visualizations (may be removed) - | LeGo_FrameFunctions; // For hitmarker in config (may be removed) + | LeGo_FrameFunctions // For hitmarker in config (may be removed) + | LeGo_View; // For hitmarker in config (may be removed) var int GFA_Flags; // Flags for initialization of GFA const int GFA_RANGED = 1<<0; // Free aiming for ranged combat (bow and crossbow) @@ -69,7 +69,7 @@ var int GFA_AimRayPrevCalcTime; // Time of last trac const int GFA_RETICLE_MIN_SIZE = 32; // Smallest reticle size in pixels const int GFA_RETICLE_MAX_SIZE = 64; // Biggest reticle size in pixels -var int GFA_ReticleHndl; // Handle of the reticle +const int GFA_RETICLE_PTR = 0; // Reticle zCView var int GFA_AimVobHasFX; // For performance: check whether FX needs to be removed const string GFA_CAMERA = "CamModGFA"; // CCamSys_Def script instance diff --git a/_work/data/Scripts/Content/GFA/_intern/reticle.d b/_work/data/Scripts/Content/GFA/_intern/reticle.d index e17c702..fe5bd24 100644 --- a/_work/data/Scripts/Content/GFA/_intern/reticle.d +++ b/_work/data/Scripts/Content/GFA/_intern/reticle.d @@ -26,8 +26,8 @@ * Hide the reticle. This function is called from various functions to ensure that the reticle disappears. */ func void GFA_RemoveReticle() { - if (Hlp_IsValidHandle(GFA_ReticleHndl)) { - View_Close(GFA_ReticleHndl); + if (GFA_RETICLE_PTR) { + ViewPtr_Close(GFA_RETICLE_PTR); }; }; @@ -57,35 +57,35 @@ func void GFA_InsertReticle(var int reticlePtr) { // Get the screen to retrieve the center var zCView screen; screen = _^(MEM_Game._zCSession_viewport); - if (!Hlp_IsValidHandle(GFA_ReticleHndl)) { + if (!GFA_RETICLE_PTR) { // Create reticle if it does not exist - GFA_ReticleHndl = View_CreateCenterPxl(screen.psizex/2, screen.psizey/2, size, size); - View_SetTexture(GFA_ReticleHndl, reticle.texture); - View_SetColor(GFA_ReticleHndl, reticle.color); - View_Open(GFA_ReticleHndl); + GFA_RETICLE_PTR = ViewPtr_CreateCenterPxl(screen.psizex/2, screen.psizey/2, size, size); + ViewPtr_SetTexture(GFA_RETICLE_PTR, reticle.texture); + ViewPtr_SetColor(GFA_RETICLE_PTR, reticle.color); + ViewPtr_Open(GFA_RETICLE_PTR); } else { // If the reticle already exists adjust it to the new texture, size and color - if (!Hlp_StrCmp(View_GetTexture(GFA_ReticleHndl), reticle.texture)) { + if (!Hlp_StrCmp(ViewPtr_GetTexture(GFA_RETICLE_PTR), reticle.texture)) { // Update its texture - View_SetTexture(GFA_ReticleHndl, reticle.texture); + ViewPtr_SetTexture(GFA_RETICLE_PTR, reticle.texture); }; - if (View_GetColor(GFA_ReticleHndl) != reticle.color) { + if (ViewPtr_GetColor(GFA_RETICLE_PTR) != reticle.color) { // Update its color - View_SetColor(GFA_ReticleHndl, reticle.color); + ViewPtr_SetColor(GFA_RETICLE_PTR, reticle.color); }; - var zCView crsHr; crsHr = _^(getPtr(GFA_ReticleHndl)); + var zCView crsHr; crsHr = _^(GFA_RETICLE_PTR); if (crsHr.psizex != size) || (screen.psizex/2 != centerX) { // Update its size and re-position it to center var int centerX; centerX = screen.psizex/2; - View_ResizePxl(GFA_ReticleHndl, size, size); - View_MoveToPxl(GFA_ReticleHndl, screen.psizex/2-(size/2), screen.psizey/2-(size/2)); + ViewPtr_ResizePxl(GFA_RETICLE_PTR, size, size); + ViewPtr_MoveToPxl(GFA_RETICLE_PTR, screen.psizex/2-(size/2), screen.psizey/2-(size/2)); }; if (!crsHr.isOpen) { // Show the reticle if it is not visible - View_Open(GFA_ReticleHndl); + ViewPtr_Open(GFA_RETICLE_PTR); }; }; } else {