Details | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
1 | pmbaty | 1 | /* |
2 | * Portions of this file are copyright Rebirth contributors and licensed as |
||
3 | * described in COPYING.txt. |
||
4 | * Portions of this file are copyright Parallax Software and licensed |
||
5 | * according to the Parallax license below. |
||
6 | * See COPYING.txt for license details. |
||
7 | |||
8 | THE COMPUTER CODE CONTAINED HEREIN IS THE SOLE PROPERTY OF PARALLAX |
||
9 | SOFTWARE CORPORATION ("PARALLAX"). PARALLAX, IN DISTRIBUTING THE CODE TO |
||
10 | END-USERS, AND SUBJECT TO ALL OF THE TERMS AND CONDITIONS HEREIN, GRANTS A |
||
11 | ROYALTY-FREE, PERPETUAL LICENSE TO SUCH END-USERS FOR USE BY SUCH END-USERS |
||
12 | IN USING, DISPLAYING, AND CREATING DERIVATIVE WORKS THEREOF, SO LONG AS |
||
13 | SUCH USE, DISPLAY OR CREATION IS FOR NON-COMMERCIAL, ROYALTY OR REVENUE |
||
14 | FREE PURPOSES. IN NO EVENT SHALL THE END-USER USE THE COMPUTER CODE |
||
15 | CONTAINED HEREIN FOR REVENUE-BEARING PURPOSES. THE END-USER UNDERSTANDS |
||
16 | AND AGREES TO THE TERMS HEREIN AND ACCEPTS THE SAME BY USE OF THIS FILE. |
||
17 | COPYRIGHT 1993-1999 PARALLAX SOFTWARE CORPORATION. ALL RIGHTS RESERVED. |
||
18 | */ |
||
19 | |||
20 | /* |
||
21 | * |
||
22 | * Definitions for the laser code. |
||
23 | * |
||
24 | */ |
||
25 | |||
26 | #pragma once |
||
27 | |||
28 | #include "maths.h" |
||
29 | #include "vecmat.h" |
||
30 | |||
31 | #ifdef __cplusplus |
||
32 | #include "fwd-segment.h" |
||
33 | #include "fwd-object.h" |
||
34 | #include "weapon_id.h" |
||
35 | |||
36 | // These are new defines for the value of 'flags' passed to do_laser_firing. |
||
37 | // The purpose is to collect other flags like QUAD_LASER and Spreadfire_toggle |
||
38 | // into a single 8-bit quantity so it can be easily used in network mode. |
||
39 | |||
40 | #define LASER_QUAD 1 |
||
41 | #define LASER_SPREADFIRE_TOGGLED 2 |
||
42 | |||
43 | #define MAX_LASER_LEVEL LASER_LEVEL_4 // Note, laser levels are numbered from 0. |
||
44 | |||
45 | #if defined(DXX_BUILD_DESCENT_I) |
||
46 | #define DXX_MAXIMUM_LASER_LEVEL LASER_LEVEL_4 |
||
47 | #elif defined(DXX_BUILD_DESCENT_II) |
||
48 | #define DXX_MAXIMUM_LASER_LEVEL MAX_SUPER_LASER_LEVEL |
||
49 | #endif |
||
50 | |||
51 | #define MAX_LASER_BITMAPS 6 |
||
52 | |||
53 | // For muzzle firing casting light. |
||
54 | #define MUZZLE_QUEUE_MAX 8 |
||
55 | |||
56 | // Constants & functions governing homing missile behavior. |
||
57 | #define NEWHOMER // activates the 30FPS-base capped homing projective code. Remove to restore original behavior. |
||
58 | #if defined(DXX_BUILD_DESCENT_I) |
||
59 | #define HOMING_MIN_TRACKABLE_DOT (3*F1_0/4) |
||
60 | #elif defined(DXX_BUILD_DESCENT_II) |
||
61 | #define HOMING_MIN_TRACKABLE_DOT (7*F1_0/8) |
||
62 | #endif |
||
63 | #define HOMING_FLY_STRAIGHT_TIME (F1_0/8) |
||
64 | #ifdef NEWHOMER |
||
65 | #define HOMING_TURN_TIME (F1_0/30) |
||
66 | #endif |
||
67 | |||
68 | #ifdef dsx |
||
69 | namespace dsx { |
||
70 | #ifdef NEWHOMER |
||
71 | void calc_d_homer_tick(); |
||
72 | #endif |
||
73 | void Laser_render(grs_canvas &, const object_base &obj); |
||
74 | imobjptridx_t Laser_player_fire(vmobjptridx_t obj, weapon_id_type laser_type, int gun_num, int make_sound, const vms_vector &shot_orientation, icobjidx_t Network_laser_track); |
||
75 | void Laser_do_weapon_sequence(vmobjptridx_t obj); |
||
76 | void Flare_create(vmobjptridx_t obj); |
||
77 | bool laser_are_related(vcobjptridx_t o1, vcobjptridx_t o2); |
||
78 | |||
79 | void do_laser_firing_player(object &); |
||
80 | extern void do_missile_firing(int drop_bomb); |
||
81 | } |
||
82 | |||
83 | namespace dsx { |
||
84 | imobjptridx_t Laser_create_new(const vms_vector &direction, const vms_vector &position, vmsegptridx_t segnum, vmobjptridx_t parent, weapon_id_type type, int make_sound); |
||
85 | |||
86 | // Fires a laser-type weapon (a Primary weapon) |
||
87 | // Fires from object objnum, weapon type weapon_id. |
||
88 | // Assumes that it is firing from a player object, so it knows which |
||
89 | // gun to fire from. |
||
90 | // Returns the number of shots actually fired, which will typically be |
||
91 | // 1, but could be higher for low frame rates when rapidfire weapons, |
||
92 | // such as vulcan or plasma are fired. |
||
93 | int do_laser_firing(vmobjptridx_t objnum, int weapon_id, int level, int flags, int nfires, vms_vector shot_orientation, icobjidx_t Network_laser_track); |
||
94 | |||
95 | // Easier to call than Laser_create_new because it determines the |
||
96 | // segment containing the firing point and deals with it being stuck |
||
97 | // in an object or through a wall. |
||
98 | // Fires a laser of type "weapon_type" from an object (parent) in the |
||
99 | // direction "direction" from the position "position" |
||
100 | // Returns object number of laser fired or -1 if not possible to fire |
||
101 | // laser. |
||
102 | imobjptridx_t Laser_create_new_easy(const vms_vector &direction, const vms_vector &position, vmobjptridx_t parent, weapon_id_type weapon_type, int make_sound); |
||
103 | |||
104 | #if defined(DXX_BUILD_DESCENT_II) |
||
105 | // give up control of the guided missile |
||
106 | void release_guided_missile(d_level_unique_object_state &, unsigned player_num); |
||
107 | |||
108 | // Omega cannon stuff. |
||
109 | #define MAX_OMEGA_CHARGE (F1_0) // Maximum charge level for omega cannonw |
||
110 | // NOTE: OMEGA_CHARGE_SCALE moved to laser.c to avoid long rebuilds if changed |
||
111 | int ok_to_do_omega_damage(const object &weapon); |
||
112 | void create_robot_smart_children(vmobjptridx_t objp, uint_fast32_t count); |
||
113 | #endif |
||
114 | |||
115 | void create_weapon_smart_children(vmobjptridx_t objp); |
||
116 | int object_to_object_visibility(vcobjptridx_t obj1, const object_base &obj2, int trans_type); |
||
117 | } |
||
118 | #endif |
||
119 | |||
120 | namespace dcx { |
||
121 | |||
122 | struct muzzle_info |
||
123 | { |
||
124 | fix64 create_time; |
||
125 | segnum_t segnum; |
||
126 | vms_vector pos; |
||
127 | }; |
||
128 | |||
129 | extern std::array<muzzle_info, MUZZLE_QUEUE_MAX> Muzzle_data; |
||
130 | } |
||
131 | |||
132 | #ifdef dsx |
||
133 | namespace d1x { |
||
134 | |||
135 | static inline int is_proximity_bomb_or_player_smart_mine(const weapon_id_type id) |
||
136 | { |
||
137 | return id == weapon_id_type::PROXIMITY_ID; |
||
138 | } |
||
139 | |||
140 | static inline int is_proximity_bomb_or_player_smart_mine_or_placed_mine(const weapon_id_type id) |
||
141 | { |
||
142 | /* Descent 1 has no smart mines or placed mines. */ |
||
143 | return id == weapon_id_type::PROXIMITY_ID; |
||
144 | } |
||
145 | |||
146 | } |
||
147 | |||
148 | #if defined(DXX_BUILD_DESCENT_II) |
||
149 | namespace dsx { |
||
150 | // Omega cannon stuff. |
||
151 | #define MAX_OMEGA_CHARGE (F1_0) // Maximum charge level for omega cannonw |
||
152 | |||
153 | static inline int is_proximity_bomb_or_player_smart_mine(const weapon_id_type id) |
||
154 | { |
||
155 | if (id == weapon_id_type::SUPERPROX_ID) |
||
156 | return 1; |
||
157 | return ::d1x::is_proximity_bomb_or_player_smart_mine(id); |
||
158 | } |
||
159 | |||
160 | static inline int is_proximity_bomb_or_player_smart_mine_or_placed_mine(const weapon_id_type id) |
||
161 | { |
||
162 | if (id == weapon_id_type::PMINE_ID) |
||
163 | return 1; |
||
164 | return is_proximity_bomb_or_player_smart_mine(id); |
||
165 | } |
||
166 | } |
||
167 | #endif |
||
168 | #endif |
||
169 | |||
170 | #endif |