FS2_Open
Open source remastering of the Freespace 2 engine
iff_defs.h
Go to the documentation of this file.
1 /*
2  * Created by Ian "Goober5000" Warfield for the FreeSpace2 Source Code Project.
3  * You may not sell or otherwise commercially exploit the source or things you
4  * create based on the source.
5  */
6 
7 
8 
9 #ifndef _IFF_DEFS_H_
10 #define _IFF_DEFS_H_
11 
12 #include "globalincs/globals.h"
13 #include "globalincs/pstypes.h"
14 #include "graphics/2d.h"
15 
16 class object;
17 
18 // Goober5000 - new IFF color system
19 #define IFF_COLOR_SELECTION 0
20 #define IFF_COLOR_MESSAGE 1
21 #define IFF_COLOR_TAGGED 2
22 #define MAX_IFF_COLORS (MAX_IFFS + 3)
23 
24 // iff flags
25 #define IFFF_SUPPORT_ALLOWED (1 << 0) // this IFF can call for support
26 #define IFFF_EXEMPT_FROM_ALL_TEAMS_AT_WAR (1 << 1) // self-explanatory
27 #define IFFF_ORDERS_HIDDEN (1 << 2) // the HUD will not show a targeted ship's orders
28 #define IFFF_ORDERS_SHOWN (1 << 3) // the HUD will show a targeted ship's orders (friendly has by default)
29 #define IFFF_WING_NAME_HIDDEN (1 << 4) // the HUD will not show a targeted ship's name if it is in a wing
30 #define MAX_IFF_FLAGS 5
31 
32 // Goober5000
33 typedef struct iff_info {
34 
35  // required stuff
37  int color_index; // treat this as private and use iff_get_color or iff_get_color_by_team
38 
39  // relationships
40  int attackee_bitmask; // treat this as private and use iff_get_attackee_mask or iff_x_attacks_y
41  int attackee_bitmask_all_teams_at_war; // treat this as private and use iff_get_attackee_mask or iff_x_attacks_y
42  int observed_color_index[MAX_IFFS]; // treat this as private and use iff_get_color or iff_get_color_by_team
43 
44  // flags
45  int flags;
48 
49  // used internally, not parsed
51 
52 } iff_info;
53 
54 extern int Num_iffs;
55 extern iff_info Iff_info[MAX_IFFS];
56 
57 extern int Iff_traitor;
58 
59 // radar blip stuff
60 extern int radar_iff_color[5][2][4];
61 
62 // color stuff
63 extern int iff_get_alpha_value(bool is_bright);
64 extern int iff_init_color(int r, int g, int b);
65 
66 // load the iff table
67 extern void iff_init();
68 
69 // search for iff
70 extern int iff_lookup(char *iff_name);
71 
72 // attack stuff
73 // NB: As far as the differences between I attack him and he attacks me, think of a hidden traitor on your own team.
74 // If he fires at you, you don't react unless you are coded to attack him, because you are oblivious.
75 extern int iff_get_attackee_mask(int attacker_team);
76 extern int iff_get_attacker_mask(int attackee_team);
77 extern int iff_x_attacks_y(int team_x, int team_y);
78 
79 // mask stuff
80 extern int iff_get_mask(int team);
81 extern int iff_matches_mask(int team, int mask);
82 
83 // get color stuff
84 extern color *iff_get_color(int color_index, int is_bright);
85 extern color *iff_get_color_by_team(int team, int seen_from_team, int is_bright);
86 extern color *iff_get_color_by_team_and_object(int team, int seen_from_team, int is_bright, object *objp);
87 
88 #endif
int flags
Definition: iff_defs.h:45
void iff_init()
Definition: iff_defs.cpp:117
color * iff_get_color_by_team(int team, int seen_from_team, int is_bright)
Definition: iff_defs.cpp:644
int iff_get_mask(int team)
Definition: iff_defs.cpp:615
int Num_iffs
Definition: iff_defs.cpp:19
Definition: 2d.h:95
CButton * team
int attackee_bitmask
Definition: iff_defs.h:40
int iff_get_alpha_value(bool is_bright)
Definition: iff_defs.cpp:45
object * objp
Definition: lua.cpp:3105
int iff_get_attackee_mask(int attacker_team)
Definition: iff_defs.cpp:561
int default_parse_flags2
Definition: iff_defs.h:47
iff_info Iff_info[MAX_IFFS]
Definition: iff_defs.cpp:20
GLdouble GLdouble GLdouble r
Definition: Glext.h:5337
GLboolean GLboolean g
Definition: Glext.h:5781
int ai_rearm_timestamp
Definition: iff_defs.h:50
int color_index
Definition: iff_defs.h:37
int iff_x_attacks_y(int team_x, int team_y)
Definition: iff_defs.cpp:605
int iff_init_color(int r, int g, int b)
Definition: iff_defs.cpp:62
int radar_iff_color[5][2][4]
Definition: iff_defs.cpp:24
color * iff_get_color(int color_index, int is_bright)
Definition: iff_defs.cpp:636
int iff_lookup(char *iff_name)
Definition: iff_defs.cpp:540
Definition: object.h:141
color * iff_get_color_by_team_and_object(int team, int seen_from_team, int is_bright, object *objp)
Definition: iff_defs.cpp:678
int attackee_bitmask_all_teams_at_war
Definition: iff_defs.h:41
GLboolean GLboolean GLboolean b
Definition: Glext.h:5781
int iff_get_attacker_mask(int attackee_team)
Definition: iff_defs.cpp:583
#define NAME_LENGTH
Definition: globals.h:15
struct iff_info iff_info
int iff_matches_mask(int team, int mask)
Definition: iff_defs.cpp:628
#define MAX_IFFS
Definition: globals.h:34
GLenum GLint GLuint mask
Definition: Glext.h:5605
char iff_name[NAME_LENGTH]
Definition: iff_defs.h:36
int default_parse_flags
Definition: iff_defs.h:46
int observed_color_index[MAX_IFFS]
Definition: iff_defs.h:42
int Iff_traitor
Definition: iff_defs.cpp:22