Commit graph

5380 commits

Author SHA1 Message Date
Kp c73e310928 Make robot_dialog inherit from UI_DIALOG 2020-09-21 03:18:12 +00:00
Kp a6b8012b5d Make editor_dialog inherit from UI_DIALOG 2020-09-21 03:18:12 +00:00
Kp e4442a1b05 Remove code for ORTHO_VIEWS
Support for ORTHO_VIEWS has been broken since commit
db514a5ded in December 2004.

`git blame HEAD -L872,+4 -- similar/editor/meddraw.cpp`:
```
db514a5ded main/editor/meddraw.c (Bradley Bell 2004-12-19 13:54:27 +0000 872) 			}
db514a5ded main/editor/meddraw.c (Bradley Bell 2004-12-19 13:54:27 +0000 873) 		} else
db514a5ded main/editor/meddraw.c (Bradley Bell 2004-12-19 13:54:27 +0000 874) #if ORTHO_VIEWS
db514a5ded main/editor/meddraw.c (Bradley Bell 2004-12-19 13:54:27 +0000 875) 		 else if ( screen_canvas == TopViewBox->canvas )
```

When ORTHO_VIEWS is true, this code expands to `} else else if (...)`; a
double-else is not legal, so the code cannot have been compiled with
ORTHO_VIEWS enabled.  All 4 of the relevant lines date to db514a5ded,
which itself is an import of files from the D1X editor.
2020-09-21 03:18:12 +00:00
Kp cd620e5f8c Make trigger_dialog inherit from UI_DIALOG 2020-09-21 03:18:12 +00:00
Kp 09966079c4 Make centers_dialog inherit from UI_DIALOG 2020-09-21 03:18:12 +00:00
Kp b97f581d56 Make hostage_dialog inherit from UI_DIALOG 2020-09-21 03:18:12 +00:00
Kp 3c1c270643 Make info_dialog_window inherit from window 2020-09-21 03:18:12 +00:00
Kp 68da7d0ae5 Make briefing inherit from window 2020-09-21 03:18:12 +00:00
Kp f37dc9e947 Make title_screen inherit from window 2020-09-21 03:18:12 +00:00
Kp e068c685f4 Make scores_menu inherit from window 2020-09-21 03:18:12 +00:00
Kp f0ae880e83 Make gamebitmaps_viewer_window inherit from window 2020-09-21 03:18:12 +00:00
Kp 9f4886c56d Make polygon_models_viewer inherit from window 2020-09-21 03:18:12 +00:00
Kp d056daa162 Remove obsolete UI_DIALOG constructor, macros 2020-09-21 03:18:12 +00:00
Kreeblah 347f11e130
Merge 575b2eb111 into 7ded8fb6c5 2020-09-10 23:29:04 -07:00
Kp 9c5f7b1248 Fix incorrect read length in D1 piggy_read_sounds
Reported-by: Kreeblah <https://github.com/dxx-rebirth/dxx-rebirth/issues/542>
Fixes: faf37e3c14 ("Always allocate D2-sized sound array")
2020-09-11 03:08:03 +00:00
Kp 969caa8c0c Add configure test to check for usable GL utility library
Rebirth built with OpenGL has a hard dependency on the GL utility
library, but did not have a configure time test to report this.  Add
one.

Reported-by: shoober420 <https://github.com/dxx-rebirth/dxx-rebirth/issues/468>
2020-09-11 03:08:02 +00:00
Kp b3c3066a38 Fix no-joystick build
When joystick support is not present, `event_joystick_get_button` is not
declared in joy.h.

