Commit Graph

4281 Commits

Author SHA1 Message Date
helixhorned 70d84cd75b Lunatic: run EVENT_INIT after initial Lua state creation.
git-svn-id: https://svn.eduke32.com/eduke32@4231 1a8010ca-5511-0410-912e-c29ae57300e0
2013-12-31 11:51:50 +00:00
helixhorned 148badc32a Lunatic: allow access to sprite[].yvel through set_yvel() member, document.
BUILD_LUNATIC.

git-svn-id: https://svn.eduke32.com/eduke32@4230 1a8010ca-5511-0410-912e-c29ae57300e0
2013-12-28 17:04:39 +00:00
helixhorned 21d8e52f0a Remaining sanitizing of .yvel usage plus minor cleanup.
git-svn-id: https://svn.eduke32.com/eduke32@4229 1a8010ca-5511-0410-912e-c29ae57300e0
2013-12-28 17:04:36 +00:00
helixhorned 2dd9b7e495 Clean up legacy ROR code and introduce LEGACY_ROR define in game.h.
Also, bound-check two .yvel meant as sprite indices in actors.c.

git-svn-id: https://svn.eduke32.com/eduke32@4228 1a8010ca-5511-0410-912e-c29ae57300e0
2013-12-28 17:04:34 +00:00
helixhorned 9b045deb4b Make a couple of player functions take player indices instead of DukePlayer_t *.
git-svn-id: https://svn.eduke32.com/eduke32@4227 1a8010ca-5511-0410-912e-c29ae57300e0
2013-12-28 17:04:31 +00:00
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 aa37d8c82f engine.c: clean up code related to ART loading. BUILD_LUNATIC.
git-svn-id: https://svn.eduke32.com/eduke32@4223 1a8010ca-5511-0410-912e-c29ae57300e0
2013-12-26 19:45:17 +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 4739d3c00e Don't autoexec <mapname>.cfg files for clipshape maps.
git-svn-id: https://svn.eduke32.com/eduke32@4212 1a8010ca-5511-0410-912e-c29ae57300e0
2013-12-24 09:44:23 +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 a2d0008e32 osd.c: patch up a possible oob access of osdtext[].
git-svn-id: https://svn.eduke32.com/eduke32@4210 1a8010ca-5511-0410-912e-c29ae57300e0
2013-12-24 09:44:20 +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 6c00f0e822 a.m32: don't clamp SE50 extra (=horiz) to [-500 500] with KP8/KP5.
git-svn-id: https://svn.eduke32.com/eduke32@4197 1a8010ca-5511-0410-912e-c29ae57300e0
2013-12-12 19:22:11 +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 a7ed1a6fe9 Makefile: add target 'print-compiler-options'.
May come in handy at times. BUILD_LUNATIC.

git-svn-id: https://svn.eduke32.com/eduke32@4194 1a8010ca-5511-0410-912e-c29ae57300e0
2013-12-06 18:56:46 +00:00
helixhorned 1628debd7c Really fix the Pause key on Windows/SDL2.
This requires enabling the same workaround as for Linux. Maybe it's not
system-dependent at all.

git-svn-id: https://svn.eduke32.com/eduke32@4193 1a8010ca-5511-0410-912e-c29ae57300e0
2013-12-06 18:56:44 +00:00
helixhorned 19da43d23b Polymer: invalidate a wall when its sector's visibility has changed.
git-svn-id: https://svn.eduke32.com/eduke32@4192 1a8010ca-5511-0410-912e-c29ae57300e0
2013-12-06 18:56: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 9a397a01c1 Fix mouse buttons 4 and 5 on SDL2/Windows.
git-svn-id: https://svn.eduke32.com/eduke32@4190 1a8010ca-5511-0410-912e-c29ae57300e0
2013-12-01 18:28:03 +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 2a43511c70 cache1d: add FIND_NOCURDIR option to klistpath().
git-svn-id: https://svn.eduke32.com/eduke32@4188 1a8010ca-5511-0410-912e-c29ae57300e0
2013-12-01 18:27:59 +00:00
helixhorned a783933726 Fix building stand-alone libcache1d.so.
git-svn-id: https://svn.eduke32.com/eduke32@4187 1a8010ca-5511-0410-912e-c29ae57300e0
2013-12-01 18:27:57 +00:00
helixhorned 4d8071e6b3 defs.c: in check_tile(), pass 'tile' by value.
git-svn-id: https://svn.eduke32.com/eduke32@4186 1a8010ca-5511-0410-912e-c29ae57300e0
2013-12-01 18:27:55 +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 a68ef20182 a-c.c: Make vector extensions also be compiled with Clang.
I was checking for GCC >= 4.7, while Clangs pretends to be GCC 4.2. Use a
feature test macro instead. The comment I made in r4161 regarding GCC vs.
Clang code was wrong. Now, Clang generates slightly faster code for these cases
(solid and masked 4-pixel wide vlines).

git-svn-id: https://svn.eduke32.com/eduke32@4182 1a8010ca-5511-0410-912e-c29ae57300e0
2013-11-28 21:18:07 +00:00