Commit Graph

478 Commits

Author SHA1 Message Date
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 be899ba3af For novelty, add support for RENDERTYPE=SDL under Windows.
This needs improvements to bring it up to par with winlayer, but it is functional. In particular, a good amount of code from winlayer could be used for both layers, including the profiling timers, the version printing code, and the hInstance and hModule sharing.

Known problems: the mouse cursor is not trapped, and the game starts before the startup window shows options.

git-svn-id: https://svn.eduke32.com/eduke32@3219 1a8010ca-5511-0410-912e-c29ae57300e0
2012-11-24 09:13:29 +00:00
terminx f9ba5f827c Relocate Bstrncpyz to the bottom of compat.h so we can use our Bstrncpy macro there
git-svn-id: https://svn.eduke32.com/eduke32@3213 1a8010ca-5511-0410-912e-c29ae57300e0
2012-11-20 01:33:22 +00:00
helixhorned 0316868c75 Clean up engine code by factoring repeated 3-liners into spriteheightofs().
This function also changed: it doesn't handle floor-aligned sprites now,
and the z offset is returned instead of set by pointer.

git-svn-id: https://svn.eduke32.com/eduke32@3205 1a8010ca-5511-0410-912e-c29ae57300e0
2012-11-17 19:46:43 +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
terminx 626180dd3f Make GCC *printf_nowarn behavior conditional on compiling as C++
git-svn-id: https://svn.eduke32.com/eduke32@3190 1a8010ca-5511-0410-912e-c29ae57300e0
2012-11-15 23:35:40 +00:00
helixhorned 5e049afa5d Probably fix the zoom crash encountered with Mapster32 and CBP8.
Described here:
http://forums.duke4.net/topic/3857-the-crash-thread/page__view__findpost__p__141202

git-svn-id: https://svn.eduke32.com/eduke32@3188 1a8010ca-5511-0410-912e-c29ae57300e0
2012-11-15 21:10:00 +00:00
helixhorned 9434025e6d Minor loadpics() cleanups, don't expose filegrp[] from cache1d.c.
git-svn-id: https://svn.eduke32.com/eduke32@3187 1a8010ca-5511-0410-912e-c29ae57300e0
2012-11-15 21:09:56 +00:00
helixhorned 6547495cac Split r3159..r3161, part 14: The rest.
git-svn-id: https://svn.eduke32.com/eduke32@3180 1a8010ca-5511-0410-912e-c29ae57300e0
2012-11-15 14:28:47 +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 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 6d5d415ea5 Split r3159..r3161, part 6: code conditional on __cplusplus.
Note the type change of vplce[] in engine.c: int32_t -> uint32_t.

git-svn-id: https://svn.eduke32.com/eduke32@3172 1a8010ca-5511-0410-912e-c29ae57300e0
2012-11-15 14:28:11 +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 9dd3748b03 Split r3159..r3161, part 3: MSVC, nedmalloc, *layer, startup windows.
git-svn-id: https://svn.eduke32.com/eduke32@3168 1a8010ca-5511-0410-912e-c29ae57300e0
2012-11-15 14:27:57 +00:00
helixhorned d37278ec58 Split r3159..r3161, part 2: C++ tracker headers.
git-svn-id: https://svn.eduke32.com/eduke32@3167 1a8010ca-5511-0410-912e-c29ae57300e0
2012-11-15 14:27:51 +00:00
helixhorned 1cd11d06ef Revert "Fix the warnings when building with C++, add MSVC C++ build support."
This reverts r3159..r3161.

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

git-svn-id: https://svn.eduke32.com/eduke32@3165 1a8010ca-5511-0410-912e-c29ae57300e0
2012-11-15 14:27:45 +00:00
hendricks266 a418bec8c2 Tools updates:
- Eliminate use of the C++ standard library from arttool. I improved some of the program's workings but it continues to corrupt my art files in certain circumstances. (Note: Not a regression; it happens with previous revisions.)
- Construct "make utils" for the game side following the pattern of the engine.
- Move ivfrate to this new distinction.
- Minor Makefile cleanup and tweaks, mainly to facilitate CLANG=1 and to formalize text output in special cases.

