Commit Graph

871 Commits

Author SHA1 Message Date
Garux d82996d684 mbspc: fix q3 entities being loaded twice 2021-08-15 18:54:28 +03:00
Garux 1372ea440b more move semantics 2021-08-15 15:15:30 +03:00
Garux bb1931b745 * sort pk3s, so content of later (zzz) overrides earlier, like in radiant and engine
* fix strong performance penalty with large amount of files in pk3s
store pak file path once per pk3, not per each file inside
2021-08-13 03:20:07 +03:00
Garux 4beae3d362 * support entries with .shader extension in shaderlist.txt
vfsListShaderFiles (empty shaderlist = load all shaders, -pk3, -repack):
	only list pk3 .shaders from scripts/ folder
	support non scripts/ shaderPath (e.g. jka)
unlimit shader files count
case insensitive shaderlist entries, so duplicates aren't loaded twice
2021-08-12 11:23:59 +03:00
Garux aa5de2fee9 wrap winding_next logic
prevent crash in AddWindingToConvexHull()
2021-08-11 18:18:38 +03:00
Garux f492ab27eb more c++ in q3map2 2021-08-10 22:41:43 +03:00
Garux 99f4a4a767 minor tweaks 2021-08-03 20:54:21 +03:00
Garux 357f67f237 remove Q_EXTERN int numLights
remove /* potential pre-setup  */ :
1. it seems to never actually be the case
2. it is called from threaded functions, while SetupEnvelopes() itself is not thread safe
2021-08-03 18:26:47 +03:00
Garux f49639c697 std::list<light_t> lights 2021-08-03 07:28:53 +03:00
Garux a743668e44 prevent overflow in gridsize adjustment 2021-08-02 12:03:22 +03:00
Garux 15b391cdb3 minor tweaks 2021-08-02 00:47:18 +03:00
Garux e8996d0857 using facelist_t = std::forward_list<face_t> 2021-08-01 22:50:35 +03:00
Garux c3041cc2f8 using winding_t = std::vector<Vector3> 2021-07-31 18:28:38 +03:00
Garux dbfb22e273 using winding_accu_t = std::vector<DoubleVector3>; 2021-07-30 12:20:56 +03:00
Garux ffa1a4340c std::vector<plane_t> mapplanes 2021-07-29 22:21:36 +03:00
Garux ee92bdd801 minor tweaks 2021-07-27 22:16:05 +03:00
Garux 89b7bcdf53 * read .map brush plane points and store brush planes for windings calculation in double precision (fixes cracks between brush faces) 2021-07-27 20:04:35 +03:00
Garux 3c17f8fbc5 add MST_PLANAR and MST_TRIANGLE_SOUP counts to -info report 2021-07-22 17:32:58 +03:00
Garux 44907db895 Add KTX and ETC1 texture support by @Triang3l
https://github.com/xonotic/netradiant/pull/1
https://gitlab.com/xonotic/netradiant/-/issues/5

This pull request adds support for Khronos Textures to NetRadiant and Q3Map2, with OpenGL ES 2.0 formats, Ericsson Texture Compression version 1, and BGR/BGRA.

