DEADSOFTWARE

also, .pk3 seems to work now
[d2df-sdl.git] / src / game / g_game.pas
index 265533e11fa49a7f094e3438865f55deb36975ee..9cca04c27ce31af3f73ea6daa86c801c7a33e004 100644 (file)
@@ -1045,6 +1045,13 @@ begin
     until FindNext(SR) <> 0;
   FindClose(SR);
 
+  if FindFirst(ModelsDir+'*.pk3', faAnyFile, SR) = 0 then
+    repeat
+      if not g_PlayerModel_Load(ModelsDir+SR.Name) then
+        e_WriteLog(Format('Error loading model %s', [SR.Name]), MSG_WARNING);
+    until FindNext(SR) <> 0;
+  FindClose(SR);
+
   gGameOn := False;
   gPause := False;
   gTime := 0;
@@ -1058,7 +1065,7 @@ begin
   g_Game_SetLoadingText(_lc[I_LOAD_MUSIC], 0, False);
   g_Sound_CreateWADEx('MUSIC_INTERMUS', GameWAD+':MUSIC\INTERMUS', True);
   g_Sound_CreateWADEx('MUSIC_MENU', GameWAD+':MUSIC\MENU', True);
-  g_Sound_CreateWADEx('MUSIC_ROUNDMUS', GameWAD+':MUSIC\ROUNDMUS');
+  g_Sound_CreateWADEx('MUSIC_ROUNDMUS', GameWAD+':MUSIC\ROUNDMUS', True);
   g_Sound_CreateWADEx('MUSIC_STDENDMUS', GameWAD+':MUSIC\ENDMUS', True);
 
   g_Game_SetLoadingText(_lc[I_LOAD_MENUS], 0, False);
@@ -4045,11 +4052,14 @@ end;
 
 procedure g_Game_DeleteTestMap();
 var
-  WAD: TWADEditor_1;
+  a: Integer;
   MapName: Char16;
-  MapList: SArray;
-  a, time: Integer;
   WadName: string;
+{
+  WAD: TWADEditor_1;
+  MapList: SArray;
+  time: Integer;
+}
 begin
   a := Pos('.wad:\', gMapToDelete);
   if a = 0 then
@@ -4062,6 +4072,7 @@ begin
   MapName := '';
   CopyMemory(@MapName[0], @gMapToDelete[1], Min(16, Length(gMapToDelete)));
 
+{
 // Èìÿ êàðòû íå ñòàíäàðòíîå òåñòîâîå:
   if MapName <> TEST_MAP_NAME then
     Exit;
@@ -4095,7 +4106,8 @@ begin
     WAD.Free();
     g_SetFileTime(WadName, time);
   end else
-    DeleteFile(WadName);
+}
+  if gTempDelete then DeleteFile(WadName);
 end;
 
 procedure GameCVars(P: SArray);
@@ -5168,7 +5180,7 @@ begin
       Exit;
     end;
     // Èãðà åù¸ íå çàïóùåíà, ñíà÷àëà íàì íàäî çàãðóçèòü êàêîé-òî WAD
-    if Pos('.wad', LowerCase(P[1])) = 0 then
+    if (Pos('.wad', LowerCase(P[1])) = 0) and (Pos('.pk3', LowerCase(P[1])) = 0) then
       P[1] := P[1] + '.wad';
 
     if FileExists(MapsDir + P[1]) then
@@ -5224,7 +5236,7 @@ begin
       Exit;
     prt := StrToIntDef(P[2], 25666);
 
-    if Pos('.wad', LowerCase(P[3])) = 0 then
+    if (Pos('.wad', LowerCase(P[3])) = 0) and (Pos('.pk3', LowerCase(P[3])) = 0) then
       P[3] := P[3] + '.wad';
 
     if FileExists(MapsDir + P[3]) then
@@ -5296,7 +5308,7 @@ begin
           begin
             g_Console_Add(Format(_lc[I_MSG_NO_MAP], [s]));
             // Òàêîé êàðòû íåò, èùåì WAD ôàéë
-            if Pos('.wad', LowerCase(P[1])) = 0 then
+            if (Pos('.wad', LowerCase(P[1])) = 0) and (Pos('.pk3', LowerCase(P[1])) = 0) then
               P[1] := P[1] + '.wad';
 
             if FileExists(MapsDir + P[1]) then
@@ -5328,7 +5340,7 @@ begin
         end else
         begin
           // Óêàçàíî äâà ïàðàìåòðà, çíà÷èò ïåðâûé - WAD ôàéë, à âòîðîé - êàðòà
-          if Pos('.wad', LowerCase(P[1])) = 0 then
+          if (Pos('.wad', LowerCase(P[1])) = 0) and (Pos('.pk3', LowerCase(P[1])) = 0) then
             P[1] := P[1] + '.wad';
 
           if FileExists(MapsDir + P[1]) then
@@ -5389,7 +5401,7 @@ begin
             begin
               g_Console_Add(Format(_lc[I_MSG_NO_MAP], [s]));
               // Òàêîé êàðòû íåò, èùåì WAD ôàéë
-              if Pos('.wad', LowerCase(P[1])) = 0 then
+              if (Pos('.wad', LowerCase(P[1])) = 0) and (Pos('.pk3', LowerCase(P[1])) = 0) then
                 P[1] := P[1] + '.wad';
 
               if FileExists(MapsDir + P[1]) then
@@ -5416,7 +5428,7 @@ begin
           end else
           begin
             // Óêàçàíî äâà ïàðàìåòðà, çíà÷èò ïåðâûé - WAD ôàéë, à âòîðîé - êàðòà
-            if Pos('.wad', LowerCase(P[1])) = 0 then
+            if (Pos('.wad', LowerCase(P[1])) = 0) and (Pos('.pk3', LowerCase(P[1])) = 0) then
               P[1] := P[1] + '.wad';
 
             if FileExists(MapsDir + P[1]) then
@@ -6245,7 +6257,7 @@ begin
 
 // Start map when game loads:
   map := LowerCase(Find_Param_Value(pars, '-map'));
-  if (map <> '') and (Pos('.wad:\', map) > 0) then
+  if (map <> '') and ((Pos('.wad:\', map) > 0) or (Pos('.pk3:\', map) > 0)) then
   begin
   // Game mode:
     s := Find_Param_Value(pars, '-gm');
@@ -6291,7 +6303,11 @@ begin
   // Delete test map after play:
     s := Find_Param_Value(pars, '--testdelete');
     if (s <> '') then
+    begin
       gMapToDelete := MapsDir + map;
+      e_WriteLog('"--testdelete" argument doesn''t supported anymore!', MSG_FATALERROR);
+      Halt(1);
+    end;
 
   // Delete temporary WAD after play:
     s := Find_Param_Value(pars, '--tempdelete');