File: 41-crosshair.patch

package info (click to toggle)
wolf4sdl 1.7%2Bsvn262%2Bdfsg1-4
  • links: PTS, VCS
  • area: contrib
  • in suites: stretch
  • size: 4,120 kB
  • ctags: 10,066
  • sloc: cpp: 34,696; ansic: 1,257; objc: 246; makefile: 161; sh: 44
file content (69 lines) | stat: -rw-r--r-- 2,490 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
Subject: Show a crosshair when the "--crosshair" parameter is given.
Author: Fabian Greffrath <fabian+debian@greffrath.com>

--- a/wl_def.h
+++ b/wl_def.h
@@ -935,6 +935,7 @@ extern  boolean  param_goodtimes;
 extern  boolean  param_ignorenumchunks;
 extern  boolean  param_shading;
 extern  boolean  param_novert;
+extern  boolean  param_crosshair;
 
 
 void            NewGame (int difficulty,int episode);
--- a/wl_draw.cpp
+++ b/wl_draw.cpp
@@ -1060,6 +1060,17 @@ void DrawPlayerWeapon (void)
         SimpleScaleShape(viewwidth/2,SPR_DEMO,viewheight+1);
 }
 
+void DrawCrosshair (void)
+{
+    if (gamestate.victoryflag || gamestate.weapon < wp_pistol)
+        return;
+
+    const int c = (gamestate.health >= 50) ? 2 : (gamestate.health >= 25) ? 6 : 4;
+    const int h = (viewsize == 21 && ingame) ? screenHeight : screenHeight - scaleFactor * STATUSLINES;
+
+    VL_Hlin (screenWidth / 2 - scaleFactor, h / 2,               2 * scaleFactor + 1, c);
+    VL_Vlin (screenWidth / 2,               h / 2 - scaleFactor, 2 * scaleFactor + 1, c);
+}
 
 //==========================================================================
 
@@ -1604,6 +1615,8 @@ void    ThreeDRefresh (void)
 #endif
 
     DrawPlayerWeapon ();    // draw player's hands
+    if (param_crosshair)
+        DrawCrosshair ();
 
     if(Keyboard[sc_Tab] && viewsize == 21 && gamestate.weapon != -1)
         ShowActStatus();
--- a/wl_main.cpp
+++ b/wl_main.cpp
@@ -103,6 +103,7 @@ boolean param_goodtimes = false;
 boolean param_ignorenumchunks = false;
 boolean param_shading = false;
 boolean param_novert = false;
+boolean param_crosshair = false;
 
 /*
 =============================================================================
@@ -1726,6 +1727,8 @@ void CheckParameters(int argc, char *arg
 #endif
         else IFARG("--novert")
             param_novert = true;
+        else IFARG("--crosshair")
+            param_crosshair = true;
         else IFARG("--res")
         {
             if(i + 2 >= argc)
@@ -1910,6 +1913,7 @@ void CheckParameters(int argc, char *arg
             " --shading              Enables shading support\n"
 #endif
             " --novert               Suppresses vertical mouse movement\n"
+            " --crosshair            Shows a crosshair\n"
             " --res <width> <height> Sets the screen resolution\n"
             "                        (must be multiple of 320x200 or 320x240)\n"
             " --resf <w> <h>         Sets any screen resolution >= 320x200\n"