The patent-free Ericsson Texture Compression format will be used in the next version of Warsow to significantly reduce VRAM usage on mobile GPUs and the integrated GPU of Intel Broadwell.
2021-07-18 16:18:49 +03:00
Garux 0e4a4fdcf6 * fix _castShadows > 1: cast on world, as advertised 2021-07-02 16:50:01 +03:00
Garux 4697d7940c fix new gcc build error: ‘N’ is not a constant expression, while using offsetof 2021-06-22 20:49:42 +03:00
Garux 5b33fae202 fix clang error: variable-sized object may not be initialized 2021-06-21 17:07:03 +03:00
germangar 3b9b05d40e Undo changing to unsigned int for maxLMSurfaceVerts, maxSurfaceVerts and maxSurfaceIndexes. Restore qfusion.h long value 2021-06-03 22:28:29 +02:00
germangar 451f88efd7 Fix: Do not ignore game descriptor value for maxLMSurfaceVerts and keepLights
Use unsigned int for maxLMSurfaceVerts, maxSurfaceVerts and maxSurfaceIndexes
Fix: Out of bounds value at qfusion.h
2021-06-02 12:16:44 +02:00
Garux 6c00419653 fix spelling 2021-05-24 20:23:09 +03:00
Garux 5efe29d863 * use dynamic maxSurfaceVerts (user preference/game define) in 'force meta process for a surface' decision (was hardcoded) 2021-05-20 17:10:31 +03:00
Garux 31e7829e2b * support negative misc_model scale 2021-05-11 19:05:54 +03:00
Garux 427ef0874b * improve ase export compatibility
write normals after faces
write vertex normals right after their face normal
2021-05-08 14:15:17 +03:00
Garux 9eefda4fc5 * fix texturing, when origin key of group entity is set 2021-05-07 14:50:43 +03:00
Garux 75c7c09903 * replace model loaders by assimp library (40+ formats)
* auto split big model meshes to <= maxSurfaceVerts chunks (avoids excess meta process for vertexlit ones)
2021-05-07 14:47:39 +03:00
Garux 2222100316 indent classes, align by spaces 2021-03-24 00:25:15 +03:00
Garux c7fedadcd1 use std::vector for flagging in SmoothNormals()
functions run about 10% faster due to cheaper access to a flag
2021-03-13 11:16:07 +03:00
Garux 1d4424f4c6 minor tweaks 2021-03-12 01:17:01 +03:00
Garux 09c78ec0dc return Vector3 from vectorForKey() 2021-03-11 20:16:52 +03:00
Garux 1144be0881 add BasicVector3 uniform constructor 2021-03-11 19:14:07 +03:00
Garux 98f9023cdc minor tweaks 2021-03-11 10:57:17 +03:00
Garux 0cff77e30d consider "textures/system/" jka common folder during map decompilation 2021-03-09 20:13:42 +03:00
Garux 0737e962de use std::sort instead of qsort 2021-03-09 20:09:08 +03:00
Garux 52ef1c838a make sure to do VectorNormalize in double 2021-03-08 15:36:46 +03:00
Garux 858ec974f7 * -saturation light switch, default = 1, affects lightmaps and vertex color; > 1 = saturate, 0 = grayscale, < 0 = complementary colors 2021-03-08 13:34:58 +03:00
Garux ac1dd904f1 * print available games on wrong -game and -format args 2021-03-08 13:32:16 +03:00
Garux 293fab0ffb manage color-to-byte conversions 2021-03-05 13:37:56 +03:00
Garux bee749118f unify WindingExtendBounds logic 2021-03-05 06:15:48 +03:00
Garux 902fb46938 random tweaks 2021-03-04 16:11:00 +03:00
Garux b68cbfd78b clean ShiftBSPMain 2021-03-03 19:16:53 +03:00
Garux ce93fb3be8 * -help -game lists available games
std::size for help arrays
2021-03-03 17:30:55 +03:00
Garux 39c22acbae * case insensitive command line arguments 2021-03-03 07:54:16 +03:00
Garux 39f5a2d060 use MinMax functions instead of raw math 2021-03-03 07:01:28 +03:00
Garux f9a424b6c8 more c++ 2021-03-02 22:01:09 +03:00
Garux 9446aeca8e fix introduced problems 2021-02-28 12:04:52 +03:00
Garux 9857bb955b more c++ math 2021-02-26 01:10:51 +03:00
Garux 4ce944444d rewrite q3map2 math in c++ 2021-02-25 19:41:43 +03:00
Garux 820dd5e21f bump MAX_IMAGES, MAX_MODELS 2021-02-10 00:20:32 +03:00
Garux ba497e4139 SafeOpenWrite, SafeOpenRead funcs use 2021-02-09 18:05:06 +03:00
Garux 37c11990cb del struct StrBuf; CopiedString for mapShaderFile; 2021-02-09 13:03:48 +03:00
Garux b013f9954c simplify unlimited bsp entities code 2021-02-08 04:36:57 +03:00
Garux d5f55e7c35 safe strings in OnlyEnts() 2021-02-08 02:53:57 +03:00
Garux 92b2487875 fix string warnings 2021-02-08 01:33:36 +03:00
Garux ca34e8f38f enum class EFloodEntities 2021-02-07 07:34:57 +03:00
Garux a17bf05f5c more information in "StrList overflow" error 2021-02-07 07:23:46 +03:00
Garux 54f7daa887 more PathExtensionless use 2021-02-07 07:18:10 +03:00
Garux 5fd7b340df * discard excess portals in the void (great optimization for maps with void areas in between of playable areas and non rectangular maps)
(excess portals there are effect of _blocksize)
	* optimize FloodPortals() (also fix stack depth crash in debug mode due to recursive calls)
	* fix xml_Select() of leaked entity (was selecting last map entity always)
	* xml_Select() leaked entity exactly in the beginning of leak line
