Commit Graph

2358 Commits

Author SHA1 Message Date
helixhorned cd89fce9aa less trivial stuff
- fix one bound-checking line
- rewrite two lines in astub.c to potentially not overflow an int16
- make tiletovox[] an array of int16's

git-svn-id: https://svn.eduke32.com/eduke32@2266 1a8010ca-5511-0410-912e-c29ae57300e0
2012-01-19 21:57:46 +00:00
helixhorned 2e1e2345af trivial tweaks: make stuff static, remove unused stuff, formatting...
git-svn-id: https://svn.eduke32.com/eduke32@2265 1a8010ca-5511-0410-912e-c29ae57300e0
2012-01-19 21:57:22 +00:00
hendricks266 426ef1494e Add the 'yoffset' token to model definitions to allow models to compensate for ART tiles with large yoffsets, such as #603. Under normal circumstances the existing 'zadd' parameter should be used instead. Special thanks to Supertanker.
git-svn-id: https://svn.eduke32.com/eduke32@2264 1a8010ca-5511-0410-912e-c29ae57300e0
2012-01-17 04:31:59 +00:00
hendricks266 ff94311f13 weapons.con.sample:
- hud_orientation now uses proper bitwise operations
 - clean up whitespace

git-svn-id: https://svn.eduke32.com/eduke32@2263 1a8010ca-5511-0410-912e-c29ae57300e0
2012-01-17 04:31:23 +00:00
helixhorned ebb3d0a378 gamedef.c: make some variables static and remove some #if 0'ed code.
git-svn-id: https://svn.eduke32.com/eduke32@2262 1a8010ca-5511-0410-912e-c29ae57300e0
2012-01-15 22:40:16 +00:00
helixhorned 031da6280d Remove the allocache() allocation type for 'intptr_t *lookups'.
Always malloc that buffer.  This allows us to remove suckcache() from
cache1d.c, which I believe to be buggy (see comments in the source).

git-svn-id: https://svn.eduke32.com/eduke32@2261 1a8010ca-5511-0410-912e-c29ae57300e0
2012-01-15 22:39:59 +00:00
helixhorned 260bbc1f92 cleanup:
- 'whitecol' was defined in the engine and in build.c, use only the engine one
 - make cachesize, artsize, artversion static in engine.c
 - undo some formatting havoc presumably done by astyle

git-svn-id: https://svn.eduke32.com/eduke32@2260 1a8010ca-5511-0410-912e-c29ae57300e0
2012-01-15 22:39:38 +00:00
helixhorned 340b2f7647 Increase the number of maximum art files from 64 to 256 and tweak loadpics().
It is likely that this is the value it used to have at some point, because
the MAXTILEFILES macro equals 256 and is as old as the Duke3D source.
loadpics() now refuses to load an ART file with localtilestart or localtileend
out of bounds, or if localtileend<=localtilestart (i.e. no tiles in ART file, or
nonsense). Also, on 'invalid art file version', continue instead of returning.

Note: this does not increase the maximum number of tiles, which is still 15360,
it only gives a bit more freedom to arrange them (well, into more art files).
Also, I don't see what anyone keeps off from packing any number of tiles (from
1 to 15360) into an art file. Old EDITART limits?

git-svn-id: https://svn.eduke32.com/eduke32@2259 1a8010ca-5511-0410-912e-c29ae57300e0
2012-01-15 22:39:10 +00:00
helixhorned 6aec1d1f26 Add a hack to the animsounds DEF token parsing to not wrongly emit an error.
git-svn-id: https://svn.eduke32.com/eduke32@2258 1a8010ca-5511-0410-912e-c29ae57300e0
2012-01-15 22:38:54 +00:00
helixhorned e30ed58aa0 Fix parallaxed sector display in Mapster32 on Polymer.
git-svn-id: https://svn.eduke32.com/eduke32@2257 1a8010ca-5511-0410-912e-c29ae57300e0
2012-01-14 14:48:45 +00:00
helixhorned 480690aa1d Fix the Polymer hitches first encountered with Parkade.
The cause was a combination of many factors. First, Polymer requires the
start-drawing position to be inside the sector to draw (deviations lead to
incorrect drawing).  This was violated by the game, because it interpolated
the current and next tic position without updating the sectnum, leading to
inconsistencies especially when passing through narrow sectors.  Polymer
worked around it by doing an updatesector() each frame, however this works
poorly for maps with overlapping geometry such as SoS or RoR.

The solution to this is to add a new engine function,
updatesector_onlynextwalls(), which searches the sectors (via nextsector)
in breadth-first fashion instead of from 0 to numsectors-1, like updatesector
does when it fails for the *immediate* nextwall neighbors.

Internally, the breadt-first search helpers are moved into the engine.

