Merge branch 'master' into 635-nvrhi3

This commit is contained in:
Robert Beckebans 2022-09-23 19:26:13 +02:00
commit cc169f9ba8
2 changed files with 130 additions and 9 deletions

View file

@ -428,17 +428,14 @@ Existing repositories can be updated manually:
---
# Compiling on Windows <a name="compile_windows"></a>
1. Download and install the Visual Studio 2017 Community Edition.
1. Download and install the Visual Studio 2019 Community Edition.
2. **Only for Windows 7 builds**: Download and install the DirectX SDK (June 2010)
http://www.microsoft.com/en-us/download/details.aspx?id=6812
2. Download and install the latest CMake and make sure cmake.exe is added to your global or user PATH.
3. Download and install the latest CMake.
3. Generate the VS2019 projects using CMake by doubleclicking a matching configuration .bat file in the neo/ folder.
Recommended in this case is `cmake-vs2019-64bit-windows10.bat`
4. Generate the VS2017 projects using CMake by doubleclicking a matching configuration .bat file in the neo/ folder.
Recommended in this case is `cmake-vs2017-64bit-windows10.bat`
5. Use the VS2017 solution to compile what you need:
4. Use the VS2019 solution to compile what you need:
RBDOOM-3-BFG/build/RBDoom3BFG.sln

View file

@ -3,7 +3,7 @@
Doom 3 GPL Source Code
Copyright (C) 1999-2011 id Software LLC, a ZeniMax Media company.
Copyright (C) 2013-2015 Robert Beckebans
Copyright (C) 2013-2022 Robert Beckebans
This file is part of the Doom 3 GPL Source Code (?Doom 3 Source Code?).
@ -659,6 +659,123 @@ int NumberNodes_r( node_t* node, int nextNumber )
return nextNumber;
}
// RB begin
// https://stackoverflow.com/questions/801740/c-how-to-draw-a-binary-tree-to-the-console
//
static int WriteASCIIArtNode_r( node_t* node, bool is_left, int offset, int depth, char s[20][2048], idFile* procFile )
{
char b[20];
int width = 5;
if( node->planenum == PLANENUM_LEAF )
{
int val = -1 - node->area;
if( val == 0 )
{
// is in solid / touches the outside void
idStr::snPrintf( b, 20, "(666)", val );
}
else
{
// leaf is area
idStr::snPrintf( b, 20, "(A%02d)", val );
}
}
else
{
int val = node->nodeNumber;
idStr::snPrintf( b, 20, "(%03d)", val );
}
int left = 0;
int right = 0;
if( node->planenum != PLANENUM_LEAF )
{
/*
int child[2];
for( int i = 0 ; i < 2 ; i++ )
{
if( node->children[i]->planenum == PLANENUM_LEAF )
{
child[i] = -1 - node->children[i]->area;
}
else
{
child[i] = node->children[i]->nodeNumber;
}
}
*/
if( depth < 19 )
{
//if( child[0] > 0 )
{
left = WriteASCIIArtNode_r( node->children[0], true, offset, depth + 1, s, procFile );
}
//if( child[1] > 0 )
{
right = WriteASCIIArtNode_r( node->children[1], false, offset + left + width, depth + 1, s, procFile );
}
}
}
for( int i = 0; i < width; i++ )
{
s[depth][offset + left + i] = b[i];
}
if( depth && is_left )
{
for( int i = 0; i < width + right; i++ )
{
s[depth - 1][offset + left + width / 2 + i] = '-';
}
s[depth - 1][offset + left + width / 2] = '.';
}
else if( depth && !is_left )
{
for( int i = 0; i < left + width; i++ )
{
s[depth - 1][offset - width / 2 + i] = '-';
}
s[depth - 1][offset + left + width / 2] = '.';
}
return left + width + right;
}
static void WriteVisualBSPTree( node_t* node, idFile* procFile )
{
// TODO calculuate depth instead of assuming 20
int s_len = 20;
char s[20][2048];
// output
procFile->WriteFloatString( "/* BSP tree visualization:\n\n" );
for( int i = 0; i < 20; i++ )
{
idStr::snPrintf( s[i], 2048, "%640s", " " );
}
WriteASCIIArtNode_r( node, 0, 0, 0, s, procFile );
for( int i = 0; i < 20; i++ )
{
procFile->WriteFloatString( "%s\n", s[i] );
}
procFile->WriteFloatString( "*/\n\n" );
}
// RB end
/*
====================
WriteOutputNodes
@ -678,6 +795,13 @@ static void WriteOutputNodes( node_t* node, idFile* procFile )
procFile->WriteFloatString( "/* a child number of 0 is an opaque, solid area */\n" );
procFile->WriteFloatString( "/* negative child numbers are areas: (-1-child) */\n" );
// RB: draw an extra ASCII BSP tree visualization for YouTube tutorial
if( dmapGlobals.glview )
{
WriteVisualBSPTree( node, procFile );
}
// RB end
WriteNode_r( node, procFile );
procFile->WriteFloatString( "}\n\n" );