While we're at it, factor out duplicate code into P_ChangeWeapon().
git-svn-id: https://svn.eduke32.com/eduke32@3015 1a8010ca-5511-0410-912e-c29ae57300e0
Specifically, use the elevator's own ceiling z height instead of searching
nextsectors with nextsectorneighborz(). This makes maps like L9.map (Spaceport
from N64) or DEMOUNT.MAP work. [Note well: work at all, since if it happened
to work before, that was pure coincidence.]
git-svn-id: https://svn.eduke32.com/eduke32@3013 1a8010ca-5511-0410-912e-c29ae57300e0
- duke3d.h: comment the timing marcos a bit more
- factor out smoothratio calculation
- (TICRATE/TICSPERFRAME) --> REALGAMETICSPERSEC
git-svn-id: https://svn.eduke32.com/eduke32@3007 1a8010ca-5511-0410-912e-c29ae57300e0
Also, correct some comments made in the demo source made earlier. Oops.
git-svn-id: https://svn.eduke32.com/eduke32@3006 1a8010ca-5511-0410-912e-c29ae57300e0
A new function maybe_append_ext() is added to common.c and used in the handling
of the -d<demo.edm> cmdline parameter and the 'map' OSD command with one
non-wildcard arg. (It's slightly different from the way the extension was
maybe-appended previously.)
git-svn-id: https://svn.eduke32.com/eduke32@3004 1a8010ca-5511-0410-912e-c29ae57300e0
Also, don't stop playback cycling at the 10th demo and show the demo
number when beginning to record one.
git-svn-id: https://svn.eduke32.com/eduke32@3003 1a8010ca-5511-0410-912e-c29ae57300e0
This currently says that MP saving/loading isn't supported, but doesn't
really work correctly. Also, properly bound-check the immediate argument
to CON's 'save' command and one more ... -> G_HandleAsync().
git-svn-id: https://svn.eduke32.com/eduke32@2999 1a8010ca-5511-0410-912e-c29ae57300e0
... and use it in three places. In two of these uses,
1) CON {read,write}arrayfromfile and
2) G_SavePlayer,
display an error message if the file name such generated is too long.
In the CON commands of 1), also error out if the file couldn't be opened.
git-svn-id: https://svn.eduke32.com/eduke32@2997 1a8010ca-5511-0410-912e-c29ae57300e0
A macro MAYBE_FCLOSE_AND_NULL(fileptr) is introduced in compat.h that does
what it says.
git-svn-id: https://svn.eduke32.com/eduke32@2995 1a8010ca-5511-0410-912e-c29ae57300e0
This is one of the cases where the duplicated code has minor modifications
at each site. These are handled by function args here.
git-svn-id: https://svn.eduke32.com/eduke32@2983 1a8010ca-5511-0410-912e-c29ae57300e0
For reference, they are the following:
- cache1d.c: suckcache()
- build.c: compare_wall_coords()
- make switch-invisible heuristic
- Mapster32: old sprite search
- Mapster32: manual z range
- m32script: read/writearray, qgetsysstr
- menus.c: savetemp()
git-svn-id: https://svn.eduke32.com/eduke32@2981 1a8010ca-5511-0410-912e-c29ae57300e0
Playing around with Coccinelle's semantic patches... be prepared for more.
git-svn-id: https://svn.eduke32.com/eduke32@2979 1a8010ca-5511-0410-912e-c29ae57300e0
Well, this never worked anyway, but invoking demons flying out of your
nose is never a good idea.
git-svn-id: https://svn.eduke32.com/eduke32@2977 1a8010ca-5511-0410-912e-c29ae57300e0
Note that since setting RETURN did nothing before, there is no backwards compatibility to uphold. Therefore, setting RETURN to 1 will cause the pistol to be selected, not disable the event. Set RETURN to -1 to cancel switching.
git-svn-id: https://svn.eduke32.com/eduke32@2976 1a8010ca-5511-0410-912e-c29ae57300e0
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
The spawn-time SE 17 setup uses nextsectorneighborz() which can fail
(return -1) on some circumstances and would cause an OOB sector[] access.
git-svn-id: https://svn.eduke32.com/eduke32@2971 1a8010ca-5511-0410-912e-c29ae57300e0
This is mostly for debugging, since currently, Mapster32 restores sprites
not in the same order as the original sprite index order. Also, expose
this option from map2text.lua and mapdiff.sh.
git-svn-id: https://svn.eduke32.com/eduke32@2968 1a8010ca-5511-0410-912e-c29ae57300e0
Basically, base palettes with lower indices trump higher ones. For example,
when one player is underwater and the other above, the normal palette takes
precedence.
git-svn-id: https://svn.eduke32.com/eduke32@2955 1a8010ca-5511-0410-912e-c29ae57300e0
Currently, the only kinds of tint that can be applied simultaneously are
one "palfrom" per player, plus one loogie tint per player. Each palfrom
still overrides the preceding one. However, this is not a big problem IMO
since palfroms decrease at the same rate (loogie tint decreases at half the
speed). This change is especially good for the splitscreen mod, since now
the tints of the two players won't compete with each other. See the comment
in the source for some properties of the blending formula.
git-svn-id: https://svn.eduke32.com/eduke32@2954 1a8010ca-5511-0410-912e-c29ae57300e0
A debug macro to test tints being stuck at the least intense non-zero value
is provided in engine.c.
git-svn-id: https://svn.eduke32.com/eduke32@2952 1a8010ca-5511-0410-912e-c29ae57300e0
Reverved quotes are ones like "Killed by xxx". Since they're only
shown for the first player for now, printing them in the upper part
makes more sense (in above/below split, the first player is above).
git-svn-id: https://svn.eduke32.com/eduke32@2950 1a8010ca-5511-0410-912e-c29ae57300e0
To enable it, the HUD-less (maximized) screen size must be selected.
git-svn-id: https://svn.eduke32.com/eduke32@2944 1a8010ca-5511-0410-912e-c29ae57300e0
Using the players's cursectnum instead of "updating" the sectnum means that it
won't glitch on SoS. The z clamping (basically a port of some code from
G_DrawRooms) is so that the view won't be drawn from under the floor when shrunk.
git-svn-id: https://svn.eduke32.com/eduke32@2939 1a8010ca-5511-0410-912e-c29ae57300e0
This fixes the screen keeping the bluish tint even after shattering a
frozen player in the splitscreen mod.
git-svn-id: https://svn.eduke32.com/eduke32@2938 1a8010ca-5511-0410-912e-c29ae57300e0
Using rotatesprite with bit 8 clear (scale to viewport) but using
fullscreen clipping bounds is never what we want. Also, tweak for
fake multi.
git-svn-id: https://svn.eduke32.com/eduke32@2932 1a8010ca-5511-0410-912e-c29ae57300e0
This uses the new rotatesprite bit introduced earlier. Also, allow the
HUD-less screen size.
git-svn-id: https://svn.eduke32.com/eduke32@2931 1a8010ca-5511-0410-912e-c29ae57300e0
I checked all direct and transitive uses of that function and am fairly
confident that it is never used.
git-svn-id: https://svn.eduke32.com/eduke32@2930 1a8010ca-5511-0410-912e-c29ae57300e0
ROTATESPRITE_MAX is moved to build.h and all orientation bits from CON commands
using rotatesprite are ANDed with (ROTATESPRITE_MAX-1). Some of the functions
use ROTATESPRITE_MAX for different internal purposes, which will not be exposed
to CON now (a good thing). Also, dorotspr_handle_bit2 is made clearer.
git-svn-id: https://svn.eduke32.com/eduke32@2929 1a8010ca-5511-0410-912e-c29ae57300e0
The black translucent background underneath the user map list will now
be drawn with a shade 32 tile 0 instead of tile BLANK, since I've seen
the latter being replaced in some mod. Also, it will look the same
regardless of screen aspect.
git-svn-id: https://svn.eduke32.com/eduke32@2928 1a8010ca-5511-0410-912e-c29ae57300e0
It seems like I broke the blitty/patchy way of drawing it with one of
the last commits.
git-svn-id: https://svn.eduke32.com/eduke32@2926 1a8010ca-5511-0410-912e-c29ae57300e0
This really fixes clearing the borders to the left and right with widescreen
and hud_bgstretch=0. Also, it seems to fix glitches when the "screen size"
is small (ud.screen_size is large).
git-svn-id: https://svn.eduke32.com/eduke32@2924 1a8010ca-5511-0410-912e-c29ae57300e0
Classic HUD now has correct aspect in widescreen modes, so with the full status
bar, there may be patches of free room left to the left and right.
git-svn-id: https://svn.eduke32.com/eduke32@2914 1a8010ca-5511-0410-912e-c29ae57300e0
setaspect(), which is called by setaspect_new, already uses the *dimen variables,
so it's the same thing done twice. Now, a change from the original full status
bar to the original mini status bar keeps the horizontal FOV again and only
bumps the view a little higher, as with the classic aspect determination.
git-svn-id: https://svn.eduke32.com/eduke32@2913 1a8010ca-5511-0410-912e-c29ae57300e0
Also, change type of g_numPlayerSprites (global and mapstate) from inconsistent
uint8_t/char to int8_t.
git-svn-id: https://svn.eduke32.com/eduke32@2897 1a8010ca-5511-0410-912e-c29ae57300e0
This makes sounds like DUKE_GET (item pickup) be heard for the second player
in the splitscreen mod, too.
git-svn-id: https://svn.eduke32.com/eduke32@2890 1a8010ca-5511-0410-912e-c29ae57300e0
This includes mirrors, rooms and masks. Any value other than 0 or 1
that is returned is considered an error (reserved for future use).
git-svn-id: https://svn.eduke32.com/eduke32@2889 1a8010ca-5511-0410-912e-c29ae57300e0
Of course, it still affects the whole screen. Handles pain and lizard spit.
git-svn-id: https://svn.eduke32.com/eduke32@2886 1a8010ca-5511-0410-912e-c29ae57300e0
The sound distance is the minimum of the two. Both point sources as well
as MUSICANDSFX ambient sound is handled.
git-svn-id: https://svn.eduke32.com/eduke32@2885 1a8010ca-5511-0410-912e-c29ae57300e0
The two instances in S_PlaySound3D() and S_Update() were slightly
different as far as sequencing is concerned. However, I think making
it the same has only benefits and may fix some popping sounds when
starting to play a sound and updating it with a different distance
value on the second buffer fill.
git-svn-id: https://svn.eduke32.com/eduke32@2884 1a8010ca-5511-0410-912e-c29ae57300e0
The story: Duke3D 1.5 source had "short frags[MAXPLAYERS][MAXPLAYERS]" and
"clearbufbyte(&frags[0][0],(MAXPLAYERS*MAXPLAYERS)<<1,0L);". In r1625,
g_player[].frags[MAXPLAYERS] was changed from an array of int32_t to one of
uint8_t, but the clearing code
("clearbufbyte(&g_player[i].frags[0],MAXPLAYERS<<1,0L);") stayed. In r2201, I
rewrote clearfrags() under the assumption that it really is supposed to clear
stuff beyond .frags[].
The moral:
1. Write clean code.
2. Use sizeof.
3. Write clean code!
git-svn-id: https://svn.eduke32.com/eduke32@2878 1a8010ca-5511-0410-912e-c29ae57300e0
This makes the code rather more readable in some places. Unlike the two
preceding commits, this one is actually purely textual replacement.
git-svn-id: https://svn.eduke32.com/eduke32@2877 1a8010ca-5511-0410-912e-c29ae57300e0
Functions affected are G_Move* in actors.c and A_Shoot in player.c.
Here, the p variable had function scope, now it's redeclared in shorter
blocks. I'm still relatively sure that no observable behavior was changed,
though not as sure as in part 1. Also, some dead assignments and the like
are eliminated.
git-svn-id: https://svn.eduke32.com/eduke32@2876 1a8010ca-5511-0410-912e-c29ae57300e0
The p variable (sometimes named differently) has short scope in all cases,
so I'm almost sure that the replacements amount to an identity transformation.
git-svn-id: https://svn.eduke32.com/eduke32@2875 1a8010ca-5511-0410-912e-c29ae57300e0
... against invalid weapon indices and arguments accessed from arrays/structs.
git-svn-id: https://svn.eduke32.com/eduke32@2873 1a8010ca-5511-0410-912e-c29ae57300e0
Also, rewrite the mapastats iterator and the LIZTROOP hitscan timing
in terms of that.
git-svn-id: https://svn.eduke32.com/eduke32@2858 1a8010ca-5511-0410-912e-c29ae57300e0
Also fix error handling path in our_require(), i.e. when loadstring fails.
git-svn-id: https://svn.eduke32.com/eduke32@2857 1a8010ca-5511-0410-912e-c29ae57300e0
erratum in r2844 commit message:
ydim vs. bytesperline --> xdim vs. bytesperline
git-svn-id: https://svn.eduke32.com/eduke32@2849 1a8010ca-5511-0410-912e-c29ae57300e0
This was narrowed to int8_t in r1625, breaking CON code that wanted
to lock the player for a longer time than 127 game tics.
git-svn-id: https://svn.eduke32.com/eduke32@2847 1a8010ca-5511-0410-912e-c29ae57300e0
The tiles used are BIGHOLE (1141) and VIEWBORDER (3250). Ideally we'd draw the
console background using something specially-coded instead of rotatesprite if
it's fully black anyway.
git-svn-id: https://svn.eduke32.com/eduke32@2846 1a8010ca-5511-0410-912e-c29ae57300e0
If input is cleared before, it can become impossible to cancel the video
when decoding and displaying a frame takes longer than a frame.
git-svn-id: https://svn.eduke32.com/eduke32@2833 1a8010ca-5511-0410-912e-c29ae57300e0
On an AMD Phenom II X4 system with generic memory modules, this brings down
the mean time for this conversion from 16.5 to 10.5 ms.
(GCC 4.6.1, optimized build)
git-svn-id: https://svn.eduke32.com/eduke32@2830 1a8010ca-5511-0410-912e-c29ae57300e0
The event is run after drawing the scene, but before the overlays. To
make a screenshot from a script, set DOSCRSHOT to non-zero. It will then
be scheduled to run once after the drawing but before the above-mentioned
event. The screenshots will be called mcapXXXX.{png,tga}.
git-svn-id: https://svn.eduke32.com/eduke32@2818 1a8010ca-5511-0410-912e-c29ae57300e0
The editor colors are the ones listed on page 9 of the Mapster32 built-in help.
git-svn-id: https://svn.eduke32.com/eduke32@2816 1a8010ca-5511-0410-912e-c29ae57300e0
The map iterator now has init/finish capability, making it possible to
write scripts that aggregate data over multiple map files. One such example
calculates some statistics, the other loads art metadata and looks for
red walls with non-pow2 ysize tiles.
git-svn-id: https://svn.eduke32.com/eduke32@2814 1a8010ca-5511-0410-912e-c29ae57300e0