Commit Graph

822 Commits

Author SHA1 Message Date
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
helixhorned f5ed4014df Fix zero-size calloc when enumerating a joystick with no hats in SDL.
git-svn-id: https://svn.eduke32.com/eduke32@2331 1a8010ca-5511-0410-912e-c29ae57300e0
2012-02-11 11:51:34 +00:00
helixhorned 15532fa96a Remove a couple of redundant declarations.
git-svn-id: https://svn.eduke32.com/eduke32@2330 1a8010ca-5511-0410-912e-c29ae57300e0
2012-02-09 22:45:38 +00:00
helixhorned dbada3c947 Fix zero-size calloc when enumerating a joystick with no hats in Windows.
git-svn-id: https://svn.eduke32.com/eduke32@2323 1a8010ca-5511-0410-912e-c29ae57300e0
2012-02-09 22:43:21 +00:00
helixhorned 103ee7a40b rotatesprite(..., windowx1,windowy1,windowx2,windowy2) --> rotatesprite_win
git-svn-id: https://svn.eduke32.com/eduke32@2318 1a8010ca-5511-0410-912e-c29ae57300e0
2012-02-04 21:35:00 +00:00
helixhorned b8c2d13f23 Mapster32: fix crash with 'vidmode <bpp>' introduced in r2311.
git-svn-id: https://svn.eduke32.com/eduke32@2315 1a8010ca-5511-0410-912e-c29ae57300e0
2012-02-04 21:34:08 +00:00
helixhorned 1d0cb07167 Factor out four instances of identical code into M32_DrawRoomsAndMasks().
git-svn-id: https://svn.eduke32.com/eduke32@2314 1a8010ca-5511-0410-912e-c29ae57300e0
2012-02-04 21:33:52 +00:00
helixhorned 00b852fe37 EDuke32: When in menus, always draw a black (33%) translucent background.
Internally, there's a new function fade_screen_black() that implements the
fading more efficiently than calling rotatesprite for classic, and uses
tile 0 (assumed to have at least 64x32 size) in the GL modes.

The black background of the user map selector is still done with rotatesprite
and tile BLANK in every renderer.

git-svn-id: https://svn.eduke32.com/eduke32@2312 1a8010ca-5511-0410-912e-c29ae57300e0
2012-02-04 14:30:39 +00:00
helixhorned 7b09accdce Check 'bpp' parameter to vidmode OSD command in EDuke32.
So that the game won't exit if you write 'vidmode 4' when intending
'setrendermode 4'.

git-svn-id: https://svn.eduke32.com/eduke32@2311 1a8010ca-5511-0410-912e-c29ae57300e0
2012-02-04 14:30:17 +00:00
helixhorned 99e08bf441 legibility improvements: rotatesprite(..., 0,0,xdim-1,ydim-1) -> rotatesprite_fs
git-svn-id: https://svn.eduke32.com/eduke32@2308 1a8010ca-5511-0410-912e-c29ae57300e0
2012-02-02 17:35:05 +00:00
helixhorned 20741efd3b Fix a sector[-1] access when starting to draw a wall in an empty map.
git-svn-id: https://svn.eduke32.com/eduke32@2305 1a8010ca-5511-0410-912e-c29ae57300e0
2012-02-01 21:51:26 +00:00
helixhorned 021126045f Mapster32: tweak dragging a single sprite so that they can be dragged 'uphill'.
The implementation uses the recently introduced updatesector_onlynextwall when
setspritez fails.

git-svn-id: https://svn.eduke32.com/eduke32@2302 1a8010ca-5511-0410-912e-c29ae57300e0
2012-01-30 18:25:13 +00:00
helixhorned a32872276d kplib.c without asm: I see an uninitialized access here, valgrind does not?
git-svn-id: https://svn.eduke32.com/eduke32@2293 1a8010ca-5511-0410-912e-c29ae57300e0
2012-01-28 14:37:08 +00:00
helixhorned 0f36ef92ee A couple of Makefile tweaks for clang 3.1 from SVN, and a workaround
for an assertion failure with clang. Really ought to file a bug report instead.

