mirror of
https://github.com/XProger/OpenLara.git
synced 2025-08-01 19:00:34 +02:00
#15 Windows reading level and soundtrack name from command line
This commit is contained in:
BIN
bin/008.ogg
Normal file
BIN
bin/008.ogg
Normal file
Binary file not shown.
BIN
bin/CUT1.PHD
Normal file
BIN
bin/CUT1.PHD
Normal file
Binary file not shown.
BIN
bin/OpenLara.exe
BIN
bin/OpenLara.exe
Binary file not shown.
16
src/game.h
16
src/game.h
@@ -10,30 +10,32 @@
|
|||||||
namespace Game {
|
namespace Game {
|
||||||
Level *level;
|
Level *level;
|
||||||
|
|
||||||
void startLevel(Stream &stream, bool demo, bool home) {
|
void startLevel(Stream &stream, const char *sndName, bool demo, bool home) {
|
||||||
delete level;
|
delete level;
|
||||||
level = new Level(stream, demo, home);
|
level = new Level(stream, demo, home);
|
||||||
|
|
||||||
#ifndef __EMSCRIPTEN__
|
#ifndef __EMSCRIPTEN__
|
||||||
//Sound::play(Sound::openWAD("05_Lara's_Themes.wav"), 1, 1, 0);
|
//Sound::play(Sound::openWAD("05_Lara's_Themes.wav"), 1, 1, 0);
|
||||||
Sound::play(new Stream("05.ogg"), vec3(0.0f), 1, 1, Sound::Flags::LOOP);
|
Sound::play(new Stream(sndName), vec3(0.0f), 1, 1, Sound::Flags::LOOP);
|
||||||
//Sound::play(new Stream("03.mp3"), 1, 1, 0);
|
//Sound::play(new Stream("03.mp3"), 1, 1, 0);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void startLevel(const char *name, bool demo, bool home) {
|
void startLevel(const char *lvlName, const char *sndName, bool demo, bool home) {
|
||||||
Stream stream(name);
|
Stream stream(lvlName);
|
||||||
startLevel(stream, demo, home);
|
startLevel(stream, sndName, demo, home);
|
||||||
}
|
}
|
||||||
|
|
||||||
void init() {
|
void init(char *lvlName = NULL, char *sndName = NULL) {
|
||||||
Core::init();
|
Core::init();
|
||||||
level = NULL;
|
level = NULL;
|
||||||
|
|
||||||
|
if (!lvlName) lvlName = "LEVEL2.PSX";
|
||||||
|
if (!sndName) sndName = "05.ogg";
|
||||||
//lstartLevel("LEVEL2_DEMO.PHD", true, false);
|
//lstartLevel("LEVEL2_DEMO.PHD", true, false);
|
||||||
//lstartLevel("GYM.PSX", false, true);
|
//lstartLevel("GYM.PSX", false, true);
|
||||||
//lstartLevel("LEVEL3A.PHD", false, false);
|
//lstartLevel("LEVEL3A.PHD", false, false);
|
||||||
startLevel("CUT1.PHD", false, false);
|
startLevel(lvlName, sndName, false, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
void free() {
|
void free() {
|
||||||
|
@@ -141,8 +141,8 @@
|
|||||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<Link>
|
<Link>
|
||||||
<SubSystem>Windows</SubSystem>
|
<SubSystem>Console</SubSystem>
|
||||||
<GenerateDebugInformation>false</GenerateDebugInformation>
|
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||||
<OptimizeReferences>true</OptimizeReferences>
|
<OptimizeReferences>true</OptimizeReferences>
|
||||||
<AdditionalDependencies>wcrt.lib;opengl32.lib;winmm.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
<AdditionalDependencies>wcrt.lib;opengl32.lib;winmm.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||||
|
@@ -272,15 +272,16 @@ void freeGL(HGLRC hRC) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#ifdef _DEBUG
|
#ifdef _DEBUG
|
||||||
int main() {
|
int main(int argc, char** argv) {
|
||||||
_CrtMemState _ms;
|
_CrtMemState _ms;
|
||||||
_CrtMemCheckpoint(&_ms);
|
_CrtMemCheckpoint(&_ms);
|
||||||
_CrtSetReportMode(_CRT_WARN, _CRTDBG_MODE_FILE);
|
_CrtSetReportMode(_CRT_WARN, _CRTDBG_MODE_FILE);
|
||||||
_CrtSetReportFile(_CRT_WARN, _CRTDBG_FILE_STDOUT);
|
_CrtSetReportFile(_CRT_WARN, _CRTDBG_FILE_STDOUT);
|
||||||
#elif PROFILE
|
//#elif PROFILE
|
||||||
int main() {
|
|
||||||
#else
|
#else
|
||||||
int CALLBACK WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow) {
|
int main(int argc, char** argv) {
|
||||||
|
//#else
|
||||||
|
//int CALLBACK WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow) {
|
||||||
#endif
|
#endif
|
||||||
RECT r = { 0, 0, 1280, 720 };
|
RECT r = { 0, 0, 1280, 720 };
|
||||||
AdjustWindowRect(&r, WS_OVERLAPPEDWINDOW, false);
|
AdjustWindowRect(&r, WS_OVERLAPPEDWINDOW, false);
|
||||||
@@ -292,7 +293,11 @@ int CALLBACK WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLi
|
|||||||
|
|
||||||
joyInit();
|
joyInit();
|
||||||
sndInit(hWnd);
|
sndInit(hWnd);
|
||||||
Game::init();
|
|
||||||
|
char *lvlName = argc > 1 ? argv[1] : NULL;
|
||||||
|
char *sndName = argc > 2 ? argv[2] : NULL;
|
||||||
|
|
||||||
|
Game::init(lvlName, sndName);
|
||||||
|
|
||||||
SetWindowLong(hWnd, GWL_WNDPROC, (LONG)&WndProc);
|
SetWindowLong(hWnd, GWL_WNDPROC, (LONG)&WndProc);
|
||||||
ShowWindow(hWnd, SW_SHOWDEFAULT);
|
ShowWindow(hWnd, SW_SHOWDEFAULT);
|
||||||
|
Reference in New Issue
Block a user