Commit graph

1747 commits

Author SHA1 Message Date
Kp 1a5844e218 Move Vertices out of global scope 2018-12-30 00:43:57 +00:00
Kp 5873ccb71e Pass vcvertptr as context 2018-12-30 00:43:57 +00:00
Kp 317c56d683 Expand Highest_vertex_index inline
This will make future conversions easier.
2018-12-30 00:43:57 +00:00
Kp 65225680c1 Move Num_vertices into d_level_shared_vertex_state 2018-12-30 00:43:57 +00:00
Kp f87c503618 Move Viewer_eye to local scope 2018-12-30 00:43:57 +00:00
Kp 045afc2c56 Prefer const shared_segment & over vcsegptr_t 2018-12-30 00:43:57 +00:00
Kp 2f537133e8 Use vcobjidx_t for fvi ignore_obj_list
Enforce that callers provide vcobjidx_t, instead of permitting any type
compatible with objnum_t.
2018-12-30 00:43:57 +00:00
Kp aa9e6da297 Pass Dl_indices as context 2018-12-30 00:43:57 +00:00
Kp 25ecf31816 Pass context to bng_process_segment 2018-12-30 00:43:57 +00:00
Kp 7ffe09dd46 Pass context to wall_close_door_ref 2018-12-30 00:43:57 +00:00
Kp a9a9d1f26a Move WALL_IS_DOORWAY out of line
Writing it inline causes wall.h to depend on segment.h.
2018-12-30 00:43:57 +00:00
Kp 992f35feb8 Expand Num_walls to Walls.get_count()
This will simplify propagating use of Walls.
2018-12-13 02:31:39 +00:00
Kp 9745236c7e Expand Num_triggers to Triggers.get_count()
This will simplify propagating use of Triggers.
2018-12-13 02:31:39 +00:00
Kp e8fdf2b669 Pass context to wall update functions 2018-12-13 02:31:38 +00:00
Kp d550cfe680 Remove struct side 2018-12-13 02:31:38 +00:00
Kp 706a704c6d Move unique_side to unique_segment 2018-12-13 02:31:38 +00:00
Kp 1d550ec0df Fix check_header_includes=1 build 2018-12-13 02:31:38 +00:00
Kp 5a64ee5132 Add experimental support for larger cooperative games
- Raise the player limit to 8.
- Remove the logic that forces player counts up/down when switching
  between cooperative and deathmatch game modes.
- Add heuristics to add start positions for the extra players, since
  standard maps will not have the required number of starts.
2018-12-03 04:25:11 +00:00
Kp 35d91d389a Raise player life count storage from uint8_t to uint16_t
Reported-by: Buff Skeleton <https://forum.dxx-rebirth.com/showthread.php?tid=1096>
2018-12-01 01:58:37 +00:00
Kp a0ed5cb283 Pass Vclip as context 2018-10-21 00:24:07 +00:00
Kp 991f72a775 Add fwd-vclip.h 2018-10-21 00:24:07 +00:00
Kp 931ea05f41 Merge branch experimental/adlmidi into master
Add experimental support for using ADL MIDI instead of SDL for music
playback.  Support for ADL MIDI contributed by Github user jpcima.  This
feature is minimally supported by the core Rebirth team, but is included
as a courtesy so that users need not patch in support separately.

Suggested-by: jpcima <https://github.com/dxx-rebirth/dxx-rebirth/pull/408>
2018-10-18 02:19:15 +00:00
Kp a76487405c Make ADL MIDI runtime configurable
Add configuration file entries for number of chips, bank index, and
whether to use ADL MIDI.  Currently, there is no GUI for this.
Interested users must enable it via direct configuration file editing.
A menu interface will come later.
2018-10-18 02:18:56 +00:00
Kp e1d1cbb0ed Pass context to set_powerup_id 2018-10-08 03:58:48 +00:00
Kp e9c9943470 Pass context to update_object_seg 2018-10-08 03:58:48 +00:00
Kp 9360a41816 Move Guided_missile into d_level_object_state 2018-10-08 03:58:48 +00:00
Kp 3b168b38fd Make Viewer const object *
Viewing should not change anything.
2018-09-25 03:44:09 +00:00
Kp 91d6285751 Factor out shortening game/mission names 2018-09-22 04:31:21 +00:00
Kp 406be26de4 Pass d_level_shared_segment_state to validate_segment_all 2018-09-19 02:13:30 +00:00
Kp f7ad4d9b1a Pass segments to find_point_seg 2018-09-19 02:13:30 +00:00
Kp c2944896de Pass vertex factory to create_shortpos_native 2018-09-19 02:13:30 +00:00
Kp 9cedc53f52 Pass vertex factory to extract_orient_from_segment 2018-09-19 02:13:30 +00:00
Kp 1527785efd Pass vertex factory to validate_segment_side 2018-09-19 02:13:29 +00:00
Kp d71938e1a7 Pass vertex factory to create_walls_on_side 2018-09-19 02:13:29 +00:00
Kp bd58d5f825 Pass vertex factory to extract_*_vector_from_segment 2018-09-19 02:13:29 +00:00
Kp 82a2fa525c Pass Robot_info, valptridx factories to more methods 2018-09-19 02:13:29 +00:00
Kp 01512015a8 Move Num_segments to new d_level_shared_segment_state 2018-09-19 02:13:29 +00:00
Kp c56223ced4 Eliminate more uses of valptridx::operator-> 2018-09-19 02:13:29 +00:00
Kp e6ea981ab4 Generalize marker object number init 2018-09-09 01:00:39 +00:00
Kp c4cb930f8e Pass ObjectState to obj_delete 2018-09-09 01:00:39 +00:00
Kp 12b57e84e6 Switch most in-tree http:// links to https://
For each link given as http://, verify that the site is accessible over
https:// and, if so, switch to it.  These domains were converted:

