Commit Graph

131 Commits

Author SHA1 Message Date
terminx 9cb68410a0 Engine memory reductions/optimizations:
-faketilesiz[MAXTILES] removed in favor of simple faketile[(MAXTILES+7)>>3] bitfield
-h_xsize/h_ysize (tile size overrides from .def) are now uint16_t instead of int32_t
-hudmem[2][MAXTILES] removed in favor of adding a hudmem ptr to mdmodel_t
-tilefromtexture performance improvements
-more tsectortype/twalltype usage in various engine functions that read but never write
-continued Polymost cleanups and refactors. Please report any odd rendering errors.

git-svn-id: https://svn.eduke32.com/eduke32@5079 1a8010ca-5511-0410-912e-c29ae57300e0
2015-03-24 00:40:48 +00:00
terminx aa4d98982c Large batch of Polymost changes, including:
-lots of stylistic rewrites
-further improvements to anti-fighting code for wall and floor sprites (introduces three new cvars, r_wspr_offset, r_wspr_offset_variance, and r_fspr_offset)
-fixed brief HOM when traversing through a one-way masked wall
-seldomly used "alphahack" feature for hightile textures now represents alpha cutoff internally as a single byte instead of a float
-fixes a handful of issues where geometry failed to draw at certain coordinates from certain angles in certain resolutions
-renames a couple of cvars

git-svn-id: https://svn.eduke32.com/eduke32@5075 1a8010ca-5511-0410-912e-c29ae57300e0
2015-03-24 00:40:33 +00:00
hendricks266 30669ab8ce Defs: When undefining a model, reset the angadd of its HUD settings to zero.
This fixes weapons not being displayed in Vaca+.

