mirror of
https://github.com/XProger/OpenLara.git
synced 2025-01-17 21:09:00 +01:00
#15 Windows reading level and soundtrack name from command line
This commit is contained in:
parent
d52b478e31
commit
c7f1226295
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 {
|
||||
Level *level;
|
||||
|
||||
void startLevel(Stream &stream, bool demo, bool home) {
|
||||
void startLevel(Stream &stream, const char *sndName, bool demo, bool home) {
|
||||
delete level;
|
||||
level = new Level(stream, demo, home);
|
||||
|
||||
#ifndef __EMSCRIPTEN__
|
||||
//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);
|
||||
#endif
|
||||
}
|
||||
|
||||
void startLevel(const char *name, bool demo, bool home) {
|
||||
Stream stream(name);
|
||||
startLevel(stream, demo, home);
|
||||
void startLevel(const char *lvlName, const char *sndName, bool demo, bool home) {
|
||||
Stream stream(lvlName);
|
||||
startLevel(stream, sndName, demo, home);
|
||||
}
|
||||
|
||||
void init() {
|
||||
void init(char *lvlName = NULL, char *sndName = NULL) {
|
||||
Core::init();
|
||||
level = NULL;
|
||||
|
||||
if (!lvlName) lvlName = "LEVEL2.PSX";
|
||||
if (!sndName) sndName = "05.ogg";
|
||||
//lstartLevel("LEVEL2_DEMO.PHD", true, false);
|
||||
//lstartLevel("GYM.PSX", false, true);
|
||||
//lstartLevel("LEVEL3A.PHD", false, false);
|
||||
startLevel("CUT1.PHD", false, false);
|
||||
startLevel(lvlName, sndName, false, false);
|
||||
}
|
||||
|
||||
void free() {
|
||||
|
@ -141,8 +141,8 @@
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
<GenerateDebugInformation>false</GenerateDebugInformation>
|
||||
<SubSystem>Console</SubSystem>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<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>
|
||||
|
@ -272,15 +272,16 @@ void freeGL(HGLRC hRC) {
|
||||
}
|
||||
|
||||
#ifdef _DEBUG
|
||||
int main() {
|
||||
int main(int argc, char** argv) {
|
||||
_CrtMemState _ms;
|
||||
_CrtMemCheckpoint(&_ms);
|
||||
_CrtSetReportMode(_CRT_WARN, _CRTDBG_MODE_FILE);
|
||||
_CrtSetReportFile(_CRT_WARN, _CRTDBG_FILE_STDOUT);
|
||||
#elif PROFILE
|
||||
int main() {
|
||||
//#elif PROFILE
|
||||
#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
|
||||
RECT r = { 0, 0, 1280, 720 };
|
||||
AdjustWindowRect(&r, WS_OVERLAPPEDWINDOW, false);
|
||||
@ -292,7 +293,11 @@ int CALLBACK WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLi
|
||||
|
||||
joyInit();
|
||||
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);
|
||||
ShowWindow(hWnd, SW_SHOWDEFAULT);
|
||||
|
Loading…
x
Reference in New Issue
Block a user