2002-08-23 21:18:00 +00:00
|
|
|
// zoom.gib
|
2002-04-29 01:41:07 +00:00
|
|
|
//
|
|
|
|
// zoom script for GIB in QuakeForge 0.5
|
|
|
|
//
|
|
|
|
// Copyright (C) 2002 Brian Koropoff
|
|
|
|
//
|
|
|
|
// 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
|
2002-08-14 05:28:07 +00:00
|
|
|
//
|
|
|
|
// $Id$
|
2002-04-29 01:41:07 +00:00
|
|
|
|
2002-08-14 05:28:07 +00:00
|
|
|
global zoom
|
2002-04-29 01:41:07 +00:00
|
|
|
|
2002-11-11 01:57:34 +00:00
|
|
|
function zoom::init { // Initialize basic options
|
2002-08-14 05:28:07 +00:00
|
|
|
if ($argc != 6) {
|
2002-11-12 02:53:24 +00:00
|
|
|
echo "Usage: ", $0, " base_amp base_fov min_zoom max_zoom zoom_step"
|
2002-05-11 06:09:50 +00:00
|
|
|
return
|
2002-04-29 01:41:07 +00:00
|
|
|
}
|
2002-08-14 05:28:07 +00:00
|
|
|
zoom.amp = $1
|
|
|
|
zoom.fov = $2
|
|
|
|
zoom.mult.lower = $3
|
|
|
|
zoom.mult = $3
|
|
|
|
zoom.mult.upper = $4
|
|
|
|
zoom.mult.step = $5
|
|
|
|
zoom.zoomed = 0
|
|
|
|
set fov ${zoom.fov}
|
|
|
|
set in_amp ${zoom.amp}
|
2002-04-29 01:41:07 +00:00
|
|
|
}
|
|
|
|
|
2002-08-23 21:18:00 +00:00
|
|
|
// Default initial values
|
2002-11-12 02:53:24 +00:00
|
|
|
zoom::init 1 90 1 90 1.15
|
2002-08-22 20:50:12 +00:00
|
|
|
|
2002-11-11 01:57:34 +00:00
|
|
|
function zoom::adjust { // Adjust fov and sensitivity to match zoom factor
|
2002-08-14 05:28:07 +00:00
|
|
|
if ${zoom.zoomed} {
|
|
|
|
set fov (${zoom.fov}/${zoom.mult})
|
|
|
|
set in_amp (${zoom.amp}/${zoom.mult})
|
2002-05-11 06:09:50 +00:00
|
|
|
return
|
2002-04-29 01:41:07 +00:00
|
|
|
} else {
|
2002-08-22 20:50:12 +00:00
|
|
|
set fov ${zoom.fov}
|
|
|
|
set in_amp ${zoom.amp}
|
2002-05-11 06:09:50 +00:00
|
|
|
}
|
2002-04-29 01:41:07 +00:00
|
|
|
}
|
|
|
|
|
2002-11-11 01:57:34 +00:00
|
|
|
function zoom::in {
|
2002-08-22 20:50:12 +00:00
|
|
|
zoom.zoomed = 1
|
2002-11-11 01:57:34 +00:00
|
|
|
zoom::adjust
|
2002-04-29 01:41:07 +00:00
|
|
|
}
|
|
|
|
|
2002-11-11 01:57:34 +00:00
|
|
|
function zoom::out {
|
2002-08-22 20:50:12 +00:00
|
|
|
zoom.zoomed = 0
|
2002-11-11 01:57:34 +00:00
|
|
|
zoom::adjust
|
2002-04-29 01:41:07 +00:00
|
|
|
}
|
|
|
|
|
2002-11-11 01:57:34 +00:00
|
|
|
function zoom::toggle {
|
2002-08-22 20:50:12 +00:00
|
|
|
zoom.zoomed = (!${zoom.zoomed})
|
2002-11-11 01:57:34 +00:00
|
|
|
zoom::adjust
|
2002-04-29 01:41:07 +00:00
|
|
|
}
|
|
|
|
|
2002-11-11 01:57:34 +00:00
|
|
|
function zoom::increase {
|
2002-08-22 20:50:12 +00:00
|
|
|
ifnot ${zoom.zoomed} {
|
|
|
|
return
|
2002-05-11 06:09:50 +00:00
|
|
|
}
|
2002-08-22 20:50:12 +00:00
|
|
|
zoom.mult = (${zoom.mult.step}*${zoom.mult})
|
|
|
|
if (${zoom.mult} > ${zoom.mult.upper}) {
|
|
|
|
zoom.mult = ${zoom.mult.upper}
|
|
|
|
}
|
2002-11-11 01:57:34 +00:00
|
|
|
zoom::adjust
|
2002-04-29 01:41:07 +00:00
|
|
|
}
|
|
|
|
|
2002-11-11 01:57:34 +00:00
|
|
|
function zoom::decrease {
|
2002-08-22 20:50:12 +00:00
|
|
|
ifnot ${zoom.zoomed} return
|
2002-08-24 05:14:46 +00:00
|
|
|
zoom.mult = (${zoom.mult}/${zoom.mult.step})
|
2002-08-22 20:50:12 +00:00
|
|
|
if (${zoom.mult} < ${zoom.mult.lower}) {
|
|
|
|
zoom.mult = ${zoom.mult.lower}
|
2002-05-11 06:09:50 +00:00
|
|
|
}
|
2002-11-11 01:57:34 +00:00
|
|
|
zoom::adjust
|
2002-04-29 01:41:07 +00:00
|
|
|
}
|
|
|
|
|
2002-11-11 01:57:34 +00:00
|
|
|
function::export zoom::init zoom::increase zoom::decrease zoom::in zoom::out zoom::toggle
|