git-svn-id: https://svn.eduke32.com/eduke32@2292 1a8010ca-5511-0410-912e-c29ae57300e0
2012-01-28 14:36:52 +00:00
helixhorned 3a0734a7b0 Lunatic: fix for running with static main engine arrays.
git-svn-id: https://svn.eduke32.com/eduke32@2291 1a8010ca-5511-0410-912e-c29ae57300e0
2012-01-28 14:36:34 +00:00
helixhorned 95e5d1e29d In Mapster32, register the 'vidmode' OSD command in non-GL builds.
git-svn-id: https://svn.eduke32.com/eduke32@2289 1a8010ca-5511-0410-912e-c29ae57300e0
2012-01-27 15:03:34 +00:00
helixhorned 2c2adee5e9 Two tweaks for USE_OPENGL=0 builds.
- Always parse 'animsounds' defs
- don't print "ignored frame/animation definition" warnings

git-svn-id: https://svn.eduke32.com/eduke32@2288 1a8010ca-5511-0410-912e-c29ae57300e0
2012-01-27 15:03:18 +00:00
helixhorned de2cbbfb47 Fix USE_OPENGL=0 build; squelch one warning.
git-svn-id: https://svn.eduke32.com/eduke32@2287 1a8010ca-5511-0410-912e-c29ae57300e0
2012-01-27 15:03:02 +00:00
helixhorned a6158ac3f6 Fix building with GCC 4.6 link-time optimization.
It looks like GCC doesn't honor the 'used' attribute with LTO. This is
"fixed" by declaring the variables in question with external linkage
(i.e. removing the 'static').  I consider such behavior a GCC bug, though.

git-svn-id: https://svn.eduke32.com/eduke32@2286 1a8010ca-5511-0410-912e-c29ae57300e0
2012-01-27 15:02:45 +00:00
helixhorned 6c405100ac Make sdlayer.c's timerticspersec an 'int32_t' to match the declaration.
git-svn-id: https://svn.eduke32.com/eduke32@2285 1a8010ca-5511-0410-912e-c29ae57300e0
2012-01-27 15:02:25 +00:00
helixhorned 98ffd6f00c Rearrange 'struct hicreplc_t' members so that no padding is inserted on x64.
git-svn-id: https://svn.eduke32.com/eduke32@2282 1a8010ca-5511-0410-912e-c29ae57300e0
2012-01-26 21:58:25 +00:00
helixhorned 143ec24cb4 engine.c cleanup, making some variables static mostly
git-svn-id: https://svn.eduke32.com/eduke32@2281 1a8010ca-5511-0410-912e-c29ae57300e0
2012-01-26 21:58:08 +00:00
helixhorned c657588658 Fix a potential sector[-1] access when drawing a masked wall in Polymost.
git-svn-id: https://svn.eduke32.com/eduke32@2280 1a8010ca-5511-0410-912e-c29ae57300e0
2012-01-26 21:57:51 +00:00
helixhorned f96cc343a2 Fix the insert cicle wall-points bug reported by Norvak.
git-svn-id: https://svn.eduke32.com/eduke32@2279 1a8010ca-5511-0410-912e-c29ae57300e0
2012-01-24 18:07:36 +00:00
helixhorned d95511ed1d Fix sprite[] access with indices > MAXSPRITES in Polymer model drawing code.
Internally, updateanimation() now takes a third parameter 'lpal'.

git-svn-id: https://svn.eduke32.com/eduke32@2277 1a8010ca-5511-0410-912e-c29ae57300e0
2012-01-22 17:18:49 +00:00
helixhorned 775eff0344 Mapster32: make sector flipping (X/Y) work properly with TROR.
git-svn-id: https://svn.eduke32.com/eduke32@2276 1a8010ca-5511-0410-912e-c29ae57300e0
2012-01-20 22:12:11 +00:00
helixhorned 661e85155b Mapster32: always show highlighted sprites in 2D mode, even in a gray sector.
git-svn-id: https://svn.eduke32.com/eduke32@2274 1a8010ca-5511-0410-912e-c29ae57300e0
2012-01-20 22:11:40 +00:00
helixhorned bb1070b795 Fix a potential wall[-1] access in Mapster32.
git-svn-id: https://svn.eduke32.com/eduke32@2273 1a8010ca-5511-0410-912e-c29ae57300e0
2012-01-20 15:48:03 +00:00
helixhorned 7a893b8ec4 minor engine cleanup.
- enclose glbuild.h in #idndef ... sentinels
- engine.c: remove unused variable 'pageoffset', make 'lastx' static
- formatting

git-svn-id: https://svn.eduke32.com/eduke32@2272 1a8010ca-5511-0410-912e-c29ae57300e0
2012-01-20 13:24:15 +00:00
helixhorned db94366657 Use ATTRIBUTE((used)) for symbols used only in inline asm.
This may fix compilation for optimized builds with GCC or clang where
the compiler would otherwise decide that those symbols are unused.