Fixes: c24864b180 ("make menus controllable with joystick")
2020-09-11 03:08:02 +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 e31d030caf Use zip for nm_messagebox_str 2020-09-11 03:08:02 +00:00
Kp 7de81a7293 Move Afterburner_charge to dsx 2020-09-11 03:08:02 +00:00
Kp 14a9657136 Use partial_range to store newmenu_item pointer/length 2020-09-11 03:08:02 +00:00
Kp c66a5276b7 Pass draw_item newmenu_item by reference 2020-09-11 03:08:02 +00:00
Kp e2204cc8e5 Rotate menu items in terms of ranges, not indexes 2020-09-11 03:08:02 +00:00
Kp 495e808f7b Factor out generating slider special characters
The same logic is used in two places.  Move it to a helper function, and
switch from repeated use of snprintf for one character at a time to
instead use fill_n.
2020-09-11 03:08:02 +00:00
Kp 18282d5b66 Move some menu code into namespaces 2020-09-11 03:08:02 +00:00
Kreeblah 575b2eb111
Don't include classic MacOS in the macOS file location info 2020-09-09 00:28:51 -07:00
Kreeblah 42903497ba
Added more specific instructions for data locations on macOS 2020-09-09 00:23:14 -07:00
Kp 96d108b7c9 Merge commit 'fix_gr_menu_crash' into master 2020-09-02 02:16:47 +00:00
Arne de Bruijn 5b56ed1970 Ensure cached cockpit textures are valid
Check if the cockpit window textures are still valid when reusing the
previous cockpit data in cockpit_decode_alpha.

This fixes a crash when leaving the graphics options menu while in
the game with cockpit visible, since that calls
ogl_smash_texture_list_internal which invalidates all textures.
2020-08-28 14:58:37 +02:00
Kp 52660dd40c Make kc_menu inherit from window 2020-08-28 00:18:45 +00:00
Kp 22afbfce15 Use zip for kc_set_exclusive_binding iteration 2020-08-28 00:18:45 +00:00
Kp b6a6cec9bd Move kconfig_start_changing to dsx 2020-08-28 00:18:45 +00:00
Kp 96c007687c Move kc_drawquestion to dcx 2020-08-28 00:18:45 +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 dc77c1a5ce Make pause window inherit from dcx::window 2020-08-28 00:18:45 +00:00
Kp c038805a9b Make credits window inherit from dcx::window 2020-08-28 00:18:45 +00:00
Kp 955c7d9542 Make console window inherit from dcx::window 2020-08-28 00:18:45 +00:00
Kp cc5506544a Make automap window inherit from dcx::window 2020-08-28 00:18:45 +00:00
Kp 7e72dfd75c Move some automap logic to dcx 2020-08-28 00:18:45 +00:00
Kp bc660bcfcd Pass automap by reference 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 1d3e546848 Inline window_get_canvas
The helper returns a reference to a mutable canvas, so there is no
isolation provided by using the helper.
2020-08-28 00:18:45 +00:00
Kp 0f89331924 Inline window_set_modal 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 02aa5c182e Use NSDMI for kmatrix_screen::end_time initialization 2020-08-28 00:18:45 +00:00
Kp 363ecc36f1 Move kmatrix_screen into local scope
It is only used inside one function, so there is no need to store it
into the structure.
2020-08-28 00:18:45 +00:00
Kp 5501683dda Store kmatrix_result in kmatrix_screen
Instead of storing a boolean that is later converted to a
kmatrix_result, store the desired result directly.
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 74a698253b Fix kconfig zip traversal past the end of kcm_* arrays
For historical reasons, the kcm_* arrays are smaller than the player's
configuration settings.  Move the kcm_ arrays to be the first range
passed to zip, so that traversal does not exceed the array.

