Debian Codegraph @

common/main/effects.h

raw
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 * Headerfile for effects.c
23 *
24 */
25
26 #pragma once
27
28 #include "vclip.h"
29 #include "dxxsconf.h"
30 #include "pack.h"
31 #include "bm.h"
32 #include <array>
33
34 #ifdef DXX_BUILD_DESCENT
35 namespace dsx {
36 #if DXX_BUILD_DESCENT == 1
37 constexpr std::integral_constant<unsigned, 60> MAX_EFFECTS{};
38 constexpr std::integral_constant<uint32_t, UINT32_MAX> eclip_none{};
39 #elif DXX_BUILD_DESCENT == 2
40 constexpr std::integral_constant<unsigned, 110> MAX_EFFECTS{};
41 constexpr std::integral_constant<uint16_t, UINT16_MAX> eclip_none{};
42 #endif
43 }
44
45 //flags for eclips. If no flags are set, always plays
46
47 #define EF_CRITICAL 1 //this doesn't get played directly (only when mine critical)
48 #define EF_ONE_SHOT 2 //this is a special that gets played once
49 #define EF_STOPPED 4 //this has been stopped
50
51 #define ECLIP_NUM_FUELCEN 2
52 #define ECLIP_NUM_BOSS 53
53 #if DXX_BUILD_DESCENT == 2
54 #define ECLIP_NUM_FORCE_FIELD 78 // diagonal force field texture
55 #define ECLIP_NUM_FORCE_FIELD2 93 // straight force field texture
56 #endif
57
58 struct eclip : public prohibit_void_ptr<eclip>
59 {
60 vclip vc; //imbedded vclip
61 fix time_left; //for sequencing
62 uint32_t frame_count; //for sequencing
63 short changing_wall_texture; //Which element of Textures array to replace.
64 object_bitmap_index changing_object_texture; //Which element of ObjBitmapPtrs array to replace.
65 int flags; //see above
66 int crit_clip; //use this clip instead of above one when mine critical
67 unsigned dest_bm_num; //use this bitmap when monitor destroyed
68 vclip_index dest_vclip; //what vclip to play when exploding
69 int dest_eclip; //what eclip to play when exploding
70 fix dest_size; //3d size of explosion
71 sound_effect sound_num; //what sound this makes
72 segnum_t segnum;
73 sidenum_t sidenum; //what seg & side, for one-shot clips
74 };
75
76 extern unsigned Num_effects;
77
78 // Set up special effects.
79 extern void init_special_effects();
80
81 // Clear any active one-shots
82 void reset_special_effects();
83
84 // Function called in game loop to do effects.
85 extern void do_special_effects();
86
87 // Restore bitmap
88 extern void restore_effect_bitmap_icons();
89
90 //stop an effect from animating. Show first frame.
91 void stop_effect(int effect_num);
92
93 //restart a stopped effect
94 void restart_effect(int effect_num);
95
96 /*
97 * reads n eclip structs from a PHYSFS_File
98 */
99 void eclip_read(NamedPHYSFS_File fp, eclip &ec);
100 #if 0
101 void eclip_write(PHYSFS_File *fp, const eclip &ec);
102 #endif
103
104 #ifdef DXX_BUILD_DESCENT
105 namespace dsx {
106
107 using d_eclip_array = std::array<eclip, MAX_EFFECTS>;
108
109 struct d_level_unique_effects_clip_state
110 {
111 d_eclip_array Effects;
112 };
113
114 extern d_level_unique_effects_clip_state LevelUniqueEffectsClipState;
115
116 }
117 #endif
118
119 #endif