Commit Graph

1055 Commits

Author SHA1 Message Date
helixhorned a374a401be Clean up parallaxed sky functionality, part 2.
- Rename sky_t members: yscale -> horizfrac, bits -> lognumtiles.
- Add default sky (8 tiles, horizfrac=32768 (i.e. 1/2 the scene horiz), offsets
  all zero) and CLOUDYOCEAN sky (8 tiles, horizfrac=65536, offsets all zero)
  to multipsky[].
- Get rid of "psky_t g_psky", merely maintaining a g_pskyidx instead. Set it up
  at map load time so as to keep the behavior of the legacy per-map psky:
  the last sector index with a matching psky ceiling wins.
- In mapstate_t, save g_pskyidx too, not (former) pskybits and pskyoffs[].
- Make on-map-load global psky setup consistent for the game and editor by
  factoring it out into common.c: G_SetupGlobalPsky().
- Remove a couple of useless initializations, add some static assertions.

This commit is more likely to introduce subtle differences in behavior.
Specifically, getpsky() now always returns the default sky properties instead of
the global sky ones (but with all-zero offsets) when no match for a suiting
multi-psky is found. This is only likely to affect the yscale/horizfrac of
non-multi-pskies when a global non-default multi-psky has been set up.
Bump BYTEVERSION again.

git-svn-id: https://svn.eduke32.com/eduke32@3976 1a8010ca-5511-0410-912e-c29ae57300e0
2013-08-04 20:37:48 +00:00
helixhorned 46e8549b5e Clean up parallaxed sky functionality, part 1.
- Consolidate psky* arrays into a "typedef struct psky_t" "g_psky" and
  "multipsky[]".
- Factor out getting parallaxed sky properties into getpsky().
- Condense initial multi-psky setup by memcpy'ing from multipsky[].
- New function: MultiPsky_TileToIdx().
- Add new define PSKYOFF_MAX and related consistency-checking assertions.
- Lower MAXPSKYTILES to 8 to reflect current usage (was 256).
- Game: make multi-pskies consider dynamically-remapped MOONSKY1, BIGORBIT1
  and LA. (Not very useful as the editor will still only act for the static
  values -- 80, 84 and 89, respectively.)

An attempt has been made to preserve behavior even in strange cases, so this
commit is unlikely to introduce regressions. Because of point 6, BYTEVERSION
had to be bumped.

git-svn-id: https://svn.eduke32.com/eduke32@3975 1a8010ca-5511-0410-912e-c29ae57300e0
2013-08-04 20:37:45 +00:00
helixhorned 4f88aaf4d2 Retire global 'lastvisinc'.
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
2013-07-18 18:08:13 +00:00
helixhorned 19b85dc5ee Make vis decay with time independent of FPS, treat p->visibility<0 like 0.
Now, if p->visibility differs from the constant visibility, the former converges
toward the latter by three-quartering the difference each second totalclock
increment (1/60th second).
Negative player visibilities are not handled consistently throughout the
different renderers, so make it look the same as 0 (can view to infinity).

git-svn-id: https://svn.eduke32.com/eduke32@3960 1a8010ca-5511-0410-912e-c29ae57300e0
2013-07-18 18:08:11 +00:00
helixhorned b9dfcc902d game.c: read sprites-on-screen count for DNDEBUG at end of G_DoSpriteAnimations.
Because that function might have inserted tsprites itself, e.g. for the fake
floor shadow. Also add one "spritesortcnt < MAXSPRITESONSCREEN" bound check
in legacy ROR code.

git-svn-id: https://svn.eduke32.com/eduke32@3952 1a8010ca-5511-0410-912e-c29ae57300e0
2013-07-13 21:04:55 +00:00
helixhorned d7e4d5afbf Factor out repeated few-liner into G_NewGame_EnterLevel(), misc. cleanup.
git-svn-id: https://svn.eduke32.com/eduke32@3950 1a8010ca-5511-0410-912e-c29ae57300e0
2013-07-13 21:04:52 +00:00
helixhorned e76348cc4b In DNCOORDS display, show execution time in ms for all actors (G_MoveActors).
Smoothed using an exponential moving average... with a time constant of 1 sec
if I didn't miscalculate things. Also, split BYTEVERSION_JF into Lunatic and
non-Lua.