git-svn-id: https://svn.eduke32.com/eduke32@2256 1a8010ca-5511-0410-912e-c29ae57300e0
2012-01-14 14:48:30 +00:00
helixhorned 87ac6b8406 winlayer.c: in WM_PALETTECHANGED handling code ("someone stole the palette
so try and steal it back"), prevent calling IDirectDrawSurface_SetPalette()
with NULL arguments, causing a crash.  It's happened for me on Vista, when
initially changing from 8-bit to 32-bit mode.

git-svn-id: https://svn.eduke32.com/eduke32@2255 1a8010ca-5511-0410-912e-c29ae57300e0
2012-01-12 20:49:50 +00:00
helixhorned a57b566c0b Add Makefile option to use the DMALLOC (debug malloc) library.
I didn't have much success in finding bugs using it, but it works
out-of-the-box on my setup, so it may be useful in the future.

git-svn-id: https://svn.eduke32.com/eduke32@2254 1a8010ca-5511-0410-912e-c29ae57300e0
2012-01-12 20:49:34 +00:00
helixhorned 300fee62da sdlayer.c: formatting of preprocessor lines
git-svn-id: https://svn.eduke32.com/eduke32@2253 1a8010ca-5511-0410-912e-c29ae57300e0
2012-01-12 20:49:15 +00:00
helixhorned 9617227a87 Support for the first "thumb" mouse button, called MOUSE4 in the menu.
The second one is passed to the 'mouseb' variable, but the game currently
can't map it since ud.config.MouseFunctions[] would have to be enlarged,
breaking savegame compatibility.
Works both for the Windows and SDL layers. For the latter, instead of using
the SDL_BUTTON_X1/X2 macro constants, I'm using 8 and 9, since that is what
SDL (and incidentally or not, xev) gives me for those buttons.

git-svn-id: https://svn.eduke32.com/eduke32@2252 1a8010ca-5511-0410-912e-c29ae57300e0
2012-01-12 20:48:57 +00:00
helixhorned 80949930bd Temporarily disable the 'model thinning-out' feature intended to save memory.
It turns out that with model interpolation, out-of-bounds frame numbers may
be generated with thinned out models, so disable it until I can sort out
what's wrong with it.
Also, minor code cleanup.

git-svn-id: https://svn.eduke32.com/eduke32@2251 1a8010ca-5511-0410-912e-c29ae57300e0
2012-01-12 20:48:38 +00:00
helixhorned 5f50c30ac2 polymer.c: "Compiling GPU program with bits (octal) %o" for easier reading.
Also, for debugging builds, show this message from verbosity level 1 on.

git-svn-id: https://svn.eduke32.com/eduke32@2250 1a8010ca-5511-0410-912e-c29ae57300e0
2012-01-12 20:48:17 +00:00
helixhorned 7a5a19a874 Fix actor[].dispicnum becoming negative.
Since the original source code release of Duke3D, there was a potentially
dangerous hack where actor[].dispicnum was set to -4 to signal "this actor
should not have a floor shadow for this moment" (it doesn't really work,
if you ask me).
Now, use another bit of actor[].flags for that purpose because setting
any picnum members to negative values asks for trouble.

git-svn-id: https://svn.eduke32.com/eduke32@2249 1a8010ca-5511-0410-912e-c29ae57300e0
2012-01-12 20:48:00 +00:00
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 d83ff63607 sounds.c: check the sound number before accessing arrays with it; always do
this in "(unsigned)i < bound" fashion.

git-svn-id: https://svn.eduke32.com/eduke32@2245 1a8010ca-5511-0410-912e-c29ae57300e0
2012-01-10 23:44:49 +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 a0d27ee702 animvpx sound: fix the 'may have many sounds per frame' requirement
E.g. this should work correctly now:
// FLY_BY, PIPEBOMB_EXPLODE, OCTA_DYING
animsounds logo { 1 244  64 14  64 144 }

git-svn-id: https://svn.eduke32.com/eduke32@2243 1a8010ca-5511-0410-912e-c29ae57300e0
2012-01-10 23:44:09 +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 f826ffb4d0 In VPX 3 planed --> packed conversion code, pull constant expressions out of
the loop.  For the release build and the test animation, this lowers the time
to 3-4 ms per conversion of one frame on my desktop machine.

git-svn-id: https://svn.eduke32.com/eduke32@2241 1a8010ca-5511-0410-912e-c29ae57300e0
2012-01-10 23:43:33 +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 3e103e435a Makefile.common: oops, -DNEBUG was in the debug build, not the release one
git-svn-id: https://svn.eduke32.com/eduke32@2239 1a8010ca-5511-0410-912e-c29ae57300e0
2012-01-07 20:37:48 +00:00
helixhorned a0f19e66be osxbuild.sh: don't build for ppc
git-svn-id: https://svn.eduke32.com/eduke32@2238 1a8010ca-5511-0410-912e-c29ae57300e0
2012-01-07 20:37:36 +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 146e1f1c09 When loading a game, DON'T restore 'adult' TV tiles. This fixes the recent
crashes.

