Commit graph

321 commits

Author SHA1 Message Date
terminx
85cf8de0f3 Add support for shareware 0.99/1.0/1.1, for shits and giggles.
git-svn-id: https://svn.eduke32.com/eduke32@3803 1a8010ca-5511-0410-912e-c29ae57300e0
2013-05-23 18:28:04 +00:00
helixhorned
8dd73d0fe8 Tweak r3681 to obtain the same behavior in the pre-r3681 undefined behavior case.
That is, assume that switch(DYNAMICTILEMAP(-1)) (which is an oob access and thus
undefined behavior) gets us to the 'default:' label.

git-svn-id: https://svn.eduke32.com/eduke32@3743 1a8010ca-5511-0410-912e-c29ae57300e0
2013-05-10 12:31:33 +00:00
helixhorned
c6d7c08d58 Generalize ZRANGE and ANGRANGE to accept any nonnegative number.
Numbers 0 and 1 mean 'no spread', but the latter does one krand() call.
Negative numbers are reserved for potential future use.

git-svn-id: https://svn.eduke32.com/eduke32@3715 1a8010ca-5511-0410-912e-c29ae57300e0
2013-04-29 19:24:12 +00:00
helixhorned
46ccf59c74 Fix TARGET sprites used as switches, introduced in r3679.
git-svn-id: https://svn.eduke32.com/eduke32@3713 1a8010ca-5511-0410-912e-c29ae57300e0
2013-04-28 16:45:29 +00:00
helixhorned
dac18a99e9 A couple of trivial stylistic changes.
git-svn-id: https://svn.eduke32.com/eduke32@3694 1a8010ca-5511-0410-912e-c29ae57300e0
2013-04-21 19:55:03 +00:00
helixhorned
e2c05cbbae Fix A_MoveSprite() wrongly reporting sector hit without z change after r3678.
git-svn-id: https://svn.eduke32.com/eduke32@3686 1a8010ca-5511-0410-912e-c29ae57300e0
2013-04-16 20:08:45 +00:00
helixhorned
0db0587731 TROR no-SE7 water: spawn splash, reuse calculated other sector number.
git-svn-id: https://svn.eduke32.com/eduke32@3683 1a8010ca-5511-0410-912e-c29ae57300e0
2013-04-15 10:48:20 +00:00
helixhorned
73eb1c4def Improve on the code that handles changing sectors of projectiles.
- In the A_MoveSprite() code that transports projectiles due to an SE7
  (introduced in r1450 / legacy ROR), only report "success" if the
  transportation succeeded.
- Clear newly introduced internal SPRITE_DIDNOSE7WATER flag after
  checking it.

git-svn-id: https://svn.eduke32.com/eduke32@3682 1a8010ca-5511-0410-912e-c29ae57300e0
2013-04-15 10:48:18 +00:00
helixhorned
732a1ca33c In G_MoveStandables() CRACKx handling, fix oob access of DynamicTileMap[].
Also, in two cases, don't assign A_IncurDamage() result to a variable if
it's not needed.

git-svn-id: https://svn.eduke32.com/eduke32@3681 1a8010ca-5511-0410-912e-c29ae57300e0
2013-04-15 10:48:15 +00:00
helixhorned
3b39a87bd1 Fix a couple of issues identified in the preceding commit.
- In S_PlaySound(), move the sound index bound check above an indexing.
- For A_CheckHitSprite(), and A_FindPlayer(), allow NULL second arg.
- In A_ShootWithZvel(), make some one-letter vars be int32_t, making
  storing safeldist() results in them meaningful.
- In MaybeTrainKillEnemies(), remove two redundant checks and move another
  one further up.
- Comment that SIDEBOLT1 will never be translucent as was probably intended.
- In G_MoveFX(), fix an always-true comparison.

git-svn-id: https://svn.eduke32.com/eduke32@3680 1a8010ca-5511-0410-912e-c29ae57300e0
2013-04-15 10:48:13 +00:00
helixhorned
8064bd2f30 Clean up of mostly actors.c, but some other files along the way too.
- Rewrite some sprites-of-{stat,sector} loops using the SPRITES_OF,
  SPRITES_OF_SECT and new SPRITES_OF_SECT_SAFE macros.