* llvm.org
* clang.llvm.org
* en.cppreference.com
* www.dxx-rebirth.com
* www.libsdl.org
* www.scons.org
2018-09-02 00:57:29 +00:00
Kp facc1fe1f5 Fix check_header_includes=1 build 2018-08-29 01:47:42 +00:00
Kp dc0a405222 Factor out piggy bitmap loading code 2018-08-26 18:10:36 +00:00
Kp 32561c5d0a Use partial_range for piggy_does_bitmap_exist_slow 2018-08-26 18:10:36 +00:00
Kp a8d5f83770 Remove reset_walls
Nothing should access the unassigned walls, so there is no need to clear
them.
2018-08-12 21:08:07 +00:00
Kp 36ada21c0c Fold exploding walls into regular walls 2018-08-12 21:08:07 +00:00
Kp dc4fcf8a35 Flip sense of is_door_free 2018-08-12 21:08:07 +00:00
Kp 8257232ecc Pass wclip & to wall_set_tmap_num 2018-08-12 21:08:07 +00:00
Kp 8bbdeedeb2 Consolidate stuck object state
Move it to a structure.  Make all the modifiers methods.  Change all
callers of those methods to pass the structure.  This makes the stuck
object handling free of direct access to global game data.
2018-08-04 17:52:57 +00:00
Kp 57334255ac Simplify stuck object cleanup 2018-08-04 17:52:57 +00:00
Kp f491059ed7 Enable building with SDL2
This commit enables Rebirth to build with SDL2, but the result is not
perfect.

- SDL2 removed some sticky key support.  Rebirth may behave differently
  now in this area.
- SDL2 removed some key-repeat related support.  Rebirth may behave
  differently now in this area.
- SDL2 gained the ability to make a window fullscreen by sizing it to
  the desktop instead of by changing the desktop resolution.  Rebirth
  uses this, and it mostly works.
  - Resizing while in the automap does not notify the automap code, so
    the view is wrong until the player switches out of automap mode and
    back in.
- SDL2 changed how to enumerate available resolutions.  Since
  fitting the window to the desktop is generally more useful than
  fitting the desktop to the window, I chose to drop support for
  enumerating resolutions instead of porting to the new API.  Users can
  now enter an arbitrary window dimension and Rebirth will make an
  attempt to use it.
  - It might be useful to cap the window dimension at the desktop
    dimension, but that is not done yet.
  - Entering fullscreen mode through the Controls->Graphics submenu
    failed to notify the relevant subsystems, causing the rendered
    content not to rescale.  For now, compile out the option to toggle
    full screen through that menu.  Toggling through Alt+Enter works
    properly.

Despite these quirks, this is a substantial improvement over the prior
commit, where SDL2 cannot be used at all.  The remaining issues can be
resolved in future work.

References: <https://github.com/dxx-rebirth/dxx-rebirth/issues/82>
2018-07-28 23:22:58 +00:00
Kp d97afc2ad5 Retain directory structure in New Game dialog
User jcotton42 suggested copying a D2X-XL feature: preserving the
directory structure of the user's missions area when showing a New Game
dialog.  This was substantially more trouble than it should have been,
but the result is good.

Previously, the dialog presented all missions at any depth below the
starting point, and sorted them as if they were all in the root
directory.

Now:
- Empty directories are hidden entirely.  There is nothing for the user
  to do in them, so there is no point showing them.
- A directory with exactly one entry has that entry promoted into the
  parent, since there is no ambiguity about what the user would want.
  If the parent in turn has only that one promoted element when the scan
  of the parent finishes, then the element can be promoted up again.
  This continues until the root is reached or until a level has more
  than one entry.  For this purpose, both missions and directories count
  as entries.
- Directory entries are decorated to inform the user how many
  immediate subdirectories are present, how many missions are present
  immediately in the directory, and how many missions total are present,
  counting all subdirectories.  If there are zero immediate
  subdirectories, then the directory count is not shown.  For this
  purpose, directories that were hidden due to a lack of missions are
  not counted.
- Sub-dialog boxes for inner directories use a title that reminds the
  user of the path so far, and recaps the directory/mission statistics.
- On entry to the New Game dialog, if the last played mission is in a
  sub-dialog, appropriate sub-dialogs are opened so that the last played
  mission can be pre-selected.

Currently, there is no in-game override to return to the prior rollup
rules.

Requested-by: jcotton42 <https://github.com/dxx-rebirth/dxx-rebirth/issues/392>
2018-07-03 05:59:40 +00:00
Kp db80a88ad2 Improve error message on failure to load mission 2018-07-03 05:59:39 +00:00
Kp 30a83eec41 Eliminate some uses of valptridx::operator-> 2018-06-24 05:06:15 +00:00
Kp 6fca290663 Pass object& to read_flying_controls 2018-06-24 05:06:15 +00:00
Kp 0fd7e0e4ce Pass context arrays to WALL_IS_DOORWAY 2018-06-24 05:06:15 +00:00
Kp 3408e3a0cd Switch to shared_segment arguments where possible 2018-06-24 05:06:15 +00:00
Kp 0c3e99f14c Split side uses based on shared vs unique 2018-06-24 05:06:15 +00:00
Kp 2de3a1dd06 Pass unique_segment to objects_in 2018-06-24 05:06:14 +00:00
Kp 4ae88b6594 Pass only shared_segment to compute_segment_center 2018-06-24 05:06:14 +00:00
Kp 6d0d68d188 Split some segment uses based on shared vs unique
Leave `sides` in `shared_segment` to minimize churn.  Parts of it must
move to `unique_segment` before this project finishes.
2018-06-24 05:06:14 +00:00
Kp 144515ff88 Warn users about tracker NAT hole punch feature
The new tracker automatically exposes LAN games to the Internet.  This
surprised one user rather badly, prompting him to think he had been
hacked.  Add a first-host warning explaining the feature and asking the
user to choose whether to enable NAT hole punch.

Reported-by: Tourmeister <https://forum.dxx-rebirth.com/showthread.php?tid=943&pid=12179#pid12179>
References: <https://github.com/dxx-rebirth/dxx-rebirth/issues/372>
Fixes: 730879d733 ("... Added support for handling ACKs from tracker and Hole punching between game clients via tracker. ...")
2018-06-21 03:08:36 +00:00
Kp a0fd264133 Tighten checks on create_path_points parameters 2018-06-20 04:16:06 +00:00
Kp 2f4524d3c2 Add screenshot=none to disable screenshot support
Per comment from kreator, some Apple systems now ship without a working
print screen key.  It makes no sense to provide print screen support
bound to a key which does not exist.  Add `screenshot=none` and activate
it on OS X to remove the unreachable screenshot support.
2018-06-16 04:13:37 +00:00
Kp f51b7b6b20 Enforce separation of font X/Y scaling 2018-06-08 04:04:05 +00:00
Kp bde498894a Disallow operator=(T &&) && in valptridx
GCC std::remove_if overwrites removed elements using:

	*dstiter = move(*srciter);

