From 2c1676db4a90291722d229789cb06762d5ca40b2 Mon Sep 17 00:00:00 2001 From: Pawel Kolodziejski Date: Sun, 24 Aug 2003 17:56:03 +0000 Subject: [PATCH] added windows target, hash maps still not compilable for resource.cpp --- actor.cpp | 1 + bitmap.cpp | 1 + bits.h | 14 ++- costume.cpp | 1 + debug.cpp | 1 + engine.cpp | 1 + hash_map.h | 6 ++ keyframe.cpp | 1 + lab.cpp | 6 ++ lab.h | 1 - localize.cpp | 1 + lua.cpp | 7 +- lua.vcproj | 207 ++++++++++++++++++++++++++++++++++++++ main.cpp | 5 +- material.cpp | 1 + mixer.cpp | 1 + mixer.h | 1 + model.cpp | 1 + registry.cpp | 1 + residual.rc | 84 ++++++++++++++++ residual.sln | 27 +++++ residual.vcproj | 261 ++++++++++++++++++++++++++++++++++++++++++++++++ resource.cpp | 8 +- scene.cpp | 1 + sound.cpp | 1 + sound.h | 2 +- stdafx.h | 120 ++++++++++++++++++++++ textobject.cpp | 1 + textsplit.cpp | 1 + walkplane.cpp | 1 + 30 files changed, 756 insertions(+), 9 deletions(-) create mode 100644 lua.vcproj create mode 100644 residual.rc create mode 100644 residual.sln create mode 100644 residual.vcproj create mode 100644 stdafx.h diff --git a/actor.cpp b/actor.cpp index ffda085f693..f367485100b 100644 --- a/actor.cpp +++ b/actor.cpp @@ -15,6 +15,7 @@ // License along with this library; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +#include "stdafx.h" #include "actor.h" #include "engine.h" #include "costume.h" diff --git a/bitmap.cpp b/bitmap.cpp index 5913ce590f1..95ac1f2518b 100644 --- a/bitmap.cpp +++ b/bitmap.cpp @@ -15,6 +15,7 @@ // License along with this library; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +#include "stdafx.h" #include #include #include diff --git a/bits.h b/bits.h index ee337d03b41..008822841fa 100644 --- a/bits.h +++ b/bits.h @@ -19,9 +19,21 @@ #define BITS_H #include -#include +#include "stdafx.h" #include "vector3d.h" +#ifdef _MSC_VER + typedef unsigned char byte; + typedef unsigned char uint8_t; + typedef unsigned short uint16_t; + typedef signed short int16_t; + typedef unsigned long uint32_t; + typedef unsigned int uint_t; + typedef signed char int8_t; + typedef signed short int16_t; + typedef signed long int32_t; +#endif + inline uint8_t get_uint8(const char *data) { return *(reinterpret_cast(data)); } diff --git a/costume.cpp b/costume.cpp index 727a5eb170f..79a04b62c27 100644 --- a/costume.cpp +++ b/costume.cpp @@ -15,6 +15,7 @@ // License along with this library; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +#include "stdafx.h" #include "costume.h" #include "textsplit.h" #include "debug.h" diff --git a/debug.cpp b/debug.cpp index 39a4111e0dc..07f8b267fa8 100644 --- a/debug.cpp +++ b/debug.cpp @@ -15,6 +15,7 @@ // License along with this library; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +#include "stdafx.h" #include "debug.h" #include #include diff --git a/engine.cpp b/engine.cpp index ec7543c98d0..630e24c2a1e 100644 --- a/engine.cpp +++ b/engine.cpp @@ -15,6 +15,7 @@ // License along with this library; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +#include "stdafx.h" #include "engine.h" #include "scene.h" #include "lua.h" diff --git a/hash_map.h b/hash_map.h index 85be257f2f5..9fabb7c06dd 100644 --- a/hash_map.h +++ b/hash_map.h @@ -18,9 +18,14 @@ #ifndef HASH_MAP_HH #define HASH_MAP_HH +#ifdef _MSC_VER +#include +#else #include +#endif #include +#ifndef _MSC_VER namespace std { using namespace __gnu_cxx; }; @@ -32,5 +37,6 @@ namespace __gnu_cxx { } }; } +#endif #endif diff --git a/keyframe.cpp b/keyframe.cpp index ea61ecbe51f..d901346dc06 100644 --- a/keyframe.cpp +++ b/keyframe.cpp @@ -15,6 +15,7 @@ // License along with this library; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +#include "stdafx.h" #include "keyframe.h" #include "debug.h" #include "bits.h" diff --git a/lab.cpp b/lab.cpp index ab4c2a9e418..474f651d4d4 100644 --- a/lab.cpp +++ b/lab.cpp @@ -15,6 +15,7 @@ // License along with this library; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +#include "stdafx.h" #include "lab.h" #include "bits.h" #include @@ -46,7 +47,9 @@ bool Lab::open(const char *filename) { std::fseek(f_, 16, SEEK_SET); char binary_entry[16]; +#ifndef _MSC_VER file_map_.resize(num_entries); +#endif for (int i = 0; i < num_entries; i++) { std::fread(binary_entry, 1, 16, f_); int fname_offset = get_LE_uint32(binary_entry); @@ -57,6 +60,9 @@ bool Lab::open(const char *filename) { std::transform(fname.begin(), fname.end(), fname.begin(), tolower); file_map_.insert(std::make_pair(fname, LabEntry(start, size))); +#ifndef _MSC_VER + file_map_.size(); +#endif } delete [] string_table; diff --git a/lab.h b/lab.h index 8051747f295..5439a8f1aff 100644 --- a/lab.h +++ b/lab.h @@ -20,7 +20,6 @@ #include #include -#include #include "hash_map.h" class Block { diff --git a/localize.cpp b/localize.cpp index 0189e468bc3..6ccf4b70340 100644 --- a/localize.cpp +++ b/localize.cpp @@ -15,6 +15,7 @@ // License along with this library; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +#include "stdafx.h" #include "localize.h" #include "registry.h" #include "debug.h" diff --git a/lua.cpp b/lua.cpp index 4e62b6d55c8..e21b30a2188 100644 --- a/lua.cpp +++ b/lua.cpp @@ -15,6 +15,7 @@ // License along with this library; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +#include "stdafx.h" #include "lua.h" #include "resource.h" #include "debug.h" @@ -56,7 +57,11 @@ static inline Sound *check_sound(int num) { static inline int check_int(int num) { double val = luaL_check_number(num); +#ifndef _MSC_VER return int(round(val)); +#else + return int(/*round*/(val)); +#endif } static inline int check_control(int num) { @@ -723,7 +728,7 @@ void GetControlState() { lua_pushnumber(0); else { Uint8 *keystate = SDL_GetKeyState(NULL); - pushbool(keystate[num]); + pushbool(keystate[num] != 0); } } diff --git a/lua.vcproj b/lua.vcproj new file mode 100644 index 00000000000..5093dd44bc1 --- /dev/null +++ b/lua.vcproj @@ -0,0 +1,207 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/main.cpp b/main.cpp index 8e72e76a467..f8da3f4a38e 100644 --- a/main.cpp +++ b/main.cpp @@ -15,6 +15,7 @@ // License along with this library; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +#include "stdafx.h" #include #include #include @@ -25,8 +26,10 @@ #include "registry.h" #include "engine.h" #include "mixer.h" +#ifndef _MSC_VER #include -//#include +#endif + static void saveRegistry() { Registry::instance()->save(); } diff --git a/material.cpp b/material.cpp index 1e8fab32e4e..8daf5d181f4 100644 --- a/material.cpp +++ b/material.cpp @@ -15,6 +15,7 @@ // License along with this library; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +#include "stdafx.h" #include "material.h" #include "colormap.h" #include "bits.h" diff --git a/mixer.cpp b/mixer.cpp index 875525c69ad..8635b69d1ec 100644 --- a/mixer.cpp +++ b/mixer.cpp @@ -15,6 +15,7 @@ // License along with this library; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +#include "stdafx.h" #include "mixer.h" #include "sound.h" #include "debug.h" diff --git a/mixer.h b/mixer.h index 9669b2a81e5..33d1234fe1b 100644 --- a/mixer.h +++ b/mixer.h @@ -18,6 +18,7 @@ #ifndef MIXER_H #define MIXER_H +#include "bits.h" #include "resource.h" #include #include diff --git a/model.cpp b/model.cpp index e156a48e127..b5f4a44a9b8 100644 --- a/model.cpp +++ b/model.cpp @@ -15,6 +15,7 @@ // License along with this library; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +#include "stdafx.h" #include "model.h" #include "bits.h" #include "resource.h" diff --git a/registry.cpp b/registry.cpp index 8a0e2eaef68..317a2cf3ef1 100644 --- a/registry.cpp +++ b/registry.cpp @@ -15,6 +15,7 @@ // License along with this library; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +#include "stdafx.h" #include "registry.h" #include "debug.h" #include diff --git a/residual.rc b/residual.rc new file mode 100644 index 00000000000..0ba73ebc803 --- /dev/null +++ b/residual.rc @@ -0,0 +1,84 @@ +//Microsoft Developer Studio generated resource script. +// +#include "winresrc.h" + +///////////////////////////////////////////////////////////////////////////// +// +// Icon +// + +// Icon with lowest ID value placed first to ensure application icon +// remains consistent on all systems. +//IDI_ICON1 ICON DISCARDABLE "residual.ico" + +#ifdef APSTUDIO_INVOKED +///////////////////////////////////////////////////////////////////////////// +// +// TEXTINCLUDE +// + +1 TEXTINCLUDE DISCARDABLE +BEGIN + "resource.h\0" +END + +2 TEXTINCLUDE DISCARDABLE +BEGIN + "#include ""afxres.h""\r\n" + "\0" +END + +3 TEXTINCLUDE DISCARDABLE +BEGIN + "\r\n" + "\0" +END + +#endif // APSTUDIO_INVOKED + + +#ifndef _MAC +///////////////////////////////////////////////////////////////////////////// +// +// Version +// + +VS_VERSION_INFO VERSIONINFO + FILEVERSION 0,0,0,0 + PRODUCTVERSION 0,0,0,0 + FILEFLAGSMASK 0x3fL +#ifdef _DEBUG + FILEFLAGS 0x1L +#else + FILEFLAGS 0x0L +#endif + FILEOS 0x40004L + FILETYPE 0x1L + FILESUBTYPE 0x0L +BEGIN + BLOCK "StringFileInfo" + BEGIN + BLOCK "040904b0" + BEGIN + VALUE "Comments", "\0" + VALUE "CompanyName", "ScummVM Team\0" + VALUE "FileDescription", "http://www.scummvm.org/\0" + VALUE "FileVersion", "0.0.0\0" + VALUE "InternalName", "residual\0" + VALUE "LegalCopyright", "Copyright © 2003 The ScummVM Team\0" + VALUE "LegalTrademarks", "\0" + VALUE "OriginalFilename", "residual.exe\0" + VALUE "PrivateBuild", "\0" + VALUE "ProductName", "Residual\0" + VALUE "ProductVersion", "\0" + VALUE "SpecialBuild", "\0" + END + END + BLOCK "VarFileInfo" + BEGIN + VALUE "Translation", 0x409, 1200 + END +END + +#endif // !_MAC + diff --git a/residual.sln b/residual.sln new file mode 100644 index 00000000000..e3299c9803f --- /dev/null +++ b/residual.sln @@ -0,0 +1,27 @@ +Microsoft Visual Studio Solution File, Format Version 7.00 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "residual", "residual.vcproj", "{44D38F29-303D-4E3D-AF45-B96523BF1F9F}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "lua", "lua.vcproj", "{5930DA38-F3BC-41AB-BC48-FC1AB8ED75B0}" +EndProject +Global + GlobalSection(SolutionConfiguration) = preSolution + ConfigName.0 = Debug + ConfigName.1 = Release + EndGlobalSection + GlobalSection(ProjectDependencies) = postSolution + EndGlobalSection + GlobalSection(ProjectConfiguration) = postSolution + {44D38F29-303D-4E3D-AF45-B96523BF1F9F}.Debug.ActiveCfg = Debug|Win32 + {44D38F29-303D-4E3D-AF45-B96523BF1F9F}.Debug.Build.0 = Debug|Win32 + {44D38F29-303D-4E3D-AF45-B96523BF1F9F}.Release.ActiveCfg = Release|Win32 + {44D38F29-303D-4E3D-AF45-B96523BF1F9F}.Release.Build.0 = Release|Win32 + {5930DA38-F3BC-41AB-BC48-FC1AB8ED75B0}.Debug.ActiveCfg = Debug|Win32 + {5930DA38-F3BC-41AB-BC48-FC1AB8ED75B0}.Debug.Build.0 = Debug|Win32 + {5930DA38-F3BC-41AB-BC48-FC1AB8ED75B0}.Release.ActiveCfg = Release|Win32 + {5930DA38-F3BC-41AB-BC48-FC1AB8ED75B0}.Release.Build.0 = Release|Win32 + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + EndGlobalSection + GlobalSection(ExtensibilityAddIns) = postSolution + EndGlobalSection +EndGlobal diff --git a/residual.vcproj b/residual.vcproj new file mode 100644 index 00000000000..39b8fc72724 --- /dev/null +++ b/residual.vcproj @@ -0,0 +1,261 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/resource.cpp b/resource.cpp index 2f8b0937658..99a92d96d1c 100644 --- a/resource.cpp +++ b/resource.cpp @@ -15,6 +15,7 @@ // License along with this library; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +#include "stdafx.h" #include "resource.h" #include "registry.h" #include "bitmap.h" @@ -25,7 +26,6 @@ #include "model.h" #include "sound.h" #include "debug.h" -#include #include #include #include @@ -44,7 +44,7 @@ ResourceLoader::ResourceLoader() { int lab_counter = 0; #ifdef _MSC_VER - WIN32_FIND_DATAW find_file_data; + WIN32_FIND_DATAA find_file_data; HANDLE d = FindFirstFile(dir_str.c_str(), &find_file_data); #else DIR *d = opendir(dir_str.c_str()); @@ -60,7 +60,7 @@ ResourceLoader::ResourceLoader() { #ifdef _MSC_VER do { int namelen = strlen(find_file_data.cFileName); - if ((namelen > 4) && (stricmp(findFileData.cFileName + namelen - 4, ".lab") == 0)) { + if ((namelen > 4) && (stricmp(find_file_data.cFileName + namelen - 4, ".lab") == 0)) { std::string fullname = dir_str + find_file_data.cFileName; Lab *l = new Lab(fullname.c_str()); lab_counter++; @@ -69,7 +69,7 @@ ResourceLoader::ResourceLoader() { else delete l; } - } while (FindNextFile(d, &find_file_data) != NULL) + } while (FindNextFile(d, &find_file_data) != NULL); FindClose(d); #else dirent *de; diff --git a/scene.cpp b/scene.cpp index b3edbff7082..8e0ad5cc44e 100644 --- a/scene.cpp +++ b/scene.cpp @@ -15,6 +15,7 @@ // License along with this library; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +#include "stdafx.h" #include "scene.h" #include "textsplit.h" #include "resource.h" diff --git a/sound.cpp b/sound.cpp index 1f6758637e6..92d548ef2ce 100644 --- a/sound.cpp +++ b/sound.cpp @@ -15,6 +15,7 @@ // License along with this library; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +#include "stdafx.h" #include "sound.h" #include "bits.h" #include "debug.h" diff --git a/sound.h b/sound.h index bc1247619b5..f79a5c5c737 100644 --- a/sound.h +++ b/sound.h @@ -18,8 +18,8 @@ #ifndef SOUND_H #define SOUND_H +#include "bits.h" #include "resource.h" -#include class Sound : public Resource { public: diff --git a/stdafx.h b/stdafx.h new file mode 100644 index 00000000000..0f2c1b409e0 --- /dev/null +++ b/stdafx.h @@ -0,0 +1,120 @@ +// Residual - Virtual machine to run LucasArts' 3D adventure games +// Copyright (C) 2003 The ScummVM-Residual Team (www.scummvm.org) +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// +// This library 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 +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +#ifndef _STDAFX_H +#define _STDAFX_H + +#if defined(_WIN32_WCE) && _WIN32_WCE < 300 + +#define NONSTANDARD_PORT + +#endif + +#if defined(NONSTANDARD_PORT) + +#include + +#elif defined(WIN32) + +#ifdef _MSC_VER +#pragma once +#pragma warning( disable : 4068 ) // turn off "unknown pragma" warning +#pragma warning( disable : 4244 ) // turn off "conversion type" warning +#endif + +#if !defined(_WIN32_WCE) + + +#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers +#define NOGDICAPMASKS +#define OEMRESOURCE +#define NONLS +#define NOICONS +#define NOMCX +#define NOPROFILER +#define NOKANJI +#define NOSERVICE +#define NOMETAFILE +#define NOCOMM +#define NOCRYPT +#define NOIME +#define NOATOM +#define NOCTLMGR +#define NOCLIPBOARD +#define NOMEMMGR +#define NOSYSMETRICS +#define NOMENUS +#define NOOPENFILE +#define NOWH +#define NOSOUND +#define NODRAWTEXT + + +#endif + + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#define strcasecmp stricmp +#define M_PI 3.14159265 + +#ifndef _MSC_VER +#include +#include +#endif + +#else + +#if defined(__MORPHOS__) +#include +#undef CMD_INVALID +#endif +#if !defined(macintosh) +#include +#include +#endif +#if !defined (__BEOS__) +#include +#endif +#if defined(__QNXNTO__) +#include /* For strcasecmp */ +#endif +#include +#include +#include +#include +#include +#include +#include +#include +#include + + +#endif + +#endif diff --git a/textobject.cpp b/textobject.cpp index 1f639e9c406..8b315da75b5 100644 --- a/textobject.cpp +++ b/textobject.cpp @@ -15,6 +15,7 @@ // License along with this library; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +#include "stdafx.h" #include "textobject.h" #include "engine.h" #include "localize.h" diff --git a/textsplit.cpp b/textsplit.cpp index 33fed8ae103..464dbf568f5 100644 --- a/textsplit.cpp +++ b/textsplit.cpp @@ -15,6 +15,7 @@ // License along with this library; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +#include "stdafx.h" #include "textsplit.h" #include "debug.h" #include diff --git a/walkplane.cpp b/walkplane.cpp index cc907ef1355..2d17a05698a 100644 --- a/walkplane.cpp +++ b/walkplane.cpp @@ -16,6 +16,7 @@ // License along with this library; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +#include "stdafx.h" #include "walkplane.h" #include "textsplit.h"