git-svn-id: https://svn.eduke32.com/eduke32@3947 1a8010ca-5511-0410-912e-c29ae57300e0
2013-07-13 21:04:47 +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 c243bab0e7 Remove one instance of duplicate code lines and now unused TSPR_MIRROR.
git-svn-id: https://svn.eduke32.com/eduke32@3936 1a8010ca-5511-0410-912e-c29ae57300e0
2013-07-07 20:59:07 +00:00
helixhorned cad7d49bd1 Lunatic: retire an actor's sprite[].hitag/lotag for new actor[] members.
git-svn-id: https://svn.eduke32.com/eduke32@3922 1a8010ca-5511-0410-912e-c29ae57300e0
2013-06-30 20:38:52 +00:00
helixhorned e164bd7f1e Actor-related code cleanup part 2: give actor t_data[] indexes names.
Using macros like AC_COUNT(t). Clean up related code:
 - comment out the dead condition noted in the previous commit
 - Lunatic: use get_count() instead of get_t_data(0) in one place,
   rename to _get_t_data(), i.e. make that method internal

git-svn-id: https://svn.eduke32.com/eduke32@3920 1a8010ca-5511-0410-912e-c29ae57300e0
2013-06-30 20:38:48 +00:00
helixhorned 90ddee2296 Actor-related code cleanup part 1: rename some locals, expose one dead condition
... due to making hi/lotag unsigned in r3174. This commit keeps the compiler
warning, the next one will remove it.

git-svn-id: https://svn.eduke32.com/eduke32@3919 1a8010ca-5511-0410-912e-c29ae57300e0
2013-06-30 20:38:45 +00:00
helixhorned ebe0ecaded Lunatic: add actor methods allowing overriding action delay and move hvel/vvel.
Add testing code for an example actor 1275 (newspaper) to test.elua.

git-svn-id: https://svn.eduke32.com/eduke32@3918 1a8010ca-5511-0410-912e-c29ae57300e0
2013-06-30 20:38:44 +00:00
terminx 214baa9475 Rename getinput() to P_GetInput(), add bounds checking for a few arrays used for weapon drawing that use kickback_pic as an index.
git-svn-id: https://svn.eduke32.com/eduke32@3902 1a8010ca-5511-0410-912e-c29ae57300e0
2013-06-27 23:04:39 +00:00
terminx 8479e63b7c Fix up handling of the Duke shareware beta a little bit, and change the dialog that pops up after running the shareware version too many times to take you to Steam instead of GOG (the Steam version is a better deal)
git-svn-id: https://svn.eduke32.com/eduke32@3884 1a8010ca-5511-0410-912e-c29ae57300e0
2013-06-13 21:17:03 +00:00
helixhorned 0d951f0256 LunaCON: bound-check defineprojectile tile/sound members.
Also from Lunatic, make these members read-only and provide methods that
allow setting them to either -1 or a number in [0..MAX{TILES,SOUNDS}-1].

git-svn-id: https://svn.eduke32.com/eduke32@3865 1a8010ca-5511-0410-912e-c29ae57300e0
2013-06-09 16:37:16 +00:00
helixhorned 01770ec720 Fix accessing the wrong animation indices with negative viewtypes.
(I think; untested.)

