Commit Graph

235 Commits

Author SHA1 Message Date
terminx 298e4f9716 1 line fix for a change that accidentally got reverted when merging newer svn updates into an older local branch
git-svn-id: https://svn.eduke32.com/eduke32@2653 1a8010ca-5511-0410-912e-c29ae57300e0
2012-05-14 22:45:40 +00:00
terminx 4ba6da5007 Addition of 3 events:
EVENT_SOUND: triggered upon playback of any sound, this allows the "hard coded" sounds to be altered in a context-aware fashion instead of having to resort to clunky hacks like replacing them with a blank sound effect.  RETURN var
iable is set to the sound effect # of the sound to be played, or -1 to cancel playback.

EVENT_CHECKTOUCHDAMAGE: triggered in P_CheckTouchDamage() whenever the player collides with anything.  Value of RET
URN is set to the result provided by clipmove() and so can be decoded in the same way.  Value of RETURN when the event is over can also be manipulated to control some of the hard coded damage effects.

EVENT_CHECKFLOORDAMAGE: triggered in P_CheckFloorDamage(), RETURN is simply the picnum of the floor of the sector t
he player is in.  Can be used to cancel hard coded floor damage effects or to make other tiles exhibit the same eff
ects

Other misc fixes and cleanups, including a possible workaround for Duke Plus SECTOREFFECTOR light issues wherein all SE49 and SE50 that have a statnum of STAT_EFFECTOR are simply changed to STAT_LIGHT during the STAT_EFFECTOR loop
 now.


git-svn-id: https://svn.eduke32.com/eduke32@2652 1a8010ca-5511-0410-912e-c29ae57300e0
2012-05-14 18:12:27 +00:00
helixhorned 144897d524 Assign light SEs (lotags 49 and 50) to an exclusive status number. EXPERIMENTAL!
The primary reason for doing this is that handing of moving sectors is
significantly simplified. Because moving sectors usually don't move containing
SEs/effector-statnum sprites, no special handing code is needed to move light
SEs with them. Thus, this commit sets light SEs to a new statnum when they're
spawned *from premap*, and a new G_Move*-like function (called G_DoPolymerLights)
is added to process every sprite in that status list.

This should "fix" light SEs moving together with a variety of moving sectors,
but CON programs expecting the old behavior may break, therefore this commit is
marked as experimental.

Additionally, a problem with the old implementation is identified: it seems like
the correct functioning is dependent upon the order of processing between the
sector movement effector and the light SE, so this makes it another good reason
for the change.  (A third one is that all lights can be processed with a per-
statnum loop, but CON coders should not do this until the change is considered
final).

git-svn-id: https://svn.eduke32.com/eduke32@2646 1a8010ca-5511-0410-912e-c29ae57300e0
2012-05-06 21:01:52 +00:00
helixhorned 3f798b048c Factor out almost all instances of setting ...->pals.[rgbf] into P_PalFrom.
This is so that it may be intercepted in the future.
The only code that's not replaced by the function call is with the CON
interface to g_player[].ps->pals via player[].pals X and .pals_time.
Also, comment out one instance because it's overwritten by a succeeding one.

git-svn-id: https://svn.eduke32.com/eduke32@2643 1a8010ca-5511-0410-912e-c29ae57300e0
2012-05-05 22:24:50 +00:00
helixhorned 2ac2cce38b In game code, replace remaining literal status numbers by their defines.
git-svn-id: https://svn.eduke32.com/eduke32@2642 1a8010ca-5511-0410-912e-c29ae57300e0
2012-05-05 22:24:33 +00:00
helixhorned 008121cffd Some leftover stuff from the Wii patch.
- in actors.c, make a static array const (the original patch removed the
  staticness)
- remove one comment and change some compiled-out code
- remove commented out pre-Makefile.common stuff

Some changes were not adopted from tueidj's patch:
- whitespace cleanup
- ud.config.UseJoystick = 1 in config.c
- Makefile.common, as mentioned before
- proper read-in of g_numRealPalettes, because it was done with r2503

