]> icculus.org git repositories - btb/d2x.git/blob - main/editor/kview.c
imported missing editor files from d1x
[btb/d2x.git] / main / editor / kview.c
1 /*
2 THE COMPUTER CODE CONTAINED HEREIN IS THE SOLE PROPERTY OF PARALLAX
3 SOFTWARE CORPORATION ("PARALLAX").  PARALLAX, IN DISTRIBUTING THE CODE TO
4 END-USERS, AND SUBJECT TO ALL OF THE TERMS AND CONDITIONS HEREIN, GRANTS A
5 ROYALTY-FREE, PERPETUAL LICENSE TO SUCH END-USERS FOR USE BY SUCH END-USERS
6 IN USING, DISPLAYING,  AND CREATING DERIVATIVE WORKS THEREOF, SO LONG AS
7 SUCH USE, DISPLAY OR CREATION IS FOR NON-COMMERCIAL, ROYALTY OR REVENUE
8 FREE PURPOSES.  IN NO EVENT SHALL THE END-USER USE THE COMPUTER CODE
9 CONTAINED HEREIN FOR REVENUE-BEARING PURPOSES.  THE END-USER UNDERSTANDS
10 AND AGREES TO THE TERMS HEREIN AND ACCEPTS THE SAME BY USE OF THIS FILE.  
11 COPYRIGHT 1993-1998 PARALLAX SOFTWARE CORPORATION.  ALL RIGHTS RESERVED.
12 */
13 /*
14  * $Source: /cvs/cvsroot/d2x/main/editor/kview.c,v $
15  * $Revision: 1.1 $
16  * $Author: btb $
17  * $Date: 2004-12-19 13:54:27 $
18  *
19  * Functions for changing viewer's position
20  *
21  * $Log: not supported by cvs2svn $
22  * Revision 1.1.1.1  1999/06/14 22:03:34  donut
23  * Import of d1x 1.37 source.
24  *
25  * Revision 2.0  1995/02/27  11:34:21  john
26  * Version 2.0! No anonymous unions, Watcom 10.0, with no need
27  * for bitmaps.tbl.
28  * 
29  * Revision 1.11  1993/12/02  12:39:41  matt
30  * Removed extra includes
31  * 
32  * Revision 1.10  1993/11/16  13:47:54  john
33  * Xchanged move away/closer
34  * 
35  * Revision 1.9  1993/11/16  13:45:32  john
36  * Exchanged zoom in/out.
37  * 
38  * Revision 1.8  1993/11/05  17:32:56  john
39  * added funcs
40  * .,
41  * 
42  * Revision 1.7  1993/11/03  12:10:21  yuan
43  * No keypress associated with chase mode
44  * 
45  * Revision 1.6  1993/11/02  17:06:55  yuan
46  * Icon stuff added.
47  * 
48  * Revision 1.5  1993/11/01  12:48:59  yuan
49  * Added Chase mode icon to status bar.
50  * 
51  * Revision 1.4  1993/10/29  19:12:55  yuan
52  * Added diagnostic messages
53  * 
54  * Revision 1.3  1993/10/27  18:26:16  matt
55  * Made zoom & related keys not do anything if no current view
56  * 
57  * Revision 1.2  1993/10/19  20:54:33  matt
58  * Changed/cleaned up window updates
59  * 
60  * Revision 1.1  1993/10/13  18:53:34  john
61  * Initial revision
62  * 
63  *
64  */
65
66 #ifdef RCS
67 static char rcsid[] = "$Id: kview.c,v 1.1 2004-12-19 13:54:27 btb Exp $";
68 #endif
69
70 #include "inferno.h"
71 #include "editor.h"
72
73 // ---------- zoom control on current window ----------
74 int ZoomIn()
75 {
76         if (!current_view) return 0.0;
77
78         current_view->ev_zoom = fixmul(current_view->ev_zoom,62259);
79         current_view->ev_changed = 1;
80         return 1;
81 }
82
83 int ZoomOut()
84 {
85         if (!current_view) return 0.0;
86
87         current_view->ev_zoom = fixmul(current_view->ev_zoom,68985);
88         current_view->ev_changed = 1;
89         return 1;
90 }
91
92 // ---------- distance-of-viewer control on current window ----------
93 int MoveCloser()
94 {
95         if (!current_view) return 0.0;
96
97         current_view->ev_dist = fixmul(current_view->ev_dist,62259);
98         current_view->ev_changed = 1;
99         return 1;
100 }
101
102 int MoveAway()
103 {
104         if (!current_view) return 0.0;
105
106         current_view->ev_dist = fixmul(current_view->ev_dist,68985);
107         current_view->ev_changed = 1;
108         return 1;
109 }
110
111 // ---------- Toggle chase mode. ----------
112
113 int ToggleChaseMode()
114 {
115         Funky_chase_mode = !Funky_chase_mode;
116         set_view_target_from_segment(Cursegp);
117     if (Funky_chase_mode == 1) {
118         diagnostic_message("Chase mode ON.");
119     }
120     if (Funky_chase_mode == 0) {
121         diagnostic_message("Chase mode OFF.");
122     }
123     return Funky_chase_mode;
124 }
125