engine: reject mbf21 and shit24 wads. there is no way to know if it is safe to ignore...
[k8vavoom.git] / source / psim / p_decal_private.h
blob8b3fb712afec4cc2466f65fee528367b07fd35b2
1 //**************************************************************************
2 //**
3 //** ## ## ## ## ## #### #### ### ###
4 //** ## ## ## ## ## ## ## ## ## ## #### ####
5 //** ## ## ## ## ## ## ## ## ## ## ## ## ## ##
6 //** ## ## ######## ## ## ## ## ## ## ## ### ##
7 //** ### ## ## ### ## ## ## ## ## ##
8 //** # ## ## # #### #### ## ##
9 //**
10 //** Copyright (C) 2018-2023 Ketmar Dark
11 //**
12 //** This program is free software: you can redistribute it and/or modify
13 //** it under the terms of the GNU General Public License as published by
14 //** the Free Software Foundation, version 3 of the License ONLY.
15 //**
16 //** This program is distributed in the hope that it will be useful,
17 //** but WITHOUT ANY WARRANTY; without even the implied warranty of
18 //** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 //** GNU General Public License for more details.
20 //**
21 //** You should have received a copy of the GNU General Public License
22 //** along with this program. If not, see <http://www.gnu.org/licenses/>.
23 //**
24 //**************************************************************************
25 // decal, decalgroup, decal animator
26 #ifndef VAVOOM_PSIM_DECAL_PRIVATE_HEADER
27 #define VAVOOM_PSIM_DECAL_PRIVATE_HEADER
29 #include "p_decal.h"
32 // ////////////////////////////////////////////////////////////////////////// //
33 class VDecalAnimFader : public VDecalAnim {
34 public:
35 enum { TypeId = TDecAnimFader };
37 public:
38 // animator properties
39 DecalFloatVal startTime, actionTime; // in seconds
41 protected:
42 virtual void doIO (VStream &strm, VNTValueIOEx &vio) override;
44 public:
45 virtual bool parse (VScriptParser *sc) override;
47 public:
48 inline VDecalAnimFader (ENoInit) noexcept : VDecalAnim(E_NoInit) {}
49 inline VDecalAnimFader () noexcept : VDecalAnim(), startTime(0.0f), actionTime(0.0f) {}
50 virtual ~VDecalAnimFader ();
52 virtual vuint8 getTypeId () const noexcept override;
53 virtual const char *getTypeName () const noexcept override;
55 // this does deep clone, so we can attach it to the actual decal object
56 virtual VDecalAnim *clone (bool forced=false) override;
58 virtual void genValues () noexcept override;
60 virtual bool animate (decal_t *decal, float timeDelta) override;
62 virtual bool calcWillDisappear () const noexcept override;
64 virtual bool isFader () const noexcept override;
66 friend void ParseDecalDef (VScriptParser *sc);
67 friend void ProcessDecalDefs ();
71 // ////////////////////////////////////////////////////////////////////////// //
72 class VDecalAnimStretcher : public VDecalAnim {
73 public:
74 enum { TypeId = TDecAnimStretcher };
76 public:
77 // animator properties
78 DecalFloatVal goalX, goalY;
79 DecalFloatVal startTime, actionTime; // in seconds
81 protected:
82 virtual void doIO (VStream &strm, VNTValueIOEx &vio) override;
84 public:
85 virtual bool parse (VScriptParser *sc) override;
87 public:
88 inline VDecalAnimStretcher (ENoInit) noexcept : VDecalAnim(E_NoInit) {}
89 inline VDecalAnimStretcher () noexcept : VDecalAnim(), goalX(), goalY(), startTime(0.0f), actionTime(0.0f) {}
90 virtual ~VDecalAnimStretcher ();
92 virtual vuint8 getTypeId () const noexcept override;
93 virtual const char *getTypeName () const noexcept override;
95 // this does deep clone, so we can attach it to the actual decal object
96 virtual VDecalAnim *clone (bool forced=false) override;
98 virtual void genValues () noexcept override;
100 virtual bool animate (decal_t *decal, float timeDelta) override;
102 virtual bool calcWillDisappear () const noexcept override;
103 virtual void calcMaxScales (float *sx, float *sy) const noexcept override;
105 virtual bool isStretcher () const noexcept override;
107 friend void ParseDecalDef (VScriptParser *sc);
108 friend void ProcessDecalDefs ();
112 // ////////////////////////////////////////////////////////////////////////// //
113 class VDecalAnimSlider : public VDecalAnim {
114 public:
115 enum { TypeId = TDecAnimSlider };
117 public:
118 // animator properties
119 DecalFloatVal distX, distY;
120 DecalFloatVal startTime, actionTime; // in seconds
121 bool k8reversey;
123 protected:
124 virtual void doIO (VStream &strm, VNTValueIOEx &vio) override;
126 public:
127 virtual bool parse (VScriptParser *sc) override;
129 public:
130 inline VDecalAnimSlider (ENoInit) noexcept : VDecalAnim(E_NoInit) {}
131 inline VDecalAnimSlider () noexcept : VDecalAnim(), distX(), distY(), startTime(0.0f), actionTime(0.0f), k8reversey(false) {}
132 virtual ~VDecalAnimSlider ();
134 virtual vuint8 getTypeId () const noexcept override;
135 virtual const char *getTypeName () const noexcept override;
137 // this does deep clone, so we can attach it to the actual decal object
138 virtual VDecalAnim *clone (bool forced=false) override;
140 virtual void genValues () noexcept override;
142 virtual bool animate (decal_t *decal, float timeDelta) override;
144 virtual bool isSlider () const noexcept override;
146 friend void ParseDecalDef (VScriptParser *sc);
147 friend void ProcessDecalDefs ();
151 // ////////////////////////////////////////////////////////////////////////// //
152 class VDecalAnimColorChanger : public VDecalAnim {
153 public:
154 enum { TypeId = TDecAnimColorChanger };
156 public:
157 // animator properties
158 float dest[3];
159 DecalFloatVal startTime, actionTime; // in seconds
161 protected:
162 virtual void doIO (VStream &strm, VNTValueIOEx &vio) override;
164 public:
165 virtual bool parse (VScriptParser *sc) override;
167 public:
168 inline VDecalAnimColorChanger (ENoInit) noexcept : VDecalAnim(E_NoInit) {}
169 inline VDecalAnimColorChanger () noexcept : VDecalAnim(), startTime(0.0f), actionTime(0.0f) { dest[0] = dest[1] = dest[2] = 0.0f; }
170 virtual ~VDecalAnimColorChanger ();
172 virtual vuint8 getTypeId () const noexcept override;
173 virtual const char *getTypeName () const noexcept override;
175 // this does deep clone, so we can attach it to the actual decal object
176 virtual VDecalAnim *clone (bool forced=false) override;
178 virtual void genValues () noexcept override;
180 virtual bool animate (decal_t *decal, float timeDelta) override;
182 virtual bool isColorChanger () const noexcept override;
184 friend void ParseDecalDef (VScriptParser *sc);
185 friend void ProcessDecalDefs ();
189 // ////////////////////////////////////////////////////////////////////////// //
190 class VDecalAnimCombiner : public VDecalAnim {
191 public:
192 enum { TypeId = TDecAnimCombiner };
194 private:
195 bool mIsCloned;
197 protected:
198 virtual void doIO (VStream &strm, VNTValueIOEx &vio) override;
200 public:
201 // animator properties
202 TArray<VName> nameList; // can be empty in cloned/loaded object
203 TArray<VDecalAnim *> list; // can contain less items than `nameList`
205 protected:
206 virtual void fixup () override;
208 public:
209 virtual bool parse (VScriptParser *sc) override;
211 public:
212 inline VDecalAnimCombiner (ENoInit) noexcept : VDecalAnim(E_NoInit) {}
213 inline VDecalAnimCombiner () noexcept : VDecalAnim(), mIsCloned(false), nameList(), list() {}
214 virtual ~VDecalAnimCombiner ();
216 virtual vuint8 getTypeId () const noexcept override;
217 virtual const char *getTypeName () const noexcept override;
219 // this does deep clone, so we can attach it to the actual decal object
220 virtual VDecalAnim *clone (bool forced=false) override;
222 virtual void genValues () noexcept override;
224 virtual bool animate (decal_t *decal, float timeDelta) override;
226 virtual bool calcWillDisappear () const noexcept override;
227 virtual void calcMaxScales (float *sx, float *sy) const noexcept override;
229 virtual bool isCombiner () const noexcept override;
231 virtual int getCount () const noexcept override;
232 virtual VDecalAnim *getAt (int idx) noexcept override;
233 virtual bool hasTypeId (vuint8 tid, int depth=0) const noexcept override;
235 friend void ParseDecalDef (VScriptParser *sc);
236 friend void ProcessDecalDefs ();
240 #endif