This is fine for normal containers, but produces incorrect results when
*dstiter returns a proxy object instead of a reference.  In that case,
the proxy object is move-assigned from the source, then goes out of
scope.  If the move assignment did not write to underlying storage, as
valptridx proxy objects do not, then incorrect results occur.  This
broke ActiveDoor handling (fixed in 4a01fab66d98[1]) and has been a trap
waiting to recur.  Apply reference-qualifiers to valptridx objects so
that move-assignment requires an lvalue for the left-hand side.  This
permits normal use of move-assignment, but forces a compile error if
std::remove_if or similar are used on valptridx proxy objects.

[1]: 4a01fab66d
2018-06-08 04:04:05 +00:00
Kp f0157490dc Fix check_header_includes=1 build 2018-06-06 04:53:45 +00:00
Kp 93789f0666 Use valptridx for Dl_indices 2018-06-06 04:53:45 +00:00
Kp 1c1d92b399 Move valptridx factory iterator out to be generally available 2018-06-06 04:53:45 +00:00
Kp fda1eb851e Pass fonts to LINE_SPACING 2018-05-19 23:21:42 +00:00
Kp 3049476e11 Change LINE_SPACING to a static inline function 2018-05-19 23:21:42 +00:00
Kp 08446f0ab6 Pass font to gr_string,gr_printf 2018-05-19 23:21:42 +00:00
Kp 4a98e796ab Prevent stacking weapon rotation sounds
digi_play_sample_once is supposed to cancel prior instances of the
sound, but that functionality was lost in
21082c6db2.  As a result, the sound can be
stacked up to the limit of the engine.  Even when the functionality
existed, its implementation was wrong.

- Change these sounds to be attached to the player generating them.
- Pass the cancellation flag to other players when sending a sound.
- Send the full value of `volume`, rather than truncating it.
- Implement cancellation by killing and restarting the earlier version of a cancelled sound.
- Delete an ugly hack that prevented the patched logic from ever running.
- Fix an ancient quirk in digi_mixer that caused it to report all sounds as not playing, which then caused digi_sync_sounds to instantly cancel the new sound.

Reported-by: Mako88 <https://github.com/dxx-rebirth/dxx-rebirth/issues/88>
Reported-by: ryusei117 <https://github.com/dxx-rebirth/dxx-rebirth/issues/88#issuecomment-269597361>
Fixes: 21082c6db2 ("Added own channel management to SDL_mixer sound interface since the builtin channel management of this lib cannot handle our needs; Little code cleanup")
2018-05-13 03:14:34 +00:00
Kp 6ab28cb8cb Use enum for Difficulty_level 2018-05-12 18:24:19 +00:00
Kp ccc2a288f1 Simplify HUD_SCALE_X_AR, HUD_SCALE_Y_AR 2018-05-12 18:24:19 +00:00
Kp 3749ee2b74 Fix cvar -Wrestrict in gcc-8
Per C99, this code was always wrong.  The results of `snprintf` are
undefined if the target string array and one of the supplied input
arguments refer to the same buffer.  In practice, this particular usage
happened to work by wastefully copying a string onto itself, then adding
more content at the end.  Switch to appending properly, which also fixes
the gcc-8 -Wrestrict warning.

References: <https://github.com/dxx-rebirth/dxx-rebirth/issues/388>
2018-05-05 22:33:55 +00:00
Kp 6a8930cef0 Remove unnecessary inclusions of compiler-static_assert.h
Various files included compiler-static_assert.h to use the compatibility
macros for compilers that lacked a working C++11 static_assert.
However, some source files used static_assert without this inclusion,
and no one ever reported problems.  From this, assume that no one uses a
compiler which lacks C++11 static_assert.  Remove the inclusions that
were only for the compatibility macro.  Keep the inclusions that use the
assert_equal helper.
2018-05-05 22:33:55 +00:00
Kp 8096af91da Add support for shuffling powerups in anarchy games 2018-04-12 04:19:35 +00:00
Kp 90d2a61c1d Simplify visited_segment_mask_t 2018-04-09 00:58:28 +00:00
Kp f869a16e35 Move Debris_object_count into d_level_object_state 2018-04-02 03:39:51 +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 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 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
Kp 0db5a2104e Pass valptridx factories to obj_unlink 2018-03-12 03:43:46 +00:00
Kp d09478d88c Pass Objects to obj_attach 2018-03-12 03:43:46 +00:00
Kp 0067e33a8c Pass ObjectState to special_reset_objects 2018-03-12 03:43:46 +00:00
Kp a6b169afcc Move free_obj_list into d_level_object_state 2018-03-12 03:43:46 +00:00
Kp b63633db51 Move num_objects into d_level_object_state 2018-03-12 03:43:46 +00:00
Kp 1c92b448c8 Add d_level_object_state to wrap Objects and related data 2018-03-12 03:43:46 +00:00
Kp 2cac55d6c7 Raise max marker limit to 4 for cooperative games 2018-03-10 22:45:04 +00:00
Kp 49a4ac1c0e Move more marker state to d_marker_state 2018-03-10 22:45:04 +00:00
Kp 4d6b796874 Store MarkerObject as imobjidx, not objnum 2018-03-10 18:32:02 +00:00
Kp 7dee4ca49f Move MarkerMessage[] into wrapper d_marker_state
Also, fix an ancient bug with the automap handling of markers caused by
WET anti-pattern.
2018-03-10 18:32:02 +00:00
Kp 852ab312d5 Remove global Network_laser_track 2018-03-05 01:40:44 +00:00
Kp 131c1b9f4d Add support for PNG screenshots 2018-02-18 00:42:42 +00:00
Kp 22fe81666a Unify some control_info fields 2018-01-29 01:56:40 +00:00
Kp 1ffefa3029 Use partial_range for robot_get_anim_state 2018-01-29 01:56:40 +00:00
Kp d2612734a3 Fix compile error for !DXX_HAVE_CXX_BUILTIN_FILE_LINE
If !defined(DXX_HAVE_CXX_BUILTIN_FILE_LINE), the default value is
omitted, but the comma between values is still required.  The comma was
incorrectly guarded, so it was present only when a default value was
set.