2021-02-06 22:22:59 +03:00
Garux e729f7b898 prevent stack overflow 2021-02-02 00:26:21 +03:00
Garux 2bf53ef643 fix overlook introduced in 36b63e1d2c 2021-01-30 16:50:40 +03:00
Garux 99a5ef0416 refactor entity key values routines 2021-01-30 16:23:31 +03:00
Garux 8425ce3c3e refactor foliage_t 2021-01-29 22:40:09 +03:00
Garux 762699287e refactor surfaceModel_t 2021-01-29 21:11:56 +03:00
Garux 276d1f5875 safe string in indexMap_t 2021-01-29 20:46:06 +03:00
Garux 40ab7fa26c remove excess string overflow checks, fix warnings 2021-01-29 05:14:33 +03:00
Garux b9d5f091e0 use fold expression, forwarding reference 2021-01-29 05:12:20 +03:00
Garux abc666ab7f use std::uint32_t in md4 2021-01-28 05:11:59 +03:00
Garux 623163ae9c remove unused markers 2021-01-28 02:12:15 +03:00
Garux e11aede11a refactor surfaceType_t enum 2021-01-27 19:43:53 +03:00
Garux 1efff8cdfe refactor enum vstatus_t 2021-01-27 11:53:32 +03:00
Garux 62a0ae5623 prevent string overflows 2021-01-26 22:31:19 +03:00
Garux 3ff224cbdf fix texture projection decompilation
in C this check was equal to
abs((int)dist) >= distanceEpsilon
comparing float dist to distanceEpsilon is not sufficient, as points are not precise enough, plus they are snapped
2021-01-25 08:36:16 +03:00
Garux d0dcce342b use LightFlags::FastActual shortcut 2021-01-25 07:29:46 +03:00
Garux bdfd864670 refactor enums
credits for class BitFlags go to Jelvan <3
2021-01-25 01:33:56 +03:00
Garux 7297e8758b remove unused light_shadows.cpp 2021-01-25 01:11:26 +03:00
Garux 20b908e31b remove excess typedef struct declarations 2021-01-23 19:26:50 +03:00
Garux 54c38610bf use std::list<epair_t> 2021-01-23 17:25:47 +03:00
Garux 36b63e1d2c turn entities array to std::vector<entity_t> 2021-01-23 15:39:42 +03:00
Garux b0e62198ba use safe strings more 2021-01-21 18:41:16 +03:00
Garux 0ab896b84a remove MAC_STATIC hack 2021-01-21 16:17:23 +03:00
Garux f3c26c791f use safe strings more 2021-01-21 16:08:53 +03:00
Garux 8b204ac054 add and use class PathExtensionless 2021-01-21 15:15:07 +03:00
Garux 7fc079c658 merge duplicated path_ functions
handle backslashes, which is out of convention, but safer, as practically paths may contain them in many spots
2021-01-21 08:53:34 +03:00
Garux 15e4b8e850 manage model shaders remapping 2021-01-21 07:19:15 +03:00
Garux fe5c0879b4 remove -tmpin & -tmpout switches, as at best they were prepending tmp/ to absolute path 2021-01-20 12:48:10 +03:00
Garux 3b39a5754d prevent filename overflow in model .skin loader
strip model extension during filename construction
add variadic template operator to StringOutputStream for inline strings creation
2021-01-20 11:59:16 +03:00
Garux cfa502df6e safe string for globalCelShader 2021-01-19 22:40:58 +03:00
Garux cbeccc7e3a use safe string in GetIndexedShader
fix custom shader overflow check
2021-01-19 22:12:53 +03:00
Garux c3437b7833 use safe strings in shaderInfo_s
turn ImageLoad() to expect extensionless path as input
2021-01-19 18:58:18 +03:00
Garux 9590d602d3 use String64 for shaderInfo_s::skyParmsImageBase
add variadic template operator to StringFixedSize for inline strings creation
2021-01-19 17:21:54 +03:00
Garux da3b05728c use safe string for shaderInfo_t.shader 2021-01-19 01:24:21 +03:00
Garux 3578370061 fix the build 2021-01-16 17:52:33 +03:00
Garux 13524d59ef fix the build 2021-01-16 15:10:59 +03:00
Garux fafa271a46 turn quake3 tools to cpp 2021-01-15 01:37:23 +03:00
Garux b2bc2077e5 prevent division by zero, which spreads darkness during bounces
source of the problem is located somewhere else
2021-01-05 01:34:55 +03:00
Garux e62c6f4bb3 fix warnings 2021-01-03 06:24:58 +03:00
Garux 3cbe922765 fix UB: fwrite with buffer = NULL 2021-01-01 17:42:08 +03:00
Garux d074634463 SetupGrid() after _ambient key read 2021-01-01 17:41:11 +03:00
Garux 97f0e61ccc initialize rawGridPoints.ambient correctly 2021-01-01 17:40:06 +03:00
Garux e1f3b25bc6 consider _decal in leak detection
point entities recognition is malformed in general
leak is about point entities, detection by origin key presence is weak, because there may exist entity w/o this key at 0 0 0
group entities may have origin too
detection by primitives presence haven't been working for _decal, as its primitive gets freed at this point
2020-12-14 08:36:55 +03:00
Garux db07c3459d * packer, repacker: handle nodraw patches correctly; warn on visible surface, having shader w/o maps (typically watercaulk) 2020-12-08 03:03:42 +03:00
Garux 5cedd26c75 * -repack -analyze switch: only analyze bsps and exit (to dump bsp resource calls) 2020-12-08 02:45:48 +03:00
Garux dd3db2f147 bump -repack bsp list size 2020-12-08 02:34:55 +03:00
Garux f30ee07376 * packer, repacker: also handle fogs without drawsurfaces 2020-11-25 10:29:49 +03:00
Garux d346f1ee07 packer, repacker: emit warning on "model2" key been found 2020-11-24 20:33:33 +03:00
Garux 06267e67cb repacker: fix odd WARNING3: %s : about to include shader for excluded texture
when repack.exclude has texture = shader from game.exclude
2020-11-24 19:59:51 +03:00
Garux 103ac6931e * fix -fixaas 2020-11-08 13:04:29 +03:00
Garux af71efc0e6 * no shaderlist.txt or empty one = load all shaders 2020-10-25 09:07:29 +03:00
Thomas Debesse 1cf7b72e6b q3map2/light_bounce: prevent infinite loop on obscure bias compute
New code produces same result without loop at all, so
it cannot fall in infinite loop, and it is faster in
use cases requiring more than one loop in previous code.