- In passing, identify some problems and mark them with 'XXX', but don't
  attempt to fix them yet.
- The usual readability improvements...

git-svn-id: https://svn.eduke32.com/eduke32@3679 1a8010ca-5511-0410-912e-c29ae57300e0
2013-04-15 10:48:09 +00:00
helixhorned
52fc0bdfc5 TROR no-SE7 water: handle projectiles.
Actually, the tweaked code in VM_Move() is not specific to projectiles, so
other sprites now may pass no-SE7 water boundaries too, but it's most noticeable
with projectiles.

git-svn-id: https://svn.eduke32.com/eduke32@3678 1a8010ca-5511-0410-912e-c29ae57300e0
2013-04-15 10:48:05 +00:00
helixhorned
84e8ce6855 TROR no-SE7 water: allow boundary change only if other-side lotag is other one.
That is, if submerging, the lower sector MUST have lotag 2. If emerging, the
upper sector MUST have lotag 1. (Previously, emersion happened from ST 2 sectors
unconditionally.)  This means that the area where submersion or emersion can
happen is now the same for the top and bottom parts.

git-svn-id: https://svn.eduke32.com/eduke32@3677 1a8010ca-5511-0410-912e-c29ae57300e0
2013-04-15 10:48:00 +00:00
helixhorned
53b01f57c6 Factor out displaying episode ending cutscenes into G_BonusCutscenes().
Also,
 - retire IFWITHIN() macro, preferring expanding it
 - fix _endofgame() in control.lua

git-svn-id: https://svn.eduke32.com/eduke32@3647 1a8010ca-5511-0410-912e-c29ae57300e0
2013-04-05 17:53:25 +00:00
helixhorned
edcef5c3ec Define a macro LUNATIC_EXTERN that expands to 'static' in non-Lunatic builds.
git-svn-id: https://svn.eduke32.com/eduke32@3645 1a8010ca-5511-0410-912e-c29ae57300e0
2013-04-05 17:53:18 +00:00
helixhorned
385c582efa Fix handling of SE31 pointing upward. A bug was introduced in r2607.
git-svn-id: https://svn.eduke32.com/eduke32@3635 1a8010ca-5511-0410-912e-c29ae57300e0
2013-04-01 18:35:44 +00:00
helixhorned
a6a4e30bbc Fix playing ambient sounds at max volume for split sec on entering their range.
This is done by always calling FX_PlayAuto3D() to play such sounds. It now
additionally takes a third argument 'loophow', permissible values being
FX_ONESHOT and FX_LOOP.

git-svn-id: https://svn.eduke32.com/eduke32@3631 1a8010ca-5511-0410-912e-c29ae57300e0
2013-03-31 18:58:17 +00:00
helixhorned
53f6d749df Return early from A_IncurDamage() if actor[].picnum ("htpicnum" in CON) is < 0.
With this change, it is impossible for negative values to be used as array
indices inside this function, and I believe that it is also impossible that
they escape to somewhere they might be used as such.

For Lunatic, allow setting actor[].picnum to negative values and in the
translator, add (commented out) code to warn whenever it is set to a constant
negative value.  Also, fix a _sound call in _addphealth in control.lua.

git-svn-id: https://svn.eduke32.com/eduke32@3626 1a8010ca-5511-0410-912e-c29ae57300e0
2013-03-29 15:59:23 +00:00
helixhorned
efbc4cec90 Lunatic: actor usertypes from CON, set SFLAGs as 2nd gameactor() arg in Lua.
In passing, fix a couple of omissions: gameactor() being passed nil's in the
middle, more than one moveflag to CON *actor.

git-svn-id: https://svn.eduke32.com/eduke32@3597 1a8010ca-5511-0410-912e-c29ae57300e0
2013-03-24 18:53:28 +00:00
hendricks266
85f6a64deb Add to r3544.
git-svn-id: https://svn.eduke32.com/eduke32@3576 1a8010ca-5511-0410-912e-c29ae57300e0
2013-03-19 06:22:08 +00:00
hendricks266
e2701c9a5a Patch up some broken hardcoded behavior with regard to the Sentry versions of the bosses (minibosses), as suggested by Fox.
This should have no adverse effects or side-effects. The changes only apply if a modder chose to use completely broken functionality in the first place.

