Commit Graph

355 Commits

Author SHA1 Message Date
helixhorned 67c1157b64 Guard a sprite/actor access with sector[].hitag as index from OOB.
Unlikely but possible for rogue CON code.

git-svn-id: https://svn.eduke32.com/eduke32@4185 1a8010ca-5511-0410-912e-c29ae57300e0
2013-12-01 18:27:52 +00:00
helixhorned 8ab35ec520 Don't assign result of A_PlaySound() to p->scream_voice if the former is >127.
Because p->scream_voice is an int8_t.
This is an unlikely situation (126 voices ought to be playing simultaneously
while starting the "scream" sound), but still...

git-svn-id: https://svn.eduke32.com/eduke32@4180 1a8010ca-5511-0410-912e-c29ae57300e0
2013-11-28 21:18:04 +00:00
helixhorned 863aae3fb1 Game: make underwater blocking floor sprites w/ xvel 1 NOT act like sprite bridge.
Likewise for blocking wall sprites. This makes it possible to construct
underwater sections containing complex spritework without losing the
"underwater-ness" when over such sprites, in a backward-compatible way.
Actually, the check is for bit 1 being set, but all other bits should be
considered reserved.

git-svn-id: https://svn.eduke32.com/eduke32@4166 1a8010ca-5511-0410-912e-c29ae57300e0
2013-11-16 18:47:21 +00:00
helixhorned 4cb24de24e In exprs like "Bmemcpy(&p->pos.x, &sprite[i].x, sizeof(vec3_t))", drop the ".x".
git-svn-id: https://svn.eduke32.com/eduke32@4132 1a8010ca-5511-0410-912e-c29ae57300e0
2013-11-04 18:21:07 +00:00
terminx e83927c2f8 Refactor projectiles a bit. Tested with all of the original weapons and with the weapons in the Duke 64 mod.
git-svn-id: https://svn.eduke32.com/eduke32@3992 1a8010ca-5511-0410-912e-c29ae57300e0
2013-08-06 23:53:34 +00:00
terminx c41efa2a09 Bring GROWSPARK a bit more in line with the other hard-coded hitscan projectiles, and give it the same sort of accuracy adjustment as the pistol gets when autoaim is disabled.
git-svn-id: https://svn.eduke32.com/eduke32@3989 1a8010ca-5511-0410-912e-c29ae57300e0
2013-08-06 23:53:00 +00:00
terminx c34410b7ed Fix up a couple of functions to adhere better to unwritten code formatting standards. Should be zero functional changes in terms of what the functions actually do.
git-svn-id: https://svn.eduke32.com/eduke32@3983 1a8010ca-5511-0410-912e-c29ae57300e0
2013-08-06 23:51:51 +00:00
helixhorned 4f88aaf4d2 Retire global 'lastvisinc'.
It was only ever used as upper bound to the time that a visibility change
decays, but since it does that in an exponential fashion, there's really
no point.

git-svn-id: https://svn.eduke32.com/eduke32@3961 1a8010ca-5511-0410-912e-c29ae57300e0
2013-07-18 18:08:13 +00:00
helixhorned d63939d820 Clean up some player.c code.
git-svn-id: https://svn.eduke32.com/eduke32@3955 1a8010ca-5511-0410-912e-c29ae57300e0
2013-07-13 21:05:01 +00:00
helixhorned 1e26e640e4 Lunatic: swap first and second arg of con.spawn().
git-svn-id: https://svn.eduke32.com/eduke32@3939 1a8010ca-5511-0410-912e-c29ae57300e0
2013-07-09 18:23:41 +00:00
helixhorned 73b5d064da Retire actor[].shootzvel, as it was only ever used in local scope.
That is, its value was only referenced during the duration of a function call
that had previously set it. It was also never accessible from CON.

