Kp
2440a271da
Improve vulcan/gauss pickup rules
...
- Change D1X to use D2X rules regarding Vulcan cannon pickup. The D1X
rules were confusing at best, and seem outright wrong in some ways.
- When a Vulcan cannon was picked up, it was treated as containing not
less than VULCAN_WEAPON_AMMO_AMOUNT rounds, regardless of what it
actually contained. D2X respected the actual contained count, even
when running in D1X emulation mode.
- In D1X single player, if the Vulcan cannon was not picked up, then
it could be treated as Vulcan ammo. If at least 1 unit of
ammunition was added to the player, the entire powerup would be
consumed, regardless of how much ammunition remained.
- In D2X single player, if the Vulcan cannon was not picked up, then
ammunition would be taken from it, but the powerup would only be
consumed if all its ammunition was taken.
- In D1X multiplayer, a player who already had a Vulcan cannon could
not get anything from touching a new cannon, and the cannon would
not be changed.
- In D2X multiplayer, a player who already had a Vulcan cannon could
take ammunition from the cannon, but the cannon could not be drained
below VULCAN_AMMO_AMOUNT. If the cannon had VULCAN_AMMO_AMOUNT or
less, then the player could not take ammunition. If the cannon had
more, the player could drain it to that level.
- Replace all that with a simplified version of the D2X rules:
- If the player does not have the cannon, the cannon is picked up
and removed from the mine. The player takes as much of its
ammunition as possible. If the cannon was well stocked, and the
player was nearly full, some ammunition will be lost. This is
unfortunate, but the game has always had this rule, and changing
it would require dropping one or more Vulcan Ammo packs to
represent the untaken ammunition.
- If the player already had that cannon, then the player takes as
much ammunition as the cannon has, while not exceeding the
ammunition cap. Other players, if any, are updated about how much
ammunition remains in the cannon. The cannon remains in the mine.
- Backport to D1X the network message for updating the contained
ammunition in a vulcan cannon. zico added the basic feature in
7684ce92
, but only applied it to D2X. With the change to let D1X
multiplayer take ammunition from the cannon, D1X now needs the same
feature.
- Remove the special case to delete an empty cannon. Instead, let the
cannon remain in the mine without ammunition. This allows a player in
single player mode to leave behind a backup cannon, which could be
useful if the player is killed and wishes to rearm before returning to
the death site. Similarly, under the new rule that players in
multiplayer can drain the cannon down to 0 ammunition, this removal
allows the cannon to remain behind for someone else to take, rather
than allowing it to be deleted by a player who already had an instance
of it.
2022-02-05 13:30:56 +00:00
Kp
636e1b6d5e
Use enumerated_array for unique_side::uvls
2022-01-15 20:39:10 +00:00
Kp
075495aa8b
Use enumerated_array for d_level_unique_automap_state::Automap_visited
2022-01-15 20:39:10 +00:00
Kp
a7c9a04c20
Use enumerated_array for shared_segment::children
2022-01-15 20:39:10 +00:00
Kp
dc2e86760e
Use enumerated_array for Side_opposite
2022-01-15 20:39:10 +00:00
Kp
4a6a4c4646
Use enumerated_array for unique_segment::sides
2022-01-15 20:39:10 +00:00
Kp
1c57e1032d
Use enumerated_array for shared_segment::sides
2022-01-15 20:39:10 +00:00
Kp
2659400a97
Use sidenum_t for trigger::side
2022-01-15 20:39:10 +00:00
Kp
2d890131fb
Disable packing on old trigger structures
...
It is not necessary, and causes problems when trying to take a reference
to a member.
2022-01-09 15:25:42 +00:00
Kp
f47a2c9f0d
Convert Side_to_verts to enumerated_array<..., sidenum_t>
2022-01-09 15:25:42 +00:00
Kp
fbe3bbd0fa
Use enum sidenum_t in more places
2022-01-09 15:25:42 +00:00
Kp
fedb48613c
Move object_rw to namespace dsx
...
It depends on types in dsx.
2022-01-09 15:25:42 +00:00
Kp
78d4a36bb4
Explicitly require support for C++11 constructor inheritance
...
Parts of the code already used the C++11 syntax, so compilers without it
were already unsupported. Expand the remaining uses to the standard
syntax.
2022-01-09 15:25:42 +00:00
Kp
0f53ce0f06
Factor out get_xrange_direction
...
clang chokes on use of a `constexpr bool` that is initialized separately
from its definition. gcc allows this. Move the value computation into
a constexpr helper function, so that the variable can be defined and
initialized in the same statement.
2022-01-09 15:25:42 +00:00
Kp
6cdc181218
Use enum class for segment_relative_vertnum
2022-01-09 15:25:42 +00:00
Kp
932419ff17
Combine Two_sides_to_edge, Edge_between_sides
...
These track the same data, but were static and defined separately.
Delete Edge_between_sides and redirect uses to Two_sides_to_edge.
2022-01-09 15:25:42 +00:00
Kp
b8a8a61ff8
Simplify multiplayer powerup creation
...
Instead of creating the powerup from a player, then overwriting the
location and velocity of the powerup, and fixing up its segment, create
the powerup directly where it should be, with the intended velocity.
2022-01-09 15:25:42 +00:00
Kp
94cfeede5c
Validate control center trigger sides on load
2022-01-09 15:25:42 +00:00
Kp
078a9affa0
Make MAX_SIDES_PER_SEGMENT an iterable range
...
Iterating over it returns each side number in turn. This allows
converting many loops of the form:
```
for (int i = 0; i < MAX_SIDES_PER_SEGMENT; ++i)
```
to the compact form:
```
for (const auto i : MAX_SIDES_PER_SEGMENT)
```
The compact form brings the usual benefit of range-based for: delegating
iteration to the compiler prevents the loop body from skipping a step,
and makes clear in the code that this is the case.
2022-01-09 15:25:42 +00:00
Kp
3004dd16e5
Convert some bare integers to sidenum_t
2022-01-09 15:25:42 +00:00
Kp
d6b4106d36
Tighten index handling for Ai_transition_table
...
Avoid undefined accesses when a robot has an invalid awareness type.
2022-01-08 17:48:09 +00:00
Kp
648bbac0b1
Convert ai_local::achieved_state to ai_static_state
2022-01-08 17:48:09 +00:00
Kp
d1ac265c2c
Convert ai_local::goal_state to ai_static_state
2022-01-08 17:48:09 +00:00
Kp
37f3c10dd4
Convert ai_static::CURRENT_STATE to ai_static_state
2022-01-08 17:48:09 +00:00
Kp
c3937f391f
Convert ai_static::GOAL_STATE to enum
2022-01-08 17:48:09 +00:00
Kp
9fdf6005df
Convert ai_static::GOALSIDE to sidenum_t
2022-01-08 17:48:09 +00:00
Kp
c6d98df9fb
Move CURRENT_GUN out of ai_static::flags
2022-01-08 17:48:09 +00:00
Kp
5128b84122
Move CURRENT_STATE out of ai_static::flags
2022-01-08 17:48:09 +00:00
Kp
39e9673f54
Move GOAL_STATE out of ai_static::flags
2022-01-08 17:48:09 +00:00
Kp
c10855939b
Move PATH_DIR out of ai_static::flags
2022-01-08 17:48:09 +00:00
Kp
1f00d716de
Move SUBMODE/SUB_FLAGS out of ai_static::flags
2022-01-08 17:48:09 +00:00
Kp
db90f0df62
Move GOALSIDE out of ai_static::flags
2022-01-08 17:48:09 +00:00
Kp
ae44e0226e
Move CLOAKED out of ai_static::flags
2022-01-08 17:48:09 +00:00
Kp
db7b528177
Move SKIP_AI_COUNT out of ai_static::flags
2022-01-08 17:48:09 +00:00
Kp
197ed13d42
Move REMOTE_OWNER out of ai_static::flags
2022-01-08 17:48:09 +00:00
Kp
7015e3e93c
Move REMOTE_SLOT_NUM out of ai_static::flags
...
Some flags merit a type other than int8_t. Begin moving flags out to
distinct variables with their own type.
Add static_assert checks that the ABI relevant structures do not change.
2022-01-08 17:48:09 +00:00
Kp
b4341e69a5
Remove unnecessary definitions of get_static_size
...
These exist only to be declared, and never called.
2022-01-07 04:26:22 +00:00
Kp
941190ff32
Explicitly default d_fname copy constructor
...
clang warns that an implicit copy constructor is deprecated in the
presence of an explicitly defaulted copy-assignment operator.
Add an explicitly defaulted default constructor too, since the
explicitly defaulted copy constructor suppresses generation of an
implicit default constructor, and the default constructor is needed.
2022-01-07 04:26:22 +00:00
Kp
223c59c5d4
Inline out object_number_array
...
Its main purpose is to pre-initialize the underlying std::array. This
can be done without a separate type.
2022-01-07 04:26:22 +00:00
Kp
f84783b95d
Use enum class for dlindexnum_t
2022-01-07 04:26:22 +00:00
Kp
2fbddf7a5a
Use enum class for tmapinfo_flags
2021-11-01 03:37:20 +00:00
Kp
795b0e9111
Use enum class for station_number
2021-11-01 03:37:20 +00:00
Kp
3e02f99bcd
Use enum class for materialization_center_number
2021-11-01 03:37:20 +00:00
Kp
eea806bcc9
Pass underlying index_type through zip()
...
If std::common_type<range::index_type>... finds a common index_type
among all the zipped ranges, pass that common type through as
zip<...>::index_type. Otherwise, set zip<...>::index_type to void.
This allows enumerate(zip(...))) to report a better index_type.
2021-11-01 03:37:20 +00:00
Kp
29b619db99
Pass random generator to pick_random_point_in_seg
2021-11-01 03:37:20 +00:00
Kp
3da988708e
Change Side_opposite value_type to sidenum_t
2021-11-01 03:37:20 +00:00
Kp
6467929025
Consolidate Side_to_verts and Side_to_verts_int
...
They have been the same variable since
a8c3a7f10b
("Alias Side_to_verts to
Side_to_verts_int").
2021-11-01 03:37:20 +00:00
Kp
9fc7a14777
Fix LTO build of Descent 2
...
enum game_mode_flags must be visible in common code, which does not
define DXX_BUILD_DESCENT_II. To avoid One Definition Rule errors,
game_mode_flags must have the same definition in all files.
Fortunately, the DXX_BUILD_DESCENT_II definition is a superset of the
common definition, so the preprocessor guards can be replaced with
advisory comments.
Fixes: 2b718da343
("Use enum class for Game_mode, Newdemo_game_mode")
2021-11-01 03:37:20 +00:00
Kp
3862edfb6c
Use enum class for segment_special
2021-11-01 03:37:19 +00:00
Kp
12a0f8e8e0
Use enum class for wall_state
2021-11-01 03:37:19 +00:00
Kp
76e2f2c6d9
Use enum class for wall_flags
2021-11-01 03:37:19 +00:00
Kp
f64ed06a9d
Use enum class for wall flag constants
2021-11-01 03:37:19 +00:00
Kp
a6f2db2502
Use enum class for player ranking
2021-11-01 03:37:19 +00:00
Kp
8ddfbd17e0
Use enum class for show_kill_list_mode
2021-11-01 03:37:19 +00:00
Kp
d22632ac48
Use enum class for msgsend_state
2021-11-01 03:37:19 +00:00
Kp
7cb34fda0c
Use enum class for network_game_type
2021-11-01 03:37:19 +00:00
Kp
eb7cedc35d
Expand macro Current_mission_longname
2021-11-01 03:37:19 +00:00
Kp
e69b7bd730
Expand macro Briefing_text_filename
2021-11-01 03:37:19 +00:00
Kp
bcc8118dd5
Expand macro Ending_text_filename
2021-11-01 03:37:19 +00:00
Kp
3d878ce04d
Expand macro Last_level
2021-11-01 03:37:19 +00:00
Kp
e36c4a17ab
Expand macro Last_secret_level
2021-11-01 03:37:19 +00:00
Kp
692c09bb7e
Expand macro N_secret_levels
2021-11-01 03:37:19 +00:00
Kp
013ef0ded7
Expand macro Secret_level_table
2021-11-01 03:37:19 +00:00
Kp
d10406c107
Expand macro Level_names
2021-11-01 03:37:19 +00:00
Kp
72cdb9b0cc
Expand macro Secret_level_names
2021-11-01 03:37:19 +00:00
Kp
c64d97307c
Pass level counts to allocate_levels
...
Avoid reading them from a global.
2021-11-01 03:37:19 +00:00
Kp
0c34a48418
Move Last_level_path_created to LevelUniqueObjectState.Level_path_created
...
Change it from the level number on which the path was created to a
true/false flag. The previous logic only tested whether the number was
equal to the current level number.
This also fixes a bug where the action was not available on the first
secret level, since that level is `-1`, and the value was set to `-1` to
indicate that it should be enabled.
2021-11-01 03:37:19 +00:00
Kp
0fcaa76fd1
Move Next_level_num to local scope
...
It does not need to be a global. For each function that uses it, it is
assigned earlier in that same function.
2021-11-01 03:37:19 +00:00
Kp
1a44112907
Remove objnum_local_to_remote wrapper
...
Always use the form that returns both fields.
2021-11-01 03:37:19 +00:00
Kp
1a08ecc8c6
Remove window subfunction types
...
These were type safety mechanisms, which are obsolete now that all
window handlers are implemented through virtual function dispatch.
2021-10-13 02:37:51 +00:00
Kp
192988b004
Use enum class for weapon_info::persistent
2021-09-19 10:53:48 +00:00
Kp
21c530a3e2
Use enumerated_array for difficulty-level-specific arrays
2021-09-19 10:53:48 +00:00
Kp
7fc8c736b3
Pass Powerup_info to multi_prep_level_objects, filter_objects_from_level
2021-09-19 10:53:48 +00:00
Kp
4e75f8a933
Pass canvas to scores_view_menu
2021-09-19 10:53:48 +00:00
Kp
855697bf5d
Make font scaling constructors explicit
2021-09-19 10:53:48 +00:00
Kp
e618851449
Pass canvas to savegame_chooser_newmenu
2021-09-19 10:53:48 +00:00
Kp
07c52f14f9
Save parent canvas in listbox_layout
2021-09-12 16:20:52 +00:00
Kp
8d67bcddb0
Record parent canvas in newmenu
...
Use it to avoid resetting to the screen canvas when preparing the
layout.
2021-09-12 16:20:52 +00:00
Kp
bb29e6fca8
Propagate canvas through more layers
2021-09-12 16:20:52 +00:00
Kp
e7aa9855e0
Compute menu border widths from screen canvas instead of screen
...
In practice, this should be the same result. However, this allows the
flexibility to use a canvas other than the screen.
2021-09-12 16:20:52 +00:00
Kp
21241471c6
Return string width/height from gr_get_string_size
...
Use structured bindings to capture the values on return, so that they
can be declared as `const` if they are immutable after initial
computation.
2021-09-12 16:20:52 +00:00
Kp
2fef4cddec
Pass canvas to do_cockpit_window_view
2021-09-12 16:20:52 +00:00
Kp
bd6612a86b
Pass canvas to render_gauges
2021-09-12 16:20:52 +00:00
Kp
4b60205b2f
Propagate up show_boxed_message RenderFlag
...
It is always constant. Explicitly propagate its effects into callers,
then remove the argument.
2021-09-12 16:20:52 +00:00
Kp
df6777c632
Expand game_init_render_buffers inline
...
It is a single function, to add 2 arguments. Using a wrapper obfuscates
the logic.
2021-09-12 16:20:52 +00:00
Kp
98f2578293
Pass Game_mode as a parameter to gauges functions
...
Avoid reloading it from the global.
2021-09-12 16:20:52 +00:00
Kp
2b718da343
Use enum class for Game_mode, Newdemo_game_mode
2021-09-12 16:20:52 +00:00
Kp
7f51fa3ac5
Use enum class for VR StereoFormat
2021-09-12 16:20:52 +00:00
Kp
233f31893b
Only prepare pause time if it will be shown
...
Demo playback does not show time data, so there is no need to format it
when it will be hidden.
2021-09-12 16:20:52 +00:00
Kp
211f4ea274
Use window_rendered_data constructor to initialize time
2021-09-12 16:20:52 +00:00
Kp
2afe2f428f
Remove write-only member window_rendered_data::viewer
2021-09-12 16:20:52 +00:00
Kp
8eabce8f27
Disallow direct construction of grs_canvas
...
Require use of grs_main_canvas or grs_subcanvas instead.
2021-09-04 12:17:14 +00:00
Kp
1c90863d63
Move grs_main_bitmap earlier in the header
2021-09-04 12:17:14 +00:00
Kp
44a50b6206
Make enumerate() index by array's index_type
2021-09-04 12:17:14 +00:00
Kp
983ad86e4b
Use enum class for trigger number
2021-09-04 12:17:14 +00:00
Kp
c58d26a791
Use trgnum_t more consistently
2021-09-04 12:17:14 +00:00
Kp
6dcd89d494
Try harder to pick distant segments for thief/powerup respawn
2021-09-04 12:17:14 +00:00
Kp
40c22d0663
Move render_frame helper inline
...
Most call sites had the correct lifetime already, and those that did not
can easily gain it with an extra block scope.
2021-08-26 03:13:45 +00:00
Kp
d748e7bbfc
Add support for xrange steps other than +1
...
Prior to this, an xrange always started at the begin term and
incremented by 1 per step until it reached the end term. There was no
support for a step size other than 1. Add support for custom step size.
It is the caller's responsibility to pick a step size that will
eventually lead to (iter != end) evaluating to false.
2021-08-26 03:13:45 +00:00
Kp
1c13d3c8d3
Improve error reporting for PHYSFSX_openReadBuffered
...
Return the PHYSFS error code on failure, so that callers can report why
the open failed.
2021-07-25 23:00:56 +00:00
Kp
b2968c55da
Improve error reporting for read_sndfile
...
Move error reporting down into read_sndfile, so that individual failure
paths can have specific error messages.
2021-07-25 23:00:56 +00:00
Kp
a7cbf60922
Return error code from PHYSFSRWOPS_openRead*
...
This improves error reporting for movies.
2021-07-25 23:00:56 +00:00
Kp
e0008cceb3
Use enum class for sound angle parameter
2021-06-28 03:37:51 +00:00
Kp
13e29c64f3
In debug builds, initialize newmenu_item type,text to poison values
...
This improves the chance that an unset value will abort rather than
displaying strange results. Release builds are unchanged.
2021-06-28 03:37:51 +00:00
Kp
9c08b233a5
Move collision functions into namespaces
2021-06-28 03:37:51 +00:00
Kp
e1aac6949a
Replace __attribute_warn_unused_result with C++17 [[nodiscard]]
...
This eliminates a configure test, and may help readers understand the
annotation more readily.
2021-06-28 03:37:51 +00:00
Kp
704f8f662d
Allow rvalue reference as input to enumerated_iterator
2021-06-28 03:37:50 +00:00
Kp
028f4f8a56
Use structured bindings to access enumerated ranges
2021-06-28 03:37:50 +00:00
Kp
7b12aac1bb
Transpose returned values for enumerate() of non-tuple
...
Match the order used for tuple.
2021-06-28 03:37:50 +00:00
Kp
212400d140
Convert nm_messagebox_str to use messagebox_newmenu
2021-06-28 03:37:50 +00:00
Kp
9044a19d78
Fold passive_messagebox_item into passive_messagebox
2021-06-28 03:37:50 +00:00
Kp
4c34875c84
Remove unused subfunction_handler
...
Previous commits eliminated all uses of it. Remove the unused stubs.
2021-06-28 03:37:50 +00:00
Kp
0c2f95e2cd
Remove write-only member window_rendered_data::rear_view
2021-06-28 03:37:50 +00:00
Kp
8a9eb82d6e
Factor out choosing bounty target
2021-06-28 03:37:50 +00:00
Kp
63ac8a1f5d
Move saved_text out of imenu_specific_type
...
This significantly shrinks newmenu_item, by not embedding a saved_text
in the union that is present in every newmenu_item.
2021-06-28 03:37:49 +00:00
Kp
d0d7545ec1
Unload robot movies on exit
2021-06-28 03:37:49 +00:00
Kp
93a7e34caf
Move newmenu_item slider storage of saved_text out of line
...
When other newmenu_item private members also move, this will make
newmenu_item smaller.
2021-06-28 03:37:49 +00:00
Kp
1936b771e1
Construct nm_item_input in place
2021-06-28 03:37:49 +00:00
Kp
ef6e36f7ee
Move newmenu_item union members into named union
2021-06-28 03:37:49 +00:00
Kp
821e68527d
Remove nm_set_item_input overload for char[]
...
Require use of std::array. There is no need to support both overloads.
2021-06-28 03:37:49 +00:00
Kp
2a504ee03e
Construct nm_item_menu in place
2021-06-28 03:37:49 +00:00
Kp
b5460a0a48
Construct nm_item_text in place
2021-06-28 03:37:49 +00:00
Kp
3d14dbacde
Remove digi_reset
...
It was only available in debug builds, and did nothing when called.
2021-06-28 03:37:49 +00:00
Kp
6e12644620
Remove write-only field digi_sound::bits
2021-06-28 03:37:49 +00:00
Dave Milici
ea6379de2d
Add above/below option sync blank interval for external sync doubler.
2021-04-08 14:07:35 -07:00
Kp
1843ed752c
Fix Windows build of kconfig.h
...
fbd05a1592
changed joy.h to include only fwd-event.h, but not event.h.
event.h included maths.h, which kconfig.h was relying on. Add an
inclusion of maths.h into kconfig.h to define `fix`.
Fixes: fbd05a1592
("optimize include files (include what you use)")
2021-04-04 22:01:25 +00:00
Kp
18c39192f6
Reduce use of global structures in cheat functions
2021-04-04 22:01:25 +00:00
Kp
02c99b7645
Consolidate stereo dimension math
...
Remove VR_half_width, VR_half_height. Their values are directly derived
from VR_stereo, and can be computed on demand.
2021-04-04 22:01:25 +00:00
Dave Milici
6bc0e822d2
Handle HUD overlays in separate screen rects for stereo renderings.
2021-03-17 16:30:31 -07:00
Dave Milici
f51e7b86b9
Reorganize & consolidate stereo vars per PR suggestions.
2021-03-15 11:32:10 -07:00
Dave Milici
509da82ee8
Add -gl_stereoview option for selecting stereo viewport modes.
2021-03-12 10:07:45 -08:00
Dave Milici
8c8b7419b6
Improved conditionals for stereo vs non-stereo modes.
...
Hot-key handling for cycling thru stereo modes & parallax adjustments.
Simplified stereo adjustments for left/right eye separation & offsets.
Not quite compatible yet with Bob Akka stereo method from Descent 1.5.
Function key assignments different (F5..F8) due to pre-empted hot-keys.
ALT+SHIFT+F5: decrease eye separation (VR_eye_width)
ALT+SHIFT+F6: increase eye separation (VR_eye_width)
SHIFT+F5: decrease image shift (VR_eye_offset)
SHIFT+F6: increase image shift (VR_eye_offset)
ALT|SHIFT+F7: reset eye separation + image shift
ALT|SHIFT+F8: cycle thru half-width + half-height formats
Note for compiling dxx-rebirth snapshot on MacOSX:
export CXXFLAGS=-Wno-uninitialized
scons macos_add_frameworks=False
2021-03-11 12:32:01 -08:00
Dave Milici
bb903a1d80
Support stereo viewport rendering in half-height & half-width formats.
...
Enable stereo mode when launched via -gl_stereo option.
GL_STEREO quad buffering may not be available unless OGL layer
supports stereo pixel format descriptors.
Half-height viewport rendering for above/below format.
Half-width viewport rendering for side/by/side formats.
HUD & cockpit elements disabled when stereo views active.
2021-03-11 12:32:01 -08:00
Kp
1ec6fdb0b5
Add back forwarding includes
...
These are not necessary for proper compilation, but are included so that
a mismatch between the forward declaration and the definition will be
diagnosed immediately.
2021-02-20 23:46:51 +00:00
Kp
6a425bb2a7
Drop unnecessary includes
2021-02-20 23:46:51 +00:00
dimag0g
6282dd25b9
Merge fbd05a1592
into 8fdc326c2a
2021-02-16 21:30:26 -08:00
Kp
00f6436959
Zero out newmenu_item::nm_private_imenu
...
Clear the largest union member to avoid issues with uninitialized
members. A future change will refine this to construct members to
specific values.
2021-02-08 01:56:15 +00:00
Dmitry Grigoryev
fbd05a1592
optimize include files (include what you use)
2021-02-06 21:38:50 +01:00
Kp
6e52dc8db2
Shrink newmenu_item::right_offset
...
Its value never exceeds UINT8_MAX.
2021-02-06 17:53:53 +00:00
Kp
a4bc997be3
Pack newmenu_item more tightly
...
Move value down to eliminate one area of padding on 64-bit systems.
2021-02-06 17:53:53 +00:00
Kp
1afd0eeae2
Move NETFLAG_DOPOWERUP to netgame_info and clarify name
2021-01-25 00:45:07 +00:00
Kp
81a2d92ee9
Move ResolutionX, ResolutionY to CCfg
2021-01-25 00:45:07 +00:00
Kp
49944a3fbf
Use enum, not integral_constant, for netflag/netgrant constants
2021-01-25 00:45:07 +00:00
Kp
5d0d9dcc1a
Use primary_weapon_index_t for pick_up_primary
2021-01-25 00:45:07 +00:00
Kp
2196f6add5
Use enumerated_array for Secondary_ammo_max
2021-01-25 00:45:07 +00:00
Kp
6c63e11caa
Use enumerated_array for Secondary_weapon_to_weapon_info
2021-01-25 00:45:07 +00:00
Kp
b20fa0d77d
Use enumerated_array for Primary_weapon_to_weapon_info
2021-01-25 00:45:07 +00:00
Kp
9abf81c77a
Factor out logic for toggling between base/super weapons
2021-01-25 00:45:07 +00:00
Kp
f1cfbaa982
Use enum class for cockpit_3d_view
2021-01-25 00:45:07 +00:00
Kp
77acae6510
Use enum class for weapon_box_user
2021-01-17 22:23:23 +00:00
Kp
b70f569178
Use enum class for OGL_TEXFILT_* constants
2021-01-17 22:23:23 +00:00
Kp
1843d375f2
Use enumerated_array for Secondary_weapon_to_powerup
2021-01-17 22:23:22 +00:00
Kp
e9f590eeb1
Use enumerated_array for Primary_weapon_to_powerup
2021-01-17 22:23:22 +00:00
Kp
baa2823953
Pass player_info to which_bomb
...
Previously, rendering the preferred bomb type could also change it if
the active type was exhausted. This is undesirable, since it depends on
the user to have a HUD mode which causes the bomb type to render.
Switch to only change the active type if the user tries to drop a bomb
while the active type is unavailable. Some call sites already switch
bomb types automatically on depletion. Those sites will still do so.
2021-01-17 22:23:22 +00:00
Kp
e4f8d02380
Make screen_resolution_menu inherit from newmenu
2020-12-27 22:03:09 +00:00
Kp
ed2bc8e213
Use enum class for nm_type
2020-12-27 22:03:09 +00:00
Kp
15f9b3d43f
Enable use of some STL algorithms on zip_iterator
...
std::find_if needs common iterator traits. Add the relevant type
definitions to zip_iterator.
Also add them to d_range, to avoid errors when a range is zipped.
2020-12-27 22:03:09 +00:00
Kp
ae021b12e7
Use named Difficulty_level enum members in MENU_DIFFICULTY_TEXT
2020-12-27 22:03:09 +00:00
Kp
995e25f740
Simplify dxx_gettext when defined(USE_BUILTIN_ENGLISH_TEXT_STRINGS)
2020-12-27 22:03:09 +00:00
Kp
daf53321bf
Remove return value of new_player_config
...
It always succeeds.
2020-12-27 22:03:09 +00:00
Kp
115c38cd77
Remove kmatrix_poll2
...
After the previous commit, its only purpose is to automatically dismiss
the window after 3 seconds. Users may be surprised by this, and the
automatic dismissal has limited value. Remove it and let the user
remain at the cancel dialog until a decision is made.
2020-12-27 22:03:09 +00:00
Kp
e7629f35ee
Move newmenu_item::saved_text into the two sub-types that need it
2020-12-27 22:03:09 +00:00
Kp
e6875641c9
Move Newmenu_allowed_chars into individual newmenu_item
...
Allowed characters are more properly scoped to a specific text entry
field. Move them there to eliminate a global.
2020-12-27 22:03:09 +00:00
Kp
1f8c8e355b
Allow newmenu callers to choose whether to use a background box
...
Previously, callers chose whether to use a fullscreen background image,
and the newmenu code inferred that callers without a background image
wanted a background box, while those with a background image wanted no
box. Change newmenu_layout to take a parameter specifying the caller's
intent, so that a caller can choose to have any combination of a
background image and a background box.
2020-12-27 22:03:09 +00:00
Kp
2b9c146ff2
Convert glitz menu to inherit from newmenu
...
Add a static method to block until the menu closes, so that the glitz
menu can continue to block its caller.
2020-12-27 22:03:09 +00:00
Kp
c0601edde3
Move GammaLevel to CCfg
2020-12-27 22:03:09 +00:00
Kp
effa7435c2
Remove newmenu_listbox1
...
It is no longer used.
2020-12-27 22:03:09 +00:00
Kp
095d660c55
Inline listbox_get_window
...
It is only used once.
2020-12-26 21:17:29 +00:00
Kp
def7e03260
Move listbox callback handling to a derived class
2020-12-26 21:17:29 +00:00
Kp
f43e98764a
Move listbox to newmenu.h
2020-12-26 21:17:29 +00:00
Kp
f01c29c779
Flatten newmenu_do* hierarchy
...
There is now a single caller for newmenu_do3. Inline do3 into do2, so
that do2 calls do4. Mark do4 as static.
2020-12-26 21:17:29 +00:00
Kp
d1ff6becb4
Move listbox_layout to newmenu.h
...
Rename listbox_create_structure to listbox_layout::create_structure.
2020-12-26 21:17:29 +00:00
Kp
b9a27094eb
Pass menu_title through listbox functions
2020-12-26 21:17:29 +00:00
Kp
b63ccc63ca
Make passive_messagebox inherit from newmenu
...
passive_messagebox is only suitable when the user's selection does not
matter, so restrict to be used for cases where only one "choice" is
offered.
2020-12-26 21:17:29 +00:00
Kp
834f009dd7
Use enum class for wallnum_t
2020-12-26 21:17:29 +00:00
Kp
fc63029833
Move more symbols into namespaces
2020-12-26 21:17:29 +00:00
Kp
faa4d2ce34
Use enum class for vertnum_t
2020-12-26 21:17:29 +00:00
Kp
70d55c010d
Move Num_vertices into if(DXX_USE_EDITOR)
...
Non-editor builds only need Num_vertices as a local during mine loading.
2020-12-26 21:17:29 +00:00
Kp
6b3e78054c
Remove support for reading Miner's .LVL files
...
The Miner LVL files are not present in retail Descent 2 data. I know of
no way to obtain them. The code for loading them has been marked as
broken since 2018, and no one reported it. Remove this support to
simplify future work.
2020-12-20 20:39:07 +00:00
Kp
dd3f272929
Use enum class for actdoornum_t
2020-12-20 20:39:07 +00:00
Kp
1c2fcf86e0
Convert multi_leave_game to dispatch through a vtable
2020-12-20 20:39:07 +00:00
Kp
e2c95058db
Convert multi_endlevel to dispatch through a vtable
2020-12-20 20:39:07 +00:00
Kp
a3eb82cefd
Move multi code into namespaces
2020-12-20 20:39:07 +00:00
Kp
5e4047ce2a
Convert disconnect_player to dispatch through a vtable
2020-12-20 20:39:07 +00:00
Kp
955ce55661
Convert kick_player to dispatch through a vtable
2020-12-20 20:39:07 +00:00
Kp
2007257064
Convert get_multi_endlevel_poll2 to dispatch through a vtable
2020-12-20 20:39:07 +00:00
Kp
407678dfdf
Convert multi_send_endlevel_packet to dispatch through a vtable
2020-12-20 20:39:07 +00:00
Kp
ea6504e60b
Convert multi_level_sync to dispatch through a vtable
2020-12-20 20:39:07 +00:00
Kp
2f90d7a208
Convert multi_do_protocol_frame to dispatch through a vtable
2020-12-20 20:39:07 +00:00
Kp
d070377e6b
Convert multi_objnum_is_past to dispatch through a vtable
...
This reduces the call depth by one, and eliminates a load of a global
variable that always has the value MULTI_PROTO_UDP. It adds a load of
the address of the empty dispatch object. Overall, this should be an
improvement.
2020-12-20 20:39:07 +00:00
Kp
696141eabf
Use enum class for weapon_info::bounce
2020-12-20 20:39:07 +00:00
Kp
e261ca2884
Use enum class for weapon_info::matter
2020-12-20 20:39:07 +00:00
Kp
9f8fbb1a77
Remove newdemo_strip_frames
...
The sole user is based on newdemo_do2, which is being retired. This
feature was only available in developer builds.
2020-12-20 20:39:07 +00:00
Kp
df1ee5e671
Make weapon reorder menu inherit from newmenu
2020-12-20 20:39:07 +00:00
Kp
303815f80c
Make netgame_list_game_menu inherit from newmenu
2020-12-20 20:39:07 +00:00
Kp
e57c9efa7e
Change main F1 help menu to inherit from newmenu
2020-12-19 16:13:26 +00:00
Kp
76acfdd38f
Convert main menu to inherit from newmenu
2020-12-19 16:13:26 +00:00
Kp
8e65573c56
Eliminate move construction of newmenu_layout
...
Construct one in place, update it, and then use it to initialize the
rest of the newmenu.
2020-12-19 16:13:26 +00:00
Kp
c68dddd372
Move various definitions into namespaces
2020-12-19 16:13:26 +00:00
Kp
b1b2300c7d
Use enum class for wall_key
2020-12-19 16:13:26 +00:00
Kp
47c33cbd55
Use enum class for WALL_IS_DOORWAY_FLAG
...
This reduces the size of the debug information substantially.
2020-12-19 16:13:26 +00:00
Kp
efcd9b91ce
Use enum class for WALL_IS_DOORWAY_sresult_t
...
This generates the same code, but shrinks the debug information.
2020-12-19 16:13:26 +00:00
Kp
56122687d1
Delegate newmenu subfunction handling into virtual function
2020-12-19 16:13:26 +00:00
Kp
d4cf9943c5
Make newmenu subfunction const
2020-12-19 16:13:26 +00:00
Kp
1032462988
Make newmenu max_displayable const
2020-12-19 16:13:26 +00:00
Kp
de5c300724
Make newmenu_layout::all_text const
2020-12-19 16:13:26 +00:00
Kp
530f396b2e
Make newmenu::tiny_mode_flag, tabs_flag, max_on_menu const
2020-12-19 16:13:26 +00:00
Kp
200952c3d9
Add type-specific tag wrappers for newmenu calls
...
Make the compiler check that title, subtitle, and filename are passed in
the right places.
2020-12-19 16:13:26 +00:00
Kp
53566b7673
Move struct newmenu to newmenu.h
2020-12-19 16:13:26 +00:00
Kp
017c4ce933
Restore buffering on PCX loads
...
Commit 3114874713
delegated PCX loading to
SDL_image, and as an incidental change, switched to using an unbuffered
PHYSFS file. On Linux, this has no perceptible difference in
performance. On Windows, the unbuffered accesses cause enough of a
performance problem for users to notice and report an issue. Add a new
helper to create an SDL_RWops around a buffered file, and use that for
PCX loading.
Fixes: 3114874713
("Delegate PCX loading to SDL_image")
Reported-by: Q3BFG10K <https://github.com/dxx-rebirth/dxx-rebirth/issues/549 >
Reported-by: aybe <https://github.com/dxx-rebirth/dxx-rebirth/issues/555 >
Analyzed-by: arbruijn <https://github.com/dxx-rebirth/dxx-rebirth/issues/555#issuecomment-735442076 >
2020-11-30 05:12:00 +00:00
Kp
a028ea14ae
Restore format(printf) attribute for powerup_basic
...
Kreeblah reports that clang now warns for powerup.cpp due to a missing
__attribute_format_printf. This was incorrectly dropped in
ffb653c0b8
. gcc did not warn, but clang
now warns. Add back the attribute.
Fixes: ffb653c0b8
("Pass control_info & to various functions")
Reported-by: Kreeblah <https://github.com/dxx-rebirth/dxx-rebirth/pull/547 >
2020-10-27 04:27:55 +00:00
Kp
ddcf8c1798
Remove support for show_order_form
...
The original way to order the full version is defunct. Remove the code
that showed that page.
2020-10-22 02:26:17 +00:00
Kp
52e4d6f103
Remove printf checking on vnm_messagebox_aN
...
It is always invoked with format arguments.
2020-10-22 02:26:17 +00:00
Kp
e7cd8bedec
Remove obsolete embed_window_pointer_t
2020-10-22 02:26:16 +00:00
Kp
d2c5b4d64a
Make listbox inherit from window
2020-10-22 02:26:16 +00:00
Kp
09531047b9
Use uint8_t for allow_abort_flag
...
It is only ever 0 or 1.
2020-10-22 02:26:16 +00:00
Kp
ffb653c0b8
Pass control_info & to various functions
...
Switch from a direct global reference to passing control_info& as a
parameter.
2020-10-12 03:28:26 +00:00
Kp
7e73ee2c78
Pass newmenu& to newmenu_create_structure
2020-10-12 03:28:26 +00:00
Kp
2ccfcb64d8
Use named enum for newmenu TinyMode
2020-10-12 03:28:26 +00:00
Kp
96f5428378
Use named enum for newmenu TabsFlag
2020-10-12 03:28:26 +00:00
Kp
a6abf76d0a
Use enum class for index into ObjBitmaps
2020-10-07 03:59:14 +00:00
Kp
24497fa085
Use enum class for bmread mode selector
2020-10-07 03:59:14 +00:00
Kp
c482d01be5
Move some fvi types to namespaces
2020-10-01 03:25:27 +00:00
Kp
b136994551
Move valptridx<segment> to dcx
...
segment is now dcx, so move the valptridx wrapper.
2020-10-01 03:25:27 +00:00
Kp
e6126b800f
Reorder endlevel definitions to split by dcx/dsx
2020-10-01 03:25:27 +00:00
Kp
e068c685f4
Make scores_menu inherit from window
2020-09-21 03:18:12 +00:00
Kp
08701ca190
Store kmatrix_result in a uint8_t size enum
2020-09-21 03:18:12 +00:00
Kp
3ee3ac7b7a
Delete multi_do_death
...
It is not needed. Deathmatch players never lose their keys, so there is
no need to reapply them.
2020-09-11 03:08:02 +00:00
Kp
6a9444e5d6
Move some multiplayer functions into namespaces
2020-09-11 03:08:02 +00:00
Kp
61f186bc18
Use enum class for texture1_value
2020-09-11 03:08:02 +00:00
Kp
39cb42b878
Push partial_range construction to newmenu callers
...
In some cases, callers know the length of the range and can apply better
checks than the called code.
2020-09-11 03:08:02 +00:00
Kp
7de81a7293
Move Afterburner_charge to dsx
2020-09-11 03:08:02 +00:00
Kp
18282d5b66
Move some menu code into namespaces
2020-09-11 03:08:02 +00:00
Kp
0f2c1cdd45
Make game window inherit from dcx::window
2020-08-28 00:18:45 +00:00
Kp
b79eff0e5c
Deduplicate fades[]
...
Two identical copies were defined in different places. Use the global
one for both consumers.
2020-08-28 00:18:45 +00:00
Kp
cdca112f0a
Pass LevelUniqueAutomapState to automap_clear_visited
2020-08-28 00:18:45 +00:00
Kp
ef8c0e7527
Make kmatrix window inherit from dcx::window
2020-08-28 00:18:45 +00:00
Kp
97315725fa
Move get_multi_endlevel_poll2 into dsx
2020-08-28 00:18:45 +00:00
Kp
53f75c3c72
Use enum class for kmatrix network flag
2020-08-28 00:18:45 +00:00
Kp
5b45fd3bae
Add compile-time check that zip() will not exceed static sizes
...
This is necessarily incomplete since it can only check ranges that have
a compile-time static size. However, it catches some simple mistakes,
and imposes no runtime cost, so it is still useful.
2020-08-28 00:18:45 +00:00
Kp
6d3dce4e16
Use enum class for tmap_num2
...
Define separate enum values for rotation data in both the high bits,
where it is usually kept, and the low bits, where it is sometimes used
for math or comparisons.
Define an enum value to represent the composite of the index and the
rotation, since the composite is not suitable for use as an array
subscript. Add helper functions to extract the component pieces.
2020-08-24 01:31:28 +00:00
Kp
da66b1d9b8
Move d1_tmap_num_unique to piggy.cpp
...
It is only used in one file. Move it there and make it static.
2020-08-24 01:31:28 +00:00
Kp
ab44115aa4
Move N_robot_joints to d_level_shared_robot_joint_state
2020-08-24 01:31:28 +00:00
Kp
c96671f763
Move Pof_names to d_level_shared_polygon_model_state
2020-08-24 01:31:28 +00:00
Kp
dca3c6cdca
Move savegame POF names to stack
...
They are only used while loading a savegame file. There is no need for
them to be global.
2020-08-24 01:31:28 +00:00
Kp
636978db4b
Move Marker_model_num to d_level_shared_polygon_model_state
2020-08-24 01:31:28 +00:00
Kp
9c3fc7523c
Make extra_bitmap_num static
...
Modify read_extra_bitmap_d1_pig to take the bitmap-to-write as a
parameter, instead of computing it from extra_bitmap_num.
2020-08-24 01:31:28 +00:00
Kp
faf37e3c14
Always allocate D2-sized sound array
...
This makes other code simpler, and the extra elements will simply be
ignored in D1.
2020-08-24 01:31:28 +00:00
Kp
514c63efad
Expose both MAX_SOUNDS in both games
2020-08-24 01:31:28 +00:00
Kp
dd035a8f2f
Move some piggy code into namespace dsx
2020-08-24 01:31:28 +00:00