Usually, after loading a game, some wall tiles are tweaked depending on whether
adult mode is enabled or not.  If it's not, those wall picnums are replaced
with blank or broken screens.  If it is, they are restored from the wall's
.extra member.  Apparently though, Mapster32 leaves some .extra members
floating around even after deleting a TROR nextwall link (it's used as the
'lower wall index').  Because MAXWALLS is greater than MAXTILES, this may
produce out-of-bounds accesses and corrupt memory (besides setting wall
tilenums to nonsensical values) later in the game.

Other than that, the change only affects loading savegames created with adult
mode OFF. Kinky TV screenies simply won't be restored then.

git-svn-id: https://svn.eduke32.com/eduke32@2235 1a8010ca-5511-0410-912e-c29ae57300e0
2012-01-05 20:48:37 +00:00
helixhorned b5f2955895 savegame.c: some const void **ptr -> void **ptr, since they're certainly not const
git-svn-id: https://svn.eduke32.com/eduke32@2234 1a8010ca-5511-0410-912e-c29ae57300e0
2012-01-05 20:48:20 +00:00
helixhorned 74b823d6dc trivial tweaks: some NULLing pointer after freeing them; move the 'too much mirrors'
check one 'if' down since mirrors are only created when the condition holds

git-svn-id: https://svn.eduke32.com/eduke32@2233 1a8010ca-5511-0410-912e-c29ae57300e0
2012-01-05 20:48:05 +00:00
helixhorned bb17cff9b7 Pass bit 16 to P_SetGamePalette from CON's setgamepalette (forgotten from earlier commit)
git-svn-id: https://svn.eduke32.com/eduke32@2232 1a8010ca-5511-0410-912e-c29ae57300e0
2012-01-03 19:56:10 +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
helixhorned f87c0db3ce In G_NewGame(), call Gv_RefreshPointers after Gv_ResetVars.
Resetting the gamevars might produce inconsistencies between an earlier loaded
game (for example, if it was saved with different/earlier CON code), and worst
of all, the gamevars that reference C variables might be overwritten (i.e. the
addresses to those variable, which is very bad!).

git-svn-id: https://svn.eduke32.com/eduke32@2230 1a8010ca-5511-0410-912e-c29ae57300e0
2012-01-03 19:55:38 +00:00
hendricks266 13c399f612 - Format CON crash output in VM_ScriptInfo() much more nicely.
- Execute VM_ScriptInfo() when DNDEBUG is used.

git-svn-id: https://svn.eduke32.com/eduke32@2229 1a8010ca-5511-0410-912e-c29ae57300e0
2012-01-01 04:14:06 +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 9a7bdfa76c a.m32 light hotkeys: clamp hitag (range) to 0..32767 instead of 0..16000
git-svn-id: https://svn.eduke32.com/eduke32@2227 1a8010ca-5511-0410-912e-c29ae57300e0
2011-12-30 22:17:29 +00:00
helixhorned afbffe5c4a CON: make the 'palette' player member actually return the player's palette ID
instead of -1. Setting is still only through 'setgamepalette'.

git-svn-id: https://svn.eduke32.com/eduke32@2226 1a8010ca-5511-0410-912e-c29ae57300e0
2011-12-29 14:26:30 +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 65deeda53a The earlier changes introduced bugs when palettes were not set correctly in
certain situations (mostly cutscenes etc). This commit removes bit 1 from all
flags that make it to setbrightness, the meaning of which is "don't actually
update the palette". I have no idea what it was for and since the corresponding
P_SetGamePalette() calls were from places like the mentioned cutscenes, I don't
think it matters performance-wise.

git-svn-id: https://svn.eduke32.com/eduke32@2223 1a8010ca-5511-0410-912e-c29ae57300e0
2011-12-28 20:35:23 +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 d1d94e083f savegame.c: fix compilation warnings with release build, add timing for debug
git-svn-id: https://svn.eduke32.com/eduke32@2218 1a8010ca-5511-0410-912e-c29ae57300e0
2011-12-28 20:33:54 +00:00
helixhorned 8007da7190 Factor out two nearly identical pieces of code in game.c and gameexec.c
into G_HandleMirror().

git-svn-id: https://svn.eduke32.com/eduke32@2217 1a8010ca-5511-0410-912e-c29ae57300e0
2011-12-28 20:33:40 +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 51e3bc0148 net: fix bug in Net_ParseServerPacket introduced with SAMESIZE_ACTOR_T.
git-svn-id: https://svn.eduke32.com/eduke32@2215 1a8010ca-5511-0410-912e-c29ae57300e0
2011-12-27 14:22:28 +00:00
helixhorned 489605ee0d Fix sintable access with raw angle value (which might be outside [0..2047])
in overhead map drawing code.

