Commit graph

11498 commits

Author SHA1 Message Date
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 4d11ad18a6 Compute movie_pause_window dimensions from parent window 2021-09-19 10:53:48 +00:00
Kp b9b7ca06b4 Compute movie window position from containing canvas
This generates the same result for now.  If a canvas other than the
screen were used, this will do the right thing, while the prior version
would not.
2021-09-19 10:53:48 +00:00
Kp 284a55ad3a Add 0.25 second sleep to movie pause dialog
Otherwise, pausing the movie puts the game into a hard CPU spin until
the pause is ended.
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 5caa4755b1 Shrink gr_blend to uint8_t
Larger values are not needed.
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 f9fa374ab4 Zero-initialize d_loaded_subtitle_state::Subtitles in debug builds
This provides uniform values, which will encourage the debugger to
collapse unused entries in its output.
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 2bbfc78ab9 Draw guidebot menu on escort_menu canvas
Previously, the guidebot menu was given the full screen dimensions and
drew on only part of them, allowing the rest of the screen to be visible
due to not repainting it.  Change to make the escort_menu window the
size that the user sees.
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 5881af50dd Use __builtin_FILE,LINE for canvas location debugging
This avoids declaring macros for gr_set_default_canvas,
gr_set_current_canvas.
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