Commit Graph

2851 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 8a2d786e23 Reserve 16 tiles from the end of MAXTILES, don't allow as user tiles from ART/DEF.
git-svn-id: https://svn.eduke32.com/eduke32@4225 1a8010ca-5511-0410-912e-c29ae57300e0
2013-12-28 17:04:22 +00:00
helixhorned 2442b107f7 Lunatic: add example toggling forcefield wall to test.lua.
git-svn-id: https://svn.eduke32.com/eduke32@4224 1a8010ca-5511-0410-912e-c29ae57300e0
2013-12-28 17:04:18 +00:00
helixhorned 35b848e81f Don't consider W_FORCEFIELD+2 (surgery instruments) a forcefield picnum.
git-svn-id: https://svn.eduke32.com/eduke32@4222 1a8010ca-5511-0410-912e-c29ae57300e0
2013-12-26 19:45:15 +00:00
helixhorned 46ec5c4146 Clean up code related to forcefield player damage etc.
git-svn-id: https://svn.eduke32.com/eduke32@4221 1a8010ca-5511-0410-912e-c29ae57300e0
2013-12-26 19:45:14 +00:00
helixhorned d26ae58627 Rename 'camsprite' to 'g_curViewscreen', other related cleanup.
git-svn-id: https://svn.eduke32.com/eduke32@4220 1a8010ca-5511-0410-912e-c29ae57300e0
2013-12-26 19:45:12 +00:00
helixhorned d3665719d9 Add helper utility lunatic/util/cmpart.lua.
git-svn-id: https://svn.eduke32.com/eduke32@4219 1a8010ca-5511-0410-912e-c29ae57300e0
2013-12-26 19:45:09 +00:00
helixhorned 2900144e22 Lunatic: swap con.insetsprite's 4th and 5th positional arguments.
git-svn-id: https://svn.eduke32.com/eduke32@4218 1a8010ca-5511-0410-912e-c29ae57300e0
2013-12-26 19:45:06 +00:00
helixhorned 3cef7cccc0 Lunatic: expose player[].gotweapon, document it and *_weapon() methods.
git-svn-id: https://svn.eduke32.com/eduke32@4217 1a8010ca-5511-0410-912e-c29ae57300e0
2013-12-26 19:45:03 +00:00
helixhorned 380aa880dc Consolidate P_AddWeaponNoSwitch into an additional P_AddWeapon argument.
git-svn-id: https://svn.eduke32.com/eduke32@4216 1a8010ca-5511-0410-912e-c29ae57300e0
2013-12-26 19:45:00 +00:00
helixhorned c45ca57eb0 Minor stylistic tweaks of code related to weapon switching.
git-svn-id: https://svn.eduke32.com/eduke32@4215 1a8010ca-5511-0410-912e-c29ae57300e0
2013-12-26 19:44:56 +00:00
helixhorned 030f72d551 premap.c: stylistic cleanup in map loading code.
git-svn-id: https://svn.eduke32.com/eduke32@4214 1a8010ca-5511-0410-912e-c29ae57300e0
2013-12-24 09:44:25 +00:00
helixhorned 8dcee7c8dc Factor some code in config.c into OSD_WriteAliases(), move symbol_t to osd.c.
git-svn-id: https://svn.eduke32.com/eduke32@4213 1a8010ca-5511-0410-912e-c29ae57300e0
2013-12-24 09:44:24 +00:00
helixhorned cc09a0ac92 Lunatic: don't allow starting demo recording, since gamevar diffing is NYI.
git-svn-id: https://svn.eduke32.com/eduke32@4211 1a8010ca-5511-0410-912e-c29ae57300e0
2013-12-24 09:44:21 +00:00
helixhorned a4510e35a1 Lunatic: error on invalid static data read like 'sprite.picnum'.
git-svn-id: https://svn.eduke32.com/eduke32@4209 1a8010ca-5511-0410-912e-c29ae57300e0
2013-12-24 09:44:19 +00:00
helixhorned 02e0929ca7 Pass RETURN to EVENT_DAMAGEHPLANE in the 'dist' arg to allow chained callbacks.
git-svn-id: https://svn.eduke32.com/eduke32@4208 1a8010ca-5511-0410-912e-c29ae57300e0
2013-12-24 09:44:14 +00:00
helixhorned fa6746867c Lunatic: add ceiling-or-floor method set_picnum(). BUILD_LUNATIC.
git-svn-id: https://svn.eduke32.com/eduke32@4207 1a8010ca-5511-0410-912e-c29ae57300e0
2013-12-20 18:31:35 +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 f10e1b1a16 Generalize Sect_DamageCeiling to Sect_DamageCeilingOrFloor, use appropriately.
- 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
2013-12-20 18:31:29 +00:00
helixhorned 99894812d8 Minor no-functionality-changing tweaks.
- 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
2013-12-20 18:31:26 +00:00
helixhorned 0f6e22e20e sector.c: in ST9 handling code, prevent oob for improperly constructed doors.
git-svn-id: https://svn.eduke32.com/eduke32@4203 1a8010ca-5511-0410-912e-c29ae57300e0
2013-12-20 18:31:24 +00:00
helixhorned dd52afbf1b Lunatic: fix a couple of spelling mistakes in the doc, found using Emacs ispell.
git-svn-id: https://svn.eduke32.com/eduke32@4202 1a8010ca-5511-0410-912e-c29ae57300e0
2013-12-20 18:31:22 +00:00
helixhorned 25108494d1 Lunatic: expose "con.shoot(tilenum, i [, zvel])". Document and add example.
git-svn-id: https://svn.eduke32.com/eduke32@4201 1a8010ca-5511-0410-912e-c29ae57300e0
2013-12-20 18:31:20 +00:00
hendricks266 cfedcbd7d7 Rewrite and unify the handling of the scrollwheel between layers, fixing it in the editor's 2D mode and tile selector under SDL.
The scrollwheel is unique among PC input because it has no innate "hold length". Previously, the layers gave the mousewheel a fake hold length to allow the not-necessarily-synchronous game/editor code to pick up the input before the layers marked it as "no longer pressed". This passed under Windows, but it didn't slide under SDL.