git-svn-id: https://svn.eduke32.com/eduke32@3921 1a8010ca-5511-0410-912e-c29ae57300e0
2013-06-30 20:38:50 +00:00
helixhorned e164bd7f1e Actor-related code cleanup part 2: give actor t_data[] indexes names.
Using macros like AC_COUNT(t). Clean up related code:
 - comment out the dead condition noted in the previous commit
 - Lunatic: use get_count() instead of get_t_data(0) in one place,
   rename to _get_t_data(), i.e. make that method internal

git-svn-id: https://svn.eduke32.com/eduke32@3920 1a8010ca-5511-0410-912e-c29ae57300e0
2013-06-30 20:38:48 +00:00
terminx e9a773a588 Add a few defined constants for commonly used weapon_pos values
git-svn-id: https://svn.eduke32.com/eduke32@3903 1a8010ca-5511-0410-912e-c29ae57300e0
2013-06-27 23:04:57 +00:00
terminx 214baa9475 Rename getinput() to P_GetInput(), add bounds checking for a few arrays used for weapon drawing that use kickback_pic as an index.
git-svn-id: https://svn.eduke32.com/eduke32@3902 1a8010ca-5511-0410-912e-c29ae57300e0
2013-06-27 23:04:39 +00:00
terminx 6516a29778 Make P_PalFrom() static inline in player.h as the whole function is just 4 assignments
git-svn-id: https://svn.eduke32.com/eduke32@3901 1a8010ca-5511-0410-912e-c29ae57300e0
2013-06-27 23:04:24 +00:00
helixhorned 5db04f585e Lunatic: player method fadecol(), an improved palfrom.
Also, an external 'minitext' with optional shade and pal. args and
documentation for ps:padecol().

git-svn-id: https://svn.eduke32.com/eduke32@3893 1a8010ca-5511-0410-912e-c29ae57300e0
2013-06-20 18:31:50 +00:00
helixhorned d56e5451d9 Fix one more 1<<31 calculation, remove one unneeded cast.
git-svn-id: https://svn.eduke32.com/eduke32@3724 1a8010ca-5511-0410-912e-c29ae57300e0
2013-05-04 16:36:08 +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 08b10ca03c Draw the flat on-screen CHAINGUN in a way inspired by 3688, preventing seam.
Specifically, in GL modes, and if the CHAINGUN is not replaced by a model,
 - draw the upper part twice: first, two screen pixels * weapon scale lower,
   then at the original position
 - reverse the previous order: draw the upper part first, then the lower part

This is much preferable to the previous engine-side hack, and to my eye,
it looks perfect now.

git-svn-id: https://svn.eduke32.com/eduke32@3695 1a8010ca-5511-0410-912e-c29ae57300e0
2013-04-21 19:55:11 +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
terminx 3c5c8b44dc Mask the seam that shows up when drawing the scuba HUD overlay in OpenGL by drawing SCUBAMASK 3 times... once at the left position + 1, and then at the proper left and right positions. It's definitely a hack, but at least it lives on the game side of things.
git-svn-id: https://svn.eduke32.com/eduke32@3688 1a8010ca-5511-0410-912e-c29ae57300e0
2013-04-16 22:37:31 +00:00
helixhorned 6be448c534 Fix SPRITES_OF_SECT_SAFE macro. Oops!
git-svn-id: https://svn.eduke32.com/eduke32@3685 1a8010ca-5511-0410-912e-c29ae57300e0
2013-04-15 18:50:21 +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
hendricks266 e2ab98261f Fix a signed/unsigned comparison.
git-svn-id: https://svn.eduke32.com/eduke32@3673 1a8010ca-5511-0410-912e-c29ae57300e0
2013-04-13 03:51:17 +00:00
helixhorned bbdc035335 Lunatic: replace DukePlayer_t set-member methods with metatable magic.
So that members needing it are checked when they're assigned to using the
usual syntax. What kind of check to perform (sector, player, ... x whether
negative values are allowed) is written in a declarative fashion inside the
C declaration.

Also, make Lunatic's MAXQUOTES be C's OBITQUOTEINDEX and bound-check an
access of sprite[p->wackedbyplayer] in the C code.

