Update MSVC project to compile with lua
minor changes to remove need for C features unsupported by MS Visual C
This commit is contained in:
		
							parent
							
								
									c29a52a4b2
								
							
						
					
					
						commit
						db39392411
					
				@ -1,3 +1,22 @@
 | 
				
			|||||||
Project files for MS Visual Studio 2010
 | 
					Project files for MS Visual Studio 2010 :
 | 
				
			||||||
Edit project properties to set proper include and libraries directory for SDL 1.2
 | 
					
 | 
				
			||||||
and SDL image 1.2
 | 
					By default the project expect SDL 1.2 SDL Image 1.2 and Lua 5.3 to be installed
 | 
				
			||||||
 | 
					in directories :
 | 
				
			||||||
 | 
					  ..\..\..\..\SDL-1.2.15
 | 
				
			||||||
 | 
					  ..\..\..\..\SDL_image-1.2.12
 | 
				
			||||||
 | 
					  ..\..\..\..\lua
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					That is, if grafX2 sources are in C:\stuff\code\grafX2
 | 
				
			||||||
 | 
					Visual studio project files are in C:\stuff\code\grafX2\project\msvc
 | 
				
			||||||
 | 
					and it is expected you have C:\stuff\lua etc.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					Download precompiled libraries from :
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  https://www.libsdl.org/download-1.2.php :
 | 
				
			||||||
 | 
					    https://www.libsdl.org/release/SDL-devel-1.2.15-VC.zip
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  https://www.libsdl.org/projects/SDL_image/release-1.2.html
 | 
				
			||||||
 | 
					    https://www.libsdl.org/projects/SDL_image/release/SDL_image-devel-1.2.12-VC.zip
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  http://luabinaries.sourceforge.net/
 | 
				
			||||||
 | 
					    https://sourceforge.net/projects/luabinaries/files/5.3.4/Windows%20Libraries/Static/
 | 
				
			||||||
 | 
				
			|||||||
@ -52,15 +52,15 @@
 | 
				
			|||||||
      </PrecompiledHeader>
 | 
					      </PrecompiledHeader>
 | 
				
			||||||
      <WarningLevel>Level3</WarningLevel>
 | 
					      <WarningLevel>Level3</WarningLevel>
 | 
				
			||||||
      <Optimization>Disabled</Optimization>
 | 
					      <Optimization>Disabled</Optimization>
 | 
				
			||||||
      <PreprocessorDefinitions>NOTTF;__no_pnglib__;_CRT_SECURE_NO_WARNINGS;_USE_MATH_DEFINES;WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
 | 
					      <PreprocessorDefinitions>NOTTF;__ENABLE_LUA__;__no_pnglib__;_CRT_SECURE_NO_WARNINGS;_USE_MATH_DEFINES;WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
 | 
				
			||||||
      <AdditionalIncludeDirectories>..\..\..\..\SDL_image-1.2.12\include;..\..\..\..\SDL-1.2.15\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
 | 
					      <AdditionalIncludeDirectories>..\..\..\..\SDL_image-1.2.12\include;..\..\..\..\SDL-1.2.15\include;..\..\..\..\lua\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
 | 
				
			||||||
      <DisableSpecificWarnings>4244;%(DisableSpecificWarnings)</DisableSpecificWarnings>
 | 
					      <DisableSpecificWarnings>4244;%(DisableSpecificWarnings)</DisableSpecificWarnings>
 | 
				
			||||||
    </ClCompile>
 | 
					    </ClCompile>
 | 
				
			||||||
    <Link>
 | 
					    <Link>
 | 
				
			||||||
      <SubSystem>Windows</SubSystem>
 | 
					      <SubSystem>Windows</SubSystem>
 | 
				
			||||||
      <GenerateDebugInformation>true</GenerateDebugInformation>
 | 
					      <GenerateDebugInformation>true</GenerateDebugInformation>
 | 
				
			||||||
      <AdditionalDependencies>SDL.lib;SDLmain.lib;SDL_image.lib;%(AdditionalDependencies)</AdditionalDependencies>
 | 
					      <AdditionalDependencies>SDL.lib;SDLmain.lib;SDL_image.lib;lua53.lib;%(AdditionalDependencies)</AdditionalDependencies>
 | 
				
			||||||
      <AdditionalLibraryDirectories>..\..\..\..\SDL-1.2.15\lib\x86;..\..\..\..\SDL_image-1.2.12\lib\x86;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
 | 
					      <AdditionalLibraryDirectories>..\..\..\..\SDL-1.2.15\lib\x86;..\..\..\..\SDL_image-1.2.12\lib\x86;..\..\..\..\lua;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
 | 
				
			||||||
    </Link>
 | 
					    </Link>
 | 
				
			||||||
  </ItemDefinitionGroup>
 | 
					  </ItemDefinitionGroup>
 | 
				
			||||||
  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
 | 
					  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
 | 
				
			||||||
