shithub: nanobsp

Download patch

ref: 44ccf1e555176bdfe47f69b95707feb9a47c2262
parent: 566511ed387125e9ad6cec3135884f01da24ac83
author: Andrew Apted <ajapted@gmail.com>
date: Fri Dec 8 18:25:33 EST 2023

added code file "nano_bsp.c", and updated Makefile for it.

This file only has a little bit of code so far....

--- a/Makefile
+++ b/Makefile
@@ -70,6 +70,7 @@
 	$(OBJ_DIR)/memio.o \
 	$(OBJ_DIR)/midifile.o \
 	$(OBJ_DIR)/mus2mid.o \
+	$(OBJ_DIR)/nano_bsp.o \
 	$(OBJ_DIR)/opl3.o \
 	$(OBJ_DIR)/opl_sdl.o \
 	$(OBJ_DIR)/opl_queue.o \
--- /dev/null
+++ b/nano_bsp.c
@@ -1,0 +1,89 @@
+//----------------------------------------------------------------------------
+//
+//  Copyright (c) 2023  Andrew Apted
+//
+//  This program is free software; you can redistribute it and/or
+//  modify it under the terms of the GNU General Public License
+//  as published by the Free Software Foundation; either version 2
+//  of the License, or (at your option) any later version.
+//
+//  This program is distributed in the hope that it will be useful,
+//  but WITHOUT ANY WARRANTY; without even the implied warranty of
+//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+//  GNU General Public License for more details.
+//
+//----------------------------------------------------------------------------
+
+#include "i_system.h"
+
+#include <stdlib.h>
+#include <assert.h>
+
+#include "doomtype.h"
+#include "doomstat.h"
+#include "d_ticcmd.h"
+#include "d_event.h"
+#include "m_fixed.h"
+#include "m_bbox.h"
+#include "m_misc.h"
+#include "m_random.h"
+#include "z_zone.h"
+
+#include "p_local.h"
+#include "p_mobj.h"
+
+#include "nano_bsp.h"
+
+
+#undef MAX
+#define MAX(a, b)  ((a) > (b) ? (a) : (b))
+
+#undef MIN
+#define MIN(a, b)  ((a) < (b) ? (a) : (b))
+
+// #define DIST_EPSILON  (1.0 / 256.0)
+
+
+seg_t * BSP_NewSeg (void)
+{
+	seg_t * seg = Z_Malloc (sizeof(seg_t), PU_LEVEL, NULL);
+	memset (seg, 0, sizeof(*seg));
+	return seg;
+}
+
+
+//----------------------------------------------------------------------------
+
+void BSP_SegForLineSide (int i, int side, seg_t ** list_var)
+{
+	line_t * ld = &lines[i];
+
+	// TODO
+
+	// if (side == 1 && ld->
+}
+
+
+seg_t * BSP_CreateSegs (void)
+{
+	seg_t * list = NULL;
+
+	int i;
+	for (i = 0 ; i < numlines ; i++)
+	{
+		BSP_SegForLineSide (i, 0, &list);
+		BSP_SegForLineSide (i, 1, &list);
+	}
+
+	return list;
+}
+
+
+//----------------------------------------------------------------------------
+
+void Nano_BuildBSP (void)
+{
+	seg_t * list = BSP_CreateSegs ();
+
+	// TODO
+}
--