git-svn-id: https://svn.eduke32.com/eduke32@2632 1a8010ca-5511-0410-912e-c29ae57300e0
2012-05-01 12:41:35 +00:00
helixhorned 5dd8d20e7a Make two-way trains capable of carrying SE49 or SE50 sprites.
git-svn-id: https://svn.eduke32.com/eduke32@2614 1a8010ca-5511-0410-912e-c29ae57300e0
2012-04-28 21:56:23 +00:00
helixhorned 4322dff22c Cleanup in game.c/actors.c part2, only whitespace changes.
git-svn-id: https://svn.eduke32.com/eduke32@2609 1a8010ca-5511-0410-912e-c29ae57300e0
2012-04-13 10:46:04 +00:00
helixhorned ab88ea66ef Some cleanup in game.c/actors.c, part 1.
git-svn-id: https://svn.eduke32.com/eduke32@2608 1a8010ca-5511-0410-912e-c29ae57300e0
2012-04-13 10:45:49 +00:00
helixhorned 7c8f2c2887 actors.c: factor out various duplicated code in G_MoveEffectors.
- 4 instances -> HandleSE31
- 4 instances -> MaybeTrainKillPlayer
- 2 instances -> MaybeTrainKillEnemies
- move a couple of variables into inner blocks and add 'const' for easier reading

In passing, fix a minor glitch where the squishing sound of an enemy that got
run over by an SE 6 or 14 car would appear to originate from the SE instead
of the enemy's last position.

git-svn-id: https://svn.eduke32.com/eduke32@2607 1a8010ca-5511-0410-912e-c29ae57300e0
2012-04-13 10:45:33 +00:00
helixhorned 8f8bb68ace Rename ud.clipping to ud.noclip internally for sanity.
This might now be even more confusing for users reading both the source
and CON code (where the access is necessarily still via '.clipping'),
but at least reading the source now makes sense :P

git-svn-id: https://svn.eduke32.com/eduke32@2454 1a8010ca-5511-0410-912e-c29ae57300e0
2012-03-11 17:38:50 +00:00
helixhorned bdc02d36d9 Explicitly call A_DeleteSprite() from game code instead of relying on macro expansion.
git-svn-id: https://svn.eduke32.com/eduke32@2452 1a8010ca-5511-0410-912e-c29ae57300e0
2012-03-11 17:38:13 +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 ea9ecf0735 Remove a couple of redundant declarations in actors.c and gameexec.c.
git-svn-id: https://svn.eduke32.com/eduke32@2447 1a8010ca-5511-0410-912e-c29ae57300e0
2012-03-11 17:36:32 +00:00
helixhorned 0919c186ba Pull the 'for (' ... ')' out of the TRAVERSE_{CONNECT,SPRITE_*} macros.
This plays more nicely with automatic formatters.  Also indent accordingly.

git-svn-id: https://svn.eduke32.com/eduke32@2379 1a8010ca-5511-0410-912e-c29ae57300e0
2012-02-21 19:33:33 +00:00
helixhorned 0f933a8522 Fix potential (certain?) oob access with ST28/SE21.
Encountered with Scent.map.  Since the SE21 are deleted after they have
been used, the search for them in the ST28 code in sector.c may come up
empty, in which case sector[-1] would be accessed.

git-svn-id: https://svn.eduke32.com/eduke32@2377 1a8010ca-5511-0410-912e-c29ae57300e0
2012-02-21 19:32:55 +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 34000a9ed0 Factor out two pieces of identical code in actors.c into A_HandleBeingSpitOn().
This fixes a bug in passing: 'int32_t j' was assigned to as a temporary inside
one instance of the code, but used as if it were the previous sprite index
further on.  Would only happen with projectiles that "work like" both SPIT
and RPG_IMPACT.

git-svn-id: https://svn.eduke32.com/eduke32@2321 1a8010ca-5511-0410-912e-c29ae57300e0
2012-02-09 22:42:51 +00:00
helixhorned 5846d73d30 Probably fix crash when reaching light count limit in G_MoveEffectors SE50 code.
git-svn-id: https://svn.eduke32.com/eduke32@2320 1a8010ca-5511-0410-912e-c29ae57300e0
2012-02-08 11:01:03 +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 f12bd9f13d misc. beautifying some game code...
git-svn-id: https://svn.eduke32.com/eduke32@2192 1a8010ca-5511-0410-912e-c29ae57300e0
2011-12-21 18:42:49 +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 ba858b3858 Fix a number of oob accesses with "switch switches".
Various code checked for switch tiles in the following manner,
  for (ii=0; ii<2; ii++)
      switch (DynamicTileMap[sprite[i].picnum-1+ii]) { case SOME_SWITCH: ... }
