build: vs2013 compat changes

This commit is contained in:
Eric Wasylishen 2016-08-06 15:37:00 -07:00
parent 1c94d4b157
commit a807204fe6
8 changed files with 24 additions and 19 deletions

View File

@ -45,6 +45,9 @@ typedef unsigned char byte;
#ifdef _MSC_VER #ifdef _MSC_VER
#define __func__ __FUNCTION__ #define __func__ __FUNCTION__
#ifndef __cplusplus
#define inline _inline
#endif
#endif #endif
#ifdef __GNUC__ #ifdef __GNUC__

View File

@ -22,6 +22,7 @@
#include <float.h> #include <float.h>
#include <math.h> #include <math.h>
#include <common/cmdlib.h>
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {

View File

@ -83,16 +83,9 @@ public:
light_t(void) : light_t(void) :
spotlight { false }, spotlight { false },
spotvec { 0, 0, 0 },
spotfalloff { 0 }, spotfalloff { 0 },
spotfalloff2 { 0 }, spotfalloff2 { 0 },
projectedmip { nullptr }, projectedmip { nullptr },
projectionmatrix {
0,0,0,0,
0,0,0,0,
0,0,0,0,
0,0,0,0,
},
epairs {nullptr}, epairs {nullptr},
targetent {nullptr}, targetent {nullptr},
generated {false}, generated {false},
@ -119,7 +112,13 @@ public:
mangle { "mangle", 0, 0, 0 }, // not transformed to vec mangle { "mangle", 0, 0, 0 }, // not transformed to vec
projangle { "project_mangle", 20, 0, 0 }, // not transformed to vec projangle { "project_mangle", 20, 0, 0 }, // not transformed to vec
project_texture { "project_texture", "" } project_texture { "project_texture", "" }
{} {
VectorSet(spotvec, 0, 0, 0);
for (int i = 0; i < 16; i++) {
projectionmatrix[i] = 0;
}
}
settingsdict_t settings() { settingsdict_t settings() {
return {{ return {{

View File

@ -579,8 +579,7 @@ public:
class modelinfo_t { class modelinfo_t {
private: #define DEFAULT_PHONG_ANGLE 89.0f
static constexpr float DEFAULT_PHONG_ANGLE = 89.0f;
public: public:
const dmodel_t *model; const dmodel_t *model;
@ -607,7 +606,6 @@ public:
modelinfo_t(const dmodel_t *m, float lmscale) : modelinfo_t(const dmodel_t *m, float lmscale) :
model { m }, model { m },
lightmapscale { lmscale }, lightmapscale { lmscale },
offset { 0, 0, 0 },
minlight { "minlight", 0 }, minlight { "minlight", 0 },
shadow { "shadow", 0 }, shadow { "shadow", 0 },
shadowself { "shadowself", 0 }, shadowself { "shadowself", 0 },
@ -616,7 +614,9 @@ public:
phong_angle { "phong_angle", 0 }, phong_angle { "phong_angle", 0 },
minlight_exclude { "minlight_exclude", "" }, minlight_exclude { "minlight_exclude", "" },
minlight_color { "minlight_color", 255, 255, 255, vec3_transformer_t::NORMALIZE_COLOR_TO_255 } minlight_color { "minlight_color", 255, 255, 255, vec3_transformer_t::NORMALIZE_COLOR_TO_255 }
{} {
VectorSet(offset, 0, 0, 0);
}
settingsdict_t settings() { settingsdict_t settings() {
return {{ return {{

View File

@ -22,6 +22,7 @@
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#include <common/cmdlib.h>
/* Use some GCC builtins */ /* Use some GCC builtins */
#if !defined(ffsl) && defined(__GNUC__) #if !defined(ffsl) && defined(__GNUC__)
@ -73,7 +74,8 @@ ClearLeafBit(leafbits_t *bits, int leafnum)
static inline size_t static inline size_t
LeafbitsSize(int numleafs) LeafbitsSize(int numleafs)
{ {
return offsetof(leafbits_t, bits[(numleafs + LEAFMASK) >> LEAFSHIFT]); int numblocks = (numleafs + LEAFMASK) >> LEAFSHIFT;
return sizeof(leafbits_t) + (sizeof(leafblock_t) * numblocks);
} }
#endif /* VIS_LEAFBITS_H */ #endif /* VIS_LEAFBITS_H */

View File

@ -1500,7 +1500,7 @@ LightFace_Entity(const bsp2_t *bsp,
static void static void
LightFace_Sky(const sun_t *sun, const lightsurf_t *lightsurf, lightmap_t *lightmaps) LightFace_Sky(const sun_t *sun, const lightsurf_t *lightsurf, lightmap_t *lightmaps)
{ {
constexpr float MAX_SKY_DIST = 65536.0f; const float MAX_SKY_DIST = 65536.0f;
const modelinfo_t *modelinfo = lightsurf->modelinfo; const modelinfo_t *modelinfo = lightsurf->modelinfo;
const plane_t *plane = &lightsurf->plane; const plane_t *plane = &lightsurf->plane;

View File

@ -875,13 +875,13 @@ public:
bsp_ray_t(int i, const vec_t *origin, const vec3_t dir, float dist, const dmodel_t *selfshadow, const vec_t *color) : bsp_ray_t(int i, const vec_t *origin, const vec3_t dir, float dist, const dmodel_t *selfshadow, const vec_t *color) :
_pointindex{i}, _pointindex{i},
_origin{origin[0], origin[1], origin[2]},
_dir{dir[0], dir[1], dir[2]},
_maxdist{dist}, _maxdist{dist},
_selfshadow{selfshadow}, _selfshadow{selfshadow},
_hitdist{dist}, _hitdist{dist},
_hittype{hittype_t::NONE}, _hittype{hittype_t::NONE},
_hit_occluded{false} { _hit_occluded{false} {
VectorCopy(origin, _origin);
VectorCopy(dir, _dir);
if (color != nullptr) { if (color != nullptr) {
VectorCopy(color, _color); VectorCopy(color, _color);
} }

View File

@ -33,7 +33,7 @@
using namespace std; using namespace std;
static constexpr float MAX_SKY_RAY_DEPTH = 8192.0f; static const float MAX_SKY_RAY_DEPTH = 8192.0f;
/** /**
* i is between 0 and face->numedges - 1 * i is between 0 and face->numedges - 1
@ -197,8 +197,8 @@ Embree_FilterFuncN(int* valid,
const struct RTCHitN* potentialHit, const struct RTCHitN* potentialHit,
const size_t N) const size_t N)
{ {
constexpr int VALID = -1; const int VALID = -1;
constexpr int INVALID = 0; const int INVALID = 0;
for (size_t i=0; i<N; i++) { for (size_t i=0; i<N; i++) {
if (valid[i] != VALID) { if (valid[i] != VALID) {