6 Commits

Author SHA1 Message Date
NT_x86
e365f3ed6c Open new place crash workaround
Reloads jointsservice on place open
2023-03-31 14:31:34 +03:00
NT_x86
998a22a43f Improved snap solver
Uses ODE collision detection instead
2023-03-29 21:00:15 +03:00
NT_x86
abb1f76c71 Joint solver basic implementation (axis aligned)
Does not handle rotation at all. solveWorkspaceSnaps is called in the debug game creation (Application.cpp)
Added isA to instance class
2023-03-28 21:05:08 +03:00
NT_x86
85e84bfdf3 Fix the crashing issue when closing Blocks3d
Physics engine now destroys JointsService on destructor
2023-03-27 20:16:17 +03:00
NT_x86
f7a76511a8 Improved snap deletion and added remove function to instance class
The current issue is that sometimes after deleting a snap and closing the game it throws an access violation (race condition?)
2023-03-27 12:06:57 +03:00
NT_x86
9cee74baf4 Initial JointsService and Snap implementation
This is incomplete and some issues need to be fixed
2023-03-26 18:51:11 +03:00
88 changed files with 661 additions and 1427 deletions

1
.gitattributes vendored
View File

@@ -1 +0,0 @@
* text=false

View File

@@ -1,37 +0,0 @@

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

View File

@@ -1,20 +0,0 @@

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

View File

@@ -1,717 +0,0 @@
<?xml version="1.0" encoding="Windows-1252"?>
<VisualStudioProject
ProjectType="Visual C++"
Version="7.10"
Name="Blocks3D"
ProjectGUID="{6C4D6EEF-B1D1-456A-B850-92CAB17124BE}"
RootNamespace="Blocks3D">
<Platforms>
<Platform
Name="Win32"/>
</Platforms>
<Configurations>
<Configuration
Name="Release|Win32"
OutputDirectory=".\Release"
IntermediateDirectory=".\Release"
ConfigurationType="1"
UseOfMFC="0"
UseOfATL="0"
ATLMinimizesCRunTimeLibraryUsage="FALSE"
CharacterSet="2">
<Tool
Name="VCCLCompilerTool"
Optimization="3"
InlineFunctionExpansion="2"
EnableIntrinsicFunctions="TRUE"
FavorSizeOrSpeed="1"
OmitFramePointers="TRUE"
WholeProgramOptimization="TRUE"
AdditionalIncludeDirectories="&quot;.\src\include&quot;"
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;NO_SDL_MAIN;_ATL_STATIC_REGISTRY"
StringPooling="TRUE"
RuntimeLibrary="2"
EnableFunctionLevelLinking="TRUE"
RuntimeTypeInfo="TRUE"
PrecompiledHeaderFile=".\Release/Blocks3D.pch"
AssemblerListingLocation=".\Release/"
ObjectFile=".\Release/"
ProgramDataBaseFileName=".\Release/"
WarningLevel="3"
SuppressStartupBanner="TRUE"/>
<Tool
Name="VCCustomBuildTool"/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="Advapi32.lib Comctl32.lib Comdlg32.lib Shell32.lib ode.lib Ole32.lib"
OutputFile="./Blocks3D.exe"
LinkIncremental="1"
SuppressStartupBanner="TRUE"
ProgramDatabaseFile=".\Release/Blocks3D.pdb"
SubSystem="2"
StackReserveSize="16777216"
OptimizeReferences="2"
EnableCOMDATFolding="2"
OptimizeForWindows98="2"
LinkTimeCodeGeneration="TRUE"
TargetMachine="1"/>
<Tool
Name="VCMIDLTool"
PreprocessorDefinitions="NDEBUG"
MkTypLibCompatible="TRUE"
SuppressStartupBanner="TRUE"
TargetEnvironment="1"
TypeLibraryName=".\Release/Blocks3D.tlb"
HeaderFileName=""/>
<Tool
Name="VCPostBuildEventTool"/>
<Tool
Name="VCPreBuildEventTool"/>
<Tool
Name="VCPreLinkEventTool"/>
<Tool
Name="VCResourceCompilerTool"
PreprocessorDefinitions="NDEBUG"
Culture="4105"/>
<Tool
Name="VCWebServiceProxyGeneratorTool"/>
<Tool
Name="VCXMLDataGeneratorTool"/>
<Tool
Name="VCWebDeploymentTool"/>
<Tool
Name="VCManagedWrapperGeneratorTool"/>
<Tool
Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
</Configuration>
<Configuration
Name="Debug|Win32"
OutputDirectory=".\Debug"
IntermediateDirectory=".\Debug"
ConfigurationType="1"
UseOfMFC="0"
ATLMinimizesCRunTimeLibraryUsage="FALSE"
CharacterSet="2"
ManagedExtensions="FALSE">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories=".\src\include"
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_ATL_STATIC_REGISTRY;NO_SDL_MAIN"
MinimalRebuild="FALSE"
BasicRuntimeChecks="0"
RuntimeLibrary="3"
EnableFunctionLevelLinking="FALSE"
EnableEnhancedInstructionSet="0"
RuntimeTypeInfo="TRUE"
PrecompiledHeaderFile=".\Debug/Blocks3D.pch"
AssemblerListingLocation=".\Debug/"
ObjectFile=".\Debug/"
ProgramDataBaseFileName=".\Debug/"
WarningLevel="3"
SuppressStartupBanner="TRUE"
DebugInformationFormat="3"/>
<Tool
Name="VCCustomBuildTool"/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="Advapi32.lib UxTheme.lib Comctl32.lib Comdlg32.lib Shell32.lib Urlmon.lib ole32.lib oleaut32.lib uuid.lib oded.lib"
OutputFile="./Blocks3D-Debug.exe"
LinkIncremental="2"
SuppressStartupBanner="TRUE"
AdditionalLibraryDirectories=""
GenerateDebugInformation="TRUE"
ProgramDatabaseFile=".\Debug/Blocks3D.pdb"
SubSystem="1"
StackReserveSize="16777216"
TargetMachine="1"/>
<Tool
Name="VCMIDLTool"
PreprocessorDefinitions="_DEBUG"
MkTypLibCompatible="TRUE"
SuppressStartupBanner="TRUE"
TargetEnvironment="1"
TypeLibraryName=".\Debug/Blocks3D.tlb"
HeaderFileName=""/>
<Tool
Name="VCPostBuildEventTool"/>
<Tool
Name="VCPreBuildEventTool"/>
<Tool
Name="VCPreLinkEventTool"/>
<Tool
Name="VCResourceCompilerTool"
PreprocessorDefinitions="_DEBUG"
Culture="4105"/>
<Tool
Name="VCWebServiceProxyGeneratorTool"/>
<Tool
Name="VCXMLDataGeneratorTool"/>
<Tool
Name="VCWebDeploymentTool"/>
<Tool
Name="VCManagedWrapperGeneratorTool"/>
<Tool
Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
</Configuration>
</Configurations>
<References>
<AssemblyReference
RelativePath="System.dll"/>
<AssemblyReference
RelativePath="System.Data.dll"/>
<AssemblyReference
RelativePath="System.Drawing.dll"/>
<AssemblyReference
RelativePath="System.Windows.Forms.dll"/>
<AssemblyReference
RelativePath="System.XML.dll"/>
</References>
<Files>
<Filter
Name="Source Files"
Filter="cpp;c;cxx;rc;def;r;odl;idl;hpj;bat">
<File
RelativePath=".\src\source\Application.cpp">
</File>
<File
RelativePath=".\src\source\AudioPlayer.cpp">
</File>
<File
RelativePath=".\src\source\ax.cpp">
</File>
<File
RelativePath=".\src\source\BrowserCallHandler.cpp">
</File>
<File
RelativePath=".\src\source\CameraController.cpp">
</File>
<File
RelativePath=".\src\source\ErrorFunctions.cpp">
</File>
<File
RelativePath=".\src\source\Globals.cpp">
</File>
<File
RelativePath=".\src\source\IEBrowser.cpp">
</File>
<File
RelativePath=".\src\source\IEDispatcher.cpp">
</File>
<File
RelativePath=".\src\source\main.cpp">
</File>
<File
RelativePath=".\src\source\Mouse.cpp">
</File>
<File
RelativePath=".\src\source\propertyGrid.cpp">
</File>
<File
RelativePath=".\src\source\PropertyWindow.cpp">
</File>
<File
RelativePath=".\src\source\Renderer.cpp">
</File>
<File
RelativePath=".\src\source\StringFunctions.cpp">
</File>
<File
RelativePath=".\src\source\TextureHandler.cpp">
</File>
<File
RelativePath=".\src\source\WindowFunctions.cpp">
</File>
<Filter
Name="Tool">
<File
RelativePath=".\src\source\Tool\ArrowTool.cpp">
</File>
<File
RelativePath=".\src\source\Tool\DraggerTool.cpp">
</File>
<File
RelativePath=".\src\source\Tool\SurfaceTool.cpp">
</File>
<File
RelativePath=".\src\source\Tool\Tool.cpp">
</File>
</Filter>
<Filter
Name="Listener">
<File
RelativePath=".\src\source\Listener\ButtonListener.cpp">
</File>
<File
RelativePath=".\src\source\Listener\CameraButtonListener.cpp">
</File>
<File
RelativePath=".\src\source\Listener\DeleteListener.cpp">
</File>
<File
RelativePath=".\src\source\Listener\GUDButtonListener.cpp">
</File>
<File
RelativePath=".\src\source\Listener\MenuButtonListener.cpp">
</File>
<File
RelativePath=".\src\source\Listener\ModeSelectionListener.cpp">
</File>
<File
RelativePath=".\src\source\Listener\RotateButtonListener.cpp">
</File>
<File
RelativePath=".\src\source\Listener\ToolbarListener.cpp">
</File>
</Filter>
<Filter
Name="DataModelV2">
<File
RelativePath=".\src\source\DataModelV2\DataModelInstance.cpp">
<FileConfiguration
Name="Release|Win32">
<Tool
Name="VCCLCompilerTool"
ObjectFile="$(IntDir)\$(InputName)1.obj"/>
</FileConfiguration>
<FileConfiguration
Name="Debug|Win32">
<Tool
Name="VCCLCompilerTool"
ObjectFile="$(IntDir)\$(InputName)1.obj"/>
</FileConfiguration>
</File>
<File
RelativePath=".\src\source\DataModelV2\GroupInstance.cpp">
<FileConfiguration
Name="Release|Win32">
<Tool
Name="VCCLCompilerTool"
ObjectFile="$(IntDir)\$(InputName)1.obj"/>
</FileConfiguration>
<FileConfiguration
Name="Debug|Win32">
<Tool
Name="VCCLCompilerTool"
ObjectFile="$(IntDir)\$(InputName)1.obj"/>
</FileConfiguration>
</File>
<File
RelativePath=".\src\source\DataModelV2\Instance.cpp">
<FileConfiguration
Name="Release|Win32">
<Tool
Name="VCCLCompilerTool"
ObjectFile="$(IntDir)\$(InputName)1.obj"/>
</FileConfiguration>
<FileConfiguration
Name="Debug|Win32">
<Tool
Name="VCCLCompilerTool"
ObjectFile="$(IntDir)\$(InputName)1.obj"/>
</FileConfiguration>
</File>
<File
RelativePath=".\src\source\DataModelV2\LevelInstance.cpp">
<FileConfiguration
Name="Release|Win32">
<Tool
Name="VCCLCompilerTool"
ObjectFile="$(IntDir)\$(InputName)1.obj"/>
</FileConfiguration>
<FileConfiguration
Name="Debug|Win32">
<Tool
Name="VCCLCompilerTool"
ObjectFile="$(IntDir)\$(InputName)1.obj"/>
</FileConfiguration>
</File>
<File
RelativePath=".\src\source\DataModelV2\LightingInstance.cpp">
</File>
<File
RelativePath=".\src\source\DataModelV2\PartInstance.cpp">
<FileConfiguration
Name="Release|Win32">
<Tool
Name="VCCLCompilerTool"
ObjectFile="$(IntDir)\$(InputName)1.obj"/>
</FileConfiguration>
<FileConfiguration
Name="Debug|Win32">
<Tool
Name="VCCLCompilerTool"
ObjectFile="$(IntDir)\$(InputName)1.obj"/>
</FileConfiguration>
</File>
<File
RelativePath=".\src\source\DataModelV2\PVInstance.cpp">
<FileConfiguration
Name="Release|Win32">
<Tool
Name="VCCLCompilerTool"
ObjectFile="$(IntDir)\$(InputName)1.obj"/>
</FileConfiguration>
<FileConfiguration
Name="Debug|Win32">
<Tool
Name="VCCLCompilerTool"
ObjectFile="$(IntDir)\$(InputName)1.obj"/>
</FileConfiguration>
</File>
<File
RelativePath=".\src\source\DataModelV2\SelectionService.cpp">
</File>
<File
RelativePath=".\src\source\DataModelV2\SoundInstance.cpp">
</File>
<File
RelativePath=".\src\source\DataModelV2\SoundService.cpp">
</File>
<File
RelativePath=".\src\source\DataModelV2\ThumbnailGeneratorInstance.cpp">
</File>
<File
RelativePath=".\src\source\DataModelV2\WorkspaceInstance.cpp">
<FileConfiguration
Name="Release|Win32">
<Tool
Name="VCCLCompilerTool"
ObjectFile="$(IntDir)\$(InputName)1.obj"/>
</FileConfiguration>
<FileConfiguration
Name="Debug|Win32">
<Tool
Name="VCCLCompilerTool"
ObjectFile="$(IntDir)\$(InputName)1.obj"/>
</FileConfiguration>
</File>
<Filter
Name="Gui">
<File
RelativePath=".\src\source\DataModelV2\BaseButtonInstance.cpp">
<FileConfiguration
Name="Release|Win32">
<Tool
Name="VCCLCompilerTool"
ObjectFile="$(IntDir)\$(InputName)1.obj"/>
</FileConfiguration>
<FileConfiguration
Name="Debug|Win32">
<Tool
Name="VCCLCompilerTool"
ObjectFile="$(IntDir)\$(InputName)1.obj"/>
</FileConfiguration>
</File>
<File
RelativePath=".\src\source\DataModelV2\BaseGuiInstance.cpp">
</File>
<File
RelativePath=".\src\source\DataModelV2\GuiRootInstance.cpp">
<FileConfiguration
Name="Release|Win32">
<Tool
Name="VCCLCompilerTool"
ObjectFile="$(IntDir)\$(InputName)1.obj"/>
</FileConfiguration>
<FileConfiguration
Name="Debug|Win32">
<Tool
Name="VCCLCompilerTool"
ObjectFile="$(IntDir)\$(InputName)1.obj"/>
</FileConfiguration>
</File>
<File
RelativePath=".\src\source\DataModelV2\ImageButtonInstance.cpp">
<FileConfiguration
Name="Release|Win32">
<Tool
Name="VCCLCompilerTool"
ObjectFile="$(IntDir)\$(InputName)1.obj"/>
</FileConfiguration>
<FileConfiguration
Name="Debug|Win32">
<Tool
Name="VCCLCompilerTool"
ObjectFile="$(IntDir)\$(InputName)1.obj"/>
</FileConfiguration>
</File>
<File
RelativePath=".\src\source\DataModelV2\TextButtonInstance.cpp">
<FileConfiguration
Name="Release|Win32">
<Tool
Name="VCCLCompilerTool"
ObjectFile="$(IntDir)\$(InputName)1.obj"/>
</FileConfiguration>
<FileConfiguration
Name="Debug|Win32">
<Tool
Name="VCCLCompilerTool"
ObjectFile="$(IntDir)\$(InputName)1.obj"/>
</FileConfiguration>
</File>
<File
RelativePath=".\src\source\DataModelV2\ToggleImageButtonInstance.cpp">
<FileConfiguration
Name="Release|Win32">
<Tool
Name="VCCLCompilerTool"
ObjectFile="$(IntDir)\$(InputName)1.obj"/>
</FileConfiguration>
<FileConfiguration
Name="Debug|Win32">
<Tool
Name="VCCLCompilerTool"
ObjectFile="$(IntDir)\$(InputName)1.obj"/>
</FileConfiguration>
</File>
</Filter>
<Filter
Name="XplicitNgine">
<File
RelativePath=".\src\source\XplicitNgine\XplicitNgine.cpp">
<FileConfiguration
Name="Release|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="0"/>
</FileConfiguration>
</File>
</Filter>
</Filter>
<Filter
Name="Helpers">
<File
RelativePath=".\src\source\base64.cpp">
</File>
</Filter>
</Filter>
<Filter
Name="Header Files"
Filter="h;hpp;hxx;hm;inl">
<File
RelativePath=".\src\include\Application.h">
</File>
<File
RelativePath=".\src\include\AudioPlayer.h">
</File>
<File
RelativePath=".\src\include\ax.h">
</File>
<File
RelativePath=".\src\include\BrowserCallHandler.h">
</File>
<File
RelativePath=".\src\include\CameraController.h">
</File>
<File
RelativePath=".\src\include\Enum.h">
</File>
<File
RelativePath=".\src\include\ErrorFunctions.h">
</File>
<File
RelativePath=".\src\include\Faces.h">
</File>
<File
RelativePath=".\src\include\Globals.h">
</File>
<File
RelativePath=".\src\include\IEBrowser.h">
</File>
<File
RelativePath=".\src\include\IEDispatcher.h">
</File>
<File
RelativePath=".\src\include\Mouse.h">
</File>
<File
RelativePath=".\src\include\propertyGrid.h">
</File>
<File
RelativePath=".\src\include\PropertyWindow.h">
</File>
<File
RelativePath=".\src\include\Renderer.h">
</File>
<File
RelativePath=".\src\include\resource.h">
</File>
<File
RelativePath=".\src\include\StringFunctions.h">
</File>
<File
RelativePath=".\src\include\TextureHandler.h">
</File>
<File
RelativePath=".\src\include\ToolEnum.h">
</File>
<File
RelativePath=".\src\include\versioning.h">
</File>
<File
RelativePath=".\src\include\VS2005CompatShim.h">
</File>
<File
RelativePath=".\src\include\win32Defines.h">
</File>
<File
RelativePath=".\src\include\WindowFunctions.h">
</File>
<Filter
Name="RapidXML">
<File
RelativePath=".\src\include\rapidxml\rapidxml.hpp">
</File>
<File
RelativePath=".\src\include\rapidxml\rapidxml_iterators.hpp">
</File>
<File
RelativePath=".\src\include\rapidxml\rapidxml_print.hpp">
</File>
<File
RelativePath=".\src\include\rapidxml\rapidxml_utils.hpp">
</File>
</Filter>
<Filter
Name="Listener">
<File
RelativePath=".\src\include\Listener\ButtonListener.h">
</File>
<File
RelativePath=".\src\include\Listener\CameraButtonListener.h">
</File>
<File
RelativePath=".\src\include\Listener\DeleteListener.h">
</File>
<File
RelativePath=".\src\include\Listener\GUDButtonListener.h">
</File>
<File
RelativePath=".\src\include\Listener\MenuButtonListener.h">
</File>
<File
RelativePath=".\src\include\Listener\ModeSelectionListener.h">
</File>
<File
RelativePath=".\src\include\Listener\RotateButtonListener.h">
</File>
<File
RelativePath=".\src\include\Listener\ToolbarListener.h">
</File>
<File
RelativePath=".\src\include\DataModel\WorkspaceInstance.h">
</File>
</Filter>
<Filter
Name="Tool">
<File
RelativePath=".\src\include\Tool\ArrowTool.h">
</File>
<File
RelativePath=".\src\include\Tool\DraggerTool.h">
</File>
<File
RelativePath=".\src\include\Tool\SurfaceTool.h">
</File>
<File
RelativePath=".\src\include\Tool\Tool.h">
</File>
</Filter>
<Filter
Name="DataModelV2">
<File
RelativePath=".\src\include\DataModelV2\DataModelInstance.h">
</File>
<File
RelativePath=".\src\include\DataModelV2\GroupInstance.h">
</File>
<File
RelativePath=".\src\include\DataModelV2\Instance.h">
</File>
<File
RelativePath=".\src\include\DataModelV2\LevelInstance.h">
</File>
<File
RelativePath=".\src\include\DataModelV2\LightingInstance.h">
</File>
<File
RelativePath=".\src\include\DataModelV2\PartInstance.h">
</File>
<File
RelativePath=".\src\include\DataModelV2\PVInstance.h">
</File>
<File
RelativePath=".\src\include\DataModelV2\SelectionService.h">
</File>
<File
RelativePath=".\src\include\DataModelV2\SoundInstance.h">
</File>
<File
RelativePath=".\src\include\DataModelV2\SoundService.h">
</File>
<File
RelativePath=".\src\include\DataModelV2\ThumbnailGeneratorInstance.h">
</File>
<File
RelativePath=".\src\include\DataModelV2\WorkspaceInstance.h">
</File>
<Filter
Name="Gui">
<File
RelativePath=".\src\include\DataModelV2\BaseButtonInstance.h">
</File>
<File
RelativePath=".\src\include\DataModelV2\BaseGuiInstance.h">
</File>
<File
RelativePath=".\src\include\DataModelV2\GuiRootInstance.h">
</File>
<File
RelativePath=".\src\include\DataModelV2\ImageButtonInstance.h">
</File>
<File
RelativePath=".\src\include\DataModelV2\TextButtonInstance.h">
</File>
<File
RelativePath=".\src\include\DataModelV2\ToggleImageButtonInstance.h">
</File>
</Filter>
<Filter
Name="XplicitNgine">
<File
RelativePath=".\src\include\XplicitNgine\XplicitNgine.h">
</File>
</Filter>
</Filter>
<Filter
Name="Helpers">
<File
RelativePath=".\src\include\base64.h">
</File>
</Filter>
</Filter>
<Filter
Name="Resource Files"
Filter="ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe">
<File
RelativePath=".\Dialogs.rc">
</File>
<File
RelativePath=".\icon1.ico">
</File>
<File
RelativePath=".\Parts.bmp">
</File>
<File
RelativePath=".\roblox_RN1_icon.ico">
</File>
</Filter>
</Files>
<Globals>
<Global
Name="RESOURCE_FILE"
Value="Dialogs.rc"/>
</Globals>
</VisualStudioProject>