@ -71,8 +71,8 @@
 | 
				
			|||||||
      <Optimization>MaxSpeed</Optimization>
 | 
					      <Optimization>MaxSpeed</Optimization>
 | 
				
			||||||
      <FunctionLevelLinking>true</FunctionLevelLinking>
 | 
					      <FunctionLevelLinking>true</FunctionLevelLinking>
 | 
				
			||||||
      <IntrinsicFunctions>true</IntrinsicFunctions>
 | 
					      <IntrinsicFunctions>true</IntrinsicFunctions>
 | 
				
			||||||
      <PreprocessorDefinitions>NOTTF;__no_pnglib__;_CRT_SECURE_NO_WARNINGS;_USE_MATH_DEFINES;WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
 | 
					      <PreprocessorDefinitions>NOTTF;__ENABLE_LUA__;__no_pnglib__;_CRT_SECURE_NO_WARNINGS;_USE_MATH_DEFINES;WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
 | 
				
			||||||
      <AdditionalIncludeDirectories>..\..\..\..\SDL_image-1.2.12\include;..\..\..\..\SDL-1.2.15\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
 | 
					      <AdditionalIncludeDirectories>..\..\..\..\SDL_image-1.2.12\include;..\..\..\..\SDL-1.2.15\include;..\..\..\..\lua\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
 | 
				
			||||||
      <DisableSpecificWarnings>4244;%(DisableSpecificWarnings)</DisableSpecificWarnings>
 | 
					      <DisableSpecificWarnings>4244;%(DisableSpecificWarnings)</DisableSpecificWarnings>
 | 
				
			||||||
    </ClCompile>
 | 
					    </ClCompile>
 | 
				
			||||||
    <Link>
 | 
					    <Link>
 | 
				
			||||||
@ -80,8 +80,8 @@
 | 
				
			|||||||
      <GenerateDebugInformation>true</GenerateDebugInformation>
 | 
					      <GenerateDebugInformation>true</GenerateDebugInformation>
 | 
				
			||||||
      <EnableCOMDATFolding>true</EnableCOMDATFolding>
 | 
					      <EnableCOMDATFolding>true</EnableCOMDATFolding>
 | 
				
			||||||
      <OptimizeReferences>true</OptimizeReferences>
 | 
					      <OptimizeReferences>true</OptimizeReferences>
 | 
				
			||||||
      <AdditionalDependencies>SDL.lib;SDLmain.lib;SDL_image.lib;%(AdditionalDependencies)</AdditionalDependencies>
 | 
					      <AdditionalDependencies>SDL.lib;SDLmain.lib;SDL_image.lib;lua53.lib;%(AdditionalDependencies)</AdditionalDependencies>
 | 
				
			||||||
      <AdditionalLibraryDirectories>..\..\..\..\SDL-1.2.15\lib\x86;..\..\..\..\SDL_image-1.2.12\lib\x86;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
 | 
					      <AdditionalLibraryDirectories>..\..\..\..\SDL-1.2.15\lib\x86;..\..\..\..\SDL_image-1.2.12\lib\x86;..\..\..\..\lua;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
 | 
				
			||||||
    </Link>
 | 
					    </Link>
 | 
				
			||||||
  </ItemDefinitionGroup>
 | 
					  </ItemDefinitionGroup>
 | 
				
			||||||
  <ItemGroup>
 | 
					  <ItemGroup>
 | 
				
			||||||
 | 
				
			|||||||
@ -59,6 +59,10 @@ char * Bound_script[10];
 | 
				
			|||||||
#include <float.h> // for DBL_MAX
 | 
					#include <float.h> // for DBL_MAX
 | 
				
			||||||
#include <limits.h> //for INT_MIN
 | 
					#include <limits.h> //for INT_MIN
 | 
				
			||||||
#include <string.h> // strncpy()
 | 
					#include <string.h> // strncpy()
 | 
				
			||||||
 | 
					#if defined(_MSC_VER)
 | 
				
			||||||
 | 
					#define strdup _strdup
 | 
				
			||||||
 | 
					#define putenv _putenv
 | 
				
			||||||
 | 
					#endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
///
 | 
					///
 | 
				
			||||||
/// Number of characters for name in fileselector.
 | 
					/// Number of characters for name in fileselector.
 | 
				
			||||||
@ -84,7 +88,7 @@ static byte Cursor_is_visible;
 | 
				
			|||||||
static byte Window_needs_update;
 | 
					static byte Window_needs_update;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/// Helper function to clamp a double to 0-255 range
 | 
					/// Helper function to clamp a double to 0-255 range
 | 
				
			||||||
static inline byte clamp_byte(double value)
 | 
					static byte clamp_byte(double value)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
  if (value<0.0)
 | 
					  if (value<0.0)
 | 
				
			||||||
    return 0;
 | 
					    return 0;
 | 
				
			||||||
@ -981,8 +985,8 @@ int L_SetBackColor(lua_State* L)
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
int L_InputBox(lua_State* L)
 | 
					int L_InputBox(lua_State* L)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
  const int max_settings = 9;
 | 
					#define max_settings (9)
 | 
				
			||||||
  const int args_per_setting = 5;
 | 
					#define args_per_setting (5)
 | 
				
			||||||
  double min_value[max_settings];
 | 
					  double min_value[max_settings];
 | 
				
			||||||
  double max_value[max_settings];
 | 
					  double max_value[max_settings];
 | 
				
			||||||
  double decimal_places[max_settings];
 | 
					  double decimal_places[max_settings];
 | 
				
			||||||
@ -1258,12 +1262,15 @@ int L_InputBox(lua_State* L)
 | 
				
			|||||||
    lua_pushnumber(L, current_value[setting]);
 | 
					    lua_pushnumber(L, current_value[setting]);
 | 
				
			||||||
    
 | 
					    
 | 
				
			||||||
  return 1 + nb_settings;
 | 
					  return 1 + nb_settings;
 | 
				
			||||||
 | 
					#undef max_settings
 | 
				
			||||||
 | 
					#undef args_per_setting
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
int L_SelectBox(lua_State* L)
 | 
					int L_SelectBox(lua_State* L)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
  const int max_settings = 10;
 | 
					#define max_settings (10)
 | 
				
			||||||
  const char * label[max_settings];
 | 
					  const char * label[max_settings];
 | 
				
			||||||
 | 
					#undef max_settings
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  const char * window_caption;
 | 
					  const char * window_caption;
 | 
				
			||||||
  unsigned int caption_length;
 | 
					  unsigned int caption_length;
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user