git-svn-id: https://svn.eduke32.com/eduke32@3544 1a8010ca-5511-0410-912e-c29ae57300e0
2013-03-04 01:23:55 +00:00
helixhorned
6816afe07e Refactor C code related to gettimedate and sect*interpolation CON commands.
No functional changes.

git-svn-id: https://svn.eduke32.com/eduke32@3486 1a8010ca-5511-0410-912e-c29ae57300e0
2013-02-16 18:53:00 +00:00
helixhorned
2c3ffa291c actors.c: factor out 6x identical code into Proj_BounceOffWall().
git-svn-id: https://svn.eduke32.com/eduke32@3461 1a8010ca-5511-0410-912e-c29ae57300e0
2013-02-07 21:00:55 +00:00
helixhorned
dec5445880 Rework hardcoded BADGUY sprite flag initialization (i.e. amend r3257).
Use a new flag to mark hard-coded enemies, not SPRITE_BADGUY.
This fixes an issue where in E1L4, a pigcop would appear in the area
you have to crawl under shrunk. Thanks to LLCoolDave1 for pinpointing
the range of relevant revisions.

git-svn-id: https://svn.eduke32.com/eduke32@3426 1a8010ca-5511-0410-912e-c29ae57300e0
2013-01-23 19:36:44 +00:00
helixhorned
b6ca618694 Lunatic: hook up PIPEBOMB_CONTROL etc. with the player members.
git-svn-id: https://svn.eduke32.com/eduke32@3414 1a8010ca-5511-0410-912e-c29ae57300e0
2013-01-20 21:16:58 +00:00
helixhorned
8fb886b14a Replace dragpoint()'s "dragpoint_noreset" global with a "flags" argument.
Also, add another flag, signifying that from the editor, also the
"lastwall"s (i.e. the CCW-linked points) should get collected. This is
to signal the editor that their wall lengths should be displayed, too.

git-svn-id: https://svn.eduke32.com/eduke32@3394 1a8010ca-5511-0410-912e-c29ae57300e0
2013-01-16 20:38:41 +00:00
helixhorned
37d8cda701 Clean up actors.c and player.c.
git-svn-id: https://svn.eduke32.com/eduke32@3353 1a8010ca-5511-0410-912e-c29ae57300e0
2013-01-01 15:24:14 +00:00
terminx
79e45c23d5 Add predefined REND_CLASSIC, REND_POLYMOST and REND_POLYMER constants and use them everywhere getrendermode() is called.
git-svn-id: https://svn.eduke32.com/eduke32@3346 1a8010ca-5511-0410-912e-c29ae57300e0
2012-12-30 20:34:34 +00:00
helixhorned
80f3e132b0 Replace "if (g_tile[..].execPtr)" -> "if (G_HaveActor(...))".
git-svn-id: https://svn.eduke32.com/eduke32@3344 1a8010ca-5511-0410-912e-c29ae57300e0
2012-12-29 15:21:28 +00:00
hendricks266
11e0897def Fix the gap between loops of ambient MUSICANDSFX sounds like BAR_MUSIC.
git-svn-id: https://svn.eduke32.com/eduke32@3336 1a8010ca-5511-0410-912e-c29ae57300e0
2012-12-29 10:58:09 +00:00
helixhorned
9c328bf0a5 Encapsulate aplWeapon* array accesses in a PWEAPON(Player, Weapon, Wmember) macro.
In the normal game, these arrays are conceptually [MAX_WEAPONS][MAXPLAYERS],
allocated as CON per-player gamevars (e.g. WEAPONx_WORKSLIKE).
For Lunatic, they are replaced with
weapondata_t g_playerWeapon[MAXPLAYERS][MAX_WEAPONS].

