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

Function WireframeFindRoomFace

editor/drawworld.cpp:509–553  ·  view source on GitHub ↗

Finds the closest room:face to the viewer at a given x,y screen position in the wireframe view Parameters: vp - the viewport we're checking. Must be the same viewport as the last wireframe view rendered x,y - the screen coordinates clicked on roomnum,facenum - pointers to variables to be filled in find_mode - see values in header file Returns: true if found a room/face

Source from the content-addressed store, hash-verified

507// find_mode - see values in header file
508// Returns: true if found a room/face
509bool WireframeFindRoomFace(grViewport *vp, int x, int y, int *roomnum, int *facenum, int find_mode) {
510 if (last_vp == NULL)
511 return 0;
512
513 if (vp != last_vp) {
514 // Int3();
515 return 0;
516 }
517
518 Draw_viewport = vp;
519
520 vp->clear();
521
522 StartEditorFrame(vp, &last_viewer_position, &last_view_orient, last_zoom);
523
524 Search_mode = 1;
525 Search_find_mode = find_mode;
526 Search_x = x;
527 Search_y = y;
528 Search_viewer = last_viewer_position;
529 Search_min_dist = (find_mode == FM_NEXT) ? Found_dist : 0.0;
530 Search_roomnum = *roomnum;
531 Search_facenum = *facenum;
532 Found_roomnum = -1;
533 Found_facenum = -1;
534
535 if (Editor_view_mode == VM_ROOM) {
536 ASSERT(D3EditState.current_room != -1);
537 CheckRoom(&Rooms[D3EditState.current_room]);
538 } else {
539 DrawAllRooms(&last_viewer_target, last_rad);
540 CheckRoom(Curroomp);
541 }
542
543 EndEditorFrame();
544
545 Search_mode = 0;
546
547 if (Found_roomnum != -1) {
548 *roomnum = Found_roomnum;
549 *facenum = Found_facenum;
550 return 1;
551 } else
552 return 0;
553}
554
555// Adds all the rooms that have a vertex inside of a given screen box to the selected list
556// Parameters: vp - the viewport we're checking. Must be the same viewport as the last wireframe view rendered

Callers 1

OnLButtonDownMethod · 0.85

Calls 5

StartEditorFrameFunction · 0.85
CheckRoomFunction · 0.85
DrawAllRoomsFunction · 0.85
EndEditorFrameFunction · 0.85
clearMethod · 0.45

Tested by

no test coverage detected