1+ /* ****************************************************************************
2+ *
3+ * PROJECT: Multi Theft Auto
4+ * LICENSE: See LICENSE in the top level directory
5+ * FILE: game_sa/C2DEffectSAInterface.h
6+ * PURPOSE: Header file for 2dfx game interface layer
7+ *
8+ * Multi Theft Auto is available from https://www.multitheftauto.com/
9+ *
10+ *****************************************************************************/
11+ #pragma once
12+
13+ #include " game/RenderWare.h"
14+ #include " game/CModelInfo.h"
15+ #include " game/C2DEffects.h"
16+ #include " CObjectSA.h"
17+
18+ struct t2dEffectLight
19+ {
20+ RwColor color;
21+ float coronaFarClip;
22+ float pointLightRange;
23+ float coronaSize;
24+ float shadowSize;
25+
26+ // Flags
27+ union
28+ {
29+ struct
30+ {
31+ // Flags 1
32+ std::uint16_t checkObstacles : 1 ;
33+ std::uint16_t fogType : 1 ;
34+ std::uint16_t fogType2 : 1 ;
35+ std::uint16_t withoutCorona : 1 ;
36+ std::uint16_t onlyLongDistance : 1 ;
37+ std::uint16_t atDay : 1 ;
38+ std::uint16_t atNight : 1 ;
39+ std::uint16_t blinking1 : 1 ;
40+
41+ // Flags 2
42+ std::uint16_t onlyFromBelow : 1 ;
43+ std::uint16_t blinking2 : 1 ;
44+ std::uint16_t updateHeightAboveGround : 1 ;
45+ std::uint16_t checkDirection : 1 ;
46+ std::uint16_t blinking3 : 1 ;
47+ };
48+
49+ std::uint16_t flags;
50+ };
51+
52+ e2dCoronaFlashType coronaFlashType; // show mode
53+ bool coronaEnableReflection;
54+ std::uint8_t coronaFlareType; // lens flare effect 0 - off, 1 - on
55+ std::uint8_t shadowColorMultiplier;
56+ std::int8_t shadowZDistance;
57+ std::int8_t offsetX;
58+ std::int8_t offsetY;
59+ std::int8_t offsetZ;
60+ std::uint8_t field_1E[2 ];
61+ RwTexture* coronaTex;
62+ RwTexture* shadowTex;
63+ std::int32_t field_28;
64+ std::int32_t field_2C;
65+ };
66+
67+ // The particle effect name is an entry in effects.fxp
68+ struct t2dEffectParticle
69+ {
70+ char szName[24 ];
71+ };
72+
73+ // It`s used for spawning peds (Like on ticketbooth, Windows of shops, Blackjack-tables)
74+ // It includes information about the External Script ped is going to use when spawned, it`s facing angle and it`s behaviour
75+ struct t2dEffectAttractor
76+ {
77+ RwV3d queueDirection;
78+ RwV3d useDirection;
79+ RwV3d forwardDirection;
80+ e2dAttractorType attractorType;
81+ std::uint8_t pedExistingProbability;
82+ std::uint8_t field_26;
83+ std::uint8_t flags;
84+ char szScriptName[8 ];
85+ };
86+
87+ // entry-exit markers similar to ipl version
88+ struct t2dEffectEnex
89+ {
90+ float enterAngle; // Rotation angle enter-marker (relative to the object)
91+ RwV3d size; // The radius of the approximation to the marker
92+ RwV3d exitPosn; // The position of exit-marker (offset relative to enter position)
93+ float exitAngle; // angle of rotation exit-marker (relative to the object)
94+ std::int16_t interiorId;
95+ std::uint8_t flags1; // Unknown flags
96+ std::uint8_t skyColor;
97+ char szInteriorName[8 ];
98+ std::uint8_t timeOn;
99+ std::uint8_t timeOff;
100+
101+ // Flags 2
102+ union
103+ {
104+ struct
105+ {
106+ std::uint8_t unknown1 : 1 ;
107+ std::uint8_t unknown2 : 1 ;
108+ std::uint8_t timedEffect : 1 ;
109+ };
110+ std::uint8_t flags2;
111+ };
112+
113+ std::uint8_t field_2F;
114+ };
115+
116+ struct t2dEffectRoadsign
117+ {
118+ RwV2d size;
119+ RwV3d rotation;
120+
121+ // Flags
122+ union
123+ {
124+ struct
125+ {
126+ std::uint8_t numOfLines : 2 ;
127+ std::uint8_t symbolsPerLine : 2 ;
128+ std::uint8_t textColor : 2 ;
129+ };
130+
131+ std::uint8_t flags;
132+ };
133+
134+ std::uint8_t field_16[2 ];
135+ char * text; // size 64
136+ RpAtomic* atomic;
137+ };
138+
139+ // Section defines a place where peds can cover during firefights
140+ struct t2dEffectCoverPoint
141+ {
142+ RwV2d direction;
143+ std::uint8_t type;
144+ std::uint8_t field_9[3 ];
145+ };
146+
147+ // Example in vgseesc01.dff
148+ struct t2dEffectEscalator
149+ {
150+ RwV3d bottom;
151+ RwV3d top;
152+ RwV3d end; // Z pos, matches top Z if escalator goes up, bottom Z if it goes down
153+ std::uint8_t direction; // 0 - down, 1 - up
154+ std::uint8_t field_25[3 ];
155+ };
156+
157+ // Example in kb_bandit_u.dff
158+ // Used to determine additional coordinates that can be used in scripts
159+ struct t2dEffectTriggerPoint
160+ {
161+ std::int32_t id;
162+ };
163+
164+ // Some interiors stuff, probably unused?
165+ struct t2dEffectFurniture
166+ {
167+ std::uint8_t type;
168+ std::int8_t groupId;
169+ // size
170+ std::uint8_t width;
171+ std::uint8_t depth;
172+ std::uint8_t height;
173+ // doors
174+ std::int8_t door;
175+ std::int8_t l_door[2 ]; // start, end
176+ std::int8_t r_door[2 ]; // start, end
177+ std::int8_t t_door[2 ]; // start, end
178+ // windows
179+ std::int8_t l_window[2 ]; // start, end
180+ std::int8_t r_window[2 ]; // start, end
181+ std::int8_t t_window[2 ]; // start, end
182+ // something like offsets?
183+ std::int8_t goLeft[3 ]; // x,y,z?
184+ std::int8_t goBottom[3 ]; // x,y,z?
185+ std::int8_t goWidth[3 ]; // x,y,z?
186+ std::int8_t goDepth[3 ]; // x,y,z?
187+
188+ std::uint8_t seed;
189+ std::uint8_t status;
190+ float rotation;
191+ };
192+
193+ union t2dEffectUnion
194+ {
195+ t2dEffectLight light;
196+ t2dEffectParticle particle;
197+ t2dEffectAttractor attractor;
198+ t2dEffectEnex enex;
199+ t2dEffectRoadsign roadsign;
200+ t2dEffectCoverPoint coverPoint;
201+ t2dEffectEscalator escalator;
202+ t2dEffectTriggerPoint triggerPoint; // slot machine, k.a.a.c gates, basketball hoop
203+ t2dEffectFurniture furniture;
204+ };
205+
206+ class C2DEffectSAInterface
207+ {
208+ public:
209+ RwV3d position;
210+ e2dEffectType type;
211+ std::uint8_t field_D[3 ];
212+
213+ t2dEffectUnion effect;
214+ };
215+
216+ class C2DEffectInfoStoreSAInterface
217+ {
218+ public:
219+ std::uint32_t objCount;
220+ C2DEffectSAInterface objects[100 ];
221+ };
222+
223+ class C2DEffectPluginDataSAInterface
224+ {
225+ public:
226+ std::uint32_t count;
227+ C2DEffectSAInterface objects[];
228+ };
229+
230+ class CEscalatorSAInterface
231+ {
232+ public:
233+ RwV3d startPos;
234+ RwV3d bottomPos;
235+ RwV3d topPos;
236+ RwV3d endPos;
237+ std::uint8_t rotation[72 ]; // CMatrixSAInterface
238+ bool exist;
239+ bool objectCreated;
240+ bool moveDown;
241+ std::uint8_t field_7B; // pad
242+ std::int32_t numIntermediatePlanes;
243+ std::uint32_t numBottomPlanes;
244+ std::uint32_t numTopPlanes;
245+ std::uint8_t field_88[8 ]; // unused field
246+ RwSphere bounding;
247+ float currentPosition;
248+ CEntitySAInterface* entity;
249+ CObjectSAInterface* objects[42 ];
250+ };
0 commit comments