git-svn-id: https://svn.eduke32.com/eduke32@3863 1a8010ca-5511-0410-912e-c29ae57300e0
2013-06-07 14:26:35 +00:00
helixhorned a57ce255e7 Allow negating an action's viewtype 5 or 7, meaning to x-flip the shown sprite.
git-svn-id: https://svn.eduke32.com/eduke32@3859 1a8010ca-5511-0410-912e-c29ae57300e0
2013-06-07 10:18:21 +00:00
helixhorned 335fa81b18 game.c: fix out-of-bounds write in G_GetSubString().
git-svn-id: https://svn.eduke32.com/eduke32@3852 1a8010ca-5511-0410-912e-c29ae57300e0
2013-06-06 11:22:38 +00:00
hendricks266 6cc62ea2bf Fix the display of numbers with TEXT_GAMETEXTNUMHACK and TEXT_XOFFSETZERO. (Fix level stats, part 2.)
The commit revises the definition of qstrdim when TEXT_[XY]OFFSETZERO are used. With these flags, the offsets the user specifies are now the only dimensions the function cares about in terms of tile placement, so depending on the difference between the offset(s) and the size of the final tile, it may be slightly more or less than the dimensions actually displayed on the screen because tile size is never taken into account. (For example, if your font is nominally 9x7 like the Duke bluefont and you use a TEXT_XOFFSETZERO of 5 with a string five characters long, the total x dimension will be 25 even though the last character will overhang that amount by four pixels. If you use a TEXT_XOFFSETZERO of 12 with the same string, the total x width will be 60 even though there will be three pixels of empty space on the right edge.) This change was made because assigning text an arbitrary constant width in general implies an intent to keep character positions constant even with a variable width font, but returning the visible span of pixels on the screen that the tiles cover would have caused the string to move when alignment options other than the top-left were used. In other words, you can now safely use TEXT_[XY]OFFSETZERO with the alignment options and the text won't jiggle.

Also, with TEXT_GAMETEXTNUMHACK, numerals are now effectively TEXT_XOFFSETZERO text that respect the above paragraph, so number count displays can look nice with alignment options too.

Having to modify the extent/offset code makes me realize that I'm not quite happy with its structure because it gets tangled juggling different concepts like character width, X offset, and spacing, and how they relate when the line wraps or in terms of the final size. Fortunately, it produces correct results as far as I know, and it's not necessarily ugly, just hard to understand. Handle with care.

git-svn-id: https://svn.eduke32.com/eduke32@3850 1a8010ca-5511-0410-912e-c29ae57300e0
2013-06-03 05:26:44 +00:00
hendricks266 e74ac19cd2 Fix display of level stats by fixing G_ScreenText() handling of (orientation & 2).
git-svn-id: https://svn.eduke32.com/eduke32@3849 1a8010ca-5511-0410-912e-c29ae57300e0
2013-06-03 05:26:24 +00:00
helixhorned 185597d3b3 LunaCON: proper handling of dynamic remappings with weapon defaults.
That is, the gamevars named WEAPONx_* in CON will now have the remapped value
if they were not overridden from CON ('gamevar' at file scope).
For C-CON, everything except signaling an override from the CON parser is in
place.

git-svn-id: https://svn.eduke32.com/eduke32@3848 1a8010ca-5511-0410-912e-c29ae57300e0
2013-06-02 14:07:56 +00:00
hendricks266 e0a373893a Replace use of preprocessor macro WIN32 with _WIN32. (Blame clang.)
git-svn-id: https://svn.eduke32.com/eduke32@3839 1a8010ca-5511-0410-912e-c29ae57300e0
2013-06-01 06:57:00 +00:00
hendricks266 899f19155d Make improvements utilizing G_ScreenText().
git-svn-id: https://svn.eduke32.com/eduke32@3838 1a8010ca-5511-0410-912e-c29ae57300e0
2013-06-01 06:56:28 +00:00
hendricks266 e483dbefcd For all HUD and text shadows that use pal 4, also use shade 127.
git-svn-id: https://svn.eduke32.com/eduke32@3837 1a8010ca-5511-0410-912e-c29ae57300e0
2013-06-01 06:56:13 +00:00
hendricks266 bf9b91352b Text wrapper conversion.
G_PrintGameText(), minitext_(), G_DrawTXDigiNumZ(), and menutext_() now wrap G_ScreenText().
G_GameTextLen() now wraps G_ScreenTextSize().
G_DrawDigiNum_() now wraps G_DrawTXDigiNumZ().

