Details | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
1 | pmbaty | 1 | /* |
2 | * Portions of this file are copyright Rebirth contributors and licensed as |
||
3 | * described in COPYING.txt. |
||
4 | * Portions of this file are copyright Parallax Software and licensed |
||
5 | * according to the Parallax license below. |
||
6 | * See COPYING.txt for license details. |
||
7 | |||
8 | THE COMPUTER CODE CONTAINED HEREIN IS THE SOLE PROPERTY OF PARALLAX |
||
9 | SOFTWARE CORPORATION ("PARALLAX"). PARALLAX, IN DISTRIBUTING THE CODE TO |
||
10 | END-USERS, AND SUBJECT TO ALL OF THE TERMS AND CONDITIONS HEREIN, GRANTS A |
||
11 | ROYALTY-FREE, PERPETUAL LICENSE TO SUCH END-USERS FOR USE BY SUCH END-USERS |
||
12 | IN USING, DISPLAYING, AND CREATING DERIVATIVE WORKS THEREOF, SO LONG AS |
||
13 | SUCH USE, DISPLAY OR CREATION IS FOR NON-COMMERCIAL, ROYALTY OR REVENUE |
||
14 | FREE PURPOSES. IN NO EVENT SHALL THE END-USER USE THE COMPUTER CODE |
||
15 | CONTAINED HEREIN FOR REVENUE-BEARING PURPOSES. THE END-USER UNDERSTANDS |
||
16 | AND AGREES TO THE TERMS HEREIN AND ACCEPTS THE SAME BY USE OF THIS FILE. |
||
17 | COPYRIGHT 1993-1998 PARALLAX SOFTWARE CORPORATION. ALL RIGHTS RESERVED. |
||
18 | */ |
||
19 | |||
20 | /* |
||
21 | * |
||
22 | * Functions for curve stuff. |
||
23 | * |
||
24 | */ |
||
25 | |||
26 | |||
27 | #include <string.h> |
||
28 | |||
29 | #include "inferno.h" |
||
30 | #include "editor.h" |
||
31 | #include "editor/esegment.h" |
||
32 | #include "kdefs.h" |
||
33 | |||
34 | static fix r1scale, r4scale; |
||
35 | static int curve; |
||
36 | |||
37 | int InitCurve() |
||
38 | { |
||
39 | curve = 0; |
||
40 | return 1; |
||
41 | } |
||
42 | |||
43 | int GenerateCurve() |
||
44 | { |
||
45 | if (Markedsegp != segment_none && !IS_CHILD(Markedsegp->children[Markedside])) |
||
46 | { |
||
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 | undo_status[Autosave_count] = "Curve Generation UNDONE."; |
||
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 |