Skip to content

Commit a73e5d8

Browse files
committed
maddog: Make gun flash a cvar option.
1 parent c5a73e0 commit a73e5d8

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

data/games/maddog/game.lua

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ local show_hitboxes = false -- if true, draw a rectangle around where you can s
1919
local show_crosshairs = true -- if false, don't draw the crosshairs (useful if you have a real lightgun instead of a mouse).
2020
local reload_on_action2 = false -- if true, right mouse clicks will reload; the Sinden Lightgun sends a right click when pointing offscreen and firing.
2121
local infinite_bullets = false -- if true, firing the gun doesn't cost a bullet, so you never need to reload.
22+
local show_gun_flash = true -- if true, we clear the screen to white for one frame when the player fires his gun.
2223

2324
DirkSimple.cvars = {
2425
{ name="starting_lives", desc="Number of lives player starts with", values="5|4|3|2|1", setter=function(name, value) starting_lives = DirkSimple.to_int(value) end },
@@ -28,6 +29,7 @@ DirkSimple.cvars = {
2829
{ name="skip_undertaker", desc="Skip undertaker scenes", values="false|true", setter=function(name, value) skip_undertaker = DirkSimple.to_bool(value) end },
2930
{ name="show_hitboxes", desc="Show hitboxes", values="false|true", setter=function(name, value) show_hitboxes = DirkSimple.to_bool(value) end },
3031
{ name="show_crosshairs", desc="Show crosshairs (turn off for real lightguns)", values="true|false", setter=function(name, value) show_crosshairs = DirkSimple.to_bool(value) end },
32+
{ name="show_gun_flash", desc="Flash the screen white when player fires gun", values="true|false", setter=function(name, value) show_gun_flash = DirkSimple.to_bool(value) end },
3133
{ name="reload_on_action2", desc="Reload with right mouse click (turn on for Sinden lightgun, etc)", values="false|true", setter=function(name, value) reload_on_action2 = DirkSimple.to_bool(value) end },
3234
{ name="infinite_bullets", desc="Shooting the gun doesn't cost a bullet, so no reloads needed", values="false|true", setter=function(name, value) infinite_bullets = DirkSimple.to_bool(value) end },
3335
}
@@ -578,7 +580,9 @@ local function check_actions(inputs)
578580
gunsound = "empty"
579581
else
580582
-- flash the screen white for one frame when firing to give some weight to it. I learned this trick from The Fablemans, lol.
581-
DirkSimple.clear_screen(255, 255, 255)
583+
if show_gun_flash then
584+
DirkSimple.clear_screen(255, 255, 255)
585+
end
582586
gunsound = "shot"
583587
if not infinite_bullets then
584588
scene_manager.loaded_bullets = scene_manager.loaded_bullets - 1

0 commit comments

Comments
 (0)