mirror of
https://github.com/zenorogue/hyperrogue.git
synced 2024-12-24 17:10:36 +00:00
viewctr is no more... major reduction of redundancy/complexity
This commit is contained in:
parent
74a139ca3e
commit
ef9e2236ba
@ -606,7 +606,7 @@ struct hrmap_archimedean : hrmap {
|
|||||||
|
|
||||||
void draw() {
|
void draw() {
|
||||||
dq::visited.clear();
|
dq::visited.clear();
|
||||||
dq::enqueue(viewctr.at, cview());
|
dq::enqueue(centerover->master, cview());
|
||||||
|
|
||||||
while(!dq::drawqueue.empty()) {
|
while(!dq::drawqueue.empty()) {
|
||||||
auto& p = dq::drawqueue.front();
|
auto& p = dq::drawqueue.front();
|
||||||
|
@ -153,7 +153,7 @@ struct hrmap_asonov : hrmap {
|
|||||||
void draw() override {
|
void draw() override {
|
||||||
dq::visited_by_matrix.clear();
|
dq::visited_by_matrix.clear();
|
||||||
|
|
||||||
dq::enqueue_by_matrix(viewctr.at, cview());
|
dq::enqueue_by_matrix(centerover->master, cview());
|
||||||
|
|
||||||
while(!dq::drawqueue.empty()) {
|
while(!dq::drawqueue.empty()) {
|
||||||
auto& p = dq::drawqueue.front();
|
auto& p = dq::drawqueue.front();
|
||||||
|
@ -13,16 +13,12 @@ EX int fontscale = 100;
|
|||||||
#if HDR
|
#if HDR
|
||||||
/** configuration of the current view */
|
/** configuration of the current view */
|
||||||
struct display_data {
|
struct display_data {
|
||||||
/** This specifies the heptagon the view is currently centered on.
|
/** The cell which is currently in the center. */
|
||||||
* Unused in masterless tilings -- precise_center is used there.
|
cell *precise_center;
|
||||||
*/
|
/** The current rotation, relative to precise_center. */
|
||||||
heptspin view_center;
|
|
||||||
/** The current rotation, relative to viewctr. */
|
|
||||||
transmatrix view_matrix;
|
transmatrix view_matrix;
|
||||||
/** The view relative to the player character. */
|
/** The view relative to the player character. */
|
||||||
transmatrix player_matrix;
|
transmatrix player_matrix;
|
||||||
/** The cell which is precisely in the center. */
|
|
||||||
cellwalker precise_center;
|
|
||||||
/** On-screen coordinates for all the visible cells. */
|
/** On-screen coordinates for all the visible cells. */
|
||||||
unordered_map<cell*, transmatrix> cellmatrices, old_cellmatrices;
|
unordered_map<cell*, transmatrix> cellmatrices, old_cellmatrices;
|
||||||
/** Position of the current map view, relative to the screen (0 to 1). */
|
/** Position of the current map view, relative to the screen (0 to 1). */
|
||||||
@ -53,7 +49,6 @@ struct display_data {
|
|||||||
|
|
||||||
#define View (current_display->view_matrix)
|
#define View (current_display->view_matrix)
|
||||||
#define cwtV (current_display->player_matrix)
|
#define cwtV (current_display->player_matrix)
|
||||||
#define viewctr (current_display->view_center)
|
|
||||||
#define centerover (current_display->precise_center)
|
#define centerover (current_display->precise_center)
|
||||||
#define gmatrix (current_display->cellmatrices)
|
#define gmatrix (current_display->cellmatrices)
|
||||||
#define gmatrix0 (current_display->old_cellmatrices)
|
#define gmatrix0 (current_display->old_cellmatrices)
|
||||||
|
@ -249,7 +249,7 @@ EX heptagon *createAlternateMap(cell *c, int rad, hstate firststate, int special
|
|||||||
alt->emeraldval = 0;
|
alt->emeraldval = 0;
|
||||||
alt->zebraval = 0;
|
alt->zebraval = 0;
|
||||||
alt->distance = 0;
|
alt->distance = 0;
|
||||||
alt->fieldval = hybrid::current_view_level;
|
alt->fieldval = hybrid::get_where(centerover).second;
|
||||||
alt->c7 = NULL;
|
alt->c7 = NULL;
|
||||||
alt->alt = alt;
|
alt->alt = alt;
|
||||||
h->alt = alt;
|
h->alt = alt;
|
||||||
|
@ -400,7 +400,7 @@ EX namespace binary {
|
|||||||
|
|
||||||
void draw() override {
|
void draw() override {
|
||||||
dq::visited.clear();
|
dq::visited.clear();
|
||||||
dq::enqueue(viewctr.at, cview());
|
dq::enqueue(centerover->master, cview());
|
||||||
|
|
||||||
while(!dq::drawqueue.empty()) {
|
while(!dq::drawqueue.empty()) {
|
||||||
auto& p = dq::drawqueue.front();
|
auto& p = dq::drawqueue.front();
|
||||||
|
@ -1525,9 +1525,9 @@ void celldrawer::draw_features_and_walls_3d() {
|
|||||||
b = !isWall3(c->move(a), dummy);
|
b = !isWall3(c->move(a), dummy);
|
||||||
if(b) {
|
if(b) {
|
||||||
if(pmodel == mdPerspective && !sphere && !quotient && !penrose && !nonisotropic && !hybri && !experimental && !nih) {
|
if(pmodel == mdPerspective && !sphere && !quotient && !penrose && !nonisotropic && !hybri && !experimental && !nih) {
|
||||||
if(a < 4 && among(geometry, gHoroTris, gBinary3) && celldistAlt(c) >= celldistAlt(viewcenter())) continue;
|
if(a < 4 && among(geometry, gHoroTris, gBinary3) && celldistAlt(c) >= celldistAlt(centerover)) continue;
|
||||||
else if(a < 2 && among(geometry, gHoroRec) && celldistAlt(c) >= celldistAlt(viewcenter())) continue;
|
else if(a < 2 && among(geometry, gHoroRec) && celldistAlt(c) >= celldistAlt(centerover)) continue;
|
||||||
else if(c->move(a)->master->distance > c->master->distance && c->master->distance > viewctr.at->distance && !quotient) continue;
|
else if(c->move(a)->master->distance > c->master->distance && c->master->distance > centerover->master->distance && !quotient) continue;
|
||||||
}
|
}
|
||||||
else if(sol && in_perspective() && !nih && !asonov::in()) {
|
else if(sol && in_perspective() && !nih && !asonov::in()) {
|
||||||
ld b = vid.binary_width * log(2) / 2;
|
ld b = vid.binary_width * log(2) / 2;
|
||||||
@ -1725,15 +1725,6 @@ void celldrawer::bookkeeping() {
|
|||||||
mouseover2 = c;
|
mouseover2 = c;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!masterless) {
|
|
||||||
double dfc = euclid ? intval(tC0(V), C0) : V[LDIM][LDIM];
|
|
||||||
|
|
||||||
if(dfc < centdist) {
|
|
||||||
centdist = dfc;
|
|
||||||
centerover = cw;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
int orbrange = (items[itRevolver] ? 3 : 2);
|
int orbrange = (items[itRevolver] ? 3 : 2);
|
||||||
|
|
||||||
if(c->cpdist <= orbrange) if(multi::players > 1 || multi::alwaysuse)
|
if(c->cpdist <= orbrange) if(multi::players > 1 || multi::alwaysuse)
|
||||||
|
@ -57,7 +57,7 @@ EX movedir mousedest;
|
|||||||
EX ld shiftmul = 1;
|
EX ld shiftmul = 1;
|
||||||
|
|
||||||
EX cell *mouseover, *mouseover2, *lmouseover;
|
EX cell *mouseover, *mouseover2, *lmouseover;
|
||||||
EX ld modist, modist2, centdist;
|
EX ld modist, modist2;
|
||||||
|
|
||||||
EX int lastt;
|
EX int lastt;
|
||||||
|
|
||||||
@ -431,7 +431,7 @@ EX void handleKeyNormal(int sym, int uni) {
|
|||||||
|
|
||||||
if(DEFAULTNOR(sym)) {
|
if(DEFAULTNOR(sym)) {
|
||||||
gmodekeys(sym, uni);
|
gmodekeys(sym, uni);
|
||||||
if(uni == 'm' && canmove && (centerover == cwt ? mouseover : centerover.at))
|
if(uni == 'm' && canmove && (centerover == cwt.at ? mouseover : centerover))
|
||||||
performMarkCommand(mouseover);
|
performMarkCommand(mouseover);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -440,11 +440,12 @@ EX void handleKeyNormal(int sym, int uni) {
|
|||||||
if((sym == SDLK_DELETE || sym == SDLK_KP_PERIOD || sym == 'g') && uni != 'G' && uni != 'G'-64)
|
if((sym == SDLK_DELETE || sym == SDLK_KP_PERIOD || sym == 'g') && uni != 'G' && uni != 'G'-64)
|
||||||
movepcto(MD_DROP, 1);
|
movepcto(MD_DROP, 1);
|
||||||
if(sym == 't' && uni != 'T' && uni != 'T'-64 && canmove) {
|
if(sym == 't' && uni != 'T' && uni != 'T'-64 && canmove) {
|
||||||
|
cell *target = GDIM == 3 ? mouseover : centerover;
|
||||||
if(playermoved && items[itStrongWind]) {
|
if(playermoved && items[itStrongWind]) {
|
||||||
cell *c = whirlwind::jumpDestination(cwt.at);
|
cell *c = whirlwind::jumpDestination(cwt.at);
|
||||||
if(c) centerover.at = c;
|
if(c) target = c;
|
||||||
}
|
}
|
||||||
targetRangedOrb(GDIM == 3 ? mouseover : centerover.at, roKeyboard);
|
targetRangedOrb(target, roKeyboard);
|
||||||
sym = 0; uni = 0;
|
sym = 0; uni = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -562,7 +562,7 @@ struct hrmap_crystal : hrmap_standard {
|
|||||||
// for(int i=0; i<S6; i++) queuepoly(ggmatrix(cwt.at), shWall3D[i], 0xFF0000FF);
|
// for(int i=0; i<S6; i++) queuepoly(ggmatrix(cwt.at), shWall3D[i], 0xFF0000FF);
|
||||||
|
|
||||||
dq::visited_by_matrix.clear();
|
dq::visited_by_matrix.clear();
|
||||||
dq::enqueue_by_matrix(viewctr.at, cview());
|
dq::enqueue_by_matrix(centerover->master, cview());
|
||||||
|
|
||||||
while(!dq::drawqueue.empty()) {
|
while(!dq::drawqueue.empty()) {
|
||||||
auto& p = dq::drawqueue.front();
|
auto& p = dq::drawqueue.front();
|
||||||
|
@ -559,7 +559,7 @@ EX void viewall() {
|
|||||||
|
|
||||||
/** launch a debugging screen, and continue normal working only after this screen is closed */
|
/** launch a debugging screen, and continue normal working only after this screen is closed */
|
||||||
EX void modalDebug(cell *c) {
|
EX void modalDebug(cell *c) {
|
||||||
viewctr.at = c->master;
|
centerover = c; View = Id;
|
||||||
if(noGUI) {
|
if(noGUI) {
|
||||||
fprintf(stderr, "fatal: modalDebug called on %p without GUI\n", c);
|
fprintf(stderr, "fatal: modalDebug called on %p without GUI\n", c);
|
||||||
exit(1);
|
exit(1);
|
||||||
|
11
euclid.cpp
11
euclid.cpp
@ -681,7 +681,7 @@ EX namespace euclid3 {
|
|||||||
|
|
||||||
void draw() override {
|
void draw() override {
|
||||||
dq::visited_by_matrix.clear();
|
dq::visited_by_matrix.clear();
|
||||||
dq::enqueue_by_matrix(viewctr.at, cview());
|
dq::enqueue_by_matrix(centerover->master, cview());
|
||||||
|
|
||||||
while(!dq::drawqueue.empty()) {
|
while(!dq::drawqueue.empty()) {
|
||||||
auto& p = dq::drawqueue.front();
|
auto& p = dq::drawqueue.front();
|
||||||
@ -1220,10 +1220,9 @@ EX ld matrixnorm(const transmatrix& Mat) {
|
|||||||
void hrmap_euclid_any::draw() {
|
void hrmap_euclid_any::draw() {
|
||||||
DEBB(DF_GRAPH, ("drawEuclidean\n"));
|
DEBB(DF_GRAPH, ("drawEuclidean\n"));
|
||||||
sphereflip = Id;
|
sphereflip = Id;
|
||||||
if(!centerover.at) centerover = cwt;
|
|
||||||
// printf("centerover = %p player = %p [%d,%d]-[%d,%d]\n", lcenterover, cwt.c,
|
// printf("centerover = %p player = %p [%d,%d]-[%d,%d]\n", lcenterover, cwt.c,
|
||||||
// mindx, mindy, maxdx, maxdy);
|
// mindx, mindy, maxdx, maxdy);
|
||||||
int pvec = cellwalker_to_vec(centerover);
|
int pvec = cellwalker_to_vec(cellwalker(centerover));
|
||||||
|
|
||||||
typedef pair<int, int> euspot;
|
typedef pair<int, int> euspot;
|
||||||
|
|
||||||
@ -1232,7 +1231,6 @@ void hrmap_euclid_any::draw() {
|
|||||||
set<euspot> visited = {zero};
|
set<euspot> visited = {zero};
|
||||||
vector<euspot> dfs = {zero};
|
vector<euspot> dfs = {zero};
|
||||||
|
|
||||||
ld centerd = matrixnorm(View);
|
|
||||||
auto View0 = cview();
|
auto View0 = cview();
|
||||||
|
|
||||||
for(int i=0; i<isize(dfs); i++) {
|
for(int i=0; i<isize(dfs); i++) {
|
||||||
@ -1245,11 +1243,6 @@ void hrmap_euclid_any::draw() {
|
|||||||
torusconfig::torus_cx = dx;
|
torusconfig::torus_cx = dx;
|
||||||
torusconfig::torus_cy = dy;
|
torusconfig::torus_cy = dy;
|
||||||
|
|
||||||
if(true) {
|
|
||||||
ld locald = matrixnorm(Mat);
|
|
||||||
if(locald < centerd) centerd = locald, centerover = cw, View = inverse(actual_view_transform) * Mat;
|
|
||||||
}
|
|
||||||
|
|
||||||
if(do_draw(cw.at, Mat)) {
|
if(do_draw(cw.at, Mat)) {
|
||||||
drawcell(cw, cw.mirrored ? Mat * spin(-2*M_PI*cw.spin / cw.at->type) * Mirror : Mat);
|
drawcell(cw, cw.mirrored ? Mat * spin(-2*M_PI*cw.spin / cw.at->type) * Mirror : Mat);
|
||||||
for(int x=-1; x<=+1; x++)
|
for(int x=-1; x<=+1; x++)
|
||||||
|
2
game.cpp
2
game.cpp
@ -3062,7 +3062,7 @@ EX int pathlock = 0;
|
|||||||
|
|
||||||
EX void compute_graphical_distance() {
|
EX void compute_graphical_distance() {
|
||||||
if(pathlock) { printf("path error: compute_graphical_distance\n"); }
|
if(pathlock) { printf("path error: compute_graphical_distance\n"); }
|
||||||
cell *c1 = centerover.at ? centerover.at : pd_from ? pd_from : cwt.at;
|
cell *c1 = centerover ? centerover : pd_from ? pd_from : cwt.at;
|
||||||
int sr = get_sightrange_ambush();
|
int sr = get_sightrange_ambush();
|
||||||
if(pd_from == c1 && pd_range == sr) return;
|
if(pd_from == c1 && pd_range == sr) return;
|
||||||
clear_pathdata();
|
clear_pathdata();
|
||||||
|
@ -157,14 +157,14 @@ transmatrix hrmap_standard::relative_matrix(cell *c2, cell *c1, const hyperpoint
|
|||||||
EX transmatrix &ggmatrix(cell *c) {
|
EX transmatrix &ggmatrix(cell *c) {
|
||||||
transmatrix& t = gmatrix[c];
|
transmatrix& t = gmatrix[c];
|
||||||
if(t[LDIM][LDIM] == 0) {
|
if(t[LDIM][LDIM] == 0) {
|
||||||
if(euwrap && centerover.at && masterless)
|
if(euwrap && centerover && masterless)
|
||||||
t = calc_relative_matrix(c, centerover.at, C0);
|
t = calc_relative_matrix(c, centerover, C0);
|
||||||
else if(masterless && WDIM == 2) {
|
else if(masterless && WDIM == 2) {
|
||||||
if(!centerover.at) centerover = cwt;
|
if(!centerover) centerover = cwt.at;
|
||||||
t = View * eumove(cell_to_vec(c) - cellwalker_to_vec(centerover));
|
t = View * eumove(cell_to_vec(c) - cellwalker_to_vec(cellwalker(centerover)));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
t = actualV(viewctr, actual_view_transform * View) * calc_relative_matrix(c, viewcenter(), C0);
|
t = calc_relative_matrix(c, centerover, C0);
|
||||||
}
|
}
|
||||||
return t;
|
return t;
|
||||||
}
|
}
|
||||||
|
38
graph.cpp
38
graph.cpp
@ -815,7 +815,7 @@ EX bool drawItemType(eItem it, cell *c, const transmatrix& V, color_t icol, int
|
|||||||
|
|
||||||
if(GDIM == 3 && mapeditor::drawUserShape(V, mapeditor::sgItem, it, darkena(icol, 0, 0xFF), c)) return false;
|
if(GDIM == 3 && mapeditor::drawUserShape(V, mapeditor::sgItem, it, darkena(icol, 0, 0xFF), c)) return false;
|
||||||
|
|
||||||
if(WDIM == 3 && c == viewcenter() && in_perspective() && hdist0(tC0(V)) < cgi.orbsize * 0.25) return false;
|
if(WDIM == 3 && c == centerover && in_perspective() && hdist0(tC0(V)) < cgi.orbsize * 0.25) return false;
|
||||||
|
|
||||||
transmatrix Vit = V;
|
transmatrix Vit = V;
|
||||||
if(GDIM == 3 && WDIM == 2 && c && it != itBabyTortoise) Vit = mscale(V, cgi.STUFF);
|
if(GDIM == 3 && WDIM == 2 && c && it != itBabyTortoise) Vit = mscale(V, cgi.STUFF);
|
||||||
@ -4068,8 +4068,8 @@ EX void drawMarkers() {
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if CAP_QUEUE
|
#if CAP_QUEUE
|
||||||
if(centerover.at && !playermoved && m && !anims::any_animation() && WDIM == 2)
|
if(centerover && !playermoved && m && !anims::any_animation() && WDIM == 2)
|
||||||
queuecircleat(centerover.at, .70 - .06 * sintick(200),
|
queuecircleat(centerover, .70 - .06 * sintick(200),
|
||||||
darkena(int(175 + 25 * sintick(200)), 0, 0xFF));
|
darkena(int(175 + 25 * sintick(200)), 0, 0xFF));
|
||||||
|
|
||||||
if(multi::players > 1 || multi::alwaysuse) for(int i=0; i<numplayers(); i++) {
|
if(multi::players > 1 || multi::alwaysuse) for(int i=0; i<numplayers(); i++) {
|
||||||
@ -4311,8 +4311,8 @@ EX void make_actual_view() {
|
|||||||
if(GDIM == 3) {
|
if(GDIM == 3) {
|
||||||
ld max = WDIM == 2 ? vid.camera : vid.yshift;
|
ld max = WDIM == 2 ? vid.camera : vid.yshift;
|
||||||
if(max) {
|
if(max) {
|
||||||
transmatrix Start = inverse(actualV(viewctr, actual_view_transform * View));
|
transmatrix Start = inverse(actual_view_transform * View);
|
||||||
ld d = wall_radar(viewcenter(), Start, nisot::local_perspective, max);
|
ld d = wall_radar(centerover, Start, nisot::local_perspective, max);
|
||||||
actual_view_transform = get_shift_view_of(ztangent(d), actual_view_transform * View) * inverse(View);
|
actual_view_transform = get_shift_view_of(ztangent(d), actual_view_transform * View) * inverse(View);
|
||||||
}
|
}
|
||||||
camera_level = asin_auto(tC0(inverse(actual_view_transform * View))[2]);
|
camera_level = asin_auto(tC0(inverse(actual_view_transform * View))[2]);
|
||||||
@ -4349,7 +4349,7 @@ EX transmatrix cview() {
|
|||||||
|
|
||||||
EX void precise_mouseover() {
|
EX void precise_mouseover() {
|
||||||
if(WDIM == 3) {
|
if(WDIM == 3) {
|
||||||
mouseover2 = mouseover = viewcenter();
|
mouseover2 = mouseover = centerover;
|
||||||
ld best = HUGE_VAL;
|
ld best = HUGE_VAL;
|
||||||
hyperpoint h = direct_exp(lp_iapply(ztangent(0.01)), 100);
|
hyperpoint h = direct_exp(lp_iapply(ztangent(0.01)), 100);
|
||||||
|
|
||||||
@ -4481,9 +4481,6 @@ EX void drawthemap() {
|
|||||||
|
|
||||||
compute_graphical_distance();
|
compute_graphical_distance();
|
||||||
|
|
||||||
centdist = 1e20;
|
|
||||||
if(!masterless) centerover.at = NULL;
|
|
||||||
|
|
||||||
for(int i=0; i<multi::players; i++) {
|
for(int i=0; i<multi::players; i++) {
|
||||||
multi::ccdist[i] = 1e20; multi::ccat[i] = NULL;
|
multi::ccdist[i] = 1e20; multi::ccat[i] = NULL;
|
||||||
}
|
}
|
||||||
@ -4794,7 +4791,7 @@ EX void gamescreen(int _darken) {
|
|||||||
if(racing::on) return;
|
if(racing::on) return;
|
||||||
// create the gmatrix
|
// create the gmatrix
|
||||||
View = subscreens::player_displays[0].view_matrix;
|
View = subscreens::player_displays[0].view_matrix;
|
||||||
viewctr = subscreens::player_displays[0].view_center;
|
centerover = subscreens::player_displays[0].precise_center;
|
||||||
just_gmatrix = true;
|
just_gmatrix = true;
|
||||||
currentmap->draw();
|
currentmap->draw();
|
||||||
just_gmatrix = false;
|
just_gmatrix = false;
|
||||||
@ -5042,14 +5039,7 @@ EX void restartGraph() {
|
|||||||
View = Id;
|
View = Id;
|
||||||
if(!autocheat) linepatterns::clearAll();
|
if(!autocheat) linepatterns::clearAll();
|
||||||
if(currentmap) {
|
if(currentmap) {
|
||||||
if(masterless) {
|
centerover = currentmap->gamestart();
|
||||||
centerover = vec_to_cellwalker(0);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
viewctr.at = currentmap->getOrigin();
|
|
||||||
viewctr.spin = 0;
|
|
||||||
viewctr.mirrored = false;
|
|
||||||
}
|
|
||||||
if(sphere) View = spin(-M_PI/2);
|
if(sphere) View = spin(-M_PI/2);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -5062,7 +5052,7 @@ EX void clearAnimations() {
|
|||||||
|
|
||||||
auto graphcm = addHook(clearmemory, 0, [] () {
|
auto graphcm = addHook(clearmemory, 0, [] () {
|
||||||
DEBBI(DF_MEMORY, ("clear graph memory"));
|
DEBBI(DF_MEMORY, ("clear graph memory"));
|
||||||
mouseover = centerover.at = lmouseover = NULL;
|
mouseover = centerover = lmouseover = NULL;
|
||||||
gmatrix.clear(); gmatrix0.clear();
|
gmatrix.clear(); gmatrix0.clear();
|
||||||
clearAnimations();
|
clearAnimations();
|
||||||
})
|
})
|
||||||
@ -5197,18 +5187,12 @@ EX void drawBug(const cellwalker& cw, color_t col) {
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
EX cell *viewcenter() {
|
|
||||||
if(masterless) return centerover.at;
|
|
||||||
else if(hybri) return hybrid::get_at(viewctr.at->c7, hybrid::current_view_level);
|
|
||||||
else return viewctr.at->c7;
|
|
||||||
}
|
|
||||||
|
|
||||||
EX bool inscreenrange(cell *c) {
|
EX bool inscreenrange(cell *c) {
|
||||||
if(sphere) return true;
|
if(sphere) return true;
|
||||||
if(euclid) return celldistance(viewcenter(), c) <= get_sightrange_ambush();
|
if(euclid) return celldistance(centerover, c) <= get_sightrange_ambush();
|
||||||
if(nonisotropic) return gmatrix.count(c);
|
if(nonisotropic) return gmatrix.count(c);
|
||||||
if(geometry == gCrystal344) return gmatrix.count(c);
|
if(geometry == gCrystal344) return gmatrix.count(c);
|
||||||
return heptdistance(viewcenter(), c) <= 8;
|
return heptdistance(centerover, c) <= 8;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if MAXMDIM >= 4
|
#if MAXMDIM >= 4
|
||||||
|
2
help.cpp
2
help.cpp
@ -752,7 +752,7 @@ EX hookset<void(cell*)> *hooks_mouseover;
|
|||||||
EX void describeMouseover() {
|
EX void describeMouseover() {
|
||||||
DEBBI(DF_GRAPH, ("describeMouseover"));
|
DEBBI(DF_GRAPH, ("describeMouseover"));
|
||||||
|
|
||||||
cell *c = mousing ? mouseover : playermoved ? NULL : centerover.at;
|
cell *c = mousing ? mouseover : playermoved ? NULL : centerover;
|
||||||
string& out = mouseovers;
|
string& out = mouseovers;
|
||||||
if(!c || instat || getcstat != '-') { }
|
if(!c || instat || getcstat != '-') { }
|
||||||
else if(c->wall != waInvisibleFloor) {
|
else if(c->wall != waInvisibleFloor) {
|
||||||
|
17
history.cpp
17
history.cpp
@ -260,7 +260,7 @@ EX namespace history {
|
|||||||
}
|
}
|
||||||
|
|
||||||
EX void create_recenter_to_view(bool precise) {
|
EX void create_recenter_to_view(bool precise) {
|
||||||
cell *c = centerover.at ? centerover.at : cwt.at;
|
cell *c = centerover ? centerover : cwt.at;
|
||||||
create(path_for_lineanimation[0], c, precise ? inverse(ggmatrix(c)) : Id);
|
create(path_for_lineanimation[0], c, precise ? inverse(ggmatrix(c)) : Id);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -271,10 +271,9 @@ EX namespace history {
|
|||||||
if(ph<0) ph = 0;
|
if(ph<0) ph = 0;
|
||||||
if(ph >= siz-1) ph = siz-2;
|
if(ph >= siz-1) ph = siz-2;
|
||||||
|
|
||||||
heptagon *old = viewctr.at;
|
cell *old = centerover;
|
||||||
|
|
||||||
viewctr.at = v[ph]->base->master;
|
centerover = v[ph]->base;
|
||||||
viewctr.spin = 0;
|
|
||||||
|
|
||||||
ld angle = 0;
|
ld angle = 0;
|
||||||
if(WDIM == 3) {
|
if(WDIM == 3) {
|
||||||
@ -294,8 +293,8 @@ EX namespace history {
|
|||||||
View = models::rotmatrix() * View;
|
View = models::rotmatrix() * View;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
if(celldistance(v[ph]->base, old->c7) <= 2) {
|
if(celldistance(v[ph]->base, old) <= 2) {
|
||||||
hyperpoint h1 = View * currentmap->relative_matrix(old, viewctr.at) * hpxy3(1,2,3);
|
hyperpoint h1 = View * currentmap->relative_matrix(old, centerover, C0) * hpxy3(1,2,3);
|
||||||
ld angle1 = atan2(h1[1], h1[2]);
|
ld angle1 = atan2(h1[1], h1[2]);
|
||||||
View = cspin(2, 1, angle1 - angle) * View;
|
View = cspin(2, 1, angle1 - angle) * View;
|
||||||
}
|
}
|
||||||
@ -303,7 +302,7 @@ EX namespace history {
|
|||||||
}
|
}
|
||||||
|
|
||||||
playermoved = false;
|
playermoved = false;
|
||||||
centerover.at = v[ph]->base;
|
centerover = v[ph]->base;
|
||||||
compute_graphical_distance();
|
compute_graphical_distance();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -445,8 +444,8 @@ EX namespace history {
|
|||||||
xpos += bwidth;
|
xpos += bwidth;
|
||||||
}
|
}
|
||||||
|
|
||||||
last_base = viewcenter();
|
last_base = centerover;
|
||||||
last_relative = inverse(ggmatrix(last_base)) * C0;
|
last_relative = C0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
141
hypgraph.cpp
141
hypgraph.cpp
@ -1164,7 +1164,7 @@ void hrmap_standard::draw() {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
drawn_cells.clear();
|
drawn_cells.clear();
|
||||||
drawn_cells.emplace_back(viewctr, hsOrigin, cview(), band_shift);
|
drawn_cells.emplace_back(centerover->master, hsOrigin, cview() * master_relative(centerover, true), band_shift);
|
||||||
for(int i=0; i<isize(drawn_cells); i++) {
|
for(int i=0; i<isize(drawn_cells); i++) {
|
||||||
// prevent reallocation due to insertion
|
// prevent reallocation due to insertion
|
||||||
if(drawn_cells.capacity() < drawn_cells.size() + 16)
|
if(drawn_cells.capacity() < drawn_cells.size() + 16)
|
||||||
@ -1364,19 +1364,8 @@ EX void centerpc(ld aspd) {
|
|||||||
if(shmup::on && vid.sspeed > -5 && GDIM == 3) {
|
if(shmup::on && vid.sspeed > -5 && GDIM == 3) {
|
||||||
int id = subscreens::in ? subscreens::current_player : 0;
|
int id = subscreens::in ? subscreens::current_player : 0;
|
||||||
auto& pc = shmup::pc[id];
|
auto& pc = shmup::pc[id];
|
||||||
if(masterless) centerover = pc->base;
|
centerover = pc->base;
|
||||||
else viewctr = pc->base->master;
|
|
||||||
transmatrix T = pc->at;
|
transmatrix T = pc->at;
|
||||||
if(hybri) {
|
|
||||||
hybrid::current_view_level = hybrid::get_where(pc->base).second;
|
|
||||||
cell *cc = hybrid::get_at(viewctr.at->c7, hybrid::current_view_level);
|
|
||||||
T = currentmap->relative_matrix(pc->base, cc, C0) * T;
|
|
||||||
}
|
|
||||||
if(WDIM == 2 && !masterless) T = master_relative(pc->base) * T;
|
|
||||||
if(prod) {
|
|
||||||
cell *c = hybrid::get_where(pc->base).first;
|
|
||||||
T = PIU(master_relative(c)) * T;
|
|
||||||
}
|
|
||||||
int sl = snakelevel(cwt.at);
|
int sl = snakelevel(cwt.at);
|
||||||
if(sl && WDIM == 2) T = T * zpush(cgi.SLEV[sl] - cgi.FLOOR);
|
if(sl && WDIM == 2) T = T * zpush(cgi.SLEV[sl] - cgi.FLOOR);
|
||||||
View = inverse(T);
|
View = inverse(T);
|
||||||
@ -1444,124 +1433,18 @@ EX void optimizeview() {
|
|||||||
|
|
||||||
if(subscreens::split(optimizeview)) return;
|
if(subscreens::split(optimizeview)) return;
|
||||||
if(dual::split(optimizeview)) return;
|
if(dual::split(optimizeview)) return;
|
||||||
|
|
||||||
|
transmatrix iView = inverse(View);
|
||||||
|
virtualRebase(centerover, iView, true);
|
||||||
|
View = inverse(iView);
|
||||||
|
|
||||||
|
println(hlog, "centerover = ", centerover);
|
||||||
|
|
||||||
if(hybri && !prod) {
|
|
||||||
cell *c = viewcenter();
|
|
||||||
cell *cbest = NULL;
|
|
||||||
ld best = hdist0(tC0(gmatrix[c]));
|
|
||||||
if(isnan(best)) return;
|
|
||||||
forCellIdEx(c2, i2, c) {
|
|
||||||
if(!gmatrix.count(c2)) return;
|
|
||||||
if(PURE || i2 >= c->type-2) {
|
|
||||||
ld quality = hdist0(tC0(gmatrix[c2]));
|
|
||||||
if(quality < best) best = quality, cbest = c2;
|
|
||||||
}
|
|
||||||
else forCellIdEx(c3, i3, c2) if(i3%2 == 0 && i3 < c2->type-2 && gmatrix.count(c3)) {
|
|
||||||
// cell *w = hybrid::get_where(c3).first;
|
|
||||||
// assert (w->master->c7 != w)
|
|
||||||
ld quality = hdist0(tC0(gmatrix[c3]));
|
|
||||||
if(quality < best) best = quality, cbest = c3;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if(cbest) {
|
|
||||||
View = View * currentmap->relative_matrix(cbest, c, C0);
|
|
||||||
viewctr.at = cbest->master;
|
|
||||||
hybrid::current_view_level = hybrid::get_where(cbest).second;
|
|
||||||
}
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if(prod) {
|
|
||||||
ld z = zlevel(tC0(View));
|
|
||||||
View = mscale(View, -z);
|
|
||||||
if(in_s2xe()) View = centralsym * View;
|
|
||||||
hybrid::in_underlying_map(optimizeview);
|
|
||||||
if(in_s2xe()) View = centralsym * View;
|
|
||||||
if(z > cgi.plevel / 2) { hybrid::current_view_level--; z -= cgi.plevel; }
|
|
||||||
if(z < -cgi.plevel / 2) { hybrid::current_view_level++; z += cgi.plevel; }
|
|
||||||
View = mscale(View, z);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
#if CAP_ANIMATIONS
|
#if CAP_ANIMATIONS
|
||||||
if(centerover.at && inmirror(centerover.at)) {
|
if(centerover && inmirror(centerover)) {
|
||||||
anims::reflect_view();
|
anims::reflect_view();
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
DEBBI(DF_GRAPH, ("optimize view"));
|
|
||||||
int turn = 0;
|
|
||||||
ld best = INF;
|
|
||||||
|
|
||||||
transmatrix TB = Id;
|
|
||||||
|
|
||||||
if(WDIM == 3 && (cgflags & qIDEAL)) {
|
|
||||||
if(gmatrix.count(centerover.at)) {
|
|
||||||
ld last = hdist0(tC0(Viewbase));
|
|
||||||
transmatrix V = gmatrix[centerover.at];
|
|
||||||
ld next = hdist0(tC0(V));
|
|
||||||
if(next < last) {
|
|
||||||
View = View * inverse(Viewbase) * V;
|
|
||||||
fixmatrix(View);
|
|
||||||
viewctr.at = centerover.at->master;
|
|
||||||
viewctr.spin = 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if(false) ;
|
|
||||||
|
|
||||||
#if CAP_BT || CAP_ARCM || MAXMDIM == 4
|
|
||||||
else if(binarytiling || archimedean || penrose || WDIM == 3) {
|
|
||||||
turn = -1, best = hdist0(tC0(View));
|
|
||||||
if(asonov::in()) {
|
|
||||||
hyperpoint h = asonov::straighten * tC0(View);
|
|
||||||
best = abs(h[2]) > 1 ? 999 : hdist0(h);
|
|
||||||
}
|
|
||||||
for(int i=0; i<viewctr.at->type; i++) {
|
|
||||||
if(penrose && euclid && (i < 4 || i >= 8)) continue;
|
|
||||||
int i1 = i * DUALMUL;
|
|
||||||
heptagon *h2 = createStep(viewctr.at, i1);
|
|
||||||
transmatrix T =
|
|
||||||
asonov::in() ? asonov::adjmatrix(i) :
|
|
||||||
nil ? nilv::adjmatrix(i) :
|
|
||||||
currentmap->relative_matrix(h2, viewctr.at);
|
|
||||||
#if MAXMDIM >= 4
|
|
||||||
if(euclid && WDIM == 3)
|
|
||||||
T = euclid3::move_matrix(viewctr.at->c7, i);
|
|
||||||
#endif
|
|
||||||
hyperpoint H = View * tC0(T);
|
|
||||||
if(asonov::in()) {
|
|
||||||
H = asonov::straighten * H;
|
|
||||||
if(abs(H[2]) > 1) continue;
|
|
||||||
}
|
|
||||||
ld quality = hdist0(H);
|
|
||||||
if(quality < best) best = quality, turn = i1, TB = T;
|
|
||||||
}
|
|
||||||
if(turn >= 0) {
|
|
||||||
View = View * TB;
|
|
||||||
fixmatrix(View);
|
|
||||||
viewctr.at = createStep(viewctr.at, turn);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
else {
|
|
||||||
|
|
||||||
for(int i=-1; i<S7; i++) {
|
|
||||||
|
|
||||||
ld trot = -i * M_PI * 2 / (S7+.0);
|
|
||||||
transmatrix T = i < 0 ? Id : spin(trot) * xpush(cgi.tessf) * pispin;
|
|
||||||
hyperpoint H = View * tC0(T);
|
|
||||||
if(H[LDIM] < best) best = H[LDIM], turn = i, TB = T;
|
|
||||||
}
|
|
||||||
|
|
||||||
if(turn >= 0) {
|
|
||||||
View = View * TB;
|
|
||||||
fixmatrix(View);
|
|
||||||
viewctr = viewctr + turn + wstep;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void addball(ld a, ld b, ld c) {
|
void addball(ld a, ld b, ld c) {
|
||||||
@ -1592,13 +1475,9 @@ EX void resetview() {
|
|||||||
DEBBI(DF_GRAPH, ("reset view"));
|
DEBBI(DF_GRAPH, ("reset view"));
|
||||||
View = models::rotmatrix();
|
View = models::rotmatrix();
|
||||||
// EUCLIDEAN
|
// EUCLIDEAN
|
||||||
if(!masterless)
|
centerover = cwt.at;
|
||||||
viewctr.at = cwt.at->master,
|
|
||||||
viewctr.spin = cwt.spin;
|
|
||||||
else centerover = cwt;
|
|
||||||
cwtV = View;
|
cwtV = View;
|
||||||
nisot::local_perspective = Id;
|
nisot::local_perspective = Id;
|
||||||
if(hybri) hybrid::current_view_level = hybrid::get_where(cwt.at).second;
|
|
||||||
// SDL_LockSurface(s);
|
// SDL_LockSurface(s);
|
||||||
// SDL_UnlockSurface(s);
|
// SDL_UnlockSurface(s);
|
||||||
}
|
}
|
||||||
|
@ -112,7 +112,7 @@ void handleclick(MOBPAR_FORMAL) {
|
|||||||
ors::reset();
|
ors::reset();
|
||||||
centerpc(INF);
|
centerpc(INF);
|
||||||
View = Id;
|
View = Id;
|
||||||
viewctr.at = cwt.at->master;
|
centerover = cwt.at->master;
|
||||||
}
|
}
|
||||||
andmode = 11;
|
andmode = 11;
|
||||||
}
|
}
|
||||||
@ -151,7 +151,7 @@ void handleclick(MOBPAR_FORMAL) {
|
|||||||
if(!playerfound) {
|
if(!playerfound) {
|
||||||
centerpc(INF);
|
centerpc(INF);
|
||||||
View = Id;
|
View = Id;
|
||||||
viewctr.at = cwt.at->master;
|
centerover = cwt.at->master;
|
||||||
}
|
}
|
||||||
playermoved = true;
|
playermoved = true;
|
||||||
}
|
}
|
||||||
|
@ -191,9 +191,9 @@ EX namespace models {
|
|||||||
spiral_multiplier = cld(0, 2 * M_PI) / cld(h[0], h[1]);
|
spiral_multiplier = cld(0, 2 * M_PI) / cld(h[0], h[1]);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(centerover.at && !history::on)
|
if(centerover && !history::on)
|
||||||
if(isize(history::path_for_lineanimation) == 0 || (quotient && history::path_for_lineanimation.back() != centerover.at)) {
|
if(isize(history::path_for_lineanimation) == 0 || (quotient && history::path_for_lineanimation.back() != centerover)) {
|
||||||
history::path_for_lineanimation.push_back(centerover.at);
|
history::path_for_lineanimation.push_back(centerover);
|
||||||
}
|
}
|
||||||
|
|
||||||
band_shift = 0;
|
band_shift = 0;
|
||||||
|
@ -670,8 +670,6 @@ EX namespace netgen {
|
|||||||
}
|
}
|
||||||
if(!created) {
|
if(!created) {
|
||||||
View = Id;
|
View = Id;
|
||||||
if(centerover.at) viewctr.at = centerover.at->master;
|
|
||||||
else viewctr.at = cwt.at->master;
|
|
||||||
playermoved = false;
|
playermoved = false;
|
||||||
dataFromHR();
|
dataFromHR();
|
||||||
designNet();
|
designNet();
|
||||||
@ -686,8 +684,6 @@ EX namespace netgen {
|
|||||||
}
|
}
|
||||||
if(uni == 's') {
|
if(uni == 's') {
|
||||||
View = Id;
|
View = Id;
|
||||||
if(centerover.at) viewctr.at = centerover.at->master;
|
|
||||||
else viewctr.at = cwt.at->master;
|
|
||||||
playermoved = false;
|
playermoved = false;
|
||||||
}
|
}
|
||||||
else if(uni == 'c') {
|
else if(uni == 'c') {
|
||||||
|
@ -383,7 +383,7 @@ EX namespace solnihv {
|
|||||||
void draw() override {
|
void draw() override {
|
||||||
dq::visited.clear();
|
dq::visited.clear();
|
||||||
|
|
||||||
dq::enqueue(viewctr.at, cview());
|
dq::enqueue(centerover->master, cview());
|
||||||
|
|
||||||
while(!dq::drawqueue.empty()) {
|
while(!dq::drawqueue.empty()) {
|
||||||
auto& p = dq::drawqueue.front();
|
auto& p = dq::drawqueue.front();
|
||||||
@ -829,7 +829,7 @@ EX namespace nilv {
|
|||||||
void draw() override {
|
void draw() override {
|
||||||
dq::visited_by_matrix.clear();
|
dq::visited_by_matrix.clear();
|
||||||
|
|
||||||
dq::enqueue_by_matrix(viewctr.at, cview());
|
dq::enqueue_by_matrix(centerover->master, cview());
|
||||||
|
|
||||||
while(!dq::drawqueue.empty()) {
|
while(!dq::drawqueue.empty()) {
|
||||||
auto& p = dq::drawqueue.front();
|
auto& p = dq::drawqueue.front();
|
||||||
@ -939,7 +939,6 @@ EX bool in_h2xe() { return prod && !hybrid::over_sphere(); }
|
|||||||
|
|
||||||
EX namespace hybrid {
|
EX namespace hybrid {
|
||||||
|
|
||||||
EX int current_view_level;
|
|
||||||
EX eGeometry underlying;
|
EX eGeometry underlying;
|
||||||
EX geometry_information *underlying_cgip;
|
EX geometry_information *underlying_cgip;
|
||||||
|
|
||||||
@ -1154,7 +1153,7 @@ EX namespace hybrid {
|
|||||||
}
|
}
|
||||||
|
|
||||||
EX bool do_draw(cell *c, const transmatrix& T) {
|
EX bool do_draw(cell *c, const transmatrix& T) {
|
||||||
return in_actual([&] { return hr::do_draw(hybrid::get_at(c, hybrid::current_view_level), T); });
|
return in_actual([&] { return hr::do_draw(hybrid::get_at(c, get_where(centerover).second), T); });
|
||||||
}
|
}
|
||||||
|
|
||||||
EX }
|
EX }
|
||||||
@ -1167,7 +1166,7 @@ EX namespace product {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void draw() override {
|
void draw() override {
|
||||||
actual_view_level = hybrid::current_view_level - floor(zlevel(tC0(cview())) / cgi.plevel + .5);
|
actual_view_level = hybrid::get_where(centerover).second - floor(zlevel(tC0(cview())) / cgi.plevel + .5);
|
||||||
in_underlying([] { currentmap->draw(); });
|
in_underlying([] { currentmap->draw(); });
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@ -1178,8 +1177,9 @@ EX namespace product {
|
|||||||
cell *c = cw.at;
|
cell *c = cw.at;
|
||||||
if(sphere) gmatrix[c] = V; /* some computations need gmatrix0 for underlying geometry */
|
if(sphere) gmatrix[c] = V; /* some computations need gmatrix0 for underlying geometry */
|
||||||
bool s = sphere || pmodel != mdPerspective;
|
bool s = sphere || pmodel != mdPerspective;
|
||||||
|
int z0 = hybrid::get_where(centerover).second;
|
||||||
hybrid::in_actual([&] {
|
hybrid::in_actual([&] {
|
||||||
cell *c0 = hybrid::get_at(c, hybrid::current_view_level);
|
cell *c0 = hybrid::get_at(c, z0);
|
||||||
cwall_offset = hybrid::wall_offset(c0);
|
cwall_offset = hybrid::wall_offset(c0);
|
||||||
if(s) cwall_mask = (1<<c->type) - 1;
|
if(s) cwall_mask = (1<<c->type) - 1;
|
||||||
else {
|
else {
|
||||||
@ -1199,7 +1199,7 @@ EX namespace product {
|
|||||||
cell *c1 = hybrid::get_at(c, actual_view_level+z);
|
cell *c1 = hybrid::get_at(c, actual_view_level+z);
|
||||||
setdist(c1, 7, NULL);
|
setdist(c1, 7, NULL);
|
||||||
cw.at = c1;
|
cw.at = c1;
|
||||||
drawcell(cw, V * mscale(Id, cgi.plevel * (z+actual_view_level - hybrid::current_view_level)));
|
drawcell(cw, V * mscale(Id, cgi.plevel * (z+actual_view_level - z0)));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -1579,7 +1579,7 @@ EX namespace rots {
|
|||||||
void draw() override {
|
void draw() override {
|
||||||
set<cell*> visited;
|
set<cell*> visited;
|
||||||
|
|
||||||
cell* start = viewcenter();
|
cell* start = centerover;
|
||||||
vector<pair<cell*, transmatrix>> dq;
|
vector<pair<cell*, transmatrix>> dq;
|
||||||
|
|
||||||
visited.insert(start);
|
visited.insert(start);
|
||||||
@ -1654,7 +1654,7 @@ EX namespace rots {
|
|||||||
|
|
||||||
EX void draw_underlying(bool cornermode) {
|
EX void draw_underlying(bool cornermode) {
|
||||||
if(underlying_scale <= 0) return;
|
if(underlying_scale <= 0) return;
|
||||||
ld d = hybrid::current_view_level;
|
ld d = hybrid::get_where(centerover).second;
|
||||||
d *= cgi.plevel;
|
d *= cgi.plevel;
|
||||||
transmatrix T = rots::uzpush(-d) * spin(-2*d);
|
transmatrix T = rots::uzpush(-d) * spin(-2*d);
|
||||||
|
|
||||||
@ -1674,12 +1674,14 @@ EX namespace rots {
|
|||||||
ld z = zlevel(tC0(View));
|
ld z = zlevel(tC0(View));
|
||||||
for(int a=0; a<3; a++) pView[a] *= exp(-z);
|
for(int a=0; a<3; a++) pView[a] *= exp(-z);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
cell *co = hybrid::get_where(centerover).first;
|
||||||
|
|
||||||
hybrid::in_underlying_map([&] {
|
hybrid::in_underlying_map([&] {
|
||||||
cgi.require_shapes();
|
cgi.require_shapes();
|
||||||
dynamicval<int> pcc(corner_centering, cornermode ? 1 : 2);
|
dynamicval<int> pcc(corner_centering, cornermode ? 1 : 2);
|
||||||
dynamicval<bool> pf(playerfound, true);
|
dynamicval<bool> pf(playerfound, true);
|
||||||
dynamicval<cellwalker> m5(centerover, viewctr.at->c7);
|
dynamicval<cell*> m5(centerover, co);
|
||||||
dynamicval<transmatrix> m2(View, inprod ? pView : ypush(0) * qtm(h));
|
dynamicval<transmatrix> m2(View, inprod ? pView : ypush(0) * qtm(h));
|
||||||
dynamicval<transmatrix> m3(playerV, Id);
|
dynamicval<transmatrix> m3(playerV, Id);
|
||||||
dynamicval<transmatrix> m4(actual_view_transform, Id);
|
dynamicval<transmatrix> m4(actual_view_transform, Id);
|
||||||
|
@ -340,7 +340,7 @@ struct hrmap_kite : hrmap {
|
|||||||
void draw() override {
|
void draw() override {
|
||||||
|
|
||||||
dq::visited.clear();
|
dq::visited.clear();
|
||||||
dq::enqueue(viewctr.at, cview());
|
dq::enqueue(centerover->master, cview());
|
||||||
|
|
||||||
while(!dq::drawqueue.empty()) {
|
while(!dq::drawqueue.empty()) {
|
||||||
auto& p = dq::drawqueue.front();
|
auto& p = dq::drawqueue.front();
|
||||||
|
@ -814,11 +814,10 @@ EX void cast() {
|
|||||||
|
|
||||||
vector<cell*> lst;
|
vector<cell*> lst;
|
||||||
|
|
||||||
cell *cs = viewcenter();
|
cell *cs = centerover;
|
||||||
|
|
||||||
transmatrix T = cview();
|
transmatrix T = cview();
|
||||||
if(nonisotropic) T = nisot::local_perspective * T;
|
if(nonisotropic) T = nisot::local_perspective * T;
|
||||||
if(prod) T = actualV(viewctr, T);
|
|
||||||
T = inverse(T);
|
T = inverse(T);
|
||||||
|
|
||||||
virtualRebase(cs, T, true);
|
virtualRebase(cs, T, true);
|
||||||
|
4
reg3.cpp
4
reg3.cpp
@ -551,7 +551,7 @@ EX namespace reg3 {
|
|||||||
// for(int i=0; i<S6; i++) queuepoly(ggmatrix(cwt.at), shWall3D[i], 0xFF0000FF);
|
// for(int i=0; i<S6; i++) queuepoly(ggmatrix(cwt.at), shWall3D[i], 0xFF0000FF);
|
||||||
|
|
||||||
dq::visited_by_matrix.clear();
|
dq::visited_by_matrix.clear();
|
||||||
dq::enqueue_by_matrix(viewctr.at, cview());
|
dq::enqueue_by_matrix(centerover->master, cview());
|
||||||
|
|
||||||
while(!dq::drawqueue.empty()) {
|
while(!dq::drawqueue.empty()) {
|
||||||
auto& p = dq::drawqueue.front();
|
auto& p = dq::drawqueue.front();
|
||||||
@ -844,7 +844,7 @@ EX namespace reg3 {
|
|||||||
// for(int i=0; i<S6; i++) queuepoly(ggmatrix(cwt.at), shWall3D[i], 0xFF0000FF);
|
// for(int i=0; i<S6; i++) queuepoly(ggmatrix(cwt.at), shWall3D[i], 0xFF0000FF);
|
||||||
|
|
||||||
dq::visited.clear();
|
dq::visited.clear();
|
||||||
dq::enqueue(viewctr.at, cview());
|
dq::enqueue(centerover->master, cview());
|
||||||
|
|
||||||
while(!dq::drawqueue.empty()) {
|
while(!dq::drawqueue.empty()) {
|
||||||
auto& p = dq::drawqueue.front();
|
auto& p = dq::drawqueue.front();
|
||||||
|
2
rug.cpp
2
rug.cpp
@ -676,7 +676,7 @@ EX void buildRug() {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
celllister cl(centerover.at ? centerover.at : cwt.at, get_sightrange(), vertex_limit, NULL);
|
celllister cl(centerover ? centerover : cwt.at, get_sightrange(), vertex_limit, NULL);
|
||||||
|
|
||||||
map<cell*, rugpoint *> vptr;
|
map<cell*, rugpoint *> vptr;
|
||||||
|
|
||||||
|
@ -514,8 +514,7 @@ EX ld rug_rotation1, rug_rotation2, ballangle_rotation, env_ocean, env_volcano;
|
|||||||
EX bool env_shmup;
|
EX bool env_shmup;
|
||||||
EX ld rug_angle;
|
EX ld rug_angle;
|
||||||
|
|
||||||
heptspin rotation_center_h;
|
cell *rotation_center;
|
||||||
cellwalker rotation_center_c;
|
|
||||||
transmatrix rotation_center_View;
|
transmatrix rotation_center_View;
|
||||||
|
|
||||||
color_t circle_display_color = 0x00FF00FF;
|
color_t circle_display_color = 0x00FF00FF;
|
||||||
@ -526,17 +525,17 @@ EX ld circle_spins = 1;
|
|||||||
void moved() {
|
void moved() {
|
||||||
optimizeview();
|
optimizeview();
|
||||||
if(cheater || autocheat) {
|
if(cheater || autocheat) {
|
||||||
if(hyperbolic && memory_saving_mode && centerover.at && gmatrix.size() && cwt.at != centerover.at && !quotient) {
|
if(hyperbolic && memory_saving_mode && centerover && gmatrix.size() && cwt.at != centerover && !quotient) {
|
||||||
if(isNeighbor(cwt.at, centerover.at)) {
|
if(isNeighbor(cwt.at, centerover)) {
|
||||||
cwt.spin = neighborId(centerover.at, cwt.at);
|
cwt.spin = neighborId(centerover, cwt.at);
|
||||||
flipplayer = true;
|
flipplayer = true;
|
||||||
}
|
}
|
||||||
animateMovement(cwt.at, centerover.at, LAYER_SMALL, NODIR);
|
animateMovement(cwt.at, centerover, LAYER_SMALL, NODIR);
|
||||||
cwt.at = centerover.at;
|
cwt.at = centerover;
|
||||||
save_memory();
|
save_memory();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
setdist(viewcenter(), 7 - getDistLimit() - genrange_bonus, NULL);
|
setdist(centerover, 7 - getDistLimit() - genrange_bonus, NULL);
|
||||||
}
|
}
|
||||||
playermoved = false;
|
playermoved = false;
|
||||||
}
|
}
|
||||||
@ -587,10 +586,10 @@ bool needs_highqual;
|
|||||||
bool joukowsky_anim;
|
bool joukowsky_anim;
|
||||||
|
|
||||||
EX void reflect_view() {
|
EX void reflect_view() {
|
||||||
if(centerover.at) {
|
if(centerover) {
|
||||||
transmatrix T = Id;
|
transmatrix T = Id;
|
||||||
cell *mbase = centerover.at;
|
cell *mbase = centerover;
|
||||||
cell *c = centerover.at;
|
cell *c = centerover;
|
||||||
if(shmup::reflect(c, mbase, T))
|
if(shmup::reflect(c, mbase, T))
|
||||||
View = inverse(T) * View;
|
View = inverse(T) * View;
|
||||||
}
|
}
|
||||||
@ -608,10 +607,10 @@ EX void apply() {
|
|||||||
history::phase = (isize(history::v) - 1) * ticks * 1. / period;
|
history::phase = (isize(history::v) - 1) * ticks * 1. / period;
|
||||||
history::movetophase();
|
history::movetophase();
|
||||||
}
|
}
|
||||||
else if(centerover.at) {
|
else if(centerover) {
|
||||||
reflect_view();
|
reflect_view();
|
||||||
if((hyperbolic && !quotient &&
|
if((hyperbolic && !quotient &&
|
||||||
(centerover.at->land != cwt.at->land || memory_saving_mode) && among(centerover.at->land, laHaunted, laIvoryTower, laDungeon, laEndorian) && centerover.at->landparam >= 10
|
(centerover->land != cwt.at->land || memory_saving_mode) && among(centerover->land, laHaunted, laIvoryTower, laDungeon, laEndorian) && centerover->landparam >= 10
|
||||||
) ) {
|
) ) {
|
||||||
if(memory_saving_mode) {
|
if(memory_saving_mode) {
|
||||||
activateSafety(laIce);
|
activateSafety(laIce);
|
||||||
@ -626,8 +625,8 @@ EX void apply() {
|
|||||||
);
|
);
|
||||||
moved();
|
moved();
|
||||||
if(clearup) {
|
if(clearup) {
|
||||||
viewcenter()->wall = waNone;
|
centerover->wall = waNone;
|
||||||
forCellEx(c1, viewcenter()) c1->wall = waNone;
|
forCellEx(c1, centerover) c1->wall = waNone;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@ -651,7 +650,7 @@ EX void apply() {
|
|||||||
moved();
|
moved();
|
||||||
rotate_view(cspin(0, GDIM-1, 2 * M_PI * t / period));
|
rotate_view(cspin(0, GDIM-1, 2 * M_PI * t / period));
|
||||||
if(clearup) {
|
if(clearup) {
|
||||||
viewcenter()->wall = waNone;
|
centerover->wall = waNone;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@ -668,8 +667,7 @@ EX void apply() {
|
|||||||
break;
|
break;
|
||||||
#endif
|
#endif
|
||||||
case maCircle: {
|
case maCircle: {
|
||||||
if(masterless) centerover = rotation_center_c;
|
centerover = rotation_center;
|
||||||
else viewctr = rotation_center_h;
|
|
||||||
ld alpha = circle_spins * 2 * M_PI * ticks / period;
|
ld alpha = circle_spins * 2 * M_PI * ticks / period;
|
||||||
View = spin(-cos_auto(circle_radius)*alpha) * xpush(circle_radius) * spin(alpha) * rotation_center_View;
|
View = spin(-cos_auto(circle_radius)*alpha) * xpush(circle_radius) * spin(alpha) * rotation_center_View;
|
||||||
moved();
|
moved();
|
||||||
@ -769,13 +767,13 @@ bool record_animation() {
|
|||||||
void display_animation() {
|
void display_animation() {
|
||||||
if(ma == maCircle && (circle_display_color & 0xFF)) {
|
if(ma == maCircle && (circle_display_color & 0xFF)) {
|
||||||
for(int s=0; s<10; s++) {
|
for(int s=0; s<10; s++) {
|
||||||
if(s == 0) curvepoint(ggmatrix(rotation_center_c.at) * xpush0(circle_radius - .1));
|
if(s == 0) curvepoint(ggmatrix(rotation_center) * xpush0(circle_radius - .1));
|
||||||
for(int z=0; z<100; z++) curvepoint(ggmatrix(rotation_center_c.at) * xspinpush0((z+s*100) * 2 * M_PI / 1000., circle_radius));
|
for(int z=0; z<100; z++) curvepoint(ggmatrix(rotation_center) * xspinpush0((z+s*100) * 2 * M_PI / 1000., circle_radius));
|
||||||
queuecurve(circle_display_color, 0, PPR::LINE);
|
queuecurve(circle_display_color, 0, PPR::LINE);
|
||||||
}
|
}
|
||||||
if(sphere) for(int s=0; s<10; s++) {
|
if(sphere) for(int s=0; s<10; s++) {
|
||||||
if(s == 0) curvepoint(centralsym * ggmatrix(rotation_center_c.at) * xpush0(circle_radius - .1));
|
if(s == 0) curvepoint(centralsym * ggmatrix(rotation_center) * xpush0(circle_radius - .1));
|
||||||
for(int z=0; z<100; z++) curvepoint(centralsym * ggmatrix(rotation_center_c.at) * xspinpush0((z+s*100) * 2 * M_PI / 1000., circle_radius));
|
for(int z=0; z<100; z++) curvepoint(centralsym * ggmatrix(rotation_center) * xspinpush0((z+s*100) * 2 * M_PI / 1000., circle_radius));
|
||||||
queuecurve(circle_display_color, 0, PPR::LINE);
|
queuecurve(circle_display_color, 0, PPR::LINE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -861,8 +859,7 @@ EX void show() {
|
|||||||
if(!prod) {
|
if(!prod) {
|
||||||
dialog::addBoolItem(XLAT("circle"), ma == maCircle, '4');
|
dialog::addBoolItem(XLAT("circle"), ma == maCircle, '4');
|
||||||
dialog::add_action([] () { ma = maCircle;
|
dialog::add_action([] () { ma = maCircle;
|
||||||
rotation_center_h = viewctr;
|
rotation_center = centerover;
|
||||||
rotation_center_c = centerover;
|
|
||||||
rotation_center_View = View;
|
rotation_center_View = View;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -1045,8 +1042,7 @@ int readArgs() {
|
|||||||
else if(argis("-animcircle")) {
|
else if(argis("-animcircle")) {
|
||||||
PHASE(3); start_game();
|
PHASE(3); start_game();
|
||||||
ma = maCircle;
|
ma = maCircle;
|
||||||
rotation_center_h = viewctr;
|
rotation_center = centerover;
|
||||||
rotation_center_c = cwt.at;
|
|
||||||
rotation_center_View = View;
|
rotation_center_View = View;
|
||||||
shift_arg_formula(circle_spins);
|
shift_arg_formula(circle_spins);
|
||||||
shift_arg_formula(circle_radius);
|
shift_arg_formula(circle_radius);
|
||||||
|
@ -16,7 +16,7 @@ EX int musicvolume = 60;
|
|||||||
EX int effvolume = 60;
|
EX int effvolume = 60;
|
||||||
|
|
||||||
EX eLand getCurrentLandForMusic() {
|
EX eLand getCurrentLandForMusic() {
|
||||||
eLand id = ((anims::center_music()) && centerover.at) ? centerover.at->land : cwt.at->land;
|
eLand id = ((anims::center_music()) && centerover) ? centerover->land : cwt.at->land;
|
||||||
if(isHaunted(id)) id = laHaunted;
|
if(isHaunted(id)) id = laHaunted;
|
||||||
if(id == laWarpSea) id = laWarpCoast;
|
if(id == laWarpSea) id = laWarpCoast;
|
||||||
if(id == laMercuryRiver) id = laTerracotta;
|
if(id == laMercuryRiver) id = laTerracotta;
|
||||||
|
@ -970,7 +970,6 @@ void init_textureconfig() {
|
|||||||
addsaver(si_save.id, "center type", 1);
|
addsaver(si_save.id, "center type", 1);
|
||||||
addsaver(si_save.dir, "center direction", 0);
|
addsaver(si_save.dir, "center direction", 0);
|
||||||
addsaver(si_save.reflect, "center reflection", false);
|
addsaver(si_save.reflect, "center reflection", false);
|
||||||
addsaver(viewctr.spin, "center spin", 0);
|
|
||||||
addsaver(config.data.twidth, "texture resolution", 2048);
|
addsaver(config.data.twidth, "texture resolution", 2048);
|
||||||
addsaver(config.gsplits, "precision", 1);
|
addsaver(config.gsplits, "precision", 1);
|
||||||
|
|
||||||
@ -1012,7 +1011,7 @@ bool texture_config::save() {
|
|||||||
targetgeometry = geometry;
|
targetgeometry = geometry;
|
||||||
targetvariation = variation;
|
targetvariation = variation;
|
||||||
|
|
||||||
cell *ctr = viewcenter();
|
cell *ctr = centerover;
|
||||||
si_save = patterns::getpatterninfo0(ctr);
|
si_save = patterns::getpatterninfo0(ctr);
|
||||||
|
|
||||||
if(archimedean) csymbol = arcm::current.symbol;
|
if(archimedean) csymbol = arcm::current.symbol;
|
||||||
@ -1071,11 +1070,9 @@ bool texture_config::load() {
|
|||||||
celllister cl(currentmap->gamestart(), 20, 10000, NULL);
|
celllister cl(currentmap->gamestart(), 20, 10000, NULL);
|
||||||
bool found = false;
|
bool found = false;
|
||||||
for(cell *c: cl.lst) if(euclid || ctof(c)) {
|
for(cell *c: cl.lst) if(euclid || ctof(c)) {
|
||||||
cell *ctr = viewcenter();
|
|
||||||
auto si_here = patterns::getpatterninfo0(c);
|
auto si_here = patterns::getpatterninfo0(c);
|
||||||
if(si_here.id == si_save.id && si_here.reflect == si_save.reflect && si_here.dir == si_save.dir) {
|
if(si_here.id == si_save.id && si_here.reflect == si_save.reflect && si_here.dir == si_save.dir) {
|
||||||
if(euclid) centerover.at = ctr;
|
centerover = c;
|
||||||
else viewctr.at = ctr->master;
|
|
||||||
found = true;
|
found = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user