View File

@@ -5,9 +5,4 @@
<assemblyIdentity type="win32" name="Microsoft.Windows.Common-Controls" version="6.0.0.0" processorArchitecture="*" publicKeyToken="6595b64144ccf1df" language="*"/> <assemblyIdentity type="win32" name="Microsoft.Windows.Common-Controls" version="6.0.0.0" processorArchitecture="*" publicKeyToken="6595b64144ccf1df" language="*"/>
</dependentAssembly> </dependentAssembly>
</dependency> </dependency>
<dependency>
<dependentAssembly>
<assemblyIdentity type="win32" name="Microsoft.VC80.CRT" version="8.0.50727.6195" processorArchitecture="x86" publicKeyToken="1fc8b3b9a1e18e3b"></assemblyIdentity>
</dependentAssembly>
</dependency>
</assembly> </assembly>

View File

@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="Windows-1252"?> <?xml version="1.0" encoding="Windows-1252"?>
<VisualStudioProject <VisualStudioProject
ProjectType="Visual C++" ProjectType="Visual C++"
Version="8.00" Version="8,00"
Name="Blocks3D" Name="Blocks3D"
ProjectGUID="{6C4D6EEF-B1D1-456A-B850-92CAB17124BE}" ProjectGUID="{6C4D6EEF-B1D1-456A-B850-92CAB17124BE}"
RootNamespace="Blocks3D" RootNamespace="Blocks3D"
@@ -55,7 +55,7 @@
OmitFramePointers="true" OmitFramePointers="true"
WholeProgramOptimization="true" WholeProgramOptimization="true"
AdditionalIncludeDirectories="&quot;.\src\include&quot;" AdditionalIncludeDirectories="&quot;.\src\include&quot;"
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_ATL_STATIC_REGISTRY;NO_SDL_MAIN" PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS"
StringPooling="true" StringPooling="true"
RuntimeLibrary="2" RuntimeLibrary="2"
EnableFunctionLevelLinking="true" EnableFunctionLevelLinking="true"
@@ -154,8 +154,8 @@
<Tool <Tool
Name="VCCLCompilerTool" Name="VCCLCompilerTool"
Optimization="0" Optimization="0"
AdditionalIncludeDirectories=".\src\include" AdditionalIncludeDirectories="&quot;C:\libraries\ode-0.5\include\drawstuff&quot;;.\src\include"
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_ATL_STATIC_REGISTRY;NO_SDL_MAIN" PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS"
MinimalRebuild="false" MinimalRebuild="false"
BasicRuntimeChecks="0" BasicRuntimeChecks="0"
RuntimeLibrary="3" RuntimeLibrary="3"
@@ -185,7 +185,6 @@
OutputFile="./Blocks3D-Debug.exe" OutputFile="./Blocks3D-Debug.exe"
LinkIncremental="2" LinkIncremental="2"
SuppressStartupBanner="true" SuppressStartupBanner="true"
AdditionalLibraryDirectories=""
GenerateDebugInformation="true" GenerateDebugInformation="true"
ProgramDatabaseFile=".\Debug/Blocks3D.pdb" ProgramDatabaseFile=".\Debug/Blocks3D.pdb"
SubSystem="1" SubSystem="1"
@@ -440,6 +439,10 @@
/> />
</FileConfiguration> </FileConfiguration>
</File> </File>
<File
RelativePath=".\src\source\DataModelV2\JointsService.cpp"
>
</File>
<File <File
RelativePath=".\src\source\DataModelV2\LevelInstance.cpp" RelativePath=".\src\source\DataModelV2\LevelInstance.cpp"
> >
@@ -514,6 +517,10 @@
RelativePath=".\src\source\DataModelV2\SelectionService.cpp" RelativePath=".\src\source\DataModelV2\SelectionService.cpp"
> >
</File> </File>
<File
RelativePath=".\src\source\DataModelV2\SnapInstance.cpp"
>
</File>
<File <File
RelativePath=".\src\source\DataModelV2\SoundInstance.cpp" RelativePath=".\src\source\DataModelV2\SoundInstance.cpp"
> >
@@ -523,7 +530,7 @@
> >
</File> </File>
<File <File
RelativePath=".\src\source\DataModelV2\ThumbnailGeneratorInstance.cpp" RelativePath=".\ThumbnailGeneratorInstance.cpp"
> >
</File> </File>
<File <File
@@ -675,6 +682,18 @@
</File> </File>
</Filter> </Filter>
</Filter> </Filter>
<Filter
Name="Properties"
>
<File
RelativePath=".\src\source\Properties\BoolProperty.cpp"
>
</File>
<File
RelativePath=".\src\source\Properties\Property.cpp"
>
</File>
</Filter>
<Filter <Filter
Name="Helpers" Name="Helpers"
> >
@@ -875,6 +894,10 @@
RelativePath=".\src\include\DataModelV2\Instance.h" RelativePath=".\src\include\DataModelV2\Instance.h"
> >
</File> </File>
<File
RelativePath=".\src\include\DataModelV2\JointsService.h"
>
</File>
<File <File
RelativePath=".\src\include\DataModelV2\LevelInstance.h" RelativePath=".\src\include\DataModelV2\LevelInstance.h"
> >
@@ -895,6 +918,10 @@
RelativePath=".\src\include\DataModelV2\SelectionService.h" RelativePath=".\src\include\DataModelV2\SelectionService.h"
> >
</File> </File>
<File
RelativePath=".\src\include\DataModelV2\SnapInstance.h"
>
</File>
<File <File
RelativePath=".\src\include\DataModelV2\SoundInstance.h" RelativePath=".\src\include\DataModelV2\SoundInstance.h"
> >
@@ -948,6 +975,18 @@
</File> </File>
</Filter> </Filter>
</Filter> </Filter>
<Filter
Name="Properties"
>
<File
RelativePath=".\src\include\Properties\BoolProperty.h"
>
</File>
<File
RelativePath=".\src\include\Properties\Property.h"
>
</File>
</Filter>
<Filter <Filter
Name="Helpers" Name="Helpers"
> >

View File

@@ -36,7 +36,7 @@ LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL
VALUE "FileDescription", "Blocks 3D" VALUE "FileDescription", "Blocks 3D"
VALUE "FileVersion", VER_STR(APP_VER_STRING) VALUE "FileVersion", VER_STR(APP_VER_STRING)
VALUE "InternalName", "Blocks3D" VALUE "InternalName", "Blocks3D"
VALUE "LegalCopyright", "Blocks3D Team 2018-2023" VALUE "LegalCopyright", "Blocks3D Team - 2022"
VALUE "LegalTrademarks", "" VALUE "LegalTrademarks", ""
VALUE "OriginalFilename", "Blocks3D.exe" VALUE "OriginalFilename", "Blocks3D.exe"
VALUE "PrivateBuild", "" VALUE "PrivateBuild", ""

13
Documentation/index.html Normal file
View File