The Unvanquished vega map is known to trigger the bug:
https://github.com/UnvanquishedAssets/map-vega_src.dpkdir
I reproduced it multiple time on various hardware (8 core FX-9590,
12 core/24 thread Ryzen 9 3900X) with commit af40508 and using
final compilation profile edited to use -fastbounce instead
of -fast option.

The symptom is simple, q3map2 stucks there:

--- Radiosity (bounce 1 of 8) ---
--- RadCreateDiffuseLights ---
0...1...2...3..

Or somewhere else in that progression bar given your hardware
and the amount of core your CPU has.

When stuck, all the CPU cores are running 100% but the thread
never returns (a strace can reveals it, a gdb backtrace too).

Thanks to @slipher for the precious advices and improving my first
attempt to fix it.

For more information on the issue, I asked:

> which negative value never can become positive
> when incremented infinitely?

slipher said:

> for a double, any value less than -2^53 would have this property
> don't know for float off the top of my head

But then, it means that's theorically verified this loop was able
to run forever in some case.

I don't know what this code is doing anyway, but at least we can
keep the behaviour without requiring to understand it.
2020-08-19 08:32:36 +03:00
Garux 4bcce46a59 q3map2: -onlyents: support *.ent as map file param 2020-06-30 13:15:10 +03:00
Garux d8e8c10849 Add "slime" surfaceparam keyword to game_wolfet q3map2 for Quake 3 map shader compatibility.
#45
2020-06-30 12:55:52 +03:00
Garux ae9fe08159 * support -extlmhacksize N N input for non square lightmaps, for example -extlmhacksize 2048 1024
also enables this for -lightmapsize, legitimacy is questionable here
2020-06-14 15:49:16 +03:00
Garux 8cdce0e07c undo searching for q3map_<surfaceparm> removal in f560e2703b
#43
2020-06-06 12:31:18 +03:00
Garux 49b725a1b2 Fix q3 compatibility bug with lightgrid and only one light.
Correct math requires the ambient component of the lightgrid to be zero
in that case. However, q3 ignores lightgrid cells with all zero ambient
value, EVEN if the directed value is nonzero.

