shithub: duke3d

Download patch

ref: bff9e7cab76d907ea4666c76a61bb9f547f11b1e
parent: 90f44c4e23edd65d0e455541fa1c9b18d60d69dd
author: unknown <fabien@fabien-PC.(none)>
date: Thu Dec 20 12:28:42 EST 2012

Fixed windows build.

--- a/Engine/Engine.vcxproj
+++ b/Engine/Engine.vcxproj
@@ -95,13 +95,14 @@
     </Lib>
   </ItemDefinitionGroup>
   <ItemGroup>
-    <ClCompile Include="src\a.c" />
-    <ClCompile Include="src\cache1d.c" />
+    <ClCompile Include="src\cache.c" />
+    <ClCompile Include="src\display.c" />
+    <ClCompile Include="src\draw.c" />
     <ClCompile Include="src\Engine.c" />
+    <ClCompile Include="src\filesystem.c" />
     <ClCompile Include="src\mmulti.c" />
     <ClCompile Include="src\mmulti_stable.cpp" />
     <ClCompile Include="src\pragmas.c" />
-    <ClCompile Include="src\sdl_driver.c" />
     <ClCompile Include="src\enet\host.c" />
     <ClCompile Include="src\enet\list.c" />
     <ClCompile Include="src\enet\memory.c" />
@@ -112,12 +113,12 @@
     <ClCompile Include="src\enet\win32.c" />
   </ItemGroup>
   <ItemGroup>
-    <ClInclude Include="src\a.h" />
     <ClInclude Include="src\build.h" />
-    <ClInclude Include="src\cache1d.h" />
+    <ClInclude Include="src\cache.h" />
     <ClInclude Include="src\display.h" />
+    <ClInclude Include="src\draw.h" />
     <ClInclude Include="src\Engine.h" />
-    <ClInclude Include="src\engine_protos.h" />
+    <ClInclude Include="src\filesystem.h" />
     <ClInclude Include="src\icon.h" />
     <ClInclude Include="src\platform.h" />
     <ClInclude Include="src\pragmas.h" />
--- a/Engine/Engine.vcxproj.filters
+++ b/Engine/Engine.vcxproj.filters
@@ -14,12 +14,6 @@
     </Filter>
   </ItemGroup>
   <ItemGroup>
-    <ClCompile Include="src\a.c">
-      <Filter>Source Files</Filter>
-    </ClCompile>
-    <ClCompile Include="src\cache1d.c">
-      <Filter>Source Files</Filter>
-    </ClCompile>
     <ClCompile Include="src\Engine.c">
       <Filter>Source Files</Filter>
     </ClCompile>
@@ -32,9 +26,6 @@
     <ClCompile Include="src\pragmas.c">
       <Filter>Source Files</Filter>
     </ClCompile>
-    <ClCompile Include="src\sdl_driver.c">
-      <Filter>Source Files</Filter>
-    </ClCompile>
     <ClCompile Include="src\enet\host.c">
       <Filter>enet</Filter>
     </ClCompile>
@@ -59,17 +50,23 @@
     <ClCompile Include="src\enet\win32.c">
       <Filter>enet</Filter>
     </ClCompile>
+    <ClCompile Include="src\cache.c">
+      <Filter>Source Files</Filter>
+    </ClCompile>
+    <ClCompile Include="src\display.c">
+      <Filter>Source Files</Filter>
+    </ClCompile>
+    <ClCompile Include="src\draw.c">
+      <Filter>Source Files</Filter>
+    </ClCompile>
+    <ClCompile Include="src\filesystem.c">
+      <Filter>Source Files</Filter>
+    </ClCompile>
   </ItemGroup>
   <ItemGroup>
-    <ClInclude Include="src\a.h">
-      <Filter>Header Files</Filter>
-    </ClInclude>
     <ClInclude Include="src\build.h">
       <Filter>Header Files</Filter>
     </ClInclude>
-    <ClInclude Include="src\cache1d.h">
-      <Filter>Header Files</Filter>
-    </ClInclude>
     <ClInclude Include="src\display.h">
       <Filter>Header Files</Filter>
     </ClInclude>
@@ -76,9 +73,6 @@
     <ClInclude Include="src\Engine.h">
       <Filter>Header Files</Filter>
     </ClInclude>
-    <ClInclude Include="src\engine_protos.h">
-      <Filter>Header Files</Filter>
-    </ClInclude>
     <ClInclude Include="src\icon.h">
       <Filter>Header Files</Filter>
     </ClInclude>
@@ -89,6 +83,15 @@
       <Filter>Header Files</Filter>
     </ClInclude>
     <ClInclude Include="src\win32_compat.h">
+      <Filter>Header Files</Filter>
+    </ClInclude>
+    <ClInclude Include="src\cache.h">
+      <Filter>Header Files</Filter>
+    </ClInclude>
+    <ClInclude Include="src\draw.h">
+      <Filter>Header Files</Filter>
+    </ClInclude>
+    <ClInclude Include="src\filesystem.h">
       <Filter>Header Files</Filter>
     </ClInclude>
   </ItemGroup>
--- a/Engine/src/display.c
+++ b/Engine/src/display.c
@@ -308,9 +308,6 @@
 #define UNLOCK_SURFACE_AND_RETURN  if (SDL_MUSTLOCK(surface)) SDL_UnlockSurface(surface); return;
 
 