Reported-by: kreatordxx <https://github.com/dxx-rebirth/dxx-rebirth/issues/361>
Fixes: 544fc0f893 ("Add support for increased precision of gamelog timestamps")
2017-12-27 05:39:07 +00:00
Kp 544fc0f893 Add support for increased precision of gamelog timestamps
- Enable display of subsecond (Linux: microseconds; Windows:
  milliseconds) precision on gamelog timestamps.
- Add disabled support for YYYY-MM-DD leaders on gamelog timestamps.
  Activate it by defining DXX_CONSOLE_TIME_FORMAT_YMD to true.
- Add disabled support for capturing caller __FILE__, __LINE__ in calls
  to con_printf, con_puts.  Activate it by defining
  DXX_CONSOLE_SHOW_FILE_LINE to true.  If captured, write those to
  gamelog after the timestamp and before the text.  This feature (and
  only this feature) requires that DXX_HAVE_CXX_BUILTIN_FILE_LINE be
  defined, which is conditional on if the compiler has __builtin_FILE()
  and __builtin_LINE().  If the compiler lacks this support, attempts to
  enable this feature are ignored.
- Switch to using GetLocalTime on Windows.
2017-12-06 05:14:32 +00:00
Kp 01e1b28d71 Replace useless printf with puts 2017-12-05 05:29:55 +00:00
Kp 7311712399 Compile out joystick key settings when DXX_MAX_JOYSTICKS=0 2017-12-05 05:29:55 +00:00
Kp c60c0352f0 Fix songs_play_file use for sdlmixer=0 2017-11-25 01:56:51 +00:00
Kp 5d4d3347e6 Remove unused found_poly 2017-11-01 02:01:20 +00:00
Kp 8d80300e0a Remove obsolete D1 hostage editor code
This code was part of a feature abandoned before retail.  It cannot be
usefully used in campaigns.  Remove it to reduce code size and simplify
later changes.
2017-10-14 17:10:31 +00:00
Kp 88832e3679 Use constexpr integral_constant for various magic numbers 2017-10-14 17:10:30 +00:00
Kp d7e97ca299 Remove write-only Escort_kill_object
Parallax never implemented Escort_kill_object because it was considered
too much work.  Remove the write-only vestiges of that feature.
2017-09-26 04:15:50 +00:00
Kp bba7e3a153 Move menu_number_bias_wrapper bias into type signature 2017-09-26 04:15:50 +00:00
Kp aeedadba89 Unify D1/D2 scrape_player_on_wall 2017-09-08 00:56:37 +00:00
Kp a24490033f Allow players to remove thief at level start
Commit f4b21088a0 ("Track vulcan ammo explicitly") fixed an original
retail bug that prevented the thief from stealing energy weapons,
because the thief could only steal weapons for which the player had ammo
and energy weapons never have ammo.  This went unremarked for several
years, until a recent report of the new semantics as a game-breaking
regression because the thief is now "ridiculously potent".

Address this report, as well as an intermittently raised issue from
various users over time, by adding two new knobs to both the single
player "Gameplay" menu and the multiplayer setup screen: "Remove Thief
at level start" and "Prevent Thief Stealing Energy Weapons".

"Remove Thief" deletes the thief object during level load.  It has no
impact on save games, and changing it after entering a level has no
effect on any thief already in the level.

"Prevent Thief Stealing" is checked at the moment of theft and, when
enabled, prevents stealing primary weapons other than Vulcan/Gauss.
This can be changed at will in single player and is immediately
effective.  In multiplayer, this option can only be changed by the game
host in the pre-game setup.

For both knobs, there is one pair of checkboxes to control this as a
player preference, which applies in single player games.  There is a
second pair of checkboxes in the multiplayer setup, which applies only
to multiplayer games.  Therefore, in multiplayer, the host chooses thief
settings and all clients use the host's choice.  The host may configure
the thief differently in multiplayer from how the host plays in single
player.

For users who wanted to remove the thief, no specific tally has been
kept for who requested it or when.  Now that the code is being updated,
this is thrown in as an easy addition.

Reported-by: MegaDescent <http://forum.dxx-rebirth.com/showthread.php?tid=980> (for the thief stealing energy weapons as a game-breaking regression)
2017-08-26 19:47:52 +00:00
Kp 4ea9ef5b0c Use reference for robot_info 2017-08-26 19:47:51 +00:00
Kp 3bcee35c7b Shrink some Netgame fields
For protocol compatibility, zero-pad the outbound messages.  Previously,
the upper bits were zero because the value fit in a byte.
2017-08-26 19:47:51 +00:00
Kp e859833f62 Use valptridx for Players
Currently, N_players is still a free variable and Players.count is
unused.  Future work will replace N_players with Players.count.
2017-08-13 20:38:32 +00:00
Kp 8b93c6a283 Make Bounty_target unsigned 2017-08-13 20:38:32 +00:00
Kp e18b95201c Tighten hoard record holder validation 2017-08-13 20:38:32 +00:00
Kp 4cf4ce38b0 Cache player references 2017-08-13 20:38:31 +00:00
Kp 6504853487 Use unsigned for Coop_view_player members 2017-08-13 20:38:31 +00:00
Kp aa56477742 Propagate objects_in arguments 2017-08-13 20:38:31 +00:00
Kp b4899aafac Pass vcvertptr to get_seg_masks 2017-08-11 23:43:54 +00:00
Kp 5eec2a5ce5 Use valptridx for Vertices 2017-08-11 23:43:54 +00:00
Kp c3a438b750 Pass draw_polygon_model orient by reference 2017-08-11 23:43:54 +00:00
Kp 7a51b26f91 Remove obsolete serial typedefs 2017-08-11 23:43:54 +00:00
Kp 32b65ce485 Simplify storing obsolete_primary_ammo 2017-08-11 23:43:53 +00:00
Kp 8c350ed5a5 Split drop_powerup path for dropping robots 2017-08-11 23:43:53 +00:00
Kp 47f1e1515a Move valptridx array typedef to appear earlier 2017-08-11 23:43:53 +00:00
Kp 1cfc8b3fbd Shrink on-stack multibuf to size of command 2017-08-11 23:43:53 +00:00
Kp 4ff9027b31 Add const-qualifiers to some multi functions 2017-08-11 23:43:53 +00:00
Kp 2a963ad077 Move multibuf into local scope
Many of these locals are wasteful, since they are always sized to the
biggest buffer required.  This is the minimal and safe solution.  Future
work will tune them to the correct size.
2017-08-11 23:43:53 +00:00
Kp 34ee376c84 Add alternate valptridx error reporting mechanisms 2017-08-11 23:43:52 +00:00
Kp e42d1c540e Move single-file defines out of mission.h 2017-08-11 23:43:52 +00:00
Kp 03cca2b3dc Track visited segments as a local
This fixes a subtle bug where a perfectly immobile player would reuse a
previous run.  In practice, players are not immobile.
2017-08-02 02:49:13 +00:00
Kp d1c6b89f17 Move dsx::segment -> dcx::segment
d2x::segment has all members of d1x::segment, as well as two new members
exclusive to d2x::segment.  Structure layout is such that d1x::segment
requires the same size allocation, and places anonymous pad members in
the locations that become named members in d2x::segment.  Thus, reusing
d2x::segment for d1x::segment does not change the size of the structure
nor the offsets of any members used.  This reuse may enable some
functions to be better shared by the dsx project.
2017-07-26 03:15:58 +00:00
Kp f16c4def1d Unify AI cloak setup
- Initialize AI cloak data in D1, too.
- Initialize reactor's idea of player position from init_ai_for_ship
2017-07-08 18:17:49 +00:00
Kp 596ecbb38d Rename segment::value to segment::station_idx
`value` is generic and unclear.  It is always meant to be used as an
index into the Station array, so rename it `station_idx` to show this.

