File: robotfirestruct.h

package info (click to toggle)
descent3 1.5.0%2Bds-2
  • links: PTS, VCS
  • area: contrib
  • in suites: forky, sid
  • size: 35,256 kB
  • sloc: cpp: 416,147; ansic: 3,233; sh: 10; makefile: 8
file content (103 lines) | stat: -rw-r--r-- 2,845 bytes parent folder | download | duplicates (3)
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
/*
* Descent 3 
* Copyright (C) 2024 Parallax Software
*
* 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 3 of the License, 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, see <http://www.gnu.org/licenses/>.
*/

#ifndef ROBOTFIRESTRUCT_H_
#define ROBOTFIRESTRUCT_H_

#include <cstdint>

#include "robotfirestruct_external.h"
#include "vecmat.h"

// NOTE: CHANGE gunbattery.h (IN POFGEN PROJECT) if constants are changed
// NOTE: Robots are limited to the number of wb configurations of the player.  This seem like an
//       adequit number (currently 21)
// (MAX_PRIMARY_WEAPONS + MAX_SECONDARY_WEAPONS + 1/*Flare*/)
// NOTE: Cannot include weapon.h because of circular dependances.
#define MAX_WBS_PER_OBJ 21

// Attach to the polymodel
struct poly_wb_info {
  // Static Data  (Add to robot generic page)
  uint16_t num_gps;
  uint8_t gp_index[MAX_WB_GUNPOINTS];

  // Turrets are listed from most important (greatest mobility) to least important
  uint8_t num_turrets;
  uint16_t turret_index[MAX_WB_TURRETS];

};

// Next free WBF is 32

// Attach to a object type
struct otype_wb_info {
  uint16_t gp_weapon_index[MAX_WB_GUNPOINTS];
  uint16_t fm_fire_sound_index[MAX_WB_FIRING_MASKS];
  uint16_t aiming_gp_index;

  uint8_t num_masks;
  uint8_t gp_fire_masks[MAX_WB_FIRING_MASKS];
  float gp_fire_wait[MAX_WB_FIRING_MASKS];

  uint8_t gp_quad_fire_mask;

  uint8_t num_levels;
  uint16_t gp_level_weapon_index[MAX_WB_UPGRADES];
  uint16_t gp_level_fire_sound_index[MAX_WB_UPGRADES];

  uint8_t aiming_flags;
  float aiming_3d_dot; // These can be reused.
  float aiming_3d_dist;
  float aiming_XZ_dot;

  float anim_start_frame[MAX_WB_FIRING_MASKS];
  float anim_fire_frame[MAX_WB_FIRING_MASKS];
  float anim_end_frame[MAX_WB_FIRING_MASKS];
  float anim_time[MAX_WB_FIRING_MASKS];

  uint16_t flags;

  float energy_usage, ammo_usage;
};

#define WB_MOVE_STILL 0
#define WB_MOVE_RIGHT 1
#define WB_MOVE_LEFT 2

// Goes with an individual robot's instance
struct dynamic_wb_info {
  // Dynamic Data
  float last_fire_time;
  uint8_t cur_firing_mask;

  float norm_turret_angle[MAX_WB_TURRETS];
  float turret_next_think_time[MAX_WB_TURRETS];
  uint8_t turret_direction[MAX_WB_TURRETS];

  uint8_t wb_anim_mask;
  float wb_anim_frame;

  vector cur_target;

  char upgrade_level; // For multi-level weapons ( 0 to MAX_WB_UPGRADES-1)

  int flags;
};

#endif