which blows for picnum 0.  Now, we simply disallow it.

git-svn-id: https://svn.eduke32.com/eduke32@2174 1a8010ca-5511-0410-912e-c29ae57300e0
2011-12-11 13:26:39 +00:00
helixhorned 151287168c - Fix invalid polymer light array access originating from game's cleanup
callback 'G_Polymer_UnInit'.
- In astub.c, reset spritelightid to -1 when nulling the spritelightptr of
  a sprite  (no crashes observed, just precaution)
- In sdlayer.c, catch SIGILLs with our signal handler too, since illegal
  instructions are what the instrumented debug builds will execute when
  attempting to carry out an undefined (per C) operation.

git-svn-id: https://svn.eduke32.com/eduke32@2169 1a8010ca-5511-0410-912e-c29ae57300e0
2011-12-09 19:11:31 +00:00
helixhorned cb950911a0 Comment out some leftover code from the "make back-facing switches invisible"
hack.

git-svn-id: https://svn.eduke32.com/eduke32@2082 1a8010ca-5511-0410-912e-c29ae57300e0
2011-10-27 13:13:37 +00:00
hendricks266 9d04c42219 Tripbombs now stop producing laserlines when they reach invalid space. In effect, tripbombs facing the wrong way will not make infinite laser lines.
fix: http://forums.duke4.net/topic/4907-laserline-crash-bug/

git-svn-id: https://svn.eduke32.com/eduke32@2072 1a8010ca-5511-0410-912e-c29ae57300e0
2011-10-10 00:07:00 +00:00
plagman 8b7af4f486 Polymer: fix stupid typo that broke r2057
git-svn-id: https://svn.eduke32.com/eduke32@2063 1a8010ca-5511-0410-912e-c29ae57300e0
2011-10-02 11:44:05 +00:00
plagman bba68b1913 Polymer: fix horizontal spotlight SEs constantly getting invalidated
Polymer has a hack that snaps horiz values of spotlights between 90 and 110
to 90 and 110 to avoid triggering aliasing artifacts with perfectly horizontal
spotlights. Propagate that change all the way to the spotlight SE sprite so
that the code won't think that the horiz is always different from the light
and mark it invalid each frame.

git-svn-id: https://svn.eduke32.com/eduke32@2057 1a8010ca-5511-0410-912e-c29ae57300e0
2011-10-02 07:09:04 +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 5d79003e60 Take a stab at hidden model switch handling. There are at least two ways by
which switches have been hidden in the original and user maps. One is to make
it face a wall, and another is to 'embed' it in e.g. the floor, like the
monitor with the burning fuse in E4L1. Both kinds show up when the switches
are rendered as models, revealing the secrets that the mapper sought to hide.
My proposal, implemented in this commit, is to apply a heuristic for such
switches at premap and make them invisible (set cstat bit 32768). The
conditions are re-checked during the game in case there is a switch coming
out of the floor, for example. A new spriteext bit is used for this feature.

git-svn-id: https://svn.eduke32.com/eduke32@1968 1a8010ca-5511-0410-912e-c29ae57300e0
2011-08-17 18:52:16 +00:00
helixhorned ff5c3b660f * "Fix" two bugs introduced by r1450. In quotation marks, because I merely tracked down the offending changes without understanding them. Mild breakage of TX's ROR is expected.
The two bugs are:
    - RPG projectiles don't pass through water
    - can't emerge from slime in bobsp2
* Coalesce Polymer lights that are at the same position for FIRE-like sprites so that only one light is actually generated. This is good for usermaps that have multi-sprite fires, like bobsp2 again.