git-svn-id: https://svn.eduke32.com/eduke32@3163 1a8010ca-5511-0410-912e-c29ae57300e0
2012-11-15 06:42:37 +00:00
hendricks266 c6bbb0547b Fix CPLUSPLUS=1 CLANG=1 building, and fix the "gotpic used attribute ignored" warning produced by clang.
git-svn-id: https://svn.eduke32.com/eduke32@3162 1a8010ca-5511-0410-912e-c29ae57300e0
2012-11-15 06:42:00 +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 d85f529b74 Introduce a per-tile bit preventing fullbrights in GL modes, use for LOADSCREEN.
git-svn-id: https://svn.eduke32.com/eduke32@3145 1a8010ca-5511-0410-912e-c29ae57300e0
2012-11-10 14:11:17 +00:00
Plagman 861eea9b16 Make glbuild C++-safe.
git-svn-id: https://svn.eduke32.com/eduke32@3141 1a8010ca-5511-0410-912e-c29ae57300e0
2012-11-10 06:09:51 +00:00
Plagman a1b82232fd Fix warnings from pointer math with the trackers.
git-svn-id: https://svn.eduke32.com/eduke32@3139 1a8010ca-5511-0410-912e-c29ae57300e0
2012-11-10 01:53:50 +00:00
Plagman a0dd0c85a5 Add automatic tracking to the sector[], wall[], sprite[] and tsprite[]
arrays; any write access to them will run the corresponding hook and write
to the [sector/wall/sprite/tsprite]clean array.

Note: tsprite and sprite use the same hook and require running a few more
instructions per access in order to disambiguiate; this could be made more
optimal (like the other arrays) by clearly separating the types in the game
code.

Note #2: taking a member's address currently marks it dirty because of tons
of helper functions across the editor code. I don't know how many read-only
accesses we have after taking a member address, but it could also be fixed
with some finessing of the code.

git-svn-id: https://svn.eduke32.com/eduke32@3138 1a8010ca-5511-0410-912e-c29ae57300e0
2012-11-09 22:31:02 +00:00
Plagman 27a39f1982 Fix the Linux mapster32 build with LTO enabled.
git-svn-id: https://svn.eduke32.com/eduke32@3136 1a8010ca-5511-0410-912e-c29ae57300e0
2012-11-09 17:35:58 +00:00
helixhorned 2b583ebf4c Fix building with SDL 1.2.
git-svn-id: https://svn.eduke32.com/eduke32@3120 1a8010ca-5511-0410-912e-c29ae57300e0
2012-11-05 20:04:02 +00:00
Plagman 548f939df5 Add horrible tracking template; for each structure you'll want to create a
separate tracker type by #defining __TRACKER_NAME and __TRACKER_GLOBAL_OFFSET.

eg.:

Then if you have a tracked value and a value of the same type at the given offset:

Tracker_1<int32_t> trackedInt;
int32_t trackedIntDirty = 0; // 4 bytes after

trackedIntDirty will become 1 everytime trackedInt changes.

git-svn-id: https://svn.eduke32.com/eduke32@3119 1a8010ca-5511-0410-912e-c29ae57300e0
2012-11-05 04:34:23 +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 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 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
terminx a5f479787f Remove built-in copy of nedmalloc and update nedmalloc.dll. Note that the built-in copy of nedmalloc hasn't been updated or enabled in a really long time as modern system allocators (Windows 7 and Linux 3.x at least) are no longer consistently beat by nedmalloc (but nor are they consistently faster). So, the dll remains for users of Windows XP because it may still improve performance there (while not likely degrading it on Vista/7).
git-svn-id: https://svn.eduke32.com/eduke32@3086 1a8010ca-5511-0410-912e-c29ae57300e0
2012-10-15 00:17:30 +00:00
helixhorned d5f7e5becf Texel-granular hitscan() for wall-aligned sprites.
The attribute is set per tile from DEF: either
    texhitscanrange <begintile> <endtile>
or
    tilefromtexture <tile> { ... texhitscan ... }
(As a special case, the list may only contain "texhitscan", in which case the
texture is not changed.)

In passing, do some cleanup for "tilefromtexture" DEF parsing: the list tokens
should now be accepted in any order, and errors don't appear in the middle of
the list parsing.