@@ -0,0 +1,13 @@
<html>
<head>
<title> RBX05R Documentation </title>
<meta charset="utf-8">
</head>
<body>
<div class="content" style="text-align:center;">
<h1> ROBLOX 2005 Recreation documentation </h1>
<br>
<h4> Current for: r360 </h4>
</div>
</body>
</html>

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@@ -1,5 +1,4 @@
;InnoSetupVersion=5.4.3 ;InnoSetupVersion=5.4.3
;ONLY USE THIS IF YOU COMPILED WITH VISUAL STUDIO 2005!!!
#define AppVer GetFileVersion('..\Blocks3D.exe') #define AppVer GetFileVersion('..\Blocks3D.exe')
[Setup] [Setup]
@@ -24,7 +23,7 @@ Type: filesandordirs; Name: "{app}"
Source: "Redist\vcredist_x86.exe"; DestDir: "{tmp}"; Flags: ignoreversion Source: "Redist\vcredist_x86.exe"; DestDir: "{tmp}"; Flags: ignoreversion
;Source: "Redist\vcredist_x64.exe"; DestDir: "{tmp}"; Check: "IsWin64"; Flags: ignoreversion ;Source: "Redist\vcredist_x64.exe"; DestDir: "{tmp}"; Check: "IsWin64"; Flags: ignoreversion
Source: "..\content\*"; DestDir: "{app}\content"; Flags: ignoreversion recursesubdirs Source: "..\content\*"; DestDir: "{app}\content"; Flags: ignoreversion recursesubdirs
;Source: "..\SDL.DLL"; DestDir: "{app}"; Flags: ignoreversion recursesubdirs Source: "..\SDL.DLL"; DestDir: "{app}"; Flags: ignoreversion recursesubdirs
Source: "..\Blocks3D.exe"; DestDir: "{app}"; Flags: ignoreversion recursesubdirs Source: "..\Blocks3D.exe"; DestDir: "{app}"; Flags: ignoreversion recursesubdirs
[Registry] [Registry]

View File

@@ -1,5 +1,4 @@
;InnoSetupVersion=5.4.3 ;InnoSetupVersion=5.4.3
;ONLY USE THIS IF YOU COMPILED WITH VISUAL STUDIO 2005!!!
#define AppVer GetFileVersion('..\Blocks3D.exe') #define AppVer GetFileVersion('..\Blocks3D.exe')
[Setup] [Setup]
@@ -27,7 +26,7 @@ Type: filesandordirs; Name: "{app}"
Source: "Redist\vcredist_x86.exe"; DestDir: "{tmp}"; Flags: ignoreversion Source: "Redist\vcredist_x86.exe"; DestDir: "{tmp}"; Flags: ignoreversion
;Source: "Redist\vcredist_x64.exe"; DestDir: "{tmp}"; Check: "IsWin64"; Flags: ignoreversion ;Source: "Redist\vcredist_x64.exe"; DestDir: "{tmp}"; Check: "IsWin64"; Flags: ignoreversion
Source: "..\content\*"; DestDir: "{app}\content"; Flags: ignoreversion recursesubdirs Source: "..\content\*"; DestDir: "{app}\content"; Flags: ignoreversion recursesubdirs
;Source: "..\SDL.DLL"; DestDir: "{app}"; Flags: ignoreversion recursesubdirs Source: "..\SDL.DLL"; DestDir: "{app}"; Flags: ignoreversion recursesubdirs
Source: "..\Blocks3D.exe"; DestDir: "{app}"; Flags: ignoreversion recursesubdirs Source: "..\Blocks3D.exe"; DestDir: "{app}"; Flags: ignoreversion recursesubdirs
[Registry] [Registry]

View File

@@ -1,48 +0,0 @@
;InnoSetupVersion=5.4.3
;ONLY USE THIS IF YOU COMPILED WITH VISUAL STUDIO 2003!!!
#define AppVer GetFileVersion('..\Blocks3D.exe')
[Setup]
AppName=Blocks3D
AppVersion=v{#AppVer}
AppId={{4C5DF268-0208-4CDE-A7F0-65F7E2CB5067}
AppPublisherURL=http://blocks3d.com/
AppSupportURL=http://blocks3d.com/
AppUpdatesURL=http://blocks3d.com/
DefaultDirName={%localappdata}\Blocks3D
OutputBaseFilename=B3DSTP
Compression=lzma2
PrivilegesRequired=lowest
WizardImageFile=setup.bmp
DefaultGroupName=Blocks3D
DiskSpanning=yes
SlicesPerDisk=1
DiskSliceSize=1457664
[UninstallDelete]
Type: filesandordirs; Name: "{app}"
[Files]
Source: "Redist\msvcr71.dll"; DestDir: "{app}"; Flags: ignoreversion
Source: "Redist\msvcp71.dll"; DestDir: "{app}"; Flags: ignoreversion
Source: "..\content\*"; DestDir: "{app}\content"; Flags: ignoreversion recursesubdirs
Source: "..\Blocks3D.exe"; DestDir: "{app}"; Flags: ignoreversion recursesubdirs
[Registry]
[Run]
Filename: "iexplore.exe"; Parameters: "http://www.blocks3d.com/FirstInstall"; Description: Start playing Blocks3D; Flags: shellexec postinstall nowait skipifsilent
[Icons]
Name: "{group}\Play Blocks3D"; Filename: "{%programfiles}\Internet Explorer\iexplore.exe"; Parameters: "http://www.blocks3d.com/Games"; IconFilename: "{app}\Blocks3D.exe"; Tasks: startscut;
Name: "{group}\Blocks3D Editor"; Filename: "{app}\Blocks3D.exe"; Tasks: startscut;
Name: "{userdesktop}\Play Blocks3D"; Filename: "{%programfiles}\Internet Explorer\iexplore.exe"; Parameters: "http://www.blocks3d.com/Games"; IconFilename: "{app}\Blocks3D.exe"; Tasks: startscut;
Name: "{userdesktop}\Blocks3D Editor"; Filename: "{app}\Blocks3D.exe"; Tasks: desktopicon
[Tasks]
Name: "desktopicon"; Description: "Create Desktop Icons";
Name: "startscut"; Description: "Create Start Menu Icons";

View File

@@ -1,45 +0,0 @@
;InnoSetupVersion=5.4.3
;ONLY USE THIS IF YOU COMPILED WITH VISUAL STUDIO 2003!!!
#define AppVer GetFileVersion('..\Blocks3D.exe')
[Setup]
AppName=Blocks3D
AppVersion=v{#AppVer}
AppId={{4C5DF268-0208-4CDE-A7F0-65F7E2CB5067}
AppPublisherURL=http://blocks3d.com/
AppSupportURL=http://blocks3d.com/
AppUpdatesURL=http://blocks3d.com/
DefaultDirName={%localappdata}\Blocks3D
OutputBaseFilename=Blocks3D_Setup_v{#AppVer}
Compression=lzma2
PrivilegesRequired=lowest
WizardImageFile=setup.bmp
DefaultGroupName=Blocks3D
[UninstallDelete]
Type: filesandordirs; Name: "{app}"
[Files]
Source: "Redist\msvcp71.dll"; DestDir: "{app}"; Flags: ignoreversion
Source: "Redist\msvcr71.dll"; DestDir: "{app}"; Flags: ignoreversion
Source: "..\content\*"; DestDir: "{app}\content"; Flags: ignoreversion recursesubdirs
Source: "..\Blocks3D.exe"; DestDir: "{app}"; Flags: ignoreversion recursesubdirs
[Registry]
[Run]
Filename: "iexplore.exe"; Parameters: "http://www.blocks3d.com/FirstInstall"; Description: Start playing Blocks3D; Flags: shellexec postinstall nowait skipifsilent
[Icons]
Name: "{group}\Play Blocks3D"; Filename: "{%programfiles}\Internet Explorer\iexplore.exe"; Parameters: "http://www.blocks3d.com/Games"; IconFilename: "{app}\Blocks3D.exe"; Tasks: startscut;
Name: "{group}\Blocks3D Editor"; Filename: "{app}\Blocks3D.exe"; Tasks: startscut;
Name: "{userdesktop}\Play Blocks3D"; Filename: "{%programfiles}\Internet Explorer\iexplore.exe"; Parameters: "http://www.blocks3d.com/Games"; IconFilename: "{app}\Blocks3D.exe"; Tasks: startscut;
Name: "{userdesktop}\Blocks3D Editor"; Filename: "{app}\Blocks3D.exe"; Tasks: desktopicon
[Tasks]
Name: "desktopicon"; Description: "Create Desktop Icons";
Name: "startscut"; Description: "Create Start Menu Icons";

BIN
Installer/setup.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.4 KiB

BIN
Parts.bmp

Binary file not shown.

Before

Width:  |  Height:  |  Size: 11 KiB

After

Width:  |  Height:  |  Size: 11 KiB

View File

@@ -1,6 +1,3 @@
# IMPORTANT -- READ BEFORE CONTRIBUTING
Work on DataModel V3 will be starting November 3rd at 3PM PDT! This will mean **many PRs involving DataModel V2 may be immediately rejected until completion!** Progress on DataModelV3 can be tracked/contributed to on the feature/datamodel_v3 branch during this time.
# ROBLOX 2005 Recreation Project # ROBLOX 2005 Recreation Project
## Why are we doing this? ## Why are we doing this?
ROBLOX in 2005 was a different game, based around minigames with win and lose conditions rather than a 3D building game. Since this build of the client is presumed lost despite having around 100 users, we have to recreate it. We are using era-appropriate tools for this as well (Visual Studio 2005 and 2005-era compilers), as well as G3D 6.10, the era-appropriate version of the Graphics3D graphics library used by ROBLOX to this day. ROBLOX in 2005 was a different game, based around minigames with win and lose conditions rather than a 3D building game. Since this build of the client is presumed lost despite having around 100 users, we have to recreate it. We are using era-appropriate tools for this as well (Visual Studio 2005 and 2005-era compilers), as well as G3D 6.10, the era-appropriate version of the Graphics3D graphics library used by ROBLOX to this day.

BIN
SDL.dll Normal file

Binary file not shown.

Binary file not shown.

Binary file not shown.

BIN
oldcontent/cursor.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 576 B

BIN
oldcontent/cursor2.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 637 B

Binary file not shown.

BIN
oldcontent/font/arial.fnt Normal file

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 353 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 433 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 628 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 595 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 665 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 627 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 788 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 660 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 552 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 655 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 798 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 522 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

BIN
roblox_RN1_icon.ico Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 29 KiB

View File

@@ -1,6 +1,6 @@
#include <G3DAll.h>
#pragma once #pragma once
#include <iostream>
#include <string.h>
class AudioPlayer class AudioPlayer
{ {
public: public:

View File

@@ -43,14 +43,6 @@ public:
virtual bool mouseHovered(float, float, RenderDevice* rd); virtual bool mouseHovered(float, float, RenderDevice* rd);
UDim2 position; UDim2 position;
UDim2 size; UDim2 size;
static G3D::Color4 translucentBackdrop()
{
return G3D::Color4(0.60000002F, 0.60000002F, 0.60000002F, 0.60000002F);
}
static G3D::Color4 disabledFill()
{
return G3D::Color4(0.69999999F, 0.69999999F, 0.69999999F, 0.5F);
}
protected: protected:
bool mouseInArea(float, float, float, float, float, float); bool mouseInArea(float, float, float, float, float, float);
class ButtonListener* listener; class ButtonListener* listener;

View File

@@ -10,6 +10,7 @@
#include "XplicitNgine/XplicitNgine.h" #include "XplicitNgine/XplicitNgine.h"
#include "SoundService.h" #include "SoundService.h"
#include "LightingInstance.h" #include "LightingInstance.h"
#include "JointsService.h"
// Libraries // Libraries
#include "rapidxml/rapidxml.hpp" #include "rapidxml/rapidxml.hpp"
@@ -27,9 +28,7 @@ public:
void clearMessage(); void clearMessage();
bool debugGetOpen(); bool debugGetOpen();
bool getOpen(); bool getOpen();
bool getOpenModel();
bool load(const char* filename,bool clearObjects); bool load(const char* filename,bool clearObjects);
bool loadModel(const char* filename);
bool readXMLFileStream(std::ifstream* file); bool readXMLFileStream(std::ifstream* file);
void drawMessage(RenderDevice*); void drawMessage(RenderDevice*);
@@ -39,6 +38,7 @@ public:
XplicitNgine* getEngine(); XplicitNgine* getEngine();
ThumbnailGeneratorInstance* getThumbnailGenerator(); ThumbnailGeneratorInstance* getThumbnailGenerator();
SoundService* getSoundService(); SoundService* getSoundService();
JointsService* getJointsService();
LightingInstance* getLighting(); LightingInstance* getLighting();
std::string message; std::string message;
@@ -74,6 +74,7 @@ private:
XplicitNgine* xplicitNgine; XplicitNgine* xplicitNgine;
SoundService* soundService; SoundService* soundService;
LightingInstance* lightingInstance; LightingInstance* lightingInstance;
JointsService* jointsService;
bool running; bool running;
}; };

View File

@@ -16,6 +16,7 @@ public:
virtual void update(); virtual void update();
std::vector<Instance*> children; // All children. std::vector<Instance*> children; // All children.
std::string getClassName(); std::string getClassName();
bool Instance::isA(std::string name);
Instance* findFirstChild(std::string); Instance* findFirstChild(std::string);
std::vector<Instance* > getChildren(); std::vector<Instance* > getChildren();
std::vector<Instance* > getAllChildren(); std::vector<Instance* > getAllChildren();
@@ -25,6 +26,7 @@ public:
void removeChild(Instance*); void removeChild(Instance*);
void clearChildren(); void clearChildren();
Instance* getParent(); Instance* getParent();
void remove();
virtual Instance* clone() const { return new Instance(*this); } virtual Instance* clone() const { return new Instance(*this); }
virtual std::vector<PROPGRIDITEM> getProperties(); virtual std::vector<PROPGRIDITEM> getProperties();
virtual void PropUpdate(LPPROPGRIDITEM &pItem); virtual void PropUpdate(LPPROPGRIDITEM &pItem);

View File

@@ -0,0 +1,15 @@
#pragma once
#include "Instance.h"
#include "PartInstance.h"
class JointsService:
public Instance
{
public:
JointsService(void);
~JointsService(void);
void createSnap(PartInstance* Part1, PartInstance* Part2);
void destroyPartSnap(PartInstance* Part);
void JointsService::solvePartSnap(PartInstance* Part, PartInstance* Part2);
void JointsService::solveWorkspaceSnaps();
};

View File

@@ -0,0 +1,14 @@
#pragma once
#include "Instance.h"
#include "PartInstance.h"
class SnapInstance:
public Instance
{
public:
SnapInstance(PartInstance* Part1, PartInstance* Part2);
~SnapInstance(void);
PartInstance* jPart1;
PartInstance* jPart2;
dJointID JointID;
};

View File

@@ -37,7 +37,7 @@ namespace Enum
enum Value { enum Value {
NoSound = 0, Victory = 1, Boing = 2, Bomb = 3, NoSound = 0, Victory = 1, Boing = 2, Bomb = 3,
Ping = 4, Break = 5, Splat = 6, Swoosh = 7, Ping = 4, Break = 5, Splat = 6, Swoosh = 7,
Snap = 8, Page = 9, Click = 10, Clock = 11, Step = 12, StepOn = 13, Snap = 8, Page = 9
}; };
} }
} }

View File

@@ -0,0 +1,12 @@
#pragma once
#include "Property.h"
class BoolProperty : public Property<bool>
{
public:
BoolProperty(std::string name, bool& value, Instance& owner)
{
Property<bool>(name, value, owner);
}
~BoolProperty(void);
PROPGRIDITEM getPropGridItem();
};

View File

@@ -0,0 +1,30 @@
#pragma once
#include "DataModelV2/Instance.h"
#include <string>
class Instance;
template <typename T>
class Property
{
public:
Property(std::string name, T& value, Instance& owner)
{
_value = value;
_owner = owner;
}
~Property(void);
const T getValue()
{
return _value;
}
const void setValue(T val)
{
_value = val;
}
virtual PROPGRIDITEM getPropGridItem();
void setProperty(LPPROPGRIDITEM item);
protected:
Instance* _owner;
std::string _name;
T* _value;
};

View File

@@ -20,6 +20,5 @@ private:
bool hasHandles; bool hasHandles;
int handleGrabbed; int handleGrabbed;
Vector3 center; Vector3 center;
Vector3 CenterOffset;
Sphere handles[6]; Sphere handles[6];
}; };

