Commit Graph

994 Commits

Author SHA1 Message Date
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