diff options
| author | Felix Morgner <felix.morgner@gmail.com> | 2026-08-24 11:16:07 +0200 |
|---|---|---|
| committer | Felix Morgner <felix.morgner@gmail.com> | 2026-08-24 11:16:07 +0200 |
| commit | c068f22329d5cc722622a2183bbb22eef2093df7 (patch) | |
| tree | 12d56c1aede67988a55e241364606bfbb4dba933 /tool_src/BspLib/BspFormat.cpp | |
| download | openparsec-c068f22329d5cc722622a2183bbb22eef2093df7.tar.xz openparsec-c068f22329d5cc722622a2183bbb22eef2093df7.zip | |
Diffstat (limited to 'tool_src/BspLib/BspFormat.cpp')
| -rw-r--r-- | tool_src/BspLib/BspFormat.cpp | 71 |
1 files changed, 71 insertions, 0 deletions
diff --git a/tool_src/BspLib/BspFormat.cpp b/tool_src/BspLib/BspFormat.cpp new file mode 100644 index 0000000..a358339 --- /dev/null +++ b/tool_src/BspLib/BspFormat.cpp @@ -0,0 +1,71 @@ +//----------------------------------------------------------------------------- +// BSPLIB MODULE: BspFormat.cpp +// +// Copyright (c) 1997 by Markus Hadwiger +// All Rights Reserved. +//----------------------------------------------------------------------------- + +// bsplib header files +#include "BspFormat.h" + + +BSPLIB_NAMESPACE_BEGIN + + +// get index to section id specified as string (this function is static!) ----- +// +int BspFormat::GetSectionId( char *section_name ) +{ + int sectionid = SingleFormat::GetSectionId( section_name ); + if ( sectionid == _nil ) { + for ( int i = 0; i < _num_bsp_sections - _num_single_sections; i++ ) + if ( stricmp( section_name, section_strings[ i ] ) == 0 ) + return section_ids[ i ]; + } + return sectionid; +} + + +// get name of section specified via id (this function is static!) ------------ +// +const char *BspFormat::GetSectionName( int section_id ) +{ + const char *sectionname = SingleFormat::GetSectionName( section_id ); + if ( sectionname == NULL ) { + return ( section_id < _num_bsp_sections ) ? + section_strings[ section_id - _num_single_sections ] : NULL; + } + return sectionname; +} + + +// BspFormat specific static variables ---------------------------------------- +// +const char BspFormat::_bspsig_str[] = "#BSP"; +const char BspFormat::BSP_FILE_EXTENSION[] = ".bsp"; + +const char BspFormat::_bspspec_polygon_str[] = "polygon"; +const char BspFormat::_bspspec_frontlist_str[] = "frontlist"; +const char BspFormat::_bspspec_backlist_str[] = "backlist"; +const char BspFormat::_bspspec_fronttree_str[] = "fronttree"; +const char BspFormat::_bspspec_backtree_str[] = "backtree"; +const char BspFormat::_bspspec_plane_str[] = "plane"; +const char BspFormat::_bspspec_boundingbox_str[] = "boundingbox"; + +const char BspFormat::_bsptree_str[] = "#bsptree"; +const char BspFormat::_polygons_str[] = "#polygons"; + +// additional section names table +const char *BspFormat::section_strings[] = { + _bsptree_str, + _polygons_str +}; +const int BspFormat::section_ids[] = { + _bsptree, + _polygons +}; + + +BSPLIB_NAMESPACE_END + +//----------------------------------------------------------------------------- |
