1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369
|
/*
SABRE Fighter Plane Simulator
Copyright (c) 1997 Dan Hammer
Portions Donated By Antti Barck
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 1, or (at your option)
any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
/*************************************************
* SABRE Fighter Plane Simulator *
* File : unguided.h *
* Date : March, 1997 *
* Author : Dan Hammer *
*************************************************/
#ifndef __unguided_h
#define __unguided_h
#include "target.h"
#include "viewobj.h"
#include "moveable.h"
#include "weapons.h"
class Rocket_Trail;
#define MAX_RADIUS_HITS 10
class Projectile : public Moveable
{
public:
float max_time;
float elapsed_time;
FlightLight *flt;
FlightLight_Specs *specs;
int damage;
int view_color;
float view_len;
int is_tracer;
Weapon_Specs *wspecs;
Target *hit;
Target *radius_hits[MAX_RADIUS_HITS];
int rad_hits;
Target *launcher;
Rocket_Trail *smk;
int fuse_type;
float fuse_data;
R_3DPoint t_position;
R_3DPoint l_position,s_position;
Projectile(FlightLight_Specs *spcs)
: specs(spcs)
{
active = 0;
flt = NULL;
view = NULL;
max_time = spcs->time_limit;
damage = 1;
view_len = 0.0;
launcher = NULL;
is_tracer = 1;
wspecs = NULL;
smk = NULL;
rad_hits = 0;
fuse_data = 0.0;
fuse_type = 0;
}
virtual ~Projectile();
virtual void create_view();
virtual void init();
void activate(Launch_Params &);
void activate(R_3DPoint &, Vector &);
void activate(R_3DPoint &r)
{ Moveable::activate(r); }
void activate(Flight &f, Gun_Specs *gs, int n = 1)
{ Moveable::activate(f,gs,n); }
void activate(Flight &f)
{ Moveable::activate(f); }
virtual void de_activate();
virtual void update();
void pause()
{ if (flt) flt->pause(); }
void start()
{ if (flt) flt->start(); }
int check_for_hit();
int check_radius_hits();
virtual void add_draw_list(DrawList &dl, Port_3D &port);
int has_damage_radius()
{
return (wspecs->getDamageRadius() > 0.0);
}
int wepType()
{
return (wspecs->getType());
}
Weapon_Specs *getWepSpecs()
{
return (wspecs);
}
};
class BlastMap : public TMoveable
{
public:
TextrMap *initmap;
TextrMap *map;
float initdur;
int initflag;
BlastMap()
{
initdur = 0.0;
initflag = 0;
}
void init();
virtual void update();
virtual void de_activate();
void add_draw_list(DrawList & dl, Port_3D & port);
static float bm_sizex;
static float bm_sizey;
static float bm_dur;
static char *bm_map;
static char *bm_initmap;
static float bm_initdur;
};
class DustUp : public TMoveable
{
public:
void init();
virtual void de_activate();
float size;
DustUp(float mtime = 0.55)
: TMoveable(mtime),
size(0.13)
{}
};
#define MAX_VSMOKES 64
class Smokey : public TMoveable
{
public:
int n_smokes;
Bitmap_View *views[MAX_VSMOKES];
int next_view;
int nview;
char *smokemap_id;
TextrMap *smokemap;
char *firemap_id;
TextrMap *firemap;
float init_size;
float d_size,d_len;
float kink;
Vector v;
int has_flame;
float flame_time_max;
float flame_time;
int flame_flag;
int nflames;
R_3DPoint cur_position;
float cur_size;
static int sm_n_smokes;
static float sm_init_size;
static float sm_d_size;
static float sm_d_len;
static float sm_kink;
static float sm_max_time;
static int sm_has_flame;
static float sm_flame_time_max;
static int sm_nflames;
static char *sm_smokemap_id;
static char *sm_firemap_id;
Smokey();
virtual ~Smokey();
static void initSmokey();
void setLocalParams();
virtual void init();
virtual void activate(R_3DPoint &);
virtual void activate(Flight &flt)
{ TMoveable::activate(flt); }
virtual void activate(R_3DPoint &p, Vector &vc)
{ TMoveable::activate(p,vc); }
virtual void activate(Flight &launcher, Gun_Specs *g_specs, int n = 1)
{ TMoveable::activate(launcher,g_specs,n); }
virtual void activate(Launch_Params &lp)
{ TMoveable::activate(lp); }
virtual void de_activate();
virtual void update();
virtual void add_draw_list(DrawList &, Port_3D &);
};
class Smoke_Trail : public Smokey
{
public:
Flight *flight;
virtual void activate(Flight &);
virtual void activate(R_3DPoint &r)
{ flame_flag = 0; Smokey::activate(r); }
virtual void activate(R_3DPoint &r, Vector &v)
{ flame_flag = 0; Smokey::activate(r,v); }
virtual void activate(Flight &launcher, Gun_Specs *g_specs, int n = 1)
{ flame_flag = 0; Smokey::activate(launcher,g_specs,n); }
virtual void activate(Launch_Params &lp)
{ flame_flag = 0; Smokey::activate(lp); }
void de_activate();
void init();
virtual void update();
virtual void add_draw_list(DrawList &, Port_3D &);
Smoke_Trail();
};
class Rocket_Trail : public Smoke_Trail
{
public:
FlightLight *fltlte;
Rocket_Specs *rspcs;
Rocket_Trail(Rocket_Specs *rspcs)
:Smoke_Trail()
{
this->rspcs = rspcs;
fltlte = NULL;
}
virtual void activate(FlightLight *);
virtual void update();
virtual void activate(R_3DPoint &r)
{ flame_flag = 0; Smokey::activate(r); }
virtual void activate(R_3DPoint &r, Vector &v)
{ flame_flag = 0; Smokey::activate(r,v); }
virtual void activate(Flight &launcher, Gun_Specs *g_specs, int n = 1)
{ flame_flag = 0; Smokey::activate(launcher,g_specs,n); }
virtual void activate(Launch_Params &lp)
{ flame_flag = 0; Smokey::activate(lp); }
virtual void activate(Flight &f)
{ Smoke_Trail::activate(f); }
};
class Debris : public Projectile
{
public:
FlightLight_Specs *global_specs;
FlightLight_Specs *local_specs;
Debris(FlightLight_Specs *spcs)
: Projectile(spcs),
global_specs(spcs),
local_specs(NULL)
{}
virtual ~Debris()
{
if (local_specs != NULL)
delete local_specs;
}
void de_activate();
void init();
void update();
void create_view();
};
#define MAX_ROUNDS 340
#define MAX_FLAK 60
#define MAX_BLASTS 40
#define MAX_DUSTUPS 40
#define MAX_DEBRIS 220
#define MAX_SMOKES 40
#define MAX_STRAILS 40
class Unguided_Manager
{
public:
FlightLight_Specs specs;
FlightLight_Specs flak_specs;
int nrounds;
int active_count;
Projectile *rounds[MAX_ROUNDS];
Projectile *flak[MAX_FLAK];
int nflak,active_flak;
float rtime,elapsed_time;
Unguided_Manager();
~Unguided_Manager();
int update();
int new_round(Launch_Params &);
int new_flak(R_3DPoint &, Vector &);
void add_draw_list(DrawList &, Port_3D &);
int check_hits();
void handle_hit(Target *hit, Projectile *p);
void handle_radius_hits(Projectile *p);
void create_debris(R_3DPoint &p, int l, int w, int n,
Vector_Q *vq = NULL);
void pause();
void start();
void boom(R_3DPoint &origin, int flags);
BlastMap *blasts[MAX_BLASTS];
int nblasts;
int new_blast(R_3DPoint &, float, float, float, char * = "fire",
char * = "smoke", float = 1.0);
int endProjectilePath(Projectile *p);
DustUp *dustups[MAX_DUSTUPS];
int ndustups;
int new_dustup(R_3DPoint &);
Smokey *smokeys[MAX_SMOKES];
int new_smoke(R_3DPoint &p,
int n_smokes,
float init_size,
float d_size,
float d_len,
float kink,
float max_time,
int has_flame,
float flame_time_max,
int n_flames,
char *smokmap_id,
char *firemap_id);
Smoke_Trail *smoke_trails[MAX_STRAILS];
int new_smoke_trail(Flight &);
FlightLight_Specs debris_specs;
Debris *debris[MAX_DEBRIS];
Moveables m_rounds,
m_flak,
m_blasts,
m_dustups,
m_debris,
m_smokes,
m_strails;
static Unguided_Manager *the_umanager;
static Target **targets;
static int ntargets;
static int inited;
static void setTargetList(Target **ts, int n)
{
targets = ts;
ntargets = n;
}
static void setUnguidedManager(Unguided_Manager *um)
{
the_umanager = um;
}
static void initUnguided();
};
#endif
|