Commit graph

664 commits

Author SHA1 Message Date
helixhorned
98ac0c2edc When searching a nextwall for a white wall after dragging a point,
exclude grayed out walls.

git-svn-id: https://svn.eduke32.com/eduke32@2039 1a8010ca-5511-0410-912e-c29ae57300e0
2011-09-22 16:52:32 +00:00
helixhorned
1203b4b213 Fix
http://forums.duke4.net/topic/1348-mapster32-problems-and-bugs/page__st__480
(I think, didn't test it)

git-svn-id: https://svn.eduke32.com/eduke32@2035 1a8010ca-5511-0410-912e-c29ae57300e0
2011-09-20 19:12:42 +00:00
plagman
03429e8f2e Polymer: sanitize backface culling
Keep track of which side is getting culled, swap around mirrors, swap
around model drawing.

git-svn-id: https://svn.eduke32.com/eduke32@2032 1a8010ca-5511-0410-912e-c29ae57300e0
2011-09-18 07:18:50 +00:00
helixhorned
6f4fedb7fe fix picking
git-svn-id: https://svn.eduke32.com/eduke32@2031 1a8010ca-5511-0410-912e-c29ae57300e0
2011-09-17 15:26:52 +00:00
helixhorned
b486f3aa0d More natural mouse picking in software mode, closer to "what's under the cursor
is picked" but still not perfect. In particular, sometimes a wrong wall is
selected, and sprites don't get picked through portals. As a rule of thumb,
don't be too far away from the objects you're modifying in 3D mode.

git-svn-id: https://svn.eduke32.com/eduke32@2030 1a8010ca-5511-0410-912e-c29ae57300e0
2011-09-17 14:26:02 +00:00
helixhorned
19ebd8feb3 In the textured 2D mode of Mapster32, only texture non-grayed out sectors.
git-svn-id: https://svn.eduke32.com/eduke32@2029 1a8010ca-5511-0410-912e-c29ae57300e0
2011-09-17 14:25:42 +00:00
helixhorned
9b1d384723 Three-way clipping in Mapster32 (still toggled with 'N): on and off as
before, and additionally a mode that doesn't clip against masked walls
and sprites.

git-svn-id: https://svn.eduke32.com/eduke32@2028 1a8010ca-5511-0410-912e-c29ae57300e0
2011-09-16 19:17:48 +00:00
helixhorned
9b70a2efbf In the editor, when rescaling the texture after dragging a wall-point, also
traverse the TROR neighbors.

git-svn-id: https://svn.eduke32.com/eduke32@2027 1a8010ca-5511-0410-912e-c29ae57300e0
2011-09-15 19:31:44 +00:00
helixhorned
7582b86237 Add high-resolution timers C API for profiling. The functions are called
uint64_t gethiticks() and gethitickspersec().  For SDL 1.2, the timer
has the same resolution as getticks (1000 Hz). For Windows and SDL 1.3,
the resolution of the underlying perf-timers is used.  The only user of
these functions right now is some TROR on-screen debugging code.

Revert an earlier change regarding r_preview_mouseaim.  We can't do the
check because editstatus is set later.

git-svn-id: https://svn.eduke32.com/eduke32@2026 1a8010ca-5511-0410-912e-c29ae57300e0
2011-09-15 17:05:00 +00:00
helixhorned
cc7110c18f - Add new trueror1.map that showcases the functionality and limitations of
the additional rendering pass
- Remove r_preview_mouseaim cvar from the game, since it's only for Mapster
- sdlmusic.c: (Failed) attempt to fix a call of waitpid() with a non-existent
  process ID in the external MIDI playing code. I think there's a race there...

git-svn-id: https://svn.eduke32.com/eduke32@2025 1a8010ca-5511-0410-912e-c29ae57300e0
2011-09-15 17:04:37 +00:00
helixhorned
2415b03c79 Support for drawing 'island sectors' for TROR/classic (and with limited
functionality, Polymost).

The new feature can be enabled/disabled with the 'r_tror_nomaskpass' cvar.

The basic idea is that when drawing lower or upper levels, a first pass
is performed that ignores all red walls for which the TROR nextwall link
'towards' the viewer arrives at a red wall.  Thus, in the worst case, there
can be up to twice as many rendering passes now (when it is discovered that
the no-mask-pass isn't different that what would be drawn with the ordinary
one, the latter is skipped, since we've already drawn all needed geometry).

Hovever, this kind of multi-pass splitting is only suitable for simple scenes,
like the upper subway in the TROR test map.  In particular, multiple islands
shouldn't 'see' each other.

Two issues are worth mentioning: first, care needs to be taken for translucent
ceilings or floors, since drawing them twice isn't the same as drawing them
once. This is done for classic, but not for Polymost.  Second, sprites (which
are always drawn _after_ the geometry for a given pass) are still clipped to
the geometry of the ordinary pass, resulting in their disappearance from
certain angles.
--

Additionaly, a change made it into this commit that fixes redundant collection
of sprites in TROR:classic/Polymost.

git-svn-id: https://svn.eduke32.com/eduke32@2024 1a8010ca-5511-0410-912e-c29ae57300e0
2011-09-15 17:04:14 +00:00
helixhorned
701c69fecc misc. cleanup:
- remove 'imageSize' global which was always yres*bytesperline and only used once
- some clearbuf() -> Bmemset() because I find the latter easier to read
- remove some clearbufs to 0 of some global arrays on init

git-svn-id: https://svn.eduke32.com/eduke32@2023 1a8010ca-5511-0410-912e-c29ae57300e0
2011-09-15 17:03:50 +00:00
helixhorned
9fd471a56a Make uninitialization sequence more consistent across the editor code. It's
always like this now:
  ExtUninit -> (writesetup, misc.)
  uninitengine -> (uninitsystem -> (uninit timers, mouse, ...))
  exit()
Some paths still lead to a plain exit(), like failures in cache1d.c or mdsprite.c

git-svn-id: https://svn.eduke32.com/eduke32@2022 1a8010ca-5511-0410-912e-c29ae57300e0
2011-09-15 17:03:29 +00:00
helixhorned
96283fdf5e Make a couple of variables static in the engine; don't initialize umost/dmost
with other than base levels, since the y*most arrays are copied there later.

git-svn-id: https://svn.eduke32.com/eduke32@2020 1a8010ca-5511-0410-912e-c29ae57300e0
2011-09-15 17:02:52 +00:00
helixhorned
24cbd241d7 - In the editor, make bunch-equal-making [J] stricter, because the way it was
handled could lead to a bunch whose floors and ceilings covered different
  areas. A fix for the reduced functionality arising from this change is
  underway.
- Rewrite a small portion of code using yax_vnextsec() in game.c.

git-svn-id: https://svn.eduke32.com/eduke32@2019 1a8010ca-5511-0410-912e-c29ae57300e0
2011-09-15 17:02:35 +00:00
helixhorned
7f1133a493 Engine: add funtion 'yax_vnextsec(wall, cf)' to C API. It's often useful when
dealing with sectors on the two sides of a bunch.  Make yax_globallev and
yax_globalbunch variables non-static.
Rewrite a TROR-related bit in the engine code using the new function.

git-svn-id: https://svn.eduke32.com/eduke32@2018 1a8010ca-5511-0410-912e-c29ae57300e0
2011-09-15 17:02:12 +00:00
helixhorned
3b634f28ae fix a couple of editor issues:
- one reported by Micky:
http://forums.duke4.net/topic/3911-true-room-over-room/page__view__findpost__p__106610
- malloc(0) call when saving a map with no sprites
- update 'asksave' after Alt-S and corrupt-check on starting a new map

git-svn-id: https://svn.eduke32.com/eduke32@2017 1a8010ca-5511-0410-912e-c29ae57300e0
2011-09-12 15:03:51 +00:00
helixhorned
e166895c90 engine: In setbrightness() and qsetmodeany(), call setpalette() only if the
palette changed from the last one (either globally or within the last call of
one of the function). This fixes the ugly OSD flickering in 8-bit mode when
a screen tint effect is in action (such as when being hurt or snotted on).

git-svn-id: https://svn.eduke32.com/eduke32@2015 1a8010ca-5511-0410-912e-c29ae57300e0
2011-09-10 15:45:11 +00:00
helixhorned
01676d7431 A couple of trivial/cleanup changes. setvgapalette() is removed from the
engine, since it had no users.

git-svn-id: https://svn.eduke32.com/eduke32@2014 1a8010ca-5511-0410-912e-c29ae57300e0
2011-09-10 15:44:53 +00:00
helixhorned
9c16dc7873 sdlayer.c: also SDL_WarpMouse() in debugging builds. This has at least three
effects:
1) Mouse turning works with SDL 1.3
2) The mouse pointer can't leave the window area with the console up, so that
   focus always stays with the application
3) Menu selection using the mouse doesn't work. Not dramatic IMO.

