Commit graph

1470 commits

Author SHA1 Message Date
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
helixhorned
ddc22ee395 a.nasm: add 'dword' to some stores in the nonpow2 routines for consistency.
git-svn-id: https://svn.eduke32.com/eduke32@3032 1a8010ca-5511-0410-912e-c29ae57300e0
2012-09-28 15:20:07 +00:00
helixhorned
52ed3e1a66 engine.c: add compilation switches for non-pow2 ysize functions, disable for now.
Previously, we used them in our builds for sprites, but MSVC builds don't have
the ASM ported to MASM, and thus the workaround of ignoring the linking errors
was not safe.

git-svn-id: https://svn.eduke32.com/eduke32@3031 1a8010ca-5511-0410-912e-c29ae57300e0
2012-09-28 15:20:03 +00:00
helixhorned
5957e0f143 Revert "Abyss crash prevention code", but make the overflow explicit.
git-svn-id: https://svn.eduke32.com/eduke32@3028 1a8010ca-5511-0410-912e-c29ae57300e0
2012-09-26 22:53:53 +00:00
helixhorned
aba1ce9e7f Disable spot lights on ATI cards, fixing the recent crashes with Catalyst 12.8.
git-svn-id: https://svn.eduke32.com/eduke32@3027 1a8010ca-5511-0410-912e-c29ae57300e0
2012-09-24 21:09:37 +00:00
helixhorned
94ebe8211b Revert r2223's removing of bit 1 making it to setbrightness(), now a noop.
Hendricks found a bug caused by that commit, so this one enables exprimentation
with setbrightness() bit 1 behavior.

git-svn-id: https://svn.eduke32.com/eduke32@3025 1a8010ca-5511-0410-912e-c29ae57300e0
2012-09-24 21:09:31 +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
95d11b9703 Add a profiling option to the 'demo' OSD command.
See the comment in source/osdcmds.c for instructions on its usage.

git-svn-id: https://svn.eduke32.com/eduke32@3021 1a8010ca-5511-0410-912e-c29ae57300e0
2012-09-15 15:28:26 +00:00
helixhorned
6389874b5d Fix aspect determination from showview in fullscreen mode.
This makes the splitscreen mod not have a ridiculous view distortion.
Such scenes will have no correction for non-square pixels, though.

git-svn-id: https://svn.eduke32.com/eduke32@3020 1a8010ca-5511-0410-912e-c29ae57300e0
2012-09-15 15:28:21 +00:00
hendricks266
8990017700 Add detection of Windows 8 and Server 2012 to win_printversion().
git-svn-id: https://svn.eduke32.com/eduke32@3018 1a8010ca-5511-0410-912e-c29ae57300e0
2012-09-13 07:07:54 +00:00
helixhorned
22a4eaaf3d __fastcall int32_t getangle -> int32_t fastcall getangle. Might fix MSVC build.
git-svn-id: https://svn.eduke32.com/eduke32@3012 1a8010ca-5511-0410-912e-c29ae57300e0
2012-09-12 09:47:26 +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
1fdc464568 In dosetaspect(), bail out calculating radarang2[] instead of failing assertion.
When this happens, parallaxmodes other than 0 will be unavailable and silently
draw as parallaxmode 0.  This usually happens with extremely wide resolutions.

git-svn-id: https://svn.eduke32.com/eduke32@2990 1a8010ca-5511-0410-912e-c29ae57300e0
2012-09-02 14:10:55 +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
helixhorned
7f74880c96 Move #include <math.h> from polymer.h to polymer.c.
git-svn-id: https://svn.eduke32.com/eduke32@2985 1a8010ca-5511-0410-912e-c29ae57300e0
2012-09-02 14:05:23 +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
8efcc81096 Remove some unneeded NULL checks.
Found by http://coccinelle.lip6.fr/rules/notnull.cocci

git-svn-id: https://svn.eduke32.com/eduke32@2978 1a8010ca-5511-0410-912e-c29ae57300e0
2012-09-02 13:57:39 +00:00
hendricks266
574f83dc76 The Build tools no longer link with SDL or SDL_mixer because they don't need to.
Fix for: http://forums.duke4.net/topic/5392-mkpalette-fails-to-build/page__view__findpost__p__132791

git-svn-id: https://svn.eduke32.com/eduke32@2974 1a8010ca-5511-0410-912e-c29ae57300e0
2012-08-27 03:51:17 +00:00
helixhorned
41f2535e91 engine.c: rewrite nextsectorneighborz() for clarity.
git-svn-id: https://svn.eduke32.com/eduke32@2969 1a8010ca-5511-0410-912e-c29ae57300e0
2012-08-26 22:15:02 +00:00
helixhorned
948a716229 Mapster32: for c&p-ing map portions w/o TROR, fix wrongly resetting wall lotag/extra
git-svn-id: https://svn.eduke32.com/eduke32@2965 1a8010ca-5511-0410-912e-c29ae57300e0
2012-08-26 22:10:40 +00:00
helixhorned
acdb7c139c Mapster32: for copy-pasting map portions without TROR, fix wrongly resetting xpanning.
This is really an artifact of overloading the sector fields for different uses.
For copy-pasting TROR'd portions, the bug still persists.

git-svn-id: https://svn.eduke32.com/eduke32@2963 1a8010ca-5511-0410-912e-c29ae57300e0
2012-08-26 22:08:27 +00:00
helixhorned
1f5971a4db If r_screenaspect is 0 (or any other invalid value), assume square pixel aspect.
git-svn-id: https://svn.eduke32.com/eduke32@2959 1a8010ca-5511-0410-912e-c29ae57300e0
2012-08-24 18:51:49 +00:00
helixhorned
a53e9b60d8 Keep full-screen tints through palette changes again.
A debug macro to test tints being stuck at the least intense non-zero value
is provided in engine.c.

git-svn-id: https://svn.eduke32.com/eduke32@2952 1a8010ca-5511-0410-912e-c29ae57300e0
2012-08-22 22:46:09 +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
eba4a3b722 Mapster32: with highlighted sectors, print rot. angle; Alt + [,]: manual angle.
Because rotating sectors "smoothly" by 1 BUILD ang will quickly accumulate
roundoff error, this lets the user first do that as a preview and then use the
manual angle rotation do carry it out for real.

