Commit graph

10124 commits

Author SHA1 Message Date
Kp 6dd25cc064 Update num_kills_level/num_kills_total for remote kills
When a remote player destroys a robot, account it on player #0 so that
materialization centers track destroyed robots.  This is required since
player #0 is the only one to generate new robots.

Reported-by: Mako88 <https://github.com/dxx-rebirth/dxx-rebirth/issues/132>
Reported-by: Sirius-TR <https://github.com/dxx-rebirth/dxx-rebirth/issues/386>
2018-04-30 01:11:29 +00:00
Kp eec2fb39d6 Update num_kills_level/num_kills_total in multiplayer
Materialization centers ("Matcens") have a governor to prevent
overrunning the level in robots.  However, due to a logic ordering
error, multiplayer games failed to record how many robots had been
destroyed, so for the purpose of detecting whether there were currently
"too many" robots in play, the game pretended that no robots had ever
been destroyed.  Therefore, once enough robots had been created to reach
the "too many" threshold, matcens stopped generating robots, regardless
of how efficiently the player(s) had been destroying robots.

Reported-by: Mako88 <https://github.com/dxx-rebirth/dxx-rebirth/issues/132>
Reported-by: Sirius-TR <https://github.com/dxx-rebirth/dxx-rebirth/issues/386>
2018-04-30 00:54:16 +00:00
Kp 685137d5f5 Fix infinite loop in newmenu default handler
If no character matches the typed character, the loop should exit when
`lb->citem == cc`, which should happen after every entry is visited
once.  However, if no item is selected, `lb->citem == -1`, and `cc` is
never `-1`, so the exit path never triggers.  Rewrite the loop to be
bounded by number of steps, rather than bounded by returning to a
particular offset.  This also protects against undefined behavior if the
menu had zero elements.
2018-04-28 21:58:46 +00:00
Kp 3201097be8 Adjust issue template formatting 2018-04-28 04:36:11 +00:00
Kp 9be90bffde Merge pull #383 "Fix FPS." to github/master 2018-04-28 04:08:28 +00:00
Kp 861b5b5b73 Add initial draft of issue template 2018-04-27 06:09:30 +00:00
Ronald M. Clifford 6aff08408a Ensure FrameTime > 0 before starting the frame. 2018-04-26 20:27:50 -07:00
Ronald M. Clifford c514e650c3 Fix FPS locking and FPS display implementations. 2018-04-23 15:33:43 -07:00
Ronald M. Clifford a9fb3c9df9 Add missing glDisableClientState call. 2018-04-22 23:31:27 -07:00
Kp 80ee9f9249 Merge pull request #376 "Update SDLMain.m" to github/master
Reviewed-by: kreatordxx <https://github.com/dxx-rebirth/dxx-rebirth/pull/376#issuecomment-383352781>
2018-04-23 05:09:52 +00:00
Ronald M. Clifford e9d36a29c1 Fix Blocky Filtered option.
[Kp: as discussed in pull #377
<https://github.com/dxx-rebirth/dxx-rebirth/pull/377>, the previous
implementation requested a parameter combination not permitted by
OpenGL.  At best, this error was silently ignored.  Fix the error by
falling through to a switch case statement that sets valid parameters.]
2018-04-23 05:07:15 +00:00
derhass 38815ba10b change SYNC_GL_AUTO mode to disable GL sync if VSync is turned off
Users with disabled VSync might not expect any forced waiting on the GPU,
and the GL sync methods were intented to fix issues with VSync only,
so the new heuristic for SYNC_GL_AUTO is to enable GL sync only if
VSync is enabled, too.

Users can still request to use a specific GL sync method via the
-gl_syncmethod switch, independent of the VSync setting.

