| 1 | /* |
| 2 | * Descent 3 |
| 3 | * Copyright (C) 2024 Parallax Software |
| 4 | * |
| 5 | * This program is free software: you can redistribute it and/or modify |
| 6 | * it under the terms of the GNU General Public License as published by |
| 7 | * the Free Software Foundation, either version 3 of the License, or |
| 8 | * (at your option) any later version. |
| 9 | * |
| 10 | * This program is distributed in the hope that it will be useful, |
| 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 13 | * GNU General Public License for more details. |
| 14 | * |
| 15 | * You should have received a copy of the GNU General Public License |
| 16 | * along with this program. If not, see <http://www.gnu.org/licenses/>. |
| 17 | */ |
| 18 | |
| 19 | #ifndef ROBOTFIRESTRUCT_H_ |
| 20 | #define ROBOTFIRESTRUCT_H_ |
| 21 | |
| 22 | #include <cstdint> |
| 23 | |
| 24 | #include "robotfirestruct_external.h" |
| 25 | #include "vecmat.h" |
| 26 | |
| 27 | // NOTE: CHANGE gunbattery.h (IN POFGEN PROJECT) if constants are changed |
| 28 | // NOTE: Robots are limited to the number of wb configurations of the player. This seem like an |
| 29 | // adequit number (currently 21) |
| 30 | // (MAX_PRIMARY_WEAPONS + MAX_SECONDARY_WEAPONS + 1/*Flare*/) |
| 31 | // NOTE: Cannot include weapon.h because of circular dependances. |
| 32 | #define MAX_WBS_PER_OBJ 21 |
| 33 | |
| 34 | // Attach to the polymodel |
| 35 | struct poly_wb_info { |
| 36 | // Static Data (Add to robot generic page) |
| 37 | uint16_t num_gps; |
| 38 | uint8_t gp_index[MAX_WB_GUNPOINTS]; |
| 39 | |
| 40 | // Turrets are listed from most important (greatest mobility) to least important |
| 41 | uint8_t num_turrets; |
| 42 | uint16_t turret_index[MAX_WB_TURRETS]; |
| 43 | |
| 44 | }; |
| 45 | |
| 46 | // Next free WBF is 32 |
| 47 | |
| 48 | // Attach to a object type |
| 49 | struct otype_wb_info { |
| 50 | uint16_t gp_weapon_index[MAX_WB_GUNPOINTS]; |
| 51 | uint16_t fm_fire_sound_index[MAX_WB_FIRING_MASKS]; |
| 52 | uint16_t aiming_gp_index; |
| 53 | |
| 54 | uint8_t num_masks; |
| 55 | uint8_t gp_fire_masks[MAX_WB_FIRING_MASKS]; |
| 56 | float gp_fire_wait[MAX_WB_FIRING_MASKS]; |
| 57 | |
| 58 | uint8_t gp_quad_fire_mask; |
| 59 | |
| 60 | uint8_t num_levels; |
| 61 | uint16_t gp_level_weapon_index[MAX_WB_UPGRADES]; |
| 62 | uint16_t gp_level_fire_sound_index[MAX_WB_UPGRADES]; |
| 63 | |
| 64 | uint8_t aiming_flags; |
| 65 | float aiming_3d_dot; // These can be reused. |
| 66 | float aiming_3d_dist; |
| 67 | float aiming_XZ_dot; |
| 68 | |
| 69 | float anim_start_frame[MAX_WB_FIRING_MASKS]; |
| 70 | float anim_fire_frame[MAX_WB_FIRING_MASKS]; |
| 71 | float anim_end_frame[MAX_WB_FIRING_MASKS]; |
| 72 | float anim_time[MAX_WB_FIRING_MASKS]; |
| 73 | |
| 74 | uint16_t flags; |
| 75 | |
| 76 | float energy_usage, ammo_usage; |
| 77 | }; |
| 78 | |
| 79 | #define WB_MOVE_STILL 0 |
| 80 | #define WB_MOVE_RIGHT 1 |
| 81 | #define WB_MOVE_LEFT 2 |
| 82 | |
| 83 | // Goes with an individual robot's instance |
| 84 | struct dynamic_wb_info { |
| 85 | // Dynamic Data |
| 86 | float last_fire_time; |
| 87 | uint8_t cur_firing_mask; |
| 88 | |
| 89 | float norm_turret_angle[MAX_WB_TURRETS]; |
| 90 | float turret_next_think_time[MAX_WB_TURRETS]; |
| 91 | uint8_t turret_direction[MAX_WB_TURRETS]; |
| 92 | |
| 93 | uint8_t wb_anim_mask; |
| 94 | float wb_anim_frame; |
| 95 | |
| 96 | vector cur_target; |
| 97 | |
| 98 | char upgrade_level; // For multi-level weapons ( 0 to MAX_WB_UPGRADES-1) |
| 99 | |
| 100 | int flags; |
| 101 | }; |
| 102 | |
| 103 | #endif |