summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 4e2a6e5)
raw | patch | inline | side by side (parent: 4e2a6e5)
author | Ketmar Dark <ketmar@ketmar.no-ip.org> | |
Sun, 20 Oct 2019 22:07:27 +0000 (01:07 +0300) | ||
committer | Ketmar Dark <ketmar@ketmar.no-ip.org> | |
Sun, 20 Oct 2019 22:07:57 +0000 (01:07 +0300) |
src/game/g_game.pas | patch | blob | history |
diff --git a/src/game/g_game.pas b/src/game/g_game.pas
index 80f53ccc05e25ea145ac322c15bdc4898ff3d935..e371e0b3efe1bb221b8f7750ac35db1f637ca82d 100644 (file)
--- a/src/game/g_game.pas
+++ b/src/game/g_game.pas
procedure g_Game_Restart();
procedure g_Game_RestartLevel();
procedure g_Game_RestartRound(NoMapRestart: Boolean = False);
-procedure g_Game_ClientWAD(NewWAD: String; const WHash: TMD5Digest);
+function g_Game_ClientWAD (NewWAD: String; const WHash: TMD5Digest): AnsiString;
procedure g_Game_SaveOptions();
function g_Game_StartMap(Map: String; Force: Boolean = False; const oldMapPath: AnsiString=''): Boolean;
procedure g_Game_ChangeMap(const MapPath: String);
e_LogWritefln('using downloaded map wad [%s] for [%s]`', [newResPath, WadName], TMsgType.Notify);
end;
//newResPath := ExtractRelativePath(MapsDir, newResPath);
-
+
gPlayer1 := g_Player_Get(g_Player_Create(gPlayer1Settings.Model,
gPlayer1Settings.Color,
ResName := g_ExtractFileName(Map);
if g_Game_IsServer then
begin
-// nws := e_FindWad(MapDirs, NewWAD);
- nws := NewWAD;
+ nws := findDiskWad(NewWAD);
+ //writeln('000: Map=[', Map, ']; nws=[', nws, ']; NewWAD=[', NewWAD, ']');
+ if (length(nws) = 0) then nws := e_FindWad(MapDirs, NewWAD);
+ //writeln('001: Map=[', Map, ']; nws=[', nws, ']; NewWAD=[', NewWAD, ']');
+ //nws := NewWAD;
if (length(nws) = 0) then
begin
- ResName := '';
+ ResName := ''; // failed
end
else
begin
+ NewWAD := nws;
if (g_Game_IsNet) then gWADHash := MD5File(nws);
//writeln('********: nws=', nws, ' : Map=', Map, ' : nw=', NewWAD, ' : resname=', ResName);
g_Game_LoadWAD(NewWAD);
end;
- end else
+ end
+ else
+ begin
// hash received in MC_RECV_GameEvent -> NET_EV_MAPSTART
- g_Game_ClientWAD(NewWAD, gWADHash);
- end else
+ NewWAD := g_Game_ClientWAD(NewWAD, gWADHash);
+ end;
+ end
+ else
+ begin
+ NewWAD := gGameSettings.WAD;
ResName := Map;
+ end;
//writeln('********: gsw=', gGameSettings.WAD, '; rn=', ResName);
result := false;
- if ResName <> '' then
- result := g_Map_Load(gGameSettings.WAD + ':\' + ResName);
+ if (ResName <> '') and (NewWAD <> '') then
+ begin
+ //result := g_Map_Load(gGameSettings.WAD + ':\' + ResName);
+ result := g_Map_Load(NewWAD+':\'+ResName);
+ end;
if Result then
begin
g_Player_ResetAll(Force or gLastMap, gGameSettings.GameType = GT_SINGLE);
gNextMap := Map;
end;
-procedure g_Game_ClientWAD(NewWAD: String; const WHash: TMD5Digest);
+function g_Game_ClientWAD (NewWAD: String; const WHash: TMD5Digest): AnsiString;
var
gWAD{, xwad}: String;
begin
+ result := NewWAD;
if not g_Game_IsClient then Exit;
//e_LogWritefln('*** g_Game_ClientWAD: `%s`', [NewWAD]);
gWAD := g_Res_DownloadMapWAD(ExtractFileName(NewWAD), WHash);
if gWAD = '' then
begin
+ result := '';
g_Game_Free();
g_FatalError(Format(_lc[I_GAME_ERROR_MAP_WAD], [ExtractFileName(NewWAD)]));
Exit;
e_LogWritefln('using downloaded client map wad [%s]`', [NewWAD], TMsgType.Notify);
g_Game_LoadWAD(NewWAD);
+ result := NewWAD;
{
if LowerCase(NewWAD) = LowerCase(gGameSettings.WAD) then Exit;