Fixes: d959eeca8f ("Use zip in kconfig to allow use of range-based for")
2020-08-28 00:18:45 +00:00
Kp 18027607cd Fix truncation warning in multi_send_message
When AddressSanitizer is enabled, gcc-10 will warn that strncpy will
truncate the message.  This truncation is valid, since it only loses the
terminating null byte, and the next line explicitly supplies a
terminating null.  Switch to memcpy to eliminate the warning and produce
simpler code.
2020-08-24 01:31:28 +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 c7a291b113 Move editor texture orientation handling to caller
tmap1 cannot be rotated, so checking for it inside
convert_to_d1_tmap_num is wrong.  tmap2 can be rotated, and checking for
it outside convert_to_d1_tmap_num is cleaner.
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 cb33b04521 Pass output grs_bitmap to read_extra_bitmap_iff 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 edb9b46b55 Move piggy_is_needed to dcx 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
Kp b29f19da51 Use enum class for GameBitmapOffset
Values in GameBitmapOffset are only intended for use indexing within the
game's PIG file.  Give them a specific type to reflect that.
2020-08-24 01:31:28 +00:00
Kp 32268b1f48 Simplify bitmap flag setup
Remove the conditional jumps.  Bit masking is simpler.
2020-08-24 01:31:28 +00:00
Kp 8a1bc7f318 Move Exit_models_loaded into d_level_shared_polygon_model_state 2020-08-24 01:31:28 +00:00
Kp 0eaabdb2fb Move N_polygon_models into d_level_shared_polygon_model_state 2020-08-24 01:31:28 +00:00
Kp de4efc4f46 Qualify more uses of shared_segment members 2020-08-24 01:31:28 +00:00
Kp 2b8522f8ad Convert uses of vcsegptr_t to shared_segment& where possible 2020-08-24 01:31:28 +00:00
Kp 2e398c02c7 Convert uses of vmsegptr_t to shared_segment& where possible 2020-08-24 01:31:28 +00:00
Kp 8e81726ac5 Use enum class for laser_level
Remove stored_laser_level, which existed primarily to enforce type
separate.  `enum class` can do that without the need for a separate
class type.
2020-08-24 01:31:28 +00:00
Kp e0b10880de Fix build break in non-debug build diagnostic
Only non-debug builds print a warning for slew objects.

Fixes: 1c42f69ff2 ("Use enum class for object_signature_t")
Reported-by: Kreeblah <https://github.com/dxx-rebirth/dxx-rebirth/issues/533>
2020-08-11 04:09:00 +00:00
Kp a8b6a8393b Fix PCH build
Add a comment in the #include directive to hide it from the PCH scanner,
since this file should not be included in the PCH.  It is only used in
one file, and it is included under special circumstances.  In
particular, it is included while inside a namespace.
2020-08-10 03:45:14 +00:00
Kp 038c6aef4d Move d_level_unique_object_state to a separate header
This is required to untangle the cross-inclusion of object.h and
morph.h.
2020-08-10 03:45:14 +00:00
Kp 8cf9ab8222 Access unique_segment::static_light directly
segment inherits unique_segment, so unique_segment members can be
referenced from an instance of segment.  Eventually, segment will be
removed.  Adjust references to go through unique_segment to support this
change.
2020-08-10 03:45:13 +00:00
Kp 7f3aa94d8c Access unique_segment::slide_textures directly
segment inherits unique_segment, so unique_segment members can be
referenced from an instance of segment.  Eventually, segment will be
removed.  Adjust references to go through unique_segment to support this
change.
2020-08-10 03:45:13 +00:00
Kp 336d84f451 Access unique_segment::light_subtracted directly
segment inherits unique_segment, so unique_segment members can be
referenced from an instance of segment.  Eventually, segment will be
removed.  Adjust references to go through unique_segment to support this
change.
2020-08-10 03:45:13 +00:00
Kp 37bd70369d Access unique_segment::objects directly
segment inherits unique_segment, so unique_segment members can be
referenced from an instance of segment.  Eventually, segment will be
removed.  Adjust references to go through unique_segment to support this
change.
2020-08-10 03:45:13 +00:00
Kp 7ad8d8c28b Rename object::movement_type to movement_source
gcc and clang disagree about how to disambiguate when an identifier is
both a typename and a member.  Avoid the disagreement by renaming the
member.
2020-08-10 03:45:13 +00:00
Kp 5245b1c4a3 Rename object::control_type to control_source
gcc and clang disagree about how to disambiguate when an identifier is
both a typename and a member.  Avoid the disagreement by renaming the
member.