git-svn-id: https://svn.eduke32.com/eduke32@5053 1a8010ca-5511-0410-912e-c29ae57300e0
2015-03-09 07:37:23 +00:00
terminx 139276e6fe Polymost changes to better support running under GL ES. Still need to investigate GL_LINES and GL_QUADS... neither work under either GL -> GL ES wrapper we've tried, so we must be doing something wrong.
git-svn-id: https://svn.eduke32.com/eduke32@5001 1a8010ca-5511-0410-912e-c29ae57300e0
2015-02-11 05:23:04 +00:00
helixhorned b9834f9832 mdsprite.c: in md3load(), allocate m->head.surfs with Xcalloc, amending r4952.
And preventing enormous corruption due to a free() called on a garbage (malloc'd)
pointer values this time. DO_BUILD_VERY_FAST_PLEASE!

git-svn-id: https://svn.eduke32.com/eduke32@4980 1a8010ca-5511-0410-912e-c29ae57300e0
2015-02-10 19:51:15 +00:00
helixhorned 910716fa11 mdsprite.c: in md3free(), also free s->geometry for each surface. DONT_BUILD.
This prevents a enormous leak being reported by LeakSanitizer. Not that it
matters much, since we most frequently free models only at exit. (Sometimes one
may be freed earlier though -- if there was an error loading it, AFAICS.)

git-svn-id: https://svn.eduke32.com/eduke32@4952 1a8010ca-5511-0410-912e-c29ae57300e0
2015-02-05 16:30:09 +00:00
terminx 4911b9a949 Revise C++ structure trackers for performance and introduce "tspritetype", for temporary sprites or other usages where using the trackers would be invalid or undesired. DONT_BUILD.
git-svn-id: https://svn.eduke32.com/eduke32@4898 1a8010ca-5511-0410-912e-c29ae57300e0
2015-01-11 04:55:07 +00:00
terminx 16b617114c Replace hightile grayscale method (usually combined with tints to produce
replacements for the first handful of palette lookups) w8th superior
"luma" method. DONT_BUILD.

git-svn-id: https://svn.eduke32.com/eduke32@4889 1a8010ca-5511-0410-912e-c29ae57300e0
2015-01-11 04:51:41 +00:00
hendricks266 9d5a17c93e Eliminate -Wno-narrowing. DONT_BUILD.
git-svn-id: https://svn.eduke32.com/eduke32@4771 1a8010ca-5511-0410-912e-c29ae57300e0
2014-11-28 23:57:21 +00:00
helixhorned 112d650843 Fix POLYMER=0 build and a couple of unused-variable warnings with it. DONT_BUILD.
git-svn-id: https://svn.eduke32.com/eduke32@4764 1a8010ca-5511-0410-912e-c29ae57300e0
2014-11-25 23:46:28 +00:00
terminx 8934226bb2 Another 5000 lines of pain and tears. DONT_BUILD.
git-svn-id: https://svn.eduke32.com/eduke32@4680 1a8010ca-5511-0410-912e-c29ae57300e0
2014-10-25 03:36:34 +00:00
terminx 6c6b68d534 Various additional optimizations: add CLASSIC_SLICE_BY_4 mode to unroll some of the loops in a-c, replace integer divisions by a divisor unknown at compile time with usage of libdivide, clean up pragmas further by removing more old stuff that wasn't used anywhere. This is another one of those nasty commits that make people cry. DONT_BUILD.
git-svn-id: https://svn.eduke32.com/eduke32@4658 1a8010ca-5511-0410-912e-c29ae57300e0
2014-10-25 03:29:21 +00:00
terminx 020dc85fd0 Additional Polymost cleanup, attempt to fix enemy shadows (they are still not right)
git-svn-id: https://svn.eduke32.com/eduke32@4656 1a8010ca-5511-0410-912e-c29ae57300e0
2014-10-25 03:27:35 +00:00
terminx 3a60abfb94 Nuke MFLAGS_NOCONV, hoist a few conditions out of loops in Polymost model drawing
git-svn-id: https://svn.eduke32.com/eduke32@4653 1a8010ca-5511-0410-912e-c29ae57300e0
2014-10-25 03:26:46 +00:00
terminx 73ecabaff9 Fix z fighting issues with wall and floor sprites. This isn't perfect, and somebody like Plgman or Helixhorned who better understands how the depth buffer positions are calculated will be able to do a much better determination of how much to offset the glDepthRange values based on distance to the sprite.
git-svn-id: https://svn.eduke32.com/eduke32@4652 1a8010ca-5511-0410-912e-c29ae57300e0
2014-10-25 03:26:31 +00:00
terminx 4263626f97 Misc additional optimizations, mostly to polymost/mdsprite. Also separate voxmodel into its own source file and object. This commit is pretty large because I was hitting the limit of what could realistically be carved up into smaller patches. DONT_BUILD.
git-svn-id: https://svn.eduke32.com/eduke32@4639 1a8010ca-5511-0410-912e-c29ae57300e0
2014-09-30 04:18:43 +00:00
terminx 144a4798ce More Polymost cleanup, also consolidate tilesizx and tilesizy into a single tilesiz vec2_t to ensure both x and y are always in the same cache line. I may add a new vec2_16t later. Still need to take care of emulating the old flat array for the sake of CON access.
git-svn-id: https://svn.eduke32.com/eduke32@4623 1a8010ca-5511-0410-912e-c29ae57300e0
2014-09-30 04:14:21 +00:00
terminx 598876e411 Extra files for previous commits
git-svn-id: https://svn.eduke32.com/eduke32@4607 1a8010ca-5511-0410-912e-c29ae57300e0
2014-09-30 04:06:57 +00:00
hendricks266 a03f9bce40 Wrap most calls to exit() with a macro that will print the exit status, file name, line number, and function name to the log when using a debug build.
git-svn-id: https://svn.eduke32.com/eduke32@4502 1a8010ca-5511-0410-912e-c29ae57300e0
2014-06-13 09:02:37 +00:00
helixhorned 1e5549dc2f Polymost: r_npotwallmode, emulating 8-bit for walls w/ nonpow2 height textures.
When that mode is enabled (see below for caveats), wall textures that have a
non-power-of-two height (call it 'h') will be modified to look like in classic:
Let 'H' be the next power of two greater than 'h'. The texture will be uploaded
with height 'H', made up from 'h' hlines of the original texture, followed by
'H'-'h' first hlines of the same.
No panning "corrections" will take place. The mode is disabled by default.

Caveats/notes:
 * the mode requires that r_hightile is disabled
 * it is not implemented in Polymer
 * in the Lunatic build, it is ineffective when a VX map is loaded, as those
   display walls with NPOT height textures correctly

git-svn-id: https://svn.eduke32.com/eduke32@4498 1a8010ca-5511-0410-912e-c29ae57300e0
2014-06-01 11:55:19 +00:00
helixhorned 0900f4066c Bye, bye, B*alloc(), all hail X*alloc()! Replace large portion of the calls...
... and cull code that is dead with the X*alloc() versions since they never
return NULL on requesting memory.

Use something like
 git grep '[^Xx]\(m\|c\|re\)alloc *('
and
 git grep '[^Xx]strdup *('
to see places where I left the B*alloc() calls intact.

BUILD_LUNATIC.

git-svn-id: https://svn.eduke32.com/eduke32@4491 1a8010ca-5511-0410-912e-c29ae57300e0
2014-05-30 00:02:19 +00:00
helixhorned 89bbfcbdea Miscellaneous cleanup, still with the same suspects...
- in mdloadskin() and gloadtile_hi(), use new function check_nonpow2()
  (bit-twiddling) instead of loop
- Replace a couple of missed literals with CACHEAD_* enum labels

git-svn-id: https://svn.eduke32.com/eduke32@4488 1a8010ca-5511-0410-912e-c29ae57300e0
2014-05-28 22:40:19 +00:00
helixhorned 6fb9929f44 Factor out commonly occuring hictinting[]-accessing code into three functions.
Note: in polymer.c, this was buggy (but harmless) because .r is a char:
  if ((uint32_t)hictinting[MAXPALOOKUPS-1].r & 0xFFFFFF00) != 0xFFFFFF00)