git-svn-id: https://svn.eduke32.com/eduke32@2214 1a8010ca-5511-0410-912e-c29ae57300e0
2011-12-26 15:44:23 +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 7baaa44e28 savegame.c: fix initial setting of compression threshold on savegame load;
64-bit fixes

git-svn-id: https://svn.eduke32.com/eduke32@2212 1a8010ca-5511-0410-912e-c29ae57300e0
2011-12-26 14:37:34 +00:00
helixhorned 0bf329e70d start CON code at script[3] instead of script[1]. The 'move' command permits
the constants 0 and 1, and moveptrs may reference the script up to index 2
then (though I'm not sure whether the code is reachable with moveofs either
0 or 1), so make sure it's nulled instead of whatever happened to compile at
the first two positions.  Move 1 is only used once in the original cons,
when frozen and being shattered.

git-svn-id: https://svn.eduke32.com/eduke32@2211 1a8010ca-5511-0410-912e-c29ae57300e0
2011-12-25 15:35:06 +00:00
helixhorned 5ef480ad7a fix displaying the screenshot even for old-version savegames.
git-svn-id: https://svn.eduke32.com/eduke32@2210 1a8010ca-5511-0410-912e-c29ae57300e0
2011-12-25 15:34:52 +00:00
helixhorned a3a80467a7 net: send BYTEVERSION as two bytes, high byte first.
Now we don't need to worry about the numbers running out soon.
Bump BYTEVERSION by three to celebrate this, too.

git-svn-id: https://svn.eduke32.com/eduke32@2209 1a8010ca-5511-0410-912e-c29ae57300e0
2011-12-25 15:34:37 +00:00
helixhorned ff6284ea8c Enable SAMESIZE_ACTOR_T described earlier.
git-svn-id: https://svn.eduke32.com/eduke32@2208 1a8010ca-5511-0410-912e-c29ae57300e0
2011-12-25 15:34:22 +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 61257b0f6b Rewrite a couple of lines in clearfrags() to look more idiomatic.
git-svn-id: https://svn.eduke32.com/eduke32@2206 1a8010ca-5511-0410-912e-c29ae57300e0
2011-12-25 15:33:37 +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 e1a10b2d57 Eh, fix out-of-bounds issue in clearfrags() with MAXPLAYERS players.
It was identified with the clearfrags rewriting, but not corrected.

git-svn-id: https://svn.eduke32.com/eduke32@2203 1a8010ca-5511-0410-912e-c29ae57300e0
2011-12-25 15:32:44 +00:00
helixhorned 8ecb6e6bd5 Factor out filename-based music setup code into G_SetupFilenameBasedMusic.
There were two instances of nearly identical code in premap.c and savegame.c.
Also identifies a (harmless) problem with realloc'ing, we had:

    if (len+1 > sizeof(MapInfo[...].musicfn))
        MapInfo[...].musicfn = Brealloc(MapInfo[...].musicfn, len+1)

which reallocs almost all the time (since .musicfn is a pointer). Now we do
realloc every time...

git-svn-id: https://svn.eduke32.com/eduke32@2202 1a8010ca-5511-0410-912e-c29ae57300e0
2011-12-25 15:32:30 +00:00
helixhorned bf00465922 premap.c: write out inline function clearfrags() for clarity.
git-svn-id: https://svn.eduke32.com/eduke32@2201 1a8010ca-5511-0410-912e-c29ae57300e0
2011-12-25 15:32:14 +00:00
helixhorned 9a3ae8df08 misc. cleanup in savegame.c
git-svn-id: https://svn.eduke32.com/eduke32@2200 1a8010ca-5511-0410-912e-c29ae57300e0
2011-12-25 15:32:00 +00:00
helixhorned 24e4d93226 Rewrite EDuke32's -d<demofile> option parsing code. Writing into argv[i]
isn't very wise. Also resize firstdemofile[] to BMAX_PATH bytes.

git-svn-id: https://svn.eduke32.com/eduke32@2199 1a8010ca-5511-0410-912e-c29ae57300e0
2011-12-25 15:31:46 +00:00
helixhorned be84374899 Remove written-out savegame.c function declarations from demo.c and include
savegame.h instead.

git-svn-id: https://svn.eduke32.com/eduke32@2198 1a8010ca-5511-0410-912e-c29ae57300e0
2011-12-25 15:31:30 +00:00
helixhorned 41db6bc512 Remove 'projectile' field from actor_t because it was entirely unused.
WARNING: This silently breaks savegames on 64-bit platforms.

