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