-int _argc = 0;
-char  **_argv = NULL;
-
     /* !!! move these elsewhere? */
 int32_t xres, yres, bytesperline, imageSize, maxpages;
 uint8_t* frameplace;
@@ -1075,9 +1072,6 @@
     int i;
 	int64_t timeElapsed;
 	char  dummyString[4096];
-
-    _argc = argc;
-    _argv = argv;
 
 	// FIX_00061: "ERROR: Two players have the same random ID" too frequent cuz of internet windows times
     TIMER_GetPlatformTicks(&timeElapsed);
--- a/Engine/src/draw.c
+++ b/Engine/src/draw.c
@@ -53,9 +53,8 @@
 
 //FCS:   Draw ceiling/floors
 //Draw a line from destination in the framebuffer to framebuffer-numPixels
-void hlineasm4(int32_t numPixels, int32_t shade, uint32_t i4, uint32_t i5, int32_t destination){
+void hlineasm4(int32_t numPixels, int32_t shade, uint32_t i4, uint32_t i5, uint8_t *dest){
 
-    uint8_t *dest = (uint8_t *) destination;
     int32_t shifter = ((256-machxbits_al) & 0x1f);
     uint32_t source;
     uint8_t  bits = machxbits_bl;
--- a/Engine/src/draw.h
+++ b/Engine/src/draw.h
@@ -32,7 +32,7 @@
 void sethlinesizes(int32_t,int32_t,uint8_t *);
 
 
-void hlineasm4(int32_t,int32_t,uint32_t,uint32_t,int32_t);
+void hlineasm4(int32_t,int32_t,uint32_t,uint32_t,uint8_t*);
 void setuprhlineasm4(int32_t,int32_t,int32_t,int32_t,int32_t,int32_t);
 void rhlineasm4(int32_t,uint8_t*,int32_t,uint32_t,uint32_t,int32_t);
 void setuprmhlineasm4(int32_t,int32_t,int32_t,int32_t,int32_t,int32_t);
--- a/Engine/src/filesystem.c
+++ b/Engine/src/filesystem.c
@@ -11,7 +11,7 @@
 #include "platform.h"
 #include "cache.h"
 #include "pragmas.h"
-#include "global.h"
+#include "../../Game/src/global.h"
 
 char game_dir[512];
 
@@ -651,7 +651,7 @@
     if (gameDir == NULL)
         return;
     
-    stpncpy(game_dir,gameDir,sizeof(game_dir));
+    strncpy(game_dir,gameDir,sizeof(game_dir));
 }
 
 char*  getGameDir(void){
--- a/Engine/src/mmulti.c
+++ b/Engine/src/mmulti.c
@@ -636,7 +636,7 @@
 #define SOCKET_SHUTDOWN_BOTH 2
 
 #include <signal.h>
-#include "cache1d.h"  /* kopen4load for cfg file. */
+#include "filesystem.h"  /* kopen4load for cfg file. */
 #include "display.h"  /* getticks */
 
 #define IPSEG1(ip) ((((unsigned int) ip) & 0xFF000000) >> 24)
--- a/Engine/src/mmulti_stable.cpp
+++ b/Engine/src/mmulti_stable.cpp
@@ -19,6 +19,7 @@
 #include "pragmas.h"
 #include "signal.h"
 #include "mmulti_stable.h"
+#include "filesystem.h"
 
 #define MAXPLAYERS 16
 #define BAKSIZ 16384
@@ -974,7 +975,7 @@
 //* Network Config File Functions
 //**************************************************************
 
-#include "cache1d.h"  /* kopen4load for cfg file. */
+#include "filesystem.h"  /* kopen4load for cfg file. */
 #include "display.h"  /* getticks */
 
 #define IPSEG1(ip) ((((unsigned int) ip) & 0xFF000000) >> 24)
--- a/Engine/src/win32_compat.h
+++ b/Engine/src/win32_compat.h
@@ -29,7 +29,10 @@
 #include <stdio.h>
 
 #if (!defined _MSC_VER)
-#include <unistd.h>
+	#include <unistd.h>
+#else
+	#include <fcntl.h>
+    #include <SYS\STAT.H>
 #endif
 
 #include <stdlib.h>
@@ -38,6 +41,7 @@
 #include <conio.h>
 #include <dos.h>
 #include <assert.h>
+#include <string.h>
 
 #define kmalloc(x) malloc(x)
 #define kkmalloc(x) malloc(x)
--- a/Game/src/game.c
+++ b/Game/src/game.c
@@ -7960,9 +7960,9 @@
 	char  groupfile[9][512];
 	int grpID ;
 
-	if(game_dir[0] != '\0')
+	if(getGameDir()[0] != '\0')
 	{
-		sprintf(groupfilefullpath, "%s\\%s", game_dir, baseDir);
+		sprintf(groupfilefullpath, "%s\\%s", getGameDir(), baseDir);
 		hFind = FindFirstFile(groupfilefullpath, &FindFileData);
 		if (hFind == INVALID_HANDLE_VALUE)
 		{
@@ -8001,10 +8001,10 @@
 	}
 	
 	FindClose(hFind);
-	if (strlen(game_dir) == 0)
+	if (strlen(getGameDir()) == 0)
 		 sprintf(groupfilefullpath, "./%s", groupfile[grpID]);
 	else
-	   sprintf(groupfilefullpath, "%s//%s", game_dir, groupfile[grpID]);
+	   sprintf(groupfilefullpath, "%s//%s", getGameDir(), groupfile[grpID]);
 }
 
 #else