1
0
mirror of https://github.com/zenorogue/hyperrogue.git synced 2024-12-24 17:10:36 +00:00

nilrider:: fixed castle texture and minitriangle regen

This commit is contained in:
Zeno Rogue 2022-05-06 19:51:46 +02:00
parent 54fa76ecf8
commit da3584a89d
2 changed files with 13 additions and 9 deletions

View File

@ -4,6 +4,7 @@ const int steps_per_block = 16;
const int texture_density = 64;
void level::init_textures() {
create_castle();
int tY = isize(map_tiles);
int tX = isize(map_tiles[0]);
@ -459,6 +460,7 @@ void level::draw_level(const shiftmatrix& V) {
int id = 0;
init_statues();
curlev->init_shapes();
curlev->init_textures();
for(auto& t: triangles) {
bool gotit = current.collected_triangles & Flag(id);
@ -482,7 +484,6 @@ void level::draw_level(const shiftmatrix& V) {
queuepoly(V, shField, 0xFFFF00FF);
curlev->init_textures();
if(!stepped_display) {
auto& poly = queuepoly(V, shFloor, 0xFFFFFFFF); // 0xFFFFFFFF);
poly.tinf = &uniltinf;
@ -495,12 +496,17 @@ void level::draw_level(const shiftmatrix& V) {
}
}
void cleanup_texture(texture::texture_data*& d) {
if(d) delete d;
d = nullptr;
}
void cleanup_textures() {
for(auto l: all_levels) {
if(l->unil_texture) delete(l->unil_texture);
l->unil_texture = nullptr;
if(l->unil_texture_stepped) delete(l->unil_texture_stepped);
l->unil_texture_stepped = nullptr;
cleanup_texture(l->unil_texture);
cleanup_texture(l->unil_texture_stepped);
}
println(hlog, "CLEANUP texture");
cleanup_texture(castle_texture);
}
}

View File

@ -25,6 +25,8 @@ hpcshape shMini[6];
void create_minitriangle() {
using namespace bricks;
bricks::bricks.clear();
build(false);
hyperpoint ctr = Hypc;
for(auto& b: bricks::bricks) ctr += b.location;
ctr /= ctr[3];
@ -79,9 +81,6 @@ void create_castle() {
tex.get_texture_pixel(x, y) = bcols[submaps['b'][y][x]];
tex.loadTextureGL();
}
bricks::build(false);
create_minitriangle();
}
hpcshape shBall;
@ -118,7 +117,6 @@ void init_statues() {
if(cgi.ext.count("nil-statues")) return;
cgi.ext["nil-statues"] = nullptr;
create_minitriangle();
create_castle();
cgi.bshape(shBall, PPR::WALL);
shBall.flags |= POLY_TRIANGLES;