diff options
author | danfe <danfe@FreeBSD.org> | 2016-03-30 14:41:55 +0800 |
---|---|---|
committer | danfe <danfe@FreeBSD.org> | 2016-03-30 14:41:55 +0800 |
commit | 8d050b0ab928172b570de3e13ade25ef79b49b43 (patch) | |
tree | 579a7984fa9d645cc7e10b35dcfd90ae29caae18 /games | |
parent | 56b05c5d3ec7c7ea7dc4aa202186439210fdbf3d (diff) | |
download | freebsd-ports-graphics-8d050b0ab928172b570de3e13ade25ef79b49b43.tar.gz freebsd-ports-graphics-8d050b0ab928172b570de3e13ade25ef79b49b43.tar.zst freebsd-ports-graphics-8d050b0ab928172b570de3e13ade25ef79b49b43.zip |
Add a port of Zoner's Half-Life compile tools, which offer many improvements
over the original map compiling tools for Half-Life.
WWW: http://zhlt.info/
Diffstat (limited to 'games')
-rw-r--r-- | games/Makefile | 1 | ||||
-rw-r--r-- | games/zhlt/Makefile | 32 | ||||
-rw-r--r-- | games/zhlt/distinfo | 2 | ||||
-rw-r--r-- | games/zhlt/files/Makefile | 79 | ||||
-rw-r--r-- | games/zhlt/files/patch-common_bspfile.h | 11 | ||||
-rw-r--r-- | games/zhlt/files/patch-common_cmdlib.cpp | 30 | ||||
-rw-r--r-- | games/zhlt/files/patch-common_mathlib.h | 46 | ||||
-rw-r--r-- | games/zhlt/files/patch-common_win32fix.h | 31 | ||||
-rw-r--r-- | games/zhlt/files/patch-hlrad_mathutil.cpp | 54 | ||||
-rw-r--r-- | games/zhlt/pkg-descr | 11 |
10 files changed, 297 insertions, 0 deletions
diff --git a/games/Makefile b/games/Makefile index 328e0021bbb..40b3ea9aaa8 100644 --- a/games/Makefile +++ b/games/Makefile @@ -1194,6 +1194,7 @@ SUBDIR += zatacka SUBDIR += zaz SUBDIR += zephulor + SUBDIR += zhlt SUBDIR += znibbles SUBDIR += zoom SUBDIR += ztrack diff --git a/games/zhlt/Makefile b/games/zhlt/Makefile new file mode 100644 index 00000000000..525055dd3ba --- /dev/null +++ b/games/zhlt/Makefile @@ -0,0 +1,32 @@ +# Created by: Alexey Dokuchaev <danfe@FreeBSD.org> +# $FreeBSD$ + +PORTNAME= zhlt +PORTVERSION= 3.4 +CATEGORIES= games devel +MASTER_SITES= http://downloads.ammahls.com/zhlt/Old%20SDK%20Code/ +DISTNAME= ${PORTNAME}${PORTVERSION:S/.//}f-src + +MAINTAINER= danfe@FreeBSD.org +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 + +MAKEFILE= ${FILESDIR}/Makefile +NO_WRKSUBDIR= yes + +PLIST_FILES= bin/hlbsp bin/hlcsg bin/hlrad bin/hlvis bin/ripent + +post-patch: + @${REINPLACE_CMD} -E 's,(min|max)\(,std::&,g' \ + ${WRKSRC}/common/boundingbox.h \ + ${WRKSRC}/common/filelib.cpp \ + ${WRKSRC}/common/winding.cpp \ + ${WRKSRC}/hlrad/lightmap.cpp \ + ${WRKSRC}/hlvis/flow.cpp + @${REINPLACE_CMD} -e 's,min(32,&L,' \ + ${WRKSRC}/common/filelib.cpp + +.include <bsd.port.mk> diff --git a/games/zhlt/distinfo b/games/zhlt/distinfo new file mode 100644 index 00000000000..84eded8297b --- /dev/null +++ b/games/zhlt/distinfo @@ -0,0 +1,2 @@ +SHA256 (zhlt34f-src.zip) = 17cce9227f825498f0ce2ba7a55a5f28229eedf9609aa59c029d533f6facab39 +SIZE (zhlt34f-src.zip) = 519205 diff --git a/games/zhlt/files/Makefile b/games/zhlt/files/Makefile new file mode 100644 index 00000000000..6b269b985ca --- /dev/null +++ b/games/zhlt/files/Makefile @@ -0,0 +1,79 @@ +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 + +common_OBJS= common/blockmem.o \ + common/bspfile.o \ + common/cmdlib.o \ + common/filelib.o \ + common/files.o \ + common/log.o \ + common/mathlib.o \ + common/messages.o \ + common/resourcelock.o \ + common/scriplib.o \ + common/threads.o \ + common/winding.o + +hlbsp_OBJ= hlbsp/merge.o \ + hlbsp/outside.o \ + hlbsp/portals.o \ + hlbsp/qbsp.o \ + hlbsp/solidbsp.o \ + hlbsp/surfaces.o \ + hlbsp/tjunc.o \ + hlbsp/writebsp.o + +hlcsg_OBJS= hlcsg/autowad.o \ + hlcsg/brush.o \ + hlcsg/brushunion.o \ + hlcsg/hullfile.o \ + hlcsg/map.o \ + hlcsg/netvis_in_vis.o \ + hlcsg/properties.o \ + hlcsg/qcsg.o \ + hlcsg/textures.o \ + hlcsg/wadcfg.o \ + hlcsg/wadinclude.o \ + hlcsg/wadpath.o + +hlrad_OBJS= hlrad/lerp.o \ + hlrad/lightmap.o \ + hlrad/mathutil.o \ + hlrad/nomatrix.o \ + hlrad/qrad.o \ + hlrad/qradutil.o \ + hlrad/sparse.o \ + hlrad/trace.o \ + hlrad/transfers.o \ + hlrad/transparency.o \ + hlrad/vismatrix.o \ + hlrad/vismatrixutil.o + +hlvis_OBJS= hlvis/flow.o \ + hlvis/vis.o \ + hlvis/zones.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) + +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) + +$(PROGS): + $(CXX) $(LDFLAGS) -o $@ $> -lpthread + +install: $(PROGS) + $(BSD_INSTALL_PROGRAM) $> $(DESTDIR)$(PREFIX)/bin + +.PHONY: all install diff --git a/games/zhlt/files/patch-common_bspfile.h b/games/zhlt/files/patch-common_bspfile.h new file mode 100644 index 00000000000..49fdfc8a69c --- /dev/null +++ b/games/zhlt/files/patch-common_bspfile.h @@ -0,0 +1,11 @@ +--- common/bspfile.h.orig 2016-03-30 06:24:01 UTC ++++ common/bspfile.h +@@ -155,7 +155,7 @@ dvertex_t; + + typedef struct + { +- float normal[3]; ++ vec3_t normal; + float dist; + planetypes type; // PLANE_X - PLANE_ANYZ ?remove? trivial to regenerate + } diff --git a/games/zhlt/files/patch-common_cmdlib.cpp b/games/zhlt/files/patch-common_cmdlib.cpp new file mode 100644 index 00000000000..673549d32fc --- /dev/null +++ b/games/zhlt/files/patch-common_cmdlib.cpp @@ -0,0 +1,30 @@ +--- common/cmdlib.cpp.orig 2016-03-30 06:24:01 UTC ++++ common/cmdlib.cpp +@@ -13,6 +13,9 @@ + #ifdef HAVE_SYS_STAT_H + #include <sys/stat.h> + #endif ++#ifdef HAVE_SYS_TIME_H ++#include <sys/time.h> ++#endif + #ifdef HAVE_FCNTL_H + #include <fcntl.h> + #endif +@@ -21,6 +24,8 @@ + #endif + #endif + ++#include <algorithm> ++ + #define PATHSEPARATOR(c) ((c) == '\\' || (c) == '/') + + /* +@@ -128,7 +133,7 @@ inline void getFilePositions(char* path, + else + { *extension_position = ptr - path; } + +- ptr = max(strrchr(path,'/'),strrchr(path,'\\')); ++ ptr = std::max(strrchr(path,'/'),strrchr(path,'\\')); + if(ptr == 0) + { *directory_position = -1; } + else diff --git a/games/zhlt/files/patch-common_mathlib.h b/games/zhlt/files/patch-common_mathlib.h new file mode 100644 index 00000000000..c4b59fb1450 --- /dev/null +++ b/games/zhlt/files/patch-common_mathlib.h @@ -0,0 +1,46 @@ +--- common/mathlib.h.orig 2016-03-30 06:24:01 UTC ++++ common/mathlib.h +@@ -12,20 +12,13 @@ + #endif + + #ifdef STDC_HEADERS ++#include <sys/limits.h> + #include <math.h> + #include <float.h> + #endif + + #include <algorithm> + +-#if !defined(max) +-#define max(a,b) (((a) > (b)) ? (a) : (b)) +-#endif +- +-#if !defined(min) +-#define min(a,b) (((a) < (b)) ? (a) : (b)) +-#endif +- + #define Q_PI 3.14159265358979323846 + + extern const vec3_t vec3_origin; +@@ -71,8 +64,8 @@ extern const vec3_t vec3_origin; + #define VectorCopy(a,b) { (b)[0]=(a)[0]; (b)[1]=(a)[1]; (b)[2]=(a)[2]; } + #define VectorClear(a) { (a)[0] = (a)[1] = (a)[2] = 0.0; } + +-#define VectorMaximum(a) ( max( (a)[0], max( (a)[1], (a)[2] ) ) ) +-#define VectorMinimum(a) ( min( (a)[0], min( (a)[1], (a)[2] ) ) ) ++#define VectorMaximum(a) ( std::max( (a)[0], std::max( (a)[1], (a)[2] ) ) ) ++#define VectorMinimum(a) ( std::min( (a)[0], std::min( (a)[1], (a)[2] ) ) ) + + #define VectorInverse(a) \ + { \ +@@ -88,8 +81,8 @@ extern const vec3_t vec3_origin; + (dest)[2] = (a)[2] + scale * (b)[2]; \ + } + #define VectorLength(a) sqrt((double) ((double)((a)[0] * (a)[0]) + (double)( (a)[1] * (a)[1]) + (double)( (a)[2] * (a)[2])) ) +-#define VectorCompareMinimum(a,b,c) { (c)[0] = min((a)[0], (b)[0]); (c)[1] = min((a)[1], (b)[1]); (c)[2] = min((a)[2], (b)[2]); } +-#define VectorCompareMaximum(a,b,c) { (c)[0] = max((a)[0], (b)[0]); (c)[1] = max((a)[1], (b)[1]); (c)[2] = max((a)[2], (b)[2]); } ++#define VectorCompareMinimum(a,b,c) { (c)[0] = std::min((a)[0], (b)[0]); (c)[1] = std::min((a)[1], (b)[1]); (c)[2] = std::min((a)[2], (b)[2]); } ++#define VectorCompareMaximum(a,b,c) { (c)[0] = std::max((a)[0], (b)[0]); (c)[1] = std::max((a)[1], (b)[1]); (c)[2] = std::max((a)[2], (b)[2]); } + + inline vec_t VectorNormalize(vec3_t v) + { diff --git a/games/zhlt/files/patch-common_win32fix.h b/games/zhlt/files/patch-common_win32fix.h new file mode 100644 index 00000000000..8835eb2afc3 --- /dev/null +++ b/games/zhlt/files/patch-common_win32fix.h @@ -0,0 +1,31 @@ +--- common/win32fix.h.orig 2016-03-30 06:24:01 UTC ++++ common/win32fix.h +@@ -5,7 +5,7 @@ + #pragma once + #endif + +-#include <malloc.h> ++#include <stdlib.h> + + ///////////////////////////// + #ifdef SYSTEM_WIN32 +@@ -50,6 +50,19 @@ + + #define INLINE inline + ++#define _close close ++#define _open open ++#define _read read ++#define _strdup strdup ++#define _strlwr strlwr ++#define _strupr strupr ++#define _unlink unlink ++ ++#define fscanf_s fscanf ++#define sprintf_s(str, ...) snprintf(str, sizeof(str), __VA_ARGS__) ++#define sscanf_s sscanf ++#define strcpy_s(dst, src) strlcpy(dst, src, sizeof(dst)) ++ + #endif + ///////////////////////////// + diff --git a/games/zhlt/files/patch-hlrad_mathutil.cpp b/games/zhlt/files/patch-hlrad_mathutil.cpp new file mode 100644 index 00000000000..1775a7578ec --- /dev/null +++ b/games/zhlt/files/patch-hlrad_mathutil.cpp @@ -0,0 +1,54 @@ +--- hlrad/mathutil.cpp.orig 2016-03-30 06:24:01 UTC ++++ hlrad/mathutil.cpp +@@ -20,7 +20,7 @@ inline bool PointInEdge(const vec_t* con + // PointInWall - check a lerpWall_t boundary + //=============================================== + +-inline bool PointInWall(const lerpWall_t* const wall, const vec_t* const point) ++bool PointInWall(const lerpWall_t* const wall, const vec_t* const point) + { + for(int counter = 0; counter < NUM_LERP_POINTS; counter++) + { +@@ -49,7 +49,7 @@ inline bool PointInWinding(const Winding + // PointInTri - check a boundary defined by 3 points + //================================================== + +-inline bool PointInTri(const vec_t* const point, const dplane_t* const plane, const vec_t* const p1, const vec_t* const p2, const vec_t* const p3) ++bool PointInTri(const vec_t* const point, const dplane_t* const plane, const vec_t* const p1, const vec_t* const p2, const vec_t* const p3) + { + return (PointInEdge(point,p1,p2,plane->normal) && PointInEdge(point,p2,p3,plane->normal) && PointInEdge(point,p3,p1,plane->normal)); + } +@@ -131,7 +131,7 @@ inline bool LineSegmentIntersectsFace(co + // point in point parameter if it exists + //================================================== + +-inline bool LineSegmentIntersectsPlane(const dplane_t& plane, const vec_t* const p1, const vec_t* const p2, vec3_t& point) ++bool LineSegmentIntersectsPlane(const dplane_t& plane, const vec_t* const p1, const vec_t* const p2, vec3_t& point) + { + vec3_t line; + VectorSubtract(p2,p1,line); +@@ -156,7 +156,7 @@ inline bool LineSegmentIntersectsPlane(c + // PlaneFromPoints + //================================================== + +-inline void PlaneFromPoints(const vec_t* const p1, const vec_t* const p2, const vec_t* const p3, dplane_t* plane) ++void PlaneFromPoints(const vec_t* const p1, const vec_t* const p2, const vec_t* const p3, dplane_t* plane) + { + vec3_t temp, temp2; + VectorSubtract(p3,p2,temp); +@@ -170,7 +170,7 @@ inline void PlaneFromPoints(const vec_t* + // SnapToPlane + //================================================== + +-inline void SnapToPlane(const dplane_t* const plane, vec_t* const point, const vec_t offset) ++void SnapToPlane(const dplane_t* const plane, vec_t* const point, const vec_t offset) + { + vec_t scale = (plane->dist + offset); + scale -= DotProduct(plane->normal,point); +@@ -243,4 +243,4 @@ int TestSegmentAgainstOpaqueList(const v + } + #endif + return -1; //not completely blocked +-} +\ No newline at end of file ++} diff --git a/games/zhlt/pkg-descr b/games/zhlt/pkg-descr new file mode 100644 index 00000000000..50b6ff18e5d --- /dev/null +++ b/games/zhlt/pkg-descr @@ -0,0 +1,11 @@ +Zoner's Half-Life compile tools offer many improvements over the original +map compiling tools for Half-Life, such as better lighting quality, faster +vis times, switchable texture based lighting, support for brush entities +casting shadows, removal of "sticky" edges, support for 64-bit processors, +and much more. + +Please note that these tools are for use with the Half-Life 1 engine (also +known as GoldSrc or GoldSource), not for the Source Engine used in Half- +Life 2. For the Source Engine, refer to Custom Source Tools (CST). + +WWW: http://zhlt.info/ |