diff --git a/Blocks3D VS2003.sln b/Blocks3D VS2003.sln new file mode 100644 index 0000000..f2affc8 --- /dev/null +++ b/Blocks3D VS2003.sln @@ -0,0 +1,37 @@ + +Microsoft Visual Studio Solution File, Format Version 8.00 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Blocks3D", "Blocks3D VS2003.vcproj", "{6C4D6EEF-B1D1-456A-B850-92CAB17124BE}" + ProjectSection(ProjectDependencies) = postProject + EndProjectSection +EndProject +Global + GlobalSection(SolutionConfiguration) = preSolution + Debug = Debug + Release = Release + EndGlobalSection + GlobalSection(ProjectDependencies) = postSolution + EndGlobalSection + GlobalSection(ProjectConfiguration) = postSolution + {6C4D6EEF-B1D1-456A-B850-92CAB17124BE}.Debug.ActiveCfg = Debug|Win32 + {6C4D6EEF-B1D1-456A-B850-92CAB17124BE}.Debug.Build.0 = Debug|Win32 + {6C4D6EEF-B1D1-456A-B850-92CAB17124BE}.Release.ActiveCfg = Release|Win32 + {6C4D6EEF-B1D1-456A-B850-92CAB17124BE}.Release.Build.0 = Release|Win32 + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + EndGlobalSection + GlobalSection(ExtensibilityAddIns) = postSolution + EndGlobalSection + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Win32 = Debug|Win32 + Release|Win32 = Release|Win32 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {6C4D6EEF-B1D1-456A-B850-92CAB17124BE}.Debug|Win32.ActiveCfg = Debug|Win32 + {6C4D6EEF-B1D1-456A-B850-92CAB17124BE}.Debug|Win32.Build.0 = Debug|Win32 + {6C4D6EEF-B1D1-456A-B850-92CAB17124BE}.Release|Win32.ActiveCfg = Release|Win32 + {6C4D6EEF-B1D1-456A-B850-92CAB17124BE}.Release|Win32.Build.0 = Release|Win32 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/Blocks3D VS2003.sln.old b/Blocks3D VS2003.sln.old new file mode 100644 index 0000000..9b35389 --- /dev/null +++ b/Blocks3D VS2003.sln.old @@ -0,0 +1,20 @@ + +Microsoft Visual Studio Solution File, Format Version 7.10 +# Visual C++ Express 2005 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Blocks3D", "Blocks3D VS2003.vcproj", "{6C4D6EEF-B1D1-456A-B850-92CAB17124BE}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Win32 = Debug|Win32 + Release|Win32 = Release|Win32 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {6C4D6EEF-B1D1-456A-B850-92CAB17124BE}.Debug|Win32.ActiveCfg = Debug|Win32 + {6C4D6EEF-B1D1-456A-B850-92CAB17124BE}.Debug|Win32.Build.0 = Debug|Win32 + {6C4D6EEF-B1D1-456A-B850-92CAB17124BE}.Release|Win32.ActiveCfg = Release|Win32 + {6C4D6EEF-B1D1-456A-B850-92CAB17124BE}.Release|Win32.Build.0 = Release|Win32 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/Blocks3D VS2003.vcproj b/Blocks3D VS2003.vcproj new file mode 100644 index 0000000..98bd4e0 --- /dev/null +++ b/Blocks3D VS2003.vcproj @@ -0,0 +1,729 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Blocks3D.vcproj b/Blocks3D.vcproj index 9a11ef0..c470824 100644 --- a/Blocks3D.vcproj +++ b/Blocks3D.vcproj @@ -55,7 +55,7 @@ OmitFramePointers="true" WholeProgramOptimization="true" AdditionalIncludeDirectories="".\src\include"" - PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS" + PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_ATL_STATIC_REGISTRY;NO_SDL_MAIN" StringPooling="true" RuntimeLibrary="2" EnableFunctionLevelLinking="true" @@ -155,7 +155,7 @@ Name="VCCLCompilerTool" Optimization="0" AdditionalIncludeDirectories=""C:\libraries\ode-0.5\include\drawstuff";.\src\include" - PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS" + PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_ATL_STATIC_REGISTRY;NO_SDL_MAIN" MinimalRebuild="false" BasicRuntimeChecks="0" RuntimeLibrary="3" diff --git a/Parts.bmp b/Parts.bmp index 2aaa8bf..e5e3f61 100644 Binary files a/Parts.bmp and b/Parts.bmp differ diff --git a/PartsOld.bmp b/PartsOld.bmp new file mode 100644 index 0000000..2aaa8bf Binary files /dev/null and b/PartsOld.bmp differ diff --git a/SDL.dll b/SDL.dll deleted file mode 100644 index 376722b..0000000 Binary files a/SDL.dll and /dev/null differ diff --git a/src/include/AudioPlayer.h b/src/include/AudioPlayer.h index 7068099..b4492a0 100644 --- a/src/include/AudioPlayer.h +++ b/src/include/AudioPlayer.h @@ -1,6 +1,6 @@ -#include #pragma once - +#include +#include class AudioPlayer { public: diff --git a/src/source/AudioPlayer.cpp b/src/source/AudioPlayer.cpp index f23c280..312c7be 100644 --- a/src/source/AudioPlayer.cpp +++ b/src/source/AudioPlayer.cpp @@ -1,11 +1,7 @@ #include "AudioPlayer.h" -#include "SDL.h" -#include "SDL_audio.h" -#include -#include -#include +#include +#include #define NUM_SOUNDS 32 -static SDL_AudioSpec fmt; static bool initiated = false; AudioPlayer::AudioPlayer(void) @@ -15,98 +11,15 @@ AudioPlayer::AudioPlayer(void) AudioPlayer::~AudioPlayer(void) { - SDL_CloseAudio(); } void AudioPlayer::init() { initiated = true; - extern void mixaudio(void *unused, Uint8 *stream, int len); - fmt.freq = 22050; - fmt.format = AUDIO_S16LSB; - fmt.channels = 2; - fmt.samples = 1024; /* A good value for games */ - fmt.callback = mixaudio; - fmt.userdata = NULL; - - /* Open the audio device and start playing sound! */ - if ( SDL_OpenAudio(&fmt, NULL) < 0 ) { - fprintf(stderr, "Unable to open audio: %s\n", SDL_GetError()); - } - SDL_PauseAudio(0); -} - -static struct sample { - Uint8 *data; - Uint32 dpos; - Uint32 dlen; -} sounds[NUM_SOUNDS]; - -void mixaudio(void *unused, Uint8 *stream, int len) -{ - int i; - Uint32 amount; - - for ( i=0; i (Uint32)len ) { - amount = len; - } - SDL_MixAudio(stream, &sounds[i].data[sounds[i].dpos], amount, SDL_MIX_MAXVOLUME); - sounds[i].dpos += amount; - } } void AudioPlayer::playSound(std::string fileString) { - - if(initiated) - { - char *file = new char[fileString.length() + 1]; - strcpy(file, fileString.c_str()); - - - int index; - SDL_AudioSpec wave; - Uint8 *data; - Uint32 dlen; - SDL_AudioCVT cvt; - - /* Look for an empty (or finished) sound slot */ - for ( index=0; index LevelInstance::getProperties() PIT_CHECK )); - sprintf_s(timerTxt, "%g", timer); - sprintf_s(scoreTxt, "%d", score); + _snprintf(timerTxt, 12, "%g", timer); + _snprintf(scoreTxt, 12, "%d", score); properties.push_back(createPGI("Gameplay", "InitialTimerValue", "The amount of time in seconds the player has to complete this level.\r\n\r\nPut 0 if time is limitless.", diff --git a/src/source/DataModelV2/PartInstance.cpp b/src/source/DataModelV2/PartInstance.cpp index fce479e..7410a7a 100644 --- a/src/source/DataModelV2/PartInstance.cpp +++ b/src/source/DataModelV2/PartInstance.cpp @@ -723,14 +723,14 @@ std::vector PartInstance::getProperties() (LPARAM)anchored, PIT_CHECK )); - sprintf_s(pto, "%g, %g, %g", position.x, position.y, position.z); + _snprintf(pto, 512, "%g, %g, %g", position.x, position.y, position.z); properties.push_back(createPGI("Item", "Offset", "The position of the object in the workspace", (LPARAM)pto, PIT_EDIT )); - sprintf_s(pto2, "%g, %g, %g", size.x, size.y, size.z); + _snprintf(pto2, 512, "%g, %g, %g", size.x, size.y, size.z); properties.push_back(createPGI("Item", "Size", "The size of the object in the workspace", @@ -759,8 +759,8 @@ std::vector PartInstance::getProperties() TEXT("NoSound\0Victory\0Boing\0Break\0Snap\0Bomb\0Splat\0Page\0Ping\0Swoosh\0Click\0Clock\0Step\0StepOn") )); - sprintf_s(changeScoreTxt, "%d", changeScore); - sprintf_s(changeTimerTxt, "%g", changeTimer); + _snprintf(changeScoreTxt, 12, "%d", changeScore); + _snprintf(changeTimerTxt, 12, "%g", changeTimer); properties.push_back(createPGI("OnTouch", "ChangeScore", "How the score is affected when touched", diff --git a/src/source/main.cpp b/src/source/main.cpp index 66ccaae..092a34a 100644 --- a/src/source/main.cpp +++ b/src/source/main.cpp @@ -142,6 +142,12 @@ LRESULT CALLBACK G3DProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) int main(int argc, char** argv) { + HINSTANCE hThisInstance = GetModuleHandle(NULL); + return WinMain(hThisInstance, NULL, NULL, 1); +} + +int WINAPI WinMain(HINSTANCE hThisInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int cmdShow) +{ #ifndef _DEBUG try{ #endif @@ -158,7 +164,6 @@ int main(int argc, char** argv) { icc.dwICC = ICC_WIN95_CLASSES/*|ICC_COOL_CLASSES|ICC_DATE_CLASSES| ICC_PAGESCROLLER_CLASS|ICC_USEREX_CLASSES*/; InitCommonControlsEx(&icc); - HMODULE hThisInstance = GetModuleHandle(NULL); if (!createWindowClass("mainHWND",WndProc,hThisInstance)) return false;