...
 
Commits (1)
......@@ -214,7 +214,7 @@ std::list<DWinding *> *CreateTrace(dleaf_t *leaf, int c, vis_header *header, byt
}
}
delete repeatlist;
delete[] repeatlist;
return pointlist;
}
......
......@@ -90,13 +90,11 @@ public:
};
class ForEachFace : public BrushVisitor {
Brush &m_brush;
public:
mutable int m_contentFlagsVis;
mutable int m_surfaceFlagsVis;
ForEachFace(Brush &brush)
: m_brush(brush)
ForEachFace()
{
m_contentFlagsVis = -1;
m_surfaceFlagsVis = -1;
......@@ -140,7 +138,7 @@ public:
{
Brush *brush = Node_getBrush(path.top());
if (brush != 0) {
ForEachFace faces(*brush);
ForEachFace faces{};
brush->forEachFace(faces);
// contentflags?
if (m_content) {
......
......@@ -182,7 +182,7 @@ inline ub4 hash(
const UB1Traits& ub1traits,
const UB4x1Traits& ub4x1traits
){
register ub4 a,b,c,len;
ub4 a,b,c,len;
/* Set up the internal state */
len = length;
......@@ -203,17 +203,17 @@ inline ub4 hash(
c += length;
switch ( len ) /* all the case statements fall through */
{
case 11: c += ( ( ub4 ) UB1Traits::as_ub1( k[10] ) << 24 ); __attribute((fallthrough));
case 10: c += ( ( ub4 ) UB1Traits::as_ub1( k[9] ) << 16 ); __attribute((fallthrough));
case 9: c += ( ( ub4 ) UB1Traits::as_ub1( k[8] ) << 8 ); __attribute((fallthrough));
case 11: c += ( ( ub4 ) UB1Traits::as_ub1( k[10] ) << 24 ); [[clang::fallthrough]];
case 10: c += ( ( ub4 ) UB1Traits::as_ub1( k[9] ) << 16 ); [[clang::fallthrough]];
case 9: c += ( ( ub4 ) UB1Traits::as_ub1( k[8] ) << 8 ); [[clang::fallthrough]];
/* the first byte of c is reserved for the length */
case 8: b += ( ( ub4 ) UB1Traits::as_ub1( k[7] ) << 24 ); __attribute((fallthrough));
case 7: b += ( ( ub4 ) UB1Traits::as_ub1( k[6] ) << 16 ); __attribute((fallthrough));
case 6: b += ( ( ub4 ) UB1Traits::as_ub1( k[5] ) << 8 ); __attribute((fallthrough));
case 5: b += UB1Traits::as_ub1( k[4] ); __attribute((fallthrough));
case 4: a += ( ( ub4 ) UB1Traits::as_ub1( k[3] ) << 24 ); __attribute((fallthrough));
case 3: a += ( ( ub4 ) UB1Traits::as_ub1( k[2] ) << 16 ); __attribute((fallthrough));
case 2: a += ( ( ub4 ) UB1Traits::as_ub1( k[1] ) << 8 ); __attribute((fallthrough));
case 8: b += ( ( ub4 ) UB1Traits::as_ub1( k[7] ) << 24 ); [[clang::fallthrough]];
case 7: b += ( ( ub4 ) UB1Traits::as_ub1( k[6] ) << 16 ); [[clang::fallthrough]];
case 6: b += ( ( ub4 ) UB1Traits::as_ub1( k[5] ) << 8 ); [[clang::fallthrough]];
case 5: b += UB1Traits::as_ub1( k[4] ); [[clang::fallthrough]];
case 4: a += ( ( ub4 ) UB1Traits::as_ub1( k[3] ) << 24 ); [[clang::fallthrough]];
case 3: a += ( ( ub4 ) UB1Traits::as_ub1( k[2] ) << 16 ); [[clang::fallthrough]];
case 2: a += ( ( ub4 ) UB1Traits::as_ub1( k[1] ) << 8 ); [[clang::fallthrough]];
case 1: a += UB1Traits::as_ub1( k[0] );
/* case 0: nothing left to add */
}
......@@ -240,7 +240,7 @@ inline ub4 hash2(
ub4 initval, /* the previous hash, or an arbitrary value */
const UB4Traits& ub4traits
){
register ub4 a,b,c,len;
ub4 a,b,c,len;
/* Set up the internal state */
len = length;
......
......@@ -207,7 +207,7 @@ void instantiate(){
Test test;
const Test& testconst = test;
{
Callback<void()> a = makeCallbackF(&test0free);
Callback<void()> a = makeCallbackF(test0free);
Callback<void()> b = Test::Test0Caller( test );
b = makeCallback( Test::Test0(), test );
Callback<void()> c = Test::Test0ConstCaller( testconst );
......@@ -221,7 +221,7 @@ void instantiate(){
}
{
typedef Callback<void(A1)> TestCallback1;
TestCallback1 a = makeCallbackF(&test1free);
TestCallback1 a = makeCallbackF(test1free);
TestCallback1 b = Test::Test1Caller( test );
b = makeCallback( Test::Test1(), test );
TestCallback1 c = Test::Test1ConstCaller( testconst );
......
......@@ -70,54 +70,36 @@ namespace detail {
namespace detail {
template<class Type>
struct ConvertFromOpaque {
struct ConvertToOpaque {
};
// reference
template<class Type>
struct ConvertFromOpaque {
};
template<class T>
inline const void *convertToOpaque(const T &t) {
return &t;
}
// pointer
template<class T>
struct ConvertFromOpaque<const T &> {
static T const &apply(void *p) {
return *static_cast<const T *>(p);
struct ConvertToOpaque<T const *> {
static void const *apply(const T *t) {
return t;
}
};
template<class T>
inline void *convertToOpaque(T &t) {
return &t;
}
template<class T>
struct ConvertFromOpaque<T &> {
static T &apply(void *p) {
return *static_cast<T *>( p );
struct ConvertFromOpaque<T const *> {
static T const *apply(void const *p) {
return static_cast<T const *>(p);
}
};
// pointer
template<class T>
inline const void *convertToOpaque(const T *t) {
return t;
}
template<class T>
struct ConvertFromOpaque<const T *> {
static const T *apply(void *p) {
return static_cast<const T *>(p);
struct ConvertToOpaque<T *> {
static void *apply(T *t) {
return t;
}
};
template<class T>
inline void *convertToOpaque(T *t) {
return t;
}
template<class T>
struct ConvertFromOpaque<T *> {
static T *apply(void *p) {
......@@ -125,35 +107,35 @@ namespace detail {
}
};
// function pointer
template<class R, class... Ts>
inline const void *convertToOpaque(R(*const &t)(Ts...)) {
return &t;
}
template<class R, class... Ts>
struct ConvertFromOpaque<R(*const &)(Ts...)> {
using Type = R(*)(Ts...);
// reference
static Type const &apply(void *p) {
return *static_cast<Type *>(p);
template<class T>
struct ConvertToOpaque<T const &> {
static void const *apply(T const &t) {
return &t;
}
};
template<class R, class... Ts>
inline void *convertToOpaque(R(*&t)(Ts...)) {
return &t;
}
template<class T>
struct ConvertFromOpaque<T const &> {
static T const &apply(void const *p) {
return *static_cast<T const *>(p);
}
};
template<class R, class... Ts>
struct ConvertFromOpaque<R(*&)(Ts...)> {
using Type = R(*)(Ts...);
template<class T>
struct ConvertToOpaque<T &> {
static void *apply(T &t) {
return &t;
}
};
static Type &apply(void *p) {
return *static_cast<Type *>(p);
}
};
template<class T>
struct ConvertFromOpaque<T &> {
static T &apply(void *p) {
return *static_cast<T *>( p );
}
};
template<class Caller, class F>
class BindFirstOpaqueN;
......@@ -182,7 +164,7 @@ namespace detail {
}
void *getEnvironment() const {
return const_cast<void *>(detail::convertToOpaque(firstBound));
return const_cast<void *>(detail::ConvertToOpaque<FirstBound>::apply(firstBound));
}
};
......
......@@ -79,7 +79,7 @@ static char my_tcpip_address[NET_NAMELEN];
const int DEFAULTnet_hostport = 26000;
const int MAXHOSTNAMELEN = 256;
#define MAXHOSTNAMELEN 256
static int net_acceptsocket = -1; // socket for fielding new connections
static int net_controlsocket;
......
......@@ -166,7 +166,7 @@ int aabb_test_plane( const aabb_t *aabb, const float *plane ){
from "Graphics Gems", Academic Press, 1990
*/
const int NUMDIM = 3;
#define NUMDIM 3
const int RIGHT = 0;
const int LEFT = 1;
const int MIDDLE = 2;
......
......@@ -1738,7 +1738,7 @@ void m4x4_solve_ge( m4x4_t matrix, vec4_t x ){
#endif
int matrix_solve_ge( vec_t* matrix, vec_t* aug, vec3_t x ){
const int N = 3;
#define N 3
int indx[N];
int c,r;
int i;
......
......@@ -444,7 +444,7 @@ static picoModel_t *_fm_load( PM_PARAMS_LOAD ){
#endif
continue;
}
else if ( ( p_index_LUT[triangle->index_xyz[j]].next == NULL ) ) { // Not equal to Main entry, and no LL entry
else if ( p_index_LUT[triangle->index_xyz[j]].next == NULL ) { // Not equal to Main entry, and no LL entry
// Add first entry of LL from Main
p_index_LUT2 = (index_LUT_t *)_pico_alloc( sizeof( index_LUT_t ) );
if ( p_index_LUT2 == NULL ) {
......
......@@ -50,7 +50,7 @@ const int MD2_MAX_TRIANGLES = 4096;
const int MD2_MAX_VERTS = 2048;
const int MD2_MAX_FRAMES = 512;
const int MD2_MAX_MD2SKINS = 32;
const int MD2_MAX_SKINNAME = 64;
#define MD2_MAX_SKINNAME 64
typedef struct index_LUT_s
{
......@@ -491,7 +491,7 @@ static picoModel_t *_md2_load( PM_PARAMS_LOAD ){
continue;
}
else if ( ( p_index_LUT[p_md2Triangle->index_xyz[j]].next == NULL ) ) { // Not equal to Main entry, and no LL entry
else if ( p_index_LUT[p_md2Triangle->index_xyz[j]].next == NULL ) { // Not equal to Main entry, and no LL entry
// Add first entry of LL from Main
p_index_LUT2 = (index_LUT_t *)_pico_alloc( sizeof( index_LUT_t ) );
if ( p_index_LUT2 == NULL ) {
......
......@@ -57,7 +57,7 @@ static picoColor_t white = { 255,255,255,255 };
/* ms3d limits */
const int MS3D_MAX_VERTS = 8192;
const int MS3D_MAX_TRIS = 16384;
const int MS3D_MAX_GROUPS = 128;
#define MS3D_MAX_GROUPS 128
const int MS3D_MAX_MATERIALS = 128;
const int MS3D_MAX_JOINTS = 128;
const int MS3D_MAX_KEYFRAMES = 216;
......
......@@ -102,53 +102,55 @@ Property<T> make_property(Self &self) {
// chain
template <class DST, class SRC, class X, class A>
struct PropertyChainImpl {
static void ExportThunk(const Callback<void(DST)> &self, SRC value) {
PropertyImpl<SRC, DST>::Export(value, self);
}
static void Export(const X &self, const Callback<void(DST)> &returnz) {
A::Get::thunk_(self, ConstReferenceCaller<Callback<void(DST)>, void(SRC), ExportThunk>(returnz));
}
static void Import(X &self, DST value) {
SRC out;
PropertyImpl<SRC, DST>::Import(out, value);
A::Set::thunk_(self, out);
}
};
template<class I_Outer, class I_Inner>
Property<detail::propertyimpl_other<I_Outer>> make_property_chain(detail::propertyimpl_self<I_Inner> &it) {
using DST = detail::propertyimpl_other<I_Outer>;
using SRC = detail::propertyimpl_self<I_Outer>;
using X = detail::propertyimpl_self<I_Inner>;
using A = property_impl<I_Inner>;
struct I {
static void ExportThunk(const Callback<void(DST)> &self, SRC value) {
PropertyImpl<SRC, DST>::Export(value, self);
}
static void Export(const X &self, const Callback<void(DST)> &returnz) {
A::Get::thunk_(self, ConstReferenceCaller<Callback<void(DST)>, void(SRC), ExportThunk>(returnz));
}
static void Import(X &self, DST value) {
SRC out;
PropertyImpl<SRC, DST>::Import(out, value);
A::Set::thunk_(self, out);
}
};
return make_property<PropertyAdaptor<X, DST, I>>(it);
return make_property<PropertyAdaptor<X, DST, PropertyChainImpl<DST, SRC, X, A>>>(it);
}
template <class DST, class SRC, class A>
struct PropertyChainImpl_free {
static void ExportThunk(const Callback<void(DST)> &self, SRC value) {
PropertyImpl<SRC, DST>::Export(value, self);
}
static void Export(const Callback<void(DST)> &returnz) {
A::Get::thunk_(nullptr, ConstReferenceCaller<Callback<void(DST)>, void(SRC), ExportThunk>(returnz));
}
static void Import(DST value) {
SRC out;
PropertyImpl<SRC, DST>::Import(out, value);
A::Set::thunk_(nullptr, out);
}
};
template<class I_Outer, class I_Inner>
Property<detail::propertyimpl_other<I_Outer>> make_property_chain() {
using DST = detail::propertyimpl_other<I_Outer>;
using SRC = detail::propertyimpl_self<I_Outer>;
using A = property_impl_free<I_Inner>;
struct I {
static void ExportThunk(const Callback<void(DST)> &self, SRC value) {
PropertyImpl<SRC, DST>::Export(value, self);
}
static void Export(const Callback<void(DST)> &returnz) {
A::Get::thunk_(nullptr, ConstReferenceCaller<Callback<void(DST)>, void(SRC), ExportThunk>(returnz));
}
static void Import(DST value) {
SRC out;
PropertyImpl<SRC, DST>::Import(out, value);
A::Set::thunk_(nullptr, out);
}
};
return make_property<PropertyAdaptorFree<DST, I>>();
return make_property<PropertyAdaptorFree<DST, PropertyChainImpl_free<DST, SRC, A>>>();
}
// specializations
......
......@@ -43,7 +43,7 @@ bool isSelected() const {
}
};
class ObservedSelectable : public Selectable
class ObservedSelectable final : public Selectable
{
SelectionChangeCallback m_onchanged;
bool m_selected;
......
......@@ -51,7 +51,10 @@ namespace ui {
>::type
>;
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wkeyword-macro"
#define this (verify<self>::test(*static_cast<self>(const_cast<pointer_remove_const<decltype(this)>::type>(this))))
#pragma clang diagnostic pop
IMPL(Editable, GTK_EDITABLE);
......
......@@ -599,7 +599,10 @@ namespace ui {
}
}
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wkeyword-macro"
#define this (*static_cast<self>(this))
#pragma clang diagnostic pop
template<class Lambda>
gulong Object::connect(char const *detailed_signal, Lambda &&c_handler, void *data)
......
......@@ -55,7 +55,6 @@ private:
CopiedString m_savefilename;
xmlDocPtr doc;
xmlXPathContextPtr context;
xmlNodeSetPtr nodePtr;
xmlXPathObjectPtr XpathEval( const char* queryString ){
xmlChar* expression = (xmlChar*)queryString;
......
......@@ -66,7 +66,7 @@ public:
virtual TreeXMLImporter &child() = 0;
};
class SubPrimitiveImporter : public TreeXMLImporter {
class SubPrimitiveImporter final : public TreeXMLImporter {
XMLImporter *m_importer;
public:
SubPrimitiveImporter(XMLImporter *importer) : m_importer(importer)
......@@ -94,7 +94,7 @@ public:
}
};
class PrimitiveImporter : public TreeXMLImporter {
class PrimitiveImporter final : public TreeXMLImporter {
scene::Node &m_parent;
XMLImporter *m_importer;
char m_child[sizeof(SubPrimitiveImporter)];
......@@ -149,7 +149,7 @@ public:
}
};
class EntityImporter : public TreeXMLImporter {
class EntityImporter final : public TreeXMLImporter {
scene::Node &m_parent;
char m_node[sizeof(NodeSmartReference)];
char m_child[sizeof(PrimitiveImporter)];
......
......@@ -39,7 +39,7 @@
#include "traverselib.h"
#include "render.h"
class VectorLightList : public LightList {
class VectorLightList final : public LightList {
typedef std::vector<const RendererLight *> Lights;
Lights m_lights;
public:
......
......@@ -43,7 +43,7 @@
#include "traverselib.h"
#include "render.h"
class VectorLightList : public LightList {
class VectorLightList final : public LightList {
typedef std::vector<const RendererLight *> Lights;
Lights m_lights;
public:
......
......@@ -558,7 +558,7 @@ void InitDirectory(const char *directory, ArchiveModules &archiveModules)
}
const char *ext = strrchr(name, '.');
char tmppath[PATH_MAX];
char tmppath[PATH_MAX + 1];
if (is_dpk_vfs) {
if (!!ext && !string_compare_nocase_upper(ext, ".dpkdir")) {
......
......@@ -2633,7 +2633,7 @@ triangles_same_winding(const BasicVector3<Element> &x1, const BasicVector3<Eleme
typedef const Plane3 *PlanePointer;
typedef PlanePointer *PlanesIterator;
class VectorLightList : public LightList {
class VectorLightList final : public LightList {
typedef std::vector<const RendererLight *> Lights;
Lights m_lights;
public:
......
......@@ -284,29 +284,31 @@ public:
}
};
template <class Widget, class Self, class T, class native>
struct AddDataCustomWrapper {
static void Export(const native &self, const Callback<void(T)> &returnz)
{
native *p = &const_cast<native &>(self);
auto widget = Self::from(p);
Widget::Get::thunk_(widget, returnz);
}
static void Import(native &self, T value)
{
native *p = &self;
auto widget = Self::from(p);
Widget::Set::thunk_(widget, value);
}
};
template<class Widget>
void AddDataCustom(DialogDataList &self, typename Widget::Type widget, Property<typename Widget::Other> const &property)
{
using Self = typename Widget::Type;
using T = typename Widget::Other;
using native = typename std::remove_pointer<typename Self::native>::type;
struct Wrapper {
static void Export(const native &self, const Callback<void(T)> &returnz)
{
native *p = &const_cast<native &>(self);
auto widget = Self::from(p);
Widget::Get::thunk_(widget, returnz);
}
static void Import(native &self, T value)
{
native *p = &self;
auto widget = Self::from(p);
Widget::Set::thunk_(widget, value);
}
};
self.push_back(new CallbackDialogData<typename Widget::Other>(
make_property<PropertyAdaptor<native, T, Wrapper>>(*static_cast<native *>(widget)),
self.push_back(new CallbackDialogData<T>(
make_property<PropertyAdaptor<native, T, AddDataCustomWrapper<Widget, Self, T, native>>>(*static_cast<native *>(widget)),
property
));
}
......
......@@ -198,7 +198,7 @@ namespace {
}
};
class AttributeImporter : public TreeXMLImporter {
class AttributeImporter final : public TreeXMLImporter {
StringOutputStream &m_comment;
public:
......@@ -278,7 +278,7 @@ namespace {
}
class ClassImporter : public TreeXMLImporter {
class ClassImporter final : public TreeXMLImporter {
EntityClassCollector &m_collector;
EntityClass *m_eclass;
StringOutputStream m_comment;
......@@ -358,7 +358,7 @@ namespace {
}
};
class ItemImporter : public TreeXMLImporter {
class ItemImporter final : public TreeXMLImporter {
public:
ItemImporter(ListAttributeType &list, const XMLElement &element)
{
......@@ -389,7 +389,7 @@ namespace {
return string_equal(name, "item");
}
class ListAttributeImporter : public TreeXMLImporter {
class ListAttributeImporter final : public TreeXMLImporter {
ListAttributeType *m_listType;
Storage<ItemImporter> m_item;
public:
......@@ -436,7 +436,7 @@ namespace {
return string_equal(name, "list");
}
class ClassesImporter : public TreeXMLImporter {
class ClassesImporter final : public TreeXMLImporter {
EntityClassCollector &m_collector;
Storage<ClassImporter> m_class;
Storage<ListAttributeImporter> m_list;
......
......@@ -325,7 +325,7 @@ namespace {
}
}
struct ModelResource : public Resource {
struct ModelResource final : public Resource {
NodeSmartReference m_model;
const CopiedString m_originalName;
CopiedString m_path;
......
......@@ -19,7 +19,7 @@
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
#if !defined( INCLUDEDE_SCENEGRAPH_H )
#if !defined( INCLUDED_SCENEGRAPH_H )
#define INCLUDED_SCENEGRAPH_H
#endif
......@@ -104,7 +104,6 @@ private:
char *m_sBSPName;
// buffer we use in push mode to receive data directly from the network
xmlParserInputBufferPtr m_xmlInputBuffer;
xmlParserInputPtr m_xmlInput;
xmlParserCtxtPtr m_xmlParserCtxt;
// call this to switch the set listening mode
......
......@@ -85,6 +85,9 @@ void MD3_ComputeTagFromTri( md3Tag_t *pTag, float pTri[3][3] ){
hypotSide = 2;
origin = 1;
}
else {
assert(0);
}
len[hypotSide] = -1;
if ( len[0] > len[1] && len[0] > len[2] ) {
......@@ -96,6 +99,9 @@ void MD3_ComputeTagFromTri( md3Tag_t *pTag, float pTri[3][3] ){
else if ( len[2] > len[0] && len[2] > len[1] ) {
longestSide = 2;
}
else {
assert(0);
}
len[longestSide] = -1;
if ( len[0] > len[1] && len[0] > len[2] ) {
......@@ -107,6 +113,9 @@ void MD3_ComputeTagFromTri( md3Tag_t *pTag, float pTri[3][3] ){
else if ( len[2] > len[0] && len[2] > len[1] ) {
shortestSide = 2;
}
else {
assert(0);
}
len[shortestSide] = -1;
......
......@@ -110,13 +110,13 @@ void GetBestSurfaceTriangleMatchForBrushside( side_t *buildSide, bspDrawVert_t *
continue;
}
}
if ( abs( DotProduct( vert[0]->xyz, buildPlane->normal ) - buildPlane->dist ) >= distanceEpsilon ) {
if ( fabsf( DotProduct( vert[0]->xyz, buildPlane->normal ) - buildPlane->dist ) >= distanceEpsilon ) {
continue;
}
if ( abs( DotProduct( vert[1]->xyz, buildPlane->normal ) - buildPlane->dist ) >= distanceEpsilon ) {
if ( fabsf( DotProduct( vert[1]->xyz, buildPlane->normal ) - buildPlane->dist ) >= distanceEpsilon ) {
continue;
}
if ( abs( DotProduct( vert[2]->xyz, buildPlane->normal ) - buildPlane->dist ) >= distanceEpsilon ) {
if ( fabsf( DotProduct( vert[2]->xyz, buildPlane->normal ) - buildPlane->dist ) >= distanceEpsilon ) {
continue;
}
// Okay. Correct surface type, correct shader, correct plane. Let's start with the business...
......
......@@ -109,4 +109,4 @@ int ExportEntitiesMain( int argc, char **argv ){
/* return to sender */
return 0;
}
\ No newline at end of file
}
......@@ -288,7 +288,7 @@ static void RadSample( int lightmapNum, bspDrawSurface_t *ds, rawLightmap_t *lm,
/* multiply by texture color */
if ( !RadSampleImage( si->lightImage->pixels, si->lightImage->width, si->lightImage->height, rw->verts[ samples ].st, textureColor ) ) {
VectorCopy( si->averageColor, textureColor );
textureColor[ 4 ] = 255.0f;
textureColor[ 3 ] = 255.0f;
}
for ( i = 0; i < 3; i++ )
color[ i ] = ( textureColor[ i ] / 255 ) * ( rw->verts[ samples ].color[ lightmapNum ][ i ] / 255.0f );
......@@ -372,7 +372,7 @@ static void RadSample( int lightmapNum, bspDrawSurface_t *ds, rawLightmap_t *lm,
/* multiply by texture color */
if ( !RadSampleImage( si->lightImage->pixels, si->lightImage->width, si->lightImage->height, st, textureColor ) ) {
VectorCopy( si->averageColor, textureColor );
textureColor[ 4 ] = 255;
textureColor[ 3 ] = 255;
}
for ( i = 0; i < 3; i++ )
color[ i ] = ( textureColor[ i ] / 255 ) * ( radLuxel[ i ] / 255 );
......
......@@ -1719,7 +1719,7 @@ void DirtyRawLightmap( int rawLightmapNum ){
static qboolean SubmapRawLuxel( rawLightmap_t *lm, int x, int y, float bx, float by, int *sampleCluster, vec3_t sampleOrigin, vec3_t sampleNormal ){
int i, *cluster, *cluster2;
float *origin, *origin2, *normal; //% , *normal2;
float *origin = NULL, *origin2 = NULL, *normal; //% , *normal2;
vec3_t originVecs[ 2 ]; //% , normalVecs[ 2 ];
......@@ -1744,9 +1744,13 @@ static qboolean SubmapRawLuxel( rawLightmap_t *lm, int x, int y, float bx, float
Sys_FPrintf( SYS_WRN, "WARNING: Spurious lightmap S vector\n" );
}
VectorSubtract( origin2, origin, originVecs[ 0 ] );
if (origin && origin2) {
VectorSubtract(origin2, origin, originVecs[0]);
}
//% VectorSubtract( normal2, normal, normalVecs[ 0 ] );
origin = origin2 = NULL;
/* calulate y vector */
if ( ( y < ( lm->sh - 1 ) && bx >= 0.0f ) || ( y == 0 && bx <= 0.0f ) ) {
cluster = SUPER_CLUSTER( x, y );
......@@ -1768,7 +1772,9 @@ static qboolean SubmapRawLuxel( rawLightmap_t *lm, int x, int y, float bx, float
Sys_FPrintf( SYS_WRN, "WARNING: Spurious lightmap T vector\n" );
}
VectorSubtract( origin2, origin, originVecs[ 1 ] );
if (origin && origin2) {
VectorSubtract(origin2, origin, originVecs[1]);
}
/* calculate new origin */
for ( i = 0; i < 3; i++ )
......
......@@ -677,7 +677,7 @@ int FloodEntities( tree_t *tree ){
inside = qfalse;
tree->outside_node.occupied = 0;
tripped = qfalse;
tripped = NULL;
c_floodedleafs = 0;
for ( i = 1; i < numEntities; i++ )
{
......
......@@ -627,7 +627,7 @@ typedef struct foliage_s
struct foliage_s *next;
char model[ MAX_QPATH ];
float scale, density, odds;
qboolean inverseAlpha;
int inverseAlpha;
}
foliage_t;
......
......@@ -719,7 +719,7 @@ void FinishShader( shaderInfo_t *si ){
/* determine error squared */
VectorSubtract( color, si->averageColor, delta );
delta[ 3 ] = color[ 3 ] - si->averageColor[ 3 ];
delta[ 3 ] = color[ 3 ] - 255;
dist = delta[ 0 ] * delta[ 0 ] + delta[ 1 ] * delta[ 1 ] + delta[ 2 ] * delta[ 2 ] + delta[ 3 ] * delta[ 3 ];
if ( dist < bestDist ) {
si->stFlat[ 0 ] = st[ 0 ];
......@@ -1272,7 +1272,7 @@ static void ParseShaderFile( const char *filename ){
else if ( !Q_stricmp( token, "sun" ) /* sof2 */ || !Q_stricmp( token, "q3map_sun" ) || !Q_stricmp( token, "q3map_sunExt" ) ) {
float a, b;
sun_t *sun;
qboolean ext;
qboolean ext = qfalse;
/* ydnar: extended sun directive? */
......
......@@ -987,8 +987,7 @@ void CreateEdge( vec4_t plane, vec3_t a, vec3_t b, edge_t *edge ){
edge->kingpinLength = edge->edge[ edge->kingpin ];
VectorNormalize( edge->edge, edge->edge );
edge->edge[ 3 ] = DotProduct( a, edge->edge );
edge->length = DotProduct( b, edge->edge ) - edge->edge[ 3 ];
edge->length = DotProduct( b, edge->edge ) - DotProduct( a, edge->edge );
/* create perpendicular plane that edge lies in */
CrossProduct( plane, edge->edge, edge->plane );
......