2002-04-29 01:41:07 +00:00
|
|
|
// zoom.rc
|
|
|
|
//
|
|
|
|
// 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
|
|
|
|
|
|
|
|
set zoom_version {$Id$}
|
2002-05-11 06:09:50 +00:00
|
|
|
set zoom_base_amp 1
|
2002-04-29 01:41:07 +00:00
|
|
|
set zoom_base_fov 90
|
|
|
|
set zoom_mult 1.25
|
|
|
|
set zoom_zoomed 0
|
|
|
|
|
|
|
|
set zoom_mult_lower 1.25
|
2002-05-01 05:10:55 +00:00
|
|
|
set zoom_mult_upper 90 // This is more or less the hard limit
|
2002-05-11 06:09:50 +00:00
|
|
|
set zoom_mult_step .25
|
2002-04-29 01:41:07 +00:00
|
|
|
|
|
|
|
alias zoom_init { // Initialize basic options
|
|
|
|
if #{$argn != 6} {
|
2002-05-11 06:09:50 +00:00
|
|
|
echo "Usage: $0 base_sensitivity base_fov min_zoom max_zoom zoom_step"
|
|
|
|
return
|
2002-04-29 01:41:07 +00:00
|
|
|
}
|
2002-05-11 06:09:50 +00:00
|
|
|
set zoom_base_amp $1
|
2002-04-29 01:41:07 +00:00
|
|
|
set zoom_base_fov $2
|
2002-05-11 06:09:50 +00:00
|
|
|
set zoom_mult_lower $3
|
|
|
|
set zoom_mult $3
|
|
|
|
set zoom_mult_upper $4
|
|
|
|
set zoom_mult_step $5
|
2002-04-29 01:41:07 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
alias zoom_mult { // "Accessor" for zoom_mult
|
2002-05-11 06:09:50 +00:00
|
|
|
if #{!$1} return // Prevent division by zero
|
|
|
|
set zoom_mult $1
|
2002-04-29 01:41:07 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
alias zoom_adjust { // Adjust fov and sensitivity to match zoom factor
|
|
|
|
if $zoom_zoomed {
|
2002-05-11 06:09:50 +00:00
|
|
|
set fov #{$zoom_base_fov/$zoom_mult}
|
2002-05-15 22:14:17 +00:00
|
|
|
set in_amp #{$zoom_base_amp/$zoom_mult}
|
2002-05-11 06:09:50 +00:00
|
|
|
return
|
2002-04-29 01:41:07 +00:00
|
|
|
} else {
|
2002-05-11 06:09:50 +00:00
|
|
|
set fov $zoom_base_fov
|
2002-05-15 22:14:17 +00:00
|
|
|
set in_amp $zoom_base_amp
|
2002-05-11 06:09:50 +00:00
|
|
|
}
|
2002-04-29 01:41:07 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
alias zoom_in { // Replaced ID zoom function
|
2002-05-11 06:09:50 +00:00
|
|
|
set zoom_zoomed 1
|
|
|
|
zoom_adjust
|
2002-04-29 01:41:07 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
alias zoom_out { // Replaced ID zoom function
|
2002-05-11 06:09:50 +00:00
|
|
|
set zoom_zoomed 0
|
|
|
|
zoom_adjust
|
2002-04-29 01:41:07 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
alias zoom_toggle {
|
2002-05-11 06:09:50 +00:00
|
|
|
toggle zoom_zoomed
|
|
|
|
zoom_adjust
|
2002-04-29 01:41:07 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
alias zoom_increase {
|
2002-05-11 06:09:50 +00:00
|
|
|
if #{!$zoom_zoomed} return
|
|
|
|
zoom_mult #{$zoom_mult + $zoom_mult_step*$zoom_mult} // Grow zoom exponentially
|
2002-04-29 01:41:07 +00:00
|
|
|
if #{$zoom_mult>$zoom_mult_upper} {
|
2002-05-11 06:09:50 +00:00
|
|
|
zoom_mult $zoom_mult_upper
|
|
|
|
}
|
|
|
|
zoom_adjust
|
2002-04-29 01:41:07 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
alias zoom_decrease {
|
2002-05-11 06:09:50 +00:00
|
|
|
if #{!$zoom_zoomed} return
|
|
|
|
zoom_mult #{$zoom_mult/(1 + $zoom_mult_step)}
|
2002-04-29 01:41:07 +00:00
|
|
|
if #{$zoom_mult < $zoom_mult_lower} {
|
2002-05-11 06:09:50 +00:00
|
|
|
zoom_mult $zoom_mult_lower
|
|
|
|
}
|
|
|
|
zoom_adjust
|
2002-04-29 01:41:07 +00:00
|
|
|
}
|
|
|
|
|