home *** CD-ROM | disk | FTP | other *** search
/ Amiga Plus 2000 #5 / Amiga Plus CD - 2000 - No. 5.iso / Tools / Dev / gltron_src / data.h < prev   
Encoding:
C/C++ Source or Header  |  2000-01-01  |  3.9 KB  |  188 lines

  1. #ifndef DATA_H
  2. #define DATA_H
  3.  
  4. /* data structures */
  5.  
  6. #include "model.h"
  7.  
  8. typedef struct callbacks {
  9.   void (*display)(void);
  10.   void (*idle)(void);
  11.   void (*keyboard)(int, int, int);
  12.   void (*init)(void);
  13.   void (*exit)(void);
  14.   void (*initGL)(void);
  15. } callbacks;
  16.  
  17. typedef struct line {
  18.   float sx, sy, ex, ey;
  19. } line;
  20.  
  21. typedef struct Model {
  22.   Mesh **mesh; /* models (lod) */
  23.   int lod; /* number of models */
  24.   // int *lod_dist;
  25.   
  26.   float color_alpha[4]; /* alpha trail */
  27.   float color_trail[4]; /* solid edges of trail */
  28.   float color_model[4]; /* model color */
  29. } Model;
  30.  
  31. typedef struct Data {
  32.   float posx; float posy;
  33.  
  34.   int dir; int last_dir;
  35.   int turn_time;
  36.   
  37.   int score;
  38.   float speed; /* set to -1 when dead */
  39.   float trail_height; /* countdown to zero when dead */
  40.   float exp_radius; /* explosion of the cycle model */
  41.   line *trails;
  42.   line *trail; /* current trail */
  43. } Data;
  44.  
  45. typedef struct Camera {
  46.   float cam[3];
  47.   float target[3];
  48.   float angle;
  49.   int camType;
  50. } Camera;
  51.  
  52. typedef struct AI {
  53.   int active;
  54.   int tdiff; /*  */
  55.   int moves;
  56.   long lasttime;
  57.   int danger;
  58. } AI;
  59.  
  60. typedef struct gDisplay {
  61.   int win_id;     /* nur das globale Window hat eine */
  62.   int h, w;       /* window */
  63.   int vp_x, vp_y; /* viewport */
  64.   int vp_h, vp_w;
  65.   int blending;
  66.   int fog;
  67.   int shademodel;
  68.   int wall;
  69.   int onScreen;
  70.  
  71.   unsigned int texFloor; 
  72.   unsigned int texWall_1;
  73.   unsigned int texWall_2;
  74.   unsigned int texWall_3;
  75.   unsigned int texWall_4;
  76.   unsigned int texGui;
  77.   unsigned int texLogo;
  78.   unsigned int texCrash;
  79.   unsigned int texTrail;
  80.   unsigned int texTrailDecal;
  81. } gDisplay;
  82.  
  83. typedef struct Player {
  84.   Model *model;
  85.   Data *data;
  86.   Camera *camera;
  87.   gDisplay *display;
  88.   AI *ai;
  89. } Player;
  90.  
  91. /* if you want to add something and make it permanent (via
  92.    .gltronrc) then
  93.    1) add it to Settings in data.h
  94.    2) add it to settings.txt
  95.    3) add pointer to initSettingsData() in settings.c
  96.    4) add a default to initMainGameSettings() in settings.c
  97.    5) make a menu entry in menu.txt
  98. */
  99.  
  100. enum {
  101.   BILINEAR = 0,
  102.   TRILINEAR = 1
  103. };
  104.  
  105. typedef struct Settings {
  106.   /* these settings affect the visuals and sound etc.
  107.      and are client side only */
  108.  
  109.   int show_help;
  110.   int show_fps;
  111.   int show_wall;
  112.   int show_2d;
  113.   int show_alpha;
  114.   int alpha_trails;
  115.  
  116.   int show_floor_texture;
  117.   int show_glow;
  118.   int show_ai_status;
  119.   int show_model;
  120.   int lod;
  121.   int show_crash_texture;
  122.   int model_backwards;
  123.   int turn_cycle; /* smooth turning */
  124.   int line_spacing; /* space between lines when the floor texture is
  125.                disabled */
  126.   int use_mipmaps; /* enable / disable mipmapping */
  127.   int mipmap_filter; /* bilinear / trilinear */
  128.  
  129.   int camType;
  130.   int mouse_warp;
  131.  
  132.   int display_type; /* 0-2 -> 1, 2 or 4 displays on the screen */
  133.   int content[4]; /* max. 4 individual viewports on the screen */
  134.   int windowMode; /* 0: fullscreen, non-zero: window mode */
  135.  
  136.   int fov;
  137.   int width;
  138.   int height;
  139.  
  140.   int playMusic;
  141.   int playEffects;
  142.  
  143.   float musicVolume;
  144.   float fxVolume;
  145.  
  146.   /* these two are ignored in multiplayer mode */
  147.   int fast_finish;
  148.   int screenSaver; /* 1: all for players are AIs when the game starts */
  149.  
  150.   /* no AI in multiplayer yet */
  151.   int ai_player1;
  152.   int ai_player2;
  153.   int ai_player3;
  154.   int ai_player4;
  155.   int ai_level;
  156.  
  157.   /* these gettings affect the gameplay */
  158.   int erase_crashed;
  159.   int game_speed; /* index */
  160.   float speed;
  161.   float current_speed;
  162.   int grid_size;
  163.   int arena_size; /* index */
  164. } Settings;
  165.  
  166. typedef struct Game {
  167.   gDisplay *screen;
  168.   Settings *settings;
  169.   Player *player;
  170.   int players; /* number of players - currently limited to 4 somewhere */
  171.   int winner; /* who won this round */
  172.   int pauseflag; /* if the game is finished: the PAUSE_GAME_FINISHED flag
  173.             is set */
  174.   int running; /* the amount of players that are still alive */
  175. } Game;
  176.  
  177. typedef struct settings_int {
  178.   char name[32];
  179.   int *value;
  180. } settings_int;
  181.  
  182. typedef struct settings_float {
  183.   char name[32];
  184.   float *value;
  185. } settings_float;
  186.  
  187. #endif
  188.