added using Shift + Right Mouse for camera rotation in 3D model editor.

This commit is contained in:
TomAwezome 2020-04-02 03:36:15 -04:00
parent 2c2a6aa475
commit fefca18050
3 changed files with 23 additions and 1 deletions

View File

@ -1,4 +1,7 @@
$WW,1$$FG,5$$TX+CX,"ChangeLog"$$FG$
$IV,1$----04/02/20 03:27:03----$IV,0$
* Added camera rotation via mouse in 3D $LK,"SpriteMesh",A="FF:::/Zenith/Gr/SpriteMesh.CC,SpriteMeshEd"$ editor. 360 used as magic number, trying $LK,"VIEWANGLES_RANGE",A="FF:::/Zenith/Ctrls/CtrlsA.CC,VIEWANGLES_RANGE"$ crashed it.
$IV,1$----04/02/20 01:50:52----$IV,0$
* 'Fixed' $LK,"Varoom",A="FF:::/Demo/Games/Varoom.CC,kbd.down_bitmap"$ window lock up on exit. Brute-forcing zero, but somewhere $LK,"mp_not_done_flags",A="FF:::/Demo/Games/Varoom.CC,mp_not_done_flags"$ isn't getting cleared when shift-esc is entered with the new key implementation.

View File

@ -975,6 +975,9 @@ $WW,0$*/
CD3I32 p0a,p0b;
CMeshEdVertex *va[3],*tmpv;
Bool adjusting_z=FALSE,moving,save_and_exit;
Bool adjusting_camera=FALSE;
CMeshFrame e;
if (c) {
@ -1050,6 +1053,7 @@ $WW,0$*/
AutoComplete;
RegOneTimePopUp(ARf_MESH_ED,
"$$GREEN$$Right Mouse$$FG$$: Hold and move to shift cursor z\n"
"$$GREEN$$Shift + Right Mouse$$FG$$: Hold and move to rotate camera\n"
"$$GREEN$$'j'$$FG$$: Jump cursor Z to nearest vertex's Z\n"
"$$GREEN$$'v'$$FG$$: Place Vertex Mode\n"
"$$GREEN$$'m'$$FG$$: Move Vertex Mode\n"
@ -1417,7 +1421,8 @@ me_clip_cut:
}
break;
case MESSAGE_MS_R_DOWN:
if (!adjusting_z && e.ed_mode!='M' &&
if (Bt(kbd.down_bitmap,SC_SHIFT)) adjusting_camera = TRUE;
else if (!adjusting_z && e.ed_mode!='M' &&
(e.chain_pred==e.vertex_head.last ||
e.ed_mode!='n' && e.ed_mode!='f' && e.ed_mode!='p')) {
if (moving) {
@ -1436,6 +1441,7 @@ me_clip_cut:
}
break;
case MESSAGE_MS_R_UP:
adjusting_camera = FALSE;
if (adjusting_z) {
e.mouse_z=RoundI64(Sign(p0b.y-mouse.presnap.y)
*Sqrt(Sqr(p0b.x-mouse.presnap.x)+Sqr(p0b.y-mouse.presnap.y))
@ -1468,6 +1474,19 @@ me_clip_cut:
}
break;
case MESSAGE_MS_MOVE:
if (adjusting_camera)
{
// In the editor, X and Y of mouse rotate around Y and X 3D axes.
s->sx += mouse.presnap.y - mouse_last.presnap.y;
if (s->sx < 0) s->sx = 360; // VIEWANGLES_RANGE
else if (s->sx > 360) s->sx = 0;
s->sy -= mouse.presnap.x - mouse_last.presnap.x;
if (s->sy < 0) s->sy = 360; // VIEWANGLES_RANGE
else if (s->sy > 360) s->sy = 0;
break;
}
if (adjusting_z) {
e.mouse_z=RoundI64(Sign(p0b.y-mouse.presnap.y)
*Sqrt(Sqr(p0b.x-mouse.presnap.x)+Sqr(p0b.y-mouse.presnap.y))