Commit Graph

651 Commits

Author SHA1 Message Date
helixhorned 7e7507746d Factor out common parts of loading LOOKUP.DAT into engine.c:loadlookups().
Also, error if didn't read enough data and account for TITLE and REALMS
swap between basepal number and on-disk order (sigh).

git-svn-id: https://svn.eduke32.com/eduke32@4334 1a8010ca-5511-0410-912e-c29ae57300e0
2014-02-16 19:16:03 +00:00
hendricks266 3b5dea7347 Fix warnings when building in C++11 mode, i.e. with CPLUSPLUS=1 CUSTOMOPT="--std=gnu++11".
git-svn-id: https://svn.eduke32.com/eduke32@4321 1a8010ca-5511-0410-912e-c29ae57300e0
2014-02-10 11:00:07 +00:00
hendricks266 7deb709ab6 Replace QuickLZ with LZ4.
git-svn-id: https://svn.eduke32.com/eduke32@4316 1a8010ca-5511-0410-912e-c29ae57300e0
2014-02-10 10:55:49 +00:00
helixhorned ad8d6795e2 In the C code, rename sprite[].filler to 'blend'.
Also, fix a missed .filler -> g_ambiencePlaying[] rewrite in the editor.
In C-CON, 'detail' is kept as alias to C-side (former) .filler / now .blend,
but that name is *deprecated*.

git-svn-id: https://svn.eduke32.com/eduke32@4305 1a8010ca-5511-0410-912e-c29ae57300e0
2014-02-08 14:37:55 +00:00
helixhorned 54c74ca78e astub.c: in M32_MoveFX, use separate bit array to store "sound is playing".
Instead of sprite[].filler.

git-svn-id: https://svn.eduke32.com/eduke32@4300 1a8010ca-5511-0410-912e-c29ae57300e0
2014-02-08 14:37:48 +00:00
hendricks266 62abd504ef Print "32-bit"/"64-bit" along with the version number in the log.
git-svn-id: https://svn.eduke32.com/eduke32@4274 1a8010ca-5511-0410-912e-c29ae57300e0
2014-01-27 10:31:39 +00:00
helixhorned 8b7cb9e6c9 Mapster32: make wall texture alignment [.]/[,] work with bottom-swapped walls.
In simple cases, it should be added. Combinations of alignment across TROR
boundaries and bottom-swapping will probably not work right.

git-svn-id: https://svn.eduke32.com/eduke32@4265 1a8010ca-5511-0410-912e-c29ae57300e0
2014-01-24 21:39:03 +00:00
hendricks266 8fa00afb7c Mapster32: Add EVENT_LOADMAP, EVENT_SAVEMAP, EVENT_PRELOADMAP, and EVENT_PRESAVEMAP.
Some are more useful than others.

git-svn-id: https://svn.eduke32.com/eduke32@4244 1a8010ca-5511-0410-912e-c29ae57300e0
2014-01-12 14:03:00 +00:00
helixhorned e71df2b6e3 Lunatic/m32: make Mapster23 actually start stand-alone, oops.
git-svn-id: https://svn.eduke32.com/eduke32@4238 1a8010ca-5511-0410-912e-c29ae57300e0
2014-01-02 00:08:36 +00:00
helixhorned 49de6d79b3 Lunatic/m32: include the Lua bytecode into the binary, exit if setup failed.
git-svn-id: https://svn.eduke32.com/eduke32@4237 1a8010ca-5511-0410-912e-c29ae57300e0
2013-12-31 11:52:01 +00:00
hendricks266 cfedcbd7d7 Rewrite and unify the handling of the scrollwheel between layers, fixing it in the editor's 2D mode and tile selector under SDL.
The scrollwheel is unique among PC input because it has no innate "hold length". Previously, the layers gave the mousewheel a fake hold length to allow the not-necessarily-synchronous game/editor code to pick up the input before the layers marked it as "no longer pressed". This passed under Windows, but it didn't slide under SDL.