View File

@@ -17,4 +17,6 @@ public:
void deleteBody(PartInstance* partInstance); void deleteBody(PartInstance* partInstance);
void updateBody(PartInstance* partInstance); void updateBody(PartInstance* partInstance);
void resetBody(PartInstance* partInstance); void resetBody(PartInstance* partInstance);
dJointID createJoint(PartInstance *part1, PartInstance *part2);
void destroyJoints(PartInstance *part);
}; };

View File

@@ -8,8 +8,8 @@
#include "DataModelV2/ImageButtonInstance.h" #include "DataModelV2/ImageButtonInstance.h"
#include "DataModelV2/DataModelInstance.h" #include "DataModelV2/DataModelInstance.h"
#include "DataModelV2/GuiRootInstance.h" #include "DataModelV2/GuiRootInstance.h"
#include "DataModelV2/SoundService.h"
#include "XplicitNgine/XplicitNgine.h" #include "XplicitNgine/XplicitNgine.h"
#include "DataModelV2/JointsService.h"
#include "CameraController.h" #include "CameraController.h"
#include "AudioPlayer.h" #include "AudioPlayer.h"
#include "Globals.h" #include "Globals.h"
@@ -39,7 +39,6 @@ static bool mouseMovedBeginMotion = false;
static POINT oldGlobalMouse; static POINT oldGlobalMouse;
Vector2 oldMouse = Vector2(0,0); Vector2 oldMouse = Vector2(0,0);
float moveRate = 0.5; float moveRate = 0.5;
float wasPropShown = 0;
void Application::clearInstances() void Application::clearInstances()
{ {
@@ -57,7 +56,7 @@ void Application::setFocus(bool focus)
if(_propWindow != NULL) if(_propWindow != NULL)
if(focus) if(focus)
{ {
//ShowWindow(_propWindow->_hwndProp, SW_SHOW); ShowWindow(_propWindow->_hwndProp, SW_SHOW);
SetWindowPos(_propWindow->_hwndProp, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE | SWP_NOACTIVATE); SetWindowPos(_propWindow->_hwndProp, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE | SWP_NOACTIVATE);
} }
else else
@@ -202,11 +201,16 @@ void Application::onInit() {
#ifdef LEGACY_LOAD_G3DFUN_LEVEL #ifdef LEGACY_LOAD_G3DFUN_LEVEL
// Anchored this baseplate for XplicitNgine tests // Anchored this baseplate for XplicitNgine tests
//XplicitNgine ngine;
PartInstance* test = makePart(); PartInstance* test = makePart();
PartInstance* test2;
PartInstance* test3;
JointsService* JointsSvc = g_dataModel->getJointsService();
test->setParent(_dataModel->getWorkspace()); test->setParent(_dataModel->getWorkspace());
test->color = Color3(0.2F,0.3F,1); test->color = Color3(0.2F,0.3F,1);
test->setSize(Vector3(24,1,24)); test->setSize(Vector3(24,1,24));
test->setPosition(Vector3(0,0,0)); test->setPosition(Vector3(0,-10,0));
test->setCFrame(test->getCFrame() * Matrix3::fromEulerAnglesXYZ(0,toRadians(0),toRadians(0))); test->setCFrame(test->getCFrame() * Matrix3::fromEulerAnglesXYZ(0,toRadians(0),toRadians(0)));
test->setSurface(TOP, Enum::SurfaceType::Bumps); test->setSurface(TOP, Enum::SurfaceType::Bumps);
test->setAnchored(true); test->setAnchored(true);
@@ -225,12 +229,12 @@ void Application::onInit() {
test->setPosition(Vector3(10,1,0)); test->setPosition(Vector3(10,1,0));
test->setSurface(TOP, Enum::SurfaceType::Bumps); test->setSurface(TOP, Enum::SurfaceType::Bumps);
test = makePart(); test2 = makePart();
test->setParent(_dataModel->getWorkspace()); test2->setParent(_dataModel->getWorkspace());
test->color = Color3::gray(); test2->color = Color3::red();
test->setSize(Vector3(4,1,2)); test2->setSize(Vector3(4,1,2));
test->setPosition(Vector3(7,2,0)); test2->setPosition(Vector3(7,2,0));
test->setSurface(TOP, Enum::SurfaceType::Bumps); test2->setSurface(TOP, Enum::SurfaceType::Bumps);
test = makePart(); test = makePart();
test->setParent(_dataModel->getWorkspace()); test->setParent(_dataModel->getWorkspace());
@@ -239,12 +243,14 @@ void Application::onInit() {
test->setPosition(Vector3(-7,2,0)); test->setPosition(Vector3(-7,2,0));
test->setSurface(TOP, Enum::SurfaceType::Bumps); test->setSurface(TOP, Enum::SurfaceType::Bumps);
test = makePart(); test3 = makePart();
test->setParent(_dataModel->getWorkspace()); test3->setParent(_dataModel->getWorkspace());
test->color = Color3::gray(); test3->color = Color3::red();
test->setSize(Vector3(4,1,2)); test3->setSize(Vector3(4,1,2));
test->setPosition(Vector3(4,3,0)); test3->setPosition(Vector3(4,3,0));
test->setSurface(TOP, Enum::SurfaceType::Bumps); test3->setSurface(TOP, Enum::SurfaceType::Bumps);
//JointsSvc->createSnap(test2, test3);
test = makePart(); test = makePart();
test->setParent(_dataModel->getWorkspace()); test->setParent(_dataModel->getWorkspace());
@@ -255,10 +261,12 @@ void Application::onInit() {
test = makePart(); test = makePart();
test->setParent(_dataModel->getWorkspace()); test->setParent(_dataModel->getWorkspace());
test->color = Color3::gray(); test->color = Color3::red();
test->setSize(Vector3(4,1,2)); test->setSize(Vector3(4,1,2));
test->setPosition(Vector3(1,4,0)); test->setPosition(Vector3(1,4,0));
test->setSurface(TOP, Enum::SurfaceType::Bumps); test->setSurface(TOP, Enum::SurfaceType::Bumps);
//JointsSvc->createSnap(test, test3);
//JointsSvc->solvePartSnap(test3, test);
test = makePart(); test = makePart();
test->setParent(_dataModel->getWorkspace()); test->setParent(_dataModel->getWorkspace());
@@ -287,6 +295,8 @@ void Application::onInit() {
test->setSize(Vector3(4,1,2)); test->setSize(Vector3(4,1,2));
test->setPosition(Vector3(2,7,0)); test->setPosition(Vector3(2,7,0));
test->setSurface(TOP, Enum::SurfaceType::Bumps); test->setSurface(TOP, Enum::SurfaceType::Bumps);
JointsSvc->solveWorkspaceSnaps();
#else #else
_dataModel->debugGetOpen(); _dataModel->debugGetOpen();
#endif #endif
@@ -340,7 +350,6 @@ void Application::onSimulation(RealTime rdt, SimTime sdt, SimTime idt) {
_dataModel->getEngine()->step(0.03F); _dataModel->getEngine()->step(0.03F);
} }
onLogic(); onLogic();
} }
_dataModel->getGuiRoot()->update(); _dataModel->getGuiRoot()->update();
@@ -514,7 +523,7 @@ void Application::onMouseWheel(int x,int y,short delta)
if (mouseOnScreen==true) if (mouseOnScreen==true)
if (cameraController.onMouseWheel(x, y, delta)) if (cameraController.onMouseWheel(x, y, delta))
{ {
_dataModel->getSoundService()->playSound(_dataModel->getSoundService()->findFirstChild("Step")); AudioPlayer::playSound(cameraSound);
} }
tool->onMouseScroll(mouse); tool->onMouseScroll(mouse);
} }

View File

@@ -1,7 +1,11 @@
#include "AudioPlayer.h" #include "AudioPlayer.h"
#include <Windows.h> #include "SDL.h"
#include <Mmsystem.h> #include "SDL_audio.h"
#include <stdlib.h>
#include <malloc.h>
#include <string.h>
#define NUM_SOUNDS 32 #define NUM_SOUNDS 32
static SDL_AudioSpec fmt;
static bool initiated = false; static bool initiated = false;
AudioPlayer::AudioPlayer(void) AudioPlayer::AudioPlayer(void)
@@ -11,15 +15,98 @@ AudioPlayer::AudioPlayer(void)
AudioPlayer::~AudioPlayer(void) AudioPlayer::~AudioPlayer(void)
{ {
SDL_CloseAudio();
} }
void AudioPlayer::init() void AudioPlayer::init()
{ {
initiated = true; 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<NUM_SOUNDS; ++i ) {
amount = (sounds[i].dlen-sounds[i].dpos);
if ( amount > (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) void AudioPlayer::playSound(std::string fileString)
{ {
//TODO probably use something a bit better
PlaySound(fileString.c_str(), NULL, SND_FILENAME | SND_ASYNC); 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<NUM_SOUNDS; ++index ) {
if ( sounds[index].dpos == sounds[index].dlen ) {
break;
}
}
if ( index == NUM_SOUNDS )
return;
/* Load the sound file and convert it to 16-bit stereo at 22kHz */
if ( SDL_LoadWAV(file, &wave, &data, &dlen) == NULL ) {
fprintf(stderr, "Couldn't load %s: %s\n", file, SDL_GetError());
return;
}
SDL_BuildAudioCVT(&cvt, wave.format, wave.channels, wave.freq,
AUDIO_S16, 2, fmt.freq);
cvt.buf = (Uint8*)malloc(dlen*cvt.len_mult);
memcpy(cvt.buf, data, dlen);
cvt.len = dlen;
SDL_ConvertAudio(&cvt);
SDL_FreeWAV(data);
/* Put the sound data in the slot (it starts playing immediately) */
if ( sounds[index].data ) {
free(sounds[index].data);
}
SDL_LockAudio();
sounds[index].data = cvt.buf;
sounds[index].dlen = cvt.len_cvt;
sounds[index].dpos = 0;
SDL_UnlockAudio();
delete [] file;
}
else
{
OutputDebugString("Audio player not initialized, sound will not play\r\n");
}
} }

View File

@@ -28,6 +28,7 @@ DataModelInstance::DataModelInstance(void)
thumbnailGenerator = new ThumbnailGeneratorInstance(); thumbnailGenerator = new ThumbnailGeneratorInstance();
soundService = new SoundService(); soundService = new SoundService();
lightingInstance = new LightingInstance(); lightingInstance = new LightingInstance();
jointsService = new JointsService();
selectionService = new SelectionService(); selectionService = new SelectionService();
selectionService->setPropertyWindow(g_usableApp->_propWindow); selectionService->setPropertyWindow(g_usableApp->_propWindow);
@@ -41,6 +42,7 @@ DataModelInstance::DataModelInstance(void)
level->setParent(this); level->setParent(this);
soundService->setParent(this); soundService->setParent(this);
lightingInstance->setParent(this); lightingInstance->setParent(this);
jointsService->setParent(this);
_loadedFileName="..//skooter.rbxm"; _loadedFileName="..//skooter.rbxm";
listicon = 5; listicon = 5;
@@ -471,6 +473,7 @@ bool DataModelInstance::scanXMLObject(xml_node<> * scanNode)
{ {
return false; return false;
} }
} }
} }
/* /*
@@ -501,29 +504,12 @@ bool DataModelInstance::load(const char* filename, bool clearObjects)
std::string tname = hname.substr(0, hname.length() - 5); std::string tname = hname.substr(0, hname.length() - 5);
name = tname; name = tname;
resetEngine(); resetEngine();
//HACK: we need to reset JointsService but there is no good way to do it in XplicitNgine code
jointsService = new JointsService();
jointsService->setParent(this);
selectionService->clearSelection(); selectionService->clearSelection();
selectionService->addSelected(this); selectionService->addSelected(this);
return true; jointsService->solveWorkspaceSnaps();
}
else
{
std::stringstream msg;
msg << "Failed to load file:" << std::endl << filename << std::endl << strerror(errno);
MessageBoxStr(msg.str());
return false;
}
}
bool DataModelInstance::loadModel(const char* filename)
{
ifstream levelFile(filename,ios::binary);
if (levelFile)
{
readXMLFileStream(&levelFile);
//resetEngine();
selectionService->clearSelection();
selectionService->addSelected(this);
return true; return true;
} }
else else
@@ -593,7 +579,7 @@ bool DataModelInstance::getOpen()
of.lpstrFile = szFile ; of.lpstrFile = szFile ;
of.lpstrFile[0]='\0'; of.lpstrFile[0]='\0';
of.nMaxFile=500; of.nMaxFile=500;
of.lpstrTitle="Open"; of.lpstrTitle="Hello";
of.Flags = OFN_FILEMUSTEXIST; of.Flags = OFN_FILEMUSTEXIST;
ShowCursor(TRUE); ShowCursor(TRUE);
BOOL file = GetOpenFileName(&of); BOOL file = GetOpenFileName(&of);
@@ -604,30 +590,6 @@ bool DataModelInstance::getOpen()
} }
return true; return true;
} }
bool DataModelInstance::getOpenModel()
{
_modY=0;
OPENFILENAME of;
ZeroMemory( &of , sizeof( of));
of.lStructSize = sizeof(OPENFILENAME);
of.lpstrFilter = "Roblox Files\0*.rbxm;*.rbxl\0\0";
char szFile[512];
of.lpstrFile = szFile ;
of.lpstrFile[0]='\0';
of.nMaxFile=500;
of.lpstrTitle="Open";
of.Flags = OFN_FILEMUSTEXIST;
ShowCursor(TRUE);
BOOL file = GetOpenFileName(&of);
if (file)
{
_loadedFileName = of.lpstrFile;
loadModel(of.lpstrFile);
}
return true;
}
void DataModelInstance::setMessage(std::string msg) void DataModelInstance::setMessage(std::string msg)
{ {
message = msg; message = msg;
@@ -667,9 +629,9 @@ void DataModelInstance::drawMessage(RenderDevice* rd)
} }
} }
char brkc[12]; char brkc[12];
_snprintf(brkc, 12, "%d", brickCount); sprintf_s(brkc, "%d", brickCount);
char instc[12]; char instc[12];
_snprintf(instc, 12, "%d", instCount); sprintf_s(instc, "%d", instCount);
message = "Bricks: "; message = "Bricks: ";
message += brkc; message += brkc;
message += " Snaps: "; message += " Snaps: ";
@@ -716,6 +678,11 @@ SoundService* DataModelInstance::getSoundService()
return soundService; return soundService;
} }
JointsService* DataModelInstance::getJointsService()
{
return jointsService;
}
LightingInstance* DataModelInstance::getLighting() LightingInstance* DataModelInstance::getLighting()
{ {
return lightingInstance; return lightingInstance;

View File

@@ -6,7 +6,6 @@
#include "DataModelV2/ImageButtonInstance.h" #include "DataModelV2/ImageButtonInstance.h"
#include "DataModelV2/ToggleImageButtonInstance.h" #include "DataModelV2/ToggleImageButtonInstance.h"
#include "DataModelV2/GuiRootInstance.h" #include "DataModelV2/GuiRootInstance.h"
#include "DataModelV2/SelectionService.h"
#include "DataModelV2/ImageButtonInstance.h" #include "DataModelV2/ImageButtonInstance.h"
#include "Globals.h" #include "Globals.h"
#include "StringFunctions.h" #include "StringFunctions.h"
@@ -214,14 +213,13 @@ GuiRootInstance::GuiRootInstance() : _message(""), _messageTime(0)
button->boxBegin = Vector2(0,215); button->boxBegin = Vector2(0,215);
button->boxEnd = Vector2(80,235); button->boxEnd = Vector2(80,235);
button->textOutlineColor = Color4(0.5F,0.5F,0.5F,0.5F); button->textOutlineColor = Color4(0.5F,0.5F,0.5F,0.5F);
button->textColor = Color3(0,1,1); button->textColor = Color3::white();
button->boxColor = Color4::clear(); button->boxColor = Color4::clear();
button->textSize = 12; button->textSize = 12;
button->title = "Group"; button->title = "Group";
button->name = "Group"; button->name = "Group";
button->setAllColorsSame(); button->setAllColorsSame();
button->textColorDis = Color3(0.8F,0.8F,0.8F); button->textColorDis = Color3(0.8F,0.8F,0.8F);
button->boxColorOvr = Color4(0.6F,0.6F,0.6F,0.4F);
button->font = g_fntlighttrek; button->font = g_fntlighttrek;
button->fontLocationRelativeTo = Vector2(10, 0); button->fontLocationRelativeTo = Vector2(10, 0);
button->setParent(this); button->setParent(this);
@@ -231,14 +229,13 @@ GuiRootInstance::GuiRootInstance() : _message(""), _messageTime(0)
button->boxBegin = Vector2(0,240); button->boxBegin = Vector2(0,240);
button->boxEnd = Vector2(80,260); button->boxEnd = Vector2(80,260);
button->textOutlineColor = Color4(0.5F,0.5F,0.5F,0.5F); button->textOutlineColor = Color4(0.5F,0.5F,0.5F,0.5F);
button->textColor = Color3(0,1,1); button->textColor = Color3::white();
button->boxColor = Color4::clear(); button->boxColor = Color4::clear();
button->textSize = 12; button->textSize = 12;
button->title = "UnGroup"; button->title = "UnGroup";
button->name = "UnGroup"; button->name = "UnGroup";
button->setAllColorsSame(); button->setAllColorsSame();
button->textColorDis = Color3(0.8F,0.8F,0.8F); button->textColorDis = Color3(0.8F,0.8F,0.8F);
button->boxColorOvr = Color4(0.6F,0.6F,0.6F,0.4F);
button->font = g_fntlighttrek; button->font = g_fntlighttrek;
button->fontLocationRelativeTo = Vector2(10, 0); button->fontLocationRelativeTo = Vector2(10, 0);
button->setParent(this); button->setParent(this);
@@ -248,45 +245,26 @@ GuiRootInstance::GuiRootInstance() : _message(""), _messageTime(0)
button->boxBegin = Vector2(0,265); button->boxBegin = Vector2(0,265);
button->boxEnd = Vector2(80,285); button->boxEnd = Vector2(80,285);
button->textOutlineColor = Color4(0.5F,0.5F,0.5F,0.5F); button->textOutlineColor = Color4(0.5F,0.5F,0.5F,0.5F);
button->textColor = Color3(0,1,1); button->textColor = Color3::white();
button->boxColor = Color4::clear(); button->boxColor = Color4::clear();
button->textSize = 12; button->textSize = 12;
button->title = "Duplicate"; button->title = "Duplicate";
button->setAllColorsSame(); button->setAllColorsSame();
button->textColorDis = Color3(0.8F,0.8F,0.8F); button->textColorDis = Color3(0.8F,0.8F,0.8F);
button->boxColorOvr = Color4(0.6F,0.6F,0.6F,0.4F);
button->font = g_fntlighttrek; button->font = g_fntlighttrek;
button->fontLocationRelativeTo = Vector2(10, 0); button->fontLocationRelativeTo = Vector2(10, 0);
button->setParent(this); button->setParent(this);
button->name = "Duplicate"; button->name = "Duplicate";
button->setButtonListener(gud); button->setButtonListener(gud);
//g_fntlighttrek->draw2D(rd,"MENU", Vector2(10,332), 14, Color3::white(), Color4(0.5F,0.5F,0.5F,0.5F));
button = makeTextButton();
button->boxBegin = Vector2(0,332);
button->boxEnd = Vector2(80,352);
button->textOutlineColor = Color4(0.5F,0.5F,0.5F,0.5F);
button->textColor = Color3::white();
button->boxColor = Color4::clear();
button->textSize = 14;
button->title = "MENU";
button->setAllColorsSame();
button->boxColorOvr = Color4(0.6F,0.6F,0.6F,0.4F);
button->font = g_fntlighttrek;
button->fontLocationRelativeTo = Vector2(10, 0);
button->setParent(this);
button->name = "MENU";
button->setButtonListener(menuListener);
ImageButtonInstance* instance = new ToggleImageButtonInstance( ImageButtonInstance* instance = new ToggleImageButtonInstance(
Texture::fromFile(&GetFileInPath("/content/images/Run.png")), Texture::fromFile(GetFileInPath("/content/images/Run.png")),
Texture::fromFile(&GetFileInPath("/content/images/Run_ovr.png")), Texture::fromFile(GetFileInPath("/content/images/Run_ovr.png")),
Texture::fromFile(&GetFileInPath("/content/images/Run_dn.png")), Texture::fromFile(GetFileInPath("/content/images/Run_dn.png")),
NULL, NULL,
Texture::fromFile(&GetFileInPath("/content/images/Stop.png")), Texture::fromFile(GetFileInPath("/content/images/Stop.png")),
Texture::fromFile(&GetFileInPath("/content/images/Stop_ovr.png")), Texture::fromFile(GetFileInPath("/content/images/Stop_ovr.png")),
Texture::fromFile(&GetFileInPath("/content/images/Stop_dn.png")) Texture::fromFile(GetFileInPath("/content/images/Stop_dn.png"))
); );
instance->setButtonListener(menuListener); instance->setButtonListener(menuListener);
instance->name = "go"; instance->name = "go";
@@ -296,17 +274,17 @@ GuiRootInstance::GuiRootInstance() : _message(""), _messageTime(0)
instance = makeImageButton( instance = makeImageButton(
Texture::fromFile(&GetFileInPath("/content/images/ArrowTool.png")), Texture::fromFile(GetFileInPath("/content/images/ArrowTool.png")),
Texture::fromFile(&GetFileInPath("/content/images/ArrowTool_ovr.png")), Texture::fromFile(GetFileInPath("/content/images/ArrowTool_ovr.png")),
Texture::fromFile(&GetFileInPath("/content/images/ArrowTool_dn.png")), Texture::fromFile(GetFileInPath("/content/images/ArrowTool_dn.png")),
Texture::fromFile(&GetFileInPath("/content/images/ArrowTool_ds.png"))); Texture::fromFile(GetFileInPath("/content/images/ArrowTool_ds.png")));
instance->size = Vector2(50,50); instance->size = Vector2(50,50);
instance->position = Vector2(15, 90); instance->position = Vector2(15, 90);
instance->setParent(this); instance->setParent(this);
instance->name = "Cursor"; instance->name = "Cursor";
instance->setButtonListener(msl); instance->setButtonListener(msl);
instance = makeImageButton(Texture::fromFile(&GetFileInPath("/content/images/ScaleTool.png")),Texture::fromFile(&GetFileInPath("/content/images/ScaleTool_ovr.png")),Texture::fromFile(&GetFileInPath("/content/images/ScaleTool_dn.png")),Texture::fromFile(&GetFileInPath("/content/images/ScaleTool_ds.png"))); instance = makeImageButton(Texture::fromFile(GetFileInPath("/content/images/ScaleTool.png")),Texture::fromFile(GetFileInPath("/content/images/ScaleTool_ovr.png")),Texture::fromFile(GetFileInPath("/content/images/ScaleTool_dn.png")),Texture::fromFile(GetFileInPath("/content/images/ScaleTool_ds.png")));
instance->size = Vector2(40,40); instance->size = Vector2(40,40);
instance->position = Vector2(0, 140); instance->position = Vector2(0, 140);
instance->setParent(this); instance->setParent(this);
@@ -315,10 +293,10 @@ GuiRootInstance::GuiRootInstance() : _message(""), _messageTime(0)
instance = makeImageButton( instance = makeImageButton(
Texture::fromFile(&GetFileInPath("/content/images/MoveTool.png")), Texture::fromFile(GetFileInPath("/content/images/MoveTool.png")),
Texture::fromFile(&GetFileInPath("/content/images/MoveTool_ovr.png")), Texture::fromFile(GetFileInPath("/content/images/MoveTool_ovr.png")),
Texture::fromFile(&GetFileInPath("/content/images/MoveTool_dn.png")), Texture::fromFile(GetFileInPath("/content/images/MoveTool_dn.png")),
Texture::fromFile(&GetFileInPath("/content/images/MoveTool_ds.png"))); Texture::fromFile(GetFileInPath("/content/images/MoveTool_ds.png")));
instance->size = Vector2(40,40); instance->size = Vector2(40,40);
instance->position = Vector2(40, 140); instance->position = Vector2(40, 140);
instance->setParent(this); instance->setParent(this);
@@ -326,10 +304,10 @@ GuiRootInstance::GuiRootInstance() : _message(""), _messageTime(0)
instance->setButtonListener(msl); instance->setButtonListener(msl);
instance = makeImageButton( instance = makeImageButton(
Texture::fromFile(&GetFileInPath("/content/images/SelectionRotate.png")), Texture::fromFile(GetFileInPath("/content/images/SelectionRotate.png")),
Texture::fromFile(&GetFileInPath("/content/images/SelectionRotate_ovr.png")), Texture::fromFile(GetFileInPath("/content/images/SelectionRotate_ovr.png")),
NULL, NULL,
Texture::fromFile(&GetFileInPath("/content/images/SelectionRotate_ds.png"))); Texture::fromFile(GetFileInPath("/content/images/SelectionRotate_ds.png")));
instance->size = Vector2(30,30); instance->size = Vector2(30,30);
instance->position = Vector2(10, 175); instance->position = Vector2(10, 175);
instance->setParent(this); instance->setParent(this);
@@ -337,10 +315,10 @@ GuiRootInstance::GuiRootInstance() : _message(""), _messageTime(0)
instance->setButtonListener(rbl); instance->setButtonListener(rbl);
instance = makeImageButton( instance = makeImageButton(
Texture::fromFile(&GetFileInPath("/content/images/SelectionTilt.png")), Texture::fromFile(GetFileInPath("/content/images/SelectionTilt.png")),
Texture::fromFile(&GetFileInPath("/content/images/SelectionTilt_ovr.png")), Texture::fromFile(GetFileInPath("/content/images/SelectionTilt_ovr.png")),
NULL, NULL,
Texture::fromFile(&GetFileInPath("/content/images/SelectionTilt_ds.png"))); Texture::fromFile(GetFileInPath("/content/images/SelectionTilt_ds.png")));
instance->size = Vector2(30,30); instance->size = Vector2(30,30);
instance->position = Vector2(40, 175); instance->position = Vector2(40, 175);
instance->setParent(this); instance->setParent(this);
@@ -349,10 +327,10 @@ GuiRootInstance::GuiRootInstance() : _message(""), _messageTime(0)
instance = makeImageButton( instance = makeImageButton(
Texture::fromFile(&GetFileInPath("/content/images/Delete.png")), Texture::fromFile(GetFileInPath("/content/images/Delete.png")),
Texture::fromFile(&GetFileInPath("/content/images/Delete_ovr.png")), Texture::fromFile(GetFileInPath("/content/images/Delete_ovr.png")),
Texture::fromFile(&GetFileInPath("/content/images/Delete_dn.png")), Texture::fromFile(GetFileInPath("/content/images/Delete_dn.png")),
Texture::fromFile(&GetFileInPath("/content/images/Delete_ds.png"))); Texture::fromFile(GetFileInPath("/content/images/Delete_ds.png")));
instance->size = Vector2(40,46); instance->size = Vector2(40,46);
instance->position = Vector2(20, 284); instance->position = Vector2(20, 284);
instance->setParent(this); instance->setParent(this);
@@ -360,9 +338,9 @@ GuiRootInstance::GuiRootInstance() : _message(""), _messageTime(0)
instance->setButtonListener(delet); instance->setButtonListener(delet);
instance = makeImageButton( instance = makeImageButton(
Texture::fromFile(&GetFileInPath("/content/images/CameraZoomIn.png")), Texture::fromFile(GetFileInPath("/content/images/CameraZoomIn.png")),
Texture::fromFile(&GetFileInPath("/content/images/CameraZoomIn_ovr.png")), Texture::fromFile(GetFileInPath("/content/images/CameraZoomIn_ovr.png")),
Texture::fromFile(&GetFileInPath("/content/images/CameraZoomIn_dn.png"))); Texture::fromFile(GetFileInPath("/content/images/CameraZoomIn_dn.png")));
instance->size = Vector2(34,25); instance->size = Vector2(34,25);
instance->floatBottom = true; instance->floatBottom = true;
instance->floatRight = true; instance->floatRight = true;
@@ -372,9 +350,9 @@ GuiRootInstance::GuiRootInstance() : _message(""), _messageTime(0)
instance->setButtonListener(cam); instance->setButtonListener(cam);
instance = makeImageButton( instance = makeImageButton(
Texture::fromFile(&GetFileInPath("/content/images/CameraZoomOut.png")), Texture::fromFile(GetFileInPath("/content/images/CameraZoomOut.png")),
Texture::fromFile(&GetFileInPath("/content/images/CameraZoomOut_ovr.png")), Texture::fromFile(GetFileInPath("/content/images/CameraZoomOut_ovr.png")),
Texture::fromFile(&GetFileInPath("/content/images/CameraZoomOut_dn.png"))); Texture::fromFile(GetFileInPath("/content/images/CameraZoomOut_dn.png")));
instance->size = Vector2(34,26); instance->size = Vector2(34,26);
instance->floatBottom = true; instance->floatBottom = true;
instance->floatRight = true; instance->floatRight = true;
@@ -384,9 +362,9 @@ GuiRootInstance::GuiRootInstance() : _message(""), _messageTime(0)
instance->setButtonListener(cam); instance->setButtonListener(cam);
instance = makeImageButton( instance = makeImageButton(
Texture::fromFile(&GetFileInPath("/content/images/CameraPanLeft.png")), Texture::fromFile(GetFileInPath("/content/images/CameraPanLeft.png")),
Texture::fromFile(&GetFileInPath("/content/images/CameraPanLeft_ovr.png")), Texture::fromFile(GetFileInPath("/content/images/CameraPanLeft_ovr.png")),
Texture::fromFile(&GetFileInPath("/content/images/CameraPanLeft_dn.png"))); Texture::fromFile(GetFileInPath("/content/images/CameraPanLeft_dn.png")));
instance->size = Vector2(34,34); instance->size = Vector2(34,34);
instance->floatBottom = true; instance->floatBottom = true;
instance->floatRight = true; instance->floatRight = true;
@@ -396,9 +374,9 @@ GuiRootInstance::GuiRootInstance() : _message(""), _messageTime(0)
instance->setButtonListener(cam); instance->setButtonListener(cam);
instance = makeImageButton( instance = makeImageButton(
Texture::fromFile(&GetFileInPath("/content/images/CameraPanRight.png")), Texture::fromFile(GetFileInPath("/content/images/CameraPanRight.png")),
Texture::fromFile(&GetFileInPath("/content/images/CameraPanRight_ovr.png")), Texture::fromFile(GetFileInPath("/content/images/CameraPanRight_ovr.png")),
Texture::fromFile(&GetFileInPath("/content/images/CameraPanRight_dn.png"))); Texture::fromFile(GetFileInPath("/content/images/CameraPanRight_dn.png")));
instance->size = Vector2(34,34); instance->size = Vector2(34,34);
instance->floatBottom = true; instance->floatBottom = true;
instance->floatRight = true; instance->floatRight = true;
@@ -408,9 +386,9 @@ GuiRootInstance::GuiRootInstance() : _message(""), _messageTime(0)
instance->setButtonListener(cam); instance->setButtonListener(cam);
instance = makeImageButton( instance = makeImageButton(
Texture::fromFile(&GetFileInPath("/content/images/CameraCenter.png")), Texture::fromFile(GetFileInPath("/content/images/CameraCenter.png")),
Texture::fromFile(&GetFileInPath("/content/images/CameraCenter_ovr.png")), Texture::fromFile(GetFileInPath("/content/images/CameraCenter_ovr.png")),
Texture::fromFile(&GetFileInPath("/content/images/CameraCenter_dn.png"))); Texture::fromFile(GetFileInPath("/content/images/CameraCenter_dn.png")));
instance->size = Vector2(34,20); instance->size = Vector2(34,20);
instance->floatBottom = true; instance->floatBottom = true;
instance->floatRight = true; instance->floatRight = true;
@@ -420,9 +398,9 @@ GuiRootInstance::GuiRootInstance() : _message(""), _messageTime(0)
instance->setButtonListener(cam); instance->setButtonListener(cam);
instance = makeImageButton( instance = makeImageButton(
Texture::fromFile(&GetFileInPath("/content/images/CameraTiltUp.png")), Texture::fromFile(GetFileInPath("/content/images/CameraTiltUp.png")),
Texture::fromFile(&GetFileInPath("/content/images/CameraTiltUp_ovr.png")), Texture::fromFile(GetFileInPath("/content/images/CameraTiltUp_ovr.png")),
Texture::fromFile(&GetFileInPath("/content/images/CameraTiltUp_dn.png"))); Texture::fromFile(GetFileInPath("/content/images/CameraTiltUp_dn.png")));
instance->size = Vector2(24,24); instance->size = Vector2(24,24);
instance->floatBottom = true; instance->floatBottom = true;
instance->floatRight = true; instance->floatRight = true;
@@ -432,9 +410,9 @@ GuiRootInstance::GuiRootInstance() : _message(""), _messageTime(0)
instance->setButtonListener(cam); instance->setButtonListener(cam);
instance = makeImageButton( instance = makeImageButton(
Texture::fromFile(&GetFileInPath("/content/images/CameraTiltDown.png")), Texture::fromFile(GetFileInPath("/content/images/CameraTiltDown.png")),
Texture::fromFile(&GetFileInPath("/content/images/CameraTiltDown_ovr.png")), Texture::fromFile(GetFileInPath("/content/images/CameraTiltDown_ovr.png")),
Texture::fromFile(&GetFileInPath("/content/images/CameraTiltDown_dn.png"))); Texture::fromFile(GetFileInPath("/content/images/CameraTiltDown_dn.png")));
instance->size = Vector2(24,24); instance->size = Vector2(24,24);
instance->floatBottom = true; instance->floatBottom = true;
instance->floatRight = true; instance->floatRight = true;
@@ -487,7 +465,7 @@ void GuiRootInstance::renderGUI(G3D::RenderDevice* rd, double fps)
//Tools menu //Tools menu
Draw::box(G3D::Box(Vector3(5, 210,0),Vector3(75, 210,0)),rd,Color4(0.6F,0.6F,0.6F,0.4F), Color4(0.6F,0.6F,0.6F,0.4F)); Draw::box(G3D::Box(Vector3(5, 210,0),Vector3(75, 210,0)),rd,Color4(0.6F,0.6F,0.6F,0.4F), Color4(0.6F,0.6F,0.6F,0.4F));
g_fntlighttrek->draw2D(rd,"MENU", Vector2(10,332), 14, Color3::white(), Color4(0.5F,0.5F,0.5F,0.5F));
//drawButtons(rd); //drawButtons(rd);
@@ -524,9 +502,6 @@ void GuiRootInstance::update()
Instance * obj3 = this->findFirstChild("UnGroup"); Instance * obj3 = this->findFirstChild("UnGroup");
Instance * obj4 = this->findFirstChild("Rotate"); Instance * obj4 = this->findFirstChild("Rotate");
Instance * obj5 = this->findFirstChild("Tilt"); Instance * obj5 = this->findFirstChild("Tilt");
SelectionService* getSelectionService = g_dataModel->getSelectionService();
if(obj != NULL && obj2 != NULL && obj3 != NULL && obj4 !=NULL && obj5 != NULL && obj6 != NULL) if(obj != NULL && obj2 != NULL && obj3 != NULL && obj4 !=NULL && obj5 != NULL && obj6 != NULL)
{ {
BaseButtonInstance* button = (BaseButtonInstance*)obj; BaseButtonInstance* button = (BaseButtonInstance*)obj;
@@ -541,23 +516,15 @@ void GuiRootInstance::update()
button4->disabled = true; button4->disabled = true;
button5->disabled = true; button5->disabled = true;
button6->disabled = true; button6->disabled = true;
for(size_t i = 0; i < getSelectionService->getSelection().size(); i++) for(size_t i = 0; i < g_dataModel->getSelectionService()->getSelection().size(); i++)
if(getSelectionService->getSelection()[i]->canDelete) if(g_dataModel->getSelectionService()->getSelection()[i]->canDelete)
{ {
button->disabled = false; button->disabled = false;
button2->disabled = false;
button3->disabled = false;
button4->disabled = false; button4->disabled = false;
button5->disabled = false; button5->disabled = false;
button6->disabled = false; button6->disabled = false;
if (getSelectionService->getSelection().size() > 1){
button2->disabled = false;
}
if (dynamic_cast<GroupInstance*>(getSelectionService->getSelection()[i])){
button3->disabled = false;
}
break; break;
} }
} }

View File

@@ -87,6 +87,7 @@ Instance::~Instance(void)
{ {
delete children.at(i); delete children.at(i);
} }
setParent(NULL);
} }
void Instance::setName(std::string newName) void Instance::setName(std::string newName)
@@ -99,6 +100,13 @@ std::string Instance::getClassName()
return className; return className;
} }
bool Instance::isA(std::string name)
{
if (className == name)
return true;
return false;
}
std::vector<Instance* > Instance::getChildren() std::vector<Instance* > Instance::getChildren()
{ {
return children; return children;
@@ -174,5 +182,7 @@ Instance* Instance::findFirstChild(std::string name)
return NULL; return NULL;
} }
void Instance::remove()
{
delete this;
}

View File

@@ -0,0 +1,69 @@
#include "DataModelV2/JointsService.h"
#include "DataModelV2/SnapInstance.h"
#include "StringFunctions.h"
#include "Globals.h"
JointsService::JointsService()
{
name = "JointsService";
className = "JointsService";
canDelete = false;
}
JointsService::~JointsService(void)
{
}
void JointsService::createSnap(PartInstance* Part1, PartInstance* Part2)
{
SnapInstance* Snap = new SnapInstance(Part1, Part2);
Snap->setParent(this);
}
void JointsService::destroyPartSnap(PartInstance* Part)
{
std::vector<Instance* > children = getChildren();
for(size_t i = 0; i < children.size(); i++)
{
SnapInstance* Snap = (SnapInstance*)children.at(i);
if((Snap->jPart1 == Part) || (Snap->jPart2 == Part))
{
Snap->remove();
}
}
}
void JointsService::solvePartSnap(PartInstance* Part1, PartInstance* Part2)
{
XplicitNgine* Phys = g_dataModel->getEngine();
float TopSurface = (Part1->getPosition().y + Part1->getSize().y / 2);
float BottomSurface2 = (Part2->getPosition().y - Part2->getSize().y / 2);
const int N = 4;
if (TopSurface == BottomSurface2)
{
Phys->createBody(Part1);
Phys->createBody(Part2);
dContact contact[N];
int n = dCollide (Part1->physGeom[0],Part2->physGeom[0],N,&contact[0].geom,sizeof(dContact));
if (n > 0)
createSnap(Part1, Part2);
}
}
void JointsService::solveWorkspaceSnaps()
{
std::vector<Instance* > children = g_dataModel->getWorkspace()->getAllChildren();
for(size_t i = 0; i < children.size(); i++)
{
PartInstance* Part1 = (PartInstance*)children.at(i);
if (Part1->isA("Part"))
{
for(size_t c = 0; c < children.size(); c++) //horrible
{
PartInstance* Part2 = (PartInstance*)children.at(c);
if (Part1 != Part2)
solvePartSnap(Part1, Part2);
}
}
}
}

View File

@@ -109,8 +109,8 @@ std::vector<PROPGRIDITEM> LevelInstance::getProperties()
PIT_CHECK PIT_CHECK
)); ));
_snprintf(timerTxt, 12, "%g", timer); sprintf_s(timerTxt, "%g", timer);
_snprintf(scoreTxt, 12, "%d", score); sprintf_s(scoreTxt, "%d", score);
properties.push_back(createPGI("Gameplay", properties.push_back(createPGI("Gameplay",
"InitialTimerValue", "InitialTimerValue",
"The amount of time in seconds the player has to complete this level.\r\n\r\nPut 0 if time is limitless.", "The amount of time in seconds the player has to complete this level.\r\n\r\nPut 0 if time is limitless.",

View File

@@ -398,6 +398,7 @@ void PartInstance::render(RenderDevice* rd) {
PartInstance::~PartInstance(void) PartInstance::~PartInstance(void)
{ {
glDeleteLists(glList, 1); glDeleteLists(glList, 1);
/* /*
// Causes some weird ODE error // Causes some weird ODE error
// Someone, please look into this // Someone, please look into this
@@ -495,14 +496,6 @@ static TCHAR* strSoundType(int option)
return "Swoosh"; return "Swoosh";
case Enum::Sound::Page: case Enum::Sound::Page:
return "Page"; return "Page";
case Enum::Sound::Click:
return "Click";
case Enum::Sound::Clock:
return "Clock";
case Enum::Sound::Step:
return "Step";
case Enum::Sound::StepOn:
return "StepOn";
} }
return "NoSound"; return "NoSound";
} }
@@ -529,14 +522,6 @@ static Enum::Sound::Value EnumOnTouchSoundType(TCHAR* option)
return Enum::Sound::Ping; return Enum::Sound::Ping;
if(strcmp("Snap", option) == 0) if(strcmp("Snap", option) == 0)
return Enum::Sound::Snap; return Enum::Sound::Snap;
if(strcmp("Click", option) == 0)
return Enum::Sound::Click;
if(strcmp("Clock", option) == 0)
return Enum::Sound::Clock;
if(strcmp("Step", option) == 0)
return Enum::Sound::Step;
if(strcmp("StepOn", option) == 0)
return Enum::Sound::StepOn;
return Enum::Sound::NoSound; return Enum::Sound::NoSound;
} }
@@ -601,18 +586,6 @@ void PartInstance::onTouch()
case Enum::Sound::Swoosh: case Enum::Sound::Swoosh:
sndService->playSound(sndService->findFirstChild("Swoosh")); sndService->playSound(sndService->findFirstChild("Swoosh"));
break; break;
case Enum::Sound::Click:
sndService->playSound(sndService->findFirstChild("Click"));
break;
case Enum::Sound::Clock:
sndService->playSound(sndService->findFirstChild("Clock"));
break;
case Enum::Sound::Step:
sndService->playSound(sndService->findFirstChild("Step"));
break;
case Enum::Sound::StepOn:
sndService->playSound(sndService->findFirstChild("StepOn"));
break;
} }
} }
@@ -723,14 +696,14 @@ std::vector<PROPGRIDITEM> PartInstance::getProperties()
(LPARAM)anchored, (LPARAM)anchored,
PIT_CHECK PIT_CHECK
)); ));
_snprintf(pto, 512, "%g, %g, %g", position.x, position.y, position.z); sprintf_s(pto, "%g, %g, %g", position.x, position.y, position.z);
properties.push_back(createPGI("Item", properties.push_back(createPGI("Item",
"Offset", "Offset",
"The position of the object in the workspace", "The position of the object in the workspace",
(LPARAM)pto, (LPARAM)pto,
PIT_EDIT PIT_EDIT
)); ));
_snprintf(pto2, 512, "%g, %g, %g", size.x, size.y, size.z); sprintf_s(pto2, "%g, %g, %g", size.x, size.y, size.z);
properties.push_back(createPGI("Item", properties.push_back(createPGI("Item",
"Size", "Size",
"The size of the object in the workspace", "The size of the object in the workspace",
@@ -756,11 +729,11 @@ std::vector<PROPGRIDITEM> PartInstance::getProperties()
"What sound plays when touched", "What sound plays when touched",
(LPARAM)strSoundType(OnTouchSound), (LPARAM)strSoundType(OnTouchSound),
PIT_COMBO, PIT_COMBO,
TEXT("NoSound\0Victory\0Boing\0Break\0Snap\0Bomb\0Splat\0Page\0Ping\0Swoosh\0Click\0Clock\0Step\0StepOn") TEXT("NoSound\0Victory\0Boing\0Break\0Snap\0Bomb\0Splat\0Page\0Ping\0Swoosh\0")
)); ));
_snprintf(changeScoreTxt, 12, "%d", changeScore); sprintf_s(changeScoreTxt, "%d", changeScore);
_snprintf(changeTimerTxt, 12, "%g", changeTimer); sprintf_s(changeTimerTxt, "%g", changeTimer);
properties.push_back(createPGI("OnTouch", properties.push_back(createPGI("OnTouch",
"ChangeScore", "ChangeScore",
"How the score is affected when touched", "How the score is affected when touched",

View File

@@ -86,17 +86,17 @@ void SelectionService::render(RenderDevice * rd)
void drawOutline(Vector3 from, Vector3 to, RenderDevice* rd, Vector3 size, Vector3 pos, CoordinateFrame c) void drawOutline(Vector3 from, Vector3 to, RenderDevice* rd, Vector3 size, Vector3 pos, CoordinateFrame c)
{ {
Color3 outline = Color3::cyan();//Color3(0.098F,0.6F,1.0F); Color3 outline = Color3::cyan();//Color3(0.098F,0.6F,1.0F);
float offsetSize = 0.1F; float offsetSize = 0.05F;
//X //X
Draw::box(c.toWorldSpace(Box(Vector3(from.x - offsetSize, from.y + offsetSize, from.z + offsetSize), Vector3(to.x + offsetSize, from.y - offsetSize, from.z - offsetSize))), rd, outline, Color4::clear()); Draw::box(c.toWorldSpace(Box(Vector3(from.x - offsetSize, from.y + offsetSize, from.z + offsetSize), Vector3(to.x + offsetSize, from.y - offsetSize, from.z - offsetSize))), rd, outline, Color4::clear());
Draw::box(c.toWorldSpace(Box(Vector3(from.x - offsetSize, to.y + offsetSize, from.z + offsetSize), Vector3(to.x + offsetSize, to.y - offsetSize, from.z - offsetSize))), rd, outline, Color4::clear()); Draw::box(c.toWorldSpace(Box(Vector3(from.x - offsetSize, to.y + offsetSize, from.z + offsetSize), Vector3(to.x + offsetSize, to.y - offsetSize, from.z - offsetSize))), rd, outline, Color4::clear());
Draw::box(c.toWorldSpace(Box(Vector3(from.x - offsetSize, to.y + offsetSize, to.z + offsetSize), Vector3(to.x + offsetSize, to.y - offsetSize, to.z - offsetSize))), rd, outline, Color4::clear()); Draw::box(c.toWorldSpace(Box(Vector3(from.x - offsetSize, to.y + offsetSize, to.z + offsetSize), Vector3(to.x + offsetSize, to.y - offsetSize, to.z - offsetSize))), rd, outline, Color4::clear());
Draw::box(c.toWorldSpace(Box(Vector3(from.x - offsetSize, from.y + offsetSize, to.z + offsetSize), Vector3(to.x + offsetSize, from.y - offsetSize, to.z - offsetSize))), rd, outline, Color4::clear()); Draw::box(c.toWorldSpace(Box(Vector3(from.x - offsetSize, from.y + offsetSize, to.z + offsetSize), Vector3(to.x + offsetSize, from.y - offsetSize, to.z - offsetSize))), rd, outline, Color4::clear());
//Y //Y
Draw::box(c.toWorldSpace(Box(Vector3(from.x + offsetSize, from.y - offsetSize + 0.2, from.z + offsetSize), Vector3(from.x - offsetSize, to.y + offsetSize - 0.2, from.z - offsetSize))), rd, outline, Color4::clear()); Draw::box(c.toWorldSpace(Box(Vector3(from.x + offsetSize, from.y - offsetSize + 0.1, from.z + offsetSize), Vector3(from.x - offsetSize, to.y + offsetSize - 0.1, from.z - offsetSize))), rd, outline, Color4::clear());
Draw::box(c.toWorldSpace(Box(Vector3(to.x + offsetSize, from.y - offsetSize + 0.2, from.z + offsetSize), Vector3(to.x - offsetSize, to.y + offsetSize - 0.2, from.z - offsetSize))), rd, outline, Color4::clear()); Draw::box(c.toWorldSpace(Box(Vector3(to.x + offsetSize, from.y - offsetSize + 0.1, from.z + offsetSize), Vector3(to.x - offsetSize, to.y + offsetSize - 0.1, from.z - offsetSize))), rd, outline, Color4::clear());
Draw::box(c.toWorldSpace(Box(Vector3(to.x + offsetSize, from.y - offsetSize + 0.2, to.z + offsetSize), Vector3(to.x - offsetSize, to.y + offsetSize-0.1, to.z - offsetSize))), rd, outline, Color4::clear()); Draw::box(c.toWorldSpace(Box(Vector3(to.x + offsetSize, from.y - offsetSize + 0.1, to.z + offsetSize), Vector3(to.x - offsetSize, to.y + offsetSize-0.1, to.z - offsetSize))), rd, outline, Color4::clear());
Draw::box(c.toWorldSpace(Box(Vector3(from.x + offsetSize, from.y - offsetSize + 0.2, to.z + offsetSize), Vector3(from.x - offsetSize, to.y + offsetSize - 0.2, to.z - offsetSize))), rd, outline, Color4::clear()); Draw::box(c.toWorldSpace(Box(Vector3(from.x + offsetSize, from.y - offsetSize + 0.1, to.z + offsetSize), Vector3(from.x - offsetSize, to.y + offsetSize - 0.1, to.z - offsetSize))), rd, outline, Color4::clear());
//Z //Z
Draw::box(c.toWorldSpace(Box(Vector3(from.x + offsetSize, from.y + offsetSize, from.z - offsetSize), Vector3(from.x - offsetSize, from.y - offsetSize, to.z + offsetSize))), rd, outline, Color4::clear()); Draw::box(c.toWorldSpace(Box(Vector3(from.x + offsetSize, from.y + offsetSize, from.z - offsetSize), Vector3(from.x - offsetSize, from.y - offsetSize, to.z + offsetSize))), rd, outline, Color4::clear());

View File

@@ -0,0 +1,29 @@
#include "DataModelV2/SnapInstance.h"
#include "XplicitNgine/XplicitNgine.h"
#include "StringFunctions.h"
#include "Globals.h"
SnapInstance::SnapInstance(PartInstance* Part1, PartInstance* Part2)
{
XplicitNgine* Phys = g_xplicitNgine;
name = "Snap";
className = "Snap";
jPart1 = Part1;
jPart2 = Part2;
if (Part1->physBody == NULL)
Phys->createBody(Part1);
if (Part2->physBody == NULL)
Phys->createBody(Part2);
JointID = Phys->createJoint(Part1, Part2);
}
SnapInstance::~SnapInstance(void)
{
//XplicitNgine* Phys = g_xplicitNgine;
printf("SnapInstance destroyed...");
if (JointID != NULL)
dJointDestroy(JointID);
}

View File

@@ -67,30 +67,6 @@ SoundService::SoundService()
stockSound->setName("Page"); stockSound->setName("Page");
stockSound->setSoundId("/content/sounds/pageturn.wav"); stockSound->setSoundId("/content/sounds/pageturn.wav");
stockSound->setParent(this); stockSound->setParent(this);
// Click
stockSound = new SoundInstance();
stockSound->setName("Click");
stockSound->setSoundId("/content/sounds/switch.wav");
stockSound->setParent(this);
// Clock
stockSound = new SoundInstance();
stockSound->setName("Clock");
stockSound->setSoundId("/content/sounds/clickfast.wav");
stockSound->setParent(this);
// Step
stockSound = new SoundInstance();
stockSound->setName("Step");
stockSound->setSoundId("/content/sounds/SWITCH3.wav");
stockSound->setParent(this);
// StepOn
stockSound = new SoundInstance();
stockSound->setName("StepOn");
stockSound->setSoundId("/content/sounds/flashbulb.wav");
stockSound->setParent(this);
} }
SoundService::~SoundService(void) SoundService::~SoundService(void)

View File

@@ -1,5 +1,5 @@
#include "DataModelV2/TextButtonInstance.h" #include "DataModelV2/TextButtonInstance.h"
#include "DataModelV2/BaseGuiInstance.h"
TextButtonInstance::TextButtonInstance(void) TextButtonInstance::TextButtonInstance(void)
{ {
@@ -11,7 +11,7 @@ TextButtonInstance::TextButtonInstance(void)
title = "TextBox"; title = "TextBox";
textColor = Color4(1, 1, 1, 1); textColor = Color4(1, 1, 1, 1);
textOutlineColor = Color4(0, 0, 0, 0); textOutlineColor = Color4(0, 0, 0, 0);
boxColor = BaseGuiInstance::translucentBackdrop(); boxColor = Color4(0.6F,0.6F,0.6F,0.4F);
boxOutlineColor = Color4(0, 0, 0, 0); boxOutlineColor = Color4(0, 0, 0, 0);
setAllColorsSame(); setAllColorsSame();
textSize = 12; textSize = 12;

View File

@@ -1,88 +1,75 @@
#include <G3DAll.h> #include <G3DAll.h>
#include "Application.h" #include "Application.h"
#include "Globals.h" #include "Globals.h"
#include "AudioPlayer.h"
#include "DataModelV2/SelectionService.h" #include "DataModelV2/SelectionService.h"
#include "Listener/GUDButtonListener.h" #include "Listener/GUDButtonListener.h"
#include "DataModelV2/SoundService.h"
void GUDButtonListener::onButton1MouseClick(BaseButtonInstance* button) void GUDButtonListener::onButton1MouseClick(BaseButtonInstance* button)
{ {
SelectionService* selectionService = g_dataModel->getSelectionService();
SoundService* soundService = g_dataModel->getSoundService();
bool cont = false; bool cont = false;
for(size_t i = 0; i < selectionService->getSelection().size(); i++) for(size_t i = 0; i < g_dataModel->getSelectionService()->getSelection().size(); i++)
if(selectionService->getSelection()[i]->canDelete) if(g_dataModel->getSelectionService()->getSelection()[i]->canDelete)
{ {
cont = true; cont = true;
break; break;
} }
if(cont)
if (cont)
{ {
if(button->disabled == false){ AudioPlayer::playSound(dingSound);
soundService->playSound(soundService->findFirstChild("Ping"));
}
if(button->name == "Duplicate") if(button->name == "Duplicate")
{ {
std::vector<Instance*> newinst; std::vector<Instance*> newinst;
for(size_t i = 0; i < selectionService->getSelection().size(); i++) for(size_t i = 0; i < g_dataModel->getSelectionService()->getSelection().size(); i++)
{ {
if(selectionService->getSelection()[i]->canDelete) if(g_dataModel->getSelectionService()->getSelection()[i]->canDelete)
{ {
Instance* tempinst = selectionService->getSelection()[i]; Instance* tempinst = g_dataModel->getSelectionService()->getSelection()[i];
Instance* clonedInstance = selectionService->getSelection()[i]->clone(); Instance* clonedInstance = g_dataModel->getSelectionService()->getSelection()[i]->clone();
if (clonedInstance->getClassName() == "PVInstance"){ newinst.push_back(tempinst);
PartInstance* Part = dynamic_cast<PartInstance*>(clonedInstance);
Part->setPosition(Part->getPosition() + G3D::Vector3(0, Part->getSize().y, 0));
}
newinst.push_back(clonedInstance);
} }
} }
selectionService->clearSelection(); g_dataModel->getSelectionService()->clearSelection();
selectionService->addSelected(newinst); g_dataModel->getSelectionService()->addSelected(newinst);
} }
else if(button->name == "Group") else if(button->name == "Group")
{ {
if (selectionService->getSelection().size() > 1){ GroupInstance * inst = new GroupInstance();
GroupInstance * inst = new GroupInstance(); inst->setParent(g_dataModel->getWorkspace());
inst->setParent(g_dataModel->getWorkspace()); for(size_t i = 0; i < g_dataModel->getSelectionService()->getSelection().size(); i++)
for(size_t i = 0; i < selectionService->getSelection().size(); i++) {
if(g_dataModel->getSelectionService()->getSelection()[i]->canDelete)
{ {
if(selectionService->getSelection()[i]->canDelete) g_dataModel->getSelectionService()->getSelection()[i]->setParent(inst);
if(PartInstance* part = dynamic_cast<PartInstance*>(g_dataModel->getSelectionService()->getSelection()[i]))
{ {
selectionService->getSelection()[i]->setParent(inst); inst->primaryPart = part;
if(PartInstance* part = dynamic_cast<PartInstance*>(selectionService->getSelection()[i]))
{
inst->primaryPart = part;
}
} }
} }
selectionService->clearSelection();
selectionService->addSelected(inst);
} }
g_dataModel->getSelectionService()->clearSelection();
g_dataModel->getSelectionService()->addSelected(inst);
} }
else if(button->name == "UnGroup") else if(button->name == "UnGroup")
{ {
std::vector<Instance*> newinst; std::vector<Instance*> newinst;
for(size_t i = 0; i < selectionService->getSelection().size(); i++) for(size_t i = 0; i < g_dataModel->getSelectionService()->getSelection().size(); i++)
{ {
Instance* selection = selectionService->getSelection()[i]; if(g_dataModel->getSelectionService()->getSelection()[i]->canDelete)
if(GroupInstance* model = dynamic_cast<GroupInstance*>(selection))
{ {
newinst = model->unGroup(); if(GroupInstance* model = dynamic_cast<GroupInstance*>(g_dataModel->getSelectionService()->getSelection()[i]))
model->setParent(NULL); {
delete model; newinst = model->unGroup();
model = NULL; model->setParent(NULL);
delete model;
model = NULL;
}
} }
} }
selectionService->clearSelection(); g_dataModel->getSelectionService()->clearSelection();
selectionService->addSelected(newinst); g_dataModel->getSelectionService()->addSelected(newinst);
} }
} }
} }

View File

@@ -2,9 +2,6 @@
#include "DataModelV2/ToggleImageButtonInstance.h" #include "DataModelV2/ToggleImageButtonInstance.h"
#include "Application.h" #include "Application.h"
#include "Globals.h" #include "Globals.h"
bool menuOpen = false;
void MenuButtonListener::onButton1MouseClick(BaseButtonInstance* button) void MenuButtonListener::onButton1MouseClick(BaseButtonInstance* button)
{ {
if(button->name == "go") if(button->name == "go")
@@ -52,36 +49,4 @@ void MenuButtonListener::onButton1MouseClick(BaseButtonInstance* button)
break; break;
} }
} }
else if (button->name == "insert"){
HMENU mainmenu = CreatePopupMenu();
AppendMenu(mainmenu, MF_STRING, 104, "Model...");
POINT p;
GetCursorPos(&p);
int menuClick = TrackPopupMenu(mainmenu, TPM_LEFTBUTTON | TPM_RETURNCMD, p.x, p.y, 0, Globals::mainHwnd, 0);
switch (menuClick)
{
case 104:
g_dataModel->getOpenModel();
break;
}
}
else if (button->name == "MENU")
{
menuOpen = !menuOpen;
ShowWindow(g_usableApp->_propWindow->_hwndProp, menuOpen);
if(TextButtonInstance* textButton = dynamic_cast<TextButtonInstance*>(button))
{
if(menuOpen)
{
textButton->textColor = Color3(0,1,1);
textButton->textColorOvr = Color3(0,1,1);
}
else
{
textButton->textColor = Color3::white();
textButton->textColorOvr = Color3::white();
}
}
}
} }

View File

@@ -0,0 +1,5 @@
//#include "Properties/BoolProperty.h"
//PROPGRIDITEM BoolProperty::getPropGridItem()
//{
//return PROPGRIDITEM();
//}

View File

@@ -0,0 +1,7 @@
#include "Properties/Property.h"
template <typename T>
void Property<T>::setProperty(LPPROPGRIDITEM item)
{
_owner->propertiesChanged();
}

View File

@@ -244,7 +244,7 @@ bool PropertyWindow::onCreate(int x, int y, int sx, int sy, HMODULE hThisInstanc
WS_EX_TOOLWINDOW, WS_EX_TOOLWINDOW,
"propHWND", "propHWND",
"PropertyGrid", "PropertyGrid",
WS_POPUPWINDOW | WS_THICKFRAME | WS_CAPTION, WS_VISIBLE | WS_POPUPWINDOW | WS_THICKFRAME | WS_CAPTION,
CW_USEDEFAULT, CW_USEDEFAULT,
CW_USEDEFAULT, CW_USEDEFAULT,
300, 300,

View File

@@ -33,82 +33,7 @@ void DraggerTool::onMouseMoved(Mouse mouse)
{ {
if(handleGrabbed != -1) if(handleGrabbed != -1)
{ {
std::vector<Instance *> selection = g_dataModel->getSelectionService()->getSelection();
if(selection.size() == 1)
{
PartInstance* part = dynamic_cast<PartInstance*>(selection[0]);
if(part)
{
Ray ray = G3D::Ray::fromOriginAndDirection(part->getPosition(), part->getCFrame().lookVector()*100);
switch(handleGrabbed){
case 0:
case 1:
ray = G3D::Ray::fromOriginAndDirection(part->getPosition(), part->getCFrame().upVector()*100);
break;
case 2:
case 3:
ray = G3D::Ray::fromOriginAndDirection(part->getPosition(), part->getCFrame().lookVector()*100);
break;
case 4:
case 5:
ray = G3D::Ray::fromOriginAndDirection(part->getPosition(), part->getCFrame().leftVector()*100);
break;
}
CenterOffset = handles[handleGrabbed].center;
Vector3 intersection1 = ray.intersection(mouse.getPlane());
Vector3 intersection2 = ray.intersection(mouse.getInversePlane());
if(intersection1.isFinite())
{
intersection1.x = (ceil(intersection1.x / 1) * 1);
intersection1.y = (ceil(intersection1.y / 1) * 1);
intersection1.z = (ceil(intersection1.z / 1) * 1);
if ( ((int)part->getSize().x)%2 == 1 )
intersection1.x += 0.5;
//intersection1.y = mouse.getPlane() + part->getSize().y/2 - 0.5;
if ( ((int)part->getSize().z)%2 == 1 )
intersection1.z += 0.5;
part->setPosition(intersection1 + (part->getPosition() - CenterOffset));
}
else if(intersection2.isFinite())
{
intersection2.x = (ceil(intersection2.x / 1) * 1);
intersection2.y = (ceil(intersection2.y / 1) * 1);
intersection2.z = (ceil(intersection2.z / 1) * 1);
if ( ((int)part->getSize().x)%2 == 1)
intersection2.x += 0.5;
//intersection2.y = mouse.getInversePlane() + part->getSize().y/2 - 0.5;
part->setPosition(intersection2 + (part->getPosition() - CenterOffset));
}
float offset = 2;
center = part->getPosition();
Vector3 size = part->getSize();
CoordinateFrame cFrame = part->getCFrame();
handles[0].center = center + cFrame.upVector()*(size.y/2+offset);
handles[1].center = center - cFrame.upVector()*(size.y/2+offset);
handles[2].center = center + cFrame.lookVector()*(size.z/2+offset);
handles[3].center = center - cFrame.lookVector()*(size.z/2+offset);
handles[4].center = center + cFrame.leftVector()*(size.x/2+offset);
handles[5].center = center - cFrame.leftVector()*(size.x/2+offset);
}
}
} }
else ArrowTool::onMouseMoved(mouse); else ArrowTool::onMouseMoved(mouse);
} }
@@ -187,23 +112,22 @@ void DraggerTool::render(RenderDevice * rd, Mouse mouse)
G3D::Draw::arrow(center, handles[i].center-center, rd, Color3::orange(), 2); G3D::Draw::arrow(center, handles[i].center-center, rd, Color3::orange(), 2);
} }
} }
std::vector<Instance *> selection = g_dataModel->getSelectionService()->getSelection(); std::vector<Instance *> selection = g_dataModel->getSelectionService()->getSelection();
for(size_t i = 0; i < selection.size(); i++) for(size_t i = 0; i < selection.size(); i++)
{ {
if(PartInstance* part = dynamic_cast<PartInstance*>(selection[i])) if(PartInstance* part = dynamic_cast<PartInstance*>(selection[i]))
{ {
//Ray ray = G3D::Ray::fromOriginAndDirection(part->getPosition(), part->getCFrame().lookVector()*100); Ray ray = G3D::Ray::fromOriginAndDirection(part->getPosition(), part->getCFrame().lookVector()*100);
//Vector3 intersection1 = ray.intersection(mouse.getPlane()); Vector3 intersection1 = ray.intersection(mouse.getPlane());
//Vector3 intersection2 = ray.intersection(mouse.getInversePlane()); Vector3 intersection2 = ray.intersection(mouse.getInversePlane());
//if(intersection1.isFinite()) if(intersection1.isFinite())
//{ {
// Draw::sphere(Sphere(intersection1, 2), rd); Draw::sphere(Sphere(intersection1, 2), rd);
//} }
//else if(intersection2.isFinite()) else if(intersection2.isFinite())
//{ {
// Draw::sphere(Sphere(intersection2, 2), rd); Draw::sphere(Sphere(intersection2, 2), rd);
//} }
} }
} }
} }

View File

@@ -1,9 +1,9 @@
#include "XplicitNgine/XplicitNgine.h" #include "XplicitNgine/XplicitNgine.h"
#include "DataModelV2/JointsService.h"
#include "Globals.h" #include "Globals.h"
XplicitNgine::XplicitNgine() XplicitNgine::XplicitNgine()
{ {
physWorld = dWorldCreate(); physWorld = dWorldCreate();
physSpace = dHashSpaceCreate(0); physSpace = dHashSpaceCreate(0);
contactgroup = dJointGroupCreate(0); contactgroup = dJointGroupCreate(0);
@@ -19,10 +19,11 @@ XplicitNgine::XplicitNgine()
XplicitNgine::~XplicitNgine() XplicitNgine::~XplicitNgine()
{ {
dJointGroupDestroy (contactgroup); g_dataModel->getJointsService()->remove();
dSpaceDestroy (physSpace); dJointGroupDestroy (contactgroup);
dWorldDestroy (physWorld); dSpaceDestroy (physSpace);
dCloseODE(); dWorldDestroy (physWorld);
dCloseODE();
} }
void XplicitNgine::resetBody(PartInstance* partInstance) void XplicitNgine::resetBody(PartInstance* partInstance)
@@ -51,12 +52,12 @@ void collisionCallback(void *data, dGeomID o1, dGeomID o2)
contact[i].surface.mode = dContactBounce | dContactSlip1 | dContactSlip2 | dContactSoftERP | dContactSoftCFM | dContactApprox1; contact[i].surface.mode = dContactBounce | dContactSlip1 | dContactSlip2 | dContactSoftERP | dContactSoftCFM | dContactApprox1;
// Define contact surface properties // Define contact surface properties
contact[i].surface.bounce = 0.5F; //Elasticity contact[i].surface.bounce = 0.5; //Elasticity
contact[i].surface.mu = 0.4F; //Friction contact[i].surface.mu = 0.4F; //Friction
contact[i].surface.slip1 = 0.0; contact[i].surface.slip1 = 0.0;
contact[i].surface.slip2 = 0.0; contact[i].surface.slip2 = 0.0;
contact[i].surface.soft_erp = 0.8F; contact[i].surface.soft_erp = 0.8F;
contact[i].surface.soft_cfm = 0.005F; contact[i].surface.soft_cfm = 0.01F;
// Create joints // Create joints
dJointID c = dJointCreateContact( dJointID c = dJointCreateContact(
@@ -81,6 +82,7 @@ void collisionCallback(void *data, dGeomID o1, dGeomID o2)
void XplicitNgine::deleteBody(PartInstance* partInstance) void XplicitNgine::deleteBody(PartInstance* partInstance)
{ {
g_dataModel->getJointsService()->destroyPartSnap(partInstance);
if(partInstance->physBody != NULL) if(partInstance->physBody != NULL)
{ {
dBodyEnable(partInstance->physBody); dBodyEnable(partInstance->physBody);
@@ -156,7 +158,8 @@ void XplicitNgine::createBody(PartInstance* partInstance)
dGeomSetData(partInstance->physGeom[0], partInstance); dGeomSetData(partInstance->physGeom[0], partInstance);
dMass mass; dMass mass;
mass.setBox(sqrt(partSize.x*2), sqrt(partSize.y*2), sqrt(partSize.z*2), 0.7F); mass.setBox(sqrt(partSize.x*20), sqrt(partSize.y*20), sqrt(partSize.z*20), 0.01F);
//mass.setBox(sqrt(partSize.x*2), sqrt(partSize.y*2), sqrt(partSize.z*2), 0.7F);
dBodySetMass(partInstance->physBody, &mass); dBodySetMass(partInstance->physBody, &mass);
// Create rigid body // Create rigid body
@@ -234,3 +237,23 @@ void XplicitNgine::updateBody(PartInstance *partInstance)
dBodySetRotation(partInstance->physBody, rotation); dBodySetRotation(partInstance->physBody, rotation);
} }
} }
dJointID XplicitNgine::createJoint(PartInstance *part1, PartInstance *part2)
{
printf("XplicitNgine::createJoint called\n");
if((part1->physBody != NULL) & (part2->physBody != NULL)){
printf("creating a fixed joint\n");
dJointID c = dJointCreateFixed(physWorld, 0);
dJointAttach(c, part1->physBody, part2->physBody);
dJointSetFixed(c);
return c;
}
return NULL;
}
void XplicitNgine::destroyJoints(PartInstance *part)
{
for(int i = 0; i < dBodyGetNumJoints(part->physBody); i++)
dJointDestroy(dBodyGetJoint(part->physBody, i));
}

View File

@@ -142,12 +142,6 @@ LRESULT CALLBACK G3DProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
int main(int argc, char** argv) { 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 #ifndef _DEBUG
try{ try{
#endif #endif
@@ -164,6 +158,7 @@ int WINAPI WinMain(HINSTANCE hThisInstance, HINSTANCE hPrevInstance, LPSTR lpCmd
icc.dwICC = ICC_WIN95_CLASSES/*|ICC_COOL_CLASSES|ICC_DATE_CLASSES| icc.dwICC = ICC_WIN95_CLASSES/*|ICC_COOL_CLASSES|ICC_DATE_CLASSES|
ICC_PAGESCROLLER_CLASS|ICC_USEREX_CLASSES*/; ICC_PAGESCROLLER_CLASS|ICC_USEREX_CLASSES*/;
InitCommonControlsEx(&icc); InitCommonControlsEx(&icc);
HMODULE hThisInstance = GetModuleHandle(NULL);
if (!createWindowClass("mainHWND",WndProc,hThisInstance)) if (!createWindowClass("mainHWND",WndProc,hThisInstance))
return false; return false;