mirror of
https://github.com/zenorogue/hyperrogue.git
synced 2024-11-27 14:37:16 +00:00
fixed 'draw' in drawing tool while the map is rotated by mouse or animated movement
This commit is contained in:
parent
bf9fdd9a88
commit
edc173a538
47
hypgraph.cpp
47
hypgraph.cpp
@ -2188,6 +2188,25 @@ EX bool shmup_inverted() {
|
|||||||
return vid.wall_height < 0;
|
return vid.wall_height < 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** create the list of matrices that are affected when we shift/rotate the view. Usually this is not only the View matrix, but also auxiliary ones such as which_copy.
|
||||||
|
* flag & 1 : spins, so return only NLP if get_view_orientation() is NLP
|
||||||
|
* flag & 2 : if rugged, only View
|
||||||
|
*/
|
||||||
|
|
||||||
|
EX vector<transmatrix*> move_affected_matrices(int flag) {
|
||||||
|
if(flag & 1) {
|
||||||
|
if(&get_view_orientation() == &NLP) return { &NLP };
|
||||||
|
}
|
||||||
|
|
||||||
|
if((flag & 2) && rug::rugged) return { &View };
|
||||||
|
vector<transmatrix*> res;
|
||||||
|
res.push_back(&View);
|
||||||
|
res.push_back(¤t_display->which_copy);
|
||||||
|
res.push_back(&cwtV.T);
|
||||||
|
if(mapeditor::dt_in()) res.push_back(&mapeditor::cfree_old.T);
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
|
||||||
EX void centerpc(ld aspd) {
|
EX void centerpc(ld aspd) {
|
||||||
|
|
||||||
if(subscreens::split([=] () {centerpc(aspd);})) return;
|
if(subscreens::split([=] () {centerpc(aspd);})) return;
|
||||||
@ -2238,15 +2257,15 @@ EX void centerpc(ld aspd) {
|
|||||||
if(vid.sspeed >= 4.99) aspd = 1000;
|
if(vid.sspeed >= 4.99) aspd = 1000;
|
||||||
DEBBI(DF_GRAPH, ("center pc"));
|
DEBBI(DF_GRAPH, ("center pc"));
|
||||||
|
|
||||||
auto& W = current_display->which_copy;
|
auto mam = move_affected_matrices(0);
|
||||||
ors::unrotate(W); ors::unrotate(View); ors::unrotate(cwtV.T);
|
for(auto pV: mam) ors::unrotate(*pV);
|
||||||
|
|
||||||
/* what should we center? */
|
/* what should we center? */
|
||||||
transmatrix T;
|
transmatrix T;
|
||||||
if(multi::players > 1)
|
if(multi::players > 1)
|
||||||
T = unshift(cwtV); /* do not even try */
|
T = unshift(cwtV); /* do not even try */
|
||||||
else {
|
else {
|
||||||
T = W;
|
T = current_display->which_copy;
|
||||||
if(shmup::on)
|
if(shmup::on)
|
||||||
T = T * shmup::pc[0]->at;
|
T = T * shmup::pc[0]->at;
|
||||||
}
|
}
|
||||||
@ -2266,9 +2285,8 @@ EX void centerpc(ld aspd) {
|
|||||||
} */
|
} */
|
||||||
|
|
||||||
spinEdge(aspd);
|
spinEdge(aspd);
|
||||||
fixmatrix(View);
|
|
||||||
fix_whichcopy(cwt.at);
|
fix_whichcopy(cwt.at);
|
||||||
fixmatrix(current_display->which_copy);
|
for(auto pV: mam) fixmatrix(*pV);
|
||||||
}
|
}
|
||||||
|
|
||||||
else {
|
else {
|
||||||
@ -2281,8 +2299,7 @@ EX void centerpc(ld aspd) {
|
|||||||
else
|
else
|
||||||
shift_view_towards(shiftless(H), aspd, shift_method(smaAutocenter));
|
shift_view_towards(shiftless(H), aspd, shift_method(smaAutocenter));
|
||||||
|
|
||||||
fixmatrix(View);
|
for(auto pV: mam) fixmatrix(*pV);
|
||||||
fixmatrix(current_display->which_copy);
|
|
||||||
spinEdge(aspd);
|
spinEdge(aspd);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2297,7 +2314,7 @@ EX void centerpc(ld aspd) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ors::rerotate(W); ors::rerotate(cwtV.T); ors::rerotate(View);
|
for(auto pV: mam) ors::rerotate(*pV);
|
||||||
}
|
}
|
||||||
|
|
||||||
EX transmatrix oView;
|
EX transmatrix oView;
|
||||||
@ -3367,9 +3384,7 @@ EX hookset<bool(const hyperpoint&)> hooks_shift_view;
|
|||||||
/** rotate the view using the given rotation matrix */
|
/** rotate the view using the given rotation matrix */
|
||||||
EX void rotate_view(transmatrix T) {
|
EX void rotate_view(transmatrix T) {
|
||||||
if(callhandlers(false, hooks_rotate_view, T)) return;
|
if(callhandlers(false, hooks_rotate_view, T)) return;
|
||||||
transmatrix& which = get_view_orientation();
|
for(auto pV: move_affected_matrices(3)) (*pV) = T * (*pV);
|
||||||
which = T * which;
|
|
||||||
if(!gproduct && !rug::rugged) current_display->which_copy = T * current_display->which_copy;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
EX shiftpoint lie_exp(hyperpoint h1) {
|
EX shiftpoint lie_exp(hyperpoint h1) {
|
||||||
@ -3595,9 +3610,7 @@ EX void shift_view(hyperpoint H, eShiftMethod sm IS(shift_method(smaManualCamera
|
|||||||
#endif
|
#endif
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
View = get_shift_view_of(H, View, sm);
|
for(auto pV: move_affected_matrices(0)) *pV = get_shift_view_of(H, *pV, sm);
|
||||||
auto& wc = current_display->which_copy;
|
|
||||||
wc = get_shift_view_of(H, wc, sm);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/** works in embedded_plane (except embedded product where shift_view works, and euc_in_sl2) */
|
/** works in embedded_plane (except embedded product where shift_view works, and euc_in_sl2) */
|
||||||
@ -3624,8 +3637,7 @@ EX void shift_v_by_matrix(transmatrix& V, const transmatrix T, eShiftMethod sm)
|
|||||||
}
|
}
|
||||||
|
|
||||||
EX void shift_view_to(shiftpoint H, eShiftMethod sm IS(shift_method(smaManualCamera))) {
|
EX void shift_view_to(shiftpoint H, eShiftMethod sm IS(shift_method(smaManualCamera))) {
|
||||||
shift_v_to(View, H, sm);
|
for(auto pV: move_affected_matrices(0)) shift_v_to(*pV, H, sm);
|
||||||
shift_v_to(current_display->which_copy, H, sm);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
EX void shift_v_to(transmatrix& V, shiftpoint H, eShiftMethod sm IS(shift_method(smaManualCamera))) {
|
EX void shift_v_to(transmatrix& V, shiftpoint H, eShiftMethod sm IS(shift_method(smaManualCamera))) {
|
||||||
@ -3645,8 +3657,7 @@ EX void shift_v_to(transmatrix& V, shiftpoint H, eShiftMethod sm IS(shift_method
|
|||||||
}
|
}
|
||||||
|
|
||||||
EX void shift_view_towards(shiftpoint H, ld l, eShiftMethod sm IS(shift_method(smaManualCamera))) {
|
EX void shift_view_towards(shiftpoint H, ld l, eShiftMethod sm IS(shift_method(smaManualCamera))) {
|
||||||
shift_v_towards(View, H, l, sm);
|
for(auto pV: move_affected_matrices(0)) shift_v_towards(*pV, H, l, sm);
|
||||||
shift_v_towards(current_display->which_copy, H, l, sm);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
EX void shift_v_towards(transmatrix& V, shiftpoint H, ld l, eShiftMethod sm IS(shift_method(smaManualCamera))) {
|
EX void shift_v_towards(transmatrix& V, shiftpoint H, ld l, eShiftMethod sm IS(shift_method(smaManualCamera))) {
|
||||||
|
@ -279,9 +279,14 @@ EX namespace mapeditor {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** for 'draw' in the drawing tool, cfree is the free shape we are currently drawing */
|
||||||
dtfree *cfree;
|
dtfree *cfree;
|
||||||
cell *cfree_at;
|
/** which cell does cfree belong to */
|
||||||
shiftmatrix cfree_old;
|
EX cell *cfree_at;
|
||||||
|
/** essentially ggmatrix(cfree_at), but we need to know to work with tori */
|
||||||
|
EX shiftmatrix cfree_old;
|
||||||
|
|
||||||
|
EX bool dt_in() { return cfree; }
|
||||||
|
|
||||||
EX void dt_finish() {
|
EX void dt_finish() {
|
||||||
cfree = nullptr;
|
cfree = nullptr;
|
||||||
|
Loading…
Reference in New Issue
Block a user