Skip to content

Commit

Permalink
Add cleanshot command.
Browse files Browse the repository at this point in the history
  • Loading branch information
JadingTsunami committed Sep 2, 2024
1 parent 22ff478 commit 9152f2f
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 3 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@ Install [PrBoom-Plus](https://github.com/coelckers/prboom-plus) and place the bi
- `set [variable] [value]` (set or create CVAR with given value)
- `unset [variable]` (delete CVAR)
- `screenshot` (take a screenshot, intended for compound keybinds)
- `cleanshot` (take a "clean" screenshot with no player sprites or messages and fullsize HUD)
- `summon <class>` (summon [class](https://github.com/JadingTsunami/prboomX#actor-names) enemy/thing/etc. to player's aim point position)
- `summonfriend <class>` (summon [class](https://github.com/JadingTsunami/prboomX#actor-names) friendly enemy/thing/etc. to player's aim point position)
- `am_summonfriend <class>` (summon [class](https://github.com/JadingTsunami/prboomX#actor-names) friendly enemy/thing/etc. to automap crosshair position)
Expand Down
35 changes: 32 additions & 3 deletions prboom2/src/c_cmd.c
Original file line number Diff line number Diff line change
Expand Up @@ -1279,38 +1279,66 @@ static void C_quicksave(char* cmd)
M_QuickSave();
}

static void NoteShotStateSaveRestore()
static void CleanScreenshotStateSaveRestore()
{
extern dboolean singletics;
extern int hud_displayed;
extern int showMessages;
extern int screenblocks;

static dboolean saved_singletics = false;
static int saved_showMessages = false;
static dboolean state_saved = false;
static dboolean saved_psprites = true;
static dboolean saved_hud = true;
static int saved_screenblocks = 8;

if (state_saved) {
singletics = saved_singletics;
showMessages = saved_showMessages;
state_saved = false;
hud_displayed = saved_hud;
if (saved_psprites)
C_CvarSet("r_drawplayersprites");
screenblocks = saved_screenblocks;
R_SetViewSize(screenblocks);
} else {
saved_singletics = singletics;
saved_showMessages = showMessages;
saved_psprites = C_CvarIsSet("r_drawplayersprites");
saved_hud = hud_displayed;
saved_screenblocks = screenblocks;

singletics = true;
showMessages = false;
C_CvarClear("r_drawplayersprites");
hud_displayed = false;
screenblocks = 11;
R_SetViewSize(screenblocks);

state_saved = true;
}
}

static void C_noteshot(char* cmd)
{
NoteShotStateSaveRestore();
CleanScreenshotStateSaveRestore();
C_schedule(4, C_screenshot);
C_schedule(5, C_mapfollow);
C_schedule(7, C_screenshot);
C_schedule(9, C_mapfollow);
C_schedule(10, NoteShotStateSaveRestore);
C_schedule(10, CleanScreenshotStateSaveRestore);
C_note(cmd);
}

static void C_cleanshot(char* cmd)
{
CleanScreenshotStateSaveRestore();
C_schedule(4, C_screenshot);
C_schedule(8, CleanScreenshotStateSaveRestore);
C_ConsolePrintf("Clean screenshot taken.");
}

command command_list[] = {
{"noclip", C_noclip},
{"noclip2", C_noclip2},
Expand Down Expand Up @@ -1346,6 +1374,7 @@ command command_list[] = {
{"set", C_set},
{"unset", C_unset},
{"screenshot", C_screenshot},
{"cleanshot", C_cleanshot},
{"am_findsecret", C_automapfindsecret},
{"am_finditem", C_automapfinditem},
{"am_findmonster", C_automapfindmonster},
Expand Down

0 comments on commit 9152f2f

Please sign in to comment.