From 96bf478482c1c6f91284f5452c6e175bf02108e3 Mon Sep 17 00:00:00 2001 From: Zeno Rogue Date: Thu, 15 Aug 2019 15:05:43 +0200 Subject: [PATCH] renamed DIM to GDIM --- 3d-models.cpp | 2 +- basegraph.cpp | 42 ++++----- blizzard.cpp | 2 +- complex.cpp | 2 +- config.cpp | 26 +++--- control.cpp | 58 ++++++------ drawing.cpp | 20 ++--- euclid.cpp | 4 +- expansion.cpp | 2 +- geom-exp.cpp | 4 +- geometry.cpp | 8 +- graph.cpp | 204 +++++++++++++++++++++--------------------- hud.cpp | 6 +- hyper.h | 3 +- hyperpoint.cpp | 16 ++-- hypgraph.cpp | 108 +++++++++++----------- init.cpp | 8 +- inventory.cpp | 2 +- landgen.cpp | 10 +-- mapeditor.cpp | 40 ++++----- menus.cpp | 6 +- models.cpp | 32 +++---- multi.cpp | 6 +- patterns.cpp | 2 +- polygons.cpp | 28 +++--- racing.cpp | 8 +- rogueviz-flocking.cpp | 2 +- rogueviz-kohonen.cpp | 2 +- rogueviz.cpp | 16 ++-- rug.cpp | 12 +-- screenshot.cpp | 20 ++--- shaders.cpp | 2 +- shmup.cpp | 8 +- system.cpp | 6 +- textures.cpp | 8 +- usershapes.cpp | 8 +- 36 files changed, 366 insertions(+), 367 deletions(-) diff --git a/3d-models.cpp b/3d-models.cpp index dd0e01ee..8b60782a 100644 --- a/3d-models.cpp +++ b/3d-models.cpp @@ -802,7 +802,7 @@ void geometry_information::make_shadow(hpcshape& sh) { } void geometry_information::make_3d_models() { - if(DIM == 2) return; + if(GDIM == 2) return; eyepos = WDIM == 2 ? 0.875 : 0.925; DEBBI(DF_POLY, ("make_3d_models")); shcenter = C0; diff --git a/basegraph.cpp b/basegraph.cpp index f4fce0da..2f219f4d 100644 --- a/basegraph.cpp +++ b/basegraph.cpp @@ -214,7 +214,7 @@ EX color_t darkena3(color_t c, int lev, int a) { } EX color_t darkena(color_t c, int lev, int a) { - return darkena3(c, lev, DIM == 3 ? 255 : a); + return darkena3(c, lev, GDIM == 3 ? 255 : a); } #if !CAP_GL @@ -248,9 +248,9 @@ void eyewidth_translate(int ed) { glhr::glmatrix model_orientation_gl() { glhr::glmatrix s = glhr::id; - for(int a=0; axsize/2, -cd->ysize/2, 1)); glhr::id_modelview(); } @@ -384,7 +384,7 @@ void display_data::set_projection(int ed) { } else { - if(hyperbolic && vid.alpha > -1 && DIM == 2) { + if(hyperbolic && vid.alpha > -1 && GDIM == 2) { // Because of the transformation from H3 to the Minkowski hyperboloid, // points with negative Z can be generated in some 3D settings. // This happens for points below the camera, but above the plane. @@ -401,7 +401,7 @@ void display_data::set_projection(int ed) { if(nisot::local_perspective_used()) glhr::projection_multiply(glhr::tmtogl_transpose(nisot::local_perspective)); } - else if(DIM == 3) { + else if(GDIM == 3) { glhr::glmatrix M = glhr::ortho(cd->xsize/current_display->radius/2, -cd->ysize/current_display->radius/2, 1); using models::clip_max; using models::clip_min; @@ -434,14 +434,14 @@ void display_data::set_projection(int ed) { if(among(glhr::new_shader_projection, glhr::shader_projection::band, glhr::shader_projection::band3)) { glhr::projection_multiply(model_orientation_gl()); - glhr::projection_multiply(glhr::scale(2 / M_PI, 2 / M_PI, DIM == 3 ? 2/M_PI : 1)); + glhr::projection_multiply(glhr::scale(2 / M_PI, 2 / M_PI, GDIM == 3 ? 2/M_PI : 1)); } if(among(glhr::new_shader_projection, glhr::shader_projection::halfplane, glhr::shader_projection::halfplane3)) { glhr::projection_multiply(model_orientation_gl()); glhr::projection_multiply(glhr::translate(0, 1, 0)); glhr::projection_multiply(glhr::scale(-1, 1, 1)); - glhr::projection_multiply(glhr::scale(models::halfplane_scale, models::halfplane_scale, DIM == 3 ? models::halfplane_scale : 1)); + glhr::projection_multiply(glhr::scale(models::halfplane_scale, models::halfplane_scale, GDIM == 3 ? models::halfplane_scale : 1)); glhr::projection_multiply(glhr::translate(0, 0.5, 0)); } } @@ -489,7 +489,7 @@ void display_data::set_viewport(int ed) { } EX bool model_needs_depth() { - return DIM == 3 || pmodel == mdBall; + return GDIM == 3 || pmodel == mdBall; } EX void setGLProjection(color_t col IS(backcolor)) { @@ -819,7 +819,7 @@ EX void resetGL() { check_cgi(); cgi.require_shapes(); #if MAXMDIM >= 4 - if(DIM == 3 && !floor_textures) make_floor_textures(); + if(GDIM == 3 && !floor_textures) make_floor_textures(); #endif cgi.initPolyForGL(); } @@ -1473,7 +1473,7 @@ EX namespace subscreens { EX bool split(reaction_t what) { using namespace racing; if(in) return false; - if(!racing::on && !(shmup::on && DIM == 3)) return false; + if(!racing::on && !(shmup::on && GDIM == 3)) return false; if(!player_displays.empty()) { in = true; int& p = current_player; diff --git a/blizzard.cpp b/blizzard.cpp index 50aacf32..d4af0a46 100644 --- a/blizzard.cpp +++ b/blizzard.cpp @@ -239,7 +239,7 @@ EX void drawArrowTraps() { hyperpoint trel = inverse(tu) * tC0(tv); transmatrix tpartial = tu * rspintox(trel) * xpush(hdist0(trel) * tt / 401.0); tpartial = tpartial * ypush(.05); - if(DIM == 3) tpartial = tpartial * cspin(1, 2, M_PI/2); + if(GDIM == 3) tpartial = tpartial * cspin(1, 2, M_PI/2); queuepoly(tpartial, cgi.shTrapArrow, 0xFFFFFFFF); } } diff --git a/complex.cpp b/complex.cpp index 8f55e3f1..274e62e4 100644 --- a/complex.cpp +++ b/complex.cpp @@ -2676,7 +2676,7 @@ EX namespace sword { void determine_sword_angles() { sword_angles = 2; - if(DIM == 3) sword_angles = 1; + if(GDIM == 3) sword_angles = 1; else if(IRREGULAR) sword_angles = 840; else if(binarytiling) sword_angles = 42; else if(archimedean) { diff --git a/config.cpp b/config.cpp index b504512b..314b8bb4 100644 --- a/config.cpp +++ b/config.cpp @@ -881,7 +881,7 @@ EX void edit_sightrange() { if(WDIM == 3 && !vid.use_smart_range) { dialog::addBoolItem_action(XLAT("sloppy range checking"), vid.sloppy_3d, 'S'); } - if(DIM == 3 && !vid.use_smart_range) { + if(GDIM == 3 && !vid.use_smart_range) { dialog::addSelItem(XLAT("limit generation"), fts(extra_generation_distance), 'E'); dialog::add_action([] { auto xo = dialog::extra_options; @@ -1438,7 +1438,7 @@ EX void show3D() { dialog::add_action(geom3::switch_always3); } #endif - if(vid.use_smart_range == 0 && DIM == 2) { + if(vid.use_smart_range == 0 && GDIM == 2) { dialog::addSelItem(XLAT("High detail range"), fts(vid.highdetail), 'n'); dialog::addSelItem(XLAT("Mid detail range"), fts(vid.middetail), 'm'); dialog::addBreak(50); @@ -1474,15 +1474,15 @@ EX void show3D() { } dialog::addBreak(50); - dialog::addSelItem(XLAT(DIM == 3 && WDIM == 2 ? "Y shift" : "third person perspective"), fts(vid.yshift), 'y'); - if(DIM == 3) { + dialog::addSelItem(XLAT(GDIM == 3 && WDIM == 2 ? "Y shift" : "third person perspective"), fts(vid.yshift), 'y'); + if(GDIM == 3) { dialog::addSelItem(XLAT("mouse aiming sensitivity"), fts(mouseaim_sensitivity), 'a'); dialog::add_action([] () { dialog::editNumber(mouseaim_sensitivity, -1, 1, 0.002, 0.01, XLAT("mouse aiming sensitivity"), "set to 0 to disable"); }); } dialog::addSelItem(XLAT("camera rotation"), fts(vid.camera_angle), 'x'); - if(DIM == 2) { + if(GDIM == 2) { dialog::addSelItem(XLAT("fixed facing"), vid.fixed_facing ? fts(vid.fixed_facing_dir) : XLAT("OFF"), 'f'); dialog::add_action([] () { vid.fixed_facing = !vid.fixed_facing; if(vid.fixed_facing) { @@ -1500,8 +1500,8 @@ EX void show3D() { dialog::addSelItem(XLAT("projection"), current_proj_name(), 'M'); } #if MAXMDIM >= 4 - if(DIM == 3) add_edit_fov('f'); - if(DIM == 3) { + if(GDIM == 3) add_edit_fov('f'); + if(GDIM == 3) { dialog::addSelItem(XLAT("radar size"), fts(vid.radarsize), 'r'); dialog::add_action([] () { dialog::editNumber(vid.radarsize, 0, 360, 15, 90, "", XLAT("set to 0 to disable")); @@ -1516,7 +1516,7 @@ EX void show3D() { dialog::extra_options = [] () { draw_radar(true); }; }); } - if(DIM == 3) add_edit_wall_quality('W'); + if(GDIM == 3) add_edit_wall_quality('W'); #endif dialog::addBreak(50); @@ -1532,7 +1532,7 @@ EX void show3D() { #if MAXMDIM >=4 if(WDIM == 2) { - dialog::addBoolItem(XLAT("configure FPP automatically"), DIM == 3, 'F'); + dialog::addBoolItem(XLAT("configure FPP automatically"), GDIM == 3, 'F'); dialog::add_action(geom3::switch_fpp); } #endif @@ -1559,14 +1559,14 @@ EX void show3D() { using namespace geom3; dialog::handleNavigation(sym, uni); - if(uni == 'n' && DIM == 2) { + if(uni == 'n' && GDIM == 2) { dialog::editNumber(vid.highdetail, 0, 5, .5, 7, XLAT("High detail range"), ""); dialog::extra_options = explain_detail; dialog::reaction = [] () { if(vid.highdetail > vid.middetail) vid.middetail = vid.highdetail; }; } - else if(uni == 'm' && DIM == 2) { + else if(uni == 'm' && GDIM == 2) { dialog::editNumber(vid.middetail, 0, 5, .5, 7, XLAT("Mid detail range"), ""); dialog::extra_options = explain_detail; dialog::reaction = [] () { @@ -1588,7 +1588,7 @@ EX void show3D() { fts(vid.depth), fts(atan(1/cosh(vid.camera))*2/degree), fts(1/cosh(vid.camera))) : XLAT("Look from behind.")); - if(DIM == 3 && pmodel == mdPerspective) dialog::extra_options = [] () { + if(GDIM == 3 && pmodel == mdPerspective) dialog::extra_options = [] () { dialog::addBoolItem_action(XLAT("reduce if walls on the way"), vid.use_wall_radar, 'R'); }; }; @@ -1755,7 +1755,7 @@ EX void showCustomizeChar() { int firsty = dialog::items[0].position / 2; int scale = firsty - 2 * vid.fsize; - dynamicval pm(pmodel, DIM == 3 ? mdFlatten : mdDisk); + dynamicval pm(pmodel, GDIM == 3 ? mdFlatten : mdDisk); dynamicval va(vid.alpha, 1); dynamicval vs(vid.scale, 1); dynamicval vc(vid.camera_angle, 0); diff --git a/control.cpp b/control.cpp index caf4284c..4b4df757 100644 --- a/control.cpp +++ b/control.cpp @@ -167,7 +167,7 @@ EX void calcMousedest() { } EX void mousemovement() { - if(DIM == 3) { + if(GDIM == 3) { if(WDIM == 2) { if(View[2][2] < -0.75) movepcto(MD_DROP, 1); @@ -283,7 +283,7 @@ EX bool smooth_scrolling = false; EX void handlePanning(int sym, int uni) { if(mousepan && dual::split([=] { handlePanning(sym, uni); })) return; - if(DIM == 3) { + if(GDIM == 3) { if(sym == PSEUDOKEY_WHEELUP) View = cpush(2, -0.05*shiftmul) * View, didsomething = true, playermoved = false; if(sym == PSEUDOKEY_WHEELDOWN) View = cpush(2, 0.05*shiftmul) * View, didsomething = true, playermoved = false; } @@ -293,16 +293,16 @@ EX void handlePanning(int sym, int uni) { } #if !ISPANDORA - if(sym == SDLK_END && DIM == 3) { + if(sym == SDLK_END && GDIM == 3) { View = solmul(cpush(2, -0.2*shiftmul), View), didsomething = true, playermoved = false; } - if(sym == SDLK_HOME && DIM == 3) { + if(sym == SDLK_HOME && GDIM == 3) { View = solmul(cpush(2, +0.2*shiftmul), View), didsomething = true, playermoved = false; } if(sym == SDLK_RIGHT) { if(history::on) history::lvspeed += 0.1 * shiftmul; - else if(DIM == 3) + else if(GDIM == 3) View = cspin(0, 2, -0.2*shiftmul) * View, didsomething = true; else View = xpush(-0.2*shiftmul) * View, playermoved = false, didsomething = true; @@ -310,7 +310,7 @@ EX void handlePanning(int sym, int uni) { if(sym == SDLK_LEFT) { if(history::on) history::lvspeed -= 0.1 * shiftmul; - else if(DIM == 3) + else if(GDIM == 3) View = cspin(0, 2, 0.2*shiftmul) * View, didsomething = true; else View = xpush(+0.2*shiftmul) * View, playermoved = false, didsomething = true; @@ -318,7 +318,7 @@ EX void handlePanning(int sym, int uni) { if(sym == SDLK_UP) { if(history::on) history::lvspeed += 0.1 * shiftmul; - else if(DIM == 3) + else if(GDIM == 3) View = cspin(1, 2, 0.2*shiftmul) * View, didsomething = true; else View = ypush(+0.2*shiftmul) * View, playermoved = false, didsomething = true; @@ -326,7 +326,7 @@ EX void handlePanning(int sym, int uni) { if(sym == SDLK_DOWN) { if(history::on) history::lvspeed -= 0.1 * shiftmul; - else if(DIM == 3) + else if(GDIM == 3) View = cspin(1, 2, -0.2*shiftmul) * View, didsomething = true; else View = ypush(-0.2*shiftmul) * View, playermoved = false, didsomething = true; @@ -348,7 +348,7 @@ EX void handlePanning(int sym, int uni) { if(sym == SDLK_PAGEUP || sym == SDLK_PAGEDOWN) if(isGravityLand(cwt.at->land)) playermoved = false; - if(sym == PSEUDOKEY_WHEELUP && DIM == 2) { + if(sym == PSEUDOKEY_WHEELUP && GDIM == 2) { ld jx = (mousex - current_display->xcenter - .0) / current_display->radius / 10; ld jy = (mousey - current_display->ycenter - .0) / current_display->radius / 10; playermoved = false; @@ -433,7 +433,7 @@ EX void handleKeyNormal(int sym, int uni) { cell *c = whirlwind::jumpDestination(cwt.at); if(c) centerover.at = c; } - targetRangedOrb(DIM == 3 ? mouseover : centerover.at, roKeyboard); + targetRangedOrb(GDIM == 3 ? mouseover : centerover.at, roKeyboard); sym = 0; uni = 0; } } @@ -472,7 +472,7 @@ EX void handleKeyNormal(int sym, int uni) { pushScreen(inv::show); #endif - if(((sym == SDLK_HOME && DIM == 2) || sym == SDLK_F3 || sym == ' ') && DEFAULTNOR(sym)) + if(((sym == SDLK_HOME && GDIM == 2) || sym == SDLK_F3 || sym == ' ') && DEFAULTNOR(sym)) fullcenter(); if(sym == 'v' && DEFAULTNOR(sym)) @@ -590,7 +590,7 @@ EX void mainloopiter() { if(cwt.mirrored) playerV = playerV * Mirror; } - mousepan = (cmode & (sm::NORMAL | sm::DRAW | sm::MAP)) && DIM == 3 && mouseaim_sensitivity; + mousepan = (cmode & (sm::NORMAL | sm::DRAW | sm::MAP)) && GDIM == 3 && mouseaim_sensitivity; if(mousepan != oldmousepan) { oldmousepan = mousepan; #if CAP_MOUSEGRAB @@ -620,7 +620,7 @@ EX void mainloopiter() { ld aspd = (ticks - lastt) / 1000.0 * exp(vid.sspeed); if(playermoved && vid.sspeed > -4.99 && !outoffocus) centerpc(aspd); - else if(DIM == 3) + else if(GDIM == 3) spinEdge(aspd); #if CAP_SDLJOY if(panjoyx || panjoyy) @@ -668,7 +668,7 @@ EX void mainloopiter() { SDL_Event ev; DEBB(DF_GRAPH, ("polling for events\n")); - if(DIM == 3 && !shmup::on && !rug::rugged) { + if(GDIM == 3 && !shmup::on && !rug::rugged) { #if CAP_MOUSEGRAB View = cspin(0, 2, -mouseaim_x) * cspin(1, 2, -mouseaim_y) * View; mouseaim_x = mouseaim_y = 0; @@ -680,18 +680,18 @@ EX void mainloopiter() { ld t = (ticks - lastticks) * shiftmul / 1000.; lastticks = ticks; Uint8 *keystate = SDL_GetKeyState(NULL); - if(keystate[SDLK_END] && DIM == 3 && DEFAULTNOR(SDLK_END)) + if(keystate[SDLK_END] && GDIM == 3 && DEFAULTNOR(SDLK_END)) View = cpush(2, -t) * View, didsomething = true, playermoved = false; - if(keystate[SDLK_HOME] && DIM == 3 && DEFAULTNOR(SDLK_HOME)) + if(keystate[SDLK_HOME] && GDIM == 3 && DEFAULTNOR(SDLK_HOME)) View = cpush(2, t) * View, didsomething = true, playermoved = false; if(keystate[SDLK_RIGHT] && DEFAULTNOR(SDLK_RIGHT)) - View = (DIM == 2 ? xpush(-t) : cspin(0, 2, -t)) * View, didsomething = true, playermoved = playermoved && DIM == 3; + View = (GDIM == 2 ? xpush(-t) : cspin(0, 2, -t)) * View, didsomething = true, playermoved = playermoved && GDIM == 3; if(keystate[SDLK_LEFT] && DEFAULTNOR(SDLK_LEFT)) - View = (DIM == 2 ? xpush(t) : cspin(0, 2, t)) * View, didsomething = true, playermoved = playermoved && DIM == 3; + View = (GDIM == 2 ? xpush(t) : cspin(0, 2, t)) * View, didsomething = true, playermoved = playermoved && GDIM == 3; if(keystate[SDLK_UP] && DEFAULTNOR(SDLK_UP)) - View = (DIM == 2 ? ypush(t) : cspin(1, 2, t)) * View, didsomething = true, playermoved = playermoved && DIM == 3; + View = (GDIM == 2 ? ypush(t) : cspin(1, 2, t)) * View, didsomething = true, playermoved = playermoved && GDIM == 3; if(keystate[SDLK_DOWN] && DEFAULTNOR(SDLK_DOWN)) - View = (DIM == 2 ? ypush(-t) : cspin(1, 2, -t)) * View, didsomething = true, playermoved = playermoved && DIM == 3; + View = (GDIM == 2 ? ypush(-t) : cspin(1, 2, -t)) * View, didsomething = true, playermoved = playermoved && GDIM == 3; if(keystate[SDLK_PAGEUP] && DEFAULTNOR(SDLK_PAGEUP)) { if(history::on) models::rotation+=t; @@ -847,13 +847,13 @@ EX void handle_event(SDL_Event& ev) { } else if(ev.button.button==SDL_BUTTON_WHEELDOWN) { - if(anyctrl && anyshift && !rug::rugged && DIM == 2) { + if(anyctrl && anyshift && !rug::rugged && GDIM == 2) { mapeditor::scaleall(1/1.2); vid.alpha /= 1.2; } - else if(anyctrl && !rug::rugged && DIM == 2) + else if(anyctrl && !rug::rugged && GDIM == 2) mapeditor::scaleall(pow(2, -.25)); - else if(anyshift && !rug::rugged && DIM == 2) + else if(anyshift && !rug::rugged && GDIM == 2) vid.alpha -= 0.25; else if(rollchange) { sym = getcstat, uni = getcstat, shiftmul = getcshift, wheelclick = true; @@ -863,13 +863,13 @@ EX void handle_event(SDL_Event& ev) { } } if(ev.button.button==SDL_BUTTON_WHEELUP) { - if(anyctrl && anyshift && !rug::rugged && DIM == 2) { + if(anyctrl && anyshift && !rug::rugged && GDIM == 2) { mapeditor::scaleall(1.2); vid.alpha *= 1.2; } - else if(anyctrl && !rug::rugged && DIM == 2) + else if(anyctrl && !rug::rugged && GDIM == 2) mapeditor::scaleall(pow(2, .25)); - else if(anyshift && !rug::rugged && DIM == 2) + else if(anyshift && !rug::rugged && GDIM == 2) vid.alpha += 0.25; else if(rollchange) { sym = getcstat, uni = getcstat, shiftmul = -getcshift, wheelclick = true; @@ -907,7 +907,7 @@ EX void handle_event(SDL_Event& ev) { vid.xposition += (mousex - lmousex) * 1. / current_display->scrsize, vid.yposition += (mousey - lmousey) * 1. / current_display->scrsize; } - else if(mouseh[DIM] < 50 && mouseoh[DIM] < 50) { + else if(mouseh[GDIM] < 50 && mouseoh[GDIM] < 50) { panning(mouseoh, mouseh); } } @@ -1020,7 +1020,7 @@ EX bool gmodekeys(int sym, int uni) { if(NUMBERKEY == '6') { vid.grid = !vid.grid; return true; } if(NUMBERKEY == '7') { vid.darkhepta = !vid.darkhepta; return true; } - if(DIM == 2) { + if(GDIM == 2) { if(NUMBERKEY == '1' && !rug::rugged) { vid.alpha = 999; vid.scale = 998; vid.xposition = vid.yposition = 0; } else if(NUMBERKEY == '2' && !rug::rugged) { vid.alpha = 1; vid.scale = 0.4; vid.xposition = vid.yposition = 0; } else if(NUMBERKEY == '3' && !rug::rugged) { vid.alpha = 1; vid.scale = 1; vid.xposition = vid.yposition = 0; } @@ -1051,7 +1051,7 @@ EX bool haveMobileCompass() { #else if(forcetarget) return false; #endif - if(DIM == 3) return false; + if(GDIM == 3) return false; return canmove && !shmup::on && vid.mobilecompasssize > 0 && isize(screens) == 1; } diff --git a/drawing.cpp b/drawing.cpp index d458ac17..ec6d96b4 100644 --- a/drawing.cpp +++ b/drawing.cpp @@ -231,7 +231,7 @@ hyperpoint goodpoint; vector> tofix; EX bool two_sided_model() { - if(DIM == 3) return false; + if(GDIM == 3) return false; if(pmodel == mdHyperboloid) return !euclid; // if(pmodel == mdHemisphere) return true; if(pmodel == mdDisk) return sphere; @@ -331,7 +331,7 @@ void addpoint(const hyperpoint& H) { } Hlast = Hscr; } - if(DIM == 2) { + if(GDIM == 2) { for(int i=0; i<3; i++) Hscr[i] *= z; Hscr[1] *= vid.stretch; } @@ -478,7 +478,7 @@ void glapplymatrix(const transmatrix& V) { GLfloat mat[16]; int id = 0; - if(in_perspective() && DIM == 3) { + if(in_perspective() && GDIM == 3) { if(spherephase & 4) { for(int y=0; y<4; y++) { for(int x=0; x<4; x++) mat[id++] = -V[x][y]; @@ -493,7 +493,7 @@ void glapplymatrix(const transmatrix& V) { return; } - if(DIM == 3) { + if(GDIM == 3) { for(int y=0; y<4; y++) for(int x=0; x<4; x++) mat[id++] = V[x][y]; } @@ -514,7 +514,7 @@ void glapplymatrix(const transmatrix& V) { if(vid.stretch != 1) mat[1] *= vid.stretch, mat[5] *= vid.stretch, mat[9] *= vid.stretch, mat[13] *= vid.stretch; if(models::model_has_orientation()) { - if(DIM == 3) for(int a=0; a<4; a++) + if(GDIM == 3) for(int a=0; a<4; a++) models::apply_orientation_yz(mat[a*4+1], mat[a*4+2]); for(int a=0; a<4; a++) models::apply_orientation(mat[a*4], mat[a*4+1]); @@ -644,7 +644,7 @@ void dqi_poly::gldraw() { #endif EX ld scale_at(const transmatrix& T) { - if(DIM == 3 && pmodel == mdPerspective) return 1 / abs((tC0(T))[2]); + if(GDIM == 3 && pmodel == mdPerspective) return 1 / abs((tC0(T))[2]); if(sol) return 1; hyperpoint h1, h2, h3; applymodel(tC0(T), h1); @@ -656,7 +656,7 @@ EX ld scale_at(const transmatrix& T) { EX ld linewidthat(const hyperpoint& h) { if(!(vid.antialias & AA_LINEWIDTH)) return 1; else if(hyperbolic && pmodel == mdDisk && vid.alpha == 1 && !ISWEB) { - double dz = h[DIM]; + double dz = h[GDIM]; if(dz < 1 || abs(dz-current_display->scrdist) < 1e-6) return 1; else { double dx = sqrt(dz * dz - 1); @@ -903,7 +903,7 @@ void dqi_poly::draw() { if(!any) return; } - if(sphere && tinf && DIM == 2 && cnt > 3) { + if(sphere && tinf && GDIM == 2 && cnt > 3) { int i = cnt; cnt = 3; for(int j=0; j& p1, const unique_ptr& p2) { auto ap1 = (dqi_poly&) *p1; auto ap2 = (dqi_poly&) *p2; diff --git a/euclid.cpp b/euclid.cpp index f57e8ac3..97767404 100644 --- a/euclid.cpp +++ b/euclid.cpp @@ -617,7 +617,7 @@ EX namespace euclid3 { tmatrix.resize(S7); for(int i=0; i= 4 - if(!floor_textures && DIM == 3 && (cgi.state & 2)) + if(!floor_textures && GDIM == 3 && (cgi.state & 2)) make_floor_textures(); #endif diff --git a/graph.cpp b/graph.cpp index 7882f1ef..4d09bccf 100644 --- a/graph.cpp +++ b/graph.cpp @@ -24,7 +24,7 @@ EX bool in_perspective() { } EX bool hide_player() { - return DIM == 3 && playermoved && vid.yshift == 0 && vid.sspeed > -5 && in_perspective() && (first_cell_to_draw || elliptic) && (WDIM == 3 || vid.camera == 0) && !inmirrorcount + return GDIM == 3 && playermoved && vid.yshift == 0 && vid.sspeed > -5 && in_perspective() && (first_cell_to_draw || elliptic) && (WDIM == 3 || vid.camera == 0) && !inmirrorcount #if CAP_RACING && !(racing::on && !racing::standard_centering && !racing::player_relative && !sol) #endif @@ -177,7 +177,7 @@ void drawShield(const transmatrix& V, eItem it) { double d = it == itOrbShield ? cgi.hexf : cgi.hexf - .1; int mt = sphere ? 7 : 5; #if MAXMDIM >= 4 - if(DIM == 3) + if(GDIM == 3) queueball(V * zpush(cgi.GROIN1), cgi.human_height / 2, darkena(col, 0, 0xFF), itOrbShield); #else if(1) ; @@ -195,7 +195,7 @@ void drawSpeed(const transmatrix& V) { ld ds = ptick(10); color_t col = darkena(iinf[itOrbSpeed].color, 0, 0xFF); #if MAXMDIM >= 4 - if(DIM == 3) queueball(V * zpush(cgi.GROIN1), cgi.human_height * 0.55, col, itOrbSpeed); + if(GDIM == 3) queueball(V * zpush(cgi.GROIN1), cgi.human_height * 0.55, col, itOrbSpeed); else #endif for(int b=0; b= 4 - if(DIM == 3) { + if(GDIM == 3) { queueball(V * zpush(cgi.GROIN1), 2*cgi.hexf, col, itOrbSafety); return; } @@ -229,7 +229,7 @@ void drawFlash(const transmatrix& V) { for(int u=0; u<5; u++) { ld rad = cgi.hexf * (2.5 + .5 * sin(ds+u*.3)); #if MAXMDIM >= 4 - if(DIM == 3) { + if(GDIM == 3) { queueball(V * zpush(cgi.GROIN1), rad, col, itOrbFlash); } #else @@ -249,7 +249,7 @@ ld cheilevel(ld v) { transmatrix chei(const transmatrix V, int a, int b) { #if MAXMDIM >= 4 - if(DIM == 2) return V; + if(GDIM == 2) return V; return V * zpush(cheilevel((a+.5) / b)); #else return V; @@ -360,7 +360,7 @@ EX transmatrix iddspin(cell *c, int d, ld bonus IS(0)) { return spin(hexshiftat(c) - displayspin(c, d) + bonus); } -#define UNTRANS (DIM == 3 ? 0x000000FF : 0) +#define UNTRANS (GDIM == 3 ? 0x000000FF : 0) EX void drawPlayerEffects(const transmatrix& V, cell *c, bool onplayer) { if(!onplayer && !items[itOrbEmpathy]) return; @@ -416,8 +416,8 @@ EX void drawPlayerEffects(const transmatrix& V, cell *c, bool onplayer) { ld l0 = PURE ? 0.6 * cgi.scalefactor : longer ? 0.36 : 0.4; ld l1 = PURE ? 0.7 * cgi.scalefactor : longer ? 0.44 : 0.42; #if MAXMDIM >= 4 - hyperpoint h0 = DIM == 3 ? xpush(l0) * zpush(cgi.FLOOR - cgi.human_height/50) * C0 : xpush0(l0); - hyperpoint h1 = DIM == 3 ? xpush(l1) * zpush(cgi.FLOOR - cgi.human_height/50) * C0 : xpush0(l1); + hyperpoint h0 = GDIM == 3 ? xpush(l0) * zpush(cgi.FLOOR - cgi.human_height/50) * C0 : xpush0(l0); + hyperpoint h1 = GDIM == 3 ? xpush(l1) * zpush(cgi.FLOOR - cgi.human_height/50) * C0 : xpush0(l1); #else hyperpoint h0 = xpush0(l0); hyperpoint h1 = xpush0(l1); @@ -629,7 +629,7 @@ EX void ShadowV(const transmatrix& V, const hpcshape& bp, PPR prio IS(PPR::MONST #if CAP_SHAPES transmatrix otherbodyparts(const transmatrix& V, color_t col, eMonster who, double footphase) { -#define VFOOT (DIM == 2 ? V : mmscale(V, cgi.LEG0)) +#define VFOOT (GDIM == 2 ? V : mmscale(V, cgi.LEG0)) #define VLEG mmscale(V, cgi.LEG) #define VGROIN mmscale(V, cgi.GROIN) #define VBODY mmscale(V, cgi.BODY) @@ -647,7 +647,7 @@ transmatrix otherbodyparts(const transmatrix& V, color_t col, eMonster who, doub #define VAHEAD mmscale(V, cgi.AHEAD) #define VFISH V -#define VBIRD ((DIM == 3 || (where && bird_disruption(where))) ? (WDIM == 2 ? mmscale(V, cgi.BIRD) : V) : mmscale(V, cgi.BIRD + .05 * sintick(1000, (int) (size_t(where))/1000.))) +#define VBIRD ((GDIM == 3 || (where && bird_disruption(where))) ? (WDIM == 2 ? mmscale(V, cgi.BIRD) : V) : mmscale(V, cgi.BIRD + .05 * sintick(1000, (int) (size_t(where))/1000.))) #define VGHOST mmscale(V, cgi.GHOST) #define VSLIMEEYE mscale(V, cgi.FLATEYE) @@ -661,19 +661,19 @@ transmatrix otherbodyparts(const transmatrix& V, color_t col, eMonster who, doub // todo - if(detaillevel >= 2 && DIM == 2) { + if(detaillevel >= 2 && GDIM == 2) { transmatrix VL = mmscale(V, cgi.LEG1); queuepoly(VL * xpush(rightfoot*3/4), cgi.shHumanLeg, col); queuepoly(VL * Mirror * xpush(-rightfoot*3/4), cgi.shHumanLeg, col); } - if(DIM == 2) { + if(GDIM == 2) { transmatrix VL = mmscale(V, cgi.LEG); queuepoly(VL * xpush(rightfoot/2), cgi.shHumanLeg, col); queuepoly(VL * Mirror * xpush(-rightfoot/2), cgi.shHumanLeg, col); } - if(detaillevel >= 2 && DIM == 2) { + if(detaillevel >= 2 && GDIM == 2) { transmatrix VL = mmscale(V, cgi.LEG3); queuepoly(VL * xpush(rightfoot/4), cgi.shHumanLeg, col); queuepoly(VL * Mirror * xpush(-rightfoot/4), cgi.shHumanLeg, col); @@ -681,7 +681,7 @@ transmatrix otherbodyparts(const transmatrix& V, color_t col, eMonster who, doub transmatrix Tright, Tleft; - if(DIM == 2) { + if(GDIM == 2) { Tright = VFOOT * xpush(rightfoot); Tleft = VFOOT * Mirror * xpush(-rightfoot); } @@ -695,7 +695,7 @@ transmatrix otherbodyparts(const transmatrix& V, color_t col, eMonster who, doub } #endif - if(who == moWaterElemental && DIM == 2) { + if(who == moWaterElemental && GDIM == 2) { double fishtail = footfun(footphase / .4) / 4 * 1.5; queuepoly(VFOOT * xpush(fishtail), cgi.shFishTail, watercolor(100)); } @@ -713,7 +713,7 @@ transmatrix otherbodyparts(const transmatrix& V, color_t col, eMonster who, doub queuepoly(Tleft, cgi.shHumanFoot, col); } - if(DIM == 3 || !mmspatial) return spin(rightfoot * wobble); + if(GDIM == 3 || !mmspatial) return spin(rightfoot * wobble); if(detaillevel >= 2 && who != moZombie) queuepoly(mmscale(V, cgi.NECK1), cgi.shHumanNeck, col); @@ -803,7 +803,7 @@ color_t kind_outline(eItem it) { } EX transmatrix face_the_player(const transmatrix V) { - if(DIM == 2) return V; + if(GDIM == 2) return V; if(nonisotropic) return spin_towards(V, C0, 2, 0); return rgpushxto0(tC0(V)); } @@ -857,13 +857,13 @@ EX bool drawItemType(eItem it, cell *c, const transmatrix& V, color_t icol, int if(c && WDIM == 3) addradar(V, iinf[it].glyph, icol, kind_outline(it)); #endif - if(DIM == 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 == viewctr.at->c7 && in_perspective() && hdist0(tC0(V)) < cgi.orbsize * 0.25) return false; transmatrix Vit = V; if(GDIM == 3 && WDIM == 2 && c && it != itBabyTortoise) Vit = mscale(V, cgi.STUFF); - if(DIM == 3 && c && it != itBabyTortoise) Vit = face_the_player(Vit); + if(GDIM == 3 && c && it != itBabyTortoise) Vit = face_the_player(Vit); // V * cspin(0, 2, ptick(618, 0)); if(c && history::includeHistory && history::infindhistory.count(c)) poly_outline = OUTLINE_DEAD; @@ -917,7 +917,7 @@ EX bool drawItemType(eItem it, cell *c, const transmatrix& V, color_t icol, int } else V2 = V; } - if(DIM == 3) { + if(GDIM == 3) { queuepoly(Vit, cgi.shRing, 0xFFFFFFFF); if(WDIM == 2) V2 = mscale(V2, cgi.STUFF); V2 = V2 * cspin(1, 2, M_PI * sintick(100) / 39); @@ -997,7 +997,7 @@ EX bool drawItemType(eItem it, cell *c, const transmatrix& V, color_t icol, int transmatrix V2 = Vit * spinptick(1500); if(xsh == &cgi.shBookCover && mmitem) { - if(DIM == 3) + if(GDIM == 3) queuepoly(V2 * cpush(2, 1e-3), cgi.shBook, 0x805020FF); else queuepoly(V2, cgi.shBook, 0x805020FF); @@ -1049,7 +1049,7 @@ EX bool drawItemType(eItem it, cell *c, const transmatrix& V, color_t icol, int color_t skincolor = 0xD0C080FF; void humanoid_eyes(const transmatrix& V, color_t ecol, color_t hcol = skincolor) { - if(DIM == 3) { + if(GDIM == 3) { queuepoly(VHEAD, cgi.shPHeadOnly, hcol); queuepoly(VHEAD, cgi.shSkullEyes, ecol); } @@ -1335,7 +1335,7 @@ void drawMimic(eMonster m, cell *where, const transmatrix& V, color_t col, doubl EX bool drawMonsterType(eMonster m, cell *where, const transmatrix& V1, color_t col, double footphase, color_t asciicol) { #if MAXMDIM >= 4 - if(DIM == 3 && m != moPlayer && asciicol != NOCOLOR) + if(GDIM == 3 && m != moPlayer && asciicol != NOCOLOR) addradar(V1, minf[m].glyph, asciicol, isFriendly(m) ? 0x00FF00FF : 0xFF0000FF); #endif @@ -1345,7 +1345,7 @@ EX bool drawMonsterType(eMonster m, cell *where, const transmatrix& V1, color_t transmatrix V = V1; if(WDIM == 3 && (classflag(m) & CF_FACE_UP) && where) V = V1 * cspin(0, 2, M_PI/2); - // if(DIM == 3) V = V * cspin(0, 2, M_PI/2); + // if(GDIM == 3) V = V * cspin(0, 2, M_PI/2); if(m == moTortoise && where && where->stuntime >= 3) drawStunStars(V, where->stuntime-2); @@ -1450,7 +1450,7 @@ EX bool drawMonsterType(eMonster m, cell *where, const transmatrix& V1, color_t if(m == moRoseLady) { // queuepoly(V, girl ? cgi.shGoatHead : cgi.shDemon, 0x800000FF); // make her hair a bit darker to stand out in 3D - queuepoly(VHEAD1, girl ? cgi.shFemaleHair : cgi.shPHead, evil ? 0x500050FF : DIM == 3 ? 0x666A64FF : 0x332A22FF); + queuepoly(VHEAD1, girl ? cgi.shFemaleHair : cgi.shPHead, evil ? 0x500050FF : GDIM == 3 ? 0x666A64FF : 0x332A22FF); } else if(m == moRoseBeauty) { if(girl) { @@ -1485,7 +1485,7 @@ EX bool drawMonsterType(eMonster m, cell *where, const transmatrix& V1, color_t } queuepoly(VAHEAD, cgi.shWolfHead, darkena(col, 0, 0xFF)); queuepoly(VAHEAD, cgi.shWolfEyes, darkena(col, 3, 0xFF)); - if(DIM == 3) { + if(GDIM == 3) { queuepoly(VAHEAD, cgi.shFamiliarEye, 0xFF); queuepoly(VAHEAD * Mirror, cgi.shFamiliarEye, 0xFF); } @@ -1584,8 +1584,8 @@ EX bool drawMonsterType(eMonster m, cell *where, const transmatrix& V1, color_t case moTameBomberbird: case moWindCrow: case moTameBomberbirdMoved: case moSandBird: case moAcidBird: { ShadowV(V, cgi.shEagle); - auto& sh = DIM == 3 ? cgi.shAnimatedEagle[wingphase(200)] : cgi.shEagle; - if(m == moParrot && DIM == 3) + auto& sh = GDIM == 3 ? cgi.shAnimatedEagle[wingphase(200)] : cgi.shEagle; + if(m == moParrot && GDIM == 3) queuepolyat(VBIRD, sh, darkena(col, 0, 0xFF), PPR::SUPERLINE); else queuepoly(VBIRD, sh, darkena(col, 0, 0xFF)); @@ -1594,7 +1594,7 @@ EX bool drawMonsterType(eMonster m, cell *where, const transmatrix& V1, color_t case moSparrowhawk: case moWestHawk: { ShadowV(V, cgi.shHawk); - auto& sh = DIM == 3 ? cgi.shAnimatedHawk[wingphase(200)] : cgi.shHawk; + auto& sh = GDIM == 3 ? cgi.shAnimatedHawk[wingphase(200)] : cgi.shHawk; queuepoly(VBIRD, sh, darkena(col, 0, 0xFF)); return false; } @@ -1602,7 +1602,7 @@ EX bool drawMonsterType(eMonster m, cell *where, const transmatrix& V1, color_t case moButterfly: { transmatrix Vwing = wingmatrix(100); ShadowV(V * Vwing, cgi.shButterflyWing); - if(DIM == 2) + if(GDIM == 2) queuepoly(VBIRD * Vwing, cgi.shButterflyWing, darkena(col, 0, 0xFF)); else queuepoly(VBIRD, cgi.shAnimatedButterfly[wingphase(100)], darkena(col, 0, 0xFF)); @@ -1613,7 +1613,7 @@ EX bool drawMonsterType(eMonster m, cell *where, const transmatrix& V1, color_t case moGadfly: { transmatrix Vwing = wingmatrix(100); ShadowV(V * Vwing, cgi.shGadflyWing); - queuepoly(VBIRD * Vwing, DIM == 2 ? cgi.shGadflyWing : cgi.shAnimatedGadfly[wingphase(100)], darkena(col, 0, 0xFF)); + queuepoly(VBIRD * Vwing, GDIM == 2 ? cgi.shGadflyWing : cgi.shAnimatedGadfly[wingphase(100)], darkena(col, 0, 0xFF)); queuepoly(VBIRD, cgi.shGadflyBody, darkena(col, 1, 0xFF)); queuepoly(VBIRD, cgi.shGadflyEye, darkena(col, 2, 0xFF)); queuepoly(VBIRD * Mirror, cgi.shGadflyEye, darkena(col, 2, 0xFF)); @@ -1624,8 +1624,8 @@ EX bool drawMonsterType(eMonster m, cell *where, const transmatrix& V1, color_t // vampires have no shadow and no mirror images if(m == moBat) ShadowV(V, cgi.shBatWings); if(m == moBat || !inmirrorcount) { - queuepoly(VBIRD, DIM == 2 ? cgi.shBatWings : cgi.shAnimatedBat[wingphase(100)], darkena(0x303030, 0, 0xFF)); - queuepoly(VBIRD, DIM == 2 ? cgi.shBatBody : cgi.shAnimatedBat2[wingphase(100)], darkena(0x606060, 0, 0xFF)); + queuepoly(VBIRD, GDIM == 2 ? cgi.shBatWings : cgi.shAnimatedBat[wingphase(100)], darkena(0x303030, 0, 0xFF)); + queuepoly(VBIRD, GDIM == 2 ? cgi.shBatBody : cgi.shAnimatedBat2[wingphase(100)], darkena(0x606060, 0, 0xFF)); } /* queuepoly(V, cgi.shBatMouth, darkena(0xC00000, 0, 0xFF)); queuepoly(V, cgi.shBatFang, darkena(0xFFC0C0, 0, 0xFF)); @@ -1637,8 +1637,8 @@ EX bool drawMonsterType(eMonster m, cell *where, const transmatrix& V1, color_t case moGargoyle: { ShadowV(V, cgi.shGargoyleWings); - queuepoly(VBIRD, DIM == 2 ? cgi.shGargoyleWings : cgi.shAnimatedGargoyle[wingphase(300)], darkena(col, 0, 0xD0)); - queuepoly(VBIRD, DIM == 2 ? cgi.shGargoyleBody : cgi.shAnimatedGargoyle2[wingphase(300)], darkena(col, 0, 0xFF)); + queuepoly(VBIRD, GDIM == 2 ? cgi.shGargoyleWings : cgi.shAnimatedGargoyle[wingphase(300)], darkena(col, 0, 0xD0)); + queuepoly(VBIRD, GDIM == 2 ? cgi.shGargoyleBody : cgi.shAnimatedGargoyle2[wingphase(300)], darkena(col, 0, 0xFF)); return false; } @@ -1732,8 +1732,8 @@ EX bool drawMonsterType(eMonster m, cell *where, const transmatrix& V1, color_t case moSkeleton: { const transmatrix VBS = VBODY * otherbodyparts(V, darkena(0xFFFFFF, 0, 0xFF), moSkeleton, footphase); queuepoly(VBS, cgi.shSkeletonBody, darkena(0xFFFFFF, 0, 0xFF)); - if(DIM == 2) queuepoly(VHEAD, cgi.shSkull, darkena(0xFFFFFF, 0, 0xFF)); - if(DIM == 2) queuepoly(VHEAD1, cgi.shSkullEyes, 0x000000FF); + if(GDIM == 2) queuepoly(VHEAD, cgi.shSkull, darkena(0xFFFFFF, 0, 0xFF)); + if(GDIM == 2) queuepoly(VHEAD1, cgi.shSkullEyes, 0x000000FF); humanoid_eyes(V, 0x000000FF, 0xFFFFFFFF); ShadowV(V, cgi.shSkeletonBody); queuepoly(VBS, cgi.shSabre, 0xFFFFFFFF); @@ -1874,14 +1874,14 @@ EX bool drawMonsterType(eMonster m, cell *where, const transmatrix& V1, color_t case moGhost: case moSeep: case moFriendlyGhost: { if(m == moFriendlyGhost) col = fghostcolor(where); - queuepolyat(VGHOST, cgi.shGhost, darkena(col, 0, m == moFriendlyGhost ? 0xC0 : 0x80), DIM == 3 ? PPR::SUPERLINE : cgi.shGhost.prio); - queuepolyat(VGHOST, cgi.shGhostEyes, 0xFF, DIM == 3 ? PPR::SUPERLINE : cgi.shEyes.prio); + queuepolyat(VGHOST, cgi.shGhost, darkena(col, 0, m == moFriendlyGhost ? 0xC0 : 0x80), GDIM == 3 ? PPR::SUPERLINE : cgi.shGhost.prio); + queuepolyat(VGHOST, cgi.shGhostEyes, 0xFF, GDIM == 3 ? PPR::SUPERLINE : cgi.shEyes.prio); return false; } case moVineSpirit: { queuepoly(VGHOST, cgi.shGhost, 0xD0D0D0C0 | UNTRANS); - queuepolyat(VGHOST, cgi.shGhostEyes, 0xFF0000FF, DIM == 3 ? PPR::SUPERLINE : cgi.shGhostEyes.prio); + queuepolyat(VGHOST, cgi.shGhostEyes, 0xFF0000FF, GDIM == 3 ? PPR::SUPERLINE : cgi.shGhostEyes.prio); return false; } @@ -1947,7 +1947,7 @@ EX bool drawMonsterType(eMonster m, cell *where, const transmatrix& V1, color_t float t = sintick(1000, where ? where->cpdist*M_PI : 0); int eyecol = t > 0.92 ? 0xFF0000 : 0; - if(DIM == 2) { + if(GDIM == 2) { queuepoly(VHEAD, cgi.shRatHead, darkena(col, 0, 0xFF)); queuepoly(VHEAD, cgi.shWolf1, darkena(eyecol, 0, 0xFF)); queuepoly(VHEAD, cgi.shWolf2, darkena(eyecol, 0, 0xFF)); @@ -2317,7 +2317,7 @@ bool applyAnimation(cell *c, transmatrix& V, double& footphase, int layer) { V = V * a.wherenow; if(a.mirrored) V = V * Mirror; if(a.attacking == 2) V = V * pispin; - // if(DIM == 3) V = V * cspin(0, 2, M_PI/2); + // if(GDIM == 3) V = V * cspin(0, 2, M_PI/2); a.ltick = ticks; return true; } @@ -2439,11 +2439,11 @@ bool drawMonster(const transmatrix& Vparam, int ct, cell *c, color_t col, bool m if(isDragon(c->monst) && c->stuntime == 0) col = 0xFF6000; - if(DIM == 3) + if(GDIM == 3) addradar(Vparam, minf[m].glyph, asciicol, isFriendly(m) ? 0x00FF00FF : 0xFF0000FF); transmatrix Vb0 = Vb; - if(c->mondir != NODIR && DIM == 3 && isAnyIvy(c)) { + if(c->mondir != NODIR && GDIM == 3 && isAnyIvy(c)) { queueline(tC0(Vparam), Vparam * tC0(calc_relative_matrix(c->move(c->mondir), c, C0)), (col << 8) + 0xFF, 0); } else if(c->mondir != NODIR) { @@ -2529,7 +2529,7 @@ bool drawMonster(const transmatrix& Vparam, int ct, cell *c, color_t col, bool m if(mmmon) { if(isAnyIvy(c)) { - if(DIM == 3) { + if(GDIM == 3) { hyperpoint V0 = tC0(Vb); transmatrix Vs = rspintox(V0) * xpush(hdist0(V0)) * cspin(0, 2, -M_PI/2); queuepoly(Vs, cgi.shILeaf[1], darkena(col, 0, 0xFF)); @@ -2614,7 +2614,7 @@ bool drawMonster(const transmatrix& Vparam, int ct, cell *c, color_t col, bool m else { if(c->monst == moTentacletail && c->mondir == NODIR) { if(c->monmirror) Vb = Vb * Mirror; - queuepoly(DIM == 3 ? mmscale(Vb, cgi.ABODY) : Vb, cgi.shWormSegment, darkena(col, 0, 0xFF)); + queuepoly(GDIM == 3 ? mmscale(Vb, cgi.ABODY) : Vb, cgi.shWormSegment, darkena(col, 0, 0xFF)); } else if(c->mondir == NODIR) { bool hexsnake = c->monst == moHexSnake || c->monst == moHexSnakeTail; @@ -3002,7 +3002,7 @@ void drawaura() { } } glflush(); - dynamicval p(pmodel, DIM == 2 && pmodel == mdDisk ? mdDisk : mdUnchanged); + dynamicval p(pmodel, GDIM == 2 && pmodel == mdDisk ? mdDisk : mdUnchanged); current_display->set_all(0); glhr::switch_mode(glhr::gmVarColored, glhr::shader_projection::standard); glhr::id_modelview(); @@ -4168,7 +4168,7 @@ int getSnakelevColor(cell *c, int i, int last, int fd, color_t wcol) { #if CAP_SHAPES void draw_wall(cell *c, const transmatrix& V, color_t wcol, color_t& zcol, int ct6, int fd) { - if(DIM == 3 && WDIM == 2) { + if(GDIM == 3 && WDIM == 2) { if(!qfi.fshape) qfi.fshape = &cgi.shFullFloor; if(conegraph(c)) { draw_shapevec(c, V, qfi.fshape->cone[0], darkena(wcol, 0, 0xFF), PPR::WALL); @@ -4283,7 +4283,7 @@ void draw_gravity_particles(cell *c, const transmatrix V) { const color_t levitate_color = 0x40F040FF; auto levf = [] (ld l) { - return DIM == 3 ? cheilevel(l) : 1 + (1-l) * 1; + return GDIM == 3 ? cheilevel(l) : 1 + (1-l) * 1; }; if(spatial_graphics || (WDIM == 2 && GDIM == 3)) { @@ -4307,7 +4307,7 @@ void draw_gravity_particles(cell *c, const transmatrix V) { for(int i=0; i<6; i++) { transmatrix T0 = V * spin(i*degree*60 + tt/60. * degree) * xpush(cgi.crossf/3); transmatrix T1 = V * spin(i*degree*60 + (tt/60. + 30) * degree) * xpush(cgi.crossf/3); - ld lv = levf(DIM == 3 ? (i+0.5)/6 : 0.5); + ld lv = levf(GDIM == 3 ? (i+0.5)/6 : 0.5); queueline(mmscale(T0, lv) * C0, mmscale(T1, lv) * C0, levitate_color); } break; @@ -4459,7 +4459,7 @@ void drawBoat(cell *c, const transmatrix*& Vboat, transmatrix& Vboat0, transmatr } void shmup_gravity_floor(cell *c) { - if(DIM == 2 && cellEdgeUnstable(c)) + if(GDIM == 2 && cellEdgeUnstable(c)) set_floor(cgi.shMFloor); else set_floor(cgi.shFullFloor); @@ -5037,10 +5037,10 @@ EX void drawcell(cell *c, transmatrix V, int spinv, bool mirrored) { if(!inmirrorcount) { transmatrix& gm = gmatrix[c]; orig = - gm[DIM][DIM] == 0 ? true : + gm[GDIM][GDIM] == 0 ? true : euwrap ? hdist0(tC0(gm)) >= hdist0(tC0(V)) : - sphereflipped() ? fabs(gm[DIM][DIM]-1) <= fabs(V[DIM][DIM]-1) : - fabs(gm[DIM][DIM]-1) >= fabs(V[DIM][DIM]-1) - 1e-8; + sphereflipped() ? fabs(gm[GDIM][GDIM]-1) <= fabs(V[GDIM][GDIM]-1) : + fabs(gm[GDIM][GDIM]-1) >= fabs(V[GDIM][GDIM]-1) - 1e-8; if(orig) gm = V; } @@ -5247,7 +5247,7 @@ EX void drawcell(cell *c, transmatrix V, int spinv, bool mirrored) { asciicol = wcol; - if(c->wall == waThumperOn && DIM == 2) { + if(c->wall == waThumperOn && GDIM == 2) { ld ds = fractick(160); for(int u=0; u<5; u++) { ld rad = cgi.hexf * (.3 * (u + ds)); @@ -5380,10 +5380,10 @@ EX void drawcell(cell *c, transmatrix V, int spinv, bool mirrored) { const transmatrix *Vdp = WDIM == 3 ? &V: !wmspatial ? &V : - sl ? &(Vd0= mscale(V, DIM == 3 ? cgi.SLEV[sl] - cgi.FLOOR : cgi.SLEV[sl])) : + sl ? &(Vd0= mscale(V, GDIM == 3 ? cgi.SLEV[sl] - cgi.FLOOR : cgi.SLEV[sl])) : (highwall(c) && GDIM == 2) ? &(Vd0= mscale(V, (1+cgi.WALL)/2)) : #if CAP_SHAPES - (chasmg==1) ? &(Vd0 = mscale(V, DIM == 3 ? cgi.LAKE - cgi.FLOOR : cgi.LAKE)) : + (chasmg==1) ? &(Vd0 = mscale(V, GDIM == 3 ? cgi.LAKE - cgi.FLOOR : cgi.LAKE)) : #endif &V; @@ -5409,7 +5409,7 @@ EX void drawcell(cell *c, transmatrix V, int spinv, bool mirrored) { // floor bool eoh = euclid || !BITRUNCATED; - if(DIM == 2 && (c->land != laRose || chaosmode)) { + if(GDIM == 2 && (c->land != laRose || chaosmode)) { int rd = rosedist(c); if(rd == 1) draw_floorshape(c, mmscale(V, cgi.SLEV[2]), cgi.shRoseFloor, 0x80406040, PPR::LIZEYE); @@ -5420,7 +5420,7 @@ EX void drawcell(cell *c, transmatrix V, int spinv, bool mirrored) { if(c->wall == waChasm) { zcol = 0; int rd = rosedist(c); - if(DIM == 2) { + if(GDIM == 2) { if(rd == 1) draw_floorshape(c, V, cgi.shRoseFloor, 0x80406020); if(rd == 2) @@ -5429,7 +5429,7 @@ EX void drawcell(cell *c, transmatrix V, int spinv, bool mirrored) { if(c->land == laZebra) fd++; if(c->land == laHalloween && !wmblack) { transmatrix Vdepth = wmspatial ? mscale(V, cgi.BOTTOM) : V; - if(DIM == 3) + if(GDIM == 3) draw_shapevec(c, V, cgi.shFullFloor.levels[SIDE_LAKE], darkena(firecolor(0, 10), 0, 0xDF), PPR::TRANSPARENT_LAKE); else draw_floorshape(c, Vdepth, cgi.shFullFloor, darkena(firecolor(0, 10), 0, 0xDF), PPR::LAKEBOTTOM); @@ -5456,7 +5456,7 @@ EX void drawcell(cell *c, transmatrix V, int spinv, bool mirrored) { set_floor(cgi.shFullFloor); #if CAP_TEXTURE - else if(DIM == 2 && texture::config.apply(c, Vf, darkena(fcol, fd, 0xFF))) ; + else if(GDIM == 2 && texture::config.apply(c, Vf, darkena(fcol, fd, 0xFF))) ; #endif else if(c->land == laMirrorWall) { @@ -5554,10 +5554,10 @@ EX void drawcell(cell *c, transmatrix V, int spinv, bool mirrored) { transmatrix Vdepth = mscale(V2, cgi.WALL); - queuepolyat(DIM == 2 ? Vdepth : V2, cgi.shSemiFloor[0], darkena(vcol, fd, 0xFF), PPR::WALL3A); - {dynamicval p(poly_outline, OUTLINE_TRANS); queuepolyat(V2 * spin(M_PI*2/3), cgi.shSemiFloorShadow, SHADOW_WALL, DIM == 2 ? PPR::WALLSHADOW : PPR::TRANSPARENT_SHADOW); } + queuepolyat(GDIM == 2 ? Vdepth : V2, cgi.shSemiFloor[0], darkena(vcol, fd, 0xFF), PPR::WALL3A); + {dynamicval p(poly_outline, OUTLINE_TRANS); queuepolyat(V2 * spin(M_PI*2/3), cgi.shSemiFloorShadow, SHADOW_WALL, GDIM == 2 ? PPR::WALLSHADOW : PPR::TRANSPARENT_SHADOW); } auto& side = queuepolyat(V2, cgi.shSemiFloorSide[SIDE_WALL], darkena(vcol, fd, 0xFF), PPR::WALL3A-2+away(V2)); - if(DIM == 3 && qfi.fshape) side.tinf = &floor_texture_vertices[shar.id]; + if(GDIM == 3 && qfi.fshape) side.tinf = &floor_texture_vertices[shar.id]; if(cgi.validsidepar[SIDE_WALL]) forCellIdEx(c2, j, c) { int dis = i-j; @@ -5654,7 +5654,7 @@ EX void drawcell(cell *c, transmatrix V, int spinv, bool mirrored) { break; case laMountain: - if(shmup::on || DIM == 3) + if(shmup::on || GDIM == 3) shmup_gravity_floor(c); else set_towerfloor(c, euclid ? celldist : c->master->alt ? celldistAltPlus : celldist); @@ -5740,7 +5740,7 @@ EX void drawcell(cell *c, transmatrix V, int spinv, bool mirrored) { break; case laDryForest: - set_floor(DIM == 3 ? cgi.shFeatherFloor : cgi.shDesertFloor); + set_floor(GDIM == 3 ? cgi.shFeatherFloor : cgi.shDesertFloor); break; case laDesert: @@ -5775,7 +5775,7 @@ EX void drawcell(cell *c, transmatrix V, int spinv, bool mirrored) { break; case laMercuryRiver: { - if(eoh || DIM == 3) + if(eoh || GDIM == 3) set_floor(cgi.shFloor); else { int bridgedir = -1; @@ -5808,9 +5808,9 @@ EX void drawcell(cell *c, transmatrix V, int spinv, bool mirrored) { if(c->wall != waFloorB && c->wall != waFloorA && c->wall != waMirror && c->wall != waCloud) { fd = 1; set_floor(cgi.shFloor); - if(c->wall != waMirror && c->wall != waCloud && DIM == 2) + if(c->wall != waMirror && c->wall != waCloud && GDIM == 2) draw_floorshape(c, V, cgi.shMFloor, darkena(fcol, 2, 0xFF), PPR::FLOORa); - if(c->wall != waMirror && c->wall != waCloud && DIM == 2) + if(c->wall != waMirror && c->wall != waCloud && GDIM == 2) draw_floorshape(c, V, cgi.shMFloor2, darkena(fcol, fcol==wcol ? 1 : 2, 0xFF), PPR::FLOORb); } else @@ -5818,7 +5818,7 @@ EX void drawcell(cell *c, transmatrix V, int spinv, bool mirrored) { break; case laEndorian: - if(shmup::on || DIM == 3) + if(shmup::on || GDIM == 3) shmup_gravity_floor(c); else if(c->wall == waTrunk) @@ -5832,7 +5832,7 @@ EX void drawcell(cell *c, transmatrix V, int spinv, bool mirrored) { break; case laIvoryTower: case laDungeon: case laWestWall: - if(shmup::on || DIM == 3) + if(shmup::on || GDIM == 3) shmup_gravity_floor(c); else set_towerfloor(c); @@ -5966,7 +5966,7 @@ EX void drawcell(cell *c, transmatrix V, int spinv, bool mirrored) { vid.darkhepta || (c->land == laClearing && !BITRUNCATED))) { #if MAXMDIM >= 4 - if(DIM == 3 && WDIM == 2) + if(GDIM == 3 && WDIM == 2) queuepoly((*Vdp)*zpush(cgi.FLOOR), cgi.shHeptaMarker, wmblack ? 0x80808080 : 0x00000080); else #endif @@ -6102,15 +6102,15 @@ EX void drawcell(cell *c, transmatrix V, int spinv, bool mirrored) { break; case waSolidBranch: - queuepoly(DIM == 3 ? mscale(V, cgi.BODY) : V, cgi.shSolidBranch, darkena(wcol, 0, 0xFF)); + queuepoly(GDIM == 3 ? mscale(V, cgi.BODY) : V, cgi.shSolidBranch, darkena(wcol, 0, 0xFF)); break; case waWeakBranch: - queuepoly(DIM == 3 ? mscale(V, cgi.BODY) : V, cgi.shWeakBranch, darkena(wcol, 0, 0xFF)); + queuepoly(GDIM == 3 ? mscale(V, cgi.BODY) : V, cgi.shWeakBranch, darkena(wcol, 0, 0xFF)); break; case waLadder: - if(DIM == 3) { + if(GDIM == 3) { #if MAXMDIM >= 4 draw_shapevec(c, V * zpush(-cgi.human_height/20), cgi.shMFloor.levels[0], 0x804000FF, PPR::FLOOR+1); #endif @@ -6176,7 +6176,7 @@ EX void drawcell(cell *c, transmatrix V, int spinv, bool mirrored) { case waClosePlate: case waOpenPlate: { transmatrix V2 = V; if(wmescher && geosupport_football() == 2 && pseudohept(c) && c->land == laPalace) V2 = V * spin(M_PI / c->type); - if(DIM == 3) { + if(GDIM == 3) { #if MAXMDIM >= 4 draw_shapevec(c, V2 * zpush(-cgi.human_height/40), cgi.shMFloor.levels[0], darkena(winf[c->wall].color, 0, 0xFF)); draw_shapevec(c, V2 * zpush(-cgi.human_height/35), cgi.shMFloor2.levels[0], (!wmblack) ? darkena(fcol, 1, 0xFF) : darkena(0,1,0xFF)); @@ -6226,7 +6226,7 @@ EX void drawcell(cell *c, transmatrix V, int spinv, bool mirrored) { color_t col = winf[waGlass].color; int dcol = darkena(col, 0, 0x80); transmatrix Vdepth = mscale((*Vdp), cgi.WALL); - if(DIM == 3) + if(GDIM == 3) draw_shapevec(c, V, cgi.shMFloor.levels[SIDE_WALL], dcol, PPR::WALL); else draw_floorshape(c, Vdepth, cgi.shMFloor, dcol, PPR::WALL); // GLASS @@ -6239,7 +6239,7 @@ EX void drawcell(cell *c, transmatrix V, int spinv, bool mirrored) { case waFan: #if MAXMDIM >= 4 - if(DIM == 3) + if(GDIM == 3) for(int a=0; a<10; a++) queuepoly(V * zpush(cgi.FLOOR + (cgi.WALL - cgi.FLOOR) * a/10.) * spin(a *degree) * spintick(PURE ? -1000 : -500, 1/12.), cgi.shFan, darkena(wcol, 0, 0xFF)); else @@ -6255,7 +6255,7 @@ EX void drawcell(cell *c, transmatrix V, int spinv, bool mirrored) { case waFireTrap: - if(DIM == 3) { + if(GDIM == 3) { #if MAXMDIM >= 4 draw_shapevec(c, V * zpush(-cgi.human_height/40), cgi.shMFloor.levels[0], darkena(0xC00000, 0, 0xFF)); draw_shapevec(c, V * zpush(-cgi.human_height/20), cgi.shMFloor2.levels[0], darkena(0x600000, 0, 0xFF)); @@ -6270,9 +6270,9 @@ EX void drawcell(cell *c, transmatrix V, int spinv, bool mirrored) { break; case waGiantRug: - queuepoly(V, cgi.shBigCarpet1, darkena(DIM == 3 ? 0 : 0xC09F00, 0, 0xFF)); - queuepoly(V, cgi.shBigCarpet2, darkena(DIM == 3 ? 0xC09F00 : 0x600000, 0, 0xFF)); - queuepoly(V, cgi.shBigCarpet3, darkena(DIM == 3 ? 0x600000 : 0xC09F00, 0, 0xFF)); + queuepoly(V, cgi.shBigCarpet1, darkena(GDIM == 3 ? 0 : 0xC09F00, 0, 0xFF)); + queuepoly(V, cgi.shBigCarpet2, darkena(GDIM == 3 ? 0xC09F00 : 0x600000, 0, 0xFF)); + queuepoly(V, cgi.shBigCarpet3, darkena(GDIM == 3 ? 0x600000 : 0xC09F00, 0, 0xFF)); break; case waBarrier: @@ -6313,7 +6313,7 @@ EX void drawcell(cell *c, transmatrix V, int spinv, bool mirrored) { wa_default: if(sl && wmspatial) { - if(DIM == 3 && qfi.fshape) + if(GDIM == 3 && qfi.fshape) draw_shapevec(c, V, qfi.fshape->levels[sl], darkena(wcol, fd, 0xFF), PPR::REDWALL-4+4*sl); else draw_qfi(c, (*Vdp), darkena(wcol, fd, 0xFF), PPR::REDWALL-4+4*sl); @@ -6337,7 +6337,7 @@ EX void drawcell(cell *c, transmatrix V, int spinv, bool mirrored) { color_t col = winf[c->wall].color; int dcol = darkena(col, 0, 0xC0); transmatrix Vdepth = mscale((*Vdp), cgi.WALL); - if(DIM == 3) + if(GDIM == 3) draw_shapevec(c, V, cgi.shMFloor.levels[SIDE_WALL], dcol, PPR::WALL); else draw_floorshape(c, Vdepth, cgi.shMFloor, dcol, PPR::WALL); // GLASS @@ -6353,7 +6353,7 @@ EX void drawcell(cell *c, transmatrix V, int spinv, bool mirrored) { } else if(c->wall == waExplosiveBarrel) { - if(DIM == 3 && qfi.fshape) { + if(GDIM == 3 && qfi.fshape) { draw_shapevec(c, V, qfi.fshape->cone[1], 0xD00000FF, PPR::REDWALL); dynamicval p(poly_outline, OUTLINE_TRANS); draw_shapevec(c, V, qfi.fshape->shadow, SHADOW_WALL, PPR::WALLSHADOW); @@ -6460,7 +6460,7 @@ EX void drawcell(cell *c, transmatrix V, int spinv, bool mirrored) { int t = (ticks - fa.t_floor); if(t <= maxtime) { erase = false; - if(DIM == 3) + if(GDIM == 3) draw_shapevec(c, V, qfi.fshape->levels[0], darkena(fcol, fd, 0xFF), PPR::WALL); else if(fa.walltype == waNone) { draw_qfi(c, V, darkena(fcol, fd, 0xFF), PPR::FLOOR); @@ -6691,7 +6691,7 @@ EX void drawcell(cell *c, transmatrix V, int spinv, bool mirrored) { #if CAP_EDIT if((cmode & sm::MAP) && lmouseover && darken == 0 && - (DIM == 3 || !mouseout()) && + (GDIM == 3 || !mouseout()) && (patterns::whichPattern ? patterns::getpatterninfo0(c).id == patterns::getpatterninfo0(lmouseover).id : c == lmouseover)) { queuecircleat(c, .78, 0x00FFFFFF); } @@ -6724,7 +6724,7 @@ struct flashdata { flashdata(int _t, int _s, cell *_w, color_t col, int sped) { t=_t; size=_s; where=_w; color = col; angle = rand() % 1000; spd = sped; - if(DIM == 3) angle2 = acos((rand() % 1000 - 499.5) / 500); + if(GDIM == 3) angle2 = acos((rand() % 1000 - 499.5) / 500); } }; @@ -6933,7 +6933,7 @@ EX void drawMarkers() { // process mouse #if CAP_SHAPES - if((vid.axes == 4 || (vid.axes == 1 && !mousing)) && !shmup::on && DIM == 2) { + if((vid.axes == 4 || (vid.axes == 1 && !mousing)) && !shmup::on && GDIM == 2) { if(multi::players == 1) { forCellIdAll(c2, d, cwt.at) IG(c2) drawMovementArrows(c2, confusingGeometry() ? Gm(cwt.at) * calc_relative_matrix(c2, cwt.at, d) : Gm(c2)); } @@ -7030,11 +7030,11 @@ void drawFlashes() { if(f.spd) { #if CAP_SHAPES kill = tim > 300; - int partcol = darkena(f.color, 0, DIM == 3 ? 255 : max(255 - tim*255/300, 0)); + int partcol = darkena(f.color, 0, GDIM == 3 ? 255 : max(255 - tim*255/300, 0)); poly_outline = OUTLINE_DEFAULT; ld t = f.spd * tim * cgi.scalefactor / 50000.; transmatrix T = - DIM == 2 ? V * spin(f.angle) * xpush(t) : + GDIM == 2 ? V * spin(f.angle) * xpush(t) : V * cspin(0, 1, f.angle) * cspin(0, 2, f.angle2) * cpush(2, t); queuepoly(T, cgi.shParticle[f.size], partcol); #endif @@ -7051,7 +7051,7 @@ void drawFlashes() { if(u > 500) flashcol = gradient(flashcol, 0, 500, u, 1100); flashcol = darkena(flashcol, 0, 0xFF); #if MAXMDIM >= 4 - if(DIM == 3) + if(GDIM == 3) queueball(V * zpush(cgi.GROIN1), rad, flashcol, itDiamond); else #endif @@ -7072,7 +7072,7 @@ void drawFlashes() { if(u > 1000) flashcol = gradient(flashcol, 0, 1000, u, 2200); flashcol = darkena(flashcol, 0, 0xFF); #if MAXMDIM >= 4 - if(DIM == 3) + if(GDIM == 3) queueball(V * zpush(cgi.GROIN1), rad, flashcol, itRuby); else #endif @@ -7140,7 +7140,7 @@ EX ld wall_radar(cell *c, transmatrix T, ld max) { EX void make_actual_view() { sphereflip = Id; - if(sphereflipped()) sphereflip[DIM][DIM] = -1; + if(sphereflipped()) sphereflip[GDIM][GDIM] = -1; actual_view_transform = sphereflip; if(vid.yshift && WDIM == 2) actual_view_transform = ypush(vid.yshift) * actual_view_transform; #if MAXMDIM >= 4 @@ -7229,7 +7229,7 @@ EX void drawthemap() { last_firelimit = firelimit; firelimit = 0; - if(DIM == 3) make_clipping_planes(); + if(GDIM == 3) make_clipping_planes(); radarpoints.clear(); radarlines.clear(); callhooks(hooks_drawmap); @@ -7260,7 +7260,7 @@ EX void drawthemap() { mmspatial = vid.monmode == 4 || vid.monmode == 5; spatial_graphics = wmspatial || mmspatial; - spatial_graphics = spatial_graphics && DIM == 2; + spatial_graphics = spatial_graphics && GDIM == 2; #if CAP_RUG if(rug::rugged && !rug::spatial_rug) spatial_graphics = false; #endif @@ -7269,7 +7269,7 @@ EX void drawthemap() { if(pmodel == mdDisk && abs(vid.alpha) < 1e-6) spatial_graphics = false; if(!spatial_graphics) wmspatial = mmspatial = false; - if(DIM == 3) wmspatial = mmspatial = true; + if(GDIM == 3) wmspatial = mmspatial = true; for(int m=0; mradius = vid.scale * cd->scrsize; - if(DIM == 3 && in_perspective()) cd->radius = cd->scrsize; + if(GDIM == 3 && in_perspective()) cd->radius = cd->scrsize; realradius = min(realradius, cd->radius); if(dronemode) { cd->ycenter -= cd->radius; cd->ycenter += vid.fsize/2; cd->ycenter += vid.fsize/2; cd->radius *= 2; } @@ -7634,7 +7634,7 @@ EX void gamescreen(int _darken) { } else { if(!haveMobileCompass()) displayabutton(-1, +1, XLAT(andmode == 0 && useRangedOrb ? "FIRE" : andmode == 0 && WDIM == 3 && wclick ? "WAIT" : "MOVE"), andmode == 0 ? BTON : BTOFF); - displayabutton(+1, +1, rug::rugged ? "RUG" : XLAT(andmode == 1 ? "BACK" : DIM == 3 ? "CAM" : "DRAG"), andmode == 1 ? BTON : BTOFF); + displayabutton(+1, +1, rug::rugged ? "RUG" : XLAT(andmode == 1 ? "BACK" : GDIM == 3 ? "CAM" : "DRAG"), andmode == 1 ? BTON : BTOFF); } displayabutton(-1, -1, XLAT("INFO"), andmode == 12 ? BTON : BTOFF); displayabutton(+1, -1, XLAT("MENU"), andmode == 3 ? BTON : BTOFF); @@ -7661,7 +7661,7 @@ EX void normalscreen() { if(tour::on) mouseovers = tour::tourhelp; #endif - if(DIM == 3 || !outofmap(mouseh)) getcstat = '-'; + if(GDIM == 3 || !outofmap(mouseh)) getcstat = '-'; cmode = sm::NORMAL | sm::DOTOUR | sm::CENTER; if(viewdists && show_distance_lists) cmode |= sm::SIDE | sm::MAYDARK; gamescreen(hiliteclick && mmmon ? 1 : 0); drawStats(); diff --git a/hud.cpp b/hud.cpp index 3127b5f0..3005975e 100644 --- a/hud.cpp +++ b/hud.cpp @@ -190,7 +190,7 @@ int glyphflags(int gid) { } EX bool graphglyph() { - // if(DIM == 3) return false; + // if(GDIM == 3) return false; return vid.graphglyph == 2 || (vid.graphglyph == 1 && vid.monmode); } @@ -216,7 +216,7 @@ bool displayglyph(int cx, int cy, int buttonsize, char glyph, color_t color, int if(m == moSlime) bsize = (2*bsize+1)/3; transmatrix V = atscreenpos(cx+buttonsize/2, cy, bsize*zoom); if(isWorm(m) && cgi.wormscale != 1) - for(int i=0; i> 2; @@ -480,7 +480,7 @@ EX void drawStats() { bool h = hide_player(); { - dynamicval pm(pmodel, DIM == 3 ? mdFlatten : mdDisk); + dynamicval pm(pmodel, GDIM == 3 ? mdFlatten : mdDisk); // dynamicval v(vid, vid); // vid.alpha = vid.scale = 1; dynamicval va(vid.alpha, 1); diff --git a/hyper.h b/hyper.h index 1afc28b1..274be69f 100644 --- a/hyper.h +++ b/hyper.h @@ -328,8 +328,7 @@ extern videopar vid; #define WDIM ((geometry >= gBinary3 && geometry != gBinary4 && geometry != gKiteDart2 PROD(&& geometry != gProduct)) ? 3 : 2) #endif #define GDIM (vid.always3 ? 3 : WDIM) -#define DIM GDIM -#define MDIM (DIM+1) +#define MDIM (GDIM+1) #define self (*this) diff --git a/hyperpoint.cpp b/hyperpoint.cpp index ac77b553..72c57a44 100644 --- a/hyperpoint.cpp +++ b/hyperpoint.cpp @@ -132,15 +132,15 @@ const static transmatrix pispin = diag(-1,-1,1,1); // central symmetry const static transmatrix centralsym = diag(-1,-1,-1,-1); -inline hyperpoint hpxyz(ld x, ld y, ld z) { return DIM == 2 ? hyperpoint(x,y,z,0) : hyperpoint(x,y,0,z); } -inline hyperpoint hpxyz3(ld x, ld y, ld z, ld w) { return DIM == 2 ? hyperpoint(x,y,w,0) : hyperpoint(x,y,z,w); } +inline hyperpoint hpxyz(ld x, ld y, ld z) { return GDIM == 2 ? hyperpoint(x,y,z,0) : hyperpoint(x,y,0,z); } +inline hyperpoint hpxyz3(ld x, ld y, ld z, ld w) { return GDIM == 2 ? hyperpoint(x,y,w,0) : hyperpoint(x,y,z,w); } inline hyperpoint point3(ld x, ld y, ld z) { return hyperpoint(x,y,z,0); } inline hyperpoint point31(ld x, ld y, ld z) { return hyperpoint(x,y,z,1); } inline hyperpoint point2(ld x, ld y) { return hyperpoint(x,y,0,0); } extern const hyperpoint C02, C03; -#define C0 (DIM == 2 ? C02 : C03) +#define C0 (GDIM == 2 ? C02 : C03) #endif // basic functions and types @@ -469,7 +469,7 @@ EX transmatrix matrix3(ld a, ld b, ld c, ld d, ld e, ld f, ld g, ld h, ld i) { #if MAXMDIM==3 return transmatrix {{{a,b,c},{d,e,f},{g,h,i}}}; #else - if(DIM == 2) + if(GDIM == 2) return transmatrix {{{a,b,c,0},{d,e,f,0},{g,h,i,0},{0,0,0,1}}}; else return transmatrix {{{a,b,0,c},{d,e,0,f},{0,0,1,0},{g,h,0,i}}}; @@ -488,7 +488,7 @@ EX transmatrix matrix4(ld a, ld b, ld c, ld d, ld e, ld f, ld g, ld h, ld i, ld EX void swapmatrix(transmatrix& T) { for(int i=0; i<4; i++) swap(T[i][2], T[i][3]); for(int i=0; i<4; i++) swap(T[2][i], T[3][i]); - if(DIM == 3) { + if(GDIM == 3) { for(int i=0; i<4; i++) T[i][2] = T[2][i] = 0; T[2][2] = 1; } @@ -795,7 +795,7 @@ EX hyperpoint mscale(const hyperpoint& t, double fac) { EX transmatrix mscale(const transmatrix& t, double fac) { if(GDIM == 3) { - // if(pmodel == mdFlatten) { transmatrix u = t; u[2][DIM] -= fac; return u; } + // if(pmodel == mdFlatten) { transmatrix u = t; u[2][GDIM] -= fac; return u; } return t * cpush(2, fac); } transmatrix res; @@ -869,7 +869,7 @@ EX hyperpoint orthogonal_of_C0(hyperpoint h0, hyperpoint h1, hyperpoint h2) { } EX hyperpoint zshift(hyperpoint x, ld z) { - if(DIM == 3 && WDIM == 2) return rgpushxto0(x) * cpush0(2, z); + if(GDIM == 3 && WDIM == 2) return rgpushxto0(x) * cpush0(2, z); else return mscale(x, z); } @@ -950,7 +950,7 @@ inline hyperpoint ypush0(ld x) { return cpush0(1, x); } // T * C0, optimized inline hyperpoint tC0(const transmatrix &T) { hyperpoint z; - for(int i=0; i 1.1 && DIM == 3; } +inline bool sphereflipped() { return sphere && vid.alpha > 1.1 && GDIM == 3; } #endif void ghcheck(hyperpoint &ret, const hyperpoint &H) { @@ -66,7 +66,7 @@ hyperpoint perspective_to_space(hyperpoint h, ld alpha, eGeometryClass gc) { hyperpoint H; H[0] = hx * (hz+vid.alpha); H[1] = hy * (hz+vid.alpha); - H[DIM] = hz; + H[GDIM] = hz; return H; } @@ -74,10 +74,10 @@ hyperpoint perspective_to_space(hyperpoint h, ld alpha, eGeometryClass gc) { hyperpoint space_to_perspective(hyperpoint z, ld alpha = vid.alpha); hyperpoint space_to_perspective(hyperpoint z, ld alpha) { - ld s = 1 / (alpha + z[DIM]); + ld s = 1 / (alpha + z[GDIM]); z[0] *= s; z[1] *= s; - if(DIM == 3) { + if(GDIM == 3) { z[2] *= s; z[3] = 0; } @@ -103,7 +103,7 @@ EX hyperpoint gethyper(ld x, ld y) { void ballmodel(hyperpoint& ret, double alpha, double d, double zl) { hyperpoint H = ypush(vid.camera) * xpush(d) * ypush(zl) * C0; - ld tzh = vid.ballproj + H[DIM]; + ld tzh = vid.ballproj + H[GDIM]; ld ax = H[0] / tzh; ld ay = H[1] / tzh; @@ -166,7 +166,7 @@ ld find_zlev(hyperpoint& H) { } ld get_tz(hyperpoint H) { - ld tz = euclid ? (1+vid.alpha) : vid.alpha+H[DIM]; + ld tz = euclid ? (1+vid.alpha) : vid.alpha+H[GDIM]; if(tz < BEHIND_LIMIT && tz > -BEHIND_LIMIT) tz = BEHIND_LIMIT; return tz; } @@ -176,7 +176,7 @@ EX ld atan2(hyperpoint h) { } pair move_z_to_y(hyperpoint& H) { - if(DIM == 2) return make_pair(0, 0); + if(GDIM == 2) return make_pair(0, 0); ld R = hypot(H[1], H[2]); pair res = { H[1] / R, H[2] / R }; H[1] = R; H[2] = 0; @@ -184,7 +184,7 @@ pair move_z_to_y(hyperpoint& H) { } void move_y_to_z(hyperpoint& H, pair coef) { - if(DIM == 3) { + if(GDIM == 3) { H[2] = H[1] * coef.second; H[1] = H[1] * coef.first; H[3] = 1; @@ -201,8 +201,8 @@ template void makeband(hyperpoint H, hyperpoint& ret, const T& f) { y = asin_auto(H[1]); x = asin_auto_clamp(H[0] / cos_auto(y)); if(sphere) { - if(H[DIM] < 0 && x > 0) x = M_PI - x; - else if(H[DIM] < 0 && x <= 0) x = -M_PI - x; + if(H[GDIM] < 0 && x > 0) x = M_PI - x; + else if(H[GDIM] < 0 && x <= 0) x = -M_PI - x; } x += band_shift; hypot_zlev(zlev, y, yf, zf); @@ -356,7 +356,7 @@ EX void applymodel(hyperpoint H, hyperpoint& ret) { if(!vid.camera_angle) { ret[0] = H[0] / tz; ret[1] = H[1] / tz; - if(DIM == 3) ret[2] = H[2] / tz; + if(GDIM == 3) ret[2] = H[2] / tz; else ret[2] = vid.xres * current_display->eyewidth() / 2 / current_display->radius - vid.ipd / tz / 2; if(MAXMDIM == 4) ret[3] = 1; } @@ -376,10 +376,10 @@ EX void applymodel(hyperpoint H, hyperpoint& ret) { case mdCentralInversion: { ld tz = get_tz(H); - for(int d=0; dstereo_active()) apply_depth(ret, -H[1] * geom3::factor_to_lev(zlev)); @@ -495,9 +495,9 @@ EX void applymodel(hyperpoint H, hyperpoint& ret) { case mdFisheye: { ld zlev = find_zlev(H); H = space_to_perspective(H); - H[DIM] = zlev; - ret = H / sqrt(1 + sqhypot_d(DIM+1, H)); - if(DIM == 3) ret[DIM] = zlev; + H[GDIM] = zlev; + ret = H / sqrt(1 + sqhypot_d(GDIM+1, H)); + if(GDIM == 3) ret[GDIM] = zlev; break; } @@ -716,7 +716,7 @@ EX void applymodel(hyperpoint H, hyperpoint& ret) { } ld zlev = find_zlev(H); - ld rad = hypot_d(DIM, H); + ld rad = hypot_d(GDIM, H); if(rad == 0) rad = 1; ld d = hdist0(H); ld df, zf; @@ -732,7 +732,7 @@ EX void applymodel(hyperpoint H, hyperpoint& ret) { d = sqrt(2*(cosh(d) - 1)) / 1.5; ret = H * (d * df / rad / M_PI); - if(DIM == 2) ret[2] = 0; + if(GDIM == 2) ret[2] = 0; if(MAXMDIM == 4) ret[3] = 1; if(zlev != 1 && current_display->stereo_active()) apply_depth(ret, d * zf / M_PI); @@ -866,11 +866,11 @@ EX bool behindsphere(const hyperpoint& h) { if(mdBandAny()) return false; if(vid.alpha > 1) { - if(h[DIM] > -1/vid.alpha) return true; + if(h[GDIM] > -1/vid.alpha) return true; } if(vid.alpha <= 1) { - if(h[DIM] < .2-vid.alpha) return true; + if(h[GDIM] < .2-vid.alpha) return true; } return false; @@ -945,15 +945,15 @@ void raise_error() { } EX bool invalid_matrix(const transmatrix T) { - for(int i=0; i 1e8 || T[i][j] < -1e8 || std::isinf(T[i][j])) return true; - for(int i=0; i .5 || T[i][j] < -.5) return false; + for(int i=0; i .5 || T[i][j] < -.5) return false; return true; } EX bool invalid_point(const hyperpoint h) { - return std::isnan(h[DIM]) || h[DIM] > 1e8 || std::isinf(h[DIM]); + return std::isnan(h[GDIM]) || h[GDIM] > 1e8 || std::isinf(h[GDIM]); } EX bool in_smart_range(const transmatrix& T) { @@ -971,7 +971,7 @@ EX bool in_smart_range(const transmatrix& T) { if(x < current_display->xtop - current_display->xsize * 1) return false; if(y > current_display->ytop + current_display->ysize * 2) return false; if(y < current_display->ytop - current_display->ysize * 1) return false; - if(DIM == 3) { + if(GDIM == 3) { if(-h1[2] < models::clip_min * 2 - models::clip_max) return false; if(-h1[2] > models::clip_max * 2 - models::clip_min) return false; } @@ -979,19 +979,19 @@ EX bool in_smart_range(const transmatrix& T) { ld epsilon = 0.01; ld dx = 0, dy = 0, dz = 0, dh[MAXMDIM]; - for(int i=0; iradius * abs(h2[0] - h1[0]) / epsilon; ld y1 = current_display->radius * abs(h2[1] - h1[1]) * vid.stretch / epsilon; dx = max(dx, x1); dy = max(dy, y1); - if(DIM == 3) dz = max(dz, abs(h2[2] - h1[2])); + if(GDIM == 3) dz = max(dz, abs(h2[2] - h1[2])); dh[i] = hypot(x1, y1); } - if(DIM == 3) { + if(GDIM == 3) { if(-h1[2] + 2 * dz < models::clip_min || -h1[2] - 2 * dz > models::clip_max) return false; - sort(dh, dh+DIM); + sort(dh, dh+GDIM); ld scale = sqrt(dh[1] * dh[2]) * cgi.scalefactor * hcrossf7; if(scale <= (WDIM == 2 ? vid.smart_range_detail : vid.smart_range_detail_3)) return false; } @@ -1175,25 +1175,25 @@ int mindx=-7, mindy=-7, maxdx=7, maxdy=7; EX transmatrix eumove(ld x, ld y) { transmatrix Mat = Id; - Mat[DIM][DIM] = 1; + Mat[GDIM][GDIM] = 1; if(a4) { - Mat[0][DIM] += x * cgi.crossf; - Mat[1][DIM] += y * cgi.crossf; + Mat[0][GDIM] += x * cgi.crossf; + Mat[1][GDIM] += y * cgi.crossf; } else { - Mat[0][DIM] += (x + y * .5) * cgi.crossf; - // Mat[DIM][0] += (x + y * .5) * cgi.crossf; - Mat[1][DIM] += y * q3 /2 * cgi.crossf; - // Mat[DIM][1] += y * q3 /2 * cgi.crossf; + Mat[0][GDIM] += (x + y * .5) * cgi.crossf; + // Mat[GDIM][0] += (x + y * .5) * cgi.crossf; + Mat[1][GDIM] += y * q3 /2 * cgi.crossf; + // Mat[GDIM][1] += y * q3 /2 * cgi.crossf; } ld v = a4 ? 1 : q3; - while(Mat[0][DIM] <= -16384 * cgi.crossf) Mat[0][DIM] += 32768 * cgi.crossf; - while(Mat[0][DIM] >= 16384 * cgi.crossf) Mat[0][DIM] -= 32768 * cgi.crossf; - while(Mat[1][DIM] <= -16384 * v * cgi.crossf) Mat[1][DIM] += 32768 * v * cgi.crossf; - while(Mat[1][DIM] >= 16384 * v * cgi.crossf) Mat[1][DIM] -= 32768 * v * cgi.crossf; + while(Mat[0][GDIM] <= -16384 * cgi.crossf) Mat[0][GDIM] += 32768 * cgi.crossf; + while(Mat[0][GDIM] >= 16384 * cgi.crossf) Mat[0][GDIM] -= 32768 * cgi.crossf; + while(Mat[1][GDIM] <= -16384 * v * cgi.crossf) Mat[1][GDIM] += 32768 * v * cgi.crossf; + while(Mat[1][GDIM] >= 16384 * v * cgi.crossf) Mat[1][GDIM] -= 32768 * v * cgi.crossf; return Mat; } @@ -1234,7 +1234,7 @@ EX void spinEdge(ld aspd) { transmatrix their = dual::player_orientation[dual::main_side]; fixmatrix(our); fixmatrix(their); - if(DIM == 2) { + if(GDIM == 2) { transmatrix T = their * inverse(our); hyperpoint H = T * xpush0(1); downspin = -atan2(H[1], H[0]); @@ -1289,7 +1289,7 @@ EX void centerpc(ld aspd) { #endif #if MAXMDIM >= 4 - if(shmup::on && vid.sspeed > -5 && DIM == 3) { + if(shmup::on && vid.sspeed > -5 && GDIM == 3) { int id = subscreens::in ? subscreens::current_player : 0; if(masterless) centerover = shmup::pc[id]->base; else viewctr = shmup::pc[id]->base->master; @@ -1320,7 +1320,7 @@ EX void centerpc(ld aspd) { } #endif hyperpoint H = inverse(actual_view_transform) * tC0(T); - ld R = zero_d(DIM, H) ? 0 : hdist0(H); + ld R = zero_d(GDIM, H) ? 0 : hdist0(H); if(R < 1e-9) { // either already centered or direction unknown /* if(playerfoundL && playerfoundR) { @@ -1337,8 +1337,8 @@ EX void centerpc(ld aspd) { aspd *= (2+3*R*R); if(aspd > R) aspd = R; - for(int i=0; i= 0) { @@ -1704,7 +1704,7 @@ EX void draw_boundary(int w) { } case mdBand: case mdBandEquidistant: case mdBandEquiarea: case mdSinusoidal: case mdMollweide: case mdCentralCyl: case mdCollignon: { - if(DIM == 3) return; + if(GDIM == 3) return; if(pmodel == mdBand && models::model_transition != 1) return; bool bndband = ((pmodel == mdBand) ? hyperbolic : sphere); transmatrix T = spin(-models::model_orientation * degree); @@ -1730,7 +1730,7 @@ EX void draw_boundary(int w) { } case mdHalfplane: - if(hyperbolic && DIM == 2) { + if(hyperbolic && GDIM == 2) { queuestraight(xspinpush0(-models::model_orientation * degree - M_PI/2, fakeinf), 1, lc, fc, p); return; } @@ -1855,7 +1855,7 @@ EX void draw_boundary(int w) { EX ld band_shift = 0; EX void fix_the_band(transmatrix& T) { - if(((mdinf[pmodel].flags & mf::uses_bandshift) && T[DIM][DIM] > 1e6) || (sphere && pmodel == mdSpiral)) { + if(((mdinf[pmodel].flags & mf::uses_bandshift) && T[GDIM][GDIM] > 1e6) || (sphere && pmodel == mdSpiral)) { hyperpoint H = tC0(T); find_zlev(H); models::apply_orientation(H[0], H[1]); @@ -1863,8 +1863,8 @@ EX void fix_the_band(transmatrix& T) { ld y = asin_auto(H[1]); ld x = asin_auto_clamp(H[0] / cos_auto(y)); if(sphere) { - if(H[DIM] < 0 && x > 0) x = M_PI - x; - else if(H[DIM] < 0 && x <= 0) x = -M_PI - x; + if(H[GDIM] < 0 && x > 0) x = M_PI - x; + else if(H[GDIM] < 0 && x <= 0) x = -M_PI - x; } band_shift += x; T = xpush(-x) * T; diff --git a/init.cpp b/init.cpp index 0097c4e9..7d94f738 100644 --- a/init.cpp +++ b/init.cpp @@ -201,7 +201,7 @@ void handleclick(MOBPAR_FORMAL) { } else if(!forcetarget) { if(WDIM == 3 && wclick) movepcto(-1); - else if(DIM == 3) mousemovement(); + else if(GDIM == 3) mousemovement(); else movepcto(mousedest); } } @@ -268,7 +268,7 @@ void mobile_draw(MOBPAR_FORMAL) { ors::check_orientation(); - if(DIM == 3 && !shmup::on && !rug::rugged) + if(GDIM == 3 && !shmup::on && !rug::rugged) apply_orientation(); if(playermoved && vid.sspeed > -4.99) @@ -377,7 +377,7 @@ void mobile_draw(MOBPAR_FORMAL) { if(lclicked && !clicked) { if(rug::rugged) rug::select(); - else if((ors::mode || DIM == 3) && !verylongclick) + else if((ors::mode || GDIM == 3) && !verylongclick) normal_reaction = true; else pushScreen(showStereo); @@ -400,7 +400,7 @@ void mobile_draw(MOBPAR_FORMAL) { static int lticks_rug; if(clicked && lclicked && andmode == 1 && normal_reaction) { - if(DIM == 3 && !rug::rugged) { + if(GDIM == 3 && !rug::rugged) { View = cpush(2, -(ticks - lticks_rug) / 2500.) * View; playermoved = false; } diff --git a/inventory.cpp b/inventory.cpp index 44d6e59d..8c5b4c84 100644 --- a/inventory.cpp +++ b/inventory.cpp @@ -480,7 +480,7 @@ EX namespace inv { int j = 0, oc = 6; if(1) { - dynamicval pm(pmodel, DIM == 3 ? mdFlatten : mdDisk); + dynamicval pm(pmodel, GDIM == 3 ? mdFlatten : mdDisk); // dynamicval v(vid, vid); // vid.alpha = vid.scale = 1; dynamicval va(vid.alpha, 1); diff --git a/landgen.cpp b/landgen.cpp index 64fec5c6..40ab7ad8 100644 --- a/landgen.cpp +++ b/landgen.cpp @@ -507,7 +507,7 @@ EX void giantLandSwitch(cell *c, int d, cell *from) { } } - if(d == 7 && c->wall == waCavewall && hrand_monster(DIM == 2 ? 5000 : 40000) < items[itEmerald] + yendor::hardness() && !safety && !reptilecheat) + if(d == 7 && c->wall == waCavewall && hrand_monster(GDIM == 2 ? 5000 : 40000) < items[itEmerald] + yendor::hardness() && !safety && !reptilecheat) c->monst = moSeep; ONEMPTY { @@ -705,7 +705,7 @@ EX void giantLandSwitch(cell *c, int d, cell *from) { } } } - if(d == 7 && c->wall == waVinePlant && hrand(DIM == 2 ? 100 : 5000) < (randomPatternsMode ? 2 : 10) && !peace::on && !reptilecheat) + if(d == 7 && c->wall == waVinePlant && hrand(GDIM == 2 ? 100 : 5000) < (randomPatternsMode ? 2 : 10) && !peace::on && !reptilecheat) c->monst = moVineSpirit; ONEMPTY { if(hrand(5000) < PT(100 + 2 * (kills[moVineBeast] + kills[moVineSpirit]), 200) && notDippingFor(itWine) && !reptilecheat) @@ -944,7 +944,7 @@ EX void giantLandSwitch(cell *c, int d, cell *from) { case laCaves: if(fargen) c->wall = (randomPatternsMode ? RANDPAT3(1) : hrand(100) < 55) ? waCavewall : waCavefloor; - if(d == 7 && c->wall == waCavewall && hrand(DIM == 2 ? 5000 : 40000) < items[itGold] + yendor::hardness() && !safety && !reptilecheat) + if(d == 7 && c->wall == waCavewall && hrand(GDIM == 2 ? 5000 : 40000) < items[itGold] + yendor::hardness() && !safety && !reptilecheat) c->monst = moSeep; ONEMPTY { if(hrand(5000) < PT(100 + 2 * min(kills[moTroll] + kills[moGoblin], 150), 200) && notDippingFor(itGold)) @@ -1006,7 +1006,7 @@ EX void giantLandSwitch(cell *c, int d, cell *from) { else c->wall = waDeadfloor; } - if(d == 7 && c->wall == waDeadwall && hrand_monster(DIM == 2 ? 1000 : 10000) < items[itSilver] + yendor::hardness() && !safety && !reptilecheat) + if(d == 7 && c->wall == waDeadwall && hrand_monster(GDIM == 2 ? 1000 : 10000) < items[itSilver] + yendor::hardness() && !safety && !reptilecheat) c->monst = moSeep; ONEMPTY { @@ -1643,7 +1643,7 @@ EX void giantLandSwitch(cell *c, int d, cell *from) { } if(d == 7 && c->wall == waSea && hrand_monster(10000) < 20 + items[itPirate] + 2 * yendor::hardness() && !safety) c->monst = moCShark; - if(d == 7 && c->wall == waCTree && hrand_monster(DIM == 2 ? 5000 : 50000) < 100 + items[itPirate] + yendor::hardness()) + if(d == 7 && c->wall == waCTree && hrand_monster(GDIM == 2 ? 5000 : 50000) < 100 + items[itPirate] + yendor::hardness()) c->monst = moParrot; ONEMPTY { if(hrand(1500) < 4 && celldistAlt(c) <= -5 && peace::on && geometry != gCrystal) diff --git a/mapeditor.cpp b/mapeditor.cpp index 2febaff9..dbd17506 100644 --- a/mapeditor.cpp +++ b/mapeditor.cpp @@ -384,7 +384,7 @@ namespace mapstream { // spinval becomes xspinval rspin = (c2->c.spin(dir) - f.read_char() + MODFIXER) % c->type; - if(DIM == 3 && rspin) { + if(GDIM == 3 && rspin) { println(hlog, "rspin in 3D"); throw hstream_exception(); } @@ -823,7 +823,7 @@ namespace mapeditor { break; case 6: c->land = laCanvas; - c->wall = DIM == 3 ? waWaxWall : waNone; + c->wall = GDIM == 3 ? waWaxWall : waNone; c->landparam = paintwhat >> 8; break; case 4: @@ -1164,7 +1164,7 @@ namespace mapeditor { lightgrid -= (lightgrid & 0xFF) / 2; transmatrix d2 = drawtrans * rgpushxto0(ccenter) * rspintox(gpushxto0(ccenter) * coldcenter); - if(DIM == 3) { + if(GDIM == 3) { queuecircleat(mapeditor::drawcell, 1, 0x80D080FF); color_t cols[4] = { 0x80D080FF, 0x80D080FF, 0xFFFFFF40, 0x00000040 }; if(true) { @@ -1276,7 +1276,7 @@ namespace mapeditor { return area; } -#define EDITING_TRIANGLES (DIM == 3) +#define EDITING_TRIANGLES (GDIM == 3) EX void showDrawEditor() { #if CAP_POLY @@ -1327,7 +1327,7 @@ namespace mapeditor { break; case sgFloor: - line1 = DIM == 3 ? XLAT("pick something") : XLAT("floor"); + line1 = GDIM == 3 ? XLAT("pick something") : XLAT("floor"); line2 = "#" + its(drawcellShapeID()); /* line2 = XLAT(ishept(drawcell) ? "heptagonal" : ishex1(drawcell) ? "hexagonal #1" : "hexagonal"); */ @@ -1354,7 +1354,7 @@ namespace mapeditor { displayButton(8, 8+fs*2, line2 + XLAT(" (r = complex tesselations)"), 'r', 0); else displayfr(8, 8+fs*2, 2, vid.fsize, line2, 0xC0C0C0, 0); - displayButton(8, 8+fs*3, XLAT(DIM == 3 ? "l = color group: %1" : "l = layers: %1", its(dslayer)), 'l', 0); + displayButton(8, 8+fs*3, XLAT(GDIM == 3 ? "l = color group: %1" : "l = layers: %1", its(dslayer)), 'l', 0); } if(us && isize(us->d[dslayer].list)) { @@ -1383,7 +1383,7 @@ namespace mapeditor { displayfr(8, 8+fs*10, 2, vid.fsize, XLAT("d = delete"), 0xC0C0C0, 0); } - if(DIM == 2) { + if(GDIM == 2) { displayfr(8, 8+fs*14, 2, vid.fsize, XLAT("t = shift"), 0xC0C0C0, 0); displayfr(8, 8+fs*15, 2, vid.fsize, XLAT("y = spin"), 0xC0C0C0, 0); } @@ -1391,7 +1391,7 @@ namespace mapeditor { displayButton(8, 8+fs*16, XLAT("p = grid color"), 'p', 0); else displayButton(8, 8+fs*16, XLAT("p = paint"), 'p', 0); - if(DIM == 2) + if(GDIM == 2) displayfr(8, 8+fs*17, 2, vid.fsize, XLAT("z = z-level"), 0xC0C0C0, 0); } @@ -1418,7 +1418,7 @@ namespace mapeditor { mousekey == 'c') mousekey = 'n'; } - if(DIM == 3) + if(GDIM == 3) displayfr(8, 8+fs*19, 2, vid.fsize, XLAT(front_config == eFront::sphere_camera ? "z = camera" : front_config == eFront::sphere_center ? "z = spheres" : nonisotropic && front_config == eFront::equidistants ? "Z =" : nonisotropic && front_config == eFront::const_x ? "X =" : @@ -1442,7 +1442,7 @@ namespace mapeditor { if(!mouseout()) { hyperpoint mh; - if(DIM == 2) { + if(GDIM == 2) { transmatrix T = inverse(drawtrans * rgpushxto0(ccenter)); mh = spintox(gpushxto0(ccenter) * coldcenter) * T * mouseh; } @@ -1452,11 +1452,11 @@ namespace mapeditor { displayfr(vid.xres-8, vid.yres-8-fs*7, 2, vid.fsize, XLAT("x: %1", fts(mh[0],4)), 0xC0C0C0, 16); displayfr(vid.xres-8, vid.yres-8-fs*6, 2, vid.fsize, XLAT("y: %1", fts(mh[1],4)), 0xC0C0C0, 16); displayfr(vid.xres-8, vid.yres-8-fs*5, 2, vid.fsize, XLAT("z: %1", fts(mh[2],4)), 0xC0C0C0, 16); - if(DIM == 3) + if(GDIM == 3) displayfr(vid.xres-8, vid.yres-8-fs*4, 2, vid.fsize, XLAT("w: %1", fts(mh[3],4)), 0xC0C0C0, 16); if(nonisotropic) mh = nisot::inverse_exp(mh, nisot::iTable, false); displayfr(vid.xres-8, vid.yres-8-fs*3, 2, vid.fsize, XLAT("r: %1", fts(hdist0(mh),4)), 0xC0C0C0, 16); - if(DIM == 3) { + if(GDIM == 3) { displayfr(vid.xres-8, vid.yres-8-fs, 2, vid.fsize, XLAT("ϕ: %1°", fts(-atan2(mh[2], hypot_d(2, mh)) / degree,4)), 0xC0C0C0, 16); displayfr(vid.xres-8, vid.yres-8-fs*2, 2, vid.fsize, XLAT("λ: %1°", fts(-atan2(mh[1], mh[0]) / degree,4)), 0xC0C0C0, 16); } @@ -1569,7 +1569,7 @@ namespace mapeditor { if(uni == 'u') loadShapes(sg, id); - if(uni == 'z' && haveshape && DIM == 2) + if(uni == 'z' && haveshape && GDIM == 2) dialog::editNumber(dsCur->zlevel, -10, +10, 0.1, 0, XLAT("z-level"), XLAT("Changing the z-level will make this layer affected by the parallax effect.")); @@ -1812,11 +1812,11 @@ namespace mapeditor { void drawHandleKey(int sym, int uni) { - if(uni == PSEUDOKEY_WHEELUP && DIM == 3 && front_step) { + if(uni == PSEUDOKEY_WHEELUP && GDIM == 3 && front_step) { front_edit += front_step * shiftmul; return; } - if(uni == PSEUDOKEY_WHEELDOWN && DIM == 3 && front_step) { + if(uni == PSEUDOKEY_WHEELDOWN && GDIM == 3 && front_step) { front_edit -= front_step * shiftmul; return; } @@ -1837,7 +1837,7 @@ namespace mapeditor { addMessage(XLAT("Hint: use F7 to edit floor under the player")); } - hyperpoint mh = DIM == 2 ? mouseh : find_mouseh3(); + hyperpoint mh = GDIM == 2 ? mouseh : find_mouseh3(); mh = inverse(drawtrans) * mh; bool clickused = false; @@ -1871,7 +1871,7 @@ namespace mapeditor { pushScreen(showMapEditor); } - if(uni == 'z' && DIM == 3) { + if(uni == 'z' && GDIM == 3) { dialog::editNumber(front_edit, 0, 5, 0.1, 0.5, XLAT("z-level"), ""); dialog::extra_options = [] () { dialog::addBoolItem(XLAT("The distance from the camera to added points."), front_config == eFront::sphere_camera, 'A'); @@ -2020,7 +2020,7 @@ namespace mapeditor { println(hlog, spaced("//", i, usp.first, l, "[", ds.color, double(ds.zlevel), "]")); print(hlog, " ID, ", us->d[l].rots, ", ", us->d[l].sym?2:1, ", "); for(int i=0; id[l].list); i++) { - for(int d=0; dd[l].list[i][d]), ", "); + for(int d=0; dd[l].list[i][d]), ", "); print(hlog, " "); } println(hlog); @@ -2169,8 +2169,8 @@ namespace mapeditor { hpcshape& sh(cgi.ushr[&ds]); if(sh.s != sh.e) { - auto& last = queuepolyat(mmscale(V, DIM == 3 ? 0 : geom3::lev_to_factor(ds.zlevel)), sh, ds.color ? ds.color : color, prio); - if(DIM == 3) { + auto& last = queuepolyat(mmscale(V, GDIM == 3 ? 0 : geom3::lev_to_factor(ds.zlevel)), sh, ds.color ? ds.color : color, prio); + if(GDIM == 3) { last.tinf = &user_triangles_texture; last.offset_texture = ds.texture_offset; } diff --git a/menus.cpp b/menus.cpp index f4d4d1be..268503f0 100644 --- a/menus.cpp +++ b/menus.cpp @@ -336,7 +336,7 @@ EX void showGraphQuickKeys() { dialog::init(XLAT("quick options")); - if(DIM == 2) { + if(GDIM == 2) { dialog::addBoolItem(XLAT("orthogonal projection"), vid.alpha >= 500, '1'); dialog::addBoolItem(XLAT(sphere ? "stereographic projection" : euclid ? "zoomed out" : "small Poincaré model"), vid.alpha == 1 && vid.scale < 1, '2'); dialog::addBoolItem(XLAT(sphere ? "zoomed stereographic projection" : euclid ? "zoomed in" : "big Poincaré model"), vid.alpha == 1 && vid.scale >= 1, '3'); @@ -444,7 +444,7 @@ EX void showCreative() { // display modes #if CAP_MODEL - if(DIM == 2) { + if(GDIM == 2) { dialog::addItem(XLAT("paper model creator"), 'n'); dialog::add_action([] { netgen::run(); }); } @@ -464,7 +464,7 @@ EX void showCreative() { dialog::add_action_push(history::history_menu); #if CAP_TEXTURE - if(DIM == 2) { + if(GDIM == 2) { dialog::addBoolItem(XLAT("texture mode"), texture::config.tstate == texture::tsActive, 't'); dialog::add_action_push(texture::showMenu); } diff --git a/models.cpp b/models.cpp index 028670d8..f51909a7 100644 --- a/models.cpp +++ b/models.cpp @@ -141,7 +141,7 @@ EX namespace models { #endif EX transmatrix rotmatrix() { - if(DIM == 2) return spin(rotation * degree); + if(GDIM == 2) return spin(rotation * degree); return spin(rotation_xy2 * degree) * cspin(0, 2, -rotation_xz * degree) * spin(rotation * degree); } @@ -167,7 +167,7 @@ EX namespace models { ocos_yz = cos(model_orientation_yz * degree); osin_yz = sin(model_orientation_yz * degree); model_straight = (ocos > 1 - 1e-9); - model_straight_yz = DIM == 2 || (ocos_yz > 1-1e-9); + model_straight_yz = GDIM == 2 || (ocos_yz > 1-1e-9); if(history::on) history::apply(); if(!euclid) { @@ -201,9 +201,9 @@ EX namespace models { if(pm == mdGeodesic && !sol) return false; if(sphere && (pm == mdHalfplane || pm == mdBall)) return false; - if(DIM == 2 && pm == mdPerspective) return false; - if(DIM == 2 && pm == mdEquivolume) return false; - if(DIM == 3 && among(pm, mdBall, mdHyperboloid, mdFormula, mdPolygonal, mdRotatedHyperboles, mdSpiral, mdHemisphere)) return false; + if(GDIM == 2 && pm == mdPerspective) return false; + if(GDIM == 2 && pm == mdEquivolume) return false; + if(GDIM == 3 && among(pm, mdBall, mdHyperboloid, mdFormula, mdPolygonal, mdRotatedHyperboles, mdSpiral, mdHemisphere)) return false; if(pm == mdCentralInversion && !euclid) return false; return true; } @@ -214,21 +214,21 @@ EX namespace models { } EX bool model_has_transition() { - return among(pmodel, mdJoukowsky, mdJoukowskyInverted, mdBand) && DIM == 2; + return among(pmodel, mdJoukowsky, mdJoukowskyInverted, mdBand) && GDIM == 2; } int editpos = 0; EX string get_model_name(eModel m) { - if(m == mdDisk && DIM == 3 && hyperbolic) return XLAT("ball model/Gans"); + if(m == mdDisk && GDIM == 3 && hyperbolic) return XLAT("ball model/Gans"); if(nonisotropic) { if(m == mdDisk) return XLAT("simple model: projection"); if(m == mdPerspective) return XLAT("simple model: perspective"); if(m == mdGeodesic) return XLAT("native perspective"); if(m == mdEquidistant) return XLAT(mdinf[m].name_hyperbolic); } - if(m == mdDisk && DIM == 3) return XLAT("perspective in 4D"); - if(m == mdHalfplane && DIM == 3 && hyperbolic) return XLAT("half-space"); + if(m == mdDisk && GDIM == 3) return XLAT("perspective in 4D"); + if(m == mdHalfplane && GDIM == 3 && hyperbolic) return XLAT("half-space"); if(sphere) return XLAT(mdinf[m].name_spherical); if(euclid) @@ -307,7 +307,7 @@ EX namespace models { dialog::addBoolItem_choice("line animation only", models::do_rotate, 0, 'N'); dialog::addBoolItem_choice("gravity lands", models::do_rotate, 1, 'G'); dialog::addBoolItem_choice("all directional lands", models::do_rotate, 2, 'D'); - if(DIM == 3) { + if(GDIM == 3) { dialog::addBreak(100); dialog::addSelItem(XLAT("XY plane"), fts(models::rotation) + "°", 'A'); dialog::add_action([] { popScreen(); edit_rotation(models::rotation); }); @@ -388,7 +388,7 @@ EX namespace models { dialog::addBoolItem(XLAT("rotation"), do_rotate == 2, 'r'); if(do_rotate == 0) dialog::lastItem().value = XLAT("NEVER"); - if(DIM == 2) + if(GDIM == 2) dialog::lastItem().value += " " + its(rotation) + "°"; else dialog::lastItem().value += " " + its(rotation) + "°" + its(rotation_xz) + "°" + its(rotation_xy2) + "°"; @@ -416,7 +416,7 @@ EX namespace models { dialog::add_action([] () { dialog::editNumber(model_orientation, 0, 360, 90, 0, XLAT("model orientation"), ""); }); - if(DIM == 3) { + if(GDIM == 3) { dialog::addSelItem(XLAT("model orientation (y/z plane)"), fts(model_orientation_yz) + "°", 'L'); dialog::add_action([] () { dialog::editNumber(model_orientation_yz, 0, 360, 90, 0, XLAT("model orientation (y/z plane)"), ""); @@ -424,7 +424,7 @@ EX namespace models { } } - if(DIM == 3 && pmodel != mdPerspective) { + if(GDIM == 3 && pmodel != mdPerspective) { const string cliphelp = XLAT( "Your view of the 3D model is naturally bounded from four directions by your window. " "Here, you can also set up similar bounds in the Z direction. Radius of the ball/band " @@ -527,7 +527,7 @@ EX namespace models { }); } - if(among(pmodel, mdJoukowsky, mdJoukowskyInverted, mdSpiral) && DIM == 2) { + if(among(pmodel, mdJoukowsky, mdJoukowskyInverted, mdSpiral) && GDIM == 2) { dialog::addSelItem(XLAT("Möbius transformations"), fts(vid.skiprope) + "°", 'S'); dialog::add_action([](){ dialog::editNumber(vid.skiprope, 0, 360, 15, 0, XLAT("Möbius transformations"), ""); @@ -687,8 +687,8 @@ EX namespace models { else if(argis("-crot")) { PHASEFROM(2); shift_arg_formula(models::rotation); - if(DIM == 3) shift_arg_formula(models::rotation_xz); - if(DIM == 3) shift_arg_formula(models::rotation_xy2); + if(GDIM == 3) shift_arg_formula(models::rotation_xz); + if(GDIM == 3) shift_arg_formula(models::rotation_xy2); } else if(argis("-clip")) { PHASEFROM(2); diff --git a/multi.cpp b/multi.cpp index 49489895..c1b5443f 100644 --- a/multi.cpp +++ b/multi.cpp @@ -326,7 +326,7 @@ struct joy_configurer { dzconfigs[numaxeconfigs] = &(scfg.deadzoneval[j][ax]); char aa = *axeconfigs[numaxeconfigs]; string what = configdead ? its(scfg.deadzoneval[j][ax]) : - (DIM == 3 && (aa%SHMUPAXES < 4)) ? XLAT(axemodes3[aa%SHMUPAXES]) : + (GDIM == 3 && (aa%SHMUPAXES < 4)) ? XLAT(axemodes3[aa%SHMUPAXES]) : XLAT(axemodes[aa%SHMUPAXES]); dialog::addSelItem(XLAT("Joystick %1, axis %2", cts('A'+j), its(ax)) + buf, what, 'a'+numaxeconfigs); @@ -702,7 +702,7 @@ void handleInput(int delta) { double panmove = actionspressed[59] - actionspressed[60]; - if(DIM == 3) + if(GDIM == 3) panmove += axespressed[1] / 32000.0; else panspin += axespressed[1] / 32000.0; @@ -737,7 +737,7 @@ void handleInput(int delta) { #endif if(panx || pany || panspin || (GDIM == 3 && panmove)) { - if(DIM == 2) { + if(GDIM == 2) { View = xpush(-panx) * ypush(-pany) * spin(panspin) * View; playermoved = false; } diff --git a/patterns.cpp b/patterns.cpp index a6e73965..2207ea83 100644 --- a/patterns.cpp +++ b/patterns.cpp @@ -366,7 +366,7 @@ int emerald_heptagon(int parent, int dir) { #undef RULE - if(weirdhyperbolic || DIM == 3) return 0; + if(weirdhyperbolic || GDIM == 3) return 0; printf("HEPTAGONAL RULE MISSING for (%d,%d)\n", parent,dir); exit(1); } diff --git a/polygons.cpp b/polygons.cpp index 5b5b73c5..ce3a92f4 100644 --- a/polygons.cpp +++ b/polygons.cpp @@ -16,7 +16,7 @@ extern long double polydata[]; void geometry_information::hpcpush(hyperpoint h) { if(sphere) h = mid(h,h); - ld threshold = (DIM == 3 || last->flags & POLY_TRIANGLES) ? 100 : (sphere ? (ISMOBWEB || NONSTDVAR ? .04 : .001) : 0.1) * pow(.25, vid.linequality); + ld threshold = (GDIM == 3 || last->flags & POLY_TRIANGLES) ? 100 : (sphere ? (ISMOBWEB || NONSTDVAR ? .04 : .001) : 0.1) * pow(.25, vid.linequality); if(/*vid.usingGL && */!first) { ld i = intval(hpc.back(), h); if(i > threshold && i < 10) { @@ -121,7 +121,7 @@ void geometry_information::finishshape() { if(abs(area) < 1e-9) last->flags |= POLY_ISSIDE; if(area >= 0) last->flags |= POLY_INVERSE; - if(DIM == 3) { + if(GDIM == 3) { last->intester = Hypc; for(int i=last->s; ie; i++) last->intester += hpc[i]; if(last->s != last->e) last->intester /= last->e-last->s; @@ -151,7 +151,7 @@ void geometry_information::finishshape() { if(asign(y1, y2)) { ld x = xcross(x1, y1, x2, y2); if(abs(x) < 1e-3 && !(last->flags & POLY_ISSIDE)) { - if(s >= 2 && DIM == 2) println(hlog, "close call [", s, "], x = ", fts(x)); + if(s >= 2 && GDIM == 2) println(hlog, "close call [", s, "], x = ", fts(x)); last->flags |= POLY_BADCENTERIN; } if(x < 0) last->flags ^= POLY_CENTERIN; @@ -671,8 +671,8 @@ void geometry_information::procedural_shapes() { } for(int i=0; i<8; i++) { - asteroid_size[i] = scalefactor * 0.1 * pow(2, (i-1) * 1. / DIM); - if(DIM == 3) asteroid_size[i] *= 7; + asteroid_size[i] = scalefactor * 0.1 * pow(2, (i-1) * 1. / GDIM); + if(GDIM == 3) asteroid_size[i] *= 7; bshape(shAsteroid[i], PPR::PARTICLE); for(int t=0; t<12; t++) hpcpush(xspinpush0(M_PI * t / 6, asteroid_size[i] * (1 - randd() * .2))); @@ -757,7 +757,7 @@ void geometry_information::create_wall3d() { shWall3D.resize(howmany); shPlainWall3D.resize(howmany); shWireframe3D.resize(howmany); - if(DIM == 3 && binarytiling && geometry == gBinary3) { + if(GDIM == 3 && binarytiling && geometry == gBinary3) { hyperpoint h00 = point3(-1,-1,-1); hyperpoint h01 = point3(-1,0,-1); hyperpoint h02 = point3(-1,+1,-1); @@ -780,7 +780,7 @@ void geometry_information::create_wall3d() { make_wall(8, make4(h22+down, h02+down, h20+down)); } - if(DIM == 3 && binarytiling && geometry == gHoroTris) { + if(GDIM == 3 && binarytiling && geometry == gHoroTris) { ld r = sqrt(3)/6; ld r1 = r; ld r2 = r * 2; @@ -853,7 +853,7 @@ void geometry_information::create_wall3d() { make_wall(13, {point3(3*h,r3,z), point3(3*h,-r3,z), point3(0,-2*r3,z), point3(-3*h,-r3,z), point3(-3*h,r3,z)}); } - if(DIM == 3 && euclid && S7 == 6) { + if(GDIM == 3 && euclid && S7 == 6) { for(int w=0; w<6; w++) { vector vertices; for(int a=0; a<4; a++) { @@ -870,7 +870,7 @@ void geometry_information::create_wall3d() { } } - if(DIM == 3 && euclid && S7 == 12) { + if(GDIM == 3 && euclid && S7 == 12) { auto v = euclid3::get_shifttable(); for(int w=0; w<12; w++) { auto co = euclid3::getcoord(v[w]); @@ -883,7 +883,7 @@ void geometry_information::create_wall3d() { } } - if(DIM == 3 && euclid && S7 == 14) { + if(GDIM == 3 && euclid && S7 == 14) { auto v = euclid3::get_shifttable(); for(int w=0; w<14; w++) { bshape(shWall3D[w], PPR::WALL); @@ -907,7 +907,7 @@ void geometry_information::create_wall3d() { } } - if(DIM == 3 && !euclid && !binarytiling && !nil) { + if(GDIM == 3 && !euclid && !binarytiling && !nil) { reg3::generate(); int facesize = isize(reg3::cellshape) / S7; for(int w=0; w= 4 - if(DIM == 3 && !floor_textures) make_floor_textures(); + if(GDIM == 3 && !floor_textures) make_floor_textures(); #endif symmetriesAt.clear(); @@ -1216,7 +1216,7 @@ void geometry_information::prepare_shapes() { bshape(shKrakenEye2, PPR::ONTENTACLE_EYES2, ksc, 249); // monsters - bshape(shGhost, DIM == 3 ? PPR::SUPERLINE : PPR::MONSTER_BODY, scalefactor, 69); + bshape(shGhost, GDIM == 3 ? PPR::SUPERLINE : PPR::MONSTER_BODY, scalefactor, 69); bshape(shMiniGhost, PPR::MONSTER_BODY, scalefactor/3, 69); bshape(shGargoyleWings, PPR::MONSTER_CLOAK, scalefactor, 70); bshape(shGargoyleBody, PPR::MONSTER_BODY, scalefactor, 71); diff --git a/racing.cpp b/racing.cpp index 2cc40aa7..c1b0d470 100644 --- a/racing.cpp +++ b/racing.cpp @@ -474,7 +474,7 @@ EX void generate_track() { for(cell *sc: track) { straight = calc_relative_matrix(sc, track[0], C0); - if(straight[DIM][DIM] > 1e8) break; + if(straight[GDIM][GDIM] > 1e8) break; } straight = rspintox(straight * C0); @@ -710,7 +710,7 @@ bool set_view() { transmatrix at = ypush(-vid.yshift) * ggmatrix(who->base) * who->at; - if(racing::player_relative || quotient || (penrose && DIM == 3)) { + if(racing::player_relative || quotient || (penrose && GDIM == 3)) { View = inverse(at) * View; } else { @@ -984,7 +984,7 @@ void race_projection() { } else dialog::addBreak(100); - if(DIM == 2) { + if(GDIM == 2) { dialog::addSelItem(XLAT("race angle"), fts(race_angle), 'a'); dialog::add_action([] () { dialog::editNumber(race_angle, 0, 360, 15, 90, XLAT("race angle"), ""); @@ -1289,7 +1289,7 @@ void drawStats() { if(!racing::on) return; - dynamicval pm(pmodel, DIM == 3 ? mdFlatten : mdDisk); + dynamicval pm(pmodel, GDIM == 3 ? mdFlatten : mdDisk); initquickqueue(); int bsize = vid.fsize * 2; diff --git a/rogueviz-flocking.cpp b/rogueviz-flocking.cpp index 5ff04aff..c6967d40 100644 --- a/rogueviz-flocking.cpp +++ b/rogueviz-flocking.cpp @@ -255,7 +255,7 @@ namespace flocking { gmatrix.clear(); vdata[0].m->pat = View * calc_relative_matrix(vdata[0].m->base, viewctr.at->c7, C0) * vdata[0].m->at; View = spin(90 * degree) * inverse(vdata[0].m->pat) * View; - if(DIM == 3) { + if(GDIM == 3) { View = hr::cspin(1, 2, 90 * degree) * View; } } diff --git a/rogueviz-kohonen.cpp b/rogueviz-kohonen.cpp index 3a5649fa..91d0070d 100644 --- a/rogueviz-kohonen.cpp +++ b/rogueviz-kohonen.cpp @@ -410,7 +410,7 @@ void buildcellcrawler(cell *c, cellcrawler& cr, int dir) { map scc; pair get_cellcrawler_id(cell *c) { - if(among(geometry, gZebraQuotient, gMinimal, gField435, gField534) || (euwrap && !fulltorus) || IRREGULAR || (DIM == 3 && sphere)) { + if(among(geometry, gZebraQuotient, gMinimal, gField435, gField534) || (euwrap && !fulltorus) || IRREGULAR || (GDIM == 3 && sphere)) { // Zebra Quotient does exhibit some symmetries, // but these are so small anyway that it is safer to just build // a crawler for every neuron diff --git a/rogueviz.cpp b/rogueviz.cpp index 4a3a8c77..d3af10ea 100644 --- a/rogueviz.cpp +++ b/rogueviz.cpp @@ -1217,10 +1217,10 @@ void queuedisk(const transmatrix& V, const colorpair& cp, bool legend, const str cgi.shDisk; if(vertex_shape == 0) ; - else if(DIM == 3 && among(cp.shade, 'b', 'f', 'g', 'B', 'F', 'G')) { + else if(GDIM == 3 && among(cp.shade, 'b', 'f', 'g', 'B', 'F', 'G')) { V1 = V; } - else if(DIM == 3) { + else if(GDIM == 3) { V1 = face_the_player(V); if(info) queueaction(PPR::MONSTER_HEAD, [info] () { SVG_LINK(*info); }); queuepolyat(V1, sh, darken_a(cp.color1), PPR::MONSTER_HEAD); @@ -1245,10 +1245,10 @@ void queuedisk(const transmatrix& V, const colorpair& cp, bool legend, const str case 's': queuepoly(V1, cgi.shDiskS, darken_a(cp.color2)); return; case 'q': queuepoly(V1, cgi.shDiskSq, darken_a(cp.color2)); return; case 'm': queuepoly(V1, cgi.shDiskM, darken_a(cp.color2)); return; - case 'b': queuepoly(V1, DIM == 3 ? cgi.shAnimatedTinyEagle[wingphase(200)] : cgi.shTinyBird, darken_a(cp.color2)); return; + case 'b': queuepoly(V1, GDIM == 3 ? cgi.shAnimatedTinyEagle[wingphase(200)] : cgi.shTinyBird, darken_a(cp.color2)); return; case 'f': queuepoly(V1, cgi.shTinyShark, darken_a(cp.color2)); return; case 'g': queuepoly(V1, cgi.shMiniGhost, darken_a(cp.color2)); return; - case 'B': queuepoly(V1, DIM == 3 ? cgi.shAnimatedEagle[wingphase(100)] : cgi.shEagle, darken_a(cp.color2)); return; + case 'B': queuepoly(V1, GDIM == 3 ? cgi.shAnimatedEagle[wingphase(100)] : cgi.shEagle, darken_a(cp.color2)); return; case 'F': queuepoly(V1, cgi.shShark, darken_a(cp.color2)); return; case 'G': queuepoly(V1, cgi.shGhost, darken_a(cp.color2)); return; } @@ -1453,7 +1453,7 @@ bool drawVertex(const transmatrix &V, cell *c, shmup::monster *m) { } hyperpoint h = tC0(V * m->at); - transmatrix V2 = DIM == 3 ? V * m->at : rgpushxto0(h) * ypush(PURE ? .3 : .2); // todo-variation + transmatrix V2 = GDIM == 3 ? V * m->at : rgpushxto0(h) * ypush(PURE ? .3 : .2); // todo-variation if(doshow && !behindsphere(V2)) { auto info = vd.info; if(info) queueaction(PPR::MONSTER_HEAD, [info] () { SVG_LINK(*info); }); @@ -1747,9 +1747,9 @@ bool turn(int delta) { #endif int dimid(char x) { - if(x >= 'a' && x < 'a' + DIM) return x - 'a'; - else if(x >= '0' && x < '0' + DIM) return x - '0'; - else if(x >= 'x' && x < 'x' + DIM) return x - 'x'; + if(x >= 'a' && x < 'a' + GDIM) return x - 'a'; + else if(x >= '0' && x < '0' + GDIM) return x - '0'; + else if(x >= 'x' && x < 'x' + GDIM) return x - 'x'; else { println(hlog, "incorrect dimension ID"); throw hr_exception(); diff --git a/rug.cpp b/rug.cpp index 50544afc..333ac423 100644 --- a/rug.cpp +++ b/rug.cpp @@ -326,8 +326,8 @@ EX rugpoint *addRugpoint(hyperpoint h, double dist) { else { m->flat = h; - ld hd = h[DIM]; - for(int d=DIM; dflat[d] = (hd - .99) * (rand() % 1000 - rand() % 1000) / 1000; } @@ -799,7 +799,7 @@ bool force(rugpoint& m1, rugpoint& m2, double rd, bool is_anticusp=false, double vector > preset_points; EX void preset(rugpoint *m) { - if(DIM == 3) return; + if(GDIM == 3) return; int q = 0; hyperpoint h; for(int i=0; i<3; i++) h[i] = 0; @@ -878,7 +878,7 @@ EX void optimize(rugpoint *m, bool do_preset) { // int ed0 = isize(preset_points); for(auto& e: m->edges) if(e.target->valid) preset_points.emplace_back(e.len, e.target); - if(gwhere >= gSphere || DIM == 3) { + if(gwhere >= gSphere || GDIM == 3) { ld cur = sse(m->flat); for(int it=0; it<500; it++) { ld ex = exp(-it/60); @@ -901,7 +901,7 @@ bool stop = false; EX bool subdivide_further() { if(fulltorus) return false; - if(DIM == 3) return false; + if(GDIM == 3) return false; return isize(points) * 4 < vertex_limit; } @@ -1483,7 +1483,7 @@ EX transmatrix currentrot; EX void reopen() { if(rugged) return; - rugdim = 2 * DIM - 1; + rugdim = 2 * GDIM - 1; when_enabled = ticks; GLERR("before init"); glbuf = new renderbuffer(TEXTURESIZE, TEXTURESIZE, vid.usingGL && !rendernogl); diff --git a/screenshot.cpp b/screenshot.cpp index 4274239f..2ad11999 100644 --- a/screenshot.cpp +++ b/screenshot.cpp @@ -609,8 +609,8 @@ EX void apply() { fullcenter(); View = spin(rand() % 1000) * View; } } - View = solmul(cspin(0, DIM-1, movement_angle * degree) * ypush(shift_angle * degree) * xpush(cycle_length * t / period) * ypush(-shift_angle * degree) * - cspin(0, DIM-1, -movement_angle * degree), View); + View = solmul(cspin(0, GDIM-1, movement_angle * degree) * ypush(shift_angle * degree) * xpush(cycle_length * t / period) * ypush(-shift_angle * degree) * + cspin(0, GDIM-1, -movement_angle * degree), View); moved(); if(clearup) { viewctr.at->c7->wall = waNone; @@ -620,22 +620,22 @@ EX void apply() { break; case maRotation: - if(DIM == 3) { + if(GDIM == 3) { View = spin(-movement_angle * degree) * View; View = cspin(1, 2, normal_angle * degree) * View; } View = spin(2 * M_PI * t / period) * View; - if(DIM == 3) { + if(GDIM == 3) { View = cspin(2, 1, normal_angle * degree) * View; View = spin(movement_angle * degree) * View; } break; case maTranslationRotation: - View = solmul(cspin(0, DIM-1, movement_angle * degree) * ypush(shift_angle * degree) * xpush(cycle_length * t / period) * ypush(-shift_angle * degree) * - cspin(0, DIM-1, -movement_angle * degree), View); + View = solmul(cspin(0, GDIM-1, movement_angle * degree) * ypush(shift_angle * degree) * xpush(cycle_length * t / period) * ypush(-shift_angle * degree) * + cspin(0, GDIM-1, -movement_angle * degree), View); moved(); - View = cspin(0, DIM-1, 2 * M_PI * t / period) * View; + View = cspin(0, GDIM-1, 2 * M_PI * t / period) * View; if(clearup) { viewctr.at->c7->wall = waNone; } @@ -645,7 +645,7 @@ EX void apply() { case maParabolic: reflect_view(); View = ypush(-shift_angle * degree) * spin(-movement_angle * degree) * View; - if(DIM == 2) + if(GDIM == 2) View = binary::parabolic(parabolic_length * t / period) * View; else View = binary::parabolic3(parabolic_length * t / period, 0) * View; @@ -916,7 +916,7 @@ EX void show() { break; } case maRotation: - if(DIM == 3) { + if(GDIM == 3) { dialog::addSelItem(XLAT("angle to screen normal"), fts(normal_angle) + "°", 'C'); dialog::add_action([] () { dialog::editNumber(normal_angle, 0, 360, 15, 0, XLAT("angle to screen normal"), ""); @@ -1057,7 +1057,7 @@ int readArgs() { else if(argis("-animclear")) { clearup = true; } else if(argis("-animrot")) { ma = maRotation; - if(DIM == 3) { + if(GDIM == 3) { shift_arg_formula(movement_angle); shift_arg_formula(normal_angle); } diff --git a/shaders.cpp b/shaders.cpp index 02957921..54d86ba2 100644 --- a/shaders.cpp +++ b/shaders.cpp @@ -794,7 +794,7 @@ EX hyperpoint gltopoint(const glvertex& t) { EX glvertex pointtogl(const hyperpoint& t) { glvertex h; h[0] = t[0]; h[1] = t[1]; h[2] = t[2]; - if(SHDIM == 4) h[3] = (DIM == 3) ? t[3] : 1; + if(SHDIM == 4) h[3] = (GDIM == 3) ? t[3] : 1; return h; } diff --git a/shmup.cpp b/shmup.cpp index f2d81f6b..02baa40f 100644 --- a/shmup.cpp +++ b/shmup.cpp @@ -2821,7 +2821,7 @@ bool drawMonster(const transmatrix& V, cell *c, const transmatrix*& Vboat, trans } else { transmatrix t = view * spin(curtime / 50.0); - queuepoly(WDIM == 3 ? t : DIM == 3 ? mscale(t, cgi.BODY) : mmscale(t, 1.15), cgi.shKnife, col); + queuepoly(WDIM == 3 ? t : GDIM == 3 ? mscale(t, cgi.BODY) : mmscale(t, 1.15), cgi.shKnife, col); ShadowV(t, cgi.shKnife); } break; @@ -2848,7 +2848,7 @@ bool drawMonster(const transmatrix& V, cell *c, const transmatrix*& Vboat, trans break; } case moAsteroid: { - if(DIM == 3) addradar(view, '*', 0xFFFFFF, 0xC0C0C0FF); + if(GDIM == 3) addradar(view, '*', 0xFFFFFF, 0xC0C0C0FF); transmatrix t = view; if(WDIM == 3) t = face_the_player(t); t = t * spin(curtime / 500.0); @@ -2875,9 +2875,9 @@ bool drawMonster(const transmatrix& V, cell *c, const transmatrix*& Vboat, trans if(hasHitpoints(m->type)) c->hitpoints = m->hitpoints; if(m->type == moTortoise) tortoise::emap[c] = getBits(m->torigin); - /* if(m->type == moMimic && DIM == 3) + /* if(m->type == moMimic && GDIM == 3) drawMonsterType(m->type, c, view * spin(-M_PI/2), col, m->footphase); */ - /* else if(DIM == 3) + /* else if(GDIM == 3) drawMonsterType(m->type, c, view * cspin(0, 2, M_PI/2), col, m->footphase); */ /* else */ drawMonsterType(m->type, c, view, col, m->footphase, col); diff --git a/system.cpp b/system.cpp index 9ef50684..657fbe93 100644 --- a/system.cpp +++ b/system.cpp @@ -1155,7 +1155,7 @@ EX void stop_game() { EX void set_geometry(eGeometry target) { if(geometry != target) { - int old_DIM = DIM; + int old_DIM = GDIM; stop_game(); ors::reset(); geometry = target; @@ -1182,9 +1182,9 @@ EX void set_geometry(eGeometry target) { #if CAP_BT if(binarytiling || WDIM == 3 || penrose) variation = eVariation::pure; #endif - if(DIM == 3 && old_DIM == 2 && pmodel == mdDisk) pmodel = mdPerspective; + if(GDIM == 3 && old_DIM == 2 && pmodel == mdDisk) pmodel = mdPerspective; if(nonisotropic && old_DIM == 2) pmodel = mdGeodesic; - if(DIM == 2 && among(pmodel, mdPerspective, mdGeodesic)) pmodel = mdDisk; + if(GDIM == 2 && among(pmodel, mdPerspective, mdGeodesic)) pmodel = mdDisk; if(nonisotropic && old_DIM == 2 && vid.texture_step < 4) vid.texture_step = 4; } } diff --git a/textures.cpp b/textures.cpp index 1e5e91ea..ec514453 100644 --- a/textures.cpp +++ b/textures.cpp @@ -1241,11 +1241,11 @@ EX void showMenu() { dialog::addItem(XLAT("select geometry/pattern"), 'r'); if(config.tstate_max == tsAdjusting || config.tstate_max == tsActive) dialog::addItem(XLAT("reactivate the texture"), 't'); - if(DIM == 2 && !rug::rugged) dialog::addItem(XLAT("open PNG as texture"), 'o'); + if(GDIM == 2 && !rug::rugged) dialog::addItem(XLAT("open PNG as texture"), 'o'); dialog::addItem(XLAT("load texture config"), 'l'); dialog::addSelItem(XLAT("texture size"), its(config.data.twidth), 'w'); #if CAP_EDIT - if(DIM == 2) dialog::addItem(XLAT("paint a new texture"), 'n'); + if(GDIM == 2) dialog::addItem(XLAT("paint a new texture"), 'n'); #endif dialog::addSelItem(XLAT("precision"), its(config.gsplits), 'P'); @@ -1309,7 +1309,7 @@ EX void showMenu() { dialog::addSelItem(XLAT("precision"), its(config.gsplits), 'P'); dialog::addBoolItem_action(XLAT("aura from texture"), texture_aura, 'a'); #if CAP_EDIT - if(DIM == 2) dialog::addItem(XLAT("edit the texture"), 'e'); + if(GDIM == 2) dialog::addItem(XLAT("edit the texture"), 'e'); #endif #if CAP_SHOT dialog::addItem(XLAT("save the full texture image"), 'S'); @@ -1612,7 +1612,7 @@ EX void drawLine(hyperpoint h1, hyperpoint h2, color_t col, int steps IS(10)) { void texture_config::true_remap() { models::configure(); drawthemap(); - if(DIM == 3) return; + if(GDIM == 3) return; clear_texture_map(); missing_cells_known.clear(); for(cell *c: dcal) { diff --git a/usershapes.cpp b/usershapes.cpp index 4955060e..e4cf360b 100644 --- a/usershapes.cpp +++ b/usershapes.cpp @@ -36,11 +36,11 @@ basic_textureinfo user_triangles_texture; void geometry_information::pushShape(usershapelayer& ds) { if(ds.list.empty()) return; - if(DIM == 3) last->flags |= POLY_TRIANGLES; + if(GDIM == 3) last->flags |= POLY_TRIANGLES; transmatrix T = rgpushxto0(ds.shift) * rspintox(ds.spin); - int z = DIM == 3 ? 3 : 1; + int z = GDIM == 3 ? 3 : 1; for(int r=0; r= 4 - if(DIM == 3) { + if(GDIM == 3) { auto& utt = user_triangles_texture; utt.texture_id = floor_textures->renderedTexture; ds.texture_offset = isize(utt.tvertices);