git-svn-id: https://svn.eduke32.com/eduke32@2197 1a8010ca-5511-0410-912e-c29ae57300e0
2011-12-25 15:31:14 +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 4fd25d1eab minor cosmetic tweaks in sector.[ch] and a off-by-one limit correction there
git-svn-id: https://svn.eduke32.com/eduke32@2195 1a8010ca-5511-0410-912e-c29ae57300e0
2011-12-21 18:43:39 +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 b72972e43b Lunatic: actor. (Needs SAMESIZE_ACTOR_T, which is not yet enabled)
git-svn-id: https://svn.eduke32.com/eduke32@2193 1a8010ca-5511-0410-912e-c29ae57300e0
2011-12-21 18:43:08 +00:00
helixhorned f12bd9f13d misc. beautifying some game code...
git-svn-id: https://svn.eduke32.com/eduke32@2192 1a8010ca-5511-0410-912e-c29ae57300e0
2011-12-21 18:42:49 +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 a7d1177d23 savegame.c: minor cleanup and crash prevention in doloadplayer2
if loading directly from file to state.

git-svn-id: https://svn.eduke32.com/eduke32@2190 1a8010ca-5511-0410-912e-c29ae57300e0
2011-12-21 18:42:12 +00:00
helixhorned eee507741d CON parser cleanup: In C_Compile, initially clear three arrays with
Bmemset(..., 0, sizeof(...)) instead of clearbuf(..., MAX..., 0),
because the latter would clear only half of the data on 64-bit platforms.

git-svn-id: https://svn.eduke32.com/eduke32@2189 1a8010ca-5511-0410-912e-c29ae57300e0
2011-12-21 18:41:55 +00:00
helixhorned 89d321c01f In EDuke32 loading/saving menus, when finding old version savegame, display
some information about it instead of simply omitting it.
Internally, struct savegame --> struct savegame_ for easier grepping.

git-svn-id: https://svn.eduke32.com/eduke32@2188 1a8010ca-5511-0410-912e-c29ae57300e0
2011-12-21 18:41:38 +00:00
helixhorned 297738389a actor t_data commoning: forgot do add a #define in duke3d.h
git-svn-id: https://svn.eduke32.com/eduke32@2187 1a8010ca-5511-0410-912e-c29ae57300e0
2011-12-21 18:41:17 +00:00
helixhorned 7f34c33bbc animvpx loop: do at least on input device poll each frame (i.e. even if we're
lagging) to be able to cancel the movie in any case.

git-svn-id: https://svn.eduke32.com/eduke32@2186 1a8010ca-5511-0410-912e-c29ae57300e0
2011-12-21 18:41:03 +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 46ed3313e7 Don't spawn weapon tiles (WEAPONx_SPAWN) if any such value has been set
to negative numbers.  Previously, only checks for being zero were performed,
but CON code in the wild also has WEAPONx_SPAWN -1, which would propagate to
the sprite picnum...

git-svn-id: https://svn.eduke32.com/eduke32@2180 1a8010ca-5511-0410-912e-c29ae57300e0
2011-12-15 22:42:25 +00:00
helixhorned b73b9cb732 a.m32: new state 'print_parallel_midpts'
git-svn-id: https://svn.eduke32.com/eduke32@2179 1a8010ca-5511-0410-912e-c29ae57300e0
2011-12-12 23:18:53 +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 4989c173bd Fix out-of-bounds access in tile selector code in astub.c
git-svn-id: https://svn.eduke32.com/eduke32@2177 1a8010ca-5511-0410-912e-c29ae57300e0
2011-12-12 23:18:15 +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 44e29613f1 Fix two yax_drawrooms() calls with too large sectnums (copy&paste error).
git-svn-id: https://svn.eduke32.com/eduke32@2175 1a8010ca-5511-0410-912e-c29ae57300e0
2011-12-11 13:26:54 +00:00
helixhorned ba858b3858 Fix a number of oob accesses with "switch switches".
Various code checked for switch tiles in the following manner,
  for (ii=0; ii<2; ii++)
      switch (DynamicTileMap[sprite[i].picnum-1+ii]) { case SOME_SWITCH: ... }
which blows for picnum 0.  Now, we simply disallow it.

git-svn-id: https://svn.eduke32.com/eduke32@2174 1a8010ca-5511-0410-912e-c29ae57300e0
2011-12-11 13:26:39 +00:00
helixhorned 44d002c354 Makefile: Remove {eduke32,mapster32}.memmap files on clean/veryclean targets
(bioman request).

