Commit Graph

145 Commits

Author SHA1 Message Date
helixhorned ed9fa753f1 Trivial G_Util_PtrToIdx*() tweaks.
git-svn-id: https://svn.eduke32.com/eduke32@3150 1a8010ca-5511-0410-912e-c29ae57300e0
2012-11-11 17:57:01 +00:00
terminx 88c95a18f7 Retire the actorscrptr[], actorLoadEventScrptr[], SpriteFlags[], ActorType[], SpriteCacheList[], ProjectileData[] and DefaultProjectile[] arrays in favor of a tile_t structure exposed as g_tile[]. This consolidates most of the MAXTILES sized arrays on the game side into one place.
git-svn-id: https://svn.eduke32.com/eduke32@3102 1a8010ca-5511-0410-912e-c29ae57300e0
2012-10-30 15:54:35 +00:00
terminx 2fde79b4bc A potential fix for MUSICANDSFX problems after loading a savegame. I was never able to reproduce the issue myself, but something like this seems like a good idea anyway. Thoughts?
git-svn-id: https://svn.eduke32.com/eduke32@3083 1a8010ca-5511-0410-912e-c29ae57300e0
2012-10-14 22:13:49 +00:00
helixhorned f8480d00f9 In savegames, store dummy constant-length block instead of a _prlight array.
sizeof(_prlight) differs across compilers, and besides, Polymer lights were
not loaded anyway (they're restored live in-game later).  The savegame version
was not bumped, but only savegames made with builds where sizeof(_prlight)==261
(like synthesis) will stay compatible!
Report and helpful debugging information by LeoD.

git-svn-id: https://svn.eduke32.com/eduke32@3052 1a8010ca-5511-0410-912e-c29ae57300e0
2012-10-03 15:29:12 +00:00
helixhorned eb4848fe05 Replace most other literal SEs/STs by symbolic enumeration values.
Have fun researching Duke3D's hardcoded weirdness!!!

git-svn-id: https://svn.eduke32.com/eduke32@3008 1a8010ca-5511-0410-912e-c29ae57300e0
2012-09-08 22:18:44 +00:00
helixhorned 1729f8fa38 Factor out some repeated code into G_{Load,Save}PlayerMaybeMulti.
This currently says that MP saving/loading isn't supported, but doesn't
really work correctly.  Also, properly bound-check the immediate argument
to CON's 'save' command and one more ... -> G_HandleAsync().

git-svn-id: https://svn.eduke32.com/eduke32@2999 1a8010ca-5511-0410-912e-c29ae57300e0
2012-09-05 17:25:43 +00:00
helixhorned 0665d961d2 Use Bstrncpyz in 1 place; fix displaying err msg if write-opening savegame fails
git-svn-id: https://svn.eduke32.com/eduke32@2998 1a8010ca-5511-0410-912e-c29ae57300e0
2012-09-05 17:25:40 +00:00
helixhorned bb5d3496ee Factor out snprintf'ing a maybe-modDir'd file name into macro G_ModDirSnprintf().
... and use it in three places. In two of these uses,
1) CON {read,write}arrayfromfile and
2) G_SavePlayer,
display an error message if the file name such generated is too long.

In the CON commands of 1), also error out if the file couldn't be opened.

git-svn-id: https://svn.eduke32.com/eduke32@2997 1a8010ca-5511-0410-912e-c29ae57300e0
2012-09-05 17:25:37 +00:00
helixhorned 2b58c6de4c Replace some literal numbers denoting SEs/STs by symbolic enumeration values.
git-svn-id: https://svn.eduke32.com/eduke32@2970 1a8010ca-5511-0410-912e-c29ae57300e0
2012-08-26 22:16:08 +00:00
terminx 9f40f84cbe This probably fixes the music breakage caused by r2727.
git-svn-id: https://svn.eduke32.com/eduke32@2738 1a8010ca-5511-0410-912e-c29ae57300e0
2012-06-04 22:01:45 +00:00
hendricks266 7f920c5541 Add EVENT_LOADGAME and EVENT_SAVEGAME, self-explanatory. Also make EVENT_NEWGAME use myconnectindex for player ID instead of screenpeek.
git-svn-id: https://svn.eduke32.com/eduke32@2688 1a8010ca-5511-0410-912e-c29ae57300e0
2012-05-25 05:14:19 +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 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 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
hendricks266 efb440ada0 All string literals sent as normal messages to the player in-game written in ALL CAPS have been converted by hand to more proper capitalization. (Critical errors have been left as-is, and the editor did not need changes.)
git-svn-id: https://svn.eduke32.com/eduke32@2540 1a8010ca-5511-0410-912e-c29ae57300e0
2012-03-26 05:07:12 +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
helixhorned acc2a2f70e Save 'Numsprites' into savegames and mapstates. Bump savegame minor version.
git-svn-id: https://svn.eduke32.com/eduke32@2483 1a8010ca-5511-0410-912e-c29ae57300e0
2012-03-14 22:31:49 +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 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 a673b762d0 Remove old functions from savegame.c.
git-svn-id: https://svn.eduke32.com/eduke32@2464 1a8010ca-5511-0410-912e-c29ae57300e0
2012-03-13 20:05:33 +00:00
helixhorned 3917e05c1e Remove non-SAMESIZE_ACTOR_T code and remaining #defines.
We've been running with same-sized actor_t for a while without problems now.
In the unlikely event (famous last words) that an issue should pop up later,
this revision should be consulted for the differences between the two versions.

