home *** CD-ROM | disk | FTP | other *** search
/ Fresh Fish 8 / FreshFishVol8-CD2.bin / bbs / misc / aspringies-1.0.lha / ASpringies / src / defs.h next >
Encoding:
C/C++ Source or Header  |  1994-08-24  |  3.5 KB  |  152 lines

  1. /* defs.h -- common defines, types and prototypes for ASpringies
  2.  * Copyright (C) 1991  Douglas M. DeCarlo
  3.  *
  4.  * Modifications for the Amiga port Copyright (C) 1994  Torsten Klein
  5.  *
  6.  * This file is part of ASpringies, a mass and spring simulation system for the Amiga
  7.  *
  8.  * ASpringies is free software; you can redistribute it and/or modify
  9.  * it under the terms of the GNU General Public License as published by
  10.  * the Free Software Foundation; either version 1, or (at your option)
  11.  * any later version.
  12.  *
  13.  * ASpringies is distributed in the hope that it will be useful,
  14.  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  15.  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  16.  * GNU General Public License for more details.
  17.  *
  18.  * You should have received a copy of the GNU General Public License
  19.  * along with ASpringies; see the file COPYING.  If not, write to
  20.  * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
  21.  *
  22.  * $Id: defs.h,v 1.5 1994/06/26 20:37:19 Torsten_Klein Exp $
  23.  */
  24.  
  25. #include <stdio.h>
  26.  
  27. #include <math.h>
  28. #include <stdlib.h>
  29. #include <exec/types.h>
  30.  
  31. typedef char boolean;
  32.  
  33. #define TRUE            1
  34. #define FALSE           0
  35.  
  36. #define MAXPATHLEN 128
  37.  
  38. #define COORD_X(x)    (x)
  39. #define COORD_Y(y)    (draw_ht - (y))
  40. #define COORD_DX(dx)    (dx)
  41. #define COORD_DY(dy)    (-(dy))
  42.  
  43. /* File operations */
  44. #define F_NONE        0
  45. #define F_LOAD        1
  46. #define F_SAVE        2
  47. #define F_INSERT    3
  48.  
  49. #define F_SAVEAS        4
  50.  
  51. #define SQR(x)          ((x) * (x))
  52. #define SGN(x)          ((x) < 0 ? (-1) : 1)
  53. #ifndef ABS
  54. #define ABS(x)          ((x) < 0 ? (-(x)) : (x))
  55. #endif
  56. #ifndef MIN
  57. #define MIN(x,y)        ((x) < (y) ? (x) : (y))
  58. #define MAX(x,y)        ((x) < (y) ? (y) : (x))
  59. #endif
  60.  
  61. /* Types of mouse actions */
  62. #define M_DOWN        0
  63. #define M_UP        1
  64. #define M_DRAG        2
  65. #define M_HOLD        3
  66. #define M_REDISPLAY    4
  67.  
  68. /* Forces */
  69. #define FR_GRAV        0
  70. #define FR_CMASS    1
  71. #define FR_PTATTRACT    2
  72. #define FR_WALL        3
  73.  
  74. #define BF_NUM        4
  75.  
  76. /* Defaults */
  77. #define DEF_TSTEP    0.025
  78.  
  79. typedef struct {
  80.   double  
  81.     cur_mass, cur_rest, cur_ks, cur_kd;
  82.   boolean 
  83.     fix_mass, show_spring;
  84.   int
  85.     center_id, bf_mode[BF_NUM];
  86.   double  
  87.     cur_grav_val[BF_NUM], cur_misc_val[BF_NUM],
  88.     cur_visc, cur_stick,  cur_dt, cur_prec;
  89.   boolean
  90.     adaptive_step, grid_snap;
  91.   double 
  92.     cur_gsnap;
  93.   boolean 
  94.     w_top, w_left, w_right, w_bottom;
  95. } t_state;
  96.  
  97.  
  98. /* -------- Variables defined --------- */
  99.  
  100. /* misc.c */
  101. char *xmalloc (int size);
  102. char *xrealloc (char *ptr, int size);
  103.  
  104. /* file.c */
  105. boolean file_command(char *file, int command);
  106.  
  107.  
  108. /* newmain.c */
  109. extern int draw_wid, draw_ht;
  110. extern t_state mst;
  111.  
  112. void new_main(void);
  113. void redisplay_widgets(void);
  114. int mass_radius(double m);
  115. void review_system(void);
  116.  
  117. /* obj.h */
  118.  
  119. void init_objects(void);
  120. void attach_fake_spring(int );
  121. void kill_fake_spring(void);
  122. void move_fake_mass(int , int );
  123. int create_mass(void);
  124. int create_spring(void);
  125. void add_massparent(int , int );
  126. void del_massparent(int , int );
  127. void delete_spring(int );
  128. void delete_mass(int );
  129. void delete_selected(void);
  130. void delete_all(void);
  131. void reconnect_masses(void);
  132. void restore_state(void);
  133. void save_state(void);
  134. int nearest_object(int , int , boolean *);
  135. void eval_selection(void);
  136. boolean anything_selected(void);
  137. void select_object(int , boolean , boolean );
  138. void select_objects(int , int , int , int , boolean );
  139. void unselect_all(void);
  140. void select_all(void);
  141. void duplicate_selected(void);
  142. void translate_selobj(int , int );
  143. void changevel_selobj(int , int , boolean );
  144. void tempfixed_obj(boolean );
  145. void set_sel_restlen(void);
  146. void set_center(void);
  147.  
  148. /* phys.c
  149.  */
  150. boolean animate_obj(void);
  151.  
  152.