Besides the two problems listed above, it also potentially limited the rate of weapon selection, where scrolling too fast would not register every clicks. [Unrelatedly, this is still the case when you scroll faster than the game's own tickrate, but addressing that would require rewriting input handling to go through a list of "events" for each tic instead of looking at overall pressed/unpressed states.]

git-svn-id: https://svn.eduke32.com/eduke32@4200 1a8010ca-5511-0410-912e-c29ae57300e0
2013-12-20 07:24:09 +00:00
helixhorned ee9e84c356 Various stylistic cleanup.
- 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
2013-12-12 19:22:16 +00:00
helixhorned 9e4f10f3e1 Lunatic: add "for s, what in sectorsofbunch(bunchnum, gv.BOTH_CF)" iterator.
git-svn-id: https://svn.eduke32.com/eduke32@4198 1a8010ca-5511-0410-912e-c29ae57300e0
2013-12-12 19:22:14 +00:00
helixhorned c323fac09d m32script: fix parsing negated labels, getnumber* with neg. 'max'.
Exposed by this snippet from a.m32:
    getnumber256 .owner "OWNER (projection picnum): " -MAXTILES
Now, Alt+KP2 works as expected in 3D mode.

git-svn-id: https://svn.eduke32.com/eduke32@4196 1a8010ca-5511-0410-912e-c29ae57300e0
2013-12-11 21:23:47 +00:00
helixhorned 44351528db LunaCON: statically check some member assignments with literal numbers.
And issue warnings whenever the assignment would fail (error) at game time.

git-svn-id: https://svn.eduke32.com/eduke32@4195 1a8010ca-5511-0410-912e-c29ae57300e0
2013-12-11 21:23:42 +00:00
helixhorned a5f0610b38 Do not consider system gamearrays for updating from demos.
This generally fixes demo playback. Before, tilesizx[]/tilesizy[] were written
into twice as many bytes as needed. Now, don't do that at all.

git-svn-id: https://svn.eduke32.com/eduke32@4191 1a8010ca-5511-0410-912e-c29ae57300e0
2013-12-06 18:56:39 +00:00
helixhorned 1542596290 Lunatic: in fs.listpath() use FIND_NOCURDIR. Also document that function.
git-svn-id: https://svn.eduke32.com/eduke32@4189 1a8010ca-5511-0410-912e-c29ae57300e0
2013-12-01 18:28:02 +00:00
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 ce68b4ab0f Lunatic: document a couple of player members, especially some 'bool' ones.
Important because in Lua, a value of zero yields true in a boolean context.

BUILD_LUNATIC.

git-svn-id: https://svn.eduke32.com/eduke32@4184 1a8010ca-5511-0410-912e-c29ae57300e0
2013-11-28 21:18:11 +00:00
helixhorned 9688dccfff multivoc.c: use a local variable instead of a file-scope one used locally.
git-svn-id: https://svn.eduke32.com/eduke32@4183 1a8010ca-5511-0410-912e-c29ae57300e0
2013-11-28 21:18:09 +00:00
helixhorned 7350e1cfa0 In P_HandleSharedKeys(), clean up weapon index bound checking.
In particular, (int32_t)j != -1 is replaced by (uint32_t)j < MAX_WEAPONS
to prevent a value >= MAX_WEAPONS to be assigned to p->wantweaponfire (it's
used as a weapon index in P_CheckWeapon().

git-svn-id: https://svn.eduke32.com/eduke32@4181 1a8010ca-5511-0410-912e-c29ae57300e0
2013-11-28 21:18:05 +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 b6efd5e57e LunaCON: disable some player members, tweak decls of others.
The ones disabled are because they were found to not be used in any mod I
tested. Exposing members directly is rarely good API.

- bool toggle_key_flag -> const uint8_t ... (because value 2 is used)
- make scream_voice, cheat_phase read-only

git-svn-id: https://svn.eduke32.com/eduke32@4179 1a8010ca-5511-0410-912e-c29ae57300e0
2013-11-28 21:18:02 +00:00
helixhorned f26663a9dc Lunatic: slightly tweak the event/actor times printout when exiting.
git-svn-id: https://svn.eduke32.com/eduke32@4178 1a8010ca-5511-0410-912e-c29ae57300e0
2013-11-28 21:18:00 +00:00
helixhorned cc1574464b LunaCON: fix assignment to projectile sound/bsound/isound.
git-svn-id: https://svn.eduke32.com/eduke32@4177 1a8010ca-5511-0410-912e-c29ae57300e0
2013-11-28 21:17:56 +00:00
helixhorned fd978ced59 Classic: implement horiz. tex panning for sprites (spriteext[].xpanning).
Known as getactor/sprite[].xpanning from CON, values are 0-255. It should be
assumed that this is only valid for wall-aligned sprites (currently, face
sprites also pan).

A test is provided in lunatic/test/animatesprites.con. It should be run in E1L2
and only with the Lunatic build.

git-svn-id: https://svn.eduke32.com/eduke32@4170 1a8010ca-5511-0410-912e-c29ae57300e0
2013-11-22 19:26:21 +00:00
helixhorned bc54631888 a.m32: add [']+[F] menu function setting xvel=1 on all sel. wall/floor sprites.
For sanitizing underwater sections, see r4166.
Also, don't print "Menu function executed successfully" when the function
printed something itself.

git-svn-id: https://svn.eduke32.com/eduke32@4169 1a8010ca-5511-0410-912e-c29ae57300e0
2013-11-19 19:00:02 +00:00
helixhorned ffed49b395 Amend r4142: make e.g. 'include a' (names shorter 4 chars) append ".m32".
DONT_BUILD.

git-svn-id: https://svn.eduke32.com/eduke32@4168 1a8010ca-5511-0410-912e-c29ae57300e0
2013-11-18 10:51:26 +00:00
helixhorned 2972155f14 sdlmusic.c: disable FORK_EXEC_MIDI.
Also, if it were to be reenabled again, use execv() instead of execvp(),
i.e. don't look up $PATH for the executable.

git-svn-id: https://svn.eduke32.com/eduke32@4167 1a8010ca-5511-0410-912e-c29ae57300e0
2013-11-16 18:47:23 +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 9ceae0d892 lunatic/util/foreachmap.lua: don't expand .xxx after ']'.
Add an example searching for all maps containing blocking floor-aligned
sprites in underwater sectors.

git-svn-id: https://svn.eduke32.com/eduke32@4165 1a8010ca-5511-0410-912e-c29ae57300e0
2013-11-16 18:47:19 +00:00
helixhorned 4dcd167c7a LunaCON: for gamevar-already-defined warnings/errors, show old location.
Synthesis, BUILD_LUNATIC! Got the build? Good synthesis.

git-svn-id: https://svn.eduke32.com/eduke32@4153 1a8010ca-5511-0410-912e-c29ae57300e0
2013-11-12 21:03:23 +00:00
helixhorned 25081fb459 LunaCON: In lunacon.lua, make room for a couple more locals at file scope.
Also, really reset all label-related tables in reset.labels().

git-svn-id: https://svn.eduke32.com/eduke32@4152 1a8010ca-5511-0410-912e-c29ae57300e0
2013-11-12 21:03:20 +00:00
helixhorned 82fb8a0724 LunaCON: for *-already-defined style warnings/errors, show location of old def.
git-svn-id: https://svn.eduke32.com/eduke32@4151 1a8010ca-5511-0410-912e-c29ae57300e0
2013-11-12 21:03:18 +00:00
helixhorned 987eb858d3 LunaCON: add a couple of userdefs members, fix tsprite's sectnum for writing.
git-svn-id: https://svn.eduke32.com/eduke32@4150 1a8010ca-5511-0410-912e-c29ae57300e0
2013-11-12 21:03:16 +00:00
helixhorned 78d30bee9b LunaCON: implement 'ssp' command.
git-svn-id: https://svn.eduke32.com/eduke32@4149 1a8010ca-5511-0410-912e-c29ae57300e0
2013-11-12 21:03:11 +00:00
helixhorned 42f66ce9ca Lunatic: add 'fs' module containing 'listpath' function, 'd' in global env.
See the updated documentation for (ATM sparse) details.

git-svn-id: https://svn.eduke32.com/eduke32@4147 1a8010ca-5511-0410-912e-c29ae57300e0
2013-11-11 16:48:23 +00:00