Commit Graph

22 Commits

Author SHA1 Message Date
helixhorned efdd31d5a9 Guard retrieval of player index (.yvel) from APLAYER sprite.
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
2013-12-28 17:04:27 +00:00
helixhorned 0c69779b98 Scripting: Add EVENT_DAMAGEHPLANE and document it in Lunatic doc Appendix B.
Also add test/damagehplane.lua with these demonstrations:
 - custom breakable ceilings
 - breakable TROR glass

git-svn-id: https://svn.eduke32.com/eduke32@4206 1a8010ca-5511-0410-912e-c29ae57300e0
2013-12-20 18:31:33 +00:00
helixhorned 7f2175fcec Lunatic: retire per-sprite tsprite access for per-tile animation callback reg.
Don't yet make this official API though, since there are unresolved issues
with newly created tsprites potentially being fed back to the animation loop.
Add xmath.angvec(), xmath.bangvec(), tspr:set_sectnum(), tspr:setpos().

git-svn-id: https://svn.eduke32.com/eduke32@3937 1a8010ca-5511-0410-912e-c29ae57300e0
2013-07-07 20:59:10 +00:00
helixhorned d1b1fe52d8 Make G_{Save,Restore}MapState() take no input arguments.
Instead, MapInfo[ud.volume_number*MAXLEVELS+ud.level_number] is accessed
inside these functions.

git-svn-id: https://svn.eduke32.com/eduke32@3792 1a8010ca-5511-0410-912e-c29ae57300e0
2013-05-19 19:29:26 +00:00
helixhorned 4a6fc2b94f Remove redundant checks for some map state function uses.
Also, prettify G_FreeMapState(), remove some duplicate function decls and
resurrect 'savestate' and 'restorestate' OSD commands for the debug build.

git-svn-id: https://svn.eduke32.com/eduke32@3791 1a8010ca-5511-0410-912e-c29ae57300e0
2013-05-19 19:29:23 +00:00
helixhorned 6682313e87 gameexec.c: factor out 2x used code into VM_KillIt.
Also, for Lunatic, handle killit from events.

git-svn-id: https://svn.eduke32.com/eduke32@3514 1a8010ca-5511-0410-912e-c29ae57300e0
2013-02-21 18:54:07 +00:00
helixhorned 46fc753f6a gameexec: for VM_Fall and VM_ResetPlayer, pass VM sprite/player etc. as args.
Simplifying VM_FallSprite and VM_ResetPlayer2 used from Lunatic.

git-svn-id: https://svn.eduke32.com/eduke32@3460 1a8010ca-5511-0410-912e-c29ae57300e0
2013-02-07 21:00:52 +00:00
helixhorned fd390efe2a Lunatic: compile out more code with LUNATIC_ONLY.
git-svn-id: https://svn.eduke32.com/eduke32@3354 1a8010ca-5511-0410-912e-c29ae57300e0
2013-01-01 15:24:18 +00:00
helixhorned 5c06ef08bf Make EventNames[] an array of (const char *) instead of const tokenlist.
git-svn-id: https://svn.eduke32.com/eduke32@3258 1a8010ca-5511-0410-912e-c29ae57300e0
2012-12-09 13:24:36 +00:00
helixhorned 274726be9b Split r3159..r3161, part 5: "nowarn" wrapping of printing functions.
git-svn-id: https://svn.eduke32.com/eduke32@3170 1a8010ca-5511-0410-912e-c29ae57300e0
2012-11-15 14:28:04 +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 f18ef269ed Add EVENT_CHANGEMENU and clean up menus.c a little more.
This event is useful in certain circumstances where you want to skip a menu/screen value and the design of the monster switch statement would require the M_ChangeMenu() call to be intercepted or the unwanted screen will flash for a split second.

git-svn-id: https://svn.eduke32.com/eduke32@3101 1a8010ca-5511-0410-912e-c29ae57300e0
2012-10-29 04:29:45 +00:00
helixhorned 7305fbbae9 Add macro CON_ERRPRINTF(Fmt, ...) and use that everywhere.
git-svn-id: https://svn.eduke32.com/eduke32@3000 1a8010ca-5511-0410-912e-c29ae57300e0
2012-09-05 17:25:47 +00:00
hendricks266 2620738eb9 Add EVENT_PREGAME. Now all sprites are processed in the following fashion:
1. EVENT_PREGAME
2. hardcoded stuff
3. EVENT_GAME

One potential use is to examine values which are clobbered by commands such as ifhitweapon/ifwasweapon.

git-svn-id: https://svn.eduke32.com/eduke32@2973 1a8010ca-5511-0410-912e-c29ae57300e0
2012-08-27 03:49:55 +00:00
helixhorned 5bdbd2eda5 Lunatic/LT: provide the predefined labels in con_lang, add "strict" from luajit.
The latter is only for development, since the embedded version already has a
undeclared-var-reference handling similar to that.  Also fix parm2memberpat.

git-svn-id: https://svn.eduke32.com/eduke32@2762 1a8010ca-5511-0410-912e-c29ae57300e0
2012-06-17 19:45:33 +00:00
hendricks266 7f920c5541 Add EVENT_LOADGAME and EVENT_SAVEGAME, self-explanatory. Also make EVENT_NEWGAME use myconnectindex for player ID instead of screenpeek.
git-svn-id: https://svn.eduke32.com/eduke32@2688 1a8010ca-5511-0410-912e-c29ae57300e0
2012-05-25 05:14:19 +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 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 4a00423c89 Add some #includes to gameexec.h and sector.h so that they can be included directly
git-svn-id: https://svn.eduke32.com/eduke32@2328 1a8010ca-5511-0410-912e-c29ae57300e0
2012-02-09 22:44:45 +00:00
helixhorned 54f345f78f Add a warning when calling {save,load}mapstate from EVENT_ANIMATESPRITES (forgotten from earlier changes).
git-svn-id: https://svn.eduke32.com/eduke32@1956 1a8010ca-5511-0410-912e-c29ae57300e0
2011-08-03 17:22:46 +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