It is unacceptable that yvel is on one hand modifiable without restriction from
scripting, but can be used as an array index without prior bound check in the C
code. Because that member has an overloaded meaning and is also used for
innocuous purposes such as the green color intensity of an SE light, it's
infeasible to restrict access from scripting. Consequently, we must add bound
checks on the C side. This is the first part of the effort to make .yvel safe,
adding two functions P_Get() and P_GetP(). There are a couple of other uses as
some kind of index.
git-svn-id: https://svn.eduke32.com/eduke32@4226 1a8010ca-5511-0410-912e-c29ae57300e0
- in the function itself: for floor, currently, do nothing (but this commit
is in preparation of the next one, again)
- In Proj_MaybeDamageCF(), Proj_MaybeDamageCF2() and the A_RadiusDamage() use
if the function, generalize to floors, but with the special case that
parallaxed floors keep blocking projectiles, as before (in constrast to
parallaxed ceilings). However, Sect_DamageCeilingOrFloor() is only
called for non-parallaxed ceilings *and* floors.
git-svn-id: https://svn.eduke32.com/eduke32@4205 1a8010ca-5511-0410-912e-c29ae57300e0
- factor out: G_WallSpriteDist()
- factor out: Proj_MaybeDamageCF() and Proj_MaybeDamageCF2()
in preparation for the next commit
- Make PROJ_DECAYVELOCITY macro take an arg for readability's sake
git-svn-id: https://svn.eduke32.com/eduke32@4204 1a8010ca-5511-0410-912e-c29ae57300e0
- Move ARRAY_SIZE() macro to compat.h, add another one ARRAY_SSIZE()
- In A_RadiusDamage(): note maybe-unaligned access issue, prevent unlikely oob
- sector.c: use SPRITES_OF* macros where appropriate
git-svn-id: https://svn.eduke32.com/eduke32@4199 1a8010ca-5511-0410-912e-c29ae57300e0
Smoothed using an exponential moving average... with a time constant of 1 sec
if I didn't miscalculate things. Also, split BYTEVERSION_JF into Lunatic and
non-Lua.
git-svn-id: https://svn.eduke32.com/eduke32@3947 1a8010ca-5511-0410-912e-c29ae57300e0
Also, in some movement functions, replace e.g. (vel*TICSPERFRAME)>>2 with vel.
git-svn-id: https://svn.eduke32.com/eduke32@3925 1a8010ca-5511-0410-912e-c29ae57300e0
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
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
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
- 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
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
- 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
- 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
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
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
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
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
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
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
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
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
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
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