git-svn-id: https://svn.eduke32.com/eduke32@2271 1a8010ca-5511-0410-912e-c29ae57300e0
2012-01-20 13:23:53 +00:00
helixhorned d0acd40ff8 Inreased debugging level for catching oob accesses to 'main' arrays.
If enabled, this makes the following arrays be allocated statically:
spriteext, spritesmooth, sector, wall, sprite, tsprite, while
necessarily disabling the clipshape feature (because it relies on
setting sector/wall to different malloc'd block temporarily).

To compile, pass DEBUGANYWAY=1 in addition to RELEASE=0 to 'make',
and it's really only useful with CC=clang, of course.

git-svn-id: https://svn.eduke32.com/eduke32@2270 1a8010ca-5511-0410-912e-c29ae57300e0
2012-01-19 23:17:34 +00:00
helixhorned a61052f807 Double MAXTILES to 30720, reduce EXTRATILES (models w/ custom pal skin) to 3840
I'm decreasing EXTRATILES because I feel that it's way overcommitted. It's the
max number of model-tiles that have their own skin for a certain palette,
like the slimer egg in the HRP.

git-svn-id: https://svn.eduke32.com/eduke32@2267 1a8010ca-5511-0410-912e-c29ae57300e0
2012-01-19 21:58:06 +00:00
helixhorned cd89fce9aa less trivial stuff
- fix one bound-checking line
- rewrite two lines in astub.c to potentially not overflow an int16
- make tiletovox[] an array of int16's

git-svn-id: https://svn.eduke32.com/eduke32@2266 1a8010ca-5511-0410-912e-c29ae57300e0
2012-01-19 21:57:46 +00:00
helixhorned 2e1e2345af trivial tweaks: make stuff static, remove unused stuff, formatting...
git-svn-id: https://svn.eduke32.com/eduke32@2265 1a8010ca-5511-0410-912e-c29ae57300e0
2012-01-19 21:57:22 +00:00
hendricks266 426ef1494e Add the 'yoffset' token to model definitions to allow models to compensate for ART tiles with large yoffsets, such as #603. Under normal circumstances the existing 'zadd' parameter should be used instead. Special thanks to Supertanker.
git-svn-id: https://svn.eduke32.com/eduke32@2264 1a8010ca-5511-0410-912e-c29ae57300e0
2012-01-17 04:31:59 +00:00
helixhorned 031da6280d Remove the allocache() allocation type for 'intptr_t *lookups'.
Always malloc that buffer.  This allows us to remove suckcache() from
cache1d.c, which I believe to be buggy (see comments in the source).

git-svn-id: https://svn.eduke32.com/eduke32@2261 1a8010ca-5511-0410-912e-c29ae57300e0
2012-01-15 22:39:59 +00:00
helixhorned 260bbc1f92 cleanup:
- 'whitecol' was defined in the engine and in build.c, use only the engine one
 - make cachesize, artsize, artversion static in engine.c
 - undo some formatting havoc presumably done by astyle

git-svn-id: https://svn.eduke32.com/eduke32@2260 1a8010ca-5511-0410-912e-c29ae57300e0
2012-01-15 22:39:38 +00:00
helixhorned 340b2f7647 Increase the number of maximum art files from 64 to 256 and tweak loadpics().
It is likely that this is the value it used to have at some point, because
the MAXTILEFILES macro equals 256 and is as old as the Duke3D source.
loadpics() now refuses to load an ART file with localtilestart or localtileend
out of bounds, or if localtileend<=localtilestart (i.e. no tiles in ART file, or
nonsense). Also, on 'invalid art file version', continue instead of returning.

Note: this does not increase the maximum number of tiles, which is still 15360,
it only gives a bit more freedom to arrange them (well, into more art files).
Also, I don't see what anyone keeps off from packing any number of tiles (from
1 to 15360) into an art file. Old EDITART limits?

git-svn-id: https://svn.eduke32.com/eduke32@2259 1a8010ca-5511-0410-912e-c29ae57300e0
2012-01-15 22:39:10 +00:00
helixhorned 480690aa1d Fix the Polymer hitches first encountered with Parkade.
The cause was a combination of many factors. First, Polymer requires the
start-drawing position to be inside the sector to draw (deviations lead to
incorrect drawing).  This was violated by the game, because it interpolated
the current and next tic position without updating the sectnum, leading to
inconsistencies especially when passing through narrow sectors.  Polymer
worked around it by doing an updatesector() each frame, however this works
poorly for maps with overlapping geometry such as SoS or RoR.

