11#include " stdafx.h"
22#include " compiler.h"
3- #include " Common/LevelGameDef.h"
4- #include " xrAICore/Navigation/level_graph.h"
5- #include " AIMapExport.h"
3+
4+ // TODO: Do we really need this?
5+ Lights g_lights;
6+ Fbox LevelBB;
67
78IC const Fvector vertex_position (const CLevelGraph::CPosition& Psrc, const Fbox& bb, const SAIParams& params)
89{
@@ -54,19 +55,18 @@ extern void Surface_Init();
5455void xrLoad (LPCSTR name, bool draft_mode)
5556{
5657 FS.get_path (" $level$" )->_set ((LPSTR)name);
57- string256 N ;
58+ string_path file_name ;
5859 if (!draft_mode)
5960 {
6061 // shaders
61- string_path N;
62- FS.update_path (N, " $game_data$" , " shaders_xrlc.xr" );
62+ FS.update_path (file_name, " $game_data$" , " shaders_xrlc.xr" );
6363 g_shaders_xrlc = new Shader_xrLC_LIB ();
64- g_shaders_xrlc->Load (N );
64+ g_shaders_xrlc->Load (file_name );
6565
6666 // Load CFORM
6767 {
68- strconcat (sizeof (N ), N , name, " build.cform" );
69- IReader* fs = FS.r_open (N );
68+ strconcat (sizeof (file_name ), file_name , name, " build.cform" );
69+ IReader* fs = FS.r_open (file_name );
7070 R_ASSERT (fs->find_chunk (0 ));
7171
7272 hdrCFORM H;
@@ -89,9 +89,8 @@ void xrLoad(LPCSTR name, bool draft_mode)
8989
9090 // Load level data
9191 {
92- strconcat (sizeof (N), N, name, " build.prj" );
93- IReader* fs = FS.r_open (N);
94- IReader* F;
92+ strconcat (sizeof (file_name), file_name, name, " build.prj" );
93+ IReader* fs = FS.r_open (file_name);
9594
9695 // Version
9796 u32 version;
@@ -111,7 +110,7 @@ void xrLoad(LPCSTR name, bool draft_mode)
111110 Logger.Status (" Processing textures..." );
112111 {
113112 Surface_Init ();
114- F = fs->open_chunk (EB_Textures);
113+ IReader* F = fs->open_chunk (EB_Textures);
115114 u32 tex_count = F->length () / sizeof (b_texture);
116115 for (u32 t = 0 ; t < tex_count; t++)
117116 {
@@ -176,8 +175,7 @@ void xrLoad(LPCSTR name, bool draft_mode)
176175 BT.pSurface = Surface_Load (N, w, h);
177176 R_ASSERT2 (BT.pSurface , " Can't load surface" );
178177 if ((w != BT.dwWidth ) || (h != BT.dwHeight ))
179- Msg (" ! THM doesn't correspond to the texture: %dx%d -> %dx%d" , BT.dwWidth ,
180- BT.dwHeight , w, h);
178+ Msg (" ! THM doesn't correspond to the texture: %dx%d -> %dx%d" , BT.dwWidth , BT.dwHeight , w, h);
181179 BT.Vflip ();
182180 }
183181 else
@@ -195,9 +193,8 @@ void xrLoad(LPCSTR name, bool draft_mode)
195193 }
196194 // Load lights
197195 {
198- strconcat (sizeof (N), N, name, " build.prj" );
199-
200- IReader* F = FS.r_open (N);
196+ strconcat (sizeof (file_name), file_name, name, " build.prj" );
197+ IReader* F = FS.r_open (file_name);
201198 R_ASSERT2 (F, " There is no file 'build.prj'!" );
202199 IReader& fs = *F;
203200
@@ -256,10 +253,9 @@ void xrLoad(LPCSTR name, bool draft_mode)
256253 }
257254 // Load initial map from the Level Editor
258255 {
259- string_path file_name;
260256 strconcat (sizeof (file_name), file_name, name, " build.aimap" );
261257 IReader* F = FS.r_open (file_name);
262- R_ASSERT2 (F, file_name );
258+ R_ASSERT2 (F, " There is no file 'build.aimap'! " );
263259
264260 R_ASSERT (F->open_chunk (E_AIMAP_CHUNK_VERSION));
265261 R_ASSERT (F->r_u16 () == E_AIMAP_VERSION);
0 commit comments