git-svn-id: https://svn.eduke32.com/eduke32@3078 1a8010ca-5511-0410-912e-c29ae57300e0
2012-10-14 20:41:34 +00:00
helixhorned 5b311f98cc Clean up redundant/local function declarations in build.c.
git-svn-id: https://svn.eduke32.com/eduke32@3061 1a8010ca-5511-0410-912e-c29ae57300e0
2012-10-07 15:26:17 +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 f10bfb6774 A bit stylistic Polymost code cleanup.
git-svn-id: https://svn.eduke32.com/eduke32@3041 1a8010ca-5511-0410-912e-c29ae57300e0
2012-10-01 17:52:25 +00:00
helixhorned b3daea46d6 Add compilation switch MODEL_OCCLUSION_CHECKING to polymost.h, leave it enabled.
git-svn-id: https://svn.eduke32.com/eduke32@3040 1a8010ca-5511-0410-912e-c29ae57300e0
2012-10-01 17:52:22 +00:00
helixhorned 735d1ed77e Remove last argument from yax_getneighborsect(), make radarang[] engine.c-local.
git-svn-id: https://svn.eduke32.com/eduke32@3039 1a8010ca-5511-0410-912e-c29ae57300e0
2012-10-01 17:52:18 +00:00
helixhorned 2ab247b68a A couple of inside()-related cleanups.
- make inside_editor() static in build.c
- replace comparisons of inside()'s return values with 0 by ones with 1
  (since a returned 0 can mean -1 or 1, i.e. oob sector or is really inside)
- prevent a theoretically possible oob access in correct_ornamented_sprite()

git-svn-id: https://svn.eduke32.com/eduke32@3038 1a8010ca-5511-0410-912e-c29ae57300e0
2012-10-01 17:52:13 +00:00
helixhorned d4ff4c4595 Clean up updatesector* family, no functional changes.
- factor out the "is inside" predicates
- rename updatesector_onlynextwalls() -> updatesectorbreadth()
- add ATTRIBUTE((nonnull(4))) to the bitmap arg of updatesectorexclude().

git-svn-id: https://svn.eduke32.com/eduke32@3037 1a8010ca-5511-0410-912e-c29ae57300e0
2012-10-01 17:52:09 +00:00
helixhorned 7e05f5884c With SDL 1.2 builds, make the profiling be cancelable by pressing any key.
git-svn-id: https://svn.eduke32.com/eduke32@3022 1a8010ca-5511-0410-912e-c29ae57300e0
2012-09-15 15:28:30 +00:00
helixhorned 06a64b8dd4 OSD command 'map': entering a name with a '*' wildcard lists those that match.
A new function maybe_append_ext() is added to common.c and used in the handling
of the -d<demo.edm> cmdline parameter and the 'map' OSD command with one
non-wildcard arg.  (It's slightly different from the way the extension was
maybe-appended previously.)

git-svn-id: https://svn.eduke32.com/eduke32@3004 1a8010ca-5511-0410-912e-c29ae57300e0
2012-09-08 22:18:31 +00:00
helixhorned 9311432cbf Fix crash when recording demo, stooping it, going to title screen, and exiting.
A macro MAYBE_FCLOSE_AND_NULL(fileptr) is introduced in compat.h that does
what it says.

git-svn-id: https://svn.eduke32.com/eduke32@2995 1a8010ca-5511-0410-912e-c29ae57300e0
2012-09-05 17:25:31 +00:00
helixhorned 202d544f14 compat.h: tweak indentation of some preprocessing directives.
git-svn-id: https://svn.eduke32.com/eduke32@2992 1a8010ca-5511-0410-912e-c29ae57300e0
2012-09-02 14:13:06 +00:00
helixhorned 72b73f6356 Make getangle() a __fastcall function instead of static inline.
This trims four 4k pages of code from the release EDuke32 build and
one page from Mapster32.

git-svn-id: https://svn.eduke32.com/eduke32@2991 1a8010ca-5511-0410-912e-c29ae57300e0
2012-09-02 14:12:01 +00:00
helixhorned ee39d713e8 Calculate sine and arctan tables, getting rid of TABLES.DAT dependency.
We're pulling stuff from math.h even in non-GL builds right now, so
adding libc's sin() and atan() doesn't seem like a big deal.  In the
unlikely event that their accuracy is so bad that the calculated tables
don't match the original ones, a warning is issued on little-endian
platforms.

git-svn-id: https://svn.eduke32.com/eduke32@2988 1a8010ca-5511-0410-912e-c29ae57300e0
2012-09-02 14:08:43 +00:00
helixhorned 5bca5f59ad Move #define PI from to build.h, add bound-checking assertion in dosetaspect().
git-svn-id: https://svn.eduke32.com/eduke32@2987 1a8010ca-5511-0410-912e-c29ae57300e0
2012-09-02 14:07:36 +00:00
helixhorned 52bb35361b Some [U]INT_MAX --> [U]INT32_MAX.
git-svn-id: https://svn.eduke32.com/eduke32@2986 1a8010ca-5511-0410-912e-c29ae57300e0
2012-09-02 14:06:30 +00:00