mirror of
https://github.com/zenorogue/hyperrogue.git
synced 2025-10-27 11:57:40 +00:00
nilrider:: fixed castle texture and minitriangle regen
This commit is contained in:
@@ -4,6 +4,7 @@ const int steps_per_block = 16;
|
|||||||
const int texture_density = 64;
|
const int texture_density = 64;
|
||||||
|
|
||||||
void level::init_textures() {
|
void level::init_textures() {
|
||||||
|
create_castle();
|
||||||
int tY = isize(map_tiles);
|
int tY = isize(map_tiles);
|
||||||
int tX = isize(map_tiles[0]);
|
int tX = isize(map_tiles[0]);
|
||||||
|
|
||||||
@@ -459,6 +460,7 @@ void level::draw_level(const shiftmatrix& V) {
|
|||||||
int id = 0;
|
int id = 0;
|
||||||
init_statues();
|
init_statues();
|
||||||
curlev->init_shapes();
|
curlev->init_shapes();
|
||||||
|
curlev->init_textures();
|
||||||
|
|
||||||
for(auto& t: triangles) {
|
for(auto& t: triangles) {
|
||||||
bool gotit = current.collected_triangles & Flag(id);
|
bool gotit = current.collected_triangles & Flag(id);
|
||||||
@@ -482,7 +484,6 @@ void level::draw_level(const shiftmatrix& V) {
|
|||||||
|
|
||||||
queuepoly(V, shField, 0xFFFF00FF);
|
queuepoly(V, shField, 0xFFFF00FF);
|
||||||
|
|
||||||
curlev->init_textures();
|
|
||||||
if(!stepped_display) {
|
if(!stepped_display) {
|
||||||
auto& poly = queuepoly(V, shFloor, 0xFFFFFFFF); // 0xFFFFFFFF);
|
auto& poly = queuepoly(V, shFloor, 0xFFFFFFFF); // 0xFFFFFFFF);
|
||||||
poly.tinf = &uniltinf;
|
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() {
|
void cleanup_textures() {
|
||||||
for(auto l: all_levels) {
|
for(auto l: all_levels) {
|
||||||
if(l->unil_texture) delete(l->unil_texture);
|
cleanup_texture(l->unil_texture);
|
||||||
l->unil_texture = nullptr;
|
cleanup_texture(l->unil_texture_stepped);
|
||||||
if(l->unil_texture_stepped) delete(l->unil_texture_stepped);
|
|
||||||
l->unil_texture_stepped = nullptr;
|
|
||||||
}
|
}
|
||||||
|
println(hlog, "CLEANUP texture");
|
||||||
|
cleanup_texture(castle_texture);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -25,6 +25,8 @@ hpcshape shMini[6];
|
|||||||
|
|
||||||
void create_minitriangle() {
|
void create_minitriangle() {
|
||||||
using namespace bricks;
|
using namespace bricks;
|
||||||
|
bricks::bricks.clear();
|
||||||
|
build(false);
|
||||||
hyperpoint ctr = Hypc;
|
hyperpoint ctr = Hypc;
|
||||||
for(auto& b: bricks::bricks) ctr += b.location;
|
for(auto& b: bricks::bricks) ctr += b.location;
|
||||||
ctr /= ctr[3];
|
ctr /= ctr[3];
|
||||||
@@ -79,9 +81,6 @@ void create_castle() {
|
|||||||
tex.get_texture_pixel(x, y) = bcols[submaps['b'][y][x]];
|
tex.get_texture_pixel(x, y) = bcols[submaps['b'][y][x]];
|
||||||
tex.loadTextureGL();
|
tex.loadTextureGL();
|
||||||
}
|
}
|
||||||
|
|
||||||
bricks::build(false);
|
|
||||||
create_minitriangle();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
hpcshape shBall;
|
hpcshape shBall;
|
||||||
@@ -118,7 +117,6 @@ void init_statues() {
|
|||||||
if(cgi.ext.count("nil-statues")) return;
|
if(cgi.ext.count("nil-statues")) return;
|
||||||
cgi.ext["nil-statues"] = nullptr;
|
cgi.ext["nil-statues"] = nullptr;
|
||||||
create_minitriangle();
|
create_minitriangle();
|
||||||
create_castle();
|
|
||||||
|
|
||||||
cgi.bshape(shBall, PPR::WALL);
|
cgi.bshape(shBall, PPR::WALL);
|
||||||
shBall.flags |= POLY_TRIANGLES;
|
shBall.flags |= POLY_TRIANGLES;
|
||||||
|
|||||||
Reference in New Issue
Block a user