File: swarm.h

package info (click to toggle)
freespace2 3.7.0%2Brepack-2
  • links: PTS, VCS
  • area: non-free
  • in suites: jessie, jessie-kfreebsd
  • size: 22,848 kB
  • ctags: 41,897
  • sloc: cpp: 369,931; makefile: 1,060; xml: 129; sh: 112
file content (68 lines) | stat: -rw-r--r-- 1,908 bytes parent folder | download
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
/*
 * 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 __FREESPACE_SWARM_H__
#define __FREESPACE_SWARM_H__

#include "globalincs/pstypes.h"

struct object;
struct ship_subsys;

typedef struct turret_swarm_info {
	int				flags;
	int				weapon_class;
	int				num_to_launch;
	int				parent_objnum;
	int				parent_sig;
	int				target_objnum;
	int				target_sig;
	ship_subsys*	turret;
	ship_subsys*	target_subsys;
	int				time_to_fire;
	int				weapon_num;
} turret_swarm_info;

typedef struct swarm_info {
	int		flags;
	int		change_timestamp;
	vec3d	original_target;
	vec3d	new_target;
	vec3d	circle_rvec, circle_uvec;
	vec3d	last_offset;
	uint		change_count;		
	int		path_num;			// which path swarm missile is currently following
	int		homing_objnum;		// object number that swarm missile is homing on, -1 if not homing
	int		change_time;		// when swarm missile should next update direction, based on missile speed
	float		angle_offset;
	float		last_dist;			// last distance to target
} swarm_info;

#define SWARM_DEFAULT_NUM_MISSILES_FIRED					4		// number of swarm missiles that launch when fired

#define MAX_SWARM_MISSILES	100
extern swarm_info	Swarm_missiles[MAX_SWARM_MISSILES];

#define MAX_TURRET_SWARM_INFO	100
extern turret_swarm_info Turret_swarm_info[MAX_TURRET_SWARM_INFO];

void	swarm_level_init();
void	swarm_delete(int index);
int	swarm_create();
void	swarm_update_direction(object *objp, float frametime);
void	swarm_maybe_fire_missile(int shipnum);

int	turret_swarm_create();
void	turret_swarm_delete(int i);
void	turret_swarm_set_up_info(int parent_objnum, ship_subsys *turret, struct weapon_info *wip, int weapon_num);
void	turret_swarm_check_validity();

#endif /* __FREESPACE_SWARM_H__ */