Skip to content

Commit c547572

Browse files
committed
fix msvc link error (wtf?)
1 parent 78ac8e5 commit c547572

File tree

16 files changed

+90
-179
lines changed

16 files changed

+90
-179
lines changed

cl_dll/cl_util.h

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,8 @@ inline void PlaySound( int iSound, float vol ) { gEngfuncs.pfnPlaySoundByIndex(
138138
#ifndef __APPLE__
139139
#define fabs(x) ((x) > 0 ? (x) : 0 - (x))
140140
#endif
141+
142+
#if 0
141143
#define DotProduct(x,y) ((x)[0]*(y)[0]+(x)[1]*(y)[1]+(x)[2]*(y)[2])
142144
#define VectorSubtract(a,b,c) {(c)[0]=(a)[0]-(b)[0];(c)[1]=(a)[1]-(b)[1];(c)[2]=(a)[2]-(b)[2];}
143145
#define VectorAdd(a,b,c) {(c)[0]=(a)[0]+(b)[0];(c)[1]=(a)[1]+(b)[1];(c)[2]=(a)[2]+(b)[2];}
@@ -147,13 +149,24 @@ inline void VectorClear(float *a) { a[0]=0.0;a[1]=0.0;a[2]=0.0;}
147149
#define VectorLength(a) ( sqrt( DotProduct( a, a )))
148150
#define VectorMA(a, scale, b, c) ((c)[0] = (a)[0] + (scale) * (b)[0],(c)[1] = (a)[1] + (scale) * (b)[1],(c)[2] = (a)[2] + (scale) * (b)[2])
149151
#define VectorScale(in, scale, out) ((out)[0] = (in)[0] * (scale),(out)[1] = (in)[1] * (scale),(out)[2] = (in)[2] * (scale))
152+
#else
153+
template<class VectorTypeA, class VectorTypeB> auto DotProduct(const VectorTypeA &x, const VectorTypeB & y) { return ((x)[0] * (y)[0] + (x)[1] * (y)[1] + (x)[2] * (y)[2]); }
154+
template<class VectorTypeA, class VectorTypeB, class VectorTypeC> void VectorSubtract(const VectorTypeA & a, const VectorTypeB & b, VectorTypeC &c) { (c)[0] = (a)[0] - (b)[0]; (c)[1] = (a)[1] - (b)[1]; (c)[2] = (a)[2] - (b)[2]; }
155+
template<class VectorTypeA, class VectorTypeB, class VectorTypeC> void VectorAdd(const VectorTypeA & a, const VectorTypeB & b, VectorTypeC &c) { (c)[0] = (a)[0] + (b)[0]; (c)[1] = (a)[1] + (b)[1]; (c)[2] = (a)[2] + (b)[2]; }
156+
template<class VectorTypeA, class VectorTypeB> void VectorCopy(const VectorTypeA & a, VectorTypeB & b) { (b)[0] = (a)[0]; (b)[1] = (a)[1]; (b)[2] = (a)[2]; }
157+
template<class VectorTypeA> void VectorClear(VectorTypeA &a) { a[0] = 0.0; a[1] = 0.0; a[2] = 0.0; }
158+
template<class VectorTypeA> auto VectorLength(const VectorTypeA &a) { return sqrt(DotProduct(a, a)); }
159+
template<class VectorTypeA, class ScaleType, class VectorTypeB, class VectorTypeC> void VectorMA(const VectorTypeA &a, ScaleType scale, const VectorTypeB &b, VectorTypeC &c) { ((c)[0] = (a)[0] + (scale) * (b)[0], (c)[1] = (a)[1] + (scale) * (b)[1], (c)[2] = (a)[2] + (scale) * (b)[2]); }
160+
template<class VectorTypeA, class ScaleType, class VectorTypeB> void VectorScale(const VectorTypeA &in, ScaleType scale, VectorTypeB &out) { ((out)[0] = (in)[0] * (scale), (out)[1] = (in)[1] * (scale), (out)[2] = (in)[2] * (scale)); }
161+
#endif
162+
150163
namespace cl{
151-
float VectorNormalize (float *v); // pm_math.h
164+
// const vec3_t ==untypedef=> float (const [3]) ==decay=> float * NOT const float * !!!
165+
float VectorNormalize(vec_t v[3]); // pm_math.h
166+
extern vec_t vec3_origin[3];
152167
}
153168
#define VectorInverse(x) ((x)[0] = -(x)[0], (x)[1] = -(x)[1], (x)[2] = -(x)[2])
154169

155-
extern vec3_t vec3_origin;
156-
157170
#ifdef MSC_VER
158171
// disable 'possible loss of data converting float to int' warning message
159172
#pragma warning( disable: 4244 )

cl_dll/hud/hud_spectator.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -481,7 +481,7 @@ int CHudSpectator::Draw(float flTime)
481481
VectorNormalize(right);
482482
VectorScale(right, m_moveDelta, right );
483483

484-
VectorAdd( m_mapOrigin, right, m_mapOrigin )
484+
VectorAdd( m_mapOrigin, right, m_mapOrigin );
485485

486486
}
487487

cl_dll/hud/radio.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,16 +28,17 @@ version.
2828

2929
#include "hud.h"
3030

31-
#include "pm_math.h"
31+
#include "cl_util.h"
3232

3333
#include "parsemsg.h"
34-
#include "cl_util.h"
3534

3635
#include "r_efx.h"
3736
#include "event_api.h"
3837
#include "com_model.h"
3938
#include <string.h>
4039

40+
using namespace cl;
41+
4142
DECLARE_MESSAGE( m_Radio, SendAudio )
4243
DECLARE_MESSAGE( m_Radio, ReloadSound )
4344
DECLARE_MESSAGE( m_Radio, BotVoice )

cl_dll/input.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,8 @@ extern int g_weaponselect;
3939
extern cl_enginefunc_t gEngfuncs;
4040

4141
// Defined in pm_math.cpp
42-
extern "C" {
43-
float anglemod(float a);
42+
namespace cl {
43+
float anglemod(float a);
4444
}
4545

4646
void IN_Init (void);

cl_dll/rain.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,7 @@
1111

1212
#include <memory.h>
1313
#include "hud.h"
14-
15-
#include "pm_math.h"
14+
#include "studio/studio_util.h"
1615

1716
#include "cl_util.h"
1817
#include "const.h"

cl_dll/view.cpp

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,6 @@
1313

1414
#include "hud.h"
1515

16-
#include "pm_math.h"
17-
1816
#include "cl_util.h"
1917
#include "cvardef.h"
2018
#include "usercmd.h"
@@ -45,11 +43,9 @@
4543
#endif
4644

4745
namespace cl { // pm_math.cpp
48-
49-
void NormalizeAngles(float *angles);
50-
float Distance(const float *v1, const float *v2);
51-
float AngleBetweenVectors(const float *v1, const float *v2);
52-
46+
void NormalizeAngles(vec_t angles[3]);
47+
float Distance(const vec_t v1[3], const vec_t v2[3]);
48+
void VectorAngles(const vec_t forward[3], vec_t angles[3]);
5349
};
5450

5551
namespace cl {
@@ -1630,7 +1626,7 @@ void V_CalcSpectatorRefdef ( struct ref_params_s * pparams )
16301626

16311627
// write back new values into pparams
16321628
VectorCopy ( v_cl_angles, pparams->cl_viewangles );
1633-
VectorCopy ( v_angles, pparams->viewangles )
1629+
VectorCopy ( v_angles, pparams->viewangles );
16341630
VectorCopy ( v_origin, pparams->vieworg );
16351631
}
16361632

common/mathlib.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,8 @@
3535
#define M_PI 3.14159265358979323846 // matches value in gcc v2 math.h
3636
#endif
3737

38+
struct mplane_s;
39+
3840
#if defined(CLIENT_DLL)
3941
namespace cl {
4042
#elif defined(SERVER_DLL)
@@ -43,8 +45,6 @@ namespace sv {
4345
extern "C++" {
4446
#endif
4547

46-
struct mplane_s;
47-
4848
extern vec3_t vec3_origin;
4949
extern int nanmask;
5050

msvc/client.vcxproj

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -309,7 +309,6 @@
309309
<ClInclude Include="..\pm_shared\pm_defs.h" />
310310
<ClInclude Include="..\pm_shared\pm_info.h" />
311311
<ClInclude Include="..\pm_shared\pm_materials.h" />
312-
<ClInclude Include="..\pm_shared\pm_math.h" />
313312
<ClInclude Include="..\pm_shared\pm_movevars.h" />
314313
<ClInclude Include="..\pm_shared\pm_shared.h" />
315314
<ClInclude Include="..\public\unicode_strtools.h" />
@@ -406,7 +405,7 @@
406405
</ClCompile>
407406
<Link>
408407
<GenerateDebugInformation>true</GenerateDebugInformation>
409-
<AdditionalDependencies>vstdlib.lib;tier0.lib;wsock32.lib;winmm.lib;%(AdditionalDependencies)</AdditionalDependencies>
408+
<AdditionalDependencies>wsock32.lib;winmm.lib;%(AdditionalDependencies)</AdditionalDependencies>
410409
<BaseAddress>
411410
</BaseAddress>
412411
<SubSystem>Windows</SubSystem>
@@ -432,7 +431,7 @@
432431
</ClCompile>
433432
<Link>
434433
<GenerateDebugInformation>true</GenerateDebugInformation>
435-
<AdditionalDependencies>vstdlib.lib;tier0.lib;wsock32.lib;winmm.lib;%(AdditionalDependencies)</AdditionalDependencies>
434+
<AdditionalDependencies>wsock32.lib;winmm.lib;%(AdditionalDependencies)</AdditionalDependencies>
436435
<BaseAddress>
437436
</BaseAddress>
438437
<SubSystem>Windows</SubSystem>
@@ -462,7 +461,7 @@
462461
<GenerateDebugInformation>true</GenerateDebugInformation>
463462
<EnableCOMDATFolding>true</EnableCOMDATFolding>
464463
<OptimizeReferences>true</OptimizeReferences>
465-
<AdditionalDependencies>vstdlib.lib;tier0.lib;wsock32.lib;winmm.lib;%(AdditionalDependencies)</AdditionalDependencies>
464+
<AdditionalDependencies>wsock32.lib;winmm.lib;%(AdditionalDependencies)</AdditionalDependencies>
466465
<BaseAddress>
467466
</BaseAddress>
468467
<SubSystem>Windows</SubSystem>
@@ -492,7 +491,7 @@
492491
<GenerateDebugInformation>true</GenerateDebugInformation>
493492
<EnableCOMDATFolding>true</EnableCOMDATFolding>
494493
<OptimizeReferences>true</OptimizeReferences>
495-
<AdditionalDependencies>vstdlib.lib;tier0.lib;wsock32.lib;winmm.lib;%(AdditionalDependencies)</AdditionalDependencies>
494+
<AdditionalDependencies>wsock32.lib;winmm.lib;%(AdditionalDependencies)</AdditionalDependencies>
496495
<BaseAddress>
497496
</BaseAddress>
498497
<SubSystem>Windows</SubSystem>

msvc/client.vcxproj.filters

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -923,9 +923,6 @@
923923
<ClInclude Include="..\pm_shared\pm_materials.h">
924924
<Filter>pm_shared</Filter>
925925
</ClInclude>
926-
<ClInclude Include="..\pm_shared\pm_math.h">
927-
<Filter>pm_shared</Filter>
928-
</ClInclude>
929926
<ClInclude Include="..\pm_shared\pm_movevars.h">
930927
<Filter>pm_shared</Filter>
931928
</ClInclude>

msvc/server.vcxproj

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -850,7 +850,6 @@
850850
<ClInclude Include="..\pm_shared\pm_defs.h" />
851851
<ClInclude Include="..\pm_shared\pm_info.h" />
852852
<ClInclude Include="..\pm_shared\pm_materials.h" />
853-
<ClInclude Include="..\pm_shared\pm_math.h" />
854853
<ClInclude Include="..\pm_shared\pm_movevars.h" />
855854
<ClInclude Include="..\pm_shared\pm_shared.h" />
856855
<ClInclude Include="..\public\archtypes.h" />

0 commit comments

Comments
 (0)