MCPcopy Create free account
hub / github.com/DescentDevelopers/Descent3 / ForceInit

Function ForceInit

Descent3/D3ForceFeedback.cpp:134–184  ·  view source on GitHub ↗

----------------------------------------------------------------- ForceInit Purpose: Initializes the Hi-Level Force Feedback system, creating all of the effects so they are ready to be used. -----------------------------------------------------------------

Source from the content-addressed store, hash-verified

132// of the effects so they are ready to be used.
133// -----------------------------------------------------------------
134void ForceInit(void) {
135 static bool first_call = true;
136
137 ASSERT(!D3Force_init);
138
139 bool dd_found, dd_enabled;
140 ddio_ff_GetInfo(&dd_found, &dd_enabled);
141
142 if (dd_found) {
143 D3Force_init = true;
144 D3Force_pause = false;
145
146 mprintf(0, "Force: High Level Force Feedback system initialized\n");
147 } else {
148 D3Force_init = false;
149 D3Force_pause = false;
150
151 mprintf(0, "Force: Force Feedback System Not Found\n");
152 }
153
154 for (int i = 0; i < DDIO_FF_MAXEFFECTS; i++) {
155 Force_hi_to_low_map[i] = -1;
156 }
157
158 ForceEffectsInit();
159
160 if (D3Force_init) {
161 // Enable/Disable the force feedback
162 // ---------------------------------
163 if (D3Use_force_feedback)
164 ForceEnable();
165 else
166 ForceDisable();
167
168 // Enable/Disable AutoCentering
169 // ----------------------------
170 if (D3Force_auto_center)
171 ForceEnableAutoCenter();
172 else
173 ForceDisableAutoCenter();
174
175 // Set ForceFeedback Gain
176 // ----------------------
177 ForceSetGain(D3Force_gain);
178 }
179
180 if (first_call) {
181 first_call = false;
182 atexit(ForceClose);
183 }
184}
185
186// -----------------------------------------------------------------
187// ForceClose

Callers 4

GameToEditorFunction · 0.85
EditorToGameFunction · 0.85
InitGameSystemsFunction · 0.85
ForceRestartFunction · 0.85

Calls 7

ddio_ff_GetInfoFunction · 0.85
ForceEffectsInitFunction · 0.85
ForceEnableFunction · 0.85
ForceDisableFunction · 0.85
ForceEnableAutoCenterFunction · 0.85
ForceDisableAutoCenterFunction · 0.85
ForceSetGainFunction · 0.85

Tested by

no test coverage detected