git-svn-id: https://svn.eduke32.com/eduke32@4487 1a8010ca-5511-0410-912e-c29ae57300e0
2014-05-28 22:40:17 +00:00
helixhorned 69c867b8e3 Replace various GL rendering related literal flags with enum labels.
- pthtyp pth->flags bits
- Flags of the <dameth> argument of various functions
- hictinting[].f / gloadtile_hi() and daskinloader() <effect> arg bits
- hicreplctyp hicr->flags bits
- texcacheheader cachead.flags bits

git-svn-id: https://svn.eduke32.com/eduke32@4486 1a8010ca-5511-0410-912e-c29ae57300e0
2014-05-28 22:40:16 +00:00
helixhorned 2b583e9c9e gloadtex() cleanup, make some vars in kplib.c static, add source/valgrind_errors.log.
BUILD_LUNATIC.

git-svn-id: https://svn.eduke32.com/eduke32@4295 1a8010ca-5511-0410-912e-c29ae57300e0
2014-02-02 15:56:13 +00:00
helixhorned 7182f0a7f2 A couple of trivial changes.
git-svn-id: https://svn.eduke32.com/eduke32@4171 1a8010ca-5511-0410-912e-c29ae57300e0
2013-11-22 19:26:44 +00:00
helixhorned 161217a59a Polymer: in model preprocessing, implement cos/sin by table lookup.
This reduces the proportion of time the trig calculations take of the whole
preprocessing from 50% to about 13%.

git-svn-id: https://svn.eduke32.com/eduke32@4060 1a8010ca-5511-0410-912e-c29ae57300e0
2013-09-13 20:23:56 +00:00
helixhorned 694975b2f5 Polymost: make spriteext[].{x,y,z}off independent of xdimen/viewingrange/aspect.
The offsets (that will translate the axes for .pitch/.roll rotation) were
calculated improperly with screen sizes other than 1280 x 1024 and were
dependent on other related variables. The fix proceeded empirically, i.e. mostly
trial, error, and some educated guesswork. (It's telling that the magic constant
1280 is needed.)  A test for Lunatic is added to test.lua that will rotate
SEENINES.
Bug pointed out by Mblackwell.

