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

Function FindNextViewerObject

editor/HView.cpp:239–266  ·  view source on GitHub ↗

Finds a viewer object if one exists. Starts looking at the specified id and searches through all possible ids Parameters: id - which viewer id view_mode - if -1, find any viewer, else find one that matches view mode Returns: object number of a viewer object, or -1 if none

Source from the content-addressed store, hash-verified

237// view_mode - if -1, find any viewer, else find one that matches view mode
238// Returns: object number of a viewer object, or -1 if none
239int FindNextViewerObject(int id, int view_mode) {
240 int i;
241 int objnum;
242 int terrain_flag;
243
244 if (id == -1)
245 id = 0;
246
247 ASSERT((id >= 0) && (id <= MAX_VIEWERS));
248
249 // Get flags
250 terrain_flag = (view_mode == VM_TERRAIN);
251
252 // Try all viewer id's, starting at the one passed in
253 for (i = 0; i < MAX_VIEWERS; i++) {
254 int check_id = ((id + i) % MAX_VIEWERS);
255
256 objnum = FindViewerObject(check_id);
257
258 if ((objnum != -1) && ((view_mode == -1) || ((OBJECT_OUTSIDE(&Objects[objnum]) != 0) == terrain_flag)))
259 break;
260 }
261
262 if (i == MAX_VIEWERS) // didn't find one
263 return -1;
264
265 return objnum;
266}
267
268// Creates a viewer object of the specified type
269// Parameters: view_mode - mine,terrain,or room. See constants in 3dedit.h

Callers 4

SelectNextViewerFunction · 0.85
DeleteViewerFunction · 0.85
SetEditorViewerFunction · 0.85
DeleteRoomFromMineFunction · 0.85

Calls 1

FindViewerObjectFunction · 0.85

Tested by

no test coverage detected