X-Git-Url: http://deadsoftware.ru/gitweb?a=blobdiff_plain;f=src%2Fgame%2Fg_main.pas;h=da95b14b6b47bde14d9773a97ac58f638fec6489;hb=db4e988645273fe1c11611d84e03f0199cd181f7;hp=48f0bb5648c73f18825364e46b4e8b93c99bf4bf;hpb=844441154d1220d6c83f75043300c2851ec87109;p=d2df-sdl.git diff --git a/src/game/g_main.pas b/src/game/g_main.pas index 48f0bb5..da95b14 100644 --- a/src/game/g_main.pas +++ b/src/game/g_main.pas @@ -1,3 +1,19 @@ +(* Copyright (C) DooM 2D:Forever Developers + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + *) +{$INCLUDE ../shared/a_modes.inc} unit g_main; interface @@ -24,7 +40,8 @@ uses e_graphics, e_input, g_game, g_console, g_gui, e_sound, g_options, g_sound, g_player, g_weapons, SysUtils, g_triggers, MAPDEF, g_map, - MAPSTRUCT, g_menu, g_language, g_net, utils; + g_menu, g_language, g_net, + utils, conbuf, envvars; var charbuff: Array [0..15] of Char; @@ -33,6 +50,8 @@ procedure Main(); var sdlflags: LongWord; begin + e_InitWritelnDriver(); + GetDir(0, GameDir); MapsDir := GameDir + '/maps/'; DataDir := GameDir + '/data/'; @@ -43,8 +62,11 @@ begin e_WriteLog('Read config file', MSG_NOTIFY); g_Options_Read(GameDir + '/' + CONFIG_FILENAME); - - e_WriteToStdOut := {$IFDEF HEADLESS}True;{$ELSE}False;{$ENDIF} + +{$IFDEF HEADLESS} + conbufDumpToStdOut := true; +{$ENDIF} + e_WriteToStdOut := False; //{$IFDEF HEADLESS}True;{$ELSE}False;{$ENDIF} //GetSystemDefaultLCID() @@ -52,9 +74,15 @@ begin //g_Language_Load(DataDir + gLanguage + '.txt'); e_WriteLog(gLanguage, MSG_NOTIFY); g_Language_Set(gLanguage); - + {$IFDEF HEADLESS} + {$IFDEF USE_SDLMIXER} + sdlflags := SDL_INIT_TIMER or SDL_INIT_AUDIO or $00004000; + // HACK: shit this into env and hope for the best + SetEnvVar('SDL_AUDIODRIVER', 'dummy'); + {$ELSE} sdlflags := SDL_INIT_TIMER or $00004000; + {$ENDIF} {$ELSE} {$IFDEF USE_SDLMIXER} sdlflags := SDL_INIT_EVERYTHING; @@ -64,7 +92,7 @@ begin {$ENDIF} if SDL_Init(sdlflags) < 0 then raise Exception.Create('SDL: Init failed: ' + SDL_GetError()); - + {$IFDEF HEADLESS} SDL_StartTextInput(); {$ENDIF} @@ -86,9 +114,20 @@ end; procedure Init(); var a: Integer; + NoSound: Boolean; begin Randomize; +{$IFDEF HEADLESS} + {$IFDEF USE_SDLMIXER} + NoSound := False; // hope env has set SDL_AUDIODRIVER to dummy + {$ELSE} + NoSound := True; // FMOD backend will sort it out + {$ENDIF} +{$ELSE} + NoSound := False; +{$ENDIF} + e_WriteLog('Init Input', MSG_NOTIFY); e_InitInput(); @@ -100,7 +139,7 @@ begin if (not gNoSound) then begin e_WriteLog('Initializing sound system', MSG_NOTIFY); - e_InitSoundSystem({$IFDEF HEADLESS}True{$ELSE}False{$ENDIF}); + e_InitSoundSystem(NoSound); end; e_WriteLog('Init game', MSG_NOTIFY); @@ -263,7 +302,8 @@ begin if gTriggers[a].TriggerType = TRIGGER_EXIT then begin gExitByTrigger := True; - g_Game_ExitLevel(gTriggers[a].Data.MapName); + //g_Game_ExitLevel(gTriggers[a].Data.MapName); + g_Game_ExitLevel(gTriggers[a].tgcMap); Break; end; goto Cheated;