Commit Graph

256 Commits

Author SHA1 Message Date
helixhorned 772778205b Pack how many players fake multi was started with into g_fakeMultiMode.
git-svn-id: https://svn.eduke32.com/eduke32@2957 1a8010ca-5511-0410-912e-c29ae57300e0
2012-08-22 22:51:38 +00:00
helixhorned ea74aad3a6 Some g_netServer || g_netServer --> g_netServer.
git-svn-id: https://svn.eduke32.com/eduke32@2925 1a8010ca-5511-0410-912e-c29ae57300e0
2012-08-19 12:54:30 +00:00
helixhorned e420dc84bd Clean up G_MoveFX() a little.
git-svn-id: https://svn.eduke32.com/eduke32@2887 1a8010ca-5511-0410-912e-c29ae57300e0
2012-08-13 18:25:59 +00:00
helixhorned 8039db5ff2 Hacks for the splitscreen mod: play sounds from both players.
The sound distance is the minimum of the two.  Both point sources as well
as MUSICANDSFX ambient sound is handled.

git-svn-id: https://svn.eduke32.com/eduke32@2885 1a8010ca-5511-0410-912e-c29ae57300e0
2012-08-13 18:25:53 +00:00
helixhorned 971d816235 Mass text replacement g_player[p].ps --> ps, part 2 (harder)
Functions affected are G_Move* in actors.c and A_Shoot in player.c.
Here, the p variable had function scope, now it's redeclared in shorter
blocks. I'm still relatively sure that no observable behavior was changed,
though not as sure as in part 1.  Also, some dead assignments and the like
are eliminated.

git-svn-id: https://svn.eduke32.com/eduke32@2876 1a8010ca-5511-0410-912e-c29ae57300e0
2012-08-10 19:11:56 +00:00
helixhorned e1d6fe534d Mass text replacement g_player[p].ps --> ps, part 1 (the easy one).
The p variable (sometimes named differently) has short scope in all cases,
so I'm almost sure that the replacements amount to an identity transformation.

git-svn-id: https://svn.eduke32.com/eduke32@2875 1a8010ca-5511-0410-912e-c29ae57300e0
2012-08-10 19:11:53 +00:00
helixhorned 689788c65b actors.c: factor out 4 instances of id. code (up to args) into nudge_player().
git-svn-id: https://svn.eduke32.com/eduke32@2874 1a8010ca-5511-0410-912e-c29ae57300e0
2012-08-10 19:11:49 +00:00
helixhorned af626df86b Fix slimers not disappearing on dnmonsters cheat, display 2nd 'on' state.
git-svn-id: https://svn.eduke32.com/eduke32@2867 1a8010ca-5511-0410-912e-c29ae57300e0
2012-08-07 13:08:57 +00:00
helixhorned 936ef3424b Clean up game.c and actors.c.
git-svn-id: https://svn.eduke32.com/eduke32@2865 1a8010ca-5511-0410-912e-c29ae57300e0
2012-08-06 20:00:31 +00:00
helixhorned f3970f9ac7 Lunatic: clean up handing of ac/mv internally, add control module.
git-svn-id: https://svn.eduke32.com/eduke32@2864 1a8010ca-5511-0410-912e-c29ae57300e0
2012-08-06 20:00:29 +00:00
helixhorned f1ffd6d90a Factor out 5 instances of functionally identical code into G_ClearCameraView().
git-svn-id: https://svn.eduke32.com/eduke32@2853 1a8010ca-5511-0410-912e-c29ae57300e0
2012-08-02 10:52:13 +00:00
helixhorned 650d859a6f actors.c: factor out 4 almost identical code instances into proj_spawn_and_sound
Most differences are handled with function parameters, except that one instance
checked SpriteProjectile[i].spawns for being >0 instead of >=0.  The factored
function always checks for >=0.

git-svn-id: https://svn.eduke32.com/eduke32@2794 1a8010ca-5511-0410-912e-c29ae57300e0
2012-07-01 22:11:22 +00:00
helixhorned 7f409f08bb When teleporting silently, also set g_player[].ps->bobposx/y to the new position
This fixes an integer overflow when a distance is calculated later.

git-svn-id: https://svn.eduke32.com/eduke32@2785 1a8010ca-5511-0410-912e-c29ae57300e0
2012-06-26 19:49:56 +00:00
helixhorned 59fa419506 Lunatic: pack actor/move parameters into t_data, which is enlarged to 14 elements.
(LUNATIC build only.)
Also, a minor problem is identified.  sizeof(actor_t) is 124 on 64-bit platforms,
while the expected size is 128 bytes.  This needs to be corrected whenever the
next savegame version bump happens.

git-svn-id: https://svn.eduke32.com/eduke32@2724 1a8010ca-5511-0410-912e-c29ae57300e0
2012-06-03 15:46:08 +00:00
helixhorned 35d989646e A couple of minor fixes and comments that got accumulated in my tree.
git-svn-id: https://svn.eduke32.com/eduke32@2709 1a8010ca-5511-0410-912e-c29ae57300e0
2012-05-29 20:01:55 +00:00
helixhorned 5b387f7a08 Introduce two convenient sprite iteration macros in build.h, add a few uses.
Defines SPRITES_OF(Statnum, Iter) and SPRITES_OF_SECT(Sectnum, Iter)
[The first is so that STAT_* can be substituted for Iter and it reads nicely.]

Usage should be self-explanatory, but one thing to keep in mind is that
the sprites that are iterated over MUST NOT be deleted.

git-svn-id: https://svn.eduke32.com/eduke32@2707 1a8010ca-5511-0410-912e-c29ae57300e0
2012-05-29 20:01:48 +00:00
helixhorned eebddcd559 Cleanup & minor rewrites, among other things in premap.c:G_EnterLevel().
git-svn-id: https://svn.eduke32.com/eduke32@2695 1a8010ca-5511-0410-912e-c29ae57300e0
2012-05-25 18:39:22 +00:00
helixhorned f5fb70250a Lunatic: actions prototype, not enabled even in the dev build.
For Lunatic, we'll want to get rid of the t_data --> script indirections, since
the latter will be no more.  Thus, all parameters are saved in t_data directly.

For the normal build, there are no changes, only stylistic tweaks.

git-svn-id: https://svn.eduke32.com/eduke32@2669 1a8010ca-5511-0410-912e-c29ae57300e0
2012-05-18 12:46:10 +00:00
helixhorned 2963e2874d Fix A_CheckEnemyTile() returning 1 for "fixed" sprites (see r1913).
Those sprites are usually decorative, and certainly not enemies!

git-svn-id: https://svn.eduke32.com/eduke32@2667 1a8010ca-5511-0410-912e-c29ae57300e0
2012-05-18 12:45:29 +00:00
terminx 1c1da97378 WIP multiplayer changes, still completely broken.
git-svn-id: https://svn.eduke32.com/eduke32@2664 1a8010ca-5511-0410-912e-c29ae57300e0
2012-05-17 23:54:43 +00:00
terminx 2ca8dc1c38 This should hopefully fix the disaster with events caused by my last couple of commits ;)
git-svn-id: https://svn.eduke32.com/eduke32@2656 1a8010ca-5511-0410-912e-c29ae57300e0
2012-05-16 00:45:10 +00:00
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