1// adjustvolume.gib 2// 3// Volume adjustment script for GIB in QuakeForge 0.5.3 4// 5// Copyright (C) 2003 Erik Jan Tromp 6// 7// This program is free software; you can redistribute it and/or 8// modify it under the terms of the GNU General Public License 9// as published by the Free Software Foundation; either version 2 10// of the License, or (at your option) any later version. 11// 12// This program is distributed in the hope that it will be useful, 13// but WITHOUT ANY WARRANTY; without even the implied warranty of 14// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 15// 16// See the GNU General Public License for more details. 17// 18// You should have received a copy of the GNU General Public License 19// along with this program; if not, write to: 20// 21// Free Software Foundation, Inc. 22// 59 Temple Place - Suite 330 23// Boston, MA 02111-1307, USA 24// 25 26// Updated for QuakeForge 0.5.3 by Brian Koropoff 27 28// this thing is primitive. as such, any attempt to break it will 29// succeed. use your head! 30 31// simply set up a couple of bindings like the ones below.. 32// in_bind IMT_0 K_KP_MINUS "adjustvolume 5" // Increase 5 percent 33// in_bind IMT_0 K_KP_PLUS "adjustvolume -5" // Decrease 5 percent 34// & something like this in autoexec.cfg.. 35// // on the fly volume adjust 36// exec adjustvolume.gib 37// set maxvolume (whatever max volume you want) 38 39domain adjustvolume 40 41global rcsid = "$Id$" 42 43global slider = "\129\129\129\129\129\129\129\129\129\129\129\129\129\129\129\129" 44set maxvolume 1.5 45 46function adjustvolume { 47 if (#args != 2) {return} 48 hold_volume = ($volume + $maxvolume * $args[1] / 100) 49 if ($hold_volume < 0) {hold_volume = 0} else if ($hold_volume > $maxvolume) {hold_volume = $maxvolume} 50 set volume $hold_volume 51 ratio = ($volume / $maxvolume) 52 percent = `split ($ratio * 100) .` 53 index = ($ratio * 15) 54 print::center "Volume: ", $percent, "%\n\n", "\128", `slice $slider 0 $index`, "\131", `slice $slider $index -1`, "\130" 55 play "doors/runetry.wav" 56} 57 58function::export adjustvolume 59