Debian Codegraph @

Descent3/powerup.h

raw symbols SCIP
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 POWERUP_H
20 #define POWERUP_H
21
22 #include "pstypes.h"
23 #include "manage.h"
24 #include "object.h"
25
26 #define MAX_POWERUPS 100
27 #define MAX_STATIC_POWERUPS 50
28
29 #define PF_IMAGE_BITMAP 1
30
31 // These defines must correspond to the Static_powerup_names array
32 #define POW_SHIELD 0
33 #define POW_ENERGY 1
34
35 #define POW_LASER 2
36 #define POW_VULCAN_WEAPON 3
37 #define POW_SPREADFIRE_WEAPON 4
38 #define POW_PLASMA_WEAPON 5
39 #define POW_FUSION_WEAPON 6
40
41 #define POW_SUPER_LASER 7
42 #define POW_GAUSS_WEAPON 8
43 #define POW_HELIX_WEAPON 9
44 #define POW_PHOENIX_WEAPON 10
45 #define POW_OMEGA_WEAPON 11
46
47 #define POW_MISSILE_1 12
48 #define POW_MISSILE_4 13 // 4-pack MUST follow single missile
49 #define POW_HOMING_MISSILE_1 14
50 #define POW_HOMING_MISSILE_4 15 // 4-pack MUST follow single missile
51 #define POW_PROXIMITY_WEAPON 16
52 #define POW_SMART_MISSILE_WEAPON 17
53 #define POW_MEGA_WEAPON 18
54
55 #define POW_FLASH_MISSILE_1 19
56 #define POW_FLASH_MISSILE_4 20 // 4-pack MUST follow single missile
57 #define POW_GUIDED_MISSILE_1 21
58 #define POW_GUIDED_MISSILE_4 22 // 4-pack MUST follow single missile
59 #define POW_SMART_MINE 23
60 #define POW_MERCURY_MISSILE_1 24
61 #define POW_MERCURY_MISSILE_4 25 // 4-pack MUST follow single missile
62 #define POW_EARTHSHAKER_MISSILE 26
63
64 #define POW_EXTRA_LIFE 27
65 #define POW_QUAD_FIRE 28
66 #define POW_VULCAN_AMMO 29
67 #define POW_CLOAK 30
68 #define POW_TURBO 31
69 #define POW_INVULNERABILITY 32
70 #define POW_FULL_MAP 33
71 #define POW_CONVERTER 34
72 #define POW_AMMO_RACK 35
73 #define POW_AFTERBURNER 36
74 #define POW_HEADLIGHT 37
75
76 #define POW_FLAG_BLUE 38
77 #define POW_FLAG_RED 39
78 #define POW_HOARD_ORB 40
79
80 // sound stuff
81
82 #define MAX_POWERUP_SOUNDS 7
83
84 #define PSI_PICKUP 0
85
86 struct powerup {
87 char name[PAGENAME_LEN];
88 float size;
89 int score;
90 int image_handle; // Either a vclip or a polygon model
91 char model_name[PAGENAME_LEN]; // used for remapping powerups which contain models
92 int flags;
93 uint16_t used;
94
95 int16_t sounds[MAX_POWERUP_SOUNDS];
96
97 // Default physics information for this powerup type
98 physics_info phys_info; // the physics data for this obj type.
99
100 };
101
102 extern int Num_powerups;
103 extern powerup Powerups[MAX_POWERUPS];
104 extern char *Static_powerup_names[];
105
106 // Sets all powerups to unused
107 void InitPowerups();
108
109 // Allocs a powerup for use, returns -1 if error, else index on success
110 int AllocPowerup();
111
112 // Frees powerup index n
113 void FreePowerup(int n);
114
115 // Gets next powerup from n that has actually been alloced
116 int GetNextPowerup(int n);
117
118 // Gets previous powerup from n that has actually been alloced
119 int GetPrevPowerup(int n);
120
121 // Searches thru all powerups for a specific name, returns -1 if not found
122 // or index of powerup with name
123 int FindPowerupName(char *name);
124
125 // Given a filename, loads either the model or vclip found in that file. If type
126 // is not NULL, sets it to 1 if file is model, otherwise sets it to zero
127 int LoadPowerupImage(char *filename, int *type);
128
129 // Given a powerup handle, returns that powerups image for framenum
130 int GetPowerupImage(int handle, int framenum);
131
132 // Given an object, renders the representation of this powerup
133 // Currently only handles bitmap types, not poly models
134 void DrawPowerupObject(object *obj);
135
136 // Given a powerup name, assigns that powerup to a specific index into
137 // the Powerups array. Returns -1 if the named powerup is not found, 0 if the powerup
138 // is already in its place, or 1 if successfully moved
139 int MatchPowerupToIndex(char *name, int dest_index);
140
141 // Moves a powerup from a given index into a new one (above MAX_STATIC_POWERUPS)
142 // returns new index
143 int MovePowerupFromIndex(int index);
144
145 // This is a very confusing function. It takes all the powerups that we have loaded
146 // and remaps then into their proper places (if they are static).
147 void RemapPowerups();
148
149 // goes thru every entity that could possible have a powerup index (ie objects, robots, etc)
150 // and changes the old index to the new index
151 void RemapAllPowerupObjects(int old_index, int new_index);
152
153 // Player activated this powerup
154 int DoPowerup(object *obj);
155
156 #endif