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

Function CreateSmallView

Descent3/SmallViews.cpp:207–250  ·  view source on GitHub ↗

Create a new small view. If there is already a view in the given window, the old view gets blown away. Parameters: window - which window to open. See constants in SmallViews.h objhandle - handle for the object to view from flags - various view attributes. See defines in header file. time - how long to keep the window up. If 0, keep up indefinitely zoom - the zoom for this window. If 0, use th

Source from the content-addressed store, hash-verified

205// label - the label for the window
206// Returns: which window was opened, or -1 if window couldn't be created
207int CreateSmallView(int window, int objhandle, int flags, float time, float zoom, int gun_num, const char *label) {
208 small_view *svp;
209
210 // Check for valid window
211 if ((window < 0) || (window >= NUM_SMALL_VIEWS)) {
212 Int3();
213 window = SVW_LEFT;
214 }
215
216 // Make sure the object exists
217 if (!ObjGet(objhandle))
218 return -1;
219
220 svp = &Small_views[window];
221
222 // If this is a pop-up, and there was a non-popup active, save previous view
223 if ((flags & SVF_POPUP) && (svp->objhandle != OBJECT_HANDLE_NONE) && !(svp->flags & SVF_POPUP))
224 Small_views_save[window] = *svp;
225
226 // Set vars for new view
227 svp->objhandle = objhandle;
228 svp->zoom = zoom;
229 svp->gun_num = gun_num;
230 svp->flags = flags;
231 svp->timer = time;
232 if (time != 0.0)
233 svp->flags |= SVF_TIMED;
234
235 strncpy(svp->label, label ? label : "", LABEL_LEN);
236 svp->label[LABEL_LEN] = 0; // strncpy won't terminate if at max len
237
238 if (window == SVW_LEFT)
239 Disable_primary_monitor = 1;
240 else if (window == SVW_RIGHT)
241 Disable_secondary_monitor = 1;
242
243 // if guided view, set flag to true
244 if (ObjGet(objhandle) == Players[Player_num].guided_obj) {
245 Guided_missile_smallview = true;
246 Guided_missile_objhandle = objhandle;
247 }
248
249 return window;
250}
251
252// Called to get rid of all the small views & init system
253void ResetSmallViews() {

Callers 6

SelectNextCameraViewFunction · 0.85
InitCameraViewsFunction · 0.85
RestoreCameraRearviewsFunction · 0.85
msafe_CallFunctionFunction · 0.85
WBFireBatteryFunction · 0.85
FireWeaponFromObjectFunction · 0.85

Calls 1

ObjGetFunction · 0.85

Tested by

no test coverage detected