git-svn-id: https://svn.eduke32.com/eduke32@4058 1a8010ca-5511-0410-912e-c29ae57300e0
2013-09-13 20:23:45 +00:00
helixhorned e71bc9d19d Polymost: fix 'zadd' DEF token handling. (Polymer has it right.)
git-svn-id: https://svn.eduke32.com/eduke32@3819 1a8010ca-5511-0410-912e-c29ae57300e0
2013-05-26 18:42:59 +00:00
terminx f8cc394fa3 Sanitize hard coded render mode numbers... replace all references to rendmode 0, 3, 4, etc with proper REND_CLASSIC, REND_POLYMOST, REND_POLYMER labels.
git-svn-id: https://svn.eduke32.com/eduke32@3784 1a8010ca-5511-0410-912e-c29ae57300e0
2013-05-17 03:44:09 +00:00
terminx 2e7803ab1d Unify glow and detail texture setup between polymost and mdsprite
git-svn-id: https://svn.eduke32.com/eduke32@3782 1a8010ca-5511-0410-912e-c29ae57300e0
2013-05-17 03:42:58 +00:00
helixhorned f72e571b18 Fix two possible signed left shift overflows.
git-svn-id: https://svn.eduke32.com/eduke32@3773 1a8010ca-5511-0410-912e-c29ae57300e0
2013-05-15 18:32:55 +00:00
terminx 08444cb825 WIP texture cache refactoring
git-svn-id: https://svn.eduke32.com/eduke32@3758 1a8010ca-5511-0410-912e-c29ae57300e0
2013-05-15 02:17:17 +00:00
hendricks266 1e7283f982 Fix a "duplicate const" error.
git-svn-id: https://svn.eduke32.com/eduke32@3672 1a8010ca-5511-0410-912e-c29ae57300e0
2013-04-13 03:50:57 +00:00
helixhorned 904a26e045 Clean up mdsprite.c:voxdraw() a little.
git-svn-id: https://svn.eduke32.com/eduke32@3589 1a8010ca-5511-0410-912e-c29ae57300e0
2013-03-21 10:20:14 +00:00
helixhorned 286cd692ec Clean up mdsprite.c:md3draw() by factoring out m->head.flags == 1337 check.
... into a macro MFLAGS_NOCONV(m). Since it currently expands to (0), some dead
code will be eliminated.
Introduce a "compilation option" macro DO_MD2_MD3_CONV in mdsprite.c.

git-svn-id: https://svn.eduke32.com/eduke32@3588 1a8010ca-5511-0410-912e-c29ae57300e0
2013-03-21 10:20:01 +00:00
helixhorned fdca2d232e Clean up mdsprite.c:md3draw() by factoring out spriteext[tspr->owner] access.
git-svn-id: https://svn.eduke32.com/eduke32@3587 1a8010ca-5511-0410-912e-c29ae57300e0
2013-03-21 10:19:55 +00:00
helixhorned 61f501c3fc Clean up mdsprite.c:md3draw() by tightening locals, factoring out 2x dup code.
git-svn-id: https://svn.eduke32.com/eduke32@3585 1a8010ca-5511-0410-912e-c29ae57300e0
2013-03-21 10:19:41 +00:00
helixhorned 182121a0aa engine: give sprite cstat 1024 a marco name, CSTAT_SPRITE_MDHACK.
git-svn-id: https://svn.eduke32.com/eduke32@3584 1a8010ca-5511-0410-912e-c29ae57300e0
2013-03-21 10:19:32 +00:00
hendricks266 7228700c87 Connect spriteext.alpha to models and voxels in Polymost.
This code is neat, tidy, organized, and sensical!

git-svn-id: https://svn.eduke32.com/eduke32@3553 1a8010ca-5511-0410-912e-c29ae57300e0
2013-03-04 07:49:27 +00:00
helixhorned 61d038f217 Split r3159..r3161, part 11: Add explicit casts, pointer types.
git-svn-id: https://svn.eduke32.com/eduke32@3177 1a8010ca-5511-0410-912e-c29ae57300e0
2012-11-15 14:28:36 +00:00
helixhorned 5ad385c043 Split r3159..r3161, part 10: add explicit casts to *alloc return values.
NOTE: changes such as these are best viewed with something like
git diff (...) --color-words='[a-zA-Z0-9_]+|[^[:space:]]'

