]> icculus.org git repositories - btb/d2x.git/blob - main/editor/kview.c
Fix crash if Num_walls=0
[btb/d2x.git] / main / editor / kview.c
1 /* $Id: kview.c,v 1.3 2004-12-19 15:21:11 btb Exp $ */
2 /*
3 THE COMPUTER CODE CONTAINED HEREIN IS THE SOLE PROPERTY OF PARALLAX
4 SOFTWARE CORPORATION ("PARALLAX").  PARALLAX, IN DISTRIBUTING THE CODE TO
5 END-USERS, AND SUBJECT TO ALL OF THE TERMS AND CONDITIONS HEREIN, GRANTS A
6 ROYALTY-FREE, PERPETUAL LICENSE TO SUCH END-USERS FOR USE BY SUCH END-USERS
7 IN USING, DISPLAYING,  AND CREATING DERIVATIVE WORKS THEREOF, SO LONG AS
8 SUCH USE, DISPLAY OR CREATION IS FOR NON-COMMERCIAL, ROYALTY OR REVENUE
9 FREE PURPOSES.  IN NO EVENT SHALL THE END-USER USE THE COMPUTER CODE
10 CONTAINED HEREIN FOR REVENUE-BEARING PURPOSES.  THE END-USER UNDERSTANDS
11 AND AGREES TO THE TERMS HEREIN AND ACCEPTS THE SAME BY USE OF THIS FILE.
12 COPYRIGHT 1993-1998 PARALLAX SOFTWARE CORPORATION.  ALL RIGHTS RESERVED.
13 */
14
15 /*
16  *
17  * Functions for changing viewer's position
18  *
19  */
20
21 #ifdef RCS
22 static char rcsid[] = "$Id: kview.c,v 1.3 2004-12-19 15:21:11 btb Exp $";
23 #endif
24
25 #ifdef HAVE_CONFIG_H
26 #include "conf.h"
27 #endif
28
29 #include "inferno.h"
30 #include "editor.h"
31
32 // ---------- zoom control on current window ----------
33 int ZoomIn()
34 {
35         if (!current_view) return 0.0;
36
37         current_view->ev_zoom = fixmul(current_view->ev_zoom,62259);
38         current_view->ev_changed = 1;
39         return 1;
40 }
41
42 int ZoomOut()
43 {
44         if (!current_view) return 0.0;
45
46         current_view->ev_zoom = fixmul(current_view->ev_zoom,68985);
47         current_view->ev_changed = 1;
48         return 1;
49 }
50
51 // ---------- distance-of-viewer control on current window ----------
52 int MoveCloser()
53 {
54         if (!current_view) return 0.0;
55
56         current_view->ev_dist = fixmul(current_view->ev_dist,62259);
57         current_view->ev_changed = 1;
58         return 1;
59 }
60
61 int MoveAway()
62 {
63         if (!current_view) return 0.0;
64
65         current_view->ev_dist = fixmul(current_view->ev_dist,68985);
66         current_view->ev_changed = 1;
67         return 1;
68 }
69
70 // ---------- Toggle chase mode. ----------
71
72 int ToggleChaseMode()
73 {
74         Funky_chase_mode = !Funky_chase_mode;
75         set_view_target_from_segment(Cursegp);
76     if (Funky_chase_mode == 1) {
77         diagnostic_message("Chase mode ON.");
78     }
79     if (Funky_chase_mode == 0) {
80         diagnostic_message("Chase mode OFF.");
81     }
82     return Funky_chase_mode;
83 }
84