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

Function DSSetControllerInfo

Descent3/soar_helpers.cpp:151–180  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

149}
150
151bool DSSetControllerInfo(int n, game_controls *controls) {
152 object *objp;
153
154 if (n < 0 || n > Highest_object_index || Objects[n].type == OBJ_NONE || Objects[n].control_type != CT_SOAR)
155 return false;
156
157 objp = &Objects[n];
158
159 // Update object's physics
160 if (objp->movement_type == MT_PHYSICS) {
161 objp->mtype.phys_info.rotthrust.x = controls->pitch_thrust * objp->mtype.phys_info.full_rotthrust;
162 objp->mtype.phys_info.rotthrust.z = controls->bank_thrust * objp->mtype.phys_info.full_rotthrust;
163 objp->mtype.phys_info.rotthrust.y = controls->heading_thrust * objp->mtype.phys_info.full_rotthrust;
164 objp->mtype.phys_info.thrust = (objp->orient.fvec * controls->forward_thrust * objp->mtype.phys_info.full_thrust) +
165 (objp->orient.uvec * controls->vertical_thrust * objp->mtype.phys_info.full_thrust) +
166 (objp->orient.rvec * controls->sideways_thrust * objp->mtype.phys_info.full_thrust);
167 }
168
169 // Process weapon firing
170 FireWeaponFromPlayer(objp, PW_PRIMARY, controls->fire_primary_down_count, controls->fire_primary_down_state,
171 controls->fire_primary_down_time);
172 FireWeaponFromPlayer(objp, PW_SECONDARY, controls->fire_secondary_down_count, controls->fire_secondary_down_state,
173 controls->fire_secondary_down_time);
174
175 // Deal with the flare
176 for (int i = 0; i < controls->fire_flare_down_count; i++)
177 FireFlareFromPlayer(objp);
178
179 return true;
180}
181
182bool DSGetFirstRoomObject(int n, int *first) {
183 if (!ROOMNUM_OUTSIDE(n)) {

Callers

nothing calls this directly

Calls 2

FireWeaponFromPlayerFunction · 0.85
FireFlareFromPlayerFunction · 0.85

Tested by

no test coverage detected