- Ja funciona que cada sector tinga una altura de sostre diferent
This commit is contained in:
24
main.cpp
24
main.cpp
@@ -162,7 +162,7 @@ void createMap()
|
||||
{
|
||||
sector s;
|
||||
s.floor_height = 0.0f;
|
||||
s.ceiling_height = 128.0f;
|
||||
s.ceiling_height = 64.0f;
|
||||
|
||||
s.verts.push_back({256.0f, 0.0f});
|
||||
s.verts.push_back({ 64.0f, 0.0f});
|
||||
@@ -222,12 +222,14 @@ void drawColumn(sector &s, int screen_column, int start, int end, float a_inc, v
|
||||
float v = dot(AP,AB) / dot(AB,AB); v *= w->u2; v = (v-int(v))*tex_height;
|
||||
|
||||
float wall_height = (sector_height*277)/dist; // [64=altura sector]
|
||||
float wall_cut = 0.0f;
|
||||
float dpix = tex_height/wall_height; // [64=crec que altura sector]
|
||||
float cpix = 0;
|
||||
float wall_start = 120-(wall_height/sector_height)*(sector_height-(height-s.floor_height)); // [64=els dos crec que altura sector]
|
||||
if (wall_start<start) {
|
||||
cpix = (start-wall_start)*dpix;
|
||||
wall_height -= (start-wall_start);
|
||||
wall_cut = start-wall_start;
|
||||
cpix = wall_cut*dpix;
|
||||
wall_height -= wall_cut;
|
||||
wall_start=start;
|
||||
}
|
||||
|
||||
@@ -250,6 +252,22 @@ void drawColumn(sector &s, int screen_column, int start, int end, float a_inc, v
|
||||
cpix += dpix;
|
||||
}
|
||||
} else {
|
||||
if (sectors[w->portal].ceiling_height < s.ceiling_height)
|
||||
{
|
||||
float upper_height = s.ceiling_height - sectors[w->portal].ceiling_height;
|
||||
float upper_wall_height = (upper_height*277)/dist;
|
||||
upper_wall_height -= wall_cut;
|
||||
if (upper_wall_height>0.0f)
|
||||
{
|
||||
// Pinta la pared
|
||||
for (int i=0; i<upper_wall_height; ++i) {
|
||||
if (wall_start+i>=end) break;
|
||||
putp(screen_column, wall_start+i, gif[(int(v)%tex_height)+int(cpix)*tex_height]);
|
||||
cpix += dpix;
|
||||
}
|
||||
wall_start += upper_wall_height;
|
||||
}
|
||||
}
|
||||
const int wall_end = SDL_min(wall_start+wall_height+1, 240);
|
||||
drawColumn(sectors[w->portal], screen_column, wall_start, wall_end, a_inc, infi);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user