home *** CD-ROM | disk | FTP | other *** search
/ Amiga ACS 1998 #6 / amigaacscoverdisc1998-061998.iso / games / descent / source / main / editor / kcurve.c < prev    next >
C/C++ Source or Header  |  1998-06-08  |  5KB  |  202 lines

  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.  * $Source: f:/miner/source/main/editor/rcs/kcurve.c $
  15.  * $Revision: 2.0 $
  16.  * $Author: john $
  17.  * $Date: 1995/02/27 11:35:29 $
  18.  *
  19.  * Functions for curve stuff.
  20.  *
  21.  * $Log: kcurve.c $
  22.  * Revision 2.0  1995/02/27  11:35:29  john
  23.  * Version 2.0! No anonymous unions, Watcom 10.0, with no need
  24.  * for bitmaps.tbl.
  25.  * 
  26.  * Revision 1.17  1994/08/25  21:56:43  mike
  27.  * IS_CHILD stuff.
  28.  * 
  29.  * Revision 1.16  1994/05/14  17:17:54  matt
  30.  * Got rid of externs in source (non-header) files
  31.  * 
  32.  * Revision 1.15  1994/01/28  10:52:24  mike
  33.  * Bind set_average_light_on_curside to DeleteCurve
  34.  * 
  35.  * Revision 1.14  1994/01/25  17:34:47  mike
  36.  * Stupidly bound fix_bogus_uvs_all to delete curve.
  37.  * 
  38.  * Revision 1.13  1993/12/06  19:34:15  yuan
  39.  * Fixed autosave so that undo restores Cursegp
  40.  * and Markedsegp
  41.  * 
  42.  * Revision 1.12  1993/12/02  12:39:28  matt
  43.  * Removed extra includes
  44.  * 
  45.  * Revision 1.11  1993/11/12  13:08:38  yuan
  46.  * Fixed warning for concave segment so it appears after any
  47.  * "less important" diagnostic messages.
  48.  * 
  49.  * Revision 1.10  1993/11/11  17:03:25  yuan
  50.  * Fixed undo-status display
  51.  * 
  52.  * Revision 1.9  1993/11/11  15:55:11  yuan
  53.  * Added undo messages.
  54.  * 
  55.  * Revision 1.8  1993/11/08  19:13:30  yuan
  56.  * Added Undo command (not working yet)
  57.  * 
  58.  * Revision 1.7  1993/11/05  17:32:51  john
  59.  * added funcs
  60.  * .,
  61.  * 
  62.  * Revision 1.6  1993/10/29  19:12:41  yuan
  63.  * Added diagnostic messages
  64.  * 
  65.  * Revision 1.5  1993/10/29  16:26:30  yuan
  66.  * Added diagnostic messages for curve generation
  67.  * 
  68.  * Revision 1.4  1993/10/22  19:47:30  yuan
  69.  * Can't build curve if Marked Seg has a segment attached.
  70.  * 
  71.  * Revision 1.3  1993/10/19  20:54:50  matt
  72.  * Changed/cleaned up window updates
  73.  * 
  74.  * Revision 1.2  1993/10/14  13:52:17  mike
  75.  * Add return value to AssignTexture
  76.  * 
  77.  * Revision 1.1  1993/10/13  18:53:11  john
  78.  * Initial revision
  79.  * 
  80.  *
  81.  */
  82.  
  83. #pragma off (unreferenced)
  84. static char rcsid[] = "$Id: kcurve.c 2.0 1995/02/27 11:35:29 john Exp $";
  85. #pragma on (unreferenced)
  86.  
  87. #include <string.h>
  88.  
  89. #include "inferno.h"
  90. #include "editor.h"
  91. #include "kdefs.h"
  92.  
  93. static fix         r1scale, r4scale;
  94. static int         curve;
  95.  
  96. int InitCurve()
  97. {
  98.     curve = 0;
  99.     return 1;
  100. }
  101.  
  102. int GenerateCurve()
  103. {
  104.     if ( (Markedsegp != 0) && !IS_CHILD(Markedsegp->children[Markedside])) {
  105.         r1scale = r4scale = F1_0*20;
  106.       autosave_mine( mine_filename );
  107.       diagnostic_message("Curve Generated.");
  108.         Update_flags |= UF_WORLD_CHANGED;
  109.       curve = generate_curve(r1scale, r4scale);
  110.         mine_changed = 1;
  111.         if (curve == 1) {
  112.             strcpy(undo_status[Autosave_count], "Curve Generation UNDONE.\n");
  113.         }
  114.         if (curve == 0) diagnostic_message("Cannot generate curve -- check Current segment.");
  115.     }
  116.     else diagnostic_message("Cannot generate curve -- check Marked segment.");
  117.     warn_if_concave_segments();
  118.  
  119.     return 1;
  120. }
  121.  
  122. int DecreaseR4()
  123. {
  124.     if (curve) {
  125.        Update_flags |= UF_WORLD_CHANGED;
  126.        delete_curve();
  127.        r4scale -= F1_0;
  128.        generate_curve(r1scale, r4scale);
  129.       diagnostic_message("R4 vector decreased.");
  130.        mine_changed = 1;
  131.         warn_if_concave_segments();
  132.     }
  133.     return 1;
  134. }
  135.  
  136. int IncreaseR4()
  137. {
  138.     if (curve) {
  139.        Update_flags |= UF_WORLD_CHANGED;
  140.        delete_curve();
  141.        r4scale += F1_0;
  142.        generate_curve(r1scale, r4scale);
  143.       diagnostic_message("R4 vector increased.");
  144.        mine_changed = 1;
  145.         warn_if_concave_segments();
  146.     }
  147.     return 1;
  148. }
  149.  
  150. int DecreaseR1()
  151. {
  152.     if (curve) {
  153.        Update_flags |= UF_WORLD_CHANGED;
  154.        delete_curve();
  155.        r1scale -= F1_0;
  156.        generate_curve(r1scale, r4scale);
  157.       diagnostic_message("R1 vector decreased.");
  158.        mine_changed = 1;
  159.         warn_if_concave_segments();
  160.     }
  161.     return 1;
  162. }
  163.  
  164. int IncreaseR1()
  165. {
  166.     if (curve) {
  167.        Update_flags |= UF_WORLD_CHANGED;
  168.        delete_curve();
  169.        r1scale += F1_0;
  170.        generate_curve(r1scale, r4scale);
  171.       diagnostic_message("R1 vector increased.");
  172.        mine_changed = 1;
  173.         warn_if_concave_segments();
  174.     }
  175.     return 1;
  176. }
  177.  
  178. int DeleteCurve()
  179. {
  180. // fix_bogus_uvs_all();
  181. set_average_light_on_curside();
  182.  
  183.     if (curve) {
  184.        Update_flags |= UF_WORLD_CHANGED;
  185.        delete_curve();
  186.        curve = 0;
  187.        mine_changed = 1;
  188.       diagnostic_message("Curve Deleted.");
  189.         warn_if_concave_segments();
  190.     }
  191.     return 1;
  192. }
  193.  
  194. int SetCurve()
  195. {
  196.     if (curve) curve = 0;
  197.    //autosave_mine( mine_filename );
  198.    //strcpy(undo_status[Autosave_count], "Curve Generation UNDONE.\n");
  199.    return 1;
  200. }
  201.  
  202.