git-svn-id: https://svn.eduke32.com/eduke32@3328 1a8010ca-5511-0410-912e-c29ae57300e0
2012-12-28 17:18:16 +00:00
helixhorned
6a4add81bd Fix rotation-fixed useractors (those having usertype bit 4 set).
Rotation-fixing happens for a couple of hard-coded statnums that presumably
never move (DEFAULT, STANDABLE, FX, FALLER, LIGHT), but for actors it wouldn't
make sense since the common case is that they do move. For this reason, bit 4
was introduced in r1934. The position of such useractors will not diverge
due to error roundoff accumulation in rotating sectors (SE0, train).

git-svn-id: https://svn.eduke32.com/eduke32@3316 1a8010ca-5511-0410-912e-c29ae57300e0
2012-12-23 19:24:21 +00:00
helixhorned
48c47af5dc Pack actor_t's bposx/bposy/bposz members into a vec3_t named "bpos".
git-svn-id: https://svn.eduke32.com/eduke32@3314 1a8010ca-5511-0410-912e-c29ae57300e0
2012-12-23 14:00:08 +00:00
terminx
fbdbca2952 Networking patch from Jasper Foreman
git-svn-id: https://svn.eduke32.com/eduke32@3270 1a8010ca-5511-0410-912e-c29ae57300e0
2012-12-12 02:53:13 +00:00
helixhorned
9d2260c3c8 Replace outer apScriptGameEvent[...] checks with G_HaveEvent().
git-svn-id: https://svn.eduke32.com/eduke32@3266 1a8010ca-5511-0410-912e-c29ae57300e0
2012-12-10 18:17:57 +00:00
helixhorned
599d9232f1 Initialize BADGUY sprite flags for hardcoded enemies.
... instead of switch/case-ing them in A_CheckEnemyTile().
Because this requires bumping BYTEVERSION, we also get rid of the
excess trailing bytes in the save game's "rest" data. (See r3052.)