git-svn-id: https://svn.eduke32.com/eduke32@1967 1a8010ca-5511-0410-912e-c29ae57300e0
2011-08-16 19:17:45 +00:00
helixhorned d4f234b09f A bit of cleanup with memory issues.
First, it is now possible to disable the memcache (which is there to cache the texcache) by setting the new cvar 'r_memcache' to 0. Do this if you're constrained on memory or getting crashes when e.g. doing vidrestart often. Also, the memcache will disable itself (and free its storage, if it's there) the first time it fails to allocate.

Fix a strcpy with identical arguments in game.c and a couple of uninitialized mem accesses related to Polymer lights.


git-svn-id: https://svn.eduke32.com/eduke32@1941 1a8010ca-5511-0410-912e-c29ae57300e0
2011-07-22 13:32:01 +00:00
helixhorned a9290a0d29 Make useractor's <actortype> bit 4 mean 'this actor will not move by itself' to make it possible to have it in a rotating sector with full rounding correction. No token name is provided because the three others come from CON and I don't want to clutter the namespace; fix the editor issue where the box wasn't shown on occasion in the tile selector (8-bit)
git-svn-id: https://svn.eduke32.com/eduke32@1934 1a8010ca-5511-0410-912e-c29ae57300e0
2011-07-20 22:08:05 +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 6a713133cf * Fix usage of uninitialized array (\!), which could result in TROR connections being deleted at random when deleting sectors. I guess this is a sign of approaching senility :(
* When dragging highlighted sprites, do a setsprite() after each position update. This way, they won't end up on the wrong level
* TROR support for SE 31 and 32 in-game, example provided in test map
* some uncommited stuff for TROR: SE 6/14


git-svn-id: https://svn.eduke32.com/eduke32@1924 1a8010ca-5511-0410-912e-c29ae57300e0
2011-06-29 19:57:05 +00:00
helixhorned 83ab50d66e * Make destructable ceilings and floors (SE 13 pointing down) behave well with TROR; also carry sprites and players on the roof of a subway. The latter uses t_data[9] on the pivot sprite.
* Make the minimum resolution possible 640x480. Sometimes you'd accidentally enter something like 'vidmode 800 60' and crashes would ensue...
* fix a warning


git-svn-id: https://svn.eduke32.com/eduke32@1921 1a8010ca-5511-0410-912e-c29ae57300e0
2011-06-26 21:59:42 +00:00
helixhorned 6509f45dd6 another small fix
git-svn-id: https://svn.eduke32.com/eduke32@1917 1a8010ca-5511-0410-912e-c29ae57300e0
2011-06-24 13:23:53 +00:00
helixhorned cf0e5b53c7 Don't crash G_ShowCacheLocks when there are many locks; Better sprite interpolation in subways
git-svn-id: https://svn.eduke32.com/eduke32@1916 1a8010ca-5511-0410-912e-c29ae57300e0
2011-06-24 11:16:12 +00:00
helixhorned 21297f8bcf I now understand SE0's
git-svn-id: https://svn.eduke32.com/eduke32@1914 1a8010ca-5511-0410-912e-c29ae57300e0
2011-06-22 19:26:11 +00:00
helixhorned 5cb1132d56 Make certain sprites in rotating sectors impervious against diverging from their initial position due to roundoff error accumulation. The sprites affected are those with statnums 0, STANDABLE, FX, and FALLER (also SE lights, but that shouldn't be considered permanent) contained in sectors with SE 0, 6 or 14. Fix some interpolation issues with such sprites in passing, though they still jitter on occasion. For usage examples, take a look at the updated trueror1.map.
Implementation note: the so instrumented sprites use actor[].t_data[7] to hold a magic number (0x18190000 + pivot spr idx), and t_data[8] and [9] for the initial coords relative to the pivot point.

git-svn-id: https://svn.eduke32.com/eduke32@1913 1a8010ca-5511-0410-912e-c29ae57300e0
2011-06-22 19:12:47 +00:00
terminx 682981b50e Fix SE49 and SE50 breakage
git-svn-id: https://svn.eduke32.com/eduke32@1885 1a8010ca-5511-0410-912e-c29ae57300e0
2011-05-14 02:00:21 +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 203cf0b7b1 A crapload of random stuff.
* Polymer light access to m32script (light[<lightidx>].<field>). As an application, provide a state 'insertlights' that takes the currently active lights and puts them into the map as SEs (e.g. for maphack recovery).
* Prototype of a mechanism to gray out certain portion of a map, making them inactive to various, but not all, editing operations. Highlighting a set of sectors and pressing Ctrl-R will make the Z bounds be [(least ceiling z), (greatest floor z)] of all selected ones, pressing Ctrl-R when no sectors are highlighted will reset them. Not sure if it's for production use at this stage...
* The 'align walls' feature [.] now has three independently toggleable behaviours: recurse nextwalls (toggled when Ctrl is pressed), iterate point2s (disabled when Shift is pressed), and also copy pixel width (toggled when Alt is pressed).
* Make shades clamp instead of overflowing in the editor

Fixes:
* crash when carrying out certain operations on walls with xrepeat 0
* the Pause key on linux. Also make demo recording start on Shift-ScrollLock because ScrollLock alone is too easily pressed when pausing


git-svn-id: https://svn.eduke32.com/eduke32@1877 1a8010ca-5511-0410-912e-c29ae57300e0
2011-05-07 18:23:34 +00:00
terminx 8eda9d683d Fix crash from http://forums.duke4.net/topic/3719-svn1857-dukeplus/page__view__findpost__p__80340
git-svn-id: https://svn.eduke32.com/eduke32@1859 1a8010ca-5511-0410-912e-c29ae57300e0
2011-04-08 22:05:32 +00:00
terminx 1fdafcdad6 Cleaning out my tree... mostly internal changes. Adds workaround to disable texture compression with the crappy fglrx driver on Linux, fixes FIRE sprites so that they don't render at their sector's floorz all the time, changes CON compiler around a bit to use a loop instead of calling C_ParseCommand() 10 million times.
git-svn-id: https://svn.eduke32.com/eduke32@1857 1a8010ca-5511-0410-912e-c29ae57300e0
2011-04-07 01:16:29 +00:00
terminx 60d47cb805 <Roma_Loom> TerminX: have you ever considered to make fire with pal 1 cast blueish light instead of default?
<TerminX> sure, I can do that


git-svn-id: https://svn.eduke32.com/eduke32@1828 1a8010ca-5511-0410-912e-c29ae57300e0
2011-03-05 07:15:44 +00:00
terminx bcc3682af0 Update nedmalloc.dll and fix undesirable FIRE/FIRE2 and COOLEXPLOSION1 behavior from http://forums.duke4.net/index.php?showtopic=2961&st=90&start=90
git-svn-id: https://svn.eduke32.com/eduke32@1827 1a8010ca-5511-0410-912e-c29ae57300e0
2011-03-05 03:57:15 +00:00
terminx 323008432a Consolidate POLYMOST preprocessor define into USE_OPENGL, remove SUPERBUILD preprocessor define, add additional mode to neartag() to skip sprite searches and speed up processing (and enable for CON_OPERATE), fix issue with nearby single instance sounds not playing due to out of range sounds blocking their playback, fix issue with settings.cfg being reset to default bindings when running a mod that specifies its own cfg base name, improve CON structure member interface read/write performance, fix a bug with CON "move" pointer validation
git-svn-id: https://svn.eduke32.com/eduke32@1820 1a8010ca-5511-0410-912e-c29ae57300e0
2011-03-04 08:50:58 +00:00
terminx 043bb208b3 Multiplayer improvements
git-svn-id: https://svn.eduke32.com/eduke32@1802 1a8010ca-5511-0410-912e-c29ae57300e0
2011-02-25 21:50:19 +00:00
helixhorned 4a5e89f0dd Fixes former crash in drawline16 and swaps drawpixel with the unsafe variant there; fixes potential sector[-1] access in sliding Star Trek doors; make CC overridable in Makefiles so that other toolchains or static analyzers like scan-build/clang can be used; with its help, fix some issues, some more severe than others.
git-svn-id: https://svn.eduke32.com/eduke32@1736 1a8010ca-5511-0410-912e-c29ae57300e0
2010-12-17 14:22:15 +00:00