Try to unbreak on 64-bit architectures by avoiding casting from pointer to
a smaller type (int) which loses information. Also, reduce imperativeness of the `files/Makefile' while at it. Reported by: pkg-fallout
This commit is contained in:
parent
72ea7e696b
commit
59f9e439a0
Notes:
svn2git
2021-03-31 03:12:20 +00:00
svn path=/head/; revision=412353
@ -12,7 +12,12 @@ COMMENT= Zoner's Half-Life compile tools
|
||||
|
||||
USES= dos2unix zip
|
||||
DOS2UNIX_FILES= common/bspfile.h common/cmdlib.cpp common/mathlib.h \
|
||||
common/win32fix.h hlrad/mathutil.cpp
|
||||
common/threads.cpp common/threads.h common/win32fix.h \
|
||||
hlbsp/qbsp.cpp hlcsg/brush.cpp hlcsg/brushunion.cpp \
|
||||
hlcsg/csg.h hlcsg/qcsg.cpp hlrad/lightmap.cpp \
|
||||
hlrad/mathutil.cpp hlrad/qrad.cpp hlrad/qrad.h \
|
||||
hlrad/sparse.cpp hlrad/vismatrix.cpp hlrad/vismatrixutil.cpp \
|
||||
hlvis/flow.cpp hlvis/vis.cpp hlvis/vis.h
|
||||
|
||||
MAKEFILE= ${FILESDIR}/Makefile
|
||||
NO_WRKSUBDIR= yes
|
||||
|
@ -1,7 +1,10 @@
|
||||
CXXFLAGS+= -Wall -Wextra
|
||||
CPPFLAGS+= -DSYSTEM_POSIX -DSTDC_HEADERS -DHAVE_SYS_RESOURCE_H \
|
||||
-DHAVE_SYS_STAT_H -DHAVE_SYS_TIME_H \
|
||||
-DHAVE_FCNTL_H -DHAVE_UNISTD_H -DDOUBLEVEC_T
|
||||
CXXFLAGS+= -Wall -Wextra
|
||||
.if $(ARCH:M*64)
|
||||
CPPFLAGS+= -DSIZEOF_CHARP=8
|
||||
.endif
|
||||
|
||||
common_OBJS= common/blockmem.o \
|
||||
common/bspfile.o \
|
||||
@ -16,7 +19,7 @@ common_OBJS= common/blockmem.o \
|
||||
common/threads.o \
|
||||
common/winding.o
|
||||
|
||||
hlbsp_OBJ= hlbsp/merge.o \
|
||||
hlbsp_OBJS= hlbsp/merge.o \
|
||||
hlbsp/outside.o \
|
||||
hlbsp/portals.o \
|
||||
hlbsp/qbsp.o \
|
||||
@ -57,18 +60,17 @@ hlvis_OBJS= hlvis/flow.o \
|
||||
|
||||
ripent_OBJS= ripent/ripent.o
|
||||
|
||||
PROGS= hlbsp/hlbsp hlcsg/hlcsg hlrad/hlrad hlvis/hlvis ripent/ripent
|
||||
|
||||
.cpp.o:
|
||||
$(CXX) $(CXXFLAGS) $(CPPFLAGS) -o $@ -c $< -Icommon -Itemplate
|
||||
|
||||
all: $(PROGS)
|
||||
all: # force default goal
|
||||
|
||||
hlbsp/hlbsp: $(common_OBJS) $(hlbsp_OBJ)
|
||||
hlcsg/hlcsg: $(common_OBJS) $(hlcsg_OBJS)
|
||||
hlrad/hlrad: $(common_OBJS) $(hlrad_OBJS)
|
||||
hlvis/hlvis: $(common_OBJS) $(hlvis_OBJS)
|
||||
ripent/ripent: $(common_OBJS) $(ripent_OBJS)
|
||||
.for p in hlbsp hlcsg hlrad hlvis ripent
|
||||
PROGS+= $(p)/$(p)
|
||||
$(p)/$(p): $(common_OBJS) $($(p)_OBJS)
|
||||
.endfor
|
||||
|
||||
all: $(PROGS)
|
||||
|
||||
$(PROGS):
|
||||
$(CXX) $(LDFLAGS) -o $@ $> -lpthread
|
||||
|
322
games/zhlt/files/patch-64bit-fixes
Normal file
322
games/zhlt/files/patch-64bit-fixes
Normal file
@ -0,0 +1,322 @@
|
||||
--- common/threads.cpp.orig 2016-04-01 13:18:21 UTC
|
||||
+++ common/threads.cpp
|
||||
@@ -180,7 +180,7 @@ q_threadfunction workfunction;
|
||||
#pragma warning(push)
|
||||
#pragma warning(disable: 4100) // unreferenced formal parameter
|
||||
#endif
|
||||
-static void ThreadWorkerFunction(int unused)
|
||||
+static void ThreadWorkerFunction(intptr_t unused)
|
||||
{
|
||||
int work;
|
||||
|
||||
@@ -499,7 +499,7 @@ q_threadfunction q_entry;
|
||||
|
||||
static void* CDECL ThreadEntryStub(void* pParam)
|
||||
{
|
||||
- q_entry((int)pParam);
|
||||
+ q_entry((intptr_t)pParam);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
--- common/threads.h.orig 2016-04-01 13:18:21 UTC
|
||||
+++ common/threads.h
|
||||
@@ -15,7 +15,7 @@ typedef enum
|
||||
}
|
||||
q_threadpriority;
|
||||
|
||||
-typedef void (*q_threadfunction) (int);
|
||||
+typedef void (*q_threadfunction) (intptr_t);
|
||||
|
||||
#ifdef SYSTEM_WIN32
|
||||
#define DEFAULT_NUMTHREADS -1
|
||||
--- hlbsp/qbsp.cpp.orig 2016-04-01 13:18:21 UTC
|
||||
+++ hlbsp/qbsp.cpp
|
||||
@@ -833,7 +833,7 @@ static surfchain_t* ReadSurfs(FILE* file
|
||||
// ProcessModelThreaded
|
||||
// time to compl
|
||||
// =====================================================================================
|
||||
-void ProcessModel(int modelnum)
|
||||
+void ProcessModel(intptr_t modelnum)
|
||||
{
|
||||
surfchain_t* surfs;
|
||||
node_t* nodes;
|
||||
--- hlcsg/brush.cpp.orig 2016-04-01 13:18:21 UTC
|
||||
+++ hlcsg/brush.cpp
|
||||
@@ -1075,7 +1075,7 @@ contents_t CheckBrushContents(const
|
||||
// CreateBrush
|
||||
// makes a brush!
|
||||
// =====================================================================================
|
||||
-void CreateBrush(const int brushnum)
|
||||
+void CreateBrush(const intptr_t brushnum)
|
||||
{
|
||||
brush_t* b;
|
||||
int contents;
|
||||
--- hlcsg/brushunion.cpp.orig 2016-04-01 13:18:21 UTC
|
||||
+++ hlcsg/brushunion.cpp
|
||||
@@ -252,7 +252,7 @@ static bool isInvalidHull(const brus
|
||||
return false;
|
||||
}
|
||||
|
||||
-void CalculateBrushUnions(const int brushnum)
|
||||
+void CalculateBrushUnions(const intptr_t brushnum)
|
||||
{
|
||||
int bn, hull;
|
||||
brush_t* b1;
|
||||
--- hlcsg/csg.h.orig 2016-04-01 13:18:21 UTC
|
||||
+++ hlcsg/csg.h
|
||||
@@ -190,7 +190,7 @@ extern int TexinfoForBrushTexture(c
|
||||
extern brush_t* Brush_LoadEntity(entity_t* ent, int hullnum);
|
||||
extern contents_t CheckBrushContents(const brush_t* const b);
|
||||
|
||||
-extern void CreateBrush(int brushnum);
|
||||
+extern void CreateBrush(intptr_t brushnum);
|
||||
|
||||
//=============================================================================
|
||||
// csg.c
|
||||
@@ -253,7 +253,7 @@ extern void HandleWadinclude();
|
||||
|
||||
//=============================================================================
|
||||
// brushunion.c
|
||||
-void CalculateBrushUnions(int brushnum);
|
||||
+void CalculateBrushUnions(intptr_t brushnum);
|
||||
|
||||
//============================================================================
|
||||
// hullfile.cpp
|
||||
--- hlcsg/qcsg.cpp.orig 2016-04-01 13:18:21 UTC
|
||||
+++ hlcsg/qcsg.cpp
|
||||
@@ -546,7 +546,7 @@ static bface_t* CopyFacesToOutside(brush
|
||||
// =====================================================================================
|
||||
// CSGBrush
|
||||
// =====================================================================================
|
||||
-static void CSGBrush(int brushnum)
|
||||
+static void CSGBrush(intptr_t brushnum)
|
||||
{
|
||||
int hull;
|
||||
brush_t* b1;
|
||||
@@ -1078,7 +1078,7 @@ static void ProcessModels()
|
||||
// =====================================================================================
|
||||
// SetModelCenters
|
||||
// =====================================================================================
|
||||
-static void SetModelCenters(int entitynum)
|
||||
+static void SetModelCenters(intptr_t entitynum)
|
||||
{
|
||||
int i;
|
||||
int last;
|
||||
--- hlrad/lightmap.cpp.orig 2016-04-01 13:18:21 UTC
|
||||
+++ hlrad/lightmap.cpp
|
||||
@@ -1786,7 +1786,7 @@ const vec3_t s_circuscolors[] = {
|
||||
// =====================================================================================
|
||||
// BuildFacelights
|
||||
// =====================================================================================
|
||||
-void BuildFacelights(const int facenum)
|
||||
+void BuildFacelights(const intptr_t facenum)
|
||||
{
|
||||
dface_t* f;
|
||||
vec3_t sampled[MAXLIGHTMAPS];
|
||||
@@ -2206,7 +2206,7 @@ void PrecompLightmapOffsets()
|
||||
// FinalLightFace
|
||||
// Add the indirect lighting on top of the direct lighting and save into final map format
|
||||
// =====================================================================================
|
||||
-void FinalLightFace(const int facenum)
|
||||
+void FinalLightFace(const intptr_t facenum)
|
||||
{
|
||||
int i, j, k;
|
||||
vec3_t lb, v;
|
||||
--- hlrad/qrad.cpp.orig 2016-04-01 13:18:21 UTC
|
||||
+++ hlrad/qrad.cpp
|
||||
@@ -1506,7 +1506,7 @@ static void CollectLight()
|
||||
#pragma warning(push)
|
||||
#pragma warning(disable: 4100) // unreferenced formal parameter
|
||||
#endif
|
||||
-static void GatherLight(int threadnum)
|
||||
+static void GatherLight(intptr_t threadnum)
|
||||
{
|
||||
int j;
|
||||
patch_t* patch;
|
||||
@@ -1628,7 +1628,7 @@ static void GatherLight(int threadnu
|
||||
|
||||
// RGB Transfer version
|
||||
#ifdef HLRAD_HULLU
|
||||
-static void GatherRGBLight(int threadnum)
|
||||
+static void GatherRGBLight(intptr_t threadnum)
|
||||
{
|
||||
int j;
|
||||
patch_t* patch;
|
||||
--- hlrad/qrad.h.orig 2016-04-01 13:18:21 UTC
|
||||
+++ hlrad/qrad.h
|
||||
@@ -432,9 +432,9 @@ extern float g_softlight_hack_distance;
|
||||
|
||||
extern void MakeTnodes(dmodel_t* bm);
|
||||
extern void PairEdges();
|
||||
-extern void BuildFacelights(int facenum);
|
||||
+extern void BuildFacelights(intptr_t facenum);
|
||||
extern void PrecompLightmapOffsets();
|
||||
-extern void FinalLightFace(int facenum);
|
||||
+extern void FinalLightFace(intptr_t facenum);
|
||||
extern int TestLine(const vec3_t start, const vec3_t stop);
|
||||
extern int TestLine_r(int node, const vec3_t start, const vec3_t stop);
|
||||
extern void CreateDirectLights();
|
||||
@@ -468,12 +468,12 @@ extern bool readtransfers(const char
|
||||
extern void writetransfers(const char* const transferfile, long total_patches);
|
||||
|
||||
// vismatrixutil.c (shared between vismatrix.c and sparse.c)
|
||||
-extern void SwapTransfers(int patchnum);
|
||||
-extern void MakeScales(int threadnum);
|
||||
+extern void SwapTransfers(intptr_t patchnum);
|
||||
+extern void MakeScales(intptr_t threadnum);
|
||||
extern void DumpTransfersMemoryUsage();
|
||||
#ifdef HLRAD_HULLU
|
||||
-extern void SwapRGBTransfers(int patchnum);
|
||||
-extern void MakeRGBScales(int threadnum);
|
||||
+extern void SwapRGBTransfers(intptr_t patchnum);
|
||||
+extern void MakeRGBScales(intptr_t threadnum);
|
||||
|
||||
// transparency.c (transparency array functions - shared between vismatrix.c and sparse.c)
|
||||
extern void GetTransparency(const unsigned p1, const unsigned p2, vec3_t &trans, unsigned int &next_index);
|
||||
--- hlrad/sparse.cpp.orig 2016-04-01 13:18:21 UTC
|
||||
+++ hlrad/sparse.cpp
|
||||
@@ -339,7 +339,7 @@ static void BuildVisRow(const int pa
|
||||
#pragma warning(push)
|
||||
#pragma warning(disable: 4100) // unreferenced formal parameter
|
||||
#endif
|
||||
-static void BuildVisLeafs(int threadnum)
|
||||
+static void BuildVisLeafs(intptr_t threadnum)
|
||||
{
|
||||
int i;
|
||||
int lface, facenum, facenum2;
|
||||
--- hlrad/vismatrix.cpp.orig 2016-04-01 13:18:21 UTC
|
||||
+++ hlrad/vismatrix.cpp
|
||||
@@ -151,7 +151,7 @@ static void BuildVisRow(const int pa
|
||||
#pragma warning(push)
|
||||
#pragma warning(disable: 4100) // unreferenced formal parameter
|
||||
#endif
|
||||
-static void BuildVisLeafs(int threadnum)
|
||||
+static void BuildVisLeafs(intptr_t threadnum)
|
||||
{
|
||||
int i;
|
||||
int lface, facenum, facenum2;
|
||||
--- hlrad/vismatrixutil.cpp.orig 2016-04-01 13:18:21 UTC
|
||||
+++ hlrad/vismatrixutil.cpp
|
||||
@@ -190,7 +190,7 @@ static transfer_index_t* CompressTransfe
|
||||
#pragma warning(push)
|
||||
#pragma warning(disable: 4100) // unreferenced formal parameter
|
||||
#endif
|
||||
-void MakeScales(const int threadnum)
|
||||
+void MakeScales(const intptr_t threadnum)
|
||||
{
|
||||
int i;
|
||||
unsigned j;
|
||||
@@ -391,7 +391,7 @@ void MakeScales(const int thr
|
||||
* they will actually be rather different.
|
||||
* =============
|
||||
*/
|
||||
-void SwapTransfers(const int patchnum)
|
||||
+void SwapTransfers(const intptr_t patchnum)
|
||||
{
|
||||
patch_t* patch = &g_patches[patchnum];
|
||||
transfer_index_t* tIndex = patch->tIndex;
|
||||
@@ -456,7 +456,7 @@ void SwapTransfers(const int
|
||||
#pragma warning(push)
|
||||
#pragma warning(disable: 4100) // unreferenced formal parameter
|
||||
#endif
|
||||
-void MakeRGBScales(const int threadnum)
|
||||
+void MakeRGBScales(const intptr_t threadnum)
|
||||
{
|
||||
int i;
|
||||
unsigned j;
|
||||
@@ -678,7 +678,7 @@ void MakeRGBScales(const int
|
||||
* they will actually be rather different.
|
||||
* =============
|
||||
*/
|
||||
-void SwapRGBTransfers(const int patchnum)
|
||||
+void SwapRGBTransfers(const intptr_t patchnum)
|
||||
{
|
||||
patch_t* patch = &g_patches[patchnum];
|
||||
transfer_index_t* tIndex = patch->tIndex;
|
||||
--- hlvis/flow.cpp.orig 2016-04-01 13:18:21 UTC
|
||||
+++ hlvis/flow.cpp
|
||||
@@ -678,7 +678,7 @@ static void SimpleFlood(byte* const
|
||||
// =====================================================================================
|
||||
// BlockVis
|
||||
// =====================================================================================
|
||||
-void BlockVis(int unused)
|
||||
+void BlockVis(intptr_t unused)
|
||||
{
|
||||
int i, j, k, l, m;
|
||||
portal_t *p;
|
||||
@@ -1156,7 +1156,7 @@ static float CalcSplitsAndDotProducts(p
|
||||
// =====================================================================================
|
||||
// BasePortalVis
|
||||
// =====================================================================================
|
||||
-void BasePortalVis(int unused)
|
||||
+void BasePortalVis(intptr_t unused)
|
||||
{
|
||||
int i, j, k;
|
||||
portal_t* tp;
|
||||
@@ -1242,7 +1242,7 @@ void BasePortalVis(int unused
|
||||
// =====================================================================================
|
||||
// MaxDistVis
|
||||
// =====================================================================================
|
||||
-void MaxDistVis(int unused)
|
||||
+void MaxDistVis(intptr_t unused)
|
||||
{
|
||||
int i, j, k, m;
|
||||
int a, b, c, d;
|
||||
--- hlvis/vis.cpp.orig 2016-04-01 13:18:21 UTC
|
||||
+++ hlvis/vis.cpp
|
||||
@@ -213,14 +213,14 @@ static void PlaneFromWinding(winding
|
||||
static winding_t* NewWinding(const int points)
|
||||
{
|
||||
winding_t* w;
|
||||
- int size;
|
||||
+ intptr_t size;
|
||||
|
||||
if (points > MAX_POINTS_ON_WINDING)
|
||||
{
|
||||
Error("NewWinding: %i points > MAX_POINTS_ON_WINDING", points);
|
||||
}
|
||||
|
||||
- size = (int)((winding_t*)0)->points[points];
|
||||
+ size = (intptr_t)((winding_t*)0)->points[points];
|
||||
w = (winding_t*)calloc(1, size);
|
||||
|
||||
return w;
|
||||
@@ -463,7 +463,7 @@ void CompressAll(void)
|
||||
#endif
|
||||
|
||||
#ifndef ZHLT_NETVIS
|
||||
-static void LeafThread(int unused)
|
||||
+static void LeafThread(intptr_t unused)
|
||||
{
|
||||
portal_t* p;
|
||||
|
||||
@@ -483,7 +483,7 @@ static void LeafThread(int unused)
|
||||
|
||||
#ifdef ZHLT_NETVIS
|
||||
|
||||
-static void LeafThread(int unused)
|
||||
+static void LeafThread(intptr_t unused)
|
||||
{
|
||||
if (g_vismode == VIS_MODE_CLIENT)
|
||||
{
|
||||
--- hlvis/vis.h.orig 2016-04-01 13:18:21 UTC
|
||||
+++ hlvis/vis.h
|
||||
@@ -184,14 +184,14 @@ extern volatile int g_vislocalpercent;
|
||||
|
||||
extern Zones* g_Zones;
|
||||
|
||||
-extern void BasePortalVis(int threadnum);
|
||||
+extern void BasePortalVis(intptr_t threadnum);
|
||||
|
||||
|
||||
#ifdef HLVIS_MAXDIST // AJM: MVD
|
||||
extern visblocker_t *GetVisBlock(char *name);
|
||||
-extern void BlockVis(int unused);
|
||||
-extern void MaxDistVis(int threadnum);
|
||||
-//extern void PostMaxDistVis(int threadnum);
|
||||
+extern void BlockVis(intptr_t unused);
|
||||
+extern void MaxDistVis(intptr_t threadnum);
|
||||
+//extern void PostMaxDistVis(intptr_t threadnum);
|
||||
#endif
|
||||
|
||||
extern void PortalFlow(portal_t* p);
|
Loading…
Reference in New Issue
Block a user