git-svn-id: https://svn.eduke32.com/eduke32@3257 1a8010ca-5511-0410-912e-c29ae57300e0
2012-12-09 13:24:32 +00:00
helixhorned
1009e0f2ec Remove many redundant (int16_t) casts and one now incorrect one.
The redundant ones are in code like this: s->cstat = (int16_t)32768;
Because the value is eventually converted to the type of "s->cstat", any
casts to integral types having at least as many bits are no-ops, signedness
being irrelevant due to (probably any two's complement arch targeting
compiler's) bit-pattern preserving semantics of these conversions.

The now incorrect one is: if (lotag == (int16_t) 65535),
"int32_t lotag" being read from a wall or sprite struct directly earlier.
Now, with these members being unsigned, and (int16_t)65535 equalling -1,
the check always fails.  The correction fixes normal switches having such
a lotag ending the level immediately.

In short: integer casts before assignments are unnecessary, those in reads
highly relevant!

git-svn-id: https://svn.eduke32.com/eduke32@3211 1a8010ca-5511-0410-912e-c29ae57300e0
2012-11-18 19:01:34 +00:00
helixhorned
0153853024 Correct arithmetic comparisons of lo/hitags in actors.c.
Rewriting them in the obvious way, i.e. by casting the expression
to int16_t first.  (That is, this commit is the reverse of r3174,
but with casts applied.)  This fixes at least one regression: a
FIREEXT with a hitag of 0 should not be linked with same-
(that is, zero-) tagged SEENINEs or OOZFILTERs.
Mind the corner cases!

git-svn-id: https://svn.eduke32.com/eduke32@3210 1a8010ca-5511-0410-912e-c29ae57300e0
2012-11-18 19:01:29 +00:00
helixhorned
107fa9cc39 Split r3159..r3161, part 12: Add explicit casts, non-pointer types.
Notes:
 - Atomic Edition (Censored) -> Plutonium Pak in grpscan.c
 - "scale" in astub.c:drawtileinfo() is incorrect, I think.
 - in demo.c, the gethitickms() value should be returned to a double.

git-svn-id: https://svn.eduke32.com/eduke32@3178 1a8010ca-5511-0410-912e-c29ae57300e0
2012-11-15 14:28:41 +00:00
helixhorned
2cb3734f85 Split r3159..r3161, part 8: make some members of base types unsigned.
NOTE: This will need very thorough review.

git-svn-id: https://svn.eduke32.com/eduke32@3174 1a8010ca-5511-0410-912e-c29ae57300e0
2012-11-15 14:28:18 +00:00
helixhorned
1cd11d06ef Revert "Fix the warnings when building with C++, add MSVC C++ build support."
This reverts r3159..r3161.

Conflicts:
	eduke32/build/include/compat.h
(Handled so that r3163's changes are kept applied.)

git-svn-id: https://svn.eduke32.com/eduke32@3165 1a8010ca-5511-0410-912e-c29ae57300e0
2012-11-15 14:27:45 +00:00
terminx
3ff46c02b2 Fix the warnings when building with C++, add MSVC C++ build support. This also changes the internal type of lotags, hitags and cstat type fields to uint16_t instead of int16_t to clean up some dubious behavior wherein the code was using a value of 32768 as a flag in these fields for certain types of things, like invisible sprites (using the value as if it was uint16_t) where it was elsewhere checking if the value was < 0 (using the value as if it was int16_t). This change may break a few specific effects if any part of the relevant code was missed when looking for areas that needed to be addressed.
I think there's also a fix for the CON precache system breakage in here (lost it in my local tree when I started getting the C++ build working in MSVC, sorry!)


git-svn-id: https://svn.eduke32.com/eduke32@3159 1a8010ca-5511-0410-912e-c29ae57300e0
2012-11-14 23:32:43 +00:00
hendricks266
fcf9beae6a Work-in-progress adjustment to the C code to compile under C++. It builds for me without errors using Win32 MinGW-GCC, but it still generates warning soup. No guarantees about MSVC or anything using SDL. Enable C++ by building with CPLUSPLUS=1. C remains the default and should compile with no change in setup.
Credit to Plagman for the idea and doing the work on the game side, which is included in this commit.

(Building as C++ will give us features with which we can make improvements and optimizations on the multiplayer code and Polymer.)

git-svn-id: https://svn.eduke32.com/eduke32@3116 1a8010ca-5511-0410-912e-c29ae57300e0
2012-11-05 02:49:08 +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
a3fe057c0a WIP networking updates from Jasper Foreman
git-svn-id: https://svn.eduke32.com/eduke32@3095 1a8010ca-5511-0410-912e-c29ae57300e0
2012-10-28 22:27:53 +00:00
terminx
067baf626a Comment out the A_GetZLimits() call right before the Bassert() in A_MoveSprite(). This call is a problem because the assertion expects "dasectnum" and spr->sectnum to match, but A_GetZLimits() can itself call A_SetSprite() which results in another call to A_MoveSprite() and can potentially change the sectnum again.
This commit also adds the NOTELEPORT sprite flag, which of course prevents sprites from teleporting.


git-svn-id: https://svn.eduke32.com/eduke32@3094 1a8010ca-5511-0410-912e-c29ae57300e0
2012-10-24 13:21:02 +00:00
Plagman
e726484ccc polymer: add support for negative lights
And hook them up to cstat 128 (half-submerged, 'c' in mapster).

git-svn-id: https://svn.eduke32.com/eduke32@3092 1a8010ca-5511-0410-912e-c29ae57300e0
2012-10-21 04:52:43 +00:00
Plagman
9d10b0b087 polymer: add a prlight flag to make shadow-less spotlights
And hook it up to SE cstat 64 ('1' in mapster32). This disables both lightmaps
and shadow maps for the spotlight; please let me know if you have a usecase
where you want lightmaps but no shadow maps for specific lights.

git-svn-id: https://svn.eduke32.com/eduke32@3091 1a8010ca-5511-0410-912e-c29ae57300e0
2012-10-21 03:41:13 +00:00
helixhorned
ce948c6ee4 Factor out 2x identical code into G_WeaponHitCeilingOrFloor().
git-svn-id: https://svn.eduke32.com/eduke32@3077 1a8010ca-5511-0410-912e-c29ae57300e0
2012-10-14 20:41:30 +00:00
helixhorned
b03c95443b Clean up G_MoveWeapons(), among other things getting rid of weird indentation.
git-svn-id: https://svn.eduke32.com/eduke32@3076 1a8010ca-5511-0410-912e-c29ae57300e0
2012-10-14 20:41:28 +00:00