Reported-by: Kreeblah <https://github.com/dxx-rebirth/dxx-rebirth/issues/532>
2020-08-10 03:45:13 +00:00
Kp 102cb5572f Exchange order of gauge_hud_type, gauge_inset_window_view
This generates better code by raising the computation of one array
level outside certain conditionals.
2020-08-10 03:45:13 +00:00
Kp 637efae03a Use enum class for gauges window indexing 2020-08-10 03:45:13 +00:00
Kp 1c42f69ff2 Use enum class for object_signature_t 2020-08-10 03:45:13 +00:00
Kp 38cddb0289 Use enum class for object movement_type 2020-08-10 03:45:13 +00:00
Kp 9e2543ecbf Use enum class for object control_type 2020-08-06 03:47:56 +00:00
Kp 4ef247e494 Use enum class for collision_result values 2020-08-06 03:47:56 +00:00
Kp 021c86d4dd Remove unnecessary variable in InitMarkerInput
This was a leftover from an earlier prototype.  gcc-7 warns about it,
but gcc-8 and later silently allow it.  Remove it to fix the gcc-7
build, since it is not needed.

Reported-by: Kieltux <https://github.com/dxx-rebirth/dxx-rebirth/issues/531>
Fixes: ec6a78c481 ("Use enum class for marker index types")
2020-08-06 03:47:56 +00:00
Kp 111b655b09 Remove GM_GAME_OVER
Various sites assign GM_GAME_OVER to Game_mode, but no sites test for
it.  Its only value would be to clear out other flags, but that can be
done by clearing Game_mode.
2020-08-06 03:47:56 +00:00
Arne de Bruijn 294d54eb58 Workaround for missing forever flag in sound object demo recording
In the original code there was a 'Hack to keep sounds from building up...'
which changed a non-forever linked sound to a non-linked sound. Therefore
the forever flag wasn't needed in the demo files. The commit
4a98e796ab removed the hack, which caused
non-forever sounds to start looping on demo playback.
This commit restores the hack as far as demo files are concerned.

Reported-by: zicodxx <https://github.com/dxx-rebirth/dxx-rebirth/issues/477>
Fixes: 4a98e796ab ("Prevent stacking weapon rotation sounds")
2020-08-05 15:32:44 +02:00
Kp 8d3f47d646 Fix hoard orb handling on player death
Descent tracked hoard orbs by borrowing the player's proximity bomb
slot.  Commit 829e95b6f8 moved proximity
bomb tracking to its own slot, but failed to update the player
death/deres logic accordingly.  This caused multiple inconsistencies
when a player was killed in hoard mode:

- The killed player saw the orb drop as expected.
- The killed player _also_ kept the orb in inventory after respawn,
  because the counter was not reset.
- Other players saw no orb drop.

Fix the inappropriate retention by resetting the orb count in
init_player_stats_new_ship.  Fix the inappropriate failure to drop by
adding a new unconditional field to the player death/deres message.  In
hoard games, use it to pass the orb count.  In other games, ignore it.

Fixes: 829e95b6f8 ("Separate hoard/proximity tracking")
Reported-by: snytek <https://github.com/dxx-rebirth/dxx-rebirth/issues/526>
2020-08-01 18:29:01 +00:00
Kp 0789298192 Hide HUD key graphics in competitive games
The keys are always enabled, so there is no need to show them here.
Non-fullscreen users already dedicate space to the key graphic, so
nothing can be saved by adding a special case for those viewing modes.
2020-08-01 18:29:01 +00:00
Kp fab8afe96c Simplify always-true title_screen::allow_keys
The value is always true, so delete tests for it and remove the
variable.
2020-08-01 18:29:01 +00:00
Kp 8ebfee3c41 Remove unused show_title_screen parameters
- allow_keys is always 1
- from_hog_only was ignored in the callee because PhysFS does not
  support it.
2020-08-01 18:29:01 +00:00
Kp 519c14a407 Use timestamped savegame description if none is given
Instead of a generic "-no title-", insert the time of the save.  This
conveys some information to users, who may find it helpful for
distinguishing individual saves.
2020-07-22 03:11:18 +00:00
Kp 1d24a2f942 Fix off-by-one in save slot memory
Save menus have a non-selectable first element used to allocate extra
space for the save game's embedded screenshot.  The memorized save game
slot failed to account for this, causing the game to suggest a slot one
less than the last used slot.  Attentive users could override the
suggestion, but the game should suggest the correct slot automatically.

Reported-by: ziplantil <https://github.com/dxx-rebirth/dxx-rebirth/issues/524>
2020-07-22 03:11:18 +00:00