quakeforge/doc/config/gib/sshot.gib

91 lines
2.2 KiB
Text
Raw Normal View History

// sshot.gib
//
// Screenshot script for GIB in QuakeForge 0.5.3
//
// Copyright (C) 2003 Erik Jan Tromp
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// as published by the Free Software Foundation; either version 2
// of the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
//
// See the GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to:
//
// Free Software Foundation, Inc.
// 59 Temple Place - Suite 330
// Boston, MA 02111-1307, USA
//
// Updated for QuakeForge 0.5.3 by Brian Koropoff
// save settings, set maximum eyecandy, take shot, restore settings
// eyecandy settings for screenshots:
// crosshair 0 (off)
// r_dlight_lightmap 1 (on)
// r_shadows 1 (on)
// r_wateralpha 0.3 (translucent)
// hud_fps 0 (off)
domain sshot
global rcsid = "$Id$"
global cvars = crosshair r_dlight_lightmap r_shadows r_wateralpha hud_fps
function cvar::save {
for i in @args[1:] {
global cvars.$i = ${$i}
}
}
function cvar::restore {
for i in @args[1:] {
set $i ${cvars.$i}
}
}
function sshot {
cvar::save @cvars
set crosshair 0
set r_dlight_lightmap 1
set r_shadows 1
set r_wateralpha 0.3
set hud_fps 0
wait
if (#args == 2) { // named screenshot
// find next available name
name_s = 0
for name_t in `file::find qf???.tga` {
echo "Testing ", `slice $name_t 2 5`
if (`slice $name_t 2 5` > $name_s) {break}
name_s = ($name_s + 1)
}
// take shot _now_
screenshot
// pad & normalize source
name_s = "00", $name_s
name_s = "qf", `slice $name_s -3`, ".tga"
// destination specified with extension?
name_d = $args[1]
ifnot $(equal $(slice $name_d -4 0) ".tga") {
name_d = $name_d, ".tga"
}
// rename
file::move $name_s $name_d
} else {
screenshot // generic screenshot
}
wait
cvar::restore @cvars
}
function::export sshot