From 85353d64fb502f27954b52db9365d3b4da994413 Mon Sep 17 00:00:00 2001 From: Raimon Zamora Date: Mon, 2 Mar 2026 17:14:54 +0100 Subject: [PATCH] =?UTF-8?q?-=20[NEW]=20Carrega=20de=20la=20posici=C3=B3,?= =?UTF-8?q?=20orientaci=C3=B3=20i=20sector=20inicials=20des=20del=20WAD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- main.cpp | 37 ++++++++++++++++++++++++++++++++++++- util.h | 2 +- 2 files changed, 37 insertions(+), 2 deletions(-) diff --git a/main.cpp b/main.cpp index 1216780..600f228 100644 --- a/main.cpp +++ b/main.cpp @@ -39,6 +39,13 @@ struct sector { std::vector walls; }; +struct thing_t { + int16_t x_position; + int16_t y_position; + int16_t angle; + int16_t type; + int16_t flags; +}; std::vector sectors; int current_sector = 38; @@ -68,6 +75,7 @@ draw::surface_t *sky; int drawColumn_count = 0; uint8_t *colormap; +thing_t *things; #pragma pack(push, 1) struct sidedef { @@ -80,6 +88,16 @@ struct sidedef { }; #pragma pack(pop) +const bool is_inside_sector(sector &s, float x, float y) +{ + const vec2 infinity = {100000.0f, 100000.0f}; + int intersections = 0; + for (auto wall : s.walls) { + if (get_line_intersection(vec2{x,y}, infinity, verts[wall.v1], verts[wall.v2], nullptr)) intersections++; + } + return (intersections%2)!=0; +} + // ------------------------------------------------------------ // Área firmada de un contorno // ------------------------------------------------------------ @@ -222,6 +240,17 @@ void loadMap(const char* name) { int size; + things = (thing_t*)wad::load(name, "THINGS", &size); + const int thing_count = size/10; + for (int i=0;i