Define and consistently use `station_none` to represent that no station
is assigned.
2017-07-08 18:17:49 +00:00
Kp 6767045a41 Shrink FuelCenter::Type to uint8_t to match special from struct segment 2017-07-08 18:17:49 +00:00
Kp 0645642465 Fix gcc-4.9 pch=1 extern conflict
Using precompiled headers includes vers_id.h into
similar/main/newdemo.cpp.  gcc-4.9 reports a conflict between vers_id.h
`extern const char g_descent_build_datetime[21]` and newdemo.cpp macro
generated `extern const char g_descent_build_datetime[]`.  The size is
only needed in the definition, so remove it from the declaration to
align with the macro-generated extern.
2017-07-08 18:17:48 +00:00
Kp 9421c31b5a Replace "compiler-type_traits.h" with <type_traits>
Delete stub "compiler-type_traits.h" header.  Redirect all uses to the
standard <type_traits> header.

git grep -wlz 'compiler-type_traits.h' -- '*.cpp' '*.h' | xargs -0 perl -p -i <<EOF
    BEGIN {
	    $i = 0;
    }
    if (($i == 1 && $_ eq "\n") || ($i < 2 && /^#include "/)) {
	    # First blank line or first user-include after a system-include.
	    # Print, then never again for this file.
	    print "#include <type_traits>\n";
	    $i = 2;
    } elsif ($i == 0) {
	    $i = 1 if (/^#include </);
    } elsif ($_ eq "#include \"compiler-type_traits.h\"\n") {
	    # Remove this line if found.
	    $_ = '';
    }
    # Reset state machine when moving to next file.
    $i = 0 if eof;
EOF
2017-06-25 20:46:03 +00:00
Kp adcf02e454 Expand tt:: indirection to std::
All supported compilers have an acceptable <type_traits>.  Commit
4cb3d46148 ("Move <type_traits> test to Cxx11RequiredFeature") made
<type_traits> support mandatory in August and no one has objected.
Remove the indirection and use namespace std directly for type_traits
members.
2017-06-25 20:46:03 +00:00
Kp b550a5aa13 Unify segment2_read
Early unification efforts missed this one because it was in gamemine.c
for Descent 1, but segment.c for Descent 2.  Move it to gamemine.cpp for
both, so that it can be static for both games.
2017-06-17 23:05:16 +00:00
Kp aa47435009 Remove write-only field FuelCenter::MaxCapacity
This is a remnant of a pre-retail design that allowed fuel centers to
be exhausted.  No one has ever asked for this mechanic, so remove
support for it.
2017-06-17 23:05:16 +00:00
Kp 73d92bb509 Make wclip::num_frames uint16_t 2017-06-17 23:05:16 +00:00
Kp 8a038de506 Tighten Marker_viewer_num validation 2017-06-10 03:31:03 +00:00
Kp 430f7832aa Move valptridx factories into array_managed_type 2017-06-10 03:31:03 +00:00
Kp 599ac9dee0 Always qualify valptridx type/factory
Previously, valptridx used PREFIX for allow-invalid+mutable, c#PREFIX
for allow-invalid+const, v#PREFIX for require-valid+mutable, vc#PREFIX
for require-valid+const.  Convert the types, factories, and all usage
sites to specify a qualifier for all four combinations:

	im#PREFIX -> allow-invalid+mutable
	ic#PREFIX -> allow-invalid+const
	vm#PREFIX -> require-valid+mutable
	vc#PREFIX -> require-valid+const

Changes to common/include/valptridx.h and common/include/fwd-valptridx.h
are manual.  All other changes are generated by:

	git grep -lz -e '\(obj\|seg\|clwall\|wall\|actdoor\|trg\)\(ptridx\|ptr\|idx\)\(_t\)\?\>' | xargs -0 sed -i -e 's/\<\(v\?\)\(\(obj\|seg\|clwall\|wall\|actdoor\|trg\)\(ptridx\|ptr\|idx\)\(_t\)\?\)\>/\1m\2/g'

for the 'm' prefix and:

	git grep -lz -e '\(obj\|seg\|clwall\|wall\|actdoor\|trg\)\(ptridx\|ptr\|idx\)\(_t\)\?\>' | xargs -0 sed -i -e 's/\<\([cm]\(obj\|seg\|clwall\|wall\|actdoor\|trg\)\(ptridx\|ptr\|idx\)\(_t\)\?\)\>/i&/g'

for the 'i' prefix.
2017-06-10 03:31:02 +00:00
Kp 806c76ce02 Fix label truncation when strlen(hats) + 1 < strlen(buttons)
Hat labels reserve an extra character for the arrow, which partially
masked this error.  When used buttons requires more characters than (1
+ used hats), the buffer had insufficient space and the label was
truncated.
2017-05-13 04:19:39 +00:00
Kp 1a1e669bc6 Pass vms_angvec &to draw_model_picture 2017-04-30 16:25:16 +00:00
Kp 79a4a19711 Pass player to init_player_stats_level 2017-04-30 16:25:16 +00:00
Kp edc3b93c9b Switch valptridx array_size error reporting to %lu
x86_64-w64-mingw32-g++ -Wformat handling misparses the std::size_t
format string, causing a spurious error.

    common/main/valptridx.tcc: In function 'void untyped_index_mismatch_exception::prepare_report(const char*, unsigned int, const void*, long int, const void*, const void*, char (&)[229], std::size_t)':
    common/main/valptridx.tcc:36:182: error: format '%u' expects argument of type 'unsigned int', but argument 7 has type 'std::size_t {aka long long unsigned int}' [-Werror=format=]

This occurs even though the processed text uses %I64u (which is correct
for a `long long unsigned int`), not %u as shown in the error message.

    static void prepare_report(const char *const filename, const unsigned lineno, const void *const array_base, const long supplied_index, const void *const expected_pointer, const void *const actual_pointer, char (&buf)[report_buffer_size], const std::size_t array_size)
    {
	snprintf(buf, sizeof(buf), "%s:%u: " "pointer/index mismatch:" " base=%p size=%" "I64u" " index=%li expected=%p actual=%p", filename, lineno, array_base, array_size, supplied_index, expected_pointer, actual_pointer);
    }

In practice, all such sizes will fit in `unsigned int` because they are
the dimension of an array of large structures.  Switch all platforms to
use `unsigned long`, which works everywhere and is at least as big as
`unsigned int`.  Using `unsigned long` produces the same size as
`std::size_t` on all platforms other than Win64, where `unsigned long`
is only 32 bits due to the strange LLP64 model Microsoft picked.
2017-04-22 21:23:55 +00:00
Kp 2dd4384d9d Move _WIN32_WINNT setup to SConf 2017-04-22 21:23:55 +00:00
Kp 466536b101 Remove abandoned powerup_cap_state
Commit b32298df5a ("Rewrite powerup cap
code to centralize logic") centralized powerup cap code in the
powerup_cap_state class.

Commit 901a554e96 ("New powerup management
code: Addeed functions and packet type to ...") removed all use of
powerup_cap_state, but left the dead implementation present.

Commit 479f5ed584 ("Fix 'format specifies
type 'unsigned short' but the argument has type 'unsigned char''
warning") switched the already dead (but still compiled) code from %hu
to %hhu to fix a warning on OS X.  Although the commit was written by
Chris, it was my suggestion to use %hhu.  I neglected to test Windows
before suggesting it, so the change went in even though Windows does not
accept %hhu; this broke the Windows build.  Fortunately, the code had
been dead for 11 months when the change was made, so the fix for Windows
is to remove the long dead code.
2017-04-22 21:23:55 +00:00
Kp 9cfbf44834 Pass object &to toggle_headlight_active 2017-04-22 21:23:55 +00:00
Kp 170d0ac777 Pass canvas &to nm_draw_background 2017-04-08 16:48:20 +00:00
Kp b358946924 Show host address/port in timeout message 2017-03-25 19:34:02 +00:00
Kp d5ed019014 Add experimental MP-aware mouselook 2017-03-25 19:34:02 +00:00
Kp 2170c10eed Move MAX_CONTROLCEN_LINKS into control_center_triggers 2017-03-18 18:07:37 +00:00
Kp 8d6594effe Inline the sole use of MAX_FLICKERING_LIGHTS 2017-03-18 18:07:36 +00:00
Kp 829e95b6f8 Separate hoard/proximity tracking 2017-03-18 18:07:36 +00:00
Kp 104169dada Move multi_maybe_disable_friendly_fire to dcx 2017-03-18 18:07:36 +00:00
Kp 9878ba2311 Move intro_played to dsx 2017-03-18 18:07:35 +00:00
Kp 85eddb8d02 Pass canvas to render_endlevel_frame 2017-03-11 19:56:28 +00:00
Kp 970ce18410 Pass canvas to render_object 2017-03-11 19:56:27 +00:00
Kp 25c36d4b0e Pass canvas to draw_morph_object 2017-03-11 19:56:27 +00:00
Kp e1d0d0603f Pass canvas to draw_hostage 2017-03-11 19:56:26 +00:00
Kp f0707cb9bd Pass canvas to draw_powerup 2017-03-11 19:56:26 +00:00
Kp a55de34884 Pass canvas to Laser_render 2017-03-11 19:56:26 +00:00
Kp 753cbafe61 Pass canvas to render_terrain 2017-03-11 19:56:26 +00:00
Kp 113aa50a2a Pass canvas to draw_fireball 2017-03-11 19:56:25 +00:00
Kp 48d9f2cd19 Pass vclip to draw_vclip_object 2017-03-11 19:56:25 +00:00
Kp 450b3ec4f5 Pass canvas to draw_weapon_vclip 2017-03-11 19:56:25 +00:00
Kp 48a6adbe87 Pass canvas to draw_vclip_object 2017-03-11 19:56:25 +00:00
Kp bc11b3bf85 Pass const object to draw_object_tmap_rod 2017-03-11 19:56:25 +00:00
Kp 03043f944e Guard Headlights by if(D2)
Descent 1 has no headlight powerup.  Code to read headlights was
incorrectly added in 357e1b0144, but no code was added to write
headlights, so the Descent 1 lighting code checked for headlights that
never existed.  Guard the headlight global variables and the associated
logic with if(D2).

Fixes: 357e1b0144 ("Made lighting code work with actual RGB values and added feature to let certain objects emit colored dynamic light as well as let mine flash red when control center destroyed (OpenGL-only at the moment)")
2017-03-11 19:56:25 +00:00
Kp a6c8087815 Remove unused compute_object_light parameter rotated_pnt 2017-03-11 19:56:24 +00:00
Kp dfbcc02346 Pass const object to compute_object_light 2017-03-11 19:56:24 +00:00
Kp 84faf8aa73 Pass canvas to draw_object_blob 2017-03-11 19:56:24 +00:00
Kp 9ccddf5366 Pass canvas to draw_exit_model 2017-03-11 19:56:23 +00:00
Kp afb52a5a3e Pass canvas to draw_hud 2017-03-11 19:56:22 +00:00
Kp a19286437a Pass canvas to show_mousefs_indicator 2017-03-11 19:56:22 +00:00
Kp 4b6f42a962 Pass canvas to show_reticle 2017-03-11 19:56:22 +00:00
Kp 5e1b27120d Pass canvas to HUD_render_message_frame 2017-03-11 19:56:21 +00:00
Kp f5a17abbe8 Pass canvas to show_HUD_names 2017-03-10 01:22:28 +00:00
Kp 7410ad343c Pass canvas to render_mine 2017-03-10 01:22:28 +00:00
Kp 8542940b24 Pass canvas to render_frame 2017-03-10 01:22:27 +00:00
Kp 393e96b8d8 Unify SDL/OGL save_screen_shot
This simplifies maintenance and reduces the potential for inconsistency.
It also cleans up one existing inconsistency.
2017-03-10 01:22:27 +00:00
Kp fe7bb8d36b Use valptridx<wall>::magic_constant for wall_none 2017-03-04 22:25:54 +00:00
Kp a8c3a7f10b Alias Side_to_verts to Side_to_verts_int 2017-03-04 22:25:54 +00:00
Kp cebd2fd36d Pass object &to boss_init_all_segments
The index is not needed.
2017-03-01 02:48:41 +00:00
Kp 482dcf0ba3 Avoid temporarily moving boss while probing layout
Expose sphere_intersects_wall and call it directly from
boss_fits_in_seg, so that boss_fits_in_seg does not need to modify the
position and segment of the boss during the test.
2017-03-01 02:48:40 +00:00
Chris Taylor 19e4c07bb0 Bosses generated by a robot maker or even released by another robot will now teleport
Fixes issue #328.
2017-02-26 10:21:10 +08:00
Chris Taylor 32286ed4fc Play boss looping immediately on loading saved game
If boss has teleported before, even before a loaded state was saved, play the boss looping sound immediately when loading the saved game (if near the boss). Resolves issue #326.
2017-02-26 10:21:10 +08:00
Kp 8a89313ec4 Move compute_segment_center body to dcx 2017-02-22 03:05:44 +00:00
Kp 892d450022 Move compute_center_point_on_side body to dcx 2017-02-22 03:05:43 +00:00
Kp dc090958d1 Reduce D1 spreadfire cost
Reported-by: zicodxx <https://github.com/dxx-rebirth/dxx-rebirth/issues/322>
Analyzed-by: kreatordxx <https://github.com/dxx-rebirth/dxx-rebirth/issues/322#issuecomment-280896375>
Fixes: 10ff2b9ea2 ("Change Primary_weapon_to_weapon_info key to weapon_id_type")
2017-02-19 19:33:45 +00:00
Kp 6cd6189681 Never pass nullptr to ai_door_is_openable
When objp is nullptr, ai_door_is_openable assumes Buddy_objnum is a
valid object number, but this assumption is not guaranteed to be true.
When it is false, the game crashes.  This crash can be triggered by a
brain robot trying to make nearby robots snipe.

Fix the crash by passing the robot of interest.

Reported-by: Yarn <http://www.dxx-rebirth.com/frm/index.php/topic,2165.0.html>
2017-02-19 19:33:45 +00:00
Kp 859b399d20 Use mask for Secondary_last_was_super 2017-02-19 19:33:45 +00:00
Kp 7c658fd8cd Use mask for Primary_last_was_super 2017-02-19 19:33:44 +00:00
Kp a6cd87613c Pass polymodel &to free_model 2017-02-19 19:33:44 +00:00
Kp 1a7659897a Pass canvas to draw_model_picture 2017-02-19 19:33:44 +00:00
Kp 39071d124d Pass canvas to draw_polygon_model 2017-02-19 19:33:43 +00:00
Kp b918760b3f Move find_connect_side body to dcx 2017-02-19 19:33:38 +00:00
Kp b82d9d2b51 Move get_side_verts body to dcx 2017-02-19 19:33:38 +00:00
Kp 9821a77372 Simplify use of get_num_faces 2017-02-19 19:33:38 +00:00
Kp cdb193c053 Use unsigned for sides/verts in more places 2017-02-19 19:33:38 +00:00
Kp 0f00cf51b0 Make segment vertices unsigned 2017-02-19 19:33:37 +00:00
Kp ef928d39c0 Fix check_header_includes=1 gamemine.h 2017-02-19 19:33:37 +00:00
Kp 45d7c6da65 Fix check_header_includes=1 wall.h 2017-02-19 19:33:36 +00:00
Kp a815541ef5 Fix check_header_includes=1 poison.h 2017-02-19 19:33:36 +00:00
Kp 569d64e927 Propagate Hack_DblClick_MenuMode 2017-02-11 21:42:47 +00:00
Kp fb53bc9257 Pass canvas to player_dead_message 2017-02-11 21:42:46 +00:00
Kp 05905ced06 Pass font to gr_get_string_wrap 2017-02-11 21:42:44 +00:00
Kp d8638c6c89 Pass canvas to UP_ARROW_MARKER, DOWN_ARROW_MARKER 2017-02-11 21:42:43 +00:00
Kp 6b8f08142f Pass canvas to LINE_SPACING
Macro LINE_SPACING previously used global grd_curcanv implicitly.
Change it to take a canvas argument.  Change all callers to pass
grd_curcanv, so that usage is explicit.
2017-02-11 21:42:42 +00:00
Kp 03c43b1d7f Expand GWIDTH
As a macro, it always refers to the global grd_curcanv.  This interferes
with converting canvas handling to be an argument.  Expand GWIDTH so
that uses of grd_curcanv can be changed individually.
2017-02-11 21:42:42 +00:00
Kp cd8f408269 Pass canvas to draw_object_tmap_rod 2017-02-11 21:42:40 +00:00
Kp 227eb98c3e Pass player_info to do_cockpit_window_view 2017-02-11 21:42:31 +00:00
Kp 1a3d89aecf Use vsegptridx in editor group functions 2017-02-11 21:42:31 +00:00
Kp 7df99350dd Pass player to do_laser_firing_player 2017-02-08 23:34:41 +00:00
Kp 82d10b910c Pass player_info to allowed_to_fire_laser 2017-02-08 23:34:41 +00:00
Kp 98c9374a12 Simplify powerup_grab_cheat_all path
Movement handling has an ugly hack that tries to grab powerups near the
console player, but it reuses general collision handling and fails to
check whether the player is alive.

Add a liveness check.  Place the check so that it happens once, before
the objects are scanned, rather than being needlessly repeated for every
object.

Refactor the collision code to let the movement hack skip the parts it
does not need.

Reported-by: ryusei117 <https://github.com/dxx-rebirth/dxx-rebirth/issues/302#issuecomment-275816259>
2017-02-04 23:10:29 +00:00
Kp 59bad96d5f Add back homing weapons cheat for D2
Kreator proposed restoring the Descent 2 cheat that grants homing
capability to all weapons.  This commit implements that proposition,
with some changes to the implementation details.

Based-on-patch-by: Chris Taylor <chris@icculus.org>
Requested-by: Chris Taylor <https://github.com/dxx-rebirth/dxx-rebirth/pull/318>
2017-01-29 21:02:48 +00:00
Chris Taylor 2f4db4a048 Player keeps any keys collected on a secret level even if they die on the secret level 2017-01-29 07:54:43 +08:00
Kp fc12995d89 Add options for reduced-size valptridx error reporting 2017-01-28 18:12:20 +00:00
Chris Taylor 30b5ef7c73 Create robot_create function and use it 4x
Contains 2 calls - to obj_create and init_ai_object. For safety reasons and tidiness compared to using obj_create directly. The call to init_ai_object in recreate_thief was already redundant.
2017-01-22 17:56:50 +08:00
Kp fd2c8df74e Raise MAX_WALLS to 255
Raise D2 MAX_WALLS to 255, since Walls[254] is not special.  Synchronize
D1 MAX_WALLS to D2 MAX_WALLS to fix D1 Level of the World BRDECON.

Requested-by: Ryusei117 <http://www.dxx-rebirth.com/frm/index.php/topic,1760.msg22509.html#msg22509>
2017-01-18 03:06:02 +00:00
zico b644ab575c Raised MAX_DELTA_LIGHTS to 32000. 2017-01-15 14:12:03 +01:00
zico 5acbb949de Raised MAX_NUM_FUELCENS and MAX_ROBOT_CENTERS to 128. 2017-01-15 13:43:02 +01:00
Kp 092d947830 Optimize change_light search
Use std::equal_range to find the upper and lower bounds in a single
binary search, rather than relying on a linear search to find the first
sought element.
2017-01-15 00:03:14 +00:00
Kp 3594e7093f Switch last_hitobj to use array<objnum_t> instead of bitset
This reduces the number of objects that can be tracked concurrently, but
allows MAX_OBJECTS to rise without causing `laser_info` to grow.
2017-01-15 00:03:13 +00:00
Kp 6d3fb34268 Abstract out last_hitobj management 2017-01-15 00:03:13 +00:00
Kp d908b22fdc Move weapon_id_type to namespace dsx 2017-01-15 00:03:13 +00:00
Kp 764d20d4e1 Make grs_bitmap::bm_flags private 2017-01-15 00:03:13 +00:00
Kp f4fffeea49 Make more render state const when possible
Make Render_zoom const in builds where there are no statements that can
change it.

Use vcseg, not vseg, for some segment accesses.
2017-01-15 00:03:12 +00:00
Chris Taylor 0c5a000328 Remove call to window_close(Game_wind) when a network event tells us to end the game
In multi_do_frame(), replace call to window_close(Game_wind) with returning window_event_result::close whenever multi_quit_game is true. Only using this return value where multi_do_frame() is directly called by GameProcessFrame(). multi_quit_game will only be set back to 0 when a new multi game is started.

Closing a window within its handler is problematic - it can result in an unstable state.
2017-01-10 14:10:39 +08:00
Chris Taylor a418f8caec Remove call to window_close(Game_wind) when multiplayer level syncing fails
Replace call to window_close(Game_wind) with returning window_event_result::close to game_handler. Applies to when there is a failure in net_udp_level_sync(). Closing a window within its handler is problematic - it can result in an unstable state.
2017-01-10 13:02:59 +08:00
Chris Taylor 2ecc4c4a07 Remove call to window_close(Game_wind) when stopping demo playback
Replace call to window_close(Game_wind) with returning window_event_result::close to game_handler. Applies to whenever newdemo_stop_playback() is called. Closing a window within its handler is problematic - it can result in an unstable state.
2017-01-09 19:09:34 +08:00
kreatordxx f590ec45c6 Merge pull request #298 from dxx-rebirth/no_game_wind_close
Remove calls to window_close(Game_wind)
2017-01-09 09:32:24 +08:00
Kp 1ef6b9d5bc Pass font to gr_get_string_size 2017-01-08 22:31:59 +00:00
Kp 0480ba8030 Pass canvas to gr_string(int,int,const char*,int,int) 2017-01-08 22:31:59 +00:00
Chris Taylor 4cc801f42f Remove calls to window_close(Game_wind) when game finished or over
Replace calls to window_close(Game_wind) with returning window_event_result::close to game handler. Applies to when DoEndGame() is called, DoGameOver() is called, aborting in the kmatrix screen (multiplayer game) during AdvanceLevel() and playing one demo frame causes playback to stop in GameProcessFrame(). Closing a window within its handler is problematic - it can result in an unstable state.
2017-01-08 21:08:50 +08:00
Kp fe04c3fef6 Initialize obsolete fields
Valgrind warns when writing uninitialized data to a file.  The Descent
savegame format requires writing certain fields that are no longer used.
Set those fields to 0 to prevent leaking stack data into the file.
2017-01-01 23:19:21 +00:00
Kp 879070f814 Fix uninitialized value usage during init_player_stats_new_ship
init_player_stats_new_ship used select_primary_weapon and
select_secondary_weapon to assign the player's weapons.  However, those
functions read the current weapon and jumped according to its value.  A
new ship has no defined value for current weapons, so the jump triggered
an uninitialized value warning from Valgrind.

Add new functions set_primary_weapon, set_secondary_weapon that work
like the previous select_* functions, but always take the path used
for weapons not equal, without checking.  This prevents the warnings
from Valgrind, as well as a theoretical risk of initializing the ship
improperly.
2016-12-25 00:33:25 +00:00