From 8f972d972dd125ca14bd51261c58650b09bac18e Mon Sep 17 00:00:00 2001 From: Raimon Zamora Date: Sun, 28 Sep 2025 13:48:56 +0200 Subject: [PATCH] - Ja funciona que cada sector tinga una altura de sostre diferent --- main.cpp | 24 +++++++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-) diff --git a/main.cpp b/main.cpp index 07fc972..7f7af16 100644 --- a/main.cpp +++ b/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_startportal].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=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); }