git-svn-id: https://svn.eduke32.com/eduke32@3836 1a8010ca-5511-0410-912e-c29ae57300e0
2013-06-01 06:56:00 +00:00
hendricks266 4297507c8f Dynamicsoundremap.
git-svn-id: https://svn.eduke32.com/eduke32@3834 1a8010ca-5511-0410-912e-c29ae57300e0
2013-06-01 06:55:30 +00:00
hendricks266 ced47cf9fc Add qstrdim and screentext, powerful new functions for HUD text.
git-svn-id: https://svn.eduke32.com/eduke32@3833 1a8010ca-5511-0410-912e-c29ae57300e0
2013-06-01 06:55:00 +00:00
helixhorned 5bfbfa3c5b Lunatic: also reset per-actor gamevars from spawns originating from C.
Take care not to do it twice. Still untested though.

git-svn-id: https://svn.eduke32.com/eduke32@3830 1a8010ca-5511-0410-912e-c29ae57300e0
2013-05-30 18:10:59 +00:00
helixhorned 560f88b022 Replace inline "qsetmode==200" checks with in3dmode().
Analogously for the negation; remove a couple of redundant decls of "qsetmode".

git-svn-id: https://svn.eduke32.com/eduke32@3823 1a8010ca-5511-0410-912e-c29ae57300e0
2013-05-30 09:13:32 +00:00
helixhorned a02ab83319 With DNCOORDS display, print number of sprites currently on the screen.
Only in debugging builds.

git-svn-id: https://svn.eduke32.com/eduke32@3818 1a8010ca-5511-0410-912e-c29ae57300e0
2013-05-26 18:42:56 +00:00
helixhorned c366388a9e Lunatic: -Wchained-loadactor option for LunaCON, clear errors on restart.
The last only in release builds.

git-svn-id: https://svn.eduke32.com/eduke32@3813 1a8010ca-5511-0410-912e-c29ae57300e0
2013-05-24 13:54:39 +00:00
helixhorned 487d54793f For DNCOORDS display, add current sprite count and #inserted sprites / last sec.
Only in debugging builds.

git-svn-id: https://svn.eduke32.com/eduke32@3808 1a8010ca-5511-0410-912e-c29ae57300e0
2013-05-24 13:54:32 +00:00
terminx 85cf8de0f3 Add support for shareware 0.99/1.0/1.1, for shits and giggles.
git-svn-id: https://svn.eduke32.com/eduke32@3803 1a8010ca-5511-0410-912e-c29ae57300e0
2013-05-23 18:28:04 +00:00
helixhorned f6ea669613 Lunatic: initialize SPRITE_HARDCODED_BADGUY on Lua state recreation, too.
git-svn-id: https://svn.eduke32.com/eduke32@3795 1a8010ca-5511-0410-912e-c29ae57300e0
2013-05-20 19:31:37 +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 4ed1eaa520 Lunatic: accept any number of *.lua modules on the command line.
There's no option letter for loading them, and the extension is checked
case sensitively. Lua modules are loaded after CON translated to Lua.
Also remove -testlua option.

git-svn-id: https://svn.eduke32.com/eduke32@3788 1a8010ca-5511-0410-912e-c29ae57300e0
2013-05-19 19:29:16 +00:00
helixhorned 9d858b9883 Lunatic: back up generated LunaCON code, recreate Lua state on map entering.
git-svn-id: https://svn.eduke32.com/eduke32@3787 1a8010ca-5511-0410-912e-c29ae57300e0
2013-05-19 19:29:13 +00:00
helixhorned f72e571b18 Fix two possible signed left shift overflows.
git-svn-id: https://svn.eduke32.com/eduke32@3773 1a8010ca-5511-0410-912e-c29ae57300e0
2013-05-15 18:32:55 +00:00
terminx 81292c238a Make the menus look the same in all rendering modes, because the LOADSCREEN tile looks like shit when any kind of palette-based shading is involved. So, now everyone gets the ugly metal looking MENUSCREEN.
git-svn-id: https://svn.eduke32.com/eduke32@3767 1a8010ca-5511-0410-912e-c29ae57300e0
2013-05-15 02:20:49 +00:00
terminx 7e51e92a81 Properly handle shading models with traditional fog when r_usetileshades is also enabled.
git-svn-id: https://svn.eduke32.com/eduke32@3766 1a8010ca-5511-0410-912e-c29ae57300e0
2013-05-15 02:20:35 +00:00
helixhorned 1ec058a47f Classic: fix oob read of frame buffer when leftmost vline has a mirror.
In the mirror reversing code, get rid of the padding. This may produce
seams, but they appear to be extremely transient and shouldn't be
noticeable.
In game.c, add a debugging compilation switch DEBUG_MIRRORS_ONLY.

