Commit Graph

1179 Commits

Author SHA1 Message Date
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 03454c8c3c Clean up texture loading code etc. in polymost.c, no functional changes.
git-svn-id: https://svn.eduke32.com/eduke32@3146 1a8010ca-5511-0410-912e-c29ae57300e0
2012-11-10 14:11:20 +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
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
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 abc3fa4e8d Fix the C++ build on Linux with LTO.
git-svn-id: https://svn.eduke32.com/eduke32@3137 1a8010ca-5511-0410-912e-c29ae57300e0
2012-11-09 18:05:21 +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 2b0bbf4a1c Fix USE_OPENGL=0 build.
git-svn-id: https://svn.eduke32.com/eduke32@3129 1a8010ca-5511-0410-912e-c29ae57300e0
2012-11-08 20:17:15 +00:00
helixhorned d6fe35a7d0 Fix one key <--> multiple gamefuncs dispatching.
git-svn-id: https://svn.eduke32.com/eduke32@3123 1a8010ca-5511-0410-912e-c29ae57300e0
2012-11-06 23:06:31 +00:00
hendricks266 a0c6fb9805 Fix linking with CLANG=1 by separating $(INVOCATION) into $(COMPILER) and $(LINKER) and removing "-x" from clang as a linker in Makefile.common. Additionally, the Build tools are now affected by CPLUSPLUS=1, for which small corrections have been made.
git-svn-id: https://svn.eduke32.com/eduke32@3122 1a8010ca-5511-0410-912e-c29ae57300e0
2012-11-06 07:49:44 +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 10c7206d1c Tweak r3116.
git-svn-id: https://svn.eduke32.com/eduke32@3118 1a8010ca-5511-0410-912e-c29ae57300e0
2012-11-05 03:48:03 +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 0bd8516806 Work around the transparent line with on-screen chaingun and linear filtering.
We do this by messing with the GL texture that gets uploaded for CHAINGUN.
Since this is implemented on the engine side, the static value for CHAINGUN
(2536) is used, and the tile dimensions are compared to 211x55 to have a
little confidence that the tile wasn't overridden by a mod.  Hack indeed.

git-svn-id: https://svn.eduke32.com/eduke32@3111 1a8010ca-5511-0410-912e-c29ae57300e0
2012-11-03 19:32:48 +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
helixhorned d42c28c344 Mapster32: when punching loop, fade screen; tweak two messages.
git-svn-id: https://svn.eduke32.com/eduke32@3106 1a8010ca-5511-0410-912e-c29ae57300e0
2012-11-03 19:32:32 +00:00
terminx 7bd6d504c7 Move win32 "Initialized nedmalloc" message out of the function that prints the Windows version since it doesn't really belong there.
git-svn-id: https://svn.eduke32.com/eduke32@3104 1a8010ca-5511-0410-912e-c29ae57300e0
2012-10-30 16:06:18 +00:00
terminx 8b02800260 A pretty useless fix from a newer version of kplib than we forked from. I'm just tired of seeing it in my tree. ;)
git-svn-id: https://svn.eduke32.com/eduke32@3103 1a8010ca-5511-0410-912e-c29ae57300e0
2012-10-30 16:04:37 +00:00
hendricks266 7e4e760e9c Fix harmless warnings in the Build tools.
git-svn-id: https://svn.eduke32.com/eduke32@3097 1a8010ca-5511-0410-912e-c29ae57300e0
2012-10-29 04:28:10 +00:00
hendricks266 f51bdc2faa Slight makefile reorganization and cleanup.
* Centralize optimization strategies in Makefile.common. This required moving detection of $(PLATFORM), which makes sense if we work on the paradigm that Makefile.common is for generic compiler setup and Makefile.shared works with libraries and things closer to the engine and game code itself.
* New Makefile variables OPTOPT (Optimization Options) and CUSTOMOPT (Custom Optimizations). OPTOPT by default contains -march, -mtune, etc. Setting this variable from Make invocation will blank these. CUSTOMOPT (Custom Optimizations) works the same but in an additive fashion, overwriting nothing. Technically CUSTOMOPT could stand for (Custom Options) and include any additional parameters sent to both linker and compiler.
* Factor out literal names of the main executables.
* The build process now prints assembler (if NOASM=0) and linker settings in addition to compiler settings.