git-svn-id: https://svn.eduke32.com/eduke32@2942 1a8010ca-5511-0410-912e-c29ae57300e0
2012-08-20 21:26:36 +00:00
helixhorned
6ed50e7170 Mapster32: use the rotatepoint code for both smooth and 90-degree sect. rotation.
git-svn-id: https://svn.eduke32.com/eduke32@2941 1a8010ca-5511-0410-912e-c29ae57300e0
2012-08-20 21:26:00 +00:00
helixhorned
28cc08a65f Fix two "may be used uninitialized" warnings (they can't, as far as I can see).
git-svn-id: https://svn.eduke32.com/eduke32@2937 1a8010ca-5511-0410-912e-c29ae57300e0
2012-08-19 13:02:47 +00:00
helixhorned
dc3a523eed Fake multi: fix display of item percentage and on/off states.
git-svn-id: https://svn.eduke32.com/eduke32@2935 1a8010ca-5511-0410-912e-c29ae57300e0
2012-08-19 13:02:37 +00:00
helixhorned
99160ede88 Introduce additional rotatesprite bit for internal use and mask ext. ones from CON.
ROTATESPRITE_MAX is moved to build.h and all orientation bits from CON commands
using rotatesprite are ANDed with (ROTATESPRITE_MAX-1).  Some of the functions
use ROTATESPRITE_MAX for different internal purposes, which will not be exposed
to CON now (a good thing).  Also, dorotspr_handle_bit2 is made clearer.

git-svn-id: https://svn.eduke32.com/eduke32@2929 1a8010ca-5511-0410-912e-c29ae57300e0
2012-08-19 12:57:57 +00:00
helixhorned
88eb1fac78 Clean up a couple of rotatesprite uses.
The black translucent background underneath the user map list will now
be drawn with a shade 32 tile 0 instead of tile BLANK, since I've seen
the latter being replaced in some mod. Also, it will look the same
regardless of screen aspect.

git-svn-id: https://svn.eduke32.com/eduke32@2928 1a8010ca-5511-0410-912e-c29ae57300e0
2012-08-19 12:56:51 +00:00
helixhorned
b07b540c0b Restucture dorotspr_handle_bit2().
This also fixes the OSD with aspects < 4/3. I broke that, too.

git-svn-id: https://svn.eduke32.com/eduke32@2927 1a8010ca-5511-0410-912e-c29ae57300e0
2012-08-19 12:55:45 +00:00
helixhorned
df591aba1c mdsprite.c: factor out two instances of identical code.
git-svn-id: https://svn.eduke32.com/eduke32@2922 1a8010ca-5511-0410-912e-c29ae57300e0
2012-08-19 12:52:10 +00:00
helixhorned
60a03c2fb3 Clean up handling of widescreen bits in dorotatesprite functions.
Don't call setaspect from them, because the only thing that's needed is
(in classic) yxaspect and xyaspect.  Pass these from the helper function
defined earlier instead.

git-svn-id: https://svn.eduke32.com/eduke32@2921 1a8010ca-5511-0410-912e-c29ae57300e0
2012-08-19 12:51:04 +00:00
helixhorned
020f261015 Clean up polymost_dorotatesprite a little (triv. changes only)
git-svn-id: https://svn.eduke32.com/eduke32@2919 1a8010ca-5511-0410-912e-c29ae57300e0
2012-08-19 12:49:37 +00:00
helixhorned
aadfd49435 In polymost_dorotatesprite, don't set [xy]dimen to [xy]dim temporarily.
This fixes stuff like the HUD chaingun with widescreen and small "screen sizes"
(in-game viewport). It also makes rotatesprite behave more like classic overall.
I have no idea why it was there in the first place.

git-svn-id: https://svn.eduke32.com/eduke32@2918 1a8010ca-5511-0410-912e-c29ae57300e0
2012-08-19 12:48:31 +00:00
terminx
71fc24c0f7 OpenBSD build fix from Brad Smith (plus a couple of irrelevant changes to the same file from my local tree)
git-svn-id: https://svn.eduke32.com/eduke32@2916 1a8010ca-5511-0410-912e-c29ae57300e0
2012-08-19 04:01:04 +00:00
helixhorned
786df72c6d In setaspect_new, determine the aspect with {x,y}dim again except for showview.
setaspect(), which is called by setaspect_new, already uses the *dimen variables,
so it's the same thing done twice.  Now, a change from the original full status
bar to the original mini status bar keeps the horizontal FOV again and only
bumps the view a little higher, as with the classic aspect determination.

git-svn-id: https://svn.eduke32.com/eduke32@2913 1a8010ca-5511-0410-912e-c29ae57300e0
2012-08-16 21:48:56 +00:00
helixhorned
ecf277c70e Factor out Polymost's widescreen bit handling code and use it in classic, too.
This means that classic and the GL modes now look the same as far as e.g.
hud_bgstretch or HUD weapons are concerned.

git-svn-id: https://svn.eduke32.com/eduke32@2911 1a8010ca-5511-0410-912e-c29ae57300e0
2012-08-16 21:48:50 +00:00
helixhorned
08260dbf25 polymost.c: rewite widescreen bit code, part 2.
Use integer math; both args to setaspect are constant.

git-svn-id: https://svn.eduke32.com/eduke32@2910 1a8010ca-5511-0410-912e-c29ae57300e0
2012-08-16 21:48:46 +00:00
helixhorned
20ccab9022 Clean up classic's and Polymost's dorotatesprite functions (triv. changes only)
git-svn-id: https://svn.eduke32.com/eduke32@2909 1a8010ca-5511-0410-912e-c29ae57300e0
2012-08-16 21:48:44 +00:00
helixhorned
8ac85eef54 polymost.c: rewrite dorotatesprite's widescreen bit handling (256,512,1024).
Instead of setting and resetting the [xy]dim globals, use them as locals
in a block (shadowing the globals).  Also, do some common subexpression
elimination for clarity.

git-svn-id: https://svn.eduke32.com/eduke32@2908 1a8010ca-5511-0410-912e-c29ae57300e0
2012-08-16 21:48:41 +00:00
helixhorned
2913ee5211 Clean up build.h and status bar drawing code in game.c.
git-svn-id: https://svn.eduke32.com/eduke32@2896 1a8010ca-5511-0410-912e-c29ae57300e0
2012-08-16 21:48:08 +00:00
helixhorned
d6e0009ec0 engine: in setaspect_new, determine the aspect with {x,y}dimen instead of {x,y}dim.
That is, use the view boundries instead of the whole screen.

git-svn-id: https://svn.eduke32.com/eduke32@2894 1a8010ca-5511-0410-912e-c29ae57300e0
2012-08-13 18:26:16 +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
4dca439d8f Text-repl.: hitinfo variables -> hit, hit{sprite,sect,wall} members -> no "hit"
This makes the code rather more readable in some places.  Unlike the two
preceding commits, this one is actually purely textual replacement.

git-svn-id: https://svn.eduke32.com/eduke32@2877 1a8010ca-5511-0410-912e-c29ae57300e0
2012-08-10 19:12:01 +00:00
helixhorned
8f61b72ca2 Mapster32: add "extend all highlighted sectors" func to 'F menu via a.m32.
git-svn-id: https://svn.eduke32.com/eduke32@2866 1a8010ca-5511-0410-912e-c29ae57300e0
2012-08-06 20:00:35 +00:00
helixhorned
569f0dbe7c sdlayer.c: Add high-resolution timer for OS X, using mach_absolute_time().
git-svn-id: https://svn.eduke32.com/eduke32@2861 1a8010ca-5511-0410-912e-c29ae57300e0
2012-08-02 10:52:41 +00:00
helixhorned
b7cfd2fe2c Lunatic: fix build on OS X, pass LUNATIC define to build/ sources.
git-svn-id: https://svn.eduke32.com/eduke32@2860 1a8010ca-5511-0410-912e-c29ae57300e0
2012-08-02 10:52:38 +00:00
helixhorned
e7d3dcba78 gethitickms(): replace division by multiplication.
git-svn-id: https://svn.eduke32.com/eduke32@2856 1a8010ca-5511-0410-912e-c29ae57300e0
2012-08-02 10:52:25 +00:00
helixhorned
19d426ba02 OSX build: mighty tweak osxbuild.sh and link to LibPNG from Fink on x86_64.
The build script now has two more presets: helix and installtools
(which was previously attempted after the build; untested). Also,
 - when detecting git, run commands such that the SVN repo isn't accessed
 - package kextract, kgroup and arttool into tools/ in the zip
 - try to exit on failure in some places, though that doesn't seem to work

git-svn-id: https://svn.eduke32.com/eduke32@2852 1a8010ca-5511-0410-912e-c29ae57300e0
2012-07-29 23:35:12 +00:00
helixhorned
109457994e Classic: on x86 GCC asm builds, fix crash with floor sprites of (x or y) size 2.
The idiv instruction also signals an FPE when the resulting *signed* quotient
overflows, so we simply use div instead.

git-svn-id: https://svn.eduke32.com/eduke32@2850 1a8010ca-5511-0410-912e-c29ae57300e0
2012-07-29 12:46:56 +00:00
helixhorned
568f213de8 Add gethitickms() to the Windows layer.
git-svn-id: https://svn.eduke32.com/eduke32@2848 1a8010ca-5511-0410-912e-c29ae57300e0
2012-07-25 18:56:15 +00:00
helixhorned
49ab0eb6e9 PNG screenshots: fix oob read of malloc'd mem on Windows.
These could manifest themselves as garbage lines on the bottom and
happened because of the ydim vs. bytesperline discrepancy again.

git-svn-id: https://svn.eduke32.com/eduke32@2844 1a8010ca-5511-0410-912e-c29ae57300e0
2012-07-20 21:57:56 +00:00
helixhorned
2a2f56f510 Add custom-built lean zlib and libpng and enable PNG screenshots on Windows.
Instructions on how I built the libs are in Windows/src/minipng.dfa.

git-svn-id: https://svn.eduke32.com/eduke32@2843 1a8010ca-5511-0410-912e-c29ae57300e0
2012-07-20 21:57:53 +00:00
helixhorned
b47c18518f Lunatic: time every event and actor call and print summary at game exit.
git-svn-id: https://svn.eduke32.com/eduke32@2842 1a8010ca-5511-0410-912e-c29ae57300e0
2012-07-20 21:57:44 +00:00
helixhorned
a17cdd9d95 Polymer: fix underwalls being not animated (introduced in r2823).
git-svn-id: https://svn.eduke32.com/eduke32@2835 1a8010ca-5511-0410-912e-c29ae57300e0
2012-07-15 09:23:58 +00:00
Plagman
7e16357c68 Revert hightile factoring for now.
git-svn-id: https://svn.eduke32.com/eduke32@2825 1a8010ca-5511-0410-912e-c29ae57300e0
2012-07-11 04:39:01 +00:00
helixhorned
9000e23683 Polymer: simplify some code while I'm at it (equivalence tranformations only)
git-svn-id: https://svn.eduke32.com/eduke32@2823 1a8010ca-5511-0410-912e-c29ae57300e0
2012-07-09 19:00:21 +00:00
helixhorned
d66856eeea Polymer: bring the ypanning correction for non-pow2 walls closer to Pmost's, pt2
This changes a constant inside the panning calculation from 256 to 255 (making
e.g. panning 255 and 0 the same in the "San Andreas fault" sign in E1L5) and
uses the correct reference wall for the "do panning correction?" conditional.
Now, the problematic walls should look the same as in Polymost.

git-svn-id: https://svn.eduke32.com/eduke32@2822 1a8010ca-5511-0410-912e-c29ae57300e0
2012-07-09 19:00:17 +00:00
helixhorned
fe1a5fe2a6 Polymer: bring the ypanning correction for non-pow2 walls closer to Pmost's, pt1
This makes the corrections conditional on where they appear in (under-, over-,
white or mask wall).

git-svn-id: https://svn.eduke32.com/eduke32@2821 1a8010ca-5511-0410-912e-c29ae57300e0
2012-07-09 19:00:14 +00:00
helixhorned
98f7be1ace Classic: draw walls with non-pow2 ysizes in the old fashion for the time being.
I'm willing to make this one concession to correctness in the name of backward-
compatibility.  I think that one reason why this has never cause a crash is that
tiles in BUILD are allocated in Ken's big allocache buffer, so oob accesses were
dampened by that (though they hit uninitialized data).

git-svn-id: https://svn.eduke32.com/eduke32@2819 1a8010ca-5511-0410-912e-c29ae57300e0
2012-07-08 21:47:25 +00:00
helixhorned
e02843b133 m32script: EVENT_DRAW3DSCREEN, screenshot functonality.
The event is run after drawing the scene, but before the overlays. To
make a screenshot from a script, set DOSCRSHOT to non-zero. It will then
be scheduled to run once after the drawing but before the above-mentioned
event.  The screenshots will be called mcapXXXX.{png,tga}.

git-svn-id: https://svn.eduke32.com/eduke32@2818 1a8010ca-5511-0410-912e-c29ae57300e0
2012-07-08 21:47:23 +00:00
helixhorned
f6c1c125ac Comment out printext256's GL mode fallback code.
This would only hit when polymost_printext256 erred out (mem alloc failure,
glGenTextures failure), i.e. "almost never".

Also, tweak a bound check in polymost_printext256.

git-svn-id: https://svn.eduke32.com/eduke32@2817 1a8010ca-5511-0410-912e-c29ae57300e0
2012-07-08 21:47:19 +00:00
helixhorned
20da833bdb Polymost: factor out y panning coefficient calculation code.
git-svn-id: https://svn.eduke32.com/eduke32@2815 1a8010ca-5511-0410-912e-c29ae57300e0
2012-07-08 21:47:14 +00:00
helixhorned
dfdcce090b Polymer: factor out wall y panning coefficient calculation.
Non-pow2 wall/mask drawing in classic introduced cases where walls are
drawn "incorrectly" because they were constructed with the old behavior
in mind.  Polymer appears to "correct" for it partially, but doesn't cover
all cases.  Specifically, now we have:
 - E1L1 first inside secret room (5000, 50000): Polymer draws like Duke 1.5,
   classic now draws with an offset.
 - E3L2 near the vault (-20000, 25000): both classic and Polymer draw with
   offsets compared to Duke 1.5, but they're different!

This means that more research is needed into what makes these two cases
diverge, even though both have the same root cause.

!!! Also, mappers should abstain from using non-power-of two textures on
    walls until this issue is resolved in a satisfactory fashion !!!

git-svn-id: https://svn.eduke32.com/eduke32@2811 1a8010ca-5511-0410-912e-c29ae57300e0
2012-07-06 15:36:50 +00:00
helixhorned
6ed9241f0a Classic: fix glitches where stuff would be drawn transiently on sect change.
This was introduced with r2771, which fixed e.g. AMC TC city_si's mirrors,
but instructed the base drawrooms inside yax_drawrooms to not correct the
passed sectnum.  Therefore, stuff would get drawn wrongly when passing
sector boundaries, like from the platform to the rails in trueror1.map.

git-svn-id: https://svn.eduke32.com/eduke32@2810 1a8010ca-5511-0410-912e-c29ae57300e0
2012-07-06 15:36:46 +00:00
helixhorned
eae25756a8 Classic: fix drawing mirrors, introduced by nonpow2-ysize wall/mask drawing.
Some more drawing glitches remain.

git-svn-id: https://svn.eduke32.com/eduke32@2809 1a8010ca-5511-0410-912e-c29ae57300e0
2012-07-06 14:16:31 +00:00
helixhorned
39e944dffe Add description for 'remap' to mapster32.cfg, add 'setstartpos' to a.m32.
The latter is commented out, since it has to be *compiled* with
script_expertmode enabled.

git-svn-id: https://svn.eduke32.com/eduke32@2808 1a8010ca-5511-0410-912e-c29ae57300e0
2012-07-06 11:27:52 +00:00
helixhorned
caa36c9d77 Classic: hook up non-power-of-two ysize wall/mask drawing in asm builds, too.
git-svn-id: https://svn.eduke32.com/eduke32@2807 1a8010ca-5511-0410-912e-c29ae57300e0
2012-07-06 11:27:49 +00:00
helixhorned
6c4c4fed15 Classic: add {,m,t}vlineasm1nonpow2, currently unreferenced from high-level drawing.
git-svn-id: https://svn.eduke32.com/eduke32@2806 1a8010ca-5511-0410-912e-c29ae57300e0
2012-07-06 11:27:46 +00:00
helixhorned
5a96b4e572 Classic-noasm: fix drawing of walls and maskwalls with non-pow2 y size tiles.
Related to that, it looks like out-of-bounds accesses when drawing such walls/
maskwalls or *sprites* are fixed, too.  Sprites still show a stray lines on some
occasions, but Valgrind doesn't complain then.

git-svn-id: https://svn.eduke32.com/eduke32@2805 1a8010ca-5511-0410-912e-c29ae57300e0
2012-07-06 11:26:24 +00:00
Plagman
5b887587f3 mdsprite: don't try to factor textures from fallback skins
git-svn-id: https://svn.eduke32.com/eduke32@2800 1a8010ca-5511-0410-912e-c29ae57300e0
2012-07-02 04:51:24 +00:00
Plagman
4055e446c0 hightile: enable the texture factoring code for all palettes
git-svn-id: https://svn.eduke32.com/eduke32@2799 1a8010ca-5511-0410-912e-c29ae57300e0
2012-07-02 04:24:04 +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
35e4f19ceb Make nsqrtasm return int32_t (instead of uint32_t) when compiled with GCC/x86.
git-svn-id: https://svn.eduke32.com/eduke32@2793 1a8010ca-5511-0410-912e-c29ae57300e0
2012-07-01 22:11:20 +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
hendricks266
da4fcec462 Fix the overlooking of EDUKE.CON in the absence of DUKE3D.GRP caused by r2726. Also, tweak a few string literals' use of quotation marks.
git-svn-id: https://svn.eduke32.com/eduke32@2789 1a8010ca-5511-0410-912e-c29ae57300e0
2012-06-27 17:45:52 +00:00
helixhorned
9dbf439f45 some trivial mapster tweaks
git-svn-id: https://svn.eduke32.com/eduke32@2787 1a8010ca-5511-0410-912e-c29ae57300e0
2012-06-26 19:50:02 +00:00
helixhorned
3e4357c6a4 Integer Overflow Offensive continued: first round of -ftrapv - cleanness.
That is, "clang -ftrapv" builds don't abort almost immediately after entering
a level.

There are various classes of overflow bugs, needing different handling:
 - Some texture mapping code was written with signed integer wrapping semantics
   in mind.  In some places, we're able to get away with unsigned casts.
 - sometimes, we really need a wider range, like when calculating distances or
   dot products
 - negating INT_MIN.  Here, we cast to int64_t temporarily.  Note that if the
   result is 32-bit wide, no 64-bit code may actually need to be generated.
 - shifting into a signed integer's sign bit.  We cast to uint32 here.
 - in hitscan(), at the "abyss crash prevention code" comment, it's clearly
   the other code that is better...

This is not merely done for pedantry, but rather makes it easier to track down
overflow bugs having a real impact on the game.

git-svn-id: https://svn.eduke32.com/eduke32@2784 1a8010ca-5511-0410-912e-c29ae57300e0
2012-06-26 19:49:53 +00:00
helixhorned
221461f05d Fix a thinko in a comment (about commenting) in build/Makefile.
git-svn-id: https://svn.eduke32.com/eduke32@2783 1a8010ca-5511-0410-912e-c29ae57300e0
2012-06-26 19:49:50 +00:00
helixhorned
b9dd289800 engine.c: factor out two instances of dup code into setup_globals_sprite1()
git-svn-id: https://svn.eduke32.com/eduke32@2782 1a8010ca-5511-0410-912e-c29ae57300e0
2012-06-26 19:49:48 +00:00
helixhorned
bfd1700ceb SDL layer: tweak high-resolution timers for profiling, add gethitickms().
For SDL 1.2 and when building on linux, the code using
clock_gettime(CLOCK_MONOTINIC, ...) is taken over from SDL HG.
gethitickms() is a convenience function that return milliseconds as
doubles and isn't exposed in any header file, yet.

git-svn-id: https://svn.eduke32.com/eduke32@2778 1a8010ca-5511-0410-912e-c29ae57300e0
2012-06-22 21:39:57 +00:00
helixhorned
ed5e5b5881 Add prototypical SDL 2.X support.
Doesn't work: indexed-color modes, gamma (at least for X11), mouse wheel,
special keys like ENTER or BACKSPACE in the OSD, probably more...

In build/Makefile.shared, we now have logic to autodetect an SDL2 installed
in /usr/local, however OS X and Wii builds follow other Makefile code paths,
it seems.  Note that the matching SDL2_mixer must be used then, too.
In source/jaudiolib/src/driver_sdl.c, change the #includes from <SDL/SDL_xxx.h>
to "SDL_xxx.h".  SDL wiki says this is the most portable way, hopefully this
doesn't break builds for anyone.

git-svn-id: https://svn.eduke32.com/eduke32@2777 1a8010ca-5511-0410-912e-c29ae57300e0
2012-06-22 21:39:53 +00:00
terminx
ef32d9cb64 Fix a single usage of S_IREAD instead of our BS_IREAD compatibility version
git-svn-id: https://svn.eduke32.com/eduke32@2776 1a8010ca-5511-0410-912e-c29ae57300e0
2012-06-21 19:48:54 +00:00
terminx
4002492146 Fix useless "No error" message when loading palette.dat fails, change file casing in error message for failing to load tables.dat to reflect the filename actually passed to kopen4load().
git-svn-id: https://svn.eduke32.com/eduke32@2775 1a8010ca-5511-0410-912e-c29ae57300e0
2012-06-21 19:47:02 +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
d5dd5fec9d Mapster32: Fix tweaking TROR wall links when flipping sectors ([X], [Y]).
This was actually broken all the time except when ALL sectors were selected
(which was what I tested incidentally when I wrote the first "fix"). D'oh!

git-svn-id: https://svn.eduke32.com/eduke32@2773 1a8010ca-5511-0410-912e-c29ae57300e0
2012-06-20 20:54:59 +00:00
helixhorned
716ea1f3b2 Fix a drawing glitch with mirrors and TROR in classic.
git-svn-id: https://svn.eduke32.com/eduke32@2772 1a8010ca-5511-0410-912e-c29ae57300e0
2012-06-20 20:54:55 +00:00
helixhorned
8a28b3ad80 Allow fogpal DEF command to fogify pal 0.
git-svn-id: https://svn.eduke32.com/eduke32@2770 1a8010ca-5511-0410-912e-c29ae57300e0
2012-06-18 20:09:03 +00:00
helixhorned
2875a45b68 polymost.c: make polymost_checkcoordinates() static
git-svn-id: https://svn.eduke32.com/eduke32@2768 1a8010ca-5511-0410-912e-c29ae57300e0
2012-06-17 19:45:51 +00:00
helixhorned
b30ac41147 Integer Overflow Offensive, First Act: rintersect, hitscan, neartag.
It's time to replace some int32s with 64-bit ints in core engine functions.
The problem is that for example, the dot product is taken between vectors that
may be the difference between two arbitrary points in a sector, so even if one
sticks to the "no blue walls" rule, that doesn't guarantee freedom from
overflows.

git-svn-id: https://svn.eduke32.com/eduke32@2761 1a8010ca-5511-0410-912e-c29ae57300e0
2012-06-13 23:13:39 +00:00
helixhorned
41921e728c Polymost: don't attempt to draw sprite with void tile, preventing div-by-0s later
git-svn-id: https://svn.eduke32.com/eduke32@2760 1a8010ca-5511-0410-912e-c29ae57300e0
2012-06-13 23:13:36 +00:00
helixhorned
84cb4fd6ca Mapster32: draw a wall blue if its squared length exceeds INT_MAX (not UINT_MAX)
git-svn-id: https://svn.eduke32.com/eduke32@2759 1a8010ca-5511-0410-912e-c29ae57300e0
2012-06-13 23:13:34 +00:00
helixhorned
4353170b47 Fix a div by zero in polymost_internal_nonparallaxed.
git-svn-id: https://svn.eduke32.com/eduke32@2758 1a8010ca-5511-0410-912e-c29ae57300e0
2012-06-13 23:13:31 +00:00
helixhorned
ec56b8e2d9 build/Makefile: Always compile a-c.o with -O2 and without -fcatch-undefined-behavior
This is to not slow down the core drawing functions too much in debugging builds
and mimics the way things are on x86.

git-svn-id: https://svn.eduke32.com/eduke32@2755 1a8010ca-5511-0410-912e-c29ae57300e0
2012-06-13 23:13:23 +00:00
helixhorned
88d7a77fdc Mapster32: disallow joining non-adjacent sectors when expert mode is disabled.
git-svn-id: https://svn.eduke32.com/eduke32@2753 1a8010ca-5511-0410-912e-c29ae57300e0
2012-06-13 23:13:15 +00:00
helixhorned
d8721f743e Factor out r2726' kopen4load checks into testkopen, closing opened files.
git-svn-id: https://svn.eduke32.com/eduke32@2752 1a8010ca-5511-0410-912e-c29ae57300e0
2012-06-11 20:35:47 +00:00
helixhorned
2ddd6df14a Classic: don't attempt drawing sprites with (cstat&48) == 48 that aren't voxels.
Bang! One more invalid internals exposure squashed. Maybe one day we'll be able
to call EDuke32 "stable"...

Actually the offending sprite IS drawn as face sprite with shade 32 and xrepeat
and yrepeat 255 for the convenience of the CON coder who will have to debug it.

git-svn-id: https://svn.eduke32.com/eduke32@2744 1a8010ca-5511-0410-912e-c29ae57300e0
2012-06-07 17:37:57 +00:00
helixhorned
9e5696a486 TROR/classic: same fix as r2739, intersecting case.
git-svn-id: https://svn.eduke32.com/eduke32@2741 1a8010ca-5511-0410-912e-c29ae57300e0
2012-06-06 22:03:32 +00:00
helixhorned
cf429d0e76 engine.c: cleanup / readability tweaks
git-svn-id: https://svn.eduke32.com/eduke32@2740 1a8010ca-5511-0410-912e-c29ae57300e0
2012-06-05 22:21:26 +00:00
helixhorned
2fa7ccf9dd TROR/classic: fix a certain class of underdraw glitches.
Those were happening when wall drawing in an upper/lower layer "closed" too
much of the "curtain" (umost/dmost) for subsequent drawing in that portal.
Example: looking down the sewer manhole at the beginning of Retaliation will
now render without HOM.

git-svn-id: https://svn.eduke32.com/eduke32@2739 1a8010ca-5511-0410-912e-c29ae57300e0
2012-06-05 22:21:22 +00:00
hendricks266
d3a3c74112 Massive menu input control revamp/cleanup/factor. (added: input.[ch])
New Wii control defaults for the Wii Remote + Nunchuk and the Classic Controller. This includes new code added just so that the Home key brings up the menu in-game, reducing the need for a USB keyboard.

On the technical side, raw joystick access (comparable to what is available for keyboard and mouse) is now present in jmact, on the game side. (added: joystick.[ch])

Using this new raw joystick access, I replaced tueidj's hack to map A and B to LMB/RMB and D-Pad Up/Down to the scrollwheel.

I made the menus more friendly to mouse and joystick browsing by adding and unifying checks and clears for various buttons and gamefuncs. In fact, the majority of the time spent on this commit was tracking down problems that appeared with the factoring and trying to understand the menu system and the way input checks are precariously executed.

In addition, "Press any key or button to continue" now truly means what it says.

As a result of incorporating proper raw access into control.c instead of it directly accessing the implementaiton, the program *may* no longer be affected by joystick input when it is out of focus. This follows the pattern set by the mouse, and I think this is a positive change.

A small bonus: In the classic/old keyboard preset, the key for Show_Console has been changed from '`' to 'C' because '`' is taken by Quick_Kick.

git-svn-id: https://svn.eduke32.com/eduke32@2728 1a8010ca-5511-0410-912e-c29ae57300e0
2012-06-03 16:11:22 +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
hendricks266
19d9d0a71e Incorporate some use of Bfflush(NULL) in hopes to alleviate Wii configuration saving concerns.
git-svn-id: https://svn.eduke32.com/eduke32@2725 1a8010ca-5511-0410-912e-c29ae57300e0
2012-06-03 16:08:27 +00:00
helixhorned
b9c553624b For me (helixhorned), do SDL_WarpMouse even in debugging builds again.
This introduces a Makefile variable EDUKE32_MY_DEVELOPER_ID, which is
expected to come from the environment, so that minor disagreements/
preferences can be handled -- don't let it go overboard though! -- to keep
the working directory clean of stuff that one doesn't actually work on.

My ID is 805120924, i.e. "helix".

git-svn-id: https://svn.eduke32.com/eduke32@2718 1a8010ca-5511-0410-912e-c29ae57300e0
2012-06-01 20:09:27 +00:00
helixhorned
520f84b569 Mapster32: keep the temp sector on some more occasions that don't delete them.
git-svn-id: https://svn.eduke32.com/eduke32@2716 1a8010ca-5511-0410-912e-c29ae57300e0
2012-06-01 20:09:22 +00:00
helixhorned
df105128cb Mapster32: Part 1 of ceiling/floor auto-alignment functionality.
Usage is from 3D mode only.  When a sector (or wall) is committed to the
clipboard, it (or the wall's sector) is saved, and is subsequently used
when auto-aligning [;-ENTER] another sector's ceiling or floor against the
reference one's.  This temp. sector is reset on any structurally modifying
operation except setting first walls; also, aligning extended ceilings or
floors is impossible as they use .*xrepeat internally.

The auto-alignment does not change picnums (this can be accomplished with
the ['+ENTER] combination), but copies the orientation bits 2^{2..6} to the
alignee.  Afterwards, if the reference is relative-aligned, it tweaks them,
so that every case where the two firstwalls are either parallel or perpendi-
cular is handled correctly.

It does not yet calculate the panning values.

git-svn-id: https://svn.eduke32.com/eduke32@2715 1a8010ca-5511-0410-912e-c29ae57300e0
2012-06-01 20:09:19 +00:00
helixhorned
d1f9cb230c Throw a commented #define DEBUG_TEXTURE_NAMES into glbuild.h.
This is so that people know where to enable it. One day, all these
debugging switches ought to go into the Makefiles in one form or
another.

git-svn-id: https://svn.eduke32.com/eduke32@2714 1a8010ca-5511-0410-912e-c29ae57300e0
2012-06-01 20:09:15 +00:00
helixhorned
35d989646e A couple of minor fixes and comments that got accumulated in my tree.
git-svn-id: https://svn.eduke32.com/eduke32@2709 1a8010ca-5511-0410-912e-c29ae57300e0
2012-05-29 20:01:55 +00:00
helixhorned
7cd44d6cdb Makefile.shared: don't link with libsupc++ on linux.
It works perfectly fine without it for me, and including it for no reason
is just an annoyance to other people building from source.

git-svn-id: https://svn.eduke32.com/eduke32@2708 1a8010ca-5511-0410-912e-c29ae57300e0
2012-05-29 20:01:50 +00:00
helixhorned
5b387f7a08 Introduce two convenient sprite iteration macros in build.h, add a few uses.
Defines SPRITES_OF(Statnum, Iter) and SPRITES_OF_SECT(Sectnum, Iter)
[The first is so that STAT_* can be substituted for Iter and it reads nicely.]

Usage should be self-explanatory, but one thing to keep in mind is that
the sprites that are iterated over MUST NOT be deleted.

git-svn-id: https://svn.eduke32.com/eduke32@2707 1a8010ca-5511-0410-912e-c29ae57300e0
2012-05-29 20:01:48 +00:00
helixhorned
32c76d14b4 mdsprite.c: patch up bad array access in loadkvx, remove const from kopen4load arg.
vbit was being accessed with an int32 e.g. at address 3200 when only 3203 were
allocated.  We simply alloc +1 byte.

git-svn-id: https://svn.eduke32.com/eduke32@2705 1a8010ca-5511-0410-912e-c29ae57300e0
2012-05-29 20:01:40 +00:00
helixhorned
0088ed0591 Only check file name case when not in-game; don't warn for ALLUPPER or alllower.
The first means that the expensive (~0.5 ms) SHGetFileInfo() calls won't inter-
fere with smooth gameplay, but files that are opened only at game-time like
sounds won't be checked.  The second means that there are now less false
positives, i.e. warnings about files that would be found due to the
check-all-{upper,lower} hack.

git-svn-id: https://svn.eduke32.com/eduke32@2702 1a8010ca-5511-0410-912e-c29ae57300e0
2012-05-28 18:15:19 +00:00
helixhorned
689e1b7167 engine.c: make horizlookup/horizlookup2 have int32_t elts instead of intptr_t.
git-svn-id: https://svn.eduke32.com/eduke32@2701 1a8010ca-5511-0410-912e-c29ae57300e0
2012-05-26 21:58:31 +00:00
helixhorned
5efab4d850 build.c: factor out two identical code instances into handle_sprite_in_clipboard
git-svn-id: https://svn.eduke32.com/eduke32@2699 1a8010ca-5511-0410-912e-c29ae57300e0
2012-05-26 21:58:26 +00:00
helixhorned
2fc6e2e6b0 Various cleanup and rewrites.
- make allocatepermanenttile() return intptr_t
- the usual

git-svn-id: https://svn.eduke32.com/eduke32@2697 1a8010ca-5511-0410-912e-c29ae57300e0
2012-05-26 21:58:21 +00:00
helixhorned
5af2088c06 With engine compiled for V7 limits, refuse loading maps exceeding them.
Also, correct the loadboard() return value checks in premap.c to be
aware of a returned -2 ("wrong map version").

git-svn-id: https://svn.eduke32.com/eduke32@2694 1a8010ca-5511-0410-912e-c29ae57300e0
2012-05-25 18:39:19 +00:00
helixhorned
000cfffe32 On Windows, don't try to lowercase/uppercase filenames.
Most of the time, Windows file name lookup is case-insensitive. Reading the
docs (see MSDN's CreateFile help, for example), it seems like case-sensitivity
can be controlled on a per-file basis where applicable (NTFS), but people
should be concerned about matching case in the DEFs/on disk *especially* in
that case.

Also, note that this hack will not always help on systems with case-sensitive
lookup.

git-svn-id: https://svn.eduke32.com/eduke32@2693 1a8010ca-5511-0410-912e-c29ae57300e0
2012-05-25 15:23:58 +00:00
helixhorned
68c701fb4a On Windows, check for case-mismatched file names on successful kopen4load().
When a file from the local file system is opened, its real file name is gotten
with SHGetFileInfo() and compared against the one that was passed. In the case
they're not identical, a warning is issued.

This is one step towards eliminating mismatched file names in DEFs etc., which
cause trouble on systems that look them up case-sensitively.  However, it's not
perfect because the issue is trickier than it appears on first sight.
For one thing, this will only check the last (i.e. file) part in the path,
falsely accepting mismatched directory names.  However for these, it reports
them ruthlessly, even for those names where the try-other-case hack (try all
uppercase, all lowercase) would find the correctly-cased file.

git-svn-id: https://svn.eduke32.com/eduke32@2692 1a8010ca-5511-0410-912e-c29ae57300e0
2012-05-25 15:23:55 +00:00
hendricks266
f303ac2f2a EDuke32 Wii: Ready for action!
git-svn-id: https://svn.eduke32.com/eduke32@2685 1a8010ca-5511-0410-912e-c29ae57300e0
2012-05-20 07:25:25 +00:00
hendricks266
d015c4acdc Mac OS X: Add correct default values for 'gameexecutable' cfg string so that the Mapster32 test feature works with .app bundles.
Note: You may encounter a crash if you try to test your map and Mapster32 is running fullscreen.

git-svn-id: https://svn.eduke32.com/eduke32@2684 1a8010ca-5511-0410-912e-c29ae57300e0
2012-05-20 07:24:28 +00:00
terminx
6db214c112 Correct an oversight and make handleevents() call our own window processing function instead of the default Windows one.
git-svn-id: https://svn.eduke32.com/eduke32@2681 1a8010ca-5511-0410-912e-c29ae57300e0
2012-05-20 05:36:32 +00:00
helixhorned
94f9c03123 PNG screenshots: don't save custom gAMA.
This should be more correct, since previously, the saved PNGs were way too
contrasty when looked from within a browser.  Now, they'll always be
slightly darker than in-game (assuming one has a gamma greater than 1).

git-svn-id: https://svn.eduke32.com/eduke32@2673 1a8010ca-5511-0410-912e-c29ae57300e0
2012-05-18 21:40:54 +00:00
helixhorned
1c530d4b2f With Clang, compile in GNU89 mode and fix clang detection in the Makefiles.
The default C99 mode is giving us linking errors from xdelta3.

git-svn-id: https://svn.eduke32.com/eduke32@2672 1a8010ca-5511-0410-912e-c29ae57300e0
2012-05-18 21:40:38 +00:00
helixhorned
165c569cbe Lunatic: v7 engine support, event updates
git-svn-id: https://svn.eduke32.com/eduke32@2668 1a8010ca-5511-0410-912e-c29ae57300e0
2012-05-18 12:45:52 +00:00
terminx
ad2f6a6560 Update QuickLZ to 1.5.1 beta 7
git-svn-id: https://svn.eduke32.com/eduke32@2662 1a8010ca-5511-0410-912e-c29ae57300e0
2012-05-17 21:36:50 +00:00
terminx
778e463549 "Band-aid" fix for the issue with EDuke32 and Mapster32 visually locking up but continuing to run and play sounds after alt+tabbing away for a few seconds on Windows Vista/7. This may screw something else up, so please test thoroughly.
git-svn-id: https://svn.eduke32.com/eduke32@2657 1a8010ca-5511-0410-912e-c29ae57300e0
2012-05-17 17:19:52 +00:00
helixhorned
2cef17641a A couple of misc. Wii changes.
- Make MAXXDIM and MAXYDIM macros be 860 and 490, respectively.  tueidj says
  max. screen size is 848x480, but there are oob access bugs in the classic
  renderer when running with the maximum possible resolution
- don't allocate additional sector/wall storage for Mapster (saves ~16k)
- Add ud.config.UseJoystick = 1 in config.c, but make it conditional on Wii
- remove one comment I no longer believe true, add one TODO comment

git-svn-id: https://svn.eduke32.com/eduke32@2645 1a8010ca-5511-0410-912e-c29ae57300e0
2012-05-06 20:23:20 +00:00
helixhorned
8ea5b89be6 Prevent an (unlikely) integer overflow in neartag with huge switch sprites.
git-svn-id: https://svn.eduke32.com/eduke32@2641 1a8010ca-5511-0410-912e-c29ae57300e0
2012-05-05 22:24:17 +00:00
helixhorned
84e5fcdad8 Accumulated trivia, mostly "the usual".
Among other things, comment out very seldomly (or not at all)
used sprite member macros: SV, ZV, RX, RY, CX, CY, CD, PL.

git-svn-id: https://svn.eduke32.com/eduke32@2639 1a8010ca-5511-0410-912e-c29ae57300e0
2012-05-05 22:23:44 +00:00
helixhorned
7cdd9a04da Make the GAMMA_CALC macro use double instead of float and use it in menus.c.
git-svn-id: https://svn.eduke32.com/eduke32@2638 1a8010ca-5511-0410-912e-c29ae57300e0
2012-05-05 22:23:17 +00:00
helixhorned
ebbb3e304d Tweak the conditions under which setbrightness() invalidates GL textures.
Previously, we checked whether the faded palette has changed (by way of CRC)
and invalidated the textures then unless the preserve flags were set.  This
however could lead to wrongly invalidating them under unfortunate circumstances,
e.g. basepal change from CON + tints at the same time before r2620 which
reverted r2232.

Now, only invalidate them if the corresponding preserve flags are clear AND
 * the base palette has really changed OR
 * the palette CRC changed and we were running on software gamma
The latter means that performance-killing invalidations may still happen on
GL platforms lacking HW gamma (for ATI, it's currently only disabled in 8-bit
fullscreen).

Also have a new global 'basepalreset' to fake a basepal change for
setbrightness(), currently used when changing renderers so that going from
Polymer to Polymost and back again will invalidate the Polymer textures
on the second change, potentially re-applying a basepal highpal. (Still
with me?)

git-svn-id: https://svn.eduke32.com/eduke32@2636 1a8010ca-5511-0410-912e-c29ae57300e0
2012-05-05 22:22:34 +00:00
helixhorned
bbc020bace winlayer: Remove code that worked around a (wrongly) not set have_ATI variable.
This was fixed with the preceding change; software mode will now always use
software gamma if an ATI/AMD card is detected.

git-svn-id: https://svn.eduke32.com/eduke32@2634 1a8010ca-5511-0410-912e-c29ae57300e0
2012-05-05 22:22:05 +00:00
helixhorned
dcd66dad62 On Windows, determine if we're running on a ATI card at startup even in classic.
Previously, I knew no way of querying for graphics adapter vendors/names from
anything other than OpenGL.  Googling revealed a way to do this with the
Windows API.

git-svn-id: https://svn.eduke32.com/eduke32@2633 1a8010ca-5511-0410-912e-c29ae57300e0
2012-05-05 22:21:49 +00:00
helixhorned
68e6141c32 Patch adding Wii support by tueidj, part 10: sound and endianness changes
This part is a mixture of the original patch and my changes.  It seems like
tueidj had some trouble
 1) getting OGG to work, which is why it's conditionally compiled out
 2) struggling with endianness with the mixing routines?  This may be also
    due to him missing to define two others BIGENDIAN macros (our code is
    in need of cleanup there).  Note the change in jaudiolib/src/mix.c!

Because I added my share to this part, I might have actually broken sound
mixing on big-endian platforms.

git-svn-id: https://svn.eduke32.com/eduke32@2630 1a8010ca-5511-0410-912e-c29ae57300e0
2012-05-01 12:40:53 +00:00
helixhorned
410ffae3ab Patch adding Wii support by tueidj, part 9: build.h sector/wall/spr/... limits
On the Wii, V7 (i.e. original) map limits are used and the maximum screen size
is 1600x1200.

git-svn-id: https://svn.eduke32.com/eduke32@2629 1a8010ca-5511-0410-912e-c29ae57300e0
2012-05-01 12:40:24 +00:00
helixhorned
dfa212aaf9 Patch adding Wii support by tueidj, part 8: system-specific changes
- conditionally compiles out some code intended for the PC platforms
- compat.c: get home directory routine, access() implementation
- game.c: don't use ioctl(), lower cache1d size to 8 MiB, Wii-specific
  initialization code and application directory ("apps/eduke32")

git-svn-id: https://svn.eduke32.com/eduke32@2628 1a8010ca-5511-0410-912e-c29ae57300e0
2012-05-01 12:40:08 +00:00
helixhorned
830f73a316 Patch adding Wii support by tueidj, part 6: mutexes
For the Wii, SDL's mutex functionality is used.  The implementation in the
original patch was wrong though, so this part required non-trivial changes.

git-svn-id: https://svn.eduke32.com/eduke32@2626 1a8010ca-5511-0410-912e-c29ae57300e0
2012-05-01 12:39:20 +00:00
helixhorned
a1d3c2dcea Patch adding Wii support by tueidj, part 4: joystick support
- sdlayer.c: custom "get joystick button names" routine
- jmact/mouse.c: packs some joystick events into the value returned by
  MOUSE_GetButtons(): bits used are 256, 512, 4096, 8192
- MOUSE_Init() --> Mouse_Init(), presumably because of a name clash?
- comments out right-shift of joystick analog values by 5, maybe this fixes
  the scale problems with the joystick on the PC too?

git-svn-id: https://svn.eduke32.com/eduke32@2624 1a8010ca-5511-0410-912e-c29ae57300e0
2012-05-01 12:38:43 +00:00
helixhorned
bc70806d32 Patch adding Wii support by tueidj, part 3: SDL-level mouse changes
This part adds support for an absolute pointing device.

git-svn-id: https://svn.eduke32.com/eduke32@2623 1a8010ca-5511-0410-912e-c29ae57300e0
2012-05-01 12:38:14 +00:00
helixhorned
bd8559f6c3 Patch adding Wii support by tueidj, part 2: Makefile changes
I didn't add Makefile.common, because it needs to be made conditional.

git-svn-id: https://svn.eduke32.com/eduke32@2622 1a8010ca-5511-0410-912e-c29ae57300e0
2012-05-01 12:37:53 +00:00
helixhorned
133acaecae Patch adding Wii support by tueidj, part 1: assembly pragmas
The original patch was communicated to me by Hendricks, but since it didn't
apply cleanly (it's based on r2182) I took the liberty of slightly messing
with it for inclusion into EDuke32.

Info: http://wiibrew.org/wiki/User:Tueidj/Duke3D

This first part (which wasn't changed from the original patch) implements
scaling arithmetic and miscellaneous pragmas, some in PPC assembly and a part
of them in C.  Of some interest is the fact that the Wii processor apparently
lacks support for 64-bit integers, so divscale() uses floating-point math.

git-svn-id: https://svn.eduke32.com/eduke32@2621 1a8010ca-5511-0410-912e-c29ae57300e0
2012-05-01 12:37:32 +00:00
helixhorned
226f04ddae Revert r2232, "don't reset full-screen tint on basepal change" in CON setgamepalette.
Because gltexinvalidate*() could be called too often when setgamepalette is used
while having a tint overlaid else.  Pending thorough analysis/reworking of the
32-bit mode base palette handling / texture invalidation.

git-svn-id: https://svn.eduke32.com/eduke32@2620 1a8010ca-5511-0410-912e-c29ae57300e0
2012-04-29 20:55:10 +00:00
helixhorned
6ac80f29ff When deleting GL skin textures, handle the case where they are aliased.
That is, have a second loop over all models run for each deleted tex and
null the texname.  This is ugly, sure, but it's better than calling
glDeleteTextures on stale names.

git-svn-id: https://svn.eduke32.com/eduke32@2619 1a8010ca-5511-0410-912e-c29ae57300e0
2012-04-29 20:54:52 +00:00
helixhorned
28bbde2377 Fix 'realloc' routine of GL texture name (id) debugging code.
git-svn-id: https://svn.eduke32.com/eduke32@2618 1a8010ca-5511-0410-912e-c29ae57300e0
2012-04-29 20:54:37 +00:00
helixhorned
530a183ea0 Prettify some code in mdsprite.c.
- factor out a longish expression
- whitespace, move a var down
- remove unneeded casts (recall: "usual arithmetic conversions")
- strcat -> Bstrcat, strcpy -> Bstrcpy

git-svn-id: https://svn.eduke32.com/eduke32@2617 1a8010ca-5511-0410-912e-c29ae57300e0
2012-04-29 20:54:22 +00:00
helixhorned
059e8ebe52 Fix a null pointer access in Polymer mouse picking.
Specifically, it was in the "determine searchwall when aiming at floor or
ceiling" part.  Now, if prsectors[]->ceil.plane (or ->floor.plane) is NULL,
we set the searchwall to the sector's firstwall and return.

git-svn-id: https://svn.eduke32.com/eduke32@2610 1a8010ca-5511-0410-912e-c29ae57300e0
2012-04-14 13:04:31 +00:00
helixhorned
90144e1dcc Polymer: when drawing art sky, temporarily set texcoord s wrapping to clamping.
This properly fixes the unwanted vertical lines.

git-svn-id: https://svn.eduke32.com/eduke32@2606 1a8010ca-5511-0410-912e-c29ae57300e0
2012-04-10 20:14:52 +00:00
helixhorned
d44f8c761e Fix flipping masked walls in Mapster/classic.
This has been there since searchbottomwall introduction in r1466.

git-svn-id: https://svn.eduke32.com/eduke32@2604 1a8010ca-5511-0410-912e-c29ae57300e0
2012-04-10 20:14:17 +00:00
helixhorned
7cf95a9b0f Fix aspect correction in fullscreen mode.
Previously, we only set the viewingrange according to the physical screen's
dimensions, but didn't correct yxaspect for a potential non-square pixel
ratio.

git-svn-id: https://svn.eduke32.com/eduke32@2603 1a8010ca-5511-0410-912e-c29ae57300e0
2012-04-09 19:22:31 +00:00
helixhorned
db6225eb5d On Windows, auto-determine r_screenaspect on startup.
Consequently, it's not saved as a setting in either the game or editor
config files.  We do this by calling "GetSystemMetrics(SM_CXSCREEN)"
(accordingly for y) and calculating the cvar by dividing common factors,
since it has to be in the form WWHH.  This may fail for _really_ strange
screen dimensions, so a log message is printed at the very beginning.

git-svn-id: https://svn.eduke32.com/eduke32@2601 1a8010ca-5511-0410-912e-c29ae57300e0
2012-04-09 19:22:00 +00:00
helixhorned
8e0ea2e9c5 On Windows, don't allow map playtesting from Mapster when in fullscreen.
Because this doesn't even seem to work on XP, we're being spammed with
DDERR_SURFACELOST messages...

git-svn-id: https://svn.eduke32.com/eduke32@2600 1a8010ca-5511-0410-912e-c29ae57300e0
2012-04-09 19:21:39 +00:00
helixhorned
cb888a3bdf Fix point deletion in Mapster32.
Previously, it was possible to leave a sector with less than three walls if
a point got deleted transitively by a TROR link.  Now, a proper check is done
for all deletion candidates and a message stating which wall and sector is
problematic is printed.  Thanks for Diaz for pointing out the brokenness.

git-svn-id: https://svn.eduke32.com/eduke32@2599 1a8010ca-5511-0410-912e-c29ae57300e0
2012-04-08 15:52:49 +00:00
helixhorned
714ecf0a21 generateicon: fix inconsistent format letter vs. vararg in fprintf.
git-svn-id: https://svn.eduke32.com/eduke32@2598 1a8010ca-5511-0410-912e-c29ae57300e0
2012-04-08 15:52:24 +00:00
hendricks266
5777eae026 Build tools:
- clearbufbyte --> Bmemset
 - add libm to $(UTILLIBS) to fix building of mkpalette
 - add self-explanatory Makefile commands: dxutils, sdlutils, printdxutils, printsdlutils

git-svn-id: https://svn.eduke32.com/eduke32@2597 1a8010ca-5511-0410-912e-c29ae57300e0
2012-04-08 07:23:24 +00:00
plagman
c35e1005b0 Fix generateicon.
git-svn-id: https://svn.eduke32.com/eduke32@2596 1a8010ca-5511-0410-912e-c29ae57300e0
2012-04-08 04:25:06 +00:00
helixhorned
9a7d1ed1a5 A couple of less interesting changes.
- strip 'inline' from animateoffs() definition, remove declaration in build.h
- one min/max -> clamp
- one malloc/strlen/strcpy -> strdup

git-svn-id: https://svn.eduke32.com/eduke32@2592 1a8010ca-5511-0410-912e-c29ae57300e0
2012-04-05 19:49:54 +00:00
helixhorned
b7df5ffa5f Big clean up in defs.c and related content. The usual stuff...
- factor out many identical checks in a convenient function; some messages
  may read slightly differently now and tile ranges may be handled more strictly
  (error out if one of the limits is invalid)
- factor out two instances of identical (up to one arg) code into
  tile_from_truecolpic
- factor out setting picsiz[] and stuff into set_picsizanm
- some checks
- Make "undefmodelof" non-functional and warn.
- in "animtilerange", if the tile difference is >= 64, error out since we
  can't store it in picanm[]

git-svn-id: https://svn.eduke32.com/eduke32@2588 1a8010ca-5511-0410-912e-c29ae57300e0
2012-04-04 18:58:19 +00:00
helixhorned
c0a8fb0588 Add dummy parsing of "nofloorpalrange" to defs.c.
git-svn-id: https://svn.eduke32.com/eduke32@2587 1a8010ca-5511-0410-912e-c29ae57300e0
2012-04-04 18:57:58 +00:00
helixhorned
b3f485a568 Move some debugging stuff out of compat.h into glbuild.h and common.h.
git-svn-id: https://svn.eduke32.com/eduke32@2586 1a8010ca-5511-0410-912e-c29ae57300e0
2012-04-04 18:57:42 +00:00
plagman
54c3e217dc winlayer: remove Intel whitelist
Allow all drivers for now; if anything, we should start maintaining a
blacklist now that most Intel chips have decent enough support to be
able to run stuff satisfactorily.

git-svn-id: https://svn.eduke32.com/eduke32@2580 1a8010ca-5511-0410-912e-c29ae57300e0
2012-04-01 04:32:17 +00:00
plagman
17d91781c5 Fix OpenGL screenshots with unaligned widths such as 1366
git-svn-id: https://svn.eduke32.com/eduke32@2579 1a8010ca-5511-0410-912e-c29ae57300e0
2012-04-01 04:24:57 +00:00
plagman
223cc81373 sdlayer: don't snap the mouse in debug mode, redux..
git-svn-id: https://svn.eduke32.com/eduke32@2578 1a8010ca-5511-0410-912e-c29ae57300e0
2012-04-01 03:57:36 +00:00
plagman
db81c01b3e engine: fix unused variable permanentlock
git-svn-id: https://svn.eduke32.com/eduke32@2576 1a8010ca-5511-0410-912e-c29ae57300e0
2012-03-31 22:32:05 +00:00
helixhorned
34c0e85295 Allow the screen bounds difference in CON showview/-unbiased to be less than 2.
This requires one tweak in drawrooms' umost/dmost setup to prevent oob access.
Specifically, a coordinate difference of 0 is allowed.  In the classic renderer,
this would mean a one-pixel (real screen coords) height or width.  In Polymost,
it would currently mean a one-pixel height and zero-pixel width, but this might
be subject to change.

git-svn-id: https://svn.eduke32.com/eduke32@2574 1a8010ca-5511-0410-912e-c29ae57300e0
2012-03-31 11:22:19 +00:00
helixhorned
5b036273c9 Really fix PNG screenshots.
git-svn-id: https://svn.eduke32.com/eduke32@2572 1a8010ca-5511-0410-912e-c29ae57300e0
2012-03-29 21:30:01 +00:00
helixhorned
258c19f411 When requesting a non-fogged identity lookup from makepalookup(), alias to palookup[0].
(That is, the base shade table.) Before, we allocated each palookup buffer.
For a vanilla setup, this means that we're now saving 224*32*256 ~= 1.8 megs,
which might be interesting for low-memory gadgets.

git-svn-id: https://svn.eduke32.com/eduke32@2571 1a8010ca-5511-0410-912e-c29ae57300e0
2012-03-29 21:17:35 +00:00
helixhorned
98935fe7a9 Don't fall back on allocache if malloc'ing a palookup buffer or transluc table fails.
First, it's unlikely in our day and age.  Second, they're always free'd at the end,
so allocache'ing them is incorrect.

git-svn-id: https://svn.eduke32.com/eduke32@2570 1a8010ca-5511-0410-912e-c29ae57300e0
2012-03-29 21:17:19 +00:00
helixhorned
0be9b7e568 Make makepalookup() accept NULL for 'remapbuf', meaning "use identity mapping".
Also,
 - use this in game.c and astub.c palookup loading code
 - when makepalookup() is passed a 0 palnum, return early.  This means that
   'fogpal' will silently fail when attempting to change pal 0.
 - in 'makepalookup' DEF command, error out if passed a pal of 0.

git-svn-id: https://svn.eduke32.com/eduke32@2569 1a8010ca-5511-0410-912e-c29ae57300e0
2012-03-29 21:17:03 +00:00
helixhorned
a7eb29027f DEF command 'makepalookup', allowing indpt. specification of fog and color remapping.
The syntax is as follows:
  makepalookup { <token-list...> }
where valid tokens are
  * pal <palnum>:  the palette number, 1 .. 250
  * red <num>, green, blue (or r, g, b):  the fog color components on a 0 to 63 scale.
    Components that are not present are assumed to be 0.
  * remappal <palnum>:  the palette number to take the index remapping from, i.e. 21
    for blue -> red.  When absent, defaults to 0.
  * remapself:  when present, specifies that the remappal is the same as the 'pal'.
    This is to prevent textual redundancy when overwriting existing palookups.

Examples (best tested with tile #251):
  1) makepalookup { pal 200  red 30  remappal 23 }
     This creates palookup 200 with a fog of (30,0,0) and a blue-to-yellow remapping
     (assuming it has not been changed before)
  2) makepalookup { pal 21  red 30  remapself }
     This 'fogifies' palookup 21 with a red fog.
  3) makepalookup { pal 21  red 30 }
     This overwrites palookup 21 with a red fog, but clears the blue-to-red remapping.

The fog aspect of this command affects the GL modes just like 'fogpal', but the
remapping has no effect for hightiles.

- Also, silently clamp 'fogpal' r,g,b values to the range 0 .. 63.

git-svn-id: https://svn.eduke32.com/eduke32@2568 1a8010ca-5511-0410-912e-c29ae57300e0
2012-03-29 21:16:41 +00:00
helixhorned
c5d8aa29ee The obligatory portion of trivial stuff.
git-svn-id: https://svn.eduke32.com/eduke32@2566 1a8010ca-5511-0410-912e-c29ae57300e0
2012-03-28 19:45:25 +00:00
helixhorned
994bdd4759 Polymer: Fix a potential uninitialized mem read in debug msg when in void space.
git-svn-id: https://svn.eduke32.com/eduke32@2565 1a8010ca-5511-0410-912e-c29ae57300e0
2012-03-28 19:45:05 +00:00
helixhorned
77918caf9c New helper function "char *dup_filename(const char *fn)" in common.h.
It allocates a buffer of size BMAX_PATH and copies the passed string into it.

git-svn-id: https://svn.eduke32.com/eduke32@2560 1a8010ca-5511-0410-912e-c29ae57300e0
2012-03-28 19:43:39 +00:00
helixhorned
0e3adea64e Replace various occurences of "Bstrncpy(buf, src, sz); buf[sz-1]=0;" with Bstrncpyz
git-svn-id: https://svn.eduke32.com/eduke32@2559 1a8010ca-5511-0410-912e-c29ae57300e0
2012-03-28 19:43:21 +00:00
helixhorned
0ea9feee2d Minor tweaks of makepalookup() and hicinit().
git-svn-id: https://svn.eduke32.com/eduke32@2558 1a8010ca-5511-0410-912e-c29ae57300e0
2012-03-28 19:42:49 +00:00
helixhorned
0c5c58cbbb Replace {get,clear}filenames with fnlist functions in build.c, menus.c and osdcmds.c
git-svn-id: https://svn.eduke32.com/eduke32@2556 1a8010ca-5511-0410-912e-c29ae57300e0
2012-03-28 19:42:16 +00:00
helixhorned
a7f6f3bacc Factor out different {clear,get}filenames definitions into fnlist_t + functions.
Don't actually replace the instances in the code now.
Additions in common.h:
 - fnlist_t, which combines CACHE1D_FIND_REC *finddirs, *findfiles and
   int32_t numdirs, numfiles
 - the FNLIST_INITIALIZER macro, which MUST be used for automatic variables
 - fnlist_clearnames, fnlist_getnames functions
 - G_LoadGroupsInDir, G_DoAutoload, two often-occurring uses of these

git-svn-id: https://svn.eduke32.com/eduke32@2555 1a8010ca-5511-0410-912e-c29ae57300e0
2012-03-28 19:41:57 +00:00
helixhorned
d77e388522 Factor out eleven (!) instances of identical code into check_file_exist().
git-svn-id: https://svn.eduke32.com/eduke32@2554 1a8010ca-5511-0410-912e-c29ae57300e0
2012-03-28 19:41:39 +00:00
helixhorned
d8b9c9b188 Clean up defs.c a little.
- remove redundant bound checks
- add necessary bound checks
- make one comparison pair consistent (> vs. >=)
- one if-if --> clamp

git-svn-id: https://svn.eduke32.com/eduke32@2553 1a8010ca-5511-0410-912e-c29ae57300e0
2012-03-28 19:41:15 +00:00
helixhorned
e350502cd0 Add "static inline" helper function "Bstrncpyz" to compat.h.
git-svn-id: https://svn.eduke32.com/eduke32@2550 1a8010ca-5511-0410-912e-c29ae57300e0
2012-03-26 22:05:38 +00:00
helixhorned
e7f091cd90 Factor out various instances of getatoken() into common.c.
Alongside, these make into into the header:
 - the 'tokenlist' type (a typedef'd struct)
 - the T_EOF and T_ERROR enumeration values

git-svn-id: https://svn.eduke32.com/eduke32@2549 1a8010ca-5511-0410-912e-c29ae57300e0
2012-03-26 22:05:23 +00:00
helixhorned
b7495ef5bd Guard scriptfile.h with an #ifndef sentinel.
git-svn-id: https://svn.eduke32.com/eduke32@2548 1a8010ca-5511-0410-912e-c29ae57300e0
2012-03-26 22:04:59 +00:00
helixhorned
e74f8cada1 Replace all occurences of assert in our code with Bassert.
git-svn-id: https://svn.eduke32.com/eduke32@2547 1a8010ca-5511-0410-912e-c29ae57300e0
2012-03-26 22:04:44 +00:00
helixhorned
2cc9f751cd Add Bassert to compatibility macros/functions, currently only an assert wrapper.
git-svn-id: https://svn.eduke32.com/eduke32@2546 1a8010ca-5511-0410-912e-c29ae57300e0
2012-03-26 22:04:24 +00:00
helixhorned
ebaf65951b Change input and return types of inline function clamp() from int to int32_t.
git-svn-id: https://svn.eduke32.com/eduke32@2545 1a8010ca-5511-0410-912e-c29ae57300e0
2012-03-26 22:04:06 +00:00
helixhorned
ee5dd2cf32 Add common.[ch] which should be used for common non-engine types/functions/data.
As inauguration, move G_AddGroup, G_AddPath and struct strllist there.
The header is located in build/include, because in the future, code that resides
closer to (but is not strictly part of) the engine might need to be factored
into here.  The source file, however, is in the source/ directory.

git-svn-id: https://svn.eduke32.com/eduke32@2542 1a8010ca-5511-0410-912e-c29ae57300e0
2012-03-26 22:03:20 +00:00
hendricks266
9d74cd700e Add "specularpower" and "specularfactor" as synonyms of "specpower" and "specfactor" respectively.
git-svn-id: https://svn.eduke32.com/eduke32@2539 1a8010ca-5511-0410-912e-c29ae57300e0
2012-03-26 05:06:31 +00:00
hendricks266
9f61e6e2d5 Superficial text changes:
- Help window text cleaned and made more consistent between game and editor
 - Added help entry for "-clipmap"
 - Log text for using CON, DEF, and RTS files has been made consistent
 - All instances of '%s' have been replaced with \"%s\" because ' is a valid filename character. (At least on Windows.)

git-svn-id: https://svn.eduke32.com/eduke32@2538 1a8010ca-5511-0410-912e-c29ae57300e0
2012-03-26 05:05:57 +00:00
hendricks266
3929d60744 OS X: Fix more warnings.
git-svn-id: https://svn.eduke32.com/eduke32@2537 1a8010ca-5511-0410-912e-c29ae57300e0
2012-03-26 05:04:21 +00:00
plagman
90e410cf47 polymer: cull sprite lights after computing sprite geometry
This was broken ever since updatesprite() had been forked off drawsprite() and
would cause static lights to never hit static sprites until one or the other
changed, after which the light would always get culled against outdated sprite
geometry.

git-svn-id: https://svn.eduke32.com/eduke32@2536 1a8010ca-5511-0410-912e-c29ae57300e0
2012-03-26 00:55:53 +00:00
plagman
3818282811 polymer: don't shadow-optimize light culling in cached sprites
Since updatesprite() only happens once for static sprites, avoiding
light culling if we hit it in a shadow pass means that sprite will
never be lit as long as that happens.

git-svn-id: https://svn.eduke32.com/eduke32@2535 1a8010ca-5511-0410-912e-c29ae57300e0
2012-03-26 00:55:41 +00:00
helixhorned
b897a59d82 Bound-check the 'picnum' argument to rotatesprite; tweak CON digitalnumber check.
There are instances where oob picnums may propagate to that function, so
protect it.  The digitanumber[z] bound check is actually made more permissive,
but could also just as well be removed now.

git-svn-id: https://svn.eduke32.com/eduke32@2533 1a8010ca-5511-0410-912e-c29ae57300e0
2012-03-25 22:01:21 +00:00
helixhorned
6cd11d0468 Accumulated trivia.
- engine.c: move some variables into a lower block
- premap.c: clearbufbyte --> Bmemset

git-svn-id: https://svn.eduke32.com/eduke32@2532 1a8010ca-5511-0410-912e-c29ae57300e0
2012-03-25 22:01:03 +00:00
helixhorned
e706258c43 Fix an assertion failure with dorotatesprite 4-pixels vline drawing.
See http://forums.duke4.net/topic/5362-crash-with-current-svn/

git-svn-id: https://svn.eduke32.com/eduke32@2529 1a8010ca-5511-0410-912e-c29ae57300e0
2012-03-25 13:55:03 +00:00
helixhorned
adc8b302ea Factor out two practically identical instances of ceiling/floor setup code.
git-svn-id: https://svn.eduke32.com/eduke32@2527 1a8010ca-5511-0410-912e-c29ae57300e0
2012-03-25 13:54:31 +00:00
helixhorned
102e97659d Factor out assignment of various globals in 4 instances of wall drawing code.
This makes the differences in these codes stand out much more clearly.

git-svn-id: https://svn.eduke32.com/eduke32@2526 1a8010ca-5511-0410-912e-c29ae57300e0
2012-03-25 13:54:14 +00:00
helixhorned
549e9f6216 Make "LIBS+= $(L_SSP) -Wl,--enable-auto-import" conditional to Windows.
git-svn-id: https://svn.eduke32.com/eduke32@2525 1a8010ca-5511-0410-912e-c29ae57300e0
2012-03-24 15:59:53 +00:00
hendricks266
0122764017 - Makefiles:
- Fix typo, correctly adding SDL libs to the tools on OS X so that makesdlkeytrans builds.
  - Move all mention of $(LIBS) out of build/Makefile into build/Makefile.shared because no linking takes place in the engine itself so LIBS additions were lost. This should fix USE_LIBPNG=1 on Windows at least.
- Other assorted cleanup.

git-svn-id: https://svn.eduke32.com/eduke32@2523 1a8010ca-5511-0410-912e-c29ae57300e0
2012-03-24 08:30:28 +00:00
hendricks266
fd71c5ef4c Build tools:
- Fix up and add building instructions for kmd2tool, getdxdidf, and makesdlkeytrans.
 - Add kmd2tool to "utils" build job.
 - Fix warning in and cross-platform building of generateicon.
 - Source and text cleanup!

git-svn-id: https://svn.eduke32.com/eduke32@2521 1a8010ca-5511-0410-912e-c29ae57300e0
2012-03-23 20:23:46 +00:00
hendricks266
64595adfb2 Makefiles:
- Properly handle the architecture definition when BUILD32_ON_64=1
 - Add proper $(*LDFLAGS) to which LTO and ARCH are correctly passed.
 - Cleanup of compiler flag variables.

This should fix to some degree building of the Build tools on OS X, and it may possibly fix the crashing of the OS X x86 32-bit build.

git-svn-id: https://svn.eduke32.com/eduke32@2520 1a8010ca-5511-0410-912e-c29ae57300e0
2012-03-23 20:22:10 +00:00
helixhorned
d51d9a0fb8 Rather trivial changes in engine.c and crc32.c.
git-svn-id: https://svn.eduke32.com/eduke32@2519 1a8010ca-5511-0410-912e-c29ae57300e0
2012-03-22 22:48:06 +00:00
helixhorned
55dc8fee40 Make engine.c's loadpalette return -1 if palette.dat is not found.
... and initengine now returns 1 if loadpalette() fails.

git-svn-id: https://svn.eduke32.com/eduke32@2514 1a8010ca-5511-0410-912e-c29ae57300e0
2012-03-22 22:46:39 +00:00
helixhorned
993b971107 editor: Factor out 'rainbow' drawing code and use bytesperline instead of xdimen.
git-svn-id: https://svn.eduke32.com/eduke32@2513 1a8010ca-5511-0410-912e-c29ae57300e0
2012-03-22 22:46:23 +00:00
helixhorned
23bb14f8aa In in-game overhead map, don't draw invisible extended floors.
git-svn-id: https://svn.eduke32.com/eduke32@2511 1a8010ca-5511-0410-912e-c29ae57300e0
2012-03-22 22:45:41 +00:00
hendricks266
2c27c33da8 Makefile: Link to libz on OS X like on Windows.
git-svn-id: https://svn.eduke32.com/eduke32@2510 1a8010ca-5511-0410-912e-c29ae57300e0
2012-03-20 19:33:24 +00:00
hendricks266
5564537510 Makefile: Update/fix treatment of libpng libraries and headers under Windows and OS X.
git-svn-id: https://svn.eduke32.com/eduke32@2509 1a8010ca-5511-0410-912e-c29ae57300e0
2012-03-20 19:30:50 +00:00
hendricks266
a35dc578e0 Makefiles: Add $(STATICSTDCPP) variable which the user can set to 0 or 1 to explicitly set C++ standard library linking to static or shared respectively. By default it is transparently left blank.
An effect is only really seen in the buildtools written in C++, currently just arttool.
This is mainly of interest to distributors of the buildtools to avoid missing DLL errors.

git-svn-id: https://svn.eduke32.com/eduke32@2507 1a8010ca-5511-0410-912e-c29ae57300e0
2012-03-20 19:29:11 +00:00
helixhorned
ea9abc58c9 Probably fix sheared PNG screenshots.
We shouldn't assume a particular bytes-per-line value and use ylookup[] instead.
Specifically, windowed modes on Windows use a frame buffer that always has odd
x dimension.

git-svn-id: https://svn.eduke32.com/eduke32@2505 1a8010ca-5511-0410-912e-c29ae57300e0
2012-03-20 18:32:16 +00:00
helixhorned
51398ca749 Rename 'numpalookups' to 'numshades' internally.
git-svn-id: https://svn.eduke32.com/eduke32@2504 1a8010ca-5511-0410-912e-c29ae57300e0
2012-03-20 18:32:00 +00:00
helixhorned
97020caf73 Clear up after r2495. (Because I'm a pedantic asshole.)
- in Mapster, pre-form the default 10 clip map names before returning from
  G_CheckCommandLine() so it gets loaded even if we passed no cmdline args.
- malloc + strlen + strcpy --> strdup
- don't need to spank dead variables ;)
- we may call calloc with zero size, which isn't bad by itself, but asserting
  for non-null afterwards is.  Allocs of 0 are implementation-defined, and may
  well return a null pointer (C99 7.20.3).

git-svn-id: https://svn.eduke32.com/eduke32@2502 1a8010ca-5511-0410-912e-c29ae57300e0
2012-03-18 23:18:32 +00:00
helixhorned
9628041766 Assorted trivia.
Make some computer Duke opponent variables in player.c static.

git-svn-id: https://svn.eduke32.com/eduke32@2501 1a8010ca-5511-0410-912e-c29ae57300e0
2012-03-18 23:18:12 +00:00
helixhorned
359614df70 Input validation: guard makepalookup 'pal', 2dcol 'col'. Add one const.
git-svn-id: https://svn.eduke32.com/eduke32@2500 1a8010ca-5511-0410-912e-c29ae57300e0
2012-03-18 23:17:51 +00:00
helixhorned
eb52100654 Use vlineasm4 for the upright-oriented rotatesprite in C-replacements build.
Gives a couple more fps for scenes where much screen estate is covered by
stuff, like when holding the devastator.

git-svn-id: https://svn.eduke32.com/eduke32@2499 1a8010ca-5511-0410-912e-c29ae57300e0
2012-03-18 23:17:32 +00:00
helixhorned
020c60feec Port tvlineasm2 to C and enable transmaskvline2 code also for all-C builds.
With the same setup as before, a screen-filling translucent wall (with nothing
drawn behind it) renders at about 7 fps faster (from 60-something fps initially)

git-svn-id: https://svn.eduke32.com/eduke32@2498 1a8010ca-5511-0410-912e-c29ae57300e0
2012-03-18 23:17:17 +00:00
helixhorned
e191a915f7 Port [m]vlineasm4 to C replacements and enable for solid and masked walls.
These two functions draw a vertical line 4 neighboring pixels at a time.
This gives a significant speed boost for a full screen solid and masked wall
scene for x86_64 (where we have plenty of registers), about 60 --> 76 fps.

git-svn-id: https://svn.eduke32.com/eduke32@2497 1a8010ca-5511-0410-912e-c29ae57300e0
2012-03-18 23:16:57 +00:00
hendricks266
cf2b9ec940 New "-clipmap" command-line switch to specify sector collision clip maps. This switch works in an additive fashion like -mx and -mh. _clipshape0.map through _clipshape9.map remain loaded by default.
Also, a very minor change in the con/def module code. (int --> int32_t)

git-svn-id: https://svn.eduke32.com/eduke32@2495 1a8010ca-5511-0410-912e-c29ae57300e0
2012-03-18 08:50:41 +00:00
hendricks266
3503a42a9a Buildtools: Add "unpackssi" and "Build Customization Suite" [Palette Importer/Extractor] (bsuite), both by JonoF. I have rewritten bsuite to use command-line arguments rather than a 16-bit real mode DOS UI. Both programs have had all warnings fixed and whitespace corrected.
git-svn-id: https://svn.eduke32.com/eduke32@2493 1a8010ca-5511-0410-912e-c29ae57300e0
2012-03-18 08:48:32 +00:00
hendricks266
44cf8c47c7 osxbuild.sh:
- Make all arguments explicit toggles (except for onlyzip).
 - Disable PowerPC builds by default on Snow Leopard in addition to Lion.
 - Enable Darwin 9 compatibility for all builds whenever PowerPC is enabled.

git-svn-id: https://svn.eduke32.com/eduke32@2487 1a8010ca-5511-0410-912e-c29ae57300e0
2012-03-17 07:25:46 +00:00
helixhorned
5e1b3bd44b Re-enable Mapster32's undo/redo functionality.
git-svn-id: https://svn.eduke32.com/eduke32@2486 1a8010ca-5511-0410-912e-c29ae57300e0
2012-03-15 18:12:17 +00:00
helixhorned
fbf0b9ea4f Include <assert.h> in compat.h.
git-svn-id: https://svn.eduke32.com/eduke32@2481 1a8010ca-5511-0410-912e-c29ae57300e0
2012-03-14 22:31:19 +00:00
helixhorned
2351c2648f When loading map w/ oob sectnum sprites, make them have sect. 0 if updatesector fails.
Previously, if the sprite turned really out to be in void space, either freelist
inconsistency (before the list rewrite) or oob access (now) would happen.
Also add an bound-checking assert() for insertsprite's sectnum argument (it's not
a bound check!)

git-svn-id: https://svn.eduke32.com/eduke32@2480 1a8010ca-5511-0410-912e-c29ae57300e0
2012-03-14 22:30:57 +00:00
helixhorned
77630792f6 Mapster32: fix faulty limit check in duplicate_selected_sprites().
git-svn-id: https://svn.eduke32.com/eduke32@2479 1a8010ca-5511-0410-912e-c29ae57300e0
2012-03-14 22:30:42 +00:00
helixhorned
4d4221d71f Continuously keep track of the number of sprites in the world.
New engine variable 'int32_t Numsprites', not yet saved into savegames
or mapstates. (The capitalization is to distinguish it from the often-used
'numsprites' locals or structure member names.
In the editor, get rid of updatenumsprites().

git-svn-id: https://svn.eduke32.com/eduke32@2478 1a8010ca-5511-0410-912e-c29ae57300e0
2012-03-14 22:30:24 +00:00
helixhorned
9c34845faa Remove redundant sprite freelist.
Previously, the lists starting at headspritestat[MAXSTATUS] and
headspritesect[MAXSECTORS] were both used as sprite freelists and were always
in complete synchrony.  Now, make only the statnum list keep the free sprites.
This way, it has no CON compatibility implications because
headspritesect[MAXSECTORS] is inaccessible there.  Leave the array at its
original size for now.

git-svn-id: https://svn.eduke32.com/eduke32@2477 1a8010ca-5511-0410-912e-c29ae57300e0
2012-03-14 22:29:45 +00:00
hendricks266
5e19a48754 osxbuild.sh: new "tools" parameter builds the Build tools in addition to the full binaries
Makefiles: new features to facilitate above:
 - buildtools: "make printutils" is a phony which simply lists all the tools
 - $(EXESUFFIX_OVERRIDE)

git-svn-id: https://svn.eduke32.com/eduke32@2476 1a8010ca-5511-0410-912e-c29ae57300e0
2012-03-14 06:27:45 +00:00
hendricks266
7b76865aaa Buildtools: Fix warnings in enumdisplay.c only revealed with the previous Makefile edits.
git-svn-id: https://svn.eduke32.com/eduke32@2475 1a8010ca-5511-0410-912e-c29ae57300e0
2012-03-14 06:27:06 +00:00
hendricks266
658c5448fe Buildtools: More Makefile changes, including bringing Makefile.msvc up to date.
git-svn-id: https://svn.eduke32.com/eduke32@2474 1a8010ca-5511-0410-912e-c29ae57300e0
2012-03-14 06:26:29 +00:00
hendricks266
67f946bdd8 Build tools: Whitespace cleanup and tab stop replacement.
git-svn-id: https://svn.eduke32.com/eduke32@2473 1a8010ca-5511-0410-912e-c29ae57300e0
2012-03-14 06:25:26 +00:00
hendricks266
a9fc470258 Fix all warnings in the Build tools for both GCC and Clang.
git-svn-id: https://svn.eduke32.com/eduke32@2472 1a8010ca-5511-0410-912e-c29ae57300e0
2012-03-14 06:24:03 +00:00
helixhorned
26dfddfaf0 Trivial stuff that got accumulated and not committed.
git-svn-id: https://svn.eduke32.com/eduke32@2471 1a8010ca-5511-0410-912e-c29ae57300e0
2012-03-13 20:07:40 +00:00
helixhorned
b044502709 When deleting sprites, insert them at the tail (instead of head) of the freelist.
The major outside-visible change is that this fixes the sound cutoff bugs that
happened because newly-spawned sprites took the place of those whose sounds
had not yet finished playing.

Besides, there are these changes:
 - remove deletesprite{sect,stat}
 - we have a new engine variable 'tailspritefree' that keeps track of the
   sprite freelist tail
 - we need to store it in savegames and mapstates, so bump the savegame
   minor version

git-svn-id: https://svn.eduke32.com/eduke32@2470 1a8010ca-5511-0410-912e-c29ae57300e0
2012-03-13 20:07:17 +00:00
helixhorned
f996995fe5 Implement changesprite{sect,stat} without temp. freelist insertion/deletion.
This is simply done by using the two list helper functions defined earlier
instead of a deletespriteX/insertspriteX pair.

git-svn-id: https://svn.eduke32.com/eduke32@2469 1a8010ca-5511-0410-912e-c29ae57300e0
2012-03-13 20:06:52 +00:00
helixhorned
4e59887198 Engine tweaks, more or less trivial stuff.
git-svn-id: https://svn.eduke32.com/eduke32@2468 1a8010ca-5511-0410-912e-c29ae57300e0
2012-03-13 20:06:37 +00:00
helixhorned
2ec4d1e150 engine.c: more changesprite{sect,stat} source up to be with the others.
git-svn-id: https://svn.eduke32.com/eduke32@2467 1a8010ca-5511-0410-912e-c29ae57300e0
2012-03-13 20:06:22 +00:00
helixhorned
60d70854c8 Remix sprite list manipulation functions.
Factor out two helper functions, do_deletesprite{sect,stat}
and do_insertsprite_at_headof{sect,stat}.

git-svn-id: https://svn.eduke32.com/eduke32@2466 1a8010ca-5511-0410-912e-c29ae57300e0
2012-03-13 20:06:07 +00:00
helixhorned
846214a164 Move insertsprite() and deletesprite() into engine.c instead of being inlined.
These operations aren't executed THAT often to warrant exposing four internal
functions.  Besides, I'll be hacking on them and need everything laid out
cleanly.  Should somebody complain, they can go change them to __fastcall or
something.

git-svn-id: https://svn.eduke32.com/eduke32@2465 1a8010ca-5511-0410-912e-c29ae57300e0
2012-03-13 20:05:51 +00:00
helixhorned
b359d0dce9 engine cleanup: make pow2char and pow2long const, make voxlock static.
git-svn-id: https://svn.eduke32.com/eduke32@2463 1a8010ca-5511-0410-912e-c29ae57300e0
2012-03-13 20:05:20 +00:00
helixhorned
42f5a7d9c9 Comment and format the engine's sprite list management functions; one tweak.
In changesprite{stat,sect}, don't check for deletesprite{stat,sect} failure,
because the only way it can fail was already checked for above.  So, this is
essentially dead code elimination.

git-svn-id: https://svn.eduke32.com/eduke32@2462 1a8010ca-5511-0410-912e-c29ae57300e0
2012-03-13 20:04:56 +00:00
helixhorned
d5a24b38de Remove some old comments. (sprite removal code at loadboard, bug notice)
git-svn-id: https://svn.eduke32.com/eduke32@2461 1a8010ca-5511-0410-912e-c29ae57300e0
2012-03-13 20:04:39 +00:00
hendricks266
c5519e3fe8 More Build tools improvements:
- JFBuild ports: arttool, givedepth, and mkpalette
 - All viable tools are now built when 'make utils' is invoked, not just some
 - Revert "initprintf" hack of previous commit and replace it with "compat_tools.c"
 - Move Bstrtolower from baselayer.c to compat.c
 - Makefiles: Add start and finish messages for the tools
 - Makefiles: To prevent "-Wimplicit" from being passed to the C++ compiler, create $(*CONLYFLAGS)

git-svn-id: https://svn.eduke32.com/eduke32@2458 1a8010ca-5511-0410-912e-c29ae57300e0
2012-03-12 04:48:42 +00:00
hendricks266
d0e0738f4f Fix compiling the Build tools by:
- Adding $(EXESUFFIX) where it belongs in the Makefile.
 - Eliminating a call to initprintf() from compat.c. This may not be ideal.

git-svn-id: https://svn.eduke32.com/eduke32@2457 1a8010ca-5511-0410-912e-c29ae57300e0
2012-03-12 04:47:49 +00:00
hendricks266
858746d081 Fix JonoF's email address.
git-svn-id: https://svn.eduke32.com/eduke32@2456 1a8010ca-5511-0410-912e-c29ae57300e0
2012-03-12 04:47:04 +00:00
helixhorned
af2f862c85 Remove YES and NO #defines from duke3d.h since they're giving warnings on OS X.
git-svn-id: https://svn.eduke32.com/eduke32@2450 1a8010ca-5511-0410-912e-c29ae57300e0
2012-03-11 17:37:25 +00:00
helixhorned
6dd048dc84 Core texture mapping functions cleanup.
- forgot a glogy --> logy in a-c.c
- comment out stretchhline and slopevlin2 in a.nasm, the former also in a-c.c
- make transmaskvline2 use a uintptr_t where appropriate

git-svn-id: https://svn.eduke32.com/eduke32@2448 1a8010ca-5511-0410-912e-c29ae57300e0
2012-03-11 17:36:49 +00:00
hendricks266
5f3000522a - Makefiles: fix handling of "-Wstrict-overflow=1" to fix Leopard 10.5/Xcode 3.1.4 compatibility
- osxbuild.sh: explicitly specify "ARCH='-arch x86_64'" for 64-bit builds

git-svn-id: https://svn.eduke32.com/eduke32@2444 1a8010ca-5511-0410-912e-c29ae57300e0
2012-03-11 07:11:59 +00:00
plagman
cdafeef732 polymer: fix animations that loop to frame 0
With VBOs enabled, the virtual pointer to the geometry of frame 0 of a model
is always NULL. This was confusing the polymer code responsible for deciding
whether to enable smooth animations or not, which meant that any animation
that would loop to frame 0 would do it as if animation interpolation was
disabled, which looks very choppy.

git-svn-id: https://svn.eduke32.com/eduke32@2443 1a8010ca-5511-0410-912e-c29ae57300e0
2012-03-11 06:52:41 +00:00
helixhorned
58a8e36374 Clean up cache1d.c.
- make some variables static
- conditionally compile out some code with DEBUG_ALLOCACHE_AS_MALLOC
- exit(1) on failure (instead of exit(0))
- some formatting

git-svn-id: https://svn.eduke32.com/eduke32@2438 1a8010ca-5511-0410-912e-c29ae57300e0
2012-03-10 21:21:20 +00:00
hendricks266
27e68e85e5 Add file existence check for model skins.
git-svn-id: https://svn.eduke32.com/eduke32@2436 1a8010ca-5511-0410-912e-c29ae57300e0
2012-03-10 09:44:54 +00:00
hendricks266
96db75dc5e Add "echo" def parameter which prints a string to the console and log file.
Syntax: echo "Your text here."

git-svn-id: https://svn.eduke32.com/eduke32@2435 1a8010ca-5511-0410-912e-c29ae57300e0
2012-03-10 09:44:17 +00:00
hendricks266
92b49b6938 OS X: fix build under Leopard/Xcode 3.1.4
git-svn-id: https://svn.eduke32.com/eduke32@2432 1a8010ca-5511-0410-912e-c29ae57300e0
2012-03-09 07:43:49 +00:00
helixhorned
8b25714262 OS X: whitespace-cleanup Objective-C files. Also does TAB-->space.
git-svn-id: https://svn.eduke32.com/eduke32@2431 1a8010ca-5511-0410-912e-c29ae57300e0
2012-03-08 19:16:47 +00:00
helixhorned
3b89d3af08 OS X: fix and enable startup windows; enable PPC build in osxbuild.sh.
git-svn-id: https://svn.eduke32.com/eduke32@2430 1a8010ca-5511-0410-912e-c29ae57300e0
2012-03-08 19:16:30 +00:00
helixhorned
8c4151f8af OS X Objective-C files: NSApp -> nsapp as before for a PPC linkage fix
Note: I'm not really sure whether I'm initializing it in the right places.

git-svn-id: https://svn.eduke32.com/eduke32@2429 1a8010ca-5511-0410-912e-c29ae57300e0
2012-03-08 19:16:06 +00:00
helixhorned
91c13a4ee6 cleanup: remove now unused B_ATTRIBUTE_USED macro.
git-svn-id: https://svn.eduke32.com/eduke32@2428 1a8010ca-5511-0410-912e-c29ae57300e0
2012-03-08 19:15:18 +00:00
helixhorned
07426ccc2a Polymost: fix mirror-related oob access analogous to r1872's fix for classic.
When drawing from inside the mirror, there may be no 'bunches' (BUILD lingo,
not TROR ones) collected, but following code used the first one unconditionally.

git-svn-id: https://svn.eduke32.com/eduke32@2427 1a8010ca-5511-0410-912e-c29ae57300e0
2012-03-08 19:15:03 +00:00
hendricks266
9f78a773f1 Add "OSX_STARTUPWINDOW" Makefile variable to toggle the OS X startup window. Off by default.
git-svn-id: https://svn.eduke32.com/eduke32@2426 1a8010ca-5511-0410-912e-c29ae57300e0
2012-03-08 06:07:10 +00:00
helixhorned
dca9d1357c Optimizations and tweaks for C replacements of mhline and thline.
Hlines for masked and translucent masked ceiling/floor (sprites).

- apply the --> 'do { ... } while (--cnt)' transformation, making these
  functions iterate cnt+1 times like the asm version.  This also fixes an
  off-by-one issue where sprites or masked ceilings/floors had a one-pixel
  non-drawn line to the right.
- This time, only declare-as-local two 'extern' globals (asm1 and asm2).
  It seems that I was too eager with "localing" all file-scoped vars earlier.
  GCC is able to remove the loads from memory inside the loop by itself, whereas
  clang is not. This is not trivial, since it has to prove that the 'screen'
  pointer passed to the functions will never alias these globals.

git-svn-id: https://svn.eduke32.com/eduke32@2424 1a8010ca-5511-0410-912e-c29ae57300e0
2012-03-07 19:42:37 +00:00
helixhorned
aa89dc6725 Optimize 'rainbow' background drawing in the editor with 8-bit renderer.
git-svn-id: https://svn.eduke32.com/eduke32@2423 1a8010ca-5511-0410-912e-c29ae57300e0
2012-03-07 19:42:20 +00:00
hendricks266
35937454ad Fix -Wformat-security and -Wformat-extra-args warnings under clang.
git-svn-id: https://svn.eduke32.com/eduke32@2421 1a8010ca-5511-0410-912e-c29ae57300e0
2012-03-05 07:25:24 +00:00
hendricks266
5b76b7dbba Remove ATTRIBUTE((used)) from gotpic[] because it only served to generate warnings when using LTO.
git-svn-id: https://svn.eduke32.com/eduke32@2418 1a8010ca-5511-0410-912e-c29ae57300e0
2012-03-05 07:23:34 +00:00
helixhorned
d4577fccb5 Formatting; remove 'loop has empty body' warnings with clang.
I have to admit, I like its grumbling.

git-svn-id: https://svn.eduke32.com/eduke32@2416 1a8010ca-5511-0410-912e-c29ae57300e0
2012-03-04 20:15:22 +00:00
helixhorned
cd8836227f Polymost: with r_parallaxskypanning=1, clamp the sky at a constant horizon.
See E4L1 for what this means.

git-svn-id: https://svn.eduke32.com/eduke32@2415 1a8010ca-5511-0410-912e-c29ae57300e0
2012-03-04 20:15:04 +00:00
helixhorned
50375fcff2 Fix apparent horizon not being independent of viewingrange (classic/Polymost).
The apparent horizon (in units proportional to pixels by a constant factor)
was being calculated without normalizing to viewingrange, resulting a
discrepancy between the drawn and actual up/down angle with non-default
viewingranges (e.g. with r_usenewaspect=1, or when setting it from setaspect).
This also means that the center-of-aim will now be the same regardless of
the aspect.

This fixes many derived bugs:
 * inconsistency w/ crosshair when shooting a gun and aiming up/down (obviously)
 * bugs resulting from being able to look up/down too far (garbage non-slope
   texture-mapping and viewing BIGORBIT skies above the borders in classic).

Note: mods that had workaround logic for this bug will have to remove it...

git-svn-id: https://svn.eduke32.com/eduke32@2414 1a8010ca-5511-0410-912e-c29ae57300e0
2012-03-04 20:14:48 +00:00
helixhorned
9eae2b485a ATTRIBUTE((pure)) for Ptile2tile(), add a forgotten comment.
git-svn-id: https://svn.eduke32.com/eduke32@2412 1a8010ca-5511-0410-912e-c29ae57300e0
2012-03-04 20:14:18 +00:00
helixhorned
2dca87b80a Make 'double ghoriz' static in polymost.c.
git-svn-id: https://svn.eduke32.com/eduke32@2409 1a8010ca-5511-0410-912e-c29ae57300e0
2012-03-04 20:13:34 +00:00
helixhorned
6065fbd38c Apply transformations to nonpow2_mhline and nonpow2_thline.
This has no measureable difference. Oh well, maybe it benefits weaker
machines, since the generated loop code should definitely be prettier.

git-svn-id: https://svn.eduke32.com/eduke32@2408 1a8010ca-5511-0410-912e-c29ae57300e0
2012-03-04 20:13:16 +00:00
helixhorned
bb5f118985 Optimize fade_screen_black(). 49 --> 54 fps for test scene.
git-svn-id: https://svn.eduke32.com/eduke32@2407 1a8010ca-5511-0410-912e-c29ae57300e0
2012-03-04 20:13:01 +00:00
helixhorned
823d37fb51 Apply the transformations of the previous commit to tslopevlin().
This doesn't give much, maybe 0.5 fps more, probably because the
loop body is pretty long.

git-svn-id: https://svn.eduke32.com/eduke32@2406 1a8010ca-5511-0410-912e-c29ae57300e0
2012-03-04 20:12:46 +00:00
helixhorned
792ac2fdf0 Optimization of C replacements of basic texture mapping functions, part 1
Affected functions: hlineasm4, vlineasm1, mvlineasm1, tvlineasm1.

Optimizations:
 - declare all used variables as possibly const-qualified locals in each
   function. This removes unnecessary loads from memory in the loops.
 - rewrite "for (; cnt>=0; cnt--) {...}" to "cnt++; do {...} while (--cnt);"
   in the three last ones (yes, these function iterate cnt+1 times). This
   makes them functionally equivalent to the asm versions (madness ensues for
   cnt < 0) and allows the compiler to remove one 'test' instruction at the
   end of each loop.
 - in the translucence function, replace addition by ORing

Observations (system: Core2 Duo Linux x86_64):
 With a 1680x1050 window fully covered by the respective type of wall (simple,
 masked, trans. masked), fps increases by 3-4 from the baseline of approx. 60.

git-svn-id: https://svn.eduke32.com/eduke32@2405 1a8010ca-5511-0410-912e-c29ae57300e0
2012-03-04 20:12:30 +00:00
helixhorned
5119b135d1 More utils tweaks.
- remove the objects too on 'clean'
- fix warning with 'transpal' on x64
  (generates translucency and shade tables)

git-svn-id: https://svn.eduke32.com/eduke32@2404 1a8010ca-5511-0410-912e-c29ae57300e0
2012-03-04 20:12:15 +00:00
helixhorned
147a41d296 Makefile tweaks for the utilities.
- print compilation status for building the final executable
- add 'cleanutils' target in build/Makefile
- don't link against pthread, seems unnecessary
- don't build nedmalloc.o when not requested in Makefile.common

git-svn-id: https://svn.eduke32.com/eduke32@2403 1a8010ca-5511-0410-912e-c29ae57300e0
2012-03-04 20:11:49 +00:00
hendricks266
0d4e066e12 Under Mac OS X, override libsupc++ with libstdc++.
git-svn-id: https://svn.eduke32.com/eduke32@2400 1a8010ca-5511-0410-912e-c29ae57300e0
2012-03-04 09:32:33 +00:00
hendricks266
56c002d3a1 Add APPLE_FRAMEWORKS Makefile variable which can be passed to the make invocation.
ex: make APPLE_FRAMEWORKS=~/Library/Frameworks

git-svn-id: https://svn.eduke32.com/eduke32@2398 1a8010ca-5511-0410-912e-c29ae57300e0
2012-03-04 09:31:37 +00:00
hendricks266
27b279a1ce JFDuke3D port: OS X Startup Window, copied almost verbatim
It needs to have the sound quality box removed and the Game directory box added, possibly among other things.

git-svn-id: https://svn.eduke32.com/eduke32@2396 1a8010ca-5511-0410-912e-c29ae57300e0
2012-03-04 09:30:27 +00:00
helixhorned
ef02682c94 Define strtoll to _strtoi64 on MSVC.
Usage of a search machine by Hendricks.

git-svn-id: https://svn.eduke32.com/eduke32@2394 1a8010ca-5511-0410-912e-c29ae57300e0
2012-03-01 23:36:11 +00:00
helixhorned
fc9609928f Make 'dommxoverlay' and 'beforedrawrooms' static in engine.c.
git-svn-id: https://svn.eduke32.com/eduke32@2391 1a8010ca-5511-0410-912e-c29ae57300e0
2012-02-27 19:40:28 +00:00
helixhorned
95324450fa Significantly speed up non-power-of-two floor sprite texture mapping functions.
(Classic renderer). We don't need 64-bit integers; also use the nice
asm version of divscale32() if possible.

git-svn-id: https://svn.eduke32.com/eduke32@2390 1a8010ca-5511-0410-912e-c29ae57300e0
2012-02-27 19:40:01 +00:00
helixhorned
e18063beb8 Fix sprites with picnums >= MAXSPRITES not drawing in classic.
This was discovered because viewscreens (TILE_VIEWSCR) ceased being drawn
with the MAXTILES increase (reported by Hank, who also did the bisect).

git-svn-id: https://svn.eduke32.com/eduke32@2376 1a8010ca-5511-0410-912e-c29ae57300e0
2012-02-21 18:24:36 +00:00
helixhorned
8b7a4dab9b Define Batoi/Batol to strtol(...) in compat.h and use these when necessary.
That is, everyplace a user input is to be converted.  The only remaining
instance of atoi() is now atoi(s_buildDate).

git-svn-id: https://svn.eduke32.com/eduke32@2374 1a8010ca-5511-0410-912e-c29ae57300e0
2012-02-20 21:17:39 +00:00
helixhorned
80bd1bb4e4 engine: make neartag accept a sprite-blacklist function and use it in sector.c.
Internally, the last argument to neartag is now a pointer to a function
  int32_t (*blacklist_sprite_func)(int32_t i),
which is supposed to return 1 if sprite[i] should NOT be considered for hitting.

This is now used in the hard-coded neartag() calls in sector.c, but not in any
way in CON (there's neither a C blacklist function provided, nor is there a
possibility to define one in CON).  There, all sprites with picnums >=1 and <=10
(i.e. the effectors) will be blacklisted.  This remedies problems where such
sprites would get in the way of switches.

Note that a whitelist approach (only consider a predefined set, namely those
picnums which will be checked afterwards) has back-compatibility implications
since people may have used e.g. lotagged window sprites to cover a switch.

Also, the >=1 to <=10 range is [sic] (the static, not dynamic values are used),
since anyone redefining effector picnums is clearly out of their mind.

git-svn-id: https://svn.eduke32.com/eduke32@2373 1a8010ca-5511-0410-912e-c29ae57300e0
2012-02-20 19:54:24 +00:00
helixhorned
1ec1e3e45c Make neartag() return void instead of always 0.
git-svn-id: https://svn.eduke32.com/eduke32@2372 1a8010ca-5511-0410-912e-c29ae57300e0
2012-02-20 19:53:42 +00:00
helixhorned
1ebdcf6443 polymost.c: More informative failure message for gloadtile_cached().
git-svn-id: https://svn.eduke32.com/eduke32@2371 1a8010ca-5511-0410-912e-c29ae57300e0
2012-02-20 19:53:23 +00:00
helixhorned
24c4364e3d cache1d.c: more meaning-preserving transformations, patch up one oob access.
lzwcompress can access one byte after lzwrawbuf[LZWSIZE] when provided with
an uncompleng of LZWSIZE, so we increase that array's size by one.

git-svn-id: https://svn.eduke32.com/eduke32@2369 1a8010ca-5511-0410-912e-c29ae57300e0
2012-02-20 19:52:53 +00:00
helixhorned
3dfb04d343 cache1d.c: formatting and trivial changes.
Remove dfread and kdfwrite, only leave a recipe how to get their
source from the respective used functions.

git-svn-id: https://svn.eduke32.com/eduke32@2368 1a8010ca-5511-0410-912e-c29ae57300e0
2012-02-20 19:52:38 +00:00
helixhorned
e45e969d89 cache1d.c: rename three variables, put commented out code at the end.
git-svn-id: https://svn.eduke32.com/eduke32@2367 1a8010ca-5511-0410-912e-c29ae57300e0
2012-02-20 19:52:22 +00:00
helixhorned
c88854b770 cache1d.c: allocate internal LZW buffers statically instead of with allocache.
git-svn-id: https://svn.eduke32.com/eduke32@2366 1a8010ca-5511-0410-912e-c29ae57300e0
2012-02-20 19:52:04 +00:00
helixhorned
2d6f24a3f2 Fix a potential free() of stack memory in screenshot code. Ouch!
git-svn-id: https://svn.eduke32.com/eduke32@2363 1a8010ca-5511-0410-912e-c29ae57300e0
2012-02-18 22:15:19 +00:00
helixhorned
165d291a48 Comment out unused dfread and kdfwrite functions in cache1d.c.
git-svn-id: https://svn.eduke32.com/eduke32@2362 1a8010ca-5511-0410-912e-c29ae57300e0
2012-02-18 22:15:04 +00:00
helixhorned
103a6e76f9 constify various cache1d and pragmas functions, some copybuf* -> memcpy/move.
The following functions have const qualifiers attached for the 'destination'
arguments: kdfwrite, dfwrite in cache1d.c and copybuf{byte,reverse,} in the
pragmas source or headers.  A couple uses of the latter ones were replaced
with calls to standard library functions.

git-svn-id: https://svn.eduke32.com/eduke32@2361 1a8010ca-5511-0410-912e-c29ae57300e0
2012-02-18 22:14:45 +00:00
helixhorned
b51a3d91a3 cache1d.c: debugging feature routing all allocache requests to malloc.
This is useful to debug out-of-bound violations for memory allocated
with that function.

git-svn-id: https://svn.eduke32.com/eduke32@2360 1a8010ca-5511-0410-912e-c29ae57300e0
2012-02-18 17:57:07 +00:00
helixhorned
60020d2dd4 In the user map selector, sort file names case-insensitively on Unix'y systems.
This makes more sense because the game selector draws the names with uppercase
letters and the hotkeys to jump to a map starting with a particualar letter
aren't case sensitive, either.  Mapster32's selector will still display maps
starting with upper case first.

git-svn-id: https://svn.eduke32.com/eduke32@2356 1a8010ca-5511-0410-912e-c29ae57300e0
2012-02-18 17:56:13 +00:00
helixhorned
b4f63547c4 Fix non-asm build, I forgot a line with the preceding change.
git-svn-id: https://svn.eduke32.com/eduke32@2355 1a8010ca-5511-0410-912e-c29ae57300e0
2012-02-18 17:55:59 +00:00
helixhorned
c965d9d70a engine.c: more formatting, removing of textually duplicate code.
git-svn-id: https://svn.eduke32.com/eduke32@2354 1a8010ca-5511-0410-912e-c29ae57300e0
2012-02-18 17:55:43 +00:00
helixhorned
72cc7cebec engine.c: formatting changes
The bulk are whitespace changes; the only exception is a
"if (expr) { stmt; }" --> "if (expr) stmt;"

git-svn-id: https://svn.eduke32.com/eduke32@2353 1a8010ca-5511-0410-912e-c29ae57300e0
2012-02-18 17:55:27 +00:00
helixhorned
0ef1721955 Mapster32: Fix extended ceiling/floor picnums taking on picnum 0 in Polymer.
The reason was that drawmasks(), which was where the resetting of the fake
RoR textures happened under Polymer, can be called from polymer_displayrooms()
when mirrors are present. I was assuming that drawmasks() was only ever called
after the 'main' drawrooms and that hence the sequence of fake RoR tile tweaking
was set, reset, set, reset, ... which it was not.
Now, do the resetting explicitly after every drawmasks() in the editor.

git-svn-id: https://svn.eduke32.com/eduke32@2350 1a8010ca-5511-0410-912e-c29ae57300e0
2012-02-16 19:25:42 +00:00
helixhorned
30e16fe7bb When loading a map in-game, clear TROR wall members corresponding to up/down links.
I find this cleaner for two reasons.  First, lotags won't get in the way of
neartag(), so that doors and switches near constrained TROR walls can be
pushed.  Second, this removes the information leak so that CON coders aren't
tempted to read that values directly before a proper API for that comes along.
When writing out a map in-game (e.g. with dndebug), restore the respective
members so that it can be loaded in the editor again.

git-svn-id: https://svn.eduke32.com/eduke32@2349 1a8010ca-5511-0410-912e-c29ae57300e0
2012-02-16 19:25:18 +00:00
helixhorned
0538c70242 engine.c: Rewrite tslopevlin (translucent slope vline texmapping) for clarity.
git-svn-id: https://svn.eduke32.com/eduke32@2348 1a8010ca-5511-0410-912e-c29ae57300e0
2012-02-16 19:24:59 +00:00
helixhorned
c900e4ef87 Fix player being not blocked by sprites lying on an extended floor.
getzrange() returns the floor rather than the sprite if their heights are
equal.  Now, make an exception for extended floors (analogously, ceilings).

git-svn-id: https://svn.eduke32.com/eduke32@2347 1a8010ca-5511-0410-912e-c29ae57300e0
2012-02-16 19:24:44 +00:00
helixhorned
967a3ec697 engine.c: replace 0xXXXXXXXX literals with INT32_MIN/MAX; whitespace changes.
git-svn-id: https://svn.eduke32.com/eduke32@2343 1a8010ca-5511-0410-912e-c29ae57300e0
2012-02-14 23:13:53 +00:00
helixhorned
53d9264f92 Fix a couple of out-of-bounds accesses when roaming around with noclip.
- guard cansee() against negative sectnums (return 0 immediately), since
  it's often called with the player sectnum as one argument
- in resetpspritevars(), don't inset APLAYER sprite if sectnum < 0, which
  can happen if a map is started in void space accidentally (e.g. from
  the editor)
- two checks before accessing sector[] with a player sectnum

git-svn-id: https://svn.eduke32.com/eduke32@2342 1a8010ca-5511-0410-912e-c29ae57300e0
2012-02-14 23:13:38 +00:00
helixhorned
5f506ec0f6 Fix sprite rendering glitches with r_usenewaspect=1 in 8-bit mode.
git-svn-id: https://svn.eduke32.com/eduke32@2341 1a8010ca-5511-0410-912e-c29ae57300e0
2012-02-14 23:13:16 +00:00
helixhorned
1e2125ce29 Make 5th mouse button functional in Windows.
git-svn-id: https://svn.eduke32.com/eduke32@2340 1a8010ca-5511-0410-912e-c29ae57300e0
2012-02-13 21:38:16 +00:00
helixhorned
747cb925db Remix mdsprite.c's updateanimation() to look prettier and clearer.
Specifically,
 - rearrange conditionals
 - factor out constant expressions
 - add a couple of debugging printfs for extraordinary events (oob frames)
 - add VERIFY comments for implicit assertions I'd like to verify sometime

Also, one calloc -> malloc.

git-svn-id: https://svn.eduke32.com/eduke32@2338 1a8010ca-5511-0410-912e-c29ae57300e0
2012-02-13 21:37:46 +00:00
helixhorned
0843ef2e93 Fix uninitialized mem access in dorotatesprite with thin tiles (e.g. 3085).
git-svn-id: https://svn.eduke32.com/eduke32@2335 1a8010ca-5511-0410-912e-c29ae57300e0
2012-02-12 13:46:57 +00:00