Commit Graph

259 Commits

Author SHA1 Message Date
helixhorned 54721d7461 Make ksqrt take uint32_t, add helper function uint32_t uhypsq(int32_t,int32_t).
uhypsq calculates the hypotenuse using unsigned multiplication. This is
permissible since for arbitrary int32s a and b, the following holds in
two's complement arithmetic:
  (int32_t)((uint32_t)a * b) == (int32_t)((int64_t)a * b)
("Signed and unsigned multiplication is the same on the bit level.")

This fixes various overflows where wall lengths for walls of length > 46340
are calculated, but does not rid us of other overflows in the same vein
(usually dot products between vectors where one point is a wall vertex and
the other a position in a sector).

git-svn-id: https://svn.eduke32.com/eduke32@2791 1a8010ca-5511-0410-912e-c29ae57300e0
2012-07-01 22:11:14 +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
hendricks266 67ed6945fd The handling for grp, con, and def filenames has been massively cleaned up and factored into common.c. A new header, common_game.h, was created because common.h was placed in build/include (see r2542) and we need a common header for things that strictly should not be in the engine. RTS file names were also improved but some of the patterned changes were already made in r2420, and they were not factored because they are strictly part of the game, not the editor.
NAM and Napalm can now share their con, def, and rts files if the one for their respective game is not present because the con and rts files are identical.

Also, decapitalize two string literals missed in r2540.

git-svn-id: https://svn.eduke32.com/eduke32@2726 1a8010ca-5511-0410-912e-c29ae57300e0
2012-06-03 16:09:33 +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 282036a048 Fix EVENT_CHECKTOUCHDAMAGE (the change to how events handle RETURN broke it)
git-svn-id: https://svn.eduke32.com/eduke32@2660 1a8010ca-5511-0410-912e-c29ae57300e0
2012-05-17 20:47:56 +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 245c8c1fef Another one line DynamicTileMap[x] -> DYNAMICTILEMAP(x) change from Helix that got obliterated during svn change merging. Fixing this changes nothing in builds with DYNTILEREMAP_ENABLE defined, so this change isn't meaningful to anyone who isn't recompiling the game to work on a low memory device or something of that nature.
git-svn-id: https://svn.eduke32.com/eduke32@2654 1a8010ca-5511-0410-912e-c29ae57300e0
2012-05-15 14:12:24 +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 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 84e5fcdad8 Accumulated trivia, mostly "the usual".
Among other things, comment out very seldomly (or not at all)
used sprite member macros: SV, ZV, RX, RY, CX, CY, CD, PL.

git-svn-id: https://svn.eduke32.com/eduke32@2639 1a8010ca-5511-0410-912e-c29ae57300e0
2012-05-05 22:23: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
helixhorned cd3947f3f4 Correct 'nofloorpalrange' range clamping, move one get_hud_pal() farther down.
The nofloorpalrange beginning and end indices are silently clamped to 1 .. 255.

git-svn-id: https://svn.eduke32.com/eduke32@2524 1a8010ca-5511-0410-912e-c29ae57300e0
2012-03-24 15:59:39 +00:00
helixhorned b5894eb7e0 Make 'nofloorpalrange' def token affect HUD weapons.
git-svn-id: https://svn.eduke32.com/eduke32@2518 1a8010ca-5511-0410-912e-c29ae57300e0
2012-03-22 22:47:47 +00:00
helixhorned 46246b8ab7 Comment out computergetinput() and children, which are unused since ng netcode.
git-svn-id: https://svn.eduke32.com/eduke32@2512 1a8010ca-5511-0410-912e-c29ae57300e0
2012-03-22 22:46:07 +00:00
helixhorned 9628041766 Assorted trivia.
Make some computer Duke opponent variables in player.c static.

git-svn-id: https://svn.eduke32.com/eduke32@2501 1a8010ca-5511-0410-912e-c29ae57300e0
2012-03-18 23:18:12 +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 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 f89d73504d Draw HANDHOLDINGLASER and ~ACCESS with guniqhud=200 and 201, respectively.
This fixes updateanimation picking up foreign (and thus potentially oob)
frame numbers at "3: c > n".

git-svn-id: https://svn.eduke32.com/eduke32@2339 1a8010ca-5511-0410-912e-c29ae57300e0
2012-02-13 21:38:00 +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 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 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 ca2d612976 Fix oob accesses when e.g. shooting tile -1. (can propagate via WEAPONx_SHOOTS)
Ideally, we would also warn when setting WEAPONx_SHOOTS to negative values, but
we'd have to intercept CON's setvar's and it wouldn't be pretty.