git-svn-id: https://svn.eduke32.com/eduke32@3176 1a8010ca-5511-0410-912e-c29ae57300e0
2012-11-15 14:28:29 +00:00
helixhorned 1cd11d06ef Revert "Fix the warnings when building with C++, add MSVC C++ build support."
This reverts r3159..r3161.

Conflicts:
	eduke32/build/include/compat.h
(Handled so that r3163's changes are kept applied.)

git-svn-id: https://svn.eduke32.com/eduke32@3165 1a8010ca-5511-0410-912e-c29ae57300e0
2012-11-15 14:27:45 +00:00
hendricks266 9b57e0ea51 Address crash when model skins have invalid file names. Affected surfaces will not be drawn, but FPS will plummet as mdloadskin() is called repeatedly. A more optimal solution would either flag the surface as invalid (so the renderers skip it) or reject the entire model when defs are loaded.
http://forums.duke4.net/topic/6031-eduke32-crashes-if-hrp-model-skin-not-available/

git-svn-id: https://svn.eduke32.com/eduke32@3164 1a8010ca-5511-0410-912e-c29ae57300e0
2012-11-15 06:42:57 +00:00
terminx 3ff46c02b2 Fix the warnings when building with C++, add MSVC C++ build support. This also changes the internal type of lotags, hitags and cstat type fields to uint16_t instead of int16_t to clean up some dubious behavior wherein the code was using a value of 32768 as a flag in these fields for certain types of things, like invisible sprites (using the value as if it was uint16_t) where it was elsewhere checking if the value was < 0 (using the value as if it was int16_t). This change may break a few specific effects if any part of the relevant code was missed when looking for areas that needed to be addressed.
I think there's also a fix for the CON precache system breakage in here (lost it in my local tree when I started getting the C++ build working in MSVC, sorry!)


git-svn-id: https://svn.eduke32.com/eduke32@3159 1a8010ca-5511-0410-912e-c29ae57300e0
2012-11-14 23:32:43 +00:00
hendricks266 fcf9beae6a Work-in-progress adjustment to the C code to compile under C++. It builds for me without errors using Win32 MinGW-GCC, but it still generates warning soup. No guarantees about MSVC or anything using SDL. Enable C++ by building with CPLUSPLUS=1. C remains the default and should compile with no change in setup.
Credit to Plagman for the idea and doing the work on the game side, which is included in this commit.

(Building as C++ will give us features with which we can make improvements and optimizations on the multiplayer code and Polymer.)

git-svn-id: https://svn.eduke32.com/eduke32@3116 1a8010ca-5511-0410-912e-c29ae57300e0
2012-11-05 02:49:08 +00:00
helixhorned 28cc08a65f Fix two "may be used uninitialized" warnings (they can't, as far as I can see).
git-svn-id: https://svn.eduke32.com/eduke32@2937 1a8010ca-5511-0410-912e-c29ae57300e0
2012-08-19 13:02:47 +00:00
helixhorned df591aba1c mdsprite.c: factor out two instances of identical code.
git-svn-id: https://svn.eduke32.com/eduke32@2922 1a8010ca-5511-0410-912e-c29ae57300e0
2012-08-19 12:52:10 +00:00
Plagman 7e16357c68 Revert hightile factoring for now.
git-svn-id: https://svn.eduke32.com/eduke32@2825 1a8010ca-5511-0410-912e-c29ae57300e0
2012-07-11 04:39:01 +00:00
Plagman 5b887587f3 mdsprite: don't try to factor textures from fallback skins
git-svn-id: https://svn.eduke32.com/eduke32@2800 1a8010ca-5511-0410-912e-c29ae57300e0
2012-07-02 04:51:24 +00:00