First running version for Windows 10

This commit is contained in:
Vladislav Khorev 2018-09-14 20:42:44 +05:00
parent 1ae34ae340
commit 49635589ee
33 changed files with 1342 additions and 190 deletions

332
.gitignore vendored Executable file
View File

@ -0,0 +1,332 @@
## Ignore Visual Studio temporary files, build results, and
## files generated by popular Visual Studio add-ons.
##
## Get latest from https://github.com/github/gitignore/blob/master/VisualStudio.gitignore
# User-specific files
*.suo
*.user
*.userosscache
*.sln.docstates
# User-specific files (MonoDevelop/Xamarin Studio)
*.userprefs
# Build results
[Dd]ebug/
[Dd]ebugPublic/
[Rr]elease/
[Rr]eleases/
x64/
x86/
bld/
[Bb]in/
[Oo]bj/
[Ll]og/
# Visual Studio 2015/2017 cache/options directory
.vs/
# Uncomment if you have tasks that create the project's static files in wwwroot
#wwwroot/
# Visual Studio 2017 auto generated files
Generated\ Files/
# MSTest test Results
[Tt]est[Rr]esult*/
[Bb]uild[Ll]og.*
# NUNIT
*.VisualState.xml
TestResult.xml
# Build Results of an ATL Project
[Dd]ebugPS/
[Rr]eleasePS/
dlldata.c
# Benchmark Results
BenchmarkDotNet.Artifacts/
# .NET Core
project.lock.json
project.fragment.lock.json
artifacts/
# StyleCop
StyleCopReport.xml
# Files built by Visual Studio
*_i.c
*_p.c
*_h.h
*.ilk
*.meta
*.obj
*.iobj
*.pch
*.pdb
*.ipdb
*.pgc
*.pgd
*.rsp
*.sbr
*.tlb
*.tli
*.tlh
*.tmp
*.tmp_proj
*.log
*.vspscc
*.vssscc
.builds
*.pidb
*.svclog
*.scc
# Chutzpah Test files
_Chutzpah*
# Visual C++ cache files
ipch/
*.aps
*.ncb
*.opendb
*.opensdf
*.sdf
*.cachefile
*.VC.db
*.VC.VC.opendb
# Visual Studio profiler
*.psess
*.vsp
*.vspx
*.sap
# Visual Studio Trace Files
*.e2e
# TFS 2012 Local Workspace
$tf/
# Guidance Automation Toolkit
*.gpState
# ReSharper is a .NET coding add-in
_ReSharper*/
*.[Rr]e[Ss]harper
*.DotSettings.user
# JustCode is a .NET coding add-in
.JustCode
# TeamCity is a build add-in
_TeamCity*
# DotCover is a Code Coverage Tool
*.dotCover
# AxoCover is a Code Coverage Tool
.axoCover/*
!.axoCover/settings.json
# Visual Studio code coverage results
*.coverage
*.coveragexml
# NCrunch
_NCrunch_*
.*crunch*.local.xml
nCrunchTemp_*
# MightyMoose
*.mm.*
AutoTest.Net/
# Web workbench (sass)
.sass-cache/
# Installshield output folder
[Ee]xpress/
# DocProject is a documentation generator add-in
DocProject/buildhelp/
DocProject/Help/*.HxT
DocProject/Help/*.HxC
DocProject/Help/*.hhc
DocProject/Help/*.hhk
DocProject/Help/*.hhp
DocProject/Help/Html2
DocProject/Help/html
# Click-Once directory
publish/
# Publish Web Output
*.[Pp]ublish.xml
*.azurePubxml
# Note: Comment the next line if you want to checkin your web deploy settings,
# but database connection strings (with potential passwords) will be unencrypted
*.pubxml
*.publishproj
# Microsoft Azure Web App publish settings. Comment the next line if you want to
# checkin your Azure Web App publish settings, but sensitive information contained
# in these scripts will be unencrypted
PublishScripts/
# NuGet Packages
*.nupkg
# The packages folder can be ignored because of Package Restore
**/[Pp]ackages/*
# except build/, which is used as an MSBuild target.
!**/[Pp]ackages/build/
# Uncomment if necessary however generally it will be regenerated when needed
#!**/[Pp]ackages/repositories.config
# NuGet v3's project.json files produces more ignorable files
*.nuget.props
*.nuget.targets
# Microsoft Azure Build Output
csx/
*.build.csdef
# Microsoft Azure Emulator
ecf/
rcf/
# Windows Store app package directories and files
AppPackages/
BundleArtifacts/
Package.StoreAssociation.xml
_pkginfo.txt
*.appx
# Visual Studio cache files
# files ending in .cache can be ignored
*.[Cc]ache
# but keep track of directories ending in .cache
!*.[Cc]ache/
# Others
ClientBin/
~$*
*~
*.dbmdl
*.dbproj.schemaview
*.jfm
*.pfx
*.publishsettings
orleans.codegen.cs
# Including strong name files can present a security risk
# (https://github.com/github/gitignore/pull/2483#issue-259490424)
#*.snk
# Since there are multiple workflows, uncomment next line to ignore bower_components
# (https://github.com/github/gitignore/pull/1529#issuecomment-104372622)
#bower_components/
# RIA/Silverlight projects
Generated_Code/
# Backup & report files from converting an old project file
# to a newer Visual Studio version. Backup files are not needed,
# because we have git ;-)
_UpgradeReport_Files/
Backup*/
UpgradeLog*.XML
UpgradeLog*.htm
ServiceFabricBackup/
*.rptproj.bak
# SQL Server files
*.mdf
*.ldf
*.ndf
# Business Intelligence projects
*.rdl.data
*.bim.layout
*.bim_*.settings
*.rptproj.rsuser
# Microsoft Fakes
FakesAssemblies/
# GhostDoc plugin setting file
*.GhostDoc.xml
# Node.js Tools for Visual Studio
.ntvs_analysis.dat
node_modules/
# Visual Studio 6 build log
*.plg
# Visual Studio 6 workspace options file
*.opt
# Visual Studio 6 auto-generated workspace file (contains which files were open etc.)
*.vbw
# Visual Studio LightSwitch build output
**/*.HTMLClient/GeneratedArtifacts
**/*.DesktopClient/GeneratedArtifacts
**/*.DesktopClient/ModelManifest.xml
**/*.Server/GeneratedArtifacts
**/*.Server/ModelManifest.xml
_Pvt_Extensions
# Paket dependency manager
.paket/paket.exe
paket-files/
# FAKE - F# Make
.fake/
# JetBrains Rider
.idea/
*.sln.iml
# CodeRush
.cr/
# Python Tools for Visual Studio (PTVS)
__pycache__/
*.pyc
# Cake - Uncomment if you are using it
# tools/**
# !tools/packages.config
# Tabs Studio
*.tss
# Telerik's JustMock configuration file
*.jmconfig
# BizTalk build output
*.btp.cs
*.btm.cs
*.odx.cs
*.xsd.cs
# OpenCover UI analysis results
OpenCover/
# Azure Stream Analytics local run output
ASALocalRun/
# MSBuild Binary and Structured Log
*.binlog
# NVidia Nsight GPU debugger configuration file
*.nvuser
# MFractors (Xamarin productivity tool) working folder
.mfractor/
# Local History for Visual Studio
.localhistory/

31
OpenGTA-win/OpenGTA-win.sln Executable file
View File

@ -0,0 +1,31 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 15
VisualStudioVersion = 15.0.27428.2015
MinimumVisualStudioVersion = 10.0.40219.1
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "OpenGTA-win", "OpenGTA-win.vcxproj", "{029D8A0B-123A-400E-9954-700F8CFF3F81}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|x64 = Debug|x64
Debug|x86 = Debug|x86
Release|x64 = Release|x64
Release|x86 = Release|x86
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{029D8A0B-123A-400E-9954-700F8CFF3F81}.Debug|x64.ActiveCfg = Debug|x64
{029D8A0B-123A-400E-9954-700F8CFF3F81}.Debug|x64.Build.0 = Debug|x64
{029D8A0B-123A-400E-9954-700F8CFF3F81}.Debug|x86.ActiveCfg = Debug|Win32
{029D8A0B-123A-400E-9954-700F8CFF3F81}.Debug|x86.Build.0 = Debug|Win32
{029D8A0B-123A-400E-9954-700F8CFF3F81}.Release|x64.ActiveCfg = Release|x64
{029D8A0B-123A-400E-9954-700F8CFF3F81}.Release|x64.Build.0 = Release|x64
{029D8A0B-123A-400E-9954-700F8CFF3F81}.Release|x86.ActiveCfg = Release|Win32
{029D8A0B-123A-400E-9954-700F8CFF3F81}.Release|x86.Build.0 = Release|Win32
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {867B0492-13C4-4F6B-8DC5-5DDFEF60B309}
EndGlobalSection
EndGlobal

277
OpenGTA-win/OpenGTA-win.vcxproj Executable file
View File

@ -0,0 +1,277 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|Win32">
<Configuration>Debug</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|Win32">
<Configuration>Release</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Debug|x64">
<Configuration>Debug</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|x64">
<Configuration>Release</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
</ItemGroup>
<PropertyGroup Label="Globals">
<VCProjectVersion>15.0</VCProjectVersion>
<ProjectGuid>{029D8A0B-123A-400E-9954-700F8CFF3F81}</ProjectGuid>
<RootNamespace>OpenGTAwin</RootNamespace>
<WindowsTargetPlatformVersion>10.0.17134.0</WindowsTargetPlatformVersion>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v141</PlatformToolset>
<CharacterSet>MultiByte</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v141</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>MultiByte</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v141</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
<CLRSupport>false</CLRSupport>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v141</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet>
<CLRSupport>false</CLRSupport>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
<ImportGroup Label="Shared">
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<IncludePath>$(VC_IncludePath);$(WindowsSDK_IncludePath);</IncludePath>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<IncludePath>$(VC_IncludePath);$(WindowsSDK_IncludePath);</IncludePath>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<Optimization>Disabled</Optimization>
<SDLCheck>true</SDLCheck>
<ConformanceMode>true</ConformanceMode>
<AdditionalIncludeDirectories>..\;..\math;..\coldet\;..\util;..\..\SDL2-2.0.8\include;..\..\physfs-3.0.1\build\install\include</AdditionalIncludeDirectories>
</ClCompile>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<Optimization>Disabled</Optimization>
<SDLCheck>true</SDLCheck>
<ConformanceMode>true</ConformanceMode>
<AdditionalIncludeDirectories>..\;..\math;..\coldet\;..\util;..\..\SDL2-2.0.8\include;..\..\physfs-3.0.1\build\install\include;..\..\loki-0.1.7\include\loki;..\opensteer\include</AdditionalIncludeDirectories>
<PreprocessorDefinitions>_CONSOLE;_SCL_SECURE_NO_WARNINGS;_CRT_SECURE_NO_WARNINGS;_MBCS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<CompileAsWinRT>false</CompileAsWinRT>
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
<AdditionalLibraryDirectories>..\..\SDL2-2.0.8\lib\x64;..\..\loki-0.1.7\lib;..\..\physfs-3.0.1\build\install\lib</AdditionalLibraryDirectories>
<AdditionalDependencies>physfs-static.lib;loki_D.lib;SDL2.lib;SDL2main.lib;opengl32.lib;glu32.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies)</AdditionalDependencies>
<EntryPointSymbol>
</EntryPointSymbol>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<Optimization>MaxSpeed</Optimization>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<SDLCheck>true</SDLCheck>
<ConformanceMode>true</ConformanceMode>
<AdditionalIncludeDirectories>..\;..\math;..\coldet\;..\util;..\..\SDL2-2.0.8\include;..\..\physfs-3.0.1\build\install\include</AdditionalIncludeDirectories>
</ClCompile>
<Link>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<Optimization>MaxSpeed</Optimization>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<SDLCheck>true</SDLCheck>
<ConformanceMode>true</ConformanceMode>
<AdditionalIncludeDirectories>..\;..\math;..\coldet\;..\util;..\..\SDL2-2.0.8\include;..\..\physfs-3.0.1\build\install\include;..\..\loki-0.1.7\include\loki;..\opensteer\include</AdditionalIncludeDirectories>
<PreprocessorDefinitions>_SCL_SECURE_NO_WARNINGS;_CRT_SECURE_NO_WARNINGS;_MBCS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<CompileAsWinRT>false</CompileAsWinRT>
</ClCompile>
<Link>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
<SubSystem>Console</SubSystem>
<AdditionalLibraryDirectories>..\..\SDL2-2.0.8\lib\x64;..\..\loki-0.1.7\lib;..\..\physfs-3.0.1\build\install\lib</AdditionalLibraryDirectories>
<AdditionalDependencies>physfs-static.lib;loki_D.lib;SDL2.lib;opengl32.lib;glu32.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies)</AdditionalDependencies>
<EntryPointSymbol>
</EntryPointSymbol>
</Link>
</ItemDefinitionGroup>
<ItemGroup>
<ClCompile Include="..\ai.cpp" />
<ClCompile Include="..\blockanim.cpp" />
<ClCompile Include="..\blockdata.cpp" />
<ClCompile Include="..\coldet\math3d.cpp" />
<ClCompile Include="..\common_sdl_gl.cpp" />
<ClCompile Include="..\datahelper.cpp" />
<ClCompile Include="..\dataholder.cpp" />
<ClCompile Include="..\entity_controller.cpp" />
<ClCompile Include="..\font_cache.cpp" />
<ClCompile Include="..\game_objects.cpp" />
<ClCompile Include="..\gl_base.cpp" />
<ClCompile Include="..\gl_camera.cpp" />
<ClCompile Include="..\gl_cityview.cpp" />
<ClCompile Include="..\gl_font.cpp" />
<ClCompile Include="..\gl_frustum.cpp" />
<ClCompile Include="..\gl_screen.cpp" />
<ClCompile Include="..\gl_spritecache.cpp" />
<ClCompile Include="..\gl_texturecache.cpp" />
<ClCompile Include="..\id_sys.cpp" />
<ClCompile Include="..\localplayer.cpp" />
<ClCompile Include="..\main.cpp" />
<ClCompile Include="..\math\obb.cpp" />
<ClCompile Include="..\math\obox.cpp" />
<ClCompile Include="..\math\plane.cpp" />
<ClCompile Include="..\math\weighted_set.cpp" />
<ClCompile Include="..\navdata.cpp" />
<ClCompile Include="..\opensteer\src\Clock.cpp" />
<ClCompile Include="..\opensteer\src\Vec3.cpp" />
<ClCompile Include="..\read_cmp.cpp" />
<ClCompile Include="..\read_fnt.cpp" />
<ClCompile Include="..\read_fxt.cpp" />
<ClCompile Include="..\read_g24.cpp" />
<ClCompile Include="..\read_gry.cpp" />
<ClCompile Include="..\read_ini.cpp" />
<ClCompile Include="..\read_sdt.cpp" />
<ClCompile Include="..\slope_height_func.cpp" />
<ClCompile Include="..\spritemanager.cpp" />
<ClCompile Include="..\train_system.cpp" />
<ClCompile Include="..\util\animation.cpp" />
<ClCompile Include="..\util\buffercache.cpp" />
<ClCompile Include="..\util\cell_iterator.cpp" />
<ClCompile Include="..\util\file_helper.cpp" />
<ClCompile Include="..\util\gui.cpp" />
<ClCompile Include="..\util\image_loader.cpp" />
<ClCompile Include="..\util\key_handler.cpp" />
<ClCompile Include="..\util\log.cpp" />
<ClCompile Include="..\util\map_helper.cpp" />
<ClCompile Include="..\util\m_exceptions.cpp" />
<ClCompile Include="..\util\pf_tree.cpp" />
<ClCompile Include="..\util\physfsrwops.c" />
<ClCompile Include="..\util\set.cpp" />
<ClCompile Include="..\util\sound_device.cpp" />
<ClCompile Include="..\util\sound_fx_cache.cpp" />
<ClCompile Include="..\util\sound_music_player.cpp" />
<ClCompile Include="..\util\sound_resample2.cpp" />
<ClCompile Include="..\util\sound_system.cpp" />
<ClCompile Include="..\util\timer.cpp" />
<ClCompile Include="..\viewer.cpp" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="..\ai.h" />
<ClInclude Include="..\blockanim.h" />
<ClInclude Include="..\blockdata.h" />
<ClInclude Include="..\coldet\math3d.h" />
<ClInclude Include="..\common_sdl_gl.h" />
<ClInclude Include="..\datahelper.h" />
<ClInclude Include="..\dataholder.h" />
<ClInclude Include="..\entity_controller.h" />
<ClInclude Include="..\font_cache.h" />
<ClInclude Include="..\fx_sdt.h" />
<ClInclude Include="..\game_objects.h" />
<ClInclude Include="..\gl_base.h" />
<ClInclude Include="..\gl_camera.h" />
<ClInclude Include="..\gl_cityview.h" />
<ClInclude Include="..\gl_font.h" />
<ClInclude Include="..\gl_frustum.h" />
<ClInclude Include="..\gl_pagedtexture.h" />
<ClInclude Include="..\gl_screen.h" />
<ClInclude Include="..\gl_spritecache.h" />
<ClInclude Include="..\gl_texturecache.h" />
<ClInclude Include="..\id_sys.h" />
<ClInclude Include="..\lid_normal_data.h" />
<ClInclude Include="..\localplayer.h" />
<ClInclude Include="..\math\basis.hpp" />
<ClInclude Include="..\math\coord_frame.hpp" />
<ClInclude Include="..\math\interpolate.hpp" />
<ClInclude Include="..\math\matrix.hpp" />
<ClInclude Include="..\math\obb.hpp" />
<ClInclude Include="..\math\obox.h" />
<ClInclude Include="..\math\plane.h" />
<ClInclude Include="..\math\quaternion.h" />
<ClInclude Include="..\math\rectangle.hpp" />
<ClInclude Include="..\math\vector.hpp" />
<ClInclude Include="..\math\weighted_set.h" />
<ClInclude Include="..\navdata.h" />
<ClInclude Include="..\opengta.h" />
<ClInclude Include="..\read_ini.h" />
<ClInclude Include="..\slope1_data.h" />
<ClInclude Include="..\slope1_tcoords.h" />
<ClInclude Include="..\spritemanager.h" />
<ClInclude Include="..\train_system.h" />
<ClInclude Include="..\util\abstract_container.h" />
<ClInclude Include="..\util\animation.h" />
<ClInclude Include="..\util\buffercache.h" />
<ClInclude Include="..\util\cell_iterator.h" />
<ClInclude Include="..\util\cistring.h" />
<ClInclude Include="..\util\file_helper.h" />
<ClInclude Include="..\util\gui.h" />
<ClInclude Include="..\util\image_loader.h" />
<ClInclude Include="..\util\key_handler.h" />
<ClInclude Include="..\util\log.h" />
<ClInclude Include="..\util\map_helper.h" />
<ClInclude Include="..\util\m_exceptions.h" />
<ClInclude Include="..\util\pf_tree.hpp" />
<ClInclude Include="..\util\physfsrwops.h" />
<ClInclude Include="..\util\sample_cache.h" />
<ClInclude Include="..\util\set.h" />
<ClInclude Include="..\util\sound_device.h" />
<ClInclude Include="..\util\sound_fx_cache.h" />
<ClInclude Include="..\util\sound_mixer.h" />
<ClInclude Include="..\util\sound_music_player.h" />
<ClInclude Include="..\util\sound_resample2.h" />
<ClInclude Include="..\util\sound_system.h" />
<ClInclude Include="..\util\timer.h" />
</ItemGroup>
<ItemGroup>
<None Include="..\Doxyfile" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>

View File

@ -0,0 +1,407 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<Filter Include="Source Files">
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
<Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
</Filter>
<Filter Include="Header Files">
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
<Extensions>h;hh;hpp;hxx;hm;inl;inc;ipp;xsd</Extensions>
</Filter>
<Filter Include="Resource Files">
<UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
<Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
</Filter>
<Filter Include="Source Files\ogta">
<UniqueIdentifier>{61d3b438-8ce2-448d-8dd9-378b1eba1e3d}</UniqueIdentifier>
</Filter>
<Filter Include="Source Files\math">
<UniqueIdentifier>{29273c88-3c60-4004-a50d-4e73bab65145}</UniqueIdentifier>
</Filter>
<Filter Include="Source Files\util">
<UniqueIdentifier>{973c556e-0197-448e-9484-234647c2a827}</UniqueIdentifier>
</Filter>
<Filter Include="Source Files\coldet">
<UniqueIdentifier>{dd602175-4834-4446-99a4-2df1bb9aa58d}</UniqueIdentifier>
</Filter>
<Filter Include="Source Files\opensteer">
<UniqueIdentifier>{b411155d-6ed1-42eb-b97b-2236cdffc485}</UniqueIdentifier>
</Filter>
</ItemGroup>
<ItemGroup>
<ClCompile Include="..\read_ini.cpp">
<Filter>Source Files\ogta</Filter>
</ClCompile>
<ClCompile Include="..\read_sdt.cpp">
<Filter>Source Files\ogta</Filter>
</ClCompile>
<ClCompile Include="..\slope_height_func.cpp">
<Filter>Source Files\ogta</Filter>
</ClCompile>
<ClCompile Include="..\spritemanager.cpp">
<Filter>Source Files\ogta</Filter>
</ClCompile>
<ClCompile Include="..\train_system.cpp">
<Filter>Source Files\ogta</Filter>
</ClCompile>
<ClCompile Include="..\viewer.cpp">
<Filter>Source Files\ogta</Filter>
</ClCompile>
<ClCompile Include="..\ai.cpp">
<Filter>Source Files\ogta</Filter>
</ClCompile>
<ClCompile Include="..\blockanim.cpp">
<Filter>Source Files\ogta</Filter>
</ClCompile>
<ClCompile Include="..\blockdata.cpp">
<Filter>Source Files\ogta</Filter>
</ClCompile>
<ClCompile Include="..\common_sdl_gl.cpp">
<Filter>Source Files\ogta</Filter>
</ClCompile>
<ClCompile Include="..\datahelper.cpp">
<Filter>Source Files\ogta</Filter>
</ClCompile>
<ClCompile Include="..\dataholder.cpp">
<Filter>Source Files\ogta</Filter>
</ClCompile>
<ClCompile Include="..\entity_controller.cpp">
<Filter>Source Files\ogta</Filter>
</ClCompile>
<ClCompile Include="..\font_cache.cpp">
<Filter>Source Files\ogta</Filter>
</ClCompile>
<ClCompile Include="..\game_objects.cpp">
<Filter>Source Files\ogta</Filter>
</ClCompile>
<ClCompile Include="..\gl_base.cpp">
<Filter>Source Files\ogta</Filter>
</ClCompile>
<ClCompile Include="..\gl_camera.cpp">
<Filter>Source Files\ogta</Filter>
</ClCompile>
<ClCompile Include="..\gl_cityview.cpp">
<Filter>Source Files\ogta</Filter>
</ClCompile>
<ClCompile Include="..\gl_font.cpp">
<Filter>Source Files\ogta</Filter>
</ClCompile>
<ClCompile Include="..\gl_frustum.cpp">
<Filter>Source Files\ogta</Filter>
</ClCompile>
<ClCompile Include="..\gl_screen.cpp">
<Filter>Source Files\ogta</Filter>
</ClCompile>
<ClCompile Include="..\gl_spritecache.cpp">
<Filter>Source Files\ogta</Filter>
</ClCompile>
<ClCompile Include="..\gl_texturecache.cpp">
<Filter>Source Files\ogta</Filter>
</ClCompile>
<ClCompile Include="..\id_sys.cpp">
<Filter>Source Files\ogta</Filter>
</ClCompile>
<ClCompile Include="..\localplayer.cpp">
<Filter>Source Files\ogta</Filter>
</ClCompile>
<ClCompile Include="..\navdata.cpp">
<Filter>Source Files\ogta</Filter>
</ClCompile>
<ClCompile Include="..\read_cmp.cpp">
<Filter>Source Files\ogta</Filter>
</ClCompile>
<ClCompile Include="..\read_fnt.cpp">
<Filter>Source Files\ogta</Filter>
</ClCompile>
<ClCompile Include="..\read_fxt.cpp">
<Filter>Source Files\ogta</Filter>
</ClCompile>
<ClCompile Include="..\read_g24.cpp">
<Filter>Source Files\ogta</Filter>
</ClCompile>
<ClCompile Include="..\read_gry.cpp">
<Filter>Source Files\ogta</Filter>
</ClCompile>
<ClCompile Include="..\math\weighted_set.cpp">
<Filter>Source Files\math</Filter>
</ClCompile>
<ClCompile Include="..\math\obb.cpp">
<Filter>Source Files\math</Filter>
</ClCompile>
<ClCompile Include="..\math\obox.cpp">
<Filter>Source Files\math</Filter>
</ClCompile>
<ClCompile Include="..\math\plane.cpp">
<Filter>Source Files\math</Filter>
</ClCompile>
<ClCompile Include="..\main.cpp">
<Filter>Source Files\ogta</Filter>
</ClCompile>
<ClCompile Include="..\util\sound_resample2.cpp">
<Filter>Source Files\util</Filter>
</ClCompile>
<ClCompile Include="..\util\sound_system.cpp">
<Filter>Source Files\util</Filter>
</ClCompile>
<ClCompile Include="..\util\timer.cpp">
<Filter>Source Files\util</Filter>
</ClCompile>
<ClCompile Include="..\util\animation.cpp">
<Filter>Source Files\util</Filter>
</ClCompile>
<ClCompile Include="..\util\buffercache.cpp">
<Filter>Source Files\util</Filter>
</ClCompile>
<ClCompile Include="..\util\cell_iterator.cpp">
<Filter>Source Files\util</Filter>
</ClCompile>
<ClCompile Include="..\util\file_helper.cpp">
<Filter>Source Files\util</Filter>
</ClCompile>
<ClCompile Include="..\util\gui.cpp">
<Filter>Source Files\util</Filter>
</ClCompile>
<ClCompile Include="..\util\image_loader.cpp">
<Filter>Source Files\util</Filter>
</ClCompile>
<ClCompile Include="..\util\key_handler.cpp">
<Filter>Source Files\util</Filter>
</ClCompile>
<ClCompile Include="..\util\log.cpp">
<Filter>Source Files\util</Filter>
</ClCompile>
<ClCompile Include="..\util\m_exceptions.cpp">
<Filter>Source Files\util</Filter>
</ClCompile>
<ClCompile Include="..\util\map_helper.cpp">
<Filter>Source Files\util</Filter>
</ClCompile>
<ClCompile Include="..\util\pf_tree.cpp">
<Filter>Source Files\util</Filter>
</ClCompile>
<ClCompile Include="..\util\physfsrwops.c">
<Filter>Source Files\util</Filter>
</ClCompile>
<ClCompile Include="..\util\set.cpp">
<Filter>Source Files\util</Filter>
</ClCompile>
<ClCompile Include="..\util\sound_device.cpp">
<Filter>Source Files\util</Filter>
</ClCompile>
<ClCompile Include="..\util\sound_fx_cache.cpp">
<Filter>Source Files\util</Filter>
</ClCompile>
<ClCompile Include="..\util\sound_music_player.cpp">
<Filter>Source Files\util</Filter>
</ClCompile>
<ClCompile Include="..\coldet\math3d.cpp">
<Filter>Source Files\coldet</Filter>
</ClCompile>
<ClCompile Include="..\opensteer\src\Vec3.cpp">
<Filter>Source Files\opensteer</Filter>
</ClCompile>
<ClCompile Include="..\opensteer\src\Clock.cpp">
<Filter>Source Files\opensteer</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="..\read_ini.h">
<Filter>Source Files\ogta</Filter>
</ClInclude>
<ClInclude Include="..\slope1_data.h">
<Filter>Source Files\ogta</Filter>
</ClInclude>
<ClInclude Include="..\slope1_tcoords.h">
<Filter>Source Files\ogta</Filter>
</ClInclude>
<ClInclude Include="..\spritemanager.h">
<Filter>Source Files\ogta</Filter>
</ClInclude>
<ClInclude Include="..\train_system.h">
<Filter>Source Files\ogta</Filter>
</ClInclude>
<ClInclude Include="..\ai.h">
<Filter>Source Files\ogta</Filter>
</ClInclude>
<ClInclude Include="..\blockanim.h">
<Filter>Source Files\ogta</Filter>
</ClInclude>
<ClInclude Include="..\blockdata.h">
<Filter>Source Files\ogta</Filter>
</ClInclude>
<ClInclude Include="..\common_sdl_gl.h">
<Filter>Source Files\ogta</Filter>
</ClInclude>
<ClInclude Include="..\datahelper.h">
<Filter>Source Files\ogta</Filter>
</ClInclude>
<ClInclude Include="..\dataholder.h">
<Filter>Source Files\ogta</Filter>
</ClInclude>
<ClInclude Include="..\entity_controller.h">
<Filter>Source Files\ogta</Filter>
</ClInclude>
<ClInclude Include="..\font_cache.h">
<Filter>Source Files\ogta</Filter>
</ClInclude>
<ClInclude Include="..\fx_sdt.h">
<Filter>Source Files\ogta</Filter>
</ClInclude>
<ClInclude Include="..\game_objects.h">
<Filter>Source Files\ogta</Filter>
</ClInclude>
<ClInclude Include="..\gl_base.h">
<Filter>Source Files\ogta</Filter>
</ClInclude>
<ClInclude Include="..\gl_camera.h">
<Filter>Source Files\ogta</Filter>
</ClInclude>
<ClInclude Include="..\gl_cityview.h">
<Filter>Source Files\ogta</Filter>
</ClInclude>
<ClInclude Include="..\gl_font.h">
<Filter>Source Files\ogta</Filter>
</ClInclude>
<ClInclude Include="..\gl_frustum.h">
<Filter>Source Files\ogta</Filter>
</ClInclude>
<ClInclude Include="..\gl_pagedtexture.h">
<Filter>Source Files\ogta</Filter>
</ClInclude>
<ClInclude Include="..\gl_screen.h">
<Filter>Source Files\ogta</Filter>
</ClInclude>
<ClInclude Include="..\gl_spritecache.h">
<Filter>Source Files\ogta</Filter>
</ClInclude>
<ClInclude Include="..\gl_texturecache.h">
<Filter>Source Files\ogta</Filter>
</ClInclude>
<ClInclude Include="..\id_sys.h">
<Filter>Source Files\ogta</Filter>
</ClInclude>
<ClInclude Include="..\lid_normal_data.h">
<Filter>Source Files\ogta</Filter>
</ClInclude>
<ClInclude Include="..\localplayer.h">
<Filter>Source Files\ogta</Filter>
</ClInclude>
<ClInclude Include="..\navdata.h">
<Filter>Source Files\ogta</Filter>
</ClInclude>
<ClInclude Include="..\opengta.h">
<Filter>Source Files\ogta</Filter>
</ClInclude>
<ClInclude Include="..\math\rectangle.hpp">
<Filter>Source Files\math</Filter>
</ClInclude>
<ClInclude Include="..\math\vector.hpp">
<Filter>Source Files\math</Filter>
</ClInclude>
<ClInclude Include="..\math\weighted_set.h">
<Filter>Source Files\math</Filter>
</ClInclude>
<ClInclude Include="..\math\basis.hpp">
<Filter>Source Files\math</Filter>
</ClInclude>
<ClInclude Include="..\math\coord_frame.hpp">
<Filter>Source Files\math</Filter>
</ClInclude>
<ClInclude Include="..\math\interpolate.hpp">
<Filter>Source Files\math</Filter>
</ClInclude>
<ClInclude Include="..\math\matrix.hpp">
<Filter>Source Files\math</Filter>
</ClInclude>
<ClInclude Include="..\math\obb.hpp">
<Filter>Source Files\math</Filter>
</ClInclude>
<ClInclude Include="..\math\obox.h">
<Filter>Source Files\math</Filter>
</ClInclude>
<ClInclude Include="..\math\plane.h">
<Filter>Source Files\math</Filter>
</ClInclude>
<ClInclude Include="..\math\quaternion.h">
<Filter>Source Files\math</Filter>
</ClInclude>
<ClInclude Include="..\util\sound_resample2.h">
<Filter>Source Files\util</Filter>
</ClInclude>
<ClInclude Include="..\util\sound_system.h">
<Filter>Source Files\util</Filter>
</ClInclude>
<ClInclude Include="..\util\timer.h">
<Filter>Source Files\util</Filter>
</ClInclude>
<ClInclude Include="..\util\abstract_container.h">
<Filter>Source Files\util</Filter>
</ClInclude>
<ClInclude Include="..\util\animation.h">
<Filter>Source Files\util</Filter>
</ClInclude>
<ClInclude Include="..\util\buffercache.h">
<Filter>Source Files\util</Filter>
</ClInclude>
<ClInclude Include="..\util\cell_iterator.h">
<Filter>Source Files\util</Filter>
</ClInclude>
<ClInclude Include="..\util\cistring.h">
<Filter>Source Files\util</Filter>
</ClInclude>
<ClInclude Include="..\util\file_helper.h">
<Filter>Source Files\util</Filter>
</ClInclude>
<ClInclude Include="..\util\gui.h">
<Filter>Source Files\util</Filter>
</ClInclude>
<ClInclude Include="..\util\image_loader.h">
<Filter>Source Files\util</Filter>
</ClInclude>
<ClInclude Include="..\util\key_handler.h">
<Filter>Source Files\util</Filter>
</ClInclude>
<ClInclude Include="..\util\log.h">
<Filter>Source Files\util</Filter>
</ClInclude>
<ClInclude Include="..\util\m_exceptions.h">
<Filter>Source Files\util</Filter>
</ClInclude>
<ClInclude Include="..\util\map_helper.h">
<Filter>Source Files\util</Filter>
</ClInclude>
<ClInclude Include="..\util\pf_tree.hpp">
<Filter>Source Files\util</Filter>
</ClInclude>
<ClInclude Include="..\util\physfsrwops.h">
<Filter>Source Files\util</Filter>
</ClInclude>
<ClInclude Include="..\util\sample_cache.h">
<Filter>Source Files\util</Filter>
</ClInclude>
<ClInclude Include="..\util\set.h">
<Filter>Source Files\util</Filter>
</ClInclude>
<ClInclude Include="..\util\sound_device.h">
<Filter>Source Files\util</Filter>
</ClInclude>
<ClInclude Include="..\util\sound_fx_cache.h">
<Filter>Source Files\util</Filter>
</ClInclude>
<ClInclude Include="..\util\sound_mixer.h">
<Filter>Source Files\util</Filter>
</ClInclude>
<ClInclude Include="..\util\sound_music_player.h">
<Filter>Source Files\util</Filter>
</ClInclude>
<ClInclude Include="..\coldet\math3d.h">
<Filter>Source Files\coldet</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<None Include="..\Doxyfile">
<Filter>Source Files\ogta</Filter>
</None>
</ItemGroup>
</Project>

BIN
OpenGTA-win/SDL2.dll Executable file

Binary file not shown.

3
coldet/math3d.cpp Normal file → Executable file
View File

@ -24,6 +24,9 @@
#include "sysdep.h" #include "sysdep.h"
#include "math3d.h" #include "math3d.h"
#define _USE_MATH_DEFINES
#include <cmath>
const Vector3D Vector3D::Zero(0.0f,0.0f,0.0f); const Vector3D Vector3D::Zero(0.0f,0.0f,0.0f);
const Matrix3D Matrix3D::Identity(1.0f,0.0f,0.0f,0.0f, const Matrix3D Matrix3D::Identity(1.0f,0.0f,0.0f,0.0f,
0.0f,1.0f,0.0f,0.0f, 0.0f,1.0f,0.0f,0.0f,

68
coldet/math3d.h Normal file → Executable file
View File

@ -66,22 +66,6 @@ struct Vector3D
float& operator[] (int i) { return ((float*)&x)[i]; } float& operator[] (int i) { return ((float*)&x)[i]; }
}; };
#define _11 sclr.s11
#define _12 sclr.s12
#define _13 sclr.s13
#define _14 sclr.s14
#define _21 sclr.s21
#define _22 sclr.s22
#define _23 sclr.s23
#define _24 sclr.s24
#define _31 sclr.s31
#define _32 sclr.s32
#define _33 sclr.s33
#define _34 sclr.s34
#define _41 sclr.s41
#define _42 sclr.s42
#define _43 sclr.s43
#define _44 sclr.s44
struct Matrix3 struct Matrix3
{ {
@ -119,10 +103,10 @@ struct Matrix3D
float f31, float f32, float f33, float f34, float f31, float f32, float f33, float f34,
float f41, float f42, float f43, float f44) float f41, float f42, float f43, float f44)
{ {
_11=f11; _12=f12; _13=f13; _14=f14; sclr.s11=f11; sclr.s12=f12; sclr.s13=f13; sclr.s14=f14;
_21=f21; _22=f22; _23=f23; _24=f24; sclr.s21=f21; sclr.s22=f22; sclr.s23=f23; sclr.s24=f24;
_31=f31; _32=f32; _33=f33; _34=f34; sclr.s31=f31; sclr.s32=f32; sclr.s33=f33; sclr.s34=f34;
_41=f41; _42=f42; _43=f43; _44=f44; sclr.s41=f41; sclr.s42=f42; sclr.s43=f43; sclr.s44=f44;
} }
Matrix3D& operator*= (const Matrix3D& m) Matrix3D& operator*= (const Matrix3D& m)
@ -199,16 +183,16 @@ inline Vector3D CrossProduct(const Vector3D& v1, const Vector3D& v2)
inline Vector3D Transform(const Vector3D& v, const Matrix3D& m) inline Vector3D Transform(const Vector3D& v, const Matrix3D& m)
{ {
return Vector3D(v.x*m._11 + v.y*m._21 + v.z*m._31 + m._41, return Vector3D(v.x*m.sclr.s11 + v.y*m.sclr.s21 + v.z*m.sclr.s31 + m.sclr.s41,
v.x*m._12 + v.y*m._22 + v.z*m._32 + m._42, v.x*m.sclr.s12 + v.y*m.sclr.s22 + v.z*m.sclr.s32 + m.sclr.s42,
v.x*m._13 + v.y*m._23 + v.z*m._33 + m._43); v.x*m.sclr.s13 + v.y*m.sclr.s23 + v.z*m.sclr.s33 + m.sclr.s43);
} }
inline Vector3D rotateVector(const Vector3D& v, const Matrix3D& m) inline Vector3D rotateVector(const Vector3D& v, const Matrix3D& m)
{ {
return Vector3D(v.x*m._11 + v.y*m._21 + v.z*m._31, return Vector3D(v.x*m.sclr.s11 + v.y*m.sclr.s21 + v.z*m.sclr.s31,
v.x*m._12 + v.y*m._22 + v.z*m._32, v.x*m.sclr.s12 + v.y*m.sclr.s22 + v.z*m.sclr.s32,
v.x*m._13 + v.y*m._23 + v.z*m._33); v.x*m.sclr.s13 + v.y*m.sclr.s23 + v.z*m.sclr.s33);
} }
inline Matrix3D operator*(float scalar, const Matrix3D& m) inline Matrix3D operator*(float scalar, const Matrix3D& m)
@ -222,22 +206,22 @@ inline Matrix3D operator*(float scalar, const Matrix3D& m)
inline Matrix3D operator*(const Matrix3D& m1, const Matrix3D& m2) inline Matrix3D operator*(const Matrix3D& m1, const Matrix3D& m2)
{ {
return Matrix3D( return Matrix3D(
m1._11*m2._11 + m1._12*m2._21 + m1._13*m2._31 + m1._14*m2._41, m1.sclr.s11*m2.sclr.s11 + m1.sclr.s12*m2.sclr.s21 + m1.sclr.s13*m2.sclr.s31 + m1.sclr.s14*m2.sclr.s41,
m1._11*m2._12 + m1._12*m2._22 + m1._13*m2._32 + m1._14*m2._42, m1.sclr.s11*m2.sclr.s12 + m1.sclr.s12*m2.sclr.s22 + m1.sclr.s13*m2.sclr.s32 + m1.sclr.s14*m2.sclr.s42,
m1._11*m2._13 + m1._12*m2._23 + m1._13*m2._33 + m1._14*m2._43, m1.sclr.s11*m2.sclr.s13 + m1.sclr.s12*m2.sclr.s23 + m1.sclr.s13*m2.sclr.s33 + m1.sclr.s14*m2.sclr.s43,
m1._11*m2._14 + m1._12*m2._24 + m1._13*m2._34 + m1._14*m2._44, m1.sclr.s11*m2.sclr.s14 + m1.sclr.s12*m2.sclr.s24 + m1.sclr.s13*m2.sclr.s34 + m1.sclr.s14*m2.sclr.s44,
m1._21*m2._11 + m1._22*m2._21 + m1._23*m2._31 + m1._24*m2._41, m1.sclr.s21*m2.sclr.s11 + m1.sclr.s22*m2.sclr.s21 + m1.sclr.s23*m2.sclr.s31 + m1.sclr.s24*m2.sclr.s41,
m1._21*m2._12 + m1._22*m2._22 + m1._23*m2._32 + m1._24*m2._42, m1.sclr.s21*m2.sclr.s12 + m1.sclr.s22*m2.sclr.s22 + m1.sclr.s23*m2.sclr.s32 + m1.sclr.s24*m2.sclr.s42,
m1._21*m2._13 + m1._22*m2._23 + m1._23*m2._33 + m1._24*m2._43, m1.sclr.s21*m2.sclr.s13 + m1.sclr.s22*m2.sclr.s23 + m1.sclr.s23*m2.sclr.s33 + m1.sclr.s24*m2.sclr.s43,
m1._21*m2._14 + m1._22*m2._24 + m1._23*m2._34 + m1._24*m2._44, m1.sclr.s21*m2.sclr.s14 + m1.sclr.s22*m2.sclr.s24 + m1.sclr.s23*m2.sclr.s34 + m1.sclr.s24*m2.sclr.s44,
m1._31*m2._11 + m1._32*m2._21 + m1._33*m2._31 + m1._34*m2._41, m1.sclr.s31*m2.sclr.s11 + m1.sclr.s32*m2.sclr.s21 + m1.sclr.s33*m2.sclr.s31 + m1.sclr.s34*m2.sclr.s41,
m1._31*m2._12 + m1._32*m2._22 + m1._33*m2._32 + m1._34*m2._42, m1.sclr.s31*m2.sclr.s12 + m1.sclr.s32*m2.sclr.s22 + m1.sclr.s33*m2.sclr.s32 + m1.sclr.s34*m2.sclr.s42,
m1._31*m2._13 + m1._32*m2._23 + m1._33*m2._33 + m1._34*m2._43, m1.sclr.s31*m2.sclr.s13 + m1.sclr.s32*m2.sclr.s23 + m1.sclr.s33*m2.sclr.s33 + m1.sclr.s34*m2.sclr.s43,
m1._31*m2._14 + m1._32*m2._24 + m1._33*m2._34 + m1._34*m2._44, m1.sclr.s31*m2.sclr.s14 + m1.sclr.s32*m2.sclr.s24 + m1.sclr.s33*m2.sclr.s34 + m1.sclr.s34*m2.sclr.s44,
m1._41*m2._11 + m1._42*m2._21 + m1._43*m2._31 + m1._44*m2._41, m1.sclr.s41*m2.sclr.s11 + m1.sclr.s42*m2.sclr.s21 + m1.sclr.s43*m2.sclr.s31 + m1.sclr.s44*m2.sclr.s41,
m1._41*m2._12 + m1._42*m2._22 + m1._43*m2._32 + m1._44*m2._42, m1.sclr.s41*m2.sclr.s12 + m1.sclr.s42*m2.sclr.s22 + m1.sclr.s43*m2.sclr.s32 + m1.sclr.s44*m2.sclr.s42,
m1._41*m2._13 + m1._42*m2._23 + m1._43*m2._33 + m1._44*m2._43, m1.sclr.s41*m2.sclr.s13 + m1.sclr.s42*m2.sclr.s23 + m1.sclr.s43*m2.sclr.s33 + m1.sclr.s44*m2.sclr.s43,
m1._41*m2._14 + m1._42*m2._24 + m1._43*m2._34 + m1._44*m2._44); m1.sclr.s41*m2.sclr.s14 + m1.sclr.s42*m2.sclr.s24 + m1.sclr.s43*m2.sclr.s34 + m1.sclr.s44*m2.sclr.s44);
} }
inline void inline void

13
coldet/sysdep.h Normal file → Executable file
View File

@ -24,14 +24,6 @@
#ifndef H_SYSDEP #ifndef H_SYSDEP
#define H_SYSDEP #define H_SYSDEP
#ifdef GCC
typedef unsigned long DWORD;
DWORD GetTickCount();
#define __CD__BEGIN
#define __CD__END
#elif defined(WIN32)
#define WIN32_LEAN_AND_MEAN #define WIN32_LEAN_AND_MEAN
#include <windows.h> #include <windows.h>
@ -42,11 +34,6 @@ DWORD GetTickCount();
#else #else
#define EXPORT __declspec(dllimport) #define EXPORT __declspec(dllimport)
#endif #endif
#else
#error No system specified (WIN32 GCC)
#endif
#ifndef EXPORT #ifndef EXPORT
#define EXPORT #define EXPORT

43
common_sdl_gl.cpp Normal file → Executable file
View File

@ -2,6 +2,11 @@
#include <SDL.h> #include <SDL.h>
#include <SDL_opengl.h> #include <SDL_opengl.h>
#include "gl/gl.h"
#include "gl/glu.h"
extern int global_EC; extern int global_EC;
#ifndef VIEWGL_FOVY #ifndef VIEWGL_FOVY
@ -14,7 +19,7 @@ extern int global_EC;
#define VIEWGL_ZFAR 250.0f #define VIEWGL_ZFAR 250.0f
#endif #endif
extern SDL_Surface* screen; extern SDL_Window* screen;
int videoFlags = 0; int videoFlags = 0;
/* /*
@ -43,27 +48,21 @@ int resize(int w, int h) {
} }
void initVideo(int w, int h, int bpp) { void initVideo(int w, int h, int bpp) {
const SDL_VideoInfo *videoInfo;
/*
SDL_Rect **modes;
int i;
videoInfo = SDL_GetVideoInfo( );
modes=SDL_ListModes(videoInfo->vfmt, SDL_FULLSCREEN|SDL_HWSURFACE);
if(modes == (SDL_Rect **)0){
printf("No modes available!\n");
exit(1);
}
if(modes == (SDL_Rect **)-1){ screen = SDL_CreateWindow("My Game Window",
printf("All resolutions available.\n"); SDL_WINDOWPOS_UNDEFINED,
} SDL_WINDOWPOS_UNDEFINED,
else{ w, h,
printf("Available Modes\n"); SDL_WINDOW_FULLSCREEN | SDL_WINDOW_OPENGL);
for(i=0;modes[i];++i)
printf(" %d x %d\n", modes[i]->w, modes[i]->h);
} resize(w, h);
*/
//Xperimental -- Vladislav Khorev vladislav.khorev@fishrungames.com
/*
const SDL_VideoInfo *videoInfo;
if (!videoInfo) if (!videoInfo)
ERROR("VideoInfo query failed"); ERROR("VideoInfo query failed");
@ -71,7 +70,7 @@ void initVideo(int w, int h, int bpp) {
videoFlags |= SDL_GL_DOUBLEBUFFER; videoFlags |= SDL_GL_DOUBLEBUFFER;
videoFlags |= SDL_HWPALETTE; videoFlags |= SDL_HWPALETTE;
//videoFlags |= SDL_RESIZABLE; //videoFlags |= SDL_RESIZABLE;
//videoFlags |= SDL_FULLSCREEN; //videoFlags |= SDL_WINDOW_FULLSCREEN;
if ( videoInfo->hw_available ) { if ( videoInfo->hw_available ) {
std::cerr << "Info: Using HWSURFACE" << std::endl; std::cerr << "Info: Using HWSURFACE" << std::endl;
@ -91,7 +90,7 @@ void initVideo(int w, int h, int bpp) {
if (!screen) if (!screen)
ERROR("SDL failed to generate requested VideoSurface!"); ERROR("SDL failed to generate requested VideoSurface!");
resize(w, h); resize(w, h);*/
} }
void initGL() { void initGL() {

5
font_cache.cpp Normal file → Executable file
View File

@ -39,8 +39,9 @@ namespace OpenGTA {
if (i == loadedFonts.end()) { if (i == loadedFonts.end()) {
OpenGL::DrawableFont* fnt = createFont(file, scale); OpenGL::DrawableFont* fnt = createFont(file, scale);
assert(fnt); assert(fnt);
loadedFonts.insert(std::make_pair<FontIdentifier, OpenGL::DrawableFont*>(
FontIdentifier(file, scale), fnt)); loadedFonts[FontIdentifier(file, scale)] = fnt;
return *fnt; return *fnt;
} }
return *i->second; return *i->second;

1
fx_sdt.h Normal file → Executable file
View File

@ -40,6 +40,7 @@ namespace OpenGTA {
~SoundsDB(); ~SoundsDB();
void load(const std::string & sdt_file); void load(const std::string & sdt_file);
struct Entry { struct Entry {
Entry();
Entry(PHYSFS_uint32, PHYSFS_uint32, PHYSFS_uint32); Entry(PHYSFS_uint32, PHYSFS_uint32, PHYSFS_uint32);
PHYSFS_uint32 rawStart; PHYSFS_uint32 rawStart;
PHYSFS_uint32 rawSize; PHYSFS_uint32 rawSize;

8
game_objects.cpp Normal file → Executable file
View File

@ -30,11 +30,6 @@
#include "ai.h" #include "ai.h"
#include "localplayer.h" #include "localplayer.h"
// ugly fix for win32
#ifdef WIN32
#undef ERROR
#define ERROR Util::Log::error(__FILE__, __LINE__)
#endif
#define INT2FLOAT_WRLD(c) (float(c >> 6) + float(c % 64) / 64.0f) #define INT2FLOAT_WRLD(c) (float(c >> 6) + float(c % 64) / 64.0f)
#define INT2F_DIV64(v) (float(v) / 64.0f) #define INT2F_DIV64(v) (float(v) / 64.0f)
@ -520,7 +515,8 @@ activeWeapon = chooseWeapon;
void CarSprite::setSirenAnim(bool on) { void CarSprite::setSirenAnim(bool on) {
if (!(assertDeltaById(15) && assertDeltaById(16))) { if (!(assertDeltaById(15) && assertDeltaById(16))) {
ERROR << "Trying to set siren anim on car-sprite that has no such delta!" << std::endl; //Xperimental -- Vladislav Khorev vladislav.khorev@fishrungames.com
//ERROR << "Trying to set siren anim on car-sprite that has no such delta!" << std::endl;
return; return;
} }
animState.set_item(10, on); animState.set_item(10, on);

6
gl_camera.cpp Normal file → Executable file
View File

@ -233,7 +233,11 @@ namespace OpenGL {
h = screen.getHeight() / 2; h = screen.getHeight() / 2;
int mx, my; int mx, my;
SDL_GetMouseState(&mx, &my); SDL_GetMouseState(&mx, &my);
SDL_WarpMouse(w, h);
//Xperimental -- Vladislav Khorev vladislav.khorev@fishrungames.com
//SDL_WarpMouse(w, h);
SDL_WarpMouseInWindow(screen.surface, w, h);
if ((mx == w) && (my == h)) if ((mx == w) && (my == h))
return; return;
float rot_x = (float(w) - mx) / 100; float rot_x = (float(w) - mx) / 100;

62
gl_screen.cpp Normal file → Executable file
View File

@ -27,6 +27,7 @@
#include "m_exceptions.h" #include "m_exceptions.h"
#include "image_loader.h" #include "image_loader.h"
namespace OpenGL { namespace OpenGL {
#ifndef DEFAULT_SCREEN_WIDTH #ifndef DEFAULT_SCREEN_WIDTH
#define DEFAULT_SCREEN_WIDTH 640 #define DEFAULT_SCREEN_WIDTH 640
@ -86,7 +87,7 @@ namespace OpenGL {
} }
bool Screen::getFullscreen() { bool Screen::getFullscreen() {
return (videoFlags & SDL_FULLSCREEN); return (videoFlags & SDL_WINDOW_FULLSCREEN);
} }
void Screen::setFullScreenFlag(bool v) { void Screen::setFullScreenFlag(bool v) {
@ -95,9 +96,9 @@ namespace OpenGL {
else if (!v && !getFullscreen()) else if (!v && !getFullscreen())
return; return;
if (v) if (v)
videoFlags |= SDL_FULLSCREEN; videoFlags |= SDL_WINDOW_FULLSCREEN;
else else
videoFlags ^= SDL_FULLSCREEN; videoFlags ^= SDL_WINDOW_FULLSCREEN;
} }
Screen::~Screen() { Screen::~Screen() {
@ -108,14 +109,40 @@ namespace OpenGL {
} }
void Screen::toggleFullscreen() { void Screen::toggleFullscreen() {
if (videoFlags & SDL_FULLSCREEN) if (videoFlags & SDL_WINDOW_FULLSCREEN)
videoFlags ^= SDL_FULLSCREEN; videoFlags ^= SDL_WINDOW_FULLSCREEN;
else else
videoFlags |= SDL_FULLSCREEN; videoFlags |= SDL_WINDOW_FULLSCREEN;
resize(width, height); resize(width, height);
} }
void Screen::initSDL() { void Screen::initSDL() {
//Xperimental -- Vladislav Khorev vladislav.khorev@fishrungames.com
size_t color_depth_triple[3];
for (int i = 0; i < 3; ++i)
color_depth_triple[i] = 8;
SDL_GL_SetAttribute(SDL_GL_RED_SIZE, color_depth_triple[0]);
SDL_GL_SetAttribute(SDL_GL_GREEN_SIZE, color_depth_triple[1]);
SDL_GL_SetAttribute(SDL_GL_BLUE_SIZE, color_depth_triple[2]);
SDL_GL_SetAttribute(SDL_GL_DEPTH_SIZE, 16);
SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER, 1);
#ifdef HAVE_SDL_VSYNC
if (useVsync == 1) {
SDL_GL_SetAttribute(SDL_GL_SWAP_CONTROL, 1);
INFO << "enabling vertical sync:" << " SDL" << std::endl;
}
#else
if (useVsync == 1)
WARN << "Cannot use SDL vsync - option disabled while compiling" << std::endl;
#endif
/*
int err = SDL_Init(SDL_INIT_VIDEO | SDL_INIT_TIMER); int err = SDL_Init(SDL_INIT_VIDEO | SDL_INIT_TIMER);
if (err) if (err)
//throw "SDL_Init failed: " + std::string(SDL_GetError()); //throw "SDL_Init failed: " + std::string(SDL_GetError());
@ -189,7 +216,7 @@ namespace OpenGL {
sdl_err = SDL_GetError(); sdl_err = SDL_GetError();
if (strlen(sdl_err) > 0) if (strlen(sdl_err) > 0)
ERROR << "setting sdl_gl attributes: " << sdl_err << std::endl; ERROR << "setting sdl_gl attributes: " << sdl_err << std::endl;
*/
} }
void Screen::initGL() { void Screen::initGL() {
@ -250,6 +277,25 @@ namespace OpenGL {
} }
void Screen::resize(Uint32 w, Uint32 h) { void Screen::resize(Uint32 w, Uint32 h) {
//Xperimental -- Vladislav Khorev vladislav.khorev@fishrungames.com
if (h == 0)
h = 1;
surface = SDL_CreateWindow(
"SDL2/OpenGL Demo", 0, 0, w, h,
SDL_WINDOW_OPENGL | SDL_WINDOW_RESIZABLE);
// Create an OpenGL context associated with the window.
glcontext = SDL_GL_CreateContext(surface);
glViewport(0, 0, w, h);
width = w;
height = h;
GL_CHECKERROR;
/*
if (h == 0) if (h == 0)
h = 1; h = 1;
surface = SDL_SetVideoMode(w, h, bpp, videoFlags); surface = SDL_SetVideoMode(w, h, bpp, videoFlags);
@ -263,7 +309,7 @@ namespace OpenGL {
glViewport(0, 0, w, h); glViewport(0, 0, w, h);
width = w; width = w;
height = h; height = h;
GL_CHECKERROR; GL_CHECKERROR;*/
} }
void Screen::set3DProjection() { void Screen::set3DProjection() {

13
gl_screen.h Normal file → Executable file
View File

@ -28,6 +28,10 @@
#include "Singleton.h" #include "Singleton.h"
#include "gl/gl.h"
#include "gl/glu.h"
namespace OpenGL { namespace OpenGL {
class Screen { class Screen {
public: public:
@ -62,11 +66,12 @@ namespace OpenGL {
float fieldOfView; float fieldOfView;
float nearPlane; float nearPlane;
float farPlane; float farPlane;
static const Uint32 defaultVideoFlags =
SDL_OPENGL | SDL_GL_DOUBLEBUFFER;// | SDL_HWPALETTE | SDL_HWACCEL;
//FIXME: use ^ here as well? not just SDL_GL_SetAttribute?
SDL_Surface *surface; static const Uint32 defaultVideoFlags = SDL_WINDOW_OPENGL | SDL_GL_DOUBLEBUFFER;
public:
SDL_Window *surface;
SDL_GLContext glcontext;
}; };
using namespace Loki; using namespace Loki;

9
gl_spritecache.cpp Normal file → Executable file
View File

@ -22,7 +22,7 @@
************************************************************************/ ************************************************************************/
#include <map> #include <map>
#include <cassert> #include <cassert>
#include <SDL_image.h> //#include <SDL_image.h>
#include "gl_spritecache.h" #include "gl_spritecache.h"
#include "image_loader.h" #include "image_loader.h"
#include "opengta.h" #include "opengta.h"
@ -144,13 +144,12 @@ namespace OpenGL {
} }
void SpriteCache::add(PHYSFS_uint16 sprNum, PHYSFS_sint16 remap, PagedTexture & t) { void SpriteCache::add(PHYSFS_uint16 sprNum, PHYSFS_sint16 remap, PagedTexture & t) {
loadedSprites.insert(
std::make_pair<SpriteIdentifier, PagedTexture>( loadedSprites[SpriteIdentifier(sprNum, remap, 0)] = t;
SpriteIdentifier(sprNum, remap, 0), t));
} }
void SpriteCache::add(const SpriteIdentifier & si, PagedTexture & t) { void SpriteCache::add(const SpriteIdentifier & si, PagedTexture & t) {
loadedSprites.insert(std::make_pair<SpriteIdentifier, PagedTexture>(si, t)); loadedSprites[si] = t;
} }
PagedTexture SpriteCache::create(PHYSFS_uint16 sprNum, PagedTexture SpriteCache::create(PHYSFS_uint16 sprNum,

14
main.cpp Normal file → Executable file
View File

@ -8,12 +8,16 @@ void initVideo(int w, int h, int bpp);
int global_EC = 0; int global_EC = 0;
int global_Done = 0; int global_Done = 0;
SDL_Surface* screen = NULL;
SDL_Window* screen = NULL;
SDL_Surface* surface = NULL; SDL_Surface* surface = NULL;
int city_num = 0; int city_num = 0;
int main(int argc, char* argv[]) { int main(int argc, char* argv[]) {
if (SDL_Init(SDL_INIT_VIDEO) < 0) { if (SDL_Init(SDL_INIT_VIDEO) < 0) {
std::cerr << "Fatal error initialising SDL!" << std::endl; std::cerr << "Fatal error initialising SDL!" << std::endl;
global_EC = 1; global_EC = 1;
@ -23,10 +27,14 @@ int main(int argc, char* argv[]) {
if (argc == 2) { if (argc == 2) {
city_num = atoi(argv[1]); city_num = atoi(argv[1]);
} }
SDL_EnableKeyRepeat( 100, SDL_DEFAULT_REPEAT_INTERVAL );
initVideo(1024, 768, 32); //Xperimental -- Vladislav Khorev vladislav.khorev@fishrungames.com
//SDL_EnableKeyRepeat( 100, SDL_DEFAULT_REPEAT_INTERVAL );
. initVideo(1024, 768, 32);
initGL(); initGL();
run_main(); run_main();
exit(0); exit(0);
return 0;
} }

3
read_cmp.cpp Normal file → Executable file
View File

@ -17,6 +17,9 @@
#include "m_exceptions.h" #include "m_exceptions.h"
#include "datahelper.h" #include "datahelper.h"
#include <algorithm>
/* see http://members.aol.com/form1/fixed.htm for fixed point floats: /* see http://members.aol.com/form1/fixed.htm for fixed point floats:
* int_var = (long) fixed_var >> 8; // for 8 bits after point * int_var = (long) fixed_var >> 8; // for 8 bits after point
*/ */

9
read_fnt.cpp Normal file → Executable file
View File

@ -15,6 +15,9 @@
#include "m_exceptions.h" #include "m_exceptions.h"
#include "log.h" #include "log.h"
#include <algorithm>
namespace OpenGTA { namespace OpenGTA {
Font::Font(const std::string &file) { Font::Font(const std::string &file) {
PHYSFS_file *fd = PHYSFS_openRead(file.c_str()); PHYSFS_file *fd = PHYSFS_openRead(file.c_str());
@ -105,6 +108,10 @@ namespace OpenGTA {
*/ */
} }
void Font::dumpAs(const char* filename, size_t id) { void Font::dumpAs(const char* filename, size_t id) {
//Xperimental -- Vladislav Khorev vladislav.khorev@fishrungames.com
/*
unsigned int len = chars[id]->width; unsigned int len = chars[id]->width;
len *= charHeight; len *= charHeight;
palette.apply(len, chars[id]->rawData, workBuffer, true); palette.apply(len, chars[id]->rawData, workBuffer, true);
@ -133,7 +140,7 @@ namespace OpenGTA {
} }
SDL_UnlockSurface(s); SDL_UnlockSurface(s);
SDL_SaveBMP(s, filename); SDL_SaveBMP(s, filename);
SDL_FreeSurface(s); SDL_FreeSurface(s);*/
} }
Font::Character::Character(PHYSFS_file *fd, uint8_t height) { Font::Character::Character(PHYSFS_file *fd, uint8_t height) {
PHYSFS_read(fd, static_cast<void*>(&width), 1, 1); PHYSFS_read(fd, static_cast<void*>(&width), 1, 1);

2
read_fxt.cpp Normal file → Executable file
View File

@ -14,6 +14,8 @@
#include "m_exceptions.h" #include "m_exceptions.h"
#include "log.h" #include "log.h"
#include <algorithm>
namespace OpenGTA { namespace OpenGTA {
MessageDB::MessageDB() { MessageDB::MessageDB() {
load("ENGLISH.FXT"); load("ENGLISH.FXT");

6
read_g24.cpp Normal file → Executable file
View File

@ -320,6 +320,10 @@ namespace OpenGTA {
} }
void Graphics24Bit::dumpClut(const char* fname) { void Graphics24Bit::dumpClut(const char* fname) {
//Xperimental -- Vladislav Khorev vladislav.khorev@fishrungames.com
/*
assert(pagedClutSize % 1024 == 0); assert(pagedClutSize % 1024 == 0);
//PHYSFS_uint32 num_clut = pagedClutSize / 1024; //PHYSFS_uint32 num_clut = pagedClutSize / 1024;
PHYSFS_uint32 num_pal = paletteIndexSize / 2; PHYSFS_uint32 num_pal = paletteIndexSize / 2;
@ -358,7 +362,7 @@ namespace OpenGTA {
} }
SDL_UnlockSurface(s); SDL_UnlockSurface(s);
SDL_SaveBMP(s, fname); SDL_SaveBMP(s, fname);
SDL_FreeSurface(s); SDL_FreeSurface(s);*/
} }
unsigned char* Graphics24Bit::getSpriteBitmap(size_t id, int remap = -1, Uint32 delta = 0) { unsigned char* Graphics24Bit::getSpriteBitmap(size_t id, int remap = -1, Uint32 delta = 0) {

14
read_sdt.cpp Normal file → Executable file
View File

@ -25,10 +25,18 @@
#include "m_exceptions.h" #include "m_exceptions.h"
#include "fx_sdt.h" #include "fx_sdt.h"
#include <algorithm>
#ifdef SOUND_DUMPER #ifdef SOUND_DUMPER
#include <iostream> #include <iostream>
#endif #endif
namespace OpenGTA { namespace OpenGTA {
SoundsDB::Entry::Entry() {
rawStart = 0;
rawSize = 0;
sampleRate = 0;
}
SoundsDB::Entry::Entry(PHYSFS_uint32 r1, PHYSFS_uint32 r2, PHYSFS_uint32 sr) { SoundsDB::Entry::Entry(PHYSFS_uint32 r1, PHYSFS_uint32 r2, PHYSFS_uint32 sr) {
rawStart = r1; rawStart = r1;
rawSize = r2; rawSize = r2;
@ -65,7 +73,10 @@ namespace OpenGTA {
#ifdef SOUND_DUMPER #ifdef SOUND_DUMPER
std::cout << i << " " << r1 << " " << r2 << " " << sr << std::endl; std::cout << i << " " << r1 << " " << r2 << " " << sr << std::endl;
#endif #endif
knownEntries.insert( std::make_pair<KeyType, Entry>(i, Entry(r1, r2, sr)));
auto entry = Entry(r1, r2, sr);
knownEntries[i] = entry;
} }
PHYSFS_close(dataFile); PHYSFS_close(dataFile);
@ -74,6 +85,7 @@ namespace OpenGTA {
dataFile = PHYSFS_openRead(raw_file.c_str()); dataFile = PHYSFS_openRead(raw_file.c_str());
if (!dataFile) { if (!dataFile) {
std::string sdt2(raw_file); std::string sdt2(raw_file);
transform(sdt2.begin(), sdt2.end(), sdt2.begin(), tolower); transform(sdt2.begin(), sdt2.end(), sdt2.begin(), tolower);
dataFile = PHYSFS_openRead(sdt2.c_str()); dataFile = PHYSFS_openRead(sdt2.c_str());
} }

32
sprite_anim_player.cpp Normal file → Executable file
View File

@ -23,7 +23,7 @@
#include <iostream> #include <iostream>
#include <sstream> #include <sstream>
#include <SDL_opengl.h> #include <SDL_opengl.h>
#include <unistd.h> //#include <unistd.h>
#include "gl_screen.h" #include "gl_screen.h"
#include "opengta.h" #include "opengta.h"
#include "log.h" #include "log.h"
@ -89,11 +89,15 @@ namespace OpenGTA {
} }
void run_init(const char*) { void run_init(const char*) {
PHYSFS_init("mapview"); PHYSFS_init("mapview");
PHYSFS_addToSearchPath(PHYSFS_getBaseDir(), 1); PHYSFS_addToSearchPath(PHYSFS_getBaseDir(), 1);
PHYSFS_addToSearchPath("gtadata.zip", 1); PHYSFS_addToSearchPath("gtadata.zip", 1);
OpenGL::ScreenHolder::Instance().activate(640, 480); OpenGL::ScreenHolder::Instance().activate(640, 480);
SDL_EnableKeyRepeat( 100, SDL_DEFAULT_REPEAT_INTERVAL );
//Xperimental -- Vladislav Khorev vladislav.khorev@fishrungames.com
//SDL_EnableKeyRepeat( 100, SDL_DEFAULT_REPEAT_INTERVAL );
OpenGTA::StyleHolder::Instance().load(style_file); OpenGTA::StyleHolder::Instance().load(style_file);
OpenGTA::StyleHolder::Instance().get().setDeltaHandling(true); OpenGTA::StyleHolder::Instance().get().setDeltaHandling(true);
@ -218,10 +222,15 @@ void drawScene(Uint32 ticks) {
glPopMatrix(); glPopMatrix();
} }
SDL_GL_SwapBuffers(); //Xperimental -- Vladislav Khorev vladislav.khorev@fishrungames.com
SDL_GL_SwapWindow(OpenGL::ScreenHolder::Instance().surface);
GL_CHECKERROR; GL_CHECKERROR;
} }
/*
void handleKeyPress( SDL_keysym *keysym ) { void handleKeyPress( SDL_keysym *keysym ) {
OpenGL::Camera & cam = OpenGL::CameraHolder::Instance(); OpenGL::Camera & cam = OpenGL::CameraHolder::Instance();
OpenGTA::GraphicsBase & style = OpenGTA::StyleHolder::Instance().get(); OpenGTA::GraphicsBase & style = OpenGTA::StyleHolder::Instance().get();
@ -384,7 +393,7 @@ void handleKeyPress( SDL_keysym *keysym ) {
if (playWithCar) if (playWithCar)
safe_try_model(car_model); safe_try_model(car_model);
} }
} }*/
void usage(const char* a0) { void usage(const char* a0) {
std::cout << "USAGE: " << a0 << " [style-filename]" << std::endl; std::cout << "USAGE: " << a0 << " [style-filename]" << std::endl;
@ -408,6 +417,10 @@ void usage(const char* a0) {
} }
void parse_args(int argc, char* argv[]) { void parse_args(int argc, char* argv[]) {
//Xperimental -- Vladislav Khorev vladislav.khorev@fishrungames.com
/*
int index; int index;
int c; int c;
@ -429,7 +442,7 @@ void parse_args(int argc, char* argv[]) {
} }
for (index = optind; index < argc; index++) for (index = optind; index < argc; index++)
style_file = std::string(argv[index]); style_file = std::string(argv[index]);*/
} }
void run_main() { void run_main() {
@ -449,14 +462,19 @@ void run_main() {
while (SDL_PollEvent(&event)) { while (SDL_PollEvent(&event)) {
switch(event.type) { switch(event.type) {
case SDL_KEYDOWN: case SDL_KEYDOWN:
handleKeyPress(&event.key.keysym); //Xperimental -- Vladislav Khorev vladislav.khorev@fishrungames.com
//handleKeyPress(&event.key.keysym);
break; break;
case SDL_KEYUP: case SDL_KEYUP:
// handleKeyUp(&event.key.keysym); // handleKeyUp(&event.key.keysym);
break; break;
//Xperimental -- Vladislav Khorev vladislav.khorev@fishrungames.com
/*
case SDL_VIDEORESIZE: case SDL_VIDEORESIZE:
OpenGL::ScreenHolder::Instance().resize(event.resize.w, event.resize.h); OpenGL::ScreenHolder::Instance().resize(event.resize.w, event.resize.h);
break; break;*/
case SDL_QUIT: case SDL_QUIT:
global_Done = 1; global_Done = 1;
break; break;

3
spritemanager.cpp Normal file → Executable file
View File

@ -628,7 +628,8 @@ SpriteObject::Animation & SpriteManager::getAnimationById(const Uint32 & id) {
void SpriteManager::registerAnimation(const Uint32 & id, void SpriteManager::registerAnimation(const Uint32 & id,
const SpriteObject::Animation & anim) { const SpriteObject::Animation & anim) {
animations.insert(std::make_pair<Uint32, SpriteObject::Animation>(id, anim));
animations[id] = anim;
} }
void SpriteManager::setDrawBBox(bool v) { void SpriteManager::setDrawBBox(bool v) {

10
util/cell_iterator.cpp Normal file → Executable file
View File

@ -75,20 +75,20 @@ namespace Util {
std::pair<bool, CellIterator> CellIterator::findTypeInCol(uint8_t t) const { std::pair<bool, CellIterator> CellIterator::findTypeInCol(uint8_t t) const {
if (isBlockType(t)) if (isBlockType(t))
return std::make_pair<bool, CellIterator>(true, *this); return std::make_pair<bool, CellIterator>(true, CellIterator(*this));
CellIterator below = down(); CellIterator below = down();
while (below.isValid()) { while (below.isValid()) {
if (below.isBlockType(t)) if (below.isBlockType(t))
return std::make_pair<bool, CellIterator>(true, below); return std::make_pair<bool, CellIterator>(true, CellIterator(below));
below = below.down(); below = below.down();
} }
CellIterator above = up(); CellIterator above = up();
while (above.isValid()) { while (above.isValid()) {
if (above.isBlockType(t)) if (above.isBlockType(t))
return std::make_pair<bool, CellIterator>(true, above); return std::make_pair<bool, CellIterator>(true, CellIterator(above));
above = above.up(); above = above.up();
} }
return std::make_pair<bool, CellIterator>(false, *this); return std::make_pair<bool, CellIterator>(false, CellIterator(*this));
} }
std::pair<bool, CellIterator> CellIterator::findNeighbourWithType( std::pair<bool, CellIterator> CellIterator::findNeighbourWithType(
@ -135,7 +135,7 @@ namespace Util {
// if (p.first) INFO << p.second.x << " " << p.second.y << " " << p.second.z << std::endl; // if (p.first) INFO << p.second.x << " " << p.second.y << " " << p.second.z << std::endl;
if (p.first) return p; if (p.first) return p;
} }
return std::make_pair<bool, CellIterator>(false, *this); return std::make_pair<bool, CellIterator>(false, CellIterator(*this));
} }

41
util/gui.cpp Normal file → Executable file
View File

@ -15,13 +15,13 @@ namespace GUI {
id(0), rect(), color(), borderColor(), drawBorder(false), id(0), rect(), color(), borderColor(), drawBorder(false),
manager(ManagerHolder::Instance()) { manager(ManagerHolder::Instance()) {
copyRect(r); copyRect(r);
color.r = 255; color.g = 255; color.b = 255; color.unused = 255; color.r = 255; color.g = 255; color.b = 255; color.a = 255;
} }
Object::Object(const size_t Id, const SDL_Rect & r) : Object::Object(const size_t Id, const SDL_Rect & r) :
id(Id), rect(), color(), borderColor(), drawBorder(false), id(Id), rect(), color(), borderColor(), drawBorder(false),
manager(ManagerHolder::Instance()) { manager(ManagerHolder::Instance()) {
copyRect(r); copyRect(r);
color.r = 255; color.g = 255; color.b = 255; color.unused = 255; color.r = 255; color.g = 255; color.b = 255; color.a = 255;
} }
Object::Object(const size_t Id, const SDL_Rect & r, const SDL_Color & c) : Object::Object(const size_t Id, const SDL_Rect & r, const SDL_Color & c) :
id(Id), rect(), color(), borderColor(), drawBorder(false), id(Id), rect(), color(), borderColor(), drawBorder(false),
@ -33,7 +33,7 @@ namespace GUI {
glEnable (GL_BLEND); glEnable (GL_BLEND);
glBlendFunc (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); glBlendFunc (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
glColor4ub(color.r, color.g, color.b, color.unused); glColor4ub(color.r, color.g, color.b, color.a);
glDisable(GL_TEXTURE_2D); glDisable(GL_TEXTURE_2D);
glBegin(GL_QUADS); glBegin(GL_QUADS);
glVertex2i(rect.x, rect.y); glVertex2i(rect.x, rect.y);
@ -47,7 +47,7 @@ namespace GUI {
} }
void Object::draw_border() { void Object::draw_border() {
glColor4ub(borderColor.r, borderColor.g, borderColor.b, glColor4ub(borderColor.r, borderColor.g, borderColor.b,
borderColor.unused); borderColor.a);
glBegin(GL_LINE_LOOP); glBegin(GL_LINE_LOOP);
glVertex2i(rect.x, rect.y); glVertex2i(rect.x, rect.y);
glVertex2i(rect.x + rect.w, rect.y); glVertex2i(rect.x + rect.w, rect.y);
@ -65,13 +65,13 @@ namespace GUI {
color.r = src.r; color.r = src.r;
color.g = src.g; color.g = src.g;
color.b = src.b; color.b = src.b;
color.unused = src.unused; color.a = src.a;
} }
void TexturedObject::draw() { void TexturedObject::draw() {
if (texId == 0) if (texId == 0)
return; return;
const OpenGL::PagedTexture & tex = manager.getCachedImage(texId); const OpenGL::PagedTexture & tex = manager.getCachedImage(texId);
glColor4ub(color.r, color.g, color.b, color.unused); glColor4ub(color.r, color.g, color.b, color.a);
glEnable(GL_TEXTURE_2D); glEnable(GL_TEXTURE_2D);
glBindTexture(GL_TEXTURE_2D, tex.inPage); glBindTexture(GL_TEXTURE_2D, tex.inPage);
glBegin(GL_QUADS); glBegin(GL_QUADS);
@ -96,7 +96,7 @@ namespace GUI {
assert(animation); assert(animation);
size_t texId = animation->getCurrentFrame(); size_t texId = animation->getCurrentFrame();
const OpenGL::PagedTexture & tex = manager.getCachedImage(texId); const OpenGL::PagedTexture & tex = manager.getCachedImage(texId);
glColor4ub(color.r, color.g, color.b, color.unused); glColor4ub(color.r, color.g, color.b, color.a);
glEnable(GL_TEXTURE_2D); glEnable(GL_TEXTURE_2D);
glBindTexture(GL_TEXTURE_2D, tex.inPage); glBindTexture(GL_TEXTURE_2D, tex.inPage);
glBegin(GL_QUADS); glBegin(GL_QUADS);
@ -116,7 +116,7 @@ namespace GUI {
void Label::draw() { void Label::draw() {
glPushMatrix(); glPushMatrix();
glColor4ub(color.r, color.g, color.b, color.unused); glColor4ub(color.r, color.g, color.b, color.a);
glEnable(GL_TEXTURE_2D); glEnable(GL_TEXTURE_2D);
if (align == 0) { if (align == 0) {
glTranslatef(rect.x, rect.y, 0); glTranslatef(rect.x, rect.y, 0);
@ -146,7 +146,7 @@ namespace GUI {
void Pager::draw() { void Pager::draw() {
const OpenGL::PagedTexture & tex = manager.getCachedImage(texId); const OpenGL::PagedTexture & tex = manager.getCachedImage(texId);
glColor4ub(color.r, color.g, color.b, color.unused); glColor4ub(color.r, color.g, color.b, color.a);
glEnable(GL_TEXTURE_2D); glEnable(GL_TEXTURE_2D);
glBindTexture(GL_TEXTURE_2D, tex.inPage); glBindTexture(GL_TEXTURE_2D, tex.inPage);
glBegin(GL_QUADS); glBegin(GL_QUADS);
@ -163,11 +163,11 @@ namespace GUI {
glEnable(GL_SCISSOR_TEST); glEnable(GL_SCISSOR_TEST);
glPushMatrix(); glPushMatrix();
glColor4ub(color.r, color.g, color.b, color.unused); glColor4ub(color.r, color.g, color.b, color.a);
glTranslatef(rect.x+offset, rect.y+4, 0); glTranslatef(rect.x+offset, rect.y+4, 0);
int slen = (int)font->drawString("test - hello world, this is a really long message. it will not end. never... or maybe sometime, but not yet. The end."); int slen = (int)font->drawString("test - hello world, this is a really long message. it will not end. never... or maybe sometime, but not yet. The end.");
if (slen + offset < -10) { if (slen + offset < -10) {
color.unused = 0; color.a = 0;
manager.remove(this); manager.remove(this);
} }
INFO << slen <<" " << offset << std::endl; INFO << slen <<" " << offset << std::endl;
@ -254,11 +254,11 @@ namespace GUI {
} }
void Manager::cacheImageRAW(const std::string & file, size_t k) { void Manager::cacheImageRAW(const std::string & file, size_t k) {
texCache.insert(std::make_pair<size_t, OpenGL::PagedTexture>(k, ImageUtil::loadImageRAW(file))); texCache.insert(std::make_pair(k, ImageUtil::loadImageRAW(file)));
} }
void Manager::cacheImageRAT(const std::string & file, const std::string & palette, size_t k) { void Manager::cacheImageRAT(const std::string & file, const std::string & palette, size_t k) {
texCache.insert(std::make_pair<size_t, OpenGL::PagedTexture>(k, texCache.insert(std::make_pair(k,
ImageUtil::loadImageRATWithPalette(file, palette))); ImageUtil::loadImageRATWithPalette(file, palette)));
} }
@ -266,7 +266,7 @@ namespace GUI {
OpenGTA::GraphicsBase & graphics = OpenGTA::StyleHolder::Instance().get(); OpenGTA::GraphicsBase & graphics = OpenGTA::StyleHolder::Instance().get();
PHYSFS_uint16 t = graphics.spriteNumbers.reIndex(id, OpenGTA::GraphicsBase::SpriteNumbers::ARROW); PHYSFS_uint16 t = graphics.spriteNumbers.reIndex(id, OpenGTA::GraphicsBase::SpriteNumbers::ARROW);
OpenGTA::GraphicsBase::SpriteInfo * info = graphics.getSprite(t); OpenGTA::GraphicsBase::SpriteInfo * info = graphics.getSprite(t);
texCache.insert(std::make_pair<size_t, OpenGL::PagedTexture>( texCache.insert(std::make_pair(
id, OpenGL::SpriteCacheHolder::Instance().createSprite(size_t(t), remap, 0, info) id, OpenGL::SpriteCacheHolder::Instance().createSprite(size_t(t), remap, 0, info)
)); ));
return ImageUtil::WidthHeightPair(info->w, info->h); return ImageUtil::WidthHeightPair(info->w, info->h);
@ -284,7 +284,7 @@ namespace GUI {
if (l == guiLayers.end()) { if (l == guiLayers.end()) {
GuiObjectList list; GuiObjectList list;
list.push_back(obj); list.push_back(obj);
guiLayers.insert(std::make_pair<uint8_t, GuiObjectList>(onLevel, list)); guiLayers.insert(std::make_pair(onLevel, list));
return; return;
} }
GuiObjectList & list = l->second; GuiObjectList & list = l->second;
@ -375,7 +375,7 @@ namespace GUI {
} }
void Manager::createAnimation(const std::vector<uint16_t> & indices, uint16_t fps, size_t k) { void Manager::createAnimation(const std::vector<uint16_t> & indices, uint16_t fps, size_t k) {
Animation * anim = new Animation(indices, fps); Animation * anim = new Animation(indices, fps);
guiAnimations.insert(std::make_pair<size_t, Animation*>(k, anim)); guiAnimations.insert(std::make_pair(k, anim));
anim->set(Util::Animation::PLAY_FORWARD, Util::Animation::LOOP); anim->set(Util::Animation::PLAY_FORWARD, Util::Animation::LOOP);
} }
@ -455,6 +455,9 @@ namespace GUI {
void screen_gamma_callback(float v) { void screen_gamma_callback(float v) {
//Xperimental -- Vladislav Khorev vladislav.khorev@fishrungames.com
/*
screen_gamma = v; screen_gamma = v;
SDL_SetGamma(v, v, v); SDL_SetGamma(v, v, v);
#ifdef WITH_LUA #ifdef WITH_LUA
@ -481,12 +484,8 @@ namespace GUI {
os << "Gamma: " << v; os << "Gamma: " << v;
static_cast<Label*>(o)->text = os.str(); static_cast<Label*>(o)->text = os.str();
} }
/*
Object * o2 = ManagerHolder::Instance().findObject(1001);
if (o2) {
static_cast<ImageStatusDisplay*>(o2)->number = screen_gamma * 3;
}*/
*/
} }
AnimStatusDisplay* wantedLevel = NULL; AnimStatusDisplay* wantedLevel = NULL;

21
util/image_loader.cpp Normal file → Executable file
View File

@ -29,7 +29,9 @@
#include "cistring.h" #include "cistring.h"
#include "opengta.h" #include "opengta.h"
#include "physfsrwops.h" #include "physfsrwops.h"
#include "SDL_image.h"
//Xperimental -- Vladislav Khorev vladislav.khorev@fishrungames.com
//#include "SDL_image.h"
#include "m_exceptions.h" #include "m_exceptions.h"
namespace ImageUtil { namespace ImageUtil {
@ -76,7 +78,7 @@ using OpenGL::PagedTexture;
if (!(bpp && bpp * width * height == size)) if (!(bpp && bpp * width * height == size))
ERROR << "could not identify image: " << name << " size: " << size << std::endl; ERROR << "could not identify image: " << name << " size: " << size << std::endl;
return std::make_pair<uint16_t, uint16_t>(width, height); return std::make_pair(width, height);
} }
@ -169,6 +171,16 @@ using OpenGL::PagedTexture;
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_NEAREST); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_NEAREST);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
//Xperimental -- Vladislav Khorev vladislav.khorev@fishrungames.com
if (rgba) {
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, w, h, 0, GL_RGBA, GL_UNSIGNED_BYTE, pixels);
}
else {
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, w, h, 0, GL_RGB, GL_UNSIGNED_BYTE, pixels);
}
/*
if (rgba) { if (rgba) {
if (mipmapTextures) if (mipmapTextures)
gluBuild2DMipmaps(GL_TEXTURE_2D, 4, w, h, GL_RGBA, GL_UNSIGNED_BYTE, pixels); gluBuild2DMipmaps(GL_TEXTURE_2D, 4, w, h, GL_RGBA, GL_UNSIGNED_BYTE, pixels);
@ -180,7 +192,10 @@ using OpenGL::PagedTexture;
gluBuild2DMipmaps(GL_TEXTURE_2D, 3, w, h, GL_RGB, GL_UNSIGNED_BYTE, pixels); gluBuild2DMipmaps(GL_TEXTURE_2D, 3, w, h, GL_RGB, GL_UNSIGNED_BYTE, pixels);
else else
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, w, h, 0, GL_RGB, GL_UNSIGNED_BYTE, pixels); glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, w, h, 0, GL_RGB, GL_UNSIGNED_BYTE, pixels);
} }*/
if (supportedMaxAnisoDegree > 1.0f) if (supportedMaxAnisoDegree > 1.0f)
glTexParameterfv(GL_TEXTURE_2D, GL_TEXTURE_MAX_ANISOTROPY_EXT, &supportedMaxAnisoDegree); glTexParameterfv(GL_TEXTURE_2D, GL_TEXTURE_MAX_ANISOTROPY_EXT, &supportedMaxAnisoDegree);

4
util/key_handler.cpp Normal file → Executable file
View File

@ -20,7 +20,9 @@
* 3. This notice may not be removed or altered from any source * * 3. This notice may not be removed or altered from any source *
* distribution. * * distribution. *
************************************************************************/ ************************************************************************/
#include <SDL_keysym.h>
//Xperimental -- Vladislav Khorev vladislav.khorev@fishrungames.com
//#include <SDL_keysym.h>
#include "key_handler.h" #include "key_handler.h"
#include "log.h" #include "log.h"

11
util/map_helper.cpp Normal file → Executable file
View File

@ -3,7 +3,7 @@
namespace Util { namespace Util {
void SpriteCreationArea::setRects(const SDL_Rect & allowed, const SDL_Rect & denied) { void SpriteCreationArea::setRects(const SDL_Rect & allowed, const SDL_Rect & denied) {
validRects = std::make_pair<SDL_Rect, SDL_Rect>(allowed, denied); validRects = std::make_pair(allowed, denied);
onScreen = denied; onScreen = denied;
} }
@ -25,11 +25,12 @@ namespace Util {
TupleOfUint8 SpriteCreationArea::getValidCoord() { TupleOfUint8 SpriteCreationArea::getValidCoord() {
uint32_t x = rnd.nextUint(validRects.first.w) + validRects.first.x; uint32_t x = rnd.nextUint(validRects.first.w) + validRects.first.x;
uint32_t y = rnd.nextUint(validRects.first.h) + validRects.first.y; uint32_t y = rnd.nextUint(validRects.first.h) + validRects.first.y;
return std::make_pair<uint8_t, uint8_t>(x, y); return std::make_pair(x, y);
} }
int item_count(MapOfPair2Int & m, int a, int b) { int item_count(MapOfPair2Int & m, int a, int b) {
MapOfPair2Int::iterator j = m.find( std::make_pair<int, int>(a, b) );
const auto& j = m.find({a, b});
if (j == m.end()) if (j == m.end())
return 0; return 0;
return j->second; return j->second;
@ -37,13 +38,13 @@ namespace Util {
void register_item1(MapOfPair2Int & m, int a, int b) { void register_item1(MapOfPair2Int & m, int a, int b) {
m.insert( std::make_pair< Pair2Int, int>( m.insert( std::make_pair< Pair2Int, int>(
std::make_pair<int, int>(a, b), std::make_pair(a, b),
1) 1)
); );
} }
void register_item(MapOfPair2Int & m, int a, int b) { void register_item(MapOfPair2Int & m, int a, int b) {
Pair2Int _p(std::make_pair<int, int>(a, b)); Pair2Int _p(std::make_pair(a, b));
MapOfPair2Int::iterator j = m.find(_p); MapOfPair2Int::iterator j = m.find(_p);
if (j == m.end()) if (j == m.end())
register_item1(m, a, b); register_item1(m, a, b);

2
util/map_helper.h Normal file → Executable file
View File

@ -31,7 +31,7 @@ namespace Util {
*/ */
template <typename T> template <typename T>
struct lt_pair { struct lt_pair {
bool operator() (const T & a, const T & b) { bool operator() (const T & a, const T & b) const {
if (a.first < b.first) if (a.first < b.first)
return true; return true;
if (a.first > b.first) if (a.first > b.first)

3
util/physfsrwops.h Normal file → Executable file
View File

@ -25,6 +25,9 @@
#include "physfs.h" #include "physfs.h"
#include "SDL.h" #include "SDL.h"
//Xperimental -- Vladislav Khorev vladislav.khorev@fishrungames.com
#define __EXPORT__
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {
#endif #endif

8
util/timer.cpp Normal file → Executable file
View File

@ -134,16 +134,16 @@ void Timer::checkSimEvents() {
void Timer::registerCallback(bool simTime, CallbackType & c, const uint32_t & b, const uint32_t & e) { void Timer::registerCallback(bool simTime, CallbackType & c, const uint32_t & b, const uint32_t & e) {
if (simTime) if (simTime)
simTimeEvents.insert(std::make_pair<uint32_t, TimeEvent>(b, TimeEvent(b, e, c))); simTimeEvents.insert(std::make_pair(b, TimeEvent(b, e, c)));
else else
realTimeEvents.insert(std::make_pair<uint32_t, TimeEvent>(b, TimeEvent(b, e, c))); realTimeEvents.insert(std::make_pair(b, TimeEvent(b, e, c)));
} }
void Timer::registerCallback(bool simTime, CallbackType & c, const uint32_t & b) { void Timer::registerCallback(bool simTime, CallbackType & c, const uint32_t & b) {
if (simTime) if (simTime)
simTimeEvents.insert(std::make_pair<uint32_t, TimeEvent>(b, TimeEvent(b, c))); simTimeEvents.insert(std::make_pair(b, TimeEvent(b, c)));
else else
realTimeEvents.insert(std::make_pair<uint32_t, TimeEvent>(b, TimeEvent(b, c))); realTimeEvents.insert(std::make_pair(b, TimeEvent(b, c)));
} }
void Timer::clearAllEvents() { void Timer::clearAllEvents() {

67
viewer.cpp Normal file → Executable file
View File

@ -24,7 +24,7 @@
#include <iomanip> #include <iomanip>
#include <SDL_opengl.h> #include <SDL_opengl.h>
#include <sstream> #include <sstream>
#include <unistd.h> //#include <unistd.h>
#include "blockanim.h" #include "blockanim.h"
#include "dataholder.h" #include "dataholder.h"
#include "entity_controller.h" #include "entity_controller.h"
@ -56,7 +56,7 @@
#define removePedById removePed #define removePedById removePed
#define addPed add #define addPed add
extern SDL_Surface* screen; extern SDL_Window* screen;
extern int global_EC; extern int global_EC;
extern int global_Done; extern int global_Done;
extern int global_Restart; extern int global_Restart;
@ -66,7 +66,8 @@ OpenGTA::CityView *city = NULL;
//OpenGL::DrawableFont* m_font = NULL; //OpenGL::DrawableFont* m_font = NULL;
GUI::Label * fps_label = NULL; GUI::Label * fps_label = NULL;
int city_num = 0; extern int city_num; //In main.cpp - Xperimental -- Vladislav Khorev vladislav.khorev@fishrungames.com
const char* styles_8[3] = { "STYLE001.GRY", "STYLE002.GRY", "STYLE003.GRY" }; const char* styles_8[3] = { "STYLE001.GRY", "STYLE002.GRY", "STYLE003.GRY" };
const char* styles_24[3] = { "STYLE001.G24", "STYLE002.G24", "STYLE003.G24" }; const char* styles_24[3] = { "STYLE001.G24", "STYLE002.G24", "STYLE003.G24" };
const char* cities[3] = { "NYC.CMP", "SANB.CMP", "MIAMI.CMP" }; const char* cities[3] = { "NYC.CMP", "SANB.CMP", "MIAMI.CMP" };
@ -142,11 +143,16 @@ void print_usage(const char* argv0) {
" -M k : texture mipmaps: 0 = disable, 1 = enable" << std::endl << " -M k : texture mipmaps: 0 = disable, 1 = enable" << std::endl <<
" -x k : scale2x sprites: 0 = disable, 1 = enable" << std::endl << " -x k : scale2x sprites: 0 = disable, 1 = enable" << std::endl <<
" -v k : vertical sync: 0 = disable, 1 = try with SDL" << " -v k : vertical sync: 0 = disable, 1 = try with SDL" <<
//Xperimental -- Vladislav Khorev vladislav.khorev@fishrungames.com
/*
#ifdef LINUX #ifdef LINUX
", 2 = try with GLX" << ", 2 = try with GLX" <<
#elif WIN32 #elif WIN32
", 2 = try with GLW" << ", 2 = try with GLW" <<
#endif #endif
*/
std::endl << std::endl <<
" -a f : anisotropic texture filtering degree: 1.0 = disabled" " -a f : anisotropic texture filtering degree: 1.0 = disabled"
<< std::endl << << std::endl <<
@ -164,6 +170,10 @@ void print_usage(const char* argv0) {
} }
void print_version_info() { void print_version_info() {
//Xperimental -- Vladislav Khorev vladislav.khorev@fishrungames.com
/*
#define PRINT_FORMATED(spaces) std::setw(spaces) << std::left << #define PRINT_FORMATED(spaces) std::setw(spaces) << std::left <<
#define PRINT_OFFSET PRINT_FORMATED(19) #define PRINT_OFFSET PRINT_FORMATED(19)
std::cout << PRINT_OFFSET "OpenGTA version:" << OGTA_VERSION_INFO << std::endl << std::cout << PRINT_OFFSET "OpenGTA version:" << OGTA_VERSION_INFO << std::endl <<
@ -222,9 +232,16 @@ void print_version_info() {
PRINT_OFFSET "compiler: " << USED_GCC_VERSION PRINT_OFFSET "compiler: " << USED_GCC_VERSION
<< std::endl; << std::endl;
*/
} }
void parse_args(int argc, char* argv[]) { void parse_args(int argc, char* argv[]) {
//Xperimental -- Vladislav Khorev vladislav.khorev@fishrungames.com
/*
int index; int index;
int c; int c;
@ -299,7 +316,7 @@ void parse_args(int argc, char* argv[]) {
if (city_num > 2) { if (city_num > 2) {
ERROR << "Invalid city number: " << city_num << std::endl; ERROR << "Invalid city number: " << city_num << std::endl;
exit(1); exit(1);
} }*/
} }
void run_init(const char* prg_name) { void run_init(const char* prg_name) {
@ -438,8 +455,9 @@ void run_init(const char* prg_name) {
// create screen // create screen
screen.activate(arg_screen_w, arg_screen_h); screen.activate(arg_screen_w, arg_screen_h);
SDL_EnableKeyRepeat( 0, 0 );
//SDL_EnableKeyRepeat( 100, SDL_DEFAULT_REPEAT_INTERVAL ); //Xperimental -- Vladislav Khorev vladislav.khorev@fishrungames.com
//SDL_EnableKeyRepeat( 0, 0 );
// more setup; that requires an active screen // more setup; that requires an active screen
#ifdef WITH_LUA #ifdef WITH_LUA
@ -516,6 +534,8 @@ void print_position() {
} }
/*
void handleKeyUp( SDL_keysym *keysym) { void handleKeyUp( SDL_keysym *keysym) {
switch ( keysym->sym ) { switch ( keysym->sym ) {
case 'j': case 'j':
@ -544,7 +564,7 @@ void handleKeyUp( SDL_keysym *keysym) {
default: default:
break; break;
} }
} }*/
void draw_mapmode(); void draw_mapmode();
@ -672,7 +692,6 @@ void show_gamma_config() {
GUI::ScrollBar * sb = new GUI::ScrollBar(GUI::GAMMA_SCROLLBAR_ID, r); GUI::ScrollBar * sb = new GUI::ScrollBar(GUI::GAMMA_SCROLLBAR_ID, r);
sb->color.r = sb->color.g = sb->color.b = 180; sb->color.r = sb->color.g = sb->color.b = 180;
sb->color.unused = 255;
sb->innerColor.r = 250; sb->innerColor.r = 250;
sb->value = screen_gamma/2; sb->value = screen_gamma/2;
sb->changeCB = GUI::ScrollBar::SC_Functor(GUI::screen_gamma_callback); sb->changeCB = GUI::ScrollBar::SC_Functor(GUI::screen_gamma_callback);
@ -722,6 +741,8 @@ void car_toggle() {
} }
/*
void handleKeyPress( SDL_keysym *keysym ) { void handleKeyPress( SDL_keysym *keysym ) {
GLfloat* cp = city->getCamPos(); GLfloat* cp = city->getCamPos();
mapPos[0] = cp[0]; mapPos[1] = cp[1]; mapPos[2] = cp[2]; mapPos[0] = cp[0]; mapPos[1] = cp[1]; mapPos[2] = cp[2];
@ -822,13 +843,6 @@ void handleKeyPress( SDL_keysym *keysym ) {
case SDLK_LSHIFT: case SDLK_LSHIFT:
toggle_player_run(); toggle_player_run();
break; break;
/*
case SDLK_F6:
tex_flip = (tex_flip ? 0 : 1);
INFO << "flipping: " << tex_flip << std::endl;
city->setTexFlipTest(tex_flip);
break;
*/
case SDLK_LCTRL: case SDLK_LCTRL:
OpenGTA::LocalPlayer::Instance().getCtrl().setFireWeapon(); OpenGTA::LocalPlayer::Instance().getCtrl().setFireWeapon();
break; break;
@ -862,21 +876,9 @@ void handleKeyPress( SDL_keysym *keysym ) {
break; break;
case '9': case '9':
//OpenGTA::SpriteManagerHolder::Instance().getPedById(0xffffffff).equip(9); //OpenGTA::SpriteManagerHolder::Instance().getPedById(0xffffffff).equip(9);
/*
ped_anim -= 1; if (ped_anim < 0) ped_anim = 0;
pedAnim.firstFrameOffset = ped_anim;
INFO << "switching to sprite: " << ped_anim << std::endl;
OpenGTA::SpriteManagerHolder::Instance().getPedById(0xffffffff).setAnimation(pedAnim);
*/
break; break;
case '0': case '0':
OpenGTA::LocalPlayer::Instance().getCtrl().setActiveWeapon(0); OpenGTA::LocalPlayer::Instance().getCtrl().setActiveWeapon(0);
/*
ped_anim += 1; if (ped_anim > 200) ped_anim = 200;
pedAnim.firstFrameOffset = ped_anim;
INFO << "switching to sprite: " << ped_anim << std::endl;
OpenGTA::SpriteManagerHolder::Instance().getPedById(0xffffffff).setAnimation(pedAnim);
*/
//OpenGTA::SpriteManagerHolder::Instance().getPedById(0xffffffff).equip(0); //OpenGTA::SpriteManagerHolder::Instance().getPedById(0xffffffff).equip(0);
break; break;
case 'w': case 'w':
@ -960,7 +962,7 @@ void handleKeyPress( SDL_keysym *keysym ) {
} }
city->setPosition(mapPos[0], mapPos[1], mapPos[2]); city->setPosition(mapPos[0], mapPos[1], mapPos[2]);
} }*/
void drawScene(Uint32 ticks) { void drawScene(Uint32 ticks) {
glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
@ -998,7 +1000,7 @@ void drawScene(Uint32 ticks) {
num_frames_drawn += 1; num_frames_drawn += 1;
glEnable(GL_DEPTH_TEST); glEnable(GL_DEPTH_TEST);
SDL_GL_SwapBuffers(); SDL_GL_SwapWindow(OpenGL::ScreenHolder::Instance().surface);
} }
void draw_mapmode() { void draw_mapmode() {
@ -1086,7 +1088,7 @@ void draw_mapmode() {
} }
glEnable(GL_TEXTURE_2D); glEnable(GL_TEXTURE_2D);
SDL_GL_SwapBuffers(); SDL_GL_SwapWindow(screen.surface);
SDL_Delay(20); SDL_Delay(20);
} }
@ -1162,6 +1164,9 @@ void run_main() {
while(!global_Done && !global_EC) { while(!global_Done && !global_EC) {
while (SDL_PollEvent(&event)) { while (SDL_PollEvent(&event)) {
switch(event.type) { switch(event.type) {
//Xperimental -- Vladislav Khorev vladislav.khorev@fishrungames.com
/*
case SDL_ACTIVEEVENT: case SDL_ACTIVEEVENT:
if (event.active.gain == 0) if (event.active.gain == 0)
paused = 1; paused = 1;
@ -1176,7 +1181,7 @@ void run_main() {
break; break;
case SDL_VIDEORESIZE: case SDL_VIDEORESIZE:
OpenGL::ScreenHolder::Instance().resize(event.resize.w, event.resize.h); OpenGL::ScreenHolder::Instance().resize(event.resize.w, event.resize.h);
break; break;*/
case SDL_QUIT: case SDL_QUIT:
global_Done = 1; global_Done = 1;
break; break;