Commit graph

347 commits

Author SHA1 Message Date
Kp 35d91d389a Raise player life count storage from uint8_t to uint16_t
Reported-by: Buff Skeleton <https://forum.dxx-rebirth.com/showthread.php?tid=1096>
2018-12-01 01:58:37 +00:00
Kp a0ed5cb283 Pass Vclip as context 2018-10-21 00:24:07 +00:00
Kp 3b168b38fd Make Viewer const object *
Viewing should not change anything.
2018-09-25 03:44:09 +00:00
Kp 1da76dde7d Fix SDL-only build of gauges.cpp
Even when empty and default-constructible, const members must be
explicitly constructed.  Add a default constructor to do this.

Fixes: 893e8cde06 ("Combine hud gauge parameters")
2018-06-30 21:53:55 +00:00
Kp 90dfedb5cb Fix gauges.cpp for gcc-5
gcc-5 rejects `V == V::E` where the first V is a variable of type V and
the second V is a scope specifier to indicate the member E in the type
V.  gcc-7 permits this.

Fixes: 5cafec2268 ("Use enum for gauges weapon_type")
2018-06-30 21:53:55 +00:00
Kp 30a83eec41 Eliminate some uses of valptridx::operator-> 2018-06-24 05:06:15 +00:00
Kp 946d5e19cb Pass screen width/height to HUD_SCALE_X/HUD_SCALE_Y explicitly 2018-06-20 04:16:06 +00:00
Kp d786122b37 Force type of ternary expressions
When using variadic forwarding constructors
(`sconf_cxx11_inherit_constructor=force-failure`) instead of inheriting
constructors, some ternary expressions become ambiguous due to the
inability to forward the `explicit` modifier from the base class
constructor to the derived class.  Add explicit type overrides to
disambiguate these expressions to the result that the compiler would
have picked on its own when using inheriting constructors.
2018-06-12 02:53:06 +00:00
Kp c04ae08c2e Preserve sign in HUD_SCALE_X,HUD_SCALE_Y
Fixes: ccc2a288f1 ("Simplify HUD_SCALE_X_AR, HUD_SCALE_Y_AR")
2018-06-06 04:53:45 +00:00
Kp d355ef4030 Pass font to various drawing functions 2018-05-19 23:21:42 +00:00
Kp fda1eb851e Pass fonts to LINE_SPACING 2018-05-19 23:21:42 +00:00
Kp 08446f0ab6 Pass font to gr_string,gr_printf 2018-05-19 23:21:42 +00:00
Kp 893e8cde06 Combine hud gauge parameters
Many gauge functions take the same parameters, and pass those parameters
on to child functions in turn.  Bundle common parameters into a few
standard structures, so that adding new context does not need to involve
every function in the chain for every new context value.
2018-05-19 23:21:42 +00:00
Kp ccc2a288f1 Simplify HUD_SCALE_X_AR, HUD_SCALE_Y_AR 2018-05-12 18:24:19 +00:00
Kp 5cafec2268 Use enum for gauges weapon_type 2018-04-30 05:31:16 +00:00
Kp 48b31d84f3 Move FPS to right side and low
Mako88 requests, as have others in the Rebirth forum, that the FPS
indicator be placed on the right side.  Moving to the right side was
quick.  Moving it low, handling all the different rendering combinations
(cockpit, statusbar, fullscreen; standard vs alternate; single player vs
multiplayer), and not overlapping anything in any of them was time
consuming.

If anyone wants more changes in this area, the existing modes ought to
be revisited and unified.  As is, there are pointless inconsistencies
among the modes, which makes it unnecessarily difficult to position an
element correctly.

Requested-by: Mako88 <https://github.com/dxx-rebirth/dxx-rebirth/issues/122>
2018-04-14 21:36:50 +00:00
Kp d049f738c8 Convert various gr_set_current_canvas calls to reference form 2017-11-05 20:49:08 +00:00
Kp ca804d5186 Clear canvas to fix missing exit tunnel movie
Global variable `grd_curcanv` is set to a variety of canvases, some of
which are local stack variables.  Use of global variables in this way is
fragile, but works as long as the global is not used beyond the life of
the backing local.

Unfortunately, some existing uses do access the canvas beyond the
lifetime of the backing local.  Playing movies sets the font of the
current canvas.  If the current canvas is an expired stack variable,
setting the font overwrites other stack data.  This data corruption
causes various symptoms, such as inability to play the escape tunnel
movie.

Prior to 03cca2b3dc, the corruption on
playing the endlevel movie had no user-visible effect.  That commit
created a large local variable, which changed stack layout.  Starting
with that commit, the corruption causes the movie to play as all black.

Fix this, and protect against some other data corruption possiblities,
by clearing the global when the local goes out of scope.

Reported-by: Havner <https://github.com/dxx-rebirth/dxx-rebirth/issues/345> (only as cutscene failure to play, not as the underlying corruption issue)
2017-11-05 20:49:08 +00:00
Kp 49c0cdae2e Simplify calls to gr_set_default_canvas
Rather than use an inline wrapper and rely on the compiler optimizer to
redirect gr_set_current_canvas(nullptr) to gr_set_default_canvas,
rewrite all relevant calls directly in the source.