git-svn-id: https://svn.eduke32.com/eduke32@3653 1a8010ca-5511-0410-912e-c29ae57300e0
2013-04-07 15:20:41 +00:00
helixhorned fb41d91a50 Lunatic: get rid of some now unneeded set-member methods, add others.
git-svn-id: https://svn.eduke32.com/eduke32@3652 1a8010ca-5511-0410-912e-c29ae57300e0
2013-04-07 15:20:37 +00:00
helixhorned cbfd2eb438 In 'tip' display code, extrapolate four more values of the y coord table.
Also, for tip_incs values greater or equal than the number of elements in
this table, return early reporting that the hand has been drawn, so that
the otherwise selected weapon is not drawn.

git-svn-id: https://svn.eduke32.com/eduke32@3630 1a8010ca-5511-0410-912e-c29ae57300e0
2013-03-31 18:58:09 +00:00
terminx cd235d2ec2 Don't continue animating Ripper, Shrinker, Expander and Freezethrower when the game is paused or the menu is up.
git-svn-id: https://svn.eduke32.com/eduke32@3616 1a8010ca-5511-0410-912e-c29ae57300e0
2013-03-27 06:37:19 +00:00
terminx f96788866c Fix shrunk player fist animation speed as requested on the forums. I didn't test this against the DOS version but it seems about right according to my memory. Let me know if it's still wrong and you care that much about it.
git-svn-id: https://svn.eduke32.com/eduke32@3614 1a8010ca-5511-0410-912e-c29ae57300e0
2013-03-27 01:38:42 +00:00
hendricks266 72156dd4c1 Prevent the middle chaingun muzzleflash from animating its position when the player is frozen.
The unmodified behavior is completely wrong and I don't see how any mod could ever use it.

git-svn-id: https://svn.eduke32.com/eduke32@3578 1a8010ca-5511-0410-912e-c29ae57300e0
2013-03-19 06:22:52 +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 c66b891a38 Lunatic: export C functions that may call into CON events using the Lua C API.
We must not call these functions using the FFI, since the Lua state is
considered locked across such calls.

git-svn-id: https://svn.eduke32.com/eduke32@3520 1a8010ca-5511-0410-912e-c29ae57300e0
2013-02-24 16:05:47 +00:00
helixhorned 2d61216758 Lunatic translator: sprite list commands, findnear*, protect player[].ftq.
git-svn-id: https://svn.eduke32.com/eduke32@3498 1a8010ca-5511-0410-912e-c29ae57300e0
2013-02-18 16:07:32 +00:00
helixhorned 7c861cac42 Rework how the z velocity is passed from *zshoot to A_Shoot().
Previously, actor[].shootzvel (implementation detail, not available to CON)
was checked, and if it was !=0, that was the overridden velocity. The value
0 meant "hardcoded, projectile-dependent velocity". But that neccesiated a
hack where if zvel 0 was passed and really meant, it needed to be set to
1 instead.  Now we have A_ShootWithZvel() taking an additional last argument
plus a macro SHOOT_HARDCODED_ZVEL permissible for that argument.

git-svn-id: https://svn.eduke32.com/eduke32@3465 1a8010ca-5511-0410-912e-c29ae57300e0
2013-02-07 21:01:12 +00:00
helixhorned 24e6aca5f7 player.c: factor out more identical code into Proj_DoHitscan().
Also, simplify a couple of other lines.

git-svn-id: https://svn.eduke32.com/eduke32@3464 1a8010ca-5511-0410-912e-c29ae57300e0
2013-02-07 21:01:06 +00:00
helixhorned 9bf6115d1f player.c: factor out a repeated 3-liner into safeldist(), remove some commented code.
git-svn-id: https://svn.eduke32.com/eduke32@3462 1a8010ca-5511-0410-912e-c29ae57300e0
2013-02-07 21:00:58 +00:00
helixhorned b5aa49953e player.c: remove a couple of unnecessary casts.
git-svn-id: https://svn.eduke32.com/eduke32@3457 1a8010ca-5511-0410-912e-c29ae57300e0
2013-02-03 12:48:20 +00:00
helixhorned 77ecaa900a Fix all hitscan weapons (not only pistol) wrongly fire without spread at enemies.
Introduced in r3358, where I missed a condition inside an 'if'.

