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
|
/*
* Copyright (C) Volition, Inc. 1999. All rights reserved.
*
* All source code herein is the property of Volition, Inc. You may not sell
* or otherwise commercially exploit the source or things you created based on the
* source.
*
*/
#ifndef _FIREBALLS_H
#define _FIREBALLS_H
#include "globalincs/pstypes.h"
#include "model/modelrender.h"
#include "gamesnd/gamesnd.h"
class object;
class ship_info;
class asteroid_info;
// values correspond to the fireball render types
#define FIREBALL_MEDIUM_EXPLOSION 0
#define FIREBALL_LARGE_EXPLOSION 1
#define FIREBALL_WARP_EFFECT 2
// these values correspond to the fireball.tbl default entries
#define FIREBALL_EXPLOSION_MEDIUM 0 // Used for the 4 little explosions before a ship explodes
#define FIREBALL_WARP 1 // Used for the warp in / warp out effect
#define FIREBALL_KNOSSOS 2 // Used for the KNOSSOS warp in / warp out effect
#define FIREBALL_ASTEROID 3
#define FIREBALL_EXPLOSION_LARGE1 4 // Used for the big explosion when a ship breaks into pieces
#define FIREBALL_EXPLOSION_LARGE2 5 // Used for the big explosion when a ship breaks into pieces
#define NUM_DEFAULT_FIREBALLS 6
#define MAX_FIREBALL_LOD 4
#define FIREBALL_NUM_LARGE_EXPLOSIONS 2
// all this moved here by Goober5000 because it makes more sense in the H file
typedef struct fireball_lod {
char filename[MAX_FILENAME_LEN];
int bitmap_id;
int num_frames;
int fps;
} fireball_lod;
typedef struct fireball_info {
char unique_id[NAME_LENGTH];
int lod_count;
fireball_lod lod[MAX_FIREBALL_LOD];
float exp_color[3]; // red, green, blue
bool use_3d_warp;
bool fireball_used;
char warp_glow[NAME_LENGTH];
int warp_glow_bitmap;
char warp_ball[NAME_LENGTH];
int warp_ball_bitmap;
char warp_model[NAME_LENGTH];
int warp_model_id;
} fireball_info;
extern SCP_vector<fireball_info> Fireball_info;
// flag values for fireball struct flags member
#define FBF_WARP_CLOSE_SOUND_PLAYED (1<<0)
#define FBF_WARP_CAPITAL_SIZE (1<<1)
#define FBF_WARP_CRUISER_SIZE (1<<2)
#define FBF_WARP_3D (1<<3) // Goober5000
#define FBF_WARP_VIA_SEXP (1<<4) // Goober5000
typedef struct fireball {
int objnum; // If -1 this object is unused
int fireball_info_index; // Index into Fireball_info array
int fireball_render_type;
int current_bitmap;
int orient; // For fireballs, which orientation. For warps, 0 is warpin, 1 is warpout
int flags; // see #define FBF_*
char lod; // current LOD
float time_elapsed; // in seconds
float total_time; // total lifetime of animation in seconds
// for warp-effect - Goober5000
gamesnd_id warp_open_sound_index;
gamesnd_id warp_close_sound_index;
float warp_open_duration;
float warp_close_duration;
// the sound multiplier is based on the ship class, but we lose that while the warp is closing
float warp_sound_range_multiplier;
} fireball;
// end move
extern SCP_vector<fireball> Fireballs;
extern bool fireballs_inited;
void fireball_init();
void fireball_render(object* obj, model_draw_list *scene);
void fireball_delete( object * obj );
void fireball_process_post(object * obj, float frame_time);
// This does not load all the data, just the filenames and such. Only used by FRED.
void fireball_parse_tbl();
int fireball_info_lookup(const char *unique_id);
// reverse is for warp_in/out effects
// velocity: If not NULL, the fireball will move at a constant velocity.
// warp_lifetime: If warp_lifetime > 0.0f then makes the explosion loop so it lasts this long. Only works for warp effect
int fireball_create(vec3d *pos, int fireball_type, int render_type, int parent_obj, float size, bool reverse=false, vec3d *velocity=nullptr, float warp_lifetime=0.0f, int ship_class=-1, matrix *orient=nullptr, int low_res=0, int extra_flags=0, gamesnd_id warp_open_sound=gamesnd_id(), gamesnd_id warp_close_sound=gamesnd_id(), float warp_open_duration=-1.0f, float warp_close_duration=-1.0f);
void fireball_close();
// Returns 1 if you can remove this fireball
int fireball_is_perishable(object * obj);
// Returns 1 if this fireball is a warp
int fireball_is_warp(object * obj);
// Returns life left of a fireball in seconds
float fireball_lifeleft( object *obj );
// Returns life left of a fireball in percent
float fireball_lifeleft_percent( object *obj );
// returns the lighting color (in [0...1] range) to use for explosion
void fireball_get_color(int idx, float *red, float *green, float *blue);
// returns the index of the fireball bitmap for this ship. -1 if there is none.
int fireball_ship_explosion_type(ship_info *sip);
// returns the index of the fireball bitmap for this asteroid. -1 if there is none.
int fireball_asteroid_explosion_type(asteroid_info *aip);
// returns the intensity of a wormhole
float fireball_wormhole_intensity( fireball *fb );
// Goober5000
extern bool Knossos_warp_ani_used;
extern bool Fireball_use_3d_warp;
extern bool Fireball_warp_flash;
// Cyborg - get a count of how many valid fireballs are in the mission.
int fireball_get_count();
// Goober5000 - stuffs fireballs and checks that indexes are in bounds
void stuff_fireball_index_list(SCP_vector<int> &list, const char *name);
#endif /* _FIREBALLS_H */
|