create map preview pictures during spectating

pressing CTRL+F12 during spectating creates a clean screenshot and saves
it as map preview picture

  modkeypressed

    returns 1, if a CTRL key is pressed and 0, if not

  screenshotpreview [lines]

    creates a screenshot cropped to 4:3 with a given number of lines
    (in the range of 144 to 480, default 240 or last given value)
    and jpeg quality 80

  gotovantagepoint

    now returns 1, if the map actually has a vantage point set

DOCREF screenshotpreview modkeypressed gotovantagepoint
This commit is contained in:
ac-stef
2017-06-11 21:13:50 +02:00
parent 06b9d3103d
commit 528d923f81
5 changed files with 51 additions and 22 deletions
+4 -3
View File
@@ -522,7 +522,7 @@ COMMANDF(getvantagepoint, "", ()
result(res);
});
void gotovantagepoint()
bool gotovantagepoint()
{
short p[5];
if(getvantagepoint(p))
@@ -530,14 +530,15 @@ void gotovantagepoint()
restoreposition(p);
physent d = *player1;
d.radius = d.eyeheight = d.maxeyeheight = d.aboveeye = 0.1;
if(!collide(&d, false)) return; // don't use out-of-map vantage points
if(!collide(&d, false)) return true; // don't use out-of-map vantage points
}
// if there is no (valid) vantage point set, we go to the first playerstart instead
int s = findentity(PLAYERSTART, 0);
if(ents.inrange(s)) gotoplayerstart(player1, &ents[s]);
entinmap(player1);
return false;
}
COMMANDF(gotovantagepoint, "", () { if(editmode) gotovantagepoint(); });
COMMANDF(gotovantagepoint, "", () { intret((editmode || (!multiplayer(NULL) && player1->isspectating())) && gotovantagepoint() ? 1 : 0); });
void setmapinfo(const char *newlicense, const char *newcomment)
{