This change sets the ambient value to #010101 if it'd be pitch black. This
should be a minimal change without affecting light hue that fixes
lightgrid rendering. In engines like DarkPlaces, almost no map should
look different from this.

Fixes https://gitlab.com/xonotic/netradiant/-/issues/137
2020-04-18 09:16:57 +03:00
Garux ab80efd198 try to fix MAC compilation #40 2020-04-04 20:46:04 +03:00
Garux 85e5807397 try to fix MAC compilation #40 2020-04-04 19:40:56 +03:00
Garux 1a614efce1 q3map2 * fix: do not affect styled lightmaps by floodlight
port of https://github.com/id-tech-3-tools/map-compiler/pull/12
87b8589a3a
2020-03-25 21:21:07 +03:00
Garux 7fd32180e2 * support misc_model::_remap facility of q3map2
q3map2: fix inconsistency, introduced in d92c32d453
(_remap result could depend on _remap keys order, e.g. remapping src: moo/rock, moo/sand-rock by: rock, sand-rock suffix matches; rock could be used for moo/sand-rock)
2020-03-25 11:53:14 +03:00
Garux b136b1a829 mbspc: * deduce OutputFile path out of input file path in -bsp2map, -bsp2map220, -entlist, -texinfo modes (like for .aas)
* append _decompiled suffix to decompiled map file names
2020-02-29 04:03:12 +03:00
Garux 5a032a991a mbspc: make builtin, html help, command line options consistent
enable -grapplereach: bugged in vanilla engine, but is likely fixed in OpenArena
remove -onlyents doc: doesn't exist in the code (wtf)
2020-02-29 02:05:38 +03:00
Thomas Debesse 4292115ef7 bsp lump write: pad with zeros, not with random unitialized memory data 2020-02-13 05:39:39 +03:00
Garux 065c415839 nullify unused space of bspShaders.shader to write cleaner bsp 2020-02-13 05:12:57 +03:00
Garux 0b1389b5a4 rename entities in AddTriangleModels() for consistency 2020-02-12 23:30:46 +03:00
Garux c956102065 support variable number of key names in entity key value reading functions 2020-02-12 23:21:15 +03:00
Garux aa44982b20 define more architectures in mbspc -> q_platform.h, as we do not define them in Makefile 2020-02-11 18:46:41 +03:00
Garux 64f6b4a4ac fix some warnings 2020-02-07 23:00:19 +03:00
Garux 1805e42582 make C code to compile with -std=c11 (though still many implicit function declarations) 2020-02-07 22:45:06 +03:00
Garux 70b6cc8696 make C code ODR compliant (-fno-common) 2020-02-07 22:41:56 +03:00
Garux a1fe170f38 fix null pointer dereferencing introduced in 80e95ac165 2020-02-07 22:35:58 +03:00
Garux 433b9e776b manage entity key value reading routines 2020-02-07 15:49:29 +03:00
Garux 1f59dac119 manage strstr() use 2020-02-05 19:54:44 +03:00
Garux 325a46a102 wrap 'string empty' logic 2020-02-05 18:20:13 +03:00
Garux 234b0cf1d4 wrap strncmp use 2020-02-04 05:53:30 +03:00
Garux 9048028faa wrap Q_strncasecmp use 2020-02-04 05:08:54 +03:00
Garux c7f1391177 wrap Q_stricmp use 2020-02-04 04:33:58 +03:00
Garux 3409de2cb0 change EPAIR_STRCMP semantics 2020-02-04 03:50:33 +03:00
Garux cf98275ee4 wrap strcmp use 2020-02-04 03:40:27 +03:00
Garux 9485b925ff add common string functions 2020-02-04 03:38:24 +03:00
Garux 416b1f7d54 delete some unused q3 cmdlib stuff
fix q3data -writedir
2020-02-04 02:07:13 +03:00
Garux 0290bd76fe remove NeXT preprocessor conditions 2020-02-03 23:58:43 +03:00
Garux eb70faddc8 use standard C bool type:
get rid of qfalse, qtrue aliases everywhere
replace qboolean in q3map2, q3data
redefine qboolean type in q2 tools, mbspc
2020-02-03 01:15:30 +03:00
Garux e5d040a770 fix simple warnings 2020-02-02 14:53:18 +03:00
Garux b2eb13b049 manage windows only strlwr(), strupr() 2020-01-29 16:42:03 +03:00
Garux 9cb2ab691e del myoffsetof macro 2020-01-29 04:09:12 +03:00
Garux be007466f9 fix [-Wincompatible-pointer-types] in RunThreadsOn() 2020-01-28 21:35:17 +03:00
Garux c7010884b6 manage strlwr, strlower->strLower 2020-01-28 21:33:37 +03:00
Garux e6ce77d031 use capital letter in strClear, strEmpty, strIstr to lessen names collision probability 2020-01-28 21:05:41 +03:00
Garux a258ebf887 fix warning: comparison between signed and unsigned integer expressions 2020-01-28 00:29:53 +03:00
Garux 93eb360104 fix Usage: help strings 2020-01-27 23:41:46 +03:00
Garux 08fee05b37 remove odd closing parenthesis from bsp marker 2020-01-27 21:30:10 +03:00
Garux 25d94dbd2f add and use path_set_extension()
fix -bsp crash with .bsp sent as map path
	* fix: qer_editorimage, q3map_lightImage etc work with file names, containing period
