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

Method OnIdle

editor/editor.cpp:623–812  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

621int Slew_limitations = 0;
622
623BOOL CEditorApp::OnIdle(LONG lCount) {
624 static bool Dirty_wireframe = 0;
625 bool viewer_rotated = 0;
626 int key;
627
628 // determine if we should process idle messages
629 if (m_Paused)
630 return TRUE;
631
632 // do our own input and output!
633 ddio_Frame();
634
635 /////////////////////////////////////////////////////////////////////////////
636 // all mouse button/drag functions go in this big if statement. this
637 // ensures that there are no conflicts between mouse drag operations
638 if (!SelManager.IsSelecting() && !ObjMoveManager.IsMoving()) {
639 // slide current texture
640 if (KEY_STATE(KEY_Y)) { // slide with mouse
641 int x, y, dx, dy;
642 ddio_MouseGetState(&x, &y, &dx, &dy);
643
644 if (KEY_STATE(KEY_LCTRL) || KEY_STATE(KEY_RCTRL))
645 HTextureRotate(Curroomp, Curface, (float)dx * 50.0);
646 else
647 HTextureSlide(Curroomp, Curface, (float)dx / 2.0, (float)-dy / 2.0);
648 }
649 // attaching rooms.
650 else if (KEY_STATE(KEY_T)) {
651 if ((Placed_room != -1) || (Placed_group != NULL)) {
652 int x, y, dx, dy;
653 ddio_MouseGetState(&x, &y, &dx, &dy);
654
655 if (KEY_STATE(KEY_LCTRL) || KEY_STATE(KEY_RCTRL))
656 Placed_room_attachpoint +=
657 (Placed_room_orient.rvec * (float)dx / 20.0) + (Placed_room_orient.uvec * (float)dy / 20.0);
658 else if ((Placed_baseroomp == NULL) &&
659 (KEY_STATE(KEY_LSHIFT) || KEY_STATE(KEY_RSHIFT))) // If on terrain, slide up/down
660 Placed_room_attachpoint += (Placed_room_orient.fvec * (float)dx / 20.0);
661 else {
662 Placed_room_angle += (float)dx * 20.0;
663 ComputePlacedRoomMatrix();
664 }
665
666 State_changed = 1;
667 }
668 } else {
669 MoveWorld();
670 }
671 }
672
673 // very temorary key handler
674 // Slew the texture view
675 bool was_outside = (OBJECT_OUTSIDE(Viewer_object) != 0);
676 int slew_flags = SlewFrame(Viewer_object, Slew_limitations);
677
678 if (slew_flags & SLEW_MOVE) {
679 Viewer_moved = 1;
680

Callers

nothing calls this directly

Calls 15

ddio_FrameFunction · 0.85
ddio_MouseGetStateFunction · 0.85
HTextureRotateFunction · 0.85
HTextureSlideFunction · 0.85
ComputePlacedRoomMatrixFunction · 0.85
MoveWorldFunction · 0.85
SlewFrameFunction · 0.85
SetViewModeFunction · 0.85
ddio_KeyInKeyFunction · 0.85
SlewControlInitFunction · 0.85
CreateRoomObjectsFunction · 0.85
ComputeAABBFunction · 0.85

Tested by

no test coverage detected