This repository has been archived by the owner on Oct 24, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 5
/
gate.h
176 lines (148 loc) · 6.17 KB
/
gate.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
// Gate.h: Definition of the Gate class
//
//////////////////////////////////////////////////////////////////////
#pragma once
#if !defined(AFX_GATE_H__EDC63CB2_226F_4606_99A9_0C2DB8FE1E3B__INCLUDED_)
#define AFX_GATE_H__EDC63CB2_226F_4606_99A9_0C2DB8FE1E3B__INCLUDED_
#include "resource.h" // main symbols
/////////////////////////////////////////////////////////////////////////////
// Gate
class GateData final : public BaseProperty
{
public:
Vertex2D m_vCenter;
float m_length;
float m_height;
float m_rotation;
TimerDataRoot m_tdr;
float m_damping;
float m_gravityfactor;
string m_szSurface;
float m_angleMin;
float m_angleMax;
GateType m_type;
bool m_showBracket;
bool m_twoWay;
};
class Gate :
public IDispatchImpl<IGate, &IID_IGate, &LIBID_VPinballLib>,
//public ISupportErrorInfo,
public CComObjectRoot,
public CComCoClass<Gate, &CLSID_Gate>,
public EventProxy<Gate, &DIID_IGateEvents>,
public IConnectionPointContainerImpl<Gate>,
public IProvideClassInfo2Impl<&CLSID_Gate, &DIID_IGateEvents, &LIBID_VPinballLib>,
public ISelect,
public IEditable,
public Hitable,
public IScriptable,
public IFireEvents,
public IPerPropertyBrowsing // Ability to fill in dropdown in property browser
{
public:
Gate();
void SetGateType(GateType type);
~Gate();
BEGIN_COM_MAP(Gate)
COM_INTERFACE_ENTRY(IDispatch)
COM_INTERFACE_ENTRY(IGate)
//COM_INTERFACE_ENTRY(ISupportErrorInfo)
COM_INTERFACE_ENTRY_IMPL(IConnectionPointContainer)
COM_INTERFACE_ENTRY(IPerPropertyBrowsing)
COM_INTERFACE_ENTRY(IProvideClassInfo)
COM_INTERFACE_ENTRY(IProvideClassInfo2)
END_COM_MAP()
//DECLARE_NOT_AGGREGATABLE(Light)
// Remove the comment from the line above if you don't want your object to
// support aggregation.
BEGIN_CONNECTION_POINT_MAP(Gate)
CONNECTION_POINT_ENTRY(DIID_IGateEvents)
END_CONNECTION_POINT_MAP()
STANDARD_EDITABLE_DECLARES(Gate, eItemGate, GATE, 1)
//DECLARE_NOT_AGGREGATABLE(Gate)
// Remove the comment from the line above if you don't want your object to
// support aggregation.
DECLARE_REGISTRY_RESOURCEID(IDR_GATE)
// ISupportsErrorInfo
STDMETHOD(InterfaceSupportsErrorInfo)(REFIID riid);
void MoveOffset(const float dx, const float dy) final;
void SetObjectPos() final;
// Multi-object manipulation
Vertex2D GetCenter() const final;
void PutCenter(const Vertex2D &pv) final;
void SetDefaultPhysics(bool fromMouseClick) final;
void RenderBlueprint(Sur *psur, const bool solid) final;
void ExportMesh(ObjLoader &loader) final;
unsigned long long GetMaterialID() const final { return m_ptable->GetMaterial(m_d.m_szMaterial)->hash(); }
ItemTypeEnum HitableGetItemType() const final { return eItemGate; }
void UpdateStatusBarInfo() final;
void WriteRegDefaults() final;
float GetOpenAngle() const;
void SetOpenAngle(const float angle);
float GetCloseAngle() const;
void SetCloseAngle(const float angle);
GateData m_d;
private:
void UpdateWire();
void RenderObject();
void GenerateBracketMesh(Vertex3D_NoTex2 *buf);
void GenerateWireMesh(Vertex3D_NoTex2 *buf);
PinTable *m_ptable;
LineSeg *m_plineseg;
HitGate *m_phitgate;
VertexBuffer *m_wireVertexBuffer;
IndexBuffer *m_wireIndexBuffer;
float m_vertexbuffer_angle;
VertexBuffer *m_bracketVertexBuffer;
IndexBuffer *m_bracketIndexBuffer;
const Vertex3D_NoTex2 *m_vertices;
const WORD *m_indices;
unsigned int m_numVertices;
unsigned int m_numIndices;
float m_baseHeight;
// IGate
public:
STDMETHOD(get_Elasticity)(/*[out, retval]*/ float *pVal);
STDMETHOD(put_Elasticity)(/*[in]*/ float newVal);
STDMETHOD(get_Open)(/*[out, retval]*/ VARIANT_BOOL *pVal);
STDMETHOD(put_Open)(/*[in]*/ VARIANT_BOOL newVal);
STDMETHOD(get_Surface)(/*[out, retval]*/ BSTR *pVal);
STDMETHOD(put_Surface)(/*[in]*/ BSTR newVal);
STDMETHOD(get_Y)(/*[out, retval]*/ float *pVal);
STDMETHOD(put_Y)(/*[in]*/ float newVal);
STDMETHOD(get_X)(/*[out, retval]*/ float *pVal);
STDMETHOD(put_X)(/*[in]*/ float newVal);
STDMETHOD(get_Rotation)(/*[out, retval]*/ float *pVal);
STDMETHOD(put_Rotation)(/*[in]*/ float newVal);
STDMETHOD(get_Length)(/*[out, retval]*/ float *pVal);
STDMETHOD(put_Length)(/*[in]*/ float newVal);
STDMETHOD(get_Material)(/*[out, retval]*/ BSTR *pVal);
STDMETHOD(put_Material)(/*[in]*/ BSTR newVal);
STDMETHOD(get_Height)(/*[out, retval]*/ float *pVal);
STDMETHOD(put_Height)(/*[in]*/ float newVal);
STDMETHOD(get_ShowBracket)(/*[out, retval]*/ VARIANT_BOOL *pVal);
STDMETHOD(put_ShowBracket)(/*[in]*/ VARIANT_BOOL newVal);
STDMETHOD(get_CloseAngle)(/*[out, retval]*/ float *pVal);
STDMETHOD(put_CloseAngle)(/*[in]*/ float newVal);
STDMETHOD(get_OpenAngle)(/*[out, retval]*/ float *pVal);
STDMETHOD(put_OpenAngle)(/*[in]*/ float newVal);
STDMETHOD(get_Collidable)(/*[out, retval]*/ VARIANT_BOOL *pVal);
STDMETHOD(put_Collidable)(/*[in]*/ VARIANT_BOOL newVal);
STDMETHOD(Move)(int dir, float speed, float angle);
STDMETHOD(get_Friction)(/*[out, retval]*/ float *pVal);
STDMETHOD(put_Friction)(/*[in]*/ float newVal);
STDMETHOD(get_Damping)(/*[out, retval]*/ float *pVal);
STDMETHOD(put_Damping)(/*[in]*/ float newVal);
STDMETHOD(get_GravityFactor)(/*[out, retval]*/ float *pVal);
STDMETHOD(put_GravityFactor)(/*[in]*/ float newVal);
STDMETHOD(get_Visible)(/*[out, retval]*/ VARIANT_BOOL *pVal);
STDMETHOD(put_Visible)(/*[in]*/ VARIANT_BOOL newVal);
STDMETHOD(get_TwoWay)(/*[out, retval]*/ VARIANT_BOOL *pVal);
STDMETHOD(put_TwoWay)(/*[in]*/ VARIANT_BOOL newVal);
STDMETHOD(get_CurrentAngle)(/*[out, retval]*/ float *pVal);
STDMETHOD(get_ReflectionEnabled)(/*[out, retval]*/ VARIANT_BOOL *pVal);
STDMETHOD(put_ReflectionEnabled)(/*[in]*/ VARIANT_BOOL newVal);
STDMETHOD(get_DrawStyle)(/*[out, retval]*/ GateType *pVal);
STDMETHOD(put_DrawStyle)(/*[in]*/ GateType newVal);
};
#endif // !defined(AFX_GATE_H__EDC63CB2_226F_4606_99A9_0C2DB8FE1E3B__INCLUDED_)