git-svn-id: https://svn.eduke32.com/eduke32@3096 1a8010ca-5511-0410-912e-c29ae57300e0
2012-10-29 04:26:25 +00:00
Plagman 67c7d67166 polymer: only let emitshadow affect shadows, not lightmaps.
Lightmaps are already opt-in anyway.

git-svn-id: https://svn.eduke32.com/eduke32@3093 1a8010ca-5511-0410-912e-c29ae57300e0
2012-10-21 18:41:09 +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 c04bae8c13 Oops! Fix MinGW build issue caused by ripping out nedmalloc
git-svn-id: https://svn.eduke32.com/eduke32@3087 1a8010ca-5511-0410-912e-c29ae57300e0
2012-10-15 00:38:41 +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
terminx ca46dc76ec Move the Windows screen size based aspect ratio determination code down farther into the initialization and change the printed message to only appear when the calculation fails
git-svn-id: https://svn.eduke32.com/eduke32@3085 1a8010ca-5511-0410-912e-c29ae57300e0
2012-10-14 22:22:03 +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
terminx 521ee43173 Fix setting r_pr_maxlightpasses from .cfg at startup
git-svn-id: https://svn.eduke32.com/eduke32@3070 1a8010ca-5511-0410-912e-c29ae57300e0
2012-10-14 14:51:29 +00:00
terminx f7ed6f47de Prevent Windows "case mismatch" spam when loading files from disk with the Windows Explorer "hide extensions for known file types" option enabled. This simply changes the relevant Bstrcmp() calls to Bstrncmp() calls instead, using the length of the string returned by SHGetFileInfo() as the number of bytes to compare.
git-svn-id: https://svn.eduke32.com/eduke32@3068 1a8010ca-5511-0410-912e-c29ae57300e0
2012-10-13 14:53:26 +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 36687ab986 Lunatic-m32: take over load path.
git-svn-id: https://svn.eduke32.com/eduke32@3059 1a8010ca-5511-0410-912e-c29ae57300e0
2012-10-07 15:26:09 +00:00
helixhorned 04a542f1b3 On non-{Windows, OS X}, don't link to libpng when PNG support is not requested.
git-svn-id: https://svn.eduke32.com/eduke32@3050 1a8010ca-5511-0410-912e-c29ae57300e0
2012-10-03 15:29:07 +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 54167d4c7e Factor out prepare/finish parts from load{old,}board(), misc. cleanup.
This means that loadoldboard() now should also initialize Polymer map
info after loading a v5/v6 map.  Make the variables holding a file descriptor
an int32_t instead of int16_t.

git-svn-id: https://svn.eduke32.com/eduke32@3044 1a8010ca-5511-0410-912e-c29ae57300e0
2012-10-01 17:52:37 +00:00
helixhorned 7efc08a919 Rip out v5/v6 map definitions and routines into src/engine_oldmap.h.
git-svn-id: https://svn.eduke32.com/eduke32@3043 1a8010ca-5511-0410-912e-c29ae57300e0
2012-10-01 17:52:34 +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
terminx ead8204e1e Fix a.masm changes so MSVC builds work again. The relevant functionality seems to work (non-power of 2 textures drawn without error), even with CLASSIC_NONPOW2_YSIZE_WALLS defined in engine.c, but I'm not familiar with any corner or edge cases that need to be watched out for with this.
Note: CLASSIC_NONPOW2_YSIZE_WALLS is still not enabled in svn.


git-svn-id: https://svn.eduke32.com/eduke32@3035 1a8010ca-5511-0410-912e-c29ae57300e0
2012-09-30 14:40:42 +00:00
helixhorned ede713af62 engine.c: Split CLASSIC_NONPOW2_YSIZE into _WALLS and _SPRITES, enable the second
git-svn-id: https://svn.eduke32.com/eduke32@3034 1a8010ca-5511-0410-912e-c29ae57300e0
2012-09-28 15:20:13 +00:00
helixhorned beb47f47b5 Port non-pow2 ysize texture mapping routines to MASM, untested.
It's mostly taking over the NASM code, with a couple of changes:
- declarations for externals and globals are slightly different
- the masm seems to have e.g. "dword ptr [...]" where the nasm has only
  "dword [...]", though the masm also has a couple of the latter. The "ptr"
  modifier seems kinda redundant to me, but I added it to every indirection
  anyway.

git-svn-id: https://svn.eduke32.com/eduke32@3033 1a8010ca-5511-0410-912e-c29ae57300e0
2012-09-28 15:20:10 +00:00