git-svn-id: https://svn.eduke32.com/eduke32@3453 1a8010ca-5511-0410-912e-c29ae57300e0
2013-02-01 19:56:26 +00:00
terminx 9bd041cb9d Fix knuckle cracking animation broken in r3436
git-svn-id: https://svn.eduke32.com/eduke32@3440 1a8010ca-5511-0410-912e-c29ae57300e0
2013-01-27 17:06:41 +00:00
helixhorned 9d7d58d678 player.c: return early from various P_Display*() if player's *incs are oob.
git-svn-id: https://svn.eduke32.com/eduke32@3436 1a8010ca-5511-0410-912e-c29ae57300e0
2013-01-26 17:07:48 +00:00
helixhorned 671bd67aa8 player.c: make four functions file-local.
git-svn-id: https://svn.eduke32.com/eduke32@3418 1a8010ca-5511-0410-912e-c29ae57300e0
2013-01-20 21:17:19 +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 cd1f3739d9 player.c: factor out repeated code into P_SetWeaponGamevars().
git-svn-id: https://svn.eduke32.com/eduke32@3413 1a8010ca-5511-0410-912e-c29ae57300e0
2013-01-20 21:16:54 +00:00
helixhorned fb1db25c4e Consolidate badly named HUD weapon globals ("g_looking_angSR1") into struct.
git-svn-id: https://svn.eduke32.com/eduke32@3408 1a8010ca-5511-0410-912e-c29ae57300e0
2013-01-19 18:28:48 +00:00
helixhorned c9190e79ae Wrap some ud.camera* and g_camera{Distance,Clock} into CAMERA* macros.
In Lunatic, make it a struct type "camera_t" instead.

git-svn-id: https://svn.eduke32.com/eduke32@3405 1a8010ca-5511-0410-912e-c29ae57300e0
2013-01-19 18:28:32 +00:00
helixhorned 0c44056945 Lunatic: getting closer to the first milestone.
On the C side, zrange, angrange and autoaimang are represented as
DukePlayer_t members then.

git-svn-id: https://svn.eduke32.com/eduke32@3366 1a8010ca-5511-0410-912e-c29ae57300e0
2013-01-02 22:33:37 +00:00
helixhorned 2528fd3bf5 player.c: factoring continued.
New local functions:
Proj_DoRandDecalSize, SectorContainsSE13, HandleHitWall, Proj_CheckBlood,
Proj_HandleKnee.

git-svn-id: https://svn.eduke32.com/eduke32@3362 1a8010ca-5511-0410-912e-c29ae57300e0
2013-01-01 15:24:42 +00:00
helixhorned 10feaeb5b4 player.c: cleanup. "ProjectileData[atwith]." --> "proj->", ...
The diff may look daunting, but it's clear what is changed with
git diff (...) --color-words='[a-zA-Z0-9_]+|[^[:space:]]' -b

git-svn-id: https://svn.eduke32.com/eduke32@3361 1a8010ca-5511-0410-912e-c29ae57300e0
2013-01-01 15:24:39 +00:00
helixhorned 552708103f player.c: finish hitscan projectile handling cleanup.
Factoring out 2x almost duplicated code into {P,A}_PostFireHitscan().

git-svn-id: https://svn.eduke32.com/eduke32@3360 1a8010ca-5511-0410-912e-c29ae57300e0
2013-01-01 15:24:36 +00:00
helixhorned f65f547fef player.c: hitscan projectile handling cleanup continued.
git-svn-id: https://svn.eduke32.com/eduke32@3359 1a8010ca-5511-0410-912e-c29ae57300e0
2013-01-01 15:24:33 +00:00