git grep -l 'gr_set_current_canvas' | xargs sed -i -e 's:gr_set_current_canvas(\s*NULL\|nullptr\s*);:gr_set_default_canvas();:'
2017-11-05 20:49:08 +00:00
Kp e859833f62 Use valptridx for Players
Currently, N_players is still a free variable and Players.count is
unused.  Future work will replace N_players with Players.count.
2017-08-13 20:38:32 +00:00
Kp 4cf4ce38b0 Cache player references 2017-08-13 20:38:31 +00:00
Kp e8d82d7d85 Pass valptridx factories to static functions 2017-07-26 03:15:59 +00:00
Kp 599ac9dee0 Always qualify valptridx type/factory
Previously, valptridx used PREFIX for allow-invalid+mutable, c#PREFIX
for allow-invalid+const, v#PREFIX for require-valid+mutable, vc#PREFIX
for require-valid+const.  Convert the types, factories, and all usage
sites to specify a qualifier for all four combinations:

	im#PREFIX -> allow-invalid+mutable
	ic#PREFIX -> allow-invalid+const
	vm#PREFIX -> require-valid+mutable
	vc#PREFIX -> require-valid+const

Changes to common/include/valptridx.h and common/include/fwd-valptridx.h
are manual.  All other changes are generated by:

	git grep -lz -e '\(obj\|seg\|clwall\|wall\|actdoor\|trg\)\(ptridx\|ptr\|idx\)\(_t\)\?\>' | xargs -0 sed -i -e 's/\<\(v\?\)\(\(obj\|seg\|clwall\|wall\|actdoor\|trg\)\(ptridx\|ptr\|idx\)\(_t\)\?\)\>/\1m\2/g'

for the 'm' prefix and:

	git grep -lz -e '\(obj\|seg\|clwall\|wall\|actdoor\|trg\)\(ptridx\|ptr\|idx\)\(_t\)\?\>' | xargs -0 sed -i -e 's/\<\([cm]\(obj\|seg\|clwall\|wall\|actdoor\|trg\)\(ptridx\|ptr\|idx\)\(_t\)\?\)\>/i&/g'

for the 'i' prefix.
2017-06-10 03:31:02 +00:00
Kp b0cb681ae7 Add gcc-7 /*-fallthrough*/ comments for obvious cases
For switch cases where existing comments or code flow logic obviously
intended to fall through, add a gcc-7 /*-fallthrough*/ comment to
silence warnings about this.  Some cases which are less obvious are not
converted, so the code does not yet compile clean with
-Wimplicit-fallthrough.

Reported-by: parkerlreed <https://github.com/dxx-rebirth/dxx-rebirth/issues/338>
2017-06-07 02:44:54 +00:00
Kp 829e95b6f8 Separate hoard/proximity tracking 2017-03-18 18:07:36 +00:00
Kp afb52a5a3e Pass canvas to draw_hud 2017-03-11 19:56:22 +00:00
Kp a19286437a Pass canvas to show_mousefs_indicator 2017-03-11 19:56:22 +00:00
Kp 4b6f42a962 Pass canvas to show_reticle 2017-03-11 19:56:22 +00:00
Kp cee6c984bd Pass canvas to hud_show_kill_list 2017-03-11 19:56:21 +00:00
Kp 5e1b27120d Pass canvas to HUD_render_message_frame 2017-03-11 19:56:21 +00:00
Kp 40943a6baf Cache canvas in draw_player_ship 2017-03-10 01:22:32 +00:00
Kp 07fbab437b Cache canvas in draw_invulnerable_ship 2017-03-10 01:22:32 +00:00
Kp 653c7666c9 Cache canvas in draw_weapon_box 2017-03-10 01:22:32 +00:00
Kp 3a4789c285 Pass canvas to draw_weapon_info 2017-03-10 01:22:32 +00:00
Kp 685187e2d0 Pass canvas to draw_secondary_weapon_info 2017-03-10 01:22:32 +00:00
Kp 4dae87044b Pass canvas to draw_primary_weapon_info 2017-03-10 01:22:31 +00:00
Kp 6651489643 Pass canvas to draw_weapon_info_sub 2017-03-10 01:22:31 +00:00
Kp 27140a30b9 Pass canvas to draw_numerical_display
Remove unnecessary extra call to draw_numerical_display.
2017-03-10 01:22:31 +00:00
Kp fa81835b96 Pass canvas to show_cockpit_cloak_invul_timer 2017-03-10 01:22:31 +00:00
Kp e583019958 Pass canvas to draw_shield_bar 2017-03-10 01:22:31 +00:00
Kp 0132750380 Pass canvas to draw_afterburner_bar 2017-03-10 01:22:31 +00:00
Kp 4ecae34ec5 Pass canvas to sb_draw_shield_num 2017-03-10 01:22:30 +00:00
Kp 3a8bb51e45 Pass canvas to sb_draw_afterburner 2017-03-10 01:22:30 +00:00
Kp 94f2776af4 Pass canvas to sb_draw_energy_bar 2017-03-10 01:22:30 +00:00
Kp 98a27e4f09 Cache canvas in draw_static 2017-03-10 01:22:30 +00:00
Kp 4fd064a374 Pass canvas to draw_wbu_overlay 2017-03-10 01:22:30 +00:00
Kp c5fe4f28e2 Pass canvas to hud_show_flag 2017-03-10 01:22:30 +00:00
Kp 9fb81eed3d Pass canvas to hud_show_orbs 2017-03-10 01:22:29 +00:00
Kp 817bd73e5e Pass canvas to hud_show_keys 2017-03-10 01:22:29 +00:00
Kp 3645abf0df Pass canvas to show_homing_warning 2017-03-10 01:22:29 +00:00