]> icculus.org git repositories - btb/d2x.git/blob - main/editor/kcurve.c
include conf.h in new editor files
[btb/d2x.git] / main / editor / kcurve.c
1 /* $Id: kcurve.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 curve stuff.
18  *
19  */
20
21 #ifdef RCS
22 static char rcsid[] = "$Id: kcurve.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 <string.h>
30
31 #include "inferno.h"
32 #include "editor.h"
33 #include "kdefs.h"
34
35 static fix         r1scale, r4scale;
36 static int         curve;
37
38 int InitCurve()
39 {
40         curve = 0;
41     return 1;
42 }
43
44 int GenerateCurve()
45 {
46     if ( (Markedsegp != 0) && !IS_CHILD(Markedsegp->children[Markedside])) {
47                 r1scale = r4scale = F1_0*20;
48       autosave_mine( mine_filename );
49       diagnostic_message("Curve Generated.");
50                 Update_flags |= UF_WORLD_CHANGED;
51       curve = generate_curve(r1scale, r4scale);
52                 mine_changed = 1;
53         if (curve == 1) {
54             strcpy(undo_status[Autosave_count], "Curve Generation UNDONE.\n");
55         }
56         if (curve == 0) diagnostic_message("Cannot generate curve -- check Current segment.");
57     }
58     else diagnostic_message("Cannot generate curve -- check Marked segment.");
59         warn_if_concave_segments();
60
61         return 1;
62 }
63
64 int DecreaseR4()
65 {
66         if (curve) {
67            Update_flags |= UF_WORLD_CHANGED;
68            delete_curve();
69            r4scale -= F1_0;
70            generate_curve(r1scale, r4scale);
71       diagnostic_message("R4 vector decreased.");
72            mine_changed = 1;
73                 warn_if_concave_segments();
74         }
75         return 1;
76 }
77
78 int IncreaseR4()
79 {
80         if (curve) {
81            Update_flags |= UF_WORLD_CHANGED;
82            delete_curve();
83            r4scale += F1_0;
84            generate_curve(r1scale, r4scale);
85       diagnostic_message("R4 vector increased.");
86            mine_changed = 1;
87                 warn_if_concave_segments();
88         }
89         return 1;
90 }
91
92 int DecreaseR1()
93 {
94         if (curve) {
95            Update_flags |= UF_WORLD_CHANGED;
96            delete_curve();
97            r1scale -= F1_0;
98            generate_curve(r1scale, r4scale);
99       diagnostic_message("R1 vector decreased.");
100            mine_changed = 1;
101                 warn_if_concave_segments();
102         }
103         return 1;
104 }
105
106 int IncreaseR1()
107 {
108         if (curve) {
109            Update_flags |= UF_WORLD_CHANGED;
110            delete_curve();
111            r1scale += F1_0;
112            generate_curve(r1scale, r4scale);
113       diagnostic_message("R1 vector increased.");
114            mine_changed = 1;
115                 warn_if_concave_segments();
116         }
117         return 1;
118 }
119
120 int DeleteCurve()
121 {
122 // fix_bogus_uvs_all();
123 set_average_light_on_curside();
124
125         if (curve) {
126            Update_flags |= UF_WORLD_CHANGED;
127            delete_curve();
128            curve = 0;
129            mine_changed = 1;
130       diagnostic_message("Curve Deleted.");
131                 warn_if_concave_segments();
132         }
133         return 1;
134 }
135
136 int SetCurve()
137 {
138         if (curve) curve = 0;
139    //autosave_mine( mine_filename );
140    //strcpy(undo_status[Autosave_count], "Curve Generation UNDONE.\n");
141    return 1;
142 }
143