Skip to content

Commit 89b6eb5

Browse files
committed
- initial work on level viewer
1 parent 9bbd0f4 commit 89b6eb5

11 files changed

Lines changed: 5889 additions & 7 deletions

File tree

DriverLevelTool/driver_level.cpp

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
#include "model_compiler/compiler.h"
66
#include "util/util.h"
7+
#include "viewer/viewer.h"
78

89
bool g_export_carmodels = false;
910
bool g_export_models = false;
@@ -133,6 +134,7 @@ void PrintCommandLineArguments()
133134
const char* argumentsMessage =
134135
"Example: DriverLevelTool <command> [arguments]\n\n\n"
135136
" -lev <filename.LEV> \t: Specify level file you want to input\n\n"
137+
" -viewer \t: Enables level file viewer\n\n"
136138
" -format <n> \t: Specify level format. 1 = Driver 1, 2 = Driver 2 Demo (alpha 1.6), 3 = Driver 2 Retail\n\n"
137139
" -textures <1/0> \t: Export textures (TGA)\n\n"
138140
" -models <1/0> \t: Export models (OBJ\n\n"
@@ -162,11 +164,15 @@ int main(int argc, char* argv[])
162164
}
163165

164166
bool generate_denting = false;
165-
bool do_main_routine = true;
167+
int main_routine = 1;
166168

167169
for (int i = 1; i < argc; i++)
168170
{
169-
if (!stricmp(argv[i], "-format"))
171+
if (!stricmp(argv[i], "-viewer"))
172+
{
173+
main_routine = 2;
174+
}
175+
else if (!stricmp(argv[i], "-format"))
170176
{
171177
g_format = (ELevelFormat)atoi(argv[i + 1]);
172178
i++;
@@ -213,7 +219,7 @@ int main(int argc, char* argv[])
213219
else if (!stricmp(argv[i], "-dmodel2obj"))
214220
{
215221
ConvertDModelFileToOBJ(argv[i + 1], argv[i + 2]);
216-
do_main_routine = false;
222+
main_routine = 0;
217223
i += 2;
218224
}
219225
else if (!stricmp(argv[i], "-denting"))
@@ -223,7 +229,7 @@ int main(int argc, char* argv[])
223229
else if (!stricmp(argv[i], "-compiledmodel"))
224230
{
225231
CompileOBJModelToDMODEL(argv[i + 1], argv[i + 2], generate_denting);
226-
do_main_routine = false;
232+
main_routine = 0;
227233
generate_denting = false; // disable denting compiler after it's job done
228234
i += 2;
229235
}
@@ -241,8 +247,10 @@ int main(int argc, char* argv[])
241247
return 0;
242248
}
243249

244-
if(do_main_routine)
250+
if (main_routine == 1)
245251
ProcessLevFile(g_levname.c_str());
252+
else if (main_routine == 2)
253+
ViewerMain(g_levname.c_str());
246254

247255
return 0;
248256
}

DriverLevelTool/driver_routines/textures.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ TVec4D<ubyte> bgr5a1_ToRGBA8(ushort color)
3131
{
3232
ubyte b = (color & 0x1F) * 8;
3333
ubyte g = ((color >> 5) & 0x1F) * 8;
34-
ubyte r = ((color >> 10) & 0x1F) * 8;
34+
ubyte r = ((color >> 9) & 0x1F) * 8;
3535

3636
ubyte a = (color >> 15);
3737

DriverLevelTool/premake5.lua

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ project "DriverLevelTool"
1111
}
1212

1313
files {
14+
"**.c",
1415
"**.cpp",
1516
"**.h",
1617
"driver_routines/**.cpp",
@@ -24,6 +25,18 @@ project "DriverLevelTool"
2425
}
2526

2627
cppdialect "C++11"
28+
29+
filter "system:windows"
30+
includedirs {
31+
SDL2_DIR.."/include"
32+
}
33+
links {
34+
"SDL2",
35+
}
36+
libdirs {
37+
SDL2_DIR.."/lib/x86",
38+
}
39+
2740

2841
filter "configurations:Debug"
2942
targetsuffix "_dbg"

0 commit comments

Comments
 (0)