Commit graph

10882 commits

Author SHA1 Message Date
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 0ae9f3c193 Make movie window inherit from dcx::window 2020-08-28 00:18:45 +00:00
Kp f666ab14cb Make movie_pause_window window inherit from dcx::window 2020-08-28 00:18:45 +00:00
Kp 9d0a9ec783 Make escort_menu window inherit from dcx::window 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 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 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 7e23ab554a Simplify custom_remove for loop
Iterate over a zipped range instead of explicitly maintaining an
index value and two pointers.
2020-08-24 01:31:28 +00:00
Kp 237106f31e Add warning that BitmapOriginal cannot be used directly 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