git-svn-id: https://svn.eduke32.com/eduke32@3726 1a8010ca-5511-0410-912e-c29ae57300e0
2013-05-04 16:36:12 +00:00
helixhorned bc78ff27ed Classic: clean up mirror drawing code.
No functional changes, but a (commented out) debug line for an oob read of the
frame buffer when the mirror covers the whole screen is inserted.

git-svn-id: https://svn.eduke32.com/eduke32@3719 1a8010ca-5511-0410-912e-c29ae57300e0
2013-05-01 17:41:59 +00:00
helixhorned 3910456d55 In G_LoadAddon(), remove inner 'struct grpfile *grp', fixing uninited access.
... four lines later.
I don't know if that is the intended semantics for this function, but
nasal demons is clearly not what we want. Please review!

git-svn-id: https://svn.eduke32.com/eduke32@3712 1a8010ca-5511-0410-912e-c29ae57300e0
2013-04-25 21:10:29 +00:00
helixhorned 3e9b1be6fb Fix two harmless warnings and reindent one switch block.
Also, make G_LoadAddon() local to game.c.

git-svn-id: https://svn.eduke32.com/eduke32@3711 1a8010ca-5511-0410-912e-c29ae57300e0
2013-04-25 21:10:25 +00:00
terminx a002290853 Support adding custom grps to the selector in the startup window. To use this feature, create a file with a ".grpinfo" extension in your EDuke32 directory, following this template:
grpinfo
{
    name "YourGameName"
    scriptname "yourgame.con"
    defname "yourgame.def"
    size yourgrpsize
    dependency DUKE15_CRC
    flags GAMEFLAG_ADDON
    crc yourgrpcrc
}

The "flags" field can also take the value "GAMEFLAG_DUKE" to define a new base game. Since this is the first commit of a new feature, certain semantics of the implementation and syntax are liable to change as necessary.

git-svn-id: https://svn.eduke32.com/eduke32@3708 1a8010ca-5511-0410-912e-c29ae57300e0
2013-04-25 17:49:10 +00:00
helixhorned 086ef3f901 Remove 'cl_angleinterpolation' cvar because it had no effect for a while.
Also remove the two instances of commented out code, but not the respective
CON structure access code.

git-svn-id: https://svn.eduke32.com/eduke32@3702 1a8010ca-5511-0410-912e-c29ae57300e0
2013-04-22 10:35:44 +00:00
helixhorned dac18a99e9 A couple of trivial stylistic changes.
git-svn-id: https://svn.eduke32.com/eduke32@3694 1a8010ca-5511-0410-912e-c29ae57300e0
2013-04-21 19:55:03 +00:00
helixhorned 34a965721b OS X: Write eduke32.log to ~/Library/Logs unless -usecwd is given.
git-svn-id: https://svn.eduke32.com/eduke32@3689 1a8010ca-5511-0410-912e-c29ae57300e0
2013-04-17 20:34:39 +00:00
hendricks266 3cd85edac0 Fix the inventory icon selector's positioning to match v1.5 (reported by Fox [1]). While we're at it, move it according to ud.statusbarscale for aesthetic purposes.
[1] http://forums.duke4.net/topic/2961-paper-cuts-minor-bugs-and-annoyances/page__view__findpost__p__153060

git-svn-id: https://svn.eduke32.com/eduke32@3676 1a8010ca-5511-0410-912e-c29ae57300e0
2013-04-14 06:42:58 +00:00