git-svn-id: https://svn.eduke32.com/eduke32@2011 1a8010ca-5511-0410-912e-c29ae57300e0
2011-09-06 17:46:50 +00:00
helixhorned
843689f8a0 polymer.c: Fix a potential zero-size calloc call when a two-walled sector
is present (like in E4L1).  Also sneak in a trivial change in cache1d.c

git-svn-id: https://svn.eduke32.com/eduke32@2010 1a8010ca-5511-0410-912e-c29ae57300e0
2011-09-06 17:46:34 +00:00
helixhorned
dc02ff5654 Using this dynamic checking tool: http://embed.cs.utah.edu/ubc/,
fix two issues with signed integer overflow. One is related to clipping
and the other to Polymost mouse-picking for overlong walls. Many more
remain especially in the 8-bit rendering code, but I expect many of
them to be intended.

git-svn-id: https://svn.eduke32.com/eduke32@2009 1a8010ca-5511-0410-912e-c29ae57300e0
2011-09-06 17:46:17 +00:00
helixhorned
727be94eb5 Tweak the source so that it can be built by clang. The only necessary change
is to remove a couple of 'inline's for functions with external linkage, which
seems to be a GCC convenience.

git-svn-id: https://svn.eduke32.com/eduke32@2008 1a8010ca-5511-0410-912e-c29ae57300e0
2011-09-06 17:46:00 +00:00
helixhorned
08f5290f4f mdsprite.c: prevent a couple of float divides by zero and save model file
name into m->head.nam after loading (but before preprocessing for Polymer)

