Browse Source

Consistent use of rc_get_bool.

Also removed some more unused code.
Thomas Buck 10 years ago
parent
commit
95ac4ecec2
6 changed files with 41 additions and 90 deletions
  1. 5
    1
      README.md
  2. 0
    7
      include/System.h
  3. 0
    18
      include/utils/math.h
  4. 36
    17
      src/OpenRaider.cpp
  5. 0
    8
      src/System.cpp
  6. 0
    39
      src/utils/math.cpp

+ 5
- 1
README.md View File

@@ -128,7 +128,7 @@ If you want to change this behaviour, this happens around line 1075 of `src/Open
128 128
 
129 129
 ### Console/Config Commands
130 130
 
131
-Console commands (BOOL is now '0' or '1' for less typing).
131
+Console commands (BOOL is '0', '1', "true" or "false").
132 132
 Pressing <UP> will go back to last command entered (saves typing).
133 133
 
134 134
 #### Game
@@ -183,12 +183,16 @@ Pressing <UP> will go back to last command entered (saves typing).
183 183
 
184 184
 #### Set Commands
185 185
 
186
+These commands have to be entered as `set COMMAND VALUE` or `set COMMAND=VALUE`.
187
+
186 188
 | Command        | Action                    |
187 189
 | --------------:|:------------------------- |
188 190
 | mousegrab BOOL | Set mouse grabbing on/off |
189 191
 
190 192
 #### Stat Commands
191 193
 
194
+These commands have to be entered as `stat COMMAND`.
195
+
192 196
 | Command | Action                 |
193 197
 | -------:|:---------------------- |
194 198
 | fps     | Toggle showing FPS     |

+ 0
- 7
include/System.h View File

@@ -68,13 +68,6 @@ public:
68 68
     virtual ~System();
69 69
 
70 70
     /*!
71
-     * \brief Created a directory
72
-     * \param path Directory to create
73
-     * \returns -1 on error
74
-     */
75
-    static int createDir(char *path);
76
-
77
-    /*!
78 71
      * \brief Created a new Command Mode.
79 72
      * \param command valid command mode for the resource file, eg "[Engine.OpenGL.Driver]"
80 73
      * \returns id given to mode

+ 0
- 18
include/utils/math.h View File

@@ -45,24 +45,6 @@ bool equalEpsilon(vec_t a, vec_t b);
45 45
 int helIntersectionLineAndPolygon(vec3_t intersect, vec3_t p1, vec3_t p2, vec3_t *polygon);
46 46
 
47 47
 /*!
48
- * \brief Calculate the distance from a sphere to a plane
49
- * \param center Center of sphere
50
- * \param radius Radius of sphere
51
- * \param plane Plane
52
- * \returns distance
53
- */
54
-vec_t helDistToSphereFromPlane3v(vec3_t center, vec_t radius, vec4_t plane);
55
-
56
-/*!
57
- * \brief Calculate the distance from a box to a plane
58
- * \param min Minimum Point of a bounding box
59
- * \param max Maximum Point of a bounding box
60
- * \param plane Plane
61
- * \returns distance
62
- */
63
-vec_t helDistToBboxFromPlane3v(vec3_t min, vec3_t max, vec4_t plane);
64
-
65
-/*!
66 48
  * \brief Calculate the length of a line segment / the distance between two points
67 49
  * \param a First point
68 50
  * \param b Second point

+ 36
- 17
src/OpenRaider.cpp View File

@@ -2698,6 +2698,8 @@ void OpenRaider::processRoom(int index)
2698 2698
 //! \fixme Use rc_get_bool consistently!
2699 2699
 void OpenRaider::consoleCommand(char *cmd)
2700 2700
 {
2701
+    bool b = false;
2702
+
2701 2703
     if (!cmd || !cmd[0])
2702 2704
         return;
2703 2705
 
@@ -2805,7 +2807,8 @@ void OpenRaider::consoleCommand(char *cmd)
2805 2807
     }
2806 2808
     else if (rc_command("r_animate", cmd))
2807 2809
     {
2808
-        if (atoi(cmd))
2810
+        rc_get_bool(cmd, &b);
2811
+        if (b)
2809 2812
         {
2810 2813
             m_render.setFlags(Render::fAnimateAllModels);
2811 2814
             print(false, "Animating all models");
@@ -2818,7 +2821,8 @@ void OpenRaider::consoleCommand(char *cmd)
2818 2821
     }
2819 2822
     else if (rc_command("r_ponytail", cmd))
2820 2823
     {
2821
-        if (atoi(cmd))
2824
+        rc_get_bool(cmd, &b);
2825
+        if (b)
2822 2826
         {
2823 2827
             m_render.setFlags(Render::fRenderPonytail);
2824 2828
             print(false, "Rendering ponytail");
@@ -2831,7 +2835,8 @@ void OpenRaider::consoleCommand(char *cmd)
2831 2835
     }
2832 2836
     else if (rc_command("r_light", cmd))
2833 2837
     {
2834
-        if (atoi(cmd))
2838
+        rc_get_bool(cmd, &b);
2839
+        if (b)
2835 2840
         {
2836 2841
             m_render.setFlags(Render::fGL_Lights);
2837 2842
         }
@@ -2842,7 +2847,8 @@ void OpenRaider::consoleCommand(char *cmd)
2842 2847
     }
2843 2848
     else if (rc_command("hop", cmd))
2844 2849
     {
2845
-        if (atoi(cmd))
2850
+        rc_get_bool(cmd, &b);
2851
+        if (b)
2846 2852
         {
2847 2853
             gWorld.setFlag(World::fEnableHopping);
2848 2854
             print(true, "Room hopping is on");
@@ -2855,7 +2861,8 @@ void OpenRaider::consoleCommand(char *cmd)
2855 2861
     }
2856 2862
     else if (rc_command("r_fog", cmd))
2857 2863
     {
2858
-        if (atoi(cmd))
2864
+        rc_get_bool(cmd, &b);
2865
+        if (b)
2859 2866
         {
2860 2867
             m_render.setFlags(Render::fFog);
2861 2868
         }
@@ -2906,7 +2913,8 @@ void OpenRaider::consoleCommand(char *cmd)
2906 2913
     }
2907 2914
     else if (rc_command("r_oneroom", cmd))
2908 2915
     {
2909
-        if (atoi(cmd))
2916
+        rc_get_bool(cmd, &b);
2917
+        if (b)
2910 2918
         {
2911 2919
             m_render.setFlags(Render::fOneRoom);
2912 2920
         }
@@ -2917,7 +2925,8 @@ void OpenRaider::consoleCommand(char *cmd)
2917 2925
     }
2918 2926
     else if (rc_command("r_allrooms", cmd))
2919 2927
     {
2920
-        if (atoi(cmd))
2928
+        rc_get_bool(cmd, &b);
2929
+        if (b)
2921 2930
         {
2922 2931
             m_render.setFlags(Render::fAllRooms);
2923 2932
         }
@@ -2930,7 +2939,8 @@ void OpenRaider::consoleCommand(char *cmd)
2930 2939
     }
2931 2940
     else if (rc_command("r_sprite", cmd))
2932 2941
     {
2933
-        if (atoi(cmd))
2942
+        rc_get_bool(cmd, &b);
2943
+        if (b)
2934 2944
         {
2935 2945
             m_render.setFlags(Render::fSprites);
2936 2946
         }
@@ -2941,7 +2951,8 @@ void OpenRaider::consoleCommand(char *cmd)
2941 2951
     }
2942 2952
     else if (rc_command("r_roommodel", cmd))
2943 2953
     {
2944
-        if (atoi(cmd))
2954
+        rc_get_bool(cmd, &b);
2955
+        if (b)
2945 2956
         {
2946 2957
             m_render.setFlags(Render::fRoomModels);
2947 2958
         }
@@ -2952,7 +2963,8 @@ void OpenRaider::consoleCommand(char *cmd)
2952 2963
     }
2953 2964
     else if (rc_command("r_entmodel", cmd))
2954 2965
     {
2955
-        if (atoi(cmd))
2966
+        rc_get_bool(cmd, &b);
2967
+        if (b)
2956 2968
         {
2957 2969
             m_render.setFlags(Render::fEntityModels);
2958 2970
         }
@@ -2963,7 +2975,8 @@ void OpenRaider::consoleCommand(char *cmd)
2963 2975
     }
2964 2976
     else if (rc_command("r_particle", cmd))
2965 2977
     {
2966
-        if (atoi(cmd))
2978
+        rc_get_bool(cmd, &b);
2979
+        if (b)
2967 2980
         {
2968 2981
             m_render.setFlags(Render::fParticles);
2969 2982
         }
@@ -2974,7 +2987,8 @@ void OpenRaider::consoleCommand(char *cmd)
2974 2987
     }
2975 2988
     else if (rc_command("r_vis", cmd))
2976 2989
     {
2977
-        if (atoi(cmd))
2990
+        rc_get_bool(cmd, &b);
2991
+        if (b)
2978 2992
         {
2979 2993
             m_render.setFlags(Render::fUsePortals);
2980 2994
         }
@@ -2985,7 +2999,8 @@ void OpenRaider::consoleCommand(char *cmd)
2985 2999
     }
2986 3000
     else if (rc_command("r_upf", cmd))
2987 3001
     {
2988
-        if (atoi(cmd))
3002
+        rc_get_bool(cmd, &b);
3003
+        if (b)
2989 3004
         {
2990 3005
             m_render.setFlags(Render::fUpdateRoomListPerFrame);
2991 3006
         }
@@ -2996,7 +3011,8 @@ void OpenRaider::consoleCommand(char *cmd)
2996 3011
     }
2997 3012
     else if (rc_command("r_portal", cmd))
2998 3013
     {
2999
-        if (atoi(cmd))
3014
+        rc_get_bool(cmd, &b);
3015
+        if (b)
3000 3016
         {
3001 3017
             m_render.setFlags(Render::fPortals);
3002 3018
         }
@@ -3007,7 +3023,8 @@ void OpenRaider::consoleCommand(char *cmd)
3007 3023
     }
3008 3024
     else if (rc_command("r_vmodel", cmd))
3009 3025
     {
3010
-        if (atoi(cmd))
3026
+        rc_get_bool(cmd, &b);
3027
+        if (b)
3011 3028
         {
3012 3029
             m_render.setFlags(Render::fViewModel);
3013 3030
         }
@@ -3018,7 +3035,8 @@ void OpenRaider::consoleCommand(char *cmd)
3018 3035
     }
3019 3036
     else if (rc_command("r_ralpha", cmd))
3020 3037
     {
3021
-        if (atoi(cmd))
3038
+        rc_get_bool(cmd, &b);
3039
+        if (b)
3022 3040
         {
3023 3041
             m_render.setFlags(Render::fRoomAlpha);
3024 3042
         }
@@ -3062,7 +3080,8 @@ void OpenRaider::consoleCommand(char *cmd)
3062 3080
     {
3063 3081
         m_flags |= OpenRaider_ShowFPS;
3064 3082
 
3065
-        if (!atoi(cmd))
3083
+        rc_get_bool(cmd, &b);
3084
+        if (!b)
3066 3085
         {
3067 3086
             m_flags ^= OpenRaider_ShowFPS;
3068 3087
         }

+ 0
- 8
src/System.cpp View File

@@ -57,14 +57,6 @@ System::System() {
57 57
 System::~System() {
58 58
 }
59 59
 
60
-int System::createDir(char *path) {
61
-#ifdef WIN32
62
-    return _mkdir(path);
63
-#else
64
-    return mkdir(path, S_IRWXU | S_IRWXG);
65
-#endif
66
-}
67
-
68 60
 unsigned int System::addCommandMode(const char *command) {
69 61
     if (command && command[0] == '[') {
70 62
         mCmdModes.pushBack(command);

+ 0
- 39
src/utils/math.cpp View File

@@ -93,45 +93,6 @@ int helIntersectionLineAndPolygon(vec3_t intersect,
93 93
 }
94 94
 
95 95
 
96
-vec_t helDistToSphereFromPlane3v(vec3_t center, vec_t radius, vec4_t plane)
97
-{
98
-    vec_t d;
99
-
100
-
101
-    d = (plane[0] * center[0] +
102
-            plane[1] * center[1] +
103
-            plane[2] * center[2] +
104
-            plane[3]);
105
-
106
-    if (d <= -radius)
107
-        return 0;
108
-
109
-    return d + radius;
110
-}
111
-
112
-
113
-vec_t helDistToBboxFromPlane3v(vec3_t min, vec3_t max, vec4_t plane)
114
-{
115
-    vec3_t center;
116
-    vec_t d, radius;
117
-
118
-
119
-    helMidpoint3v(min, max, center);
120
-
121
-    d = (plane[0] * center[0] +
122
-            plane[1] * center[1] +
123
-            plane[2] * center[2] +
124
-            plane[3]);
125
-
126
-    radius = helDist3v(max, center);
127
-
128
-    if (d <= -radius)
129
-        return 0;
130
-
131
-    return d + radius;
132
-}
133
-
134
-
135 96
 vec_t helDist3v(vec3_t a, vec3_t b)
136 97
 {
137 98
     return (sqrtf( ((b[0] - a[0]) * (b[0] - a[0])) +

Loading…
Cancel
Save