git-svn-id: https://svn.eduke32.com/eduke32@2268 1a8010ca-5511-0410-912e-c29ae57300e0
2012-01-19 21:58:23 +00:00
helixhorned 46ed3313e7 Don't spawn weapon tiles (WEAPONx_SPAWN) if any such value has been set
to negative numbers.  Previously, only checks for being zero were performed,
but CON code in the wild also has WEAPONx_SPAWN -1, which would propagate to
the sprite picnum...

git-svn-id: https://svn.eduke32.com/eduke32@2180 1a8010ca-5511-0410-912e-c29ae57300e0
2011-12-15 22:42:25 +00:00
helixhorned cd6e846fac Fix potential out-of-bounds array access in P_DisplayTip (happened with
WGR2 SVN, so not sure where there's a tipping animation there).

git-svn-id: https://svn.eduke32.com/eduke32@2171 1a8010ca-5511-0410-912e-c29ae57300e0
2011-12-09 19:12:01 +00:00
helixhorned 99ce725b60 Much more elegant solution to updating the player's sectnum when passing through
TROR portals that works with a little help from updatesectorz() (change not visible
from CON code). Relies only on the presence of an extension whose portal isn't
blocked and also plays nicely with corner cases like being shrunk and enabling
the jetpack. This should fix the upward moving platforms in WGR2.

git-svn-id: https://svn.eduke32.com/eduke32@1996 1a8010ca-5511-0410-912e-c29ae57300e0
2011-09-01 18:38:13 +00:00
helixhorned 6e7a13448d fix sector updating between TROR bunches, leading to 'being stuck' glitches. Difference: one character.
git-svn-id: https://svn.eduke32.com/eduke32@1966 1a8010ca-5511-0410-912e-c29ae57300e0
2011-08-15 15:46:42 +00:00
helixhorned a3443cd1dd * fix screen warping with r_usenewaspect: now you have a larger FOV when being shrunk
* fix 'squishing' when taking off shrunk (the reason was TROR game code using updatesectorz) and a potential sector[-1] access

git-svn-id: https://svn.eduke32.com/eduke32@1960 1a8010ca-5511-0410-912e-c29ae57300e0
2011-08-10 11:47:23 +00:00
hendricks266 4aba6785b4 fix shrinker/expander glowing bug
git-svn-id: https://svn.eduke32.com/eduke32@1946 1a8010ca-5511-0410-912e-c29ae57300e0
2011-07-28 21:09:24 +00:00
helixhorned 95a33b72bd editor: tweak RShift so that unnecessary gray walls aren't selected; fix ugly bug with TROR joining
game: when entering/leaving water or slime, delay changing palette by one game tic to make it look right


git-svn-id: https://svn.eduke32.com/eduke32@1899 1a8010ca-5511-0410-912e-c29ae57300e0
2011-05-29 12:30:38 +00:00
helixhorned e92099b2f7 Polymost:
* rudimentary TROR support
 * free mixing of multi- and single-tile pskies
 * Don't cull models behind you. That is, treat them like floor sprites in that respect. This way large models like corpses don't disappear from the view unexpectedly.

Classic:
 * tweak the last row and column of the translucency table so that e.g. a transparent sprite against a FANSPRITE wall doesn't show up purple (only if Duke3D table is found)

Misc.:
 * fixes TROR-nextwall corruption when deleting sectors
 * tile selector 'goto' now has also completion
 * I forgot a file for the non-OpenGL build last time


git-svn-id: https://svn.eduke32.com/eduke32@1892 1a8010ca-5511-0410-912e-c29ae57300e0
2011-05-22 21:52:22 +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 9c3889e59b Fix more overheadmap crashes, this time with 'Last Pissed Time'. Mapster32 now asks to jump to a sector, wall, sprite, or coordinates with 'J. Also fix crash when pressing '-' (not KP-) when aiming at something with tile 0.
git-svn-id: https://svn.eduke32.com/eduke32@1874 1a8010ca-5511-0410-912e-c29ae57300e0
2011-04-28 21:28:33 +00:00
terminx ef39c49049 Fuck, oops
git-svn-id: https://svn.eduke32.com/eduke32@1858 1a8010ca-5511-0410-912e-c29ae57300e0
2011-04-07 17:36:11 +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 1a8f02a07b a couple of multiplayer fixes
git-svn-id: https://svn.eduke32.com/eduke32@1826 1a8010ca-5511-0410-912e-c29ae57300e0
2011-03-05 01:41:38 +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
plagman 4a2fd12f4b Manage base palette as IDs instead of passing pointers around ($10 says I broke something). Corresponding engine change will be coming up; this is in prevision of highpal handling of game palettes.
git-svn-id: https://svn.eduke32.com/eduke32@1772 1a8010ca-5511-0410-912e-c29ae57300e0
2011-01-17 03:49:34 +00:00
terminx a2d2f0ed75 Fix some crashes with weapon sounds inappropriately set to -1 in the cons
git-svn-id: https://svn.eduke32.com/eduke32@1690 1a8010ca-5511-0410-912e-c29ae57300e0
2010-08-08 00:06:26 +00:00
terminx 219b3204dd Fix bugs for DarkDefender
git-svn-id: https://svn.eduke32.com/eduke32@1684 1a8010ca-5511-0410-912e-c29ae57300e0
2010-08-07 22:38:15 +00:00
terminx c825727234 Damnit
git-svn-id: https://svn.eduke32.com/eduke32@1678 1a8010ca-5511-0410-912e-c29ae57300e0
2010-08-02 08:19:28 +00:00
terminx a7eb0418d1 Global thermonuclear code rape
git-svn-id: https://svn.eduke32.com/eduke32@1677 1a8010ca-5511-0410-912e-c29ae57300e0
2010-08-02 08:13:51 +00:00
terminx 1102b74a35 mostly multiplayer fixes among other things
git-svn-id: https://svn.eduke32.com/eduke32@1672 1a8010ca-5511-0410-912e-c29ae57300e0
2010-07-19 15:14:00 +00:00
terminx 013ac85e2d Emit RPG_EXPLODE, PIPEBOMB_EXPODE and LASERTRIP_EXPLODE from the actual EXPLOSION2 sprite instead of whatever spawned EXPLOSION2, to prevent the sound from being owned by whatever sprite happens to spawn with the ID the RPG/pipebomb/whatever had before it was removed
Add brightness/gamma/contrast cvars to Mapster32

Fix bug with WEAPON_SEMIAUTO flag for custom weapons

Fix VM error with starttrack when specifying an invalid music track

Fix detection of 0x1a EOF characters in CON files

Fix a couple of additional sound issues

Fix crash in pushmove()

Fix Mapster32 textured 2D mode display being a few pixels off from the actual lines drawn

Fix crash when clicking "cancel" in Mapster32 startup window

Add Makefile detection to build with -march=pentium3 -mtune=generic on i686


git-svn-id: https://svn.eduke32.com/eduke32@1665 1a8010ca-5511-0410-912e-c29ae57300e0
2010-07-03 08:53:57 +00:00
terminx 9143833fc8 rotatesprite and multivoc have a rape baby
No, seriously.  Adds widescreen aware rotatesprite and works out half a dozen huge problems in the sound system, among other things.


git-svn-id: https://svn.eduke32.com/eduke32@1658 1a8010ca-5511-0410-912e-c29ae57300e0
2010-06-22 21:50:01 +00:00
terminx 4c3c64286a shading changes and fixes for a few crashes
git-svn-id: https://svn.eduke32.com/eduke32@1657 1a8010ca-5511-0410-912e-c29ae57300e0
2010-06-07 09:03:16 +00:00
terminx ac7767986a Updated synthesis script, moved some non-essential files around, updated license headers on all non-BUILDLIC files, added memory cache on top of texcache to improve load times, moved some duplicated keyboard handling stuff from winlayer/sdlayer to baselayer, fixed keypad / in Mapster32 tile selector, fixed bug where p->rotscrnang and p->look_ang never reset to 0, added support for reloading maphack based polymer lights after mode changes/savegame loads, other minor changes
git-svn-id: https://svn.eduke32.com/eduke32@1652 1a8010ca-5511-0410-912e-c29ae57300e0
2010-05-25 10:56:00 +00:00
terminx ddf83fbbf1 fix shrunk player speed
git-svn-id: https://svn.eduke32.com/eduke32@1639 1a8010ca-5511-0410-912e-c29ae57300e0
2010-05-14 12:40:24 +00:00