Commit Graph

2863 Commits

Author SHA1 Message Date
helixhorned a9fb18b228 Lunatic: document fundamentals of shade tables, but not 'engine' API yet.
git-svn-id: https://svn.eduke32.com/eduke32@4239 1a8010ca-5511-0410-912e-c29ae57300e0
2014-01-02 00:08:39 +00:00
helixhorned e71df2b6e3 Lunatic/m32: make Mapster23 actually start stand-alone, oops.
git-svn-id: https://svn.eduke32.com/eduke32@4238 1a8010ca-5511-0410-912e-c29ae57300e0
2014-01-02 00:08:36 +00:00
helixhorned 49de6d79b3 Lunatic/m32: include the Lua bytecode into the binary, exit if setup failed.
git-svn-id: https://svn.eduke32.com/eduke32@4237 1a8010ca-5511-0410-912e-c29ae57300e0
2013-12-31 11:52:01 +00:00
helixhorned 13c125db02 Lunatic: add 'engine' module, currently allowing to create custom shade tables.
Available in the game and editor. Provide test/shadexfog.lua, containing a
function to creating a set of 32 shade tables corresponding to different shades
of the same fog palookup table, together with some tests and convenience
functions.

Also,
- Add gv.LUNATIC_CLIENT{,_EDUKE32,_MAPSTER32}
- Add LUNATIC_FIRST_TIME in the global env for the game
- defs_m32.lua: add reload() convenience function
- Failed attempt at recreating the base shade table. It is NOT a linear ramp
  of the base palette colors to (0,0,0). That is, it's not created by
  build/util/transpal.exe!

git-svn-id: https://svn.eduke32.com/eduke32@4236 1a8010ca-5511-0410-912e-c29ae57300e0
2013-12-31 11:52:00 +00:00
helixhorned 75f5449e9a build.lua: add a flag toggling multiplication of the color components by 4.
git-svn-id: https://svn.eduke32.com/eduke32@4235 1a8010ca-5511-0410-912e-c29ae57300e0
2013-12-31 11:51:57 +00:00
helixhorned 2174b17901 Lunatic: fix setup under Mapster32, remove a few obsolete lines in defs_common.lua.
git-svn-id: https://svn.eduke32.com/eduke32@4234 1a8010ca-5511-0410-912e-c29ae57300e0
2013-12-31 11:51:55 +00:00
helixhorned 8a4c5259a8 In the no-netcode build, don't expose four internal engine functions.
Also don't compile three multiplayer related OSD commands there.

git-svn-id: https://svn.eduke32.com/eduke32@4233 1a8010ca-5511-0410-912e-c29ae57300e0
2013-12-31 11:51:54 +00:00
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 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