git-svn-id: https://svn.eduke32.com/eduke32@2007 1a8010ca-5511-0410-912e-c29ae57300e0
2011-09-06 17:45:39 +00:00
helixhorned
a145cc93bc Make Polymer declare a callback function G_Polymer_UnInit() that is called
whenever we change to another renderer etc. and define it for the game and
editor.  The purpose of the function is to clean up references to Polymer
resources like lights.
This fixes 1) all lights becoming spot lights in the game and 2)
an issue with maphack lights in the editor (can't recall which exactly).

git-svn-id: https://svn.eduke32.com/eduke32@2006 1a8010ca-5511-0410-912e-c29ae57300e0
2011-09-06 17:45:21 +00:00
helixhorned
b3d3fd9a39 Better handling of tsprites that are duplicated through TROR portals.
Specifically, now also consider the sprite tile's yoffset, and fix an
issue when a tsprite got duplicated 'toward' the viewer. Also add a
couple of tests in trueror1.map.

git-svn-id: https://svn.eduke32.com/eduke32@2004 1a8010ca-5511-0410-912e-c29ae57300e0
2011-09-04 19:44:51 +00:00
helixhorned
a3e83fbe0c Unbreak zip support as another means to group files. Using 16-bit integers to
hold file lengths is certainly very frownworthy.

git-svn-id: https://svn.eduke32.com/eduke32@2003 1a8010ca-5511-0410-912e-c29ae57300e0
2011-09-04 19:44:24 +00:00
helixhorned
a23504822d Prepare polymost.c for proper umost/dmost clipping of TROR passes. No real functional changes.
git-svn-id: https://svn.eduke32.com/eduke32@2002 1a8010ca-5511-0410-912e-c29ae57300e0
2011-09-04 19:44:07 +00:00
helixhorned
962910ce32 Move the fixspritesectors call and the start sector updating into ExtPreSaveMap().
This makes the latter also correct when testing a map from the editor.

git-svn-id: https://svn.eduke32.com/eduke32@2001 1a8010ca-5511-0410-912e-c29ae57300e0
2011-09-04 19:43:48 +00:00
helixhorned
decb2a0db1 use updatesectorz instead of updatesector for the startsectnum updating when saving a map.
git-svn-id: https://svn.eduke32.com/eduke32@2000 1a8010ca-5511-0410-912e-c29ae57300e0
2011-09-02 22:15:43 +00:00
helixhorned
99ce725b60 Much more elegant solution to updating the player's sectnum when passing through
TROR portals that works with a little help from updatesectorz() (change not visible
from CON code). Relies only on the presence of an extension whose portal isn't
blocked and also plays nicely with corner cases like being shrunk and enabling
the jetpack. This should fix the upward moving platforms in WGR2.

git-svn-id: https://svn.eduke32.com/eduke32@1996 1a8010ca-5511-0410-912e-c29ae57300e0
2011-09-01 18:38:13 +00:00
helixhorned
b72d351f20 * game and editor: emit a warning when a search-path directory specified
on the command-line isn't found (instead of saying nothing)
* editor: Move inconsistent (stat&2)/heinum detection into the corruption
  checker. This makes a lot of original maps spew countless 'errors', but
  it's preferable for new maps since such floors and ceilings could behave
  strangely with TROR.

git-svn-id: https://svn.eduke32.com/eduke32@1995 1a8010ca-5511-0410-912e-c29ae57300e0
2011-09-01 18:37:53 +00:00
helixhorned
317aca0093 polymost.c: remove the rest of the rendmode 1 and 2 code from the build
git-svn-id: https://svn.eduke32.com/eduke32@1994 1a8010ca-5511-0410-912e-c29ae57300e0
2011-08-28 17:31:08 +00:00
plagman
c17818aa6e Polymer: fix leak of GL query objects
In cases where performing occlusion queries for multiple red walls
leading to the same sector, we would sometimes leak a number of
query objects. This was apparently harmless on NVIDIA drivers, but
would leak tons of memory on ATI.

git-svn-id: https://svn.eduke32.com/eduke32@1993 1a8010ca-5511-0410-912e-c29ae57300e0
2011-08-28 04:42:27 +00:00
plagman
95d6c6f281 Polymer: fix sector masks translucency.
The code was using the Polymer-cached version of the sector cstat to
determine the translucency of its diffuse material, meaning it would
never get it right on the first try; that's what you get for having
completely different variables named 's' and 'sec'.

git-svn-id: https://svn.eduke32.com/eduke32@1991 1a8010ca-5511-0410-912e-c29ae57300e0
2011-08-21 19:41:34 +00:00
plagman
458ad8fa04 Polymer: Don't draw back faces of sector masks.
We normally enable backface culling always, but turn it off for
two-sided sprites; we need to make sure it's re-enabled after that
as sector masks are drawn after.

git-svn-id: https://svn.eduke32.com/eduke32@1990 1a8010ca-5511-0410-912e-c29ae57300e0
2011-08-21 19:41:22 +00:00
hendricks266
6cbc6a1a0c add support for the include command to names.h loaded by Mapster32, and names.h no longer requires # in front of commands for CON compatibility
git-svn-id: https://svn.eduke32.com/eduke32@1987 1a8010ca-5511-0410-912e-c29ae57300e0
2011-08-20 23:28:14 +00:00
plagman
8e5bf7a89c Polymer: fix external view.
Some of the ROR code was operating under the assumption that drawasks
always correspond to one call of polymer_displarooms(), but that's not
necessarily the case; external view draws all sectors from the top
polymer_drawrooms(), which was causing crashes. Just ignore the sector
mask queues in external view mode, we already don't draw masked walls.

git-svn-id: https://svn.eduke32.com/eduke32@1982 1a8010ca-5511-0410-912e-c29ae57300e0
2011-08-20 21:06:00 +00:00
plagman
0423ff8184 Polymer: propagate lights across vertical boundaries.
Check all the bunch siblings if we get a floor/ceiling hit and walk
them if their own planes hit.

git-svn-id: https://svn.eduke32.com/eduke32@1981 1a8010ca-5511-0410-912e-c29ae57300e0
2011-08-20 21:05:49 +00:00
plagman
8250e5f3e8 Polymer: add preliminary support for sector masks.
When walking the sectors in displayrooms, detect floor/sector masks to
place them in a mask queue. The queues are allocated on the heap, but
a stack pointer is maintained by the displayrooms to allow it to play
nice with mirror recursion.

Right now the masks are drawn after all of drawmasks is finished; that
means you can see sprites and wall masks through sector masks, but not
the opposite. There is a slight attempt at blending far to near, but
nothing too conclusive yet; that means that in some cases some sector
masks won't be visible through other sector masks, but it should work
for trivial cases.

The next step would be to copy all the drawmasks logic into Polymer
and have it (attempt to) properly interleave sector masks where they
belong in the blending order.

git-svn-id: https://svn.eduke32.com/eduke32@1980 1a8010ca-5511-0410-912e-c29ae57300e0
2011-08-20 21:05:38 +00:00
plagman
e77548d42a Polymer: Don't draw 1-way walls twice.
Previously they would get counted both as 1-way walls for immediate
drawing and as mask walls for delayed drawing.

git-svn-id: https://svn.eduke32.com/eduke32@1979 1a8010ca-5511-0410-912e-c29ae57300e0
2011-08-20 21:05:24 +00:00
plagman
98061f3a38 Polymer: Don't bother fogcalc()ing invisible planes.
Doesn't actually matter that much.

git-svn-id: https://svn.eduke32.com/eduke32@1978 1a8010ca-5511-0410-912e-c29ae57300e0
2011-08-20 21:05:14 +00:00
plagman
5b379decc6 Polymer: handle floor/ceiling translucency.
Assigns the right alpha value to floor/ceiling planes if their
translucency bits are set and make sure that changing the cstat now
triggers an update of the material for editing purposes.

This doesn't do anything by itself, but will be needed to correctly
draw floor/ceiling masks.

git-svn-id: https://svn.eduke32.com/eduke32@1977 1a8010ca-5511-0410-912e-c29ae57300e0
2011-08-20 21:05:04 +00:00
plagman
e7fc03ed33 Polymer: Reorganize main displayrooms loop a bit.
When walking the sectors, put more drawing work between queuing and
reaping the occlusion queries to potentially make them more efficient.

git-svn-id: https://svn.eduke32.com/eduke32@1976 1a8010ca-5511-0410-912e-c29ae57300e0
2011-08-20 21:04:53 +00:00
plagman
936147e33b Polymer: Correct(er) TROR walking.
Enumerate the vertical siblings of each walked sector and check them
against the current frustum. No occlusion queries yet, but that should
correct any missing sectors until a flaw in that logic is discovered.

git-svn-id: https://svn.eduke32.com/eduke32@1975 1a8010ca-5511-0410-912e-c29ae57300e0
2011-08-20 21:04:42 +00:00
plagman
6de59ef085 Polymer skeleton cleanup.
Reorganize polymer.c a bit to match the order of prototypes from the
header, move macros from the middle into the header.

git-svn-id: https://svn.eduke32.com/eduke32@1974 1a8010ca-5511-0410-912e-c29ae57300e0
2011-08-20 21:04:28 +00:00
helixhorned
c8bf3682e0 disable undo/redo editor feature until I can debug the disappearing sprites
git-svn-id: https://svn.eduke32.com/eduke32@1973 1a8010ca-5511-0410-912e-c29ae57300e0
2011-08-20 11:54:16 +00:00
helixhorned
4d8d392bbf slight tweak for software renderer sprite picking: don't pick them if they're behind a TROR portal from the current position.
git-svn-id: https://svn.eduke32.com/eduke32@1971 1a8010ca-5511-0410-912e-c29ae57300e0
2011-08-18 22:01:18 +00:00
helixhorned
5c2be94bff Make Ctrl-Alt-A also remove gray walls in the side-view mode. This makes TROR-heavy maps look much less cramped when used in conjunction with Ctrl-A.
git-svn-id: https://svn.eduke32.com/eduke32@1970 1a8010ca-5511-0410-912e-c29ae57300e0
2011-08-18 22:01:01 +00:00
helixhorned
5262a0f24c Various cleanup work:
- fix an earlier 'oops': make highpals load correctly again
 - maphack lights shouldn't be double-loaded now
 - slight tweak to the loading screen fadein/out timing
 - two bound checks
 - make some variables static in engine.c

git-svn-id: https://svn.eduke32.com/eduke32@1969 1a8010ca-5511-0410-912e-c29ae57300e0
2011-08-17 18:52:54 +00:00