git-svn-id: https://svn.eduke32.com/eduke32@2173 1a8010ca-5511-0410-912e-c29ae57300e0
2011-12-11 13:26:22 +00:00
helixhorned 65e0e75a8c Fix negative array access in premap.c
git-svn-id: https://svn.eduke32.com/eduke32@2172 1a8010ca-5511-0410-912e-c29ae57300e0
2011-12-09 19:12:15 +00:00
helixhorned cd6e846fac Fix potential out-of-bounds array access in P_DisplayTip (happened with
WGR2 SVN, so not sure where there's a tipping animation there).

git-svn-id: https://svn.eduke32.com/eduke32@2171 1a8010ca-5511-0410-912e-c29ae57300e0
2011-12-09 19:12:01 +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 eb764b3b75 gameexec.c: fix calculation of a pointer value outside the bounds of an array
and an invalid derived pointer value.

git-svn-id: https://svn.eduke32.com/eduke32@2166 1a8010ca-5511-0410-912e-c29ae57300e0
2011-12-09 19:10:35 +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 c112cdde89 Fix a potential out-of-bounds read and write when loading the help file
in Mapster32.

git-svn-id: https://svn.eduke32.com/eduke32@2161 1a8010ca-5511-0410-912e-c29ae57300e0
2011-12-09 19:09:14 +00:00
helixhorned d806bc9fea When compiling debugging builds with clang, enable -fcatch-undefined-behavior.
git-svn-id: https://svn.eduke32.com/eduke32@2160 1a8010ca-5511-0410-912e-c29ae57300e0
2011-12-09 19:09:00 +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 a7bce8814a Fix a warning with 64-bit builds.
git-svn-id: https://svn.eduke32.com/eduke32@2157 1a8010ca-5511-0410-912e-c29ae57300e0
2011-12-09 19:08:05 +00:00
terminx 81b5ed0025 Simple one-liner from Robin Green to fix a problem where the menu background tint would sometimes draw over the menu contents
git-svn-id: https://svn.eduke32.com/eduke32@2156 1a8010ca-5511-0410-912e-c29ae57300e0
2011-12-08 03:56:38 +00:00
helixhorned e6d1c9bd6a a.m32: New function save_restore_hlsectors, also accessible from the Quote-F
menu.  If some sectors are highlighted, save their indices.  The highlighting
of those particular sectors can then be restored at a later time (but careful
across structural modifications that tweak sector indices) by running the same
function.  Shares a 'gamearray' with function 'collect_teleporting_sectors',
so the latter will reset this one when run.

git-svn-id: https://svn.eduke32.com/eduke32@2155 1a8010ca-5511-0410-912e-c29ae57300e0
2011-12-04 21:21:01 +00:00
helixhorned 3aac0c1bd4 M32Script: when failing to compile a state with a menu name, don't keep the
menu entry.

git-svn-id: https://svn.eduke32.com/eduke32@2154 1a8010ca-5511-0410-912e-c29ae57300e0
2011-12-04 21:20:48 +00:00
helixhorned 086dcf383d Mapster32: fix filling all sectors of a bunch with Ctrl-U. Previously, only
one sector was filled and the 'clear bunch' message was displayed even if the
operation was canceled.

git-svn-id: https://svn.eduke32.com/eduke32@2153 1a8010ca-5511-0410-912e-c29ae57300e0
2011-12-04 21:20:31 +00:00
helixhorned 03000a52b9 CON parser cleanup: make labelcode save offsets to CON code instead of
pointers and make it into an int32_t*.

git-svn-id: https://svn.eduke32.com/eduke32@2152 1a8010ca-5511-0410-912e-c29ae57300e0
2011-12-04 21:20:17 +00:00
helixhorned 0b7c08ce0e CON parser cleanup: make labeltype be an int32_t* instead of an intptr_t*.
git-svn-id: https://svn.eduke32.com/eduke32@2151 1a8010ca-5511-0410-912e-c29ae57300e0
2011-12-04 21:19:57 +00:00
helixhorned fabbcdcf56 CON parser cleanup: when getting a value from labelcode[], assume that it
represents a pointer into the script for label types other than LABEL_DEFINE
instead of checking inclusion of the value in the script bounds. This
assertion was tested with WGR2 SVN.

git-svn-id: https://svn.eduke32.com/eduke32@2150 1a8010ca-5511-0410-912e-c29ae57300e0
2011-12-04 21:19:41 +00:00
helixhorned 3285cfef8c CON: Add the following commands to those which shouldn't be optimized away
with empty branches: ifcanseetarget, ifpdistl, ifpdistg, ifgotweapononce.

git-svn-id: https://svn.eduke32.com/eduke32@2149 1a8010ca-5511-0410-912e-c29ae57300e0
2011-12-04 18:10:06 +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
terminx 8ac88ab4da Fix issue reported at http://forums.duke4.net/topic/5068-bug-introduced-in-old-versions-of-eduke32
git-svn-id: https://svn.eduke32.com/eduke32@2147 1a8010ca-5511-0410-912e-c29ae57300e0
2011-12-04 00:31:20 +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 c38d4f46f7 Lunatic: Makefile bits for Windows.
git-svn-id: https://svn.eduke32.com/eduke32@2143 1a8010ca-5511-0410-912e-c29ae57300e0
2011-12-03 13:12:51 +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 c4b243ba4e Fix moving cloud panning like in E4L1.
git-svn-id: https://svn.eduke32.com/eduke32@2140 1a8010ca-5511-0410-912e-c29ae57300e0
2011-11-26 22:40:54 +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
helixhorned 2675334a60 In backing up highlighted sectors code: also back up TROR information so
that bunches and nextwall links are restores, too.  Now, to coalesce two
TROR maps (e.g. for a CBP), one could
  do for i allsectors, sethighlightsector i 1
on the console, and then load the 'other' map to copy over the contents
of the first, including all TROR stuff. Note that neither selecting
all sectors with RAlt, nor duplicating them with Insert would lead to
the desired effect (yet).

Internally,
 - yax_setbunch() now has different behavior for bunchnums -1, -2 and -3
   (it either clears the nextwalls or not)
 - build.c has a helper function free_n_ptrs(). This could be handy in
   other situations where many blocks of memory must be allocated
   consecutively and freed in case of failure

git-svn-id: https://svn.eduke32.com/eduke32@2136 1a8010ca-5511-0410-912e-c29ae57300e0
2011-11-26 22:39:50 +00:00
helixhorned b461dc5fb9 When restoring temporarily backed up map, clear all TROR bunches. This is
suboptimal, but at least 'correct' and won't produce the aforementioned
corruptions anymore.

git-svn-id: https://svn.eduke32.com/eduke32@2135 1a8010ca-5511-0410-912e-c29ae57300e0
2011-11-26 14:12:59 +00:00
helixhorned f4703a596d Auto-correct the just mentioned inconsistency by clearing the respective TROR
nextwalls. (i.e. setting them to -1 on 'corruptcheck tryfix')

git-svn-id: https://svn.eduke32.com/eduke32@2134 1a8010ca-5511-0410-912e-c29ae57300e0
2011-11-26 14:12:44 +00:00
helixhorned 1402a6d70b corruption checker: catch TROR-nextwalls in non-extended sectors. These
can be caused by copying map parts from one map to another (or a new one).
The copying system is slightly broken right now....

git-svn-id: https://svn.eduke32.com/eduke32@2133 1a8010ca-5511-0410-912e-c29ae57300e0
2011-11-26 14:12:30 +00:00
helixhorned e76341f4f3 Backing up and restoring highlighted portion of map: calculate new
next{wall,sector} indices instead of using checksectorpointer() so
that the nextwalls will be restored exactly as they were (provided
that they are copied).  Also fix tweaking the sectnums of sprites.

git-svn-id: https://svn.eduke32.com/eduke32@2132 1a8010ca-5511-0410-912e-c29ae57300e0
2011-11-26 14:12:15 +00:00
helixhorned 235a82f13d Fix two bugs with the loop punching code that made it practically useless.
git-svn-id: https://svn.eduke32.com/eduke32@2131 1a8010ca-5511-0410-912e-c29ae57300e0
2011-11-25 13:46:48 +00:00
helixhorned ee30112c38 Ability to duplicate an inner loop in a neighboring TROR sector.
Called 'loop punching'. In addition to duplicating the loop, the inner
portions of the original and cloned loop are made into a new bunch, and
the loop walls are made to be neighbors, linking their movement to each
other. This gives a way to create island sectors with a differing
bunchnum in the midst of an already extended area.

Usage:
For an extended sector containing a CCW inner loop, select its points
using Ctrl+Shift. Press Ctrl-E to be queried whether to duplicate the
points into the upper or lower extension (even if it's unambiguous).
A number of conditions must be met for a successful 'punch', which
should hopefully be more or less obvious. Among them:
 - loop walls should all be red
 - the starting wall is only considered among the non-grayed-out ones
 - the neighboring sector must not contain points inside or at the loop

git-svn-id: https://svn.eduke32.com/eduke32@2130 1a8010ca-5511-0410-912e-c29ae57300e0
2011-11-25 09:53:07 +00:00
helixhorned f4d81d7975 "Sloped extended sectors cannot be split", oops. Also fix a glitch that
would break out of the 2D mode loop when splitting a sector would exceed
limits.

git-svn-id: https://svn.eduke32.com/eduke32@2129 1a8010ca-5511-0410-912e-c29ae57300e0
2011-11-25 09:52:52 +00:00
helixhorned 98ad4d7132 Factor out high-level 'add loop to sector' code into own function.
git-svn-id: https://svn.eduke32.com/eduke32@2128 1a8010ca-5511-0410-912e-c29ae57300e0
2011-11-25 09:52:37 +00:00
helixhorned c196e27ee9 in 'adding new loop to sector': use local 'firstwall' instead of ovh.suckwall
git-svn-id: https://svn.eduke32.com/eduke32@2127 1a8010ca-5511-0410-912e-c29ae57300e0
2011-11-25 09:52:22 +00:00
helixhorned 53bbb48675 Three Mapster32 changes (2 wall-drawing related, 1 crash fix)
- Don't crash when sector joining fails under certain circumstances.
- Increase the point lock (Manhattan) distance from 1/16th to 1/8th
  of the grid square length, making it easier to snap to vertices not
  lying at the grid points with grid lock on
- When drawing walls, don't snap to any of them except the first drawn

git-svn-id: https://svn.eduke32.com/eduke32@2126 1a8010ca-5511-0410-912e-c29ae57300e0
2011-11-25 09:52:08 +00:00
helixhorned 45bcc11f46 Batch-insertion of many points at once using line drawing and ENTER.
When having drawn N new points (and having one 'free') and pressing
ENTER, the N line segments between the new points are checked one by
one for intersection with every non-grayed-out wall and a wall vertex
is inserted at every intersecting point.  This may be viewed as a
prerequisite for a 'cutter' style tool.

git-svn-id: https://svn.eduke32.com/eduke32@2125 1a8010ca-5511-0410-912e-c29ae57300e0
2011-11-25 09:51:53 +00:00
helixhorned 24edef5c63 Warn user if pressing Ctrl+Shift+ENTER (check all wall pointers) in TROR map.
git-svn-id: https://svn.eduke32.com/eduke32@2124 1a8010ca-5511-0410-912e-c29ae57300e0
2011-11-25 09:51:36 +00:00
helixhorned 2d308625ff Factor out high-level point inserting code into M32_InsertPoint().
This function only handles the actual insertion, also taking care of
constrained TROR walls. Anything around the inserting such as backing up
drawn walls or snapping the x/y position to the grid is handled outside.

git-svn-id: https://svn.eduke32.com/eduke32@2123 1a8010ca-5511-0410-912e-c29ae57300e0
2011-11-25 09:51:21 +00:00
helixhorned 39314586ac Somewhat largish commit with various keyboard tinkering for Mapster.
The main change consist of adding a key press (and release) callback
whose only purpose is to be used from m32script as EVENT_KEYPRESS.
When entering that event, the RETURN variable will be set to the
keystatus code of the key, and whether it was pressed or released can
be checked by looking at keystatus[] at that code (ifholdkey and
ifhitkey do this). The purpose of this, then, is to be able to remap
keys in a more general (and complicated) fashion than is possible with
the mapster32.cfg 'remap' option. Various other additions build around
this central one:

- add an example EVENT_KEYPRESS to a.m32, among other things emulating
  the keypad arrows with Alt-<normal arrows> for notebook convenience;
  disabled initially
- a.m32: set 'owner' with Alt-KP2: now Alt-Shift-KP2, because of
  collision with the above
- new m32script command: setkey <keycode>, setting keystatus[<keycode>]
  to 1 (note: may be restricted to use in EVENT_KEYPRESS only in the
  future)
- fix indexing an m32script array with a defined label, there used to
  be a 'not a gamevar' error instead
- add the following constant labels for some key codes:
  KEY_SCROLL, KEY_F1 .. KEY_F12

git-svn-id: https://svn.eduke32.com/eduke32@2122 1a8010ca-5511-0410-912e-c29ae57300e0
2011-11-25 09:51:06 +00:00
helixhorned 9a8603d01e - Make old-nextwalls invalid on the following two occasions: ovh_whiteoutgrab
with no highlighted sectors; and when entering 3D mode, even if there are
  highlighted sectors. This should have almost no effect, but I find it cleaner
  that way.
- Check map for corruption every time an editing change is done. This was
  accidentally disabled when commenting out the undo code (which I've yet
  to debug).

git-svn-id: https://svn.eduke32.com/eduke32@2121 1a8010ca-5511-0410-912e-c29ae57300e0
2011-11-25 09:50:40 +00:00
helixhorned a1864b6a2e Make it impossible to start drawing walls when having a circle-wall
selected. (There was a corner case where this was possible.)

git-svn-id: https://svn.eduke32.com/eduke32@2120 1a8010ca-5511-0410-912e-c29ae57300e0
2011-11-25 09:50:21 +00:00
helixhorned 57e132a044 Remove after_handleevents_hook and its only user, the keystatus-level clearing
of SPACE and C when in side-view mode. Now, this is accomplished by checking
directly in the overheadeditor code.

git-svn-id: https://svn.eduke32.com/eduke32@2119 1a8010ca-5511-0410-912e-c29ae57300e0
2011-11-25 09:50:07 +00:00
helixhorned 568a7e1243 Eliminate potential malloc(0) calls when loading (converting) md2 models
with no skins or no GL comands.

git-svn-id: https://svn.eduke32.com/eduke32@2118 1a8010ca-5511-0410-912e-c29ae57300e0
2011-11-25 09:49:40 +00:00
helixhorned ac12a06de4 Fix calling glEnable() without checking for the rendering mode in the tile
selector. This could lead to a crash when OpenGL wasn't initialized before.

git-svn-id: https://svn.eduke32.com/eduke32@2117 1a8010ca-5511-0410-912e-c29ae57300e0
2011-11-25 09:49:22 +00:00