Commit Graph

776 Commits

Author SHA1 Message Date
helixhorned 7e6f712ad1 more internal cleanup...
the only visible change is that polymost_trytexcache (formerly two
instances of nearly duplicate code) now prints a diagnostic after
a cache miss.  The one that one is most likely to encounter is
"r_downsize doesn't match", meaning that this setting likely differs
between Mapster and the game.

git-svn-id: https://svn.eduke32.com/eduke32@2248 1a8010ca-5511-0410-912e-c29ae57300e0
2012-01-12 20:47:41 +00:00
helixhorned e3150b2801 a couple more trivial tweaks
git-svn-id: https://svn.eduke32.com/eduke32@2247 1a8010ca-5511-0410-912e-c29ae57300e0
2012-01-10 23:45:34 +00:00
helixhorned fa6f2d9ca2 md4.c/h: add consts to appropriate arguments
git-svn-id: https://svn.eduke32.com/eduke32@2246 1a8010ca-5511-0410-912e-c29ae57300e0
2012-01-10 23:45:08 +00:00
helixhorned 3095b09773 trivial formatting / removing of old cruft / adding comments
git-svn-id: https://svn.eduke32.com/eduke32@2244 1a8010ca-5511-0410-912e-c29ae57300e0
2012-01-10 23:44:35 +00:00
helixhorned 6a37636bb0 Possibility of specifying sounds for a VPX anim-replacement via DEF.
The syntax is as follows:
  animsounds <anim> { frame1 sound1  frame2 sound2 ... }

<anim> has to be one of the tokens: cineov2, cineov3, RADLOGO, DUKETEAM,
logo, vol41a, vol42a, vol4e1, vol43a, vol4e2, or vol4e3, corresponding
to hard-coded Duke3D anims.

The frameN's (1-based frame numbers) have to be in ascending order (but not
necessarily strictly ascending, so that a frame may have more than one sound).

Example: for Duke3D's XBLA nuke logo animation (IVF extracted from nuke.webm),
the following definition overlays the video with a sound sequence similar
(identical save for timing) to the original nuke animation:

// frame 1: FLY_BY, frame 64: PIPEBOMB_EXPLODE
animsounds logo { 1 244  64 14 }

git-svn-id: https://svn.eduke32.com/eduke32@2242 1a8010ca-5511-0410-912e-c29ae57300e0
2012-01-10 23:43:54 +00:00
helixhorned a86dfe661b maint: make the following static in polymost.c:
- texcacheindex *firstcacheindex, *curcacheindex
 - trytexcache(), gloadtile_cached()
- Factor out duplicated code into clear_cache_internal()

git-svn-id: https://svn.eduke32.com/eduke32@2240 1a8010ca-5511-0410-912e-c29ae57300e0
2012-01-10 23:43:18 +00:00
helixhorned 114d8e4a36 When defining a model with the 'model' token and there were errors, don't
let it hang around causing trouble later on; delete it right now and inform
the user.
Add a couple of 'static's to some functions and file scope data in mdsprite.c

