mirror of
https://github.com/zenorogue/hyperrogue.git
synced 2025-12-23 05:56:57 +00:00
clear cgis, fixed missing textures
This commit is contained in:
@@ -964,6 +964,7 @@ void geometry_information::make_floor_textures_here() {
|
|||||||
IMAGESAVE(sdark, "texture-test.png");
|
IMAGESAVE(sdark, "texture-test.png");
|
||||||
*/
|
*/
|
||||||
rb.reset();
|
rb.reset();
|
||||||
|
last_texture_step = vid.texture_step;
|
||||||
}
|
}
|
||||||
|
|
||||||
void make_floor_textures() {
|
void make_floor_textures() {
|
||||||
|
|||||||
31
geometry.cpp
31
geometry.cpp
@@ -432,6 +432,8 @@ void switch_always3() {
|
|||||||
geometry_information *cgip;
|
geometry_information *cgip;
|
||||||
map<string, geometry_information> cgis;
|
map<string, geometry_information> cgis;
|
||||||
|
|
||||||
|
int last_texture_step;
|
||||||
|
|
||||||
void check_cgi() {
|
void check_cgi() {
|
||||||
string s;
|
string s;
|
||||||
auto V = [&] (string a, string b) { s += a; s += ": "; s += b; s += "; "; };
|
auto V = [&] (string a, string b) { s += a; s += ": "; s += b; s += "; "; };
|
||||||
@@ -473,6 +475,35 @@ void check_cgi() {
|
|||||||
V("LQ", its(vid.linequality));
|
V("LQ", its(vid.linequality));
|
||||||
|
|
||||||
cgip = &cgis[s];
|
cgip = &cgis[s];
|
||||||
|
|
||||||
|
if(isize(cgis) > 2) {
|
||||||
|
cgi.timestamp = ticks;
|
||||||
|
vector<pair<int, string>> timestamps;
|
||||||
|
for(auto& t: cgis) timestamps.emplace_back(-t.second.timestamp, t.first);
|
||||||
|
sort(timestamps.begin(), timestamps.end());
|
||||||
|
while(isize(timestamps) > 2) {
|
||||||
|
println(hlog, "erasing geometry ", timestamps.back().second);
|
||||||
|
cgis.erase(timestamps.back().second);
|
||||||
|
timestamps.pop_back();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(floor_textures && last_texture_step != vid.texture_step) {
|
||||||
|
println(hlog, "changed ", last_texture_step, " to ", vid.texture_step);
|
||||||
|
delete floor_textures;
|
||||||
|
floor_textures = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(!floor_textures && DIM == 3 && (cgi.state & 2))
|
||||||
|
make_floor_textures();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void clear_cgis() {
|
||||||
|
printf("clear_cgis\n");
|
||||||
|
for(auto& p: cgis) if(&p.second != &cgi) { cgis.erase(p.first); return; }
|
||||||
|
}
|
||||||
|
|
||||||
|
auto ah_clear_geo = addHook(hooks_clear_cache, 0, clear_cgis);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
1
hyper.h
1
hyper.h
@@ -4605,6 +4605,7 @@ hpcshape
|
|||||||
void require_basics() { if(state & 1) return; state |= 1; prepare_basics(); }
|
void require_basics() { if(state & 1) return; state |= 1; prepare_basics(); }
|
||||||
void require_shapes() { if(state & 2) return; state |= 2; prepare_shapes(); }
|
void require_shapes() { if(state & 2) return; state |= 2; prepare_shapes(); }
|
||||||
void require_usershapes() { if(usershape_state == usershape_changes) return; usershape_state = usershape_changes; prepare_usershapes(); }
|
void require_usershapes() { if(usershape_state == usershape_changes) return; usershape_state = usershape_changes; prepare_usershapes(); }
|
||||||
|
int timestamp;
|
||||||
};
|
};
|
||||||
|
|
||||||
#if MAXMDIM >= 4
|
#if MAXMDIM >= 4
|
||||||
|
|||||||
Reference in New Issue
Block a user