The solution to this is to add a new engine function,
updatesector_onlynextwalls(), which searches the sectors (via nextsector)
in breadth-first fashion instead of from 0 to numsectors-1, like updatesector
does when it fails for the *immediate* nextwall neighbors.

Internally, the breadt-first search helpers are moved into the engine.

git-svn-id: https://svn.eduke32.com/eduke32@2256 1a8010ca-5511-0410-912e-c29ae57300e0
2012-01-14 14:48:30 +00:00
helixhorned 87ac6b8406 winlayer.c: in WM_PALETTECHANGED handling code ("someone stole the palette
so try and steal it back"), prevent calling IDirectDrawSurface_SetPalette()
with NULL arguments, causing a crash.  It's happened for me on Vista, when
initially changing from 8-bit to 32-bit mode.

git-svn-id: https://svn.eduke32.com/eduke32@2255 1a8010ca-5511-0410-912e-c29ae57300e0
2012-01-12 20:49:50 +00:00
helixhorned a57b566c0b Add Makefile option to use the DMALLOC (debug malloc) library.
I didn't have much success in finding bugs using it, but it works
out-of-the-box on my setup, so it may be useful in the future.

git-svn-id: https://svn.eduke32.com/eduke32@2254 1a8010ca-5511-0410-912e-c29ae57300e0
2012-01-12 20:49:34 +00:00
helixhorned 300fee62da sdlayer.c: formatting of preprocessor lines
git-svn-id: https://svn.eduke32.com/eduke32@2253 1a8010ca-5511-0410-912e-c29ae57300e0
2012-01-12 20:49:15 +00:00
helixhorned 9617227a87 Support for the first "thumb" mouse button, called MOUSE4 in the menu.
The second one is passed to the 'mouseb' variable, but the game currently
can't map it since ud.config.MouseFunctions[] would have to be enlarged,
breaking savegame compatibility.
Works both for the Windows and SDL layers. For the latter, instead of using
the SDL_BUTTON_X1/X2 macro constants, I'm using 8 and 9, since that is what
SDL (and incidentally or not, xev) gives me for those buttons.

git-svn-id: https://svn.eduke32.com/eduke32@2252 1a8010ca-5511-0410-912e-c29ae57300e0
2012-01-12 20:48:57 +00:00
helixhorned 80949930bd Temporarily disable the 'model thinning-out' feature intended to save memory.
It turns out that with model interpolation, out-of-bounds frame numbers may
be generated with thinned out models, so disable it until I can sort out
what's wrong with it.
Also, minor code cleanup.

git-svn-id: https://svn.eduke32.com/eduke32@2251 1a8010ca-5511-0410-912e-c29ae57300e0
2012-01-12 20:48:38 +00:00
helixhorned 5f50c30ac2 polymer.c: "Compiling GPU program with bits (octal) %o" for easier reading.
Also, for debugging builds, show this message from verbosity level 1 on.

git-svn-id: https://svn.eduke32.com/eduke32@2250 1a8010ca-5511-0410-912e-c29ae57300e0
2012-01-12 20:48:17 +00:00
helixhorned 7e6f712ad1 more internal cleanup...
the only visible change is that polymost_trytexcache (formerly two
instances of nearly duplicate code) now prints a diagnostic after
a cache miss.  The one that one is most likely to encounter is
"r_downsize doesn't match", meaning that this setting likely differs
between Mapster and the game.

git-svn-id: https://svn.eduke32.com/eduke32@2248 1a8010ca-5511-0410-912e-c29ae57300e0
2012-01-12 20:47:41 +00:00
helixhorned e3150b2801 a couple more trivial tweaks
git-svn-id: https://svn.eduke32.com/eduke32@2247 1a8010ca-5511-0410-912e-c29ae57300e0
2012-01-10 23:45:34 +00:00
helixhorned fa6f2d9ca2 md4.c/h: add consts to appropriate arguments
git-svn-id: https://svn.eduke32.com/eduke32@2246 1a8010ca-5511-0410-912e-c29ae57300e0
2012-01-10 23:45:08 +00:00
helixhorned 3095b09773 trivial formatting / removing of old cruft / adding comments
git-svn-id: https://svn.eduke32.com/eduke32@2244 1a8010ca-5511-0410-912e-c29ae57300e0
2012-01-10 23:44:35 +00:00