Debian Codegraph @

Descent3/procedurals.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 PROCEDURALS_H
20 #define PROCEDURALS_H
21
22 #include "pstypes.h"
23 #include "pserror.h"
24 #include "fix.h"
25
26 #define MAX_PROC_ELEMENTS 8000
27
28 // Fire procedurals
29 #define PROC_NONE 0
30 #define PROC_LINE_LIGHTNING 1
31 #define PROC_SPHERE_LIGHTNING 2
32 #define PROC_STRAIGHT 3
33 #define PROC_RISING_EMBER 4
34 #define PROC_RANDOM_EMBERS 5
35 #define PROC_SPINNERS 6
36 #define PROC_ROAMERS 7
37 #define PROC_FOUNTAIN 8
38 #define PROC_CONE 9
39 #define PROC_FALL_RIGHT 10
40 #define PROC_FALL_LEFT 11
41
42 #define PROC_WATER_NONE 0
43 #define PROC_WATER_HEIGHT_BLOB 1
44 #define PROC_WATER_SINE_BLOB 2
45 #define PROC_WATER_RAINDROPS 3
46 #define PROC_WATER_BLOBDROPS 4
47
48 struct dynamic_proc_element {
49 uint8_t type;
50 fix dx, dy;
51 uint8_t frames_left;
52 uint8_t speed;
53 uint8_t color;
54
55 uint8_t size;
56
57 fix x1, y1;
58
59 int16_t prev, next;
60 };
61
62 extern dynamic_proc_element DynamicProcElements[];
63 extern const char *ProcNames[], *WaterProcNames[];
64
65 extern uint16_t DefaultProcPalette[];
66
67 // Goes through our array and clears the slots out
68 void InitProcedurals();
69
70 // Fades and entire texture one step closer to black
71 void FadeProcTexture(int tex_handle);
72
73 // Draws lightning into a bitmap
74 void AddProcLightning(int x1, int y1, int x2, int y2);
75
76 // link the procedural into the list for its texture
77 void ProcElementLink(int index, int texnum);
78
79 // Unlinks a proc_element from a texture
80 void ProcElementUnlink(int index, int texnum);
81
82 // Clears all the procedurals elements attached to this texture
83 void ClearAllProceduralsFromTexture(int texnum);
84
85 // Does a procedural for this texture
86 void EvaluateProcedural(int texnum);
87
88 // Returns the next free procelement
89 int ProcElementAllocate();
90
91 // Frees up a procelement for use
92 int ProcElementFree(int index);
93
94 // Given an array of r,g,b values, generates a 16bit palette table for those colors
95 void GeneratePaletteForProcedural(uint8_t *r, uint8_t *g, uint8_t *b, uint16_t *pal);
96
97 #endif