Kp
f933feeef1
Combine vertex setup steps in med_attach_segment_rotated
...
This eliminates the need to keep all 4 vertex objects as temporaries,
and simplifies the loop counter.
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
3da1fdad0d
Log a diagnostic when D1 cannot find target secret level
...
A level can have a secret exit without having a mission entry describing
where to go when the secret exit is used. Switch from an assertion
failure in that case to a log message.
2022-01-08 17:48:09 +00:00
Kp
4d5488e493
Remove unused-but-set variable similar/main/piggy.cpp: sbytes
2022-01-07 04:26:22 +00:00
Kreeblah
5b9b353231
Added high DPI flag to SDL 2.0 builds for macOS
2021-12-22 14:26:05 -08:00
Kp
157ec66668
Remove useless cast in DXX_USE_OGLES path in ogl_init_window
...
This triggers a diagnostic from -Wuseless-cast. It appears to be
unnecessary, after tracing down typedefs. It might need to be restored
if some platform uses a definition that is neither the same type nor
implicitly convertible.
2021-12-19 19:35:11 +00:00
Kp
93e98ae71a
Fix -Wold-style-cast in DXX_USE_OGLES code
2021-12-19 19:26:44 +00:00
Kp
328046d1ba
Use xrange for texture merge loops
2021-12-01 03:15:21 +00:00
Kp
4ac9845f07
Fix clang build of fuelcen.cpp
...
clang treats names introduced by structured bindings specially, and
refuses to capture them for a lambda, even when it should be capturing
an rvalue reference. gcc accepts this capture.
Switch to initializing a lambda local variable from the structured
binding in the outer scope, which works with both compilers.
Reported-by: Kreeblah <https://github.com/dxx-rebirth/dxx-rebirth/issues/609 >
2021-11-04 03:24:43 +00:00
Kp
92990222a2
Use structured bindings in mission parsing
2021-11-01 03:37:20 +00:00
Kp
b0103a1950
Allow non-developers to start on any level
2021-11-01 03:37:20 +00:00
Kp
1ca482d587
Factor out clamping AI times during save
...
Also, fix a bug that time_player_sound_attacked was clamped, stored, and
then immediately overwritten with an unclamped value.
2021-11-01 03:37:20 +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
d463b4beba
Use enumerate when traversing Station
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
0389955d7d
Fix logic in write_matcen_text
...
write_matcen_text had a comment warning that its iteration logic was
bogus. Rework the logic to try to walk the right structures.
2021-11-01 03:37:20 +00:00
Kp
51a76f74be
Move rotate_point_list inline in g3_interpreter_draw_base
...
This eliminates the only place that zip<>'s template parameter list is
written out in the source, which will allow later commits to change the
template parameter list.
2021-11-01 03:37:20 +00:00
Kp
6dd2776725
Use zip to traverse side uvl
2021-11-01 03:37:20 +00:00
Kp
e14c54936d
Reduce copying of side UVs
2021-11-01 03:37:20 +00:00
Kp
88b87d2aa1
Use enumerate to traverse MAX_VERTICES_PER_SEGMENT arrays
2021-11-01 03:37:20 +00:00
Kp
e259b1c0ad
Use enum class for packed edge in editor drawing
2021-11-01 03:37:20 +00:00
Kp
d0c028ee2b
Use enumerated_array for Two_sides_to_edge
2021-11-01 03:37:20 +00:00
Kp
a655b82e7d
Use zip() in place_new_segment_in_world
...
This produces clearer code than an xrange.
2021-11-01 03:37:20 +00:00
Kp
5eaa53d220
Fix SDL-only build
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
0044c010ad
Use structured bindings for create_abs_vertex_lists
2021-11-01 03:37:20 +00:00
Kp
6fefeadf09
Avoid storing verts_for_normal::negate_flag when not needed
...
Change it to be returned from get_verts_for_normal, so that callers
which do not need it can discard it.
2021-11-01 03:37:20 +00:00
Kp
ba01b2bdc1
Convert some math functions to fixang
...
The value was always truncated internally anyway. Move the truncation
to the call boundary, since most callers started with a fixang.
2021-11-01 03:37:20 +00:00
Kp
164727db9a
Pass segment sound flags to do_ambient_sounds
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
b0b53c2711
Sanitize segment special in D2 also
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
9823c2e33c
Fix blastable wall test
...
WALL_BLASTABLE is a property of the wall flags, not the wall state.
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
87cc8f0794
Simplify clearing UDP_Socket
...
Remove the workaround added for issue #289 [1]. That issue covered a
miscompilation by early versions of gcc-4.9. gcc-4.9.x is no longer
supported, so the workaround is no longer needed.
[1]: https://github.com/dxx-rebirth/dxx-rebirth/issues/289
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
e6ff0390c9
Initialize level names before putting them in Current_mission
2021-11-01 03:37:19 +00:00
Kp
30ff2de7ca
Factor out building builtin level names
2021-11-01 03:37:19 +00:00
Kp
1e35584384
Remove unnecessary return value from mission shortcut functions
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
57780e0450
Move window_is_visible,window_set_visible to be window methods
...
Shrink w_visible to uint8_t. Move it to pack better.
2021-11-01 03:37:18 +00:00
Kp
3cca690728
Assign weakly-typed symbolic names to ogl_ubitmapm_cs special cases
2021-11-01 03:37:18 +00:00
Kp
7bb55dff22
Remove dead computations in ogl_ubitmapm_cs
2021-11-01 03:37:18 +00:00
Kp
961aae074a
Remove unused ogl_ubitmapm_cs argument scale
...
Every caller passes `F1_0`. Remove the argument, and propagate its
results through the function.
2021-11-01 03:37:18 +00:00
Kp
50d2b14aed
Move WinBoxOverlay+deccpt into a common structure
...
cockpit_decode_alpha::deccpt has static scope and is retained to support
the data in WinBoxOverlay. Change WinBoxOverlay into a structure that
stores deccpt (and rename it to the more descriptive
`decoded_full_cockpit_image`) to keep the pieces together.
2021-11-01 03:37:18 +00:00
AlumiuN
7a90b1461d
Fix rendering of "classic reboot" crosshair
2021-10-12 15:20:27 +13:00
C.W. Betts
b42ab2aa2f
Update fireball.cpp
...
Add include optional.
Fixes build failure on macOS.
2021-09-22 15:11:42 -06:00
Kp
49dee72766
Preserve type of vm_vec_mag return value
...
Defer converting to `fix` until necessary.
2021-09-19 10:53:48 +00:00
Kp
87f7f8dcd6
Simplify player enumeration in do_powerup
2021-09-19 10:53:48 +00:00
Kp
04d1d577c1
Simplify powerup velocity setup
...
Avoid computing a random velocity on objects which are then forced to
zero velocity.
2021-09-19 10:53:48 +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
c01a51fd8b
Remove PlayMovie special case for .MVE
...
Only one caller needed this special case. Remove the special case, and
adjust that caller to include the `.MVE` as a static suffix on its
inputs.
2021-09-19 10:53:48 +00:00
Kp
a0be3a8344
Factor out do_briefing_screens calls in ShowLevelIntro
...
The special cases do not need to be quite so special.
2021-09-19 10:53:48 +00:00
Kp
83fe347a03
Pass canvas to briefing functions
2021-09-19 10:53:48 +00:00
Kp
6a2b31cc6e
Use padding of msgstream to store the required null byte
...
This avoids needing to make temporary local variables to place a null
terminator.
2021-09-19 10:53:48 +00:00
Kp
e973dc0c4c
Move small briefing members earlier in the structure
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
ba8e51f187
Take scores_menu border from parent canvas instead of screen
...
Currently, the parent canvas is the screen, so this is a no-op for now,
but may be useful later when the caller passes in an arbitrary canvas.
2021-09-19 10:53:48 +00:00
Kp
211a1b071a
Adjust scores_menu dimensions to include its background
2021-09-19 10:53:48 +00:00
Kp
39d5c9a0c1
Cache high score position values
...
Avoid recomputing the same scaled values for every item.
2021-09-19 10:53:48 +00:00
Kp
855697bf5d
Make font scaling constructors explicit
2021-09-19 10:53:48 +00:00
Kp
2cff18c114
Prepare scores_menu strings at construction time
...
Switch from formatting the strings each time they are drawn to format
them once and save them in scores_menu. Change the drawing logic to
draw from those saved strings. Change the reset logic to reinitialize
those strings instead of recreating the entire menu.
2021-09-19 10:53:48 +00:00
Kp
6b01c49b9e
Lift out scores_draw_item computation of y coordinate
2021-09-19 10:53:48 +00:00
Kp
87f47c9f0e
Use std::replace to convert to monospace '1'
2021-09-19 10:53:48 +00:00
Kp
b05905ab4d
Delegate score comma handling to std::locale
2021-09-19 10:53:48 +00:00
Kp
04cfd817c3
Cache scores variables
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
70169c4921
Compute briefing window dimensions from caller's canvas
2021-09-19 10:53:48 +00:00
Kp
dfc51fd822
Remove newmenu updates of grd_curcanv
...
They are no longer needed.
2021-09-19 10:53:48 +00:00
Kp
5491630142
Pass canvas to ogl_texture_stats
2021-09-19 10:53:48 +00:00
Kp
aba5fce3a9
Use enum class for gr fade_level
2021-09-19 10:53:48 +00:00
Kp
0216cdc68d
Derive title screen dimensions from canvas
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
bef23a3894
Use newmenu's parent canvas in newmenu_draw
...
Avoid resetting to screen canvas.
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
8623ce3c6a
Pass canvas to ogl_draw_vertex_reticle
2021-09-12 16:20:52 +00:00
Kp
1ddac148a9
Use local canvas for 3d op_flatpoly
2021-09-12 16:20:52 +00:00
Kp
3c37552e5b
Use enum class bm_mode for grs_bitmap::type
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
0750046bc1
Move retrieval of font average width out of gr_get_string_size
...
Most callers do not need it, and it is only vaguely related to the
purpose of measuring a particular string. For those callers that need
it, lift it out.
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
3aa1140700
Optimize out warn_printf on some targets
...
Some targets only ever use GUI warn functions. On those targets:
- initialize `warn_func` to `msgbox_warning` at compile time
- remove the runtime initialize of warn_func in main
On targets which do not call `clear_warn_func`, preprocess out its
declaration and definition.
Taken together, these changes allow some targets not to define
`warn_printf`.
2021-09-12 16:20:52 +00:00
Kp
2f4f0299a0
Fix Windows build of dumpmine.cpp
...
On x86_64-w64-mingw32, `uint_fast32_t` is `unsigned int`. Use the
appropriate format macro for it, instead of writing `lu` and expecting
that `uint_fast32_t` will be `unsigned long`.
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
2da07e75e5
Fix gcc-7 editor build
...
gcc-7 warns if a structured binding defines a variable, and then does
not use it. Suppress the warning, since the binding is needed in the
non-editor build.
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
4d3c38084d
Factor out VR stereo subcanvas initialization
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
48a3ac2c53
Lift ogl_start_frame eye handling into caller
2021-09-12 16:20:52 +00:00
Kp
d257d032f4
Avoid reloading GL viewport unnecessarily in stereo 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
007ac68569
Reduce size of pause_window::msg
...
1024 is excessive. 128 leaves 25 bytes unused on Trainee (the longest
difficulty string, tied with Hotshot) at time 0:00:00. A player who
reached double-digit hours for both time on level and time in game would
need 2 bytes more. A player who rescued 100 hostages would need another
2 bytes.
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
71ed303c27
Fix clang editor medwall build
...
The existing code checks that w.m_ptr is not nullptr before using it.
clang's flow analysis is unable to prove that w.m_ptr does not become
nullptr after it was first checked, even though `w` is const. This
causes clang to include calls to null_pointer_exception::report, which
is not instantiated for wall. That in turn causes a link error.
Rewrite the code to let clang see that the value tested is the value
used, and that no nullptr dereference can happen here.
2021-09-04 12:17:14 +00:00
Kp
fdf5836031
Move g3 instance contexts onto the stack
2021-09-04 12:17:14 +00:00
Kp
6a1f5937a2
Change ogl_font_choose_size to return width/height
2021-09-04 12:17:14 +00:00
Kp
4c681c40fd
Factor out the slider font smoothing hack
...
Move the test from the innermost loop to one layer farther out, since it
was conditional on two specific passes of the innermost loop.
2021-09-04 12:17:14 +00:00
Kp
6172b69329
Convert more font.cpp sites to use xrange
2021-09-04 12:17:14 +00:00
Kp
c99b67e359
Switch callers to unchecked_partial_range(range) where possible
...
Use unchecked_partial_range(range) instead of
unchecked_partial_range(iterator), since the range form can preserve the
underlying index_type.
2021-09-04 12:17:14 +00:00
Kp
ef1c3d20c6
Compute required_buffer_size earlier in partial_range call tree
...
Push the computation up, so that invocations that differ only in the
length of their expression strings will resolve to the same template.
Rework unchecked_partial_range not to take expression strings if they
will not be used.
2021-09-04 12:17:14 +00:00
Kp
1354099b0d
Move Computed_colors into gr_find_closest_color
...
- Inline add_computed_color into gr_find_closest_color, and then only
one function will need access to Computed_colors.
- Allow the recent-choice bubble-up logic to apply to all elements
- If all entries are in use, always overwrite the last element in
Computed_colors instead of picking one randomly.
2021-09-04 12:17:14 +00:00
Kp
ae3dc7f934
Simplify computed color reset
...
gr_find_closest_color did not need it. Remove it. For the others,
resetting the count is sufficient. There is no need to reset the
individual elements.
2021-09-04 12:17:14 +00:00
Kp
347b8d9f77
Factor out palette color search code
2021-09-04 12:17:14 +00:00