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
|
/*
* Created by Ian "Goober5000" Warfield for the FreeSpace2 Source Code Project.
* You may not sell or otherwise commercially exploit the source or things you
* create based on the source.
*/
#ifndef _IFF_DEFS_H_
#define _IFF_DEFS_H_
#include "globalincs/pstypes.h"
#include "globalincs/globals.h"
#include "graphics/2d.h"
struct object;
// Goober5000 - new IFF color system
#define IFF_COLOR_SELECTION 0
#define IFF_COLOR_MESSAGE 1
#define IFF_COLOR_TAGGED 2
#define MAX_IFF_COLORS (MAX_IFFS + 3)
// iff flags
#define IFFF_SUPPORT_ALLOWED (1 << 0) // this IFF can call for support
#define IFFF_EXEMPT_FROM_ALL_TEAMS_AT_WAR (1 << 1) // self-explanatory
#define IFFF_ORDERS_HIDDEN (1 << 2) // the HUD will not show a targeted ship's orders
#define IFFF_ORDERS_SHOWN (1 << 3) // the HUD will show a targeted ship's orders (friendly has by default)
#define IFFF_WING_NAME_HIDDEN (1 << 4) // the HUD will not show a targeted ship's name if it is in a wing
#define MAX_IFF_FLAGS 5
// Goober5000
typedef struct iff_info {
// required stuff
char iff_name[NAME_LENGTH];
int color_index; // treat this as private and use iff_get_color or iff_get_color_by_team
// relationships
int attackee_bitmask; // treat this as private and use iff_get_attackee_mask or iff_x_attacks_y
int attackee_bitmask_all_teams_at_war; // treat this as private and use iff_get_attackee_mask or iff_x_attacks_y
int observed_color_index[MAX_IFFS]; // treat this as private and use iff_get_color or iff_get_color_by_team
// flags
int flags;
int default_parse_flags;
int default_parse_flags2;
// used internally, not parsed
int ai_rearm_timestamp;
// constructor to initialize everything to 0
iff_info()
: color_index( 0 ), attackee_bitmask( 0 ),
attackee_bitmask_all_teams_at_war( 0 ),
flags( 0 ), default_parse_flags( 0 ), default_parse_flags2( 0 ),
ai_rearm_timestamp( 0 )
{
memset( iff_name, 0, sizeof( iff_name ) );
memset( observed_color_index, 0, sizeof( observed_color_index ) );
}
} iff_info;
extern int Num_iffs;
extern iff_info Iff_info[MAX_IFFS];
extern int Iff_traitor;
// radar blip stuff
extern int radar_iff_color[5][2][4];
// color stuff
extern int iff_get_alpha_value(bool is_bright);
extern int iff_init_color(int r, int g, int b);
// load the iff table
extern void iff_init();
// search for iff
extern int iff_lookup(char *iff_name);
// attack stuff
// NB: As far as the differences between I attack him and he attacks me, think of a hidden traitor on your own team.
// If he fires at you, you don't react unless you are coded to attack him, because you are oblivious.
extern int iff_get_attackee_mask(int attacker_team);
extern int iff_get_attacker_mask(int attackee_team);
extern int iff_x_attacks_y(int team_x, int team_y);
// mask stuff
extern int iff_get_mask(int team);
extern int iff_matches_mask(int team, int mask);
// get color stuff
extern color *iff_get_color(int color_index, int is_bright);
extern color *iff_get_color_by_team(int team, int seen_from_team, int is_bright);
extern color *iff_get_color_by_team_and_object(int team, int seen_from_team, int is_bright, object *objp);
#endif
|