(i.e. 'file.name.ext' names; don't StripExtension() twice in ImageLoad() for that)
2020-01-27 01:22:10 +03:00
Garux 80e95ac165 refactor paths related codes 2020-01-26 19:01:57 +03:00
Garux 437004713f fix q3data warnings 2020-01-24 17:02:46 +03:00
Garux 3a95f8bb53 use StripExtension() in q3data 2020-01-24 04:20:04 +03:00
Garux 09953b82be minor tweaks 2020-01-24 03:48:13 +03:00
Garux 854eb14a69 use path_get_extension() 2020-01-24 03:20:17 +03:00
Garux ba26c2d02b add common functions:
strempty
	strclear
	path_is_absolute
	path_get_filename_start
	path_get_filename_base_end
	path_get_extension
simplify functions:
	DefaultExtension
	StripFilename
	StripExtension
	ExtractFilePath
	ExtractFileBase
	ExtractFileExtension
2020-01-23 21:55:43 +03:00
Garux 0bc1a2a280 workaround safe_*alloc size print on error (was negative due to %i format specifier for size_t) 2020-01-23 07:25:12 +03:00
Garux 2d839e524f allocate just once in CopyBrushSidesLump() 2020-01-23 05:01:46 +03:00
Garux ad05e553b9 use realloc() instead of safe_malloc() + free()
add AUTOEXPAND_BY_REALLOC_ADD macro, use it
2020-01-23 05:01:44 +03:00
Garux e4eae18f5f use safe_malloc_info instead of unreachable code 2020-01-23 05:01:21 +03:00
Garux de8171f1ea use snprintf instead of strcpy, strcat 2020-01-22 00:03:16 +03:00
Garux 1c73baa8b9 don't check safe_malloc() result for NULL 2020-01-21 23:45:57 +03:00
Garux 3f8d708bc4 repackBSPMain(): do Error on bspList overflow 2020-01-20 19:46:19 +03:00
Garux d58454d718 repackBSPMain(): don't check for NULL before free()
reset counts (isn't required at the moment, just for potential safety)
2020-01-20 19:33:02 +03:00
Garux dfae69d446 don't check for NULL, while doing free() 2020-01-20 19:14:52 +03:00
Garux 67820df935 simplify phrasing in vsf.c 2020-01-20 17:49:44 +03:00
Garux bc8cc6e213 fix compilation in Linux (Q_stricmp was function before and was implicitly linked w/o direct inclusion)
remove platform dependent branching in q3data
2020-01-20 16:33:33 +03:00
Garux 7492d3d8c5 use memcpy in CopyWindingAccuIncreaseSizeAndFreeOld
rephrase ChopWindingInPlaceAccu::fineEpsilon
2020-01-13 12:43:18 +03:00
Garux 4d9a6cc2a9 const pointer in copy functions 2020-01-13 04:31:05 +03:00
Garux 5dc0244ef9 remove unused statistic variables 2020-01-13 00:39:55 +03:00
Garux a626907ba9 use offsetof( type, flexible_array_member[size] ) semantics 2020-01-13 00:37:44 +03:00
Garux 99bae99b36 add safe_calloc(), safe_calloc_info() functions, use them (optimization, code shortening) 2020-01-12 18:55:03 +03:00
Thomas Köppe 23a166a4dd Change winding_t, winding_accu_t and brush_t to use flexible array members rather than fixed-sized arrays.
The arrays were always meant to be variably sized, and objects are only ever allocated dynamically. Object size computations are simplified with this change.

Flexible arrays were introduced in C99, so this change means that we will require a C99-conforming compiler henceforth.
2020-01-12 01:32:43 +03:00
Thomas Köppe 1e2ccf5f06 Use standard "offsetof" facility rather than manual code involving null pointer dereferences. 2020-01-12 00:49:05 +03:00
Thomas Köppe 07c14c71a1 [unzip.c{,pp}] Change zc{alloc,free} to internal linkage 2020-01-11 20:29:10 +03:00
Thomas Köppe 78bc1dcec6 [q3map2] Unwind script stack in case of script loading error.
Also avoid type punning read into char* variable (even though char* and void* happen to be layout-compatible).
2020-01-11 20:16:26 +03:00
Garux d320ac3a4b optimize copystring(), use it 2020-01-10 20:43:15 +03:00
Garux d9bad45a3d emit error on shader name string overflow in ShaderInfoForShader instead of silent truncation 202a05461f 2020-01-09 20:30:21 +03:00
Zack Middleton 48444683ee q3map2: add missing help for q3map2 stage arguments
Move -keeplights help from -light stage to -bsp. Add other ~40 arguments
that were missing from help. My main focus was on the -convert stage
but I tried to document the rest as well. Some descriptions are copied
from message when enabling the option.
2019-12-28 12:40:14 +03:00
Zack Middleton c9a33917e3 q3map2: fix crash if command-line argument is missing
Running `q3map2 -fs_forbiddenpath -v mapname.map` would crash because
-v gets replaced with NULL in main().

Running `q3map2 -threads` would crash because missing next argument
for number of threads.
2019-12-28 12:06:36 +03:00
Zack Middleton 9c60ebea68 q3map2: fix not displaying default args for some q3map2 stages
Fix not displaying default arguments, and possibly segfaulting, when
running q3map2 -bsp, -analyze, -convert, -exportents, -export, or
-import.
2019-12-28 11:52:56 +03:00
Garux 19accfbbab fix Convert_ReferenceLightmaps() from 42ab06e363 2019-12-28 00:59:50 +03:00
Garux 48f3a19d87 repackBSPMain(): use StrBuf struct for shader dump (safer, faster) 2019-12-28 00:32:12 +03:00
Garux d0032126cd repackBSPMain(): use pointer to array of chars semantics for bspList 2019-12-27 14:07:40 +03:00
Garux 3b4f22ee32 use pushStringCallback in vfsListShaderFiles() 2019-12-27 09:07:55 +03:00
Garux 02fce47d00 add -complevel to -pk3 2019-12-27 07:32:54 +03:00
Garux 05be4d4936 add autopk3.c::packResource(), packTexture() 2019-12-27 07:28:18 +03:00
Garux 5d46d88d2d refactor autopk3.c
generalize Q_stricmp, Q_strncasecmp defines instead of local implementations
replace Q_strncpyz, Q_strcat, Q_strncat with strlcpy, strlcat versions: strcpyQ, strcatQ, strncatQ
fix ExtractFilePath, ExtractFileBase, ExtractFileExtension edge case (empty path string)
ExtractFileBase() : mimic StripExtension() logic
BeginMapShaderFile() : use 	ExtractFileBase(), 	ExtractFilePath()
2019-12-27 06:01:28 +03:00
Garux 8373782b75 generalize FixDOSName function and its use 2019-12-20 20:10:49 +03:00
Garux 3cbbbaf7e9 move main.c::pk3 business->autopk3.c 2019-12-20 20:05:42 +03:00
Garux 853633efd1 move main.c::FixAAS()->convert_bsp.c 2019-12-20 17:39:04 +03:00
Thomas Debesse 68f8cabf95 split bsp conversion stuff from q3map2 2019-12-20 08:02:06 +03:00
Thomas Debesse 27b1549a2d split minimap stuff from q3map2 2019-12-20 06:57:02 +03:00
Thomas Debesse 18d7d50444 [q3map2] unvanquished expects white minimap 2019-12-20 06:34:57 +03:00
Garux c401adfe3e * -brightness only affects lightmap brightness, like q3map_lightmapBrightness, as there are -vertexscale and -gridscale for the rest
is multipled with q3map_lightmapBrightness
2019-12-12 00:20:00 +03:00