git-svn-id: https://svn.eduke32.com/eduke32@2451 1a8010ca-5511-0410-912e-c29ae57300e0
2012-03-11 17:37:50 +00:00
helixhorned ba9a3f9d1b Save TROR-related information into map states and bump BYTEVERSION.
git-svn-id: https://svn.eduke32.com/eduke32@2449 1a8010ca-5511-0410-912e-c29ae57300e0
2012-03-11 17:37:08 +00:00
helixhorned e5a133db8b When failing to open a savegame file for writing, print the reason to the log.
git-svn-id: https://svn.eduke32.com/eduke32@2393 1a8010ca-5511-0410-912e-c29ae57300e0
2012-03-01 23:35:53 +00:00
helixhorned 15c7460059 When loading a map and in a few other places, reset screen tinting.
git-svn-id: https://svn.eduke32.com/eduke32@2306 1a8010ca-5511-0410-912e-c29ae57300e0
2012-02-02 17:34:16 +00:00
helixhorned 283e8d053f Conditionally compile out the dynamic-to-static tile remapping feature.
git-svn-id: https://svn.eduke32.com/eduke32@2297 1a8010ca-5511-0410-912e-c29ae57300e0
2012-01-28 14:38:23 +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 b926e2a496 - When saving game, clear all polymer lights before. Not doing this makes
the SE ones douple, triple, ... after each save.  Maphack lights are reloaded
with polymer_resetlights() (though I've had them disappearing after load, I
couldn't reproduce it afterwards).
- in debugging builds, print a message when polymer_resetlight is called on a
nonexistent one.  The problem is not so much the call itself (it's guarded),
but the fact that resources on the caller side may not have been freed if it
thinks that those lights do in fact exist. Right now, it's not the case though.
- add 'loaded map hack' messages after some other successful loadmaphack calls

git-svn-id: https://svn.eduke32.com/eduke32@2236 1a8010ca-5511-0410-912e-c29ae57300e0
2012-01-05 21:58:23 +00:00
helixhorned 146e1f1c09 When loading a game, DON'T restore 'adult' TV tiles. This fixes the recent
crashes.

Usually, after loading a game, some wall tiles are tweaked depending on whether
adult mode is enabled or not.  If it's not, those wall picnums are replaced
with blank or broken screens.  If it is, they are restored from the wall's
.extra member.  Apparently though, Mapster32 leaves some .extra members
floating around even after deleting a TROR nextwall link (it's used as the
'lower wall index').  Because MAXWALLS is greater than MAXTILES, this may
produce out-of-bounds accesses and corrupt memory (besides setting wall
tilenums to nonsensical values) later in the game.

Other than that, the change only affects loading savegames created with adult
mode OFF. Kinky TV screenies simply won't be restored then.

git-svn-id: https://svn.eduke32.com/eduke32@2235 1a8010ca-5511-0410-912e-c29ae57300e0
2012-01-05 20:48:37 +00:00
helixhorned b5f2955895 savegame.c: some const void **ptr -> void **ptr, since they're certainly not const
git-svn-id: https://svn.eduke32.com/eduke32@2234 1a8010ca-5511-0410-912e-c29ae57300e0
2012-01-05 20:48:20 +00:00
helixhorned d1d94e083f savegame.c: fix compilation warnings with release build, add timing for debug
git-svn-id: https://svn.eduke32.com/eduke32@2218 1a8010ca-5511-0410-912e-c29ae57300e0
2011-12-28 20:33:54 +00:00
helixhorned 7baaa44e28 savegame.c: fix initial setting of compression threshold on savegame load;
64-bit fixes

git-svn-id: https://svn.eduke32.com/eduke32@2212 1a8010ca-5511-0410-912e-c29ae57300e0
2011-12-26 14:37:34 +00:00
helixhorned 5ef480ad7a fix displaying the screenshot even for old-version savegames.
git-svn-id: https://svn.eduke32.com/eduke32@2210 1a8010ca-5511-0410-912e-c29ae57300e0
2011-12-25 15:34:52 +00:00
helixhorned b3474c75b2 Rewrite the savegame format in terms of the generic saving/loading system.
This makes savegames practically the same as the initial snapshot of a demo.
Saves are now named 'dukesavX.esv' (demos: 'edemoX.edm').
Additionally, many changes that couldn't/needn't be cleanly separated are added
with this commit:
 - make spriteext_t have the same size across 32/64 bit platforms (actor_t partially)
 - prevent saving/loading in MP games (it certainly didn't work and still doesn't)
 - it's time we start using assertions! Define NDEBUG for releasse builds.
 - reset savegame major and minor versions (we have a new magic string, so no conflict)

git-svn-id: https://svn.eduke32.com/eduke32@2207 1a8010ca-5511-0410-912e-c29ae57300e0
2011-12-25 15:34:06 +00:00
helixhorned 8ecb6e6bd5 Factor out filename-based music setup code into G_SetupFilenameBasedMusic.
There were two instances of nearly identical code in premap.c and savegame.c.
Also identifies a (harmless) problem with realloc'ing, we had:

    if (len+1 > sizeof(MapInfo[...].musicfn))
        MapInfo[...].musicfn = Brealloc(MapInfo[...].musicfn, len+1)

which reallocs almost all the time (since .musicfn is a pointer). Now we do
realloc every time...

git-svn-id: https://svn.eduke32.com/eduke32@2202 1a8010ca-5511-0410-912e-c29ae57300e0
2011-12-25 15:32:30 +00:00
helixhorned 9a3ae8df08 misc. cleanup in savegame.c
git-svn-id: https://svn.eduke32.com/eduke32@2200 1a8010ca-5511-0410-912e-c29ae57300e0
2011-12-25 15:32:00 +00:00
helixhorned 41db6bc512 Remove 'projectile' field from actor_t because it was entirely unused.
WARNING: This silently breaks savegames on 64-bit platforms.

git-svn-id: https://svn.eduke32.com/eduke32@2197 1a8010ca-5511-0410-912e-c29ae57300e0
2011-12-25 15:31:14 +00:00
helixhorned a7d1177d23 savegame.c: minor cleanup and crash prevention in doloadplayer2
if loading directly from file to state.

git-svn-id: https://svn.eduke32.com/eduke32@2190 1a8010ca-5511-0410-912e-c29ae57300e0
2011-12-21 18:42:12 +00:00
helixhorned 89d321c01f In EDuke32 loading/saving menus, when finding old version savegame, display
some information about it instead of simply omitting it.
Internally, struct savegame --> struct savegame_ for easier grepping.

git-svn-id: https://svn.eduke32.com/eduke32@2188 1a8010ca-5511-0410-912e-c29ae57300e0
2011-12-21 18:41:38 +00:00
helixhorned 8e54a3febf Preliminary commoning of actor[].t_data[10] to an array of int32's on both
32- and 64-bit platforms. Also, make struct type actor_t also have a common
size of 128 bytes. New code currently disabled and #ifdef'd for comparison.

This requires certain t_data[] entries ([1]: move ptr, [4]: action ptr and
[5]: ai ptr with actors) to be converted to script offsets instead of pointers,
breaking savegame and net packet compatibility (we could in theory try hard not
to, but it would be too much trouble).

git-svn-id: https://svn.eduke32.com/eduke32@2185 1a8010ca-5511-0410-912e-c29ae57300e0
2011-12-21 18:40:47 +00:00
helixhorned 6fc7e5b683 Remove some warnings with clang, code-side changes.
git-svn-id: https://svn.eduke32.com/eduke32@2158 1a8010ca-5511-0410-912e-c29ae57300e0
2011-12-09 19:08:29 +00:00
helixhorned 85fba8755b maint 2: refactor bits of code that twiddle/untwiddle pointers for persistent storage into a G_Util_PtrToIdx() function
git-svn-id: https://svn.eduke32.com/eduke32@1950 1a8010ca-5511-0410-912e-c29ae57300e0
2011-07-29 22:07:49 +00:00
helixhorned 864cc11463 maint 1: refactor 3 redundant instances of the same code into G_ResetInterpolations()
git-svn-id: https://svn.eduke32.com/eduke32@1949 1a8010ca-5511-0410-912e-c29ae57300e0
2011-07-29 22:07:28 +00:00
helixhorned 793aadebc5 Janitorial work part 2, perfect for a rainy day. This fixes a lot of leaks, both on the client side as well as for memory allocated by OpenGL. If you had crashes after a few times of restartvid'ing in Polymer, this should fix it.
git-svn-id: https://svn.eduke32.com/eduke32@1942 1a8010ca-5511-0410-912e-c29ae57300e0
2011-07-22 22:00:53 +00:00
helixhorned ee4d060b1f * New m32script commands:
- sethighlightsector <sectnum> <on?>
 - updatehighlightsector
 - collectsectors <<array_to_collect_sectnums>> <initial_sector> <<num_collected_sectors>> <sector_filtering_state>

The latter does a breadth-first search starting from an initial sector and collects nextsectors only when the filtering state, given a sectnum as RETURN input, writes a nonzero value into RETURN. As a usage example, a.m32 includes the state 'collect_teleporting_sectors', that collects all sectors containing an SE7 and highlights them afterwards. This way, it should be possible to retrofit old maps with TROR by distributing small scripts that do most of the work (right now, joining has to be done by hand, though).


* corruption checker: for the 'nextwall inconsistent with nextsector' corruption, suggest an alternative fix by searching fitting nextwalls and changing the nextwall of the corrupt wall (as opposed to the nextsector). It will display with a leading '?' in the listing, and can be demanded by suffixing 'corruptcheck tryfix' with it. For example,

corruptcheck tryfix 9-21 ?

would fix some corruptions in Billy Boy's cranium.map without introducing drawing errors.


* fix demo playback (tueidj figured this out)


git-svn-id: https://svn.eduke32.com/eduke32@1927 1a8010ca-5511-0410-912e-c29ae57300e0
2011-07-03 22:51:28 +00:00
helixhorned 43ecbb1019 * We cansee() now through TROR portals, making enemies recognize you from above and below
* fixed subway roof interpolation; also small tweak to make this possible: http://forums.duke4.net/topic/3911-true-room-over-room/page__view__findpost__p__99099
* API change: Sect_{Set,Clear}Interpolation now takes sectnums directly


git-svn-id: https://svn.eduke32.com/eduke32@1926 1a8010ca-5511-0410-912e-c29ae57300e0
2011-07-01 17:15:07 +00:00
helixhorned 51fb860650 * Thin out models in memory by removing unused frames. This saves 200MB with DNE on Polymer.
* fix memory corruption when loading a Polymer savegame using another renderer and then change to Polymer
* fix possible crash in OSD_Exec() and uninitialized mem access in game config reader
* move makeasmwriteable() to baselayer.c


git-svn-id: https://svn.eduke32.com/eduke32@1910 1a8010ca-5511-0410-912e-c29ae57300e0
2011-06-19 18:30:32 +00:00
helixhorned 873375025f * Include file cleanup by dragging most declarations into editor.h
* more useful auto-red wall feature: if no structure-changing operations have been applied after highlighting and duplicating, now also paste 'visual' fields of outer walls (this is one example of the use of a system that temporarily keeps track of nextwalls for former red lines)
* multi-pkies now have individual parallaxyscale


git-svn-id: https://svn.eduke32.com/eduke32@1886 1a8010ca-5511-0410-912e-c29ae57300e0
2011-05-15 22:37:24 +00:00
helixhorned 98456aefe3 -- engine:
* support for free mixing of multi- and single-tile parallaxed skies in classic
* make visibility independent of yxaspect and viewingrange in OpenGL modes

-- editor:
* when dragging walls, restore pixel width after that (only for the left and right walls of pointhighlight, and its nextwalls, if any)
* pasting on walls and auto-aligning them now carries over a few more fields

-- fixes:
* visibility in OpenGL modes wasn't incremented gradually (regression due to making 'clamp' an inline function instead of a macro)
* memory corruption due to calling qlz_compress with less than the recommended surplus storage of 400 bytes
* decorative sprites in the mirror showing non-flipped
* make the subway SE message (much) more helpful by showing which sector the game considers to be the track sector


git-svn-id: https://svn.eduke32.com/eduke32@1882 1a8010ca-5511-0410-912e-c29ae57300e0
2011-05-12 23:31:13 +00:00
helixhorned 243e50db4b Insert two divide-by-zero checks that seem to fix the overhead map crash, but only with NOASM=1. Fix a couple of Mapster32 bugs and prettify some code there. Fix EDuke32 bug where the demo system overwrote boardname[] while using the file picker, making navigation between directories impossible.
git-svn-id: https://svn.eduke32.com/eduke32@1869 1a8010ca-5511-0410-912e-c29ae57300e0
2011-04-22 22:48:06 +00:00
helixhorned 621da89b37 fix demo playback on 64-bit systems; bump demo minor version number to reflect changes in r1857
git-svn-id: https://svn.eduke32.com/eduke32@1864 1a8010ca-5511-0410-912e-c29ae57300e0
2011-04-09 22:38:39 +00:00