diff --git a/blizzard.cpp b/blizzard.cpp index cbdf85a1..efa09d3b 100644 --- a/blizzard.cpp +++ b/blizzard.cpp @@ -48,6 +48,10 @@ struct blizzardcell { map blizzardcells; +void set_blizzard_frame(cell *c, int frameid) { + blizzardcells[c].frame = frameid; + } + vector bcells; int N; diff --git a/compileunits.h b/compileunits.h index 00284f3b..1a5bb7bf 100644 --- a/compileunits.h +++ b/compileunits.h @@ -52,6 +52,7 @@ bool inv::activating; #include "debug.cpp" #include "geometry.cpp" #include "polygons.cpp" +#include "floorshapes.cpp" #include "mapeditor.cpp" #if CAP_MODEL #include "netgen.cpp" @@ -64,6 +65,7 @@ bool inv::activating; #include "help.cpp" #include "config.cpp" #include "scores.cpp" +#include "dialogs.cpp" #include "menus.cpp" #include "geom-exp.cpp" #include "quit.cpp" @@ -78,6 +80,7 @@ bool inv::activating; #include "hypgraph.cpp" #include "textures.cpp" #include "graph.cpp" +#include "blizzard.cpp" #include "sound.cpp" #include "achievement.cpp" #include "barriers.cpp" diff --git a/floorshapes.cpp b/floorshapes.cpp index 570038df..2b506986 100644 --- a/floorshapes.cpp +++ b/floorshapes.cpp @@ -1,31 +1,6 @@ -struct plain_floorshape; -struct escher_floorshape; - vector all_plain_floorshapes; vector all_escher_floorshapes; -struct floorshape { - bool is_plain; - int shapeid, prio; - vector b, shadow, side[SIDEPARS], gpside[SIDEPARS][8]; - floorshape() { prio = PPR_FLOOR; } - }; - -struct plain_floorshape : floorshape { - ld rad0, rad1; - plain_floorshape() { is_plain = true; all_plain_floorshapes.push_back(this); } - void configure(ld r0, ld r1) { rad0 = r0; rad1 = r1; } - }; - -// noftype: 0 (shapeid2 is heptagonal or just use shapeid1), 1 (shapeid2 is pure heptagonal), 2 (shapeid2 is Euclidean), 3 (shapeid2 is hexagonal) -struct escher_floorshape : floorshape { - int shapeid0, shapeid1, noftype, shapeid2; - ld scale; - escher_floorshape(int s0, int s1, int noft=0, int s2=0) : shapeid0(s0), shapeid1(s1), noftype(noft), shapeid2(s2) { - all_escher_floorshapes.push_back(this); scale = 1; is_plain = false; - } - }; - plain_floorshape shFloor, shMFloor, shMFloor2, shMFloor3, shMFloor4, shFullFloor, diff --git a/graph.cpp b/graph.cpp index efc4cd50..1dc8b50d 100644 --- a/graph.cpp +++ b/graph.cpp @@ -3275,8 +3275,6 @@ bool allemptynear(cell *c) { return true; } -#include "blizzard.cpp" - static const int trapcol[4] = {0x904040, 0xA02020, 0xD00000, 0x303030}; static const int terracol[8] = {0xD000, 0xE25050, 0xD0D0D0, 0x606060, 0x303030, 0x181818, 0x0080, 0x8080}; @@ -4640,7 +4638,7 @@ void drawcell(cell *c, transmatrix V, int spinv, bool mirrored) { if(c->land == laBlizzard) { if(vid.backeffects) { if(c->cpdist <= getDistLimit()) - blizzardcells[c].frame = frameid; + set_blizzard_frame(c, frameid); } else { forCellIdEx(c2, i, c) if(againstWind(c, c2)) diff --git a/hyper.h b/hyper.h index 430eb236..702f1014 100644 --- a/hyper.h +++ b/hyper.h @@ -3407,3 +3407,54 @@ void switch_game_mode(char switchWhat); void stop_game_and_switch_mode(char switchWhat = rg::nothing); // stop_game + switch_game_mode void restart_game(char switchWhat = rg::nothing); // popAllScreens + popAllGames + stop_game + switch_game_mode + start_game + +void generate_floorshapes(); +void drawArrowTraps(); +void drawBlizzards(); + +struct blizzardcell; + +extern vector arrowtraps; +extern map blizzardcells; +extern vector bcells; +void set_blizzard_frame(cell *c, int frameid); + +#define SIDE_SLEV 0 +#define SIDE_WALL 3 +#define SIDE_LAKE 4 +#define SIDE_LTOB 5 +#define SIDE_BTOI 6 +#define SIDE_WTS3 7 +#define SIDEPARS 8 + +struct floorshape { + bool is_plain; + int shapeid, prio; + vector b, shadow, side[SIDEPARS], gpside[SIDEPARS][8]; + floorshape() { prio = PPR_FLOOR; } + }; + +extern vector all_plain_floorshapes; +extern vector all_escher_floorshapes; + +struct plain_floorshape : floorshape { + ld rad0, rad1; + plain_floorshape() { is_plain = true; all_plain_floorshapes.push_back(this); } + void configure(ld r0, ld r1) { rad0 = r0; rad1 = r1; } + }; + +// noftype: 0 (shapeid2 is heptagonal or just use shapeid1), 1 (shapeid2 is pure heptagonal), 2 (shapeid2 is Euclidean), 3 (shapeid2 is hexagonal) +struct escher_floorshape : floorshape { + int shapeid0, shapeid1, noftype, shapeid2; + ld scale; + escher_floorshape(int s0, int s1, int noft=0, int s2=0) : shapeid0(s0), shapeid1(s1), noftype(noft), shapeid2(s2) { + all_escher_floorshapes.push_back(this); scale = 1; is_plain = false; + } + }; + +extern plain_floorshape + shFloor, + shMFloor, shMFloor2, shMFloor3, shMFloor4, shFullFloor, + shBigTriangle, shTriheptaFloor, shBigHepta; + +extern escher_floorshape shDragonFloor, shPowerFloor, shRedRockFloor[3]; diff --git a/menus.cpp b/menus.cpp index 9a94c884..33fbb5c6 100644 --- a/menus.cpp +++ b/menus.cpp @@ -1,8 +1,6 @@ // HyperRogue menus // Copyright (C) 2011-2018 Zeno Rogue, see 'hyper.cpp' for details -#include "dialogs.cpp" - // -- overview -- #define BLACKISH 0x404040 diff --git a/polygons.cpp b/polygons.cpp index a30f0513..210cf66f 100644 --- a/polygons.cpp +++ b/polygons.cpp @@ -79,14 +79,6 @@ void hpcpush(hyperpoint h) { hpc.push_back(h); } -#define SIDE_SLEV 0 -#define SIDE_WALL 3 -#define SIDE_LAKE 4 -#define SIDE_LTOB 5 -#define SIDE_BTOI 6 -#define SIDE_WTS3 7 -#define SIDEPARS 8 - bool validsidepar[SIDEPARS]; void chasmifyPoly(double fac, double fac2, int k) { @@ -1398,8 +1390,6 @@ ld dlow_table[SIDEPARS], dhi_table[SIDEPARS]; #define SHADMUL (S3==4 ? 1.05 : 1.3) -#include "floorshapes.cpp" - void buildpolys() { symmetriesAt.clear(); diff --git a/rogueviz.cpp b/rogueviz.cpp index 4f0071e0..53de85d3 100644 --- a/rogueviz.cpp +++ b/rogueviz.cpp @@ -914,9 +914,6 @@ bool edgecmp(edgeinfo *e1, edgeinfo *e2) { return e1->weight > e2->weight; } -#include "rogueviz-kohonen.cpp" -#include "rogueviz-staircase.cpp" - void describe(cell *c) { if(kind == kKohonen) return kohonen::describe(c); } @@ -1987,5 +1984,8 @@ auto hooks = #endif addHook(clearmemory, 0, close); +#include "rogueviz-kohonen.cpp" +#include "rogueviz-staircase.cpp" }; + diff --git a/system.cpp b/system.cpp index 3352588c..cb22ab5a 100644 --- a/system.cpp +++ b/system.cpp @@ -1078,6 +1078,7 @@ void popAllGames() { void stop_game() { if(!game_active) return; + DEBB(DF_INIT, (debugfile,"stop_game\n")); achievement_final(true); #if CAP_SAVE saveStats(); @@ -1119,6 +1120,7 @@ void push_game() { } void switch_game_mode(char switchWhat) { + DEBB(DF_INIT, (debugfile,"switch_game_mode\n")); switch(switchWhat) { case rg::peace: peace::on = !peace::on; @@ -1243,6 +1245,7 @@ void switch_game_mode(char switchWhat) { void start_game() { if(game_active) return; + DEBB(DF_INIT, (debugfile,"start_game\n")); game_active = true; if(need_reset_geometry) resetGeometry(); initcells();