git-svn-id: https://svn.eduke32.com/eduke32@2237 1a8010ca-5511-0410-912e-c29ae57300e0
2012-01-07 17:48:55 +00:00
helixhorned b926e2a496 - When saving game, clear all polymer lights before. Not doing this makes
the SE ones douple, triple, ... after each save.  Maphack lights are reloaded
with polymer_resetlights() (though I've had them disappearing after load, I
couldn't reproduce it afterwards).
- in debugging builds, print a message when polymer_resetlight is called on a
nonexistent one.  The problem is not so much the call itself (it's guarded),
but the fact that resources on the caller side may not have been freed if it
thinks that those lights do in fact exist. Right now, it's not the case though.
- add 'loaded map hack' messages after some other successful loadmaphack calls

git-svn-id: https://svn.eduke32.com/eduke32@2236 1a8010ca-5511-0410-912e-c29ae57300e0
2012-01-05 21:58:23 +00:00
helixhorned 76d210c4b8 Patch up access of malloc'd buffer one byte beyond its size in kplib's
JPEG decoder (unearthed by valgrind).

git-svn-id: https://svn.eduke32.com/eduke32@2231 1a8010ca-5511-0410-912e-c29ae57300e0
2012-01-03 19:55:55 +00:00
hendricks266 e9aec2a65b Comment ldcty[12] array from kpegrend() to remove last of set-but-unused warnings. I don't see any reason to leave this alone.
git-svn-id: https://svn.eduke32.com/eduke32@2228 1a8010ca-5511-0410-912e-c29ae57300e0
2012-01-01 04:12:37 +00:00
helixhorned 8ec15480c0 Besides the performance issues, there's another reason why changing the palette
'frequently' isn't such a good idea.  Assume an actor constantly changes the
palette to some value and you're attacked by a newbeast at the same time. Then
the pain tinting would be reset each time the actor's code is run.  This commit
adds a new flag 16 to setbrightness(), meaning "don't reset the fade tinting".
Its only use right now is from CON's setgamepalette command (and there, always).
The change is done in the engine and thus affects all platforms.

git-svn-id: https://svn.eduke32.com/eduke32@2225 1a8010ca-5511-0410-912e-c29ae57300e0
2011-12-28 20:36:01 +00:00
helixhorned d5a934f9ba Trivial tweaks of setbrightness. Add an assertion that bits 1 and 4 are clear,
mainly.  Also remove setvgapalette() from source.

git-svn-id: https://svn.eduke32.com/eduke32@2224 1a8010ca-5511-0410-912e-c29ae57300e0
2011-12-28 20:35:44 +00:00
helixhorned 92e5d8214d SDL layer: don't call SDL_SetGammaRamp() if there would be no change.
This is in the similar vein as the set-palette deferring and it's this
that fixes the low FPS in the radioactively contaminated area in AMC TC:
Megabase (since setgamma() is called from setbrightness()).

Again, update issues might be expected, but changing focus between EDuke32
and the desktop and back seems to restore the gamma settings properly on
Kubuntu. Looks like X (or whatever above handles this stuff) maintains it
on a per-application basis.

git-svn-id: https://svn.eduke32.com/eduke32@2222 1a8010ca-5511-0410-912e-c29ae57300e0
2011-12-28 20:34:57 +00:00
helixhorned 4ae50ef22a SDL layer: in 8-bit mode, defer setting the palette until showing the next frame.
CON code sometimes uses 'setgamepalette' from withing actors, which is a bit too
frequent.  Deferring the actual palette updating means that multiple requests in
between two screen redraws are coalesced into one, which is desirable for
performance reasons and for the reduction of 'tearing' artefacts (but not
prevention, since the drawing isn't synced to the screen refresh rate with
vsync off).

(Did-not-)update issues might be introduced.

Windows isn't touched because
 - I expect it to be more brittle, especially in light of the ATI HW gamma
   problems.
 - I haven't tested whether the particular performance penalty that lead to this
   change ('gas' in AMC TC) exists there too

git-svn-id: https://svn.eduke32.com/eduke32@2221 1a8010ca-5511-0410-912e-c29ae57300e0
2011-12-28 20:34:41 +00:00
helixhorned 9e1399ec14 screenshots: remove the old inversion and PCX code from the source
git-svn-id: https://svn.eduke32.com/eduke32@2220 1a8010ca-5511-0410-912e-c29ae57300e0
2011-12-28 20:34:26 +00:00
helixhorned 98bcc0e60c screenshots: if compiled with USE_LIBPNG, always use PNG, even for
color-inversed shots. For both PNG and TGA, change the way they're
done in 8-bit mode: instead of XORing every byte with 15, save the
inverse palette (each component taken 255-x).

git-svn-id: https://svn.eduke32.com/eduke32@2219 1a8010ca-5511-0410-912e-c29ae57300e0
2011-12-28 20:34:10 +00:00
helixhorned 7c245875cb engine: make smoststart[] (which saves starting "smostcnt"s) an array of int32's
instead of shorts. This fixes their values' overflow in AMC TC megabase and
probably a couple of other large maps.

git-svn-id: https://svn.eduke32.com/eduke32@2216 1a8010ca-5511-0410-912e-c29ae57300e0
2011-12-27 14:22:45 +00:00
helixhorned b30711586b patch up another out-of-bounds access in the voxel drawing code, though
I'm not sure whether the increased array size is enough.

git-svn-id: https://svn.eduke32.com/eduke32@2213 1a8010ca-5511-0410-912e-c29ae57300e0
2011-12-26 15:44:09 +00:00
helixhorned b3474c75b2 Rewrite the savegame format in terms of the generic saving/loading system.
This makes savegames practically the same as the initial snapshot of a demo.
Saves are now named 'dukesavX.esv' (demos: 'edemoX.edm').
Additionally, many changes that couldn't/needn't be cleanly separated are added
with this commit:
 - make spriteext_t have the same size across 32/64 bit platforms (actor_t partially)
 - prevent saving/loading in MP games (it certainly didn't work and still doesn't)
 - it's time we start using assertions! Define NDEBUG for releasse builds.
 - reset savegame major and minor versions (we have a new magic string, so no conflict)

git-svn-id: https://svn.eduke32.com/eduke32@2207 1a8010ca-5511-0410-912e-c29ae57300e0
2011-12-25 15:34:06 +00:00
helixhorned 9f2153d0ea Beauty tweaks; revert s_buildDate since we don't want windows builds to pull
snapshots in the current development state now.

git-svn-id: https://svn.eduke32.com/eduke32@2205 1a8010ca-5511-0410-912e-c29ae57300e0
2011-12-25 15:33:24 +00:00
helixhorned 664e0dcb9b Fix non-TROR build and add a warning that such a build is only useful for
debugging, i.e. savegames and the like will break.

git-svn-id: https://svn.eduke32.com/eduke32@2204 1a8010ca-5511-0410-912e-c29ae57300e0
2011-12-25 15:33:02 +00:00
helixhorned 60fa7d9f00 Remove a few unused variables from global.[ch], update build date string.
git-svn-id: https://svn.eduke32.com/eduke32@2196 1a8010ca-5511-0410-912e-c29ae57300e0
2011-12-25 15:30:50 +00:00
helixhorned 2f7851336b Fix out-of-bounds write when passing a map filename to Mapster32.
git-svn-id: https://svn.eduke32.com/eduke32@2194 1a8010ca-5511-0410-912e-c29ae57300e0
2011-12-21 18:43:24 +00:00
helixhorned 6b913a39aa some more clearbuf -> memset in gamedef.c plus add a forgotten keystatus
reset in the editor

git-svn-id: https://svn.eduke32.com/eduke32@2191 1a8010ca-5511-0410-912e-c29ae57300e0
2011-12-21 18:42:32 +00:00
helixhorned 8e54a3febf Preliminary commoning of actor[].t_data[10] to an array of int32's on both
32- and 64-bit platforms. Also, make struct type actor_t also have a common
size of 128 bytes. New code currently disabled and #ifdef'd for comparison.

This requires certain t_data[] entries ([1]: move ptr, [4]: action ptr and
[5]: ai ptr with actors) to be converted to script offsets instead of pointers,
breaking savegame and net packet compatibility (we could in theory try hard not
to, but it would be too much trouble).

git-svn-id: https://svn.eduke32.com/eduke32@2185 1a8010ca-5511-0410-912e-c29ae57300e0
2011-12-21 18:40:47 +00:00
helixhorned 9b0ea0366e Add new actor[].flags flag 2048 (SPRITE_NOCLIP), for 'spriteflags' CON usage.
Actors are always moved such that _they_ clip against blocking sprites, even
if their blocking bit is clear. Setting the new bit make them not clip against
anything.  The promary use of this is for decorative moving sprites that are
spawned in masses, such as rain or snow.

git-svn-id: https://svn.eduke32.com/eduke32@2184 1a8010ca-5511-0410-912e-c29ae57300e0
2011-12-17 18:51:50 +00:00
helixhorned 60bb16693b engine.c, in engine_addtsprite: if we can't add more tsprites because we
already have MAXSPRITESONSCREEN of them, return 1 to signal that the caller
should break out of the loop.

git-svn-id: https://svn.eduke32.com/eduke32@2183 1a8010ca-5511-0410-912e-c29ae57300e0
2011-12-17 18:51:29 +00:00
helixhorned 8f92cb024d Tweaks to compile the release build with clang. Now if it only would not
generate curious code like this one (Ubuntu 11.10's clang 2.9 on i386):

   0x080a57ea <+538>:   xor    %al,%al
   0x080a57ec <+540>:   test   %al,%al
   0x080a57ee <+542>:   jnz    0x80a57f2 <initgroupfile+546>
=> 0x080a57f0 <+544>:   jmp    0x80a57f0 <initgroupfile+544>
   0x080a57f2 <+546>:   shl    $0x4,%edi

git-svn-id: https://svn.eduke32.com/eduke32@2182 1a8010ca-5511-0410-912e-c29ae57300e0
2011-12-15 22:43:01 +00:00
helixhorned df94c55eab Patch up out-of-bounds access in some voxel drawing code.
git-svn-id: https://svn.eduke32.com/eduke32@2181 1a8010ca-5511-0410-912e-c29ae57300e0
2011-12-15 22:42:42 +00:00
helixhorned 84867ee620 Mapster32: Rudimentary support for auto-aligning along TROR nextwalls.
Usage: press the ['] (quote) modifier together with the PERIOD key.
Aligns only the immediate upper and lower neighbors of each wall that got
aligned by following point2s or nextwalls.  Doesn't play well with Alt
(carry over xrepeat) yet, might need two subsequent alignment passes.

git-svn-id: https://svn.eduke32.com/eduke32@2178 1a8010ca-5511-0410-912e-c29ae57300e0
2011-12-12 23:18:35 +00:00
helixhorned 2f14c6dbed checkdefs.sh script: hackish support for CON files, only 'include *.con' and
'definesound ... *.(voc|wav|ogg)' commands (missing: 'music', something else?).

git-svn-id: https://svn.eduke32.com/eduke32@2176 1a8010ca-5511-0410-912e-c29ae57300e0
2011-12-12 23:18:00 +00:00
helixhorned 3ca41992dd Fix sintable[] access with out-of-bounds values in core engine functions
(getzrange, hitscan, clipmove, drawmapview).
They're reproducible with DNE1.3D;  Since these angle values most likely come
from CON code, my suggestion would be to bit-and all values representing angles
with 2047 when setting the from CON, but I'd have to think about potential
side-effects of doing this.

git-svn-id: https://svn.eduke32.com/eduke32@2170 1a8010ca-5511-0410-912e-c29ae57300e0
2011-12-09 19:11:47 +00:00
helixhorned 151287168c - Fix invalid polymer light array access originating from game's cleanup
callback 'G_Polymer_UnInit'.
- In astub.c, reset spritelightid to -1 when nulling the spritelightptr of
  a sprite  (no crashes observed, just precaution)
- In sdlayer.c, catch SIGILLs with our signal handler too, since illegal
  instructions are what the instrumented debug builds will execute when
  attempting to carry out an undefined (per C) operation.

git-svn-id: https://svn.eduke32.com/eduke32@2169 1a8010ca-5511-0410-912e-c29ae57300e0
2011-12-09 19:11:31 +00:00
helixhorned 20d303ed15 engine.c: fix shift by negative value in parascan().
git-svn-id: https://svn.eduke32.com/eduke32@2168 1a8010ca-5511-0410-912e-c29ae57300e0
2011-12-09 19:11:08 +00:00
helixhorned b85b4d7b7c polymer.c: fix out-of-bounds picanm[] read.
git-svn-id: https://svn.eduke32.com/eduke32@2167 1a8010ca-5511-0410-912e-c29ae57300e0
2011-12-09 19:10:51 +00:00
helixhorned b7aacd242a Fix shift by values greater than 31 in some voxel loading code.
git-svn-id: https://svn.eduke32.com/eduke32@2165 1a8010ca-5511-0410-912e-c29ae57300e0
2011-12-09 19:10:21 +00:00
helixhorned f39429fa96 kplib.c: patch up negative array access, dunno how to really fix this at
the root.

git-svn-id: https://svn.eduke32.com/eduke32@2164 1a8010ca-5511-0410-912e-c29ae57300e0
2011-12-09 19:10:03 +00:00
helixhorned a950232046 Mapster32: fix AWFUL out-of-bounds WRITE with sector highlighting.
How in the name of hell this could pass undetected for so long is a
mystery to me.

git-svn-id: https://svn.eduke32.com/eduke32@2163 1a8010ca-5511-0410-912e-c29ae57300e0
2011-12-09 19:09:45 +00:00
helixhorned c7aa4592c2 polymost_printext256: fix oob read when passing negative 'col' or 'backcol'
values;  check the color index that is potentially gotten from the string to
be printed.

git-svn-id: https://svn.eduke32.com/eduke32@2162 1a8010ca-5511-0410-912e-c29ae57300e0
2011-12-09 19:09:29 +00:00
helixhorned 6dc17eec1b Makefiles: disable a few warning categories and other switches when compiling
with clang to prevent spamming the output.

git-svn-id: https://svn.eduke32.com/eduke32@2159 1a8010ca-5511-0410-912e-c29ae57300e0
2011-12-09 19:08:47 +00:00
helixhorned 6fc7e5b683 Remove some warnings with clang, code-side changes.
git-svn-id: https://svn.eduke32.com/eduke32@2158 1a8010ca-5511-0410-912e-c29ae57300e0
2011-12-09 19:08:29 +00:00
helixhorned 775d652d7d Lunatic: more Makefile tweaks; spriteext
git-svn-id: https://svn.eduke32.com/eduke32@2148 1a8010ca-5511-0410-912e-c29ae57300e0
2011-12-04 18:09:50 +00:00
helixhorned c0b86bae3a Mapster32: When failing to extend a collection of sectors because one of
them has a different height, print the sectnums of two differing sectors
to so that the mapper can find and examine them with Ctrl-J.

git-svn-id: https://svn.eduke32.com/eduke32@2146 1a8010ca-5511-0410-912e-c29ae57300e0
2011-12-03 13:13:44 +00:00
helixhorned bbc6db465e Mapster32: new cfg var 'glusememcache', the same as r_memcache cvar.
git-svn-id: https://svn.eduke32.com/eduke32@2145 1a8010ca-5511-0410-912e-c29ae57300e0
2011-12-03 13:13:28 +00:00
helixhorned 324510f40d Mapster32: when having some sectors highlighted, also show how many walls
they contain in total.

git-svn-id: https://svn.eduke32.com/eduke32@2144 1a8010ca-5511-0410-912e-c29ae57300e0
2011-12-03 13:13:08 +00:00
helixhorned 59881f50e0 Revert r2141 functionality because it was a stupid-ass hack and breaks E3L5.
The texture warping mode will need to be set depending on whether we're
actually drawing a parallaxed sky or not.

git-svn-id: https://svn.eduke32.com/eduke32@2142 1a8010ca-5511-0410-912e-c29ae57300e0
2011-11-27 12:02:41 +00:00
helixhorned 2a73b7fc9b Upload sky textures with s wrapping set to GL_CLAMP{_TO_EDGE}.
This fixes the vertical (~1 texel wide) stripes that are especially
noticable with tiled art skies and Polymost with r_parallaxskyclamp=1
or Polymer (which always uploads skies with repeating s and t coords).
What constitutes a sky tile is currently hardcoded to be >=78 and <=99.

git-svn-id: https://svn.eduke32.com/eduke32@2141 1a8010ca-5511-0410-912e-c29ae57300e0
2011-11-26 22:41:09 +00:00
helixhorned 0414072838 Remove old duplicate_selected_sectors() function and copysector(), which
was only used there, from the source.

git-svn-id: https://svn.eduke32.com/eduke32@2139 1a8010ca-5511-0410-912e-c29ae57300e0
2011-11-26 22:40:39 +00:00
helixhorned 2ce07bdcd2 Rewrite sector duplication (Insert or C) in terms of backup_highlighted_sector
and restore_highlighted_sector functions. What this means is that TROR bunches
are now correctly duplicated too (only if all sectors of a given bunch are
highlighted).

git-svn-id: https://svn.eduke32.com/eduke32@2138 1a8010ca-5511-0410-912e-c29ae57300e0
2011-11-26 22:40:23 +00:00
helixhorned 54c109168d New modifier for RAlt. When RShift is depressed while highlighting sectors
(i.e. first press RAlt, then hold RShift to make it active), consider all
sectors, even the grayed out ones.
This makes 6 modifier keys in 4 categories for RAlt. Can you name them all?

Also spell out the labels that get drawn near the reticle when applying
some of the modifiers and make them not show when not actually selecting
(e.g. pressed RShift alone, but have highlighted sectors)

git-svn-id: https://svn.eduke32.com/eduke32@2137 1a8010ca-5511-0410-912e-c29ae57300e0
2011-11-26 22:40:07 +00:00