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