[Kp: folded `else { if () }` into `else if ()` to avoid moving
`ogl_have_ARB_sync` lines.  Original change visible at
<https://github.com/dxx-rebirth/dxx-rebirth/pull/381>.]
2018-04-23 04:57:48 +00:00
Ronald M. Clifford 19dbc3c13c
Fix FPS. 2018-04-22 19:28:20 -07:00
derhass 8e43a845b3 handle multiplayer network packets during SYNC_GL_FENCE_SLEEP wait loop
This mirrors the logic from calc_frame_time(). When VSync is enabled,
waiting for the previous frame to complete might induce long wait periods,
up to the complete frame time, so we should also handle multiplayer there.

For the other sync modes, the GL calls will simply block, so we can't do
anything about that (except going multithreaded, but that's a totally
different can of worms). Note that even without sync, the SwapBuffers()
call in gr_flip() may also block if VSync is on (and enough frames are
queued up), so the issue is not the GL sync code itself.

SYNC_GL_FENCE_SLEEP is now probably the nicest mode for multiplayer
with VSsync, as it is the only one which has the potential to continue
handling multiplayer packets during the wait for VBlank time.
2018-04-22 18:14:34 +02:00
C.W. Betts c4417aafb1 Update SDLMain.m:
10.9 changed how applications were launched, making the old method of detecting a Finder launch fail.
2018-04-16 16:19:36 -06:00
Kp fca9750105 Add utility script for converting HAM to/from json
This script was written years ago and has sat unused since then.
Recently, someone asked for a copy, so I may as well publish it.  The
HXM support may not have been tested, but the base HAM support can
successfully deconstruct Vertigo and reassemble a bit-wise identical
copy.
2018-04-15 21:48:32 +00:00
Kp 8a16296eb4 Fix -Wunused-variable warning in PNG screenshot code
Global `Viewer` was copied to local `viewer`, and the local should have
been used in this block.  Instead, the global was incorrectly used.
gcc-5 warns for this unused variable.  gcc-6 and gcc-7 incorrectly do
not warn.

Reported-by: Jayman2000 <https://github.com/dxx-rebirth/dxx-rebirth/issues/375>
Fixes: 131c1b9f4d ("Add support for PNG screenshots")
2018-04-15 19:43:38 +00:00
Kp 48b31d84f3 Move FPS to right side and low
Mako88 requests, as have others in the Rebirth forum, that the FPS
indicator be placed on the right side.  Moving to the right side was
quick.  Moving it low, handling all the different rendering combinations
(cockpit, statusbar, fullscreen; standard vs alternate; single player vs
multiplayer), and not overlapping anything in any of them was time
consuming.

If anyone wants more changes in this area, the existing modes ought to
be revisited and unified.  As is, there are pointless inconsistencies
among the modes, which makes it unnecessarily difficult to position an
element correctly.

Requested-by: Mako88 <https://github.com/dxx-rebirth/dxx-rebirth/issues/122>
2018-04-14 21:36:50 +00:00
Kp 8096af91da Add support for shuffling powerups in anarchy games 2018-04-12 04:19:35 +00:00
Kp ce5d1005dd Restore padding to workaround menu sizing bug
Commit d580328 eliminated junk whitespace in the individual line items
for joinable games.  Unfortunately, this whitespace was not junk.  It
was an undocumented workaround (possibly even unknowing workaround) for
a bug that undercounts the space required to show the header.  Restore
the "junk" padding to force the window back to its old width.

Reported-by: Mako88 <https://github.com/dxx-rebirth/dxx-rebirth/issues/374>
Fixes: d580328698 ("Combine direct_join allocations")
2018-04-11 04:18:37 +00:00
Kp 732bbd3395 Round screen width/height up to next multiple of 4
Mako88 reports incorrect images captured when using a screen resolution
of 1366x768.  1366 is not a multiple of 4.  Debugging also shows memory
corruption at this resolution, as Mesa writes off the end of the
allocated buffer.  Padding the buffer to tolerate these writes is
insufficient, as libpng then crashes with an alignment fault trying to
read unaligned data from the buffer.  All these problems are eliminated
by rounding the width and height to the next multiple of 4.

Reported-by: Mako88 <https://github.com/dxx-rebirth/dxx-rebirth/issues/373>
Fixes: 131c1b9f4d ("Add support for PNG screenshots")
2018-04-10 04:13:49 +00:00
Kp 771eecf695 Fix ambient sound effects
Ambient sound effects have always been buggy in certain topologies,
since `ambient_mark_bfs` refuses to cross its own path.  Consider a
corridor:

 L _ _ _ _ _ _ _ _ _ _
     _     _
     _     L

Where L is a lavafall emitting sound, whitespace is insignificant, _ is
a segment, * is a tagged segment, and / is a segment that should be
tagged, but is not.  Let the leftmost L be a lower number segment than
the lower L.  Sound propagation after the first step is:

 L * * * * * _ _ _ _ _
     *     _
     *     L

After the second step, it should be:

 L * * * * * * * * _ _
     *     *
     *     L

However, `ambient_mark_bfs` will stop when it hits the intersection, so
instead the result is:

 L * * * * * / / / _ _
     *     *
     *     L

To further confuse the issue, emitter segments are processed in memory
order, so if the leftmost L is a higher index segment than the lower L,
the lower L will be processed first and the steps will be:

 L _ * * * * * * * _ _
     _     *
     _     L

 L * * * * * * * * _ _
     /     *
     /     L

Rewrite the propagation to record the travel depth remaining at each
node, and permit it to cross a segment with a lower depth remaining than
the current step.  This still stops early when traversal attempts to
backtrack over itself, but permits it to visit, tag, and cross segments
that were previously visited by a different emitter.
2018-04-09 00:58:28 +00:00
Kp 90d2a61c1d Simplify visited_segment_mask_t 2018-04-09 00:58:28 +00:00
Kp 25d623fac5 Mark buddy_message_* functions as printf format
clang issues -Wformat-nonliteral when `vsnprintf` is passed the format
string from its caller.  This is generally not useful.  Fortunately, the
warning can be suppressed by annotating the function as format(printf).
Presumably, this is because clang now trusts that the caller would have
been warned for a bad format string.

Reported-by: kreatordxx <https://github.com/dxx-rebirth/dxx-rebirth/issues/369>
Fixes: dc79bb8e4a ("Remove hack for bypassing buddy time restriction")
2018-04-03 03:20:08 +00:00
Kp 6e9208efcd Simplify test for corrupt IFF file
clang rightly warns for `if (!var&1)`, which parses as `if (!(var &
1))`, which is probably not what the original author intended.
Unfortunately, the author never commented what *was* intended.  The
author might have meant to reject any row with an even length (`if
(!(var & 1))`, but that seems strange in this context.  Remove the `&
1`, which retains the sense of what the code has always done.
2018-04-03 03:20:08 +00:00
Kp 91e7d2960e Switch do_silly_animation robot angle to reference
clang warns for taking the address of unaligned data, but not for taking
a reference to it.  It should warn for both.  The data should be fixed
not to be unaligned, but for now, this change will quiet the warning.
2018-04-03 03:20:08 +00:00
Kp c9da856a90 Fix struct/class class-key mismatch in mglobal
clang warns when a type is declared with `struct`, then instantiated
with `class`.  Change the declaration to `class` to match the
instantiation.
2018-04-03 03:20:08 +00:00
Kp f869a16e35 Move Debris_object_count into d_level_object_state 2018-04-02 03:39:51 +00:00
Kp 64690c3ce8 Fix clang build of similar/main/weapon.cpp
OS X clang warns when a variable is captured but not used.  Linux gcc
does not.  Remove the unused variable.

Reported-by: kreatordxx <https://github.com/dxx-rebirth/dxx-rebirth/issues/368>
Fixes: 7da64d3782 ("Add new autoselect-while-firing mode: "when firing stops"")
2018-04-02 03:39:51 +00:00
Kp e08ea9f29a Clear weapon hitobj list on level load 2018-03-31 21:53:01 +00:00
Kp 813d73eedd Pass vms_matrix &to vms_matrix_from_quaternion 2018-03-31 21:53:01 +00:00
Kp 45f59c384b Pass vms_matrix &to vms_quaternion_from_matrix 2018-03-31 21:53:01 +00:00
Kp 18af84a0ab Remove __attribute__((packed)) from quaternionpos
Packed structures cannot be passed by reference, may fail on
alignment-strict architectures, and are bad for performance even on
alignment-tolerant architectures.  Using them for anything other than an
abstract layout declaration is a mistake.  Remove
__attribute__((packed)).
2018-03-31 21:53:01 +00:00
Kp 9b028f26f2 Make eclip_num unsigned 2018-03-31 21:53:01 +00:00
Kp a3871cfefd Tighten eclip::dest_bm_num handling
Instead of testing for -1, test for any out-of-range value.
2018-03-31 21:53:01 +00:00
Kp 29c6d63daa Move flickering light state into structure 2018-03-31 21:53:01 +00:00
Kp 1097630e42 Simplify host_platform normalization
OpenBSD 6 uses `openbsd6` as its sys.platform.  Strip trailing numbers,
then remove the hack for converting `linux2` into `linux`.  This should
prevent compatibility problems when OpenBSD 7 is used.
2018-03-27 03:49:34 +00:00
Kp 4b39cca42e Clarify SConf output when rejecting a header
Commit 265af2b9e5 added an extra test for whether the header could be
preprocessed, but reused the string shown when an empty test program is
compiled.  This can confuse users since the same message is shown twice.
Differentiate the messages.

Fixes: 265af2b9e5 ("Extend SConf diagnostics for failed system headers")
2018-03-27 03:49:34 +00:00
Kp c368cf5ddd Simplify ai predicate functions
Many predicate functions only need to return zero/nonzero, and the
callers do not care about the particular value of nonzero.  Use this to
eliminate loads of explicit `1`, instead returning a nonzero value
generated by the test.
2018-03-27 03:49:34 +00:00
Kp dc79bb8e4a Remove hack for bypassing buddy time restriction 2018-03-27 03:49:34 +00:00
Kp 57008a7164 Read/write flickering_light by reference 2018-03-27 03:49:34 +00:00
Kp 30c7e39ede Fix d_marker_state method for gcc-5
gcc-5 rejects `constexpr bool DefiningMarkerMessage() const` because
`d_marker_state` is not literal.  Later versions of gcc accept this, but
the `constexpr` is not useful here since one term is a runtime variable.
Remove `constexpr`.

Also, modify the definition of `marker_message_text_t` and
`d_marker_state` to encourage the compiler to initialize `MarkerState`
at compile time instead of load time.

Fixes: 49a4ac1c0e ("Move more marker state to d_marker_state")
2018-03-24 21:33:29 +00:00
Kp 1527d14c2d Fix SConf png test for gcc-4.9
gcc-4.9 warns (and due to -Werror, errors) for `png_time pt{}` because
the members are not explicitly initialized.  This code is compiled, but
never run, so the explicit initialization is unnecessary.  Later
versions of gcc accept both versions of this code without complaint.

Fixes: 131c1b9f4d ("Add support for PNG screenshots")
2018-03-24 21:33:29 +00:00
Kp ac29854007 Reset boss teleport time on boss initialization
User roncli reports[1] an original game bug that prevents boss
teleportation from operating correctly if the program is not restarted
between each campaign.  This is another case of a global variable being
used improperly.  Reset the relevant variables when the boss is
initialized.

[1] https://github.com/dxx-rebirth/dxx-rebirth/issues/366#issuecomment-373199624
2018-03-15 04:05:42 +00:00
Kp e8645b2062 Pass vertex factory to compute_center_point_on_side 2018-03-12 03:43:47 +00:00
Kp 53a1d5f9ce Pass vertex factory to compute_segment_center 2018-03-12 03:43:47 +00:00
Kp ad8fd0f871 Pass valptridx factories to obj_relink 2018-03-12 03:43:46 +00:00
Kp e2b24b37d5 Pass d_level_object_state to reset_objects 2018-03-12 03:43:46 +00:00
Kp 44bba9d2a2 Pass valptridx object factory to obj_link 2018-03-12 03:43:46 +00:00
Kp daf87ac23a Pass valptridx object factory to obj_link_unchecked 2018-03-12 03:43:46 +00:00