Besides the two problems listed above, it also potentially limited the rate of weapon selection, where scrolling too fast would not register every clicks. [Unrelatedly, this is still the case when you scroll faster than the game's own tickrate, but addressing that would require rewriting input handling to go through a list of "events" for each tic instead of looking at overall pressed/unpressed states.]

git-svn-id: https://svn.eduke32.com/eduke32@4200 1a8010ca-5511-0410-912e-c29ae57300e0
2013-12-20 07:24:09 +00:00
helixhorned bc54631888 a.m32: add [']+[F] menu function setting xvel=1 on all sel. wall/floor sprites.
For sanitizing underwater sections, see r4166.
Also, don't print "Menu function executed successfully" when the function
printed something itself.

git-svn-id: https://svn.eduke32.com/eduke32@4169 1a8010ca-5511-0410-912e-c29ae57300e0
2013-11-19 19:00:02 +00:00
helixhorned 794edf18ff Lunatic: add 'lua' OSD command, permitting to execute arbitrary code.
That is, everything that would be possible via scripting.

git-svn-id: https://svn.eduke32.com/eduke32@4134 1a8010ca-5511-0410-912e-c29ae57300e0
2013-11-04 22:56:03 +00:00
hendricks266 ccf7d2d470 Allow -g, -x, -h, -j, and for the game, -d, to take their file name after a space. This allows quotes to be used with them properly.
I updated the help windows to prefer these variants because they are superior to the -xSquished versions.
Also, factor out the command-line processing code for the above, plus con/def modules and clipmaps.

git-svn-id: https://svn.eduke32.com/eduke32@4128 1a8010ca-5511-0410-912e-c29ae57300e0
2013-11-03 04:02:23 +00:00
helixhorned c2797e4b11 Mapster32: take initial map file name from ExtPreInit()->G_CheckCommandLine().
Instead of directly in build.c:app_main(). Previously, it was possible that an
argument to an option, e.g. "WGR2" with "-game_dir WGR2", would get interpreted
as the initial map to load. This in turn would attempt to execute WGR2.cfg as
sequence of OSD commands -- where that file is an EDuke32 config file instead!

Now: maps are passed without any options, e.g. "mapster32 [opts...] debug.map".
The map file name is not added to the "additional parameters" for map testing.

git-svn-id: https://svn.eduke32.com/eduke32@4121 1a8010ca-5511-0410-912e-c29ae57300e0
2013-10-28 21:26:25 +00:00
hendricks266 4f2bc62dc2 Fix USE_OPENGL=0 build.
git-svn-id: https://svn.eduke32.com/eduke32@4081 1a8010ca-5511-0410-912e-c29ae57300e0
2013-10-07 10:03:49 +00:00
hendricks266 a831f408e4 Fix building of astub.c with MinGW 4.8.
We have to work around namespace pollution in <sys/stat.h>.

git-svn-id: https://svn.eduke32.com/eduke32@4072 1a8010ca-5511-0410-912e-c29ae57300e0
2013-10-06 07:49:10 +00:00
helixhorned 514a3bfd64 Prevent calling function pointers cast to an incompatible type.
Most often, this had happened when casting comparison functions for qsort()
like these: "int yax_cmpbunches(const int16_t *b1, const int16_t *b2)"
to a function pointer type expecting "const void *". Alas, this is undefined
behavior: see
http://blog.frama-c.com/index.php?post/2013/08/24/Function-pointers-in-C
and posts linked from it.

At least two cases have not been fixed:
- The savegame system maintains pointers which are either to data or a function in
  the generic "void *". This ought to be made into a union.
- Probably also:
  #define OSD_ALIAS     (int32_t (*)(const osdfuncparm_t*))0x1337

git-svn-id: https://svn.eduke32.com/eduke32@4068 1a8010ca-5511-0410-912e-c29ae57300e0
2013-09-21 13:38:44 +00:00
helixhorned 14467dec24 Replace literal g_sounds[].m bits with enum constants. DONT_BUILD.
git-svn-id: https://svn.eduke32.com/eduke32@4055 1a8010ca-5511-0410-912e-c29ae57300e0
2013-09-08 20:18:56 +00:00
helixhorned 1328c66f9c Lunatic: add option -Lopts=... from command line.
Permitting to enable various debugging options. See "eduke32 -debughelp"
for which ones those are: they were previously settable from defs_common.lua,
and a new option 'strict' has been added that makes accesses to void sprites
error. (That is, already "sprite[i]", not "sprite[i].some_member".)

git-svn-id: https://svn.eduke32.com/eduke32@4049 1a8010ca-5511-0410-912e-c29ae57300e0
2013-09-05 17:37:46 +00:00
helixhorned a374a401be Clean up parallaxed sky functionality, part 2.
- Rename sky_t members: yscale -> horizfrac, bits -> lognumtiles.
- Add default sky (8 tiles, horizfrac=32768 (i.e. 1/2 the scene horiz), offsets
  all zero) and CLOUDYOCEAN sky (8 tiles, horizfrac=65536, offsets all zero)
  to multipsky[].
- Get rid of "psky_t g_psky", merely maintaining a g_pskyidx instead. Set it up
  at map load time so as to keep the behavior of the legacy per-map psky:
  the last sector index with a matching psky ceiling wins.
- In mapstate_t, save g_pskyidx too, not (former) pskybits and pskyoffs[].
- Make on-map-load global psky setup consistent for the game and editor by
  factoring it out into common.c: G_SetupGlobalPsky().
- Remove a couple of useless initializations, add some static assertions.

This commit is more likely to introduce subtle differences in behavior.
Specifically, getpsky() now always returns the default sky properties instead of
the global sky ones (but with all-zero offsets) when no match for a suiting
multi-psky is found. This is only likely to affect the yscale/horizfrac of
non-multi-pskies when a global non-default multi-psky has been set up.
Bump BYTEVERSION again.

git-svn-id: https://svn.eduke32.com/eduke32@3976 1a8010ca-5511-0410-912e-c29ae57300e0
2013-08-04 20:37:48 +00:00
helixhorned 46e8549b5e Clean up parallaxed sky functionality, part 1.
- Consolidate psky* arrays into a "typedef struct psky_t" "g_psky" and
  "multipsky[]".
- Factor out getting parallaxed sky properties into getpsky().
- Condense initial multi-psky setup by memcpy'ing from multipsky[].
- New function: MultiPsky_TileToIdx().
- Add new define PSKYOFF_MAX and related consistency-checking assertions.
- Lower MAXPSKYTILES to 8 to reflect current usage (was 256).
- Game: make multi-pskies consider dynamically-remapped MOONSKY1, BIGORBIT1
  and LA. (Not very useful as the editor will still only act for the static
  values -- 80, 84 and 89, respectively.)

An attempt has been made to preserve behavior even in strange cases, so this
commit is unlikely to introduce regressions. Because of point 6, BYTEVERSION
had to be bumped.

git-svn-id: https://svn.eduke32.com/eduke32@3975 1a8010ca-5511-0410-912e-c29ae57300e0
2013-08-04 20:37:45 +00:00
helixhorned b2c5e2d807 Mapster32/Lunatic: ask when a <V10 map would be overwritten with a map-text one.
Also, clean up the saving/loading logic a bit:
- On load failure, display message with purple color.
- Take over the current file name ('boardfilename') only on success.
- Check SaveBoard() return values in various places.

git-svn-id: https://svn.eduke32.com/eduke32@3911 1a8010ca-5511-0410-912e-c29ae57300e0
2013-06-28 14:07:44 +00:00
helixhorned 51e021e810 Mapster32: fix construction of *_crash.map file name in crash handler.
git-svn-id: https://svn.eduke32.com/eduke32@3876 1a8010ca-5511-0410-912e-c29ae57300e0
2013-06-13 17:10:56 +00:00
helixhorned 593b82692e Mapster32: allow setting first walls of TROR sectors independently.
In 3D mode, Alt+F now only attempts to set the first wall of the aimed at
wall, not collecting upper/lower neighbors. For this, press Shift+Alt+F.
In 2D mode, they are always collected.

git-svn-id: https://svn.eduke32.com/eduke32@3825 1a8010ca-5511-0410-912e-c29ae57300e0
2013-05-30 18:10:45 +00:00
helixhorned 4457a5fbca Fix potential oob access when flipping the floor [F] in 2D mode.
git-svn-id: https://svn.eduke32.com/eduke32@3824 1a8010ca-5511-0410-912e-c29ae57300e0
2013-05-30 09:13:34 +00:00
helixhorned 560f88b022 Replace inline "qsetmode==200" checks with in3dmode().
Analogously for the negation; remove a couple of redundant decls of "qsetmode".

git-svn-id: https://svn.eduke32.com/eduke32@3823 1a8010ca-5511-0410-912e-c29ae57300e0
2013-05-30 09:13:32 +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
helixhorned fac799b782 Mapster32: make 'corruptcheck tryfix ?' (or '??') not require c. number range.
git-svn-id: https://svn.eduke32.com/eduke32@3747 1a8010ca-5511-0410-912e-c29ae57300e0
2013-05-10 12:31:39 +00:00
helixhorned 9f76b78496 Mapster32: for some nextwall/nextsector corruptions, suggest making wall white.
Selected by writing e.g. 'corruptcheck tryfix 1-14 ??' in the console.
Like with the first alternative, the corruption numbers / range (here, 1-14)
must be given.

git-svn-id: https://svn.eduke32.com/eduke32@3746 1a8010ca-5511-0410-912e-c29ae57300e0
2013-05-10 12:31:38 +00:00
helixhorned 789e26b42f Mapster32 corruptcheck: on nextsector/nextwall oob, suggest making wall white.
... in the auto-correction. Also,
- make two similar corruptions level 5 (wallptr oob, wallptr+wallnum oob).
- in drawscreen_drawwall(), do a more strict bound check, not only >=0.

git-svn-id: https://svn.eduke32.com/eduke32@3745 1a8010ca-5511-0410-912e-c29ae57300e0
2013-05-10 12:31:37 +00:00
helixhorned c86bf550a5 Mapster32 corruptcheck: if some members out of MAX bounds, signal level 5.
git-svn-id: https://svn.eduke32.com/eduke32@3744 1a8010ca-5511-0410-912e-c29ae57300e0
2013-05-10 12:31:35 +00:00
helixhorned 3792cc7312 Mapster32: in quick tile selection [G], if tile is nonexistent, revert it.
git-svn-id: https://svn.eduke32.com/eduke32@3698 1a8010ca-5511-0410-912e-c29ae57300e0
2013-04-21 19:55:26 +00:00
helixhorned 520b608094 Engine: stricter map load time checking for sprites with oob sectnums.
Sprites are now considered to have out of bounds sector numbers if it is
< 0 or >= numsectors (not merely >= MAXSECTORS). If such a sprite is now
encountered during post-load, an attempt is made first to assign it a sector
number (using updatesector()). If that fails, the sprite is removed from the
map.  The background is that a dozen of maps do come with such sprites and
could previously corrupt the sprite list when loaded.

git-svn-id: https://svn.eduke32.com/eduke32@3696 1a8010ca-5511-0410-912e-c29ae57300e0
2013-04-21 19:55:18 +00:00
helixhorned 1773ac9276 Mapster32: print the "Saved board" message more persistently.
git-svn-id: https://svn.eduke32.com/eduke32@3659 1a8010ca-5511-0410-912e-c29ae57300e0
2013-04-09 17:35:14 +00:00
helixhorned 7b6bf4dda2 Lunatic: new-generation map format, in-memory representation ("map-int VX").
The Lunatic build compiles with new structures for sector and wall types.
They have separate members for TROR {up,down}{bunch,nextwall}, so there are
no conflicts with other uses of members into which they were previously
shoehorned.  Also, the maximum bunch limit is bumped to 512 in that build.

Currently, loading from V7/8/9 and saving to V7 and V8 are supported.

git-svn-id: https://svn.eduke32.com/eduke32@3658 1a8010ca-5511-0410-912e-c29ae57300e0
2013-04-09 17:35:11 +00:00
helixhorned ebb71cf4ab Mapster32: don't wrongly report PANIC corruption with MAXSPRITES sprites present.
git-svn-id: https://svn.eduke32.com/eduke32@3599 1a8010ca-5511-0410-912e-c29ae57300e0
2013-03-24 18:53:56 +00:00
hendricks266 ec1923b417 Wii: Fix Mapster32. It runs now.
git-svn-id: https://svn.eduke32.com/eduke32@3582 1a8010ca-5511-0410-912e-c29ae57300e0
2013-03-21 09:49:12 +00:00
hendricks266 bdc4f7cd68 Windows: Add the default installation paths for the GOG.com release of Duke Nukem 3D: Atomic Edition and the Steam release of Duke Nukem 3D: Megaton Edition (if they exist) to EDuke32's search path.
git-svn-id: https://svn.eduke32.com/eduke32@3581 1a8010ca-5511-0410-912e-c29ae57300e0
2013-03-21 09:48:21 +00:00
helixhorned 1685228ab7 Lunatic: compile defs.ilua as bytecode and load it from the executable.
git-svn-id: https://svn.eduke32.com/eduke32@3517 1a8010ca-5511-0410-912e-c29ae57300e0
2013-02-24 16:05:31 +00:00
helixhorned 0796c0e66e Don't apply GL fogging to wall lines drawn in game's "light" overhead view.
git-svn-id: https://svn.eduke32.com/eduke32@3438 1a8010ca-5511-0410-912e-c29ae57300e0
2013-01-26 17:07:58 +00:00
helixhorned f0bf345233 Mapster32: fix cycling to the next link sprite with LShift+"]", tweak message.
git-svn-id: https://svn.eduke32.com/eduke32@3424 1a8010ca-5511-0410-912e-c29ae57300e0
2013-01-23 19:36:36 +00:00
helixhorned dc9f4eb360 Mapster32: add cvar/mapster32.cfg option "keeptexturestretch".
If enabled, dragging wall vertices will correct the xrepeat after the
mouse button is released, so that the pre-drag absolute stretching is
restored.

git-svn-id: https://svn.eduke32.com/eduke32@3398 1a8010ca-5511-0410-912e-c29ae57300e0
2013-01-16 20:38:56 +00:00
helixhorned 8bca521ef4 Mapster32: slightly rework code for setting/querying some cvars.
git-svn-id: https://svn.eduke32.com/eduke32@3397 1a8010ca-5511-0410-912e-c29ae57300e0
2013-01-16 20:38:52 +00:00
helixhorned 0648d25db1 Mapster32: more or less fix the auto wall-alignment feature ([.]/[,]).
- Run it twice, since the first one is wrong.
- Warn when attempting to align based on a top-oriented wall. When the
  sequence of walls to align has "windows", only the bottom parts will
  be correct.
- Make the modifiers actually useful:
  * Pressing SHIFT aligns at most one wall, remove the old CTRL modifier.
  * The rest is as before: ALT makes the walls have (approximately) equal
    texture stretching, ['] (quote) aligns the immediate TROR-nextwalls.

git-svn-id: https://svn.eduke32.com/eduke32@3396 1a8010ca-5511-0410-912e-c29ae57300e0
2013-01-16 20:38:50 +00:00
helixhorned 8fb886b14a Replace dragpoint()'s "dragpoint_noreset" global with a "flags" argument.
Also, add another flag, signifying that from the editor, also the
"lastwall"s (i.e. the CCW-linked points) should get collected. This is
to signal the editor that their wall lengths should be displayed, too.

git-svn-id: https://svn.eduke32.com/eduke32@3394 1a8010ca-5511-0410-912e-c29ae57300e0
2013-01-16 20:38:41 +00:00
helixhorned 7d2dd223bb Mapster32: don't apply GL fogging to crosshair.
git-svn-id: https://svn.eduke32.com/eduke32@3389 1a8010ca-5511-0410-912e-c29ae57300e0
2013-01-13 16:40:14 +00:00
helixhorned 222e92ef37 Make r_downsize 0 by default.
Also, rewrite comparison to the non-tint in astub.c to be even less hackish.

git-svn-id: https://svn.eduke32.com/eduke32@3387 1a8010ca-5511-0410-912e-c29ae57300e0
2013-01-08 23:12:59 +00:00
hendricks266 8bb14fa13e Fix warnings that appear if big-endian || USE_OPENGL=0.
git-svn-id: https://svn.eduke32.com/eduke32@3382 1a8010ca-5511-0410-912e-c29ae57300e0
2013-01-08 06:17:10 +00:00
terminx 79e45c23d5 Add predefined REND_CLASSIC, REND_POLYMOST and REND_POLYMER constants and use them everywhere getrendermode() is called.
git-svn-id: https://svn.eduke32.com/eduke32@3346 1a8010ca-5511-0410-912e-c29ae57300e0
2012-12-30 20:34:34 +00:00
hendricks266 b6ddc6149e Replace initialize_globals() with global initialization.
git-svn-id: https://svn.eduke32.com/eduke32@3337 1a8010ca-5511-0410-912e-c29ae57300e0
2012-12-29 10:58:38 +00:00
hendricks266 11e0897def Fix the gap between loops of ambient MUSICANDSFX sounds like BAR_MUSIC.
git-svn-id: https://svn.eduke32.com/eduke32@3336 1a8010ca-5511-0410-912e-c29ae57300e0
2012-12-29 10:58:09 +00:00
helixhorned 0dd78fb029 Cleanup of console/on-screen-display (OSD) functionality.
- Rewrite the "clear background" routine in a no-brainer way instead of
  juggling around with rotatesprite(). Make it common to game+editor.
  Expose glRectd to glbuild.
- Don't stop OSD text line drawing when encountering a non-printable char.
  Instead, treat it as space.
- In OSD_SetTextMode(), don't use swaplong (which really swaps 32-bit ints)
  to swap pointers. Write an analogous "swapptr" instead.
- When changing from/to OSD, don't inject a pause key. This *might* have been
  the cause of the reported pausing problems.
- clean up the code...
(Yes, this commit throws together too much stuff. I suck sometimes. :P)

git-svn-id: https://svn.eduke32.com/eduke32@3321 1a8010ca-5511-0410-912e-c29ae57300e0
2012-12-25 16:13:50 +00:00
helixhorned 518ac7b4df Mapster32: in 3D mode's tile info, highlight members of swapped bottom walls.
- If aiming at a swapped bottom wall, display "Wall <wallnum> -> <otherwallnum>"
- highlight pic, shade, pal, cstat in yellow then
- in printext256, accept at most 3 digits for the color format string (e.g. ^123)

git-svn-id: https://svn.eduke32.com/eduke32@3308 1a8010ca-5511-0410-912e-c29ae57300e0
2012-12-20 12:04:39 +00:00
helixhorned 192e863dd6 Mapster32: when pasting single wall, take over bits 4, 1+64 and 8+256.
That is, everything concerning orientation. Previously, it was wrongly
the bitwise NOT of these bits that got taken over. In particular, if bit
2 (swap bottom walls) would get pasted, ridiculousness could ensue.

git-svn-id: https://svn.eduke32.com/eduke32@3306 1a8010ca-5511-0410-912e-c29ae57300e0
2012-12-18 22:40:49 +00:00
helixhorned 5bda3a6ebf Don't enable fog in polymost_printext256() and when drawing tile view in M32.
The new "r_usenewshading 2" mode could darken these otherwise.

git-svn-id: https://svn.eduke32.com/eduke32@3302 1a8010ca-5511-0410-912e-c29ae57300e0
2012-12-16 19:18:13 +00:00
helixhorned 243bea66dd Mapster32: correct message when changing shade by small steps ([+], [-], mwheel)
git-svn-id: https://svn.eduke32.com/eduke32@3289 1a8010ca-5511-0410-912e-c29ae57300e0
2012-12-14 19:28:11 +00:00
helixhorned 92dabb3694 Rename global visibility to g_visibility, remove useless casts & old fog code.
git-svn-id: https://svn.eduke32.com/eduke32@3287 1a8010ca-5511-0410-912e-c29ae57300e0
2012-12-14 19:28:05 +00:00
helixhorned 049e63d7f3 Mapster32: In 3D mode, [,] auto-aligns walls to the left.
git-svn-id: https://svn.eduke32.com/eduke32@3281 1a8010ca-5511-0410-912e-c29ae57300e0
2012-12-13 22:21:22 +00:00
helixhorned 7614a78cc5 Factor dist() and ldist() into common.c.
git-svn-id: https://svn.eduke32.com/eduke32@3243 1a8010ca-5511-0410-912e-c29ae57300e0
2012-11-29 12:49:38 +00:00
hendricks266 890aba88eb Fix warnings involving printf() requiring explicit casts on tracked types.
git-svn-id: https://svn.eduke32.com/eduke32@3238 1a8010ca-5511-0410-912e-c29ae57300e0
2012-11-26 08:26:04 +00:00
hendricks266 5e0ffb93b3 RENDERTYPE=SDL on Windows, part 2.
This introduces winbits.[ch] in the engine, containing layer-independent code migrated from winlayer, including nedmalloc, ebacktrace1, OS version detection, and high-resolution profiling timers.

sdlayer has been expanded to include the code from winbits under _WIN32.

All uses of RENDERTYPEWIN in the source have been examined and changed to _WIN32 (or removed) where the block in question is layer-independent.

git-svn-id: https://svn.eduke32.com/eduke32@3221 1a8010ca-5511-0410-912e-c29ae57300e0
2012-11-25 04:26:37 +00:00
hendricks266 9a75f0b88c Factor G_MultiPskyInit into common.c.
git-svn-id: https://svn.eduke32.com/eduke32@3220 1a8010ca-5511-0410-912e-c29ae57300e0
2012-11-25 04:25:31 +00:00
helixhorned dd424fac70 Mapster32: fix cycling picnum in 3D mode.
Using non-keypad [-]/[+] or LMB + mousewheel, it was broken when a void
tile was in between.

git-svn-id: https://svn.eduke32.com/eduke32@3203 1a8010ca-5511-0410-912e-c29ae57300e0
2012-11-17 19:46:33 +00:00
helixhorned 44904b12be Clean up picanm[] by making its elements values of struct type picanm_t.
The size of that struct is currently 4, and its layout almost the same as
what is read in with loadpics().  The number of tiles in an animation is
bumped to 256, so that the max. tile difference in DEF's animtilerange is
255. (There's no way to have such animations from ART.)

git-svn-id: https://svn.eduke32.com/eduke32@3202 1a8010ca-5511-0410-912e-c29ae57300e0
2012-11-17 19:46:28 +00:00
helixhorned 0a999d7a7e Mapster32: Fix clipboard tile display in 3D mode.
git-svn-id: https://svn.eduke32.com/eduke32@3183 1a8010ca-5511-0410-912e-c29ae57300e0
2012-11-15 14:28:55 +00:00
helixhorned 107fa9cc39 Split r3159..r3161, part 12: Add explicit casts, non-pointer types.
Notes:
 - Atomic Edition (Censored) -> Plutonium Pak in grpscan.c
 - "scale" in astub.c:drawtileinfo() is incorrect, I think.
 - in demo.c, the gethitickms() value should be returned to a double.

git-svn-id: https://svn.eduke32.com/eduke32@3178 1a8010ca-5511-0410-912e-c29ae57300e0
2012-11-15 14:28:41 +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 2cb3734f85 Split r3159..r3161, part 8: make some members of base types unsigned.
NOTE: This will need very thorough review.

git-svn-id: https://svn.eduke32.com/eduke32@3174 1a8010ca-5511-0410-912e-c29ae57300e0
2012-11-15 14:28:18 +00:00
helixhorned 274726be9b Split r3159..r3161, part 5: "nowarn" wrapping of printing functions.
git-svn-id: https://svn.eduke32.com/eduke32@3170 1a8010ca-5511-0410-912e-c29ae57300e0
2012-11-15 14:28:04 +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
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
helixhorned 3bcdc5acb8 Lunatic reorganization part 2: split into engine and editor/game parts.
On the engine side (functions starting with L_), there are now the basic
parts like state creation and running code from strings and files.
The game and editor can add to that by e.g. loading whatever they please
into the state. Their functions start with El_ and Em_, respectively.
The Lua scripts still reside in source/lunatic, even for the common ones.
This is because they will be embedded into the binaries as bytecode or
compressed source eventually, so their location on disk will be irrelevant.

git-svn-id: https://svn.eduke32.com/eduke32@3148 1a8010ca-5511-0410-912e-c29ae57300e0
2012-11-10 20:59:00 +00:00
helixhorned c71b3d529c Classic: fix rotatesprite with no screen scaling and non-widescreen aspects.
Also, enable showing sprites in Mapster32's overhead view again, since that
was one (the only?) use of that code path.  The uninitialized read was
introduced in r2927.

git-svn-id: https://svn.eduke32.com/eduke32@3144 1a8010ca-5511-0410-912e-c29ae57300e0
2012-11-10 14:11:13 +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 20f0f21986 engine.c: add bound-check assert failing for sprites in m32's textured 2D mode.
Also, disable drawing sprites in that mode for now.

git-svn-id: https://svn.eduke32.com/eduke32@3114 1a8010ca-5511-0410-912e-c29ae57300e0
2012-11-04 23:03:26 +00:00
helixhorned 65a7ed04f7 Mapster32: functionality to rotate or scale RShift-highlighted stuff smoothly.
This is done by pressing LShift and
 - holding down the left mouse button for scaling, or
 - the right mouse button for rotating the highlighted walls/sprites
with respect to a pivot point determined as the center of the bounding box of
all highlighted points.

Note that scaling sectors isn't that easy and the current functionality is very
rudimentary: there's no z scaling, no xrepeat correction, and sprites aren't
touched expect for their position.  The user is responsible to maintain map
consistency, for example to prevent wall-lines of the same sector crossing
each other.

git-svn-id: https://svn.eduke32.com/eduke32@3113 1a8010ca-5511-0410-912e-c29ae57300e0
2012-11-04 23:03:22 +00:00
helixhorned 737e6e6a17 Mapster32: when looking for matching wall in 2nd pt. ins., don't skip gray nextwalls.
This fixes a bug where it's not possible to split a sector under certain
circumstances, reported by Micky C here:
http://forums.duke4.net/topic/1348-mapster32-problems-and-bugs/page__view__findpost__p__138380

Also, don't allow zero in various 'F functions: Resize selection and
Global {shade, visibility} divide.

git-svn-id: https://svn.eduke32.com/eduke32@3112 1a8010ca-5511-0410-912e-c29ae57300e0
2012-11-04 23:03:16 +00:00
helixhorned e6fdb25d6d Mapster32: draw lines to linking sprites with LShift, jump to them with +[ or +]
When LShift is pressed and the mouse is over a linking sprite (as determined by
the tag labeling system), lines are drawn to all other sprites, and pressing
[ or ] will cycle these then. False positives and missed sprites are possible.

Additional changes:
 - consider SE 31 and 32's lotag to NOT be linking, since the ACTIVATOR is what
   matters.  The original maps are inconsistent there.
 - When pressing Alt+[ or Alt+] and there are no corruptions, say so instead of
   doing [ or ].

git-svn-id: https://svn.eduke32.com/eduke32@3108 1a8010ca-5511-0410-912e-c29ae57300e0
2012-11-03 19:32:39 +00:00
Plagman e726484ccc polymer: add support for negative lights
And hook them up to cstat 128 (half-submerged, 'c' in mapster).

git-svn-id: https://svn.eduke32.com/eduke32@3092 1a8010ca-5511-0410-912e-c29ae57300e0
2012-10-21 04:52:43 +00:00
Plagman 9d10b0b087 polymer: add a prlight flag to make shadow-less spotlights
And hook it up to SE cstat 64 ('1' in mapster32). This disables both lightmaps
and shadow maps for the spotlight; please let me know if you have a usecase
where you want lightmaps but no shadow maps for specific lights.

git-svn-id: https://svn.eduke32.com/eduke32@3091 1a8010ca-5511-0410-912e-c29ae57300e0
2012-10-21 03:41:13 +00:00
helixhorned 3a7b697a32 Lunatic-m32: save command input history.
git-svn-id: https://svn.eduke32.com/eduke32@3062 1a8010ca-5511-0410-912e-c29ae57300e0
2012-10-07 15:26:20 +00:00
helixhorned 2851f412d2 Lunatic-m32: add an OSD command to be able to interface with stuff.
git-svn-id: https://svn.eduke32.com/eduke32@3058 1a8010ca-5511-0410-912e-c29ae57300e0
2012-10-07 15:26:04 +00:00
helixhorned 851c6b081d Lunatic: prototypical editor binding.
git-svn-id: https://svn.eduke32.com/eduke32@3056 1a8010ca-5511-0410-912e-c29ae57300e0
2012-10-07 15:25:52 +00:00
helixhorned 57348c1fdc Mapster32: make 'corruptcheck_noalreadyrefd' a separate OSD command.
Instead of having 'noalreadyrefd' as a 'corruptcheck' subcommand.
This way, TAB completion can be had.

git-svn-id: https://svn.eduke32.com/eduke32@3047 1a8010ca-5511-0410-912e-c29ae57300e0
2012-10-01 17:52:47 +00:00
helixhorned 9d0bffebde Mapster32: factor out some code (3x) into GetSaveBoardFilename().
git-svn-id: https://svn.eduke32.com/eduke32@3046 1a8010ca-5511-0410-912e-c29ae57300e0
2012-10-01 17:52:44 +00:00
helixhorned 9128e8af04 For loadboard() and friends, pass a vec3_t position instead of separate x/y/z.
git-svn-id: https://svn.eduke32.com/eduke32@3042 1a8010ca-5511-0410-912e-c29ae57300e0
2012-10-01 17:52:30 +00:00
helixhorned 599a2049e6 Mapster32: add check for sprites being out of the maximal grid range (+-524288).
Requested auto-correction will place such sprites at their sector's first point.

git-svn-id: https://svn.eduke32.com/eduke32@3029 1a8010ca-5511-0410-912e-c29ae57300e0
2012-09-26 22:53:57 +00:00
helixhorned b8ed142c6b Remove some #if 0 blocks that are probably of no interest any more.
For reference, they are the following:
 - cache1d.c: suckcache()
 - build.c: compare_wall_coords()
 - make switch-invisible heuristic
 - Mapster32: old sprite search
 - Mapster32: manual z range
 - m32script: read/writearray, qgetsysstr
 - menus.c: savetemp()

git-svn-id: https://svn.eduke32.com/eduke32@2981 1a8010ca-5511-0410-912e-c29ae57300e0
2012-09-02 14:00:58 +00:00
helixhorned 13178b7cda Mapster32: properly reset highlights in undo/redo.
git-svn-id: https://svn.eduke32.com/eduke32@2943 1a8010ca-5511-0410-912e-c29ae57300e0
2012-08-20 21:27:42 +00:00
helixhorned 2b2be071d4 High-level TROR drawing: clean up how things are passed around.
git-svn-id: https://svn.eduke32.com/eduke32@2880 1a8010ca-5511-0410-912e-c29ae57300e0
2012-08-13 18:25:37 +00:00
helixhorned bdedbc6f76 Constify various char* vars, parameters, etc. for more -Wwrite-strings cleanness
-Wwrite-strings is useful to detect code where string literals and e.g. alloc'd
strings are used side-by-side, potentially creating dangerous situations, or to
find uses of old, non-constified APIs.  However, enabling it would still flood
the log with too many warnings.  Also, GCC wrongly warns for initializations of
char arrays.

git-svn-id: https://svn.eduke32.com/eduke32@2796 1a8010ca-5511-0410-912e-c29ae57300e0
2012-07-01 22:11:33 +00:00
helixhorned 8a89c07261 editor: const char *scripthist -> char *, since it's alloc'd/freed
git-svn-id: https://svn.eduke32.com/eduke32@2795 1a8010ca-5511-0410-912e-c29ae57300e0
2012-07-01 22:11:25 +00:00
helixhorned 54721d7461 Make ksqrt take uint32_t, add helper function uint32_t uhypsq(int32_t,int32_t).
uhypsq calculates the hypotenuse using unsigned multiplication. This is
permissible since for arbitrary int32s a and b, the following holds in
two's complement arithmetic:
  (int32_t)((uint32_t)a * b) == (int32_t)((int64_t)a * b)
("Signed and unsigned multiplication is the same on the bit level.")

This fixes various overflows where wall lengths for walls of length > 46340
are calculated, but does not rid us of other overflows in the same vein
(usually dot products between vectors where one point is a wall vertex and
the other a position in a sector).

git-svn-id: https://svn.eduke32.com/eduke32@2791 1a8010ca-5511-0410-912e-c29ae57300e0
2012-07-01 22:11:14 +00:00
helixhorned 13a2f97a72 Relative-aligned non-flipped ceiling/floor texture alignment ([;]+[ENTER])
Flipped reference ceilings/floors aren't handled correctly yet.

git-svn-id: https://svn.eduke32.com/eduke32@2774 1a8010ca-5511-0410-912e-c29ae57300e0
2012-06-20 20:55:03 +00:00
helixhorned d741df358d Mapster32: display zero-length walls as level-3 corruptions.
git-svn-id: https://svn.eduke32.com/eduke32@2767 1a8010ca-5511-0410-912e-c29ae57300e0
2012-06-17 19:45:48 +00:00
helixhorned 8d8196993b Mapster32: fix a div by zero when drawing tile info for void tile in 3D mode.
This was exposed by Clang with -ftrapv, which apparently also traps those.

git-svn-id: https://svn.eduke32.com/eduke32@2757 1a8010ca-5511-0410-912e-c29ae57300e0
2012-06-13 23:13:28 +00:00
terminx 169587b5b4 Fix MSVC build error caused by the use of a C99 feature (that should have been added to the compiler about 13 years ago)
git-svn-id: https://svn.eduke32.com/eduke32@2743 1a8010ca-5511-0410-912e-c29ae57300e0
2012-06-07 02:59:24 +00:00
hendricks266 67ed6945fd The handling for grp, con, and def filenames has been massively cleaned up and factored into common.c. A new header, common_game.h, was created because common.h was placed in build/include (see r2542) and we need a common header for things that strictly should not be in the engine. RTS file names were also improved but some of the patterned changes were already made in r2420, and they were not factored because they are strictly part of the game, not the editor.
NAM and Napalm can now share their con, def, and rts files if the one for their respective game is not present because the con and rts files are identical.

Also, decapitalize two string literals missed in r2540.

git-svn-id: https://svn.eduke32.com/eduke32@2726 1a8010ca-5511-0410-912e-c29ae57300e0
2012-06-03 16:09:33 +00:00