This fixes the out-of-bounds read of former g_player[] in VM_EventCommon_().
git-svn-id: https://svn.eduke32.com/eduke32@4961 1a8010ca-5511-0410-912e-c29ae57300e0
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
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
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
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
- add LuaJIT's 'v' module printing trace info
- translator: fix game function name definitions
- revert math.fmod -> math.modf, they are different!
- disable JIT compilation for a function we're getting strange crashes with
- Make some of DukePlayer_t's members 'bool' on the Lua side. It's way
too easy to write something like "ps.jetpack_on" where "ps.jetpack_on~=0"
was meant. [Background: Kyle873 observed that Duke was always floating.]
- Error out if looping in our_module(). I find this behavior more logical
than returning true.
- fix a couple of missed FORBID variables
git-svn-id: https://svn.eduke32.com/eduke32@3530 1a8010ca-5511-0410-912e-c29ae57300e0
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
actors.h: remove 'packed' from projectile_t, tiledata_t. In tiledata_t,
make .cacherange member an int32_t so that the following member
"projectile_t defproj" is aligned on a 4-byte boundary.
player.h: remove 'packed' from playerspawn_t, DukeStatus_t, input_t.
In Lunatic, correct packing attribute of the base type of the unrestricted
actor_t and DukePlayer_t pointer types (the declaration was used without
Bump BYTEVERSION.
git-svn-id: https://svn.eduke32.com/eduke32@3458 1a8010ca-5511-0410-912e-c29ae57300e0
Most of them are already aligned to their natural boundaries, so lowering
the alignment to 1 byte can only worsen things by making the C compiler
generate poorer (unaligned access) code for some platforms.
The layout of structures is not specified by the C Standard, but is rather
given by a particular platform + toolchain's ABI (application binary interface).
Most ABIs follow the expected pattern "alignment of scalars is their size,
alignment of arrays is that of its element type, alignment of structs is the
maximum alignment of its members". A couple of links to particular ABIs are
given in build.h.
Problems are expected with archs that care about unaligned access when a pointer
to a non-packed struct is taken that resides in a packed aggregate, but these
uses should be weeded out (I'm not sure if there are any in our codebase).
The following types are affected, only hitdata_t changes its size:
sectortype, walltype, spritetype, spriteext_t, spritesmooth_t,
struct validmode_t, picanm_t, palette_t, vec2_t, vec3_t, hitdata_t.
git-svn-id: https://svn.eduke32.com/eduke32@3455 1a8010ca-5511-0410-912e-c29ae57300e0
- more predefined vars
- fix recursive states and ones with a stray "else" before the end
git-svn-id: https://svn.eduke32.com/eduke32@3409 1a8010ca-5511-0410-912e-c29ae57300e0
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
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
- more codegen
- make more members const, some char unsigned
- fix some "geom" metamethods
- '^' operator
git-svn-id: https://svn.eduke32.com/eduke32@3253 1a8010ca-5511-0410-912e-c29ae57300e0
It's still not pretty though since there's no interpolation from G_DrawRooms().
git-svn-id: https://svn.eduke32.com/eduke32@3149 1a8010ca-5511-0410-912e-c29ae57300e0
These control the maximum difference in height between two sectors that the player will automatically traverse without needing to jump.
The latter controls the special case when the player's sector's lotag is ST_1_ABOVE_WATER or p->spritebridge == 1.
BYTEVERSION bumped.
git-svn-id: https://svn.eduke32.com/eduke32@3100 1a8010ca-5511-0410-912e-c29ae57300e0
Classic HUD now has correct aspect in widescreen modes, so with the full status
bar, there may be patches of free room left to the left and right.
git-svn-id: https://svn.eduke32.com/eduke32@2914 1a8010ca-5511-0410-912e-c29ae57300e0
Also, change type of g_numPlayerSprites (global and mapstate) from inconsistent
uint8_t/char to int8_t.
git-svn-id: https://svn.eduke32.com/eduke32@2897 1a8010ca-5511-0410-912e-c29ae57300e0
This was narrowed to int8_t in r1625, breaking CON code that wanted
to lock the player for a longer time than 127 game tics.
git-svn-id: https://svn.eduke32.com/eduke32@2847 1a8010ca-5511-0410-912e-c29ae57300e0
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